Revision: 200949
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 17 Dec 2009 08:55:21 +0200
changeset 0 5a93021fdf25
child 1 40cb640ef159
Revision: 200949 Kit: 200951
accesspointcontrol/apcontrollistplugin/data/10281BB4.rss
accesspointcontrol/apcontrollistplugin/data/apcontrollistpluginrsc.rss
accesspointcontrol/apcontrollistplugin/group/apcontrollistplugin.mmp
accesspointcontrol/apcontrollistplugin/group/apcontrollistpluginicons_dc.mk
accesspointcontrol/apcontrollistplugin/group/bld.inf
accesspointcontrol/apcontrollistplugin/inc/apcontrollistapiwrapper.h
accesspointcontrol/apcontrollistplugin/inc/apcontrollistbox.h
accesspointcontrol/apcontrollistplugin/inc/apcontrollistboxmodel.h
accesspointcontrol/apcontrollistplugin/inc/apcontrollistcapschange.h
accesspointcontrol/apcontrollistplugin/inc/apcontrollistplugin.h
accesspointcontrol/apcontrollistplugin/inc/apcontrollistplugin.hrh
accesspointcontrol/apcontrollistplugin/inc/apcontrollistplugincontainer.h
accesspointcontrol/apcontrollistplugin/inc/apcontrollistpluginlogger.h
accesspointcontrol/apcontrollistplugin/loc/apcontrollistplugin.loc
accesspointcontrol/apcontrollistplugin/rom/APControlListPlugin.iby
accesspointcontrol/apcontrollistplugin/rom/APControlListPluginResources.iby
accesspointcontrol/apcontrollistplugin/src/apcontrollistapiwrapper.cpp
accesspointcontrol/apcontrollistplugin/src/apcontrollistbox.cpp
accesspointcontrol/apcontrollistplugin/src/apcontrollistboxmodel.cpp
accesspointcontrol/apcontrollistplugin/src/apcontrollistcapschange.cpp
accesspointcontrol/apcontrollistplugin/src/apcontrollistplugin.cpp
accesspointcontrol/apcontrollistplugin/src/apcontrollistplugincontainer.cpp
accesspointcontrol/apcontrollistplugin/src/apcontrollistpluginimplementationtable.cpp
accesspointcontrol/apcontrollistplugin/src/apcontrollistpluginlogger.cpp
alwayson_net_plugin/group/bld.inf
alwayson_net_plugin/pdpcontextmanager2/cenrep/keys_pdpcontextmanager2.xls
alwayson_net_plugin/pdpcontextmanager2/conf/pdpcontextmanager2.confml
alwayson_net_plugin/pdpcontextmanager2/conf/pdpcontextmanager2_102071F5.crml
alwayson_net_plugin/pdpcontextmanager2/data/10281f41.rss
alwayson_net_plugin/pdpcontextmanager2/data/pdpcontextmanager2.rss
alwayson_net_plugin/pdpcontextmanager2/group/bld.inf
alwayson_net_plugin/pdpcontextmanager2/group/pdpcontextmanager2.mmp
alwayson_net_plugin/pdpcontextmanager2/inc/10281f41.ini
alwayson_net_plugin/pdpcontextmanager2/inc/alwaysonconfig.hrh
alwayson_net_plugin/pdpcontextmanager2/inc/alwaysonlinepdpplugin.h
alwayson_net_plugin/pdpcontextmanager2/inc/caoasyncwrapper.h
alwayson_net_plugin/pdpcontextmanager2/inc/caoconnection.h
alwayson_net_plugin/pdpcontextmanager2/inc/caoconnectionimpl.h
alwayson_net_plugin/pdpcontextmanager2/inc/caoconnectionimplstub.h
alwayson_net_plugin/pdpcontextmanager2/inc/caoconnectionmanager.h
alwayson_net_plugin/pdpcontextmanager2/inc/caoconnectionmonitor.h
alwayson_net_plugin/pdpcontextmanager2/inc/caoconnectionmonitorimpl.h
alwayson_net_plugin/pdpcontextmanager2/inc/caoconnectionmonitorimplstub.h
alwayson_net_plugin/pdpcontextmanager2/inc/caogpds.h
alwayson_net_plugin/pdpcontextmanager2/inc/caoraumanager.h
alwayson_net_plugin/pdpcontextmanager2/inc/caoraumanagerimpl.h
alwayson_net_plugin/pdpcontextmanager2/inc/caoraumanagerimplstub.h
alwayson_net_plugin/pdpcontextmanager2/inc/caoserver.h
alwayson_net_plugin/pdpcontextmanager2/inc/caosettings.h
alwayson_net_plugin/pdpcontextmanager2/inc/caotimer.h
alwayson_net_plugin/pdpcontextmanager2/inc/linger.h
alwayson_net_plugin/pdpcontextmanager2/inc/logger.h
alwayson_net_plugin/pdpcontextmanager2/inc/maoconnectionmanager.h
alwayson_net_plugin/pdpcontextmanager2/inc/maoconnectionmanagerobserver.h
alwayson_net_plugin/pdpcontextmanager2/inc/maoconnectionmonitorobserver.h
alwayson_net_plugin/pdpcontextmanager2/inc/maoconnectionobserver.h
alwayson_net_plugin/pdpcontextmanager2/inc/maogpds.h
alwayson_net_plugin/pdpcontextmanager2/inc/maogpdsobserver.h
alwayson_net_plugin/pdpcontextmanager2/inc/maoraumanager.h
alwayson_net_plugin/pdpcontextmanager2/inc/maoraumanagerobserver.h
alwayson_net_plugin/pdpcontextmanager2/inc/maosettings.h
alwayson_net_plugin/pdpcontextmanager2/inc/maosettingsobserver.h
alwayson_net_plugin/pdpcontextmanager2/inc/maostatecontext.h
alwayson_net_plugin/pdpcontextmanager2/inc/maostatepool.h
alwayson_net_plugin/pdpcontextmanager2/inc/maotimer.h
alwayson_net_plugin/pdpcontextmanager2/inc/maotimerobserver.h
alwayson_net_plugin/pdpcontextmanager2/inc/pdpcontextmanagerinternalpskeys.h
alwayson_net_plugin/pdpcontextmanager2/inc/taostate.h
alwayson_net_plugin/pdpcontextmanager2/inc/taostateconnected.h
alwayson_net_plugin/pdpcontextmanager2/inc/taostateconnecting.h
alwayson_net_plugin/pdpcontextmanager2/inc/taostatedisabled.h
alwayson_net_plugin/pdpcontextmanager2/inc/taostatedisconnected.h
alwayson_net_plugin/pdpcontextmanager2/inc/taostateexternalconnection.h
alwayson_net_plugin/pdpcontextmanager2/inc/taostateinit.h
alwayson_net_plugin/pdpcontextmanager2/inc/taostateresetfactorysettings.h
alwayson_net_plugin/pdpcontextmanager2/inc/taostatestarting.h
alwayson_net_plugin/pdpcontextmanager2/inc/taostateunconnected.h
alwayson_net_plugin/pdpcontextmanager2/inc/taostatewaiting.h
alwayson_net_plugin/pdpcontextmanager2/inl/taostate.inl
alwayson_net_plugin/pdpcontextmanager2/rom/pdpcontextmanager2.iby
alwayson_net_plugin/pdpcontextmanager2/src/10281f41.rss
alwayson_net_plugin/pdpcontextmanager2/src/alwaysonlinepdpplugin.cpp
alwayson_net_plugin/pdpcontextmanager2/src/caoconnection.cpp
alwayson_net_plugin/pdpcontextmanager2/src/caoconnectionimpl.cpp
alwayson_net_plugin/pdpcontextmanager2/src/caoconnectionimplstub.cpp
alwayson_net_plugin/pdpcontextmanager2/src/caoconnectionmanager.cpp
alwayson_net_plugin/pdpcontextmanager2/src/caoconnectionmonitor.cpp
alwayson_net_plugin/pdpcontextmanager2/src/caoconnectionmonitorimpl.cpp
alwayson_net_plugin/pdpcontextmanager2/src/caoconnectionmonitorimplstub.cpp
alwayson_net_plugin/pdpcontextmanager2/src/caogpds.cpp
alwayson_net_plugin/pdpcontextmanager2/src/caoraumanager.cpp
alwayson_net_plugin/pdpcontextmanager2/src/caoraumanagerimpl.cpp
alwayson_net_plugin/pdpcontextmanager2/src/caoraumanagerimplstub.cpp
alwayson_net_plugin/pdpcontextmanager2/src/caoserver.cpp
alwayson_net_plugin/pdpcontextmanager2/src/caosettings.cpp
alwayson_net_plugin/pdpcontextmanager2/src/caotimer.cpp
alwayson_net_plugin/pdpcontextmanager2/src/linger.cpp
alwayson_net_plugin/pdpcontextmanager2/src/pdpcontextmanager2.rss
alwayson_net_plugin/pdpcontextmanager2/src/taostate.cpp
alwayson_net_plugin/pdpcontextmanager2/src/taostateconnected.cpp
alwayson_net_plugin/pdpcontextmanager2/src/taostateconnecting.cpp
alwayson_net_plugin/pdpcontextmanager2/src/taostatedisabled.cpp
alwayson_net_plugin/pdpcontextmanager2/src/taostatedisconnected.cpp
alwayson_net_plugin/pdpcontextmanager2/src/taostateexternalconnection.cpp
alwayson_net_plugin/pdpcontextmanager2/src/taostateinit.cpp
alwayson_net_plugin/pdpcontextmanager2/src/taostateresetfactorysettings.cpp
alwayson_net_plugin/pdpcontextmanager2/src/taostatestarting.cpp
alwayson_net_plugin/pdpcontextmanager2/src/taostateunconnected.cpp
alwayson_net_plugin/pdpcontextmanager2/src/taostatewaiting.cpp
apengine/apeng/BWinsCw/ApEngine_EKA2U.def
apengine/apeng/Data/ApEngine.rss
apengine/apeng/EABI/ApEngine_EKA2U.def
apengine/apeng/Rom/ApEngine.iby
apengine/apeng/Rom/ApEngineResources.iby
apengine/apeng/cenrep/keys_accesspoints.xls
apengine/apeng/conf/accesspoints.confml
apengine/apeng/conf/accesspoints_10008D3A.crml
apengine/apeng/conf/accesspoints_10008D3B.crml
apengine/apeng/group/APEngine.MMP
apengine/apeng/group/ApEngineCvt.mmp
apengine/apeng/group/bld.inf
apengine/apeng/inc/APEngineVariant.hrh
apengine/apeng/inc/APItemCdmaData.h
apengine/apeng/inc/APItemExtra.h
apengine/apeng/inc/APItemWlanData.h
apengine/apeng/inc/ActiveApDbNotifier.h
apengine/apeng/inc/ApEngineCommons.h
apengine/apeng/inc/ApEngineLogger.h
apengine/apeng/inc/ApEnginePrivateCRKeys.h
apengine/apeng/inc/ApListItemKey.h
apengine/apeng/inc/ApSpeedLookup.h
apengine/apeng/loc/apengine.loc
apengine/apeng/src/APAccessPointItem.cpp
apengine/apeng/src/APDataHandler.cpp
apengine/apeng/src/APNetworks.cpp
apengine/apeng/src/APSelect.cpp
apengine/apeng/src/APUtils.cpp
apengine/apeng/src/ActiveApDb.cpp
apengine/apeng/src/ActiveApDbNotifier.cpp
apengine/apeng/src/ApEngineCommons.cpp
apengine/apeng/src/ApEngineLogger.cpp
apengine/apeng/src/ApListItem.cpp
apengine/apeng/src/ApListItemKey.cpp
apengine/apeng/src/ApNetworkItem.cpp
apengine/apeng/src/ApProtHandler.cpp
apengine/apeng/src/VpnApEngine.cpp
apengine/apeng/src/VpnApItem.cpp
apengine/apeng/src/aplistitemlist.cpp
apengine/apeng/src/apnetworkitemlist.cpp
apengine/apsettingshandlerui/BMARM/APSETTINGSHANDLERUIU.DEF
apengine/apsettingshandlerui/BMARM/ApSettingsHandlerUI_EKA2U.def
apengine/apsettingshandlerui/BWINS/APSETTINGSHANDLERUIU.DEF
apengine/apsettingshandlerui/BWinsCw/APSETTINGSHANDLERUIU.DEF
apengine/apsettingshandlerui/BWinsCw/ApSettingsHandlerUI_EKA2U.def
apengine/apsettingshandlerui/EABI/ApSettingsHandlerUI_EKA2U.def
apengine/apsettingshandlerui/Rom/ApSettingsHandlerUI.iby
apengine/apsettingshandlerui/Rom/ApSettingsHandlerUIResources.iby
apengine/apsettingshandlerui/data/apsetui.rss
apengine/apsettingshandlerui/group/ApSettingsHandlerUiCvt.mmp
apengine/apsettingshandlerui/group/Apsettingshandlerui.mmp
apengine/apsettingshandlerui/group/apsettingshandleruiicons.mk
apengine/apsettingshandlerui/group/apsettingshandleruiicons_dc.mk
apengine/apsettingshandlerui/group/bld.inf
apengine/apsettingshandlerui/inc/APSettingsHandlerUIVariant.hrh
apengine/apsettingshandlerui/inc/AccessPointTextSettingPage.h
apengine/apsettingshandlerui/inc/ApMultiLineDataQueryDialog.h
apengine/apsettingshandlerui/inc/ApNetSelPopupList.h
apengine/apsettingshandlerui/inc/ApNetSelectorListBoxModel.h
apengine/apsettingshandlerui/inc/ApSelPopupList.h
apengine/apsettingshandlerui/inc/ApSelQueryDialog.h
apengine/apsettingshandlerui/inc/ApSelectorDialog.h
apengine/apsettingshandlerui/inc/ApSelectorListBoxModel.h
apengine/apsettingshandlerui/inc/ApSelectorListbox.h
apengine/apsettingshandlerui/inc/ApSettingsDlg.h
apengine/apsettingshandlerui/inc/ApSettingsHandlerConsts.h
apengine/apsettingshandlerui/inc/ApSettingsHandlerLogger.h
apengine/apsettingshandlerui/inc/ApSettingsHandlerUI.hrh
apengine/apsettingshandlerui/inc/ApSettingsHandlerUiPrivateCRKeys.h
apengine/apsettingshandlerui/inc/ApSettingsLookups.h
apengine/apsettingshandlerui/inc/ApSettingsModel.h
apengine/apsettingshandlerui/inc/Apsettingsdeleteoperation.h
apengine/apsettingshandlerui/inc/ApsettingshandleruiImpl.h
apengine/apsettingshandlerui/inc/FeatureManagerWrapper.h
apengine/apsettingshandlerui/inc/TextOverrides.h
apengine/apsettingshandlerui/inc/apsettingsui.h
apengine/apsettingshandlerui/loc/apsettingshandlerui.loc
apengine/apsettingshandlerui/src/AccessPointTextSettingPage.cpp
apengine/apsettingshandlerui/src/ApMultiLineDataQueryDialog.cpp
apengine/apsettingshandlerui/src/ApNetSelPopupList.cpp
apengine/apsettingshandlerui/src/ApNetSelectorListBoxModel.cpp
apengine/apsettingshandlerui/src/ApSelPopupList.cpp
apengine/apsettingshandlerui/src/ApSelQueryDialog.cpp
apengine/apsettingshandlerui/src/ApSelectorDialog.cpp
apengine/apsettingshandlerui/src/ApSelectorListBox.cpp
apengine/apsettingshandlerui/src/ApSelectorListBoxModel.cpp
apengine/apsettingshandlerui/src/ApSettingsCommons.cpp
apengine/apsettingshandlerui/src/ApSettingsDlg.cpp
apengine/apsettingshandlerui/src/ApSettingsModel.cpp
apengine/apsettingshandlerui/src/FeatureManagerWrapper.cpp
apengine/apsettingshandlerui/src/TextOverrides.cpp
apengine/apsettingshandlerui/src/apsettingsdeleteoperation.cpp
apengine/apsettingshandlerui/src/apsettingshandlerui.cpp
apengine/apsettingshandlerui/src/apsettingshandleruiImpl.cpp
apengine/apsettingshandlerui/src/apsettingsui.cpp
apengine/apsettingsplugin/data/1020736C.rss
apengine/apsettingsplugin/data/ApSettingsPluginRsc.rss
apengine/apsettingsplugin/group/ApSettingsPlugin.mmp
apengine/apsettingsplugin/group/apsettingspluginicons.mk
apengine/apsettingsplugin/group/bld.inf
apengine/apsettingsplugin/inc/APSettingsPlugin.h
apengine/apsettingsplugin/inc/utilities.h
apengine/apsettingsplugin/loc/apsettingsplugin.loc
apengine/apsettingsplugin/rom/ApSettingsPlugin.iby
apengine/apsettingsplugin/rom/ApSettingsPluginResources.iby
apengine/apsettingsplugin/src/APSettingsPlugin.cpp
apengine/apsettingsplugin/src/ApSettingsPluginImplementationTable.cpp
apengine/apsettingsplugin/src/utilities.cpp
apengine/group/bld.inf
bearermanagement/S60MCPR/data/s60mcpr.confml
bearermanagement/S60MCPR/data/s60mcpr_101F6D4A.crml
bearermanagement/S60MCPR/group/bld.inf
bearermanagement/S60MCPR/group/s60mcpr.mmp
bearermanagement/S60MCPR/inc/s60extendedtmselector.h
bearermanagement/S60MCPR/inc/s60mcpr.h
bearermanagement/S60MCPR/inc/s60mcpractivities.h
bearermanagement/S60MCPR/inc/s60mcprfactory.h
bearermanagement/S60MCPR/inc/s60mcprmpmlog.h
bearermanagement/S60MCPR/inc/s60mcprstates.h
bearermanagement/S60MCPR/inc/s60mpmnotifications.h
bearermanagement/S60MCPR/inc/s60mpmpolicyinterfaces.h
bearermanagement/S60MCPR/inc/s60mpmrequests.h
bearermanagement/S60MCPR/inc/s60tcprecvwin.h
bearermanagement/S60MCPR/inc/s60tiermanager.h
bearermanagement/S60MCPR/inc/s60tiermanagerfactory.h
bearermanagement/S60MCPR/inc/s60tiermanagerselector.h
bearermanagement/S60MCPR/inc/s60tmactivities.h
bearermanagement/S60MCPR/rom/s60mcpr.iby
bearermanagement/S60MCPR/src/101F6D4A.rss
bearermanagement/S60MCPR/src/ecom_impl.cpp
bearermanagement/S60MCPR/src/s60extendedtmselector.cpp
bearermanagement/S60MCPR/src/s60mcpr.cpp
bearermanagement/S60MCPR/src/s60mcpractivities.cpp
bearermanagement/S60MCPR/src/s60mcprerrorrecoveryactivity.cpp
bearermanagement/S60MCPR/src/s60mcprfactory.cpp
bearermanagement/S60MCPR/src/s60mcprmobilityactivity.cpp
bearermanagement/S60MCPR/src/s60mcprsimpleselectactivity.cpp
bearermanagement/S60MCPR/src/s60mcprstates.cpp
bearermanagement/S60MCPR/src/s60mpmnotifications.cpp
bearermanagement/S60MCPR/src/s60mpmrequests.cpp
bearermanagement/S60MCPR/src/s60tcprecvwin.cpp
bearermanagement/S60MCPR/src/s60tiermanager.cpp
bearermanagement/S60MCPR/src/s60tiermanagerfactory.cpp
bearermanagement/S60MCPR/src/s60tiermanagerselector.cpp
bearermanagement/S60MCPR/src/s60tmactivities.cpp
bearermanagement/S60MCPR/src/s60tmprovideractivity.cpp
bearermanagement/data/ip.providers.esk
bearermanagement/extendedconnpref/bwins/extendedconnprefu.def
bearermanagement/extendedconnpref/eabi/extendedconnprefu.def
bearermanagement/extendedconnpref/group/bld.inf
bearermanagement/extendedconnpref/group/extendedconnpref.mmp
bearermanagement/extendedconnpref/group/extendedconnprefecom.mmp
bearermanagement/extendedconnpref/rom/extendedconnpref.iby
bearermanagement/extendedconnpref/rom/extendedconnprefecom.iby
bearermanagement/extendedconnpref/src/2002429F.rss
bearermanagement/extendedconnpref/src/extendedconnpref.cpp
bearermanagement/extendedconnpref/src/extendedconnpreffactory.cpp
bearermanagement/group/bld.inf
bearermanagement/mpm/bwins/MPMSERVERU.DEF
bearermanagement/mpm/bwins/mpmdefaultconnectionu.def
bearermanagement/mpm/bwins/mpmu.def
bearermanagement/mpm/conf/mpm.confml
bearermanagement/mpm/conf/mpm_101f6d12.crml
bearermanagement/mpm/conf/mpm_101f6d50.crml
bearermanagement/mpm/eabi/MPMU.DEF
bearermanagement/mpm/eabi/mpmdefaultconnectionu.def
bearermanagement/mpm/group/bld.inf
bearermanagement/mpm/group/mpmclient.mmp
bearermanagement/mpm/group/mpmdefaultconnectionclient.mmp
bearermanagement/mpm/group/mpmserver.mmp
bearermanagement/mpm/group/mpmserver_platsim.mmp
bearermanagement/mpm/inc/mpmcommon.h
bearermanagement/mpm/inc/mpmcommsdataccess.h
bearermanagement/mpm/inc/mpmconfirmdlg.h
bearermanagement/mpm/inc/mpmconfirmdlgroaming.h
bearermanagement/mpm/inc/mpmconfirmdlgstarting.h
bearermanagement/mpm/inc/mpmconnmonevents.h
bearermanagement/mpm/inc/mpmconnmonreqs.h
bearermanagement/mpm/inc/mpmcsidwatcher.h
bearermanagement/mpm/inc/mpmdefaultconnection.h
bearermanagement/mpm/inc/mpmdefaultconnserver.h
bearermanagement/mpm/inc/mpmdefaultconnserversession.h
bearermanagement/mpm/inc/mpmdialog.h
bearermanagement/mpm/inc/mpmdialogbase.h
bearermanagement/mpm/inc/mpmdisconnectdlg.h
bearermanagement/mpm/inc/mpmdtmwatcher.h
bearermanagement/mpm/inc/mpmiapselection.h
bearermanagement/mpm/inc/mpmlauncher.h
bearermanagement/mpm/inc/mpmlogger.h
bearermanagement/mpm/inc/mpmprivatecrkeys.h
bearermanagement/mpm/inc/mpmroamingwatcher.h
bearermanagement/mpm/inc/mpmserver.h
bearermanagement/mpm/inc/mpmserver.inl
bearermanagement/mpm/inc/mpmserversession.h
bearermanagement/mpm/inc/mpmserversession.inl
bearermanagement/mpm/inc/mpmstarter.h
bearermanagement/mpm/inc/mpmwlanavailability.h
bearermanagement/mpm/inc/mpmwlanquerydialog.h
bearermanagement/mpm/inc/rmpm.h
bearermanagement/mpm/inc/rmpm.inl
bearermanagement/mpm/rom/mpm.iby
bearermanagement/mpm/rom/mpmdefaultconnection.iby
bearermanagement/mpm/rom/mpmserver.iby
bearermanagement/mpm/src/mpmcommsdataccess.cpp
bearermanagement/mpm/src/mpmconfirmdlg.cpp
bearermanagement/mpm/src/mpmconfirmdlgroaming.cpp
bearermanagement/mpm/src/mpmconfirmdlgstarting.cpp
bearermanagement/mpm/src/mpmconnmonevents.cpp
bearermanagement/mpm/src/mpmconnmonreqs.cpp
bearermanagement/mpm/src/mpmcsidwatcher.cpp
bearermanagement/mpm/src/mpmdefaultconnection.cpp
bearermanagement/mpm/src/mpmdefaultconnserver.cpp
bearermanagement/mpm/src/mpmdefaultconnserversession.cpp
bearermanagement/mpm/src/mpmdialog.cpp
bearermanagement/mpm/src/mpmdialogbase.cpp
bearermanagement/mpm/src/mpmdisconnectdlg.cpp
bearermanagement/mpm/src/mpmdtmwatcher.cpp
bearermanagement/mpm/src/mpmiapselection.cpp
bearermanagement/mpm/src/mpmlauncher.cpp
bearermanagement/mpm/src/mpmroamingwatcher.cpp
bearermanagement/mpm/src/mpmserver.cpp
bearermanagement/mpm/src/mpmserversession.cpp
bearermanagement/mpm/src/mpmstarter.cpp
bearermanagement/mpm/src/mpmwlanavailability.cpp
bearermanagement/mpm/src/mpmwlanquerydialog.cpp
bearermanagement/mpm/src/rmpm.cpp
bearermanagement/mpm/src/rmpmdefaultconnection.cpp
cmmanager/cmmgr/Framework/BWinsCw/CmManager_prot_setupU.DEF
cmmanager/cmmgr/Framework/EABI/CmManager_prot_setupU.def
cmmanager/cmmgr/Framework/Group/bld.inf
cmmanager/cmmgr/Framework/Group/cmmanager.mmp
cmmanager/cmmgr/Framework/Group/framework_icons.mk
cmmanager/cmmgr/Framework/Inc/ccmdexec.h
cmmanager/cmmgr/Framework/Inc/cmapplicationsettingsuiimpl.h
cmmanager/cmmgr/Framework/Inc/cmcommsdatnotifier.h
cmmanager/cmmgr/Framework/Inc/cmconnectionmethodinfo.h
cmmanager/cmmgr/Framework/Inc/cmconnselectrbpage.h
cmmanager/cmmgr/Framework/Inc/cmconnsettingsuiimpl.h
cmmanager/cmmgr/Framework/Inc/cmdesticondialog.h
cmmanager/cmmgr/Framework/Inc/cmdesticonmap.h
cmmanager/cmmgr/Framework/Inc/cmdestinationimpl.h
cmmanager/cmmgr/Framework/Inc/cmdlg.h
cmmanager/cmmgr/Framework/Inc/cmlistbox.h
cmmanager/cmmgr/Framework/Inc/cmlistboxmodel.h
cmmanager/cmmgr/Framework/Inc/cmlistitem.h
cmmanager/cmmgr/Framework/Inc/cmlistitemlist.h
cmmanager/cmmgr/Framework/Inc/cmlogger.h
cmmanager/cmmgr/Framework/Inc/cmmanager.hrh
cmmanager/cmmgr/Framework/Inc/cmmanagerimpl.h
cmmanager/cmmgr/Framework/Inc/cmmanagerimpl.inl
cmmanager/cmmgr/Framework/Inc/cmobjectpool.h
cmmanager/cmmgr/Framework/Inc/cmpluginmenucommands.hrh
cmmanager/cmmgr/Framework/Inc/cmpluginmultilinedialog.h
cmmanager/cmmgr/Framework/Inc/cmsettingsuiimpl.h
cmmanager/cmmgr/Framework/Inc/cmtransactionhandler.h
cmmanager/cmmgr/Framework/Inc/cmwizard.h
cmmanager/cmmgr/Framework/Inc/destdlg.h
cmmanager/cmmgr/Framework/Inc/destlistbox.h
cmmanager/cmmgr/Framework/Inc/destlistboxmodel.h
cmmanager/cmmgr/Framework/Inc/destlistitem.h
cmmanager/cmmgr/Framework/Inc/destlistitemlist.h
cmmanager/cmmgr/Framework/Inc/selectdestinationdlg.h
cmmanager/cmmgr/Framework/Inc/uncatdlg.h
cmmanager/cmmgr/Framework/Src/ccmdexec.cpp
cmmanager/cmmgr/Framework/Src/ccmpluginbaseeng.cpp
cmmanager/cmmgr/Framework/Src/cmapplicationsettingsui.cpp
cmmanager/cmmgr/Framework/Src/cmapplicationsettingsuiimpl.cpp
cmmanager/cmmgr/Framework/Src/cmcommonui.cpp
cmmanager/cmmgr/Framework/Src/cmcommsdatnotifier.cpp
cmmanager/cmmgr/Framework/Src/cmconnectionmethod.cpp
cmmanager/cmmgr/Framework/Src/cmconnectionmethodext.cpp
cmmanager/cmmgr/Framework/Src/cmconnectionmethodinfo.cpp
cmmanager/cmmgr/Framework/Src/cmconnselectrbpage.cpp
cmmanager/cmmgr/Framework/Src/cmconnsettingsuiimpl.cpp
cmmanager/cmmgr/Framework/Src/cmdesticondialog.cpp
cmmanager/cmmgr/Framework/Src/cmdesticonmap.cpp
cmmanager/cmmgr/Framework/Src/cmdestination.cpp
cmmanager/cmmgr/Framework/Src/cmdestinationext.cpp
cmmanager/cmmgr/Framework/Src/cmdestinationimpl.cpp
cmmanager/cmmgr/Framework/Src/cmdlg.cpp
cmmanager/cmmgr/Framework/Src/cmlistbox.cpp
cmmanager/cmmgr/Framework/Src/cmlistboxmodel.cpp
cmmanager/cmmgr/Framework/Src/cmlistitem.cpp
cmmanager/cmmgr/Framework/Src/cmlistitemlist.cpp
cmmanager/cmmgr/Framework/Src/cmlogger.cpp
cmmanager/cmmgr/Framework/Src/cmmanager.cpp
cmmanager/cmmgr/Framework/Src/cmmanagerext.cpp
cmmanager/cmmgr/Framework/Src/cmmanagerimpl.cpp
cmmanager/cmmgr/Framework/Src/cmobjectpool.cpp
cmmanager/cmmgr/Framework/Src/cmpbasesettingsdlg.cpp
cmmanager/cmmgr/Framework/Src/cmpbasesettingsdlgadv.cpp
cmmanager/cmmgr/Framework/Src/cmpbasesettingsdlgip.cpp
cmmanager/cmmgr/Framework/Src/cmpluginbase.cpp
cmmanager/cmmgr/Framework/Src/cmpluginlanbase.cpp
cmmanager/cmmgr/Framework/Src/cmpluginmultilinedialog.cpp
cmmanager/cmmgr/Framework/Src/cmsettingsui.cpp
cmmanager/cmmgr/Framework/Src/cmsettingsuiimpl.cpp
cmmanager/cmmgr/Framework/Src/cmtransactionhandler.cpp
cmmanager/cmmgr/Framework/Src/cmwizard.cpp
cmmanager/cmmgr/Framework/Src/destdlg.cpp
cmmanager/cmmgr/Framework/Src/destlistbox.cpp
cmmanager/cmmgr/Framework/Src/destlistboxmodel.cpp
cmmanager/cmmgr/Framework/Src/destlistitem.cpp
cmmanager/cmmgr/Framework/Src/destlistitemlist.cpp
cmmanager/cmmgr/Framework/Src/selectdestination.cpp
cmmanager/cmmgr/Framework/Src/uncatdlg.cpp
cmmanager/cmmgr/Framework/SrcData/cmmanager.rss
cmmanager/cmmgr/Framework/loc/cmmanager.loc
cmmanager/cmmgr/Plugins/Group/bld.inf
cmmanager/cmmgr/Plugins/cmpluginembdestination/data/1020737D.rss
cmmanager/cmmgr/Plugins/cmpluginembdestination/data/cmpluginembdestinationui.rss
cmmanager/cmmgr/Plugins/cmpluginembdestination/group/bld.inf
cmmanager/cmmgr/Plugins/cmpluginembdestination/group/cmpluginembdestination.mmp
cmmanager/cmmgr/Plugins/cmpluginembdestination/inc/cmpluginembdestination.h
cmmanager/cmmgr/Plugins/cmpluginembdestination/src/cmpluginembdestination.cpp
cmmanager/cmmgr/Plugins/cmpluginembdestination/src/cmpluginembdestinationproxy.cpp
cmmanager/cmmgr/Plugins/cmpluginlan/data/1020737B.rss
cmmanager/cmmgr/Plugins/cmpluginlan/group/bld.inf
cmmanager/cmmgr/Plugins/cmpluginlan/group/cmpluginlan.mmp
cmmanager/cmmgr/Plugins/cmpluginlan/inc/cmpluginlan.h
cmmanager/cmmgr/Plugins/cmpluginlan/src/cmpluginlan.cpp
cmmanager/cmmgr/Plugins/cmpluginlan/src/cmpluginlanproxy.cpp
cmmanager/cmmgr/Plugins/cmpluginpacketdata/data/1020737C.rss
cmmanager/cmmgr/Plugins/cmpluginpacketdata/data/cmpacketdataui.rss
cmmanager/cmmgr/Plugins/cmpluginpacketdata/group/bld.inf
cmmanager/cmmgr/Plugins/cmpluginpacketdata/group/cmpluginpacketdata.mmp
cmmanager/cmmgr/Plugins/cmpluginpacketdata/group/pluginpacketdata_icons.mk
cmmanager/cmmgr/Plugins/cmpluginpacketdata/inc/cmpacketdatacommonconstants.h
cmmanager/cmmgr/Plugins/cmpluginpacketdata/inc/cmpluginpacketdata.h
cmmanager/cmmgr/Plugins/cmpluginpacketdata/inc/cmppacketdatasettingsdlg.h
cmmanager/cmmgr/Plugins/cmpluginpacketdata/inc/cmppacketdatasettingsdlgadv.h
cmmanager/cmmgr/Plugins/cmpluginpacketdata/loc/cmpluginpacketdata.loc
cmmanager/cmmgr/Plugins/cmpluginpacketdata/src/cmpluginpacketdata.cpp
cmmanager/cmmgr/Plugins/cmpluginpacketdata/src/cmpluginpacketdataproxy.cpp
cmmanager/cmmgr/Plugins/cmpluginpacketdata/src/cmppacketdatasettingsdlg.cpp
cmmanager/cmmgr/Plugins/cmpluginpacketdata/src/cmppacketdatasettingsdlgadv.cpp
cmmanager/cmmgr/Plugins/cmpluginvpn/data/10281BBE.rss
cmmanager/cmmgr/Plugins/cmpluginvpn/data/cmpluginvpnui.rss
cmmanager/cmmgr/Plugins/cmpluginvpn/group/bld.inf
cmmanager/cmmgr/Plugins/cmpluginvpn/group/cmpluginvpn.mmp
cmmanager/cmmgr/Plugins/cmpluginvpn/group/cmpluginvpn_icons.mk
cmmanager/cmmgr/Plugins/cmpluginvpn/inc/cmpluginvpn.h
cmmanager/cmmgr/Plugins/cmpluginvpn/inc/cmpvpnnextlayerselectdlg.h
cmmanager/cmmgr/Plugins/cmpluginvpn/inc/cmpvpnpolicyselectiondlg.h
cmmanager/cmmgr/Plugins/cmpluginvpn/inc/cmpvpnsettingsdlg.h
cmmanager/cmmgr/Plugins/cmpluginvpn/inc/cmvpncommonconstants.h
cmmanager/cmmgr/Plugins/cmpluginvpn/loc/cmpluginvpn.loc
cmmanager/cmmgr/Plugins/cmpluginvpn/src/cmpluginproxyvpn.cpp
cmmanager/cmmgr/Plugins/cmpluginvpn/src/cmpluginvpn.cpp
cmmanager/cmmgr/Plugins/cmpluginvpn/src/cmpvpnnextlayerselectdlg.cpp
cmmanager/cmmgr/Plugins/cmpluginvpn/src/cmpvpnpolicyselectiondlg.cpp
cmmanager/cmmgr/Plugins/cmpluginvpn/src/cmpvpnsettingsdlg.cpp
cmmanager/cmmgr/Plugins/cmpluginwlan/data/10281BB2.rss
cmmanager/cmmgr/Plugins/cmpluginwlan/data/cmwlanui.rss
cmmanager/cmmgr/Plugins/cmpluginwlan/group/bld.inf
cmmanager/cmmgr/Plugins/cmpluginwlan/group/cmpluginwlan.mmp
cmmanager/cmmgr/Plugins/cmpluginwlan/group/pluginwlan_icons.mk
cmmanager/cmmgr/Plugins/cmpluginwlan/inc/cmpluginwlan.h
cmmanager/cmmgr/Plugins/cmpluginwlan/inc/cmpluginwlandata.h
cmmanager/cmmgr/Plugins/cmpluginwlan/inc/cmpluginwlandataarray.h
cmmanager/cmmgr/Plugins/cmpluginwlan/inc/cmpwlanactivewaiter.h
cmmanager/cmmgr/Plugins/cmpluginwlan/inc/cmpwlansettingsdlg.h
cmmanager/cmmgr/Plugins/cmpluginwlan/inc/cmpwlansettingsdlgadv.h
cmmanager/cmmgr/Plugins/cmpluginwlan/inc/cmpwlansettingsdlgipv4.h
cmmanager/cmmgr/Plugins/cmpluginwlan/inc/cmpwlansettingsdlgipv6.h
cmmanager/cmmgr/Plugins/cmpluginwlan/inc/cmwlancommonconstants.h
cmmanager/cmmgr/Plugins/cmpluginwlan/inc/cmwlancoveragecheck.h
cmmanager/cmmgr/Plugins/cmpluginwlan/loc/cmpluginwlan.loc
cmmanager/cmmgr/Plugins/cmpluginwlan/src/cmpluginwlan.cpp
cmmanager/cmmgr/Plugins/cmpluginwlan/src/cmpluginwlandata.cpp
cmmanager/cmmgr/Plugins/cmpluginwlan/src/cmpluginwlandataarray.cpp
cmmanager/cmmgr/Plugins/cmpluginwlan/src/cmpluginwlanproxy.cpp
cmmanager/cmmgr/Plugins/cmpluginwlan/src/cmpwlanactivewaiter.cpp
cmmanager/cmmgr/Plugins/cmpluginwlan/src/cmpwlansettingsdlg.cpp
cmmanager/cmmgr/Plugins/cmpluginwlan/src/cmpwlansettingsdlgadv.cpp
cmmanager/cmmgr/Plugins/cmpluginwlan/src/cmpwlansettingsdlgipv4.cpp
cmmanager/cmmgr/Plugins/cmpluginwlan/src/cmpwlansettingsdlgipv6.cpp
cmmanager/cmmgr/Plugins/cmpluginwlan/src/cmwlancoveragecheck.cpp
cmmanager/cmmgr/Rom/CmManager.iby
cmmanager/cmmgr/Rom/CmManagerResources.iby
cmmanager/cmmgr/Rom/cmplugincsd.iby
cmmanager/cmmgr/Rom/cmplugincsdresources.iby
cmmanager/cmmgr/Rom/cmpluginembdestination.iby
cmmanager/cmmgr/Rom/cmpluginembdestinationresources.iby
cmmanager/cmmgr/Rom/cmpluginpacketdata.iby
cmmanager/cmmgr/Rom/cmpluginpacketdataresources.iby
cmmanager/cmmgr/Rom/cmpluginvpn.iby
cmmanager/cmmgr/Rom/cmpluginvpnresources.iby
cmmanager/cmmgr/Rom/cmpluginwlan.iby
cmmanager/cmmgr/Rom/cmpluginwlanresources.iby
cmmanager/cmmgr/database/bwinscw/cmmanagerdatabaseU.def
cmmanager/cmmgr/database/eabi/cmmanagerdatabaseU.def
cmmanager/cmmgr/database/group/bld.inf
cmmanager/cmmgr/database/group/cmmanagerdatabase.mmp
cmmanager/cmmgr/database/inc/datamobilitycommsdattypes.h
cmmanager/cmmgr/database/rom/cmmanagerdatabase.iby
cmmanager/cmmgr/database/src/cmmanagertableformats.cpp
cmmanager/cmmgr/database/src/datamobilitycommsdattypes.cpp
cmmanager/cmmgr/group/bld.inf
cmmanager/group/bld.inf
cmmanager/gsconnsettingsplugin/data/200255B8.rss
cmmanager/gsconnsettingsplugin/data/gsconnsettingspluginrsc.rss
cmmanager/gsconnsettingsplugin/group/bld.inf
cmmanager/gsconnsettingsplugin/group/gsconnsettingsplugin.mmp
cmmanager/gsconnsettingsplugin/inc/gsconnsettingsmskobserver.h
cmmanager/gsconnsettingsplugin/inc/gsconnsettingsplugin.h
cmmanager/gsconnsettingsplugin/inc/gsconnsettingsplugin.hrh
cmmanager/gsconnsettingsplugin/inc/gsconnsettingsplugincontainer.h
cmmanager/gsconnsettingsplugin/inc/gsconnsettingspluginmodel.h
cmmanager/gsconnsettingsplugin/inc/gsconnsettingsselectiondlg.h
cmmanager/gsconnsettingsplugin/loc/gsconnsettingsplugin.loc
cmmanager/gsconnsettingsplugin/rom/gsconnsettingsplugin.iby
cmmanager/gsconnsettingsplugin/rom/gsconnsettingspluginresources.iby
cmmanager/gsconnsettingsplugin/src/gsconnsettingsplugin.cpp
cmmanager/gsconnsettingsplugin/src/gsconnsettingsplugincontainer.cpp
cmmanager/gsconnsettingsplugin/src/gsconnsettingspluginimpltable.cpp
cmmanager/gsconnsettingsplugin/src/gsconnsettingspluginmodel.cpp
cmmanager/gsconnsettingsplugin/src/gsconnsettingsselectiondlg.cpp
cmmanager/gsconnsettingsplugin/traces/OstTraceDefinitions.h
cmmanager/gsconnsettingsplugin/traces/gsconnsettingspluginmodelTraces.h
connectionmonitoring/connectionmonitorplugin/data/10281BC1.rss
connectionmonitoring/connectionmonitorplugin/data/connectionmonitorpluginrsc.rss
connectionmonitoring/connectionmonitorplugin/group/bld.inf
connectionmonitoring/connectionmonitorplugin/group/connectionmonitorplugin.mmp
connectionmonitoring/connectionmonitorplugin/inc/connectionmonitorplugin.h
connectionmonitoring/connectionmonitorplugin/loc/connectionmonitorplugin.loc
connectionmonitoring/connectionmonitorplugin/rom/connectionmonitorplugin.iby
connectionmonitoring/connectionmonitorplugin/rom/connectionmonitorpluginresources.iby
connectionmonitoring/connectionmonitorplugin/src/connectionmonitorplugin.cpp
connectionmonitoring/connectionmonitorplugin/src/connectionmonitorpluginimplementationtable.cpp
connectionmonitoring/connectionmonitorui/ROM/ConnectionMonitorUi.iby
connectionmonitoring/connectionmonitorui/ROM/ConnectionMonitorUiResources.iby
connectionmonitoring/connectionmonitorui/aif/ConnectionMonitorUiaif.rss
connectionmonitoring/connectionmonitorui/aif/context_pane_icon.bmp
connectionmonitoring/connectionmonitorui/aif/context_pane_icon_mask.bmp
connectionmonitoring/connectionmonitorui/aif/list_icon.bmp
connectionmonitoring/connectionmonitorui/aif/list_icon_mask.bmp
connectionmonitoring/connectionmonitorui/data/ConnectionMonitorUi.rss
connectionmonitoring/connectionmonitorui/data/ConnectionMonitorUi_caption.rss
connectionmonitoring/connectionmonitorui/data/ConnectionMonitorUi_reg.rss
connectionmonitoring/connectionmonitorui/group/ConnectionMonitorUI.mmp
connectionmonitoring/connectionmonitorui/group/bld.inf
connectionmonitoring/connectionmonitorui/help/data/xhtml.zip
connectionmonitoring/connectionmonitorui/help/group/bld.inf
connectionmonitoring/connectionmonitorui/help/inc/cmon.hlp.hrh
connectionmonitoring/connectionmonitorui/help/rom/connectionmonitoruihelps_variant.iby
connectionmonitoring/connectionmonitorui/inc/ActiveWrapper.h
connectionmonitoring/connectionmonitorui/inc/ConnectionArray.h
connectionmonitoring/connectionmonitorui/inc/ConnectionInfoBase.h
connectionmonitoring/connectionmonitorui/inc/ConnectionMonitorUi.hrh
connectionmonitoring/connectionmonitorui/inc/ConnectionMonitorUiApp.h
connectionmonitoring/connectionmonitorui/inc/ConnectionMonitorUiAppUi.h
connectionmonitoring/connectionmonitorui/inc/ConnectionMonitorUiContainer.h
connectionmonitoring/connectionmonitorui/inc/ConnectionMonitorUiDetailsContainer.h
connectionmonitoring/connectionmonitorui/inc/ConnectionMonitorUiDetailsView.h
connectionmonitoring/connectionmonitorui/inc/ConnectionMonitorUiDocument.h
connectionmonitoring/connectionmonitorui/inc/ConnectionMonitorUiLogger.h
connectionmonitoring/connectionmonitorui/inc/ConnectionMonitorUiView.h
connectionmonitoring/connectionmonitorui/inc/CsdConnectionInfo.h
connectionmonitoring/connectionmonitorui/inc/EasyWLANConnectionInfo.h
connectionmonitoring/connectionmonitorui/inc/FeatureManagerWrapper.h
connectionmonitoring/connectionmonitorui/inc/GprsConnectionInfo.h
connectionmonitoring/connectionmonitorui/inc/WlanConnectionInfo.h
connectionmonitoring/connectionmonitorui/loc/connectionmonitorui.loc
connectionmonitoring/connectionmonitorui/sis/ConnectionMonitorUI.pkg
connectionmonitoring/connectionmonitorui/src/ActiveWrapper.cpp
connectionmonitoring/connectionmonitorui/src/ConnectionArray.cpp
connectionmonitoring/connectionmonitorui/src/ConnectionInfoBase.cpp
connectionmonitoring/connectionmonitorui/src/ConnectionMonitorUiApp.cpp
connectionmonitoring/connectionmonitorui/src/ConnectionMonitorUiAppUi.cpp
connectionmonitoring/connectionmonitorui/src/ConnectionMonitorUiContainer.cpp
connectionmonitoring/connectionmonitorui/src/ConnectionMonitorUiDetailsContainer.cpp
connectionmonitoring/connectionmonitorui/src/ConnectionMonitorUiDetailsView.cpp
connectionmonitoring/connectionmonitorui/src/ConnectionMonitorUiDocument.cpp
connectionmonitoring/connectionmonitorui/src/ConnectionMonitorUiView.cpp
connectionmonitoring/connectionmonitorui/src/CsdConnectionInfo.cpp
connectionmonitoring/connectionmonitorui/src/EasyWLANConnectionInfo.cpp
connectionmonitoring/connectionmonitorui/src/FeatureManagerWrapper.cpp
connectionmonitoring/connectionmonitorui/src/GprsConnectionInfo.cpp
connectionmonitoring/connectionmonitorui/src/WlanConnectionInfo.cpp
connectionmonitoring/connmon/connectionmonitor/BMARM/CONNMONU.DEF
connectionmonitoring/connmon/connectionmonitor/BMARM/CONNMON_EKA2U.def
connectionmonitoring/connmon/connectionmonitor/BWINS/CONNMONU.DEF
connectionmonitoring/connmon/connectionmonitor/BWINSCW/CONNMONU.DEF
connectionmonitoring/connmon/connectionmonitor/BWINSCW/CONNMON_EKA2U.def
connectionmonitoring/connmon/connectionmonitor/EABI/ConnMonU.DEF
connectionmonitoring/connmon/connectionmonitor/EABI/ConnMon_EKA2U.def
connectionmonitoring/connmon/connectionmonitor/group/ConnMon.mmp
connectionmonitoring/connmon/connectionmonitor/group/ConnMonExe.mmp
connectionmonitoring/connmon/connectionmonitor/group/bld.inf
connectionmonitoring/connmon/connectionmonitor/inc/CCsdFax.h
connectionmonitoring/connmon/connectionmonitor/inc/CDataVolume.h
connectionmonitoring/connmon/connectionmonitor/inc/CEventQueue.h
connectionmonitoring/connmon/connectionmonitor/inc/CIapSupport.h
connectionmonitoring/connmon/connectionmonitor/inc/CPlugin.h
connectionmonitoring/connmon/connectionmonitor/inc/CPsdFax.h
connectionmonitoring/connmon/connectionmonitor/inc/CUiDialogAO.h
connectionmonitoring/connmon/connectionmonitor/inc/CWlanSupport.h
connectionmonitoring/connmon/connectionmonitor/inc/ConnMonAvailabilityManager.h
connectionmonitoring/connmon/connectionmonitor/inc/ConnMonBearer.h
connectionmonitoring/connmon/connectionmonitor/inc/ConnMonBearerCSD.h
connectionmonitoring/connmon/connectionmonitor/inc/ConnMonBearerGPRS.h
connectionmonitoring/connmon/connectionmonitor/inc/ConnMonBearerGroupManager.h
connectionmonitoring/connmon/connectionmonitor/inc/ConnMonBearerLAN.h
connectionmonitoring/connmon/connectionmonitor/inc/ConnMonBearerNotifier.h
connectionmonitoring/connmon/connectionmonitor/inc/ConnMonBearerWLAN.h
connectionmonitoring/connmon/connectionmonitor/inc/ConnMonCli.h
connectionmonitoring/connmon/connectionmonitor/inc/ConnMonDef.h
connectionmonitoring/connmon/connectionmonitor/inc/ConnMonEGprsNotifier.h
connectionmonitoring/connmon/connectionmonitor/inc/ConnMonHsdpaNotifier.h
connectionmonitoring/connmon/connectionmonitor/inc/ConnMonIAP.h
connectionmonitoring/connmon/connectionmonitor/inc/ConnMonNoti.h
connectionmonitoring/connmon/connectionmonitor/inc/ConnMonServ.h
connectionmonitoring/connmon/connectionmonitor/inc/ConnMonSess.h
connectionmonitoring/connmon/connectionmonitor/inc/ConnMonUtils.h
connectionmonitoring/connmon/connectionmonitor/inc/connmoncommsdatcache.h
connectionmonitoring/connmon/connectionmonitor/inc/connmoncommsdatnotifier.h
connectionmonitoring/connmon/connectionmonitor/inc/connmondtmnoti.h
connectionmonitoring/connmon/connectionmonitor/inc/connmontelnoti.h
connectionmonitoring/connmon/connectionmonitor/inc/connmonwlannetwork.h
connectionmonitoring/connmon/connectionmonitor/inc/log.h
connectionmonitoring/connmon/connectionmonitor/rom/connmon.iby
connectionmonitoring/connmon/connectionmonitor/src/CCsdFax.cpp
connectionmonitoring/connmon/connectionmonitor/src/CDataVolume.cpp
connectionmonitoring/connmon/connectionmonitor/src/CEventQueue.cpp
connectionmonitoring/connmon/connectionmonitor/src/CIapSupport.cpp
connectionmonitoring/connmon/connectionmonitor/src/CPlugin.cpp
connectionmonitoring/connmon/connectionmonitor/src/CPsdFax.cpp
connectionmonitoring/connmon/connectionmonitor/src/CUiDialogAO.cpp
connectionmonitoring/connmon/connectionmonitor/src/CWlanSupport.cpp
connectionmonitoring/connmon/connectionmonitor/src/ConnMonAvailabilityManager.cpp
connectionmonitoring/connmon/connectionmonitor/src/ConnMonBearer.cpp
connectionmonitoring/connmon/connectionmonitor/src/ConnMonBearerCSD.cpp
connectionmonitoring/connmon/connectionmonitor/src/ConnMonBearerGPRS.cpp
connectionmonitoring/connmon/connectionmonitor/src/ConnMonBearerGroupManager.cpp
connectionmonitoring/connmon/connectionmonitor/src/ConnMonBearerLAN.cpp
connectionmonitoring/connmon/connectionmonitor/src/ConnMonBearerNotifier.cpp
connectionmonitoring/connmon/connectionmonitor/src/ConnMonBearerWLAN.cpp
connectionmonitoring/connmon/connectionmonitor/src/ConnMonCli.cpp
connectionmonitoring/connmon/connectionmonitor/src/ConnMonEGprsNotifier.cpp
connectionmonitoring/connmon/connectionmonitor/src/ConnMonExe.cpp
connectionmonitoring/connmon/connectionmonitor/src/ConnMonHsdpaNotifier.cpp
connectionmonitoring/connmon/connectionmonitor/src/ConnMonIAP.cpp
connectionmonitoring/connmon/connectionmonitor/src/ConnMonId.cpp
connectionmonitoring/connmon/connectionmonitor/src/ConnMonIdsArrayPckg.cpp
connectionmonitoring/connmon/connectionmonitor/src/ConnMonNoti.cpp
connectionmonitoring/connmon/connectionmonitor/src/ConnMonServ.cpp
connectionmonitoring/connmon/connectionmonitor/src/ConnMonSess.cpp
connectionmonitoring/connmon/connectionmonitor/src/ConnMonUtils.cpp
connectionmonitoring/connmon/connectionmonitor/src/ConnMonWLANNetwork.cpp
connectionmonitoring/connmon/connectionmonitor/src/ConnMonWLANNetworksArrayPckg.cpp
connectionmonitoring/connmon/connectionmonitor/src/ConnMonWLANNetworksArrayPckg_v2.cpp
connectionmonitoring/connmon/connectionmonitor/src/RConnMon.cpp
connectionmonitoring/connmon/connectionmonitor/src/connmoncommsdatcache.cpp
connectionmonitoring/connmon/connectionmonitor/src/connmoncommsdatnotifier.cpp
connectionmonitoring/connmon/connectionmonitor/src/connmondtmnoti.cpp
connectionmonitoring/connmon/connectionmonitor/src/connmontelnoti.cpp
connectionmonitoring/connmon/connectionmonitor/src/connmonwlannetwork_v2.cpp
connectionmonitoring/connmon/dataconnectionlogger/BMARM/DATACONNECTIONLOGGERU.DEF
connectionmonitoring/connmon/dataconnectionlogger/BWINS/DATACONNECTIONLOGGERU.DEF
connectionmonitoring/connmon/dataconnectionlogger/EABI/DATACONNECTIONLOGGERU.DEF
connectionmonitoring/connmon/dataconnectionlogger/cenrep/keys_dcl.xls
connectionmonitoring/connmon/dataconnectionlogger/conf/dcl.confml
connectionmonitoring/connmon/dataconnectionlogger/conf/dcl_101F4CD5.crml
connectionmonitoring/connmon/dataconnectionlogger/conf/dcl_101F6CFE.crml
connectionmonitoring/connmon/dataconnectionlogger/group/backup_registration.xml
connectionmonitoring/connmon/dataconnectionlogger/group/bld.inf
connectionmonitoring/connmon/dataconnectionlogger/group/dcl.mmp
connectionmonitoring/connmon/dataconnectionlogger/inc/DclPrivateCRKeys.h
connectionmonitoring/connmon/dataconnectionlogger/inc/dcl.h
connectionmonitoring/connmon/dataconnectionlogger/inc/dclTimer.h
connectionmonitoring/connmon/dataconnectionlogger/inc/dcl_log.h
connectionmonitoring/connmon/dataconnectionlogger/inc/dclevent.h
connectionmonitoring/connmon/dataconnectionlogger/inc/saeobserver.h
connectionmonitoring/connmon/dataconnectionlogger/rom/DataConnectionLogger.iby
connectionmonitoring/connmon/dataconnectionlogger/src/dcl.cpp
connectionmonitoring/connmon/dataconnectionlogger/src/dclTimer.cpp
connectionmonitoring/connmon/dataconnectionlogger/src/dcl_dll.cpp
connectionmonitoring/connmon/dataconnectionlogger/src/dclevent.cpp
connectionmonitoring/connmon/dataconnectionlogger/src/saeobserver.cpp
connectionmonitoring/connmonext/BMARM/CONNMONEXTU.DEF
connectionmonitoring/connmonext/BWINS/CONNMONEXTU.DEF
connectionmonitoring/connmonext/BWinsCw/CONNMONEXTU.DEF
connectionmonitoring/connmonext/BWinsCw/CONNMONEXT_EKA2U.def
connectionmonitoring/connmonext/EABI/ConnMonExtU.DEF
connectionmonitoring/connmonext/EABI/ConnMonExt_EKA2U.def
connectionmonitoring/connmonext/group/ConnMonExt.mmp
connectionmonitoring/connmonext/group/bld.inf
connectionmonitoring/connmonext/inc/log.h
connectionmonitoring/connmonext/rom/ConnMonExt.iby
connectionmonitoring/connmonext/src/ConnMonExt.cpp
connectionmonitoring/group/bld.inf
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/BWinsCw/ConnUiUtilsNotifU.DEF
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/BWinsCw/ConnectionUiUtilities_ALRU.def
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/BWinsCw/ConnectionUiUtilities_PROTU.def
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/EABI/ConnUiUtilsNotifU.DEF
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/EABI/ConnectionUiUtilities_ALRU.def
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/EABI/ConnectionUiUtilities_PROTU.def
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/ActiveConnectViaNote.h
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/ActiveOfflineWlanDisabledNote.h
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/ActiveSelectWLanDlgPlugin.h
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/ActiveWLANNetworkUnavailableNote.h
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/ConfirmationQuery.h
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/ConfirmationQueryNotif.h
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/ConnUiUtilsNotif.h
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/ConnUiUtilsNotif.hrh
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/ConnectViaNoteNotif.h
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/EasyWepDlgNotif.h
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/EasyWpaDlgNotif.h
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/NetworkInfoArray.h
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/NetworkInfoBase.h
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/NetworkInfoBase.inl
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/NetworkInfoKey.h
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/NoteDlgSuppressingSwitch.h
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/OfflineWlanDisabledNoteNotif.h
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/OfflineWlanNoteDlg.h
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/OfflineWlanNoteNotif.h
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/SelectWLANDlg.h
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/SelectWLANDlg.inl
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/SelectWLanDlgPlugin.h
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/WLANNetworkUnavailableNoteNotif.h
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/WepWpaQueryDlg.h
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/WlanNetworkDataProvider.h
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/WlanNetworkDataProvider.inl
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/connectingviadiscreetpopup.h
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/connectingviadiscreetpopupnotif.h
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/connectionerrordiscreetpopup.h
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/connectionerrordiscreetpopupnotif.h
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/easywapidlgnotif.h
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/nowlannetworksavailablenotif.h
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/wlancoveragecheck.h
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/wlanpowersavetest.h
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/wlanpowersavetestnotif.h
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/ActiveConnectViaNote.cpp
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/ActiveOfflineWlanDisabledNote.cpp
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/ActiveSelectWLanDlgPlugin.cpp
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/ActiveWLANNetworkUnavailableNote.cpp
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/ConfirmationQuery.cpp
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/ConfirmationQueryNotif.cpp
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/ConnUiUtilsNotif.cpp
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/ConnectViaNoteNotif.cpp
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/EasyWepDlgNotif.cpp
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/EasyWpaDlgNotif.cpp
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/NetworkInfoArray.cpp
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/NetworkInfoBase.cpp
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/NetworkInfoKey.cpp
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/NoteDlgSuppressingSwitch.cpp
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/OfflineWlanDisabledNoteNotif.cpp
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/OfflineWlanNoteDlg.cpp
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/OfflineWlanNoteNotif.cpp
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/SelectWLANDlg.cpp
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/SelectWLanDlgPlugin.cpp
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/WLANNetworkUnavailableNoteNotif.cpp
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/WepWpaQueryDlg.cpp
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/WlanNetworkDataProvider.cpp
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/connectingviadiscreetpopup.cpp
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/connectingviadiscreetpopupnotif.cpp
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/connectionerrordiscreetpopup.cpp
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/connectionerrordiscreetpopupnotif.cpp
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/easywapidlgnotif.cpp
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/nowlannetworksavailablenotif.cpp
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/wlancoveragecheck.cpp
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/wlanpowersavetest.cpp
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/wlanpowersavetestnotif.cpp
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/data/ConnUiUtilsNotif.rss
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/data/ConnectionUiUtilities.rss
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/inc/ActiveCChangeConnectionDlg.h
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/inc/ActiveCChangeConnectionDlg.inl
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/inc/ActiveWrapper.h
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/inc/ChangeConnectionDlg.h
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/inc/ConnectionUiUtilitiesClient.h
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/inc/ConnectionUiUtilitiesCommon.h
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/inc/ConnectionUiUtilitiesImpl.h
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/inc/ConnectionUiUtilitiesPanic.h
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/inc/ConnectionUiUtilitiesPrivateCRKeys.h
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/loc/connectionuiutilities.loc
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/src/ActiveCChangeConnectionDlg.cpp
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/src/ActiveWrapper.cpp
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/src/ChangeConnectionDlg.cpp
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/src/ConnectionUiUtilities.cpp
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/src/ConnectionUiUtilitiesClient.cpp
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/src/ConnectionUiUtilitiesImpl.cpp
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/src/ConnectionUiUtilitiesPanic.cpp
connectionutilities/ConnectionDialogs/DisconnectDlg/BWinsCw/DISCONNECTDLGCLIENTU.def
connectionutilities/ConnectionDialogs/DisconnectDlg/BWinsCw/DISCONNECTDLGU.def
connectionutilities/ConnectionDialogs/DisconnectDlg/EABI/DISCONNECTDLGCLIENTU.def
connectionutilities/ConnectionDialogs/DisconnectDlg/EABI/DisconnectDlgU.DEF
connectionutilities/ConnectionDialogs/DisconnectDlg/clientsrc/DisconnectDlgClient.cpp
connectionutilities/ConnectionDialogs/DisconnectDlg/data/DisconnectDlg.rss
connectionutilities/ConnectionDialogs/DisconnectDlg/inc/ActiveDisconnectDlgPlugin.h
connectionutilities/ConnectionDialogs/DisconnectDlg/inc/ConnectionCArray.h
connectionutilities/ConnectionDialogs/DisconnectDlg/inc/ConnectionInfo.h
connectionutilities/ConnectionDialogs/DisconnectDlg/inc/ConnectionInfo.inl
connectionutilities/ConnectionDialogs/DisconnectDlg/inc/ConnectionModel.h
connectionutilities/ConnectionDialogs/DisconnectDlg/inc/DisconnectDlgActiveWaiter.h
connectionutilities/ConnectionDialogs/DisconnectDlg/inc/DisconnectDlgDialog.h
connectionutilities/ConnectionDialogs/DisconnectDlg/inc/DisconnectDlgUi.h
connectionutilities/ConnectionDialogs/DisconnectDlg/inc/DisconnectDlgUi.inl
connectionutilities/ConnectionDialogs/DisconnectDlg/inc/QueryDisconnectDlgDialog.h
connectionutilities/ConnectionDialogs/DisconnectDlg/inc/connectioninfosortkey.h
connectionutilities/ConnectionDialogs/DisconnectDlg/loc/disconnectdlg.loc
connectionutilities/ConnectionDialogs/DisconnectDlg/src/ActiveDisconnectDlgPlugin.cpp
connectionutilities/ConnectionDialogs/DisconnectDlg/src/ConnectionCArray.cpp
connectionutilities/ConnectionDialogs/DisconnectDlg/src/ConnectionInfo.cpp
connectionutilities/ConnectionDialogs/DisconnectDlg/src/ConnectionModel.cpp
connectionutilities/ConnectionDialogs/DisconnectDlg/src/DisconnectDlgActiveWaiter.cpp
connectionutilities/ConnectionDialogs/DisconnectDlg/src/DisconnectDlgDialog.cpp
connectionutilities/ConnectionDialogs/DisconnectDlg/src/DisconnectDlgUi.cpp
connectionutilities/ConnectionDialogs/DisconnectDlg/src/QueryDisconnectDlgDialog.cpp
connectionutilities/ConnectionDialogs/DisconnectDlg/src/connectioninfosortkey.cpp
connectionutilities/ConnectionDialogs/cconndlg/BWinsCw/AgentDialogU.def
connectionutilities/ConnectionDialogs/cconndlg/BWinsCw/CConnDlgPluginU.DEF
connectionutilities/ConnectionDialogs/cconndlg/EABI/CCONNDLGPLUGINU.DEF
connectionutilities/ConnectionDialogs/cconndlg/EABI/agentdialogu.def
connectionutilities/ConnectionDialogs/cconndlg/clientinc/ActiveLogin.h
connectionutilities/ConnectionDialogs/cconndlg/clientinc/GenConAgentDialogServer.h
connectionutilities/ConnectionDialogs/cconndlg/clientsrc/ActiveLogin.cpp
connectionutilities/ConnectionDialogs/cconndlg/clientsrc/GenConAgentDialogServer.cpp
connectionutilities/ConnectionDialogs/cconndlg/data/CConnDlgPlugin.rss
connectionutilities/ConnectionDialogs/cconndlg/inc/ActiveBase.h
connectionutilities/ConnectionDialogs/cconndlg/inc/ActiveIapPlugin.h
connectionutilities/ConnectionDialogs/cconndlg/inc/ActiveSelectConnectionPlugin.h
connectionutilities/ConnectionDialogs/cconndlg/inc/ActiveSelectExplicit.h
connectionutilities/ConnectionDialogs/cconndlg/inc/AuthenticationDialog.h
connectionutilities/ConnectionDialogs/cconndlg/inc/CConnDlgPrivateCRKeys.h
connectionutilities/ConnectionDialogs/cconndlg/inc/ConnDlgPlugin.h
connectionutilities/ConnectionDialogs/cconndlg/inc/IAPDialog.h
connectionutilities/ConnectionDialogs/cconndlg/inc/IapDialog.inl
connectionutilities/ConnectionDialogs/cconndlg/inc/NewIapDialog.h
connectionutilities/ConnectionDialogs/cconndlg/inc/QosDialog.h
connectionutilities/ConnectionDialogs/cconndlg/inc/ReconnectDialog.h
connectionutilities/ConnectionDialogs/cconndlg/inc/SelectConnectionDialog.h
connectionutilities/ConnectionDialogs/cconndlg/inc/SelectConnectionDialog.inl
connectionutilities/ConnectionDialogs/cconndlg/inc/SelectExplicitDialog.h
connectionutilities/ConnectionDialogs/cconndlg/inc/SelectExplicitDialog.inl
connectionutilities/ConnectionDialogs/cconndlg/inc/sortsnaputils.h
connectionutilities/ConnectionDialogs/cconndlg/loc/agentdialog.loc
connectionutilities/ConnectionDialogs/cconndlg/src/ActiveBase.cpp
connectionutilities/ConnectionDialogs/cconndlg/src/ActiveIapPlugin.cpp
connectionutilities/ConnectionDialogs/cconndlg/src/ActiveSelectConnectionPlugin.cpp
connectionutilities/ConnectionDialogs/cconndlg/src/ActiveSelectExplicit.cpp
connectionutilities/ConnectionDialogs/cconndlg/src/AuthenticationDialog.cpp
connectionutilities/ConnectionDialogs/cconndlg/src/ConnDlgPlugin.cpp
connectionutilities/ConnectionDialogs/cconndlg/src/IAPDialog.cpp
connectionutilities/ConnectionDialogs/cconndlg/src/NewIapDialog.cpp
connectionutilities/ConnectionDialogs/cconndlg/src/QosDialog.cpp
connectionutilities/ConnectionDialogs/cconndlg/src/ReconnectDialog.cpp
connectionutilities/ConnectionDialogs/cconndlg/src/SelectConnectionDialog.cpp
connectionutilities/ConnectionDialogs/cconndlg/src/SelectExplicitDialog.cpp
connectionutilities/ConnectionDialogs/cconndlg/src/sortsnaputils.cpp
connectionutilities/ConnectionDialogs/cenrep/keys_connectiondialogs.xls
connectionutilities/ConnectionDialogs/conf/connectiondialogs.confml
connectionutilities/ConnectionDialogs/conf/connectiondialogs_10008D55.crml
connectionutilities/ConnectionDialogs/conf/connectiondialogs_101FD67E.crml
connectionutilities/ConnectionDialogs/data/10207374.rss
connectionutilities/ConnectionDialogs/ecomsrc/connectiondialogswrapper.cpp
connectionutilities/ConnectionDialogs/group/CConnDlgClient.mmp
connectionutilities/ConnectionDialogs/group/CConnDlgPlugin.mmp
connectionutilities/ConnectionDialogs/group/ConnUiUtilsIcons.mk
connectionutilities/ConnectionDialogs/group/ConnUiUtilsNotif.mmp
connectionutilities/ConnectionDialogs/group/ConnectionUiUtilities.mmp
connectionutilities/ConnectionDialogs/group/DisconnectDlg.mmp
connectionutilities/ConnectionDialogs/group/DisconnectDlgClient.mmp
connectionutilities/ConnectionDialogs/group/DisconnectDlgIcons.MK
connectionutilities/ConnectionDialogs/group/bld.inf
connectionutilities/ConnectionDialogs/group/connectiondialogswrapper.mmp
connectionutilities/ConnectionDialogs/inc/ActiveIAPListing.h
connectionutilities/ConnectionDialogs/inc/ConnectionDialogs.hrh
connectionutilities/ConnectionDialogs/inc/ConnectionDialogsLogger.h
connectionutilities/ConnectionDialogs/inc/ConnectionDialogsNotifBase.h
connectionutilities/ConnectionDialogs/inc/ConnectionDialogsNotifBase.inl
connectionutilities/ConnectionDialogs/inc/ConnectionDialogsUidDefs.h
connectionutilities/ConnectionDialogs/inc/ConnectionInfo.h
connectionutilities/ConnectionDialogs/inc/ConnectionInfo.inl
connectionutilities/ConnectionDialogs/inc/ConnectionInfoArray.h
connectionutilities/ConnectionDialogs/inc/ConnectionInfoKey.h
connectionutilities/ConnectionDialogs/inc/ExpiryTimer.h
connectionutilities/ConnectionDialogs/inc/ExpiryTimerCallback.h
connectionutilities/ConnectionDialogs/rom/ConnectionDialogs.iby
connectionutilities/ConnectionDialogs/rom/ConnectionUiUtilities.iby
connectionutilities/ConnectionDialogs/rom/ConnectionUiUtilitiesResources.iby
connectionutilities/ConnectionDialogs/rom/DisconnectDlg.iby
connectionutilities/ConnectionDialogs/rom/DisconnectDlgResources.iby
connectionutilities/ConnectionDialogs/rom/agentdialog.iby
connectionutilities/ConnectionDialogs/rom/cconndlg.iby
connectionutilities/ConnectionDialogs/rom/cconndlgResources.iby
connectionutilities/ConnectionDialogs/src/ActiveIAPListing.cpp
connectionutilities/ConnectionDialogs/src/ConnectionDialogsNotifBase.cpp
connectionutilities/ConnectionDialogs/src/ConnectionInfo.cpp
connectionutilities/ConnectionDialogs/src/ConnectionInfoArray.cpp
connectionutilities/ConnectionDialogs/src/ConnectionInfoKey.cpp
connectionutilities/ConnectionDialogs/src/ExpiryTimer.cpp
data/cccccc00_emulator.cre
dbcreator/commsdatcreator/Inc/cdcdatamobilitytables.h
dbcreator/commsdatcreator/Inc/cdcdumptables.h
dbcreator/commsdatcreator/Inc/cdclogfilename.h
dbcreator/commsdatcreator/Inc/cdcprocessorbase.h
dbcreator/commsdatcreator/Inc/cdcprocessordn.h
dbcreator/commsdatcreator/Inc/cdcprocessorglobal.h
dbcreator/commsdatcreator/Inc/cdcprocessorlan.h
dbcreator/commsdatcreator/Inc/cdcprocessorpacketdata.h
dbcreator/commsdatcreator/Inc/cdcprocessorvpn.h
dbcreator/commsdatcreator/Inc/cdcprocessorwlan.h
dbcreator/commsdatcreator/Inc/cdcreaderbase.h
dbcreator/commsdatcreator/Inc/cdcreaderxml.h
dbcreator/commsdatcreator/Inc/cdctagcontainer.h
dbcreator/commsdatcreator/Inc/cdcwlandevicesettings.h
dbcreator/commsdatcreator/Inc/cdcwlantables.h
dbcreator/commsdatcreator/Src/cdccommsdatcreator.cpp
dbcreator/commsdatcreator/Src/cdcdatamobilitytables.cpp
dbcreator/commsdatcreator/Src/cdcdumptables.cpp
dbcreator/commsdatcreator/Src/cdcprocessorbase.cpp
dbcreator/commsdatcreator/Src/cdcprocessordn.cpp
dbcreator/commsdatcreator/Src/cdcprocessorglobal.cpp
dbcreator/commsdatcreator/Src/cdcprocessorlan.cpp
dbcreator/commsdatcreator/Src/cdcprocessorpacketdata.cpp
dbcreator/commsdatcreator/Src/cdcprocessorvpn.cpp
dbcreator/commsdatcreator/Src/cdcprocessorwlan.cpp
dbcreator/commsdatcreator/Src/cdcreaderbase.cpp
dbcreator/commsdatcreator/Src/cdcreaderxml.cpp
dbcreator/commsdatcreator/Src/cdctagcontainer.cpp
dbcreator/commsdatcreator/Src/cdcwlandevicesettings.cpp
dbcreator/commsdatcreator/Src/cdcwlantables.cpp
dbcreator/commsdatcreator/bwins/commsdatcreatoru.def
dbcreator/commsdatcreator/eabi/commsdatcreatoru.def
dbcreator/commsdatcreator/group/bld.inf
dbcreator/commsdatcreator/group/cdccommsdatcreator.mmp
dbcreator/commsdatcreatorrfsplugin/data/10281BC5.rss
dbcreator/commsdatcreatorrfsplugin/group/bld.inf
dbcreator/commsdatcreatorrfsplugin/group/cdccommsdatcreatorrfsplugin.mmp
dbcreator/commsdatcreatorrfsplugin/inc/cdccommsdatcreatorrfsplugin.h
dbcreator/commsdatcreatorrfsplugin/inc/cdclogfilename.h
dbcreator/commsdatcreatorrfsplugin/inc/cdcprocesslauncher.h
dbcreator/commsdatcreatorrfsplugin/src/cdccommsdatcreatorrfsplugin.cpp
dbcreator/commsdatcreatorrfsplugin/src/cdccommsdatcreatorrfspluginproxy.cpp
dbcreator/commsdatcreatorrfsplugin/src/cdcprocesslauncher.cpp
dbcreator/commsdatstartup/Inc/cdccommsdatstartup.h
dbcreator/commsdatstartup/Inc/cdclogfilename.h
dbcreator/commsdatstartup/Src/cdccommsdatstartup.cpp
dbcreator/commsdatstartup/Src/main.cpp
dbcreator/commsdatstartup/cenrep/keys_commsdatcreator.xls
dbcreator/commsdatstartup/group/bld.inf
dbcreator/commsdatstartup/group/cdccommsdatstartup.mmp
dbcreator/conf/commsdatcreator.confml
dbcreator/conf/commsdatcreator_01.gcfml
dbcreator/conf/commsdatcreator_10281BC8.crml
dbcreator/dbcreatorexe/Inc/cdcdbcreator.h
dbcreator/dbcreatorexe/Inc/cdclogfilename.h
dbcreator/dbcreatorexe/Src/cdcdbcreator.cpp
dbcreator/dbcreatorexe/Src/main.cpp
dbcreator/dbcreatorexe/group/bld.inf
dbcreator/dbcreatorexe/group/dbcreatorexe.mmp
dbcreator/group/bld.inf
dbcreator/inc/cdccommon.h
dbcreator/inc/cdccommsdatcreator.h
dbcreator/inc/cdccommsdatcreatorcrkeys.h
dbcreator/inc/cdcerrors.h
dbcreator/inc/cdclogger.h
dbcreator/rom/commsdatcreator.iby
group/bld.inf
inc/meshpreface1.cfg
ipcm_plat/access_point_engine_misc_api/access_point_engine_misc_api.metaxml
ipcm_plat/access_point_engine_misc_api/group/bld.inf
ipcm_plat/access_point_engine_misc_api/inc/ApProtHandler.h
ipcm_plat/access_point_engine_misc_api/inc/VpnAPEngine.h
ipcm_plat/access_point_engine_misc_api/inc/VpnAPItem.h
ipcm_plat/bearer_settings_plugin_api/bearer_settings_plugin_api.metaxml
ipcm_plat/bearer_settings_plugin_api/group/bld.inf
ipcm_plat/bearer_settings_plugin_api/inc/cmcommonconstants.h
ipcm_plat/bearer_settings_plugin_api/inc/cmmanager.loc
ipcm_plat/bearer_settings_plugin_api/inc/cmpbasesettingsdlg.h
ipcm_plat/bearer_settings_plugin_api/inc/cmpbasesettingsdlgadv.h
ipcm_plat/bearer_settings_plugin_api/inc/cmpbasesettingsdlgip.h
ipcm_plat/bearer_settings_plugin_api/inc/cmpluginbase.h
ipcm_plat/bearer_settings_plugin_api/inc/cmpluginbaseeng.h
ipcm_plat/bearer_settings_plugin_api/inc/cmpluginlanbase.h
ipcm_plat/bearer_settings_plugin_api/inc/cmpluginlanbasedef.h
ipcm_plat/bearer_settings_plugin_api/inc/cmpluginlandef.h
ipcm_plat/bearer_settings_plugin_api/inc/mcmdexec.h
ipcm_plat/commsdat_wlan_api/commsdat_wlan_api.metaxml
ipcm_plat/commsdat_wlan_api/group/bld.inf
ipcm_plat/commsdat_wlan_api/inc/cmmanagertablefields.h
ipcm_plat/commsdat_wlan_api/inc/wlancdbcols.h
ipcm_plat/commsdat_wlan_api/inc/wlancontainer.h
ipcm_plat/connection_monitor_extension_api/connection_monitor_extension_api.metaxml
ipcm_plat/connection_monitor_extension_api/group/bld.inf
ipcm_plat/connection_monitor_extension_api/inc/ConnMonExt.h
ipcm_plat/connection_ui_utilities_api/connection_ui_utilities_api.metaxml
ipcm_plat/connection_ui_utilities_api/group/bld.inf
ipcm_plat/connection_ui_utilities_api/inc/ConnectionUiUtilities.h
ipcm_plat/disconnect_dialog_api/disconnect_dialog_api.metaxml
ipcm_plat/disconnect_dialog_api/group/bld.inf
ipcm_plat/disconnect_dialog_api/inc/DisconnectDlgClient.h
ipcm_plat/disconnect_dialog_disable_api/disconnect_dialog_disable_api.metaxml
ipcm_plat/disconnect_dialog_disable_api/group/bld.inf
ipcm_plat/disconnect_dialog_disable_api/inc/mpmpropertydef.h
ipcm_plat/extended_connection_settings_api/extended_connection_settings_api.metaxml
ipcm_plat/extended_connection_settings_api/group/bld.inf
ipcm_plat/extended_connection_settings_api/inc/cmcommonui.h
ipcm_plat/extended_connection_settings_api/inc/cmconnectionmethodext.h
ipcm_plat/extended_connection_settings_api/inc/cmdestinationext.h
ipcm_plat/extended_connection_settings_api/inc/cmmanagerext.h
ipcm_plat/extended_connection_settings_api/inc/cmpsettingsconsts.h
ipcm_plat/extended_connection_settings_api/inc/cmsettingsui.h
ipcm_plat/group/bld.inf
ipcm_plat/mpm_connect_screen_api/group/bld.inf
ipcm_plat/mpm_connect_screen_api/inc/mpmconnectscreenid.h
ipcm_plat/mpm_default_connection_api/group/bld.inf
ipcm_plat/mpm_default_connection_api/inc/rmpmdefaultconnection.h
ipcm_plat/mpm_default_connection_api/mpm_default_connection_api.metaxml
ipcm_plat/pdpcontextmanager2_reset_factory_settings_api/group/bld.inf
ipcm_plat/pdpcontextmanager2_reset_factory_settings_api/inc/pdpcontextmanagerpskeys.h
ipcm_plat/pdpcontextmanager2_reset_factory_settings_api/pdpcontextmanager2_reset_factory_settings_api.metaxml
ipcm_plat/pdpcontextmanager2_settings_api/group/bld.inf
ipcm_plat/pdpcontextmanager2_settings_api/inc/pdpcontextmanagerinternalcrkeys.h
ipcm_plat/pdpcontextmanager2_settings_api/pdpcontextmanager2_settings_api.metaxml
ipcm_pub/access_point_engine_api/access_point_engine_api.metaxml
ipcm_pub/access_point_engine_api/group/bld.inf
ipcm_pub/access_point_engine_api/inc/APAccessPointItem.h
ipcm_pub/access_point_engine_api/inc/APDataHandler.h
ipcm_pub/access_point_engine_api/inc/APNetworks.h
ipcm_pub/access_point_engine_api/inc/APSelect.h
ipcm_pub/access_point_engine_api/inc/APUtils.h
ipcm_pub/access_point_engine_api/inc/ActiveApDb.h
ipcm_pub/access_point_engine_api/inc/ApEngineConsts.h
ipcm_pub/access_point_engine_api/inc/ApEngineVer.h
ipcm_pub/access_point_engine_api/inc/ApListItem.h
ipcm_pub/access_point_engine_api/inc/ApNetworkItem.h
ipcm_pub/access_point_engine_api/inc/ApNetworkItemlist.h
ipcm_pub/access_point_engine_api/inc/Aplistitemlist.h
ipcm_pub/access_point_settings_handler_api/access_point_settings_handler_api.metaxml
ipcm_pub/access_point_settings_handler_api/group/bld.inf
ipcm_pub/access_point_settings_handler_api/inc/ApSettingsHandlerCommons.h
ipcm_pub/access_point_settings_handler_api/inc/Apsettingshandlerui.h
ipcm_pub/agent_dialog_api/agent_dialog_api.metaxml
ipcm_pub/agent_dialog_api/group/bld.inf
ipcm_pub/agent_dialog_api/inc/agentdialog.h
ipcm_pub/connection_monitor_server_api/connection_monitor_server_api.metaxml
ipcm_pub/connection_monitor_server_api/group/bld.inf
ipcm_pub/connection_monitor_server_api/inc/rconnmon.h
ipcm_pub/connection_settings_api/connection_settings_api.metaxml
ipcm_pub/connection_settings_api/group/bld.inf
ipcm_pub/connection_settings_api/inc/cmconnectionmethod.h
ipcm_pub/connection_settings_api/inc/cmconnectionmethod.inl
ipcm_pub/connection_settings_api/inc/cmconnectionmethoddef.h
ipcm_pub/connection_settings_api/inc/cmdefconnvalues.h
ipcm_pub/connection_settings_api/inc/cmdestination.h
ipcm_pub/connection_settings_api/inc/cmgenconnsettings.h
ipcm_pub/connection_settings_api/inc/cmmanager.h
ipcm_pub/connection_settings_api/inc/cmmanager.inl
ipcm_pub/connection_settings_api/inc/cmmanagerdef.h
ipcm_pub/connection_settings_api/inc/cmplugincsddef.h
ipcm_pub/connection_settings_api/inc/cmplugindialcommondefs.h
ipcm_pub/connection_settings_api/inc/cmpluginembdestinationdef.h
ipcm_pub/connection_settings_api/inc/cmpluginhscsddef.h
ipcm_pub/connection_settings_api/inc/cmpluginpacketdatadef.h
ipcm_pub/connection_settings_api/inc/cmpluginvpndef.h
ipcm_pub/connection_settings_api/inc/cmpluginwlandef.h
ipcm_pub/connection_settings_api/inc/cmsettingsui.h
ipcm_pub/connection_settings_ui_api/connection_settings_ui_api.metaxml
ipcm_pub/connection_settings_ui_api/group/bld.inf
ipcm_pub/connection_settings_ui_api/inc/cmapplicationsettingsui.h
ipcm_pub/data_connection_log_counters_api/data_connection_log_counters_api.metaxml
ipcm_pub/data_connection_log_counters_api/group/bld.inf
ipcm_pub/data_connection_log_counters_api/inc/dclcrkeys.h
ipcm_pub/extendedconnpref_api/extendedconnpref_api.metaxml
ipcm_pub/extendedconnpref_api/group/bld.inf
ipcm_pub/extendedconnpref_api/inc/extendedconnpref.h
ipcm_pub/group/bld.inf
layers.sysdef.xml
package_definition.xml
sysdef_1_4_0.dtd
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/accesspointcontrol/apcontrollistplugin/data/10281BB4.rss	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,48 @@
+/*
+* 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
+                    }
+                };
+            }
+        };
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/accesspointcontrol/apcontrollistplugin/data/apcontrollistpluginrsc.rss	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,357 @@
+/*
+* 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/accesspointcontrol/apcontrollistplugin/group/apcontrollistplugin.mmp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,96 @@
+/*
+* 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/accesspointcontrol/apcontrollistplugin/group/apcontrollistpluginicons_dc.mk	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,66 @@
+#
+# 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/accesspointcontrol/apcontrollistplugin/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,49 @@
+/*
+* 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/accesspointcontrol/apcontrollistplugin/inc/apcontrollistapiwrapper.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,240 @@
+/*
+* 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/accesspointcontrol/apcontrollistplugin/inc/apcontrollistbox.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,83 @@
+/*
+* 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/accesspointcontrol/apcontrollistplugin/inc/apcontrollistboxmodel.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,68 @@
+/*
+* 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/accesspointcontrol/apcontrollistplugin/inc/apcontrollistcapschange.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,75 @@
+/*
+* 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/accesspointcontrol/apcontrollistplugin/inc/apcontrollistplugin.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,256 @@
+/*
+* 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/accesspointcontrol/apcontrollistplugin/inc/apcontrollistplugin.hrh	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,38 @@
+/*
+* 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/accesspointcontrol/apcontrollistplugin/inc/apcontrollistplugincontainer.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,170 @@
+/*
+* 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   
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/accesspointcontrol/apcontrollistplugin/inc/apcontrollistpluginlogger.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,155 @@
+/*
+* 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 */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/accesspointcontrol/apcontrollistplugin/loc/apcontrollistplugin.loc	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,162 @@
+/*
+* 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
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/accesspointcontrol/apcontrollistplugin/rom/APControlListPlugin.iby	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,32 @@
+/*
+* 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/accesspointcontrol/apcontrollistplugin/rom/APControlListPluginResources.iby	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/accesspointcontrol/apcontrollistplugin/src/apcontrollistapiwrapper.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,709 @@
+/*
+* 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" ) ) );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/accesspointcontrol/apcontrollistplugin/src/apcontrollistbox.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,169 @@
+/*
+* 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/accesspointcontrol/apcontrollistplugin/src/apcontrollistboxmodel.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,83 @@
+/*
+* 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/accesspointcontrol/apcontrollistplugin/src/apcontrollistcapschange.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,110 @@
+/*
+* 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" ) ) );
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/accesspointcontrol/apcontrollistplugin/src/apcontrollistplugin.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,506 @@
+/*
+* 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/accesspointcontrol/apcontrollistplugin/src/apcontrollistplugincontainer.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,344 @@
+/*
+* 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  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/accesspointcontrol/apcontrollistplugin/src/apcontrollistpluginimplementationtable.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,45 @@
+/*
+* 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;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/accesspointcontrol/apcontrollistplugin/src/apcontrollistpluginlogger.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,172 @@
+/*
+* 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
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2001-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:  Build information file for all projects in  
+*                alwaysonline subsystem
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+#include "../pdpcontextmanager2/group/bld.inf"
+
+PRJ_TESTMMPFILES
+
Binary file alwayson_net_plugin/pdpcontextmanager2/cenrep/keys_pdpcontextmanager2.xls has changed
Binary file alwayson_net_plugin/pdpcontextmanager2/conf/pdpcontextmanager2.confml has changed
Binary file alwayson_net_plugin/pdpcontextmanager2/conf/pdpcontextmanager2_102071F5.crml has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/data/10281f41.rss	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2002 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 <ecom/registryinfo.rh>
+
+RESOURCE REGISTRY_INFO theInfo
+	{
+	// PDPContextManager2.dll UID
+	dll_uid = 0x10281F41;
+	interfaces = 
+		{
+		INTERFACE_INFO
+			{
+			// CEComInterface interface UID
+			interface_uid = 0x101F85EC;
+			implementations = 
+				{
+				IMPLEMENTATION_INFO
+					{
+					// AlwaysOnlineManager implementation UID
+					implementation_uid = 0x10281F42;
+					version_no = 1;
+					display_name = "PDP context ECom Plugin for always online manager";
+					default_data = "PDPContextManager2";
+					// Note : opaque_data MUST have @ least a single byte of data
+					// in this instance it is an empty string.
+					opaque_data = " ";
+					}
+				// Place additional interface implementations here
+				};
+			}
+		// Place additional interfaces here
+		};
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/data/pdpcontextmanager2.rss	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2002 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 <eikon.rh>
+#include <avkon.loc>
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.hrh>
+#include <avkon.mbg>
+
+NAME AOEM
+RESOURCE RSS_SIGNATURE {}
+RESOURCE TBUF16 { buf=""; }
+
+
+//EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2002-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:  Build information file for project PDPContextManager2
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../rom/pdpcontextmanager2.iby CORE_MW_LAYER_IBY_EXPORT_PATH(pdpcontextmanager2.iby)
+
+
+../conf/pdpcontextmanager2.confml		APP_LAYER_CONFML(pdpcontextmanager2.confml)
+../conf/pdpcontextmanager2_102071F5.crml	APP_LAYER_CRML(pdpcontextmanager2_102071F5.crml)
+
+#ifndef WINSCW
+PRJ_MMPFILES
+pdpcontextmanager2.mmp
+#endif
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/group/pdpcontextmanager2.mmp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2004,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:  mmp file of the project
+*
+*/
+
+
+#include <platform_paths.hrh>
+#include "../inc/alwaysonconfig.hrh"
+
+TARGET          pdpcontextmanager2.dll
+TARGETTYPE      PLUGIN
+UID             0x10009D8D 0x10281F41
+
+CAPABILITY      CAP_ECOM_PLUGIN
+VENDORID        VID_DEFAULT
+
+SOURCEPATH      ../src
+SOURCE          alwaysonlinepdpplugin.cpp
+SOURCE          caoserver.cpp
+SOURCE          caoconnectionmanager.cpp
+SOURCE          caotimer.cpp
+SOURCE          caoraumanager.cpp
+SOURCE          caosettings.cpp
+SOURCE          caogpds.cpp
+SOURCE          caoconnection.cpp
+SOURCE          caoconnectionmonitor.cpp
+SOURCE          taostate.cpp
+SOURCE          taostateinit.cpp
+SOURCE          taostatestarting.cpp
+SOURCE          taostatedisabled.cpp
+SOURCE          taostateconnecting.cpp
+SOURCE          taostateconnected.cpp
+SOURCE          taostatedisconnected.cpp
+SOURCE          taostatewaiting.cpp
+SOURCE          taostateunconnected.cpp
+SOURCE          taostateresetfactorysettings.cpp
+SOURCE          taostateexternalconnection.cpp
+SOURCE          caoraumanagerimpl.cpp
+SOURCE          caoconnectionmonitorimpl.cpp
+SOURCE          caoconnectionimpl.cpp
+SOURCE          linger.cpp
+
+
+// Component specific internal headers 
+USERINCLUDE		../inc
+
+
+// Default system include paths for application layer modules.
+APP_LAYER_SYSTEMINCLUDE
+
+
+SOURCEPATH          ../data
+
+
+START RESOURCE 10281f41.rss
+TARGET   pdpcontextmanager2.rsc
+END // RESOURCE
+
+
+LIBRARY         euser.lib
+LIBRARY         ecom.lib
+LIBRARY         commdb.lib
+LIBRARY         esock.lib
+LIBRARY         flogger.lib
+LIBRARY         centralrepository.lib
+LIBRARY         connmon.lib
+LIBRARY         cenrepnotifhandler.lib
+LIBRARY         etel3rdparty.lib
+LIBRARY         etelmm.lib
+LIBRARY         CustomAPI.lib
+LIBRARY         etel.lib
+#ifdef LOGGING_ENABLED
+#ifdef LOGGING_MODE_FILE
+LIBRARY         efsrv.lib
+#endif // LOGGING_MODE_FILE
+#endif // LOGGING_ENABLED
+
+// End of file
Binary file alwayson_net_plugin/pdpcontextmanager2/inc/10281f41.ini has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/alwaysonconfig.hrh	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2004 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:  Configurations
+*
+*/
+
+
+#ifndef ALWAYSONCONFIG_HRH
+#define ALWAYSONCONFIG_HRH
+
+// This flags sets RAU manager stub and connection manager
+// stub in use instead of real ones
+#undef USE_RAU_STUB_IMPLEMENTATION
+
+// This flags sets connection monitoring stub in use
+#undef USE_CONNMON_STUB_IMPLEMENTATION
+
+// This flag sets connection stub in use
+#undef USE_CONNECTION_STUB
+
+#ifdef _DEBUG
+
+// This flag enables logging
+#define LOGGING_ENABLED
+
+// This flag defines file logger to be in use
+// By default RDebug is used
+#define LOGGING_MODE_FILE
+    
+#endif // _DEBUG
+
+// This flag defines whether customized CustomAPI is in use.
+#undef __ALWAYS_ON_CUSTOM_API
+
+#endif // ALWAYSONCONFIG_HRH
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/alwaysonlinepdpplugin.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,93 @@
+/*
+* Copyright (c) 2004,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:  Implements the CAlwaysOnlineEComInterface interface
+*
+*/
+
+
+#ifndef C_CALWAYSONLINEPDPPLUGIN_H
+#define C_CALWAYSONLINEPDPPLUGIN_H
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <AlwaysOnlineEComInterface.h>
+
+// FORWARD DECLARATIONS
+class CAOServer;
+
+/**
+*  Implements the CAlwaysOnlineEComInterface interface
+*
+*  @lib PDPContextManager2.lib
+*  @since S60 v3.1
+*/
+NONSHARABLE_CLASS( CAlwaysOnlinePDPPlugin ):
+    public CAlwaysOnlineEComInterface
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 v3.1
+     * @return pointer to the created CAlwaysOnlinePDPPlugin object
+     */
+    static CAlwaysOnlinePDPPlugin* NewL();
+
+    /**
+     * Destructor
+     *
+     * @since S60 v3.1
+     */
+    virtual ~CAlwaysOnlinePDPPlugin();
+
+    /**
+     * Interface function from CAlwaysOnlineEComInterface
+     * Command ID's can be found in alwaysonlinemanagercommon.h
+     * Handles the command coming from the Always Online Manager
+     *
+     * @since S60 v3.1
+     * @param aCommand The command as an integer
+     * @param aParameters A Buffer containing parameters
+     * @return TAny A return value, KErrNone if successfull
+     *           KErrNotSupported if command wasn't supported
+     */
+    TAny* HandleServerCommandL( TInt aCommand, TDesC8* aParameters );
+
+private:    // New methods
+
+    /**
+     * Constructor.
+     *
+     * @since S60 v3.1
+     */
+    CAlwaysOnlinePDPPlugin();
+
+    /**
+     * Default Symbian second phase constructor
+     *
+     * @since S60 v3.1
+     */
+    void ConstructL();
+
+private:    // Data
+
+    /**
+     * Always-On Server
+     * Own
+     */
+    CAOServer* iAlwaysOnServer;
+    };
+
+#endif // C_CALWAYSONLINEPDPPLUGIN_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/caoasyncwrapper.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,287 @@
+/*
+* Copyright (c) 2004,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:  Active object wrapper
+*
+*/
+
+
+
+#ifndef C_CAOASYNCWRAPPER_H
+#define C_CAOASYNCWRAPPER_H
+
+// INCLUDE FILES
+#include <e32base.h>
+
+// LOCAL DEFINITIONS
+
+/**  
+ * Panic category for AsyncWrapper
+ */
+_LIT(  KPanicCategory, "AsyncWrapper" );
+
+/**  
+ * Panic reason for AsyncWrapper
+ */
+const TInt KReason = 0;
+
+// CLASS DEFINITION
+
+/**
+ *  Active object wrapper for asynchronous requests.
+ *
+ *  @lib PDPContextManager2.lib
+ *  @since S60 v3.1
+ */
+template <class T>
+NONSHARABLE_CLASS( CAOAsyncWrapper ): public CActive
+    {
+public:        // Construction
+
+    /**
+     * Create a CAOAsyncWrapper object.
+     *
+     * @since S60 v3.1
+     * @param aPt2Object    A ponter to object, for which the following 
+     *                      function pointers are called.
+     * @param aRequestFpt   A pointer to Request member function.
+     * @param aRunLFpt      A pointer to RunL member function.
+     * @param aDoCancelFpt  A pointer to DoCancel member function.
+     * @param aRunErrorFpt  A pointer to RunError member function. Note:
+     *                      aRunErrorFpt is allowed to be NULL, 
+                            in contrast to other parameters!
+     * @return a pointer to the created instance of CAOAsyncWrapper.
+     */
+    static CAOAsyncWrapper* NewL( T* aPt2Object,
+                              void ( T::*aRequestFpt )( TRequestStatus& ),
+                           void ( T::*aRunLFpt )( TInt ),
+                           void ( T::*aDoCancelFpt )(),
+                           TInt ( T::*aRunErrorFpt )( TInt ) )
+        {
+        CAOAsyncWrapper* self = NewLC( aPt2Object, aRequestFpt, 
+                                   aRunLFpt, aDoCancelFpt, aRunErrorFpt );
+        CleanupStack::Pop(self);
+        return self;
+        };
+    
+    /**
+     * Create a CAOAsyncWrapper object.
+     * Created instance is put on the CleanupStack.
+     *
+     * @since S60 v3.1
+     * @param aPt2Object    A ponter to object, for which the following 
+     *                      function pointers are called.
+     * @param aRequestFpt   A pointer to Request member function.
+     * @param aRunLFpt      A pointer to RunL member function.
+     * @param aDoCancelFpt  A pointer to DoCancel member function.
+     * @param aRunErrorFpt  A pointer to RunError member function. Note:
+     *                      aRunErrorFpt is allowed to be NULL, 
+     *                      in contrast to other parameters!
+     * @return a pointer to the created instance of CAOAsyncWrapper.
+     */
+    static CAOAsyncWrapper* NewLC( T* aPt2Object,
+                              void ( T::*aRequestFpt )( TRequestStatus& ),
+                            void ( T::*aRunLFpt )( TInt ),
+                            void ( T::*aDoCancelFpt )(),
+                            TInt ( T::*aRunErrorFpt )( TInt ) )
+        {
+        CAOAsyncWrapper* self = new ( ELeave ) CAOAsyncWrapper( aPt2Object,
+                                                                aRequestFpt, 
+                                                                aRunLFpt,
+                                                                aDoCancelFpt,
+                                                               aRunErrorFpt );
+        CleanupStack::PushL( self );
+        self->ConstructL();
+        return self;
+        };
+
+    /**
+     * Destructor. Destroy the object and release all memory objects.
+     * Active object is also canceled.
+     *
+     * @since S60 v3.1
+     */
+    virtual ~CAOAsyncWrapper()
+        {
+        Cancel();
+        };
+
+
+public:        // New methods
+
+    /**
+     * Issue asynchronous request.
+     * Calls in construction given "request" function pointer, if 
+     * AO is not already active.
+     * Note: IssueRequestL may leave only if iRequestFpt may leave!
+     *
+     * @since S60 v3.1
+     */
+    void IssueRequestL()
+        {
+        if ( !IsActive() )
+            {
+            (*iPt2Object.*iRequestFpt)( iStatus );
+            SetActive();
+            }
+        };
+
+    /**
+     * Issue asynchronous request.
+     * Calls in construction given "request" function pointer, if 
+     * AO is not already active.
+     * Note: Non-leavable method, should be used only if 
+     * issue request method is also non-leavable.
+     *
+     * @since S60 v3.1
+     */
+    void IssueRequest()
+        {
+        if ( !IsActive() )
+            {
+            (*iPt2Object.*iRequestFpt)( iStatus );
+            SetActive();
+            }
+        };
+
+
+private:    // Construction
+
+    /**
+     * Constructor
+     *
+     * @since S60 v3.1
+     * @param aPt2Object    A ponter to object, for which the following 
+     *                      function pointers are called.
+     * @param aRequestFpt   A pointer to Request member function.
+     * @param aRunLFpt      A pointer to RunL member function.
+     * @param aDoCancelFpt  A pointer to DoCancel member function.
+     * @param aRunErrorFpt  A pointer to RunError member function. Note:
+     *                      aRunErrorFpt is allowed to be NULL, 
+     *                      in contrast to other parameters!
+     */
+    CAOAsyncWrapper( T* aPt2Object,
+              void ( T::*aRequestFpt )( TRequestStatus& ),
+              void ( T::*aRunLFpt )( TInt ),
+              void ( T::*aDoCancelFpt )(),
+              TInt ( T::*aRunErrorFpt )( TInt ) )  :
+    CActive( CActive::EPriorityStandard ),
+    iPt2Object( aPt2Object ),
+    iRequestFpt( aRequestFpt ),
+    iRunLFpt( aRunLFpt ), 
+    iDoCancelFpt( aDoCancelFpt ),
+    iRunErrorFpt( aRunErrorFpt )
+        {
+        __ASSERT_ALWAYS( iPt2Object, User::Panic( KPanicCategory, KReason ) );
+        __ASSERT_ALWAYS( iRequestFpt,User::Panic( KPanicCategory, KReason ) );
+        __ASSERT_ALWAYS( iRunLFpt,   User::Panic( KPanicCategory, KReason ) );
+        __ASSERT_ALWAYS( iDoCancelFpt,
+                                     User::Panic( KPanicCategory, KReason ) );
+        CActiveScheduler::Add( this );        
+        };
+                
+                
+    /**
+     * Performs second phase construction of this object
+     *
+     * @since S60 v3.1
+     */
+    void ConstructL()
+        {
+        // Empty
+        };
+
+
+private:    
+
+// from CActive
+
+    /**
+     * From CActive
+     * Cancel outstanding request
+     *
+     * @since S60 v3.1
+     */
+    void DoCancel()
+        {
+        (*iPt2Object.*iDoCancelFpt)();
+        };
+
+    /**
+     * From CActive
+     * Process the completed request.
+     *
+     * @since S60 v3.1
+     */
+    void RunL()
+        {
+        (*iPt2Object.*iRunLFpt)( iStatus.Int() );
+        };
+
+    /**
+     * From CActive
+     * Handle a leave occurred in the RunL().
+     * Note: If RunError function pointer is not given in construction,
+     * the leave error is to be propagated back to the active scheduler!
+     *
+     * @since S60 v3.1
+     * @param aError the error code of leave
+     */
+    TInt RunError( TInt aError )
+        {
+        if ( iRunErrorFpt )
+            {
+            return (*iPt2Object.*iRunErrorFpt)( aError );
+            }
+        else
+            {
+            return aError;
+            }
+        }
+
+
+private:    // Member variables
+
+    /**
+     * ?description_of_pointer_member
+     * Not own.
+     */
+    T* iPt2Object;
+
+    /**
+     * ?description_of_pointer_member
+     * Not own.
+     */
+    void ( T::*iRequestFpt )( TRequestStatus& );
+
+    /**
+     * ?description_of_pointer_member
+     * Not own.
+     */
+    void ( T::*iRunLFpt )( TInt );
+
+    /**
+     * ?description_of_pointer_member
+     * Not own.
+     */
+    void ( T::*iDoCancelFpt )();
+
+    /**
+     * ?description_of_pointer_member
+     * Not own.
+     */
+    TInt ( T::*iRunErrorFpt )( TInt );    // May be NULL
+
+    };
+
+#endif // C_CAOASYNCWRAPPER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/caoconnection.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,132 @@
+/*
+* Copyright (c) 2004,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 CAOConnection declaratation.
+*
+*/
+
+
+#ifndef CAOCONNECTION_H
+#define CAOCONNECTION_H
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <es_sock.h>
+
+// FORWARD DECLARATIONS
+class CAOConnectionImpl;
+class MAOConnectionObserver;
+class MAOSettings;
+
+/**
+ *  CAOConnection is responsible for creating a new connection
+ *  if requested. Also it is possible to attach to an existing
+ *  connection via connection ID.
+ *  Events like succesfull connection, disconnection, connection failures
+ *  are notified through MAOConnectionObserver interface.
+ *  
+ *  @lib PDPContextManager.lib
+ *  @since S60 v3.1
+ */
+NONSHARABLE_CLASS( CAOConnection ): public CBase
+    {
+public: // Constructors & destructors
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 v3.1
+     * @param aObserver ?
+     * @param aSettings ?
+     * @param aSocketServ ?
+     * @return ?
+     */
+    static CAOConnection* NewL( MAOConnectionObserver& aObserver,
+                                MAOSettings&           aSettings,
+                                RSocketServ*           aSocketServ );
+
+    /**
+     * Default destructor
+     *
+     * @since S60 v3.1
+     */
+    virtual ~CAOConnection();
+    
+    /**
+     * Starts a new connection if none exists.
+     *
+     * @since S60 v3.1
+     */
+    void ActivateConnection();
+    
+    /**
+     * Cancels any outstanding connections.
+     *
+     * @since S60 v3.1
+     */
+    void CancelConnection();
+    
+     /**
+     * Closes connection without stopping it.
+     *
+     * @since S60 v3.2
+     */
+    void CloseConnection();
+    
+    /**
+     * Checks if there is already a connection ongoing.
+     *
+     * @since S60 v3.1
+     * @return ETrue if there is connection
+     */
+    TBool IsConnectedToDefaultIAP();
+    
+    /**
+     * Returns number of ongoing connections.
+     *
+     * @since 3.0
+     * @return TInt
+     */
+    TInt NumberOfConnections();
+        
+private: // New methods
+
+    /**
+     * Default constructor.
+     *
+     * @since S60 v3.1
+     */
+    CAOConnection();
+
+    /**
+     * Default Symbian constructor
+     *
+     * @since S60 v3.1
+     * @param aObserver ?
+     * @param aSettings ?
+     * @param aSocketServ ?
+     */
+    void ConstructL( MAOConnectionObserver& aObserver,
+                     MAOSettings&           aSettings,
+                     RSocketServ*           aSocketServ );
+
+private: // Data
+
+    /**
+     * Own: Connection implementation
+     */
+    CAOConnectionImpl* iConnectionImpl;
+    
+    };
+    
+#endif /* CAOCONNECTION_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/caoconnectionimpl.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,291 @@
+/*
+* Copyright (c) 2004,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:  RAU manager
+*
+*/
+
+
+#ifndef CAOCONNECTIONIMPL_H
+#define CAOCONNECTIONIMPL_H
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <commdbconnpref.h>
+#include <es_sock.h>
+#include <commdb.h>
+#include "maoconnectionmanager.h"
+
+// FORWARD DECLARATIONS
+class MAOSettings;
+class CCommsDatabase;
+class MAOConnectionObserver;
+
+/**
+ *  Connection implementation.
+ *  @see CAOConnection
+ *
+ *  @lib PDPContextManager.lib
+ *  @since S60 v3.1
+ */
+NONSHARABLE_CLASS( CAOConnectionImpl ): public CActive
+    {
+private: // Data types
+
+    /**
+     * Internal state bit
+     */
+    enum TInternalState
+        {
+        EDisconnected,
+        EOpeningLink,
+        EListeningAccessPoint
+        };
+        
+public: // Constructors & destructors
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 v3.1
+     * @param aObserver ?
+     * @param aSettings ?
+     * @param aSocketServ ?
+     * @return ?
+     */
+    static CAOConnectionImpl* NewL( MAOConnectionObserver& aObserver,
+                                    MAOSettings&           aSettings,
+                                    RSocketServ*           aSocketServ );
+
+    /**
+     * Default destructor
+     *
+     * @since S60 v3.1
+     */
+    virtual ~CAOConnectionImpl();
+
+    /**
+     * Starts a new connection if none exists.
+     *
+     * @since S60 v3.1
+     */ 
+    void ActivateConnection();
+    
+    /**
+     * Cancels any outstanding connections.
+     *
+     * @since S60 v3.1
+     */
+    void CancelConnection();
+    
+    /**
+     * Checks if there is already a connection ongoing.
+     *
+     * @since S60 v3.1
+     * @return ETrue if there is connection
+     */ 
+    TBool IsConnectedToDefaultIAP();
+        
+    /**
+     * Returns number of ongoing connections.
+     *
+     * @since 3.0
+     * @return TInt
+     */ 
+    TInt NumberOfConnections();
+    
+    /**
+     * Closes connection (detaches) without stopping it.
+     *
+     * @since 3.2
+     * @return void
+     */ 
+    void CloseConnection();
+        
+private: // New methods
+
+    /**
+    * Default constructor.
+    * @param aObserver ?
+    * @param aSettings ?
+    * @param aSocketServ ?
+    */
+    CAOConnectionImpl( MAOConnectionObserver& aObserver,
+                       MAOSettings&           aSettings,
+                       RSocketServ*           aSocketServ );
+
+    /**
+    * Default Symbian constructor
+    */
+    void ConstructL();
+
+    /**
+     * Checks if current IAP is valid
+     *
+     * @since S60 v3.1
+     * @param aId ?
+     * @return ?
+     */
+    TBool IsValidIAP( TUint32 aId ) const;
+    
+    /**
+     * Complete self
+     *
+     * @since S60 v3.1
+     * @param aStatus ?
+     * @param aReason ?
+     */     
+    void CompleteSelf( TRequestStatus& aStatus, TInt aReason );
+    
+    /**
+     * Handle method for EOpeningLink state
+     *
+     * @since S60 v3.1
+     * @param aStatus ?
+     */
+    void HandleOpeningLinkL( TInt aStatus );
+
+    /**
+     * Handle method for EListeningAccessPoint state
+     *
+     * @since S60 v3.1
+     * @param aStatus ?
+     */
+    void HandleListeningAccessPointL( TInt aStatus );
+    
+    /**
+     * Change state
+     *
+     * @since S60 v3.1
+     * @param aNewState ?
+     */
+    void ChangeState( TInternalState aNewState );
+    
+    /**
+     * Issue progress notification
+     *
+     * @since S60 v3.1
+     */
+    void IssueProgressNotification();
+    
+    /**
+     * Sends 'disconnected' error
+     *
+     * @since S60 v3.1
+     * @param aError ?
+     */
+    void BrodcastDisconnectedError( TInt aError );
+    
+    /**
+     * Sends 'activation failed' error
+     *
+     * @since S60 v3.1
+     * @param aError ?
+     */
+    void BrodcastActivationFailedError( TInt aError );
+    
+    /**
+     * Converts error code to failure reason
+     *
+     * @since S60 v3.1
+     * @param aError ?
+     * @return ?
+     */
+    MAOConnectionManager::TFailureReason FailureReason( TInt aError );
+    
+    /**
+     * Activates self
+     *
+     * @since S60 v3.1
+     * @param aCode ?
+     */
+    void ActivateSelf( TInt aCode );
+    
+    /**
+     * Stops connection
+     *
+     * @since S60 v3.1
+     */
+    void StopConnection();
+
+// From base classes CActive
+
+    /**
+     * From CActive
+     * ?
+     *
+     * @since S60 v3.1
+     */
+    void RunL();
+    
+    /**
+     * From CActive
+     * ?
+     *
+     * @since S60 v3.1
+     */
+    void DoCancel();
+    
+    /**
+     * From CActive
+     * ?
+     *
+     * @since S60 v3.1
+     * @param aError ?
+     * @return ?
+     */     
+    TInt RunError( TInt aError );
+
+private: // Data
+
+    /**
+     * Ref: Connection observer
+     */
+    MAOConnectionObserver& iObserver;
+
+    /**
+     * Ref: Settings
+     */
+    MAOSettings& iSettings;
+    
+    /**
+     * Not Own: Socket server session
+     */
+    RSocketServ* iSocketServ;
+    
+    /**
+     * Own: Connection
+     */
+    RConnection iConnection;
+    
+    /**
+     * Own: Progress notification buffer
+     */
+    TNifProgressBuf iProgressBuf;
+    
+    /**
+     * Own: Internal state flag
+     */
+    TInternalState iState;
+    
+    /**
+     * Own: Access point settings
+     */
+    TCommDbConnPref iAccessPointSettings;
+    
+    /**
+     * Own: Comms database
+     */
+    CCommsDatabase* iCommsDatabase;
+    };
+#endif /* CAOCONNECTIONIMPL_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/caoconnectionimplstub.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,380 @@
+/*
+* Copyright (c) 2004,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:  RAU manager
+*
+*/
+
+
+
+#ifndef CAOCONNECTIONIMPLSTUB_H
+#define CAOCONNECTIONIMPLSTUB_H
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <e32property.h>
+#include "maoconnectionmanager.h"
+
+// FORWARD DECLARATIONS
+class MAOSettings;
+class MAOConnectionObserver;
+class CPeriodic;
+template<class T> class CAOAsyncWrapper;
+
+/**
+ *  Connection implementation.
+ *  This is the stub version of CAOConnectionImpl.
+ *
+ *  @lib PDPContextManager.lib
+ *  @since S60 v3.1
+ */
+class CAOConnectionImpl : public CActive
+    {
+private: // Data types
+
+    /**
+     * Internal state bit
+     */
+    enum TInternalState
+        {
+        EDisconnected,
+        EOpeningLink,
+        EListeningAccessPoint,
+        EAttachingExistingConnection
+        };
+        
+public: // Constructors & destructors
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 v3.1
+     * @param aObserver ?
+     * @param aSettings ?
+     * @param aSocketServ ?
+     * @return ?
+     */
+    static CAOConnectionImpl* NewL( 
+        MAOConnectionObserver& aObserver,
+        MAOSettings&           aSettings,
+        RSocketServ*           aSocketServ );
+
+    /**
+     * Default destructor
+     *
+     * @since S60 v3.1
+     */ 
+    virtual ~CAOConnectionImpl();
+    
+    /**
+     * Starts a new connection if none exists.
+     *
+     * @since S60 v3.1
+     */ 
+    void ActivateConnection();
+    
+    /**
+     * ?
+     *
+     * @since S60 v3.1
+     * @param aConnectionId ?
+     */
+    void AttachToExistingConnection( TUint aConnectionId );
+    
+    /**
+     * Cancels any outstanding connections.
+     *
+     * @since S60 v3.1
+     */
+    void CancelConnection();
+    
+    /**
+     * Checks if there is already a connection ongoing.
+     *
+     * @since S60 v3.1
+     * @return ETrue if there is connection
+     */
+    TBool IsConnectedToDefaultIAP();
+
+    /**
+     * Returns number of ongoing connections.
+     *
+     * @since 3.0
+     * @return TInt
+     */ 
+    TInt NumberOfConnections();
+            
+private:
+
+    /**
+     * Default constructor.
+     *
+     * @since S60 v3.1
+     * @param aObserver
+     * @param aSettings
+     * @param aSocketServ
+     */
+    CAOConnectionImpl( 
+        MAOConnectionObserver& aObserver,
+        MAOSettings&           aSettings,
+        RSocketServ*           aSocketServ );
+
+    /**
+     * Default Symbian constructor
+     *
+     * @since S60 v3.1
+     */
+    void ConstructL();
+
+    /**
+     * Change state
+     *
+     * @since S60 v3.1
+     * @param aNewState ?
+     */
+    void ChangeState( TInternalState aNewState );
+    
+    /**
+     * Completes self
+     *
+     * @since S60 v3.1
+     * @param aStatus ?
+     * @param aReason ?
+     */
+    void CompleteSelf( TRequestStatus& aStatus, TInt aReason );
+    
+    /**
+     * Callback for connection timer
+     *
+     * @since S60 v3.1
+     * @param aSelf ?
+     */
+    static TInt ConnectionCallBack( TAny* aSelf );
+    
+    /**
+     * Handles callback timer trigger
+     *
+     * @since S60 v3.1
+     */
+    void HandleConnectionCallBackL();
+    
+    /**
+     * Activates connection
+     *
+     * @since S60 v3.1
+     */
+    void DoActivateConnection();
+    
+    /**
+     * Handles EOpeningLink request completion
+     *
+     * @since S60 v3.1
+     * @param aStatus ?
+     */
+    void HandleOpeningLinkL( TInt aStatus );
+
+    /**
+     * Converts error code to failure reason
+     *
+     * @since S60 v3.1
+     * @param aError ?
+     * @return ?
+     */
+    MAOConnectionManager::TFailureReason FailureReason( TInt aError );
+    
+    /**
+     * Handles EListeningAccessPoint request completion
+     *
+     * @since S60 v3.1
+     * @param aStatus ?
+     */
+    void HandleListeningAccessPointL( TInt aStatus );
+    
+    /**
+     * Reports PDP context activation error
+     *
+     * @since S60 v3.1
+     * @param aError ?
+     */ 
+    void BroadcastPDPContextActivationFailureL( TInt aError );
+    
+    /**
+     * Reports PDP context disconnection
+     *
+     * @since S60 v3.1
+     * @param aError ?
+     */
+    void BroadcastPDPContextDisconnectionL( TInt aError );
+    
+    /**
+     * Handles EAttachingExistingConnection request completion
+     *
+     * @since S60 v3.1
+     * @param aStatus ?
+     */
+    void HandleAttachingExistingConnectionL( TInt aStatus );
+    
+    /**
+     * PDP context activation property
+     *
+     * @since S60 v3.1
+     */
+    void SubscribePDPContextActivation();
+    
+    /**
+     * ?
+     *
+     * @since S60 v3.1
+     * @param aStatus ?
+     */
+    void PDPContextActivationIssueRequest( TRequestStatus& aStatus );
+    
+    /**
+     * ?
+     *
+     * @since S60 v3.1
+     * @param aStatus ?
+     */
+    void PDPContextActivationRunL( TInt aStatus );
+    
+    /**
+     * ?
+     *
+     * @since S60 v3.1
+     */
+    void PDPContextActivationDoCancel();
+    
+    /**
+     * PDP context disconnection property
+     *
+     * @since S60 v3.1
+     */
+    void SubscribePDPContextDisconnection();
+    
+    /**
+     * ?
+     *
+     * @since S60 v3.1
+     * @param aStatus ?
+     */
+    void PDPContextDisconnectionIssueRequest( TRequestStatus& aStatus );
+    
+    /**
+     * ?
+     *
+     * @since S60 v3.1
+     * @param aStatus ?
+     */
+    void PDPContextDisconnectionRunL( TInt aStatus );
+    
+    /**
+     * ?
+     *
+     * @since S60 v3.1
+     */
+    void PDPContextDisconnectionDoCancel();
+    
+    /**
+     * Broadcast PDP context activated
+     *
+     * @since S60 v3.1
+     */
+    void BroadcastPDPContextActivatedL();
+
+// From base classes CActive
+
+    /**
+     * From CActive
+     * ?
+     *
+     * @since S60 v3.1
+     */
+    void RunL();
+    
+    /**
+     * From CActive
+     * ?
+     *
+     * @since S60 v3.1
+     */
+    void DoCancel();
+    
+    /**
+     * From CActive
+     * ?
+     *
+     * @since S60 v3.1
+     * @param aError ?
+     * @return ?
+     */
+    TInt RunError( TInt aError );
+
+private: // Data
+
+    /**
+     * Ref: Connection observer
+     */
+    MAOConnectionObserver& iObserver;
+    
+    /**
+     * Ref: Settings
+     */
+    MAOSettings& iSettings;
+    
+    /**
+     * Not Own: Socket server session
+     */
+    RSocketServ* iSocketServ;
+    
+    /**
+     * Own: Internal state flag
+     */
+    TInternalState iState;
+    
+    /**
+     * Own: Connection timer
+     */
+    CPeriodic* iConnectionTimer;
+    
+    /**
+     * Own: PDP context activation property
+     */
+    RProperty iPDPContextActivationProperty;
+    
+    /**
+     * Own: ?
+     */
+    CAOAsyncWrapper<CAOConnectionImpl>* iPDPContextActivationSubscriber;
+    
+    /**
+     * Own: PDP context disconnection property
+     */
+    RProperty iPDPContextDisconnectionProperty;
+    
+    /**
+     * Own: ?
+     */
+    CAOAsyncWrapper<CAOConnectionImpl>* iPDPContextDisconnectionSubscriber;
+    
+    /**
+     * Own: PDP context activation error
+     */
+    TInt iActivationError;
+
+    /**
+     * Own: PDP context activation error
+     */
+    TInt iDisconnectionError;
+    };
+
+#endif /* CAOCONNECTIONIMPLSTUB_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/caoconnectionmanager.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,274 @@
+/*
+* Copyright (c)  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 CAOCONNECTIONMANAGER_H
+#define CAOCONNECTIONMANAGER_H
+
+// INCLUDE FILES
+#include <e32base.h>
+
+#include "maoconnectionmanager.h"
+#include "maoconnectionobserver.h"
+#include "maoconnectionmonitorobserver.h"
+#include "linger.h"
+
+// FORWARD DECLARATIONS
+class MAOConnectionManagerObserver;
+class MAOSettings;
+class CAOConnection;
+class CAOConnectionMonitor;
+
+/**
+ *  Connection manager class.
+ *  Connection manager is responsible for creating new
+ *  connections and monitoring existing ones.
+ *  Network registration is also fetchable through Connection manager.
+ *
+ *  Events are notified through MAOConnectionManagerObserver
+ *  interface.
+ *
+ *  @lib PDPContextManager.lib
+ *  @since S60 v3.1
+ */
+NONSHARABLE_CLASS( CAOConnectionManager ):
+    public CBase,
+    public MAOConnectionManager,
+    public MAOConnectionObserver,
+    public MAOConnectionMonitorObserver
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 v3.1
+     */
+    static CAOConnectionManager* NewL(
+        MAOConnectionManagerObserver& aObserver,
+        MAOSettings& aSettings );
+
+    /**
+     * Default destructor
+     *
+     * @since S60 v3.1
+     */
+    virtual ~CAOConnectionManager();
+    
+    /**
+     * Fetches network registration status.
+     * Asynchronous.
+     *
+     * @since S60 v3.1
+     */
+    void FetchNetworkRegistrationStatus();
+    
+// From base class MAOConnectionManager
+// Allow Always-On Server to access these methods
+
+    /**
+     * From MAOConnectionManager
+     *
+     * @since S60 v3.1
+     */ 
+    void ActivatePDPContextL();
+    
+    /**
+     * From MAOConnectionManager
+     *
+     * @since S60 v3.1
+     * @return ETrue if PDP context is active
+     */
+    TBool IsPDPContextActive() const;
+
+    /**
+     * From MAOConnectionManager
+     *
+     * @since S60 v3.1
+     */
+    void CloseConnection();
+    
+     /**
+     * From MAOConnectionManager
+     *
+     * @since S60 v3.2
+     */
+    void DetachConnection();
+       
+    /**
+     * From MAOConnectionManager
+     *
+     * @since S60 v3.1
+     */
+    TNetworkType NetworkType() const;
+
+    /**
+     * From MAOConnectionManager
+     *
+     * @since S60 v3.1
+     */
+    TInt NumberOfConnections();
+    
+     /**
+     * From MAOConnectionManager
+     *
+     * @since S60 v3.2
+     */
+    void HandleSettingsChangedL();
+        
+private:
+
+    /**
+     * Default constructor.
+     *
+     * @since S60 v3.1
+     * @param aObserver ?
+     */
+    CAOConnectionManager(
+        MAOConnectionManagerObserver& aObserver,
+        MAOSettings& aSettings );
+
+    /**
+     * Default Symbian constructor
+     *
+     * @since S60 v3.1
+     * @param aSettings
+     */
+    void ConstructL( MAOSettings& aSettings );
+    
+    /**
+     * Checks if network status and settings support always-on
+     *
+     * @since S60 v3.2
+     * @return ETrue if always-on is enabled, EFalse otherwise.
+     */
+    TBool IsAlwaysOnEnabled();
+    
+// From base class MAOConnectionObserver
+
+    /**
+     * From MAOConnectionObserver
+     *
+     * @since S60 v3.1
+     */
+    void HandlePDPContextActivatedL();
+
+    /**
+     * From MAOConnectionObserver
+     *
+     * @since S60 v3.1
+     */
+    void HandlePDPContextActivationFailedL(
+        MAOConnectionManager::TFailureReason aReason );
+        
+    /**
+     * From MAOConnectionObserver
+     *
+     * @since S60 v3.1
+     */
+    void HandlePDPContextDisconnectedL(
+        MAOConnectionManager::TFailureReason aReason );
+    
+    /**
+     * From MAOConnectionObserver
+     *
+     * @since S60 v3.1
+     */
+    void HandlePDPContextTemporarilyBlockedL();
+    
+// From base class MAOConnectionMonitorObserver
+
+    /**
+     * From MAOConnectionMonitorObserver
+     *
+     * @since S60 v3.1
+     * @param aNetworkRegistration ?
+     */
+    void HandleNWRegistrationStatusChangedL(
+        CTelephony::TRegistrationStatus aNetworkRegistration );
+                
+    /**
+     * From MAOConnectionMonitorObserver
+     *
+     * @since S60 v3.1
+     * @param aConnectionId connection id from connection monitor
+     * @param aForward Tells whether message should be forwarded next layer
+     */
+    void HandleConnectionDeletedL( const TUint aConnectionId,
+                                   const TBool aForward );
+    
+    /**
+     * Notifies that external connection has been created.
+     *
+     * @since 3.0
+     */
+    void HandleExternalConnectionCreatedL();
+    
+    /**
+     * Notifies that internal not-always-on connection has been created.
+     *
+     * @since S60 v3.2
+     * @param aConnectionId connection id from connection monitor
+     * @param aIapId iap id
+     * @param anetId network id
+     * @return void
+     */
+    void HandleInternalConnectionCreatedL( const TUint aConnectionId,
+                                           const TUint aIapId, 
+                                           const TUint aNetId );  
+    
+    /**
+     * From MAOConnectionMonitorObserver
+     *
+     * @since S60 v3.1
+     */
+    void HandleError( TInt aError );
+  
+private: // Data
+
+    /**
+     * Ref: Connection manager observer
+     */
+    MAOConnectionManagerObserver& iObserver;
+    
+    /**
+     * Ref: Settings
+     */
+    MAOSettings& iSettings;
+    
+    /**
+     * Own: Socket server session
+     */
+    RSocketServ iSocketServ;
+    
+    /**
+     * Own: Connection handler
+     */
+    CAOConnection* iConnection;
+    
+    /**
+     * Own: Connection monitor
+     */
+    CAOConnectionMonitor* iConnectionMonitor;
+    
+    /**
+     * Array of pointers to linger objects
+     */
+    RArray< CLingerConnection* > iLingerArray;
+    };
+
+#endif /* CAOCONNECTIONMANAGER_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/caoconnectionmonitor.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,111 @@
+/*
+* Copyright (c)  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 CAOCONNECTIONMONITOR_H
+#define CAOCONNECTIONMONITOR_H
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <etel3rdparty.h>
+
+#include "caosettings.h"
+
+// FORWARD DECLARATIONS
+class CAOConnectionMonitorImpl;
+class MAOConnectionMonitorObserver;
+
+/**
+ *  Connection monitor is responsible for listening
+ *  all connection related events like creation of new connections,
+ *  closing existing connection, nw changes etc.
+ *  These events are notified through MAOConnectionMonitorObserver
+ *  interface.
+ *
+ *  @lib PDPContextManager.lib
+ *  @since S60 v3.1
+ */
+NONSHARABLE_CLASS( CAOConnectionMonitor ): public CBase
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 v3.1
+     * @param aObserver
+     * @param aSettings
+     * @return ?
+     */
+    static CAOConnectionMonitor* NewL(
+        MAOConnectionMonitorObserver& aObserver,
+        MAOSettings& aSettings );
+
+    /**
+     * Default destructor
+     *
+     * @since S60 v3.1
+     */
+    virtual ~CAOConnectionMonitor();
+    
+    /**
+     * Fetches current network registration status.
+     * Current status will be informed through
+     * MAOConnectionMonitorObserver interface.
+     * Asynchronous method.
+     *
+     * @since 3.0
+     */
+    void FetchNetworkRegistrationStatus();
+    
+    /**
+     * Fetches current network registration status.
+     * Synchronous method.
+     *
+     * @since S60 v3.1
+     * @return Telephony::TRegistrationStatus
+     */
+    CTelephony::TRegistrationStatus NetworkRegistration() const;
+    
+private:
+
+    /**
+     * Default constructor.
+     *
+     * @since S60 v3.1
+     */
+    CAOConnectionMonitor();
+
+    /**
+     * Default Symbian constructor
+     *
+     * @since S60 v3.1
+     * @param aObserver
+     * @param aSettings
+     */
+    void ConstructL( MAOConnectionMonitorObserver& aObserver,
+                     MAOSettings& aSettings );
+
+private: // Data
+
+    /**
+     * Own: Connection monitor implementation
+     */
+    CAOConnectionMonitorImpl* iConnectionMonitorImpl;
+    };
+
+#endif /* CAOCONNECTIONMONITOR_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/caoconnectionmonitorimpl.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,309 @@
+/*
+* Copyright (c)  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 CAOCONNECTIONMONITORIMPL_H
+#define CAOCONNECTIONMONITORIMPL_H
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <rconnmon.h>
+#include <etel3rdparty.h>
+
+// FORWARD DECLARATIONS
+class MAOSettings;
+class MAOConnectionMonitorObserver;
+class CConnMonEventBase;
+template<class T> class CAOAsyncWrapper;
+class CActiveSchedulerWait;
+
+/**
+ *  Connection monitor implementation.
+ *  @see CAOConnectionMonitor
+ *
+ *  @lib PDPContextManager.lib
+ *  @since S60 v3.1
+ */
+NONSHARABLE_CLASS( CAOConnectionMonitorImpl ):
+    public CBase,
+    public MConnectionMonitorObserver
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 v3.1
+     * @param aObserver ?
+     * @param aSettings Commsdat settings
+     */
+    static CAOConnectionMonitorImpl* NewL(
+        MAOConnectionMonitorObserver& aObserver,
+        MAOSettings& aSettings  );
+
+    /**
+     * Default destructor
+     *
+     * @since S60 v3.1
+     */
+    virtual ~CAOConnectionMonitorImpl();
+    
+public:
+    
+    /**
+     * @see CAOConnectionMonitor
+     *
+     * @since S60 v3.1
+     */
+    void FetchNetworkRegistrationStatus();
+    
+    /**
+     * @see CAOConnectionMonitor
+     *
+     * @since S60 v3.1
+     */
+    CTelephony::TRegistrationStatus NetworkRegistration() const;
+    
+
+private: // New methods
+
+    /**
+     * Default constructor.
+     *
+     * @since S60 v3.1
+     * @param aObserver ?
+     * @param aSettings Commsdat settings
+     */
+    CAOConnectionMonitorImpl(
+        MAOConnectionMonitorObserver& aObserver,
+        MAOSettings& aSettings );
+
+    /**
+     * Default Symbian constructor
+     *
+     * @since S60 v3.1
+     */
+    void ConstructL();
+
+    /**
+     * Start listening nw registration
+     *
+     * @since S60 v3.1
+     */
+    void ListenNetworkRegistrationStatusChange();
+    
+    /**
+     * Handle error situations
+     *
+     * @since S60 v3.1
+     * @param aError ?
+     */
+    void HandleError( TInt aError );
+    
+    /**
+     * Network registration status
+     *
+     * @since S60 v3.1
+     * @param aStatus ?
+     */
+    void NWRegStatusIssueRequest( TRequestStatus& aStatus );
+    
+    /**
+     * ?
+     *
+     * @since S60 v3.1
+     * @param aStatus ?
+     */
+    void NWRegStatusRunL( TInt aStatus );
+    
+    /**
+     * ?
+     *
+     * @since S60 v3.1
+     */
+    void NWRegStatusDoCancel();
+    
+    /**
+     * ?
+     *
+     * @since S60 v3.1
+     * @param aError ?
+     * @return ?
+     */
+    TInt NWRegStatusRunError( TInt aError );
+
+    /**
+     * Network registration status
+     *
+     * @since S60 v3.1
+     * @param aStatus ?
+     */
+    void NWRegStatusChangeIssueRequest( TRequestStatus& aStatus );
+    
+    /**
+     * ?
+     *
+     * @since S60 v3.1
+     * @param aStatus ?
+     */
+    void NWRegStatusChangeRunL( TInt aStatus );
+    
+    /**
+     * ?
+     *
+     * @since S60 v3.1
+     */
+    void NWRegStatusChangeDoCancel();
+    
+    /**
+     * ?
+     *
+     * @since S60 v3.1
+     * @param aError ?
+     * @return ?
+     */
+    TInt NWRegStatusChangeRunError( TInt aError );
+
+    /**
+     * Bearer type
+     *
+     * @since S60 v3.1
+     */
+    void FetchBearerType();
+    
+    /**
+     * ?
+     *
+     * @since S60 v3.1
+     */
+    void CancelFetchBearerType();
+    
+    /**
+     * ?
+     *
+     * @since S60 v3.1
+     */
+    void BearerIssueRequest( TRequestStatus& aStatus );
+    
+    /**
+     * ?
+     *
+     * @since S60 v3.1
+     */
+    void BearerRunL( TInt aStatus );
+    
+    /**
+     * ?
+     *
+     * @since S60 v3.1
+     */
+    void BearerDoCancel();
+    
+    /**
+     * ?
+     *
+     * @since S60 v3.1
+     */
+    TInt BearerRunError( TInt aError );
+
+// From base class MConnectionMonitorObserver
+
+    /**
+     * From MConnectionMonitorObserver
+     *
+     * @since S60 v3.1
+     * @param aConnMonEvent ?
+     */
+    void EventL( const CConnMonEventBase &aConnMonEvent );
+
+private: // Data
+
+    /**
+     * Ref: Observer
+     */
+    MAOConnectionMonitorObserver& iObserver;
+    
+    /**
+     * Ref: Settings
+     */
+    MAOSettings& iSettings;
+    
+    /**
+     * Own: Connection monitor
+     */
+    RConnectionMonitor iConnectionMonitor;
+    
+    /**
+     * Own: Telephony
+     */
+    CTelephony* iTelephony;
+    
+    /**
+     * Own: NW registration status package
+     */
+    CTelephony::TNetworkRegistrationV1Pckg iWNRegPckg;
+    
+    /**
+     * Own: NW registration status
+     */
+    CTelephony::TNetworkRegistrationV1 iWNReg;
+    
+    /**
+     * Own: NW registration status change package
+     */
+    CTelephony::TNetworkRegistrationV1Pckg iWNRegChangePckg;
+    
+    /**
+     * Own: NW registration status change
+     */
+    CTelephony::TNetworkRegistrationV1 iWNChangeReg;
+    
+    /**
+     * Own: Network registration status fetcher ao
+     */
+    CAOAsyncWrapper<CAOConnectionMonitorImpl>*
+        iNWRegistrationStatus;
+
+    /**
+     * Own: Network registration status change handler ao
+     */
+    CAOAsyncWrapper<CAOConnectionMonitorImpl>*
+        iNWRegistrationStatusChange;
+    
+    /**
+     * Own: Bearer type fetcher
+     */
+    CAOAsyncWrapper<CAOConnectionMonitorImpl>*
+        iBearer;
+        
+    /**
+     * Own: New created connection id
+     */
+    TUint iMyConnectionId;
+    
+    /**
+     * Own: Shows if the connection is beeing open.
+     */
+    TBool iConnectionAlive;
+    
+    /**
+     * Own: Bearer type
+     */
+    TInt iBearerValue;
+    };
+
+#endif /* CAOCONNECTIONMONITORIMPL_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/caoconnectionmonitorimplstub.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,276 @@
+/*
+* Copyright (c)  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 CAOCONNECTIONMONITORIMPLSTUB_H
+#define CAOCONNECTIONMONITORIMPLSTUB_H
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <e32property.h>
+#include <etel3rdparty.h>
+
+// FORWARD DECLARATIONS
+class MAOSettings;
+class MAOConnectionMonitorObserver;
+template<class T> class CAOAsyncWrapper;
+class CPeriodic;
+
+/**
+ *  Connection monitor implementation.
+ *  This is the real implementation for connection monitor.  
+ *
+ *  @lib PDPContextManager.lib
+ *  @since S60 v3.1
+ */
+class CAOConnectionMonitorImpl : public CBase
+    {
+public: // Constructors & destructors
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 v3.1
+     * @param aObserver ?
+     * @param aSettings ?
+     * @return ?
+     */
+    static CAOConnectionMonitorImpl* NewL(
+        MAOConnectionMonitorObserver& aObserver,
+        MAOSettings& aSettings );
+
+    /**
+     * Default destructor
+     *
+     * @since S60 v3.1
+     */
+    virtual ~CAOConnectionMonitorImpl();
+        
+    /**
+     * Fetches network registration status.
+     * Asynchronous.
+     *
+     * @since S60 v3.1
+     */
+    void FetchNetworkRegistrationStatus();
+    
+    /**
+     * Fetches current network registration status.
+     * Synchronous method.
+     *
+     * @since S60 v3.1
+     * @return Telephony::TRegistrationStatus
+     */
+    CTelephony::TRegistrationStatus NetworkRegistration() const;
+    
+private: // New methods
+
+    /**
+     * Default constructor.
+     *
+     * @since S60 v3.1
+     * @param aObserver ?
+     * @param aSettings ?
+     */
+    CAOConnectionMonitorImpl(
+        MAOConnectionMonitorObserver& aObserver,
+        MAOSettings& aSettings );
+
+    /**
+     * Default Symbian constructor
+     *
+     * @since S60 v3.1
+     */
+    void ConstructL();
+
+    /**
+     * NW reg status change property
+     *
+     * @since S60 v3.1
+     */
+    void SubscribeNWChangeProperty();
+    
+    /**
+     * ?
+     *
+     * @since S60 v3.1
+     * @param aStatus ?
+     */
+    void NWChangePropertyIssueRequest( TRequestStatus& aStatus );
+    
+    /**
+     * ?
+     *
+     * @since S60 v3.1
+     * @param aStatus ?
+     */
+    void NWChangePropertyRunL( TInt aStatus );
+    
+    /**
+     * ?
+     *
+     * @since S60 v3.1
+     */
+    void NWChangePropertyDoCancel();
+    
+    /**
+     * External PDP context property
+     *
+     * @since S60 v3.1
+     */
+    void SubscribeExternalPDPContextProperty();
+    
+    /**
+     * ?
+     *
+     * @since S60 v3.1
+     * @param aStatus ?
+     */
+    void ExternalPDPContextIssueRequest( TRequestStatus& aStatus );
+    
+    /**
+     * ?
+     *
+     * @since S60 v3.1
+     * @param aStatus ?
+     */
+    void ExternalPDPContextRunL( TInt aStatus );
+    
+    /**
+     * ?
+     *
+     * @since S60 v3.1
+     */
+    void ExternalPDPContextDoCancel();
+    
+    /**
+     * New PDP context property
+     *
+     * @since S60 v3.1
+     */
+    void SubscribeNewPDPContextProperty();
+    
+    /**
+     * ?
+     *
+     * @since S60 v3.1
+     * @param aStatus ?
+     */
+    void NewPDPContextIssueRequest( TRequestStatus& aStatus );
+    
+    /**
+     * ?
+     *
+     * @since S60 v3.1
+     * @param aStatus ?
+     */
+    void NewPDPContextRunL( TInt aStatus );
+    
+    /**
+     * ?
+     *
+     * @since S60 v3.1
+     */
+    void NewPDPContextDoCancel();
+    
+    /**
+     * NW reg status fetching
+     *
+     * @since S60 v3.1
+     * @param aSelf ?
+     */
+    static TInt NWRegStatusFetchCallBack( TAny* aSelf );
+    
+    /**
+     * ?
+     *
+     * @since S60 v3.1
+     */
+    void HandleNWRegStatusFetchedL();
+    
+private: // Data
+
+    /**
+     * Ref: Not used
+     */
+    MAOConnectionMonitorObserver& iObserver;
+    
+    /**
+     * Ref: Settings
+     */
+    MAOSettings& iSettings;
+
+    /**
+     * Own: NW registration status package
+     */
+    CTelephony::TNetworkRegistrationV1Pckg iWNRegPckg;
+    
+    /**
+     * Own: NW registration status
+     */
+    CTelephony::TNetworkRegistrationV1 iWNReg;
+    
+    /**
+     * Own: NW registration status change package
+     */
+    CTelephony::TNetworkRegistrationV1Pckg iWNRegChangePckg;
+    
+    /**
+     * Own: NW registration status change
+     */
+    CTelephony::TNetworkRegistrationV1 iWNChangeReg;
+    
+    /**
+     * NW reg status change property
+     */
+    RProperty iNWRegStatusChangeProperty;
+    
+    /**
+     * Own: ?
+     */
+    CAOAsyncWrapper<CAOConnectionMonitorImpl>*
+        iNWRegStatusChangeSubscriber;
+        
+    /**
+     * External PDP context property
+     */
+    RProperty iExternalPDPContextProperty;
+    
+    /**
+     * Own: ?
+     */
+    CAOAsyncWrapper<CAOConnectionMonitorImpl>*
+        iExternalPDPContextSubscriber;
+        
+    /**
+     * New PDP context property
+     */
+    RProperty iNewPDPContextProperty;
+    
+    /**
+     * Own: ?
+     */
+    CAOAsyncWrapper<CAOConnectionMonitorImpl>*
+        iNewPDPContextSubscriber;
+        
+    /**
+     * NW reg status fetcher
+     */
+    CPeriodic* iNWStatusFetcher;
+    };
+    
+#endif /* CAOCONNECTIONMONITORIMPLSTUB_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/caogpds.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,132 @@
+/*
+* Copyright (c) 2004,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:  GPDS interface
+*
+*/
+
+
+#ifndef C_CAOGPDS_H
+#define C_CAOGPDS_H
+
+// INCLUDE FILES
+#include <e32base.h>
+
+#include "maogpds.h"
+#include "alwaysonconfig.hrh"
+
+// FORWARD DECLARATIONS
+class CPeriodic;
+class CActiveSchedulerWait;
+
+class RMmCustomAPI;
+
+/**
+*  GPDS interface. Through GPDS interface can be set
+*  Always-On mode for TSY.
+*
+*  @lib PDPContextManager2.lib
+*  @since S60 v3.1
+*/
+NONSHARABLE_CLASS( CAOGpds ):
+    public CActive,
+    public MAOGpds
+    {
+public:    // Constructors & destructors
+
+    
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 v3.1
+     * @param aCustomAPI: RMCustomApi sends notification to
+     *      Always On server from RAU (Routing Area Update)
+     *      Always On server sends notification to TSY via RMCustomApi.  
+     * @return a pointer to the created instance of CAOGpds.
+     */
+    static CAOGpds* NewL( RMmCustomAPI& aCustomAPI );
+
+
+    /**
+     * Destructor
+     *
+     * @since S60 v3.1
+     */
+    virtual ~CAOGpds();
+    
+private: // Constructors
+    
+    /**
+     * Constructor.
+     *
+     * @since S60 v3.1
+     * @param aCustomAPI: RMCustomApi sends notification to
+     *      Always On server from RAU (Routing Area Update)
+     *      Always On server sends notification to TSY via RMCustomApi.  
+     */
+    CAOGpds( RMmCustomAPI& aCustomAPI );
+
+
+    /**
+     * Default Symbian second phase constructor
+     *
+     * @since S60 v3.1
+     */
+    void ConstructL();
+    
+private: // From base class CActive
+
+    /**
+     * From CActive
+     * Process the completed request.
+     *
+     * @since S60 v3.1
+     */
+    void RunL();
+    
+    /**
+     * From CActive
+     * Cancel outstanding request
+     *
+     * @since S60 v3.1
+     */
+    void DoCancel();
+    
+private: // From base class MAOGpds
+
+    /**
+     * From MAOGdps
+     * Sets always on mode.
+     *
+     * @since S60 v3.1
+     * @param aMode: Current always on mode
+     */
+    void SetAlwaysOnModeL( TAlwaysOnMode aMode );
+
+private: // Data
+
+    /**
+     * Active scheduler wait
+     * Own
+     */
+    CActiveSchedulerWait* iWait;
+    
+
+    /**
+     * Reference to RMCustomAPI
+     */
+    RMmCustomAPI& iCustomAPI;
+    
+    };
+
+#endif // C_CAOGPDS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/caoraumanager.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,124 @@
+/*
+* Copyright (c) 2004,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:  RAU manager
+*
+*/
+
+
+#ifndef C_CAORAUMANAGER_H
+#define C_CAORAUMANAGER_H
+
+// INCLUDE FILES
+#include <e32base.h>
+#include "maoraumanager.h"
+#include "alwaysonconfig.hrh"
+
+// FORWARD DECLARATIONS
+class MAORAUManagerObserver;
+class CAORAUManagerImpl;
+#ifdef __ALWAYS_ON_CUSTOM_API
+class RMmCustomAPI;
+#endif
+
+/**
+*  RAU manager. RAU manager listens RAU events (Routing Area Update)
+*  and notifies them forwards.
+*  Succesfull RAU events are notified through MAORAUManagerObserver
+*  interface.
+*
+*  @lib PDPContextManager2.lib
+*  @since S60 v3.1
+*/
+NONSHARABLE_CLASS( CAORAUManager ):
+    public CBase,
+    public MAORAUManager
+    {
+public: // Constructors & destructors
+
+#ifdef __ALWAYS_ON_CUSTOM_API
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 v3.1
+     * @param aObserver  Interface via receive notifications from RAU.
+     * @param aCustomAPI Object via send notifications to TSY.
+     * @return a pointer to the created instance of CAORAUManager.
+     */
+    static CAORAUManager* NewL( MAORAUManagerObserver& aObserver,
+                                RMmCustomAPI& aCustomAPI );
+#else
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 v3.1
+     * @param aObserver  Interface via receive notifications from RAU.
+     * @return a pointer to the created instance of CAORAUManager.
+     */
+    static CAORAUManager* NewL( MAORAUManagerObserver& aObserver );
+
+#endif // __ALWAYS_ON_CUSTOM_API
+
+    /**
+     * Destructor
+     *
+     * @since S60 v3.1
+     */
+    virtual ~CAORAUManager();
+    
+private: // New methods
+
+    /**
+     * Constructor.
+     *
+     * @since S60 v3.1
+     */
+    CAORAUManager();
+
+#ifdef __ALWAYS_ON_CUSTOM_API
+
+    /**
+     * Second-phase constructor.
+     *
+     * @since S60 v3.1
+     * @param aObserver  Interface via receive notifications from RAU.
+     * @param aCustomAPI Object via send notifications to TSY.
+     * @return a pointer to the created instance of CAORAUManager.
+     */
+    void ConstructL( MAORAUManagerObserver& aObserver,
+                     RMmCustomAPI& aCustomAPI );
+#else
+
+    /**
+     * Second-phase constructor.
+     *
+     * @since S60 v3.1
+     * @param aObserver  Interface via receive notifications from RAU.
+     * @return a pointer to the created instance of CAORAUManager.
+     */
+    void ConstructL( MAORAUManagerObserver& aObserver );
+
+#endif // __ALWAYS_ON_CUSTOM_API
+
+private: // Data
+
+    /** RAU manager implementation
+     *
+     * Own
+     */
+    CAORAUManagerImpl* iRAUManagerImpl;
+    };
+
+#endif // C_CAORAUMANAGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/caoraumanagerimpl.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,165 @@
+/*
+* Copyright (c) 2004,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:  RAU manager implementation
+*
+*/
+
+
+#ifndef C_CAORAUMANAGERIMPL_H
+#define C_CAORAUMANAGERIMPL_H
+
+// INCLUDE FILES
+#include <e32base.h>
+
+#include "alwaysonconfig.hrh"
+
+#ifdef __ALWAYS_ON_CUSTOM_API
+#include <RMmCustomAPI.h>
+#endif // __ALWAYS_ON_CUSTOM_API
+
+// FORWARD DECLARATIONS
+class MAORAUManagerObserver;
+
+/**
+*  RAU manager implementation.
+*  @see CAORAUManager
+*
+*  @lib PDPContextManager2.lib
+*  @since S60 v3.1
+*/
+NONSHARABLE_CLASS( CAORAUManagerImpl ): public CActive
+    {
+public: // Constructors & destructors
+
+#ifdef __ALWAYS_ON_CUSTOM_API
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 v3.1
+     * @param aObserver  Interface via receive notifications from RAU.
+     * @param aCustomAPI Object via send notifications to TSY.
+     * @return a pointer to the created instance of CAORAUManagerImpl.
+     */
+    static CAORAUManagerImpl* NewL( MAORAUManagerObserver& aObserver,
+                                    RMmCustomAPI& aCustomAPI );
+#else
+ 
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 v3.1
+     * @param aObserver  Interface via receive notifications from RAU.
+     * @return a pointer to the created instance of CAORAUManagerImpl.
+     */
+   static CAORAUManagerImpl* NewL( MAORAUManagerObserver& aObserver );
+
+#endif // __ALWAYS_ON_CUSTOM_API
+
+    /**
+     * Destructor
+     *
+     * @since S60 v3.1
+     */
+    virtual ~CAORAUManagerImpl();
+    
+private: // New methods
+
+#ifdef __ALWAYS_ON_CUSTOM_API
+
+    /**
+     * Constructor.
+     *
+     * @since S60 v3.1
+     * @param aObserver  Interface via receive notifications from RAU.
+     * @param aCustomAPI Object via send notifications to TSY.
+     */
+    CAORAUManagerImpl( MAORAUManagerObserver& aObserver,
+                       RMmCustomAPI& aCustomAPI );
+#else
+
+    /**
+     * Constructor.
+     *
+     * @since S60 v3.1
+     * @param aObserver  Interface via receive notifications from RAU.
+     */
+    CAORAUManagerImpl( MAORAUManagerObserver& aObserver );
+
+#endif // __ALWAYS_ON_CUSTOM_API
+
+    /**
+     * Symbian 2nd-phase constructor.
+     *
+     * @since S60 v3.1
+     */
+    void ConstructL();
+    
+private: // New methods
+
+    //
+    void IssueRAUNotifications();
+
+private: // From base class CActive
+
+    /**
+     * From CActive
+     * Process the completed request.
+     *
+     * @since S60 v3.1
+     */
+    void RunL();
+    
+    /**
+     * From CActive
+     * Cancel outstanding request
+     *
+     * @since S60 v3.1
+     */
+    void DoCancel();
+    
+    /**
+     * From CActive
+     * Handle a leave occurred in the RunL().
+     * Note: If RunError function pointer is not given in construction,
+     * the leave error is to be propagated back to the active scheduler!
+     *
+     * @since S60 v3.1
+     * @param aError the error code of leave
+     */
+    TInt RunError( TInt aError );
+    
+private: // Data
+
+    /**
+     * Ref: RAU manager observer
+     */
+    MAORAUManagerObserver& iObserver;
+    
+#ifdef __ALWAYS_ON_CUSTOM_API
+    
+    /** 
+     * Ref: Custom API
+     */
+    RMmCustomAPI& iCustomAPI;
+    
+    /**
+     * RAU status
+     */
+    RMmCustomAPI::TRauEventStatus iRAUStatus;
+    
+#endif // __ALWAYS_ON_CUSTOM_API
+    };
+
+#endif // C_CAORAUMANAGERIMPL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/caoraumanagerimplstub.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,145 @@
+/*
+* Copyright (c) 2004,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:  RAU manager stub for testing
+*
+*/
+
+
+#ifndef C_CAORAUMANAGERIMPLSTUB_H
+#define C_CAORAUMANAGERIMPLSTUB_H
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <e32property.h>
+
+#include "alwaysonconfig.hrh"
+#include "caoasyncwrapper.h"
+
+// FORWARD DECLARATIONS
+class MAORAUManagerObserver;
+#ifdef __ALWAYS_ON_CUSTOM_API
+class RMmCustomAPI;
+#endif // __ALWAYS_ON_CUSTOM_API
+
+/**
+*  RAU manager implementation.
+*
+*  @lib PDPContextManager2.lib
+*  @since S60 v3.1
+*/
+class CAORAUManagerImpl : public CBase
+    {
+public: // Constructors & destructors
+
+#ifdef __ALWAYS_ON_CUSTOM_API
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 v3.1
+     * @param aObserver  Interface via receive notifications from RAU.
+     * @param aCustomAPI Object via send notifications to TSY.
+     * @return a pointer to the created instance of CAORAUManagerImpl.
+     */
+    static CAORAUManagerImpl* NewL( MAORAUManagerObserver& aObserver,
+                                    RMmCustomAPI& /*aCustomAPI*/ );
+#else
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 v3.1
+     * @param aObserver  Interface via receive notifications from RAU.
+     * @return a pointer to the created instance of CAORAUManagerImpl.
+     */
+    static CAORAUManagerImpl* NewL( MAORAUManagerObserver& aObserver );
+
+#endif// __ALWAYS_ON_CUSTOM_API
+
+    /**
+     * Destructor
+     *
+     * @since S60 v3.1
+     */
+    virtual ~CAORAUManagerImpl();
+    
+private: // RAU impl stub methods
+
+    /**
+     * RAU event async wrapper method
+     *
+     * @since S60 v3.1
+     */
+    void SubscribeRAUEvents();
+
+    /**
+     * RAU event async wrapper method
+     *
+     * @since S60 v3.1
+     * @param aStatus TRequestStatus for async call
+     */
+    void RAUEventSubscribeIssueRequest( TRequestStatus& aStatus );
+
+    /**
+     * RAU event async wrapper method
+     *
+     * @since S60 v3.1
+     * @param aStatus returned status from async call
+     */
+    void RAUEventSubscribeRunL( TInt aStatus );
+
+    /**
+     * RAU event async wrapper method
+     *
+     * @since S60 v3.1
+     */
+    void RAUEventSubscribeDoCancel();
+            
+private: // New methods
+
+    /**
+     * Constructor.
+     *
+     * @since S60 v3.1
+     * @param aObserver  Interface via receive notifications from RAU.
+     */
+    CAORAUManagerImpl( MAORAUManagerObserver& aObserver );
+
+    /**
+     * Symbian 2nd-phase constructor.
+     *
+     * @since S60 v3.1
+     */
+    void ConstructL();
+
+private: // Data
+
+    /**
+     * RAU manager observer
+     */
+    MAORAUManagerObserver& iObserver;
+    
+    /**
+     * RAU Event property
+     */
+    RProperty iRAUEventProperty;
+    
+    /**
+     * RAU Event subscriber
+     * Own
+     */
+    CAOAsyncWrapper<CAORAUManagerImpl>* iRAUEventSubscriber;
+    };
+
+#endif // C_CAORAUMANAGERIMPLSTUB_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/caoserver.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,500 @@
+/*
+* Copyright (c) 2004,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:  Implements the CAlwaysOnlineEComInterface interface
+*
+*/
+
+
+#ifndef C_CAOSERVER_H
+#define C_CAOSERVER_H
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <e32property.h>
+
+#include "alwaysonconfig.hrh"
+
+#include <rmmcustomapi.h>
+
+#include "maostatecontext.h"
+#include "maostatepool.h"
+#include "maoconnectionmanagerobserver.h"
+#include "taostate.h"
+#include "maotimerobserver.h"
+#include "maosettingsobserver.h"
+#include "maoraumanagerobserver.h"
+#include "maogpdsobserver.h"
+#include "caoasyncwrapper.h"
+
+// FORWARD DECLARATIONS
+class CAOConnectionManager;
+class CAOTimer;
+class CAORAUManager;
+class CAOSettings;
+class CAOGpds;
+
+/**
+*  Always-On Server class.
+*
+*  @lib PDPContextManager2.lib
+*  @since S60 v3.1
+*/
+NONSHARABLE_CLASS( CAOServer ):
+    public CBase,
+    public MAOStateContext,
+    public MAOStatePool,
+    public MAOConnectionManagerObserver,
+    public MAOTimerObserver,
+    public MAOSettingsObserver,
+    public MAORAUManagerObserver
+    {
+public:    // Constructors & destructors
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 v3.1
+     */
+    static CAOServer* NewL();
+
+    /**
+     * Destructor
+     *
+     * @since S60 v3.1
+     */
+    virtual ~CAOServer();
+    
+private: // New methods
+
+    /**
+     * Default constructor.
+     *
+     * @since S60 v3.1
+     */
+    CAOServer();
+
+    /**
+     * Default Symbian second-phase constructor
+     *
+     * @since S60 v3.1
+     */
+    void ConstructL();
+
+private: // New methods
+
+    /**
+     * Setup Always-On server
+     *
+     * @since S60 v3.1
+     */
+    void Setup();
+    
+    /**
+     * Reactivation call back
+     *
+     * @since S60 v3.1
+     * @param aSelf the caller
+     */
+    static TInt ReactivationCallBack( TAny* aSelf );
+    
+    /**
+     * Handles reactivation
+     *
+     * @since S60 v3.1
+     */
+    void HandleReactivationL();
+    
+    /**
+     * Does re-activation
+     *
+     * @since S60 v3.1
+     * @param aReason reason of the failure
+     */
+    void DoReactivation( MAOConnectionManager::TFailureReason aReason );
+    
+    /**
+     * PDP property observer
+     *
+     * @since S60 v3.1
+     */
+    void IssuePDPPropertySubscription();
+
+    /**
+     * PDP property observer
+     *
+     * @since S60 v3.1
+     * @param aStatus TRequestStatus for asynchronus call 
+     */
+    void PDPPropertySubscriptionIssueRequest( TRequestStatus& aStatus );
+
+    /**
+     * PDP property observer
+     *
+     * @since S60 v3.1
+     * @param aStatus result status of the returned asynchronus call
+     */
+    void PDPPropertySubscriptionRunL( TInt aStatus );
+
+    /**
+     * PDP property observer
+     *
+     * @since S60 v3.1
+     */
+    void PDPPropertySubscriptionDoCancel();
+    
+    /**
+     * Releases PDP P&S property
+     *
+     * @since S60 v3.1
+     */
+    void ReleasePDPProperty();
+    
+    /**
+     * Creates PDP preoperty and subscribes it
+     *
+     * @since S60 v3.1
+     */
+    void CreatePDPPropertyAndSubscribeL();
+    
+    /**
+     * Setup call back
+     *
+     * @since S60 v3.1
+     * @param aSelf the caller
+     */
+    static TInt SetupCallBack( TAny* aSelf );
+    
+    /**
+     * Handles setup call back
+     *
+     * @since S60 v3.1
+     */
+    void HandleSetup();
+
+
+    /**
+     * Creates the StatePool and fills it with the States.
+     *
+     * @since S60 v3.2
+     */
+    void InitStatePoolL();
+
+
+    /**
+     * Configures Custom API
+     *
+     * @since S60 v3.1
+     */
+    void ConfigureCustomAPIL();
+
+
+private: // From base class MAOStateContext
+
+    /**
+     * From MAOStateContext
+     * Returns connection manager interface.
+     *
+     * @since S60 v3.1
+     */
+    MAOConnectionManager& ConnectionManager() const;
+
+    /**
+     * From MAOStateContext
+     * Returns retry timer interface.
+     *
+     * @since S60 v3.1
+     */
+    MAOTimer& Timer() const;
+    
+    /**
+     * From MAOStateContext
+     * Returns RAU manager interface.
+     *
+     * @since S60 v3.1
+     */
+    MAORAUManager& RAUManager() const;
+    
+    /**
+     * From MAOStateContext
+     * Returns settings interface.
+     *
+     * @since S60 v3.1
+     */
+    MAOSettings& Settings() const;
+    
+    /**
+     * From MAOStateContext
+     * Returns GPDS interface.
+     *
+     * @since S60 v3.1
+     */
+    MAOGpds& Gpds() const;
+    
+private: // From base class MAOStatePool
+
+    /**
+     * From MAOStatePool
+     * Changes to defined state.
+     * New state is returned as a parameter.
+     *
+     * @since S60 v3.1
+     * @param aState: New state
+     */
+    TAOState* ChangeState( TAOState::TAOStateName aState );
+    
+    /**
+     * From MAOStatePool
+     * Returns current state.
+     *
+     * @since S60 v3.1
+     */
+    TAOState* CurrentState() const;
+    
+private: // From base class MAOConnectionManagerObserver
+
+    /**
+     * From MAOConnectionManagerObserver
+     * Succesful PDP context activation is notified
+     * through this method.
+     *
+     * @since S60 v3.1
+     */
+    void HandlePDPContextActivatedL();
+
+    /**
+     * From MAOConnectionManagerObserver
+     * PDP context activation failure is notified through
+     * this method.
+     *
+     * @since S60 v3.1
+     * @param aReason: Activation failure reason
+     */
+    void HandlePDPContextActivationFailedL(
+        MAOConnectionManager::TFailureReason aReason );
+        
+    /**
+     * From MAOConnectionManagerObserver
+     * PDP context disconnection is notified through
+     * this method.
+     *
+     * @since S60 v3.1
+     * @param aReason: Disconnection reason
+     */
+    void HandlePDPContextDisconnectedL(
+        MAOConnectionManager::TFailureReason aReason );
+    
+    /**
+     * From MAOConnectionManagerObserver
+     * PDP context temporary data transfer blocking notification
+     * is recieved through this method.
+     *
+     * @since S60 v3.1
+     */
+    void HandlePDPContextTemporarilyBlockedL();
+    
+    /**
+     * From MAOConnectionManagerObserver
+     * Notifies network registration status changes.
+     *
+     * @since S60 v3.1
+     * @param aNetworkRegistration: NW registration
+     */
+    void HandleNWRegistrationStatusChangedL(
+        CTelephony::TRegistrationStatus aNetworkRegistration );
+        
+    /**
+     * From MAOConnectionManagerObserver
+     * Notifies from a deleted connection.
+     *
+     * @since S60 v3.1
+     * @param aMyConnectionId connection id from connection monitor
+     * @param aForward Tells whether message should be forwarded next layer
+     */
+    void HandleConnectionDeletedL( const TUint aConnectionId,
+                                   const TBool aForward);
+    
+     /**
+     * From MAOConnectionManagerObserver
+     * ?
+     *
+     * @since S60 v3.1
+     */
+    void HandleExternalConnectionCreatedL();
+    
+    
+    /**
+     * From MAOConnectionManagerObserver
+     *
+     * @since S60 v3.2
+     * @param aMyConnectionId connection id from connection monitor
+     * @param aIapId iap id
+     * @param anetId network id
+     * @return void
+     */
+    void HandleInternalConnectionCreatedL( const TUint aConnectionId,
+                                           const TUint aIapId, 
+                                           const TUint aNetId );
+    
+    /**
+     * From MAOConnectionManagerObserver
+     * Notifies error if network registration status
+     * is not received.
+     *
+     * @since S60 v3.1
+     * @param aError: Error code
+     */
+    void HandleError( TInt aError );
+    
+private: // From base class MAOTimerObserver
+
+    /**
+     * From MAOTimerObserver
+     * Handles retry timer expiration.
+     *
+     * @since S60 v3.1
+     */
+    void HandleRetryTimerExpiredL();
+
+    /**
+     * From MAOTimerObserver
+     * Handles connection timer expiration.
+     *
+     * @since S60 v3.1
+     */
+    void HandleConnectionTimerExpiredL();
+
+    /**
+     * Handles unconnect timer expiration.
+     *
+     * @since 3.0
+     */
+    void HandleUnconnectTimerExpiredL();
+    
+private: // From base class MAOSettingsObserver
+
+    /**
+     * From MAOSettingsObserver
+     * Method through setting changes are notified.
+     *
+     * @since S60 v3.1
+     */
+    void HandleSettingsChangedL();
+    
+private: // From base class MAORAUManagerObserver
+
+    /**
+     * From MAORAUManagerObserver
+     * Succesfull RAU is notified through this method.
+     *
+     * @since S60 v3.1
+     * @param aType: RAU type
+     */
+    void HandleSuccesfulRAUL( TRAUType aType );
+    
+    
+private: // Data
+
+    
+    /**
+     * Tel server
+     */
+    RTelServer iTelServer;
+
+    /**
+     * Mobile phone
+     */
+    RMobilePhone iMobilePhone;
+
+    /**
+     * Custom API
+     */
+    RMmCustomAPI iCustomAPI;
+    
+    
+    /** 
+     * Connection manager
+     * Own
+     */ 
+    CAOConnectionManager* iConnectionManager;
+    
+    /** 
+     * Retry timer
+     * Own
+     */ 
+    CAOTimer* iTimer;
+    
+    /** 
+     * RAU event manager
+     * Own
+     */ 
+    CAORAUManager* iRAUManager;
+    
+    /** 
+     * Settings
+     * Own
+     */ 
+    CAOSettings* iSettings;
+    
+    /** 
+     * GPDS interface
+     * Own
+     */ 
+    CAOGpds* iGpds;
+    
+    /** 
+     * States array
+     */ 
+    CArrayPtrFlat<TAOState>* iPointerStatePool;
+    
+    /** 
+     * Async PDP context re-activation timer
+     * Own
+     */ 
+    CPeriodic* iAsyncReactivation;
+    
+    /** 
+     * Current disconnect / failure reason
+     */ 
+    MAOConnectionManager::TFailureReason iFailure;
+    
+    /** 
+     * Current activation failure
+     */ 
+    TBool iActivationFailure;
+    
+    /** 
+     * Current state
+     * Not own
+     */ 
+    TAOState* iCurrentState;
+    
+    /** 
+     * PDPProperty
+     */ 
+    RProperty iPDPProperty;
+    
+    /** 
+     * PDP P&S property observer
+     * Own
+     */ 
+    CAOAsyncWrapper<CAOServer>* iPDPPropertySubscriber;
+    
+    /** 
+     * Timer setup
+     * Own
+     */ 
+    CPeriodic* iAsyncSetup;
+    };
+
+#endif //C_CAOSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/caosettings.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,371 @@
+/*
+* Copyright (c) 2004,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:  Always-On Settings
+*
+*/
+
+
+#ifndef C_CAOSETTINGS_H
+#define C_CAOSETTINGS_H
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <cenrepnotifyhandler.h>
+
+#include "maosettings.h"
+
+// FORWARD DECLARATIONS
+class MAOSettingsObserver;
+class CRepository;
+
+// CONSTANTS
+
+/**
+*  TLingerSetting encapsulates iap id and corresponding.
+*  linger timer interval.
+*
+*  @lib PDPContextManager2.lib
+*  @since S60 v3.2
+*/
+class TLingerSetting
+    { 
+    public: // Data
+        TInt iIap;
+        TInt iInterval;
+    };
+
+
+/**
+*  Settings encapsulates all Always-On related settings.
+*  Settings also notifies if Always-On settings are
+*  updated OTA (Over The Air).
+*  Settings changes are notified through MAOSettingsObserver interface.
+*
+*  @lib PDPContextManager2.lib
+*  @since S60 v3.1
+*/
+NONSHARABLE_CLASS( CAOSettings ):
+    public CActive,
+    public MAOSettings,
+    public MCenRepNotifyHandlerCallback
+    {
+public:    // Constructors & destructors
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 v3.1
+     * @param aObserver observer for setting changes
+     * @return pointer to the created CAOSettings object
+     */
+    static CAOSettings* NewL( MAOSettingsObserver& aObserver );
+
+    /**
+     * Destructor
+     *
+     * @since S60 v3.1
+     */
+    virtual ~CAOSettings();
+    
+public: // New methods
+
+    /**
+     * Fetches asynchronously current settings.
+     * When settings have been received notification
+     * is broadcasted through MAOSettingsObserver interface.
+     * If parameter '0' is used then all settings are fetched.
+     *
+     * @since S60 v3.1
+     * @param aId of the required settings
+     */
+    void FetchSettings( TUint32 aId = 0 );
+    
+private: // From base class CActive
+
+    /**
+     * From CActive
+     * Process the completed request.
+     *
+     * @since S60 v3.1
+     */
+    void RunL();
+
+    /**
+     * From CActive
+     * Cancel outstanding request
+     *
+     * @since S60 v3.1
+     */
+    void DoCancel();
+
+    /**
+     * From CActive
+     * Handle a leave occurred in the RunL().
+     * Note: If RunError function pointer is not given in construction,
+     * the leave error is to be propagated back to the active scheduler!
+     *
+     * @since S60 v3.1
+     * @param aError the error code of leave
+     */
+    TInt RunError( TInt aError );
+
+public: // From base class MAOSettings
+        // Allow Always-On Server access settings
+    
+    /**
+     * From MAOSettings
+     * Gets current acces point id.
+     *
+     * @since S60 v3.1
+     */
+    TInt AccessPointId() const;
+
+    /**
+     * From MAOSettings
+     * Gets current retry timer value in seconds.
+     *
+     * @since S60 v3.1
+     */
+    TInt RetryTimerValue() const;
+            
+    /**
+     * From MAOSettings
+     * Gets Always-On support in HPLMN (home network).
+     *
+     * @since S60 v3.1
+     * @return ETrue if supported
+     */
+    TBool AlwaysOnSupportedInHPLMN() const;
+    
+    /**
+     * From MAOSettings
+     * Gets Always-On support in VPLMN (visitor network).
+     *
+     * @since S60 v3.1
+     * @return ETrue if supported.
+     */
+    TBool AlwaysOnSupportedInVPLMN() const;
+    
+    /**
+     * From MAOSettings
+     * Gets current connection timer value in seconds.
+     *
+     * @since S60 v3.1
+     * @return TInt the connection timer value in seconds.
+     */
+    TInt ConnectionTimerValue() const;
+        
+    /**
+     * Gets current unconnect timer value in seconds.
+     *
+     * @since 3.0
+     * @return TInt
+     */
+    TInt UnconnectTimerValue() const;
+    
+     /**
+     * From MAOSettings
+     * Gets current linger timer value in seconds.
+     *
+     * @param aIapId Iap id of the connection.
+     * @since S60 v3.2
+     */
+    TInt LingerTimerValue( const TUint aIapId ) const;
+    
+private: // From base class MAOSettings
+    
+    /** 
+     * From MAOSettings
+     * This callback method is used to notify the client about
+     * changes in keys when the whole repository is listened for.
+     *
+     * Note: It is not guaranteed that a notification will be received
+     *       for all keys, if multiple keys are changed in rapid succession
+     *       by multiple threads or when the whole repository is reset,
+     *       therefore only listen for whole repository if this is not an 
+     *       issue.
+     *
+     * @param aId Id of the key that has changed.If multiple keys were changed
+     *        by whole repository reset, value will be KInvalidNotificationId.
+     */
+    void HandleNotifyGeneric( TUint32 aId );
+    
+private: // New methods
+
+    /**
+     * Constructor.
+     *
+     * @since S60 v3.1
+     * @param aObserver observer for setting changes
+     */
+    CAOSettings( MAOSettingsObserver& aObserver );
+
+    /**
+     * Default Symbian 2nd-phase constructor
+     *
+     * @since S60 v3.1
+     */
+    void ConstructL();
+
+private: // New methods
+
+    /**
+     * Gets current settings
+     * 0 stands for all
+     *
+     * @since S60 v3.1
+     * @param
+     */
+    void SetupSettings( TUint32 aId = 0 );
+    
+    /**
+     * Completes self
+     *
+     * @since S60 v3.1
+     * @param aStatus TRequestStatus to coplete
+     * @param aReason reason of the completion
+     */
+    void CompleteSelf( TRequestStatus& aStatus, TInt aReason );
+    
+    /**
+     * Update IAP setting.
+     * If new setting cannot be retrieved old remains
+     *
+     * @since S60 v3.1
+     */
+    void UpdateIAPSetting();
+    
+    /**
+     * Update retry timer setting.
+     * If new setting cannot be retrieved old remains
+     *
+     * @since S60 v3.1
+     */
+    void UpdateRetryTimerSetting();
+
+    /**
+     * Update connection timer setting.
+     * If new setting cannot be retrieved old remains
+     *
+     * @since S60 v3.1
+     */
+    void UpdateConnectionTimerSetting();
+    
+    /**
+     * Update unconnect timer setting.
+     * If new setting cannot be retrieved old remains
+     *
+     * @since S60 v3.1
+     */
+    void UpdateUnconnectTimerSetting();
+
+    /**
+     * Update HPLMN setting.
+     * If new setting cannot be retrieved old remains
+     *
+     * @since S60 v3.1
+     */
+    void UpdateHPLMNSetting();
+    
+    /**
+     * Update VPLMN setting.
+     * If new setting cannot be retrieved old remains
+     *
+     * @since S60 v3.1
+     */
+    void UpdateVPLMNSetting();
+
+    /**
+     * Update linger timer setting.
+     * If new setting cannot be retrieved old remains
+     *
+     * @since S60 v3.2
+     */
+    void UpdateLingerTimerSetting();
+    
+    /**
+     * Updates the setting
+     *
+     * @since S60 v3.1
+     * @param aId id os the setting to update
+     * @param aValue new value of the setting
+     */
+    void UpdateSetting( TUint32 aId, TInt& aValue );
+    
+private: // Data
+
+    /** 
+     * Settings observer
+     */
+    MAOSettingsObserver& iObserver;
+    
+    /** 
+     * Central repository
+     * Own
+     */
+    CRepository* iRepository;
+    
+    /** 
+     * Listener for settings
+     * Own
+     */
+    CCenRepNotifyHandler* iCenRepNotifyHandler;
+    
+    /** 
+     * Access point ID
+     */
+    TInt iIAP;
+    
+    /** 
+     * Retry timer value in seconds
+     */
+    TInt iRetryTimerValue;
+    
+    /** 
+     * Always-On mode supported in HPLMN
+     */
+    TBool iSupportedInHPLMN;
+
+    /** 
+     * Always-On mode supported in VPLMN
+     */
+    TBool iSupportedInVPLMN;
+    
+    /** 
+     * Setting to fetch
+     */
+    TUint32 iSettingsToFetch;
+    
+    /** 
+     * Connection timer value
+     */
+    TInt iConnectionTimerValue;
+        
+    /**
+     * Own: Unconnect timer value
+     */
+    TInt iUnconnectTimerValue;
+    
+    /** 
+     * Linger timer value in seconds
+     */
+    TInt iLingerTimerValue;
+    
+    /** 
+     * Array of iap id and linger interval pairs
+     */
+    RArray< TLingerSetting > iLingerSettings;
+    };
+    
+#endif // C_CAOSETTINGS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/caotimer.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,237 @@
+/*
+* Copyright (c) 2004,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 CAOTimer class
+*
+*/
+
+
+#ifndef C_CAOTIMER_H
+#define C_CAOTIMER_H
+
+// INCLUDE FILES
+#include <e32base.h>
+#include "maotimer.h"
+
+// FORWARD DECLARATIONS
+class CPeriodic;
+class MAOTimerObserver;
+class MAOSettings;
+
+/**
+*  Timer provides possibility to start and stop retry
+*  and connection timers.
+*
+*  @lib PDPContextManager2.lib
+*  @since S60 v3.1
+*/
+NONSHARABLE_CLASS( CAOTimer ):
+    public CBase,
+    public MAOTimer
+    {
+public:    // Constructors & destructors
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 v3.1
+     * @param aObserver observer for timer events
+     * @param aSettings settings for the timer
+     * @return pointer to the created CAOTimer object
+     */
+    static CAOTimer* NewL( MAOTimerObserver& aObserver,
+                           MAOSettings& aSettings );
+
+    /**
+     * Destructor
+     *
+     * @since S60 v3.1
+     */
+    virtual ~CAOTimer();
+    
+public: // New methods
+
+    /**
+     * Handles settings changes.
+     *
+     * @since S60 v3.1
+     */
+    void HandleSettingsChangedL();
+    
+public: // From base class MAOTimer
+        // Allow Always-On Server access
+
+    /**
+     * From MAOTimer
+     * Starts retry timer.
+     *
+     * @since S60 v3.1
+     */
+    void StartRetryTimer();
+
+    /**
+     * From MAOTimer
+     * Starts connection timer.
+     *
+     * @since S60 v3.1
+     */
+    void StartConnectionTimer();
+
+    /**
+     * From MAOTimer
+     * Stops retry timer.
+     *
+     * @since S60 v3.1
+     */
+    void StopRetryTimer();
+
+    /**
+     * From MAOTimer
+     * Stops connection timer.
+     *
+     * @since S60 v3.1
+     */
+    void StopConnectionTimer();
+
+    /**
+     * Starts unconnect timer.
+     *
+     * @since 3.0
+     */
+    void StartUnconnectTimer();
+
+    /**
+     * Stops unconnect timer.
+     *
+     * @since 3.0
+     */
+    void StopUnconnectTimer();
+    
+    /**
+     * From MAOTimer
+     * Checks if retry timer is set to infinite (disabled).
+     *
+     * @since S60 v3.1
+     */
+    TBool RetryTimerDisabled() const;
+    
+    /**
+     * Checks if unconnect timer is set to zero (disabled).
+     *
+     * @since 3.0
+     * @return ETrue if set to infinite
+     */
+    TBool UnconnectTimerDisabled() const;
+    
+private: // New methods
+
+    /**
+     * Constructor.
+     *
+     * @since S60 v3.1
+     * @param aObserver observer for timer events
+     * @param aSettings settings for the timer
+     */
+    CAOTimer( MAOTimerObserver& aObserver,
+              MAOSettings& aSettings );
+
+    /**
+     * Default Symbian 2nd-phase constructor
+     *
+     * @since S60 v3.1
+     */
+    void ConstructL();
+
+private: // New metohds
+
+    /**
+     * Retry timer callback
+     *
+     * @since S60 v3.1
+     * @param aSelf the caller
+     * @return error code in case of error else KErrNone
+     */
+    static TInt RetryTimerCallBack( TAny* aSelf );
+    
+    /**
+     * Connection timer callback
+     *
+     * @since S60 v3.1
+     * @param aSelf the caller
+     * @return error code in case of error else KErrNone
+     */
+    static TInt ConnectionTimerCallBack( TAny* aSelf );
+    
+    /**
+     * Handles retry timer callback
+     *
+     * @since S60 v3.1
+     */
+    void HandleRetryTimerCallBackL();
+        
+    /**
+     * unconnected timer call back
+     *
+     * @since S60 v3.1
+     * @param aSelf ?
+     */ 
+    static TInt UnconnectTimerCallBack( TAny* aSelf );
+    
+    /**
+     * Configures interval for timer
+     * Return value is internal in micro seconds
+     *
+     * @since S60 v3.1
+     * @param aInternalInSec ?
+     */ 
+    TInt ConfigureInterval( const TInt& aIntervalInSec );
+
+private: // Data
+
+    /**
+     * Timer observer
+     */
+    MAOTimerObserver& iObserver;
+    
+    /**
+     * Settings
+     */
+    MAOSettings& iSettings;
+
+    /**
+     * Own: Retry timer
+     */
+    CPeriodic* iRetryTimer;
+    
+    /**
+     * Retry timer value
+     */
+    TInt iRetryTimerCount;
+
+    /**
+     * Currently used retry timer interval
+     */
+    TInt iCurrentRetryTimerInterval;
+    
+    /**
+     * Own: Connection timer
+     */
+    CPeriodic* iConnectionTimer;
+        
+    /**
+     * Own: Unconnect timer
+     */
+    CPeriodic* iUnconnectTimer;
+    };
+
+#endif // C_CAOTIMER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/linger.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,291 @@
+/*
+* 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:  Provides lingering functionality for not-always-on connections.
+*
+*/
+
+
+#ifndef CLINGERCONNECTION_H
+#define CLINGERCONNECTION_H
+
+#include <e32base.h>
+#include <es_sock.h>
+#include <in_sock.h>
+#include <es_enum.h>
+
+class MAOSettings;
+
+/**
+ *  Monitors and keeps open/stops not-always-on connections.
+ *
+ *  Keeps not-always-on connection open for a lingering period.
+ *  (defined by T_notAlwaysOn) after connection has gone idle.
+ *  Then stops connection if it is still idle.
+ *
+ *  @lib pdpcontextmanager2
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CLingerConnection ) : public CBase
+    {
+public:
+
+    /** Possible status values */
+    enum TLingerStatus
+        {
+        ELingerStopped,
+        ELingerAttached,
+        ELingerRunning
+        };
+
+    /**
+     * Two-phased constructor.
+     * @param aConnectionInfo Connection id.
+     * @param aConnectionInfo Iap id and net id of the connection
+     * @param aSettings Provides timer settings
+     * @param aSocketServ Pointer to socket server
+     */
+    static CLingerConnection* NewL(
+          TUint            aConnectionId,
+          TConnectionInfo  aConnectionInfo, 
+          MAOSettings&     aSettings, 
+          RSocketServ*     aSocketServ );
+          
+    static CLingerConnection* NewLC(
+          TUint            aConnectionId, 
+          TConnectionInfo  aConnectionInfo, 
+          MAOSettings&     aSettings, 
+          RSocketServ*     aSocketServ );      
+    
+    /**
+    * Destructor.
+    */
+    virtual ~CLingerConnection();
+    
+    /**
+     * Attaches to connection and starts linger timer
+     *
+     * @since S60 v3.2
+     * @return error code in case of error else KErrNone
+     */
+    TInt StartLinger();
+    
+    /**
+     * Stops linger timer and detaches from connection
+     *
+     * @since S60 v3.2
+     * @return void
+     */
+    void StopLinger();
+
+    /**
+     * Stops connection
+     *
+     * @since S60 v3.2
+     * @return error code in case of error else KErrNone
+     */
+    TInt StopConnection();
+    
+    /**
+     * Refreshes settings from CommsDat
+     *
+     * @since S60 v3.2
+     * @return void
+     */
+    void HandleSettingsChanged();
+    
+    /**
+     * Returns connection id
+     *
+     * @since S60 v3.2
+     * @return connection id
+     */
+    TUint ConnectionId() { return iConnectionId; };
+
+    /**
+     * Returns iap id
+     *
+     * @since S60 v3.2
+     * @return iap id
+     */
+    TUint IapId() { return iConnectionInfo.iIapId; };
+    
+    /**
+     * Returns current status
+     *
+     * @since S60 v3.2
+     * @return current status
+     */
+    TInt Status();
+
+protected:
+
+private:
+
+    /**
+     * Default constructor.
+     * @param aConnectionInfo Connection id.
+     * @param aConnectionInfo Iap id and net id of the connection
+     * @param aSettings Provides timer settings
+     * @param aSocketServ Pointer to socket server
+     */
+    CLingerConnection( TUint           aConnectionId,
+                       TConnectionInfo aConnectionInfo,
+                       MAOSettings&    aSettings, 
+                       RSocketServ*    aSocketServ);
+
+    void ConstructL();
+
+    /**
+     * Opens and attaches to RConnection object to keep
+     * the connection open. 
+     *
+     * @since v3.2
+     * @return error code in case of error else KErrNone
+     */
+    TInt OpenAndAttach();
+    
+    /**
+     * Closes RConnection object.
+     *
+     * @since v3.2
+     * @return void
+     */
+    void CloseConnection();
+
+    /**
+     * Checks if there has been any data transfer throuh the connection
+     *
+     * @since S60 v3.2
+     * @return ETrue if connection is idle, otherwise EFalse.
+     */
+    TBool IsConnectionIdle();
+    
+    /**
+     * Reads linger settings.
+     *
+     * @since S60 v3.2
+     * @return void
+     */
+    void ReadSettings();
+    
+     /**
+     * Starts a periodic timer
+     *
+     * @since S60 v3.2
+     * @param aTimerInterval Timer  interval in seconds
+     * @param aReset Resets timer call count to zero when ETrue
+     * @return void
+     */
+    void StartTimer( TInt aTimerInterval, TBool aReset=ETrue );
+    
+    /**
+     * Stops periodic timer
+     *
+     * @since S60 v3.2
+     * @return void
+     */
+    void CancelTimer();
+    
+    /**
+     * Timer callback
+     *
+     * @since v3.2
+     * @param aSelf the caller
+     * @return error code in case of error else KErrNone
+     */
+    static TInt TimerCallBack( TAny* aSelf );
+
+private: // data
+
+     /**
+     * Connection id (from Connection Monitor)
+     */
+    TUint iConnectionId;
+    
+     /**
+     * Identifies connection (Iap id & net id)
+     */
+    TConnectionInfo iConnectionInfo;
+    
+    /**
+     * Reference to Settings object
+     */
+    MAOSettings& iSettings;
+
+    /**
+     * Pointer to socket server
+     * Not own.
+     */
+    RSocketServ* iSocketServ;
+    
+    /**
+     * Tells whether connection is linger mode or not
+     */
+    TBool iLingering;
+    
+    /**
+     * Tells whether connection is attached or not
+     */
+    TBool iAttached;
+    
+    /**
+     * Latest downlink data transferred
+     */
+    TUint iDlData;
+    
+    /**
+     * Packaged downlink data 
+     */
+    TPckg< TUint >  iPckgDlData;
+    
+    /**
+     * Latest uplink data transferred
+     */
+    TUint iUlData;
+    
+    /**
+     * Packaged uplink data
+     */
+    TPckg< TUint >  iPckgUlData;
+    
+    /**
+     * Connection object for keeping the connetion open
+     * and for stopping the connection when needed.
+     */
+    RConnection iConnection;
+    
+    /**
+     * Idle/linger timer
+     * Own.
+     */
+    CPeriodic* iTimer;
+
+    /**
+     * Linger interval in seconds
+     */
+    TInt iLingerInterval;
+    
+     /**
+     * Linger timer call count
+     */
+    TInt iLingerTimerCount;
+
+    /**
+     * Currently used timer interval
+     */
+    TInt iCurrentTimerInterval;
+    
+    };
+
+#endif // CLINGERCONNECTION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/logger.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2004,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
+*
+*/
+
+
+#ifndef LOGGER_H
+#define LOGGER_H
+
+// INCLUDE FILES
+#include <e32std.h>
+#include <flogger.h>
+#include "alwaysonconfig.hrh"
+
+// CONSTANTS
+_LIT( KPath, "pdpcm2" );
+_LIT( KFile, "AlwaysOn.txt" );
+
+#ifdef LOGGING_ENABLED
+
+#ifdef LOGGING_MODE_FILE
+
+#define LOG_1( a )\
+    RFileLogger::Write( KPath, KFile, EFileLoggingModeAppend, a )
+#define LOG_2( a, b )\
+    RFileLogger::WriteFormat( KPath, KFile, EFileLoggingModeAppend, a, b )
+#define LOG_3( a, b, c )\
+    RFileLogger::WriteFormat( KPath, KFile, EFileLoggingModeAppend, a, b, c )
+    
+#else
+    
+#define LOG_1( a ) RDebug::Print( a )
+#define LOG_2( a, b ) RDebug::Print( a, b )
+#define LOG_3( a, b, c ) RDebug::Print( a, b, c )
+    
+#endif // LOGGING_MODE_FILE
+
+#else
+
+#define LOG_1( a )
+#define LOG_2( a, b )
+#define LOG_3( a, b, c )
+
+#endif // LOGGING_ENABLED
+
+#endif // LOGGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/maoconnectionmanager.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,126 @@
+/*
+* Copyright (c) 2004 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 MAOConnectionManager interface
+*
+*/
+
+
+#ifndef MAOCONNECTIONMANAGER_H
+#define MAOCONNECTIONMANAGER_H
+
+// INCLUDE FILES
+
+// FORWARD DECLARATIONS
+
+/**
+ *  Connection manager interface.
+ *
+ *  @lib PDPContextManager.lib
+ *  @since S60 v3.1
+ */
+class MAOConnectionManager
+    {
+public: // Data types
+
+    /**
+     * Network type
+     */
+    enum TNetworkType
+        {
+        ENotRegistered,
+        EHPLMN,
+        EVPLMN
+        };
+
+    /**
+     * Failure reason
+     */
+    enum TFailureReason
+        {
+        ETemporary,
+        EPermanent,
+        EDisconnected
+        };
+        
+public:
+
+    /**
+     * Activate PDP context.
+     * Asynchronous.
+     *
+     * @since S60 v3.1
+     */
+    virtual void ActivatePDPContextL() = 0;
+    
+    /**
+     * Checks if we have a PDP context active.
+     * Synchronous.
+     *
+     * @since S60 v3.1
+     * @return ETrue if PDP context is active
+     */
+    virtual TBool IsPDPContextActive() const = 0;       
+
+    /**
+     * Closes current connection.
+     * Synchronous.
+     *
+     * @since S60 v3.1
+     */
+    virtual void CloseConnection() = 0;
+    
+    /**
+     * Closes current connection without stopping it.
+     * Synchronous.
+     *
+     * @since S60 v3.2
+     */
+    virtual void DetachConnection() = 0;
+    
+    /**
+     * Gets current network type.
+     * Synchronous.
+     *
+     * @since S60 v3.1
+     * @return TNetworkType
+     */
+    virtual TNetworkType NetworkType() const = 0;       
+    
+    /**
+     * Gets numer of currently active connections.
+     * Synchronous.
+     *
+     * @since 3.0
+     * @return TInt
+     */     
+    virtual TInt NumberOfConnections() = 0;
+    
+    /**
+     * Handles settings changes.
+     *
+     * @since S60 v3.2
+     */
+    virtual void HandleSettingsChangedL() = 0;
+    
+protected:
+
+    /**
+     * Prohibit destruction
+     *
+     * @since S60 v3.1
+     */
+    virtual ~MAOConnectionManager(){};
+    };
+
+#endif /* MAOCONNECTIONMANAGER_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/maoconnectionmanagerobserver.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2004,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:  Defines MAOConnectionManagerObserver interface
+*
+*/
+
+
+#ifndef M_MAOCONNECTIONMANAGEROBSERVER_H
+#define M_MAOCONNECTIONMANAGEROBSERVER_H
+
+// INCLUDE FILES
+#include "maoconnectionobserver.h"
+#include "maoconnectionmonitorobserver.h"
+
+// FORWARD DECLARATIONS
+
+/**
+*  Connection manager observer.
+*  This interface combines MAOConnectionObserver and
+*  MAOConnectionMonitorObserver interfaces together.
+*
+*  @lib PDPContextManager2.lib
+*  @since S60 v3.1
+*/
+class MAOConnectionManagerObserver : public MAOConnectionObserver,
+                                     public MAOConnectionMonitorObserver
+    {
+protected:
+
+    /**
+     * Prohibit destruction
+     *
+     * @since S60 v3.1
+     */
+    virtual ~MAOConnectionManagerObserver(){};
+    };
+
+#endif // M_MAOCONNECTIONMANAGEROBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/maoconnectionmonitorobserver.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,95 @@
+/*
+* Copyright (c) 2004,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:  Defines MAOConnectionMonitorObserver interface
+*
+*/
+
+
+#ifndef M_MAOCONNECTIONMONITOROBSERVER_H
+#define M_MAOCONNECTIONMONITOROBSERVER_H
+
+// INCLUDE FILES
+#include <etel3rdparty.h>
+
+// FORWARD DECLARATIONS
+
+/**
+*  Connection monitor observer interface.
+*
+*  @lib PDPContextManager2.lib
+*  @since S60 3.1
+*/
+class MAOConnectionMonitorObserver
+    {
+public:
+
+    /**
+      * Notifies network registration status changes.
+     *
+     * @since 3.1
+     * @param aNetworkRegistration: NW registration
+      */
+    virtual void HandleNWRegistrationStatusChangedL(
+        CTelephony::TRegistrationStatus aNetworkRegistration ) = 0;
+    
+    /**
+     * Notifies from a deleted connection.
+     *
+     * @since 3.1
+     * @param aConnectionId connection id from connection monitor
+     * @param aForward Tells whether message should be forwarded next layer
+     */
+    virtual void HandleConnectionDeletedL( const TUint aConnectionId, 
+                                           const TBool aForward ) = 0;
+    
+    /**
+     * Notifies that external connection has been created.
+     *
+     * @since 3.0
+     */
+    virtual void HandleExternalConnectionCreatedL() = 0;
+    
+    /**
+     * Notifies that internal packet data connection has been created.
+     *
+     * @since S60 v3.2
+     * @param aMyConnectionId connection id from connection monitor
+     * @param aIapId iap id
+     * @param anetId network id
+     * @return void
+     */
+    virtual void HandleInternalConnectionCreatedL( const TUint aConnectionId,
+                                                   const TUint aIapId, 
+                                                   const TUint aNetId ) = 0;  
+        
+    /**
+     * Notifies error if network registration status
+     * is not received.
+     *
+     * @since 3.1
+     * @param aError: Error code
+     */
+    virtual void HandleError( TInt aError ) = 0;
+    
+protected:
+
+    /**
+     * Prohibit destruction
+     *
+     * @since 3.1
+     */
+    virtual ~MAOConnectionMonitorObserver(){};
+    };
+
+#endif // M_MAOCONNECTIONMONITOROBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/maoconnectionobserver.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2004,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:  Defines MAOConnectionObserver interface
+*
+*/
+
+
+#ifndef M_MAOCONNECTIONOBSERVER_H
+#define M_MAOCONNECTIONOBSERVER_H
+
+// INCLUDE FILES
+#include <es_sock.h>
+#include "maoconnectionmanager.h"
+
+// FORWARD DECLARATIONS
+
+/**
+*  Connection listener observer interface.
+*
+*  @lib PDPContextManager2.lib
+*  @since S60 v3.1
+*/
+class MAOConnectionObserver
+    {
+public:
+
+    /**
+     * Succesful PDP context activation is notified
+     * through this method.
+     *
+     * @since S60 v3.1
+     */
+    virtual void HandlePDPContextActivatedL() = 0;
+
+    /**
+     * PDP context activation failure is notified through
+     * this method.
+     *
+     * @since S60 v3.1
+     * @param aReason: Activation failure reason
+     */
+    virtual void HandlePDPContextActivationFailedL(
+        MAOConnectionManager::TFailureReason aReason ) = 0;
+    
+    /**
+     * PDP context disconnection is notified through
+     * this method.
+     *
+     * @since S60 v3.1
+     * @param aReason: Disconnection reason
+     */
+    virtual void HandlePDPContextDisconnectedL(
+        MAOConnectionManager::TFailureReason aReason ) = 0;
+    
+    /**
+     * PDP context temporary data transfer blocking notification
+     * is recieved through this method.
+     *
+     * @since S60 v3.1
+     */
+    virtual void HandlePDPContextTemporarilyBlockedL() = 0;
+    
+protected:
+
+    /**
+     * Prohibit destruction
+     *
+     * @since S60 v3.1
+     */
+    virtual ~MAOConnectionObserver(){};
+    };
+
+#endif // M_MAOCONNECTIONOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/maogpds.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2004,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:  Defines MAOGpds interface
+*
+*/
+
+
+#ifndef M_MAOGPDS_H
+#define M_MAOGPDS_H
+
+// INCLUDE FILES
+
+// FORWARD DECLARATIONS
+
+/**
+*  GPDS interface.
+*
+*  @lib PDPContextManager2.lib
+*  @since S60 v3.1
+*/
+class MAOGpds
+    {
+public: // Data types
+
+    /** Always-On mode enums */
+    enum TAlwaysOnMode
+        {
+        EHPLMN,
+        EVPLMN,
+        EBoth,
+        ENeither
+        };
+
+public: // New methods
+
+    /**
+     * Sets always on mode.
+     *
+     * @since S60 v3.1
+     * @param aMode: Current always on mode
+     */
+    virtual void SetAlwaysOnModeL( TAlwaysOnMode aMode ) = 0;
+
+    };
+
+#endif // M_MAOGPDS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/maogpdsobserver.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2004,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:  Defines MAOGpdsObserver interface
+*
+*/
+
+
+#ifndef M_MAOGPDSOBSERVER_H
+#define M_MAOGPDSOBSERVER_H
+
+// INCLUDE FILES
+
+// FORWARD DECLARATIONS
+
+/**
+*  Interface through succesful always on mode detting to TSY is
+*  notified.
+*
+*  @lib PDPContextManager2.lib
+*  @since S60 v3.x not used yet
+*/
+class MAOGpdsObserver
+    {
+public: // New methods
+
+    /**
+     * Handles always on mode set notification.
+     *
+     * @since S60 v3.x not used yet
+     * @param aError: Success code
+     */
+    virtual void HandleAlwaysOnModeSetL( TInt aError ) = 0;
+
+protected:
+
+    /**
+     * Destructor
+     *
+     * @since S60 v3.x not used yet
+     */
+    virtual ~MAOGpdsObserver(){};
+    };
+
+#endif // M_MAOGPDSOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/maoraumanager.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2004,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:  Defines MAORAUManager interface
+*
+*/
+
+
+#ifndef M_MAORAUMANAGER_H
+#define M_MAORAUMANAGER_H
+
+// INCLUDE FILES
+
+// FORWARD DECLARATIONS
+
+/**
+*  State base class.
+*
+*  @lib PDPContextManager2.lib
+*  @since S60 v3.1
+*/
+class MAORAUManager
+    {
+public:
+
+    /**
+    * 
+    * @since 3.1
+    * @param
+    * @return
+    */
+
+protected:
+
+    // Prohibit destruction
+    virtual ~MAORAUManager(){};
+    };
+
+#endif // M_MAORAUMANAGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/maoraumanagerobserver.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2004,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:  Defines MAORAUManagerObserver interface
+*
+*/
+
+
+#ifndef M_MAORAUMANAGEROBSERVER_H
+#define M_MAORAUMANAGEROBSERVER_H
+
+// INCLUDE FILES
+
+// FORWARD DECLARATIONS
+
+/**
+*  RAU manager observer interface.
+*
+*  @lib PDPContextManager2.lib
+*  @since S60 v3.1
+*/
+class MAORAUManagerObserver
+    {
+public: // Data types
+
+    // RAU type
+    enum TRAUType
+        {
+        ENormal,
+        EPeriodical
+        };
+
+public: // New methods
+
+    /**
+     * Succesfull RAU is notified through this method.
+     *
+     * @since S60 v3.1
+     * @param aType: RAU type
+     */
+    virtual void HandleSuccesfulRAUL( TRAUType aType ) = 0;
+
+protected:
+
+    /**
+     * Prohibit destruction
+     *
+     * @since S60 v3.1
+     */
+    virtual ~MAORAUManagerObserver(){};
+    };
+
+#endif // M_MAORAUMANAGEROBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/maosettings.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,105 @@
+/*
+* Copyright (c) 2004,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:  Defines MAOSettings interface
+*
+*/
+
+
+#ifndef MAOSETTINGS_H
+#define MAOSETTINGS_H
+
+// INCLUDE FILES
+
+// FORWARD DECLARATIONS
+
+// CONSTANTS
+
+/**
+*  Settings interface.
+*
+*  @lib PDPContextManager2.lib
+*  @since S60 v3.1
+*/
+class MAOSettings
+    {
+public:
+
+    /**
+     * Gets current acces point id.
+     *
+     * @since S60 v3.1
+     * @return TInt the acces point ID.
+     */
+    virtual TInt AccessPointId() const = 0;
+
+    /**
+     * Gets current retry timer value in seconds.
+     *
+     * @since S60 v3.1
+     * @return TInt the retry timer interval in seconds.
+     */
+    virtual TInt RetryTimerValue() const = 0;
+    
+    /**
+     * Gets Always-On support in HPLMN (home network).
+     *
+     * @since S60 v3.1
+     * @return ETrue if supported
+     */
+    virtual TBool AlwaysOnSupportedInHPLMN() const = 0;
+    
+    /**
+     * Gets Always-On support in VPLMN (visitor network).
+     *
+     * @since S60 v3.1
+     * @return ETrue if supported.
+     */
+    virtual TBool AlwaysOnSupportedInVPLMN() const = 0;
+    
+    /**
+     * Gets current connection timer value in seconds.
+     *
+     * @since S60 v3.1
+     * @return TInt the connection timer value in seconds.
+     */
+    virtual TInt ConnectionTimerValue() const = 0;
+    
+    /**
+     * Gets current unconnect timer value in seconds.
+     *
+     * @since 3.0
+     * @return TInt
+     */
+    virtual TInt UnconnectTimerValue() const = 0;
+    
+    /**
+     * Gets current linger timer value in seconds.
+     *
+     * @param aIapId Iap id of the connection.
+     * @since 3.2
+     * @return TInt
+     */
+    virtual TInt LingerTimerValue( const TUint aIapId ) const = 0;
+        
+protected:
+
+    /**
+     * Prohibit destruction
+     *
+     * @since 3.1
+     */
+    virtual ~MAOSettings(){};
+    };
+
+#endif // M_MAOSETTINGS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/maosettingsobserver.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2004,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:  Defines MAOSettingsObserver interface
+*
+*/
+
+
+#ifndef M_MAOSETTINGSOBSERVER_H
+#define M_MAOSETTINGSOBSERVER_H
+
+// INCLUDE FILES
+
+// FORWARD DECLARATIONS
+
+/**
+*  Settings observer interface.
+*
+*  @lib PDPContextManager2.lib
+*  @since S60 v3.1
+*/
+class MAOSettingsObserver
+    {
+public:
+
+    /**
+      * Method through setting changes are notified.
+     *
+     * @since 3.1
+     */
+    virtual void HandleSettingsChangedL() = 0;
+
+protected:
+
+    /**
+     * Prohibit destruction
+     *
+     * @since 3.1
+     */
+    virtual ~MAOSettingsObserver(){};
+    };
+
+#endif // M_MAOSETTINGSOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/maostatecontext.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2004,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:  Defines MAOStateContext interface
+*
+*/
+
+
+#ifndef M_MAOSTATECONTEXT_H
+#define M_MAOSTATECONTEXT_H
+
+// INCLUDE FILES
+#include <e32std.h>
+
+// FORWARD DECLARATIONS
+class MAOConnectionManager;
+class MAOTimer;
+class MAORAUManager;
+class MAOSettings;
+class MAOGpds;
+
+/**
+*  State context interface.
+*
+*  @lib PDPContextManager2.lib
+*  @since S60 v3.1
+*/
+class MAOStateContext
+    {
+public:
+
+    /**
+     * Returns connection manager interface.
+     *
+     * @since 3.1
+     * @return MAOConnectionManager&
+     */
+    virtual MAOConnectionManager& ConnectionManager() const = 0;
+
+    /**
+      * Returns retry timer interface.
+     *
+     * @since 3.1
+     * @return MAOTimer&
+     */
+    virtual MAOTimer& Timer() const = 0;
+    
+    /**
+      * Returns RAU manager interface.
+     *
+     * @since 3.1
+     * @return MAORAUManager&
+     */
+    virtual MAORAUManager& RAUManager() const = 0;
+    
+    /**
+     * Returns settings interface.
+     *
+     * @since 3.1
+     * @return MAOSettings&
+     */
+    virtual MAOSettings& Settings() const = 0;
+    
+    /**
+     * Returns GPDS interface.
+     *
+     * @since 3.1
+     * @return MAOGpds&
+     */
+    virtual MAOGpds& Gpds() const = 0;
+    
+protected:
+
+    /**
+     * Prohibit destruction
+     *
+     * @since 3.1
+     */
+    virtual ~MAOStateContext(){};
+    };
+
+#endif // M_MAOSTATECONTEXT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/maostatepool.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2004,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:  Defines MAOStatePool interface
+*
+*/
+
+
+#ifndef M_MAOSTATEPOOL_H
+#define M_MAOSTATEPOOL_H
+
+// INCLUDE FILES
+#include <e32base.h>
+#include "taostate.h"
+
+// FORWARD DECLARATIONS
+
+/**
+*  State pool.
+*  State pool provides possibility to change Always-On state.
+*
+*  @lib PDPContextManager2.lib
+*  @since S60 v3.1
+*/
+class MAOStatePool
+    {
+public:
+
+    /**
+      * Changes to defined state.
+     * New state is returned as a parameter.
+     *
+     * @since 3.1
+     * @param aState: New state
+     * @return TAOState*
+     */
+    virtual TAOState* ChangeState( TAOState::TAOStateName aState ) = 0;
+    
+    /**
+      * Returns current state.
+     *
+     * @since 3.1
+     * @return TAOState* The current state
+     */
+    virtual TAOState* CurrentState() const = 0;
+
+protected:
+    
+    /**
+     * Prohibit destruction
+     *
+     * @since 3.1
+     */
+    virtual ~MAOStatePool(){};
+    };
+
+#endif // M_MAOSTATEPOOL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/maotimer.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,104 @@
+/*
+* Copyright (c) 2004,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:  Defines MAOTimer interface
+*
+*/
+
+
+#ifndef M_MAOTIMER_H
+#define M_MAOTIMER_H
+
+// INCLUDE FILES
+
+// FORWARD DECLARATIONS
+
+/**
+*  Timer interface.
+*
+*  @lib PDPContextManager2.lib
+*  @since S60 v3.1
+*/
+class MAOTimer
+    {
+public:
+
+    /**
+     * Starts retry timer.
+     *
+     * @since S60 v3.1
+     */
+    virtual void StartRetryTimer() = 0;
+
+    /**
+     * Starts connection timer.
+     *
+     * @since S60 v3.1
+     */
+    virtual void StartConnectionTimer() = 0;
+    
+    /**
+     * Stops retry timer.
+     *
+     * @since S60 v3.1
+     */
+    virtual void StopRetryTimer() = 0;
+    
+    /**
+     * Stops connection timer.
+     *
+     * @since S60 v3.1
+     */
+    virtual void StopConnectionTimer() = 0;
+    
+    /**
+     * Starts unconnect timer.
+     *
+     * @since 3.0
+     */
+    virtual void StartUnconnectTimer() = 0;
+    
+    /**
+     * Stops unconnect timer.
+     *
+     * @since 3.0
+     */
+    virtual void StopUnconnectTimer() = 0;
+    
+    /**
+     * Checks if retry timer is set to infinite (disabled).
+     *
+     * @since S60 v3.1
+     * @return ETrue if set to infinite
+     */
+    virtual TBool RetryTimerDisabled() const = 0;
+    
+    /**
+     * Checks if unconnect timer is set to zero (disabled).
+     *
+     * @since 3.0
+     * @return ETrue if set to infinite
+     */
+    virtual TBool UnconnectTimerDisabled() const = 0;
+        
+protected:
+
+    /**
+     * Prohibit destruction
+     *
+     * @since S60 v3.1
+     */
+    virtual ~MAOTimer(){};
+    };
+
+#endif // M_MAOTIMER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/maotimerobserver.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2004,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:  Defines MAOTimerObserver interface
+*
+*/
+
+
+#ifndef M_MAOTIMEROBSERVER_H
+#define M_MAOTIMEROBSERVER_H
+
+// INCLUDE FILES
+
+// FORWARD DECLARATIONS
+
+/**
+*  Timer observer interface.
+*
+*  @lib PDPContextManager2.lib
+*  @since S60 v3.1
+*/
+class MAOTimerObserver
+    {
+public:
+
+    /**
+     * Handles retry timer expiration.
+     *
+     * @since 3.1
+     */
+    virtual void HandleRetryTimerExpiredL() = 0;
+
+    /**
+     * Handles connection timer expiration.
+     *
+     * @since 3.1
+     */
+    virtual void HandleConnectionTimerExpiredL() = 0;
+    
+    /**
+     * Handles unconnect timer expiration.
+     *
+     * @since 3.0
+     */
+    virtual void HandleUnconnectTimerExpiredL() = 0;
+        
+protected:
+
+    /**
+     * Prohibit destruction
+     *
+     * @since 3.1
+     */
+    virtual ~MAOTimerObserver(){};
+    };
+
+#endif // M_MAOTIMEROBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/pdpcontextmanagerinternalpskeys.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2005,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:  Publish & Subscribe keys only for testing
+*
+*/
+
+
+#ifndef PDPCONTEXTMANAGERINTERNALPSKEYS_H
+#define PDPCONTEXTMANAGERINTERNALPSKEYS_H
+
+// NOTE:
+//
+// These PS keys are only internal to PDP context manager and are
+// used only by the stub implementations.
+//
+// USE FOR TESTING PURPOSES ONLY!
+
+// RAU event keys
+const TUid KRAUEventCat = {0x00000001};
+const TUint KRAUGenerateEvent = 1;
+enum
+    {
+    ENormalRAU,
+    EPeriodicalRAU
+    };
+
+// Connection monitor keys
+const TUid KConnectionMonitorCat = {0x00000002};
+const TUint KNetworkRegStatusChange     = 1;
+const TUint KExternalPDPContextCreated  = 2;
+const TUint KNewPDPContextCreated       = 3;
+enum
+    {
+    ENetworkNotRegistered,
+    ENetworkHome,
+    ENeworkRoaming
+    };
+
+// Connection keys
+const TUid KConnectionCat = {0x00000003};
+const TUint KPDPContextActivation       = 1;
+const TUint KPDPContextDisconnection    = 2;
+
+#endif // PDPCONTEXTMANAGERINTERNALPSKEYS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/taostate.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,344 @@
+/*
+* Copyright (c) 2004,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:  State base class.
+*
+*/
+
+
+
+#ifndef T_TAOSTATE_H
+#define T_TAOSTATE_H
+
+// INCLUDE FILES
+#include <e32std.h>
+
+#include "maoconnectionmanager.h"
+
+// FORWARD DECLARATIONS
+class MAOStateContext;
+class MAOStatePool;
+
+// CLASS DESCRIPTION
+
+/**
+ *  State base class.
+ *  New states should derive directly from this.
+ *
+ *  @lib PDPContextManager2.lib
+ *  @since S60 v3.1
+ */
+NONSHARABLE_CLASS( TAOState )
+    {
+public: // Data types
+
+    /**  State name enums */
+    enum TAOStateName
+        {
+        EStateInit = 0,
+        EStateStarting,
+        EStateDisabled,
+        EStateConnecting,
+        EStateConnected,
+        EStateDisconnected,
+        EStateWaiting,
+        EStateUnconnected,
+        EStateResetFactorySettings,
+        EStateExternalConnection,
+        EStateLastItem  // this item used for indicating 
+                        // the number of members of this enum.
+                        // It should be always the last even if the 
+                        // enum extracted.
+        };
+
+public: // Constructors & destructors
+
+    /**
+     * Constructor.
+     *
+     * @since S60 v3.1
+     * @param aStateContext Reference to MAOStateContext
+     * @param aStatePool Reference to MAOStatePool
+     * @return Pointer to created object.
+     */
+    TAOState( MAOStateContext& aStateContext, MAOStatePool& aStatePool );
+    
+public: // New methods
+
+    /**
+     * Returns state name (ID).
+     *
+     * @since S60 v3.1
+     * @return TAOStateName
+     */
+    virtual TAOStateName StateName() const = 0;
+
+    /**
+     * Notification from PDP context activation is received
+     * through this method.
+     *
+     * @since S60 v3.1
+     * @return New state or NULL if state is not
+     *         needed to be changed.
+     */
+    virtual TAOState* HandlePDPContextActivatedL();
+    
+    /**
+     * Notification from PDP context activation failure
+     * is received through this method.
+     *
+     * @since S60 v3.1
+     * @return New state or NULL if state is not
+     *         needed to be changed.
+     */
+    virtual TAOState* HandlePDPContextActivationFailedL();
+    
+    /**
+     * Notification from PDP context disconnect is received
+     * through this method.
+     *
+     * @since S60 v3.1
+     * @param aReason: Disconnect reason
+     * @return New state or NULL if state is not
+     *         needed to be changed.
+     */
+    virtual TAOState* HandlePDPContextDisconnectedL( TInt aReason );
+    
+    /**
+     * Notification from network change is receive through
+     * this method.
+     *
+     * @since S60 v3.1
+     * @param aNetworkType: New network type
+     * @return New state or NULL if state is not
+     *         needed to ba changed.
+     */
+    virtual TAOState* HandleNetworkChangedL(
+        MAOConnectionManager::TNetworkType aNetworkType );
+    
+    /**
+     * Notification from succesful RAU is received
+     * through this method.
+     *
+     * @since S60 v3.1
+     * @return New state or NULL if state is not
+     *         needed to ba changed.
+     */
+    virtual TAOState* HandleSuccesfulRAUEventL();
+
+    /**
+     * Notification from retry timer triggering
+     * is received through this method.
+     *
+     * @since S60 v3.1
+     * @return New state or NULL if state is not
+     *         needed to ba changed.
+     */
+    virtual TAOState* HandleRetryTimerTriggeredL();
+        
+    /**
+     * Notification from connection timer triggering
+     * is received through this method.
+     *
+     * @since S60 v3.1
+     * @return New state or NULL if state is not
+     *         needed to ba changed.
+     */
+    virtual TAOState* HandleConnectionTimerTriggeredL();
+    
+    /**
+     * Notifications from new settings is received through
+     * this method.
+     *
+     * @since S60 v3.1
+     * @return New state or NULL if state is not
+     *         needed to be changed.
+     */
+    virtual TAOState* HandleSettingsReceivedL();
+    
+    /**
+     * Notifications from PDP context data transfer block notification
+     * received through this method.
+     *
+     * @since S60 v3.1
+     * @return New state or NULL if state is not
+     *         needed to be changed.
+     */
+    virtual TAOState* HandlePDPContextTemporarilyBlockedL();
+    
+    /**
+     * Handles error. Always leads to disconnected state.
+     *
+     * @since S60 v3.1
+     * @return TAOStateDisconnected*
+     */
+    virtual TAOState* HandleGeneralError();
+    
+    /**
+     * Handles enable always on request.
+     *
+     * @since S60 v3.1
+     * @return New state or NULL if state is not
+     *         needed to be changed.
+     */
+    virtual TAOState* HandleEnableAlwaysOnL();
+    
+    /**
+     * Changes state from disconnected state.
+     *
+     * @since S60 v3.1
+     * @param aReason: Disconnect reason
+     * @return New state or NULL if state is not
+     *         needed to be changed.
+     */
+    virtual TAOState* HandleSwitchFromDisconnectedL(
+        MAOConnectionManager::TFailureReason aReason );
+        
+    /**
+     * Handles connection deleted notification.
+     *
+     * @since S60 v3.1
+     * @return New state or NULL if state is not
+     *         needed to be changed.
+     */
+    virtual TAOState* HandleConnectionDeletedL();
+    
+    /**
+     * Handles reset factory settings notification.
+     * If this is overridden it must be remembered that
+     * connection MUST be closed after this method has been
+     * called. Otherwise factory resetting will fail.
+     *
+     * @since S60 v3.1
+     * @param aReset: ETrue will indicate reset, EFalse completion of reset
+     * @return New state or NULL if state is not
+     *         needed to be changed.
+     */
+    virtual TAOState* HandleResetFactorySettingsL( TBool aReset );
+        
+    /**
+     * Handles external connection creation notification.
+     *
+     * @since 3.0
+     */
+    virtual TAOState* HandleExternalConnectionCreatedL();
+        
+    /**
+     * Handles unconnect timer trigger notification.
+     *
+     * @since 3.0
+     */
+    virtual TAOState* HandleUnconnectTimerExpiredL();
+        
+protected: // New methods
+
+    /**
+     * Cancels all operations        
+     *
+     * @since S60 v3.1
+     */
+    void CancelAll();
+    
+    /**
+     * Setting a flag
+     *
+     * @since S60 v3.1
+     * @param aFlag flag to set 
+     */
+    inline void SetFlag( TUint aFlag );
+    
+    /**
+     * Clears a flag
+     *
+     * @since S60 v3.1
+     * @param aFlag flag to clear 
+     */
+    inline void ClearFlag( TUint aFlag );
+    
+    /**
+     * Checks if flag is set
+     *
+     * @since S60 v3.1
+     * @param aFlag flag to check
+     * @return ETrue if the checked flag is on else EFalse
+     */
+    inline TBool CheckFlag( TUint aFlag );
+    
+    /**
+     * Clears all flags
+     *
+     * @since S60 v3.1
+     */
+    inline void ClearFlags();
+    
+    /**
+     * Checks if Always On should be enabled
+     *
+     * @since S60 v3.1
+     * @return ETrue if Always On should be enabled else EFalse
+     */
+    TBool EnableAlwaysOn();
+    
+    /**
+     * Cancels all timers
+     *
+     * @since S60 v3.1
+     */
+    void CancelTimers();
+    
+    /**
+     * Sets always on mode to TSY
+     *
+     * @since S60 v3.1
+     */
+    void SetAlwaysOnModeL();
+    
+    /**
+     * Basic handling for connection deletion
+     *
+     * @since S60 v3.1
+     * @return TAOState*
+     */
+    TAOState* DoHandleConnectionDeletedL();
+    
+    /**
+     * Activates PDP context
+     *
+     * @since S60 v3.1
+     * @return TAOState*
+     */
+    TAOState* DoActivatePDPContextL();
+    
+
+protected: // data
+
+    /**
+     * Ref: State context
+     */
+    MAOStateContext& iStateContext;
+    
+    /**
+     * Ref: State pool
+     */
+    MAOStatePool& iStatePool;
+    
+    /**
+     * Internal state flag
+     */
+    TUint iFlags;
+    };
+    
+// inline methods    
+#include "../inl/taostate.inl"
+
+#endif // T_TAOSTATE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/taostateconnected.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,162 @@
+/*
+* Copyright (c) 2004,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:  TAOStateConnected class.
+*
+*/
+
+
+#ifndef T_TAOSTATECONNECTED_H
+#define T_TAOSTATECONNECTED_H
+
+// INCLUDE FILES
+#include "taostate.h"
+
+// FORWARD DECLARATIONS
+class MAOStateContext;
+class MAOStatePool;
+
+// CLASS DESCRIPTION
+
+/**
+ *  Connected state class.
+ *
+ *  @lib PDPContextManager2.lib
+ *  @since S60 v3.1
+ */
+NONSHARABLE_CLASS( TAOStateConnected ): public TAOState
+    {
+public:
+    
+    /**
+     * Constructor.
+     *
+     * @since S60 v3.1
+     * @param aStateContext Reference to MAOStateContext
+     * @param aStatePool Reference to MAOStatePool
+     */
+    TAOStateConnected( MAOStateContext& aStateContext, 
+                       MAOStatePool& aStatePool );
+        
+protected: 
+
+// From base class TAOState
+    
+    /**
+     * From TAOState.
+     * Returns state name (ID).
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOStateName StateName() const;
+
+    /**
+     * From TAOState.
+     * Notification from PDP context disconnect is received
+     * through this method.
+     *
+     * @since S60 v3.1
+     * @param aReason: Disconnect reason
+     */
+    virtual TAOState* HandlePDPContextDisconnectedL( TInt aReason );
+        
+    /**
+     * From TAOState.
+     * Handles connection deleted notification.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandleConnectionDeletedL();
+     
+    // These are ignored in connected state
+
+    /**
+     * From TAOState.
+     * This is ignored in connected state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandlePDPContextActivatedL();
+    
+    /**
+     * From TAOState.
+     * 
+     *
+     * @since S60 v3.2
+     * @param aNetworkType: New network type
+     * @return New state or NULL if state is not
+     *         needed to be changed.
+     */
+    virtual TAOState* HandleNetworkChangedL(
+        MAOConnectionManager::TNetworkType aNetworkType );
+    
+
+    /**
+     * From TAOState.
+     * This is ignored in connected state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandleSuccesfulRAUEventL();
+
+    /**
+     * From TAOState.
+     * This is ignored in connected state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandleRetryTimerTriggeredL();
+
+    /**
+     * From TAOState.
+     * This is ignored in connected state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandleConnectionTimerTriggeredL();
+
+    /**
+     * From TAOState.
+     * This is ignored in connected state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandlePDPContextTemporarilyBlockedL();
+    
+    /**
+     * From TAOState.
+     * This is ignored in connected state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandleGeneralError();
+
+    /**
+     * From TAOState.
+     * This is ignored in connected state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandleEnableAlwaysOnL();
+
+    /**
+     * From TAOState.
+     * This is ignored in connected state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandleSwitchFromDisconnectedL(
+            MAOConnectionManager::TFailureReason /*aReason*/ );
+    };
+
+#endif // T_TAOSTATECONNECTED_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/taostateconnecting.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,167 @@
+/*
+* Copyright (c) 2004,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:  TAOStateConnecting class.
+*
+*/
+
+
+
+#ifndef T_TAOSTATECONNECTING_H
+#define T_TAOSTATECONNECTING_H
+
+// INCLUDE FILES
+#include "taostate.h"
+
+// FORWARD DECLARATIONS
+class MAOStateContext;
+class MAOStatePool;
+
+// CLASS DESCRIPTION
+
+/**
+ *  Connecting state class.
+ *
+ *  @lib PDPContextManager2.lib
+ *  @since S60 v3.1
+ */
+NONSHARABLE_CLASS( TAOStateConnecting ): public TAOState
+    {
+    public: // Constructors & destructors
+    
+    /**
+     * Constructor.
+     *
+     * @since S60 v3.1
+     * @param aStateContext Reference to MAOStateContext
+     * @param aStatePool Reference to MAOStatePool
+     */
+    TAOStateConnecting( MAOStateContext& aStateContext, 
+                        MAOStatePool& aStatePool );
+        
+    protected: 
+    
+// From base class TAOState
+    
+    /**
+     * From TAOState.
+     * Returns state name (ID).
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOStateName StateName() const;
+    
+    /**
+     * From TAOState.
+     * Notification from PDP context activation is received
+     * through this method.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandlePDPContextActivatedL();
+    
+    /**
+     * From TAOState.
+     * Notification from PDP context activation failure
+     * is received through this method.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandlePDPContextActivationFailedL();
+    
+    /**
+     * From TAOState.
+     * Notification from retry timer triggering
+     * is received through this method.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandleConnectionTimerTriggeredL();
+    
+    /**
+     * From TAOState.
+     * Handles connection deleted notification.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandleConnectionDeletedL();
+    
+    // These are ignored in connecting state
+    
+    /**
+     * From TAOState.
+     * This is ignored in connecting state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandlePDPContextDisconnectedL( TInt /*aReason*/ );
+        
+    /**
+     * From TAOState.
+     * This is ignored in connecting state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandleSuccesfulRAUEventL();
+
+    /**
+     * From TAOState.
+     * This is ignored in connecting state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandleRetryTimerTriggeredL();
+    
+    /**
+     * From TAOState.
+     * This is ignored in connecting state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandlePDPContextTemporarilyBlockedL();
+    
+    /**
+     * From TAOState.
+     * This is ignored in connecting state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandleGeneralError();
+    
+    /**
+     * From TAOState.
+     * This is ignored in connecting state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandleEnableAlwaysOnL();
+    
+    /**
+     * From TAOState.
+     * This is ignored in connecting state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandleSwitchFromDisconnectedL(
+        MAOConnectionManager::TFailureReason /*aReason*/ );
+        
+        
+    private:
+    
+    /**
+     * Own: Connection counter
+     */
+    TInt iConnectionCounter;    
+    };
+
+#endif // T_TAOSTATECONNECTING_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/taostatedisabled.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,159 @@
+/*
+* Copyright (c) 2004,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:  Implements the TAOStateDisabled class.
+*
+*/
+
+
+#ifndef T_TAOSTATEDISABLED_H
+#define T_TAOSTATEDISABLED_H
+
+// INCLUDE FILES
+#include "taostate.h"
+
+// FORWARD DECLARATIONS
+class MAOStateContext;
+class MAOStatePool;
+
+// CLASS DESCRIPTION
+
+/**
+*  Disabled state class.
+*
+*  @lib PDPContextManager2.lib
+*  @since S60 v3.1
+*/
+NONSHARABLE_CLASS( TAOStateDisabled ): public TAOState
+    {
+public: // Constructors & destructors
+    
+    /**
+     * Constructor.
+     *
+     * @since S60 v3.1
+     * @param aStateContext Reference to MAOStateContext
+     * @param aStatePool Reference to MAOStatePool
+     */
+    TAOStateDisabled( MAOStateContext& aStateContext, 
+                      MAOStatePool& aStatePool );
+     
+protected: // From base class TAOState
+    
+    /**
+     * From TAOState.
+     * Returns state name (ID).
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOStateName StateName() const;
+        
+    /**
+     * From TAOState.    
+     * Notification from network change is receive through
+     * this method.
+     *
+     * @since S60 v3.1
+     * @param aNetworkType: New network type
+     */
+    virtual TAOState* HandleNetworkChangedL(
+        MAOConnectionManager::TNetworkType aNetworkType );
+
+
+    // These all must be ignored in disabled state.
+ 
+    /**
+     * From TAOState.
+     * This is ignored in disabled state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    TAOState* HandlePDPContextActivatedL();
+
+    /**
+     * From TAOState.
+     * This is ignored in disabled state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    TAOState* HandlePDPContextDisconnectedL( TInt /*aReason*/ );
+
+    /**
+     * From TAOState.
+     * This is ignored in disabled state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    TAOState* HandleSuccesfulRAUEventL();
+
+    /**
+     * From TAOState.
+     * This is ignored in disabled state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    TAOState* HandleRetryTimerTriggeredL();
+
+    /**
+     * From TAOState.
+     * This is ignored in disabled state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    TAOState* HandleConnectionTimerTriggeredL();
+
+    /**
+     * From TAOState.
+     * This is ignored in disabled state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    TAOState* HandlePDPContextTemporarilyBlockedL();
+
+    /**
+     * From TAOState.
+     * This is ignored in disabled state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    TAOState* HandleGeneralError();
+
+    /**
+     * From TAOState.
+     * This is ignored in disabled state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    TAOState* HandleEnableAlwaysOnL();
+
+    /**
+     * From TAOState.
+     * This is ignored in disabled state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     * @param aReason ?
+     */
+    TAOState* HandleSwitchFromDisconnectedL(
+        MAOConnectionManager::TFailureReason /*aReason*/ );
+            
+    /**
+     * From TAOState.
+     * ?
+     *
+     * @since S60 v3.1
+     */
+    TAOState* HandleExternalConnectionCreatedL();
+
+    };
+
+#endif // T_TAOSTATEDISABLED_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/taostatedisconnected.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,153 @@
+/*
+* Copyright (c) 2004,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:  TAOStateDisconnected class.
+*
+*/
+
+
+#ifndef T_TAOSTATEDISCONNECTED_H
+#define T_TAOSTATEDISCONNECTED_H
+
+// INCLUDE FILES
+#include "taostate.h"
+
+// FORWARD DECLARATIONS
+class MAOStateContext;
+class MAOStatePool;
+
+// CLASS DESCRIPTION
+
+/**
+ *  Disconnected state class.
+ *  Disconnected state is only a temporary state where Always On
+ *  changes right away to a different state.
+ *
+ *  @lib PDPContextManager2.lib
+ *  @since S60 v3.1
+ */
+NONSHARABLE_CLASS( TAOStateDisconnected ): public TAOState
+    {
+    public: // Constructors & destructors
+    
+    /**
+     * Constructor.
+     *
+     * @since S60 v3.1
+     * @param aStateContext Reference to MAOStateContext
+     * @param aStatePool Reference to MAOStatePool
+     */
+    TAOStateDisconnected( MAOStateContext& aStateContext, 
+                          MAOStatePool& aStatePool );
+        
+    protected: 
+    
+// From base class TAOState
+    
+    /**
+     * From TAOState.
+     * Returns state name (ID).
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOStateName StateName() const;
+    
+    /**
+     * From TAOState.
+     * Changes state from disconnected state.
+     *
+     * @since S60 v3.1
+     * @param aReason: Disconnect reason
+     */
+    virtual TAOState* HandleSwitchFromDisconnectedL(
+        MAOConnectionManager::TFailureReason aReason );
+        
+    /**
+     * From TAOState.
+     * Handles connection deleted notification.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandleConnectionDeletedL();
+    
+    
+    // These all must be ignored in disconnected state.
+
+    /**
+     * From TAOState.
+     * This is ignored in disconnected state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandlePDPContextActivatedL();
+
+    /**
+     * From TAOState.
+     * This is ignored in disconnected state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandlePDPContextDisconnectedL( TInt /*aReason*/ );
+
+    /**
+     * From TAOState.
+     * This is ignored in disconnected state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandleSuccesfulRAUEventL();
+
+    /**
+     * From TAOState.
+     * This is ignored in disconnected state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandleRetryTimerTriggeredL();
+
+    /**
+     * From TAOState.
+     * This is ignored in disconnected state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandleConnectionTimerTriggeredL();
+
+    /**
+     * From TAOState.
+     * This is ignored in disconnected state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandlePDPContextTemporarilyBlockedL();
+
+    /**
+     * From TAOState.
+     * This is ignored in disconnected state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandleGeneralError();
+
+    /**
+     * From TAOState.
+     * This is ignored in disconnected state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandleEnableAlwaysOnL();
+                
+    protected: // Data
+    };
+
+#endif // T_TAOSTATEDISCONNECTED_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/taostateexternalconnection.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,212 @@
+/*
+* Copyright (c) 2004 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:  TAOStateExternalConnection class.
+*
+*/
+
+
+#ifndef TAOSTATEEXTERNALCONNECTION_H
+#define TAOSTATEEXTERNALCONNECTION_H
+
+// INCLUDE FILES
+#include "taostate.h"
+
+// FORWARD DECLARATIONS
+class MAOStateContext;
+class MAOStatePool;
+
+// CLASS DESCRIPTION
+
+/**
+*  External connection state class.
+*
+*  @lib PDPContextManager2.lib
+*  @since S60 v3.1
+*/
+NONSHARABLE_CLASS( TAOStateExternalConnection ): public TAOState
+	{
+	public: // Constructors & destructors
+	
+    /**
+     * Constructor.
+     *
+     * @since S60 v3.1
+     * @param aStateContext Reference to MAOStateContext
+     * @param aStatePool Reference to MAOStatePool
+     */
+    TAOStateExternalConnection(
+            MAOStateContext& aStateContext,
+            MAOStatePool& aStatePool );
+        
+    protected: // From base class TAOState
+    
+    /**
+     * From TAOState.
+     * Returns state name (ID).
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOStateName StateName() const;
+        
+    /**
+     * Handles connection deleted notification.
+     *
+     * @since S60 v3.1
+     * @return New state or NULL if state is not needed to be changed.
+     */
+    virtual TAOState* HandleConnectionDeletedL();
+		
+    /**
+     * Handles reset factory settings notification.
+     * If this is overridden it must be remembered that
+     * connection MUST be closed after this method has been
+     * called. Otherwise factory resetting will fail.
+     *
+     * @since S60 v3.1
+     * @return New state or NULL if state is not needed to be changed.
+     */
+    virtual TAOState* HandleResetFactorySettingsL( TBool aReset );
+        
+    // These all must be ignored in external connection settings state.
+    // Though in real device these are impossible to receive.
+
+    /**
+     * From TAOState.
+     * This is ignored in external connection setting state. 
+     * Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandlePDPContextActivatedL();
+
+    /**
+     * From TAOState.
+     * This is ignored in external connection setting state. 
+     * Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandlePDPContextActivationFailedL();
+
+    /**
+     * From TAOState.
+     * This is ignored in external connection setting state. 
+     * Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandlePDPContextDisconnectedL( TInt /*aReason*/ );
+
+    /**
+     * From TAOState.
+     * This is ignored in external connection setting state. 
+     * Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+	virtual TAOState* HandleNetworkChangedL(
+		    MAOConnectionManager::TNetworkType /*aNetworkType*/ );
+
+    /**
+     * From TAOState.
+     * This is ignored in external connection setting state. 
+     * Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandleSuccesfulRAUEventL();
+
+    /**
+     * From TAOState.
+     * This is ignored in external connection setting state. 
+     * Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandleRetryTimerTriggeredL();
+
+    /**
+     * From TAOState.
+     * This is ignored in external connection setting state. 
+     * Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+	virtual TAOState* HandleConnectionTimerTriggeredL();
+	
+	    /**
+     * From TAOState.
+     * This is ignored in external connection state. Always returns NULL.
+     *
+     * @since S60 v3.2
+     */
+    virtual TAOState* HandleSettingsReceivedL();
+
+    /**
+     * From TAOState.
+     * This is ignored in external connection setting state. 
+     * Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandlePDPContextTemporarilyBlockedL();
+
+    /**
+     * From TAOState.
+     * This is ignored in external connection setting state. 
+     * Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandleGeneralError();
+
+    /**
+     * From TAOState.
+     * This is ignored in external connection setting state. 
+     * Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandleEnableAlwaysOnL();
+
+    /**
+     * From TAOState.
+     * This is ignored in external connection setting state. 
+     * Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandleSwitchFromDisconnectedL(
+		    MAOConnectionManager::TFailureReason /*aReason*/ );
+
+    /**
+     * From TAOState.
+     * This is ignored in external connection setting state. 
+     * Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandleExternalConnectionCreatedL();
+
+    /**
+     * From TAOState.
+     * This is ignored in external connection setting state. 
+     * Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandleUnconnectTimerExpiredL();
+	};
+
+#endif // TAOSTATEEXTERNALCONNECTION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/taostateinit.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,181 @@
+/*
+* Copyright (c) 2004,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:  TAOStateInit class.
+*
+*/
+
+
+#ifndef T_TAOSTATEINIT_H
+#define T_TAOSTATEINIT_H
+
+// INCLUDE FILES
+#include "taostate.h"
+
+// FORWARD DECLARATIONS
+class MAOStateContext;
+class MAOStatePool;
+
+// CLASS DESCRIPTION
+
+/**
+ *  Init state class.
+ *
+ *  @lib PDPContextManager2.lib
+ *  @since S60 v3.1
+ */
+NONSHARABLE_CLASS( TAOStateInit ): public TAOState
+    {
+protected: // Data types
+    
+    /** Internal state flags */
+    enum TInitStateFlag
+        {
+        ENone                   = 0x00,
+        ESettingsReceived       = 0x01,
+        ENWRegistrationReceived = 0x02
+        };
+    
+public: // Constructors & destructors
+    
+    /**
+     * Constructor.
+     *
+     * @since S60 v3.1
+     * @param aStateContext Reference to MAOStateContext
+     * @param aStatePool Reference to MAOStatePool
+     */
+    TAOStateInit( MAOStateContext& aStateContext, 
+                  MAOStatePool& aStatePool );
+        
+protected: 
+    
+// From base class TAOState
+    
+    /**
+     * From TAOState.
+     * Returns state name (ID).
+     *
+     * @since S60 v3.1
+     */
+    TAOStateName StateName() const;
+    
+    /**
+     * From TAOState.
+     * Notification from network change is receive through
+     * this method.
+     *
+     * @since S60 v3.1
+     * @param aNetworkType: New network type
+     */    
+    TAOState* HandleNetworkChangedL(
+        MAOConnectionManager::TNetworkType aNetworkType );
+        
+    /**
+     * From TAOState.
+     * Notifications from new settings is received through
+     * this method.
+     *
+     * @since S60 v3.1
+     * @return New state or NULL if state is not
+     *         needed to be changed.
+     */
+    TAOState* HandleSettingsReceivedL();
+    
+    // These all must be ignored in init state.
+    // Though in real device these are impossible to receive.
+
+    /**
+     * From TAOState.
+     * This is ignored in init state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    TAOState* HandlePDPContextActivatedL();
+        
+    /**
+     * From TAOState.
+     * This is ignored in init state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    TAOState* HandlePDPContextDisconnectedL( TInt /*aReason*/ );
+
+    /**
+     * From TAOState.
+     * This is ignored in init state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    TAOState* HandleSuccesfulRAUEventL();
+
+    /**
+     * From TAOState.
+     * This is ignored in init state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    TAOState* HandleRetryTimerTriggeredL();
+
+    /**
+     * From TAOState.
+     * This is ignored in init state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    TAOState* HandleConnectionTimerTriggeredL();
+
+    /**
+     * From TAOState.
+     * This is ignored in init state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    TAOState* HandlePDPContextTemporarilyBlockedL();
+
+    /**
+     * From TAOState.
+     * This is ignored in init state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    TAOState* HandleGeneralError();
+
+    /**
+     * From TAOState.
+     * This is ignored in init state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    TAOState* HandleEnableAlwaysOnL();
+
+    /**
+     * From TAOState.
+     * This is ignored in init state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    TAOState* HandleSwitchFromDisconnectedL(
+        MAOConnectionManager::TFailureReason /*aReason*/ );
+
+    /**
+     * From TAOState.
+     * ?
+     *
+     * @since S60 v3.1
+     */         
+    TAOState* HandleExternalConnectionCreatedL();
+    
+    };
+
+#endif // T_TAOSTATEINIT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/taostateresetfactorysettings.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,199 @@
+/*
+* Copyright (c) 2004,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:  TAOStateResetFactorySettings class.
+*
+*/
+
+
+#ifndef T_TAOSTATERESETFACTORYSETTINGS_H
+#define T_TAOSTATERESETFACTORYSETTINGS_H
+
+// INCLUDE FILES
+#include "taostate.h"
+
+// FORWARD DECLARATIONS
+class MAOStateContext;
+class MAOStatePool;
+
+// CLASS DESCRIPTION
+
+/**
+*  Reset factory settings state class.
+*
+*  @lib PDPContextManager2.lib
+*  @since S60 v3.1
+*/
+NONSHARABLE_CLASS( TAOStateResetFactorySettings ): public TAOState
+    {
+public: // Constructors & destructors
+    
+    /**
+     * Constructor.
+     *
+     * @since S60 v3.1
+     * @param aStateContext Reference to MAOStateContext
+     * @param aStatePool Reference to MAOStatePool
+     */
+    TAOStateResetFactorySettings( MAOStateContext& aStateContext,
+                                  MAOStatePool& aStatePool );
+        
+protected: // From base class TAOState
+    
+    /**
+     * From TAOState.
+     * Returns state name (ID).
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOStateName StateName() const;
+        
+    /**
+     * Handles reset factory settings notification.
+     * If this is overridden it must be remembered that
+     * connection MUST be closed after this method has been
+     * called. Otherwise factory resetting will fail.
+     *
+     * @since S60 v3.1
+     * @param aReset: ETrue will indicate reset, EFalse completion of reset
+     */
+    virtual TAOState* HandleResetFactorySettingsL( TBool aReset );
+    
+    // These all must be ignored in reset factory settings state.
+    // Though in real device these are impossible to receive.
+
+    /**
+     * From TAOState.
+     * This is ignored in reset factory setting state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandlePDPContextActivatedL();
+            
+    /**
+     * From TAOState.
+     * This is ignored in reset factory setting state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandlePDPContextActivationFailedL();
+
+    /**
+     * From TAOState.
+     * This is ignored in reset factory setting state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandlePDPContextDisconnectedL( TInt aReason );
+
+    /**
+     * From TAOState.
+     * This is ignored in reset factory setting state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandleNetworkChangedL(
+        MAOConnectionManager::TNetworkType /*aNetworkType*/ );
+
+    /**
+     * From TAOState.
+     * This is ignored in reset factory setting state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandleSuccesfulRAUEventL();
+
+    /**
+     * From TAOState.
+     * This is ignored in reset factory setting state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandleRetryTimerTriggeredL();
+
+    /**
+     * From TAOState.
+     * This is ignored in reset factory setting state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandleConnectionTimerTriggeredL();
+
+    /**
+     * From TAOState.
+     * This is ignored in reset factory setting state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandleSettingsReceivedL();
+
+    /**
+     * From TAOState.
+     * This is ignored in reset factory setting state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandlePDPContextTemporarilyBlockedL();
+
+    /**
+     * From TAOState.
+     * This is ignored in reset factory setting state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandleGeneralError();
+
+    /**
+     * From TAOState.
+     * This is ignored in reset factory setting state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandleEnableAlwaysOnL();
+
+    /**
+     * From TAOState.
+     * This is ignored in reset factory setting state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandleSwitchFromDisconnectedL(
+        MAOConnectionManager::TFailureReason aReason );
+
+    /**
+     * From TAOState.
+     * This is ignored in reset factory setting state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandleConnectionDeletedL();
+    
+    /**
+     * From TAOState.
+     * ?
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandleExternalConnectionCreatedL();
+    
+    /**
+     * From TAOState.
+     * ?
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandleUnconnectTimerExpiredL();
+
+    };
+
+#endif // T_TAOSTATERESETFACTORYSETTINGS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/taostatestarting.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,158 @@
+/*
+* Copyright (c) 2004,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:  TAOStateStarting class.
+*
+*/
+
+
+#ifndef T_TAOSTATESTARTING_H
+#define T_TAOSTATESTARTING_H
+
+// INCLUDE FILES
+#include "taostate.h"
+
+// FORWARD DECLARATIONS
+class MAOStateContext;
+class MAOStatePool;
+
+// CLASS DESCRIPTION
+
+/**
+ *  Starting state class.
+ *  Currently starting state is just a phase for moving either to
+ *  disabled or connecting state.
+ *
+ *  @lib PDPContextManager2.lib
+ *  @since S60 v3.1
+ */
+NONSHARABLE_CLASS( TAOStateStarting ): public TAOState
+    {
+public: // Constructors & destructors
+    
+    /**
+     * Constructor.
+     *
+     * @since S60 v3.1
+     * @param aStateContext Reference to MAOStateContext
+     * @param aStatePool Reference to MAOStatePool
+     */
+    TAOStateStarting( MAOStateContext& aStateContext, 
+                      MAOStatePool& aStatePool );
+        
+protected: // From base class TAOState
+    
+    /**
+     * From TAOState.
+     * Returns state name (ID).
+     *
+     * @since S60 v3.1
+     */
+    TAOStateName StateName() const;
+    
+    // These all must be ignored in starting state.
+    // @see TAOState
+
+    /**
+     * From TAOState.
+     * This is ignored in starting state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    TAOState* HandleNetworkChangedL(
+        MAOConnectionManager::TNetworkType /*aNetworkType*/ );
+
+    /**
+     * From TAOState.
+     * This is ignored in starting state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    TAOState* HandleSettingsReceivedL();
+    
+    /**
+     * From TAOState.
+     * This is ignored in starting state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    TAOState* HandlePDPContextActivatedL();
+    
+    /**
+     * From TAOState.
+     * This is ignored in starting state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    TAOState* HandlePDPContextDisconnectedL( TInt /*aReason*/ );
+    
+    /**
+     * From TAOState.
+     * This is ignored in starting state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    TAOState* HandleSuccesfulRAUEventL();
+    
+    /**
+     * From TAOState.
+     * This is ignored in starting state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    TAOState* HandleRetryTimerTriggeredL();
+    
+    /**
+     * From TAOState.
+     * This is ignored in starting state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    TAOState* HandleConnectionTimerTriggeredL();
+    
+    /**
+     * From TAOState.
+     * This is ignored in starting state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    TAOState* HandlePDPContextTemporarilyBlockedL();
+    
+    /**
+     * From TAOState.
+     * This is ignored in starting state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    TAOState* HandleGeneralError();
+    
+    /**
+     * From TAOState.
+     * This is ignored in starting state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    TAOState* HandleSwitchFromDisconnectedL(
+        MAOConnectionManager::TFailureReason /*aReason*/ );
+    
+    /**
+     * From TAOState.
+     * ?
+     *
+     * @since S60 v3.1
+     */        
+    TAOState* HandleExternalConnectionCreatedL();
+
+    };
+
+#endif // T_TAOSTATESTARTING_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/taostateunconnected.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,165 @@
+/*
+* Copyright (c) 2004,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:  TAOStateUnconnected class.
+*
+*/
+
+
+#ifndef T_TAOSTATEUNCONNECTED_H
+#define T_TAOSTATEUNCONNECTED_H
+
+// INCLUDE FILES
+#include "taostate.h"
+
+// FORWARD DECLARATIONS
+class MAOStateContext;
+class MAOStatePool;
+
+// CLASS DESCRIPTION
+
+/**
+*  Unconnected state class.
+*
+*  @lib PDPContextManager2.lib
+*  @since S60 v3.1
+*/
+NONSHARABLE_CLASS( TAOStateUnconnected ): public TAOState
+    {
+public: // Constructors & destructors
+    
+    /**
+     * Constructor.
+     *
+     * @since S60 v3.1
+     * @param aStateContext Reference to MAOStateContext
+     * @param aStatePool Reference to MAOStatePool
+     * @return Pointer to created object.
+     */
+    TAOStateUnconnected( MAOStateContext& aStateContext, 
+                         MAOStatePool& aStatePool );
+        
+protected: 
+
+// From base class TAOState
+    
+    /**
+     * From TAOState.
+     * Returns state name (ID).
+     *
+     * @since S60 v3.1
+     */
+    TAOStateName StateName() const;
+
+    /**
+     * From TAOState.
+     * Handles connection deleted notification.
+     *
+     * @since S60 v3.1
+     */
+    TAOState* HandleConnectionDeletedL();
+    
+    /**
+     * Handles unconnect timer trigger notification.
+     *
+     * @since 3.0
+     */
+    TAOState* HandleUnconnectTimerExpiredL();
+    
+    // These must be ignored in unconnected state        
+    // @see TAOState
+    
+    /**
+     * From TAOState.
+     * This is ignored in unconnected state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    TAOState* HandlePDPContextActivatedL();
+
+    /**
+     * From TAOState.
+     * This is ignored in unconnected state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    TAOState* HandlePDPContextActivationFailedL();
+
+    /**
+     * From TAOState.
+     * This is ignored in unconnected state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    TAOState* HandlePDPContextDisconnectedL( TInt /*aReason*/ );
+
+    /**
+     * From TAOState.
+     * This is ignored in unconnected state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    TAOState* HandleRetryTimerTriggeredL();
+
+    /**
+     * From TAOState.
+     * This is ignored in unconnected state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    TAOState* HandleConnectionTimerTriggeredL();
+
+    /**
+     * From TAOState.
+     * This is ignored in unconnected state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    TAOState* HandlePDPContextTemporarilyBlockedL();
+
+    /**
+     * From TAOState.
+     * This is ignored in unconnected state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    TAOState* HandleGeneralError();
+
+    /**
+     * From TAOState.
+     * This is ignored in unconnected state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    TAOState* HandleEnableAlwaysOnL();
+
+    /**
+     * From TAOState.
+     * This is ignored in unconnected state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    TAOState* HandleSwitchFromDisconnectedL(
+        MAOConnectionManager::TFailureReason /*aReason*/ );
+            
+    /**
+     * From TAOState.
+     * ?
+     *
+     * @since S60 v3.1
+     */        
+    TAOState* HandleExternalConnectionCreatedL();
+
+    };
+
+#endif // T_TAOSTATEUNCONNECTED_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/inc/taostatewaiting.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,168 @@
+/*
+* Copyright (c) 2004,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:  TAOStateWaiting class.
+*
+*/
+
+
+#ifndef T_TAOSTATEWAITING_H
+#define T_TAOSTATEWAITING_H
+
+// INCLUDE FILES
+#include "taostate.h"
+
+// FORWARD DECLARATIONS
+class MAOStateContext;
+class MAOStatePool;
+
+// CLASS DESCRIPTION
+
+/**
+ *  Waiting state class.
+ *
+ *  @lib PDPContextManager2.lib
+ *  @since S60 v3.1
+ */
+NONSHARABLE_CLASS( TAOStateWaiting ): public TAOState
+    {
+public: // Constructors & destructors
+    
+    /**
+     * Constructor.
+     *
+     * @since S60 v3.1
+     * @param aStateContext Reference to MAOStateContext
+     * @param aStatePool Reference to MAOStatePool
+     * @return Pointer to created object.
+     */
+    TAOStateWaiting( MAOStateContext& aStateContext, 
+                     MAOStatePool& aStatePool );
+        
+protected: // New methods
+    
+    /**
+     * Do PDP context activation
+     *
+     * @return
+     */
+    virtual TAOState* DoActivatePDPContextL();
+
+protected: 
+
+// From base class TAOState
+    
+    /**
+     * From TAOState.
+     * Returns state name (ID).
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOStateName StateName() const;
+    
+    /**
+     * From TAOState.
+     * Notification from succesful RAU is received
+     * through this method.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandleSuccesfulRAUEventL();
+            
+    /**
+     * From TAOState.
+     * Notification from retry timer triggering
+     * is received through this method.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandleRetryTimerTriggeredL();
+    
+    /**
+     * From TAOState.
+     * Handles connection deleted notification.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandleConnectionDeletedL();
+    
+    // These all must be ignored in waiting state.
+    // @see TAOState
+
+    /**
+     * From TAOState.
+     * This is ignored in waiting state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandlePDPContextActivatedL();
+
+    /**
+     * From TAOState.
+     * This is ignored in waiting state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandlePDPContextActivationFailedL();
+
+    /**
+     * From TAOState.
+     * This is ignored in waiting state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandlePDPContextDisconnectedL( TInt /*aReason*/ );
+
+    /**
+     * From TAOState.
+     * This is ignored in waiting state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandleConnectionTimerTriggeredL();
+
+    /**
+     * From TAOState.
+     * This is ignored in waiting state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandlePDPContextTemporarilyBlockedL();
+
+    /**
+     * From TAOState.
+     * This is ignored in waiting state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandleGeneralError();
+
+    /**
+     * From TAOState.
+     * This is ignored in waiting state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandleEnableAlwaysOnL();
+
+    /**
+     * From TAOState.
+     * This is ignored in waiting state. Always returns NULL.
+     *
+     * @since S60 v3.1
+     */
+    virtual TAOState* HandleSwitchFromDisconnectedL(
+        MAOConnectionManager::TFailureReason /*aReason*/ );
+    };
+
+#endif // T_TAOSTATEWAITING_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/inl/taostate.inl	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,54 @@
+/*
+* 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:  Inline function implementations for TAOState 
+*
+*/
+
+
+// ---------------------------------------------------------------------------
+// Setting a flag
+// ---------------------------------------------------------------------------
+//
+inline void TAOState::SetFlag( TUint aFlag )
+    {
+    iFlags |= aFlag;
+    }
+
+// ---------------------------------------------------------------------------
+// Clears the flag
+// ---------------------------------------------------------------------------
+//
+inline void TAOState::ClearFlag( TUint aFlag )
+    {
+    iFlags &= ~aFlag;
+    }
+
+// ---------------------------------------------------------------------------
+// Checks if flag is set
+// ---------------------------------------------------------------------------
+//
+inline TBool TAOState::CheckFlag( TUint aFlag )
+    {
+    return iFlags & aFlag;
+    }
+    
+// ---------------------------------------------------------------------------
+// Clears all flags
+// ---------------------------------------------------------------------------
+//
+inline void TAOState::ClearFlags()
+    {
+    iFlags = 0;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/rom/pdpcontextmanager2.iby	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef PDPCONTEXTMANAGER2_IBY
+#define PDPCONTEXTMANAGER2_IBY
+
+#ifdef __ALWAYS_ONLINE_PDPCONTEXT2
+
+ECOM_PLUGIN(PDPCONTEXTMANAGER2.DLL,10281F41.rsc)
+
+#endif //__ALWAYS_ONLINE_PDPCONTEXT2
+
+#endif //PDPCONTEXTMANAGER2_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/src/10281f41.rss	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2002 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 <Ecom/RegistryInfo.rh>
+
+RESOURCE REGISTRY_INFO theInfo
+	{
+	// PDPContextManager2.dll UID
+	dll_uid = 0x10281F41;
+	interfaces = 
+		{
+		INTERFACE_INFO
+			{
+			// CEComInterface interface UID
+			interface_uid = 0x101F85EC;
+			implementations = 
+				{
+				IMPLEMENTATION_INFO
+					{
+					// AlwaysOnlineManager implementation UID
+					implementation_uid = 0x10281F42;
+					version_no = 1;
+					display_name = "PDP context ECom Plugin for always online manager";
+					default_data = "PDPContextManager2";
+					// Note : opaque_data MUST have @ least a single byte of data
+					// in this instance it is an empty string.
+					opaque_data = " ";
+					}
+				// Place additional interface implementations here
+				};
+			}
+		// Place additional interfaces here
+		};
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/src/alwaysonlinepdpplugin.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,122 @@
+/*
+* Copyright (c) 2004,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:  Implements the CAlwaysOnlineEComInterface interface
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32std.h>
+#include <ecom/implementationproxy.h>
+#include <AlwaysOnlineManagerCommon.h>
+
+#include "alwaysonlinepdpplugin.h"
+#include "caoserver.h"
+
+#include "alwaysonconfig.hrh"
+#include "logger.h"
+
+
+#define KPDPContextManager2ImplUid 0x10281F42
+
+//    METHODS
+
+// ---------------------------------------------------------------------------
+// CAlwaysOnlinePDPPlugin::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CAlwaysOnlinePDPPlugin* CAlwaysOnlinePDPPlugin::NewL()
+    {
+    LOG_1( _L("||-- LOGGING STARTS --||") );
+    LOG_1( _L("CAlwaysOnlinePDPPlugin:: NewL") );
+
+    CAlwaysOnlinePDPPlugin* self = new( ELeave ) CAlwaysOnlinePDPPlugin;
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CAlwaysOnlinePDPPlugin::~CAlwaysOnlinePDPPlugin
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CAlwaysOnlinePDPPlugin::~CAlwaysOnlinePDPPlugin()
+    {
+    delete iAlwaysOnServer;
+    }
+
+// ---------------------------------------------------------------------------
+// CAlwaysOnlinePDPPlugin::CAlwaysOnlinePDPPlugin
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CAlwaysOnlinePDPPlugin::CAlwaysOnlinePDPPlugin():
+    CAlwaysOnlineEComInterface()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CAlwaysOnlinePDPPlugin::ConstructL
+// Symbian 2nd phase constructor
+// ---------------------------------------------------------------------------
+//
+void CAlwaysOnlinePDPPlugin::ConstructL()
+    {
+    LOG_1( _L("CAlwaysOnlinePDPPlugin:: ConstructL") );
+    iAlwaysOnServer = CAOServer::NewL();
+    }
+
+// ---------------------------------------------------------------------------
+// CAlwaysOnlinePDPPlugin::HandleServerCommandL
+// Handles the events coming from the Always Online Server
+// ---------------------------------------------------------------------------
+//
+TAny* CAlwaysOnlinePDPPlugin::HandleServerCommandL(
+    TInt /*aCommand*/,
+    TDesC8* /*aParameters*/ )
+    {
+    return static_cast<TAny*>( KErrNone );
+    }
+
+// ---------------------------------------------------------------------------
+// Exported proxy for instantiation method resolution
+// Use the plugin UID and Implementation factory method
+// as a pair for ECom instantiation.
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] =
+    {
+    IMPLEMENTATION_PROXY_ENTRY(
+        KPDPContextManager2ImplUid,
+        ( TProxyNewLPtr )CAlwaysOnlinePDPPlugin::NewL )
+    };
+
+// ---------------------------------------------------------------------------
+// Give the table to the caller
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( 
+                                             TInt& aTableCount )
+    {
+    aTableCount = sizeof( ImplementationTable ) / 
+                  sizeof( ImplementationTable[0] );
+    return ImplementationTable;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/src/caoconnection.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,134 @@
+/*
+* Copyright (c) 2004,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:  Implements the CAOConnection class
+*
+*/
+
+
+// INCLUDE FILES
+#include "caoconnection.h"
+#include "caoconnectionimpl.h"
+#include "logger.h"
+
+// METHODS
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CAOConnection* CAOConnection::NewL(
+    MAOConnectionObserver& aObserver,
+    MAOSettings&           aSettings,
+    RSocketServ*           aSocketServ
+     )
+    {
+    LOG_1( _L("CAOConnection::NewL") );
+    
+    CAOConnection* self = new( ELeave ) CAOConnection();
+    
+    CleanupStack::PushL( self );
+    self->ConstructL( aObserver, aSettings, aSocketServ );
+    CleanupStack::Pop( self );
+    
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CAOConnection::~CAOConnection()
+    {
+    LOG_1( _L("CAOConnection::~CAOConnection") );
+
+    delete iConnectionImpl; 
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnection::ActivateConnection
+// ---------------------------------------------------------------------------
+//
+void CAOConnection::ActivateConnection()
+    {
+    LOG_1( _L("CAOConnection::ActivateConnection") );
+
+    iConnectionImpl->ActivateConnection();      
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnection::CancelConnection
+// ---------------------------------------------------------------------------
+//
+void CAOConnection::CancelConnection()
+    {
+    LOG_1( _L("CAOConnection::CancelConnection") );
+    
+    iConnectionImpl->CancelConnection();
+    }
+    
+// ---------------------------------------------------------------------------
+// CAOConnection::CloseConnection
+// ---------------------------------------------------------------------------
+//
+void CAOConnection::CloseConnection()
+    {
+    LOG_1( _L("CAOConnection::CloseConnection") );
+    
+    iConnectionImpl->CloseConnection();
+    }    
+
+// ---------------------------------------------------------------------------
+// CAOConnection::IsConnectedToDefaultIAP
+// ---------------------------------------------------------------------------
+//
+TBool CAOConnection::IsConnectedToDefaultIAP()
+    {
+    LOG_1( _L("CAOConnection::IsConnectedToDefaultIAP" ) );
+    
+    return iConnectionImpl->IsConnectedToDefaultIAP();
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnection::NumberOfConnections
+// ---------------------------------------------------------------------------
+//
+TInt CAOConnection::NumberOfConnections()
+    {
+    LOG_1( _L("CAOConnection::NumberOfConnections" ) );
+    
+    return iConnectionImpl->NumberOfConnections();
+    }
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CAOConnection::CAOConnection()
+    {
+    LOG_1( _L("CAOConnection::CAOConnection") );
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor
+// ---------------------------------------------------------------------------
+//
+void CAOConnection::ConstructL(
+    MAOConnectionObserver& aObserver,
+    MAOSettings&           aSettings,
+    RSocketServ*           aSocketServ )
+    {
+    LOG_1( _L("CAOConnection::ConstructL") );
+    
+    iConnectionImpl = CAOConnectionImpl::NewL( aObserver, aSettings, aSocketServ );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/src/caoconnectionimpl.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,653 @@
+/*
+* Copyright (c) 2004,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:  Implements the CAOConnectionImpl class
+*
+*/
+
+
+// INCLUDE FILES
+#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include <es_enum_partner.h>
+#endif
+#include <es_enum.h>
+#include <etelpckt.h>
+#include <in_sock.h>
+
+#include "caoconnectionimpl.h"
+#include "maosettings.h"
+#include "logger.h"
+#include "maoconnectionobserver.h"
+
+// UNNAMED NAMESPACE FOR LOCAL DEFINITIONS
+namespace
+    {
+    // CONSTANTS
+    _LIT( KPanicCat, "ConnectionImpl" );
+    
+    // Default value that indicates that we do not want to prompt user for IAP
+    const TCommDbDialogPref KDlgPreference = ECommDbDialogPrefDoNotPrompt;
+    
+    // DATA TYPES
+    enum TPanicCode
+        {
+        ENone,
+        EConnectionAlreadyActive,
+        ENotActive,
+        EInvalidState,
+        EAlreadyActive,
+        EReuqestNotPending
+        };
+    
+    // LOCAL FUNCTIONS
+    LOCAL_C void Panic( TPanicCode aCode )
+        {
+        User::Panic( KPanicCat, aCode );
+        }
+    }
+
+// METHODS
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CAOConnectionImpl* CAOConnectionImpl::NewL(
+    MAOConnectionObserver& aObserver,
+    MAOSettings&           aSettings,
+    RSocketServ*           aSocketServ )
+    {
+    LOG_1( _L("CAOConnectionImpl::NewL") );
+    
+    CAOConnectionImpl* self = new( ELeave ) CAOConnectionImpl(
+        aObserver,
+        aSettings,
+        aSocketServ );
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+        
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CAOConnectionImpl::~CAOConnectionImpl()
+    {
+    LOG_1( _L("CAOConnectionImpl::~CAOConnectionImpl") );
+    
+    Cancel();
+    
+    delete iCommsDatabase;
+    iConnection.Close();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CAOConnectionImpl::ActivateConnection
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionImpl::ActivateConnection()
+    {
+    LOG_1( _L("CAOConnectionImpl::ActivateConnection") );
+        
+    __ASSERT_DEBUG( !IsActive() && iState == EDisconnected,
+        Panic( EConnectionAlreadyActive ) );
+        
+    // Change state to EOpeningLink
+    ChangeState( EOpeningLink );
+    
+    // Check IAP
+    TUint iap = iSettings.AccessPointId();
+    if ( IsValidIAP( iap ) )
+        {
+        // Check that we really have RConnection handle opened
+        TInt err = KErrNone;
+        if( !iConnection.SubSessionHandle() )
+            {
+            // Socket serv is closed only in destructor
+            err = iConnection.Open( *iSocketServ );
+            }
+    
+        if( err == KErrNone )
+            {
+			// Set acces point settings
+			iAccessPointSettings.SetIapId( iap );
+			iAccessPointSettings.SetDialogPreference( KDlgPreference );
+        
+			// Start connection
+    		iConnection.Start( iAccessPointSettings, iStatus );
+			SetActive();
+            }
+        else
+            {
+            ActivateSelf( KErrNotSupported );
+            }
+        }
+    else
+        {
+        // Something is wrong. Complete self with error KErrNotSupported ->
+        // leads to permanent failure.
+        ActivateSelf( KErrNotSupported );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionImpl::CancelConnection
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionImpl::CancelConnection()
+    {
+    LOG_1( _L("CAOConnectionImpl::CancelConnection") );
+    Cancel();
+    LOG_2( _L("CAOConnectionImpl::CancelConnection: Cur. state: %d"),
+        iState );
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionImpl::IsConnectedToDefaultIAP
+// ---------------------------------------------------------------------------
+//
+TBool CAOConnectionImpl::IsConnectedToDefaultIAP()
+    {
+    LOG_1( _L("CAOConnectionImpl::IsConnectedToDefaultIAP") );
+    
+    // Check if we have PDP context open to default IAP
+    TBool connected = EFalse;
+    TUint connectionCount = 0;
+    TInt err = iConnection.EnumerateConnections( connectionCount );
+    if ( err == KErrNone )
+        {
+        TPckgBuf<TConnectionInfoV2> connectionInfo;
+        for ( TInt i = 0; i < connectionCount; i++ )
+            {
+            err = iConnection.GetConnectionInfo( i + 1, connectionInfo );
+            if ( err == KErrNone )
+                {
+                if ( connectionInfo().iIapId == iSettings.AccessPointId() )
+                    {
+                    LOG_1( _L("CAOConnectionImpl::IsConnectedToDefaultIAP: \
+                               Connected to default IAP") );
+                    connected = ETrue;
+                    break;
+                    }
+                }
+            }
+        }
+        
+    LOG_2( _L("CAOConnectionImpl::IsConnectedToDefaultIAP: Connected: %d "),
+        connected );
+        
+    return connected;
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionImpl::NumberOfConnections
+// ---------------------------------------------------------------------------
+//
+TInt CAOConnectionImpl::NumberOfConnections()
+    {
+    LOG_1( _L("CAOConnectionImpl::NumberOfConnections") );
+    
+    TUint connectionCount = 0;
+    TInt err = iConnection.EnumerateConnections( connectionCount );
+    if( err != KErrNone )
+        {
+        connectionCount = 0;
+        }
+    LOG_2( _L("> Number of connections: %d"), connectionCount );
+        
+    return static_cast<TInt>( connectionCount );
+    }
+    
+// ---------------------------------------------------------------------------
+// CAOConnectionImpl::CloseConnection
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionImpl::CloseConnection()
+    {
+    LOG_1( _L("CAOConnectionImpl::CloseConnection") );
+    
+    if ( iState == EListeningAccessPoint )
+        {
+        if ( IsActive() )
+            {
+            iConnection.CancelProgressNotification();	
+            }
+        	
+    	iConnection.Close();
+        
+        // To really close: re-open
+        TInt err = iConnection.Open( *iSocketServ );
+        LOG_2( _L("> Re-opened connection handle: Err: %d"), err );
+
+        ChangeState( EDisconnected );
+        }
+    }
+        
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CAOConnectionImpl::CAOConnectionImpl(
+                                      MAOConnectionObserver& aObserver,
+                                      MAOSettings&           aSettings,
+                                      RSocketServ*           aSocketServ ):
+    CActive( CActive::EPriorityStandard ),
+    iObserver( aObserver ),
+    iSettings( aSettings ),
+    iSocketServ( aSocketServ ),
+    iState( EDisconnected )
+    {
+    LOG_1( _L("CAOConnectionImpl::CAOConnectionImpl") );
+    
+    CActiveScheduler::Add( this );
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionImpl::ConstructL()
+    {
+    LOG_1( _L("CAOConnectionImpl::ConstructL") );
+    
+    User::LeaveIfError( iConnection.Open( *iSocketServ, KAfInet ) );
+    iCommsDatabase = CCommsDatabase::NewL( EDatabaseTypeUnspecified );
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionImpl::IsValidIAP
+// ---------------------------------------------------------------------------
+//
+TBool CAOConnectionImpl::IsValidIAP( TUint32 aId ) const
+    {
+    LOG_1( _L("CAOConnectionImpl::IsValidIAP") );
+    
+    CCommsDbTableView* table = NULL;
+    
+    // E32USER Cbase panic 79 is raised if OpenViewMatchingUintLC does not
+    // leave inside trap. Therefore pop table out from cleanup stack before
+    // exiting from TRAP harness.
+    TRAPD( error, table = iCommsDatabase->OpenViewMatchingUintLC(
+        TPtrC( IAP ),
+        TPtrC( COMMDB_ID ),
+        aId );
+        CleanupStack::Pop( table ) );
+    
+    if ( error == KErrNone )
+        {
+        error = table->GotoFirstRecord();
+        }
+    delete table;
+    
+    return error == KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionImpl::CompleteSelf
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionImpl::CompleteSelf( TRequestStatus& aStatus, TInt aReason )
+    {
+    LOG_1( _L("CAOConnectionImpl::CompleteSelf") );
+    
+    __ASSERT_DEBUG( IsActive(), Panic( ENotActive ) );
+    __ASSERT_DEBUG( aStatus == KRequestPending, Panic( EReuqestNotPending ) );
+    
+    TRequestStatus* status = &aStatus;
+    User::RequestComplete( status, aReason );
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionImpl::HandleOpeningLinkL
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionImpl::HandleOpeningLinkL( TInt aStatus )
+    {
+    LOG_1( _L("CAOConnectionImpl::HandleOpeningLinkL") );
+    
+    if ( aStatus == KErrNone )
+        {
+        // First check current status
+        TInt err = iConnection.Progress( iProgressBuf() );
+        if ( err == KErrNone && iProgressBuf().iError == KErrNone )
+            {
+            IssueProgressNotification();
+            if ( iProgressBuf().iStage == KLinkLayerOpen )
+                {
+                // Link open
+                ChangeState( EListeningAccessPoint );
+                iObserver.HandlePDPContextActivatedL();
+                }
+            }
+        else
+            {
+            BrodcastActivationFailedError( err );
+            }
+        }
+    else
+        {
+        BrodcastActivationFailedError( aStatus );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionImpl::HandleListeningAccessPointL
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionImpl::HandleListeningAccessPointL( TInt aStatus )
+    {
+    LOG_1( _L("CAOConnectionImpl::HandleListeningAccessPointL") );
+    LOG_2( _L("> aStatus: %d"), aStatus );
+    LOG_2( _L("> iProgressBuf().iError: %d"), iProgressBuf().iError );
+    
+    if ( aStatus == KErrNone && iProgressBuf().iError == KErrNone )
+        {
+        // Check connection status
+        switch ( iProgressBuf().iStage )
+            {
+            case KLinkLayerClosed:
+                {
+                LOG_1( _L("> Link closed") );
+                
+                // Connection disconnected
+                // Stop connection just in case
+                StopConnection();
+                
+                // Notify and change state
+                BrodcastDisconnectedError( KErrDisconnected );
+                break;
+                }
+            case KLinkLayerOpen:
+                {
+                LOG_1( _L("> Link open") );
+                
+                // everything ok -> continue listening
+                IssueProgressNotification();
+                break;
+                }
+            case KDataTransferTemporarilyBlocked:
+                {
+                LOG_1( _L("> Link temporarily blocked") );
+                
+                // Data transfer temporarily blocked
+                // Continue listening and notify
+                IssueProgressNotification();
+                iObserver.HandlePDPContextTemporarilyBlockedL();
+                break;
+                }
+            case KConnectionClosed:
+                {
+                LOG_1( _L("> Connection closed") );
+                    
+                // Notify and change state
+                BrodcastDisconnectedError( KErrDisconnected );
+                break;
+                }                
+            default:
+                {
+                LOG_2( _L("iProgressBuf().iStage: %d"),
+                        iProgressBuf().iStage );
+                
+                // Just continue listening
+                IssueProgressNotification();
+                break;
+                }
+            }
+        }
+    else
+        {
+        // Handle error
+        BrodcastDisconnectedError( aStatus );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionImpl::ChangeState
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionImpl::ChangeState( TInternalState aNewState )
+    {
+#ifdef LOGGING_ENABLED
+    TInternalState old = iState;
+    iState = aNewState;
+    LOG_3( _L("CAOConnectionImpl::ChangeState >> Changing state %d -> %d"),
+        old, iState );
+#else
+    iState = aNewState;
+#endif // LOGGING_ENABLED
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionImpl::IssueProgressNotification
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionImpl::IssueProgressNotification()
+    {
+    LOG_1( _L("CAOConnectionImpl::IssueProgressNotification") );
+    
+    __ASSERT_DEBUG( !IsActive(), Panic( EConnectionAlreadyActive ) );
+    
+    iConnection.ProgressNotification( iProgressBuf, iStatus );
+    SetActive();
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionImpl::BrodcastDisconnectedError
+// ---------------------------------------------------------------------------
+//
+#ifdef LOGGING_ENABLED
+void CAOConnectionImpl::BrodcastDisconnectedError( TInt aError )
+#else
+void CAOConnectionImpl::BrodcastDisconnectedError( TInt /*aError*/ )
+#endif
+    {
+    LOG_2( _L("CAOConnectionImpl::BrodcastDisconnectedError: aError: %d"),
+           aError );
+    
+    ChangeState( EDisconnected );
+    TRAP_IGNORE( iObserver.HandlePDPContextDisconnectedL(
+        MAOConnectionManager::EDisconnected ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionImpl::BrodcastActivationFailedError
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionImpl::BrodcastActivationFailedError( TInt aError )
+    {
+    LOG_2( _L("CAOConnectionImpl::BrodcastActivationFailedError: aError: %d"),
+        aError );
+    
+    ChangeState( EDisconnected );
+    TRAP_IGNORE( iObserver.HandlePDPContextActivationFailedL(
+        FailureReason( aError ) ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionImpl::FailureReason
+// ---------------------------------------------------------------------------
+//
+MAOConnectionManager::TFailureReason CAOConnectionImpl::FailureReason(
+    TInt aError )
+    {
+    LOG_2( _L("CAOConnectionImpl::FailureReason: aError: %d"), aError );
+    
+    // Determine error cause
+    MAOConnectionManager::TFailureReason reason =
+        MAOConnectionManager::EPermanent;
+    switch ( aError )
+        {
+        // Temporary cause
+        case KErrGprsUserAuthenticationFailure:
+        case KErrGprsActivationRejectedByGGSN:
+        case KErrGprsActivationRejected:
+        case KErrGprsServiceOptionTemporarilyOutOfOrder:
+        case KErrConnectionTerminated:
+            {
+            LOG_1( _L("> Temporary failure") );
+            reason = MAOConnectionManager::ETemporary;
+            break;
+            }
+        // Permanent cause
+        default:
+            {
+            LOG_1( _L("> Permanent failure") );
+            reason = MAOConnectionManager::EPermanent;
+            break;
+            }
+        }
+        
+    LOG_2( _L("CAOConnectionImpl::FailureReason: Reason: %d"), reason );
+            
+    return reason;
+    }
+    
+// ---------------------------------------------------------------------------
+// CAOConnectionImpl::ActivateSelf
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionImpl::ActivateSelf( TInt aReason )
+    {
+    LOG_2( _L("CAOConnectionImpl::ActivateSelf: aReason: %d"), aReason );
+    
+    __ASSERT_DEBUG( !IsActive(), Panic( EAlreadyActive ) );
+    
+    iStatus = KRequestPending;
+    SetActive();
+    CompleteSelf( iStatus, aReason );
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionImpl::StopConnection
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionImpl::StopConnection()
+    {
+    LOG_1( _L("CAOConnectionImpl::StopConnection") );
+    
+    TInt err = iConnection.Stop( RConnection::EStopAuthoritative );
+    LOG_2( _L("> Stopped connection: Err: %d"), err );
+    
+    iConnection.Close();
+    LOG_1( _L("> Closed connection handle") );
+    
+    err = iConnection.Open( *iSocketServ );
+    LOG_2( _L("> Re-opened connection handle: Err: %d"), err );
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// CAOConnectionImpl::RunL
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionImpl::RunL()
+    {
+    LOG_2( _L("CAOConnectionImpl::RunL: iStatus: %d"), iStatus.Int() );
+    
+    TInt status = iStatus.Int();
+    switch ( iState )
+        {
+        case EDisconnected:
+            {
+            // nothing to do
+            break;
+            }
+        case EOpeningLink:
+            {
+            HandleOpeningLinkL( status );
+            break;
+            }
+        case EListeningAccessPoint:
+            {
+            HandleListeningAccessPointL( status );
+            break;
+            }
+        default:
+            {
+            LOG_1( _L("CAOConnectionImpl::RunL >> Invalid state!") );
+            Panic( EInvalidState );
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionImpl::DoCancel
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionImpl::DoCancel()
+    {
+    LOG_1( _L("CAOConnectionImpl::DoCancel") );
+    
+    TInternalState currentState = iState;
+    ChangeState( EDisconnected );
+    switch ( currentState )
+        {
+        case EDisconnected:
+            {
+            // Nothing to do
+            break;
+            }
+        case EOpeningLink:
+        case EListeningAccessPoint:
+            {
+            // Ignore error code since there is nothing that can be done if
+            // these fail
+            iConnection.CancelProgressNotification();
+            StopConnection();
+            break;
+            }
+        default:
+            {
+            LOG_1( _L("CAOConnectionImpl::DoCancel >> Invalid state!") );
+            Panic( EInvalidState );
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionImpl::RunError
+// ---------------------------------------------------------------------------
+//
+TInt CAOConnectionImpl::RunError( TInt aError )
+    {
+    LOG_2( _L("CAOConnectionImpl::RunError: aError: %d"), aError );
+    
+    switch ( iState )
+        {
+        case EDisconnected:
+        case EOpeningLink:
+        case EListeningAccessPoint:
+            {
+            BrodcastDisconnectedError( aError );
+            break;
+            }
+        default:
+            {
+            LOG_1( _L("CAOConnectionImpl::RunError >> Invalid state!") );
+            Panic( EInvalidState );
+            break;
+            }
+        }
+    ChangeState( EDisconnected );
+    
+    return KErrNone;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/src/caoconnectionimplstub.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,624 @@
+/*
+* Copyright (c) 2004,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:  Implements the CAOConnectionImpl class
+*
+*/
+
+
+// INCLUDE FILES
+#include <es_enum.h>
+#include <ETELPCKT.H>
+#include <in_sock.h>
+
+#include "caoconnectionimplstub.h"
+#include "logger.h"
+#include "maoconnectionobserver.h"
+#include "pdpcontextmanagerinternalpskeys.h"
+#include "caoasyncwrapper.h"
+
+// UNNAMED NAMESPACE FOR LOCAL DEFINITIONS
+namespace
+    {
+    // CONSTANTS
+    _LIT( KPanicCat, "ConnImplStub" );
+    const TInt KDelay = 2000000; // 2 seconds
+    
+    // DATA TYPES
+    enum TPanicReason
+        {
+        EAlreadyConnected,
+        ENotActive,
+        EInvalidState
+        };
+    
+    // LOCAL FUNCTIONS
+    LOCAL_C void Panic( TPanicReason aReason )
+        {
+        User::Panic( KPanicCat, aReason );
+        }
+    }
+
+// METHODS
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CAOConnectionImpl* CAOConnectionImpl::NewL(
+    MAOConnectionObserver& aObserver,
+    MAOSettings&           aSettings,
+    RSocketServ*           aSocketServ  )
+    {
+    LOG_1( _L("CAOConnectionImpl::NewL") );
+    
+    CAOConnectionImpl* self = new( ELeave ) CAOConnectionImpl(
+        aObserver,
+        aSettings,
+        aSocketServ );
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self ); // self
+    
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CAOConnectionImpl::~CAOConnectionImpl()
+    {
+    LOG_1( _L("CAOConnectionImpl::~CAOConnectionImpl") );
+    
+    Cancel();
+    delete iConnectionTimer;
+    
+    delete iPDPContextActivationSubscriber;
+    iPDPContextActivationProperty.Delete(
+        KConnectionCat,
+        KPDPContextActivation );
+    iPDPContextActivationProperty.Close();
+    
+    delete iPDPContextDisconnectionSubscriber;
+    iPDPContextDisconnectionProperty.Delete(
+        KConnectionCat,
+        KPDPContextDisconnection );
+    iPDPContextDisconnectionProperty.Close();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CAOConnectionImpl::ActivateConnection
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionImpl::ActivateConnection()
+    {
+    LOG_1( _L("CAOConnectionImpl::ActivateConnection") );
+    
+    __ASSERT_DEBUG( !IsActive() && iState == EDisconnected,
+        Panic( EAlreadyConnected ) );
+
+    // Change state -> EOpeningLink
+    ChangeState( EOpeningLink );
+    
+    // Activate connection
+    DoActivateConnection();
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionImpl::AttachToExistingConnection
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionImpl::AttachToExistingConnection( TUint /*aConnectionId*/ )
+    {
+    LOG_1( _L("CAOConnectionImpl::AttachToExistingConnection") );
+         
+    __ASSERT_DEBUG( !IsActive() && iState == EDisconnected,
+        Panic( EAlreadyConnected ) );
+        
+    // Change state -> EAttachingExistingConnection
+    ChangeState( EAttachingExistingConnection );
+    
+    // Activate connection
+    DoActivateConnection();
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionImpl::CancelConnection
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionImpl::CancelConnection()
+    {
+    LOG_1( _L("CAOConnectionImpl::CancelConnection") );
+    
+    Cancel();
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionImpl::IsConnectedToDefaultIAP
+// ---------------------------------------------------------------------------
+//
+TBool CAOConnectionImpl::IsConnectedToDefaultIAP()
+    {
+    LOG_1( _L("CAOConnectionImpl::IsConnectedToDefaultIAP") );
+    
+    return iState != EDisconnected;
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionImpl::NumberOfConnections
+// ---------------------------------------------------------------------------
+//
+TInt CAOConnectionImpl::NumberOfConnections()
+    {
+    LOG_1( _L("CAOConnectionImpl::NumberOfConnections") );
+    
+    return 0;
+    }
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CAOConnectionImpl::CAOConnectionImpl(
+    MAOConnectionObserver& aObserver,
+    MAOSettings&           aSettings,
+    RSocketServ*           aSocketServ  ):
+    CActive( CActive::EPriorityStandard ),
+    iObserver( aObserver ),
+    iSettings( aSettings ),
+    iSocketServ( aSocketServ )
+    {
+    LOG_1( _L("CAOConnectionImpl::CAOConnectionImpl") );
+    
+    CActiveScheduler::Add( this );
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionImpl::ConstructL()
+    {
+    LOG_1( _L("CAOConnectionImpl::ConstructL") );
+    
+    iConnectionTimer = CPeriodic::NewL( CActive::EPriorityStandard );
+    
+    // Define PDP context activation property
+    User::LeaveIfError( iPDPContextActivationProperty.Define(
+        KConnectionCat,
+        KPDPContextActivation,
+        RProperty::EInt ) );
+    User::LeaveIfError( iPDPContextActivationProperty.Attach(
+        KConnectionCat,
+        KPDPContextActivation ) );
+    iPDPContextActivationSubscriber =
+        CAOAsyncWrapper<CAOConnectionImpl>::NewL(
+            this,
+            PDPContextActivationIssueRequest,
+            PDPContextActivationRunL,
+            PDPContextActivationDoCancel,
+            NULL );
+    SubscribePDPContextActivation();
+
+    // Define PDP context activation property
+    User::LeaveIfError( iPDPContextDisconnectionProperty.Define(
+        KConnectionCat,
+        KPDPContextDisconnection,
+        RProperty::EInt ) );
+    User::LeaveIfError( iPDPContextDisconnectionProperty.Attach(
+        KConnectionCat,
+        KPDPContextDisconnection ) );
+    iPDPContextDisconnectionSubscriber =
+        CAOAsyncWrapper<CAOConnectionImpl>::NewL(
+            this,
+            PDPContextDisconnectionIssueRequest,
+            PDPContextDisconnectionRunL,
+            PDPContextDisconnectionDoCancel,
+            NULL );
+    SubscribePDPContextDisconnection();
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionImpl::ChangeState
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionImpl::ChangeState( TInternalState aNewState )
+    {
+    TInternalState old = iState;
+    iState = aNewState;
+    LOG_3( _L("CAOConnectionImpl::ChangeState >> Changing state %d -> %d"),
+        old, iState );
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionImpl::CompleteSelf
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionImpl::CompleteSelf( TRequestStatus& aStatus, TInt aReason )
+    {
+    LOG_2( _L("CAOConnectionImpl::CompleteSelf: aReason: %d"), aReason );
+    
+    __ASSERT_DEBUG( IsActive(), Panic( ENotActive ) );
+    
+    aStatus = KRequestPending;
+    TRequestStatus* status = &aStatus;
+    User::RequestComplete( status, aReason );
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionImpl::ConnectionCallBack
+// ---------------------------------------------------------------------------
+//
+TInt CAOConnectionImpl::ConnectionCallBack( TAny* aSelf )
+    {
+    LOG_1( _L("CAOConnectionImpl::ConnectionCallBack") );
+    
+    CAOConnectionImpl* self = static_cast<CAOConnectionImpl*>( aSelf );
+    TRAPD( err, self->HandleConnectionCallBackL() );
+    
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionImpl::HandleConnectionCallBackL
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionImpl::HandleConnectionCallBackL()
+    {
+    LOG_1( _L("CAOConnectionImpl::HandleConnectionCallBackL") );
+    
+    iConnectionTimer->Cancel();
+    CompleteSelf( iStatus, iActivationError );
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionImpl::DoActivateConnection
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionImpl::DoActivateConnection()
+    {
+    LOG_1( _L("CAOConnectionImpl::DoActivateConnection") );
+    
+    TCallBack cb( ConnectionCallBack, this );
+    iConnectionTimer->Start( KDelay, KDelay, cb );
+    iStatus = KRequestPending;
+    SetActive();
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionImpl::HandleOpeningLinkL
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionImpl::HandleOpeningLinkL( TInt aStatus )
+    {
+    LOG_2( _L("CAOConnectionImpl::HandleOpeningLinkL: aStatus: %d"),
+            aStatus );
+    
+    if ( aStatus == KErrNone )
+        {
+        // Everything ok - Link opened
+        BroadcastPDPContextActivatedL();
+        }
+    else
+        {
+        // Report error
+        BroadcastPDPContextActivationFailureL( aStatus );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionImpl::FailureReason
+// ---------------------------------------------------------------------------
+//
+MAOConnectionManager::TFailureReason CAOConnectionImpl::FailureReason(
+    TInt aError )
+    {
+    LOG_2( _L("CAOConnectionImpl::FailureReason: aError: %d"), aError );
+    
+    // Determine error cause
+    MAOConnectionManager::TFailureReason reason =
+        MAOConnectionManager::EPermanent;
+    switch ( aError )
+        {
+        // Temporary cause
+        case KErrGprsUserAuthenticationFailure:
+        case KErrGprsActivationRejectedByGGSN:
+        case KErrGprsActivationRejected:
+        case KErrGprsServiceOptionTemporarilyOutOfOrder:
+            {
+            reason = MAOConnectionManager::ETemporary;
+            break;
+            }
+        // Permanent cause
+        default:
+            {
+            reason = MAOConnectionManager::EPermanent;
+            break;
+            }
+        }
+        
+    LOG_2( _L("CAOConnectionImpl::FailureReason: Reason: %d"), reason );
+            
+    return reason;
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionImpl::HandleListeningAccessPointL
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionImpl::HandleListeningAccessPointL( TInt aStatus )
+    {
+    LOG_2( _L("CAOConnectionImpl::HandleListeningAccessPointL: aStatus: %d"),
+        aStatus );
+    
+    if ( aStatus == KErrNone )
+        {
+        // Everything ok - Continue listening
+        iStatus = KRequestPending;
+        SetActive();
+        }
+    else
+        {
+        // Report error
+        BroadcastPDPContextDisconnectionL( aStatus );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionImpl::BroadcastPDPContextActivationFailureL
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionImpl::BroadcastPDPContextActivationFailureL( TInt aError )
+    {
+    LOG_2( _L("CAOConnectionImpl::BroadcastPDPContextActivationFailureL: \
+        aError: %d"), aError );
+    
+    ChangeState( EDisconnected );
+    iObserver.HandlePDPContextActivationFailedL(
+        FailureReason( aError ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionImpl::BroadcastPDPContextActivationFailureL
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionImpl::BroadcastPDPContextDisconnectionL( TInt aError )
+    {
+    LOG_2( _L("CAOConnectionImpl::BroadcastPDPContextDisconnectionL: \
+        aError: %d"), aError );
+        
+    ChangeState( EDisconnected );
+    iObserver.HandlePDPContextDisconnectedL(
+        MAOConnectionManager::ETemporary );
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionImpl::HandleAttachingExistingConnectionL
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionImpl::HandleAttachingExistingConnectionL( TInt aStatus )
+    {
+    LOG_2( _L("CAOConnectionImpl::HandleAttachingExistingConnectionL:\
+        aStatus: %d"), aStatus );
+    
+    if ( aStatus == KErrNone )
+        {
+        // Broadcast PDP context activated
+        BroadcastPDPContextActivatedL();
+        }
+    else
+        {
+        // Report error
+        BroadcastPDPContextActivationFailureL( aStatus );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionImpl::SubscribePDPContextActivation
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionImpl::SubscribePDPContextActivation()
+    {
+    LOG_1( _L("CAOConnectionImpl::SubscribePDPContextActivation") );
+
+    iPDPContextActivationSubscriber->IssueRequest();
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionImpl::PDPContextActivationIssueRequest
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionImpl::PDPContextActivationIssueRequest(
+    TRequestStatus& aStatus )
+    {
+    LOG_1( _L("CAOConnectionImpl::PDPContextActivationIssueRequest") );
+    
+    iPDPContextActivationProperty.Subscribe( aStatus );
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionImpl::PDPContextActivationRunL
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionImpl::PDPContextActivationRunL( TInt aStatus )
+    {
+    LOG_1( _L("CAOConnectionImpl::PDPContextActivationIssueRequest") );
+    
+    if ( aStatus == KErrNone )
+        {
+        TInt value = 0;
+        TInt err = iPDPContextActivationProperty.Get( value );
+        if ( err == KErrNone )
+            {
+            iActivationError = value;
+            if ( IsActive() &&
+                ( iState == EOpeningLink || 
+                  iState == EAttachingExistingConnection ) )
+                {
+                CompleteSelf( iStatus, iActivationError );
+                }
+            }
+        }
+    SubscribePDPContextActivation();
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionImpl::PDPContextActivationDoCancel
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionImpl::PDPContextActivationDoCancel()
+    {
+    LOG_1( _L("CAOConnectionImpl::PDPContextActivationDoCancel") );
+    
+    iPDPContextActivationProperty.Cancel();
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionImpl::SubscribePDPContextDisconnection
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionImpl::SubscribePDPContextDisconnection()
+    {
+    LOG_1( _L("CAOConnectionImpl::SubscribePDPContextDisconnection") );
+    
+    iPDPContextDisconnectionSubscriber->IssueRequest();
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionImpl::PDPContextDisconnectionIssueRequest
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionImpl::PDPContextDisconnectionIssueRequest(
+    TRequestStatus& aStatus )
+    {
+    LOG_1( _L("CAOConnectionImpl::PDPContextDisconnectionIssueRequest") );
+    
+    iPDPContextDisconnectionProperty.Subscribe( aStatus );
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionImpl::PDPContextDisconnectionRunL
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionImpl::PDPContextDisconnectionRunL( TInt aStatus )
+    {
+    LOG_2( _L("CAOConnectionImpl::PDPContextDisconnectionRunL: aStatus: %d"),
+        aStatus );
+    
+    if ( aStatus == KErrNone )
+        {
+        TInt value = 0;
+        TInt err = iPDPContextDisconnectionProperty.Get( value );
+        if ( err == KErrNone )
+            {
+            iDisconnectionError = value;
+            if ( IsActive() && iState == EListeningAccessPoint )
+                {
+                CompleteSelf( iStatus, iDisconnectionError );
+                }
+            }
+        }
+    SubscribePDPContextDisconnection();
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionImpl::PDPContextDisconnectionDoCancel
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionImpl::PDPContextDisconnectionDoCancel()
+    {
+    LOG_1( _L("CAOConnectionImpl::PDPContextDisconnectionIssueRequest") );
+    
+    iPDPContextDisconnectionProperty.Cancel();
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionImpl::BroadcastPDPContextActivatedL
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionImpl::BroadcastPDPContextActivatedL()
+    {
+    LOG_1( _L("CAOConnectionImpl::BroadcastPDPContextActivatedL") );
+    
+    ChangeState( EListeningAccessPoint );
+    iStatus = KRequestPending;
+    SetActive();
+    iObserver.HandlePDPContextActivatedL();
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionImpl::RunL
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionImpl::RunL()
+    {
+    LOG_2( _L("CAOConnectionImpl::RunL: iStatus: %d"), iStatus.Int() );
+
+    TInt status = iStatus.Int();
+    switch ( iState )
+        {
+        case EDisconnected:
+            {
+            // Nothing to do
+            break;
+            }
+        case EOpeningLink:
+            {
+            HandleOpeningLinkL( status );
+            break;
+            }
+        case EListeningAccessPoint:
+            {
+            HandleListeningAccessPointL( status );
+            break;
+            }
+        case EAttachingExistingConnection:
+            {
+            HandleAttachingExistingConnectionL( status );
+            break;
+            }
+        default:
+            {
+            // Should not be here
+            Panic( EInvalidState );
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionImpl::DoCancel
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionImpl::DoCancel()
+    {
+    LOG_1( _L("CAOConnectionImpl::DoCancel") );
+    
+    ChangeState( EDisconnected );
+    CompleteSelf( iStatus, KErrCancel );
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionImpl::RunError
+// ---------------------------------------------------------------------------
+//
+TInt CAOConnectionImpl::RunError( TInt aError )
+    {
+    LOG_1( _L("CAOConnectionImpl::RunError") );
+    
+    return aError;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/src/caoconnectionmanager.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,464 @@
+/*
+* Copyright (c) 2004,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:  Implements the CAOConnectionManager class
+*
+*/
+
+// INCLUDE FILES
+#include "caoconnectionmanager.h"
+#include "logger.h"
+#include "caoconnection.h"
+#include "caoconnectionmonitor.h"
+#include "maoconnectionmanagerobserver.h"
+
+// METHODS
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CAOConnectionManager* CAOConnectionManager::NewL(
+    MAOConnectionManagerObserver& aObserver,
+    MAOSettings& aSettings )
+    {
+    LOG_1( _L("CAOConnectionManager::NewL") );
+    
+    CAOConnectionManager* self = new( ELeave ) 
+        CAOConnectionManager( aObserver, aSettings );
+    
+    CleanupStack::PushL( self );
+    self->ConstructL( aSettings );
+    CleanupStack::Pop( self );
+    
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CAOConnectionManager::~CAOConnectionManager()
+    {
+    LOG_1( _L("CAOConnectionManager::~CAOConnectionManager") );
+    
+    for ( TInt i=0; i < iLingerArray.Count(); i++ )
+        {
+        delete iLingerArray[ i ];    
+        }
+    
+    iLingerArray.Reset();
+    iLingerArray.Close();
+            
+    delete iConnectionMonitor;
+    delete iConnection;
+    iSocketServ.Close();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CAOConnectionManager::FetchNetworkRegistrationStatus
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionManager::FetchNetworkRegistrationStatus()
+    {
+    LOG_1( _L("CAOConnectionManager::FetchNetworkRegistrationStatus") );
+    
+    iConnectionMonitor->FetchNetworkRegistrationStatus();
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionManager::ActivatePDPContext
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionManager::ActivatePDPContextL()
+    {
+    LOG_1( _L("CAOConnectionManager::ActivatePDPContextL") );
+    
+    iConnection->ActivateConnection();
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionManager::IsPDPContextActive
+// ---------------------------------------------------------------------------
+//
+TBool CAOConnectionManager::IsPDPContextActive() const
+    {
+    LOG_1( _L("CAOConnectionManager::IsPDPContextActive") );
+    
+    return iConnection->IsConnectedToDefaultIAP();
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionManager::CloseConnection
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionManager::CloseConnection()
+    {
+    LOG_1( _L("CAOConnectionManager::CloseConnection") );
+    
+    iConnection->CancelConnection();
+    }
+    
+// ---------------------------------------------------------------------------
+// CAOConnectionManager::DetachConnection
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionManager::DetachConnection()
+    {
+    LOG_1( _L("CAOConnectionManager::DetachConnection") );
+    
+    iConnection->CloseConnection();
+    }    
+
+// ---------------------------------------------------------------------------
+// CAOConnectionManager::NetworkType
+// ---------------------------------------------------------------------------
+//
+MAOConnectionManager::TNetworkType CAOConnectionManager::NetworkType() const
+    {
+    LOG_1( _L("CAOConnectionManager::NetworkType") );
+    
+    MAOConnectionManager::TNetworkType nwType = ENotRegistered;
+    switch ( iConnectionMonitor->NetworkRegistration() )
+        {
+        case CTelephony::ERegisteredOnHomeNetwork:
+            {
+            nwType = EHPLMN;
+            break;
+            }
+        case CTelephony::ERegisteredRoaming:
+            {
+            nwType = EVPLMN;
+            break;
+            }
+        default:
+            {
+            // Other types are considered as not registered.
+            break;
+            }
+        }
+    LOG_2( _L("CAOConnectionManager::NetworkType: NWType: %d"),
+        nwType );
+    
+    return nwType;
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionManager::NumberOfConnections
+// ---------------------------------------------------------------------------
+//
+TInt CAOConnectionManager::NumberOfConnections()
+    {
+    LOG_1( _L("CAOConnectionManager::NumberOfConnections") );
+    
+    TInt numOfConnections = iConnection->NumberOfConnections();
+    LOG_2( _L("> Connection count: %d"), numOfConnections );
+    
+    return numOfConnections;
+    }
+    
+// ---------------------------------------------------------------------------
+// CAOConnectionManager::HandleSettingsChangedL
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionManager::HandleSettingsChangedL()
+    {
+    LOG_1( _L("CAOConnectionManager::HandleSettingsChangedL") );
+    
+       
+    // Check if always-on iap should stop linger
+    for ( TInt i=0; i < iLingerArray.Count(); i++ )
+        {
+        if  ( iLingerArray[ i ]->IapId() == iSettings.AccessPointId() )
+            {
+            // Always-on IAP
+            if ( IsAlwaysOnEnabled() )
+                {	
+                iLingerArray[ i ]->StopLinger();    
+                }
+            else
+                {
+                iLingerArray[ i ]->HandleSettingsChanged();	
+                }	     
+            }
+        else
+            {
+            // common IAP
+            iLingerArray[ i ]->HandleSettingsChanged();    
+            }    
+        }    
+    }    
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CAOConnectionManager::CAOConnectionManager(
+                                        MAOConnectionManagerObserver& aObserver,
+                                        MAOSettings& aSettings ):
+    iObserver( aObserver ),
+    iSettings( aSettings )
+    {
+    LOG_1( _L("CAOConnectionManager::CAOConnectionManager") );
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionManager::ConstructL( MAOSettings& aSettings )
+    {
+    LOG_1( _L("CAOConnectionManager::ConstructL") );
+    
+    User::LeaveIfError( iSocketServ.Connect() );
+     
+    iConnection = CAOConnection::NewL( *this, aSettings, &iSocketServ );
+    iConnectionMonitor = CAOConnectionMonitor::NewL( *this, aSettings );
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionManager::IsAlwaysOnEnabled()
+// ---------------------------------------------------------------------------
+//
+TBool CAOConnectionManager::IsAlwaysOnEnabled()
+    {
+    LOG_1( _L("CAOConnectionManager::IsAlwaysOnEnabled") );
+    
+    TBool alwaysOnEnabled( EFalse );
+        
+    MAOConnectionManager::TNetworkType nwType = NetworkType();
+    
+    if ( nwType == MAOConnectionManager::EHPLMN )
+        {
+        if ( iSettings.AlwaysOnSupportedInHPLMN() )
+            {
+            alwaysOnEnabled = ETrue;
+            }
+        }
+    else if ( nwType == MAOConnectionManager::EVPLMN )
+        {
+        if ( iSettings.AlwaysOnSupportedInVPLMN() )
+            {
+            alwaysOnEnabled = ETrue;
+            }
+        }
+    else
+        {
+        alwaysOnEnabled = EFalse;    
+        }
+            
+    return alwaysOnEnabled;     
+    }
+       
+// ---------------------------------------------------------------------------
+// CAOConnectionManager::HandlePDPContextActivatedL
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionManager::HandlePDPContextActivatedL()
+    {
+    LOG_1( _L("CAOConnectionManager::HandlePDPContextActivatedL") );
+    
+    iObserver.HandlePDPContextActivatedL();
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionManager::HandlePDPContextActivationFailedL
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionManager::HandlePDPContextActivationFailedL(
+    MAOConnectionManager::TFailureReason aReason )
+    {
+    LOG_1( _L("CAOConnectionManager::HandlePDPContextActivationFailedL") );
+    
+    iObserver.HandlePDPContextActivationFailedL( aReason );
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionManager::HandlePDPContextDisconnectedL
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionManager::HandlePDPContextDisconnectedL(
+    MAOConnectionManager::TFailureReason aReason )
+    {
+    LOG_1( _L("CAOConnectionManager::HandlePDPContextDisconnectedL") );
+    
+    iObserver.HandlePDPContextDisconnectedL( aReason );
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionManager::HandlePDPContextTemporarilyBlockedL
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionManager::HandlePDPContextTemporarilyBlockedL()
+    {
+    LOG_1( _L("CAOConnectionManager::HandlePDPContextTemporarilyBlockedL") );
+    
+    iObserver.HandlePDPContextTemporarilyBlockedL();
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionManager::HandleNWRegistrationStatusChangedL
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionManager::HandleNWRegistrationStatusChangedL(
+    CTelephony::TRegistrationStatus aNetworkRegistration )
+    {
+    LOG_1( _L("CAOConnectionManager::HandleNWRegistrationStatusChangedL") );
+    
+    MAOConnectionManager::TNetworkType nwType = NetworkType();
+                 
+    // Check if always-on iap should start/stop linger
+    for ( TInt i=0; i < iLingerArray.Count(); i++ )
+        {
+        if  ( iLingerArray[ i ]->IapId() == iSettings.AccessPointId() )
+            {
+            if ( IsAlwaysOnEnabled() )
+                {
+                iObserver.HandleNWRegistrationStatusChangedL( aNetworkRegistration );	
+                iLingerArray[ i ]->StopLinger();
+                return;    
+                }
+            else if ( nwType != MAOConnectionManager::ENotRegistered )
+                {
+                iLingerArray[ i ]->StartLinger();
+                iObserver.HandleNWRegistrationStatusChangedL( aNetworkRegistration );
+                return;	
+                }
+                	    
+            break; 
+            }
+        }
+        
+    iObserver.HandleNWRegistrationStatusChangedL( aNetworkRegistration );        
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionManager::HandleExternalConnectionCreatedL
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionManager::HandleExternalConnectionCreatedL()
+    {
+    LOG_1( _L("CAOConnectionManager::HandleExternalConnectionCreatedL") );
+    
+    iObserver.HandleExternalConnectionCreatedL();
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionManager::HandleConnectionDeletedL
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionManager::HandleConnectionDeletedL( const TUint aConnectionId,
+                                                     const TBool aForward )
+    {
+    LOG_1( _L("CAOConnectionManager::HandleConnectionDeletedL") );
+    
+    // Check if this is a linger connection
+    for ( TInt i=0; i < iLingerArray.Count(); i++ )
+        {
+        if  ( iLingerArray[ i ]->ConnectionId() == aConnectionId )
+            {
+            delete iLingerArray[ i ];    
+            iLingerArray.Remove( i );
+            break; 
+            }
+        }
+    
+    if ( aForward )
+        {
+        iObserver.HandleConnectionDeletedL( aConnectionId, aForward );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionManager::HandleInternalConnectionCreatedL
+// ---------------------------------------------------------------------------
+//    
+void CAOConnectionManager::HandleInternalConnectionCreatedL( 
+                                                      const TUint aConnectionId,
+                                                      const TUint aIapId, 
+                                                      const TUint aNetId )
+    {
+    LOG_1( _L("CAOConnectionManager::HandleInternalConnectionCreatedL") );
+    
+    CLingerConnection* ptr = NULL;
+    TInt               err( KErrNone );
+    
+    // Check if there is already a linger object for this connection
+    for ( TInt i=0; i < iLingerArray.Count(); i++ )
+        {
+        if  ( iLingerArray[ i ]->ConnectionId() == aConnectionId )
+            {
+            delete iLingerArray[ i ];    
+            iLingerArray.Remove( i );    
+            break; 
+            }
+        }
+    
+    if ( ptr == NULL )
+        {
+        TConnectionInfo    connInfo;
+        
+        connInfo.iIapId =  aIapId;
+        connInfo.iNetId =  aNetId;
+    
+        ptr = CLingerConnection::NewL( aConnectionId, 
+                                       connInfo, 
+                                       iSettings, 
+                                       &iSocketServ );
+                                   
+        iLingerArray.Append( ptr );
+        }
+                                   
+                                           
+    if ( iSettings.AccessPointId() == aIapId )
+        {
+        // Always-on-iap
+        if ( !IsAlwaysOnEnabled() )
+            {
+            // Start linger since iap is not in always-on mode
+            err = ptr->StartLinger();
+            
+            if ( err )
+                {
+                // write to log
+                LOG_2( _L("ptr->StartLinger: err: %d"), err );
+                }
+            }
+        }
+    else
+        {
+        // common iap
+        err = ptr->StartLinger();
+
+        if ( err )
+            {
+            // write to log
+            LOG_2( _L("ptr->StartLinger: err: %d"), err );
+            }
+        }    
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionManager::HandleError
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionManager::HandleError( TInt /*aError*/ )
+    {
+    LOG_1( _L("CAOConnectionManager::HandleError") );
+    
+    // Notify that PDP context has disconnected since there is something wrong
+    // with network
+    TRAP_IGNORE( iObserver.HandlePDPContextDisconnectedL(
+        MAOConnectionManager::EDisconnected ) );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/src/caoconnectionmonitor.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,99 @@
+/*
+* Copyright (c) 2004,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:  Implements the CAOConnectionMonitor class
+*
+*/
+
+// INCLUDE FILES
+#include "caoconnectionmonitor.h"
+#include "logger.h"
+#include "caoconnectionmonitorimpl.h"
+
+// METHODS
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CAOConnectionMonitor* CAOConnectionMonitor::NewL(
+    MAOConnectionMonitorObserver& aObserver,
+    MAOSettings& aSettings )
+    {
+    LOG_1( _L("CAOConnectionMonitor::NewL") );
+    
+    CAOConnectionMonitor* self = new( ELeave ) CAOConnectionMonitor;
+    
+    CleanupStack::PushL( self );
+    self->ConstructL( aObserver, aSettings );
+    CleanupStack::Pop( self );
+    
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CAOConnectionMonitor::~CAOConnectionMonitor()
+    {
+    LOG_1( _L("CAOConnectionMonitor::~CAOConnectionMonitor") );
+
+    delete iConnectionMonitorImpl;
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionMonitor::FetchNetworkRegistrationStatus
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionMonitor::FetchNetworkRegistrationStatus()
+    {
+    LOG_1( _L("CAOConnectionMonitor::FetchNetworkRegistrationStatus") );
+    
+    iConnectionMonitorImpl->FetchNetworkRegistrationStatus();
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionMonitor::NetworkRegistration
+// ---------------------------------------------------------------------------
+//
+CTelephony::TRegistrationStatus 
+    CAOConnectionMonitor::NetworkRegistration() const
+    {
+    LOG_1( _L("CAOConnectionMonitor::NetworkRegistration") );
+    
+    return iConnectionMonitorImpl->NetworkRegistration();
+    }
+    
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CAOConnectionMonitor::CAOConnectionMonitor()
+    {
+    LOG_1( _L("CAOConnectionMonitor::CAOConnectionMonitor") );
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionMonitor::ConstructL(
+    MAOConnectionMonitorObserver& aObserver,
+    MAOSettings& aSettings )
+    {
+    LOG_1( _L("CAOConnectionMonitor::ConstructL") );
+    
+    iConnectionMonitorImpl =
+        CAOConnectionMonitorImpl::NewL( aObserver, aSettings );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/src/caoconnectionmonitorimpl.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,596 @@
+/*
+* Copyright (c) 2004,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:  Implements the CAOConnectionMonitorImpl class
+*
+*/
+
+// INCLUDE FILES
+#include <NIFVAR.H>
+#include "caoconnectionmonitorimpl.h"
+#include "maosettings.h"
+#include "logger.h"
+#include "maoconnectionmonitorobserver.h"
+#include "caoasyncwrapper.h"
+
+// UNNAMED NAMESPACE FOR LOCAL DEFINITIONS
+namespace
+    {
+    // CONSTATNS
+#ifdef _DEBUG
+    _LIT( KPanicCat, "ConnMon" );
+#endif
+
+    const TInt KBearerNotSearched = KErrNotFound;
+    
+    // DATA TYPES
+    enum TPanicReason
+        {
+        EAlreadyFetchingNWRegistration,
+        EAlreadyListeningNwRegistrationChange
+        //EAlreadyFetchingBearerType
+        };
+    
+    // LOCAL FUNCTIONS
+#ifdef _DEBUG
+    LOCAL_C void Panic( TPanicReason aReason )
+        {
+        User::Panic( KPanicCat, aReason );
+        }
+#endif
+    }
+
+// METHODS
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CAOConnectionMonitorImpl* CAOConnectionMonitorImpl::NewL(
+    MAOConnectionMonitorObserver& aObserver,
+    MAOSettings& aSettings )
+    {
+    LOG_1( _L("CAOConnectionMonitorImpl::NewL") );
+    
+    CAOConnectionMonitorImpl* self = new( ELeave )
+        CAOConnectionMonitorImpl( aObserver, aSettings );
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CAOConnectionMonitorImpl::~CAOConnectionMonitorImpl()
+    {
+    LOG_1( _L("CAOConnectionMonitorImpl::~CAOConnectionMonitorImpl") );
+    
+    delete iBearer;
+    delete iNWRegistrationStatusChange;
+    delete iNWRegistrationStatus;
+    delete iTelephony;
+    iConnectionMonitor.CancelNotifications();
+    iConnectionMonitor.Close();
+    }
+    
+// ---------------------------------------------------------------------------
+// CAOConnectionMonitorImpl::FetchNetworkRegistrationStatus
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionMonitorImpl::FetchNetworkRegistrationStatus()
+    {
+    LOG_1( _L("CAOConnectionMonitorImpl::FetchNetworkRegistrationStatus" ) );
+    
+    __ASSERT_DEBUG( !iNWRegistrationStatus->IsActive(),
+        Panic( EAlreadyFetchingNWRegistration ) );
+
+    iNWRegistrationStatus->IssueRequest();
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionMonitorImpl::NetworkRegistration
+// ---------------------------------------------------------------------------
+//
+CTelephony::TRegistrationStatus
+    CAOConnectionMonitorImpl::NetworkRegistration() const
+    {
+    LOG_1( _L("CAOConnectionMonitorImpl::NetworkRegistration") );
+    
+    return iWNReg.iRegStatus;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CAOConnectionMonitorImpl::CAOConnectionMonitorImpl(
+    MAOConnectionMonitorObserver& aObserver, MAOSettings& aSettings ):
+    iObserver( aObserver ),
+    iSettings( aSettings ),
+    iWNRegPckg( iWNReg ),
+    iWNRegChangePckg( iWNChangeReg ),
+    iConnectionAlive( EFalse ),
+    iBearerValue( KBearerNotSearched )
+    {
+    LOG_1( _L("CAOConnectionMonitorImpl::CAOConnectionMonitorImpl") );
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionMonitorImpl::ConstructL()
+    {
+    LOG_1( _L("CAOConnectionMonitorImpl::ConstructL") );
+    
+    // Create connection monitor
+    iConnectionMonitor.ConnectL();
+    User::LeaveIfError( iConnectionMonitor.NotifyEventL( *this ) );
+    
+    // Create telephony
+    iTelephony = CTelephony::NewL();
+    
+    // Network registration async wrapper
+    iNWRegistrationStatus = CAOAsyncWrapper<CAOConnectionMonitorImpl>::NewL(
+        this,
+        &CAOConnectionMonitorImpl::NWRegStatusIssueRequest,
+        &CAOConnectionMonitorImpl::NWRegStatusRunL,
+        &CAOConnectionMonitorImpl::NWRegStatusDoCancel,
+        &CAOConnectionMonitorImpl::NWRegStatusRunError );
+        
+    // Network registration status change async wrapper
+    iNWRegistrationStatusChange = 
+        CAOAsyncWrapper<CAOConnectionMonitorImpl>::NewL(
+        this,
+        &CAOConnectionMonitorImpl::NWRegStatusChangeIssueRequest,
+        &CAOConnectionMonitorImpl::NWRegStatusChangeRunL,
+        &CAOConnectionMonitorImpl::NWRegStatusChangeDoCancel,
+        &CAOConnectionMonitorImpl::NWRegStatusChangeRunError );
+        
+    // Bearer type fetcher
+    iBearer = CAOAsyncWrapper<CAOConnectionMonitorImpl>::NewL(
+        this,
+        &CAOConnectionMonitorImpl::BearerIssueRequest,
+        &CAOConnectionMonitorImpl::BearerRunL,
+        &CAOConnectionMonitorImpl::BearerDoCancel,
+        &CAOConnectionMonitorImpl::BearerRunError );
+        
+    // Start listening NW reg status change
+    ListenNetworkRegistrationStatusChange();
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionMonitorImpl::ListenNetworkRegistrationStatusChange
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionMonitorImpl::ListenNetworkRegistrationStatusChange()
+    {
+    LOG_1( _L(
+        "CAOConnectionMonitorImpl::ListenNetworkRegistrationStatusChange" ) );
+    
+    __ASSERT_DEBUG( !iNWRegistrationStatusChange->IsActive(),
+        Panic( EAlreadyListeningNwRegistrationChange ) );
+
+    iNWRegistrationStatusChange->IssueRequest();    
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionMonitorImpl::HandleError
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionMonitorImpl::HandleError( TInt aError )
+    {
+    LOG_1( _L("CAOConnectionMonitorImpl::HandleError" ) );
+    
+    iObserver.HandleError( aError );
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionMonitorImpl::NWRegStatusIssueRequest
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionMonitorImpl::NWRegStatusIssueRequest(
+    TRequestStatus& aStatus )
+    {
+    LOG_1( _L("CAOConnectionMonitorImpl::NWRegStatusIssueRequest" ) );
+    
+    iTelephony->GetNetworkRegistrationStatus( aStatus, iWNRegPckg );
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionMonitorImpl::NWRegStatusRunL
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionMonitorImpl::NWRegStatusRunL( TInt aStatus )
+    {
+    LOG_2( _L("CAOConnectionMonitorImpl::NWRegStatusRunL: aStatus: %d" ),
+        aStatus );
+        
+    if ( aStatus == KErrNone )
+        {
+        LOG_2( _L("> NW reg. status: %d"), iWNReg.iRegStatus );
+        iObserver.HandleNWRegistrationStatusChangedL( 
+            iWNRegPckg().iRegStatus );
+        }
+    else
+        {
+        HandleError( aStatus );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionMonitorImpl::NWRegStatusDoCancel
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionMonitorImpl::NWRegStatusDoCancel()
+    {
+    LOG_1( _L("CAOConnectionMonitorImpl::NWRegStatusDoCancel" ) );
+    
+    iTelephony->CancelAsync( 
+        CTelephony::EGetNetworkRegistrationStatusCancel );
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionMonitorImpl::NWRegStatusRunError
+// ---------------------------------------------------------------------------
+//
+TInt CAOConnectionMonitorImpl::NWRegStatusRunError( TInt aError )
+    {
+    LOG_2( _L("CAOConnectionMonitorImpl::NWRegStatusRunError: aError: %d" ),
+        aError );
+
+    HandleError( aError );
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionMonitorImpl::NWRegStatusChangeIssueRequest
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionMonitorImpl::NWRegStatusChangeIssueRequest(
+    TRequestStatus& aStatus )
+    {
+    LOG_1( _L("CAOConnectionMonitorImpl::NWRegStatusChangeIssueRequest" ) );
+    
+    iTelephony->NotifyChange(
+        aStatus,
+        CTelephony::ENetworkRegistrationStatusChange,
+        iWNRegChangePckg );
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionMonitorImpl::NWRegStatusChangeRunL
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionMonitorImpl::NWRegStatusChangeRunL( TInt aStatus )
+    {
+    LOG_2( _L("CAOConnectionMonitorImpl::NWRegStatusChangeRunL: \
+        aStatus: %d" ),
+        aStatus );
+        
+    // Handle event and continue listening
+    if ( aStatus == KErrNone )
+        {
+        LOG_3( _L("> NW reg. old: %d, WN reg. new: %d"),
+            iWNReg.iRegStatus, iWNChangeReg.iRegStatus );
+            
+        // Notify only if the value really changed
+        if ( iWNReg.iRegStatus != iWNChangeReg.iRegStatus )
+            {
+            iWNReg = iWNChangeReg;
+            iObserver.HandleNWRegistrationStatusChangedL(
+                iWNRegChangePckg().iRegStatus );
+            }
+        }
+    else
+        {
+        HandleError( aStatus );
+        }
+    
+    // Continue listening
+    ListenNetworkRegistrationStatusChange();
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionMonitorImpl::NWRegStatusChangeDoCancel
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionMonitorImpl::NWRegStatusChangeDoCancel()
+    {
+    LOG_1( _L("CAOConnectionMonitorImpl::NWRegStatusChangeDoCancel" ) );
+    
+    iTelephony->CancelAsync(
+        CTelephony::ENetworkRegistrationStatusChangeCancel );
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionMonitorImpl::NWRegStatusChangeRunError
+// ---------------------------------------------------------------------------
+//
+#ifdef LOGGING_ENABLED
+TInt CAOConnectionMonitorImpl::NWRegStatusChangeRunError( TInt aError )
+#else
+TInt CAOConnectionMonitorImpl::NWRegStatusChangeRunError( TInt /*aError*/ )
+#endif
+    {
+    LOG_2( _L("CAOConnectionMonitorImpl::NWRegStatusChangeRunError: \
+        aError: %d" ),
+        aError );
+    
+    // Continue listening
+    ListenNetworkRegistrationStatusChange();
+    return KErrNone;
+    }
+    
+// ---------------------------------------------------------------------------
+// CAOConnectionMonitorImpl::BearerIssueRequest
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionMonitorImpl::BearerIssueRequest( TRequestStatus& aStatus )
+    {
+    LOG_1( _L("CAOConnectionMonitorImpl::BearerIssueRequest" ) );
+    
+    iBearerValue = KBearerNotSearched;
+    
+    iConnectionMonitor.GetIntAttribute(
+        iMyConnectionId,
+        0,
+        KBearer,
+        iBearerValue,
+        aStatus );
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionMonitorImpl::CancelFetchBearerType
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionMonitorImpl::CancelFetchBearerType()
+    {
+    LOG_1( _L("CAOConnectionMonitorImpl::CancelFetchBearerType" ) );
+    
+    iBearerValue = KBearerNotSearched;
+    iBearer->Cancel();
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionMonitorImpl::BearerRunL
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionMonitorImpl::BearerRunL( TInt aStatus )
+    {
+    LOG_2( _L("CAOConnectionMonitorImpl::BearerRunL: aStatus: %d" ), 
+            aStatus );
+    
+    if( aStatus != KErrNone )
+        {
+        iBearerValue = EBearerUnknown;
+        }
+    LOG_2( _L("> Bearer type: %d"), iBearerValue );
+       
+    switch( iBearerValue )
+        {
+        case EBearerExternalCSD:
+        case EBearerExternalWCDMA:
+        case EBearerExternalLAN:
+        case EBearerExternalCDMA2000:
+        case EBearerExternalGPRS:
+        case EBearerExternalHSCSD:
+        case EBearerExternalEdgeGPRS:
+        case EBearerExternalWLAN:
+        case EBearerExternalBluetooth:
+        case EBearerExternalWcdmaCSD:   
+        case EBearerGPRS:
+        case EBearerEdgeGPRS:
+        case EBearerWCDMA:    
+            {
+            iConnectionAlive = ETrue;
+            iObserver.HandleExternalConnectionCreatedL();    
+            
+            break;
+            }
+        
+        default:
+            {
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionMonitorImpl::BearerDoCancel
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionMonitorImpl::BearerDoCancel()
+    {
+    LOG_1( _L("CAOConnectionMonitorImpl::BearerDoCancel" ) );
+
+    iConnectionMonitor.CancelAsyncRequest( KBearer );
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionMonitorImpl::BearerRunError
+// ---------------------------------------------------------------------------
+//
+TInt CAOConnectionMonitorImpl::BearerRunError( TInt /*aError*/ )
+    {
+    LOG_1( _L("CAOConnectionMonitorImpl::BearerRunError" ) );
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionMonitorImpl::FetchBearerType
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionMonitorImpl::FetchBearerType()
+    {
+    LOG_1( _L("CAOConnectionMonitorImpl::FetchBearerType" ) );
+
+    iBearer->IssueRequest();
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionMonitorImpl::EventL
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionMonitorImpl::EventL
+     ( const CConnMonEventBase &aConnMonEvent )
+    {
+    LOG_1( _L("CAOConnectionMonitorImpl::EventL") );
+    LOG_2( _L("> Event type: %d"), aConnMonEvent.EventType() );
+    LOG_2( _L("> Connection id: %d"), aConnMonEvent.ConnectionId() );
+        
+    switch ( aConnMonEvent.EventType() )
+        {
+        case EConnMonCreateConnection:
+            {
+            LOG_1( _L("> Connection created") );
+            if( iConnectionAlive )
+                {
+                LOG_1( _L("Connection has been alive! Break") );
+                break;
+                }
+            
+            iMyConnectionId = aConnMonEvent.ConnectionId();
+            
+            // Get iap id
+            TUint           iapId( 0 );
+            TRequestStatus  status1( KErrNone );
+            
+            iConnectionMonitor.GetUintAttribute( iMyConnectionId, 
+                                                 0, 
+                                                 KIAPId, 
+                                                 iapId, 
+                                                 status1 );
+            User::WaitForRequest( status1 );
+    
+            if ( iSettings.AccessPointId() != iapId )
+                {
+                // Check the if the connection is external
+                if( !iBearer->IsActive() )
+                    {
+                    FetchBearerType();
+                    // iConnectionAlive can be true if the bearer could be retrieved 
+                    }
+                }
+            break;
+            }
+        case EConnMonDeleteConnection:
+            {
+            LOG_1( _L("> Connection deleted") );
+            
+            if( iMyConnectionId != aConnMonEvent.ConnectionId() )
+                {
+                LOG_1( _L("Other connection was closed Break") );
+                  
+                iObserver.HandleConnectionDeletedL( aConnMonEvent.ConnectionId(), EFalse );
+                break;
+                }
+            
+            if ( iBearer->IsActive() )
+                {
+                CancelFetchBearerType();    
+                }
+            
+            iConnectionAlive = EFalse;
+            iObserver.HandleConnectionDeletedL( aConnMonEvent.ConnectionId(), ETrue );
+            break;
+            }
+            
+       case EConnMonConnectionStatusChange:
+           {
+           const CConnMonConnectionStatusChange* eventStatus; 
+           eventStatus  = static_cast<const CConnMonConnectionStatusChange*>( 
+                                                         &aConnMonEvent );
+           TInt connId = eventStatus->ConnectionId(); 
+
+           if ( eventStatus->ConnectionStatus() == KLinkLayerOpen )
+               {
+               LOG_1( _L("> Connection status KlinkLayerOpen") );
+               	
+               TUint iapId( 0 );
+               TUint netId( 0 );
+               TRequestStatus  status1( KErrNone );
+               TRequestStatus  status2( KErrNone );
+            
+                iConnectionMonitor.GetUintAttribute( connId, 
+                                                     0, 
+                                                     KIAPId, 
+                                                     iapId, 
+                                                     status1 );
+                User::WaitForRequest( status1 );
+		    
+		    
+                iConnectionMonitor.GetUintAttribute( connId, 
+                                                     0, 
+                                                     KNetworkIdentifier, 
+                                                     netId, 
+                                                     status2 );
+                User::WaitForRequest( status2 );
+		    
+                if ( status1 == KErrNone && status2 == KErrNone )
+                    {    
+                    // if this is a not-always-on iap
+                    TInt bearer( 0 );
+                    TRequestStatus status( KErrNotReady );
+       
+                    // Get the bearer info from CM server.
+                    iConnectionMonitor.GetIntAttribute( connId, 
+                                                        0, 
+                                                        KBearer, 
+                                                        bearer, 
+                                                        status );
+                    User::WaitForRequest( status ); 
+
+                    if ( status.Int() != KErrNone ) 
+                        {
+                        // write to log
+                        //LOG( Log::Printf( _L("KBearer FAILED: %d\n"), status.Int()));
+                        break;
+                        }
+
+                    // Check that it is GPRS or WCDMA.
+                    if ( bearer == EBearerGPRS      || 
+                         bearer == EBearerEdgeGPRS  ||
+                         bearer == EBearerWCDMA )
+                        {     
+                        // Notify internal packet connections
+                        //if ( iSettings.AccessPointId() != iapId )
+                        //    {
+                        //    iConnectionAlive = ETrue;    
+                        //    }
+                        
+                        iObserver.HandleInternalConnectionCreatedL( connId,
+                                                                    iapId, 
+                                                                    netId );
+                        }  
+                    }
+                }
+            }
+        default:
+            {
+            LOG_1( _L("> Do nothing") );
+            // Nothing to do
+            break;
+            }
+        }
+
+    LOG_1( _L("CAOConnectionMonitorImpl::EventL end") );
+
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/src/caoconnectionmonitorimplstub.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,394 @@
+/*
+* Copyright (c) 2004,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:  Implements the CAOConnectionMonitorImpl class
+*
+*/
+
+// INCLUDE FILES
+#include "caoconnectionmonitorimplstub.h"
+#include "logger.h"
+#include "maoconnectionmonitorobserver.h"
+#include "maosettings.h"
+#include "pdpcontextmanagerinternalpskeys.h"
+#include "caoasyncwrapper.h"
+#include "maoconnectionmanager.h"
+
+// CONSTANTS
+const TInt KDelay = 1;
+
+// METHODS
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CAOConnectionMonitorImpl* CAOConnectionMonitorImpl::NewL(
+    MAOConnectionMonitorObserver& aObserver,
+    MAOSettings& aSettings )
+    {
+    LOG_1( _L("CAOConnectionMonitorImpl::NewL") );
+    
+    CAOConnectionMonitorImpl* self = new( ELeave )
+        CAOConnectionMonitorImpl( aObserver, aSettings );
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self ); // self
+    
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CAOConnectionMonitorImpl::~CAOConnectionMonitorImpl()
+    {
+    LOG_1( _L("CAOConnectionMonitorImpl::~CAOConnectionMonitorImpl") );
+    
+    delete iNWRegStatusChangeSubscriber;
+    iNWRegStatusChangeProperty.Delete(
+        KConnectionMonitorCat,
+        ENetworkNotRegistered );
+    iNWRegStatusChangeProperty.Close();
+    
+    delete iExternalPDPContextSubscriber;
+    iExternalPDPContextProperty.Delete(
+        KConnectionMonitorCat,
+        KExternalPDPContextCreated );
+    iExternalPDPContextProperty.Close();
+    
+    delete iNewPDPContextSubscriber;
+    iNewPDPContextProperty.Delete(
+        KConnectionMonitorCat,
+        KExternalPDPContextCreated );
+    iNewPDPContextProperty.Close();
+    
+    delete iNWStatusFetcher;
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionMonitorImpl::FetchNetworkRegistrationStatus
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionMonitorImpl::FetchNetworkRegistrationStatus()
+    {
+    LOG_1( _L("CAOConnectionMonitorImpl::FetchNetworkRegistrationStatus" ) );
+    
+    TCallBack cb( NWRegStatusFetchCallBack, this );
+    iNWStatusFetcher->Start( KDelay, KDelay, cb );
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionMonitorImpl::NetworkRegistration
+// ---------------------------------------------------------------------------
+//
+CTelephony::TRegistrationStatus
+    CAOConnectionMonitorImpl::NetworkRegistration() const
+    {
+    LOG_1( _L("CAOConnectionMonitorImpl::NetworkRegistration") );
+    
+    return iWNReg.iRegStatus;
+    }
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CAOConnectionMonitorImpl::CAOConnectionMonitorImpl(
+    MAOConnectionMonitorObserver& aObserver,
+    MAOSettings&                  aSettings ):
+    iObserver( aObserver ),
+    iSettings( aSettings ),
+    iWNRegPckg( iWNReg ),
+    iWNRegChangePckg( iWNChangeReg )
+    {
+    LOG_1( _L("CAOConnectionMonitorImpl::CAOConnectionMonitorImpl") );
+    
+    iWNReg.iRegStatus = CTelephony::ENotRegisteredNoService;
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionMonitorImpl::ConstructL()
+    {
+    LOG_1( _L("CAOConnectionMonitorImpl::ConstructL") );
+    
+    // Define NW reg status change property
+    User::LeaveIfError( iNWRegStatusChangeProperty.Define(
+        KConnectionMonitorCat,
+        KNetworkRegStatusChange,
+        RProperty::EInt ) );
+    User::LeaveIfError( iNWRegStatusChangeProperty.Attach(
+        KConnectionMonitorCat,
+        KNetworkRegStatusChange ) );
+    iNWRegStatusChangeSubscriber =
+        CAOAsyncWrapper<CAOConnectionMonitorImpl>::NewL(
+            this,
+            NWChangePropertyIssueRequest,
+            NWChangePropertyRunL,
+            NWChangePropertyDoCancel,
+            NULL );
+    SubscribeNWChangeProperty();
+    
+    // Define external PDP context property
+    User::LeaveIfError( iExternalPDPContextProperty.Define(
+        KConnectionMonitorCat,
+        KExternalPDPContextCreated,
+        RProperty::EInt ) );
+    User::LeaveIfError( iExternalPDPContextProperty.Attach(
+        KConnectionMonitorCat,
+        KExternalPDPContextCreated ) );
+    iExternalPDPContextSubscriber =
+        CAOAsyncWrapper<CAOConnectionMonitorImpl>::NewL(
+            this,
+            ExternalPDPContextIssueRequest,
+            ExternalPDPContextRunL,
+            ExternalPDPContextDoCancel,
+            NULL );
+    SubscribeExternalPDPContextProperty();
+    
+    // Define new PDP context property
+    User::LeaveIfError( iNewPDPContextProperty.Define(
+        KConnectionMonitorCat,
+        KNewPDPContextCreated,
+        RProperty::EInt ) );
+    User::LeaveIfError( iNewPDPContextProperty.Attach(
+        KConnectionMonitorCat,
+        KNewPDPContextCreated ) );
+    iNewPDPContextSubscriber =
+        CAOAsyncWrapper<CAOConnectionMonitorImpl>::NewL(
+            this,
+            NewPDPContextIssueRequest,
+            NewPDPContextRunL,
+            NewPDPContextDoCancel,
+            NULL );
+    SubscribeNewPDPContextProperty();
+    
+    iNWStatusFetcher = CPeriodic::NewL( CActive::EPriorityStandard );
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionMonitorImpl::SubscribeNWChangeProperty
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionMonitorImpl::SubscribeNWChangeProperty()
+    {
+    LOG_1( _L("CAOConnectionMonitorImpl::SubscribeNWChangeProperty") );
+    
+    iNWRegStatusChangeSubscriber->IssueRequest();
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionMonitorImpl::NWChangePropertyIssueRequest
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionMonitorImpl::NWChangePropertyIssueRequest(
+    TRequestStatus& aStatus )
+    {
+    LOG_1( _L("CAOConnectionMonitorImpl::NWChangePropertyIssueRequest") );
+    
+    iNWRegStatusChangeProperty.Subscribe( aStatus );
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionMonitorImpl::NWChangePropertyRunL
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionMonitorImpl::NWChangePropertyRunL( TInt aStatus )
+    {
+    LOG_2( _L("CAOConnectionMonitorImpl::NWChangePropertyRunL: aStatus: %d"),
+        aStatus );
+        
+    if ( aStatus == KErrNone )
+        {
+        TInt value = 0;
+        TInt err = iNWRegStatusChangeProperty.Get( value );
+        if ( err == KErrNone )
+            {
+            CTelephony::TRegistrationStatus status =
+                CTelephony::ERegistrationUnknown;
+            switch ( value )
+                {
+                case ENetworkNotRegistered:
+                    {
+                    status = CTelephony::ENotRegisteredNoService;
+                    break;
+                    }
+                case ENetworkHome:
+                    {
+                    status = CTelephony::ERegisteredOnHomeNetwork;
+                    break;
+                    }
+                case ENeworkRoaming:
+                    {
+                    status = CTelephony::ERegisteredRoaming;
+                    break;
+                    }
+                default:
+                    {
+                    // Nothing do
+                    break;
+                    }
+                }
+            iWNReg.iRegStatus = status;
+            iObserver.HandleNWRegistrationStatusChangedL( iWNReg.iRegStatus );
+            }
+        }
+    SubscribeNWChangeProperty();
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionMonitorImpl::NWChangePropertyDoCancel
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionMonitorImpl::NWChangePropertyDoCancel()
+    {
+    LOG_1( _L("CAOConnectionMonitorImpl::NWChangePropertyDoCancel") );
+    
+    iNWRegStatusChangeProperty.Cancel();
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionMonitorImpl::SubscribeExternalPDPContextProperty
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionMonitorImpl::SubscribeExternalPDPContextProperty()
+    {
+    LOG_1( _L(
+        "CAOConnectionMonitorImpl::SubscribeExternalPDPContextProperty") );
+    
+    iExternalPDPContextSubscriber->IssueRequest();
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionMonitorImpl::ExternalPDPContextIssueRequest
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionMonitorImpl::ExternalPDPContextIssueRequest(
+    TRequestStatus& aStatus )
+    {
+    LOG_1( _L("CAOConnectionMonitorImpl::ExternalPDPContextIssueRequest") );
+    
+    iExternalPDPContextProperty.Subscribe( aStatus );
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionMonitorImpl::ExternalPDPContextRunL
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionMonitorImpl::ExternalPDPContextRunL( TInt aStatus )
+    {
+    LOG_2( _L("CAOConnectionMonitorImpl::ExternalPDPContextRunL: \
+        aStatus: %d"),
+        aStatus );
+        
+    if ( aStatus == KErrNone )
+        {
+        // Value is not relevant
+        //iObserver.HandleNewConnectionCreatedL( 1, ETrue );
+        }
+    SubscribeExternalPDPContextProperty();
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionMonitorImpl::ExternalPDPContextDoCancel
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionMonitorImpl::ExternalPDPContextDoCancel()
+    {
+    LOG_1( _L("CAOConnectionMonitorImpl::ExternalPDPContextDoCancel") );
+    
+    iExternalPDPContextProperty.Cancel();
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionMonitorImpl::SubscribeNewPDPContextProperty
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionMonitorImpl::SubscribeNewPDPContextProperty()
+    {
+    LOG_1( _L("CAOConnectionMonitorImpl::SubscribeNewPDPContextProperty") );
+    
+    iNewPDPContextSubscriber->IssueRequest();
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionMonitorImpl::SubscribeNewPDPContextProperty
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionMonitorImpl::NewPDPContextIssueRequest(
+    TRequestStatus& aStatus )
+    {
+    LOG_1( _L("CAOConnectionMonitorImpl::NewPDPContextIssueRequest") );
+    
+    iNewPDPContextProperty.Subscribe( aStatus );
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionMonitorImpl::NewPDPContextRunL
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionMonitorImpl::NewPDPContextRunL( TInt aStatus )
+    {
+    LOG_2( _L("CAOConnectionMonitorImpl::NewPDPContextRunL: aStatus: %d"),
+        aStatus );
+        
+    if ( aStatus == KErrNone )
+        {
+        // Value is not relevant
+        //iObserver.HandleNewConnectionCreatedL( 1, EFalse );
+        }
+    SubscribeNewPDPContextProperty();
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionMonitorImpl::NewPDPContextDoCancel
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionMonitorImpl::NewPDPContextDoCancel()
+    {
+    LOG_1( _L("CAOConnectionMonitorImpl::NewPDPContextDoCancel") );
+    
+    iNewPDPContextProperty.Cancel();
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionMonitorImpl::NWRegStatusFetchCallBack
+// ---------------------------------------------------------------------------
+//
+TInt CAOConnectionMonitorImpl::NWRegStatusFetchCallBack( TAny* aSelf )
+    {
+    LOG_1( _L("CAOConnectionMonitorImpl::NWRegStatusFetchCallBack") );
+    
+    CAOConnectionMonitorImpl* self = static_cast<CAOConnectionMonitorImpl*>(
+        aSelf );
+    TRAPD( err, self->HandleNWRegStatusFetchedL() );
+    
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CAOConnectionMonitorImpl::HandleNWRegStatusFetchedL
+// ---------------------------------------------------------------------------
+//
+void CAOConnectionMonitorImpl::HandleNWRegStatusFetchedL()
+    {
+    LOG_1( _L("CAOConnectionMonitorImpl::HandleNWRegStatusFetchedL") );
+
+    iNWStatusFetcher->Cancel();
+    iObserver.HandleNWRegistrationStatusChangedL( iWNReg.iRegStatus );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/src/caogpds.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,212 @@
+/*
+* Copyright (c) 2004,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:  Implements the CAOGpds class
+*
+*/
+
+
+// INCLUDE FILES
+#include "caogpds.h"
+#include "logger.h"
+
+#include <rmmcustomapi.h>
+
+
+//  UNNAMED NAMESPACE FOR LOCAL DEFINITIONS
+//namespace
+//    {
+    // CONSTANTS
+//    _LIT( KPanicCat, "Gpds" );
+    
+    // DATA TYPES
+//    enum TPanicReason
+//        {
+//        ENoReason,
+//        EAlreadyActive
+//        };
+    
+    // LOCAL FUNCTIONS
+//    LOCAL_C void Panic( TPanicReason aReason )
+//        {
+//        User::Panic( KPanicCat, aReason );
+//        }
+//    }
+
+//    METHODS
+
+// ---------------------------------------------------------------------------
+// CAOGpds::NewL
+// ---------------------------------------------------------------------------
+//
+CAOGpds* CAOGpds::NewL( RMmCustomAPI& aCustomAPI )
+    {
+    LOG_1( _L("CAOGpds::NewL") );
+    
+    CAOGpds* self = new( ELeave ) CAOGpds( aCustomAPI );
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CAOGpds::~CAOGpds
+// ---------------------------------------------------------------------------
+//
+CAOGpds::~CAOGpds()
+    {
+    LOG_1( _L("CAOGpds::~CAOGpds") );
+    
+    Cancel();
+    if ( iWait )
+        {
+        if ( iWait->IsStarted() )
+            {
+            iWait->AsyncStop();
+            }
+        delete iWait;
+        }
+    }
+
+// Constructor
+
+// ---------------------------------------------------------------------------
+// CAOGpds::CAOGpds
+// ---------------------------------------------------------------------------
+//
+CAOGpds::CAOGpds( RMmCustomAPI& aCustomAPI ):
+    CActive( EPriorityStandard ),
+    iCustomAPI( aCustomAPI )
+    {
+    LOG_1( _L("CAOGpds::CAOGpds") );
+    
+    CActiveScheduler::Add( this );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CAOGpds::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CAOGpds::ConstructL()
+    {
+    LOG_1( _L("CAOGpds::ConstructL") );
+    
+    // Create active schduler wiat for synchronizing async operations    
+    iWait = new( ELeave ) CActiveSchedulerWait;
+    }
+
+// ---------------------------------------------------------------------------
+// CAOGpds::RunL
+// ---------------------------------------------------------------------------
+//
+void CAOGpds::RunL()
+    {
+    LOG_2( _L("CAOGpds::RunL: iStatus: %d"), iStatus.Int() );
+    
+    if ( iWait->IsStarted() )
+        {
+        iWait->AsyncStop();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAOGpds::DoCancel
+// ---------------------------------------------------------------------------
+//
+void CAOGpds::DoCancel()
+    {
+    LOG_1( _L("CAOGpds::DoCancel") );
+    
+#ifndef __WINS__
+    iCustomAPI.CancelAsyncRequest( ECustomSetAlwaysOnMode );
+#endif // __WINS__
+
+    if ( iWait->IsStarted() )
+        {
+        iWait->AsyncStop();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAOGpds::SetAlwaysOnModeL
+// ---------------------------------------------------------------------------
+//
+void CAOGpds::SetAlwaysOnModeL( TAlwaysOnMode aMode )
+    {
+    LOG_2( _L("CAOGpds::SetAlwaysOnModeL: aMode: %d"), aMode );
+    
+    if ( IsActive() )
+        {
+        return;
+        }
+        
+#ifdef __WINS__
+    aMode = aMode;
+    iStatus = KRequestPending;
+    SetActive();
+    TRequestStatus* status = &iStatus;
+    User::RequestComplete( status, KErrNone );
+    
+    if( !iWait->IsStarted() )
+    {
+        iWait->Start();
+    }
+#else
+    RMmCustomAPI::TSetAlwaysOnMode mode( RMmCustomAPI::EAlwaysModeNeither );
+    switch ( aMode )
+        {
+        case EHPLMN:
+            {
+            mode = RMmCustomAPI::EAlwaysModeHPLMN;
+            break;
+            }
+        case EVPLMN:
+            {
+            mode = RMmCustomAPI::EAlwaysModeVPLMN;
+            break;
+            }
+        case EBoth:
+            {
+            mode = RMmCustomAPI::EAlwaysModeBoth;
+            break;
+            }
+        case ENeither:
+            {
+            mode = RMmCustomAPI::EAlwaysModeNeither;
+            break;
+            }
+        default:
+            {
+            mode = RMmCustomAPI::EAlwaysModeNeither;
+            break;
+            }
+        }
+        
+    // Wait here until request has completed
+    iCustomAPI.SetAlwaysOn( iStatus, mode );
+    LOG_2( _L("iCustomAPI.SetAlwaysOn: mode: %d"), mode );
+    
+    SetActive();
+    if( !iWait->IsStarted() )
+    {
+        iWait->Start();
+    }
+    LOG_2( _L("iCustomAPI.SetAlwaysOn: iStatus: %d"), iStatus.Int() );
+#endif // __WINS__
+    }
+        
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/src/caoraumanager.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,117 @@
+/*
+* Copyright (c) 2004,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:  Implements the CAORAUManager class
+*
+*/
+
+
+// INCLUDE FILES
+#include "caoraumanager.h"
+#include "logger.h"
+#include "caoraumanagerimpl.h"
+
+//    METHODS
+
+// Two-phased constructor.
+#ifdef __ALWAYS_ON_CUSTOM_API
+
+// ---------------------------------------------------------------------------
+// CAORAUManager::NewL
+// ---------------------------------------------------------------------------
+//
+CAORAUManager* CAORAUManager::NewL(
+    MAORAUManagerObserver& aObserver,
+    RMmCustomAPI& aCustomAPI )
+    {
+    LOG_1( _L("CAORAUManager::NewL") );
+    
+    CAORAUManager* self = new( ELeave ) CAORAUManager;
+    
+    CleanupStack::PushL( self );
+    self->ConstructL( aObserver, aCustomAPI );
+    CleanupStack::Pop( self );
+    
+    return self;
+    }
+#else
+
+// ---------------------------------------------------------------------------
+// CAORAUManager::NewL
+// ---------------------------------------------------------------------------
+//
+CAORAUManager* CAORAUManager::NewL( MAORAUManagerObserver& aObserver )
+    {
+    LOG_1( _L("CAORAUManager::NewL") );
+    
+    CAORAUManager* self = new( ELeave ) CAORAUManager;
+    
+    CleanupStack::PushL( self );
+    self->ConstructL( aObserver );
+    CleanupStack::Pop( self );
+    
+    return self;
+    }
+    
+#endif // __ALWAYS_ON_CUSTOM_API
+
+// ---------------------------------------------------------------------------
+// CAORAUManager::~CAORAUManager
+// ---------------------------------------------------------------------------
+//
+CAORAUManager::~CAORAUManager()
+    {
+    LOG_1( _L("CAORAUManager::~CAORAUManager") );
+    
+    delete iRAUManagerImpl;
+    }
+
+// ---------------------------------------------------------------------------
+// CAORAUManager::CAORAUManager
+// ---------------------------------------------------------------------------
+//
+CAORAUManager::CAORAUManager()
+    {
+    LOG_1( _L("CAORAUManager::CAORAUManager") );
+    }
+
+// Symbian 2nd phase constructor
+#ifdef __ALWAYS_ON_CUSTOM_API
+
+// ---------------------------------------------------------------------------
+// CAORAUManager::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CAORAUManager::ConstructL( MAORAUManagerObserver& aObserver,
+                                RMmCustomAPI& aCustomAPI )
+    {
+    LOG_1( _L("CAORAUManager::ConstructL") );
+    
+    iRAUManagerImpl = CAORAUManagerImpl::NewL( aObserver, aCustomAPI );
+    }
+#else
+
+// ---------------------------------------------------------------------------
+// CAORAUManager::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CAORAUManager::ConstructL( MAORAUManagerObserver& aObserver )
+    {
+    LOG_1( _L("CAORAUManager::ConstructL") );
+    
+    iRAUManagerImpl = CAORAUManagerImpl::NewL( aObserver );
+    }
+    
+#endif // __ALWAYS_ON_CUSTOM_API
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/src/caoraumanagerimpl.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,242 @@
+/*
+* Copyright (c) 2004,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:  Implements the CAORAUManagerImpl class
+*
+*/
+
+
+// INCLUDE FILES
+#include "caoraumanagerimpl.h"
+#include "logger.h"
+#include "maoraumanagerobserver.h"
+
+//  UNNAMED NAMESPACE FOR LOCAL DEFINITIONS
+#ifdef __ALWAYS_ON_CUSTOM_API
+namespace
+    {
+#ifdef _DEBUG
+    // CONSTANTS
+    _LIT( KPanicCat, "RAUManager" );
+    
+    // DATA TYPES
+    enum TPanicReason
+        {
+        ENoReason,
+        EAlreadyActive
+        };
+    
+    // LOCAL FUNCTIONS
+    LOCAL_C void Panic( TPanicReason aReason )
+        {
+        User::Panic( KPanicCat, aReason );
+        }
+       
+#endif // _DEBUG 
+    }
+#endif // __ALWAYS_ON_CUSTOM_API 
+
+//    METHODS
+
+#ifdef __ALWAYS_ON_CUSTOM_API
+
+// ---------------------------------------------------------------------------
+// CAORAUManagerImpl::NewL
+// ---------------------------------------------------------------------------
+//
+CAORAUManagerImpl* CAORAUManagerImpl::NewL(
+    MAORAUManagerObserver& aObserver,
+    RMmCustomAPI& aCustomAPI )
+    {
+    LOG_1( _L("CAORAUManagerImpl::NewL") );
+    
+    CAORAUManagerImpl* self = new( ELeave ) CAORAUManagerImpl(
+        aObserver,
+        aCustomAPI );
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    
+    return self;
+    }
+#else
+
+// ---------------------------------------------------------------------------
+// CAORAUManagerImpl::NewL
+// ---------------------------------------------------------------------------
+//
+CAORAUManagerImpl* CAORAUManagerImpl::NewL( MAORAUManagerObserver& aObserver )
+    {
+    LOG_1( _L("CAORAUManagerImpl::NewL") );
+    
+    CAORAUManagerImpl* self = new( ELeave ) CAORAUManagerImpl( aObserver );
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    
+    return self;
+    }
+    
+#endif //  __ALWAYS_ON_CUSTOM_API
+
+// ---------------------------------------------------------------------------
+// CAORAUManagerImpl::~CAORAUManagerImpl
+// ---------------------------------------------------------------------------
+//
+CAORAUManagerImpl::~CAORAUManagerImpl()
+    {
+    LOG_1( _L("CAORAUManagerImpl::~CAORAUManagerImpl") );
+    
+    Cancel();
+    }
+
+#ifdef __ALWAYS_ON_CUSTOM_API
+
+// ---------------------------------------------------------------------------
+// CAORAUManagerImpl::CAORAUManagerImpl
+// ---------------------------------------------------------------------------
+//
+CAORAUManagerImpl::CAORAUManagerImpl(
+    MAORAUManagerObserver& aObserver,
+    RMmCustomAPI& aCustomAPI ):
+    CActive( EPriorityStandard ),
+    iObserver( aObserver ),
+    iCustomAPI( aCustomAPI )
+    {
+    LOG_1( _L("CAORAUManagerImpl::CAORAUManagerImpl") );
+    
+    CActiveScheduler::Add( this );
+    }
+#else
+
+// ---------------------------------------------------------------------------
+// CAORAUManagerImpl::CAORAUManagerImpl
+// ---------------------------------------------------------------------------
+//
+CAORAUManagerImpl::CAORAUManagerImpl( MAORAUManagerObserver& aObserver ):
+    CActive( EPriorityStandard ),
+    iObserver( aObserver )
+    {
+    LOG_1( _L("CAORAUManagerImpl::CAORAUManagerImpl") );
+    
+    CActiveScheduler::Add( this );
+    }
+    
+#endif //  __ALWAYS_ON_CUSTOM_API
+
+// ---------------------------------------------------------------------------
+// CAORAUManagerImpl::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CAORAUManagerImpl::ConstructL()
+    {
+    LOG_1( _L("CAORAUManagerImpl::ConstructL") );
+
+    IssueRAUNotifications();
+    }
+
+// ---------------------------------------------------------------------------
+// CAORAUManagerImpl::RunL
+// ---------------------------------------------------------------------------
+//
+void CAORAUManagerImpl::RunL()
+    {
+    LOG_2( _L("CAORAUManagerImpl::RunL: iStatus: %d"), iStatus.Int() );
+    
+#ifdef __ALWAYS_ON_CUSTOM_API
+
+    if ( iStatus == KErrNone )
+        {
+        MAORAUManagerObserver::TRAUType rau;
+        switch ( iRAUStatus )
+            {
+            case RMmCustomAPI::ERauEventActive:
+                {
+                rau = MAORAUManagerObserver::ENormal;
+                break;
+                }
+            case RMmCustomAPI::ERauEventResumed:
+                {
+                rau = MAORAUManagerObserver::EPeriodical;
+                break;
+                }
+            default:
+                {
+                rau = MAORAUManagerObserver::ENormal;
+                break;
+                }
+            }
+        iObserver.HandleSuccesfulRAUL( rau );
+        }
+    IssueRAUNotifications();
+    
+#endif //  __ALWAYS_ON_CUSTOM_API
+    }
+
+// ---------------------------------------------------------------------------
+// CAORAUManagerImpl::DoCancel
+// ---------------------------------------------------------------------------
+//
+void CAORAUManagerImpl::DoCancel()
+    {
+    LOG_1( _L("CAORAUManagerImpl::DoCancel") );
+    
+#ifdef __ALWAYS_ON_CUSTOM_API
+#ifndef __WINS__
+    iCustomAPI.CancelAsyncRequest( ECustomNotifyRauEventIPC );
+#endif // __WINS__
+#endif // __ALWAYS_ON_CUSTOM_API
+    }
+
+// ---------------------------------------------------------------------------
+// CAORAUManagerImpl::RunError
+// ---------------------------------------------------------------------------
+//
+#ifdef LOGGING_ENABLED
+TInt CAORAUManagerImpl::RunError( TInt aError )
+#else
+TInt CAORAUManagerImpl::RunError( TInt /*aError*/ )
+#endif // LOGGING_ENABLED
+    {
+    LOG_2( _L("CAORAUManagerImpl::RunError: aError: %d"), aError );
+    
+    IssueRAUNotifications();
+    return KErrNone;
+    }
+
+//----------------------------------------------------------------------------
+// CAORAUManagerImpl::IssueRAUNotifications
+// ---------------------------------------------------------------------------
+//
+void CAORAUManagerImpl::IssueRAUNotifications()
+    {
+    LOG_1( _L("CAORAUManagerImpl::IssueRAUNotifications") );
+    
+#ifdef __ALWAYS_ON_CUSTOM_API
+    __ASSERT_DEBUG( !IsActive(), Panic( EAlreadyActive ) );
+    
+#ifdef __WINS__
+    iStatus = KRequestPending;
+    SetActive();
+    TRequestStatus* status = &iStatus;
+    User::RequestComplete( status, KErrNone );
+#else
+    iCustomAPI.NotifyRauEvent( iStatus, iRAUStatus );
+    SetActive();
+#endif // __WINS__
+#endif // __ALWAYS_ON_CUSTOM_API
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/src/caoraumanagerimplstub.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,183 @@
+/*
+* Copyright (c) 2004,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:  Implements the CAORAUManagerImpl class
+*
+*/
+
+
+// INCLUDE FILES
+#include "caoraumanagerimplstub.h"
+#include "logger.h"
+#include "raumanagerobserver.h"
+#include "pdpcontextmanagerinternalpskeys.h"
+
+// METHODS
+
+#ifdef __ALWAYS_ON_CUSTOM_API
+
+// ---------------------------------------------------------------------------
+// CAORAUManagerImpl::NewL
+// ---------------------------------------------------------------------------
+//
+CAORAUManagerImpl* CAORAUManagerImpl::NewL( MAORAUManagerObserver& aObserver,
+                                            RMmCustomAPI& /*aCustomAPI*/ )
+    {
+    LOG_1( _L("CAORAUManagerImpl::NewL") );
+    
+    CAORAUManagerImpl* self = new( ELeave ) CAORAUManagerImpl( aObserver );
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self ); // self
+    
+    return self;
+    }
+
+#else
+
+// ---------------------------------------------------------------------------
+// CAORAUManagerImpl::NewL
+// ---------------------------------------------------------------------------
+//
+CAORAUManagerImpl* CAORAUManagerImpl::NewL( MAORAUManagerObserver& aObserver )
+    {
+    LOG_1( _L("CAORAUManagerImpl::NewL") );
+    
+    CAORAUManagerImpl* self = new( ELeave ) CAORAUManagerImpl( aObserver );
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self ); // self
+    
+    return self;
+    }
+
+#endif // __ALWAYS_ON_CUSTOM_API
+
+// ---------------------------------------------------------------------------
+// CAORAUManagerImpl::~CAORAUManagerImpl
+// ---------------------------------------------------------------------------
+//
+CAORAUManagerImpl::~CAORAUManagerImpl()
+    {
+    LOG_1( _L("CAORAUManagerImpl::~CAORAUManagerImpl") );
+    
+    if ( iRAUEventSubscriber )
+        {
+        iRAUEventSubscriber->Cancel();
+        }
+    iRAUEventProperty.Delete( KRAUEventCat, KRAUGenerateEvent );
+    iRAUEventProperty.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// CAORAUManagerImpl::CAORAUManagerImpl
+// ---------------------------------------------------------------------------
+//
+CAORAUManagerImpl::CAORAUManagerImpl( MAORAUManagerObserver& aObserver ):
+    iObserver( aObserver )
+    {
+    LOG_1( _L("CAORAUManagerImpl::CAORAUManagerImpl") );
+    }
+
+// ---------------------------------------------------------------------------
+// CAORAUManagerImpl::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CAORAUManagerImpl::ConstructL()
+    {
+    LOG_1( _L("CAORAUManagerImpl::ConstructL") );
+    
+    // Define a property and attatch to it
+    User::LeaveIfError( iRAUEventProperty.Define(
+        KRAUEventCat,
+        KRAUGenerateEvent,
+        RProperty::EInt ) );
+    User::LeaveIfError(
+        iRAUEventProperty.Attach( KRAUEventCat, KRAUGenerateEvent ) );
+    
+    // Create subscription listener
+    iRAUEventSubscriber = CAOAsyncWrapper<CAORAUManagerImpl>::NewL(
+        this,
+        RAUEventSubscribeIssueRequest,
+        RAUEventSubscribeRunL,
+        RAUEventSubscribeDoCancel,
+        NULL );
+        
+    // Subscribe RAU event
+    SubscribeRAUEvents();
+    }
+
+// ---------------------------------------------------------------------------
+// CAORAUManagerImpl::SubscribeRAUEvents
+// ---------------------------------------------------------------------------
+//
+void CAORAUManagerImpl::SubscribeRAUEvents()
+    {
+    LOG_1( _L("CAORAUManagerImpl::SubscribeRAUEvents") );
+    
+    iRAUEventSubscriber->IssueRequest();
+    }
+
+// ---------------------------------------------------------------------------
+// CAORAUManagerImpl::RAUEventSubscribeIssueRequest
+// ---------------------------------------------------------------------------
+//
+void CAORAUManagerImpl::RAUEventSubscribeIssueRequest(
+    TRequestStatus& aStatus )
+    {
+    LOG_1( _L("CAORAUManagerImpl::RAUEventSubscribeIssueRequest") );
+    
+    iRAUEventProperty.Subscribe( aStatus );
+    }
+
+// ---------------------------------------------------------------------------
+// CAORAUManagerImpl::RAUEventSubscribeRunL
+// ---------------------------------------------------------------------------
+//
+void CAORAUManagerImpl::RAUEventSubscribeRunL( TInt aStatus )
+    {
+    LOG_2( _L("CAORAUManagerImpl::RAUEventSubscribeRunL: aStatus: %d"),
+        aStatus );
+    
+    if ( aStatus == KErrNone )
+        {
+        TInt value = 0;
+        TInt err = iRAUEventProperty.Get( value );
+        if ( err == KErrNone )
+            {
+            MAORAUManagerObserver::TRAUType rauType =
+                MAORAUManagerObserver::ENormal;
+            if ( value == EPeriodicalRAU )
+                {
+                rauType = MAORAUManagerObserver::EPeriodical;
+                }
+            iObserver.HandleSuccesfulRAUL( rauType );
+            }
+        }
+    SubscribeRAUEvents();
+    }
+
+// ---------------------------------------------------------------------------
+// CAORAUManagerImpl::SubscribeRAUEvents
+// ---------------------------------------------------------------------------
+//
+void CAORAUManagerImpl::RAUEventSubscribeDoCancel()
+    {
+    LOG_1( _L("CAORAUManagerImpl::RAUEventSubscribeDoCancel") );
+    
+    iRAUEventProperty.Cancel();
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/src/caoserver.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,1003 @@
+/*
+* Copyright (c) 2004,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:  Implements the CAOServer class
+*
+*/
+
+
+// INCLUDE FILES
+#include <mmtsy_names.h>
+
+#include "caoserver.h"
+#include "caoconnectionmanager.h"
+#include "caotimer.h"
+#include "caoraumanager.h"
+#include "caosettings.h"
+#include "caogpds.h"
+#include "taostateinit.h"
+#include "taostatestarting.h"
+#include "taostatedisabled.h"
+#include "taostateconnecting.h"
+#include "taostateconnected.h"
+#include "taostatedisconnected.h"
+#include "taostatewaiting.h"
+#include "taostateunconnected.h"
+#include "taostateresetfactorysettings.h"
+#include "taostateexternalconnection.h"
+#include "logger.h"
+#include "pdpcontextmanagerpskeys.h"
+
+#ifdef LOGGING_ENABLED
+#ifdef LOGGING_MODE_FILE
+#include <f32file.h>
+#endif // LOGGING_MODE_FILE
+#endif // LOGGING_ENABLED
+
+// UNNAMED NAMESPACE FOR LOCAL DEFINITIONS
+namespace
+    {
+    // CONSTANTS
+#ifdef LOGGING_ENABLED
+
+    _LIT( KStateNone,           "None" );
+    _LIT( KStateInit,           "Init" );
+    _LIT( KStateStarting,       "Starting" );
+    _LIT( KStateDisabled,       "Disabled" );
+    _LIT( KStateConnecting,     "Connecting" );
+    _LIT( KStateConnected,      "Connected" );
+    _LIT( KStateDisconnected,   "Disconnected" );
+    _LIT( KStateWaiting,        "Waiting" );
+    _LIT( KStateUnconnected,    "Unconnected" );
+    _LIT( KStateRfs,            "ResetFactorySettings" );
+    _LIT( KStateExtConn,        "ExternalConnection" );
+    _LIT( KStateUnexpected,     "Unexpected" );
+
+#endif // LOGGING_ENABLED
+
+    const TInt KReactivationDelay = 25000000; // 25 seconds
+    const TInt KSetupDelay = 2000000; // 2 seconds
+    _LIT_SECURITY_POLICY_PASS( KPDPAlwaysPass );
+
+#ifdef _DEBUG
+    _LIT( KPanicCat, "AOServ" );
+    
+    // DATA TYPES
+    enum TPanicReason
+        {
+        ENoReason,
+        EPDPAlreadySubscribed,
+        ESetupAlreadyInitiated
+        };
+
+    // LOCAL FUNCTIONS
+    LOCAL_C void Panic( TPanicReason aReason )
+        {
+        User::Panic( KPanicCat, aReason );
+        }
+#endif // _DEBUG
+    
+    
+#ifdef LOGGING_ENABLED
+    LOCAL_C const TDesC& StateToDesC( TAOState::TAOStateName aState )
+        {
+        switch ( aState )
+            {
+            case TAOState::EStateInit:
+                {
+                return KStateInit;
+                }
+            case TAOState::EStateStarting:
+                {
+                return KStateStarting;
+                }
+            case TAOState::EStateDisabled:
+                {
+                return KStateDisabled;
+                }
+            case TAOState::EStateConnecting:
+                {
+                return KStateConnecting;
+                }
+            case TAOState::EStateConnected:
+                {
+                return KStateConnected;
+                }
+            case TAOState::EStateDisconnected:
+                {
+                return KStateDisconnected;
+                }
+            case TAOState::EStateWaiting:
+                {
+                return KStateWaiting;
+                }
+            case TAOState::EStateUnconnected:
+                {
+                return KStateUnconnected;
+                }
+            case TAOState::EStateResetFactorySettings:
+                {
+                return KStateRfs;
+                }
+            case TAOState::EStateExternalConnection:
+                {
+                return KStateExtConn;
+                }
+            default:
+                {
+                return KStateUnexpected;
+                }
+            }
+        }
+#endif // LOGGING_ENABLED
+    }
+
+// METHODS
+
+// ---------------------------------------------------------------------------
+// CAOServer::NewL
+// ---------------------------------------------------------------------------
+//
+CAOServer* CAOServer::NewL()
+    {
+    LOG_1( _L("CAOServer::NewL") );
+    
+    CAOServer* self = new( ELeave ) CAOServer;
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CAOServer::~CAOServer
+// ---------------------------------------------------------------------------
+//
+CAOServer::~CAOServer()
+    {
+    LOG_1( _L("CAOServer::~CAOServer") );
+
+    delete iAsyncSetup;
+    ReleasePDPProperty();    
+    delete iAsyncReactivation;
+    
+    if ( iPointerStatePool )
+        {
+        iPointerStatePool->ResetAndDestroy();
+        delete iPointerStatePool;    
+        }
+    
+    delete iGpds;
+    delete iRAUManager;
+    delete iTimer;
+    delete iConnectionManager;
+    delete iSettings;
+    
+    iCustomAPI.Close();
+    iMobilePhone.Close();
+    iTelServer.UnloadPhoneModule( KMmTsyModuleName() );
+    iTelServer.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// CAOServer::CAOServer
+// ---------------------------------------------------------------------------
+//
+CAOServer::CAOServer()
+    {
+    LOG_1( _L("CAOServer::CAOServer") );
+    }
+
+// ---------------------------------------------------------------------------
+// CAOServer::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CAOServer::ConstructL()
+    {
+    LOG_1( _L("CAOServer::ConstructL") );
+    
+    // Configure Custom API
+    ConfigureCustomAPIL();
+    
+    // Create services
+    iSettings = CAOSettings::NewL( *this );
+    iConnectionManager = CAOConnectionManager::NewL( *this, *iSettings );
+    iTimer = CAOTimer::NewL( *this, *iSettings );
+
+#ifdef __ALWAYS_ON_CUSTOM_API
+
+    iRAUManager = CAORAUManager::NewL( *this, iCustomAPI );
+    
+#else
+
+    iRAUManager = CAORAUManager::NewL( *this );
+
+#endif // __ALWAYS_ON_CUSTOM_API
+    
+    iGpds = CAOGpds::NewL( iCustomAPI );
+    
+    InitStatePoolL();
+        
+    // Set current state to 'init'
+    iCurrentState = ChangeState( TAOState::EStateInit );
+    
+    // Init timers
+    iAsyncReactivation = CPeriodic::NewL( CActive::EPriorityStandard );
+    iAsyncSetup = CPeriodic::NewL( CActive::EPriorityStandard );
+    
+    // Create PDP property observer
+    CreatePDPPropertyAndSubscribeL();
+    
+    // Setup Always-On server
+    Setup();
+    }
+
+// ---------------------------------------------------------------------------
+// CAOServer::Setup
+// ---------------------------------------------------------------------------
+//
+void CAOServer::Setup()
+    {
+    LOG_1( _L("CAOServer::SetupL") );
+    
+    __ASSERT_DEBUG( !iAsyncSetup->IsActive(), 
+                    Panic( ESetupAlreadyInitiated ) );
+    
+    TCallBack cb( SetupCallBack, this );
+    iAsyncSetup->Start( KSetupDelay, KSetupDelay, cb );
+    }
+
+// ---------------------------------------------------------------------------
+// CAOServer::ReactivationCallBack
+// ---------------------------------------------------------------------------
+//
+TInt CAOServer::ReactivationCallBack( TAny* aSelf )
+    {
+    LOG_1( _L("CAOServer::ReactivationCallBack") );
+    
+    TRAP_IGNORE( static_cast<CAOServer*>( aSelf )->HandleReactivationL() );
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CAOServer::HandleReactivationL
+// ---------------------------------------------------------------------------
+//
+void CAOServer::HandleReactivationL()
+    {
+    LOG_1( _L("CAOServer::HandleReactivationL") );
+    
+    iAsyncReactivation->Cancel();
+    
+    TAOState* newState =
+        iCurrentState->HandleSwitchFromDisconnectedL( iFailure );
+    if ( newState )
+        {
+        iCurrentState = newState;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAOServer::DoReactivation
+// ---------------------------------------------------------------------------
+//
+void CAOServer::DoReactivation( MAOConnectionManager::TFailureReason aReason )
+    {
+    LOG_1( _L("CAOServer::DoReactivation") );
+    
+    // If we are not already re-activating
+    if ( !iAsyncReactivation->IsActive() )
+        {
+        iFailure = aReason;
+        TCallBack cb( ReactivationCallBack, this );
+        iAsyncReactivation->Start(
+            KReactivationDelay, KReactivationDelay, cb );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAOServer::IssuePDPPropertySubscription
+// ---------------------------------------------------------------------------
+//
+void CAOServer::IssuePDPPropertySubscription()
+    {
+    LOG_1( _L("CAOServer::IssuePDPPropertySubscription") );
+    
+    __ASSERT_DEBUG( !iPDPPropertySubscriber->IsActive(),
+        Panic( EPDPAlreadySubscribed ) );
+    
+    iPDPPropertySubscriber->IssueRequest();
+    }
+// ---------------------------------------------------------------------------
+// CAOServer::PDPPropertySubscriptionIssueRequest
+// ---------------------------------------------------------------------------
+//
+void CAOServer::PDPPropertySubscriptionIssueRequest( TRequestStatus& aStatus )
+    {
+    LOG_1( _L("CAOServer::PDPPropertySubscriptionIssueRequest") );
+    
+    iPDPProperty.Subscribe( aStatus );
+    }
+
+// ---------------------------------------------------------------------------
+// CAOServer::PDPPropertySubscriptionRunL
+// ---------------------------------------------------------------------------
+//
+void CAOServer::PDPPropertySubscriptionRunL( TInt aStatus )
+    {
+    LOG_2( _L("CAOServer::PDPPropertySubscriptionRunL: aStatus: %d"),
+        aStatus );
+    
+    if ( aStatus == KErrNone )
+        {
+        TInt val = 0;
+        TInt err = iPDPProperty.Get(
+            KPDPContextManager2,
+            KPDPContextManagerFactorySettingsReset,
+            val );
+            
+        TAOState* newState = NULL;
+        if ( err == KErrNone )
+            {
+            if ( val == EPDPContextManagerFactorySettingsResetStart )
+                {
+                newState =
+                    iCurrentState->HandleResetFactorySettingsL( ETrue );
+                }
+            else if ( val == EPDPContextManagerFactorySettingsResetStop )
+                {
+                newState =
+                    iCurrentState->HandleResetFactorySettingsL( EFalse );
+                }
+            }
+        if ( newState )
+            {
+            iCurrentState = newState;
+            }
+        }
+    IssuePDPPropertySubscription();
+    }
+
+// ---------------------------------------------------------------------------
+// CAOServer::PDPPropertySubscriptionDoCancel
+// ---------------------------------------------------------------------------
+//
+void CAOServer::PDPPropertySubscriptionDoCancel()
+    {
+    LOG_1( _L("CAOServer::PDPPropertySubscriptionDoCancel") );
+    
+    iPDPProperty.Cancel();
+    }
+
+// ---------------------------------------------------------------------------
+// CAOServer::ReleasePDPProperty
+// ---------------------------------------------------------------------------
+//
+void CAOServer::ReleasePDPProperty()
+    {
+    LOG_1( _L("CAOServer::ReleasePDPProperty") );
+    
+    delete iPDPPropertySubscriber;
+    iPDPProperty.Delete(
+        KPDPContextManager2,
+        KPDPContextManagerFactorySettingsReset );
+    iPDPProperty.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// CAOServer::CreatePDPPropertyAndSubscribeL
+// ---------------------------------------------------------------------------
+//
+void CAOServer::CreatePDPPropertyAndSubscribeL()
+    {
+    LOG_1( _L("CAOServer::CreatePDPPropertyAndSubscribeL") );
+
+    // Define PDP property
+    TInt err = iPDPProperty.Define(
+        KPDPContextManager2,
+        KPDPContextManagerFactorySettingsReset,
+        RProperty::EInt,
+        KPDPAlwaysPass,
+        KPDPAlwaysPass,
+        0 );
+    LOG_2( _L("> Property define: %d"), err );
+    if ( err != KErrAlreadyExists )
+        {
+        User::LeaveIfError( err );
+        }
+    
+    // Attach to property
+    err = iPDPProperty.Attach(
+        KPDPContextManager2,
+        KPDPContextManagerFactorySettingsReset );
+    LOG_2( _L("> Property attach: %d"), err );
+    User::LeaveIfError( err );
+        
+    // Create property subscriber
+    iPDPPropertySubscriber = CAOAsyncWrapper<CAOServer>::NewL(
+        this,
+        &PDPPropertySubscriptionIssueRequest,
+        &PDPPropertySubscriptionRunL,
+        &PDPPropertySubscriptionDoCancel,
+        NULL );
+        
+    // Subscribe
+    IssuePDPPropertySubscription();
+    }
+
+// ---------------------------------------------------------------------------
+// CAOServer::SetupCallBack
+// ---------------------------------------------------------------------------
+//
+TInt CAOServer::SetupCallBack( TAny* aSelf )
+    {
+    LOG_1( _L("CAOServer::SetupCallBack") );
+    
+    CAOServer* server = static_cast<CAOServer*>( aSelf );
+    TRAPD( err, server->HandleSetup() );
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CAOServer::HandleSetupL
+// ---------------------------------------------------------------------------
+//
+void CAOServer::HandleSetup()
+    {
+    LOG_1( _L("CAOServer::HandleSetup") );
+    
+    iAsyncSetup->Cancel();
+    
+    // Fetch settings and network registration status
+    iSettings->FetchSettings();
+    iConnectionManager->FetchNetworkRegistrationStatus();
+    }
+
+// ---------------------------------------------------------------------------
+// CAOServer::ConfigureCustomAPIL
+// ---------------------------------------------------------------------------
+//
+void CAOServer::ConfigureCustomAPIL()
+    {
+    LOG_1( _L("CAOServer::ConfigureCustomAPIL") );
+    
+    // Connect tel server
+    // If not possible to load module and if it not already loaded
+    // no way to recover.
+    User::LeaveIfError( iTelServer.Connect() );
+    TInt err = iTelServer.LoadPhoneModule( KMmTsyModuleName() );
+    if ( err != KErrNone && err != KErrAlreadyExists )
+        {
+        User::Leave( KErrGeneral );
+        }
+
+    // Open mobile phone and custom API
+    User::LeaveIfError( iMobilePhone.Open( iTelServer, KMmTsyPhoneName() ) );
+    User::LeaveIfError( iCustomAPI.Open( iMobilePhone ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CAOServer::ConnectionManager
+// ---------------------------------------------------------------------------
+//
+MAOConnectionManager& CAOServer::ConnectionManager() const
+    {
+    LOG_1( _L("CAOServer::ConnectionManager") );
+    
+    return *iConnectionManager;
+    }
+
+// ---------------------------------------------------------------------------
+// CAOServer::Timer
+// ---------------------------------------------------------------------------
+//
+MAOTimer& CAOServer::Timer() const
+    {
+    LOG_1( _L("CAOServer::Timer") );
+    
+    return *iTimer;
+    }
+
+// ---------------------------------------------------------------------------
+// CAOServer::RAUManager
+// ---------------------------------------------------------------------------
+//
+MAORAUManager& CAOServer::RAUManager() const
+    {
+    LOG_1( _L("CAOServer::RAUManager") );
+    
+    return *iRAUManager;
+    }
+
+// ---------------------------------------------------------------------------
+// CAOServer::Settings
+// ---------------------------------------------------------------------------
+//
+MAOSettings& CAOServer::Settings() const
+    {
+    LOG_1( _L("CAOServer::Settings") );
+    
+    return *iSettings;
+    }
+
+// ---------------------------------------------------------------------------
+// CAOServer::Gpds
+// ---------------------------------------------------------------------------
+//
+MAOGpds& CAOServer::Gpds() const
+    {
+    LOG_1( _L("CAOServer::Gpds") );
+    
+    return *iGpds;
+    }
+
+// ---------------------------------------------------------------------------
+// CAOServer::ChangeState
+// ---------------------------------------------------------------------------
+//
+TAOState* CAOServer::ChangeState( TAOState::TAOStateName aState )
+    {
+    if ( !iCurrentState )
+        {
+        LOG_3( _L(
+            ">>>> CAOServer::ChangeState: Old state %S > New state %S <<<<" ),
+            &KStateNone, &StateToDesC( aState ) );
+        }
+    else
+        {
+        LOG_3( _L(
+            ">>>> CAOServer::ChangeState: Old state %S > New state %S <<<<" ),
+            &StateToDesC( CurrentState()->StateName() ),
+            &StateToDesC( aState ) );
+        }
+    
+    return (*iPointerStatePool)[aState];
+    }
+
+// ---------------------------------------------------------------------------
+// CAOServer::CurrentState
+// ---------------------------------------------------------------------------
+//
+TAOState* CAOServer::CurrentState() const
+    {
+    LOG_1( _L("CAOServer::CurrentState") );
+    
+    if( !iCurrentState )
+        {
+        LOG_1( _L("CAOServer::CurrentState is NULL !") );
+        }
+    
+    return iCurrentState;
+    }
+
+// ---------------------------------------------------------------------------
+// CAOServer::HandlePDPContextActivatedL
+// ---------------------------------------------------------------------------
+//
+void CAOServer::HandlePDPContextActivatedL()
+    {
+    LOG_1( _L("CAOServer::HandlePDPContextActivatedL") );
+    LOG_2( _L("> Current state: %S"),
+        &StateToDesC( CurrentState()->StateName() ) );
+    
+    TAOState* newState = iCurrentState->HandlePDPContextActivatedL();
+    if ( newState )
+        {
+        iCurrentState = newState;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAOServer::HandlePDPContextActivationFailedL
+// ---------------------------------------------------------------------------
+//
+void CAOServer::HandlePDPContextActivationFailedL(
+    MAOConnectionManager::TFailureReason aReason )
+    {
+    LOG_1( _L("CAOServer::HandlePDPContextActivationFailedL") );
+    LOG_2( _L("> Current state: %S"),
+        &StateToDesC( CurrentState()->StateName() ) );
+        
+    iActivationFailure = ETrue;
+    
+    TAOState* newState = iCurrentState->HandlePDPContextActivationFailedL();
+    if ( newState )
+        {
+        iCurrentState = newState;
+        
+        // If new state is disconnected we need synchronously change to new
+        // state depending from the failure reason
+        if ( CurrentState()->StateName() == TAOState::EStateDisconnected )
+            {
+            newState = iCurrentState->HandleSwitchFromDisconnectedL( 
+                                                                aReason );
+            }
+            
+        // Change state if new state received
+        if ( newState )
+            {
+            iCurrentState = newState;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAOServer::HandlePDPContextDisconnectedL
+// ---------------------------------------------------------------------------
+//
+void CAOServer::HandlePDPContextDisconnectedL(
+    MAOConnectionManager::TFailureReason aReason )
+    {
+    LOG_1( _L("CAOServer::HandlePDPContextDisconnectedL") );
+    LOG_2( _L("> Current state: %S"),
+        &StateToDesC( CurrentState()->StateName() ) );
+    
+    TAOState* newState =
+        iCurrentState->HandlePDPContextDisconnectedL( aReason );
+    if ( newState )
+        {
+        iCurrentState = newState;
+        
+        // If new state is disconnected we need synchronously change to new
+        // state depending from the failure reason
+        if ( CurrentState()->StateName() == TAOState::EStateDisconnected )
+            {
+            // Do asnyc re-activation to ensure old connection
+            // has really been closed
+            DoReactivation( aReason );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAOServer::HandlePDPContextTemporarilyBlockedL
+// ---------------------------------------------------------------------------
+//
+void CAOServer::HandlePDPContextTemporarilyBlockedL()
+    {
+    LOG_1( _L("CAOServer::HandlePDPContextTemporarilyBlockedL") );
+    LOG_2( _L("> Current state: %S"),
+        &StateToDesC( CurrentState()->StateName() ) );
+    
+    TAOState* newState = iCurrentState->HandlePDPContextTemporarilyBlockedL();
+    if ( newState )
+        {
+        iCurrentState = newState;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAOServer::HandleNWRegistrationStatusChangedL
+// ---------------------------------------------------------------------------
+//
+void CAOServer::HandleNWRegistrationStatusChangedL(
+    CTelephony::TRegistrationStatus /*aNetworkRegistration*/ )
+    {
+    LOG_1( _L("CAOServer::HandleNWRegistrationStatusChangedL") );
+    LOG_2( _L("> Current state: %S"),
+        &StateToDesC( CurrentState()->StateName() ) );
+    
+    // Get current network type from connection manager
+    MAOConnectionManager::TNetworkType nwType =
+        iConnectionManager->NetworkType();
+        
+    TAOState* newState = iCurrentState->HandleNetworkChangedL( nwType );
+    if ( newState )
+        {
+        iCurrentState = newState;
+        
+        // New state is 'starting'
+        if ( CurrentState()->StateName() == TAOState::EStateStarting )
+            {
+            newState = iCurrentState->HandleEnableAlwaysOnL();
+            }
+        // New state is 'disconnected'
+        else if ( CurrentState()->StateName() == TAOState::EStateDisconnected )
+            {
+            newState = iCurrentState->HandleSwitchFromDisconnectedL(
+                MAOConnectionManager::ETemporary );
+            }
+            
+        // Change state if new state received
+        if ( newState )
+            {
+            iCurrentState = newState;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAOServer::HandleConnectionDeletedL
+// ---------------------------------------------------------------------------
+//
+void CAOServer::HandleConnectionDeletedL( const TUint /*aConnectionId*/,
+                                          const TBool /*aForward*/ )
+    {
+    LOG_1( _L("CAOServer::HandleConnectionDeletedL") );
+    LOG_2( _L("> Current state: %S"),
+        &StateToDesC( CurrentState()->StateName() ) );
+        
+    // If we currently tried to activate PDP context and it has failed
+    // due temporary or permanent reason do not do anything with
+    // connection deleted notification since notification concerns
+    // the same connection that just failed to activate
+    if ( iActivationFailure )
+        {
+        LOG_1( _L("> Activation failure -> ignore") );
+        iActivationFailure = EFalse;
+        }
+    // If we have not already received disconnect message
+    else if ( !iAsyncReactivation->IsActive() )
+        {
+        LOG_1( _L("> Not an activation failure -> process") );
+        TAOState* newState = iCurrentState->HandleConnectionDeletedL();
+        if ( newState )
+            {
+            iCurrentState = newState;
+            
+            // If new state is disconnected
+            if ( CurrentState()->StateName() == TAOState::EStateDisconnected )
+                {
+                // Do async re-activation
+                DoReactivation( MAOConnectionManager::EDisconnected );
+                }
+            }
+        }
+    // Just to log
+    else
+        {
+        LOG_1( _L("> Already re-activating -> ignore") );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAOServer::HandleExternalConnectionCreatedL
+// ---------------------------------------------------------------------------
+//
+void CAOServer::HandleExternalConnectionCreatedL()
+    {
+    LOG_1( _L("CAOServer::HandleExternalConnectionCreatedL") );
+    LOG_2( _L("> Current state: %S"),
+        &StateToDesC( CurrentState()->StateName() ) );
+        
+    // End possible re-activation
+    iAsyncReactivation->Cancel();
+    TAOState* newState = iCurrentState->HandleExternalConnectionCreatedL();
+    if( newState )
+        {
+        iCurrentState = newState;
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// CAOServer::HandleInternalConnectionCreatedL
+// ---------------------------------------------------------------------------
+//    
+void CAOServer::HandleInternalConnectionCreatedL( const TUint /*aConnectionId*/,
+                                                  const TUint /*aIapId*/, 
+                                                  const TUint /*aNetId*/ )
+    {
+    }    
+
+// ---------------------------------------------------------------------------
+// CAOServer::HandleError
+// ---------------------------------------------------------------------------
+//
+void CAOServer::HandleError( TInt /*aError*/ )
+    {
+    LOG_1( _L("CAOServer::HandleError") );
+    LOG_2( _L("> Current state: %S"),
+        &StateToDesC( CurrentState()->StateName() ) );
+    
+    TAOState* newState = iCurrentState->HandleGeneralError();
+    if ( newState )
+        {
+        iCurrentState = newState;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAOServer::HandleRetryTimerExpiredL
+// ---------------------------------------------------------------------------
+//
+void CAOServer::HandleRetryTimerExpiredL()
+    {
+    LOG_1( _L("CAOServer::HandleRetryTimerExpiredL") );
+    LOG_2( _L("> Current state: %S"),
+        &StateToDesC( CurrentState()->StateName() ) );
+    
+    TAOState* newState = iCurrentState->HandleRetryTimerTriggeredL();
+    if ( newState )
+        {
+        iCurrentState = newState;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAOServer::HandleConnectionTimerExpiredL
+// ---------------------------------------------------------------------------
+//
+void CAOServer::HandleConnectionTimerExpiredL()
+    {
+    LOG_1( _L("CAOServer::HandleConnectionTimerExpiredL") );
+    LOG_2( _L("> Current state: %S"),
+        &StateToDesC( CurrentState()->StateName() ) );
+    
+    TAOState* newState = iCurrentState->HandleConnectionTimerTriggeredL();
+    if ( newState )
+        {
+        iCurrentState = newState;
+        
+        // Connection timer has trigered maximum amount -> start retry timer
+        if ( iCurrentState->StateName() == TAOState::EStateDisconnected )
+            {
+            newState = iCurrentState->HandleSwitchFromDisconnectedL(
+                MAOConnectionManager::ETemporary );
+            }
+            
+        // Change state if new state received
+        if ( newState )
+            {
+            iCurrentState = newState;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAOServer::HandleUnconnectTimerExpiredL
+// ---------------------------------------------------------------------------
+//
+void CAOServer::HandleUnconnectTimerExpiredL()
+    {
+    LOG_1( _L("CAOServer::HandleUnconnectTimerExpiredL") );
+    
+    TAOState* newState = iCurrentState->HandleUnconnectTimerExpiredL();
+    if( newState )
+        {
+        iCurrentState = newState;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAOServer::HandleSettingsChangedL
+// ---------------------------------------------------------------------------
+//
+void CAOServer::HandleSettingsChangedL()
+    {
+    LOG_1( _L("CAOServer::HandleSettingsChangedL") );
+
+    // Update retry timer value
+    iTimer->HandleSettingsChangedL();
+    
+    // Handle notification
+    TAOState* newState = iCurrentState->HandleSettingsReceivedL();
+
+    if ( newState )
+        {
+
+        LOG_2( _L("> newState1: %d"), newState->StateName() );
+    
+        iCurrentState = newState;
+        
+        if ( iCurrentState->StateName() == TAOState::EStateStarting )
+            {
+            // If new state is starting check if Always On should be enabled
+            // in current network
+            newState = iCurrentState->HandleEnableAlwaysOnL();
+            }
+            
+        // Change state if new state received
+        if ( newState )
+            {
+            LOG_2( _L("> newState2: %d"), newState->StateName() );
+            iCurrentState = newState;
+            }
+        else
+            {
+            LOG_1( _L("> New state is null2.") );
+            }
+        }
+     else
+        {
+        LOG_1( _L("> New state is null1.") );
+        }
+       
+    // Update linger objects    
+    iConnectionManager->HandleSettingsChangedL();    
+    }
+
+// ---------------------------------------------------------------------------
+// CAOServer::HandleSuccesfulRAUL
+// ---------------------------------------------------------------------------
+//
+void CAOServer::HandleSuccesfulRAUL( TRAUType /*aType*/ )
+    {
+    LOG_1( _L("CAOServer::HandleSuccesfulRAUL") );
+    LOG_2( _L("> Current state: %S"),
+        &StateToDesC( CurrentState()->StateName() ) );
+    
+    TAOState* newState = iCurrentState->HandleSuccesfulRAUEventL();
+    if ( newState )
+        {
+        iCurrentState = newState;
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CAOServer::InitStatePoolL
+// ---------------------------------------------------------------------------
+//
+void CAOServer::InitStatePoolL()
+    {
+    LOG_1( _L("CAOServer::InitStatePoolL") );
+
+    iPointerStatePool = new (ELeave) CArrayPtrFlat<TAOState>( TAOState::EStateLastItem );
+    
+    
+    TAOStateInit *stateInit = new (ELeave) TAOStateInit( *this, *this );
+    CleanupStack::PushL( stateInit );
+    iPointerStatePool->InsertL( TAOState::EStateInit, stateInit );
+    CleanupStack::Pop( stateInit );
+
+    TAOStateStarting *stateStarting = new (ELeave) TAOStateStarting( *this, *this );
+    CleanupStack::PushL( stateStarting );
+    iPointerStatePool->InsertL( TAOState::EStateStarting, stateStarting );
+    CleanupStack::Pop( stateStarting );
+
+    TAOStateDisabled *stateDisabled = new (ELeave) TAOStateDisabled( *this, *this );
+    CleanupStack::PushL( stateDisabled );
+    iPointerStatePool->InsertL( TAOState::EStateDisabled, stateDisabled );
+    CleanupStack::Pop( stateDisabled );
+    
+    TAOStateConnecting *stateConnecting = new (ELeave) TAOStateConnecting( *this, *this );
+    CleanupStack::PushL( stateConnecting );
+    iPointerStatePool->InsertL( TAOState::EStateConnecting, stateConnecting );
+    CleanupStack::Pop( stateConnecting );
+    
+    TAOState *stateConnected = new (ELeave) TAOStateConnected( *this, *this );
+    CleanupStack::PushL( stateConnected );
+    iPointerStatePool->InsertL( TAOState::EStateConnected, stateConnected );
+    CleanupStack::Pop( stateConnected );
+    
+    TAOState *stateDisconnected = new (ELeave) TAOStateDisconnected( *this, *this );
+    CleanupStack::PushL( stateDisconnected );
+    iPointerStatePool->InsertL( TAOState::EStateDisconnected, stateDisconnected );
+    CleanupStack::Pop( stateDisconnected );
+    
+    TAOState *stateWaiting = new (ELeave) TAOStateWaiting( *this, *this );
+    CleanupStack::PushL( stateWaiting );
+    iPointerStatePool->InsertL( TAOState::EStateWaiting, stateWaiting );
+    CleanupStack::Pop( stateWaiting );
+    
+    TAOState *stateUnconnected = new (ELeave) TAOStateUnconnected( *this, *this );
+    CleanupStack::PushL( stateUnconnected );
+    iPointerStatePool->InsertL( TAOState::EStateUnconnected, stateUnconnected );
+    CleanupStack::Pop( stateUnconnected );
+    
+    TAOState *stateResetFactorySettings = new (ELeave) TAOStateResetFactorySettings( *this, *this );
+    CleanupStack::PushL( stateResetFactorySettings );
+    iPointerStatePool->InsertL( TAOState::EStateResetFactorySettings, stateResetFactorySettings );
+    CleanupStack::Pop( stateResetFactorySettings );
+    
+    TAOState *stateExternalConnection = new (ELeave) TAOStateExternalConnection( *this, *this );
+    CleanupStack::PushL( stateExternalConnection );
+    iPointerStatePool->InsertL( TAOState::EStateExternalConnection, stateExternalConnection );
+    CleanupStack::Pop( stateExternalConnection );
+    
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/src/caosettings.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,571 @@
+/*
+* Copyright (c) 2004,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:  Implements the CAOSettings class
+*
+*/
+
+
+// INCLUDE FILES
+#include <centralrepository.h>
+
+#include "caosettings.h"
+#include "logger.h"
+#include "maosettingsobserver.h"
+#include "pdpcontextmanagerinternalcrkeys.h"
+
+// UNNAMED NAMESPACE FOR LOCAL DEFINITIONS
+namespace
+    {
+    // CONSTANTS
+#ifdef _DEBUG
+    _LIT( KPanicCat, "Settings" );
+#endif
+
+    // Default values    
+    const TInt  KDefaultRetryInterval      = 1;
+    const TInt  KDefaultIAPUid             = 1;
+    const TInt  KDefaultConnectionInterval = 25;
+    const TInt  KDefaultUnconnectInterval  = 25;
+    const TInt  KLingerOff                 = 0;
+    const TInt  KLingerForEver             = -1;
+    
+    const TUint KIapColumn                 = 0x00000100;
+    const TUint KLingerColumn              = 0x00000200;
+    
+    // DATA TYPES
+    enum TPanicCode
+        {
+        EAlreadyFetchingSettings,
+        ENotActive
+        };
+    
+    // LOCAL FUNCTIONS
+#ifdef _DEBUG
+    LOCAL_C void Panic( TPanicCode aCode )
+        {
+        User::Panic( KPanicCat, aCode );
+        }
+#endif
+    }
+
+// METHODS
+
+// ---------------------------------------------------------------------------
+// CAOSettings::NewL
+// ---------------------------------------------------------------------------
+//
+CAOSettings* CAOSettings::NewL( MAOSettingsObserver& aObserver )
+    {
+    LOG_1( _L("CAOSettings::NewL") );
+    
+    CAOSettings* self = new( ELeave ) CAOSettings( aObserver );
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CAOSettings::~CAOSettings
+// ---------------------------------------------------------------------------
+//
+CAOSettings::~CAOSettings()
+    {
+    LOG_1( _L("CAOSettings::~CAOSettings") );
+    
+    Cancel();
+    if ( iCenRepNotifyHandler )
+        {
+        iCenRepNotifyHandler->StopListening();
+        delete iCenRepNotifyHandler;
+        }
+    delete iRepository;
+    
+    iLingerSettings.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// CAOSettings::CAOSettings
+// ---------------------------------------------------------------------------
+//
+CAOSettings::CAOSettings( MAOSettingsObserver& aObserver ):
+    CActive( CActive::EPriorityStandard ),
+    iObserver( aObserver ),
+    iIAP( KDefaultIAPUid ),
+    iRetryTimerValue( KDefaultRetryInterval ),
+    iSupportedInHPLMN( EFalse ),
+    iSupportedInVPLMN( EFalse ),
+    iLingerTimerValue( KLingerOff )
+    {
+    LOG_1( _L("CAOSettings::CAOSettings") );
+    
+    CActiveScheduler::Add( this );
+    }
+
+// ---------------------------------------------------------------------------
+// CAOSettings::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CAOSettings::ConstructL()
+    {
+    LOG_1( _L("CAOSettings::ConstructL") );
+    
+    // Create cenrep
+    iRepository = CRepository::NewL( KCRUidPDPContextManager );
+    
+    // Create cenrep listener
+    iCenRepNotifyHandler = CCenRepNotifyHandler::NewL(
+        *this,
+        *iRepository );
+    iCenRepNotifyHandler->StartListeningL();
+    
+    // Get connection timer value
+    iConnectionTimerValue = KDefaultConnectionInterval;
+    UpdateConnectionTimerSetting();
+        
+    // Get unconnect timer value
+    iUnconnectTimerValue = KDefaultUnconnectInterval;
+    UpdateUnconnectTimerSetting();
+
+    }
+
+// ---------------------------------------------------------------------------
+// CAOSettings::FetchSettings
+// ---------------------------------------------------------------------------
+//
+void CAOSettings::FetchSettings( TUint32 aId )
+    {
+    LOG_2( _L("CAOSettings::FetchSettings: aId: %d"), aId );
+    
+    __ASSERT_DEBUG( !IsActive(), Panic( EAlreadyFetchingSettings ) );
+    
+    // Let just scheduler run and get settings when RunL is called
+    iSettingsToFetch = aId;
+    iStatus = KRequestPending;
+    SetActive();
+    CompleteSelf( iStatus, KErrNone );
+    }
+
+// ---------------------------------------------------------------------------
+// CAOSettings::RunL
+// ---------------------------------------------------------------------------
+//
+void CAOSettings::RunL()
+    {
+    LOG_2( _L("CAOSettings::RunL: iStatus: %d"), iStatus.Int() );
+    
+    // Currently we cannot complete with an error
+    SetupSettings( iSettingsToFetch );
+    iObserver.HandleSettingsChangedL();
+    }
+
+// ---------------------------------------------------------------------------
+// CAOSettings::DoCancel
+// ---------------------------------------------------------------------------
+//
+void CAOSettings::DoCancel()
+    {
+    LOG_1( _L("CAOSettings::DoCancel") );
+    
+    // We must complete pending request if needed
+    // Checking IsActive is not sufficient, we must check also
+    // iStatus
+    if ( iStatus == KRequestPending && IsActive() )
+        {
+        CompleteSelf( iStatus, KErrCancel );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAOSettings::RunError
+// ---------------------------------------------------------------------------
+//
+TInt CAOSettings::RunError( TInt /*aError*/ )
+    {
+    LOG_1( _L("CAOSettings::RunError") );
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CAOSettings::AccessPointId
+// ---------------------------------------------------------------------------
+//
+TInt CAOSettings::AccessPointId() const
+    {
+    LOG_1( _L("CAOSettings::AccessPointId") );
+    
+    return iIAP;
+    }
+
+// ---------------------------------------------------------------------------
+// CAOSettings::RetryTimerValue
+// ---------------------------------------------------------------------------
+//
+TInt CAOSettings::RetryTimerValue() const
+    {
+    LOG_1( _L("CAOSettings::RetryTimerValue") );
+    
+    return iRetryTimerValue;
+    }
+
+// ---------------------------------------------------------------------------
+// CAOSettings::AlwaysOnSupportedInHPLMN
+// ---------------------------------------------------------------------------
+//
+TBool CAOSettings::AlwaysOnSupportedInHPLMN() const
+    {
+    LOG_1( _L("CAOSettings::AlwaysOnSupportedInHPLMN") );
+    
+    return iSupportedInHPLMN;
+    }
+
+// ---------------------------------------------------------------------------
+// CAOSettings::AlwaysOnSupportedInVPLMN
+// ---------------------------------------------------------------------------
+//
+TBool CAOSettings::AlwaysOnSupportedInVPLMN() const
+    {
+    LOG_1( _L("CAOSettings::AlwaysOnSupportedInVPLMN") );
+    
+    return iSupportedInVPLMN;
+    }
+
+// ---------------------------------------------------------------------------
+// CAOSettings::ConnectionTimerValue
+// ---------------------------------------------------------------------------
+//
+TInt CAOSettings::ConnectionTimerValue() const
+    {
+    LOG_1( _L("CAOSettings::ConnectionTimerValue") );
+    
+    return iConnectionTimerValue;
+    }
+
+// ---------------------------------------------------------------------------
+// CAOSettings::UnconnectTimerValue
+// ---------------------------------------------------------------------------
+//
+TInt CAOSettings::UnconnectTimerValue() const
+    {
+    LOG_1( _L("CAOSettings::UnconnectTimerValue") );
+    
+    return iUnconnectTimerValue;
+    }
+    
+// ---------------------------------------------------------------------------
+// CAOSettings::LingerTimerValue
+// ---------------------------------------------------------------------------
+//
+TInt CAOSettings::LingerTimerValue( const TUint aIapId ) const
+    {
+    LOG_1( _L("CAOSettings::LingerTimerValue") );
+    
+    for ( TInt j=0; j < iLingerSettings.Count(); j++ )
+        {
+        if ( iLingerSettings[ j ].iIap == aIapId )
+            {
+            LOG_3( _L("Linger setting found >> iap: %d, interval: %d"),
+                   aIapId,
+                   iLingerSettings[ j ].iInterval);  
+        
+            if ( iLingerSettings[ j ].iInterval == 0 )
+                {
+                return KLingerForEver;    
+                }
+            else
+                {
+                return ( iLingerSettings[ j ].iInterval );    
+                }
+            }    
+        }
+        
+    LOG_2( _L("LingerTimerValue() not found >> iap: %d"),
+           aIapId );
+           
+    return KLingerOff; // Linger is off           
+    }    
+
+// ---------------------------------------------------------------------------
+// CAOSettings::HandleNotifyGeneric
+// ---------------------------------------------------------------------------
+//
+void CAOSettings::HandleNotifyGeneric( TUint32 aId )
+    {
+    LOG_2( _L("CAOSettings::HandleNotifyGeneric: aId: %d"), aId );
+    
+    switch ( aId )
+        {
+        // We are interested only in Always-On settings
+        case KPDPContextManagerDefaultUid:
+        case KPDPContextManagerRetryTimer:
+        case KPDPContextManagerConnectionTimer:
+        case KPDPContextManagerUnconnectTimer:
+        case KPDPContextManagerEnableWhenRoaming:
+        case KPDPContextManagerEnableWhenHome:
+            {
+            FetchSettings( aId );
+            break;
+            }
+        default:
+            {
+            if ( ( aId & KLingerColumn ) == KLingerColumn )
+                {
+                FetchSettings( KPDPContextManagerLinger );    
+                }
+            
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAOSettings::SetupSettings
+// ---------------------------------------------------------------------------
+//
+void CAOSettings::SetupSettings( TUint32 aId )
+    {
+    LOG_2( _L("CAOSettings::SetupSettings: aId: %d"), aId );
+    
+    switch ( aId )
+        {
+        case KPDPContextManagerDefaultUid:
+            {
+            UpdateIAPSetting();
+            break;
+            }
+        case KPDPContextManagerRetryTimer:
+            {
+            UpdateRetryTimerSetting();
+            break;
+            }
+        case KPDPContextManagerConnectionTimer:
+            {
+            UpdateConnectionTimerSetting();
+            break;
+            }
+        case KPDPContextManagerUnconnectTimer:
+            {
+            UpdateUnconnectTimerSetting();
+            break;
+            }
+        case KPDPContextManagerEnableWhenHome:
+            {
+            UpdateHPLMNSetting();
+            break;
+            }
+        case KPDPContextManagerEnableWhenRoaming:
+            {
+            UpdateVPLMNSetting();
+            break;
+            }
+        case KPDPContextManagerLinger:
+            {
+            UpdateLingerTimerSetting();
+            break;
+            }    
+        default:
+            {
+            // Set all
+            UpdateIAPSetting();
+            UpdateRetryTimerSetting();
+            UpdateConnectionTimerSetting();
+            UpdateUnconnectTimerSetting();
+            UpdateHPLMNSetting();
+            UpdateVPLMNSetting();
+            UpdateLingerTimerSetting();
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAOSettings::CompleteSelf
+// ---------------------------------------------------------------------------
+//
+void CAOSettings::CompleteSelf( TRequestStatus& aStatus, TInt aReason )
+    {
+    LOG_1( _L("CAOSettings::CompleteSelf") );
+    
+    __ASSERT_DEBUG( IsActive(), Panic( ENotActive ) );
+    
+    TRequestStatus* status = &aStatus;
+    User::RequestComplete( status, aReason );
+    }
+
+// ---------------------------------------------------------------------------
+// CAOSettings::UpdateIAPSetting
+// ---------------------------------------------------------------------------
+//
+void CAOSettings::UpdateIAPSetting()
+    {
+    LOG_2( _L("CAOSettings::UpdateIAPSettingL >> Old value: %d"), iIAP );
+    
+    UpdateSetting( KPDPContextManagerDefaultUid, iIAP );
+        
+    LOG_2( _L("CAOSettings::UpdateIAPSettingL >> New value: %d"), iIAP );
+    }
+
+// ---------------------------------------------------------------------------
+// CAOSettings::UpdateRetryTimerSetting
+// ---------------------------------------------------------------------------
+//
+void CAOSettings::UpdateRetryTimerSetting()
+    {
+    LOG_2( _L("CAOSettings::UpdateRetryTimerSetting >> Old value: %d"),
+        iRetryTimerValue );
+        
+    UpdateSetting( KPDPContextManagerRetryTimer, iRetryTimerValue );
+        
+    LOG_2( _L("CAOSettings::UpdateRetryTimerSetting >> New value: %d"),
+        iRetryTimerValue );
+    }
+
+// ---------------------------------------------------------------------------
+// CAOSettings::UpdateConnectionTimerSetting
+// ---------------------------------------------------------------------------
+//
+void CAOSettings::UpdateConnectionTimerSetting()
+    {
+    LOG_2( _L("CAOSettings::UpdateConnectionTimerSetting >> Old value: %d"),
+        iConnectionTimerValue );
+        
+    UpdateSetting( KPDPContextManagerConnectionTimer, iConnectionTimerValue );
+        
+    LOG_2( _L("CAOSettings::UpdateConnectionTimerSetting >> New value: %d"),
+        iConnectionTimerValue );
+    }
+
+// ---------------------------------------------------------------------------
+// CAOSettings::UpdateUnconnectTimerSetting
+// ---------------------------------------------------------------------------
+//
+void CAOSettings::UpdateUnconnectTimerSetting()
+    {
+    LOG_2( _L("CAOSettings::UpdateUnconnectTimerSetting >> Old value: %d"),
+        iUnconnectTimerValue );
+        
+    UpdateSetting( KPDPContextManagerUnconnectTimer, iUnconnectTimerValue );
+        
+    LOG_2( _L("CAOSettings::UpdateUnconnectTimerSetting >> New value: %d"),
+        iUnconnectTimerValue );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CAOSettings::UpdateHPLMNSetting
+// ---------------------------------------------------------------------------
+//
+void CAOSettings::UpdateHPLMNSetting()
+    {
+    LOG_2( _L("CAOSettings::UpdateHPLMNSetting >> Old value: %d"),
+        iSupportedInHPLMN );
+        
+    UpdateSetting( KPDPContextManagerEnableWhenHome, iSupportedInHPLMN );
+        
+    LOG_2( _L("CAOSettings::UpdateHPLMNSetting >> New value: %d"),
+        iSupportedInHPLMN );
+    }
+
+// ---------------------------------------------------------------------------
+// CAOSettings::UpdateVPLMNSetting
+// ---------------------------------------------------------------------------
+//
+void CAOSettings::UpdateVPLMNSetting()
+    {
+    LOG_2( _L("CAOSettings::UpdateVPLMNSetting >> Old value: %d"),
+        iSupportedInVPLMN );
+        
+    UpdateSetting( KPDPContextManagerEnableWhenRoaming, iSupportedInVPLMN );
+        
+    LOG_2( _L("CAOSettings::UpdateVPLMNSetting >> New value: %d"),
+        iSupportedInVPLMN );
+    }
+
+// ---------------------------------------------------------------------------
+// CAOSettings::UpdateLingerTimerSetting
+// ---------------------------------------------------------------------------
+//
+void CAOSettings::UpdateLingerTimerSetting()
+    {
+    LOG_1( _L("CAOSettings::UpdateLingerTimerSetting"));
+        
+    TInt           count( 0 );
+    TInt           err( KErrNone );
+    TLingerSetting ls;
+        
+    iLingerSettings.Reset();
+    
+    // Get number of entries (iapId&linger) in Centrep
+    err = iRepository->Get( KPdpContextManagerLingerArrayCount, count );
+        
+    if ( err == KErrNone )
+        {
+        // read all entries from Centrep
+        for ( TInt row=1; row <= count; row++ )
+            {
+            err = iRepository->Get( ( KIapColumn | row ), ls.iIap ); 
+        
+            if ( err == KErrNone )
+                {
+                err = iRepository->Get( ( KLingerColumn | row ), ls.iInterval );     
+                }
+                
+            if ( err == KErrNone ) 
+                {
+                iLingerSettings.Append( ls );    
+                }
+            else
+                {
+                LOG_3( _L("CRepository::Get() failed >> err: %d, row: %d"),
+                err, row);
+                
+                return;        
+                }    
+            }
+        }
+    else
+        {
+        LOG_2( _L("CRepository::Get( KPdpContextManagerLingerArrayCount) >> err: %d"),
+                err);       
+        }        
+      
+    // Write to log    
+    for ( TInt j=0; j < iLingerSettings.Count(); j++ )
+        {
+        LOG_3( _L("iLingerSettings >> iap: %d, interval: %d"),
+        iLingerSettings[ j ].iIap,
+        iLingerSettings[ j ].iInterval);    
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAOSettings::UpdateSetting
+// ---------------------------------------------------------------------------
+//
+void CAOSettings::UpdateSetting( TUint32 aId, TInt& aValue )
+    {
+    LOG_2( _L("CAOSettings::UpdateSetting: %d"), aId );
+
+    TInt value = 0;
+    TInt err = iRepository->Get( aId, value );
+    if ( err == KErrNone )
+        {
+        // New value got, store it
+        aValue = value;
+        }
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/src/caotimer.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,356 @@
+/*
+* Copyright (c) 2004,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:  Implements the CAOTimer class
+*
+*/
+
+
+// INCLUDE FILES
+#include "caotimer.h"
+#include "logger.h"
+#include "maotimerobserver.h"
+#include "maosettings.h"
+#include "pdpcontextmanagerinternalcrkeys.h"
+
+// UNNAMED NAMESPACE FOR LOCAL DEFINITIONS
+namespace
+    {
+    // CONSTANTS
+#ifdef _DEBUG
+    _LIT( KPanicCat, "Timer" );
+#endif
+    const TInt KSecondsToMicro = 1000000; // one second
+    const TInt KMaxTimerInSeconds = 1800; // 30 minutes
+    
+    // DATA TYPES
+    enum TPanicReason
+        {
+        ERetryTimerAlreadyActive,
+        EConnectionTimerAlreadyActive,
+        EUnconnectTimerAlreadyActive
+        };
+    
+    // LOCAL FUNCTIONS
+#ifdef _DEBUG
+    LOCAL_C void Panic( TPanicReason aReason )
+        {
+        User::Panic( KPanicCat, aReason );
+        }
+#endif
+    }
+
+// METHODS
+
+// ---------------------------------------------------------------------------
+// CAOTimer::NewL
+// ---------------------------------------------------------------------------
+//
+CAOTimer* CAOTimer::NewL( MAOTimerObserver& aObserver,
+                          MAOSettings& aSettings )
+    {
+    LOG_1( _L("CAOTimer::NewL") );
+    
+    CAOTimer* self = new( ELeave ) CAOTimer( aObserver, aSettings );
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CAOTimer::~CAOTimer
+// ---------------------------------------------------------------------------
+//
+CAOTimer::~CAOTimer()
+    {
+    LOG_1( _L("CAOTimer::~CAOTimer") );
+    
+    delete iUnconnectTimer;
+    delete iConnectionTimer;
+    delete iRetryTimer;
+    }
+
+// ---------------------------------------------------------------------------
+// CAOTimer::HandleSettingsChangedL
+// ---------------------------------------------------------------------------
+//
+void CAOTimer::HandleSettingsChangedL()
+    {
+    LOG_1( _L("CAOTimer::HandleSettingsChangedL") );
+    
+    // Nothing to do
+    }
+
+// ---------------------------------------------------------------------------
+// CAOTimer::StartRetryTimer
+// ---------------------------------------------------------------------------
+//
+void CAOTimer::StartRetryTimer()
+    {
+    LOG_1( _L("CAOTimer::StartRetryTimer") );
+    
+    __ASSERT_DEBUG( !iRetryTimer->IsActive(),
+        Panic( ERetryTimerAlreadyActive ) );
+        
+    iRetryTimerCount = 0;
+    
+    // First check if the current retry timer value is more than 30 minutes
+    iCurrentRetryTimerInterval = 0;
+    if( iSettings.RetryTimerValue() > KMaxTimerInSeconds )
+        {
+        // First interval is 30 minutes
+        iCurrentRetryTimerInterval = KMaxTimerInSeconds * KSecondsToMicro;
+        }
+    else
+        {
+        // use current value
+        iCurrentRetryTimerInterval =
+            iSettings.RetryTimerValue() * KSecondsToMicro;
+        }
+    
+    TCallBack cb( RetryTimerCallBack, this );
+    iRetryTimer->Start(
+        iCurrentRetryTimerInterval, iCurrentRetryTimerInterval, cb );
+    }
+
+// ---------------------------------------------------------------------------
+// CAOTimer::StartConnectionTimer
+// ---------------------------------------------------------------------------
+//
+void CAOTimer::StartConnectionTimer()
+    {
+    LOG_1( _L("CAOTimer::StartConnectionTimer") );
+    
+    __ASSERT_DEBUG( !iConnectionTimer->IsActive(),
+        Panic( EConnectionTimerAlreadyActive ) );
+        
+    TInt interval = ConfigureInterval( iSettings.ConnectionTimerValue() );
+    TCallBack cb( ConnectionTimerCallBack, this );
+    iConnectionTimer->Start( interval, interval, cb );
+    }
+
+// ---------------------------------------------------------------------------
+// CAOTimer::StopRetryTimer
+// ---------------------------------------------------------------------------
+//
+void CAOTimer::StopRetryTimer()
+    {
+    LOG_1( _L("CAOTimer::StopRetryTimer") );
+    
+    iRetryTimer->Cancel();
+    }
+
+// ---------------------------------------------------------------------------
+// CAOTimer::StopConnectionTimer
+// ---------------------------------------------------------------------------
+//
+void CAOTimer::StopConnectionTimer()
+    {
+    LOG_1( _L("CAOTimer::StopConnectionTimer") );
+    
+    iConnectionTimer->Cancel();
+    }
+
+// ---------------------------------------------------------------------------
+// CAOTimer::StartUnconnectTimer
+// ---------------------------------------------------------------------------
+//
+void CAOTimer::StartUnconnectTimer()
+    {
+    LOG_1( _L("CAOTimer::StartUnconnectTimer") );
+
+    __ASSERT_DEBUG( !iUnconnectTimer->IsActive(),
+        Panic( EUnconnectTimerAlreadyActive ) );
+    
+    TInt interval = ConfigureInterval( iSettings.UnconnectTimerValue() );
+    TCallBack cb( UnconnectTimerCallBack, this );
+    iUnconnectTimer->Start( interval, interval, cb );
+    }
+
+// ---------------------------------------------------------------------------
+// CAOTimer::StopUnconnectTimer
+// ---------------------------------------------------------------------------
+//
+void CAOTimer::StopUnconnectTimer()
+    {
+    LOG_1( _L("CAOTimer::StopUnconnectTimer") );
+    
+    iUnconnectTimer->Cancel();
+    }
+
+// ---------------------------------------------------------------------------
+// CAOTimer::RetryTimerDisabled
+// ---------------------------------------------------------------------------
+//
+TBool CAOTimer::RetryTimerDisabled() const
+    {
+    LOG_1( _L("CAOTimer::RetryTimerDisabled") );
+    
+    return iSettings.RetryTimerValue() == 0;
+    }
+
+// ---------------------------------------------------------------------------
+// CAOTimer::UnconnectTimerDisabled
+// ---------------------------------------------------------------------------
+//
+TBool CAOTimer::UnconnectTimerDisabled() const
+    {
+    LOG_1( _L("CAOTimer::UnconnectTimerDisabled") );
+    
+    return iSettings.UnconnectTimerValue() == 0;
+    }
+
+// ---------------------------------------------------------------------------
+// CAOTimer::CAOTimer
+// ---------------------------------------------------------------------------
+//
+CAOTimer::CAOTimer( MAOTimerObserver& aObserver, MAOSettings& aSettings ):
+    iObserver( aObserver ),
+    iSettings( aSettings )
+    {
+    LOG_1( _L("CAOTimer::CAOTimer") );
+    }
+
+// ---------------------------------------------------------------------------
+// CAOTimer::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CAOTimer::ConstructL()
+    {
+    LOG_1( _L("CAOTimer::ConstructL") );
+    
+    // Create timers
+    iRetryTimer = CPeriodic::NewL( CActive::EPriorityStandard );
+    iConnectionTimer = CPeriodic::NewL( CActive::EPriorityStandard );
+    iUnconnectTimer = CPeriodic::NewL( CActive::EPriorityStandard );
+    }
+
+// ---------------------------------------------------------------------------
+// CAOTimer::RetryTimerCallBack
+// ---------------------------------------------------------------------------
+//
+TInt CAOTimer::RetryTimerCallBack( TAny* aSelf )
+    {
+    LOG_1( _L("CAOTimer::RetryTimerCallBack") );
+    
+    CAOTimer* self = static_cast<CAOTimer*>( aSelf );
+    TRAPD( err, self->HandleRetryTimerCallBackL() );
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CAOTimer::ConnectionTimerCallBack
+// ---------------------------------------------------------------------------
+//
+TInt CAOTimer::ConnectionTimerCallBack( TAny* aSelf )
+    {
+    LOG_1( _L("CAOTimer::ConnectionTimerCallBack") );
+    
+    CAOTimer* self = static_cast<CAOTimer*>( aSelf );
+    self->StopConnectionTimer();
+    TRAPD( err, self->iObserver.HandleConnectionTimerExpiredL() );
+    return err;
+    }
+    
+// ---------------------------------------------------------------------------
+// CAOTimer::HandleRetryTimerCallBackL
+// ---------------------------------------------------------------------------
+//
+void CAOTimer::HandleRetryTimerCallBackL()
+    {
+    LOG_1( _L("CAOTimer::HandleRetryTimerCallBackL") );
+    
+    // Stop retry timer and increase timer count
+    iRetryTimerCount++;
+    StopRetryTimer();
+    
+    // Check if we still need to continue
+    // If retry timer has been set longer than 30min
+    TInt currentlyRanInSec = ( iCurrentRetryTimerInterval / KSecondsToMicro ) 
+         + ( ( iRetryTimerCount - 1 ) * KMaxTimerInSeconds );
+    if( iSettings.RetryTimerValue() != currentlyRanInSec )
+        {
+        // Get remaining time in seconds
+        TInt timeRemainingInSec =
+            iSettings.RetryTimerValue() - currentlyRanInSec;
+            
+        // Check if remaining time is longer than 30 minutes
+        if ( timeRemainingInSec > KMaxTimerInSeconds )
+            {
+            // Current interval is 30 minutes
+            iCurrentRetryTimerInterval = KMaxTimerInSeconds * KSecondsToMicro;
+            }
+        else
+            {
+            // use time that is left
+            iCurrentRetryTimerInterval = timeRemainingInSec * KSecondsToMicro;
+            }
+            
+        // Restart timer
+        TCallBack cb( RetryTimerCallBack, this );
+        if( !iRetryTimer->IsActive())
+            {
+            
+            iRetryTimer->Start(
+                iCurrentRetryTimerInterval, iCurrentRetryTimerInterval, cb );
+            }
+        }
+    else
+        {
+        // Retry timer expired, notify observer
+        iObserver.HandleRetryTimerExpiredL();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAOTimer::UnconnectTimerCallBack
+// ---------------------------------------------------------------------------
+//
+TInt CAOTimer::UnconnectTimerCallBack( TAny* aSelf )
+    {
+    LOG_1( _L("CAOTimer::UnconnectTimerCallBack") );
+    
+    CAOTimer* self = static_cast<CAOTimer*>( aSelf );
+    self->StopUnconnectTimer();
+    TRAPD( err, self->iObserver.HandleUnconnectTimerExpiredL() );
+    
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CAOTimer::ConfigureInterval
+// ---------------------------------------------------------------------------
+//
+TInt CAOTimer::ConfigureInterval( const TInt& aIntervalInSec )
+    {
+    LOG_2( _L("CAOTimer::ConfigureInterval: aIntervalInSec: %d"),
+        aIntervalInSec );
+        
+    // Interval maximum value is 30 minutes
+    TInt interval = 0;
+    if( aIntervalInSec > KMaxTimerInSeconds )
+        {
+        interval = KMaxTimerInSeconds * KSecondsToMicro;
+        }
+    else
+        {
+        interval = aIntervalInSec * KSecondsToMicro;
+        }
+        
+    return interval;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/src/linger.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,541 @@
+/*
+* 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:  This module implements linger functionality for not-always-on 
+*                connections.
+*
+*/
+
+
+#include "linger.h"
+#include "logger.h"
+#include "maosettings.h"
+
+const TInt KSecondsToMicro         = 1000000; // one second
+const TInt KDataInactivityInterval = 30;      // 30 seconds
+const TInt KMaxTimerInSeconds      = 1800;    // 30 minutes
+
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// ---------------------------------------------------------------------------
+// CLingerConnection::CLingerConnection
+// ---------------------------------------------------------------------------
+//
+CLingerConnection::CLingerConnection( TUint           aConnectionId,
+                                      TConnectionInfo aConnectionInfo,
+                                      MAOSettings&    aSettings, 
+                                      RSocketServ*    aSocketServ) :
+    iConnectionId( aConnectionId ),
+    iConnectionInfo( aConnectionInfo ),
+    iSettings( aSettings ),
+    iSocketServ( aSocketServ ),
+    iLingering( EFalse ),
+    iAttached( EFalse ),
+    iDlData( 0 ),
+    iPckgDlData( iDlData ),
+    iUlData( 0 ),
+    iPckgUlData( iUlData )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CLingerConnection::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CLingerConnection::ConstructL()
+    {
+    LOG_1( _L("CLingerConnection::ConstructL") );         
+    
+    // Create timer
+    iTimer = CPeriodic::NewL( CActive::EPriorityStandard );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CLingerConnection::NewL
+// ---------------------------------------------------------------------------
+//
+CLingerConnection* CLingerConnection::NewL( TUint           aConnectionId,
+                                            TConnectionInfo aConnectionInfo, 
+                                            MAOSettings&    aSettings, 
+                                            RSocketServ*    aSocketServ)
+    {
+    LOG_1( _L("CLingerConnection::NewL") );
+    
+    CLingerConnection* self = CLingerConnection::NewLC( aConnectionId,
+                                                        aConnectionInfo,
+                                                        aSettings, 
+                                                        aSocketServ );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CLingerConnection::NewLC
+// ---------------------------------------------------------------------------
+//
+CLingerConnection* CLingerConnection::NewLC( TUint           aConnectionId,
+                                             TConnectionInfo aConnectionInfo,
+                                             MAOSettings&    aSettings, 
+                                             RSocketServ*    aSocketServ)
+    {
+    LOG_1( _L("CLingerConnection::NewLC") );
+    
+    CLingerConnection* self = new( ELeave ) CLingerConnection ( aConnectionId,
+                                                                aConnectionInfo,
+                                                                aSettings, 
+                                                                aSocketServ );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ~CLingerConnection
+// ---------------------------------------------------------------------------
+//
+CLingerConnection::~CLingerConnection()
+    {
+    LOG_1( _L("CLingerConnection::~CLingerConnection") );
+    
+    // Cancel timer
+    CancelTimer();
+    
+    // Delete timer
+    delete iTimer;
+    
+    // Close RConnection object
+    CloseConnection();
+    }
+
+// ---------------------------------------------------------------------------
+// CLingerConnection::StartLinger
+// ---------------------------------------------------------------------------
+//
+TInt CLingerConnection::StartLinger()
+    {
+    LOG_1( _L("CLingerConnection::StartLinger") );
+    
+    if ( !iAttached )
+        {    
+        // Read settings    
+        ReadSettings();
+         
+        if ( iLingerInterval != 0 )
+            {
+            TInt err = OpenAndAttach();
+
+            if ( err != KErrNone )
+                {
+                // Write to log
+                LOG_2( _L("OpenAndAttach: err: %d"), err );    
+                return( err );
+                }
+        
+            if ( iLingerInterval > 0 )
+                {
+                // Start timer
+                StartTimer( KDataInactivityInterval );
+            
+                LOG_1( _L("Linger timer started OK") );    
+                }
+            
+            }
+        }
+        
+    return KErrNone;                  
+    }
+ 
+// ---------------------------------------------------------------------------
+// CLingerConnection::StopLinger
+// ---------------------------------------------------------------------------
+//
+void CLingerConnection::StopLinger()
+    {
+    LOG_1( _L("CLingerConnection::StopLinger") );
+    
+    if ( iAttached )
+        {    
+        CancelTimer();
+        CloseConnection();           
+        iLingering = EFalse;
+        
+        LOG_1( _L("Linger timer stopped") );
+        }      
+    }
+    
+// ---------------------------------------------------------------------------
+// CLingerConnection::StopConnection
+// ---------------------------------------------------------------------------
+//
+TInt CLingerConnection::StopConnection()
+    {
+    LOG_1( _L("CLingerConnection::StopConnection") );
+    
+    if ( !iAttached )
+        {
+        return KErrNotSupported;
+        }
+    
+    // Must first stop connection    
+    TInt err = iConnection.Stop( RConnection::EStopAuthoritative );
+
+    // Stop linger & close handles
+    if ( err == KErrNone )
+        {
+        StopLinger();
+        }
+        
+    return err;                
+    }
+    
+// ---------------------------------------------------------------------------
+// CLingerConnection::HandleSettingsChanged
+// ---------------------------------------------------------------------------
+//
+void CLingerConnection::HandleSettingsChanged()
+    {
+    LOG_1( _L("CLingerConnection::HandleSettingsChangedL") );
+    
+    TInt oldLingerInterval( iLingerInterval );
+    
+    ReadSettings();
+   
+    if ( iLingerInterval != oldLingerInterval )
+        {
+        if ( iLingerInterval == 0 )
+            {
+            // Linger was turned off
+            StopLinger();
+            return; 
+            }
+        
+        if ( iLingering )
+            {          
+            if ( iLingerInterval > 0 )
+                {
+                // Linger timer has a new positive value
+                CancelTimer();
+                StartTimer( iLingerInterval );
+                }
+            else
+                {
+                // Linger timer has a new negative value
+                // -> linger forever
+                CancelTimer();
+                iLingering = EFalse; 
+                }        
+            }
+        else if ( iAttached )
+            {
+            if ( ( oldLingerInterval > 0 ) && ( iLingerInterval < 0 ) )
+                {
+                // Linger timer has a new negative value
+                // -> linger forever
+                CancelTimer();     
+                }
+            else if ( ( oldLingerInterval < 0 ) && ( iLingerInterval > 0 ) )
+                {
+                // Linger timer has a new positive value
+                CancelTimer();
+                StartTimer( KDataInactivityInterval );
+                }      
+            }    
+        else // not attached, not lingering
+            {
+            StartLinger();
+            }        
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// CLingerConnection::Status
+// ---------------------------------------------------------------------------
+//
+TInt CLingerConnection::Status()
+    {        
+    if ( iLingering )
+        {
+        return ELingerRunning;    
+        }
+    else if ( iAttached )
+        {
+        return ELingerAttached;    
+        }
+    else
+        {
+        return ELingerStopped;    
+        }    
+    }
+
+// ---------------------------------------------------------------------------
+// CLingerConnection::OpenAndAttach
+// ---------------------------------------------------------------------------
+//
+TInt CLingerConnection::OpenAndAttach()
+    {
+    LOG_1( _L("CLingerConnection::OpenAndAttach") );
+    
+    if ( !iAttached )
+        {        
+        // Open
+        TInt err = iConnection.Open( *iSocketServ, KAfInet );
+
+        if ( err != KErrNone )
+            {
+            return ( err );
+            }
+    
+        // Attach to keep the connection open
+        err = iConnection.Attach( TPckg< TConnectionInfo >( iConnectionInfo ), 
+                                  RConnection::EAttachTypeNormal );
+                              
+        if ( err != KErrNone )
+            {
+            iConnection.Close();
+            return ( err );
+            }
+        
+        iAttached = ETrue;    
+        }
+            
+    return KErrNone;    
+    }
+        
+// ---------------------------------------------------------------------------
+// CLingerConnection::CloseConnection
+// ---------------------------------------------------------------------------
+//
+void CLingerConnection::CloseConnection()
+    {
+    LOG_1( _L("CLingerConnection::CloseConnection") );
+    
+    // Close RConnection object
+    if ( iAttached )
+        {
+        iConnection.Close();
+        
+        // To really close: re-open & re-close
+        TInt err = iConnection.Open( *iSocketServ, KAfInet );
+
+        if ( err == KErrNone )
+            {
+            iConnection.Close();
+            }
+            
+        iAttached = EFalse;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CLingerConnection::IsConnectionIdle
+// ---------------------------------------------------------------------------
+//
+TBool CLingerConnection::IsConnectionIdle()
+    {
+    LOG_1( _L("CLingerConnection::IsConnectionIdle") );
+    
+    TUint currentDlData( iDlData );
+    TUint currentUlData( iUlData );
+    
+    if ( !iAttached )
+        {
+        return ETrue;
+        }
+        
+    LOG_2( _L("old Uplink data volume: %d"), currentUlData );
+    LOG_2( _L("old Downlink data volume: %d"), currentDlData );    
+               
+    // get new data volumes from ESock
+    iDlData = 0;
+    iUlData = 0;
+    
+    TRequestStatus status( KErrNone );
+           
+    iConnection.DataTransferredRequest( iPckgUlData, iPckgDlData, status );
+    
+    User::WaitForRequest( status );
+    
+    LOG_2( _L("new Uplink data volume: %d"), iUlData );
+    LOG_2( _L("new Downlink data volume: %d"), iDlData );    
+    
+    if ( status == KErrNone )
+        {
+        if ( ( iUlData == currentUlData ) && ( iDlData == currentDlData  ) )
+            {
+            return ETrue;    
+            }
+        else
+            {
+            return EFalse;    
+            }    
+        }
+    else
+        {
+        return EFalse;   
+        }    
+    }
+
+// ---------------------------------------------------------------------------
+// CLingerConnection::ReadSettings
+// ---------------------------------------------------------------------------
+//
+void CLingerConnection::ReadSettings()
+    {
+    LOG_1( _L("CLingerConnection::ReadSettings") );
+    
+    iLingerInterval = iSettings.LingerTimerValue( iConnectionInfo.iIapId );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CLingerConnection::StartTimer()
+// ---------------------------------------------------------------------------
+//
+void CLingerConnection::StartTimer( TInt aTimerInterval, TBool aReset )
+    {
+    LOG_1( _L("CLingerConnection::StartTimer") );
+    
+    if ( aReset )
+        {
+        iLingerTimerCount = 0;
+        }
+    
+    TCallBack cb( TimerCallBack, this );
+
+    // if linger timer is negative we should not start timer but linger forever...
+    if ( iLingerInterval > 0 )
+        {
+        LOG_2( _L("iTimer->Start: aTimerInterval: %d"), aTimerInterval );
+        
+        if( aTimerInterval > KMaxTimerInSeconds )
+            {
+            // Maximum allowed interval is 30 minutes.
+            // This restriction comes from TTimeIntervalMicroSeconds32
+            iCurrentTimerInterval = KMaxTimerInSeconds;
+            }
+        else
+            {
+            // use current value
+            iCurrentTimerInterval = aTimerInterval;
+            }    
+    
+        LOG_2( _L("iTimer->Start: iCurrentTimerInterval: %d"), iCurrentTimerInterval );
+        CancelTimer();
+        iTimer->Start( ( iCurrentTimerInterval * KSecondsToMicro ), 
+                       ( iCurrentTimerInterval * KSecondsToMicro ), 
+                       cb );    
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CLingerConnection::CancelTimer()
+// ---------------------------------------------------------------------------
+//
+void CLingerConnection::CancelTimer()
+    {
+    LOG_1( _L("CLingerConnection::CancelTimer") );
+    
+    if( iTimer->IsActive() )
+        {
+        iTimer->Cancel();  
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CLingerConnection::TimerCallBack
+// ---------------------------------------------------------------------------
+//
+TInt CLingerConnection::TimerCallBack( TAny* aSelf )
+    {
+    LOG_1( _L("CLingerConnection::TimerCallBack") );
+    
+    CLingerConnection* self = static_cast< CLingerConnection* >( aSelf );
+    
+    if ( self->iLingering )
+        {
+        // Maximum allowed timer interval is 30 min
+        // This restriction comes from TTimeIntervalMicroSeconds32 
+        self->iLingerTimerCount++;
+        
+        TInt currentlyRanInSec = 
+        self->iCurrentTimerInterval + ( ( self->iLingerTimerCount - 1 ) * KMaxTimerInSeconds );
+         
+        if( self->iLingerInterval != currentlyRanInSec )
+            {
+            // Get remaining time in seconds
+            TInt timeRemainingInSec = self->iLingerInterval - currentlyRanInSec;
+                
+            // Check if remaining time is longer than 30 minutes
+            if ( timeRemainingInSec > KMaxTimerInSeconds )
+                {
+                // Current interval is 30 minutes
+                self->iCurrentTimerInterval = KMaxTimerInSeconds;
+                }
+            else
+                {
+                // use time that is left
+                self->iCurrentTimerInterval = timeRemainingInSec;
+                }
+            
+            // Restart timer to reach iLingerInterval    
+            self->iTimer->Cancel();
+            self->StartTimer( self->iCurrentTimerInterval, EFalse );
+            
+            return  KErrNone;       
+            }
+        }        
+    
+    if ( self->IsConnectionIdle() )
+        {
+        if ( self->iLingering )
+            {
+            // Connection has been idle during lingering period e.g. 60 min.
+            // Stop connection.
+            TInt err = self->StopConnection();
+    
+            if ( err == KErrNone )
+                {
+                self->iTimer->Cancel();
+                self->iLingering = EFalse;
+                }    
+            }
+        else
+            {
+            // Connection has been idle during data inactivity period e.g 30 s. 
+            // Start lingering timer.
+            self->iTimer->Cancel();
+            self->StartTimer( self->iLingerInterval );
+            self->iLingering = ETrue;   
+            }    
+        }
+    else
+        {
+        // There was data trasfer through the connection
+        if ( self->iLingering )
+            {
+            // Start monitoring data transfer with KDataInactivityInterval
+            // if connection was already in lingering mode. 
+            self->iTimer->Cancel();
+            self->StartTimer( KDataInactivityInterval );
+            self->iLingering = EFalse;   
+            }        
+        }    
+    
+    return KErrNone;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/src/pdpcontextmanager2.rss	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2002 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 <eikon.rh>
+#include <avkon.loc>
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.hrh>
+#include <avkon.mbg>
+
+NAME AOEM
+RESOURCE RSS_SIGNATURE {}
+RESOURCE TBUF16 { buf=""; }
+
+
+//EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/src/taostate.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,424 @@
+/*
+* Copyright (c) 2004,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:  Implements the TAOState class
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32property.h>
+
+#include "taostate.h"
+#include "logger.h"
+#include "maoconnectionmanager.h"
+#include "maostatecontext.h"
+#include "maotimer.h"
+#include "maostatepool.h"
+#include "maosettings.h"
+#include "maogpds.h"
+#include "pdpcontextmanagerpskeys.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// --------------------------------------------------------------------------
+// Constructor
+// --------------------------------------------------------------------------
+//
+TAOState::TAOState( MAOStateContext& aStateContext, 
+                    MAOStatePool& aStatePool ):
+    iStateContext( aStateContext ),
+    iStatePool( aStatePool ),
+    iFlags( 0 )
+    {
+    LOG_1( _L("TAOState::TAOState") );
+    }
+
+// --------------------------------------------------------------------------
+// TAOState::HandlePDPContextActivatedL
+// --------------------------------------------------------------------------
+//
+TAOState* TAOState::HandlePDPContextActivatedL()
+    {
+    LOG_1( _L("TAOState::HandlePDPContextActivatedL") );
+
+    return NULL;    
+    }
+
+// --------------------------------------------------------------------------
+// TAOState::HandlePDPContextActivationFailedL
+// --------------------------------------------------------------------------
+//
+TAOState* TAOState::HandlePDPContextActivationFailedL()
+    {
+    LOG_1( _L("TAOState::HandlePDPContextActivationFailedL") );
+    
+    return NULL;
+    }
+
+// --------------------------------------------------------------------------
+// TAOState::HandlePDPContextDisconnectedL
+// --------------------------------------------------------------------------
+//
+TAOState* TAOState::HandlePDPContextDisconnectedL( TInt /*aReason*/ )
+    {
+    LOG_1( _L("TAOState::HandlePDPContextDisconnectedL") );
+    
+    return NULL;
+    }
+
+// --------------------------------------------------------------------------
+// TAOState::HandleNetworkChangedL
+// --------------------------------------------------------------------------
+//
+#ifdef LOGGING_ENABLED
+TAOState* TAOState::HandleNetworkChangedL(
+    MAOConnectionManager::TNetworkType aNetworkType )
+#else
+TAOState* TAOState::HandleNetworkChangedL(
+    MAOConnectionManager::TNetworkType /*aNetworkType*/ )
+#endif
+    {
+    LOG_2( _L("TAOState::HandleNetworkChangedL: aNetworkType: %d"), 
+              aNetworkType );
+
+    // PLMN change notification
+    // Cancel all requests
+    CancelAll();
+    return iStatePool.ChangeState( EStateStarting );
+    }
+
+// --------------------------------------------------------------------------
+// TAOState::HandleSuccesfulRAUEventL
+// --------------------------------------------------------------------------
+//
+TAOState* TAOState::HandleSuccesfulRAUEventL()
+    {
+    LOG_1( _L("TAOState::HandleSuccesfulRAUEventL") );
+    
+    TAOState* newState = NULL;
+    
+    // If we don't have PDP context active try to activate it
+    if ( !iStateContext.ConnectionManager().IsPDPContextActive() )
+        {
+        CancelAll();
+        newState = DoActivatePDPContextL();
+        }
+    
+    return newState;
+    }
+
+// --------------------------------------------------------------------------
+// TAOState::HandleRetryTimerTriggeredL
+// --------------------------------------------------------------------------
+//
+TAOState* TAOState::HandleRetryTimerTriggeredL()
+    {
+    LOG_1( _L("TAOState::HandleRetryTimerTriggeredL") );
+    
+    return NULL;
+    }
+
+// --------------------------------------------------------------------------
+// TAOState::HandleConnectionTimerTriggeredL
+// --------------------------------------------------------------------------
+//
+TAOState* TAOState::HandleConnectionTimerTriggeredL()
+    {
+    LOG_1( _L("TAOState::HandleConnectionTimerTriggeredL") );
+    
+    return NULL;
+    }
+
+// --------------------------------------------------------------------------
+// TAOState::HandleSettingsReceivedL
+// --------------------------------------------------------------------------
+//
+TAOState* TAOState::HandleSettingsReceivedL()
+    {
+    LOG_1( _L("TAOState::HandleSettingsReceivedL") );
+
+    // By default if settings are changed OTA
+    // cancel all requests and switch to starting state    
+    CancelAll();
+    
+    // Set Always-On mode to cellmo side
+    SetAlwaysOnModeL();
+        
+    return iStatePool.ChangeState( EStateStarting );
+    }
+
+// --------------------------------------------------------------------------
+// TAOState::HandlePDPContextTemporarilyBlockedL
+// --------------------------------------------------------------------------
+//
+TAOState* TAOState::HandlePDPContextTemporarilyBlockedL()
+    {
+    LOG_1( _L("TAOState::HandlePDPContextTemporarilyBlockedL") );
+    
+    return NULL;
+    }
+
+// --------------------------------------------------------------------------
+// TAOState::HandleGeneralError
+// --------------------------------------------------------------------------
+//
+TAOState* TAOState::HandleGeneralError()
+    {
+    LOG_1( _L("TAOState::HandleGeneralError") );
+    
+    // Error occured:
+    // Cancel all operations and go to disconnected state
+    CancelAll();
+    return iStatePool.ChangeState( EStateDisconnected );
+    }
+
+// --------------------------------------------------------------------------
+// TAOState::CancelAll
+// --------------------------------------------------------------------------
+//
+void TAOState::CancelAll()
+    {
+    LOG_1( _L("TAOState::CancelAll") );
+
+    // Cancel timers
+    CancelTimers();
+    
+    // Close current connection    
+    iStateContext.ConnectionManager().CloseConnection();
+    }
+
+// --------------------------------------------------------------------------
+// TAOState::SetAlwaysOnModeL
+// --------------------------------------------------------------------------
+//
+void TAOState::SetAlwaysOnModeL()
+    {
+    LOG_1( _L("TAOState::SetAlwaysOnModeL") );
+    
+    MAOGpds::TAlwaysOnMode mode = MAOGpds::ENeither;
+    MAOSettings& settings = iStateContext.Settings();
+    if ( settings.AlwaysOnSupportedInHPLMN() )
+        {
+        mode = MAOGpds::EHPLMN;
+        }
+    if ( settings.AlwaysOnSupportedInVPLMN() )
+        {
+        if ( mode == MAOGpds::EHPLMN )
+            {
+            mode = MAOGpds::EBoth;
+            }
+        else
+            {
+            mode = MAOGpds::EVPLMN;
+            }
+        }
+    iStateContext.Gpds().SetAlwaysOnModeL( mode );
+    }
+
+// --------------------------------------------------------------------------
+// TAOState::HandleEnableAlwaysOnL
+// --------------------------------------------------------------------------
+//
+TAOState* TAOState::HandleEnableAlwaysOnL()
+    {
+    LOG_1( _L("TAOState::HandleEnableAlwaysOnL") );
+    
+    TAOState* newState = NULL;
+    if ( EnableAlwaysOn() )
+        {
+        // start PDP connection
+        newState = DoActivatePDPContextL();
+        }
+    else
+        {
+        newState = iStatePool.ChangeState( TAOState::EStateDisabled );
+        }
+        
+    return newState;
+    }
+
+// --------------------------------------------------------------------------
+// TAOState::HandleSwitchFromDisconnectedL
+// --------------------------------------------------------------------------
+//
+TAOState* TAOState::HandleSwitchFromDisconnectedL(
+    MAOConnectionManager::TFailureReason /*aReason*/ )
+    {
+    LOG_1( _L("TAOState::HandleSwitchFromDisconnectedL") );
+    
+    return NULL;    
+    }
+
+// --------------------------------------------------------------------------
+// TAOState::HandleConnectionDeletedL
+// --------------------------------------------------------------------------
+//
+TAOState* TAOState::HandleConnectionDeletedL()
+    {
+    LOG_1( _L("TAOState::HandleConnectionDeletedL") );
+    
+    return NULL;    
+    }
+
+// --------------------------------------------------------------------------
+// TAOState::HandleResetFactorySettingsL
+// --------------------------------------------------------------------------
+//
+TAOState* TAOState::HandleResetFactorySettingsL( TBool aReset )
+    {
+    LOG_1( _L("TAOState::HandleResetFactorySettingsL") );
+    
+    TAOState* newState = NULL;
+    if ( aReset )
+        {
+        // Close connection
+        CancelAll();
+        
+        // Respond to Rfs that connection has been torn down and rfs sequence
+        // can continue
+        RProperty::Set(
+            KPDPContextManager2,
+            KPDPContextManagerFactorySettingsReset,
+            EPDPContextManagerFactorySettingsResetStartReply );
+            
+        newState = iStatePool.ChangeState( EStateResetFactorySettings );
+        }
+    else
+        {
+        newState = DoActivatePDPContextL();
+        }
+    return newState;
+    }
+
+// --------------------------------------------------------------------------
+// TAOState::EnableAlwaysOn
+// --------------------------------------------------------------------------
+//
+TBool TAOState::EnableAlwaysOn()
+    {
+    LOG_1( _L("TAOState::EnableAlwaysOn") );
+    
+    TBool enabled = EFalse;
+    MAOConnectionManager& connectionManager =
+        iStateContext.ConnectionManager();
+    MAOSettings& settings = iStateContext.Settings();
+    
+    // If new state is in starting state, we'll check
+    // whether Always-On should be supported in current
+    // network
+    MAOConnectionManager::TNetworkType nwType =
+        connectionManager.NetworkType();
+    switch ( nwType )
+        {
+        case MAOConnectionManager::EHPLMN:
+            {
+            if ( settings.AlwaysOnSupportedInHPLMN() )
+                {
+                enabled = ETrue;
+                }
+            break;
+            }
+        case MAOConnectionManager::EVPLMN:
+            {
+            if ( settings.AlwaysOnSupportedInVPLMN() )
+                {
+                enabled = ETrue;
+                }
+            break;
+            }
+        default:
+            {
+            // Not enabled
+            break;
+            }
+        }
+        
+    LOG_2( _L("TAOState::EnableAlwaysOn >> Enabled: %d"), enabled );
+    
+    return enabled;
+    }
+
+// --------------------------------------------------------------------------
+// TAOState::CancelTimers
+// --------------------------------------------------------------------------
+//
+void TAOState::CancelTimers()
+    {
+    LOG_1( _L("TAOState::CancelTimers") );
+    
+    iStateContext.Timer().StopConnectionTimer();
+    iStateContext.Timer().StopRetryTimer();
+    iStateContext.Timer().StopUnconnectTimer();
+    }
+
+// --------------------------------------------------------------------------
+// TAOState::DoActivatePDPContextL
+// --------------------------------------------------------------------------
+//
+TAOState* TAOState::DoActivatePDPContextL()
+    {
+    LOG_1( _L("TAOState::DoActivatePDPContextL") );
+    
+    iStateContext.Timer().StartConnectionTimer();
+    iStateContext.ConnectionManager().ActivatePDPContextL();
+    
+    return iStatePool.ChangeState( TAOState::EStateConnecting );
+    }
+
+// --------------------------------------------------------------------------
+// TAOState::DoHandleConnectionDeletedL
+// --------------------------------------------------------------------------
+//
+TAOState* TAOState::DoHandleConnectionDeletedL()
+    {
+    LOG_1( _L("TAOState::DoHandleConnectionDeletedL") );
+    
+    MAOConnectionManager& connectionManager =
+        iStateContext.ConnectionManager();
+    TAOState* newState = NULL;
+        
+    if ( !connectionManager.IsPDPContextActive() )
+        {
+        CancelAll();
+        newState = DoActivatePDPContextL();
+        }
+        
+    return newState;
+    }
+
+// ---------------------------------------------------------------------------
+// TAOState::HandleExternalConnectionCreatedL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOState::HandleExternalConnectionCreatedL()
+    {
+    LOG_1( _L("TAOState::HandleExternalConnectionCreatedL") );
+    
+    CancelAll();
+    return iStatePool.ChangeState( TAOState::EStateExternalConnection );
+    }
+
+// ---------------------------------------------------------------------------
+// TAOState::HandleUnconnectTimerExpiredL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOState::HandleUnconnectTimerExpiredL()
+    {
+    LOG_1( _L("TAOState::HandleUnconnectTimerExpiredL") );
+    
+    return NULL;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/src/taostateconnected.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,208 @@
+/*
+* Copyright (c) 2004,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:  Implements the TAOStateConnected class
+*
+*/
+
+
+// INCLUDE FILES
+#include "taostateconnected.h"
+#include "logger.h"
+#include "maostatepool.h"
+#include "maostatecontext.h"
+#include "maotimer.h"
+#include "maosettings.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// --------------------------------------------------------------------------
+// Constructor
+// --------------------------------------------------------------------------
+//
+TAOStateConnected::TAOStateConnected(
+    MAOStateContext& aStateContext,
+    MAOStatePool& aStatePool ):
+    TAOState( aStateContext, aStatePool )
+    {
+    LOG_1( _L("TAOStateConnected::TAOStateConnected") );
+    }
+
+// --------------------------------------------------------------------------
+// TAOStateConnected::StateName
+// --------------------------------------------------------------------------
+//
+TAOState::TAOStateName TAOStateConnected::StateName() const
+    {
+    LOG_2( _L("TAOStateConnected::StateName: %d"),
+        TAOState::EStateConnected );
+    
+    return TAOState::EStateConnected;
+    }
+
+// --------------------------------------------------------------------------
+// TAOStateConnected::HandlePDPContextDisconnectedL
+// --------------------------------------------------------------------------
+//
+TAOState* TAOStateConnected::HandlePDPContextDisconnectedL( 
+                             TInt /*aReason*/ )
+    {
+    LOG_1( _L("TAOStateConnected::HandlePDPContextDisconnectedL") );
+    
+    return iStatePool.ChangeState( TAOState::EStateDisconnected );
+    }
+
+// --------------------------------------------------------------------------
+// TAOStateConnected::HandleConnectionDeletedL
+// --------------------------------------------------------------------------
+//
+TAOState* TAOStateConnected::HandleConnectionDeletedL()
+    {
+    LOG_1( _L("TAOStateConnected::HandleConnectionDeletedL") );
+    
+    TAOState* newState = NULL;
+    
+    // If we are already connected to default IAP
+    // we can stay in connected state
+    if ( iStateContext.ConnectionManager().IsPDPContextActive() )
+        {
+        newState = iStatePool.CurrentState();
+        }
+    // Not connected to default IAP, cancel all and go to disconnected state
+    else
+        {
+        CancelAll();
+        newState = iStatePool.ChangeState( TAOState::EStateDisconnected );
+        }
+    
+    return newState;
+    }
+
+
+// --------------------------------------------------------------------------
+// TAOStateConnected::HandlePDPContextActivatedL
+// --------------------------------------------------------------------------
+//
+TAOState* TAOStateConnected::HandlePDPContextActivatedL()
+    {
+    return NULL;
+    }
+
+// --------------------------------------------------------------------------
+// TAOStateConnected::HandleNetworkChangedL
+// --------------------------------------------------------------------------
+//
+TAOState* TAOStateConnected::HandleNetworkChangedL(
+    MAOConnectionManager::TNetworkType aNetworkType )
+    {
+    LOG_2( _L("TAOStateConnected::HandleNetworkChangedL: aNetworkType: %d"), 
+              aNetworkType );
+
+    // PLMN change notification
+    if ( aNetworkType != MAOConnectionManager::ENotRegistered )
+        {
+	    if ( EnableAlwaysOn() )
+	        {
+	    	// Stay connected
+	    	return NULL;
+	        }
+	    else
+	        {
+	        // Is linger enabled
+	        if ( iStateContext.Settings().LingerTimerValue( 
+	             iStateContext.Settings().AccessPointId() ) > 0 )
+	            {
+	        	// Go to disabled state but do not stop the connection. 
+	        	// Linger timer will stop connection later.
+	        	iStateContext.ConnectionManager().DetachConnection();
+	        	CancelTimers();
+	        	return iStatePool.ChangeState( EStateDisabled );
+	            }
+	        }	
+        }
+    
+    // Either aNetworkType == MAOConnectionManager::ENotRegistered
+    // or PLMN changed and always-on is disabled & linger is off
+        
+    // Cancel all requests
+    CancelAll();
+    return iStatePool.ChangeState( EStateStarting );	
+    }
+            
+// --------------------------------------------------------------------------
+// TAOStateConnected::HandleSuccesfulRAUEventL
+// --------------------------------------------------------------------------
+//
+TAOState* TAOStateConnected::HandleSuccesfulRAUEventL()
+    {
+    return NULL;
+    }
+    
+// --------------------------------------------------------------------------
+// TAOStateConnected::HandleRetryTimerTriggeredL
+// --------------------------------------------------------------------------
+//
+TAOState* TAOStateConnected::HandleRetryTimerTriggeredL()
+    {
+    return NULL;
+    }
+    
+// --------------------------------------------------------------------------
+// TAOStateConnected::HandleConnectionTimerTriggeredL
+// --------------------------------------------------------------------------
+//
+TAOState* TAOStateConnected::HandleConnectionTimerTriggeredL()
+    {
+    return NULL;
+    }
+    
+// --------------------------------------------------------------------------
+// TAOStateConnected::HandlePDPContextTemporarilyBlockedL
+// --------------------------------------------------------------------------
+//
+TAOState* TAOStateConnected::HandlePDPContextTemporarilyBlockedL()
+    {
+    return NULL;
+    }
+    
+// --------------------------------------------------------------------------
+// TAOStateConnected::HandleGeneralError
+// --------------------------------------------------------------------------
+//
+TAOState* TAOStateConnected::HandleGeneralError()
+    {
+    return NULL;
+    }
+    
+// --------------------------------------------------------------------------
+// TAOStateConnected::HandleEnableAlwaysOnL
+// --------------------------------------------------------------------------
+//
+TAOState* TAOStateConnected::HandleEnableAlwaysOnL()
+    {
+    return NULL;
+    }
+    
+// --------------------------------------------------------------------------
+// TAOStateConnected::HandleSwitchFromDisconnectedL
+// --------------------------------------------------------------------------
+//
+TAOState* TAOStateConnected::HandleSwitchFromDisconnectedL(
+          MAOConnectionManager::TFailureReason /*aReason*/ )
+    {
+    return NULL;
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/src/taostateconnecting.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,210 @@
+/*
+* Copyright (c) 2004,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:  Implements the TAOStateConnecting class
+*
+*/
+
+
+// INCLUDE FILES
+#include "taostateconnecting.h"
+#include "logger.h"
+#include "maostatepool.h"
+#include "maostatecontext.h"
+#include "maotimer.h"
+
+// UNNAMNED NAMESPACE FOR LOCAL DEFINITIONS
+namespace
+    {
+    // CONSTANTS
+    const TInt KMaxAttempts = 5;
+    }
+
+// METHODS
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+TAOStateConnecting::TAOStateConnecting(
+    MAOStateContext& aStateContext, MAOStatePool& aStatePool ):
+    TAOState( aStateContext, aStatePool ),
+    iConnectionCounter( 0 )
+    {
+    LOG_1( _L("TAOStateConnecting::TAOStateConnecting") );
+    }
+
+// ---------------------------------------------------------------------------
+// TAOStateConnecting::StateName
+// ---------------------------------------------------------------------------
+//
+TAOState::TAOStateName TAOStateConnecting::StateName() const
+    {
+    LOG_2( _L("TAOStateConnecting::StateName: %d"),
+        TAOState::EStateConnecting );
+    
+    return TAOState::EStateConnecting;
+    }
+
+// ---------------------------------------------------------------------------
+// TAOStateConnecting::HandlePDPContextActivatedL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateConnecting::HandlePDPContextActivatedL()
+    {
+    LOG_1( _L("TAOStateConnecting::HandlePDPContextActivatedL") );
+    
+    iStateContext.Timer().StopConnectionTimer();
+    return iStatePool.ChangeState( TAOState::EStateConnected );
+    }
+
+// ---------------------------------------------------------------------------
+// TAOStateConnecting::HandlePDPContextActivationFailedL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateConnecting::HandlePDPContextActivationFailedL()
+    {
+    LOG_1( _L("TAOStateConnecting::HandlePDPContextActivationFailedL") );
+    
+    iStateContext.Timer().StopConnectionTimer();
+    return iStatePool.ChangeState( TAOState::EStateDisconnected );
+    }
+
+// ---------------------------------------------------------------------------
+// TAOStateConnecting::HandleConnectionTimerTriggeredL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateConnecting::HandleConnectionTimerTriggeredL()
+    {
+    LOG_1( _L("TAOStateConnecting::HandleConnectionTimerTriggeredL") );
+    
+    TAOState* newState = NULL;
+    
+    // Connection took too long -> disconnect and retry
+    CancelAll();
+    iConnectionCounter++;
+    if ( iConnectionCounter >= KMaxAttempts )
+        {
+        // Maximum attempts achieved -> change to disconnected
+        iConnectionCounter = 0;
+        newState = iStatePool.ChangeState( TAOState::EStateDisconnected );
+        }
+    else
+        {
+        // Try to reconnect and start connection timer
+        iStateContext.Timer().StartConnectionTimer();
+        }
+    return newState;
+    }
+
+// ---------------------------------------------------------------------------
+// TAOStateConnecting::HandleConnectionDeletedL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateConnecting::HandleConnectionDeletedL()
+    {
+    LOG_1( _L("TAOStateConnecting::HandleConnectionDeletedL") );
+    
+    TAOState* newState = NULL;
+    
+    // If we are already connecting to default IAP
+    // we can stay in connected state
+    if ( iStateContext.ConnectionManager().IsPDPContextActive() )
+        {
+        newState = iStatePool.CurrentState();
+        }
+    // Not connected to default IAP, cancel all and go to disconnected state
+    else
+        {
+        CancelAll();
+        newState = iStatePool.ChangeState( TAOState::EStateDisconnected );
+        }
+    
+    return newState;
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// TAOStateConnecting::HandlePDPContextDisconnectedL
+// This is ignored in connecting state. Always returns NULL;
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateConnecting::HandlePDPContextDisconnectedL( TInt 
+                                                             /*aReason*/ )
+    {
+    return NULL;
+    }
+    
+// --------------------------------------------------------------------------
+// TAOStateConnecting::HandleSuccesfulRAUEventL
+// This is ignored in connecting state. Always returns NULL;
+// --------------------------------------------------------------------------
+//
+TAOState* TAOStateConnecting::HandleSuccesfulRAUEventL()
+    {
+    return NULL;
+    }
+    
+// --------------------------------------------------------------------------
+// TAOStateConnecting::HandleRetryTimerTriggeredL
+// This is ignored in connecting state. Always returns NULL;
+// --------------------------------------------------------------------------
+//
+TAOState* TAOStateConnecting::HandleRetryTimerTriggeredL()
+    {
+    return NULL;
+    }
+    
+// --------------------------------------------------------------------------
+// TAOStateConnecting::HandlePDPContextTemporarilyBlockedL
+// This is ignored in connecting state. Always returns NULL;
+// --------------------------------------------------------------------------
+//
+TAOState* TAOStateConnecting::HandlePDPContextTemporarilyBlockedL()
+    {
+    return NULL;
+    }
+    
+// --------------------------------------------------------------------------
+// TAOStateConnecting::HandleGeneralError
+// This is ignored in connecting state. Always returns NULL;
+// --------------------------------------------------------------------------
+//
+TAOState* TAOStateConnecting::HandleGeneralError()
+    {
+    return NULL;
+    }
+    
+// --------------------------------------------------------------------------
+// TAOStateConnecting::HandleEnableAlwaysOnL
+// This is ignored in connecting state. Always returns NULL;
+// --------------------------------------------------------------------------
+//
+TAOState* TAOStateConnecting::HandleEnableAlwaysOnL()
+    {
+    return NULL;
+    }
+    
+// --------------------------------------------------------------------------
+// TAOStateConnecting::HandleSwitchFromDisconnectedL
+// This is ignored in connecting state. Always returns NULL;
+// --------------------------------------------------------------------------
+//
+TAOState* TAOStateConnecting::HandleSwitchFromDisconnectedL(
+    MAOConnectionManager::TFailureReason /*aReason*/ )
+    {
+    return NULL;
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/src/taostatedisabled.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,162 @@
+/*
+* Copyright (c) 2004,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:  Implements the TAOStateDisabled class
+*
+*/
+
+
+// INCLUDE FILES
+#include "taostatedisabled.h"
+#include "logger.h"
+#include "maostatepool.h"
+
+//    METHODS
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+TAOStateDisabled::TAOStateDisabled( MAOStateContext& aStateContext, 
+                                    MAOStatePool& aStatePool ):
+    TAOState( aStateContext, aStatePool )
+    {
+    LOG_1( _L("TAOStateDisabled::TAOStateDisabled") );
+    }
+
+// --------------------------------------------------------------------------
+// TAOStateDisabled::StateName
+// --------------------------------------------------------------------------
+//
+TAOState::TAOStateName TAOStateDisabled::StateName() const
+    {
+    LOG_2( _L("TAOStateDisabled::StateName: %d"),
+        TAOState::EStateDisabled );
+    
+    return TAOState::EStateDisabled;
+    }
+
+// ---------------------------------------------------------------------------
+// TAOStateDisabled::HandleNetworkChangedL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateDisabled::HandleNetworkChangedL(
+    MAOConnectionManager::TNetworkType aNetworkType )
+    {
+    LOG_1( _L("TAOStateDisabled::HandleNetworkChangedL") );
+    
+    TAOState* newState = NULL;
+    
+    if ( aNetworkType == MAOConnectionManager::EHPLMN ||
+        aNetworkType == MAOConnectionManager::EVPLMN )
+        {
+        newState = iStatePool.ChangeState( TAOState::EStateStarting );
+        }
+    
+    return newState;
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// TAOStateDisabled::HandlePDPContextActivatedL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateDisabled::HandlePDPContextActivatedL()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateDisabled::HandlePDPContextDisconnectedL
+// ---------------------------------------------------------------------------
+//
+    TAOState* TAOStateDisabled::HandlePDPContextDisconnectedL(
+                                TInt /*aReason*/ )
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateDisabled::HandleSuccesfulRAUEventL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateDisabled::HandleSuccesfulRAUEventL()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateDisabled::HandleRetryTimerTriggeredL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateDisabled::HandleRetryTimerTriggeredL()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateDisabled::HandleConnectionTimerTriggeredL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateDisabled::HandleConnectionTimerTriggeredL()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateDisabled::HandlePDPContextTemporarilyBlockedL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateDisabled::HandlePDPContextTemporarilyBlockedL()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateDisabled::HandleGeneralError
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateDisabled::HandleGeneralError()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateDisabled::HandleEnableAlwaysOnL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateDisabled::HandleEnableAlwaysOnL()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateDisabled::HandleSwitchFromDisconnectedL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateDisabled::HandleSwitchFromDisconnectedL(
+        MAOConnectionManager::TFailureReason /*aReason*/ )
+    {
+    return NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// TAOStateDisabled::HandleExternalConnectionCreatedL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateDisabled::HandleExternalConnectionCreatedL()
+    {
+    return NULL;
+    }
+    
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/src/taostatedisconnected.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,226 @@
+/*
+* Copyright (c) 2004,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:  Implements the TAOStateDisconnected class
+*
+*/
+
+
+// INCLUDE FILES
+#include "taostatedisconnected.h"
+#include "logger.h"
+#include "maotimer.h"
+#include "maostatecontext.h"
+#include "maostatepool.h"
+
+// UNNAMED NAMESPACE FOR LOCAL DEFINITIONS
+namespace
+    {
+    // CONSTANTS
+    _LIT( KPanicCat, "StateDisconnected" );
+    
+    // DATA TYPES
+    enum TPanicReason
+        {
+        EInvalidFailureReason
+        };
+    
+    // LOCAL FUNCTIONS
+    LOCAL_C void Panic( TPanicReason aReason )
+        {
+        User::Panic( KPanicCat, aReason );
+        }
+    }
+
+// METHODS
+
+// ---------------------------------------------------------------------------
+// TAOStateDisconnected::TAOStateDisconnected
+// ---------------------------------------------------------------------------
+//
+TAOStateDisconnected::TAOStateDisconnected(
+    MAOStateContext& aStateContext,
+    MAOStatePool& aStatePool ):
+    TAOState( aStateContext, aStatePool )
+    {
+    LOG_1( _L("TAOStateDisconnected::TAOStateDisconnected") );
+    }
+
+// ---------------------------------------------------------------------------
+// TAOStateDisconnected::StateName
+// ---------------------------------------------------------------------------
+//
+TAOState::TAOStateName TAOStateDisconnected::StateName() const
+    {
+    LOG_2( _L("TAOStateDisconnected::StateName: %d"),
+        TAOState::EStateDisconnected );
+    
+    return TAOState::EStateDisconnected;
+    }
+
+// ---------------------------------------------------------------------------
+// TAOStateDisconnected::HandleSwitchFromDisconnectedL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateDisconnected::HandleSwitchFromDisconnectedL(
+    MAOConnectionManager::TFailureReason aReason )
+    {
+    LOG_1( _L("TAOStateDisconnected::HandleSwitchFromDisconnectedL") );
+    
+    TAOState* newState = NULL;
+    MAOTimer& timer = iStateContext.Timer();
+    MAOConnectionManager& connectionManager =
+        iStateContext.ConnectionManager();
+    
+    switch ( aReason )
+        {
+        case MAOConnectionManager::ETemporary:
+            {
+            if ( !timer.RetryTimerDisabled() )
+                {
+                // Retry timer is not disabled on other words timer value
+                // is != 0 (infinite)
+                timer.StartRetryTimer();
+                newState = iStatePool.ChangeState( TAOState::EStateWaiting );
+                }
+            else
+                {
+                // Retry timer disabled - Go to unconnected and wait for RAU
+                newState = iStatePool.ChangeState( 
+                    TAOState::EStateUnconnected );
+                if( !iStateContext.Timer().UnconnectTimerDisabled() )
+                    {
+                    // Start unconnect timer to poll connection
+                    // in unconnected state
+                    timer.StartUnconnectTimer();
+                    }
+                }
+            break;
+            }
+        case MAOConnectionManager::EPermanent:
+            {
+            newState = iStatePool.ChangeState( TAOState::EStateUnconnected );
+            if( !iStateContext.Timer().UnconnectTimerDisabled() )
+                {
+                // Start unconnect timer to poll connection
+                // in unconnected state
+                timer.StartUnconnectTimer();
+                }
+            break;
+            }
+        case MAOConnectionManager::EDisconnected:
+            {
+            timer.StartConnectionTimer();
+            connectionManager.ActivatePDPContextL();
+            newState = iStatePool.ChangeState( TAOState::EStateConnecting );
+            break;
+            }
+        default:
+            {
+            // Should not be here
+            Panic( EInvalidFailureReason );
+            break;
+            }
+        }
+        
+    return newState;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateDisconnected::HandleConnectionDeletedL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateDisconnected::HandleConnectionDeletedL()
+    {
+    LOG_1( _L("TAOStateDisconnected::HandleConnectionDeletedL") );
+    
+    return TAOState::DoHandleConnectionDeletedL();
+    }
+    
+    
+    // These all must be ignored in disconnected state.
+    
+// ---------------------------------------------------------------------------
+// TAOStateDisconnected::HandlePDPContextActivatedL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateDisconnected::HandlePDPContextActivatedL()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateDisconnected::HandlePDPContextDisconnectedL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateDisconnected::HandlePDPContextDisconnectedL( 
+                                TInt /*aReason*/ )
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateDisconnected::HandleSuccesfulRAUEventL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateDisconnected::HandleSuccesfulRAUEventL()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateDisconnected::HandleRetryTimerTriggeredL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateDisconnected::HandleRetryTimerTriggeredL()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateDisconnected::HandleConnectionTimerTriggeredL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateDisconnected::HandleConnectionTimerTriggeredL()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateDisconnected::HandlePDPContextTemporarilyBlockedL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateDisconnected::HandlePDPContextTemporarilyBlockedL()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateDisconnected::HandleGeneralError
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateDisconnected::HandleGeneralError()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateDisconnected::HandleEnableAlwaysOnL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateDisconnected::HandleEnableAlwaysOnL()
+    {
+    return NULL;
+    }
+    
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/src/taostateexternalconnection.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,208 @@
+/*
+* Copyright (c) 2004 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:  Implements the TAOStateExternalConnection class
+*
+*/
+
+// INCLUDE FILES
+#include <e32property.h>
+
+#include "taostateexternalconnection.h"
+#include "logger.h"
+#include "pdpcontextmanagerpskeys.h"
+
+//	METHODS
+
+// Constructor
+TAOStateExternalConnection::TAOStateExternalConnection(
+    MAOStateContext& aStateContext,
+    MAOStatePool& aStatePool ):
+    TAOState( aStateContext, aStatePool )
+	{
+	LOG_1( _L("TAOStateExternalConnection::TAOStateExternalConnection") );
+	}
+
+// ----------------------------------------------------------------------------
+// TAOStateExternalConnection::StateName
+// ----------------------------------------------------------------------------
+//
+TAOState::TAOStateName TAOStateExternalConnection::StateName() const
+    {
+    LOG_2( _L("TAOStateExternalConnection::StateName: %d"),
+        TAOState::EStateExternalConnection );
+    
+    return TAOState::EStateExternalConnection;
+    }
+
+// ----------------------------------------------------------------------------
+// TAOStateExternalConnection::HandleConnectionDeletedL
+// ----------------------------------------------------------------------------
+//
+TAOState* TAOStateExternalConnection::HandleConnectionDeletedL()
+    {
+    LOG_1( _L("TAOStateExternalConnection::HandleConnectionDeletedL") );
+        
+    return DoActivatePDPContextL();
+    }
+
+// ----------------------------------------------------------------------------
+// TAOStateExternalConnection::HandleResetFactorySettingsL
+// ----------------------------------------------------------------------------
+//
+TAOState* TAOStateExternalConnection::HandleResetFactorySettingsL(
+    TBool /*aReset*/ )
+    {
+    LOG_1( _L("TAOStateExternalConnection::HandleResetFactorySettingsL") );
+        
+    // Respond to Rfs
+    RProperty::Set(
+        KPDPContextManager2,
+        KPDPContextManagerFactorySettingsReset,
+        EPDPContextManagerFactorySettingsResetStartReply );
+        
+    return NULL;
+    }
+    
+      
+// ---------------------------------------------------------------------------
+// TAOStateExternalConnection::HandlePDPContextActivatedL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateExternalConnection::HandlePDPContextActivatedL()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateExternalConnection::HandlePDPContextActivationFailedL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateExternalConnection::HandlePDPContextActivationFailedL()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateExternalConnection::HandlePDPContextDisconnectedL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateExternalConnection::HandlePDPContextDisconnectedL( 
+                                        TInt /*aReason*/ )
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateExternalConnection::HandleNetworkChangedL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateExternalConnection::HandleNetworkChangedL(
+        MAOConnectionManager::TNetworkType /*aNetworkType*/ )
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateExternalConnection::HandleSuccesfulRAUEventL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateExternalConnection::HandleSuccesfulRAUEventL()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateExternalConnection::HandleRetryTimerTriggeredL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateExternalConnection::HandleRetryTimerTriggeredL()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateExternalConnection::HandleConnectionTimerTriggeredL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateExternalConnection::HandleConnectionTimerTriggeredL()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateExternalConnection::HandleSettingsReceivedL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateExternalConnection::HandleSettingsReceivedL()
+    {
+    return NULL;
+    }    
+    
+// ---------------------------------------------------------------------------
+// TAOStateExternalConnection::HandlePDPContextTemporarilyBlockedL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateExternalConnection::HandlePDPContextTemporarilyBlockedL()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateExternalConnection::HandleGeneralError
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateExternalConnection::HandleGeneralError()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateExternalConnection::HandleEnableAlwaysOnL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateExternalConnection::HandleEnableAlwaysOnL()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateExternalConnection::HandleSwitchFromDisconnectedL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateExternalConnection::HandleSwitchFromDisconnectedL(
+        MAOConnectionManager::TFailureReason /*aReason*/ )
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateExternalConnection::HandleExternalConnectionCreatedL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateExternalConnection::HandleExternalConnectionCreatedL()
+    {
+    return NULL;
+    }    
+
+// ---------------------------------------------------------------------------
+// TAOStateExternalConnection::HandleUnconnectTimerExpiredL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateExternalConnection::HandleUnconnectTimerExpiredL()
+    {
+    return NULL;
+    }
+    
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/src/taostateinit.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,190 @@
+/*
+* Copyright (c) 2004,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:  Implements the TAOStateInit class
+*
+*/
+
+
+// INCLUDE FILES
+#include "taostateinit.h"
+#include "logger.h"
+#include "maostatepool.h"
+
+//    METHODS
+
+// ---------------------------------------------------------------------------
+// TAOStateInit::TAOStateInit
+// ---------------------------------------------------------------------------
+//
+TAOStateInit::TAOStateInit(
+    MAOStateContext& aStateContext,
+    MAOStatePool& aStatePool ):
+    TAOState( aStateContext, aStatePool )
+    {
+    LOG_1( _L("TAOStateInit::TAOStateInit") );
+    }
+
+// ---------------------------------------------------------------------------
+// TAOStateInit::StateName
+// ---------------------------------------------------------------------------
+//
+TAOState::TAOStateName TAOStateInit::StateName() const
+    {
+    LOG_2( _L("TAOStateInit::StateName: %d"),
+        TAOState::EStateInit );
+    
+    return TAOState::EStateInit;
+    }
+
+// ---------------------------------------------------------------------------
+// TAOStateInit::HandleNetworkChangedL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateInit::HandleNetworkChangedL(
+    MAOConnectionManager::TNetworkType aNetworkType )
+    {
+    LOG_1( _L("TAOStateInit::HandleNetworkChangedL") );
+    
+    TAOState* newState = NULL;
+    if ( aNetworkType == MAOConnectionManager::EHPLMN ||
+        aNetworkType == MAOConnectionManager::EVPLMN )
+        {
+        SetFlag( ENWRegistrationReceived );
+        if ( CheckFlag( ESettingsReceived ) )
+            {
+            // Conditions met to change 'connecting' state
+            ClearFlags();
+            newState = iStatePool.ChangeState( EStateStarting );
+            }
+        }
+    return newState;
+    }
+            
+// ---------------------------------------------------------------------------
+// TAOStateInit::HandleSettingsReceivedL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateInit::HandleSettingsReceivedL()
+    {
+    LOG_1( _L("TAOStateInit::HandleSettingsReceivedL") );
+    
+    TAOState* newState = NULL;
+    
+    // Set always on mode to TSY
+    SetAlwaysOnModeL();
+    
+    // Set flag that settings have been received
+    SetFlag( ESettingsReceived );
+    if ( CheckFlag( ENWRegistrationReceived ) )
+        {
+        // Conditions met to change 'connecting' state
+        ClearFlags();
+        newState = iStatePool.ChangeState( EStateStarting );
+        }
+    
+    return newState;
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// TAOStateInit::HandlePDPContextActivatedL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateInit::HandlePDPContextActivatedL()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateInit::HandlePDPContextDisconnectedL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateInit::HandlePDPContextDisconnectedL( TInt /*aReason*/ )
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateInit::HandleSuccesfulRAUEventL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateInit::HandleSuccesfulRAUEventL()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateInit::HandleRetryTimerTriggeredL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateInit::HandleRetryTimerTriggeredL()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateInit::HandleConnectionTimerTriggeredL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateInit::HandleConnectionTimerTriggeredL()
+    {
+    return NULL;
+    }    
+// ---------------------------------------------------------------------------
+// TAOStateInit::HandlePDPContextTemporarilyBlockedL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateInit::HandlePDPContextTemporarilyBlockedL()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateInit::HandleGeneralError
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateInit::HandleGeneralError()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateInit::HandleEnableAlwaysOnL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateInit::HandleEnableAlwaysOnL()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateInit::HandleSwitchFromDisconnectedL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateInit::HandleSwitchFromDisconnectedL(
+    MAOConnectionManager::TFailureReason /*aReason*/ )
+    {
+    return NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// TAOStateInit::HandleExternalConnectionCreatedL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateInit::HandleExternalConnectionCreatedL()
+    {
+    return NULL;
+    }
+        
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/src/taostateresetfactorysettings.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,208 @@
+/*
+* Copyright (c) 2004,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:  Implements the TAOStateResetFactorySettings class
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32property.h>
+
+#include "taostateresetfactorysettings.h"
+#include "logger.h"
+#include "pdpcontextmanagerpskeys.h"
+
+//    METHODS
+
+// ---------------------------------------------------------------------------
+// TAOStateResetFactorySettings::TAOStateResetFactorySettings
+// ---------------------------------------------------------------------------
+//
+TAOStateResetFactorySettings::TAOStateResetFactorySettings(
+    MAOStateContext& aStateContext,
+    MAOStatePool& aStatePool ):
+    TAOState( aStateContext, aStatePool )
+    {
+    LOG_1( _L("TAOStateResetFactorySettings::TAOStateResetFactorySettings") );
+    }
+
+// ---------------------------------------------------------------------------
+// TAOStateResetFactorySettings::StateName
+// ---------------------------------------------------------------------------
+//
+TAOState::TAOStateName TAOStateResetFactorySettings::StateName() const
+    {
+    LOG_2( _L("TAOStateResetFactorySettings::StateName: %d"),
+        TAOState::EStateInit );
+    
+    return TAOState::EStateResetFactorySettings;
+    }
+
+// ---------------------------------------------------------------------------
+// TAOStateResetFactorySettings::HandleResetFactorySettingsL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateResetFactorySettings::HandleResetFactorySettingsL(
+    TBool aReset )
+    {
+    LOG_1( _L("TAOStateResetFactorySettings::HandleResetFactorySettingsL") );
+    
+    TAOState* newState = NULL;
+    if ( !aReset )
+        {
+        newState = DoActivatePDPContextL();
+        }
+        
+    return newState;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateResetFactorySettings::TAOStateResetFactorySettings
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateResetFactorySettings::HandlePDPContextActivatedL()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateResetFactorySettings::HandlePDPContextActivationFailedL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateResetFactorySettings::HandlePDPContextActivationFailedL()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateResetFactorySettings::HandlePDPContextDisconnectedL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateResetFactorySettings::HandlePDPContextDisconnectedL( 
+                                        TInt /*aReason*/ )
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateResetFactorySettings::HandleNetworkChangedL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateResetFactorySettings::HandleNetworkChangedL(
+        MAOConnectionManager::TNetworkType /*aNetworkType*/ )
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateResetFactorySettings::HandleSuccesfulRAUEventL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateResetFactorySettings::HandleSuccesfulRAUEventL()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateResetFactorySettings::HandleRetryTimerTriggeredL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateResetFactorySettings::HandleRetryTimerTriggeredL()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateResetFactorySettings::HandleConnectionTimerTriggeredL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateResetFactorySettings::HandleConnectionTimerTriggeredL()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateResetFactorySettings::HandleSettingsReceivedL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateResetFactorySettings::HandleSettingsReceivedL()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateResetFactorySettings::HandlePDPContextTemporarilyBlockedL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateResetFactorySettings::HandlePDPContextTemporarilyBlockedL()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateResetFactorySettings::HandleGeneralError
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateResetFactorySettings::HandleGeneralError()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateResetFactorySettings::HandleEnableAlwaysOnL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateResetFactorySettings::HandleEnableAlwaysOnL()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateResetFactorySettings::HandleSwitchFromDisconnectedL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateResetFactorySettings::HandleSwitchFromDisconnectedL(
+        MAOConnectionManager::TFailureReason /*aReason*/ )
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateResetFactorySettings::HandleConnectionDeletedL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateResetFactorySettings::HandleConnectionDeletedL()
+    {
+    return NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// TAOStateResetFactorySettings::HandleExternalConnectionCreatedL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateResetFactorySettings::HandleExternalConnectionCreatedL()
+    {
+    return NULL;
+    }    
+
+// ---------------------------------------------------------------------------
+// TAOStateResetFactorySettings::HandleUnconnectTimerExpiredL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateResetFactorySettings::HandleUnconnectTimerExpiredL()
+    {
+    return NULL;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/src/taostatestarting.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,148 @@
+/*
+* Copyright (c) 2004,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:  Implements the TAOStateStarting class
+*
+*/
+
+
+// INCLUDE FILES
+#include "taostatestarting.h"
+#include "logger.h"
+
+//    METHODS
+
+// ---------------------------------------------------------------------------
+// TAOStateStarting::TAOStateStarting
+// ---------------------------------------------------------------------------
+//
+TAOStateStarting::TAOStateStarting( MAOStateContext& aStateContext, 
+                                    MAOStatePool& aStatePool ):
+    TAOState( aStateContext, aStatePool )
+    {
+    LOG_1( _L("TAOStateStarting::TAOStateStarting") );
+    }
+
+// ---------------------------------------------------------------------------
+// TAOStateStarting::StateName
+// ---------------------------------------------------------------------------
+//
+TAOState::TAOStateName TAOStateStarting::StateName() const
+    {
+    LOG_2( _L("TAOStateStarting::StateName: %d"),
+        TAOState::EStateStarting );
+    
+    return TAOState::EStateStarting;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateStarting::
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateStarting::HandleNetworkChangedL(
+        MAOConnectionManager::TNetworkType /*aNetworkType*/ )
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateStarting::
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateStarting::HandleSettingsReceivedL()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateStarting::HandlePDPContextActivatedL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateStarting::HandlePDPContextActivatedL()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateStarting::HandlePDPContextDisconnectedL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateStarting::HandlePDPContextDisconnectedL( TInt /*aReason*/ )
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateStarting::HandleSuccesfulRAUEventL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateStarting::HandleSuccesfulRAUEventL()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateStarting::HandleRetryTimerTriggeredL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateStarting::HandleRetryTimerTriggeredL()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateStarting::HandleConnectionTimerTriggeredL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateStarting::HandleConnectionTimerTriggeredL()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateStarting::HandlePDPContextTemporarilyBlockedL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateStarting::HandlePDPContextTemporarilyBlockedL()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateStarting::HandleGeneralError
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateStarting::HandleGeneralError()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateStarting::HandleSwitchFromDisconnectedL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateStarting::HandleSwitchFromDisconnectedL(
+        MAOConnectionManager::TFailureReason /*aReason*/ )
+    {
+    return NULL;
+    }
+// ---------------------------------------------------------------------------
+// TAOStateStarting::HandleExternalConnectionCreatedL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateStarting::HandleExternalConnectionCreatedL()
+    {
+    return NULL;
+    }
+    
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/src/taostateunconnected.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,177 @@
+/*
+* Copyright (c) 2004,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:  Implements the TAOStateUnconnected class
+*
+*/
+
+
+// INCLUDE FILES
+#include "taostateunconnected.h"
+#include "logger.h"
+#include "maostatecontext.h"
+#include "maostatepool.h"
+#include "maoconnectionmanager.h"
+#include "maotimer.h"
+
+//    METHODS
+
+// Constructor
+TAOStateUnconnected::TAOStateUnconnected(
+    MAOStateContext& aStateContext, MAOStatePool& aStatePool ):
+    TAOState( aStateContext, aStatePool )
+    {
+    LOG_1( _L("TAOStateUnconnected::TAOStateUnconnected") );
+    }
+
+// ---------------------------------------------------------------------------
+// TAOStateUnconnected::StateName
+// ---------------------------------------------------------------------------
+//
+TAOState::TAOStateName TAOStateUnconnected::StateName() const
+    {
+    LOG_2( _L("TAOStateUnconnected::StateName: %d"),
+        TAOState::EStateUnconnected );
+    
+    return TAOState::EStateUnconnected;
+    }
+
+// ---------------------------------------------------------------------------
+// TAOStateUnconnected::HandleConnectionDeletedL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateUnconnected::HandleConnectionDeletedL()
+    {
+    LOG_1( _L("TAOStateUnconnected::HandleConnectionDeletedL") );
+    
+    return TAOState::DoHandleConnectionDeletedL();
+    }
+
+// ---------------------------------------------------------------------------
+// TAOStateUnconnected::HandleUnconnectTimerExpiredL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateUnconnected::HandleUnconnectTimerExpiredL()
+    {
+    LOG_1( _L("TAOStateUnconnected::HandleUnconnectTimerExpiredL") );
+    
+    // First check that we don't have a connection ongoing.
+    // Browser acts funny if we try to open a connection while browsing
+    TAOState* newState = NULL;
+    if( !iStateContext.ConnectionManager().NumberOfConnections() )
+        {
+        // No ongoing connections, try to activate always on connection
+        newState = DoActivatePDPContextL();
+        }
+    else
+        {
+        // Already connected to some APN.
+        // Do not try to open a new connection but restart timer
+        iStateContext.Timer().StartUnconnectTimer();
+        }
+    return newState;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateUnconnected::HandlePDPContextActivatedL
+// ---------------------------------------------------------------------------
+//    
+TAOState* TAOStateUnconnected::HandlePDPContextActivatedL()
+    {
+    return NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// TAOStateUnconnected::HandlePDPContextActivationFailedL
+// ---------------------------------------------------------------------------
+//    
+TAOState* TAOStateUnconnected::HandlePDPContextActivationFailedL()
+    {
+    return NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// TAOStateUnconnected::HandlePDPContextDisconnectedL
+// ---------------------------------------------------------------------------
+//    
+TAOState* TAOStateUnconnected::HandlePDPContextDisconnectedL( 
+                               TInt /*aReason*/ )
+    {
+    return NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// TAOStateUnconnected::HandleRetryTimerTriggeredL
+// ---------------------------------------------------------------------------
+//    
+TAOState* TAOStateUnconnected::HandleRetryTimerTriggeredL()
+    {
+    return NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// TAOStateUnconnected::HandleConnectionTimerTriggeredL
+// ---------------------------------------------------------------------------
+//    
+TAOState* TAOStateUnconnected::HandleConnectionTimerTriggeredL()
+    {
+    return NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// TAOStateUnconnected::HandlePDPContextTemporarilyBlockedL
+// ---------------------------------------------------------------------------
+//    
+TAOState* TAOStateUnconnected::HandlePDPContextTemporarilyBlockedL()
+    {
+    return NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// TAOStateUnconnected::HandleGeneralError
+// ---------------------------------------------------------------------------
+//    
+TAOState* TAOStateUnconnected::HandleGeneralError()
+    {
+    return NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// TAOStateUnconnected::HandleEnableAlwaysOnL
+// ---------------------------------------------------------------------------
+//    
+TAOState* TAOStateUnconnected::HandleEnableAlwaysOnL()
+    {
+    return NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// TAOStateUnconnected::HandleSwitchFromDisconnectedL
+// ---------------------------------------------------------------------------
+//    
+TAOState* TAOStateUnconnected::HandleSwitchFromDisconnectedL(
+    MAOConnectionManager::TFailureReason /*aReason*/ )
+    {
+    return NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// TAOStateUnconnected::HandleExternalConnectionCreatedL
+// ---------------------------------------------------------------------------
+// 
+TAOState* TAOStateUnconnected::HandleExternalConnectionCreatedL()
+    {
+    return NULL;
+    }
+    
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alwayson_net_plugin/pdpcontextmanager2/src/taostatewaiting.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,175 @@
+/*
+* Copyright (c) 2004,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:  Implements the TAOStateWaiting class
+*
+*/
+
+
+// INCLUDE FILES
+#include "taostatewaiting.h"
+#include "logger.h"
+#include "maostatecontext.h"
+#include "maostatepool.h"
+#include "maotimer.h"
+
+//    METHODS
+
+// ---------------------------------------------------------------------------
+// TAOStateWaiting::TAOStateWaiting
+// ---------------------------------------------------------------------------
+//
+TAOStateWaiting::TAOStateWaiting(
+    MAOStateContext& aStateContext,
+    MAOStatePool& aStatePool ):
+    TAOState( aStateContext, aStatePool )
+    {
+    LOG_1( _L("TAOStateWaiting::TAOStateWaiting") );
+    }
+
+// ---------------------------------------------------------------------------
+// TAOStateWaiting::StateName
+// ---------------------------------------------------------------------------
+//
+TAOState::TAOStateName TAOStateWaiting::StateName() const
+    {
+    LOG_2( _L("TAOStateWaiting::StateName: %d"),
+        TAOState::EStateWaiting );
+    
+    return TAOState::EStateWaiting;
+    }
+
+// ---------------------------------------------------------------------------
+// TAOStateWaiting::HandleSuccesfulRAUEventL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateWaiting::HandleSuccesfulRAUEventL()
+    {
+    LOG_1( _L("TAOStateWaiting::HandleSuccesfulRAUEventL") );
+    
+    return DoActivatePDPContextL();
+    }
+
+// ---------------------------------------------------------------------------
+// TAOStateWaiting::HandleRetryTimerTriggeredL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateWaiting::HandleRetryTimerTriggeredL()
+    {
+    LOG_1( _L("TAOStateWaiting::HandleRetryTimerTriggeredL") );
+
+    return DoActivatePDPContextL();
+    }
+
+// ---------------------------------------------------------------------------
+// TAOStateWaiting::DoActivatePDPContextL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateWaiting::DoActivatePDPContextL()
+    {
+    LOG_1( _L("TAOStateWaiting::DoActivatePDPContextL") );
+    
+    iStateContext.Timer().StartConnectionTimer();
+    iStateContext.ConnectionManager().ActivatePDPContextL();
+    return iStatePool.ChangeState( TAOState::EStateConnecting );
+    }
+
+// ---------------------------------------------------------------------------
+// TAOStateWaiting::HandleConnectionDeletedL
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateWaiting::HandleConnectionDeletedL()
+    {
+    LOG_1( _L("TAOStateWaiting::HandleConnectionDeletedL") );
+    
+    return TAOState::DoHandleConnectionDeletedL();
+    }
+
+// These all must be ignored in waiting state.
+// @see TAOState
+        
+// ---------------------------------------------------------------------------
+// TAOStateWaiting::
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateWaiting::HandlePDPContextActivatedL()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateWaiting::
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateWaiting::HandlePDPContextActivationFailedL()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateWaiting::
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateWaiting::HandlePDPContextDisconnectedL( TInt /*aReason*/ )
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateWaiting::
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateWaiting::HandleConnectionTimerTriggeredL()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateWaiting::
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateWaiting::HandlePDPContextTemporarilyBlockedL()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateWaiting::
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateWaiting::HandleGeneralError()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateWaiting::
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateWaiting::HandleEnableAlwaysOnL()
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// TAOStateWaiting::
+// ---------------------------------------------------------------------------
+//
+TAOState* TAOStateWaiting::HandleSwitchFromDisconnectedL(
+            MAOConnectionManager::TFailureReason /*aReason*/ )
+    {
+    return NULL;
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apeng/BWinsCw/ApEngine_EKA2U.def	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,181 @@
+EXPORTS
+	??0CApAccessPointItem@@IAE@XZ @ 1 NONAME ; CApAccessPointItem::CApAccessPointItem(void)
+	??0CApDataHandler@@IAE@XZ @ 2 NONAME ; CApDataHandler::CApDataHandler(void)
+	??0CApListItem@@IAE@XZ @ 3 NONAME ; CApListItem::CApListItem(void)
+	??0CApListItemList@@QAE@XZ @ 4 NONAME ; CApListItemList::CApListItemList(void)
+	??0CApNetworkItem@@AAE@XZ @ 5 NONAME ; CApNetworkItem::CApNetworkItem(void)
+	??0CApNetworkItemList@@QAE@XZ @ 6 NONAME ; CApNetworkItemList::CApNetworkItemList(void)
+	??0CApNetworks@@AAE@XZ @ 7 NONAME ; CApNetworks::CApNetworks(void)
+	??0CApSelect@@IAE@XZ @ 8 NONAME ; CApSelect::CApSelect(void)
+	??0CApUtils@@IAE@XZ @ 9 NONAME ; CApUtils::CApUtils(void)
+	??0CVpnApEngine@@AAE@XZ @ 10 NONAME ; CVpnApEngine::CVpnApEngine(void)
+	??0CVpnApItem@@AAE@XZ @ 11 NONAME ; CVpnApItem::CVpnApItem(void)
+	??1CActiveApDb@@UAE@XZ @ 12 NONAME ; CActiveApDb::~CActiveApDb(void)
+	??1CApAccessPointItem@@UAE@XZ @ 13 NONAME ; CApAccessPointItem::~CApAccessPointItem(void)
+	??1CApDataHandler@@UAE@XZ @ 14 NONAME ; CApDataHandler::~CApDataHandler(void)
+	??1CApListItem@@UAE@XZ @ 15 NONAME ; CApListItem::~CApListItem(void)
+	??1CApListItemList@@UAE@XZ @ 16 NONAME ; CApListItemList::~CApListItemList(void)
+	??1CApNetworkItem@@UAE@XZ @ 17 NONAME ; CApNetworkItem::~CApNetworkItem(void)
+	??1CApNetworkItemList@@UAE@XZ @ 18 NONAME ; CApNetworkItemList::~CApNetworkItemList(void)
+	??1CApNetworks@@UAE@XZ @ 19 NONAME ; CApNetworks::~CApNetworks(void)
+	??1CApSelect@@UAE@XZ @ 20 NONAME ; CApSelect::~CApSelect(void)
+	??1CApUtils@@UAE@XZ @ 21 NONAME ; CApUtils::~CApUtils(void)
+	??1CVpnApEngine@@UAE@XZ @ 22 NONAME ; CVpnApEngine::~CVpnApEngine(void)
+	??1CVpnApItem@@UAE@XZ @ 23 NONAME ; CVpnApItem::~CVpnApItem(void)
+	??8CApAccessPointItem@@QBEHABV0@@Z @ 24 NONAME ; int CApAccessPointItem::operator==(class CApAccessPointItem const &) const
+	??8CVpnApItem@@QBEHABV0@@Z @ 25 NONAME ; int CVpnApItem::operator==(class CVpnApItem const &) const
+	??9CApAccessPointItem@@QBEHABV0@@Z @ 26 NONAME ; int CApAccessPointItem::operator!=(class CApAccessPointItem const &) const
+	??9CVpnApItem@@QBEHABV0@@Z @ 27 NONAME ; int CVpnApItem::operator!=(class CVpnApItem const &) const
+	?AccessPointDataL@CApDataHandler@@QAEXKAAVCApAccessPointItem@@@Z @ 28 NONAME ; void CApDataHandler::AccessPointDataL(unsigned long, class CApAccessPointItem &)
+	?AddObserverL@CActiveApDb@@QAEXPAVMActiveApDbObserver@@@Z @ 29 NONAME ; void CActiveApDb::AddObserverL(class MActiveApDbObserver *)
+	?AllListItemDataL@CApNetworks@@QAEHAAVCApNetworkItemList@@@Z @ 30 NONAME ; int CApNetworks::AllListItemDataL(class CApNetworkItemList &)
+	?AllListItemDataL@CApSelect@@QAEHAAVCApListItemList@@@Z @ 31 NONAME ; int CApSelect::AllListItemDataL(class CApListItemList &)
+	?BearerFilter@CApSelect@@QAEHXZ @ 32 NONAME ; int CApSelect::BearerFilter(void)
+	?BearerType@CApListItem@@QAE?AW4TApBearerType@@XZ @ 33 NONAME ; enum TApBearerType CApListItem::BearerType(void)
+	?BearerType@CApSelect@@QAE?AW4TApBearerType@@XZ @ 34 NONAME ; enum TApBearerType CApSelect::BearerType(void)
+	?BearerTypeL@CApAccessPointItem@@QAE?AW4TApBearerType@@XZ @ 35 NONAME ; enum TApBearerType CApAccessPointItem::BearerTypeL(void)
+	?BearerTypeL@CApUtils@@QAE?AW4TApBearerType@@K@Z @ 36 NONAME ; enum TApBearerType CApUtils::BearerTypeL(unsigned long)
+	?ConnectionName@CApAccessPointItem@@QBEABVTDesC16@@XZ @ 37 NONAME ; class TDesC16 const & CApAccessPointItem::ConnectionName(void) const
+	?ConstructL@CApAccessPointItem@@IAEXXZ @ 38 NONAME ; void CApAccessPointItem::ConstructL(void)
+	?ConstructL@CApDataHandler@@IAEXAAVCCommsDatabase@@@Z @ 39 NONAME ; void CApDataHandler::ConstructL(class CCommsDatabase &)
+	?ConstructL@CApListItem@@IAEXW4TCommsDbIspType@@KABVTDesC16@@W4TApBearerType@@1@Z @ 40 NONAME ; void CApListItem::ConstructL(enum TCommsDbIspType, unsigned long, class TDesC16 const &, enum TApBearerType, class TDesC16 const &)
+	?ConstructL@CApListItem@@IAEXW4TCommsDbIspType@@KABVTDesC16@@W4TApBearerType@@@Z @ 41 NONAME ; void CApListItem::ConstructL(enum TCommsDbIspType, unsigned long, class TDesC16 const &, enum TApBearerType)
+	?ConstructL@CApListItem@@IAEXXZ @ 42 NONAME ; void CApListItem::ConstructL(void)
+	?ConstructL@CApNetworkItem@@AAEXKABVTDesC16@@@Z @ 43 NONAME ; void CApNetworkItem::ConstructL(unsigned long, class TDesC16 const &)
+	?ConstructL@CApNetworkItem@@AAEXXZ @ 44 NONAME ; void CApNetworkItem::ConstructL(void)
+	?ConstructL@CApNetworks@@AAEXAAVCCommsDatabase@@@Z @ 45 NONAME ; void CApNetworks::ConstructL(class CCommsDatabase &)
+	?ConstructL@CApSelect@@IAEXAAVCCommsDatabase@@HHH@Z @ 46 NONAME ; void CApSelect::ConstructL(class CCommsDatabase &, int, int, int)
+	?ConstructL@CApSelect@@IAEXAAVCCommsDatabase@@HHHH@Z @ 47 NONAME ; void CApSelect::ConstructL(class CCommsDatabase &, int, int, int, int)
+	?ConstructL@CApSelect@@IAEXAAVCCommsDatabase@@HHHHW4TVpnFilterType@@@Z @ 48 NONAME ; void CApSelect::ConstructL(class CCommsDatabase &, int, int, int, int, enum TVpnFilterType)
+	?ConstructL@CApUtils@@IAEXAAVCCommsDatabase@@@Z @ 49 NONAME ; void CApUtils::ConstructL(class CCommsDatabase &)
+	?ConstructL@CVpnApEngine@@IAEXPAVCCommsDatabase@@@Z @ 50 NONAME ; void CVpnApEngine::ConstructL(class CCommsDatabase *)
+	?ConstructL@CVpnApItem@@IAEXXZ @ 51 NONAME ; void CVpnApItem::ConstructL(void)
+	?CopyFromL@CApAccessPointItem@@QAEXABV1@@Z @ 52 NONAME ; void CApAccessPointItem::CopyFromL(class CApAccessPointItem const &)
+	?CopyFromL@CApListItem@@QAEXABV1@@Z @ 53 NONAME ; void CApListItem::CopyFromL(class CApListItem const &)
+	?CopyFromL@CApNetworkItem@@QAEXABV1@@Z @ 54 NONAME ; void CApNetworkItem::CopyFromL(class CApNetworkItem const &)
+	?CopyFromL@CVpnApItem@@QAEXABV1@@Z @ 55 NONAME ; void CVpnApItem::CopyFromL(class CVpnApItem const &)
+	?Count@CApNetworks@@QBEKXZ @ 56 NONAME ; unsigned long CApNetworks::Count(void) const
+	?Count@CApSelect@@QAEKXZ @ 57 NONAME ; unsigned long CApSelect::Count(void)
+	?CreateCopyFromL@CApDataHandler@@QAEKK@Z @ 58 NONAME ; unsigned long CApDataHandler::CreateCopyFromL(unsigned long)
+	?CreateFromDataL@CApDataHandler@@QAEKAAVCApAccessPointItem@@@Z @ 59 NONAME ; unsigned long CApDataHandler::CreateFromDataL(class CApAccessPointItem &)
+	?CreateNetworkL@CApDataHandler@@QAEXAAVCApNetworkItem@@@Z @ 60 NONAME ; void CApDataHandler::CreateNetworkL(class CApNetworkItem &)
+	?CreateVpnApL@CVpnApEngine@@QAEKAAVCVpnApItem@@@Z @ 61 NONAME ; unsigned long CVpnApEngine::CreateVpnApL(class CVpnApItem &)
+	?CreateVpnApL@CVpnApEngine@@QAEKAAVTDesC16@@K0PAV2@K@Z @ 62 NONAME ; unsigned long CVpnApEngine::CreateVpnApL(class TDesC16 &, unsigned long, class TDesC16 &, class TDesC16 *, unsigned long)
+	?Cvt@CVpnApEngine@@SAHXZ @ 63 NONAME ; int CVpnApEngine::Cvt(void)
+	?Database@CActiveApDb@@QAEPAVCCommsDatabase@@XZ @ 64 NONAME ; class CCommsDatabase * CActiveApDb::Database(void)
+	?DefaultL@CApDataHandler@@QBEKH@Z @ 65 NONAME ; unsigned long CApDataHandler::DefaultL(int) const
+	?DefaultL@CApDataHandler@@QBEKHAAH@Z @ 66 NONAME ; unsigned long CApDataHandler::DefaultL(int, int &) const
+	?DeleteVpnL@CVpnApEngine@@QAEXK@Z @ 67 NONAME ; void CVpnApEngine::DeleteVpnL(unsigned long)
+	?DoHasMandatoryFieldsFilledL@CApUtils@@QAEHKPAVCCommsDbTableView@@W4TApBearerType@@@Z @ 68 NONAME ; int CApUtils::DoHasMandatoryFieldsFilledL(unsigned long, class CCommsDbTableView *, enum TApBearerType)
+	?GetPreferredIfDbIapTypeL@CApDataHandler@@QAEXKW4TCommDbConnectionDirection@@AAK11@Z @ 69 NONAME ; void CApDataHandler::GetPreferredIfDbIapTypeL(unsigned long, enum TCommDbConnectionDirection, unsigned long &, unsigned long &, unsigned long &)
+	?GetPreferredIfDbIspTypeL@CApDataHandler@@QAEABVTDesC16@@KW4TCommDbConnectionDirection@@AAK111@Z @ 70 NONAME ; class TDesC16 const & CApDataHandler::GetPreferredIfDbIspTypeL(unsigned long, enum TCommDbConnectionDirection, unsigned long &, unsigned long &, unsigned long &, unsigned long &)
+	?HasMandatoryFieldsFilledL@CApUtils@@QAEHK@Z @ 71 NONAME ; int CApUtils::HasMandatoryFieldsFilledL(unsigned long)
+	?HasSameIspAndBearerL@CApAccessPointItem@@QAEHAAV1@@Z @ 72 NONAME ; int CApAccessPointItem::HasSameIspAndBearerL(class CApAccessPointItem &)
+	?IAPExistsL@CApUtils@@QAEHK@Z @ 73 NONAME ; int CApUtils::IAPExistsL(unsigned long)
+	?ISPTypeL@CApUtils@@QAEXKAAW4TCommsDbIspType@@@Z @ 74 NONAME ; void CApUtils::ISPTypeL(unsigned long, enum TCommsDbIspType &)
+	?IapIdFromWapIdL@CApUtils@@QAEKK@Z @ 75 NONAME ; unsigned long CApUtils::IapIdFromWapIdL(unsigned long)
+	?IsAPInUseL@CApUtils@@QAEHK@Z @ 76 NONAME ; int CApUtils::IsAPInUseL(unsigned long)
+	?IsApProtectedL@CApProtHandler@@SAHPAVCCommsDatabase@@K@Z @ 77 NONAME ; int CApProtHandler::IsApProtectedL(class CCommsDatabase *, unsigned long)
+	?IsPreferencesProtectedL@CApProtHandler@@SAHPAVCCommsDatabase@@@Z @ 78 NONAME ; int CApProtHandler::IsPreferencesProtectedL(class CCommsDatabase *)
+	?IsReadOnly@CApAccessPointItem@@QBEHXZ @ 79 NONAME ; int CApAccessPointItem::IsReadOnly(void) const
+	?IsReadOnly@CApListItem@@QBEHXZ @ 80 NONAME ; int CApListItem::IsReadOnly(void) const
+	?IsReadOnly@CApSelect@@QBEHXZ @ 81 NONAME ; int CApSelect::IsReadOnly(void) const
+	?IsReadOnlyL@CApUtils@@QAEHK@Z @ 82 NONAME ; int CApUtils::IsReadOnlyL(unsigned long)
+	?IsTableProtectedL@CApProtHandler@@SAHPAVCCommsDatabase@@@Z @ 83 NONAME ; int CApProtHandler::IsTableProtectedL(class CCommsDatabase *)
+	?IsValidNameL@CApUtils@@QAEHABVTDesC16@@@Z @ 84 NONAME ; int CApUtils::IsValidNameL(class TDesC16 const &)
+	?IsValidNameL@CApUtils@@QAEHABVTDesC16@@K@Z @ 85 NONAME ; int CApUtils::IsValidNameL(class TDesC16 const &, unsigned long)
+	?IsVpnApL@CVpnApEngine@@QAEHK@Z @ 86 NONAME ; int CVpnApEngine::IsVpnApL(unsigned long)
+	?IspTypeFilter@CApSelect@@QAEHXZ @ 87 NONAME ; int CApSelect::IspTypeFilter(void)
+	?ItemForUid@CApListItemList@@QBEPAVCApListItem@@K@Z @ 88 NONAME ; class CApListItem * CApListItemList::ItemForUid(unsigned long) const
+	?ItemForUid@CApNetworkItemList@@QBEPBVCApNetworkItem@@K@Z @ 89 NONAME ; class CApNetworkItem const * CApNetworkItemList::ItemForUid(unsigned long) const
+	?MakeValidNameL@CApUtils@@QAEHAAVTDes16@@@Z @ 90 NONAME ; int CApUtils::MakeValidNameL(class TDes16 &)
+	?MoveLast@CApSelect@@QAEHXZ @ 91 NONAME ; int CApSelect::MoveLast(void)
+	?MoveNext@CApSelect@@QAEHXZ @ 92 NONAME ; int CApSelect::MoveNext(void)
+	?MovePrev@CApSelect@@QAEHXZ @ 93 NONAME ; int CApSelect::MovePrev(void)
+	?MoveToFirst@CApSelect@@QAEHXZ @ 94 NONAME ; int CApSelect::MoveToFirst(void)
+	?Name@CApListItem@@QAEABVTDesC16@@XZ @ 95 NONAME ; class TDesC16 const & CApListItem::Name(void)
+	?Name@CApNetworkItem@@QBEABVTDesC16@@XZ @ 96 NONAME ; class TDesC16 const & CApNetworkItem::Name(void) const
+	?Name@CApSelect@@QAEABVTDesC16@@XZ @ 97 NONAME ; class TDesC16 const & CApSelect::Name(void)
+	?Name@CVpnApItem@@QBEABVTDesC16@@XZ @ 98 NONAME ; class TDesC16 const & CVpnApItem::Name(void) const
+	?NameL@CApNetworks@@QBEABVTDesC16@@K@Z @ 99 NONAME ; class TDesC16 const & CApNetworks::NameL(unsigned long) const
+	?NameL@CApUtils@@QAEXKAAVTDes16@@@Z @ 100 NONAME ; void CApUtils::NameL(unsigned long, class TDes16 &)
+	?NewL@CActiveApDb@@SAPAV1@W4TCommDbDatabaseType@@@Z @ 101 NONAME ; class CActiveApDb * CActiveApDb::NewL(enum TCommDbDatabaseType)
+	?NewLC@CApAccessPointItem@@SAPAV1@XZ @ 102 NONAME ; class CApAccessPointItem * CApAccessPointItem::NewLC(void)
+	?NewLC@CApDataHandler@@SAPAV1@AAVCCommsDatabase@@@Z @ 103 NONAME ; class CApDataHandler * CApDataHandler::NewLC(class CCommsDatabase &)
+	?NewLC@CApListItem@@SAPAV1@PAV1@@Z @ 104 NONAME ; class CApListItem * CApListItem::NewLC(class CApListItem *)
+	?NewLC@CApListItem@@SAPAV1@W4TCommsDbIspType@@KABVTDesC16@@W4TApBearerType@@1H@Z @ 105 NONAME ; class CApListItem * CApListItem::NewLC(enum TCommsDbIspType, unsigned long, class TDesC16 const &, enum TApBearerType, class TDesC16 const &, int)
+	?NewLC@CApListItem@@SAPAV1@W4TCommsDbIspType@@KABVTDesC16@@W4TApBearerType@@@Z @ 106 NONAME ; class CApListItem * CApListItem::NewLC(enum TCommsDbIspType, unsigned long, class TDesC16 const &, enum TApBearerType)
+	?NewLC@CApListItem@@SAPAV1@XZ @ 107 NONAME ; class CApListItem * CApListItem::NewLC(void)
+	?NewLC@CApNetworkItem@@SAPAV1@PAV1@@Z @ 108 NONAME ; class CApNetworkItem * CApNetworkItem::NewLC(class CApNetworkItem *)
+	?NewLC@CApNetworkItem@@SAPAV1@XZ @ 109 NONAME ; class CApNetworkItem * CApNetworkItem::NewLC(void)
+	?NewLC@CApNetworks@@SAPAV1@AAVCCommsDatabase@@@Z @ 110 NONAME ; class CApNetworks * CApNetworks::NewLC(class CCommsDatabase &)
+	?NewLC@CApSelect@@SAPAV1@AAVCCommsDatabase@@HHH@Z @ 111 NONAME ; class CApSelect * CApSelect::NewLC(class CCommsDatabase &, int, int, int)
+	?NewLC@CApSelect@@SAPAV1@AAVCCommsDatabase@@HHHH@Z @ 112 NONAME ; class CApSelect * CApSelect::NewLC(class CCommsDatabase &, int, int, int, int)
+	?NewLC@CApSelect@@SAPAV1@AAVCCommsDatabase@@HHHHW4TVpnFilterType@@@Z @ 113 NONAME ; class CApSelect * CApSelect::NewLC(class CCommsDatabase &, int, int, int, int, enum TVpnFilterType)
+	?NewLC@CApUtils@@SAPAV1@AAVCCommsDatabase@@@Z @ 114 NONAME ; class CApUtils * CApUtils::NewLC(class CCommsDatabase &)
+	?NewLC@CVpnApEngine@@SAPAV1@PAVCCommsDatabase@@@Z @ 115 NONAME ; class CVpnApEngine * CVpnApEngine::NewLC(class CCommsDatabase *)
+	?NewLC@CVpnApItem@@SAPAV1@XZ @ 116 NONAME ; class CVpnApItem * CVpnApItem::NewLC(void)
+	?ProtectItemL@CApProtHandler@@SAXPAVCCommsDatabase@@K@Z @ 117 NONAME ; void CApProtHandler::ProtectItemL(class CCommsDatabase *, unsigned long)
+	?ProtectPreferencesL@CApProtHandler@@SAXPAVCCommsDatabase@@@Z @ 118 NONAME ; void CApProtHandler::ProtectPreferencesL(class CCommsDatabase *)
+	?ProtectTableL@CApProtHandler@@SAXPAVCCommsDatabase@@@Z @ 119 NONAME ; void CApProtHandler::ProtectTableL(class CCommsDatabase *)
+	?ReadBool@CApAccessPointItem@@QAEHW4TApMember@@AAH@Z @ 120 NONAME ; int CApAccessPointItem::ReadBool(enum TApMember, int &)
+	?ReadBool@CVpnApItem@@QAEHW4TVpnApMember@@AAH@Z @ 121 NONAME ; int CVpnApItem::ReadBool(enum TVpnApMember, int &)
+	?ReadConstLongTextL@CApAccessPointItem@@QAEPBVHBufC16@@W4TApMember@@@Z @ 122 NONAME ; class HBufC16 const * CApAccessPointItem::ReadConstLongTextL(enum TApMember)
+	?ReadConstLongTextL@CVpnApItem@@QAEPBVHBufC16@@W4TVpnApMember@@@Z @ 123 NONAME ; class HBufC16 const * CVpnApItem::ReadConstLongTextL(enum TVpnApMember)
+	?ReadLongTextL@CApAccessPointItem@@QAEPAVHBufC16@@W4TApMember@@@Z @ 124 NONAME ; class HBufC16 * CApAccessPointItem::ReadLongTextL(enum TApMember)
+	?ReadNetworkL@CApDataHandler@@QAEXKAAVCApNetworkItem@@@Z @ 125 NONAME ; void CApDataHandler::ReadNetworkL(unsigned long, class CApNetworkItem &)
+	?ReadNetworkPartL@CApDataHandler@@QAEXAAVCApAccessPointItem@@@Z @ 126 NONAME ; void CApDataHandler::ReadNetworkPartL(class CApAccessPointItem &)
+	?ReadTextL@CApAccessPointItem@@QAEXW4TApMember@@AAVTDes16@@@Z @ 127 NONAME ; void CApAccessPointItem::ReadTextL(enum TApMember, class TDes16 &)
+	?ReadTextL@CApAccessPointItem@@QAEXW4TApMember@@AAVTDes8@@@Z @ 128 NONAME ; void CApAccessPointItem::ReadTextL(enum TApMember, class TDes8 &)
+	?ReadTextL@CVpnApItem@@QAEXW4TVpnApMember@@AAVTDes16@@@Z @ 129 NONAME ; void CVpnApItem::ReadTextL(enum TVpnApMember, class TDes16 &)
+	?ReadTextLengthL@CApAccessPointItem@@QAEKW4TApMember@@@Z @ 130 NONAME ; unsigned long CApAccessPointItem::ReadTextLengthL(enum TApMember)
+	?ReadUint@CApAccessPointItem@@QAEHW4TApMember@@AAK@Z @ 131 NONAME ; int CApAccessPointItem::ReadUint(enum TApMember, unsigned long &)
+	?ReadUint@CVpnApItem@@QAEHW4TVpnApMember@@AAK@Z @ 132 NONAME ; int CVpnApItem::ReadUint(enum TVpnApMember, unsigned long &)
+	?RemoveAPL@CApDataHandler@@QAEXK@Z @ 133 NONAME ; void CApDataHandler::RemoveAPL(unsigned long)
+	?RemoveNetworkL@CApDataHandler@@QAEXK@Z @ 134 NONAME ; void CApDataHandler::RemoveNetworkL(unsigned long)
+	?RemoveObserver@CActiveApDb@@QAEXPAVMActiveApDbObserver@@@Z @ 135 NONAME ; void CActiveApDb::RemoveObserver(class MActiveApDbObserver *)
+	?RemoveProtectedAccessPointsL@CApProtHandler@@SAXPAVCCommsDatabase@@@Z @ 136 NONAME ; void CApProtHandler::RemoveProtectedAccessPointsL(class CCommsDatabase *)
+	?SanityCheckOk@CApAccessPointItem@@QAEHXZ @ 137 NONAME ; int CApAccessPointItem::SanityCheckOk(void)
+	?SetAsDefaultL@CApDataHandler@@QAEXKW4TCommsDbIspType@@@Z @ 138 NONAME ; void CApDataHandler::SetAsDefaultL(unsigned long, enum TCommsDbIspType)
+	?SetBearerTypeL@CApAccessPointItem@@QAEXW4TApBearerType@@@Z @ 139 NONAME ; void CApAccessPointItem::SetBearerTypeL(enum TApBearerType)
+	?SetFiltersL@CApSelect@@QAEXHHH@Z @ 140 NONAME ; void CApSelect::SetFiltersL(int, int, int)
+	?SetISPTypeL@CApUtils@@QAEXKW4TCommsDbIspType@@@Z @ 141 NONAME ; void CApUtils::SetISPTypeL(unsigned long, enum TCommsDbIspType)
+	?SetItemL@CApListItem@@QAEXW4TCommsDbIspType@@KABVTDesC16@@W4TApBearerType@@1@Z @ 142 NONAME ; void CApListItem::SetItemL(enum TCommsDbIspType, unsigned long, class TDesC16 const &, enum TApBearerType, class TDesC16 const &)
+	?SetItemL@CApListItem@@QAEXW4TCommsDbIspType@@KABVTDesC16@@W4TApBearerType@@@Z @ 143 NONAME ; void CApListItem::SetItemL(enum TCommsDbIspType, unsigned long, class TDesC16 const &, enum TApBearerType)
+	?SetNameL@CApNetworkItem@@QAEXABVTDesC16@@@Z @ 144 NONAME ; void CApNetworkItem::SetNameL(class TDesC16 const &)
+	?SetNameL@CApUtils@@QAEXAAVTDes16@@K@Z @ 145 NONAME ; void CApUtils::SetNameL(class TDes16 &, unsigned long)
+	?SetNamesL@CApAccessPointItem@@QAEXABVTDesC16@@@Z @ 146 NONAME ; void CApAccessPointItem::SetNamesL(class TDesC16 const &)
+	?SetPreferredIfDbIapTypeL@CApDataHandler@@QAEXKW4TCommDbConnectionDirection@@KW4TCommDbDialogPref@@KH@Z @ 147 NONAME ; void CApDataHandler::SetPreferredIfDbIapTypeL(unsigned long, enum TCommDbConnectionDirection, unsigned long, enum TCommDbDialogPref, unsigned long, int)
+	?SetPreferredIfDbIspTypeL@CApDataHandler@@QAEXKW4TCommDbConnectionDirection@@KW4TCommDbDialogPref@@KKABVTDesC16@@H@Z @ 148 NONAME ; void CApDataHandler::SetPreferredIfDbIspTypeL(unsigned long, enum TCommDbConnectionDirection, unsigned long, enum TCommDbDialogPref, unsigned long, unsigned long, class TDesC16 const &, int)
+	?SetUid@CApNetworkItem@@QAEXK@Z @ 149 NONAME ; void CApNetworkItem::SetUid(unsigned long)
+	?SortOrder@CApSelect@@QAEHXZ @ 150 NONAME ; int CApSelect::SortOrder(void)
+	?StartPage@CApListItem@@QBEABVTDesC16@@XZ @ 151 NONAME ; class TDesC16 const & CApListItem::StartPage(void) const
+	?Type@CApListItem@@QAE?AW4TCommsDbIspType@@XZ @ 152 NONAME ; enum TCommsDbIspType CApListItem::Type(void)
+	?Type@CApSelect@@QAE?AW4TCommsDbIspType@@XZ @ 153 NONAME ; enum TCommsDbIspType CApSelect::Type(void)
+	?Uid@CApListItem@@QAEKXZ @ 154 NONAME ; unsigned long CApListItem::Uid(void)
+	?Uid@CApNetworkItem@@QBEKXZ @ 155 NONAME ; unsigned long CApNetworkItem::Uid(void) const
+	?Uid@CApSelect@@QAEKXZ @ 156 NONAME ; unsigned long CApSelect::Uid(void)
+	?UnprotectItemL@CApProtHandler@@SAXPAVCCommsDatabase@@K@Z @ 157 NONAME ; void CApProtHandler::UnprotectItemL(class CCommsDatabase *, unsigned long)
+	?UnprotectPreferencesL@CApProtHandler@@SAXPAVCCommsDatabase@@@Z @ 158 NONAME ; void CApProtHandler::UnprotectPreferencesL(class CCommsDatabase *)
+	?UnprotectTableL@CApProtHandler@@SAXPAVCCommsDatabase@@@Z @ 159 NONAME ; void CApProtHandler::UnprotectTableL(class CCommsDatabase *)
+	?UpdateAccessPointDataL@CApDataHandler@@QAEXAAVCApAccessPointItem@@AAH@Z @ 160 NONAME ; void CApDataHandler::UpdateAccessPointDataL(class CApAccessPointItem &, int &)
+	?UpdateVpnDataL@CVpnApEngine@@QAEXAAVCVpnApItem@@@Z @ 161 NONAME ; void CVpnApEngine::UpdateVpnDataL(class CVpnApItem &)
+	?VpnDataL@CVpnApEngine@@QAEXKAAVCVpnApItem@@@Z @ 162 NONAME ; void CVpnApEngine::VpnDataL(unsigned long, class CVpnApItem &)
+	?WapApExistsL@CApUtils@@QAEHK@Z @ 163 NONAME ; int CApUtils::WapApExistsL(unsigned long)
+	?WapBearer@CApAccessPointItem@@QBEABVTDesC16@@XZ @ 164 NONAME ; class TDesC16 const & CApAccessPointItem::WapBearer(void) const
+	?WapBearerTypeL@CApUtils@@QAEXKAAVTDes16@@@Z @ 165 NONAME ; void CApUtils::WapBearerTypeL(unsigned long, class TDes16 &)
+	?WapIdFromIapIdL@CApUtils@@QAEKK@Z @ 166 NONAME ; unsigned long CApUtils::WapIdFromIapIdL(unsigned long)
+	?WapUid@CApAccessPointItem@@QBEKXZ @ 167 NONAME ; unsigned long CApAccessPointItem::WapUid(void) const
+	?WapUid@CVpnApItem@@QBEKXZ @ 168 NONAME ; unsigned long CVpnApItem::WapUid(void) const
+	?WriteBool@CApAccessPointItem@@QAEHW4TApMember@@ABH@Z @ 169 NONAME ; int CApAccessPointItem::WriteBool(enum TApMember, int const &)
+	?WriteBool@CVpnApItem@@QAEHW4TVpnApMember@@ABH@Z @ 170 NONAME ; int CVpnApItem::WriteBool(enum TVpnApMember, int const &)
+	?WriteLongTextL@CApAccessPointItem@@QAEHW4TApMember@@ABVTDesC16@@@Z @ 171 NONAME ; int CApAccessPointItem::WriteLongTextL(enum TApMember, class TDesC16 const &)
+	?WriteLongTextL@CVpnApItem@@QAEHW4TVpnApMember@@ABVTDesC16@@@Z @ 172 NONAME ; int CVpnApItem::WriteLongTextL(enum TVpnApMember, class TDesC16 const &)
+	?WriteTextL@CApAccessPointItem@@QAEHW4TApMember@@ABVTDesC16@@@Z @ 173 NONAME ; int CApAccessPointItem::WriteTextL(enum TApMember, class TDesC16 const &)
+	?WriteTextL@CApAccessPointItem@@QAEHW4TApMember@@ABVTDesC8@@@Z @ 174 NONAME ; int CApAccessPointItem::WriteTextL(enum TApMember, class TDesC8 const &)
+	?WriteTextL@CVpnApItem@@QAEHW4TVpnApMember@@ABVTDesC16@@@Z @ 175 NONAME ; int CVpnApItem::WriteTextL(enum TVpnApMember, class TDesC16 const &)
+	?WriteUint@CApAccessPointItem@@QAEHW4TApMember@@ABK@Z @ 176 NONAME ; int CApAccessPointItem::WriteUint(enum TApMember, unsigned long const &)
+	?WriteUint@CVpnApItem@@QAEHW4TVpnApMember@@ABK@Z @ 177 NONAME ; int CVpnApItem::WriteUint(enum TVpnApMember, unsigned long const &)
+	?ConstructL@CApSelect@@IAEXAAVCCommsDatabase@@HHHHW4TVpnFilterType@@H@Z @ 178 NONAME ; void CApSelect::ConstructL(class CCommsDatabase &, int, int, int, int, enum TVpnFilterType, int)
+	?NewLC@CApSelect@@SAPAV1@AAVCCommsDatabase@@HHHHW4TVpnFilterType@@H@Z @ 179 NONAME ; class CApSelect * CApSelect::NewLC(class CCommsDatabase &, int, int, int, int, enum TVpnFilterType, int)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apeng/Data/ApEngine.rss	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2002 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 all the resources for the ApEngine.
+*
+*/
+
+
+//  RESOURCE IDENTIFIER
+NAME    APNG // 4 letter ID
+
+//  INCLUDES
+#include <apengine.loc>
+#include <eikon.rh>
+
+
+//  RESOURCE DEFINITIONS
+
+RESOURCE RSS_SIGNATURE {}
+
+RESOURCE TBUF { buf="ApEngine"; }
+
+RESOURCE TBUF64 r_apng_default_ap_name                { buf =  qtn_set_ap_default_name; }
+
+RESOURCE TBUF64 r_apng_default_vpn_ap_name            { buf =  qtn_vpn_sett_vpn_iap_default_name; }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apeng/EABI/ApEngine_EKA2U.def	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,238 @@
+EXPORTS
+	_ZN10CVpnApItem10ConstructLEv @ 1 NONAME
+	_ZN10CVpnApItem10WriteTextLE12TVpnApMemberRK7TDesC16 @ 2 NONAME
+	_ZN10CVpnApItem14WriteLongTextLE12TVpnApMemberRK7TDesC16 @ 3 NONAME
+	_ZN10CVpnApItem18ReadConstLongTextLE12TVpnApMember @ 4 NONAME
+	_ZN10CVpnApItem5NewLCEv @ 5 NONAME
+	_ZN10CVpnApItem8ReadBoolE12TVpnApMemberRi @ 6 NONAME
+	_ZN10CVpnApItem8ReadUintE12TVpnApMemberRm @ 7 NONAME
+	_ZN10CVpnApItem9CopyFromLERKS_ @ 8 NONAME
+	_ZN10CVpnApItem9ReadTextLE12TVpnApMemberR6TDes16 @ 9 NONAME
+	_ZN10CVpnApItem9WriteBoolE12TVpnApMemberRKi @ 10 NONAME
+	_ZN10CVpnApItem9WriteUintE12TVpnApMemberRKm @ 11 NONAME
+	_ZN10CVpnApItemC1Ev @ 12 NONAME
+	_ZN10CVpnApItemC2Ev @ 13 NONAME
+	_ZN10CVpnApItemD0Ev @ 14 NONAME
+	_ZN10CVpnApItemD1Ev @ 15 NONAME
+	_ZN10CVpnApItemD2Ev @ 16 NONAME
+	_ZN11CActiveApDb12AddObserverLEP19MActiveApDbObserver @ 17 NONAME
+	_ZN11CActiveApDb14RemoveObserverEP19MActiveApDbObserver @ 18 NONAME
+	_ZN11CActiveApDb4NewLE19TCommDbDatabaseType @ 19 NONAME
+	_ZN11CActiveApDb8DatabaseEv @ 20 NONAME
+	_ZN11CActiveApDbD0Ev @ 21 NONAME
+	_ZN11CActiveApDbD1Ev @ 22 NONAME
+	_ZN11CActiveApDbD2Ev @ 23 NONAME
+	_ZN11CApListItem10BearerTypeEv @ 24 NONAME
+	_ZN11CApListItem10ConstructLE15TCommsDbIspTypemRK7TDesC1613TApBearerType @ 25 NONAME
+	_ZN11CApListItem10ConstructLE15TCommsDbIspTypemRK7TDesC1613TApBearerTypeS3_ @ 26 NONAME
+	_ZN11CApListItem10ConstructLEv @ 27 NONAME
+	_ZN11CApListItem3UidEv @ 28 NONAME
+	_ZN11CApListItem4NameEv @ 29 NONAME
+	_ZN11CApListItem4TypeEv @ 30 NONAME
+	_ZN11CApListItem5NewLCE15TCommsDbIspTypemRK7TDesC1613TApBearerType @ 31 NONAME
+	_ZN11CApListItem5NewLCE15TCommsDbIspTypemRK7TDesC1613TApBearerTypeS3_i @ 32 NONAME
+	_ZN11CApListItem5NewLCEPS_ @ 33 NONAME
+	_ZN11CApListItem5NewLCEv @ 34 NONAME
+	_ZN11CApListItem8SetItemLE15TCommsDbIspTypemRK7TDesC1613TApBearerType @ 35 NONAME
+	_ZN11CApListItem8SetItemLE15TCommsDbIspTypemRK7TDesC1613TApBearerTypeS3_ @ 36 NONAME
+	_ZN11CApListItem9CopyFromLERKS_ @ 37 NONAME
+	_ZN11CApListItemC1Ev @ 38 NONAME
+	_ZN11CApListItemC2Ev @ 39 NONAME
+	_ZN11CApListItemD0Ev @ 40 NONAME
+	_ZN11CApListItemD1Ev @ 41 NONAME
+	_ZN11CApListItemD2Ev @ 42 NONAME
+	_ZN11CApNetworks10ConstructLER14CCommsDatabase @ 43 NONAME
+	_ZN11CApNetworks16AllListItemDataLER18CApNetworkItemList @ 44 NONAME
+	_ZN11CApNetworks5NewLCER14CCommsDatabase @ 45 NONAME
+	_ZN11CApNetworksC1Ev @ 46 NONAME
+	_ZN11CApNetworksC2Ev @ 47 NONAME
+	_ZN11CApNetworksD0Ev @ 48 NONAME
+	_ZN11CApNetworksD1Ev @ 49 NONAME
+	_ZN11CApNetworksD2Ev @ 50 NONAME
+	_ZN12CVpnApEngine10ConstructLEP14CCommsDatabase @ 51 NONAME
+	_ZN12CVpnApEngine10DeleteVpnLEm @ 52 NONAME
+	_ZN12CVpnApEngine12CreateVpnApLER10CVpnApItem @ 53 NONAME
+	_ZN12CVpnApEngine12CreateVpnApLER7TDesC16mS1_PS0_m @ 54 NONAME
+	_ZN12CVpnApEngine14UpdateVpnDataLER10CVpnApItem @ 55 NONAME
+	_ZN12CVpnApEngine3CvtEv @ 56 NONAME
+	_ZN12CVpnApEngine5NewLCEP14CCommsDatabase @ 57 NONAME
+	_ZN12CVpnApEngine8IsVpnApLEm @ 58 NONAME
+	_ZN12CVpnApEngine8VpnDataLEmR10CVpnApItem @ 59 NONAME
+	_ZN12CVpnApEngineC1Ev @ 60 NONAME
+	_ZN12CVpnApEngineC2Ev @ 61 NONAME
+	_ZN12CVpnApEngineD0Ev @ 62 NONAME
+	_ZN12CVpnApEngineD1Ev @ 63 NONAME
+	_ZN12CVpnApEngineD2Ev @ 64 NONAME
+	_ZN14CApDataHandler10ConstructLER14CCommsDatabase @ 65 NONAME
+	_ZN14CApDataHandler12ReadNetworkLEmR14CApNetworkItem @ 66 NONAME
+	_ZN14CApDataHandler13SetAsDefaultLEm15TCommsDbIspType @ 67 NONAME
+	_ZN14CApDataHandler14CreateNetworkLER14CApNetworkItem @ 68 NONAME
+	_ZN14CApDataHandler14RemoveNetworkLEm @ 69 NONAME
+	_ZN14CApDataHandler15CreateCopyFromLEm @ 70 NONAME
+	_ZN14CApDataHandler15CreateFromDataLER18CApAccessPointItem @ 71 NONAME
+	_ZN14CApDataHandler16AccessPointDataLEmR18CApAccessPointItem @ 72 NONAME
+	_ZN14CApDataHandler16ReadNetworkPartLER18CApAccessPointItem @ 73 NONAME
+	_ZN14CApDataHandler22UpdateAccessPointDataLER18CApAccessPointItemRi @ 74 NONAME
+	_ZN14CApDataHandler24GetPreferredIfDbIapTypeLEm26TCommDbConnectionDirectionRmS1_S1_ @ 75 NONAME
+	_ZN14CApDataHandler24GetPreferredIfDbIspTypeLEm26TCommDbConnectionDirectionRmS1_S1_S1_ @ 76 NONAME
+	_ZN14CApDataHandler24SetPreferredIfDbIapTypeLEm26TCommDbConnectionDirectionm17TCommDbDialogPrefmi @ 77 NONAME
+	_ZN14CApDataHandler24SetPreferredIfDbIspTypeLEm26TCommDbConnectionDirectionm17TCommDbDialogPrefmmRK7TDesC16i @ 78 NONAME
+	_ZN14CApDataHandler5NewLCER14CCommsDatabase @ 79 NONAME
+	_ZN14CApDataHandler9RemoveAPLEm @ 80 NONAME
+	_ZN14CApDataHandlerC1Ev @ 81 NONAME
+	_ZN14CApDataHandlerC2Ev @ 82 NONAME
+	_ZN14CApDataHandlerD0Ev @ 83 NONAME
+	_ZN14CApDataHandlerD1Ev @ 84 NONAME
+	_ZN14CApDataHandlerD2Ev @ 85 NONAME
+	_ZN14CApNetworkItem10ConstructLEmRK7TDesC16 @ 86 NONAME
+	_ZN14CApNetworkItem10ConstructLEv @ 87 NONAME
+	_ZN14CApNetworkItem5NewLCEPS_ @ 88 NONAME
+	_ZN14CApNetworkItem5NewLCEv @ 89 NONAME
+	_ZN14CApNetworkItem6SetUidEm @ 90 NONAME
+	_ZN14CApNetworkItem8SetNameLERK7TDesC16 @ 91 NONAME
+	_ZN14CApNetworkItem9CopyFromLERKS_ @ 92 NONAME
+	_ZN14CApNetworkItemC1Ev @ 93 NONAME
+	_ZN14CApNetworkItemC2Ev @ 94 NONAME
+	_ZN14CApNetworkItemD0Ev @ 95 NONAME
+	_ZN14CApNetworkItemD1Ev @ 96 NONAME
+	_ZN14CApNetworkItemD2Ev @ 97 NONAME
+	_ZN14CApProtHandler12ProtectItemLEP14CCommsDatabasem @ 98 NONAME
+	_ZN14CApProtHandler13ProtectTableLEP14CCommsDatabase @ 99 NONAME
+	_ZN14CApProtHandler14IsApProtectedLEP14CCommsDatabasem @ 100 NONAME
+	_ZN14CApProtHandler14UnprotectItemLEP14CCommsDatabasem @ 101 NONAME
+	_ZN14CApProtHandler15UnprotectTableLEP14CCommsDatabase @ 102 NONAME
+	_ZN14CApProtHandler17IsTableProtectedLEP14CCommsDatabase @ 103 NONAME
+	_ZN14CApProtHandler19ProtectPreferencesLEP14CCommsDatabase @ 104 NONAME
+	_ZN14CApProtHandler21UnprotectPreferencesLEP14CCommsDatabase @ 105 NONAME
+	_ZN14CApProtHandler23IsPreferencesProtectedLEP14CCommsDatabase @ 106 NONAME
+	_ZN14CApProtHandler28RemoveProtectedAccessPointsLEP14CCommsDatabase @ 107 NONAME
+	_ZN15CApListItemListC1Ev @ 108 NONAME
+	_ZN15CApListItemListC2Ev @ 109 NONAME
+	_ZN15CApListItemListD0Ev @ 110 NONAME
+	_ZN15CApListItemListD1Ev @ 111 NONAME
+	_ZN15CApListItemListD2Ev @ 112 NONAME
+	_ZN18CApAccessPointItem10ConstructLEv @ 113 NONAME
+	_ZN18CApAccessPointItem10WriteTextLE9TApMemberRK6TDesC8 @ 114 NONAME
+	_ZN18CApAccessPointItem10WriteTextLE9TApMemberRK7TDesC16 @ 115 NONAME
+	_ZN18CApAccessPointItem11BearerTypeLEv @ 116 NONAME
+	_ZN18CApAccessPointItem13ReadLongTextLE9TApMember @ 117 NONAME
+	_ZN18CApAccessPointItem13SanityCheckOkEv @ 118 NONAME
+	_ZN18CApAccessPointItem14SetBearerTypeLE13TApBearerType @ 119 NONAME
+	_ZN18CApAccessPointItem14WriteLongTextLE9TApMemberRK7TDesC16 @ 120 NONAME
+	_ZN18CApAccessPointItem15ReadTextLengthLE9TApMember @ 121 NONAME
+	_ZN18CApAccessPointItem18ReadConstLongTextLE9TApMember @ 122 NONAME
+	_ZN18CApAccessPointItem20HasSameIspAndBearerLERS_ @ 123 NONAME
+	_ZN18CApAccessPointItem5NewLCEv @ 124 NONAME
+	_ZN18CApAccessPointItem8ReadBoolE9TApMemberRi @ 125 NONAME
+	_ZN18CApAccessPointItem8ReadUintE9TApMemberRm @ 126 NONAME
+	_ZN18CApAccessPointItem9CopyFromLERKS_ @ 127 NONAME
+	_ZN18CApAccessPointItem9ReadTextLE9TApMemberR5TDes8 @ 128 NONAME
+	_ZN18CApAccessPointItem9ReadTextLE9TApMemberR6TDes16 @ 129 NONAME
+	_ZN18CApAccessPointItem9SetNamesLERK7TDesC16 @ 130 NONAME
+	_ZN18CApAccessPointItem9WriteBoolE9TApMemberRKi @ 131 NONAME
+	_ZN18CApAccessPointItem9WriteUintE9TApMemberRKm @ 132 NONAME
+	_ZN18CApAccessPointItemC1Ev @ 133 NONAME
+	_ZN18CApAccessPointItemC2Ev @ 134 NONAME
+	_ZN18CApAccessPointItemD0Ev @ 135 NONAME
+	_ZN18CApAccessPointItemD1Ev @ 136 NONAME
+	_ZN18CApAccessPointItemD2Ev @ 137 NONAME
+	_ZN18CApNetworkItemListC1Ev @ 138 NONAME
+	_ZN18CApNetworkItemListC2Ev @ 139 NONAME
+	_ZN18CApNetworkItemListD0Ev @ 140 NONAME
+	_ZN18CApNetworkItemListD1Ev @ 141 NONAME
+	_ZN18CApNetworkItemListD2Ev @ 142 NONAME
+	_ZN8CApUtils10ConstructLER14CCommsDatabase @ 143 NONAME
+	_ZN8CApUtils10IAPExistsLEm @ 144 NONAME
+	_ZN8CApUtils10IsAPInUseLEm @ 145 NONAME
+	_ZN8CApUtils11BearerTypeLEm @ 146 NONAME
+	_ZN8CApUtils11IsReadOnlyLEm @ 147 NONAME
+	_ZN8CApUtils11SetISPTypeLEm15TCommsDbIspType @ 148 NONAME
+	_ZN8CApUtils12IsValidNameLERK7TDesC16 @ 149 NONAME
+	_ZN8CApUtils12IsValidNameLERK7TDesC16m @ 150 NONAME
+	_ZN8CApUtils12WapApExistsLEm @ 151 NONAME
+	_ZN8CApUtils14MakeValidNameLER6TDes16 @ 152 NONAME
+	_ZN8CApUtils14WapBearerTypeLEmR6TDes16 @ 153 NONAME
+	_ZN8CApUtils15IapIdFromWapIdLEm @ 154 NONAME
+	_ZN8CApUtils15WapIdFromIapIdLEm @ 155 NONAME
+	_ZN8CApUtils25HasMandatoryFieldsFilledLEm @ 156 NONAME
+	_ZN8CApUtils27DoHasMandatoryFieldsFilledLEmP17CCommsDbTableView13TApBearerType @ 157 NONAME
+	_ZN8CApUtils5NameLEmR6TDes16 @ 158 NONAME
+	_ZN8CApUtils5NewLCER14CCommsDatabase @ 159 NONAME
+	_ZN8CApUtils8ISPTypeLEmR15TCommsDbIspType @ 160 NONAME
+	_ZN8CApUtils8SetNameLER6TDes16m @ 161 NONAME
+	_ZN8CApUtilsC1Ev @ 162 NONAME
+	_ZN8CApUtilsC2Ev @ 163 NONAME
+	_ZN8CApUtilsD0Ev @ 164 NONAME
+	_ZN8CApUtilsD1Ev @ 165 NONAME
+	_ZN8CApUtilsD2Ev @ 166 NONAME
+	_ZN9CApSelect10BearerTypeEv @ 167 NONAME
+	_ZN9CApSelect10ConstructLER14CCommsDatabaseiii @ 168 NONAME
+	_ZN9CApSelect10ConstructLER14CCommsDatabaseiiii @ 169 NONAME
+	_ZN9CApSelect10ConstructLER14CCommsDatabaseiiii14TVpnFilterType @ 170 NONAME
+	_ZN9CApSelect11MoveToFirstEv @ 171 NONAME
+	_ZN9CApSelect11SetFiltersLEiii @ 172 NONAME
+	_ZN9CApSelect12BearerFilterEv @ 173 NONAME
+	_ZN9CApSelect13IspTypeFilterEv @ 174 NONAME
+	_ZN9CApSelect16AllListItemDataLER15CApListItemList @ 175 NONAME
+	_ZN9CApSelect3UidEv @ 176 NONAME
+	_ZN9CApSelect4NameEv @ 177 NONAME
+	_ZN9CApSelect4TypeEv @ 178 NONAME
+	_ZN9CApSelect5CountEv @ 179 NONAME
+	_ZN9CApSelect5NewLCER14CCommsDatabaseiii @ 180 NONAME
+	_ZN9CApSelect5NewLCER14CCommsDatabaseiiii @ 181 NONAME
+	_ZN9CApSelect5NewLCER14CCommsDatabaseiiii14TVpnFilterType @ 182 NONAME
+	_ZN9CApSelect8MoveLastEv @ 183 NONAME
+	_ZN9CApSelect8MoveNextEv @ 184 NONAME
+	_ZN9CApSelect8MovePrevEv @ 185 NONAME
+	_ZN9CApSelect9SortOrderEv @ 186 NONAME
+	_ZN9CApSelectC1Ev @ 187 NONAME
+	_ZN9CApSelectC2Ev @ 188 NONAME
+	_ZN9CApSelectD0Ev @ 189 NONAME
+	_ZN9CApSelectD1Ev @ 190 NONAME
+	_ZN9CApSelectD2Ev @ 191 NONAME
+	_ZNK10CVpnApItem4NameEv @ 192 NONAME
+	_ZNK10CVpnApItem6WapUidEv @ 193 NONAME
+	_ZNK10CVpnApItemeqERKS_ @ 194 NONAME
+	_ZNK10CVpnApItemneERKS_ @ 195 NONAME
+	_ZNK11CApListItem10IsReadOnlyEv @ 196 NONAME
+	_ZNK11CApListItem9StartPageEv @ 197 NONAME
+	_ZNK11CApNetworks5CountEv @ 198 NONAME
+	_ZNK11CApNetworks5NameLEm @ 199 NONAME
+	_ZNK14CApDataHandler8DefaultLEi @ 200 NONAME
+	_ZNK14CApDataHandler8DefaultLEiRi @ 201 NONAME
+	_ZNK14CApNetworkItem3UidEv @ 202 NONAME
+	_ZNK14CApNetworkItem4NameEv @ 203 NONAME
+	_ZNK15CApListItemList10ItemForUidEm @ 204 NONAME
+	_ZNK18CApAccessPointItem10IsReadOnlyEv @ 205 NONAME
+	_ZNK18CApAccessPointItem14ConnectionNameEv @ 206 NONAME
+	_ZNK18CApAccessPointItem6WapUidEv @ 207 NONAME
+	_ZNK18CApAccessPointItem9WapBearerEv @ 208 NONAME
+	_ZNK18CApAccessPointItemeqERKS_ @ 209 NONAME
+	_ZNK18CApAccessPointItemneERKS_ @ 210 NONAME
+	_ZNK18CApNetworkItemList10ItemForUidEm @ 211 NONAME
+	_ZNK9CApSelect10IsReadOnlyEv @ 212 NONAME
+	_ZTI11CApListItem @ 213 NONAME ; #<TI>#
+	_ZTI12CApItemExtra @ 214 NONAME ; #<TI>#
+	_ZTI14CApDataHandler @ 215 NONAME ; #<TI>#
+	_ZTI15CApItemCdmaData @ 216 NONAME ; #<TI>#
+	_ZTI15CApItemWlanData @ 217 NONAME ; #<TI>#
+	_ZTI15CApListItemList @ 218 NONAME ; #<TI>#
+	_ZTI18CApAccessPointItem @ 219 NONAME ; #<TI>#
+	_ZTI18CApNetworkItemList @ 220 NONAME ; #<TI>#
+	_ZTI19CActiveApDbNotifier @ 221 NONAME ; #<TI>#
+	_ZTI8CApUtils @ 222 NONAME ; #<TI>#
+	_ZTI9CApSelect @ 223 NONAME ; #<TI>#
+	_ZTV11CApListItem @ 224 NONAME ; #<VT>#
+	_ZTV12CApItemExtra @ 225 NONAME ; #<VT>#
+	_ZTV14CApDataHandler @ 226 NONAME ; #<VT>#
+	_ZTV15CApItemCdmaData @ 227 NONAME ; #<VT>#
+	_ZTV15CApItemWlanData @ 228 NONAME ; #<VT>#
+	_ZTV15CApListItemList @ 229 NONAME ; #<VT>#
+	_ZTV18CApAccessPointItem @ 230 NONAME ; #<VT>#
+	_ZTV18CApNetworkItemList @ 231 NONAME ; #<VT>#
+	_ZTV19CActiveApDbNotifier @ 232 NONAME ; #<VT>#
+	_ZTV8CApUtils @ 233 NONAME ; #<VT>#
+	_ZTV9CApSelect @ 234 NONAME ; #<VT>#
+	_ZN9CApSelect10ConstructLER14CCommsDatabaseiiii14TVpnFilterTypei @ 235 NONAME
+	_ZN9CApSelect5NewLCER14CCommsDatabaseiiii14TVpnFilterTypei @ 236 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apeng/Rom/ApEngine.iby	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef __APENGINE_IBY__
+#define __APENGINE_IBY__
+
+file=ABI_DIR\BUILD_DIR\ApEngine.dll  SHARED_LIB_DIR\ApEngine.dll
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apeng/Rom/ApEngineResources.iby	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef __APENGINERESOURCES_IBY__
+#define __APENGINERESOURCES_IBY__
+
+DATA=DATAZ_\RESOURCE_FILES_DIR\ApEngine.rsc	RESOURCE_FILES_DIR\ApEngine.rsc
+
+#endif
Binary file apengine/apeng/cenrep/keys_accesspoints.xls has changed
Binary file apengine/apeng/conf/accesspoints.confml has changed
Binary file apengine/apeng/conf/accesspoints_10008D3A.crml has changed
Binary file apengine/apeng/conf/accesspoints_10008D3B.crml has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apeng/group/APEngine.MMP	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,131 @@
+/*
+* Copyright (c) 2002 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 description file for the Access Point Engine
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+TARGET      APEngine.dll
+TARGETTYPE      dll
+UID         0x1000008d  0x10008D3A
+
+CAPABILITY  CAP_GENERAL_DLL
+VENDORID VID_DEFAULT
+
+
+SOURCEPATH  ../src
+SOURCE      ApEngineLogger.cpp
+SOURCE      ApListItem.cpp
+SOURCE      APSelect.cpp
+SOURCE      APDataHandler.cpp
+SOURCE      APUtils.cpp
+SOURCE      APAccessPointItem.cpp
+SOURCE      ApEngineCommons.cpp
+SOURCE      ActiveApDb.cpp
+SOURCE      ActiveApDbNotifier.cpp
+SOURCE      aplistitemlist.cpp
+SOURCE      ApProtHandler.cpp
+SOURCE      ApListItemKey.cpp
+SOURCE		ApNetworkItem.cpp
+SOURCE		APNetworks.cpp
+SOURCE	    apnetworkitemlist.cpp
+SOURCE	    VpnApItem.cpp
+SOURCE	    VpnApEngine.cpp
+
+
+
+START RESOURCE ../Data/ApEngine.rss
+HEADER
+TARGETPATH RESOURCE_FILES_DIR
+LANGUAGE_IDS
+END  // RESOURCE
+
+// Component specific internal headers 
+USERINCLUDE			../inc
+
+// ADO specific internal headers 
+SYSTEMINCLUDE		../../../inc
+
+//Macro to /epoc32 headers
+MW_LAYER_SYSTEMINCLUDE
+
+#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
+SYSTEMINCLUDE ../../../../../os/commsfw/commsconfig/commsdatabaseshim/commdbshim/ProtectedDB
+#endif
+
+LIBRARY     commdb.lib 
+LIBRARY     euser.lib
+LIBRARY     efsrv.lib
+LIBRARY     bafl.lib
+LIBRARY     insock.lib
+LIBRARY     esock.lib
+LIBRARY     FeatMgr.lib
+LIBRARY		Vpnapi.lib
+LIBRARY     centralrepository.lib
+
+
+LIBRARY WEPSecuritySettingsUi.lib
+LIBRARY WPASecuritySettingsUi.lib
+
+
+#if defined(ARMCC)
+    DEFFILE ../EABI/ApEngine_EKA2.def
+#elif defined( WINSCW )
+    DEFFILE ../BWinsCw/ApEngine_EKA2.def
+#elif defined( WINS )
+    DEFFILE ../BWins/ApEngine_EKA2.def
+#else
+    DEFFILE ../BMarm/ApEngine_EKA2.def
+#endif
+
+// Define this macro if you wish to enable logging
+//#define __TEST_APENGINE_LOG_ENABLED
+
+
+// Define this macro if you wish to enable IPv6 support for testing
+// It will override FeatureManager's NOT SUPPORTED....
+//MACRO __TEST_IPV6_SUPPORT    
+
+#ifdef __TEST_APENGINE_LOG_ENABLED
+	MACRO __TEST_APENGINE_LOG__
+	LIBRARY     flogger.lib
+#endif	// __TEST_APENGINE_LOG_ENABLED
+
+// Define this to test CDMA support.
+//MACRO __TEST_CDMA_SUPPORT
+
+
+// Define this to test CSD support.
+//MACRO __TEST_CSD_SUPPORT
+
+
+// Define this to test HSCSD support.
+//MACRO __TEST_HSCSD_SUPPORT
+
+// Define this to test CDMA write-protect support.
+//MACRO __TEST_CDMA_WRITE_PROTECT
+
+// Define this to test WLAN support.
+// MACRO __TEST_WLAN_SUPPORT
+
+
+// Define this to test LAN support.
+#ifdef WINS
+    MACRO __TEST_LAN_BEARER
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apeng/group/ApEngineCvt.mmp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,44 @@
+/*
+* 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:  Project specification for Accesspoint Engine filter
+*               Component Validation Test.
+*      
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET      ApEngineCvt.exe
+TARGETTYPE  exe
+
+SOURCEPATH  ../tsrc
+
+SOURCE      ApEngineCvt.cpp 
+
+// Component specific internal headers 
+USERINCLUDE			../inc
+
+// ADO-SUBSYSTEM specific internal headers 
+SYSTEMINCLUDE		../../inc
+
+// ADO specific internal headers 
+SYSTEMINCLUDE		../../../inc
+
+//Macro to /epoc32 headers
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY     ApEngine.lib
+LIBRARY	    commdb.lib
+LIBRARY     euser.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apeng/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2002 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 Access Point Engine
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+// export iby files
+../Rom/ApEngine.iby		CORE_MW_LAYER_IBY_EXPORT_PATH(ApEngine.iby)
+../Rom/ApEngineResources.iby	LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(ApEngineResources.iby)
+
+// export localised loc file
+../loc/ApEngine.loc	MW_LAYER_LOC_EXPORT_PATH(apengine.loc)
+
+../conf/accesspoints.confml		APP_LAYER_CONFML(accesspoints.confml)
+../conf/accesspoints_10008D3A.crml	APP_LAYER_CRML(accesspoints_10008D3A.crml)
+../conf/accesspoints_10008D3B.crml	APP_LAYER_CRML(accesspoints_10008D3B.crml)
+
+PRJ_MMPFILES
+./APEngine.MMP
+
+
+
+PRJ_TESTMMPFILES
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apeng/inc/APEngineVariant.hrh	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2002 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 variation info for ApEngine.
+*     The file can be included in C++ or resource file.
+*
+*/
+
+
+#ifndef APENGINEVARIANT_HRH
+#define APENGINEVARIANT_HRH
+
+// feature to disable editing of normal access points and allow it only for VPN
+#define KApUiEditOnlyVPNs 0x01
+
+#endif      //  APENGINEVARIANT_HRH
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apeng/inc/APItemCdmaData.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,115 @@
+/*
+* Copyright (c) 2002 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 CApItemCdmaData 
+*
+*/
+
+
+#ifndef CAPITEMCDMADATA_H
+#define CAPITEMCDMADATA_H
+
+
+//  INCLUDES
+#include <e32base.h>
+
+
+
+// CLASS DECLARATION
+
+/**
+* CDMA2000-specific data extension for CApAccessPointItem.
+* Access Point data which is common to all AP-s (ISP...), are not stored
+* here.
+*/
+class CApItemCdmaData :public CBase
+    {
+    public:
+        /**
+        * Two-phased constructor. Leaves on failure
+        * @return The constructed CApItemCdmaData.
+        */
+        static CApItemCdmaData* NewL();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CApItemCdmaData();
+
+        /**
+        * C++ default constructor.
+        */
+        CApItemCdmaData();
+
+        /**
+        * Second-phase constructor.
+        */
+        void ConstructL();
+
+    public:
+        HBufC*  iIwfName;           ///< IWF name.
+        TUint32 iServiceOption;     ///< Service option.
+        TUint32 iPdpType;           ///< PDP type.
+        HBufC*  iPdpAddress;        ///< PDP address.
+        TUint32 iReqFwdPriority;    ///< Requested forward priority.
+        TUint32 iReqRevPriority;    ///< Requested reverse priority.
+        TUint32 iReqFwdBitrate;     ///< Requested forward bitrate.
+        TUint32 iReqRevBitrate;     ///< Requested reverse bitrate.
+        TUint32 iReqFwdLoss;        ///< Req. forward frame loss rate.
+        TUint32 iReqRevLoss;        ///< Req. reverse frame loss rate.
+        TUint32 iReqFwdMaxDelay;    ///< Requested forward delay.
+        TUint32 iReqRevMaxDelay;    ///< Requested reverse delay.
+        TUint32 iMinFwdBitrate;     ///< Min. acceptable fwd bitrate.
+        TUint32 iMinRevBitrate;     ///< Min. acceptable rev bitrate.
+        TUint32 iAccptFwdLoss;      ///< Max. acc. fwd frame loss rate.
+        TUint32 iAccptRevLoss;      ///< Max. acc. rev frame loss rate.
+        TUint32 iAccptFwdMaxDelay;  ///< Max. acceptable forward delay.
+        TUint32 iAccptRevMaxDelay;  ///< Max. acceptable reverse delay.
+        TUint32 iQosWarningTimeout; ///< Notify user if the requested QOS
+                                    ///< cannot be satisfied for this time in
+                                    ///< microseconds
+        TUint32 iRlpMode;           ///< Transparent or non-transparent
+                                    ///< radio link protocol.
+        // CDMA2000 deprecated Mobile IP fields
+        TBool   iMip;               ///< Attempt to use mobile IP.
+        HBufC*  iHomeAgentAddress;  ///< Home Agent address.
+        TUint32 iMipTimeout;        ///< A normal reconnect (informing the
+                                    ///< user) takes place if both the PPP link
+                                    ///< drops and a change in SID or NID is
+                                    ///< received within this time in
+                                    ///< milliseconds.
+        // CDMA2000 specific CDMA parameters provisioned through OTA and
+        // defined in TIA-683B section 3.5.8
+        // These fields replace the old Mobile IP fields (above).
+        TUint32 iNaiType;               ///< Type of NAI.
+        TUint32 iSimpleIpAuthAlgorithm; ///< SimpleIP auth.algorithm.
+        TUint32 iSimpleIpPapSsHandle;   ///< SimpleIP PAP shared secret handle
+        TUint32 iSimpleIpChapSsHandle;  ///< SimpleIP CHAP shared secret handle
+        TUint32 iMipTBit;               ///< Reverse-tunneling reqd flag.
+        HBufC*  iMipHomeAddress;        ///< Home address.
+        HBufC*  iMipPrimaryHomeAgent;   ///< IP address of mobile node's
+                                        ///< primary home agent.
+        HBufC*  iMipSecondaryHomeAgent; ///< IP address of mobile node's
+                                        ///< secondary home agent.
+        TUint32 iMipMnAaaAuthAlgorithm; ///< MN-AAA auth algorithm.
+        TUint32 iMipMnAaaSpi;           ///< MN-AAA security param index.
+        TUint32 iMipMnAaaSsHandle;      ///< MN-AAA shared secret handle.
+        TUint32 iMipMnHaAuthAlgorithm;  ///< MN-HA auth algorithm.
+        TUint32 iMipMnHaSpi;            ///< MN-HA security param index.
+        TUint32 iMipMnHaSsHandle;       ///< MN-HA shared secret handle.
+
+    };
+
+#endif      // CAPITEMCDMADATA_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apeng/inc/APItemExtra.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,95 @@
+/*
+* Copyright (c) 2002 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 CApItemExtra 
+*
+*/
+
+
+#ifndef CAPITEMEXTRA_H
+#define CAPITEMEXTRA_H
+
+
+//  INCLUDES
+
+// FORWARD DECLARATION
+class CApItemCdmaData;
+class CApItemWlanData;
+
+// CONSTANTS
+
+
+// CLASS DECLARATION
+
+/**
+*  Representation of the access point extra data class.
+*  Provides a way to store additional data whithout breaking BC.
+*/
+class CApItemExtra :public CBase
+    {
+    public:
+        /**
+        * Two-phased constructor. Leaves on failure
+        * @return The constructed CApItemExtra.
+        */
+        static CApItemExtra* NewL();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CApItemExtra();
+
+        /**
+        * C++ default constructor.
+        */
+        CApItemExtra();
+
+        /**
+        * Second-phase constructor.
+        */
+        void ConstructL();
+    
+
+    public:
+        TBool               iIsFeatureManagerInitialised; // FALSE by default
+        TBool               iIpv6GetDNSIPFromServer;
+        TBool               iIsWcdma;
+        HBufC*              iIpv6PrimaryDNS;
+        HBufC*              iIpv6SecondaryDNS;
+        TUint               iIsIpv6Supported;   // FALSE by default
+        TBool               iIsVpnAp;           // False by default
+        TApBearerType       iVPnRealIapBearerType;
+        CApItemCdmaData*    iCdmaData;  // Owned. If NULL, CDMA is unsupported.
+        CApItemWlanData*    iWlanData;  // Owned. If NULL, Wlan is unsupported.
+        HBufC*              iLanBearerModemName;
+        HBufC*              iIapBearerType;
+        TUint32             iIapBearerID;
+        TInt                iBearerProtocol;
+        TInt                iBearerSpeed;
+
+        /**
+        * Indicates if CSD Access point is supported or not.
+        */
+        TBool               iIsAppCsdSupport;      
+        
+        /**
+        * Indicates if HSCSD Access point is supported or not.
+        */
+        TBool               iIsAppHscsdSupport;              
+
+        
+    };
+
+#endif      // CAPITEMEXTRA_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apeng/inc/APItemWlanData.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2002 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 CApItemWlanData 
+*
+*/
+
+
+#ifndef CAPITEMWLANDATA_H
+#define CAPITEMWLANDATA_H
+
+
+//  INCLUDES
+#include <e32base.h>
+
+
+
+// CLASS DECLARATION
+
+/**
+* Wlan-specific data extension for CApAccessPointItem.
+* Access Point data which is common to all AP-s (ISP...), are not stored
+* here.
+*/
+class CApItemWlanData : public CBase
+    {
+    public:
+        /**
+        * Two-phased constructor. Leaves on failure
+        * @return The constructed CApItemWlanData.
+        */
+        static CApItemWlanData* NewL();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CApItemWlanData();
+
+        /**
+        * C++ default constructor.
+        */
+        CApItemWlanData();
+
+        /**
+        * Second-phase constructor.
+        */
+        void ConstructL();
+
+    public:
+        // data members are public for CApAccessPointItem...
+        HBufC* iWlanNetworkName;    ///< WLAN netwotk name, SSID
+        TUint32 iWlanNetworkMode;   ///< Gives network mode, TUint32
+        TUint32 iWlanSecurityMode;  ///< The security mode, TUint32
+        TUint32 iWlanId;            ///< Commdb_id of wlan settings, TUint32
+        TBool   iIsWlan;            ///< Indicates that this WLAN-capable 
+                                    ///< access point is really WLAN or not.
+        TBool   iScanSSID;          ///< need to scan the SSID
+        TUint32 iChannelId;         ///< The ad-hoc channel ID
+    };
+
+#endif      // CAPITEMWLANDATA_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apeng/inc/ActiveApDbNotifier.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,93 @@
+/*
+* Copyright (c) 2002 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: 
+*     Declares the CActiveApDbNotifier class.
+*
+*/
+
+
+#ifndef ACTIVE_AP_DB_NOTIFIER_H
+#define ACTIVE_AP_DB_NOTIFIER_H
+
+//  INCLUDES
+
+#include <e32base.h>
+#include <ApEngineVer.h>
+
+
+// FORWARD DECLARATIONS
+
+class CActiveApDb;
+
+// CLASS DECLARATION
+
+/**
+* Active object encapsulating an access point database notifier.
+* Used by CActiveApDb.
+*/
+class CActiveApDbNotifier : public CActive
+    {
+    public:     // construct / destruct
+
+        /**
+        * Constructor.
+        * @param aDb Active access point database to watch for.
+        */
+        CActiveApDbNotifier( CActiveApDb& aDb );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CActiveApDbNotifier();
+
+    protected:  // from CActive
+        /**
+        * Invoked when the outstanding request completes.
+        */
+        void RunL() ;
+
+        /**
+        * Implementation of the Cancel protocol;
+        * cancel any outstanding request.
+        */
+        void DoCancel();
+
+    public:     // new methods
+
+        /**
+        * Start the notifier. The notification request is automatically
+        * renewed until it is cancelled, or the database is closed by
+        * all clients (i.e. released by DBMS).
+        */
+        void Start();
+
+        /**
+        * Cancel and close the notifier now.
+        */
+        void Stop();
+
+    private:
+        /**
+        * Request database change notification from the Access Point Engine.
+        */
+        void NotifyChange();
+
+    private:    // data
+        CActiveApDb* iActiveDb;     ///< Pointer to the database.
+                                    ///< Does not owns it.
+    };
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apeng/inc/ApEngineCommons.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,309 @@
+/*
+* Copyright (c) 2002 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 some common global functions.
+*
+*/
+
+
+#ifndef APENGINE_COMMONS_H
+#define APENGINE_COMMONS_H
+
+//  INCLUDES
+#include <commdb.h>
+#include <ApEngineVer.h>
+
+
+// CONSTANTS
+_LIT(KSqlSelectBase, "SELECT * from %s WHERE %s='%S'");
+_LIT( KEmpty, "" );
+_LIT( KFormat, "%S" );
+_LIT8( KFormat8,"%S" );
+
+
+LOCAL_C const TInt KR_ApEngineDefaultValue    = 0;
+
+// DATA TYPES
+
+enum TApEnginePanicCodes
+    {
+    ENullPointer,
+    EInvalidDbType,
+    EWrongResourceFormat,
+    EActiveApDbObserverNotFound,
+    EInvalidColumn,
+    EInvalidSpeed,
+    ESqlError,
+    ESanityCheckFailed,
+    ENotSupported,
+    EMenuCommandUnknown
+    };
+
+
+// CLASS DECLARATION
+/**
+* ApCommons is a collection of commonly used 'utility' functions.
+*/
+NONSHARABLE_CLASS( ApCommons )
+    {
+    public:
+        /**
+        * Panics.
+        */
+        static void Panic( TApEnginePanicCodes aPanic );
+
+        /**
+        * Starts a transaction on the given database if not already in one.
+        * In case of error, leaves with CommDb error codes.
+        * In case of KErrLocked, if retry is asked, it retries the operation
+        * after a short ( KRetryWait ) period. If still locked, leaves with it
+        * to allow caller module to handle the situation
+        * (e.g. giving up a Retry/Cancel query).
+        * In case of successfull transaction starting, pushes
+        * RollbackTransactionOnLeave to the CleanUpStack.
+        * @param aDb A reference to a CCommsDatabase object to start
+        * the transaction.
+        * @param aRetry A TBool indicating whether it shall retry
+        * the operation or not.
+        * @return Boolean indicating whether it has started a
+        * transaction or not (it also means whether it has pushed it or not.)
+        * It is used after DB operations to decide whether we have to
+        * commit or it is the caller's task.
+        */
+        static TBool StartPushedTransactionLC( CCommsDatabase& aDb,
+                                               TBool aRetry = ETrue );
+
+
+        /**
+        * Rolls back transaction on leave; called in leave processing.
+        * @param aDb The database (CCommsDatabase*) as TAny*.
+        */
+        static void RollbackTransactionOnLeave( TAny* aDb );
+
+
+
+
+        /**
+        * Creates a valid name from the passed aName.
+        * @param aDb A reference to a CCommsDatabase object 
+        * @param aChanged A reference to a boolean to hold whether the name 
+        *   had been changed or not.
+        * @param aUid The Uid of the access point whose name we are checking
+        *   to be able to handle updates and ignore self-match only situation
+        * @param aIsNew a boolean specifying whether tha access point whose 
+        *   name we are checking is new or not.
+        * @return A valid name
+        */
+        static HBufC* DoMakeValidNameL( CCommsDatabase& aDb,
+                                        TBool& aChanged,
+                                        HBufC* aName,
+                                        TUint32 aUid,
+                                        TBool aIsNew );
+
+        /**
+        * Ensures that the passed name is valid, length > 0 & length < max.
+        * If length == 0, leaves with KErrInvalidName
+        * If name is only whitespace, leaves with KErrInvalidName
+        * If name is longer than max, name is truncated
+        * It copies the name, pushez it onto the CleanupStack and passes
+        * ownership.
+        * @param aName The name
+        * @param aChanged A reference to a boolean to hold whether the name 
+        *   had been changed or not.        
+        * @return The valid-length name
+        */
+        static HBufC* EnsureMaxLengthLC( const TDesC* aName, TBool& aChanged );
+
+
+
+
+
+
+        /**
+        * If aName is constructed from aPrefix with a postfix, get the numeric
+        * value of the postfix, e.g:
+        *   - GetPostfix( "Foo (3)", "Foo" ) == 3
+        *   - GetPostfix( "Foo 23 (45)", "Foo 23" ) == 45
+        * If aName is the same as aPrefix, return 0, e.g.:
+        *   - GetPostfix( "Foo", "Foo" ) == 0
+        * If aName is not constructed from aPrefix, return -1, e.g.:
+        *   - GetPostfix( "Foobar", "Foo" ) == -1
+        *   - GetPostfix( "Fo 23 45", "Foo" ) == -1
+        * @param aName  The name to get the postfix from
+        * @param aPrefix The prefix
+        * @return The postfix
+        */
+        static TInt GetPostfix( const TDesC& aName, const TDesC& aPrefix );
+
+
+        /**
+        * Given aName in the format <prefix> or
+        * <prefix><brace><integer><brace>, return a
+        * pointer to the leading part. That is, if there is
+        * trailing <space><integer>, then that is excluded;
+        * if there is no trailing part, then the original
+        * decriptor is returned.
+        * Examples:
+        *   - "Foo" returns "Foo";
+        *   - "Foo 12" returns "Foo 12";
+        *   - "Foo(12)" returns "Foo";
+        *   - "Foo 12 (34)" returns "Foo 12 ";
+        *   - "Foo bar" returns "Foo bar";
+        *   - "Foo " returns "Foo ".
+        * @param aName  The name to get the prefix from
+        * @return The prefix
+        */
+        static TPtrC GetPrefix( const TDesC& aName );
+
+
+        /**
+        * Reads up a TUint32 from the given tables given column.
+        * Leaves in case of error.
+        * Leave with KErrUnknown is captured and returned as
+        * function return value.
+        * The main aim is not to Leave if some value is not written to the DB.
+        * @param atable The table to read from
+        * @param aColumn The column to read
+        * @param aValue A reference to hold the readed integer
+        * @return Error code
+        */
+        static TInt ReadUintL
+                        (
+                        CCommsDbTableView* atable,
+                        const TDesC& aColumn,
+                        TUint32& aValue
+                        );
+
+        /**
+        * Reads up a TBool from the given tables given column.
+        * Leaves in case of error.
+        * Leave with KErrUnknown is captured and returned as
+        * function return value.
+        * The main aim is not to Leave if some value is not written to the DB.
+        * @param atable The table to read from
+        * @param aColumn The column to read
+        * @param aValue A reference to hold the readed boolean
+        * @return Error code
+        */
+        static TInt ReadBoolL
+                        (
+                        CCommsDbTableView* atable,
+                        const TDesC& aColumn,
+                        TBool& aValue
+                        );
+
+
+        /**
+        * Reads up a long text from the given tables given column.
+        * Leaves in case of error.
+        * Leave with KErrUnknown is captured and returned as
+        * function return value.
+        * Ownership of the returned text is passed to the caller.
+        * The main aim is not to Leave if some value is not written to the DB.
+        * @param atable The table to read from
+        * @param aColumn The column to read
+        * @param aValue A reference to hold the error code
+        * @return The readed long text
+        */
+        static HBufC* ReadLongTextLC
+                        (
+                        CCommsDbTableView* atable,
+                        const TDesC& aColumn,
+                        TInt& aErrCode
+                        );
+                        
+
+        /**
+        * Reads up a long text from the given tables given column.
+        * Leaves in case of error.
+        * Ownership of the returned text is passed to the caller.
+        * Readed data is poped from the CleanuptStack to be able
+        * to TRAP it in ReadLongTextLC (above) function...
+        * @param atable The table to read from
+        * @param aColumn The column to read
+        * @return The readed long text
+        */
+        static HBufC* ReadLongTextL( CCommsDbTableView* atable,
+                                     const TDesC& aColumn );
+
+
+        /**
+        * Returns the escaped aLiteral.
+        * @param aLiteral The lietral to be escaped
+        * @return the escaped aLiteral.
+        */
+        static HBufC* EscapeTextLC( const TDesC& aLiteral );
+
+
+        /**
+        * Reads up the specified text columns value from the database.
+        * In case of error, leaves with CommDb error codes.
+        */
+        static HBufC16* ReadText16ValueLC( CCommsDbTableView* atable,
+                                           const TDesC& aCol );
+
+        /**
+        * Reads up the specified text columns value from the database.
+        * In case of error, leaves with CommDb error codes.
+        * @param atable The table to read from
+        * @param aColumn The column to read
+        * @return The readed text
+        */
+        static HBufC8* ReadText8ValueLC( CCommsDbTableView* atable,
+                                         const TDesC& aCol );
+
+        /**
+        * Reads up the read-only flag for the current record
+        * in the passed table
+        * In case of error, leaves with CommDb error codes.
+        * The function expects the passed table to have a valid
+        * current record, that is, after creating the table,
+        * record cursor must be setted to the desired record...
+        * @param aTable The table to read current records read-only flag.
+        * @return The current records read-only flag
+        */
+        static TBool DoGetReadOnlyL( CCommsDbTableView& aTable );
+
+
+        /**
+        * Commits a transaction on the given database.
+        * In case of error, returns the CommDb error codes.
+        * @param aDb The database to commit the transaction on
+        * @return Error code
+        */
+        static TInt CommitTransaction( CCommsDatabase& aDb );
+
+
+        /**
+        * Gets the local variant value 
+        * @return A TInt stating the variant
+        */
+        static TInt GetVariantL();
+
+
+        /**
+        * Gives back the TInt Value of the given shared data key for the given 
+        * UId. Does't use notify the given shared data, just gives back the
+        * actual value.
+        * @param aUid actual uid to identify the chunk of shared data
+        * @param aKey actual shared data key
+        * @return The actual value of the shared data
+        */
+        static TInt IsGivenSharedDataSupportL( const TUid aUid, 
+                                               const TUint32 aKey );
+
+    };
+
+#endif      // CAPENGINE_COMMONS_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apeng/inc/ApEngineLogger.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,153 @@
+/*
+* Copyright (c) 2002 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 Access Point Engine
+*      
+*
+*/
+
+
+#ifndef APENGINE_LOGGER_H
+#define APENGINE_LOGGER_H
+
+// INCLUDES
+
+#ifdef __TEST_APENGINE_LOG__
+    #include <e32std.h>
+    #include <e32def.h>
+    #include <flogger.h>
+
+    // TYPES
+
+    enum TApEngineLogMask             ///< Log mask bits.
+        {
+        ELogOff         = 0x00000000,   ///< Don't log.
+        ETransaction    = 0x00000001,   ///< Log transaction activity.
+        ESelect         = 0x00000002,   ///< Log ApSelect activity.
+        EHandler        = 0x00000004,   ///< Log ApDataHandler activity.
+        EUtil           = 0x00000008,   ///< Log ApUtils activity.
+        ENetworks       = 0x0000000F,   ///< Log Networks activity.
+        EApList         = 0x00000010,   ///< Log ApList activity.
+        EProtection     = 0x00000020,   ///< Log protection activity.
+        EApItem         = 0x00000040,   ///< Log ApItem activity.
+        ECommons        = 0x00000080,   ///< Log transaction activity.
+        EActiveDb       = 0x000000F0,   ///< Log active db & notification 
+                                        ///< activity.
+
+        ESpecial        = 0x0FFFF000,   ///< Log special, temp stuff only
+        ELogAll         = 0xFFFFFFFF    ///< Log all.
+        };
+
+    // MACROS
+
+    /// Determines what to log. Construct this from TApEngineLogMask values.
+    #define APENGINE_LOG_MASK ELogAll
+
+    /// Determines log detail (0==basic level).
+    #define APENGINE_LOG_LEVEL 4
+
+    // CLASS DECLARATION
+
+    /**
+    * Logger class.
+    */
+    NONSHARABLE_CLASS( ApEngineLogger )
+        {
+        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
+            );
+        };
+
+
+    /// Write formatted to log.
+    #define CLOG( body ) ApEngineLogger::Write body
+    /// Write hex dump.
+    #define CDUMP( body ) ApEngineLogger::HexDump body
+
+#else /* not defined __TEST_APENGINE_LOG__ */
+
+    /// Do nothing (log disabled).
+    #define CLOG( body )
+    /// Do nothing (log disabled).
+    #define CDUMP( body )
+
+#endif /* def __TEST_APENGINE_LOG__ */
+
+#endif /* def APENGINE_LOGGER_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apeng/inc/ApEnginePrivateCRKeys.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef APENGINEPRIVATECRKEYS_H
+#define APENGINEPRIVATECRKEYS_H
+
+const TUid KCRUidApEngineLV = {0x10008D3A};
+
+// Local variation for ApEngine
+const TUint32 KApEngineLVFlags =            0x00000001;
+
+
+#endif      // APENGINEPRIVATECRKEYS_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apeng/inc/ApListItemKey.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2002 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 the TApListItemKey class.
+*
+*/
+
+
+#ifndef TAPLISTITEMKEY_H
+#define TAPLISTITEMKEY_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <e32std.h>
+#include <ApEngineVer.h>
+
+// CLASS DECLARATION
+/**
+*  A key for sorting CApListItems according to their name
+*  The pointer to the list is not owned
+*/
+NONSHARABLE_CLASS( TApListItemNameKey ) : public TKeyArrayFix
+    {
+public:
+    /**
+    * Sets the list to sort
+    * @param aPtr A pointer to the l;ist to sort
+    */
+    void SetPtr( CApListItemList* aPtr );
+    
+    // From TKeyArrayFix
+    virtual TInt Compare( TInt aLeft,TInt aRight ) const;
+    
+    // From TKeyArrayFix
+    virtual TAny* At( TInt anIndex ) const;
+    
+    /**
+    * Constructor
+    */
+    TApListItemNameKey( TBool aAscending = ETrue );
+    
+protected:
+    CApListItemList* iList;
+    TBool            iAscending;
+    };
+
+
+
+
+/**
+*  A key for sorting CApListItems according to their UID
+*  The pointer to the list is not owned
+*/
+NONSHARABLE_CLASS( TApListItemUidKey ) : public TKeyArrayFix
+    {
+public:
+    /**
+    * Sets the list to sort
+    * @param aPtr A pointer to the l;ist to sort
+    */
+    void SetPtr( CApListItemList* aPtr );
+        
+    // From TKeyArrayFix
+    virtual TInt Compare( TInt aLeft,TInt aRight ) const;
+    
+    // From TKeyArrayFix
+    virtual TAny* At( TInt anIndex ) const;
+    
+    /**
+    * Constructor
+    */
+    TApListItemUidKey( TBool aAscending = ETrue );
+
+    
+protected:
+    CApListItemList* iList;
+    TBool            iAscending;
+    };
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apeng/inc/ApSpeedLookup.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,129 @@
+/*
+* 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 file containes the Access Point Engine speed - ETel speed 
+*       lookup-information for the Access Point Engine 
+*
+*/
+
+
+
+#ifndef APSPEED_LOOKUP_H
+#define APSPEED_LOOKUP_H
+
+// INCLUDE FILES
+#include <ApEngineConsts.h>
+
+
+// CONSTANTS
+
+const TInt  CSD     = 0;
+const TInt  HSCSD   = 1;
+
+const TInt  Analogue    = 0;
+const TInt  V110        = 1;
+const TInt  V120        = 2;
+
+
+const TInt SpeedData[27][13] =
+    {
+        {
+        CSD,  Analogue,  KSpeedAutobaud,  0,  1,  2,  0,  0,  0,  0,  0,  1,  0
+        },
+        {
+        CSD,  Analogue,  KSpeed9600,      0,  4,  2,  0,  0,  0,  0,  0,  1,  2
+        },
+        {
+        CSD,  Analogue,  KSpeed14400,     0,  5,  2,  0,  0,  0,  0,  0,  1,  3
+        },        
+        {
+        CSD,  Analogue,  KSpeed28800,     0,  7,  2,  0,  0,  0,  0,  0,  1,  3
+        },
+        {
+        CSD,  V110,  KSpeed9600,      0,  4,  2,  0,  0,  0,  0,  0,  1,  4
+        },
+        {
+        CSD,  V110,  KSpeed14400,     0,  5,  2,  0,  0,  0,  0,  0,  1,  4
+        },        
+        {
+        CSD,  V110,  KSpeed28800,     0,  7,  2,  0,  0,  0,  0,  0,  1,  4
+        },
+        {
+        CSD,  V110,  KSpeed38400,     0, 10,  2,  0,  0,  0,  0,  0,  1,  4
+        },
+        {
+        CSD,  V120,  KSpeed9600,      0,  4,  2,  0,  0,  0,  0,  0,  1,  5
+        },
+        {
+        CSD,  V120,  KSpeed14400,     0,  5,  2,  0,  0,  0,  0,  0,  1,  5
+        },        
+        {
+        CSD,  V120,  KSpeed28800,     0,  7,  2,  0,  0,  0,  0,  0,  1,  5
+        },
+        {
+        CSD,  V120,  KSpeed56000,     0, 13,  2,  0,  0,  0,  0,  0,  1,  5
+        },
+        {
+        HSCSD, Analogue, KSpeedAutobaud,  1,  7,  2,  1, 12,  0,  0,  2,  1,  3
+        },
+        {
+        HSCSD, Analogue, KSpeed9600,      1,  7,  2,  1,  4,  0,  1,  1,  1,  3
+        },
+        {
+        HSCSD, Analogue, KSpeed14400,     1,  7,  2,  1, 12,  0,  1,  1,  1,  3
+        },        
+        {
+        HSCSD, Analogue, KSpeed19200,     1,  7,  2,  1,  4,  0,  2,  2,  1,  3
+        },
+        {
+        HSCSD, Analogue, KSpeed28800,     1,  7,  2,  1, 12,  0,  2,  2,  1,  3
+        },
+        {
+        HSCSD, V110, KSpeed9600,      1, 10,  2,  1,  4,  0,  1,  1,  1,  4
+        },
+        {
+        HSCSD, V110, KSpeed14400,     1, 10,  2,  1, 12,  0,  1,  1,  1,  4
+        },        
+        {
+        HSCSD, V110, KSpeed19200,     1, 10,  2,  1,  4,  0,  2,  2,  1,  4
+        },
+        {
+        HSCSD, V110, KSpeed28800,     1, 10,  2,  1, 12,  0,  2,  2,  1,  4
+        },
+        {
+        HSCSD, V110, KSpeed38400,     1, 10,  2,  1, 12,  0,  3,  3,  1,  4
+        },
+        {
+        HSCSD, V120, KSpeed9600,      1, 13,  2,  1,  4,  0,  1,  1,  1,  5
+        },
+        {
+        HSCSD, V120, KSpeed14400,     1, 13,  2,  1, 12,  0,  1,  1,  1,  5
+        },        
+        {
+        HSCSD, V120, KSpeed19200,     1, 13,  2,  1,  4,  0,  2,  2,  1,  5
+        },        
+        {
+        HSCSD, V120, KSpeed28800,     1, 13,  2,  1, 12,  0,  2,  2,  1,  5
+        },
+        {
+        HSCSD, V120, KSpeed43200,     1, 13,  2,  1, 12,  0,  3,  3,  1,  5
+        }
+    };
+        
+
+
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apeng/loc/apengine.loc	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2002 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 a localisation file for ApEngine
+*     A .loc file is the one and only place where the logical strings
+*     to be localised are defined.
+*
+*/
+
+
+
+// LOCALISATION STRINGS
+
+
+//d:The name of a new, default connection. Max.30 chars, longer ones will be truncated.
+//l:list_set_graphic_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_ap_default_name "New connection"
+
+
+//d:The name of a new, default vpn connection. Max.30 chars, longer ones will be truncated.
+//l:list_set_graphic_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_vpn_sett_vpn_iap_default_name "Connection"
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apeng/src/APAccessPointItem.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,5492 @@
+/*
+* Copyright (c) 2002 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 the class CApAccessPointItem
+*
+*/
+
+
+// INCLUDE FILES
+#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include <nifvar_internal.h>
+#endif
+#include    <cdblen.h>
+#include    <f32file.h>
+#include    <bautils.h>
+#include    <barsc.h>
+#include    <ApEngine.rsg>
+#include    "ApAccessPointItem.h"
+#include    "ApEngineConsts.h"
+#include    "ApEngineCommons.h"
+#include    "ApEngineLogger.h"
+#include    <txtetext.h>
+#include    <in_sock.h>
+
+#include    "APItemExtra.h"
+#include    "APItemCdmaData.h"
+#include    "APItemWlanData.h"
+
+#include    <featmgr.h>
+#include    <etelpckt.h>
+#include    <etelqos.h>
+
+#include    <data_caging_path_literals.hrh>
+
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+_LIT( KDefIspIfName, "ppp" );                           // required !
+
+_LIT( KDefGprsIfName, "pppgprs" );                      // required !
+
+_LIT( KDefIspIfNetworksIPv4, "ip" );                        // required !
+//_LIT( KDefGprsIfParams, "gprsnif" );                    // required !
+_LIT( KDefGprsIfParams, "" );                    // required !
+
+_LIT( KDefWapGatewayIpAddress, "0.0.0.0" );
+_LIT( KDefIspGateway, "0.0.0.0" );
+_LIT( KDefPhoneIpAddress, "0.0.0.0" );
+_LIT( KDefPrimaryNameServer, "0.0.0.0" );
+_LIT( KDefSecondaryNameServer, "0.0.0.0" );
+
+_LIT( KWellKnownIp6PrimaryNameServer, "fec0:000:0000:ffff::1" );
+_LIT( KWellKnownIp6SecondaryNameServer, "fec0:000:0000:ffff::2" );
+_LIT( KDefIp6PrimaryNameServer, "0:0:0:0:0:0:0:0" );
+_LIT( KDefIp6SecondaryNameServer, "0:0:0:0:0:0:0:0" );
+
+_LIT( KDefIspIfNetworksIPv6, "ip6" );                        // required !
+_LIT( KDefIspIfNetworksIPv4IPv6, "ip,ip6" );                 // required !
+_LIT( KDefIspIfNetworksIPv4IPv6LAN, "ip,ip6" );              // required !
+
+
+
+/// ROM drive.
+_LIT( KApEngineResDriveZ, "z:" );
+/// ApEngine resource file name.
+_LIT( KApEngineResFileName, "ApEngine.rsc" );
+
+
+/**
+* General Settings UID
+*/
+#ifdef __TEST_USE_SHARED_DATA
+    LOCAL_D const TUid KGeneralSettingsUid = { 0X100058EC };
+#endif // __TEST_USE_SHARED_DATA
+
+
+// MACROS
+#define BOOL_COMPARE(a,b) (((a) && (b)) || (!(a) && !(b)))
+
+// LOCAL CONSTANTS AND MACROS
+const TInt KApItemInitialTxtBufSize = 0;
+
+const TInt KApMembers = EApWlanIPNameServer2+1;
+
+_LIT( KDefProxyProtocolName, "http" );                      // required !
+
+#if defined(_DEBUG)
+    _LIT( kApSet, "APEngine" ) ;
+#endif // (_DEBUG)
+
+const TInt KEndOfArray = -1;
+
+const TInt KCsdAnalogue[]       = { KSpeedAutobaud, KSpeed9600, KSpeed14400,
+                                    KEndOfArray };
+
+const TInt KCsdAnalogueWcdma[]  = { KSpeedAutobaud, KSpeed9600, KSpeed14400,
+                                    KSpeed28800, KEndOfArray};
+
+const TInt KCsdIsdn110[]        = { KSpeed9600, KSpeed14400, KEndOfArray};
+
+const TInt KCsdIsdn110Wcdma[]   = { KSpeed9600, KSpeed14400, KSpeed28800,
+                                    KSpeed38400, KEndOfArray};
+
+const TInt KCsdIsdn120[]        = { KSpeed9600, KSpeed14400, KEndOfArray};
+
+const TInt KCsdIsdn120Wcdma[]   = { KSpeed9600, KSpeed14400, KSpeed28800,
+                                    KSpeed56000, KEndOfArray};
+
+const TInt KHcsdAnal[]          = { KSpeedAutobaud, KSpeed9600, KSpeed14400,
+                                    KSpeed19200, KSpeed28800, KEndOfArray};
+
+const TInt KHcsdIsdn110[]       = { KSpeed9600, KSpeed14400, KSpeed19200, 
+                                    KSpeed28800, KSpeed38400, KEndOfArray};
+
+const TInt KHcsdIsdn120[]       = { KSpeed9600, KSpeed14400, KSpeed19200,
+                                    KSpeed28800, KSpeed43200, KEndOfArray};
+
+
+
+// ---------------------------------------------------------
+// ---------------------------------------------------------
+// 
+//  LOCAL, CApItemExtra class implementation
+// 
+// ---------------------------------------------------------
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+// CApItemExtra::NewL
+// ---------------------------------------------------------
+//
+CApItemExtra* CApItemExtra::NewL()
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApItemExtra::NewL" ) ) );
+
+    CApItemExtra* self = new ( ELeave ) CApItemExtra;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+
+    CleanupStack::Pop( self );
+
+    CLOG( ( EApItem, 1, _L( "<- CApItemExtra::NewL" ) ) );
+    
+    return self;
+    }
+
+
+// Destructor
+// ---------------------------------------------------------
+// CApItemExtra::~CApItemExtra
+// ---------------------------------------------------------
+//
+CApItemExtra::~CApItemExtra()
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApItemExtra::~CApItemExtra" ) ) );
+
+    delete iCdmaData;
+    delete iWlanData;
+    delete iIpv6PrimaryDNS;
+    delete iIpv6SecondaryDNS;
+    delete iLanBearerModemName;
+    delete iIapBearerType;
+    }
+
+
+// C++ default constructor can NOT contain any code that
+// might leave.
+// ---------------------------------------------------------
+// CApItemExtra::CApItemExtra
+// ---------------------------------------------------------
+//
+CApItemExtra::CApItemExtra()
+:iIsFeatureManagerInitialised( EFalse ),
+iIpv6GetDNSIPFromServer( ETrue ),
+iIsWcdma( EFalse ), 
+iIsIpv6Supported( EFalse ),
+iIsVpnAp( EFalse ),
+iIsAppCsdSupport( EFalse )
+    {
+    }
+
+// Symbian OS default constructor can leave.
+// ---------------------------------------------------------
+// CApItemExtra::ConstructL
+// ---------------------------------------------------------
+//
+void CApItemExtra::ConstructL()
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApItemExtra::ConstructL" ) ) );
+
+    iIpv6PrimaryDNS = HBufC::NewL( KApItemInitialTxtBufSize );
+    iIpv6SecondaryDNS = HBufC::NewL( KApItemInitialTxtBufSize );
+    iLanBearerModemName = HBufC::NewL( KApItemInitialTxtBufSize );
+    iIapBearerType = HBufC::NewL( KApItemInitialTxtBufSize );
+     
+#ifdef __TEST_USE_SHARED_DATA
+    iIsAppHscsdSupport = 
+        ApCommons::IsGivenSharedDataSupportL( KGeneralSettingsUid, 
+                                              KGSHSCSDAccessPoints );
+#else
+    iIsAppHscsdSupport = ETrue;
+#endif // __TEST_USE_SHARED_DATA
+
+
+#ifdef __TEST_HSCSD_SUPPORT
+    iIsAppHscsdSupport = ETrue;
+#endif // __TEST_HSCSD_SUPPORT
+
+    CLOG( ( EApItem, 1, _L( "<- CApItemExtra::ConstructL" ) ) );
+    }
+
+
+// ---------------------------------------------------------
+// ---------------------------------------------------------
+// 
+//  LOCAL, CApItemCdmaData class implementation
+// 
+// ---------------------------------------------------------
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+// CApItemCdmaData::NewL
+// ---------------------------------------------------------
+//
+CApItemCdmaData* CApItemCdmaData::NewL()
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApItemCdmaData::NewL" ) ) );
+
+    CApItemCdmaData* self = new ( ELeave ) CApItemCdmaData;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    CLOG( ( EApItem, 1, _L( "<- CApItemCdmaData::NewL" ) ) );
+    
+    return self;
+    }
+
+
+// Destructor
+// ---------------------------------------------------------
+// CApItemCdmaData::~CApItemCdmaData
+// ---------------------------------------------------------
+//
+CApItemCdmaData::~CApItemCdmaData()
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApItemCdmaData::~CApItemCdmaData" ) ) );
+
+    delete iIwfName;
+    delete iPdpAddress;
+    delete iHomeAgentAddress;
+    delete iMipHomeAddress;
+    delete iMipPrimaryHomeAgent;
+    delete iMipSecondaryHomeAgent;
+    }
+
+
+// C++ default constructor can NOT contain any code that
+// might leave.
+// ---------------------------------------------------------
+// CApItemCdmaData::CApItemCdmaData
+// ---------------------------------------------------------
+//
+CApItemCdmaData::CApItemCdmaData()
+/* Assuming 0 default values everywhere. */
+:iServiceOption( RPacketContext::KLowSpeedData ),
+iPdpType( EIPv4 ),
+iReqFwdPriority( 0 ), /*RPacketQoS::TQoSLinkPriority*/
+iReqRevPriority( 0 ), /*RPacketQoS::TQoSLinkPriority*/
+iReqFwdBitrate( 0 ),  /*RPacketQoS::TQoSDataRate*/
+iReqRevBitrate( 0 ),  /*RPacketQoS::TQoSDataRate*/
+iReqFwdLoss( 0 ),  /*RPacketQoS::TQoSDataLoss*/
+iReqRevLoss( 0 ),  /*RPacketQoS::TQoSDataLoss*/
+iReqFwdMaxDelay( 0 ),  /*RPacketQoS::TQoSDelay*/
+iReqRevMaxDelay( 0 ),  /*RPacketQoS::TQoSDelay*/
+iMinFwdBitrate( 0 ),  /*RPacketQoS::TQoSDataRate*/
+iMinRevBitrate( 0 ),  /*RPacketQoS::TQoSDataRate*/
+iAccptFwdLoss( 0 ),  /*RPacketQoS::TQoSDataLoss*/
+iAccptRevLoss( 0 ),  /*RPacketQoS::TQoSDataLoss*/
+iAccptFwdMaxDelay( 0 ),  /*RPacketQoS::TQoSDelay*/
+iAccptRevMaxDelay( 0 ),  /*RPacketQoS::TQoSDelay*/
+iQosWarningTimeout( 0 ), /*0xffffffff disables*/
+iRlpMode( RPacketQoS::KRLPUnknown ),
+// CDMA2000 deprecated Mobile IP fields
+iMip( EFalse ),
+iMipTimeout( 0 ),
+// CDMA2000 specific CDMA parameters provisioned through OTA
+iNaiType( 0 ),
+iSimpleIpAuthAlgorithm( 0 ),
+iSimpleIpPapSsHandle( 0 ),
+iSimpleIpChapSsHandle( 0 ),
+iMipTBit( 0 ),
+iMipMnAaaAuthAlgorithm( 0 ),
+iMipMnAaaSpi( 0 ),
+iMipMnAaaSsHandle( 0 ),
+iMipMnHaAuthAlgorithm( 0 ),
+iMipMnHaSpi( 0 ),
+iMipMnHaSsHandle( 0 )
+    {
+    }
+
+// Symbian OS default constructor can leave.
+// ---------------------------------------------------------
+// CApItemCdmaData::ConstructL
+// ---------------------------------------------------------
+//
+void CApItemCdmaData::ConstructL()
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApItemCdmaData::ConstructL" ) ) );
+
+    iIwfName = HBufC::NewL( KApItemInitialTxtBufSize );
+    iPdpAddress = HBufC::NewL( KApItemInitialTxtBufSize );
+    iHomeAgentAddress = HBufC::NewL( KApItemInitialTxtBufSize );
+    iMipHomeAddress = HBufC::NewL( KApItemInitialTxtBufSize );
+    iMipPrimaryHomeAgent = HBufC::NewL( KApItemInitialTxtBufSize );
+    iMipSecondaryHomeAgent = HBufC::NewL( KApItemInitialTxtBufSize );
+
+    CLOG( ( EApItem, 1, _L( "<- CApItemCdmaData::ConstructL" ) ) );
+    }
+
+
+
+
+
+
+
+// ---------------------------------------------------------
+// ---------------------------------------------------------
+// 
+//  LOCAL, CApItemWlanData class implementation
+// 
+// ---------------------------------------------------------
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+// CApItemWlanData::NewL
+// ---------------------------------------------------------
+//
+CApItemWlanData* CApItemWlanData::NewL()
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApItemWlanData::NewL" ) ) );
+
+    CApItemWlanData* self = new ( ELeave ) CApItemWlanData;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    CLOG( ( EApItem, 1, _L( "<- CApItemWlanData::NewL" ) ) );
+    
+    return self;
+    }
+
+
+// Destructor
+// ---------------------------------------------------------
+// CApItemWlanData::~CApItemWlanData
+// ---------------------------------------------------------
+//
+CApItemWlanData::~CApItemWlanData()
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApItemWlanData::~CApItemWlanData" ) ) );
+    delete iWlanNetworkName;
+    }
+
+
+// C++ default constructor can NOT contain any code that
+// might leave.
+// ---------------------------------------------------------
+// CApItemWlanData::CApItemWlanData
+// ---------------------------------------------------------
+//
+CApItemWlanData::CApItemWlanData()
+:iWlanNetworkMode( EInfra ),
+iWlanSecurityMode( EOpen )
+/* Assuming 0 default values elsewhere. */
+    {
+    }
+
+// Symbian OS default constructor can leave.
+// ---------------------------------------------------------
+// CApItemWlanData::ConstructL
+// ---------------------------------------------------------
+//
+void CApItemWlanData::ConstructL()
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApItemWlanData::ConstructL" ) ) );
+
+    iWlanNetworkName = HBufC::NewL( KApItemInitialTxtBufSize );
+
+    CLOG( ( EApItem, 1, _L( "<- CApItemWlanData::ConstructL" ) ) );
+    }
+
+
+
+
+// MODULE DATA STRUCTURES
+
+// =========================================================
+// =========================================================
+// =========================================================
+// 
+// CApAccessPointItem class implementation
+// 
+// =========================================================
+// =========================================================
+// =========================================================
+//
+
+// ================= MEMBER FUNCTIONS =======================
+// Two-phased constructor.
+// ---------------------------------------------------------
+// CApAccessPointItem::NewLC
+// ---------------------------------------------------------
+//
+EXPORT_C CApAccessPointItem* CApAccessPointItem::NewLC()
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApAccessPointItem::NewLC" ) ) );
+
+    CApAccessPointItem* self = new ( ELeave ) CApAccessPointItem;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+
+    CLOG( ( EApItem, 1, _L( "<- CApAccessPointItem::NewLC" ) ) );
+    return self;
+    }
+
+
+// Destructor
+// ---------------------------------------------------------
+// CApAccessPointItem::~CApAccessPointItem
+// ---------------------------------------------------------
+//
+EXPORT_C CApAccessPointItem::~CApAccessPointItem()
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApAccessPointItem::~CApAccessPointItem" ) ) );
+
+    if ( iExt )
+        {
+        if ( iExt->iIsFeatureManagerInitialised )
+            {
+            FeatureManager::UnInitializeLib();
+            }
+        }
+
+    delete iExt;
+    delete iSpecified;
+    delete iWapAccessPointName;
+    delete iWapBearer;
+    delete iStartingPage;
+    delete iWapGatewayAddress;
+    delete iIapName;
+    delete iIspName;
+    delete iIspDescription;
+    delete iIspDefaultTelNumber;
+    delete iLoginScript;
+    delete iUserName;
+    delete iPassword;
+    delete iIspIfName;
+    delete iIspIfParams;
+    delete iIspIfNetworks;
+    delete iIspIfAuthName;
+    delete iIspIfAuthPass;
+    delete iIspIfCallbackInfo;
+    delete iIspIPAddr;
+    delete iIspIPNetMask;
+    delete iIspGateway;
+    delete iPrimaryDNS;
+    delete iSecondaryDNS;
+    delete iIspInitString;
+    delete iIapServiceType;
+    delete iGprsAccessPointName;
+    delete iGprsPdpAddress;
+    delete iApProxyProtocolName;
+    delete iApProxyServerAddress;
+    delete iApProxyExceptions;
+    delete iNetworkName;
+    delete iWapProxyLoginName; 
+    delete iWapProxyLoginPass;
+
+    CLOG( ( EApItem, 1, _L( "<- CApAccessPointItem::~CApAccessPointItem" ) ) );
+    }
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::CopyFromL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApAccessPointItem::CopyFromL( const CApAccessPointItem&
+                                            aCopyFrom  )
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApAccessPointItem::CopyFromL" ) ) );
+
+    WriteTextL( EApWapAccessPointName, *aCopyFrom.iWapAccessPointName );
+    WriteTextL( EApWapCurrentBearer, *aCopyFrom.iWapBearer );
+    WriteLongTextL( EApWapStartPage, *aCopyFrom.iStartingPage );
+    // The WAP gateway address
+    WriteTextL( EApWapGatewayAddress, *aCopyFrom.iWapGatewayAddress );
+
+    iIsWTLSSecurityOn = aCopyFrom.iIsWTLSSecurityOn;
+    iIsConnectionTypeContinuous = aCopyFrom.iIsConnectionTypeContinuous;
+    iChargeCard = aCopyFrom.iChargeCard;
+    iWapIap = aCopyFrom.iWapIap;
+
+    WriteTextL( EApIapName, *aCopyFrom.iIapName );
+    iIapServiceId = aCopyFrom.iIapServiceId;
+    WriteTextL( EApIapServiceType, *aCopyFrom.iIapServiceType );
+
+
+    iIapChargeCardId = aCopyFrom.iIapChargeCardId;
+
+    WriteTextL( EApIspName, *aCopyFrom.iIspName );
+    WriteTextL( EApIspDescription, *aCopyFrom.iIspDescription );
+
+    iIspType = aCopyFrom.iIspType;
+
+    WriteTextL( EApIspDefaultTelNumber, *aCopyFrom.iIspDefaultTelNumber );
+
+    iIspDialResolution = aCopyFrom.iIspDialResolution;
+    iUseLoginScript = aCopyFrom.iUseLoginScript;
+
+    WriteLongTextL( EApIspLoginScript, *aCopyFrom.iLoginScript );
+
+    iPromptPassword = aCopyFrom.iPromptPassword;
+
+    WriteTextL( EApIspLoginName, *aCopyFrom.iUserName );
+    WriteTextL( EApIspLoginPass, *aCopyFrom.iPassword );
+
+    iDisplayTerminalWindow = aCopyFrom.iDisplayTerminalWindow;
+
+    WriteTextL( EApIspIfName, *aCopyFrom.iIspIfName );
+    WriteTextL( EApIspIfParams, *aCopyFrom.iIspIfParams );
+    WriteTextL( EApIspIfNetworks, *aCopyFrom.iIspIfNetworks );
+
+    iIspIfPromptForAuth = aCopyFrom.iIspIfPromptForAuth;
+
+    WriteTextL( EApIspIfAuthName, *aCopyFrom.iIspIfAuthName );
+    WriteTextL( EApIspIfAuthPass, *aCopyFrom.iIspIfAuthPass );
+
+    iIspIfAuthRetries = aCopyFrom.iIspIfAuthRetries;
+    iUseCallBack = aCopyFrom.iUseCallBack;
+    iCallBackTypeIsServerNum = aCopyFrom.iCallBackTypeIsServerNum;
+
+    WriteTextL( EApIspIfCallbackInfo, *aCopyFrom.iIspIfCallbackInfo );
+
+    iIspCallbackTimeOut = aCopyFrom.iIspCallbackTimeOut;
+    iIspIPAddrFromServer = aCopyFrom.iIspIPAddrFromServer;
+
+    WriteTextL( EApIspIPAddr, *aCopyFrom.iIspIPAddr );
+    WriteTextL( EApIspIPNetMask, *aCopyFrom.iIspIPNetMask );
+    WriteTextL( EApIspIPGateway, *aCopyFrom.iIspGateway );
+
+    iGetDNSIPFromServer = aCopyFrom.iGetDNSIPFromServer;
+
+    WriteTextL( EApIspIPNameServer1, *aCopyFrom.iPrimaryDNS );
+    WriteTextL( EApIspIPNameServer2, *aCopyFrom.iSecondaryDNS );
+
+    iEnablePPPCompression = aCopyFrom.iEnablePPPCompression;
+    iIspEnableLCPExtensions = aCopyFrom.iIspEnableLCPExtensions;
+    iIsPasswordAuthenticationSecure =
+                aCopyFrom.iIsPasswordAuthenticationSecure;
+    iIspEnableSwCompression = aCopyFrom.iIspEnableSwCompression;
+    iIspBearerName = aCopyFrom.iIspBearerName;
+    iMaxConnSpeed = aCopyFrom.iMaxConnSpeed;
+    iIspBearerCE = aCopyFrom.iIspBearerCE;
+    iApIapBearerService = aCopyFrom.iApIapBearerService;
+    iBearerCallTypeIsdn = aCopyFrom.iBearerCallTypeIsdn;
+
+    WriteTextL( EApIspInitString, *aCopyFrom.iIspInitString );
+
+    iIspBearerType = aCopyFrom.iIspBearerType;
+    iIspChannelCoding = aCopyFrom.iIspChannelCoding;
+    iIspAIUR = aCopyFrom.iIspAIUR;
+    iIspRequestedTimeSlots = aCopyFrom.iIspRequestedTimeSlots;
+    iIspMaximumTimeSlots = aCopyFrom.iIspMaximumTimeSlots;
+
+    WriteLongTextL( EApGprsAccessPointName, *aCopyFrom.iGprsAccessPointName );
+
+    WriteTextL( EApGprsPdpAddress, *aCopyFrom.iGprsPdpAddress );
+
+    iGprsPdpType = aCopyFrom.iGprsPdpType;
+    iGprsReqPrecedence = aCopyFrom.iGprsReqPrecedence;
+    iGprsReqDelay = aCopyFrom.iGprsReqDelay;
+    iGprsReqReliability = aCopyFrom.iGprsReqReliability;
+    iGprsReqPeakThroughput = aCopyFrom.iGprsReqPeakThroughput;
+    iGprsReqMeanPeakThroughput = aCopyFrom.iGprsReqMeanPeakThroughput;
+    iGprsMinPrecedence = aCopyFrom.iGprsMinPrecedence;
+
+    iGprsMinDelay = aCopyFrom.iGprsMinDelay;
+    iGprsMinReliability = aCopyFrom.iGprsMinReliability;
+    iGprsMinPeakThroughput = aCopyFrom.iGprsMinPeakThroughput;
+    iGprsMinMeanThroughput = aCopyFrom.iGprsMinMeanThroughput;
+
+    iGprsUseAnonymAccess = aCopyFrom.iGprsUseAnonymAccess;
+    WriteTextL( EApProxyProtocolName, *aCopyFrom.iApProxyProtocolName );
+    WriteLongTextL( EApProxyServerAddress, *aCopyFrom.iApProxyServerAddress );
+    WriteLongTextL( EApProxyExceptions, *aCopyFrom.iApProxyExceptions);        
+    iApProxyPortNumber = aCopyFrom.iApProxyPortNumber;
+    iApProxyUseProxy = aCopyFrom.iApProxyUseProxy;
+    iApHasProxySettings = aCopyFrom.iApHasProxySettings;
+    WriteTextL( EApNetworkName, *aCopyFrom.iNetworkName );
+    WriteTextL( EApProxyLoginName, *aCopyFrom.iWapProxyLoginName );
+    WriteTextL( EApProxyLoginPass, *aCopyFrom.iWapProxyLoginPass );
+
+    iNetworkId = aCopyFrom.iNetworkId;
+    WriteTextL( EApLanBearerName, *aCopyFrom.iExt->iLanBearerModemName );
+    WriteTextL( EApIapBearerType, *aCopyFrom.iExt->iIapBearerType );
+
+
+    // Copying of WLAN data must be before Ipv6 support handling as that 
+    // requires the knowledge of the bearer type!!!!!
+    if ( iExt->iWlanData )
+        {
+        iExt->iWlanData->iWlanNetworkMode = 
+                    aCopyFrom.iExt->iWlanData->iWlanNetworkMode;
+        iExt->iWlanData->iWlanSecurityMode = 
+                    aCopyFrom.iExt->iWlanData->iWlanSecurityMode;
+        ReAllocL( iExt->iWlanData->iWlanNetworkName, 
+                    *aCopyFrom.iExt->iWlanData->iWlanNetworkName );
+        iExt->iWlanData->iWlanId = aCopyFrom.iExt->iWlanData->iWlanId;
+        iExt->iWlanData->iIsWlan = aCopyFrom.iExt->iWlanData->iIsWlan;
+        iExt->iWlanData->iScanSSID = aCopyFrom.iExt->iWlanData->iScanSSID;
+        iExt->iWlanData->iChannelId = aCopyFrom.iExt->iWlanData->iChannelId;
+        }
+
+    if ( iExt->iIsIpv6Supported )
+        {
+        iExt->iIpv6GetDNSIPFromServer = 
+            aCopyFrom.iExt->iIpv6GetDNSIPFromServer;
+        WriteTextL( EApIP6NameServer1, *aCopyFrom.iExt->iIpv6PrimaryDNS );
+        WriteTextL( EApIP6NameServer2, *aCopyFrom.iExt->iIpv6SecondaryDNS );
+        }
+
+    if( iExt->iCdmaData )
+        {
+        // CDMA2000
+        ReAllocL( iExt->iCdmaData->iIwfName, 
+                    *aCopyFrom.iExt->iCdmaData->iIwfName );
+        iExt->iCdmaData->iServiceOption = 
+                    aCopyFrom.iExt->iCdmaData->iServiceOption;
+        iExt->iCdmaData->iPdpType = aCopyFrom.iExt->iCdmaData->iPdpType;
+        ReAllocL( iExt->iCdmaData->iPdpAddress, 
+                    *aCopyFrom.iExt->iCdmaData->iPdpAddress );
+        iExt->iCdmaData->iReqFwdPriority = 
+                    aCopyFrom.iExt->iCdmaData->iReqFwdPriority;
+        iExt->iCdmaData->iReqRevPriority = 
+                    aCopyFrom.iExt->iCdmaData->iReqRevPriority;
+        iExt->iCdmaData->iReqFwdBitrate = 
+                    aCopyFrom.iExt->iCdmaData->iReqFwdBitrate;
+        iExt->iCdmaData->iReqRevBitrate = 
+                    aCopyFrom.iExt->iCdmaData->iReqRevBitrate;
+        iExt->iCdmaData->iReqFwdLoss = aCopyFrom.iExt->iCdmaData->iReqFwdLoss;
+        iExt->iCdmaData->iReqRevLoss = aCopyFrom.iExt->iCdmaData->iReqRevLoss;
+        iExt->iCdmaData->iReqFwdMaxDelay = 
+                    aCopyFrom.iExt->iCdmaData->iReqFwdMaxDelay;
+        iExt->iCdmaData->iReqRevMaxDelay = 
+                    aCopyFrom.iExt->iCdmaData->iReqRevMaxDelay;
+        iExt->iCdmaData->iMinFwdBitrate = 
+                    aCopyFrom.iExt->iCdmaData->iMinFwdBitrate;
+        iExt->iCdmaData->iMinRevBitrate = 
+                    aCopyFrom.iExt->iCdmaData->iMinRevBitrate;
+        iExt->iCdmaData->iAccptFwdLoss = 
+                    aCopyFrom.iExt->iCdmaData->iAccptFwdLoss;
+        iExt->iCdmaData->iAccptRevLoss = 
+                    aCopyFrom.iExt->iCdmaData->iAccptRevLoss;
+        iExt->iCdmaData->iAccptFwdMaxDelay = 
+                    aCopyFrom.iExt->iCdmaData->iAccptFwdMaxDelay;
+        iExt->iCdmaData->iAccptRevMaxDelay = 
+                    aCopyFrom.iExt->iCdmaData->iAccptRevMaxDelay;
+        iExt->iCdmaData->iQosWarningTimeout = 
+                    aCopyFrom.iExt->iCdmaData->iQosWarningTimeout;
+        iExt->iCdmaData->iRlpMode = aCopyFrom.iExt->iCdmaData->iRlpMode;
+        // CDMA2000 deprecated Mobile IP fields
+        iExt->iCdmaData->iMip = aCopyFrom.iExt->iCdmaData->iMip;
+        ReAllocL( iExt->iCdmaData->iHomeAgentAddress, 
+                    *aCopyFrom.iExt->iCdmaData->iHomeAgentAddress );
+        iExt->iCdmaData->iMipTimeout = aCopyFrom.iExt->iCdmaData->iMipTimeout;
+        // CDMA2000 specific CDMA parameters provisioned through OTA
+        iExt->iCdmaData->iNaiType = aCopyFrom.iExt->iCdmaData->iNaiType;
+        iExt->iCdmaData->iSimpleIpAuthAlgorithm = 
+                    aCopyFrom.iExt->iCdmaData->iSimpleIpAuthAlgorithm;
+        iExt->iCdmaData->iSimpleIpPapSsHandle = 
+                    aCopyFrom.iExt->iCdmaData->iSimpleIpPapSsHandle;
+        iExt->iCdmaData->iSimpleIpChapSsHandle = 
+                    aCopyFrom.iExt->iCdmaData->iSimpleIpChapSsHandle;
+        iExt->iCdmaData->iMipTBit = aCopyFrom.iExt->iCdmaData->iMipTBit;
+        ReAllocL( iExt->iCdmaData->iMipHomeAddress, 
+                    *aCopyFrom.iExt->iCdmaData->iMipHomeAddress );
+        ReAllocL( iExt->iCdmaData->iMipPrimaryHomeAgent, 
+                    *aCopyFrom.iExt->iCdmaData->iMipPrimaryHomeAgent );
+        ReAllocL( iExt->iCdmaData->iMipSecondaryHomeAgent, 
+                    *aCopyFrom.iExt->iCdmaData->iMipSecondaryHomeAgent );
+        iExt->iCdmaData->iMipMnAaaAuthAlgorithm = 
+                    aCopyFrom.iExt->iCdmaData->iMipMnAaaAuthAlgorithm;
+        iExt->iCdmaData->iMipMnAaaSpi = 
+                    aCopyFrom.iExt->iCdmaData->iMipMnAaaSpi;
+        iExt->iCdmaData->iMipMnAaaSsHandle = 
+                    aCopyFrom.iExt->iCdmaData->iMipMnAaaSsHandle;
+        iExt->iCdmaData->iMipMnHaAuthAlgorithm = 
+                    aCopyFrom.iExt->iCdmaData->iMipMnHaAuthAlgorithm;
+        iExt->iCdmaData->iMipMnHaSpi = aCopyFrom.iExt->iCdmaData->iMipMnHaSpi;
+        iExt->iCdmaData->iMipMnHaSsHandle = 
+                    aCopyFrom.iExt->iCdmaData->iMipMnHaSsHandle;
+        }
+
+
+    SetIfNetworksL();
+
+    CLOG( ( EApItem, 1, _L( "<- CApAccessPointItem::CopyFromL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::operator==
+// ---------------------------------------------------------
+//
+EXPORT_C TBool CApAccessPointItem::operator==(
+                                             const CApAccessPointItem& aItem
+                                             ) const
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApAccessPointItem::operator==" ) ) );
+
+    TBool retval( EFalse );
+    TRAPD( err, retval = DoCompareApL( aItem ) );
+    if ( err )
+        {
+        retval = EFalse;
+        }
+
+    CLOG( ( EApItem, 1, _L( "<- CApAccessPointItem::operator==" ) ) );
+    return retval;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::operator!=
+// ---------------------------------------------------------
+//
+EXPORT_C TBool CApAccessPointItem::operator!=(
+                                             const CApAccessPointItem& aItem
+                                             ) const
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApAccessPointItem::operator!=" ) ) );
+
+    TBool ret = ( *this == aItem );
+
+    CLOG( ( EApItem, 1, _L( "<- CApAccessPointItem::operator!=" ) ) );
+    return ( !ret );
+    }
+
+
+
+// C++ default constructor can NOT contain any code that
+// might leave.
+// ---------------------------------------------------------
+// CApAccessPointItem::CApAccessPointItem
+// ---------------------------------------------------------
+//
+EXPORT_C CApAccessPointItem::CApAccessPointItem()
+:iIsWTLSSecurityOn( EFalse ),
+iIsConnectionTypeContinuous( EWapWspOptionConnectionOriented ),
+iIspType( EIspTypeInternetOnly ),
+iUseLoginScript( EFalse ),
+iPromptPassword( EFalse ),
+iDisplayTerminalWindow( EFalse ),
+iUseCallBack( EFalse ),
+iCallBackTypeIsServerNum( ECallbackActionMSCBCPAcceptServerSpecifiedNumber ),
+iIspCallbackTimeOut( KCallBackTimeOut ),
+iEnablePPPCompression( EFalse ),
+iIsPasswordAuthenticationSecure( ETrue ),
+iBearerCallTypeIsdn( ECallTypeAnalogue ),
+iIspBearerCE( RMobileCall::EQoSNonTransparent ),
+iGprsPdpType( EIPv4 ),
+iIsReadOnly( EFalse ),
+iApHasProxySettings( EFalse ),
+iNetworkId( 0 ),
+iApIapBearerService( RMobileCall::KCapsDataCircuitAsynchronous )
+
+    {
+    }
+
+
+// Symbian OS default constructor can leave.
+// ---------------------------------------------------------
+// CApAccessPointItem::ConstructL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApAccessPointItem::ConstructL()
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApAccessPointItem::ConstructL" ) ) );
+   
+    iExt = CApItemExtra::NewL();
+
+    FeatureManager::InitializeLibL();
+    iExt->iIsFeatureManagerInitialised = ETrue;
+
+    iExt->iIsWcdma = 
+        FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma );
+
+    iExt->iIsAppCsdSupport = 
+        FeatureManager::FeatureSupported( KFeatureIdAppCsdSupport );
+#ifdef __TEST_CSD_SUPPORT
+    iExt->iIsAppCsdSupport = ETrue;
+#endif // __TEST_CSD_SUPPORT
+
+
+    iExt->iIsIpv6Supported = 
+        FeatureManager::FeatureSupported( KFeatureIdIPv6 );
+#ifdef __TEST_IPV6_SUPPORT    
+    iExt->iIsIpv6Supported = ETrue;
+#endif //  __TEST_IPV6_SUPPORT    
+    if( FeatureManager::FeatureSupported( KFeatureIdProtocolCdma ) )
+        {
+        iExt->iCdmaData = CApItemCdmaData::NewL();
+        }
+#ifdef __TEST_CDMA_SUPPORT
+    if( !iExt->iCdmaData )
+        {
+        iExt->iCdmaData = CApItemCdmaData::NewL();
+        }
+#endif // __TEST_CDMA_SUPPORT
+
+    if( FeatureManager::FeatureSupported( KFeatureIdProtocolWlan ) )
+        {
+        iExt->iWlanData = CApItemWlanData::NewL();
+        }
+#ifdef __TEST_WLAN_SUPPORT
+    iExt->iWlanData = CApItemWlanData::NewL();
+#endif // __TEST_WLAN_SUPPORT
+
+    iSpecified = new (ELeave) CArrayFixFlat<TBool>( KApMembers );
+    for (TInt i=0; i< KApMembers; i++)
+        {
+        iSpecified->AppendL( EFalse );
+        }
+    // as we are in ConstructL called from NewLC,
+    // 'this' is already on the CleanupStack,
+    // so do not push members onto it!
+    iWapAccessPointName = HBufC::NewL( KApItemInitialTxtBufSize );
+    iWapBearer = HBufC::NewL( KApItemInitialTxtBufSize );
+    iStartingPage = HBufC::NewL( KApItemInitialTxtBufSize );
+    iWapGatewayAddress = HBufC::NewL( KApItemInitialTxtBufSize );
+    iIapName = HBufC::NewL( KApItemInitialTxtBufSize );
+    iIspName = HBufC::NewL( KApItemInitialTxtBufSize );
+    iIspDescription = HBufC::NewL( KApItemInitialTxtBufSize );
+    iLoginScript = HBufC::NewL( KApItemInitialTxtBufSize );
+    iUserName = HBufC::NewL( KApItemInitialTxtBufSize );
+
+    iPassword = HBufC::NewL( KApItemInitialTxtBufSize );
+    iIspIfName = HBufC::NewL( KApItemInitialTxtBufSize );
+    iIspIfParams = HBufC::NewL( KApItemInitialTxtBufSize );
+    iIspIfNetworks = HBufC::NewL( KApItemInitialTxtBufSize );
+    iIspIfAuthName = HBufC::NewL( KApItemInitialTxtBufSize );
+    iIspIfAuthPass = HBufC::NewL( KApItemInitialTxtBufSize );
+    iIspIfCallbackInfo = HBufC8::NewL( KApItemInitialTxtBufSize );
+    iIspIPAddr = HBufC::NewL( KApItemInitialTxtBufSize );
+    iIspIPNetMask = HBufC::NewL( KApItemInitialTxtBufSize );
+    iIspGateway = HBufC::NewL( KApItemInitialTxtBufSize );
+
+    iPrimaryDNS = HBufC::NewL( KApItemInitialTxtBufSize );
+    iSecondaryDNS = HBufC::NewL( KApItemInitialTxtBufSize );
+    iIspInitString = HBufC8::NewL( KApItemInitialTxtBufSize );
+    iIspDefaultTelNumber = HBufC::NewL( KApItemInitialTxtBufSize );
+
+
+    iIapServiceType = HBufC::NewL( KApItemInitialTxtBufSize );
+    iGprsAccessPointName = HBufC::NewL( KApItemInitialTxtBufSize );
+    iGprsPdpAddress = HBufC::NewL( KApItemInitialTxtBufSize );
+
+
+    iApProxyProtocolName = HBufC::NewL( KApItemInitialTxtBufSize );
+    iApProxyServerAddress = HBufC::NewL( KApItemInitialTxtBufSize );
+    iApProxyExceptions = HBufC::NewL( KApItemInitialTxtBufSize );
+    iNetworkName = HBufC::NewL( KApItemInitialTxtBufSize );
+
+    iWapProxyLoginName = HBufC::NewL( KApItemInitialTxtBufSize );
+    iWapProxyLoginPass = HBufC::NewL( KApItemInitialTxtBufSize );
+
+    RFs fs;
+    CleanupClosePushL<RFs>( fs );
+    User::LeaveIfError( fs.Connect() );
+
+    // can't use resource here because it is not added yet....
+    TFileName resourceFile;
+    resourceFile.Append( KApEngineResDriveZ );
+    resourceFile.Append( KDC_RESOURCE_FILES_DIR );
+    resourceFile.Append( KApEngineResFileName );
+    BaflUtils::NearestLanguageFile( fs, resourceFile );
+
+    RResourceFile rf;
+    CleanupClosePushL<RResourceFile>( rf );
+    rf.OpenL( fs, resourceFile );
+    rf.ConfirmSignatureL( 0 );
+    HBufC8* readBuffer = rf.AllocReadLC( R_APNG_DEFAULT_AP_NAME );
+    // as we are expecting HBufC16...
+    __ASSERT_DEBUG( ( readBuffer->Length()%2 ) == 0,
+                    ApCommons::Panic( EWrongResourceFormat ) );
+    const TPtrC16 ptrReadBuffer( (TText16*) readBuffer->Ptr(),
+                                 ( readBuffer->Length() + 1 ) >> 1 );
+    HBufC16* textBuffer=HBufC16::NewL( ptrReadBuffer.Length() );
+    *textBuffer=ptrReadBuffer;
+    CleanupStack::PopAndDestroy( readBuffer ); // readBuffer
+    CleanupStack::PushL( textBuffer );
+    
+    SetNamesL( *textBuffer );
+
+    CleanupStack::PopAndDestroy( 3 ); // textbuffer, fs, rf
+
+    WriteTextL( EApWapCurrentBearer, TPtrC(WAP_IP_BEARER) );    // required !
+
+    WriteTextL( EApIapServiceType, TPtrC(OUTGOING_WCDMA) );      // required !
+
+
+    WriteTextL( EApIspIfName, KDefGprsIfName );                 // required !
+    WriteTextL( EApIspIfParams, KDefGprsIfParams );             // required !
+    WriteTextL( EApIspIPGateway, KDefIspGateway );
+    
+    WriteTextL( EApWapGatewayAddress, KDefWapGatewayIpAddress );
+    WriteTextL( EApIspIPAddr, KDefPhoneIpAddress );
+    WriteTextL( EApIspIPNameServer1, KDefPrimaryNameServer );
+    WriteTextL( EApIspIPNameServer2, KDefSecondaryNameServer );
+
+    if ( iExt->iIsIpv6Supported )
+        {
+        WriteTextL( EApIP6NameServer1, KDefIp6PrimaryNameServer );
+        WriteTextL( EApIP6NameServer2, KDefIp6SecondaryNameServer );
+        }
+
+    SetIfNetworksL();
+
+    WriteTextL( EApProxyProtocolName, KDefProxyProtocolName );
+
+    CLOG( ( EApItem, 1, _L( "<- CApAccessPointItem::ConstructL" ) ) );
+    }
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::ReadTextL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApAccessPointItem::ReadTextL( const TApMember aColumn,
+                                           TDes8& aValue )
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApAccessPointItem::ReadTextL8" ) ) );
+
+    LeaveIfUnsupportedL( aColumn );
+
+    switch ( aColumn )
+        {
+        case EApIspIfCallbackInfo:
+            {
+            // make it large enough to hold
+            aValue.SetLength( iIspIfCallbackInfo->Length() );
+            aValue.Format( KFormat8, iIspIfCallbackInfo );
+            break;
+            }
+        case EApIspInitString:
+            {
+            // make it large enough to hold
+            aValue.SetLength( iIspInitString->Length() );
+            aValue.Format( KFormat8, iIspInitString );
+            break;
+            }
+        default:
+            {
+            __ASSERT_DEBUG( EFalse, ApCommons::Panic( EInvalidColumn ) );
+            User::Leave( KErrInvalidColumn );
+            break;
+            }
+        }
+
+    CLOG( ( EApItem, 1, _L( "<- CApAccessPointItem::ReadTextL8" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::ReadTextL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApAccessPointItem::ReadTextL( const TApMember aColumn,
+                                           TDes16& aValue )
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApAccessPointItem::ReadTextL" ) ) );
+
+    LeaveIfUnsupportedL( aColumn );
+
+    switch ( aColumn )
+        {
+        case EApWapAccessPointName:
+            {
+            aValue.SetLength( iWapAccessPointName->Length() );
+            aValue.Format( KFormat, iWapAccessPointName );
+            break;
+            }
+        case EApWapCurrentBearer:
+            {
+            // make it large enough to hold
+            aValue.SetLength( iWapBearer->Length() );
+            aValue.Format( KFormat, iWapBearer );
+            break;
+            }
+        case EApWapGatewayAddress:
+            {
+            // make it large enough to hold
+            aValue.SetLength( iWapGatewayAddress->Length() );
+            aValue.Format( KFormat, iWapGatewayAddress );
+            break;
+            }
+        case EApIapName:
+            {
+            // make it large enough to hold
+            aValue.SetLength( iIapName->Length() );
+            aValue.Format( KFormat, iIapName );
+            break;
+            }
+        case EApIapServiceType:
+            {
+            // make it large enough to hold
+            aValue.SetLength( iIapServiceType->Length() );
+            aValue.Format( KFormat, iIapServiceType );
+            break;
+            }
+        case EApIspName:
+            {
+            // make it large enough to hold
+            aValue.SetLength( iIspName->Length() );
+            aValue.Format( KFormat, iIspName );
+            break;
+            }
+        case EApIspDescription:
+            {
+            // make it large enough to hold
+            aValue.SetLength( iIspDescription->Length() );
+            aValue.Format( KFormat, iIspDescription );
+            break;
+            }
+        case EApIspDefaultTelNumber:
+            {
+            // make it large enough to hold
+            aValue.SetLength( iIspDefaultTelNumber->Length() );
+            aValue.Format( KFormat, iIspDefaultTelNumber );
+            break;
+            }
+        case EApIspLoginName:
+            {
+            // make it large enough to hold
+            aValue.SetLength( iUserName->Length() );
+            aValue.Format( KFormat, iUserName );
+            break;
+            }
+        case EApIspLoginPass:
+            {
+            // make it large enough to hold
+            aValue.SetLength( iPassword->Length() );
+            aValue.Format( KFormat, iPassword );
+            break;
+            }
+        case EApIspIfName:
+        case EApGprsIfName:
+        case EApCdmaIfName:
+            {
+            // make it large enough to hold
+            aValue.SetLength( iIspIfName->Length() );
+            aValue.Format( KFormat, iIspIfName );
+            break;
+            }
+        case EApIspIfParams:
+        case EApGprsIfParams:
+        case EApCdmaIfParams:
+            {
+            // make it large enough to hold
+            aValue.SetLength( iIspIfParams->Length() );
+            aValue.Format( KFormat, iIspIfParams );
+            break;
+            }
+        case EApIspIfNetworks:
+        case EApGprsIfNetworks:
+        case EApCdmaIfNetworks:
+        case EApWlanIfNetworks:
+            {
+            // make it large enough to hold
+            aValue.SetLength( iIspIfNetworks->Length() );
+            aValue.Format( KFormat, iIspIfNetworks );
+            break;
+            }
+        case EApIspIfAuthName:
+        case EApGprsIfAuthName:
+        case EApCdmaIfAuthName:
+        case EApWlanIfAuthName:
+            {
+            // make it large enough to hold
+            aValue.SetLength( iIspIfAuthName->Length() );
+            aValue.Format( KFormat, iIspIfAuthName );
+            break;
+            }
+        case EApIspIfAuthPass:
+        case EApGprsIfAuthPassword:
+        case EApCdmaIfAuthPassword:
+        case EApWlanIfAuthPassword:
+            {
+            // make it large enough to hold
+            aValue.SetLength( iIspIfAuthPass->Length() );
+            aValue.Format( KFormat, iIspIfAuthPass );
+            break;
+            }
+        case EApIspIPAddr:
+        case EApGprsIpAddr:
+        case EApCdmaIpAddr:
+        case EApWlanIpAddr:
+            {
+            // make it large enough to hold
+            aValue.SetLength( iIspIPAddr->Length() );
+            aValue.Format( KFormat, iIspIPAddr );
+            break;
+            }
+        case EApIspIPNetMask:
+        case EApGprsIpNetMask:
+        case EApCdmaIpNetMask:
+        case EApWlanIpNetMask:
+            {
+            // make it large enough to hold
+            aValue.SetLength( iIspIPNetMask->Length() );
+            aValue.Format( KFormat, iIspIPNetMask );
+            break;
+            }
+        case EApIspIPGateway:
+        case EApGprsIpGateway:
+        case EApCdmaIpGateway:
+        case EApWlanIpGateway:
+            {
+            // make it large enough to hold
+            aValue.SetLength( iIspGateway->Length() );
+            aValue.Format( KFormat, iIspGateway );
+            break;
+            }
+        case EApIspIPNameServer1:
+        case EApGprsIPNameServer1:
+        case EApCdmaIPNameServer1:
+        case EApWlanIPNameServer1:
+            {
+            // make it large enough to hold
+            aValue.SetLength( iPrimaryDNS->Length() );
+            aValue.Format( KFormat, iPrimaryDNS );
+            break;
+            }
+        case EApIspIPNameServer2:
+        case EApGprsIPNameServer2:
+        case EApCdmaIPNameServer2:
+        case EApWlanIPNameServer2:
+            {
+            // make it large enough to hold
+            aValue.SetLength( iSecondaryDNS->Length() );
+            aValue.Format( KFormat, iSecondaryDNS );
+            break;
+            }
+        case EApGprsPdpAddress:
+            {
+            // make it large enough to hold
+            aValue.SetLength( iGprsPdpAddress->Length() );
+            aValue.Format( KFormat, iGprsPdpAddress );
+            break;
+            }
+        case EApProxyProtocolName:
+            {
+            aValue.SetLength( iApProxyProtocolName->Length() );
+            aValue.Format( KFormat, iApProxyProtocolName );
+            break;
+            }
+        case EApProxyLoginName:
+            {
+            aValue.SetLength( iWapProxyLoginName->Length() );
+            aValue.Format( KFormat, iWapProxyLoginName );
+            break;
+            }
+        case EApProxyLoginPass:
+            {
+            aValue.SetLength( iWapProxyLoginPass->Length() );
+            aValue.Format( KFormat, iWapProxyLoginPass );
+            break;
+            }
+        case EApNetworkName:
+            {
+            aValue.SetLength( iNetworkName->Length() );
+            aValue.Format( KFormat, iNetworkName );
+            break;
+            }
+        case EApIP6NameServer1:
+            {
+            // make it large enough to hold
+            if ( iExt->iIsIpv6Supported )
+                {
+                aValue.SetLength( iExt->iIpv6PrimaryDNS->Length() );
+                aValue.Format( KFormat, iExt->iIpv6PrimaryDNS );
+                }
+            else
+                {
+                User::Leave( KErrNotSupported );
+                }
+            break;
+            }
+        case EApIP6NameServer2:
+            {
+            // make it large enough to hold
+            if ( iExt->iIsIpv6Supported )
+                {
+                aValue.SetLength( iExt->iIpv6SecondaryDNS->Length() );
+                aValue.Format( KFormat, iExt->iIpv6SecondaryDNS );
+                }
+            else
+                {
+                User::Leave( KErrNotSupported );
+                }
+            break;
+            }
+        // CDMA2000
+        case EApCdmaIwfName:
+            {
+            // LeaveIfUnsupported prevents getting here with no CDMA support.
+            __ASSERT_ALWAYS \
+                ( iExt->iCdmaData, ApCommons::Panic( ESanityCheckFailed ) );
+            aValue.SetLength( iExt->iCdmaData->iIwfName->Length() );
+            aValue.Format( KFormat, iExt->iCdmaData->iIwfName );
+            break;
+            }
+        case EApCdmaPdpAddress:
+            {
+            // LeaveIfUnsupported prevents getting here with no CDMA support.
+            __ASSERT_ALWAYS \
+                ( iExt->iCdmaData, ApCommons::Panic( ESanityCheckFailed ) );
+            aValue.SetLength( iExt->iCdmaData->iPdpAddress->Length() );
+            aValue.Format( KFormat, iExt->iCdmaData->iPdpAddress );
+            break;
+            }
+        case EApCdmaHomeAgentAddress:
+            {
+            // LeaveIfUnsupported prevents getting here with no CDMA support.
+            __ASSERT_ALWAYS \
+                ( iExt->iCdmaData, ApCommons::Panic( ESanityCheckFailed ) );
+            aValue.SetLength( iExt->iCdmaData->iHomeAgentAddress->Length() );
+            aValue.Format( KFormat, iExt->iCdmaData->iHomeAgentAddress );
+            break;
+            }
+        case EApCdmaMipPrimaryHomeAgent:
+            {
+            // LeaveIfUnsupported prevents getting here with no CDMA support.
+            __ASSERT_ALWAYS \
+                ( iExt->iCdmaData, ApCommons::Panic( ESanityCheckFailed ) );
+            aValue.SetLength
+                ( iExt->iCdmaData->iMipPrimaryHomeAgent->Length() );
+            aValue.Format
+                ( KFormat, iExt->iCdmaData->iMipPrimaryHomeAgent );
+            break;
+            }
+        case EApCdmaMipSecondaryHomeAgent:
+            {
+            // LeaveIfUnsupported prevents getting here with no CDMA support.
+            __ASSERT_ALWAYS \
+                ( iExt->iCdmaData, ApCommons::Panic( ESanityCheckFailed ) );
+            aValue.SetLength
+                ( iExt->iCdmaData->iMipSecondaryHomeAgent->Length() );
+            aValue.Format
+                ( KFormat, iExt->iCdmaData->iMipSecondaryHomeAgent );
+            break;
+            }
+        // END CDMA2000
+        // WLAN
+        case EApWlanNetworkName:
+            {
+            // LeaveIfUnsupported prevents getting here with no WLAN support.
+            __ASSERT_ALWAYS \
+                ( iExt->iWlanData, ApCommons::Panic( ESanityCheckFailed ) );
+            aValue.SetLength
+                ( iExt->iWlanData->iWlanNetworkName->Length() );
+            aValue.Format
+                ( KFormat, iExt->iWlanData->iWlanNetworkName );
+            break;
+            }
+        // END WLAN
+        // LANModem
+        case EApLanBearerName:
+            {
+            aValue.SetLength( iExt->iLanBearerModemName->Length() );
+            aValue.Format( KFormat, iExt->iLanBearerModemName );            
+            break;
+            }
+        // END LANModem
+        case EApIapBearerType:
+            {
+            aValue.SetLength( iExt->iIapBearerType->Length() );
+            aValue.Format( KFormat, iExt->iIapBearerType );            
+            break;
+            }
+        default:
+            {
+            __ASSERT_DEBUG( EFalse, ApCommons::Panic( EInvalidColumn ) );
+            User::Leave( KErrInvalidColumn );
+            }
+        }
+
+    CLOG( ( EApItem, 1, _L( "<- CApAccessPointItem::ReadTextL" ) ) );
+    }
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::ReadLongTextL
+// ---------------------------------------------------------
+//
+EXPORT_C HBufC* CApAccessPointItem::ReadLongTextL( const TApMember aColumn )
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApAccessPointItem::ReadLongTextL" ) ) );
+
+    LeaveIfUnsupportedL( aColumn );
+
+    HBufC* retval = NULL;
+    switch ( aColumn )
+        {
+        case EApWapStartPage:
+            {
+            retval = iStartingPage;
+            break;
+            }
+        case EApIspLoginScript:
+            {
+            retval = iLoginScript;
+            break;
+            }
+        case EApGprsAccessPointName:
+            {
+            retval = iGprsAccessPointName;
+            break;
+            }
+        case EApProxyServerAddress:
+            {
+            retval = iApProxyServerAddress;
+            break;
+            }
+        case EApProxyExceptions:
+            {
+            retval = iApProxyExceptions;
+            break;
+            }
+        default:
+            {
+            __ASSERT_DEBUG( EFalse, ApCommons::Panic( EInvalidColumn ) );
+            User::Leave( KErrInvalidColumn );
+            break;
+            }
+        }
+
+    CLOG( ( EApItem, 1, _L( "<- CApAccessPointItem::ReadLongTextL" ) ) );
+    return retval;
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::ReadConstLongTextL
+// ---------------------------------------------------------
+//
+EXPORT_C const HBufC* CApAccessPointItem::ReadConstLongTextL
+                                            ( const TApMember aColumn )
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApAccessPointItem::ReadConstLongTextL" ) ) );
+
+    LeaveIfUnsupportedL( aColumn );
+
+    HBufC* retval = NULL;
+    switch ( aColumn )
+        {
+        case EApWapStartPage:
+            {
+            retval = iStartingPage;
+            break;
+            }
+        case EApIspLoginScript:
+            {
+            retval = iLoginScript;
+            break;
+            }
+        case EApGprsAccessPointName:
+            {
+            retval = iGprsAccessPointName;
+            break;
+            }
+        case EApProxyServerAddress:
+            {
+            retval = iApProxyServerAddress;
+            break;
+            }
+        case EApProxyExceptions:
+            {
+            retval = iApProxyExceptions;
+            break;
+            }
+        default:
+            {
+            __ASSERT_DEBUG( EFalse, ApCommons::Panic( EInvalidColumn ) );
+            User::Leave( KErrInvalidColumn );
+            break;
+            }
+        }
+    
+    CLOG( ( EApItem, 1, _L( "<- CApAccessPointItem::ReadConstLongTextL" ) ) );
+    return retval;
+    }
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::ReadTextLengthL
+// ---------------------------------------------------------
+//
+EXPORT_C TUint32 CApAccessPointItem::ReadTextLengthL( const TApMember aColumn )
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApAccessPointItem::ReadTextLengthL" ) ) );
+
+    LeaveIfUnsupportedL( aColumn );
+
+    TUint32 l( 0 );
+    switch ( aColumn )
+        { // 16 first
+        case EApWapAccessPointName:
+            {
+            l = iWapAccessPointName->Length();
+            break;
+            }
+        case EApWapStartPage:
+            {
+            l = iStartingPage->Length();
+            break;
+            }
+        case EApWapCurrentBearer:
+            {
+            l = iWapBearer->Length();
+            break;
+            }
+        case EApWapGatewayAddress:
+            {
+            l = iWapGatewayAddress->Length();
+            break;
+            }
+        case EApIapName:
+            {
+            l = iIapName->Length();
+            break;
+            }
+        case EApIapServiceType:
+            {
+            l = iIapServiceType->Length();
+            break;
+            }
+        case EApIspName:
+            {
+            l = iIspName->Length();
+            break;
+            }
+        case EApIspDescription:
+            {
+            l = iIspDescription->Length();
+            break;
+            }
+        case EApIspDefaultTelNumber:
+            {
+            l = iIspDefaultTelNumber->Length();
+            break;
+            }
+        case EApIspLoginName:
+            {
+            l = iUserName->Length();
+            break;
+            }
+        case EApIspLoginPass:
+            {
+            l = iPassword->Length();
+            break;
+            }
+        case EApIspIfName:
+        case EApGprsIfName:
+        case EApCdmaIfName:
+            {
+            l = iIspIfName->Length();
+            break;
+            }
+        case EApIspIfParams:
+        case EApGprsIfParams:
+        case EApCdmaIfParams:
+            {
+            l = iIspIfParams->Length();
+            break;
+            }
+        case EApIspIfNetworks:
+        case EApGprsIfNetworks:
+        case EApCdmaIfNetworks:
+        case EApWlanIfNetworks:
+            {
+            l = iIspIfNetworks->Length();
+            break;
+            }
+        case EApIspIfAuthName:
+        case EApGprsIfAuthName:
+        case EApCdmaIfAuthName:
+        case EApWlanIfAuthName:
+            {
+            l = iIspIfAuthName->Length();
+            break;
+            }
+        case EApIspIfAuthPass:
+        case EApGprsIfAuthPassword:
+        case EApCdmaIfAuthPassword:
+        case EApWlanIfAuthPassword:
+            {
+            l = iIspIfAuthPass->Length();
+            break;
+            }
+        case EApIspIPAddr:
+        case EApGprsIpAddr:
+        case EApCdmaIpAddr:
+        case EApWlanIpAddr:
+            {
+            l = iIspIPAddr->Length();
+            break;
+            }
+        case EApIspIPNetMask:
+        case EApGprsIpNetMask:
+        case EApCdmaIpNetMask:
+        case EApWlanIpNetMask:
+            {
+            l = iIspIPNetMask->Length();
+            break;
+            }
+        case EApIspIPGateway:
+        case EApGprsIpGateway:
+        case EApCdmaIpGateway:
+        case EApWlanIpGateway:
+            {
+            l = iIspGateway->Length();
+            break;
+            }
+        case EApIspIPNameServer1:
+        case EApGprsIPNameServer1:
+        case EApCdmaIPNameServer1:
+        case EApWlanIPNameServer1:
+            {
+            l = iPrimaryDNS->Length();
+            break;
+            }
+        case EApIspIPNameServer2:
+        case EApGprsIPNameServer2:
+        case EApCdmaIPNameServer2:
+        case EApWlanIPNameServer2:
+            {
+            l = iSecondaryDNS->Length();
+            break;
+            }
+        case EApGprsAccessPointName:
+            {
+            l = iGprsAccessPointName->Length();
+            break;
+            }
+        case EApGprsPdpAddress:
+            {
+            l = iGprsPdpAddress->Length();
+            break;
+            }
+        // 8 bit ones
+        case EApIspIfCallbackInfo:
+            {
+            l = iIspIfCallbackInfo->Length();
+            break;
+            }
+        case EApIspInitString:
+            {
+            l = iIspInitString->Length();
+            break;
+            }
+        // Login script
+        case EApIspLoginScript:
+            {
+            l = iLoginScript->Length();
+            break;
+            }
+        case EApProxyProtocolName:
+            {
+            l = iApProxyProtocolName->Length();
+            break;
+            }
+        case EApProxyServerAddress:
+            {
+            l = iApProxyServerAddress->Length();
+            break;
+            }
+        case EApProxyExceptions:
+            {
+            l = iApProxyExceptions->Length();
+            break;
+            }
+        case EApProxyLoginName:
+            {
+            l = iWapProxyLoginName->Length();
+            break;
+            }
+        case EApProxyLoginPass:
+            {
+            l = iWapProxyLoginPass->Length();
+            break;
+            }
+        case EApNetworkName:
+            {
+            l = iNetworkName->Length();
+            break;
+            }
+        case EApIP6NameServer1:
+            {
+            if ( iExt->iIsIpv6Supported )
+                {
+                l = iExt->iIpv6PrimaryDNS->Length();
+                }
+            else
+                {
+                User::Leave( KErrNotSupported );
+                }
+            break;
+            }
+        case EApIP6NameServer2:
+            {
+            if ( iExt->iIsIpv6Supported )
+                {
+                l = iExt->iIpv6SecondaryDNS->Length();
+                }
+            else
+                {
+                User::Leave( KErrNotSupported );
+                }
+            break;
+            }
+        // CDMA2000
+        case EApCdmaIwfName:
+            {
+            // LeaveIfUnsupported prevents getting here with no CDMA support.
+            __ASSERT_ALWAYS \
+                ( iExt->iCdmaData, ApCommons::Panic( ESanityCheckFailed ) );
+            l = iExt->iCdmaData->iIwfName->Length();
+            break;
+            }
+        case EApCdmaPdpAddress:
+            {
+            // LeaveIfUnsupported prevents getting here with no CDMA support.
+            __ASSERT_ALWAYS \
+                ( iExt->iCdmaData, ApCommons::Panic( ESanityCheckFailed ) );
+            l = iExt->iCdmaData->iPdpAddress->Length();
+            break;
+            }
+        case EApCdmaHomeAgentAddress:
+            {
+            // LeaveIfUnsupported prevents getting here with no CDMA support.
+            __ASSERT_ALWAYS \
+                ( iExt->iCdmaData, ApCommons::Panic( ESanityCheckFailed ) );
+            l = iExt->iCdmaData->iHomeAgentAddress->Length();
+            break;
+            }
+        case EApCdmaMipPrimaryHomeAgent:
+            {
+            // LeaveIfUnsupported prevents getting here with no CDMA support.
+            __ASSERT_ALWAYS \
+                ( iExt->iCdmaData, ApCommons::Panic( ESanityCheckFailed ) );
+            l = iExt->iCdmaData->iMipPrimaryHomeAgent->Length();
+            break;
+            }
+        case EApCdmaMipSecondaryHomeAgent:
+            {
+            // LeaveIfUnsupported prevents getting here with no CDMA support.
+            __ASSERT_ALWAYS \
+                ( iExt->iCdmaData, ApCommons::Panic( ESanityCheckFailed ) );
+            l = iExt->iCdmaData->iMipSecondaryHomeAgent->Length();
+            break;
+            }
+        // END CDMA2000
+        // WLAN
+        case EApWlanNetworkName:
+            {
+            // LeaveIfUnsupported prevents getting here with no WLAN support.
+            __ASSERT_ALWAYS \
+                ( iExt->iWlanData, ApCommons::Panic( ESanityCheckFailed ) );
+            l = iExt->iWlanData->iWlanNetworkName->Length();
+            break;
+            }
+        // END WLAN
+        default:
+            {
+            __ASSERT_DEBUG( EFalse, ApCommons::Panic( EInvalidColumn ) );
+            User::Leave( KErrInvalidColumn );
+            }
+        }
+
+    CLOG( ( EApItem, 1, _L( "<- CApAccessPointItem::ReadTextLengthL" ) ) );
+    return l;
+    }
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::ReadUint
+// ---------------------------------------------------------
+//
+EXPORT_C TInt CApAccessPointItem::ReadUint( const TApMember aColumn,
+                                           TUint32& aValue )
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApAccessPointItem::ReadUint" ) ) );
+
+    TInt retval ( KErrNone );
+
+    if( !IsSupported( aColumn ) )
+        {
+        retval = KErrNotSupported;
+        }
+    else
+        {
+        switch ( aColumn )
+            {
+            case EApWapAccessPointID:
+                {
+                aValue = iWapUid;
+                break;
+                }
+            case EApWapIap:
+                {
+                aValue = iWapIap;
+                break;
+                }
+            case EApIapServiceId:
+                {
+                aValue = iIapServiceId;
+                break;
+                }
+            case EApIapChargecard:
+                {
+                aValue = iIapChargeCardId;
+                break;
+                }
+            case EApIspIspType:
+            case EApCdmaApType:
+                {
+                aValue = iIspType;
+                break;
+                }
+            case EApIspAuthRetries:
+            case EApGprsIfAuthRetries:
+            case EApCdmaIfAuthRetries:
+            case EApWlanIfAuthRetries:
+                {
+                aValue = iIspIfAuthRetries;
+                break;
+                }
+            case EApIspIfCallbackType:
+                {
+                aValue = iCallBackTypeIsServerNum;
+                break;
+                }
+            case EApIspCallBackTimeOut:
+                {
+                aValue = iIspCallbackTimeOut;
+                break;
+                }
+            case EApIspBearerName:
+                {
+                aValue = iIspBearerName;
+                break;
+                }
+            case EApIspBearerSpeed:
+                {
+                aValue = iMaxConnSpeed;
+                break;
+                }
+            case EApIspBearerCE:
+                {
+                aValue = iIspBearerCE;
+                break;
+                }
+            case EApIspBearerCallTypeIsdn:
+                {
+                aValue = iBearerCallTypeIsdn;
+                break;
+                }
+            case EApIspBearerType:
+                {
+                aValue = iIspBearerType;
+                break;
+                }
+            case EApIspChannelCoding:
+                {
+                aValue = iIspChannelCoding;
+                break;
+                }
+            case EApIspAIUR:
+                {
+                aValue = iIspAIUR;
+                break;
+                }
+            case EApIspRequestedTimeSlots:
+                {
+                aValue = iIspRequestedTimeSlots;
+                break;
+                }
+            case EApIspMaximumTimeSlots:
+                {
+                aValue = iIspMaximumTimeSlots;
+                break;
+                }
+            case EApGprsPdpType:
+                {
+                aValue = iGprsPdpType;
+                break;
+                }
+            case EApGprsReqPrecedence:
+                {
+                aValue = iGprsReqPrecedence;
+                break;
+                }
+            case EApGprsReqDelay:
+                {
+                aValue = iGprsReqDelay;
+                break;
+                }
+            case EApGprsReqReliability:
+                {
+                aValue = iGprsReqReliability;
+                break;
+                }
+            case EApGprsReqPeakThroughput:
+                {
+                aValue = iGprsReqPeakThroughput;
+                break;
+                }
+            case EApGprsReqMeanPeakThroughput:
+                {
+                aValue = iGprsReqMeanPeakThroughput;
+                break;
+                }
+            case EApGprsMinPrecedence:
+                {
+                aValue = iGprsMinPrecedence;
+                break;
+                }
+            case EApGprsMinDelay:
+                {
+                aValue = iGprsMinDelay;
+                break;
+                }
+            case EApGprsMinReliability:
+                {
+                aValue = iGprsMinReliability;
+                break;
+                }
+            case EApGprsMinPeakThroughput:
+                {
+                aValue = iGprsMinPeakThroughput;
+                break;
+                }
+            case EApGprsMinMeanThroughput:
+                {
+                aValue = iGprsMinMeanThroughput;
+                break;
+                }
+            case EApWapWspOption:
+                {
+                aValue = iIsConnectionTypeContinuous;
+                break;
+                }
+            case EApProxyPortNumber:
+                {
+                aValue = iApProxyPortNumber;
+                break;
+                }
+            case EApWapProxyPort:
+                {
+                aValue = iWapProxyPort;
+                break;
+                }
+            case EApNetworkID:
+                {
+                aValue = iNetworkId;
+                break;
+                }
+            case EApIapBearerService:
+                {
+                aValue = iApIapBearerService;
+                break;
+                }
+
+    //* DEPRECATED !!!
+            case EApWapIsp:
+            case EApWapChargecard:
+            case EApWapIspType:
+                {
+                __ASSERT_DEBUG( EFalse, \
+                                User::Panic( kApSet, KErrNotSupported ) );
+                retval = KErrNotSupported;
+                break;
+                }
+    //* Deprecated ends
+            // CDMA2000
+            case EApCdmaServiceOption:
+                {
+                // IsSupported() check prevents getting here with no CDMA supp.
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                aValue = iExt->iCdmaData->iServiceOption;
+                break;
+                }
+            case EApCdmaPdpType:
+                {
+                // IsSupported() check prevents getting here with no CDMA supp.
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                aValue = iExt->iCdmaData->iPdpType;
+                break;
+                }
+            case EApCdmaReqFwdPriority:
+                {
+                // IsSupported() check prevents getting here with no CDMA supp.
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                aValue = iExt->iCdmaData->iReqFwdPriority;
+                break;
+                }
+            case EApCdmaReqRevPriority:
+                {
+                // IsSupported() check prevents getting here with no CDMA supp.
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                aValue = iExt->iCdmaData->iReqRevPriority;
+                break;
+                }
+            case EApCdmaReqFwdBitrate:
+                {
+                // IsSupported() check prevents getting here with no CDMA supp.
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                aValue = iExt->iCdmaData->iReqFwdBitrate;
+                break;
+                }
+            case EApCdmaReqRevBitrate:
+                {
+                // IsSupported() check prevents getting here with no CDMA supp.
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                aValue = iExt->iCdmaData->iReqRevBitrate;
+                break;
+                }
+            case EApCdmaReqFwdLoss:
+                {
+                // IsSupported() check prevents getting here with no CDMA supp.
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                aValue = iExt->iCdmaData->iReqFwdLoss;
+                break;
+                }
+            case EApCdmaReqRevLoss:
+                {
+                // IsSupported() check prevents getting here with no CDMA supp.
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                aValue = iExt->iCdmaData->iReqRevLoss;
+                break;
+                }
+            case EApCdmaReqFwdMaxDelay:
+                {
+                // IsSupported() check prevents getting here with no CDMA supp.
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                aValue = iExt->iCdmaData->iReqFwdMaxDelay;
+                break;
+                }
+            case EApCdmaReqRevMaxDelay:
+                {
+                // IsSupported() check prevents getting here with no CDMA supp.
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                aValue = iExt->iCdmaData->iReqRevMaxDelay;
+                break;
+                }
+            case EApCdmaMinFwdBitrate:
+                {
+                // IsSupported() check prevents getting here with no CDMA supp.
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                aValue = iExt->iCdmaData->iMinFwdBitrate;
+                break;
+                }
+            case EApCdmaMinRevBitrate:
+                {
+                // IsSupported() check prevents getting here with no CDMA supp.
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                aValue = iExt->iCdmaData->iMinRevBitrate;
+                break;
+                }
+            case EApCdmaAccptFwdLoss:
+                {
+                // IsSupported() check prevents getting here with no CDMA supp.
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                aValue = iExt->iCdmaData->iAccptFwdLoss;
+                break;
+                }
+            case EApCdmaAccptRevLoss:
+                {
+                // IsSupported() check prevents getting here with no CDMA supp.
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                aValue = iExt->iCdmaData->iAccptRevLoss;
+                break;
+                }
+            case EApCdmaAccptFwdMaxDelay:
+                {
+                // IsSupported() check prevents getting here with no CDMA supp.
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                aValue = iExt->iCdmaData->iAccptFwdMaxDelay;
+                break;
+                }
+            case EApCdmaAccptRevMaxDelay:
+                {
+                // IsSupported() check prevents getting here with no CDMA supp.
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                aValue = iExt->iCdmaData->iAccptRevMaxDelay;
+                break;
+                }
+            case EApCdmaQosWarningTimeout:
+                {
+                // IsSupported() check prevents getting here with no CDMA supp.
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                aValue = iExt->iCdmaData->iQosWarningTimeout;
+                break;
+                }
+            case EApCdmaRlpMode:
+                {
+                // IsSupported() check prevents getting here with no CDMA supp.
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                aValue = iExt->iCdmaData->iRlpMode;
+                break;
+                }
+            case EApCdmaMipTimeout:
+                {
+                // IsSupported() check prevents getting here with no CDMA supp.
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                aValue = iExt->iCdmaData->iMipTimeout;
+                break;
+                }
+            case EApCdmaNaiType:
+                {
+                // IsSupported() check prevents getting here with no CDMA supp.
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                aValue = iExt->iCdmaData->iNaiType;
+                break;
+                }
+            case EApCdmaSimpleIpAuthAlgorithm:
+                {
+                // IsSupported() check prevents getting here with no CDMA supp.
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                aValue = iExt->iCdmaData->iSimpleIpAuthAlgorithm;
+                break;
+                }
+            case EApCdmaSimpleIpPapSsHandle:
+                {
+                // IsSupported() check prevents getting here with no CDMA supp.
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                aValue = iExt->iCdmaData->iSimpleIpPapSsHandle;
+                break;
+                }
+            case EApCdmaSimpleIpChapSsHandle:
+                {
+                // IsSupported() check prevents getting here with no CDMA supp.
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                aValue = iExt->iCdmaData->iSimpleIpChapSsHandle;
+                break;
+                }
+            case EApCdmaMipTBit:
+                {
+                // IsSupported() check prevents getting here with no CDMA supp.
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                aValue = iExt->iCdmaData->iMipTBit;
+                break;
+                }
+            case EApCdmaMipMnAaaAuthAlgorithm:
+                {
+                // IsSupported() check prevents getting here with no CDMA supp.
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                aValue = iExt->iCdmaData->iMipMnAaaAuthAlgorithm;
+                break;
+                }
+            case EApCdmaMipMnAaaSpi:
+                {
+                // IsSupported() check prevents getting here with no CDMA supp.
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                aValue = iExt->iCdmaData->iMipMnAaaSpi;
+                break;
+                }
+            case EApCdmaMipMnAaaSsHandle:
+                {
+                // IsSupported() check prevents getting here with no CDMA supp.
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                aValue = iExt->iCdmaData->iMipMnAaaSsHandle;
+                break;
+                }
+            case EApCdmaMipMnHaAuthAlgorithm:
+                {
+                // IsSupported() check prevents getting here with no CDMA supp.
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                aValue = iExt->iCdmaData->iMipMnHaAuthAlgorithm;
+                break;
+                }
+            case EApCdmaMipMnHaSpi:
+                {
+                // IsSupported() check prevents getting here with no CDMA supp.
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                aValue = iExt->iCdmaData->iMipMnHaSpi;
+                break;
+                }
+            case EApCdmaMipMnHaSsHandle:
+                {
+                // IsSupported() check prevents getting here with no CDMA supp.
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                aValue = iExt->iCdmaData->iMipMnHaSsHandle;
+                break;
+                }
+            // END CDMA2000
+            // WLAN
+            case EApWlanNetworkMode:
+                {
+                // IsSupported() check prevents getting here with no WLAN supp.
+                __ASSERT_ALWAYS ( iExt->iWlanData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                aValue = iExt->iWlanData->iWlanNetworkMode;
+                break;
+                }
+            case EApWlanSecurityMode:
+                {
+                // IsSupported() check prevents getting here with no WLAN supp.
+                __ASSERT_ALWAYS ( iExt->iWlanData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                aValue = iExt->iWlanData->iWlanSecurityMode;
+                break;
+                }
+            case EApWlanSettingsId:
+                {
+                // IsSupported() check prevents getting here with no WLAN supp.
+                __ASSERT_ALWAYS ( iExt->iWlanData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                aValue = iExt->iWlanData->iWlanId;
+                break;
+                }
+            case EApWlanChannelId:
+                {
+                // IsSupported() check prevents getting here with no WLAN supp.
+                __ASSERT_ALWAYS ( iExt->iWlanData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                aValue = iExt->iWlanData->iChannelId;
+                break;                
+                }
+            // END WLAN
+            // LANModem
+            case EApIapBearerID:
+                {
+                aValue = iExt->iIapBearerID;
+                break;
+                }
+            // END LANModem            
+            default :
+                {
+                __ASSERT_DEBUG( EFalse, ApCommons::Panic( EInvalidColumn ) );
+                retval = KErrInvalidColumn;
+                break;
+                }
+            }
+        }
+
+    CLOG( ( EApItem, 1, _L( "<- CApAccessPointItem::ReadUint" ) ) );
+    return retval;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::ReadBool
+// ---------------------------------------------------------
+//
+EXPORT_C TInt CApAccessPointItem::ReadBool( const TApMember aColumn,
+                                           TBool& aValue )
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApAccessPointItem::ReadBool" ) ) );
+    
+    TInt retval ( KErrNone );
+
+    if( !IsSupported( aColumn ) )
+        {
+        retval = KErrNotSupported;
+        }
+    else
+        {
+        switch ( aColumn )
+            {
+            case EApWapSecurity:
+                {
+                aValue = iIsWTLSSecurityOn;
+                break;
+                }
+            case EApIspDialResolution:
+                {
+                aValue = iIspDialResolution;
+                break;
+                }
+            case EApIspUseLoginScript:
+                {
+                aValue = iUseLoginScript;
+                break;
+                }
+            case EApIspPromptForLogin:
+                {
+                aValue = iPromptPassword;
+                break;
+                }
+            case EApIspDisplayPCT:
+                {
+                aValue = iDisplayTerminalWindow;
+                break;
+                }
+            case EApIspIfPromptForAuth:
+            case EApGprsIfPromptForAuth:
+            case EApCdmaIfPromptForAuth:
+            case EApWlanIfPromptForAuth:
+                {
+                aValue = iIspIfPromptForAuth;
+                break;
+                }
+            case EApIspIfCallbackEnabled:
+                {
+                aValue = iUseCallBack;
+                break;
+                }
+            case EApIspIPAddrFromServer:
+            case EApGprsIpAddrFromServer:
+            case EApCdmaIpAddrFromServer:
+            case EApWlanIpAddrFromServer:
+                {
+                aValue = iIspIPAddrFromServer;
+                break;
+                }
+            case EApIspIPDnsAddrFromServer:
+            case EApGprsIpDnsAddrFromServer:
+            case EApCdmaIpDnsAddrFromServer:
+            case EApWlanIpDnsAddrFromServer:
+                {
+                aValue = iGetDNSIPFromServer;
+                break;
+                }
+            case EApIspEnableIpHeaderComp:
+            case EApGprsHeaderCompression:
+            case EApCdmaHeaderCompression:
+                {
+                aValue = iEnablePPPCompression;
+                break;
+                }
+            case EApIspEnableLCPExtensions:
+            case EApGprsEnableLCPExtensions:
+            case EApCdmaEnableLCPExtensions:
+                {
+                aValue = iIspEnableLCPExtensions;
+                break;
+                }
+            case EApIspDisablePlainTextAuth:
+            case EApGprsDisablePlainTextAuth:
+            case EApCdmaDisablePlainTextAuth:
+                {
+                aValue = iIsPasswordAuthenticationSecure;
+                break;
+                }
+            case EApIspEnableSWCompression:
+            case EApGprsDataCompression:
+            case EApCdmaDataCompression:
+                {
+                aValue = iIspEnableSwCompression;
+                break;
+                }
+// NOTE! This has been deprecated.
+            case EApIspBearerCallTypeIsdn:
+                {
+                aValue = ( iBearerCallTypeIsdn != ECallTypeAnalogue );
+                break;
+                }
+            case EApGprsUseAnonymAccess:
+            case EApCdmaAnonymousAccess:
+                {
+                aValue = iGprsUseAnonymAccess;
+                break;
+                }
+            case EApIsReadOnly:
+                {
+                aValue = iIsReadOnly;
+                break;
+                }
+            case EApProxyUseProxy:
+                {
+                aValue = iApProxyUseProxy;
+                break;
+                }
+            case EApHasProxySettings:
+                {
+                aValue = iApHasProxySettings;
+                break;
+                }
+            case EApIP6DNSAddrFromServer:
+                {
+                if ( iExt->iIsIpv6Supported )
+                    {
+                    aValue = iExt->iIpv6GetDNSIPFromServer;
+                    }
+                else
+                    {
+                    retval = KErrNotSupported;
+                    }
+                break;
+                }
+            // CDMA2000
+            case EApCdmaMip:
+                {
+                // IsSupported() check prevents getting here with no CDMA supp.
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                aValue = iExt->iCdmaData->iMip;
+                break;
+                }
+            // END CDMA2000
+            // WLAN
+            case EApWlanScanSSID:
+                {
+                // IsSupported() check prevents getting here with no WLAN supp.
+                __ASSERT_ALWAYS ( iExt->iWlanData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );                
+                aValue = iExt->iWlanData->iScanSSID;
+                break;
+                }
+            // END WLAN
+            default :
+                {
+                __ASSERT_DEBUG( EFalse, ApCommons::Panic( EInvalidColumn ) );
+                return KErrInvalidColumn;
+                }
+            }
+        }
+
+    CLOG( ( EApItem, 1, _L( "<- CApAccessPointItem::ReadBool" ) ) );
+    return retval;
+    }
+
+
+// Update
+// ---------------------------------------------------------
+// CApAccessPointItem::WriteTextL
+// ---------------------------------------------------------
+//
+EXPORT_C TInt CApAccessPointItem::WriteTextL( const TApMember aColumn,
+                                            const TDesC8& aValue )
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApAccessPointItem::WriteTextL8" ) ) );
+
+    LeaveIfUnsupportedL( aColumn );
+
+    TInt ret = KErrNone;
+
+    switch ( aColumn )
+        {
+        case EApIspIfCallbackInfo:
+            {
+            ReAllocL( iIspIfCallbackInfo, aValue );
+            break;
+            }
+        case EApIspInitString:
+            {
+            ReAllocL( iIspInitString, aValue );
+            break;
+            }
+        default:
+            {
+            __ASSERT_DEBUG( EFalse, ApCommons::Panic( EInvalidColumn ) );
+            ret = KErrInvalidColumn;
+            break;
+            }
+        }
+
+    CLOG( ( EApItem, 1, _L( "<- CApAccessPointItem::WriteTextL8" ) ) );
+    return ret;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::WriteTextL
+// ---------------------------------------------------------
+//
+EXPORT_C TInt CApAccessPointItem::WriteTextL( const TApMember aColumn,
+                                            const TDesC16& aValue )
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApAccessPointItem::WriteTextL" ) ) );
+
+    LeaveIfUnsupportedL( aColumn );
+
+    TInt retval( KErrNone );
+    switch ( aColumn )
+    {
+        case EApWapAccessPointName:
+            {
+            HBufC* sgd = aValue.AllocLC();
+            sgd->Des().Trim();
+            ReAllocL( iWapAccessPointName, *sgd);
+            CleanupStack::PopAndDestroy( sgd ); // sgd
+            break;
+            }
+        case EApWapCurrentBearer:
+            {
+            ReAllocL( iWapBearer, aValue);
+            break;
+            }
+        case EApWapGatewayAddress:
+            {
+            // this is an IP Address, must remove leading 0s from
+            // the numbers
+            HBufC *tmp = GetCleanIpAddressLC( aValue );
+            ReAllocL( iWapGatewayAddress, *tmp );
+            CleanupStack::PopAndDestroy( tmp );
+            break;
+            }
+        case EApIapName:
+            {
+            ReAllocL( iIapName, aValue);
+            break;
+            }
+        case EApIspName:
+            {
+            ReAllocL( iIspName, aValue);
+            break;
+            }
+        case EApIapServiceType:
+            {
+            ReAllocL( iIapServiceType, aValue);
+            //Check if ISP/GPRS has changed , update lfname &/or lfnetworks.!
+            if ( ( *iIapServiceType == TPtrC(DIAL_IN_ISP) ) ||
+                 ( *iIapServiceType == TPtrC(DIAL_OUT_ISP) ) )
+                {
+                WriteTextL( EApIspIfName, KDefIspIfName );
+                }
+            else if ( ( *iIapServiceType == TPtrC(OUTGOING_GPRS) ) ||
+                     ( *iIapServiceType == TPtrC(INCOMING_GPRS) ) )
+                {
+                WriteTextL( EApIspIfName, KDefGprsIfName );
+                }
+            else
+                { // unknown ISP type, do not know what to write, 
+                // simply ignore it....
+                }
+            break;
+            }
+        case EApIspDescription:
+            {
+            ReAllocL( iIspDescription, aValue);
+            break;
+            }
+        case EApIspDefaultTelNumber:
+            {
+            ReAllocL( iIspDefaultTelNumber, aValue);
+            break;
+            }
+        case EApIspLoginName:
+            {
+            ReAllocL( iUserName, aValue);
+            ReAllocL( iIspIfAuthName, aValue);
+            break;
+            }
+        case EApIspLoginPass:
+            {
+            ReAllocL( iPassword, aValue);
+            ReAllocL( iIspIfAuthPass, aValue);
+            break;
+            }
+        case EApIspIfName:
+        case EApGprsIfName:
+        case EApCdmaIfName:
+            {
+            ReAllocL( iIspIfName, aValue);
+            break;
+            }
+        case EApIspIfParams:
+        case EApGprsIfParams:
+        case EApCdmaIfParams:
+            {
+            ReAllocL( iIspIfParams, aValue);
+            break;
+            }
+        case EApIspIfNetworks:
+        case EApGprsIfNetworks:
+        case EApCdmaIfNetworks:
+        case EApWlanIfNetworks:
+            {
+            ReAllocL( iIspIfNetworks, aValue); // CAN NOT BE CHANGED
+            break;
+            }
+        case EApIspIfAuthName:
+        case EApGprsIfAuthName:
+        case EApCdmaIfAuthName:
+        case EApWlanIfAuthName:
+            {
+            ReAllocL( iIspIfAuthName, aValue);
+            ReAllocL( iUserName, aValue);
+            break;
+            }
+        case EApIspIfAuthPass:
+        case EApGprsIfAuthPassword:
+        case EApCdmaIfAuthPassword:
+        case EApWlanIfAuthPassword:
+            {
+            ReAllocL( iIspIfAuthPass, aValue);
+            ReAllocL( iPassword, aValue);
+            break;
+            }
+        case EApIspIPAddr:
+        case EApGprsIpAddr:
+        case EApCdmaIpAddr:
+        case EApWlanIpAddr:
+            {
+            ReAllocL( iIspIPAddr, aValue);
+            SetIpFromServer();
+            break;
+            }
+        case EApIspIPNetMask:
+        case EApGprsIpNetMask:
+        case EApCdmaIpNetMask:
+        case EApWlanIpNetMask:
+            {
+            ReAllocL( iIspIPNetMask, aValue);
+            break;
+            }
+        case EApIspIPGateway:
+        case EApGprsIpGateway:
+        case EApCdmaIpGateway:
+        case EApWlanIpGateway:
+            {
+            ReAllocL( iIspGateway, aValue);
+            break;
+            }
+        case EApIspIPNameServer1:
+        case EApGprsIPNameServer1:
+        case EApCdmaIPNameServer1:
+        case EApWlanIPNameServer1:
+            {
+            ReAllocL( iPrimaryDNS, aValue);
+            SetDnsIpFromServer();
+            break;
+            }
+        case EApIspIPNameServer2:
+        case EApGprsIPNameServer2:
+        case EApCdmaIPNameServer2:
+        case EApWlanIPNameServer2:
+            {
+            ReAllocL( iSecondaryDNS, aValue);
+            SetDnsIpFromServer();
+            break;
+            }
+        case EApGprsPdpAddress:
+            {
+            ReAllocL( iGprsPdpAddress, aValue );
+            break;
+            }
+        case EApProxyProtocolName:
+            {
+            ReAllocL( iApProxyProtocolName, aValue );
+            SetProxyFlag();
+            break;
+            }
+        case EApNetworkName:
+            {
+            ReAllocL( iNetworkName, aValue );
+            break;
+            }
+        case EApProxyLoginName:
+            {
+            ReAllocL( iWapProxyLoginName, aValue );
+            break;
+            }
+        case EApProxyLoginPass:
+            {
+            ReAllocL( iWapProxyLoginPass, aValue );
+            break;
+            }
+        case EApIP6NameServer1:
+            {
+            if ( iExt->iIsIpv6Supported )
+                {
+                ReAllocL( iExt->iIpv6PrimaryDNS, aValue);
+                SetDns6IpFromServer();
+                }
+            else
+                {
+                User::Leave( KErrNotSupported );
+                }
+            break;
+            }
+        case EApIP6NameServer2:
+            {
+            if ( iExt->iIsIpv6Supported )
+                {
+                ReAllocL( iExt->iIpv6SecondaryDNS, aValue);
+                SetDns6IpFromServer();
+                }
+            else
+                {
+                User::Leave( KErrNotSupported );
+                }
+            break;
+            }
+        // CDMA2000
+        case EApCdmaIwfName:
+            {
+            __ASSERT_ALWAYS \
+                ( iExt->iCdmaData, ApCommons::Panic( ESanityCheckFailed ) );
+            ReAllocL( iExt->iCdmaData->iIwfName, aValue );
+            break;
+            }
+        case EApCdmaPdpAddress:
+            {
+            __ASSERT_ALWAYS \
+                ( iExt->iCdmaData, ApCommons::Panic( ESanityCheckFailed ) );
+            ReAllocL( iExt->iCdmaData->iPdpAddress, aValue );
+            break;
+            }
+        case EApCdmaHomeAgentAddress:
+            {
+            __ASSERT_ALWAYS \
+                ( iExt->iCdmaData, ApCommons::Panic( ESanityCheckFailed ) );
+            ReAllocL( iExt->iCdmaData->iHomeAgentAddress, aValue );
+            break;
+            }
+        case EApCdmaMipPrimaryHomeAgent:
+            {
+            __ASSERT_ALWAYS \
+                ( iExt->iCdmaData, ApCommons::Panic( ESanityCheckFailed ) );
+            ReAllocL( iExt->iCdmaData->iMipPrimaryHomeAgent, aValue );
+            break;
+            }
+        case EApCdmaMipSecondaryHomeAgent:
+            {
+            __ASSERT_ALWAYS \
+                ( iExt->iCdmaData, ApCommons::Panic( ESanityCheckFailed ) );
+            ReAllocL( iExt->iCdmaData->iMipSecondaryHomeAgent, aValue );
+            break;
+            }
+        // END CDMA2000
+        // WLAN
+        case EApWlanNetworkName:
+            {
+            __ASSERT_ALWAYS \
+                ( iExt->iWlanData, ApCommons::Panic( ESanityCheckFailed ) );
+            ReAllocL( iExt->iWlanData->iWlanNetworkName, aValue );
+            break;
+            }
+        // END WLAN
+        // LANModem
+        case EApLanBearerName:
+            {
+            ReAllocL( iExt->iLanBearerModemName, aValue );
+            break;
+            }
+        // END LANModem
+        case EApIapBearerType:
+            {
+            ReAllocL( iExt->iIapBearerType, aValue );
+            break;
+            }        
+        default:
+            {
+            __ASSERT_DEBUG( EFalse, ApCommons::Panic( EInvalidColumn ) );
+            retval = KErrInvalidColumn;
+            break;
+            }
+        }
+
+    CLOG( ( EApItem, 1, _L( "<- CApAccessPointItem::WriteTextL" ) ) );
+    return retval;
+    }
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::WriteLongTextL
+// ---------------------------------------------------------
+//
+EXPORT_C TInt CApAccessPointItem::WriteLongTextL( const TApMember aColumn,
+                                                const TDesC& aValue )
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApAccessPointItem::WriteLongTextL" ) ) );
+
+    LeaveIfUnsupportedL( aColumn );
+
+    TInt retval( KErrNone );
+    switch ( aColumn )
+        {
+        case EApGprsAccessPointName:
+            {
+            ReAllocL( iGprsAccessPointName, aValue);
+            break;
+            }
+        case EApWapStartPage:
+            {
+            ReAllocL( iStartingPage, aValue);
+            break;
+            }
+        case EApIspLoginScript:
+            {
+            ReAllocL( iLoginScript, aValue );
+            break;
+            }
+        case EApProxyServerAddress:
+            {
+            ReAllocL( iApProxyServerAddress, aValue );
+            SetProxyFlag();
+            break;
+            }
+        case EApProxyExceptions:
+            {
+            ReAllocL( iApProxyExceptions, aValue );
+            SetProxyFlag();
+            break;
+            }
+        default:
+            {
+            // unknown column...
+            __ASSERT_DEBUG( EFalse, ApCommons::Panic( EInvalidColumn ) );
+            retval = KErrInvalidColumn;
+            break;
+            }
+        }
+
+    CLOG( ( EApItem, 1, _L( "<- CApAccessPointItem::WriteLongTextL" ) ) );
+    return retval;
+    }
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::WriteUint
+// ---------------------------------------------------------
+//
+EXPORT_C TInt CApAccessPointItem::WriteUint( const TApMember aColumn,
+                                            const TUint32& aValue )
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApAccessPointItem::WriteUint" ) ) );
+
+    /*****************************************************
+    *   Series 60 Customer / ETel
+    *   Series 60  ETel API
+    *****************************************************/
+    TInt retval( KErrNone );
+
+    if ( !IsSupported( aColumn ) )
+        {
+        retval = KErrNotSupported;
+        }
+    else
+        {
+        switch ( aColumn )
+            {
+            case EApWapAccessPointID:
+                {
+                iWapUid = aValue;
+                break;
+                }
+            case EApWapIap:
+                {
+                iWapIap = aValue;
+                break;
+                }
+            case EApIapServiceId:
+                {
+                iIapServiceId = aValue;
+                break;
+                }
+            case EApIapChargecard:
+                {
+                iIapChargeCardId = aValue;
+                break;
+                }
+            case EApIspIspType:
+            case EApCdmaApType:
+                {
+                iIspType = (TCommsDbIspType)aValue;
+                break;
+                }
+            case EApIspAuthRetries:
+            case EApGprsIfAuthRetries:
+            case EApCdmaIfAuthRetries:
+            case EApWlanIfAuthRetries:
+                {
+                iIspIfAuthRetries = aValue;
+                break;
+                }
+            case EApIspIfCallbackType:
+                {
+                iCallBackTypeIsServerNum = TCallbackAction( aValue );
+                break;
+                }
+            case EApIspCallBackTimeOut:
+                {
+                iIspCallbackTimeOut = aValue;
+                break;
+                }
+            case EApIspBearerName:
+                {
+                iIspBearerName = 
+                    RMobileCall::TMobileCallDataServiceCaps( aValue );
+                break;
+                }
+            case EApIspBearerSpeed:
+                {
+                iMaxConnSpeed = TApCallSpeed( aValue );
+                break;
+                }
+            case EApIspBearerCE:
+                {
+                //iIspBearerCE = RMobileCall::TMobileCallDataQoSCaps( aValue );
+                iIspBearerCE = RMobileCall::TMobileCallDataQoS( aValue );
+                break;
+                }
+            case EApIspBearerCallTypeIsdn:
+                {
+                /*
+                // DO NOT CHECK VALIDITY HERE AS COMMSDB STORES IT DIFFERENTLY
+                // AFTER READED FROM THE DB, IT WILL BE CHECKED!!!!!
+                // ensure it is in the valid range
+                TUint32 tempint = aValue;
+                tempint = Min( tempint, TUint32(ECallTypeISDNv120) );
+                tempint = Max( tempint, TUint32(ECallTypeAnalogue) );
+                */
+                iBearerCallTypeIsdn = (TApCallType)aValue;
+                break;
+                }
+            case EApIspBearerType:
+                {
+                iIspBearerType = aValue;
+                break;
+                }
+            case EApIspChannelCoding:
+                {
+                iIspChannelCoding = aValue;
+                break;
+                }
+            case EApIspAIUR:
+                {
+                iIspAIUR = aValue;
+                break;
+                }
+            case EApIspRequestedTimeSlots:
+                {
+                iIspRequestedTimeSlots = aValue;
+                break;
+                }
+            case EApIspMaximumTimeSlots:
+                {
+                iIspMaximumTimeSlots = aValue;
+                break;
+                }
+
+            case EApGprsPdpType:
+                {
+                iGprsPdpType = aValue;
+                TRAP_IGNORE( SetIfNetworksL() );
+                break;
+                }
+            case EApGprsReqPrecedence:
+                {
+                iGprsReqPrecedence = aValue;
+                break;
+                }
+            case EApGprsReqDelay:
+                {
+                iGprsReqDelay = aValue;
+                break;
+                }
+            case EApGprsReqReliability:
+                {
+                iGprsReqReliability = aValue;
+                break;
+                }
+            case EApGprsReqPeakThroughput:
+                {
+                iGprsReqPeakThroughput = aValue;
+                break;
+                }
+            case EApGprsReqMeanPeakThroughput:
+                {
+                iGprsReqMeanPeakThroughput = aValue;
+                break;
+                }
+            case EApGprsMinPrecedence:
+                {
+                iGprsMinPrecedence = aValue;
+                break;
+                }
+            case EApGprsMinDelay:
+                {
+                iGprsMinDelay = aValue;
+                break;
+                }
+            case EApGprsMinReliability:
+                {
+                iGprsMinReliability = aValue;
+                break;
+                }
+            case EApGprsMinPeakThroughput:
+                {
+                iGprsMinPeakThroughput = aValue;
+                break;
+                }
+            case EApGprsMinMeanThroughput:
+                {
+                iGprsMinMeanThroughput = aValue;
+                break;
+                }
+            case EApWapWspOption:
+                {
+                iIsConnectionTypeContinuous = aValue;
+                break;
+                }
+            case EApProxyPortNumber:
+                {
+                iApProxyPortNumber = aValue;
+                SetProxyFlag();
+                break;
+                }
+            case EApWapProxyPort:
+                {
+                iWapProxyPort = aValue;
+                break;
+                }
+            case EApNetworkID:
+                { // now it is supported to set it from the outside...
+                iNetworkId = aValue;
+                break;
+                }
+            case EApIapBearerService:
+                {
+                iApIapBearerService = aValue;
+                break;
+                }
+
+    // DEPRECATED !!!
+            case EApWapIsp:
+            case EApWapChargecard:
+            case EApWapIspType:
+                {
+                __ASSERT_DEBUG( EFalse, \
+                                User::Panic( kApSet, KErrNotSupported ) );
+                retval = KErrNotSupported;
+                break;
+                }
+            // CDMA2000
+            case EApCdmaServiceOption:
+                {
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                iExt->iCdmaData->iServiceOption = aValue;
+                break;
+                }
+            case EApCdmaPdpType:
+                {
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                iExt->iCdmaData->iPdpType = aValue;
+                TRAP_IGNORE( SetIfNetworksL() );
+                break;
+                }
+            case EApCdmaReqFwdPriority:
+                {
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                iExt->iCdmaData->iReqFwdPriority = aValue;
+                break;
+                }
+            case EApCdmaReqRevPriority:
+                {
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                iExt->iCdmaData->iReqRevPriority = aValue;
+                break;
+                }
+            case EApCdmaReqFwdBitrate:
+                {
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                iExt->iCdmaData->iReqFwdBitrate = aValue;
+                break;
+                }
+            case EApCdmaReqRevBitrate:
+                {
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                iExt->iCdmaData->iReqRevBitrate = aValue;
+                break;
+                }
+            case EApCdmaReqFwdLoss:
+                {
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                iExt->iCdmaData->iReqFwdLoss = aValue;
+                break;
+                }
+            case EApCdmaReqRevLoss:
+                {
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                iExt->iCdmaData->iReqRevLoss = aValue;
+                break;
+                }
+            case EApCdmaReqFwdMaxDelay:
+                {
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                iExt->iCdmaData->iReqFwdMaxDelay = aValue;
+                break;
+                }
+            case EApCdmaReqRevMaxDelay:
+                {
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                iExt->iCdmaData->iReqRevMaxDelay = aValue;
+                break;
+                }
+            case EApCdmaMinFwdBitrate:
+                {
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                iExt->iCdmaData->iMinFwdBitrate = aValue;
+                break;
+                }
+            case EApCdmaMinRevBitrate:
+                {
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                iExt->iCdmaData->iMinRevBitrate = aValue;
+                break;
+                }
+            case EApCdmaAccptFwdLoss:
+                {
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                iExt->iCdmaData->iAccptFwdLoss = aValue;
+                break;
+                }
+            case EApCdmaAccptRevLoss:
+                {
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                iExt->iCdmaData->iAccptRevLoss = aValue;
+                break;
+                }
+            case EApCdmaAccptFwdMaxDelay:
+                {
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                iExt->iCdmaData->iAccptFwdMaxDelay = aValue;
+                break;
+                }
+            case EApCdmaAccptRevMaxDelay:
+                {
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                iExt->iCdmaData->iAccptRevMaxDelay = aValue;
+                break;
+                }
+            case EApCdmaQosWarningTimeout:
+                {
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                iExt->iCdmaData->iQosWarningTimeout = aValue;
+                break;
+                }
+            case EApCdmaRlpMode:
+                {
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                iExt->iCdmaData->iRlpMode = aValue;
+                break;
+                }
+            case EApCdmaMipTimeout:
+                {
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                iExt->iCdmaData->iMipTimeout = aValue;
+                break;
+                }
+            case EApCdmaNaiType:
+                {
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                iExt->iCdmaData->iNaiType = aValue;
+                break;
+                }
+            case EApCdmaSimpleIpAuthAlgorithm:
+                {
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                iExt->iCdmaData->iSimpleIpAuthAlgorithm = aValue;
+                break;
+                }
+            case EApCdmaSimpleIpPapSsHandle:
+                {
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                iExt->iCdmaData->iSimpleIpPapSsHandle = aValue;
+                break;
+                }
+            case EApCdmaSimpleIpChapSsHandle:
+                {
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                iExt->iCdmaData->iSimpleIpChapSsHandle = aValue;
+                break;
+                }
+            case EApCdmaMipTBit:
+                {
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                iExt->iCdmaData->iMipTBit = aValue;
+                break;
+                }
+            case EApCdmaMipMnAaaAuthAlgorithm:
+                {
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                iExt->iCdmaData->iMipMnAaaAuthAlgorithm = aValue;
+                break;
+                }
+            case EApCdmaMipMnAaaSpi:
+                {
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                iExt->iCdmaData->iMipMnAaaSpi = aValue;
+                break;
+                }
+            case EApCdmaMipMnAaaSsHandle:
+                {
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                iExt->iCdmaData->iMipMnAaaSsHandle = aValue;
+                break;
+                }
+            case EApCdmaMipMnHaAuthAlgorithm:
+                {
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                iExt->iCdmaData->iMipMnHaAuthAlgorithm = aValue;
+                break;
+                }
+            case EApCdmaMipMnHaSpi:
+                {
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                iExt->iCdmaData->iMipMnHaSpi = aValue;
+                break;
+                }
+            case EApCdmaMipMnHaSsHandle:
+                {
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                iExt->iCdmaData->iMipMnHaSsHandle = aValue;
+                break;
+                }
+            // END CDMA2000
+            // WLAN
+            case EApWlanNetworkMode:
+                {
+                __ASSERT_ALWAYS ( iExt->iWlanData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                iExt->iWlanData->iWlanNetworkMode = aValue;
+                break;
+                }
+            case EApWlanSecurityMode:
+                {
+                __ASSERT_ALWAYS ( iExt->iWlanData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                iExt->iWlanData->iWlanSecurityMode = aValue;
+                break;
+                }
+            case EApWlanSettingsId:
+                {
+                __ASSERT_ALWAYS ( iExt->iWlanData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                iExt->iWlanData->iWlanId = aValue;
+                break;
+                }
+            case EApWlanChannelId:
+                {
+                __ASSERT_ALWAYS ( iExt->iWlanData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                iExt->iWlanData->iChannelId = aValue;
+                break;
+                }
+            // END WLAN
+            // LANModem
+            case EApIapBearerID:
+                {
+                iExt->iIapBearerID = aValue;
+                break;
+                }
+            // END LANModem
+            default :
+                {
+                __ASSERT_DEBUG( EFalse, ApCommons::Panic( EInvalidColumn ) );
+                retval = KErrInvalidColumn;
+                }
+            }
+        }
+
+    CLOG( ( EApItem, 1, _L( "<- CApAccessPointItem::WriteUint" ) ) );
+    return retval;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::WriteBool
+// ---------------------------------------------------------
+//
+EXPORT_C TInt CApAccessPointItem::WriteBool( const TApMember aColumn,
+                                            const TBool& aValue )
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApAccessPointItem::WriteBool" ) ) );
+
+    TInt retval( KErrNone );
+
+    if ( !IsSupported( aColumn ) )
+        {
+        retval = KErrNotSupported;
+        }
+    else
+        {
+        switch ( aColumn )
+            {
+            case EApWapSecurity:
+                {
+                iIsWTLSSecurityOn = aValue;
+                break;
+                }
+            case EApIspDialResolution:
+                {
+                iIspDialResolution = aValue;
+                break;
+                }
+            case EApIspUseLoginScript:
+                {
+                iUseLoginScript = aValue;
+                break;
+                }
+            case EApIspPromptForLogin:
+                {
+                iPromptPassword = aValue;
+                iIspIfPromptForAuth = aValue;
+                break;
+                }
+            case EApIspDisplayPCT:
+                {
+                iDisplayTerminalWindow = EFalse;
+                break;
+                }
+            case EApIspIfPromptForAuth:
+            case EApGprsIfPromptForAuth:
+            case EApCdmaIfPromptForAuth:
+            case EApWlanIfPromptForAuth:
+                {
+                iIspIfPromptForAuth = aValue;
+                iPromptPassword = aValue;
+                break;
+                }
+            case EApIspIfCallbackEnabled:
+                {
+                iUseCallBack = aValue;
+                break;
+                }
+            case EApIspIPAddrFromServer:
+            case EApGprsIpAddrFromServer:
+            case EApCdmaIpAddrFromServer:
+            case EApWlanIpAddrFromServer:
+                {
+                iIspIPAddrFromServer = aValue;
+                break;
+                }
+            case EApIspIPDnsAddrFromServer:
+            case EApGprsIpDnsAddrFromServer:
+            case EApCdmaIpDnsAddrFromServer:
+            case EApWlanIpDnsAddrFromServer:
+                {
+                iGetDNSIPFromServer = aValue;
+                break;
+                }
+            case EApIspEnableIpHeaderComp:
+            case EApGprsHeaderCompression:
+            case EApCdmaHeaderCompression:
+                {
+                iEnablePPPCompression = aValue;
+                break;
+                }
+            case EApIspEnableLCPExtensions:
+            case EApGprsEnableLCPExtensions:
+            case EApCdmaEnableLCPExtensions:
+                {
+                iIspEnableLCPExtensions = aValue;
+                break;
+                }
+            case EApIspDisablePlainTextAuth:
+            case EApGprsDisablePlainTextAuth:
+            case EApCdmaDisablePlainTextAuth:
+                {
+                iIsPasswordAuthenticationSecure = aValue;
+                break;
+                }
+            case EApIspEnableSWCompression:
+            case EApGprsDataCompression:
+            case EApCdmaDataCompression:
+                {
+                iIspEnableSwCompression = aValue;
+                break;
+                }
+    // NOTE! This is deprecated.
+            case EApIspBearerCallTypeIsdn:
+                {
+                iBearerCallTypeIsdn = 
+                    TApCallType( aValue != ECallTypeAnalogue );
+                break;
+                }
+            case EApGprsUseAnonymAccess:
+            case EApCdmaAnonymousAccess:
+                {
+                iGprsUseAnonymAccess = aValue;
+                break;
+                }
+            case EApIsReadOnly:
+                {
+                __ASSERT_DEBUG( EFalse, ApCommons::Panic( EInvalidColumn ) );
+                retval = KErrInvalidColumn;
+                break;
+                }
+            case EApProxyUseProxy:
+                {
+                iApProxyUseProxy = aValue;
+                SetProxyFlag();
+                break;
+                }
+            case EApHasProxySettings:
+                {
+                __ASSERT_DEBUG( EFalse, ApCommons::Panic( EInvalidColumn ) );
+                retval = KErrNotSupported;
+                break;
+                }
+            case EApIP6DNSAddrFromServer:
+                {
+                if ( iExt->iIsIpv6Supported )
+                    {
+                    iExt->iIpv6GetDNSIPFromServer = aValue;
+                    }
+                else
+                    {
+                    retval = KErrNotSupported;
+                    }
+                break;
+                }
+            // CDMA2000
+            case EApCdmaMip:
+                {
+                __ASSERT_ALWAYS ( iExt->iCdmaData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                iExt->iCdmaData->iMip = aValue;
+                break;
+                }
+            // END CDMA2000
+            // WLAN
+            case EApWlanScanSSID:
+                {
+                __ASSERT_ALWAYS ( iExt->iWlanData, \
+                    ApCommons::Panic( ESanityCheckFailed ) );
+                iExt->iWlanData->iScanSSID = aValue;
+                break;
+                }
+            // END WLAN
+            default :
+                {
+                __ASSERT_DEBUG( EFalse, ApCommons::Panic( EInvalidColumn ) );
+                retval = KErrInvalidColumn;
+                break;
+                }
+            }
+        }
+
+    CLOG( ( EApItem, 1, _L( "<- CApAccessPointItem::WriteBool" ) ) );
+    return retval;
+    }
+
+
+
+// Query
+// COMMON
+
+// ---------------------------------------------------------
+// CApAccessPointItem::Uid
+// ---------------------------------------------------------
+//
+EXPORT_C TUint32 CApAccessPointItem::WapUid() const
+    {
+    CLOG( ( EApItem, 0, _L( "<-> CApAccessPointItem::WapUid" ) ) );
+
+    return iWapUid;
+    }
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::ConnectionName
+// ---------------------------------------------------------
+//
+EXPORT_C const TDesC& CApAccessPointItem::ConnectionName() const
+    {
+    CLOG( ( EApItem, 0, _L( "<-> CApAccessPointItem::ConnectionName" ) ) );
+
+    return *iWapAccessPointName;
+    }
+
+
+// WAP-spec.
+// ---------------------------------------------------------
+// CApAccessPointItem::WapBearer
+// ---------------------------------------------------------
+//
+EXPORT_C const TDesC& CApAccessPointItem::WapBearer() const
+    {
+    CLOG( ( EApItem, 0, _L( "<-> CApAccessPointItem::WapBearer" ) ) );
+
+    return *iWapBearer;
+    }
+
+
+
+// WAP-spec.
+// ---------------------------------------------------------
+// CApAccessPointItem::BearerTypeL
+// ---------------------------------------------------------
+//
+EXPORT_C TApBearerType CApAccessPointItem::BearerTypeL()
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApAccessPointItem::BearerTypeL" ) ) );
+
+    TApBearerType retval( EApBearerTypeAllBearers );
+    // decide which bearer, read bearer spec. data.
+    if ( *iWapBearer == TPtrC(WAP_IP_BEARER) )
+        {
+        if ( ( *iIapServiceType == TPtrC(DIAL_OUT_ISP) ) ||
+             ( *iIapServiceType == TPtrC(DIAL_IN_ISP) ) )
+            {
+            // now check speed
+            if ( iIspBearerType == EBearerTypeCSD )
+                {
+                retval = EApBearerTypeCSD;
+                }
+            else
+                {
+                if ( iIspBearerType == EBearerTypeHSCSD )
+                    {
+                    retval = EApBearerTypeHSCSD;
+                    }
+                else
+                    {
+                    User::Leave( KErrInvalidBearer );
+                    }
+                }
+            }
+        else
+            {
+            if ( ( *iIapServiceType == TPtrC(OUTGOING_WCDMA) ) ||
+                 ( *iIapServiceType == TPtrC(INCOMING_WCDMA) ) )
+                {
+                retval = EApBearerTypeGPRS;
+                }
+            else
+                { // some other bearer, currently only VPN...
+                if ( iExt->iIsVpnAp )
+                    {
+                    // in this case get REAL IAP's bearer type...
+                    retval = iExt->iVPnRealIapBearerType;
+                    }
+                else
+                    {
+                    if ( iExt->iWlanData )
+                        {                        
+                        // check if it is WLAN...
+                        if ( *iIapServiceType == TPtrC(LAN_SERVICE) )
+                            {
+                            if ( IsWlan() )
+                                {
+                                retval = EApBearerTypeWLAN;
+                                }
+                            else
+                                {
+                                if ( *iExt->iLanBearerModemName == 
+                                        KModemBearerLANModem )
+                                    {// IPPass Through
+                                    retval = EApBearerTypeLANModem;
+                                    }
+                                else
+                                    {                                
+                        #ifdef __TEST_LAN_BEARER
+                                    retval = EApBearerTypeLAN;
+                        #else
+                                    User::Leave( KErrInvalidBearer );
+                        #endif // __TEST_LAN_BEARER
+                                    }
+                                }
+                            }
+                        else
+                            { // otherwise, it is not known, invalid...
+                            User::Leave( KErrInvalidBearer );
+                            }
+                        }
+                    else
+                        {
+                        if ( *iExt->iLanBearerModemName == 
+                                KModemBearerLANModem )
+                            {// IPPass Through
+                            retval = EApBearerTypeLANModem;
+                            }
+                        else
+                            {
+                    #ifdef __TEST_LAN_BEARER
+                        retval = EApBearerTypeLAN;
+                    #else // __TEST_LAN_BEARER
+                        User::Leave( KErrInvalidBearer );
+                    #endif // __TEST_LAN_BEARER
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    else
+        {
+        User::Leave( KErrInvalidBearer );
+        }
+    if ( retval == EApBearerTypeAllBearers )
+        {
+        User::Leave( KErrInvalidBearer );
+        }
+
+    CLOG( ( EApItem, 1, _L( "<- CApAccessPointItem::BearerTypeL" ) ) );
+    return retval;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::SetBearerTypeL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApAccessPointItem::SetBearerTypeL( TApBearerType aBearer )
+    {    
+    CLOG( ( EApItem, 0, _L( "-> CApAccessPointItem::SetBearerTypeL" ) ) );
+
+    HBufC* tmpbuf;
+    switch ( aBearer )
+        {
+        case EApBearerTypeGPRS: // GPRS
+            {
+            tmpbuf = TPtrC(WAP_IP_BEARER).AllocL();
+            delete iWapBearer;
+            iWapBearer = tmpbuf;
+            WriteTextL( EApIapServiceType, TPtrC(OUTGOING_WCDMA) );
+            WriteTextL( EApIspIfParams, KDefGprsIfParams );      // required !
+            if( iExt->iWlanData )
+                {
+                iExt->iWlanData->iIsWlan = EFalse;
+                }
+            WriteTextL( EApLanBearerName, KModemBearerGPRS );
+            break;
+            }
+        case EApBearerTypeCSD: // CSD
+            {
+            if ( !iExt->iIsAppCsdSupport )
+                {
+                User::Leave( KErrNotSupported );
+                }
+
+            tmpbuf = TPtrC(WAP_IP_BEARER).AllocL();
+            delete iWapBearer;
+            iWapBearer = tmpbuf;
+            WriteTextL( EApIapServiceType, TPtrC(DIAL_OUT_ISP) );            
+            WriteTextL( EApIspIfParams, KEmpty );             // required !
+            iIspBearerType = EBearerTypeCSD;            
+            if( iExt->iWlanData )
+                {
+                iExt->iWlanData->iIsWlan = EFalse;
+                }            
+            WriteTextL( EApLanBearerName, KModemBearerCSD );
+            LimitIp6DNSL();            
+            break;
+            }
+        case EApBearerTypeHSCSD: // HSCSD
+            {
+            if ( !iExt->iIsAppHscsdSupport || !iExt->iIsAppCsdSupport )
+                {
+                User::Leave( KErrNotSupported );
+                }
+            tmpbuf = TPtrC(WAP_IP_BEARER).AllocL();
+            delete iWapBearer;
+            iWapBearer = tmpbuf;
+            WriteTextL( EApIapServiceType, TPtrC(DIAL_OUT_ISP) );
+            WriteTextL( EApIspIfParams, KEmpty );             // required !
+            iIspBearerType = EBearerTypeHSCSD;
+            if( iExt->iWlanData )
+                {
+                iExt->iWlanData->iIsWlan = EFalse;
+                }            
+            WriteTextL( EApLanBearerName, KModemBearerCSD );
+            LimitIp6DNSL();
+            break;
+            }
+        case EApBearerTypeWLAN: // WLAN
+            { 
+            if( !iExt->iWlanData )
+                {
+                User::Leave( KErrNotSupported );
+                }
+            tmpbuf = TPtrC(WAP_IP_BEARER).AllocL();
+            delete iWapBearer;
+            iWapBearer = tmpbuf;
+            WriteTextL( EApIapServiceType, TPtrC(LAN_SERVICE) );
+            WriteTextL( EApIspIfParams, KEmpty );             // required !
+            WriteTextL( EApLanBearerName, KModemBearerWLAN );
+            iExt->iWlanData->iIsWlan = ETrue;
+            break;
+            }
+#ifdef __TEST_LAN_BEARER
+        case EApBearerTypeLAN: // LAN
+            { 
+            tmpbuf = TPtrC(WAP_IP_BEARER).AllocL();
+            delete iWapBearer;
+            iWapBearer = tmpbuf;
+            WriteTextL( EApIapServiceType, TPtrC(LAN_SERVICE) );
+            WriteTextL( EApIspIfParams, KEmpty );             // required !
+            if( iExt->iWlanData )
+                {
+                iExt->iWlanData->iIsWlan = EFalse;
+                }            
+            WriteTextL( EApLanBearerName, KModemBearerLAN );
+            break;
+            }
+#endif // __TEST_LAN_BEARER
+        case EApBearerTypeLANModem: // LAN modem
+            { 
+            tmpbuf = TPtrC(WAP_IP_BEARER).AllocL();
+            delete iWapBearer;
+            iWapBearer = tmpbuf;
+            WriteTextL( EApIapServiceType, TPtrC(LAN_SERVICE) );
+            WriteTextL( EApIspIfParams, KEmpty );             // required !
+            if( iExt->iWlanData )
+                {
+                iExt->iWlanData->iIsWlan = EFalse;
+                }            
+            WriteTextL( EApLanBearerName, KModemBearerLANModem );
+            break;
+            }            
+        default:
+            {
+            User::Leave( KErrInvalidBearer );
+            break;
+            }
+        }
+    LimitSpeedL();
+
+    SetIfNetworksL();
+
+    CLOG( ( EApItem, 1, _L( "<- CApAccessPointItem::SetBearerTypeL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::SetNamesL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApAccessPointItem::SetNamesL( const TDesC16& aValue )
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApAccessPointItem::SetNamesL" ) ) );
+
+    WriteTextL( EApWapAccessPointName, aValue );
+    WriteTextL( EApIapName, aValue );
+    WriteTextL( EApIspName, aValue );
+    WriteTextL( EApNetworkName, aValue );
+
+    CLOG( ( EApItem, 1, _L( "<- CApAccessPointItem::SetNamesL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::SanityCheckOk
+// ---------------------------------------------------------
+//
+EXPORT_C TBool CApAccessPointItem::SanityCheckOk()
+    {
+    CLOG( ( EApItem, 0, _L( "<-> CApAccessPointItem::SanityCheckOk" ) ) );
+
+    TBool retval( ETrue );
+    // as iWApIspType had been deprecated, this method also...
+    return retval;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::HasSameIspAndBearer
+// ---------------------------------------------------------
+//
+EXPORT_C TBool CApAccessPointItem::HasSameIspAndBearerL(
+                                 CApAccessPointItem& aItem )
+    {
+    CLOG( ( EApItem, 0, 
+            _L( "-> CApAccessPointItem::HasSameIspAndBearerL" ) ) );
+
+    TBool retval( EFalse );
+    TApBearerType bearer = BearerTypeL();
+    if ( bearer == aItem.BearerTypeL() )
+        {
+        switch ( bearer )
+            {
+            case EApBearerTypeCSD:
+            case EApBearerTypeHSCSD:
+                {
+                // compare phone number, username, pwd
+                // first compare phone numbers
+                if ( IsSamePhoneNumberL( aItem ) )
+                    {
+                    TBool pwd1;
+                    ReadBool( EApIspPromptForLogin, pwd1 );
+                    TBool pwd2;
+                    aItem.ReadBool( EApIspPromptForLogin, pwd2 );
+                    if ( ( !pwd1 ) && ( !pwd2 ) )
+                        {
+                        HBufC* tmpuser = HBufC::NewLC( 
+                                aItem.ReadTextLengthL( EApIspLoginName ) );
+                        HBufC* tmppwd = HBufC::NewLC( 
+                                aItem.ReadTextLengthL( EApIspLoginPass ) );
+                        TPtr16 tmpptruser( tmpuser->Des() );
+                        TPtr16 tmpptrpwd( tmppwd->Des() );
+                        aItem.ReadTextL( EApIspLoginName, tmpptruser );
+                        aItem.ReadTextL( EApIspLoginPass, tmpptrpwd );
+                        if ( ( iUserName->Compare( *tmpuser ) == 0 )
+                            && (iPassword->Compare( *tmppwd ) == 0 ) )
+                            {
+                            retval = ETrue;
+                            }
+                        // tmpuser, tmppw
+                        CleanupStack::PopAndDestroy( 2, tmpuser ); 
+                        }
+                    }
+                break;
+                }
+            case EApBearerTypeGPRS:
+                {
+                // compare APN, (username/pwd?)
+                if ( aItem.ReadConstLongTextL( EApGprsAccessPointName )
+                    ->Compare( *iGprsAccessPointName ) == 0 )
+                    {
+                    retval = ETrue;
+                    }
+                break;
+                }
+            case EApBearerTypeCDMA:
+                {
+                retval = ETrue;
+                break;
+                }
+            case EApBearerTypeWLAN:
+                {
+                if( iExt->iWlanData )
+                    {                    
+                    retval = ETrue;
+                    }
+                else
+                    {
+                    User::Leave( KErrNotSupported );
+                    }
+                break;
+                }
+#ifdef __TEST_LAN_BEARER
+            case EApBearerTypeLAN:
+                {
+                retval = ETrue;
+                break;
+                }
+#endif // __TEST_LAN_BEARER
+            case EApBearerTypeLANModem:
+                {
+                retval = ETrue;
+                break;
+                }
+            default:
+                {
+                User::Leave( KErrInvalidBearer );
+                break;
+                }
+            }
+        }
+
+    CLOG( ( EApItem, 1, 
+            _L( "<- CApAccessPointItem::HasSameIspAndBearerL" ) ) );
+    return retval;
+    }
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::IsReadOnly
+// ---------------------------------------------------------
+//
+EXPORT_C TBool CApAccessPointItem::IsReadOnly() const
+    {
+    CLOG( ( EApItem, 0, _L( "<-> CApAccessPointItem::IsReadOnly" ) ) );
+
+    return iIsReadOnly;
+    }
+
+
+
+
+// ================= OTHER EXPORTED FUNCTIONS ==============
+
+
+// =============== OTHER NON - EXPORTED FUNCTIONS ============
+// ---------------------------------------------------------
+// CApAccessPointItem::IsVpnAp
+// ---------------------------------------------------------
+//
+TBool CApAccessPointItem::IsVpnAp() const
+    {
+    return iExt->iIsVpnAp;
+    }
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::SetVpnAp
+// ---------------------------------------------------------
+//
+void CApAccessPointItem::SetVpnAp( TBool aIsVpn )
+    {
+    iExt->iIsVpnAp = aIsVpn;
+    }
+
+// ---------------------------------------------------------
+// CApAccessPointItem::Specified
+// ---------------------------------------------------------
+//
+TBool CApAccessPointItem::Specified( TApMember aMember )
+    {
+    CLOG( ( EApItem, 0, _L( "<-> CApAccessPointItem::Specified" ) ) );
+
+    return iSpecified->At( aMember );
+    }
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::Specify
+// ---------------------------------------------------------
+//
+void CApAccessPointItem::Specify( TApMember aMember, TBool aOn )
+    {
+    CLOG( ( EApItem, 0, _L( "<-> CApAccessPointItem::Specify" ) ) );
+
+    iSpecified->At( aMember ) = aOn;
+    }
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::SpecifyAll
+// ---------------------------------------------------------
+//
+void CApAccessPointItem::SpecifyAll( TBool aOn )
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApAccessPointItem::SpecifyAll" ) ) );
+
+    for( TInt i=0; i< KApMembers; i++ )
+        {
+        iSpecified->At( i ) = aOn;
+        }
+
+    CLOG( ( EApItem, 1, _L( "<- CApAccessPointItem::SpecifyAll" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::SpecifyWap
+// ---------------------------------------------------------
+//
+void CApAccessPointItem::SpecifyWap( TBool aOn )
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApAccessPointItem::SpecifyWap" ) ) );
+
+    iSpecified->At( EApWapAccessPointID ) = aOn;
+    iSpecified->At( EApWapAccessPointName ) = aOn;
+    iSpecified->At( EApWapCurrentBearer ) = aOn;
+    iSpecified->At( EApWapStartPage ) = aOn;
+    iSpecified->At( EApWapGatewayAddress ) = aOn;
+    iSpecified->At( EApWapWspOption ) = aOn;
+    iSpecified->At( EApWapSecurity ) = aOn;
+
+    CLOG( ( EApItem, 1, _L( "<- CApAccessPointItem::SpecifyWap" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::SpecifyIpBearer
+// ---------------------------------------------------------
+//
+void CApAccessPointItem::SpecifyIpBearer( TBool aOn )
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApAccessPointItem::SpecifyIpBearer" ) ) );
+
+//* DEPRECATED
+    iSpecified->At( EApWapIsp ) = EFalse;
+//* DEPRECATED
+    iSpecified->At( EApWapChargecard ) = EFalse;
+    iSpecified->At( EApWapIap ) = aOn;
+//* DEPRECATED
+    iSpecified->At( EApWapIspType ) = EFalse;
+
+    CLOG( ( EApItem, 1, _L( "<- CApAccessPointItem::SpecifyIpBearer" ) ) );
+    }
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::SpecifyIAP
+// ---------------------------------------------------------
+//
+void CApAccessPointItem::SpecifyIAP( TBool aOn )
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApAccessPointItem::SpecifyIAP" ) ) );
+
+    iSpecified->At( EApWapIap ) = aOn;
+    iSpecified->At( EApIapName ) = aOn;
+    iSpecified->At( EApIapServiceType ) = aOn;
+    iSpecified->At( EApIapServiceId ) = aOn;
+    iSpecified->At( EApIapChargecard ) = aOn;
+
+    CLOG( ( EApItem, 1, _L( "<- CApAccessPointItem::SpecifyIAP" ) ) );
+    }
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::SpecifyISP
+// ---------------------------------------------------------
+//
+void CApAccessPointItem::SpecifyISP( TBool aOn )
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApAccessPointItem::SpecifyISP" ) ) );
+
+    iSpecified->At( EApIspName ) = aOn;
+    iSpecified->At( EApIspDescription ) = aOn;
+    iSpecified->At( EApIspIspType ) = aOn;
+
+    iSpecified->At( EApIspDefaultTelNumber ) = aOn;
+    iSpecified->At( EApIspDialResolution ) = aOn;
+    iSpecified->At( EApIspUseLoginScript ) = aOn;
+    iSpecified->At( EApIspLoginScript ) = aOn;
+    iSpecified->At( EApIspPromptForLogin ) = aOn;
+    iSpecified->At( EApIspLoginName ) = aOn;
+    iSpecified->At( EApIspLoginPass ) = aOn;
+    iSpecified->At( EApIspDisplayPCT ) = aOn;
+    iSpecified->At( EApIspIfName ) = aOn;
+    iSpecified->At( EApIspIfParams ) = aOn;
+    iSpecified->At( EApIspIfNetworks ) = aOn;
+    iSpecified->At( EApIspIfPromptForAuth ) = aOn;
+    iSpecified->At( EApIspIfAuthName ) = aOn;
+    iSpecified->At( EApIspIfAuthPass ) = aOn;
+    iSpecified->At( EApIspAuthRetries ) = aOn;
+    iSpecified->At( EApIspIfCallbackEnabled ) = aOn;
+    iSpecified->At( EApIspIfCallbackType ) = aOn;
+    iSpecified->At( EApIspIfCallbackInfo ) = aOn;
+    iSpecified->At( EApIspCallBackTimeOut ) = aOn;
+    iSpecified->At( EApIspIPAddrFromServer ) = aOn;
+    iSpecified->At( EApIspIPAddr ) = aOn;
+    iSpecified->At( EApIspIPNetMask ) = aOn;
+    iSpecified->At( EApIspIPGateway ) = aOn;
+    iSpecified->At( EApIspIPDnsAddrFromServer ) = aOn;
+    iSpecified->At( EApIspIPNameServer1 ) = aOn;
+    iSpecified->At( EApIspIPNameServer2 ) = aOn;
+    iSpecified->At( EApIspEnableIpHeaderComp ) = aOn;
+    iSpecified->At( EApIspEnableLCPExtensions ) = aOn;
+    iSpecified->At( EApIspDisablePlainTextAuth ) = aOn;
+    iSpecified->At( EApIspEnableSWCompression ) = aOn;
+    iSpecified->At( EApIspBearerName ) = aOn;
+    iSpecified->At( EApIspBearerSpeed ) = aOn;
+    iSpecified->At( EApIspBearerCallTypeIsdn ) = aOn;
+    iSpecified->At( EApIspBearerCE ) = aOn;
+    iSpecified->At( EApIspInitString ) = aOn;
+    iSpecified->At( EApIspBearerType ) = aOn;
+    iSpecified->At( EApIspChannelCoding ) = aOn;
+    iSpecified->At( EApIspAIUR ) = aOn;
+    iSpecified->At( EApIspRequestedTimeSlots ) = aOn;
+    iSpecified->At( EApIspMaximumTimeSlots ) = aOn;
+
+    if ( iExt->iIsIpv6Supported )
+        {
+        iSpecified->At( EApIP6DNSAddrFromServer ) = aOn;
+        iSpecified->At( EApIP6NameServer1 ) = aOn;
+        iSpecified->At( EApIP6NameServer2 ) = aOn;
+        }
+
+    CLOG( ( EApItem, 1, _L( "<- CApAccessPointItem::SpecifyISP" ) ) );
+    }
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::SpecifyGPRS
+// ---------------------------------------------------------
+//
+void CApAccessPointItem::SpecifyGPRS( TBool aOn )
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApAccessPointItem::SpecifyGPRS" ) ) );
+
+    iSpecified->At( EApGprsAccessPointName ) = aOn;
+    iSpecified->At( EApGprsPdpType ) = aOn;
+    iSpecified->At( EApGprsPdpAddress ) = aOn;
+    iSpecified->At( EApGprsReqPrecedence ) = aOn;
+    iSpecified->At( EApGprsReqDelay ) = aOn;
+    iSpecified->At( EApGprsReqReliability ) = aOn;
+    iSpecified->At( EApGprsReqPeakThroughput ) = aOn;
+    iSpecified->At( EApGprsReqMeanPeakThroughput ) = aOn;
+    iSpecified->At( EApGprsMinPrecedence ) = aOn;
+    iSpecified->At( EApGprsMinDelay ) = aOn;
+    iSpecified->At( EApGprsMinReliability ) = aOn;
+    iSpecified->At( EApGprsMinPeakThroughput ) = aOn;
+    iSpecified->At( EApGprsMinMeanThroughput ) = aOn;
+    iSpecified->At( EApGprsUseAnonymAccess ) = aOn;
+
+    // followings are mapped to ISP... fields
+    iSpecified->At( EApGprsDataCompression ) = aOn;
+    iSpecified->At( EApGprsHeaderCompression ) = aOn;
+    iSpecified->At( EApGprsIfName ) = aOn;
+    iSpecified->At( EApGprsIfParams ) = aOn;
+    iSpecified->At( EApGprsIfNetworks ) = aOn;
+    iSpecified->At( EApGprsIfPromptForAuth ) = aOn;
+    iSpecified->At( EApGprsIfAuthName ) = aOn;
+    iSpecified->At( EApGprsIfAuthPassword ) = aOn;
+    iSpecified->At( EApGprsIfAuthRetries ) = aOn;
+    iSpecified->At( EApGprsIpNetMask ) = aOn;
+    iSpecified->At( EApGprsIpGateway ) = aOn;
+    iSpecified->At( EApGprsIpAddrFromServer ) = aOn;
+    iSpecified->At( EApGprsIpAddr ) = aOn;
+    iSpecified->At( EApGprsIpDnsAddrFromServer ) = aOn;
+    iSpecified->At( EApGprsIPNameServer1 ) = aOn;
+    iSpecified->At( EApGprsIPNameServer2 ) = aOn;
+    iSpecified->At( EApGprsEnableLCPExtensions ) = aOn;
+    iSpecified->At( EApGprsDisablePlainTextAuth ) = aOn;
+
+    CLOG( ( EApItem, 1, _L( "<- CApAccessPointItem::SpecifyGPRS" ) ) );
+    }
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::SpecifyCDMA
+// ---------------------------------------------------------
+//
+void CApAccessPointItem::SpecifyCDMA( TBool aOn )
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApAccessPointItem::SpecifyCDMA" ) ) );
+
+    __ASSERT_DEBUG( iExt->iCdmaData, ApCommons::Panic( ESanityCheckFailed ) );
+
+    iSpecified->At( EApCdmaIwfName ) = aOn;
+    iSpecified->At( EApCdmaServiceOption ) = aOn;
+    iSpecified->At( EApCdmaPdpType ) = aOn;
+    iSpecified->At( EApCdmaPdpAddress ) = aOn;
+    iSpecified->At( EApCdmaReqFwdPriority ) = aOn;
+    iSpecified->At( EApCdmaReqRevPriority ) = aOn;
+    iSpecified->At( EApCdmaReqFwdBitrate ) = aOn;
+    iSpecified->At( EApCdmaReqRevBitrate ) = aOn;
+    iSpecified->At( EApCdmaReqFwdLoss ) = aOn;
+    iSpecified->At( EApCdmaReqRevLoss ) = aOn;
+    iSpecified->At( EApCdmaReqFwdMaxDelay ) = aOn;
+    iSpecified->At( EApCdmaReqRevMaxDelay ) = aOn;
+    iSpecified->At( EApCdmaMinFwdBitrate ) = aOn;
+    iSpecified->At( EApCdmaMinRevBitrate ) = aOn;
+    iSpecified->At( EApCdmaAccptFwdLoss ) = aOn;
+    iSpecified->At( EApCdmaAccptRevLoss ) = aOn;
+    iSpecified->At( EApCdmaAccptFwdMaxDelay ) = aOn;
+    iSpecified->At( EApCdmaAccptRevMaxDelay ) = aOn;
+    // CDMA2000, mapped to ISP... fields
+    iSpecified->At( EApCdmaDataCompression ) = aOn;
+    iSpecified->At( EApCdmaHeaderCompression ) = aOn;
+    iSpecified->At( EApCdmaAnonymousAccess ) = aOn;
+    iSpecified->At( EApCdmaIfName ) = aOn;
+    iSpecified->At( EApCdmaIfParams ) = aOn;
+    iSpecified->At( EApCdmaIfNetworks ) = aOn;
+    iSpecified->At( EApCdmaIfPromptForAuth ) = aOn;
+    iSpecified->At( EApCdmaIfAuthName ) = aOn;
+    iSpecified->At( EApCdmaIfAuthPassword ) = aOn;
+    iSpecified->At( EApCdmaIfAuthRetries ) = aOn;
+    iSpecified->At( EApCdmaIpNetMask ) = aOn;
+    iSpecified->At( EApCdmaIpGateway ) = aOn;
+    iSpecified->At( EApCdmaIpAddrFromServer ) = aOn;
+    iSpecified->At( EApCdmaIpAddr ) = aOn;
+    iSpecified->At( EApCdmaIpDnsAddrFromServer ) = aOn;
+    iSpecified->At( EApCdmaIPNameServer1 ) = aOn;
+    iSpecified->At( EApCdmaIPNameServer2 ) = aOn;
+    iSpecified->At( EApCdmaEnableLCPExtensions ) = aOn;
+    iSpecified->At( EApCdmaDisablePlainTextAuth ) = aOn;
+    // CDMA2000
+    iSpecified->At( EApCdmaApType ) = aOn;
+    iSpecified->At( EApCdmaQosWarningTimeout ) = aOn;
+    iSpecified->At( EApCdmaRlpMode ) = aOn;
+    // CDMA2000 deprecated Mobile IP fields
+    iSpecified->At( EApCdmaMip ) = aOn;
+    iSpecified->At( EApCdmaHomeAgentAddress ) = aOn;
+    iSpecified->At( EApCdmaMipTimeout ) = aOn;
+    // CDMA2000 specific CDMA parameters provisioned through OTA
+    iSpecified->At( EApCdmaNaiType ) = aOn;
+    iSpecified->At( EApCdmaSimpleIpAuthAlgorithm ) = aOn;
+    iSpecified->At( EApCdmaSimpleIpPapSsHandle ) = aOn;
+    iSpecified->At( EApCdmaSimpleIpChapSsHandle ) = aOn;
+    iSpecified->At( EApCdmaMipTBit ) = aOn;
+    iSpecified->At( EApCdmaMipHomeAddress ) = aOn;
+    iSpecified->At( EApCdmaMipPrimaryHomeAgent ) = aOn;
+    iSpecified->At( EApCdmaMipSecondaryHomeAgent ) = aOn;
+    iSpecified->At( EApCdmaMipMnAaaAuthAlgorithm ) = aOn;
+    iSpecified->At( EApCdmaMipMnAaaSpi ) = aOn;
+    iSpecified->At( EApCdmaMipMnAaaSsHandle ) = aOn;
+    iSpecified->At( EApCdmaMipMnHaAuthAlgorithm ) = aOn;
+    iSpecified->At( EApCdmaMipMnHaSpi ) = aOn;
+    iSpecified->At( EApCdmaMipMnHaSsHandle ) = aOn;
+
+    CLOG( ( EApItem, 1, _L( "<- CApAccessPointItem::SpecifyCDMA" ) ) );
+    }
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::SpecifyWLAN
+// ---------------------------------------------------------
+//
+void CApAccessPointItem::SpecifyWLAN( TBool aOn )
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApAccessPointItem::SpecifyWLAN" ) ) );
+
+    __ASSERT_DEBUG( iExt->iWlanData, ApCommons::Panic( ESanityCheckFailed ) );
+
+    // WLAN, mapped to ISP... fields
+    iSpecified->At( EApWlanIfNetworks ) = aOn;
+    iSpecified->At( EApWlanIfPromptForAuth ) = aOn;
+    iSpecified->At( EApWlanIfAuthName ) = aOn;
+    iSpecified->At( EApWlanIfAuthPassword ) = aOn;
+    iSpecified->At( EApWlanIfAuthRetries ) = aOn;
+    iSpecified->At( EApWlanIpNetMask ) = aOn;
+    iSpecified->At( EApWlanIpGateway ) = aOn;
+    iSpecified->At( EApWlanIpAddrFromServer ) = aOn;
+    iSpecified->At( EApWlanIpAddr ) = aOn;
+    iSpecified->At( EApWlanIpDnsAddrFromServer ) = aOn;
+    iSpecified->At( EApWlanIPNameServer1 ) = aOn;
+    iSpecified->At( EApWlanIPNameServer2 ) = aOn;
+
+    CLOG( ( EApItem, 1, _L( "<- CApAccessPointItem::SpecifyWLAN" ) ) );
+    }
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::SetDnsIpFromServer
+// ---------------------------------------------------------
+//
+void CApAccessPointItem::SetDnsIpFromServer()
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApAccessPointItem::SetDnsIpFromServer" ) ) );
+
+    if ( ( iPrimaryDNS->Compare( KDynIpAddress ) == 0 ) &&
+         ( iSecondaryDNS->Compare( KDynIpAddress ) == 0 ) )
+        {
+        iGetDNSIPFromServer = ETrue;
+        }
+    else
+        {
+        iGetDNSIPFromServer = EFalse;
+        }
+
+    CLOG( ( EApItem, 1, _L( "<- CApAccessPointItem::SetDnsIpFromServer" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::SetIpFromServer
+// ---------------------------------------------------------
+//
+void CApAccessPointItem::SetIpFromServer()
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApAccessPointItem::SetIpFromServer" ) ) );
+
+    if ( iIspIPAddr->Compare( KDynIpAddress ) == 0 )
+        {
+        iIspIPAddrFromServer = ETrue;
+        }
+    else
+        {
+        iIspIPAddrFromServer = EFalse;
+        }
+
+    CLOG( ( EApItem, 1, _L( "<- CApAccessPointItem::SetIpFromServer" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::SetDns6IpFromServer
+// ---------------------------------------------------------
+//
+void CApAccessPointItem::SetDns6IpFromServer()
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApAccessPointItem::SetDns6IpFromServer" ) ) );
+
+    if ( iExt->iIsIpv6Supported )
+        {
+        if ( ( iExt->iIpv6PrimaryDNS->Compare( KDynIpv6Address ) == 0 ) &&
+             ( iExt->iIpv6SecondaryDNS->Compare( KDynIpv6Address ) == 0 ) )
+            {
+            
+            TApBearerType bt(EApBearerTypeGPRS);
+            TInt err(KErrNone);
+            TRAP( err, bt = BearerTypeL() );
+            if ( err == KErrNone )
+                {
+                switch (bt) 
+                    {
+                    case EApBearerTypeCSD:
+                    case EApBearerTypeHSCSD:
+                        { // consider it user defined
+                        iExt->iIpv6GetDNSIPFromServer = EFalse; 
+                        break;
+                        }
+                    default:
+                        {
+                        iExt->iIpv6GetDNSIPFromServer = ETrue;
+                        break;
+                        }
+                    }
+                }
+            }
+        else
+            {
+            iExt->iIpv6GetDNSIPFromServer = EFalse;
+            }
+        }
+
+    CLOG( ( EApItem, 1, _L( "<- CApAccessPointItem::SetDns6IpFromServer" ) ) );
+    }
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::ReAllocL
+// ---------------------------------------------------------
+//
+void CApAccessPointItem::ReAllocL(HBufC8*& aDes, const TDesC8& aValue)
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApAccessPointItem::ReAllocL8" ) ) );
+
+    // now remove 'invalid' chars (TABs) as they cause problems
+    // in other places, like listboxes...
+    HBufC8* tmp = RemoveInvalidCharsLC( aValue );
+    delete aDes;
+    aDes = tmp;
+    CleanupStack::Pop( tmp );
+
+    CLOG( ( EApItem, 1, _L( "<- CApAccessPointItem::ReAllocL8" ) ) );
+    }
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::ReAllocL
+// ---------------------------------------------------------
+//
+void CApAccessPointItem::ReAllocL(HBufC*& aDes, const TDesC16& aValue)
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApAccessPointItem::ReAllocL" ) ) );
+
+    // now remove 'invalid' chars (TABs) as they cause problems
+    // in other places, like listboxes...
+    HBufC* tmp = RemoveInvalidCharsLC( aValue );
+    delete aDes;
+    aDes = tmp;
+    CleanupStack::Pop( tmp );
+
+    CLOG( ( EApItem, 1, _L( "<- CApAccessPointItem::ReAllocL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::DoCompareApL
+// ---------------------------------------------------------
+//
+TBool CApAccessPointItem::DoCompareApL( const CApAccessPointItem& aItem )const
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApAccessPointItem::DoCompareApL" ) ) );
+
+    TBool retval( EFalse );
+    // sorry for those CONST_CASTS, but could not do it otherwise
+    // without API breask....
+    CApAccessPointItem* thisitem = CONST_CAST( CApAccessPointItem*, this );
+    CApAccessPointItem* otheritem = CONST_CAST( CApAccessPointItem*, &aItem );
+
+    TApBearerType thisbearer = thisitem->BearerTypeL();
+    if ( thisbearer == otheritem->BearerTypeL() )
+        { // if diff. bearers, compareing might give false results
+        // compare WAP:
+            // expect IAP ID
+        if ( CompareWap( aItem ) )
+            {
+            switch ( thisbearer )
+                {
+                case EApBearerTypeCSD:
+                case EApBearerTypeHSCSD:
+                    {
+                    // compare IAP
+                    if ( CompareIap( aItem ) )
+                        {
+                        // compare ISP
+                        if ( CompareIsp( aItem ) )
+                            {
+                            if ( CompareProxy( aItem ) )
+                                {
+                                retval = ETrue;
+                                }
+                            }
+                        }
+                    break;
+                    }
+                case EApBearerTypeGPRS:
+                    {
+                    // compare IAP
+                    if ( CompareIap( aItem ) )
+                        {
+                        // comapre GPRS
+                        if ( CompareGprs( aItem ) )
+                            {
+                            if ( CompareProxy( aItem ) )
+                                {
+                                retval = ETrue;
+                                }
+                            }
+                        }
+                    break;
+                    }
+                case EApBearerTypeCDMA:
+                    {
+                    // compare IAP
+                    if ( CompareIap( aItem ) )
+                        {
+                        // comapre CDMA
+                        if ( CompareCdma( aItem ) )
+                            {
+                            if ( CompareProxy( aItem ) )
+                                {
+                                retval = ETrue;
+                                }
+                            }
+                        }
+                    break;
+                    }
+                case EApBearerTypeWLAN:
+                    { 
+                    if ( iExt->iWlanData )
+                        {
+                        // Compare Iap
+                        if ( CompareIap( aItem ) )
+                            {
+                            // Check compareing for WLAN and LAN!!!
+                            // Compare WLAN
+                            if ( CompareWlan( aItem ) )
+                                {
+                                if ( CompareProxy( aItem ) )
+                                    {
+                                    retval = ETrue;
+                                    }
+                                }
+                            }
+                        }
+                    else
+                        {
+                        User::Leave( KErrNotSupported );
+                        }
+                    break;
+                    }
+                default:
+                    {
+                    // KErrInvalidBearer, but can not Leave here,
+                    // so just return False
+                    // retval is already False, nothing to do
+                    break;
+                    }
+                }
+            }
+        }
+
+    CLOG( ( EApItem, 1, _L( "<- CApAccessPointItem::DoCompareApL" ) ) );
+    return retval;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::CompareWap
+// ---------------------------------------------------------
+//
+TBool CApAccessPointItem::CompareWap( const CApAccessPointItem& aItem ) const
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApAccessPointItem::CompareWap" ) ) );
+
+    TBool retval( EFalse );
+// WAP AP Table
+/*
+WAP_CURRENT_BEARER
+WAP_START_PAGE
+*/
+
+// WAP IP Bearer Table
+/*
+    -- WAP_ACCESS_POINT_ID
+WAP_GATEWAY_ADDRESS
+    -- WAP_IAP
+    -- WAP_ISP
+    -- WAP_CHARGECARD
+WAP_ISP_TYPE
+WAP_WSP_OPTION
+WAP_SECURITY
+*/
+
+    if ( BOOL_COMPARE( iIsWTLSSecurityOn, aItem.iIsWTLSSecurityOn )
+       && ( iIsConnectionTypeContinuous == aItem.iIsConnectionTypeContinuous )
+       )
+        {
+        if (
+           ( iWapAccessPointName->Compare( *aItem.iWapAccessPointName ) == 0 )
+           && ( iWapBearer->Compare( *aItem.iWapBearer ) == 0 )
+           && ( iStartingPage->Compare( *aItem.iStartingPage ) == 0 )
+           && ( iWapGatewayAddress->Compare( *aItem.iWapGatewayAddress ) == 0 )
+           && ( iWapProxyLoginName->Compare(
+                                        *aItem.iWapProxyLoginName ) == 0 )
+           && ( iWapProxyLoginPass->Compare(
+                                        *aItem.iWapProxyLoginPass ) == 0 )
+            )
+            {
+            retval = ETrue;
+            }
+        }
+
+    CLOG( ( EApItem, 1, _L( "<- CApAccessPointItem::CompareWap" ) ) );
+    return retval;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::CompareIap
+// ---------------------------------------------------------
+//
+TBool CApAccessPointItem::CompareIap( const CApAccessPointItem& aItem ) const
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApAccessPointItem::CompareIap" ) ) );
+
+    TBool retval( EFalse );
+// WAP IAP Table
+/*
+COMMDB_NAME
+-- IAP_SERVICE                                      _S("IAPService")
+IAP_SERVICE_TYPE                                _S("IAPServiceType")
+-- IAP_CHARGECARD                                   _S("Chargecard")
+*/
+    if (
+       ( iIapName->Compare( *aItem.iIapName ) == 0 )
+        && ( iIapServiceType->Compare( *aItem.iIapServiceType ) == 0 )
+        && ( iNetworkName->Compare( *aItem.iNetworkName ) == 0 )
+        && ( iNetworkId == aItem.iNetworkId )
+        )
+        {
+        retval = ETrue;
+        }
+
+    CLOG( ( EApItem, 1, _L( "<- CApAccessPointItem::CompareIap" ) ) );
+    return retval;
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::CompareIsp
+// ---------------------------------------------------------
+//
+TBool CApAccessPointItem::CompareIsp( const CApAccessPointItem& aItem ) const
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApAccessPointItem::CompareIsp" ) ) );
+
+    TBool retval( EFalse );
+    if (
+        BOOL_COMPARE( iIspDialResolution , aItem.iIspDialResolution )
+        && BOOL_COMPARE( iUseLoginScript, aItem.iUseLoginScript )
+        && BOOL_COMPARE( iPromptPassword, aItem.iPromptPassword )
+        && BOOL_COMPARE( iDisplayTerminalWindow, aItem.iDisplayTerminalWindow )
+        && BOOL_COMPARE( iIspIfPromptForAuth, aItem.iIspIfPromptForAuth )
+        && iIspIfAuthRetries == aItem.iIspIfAuthRetries
+        && BOOL_COMPARE( iUseCallBack, aItem.iUseCallBack )
+        && iCallBackTypeIsServerNum == aItem.iCallBackTypeIsServerNum
+        && iIspCallbackTimeOut == aItem.iIspCallbackTimeOut
+        && BOOL_COMPARE( iIspIPAddrFromServer, aItem.iIspIPAddrFromServer )
+        && BOOL_COMPARE( iGetDNSIPFromServer, aItem.iGetDNSIPFromServer )
+        && BOOL_COMPARE( iEnablePPPCompression, aItem.iEnablePPPCompression )
+        && BOOL_COMPARE( iIspEnableLCPExtensions,
+                                aItem.iIspEnableLCPExtensions )
+        && BOOL_COMPARE( iIsPasswordAuthenticationSecure,
+                                aItem.iIsPasswordAuthenticationSecure )
+        && BOOL_COMPARE( iIspEnableSwCompression, 
+                                aItem.iIspEnableSwCompression )
+        && iIspBearerName == aItem.iIspBearerName
+        && iMaxConnSpeed == aItem.iMaxConnSpeed
+        && iIspBearerCE == aItem.iIspBearerCE
+        && iApIapBearerService == aItem.iApIapBearerService
+        && iIspBearerType == aItem.iIspBearerType
+        && iBearerCallTypeIsdn == aItem.iBearerCallTypeIsdn
+        && iIspChannelCoding == aItem.iIspChannelCoding
+        && iIspAIUR == aItem.iIspAIUR
+        && iIspRequestedTimeSlots == aItem.iIspRequestedTimeSlots
+        && iIspMaximumTimeSlots == aItem.iIspMaximumTimeSlots
+        && ( 
+            ( iExt->iIsIpv6Supported 
+            && ( BOOL_COMPARE( iExt->iIpv6GetDNSIPFromServer,
+                                 aItem.iExt->iIpv6GetDNSIPFromServer ) ) )
+            || !iExt->iIsIpv6Supported )
+        )
+        {
+        if (
+            ( iIspName->Compare( *aItem.iIspName ) == 0 )
+            && ( iIspDescription->Compare( *aItem.iIspDescription ) == 0 )
+            &&
+            ( iIspDefaultTelNumber->Compare( 
+                        *aItem.iIspDefaultTelNumber ) == 0 )
+            && ( iLoginScript->Compare( *aItem.iLoginScript ) == 0 )
+            && ( iUserName->Compare( *aItem.iUserName ) == 0 )
+            && ( iPassword->Compare( *aItem.iPassword ) == 0 )
+            && ( iIspIfName->Compare( *aItem.iIspIfName ) == 0 )
+            && ( iIspIfParams->Compare( *aItem.iIspIfParams ) == 0 )
+            && ( iIspIfNetworks->Compare( *aItem.iIspIfNetworks ) == 0 )
+            && ( iIspIfAuthName->Compare( *aItem.iIspIfAuthName ) == 0 )
+            && ( iIspIfAuthPass->Compare( *aItem.iIspIfAuthPass ) == 0 )
+            &&
+            ( iIspIfCallbackInfo->Compare( *aItem.iIspIfCallbackInfo ) == 0 )
+            && ( iIspIPAddr->Compare( *aItem.iIspIPAddr ) == 0 )
+            && ( iIspIPNetMask->Compare( *aItem.iIspIPNetMask ) == 0 )
+            && ( iIspGateway->Compare( *aItem.iIspGateway ) == 0 )
+            && ( iPrimaryDNS->Compare( *aItem.iPrimaryDNS ) == 0 )
+            && ( iSecondaryDNS->Compare( *aItem.iSecondaryDNS ) == 0 )
+            && ( iIspInitString->Compare( *aItem.iIspInitString ) == 0 )
+            && (
+               ( iExt->iIsIpv6Supported && 
+                    ( 
+                        ( iExt->iIpv6PrimaryDNS->Compare( 
+                                *aItem.iExt->iIpv6PrimaryDNS ) == 0 )
+                        && 
+                        ( iExt->iIpv6SecondaryDNS->Compare( 
+                                *aItem.iExt->iIpv6SecondaryDNS ) == 0 )
+                    )
+                || !iExt->iIsIpv6Supported )
+                )
+            )
+            {
+            retval = ETrue;
+            }
+        }
+
+    CLOG( ( EApItem, 1, _L( "<- CApAccessPointItem::CompareIsp" ) ) );
+    return retval;
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::CompareGprs
+// ---------------------------------------------------------
+//
+TBool CApAccessPointItem::CompareGprs( const CApAccessPointItem& aItem ) const
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApAccessPointItem::CompareGprs" ) ) );
+
+    TBool retval( EFalse );
+
+    if (
+        iGprsPdpType == aItem.iGprsPdpType
+//
+        && BOOL_COMPARE( iIspIfPromptForAuth, aItem.iIspIfPromptForAuth )
+        && iIspIfAuthRetries == aItem.iIspIfAuthRetries
+        && BOOL_COMPARE( iIspIPAddrFromServer, aItem.iIspIPAddrFromServer )
+        && BOOL_COMPARE( iGetDNSIPFromServer, aItem.iGetDNSIPFromServer )
+        && BOOL_COMPARE( iEnablePPPCompression, aItem.iEnablePPPCompression )
+        && BOOL_COMPARE( iIspEnableLCPExtensions, 
+                                aItem.iIspEnableLCPExtensions )
+        && BOOL_COMPARE( iIsPasswordAuthenticationSecure,
+                                aItem.iIsPasswordAuthenticationSecure )
+        && BOOL_COMPARE( iIspEnableSwCompression, 
+                                aItem.iIspEnableSwCompression )
+//
+        && iGprsReqPrecedence == aItem.iGprsReqPrecedence
+        && iGprsReqDelay == aItem.iGprsReqDelay
+        && iGprsReqReliability == aItem.iGprsReqReliability
+        && iGprsReqPeakThroughput == aItem.iGprsReqPeakThroughput
+        && iGprsReqMeanPeakThroughput == aItem.iGprsReqMeanPeakThroughput
+        && iGprsMinPrecedence == aItem.iGprsMinPrecedence
+        && iGprsMinDelay == aItem.iGprsMinDelay
+        && iGprsMinReliability == aItem.iGprsMinReliability
+        && iGprsMinPeakThroughput == aItem.iGprsMinPeakThroughput
+        && iGprsMinMeanThroughput == aItem.iGprsMinMeanThroughput
+        && BOOL_COMPARE( iGprsUseAnonymAccess, aItem.iGprsUseAnonymAccess )
+        && ( 
+            ( iExt->iIsIpv6Supported 
+            && (BOOL_COMPARE( iExt->iIpv6GetDNSIPFromServer,
+                                 aItem.iExt->iIpv6GetDNSIPFromServer ) ) )
+            || ( !iExt->iIsIpv6Supported ) )
+        )
+        {
+        if (
+            ( iGprsAccessPointName->Compare( 
+                        *aItem.iGprsAccessPointName ) == 0 )
+//
+            && ( iIspIfName->Compare( *aItem.iIspIfName ) == 0 )
+            && ( iIspIfParams->Compare( *aItem.iIspIfParams ) == 0 )
+            && ( iIspIfNetworks->Compare( *aItem.iIspIfNetworks ) == 0 )
+            && ( iIspIfAuthName->Compare( *aItem.iIspIfAuthName ) == 0 )
+            && ( iIspIfAuthPass->Compare( *aItem.iIspIfAuthPass ) == 0 )
+            && ( iIspIPAddr->Compare( *aItem.iIspIPAddr ) == 0 )
+            && ( iIspIPNetMask->Compare( *aItem.iIspIPNetMask ) == 0 )
+            && ( iIspGateway->Compare( *aItem.iIspGateway ) == 0 )
+            && ( iPrimaryDNS->Compare( *aItem.iPrimaryDNS ) == 0 )
+            && ( iSecondaryDNS->Compare( *aItem.iSecondaryDNS ) == 0 )
+//
+            && ( iGprsPdpAddress->Compare( *aItem.iGprsPdpAddress ) == 0 )  
+            && (
+               ( iExt->iIsIpv6Supported && 
+                    ( 
+                        ( iExt->iIpv6PrimaryDNS->Compare( 
+                                *aItem.iExt->iIpv6PrimaryDNS ) == 0 )
+                        && 
+                        ( iExt->iIpv6SecondaryDNS->Compare( 
+                                *aItem.iExt->iIpv6SecondaryDNS ) == 0 )
+                    )
+                || !iExt->iIsIpv6Supported )
+                )
+            )
+            {
+            retval = ETrue;
+            }
+        }
+
+    CLOG( ( EApItem, 1, _L( "<- CApAccessPointItem::CompareGprs" ) ) );
+    return retval;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::CompareCdma
+// ---------------------------------------------------------
+//
+TBool CApAccessPointItem::CompareCdma( const CApAccessPointItem& aItem ) const
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApAccessPointItem::CompareCdma" ) ) );
+
+    TBool retval( EFalse );
+
+    __ASSERT_ALWAYS( iExt->iCdmaData, ApCommons::Panic( ESanityCheckFailed ) );
+
+    if (
+           iExt->iCdmaData->iServiceOption == 
+                                aItem.iExt->iCdmaData->iServiceOption
+        && iExt->iCdmaData->iPdpType == aItem.iExt->iCdmaData->iPdpType
+        && iExt->iCdmaData->iReqFwdPriority == 
+                                aItem.iExt->iCdmaData->iReqFwdPriority
+        && iExt->iCdmaData->iReqRevPriority == 
+                                aItem.iExt->iCdmaData->iReqRevPriority
+        && iExt->iCdmaData->iReqFwdBitrate == 
+                                aItem.iExt->iCdmaData->iReqFwdBitrate
+        && iExt->iCdmaData->iReqRevBitrate == 
+                                aItem.iExt->iCdmaData->iReqRevBitrate
+        && iExt->iCdmaData->iReqFwdLoss == aItem.iExt->iCdmaData->iReqFwdLoss
+        && iExt->iCdmaData->iReqRevLoss == aItem.iExt->iCdmaData->iReqRevLoss
+        && iExt->iCdmaData->iReqFwdMaxDelay == 
+                                aItem.iExt->iCdmaData->iReqFwdMaxDelay
+        && iExt->iCdmaData->iReqRevMaxDelay == 
+                                aItem.iExt->iCdmaData->iReqRevMaxDelay
+        && iExt->iCdmaData->iMinFwdBitrate == 
+                                aItem.iExt->iCdmaData->iMinFwdBitrate
+        && iExt->iCdmaData->iMinRevBitrate == 
+                                aItem.iExt->iCdmaData->iMinRevBitrate
+        && iExt->iCdmaData->iAccptFwdLoss == 
+                                aItem.iExt->iCdmaData->iAccptFwdLoss
+        && iExt->iCdmaData->iAccptRevLoss == 
+                                aItem.iExt->iCdmaData->iAccptRevLoss
+        && iExt->iCdmaData->iAccptFwdMaxDelay == 
+                                aItem.iExt->iCdmaData->iAccptFwdMaxDelay
+        && iExt->iCdmaData->iAccptRevMaxDelay == 
+                                aItem.iExt->iCdmaData->iAccptRevMaxDelay
+//
+        && BOOL_COMPARE( iIspIfPromptForAuth, aItem.iIspIfPromptForAuth )
+        && iIspIfAuthRetries == aItem.iIspIfAuthRetries
+        && BOOL_COMPARE( iIspIPAddrFromServer, aItem.iIspIPAddrFromServer )
+        && BOOL_COMPARE( iGetDNSIPFromServer, aItem.iGetDNSIPFromServer )
+        && BOOL_COMPARE( iEnablePPPCompression, aItem.iEnablePPPCompression )
+        && BOOL_COMPARE( iIspEnableLCPExtensions, 
+                                aItem.iIspEnableLCPExtensions )
+        && BOOL_COMPARE( iIsPasswordAuthenticationSecure,
+                                aItem.iIsPasswordAuthenticationSecure )
+        && BOOL_COMPARE( iIspEnableSwCompression, 
+                                aItem.iIspEnableSwCompression )
+//
+        && iIspType == aItem.iIspType
+        && iExt->iCdmaData->iQosWarningTimeout == 
+                                aItem.iExt->iCdmaData->iQosWarningTimeout
+        && iExt->iCdmaData->iRlpMode == aItem.iExt->iCdmaData->iRlpMode
+        && BOOL_COMPARE( iExt->iCdmaData->iMip, aItem.iExt->iCdmaData->iMip )
+        && iExt->iCdmaData->iMipTimeout == aItem.iExt->iCdmaData->iMipTimeout
+        && iExt->iCdmaData->iNaiType == aItem.iExt->iCdmaData->iNaiType
+        && iExt->iCdmaData->iSimpleIpAuthAlgorithm == 
+                                aItem.iExt->iCdmaData->iSimpleIpAuthAlgorithm
+        && iExt->iCdmaData->iSimpleIpPapSsHandle == 
+                                aItem.iExt->iCdmaData->iSimpleIpPapSsHandle
+        && iExt->iCdmaData->iSimpleIpChapSsHandle == 
+                                aItem.iExt->iCdmaData->iSimpleIpChapSsHandle
+        && iExt->iCdmaData->iMipTBit == aItem.iExt->iCdmaData->iMipTBit
+        && iExt->iCdmaData->iMipMnAaaAuthAlgorithm == 
+                                aItem.iExt->iCdmaData->iMipMnAaaAuthAlgorithm
+        && iExt->iCdmaData->iMipMnAaaSpi == 
+                                aItem.iExt->iCdmaData->iMipMnAaaSpi
+        && iExt->iCdmaData->iMipMnAaaSsHandle == 
+                                aItem.iExt->iCdmaData->iMipMnAaaSsHandle
+        && iExt->iCdmaData->iMipMnHaAuthAlgorithm == 
+                                aItem.iExt->iCdmaData->iMipMnHaAuthAlgorithm
+        && iExt->iCdmaData->iMipMnHaSpi == aItem.iExt->iCdmaData->iMipMnHaSpi
+        && iExt->iCdmaData->iMipMnHaSsHandle == 
+                                aItem.iExt->iCdmaData->iMipMnHaSsHandle
+//
+        && BOOL_COMPARE( iGprsUseAnonymAccess, aItem.iGprsUseAnonymAccess )
+        && ( 
+            ( iExt->iIsIpv6Supported 
+            && ( BOOL_COMPARE( iExt->iIpv6GetDNSIPFromServer, 
+                                 aItem.iExt->iIpv6GetDNSIPFromServer ) ) )
+            || ( !iExt->iIsIpv6Supported ) )
+        )
+        {
+        if (
+               ( iExt->iCdmaData->iIwfName->Compare( 
+                        *aItem.iExt->iCdmaData->iIwfName ) == 0 )
+            && ( iExt->iCdmaData->iPdpAddress->Compare( 
+                        *aItem.iExt->iCdmaData->iPdpAddress ) == 0 )
+            && ( iExt->iCdmaData->iHomeAgentAddress->Compare( 
+                        *aItem.iExt->iCdmaData->iHomeAgentAddress ) == 0 )
+            && ( iExt->iCdmaData->iMipHomeAddress->Compare( 
+                        *aItem.iExt->iCdmaData->iMipHomeAddress ) == 0 )
+            && ( iExt->iCdmaData->iMipPrimaryHomeAgent->Compare( 
+                        *aItem.iExt->iCdmaData->iMipPrimaryHomeAgent ) == 0 )
+            && ( iExt->iCdmaData->iMipSecondaryHomeAgent->Compare( 
+                        *aItem.iExt->iCdmaData->iMipSecondaryHomeAgent ) == 0 )
+//
+            && ( iIspIfName->Compare( *aItem.iIspIfName ) == 0 )
+            && ( iIspIfParams->Compare( *aItem.iIspIfParams ) == 0 )
+            && ( iIspIfNetworks->Compare( *aItem.iIspIfNetworks ) == 0 )
+            && ( iIspIfAuthName->Compare( *aItem.iIspIfAuthName ) == 0 )
+            && ( iIspIfAuthPass->Compare( *aItem.iIspIfAuthPass ) == 0 )
+            && ( iIspIPAddr->Compare( *aItem.iIspIPAddr ) == 0 )
+            && ( iIspIPNetMask->Compare( *aItem.iIspIPNetMask ) == 0 )
+            && ( iIspGateway->Compare( *aItem.iIspGateway ) == 0 )
+            && ( iPrimaryDNS->Compare( *aItem.iPrimaryDNS ) == 0 )
+            && ( iSecondaryDNS->Compare( *aItem.iSecondaryDNS ) == 0 )
+//
+            && (
+               ( iExt->iIsIpv6Supported && 
+                    ( 
+                        ( iExt->iIpv6PrimaryDNS->Compare( 
+                                *aItem.iExt->iIpv6PrimaryDNS ) == 0 )
+                        && 
+                        ( iExt->iIpv6SecondaryDNS->Compare( 
+                                *aItem.iExt->iIpv6SecondaryDNS ) == 0 )
+                    )
+                || !iExt->iIsIpv6Supported )
+                )
+            )
+            {
+            retval = ETrue;
+            }
+        }
+
+    CLOG( ( EApItem, 1, _L( "<- CApAccessPointItem::CompareCdma" ) ) );
+    return retval;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::CompareWlan
+// ---------------------------------------------------------
+//
+TBool CApAccessPointItem::CompareWlan( const CApAccessPointItem& aItem ) const
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApAccessPointItem::CompareWlan" ) ) );
+
+    TBool retval( EFalse );
+
+    __ASSERT_ALWAYS( iExt->iWlanData, ApCommons::Panic( ESanityCheckFailed ) );
+    __ASSERT_ALWAYS( aItem.iExt->iWlanData, 
+                     ApCommons::Panic( ESanityCheckFailed ) );
+
+    if (  
+         iExt->iWlanData->iWlanNetworkMode == 
+                                aItem.iExt->iWlanData->iWlanNetworkMode
+         && iExt->iWlanData->iScanSSID == aItem.iExt->iWlanData->iScanSSID
+         && iExt->iWlanData->iWlanSecurityMode == 
+                                aItem.iExt->iWlanData->iWlanSecurityMode
+         && iExt->iWlanData->iChannelId == 
+                                aItem.iExt->iWlanData->iChannelId
+        && BOOL_COMPARE( iGetDNSIPFromServer, aItem.iGetDNSIPFromServer )
+        )        
+        {
+        if (   ( iExt->iWlanData->iWlanNetworkName->Compare( 
+                    *aItem.iExt->iWlanData->iWlanNetworkName ) == 0 )
+            && ( iIspIPAddr->Compare( *aItem.iIspIPAddr ) == 0 )
+            && ( iIspIPNetMask->Compare( *aItem.iIspIPNetMask ) == 0 )
+            && ( iIspGateway->Compare( *aItem.iIspGateway ) == 0 )
+            && ( iPrimaryDNS->Compare( *aItem.iPrimaryDNS ) == 0 )
+            && ( iSecondaryDNS->Compare( *aItem.iSecondaryDNS ) == 0 )
+// Check if AuthName is needed or not
+//            && ( iIspIfAuthName->Compare( *aItem.iIspIfAuthName ) == 0 )
+            )
+            {
+            retval = ETrue;
+            }
+        }
+
+    CLOG( ( EApItem, 1, _L( "<- CApAccessPointItem::CompareWlan" ) ) );
+    return retval;
+    }
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::GetCleanIpAddressLC
+// ---------------------------------------------------------
+//
+HBufC* CApAccessPointItem::GetCleanIpAddressLC( const TDesC& aValue )
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApAccessPointItem::GetCleanIpAddressLC" ) ) );
+
+    TBuf<256> buf;
+    TInetAddr in;
+    User::LeaveIfError( in.Input( aValue ) );
+    in.Output( buf );
+
+    CLOG( ( EApItem, 1, _L( "<- CApAccessPointItem::GetCleanIpAddressLC" ) ) );
+    return buf.AllocLC();
+    }
+
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::GetPlainPhoneNumberLC
+// ---------------------------------------------------------
+//
+HBufC* CApAccessPointItem::GetPlainPhoneNumberLC( const TDesC& aNumber )
+    {
+    CLOG( ( EApItem, 0, 
+            _L( "-> CApAccessPointItem::GetPlainPhoneNumberLC" ) ) );
+
+    // Removes invalid chars e.g. space, () from the passed phone number.
+    // (valid are 0,1,2,..9,p,w,+,*,#)
+    // Strips pre- and postfixes, prefix separator is#,
+    // postfix separators are p, w or +
+    HBufC* retval = NULL;
+
+    HBufC* numbuf = RemoveInvalidPhoneCharsLC( aNumber );
+    TPtr16 num( numbuf->Des() );
+
+    TInt prefixpos( 0 );
+    TInt postfixpos( 0 );
+    TInt lasthashmark = num.LocateReverse('#');
+    if ( lasthashmark != KErrNotFound )
+        { // has prefix
+        prefixpos = ++lasthashmark;
+        }
+    else
+        { // no prefix
+        prefixpos = 0;
+        }
+    // now get postfixes, if any
+    // be carefull not to say postfix for the international code...
+    // as can be more than one postfix, get each postfix-separator type's
+    // position and use the lowest one
+    TInt ppos( 0 );
+    TInt wpos( 0 );
+    TInt pluspos( 0 );
+    TInt tmppos( 0 );
+
+    tmppos = num.Locate( '+' );
+    if ( tmppos != KErrNotFound )
+        {
+        pluspos = tmppos;
+        if ( tmppos == 0 )
+            { // possibly country code comes, get next if any
+            // also inc. prefixpos
+            prefixpos++;
+            num = num.Right( num.Length() - 1 );
+            tmppos = num.Locate( '+' );
+            if ( tmppos != KErrNotFound )
+                {
+                tmppos = pluspos;
+                }
+            }
+        }
+
+    tmppos = num.Locate( 'p' );
+    if ( tmppos != KErrNotFound )
+        {
+        ppos = tmppos;
+        num = num.Left( num.Length() - ppos );
+        }
+    tmppos = num.LocateReverse( 'w' );
+    if ( tmppos != KErrNotFound )
+        {
+        wpos = tmppos;
+        num = num.Left( num.Length() - wpos );
+        }
+    // now we have 3 positions,
+    // decide which is the smallest but greater than 0
+    // if all is 0, it is 0...
+    if ( wpos )
+        {
+        postfixpos = wpos;
+        }
+    else
+        {
+        if ( ppos )
+            {
+            postfixpos = ppos;
+            }
+        else
+            {
+            if ( pluspos )
+                {
+                postfixpos = pluspos;
+                }
+            }
+        }
+    // now we have pre- and postfix positions, get the resulting string
+    if ( postfixpos == 0 )
+        {
+        postfixpos = aNumber.Length();
+        }
+    retval = aNumber.Mid( prefixpos, postfixpos-prefixpos ).AllocLC();
+    CleanupStack::Pop( retval ); // retval
+    CleanupStack::PopAndDestroy( numbuf ); // numbuf
+    CleanupStack::PushL( retval );
+
+    CLOG( ( EApItem, 1, 
+            _L( "<- CApAccessPointItem::GetPlainPhoneNumberLC" ) ) );
+    return retval;
+    }
+
+
+
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::IsSamePhoneNumber
+// ---------------------------------------------------------
+//
+TBool CApAccessPointItem::IsSamePhoneNumberL( CApAccessPointItem& aItem )
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApAccessPointItem::IsSamePhoneNumberL" ) ) );
+
+    TBool retval( EFalse );
+
+    HBufC* tmpphone = 
+        HBufC::NewLC( aItem.ReadTextLengthL( EApIspDefaultTelNumber ) );
+    TPtr16 tmpptr( tmpphone->Des() );
+    aItem.ReadTextL( EApIspDefaultTelNumber, tmpptr );
+
+    HBufC* ph1 = GetPlainPhoneNumberLC( *iIspDefaultTelNumber );
+    HBufC* ph2 = GetPlainPhoneNumberLC( tmpptr );
+    TInt cl ( 7 );
+    cl = Min( cl, ph1->Length() );
+    cl = Min( cl, ph2->Length() );
+    TPtrC16 ptr1 = ph1->Right( cl );
+    TPtrC16 ptr2 = ph2->Right( cl );
+    if ( ptr1.Compare( ptr2 ) == 0 )
+        {
+        retval = ETrue;
+        }
+    CleanupStack::PopAndDestroy( 3, tmpphone ); // ph1, ph2, tmpphone
+
+    CLOG( ( EApItem, 1, _L( "<- CApAccessPointItem::IsSamePhoneNumberL" ) ) );
+    return retval;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::RemoveInvalidPhoneCharsLC
+// ---------------------------------------------------------
+//
+HBufC* CApAccessPointItem::RemoveInvalidPhoneCharsLC( const TDesC16& aInText )
+    {
+    CLOG( ( EApItem, 0, 
+            _L( "-> CApAccessPointItem::RemoveInvalidPhoneCharsLC" ) ) );
+
+    // valid are 0,1,2,..9,p,w,+,*,#
+    TInt size = aInText.Length();
+    HBufC* aOutText = HBufC::NewLC( size );
+    TPtr ptr = aOutText->Des();
+
+    for(TInt i = 0; i< size; i++)
+        {
+        //TText ch = aInText[i];
+        TChar ch = aInText[i];
+        if ( ( ch == 'p' ) || ( ch == 'P' ) || ( ch == 'W' ) || ( ch == 'W' )
+            || ( ch == '+' ) || ( ch == '0' ) || ( ch == '1' ) || ( ch == '2' )
+            || ( ch == '3' ) || ( ch == '4' ) || ( ch == '5' ) || ( ch == '6' )
+            || ( ch == '7' ) || ( ch == '8' ) || ( ch == '9' ) || ( ch == '*' )
+            || ( ch == '#' )
+            )
+            {
+            ptr.Append( ch );
+            }
+        }
+
+    CLOG( ( EApItem, 1, 
+            _L( "<- CApAccessPointItem::RemoveInvalidPhoneCharsLC" ) ) );
+    return aOutText;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::RemoveInvalidCharsLC
+// ---------------------------------------------------------
+//
+HBufC* CApAccessPointItem::RemoveInvalidCharsLC( const TDesC16& aInText )
+    {
+    CLOG( ( EApItem, 0, 
+            _L( "-> CApAccessPointItem::RemoveInvalidCharsLC" ) ) );
+
+    TInt size = aInText.Length();
+    HBufC* aOutText = HBufC::NewLC( size );
+    TPtr ptr = aOutText->Des();
+
+    for ( TInt ii=0; ii<size; ++ii )
+        {
+        TText ch = aInText[ii];
+        if ( ch == CEditableText::ETabCharacter )
+            {
+            ch = ' ';
+            }
+        ptr.Append( ch );
+        }
+
+    CLOG( ( EApItem, 1, 
+            _L( "<- CApAccessPointItem::RemoveInvalidCharsLC" ) ) );
+    return aOutText;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::RemoveInvalidCharsLC
+// ---------------------------------------------------------
+//
+HBufC8* CApAccessPointItem::RemoveInvalidCharsLC( const TDesC8& aInText )
+    {
+    CLOG( ( EApItem, 0, 
+            _L( "-> CApAccessPointItem::RemoveInvalidCharsLC8" ) ) );
+
+    TInt size = aInText.Length();
+    HBufC8* aOutText = HBufC8::NewLC( size );
+    TPtr8 ptr = aOutText->Des();
+
+    for ( TInt ii=0; ii<size; ++ii )
+        {
+        TText ch = aInText[ii];
+        if ( ch == CEditableText::ETabCharacter )
+            {
+            ch = ' ';
+            }
+        ptr.Append( ch );
+        }
+
+    CLOG( ( EApItem, 1, 
+            _L( "<- CApAccessPointItem::RemoveInvalidCharsLC8" ) ) );
+    return aOutText;
+    }
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::CompareProxy
+// ---------------------------------------------------------
+//
+TBool CApAccessPointItem::CompareProxy( const CApAccessPointItem& aItem ) const
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApAccessPointItem::CompareProxy" ) ) );
+
+    TBool retval( EFalse );
+    if ( BOOL_COMPARE( iApHasProxySettings, aItem.iApHasProxySettings )
+         && iApProxyPortNumber == aItem.iApProxyPortNumber
+         && BOOL_COMPARE( iApProxyUseProxy, iApProxyUseProxy )
+         && ( iApProxyProtocolName->Compare( 
+                        *aItem.iApProxyProtocolName ) == 0 )
+         && ( iApProxyServerAddress->Compare( 
+                        *aItem.iApProxyServerAddress ) == 0 )
+         && ( iApProxyExceptions->Compare( *aItem.iApProxyExceptions ) == 0 ) )
+        {
+        retval = ETrue;
+        }
+
+    CLOG( ( EApItem, 1, _L( "<- CApAccessPointItem::CompareProxy" ) ) );
+    return retval;
+    }
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::HasProxy
+// ---------------------------------------------------------
+//
+TBool CApAccessPointItem::HasProxy() const
+    {
+    CLOG( ( EApItem, 0, _L( "<-> CApAccessPointItem::HasProxy" ) ) );
+
+    return iApHasProxySettings;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApAccessPointItem::SetProxyFlag
+// ---------------------------------------------------------
+//
+void CApAccessPointItem::SetProxyFlag()
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApAccessPointItem::SetProxyFlag" ) ) );
+
+    if ( ( iApProxyServerAddress->Compare( KDynIpAddress ) 
+         && iApProxyServerAddress->Compare( KEmpty ) )
+         || ( iApProxyPortNumber != 0 ) )
+        {
+        iApHasProxySettings = ETrue;
+        }
+    else
+        {
+        iApHasProxySettings = EFalse;
+        }
+    // BY DEFAULT, as it is not accessible on the UI,
+    // we set the USE PROXY flag if ANY proxy setting is defined...
+    iApProxyUseProxy = iApHasProxySettings;
+
+    CLOG( ( EApItem, 1, _L( "<- CApAccessPointItem::SetProxyFlag" ) ) );
+    }
+
+
+
+
+//----------------------------------------------------------
+// CApAccessPointItem::LimitSpeed
+//----------------------------------------------------------
+//
+void CApAccessPointItem::LimitSpeedL()
+    {
+    CLOG( ( EApItem, 0, _L( "-> CApAccessPointItem::LimitSpeedL" ) ) );
+
+    TBool isWcdma = iExt->iIsWcdma;
+    TApBearerType bearer = BearerTypeL();
+    const TInt* actSpeeds = NULL;
+    switch ( bearer )
+        {
+        case EApBearerTypeCSD:
+            {
+            switch ( iBearerCallTypeIsdn )
+                {
+                case ECallTypeISDNv110:
+                    {
+                    isWcdma ? actSpeeds = KCsdIsdn110Wcdma :
+                              actSpeeds = KCsdIsdn110;
+                    break;
+                    }
+                case ECallTypeISDNv120:
+                    {
+                    isWcdma ? actSpeeds = KCsdIsdn120Wcdma :
+                              actSpeeds = KCsdIsdn120;
+                    break;
+                    }
+                case ECallTypeAnalogue:
+                default:
+                    {
+                    isWcdma ? actSpeeds = KCsdAnalogueWcdma :
+                              actSpeeds = KCsdAnalogue;
+                    break;
+                    }
+                }
+            break;
+            }
+        case EApBearerTypeHSCSD:
+            {
+            switch ( iBearerCallTypeIsdn )
+                {
+                case ECallTypeISDNv110:
+                    {
+                    actSpeeds = KHcsdIsdn110;
+                    break;
+                    }
+                case ECallTypeISDNv120:
+                    {
+                    actSpeeds = KHcsdIsdn120;
+                    break;
+                    }
+                case ECallTypeAnalogue:
+                default:
+                    {
+                    actSpeeds = KHcsdAnal;
+                    break;
+                    }
+                }
+            break;
+            }
+        default:
+            {
+            break;
+            }
+        }
+
+
+    if( actSpeeds )
+        {
+        TInt tempSpeed = *actSpeeds;
+        TInt nextSpeed = *( actSpeeds + 1);
+        while ( ( nextSpeed != KEndOfArray ) 
+                && ( tempSpeed < ( TInt )iMaxConnSpeed ) 
+                && ( nextSpeed <= ( TInt )iMaxConnSpeed ) )
+            {
+            tempSpeed = *( ++actSpeeds );
+            nextSpeed = *( actSpeeds + 1);
+            }
+        iMaxConnSpeed = ( TApCallSpeed )tempSpeed ;
+        }
+
+    CLOG( ( EApItem, 1, _L( "<- CApAccessPointItem::LimitSpeedL" ) ) );
+    }
+
+
+
+//----------------------------------------------------------
+// CApAccessPointItem::SetIfNetworksL
+//----------------------------------------------------------
+//
+void CApAccessPointItem::SetIfNetworksL()
+    {
+    // Check if Wlan affects this one!!!
+    // Check if Lan affects this one!!!
+    TApBearerType bearertype = BearerTypeL();
+    if ( iExt->iIsIpv6Supported )
+        {
+        if ( bearertype == EApBearerTypeGPRS )
+            {
+            if ( iGprsPdpType  == EIPv6 )
+                {
+                WriteTextL( EApIspIfNetworks, KDefIspIfNetworksIPv6 );
+                }
+            else
+                {
+                WriteTextL( EApIspIfNetworks, KDefIspIfNetworksIPv4 );
+                }
+            }
+        else if ( bearertype == EApBearerTypeCDMA )
+            {
+            __ASSERT_ALWAYS( iExt->iCdmaData, \
+                ApCommons::Panic( ESanityCheckFailed ) );
+            if ( iExt->iCdmaData->iPdpType  == EIPv6 )
+                {
+                WriteTextL( EApIspIfNetworks, KDefIspIfNetworksIPv6 );
+                }
+            else
+                {
+                WriteTextL( EApIspIfNetworks, KDefIspIfNetworksIPv4 );
+                }
+            }
+        else 
+            {
+#ifdef __TEST_LAN_BEARER
+            if ( bearertype == EApBearerTypeLAN )
+                {
+                WriteTextL( EApIspIfNetworks, KDefIspIfNetworksIPv4IPv6LAN );
+                }            
+#endif// __TEST_LAN_BEARER
+            if ( ( bearertype == EApBearerTypeWLAN ) 
+                || ( bearertype == EApBearerTypeLANModem ) )
+                {
+                WriteTextL( EApIspIfNetworks, KDefIspIfNetworksIPv4IPv6LAN );
+                }
+            else
+                { // CSD, HSCSD
+                WriteTextL( EApIspIfNetworks, KDefIspIfNetworksIPv4IPv6 );
+                }
+            }
+        }
+    else
+        {
+        WriteTextL( EApIspIfNetworks, KDefIspIfNetworksIPv4 );
+        }
+    }
+
+
+//----------------------------------------------------------
+// CApAccessPointItem::IsSupported
+//----------------------------------------------------------
+//
+TBool CApAccessPointItem::IsSupported( TApMember aColumn )
+    {
+    TBool ret( ETrue );
+
+    switch ( aColumn )
+        {
+        case EApCdmaIwfName:
+        case EApCdmaServiceOption:
+        case EApCdmaPdpType:
+        case EApCdmaPdpAddress:
+        case EApCdmaReqFwdPriority:
+        case EApCdmaReqRevPriority:
+        case EApCdmaReqFwdBitrate:
+        case EApCdmaReqRevBitrate:
+        case EApCdmaReqFwdLoss:
+        case EApCdmaReqRevLoss:
+        case EApCdmaReqFwdMaxDelay:
+        case EApCdmaReqRevMaxDelay:
+        case EApCdmaMinFwdBitrate:
+        case EApCdmaMinRevBitrate:
+        case EApCdmaAccptFwdLoss:
+        case EApCdmaAccptRevLoss:
+        case EApCdmaAccptFwdMaxDelay:
+        case EApCdmaAccptRevMaxDelay:
+        case EApCdmaDataCompression:
+        case EApCdmaHeaderCompression:
+        case EApCdmaAnonymousAccess:
+        case EApCdmaIfName:
+        case EApCdmaIfParams:
+        case EApCdmaIfNetworks:
+        case EApCdmaIfPromptForAuth:
+        case EApCdmaIfAuthName:
+        case EApCdmaIfAuthPassword:
+        case EApCdmaIfAuthRetries:
+        case EApCdmaIpNetMask:
+        case EApCdmaIpGateway:
+        case EApCdmaIpAddrFromServer:
+        case EApCdmaIpAddr:
+        case EApCdmaIpDnsAddrFromServer:
+        case EApCdmaIPNameServer1:
+        case EApCdmaIPNameServer2:
+        case EApCdmaEnableLCPExtensions:
+        case EApCdmaDisablePlainTextAuth:
+        case EApCdmaApType:
+        case EApCdmaQosWarningTimeout:
+        case EApCdmaRlpMode:
+        case EApCdmaMip:
+        case EApCdmaHomeAgentAddress:
+        case EApCdmaMipTimeout:
+        case EApCdmaNaiType:
+        case EApCdmaSimpleIpAuthAlgorithm:
+        case EApCdmaSimpleIpPapSsHandle:
+        case EApCdmaSimpleIpChapSsHandle:
+        case EApCdmaMipTBit:
+        case EApCdmaMipHomeAddress:
+        case EApCdmaMipPrimaryHomeAgent:
+        case EApCdmaMipSecondaryHomeAgent:
+        case EApCdmaMipMnAaaAuthAlgorithm:
+        case EApCdmaMipMnAaaSpi:
+        case EApCdmaMipMnAaaSsHandle:
+        case EApCdmaMipMnHaAuthAlgorithm:
+        case EApCdmaMipMnHaSpi:
+        case EApCdmaMipMnHaSsHandle:
+            {
+            ret = iExt->iCdmaData != NULL;
+            break;
+            }
+        case EApWlanNetworkName:
+        case EApWlanNetworkMode:
+        case EApWlanSecurityMode:
+        case EApWlanScanSSID:
+        case EApWlanChannelId:
+            {
+            ret = iExt->iWlanData != NULL;
+            break;
+            }
+
+        default:
+            {
+            break;
+            }
+        }
+
+    return ret;
+    }
+
+//----------------------------------------------------------
+// CApAccessPointItem::LeaveIfUnsupportedL
+//----------------------------------------------------------
+//
+void CApAccessPointItem::LeaveIfUnsupportedL( TApMember aColumn )
+    {
+    if( !IsSupported( aColumn ) )
+        {
+        User::Leave( KErrNotSupported );
+        }
+    }
+
+
+
+
+//----------------------------------------------------------
+// CApAccessPointItem::IsWlan
+//----------------------------------------------------------
+//
+TBool CApAccessPointItem::IsWlan()
+    {
+    TBool retval( EFalse );
+    if ( iExt->iWlanData )
+        {
+        retval = iExt->iWlanData->iIsWlan;
+        }
+    return retval;
+    }
+
+
+//----------------------------------------------------------
+// CApAccessPointItem::LimitIp6DNSL
+//----------------------------------------------------------
+//
+void CApAccessPointItem::LimitIp6DNSL()
+    {
+    if ( iExt->iIsIpv6Supported )
+        {
+        if ( ( iExt->iIpv6PrimaryDNS->Compare( KDynIpv6Address ) == 0 ) &&
+             ( iExt->iIpv6SecondaryDNS->Compare( KDynIpv6Address ) == 0 ) )
+            {
+            WriteTextL( EApIP6NameServer1, KWellKnownIp6PrimaryNameServer );
+            WriteTextL( EApIP6NameServer2, KWellKnownIp6SecondaryNameServer );
+            }
+        }
+    
+    }
+    
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apeng/src/APDataHandler.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,4358 @@
+/*
+* Copyright (c) 2002 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 CApDataHandler
+*
+*/
+
+
+// INCLUDE FILES
+#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include <nifvar_internal.h>
+#endif
+#include "APEngineVariant.hrh"
+
+#include <cdbcols.h>
+#include <commdb.h>
+#include <cdbpreftable.h>
+#include <etelpckt.h>
+#include <featmgr.h>
+#ifdef __TEST_USE_SHARED_DATA
+    #include <SharedDataClient.h>
+    #include <sharedDataValues.h>
+#endif //__TEST_USE_SHARED_DATA
+#include <WlanCdbCols.h>
+
+#include "ApDataHandler.h"
+#include "ApAccessPointItem.h"
+#include "ApEngineCommons.h"
+#include "ApUtils.h"
+#include "ApEngineVer.h"
+#include "ApEngineLogger.h"
+#include "ApNetworkItem.h"
+#include "APItemExtra.h"
+#include "APItemCdmaData.h"
+#include "APItemWlanData.h"
+#include "ApSpeedLookup.h"
+
+#include <WEPSecuritySettingsUI.h>
+#include <WPASecuritySettingsUI.h>
+
+
+// CONSTANTS
+#if defined(_DEBUG)
+    _LIT( KErrInvalidIntendedType, "Invalid intended default type" );
+#endif // (_DEBUG)
+_LIT( KErrNoSuchCase, "No such case" );
+
+
+// Agreed GPRS_QOS_WARNING_TIMEOUT Value
+const TInt KGprsOsTimeout = -1;
+
+/**
+* General Settings UID
+*/
+#ifdef __TEST_USE_SHARED_DATA
+    LOCAL_D const TUid KGeneralSettingsUid = { 0X100058EC };
+#endif // __TEST_USE_SHARED_DATA
+
+
+
+
+
+
+_LIT( KWlanBearerName, "WLANBearer" );
+_LIT( KWlanBearerAgent, "wlanagt.agt" );
+_LIT( KWlanBearerNif, "wlannif" );
+
+_LIT( KWlanLDDName, "not used" );
+_LIT( KWlanPDDName, "not used" );
+
+const TInt KWlanLastSocketActivityTimeout = -1;
+const TInt KWlanLastSessionClosedTimeout = 1;
+const TInt KWlanLastSocketClosedTimeout = -1;
+
+
+
+
+
+
+// MACROS
+
+
+// LOCAL FUNCTION PROTOTYPES
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// C++ default constructor can NOT contain any code that
+// might leave.
+//
+// ---------------------------------------------------------
+// CApDataHandler::NewLC
+// ---------------------------------------------------------
+//
+EXPORT_C CApDataHandler* CApDataHandler::NewLC( CCommsDatabase& aDb )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::NewLC" ) ) );
+
+    CApDataHandler* db = new( ELeave ) CApDataHandler;
+    CleanupStack::PushL( db );
+    db->ConstructL( aDb );
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::NewLC" ) ) );
+
+    return db;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApDataHandler::~CApDataHandler
+// ---------------------------------------------------------
+//
+EXPORT_C CApDataHandler::~CApDataHandler()
+    {
+    if ( iExt )
+        {
+        if ( iExt->iIsFeatureManagerInitialised )
+            {
+            FeatureManager::UnInitializeLib();
+            }
+        }
+    delete iExt;
+    }
+
+
+// ---------------------------------------------------------
+// CApDataHandler::CApDataHandler
+// ---------------------------------------------------------
+//
+EXPORT_C CApDataHandler::CApDataHandler( )
+    {
+    iDb = NULL;
+    }
+
+
+// ---------------------------------------------------------
+// CApDataHandler::ConstructL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApDataHandler::ConstructL( CCommsDatabase& aDb )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::ConstructL" ) ) );
+
+    iExt = new ( ELeave )THandlerExtra;
+    iExt->iIsFeatureManagerInitialised = EFalse;
+    iExt->iIsIpv6Supported = EFalse;
+    
+    FeatureManager::InitializeLibL();
+    iExt->iIsFeatureManagerInitialised = ETrue;
+
+    iExt->iIsIpv6Supported = 
+                            FeatureManager::FeatureSupported( KFeatureIdIPv6 );
+#ifdef __TEST_IPV6_SUPPORT    
+    iExt->iIsIpv6Supported = ETrue;
+#endif //  __TEST_IPV6_SUPPORT    
+    
+    iDb = &aDb;
+
+#ifdef __TEST_USE_SHARED_DATA
+    iExt->iIsAppHscsdSupport = 
+        ApCommons::IsGivenSharedDataSupportL( KGeneralSettingsUid, 
+                                              KGSHSCSDAccessPoints );
+#else
+    iExt->iIsAppHscsdSupport = ETrue;
+#endif // __TEST_USE_SHARED_DATA
+
+
+#ifdef __TEST_HSCSD_SUPPORT
+    iExt->iIsAppHscsdSupport = ETrue;
+#endif // __TEST_HSCSD_SUPPORT
+
+    iExt->iVariant = ApCommons::GetVariantL();
+
+#ifdef __TEST_CDMA_WRITE_PROTECT
+    iExt->iVariant |= KApUiEditOnlyVPNs;
+#endif // __TEST_CDMA_WRITE_PROTECT
+
+
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::ConstructL" ) ) );
+    }
+
+
+// query
+// ---------------------------------------------------------
+// CApDataHandler::AccessPointDataL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApDataHandler::AccessPointDataL( TUint32 aUid,
+                                              CApAccessPointItem& aApItem )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::AccessPointDataL" ) ) );
+
+    // returns the AP data of the record with the UID aUid
+    TBool ownTransaction = ApCommons::StartPushedTransactionLC( *iDb );
+    DoAccessPointDataL( aUid, aApItem );
+    if ( ownTransaction )
+        {
+        ApCommons::CommitTransaction( *iDb );
+        CleanupStack::Pop(); // RollbackTransactionOnLeave
+        }
+    aApItem.SanityCheckOk();
+
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::AccessPointDataL" ) ) );
+    }
+
+
+
+// update
+// ---------------------------------------------------------
+// CApDataHandler::UpdateAccessPointDataL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApDataHandler::UpdateAccessPointDataL
+                                                (
+                                                CApAccessPointItem& aApItem,
+                                                TBool& aNameChanged
+                                                )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::UpdateAccessPointDataL" ) ) );
+
+    if ( iExt->iVariant & KApUiEditOnlyVPNs )
+        {
+        User::Leave( KErrNotSupported );
+        }
+
+    // update access point data.
+    aApItem.SanityCheckOk();
+
+    TBool ownTransaction = ApCommons::StartPushedTransactionLC( *iDb );
+    DoUpdateAccessPointDataL( aApItem, EFalse, aNameChanged );
+    if ( ownTransaction )
+        {
+        ApCommons::CommitTransaction( *iDb );
+        CleanupStack::Pop(); // RollbackTransactionOnLeave
+        }
+
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::UpdateAccessPointDataL" ) ) );
+    }
+
+
+
+// Creating new AP
+// ---------------------------------------------------------
+// CApDataHandler::CreateCopyFromL
+// ---------------------------------------------------------
+//
+EXPORT_C TUint32 CApDataHandler::CreateCopyFromL( TUint32 aBaseId )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::CreateCopyFromL" ) ) );
+
+    if ( iExt->iVariant & KApUiEditOnlyVPNs )
+        {
+        User::Leave( KErrNotSupported );
+        }
+
+    CApAccessPointItem* holder = CApAccessPointItem::NewLC();
+
+    TBool ownTransaction = ApCommons::StartPushedTransactionLC( *iDb );
+    AccessPointDataL( aBaseId, *holder );
+    TUint32 oldwlanid( 0 );
+    holder->ReadUint( EApIapServiceId, oldwlanid );
+    
+    TUint32 retval( 0 );
+    TBool aNameChanged( EFalse );
+    
+    TApBearerType bearer = holder->BearerTypeL();
+    CWEPSecuritySettings* wepSecSettings = NULL;
+    CWPASecuritySettings* wpaSecSettings( NULL );
+    // only one of the above might be loaded once, so after copying
+    // we might need to PopAndDestroy only one item
+    TBool pushed(EFalse);
+
+    if ( bearer == EApBearerTypeWLAN )
+        {
+        TUint32 secmode( 0 );
+        holder->ReadUint( EApWlanSecurityMode, secmode );
+        switch ( secmode )
+            {
+            case EOpen:
+                {
+                break;
+                }
+            case EWep:
+                {
+                wepSecSettings = CWEPSecuritySettings::NewL();
+                CleanupStack::PushL( wepSecSettings );
+                pushed = ETrue;
+                TUint32 wlanid( 0 );
+                holder->ReadUint( EApIapServiceId, wlanid );
+                wepSecSettings->LoadL( wlanid, *iDb );
+                break;
+                }
+            case E802_1x:
+                {
+                wpaSecSettings = 
+                    CWPASecuritySettings::NewL( ESecurityMode8021x );
+                CleanupStack::PushL( wpaSecSettings );
+                pushed = ETrue;
+                TUint32 wlanid( 0 );
+                holder->ReadUint( EApIapServiceId, wlanid );
+                wpaSecSettings->LoadL( wlanid, *iDb );
+                break;
+                }
+            case EWpa:
+            case EWpa2:
+                {
+                wpaSecSettings = 
+                        CWPASecuritySettings::NewL( ESecurityModeWpa );
+                CleanupStack::PushL( wpaSecSettings );
+                pushed = ETrue;
+                TUint32 wlanid( 0 );
+                holder->ReadUint( EApIapServiceId, wlanid );
+                wpaSecSettings->LoadL( wlanid, *iDb );
+                break;
+                }
+            default:
+                {
+                __ASSERT_DEBUG( EFalse, ApCommons::Panic( ENotSupported ) );
+                // do nothing in urel
+                break;
+                }
+            }
+        
+        }
+    
+    retval = DoUpdateAccessPointDataL( *holder, ETrue, aNameChanged );
+    
+    if ( bearer == EApBearerTypeWLAN )
+        {
+        TUint32 wlanid(0);
+        holder->ReadUint( EApIapServiceId, wlanid );        
+        // now check if it is WEP...
+        // read up security mode
+        TUint32 secmode( 0 );
+        holder->ReadUint( EApWlanSecurityMode, secmode );
+        switch ( secmode )
+            {
+            case EOpen:
+                {
+                break;
+                }
+            case EWep:
+                {
+                // we have to try to save
+                wepSecSettings->SaveL( wlanid, *iDb );
+                break;
+                }
+            case E802_1x:
+                {
+                wpaSecSettings->SaveL( wlanid, *iDb, 
+                                       ESavingNewAPAsACopy, oldwlanid );
+                break;
+                }
+            case EWpa:
+            case EWpa2:
+                {
+                wpaSecSettings->SaveL( wlanid, *iDb,
+                                       ESavingNewAPAsACopy, oldwlanid );
+                break;
+                }
+            default:
+                {
+                __ASSERT_DEBUG( EFalse, ApCommons::Panic( ENotSupported ) );
+                // do nothing in urel
+                break;
+                }
+            }
+        }
+    if ( pushed )        
+        {
+        CleanupStack::PopAndDestroy(); // the sec. settings
+        }
+        
+    if ( ownTransaction )
+        {
+        ApCommons::CommitTransaction( *iDb );
+        CleanupStack::Pop(); // RollbackTransactionOnLeave
+        }
+    CleanupStack::PopAndDestroy( holder );    // holder
+
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::CreateCopyFromL" ) ) );
+    return retval;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApDataHandler::CreateFromDataL
+// ---------------------------------------------------------
+//
+EXPORT_C TUint32 CApDataHandler::CreateFromDataL( CApAccessPointItem& aApItem )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::CreateFromDataL" ) ) );
+
+    if ( iExt->iVariant & KApUiEditOnlyVPNs )
+        {
+        User::Leave( KErrNotSupported );
+        }
+
+    aApItem.SanityCheckOk();
+
+    TBool aNameChanged( EFalse );
+    TBool ownTransaction = ApCommons::StartPushedTransactionLC( *iDb );
+    TUint32 retval = DoUpdateAccessPointDataL( aApItem, ETrue, aNameChanged );
+    if ( ownTransaction )
+        {
+        ApCommons::CommitTransaction( *iDb );
+        CleanupStack::Pop(); // RollbackTransaction
+        }
+
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::CreateFromDataL" ) ) );
+    return retval;
+    }
+
+
+
+// Remove
+// ---------------------------------------------------------
+// CApDataHandler::RemoveAP
+// ---------------------------------------------------------
+//
+EXPORT_C void CApDataHandler::RemoveAPL( TUint32 aUid )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::RemoveAPL" ) ) );
+
+    if ( iExt->iVariant & KApUiEditOnlyVPNs )
+        {
+        User::Leave( KErrNotSupported );
+        }
+
+    TBool ownTransaction = ApCommons::StartPushedTransactionLC( *iDb );
+    DoRemoveAPL( aUid );
+    if ( ownTransaction )
+        {
+        ApCommons::CommitTransaction( *iDb );
+        CleanupStack::Pop(); // RollbackTransactionOnLeave
+        }
+
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::RemoveAPL" ) ) );
+    }
+
+
+// Getting default access point
+// ---------------------------------------------------------
+// CApDataHandler::DefaultL
+// ---------------------------------------------------------
+//
+EXPORT_C TUint32 CApDataHandler::DefaultL( TBool aIsWap ) const
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::DefaultL" ) ) );
+
+    // get default AP...
+    // first get global settings...
+    TBool ownTransaction = ApCommons::StartPushedTransactionLC( *iDb );
+    TUint32 value = DoGetDefaultL( aIsWap, NULL );
+    if ( ownTransaction )
+        {
+        ApCommons::CommitTransaction( *iDb );
+        CleanupStack::Pop(); // RollbackTransactionOnLeave
+        }
+
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::DefaultL" ) ) );
+    return value;
+    }
+
+
+
+// Setting as default
+// ---------------------------------------------------------
+// CApDataHandler::SetAsDefaultL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApDataHandler::SetAsDefaultL( TUint32 aUid,
+                                            TCommsDbIspType aIntendedType )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::SetAsDefaultL" ) ) );
+
+    if ( iExt->iVariant & KApUiEditOnlyVPNs )
+        {
+        User::Leave( KErrNotSupported );
+        }
+
+    TBool ownTransaction = ApCommons::StartPushedTransactionLC( *iDb );
+    DoSetAsDefaultL( aUid, aIntendedType );
+    if ( ownTransaction )
+        {
+        ApCommons::CommitTransaction( *iDb );
+        CleanupStack::Pop(); // RollbackTransactionOnLeave
+        }
+
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::SetAsDefaultL" ) ) );
+    }
+
+
+// ---------------------------------------------------------
+// ---------------------------------------------------------
+// Connection Preferene Handling
+// ---------------------------------------------------------
+// ---------------------------------------------------------
+
+
+// ---------------------------------------------------------
+// CApDataHandler::SetPreferredIfDbIapTypeL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApDataHandler::SetPreferredIfDbIapTypeL
+                                    (
+                                    TUint32 aRank,
+                                    TCommDbConnectionDirection aDirection,
+                                    TUint32 aBearers,
+                                    TCommDbDialogPref aPrompt,
+                                    TUint32 aIAP,
+                                    TBool aOverwrite
+                                    )
+    {
+    CLOG( ( EHandler, 0, 
+        _L( "-> CApDataHandler::SetPreferredIfDbIapTypeL" ) ) );
+
+    if ( iExt->iVariant & KApUiEditOnlyVPNs )
+        {
+        User::Leave( KErrNotSupported );
+        }
+
+    TBool ownTransaction = ApCommons::StartPushedTransactionLC( *iDb );
+    DoSetPreferredIfDbIapTypeL( aRank, aDirection, aBearers,
+                                           aPrompt, aIAP, aOverwrite);
+    if ( ownTransaction )
+        {
+        ApCommons::CommitTransaction( *iDb );
+        CleanupStack::Pop(); // RollbackTransactionOnLeave
+        }
+
+    CLOG( ( EHandler, 1, 
+        _L( "<- CApDataHandler::SetPreferredIfDbIapTypeL" ) ) );
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CApDataHandler::SetPreferredIfDbIspTypeL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApDataHandler::SetPreferredIfDbIspTypeL
+                                    (
+                                    TUint32 aRank,
+                                    TCommDbConnectionDirection aDirection,
+                                    TUint32 aBearers,
+                                    TCommDbDialogPref aPrompt,
+                                    TUint32 aISP,
+                                    TUint32 aChargeCard,
+                                    const TDesC& aServiceType,
+                                    TBool aOverwrite
+                                    )
+    {
+    CLOG( ( EHandler, 0, 
+        _L( "-> CApDataHandler::SetPreferredIfDbIspTypeL" ) ) );
+
+    if ( iExt->iVariant & KApUiEditOnlyVPNs )
+        {
+        User::Leave( KErrNotSupported );
+        }
+
+    TBool ownTransaction = ApCommons::StartPushedTransactionLC( *iDb );
+    DoSetPreferredIfDbIspTypeL( aRank, aDirection, aBearers, aPrompt,
+                                aISP, aChargeCard, aServiceType, aOverwrite);
+    if ( ownTransaction )
+        {
+        ApCommons::CommitTransaction( *iDb );
+        CleanupStack::Pop(); // RollbackTransactionOnLeave
+        }
+
+    CLOG( ( EHandler, 1, 
+        _L( "<- CApDataHandler::SetPreferredIfDbIspTypeL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApDataHandler::GetPreferredIfDbIapTypeL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApDataHandler::GetPreferredIfDbIapTypeL
+                                    (
+                                    TUint32 aRank,
+                                    TCommDbConnectionDirection aDirection,
+                                    TUint32& aBearers,
+                                    TUint32& aPrompt,
+                                    TUint32& aIAP
+                                    )
+    {
+    CLOG( ( EHandler, 0, 
+        _L( "-> CApDataHandler::GetPreferredIfDbIapTypeL" ) ) );
+
+    TBool ownTransaction = ApCommons::StartPushedTransactionLC( *iDb );
+    CCommsDbConnectionPrefTableView* preft =
+           iDb->OpenConnectionPrefTableViewOnRankLC( aDirection, aRank );
+    TInt err = preft->GotoFirstRecord(); // OK.
+    if ( err == KErrNone )
+        { // record has been found
+        CCommsDbConnectionPrefTableView::TCommDbIapConnectionPref pref;
+        preft->ReadConnectionPreferenceL( pref );
+        aBearers = pref.iBearer.iBearerSet;
+        aPrompt = pref.iDialogPref;
+        aIAP = pref.iBearer.iIapId;
+        }
+    else
+        {
+        User::Leave( err );
+        }
+    CleanupStack::PopAndDestroy( preft ); // preft
+
+    if ( ownTransaction )
+        {
+        ApCommons::CommitTransaction( *iDb );
+        CleanupStack::Pop(); // RollbackTransactionOnLeave
+        }
+
+    CLOG( ( EHandler, 1, 
+        _L( "<- CApDataHandler::GetPreferredIfDbIapTypeL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApDataHandler::GetPreferredIfDbIspTypeL
+// ---------------------------------------------------------
+//
+EXPORT_C const TDesC& CApDataHandler::GetPreferredIfDbIspTypeL
+                                    (
+                                    TUint32 /*aRank*/,
+                                    TCommDbConnectionDirection /*aDirection*/,
+                                    TUint32& /*aBearers*/,
+                                    TUint32& /*aPrompt*/,
+                                    TUint32& /*aISP*/,
+                                    TUint32& /*aChargeCard*/
+                                    )
+    {
+    CLOG( ( EHandler, 0, 
+        _L( "<-> CApDataHandler::GetPreferredIfDbIspTypeL" ) ) );
+
+    User::Leave( KErrNotSupported );
+
+    return KErrNoSuchCase;
+
+    }
+
+
+
+// ---------------------------------------------------------
+// CApDataHandler::GetPreferredIfDbIspTypeL
+// ---------------------------------------------------------
+//
+EXPORT_C TUint32 CApDataHandler::DefaultL( TBool aIsWap,
+                                                 TBool& aReadOnly ) const
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::DefaultL" ) ) );
+
+    // get default AP...
+    // first get global settings...
+    TBool ownTransaction = ApCommons::StartPushedTransactionLC( *iDb );
+    TUint32 value = DoGetDefaultL( aIsWap, &aReadOnly );
+    if ( ownTransaction )
+        {
+        ApCommons::CommitTransaction( *iDb );
+        CleanupStack::Pop(); // RollbackTransactionOnLeave
+        }
+
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::DefaultL" ) ) );
+    return value;
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CApDataHandler::RemoveNetworkL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApDataHandler::RemoveNetworkL( TUint32 aUid )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::RemoveNetworkL" ) ) );
+
+    if ( iExt->iVariant & KApUiEditOnlyVPNs )
+        {
+        User::Leave( KErrNotSupported );
+        }
+
+    TBool ownTransaction = ApCommons::StartPushedTransactionLC( *iDb );
+    CCommsDbTableView* nettable =
+        iDb->OpenViewMatchingUintLC( TPtrC(NETWORK), 
+                                     TPtrC(COMMDB_ID), 
+                                     aUid );
+    TInt err = nettable->GotoFirstRecord();
+    if ( err == KErrNone )
+        {
+        nettable->DeleteRecord();
+        }
+    else
+        {
+        if ( err != KErrNotFound )
+            {
+            User::Leave( err );
+            }
+        }
+    CleanupStack::PopAndDestroy( nettable ); // RollbackTransactionOnLeave
+    if ( ownTransaction )
+        {
+        ApCommons::CommitTransaction( *iDb );
+        CleanupStack::Pop(); // RollbackTransactionOnLeave
+        }
+
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::RemoveNetworkL" ) ) );
+    }
+
+
+// ---------------------------------------------------------
+// CApDataHandler::CreateNetworkL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApDataHandler::CreateNetworkL( CApNetworkItem& aNetwork )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::CreateNetworkL" ) ) );
+
+    if ( iExt->iVariant & KApUiEditOnlyVPNs )
+        {
+        User::Leave( KErrNotSupported );
+        }
+
+    CApAccessPointItem* aApItem = CApAccessPointItem::NewLC();
+    aApItem->WriteTextL( EApNetworkName, aNetwork.Name() );
+    WriteNetworkDataL( ETrue, *aApItem );
+    TUint32 tempuint( 0 );
+    aApItem->ReadUint( EApNetworkID, tempuint );
+    aNetwork.SetUid( tempuint );
+    CleanupStack::PopAndDestroy( aApItem );
+
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::CreateNetworkL" ) ) );
+    }
+
+
+// ---------------------------------------------------------
+// CApDataHandler::ReadNetworkPartL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApDataHandler::ReadNetworkPartL( CApAccessPointItem& aItem )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::ReadNetworkPartL" ) ) );
+
+    ReadNetworkDataL( aItem );
+
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::ReadNetworkPartL" ) ) );
+    }
+
+
+// ---------------------------------------------------------
+// CApDataHandler::ReadNetworkL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApDataHandler::ReadNetworkL( TUint32 aUid, 
+                                            CApNetworkItem& aNetwork )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::ReadNetworkL" ) ) );
+
+    CApAccessPointItem* aItem = CApAccessPointItem::NewLC();
+    aItem->WriteUint( EApNetworkID, aUid );
+    ReadNetworkDataL( *aItem );
+    TUint32 length = aItem->ReadTextLengthL( EApNetworkName );
+    HBufC* buf = HBufC::NewLC( length );
+    TPtr16 ptr = buf->Des();
+    aItem->ReadTextL( EApNetworkName, ptr );
+    aNetwork.SetUid( aUid );
+    aNetwork.SetNameL( ptr );
+    CleanupStack::PopAndDestroy( buf );
+    CleanupStack::PopAndDestroy( aItem );
+
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::ReadNetworkL" ) ) );
+    }
+
+
+// ================= OTHER EXPORTED FUNCTIONS ==============
+
+
+// ================= PROTECTED FUNCTIONS ==============
+
+// ---------------------------------------------------------
+// CApDataHandler::ReadWapDataL
+// ---------------------------------------------------------
+//
+void CApDataHandler::ReadWapDataL( TUint32 aWapId,
+                                  CApAccessPointItem& aApItem )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::ReadWapDataL" ) ) );
+
+    // internal function, caller MUST initiate a transaction, WE WILL NOT.
+    CCommsDbTableView* wapt;
+    wapt = iDb->OpenViewMatchingUintLC( TPtrC(WAP_ACCESS_POINT),
+                                       TPtrC(COMMDB_ID), aWapId );
+
+
+    User::LeaveIfError( wapt->GotoFirstRecord() );
+
+    aApItem.WriteUint( EApWapAccessPointID, aWapId );
+
+    TInt err;
+    HBufC* buf = ApCommons::ReadLongTextLC( wapt,
+                                             TPtrC(WAP_START_PAGE),
+                                             err );
+    if ( err != KErrUnknown )
+        {
+        aApItem.WriteLongTextL( EApWapStartPage, *buf );
+        CleanupStack::PopAndDestroy( buf ); 
+        }
+
+    buf = ApCommons::ReadText16ValueLC( wapt, TPtrC(WAP_CURRENT_BEARER) );
+    aApItem.WriteTextL( EApWapCurrentBearer, *buf );
+    CleanupStack::PopAndDestroy( buf );
+
+    buf = ApCommons::ReadText16ValueLC( wapt, TPtrC(COMMDB_NAME) );
+    aApItem.WriteTextL( EApWapAccessPointName, *buf );
+    CleanupStack::PopAndDestroy( buf );
+
+
+    TBool readonly = ApCommons::DoGetReadOnlyL( *wapt );
+    // not WriteBool, as it is 'write protected'...
+    aApItem.iIsReadOnly = readonly;
+
+    CCommsDbTableView* bearert;
+    bearert = iDb->OpenViewMatchingUintLC( *aApItem.iWapBearer,
+                                          TPtrC(WAP_ACCESS_POINT_ID), aWapId );
+
+    User::LeaveIfError( bearert->GotoFirstRecord() );
+    // now we can read common data
+    buf = ApCommons::ReadText16ValueLC( bearert,
+                                         TPtrC( WAP_GATEWAY_ADDRESS ) );
+    aApItem.WriteTextL( EApWapGatewayAddress, *buf );
+    CleanupStack::PopAndDestroy( buf );
+
+
+    TUint32 tempint( 0 );
+    TBool tempbool( EFalse );
+
+    ApCommons::ReadUintL( bearert, TPtrC(WAP_WSP_OPTION), tempint );
+    aApItem.WriteUint( EApWapWspOption, tempint );
+
+    ApCommons::ReadBoolL( bearert, TPtrC(WAP_SECURITY), tempbool );
+    aApItem.WriteBool( EApWapSecurity, tempbool );
+
+    aApItem.SpecifyWap( ETrue );
+    // decide which bearer, read bearer spec. data.
+    if ( *aApItem.iWapBearer == TPtrC(WAP_IP_BEARER) )
+        {
+        // init it, if it is specified in IAP, will override this...
+        aApItem.WriteUint( EApIapServiceId, tempint );
+
+        ApCommons::ReadUintL( bearert, TPtrC(WAP_IAP), tempint );
+        aApItem.WriteUint( EApWapIap, tempint );
+
+        ApCommons::ReadUintL( bearert, TPtrC(WAP_PROXY_PORT), tempint );
+        aApItem.WriteUint( EApWapProxyPort, tempint );
+
+        buf = ApCommons::ReadText16ValueLC( bearert, 
+                                            TPtrC(WAP_PROXY_LOGIN_NAME) );
+        aApItem.WriteTextL( EApProxyLoginName, *buf );
+        CleanupStack::PopAndDestroy( buf );
+
+
+        buf = ApCommons::ReadText16ValueLC( bearert, 
+                                            TPtrC(WAP_PROXY_LOGIN_PASS) );
+        aApItem.WriteTextL( EApProxyLoginPass, *buf );
+        CleanupStack::PopAndDestroy( buf );
+
+
+
+        aApItem.SpecifyIpBearer( ETrue );
+        }
+    else
+        {
+        User::Leave( KErrInvalidBearer );
+        }
+    CleanupStack::PopAndDestroy( 2, wapt );    // bearert, wapt
+
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::ReadWapDataL" ) ) );
+    }
+
+
+// ---------------------------------------------------------
+// CApDataHandler::ReadIapDataL
+// ---------------------------------------------------------
+//
+void CApDataHandler::ReadIapDataL( TUint32 aIapId,
+                                   CApAccessPointItem& aApItem )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::ReadIapDataL" ) ) );
+
+    // internal function, caller MUST initiate a transaction, WE WILL NOT.
+    CCommsDbTableView* iapt = iDb->OpenViewMatchingUintLC( TPtrC(IAP),
+                                           TPtrC(COMMDB_ID), aIapId );
+
+    User::LeaveIfError( iapt->GotoFirstRecord() );
+    // can not be more than one record,
+    // because we are looking up about UID!
+    aApItem.WriteUint( EApWapIap, aIapId );
+
+    HBufC* buf = ApCommons::ReadText16ValueLC( iapt, TPtrC(COMMDB_NAME) );
+    aApItem.WriteTextL( EApIapName, *buf );
+    CleanupStack::PopAndDestroy( buf );
+
+    TUint32 tempint;
+
+    ApCommons::ReadUintL( iapt, TPtrC(IAP_SERVICE), tempint );
+    aApItem.WriteUint( EApIapServiceId, tempint );
+
+
+    buf = ApCommons::ReadText16ValueLC( iapt, TPtrC(IAP_SERVICE_TYPE) );
+    aApItem.WriteTextL( EApIapServiceType, *buf );
+    CleanupStack::PopAndDestroy( buf );
+
+
+    ApCommons::ReadUintL( iapt, TPtrC(IAP_BEARER), tempint );
+    aApItem.WriteUint( EApIapBearerID, tempint );
+
+    buf = ApCommons::ReadText16ValueLC( iapt, TPtrC(IAP_BEARER_TYPE) );
+    aApItem.WriteTextL( EApIapBearerType, *buf );
+    CleanupStack::PopAndDestroy( buf );
+
+    ReadModemBearerNameL( aApItem );
+
+    ApCommons::ReadUintL( iapt, TPtrC(IAP_NETWORK), tempint );
+    aApItem.iNetworkId = tempint;
+
+    // Network weighting!
+    ApCommons::ReadUintL( iapt, TPtrC(IAP_NETWORK_WEIGHTING), tempint );
+    
+/*
+    // seems that location is fixed so no read...
+    ApCommons::ReadUintL( iapt, TPtrC(IAP_LOCATION), tempint );
+    aApItem.i = tempint;
+*/
+
+
+    aApItem.SpecifyIAP( ETrue );
+    CleanupStack::PopAndDestroy( iapt );  // iapt
+
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::ReadIapDataL" ) ) );
+    }
+
+
+
+
+
+// ---------------------------------------------------------
+// CApDataHandler::ReadIspDataL
+// ---------------------------------------------------------
+//
+void CApDataHandler::ReadIspDataL( TUint32 aIspId, 
+                                   CApAccessPointItem& aApItem )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::ReadIspDataL" ) ) );
+
+    /*****************************************************
+    *   Series 60 Customer / ETel
+    *   Series 60  ETel API
+    *****************************************************/
+    // internal function, caller MUST initiate a transaction, WE WILL NOT.
+    HBufC* buf = HBufC::NewLC( KModifiableTextLength );
+    TPtr16 ptr = buf->Des();
+    aApItem.ReadTextL( EApIapServiceType, ptr );
+
+    if ( ( buf->Compare( TPtrC(OUTGOING_WCDMA ) ) == 0 ) ||
+        ( buf->Compare( TPtrC(INCOMING_WCDMA ) ) == 0 ) )
+        {
+        ReadGprsDataL( aIspId, aApItem );
+        }
+    else
+        {
+        if ( ( buf->Compare( TPtrC(DIAL_OUT_ISP ) ) == 0 ) ||
+            ( buf->Compare( TPtrC(DIAL_IN_ISP ) ) == 0 ) )
+            {
+            ReadDialInOutDataL( aIspId, aApItem );
+            }
+        else
+            { // e.g. vpn...
+            if ( buf->Compare( TPtrC(VPN_SERVICE) ) == 0 )
+                { // VPN
+                aApItem.iExt->iIsVpnAp = ETrue;
+                // get vpn bearer type
+                ReadVpnInfoL( aIspId, aApItem );
+                }
+            else
+                {
+                if ( buf->Compare( TPtrC(LAN_SERVICE) ) == 0 )
+                    { // LAN
+                    // get LAN data (WLAN)
+                    ReadLanDataL( aIspId, aApItem );
+                    }
+                else
+                    {
+                    User::Leave( KErrInvalidBearer );
+                    }
+                }
+            }
+        }
+    CleanupStack::PopAndDestroy( buf );   // buf
+
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::ReadIspDataL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApDataHandler::ReadGprsDataL
+// ---------------------------------------------------------
+//
+void CApDataHandler::ReadGprsDataL( TUint32 aIspId,
+                                    CApAccessPointItem& aApItem )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::ReadGprsDataL" ) ) );
+
+    // internal function, caller MUST initiate a transaction, WE WILL NOT.
+    CCommsDbTableView* ispt = NULL;
+
+    HBufC* servtype = HBufC::NewLC( KModifiableTextLength );
+    TPtr16 ptr = servtype->Des();
+    aApItem.ReadTextL( EApIapServiceType, ptr );
+
+    if ( servtype->Compare( TPtrC(OUTGOING_WCDMA ) ) == 0 )
+        {
+        ispt = iDb->OpenViewMatchingUintLC( TPtrC(OUTGOING_WCDMA),
+                                           TPtrC(COMMDB_ID),
+                                           aIspId );
+        }
+    else
+        {
+        if ( servtype->Compare( TPtrC(INCOMING_WCDMA ) ) == 0 )
+            {
+            ispt = iDb->OpenViewMatchingUintLC( TPtrC(INCOMING_WCDMA),
+                                               TPtrC(COMMDB_ID),
+                                               aIspId );
+            }
+        else
+            {
+            User::Leave( KErrInvalidBearer );
+            }
+        }
+
+
+    User::LeaveIfError( ispt->GotoFirstRecord() );
+
+    // now read record data
+    HBufC* buf = ApCommons::ReadText16ValueLC( ispt, TPtrC(COMMDB_NAME) );
+    aApItem.WriteTextL( EApIspName, *buf );
+    CleanupStack::PopAndDestroy( buf );
+
+    TInt err( KErrNone );
+    buf = ApCommons::ReadLongTextLC( ispt, TPtrC(GPRS_APN), err );
+    if ( err != KErrUnknown )
+        {
+        aApItem.WriteLongTextL( EApGprsAccessPointName, *buf );
+        CleanupStack::PopAndDestroy( buf );
+        }
+
+    TUint32 tempint( 0 );
+    TBool   tempbool( EFalse );
+
+    ApCommons::ReadUintL( ispt, TPtrC(GPRS_PDP_TYPE), tempint );
+    if ( tempint == RPacketContext::EPdpTypeIPv6 )
+        {
+        aApItem.WriteUint( EApGprsPdpType, EIPv6 );
+        }
+    else
+        {
+        aApItem.WriteUint( EApGprsPdpType, EIPv4 );
+        }
+
+    buf = ApCommons::ReadText16ValueLC( ispt, TPtrC(GPRS_PDP_ADDRESS) );
+    aApItem.WriteTextL( EApGprsPdpAddress, *buf );
+    CleanupStack::PopAndDestroy( buf );
+
+    ApCommons::ReadUintL( ispt, TPtrC(GPRS_REQ_PRECEDENCE), tempint );
+    aApItem.WriteUint( EApGprsReqPrecedence, tempint);
+
+    ApCommons::ReadUintL( ispt, TPtrC(GPRS_REQ_DELAY), tempint );
+    aApItem.WriteUint( EApGprsReqDelay, tempint);
+
+    ApCommons::ReadUintL( ispt, TPtrC(GPRS_REQ_RELIABILITY), tempint );
+    aApItem.WriteUint( EApGprsReqReliability, tempint);
+
+    ApCommons::ReadUintL( ispt, TPtrC(GPRS_REQ_PEAK_THROUGHPUT), tempint );
+    aApItem.WriteUint( EApGprsReqPeakThroughput, tempint);
+
+    ApCommons::ReadUintL( ispt, TPtrC(GPRS_REQ_MEAN_THROUGHPUT), tempint );
+    aApItem.WriteUint( EApGprsReqMeanPeakThroughput, tempint);
+
+    ApCommons::ReadUintL( ispt, TPtrC(GPRS_MIN_PRECEDENCE), tempint );
+    aApItem.WriteUint( EApGprsMinPrecedence, tempint);
+
+    ApCommons::ReadUintL( ispt, TPtrC(GPRS_MIN_DELAY), tempint );
+    aApItem.WriteUint( EApGprsMinDelay, tempint);
+
+    ApCommons::ReadUintL( ispt, TPtrC(GPRS_MIN_RELIABILITY), tempint );
+    aApItem.WriteUint( EApGprsMinReliability, tempint);
+
+    ApCommons::ReadUintL( ispt, TPtrC(GPRS_MIN_PEAK_THROUGHPUT), tempint );
+    aApItem.WriteUint( EApGprsMinPeakThroughput, tempint);
+
+    ApCommons::ReadUintL( ispt, TPtrC(GPRS_MIN_MEAN_THROUGHPUT), tempint );
+    aApItem.WriteUint( EApGprsMinMeanThroughput, tempint);
+
+    ApCommons::ReadBoolL( ispt, TPtrC(GPRS_DATA_COMPRESSION), tempbool );
+    aApItem.WriteBool( EApGprsDataCompression, tempbool );
+
+    ApCommons::ReadBoolL( ispt, TPtrC(GPRS_HEADER_COMPRESSION), tempbool );
+    aApItem.WriteBool( EApGprsHeaderCompression, tempbool );
+
+    ApCommons::ReadBoolL( ispt, TPtrC(GPRS_ANONYMOUS_ACCESS), tempbool );
+    aApItem.WriteBool( EApGprsUseAnonymAccess, tempbool );
+
+
+    buf = ApCommons::ReadText16ValueLC( ispt, TPtrC(GPRS_IF_PARAMS) );
+    aApItem.WriteTextL( EApGprsIfParams, *buf );
+    CleanupStack::PopAndDestroy( buf );
+
+    buf = ApCommons::ReadText16ValueLC( ispt, TPtrC(GPRS_IF_NETWORKS) );
+    aApItem.WriteTextL( EApGprsIfNetworks, *buf );
+    CleanupStack::PopAndDestroy( buf );
+
+    ApCommons::ReadBoolL( ispt, TPtrC(GPRS_IF_PROMPT_FOR_AUTH), tempbool );
+    aApItem.WriteBool( EApGprsIfPromptForAuth, tempbool );
+
+
+    buf = ApCommons::ReadText16ValueLC( ispt, TPtrC(GPRS_IF_AUTH_NAME) );
+    aApItem.WriteTextL( EApGprsIfAuthName, *buf );
+    CleanupStack::PopAndDestroy( buf );
+
+    buf = ApCommons::ReadText16ValueLC( ispt, TPtrC(GPRS_IF_AUTH_PASS) );
+    aApItem.WriteTextL( EApGprsIfAuthPassword, *buf );
+    CleanupStack::PopAndDestroy( buf ); 
+
+    ApCommons::ReadUintL( ispt, TPtrC(GPRS_IF_AUTH_RETRIES), tempint );
+    aApItem.WriteUint( EApGprsIfAuthRetries, tempint );
+
+    buf = ApCommons::ReadText16ValueLC( ispt, TPtrC(GPRS_IP_NETMASK) );
+    aApItem.WriteTextL( EApGprsIpNetMask, *buf );
+    CleanupStack::PopAndDestroy( buf );
+
+    buf = ApCommons::ReadText16ValueLC( ispt, TPtrC(GPRS_IP_GATEWAY) );
+    aApItem.WriteTextL( EApGprsIpGateway, *buf );
+    CleanupStack::PopAndDestroy( buf );
+
+    ApCommons::ReadBoolL( ispt, TPtrC(GPRS_IP_ADDR_FROM_SERVER), tempbool );
+    aApItem.WriteBool( EApGprsIpAddrFromServer, tempbool );
+
+    buf = ApCommons::ReadText16ValueLC( ispt, TPtrC(GPRS_IP_ADDR) );
+    aApItem.WriteTextL( EApGprsIpAddr, *buf );
+    CleanupStack::PopAndDestroy( buf );
+
+    ApCommons::ReadBoolL( ispt, TPtrC(GPRS_IP_DNS_ADDR_FROM_SERVER),
+                           tempbool );
+    aApItem.WriteBool( EApGprsIpDnsAddrFromServer, tempbool );
+
+    buf = ApCommons::ReadText16ValueLC( ispt, TPtrC(GPRS_IP_NAME_SERVER1) );
+    aApItem.WriteTextL( EApGprsIPNameServer1, *buf );
+    CleanupStack::PopAndDestroy( buf );
+
+    buf = ApCommons::ReadText16ValueLC( ispt, TPtrC(GPRS_IP_NAME_SERVER2) );
+    aApItem.WriteTextL( EApGprsIPNameServer2, *buf );
+    CleanupStack::PopAndDestroy( buf ); 
+
+    ApCommons::ReadBoolL( ispt, TPtrC(GPRS_ENABLE_LCP_EXTENSIONS), tempbool );
+    aApItem.WriteBool( EApGprsEnableLCPExtensions, tempbool );
+
+
+    ApCommons::ReadBoolL( ispt, TPtrC(GPRS_DISABLE_PLAIN_TEXT_AUTH),
+                           tempbool );
+    aApItem.WriteBool( EApGprsDisablePlainTextAuth, tempbool );
+
+    ApCommons::ReadUintL( ispt, TPtrC(GPRS_AP_TYPE), tempint );
+    aApItem.WriteUint( EApIspIspType, TCommsDbIspType( tempint ) );
+
+    if ( iExt->iIsIpv6Supported )
+        {
+        ReadServiceIp6L( *ispt, aApItem );
+        }
+
+    aApItem.SpecifyGPRS( ETrue );
+    CleanupStack::PopAndDestroy( 2, servtype );  // ispt, servtype
+
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::ReadGprsDataL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApDataHandler::ReadLanDataL
+// ---------------------------------------------------------
+//
+void CApDataHandler::ReadLanDataL( TUint32 aIspId,
+                                   CApAccessPointItem& aApItem )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::ReadLanDataL" ) ) );
+
+    // internal function, caller MUST initiate a transaction, WE WILL NOT.
+    CCommsDbTableView* ispt = NULL;
+
+    ispt = iDb->OpenViewMatchingUintLC( TPtrC(LAN_SERVICE),
+                                           TPtrC(COMMDB_ID),
+                                           aIspId );
+    User::LeaveIfError( ispt->GotoFirstRecord() );
+
+    // now read record data
+    ReadServiceL( *ispt, aApItem );
+
+    CCommsDbTableView* lant = NULL;
+    // now see if it is WLAN
+    
+    if ( aApItem.iExt->iWlanData )
+        { // WLAN is supported
+        lant = iDb->OpenViewMatchingUintLC( TPtrC(WLAN_SERVICE ),
+                                            TPtrC(WLAN_SERVICE_ID),
+                                            aIspId );
+    
+        TInt err = lant->GotoFirstRecord();
+        // it can be Ethernet Lan, WLAN and LanModem, 
+        // from those, only WLAN has these fields,
+        // so if we can read them, it is wlan. If not, it is something else...
+        if ( err == KErrNone )
+            {
+            // now read record data
+            ReadWlanL( *lant, aApItem );
+            aApItem.iExt->iWlanData->iIsWlan = ETrue;
+            }
+        else
+            { 
+            if ( err != KErrNotFound )
+                {
+                User::LeaveIfError( err );
+                }
+            // can not leave on not found error, as it still might be 
+            // a valid bearer after all...
+            aApItem.iExt->iWlanData->iIsWlan = EFalse;
+            }
+        aApItem.SpecifyWLAN( ETrue );
+        CleanupStack::PopAndDestroy( lant ); 
+        }
+        
+    if ( iExt->iIsIpv6Supported )
+        {
+        ReadServiceIp6L( *ispt, aApItem );
+        }
+
+
+
+    CleanupStack::PopAndDestroy( ispt ); 
+
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::ReadLanDataL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApDataHandler::ReadDialInOutDataL
+// ---------------------------------------------------------
+//
+void CApDataHandler::ReadDialInOutDataL( TUint32 aIspId,
+                                         CApAccessPointItem& aApItem )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::ReadDialInOutDataL" ) ) );
+    /*****************************************************
+    *   Series 60 Customer / ETel
+    *   Series 60  ETel API
+    *****************************************************/
+
+    // internal function, caller MUST initiate a transaction, WE WILL NOT.
+    CCommsDbTableView* ispt = NULL;
+
+    HBufC* servtype = HBufC::NewLC( KModifiableTextLength );
+    TPtr16 ptr = servtype->Des();
+    aApItem.ReadTextL( EApIapServiceType, ptr );
+
+    if ( servtype->Compare( TPtrC(DIAL_OUT_ISP) ) == 0 )    
+        {
+        ispt = iDb->OpenViewMatchingUintLC( TPtrC(DIAL_OUT_ISP),
+                                            TPtrC(COMMDB_ID), aIspId );
+        }
+    else
+        {
+        ispt = iDb->OpenViewMatchingUintLC( TPtrC(DIAL_IN_ISP),
+                                            TPtrC(COMMDB_ID), aIspId );
+        }
+
+    User::LeaveIfError( ispt->GotoFirstRecord() );
+
+    TUint32 tempint( 0 );
+    TBool   tempbool( EFalse );
+
+    HBufC* buf = NULL;
+
+    aApItem.WriteUint( EApIapServiceId, aIspId );
+
+
+    buf = ApCommons::ReadText16ValueLC( ispt, TPtrC(COMMDB_NAME) );
+    aApItem.WriteTextL( EApIspName, *buf );
+    CleanupStack::PopAndDestroy( buf ); 
+
+    buf = ApCommons::ReadText16ValueLC( ispt, TPtrC(ISP_DESCRIPTION) );
+    aApItem.WriteTextL( EApIspDescription, *buf );
+    CleanupStack::PopAndDestroy( buf );
+
+
+    ApCommons::ReadUintL( ispt, TPtrC(ISP_TYPE), tempint );
+    aApItem.WriteUint( EApIspIspType, TCommsDbIspType( tempint ) );
+
+    buf = ApCommons::ReadText16ValueLC( ispt,
+                                         TPtrC(ISP_DEFAULT_TEL_NUM) );
+    aApItem.WriteTextL( EApIspDefaultTelNumber, *buf );
+    CleanupStack::PopAndDestroy( buf );
+
+
+    ApCommons::ReadBoolL( ispt, TPtrC(ISP_DIAL_RESOLUTION), tempbool );
+    aApItem.WriteBool( EApIspDialResolution, tempbool );
+
+    ApCommons::ReadBoolL( ispt, TPtrC(ISP_USE_LOGIN_SCRIPT), tempbool );
+    aApItem.WriteBool( EApIspUseLoginScript, tempbool );
+
+    TInt err;
+    buf = ApCommons::ReadLongTextLC( ispt, TPtrC(ISP_LOGIN_SCRIPT), err );
+    aApItem.WriteLongTextL( EApIspLoginScript, *buf );
+    CleanupStack::PopAndDestroy( buf );
+
+
+    ApCommons::ReadBoolL( ispt, TPtrC(ISP_PROMPT_FOR_LOGIN), tempbool );
+    aApItem.WriteBool( EApIspPromptForLogin, tempbool );
+
+    buf = ApCommons::ReadText16ValueLC( ispt, TPtrC(ISP_LOGIN_NAME) );
+    // as same UserName & AuthName is required, it is readed from username
+    aApItem.WriteTextL( EApIspLoginName, *buf );
+    aApItem.WriteTextL( EApIspIfAuthName, *buf );
+    CleanupStack::PopAndDestroy( buf );
+
+
+    buf = ApCommons::ReadText16ValueLC( ispt, TPtrC(ISP_LOGIN_PASS) );
+    // as same Login_pass & AuthPassword is required,
+    // it is readed from login_pass
+    aApItem.WriteTextL( EApIspLoginPass, *buf );
+    aApItem.WriteTextL( EApIspIfAuthPass, *buf );
+    CleanupStack::PopAndDestroy( buf );
+
+
+    ApCommons::ReadBoolL( ispt, TPtrC(ISP_DISPLAY_PCT), tempbool );
+    aApItem.WriteBool( EApIspDisplayPCT, tempbool );
+
+
+    buf = ApCommons::ReadText16ValueLC( ispt, TPtrC(ISP_IF_PARAMS) );
+    aApItem.WriteTextL( EApIspIfParams, *buf );
+    CleanupStack::PopAndDestroy( buf );
+
+    buf = ApCommons::ReadText16ValueLC( ispt, TPtrC(ISP_IF_NETWORKS) );
+    aApItem.WriteTextL( EApIspIfNetworks, *buf );
+    CleanupStack::PopAndDestroy( buf );
+
+    ApCommons::ReadBoolL( ispt, TPtrC(ISP_IF_PROMPT_FOR_AUTH), tempbool );
+    aApItem.WriteBool( EApIspIfPromptForAuth, tempbool );
+
+
+    ApCommons::ReadUintL( ispt, TPtrC(ISP_IF_AUTH_RETRIES), tempint );
+    aApItem.WriteUint( EApIspAuthRetries, tempint );
+
+    ApCommons::ReadBoolL( ispt,
+                           TPtrC(ISP_IF_CALLBACK_ENABLED), tempbool );
+
+    aApItem.WriteBool( EApIspIfCallbackEnabled, tempbool );
+
+
+    ApCommons::ReadUintL( ispt, TPtrC(ISP_IF_CALLBACK_TYPE), tempint );
+    aApItem.WriteUint( EApIspIfCallbackType, ( TCallbackAction )tempint );
+
+
+    HBufC8* buf8 = ApCommons::ReadText8ValueLC
+                                    (
+                                    ispt,
+                                    TPtrC(ISP_IF_CALLBACK_INFO)
+                                    );
+    aApItem.WriteTextL( EApIspIfCallbackInfo, *buf8 );
+    CleanupStack::PopAndDestroy( buf8 ); 
+
+    ApCommons::ReadUintL( ispt, TPtrC(ISP_CALLBACK_TIMEOUT), tempint );
+    aApItem.WriteUint( EApIspCallBackTimeOut, tempint );
+
+
+    ApCommons::ReadBoolL( ispt,
+                           TPtrC(ISP_IP_ADDR_FROM_SERVER), tempbool );
+
+    aApItem.WriteBool( EApIspIPAddrFromServer, tempbool );
+
+    buf = ApCommons::ReadText16ValueLC( ispt, TPtrC(ISP_IP_ADDR) );
+    aApItem.WriteTextL( EApIspIPAddr, *buf );
+    CleanupStack::PopAndDestroy( buf );
+
+    buf = ApCommons::ReadText16ValueLC( ispt, TPtrC(ISP_IP_NETMASK) );
+    aApItem.WriteTextL( EApIspIPNetMask, *buf );
+    CleanupStack::PopAndDestroy( buf );
+
+    buf = ApCommons::ReadText16ValueLC( ispt, TPtrC(ISP_IP_GATEWAY) );
+    aApItem.WriteTextL( EApIspIPGateway, *buf );
+    CleanupStack::PopAndDestroy( buf );
+
+    ApCommons::ReadBoolL( ispt, TPtrC(ISP_IP_DNS_ADDR_FROM_SERVER),
+                           tempbool );
+
+    aApItem.WriteBool( EApIspIPDnsAddrFromServer, tempbool );
+
+    buf = ApCommons::ReadText16ValueLC( ispt,
+                                         TPtrC(ISP_IP_NAME_SERVER1) );
+
+    aApItem.WriteTextL( EApIspIPNameServer1, *buf );
+    CleanupStack::PopAndDestroy( buf ); 
+
+    buf = ApCommons::ReadText16ValueLC( ispt,
+                                         TPtrC(ISP_IP_NAME_SERVER2) );
+
+    aApItem.WriteTextL( EApIspIPNameServer2, *buf );
+    CleanupStack::PopAndDestroy( buf );
+
+
+    ApCommons::ReadBoolL( ispt, TPtrC(ISP_ENABLE_IP_HEADER_COMP),
+                           tempbool );
+
+    aApItem.WriteBool( EApIspEnableIpHeaderComp, tempbool );
+
+
+    ApCommons::ReadBoolL( ispt, TPtrC(ISP_ENABLE_LCP_EXTENSIONS),
+                           tempbool );
+
+    aApItem.WriteBool( EApIspEnableLCPExtensions, tempbool );
+
+
+    ApCommons::ReadBoolL( ispt, TPtrC(ISP_DISABLE_PLAIN_TEXT_AUTH),
+                           tempbool );
+
+    aApItem.WriteBool( EApIspDisablePlainTextAuth, tempbool );
+
+
+    ApCommons::ReadBoolL( ispt, TPtrC(ISP_ENABLE_SW_COMP), tempbool );
+
+    aApItem.WriteBool( EApIspEnableSWCompression, tempbool );
+
+
+    ApCommons::ReadUintL( ispt, TPtrC(ISP_BEARER_NAME), tempint );
+    aApItem.WriteUint( EApIspBearerName,
+                       (RMobileCall::TMobileCallDataServiceCaps)tempint );
+
+    ApCommons::ReadUintL( ispt, TPtrC(ISP_BEARER_SPEED), tempint );
+    aApItem.iExt->iBearerSpeed = tempint;
+
+    ApCommons::ReadUintL( ispt, TPtrC(ISP_BEARER_PROTOCOL), tempint );
+    aApItem.iExt->iBearerProtocol = tempint;
+
+    ApCommons::ReadUintL( ispt, TPtrC(ISP_BEARER_CE), tempint );
+    aApItem.WriteUint( EApIspBearerCE, 
+                      (RMobileCall::TMobileCallDataQoSCaps) tempint );
+
+    ApCommons::ReadUintL( ispt, TPtrC(ISP_BEARER_SERVICE), tempint );
+    aApItem.WriteUint( EApIapBearerService, tempint );
+
+
+
+    buf8 = ApCommons::ReadText8ValueLC( ispt,
+                                         TPtrC(ISP_INIT_STRING) );
+
+    aApItem.WriteTextL( EApIspInitString, *buf8 );
+    CleanupStack::PopAndDestroy( buf8 );
+
+    ApCommons::ReadUintL( ispt, TPtrC(ISP_BEARER_TYPE), tempint );
+    aApItem.WriteUint( EApIspBearerType, tempint);
+
+    ApCommons::ReadUintL( ispt, TPtrC(ISP_CHANNEL_CODING), tempint );
+    aApItem.WriteUint( EApIspChannelCoding, tempint);
+
+    ApCommons::ReadUintL( ispt, TPtrC(ISP_AIUR), tempint );
+    aApItem.WriteUint( EApIspAIUR, tempint);
+
+    ApCommons::ReadUintL( ispt,
+                           TPtrC(ISP_REQUESTED_TIME_SLOTS),
+                           tempint );
+    aApItem.WriteUint( EApIspRequestedTimeSlots, tempint);
+
+    ApCommons::ReadUintL( ispt, TPtrC(ISP_MAXIMUM_TIME_SLOTS), tempint );
+    aApItem.WriteUint( EApIspMaximumTimeSlots, tempint);
+
+
+    if ( iExt->iIsIpv6Supported )
+        {
+        ReadServiceIp6L( *ispt, aApItem );
+        }
+
+    EtelSpeed2ApL( aApItem );
+
+    aApItem.SpecifyISP( ETrue );
+    CleanupStack::PopAndDestroy( 2, servtype );   // ispt, servtype
+
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::ReadDialInOutDataL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApDataHandler::ReadVpnInfoL
+// ---------------------------------------------------------
+//
+void CApDataHandler::ReadVpnInfoL( TUint32 aIspId, 
+                                   CApAccessPointItem& aApItem)
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::ReadVpnInfoL" ) ) );
+
+    // internal function, caller MUST initiate a transaction, WE WILL NOT.
+    CCommsDbTableView* ispt = NULL;
+
+    ispt = iDb->OpenViewMatchingUintLC( TPtrC(VPN_SERVICE),
+                                        TPtrC(COMMDB_ID), aIspId );
+    User::LeaveIfError( ispt->GotoFirstRecord() );
+
+    TUint32 tempint;
+
+    HBufC* buf = NULL;
+    // get the real iap
+    ApCommons::ReadUintL( ispt, TPtrC(VPN_SERVICE_IAP), tempint );
+
+    CCommsDbTableView* iapt = NULL;
+    iapt = iDb->OpenViewMatchingUintLC( TPtrC(IAP),
+                                        TPtrC(COMMDB_ID), tempint );
+
+    User::LeaveIfError( iapt->GotoFirstRecord() );
+
+    TUint32 iapservice;
+    ApCommons::ReadUintL( iapt, TPtrC(IAP_SERVICE), iapservice );
+    
+    buf = ApCommons::ReadText16ValueLC( iapt, TPtrC(IAP_SERVICE_TYPE) );
+    
+    if ( ( buf->Compare( TPtrC(OUTGOING_WCDMA ) ) == 0 ) ||
+        ( buf->Compare( TPtrC(INCOMING_WCDMA ) ) == 0 ) )
+        {
+        aApItem.iExt->iVPnRealIapBearerType = EApBearerTypeGPRS;
+        }
+    else
+        {
+        if ( ( buf->Compare( TPtrC(DIAL_OUT_ISP ) ) == 0 ) ||
+            ( buf->Compare( TPtrC(DIAL_IN_ISP ) ) == 0 ) )
+            {
+            // need to get ISP,
+            CCommsDbTableView* doutt = NULL;
+            doutt = iDb->OpenViewMatchingUintLC( *buf,
+                                                 TPtrC(COMMDB_ID), 
+                                                 iapservice );
+            User::LeaveIfError( doutt->GotoFirstRecord() );
+            ApCommons::ReadUintL( doutt , TPtrC(ISP_BEARER_TYPE), tempint );
+            if ( tempint == EBearerTypeCSD )
+                {
+                aApItem.iExt->iVPnRealIapBearerType = EApBearerTypeCSD;
+                }
+            else
+                {
+                aApItem.iExt->iVPnRealIapBearerType = EApBearerTypeHSCSD;
+                }
+            CleanupStack::PopAndDestroy( doutt ); // doutt
+            }
+        else
+            {
+            // VPN, having a bearer something else than CSD, HSCSD,
+            // GPRS & CDMA?
+            if ( buf->Compare( TPtrC(LAN_SERVICE) ) == 0 )
+                { // LAN
+                ReadLanDataL( aIspId, aApItem );
+                }
+            else
+                { // otherwise, error
+                User::Leave( KErrInvalidBearer );
+                }
+            }
+        }
+
+    CleanupStack::PopAndDestroy( 3, ispt ); // buf, iapt, ispt
+
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::ReadVpnInfoL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApDataHandler::WriteWapBearerDataL
+// ---------------------------------------------------------
+//
+void CApDataHandler::WriteWapBearerDataL( TBool aIsNew, TUint32 aWapId,
+                                   CApAccessPointItem& aApItem )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::WriteWapBearerDataL" ) ) );
+
+    // internal function, caller MUST initiate a transaction, WE WILL NOT.
+    CCommsDbTableView* bearert;
+    if ( aIsNew )
+        {
+        bearert = iDb->OpenTableLC( TPtrC(*aApItem.iWapBearer) );
+        // CommDB's back-link makes returned UID value unusable,
+        // variable needed just to be able to make the call...
+        TUint32 dummy;
+        User::LeaveIfError( bearert->InsertRecord( dummy ) );
+        }
+    else
+        {
+        bearert = iDb->OpenViewMatchingUintLC( TPtrC(*aApItem.iWapBearer),
+                                              TPtrC(WAP_ACCESS_POINT_ID),
+                                              aWapId );
+        User::LeaveIfError( bearert->GotoFirstRecord() );
+        User::LeaveIfError( bearert->UpdateRecord() );
+        }
+    bearert->WriteTextL( TPtrC(WAP_GATEWAY_ADDRESS),
+                         *aApItem.iWapGatewayAddress );
+    bearert->WriteUintL( TPtrC(WAP_WSP_OPTION),
+                         aApItem.iIsConnectionTypeContinuous );
+    bearert->WriteBoolL( TPtrC(WAP_SECURITY), aApItem.iIsWTLSSecurityOn );
+    bearert->WriteUintL( TPtrC(WAP_ACCESS_POINT_ID), aWapId );
+
+    if ( *aApItem.iWapBearer == TPtrC(WAP_IP_BEARER) )
+        {
+        bearert->WriteUintL( TPtrC(WAP_IAP), aApItem.iWapIap );        
+        bearert->WriteUintL( TPtrC(WAP_PROXY_PORT), aApItem.iWapProxyPort );
+        bearert->WriteTextL( TPtrC(WAP_PROXY_LOGIN_NAME),
+                             *aApItem.iWapProxyLoginName );
+        bearert->WriteTextL( TPtrC(WAP_PROXY_LOGIN_PASS),
+                             *aApItem.iWapProxyLoginPass );
+        }
+    else
+        {
+        User::Leave( KErrInvalidBearer );
+        }
+
+    User::LeaveIfError( bearert->PutRecordChanges( EFalse, EFalse ) );
+
+    CleanupStack::PopAndDestroy( bearert );   // bearert
+
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::WriteWapBearerDataL" ) ) );
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CApDataHandler::WriteWapApDataL
+// ---------------------------------------------------------
+//
+void CApDataHandler::WriteWapApDataL( TBool aIsNew, TUint32 aWapId,
+                                   CApAccessPointItem& aApItem )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::WriteWapApDataL" ) ) );
+
+    // internal function, caller MUST initiate a transaction, WE WILL NOT.
+    CCommsDbTableView* wapt;
+
+    if ( aIsNew )
+        {
+        wapt = iDb->OpenTableLC( TPtrC(WAP_ACCESS_POINT) );
+        TInt err = wapt->InsertRecord( aApItem.iWapUid );
+        if ( err )
+            {
+            User::LeaveIfError( err );
+            }
+        // CommDB's back-link makes returned UID value unusable,
+        // variable needed just to be able to make the call...
+        }
+    else
+        {
+        wapt = iDb->OpenViewMatchingUintLC( TPtrC(WAP_ACCESS_POINT),
+                                           TPtrC(COMMDB_ID), aWapId );
+        User::LeaveIfError( wapt->GotoFirstRecord() );
+        User::LeaveIfError( wapt->UpdateRecord() );
+        }
+
+    wapt->WriteTextL( TPtrC(WAP_CURRENT_BEARER), *aApItem.iWapBearer );
+    wapt->WriteTextL( TPtrC(COMMDB_NAME), *aApItem.iWapAccessPointName );
+
+    wapt->WriteLongTextL( TPtrC(WAP_START_PAGE), *aApItem.iStartingPage );
+
+    User::LeaveIfError( wapt->PutRecordChanges( EFalse, EFalse ) );
+
+    CleanupStack::PopAndDestroy( wapt );   // wapt
+
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::WriteWapApDataL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApDataHandler::WriteIapDataL
+// ---------------------------------------------------------
+//
+void CApDataHandler::WriteIapDataL( TBool aIsNew, TUint32 aIapId,
+                                   CApAccessPointItem& aApItem )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::WriteIapDataL" ) ) );
+
+    CCommsDbTableView* iapt;
+    // internal function, caller MUST initiate a transaction, WE WILL NOT.
+    if ( aIsNew )
+        {
+        iapt = iDb->OpenTableLC( TPtrC(IAP) );
+        User::LeaveIfError( iapt->InsertRecord( aApItem.iWapIap ) );
+        }
+    else
+        {
+        iapt = iDb->OpenViewMatchingUintLC( TPtrC(IAP),
+                                               TPtrC(COMMDB_ID), aIapId );
+        User::LeaveIfError( iapt->GotoFirstRecord() );
+        User::LeaveIfError( iapt->UpdateRecord() );
+        }
+
+    iapt->WriteTextL( TPtrC(COMMDB_NAME), *aApItem.iIapName );
+    iapt->WriteUintL( TPtrC(IAP_SERVICE), aApItem.iIapServiceId );
+    iapt->WriteTextL( TPtrC(IAP_SERVICE_TYPE), *aApItem.iIapServiceType );
+
+    // hardcoded...
+    TApBearerType bearer = aApItem.BearerTypeL();
+    switch ( bearer )
+        {
+        case EApBearerTypeWLAN:
+            {
+            if ( aApItem.iExt->iWlanData )
+                {
+                iapt->WriteTextL( TPtrC(IAP_BEARER_TYPE), TPtrC(LAN_BEARER) );
+                }
+            else
+                {
+                User::Leave( KErrNotSupported );
+                }
+            break;
+            }
+#ifdef __TEST_LAN_BEARER 
+        case EApBearerTypeLAN:
+            {
+            iapt->WriteTextL( TPtrC(IAP_BEARER_TYPE), TPtrC(LAN_BEARER) );
+            break;
+            }
+#endif // __TEST_LAN_BEARER        
+        case EApBearerTypeLANModem:
+            {
+            iapt->WriteTextL( TPtrC(IAP_BEARER_TYPE), TPtrC(LAN_BEARER) );
+            break;
+            }
+        default:
+            {
+            iapt->WriteTextL( TPtrC(IAP_BEARER_TYPE), TPtrC(MODEM_BEARER) );
+            break;
+            }            
+        }
+        
+    TUint32 id = GetModemBearerIDL( aApItem );
+    iapt->WriteUintL( TPtrC(IAP_BEARER), id );
+    
+    iapt->WriteUintL( TPtrC(IAP_NETWORK), aApItem.iNetworkId );
+    // Network weighting!
+    iapt->WriteUintL( TPtrC(IAP_NETWORK_WEIGHTING), 0 );
+    
+    TUint32 loc = GetLocationIdL();
+    iapt->WriteUintL( TPtrC(IAP_LOCATION), loc );
+
+    // now put changes
+    User::LeaveIfError( iapt->PutRecordChanges( EFalse, EFalse ) );
+
+    CleanupStack::PopAndDestroy( iapt );  // iapt
+
+    if ( aIsNew )
+        {
+        CCommsDbConnectionPrefTableView* view = 
+            iDb->OpenConnectionPrefTableViewOnRankLC( 
+                    ECommDbConnectionDirectionOutgoing, 1 );
+        
+        TInt ret = view->GotoFirstRecord();
+        
+        CCommsDbConnectionPrefTableView::TCommDbIapConnectionPref tablePref;
+        
+        if ( ret == KErrNone )
+            {
+            view->ReadConnectionPreferenceL( tablePref );
+                
+            TUint32 iapId = tablePref.iBearer.iIapId;
+                
+            // Check if iap exists
+            CCommsDbTableView* view2 = 
+                iDb->OpenViewMatchingUintLC( TPtrC(IAP), 
+                                             TPtrC(COMMDB_ID), 
+                                             iapId );
+        
+            TInt exists = view2->GotoFirstRecord();
+            CleanupStack::PopAndDestroy(); // view2
+
+            if ( iapId == 0 || exists != KErrNone )
+                {
+                if ( bearer & 
+                   ( EApBearerTypeCSD 
+                     + EApBearerTypeHSCSD 
+                     + EApBearerTypeGPRS 
+                     + EApBearerTypeCDMA ) )
+                    {
+                    // Get the current settings and then overwrite with the Iap
+                    tablePref.iBearer.iIapId = aApItem.iWapIap;
+                    tablePref.iBearer.iBearerSet = 
+                            KCommDbBearerCSD | KCommDbBearerWcdma;
+                    view->UpdateBearerL( tablePref.iBearer );
+                    }
+                }
+            }
+        CleanupStack::PopAndDestroy(); // view
+        }
+
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::WriteIapDataL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApDataHandler::WriteIspDataL
+// ---------------------------------------------------------
+//
+void CApDataHandler::WriteIspDataL( TBool aIsNew, TUint32 aIspId,
+                                   CApAccessPointItem& aApItem )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::WriteIspDataL" ) ) );
+
+    aApItem.WriteUint( EApIapServiceId, aIspId );
+    // internal function, caller MUST initiate a transaction, WE WILL NOT.
+    if ( ( aApItem.iIapServiceType->Compare( TPtrC(OUTGOING_WCDMA ) ) == 0 ) ||
+        ( aApItem.iIapServiceType->Compare( TPtrC(INCOMING_WCDMA ) ) == 0 ) )
+        {
+        WriteGprsDataL( aIsNew, aApItem );
+        }
+    else
+        {
+        if ( ( aApItem.iIapServiceType->Compare( TPtrC(DIAL_IN_ISP) ) == 0 ) ||
+            ( aApItem.iIapServiceType->Compare( TPtrC(DIAL_OUT_ISP) ) == 0 ) )
+            {
+            WriteCsdDataL( aIsNew, aApItem );
+            }
+        else
+            { // check if VPN
+            if ( aApItem.iIapServiceType->Compare( TPtrC(VPN_SERVICE) ) == 0 )
+                { // currently, KErrNotSupported
+                User::Leave( KErrNotSupported );
+                }
+            else
+                { 
+                if ( aApItem.iIapServiceType->Compare( 
+                                TPtrC(LAN_SERVICE) ) == 0 )
+                    {
+                    WriteLanDataL( aIsNew, aApItem );
+                    }
+                else
+                    {
+                    // something unknown, 
+                    User::Leave( KErrInvalidBearer );
+                    }
+                }
+            }
+        }
+
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::WriteIspDataL" ) ) );
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CApDataHandler::WriteGprsDataL
+// ---------------------------------------------------------
+//
+void CApDataHandler::WriteGprsDataL( TBool aIsNew,
+                                    CApAccessPointItem& aApItem )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::WriteGprsDataL" ) ) );
+
+    CCommsDbTableView* table;
+
+    if ( aIsNew )
+        {
+        table = iDb->OpenTableLC( *aApItem.iIapServiceType );
+        User::LeaveIfError( table->InsertRecord( aApItem.iIapServiceId ) );
+        }
+    else
+        {
+        table = iDb->OpenViewMatchingUintLC( *aApItem.iIapServiceType,
+                                           TPtrC(COMMDB_ID),
+                                           aApItem.iIapServiceId );
+        User::LeaveIfError( table->GotoFirstRecord() );
+        User::LeaveIfError( table->UpdateRecord() );
+        }
+    // now write record data
+    table->WriteTextL( TPtrC(COMMDB_NAME), *aApItem.iIspName );
+
+    table->WriteLongTextL( TPtrC(GPRS_APN), *aApItem.iGprsAccessPointName );
+
+    
+    if ( aApItem.iGprsPdpType == EIPv6 )
+        {
+        table->WriteUintL( TPtrC(GPRS_PDP_TYPE), 
+                           RPacketContext::EPdpTypeIPv6 );
+        }
+    else
+        {
+        table->WriteUintL( TPtrC(GPRS_PDP_TYPE), 
+                           RPacketContext::EPdpTypeIPv4 );
+        }
+
+    table->WriteTextL( TPtrC(GPRS_PDP_ADDRESS), *aApItem.iGprsPdpAddress );
+
+    table->WriteUintL( TPtrC(GPRS_REQ_PRECEDENCE),
+                       aApItem.iGprsReqPrecedence );
+
+    table->WriteUintL( TPtrC(GPRS_REQ_DELAY), aApItem.iGprsReqDelay );
+
+    table->WriteUintL( TPtrC(GPRS_REQ_RELIABILITY),
+                       aApItem.iGprsReqReliability );
+
+    table->WriteUintL( TPtrC(GPRS_REQ_PEAK_THROUGHPUT),
+                       aApItem.iGprsReqPeakThroughput );
+
+    table->WriteUintL( TPtrC(GPRS_REQ_MEAN_THROUGHPUT),
+                       aApItem.iGprsReqMeanPeakThroughput );
+
+    table->WriteUintL( TPtrC(GPRS_MIN_PRECEDENCE),
+                       aApItem.iGprsMinPrecedence );
+
+    table->WriteUintL( TPtrC(GPRS_MIN_DELAY), aApItem.iGprsMinDelay );
+
+    table->WriteUintL( TPtrC(GPRS_MIN_RELIABILITY),
+                       aApItem.iGprsMinReliability );
+
+    table->WriteUintL( TPtrC(GPRS_MIN_PEAK_THROUGHPUT),
+                       aApItem.iGprsMinPeakThroughput );
+
+    table->WriteUintL( TPtrC(GPRS_MIN_MEAN_THROUGHPUT),
+                       aApItem.iGprsMinMeanThroughput );
+
+    table->WriteBoolL( TPtrC(GPRS_DATA_COMPRESSION),
+                     aApItem.iIspEnableSwCompression );
+
+    table->WriteBoolL( TPtrC(GPRS_HEADER_COMPRESSION),
+                     aApItem.iEnablePPPCompression );
+
+    table->WriteBoolL( TPtrC(GPRS_ANONYMOUS_ACCESS),
+                     aApItem.iGprsUseAnonymAccess );
+
+/*
+// Keep as long as replacing IF_NAME does not works as specified 
+    table->WriteTextL( TPtrC(IF_NAME), *aApItem.iIspIfName );
+*/
+
+    table->WriteTextL( TPtrC(GPRS_IF_PARAMS), *aApItem.iIspIfParams );
+
+    table->WriteTextL( TPtrC(GPRS_IF_NETWORKS), *aApItem.iIspIfNetworks );
+
+    table->WriteBoolL( TPtrC(GPRS_IF_PROMPT_FOR_AUTH),
+                     aApItem.iIspIfPromptForAuth );
+
+    table->WriteTextL( TPtrC(GPRS_IF_AUTH_NAME), *aApItem.iIspIfAuthName );
+
+    table->WriteTextL( TPtrC(GPRS_IF_AUTH_PASS), *aApItem.iIspIfAuthPass );
+
+    table->WriteUintL( TPtrC(GPRS_IF_AUTH_RETRIES),
+                     aApItem.iIspIfAuthRetries );
+
+    table->WriteTextL( TPtrC(GPRS_IP_NETMASK), *aApItem.iIspIPNetMask );
+
+    table->WriteTextL( TPtrC(GPRS_IP_GATEWAY), *aApItem.iIspGateway );
+
+    table->WriteBoolL( TPtrC(GPRS_IP_ADDR_FROM_SERVER),
+                       aApItem.iIspIPAddrFromServer );
+
+    table->WriteTextL( TPtrC(GPRS_IP_ADDR), *aApItem.iIspIPAddr );
+
+    table->WriteBoolL( TPtrC(GPRS_IP_DNS_ADDR_FROM_SERVER),
+                     aApItem.iGetDNSIPFromServer );
+
+    table->WriteTextL( TPtrC(GPRS_IP_NAME_SERVER1), *aApItem.iPrimaryDNS );
+
+    table->WriteTextL( TPtrC(GPRS_IP_NAME_SERVER2), *aApItem.iSecondaryDNS );
+
+    table->WriteBoolL( TPtrC(GPRS_ENABLE_LCP_EXTENSIONS),
+                     aApItem.iIspEnableLCPExtensions );
+
+    table->WriteBoolL( TPtrC(GPRS_DISABLE_PLAIN_TEXT_AUTH),
+                     aApItem.iIsPasswordAuthenticationSecure );
+
+    table->WriteUintL( TPtrC(GPRS_AP_TYPE), aApItem.iIspType );
+
+
+    // Agreed to use const...
+    table->WriteUintL( TPtrC(GPRS_QOS_WARNING_TIMEOUT), 
+                       TUint32(KGprsOsTimeout) );
+
+    if ( iExt->iIsIpv6Supported )
+        {
+        WriteServiceIp6L( *table, aApItem );
+        }
+
+//    WriteDaemonL( *table, aApItem ); starts here
+    if ( aApItem.iIspIPAddrFromServer )
+        {
+        table->WriteTextL( TPtrC(SERVICE_CONFIG_DAEMON_MANAGER_NAME), 
+                           KDaemonManagerName );
+        table->WriteTextL( TPtrC(SERVICE_CONFIG_DAEMON_NAME), 
+                           KConfigDaemonName );
+        }
+    else
+        {
+        // 3.1 it is changed!!
+        if ( FeatureManager::FeatureSupported( KFeatureIdIPv6 ) )
+            {
+            table->WriteTextL( TPtrC(SERVICE_CONFIG_DAEMON_MANAGER_NAME), 
+                               KDaemonManagerName );
+            table->WriteTextL( TPtrC(SERVICE_CONFIG_DAEMON_NAME), 
+                               KConfigDaemonName );            
+            }
+        else
+            {
+            table->WriteTextL( TPtrC(SERVICE_CONFIG_DAEMON_MANAGER_NAME), KEmpty );
+            table->WriteTextL( TPtrC(SERVICE_CONFIG_DAEMON_NAME), KEmpty );            
+            }
+        }
+//    WriteDaemonL() Ends here
+    
+    // now put changes
+    User::LeaveIfError( table->PutRecordChanges( EFalse, EFalse ) );
+
+    CleanupStack::PopAndDestroy( table );  // table
+
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::WriteGprsDataL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApDataHandler::WriteLanDataL
+// ---------------------------------------------------------
+//
+void CApDataHandler::WriteLanDataL( TBool aIsNew,
+                                    CApAccessPointItem& aApItem )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::WriteLanDataL" ) ) );
+
+    CCommsDbTableView* table;
+
+    if ( aIsNew )
+        {
+        table = iDb->OpenTableLC( *aApItem.iIapServiceType );
+        User::LeaveIfError( table->InsertRecord( aApItem.iIapServiceId ) );
+        }
+    else
+        {
+        table = iDb->OpenViewMatchingUintLC( *aApItem.iIapServiceType,
+                                           TPtrC(COMMDB_ID),
+                                           aApItem.iIapServiceId );
+        User::LeaveIfError( table->GotoFirstRecord() );
+        User::LeaveIfError( table->UpdateRecord() );
+        }
+
+    // now write record data
+    WriteServiceL( *table, aApItem );
+
+    TApBearerType bearer = aApItem.BearerTypeL();
+
+   
+    if ( bearer == EApBearerTypeWLAN )
+        {
+        if ( aApItem.iExt->iWlanData )
+            {
+        
+            CCommsDbTableView* wlantable = NULL;
+
+            if ( aIsNew )
+                {        
+                TUint32 dummy;
+                wlantable = iDb->OpenTableLC( TPtrC(WLAN_SERVICE) );
+                User::LeaveIfError( wlantable->InsertRecord( dummy ) );
+                aApItem.iExt->iWlanData->iWlanId = dummy;        
+                }
+            else
+                {
+                // WLAN settings table backlinks to LAN service, 
+                // so we query WLAN settings for a record 
+                // where WLAN_SERVICE_ID is LAN_SERVICE's COMMDB_ID, 
+                // which is aApItem.iIapServiceId...
+                wlantable = iDb->OpenViewMatchingUintLC( TPtrC(WLAN_SERVICE),
+                                                         TPtrC(WLAN_SERVICE_ID),
+                                                         aApItem.iIapServiceId );
+                User::LeaveIfError( wlantable->GotoFirstRecord() );
+                User::LeaveIfError( wlantable->UpdateRecord() );
+                }
+
+            // Add WLAN specific data storage
+            WriteWlanL( *wlantable, aApItem );
+            User::LeaveIfError( wlantable->PutRecordChanges( EFalse, EFalse ) );
+            CleanupStack::PopAndDestroy( wlantable );  // wlantable
+            }
+        else
+            {                        
+            // WLAN not supported, do not try to write it....
+            User::Leave( KErrInvalidBearer );
+            }
+
+        }
+    
+    if ( iExt->iIsIpv6Supported )
+        {
+        WriteServiceIp6L( *table, aApItem );
+        }
+
+    // now put changes
+    User::LeaveIfError( table->PutRecordChanges( EFalse, EFalse ) );
+    CleanupStack::PopAndDestroy( table );  // table
+
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::WriteLanDataL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApDataHandler::DoUpdateAccessPointDataL
+// ---------------------------------------------------------
+//
+TUint32 CApDataHandler::DoUpdateAccessPointDataL
+                                        (
+                                        CApAccessPointItem& aApItem,
+                                        TBool aIsNew,
+                                        TBool& aNameChanged
+                                        )
+    {
+    CLOG( ( EHandler, 0, 
+        _L( "-> CApDataHandler::DoUpdateAccessPointDataL" ) ) );
+
+    // internal function, caller MUST initiate a transaction, WE WILL NOT.
+    if ( aApItem.iWapAccessPointName->Length() == 0 )
+        {
+        User::Leave( KErrInvalidName );
+        }
+
+    if ( aIsNew )
+        {
+        HBufC* sgd = ApCommons::DoMakeValidNameL
+                                        (
+                                        *iDb,
+                                        aNameChanged,
+                                        aApItem.iWapAccessPointName,
+                                        aApItem.iWapUid,
+                                        aIsNew
+                                        );
+        if ( aNameChanged )
+            {
+            CleanupStack::PushL( sgd );
+            aApItem.SetNamesL( *sgd );
+            CleanupStack::Pop( sgd );
+            }
+        delete sgd;
+        }
+    else
+        {
+        // first check the existence of the access point,
+        // just to be on the sure side...
+        CCommsDbTableView* wapt;
+        wapt = iDb->OpenViewMatchingUintLC( TPtrC(WAP_ACCESS_POINT),
+                                           TPtrC(COMMDB_ID), aApItem.iWapUid );
+        // if no other problem, will return KErrNone if it exists
+        // so we will go through to the next step.
+        // if returns KErrNotFound or any other problem, leave here.
+        User::LeaveIfError( wapt->GotoFirstRecord() );
+        // now we need to destroy to create a new 'view'
+        CleanupStack::PopAndDestroy( wapt ); // wapt
+
+        // now we can go on with the real stuff here...
+        // check if a record with the currently given name exists.
+        // No problem, if the UID is the same as ours,
+        // otherwise, leave because name already exists...
+        wapt = iDb->OpenViewMatchingTextLC( TPtrC(WAP_ACCESS_POINT),
+                                            TPtrC(COMMDB_NAME),
+                                            *aApItem.iWapAccessPointName );
+        TInt res =  wapt->GotoFirstRecord();
+        if ( res == KErrNotFound )
+            { // no such name
+            aNameChanged = EFalse;
+            }
+        else
+            {
+            if ( res == KErrNone )
+                {
+                TUint32 id;
+                wapt->ReadUintL( TPtrC(COMMDB_ID), id );
+                if ( id != aApItem.iWapUid )
+                    {
+                    User::Leave( KErrAlreadyExists );
+                    }
+                }
+            else
+                {
+                User::LeaveIfError( res );
+                }
+            }
+        CleanupStack::PopAndDestroy( wapt );   // wapt
+        }
+
+    TBool NeedManualUpdate( ETrue );
+
+    // additional code for managing bearer-change starts here...
+    if ( !aIsNew )
+        { // only check if update op.
+        // if bearer changed, it also UPDATES everything !
+        // if no change, update MUST BE DONE HERE MANUALLY!
+        if ( HandleBearerChangeIfNeededL( aApItem ) )
+            {
+            NeedManualUpdate = EFalse;
+            }
+        }
+    if ( NeedManualUpdate )
+        {
+        WriteIspDataL( aIsNew, aApItem.iIapServiceId, aApItem );
+        WriteNetworkDataL( aIsNew, aApItem );
+        WriteIapDataL( aIsNew, aApItem.iWapIap, aApItem );
+        WriteWapApDataL( aIsNew, aApItem.iWapUid, aApItem );
+        WriteWapBearerDataL( aIsNew, aApItem.iWapUid, aApItem );
+        if ( aApItem.HasProxy() )
+            {
+            WriteProxyDataL( aIsNew, aApItem );
+            }
+        else
+            {
+            if ( !aIsNew )
+                {
+                TRAP_IGNORE( RemoveProxyDataL( aApItem.iIapServiceType, 
+                                               aApItem.iIapServiceId ) );
+                }
+            }
+        }
+
+    CLOG( ( EHandler, 1, 
+        _L( "<- CApDataHandler::DoUpdateAccessPointDataL" ) ) );
+    return aApItem.iWapUid;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApDataHandler::SetDefaultIapIspL
+// ---------------------------------------------------------
+//
+void CApDataHandler::SetDefaultIapIspL( TUint32 aUid )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::SetDefaultIapIspL" ) ) );
+    
+    CApAccessPointItem* ap = CApAccessPointItem::NewLC();
+    AccessPointDataL( aUid, *ap );
+    // Get IAP uid from aUid record
+    // ap.iWapIap
+    // Dial In or Dial Out?
+    // ap.iWapIspType
+    // store it accordingly
+    switch ( ap->BearerTypeL() )
+        {
+        case EApBearerTypeCSD:
+        case EApBearerTypeHSCSD:
+            {
+//            iDb->SetGlobalSettingL( TPtrC(DIAL_OUT_IAP), ap->iWapIap );
+            SetPreferredIfDbIapTypeL
+                ( 1,                                    // aRank,
+                  ECommDbConnectionDirectionOutgoing,   //aDirection,
+                  KCommDbBearerCSD,                     // aBearers,
+                  ECommDbDialogPrefDoNotPrompt,         //aPrompt,
+                  ap->iWapIap,                          //aIAP,
+                  ETrue                                 //aOverwrite
+                );
+            break;
+            }
+        case EApBearerTypeGPRS:
+        case EApBearerTypeCDMA:
+            {
+            // Not applicable !
+            User::Leave( KErrArgument );
+            break;
+            }
+        default:
+            {
+            User::Leave( KErrInvalidIspRequest );
+            }
+        }
+    CleanupStack::PopAndDestroy( ap );    // ap
+
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::SetDefaultIapIspL" ) ) );
+    }
+
+
+
+
+
+// ---------------------------------------------------------
+// CApDataHandler::RemoveWapBearerApL
+// ---------------------------------------------------------
+//
+void CApDataHandler::RemoveWapBearerApL( TUint32 aUid )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::RemoveWapBearerApL" ) ) );
+
+    CCommsDbTableView* bearert;
+    bearert = iDb->OpenViewMatchingUintLC( TPtrC(WAP_IP_BEARER),
+                                   TPtrC(WAP_ACCESS_POINT_ID), aUid );
+
+    TInt res = bearert->GotoFirstRecord();  // OK.
+    if ( res == KErrNone )
+        { // exists, delete it
+        User::LeaveIfError( bearert->DeleteRecord() );
+        }
+    else
+        {
+        // silently ignore KErrNotFound. It is caused by incorrect DB,
+        // we are 'repairing it' this way.
+        if ( res != KErrNotFound )
+            {
+            User::LeaveIfError( res );
+            }
+        }
+    CleanupStack::PopAndDestroy( bearert ); // bearert
+
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::RemoveWapBearerApL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApDataHandler::RemoveWapApL
+// ---------------------------------------------------------
+//
+void CApDataHandler::RemoveWapApL( TUint32 aUid )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::RemoveWapApL" ) ) );
+
+    CCommsDbTableView* wapt = iDb->OpenViewMatchingUintLC(
+                                        TPtrC(WAP_ACCESS_POINT),
+                                        TPtrC(COMMDB_ID), aUid );
+    TInt res = wapt->GotoFirstRecord(); // OK.
+    if ( res == KErrNone )
+        { // exists, delete it
+        User::LeaveIfError( wapt->DeleteRecord() );
+        }
+    else
+        {
+        // silently ignore KErrNotFound. It is caused by incorrect DB,
+        // we are 'repairing it' this way.
+        if ( res != KErrNotFound )
+            {
+            User::Leave( res );
+            }
+        }
+    CleanupStack::PopAndDestroy( wapt ); // wapt
+
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::RemoveWapApL" ) ) );
+    }
+
+
+// ---------------------------------------------------------
+// CApDataHandler::RemoveIapL
+// ---------------------------------------------------------
+//
+void CApDataHandler::RemoveIapL( TUint32 aUid )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::RemoveIapL" ) ) );
+
+    CCommsDbTableView* iapt;
+    iapt = iDb->OpenViewMatchingUintLC( TPtrC(IAP),
+                                   TPtrC(COMMDB_ID), aUid );
+    TInt res = iapt->GotoFirstRecord(); // OK.
+    if ( res == KErrNone )
+        { // exists, delete it
+        User::LeaveIfError( iapt->DeleteRecord() );
+        }
+    else
+        {
+        // silently ignore KErrNotFound. It is caused by incorrect DB,
+        // we are 'repairing it' this way.
+        if ( res != KErrNotFound )
+            {
+            User::Leave( res );
+            }
+        }
+    CleanupStack::PopAndDestroy( iapt ); // iapt
+
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::RemoveIapL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApDataHandler::RemoveIspL
+// ---------------------------------------------------------
+//
+void CApDataHandler::RemoveIspL( TUint32 aUid, TBool aOut )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::RemoveIspL" ) ) );
+
+    CCommsDbTableView* ispt;
+    if ( aOut )
+        {
+        ispt = iDb->OpenViewMatchingUintLC( TPtrC(DIAL_OUT_ISP),
+                                       TPtrC(COMMDB_ID), aUid );
+        }
+    else
+        {
+        ispt = iDb->OpenViewMatchingUintLC( TPtrC(DIAL_IN_ISP),
+                                       TPtrC(COMMDB_ID), aUid );
+        }
+
+    TInt res = ispt->GotoFirstRecord(); // OK.
+    if ( res == KErrNone )
+        { // exists, delete it
+        User::LeaveIfError( ispt->DeleteRecord() );
+        }
+    else
+        {
+        // silently ignore KErrNotFound. It is caused by incorrect DB,
+        // we are 'repairing it' this way.
+        if ( res != KErrNotFound )
+            {
+            User::Leave( res );
+            }
+        }
+    CleanupStack::PopAndDestroy( ispt ); // ispt
+
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::RemoveIspL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApDataHandler::RemoveGprsL
+// ---------------------------------------------------------
+//
+void CApDataHandler::RemoveGprsL( TUint32 aUid, TBool aOut )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::RemoveGprsL" ) ) );
+
+    CCommsDbTableView* table;
+    if ( aOut )
+        {
+        table = iDb->OpenViewMatchingUintLC( TPtrC(OUTGOING_WCDMA),
+                                       TPtrC(COMMDB_ID), aUid );
+        }
+    else
+        {
+        table = iDb->OpenViewMatchingUintLC( TPtrC(INCOMING_WCDMA),
+                                       TPtrC(COMMDB_ID), aUid );
+        }
+
+    TInt res = table->GotoFirstRecord(); // O.K.
+    if ( res == KErrNone )
+        { // exists, delete it
+        User::LeaveIfError( table->DeleteRecord() );
+        }
+    else
+        {
+        // silently ignore KErrNotFound. It is caused by incorrect DB,
+        // we are 'repairing it' this way.
+        if ( res != KErrNotFound )
+            {
+            User::Leave( res );
+            }
+        }
+
+    CleanupStack::PopAndDestroy( table ); // table
+
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::RemoveGprsL" ) ) );
+    }
+
+
+// ---------------------------------------------------------
+// CApDataHandler::RemoveLanL
+// ---------------------------------------------------------
+//
+void CApDataHandler::RemoveLanL( TUint32 aUid )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::RemoveLanL" ) ) );
+
+    CCommsDbTableView* table = iDb->OpenViewMatchingUintLC
+        ( TPtrC(LAN_SERVICE), TPtrC(COMMDB_ID), aUid );
+
+    TInt res = table->GotoFirstRecord(); // O.K.
+    if ( res == KErrNone )
+        { // exists, delete it
+        User::LeaveIfError( table->DeleteRecord() );
+        }
+    else
+        {
+        // silently ignore KErrNotFound. It is caused by incorrect DB,
+        // we are 'repairing it' this way.
+        if ( res != KErrNotFound )
+            {
+            User::Leave( res );
+            }
+        }
+    CleanupStack::PopAndDestroy( table ); // table
+    
+    // try to remove WLAN part, if it has any
+    // TRAP and ignore if not found
+    TRAP( res, RemoveWlanL( aUid ) );
+    if ( res != KErrNotFound )
+        {
+        User::LeaveIfError( res );
+        }
+
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::RemoveLanL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApDataHandler::RemoveWlanL
+// ---------------------------------------------------------
+//
+void CApDataHandler::RemoveWlanL( TUint32 aUid )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::RemoveWlanL" ) ) );
+
+    CCommsDbTableView* table = NULL;
+
+    // now check the WLAN table for corresponding record and delete them, too
+    table = iDb->OpenViewMatchingUintLC
+            ( TPtrC(WLAN_SERVICE), TPtrC(WLAN_SERVICE_ID), aUid );
+
+    TInt res = table->GotoFirstRecord(); // O.K.
+    if ( res == KErrNone )
+        { // exists, delete it
+        TUint32 tempint( 0 );
+        ApCommons::ReadUintL( table, TPtrC(WLAN_SECURITY_MODE), tempint );
+        // now tempint holds the security mode
+        // we have to delete security settings, too
+        switch ( tempint )
+            {
+            case EOpen:
+            case EWep:
+                {
+                break;
+                }
+            case E802_1x:
+                {
+                CWPASecuritySettings* wpa = 
+                        CWPASecuritySettings::NewL( ESecurityMode8021x );
+                CleanupStack::PushL( wpa );
+                wpa->DeleteL( aUid );
+                CleanupStack::PopAndDestroy( wpa );
+                break;
+                }
+            case EWpa:
+            case EWpa2:
+                {
+                CWPASecuritySettings* wpa = 
+                        CWPASecuritySettings::NewL( ESecurityModeWpa );
+                CleanupStack::PushL( wpa );
+                wpa->DeleteL( aUid );
+                CleanupStack::PopAndDestroy( wpa );
+                break;
+                }
+            default:
+                {
+                // some weird error, repair it...
+                __ASSERT_DEBUG( EFalse, ApCommons::Panic( ENotSupported ) );
+                break;
+                }
+            }
+        
+        User::LeaveIfError( table->DeleteRecord() );
+        }
+    else
+        {
+        // silently ignore KErrNotFound. It is caused by incorrect DB,
+        // we are 'repairing it' this way.
+        if ( res != KErrNotFound )
+            {
+            User::Leave( res );
+            }
+        }
+
+    // only need to destroy if it was successfully created!
+    CleanupStack::PopAndDestroy( table ); // table            
+    
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::RemoveWlanL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApDataHandler::HandleBearerChangeIfNeededL
+// ---------------------------------------------------------
+//
+TBool CApDataHandler::HandleBearerChangeIfNeededL
+                                    ( CApAccessPointItem& aApItem )
+    {
+    CLOG( ( EHandler, 0, 
+        _L( "-> CApDataHandler::HandleBearerChangeIfNeededL" ) ) );
+
+    TApBearerType anew = aApItem.BearerTypeL();
+
+    CApUtils* au = CApUtils::NewLC( *iDb );
+    TApBearerType aold = au->BearerTypeL( aApItem.iWapUid );
+    // if different WAP_Bearer table, OR different IAP_SERVICE table,
+    // delete old ones and save current as NEW records
+    // under the SAME iWapUid !
+
+    TBool retval( EFalse );
+    if ( ( aold != anew ) &&
+        !(
+           (( aold == EApBearerTypeHSCSD ) && ( anew == EApBearerTypeCSD ) )
+           ||
+           ( ( aold == EApBearerTypeCSD ) && ( anew == EApBearerTypeHSCSD ) )
+         )
+        )
+        {// different bearers!
+        HBufC* buf = HBufC::NewLC( KModifiableTextLength );
+        TPtr ptr( buf->Des() );
+        au->WapBearerTypeL( aApItem.iWapUid, ptr );
+
+        CApAccessPointItem* apitem = CApAccessPointItem::NewLC();
+        AccessPointDataL( aApItem.iWapUid, *apitem );
+
+        if ( *aApItem.iWapBearer != ptr )
+            {
+            // if different WAP_Bearer table, delete old wap_bearer
+            // & if needed, IAP, ISP, GPRS, CDMA, too
+            //  and Crete new wap bearer & if needed, IAP, ISP, GPRS, CDMA, too
+            if ( *apitem->iWapBearer == TPtrC(WAP_IP_BEARER) )
+                {
+                // e.g.:RemoveIpBearer(iIapServiceType, iIapServiceId,
+                //                     iWapIap )
+                if ( ( *apitem->iIapServiceType == TPtrC(DIAL_OUT_ISP) )
+                    || ( *apitem->iIapServiceType == TPtrC(DIAL_IN_ISP) ) )
+                    { // ISP
+                    RemoveIspL( apitem->iIapServiceId,
+                        ( *apitem->iIapServiceType == TPtrC(DIAL_OUT_ISP) ) );
+                    }
+                else if( ( *apitem->iIapServiceType ==
+                                        TPtrC(OUTGOING_WCDMA) )
+                        || ( *apitem->iIapServiceType ==
+                                        TPtrC(INCOMING_WCDMA) ) )
+                    {// Gprs
+                    RemoveGprsL( apitem->iIapServiceId,
+                        ( *apitem->iIapServiceType == 
+                                TPtrC(OUTGOING_WCDMA) ) );
+                    }
+                else
+                    {
+                    // check if WLAN
+                    if ( aApItem.iExt->iWlanData )
+                        {
+                        RemoveLanL( apitem->iIapServiceId );
+                        }
+                    else
+                        {                            
+                        // no leave on else Unknown, as we are deleting 
+                        // so silently ignore the error...
+                        }
+                    }
+                RemoveIapL( apitem->iWapIap );
+                RemoveWapBearerApL( aApItem.iWapUid );
+                }
+            else
+                { // SMS
+                User::Leave( KErrInvalidBearerType );
+                }
+            RemoveProxyDataL( apitem->iIapServiceType, apitem->iIapServiceId );
+            WriteIspDataL( ETrue, aApItem.iIapServiceId, aApItem );
+            WriteIapDataL( ETrue, aApItem.iWapIap, aApItem );
+
+            // gets the UID needed for Bearer table
+            WriteWapApDataL( EFalse, aApItem.iWapUid, aApItem );
+            // needs new bearer record
+            WriteWapBearerDataL( ETrue, aApItem.iWapUid, aApItem );
+            if ( aApItem.HasProxy() )
+                {
+                WriteProxyDataL( ETrue, aApItem );
+                }
+            }
+        else
+            { // bearer table is same, but IAP_SERVICE is different
+            if ( ( aold == EApBearerTypeHSCSD ) ||
+                 ( aold == EApBearerTypeCSD ) )
+                {
+                RemoveIspL( apitem->iIapServiceId,
+                    ( *apitem->iIapServiceType == TPtrC(DIAL_OUT_ISP) ) );
+                }
+            else if ( ( *apitem->iIapServiceType ==
+                                        TPtrC(OUTGOING_WCDMA) )
+                     || ( *apitem->iIapServiceType ==
+                                        TPtrC(INCOMING_WCDMA) ) )
+                {
+                RemoveGprsL( apitem->iIapServiceId,
+                    ( *apitem->iIapServiceType == TPtrC(OUTGOING_WCDMA) ) );
+                }
+            else 
+                {
+                // check if WLAN
+                if ( aApItem.iExt->iWlanData )
+                    {
+                    RemoveLanL( apitem->iIapServiceId );
+                    }
+                else
+                    {
+                    // no leave on else Unknown, as we are deleting 
+                    // so silently ignore the error...
+                    }
+                }
+            RemoveProxyDataL( apitem->iIapServiceType, apitem->iIapServiceId );
+            WriteIspDataL( ETrue, aApItem.iIapServiceId, aApItem );
+            WriteIapDataL( EFalse, aApItem.iWapIap, aApItem );
+            // gets the UID needed for Bearer table
+            WriteWapApDataL( EFalse, aApItem.iWapUid, aApItem );
+            WriteWapBearerDataL( EFalse, aApItem.iWapUid, aApItem );
+            if ( aApItem.HasProxy() )
+                {
+                WriteProxyDataL( ETrue, aApItem );
+                }
+            }
+        CleanupStack::PopAndDestroy( 2, buf ); // apitem, buf
+        retval = ETrue;
+        }
+    CleanupStack::PopAndDestroy( au ); // au
+    // additional code for managing bearer-change ends here...
+
+    CLOG( ( EHandler, 1, 
+        _L( "<- CApDataHandler::HandleBearerChangeIfNeededL" ) ) );
+    return retval;
+    }
+
+
+
+
+
+// ---------------------------------------------------------
+// CApDataHandler::DoAccessPointDataL
+// ---------------------------------------------------------
+//
+void CApDataHandler::DoAccessPointDataL( TUint32 aUid,
+                                         CApAccessPointItem& aApItem )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::DoAccessPointDataL" ) ) );
+
+    ReadWapDataL( aUid, aApItem );
+
+    if ( *aApItem.iWapBearer == TPtrC(WAP_IP_BEARER) )
+        {
+        ReadIapDataL( aApItem.iWapIap, aApItem );
+        ReadNetworkDataL( aApItem );
+        ReadIspDataL( aApItem.iIapServiceId, aApItem );
+        }
+    ReadProxyDataL( aApItem );
+
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::DoAccessPointDataL" ) ) );
+    }
+
+
+// ---------------------------------------------------------
+// CApDataHandler::DoRemoveAPL
+// ---------------------------------------------------------
+//
+void CApDataHandler::DoRemoveAPL( TUint32 aUid )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::DoRemoveAPL" ) ) );
+
+    CApUtils* utils = CApUtils::NewLC( *iDb );
+    if ( utils->IsAPInUseL( aUid ) )
+        {
+        User::Leave( KErrInUse );
+        }
+    CleanupStack::PopAndDestroy( utils );   // utils
+
+    CCommsDbTableView* wapt;
+    wapt = iDb->OpenViewMatchingUintLC( TPtrC(WAP_ACCESS_POINT),
+                                       TPtrC(COMMDB_ID), aUid );
+    User::LeaveIfError( wapt->GotoFirstRecord() );
+    HBufC* buf = HBufC::NewLC( KCommsDbSvrMaxFieldLength );
+    TPtr ptr( buf->Des() );
+    wapt->ReadTextL( TPtrC(WAP_CURRENT_BEARER),
+                     ptr ); // see declaration for comments!
+
+    if ( *buf == TPtrC(WAP_IP_BEARER) )
+        {
+        // get serviceType
+        CCommsDbTableView* bearert;
+        bearert = iDb->OpenViewMatchingUintLC( TPtrC(WAP_IP_BEARER),
+                                               TPtrC(WAP_ACCESS_POINT_ID),
+                                               aUid );
+
+        User::LeaveIfError( bearert->GotoFirstRecord() );
+        TUint32 iapid;
+        ApCommons::ReadUintL( bearert, TPtrC(WAP_IAP), iapid );
+
+        CCommsDbTableView* iapt;
+        iapt = iDb->OpenViewMatchingUintLC( TPtrC(IAP), TPtrC(COMMDB_ID),
+                                            iapid );
+
+        User::LeaveIfError( iapt->GotoFirstRecord() );
+        HBufC* servicetype = HBufC::NewLC( KCommsDbSvrMaxFieldLength );
+        TPtr servptr( servicetype->Des() );
+        iapt->ReadTextL( TPtrC(IAP_SERVICE_TYPE), servptr );
+        TUint32 ispid;
+        iapt->ReadUintL( TPtrC(IAP_SERVICE), ispid );
+        TUint32 networkid;
+        iapt->ReadUintL( TPtrC(IAP_NETWORK), networkid );
+        RemoveNetworkDataL( networkid );
+        if ( ( *servicetype == TPtrC(DIAL_OUT_ISP) ) ||
+             ( *servicetype == TPtrC(DIAL_IN_ISP) ) )
+            { // ISP
+            RemoveIspL( ispid, ( *servicetype == TPtrC(DIAL_OUT_ISP)) );
+            RemoveIapL( iapid );
+            }
+        else
+            { // Gprs
+            if ( ( *servicetype == TPtrC(OUTGOING_WCDMA) ) ||
+                 ( *servicetype == TPtrC(INCOMING_WCDMA) ) )
+                {
+                RemoveGprsL( ispid, ( *servicetype == TPtrC(OUTGOING_WCDMA)) );
+                RemoveIapL( iapid );
+                }
+            else
+                { 
+                if ( *servicetype ==TPtrC(LAN_SERVICE) )
+                    {
+                    // LAN, WLAN
+                    RemoveLanL( ispid );
+                    RemoveIapL( iapid );
+                    }
+                else
+                    {
+                    // VPN...
+                    }
+                }
+            }
+        RemoveProxyDataL( servicetype, ispid );
+        RemoveWapBearerApL( aUid );
+        CleanupStack::PopAndDestroy( 3, bearert ); // servicetype,iapt,bearert
+        }
+    else
+        { // sms,
+        User::Leave( KErrInvalidBearerType );
+        }
+
+    RemoveWapApL( aUid );
+
+    CleanupStack::PopAndDestroy( 2, wapt );   // buf, wapt
+
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::DoRemoveAPL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApDataHandler::DoSetAsDefaultL
+// ---------------------------------------------------------
+//
+void CApDataHandler::DoSetAsDefaultL( TUint32 aUid,
+                                      TCommsDbIspType aIntendedType )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::DoSetAsDefaultL" ) ) );
+
+    // Due to changes in the database, ONLY WAP_ACCESS_POINT_ID
+    switch ( aIntendedType )
+        {
+        case EIspTypeInternetOnly:
+            {
+            SetDefaultIapIspL( aUid );
+            break;
+            }
+        case EIspTypeWAPOnly:
+            {
+            iDb->SetGlobalSettingL( TPtrC(WAP_ACCESS_POINT), aUid );
+            break;
+            }
+        case EIspTypeInternetAndWAP:
+            {
+            iDb->SetGlobalSettingL( TPtrC(WAP_ACCESS_POINT), aUid );
+            SetDefaultIapIspL( aUid );
+            break;
+            }
+        default :
+            {
+            __ASSERT_DEBUG( EFalse, User::Panic( KErrInvalidIntendedType,
+                                                 aIntendedType ) );
+            break;
+            }
+        }
+
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::DoSetAsDefaultL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApDataHandler::DoSetPreferredIfDbIapTypeL
+// ---------------------------------------------------------
+//
+void CApDataHandler::DoSetPreferredIfDbIapTypeL(
+                                 TUint32 aRank,
+                                 TCommDbConnectionDirection aDirection,
+                                 TUint32 aBearers,
+                                 TCommDbDialogPref aPrompt,
+                                 TUint32 aIAP,
+                                 TBool aOverwrite
+                                    )
+    {
+    CLOG( ( EHandler, 0, 
+        _L( "-> CApDataHandler::DoSetPreferredIfDbIapTypeL" ) ) );
+
+    CCommsDbConnectionPrefTableView* preft =
+             iDb->OpenConnectionPrefTableViewOnRankLC( aDirection, aRank );
+    if ( aOverwrite )
+        {
+        TInt res = preft->GotoFirstRecord(); // OK.
+        if ( res == KErrNone )
+            { // already exists, delete original and store the new one...
+            preft->DeleteConnectionPreferenceL();
+            }
+        else
+            {
+            // silently ignore KErrNotFound.
+            // It is not an error in this case.
+            if ( res != KErrNotFound )
+                {
+                User::Leave( res );
+                }
+            }
+        }
+    CCommsDbConnectionPrefTableView::TCommDbIapConnectionPref pref;
+    pref.iRanking = aRank;
+    pref.iBearer.iBearerSet = aBearers;
+    pref.iDialogPref = aPrompt;
+    pref.iBearer.iIapId = aIAP;
+    pref.iDirection = aDirection;
+    preft->InsertConnectionPreferenceL( pref );
+    CleanupStack::PopAndDestroy( preft ); // preft
+
+    CLOG( ( EHandler, 1, 
+        _L( "<- CApDataHandler::DoSetPreferredIfDbIapTypeL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApDataHandler::DoSetPreferredIfDbIspTypeL
+// ---------------------------------------------------------
+//
+void CApDataHandler::DoSetPreferredIfDbIspTypeL(
+                                 TUint32 /*aRank*/,
+                                 TCommDbConnectionDirection /*aDirection*/,
+                                 TUint32 /*aBearers*/,
+                                 TCommDbDialogPref /*aPrompt*/,
+                                 TUint32 /*aISP*/,
+                                 TUint32 /*aChargeCard*/,
+                                 const TDesC& /*aServiceType*/,
+                                 TBool /*aOverwrite*/
+                                    )
+    {
+    /*
+    DEPRECATED!!!
+    */
+    CLOG( ( EHandler, 0, 
+        _L( "<-> CApDataHandler::DoSetPreferredIfDbIspTypeL" ) ) );
+
+    User::Leave( KErrNotSupported );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApDataHandler::ApSpeed2EtelL
+// ---------------------------------------------------------
+//
+void CApDataHandler::ApSpeed2EtelL( CApAccessPointItem* aItem )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::ApSpeed2EtelL" ) ) );
+    
+    __ASSERT_DEBUG( (aItem), ApCommons::Panic( ENullPointer ) ) ;
+    
+    /*****************************************************
+    *   Series 60 Customer / ETel
+    *   Series 60  ETel API
+    *****************************************************/
+    
+    TInt bear = CSD;
+    switch ( aItem->BearerTypeL() )
+        {
+        case EApBearerTypeCSD:
+            {
+            // search for (CSD, x, x)
+            bear = CSD;
+            break;
+            }
+        case EApBearerTypeHSCSD:
+            {
+            // HSCSD
+            // search for (HCSD, x, x)
+            bear = HSCSD;
+            break;
+            }
+        default:
+            {
+            // it is called only for CSD/HSCSD bearers, but to be sure...
+            __ASSERT_DEBUG( EFalse, ApCommons::Panic( ENotSupported ) ) ;
+            User::Leave( KErrInvalidBearerType );
+            break;
+            }
+        }
+    
+    TInt type = Analogue;
+    switch ( aItem->iBearerCallTypeIsdn )
+        {
+        case ECallTypeAnalogue:
+            {
+            type = Analogue;
+            break;
+            }
+        case ECallTypeISDNv110:
+            {
+            type = V110;
+            break;
+            }
+        case ECallTypeISDNv120:
+            {
+            type = V120;
+            break;
+            }
+        default:
+            {
+            // it has only 3 states, but to be sure...
+            __ASSERT_DEBUG( EFalse, ApCommons::Panic( EInvalidSpeed ) ) ;
+            User::Leave( KErrInvalidBearerType );
+            break;            
+            }
+        }
+        
+    TBool found(EFalse);
+    // just get count once...
+    TInt count = sizeof(SpeedData)/sizeof(SpeedData[0]);    
+    
+    for( TInt i=0; i<count; i++)
+        {
+        if ( ( SpeedData[i][0] == bear ) 
+            && ( SpeedData[i][1] == type ) 
+            && ( SpeedData[i][2] == aItem->iMaxConnSpeed ) )
+            {
+            // wwe found it, get values, break
+            // Bearer_name, Bearer speed, Bearer_ce, Bearer_type
+            aItem->WriteUint( EApIspBearerName, SpeedData[i][3] );
+            aItem->iExt->iBearerSpeed = SpeedData[i][4];
+            aItem->WriteUint( EApIspBearerCE, SpeedData[i][5] );
+            aItem->WriteUint( EApIspBearerType, SpeedData[i][6] );
+            
+            
+            // Channel coding, Aiur, Req.Slot, MaxSlot, 
+            aItem->WriteUint( EApIspChannelCoding, SpeedData[i][7] );
+            aItem->WriteUint( EApIspAIUR, SpeedData[i][8] );
+            aItem->WriteUint( EApIspRequestedTimeSlots, SpeedData[i][9] );
+            aItem->WriteUint( EApIspMaximumTimeSlots, SpeedData[i][10] );
+            
+            // Bearer_service, Bearer_Protocol
+            aItem->WriteUint( EApIapBearerService, SpeedData[i][11] );
+            aItem->iExt->iBearerProtocol = SpeedData[i][12];
+
+            i = count;
+            found = ETrue;
+            }
+        }
+    if ( !found )
+        {
+        // if not found, someone set an invalid speed in the engine
+        // which already should have been checked, 
+        // just to be on the sure side
+        __ASSERT_DEBUG( EFalse, ApCommons::Panic( EInvalidSpeed ) ) ;
+        User::Leave(KErrNotFound);
+        }
+
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::ApSpeed2EtelL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApDataHandler::EtelSpeed2ApL
+// ---------------------------------------------------------
+//
+void CApDataHandler::EtelSpeed2ApL( CApAccessPointItem& aItem )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::EtelSpeed2ApL" ) ) );
+
+    // ************* ALERT ***************
+    // We utilise the fact that this is called right after the data 
+    // had been read from the DB and the 
+    // aItem.iMaxConnSpeed and aItem.iBearerCallTypeIsdn members 
+    // are holding the CommsDb style values.
+    // now we are converting it to our style as the API is fixed
+    // and so are the used enums...
+
+    /*****************************************************
+    *   Series 60 Customer / ETel
+    *   Series 60  ETel API
+    *****************************************************/
+
+    TBool found(EFalse);
+    // just get count once...
+    TInt count = sizeof(SpeedData)/sizeof(SpeedData[0]);    
+    
+    for( TInt i=0; i<count; i++)
+        {
+        if ( ( SpeedData[i][3] == aItem.iIspBearerName )
+            && ( SpeedData[i][4] == aItem.iExt->iBearerSpeed )
+            && ( SpeedData[i][5] == aItem.iIspBearerCE )
+            && ( SpeedData[i][6] == aItem.iIspBearerType )
+            && ( SpeedData[i][7] == aItem.iIspChannelCoding )
+            && ( SpeedData[i][8] == aItem.iIspAIUR )
+            && ( SpeedData[i][9] == aItem.iIspRequestedTimeSlots )
+            && ( SpeedData[i][10] == aItem.iIspMaximumTimeSlots )
+            && ( SpeedData[i][11] == aItem.iApIapBearerService )
+            && ( SpeedData[i][12] == aItem.iExt->iBearerProtocol ) )
+            {
+            // we found it, get values, break
+            switch ( SpeedData[i][0] )
+                { 
+                case CSD:
+                    {
+                    aItem.iIspBearerType = EBearerTypeCSD;
+                    break;
+                    }
+                case HSCSD:
+                    {
+                    aItem.iIspBearerType = EBearerTypeHSCSD;
+                    break;            
+                    }
+                default:
+                    { // incorrect db, repair...
+                    aItem.iIspBearerType = EBearerTypeCSD;
+                    break;
+                    }
+                }
+
+            
+            switch ( SpeedData[i][1])
+                {
+                case Analogue:
+                    {
+                    aItem.iBearerCallTypeIsdn = ECallTypeAnalogue;
+                    break;
+                    }
+                case V110:
+                    {
+                    aItem.iBearerCallTypeIsdn = ECallTypeISDNv110;
+                    break;
+                    }
+                case V120: 
+                    {
+                    aItem.iBearerCallTypeIsdn = ECallTypeISDNv120;
+                    break;
+                    }                    
+                default:
+                    {
+                    // incorrect db, repair...
+                    aItem.iBearerCallTypeIsdn = ECallTypeAnalogue;
+                    break;
+                    }
+                }
+            
+            aItem.iMaxConnSpeed = TApCallSpeed(SpeedData[i][2]);
+            i = count;
+            found = ETrue;
+            }
+        }
+    if ( !found )
+        {
+        // if not found, someone set an invalid speed in the engine
+        // which already should have been checked, 
+        // just to be on the sure side
+        __ASSERT_DEBUG( EFalse, ApCommons::Panic( EInvalidSpeed ) ) ;
+        User::Leave(KErrNotFound);
+        }
+  
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::EtelSpeed2ApL" ) ) );
+
+    }
+
+
+
+// Getting default access point
+// ---------------------------------------------------------
+// CApDataHandler::DoGetDefaultL
+// ---------------------------------------------------------
+//
+TUint32 CApDataHandler::DoGetDefaultL( TBool aIsWap,
+                                             TBool* aReadOnly ) const
+    { // client MUST initiate a transaction, we will NOT !
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::DoGetDefaultL" ) ) );
+
+    TUint32 value( KErrNone );
+    if ( aIsWap )
+        {
+        iDb->GetGlobalSettingL( TPtrC(WAP_ACCESS_POINT), value );
+        }
+    else
+        { 
+        TUint32 tmp( 0 );
+        // CONST_CAST added later, originally used other code, 
+        // when moved to 2.0, support was removed and needed 
+        // to use own (non-const)
+        // method which can not be made const as it is part of the public API
+        CONST_CAST( CApDataHandler*, this )->GetPreferredIfDbIapTypeL
+            ( 1, // Rank
+              ECommDbConnectionDirectionOutgoing,
+              tmp,    // aBearers,
+              tmp,    // aPrompt,
+              value   // aIAP
+            );
+        }
+
+    if ( aReadOnly )
+        { // get read-only flag for an AP
+        CCommsDbTableView* wapt =
+                iDb->OpenViewMatchingUintLC( TPtrC(WAP_ACCESS_POINT),
+                                             TPtrC(COMMDB_ID), value);
+        User::LeaveIfError( wapt->GotoFirstRecord() );
+        *aReadOnly = ApCommons::DoGetReadOnlyL( *wapt );
+        CleanupStack::PopAndDestroy( wapt );
+        }
+    
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::DoGetDefaultL" ) ) );
+    return value;
+    }
+
+
+// ---------------------------------------------------------
+// CApDataHandler::WriteProxyDataL
+// ---------------------------------------------------------
+//
+void CApDataHandler::WriteProxyDataL( TBool aIsNew, 
+                                      const CApAccessPointItem& aApItem )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::WriteProxyDataL" ) ) );
+
+    CCommsDbTableView* proxies;
+    if ( aIsNew )
+        {
+        proxies = iDb->OpenTableLC( TPtrC(PROXIES) );
+        // variable needed just to be able to make the call...
+        TUint32 dummy;
+        User::LeaveIfError( proxies->InsertRecord( dummy ) );
+        }
+    else
+        {
+        // Add test cases covering this route
+        proxies = iDb->OpenViewMatchingTextLC( TPtrC(PROXIES), 
+                                               TPtrC(PROXY_SERVICE_TYPE),
+                                               *aApItem.iIapServiceType );
+        TInt err = proxies->GotoFirstRecord();
+        if ( err == KErrNotFound )
+            { // originally there were NO proxy, but now it is added
+            // variable needed just to be able to make the call...
+            // Add test cases covering this route
+            TUint32 dummy;
+            User::LeaveIfError( proxies->InsertRecord( dummy ) );
+            }
+        else
+            {
+            // Add test cases covering this route
+            // now check if we have our record
+            TUint32 uval;
+            TBool found( EFalse );
+            do
+                {
+                // Add test cases covering this route
+                proxies->ReadUintL( TPtrC(PROXY_ISP), uval );
+                if ( uval == aApItem.iIapServiceId )
+                    {
+                    found = ETrue;
+                    }
+                else
+                    {
+                    err = proxies->GotoNextRecord();
+                    }
+                } while ( (!err) && (!found) );
+            if ( !found )
+                { // no proxy record, add it now
+                // variable needed just to be able to make the call...
+                TUint32 dummy;
+                User::LeaveIfError( proxies->InsertRecord( dummy ) );
+                }
+            else
+                { // we found our proxy, use it...
+                User::LeaveIfError( proxies->UpdateRecord() );
+                }
+            }
+        }
+    proxies->WriteUintL( TPtrC(PROXY_ISP), aApItem.iIapServiceId );
+    proxies->WriteTextL( TPtrC(PROXY_SERVICE_TYPE),
+                         *aApItem.iIapServiceType );
+
+
+    proxies->WriteLongTextL( TPtrC(PROXY_SERVER_NAME),
+                            *aApItem.iApProxyServerAddress);
+
+    proxies->WriteTextL( TPtrC(PROXY_PROTOCOL_NAME),
+                         *aApItem.iApProxyProtocolName );
+
+    proxies->WriteUintL( TPtrC(PROXY_PORT_NUMBER),
+                         aApItem.iApProxyPortNumber );
+
+    proxies->WriteBoolL( TPtrC(PROXY_USE_PROXY_SERVER), 
+                         aApItem.iApProxyUseProxy );
+
+    proxies->WriteLongTextL( TPtrC(PROXY_EXCEPTIONS),
+                            *aApItem.iApProxyExceptions );
+
+    User::LeaveIfError( proxies->PutRecordChanges( EFalse, EFalse ) );
+
+    CleanupStack::PopAndDestroy( proxies );   // proxies
+
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::WriteProxyDataL" ) ) );
+    }
+
+
+// ---------------------------------------------------------
+// CApDataHandler::ReadProxyDataL
+// ---------------------------------------------------------
+//
+void CApDataHandler::ReadProxyDataL( CApAccessPointItem& aApItem )
+    {
+    // internal function, caller MUST initiate a transaction, WE WILL NOT.
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::ReadProxyDataL" ) ) );
+
+    // Add test cases covering ALL routes of this function
+
+    CCommsDbTableView* proxies;    
+    proxies = iDb->OpenViewMatchingTextLC( TPtrC(PROXIES), 
+                                           TPtrC(PROXY_SERVICE_TYPE),
+                                           *aApItem.iIapServiceType );
+
+    TInt err = proxies->GotoFirstRecord();
+
+    if ( err != KErrNotFound )
+        {
+        User::LeaveIfError( err );
+        }
+
+    if ( err != KErrNotFound )
+        {
+        // we have some proxy, now found our record...
+        TUint32 uval;
+        TBool found( EFalse );
+        do
+            {
+            proxies->ReadUintL( TPtrC(PROXY_ISP), uval );
+            if ( uval == aApItem.iIapServiceId )
+                {
+                found = ETrue;
+                }
+            else
+                {
+                err = proxies->GotoNextRecord();
+                }
+            } while ( (!err) && (!found) );
+        if ( found )
+            {
+            HBufC* buf = ApCommons::ReadLongTextLC( proxies,
+                                                    TPtrC(PROXY_SERVER_NAME),
+                                                    err );
+            if ( err != KErrUnknown )
+                {
+                aApItem.WriteLongTextL( EApProxyServerAddress, *buf );
+                }
+
+            CleanupStack::PopAndDestroy( buf ); 
+            buf = ApCommons::ReadText16ValueLC( proxies, 
+                                                TPtrC(PROXY_PROTOCOL_NAME) );
+            aApItem.WriteTextL( EApProxyProtocolName, *buf );
+            CleanupStack::PopAndDestroy( buf ); 
+
+            TUint32 tempint( 0 );
+            TBool tempbool( EFalse );
+
+            ApCommons::ReadUintL( proxies, TPtrC(PROXY_PORT_NUMBER), tempint );
+            aApItem.WriteUint( EApProxyPortNumber, tempint );
+
+
+            ApCommons::ReadBoolL( proxies, 
+                                  TPtrC(PROXY_USE_PROXY_SERVER), 
+                                  tempbool );
+            aApItem.WriteBool( EApProxyUseProxy, tempbool );
+
+            buf = ApCommons::ReadLongTextLC( proxies,
+                                             TPtrC(PROXY_EXCEPTIONS),
+                                             err );
+            aApItem.WriteLongTextL( EApProxyExceptions, *buf );
+    
+            CleanupStack::PopAndDestroy( buf );
+            }
+        }
+    CleanupStack::PopAndDestroy( proxies ); // proxies, sqlbuf
+
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::ReadProxyDataL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApDataHandler::RemoveProxyDataL
+// ---------------------------------------------------------
+//
+void CApDataHandler::RemoveProxyDataL( HBufC* aServiceType, TUint32 aIspId )
+    {
+    // internal function, caller MUST initiate a transaction, WE WILL NOT.
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::RemoveProxyDataL" ) ) );
+
+    // Add test cases covering ALL routes of this function
+
+    CCommsDbTableView* proxies;    
+    proxies = iDb->OpenViewMatchingTextLC( TPtrC(PROXIES), 
+                                           TPtrC(PROXY_SERVICE_TYPE),
+                                           *aServiceType );
+
+    TInt err = proxies->GotoFirstRecord();
+
+    if ( err != KErrNotFound )
+        {
+        User::LeaveIfError( err );
+        }
+
+    if ( err != KErrNotFound )
+        {
+        // we have some proxy, now found our record...
+        TUint32 uval;
+        TBool found( EFalse );
+        do
+            {
+            proxies->ReadUintL( TPtrC(PROXY_ISP), uval );
+            if ( uval == aIspId )
+                {
+                found = ETrue;
+                }
+            else
+                {
+                err = proxies->GotoNextRecord();
+                }
+            } while ( (!err) && (!found) );
+        if ( found )
+            {
+            if ( err == KErrNone )
+                {
+                User::LeaveIfError( proxies->DeleteRecord() );
+                }
+            else
+                {
+                // silently ignore KErrNotFound. It is caused by incorrect DB,
+                // we are 'repairing it' this way.
+                if ( err != KErrNotFound )
+                    {
+                    User::LeaveIfError( err );
+                    }
+                }
+            }
+        }
+    CleanupStack::PopAndDestroy( proxies ); // proxies
+    
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::RemoveProxyDataL" ) ) );
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CApDataHandler::WriteNetworkDataL
+// ---------------------------------------------------------
+//
+void CApDataHandler::WriteNetworkDataL( TBool aIsNew, 
+                                        CApAccessPointItem& aApItem )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::WriteNetworkDataL" ) ) );
+
+    if ( aApItem.iNetworkName->Compare( KEmpty ) != 0 )
+        {
+        CCommsDbTableView* networks;
+        HBufC* buf = HBufC::NewLC( KApEngineMaxSql );
+        if ( aIsNew )
+            {
+            networks = iDb->OpenTableLC( TPtrC(NETWORK) );
+            TUint32 netid;
+            User::LeaveIfError( networks->InsertRecord( netid ) );
+            aApItem.iNetworkId = netid;
+            }
+        else
+            {
+            networks = iDb->OpenViewMatchingUintLC( TPtrC(NETWORK), 
+                                                    TPtrC(COMMDB_ID), 
+                                                    aApItem.iNetworkId );
+            TInt err = networks->GotoFirstRecord();
+            if ( err == KErrNotFound )
+                { 
+                // originally there were NO network, but now it is added
+                TUint32 netid;
+                User::LeaveIfError( networks->InsertRecord( netid ) );
+                aApItem.iNetworkId = netid;
+                }
+            else
+                {
+                User::LeaveIfError( networks->UpdateRecord() );
+                }
+            }
+        networks->WriteTextL( TPtrC(COMMDB_NAME), *aApItem.iNetworkName );
+
+        User::LeaveIfError( networks->PutRecordChanges( EFalse, EFalse ) );
+
+        CleanupStack::PopAndDestroy( networks );   // networks
+        CleanupStack::PopAndDestroy( buf );   // buf
+        }
+    
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::WriteNetworkDataL" ) ) );
+    }
+
+
+// ---------------------------------------------------------
+// CApDataHandler::ReadNetworkDataL
+// ---------------------------------------------------------
+//
+void CApDataHandler::ReadNetworkDataL( CApAccessPointItem& aApItem )
+    {
+    // internal function, caller MUST initiate a transaction, WE WILL NOT.
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::ReadNetworkDataL" ) ) );
+        
+    CCommsDbTableView* networks;
+    networks = iDb->OpenViewMatchingUintLC( TPtrC(NETWORK), 
+                                            TPtrC(COMMDB_ID), 
+                                            aApItem.iNetworkId );
+
+    TInt err = networks->GotoFirstRecord();
+
+    if ( err != KErrNotFound )
+        {
+        User::LeaveIfError( err );
+        }
+    if ( err != KErrNotFound )
+        {
+        HBufC* buf = ApCommons::ReadText16ValueLC( networks, 
+                                                   TPtrC(COMMDB_NAME) );
+        if ( err != KErrUnknown )
+            {
+            aApItem.WriteTextL( EApNetworkName, *buf );
+            }
+
+        CleanupStack::PopAndDestroy( buf );
+        }
+    else
+        { // not found, set to NONE
+        aApItem.WriteTextL( EApNetworkName, KEmpty );
+        }
+    CleanupStack::PopAndDestroy( networks ); // networks
+    
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::ReadNetworkDataL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApDataHandler::RemoveNetworkDataL
+// ---------------------------------------------------------
+//
+void CApDataHandler::RemoveNetworkDataL( TUint32 aIspId )
+    {
+    // internal function, caller MUST initiate a transaction, WE WILL NOT.
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::RemoveNetworkDataL" ) ) );
+        
+    CCommsDbTableView* networks;
+    networks = iDb->OpenViewMatchingUintLC( TPtrC(NETWORK), 
+                                            TPtrC(COMMDB_ID), 
+                                            aIspId );
+
+    TInt err = networks->GotoFirstRecord();
+
+    if ( err == KErrNone )
+        {
+        User::LeaveIfError( networks->DeleteRecord() );
+        }
+    else
+        {
+        // silently ignore KErrNotFound. It is caused by incorrect DB,
+        // we are 'repairing it' this way.
+        if ( err != KErrNotFound )
+            {
+            User::LeaveIfError( err );
+            }
+        }
+    CleanupStack::PopAndDestroy( networks ); // networks, buf
+
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::RemoveNetworkDataL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApDataHandler::GetLocationIdL
+// ---------------------------------------------------------
+//
+TUint32 CApDataHandler::GetLocationIdL()
+    {
+    // agreed that the location record having the name 'Mobile' is used
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::GetLocationIdL" ) ) );
+
+    CCommsDbTableView* loc;
+    loc = iDb->OpenViewMatchingTextLC( TPtrC(LOCATION), TPtrC(COMMDB_NAME), 
+                                       KLocation );
+    TInt err = loc->GotoFirstRecord();
+
+    User::LeaveIfError( err );
+    TUint32 id( 0 );
+    loc->ReadUintL( TPtrC(COMMDB_ID), id );
+
+    CleanupStack::PopAndDestroy( loc ); // loc
+
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::GetLocationIdL" ) ) );
+    return id;    
+    }
+
+
+
+// ---------------------------------------------------------
+// CApDataHandler::GetModemBearerIDL
+// ---------------------------------------------------------
+//
+TUint32 CApDataHandler::GetModemBearerIDL( CApAccessPointItem& aApItem )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::GetModemBearerIDL" ) ) );
+
+    // agreed that the modem bearer record having the name 
+    // 'CSD Modem' is used for (HS)CSD Access Points and
+    // 'GPRS Modem' is used for GPRS/WCDMA Access Points
+    // 'CDMA Modem' is used for CDMA Access Points
+    CCommsDbTableView* view = NULL;
+    TApBearerType bearer = aApItem.BearerTypeL();
+    switch ( bearer )
+        {
+        case EApBearerTypeCSD:
+        case EApBearerTypeHSCSD:
+            {
+            view = iDb->OpenViewMatchingTextLC( TPtrC(MODEM_BEARER), 
+                                               TPtrC(COMMDB_NAME), 
+                                               KModemBearerCSD );
+            break;
+            }
+        case EApBearerTypeCDMA:
+            {
+            view = iDb->OpenViewMatchingTextLC( TPtrC(MODEM_BEARER), 
+                                               TPtrC(COMMDB_NAME), 
+                                               KModemBearerCDMA );
+            break;
+            }
+        case EApBearerTypeGPRS:
+            {
+            view = iDb->OpenViewMatchingTextLC( TPtrC(MODEM_BEARER), 
+                                               TPtrC(COMMDB_NAME), 
+                                               KModemBearerGPRS );
+            break;
+            }
+#ifdef __TEST_LAN_BEARER
+        case EApBearerTypeLAN:
+            {
+            view = iDb->OpenViewMatchingTextLC( TPtrC(LAN_BEARER), 
+                                           TPtrC(COMMDB_NAME), 
+                                           KModemBearerLAN );
+            break;
+            }
+#endif // __TEST_LAN_BEARER            
+        case EApBearerTypeWLAN:
+            {
+            if ( aApItem.iExt->iWlanData )
+                {                
+                view = iDb->OpenViewMatchingTextLC( TPtrC(LAN_BEARER), 
+                                                    TPtrC(COMMDB_NAME), 
+                                                    KModemBearerWLAN );
+                }
+            else
+                {
+                User::Leave( KErrNotSupported );
+                }
+            break;
+            }
+        case EApBearerTypeLANModem:
+            {
+            view = iDb->OpenViewMatchingTextLC( TPtrC(LAN_BEARER), 
+                                           TPtrC(COMMDB_NAME), 
+                                           KModemBearerLANModem );
+            break;
+            }            
+        default:
+            {
+            User::Leave( KErrInvalidBearerType );
+            }
+        }
+        
+    TUint32 id( 0 );
+    
+    if ( view )
+        {
+        TInt err = view->GotoFirstRecord();
+        if ( err == KErrNone )
+            {
+            view->ReadUintL( TPtrC(COMMDB_ID), id );
+            }
+        else
+            {
+            if ( err != KErrNotFound ) 
+                {
+                User::LeaveIfError( err );
+                }
+            else
+                {
+                if ( aApItem.iExt->iWlanData )
+                    {
+                    id = CreateLanBearerIfNeededL();
+                    }
+                else
+                    {
+#ifdef      __TEST_LAN_BEARER
+                    id = CreateLanBearerIfNeededL();
+#else // __TEST_LAN_BEARER                
+                    User::Leave( KErrNotSupported );
+#endif //__TEST_LAN_BEARER
+                    }
+                }
+            }
+        CleanupStack::PopAndDestroy( view ); // view
+        }
+
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::GetModemBearerIDL" ) ) );
+    return id;
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CApDataHandler::ReadServiceL
+// ---------------------------------------------------------
+//
+void CApDataHandler::ReadServiceL( CCommsDbTableView& ispt,
+                                   CApAccessPointItem& aApItem )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::ReadServiceL" ) ) );
+
+    HBufC* buf = ApCommons::ReadText16ValueLC( &ispt, TPtrC(COMMDB_NAME) );
+    aApItem.WriteTextL( EApIspName, *buf );
+    CleanupStack::PopAndDestroy( buf );
+    
+//    TUint32 tempint( 0 );
+    TBool   tempbool( EFalse );
+
+/*
+    buf = ApCommons::ReadText16ValueLC( &ispt, TPtrC(SERVICE_IF_PARAMS) );
+    aApItem.WriteTextL( EApIspIfParams, *buf );
+    CleanupStack::PopAndDestroy( buf );
+*/
+    buf = ApCommons::ReadText16ValueLC( &ispt, TPtrC(SERVICE_IF_NETWORKS) );
+    aApItem.WriteTextL( EApWlanIfNetworks, *buf );
+    CleanupStack::PopAndDestroy( buf );
+
+/*
+    ApCommons::ReadBoolL( &ispt, TPtrC(SERVICE_IF_PROMPT_FOR_AUTH), tempbool );
+    aApItem.WriteBool( EApWlanIfPromptForAuth, tempbool );
+
+    buf = ApCommons::ReadText16ValueLC( &ispt, TPtrC(SERVICE_IF_AUTH_NAME) );
+    aApItem.WriteTextL( EApWlanIfAuthName, *buf );
+    CleanupStack::PopAndDestroy( buf );
+
+    buf = ApCommons::ReadText16ValueLC( &ispt, TPtrC(SERVICE_IF_AUTH_PASS) );
+    aApItem.WriteTextL( EApWlanIfAuthPassword, *buf );
+    CleanupStack::PopAndDestroy( buf );
+
+    ApCommons::ReadUintL( &ispt, TPtrC(SERVICE_IF_AUTH_RETRIES), tempint );
+    aApItem.WriteUint( EApWlanIfAuthRetries, tempint );
+
+    ApCommons::ReadBoolL( &ispt,
+                           TPtrC(SERVICE_IF_CALLBACK_ENABLED), tempbool );
+    aApItem.WriteBool( EApIspIfCallbackEnabled, tempbool );
+
+    ApCommons::ReadUintL( &ispt, TPtrC(SERVICE_IF_CALLBACK_TYPE), tempint );
+    aApItem.WriteUint( EApIspIfCallbackType, ( TCallbackAction )tempint );
+
+    HBufC8* buf8 = ApCommons::ReadText8ValueLC
+                                ( &ispt, TPtrC(SERVICE_IF_CALLBACK_INFO) );
+    aApItem.WriteTextL( EApIspIfCallbackInfo, *buf8 );
+    CleanupStack::PopAndDestroy( buf8 ); 
+
+    ApCommons::ReadUintL( &ispt, TPtrC(SERVICE_CALLBACK_TIMEOUT), tempint );
+    aApItem.WriteUint( EApIspCallBackTimeOut, tempint );
+*/
+
+    buf = ApCommons::ReadText16ValueLC( &ispt, TPtrC(SERVICE_IP_NETMASK) );
+    aApItem.WriteTextL( EApWlanIpNetMask, *buf );
+    CleanupStack::PopAndDestroy( buf );
+
+    buf = ApCommons::ReadText16ValueLC( &ispt, TPtrC(SERVICE_IP_GATEWAY) );
+    aApItem.WriteTextL( EApWlanIpGateway, *buf );
+    CleanupStack::PopAndDestroy( buf );
+
+    ApCommons::ReadBoolL( &ispt, 
+                          TPtrC(SERVICE_IP_ADDR_FROM_SERVER), tempbool );
+    aApItem.WriteBool( EApWlanIpAddrFromServer, tempbool );
+
+    buf = ApCommons::ReadText16ValueLC( &ispt, TPtrC(SERVICE_IP_ADDR) );
+    aApItem.WriteTextL( EApWlanIpAddr, *buf );
+    CleanupStack::PopAndDestroy( buf );
+
+    ApCommons::ReadBoolL( &ispt, TPtrC(SERVICE_IP_DNS_ADDR_FROM_SERVER),
+                           tempbool );
+    aApItem.WriteBool( EApWlanIpDnsAddrFromServer, tempbool );
+
+    buf = ApCommons::ReadText16ValueLC( &ispt, 
+                                        TPtrC(SERVICE_IP_NAME_SERVER1) );
+    aApItem.WriteTextL( EApWlanIPNameServer1, *buf );
+    CleanupStack::PopAndDestroy( buf );
+
+    buf = ApCommons::ReadText16ValueLC( &ispt, 
+                                        TPtrC(SERVICE_IP_NAME_SERVER2) );
+    aApItem.WriteTextL( EApWlanIPNameServer2, *buf );
+    CleanupStack::PopAndDestroy( buf );
+
+/*
+    ApCommons::ReadBoolL( &ispt, TPtrC(SERVICE_ENABLE_SW_COMP), tempbool );
+    aApItem.WriteBool( EApIspEnableSWCompression, tempbool );
+
+    ApCommons::ReadBoolL( &ispt, 
+                          TPtrC(SERVICE_ENABLE_IP_HEADER_COMP), 
+                          tempbool );
+    aApItem.WriteBool( EApIspEnableIpHeaderComp, tempbool);
+
+    ApCommons::ReadBoolL( &ispt, 
+                          TPtrC(SERVICE_ENABLE_LCP_EXTENSIONS), tempbool );
+    aApItem.WriteBool( EApIspEnableLCPExtensions, tempbool );
+
+    ApCommons::ReadBoolL( &ispt, TPtrC(SERVICE_DISABLE_PLAIN_TEXT_AUTH),
+                           tempbool );
+    aApItem.WriteBool( EApIspDisablePlainTextAuth, tempbool );
+*/
+    CLOG( ( EHandler, 0, _L( "<- CApDataHandler::ReadServiceL" ) ) );
+    }
+
+
+// ---------------------------------------------------------
+// CApDataHandler::ReadServiceIp6L
+// ---------------------------------------------------------
+//
+void CApDataHandler::ReadServiceIp6L( CCommsDbTableView& ispt,
+                                   CApAccessPointItem& aApItem )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::ReadServiceIp6L" ) ) );
+
+    if ( iExt->iIsIpv6Supported )
+        {
+        TBool tempbool( EFalse );
+        HBufC* buf;
+
+        ApCommons::ReadBoolL( &ispt, TPtrC(SERVICE_IP6_DNS_ADDR_FROM_SERVER),
+                               tempbool );
+
+        aApItem.WriteBool( EApIP6DNSAddrFromServer, tempbool );
+
+        buf = ApCommons::ReadText16ValueLC( &ispt,
+                                            TPtrC(SERVICE_IP6_NAME_SERVER1) );
+
+        aApItem.WriteTextL( EApIP6NameServer1, *buf );
+        CleanupStack::PopAndDestroy( buf );
+
+        buf = ApCommons::ReadText16ValueLC( &ispt,
+                                            TPtrC(SERVICE_IP6_NAME_SERVER2) );
+
+        aApItem.WriteTextL( EApIP6NameServer2, *buf );
+        CleanupStack::PopAndDestroy( buf );
+        }
+
+    CLOG( ( EHandler, 0, _L( "<- CApDataHandler::ReadServiceIp6L" ) ) );
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CApDataHandler::WriteServiceL
+// ---------------------------------------------------------
+//
+void CApDataHandler::WriteServiceL( CCommsDbTableView& aTable,
+                                    CApAccessPointItem& aApItem )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::WriteServiceL" ) ) );
+    
+    aTable.WriteTextL( TPtrC(COMMDB_NAME), *aApItem.iIspName );
+    
+//    aTable.WriteTextL( TPtrC(SERVICE_IF_PARAMS), *aApItem.iIspIfParams );
+
+    aTable.WriteTextL( TPtrC(SERVICE_IF_NETWORKS), *aApItem.iIspIfNetworks );
+
+//    aTable.WriteBoolL( TPtrC(SERVICE_IF_PROMPT_FOR_AUTH),
+//                     aApItem.iIspIfPromptForAuth );
+
+//    aTable.WriteTextL( TPtrC(SERVICE_IF_AUTH_NAME), 
+//                       *aApItem.iIspIfAuthName );
+
+//    aTable.WriteTextL( TPtrC(SERVICE_IF_AUTH_PASS), 
+//                       *aApItem.iIspIfAuthPass );
+
+//    aTable.WriteUintL( TPtrC(SERVICE_IF_AUTH_RETRIES),
+//                     aApItem.iIspIfAuthRetries );
+
+    aTable.WriteTextL( TPtrC(SERVICE_IP_NETMASK), *aApItem.iIspIPNetMask );
+
+    aTable.WriteTextL( TPtrC(SERVICE_IP_GATEWAY), *aApItem.iIspGateway );
+
+    aTable.WriteBoolL( TPtrC(SERVICE_IP_ADDR_FROM_SERVER),
+                       aApItem.iIspIPAddrFromServer );
+
+    aTable.WriteTextL( TPtrC(SERVICE_IP_ADDR), *aApItem.iIspIPAddr );
+
+    aTable.WriteBoolL( TPtrC(SERVICE_IP_DNS_ADDR_FROM_SERVER),
+                     aApItem.iGetDNSIPFromServer );
+
+    aTable.WriteTextL( TPtrC(SERVICE_IP_NAME_SERVER1), 
+                       *aApItem.iPrimaryDNS );
+
+    aTable.WriteTextL( TPtrC(SERVICE_IP_NAME_SERVER2), 
+                       *aApItem.iSecondaryDNS );
+
+/*
+    aTable.WriteBoolL( TPtrC(SERVICE_ENABLE_LCP_EXTENSIONS),
+                     aApItem.iIspEnableLCPExtensions );
+
+    aTable.WriteBoolL( TPtrC(SERVICE_DISABLE_PLAIN_TEXT_AUTH),
+                     aApItem.iIsPasswordAuthenticationSecure );
+
+    aTable.WriteBoolL( TPtrC(SERVICE_ENABLE_SW_COMP),
+                     aApItem.iIspEnableSwCompression );
+
+    aTable.WriteBoolL( TPtrC(SERVICE_ENABLE_IP_HEADER_COMP),
+                     aApItem.iEnablePPPCompression );
+        
+    aTable.WriteBoolL( TPtrC(SERVICE_IF_CALLBACK_ENABLED),
+                     aApItem.iUseCallBack );
+
+    aTable.WriteUintL( TPtrC(SERVICE_IF_CALLBACK_TYPE),
+                     aApItem.iCallBackTypeIsServerNum );
+
+    aTable.WriteTextL( TPtrC(SERVICE_IF_CALLBACK_INFO),
+                     *aApItem.iIspIfCallbackInfo );
+
+    aTable.WriteUintL( TPtrC(SERVICE_CALLBACK_TIMEOUT),
+                     aApItem.iIspCallbackTimeOut );    
+*/    
+
+//    WriteDaemonL( aTable, aApItem ); starts here
+    if ( aApItem.iIspIPAddrFromServer )
+        {
+        aTable.WriteTextL( TPtrC(SERVICE_CONFIG_DAEMON_MANAGER_NAME), 
+                           KDaemonManagerName );
+        aTable.WriteTextL( TPtrC(SERVICE_CONFIG_DAEMON_NAME), 
+                           KConfigDaemonName );
+        }
+    else
+        {
+        // 3.1 it is changed!!
+        if ( FeatureManager::FeatureSupported( KFeatureIdIPv6 ) )
+            {
+            aTable.WriteTextL( TPtrC(SERVICE_CONFIG_DAEMON_MANAGER_NAME), 
+                               KDaemonManagerName );
+            aTable.WriteTextL( TPtrC(SERVICE_CONFIG_DAEMON_NAME), 
+                               KConfigDaemonName );            
+            }
+        else
+            {
+            aTable.WriteTextL( TPtrC(SERVICE_CONFIG_DAEMON_MANAGER_NAME), KEmpty );
+            aTable.WriteTextL( TPtrC(SERVICE_CONFIG_DAEMON_NAME), KEmpty );            
+            }
+        }
+//    WriteDaemonL() Ends here
+
+
+    CLOG( ( EHandler, 0, _L( "<- CApDataHandler::WriteServiceL" ) ) );
+    }
+
+
+// ---------------------------------------------------------
+// CApDataHandler::WriteServiceIp6L
+// ---------------------------------------------------------
+//
+void CApDataHandler::WriteServiceIp6L( CCommsDbTableView& ispt,
+                                       CApAccessPointItem& aApItem )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::WriteServiceIp6L" ) ) );
+
+    ispt.WriteBoolL( TPtrC(SERVICE_IP6_DNS_ADDR_FROM_SERVER),
+                     aApItem.iExt->iIpv6GetDNSIPFromServer );
+
+    ispt.WriteTextL( TPtrC(SERVICE_IP6_NAME_SERVER1), 
+                    *aApItem.iExt->iIpv6PrimaryDNS );
+
+    ispt.WriteTextL( TPtrC(SERVICE_IP6_NAME_SERVER2), 
+                    *aApItem.iExt->iIpv6SecondaryDNS );
+        
+    CLOG( ( EHandler, 0, _L( "<- CApDataHandler::WriteServiceIp6L" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApDataHandler::WriteCsdDataL
+// ---------------------------------------------------------
+//
+void CApDataHandler::WriteCsdDataL( TBool aIsNew,
+                                    CApAccessPointItem& aApItem )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::WriteCsdDataL" ) ) );
+
+    TInt isCsdSupported = 
+         FeatureManager::FeatureSupported( KFeatureIdAppCsdSupport ); 
+#ifdef __TEST_CSD_SUPPORT
+    isCsdSupported = ETrue;
+#endif // __TEST_CSD_SUPPORT
+   
+    TCommsDbBearerType bearerType = 
+                    STATIC_CAST( TCommsDbBearerType, aApItem.iIspBearerType );
+
+    if ( ( ( bearerType == EBearerTypeCSD ) && ( !isCsdSupported ) ) || 
+         ( ( bearerType == EBearerTypeHSCSD ) && 
+           ( !isCsdSupported || !iExt->iIsAppHscsdSupport ) ) )
+        {
+        User::Leave( KErrNotSupported );
+        }
+
+    CCommsDbTableView* ispt;
+
+    if ( aIsNew )
+        {
+        ispt = iDb->OpenTableLC( *aApItem.iIapServiceType );
+        User::LeaveIfError( ispt->InsertRecord( aApItem.iIapServiceId ) );
+        }
+    else
+        {
+        ispt = iDb->OpenViewMatchingUintLC( *aApItem.iIapServiceType,
+                                           TPtrC(COMMDB_ID),
+                                           aApItem.iIapServiceId );
+        User::LeaveIfError( ispt->GotoFirstRecord() );
+        User::LeaveIfError( ispt->UpdateRecord() );
+        }
+    // now write record data
+    ispt->WriteTextL( TPtrC(COMMDB_NAME), *aApItem.iIspName );
+
+    ispt->WriteTextL( TPtrC(ISP_DESCRIPTION), *aApItem.iIspDescription );
+
+    ispt->WriteUintL( TPtrC(ISP_TYPE), aApItem.iIspType );
+
+    ispt->WriteTextL( TPtrC(ISP_DEFAULT_TEL_NUM),
+                     *aApItem.iIspDefaultTelNumber );
+
+    ispt->WriteBoolL( TPtrC(ISP_DIAL_RESOLUTION),
+                     aApItem.iIspDialResolution );
+
+    ispt->WriteBoolL( TPtrC(ISP_USE_LOGIN_SCRIPT),
+                      aApItem.iUseLoginScript );
+
+    ispt->WriteLongTextL( TPtrC(ISP_LOGIN_SCRIPT), *aApItem.iLoginScript );
+
+    ispt->WriteBoolL( TPtrC(ISP_PROMPT_FOR_LOGIN),
+                      aApItem.iPromptPassword );
+
+    ispt->WriteTextL( TPtrC(ISP_LOGIN_NAME), *aApItem.iUserName );
+
+    ispt->WriteTextL( TPtrC(ISP_LOGIN_PASS), *aApItem.iPassword );
+
+    ispt->WriteBoolL( TPtrC(ISP_DISPLAY_PCT),
+                     aApItem.iDisplayTerminalWindow );
+
+    ApSpeed2EtelL( &aApItem );
+
+/*
+// Keep as long as replacing IF_NAME does not works as specified
+    ispt->WriteTextL( TPtrC(IF_NAME), *aApItem.iIspIfName );
+*/
+
+    ispt->WriteTextL( TPtrC(ISP_IF_PARAMS), *aApItem.iIspIfParams );
+
+    ispt->WriteTextL( TPtrC(ISP_IF_NETWORKS), *aApItem.iIspIfNetworks );
+
+    ispt->WriteBoolL( TPtrC(ISP_IF_PROMPT_FOR_AUTH),
+                     aApItem.iIspIfPromptForAuth );
+
+    // as same UserName & Auth_name is required
+    ispt->WriteTextL( TPtrC(ISP_IF_AUTH_NAME), *aApItem.iUserName );
+
+    // as same login_pass & Auth_password is required
+    ispt->WriteTextL( TPtrC(ISP_IF_AUTH_PASS), *aApItem.iPassword );
+
+    ispt->WriteUintL( TPtrC(ISP_IF_AUTH_RETRIES),
+                      aApItem.iIspIfAuthRetries );
+
+    ispt->WriteBoolL( TPtrC(ISP_IF_CALLBACK_ENABLED),
+                      aApItem.iUseCallBack );
+
+    ispt->WriteUintL( TPtrC(ISP_IF_CALLBACK_TYPE),
+                     aApItem.iCallBackTypeIsServerNum );
+
+    ispt->WriteTextL( TPtrC(ISP_IF_CALLBACK_INFO),
+                      *aApItem.iIspIfCallbackInfo );
+
+    ispt->WriteUintL( TPtrC(ISP_CALLBACK_TIMEOUT),
+                     aApItem.iIspCallbackTimeOut );
+
+    ispt->WriteBoolL( TPtrC(ISP_IP_ADDR_FROM_SERVER),
+                     aApItem.iIspIPAddrFromServer );
+
+    ispt->WriteTextL( TPtrC(ISP_IP_ADDR), *aApItem.iIspIPAddr );
+
+    ispt->WriteTextL( TPtrC(ISP_IP_NETMASK), *aApItem.iIspIPNetMask );
+
+    ispt->WriteTextL( TPtrC(ISP_IP_GATEWAY), *aApItem.iIspGateway );
+
+    ispt->WriteBoolL( TPtrC(ISP_IP_DNS_ADDR_FROM_SERVER),
+                     aApItem.iGetDNSIPFromServer );
+
+    ispt->WriteTextL( TPtrC(ISP_IP_NAME_SERVER1), *aApItem.iPrimaryDNS );
+
+    ispt->WriteTextL( TPtrC(ISP_IP_NAME_SERVER2), *aApItem.iSecondaryDNS );
+
+    ispt->WriteBoolL( TPtrC(ISP_ENABLE_IP_HEADER_COMP),
+                     aApItem.iEnablePPPCompression );
+
+    ispt->WriteBoolL( TPtrC(ISP_ENABLE_LCP_EXTENSIONS),
+                     aApItem.iIspEnableLCPExtensions );
+
+    ispt->WriteBoolL( TPtrC(ISP_DISABLE_PLAIN_TEXT_AUTH),
+                     aApItem.iIsPasswordAuthenticationSecure );
+
+    ispt->WriteBoolL( TPtrC(ISP_ENABLE_SW_COMP),
+                     aApItem.iIspEnableSwCompression );
+
+    ispt->WriteUintL( TPtrC(ISP_BEARER_NAME), aApItem.iIspBearerName );
+
+    ispt->WriteUintL( TPtrC(ISP_BEARER_SPEED), aApItem.iExt->iBearerSpeed );
+    
+    ispt->WriteUintL( TPtrC(ISP_BEARER_PROTOCOL), 
+                      aApItem.iExt->iBearerProtocol );
+
+    ispt->WriteUintL( TPtrC(ISP_BEARER_CE), aApItem.iIspBearerCE );
+
+    ispt->WriteUintL( TPtrC(ISP_BEARER_SERVICE), aApItem.iApIapBearerService );
+
+
+
+    ispt->WriteTextL( TPtrC(ISP_INIT_STRING), *aApItem.iIspInitString );
+
+    ispt->WriteUintL( TPtrC(ISP_BEARER_TYPE), aApItem.iIspBearerType );
+
+    ispt->WriteUintL( TPtrC(ISP_CHANNEL_CODING),
+                      aApItem.iIspChannelCoding );
+
+    ispt->WriteUintL( TPtrC(ISP_AIUR), aApItem.iIspAIUR );
+
+    ispt->WriteUintL( TPtrC(ISP_REQUESTED_TIME_SLOTS),
+                     aApItem.iIspRequestedTimeSlots );
+
+    ispt->WriteUintL( TPtrC(ISP_MAXIMUM_TIME_SLOTS),
+                     aApItem.iIspMaximumTimeSlots );
+
+    if ( iExt->iIsIpv6Supported )
+        {
+        WriteServiceIp6L( *ispt, aApItem );
+        }
+
+    // No DHCP for CSD/HSCSD, so set it empty
+    ispt->WriteTextL( TPtrC(SERVICE_CONFIG_DAEMON_MANAGER_NAME), KEmpty );
+    ispt->WriteTextL( TPtrC(SERVICE_CONFIG_DAEMON_NAME), KEmpty );
+    
+    // now put changes
+    User::LeaveIfError( ispt->PutRecordChanges( EFalse, EFalse ) );
+
+    CleanupStack::PopAndDestroy( ispt );  // ispt
+
+    CLOG( ( EHandler, 0, _L( "<- CApDataHandler::WriteCsdDataL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApDataHandler::ReadWlanL
+// ---------------------------------------------------------
+//
+void CApDataHandler::ReadWlanL( CCommsDbTableView& lant,
+                                CApAccessPointItem& aApItem )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::ReadWlanL" ) ) );
+
+    HBufC* buf = ApCommons::ReadText16ValueLC( &lant, TPtrC(NU_WLAN_SSID) );
+    aApItem.WriteTextL( EApWlanNetworkName, *buf );
+    CleanupStack::PopAndDestroy( buf );
+    
+    TUint32 tempint( 0 );
+
+    ApCommons::ReadUintL( &lant, TPtrC(COMMDB_ID), tempint );
+    aApItem.WriteUint( EApWlanSettingsId, tempint );
+
+    ApCommons::ReadUintL( &lant, TPtrC(WLAN_CONNECTION_MODE), tempint );
+    aApItem.WriteUint( EApWlanNetworkMode, tempint );
+
+    ApCommons::ReadUintL( &lant, TPtrC(WLAN_SECURITY_MODE), tempint );
+    aApItem.WriteUint( EApWlanSecurityMode, tempint );
+
+    TBool b;
+    ApCommons::ReadBoolL( &lant, TPtrC(WLAN_SCAN_SSID), b );
+    aApItem.WriteBool( EApWlanScanSSID, b );
+
+    ApCommons::ReadUintL( &lant, TPtrC(NU_WLAN_CHANNEL_ID), tempint );
+    aApItem.WriteUint( EApWlanChannelId, tempint );
+
+    CLOG( ( EHandler, 0, _L( "<- CApDataHandler::ReadWlanL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApDataHandler::WriteWlanL
+// ---------------------------------------------------------
+//
+void CApDataHandler::WriteWlanL( CCommsDbTableView& aTable,
+                                 CApAccessPointItem& aApItem )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::WriteWlanL" ) ) );
+
+    aTable.WriteTextL( TPtrC(COMMDB_NAME), *aApItem.iIspName );
+    aTable.WriteUintL( TPtrC(WLAN_SERVICE_ID), aApItem.iIapServiceId );
+    aTable.WriteTextL( TPtrC(NU_WLAN_SSID), 
+                       *aApItem.iExt->iWlanData->iWlanNetworkName );
+    aTable.WriteUintL( TPtrC(WLAN_CONNECTION_MODE), 
+                      aApItem.iExt->iWlanData->iWlanNetworkMode );
+
+    aTable.WriteUintL( TPtrC(WLAN_SECURITY_MODE), 
+                      aApItem.iExt->iWlanData->iWlanSecurityMode );
+
+    aTable.WriteBoolL( TPtrC(WLAN_SCAN_SSID),
+                     aApItem.iExt->iWlanData->iScanSSID );
+                     
+    aTable.WriteUintL( TPtrC(NU_WLAN_CHANNEL_ID), 
+                      aApItem.iExt->iWlanData->iChannelId );
+    
+    CLOG( ( EHandler, 0, _L( "<- CApDataHandler::WriteWlanL" ) ) );
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CApDataHandler::CreateLanBearerIfNeededL
+// ---------------------------------------------------------
+//
+TUint32 CApDataHandler::CreateLanBearerIfNeededL()
+    {
+    CLOG( ( EApItem, 0, 
+            _L( "-> CApDataHandler::CreateLanBearerIfNeededL" ) ) );
+    
+    TUint32 retval( 0 );
+
+    CCommsDbTableView* t = NULL;
+
+    t = iDb->OpenViewMatchingTextLC( TPtrC(LAN_BEARER), 
+                                     TPtrC(LAN_BEARER_AGENT), 
+                                     KWlanBearerAgent );
+    if ( t->GotoFirstRecord() == KErrNotFound )
+        { // no such yet, create one
+        TInt err = t->InsertRecord( retval );
+        if ( err )
+            {
+            User::LeaveIfError( err );
+            }
+        t->WriteTextL( TPtrC(COMMDB_NAME), KWlanBearerName );
+        t->WriteTextL( TPtrC(LAN_BEARER_AGENT), KWlanBearerAgent );
+        t->WriteTextL( TPtrC(LAN_BEARER_NIF_NAME), KWlanBearerNif );
+
+        t->WriteTextL( TPtrC(LAN_BEARER_LDD_NAME), KWlanLDDName );
+        t->WriteTextL( TPtrC(LAN_BEARER_PDD_NAME), KWlanPDDName );
+
+
+
+        t->WriteUintL( TPtrC(LAST_SOCKET_ACTIVITY_TIMEOUT), 
+                       (TUint32)KWlanLastSocketActivityTimeout ); 
+        t->WriteUintL( TPtrC(LAST_SESSION_CLOSED_TIMEOUT), 
+                       KWlanLastSessionClosedTimeout ); 
+        t->WriteUintL( TPtrC(LAST_SOCKET_CLOSED_TIMEOUT), 
+                       (TUint32)KWlanLastSocketClosedTimeout ); 
+
+        User::LeaveIfError( t->PutRecordChanges( EFalse, EFalse ) );
+
+        }
+    else
+        { // there is one, use it
+        t->ReadUintL( TPtrC(COMMDB_ID), retval );
+        }
+
+    CleanupStack::PopAndDestroy( t );   // t
+    
+    CLOG( ( EApItem, 0, 
+            _L( "<- CApDataHandler::CreateLanBearerIfNeededL" ) ) );
+
+    return retval;
+    }
+
+
+
+
+
+
+// ---------------------------------------------------------
+// CApDataHandler::ReadModemBearerNameL
+// ---------------------------------------------------------
+//
+void CApDataHandler::ReadModemBearerNameL( CApAccessPointItem& aApItem )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CApDataHandler::ReadModemBearerNameL" ) ) );
+
+    // agreed that the modem bearer record having the name 
+    // 'CSD Modem' is used for (HS)CSD Access Points and
+    // 'GPRS Modem' is used for GPRS/WCDMA Access Points
+    // 'CDMA Modem' is used for CDMA Access Points
+    CCommsDbTableView* view = NULL;
+//    TApBearerType bearer = aApItem.BearerTypeL();
+
+    view = iDb->OpenViewMatchingUintLC( *aApItem.iExt->iIapBearerType, 
+                                       TPtrC(COMMDB_ID), 
+                                       aApItem.iExt->iIapBearerID );
+//                                       0 );
+    HBufC* buf = NULL;
+    buf = ApCommons::ReadText16ValueLC( view, TPtrC(COMMDB_NAME) );
+    aApItem.WriteTextL( EApLanBearerName, *buf );
+    CleanupStack::PopAndDestroy( buf );
+
+    CleanupStack::PopAndDestroy( view );
+
+
+    CLOG( ( EHandler, 1, _L( "<- CApDataHandler::ReadModemBearerNameL" ) ) );
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apeng/src/APNetworks.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,270 @@
+/*
+* Copyright (c) 2002 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 the CApNetworks class.
+*
+*/
+
+
+// INCLUDE FILES
+#include <cdbcols.h>
+#include <commdb.h>
+#include <eikdef.h>
+#include <d32dbms.h>
+#include <ApNetworkItem.h>
+#include <ApNetworkItemList.h>
+#include <ApEngineConsts.h>
+
+#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include <ProtectDb.h>
+#else
+#include <comms-infras/commdb/protection/protectdb.h>
+#endif
+
+#include "ApNetworks.h"
+#include "ApEngineLogger.h"
+#include "ApEngineCommons.h"
+
+
+
+
+// LOCAL CONSTANTS AND MACROS
+
+// LOCAL FUNCTION PROTOTYPES
+
+// ================= MEMBER FUNCTIONS =======================
+// Two-phased constructor.
+// ---------------------------------------------------------
+// CApNetworks::NewLC
+// ---------------------------------------------------------
+//
+EXPORT_C CApNetworks* CApNetworks::NewLC( CCommsDatabase& aDb )
+    {
+    CLOG( ( ENetworks, 0, _L( "-> CApNetworks::NewLC" ) ) );
+
+    CApNetworks* db = new( ELeave ) CApNetworks;
+    CleanupStack::PushL( db );
+    db->ConstructL( aDb );
+
+    CLOG( ( ENetworks, 1, _L( "<- CApNetworks::NewLC" ) ) );
+    return db;
+    }
+
+
+// Destructor
+// ---------------------------------------------------------
+// CApNetworks::~CApNetworks
+// ---------------------------------------------------------
+//
+EXPORT_C CApNetworks::~CApNetworks()
+    {
+    CLOG( ( ENetworks, 0, _L( "-> CApNetworks::~CApNetworks" ) ) );
+
+    if ( iApList )
+        {
+        iApList->ResetAndDestroy();
+        delete iApList;
+        }
+
+    CLOG( ( ENetworks, 1, _L( "<- CApNetworks::~CApNetworks" ) ) );
+    }
+
+
+// C++ default constructor can NOT contain any code that
+// might leave.
+//
+// ---------------------------------------------------------
+// CApNetworks::CApNetworks
+// ---------------------------------------------------------
+//
+EXPORT_C CApNetworks::CApNetworks()
+:iCount( 0 )
+    {
+    }
+
+
+// Symbian OS default constructor can leave.
+// ---------------------------------------------------------
+// CApNetworks::ConstructL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApNetworks::ConstructL( CCommsDatabase& aDb )
+
+    {
+    CLOG( ( ENetworks, 0, _L( "-> CApNetworks::ConstructL" ) ) );
+
+    iApList = new( ELeave )CApNetworkItemList();
+    iDb = &aDb;
+    DoUpdateL();
+
+    CLOG( ( ENetworks, 1, _L( "<- CApNetworks::ConstructL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApNetworks::Count
+// ---------------------------------------------------------
+//
+EXPORT_C TUint32 CApNetworks::Count() const
+    {
+    CLOG( ( ENetworks, 0, _L( "<-> CApNetworks::Count" ) ) );
+
+    return iApList->Count( );
+    }
+
+
+// ---------------------------------------------------------
+// CApNetworks::Name
+// ---------------------------------------------------------
+//
+EXPORT_C const TDesC& CApNetworks::NameL( TUint32 aUid ) const
+    {
+    CLOG( ( ENetworks, 0, _L( "-> CApNetworks::NameL" ) ) );
+
+    CApNetworkItem* item = 
+        CONST_CAST( CApNetworkItem*, iApList->ItemForUid( aUid ) );
+    if ( item == NULL )
+        {
+        User::Leave( KErrNotFound );
+        }
+
+    CLOG( ( ENetworks, 1, _L( "<- CApNetworks::NameL" ) ) );
+    return (item->Name() );
+    }
+
+
+
+
+
+
+// ---------------------------------------------------------
+// CApNetworks::AllListItemDataL
+// ---------------------------------------------------------
+//
+EXPORT_C TInt CApNetworks::AllListItemDataL( CApNetworkItemList& aList )
+    {
+    CLOG( ( ENetworks, 0, _L( "-> CApNetworks::AllListItemDataL" ) ) );
+
+    aList.ResetAndDestroy();
+
+    CApNetworkItem* item=NULL;
+
+    TInt i;
+    TInt count = iApList->Count();
+    for ( i=0; i<count; i++ )
+        {
+        item = CApNetworkItem::NewLC( ( *iApList )[i] );
+        aList.AppendL( item );
+        CleanupStack::Pop( item ); // item owned by aList !
+        }
+    CLOG( ( ENetworks, 1, _L( "<- CApNetworks::AllListItemDataL" ) ) );
+
+    return aList.Count();
+    }
+
+
+
+
+// ================= OTHER EXPORTED FUNCTIONS ==============
+
+// ================== OTHER MEMBER FUNCTIONS ===============
+
+
+
+// ---------------------------------------------------------
+// CApNetworks::DoUpdate
+// ---------------------------------------------------------
+//
+TInt CApNetworks::DoUpdateL()
+    {
+    CLOG( ( ENetworks, 0, _L( "-> CApNetworks::DoUpdateL" ) ) );
+
+    TInt err( KErrNone );
+
+    TBool OwnTransaction = ApCommons::StartPushedTransactionLC( *iDb );
+
+    CCommsDbTableView* networkt =  iDb->OpenTableLC( TPtrC(NETWORK) );
+
+    err = networkt->GotoFirstRecord();
+
+    if ( ( err == KErrNone ) || ( err == KErrNotFound ) )
+        { // even if it is empty, we must clear the list.
+        // otherwise, Leave
+        // fill up list. First empty it
+        iApList->ResetAndDestroy();
+        iCount = 0;
+        TUint32 temp( 0 );
+        TInt length( 0 );
+
+        CApNetworkItem* item = NULL;
+        CApNetworkItemList* tmpnetlist = new( ELeave )CApNetworkItemList();
+        HBufC* tmp = NULL;
+        CleanupStack::PushL( tmpnetlist );
+        
+        if ( err == KErrNone )
+            { // now get the names and UIDs
+            TBool goon( ETrue );
+            do
+                {
+                err = ApCommons::ReadUintL( networkt, TPtrC(COMMDB_ID), temp );
+
+                networkt->ReadColumnLengthL( TPtrC(COMMDB_NAME), length );
+                tmp = HBufC::NewLC( length );
+                TPtr tmpptr( tmp->Des() );
+                networkt->ReadTextL( TPtrC(COMMDB_NAME), tmpptr );
+                item = CApNetworkItem::NewLC( );
+                item->SetUid( temp );
+                item->SetNameL( tmpptr );
+                tmpnetlist->AppendL( item );
+                CleanupStack::Pop( item ); // item owned by list !
+
+                err = networkt->GotoNextRecord();
+                if ( err == KErrNotFound )
+                    {
+                    goon = EFalse;
+                    }
+                else
+                    {
+                    User::LeaveIfError( err );
+                    }
+                CleanupStack::PopAndDestroy( tmp );
+                }
+                while ( goon );
+            }
+        // and now move items to real array
+        CleanupStack::Pop( tmpnetlist );
+        delete iApList;
+        iApList = tmpnetlist;
+        }
+    else
+        {
+        User::Leave( err );
+        }
+
+    CleanupStack::PopAndDestroy( networkt );
+    
+    if ( OwnTransaction )
+        {
+        ApCommons::CommitTransaction( *iDb );
+        CleanupStack::Pop(); // RollbackTransactionOnLeave
+        }
+    
+
+    CLOG( ( ENetworks, 1, _L( "<- CApNetworks::DoUpdateL" ) ) );
+    return err;
+    }
+
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apeng/src/APSelect.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,2516 @@
+/*
+* Copyright (c) 2002 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 the CApSelect class.
+*
+*/
+
+
+// INCLUDE FILES
+#include <cdbcols.h>
+#include <commdb.h>
+#include <eikdef.h>
+#include <d32dbms.h>
+#include <featmgr.h>
+
+#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include <ProtectDb.h>
+#else
+#include <comms-infras/commdb/protection/protectdb.h>
+#endif
+
+#include <etelpckt.h>
+#ifdef __TEST_USE_SHARED_DATA
+    #include <sharedDataValues.h>
+#endif // __TEST_USE_SHARED_DATA
+
+#include "ApListItem.h"
+#include "ApListItemList.h"
+#include "ApSelect.h"
+#include "ApUtils.h"
+#include "ApEngineCommons.h"
+#include <ApEngineConsts.h>
+#include "ApEngineLogger.h"
+#include "ApListItemKey.h"
+
+
+
+
+// CONSTANTS
+const TInt KCursorNullPos = 0;
+const TInt KItemCountNull = 0;
+
+#ifdef __TEST_USE_SHARED_DATA
+    // General Settings UID, Hardcoded
+    const TUid KGeneralSettingsUid={0X100058EC};
+#endif // __TEST_USE_SHARED_DATA
+
+
+const TInt KDIALOUT     = 0;
+const TInt KGPRSIN      = 1;
+const TInt KGPRSOUT     = 2;
+const TInt KCDMA_ISP    = 3;
+const TInt KVPN         = 4;
+
+
+const TInt  KUID        = 0;
+const TInt  KISPTYPE    = 1;
+const TInt  KBEARERTYPE = 2;
+
+
+
+// LOCAL CONSTANTS AND MACROS
+
+
+// LOCAL FUNCTION PROTOTYPES
+
+// ================= MEMBER FUNCTIONS =======================
+// Two-phased constructor.
+// ---------------------------------------------------------
+// CApSelect::NewLC
+// ---------------------------------------------------------
+//
+EXPORT_C CApSelect* CApSelect::NewLC( CCommsDatabase& aDb,
+                                     TInt aIspFilter,
+                                     TInt aBearerFilter,
+                                     TInt aSortType )
+    {
+    CLOG( ( ESelect, 0, _L( "-> CApSelect::NewLC" ) ) );
+
+    CApSelect* db = CApSelect::NewLC( aDb, aIspFilter, 
+                                      aBearerFilter, aSortType, EIPv4 );
+
+    CLOG( ( ESelect, 1, _L( "<- CApSelect::NewLC" ) ) );
+    return db;
+    }
+
+
+// Destructor
+// ---------------------------------------------------------
+// CApSelect::~CApSelect
+// ---------------------------------------------------------
+//
+EXPORT_C CApSelect::~CApSelect()
+    {
+    CLOG( ( ESelect, 0, _L( "-> CApSelect::~CApSelect" ) ) );
+
+    if ( iExt )
+        {
+        if ( iExt->iIsFeatureManagerInitialised )
+            {
+            FeatureManager::UnInitializeLib();
+            }
+        }
+
+    if ( iApList )
+        {
+        iApList->ResetAndDestroy();
+        delete iApList;
+        }
+    
+    delete iExt;
+
+    CLOG( ( ESelect, 1, _L( "<- CApSelect::~CApSelect" ) ) );
+    }
+
+
+// C++ default constructor can NOT contain any code that
+// might leave.
+//
+// ---------------------------------------------------------
+// CApSelect::CApSelect
+// ---------------------------------------------------------
+//
+EXPORT_C CApSelect::CApSelect()
+:iCursor( KCursorNullPos ),
+iCount( KItemCountNull )
+    {
+    }
+
+
+// Symbian OS default constructor can leave.
+// ---------------------------------------------------------
+// CApSelect::ConstructL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApSelect::ConstructL( CCommsDatabase& aDb,
+                                 TInt aIspFilter,
+                                 TInt aBearerFilter,
+                                 TInt aSortType )
+
+    {
+    ConstructL( aDb, aIspFilter, aBearerFilter, 
+                aSortType, EIPv4, EVpnFilterBoth );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSelect::SetFilters
+// ---------------------------------------------------------
+//
+EXPORT_C void CApSelect::SetFiltersL( TInt aIspFilter,
+                                    TInt aBearerFilter,
+                                    TInt aSortType )
+    {
+    SetFiltersL( aIspFilter, aBearerFilter, aSortType, 
+                 iExt->iReqIpvType, iExt->iVpnFilterType );
+                 
+    }
+
+
+// ---------------------------------------------------------
+// CApSelect::IspTypeFilter
+// ---------------------------------------------------------
+//
+EXPORT_C TInt CApSelect::IspTypeFilter()
+    {
+    CLOG( ( ESelect, 0, _L( "<-> CApSelect::IspTypeFilter" ) ) );
+
+    return iIsp;
+    }
+
+
+// ---------------------------------------------------------
+// CApSelect::BearerFilter
+// ---------------------------------------------------------
+//
+EXPORT_C TInt CApSelect::BearerFilter()
+    {
+    CLOG( ( ESelect, 0, _L( "<-> CApSelect::BearerFilter" ) ) );
+
+    return iBearer;
+    }
+
+
+// ---------------------------------------------------------
+// CApSelect::SortOrder
+// ---------------------------------------------------------
+//
+EXPORT_C TInt CApSelect::SortOrder()
+    {
+    CLOG( ( ESelect, 0, _L( "<-> CApSelect::SortOrder" ) ) );
+
+    return iSort;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSelect::MoveToFirst
+// ---------------------------------------------------------
+//
+EXPORT_C TBool CApSelect::MoveToFirst()
+    {
+    CLOG( ( ESelect, 0, _L( "<-> CApSelect::MoveToFirst" ) ) );
+
+    iCursor = 0;
+    return ( iExt->iMaxIndex >= 0 );
+    }
+
+
+// ---------------------------------------------------------
+// CApSelect::MoveNext
+// ---------------------------------------------------------
+//
+EXPORT_C TBool CApSelect::MoveNext()
+    {
+    CLOG( ( ESelect, 0, _L( "<-> CApSelect::MoveNext" ) ) );
+
+    if ( iCursor < iExt->iMaxIndex )
+        {
+        iCursor++;
+        return ETrue;
+        }
+    return EFalse;
+    }
+
+
+// ---------------------------------------------------------
+// CApSelect::MoveLast
+// ---------------------------------------------------------
+//
+EXPORT_C TBool CApSelect::MoveLast()
+    {
+    CLOG( ( ESelect, 0, _L( "<-> CApSelect::MoveLast" ) ) );
+
+    iCursor = iExt->iMaxIndex;
+    return ( iCursor >= 0 );
+    }
+
+
+// ---------------------------------------------------------
+// CApSelect::MovePrev
+// ---------------------------------------------------------
+//
+EXPORT_C TBool CApSelect::MovePrev()
+    {
+    CLOG( ( ESelect, 0, _L( "<-> CApSelect::MovePrev" ) ) );
+
+    if ( iCursor>0 )
+        {
+        iCursor--;
+        return ETrue;
+        }
+    return EFalse;
+    }
+
+
+// ---------------------------------------------------------
+// CApSelect::Count
+// ---------------------------------------------------------
+//
+EXPORT_C TUint32 CApSelect::Count()
+    {
+    CLOG( ( ESelect, 0, _L( "<-> CApSelect::Count" ) ) );
+
+    return iApList->Count( );
+    }
+
+
+// ---------------------------------------------------------
+// CApSelect::Name
+// ---------------------------------------------------------
+//
+EXPORT_C const TDesC& CApSelect::Name()
+    {
+    CLOG( ( ESelect, 0, _L( "<-> CApSelect::Name" ) ) );
+
+    return *iApList->At( iCursor )->iName;
+    }
+
+
+// ---------------------------------------------------------
+// CApSelect::Uid
+// ---------------------------------------------------------
+//
+EXPORT_C TUint32 CApSelect::Uid()
+    {
+    CLOG( ( ESelect, 0, _L( "<-> CApSelect::Uid" ) ) );
+
+    return iApList->At( iCursor )->iUid;
+    }
+
+
+// ---------------------------------------------------------
+// CApSelect::Type
+// ---------------------------------------------------------
+//
+EXPORT_C TCommsDbIspType CApSelect::Type()
+    {
+    CLOG( ( ESelect, 0, _L( "<-> CApSelect::Type" ) ) );
+
+    return iApList->At( iCursor )->iIspType;
+    }
+
+
+// ---------------------------------------------------------
+// CApSelect::BearerType
+// ---------------------------------------------------------
+//
+EXPORT_C TApBearerType CApSelect::BearerType()
+    {
+    CLOG( ( ESelect, 0, _L( "<-> CApSelect::BearerType" ) ) );
+
+    return iApList->At( iCursor )->iBearerType;
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CApSelect::AllListItemDataL
+// ---------------------------------------------------------
+//
+EXPORT_C TInt CApSelect::AllListItemDataL( CApListItemList& aList )
+    {
+    CLOG( ( ESelect, 0, _L( "-> CApSelect::AllListItemDataL" ) ) );
+
+    aList.ResetAndDestroy();
+
+    CApListItem* item=NULL;
+
+    TInt i;
+    TInt count = iApList->Count();
+    for ( i=0; i<count; i++ )
+        {
+        item = CApListItem::NewLC( ( *iApList )[i] );
+        aList.AppendL( item );
+        CleanupStack::Pop( item ); // item owned by aList !
+        }
+    CLOG( ( ESelect, 1, _L( "<- CApSelect::AllListItemDataL" ) ) );
+
+    return aList.Count();
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSelect::IsReadOnly
+// ---------------------------------------------------------
+//
+EXPORT_C TBool CApSelect::IsReadOnly() const
+    {
+    CLOG( ( ESelect, 0, _L( "<-> CApSelect::IsReadOnly" ) ) );
+
+    return iApList->At( iCursor )->iExt->iReadOnly;
+    }
+
+
+
+// ================= OTHER EXPORTED FUNCTIONS ==============
+
+// ================== OTHER MEMBER FUNCTIONS ===============
+
+
+
+// ---------------------------------------------------------
+// CApSelect::DoUpdate
+// ---------------------------------------------------------
+//
+TInt CApSelect::DoUpdateL()
+    {
+    CLOG( ( ESelect, 0, _L( "-> CApSelect::DoUpdateL" ) ) );
+
+    // filtering criteria:
+    // Bearer type
+    // Isp type
+    // HasMandatory
+    // + ordering (name or UID...)
+    // first filter WAP_ACCESS_POINT table and order it
+    TBool OwnTransaction = ApCommons::StartPushedTransactionLC( *iDb );
+    if ( !OwnTransaction )
+        {
+        __ASSERT_DEBUG( EFalse, ApCommons::Panic( ENotSupported ) );
+        User::Leave( KErrNotSupported );
+        }
+
+    CCommsDbTableView* wapt = NULL;
+    CCommsDbTableView* ipbearert = NULL;
+
+    CCommsDbTableView* iapt = NULL;
+                                     // csdOut, GprsIn, gprsOut, cdma,  VPN
+    CCommsDbTableView* isptables[5] = { NULL,   NULL,   NULL,   NULL,   NULL};
+
+
+    wapt = GetFilteredSortedWapTableViewLC();
+    TInt err = wapt->GotoFirstRecord(); // OK.
+    if ( ( err == KErrNone ) || ( err == KErrNotFound ) )
+        { // even if it is empty, we must clear the list.
+        // otherwise, Leave
+        // fill up list. First empty it
+        iApList->ResetAndDestroy();
+        iCount = 0;
+        if ( err == KErrNone )
+            { // have some, we can go on...
+            // First get ip_bearer table, then iap, then isp & gprs, if needed
+            if ( ( iBearer & EApBearerTypeCSD ) ||
+                 ( iBearer & EApBearerTypeHSCSD ) ||
+                 ( iBearer & EApBearerTypeGPRS ) ||
+                 ( iExt->iCdma && ( iBearer & EApBearerTypeCDMA ) ) )
+                {
+                ipbearert = GetFilteredSortedIpBearerTableViewLC();
+                if ( ipbearert )
+                    {
+                    err = ipbearert->GotoFirstRecord();
+                    if ( err == KErrNone )
+                        {
+                        if ( ( iBearer & EApBearerTypeCSD ) ||
+                             ( iBearer & EApBearerTypeHSCSD ) )
+                            {
+                            isptables[KDIALOUT] =
+                                GetFilteredSortedIspOutTableViewLC();
+                            }
+                        if ( ( iBearer & EApBearerTypeGPRS ) )
+                            {
+                            isptables[KGPRSIN] =
+                                GetFilteredSortedGprsTableViewLC( ETrue );
+                            isptables[KGPRSOUT] =
+                                GetFilteredSortedGprsTableViewLC( EFalse );
+                            }
+                        }
+                    else
+                        {
+                        if ( err != KErrNotFound )
+                            {
+                            User::LeaveIfError( err );
+                            }
+                        }
+                    }
+                }
+            // get wapapids
+               // get smsapids, if defined
+            // get ipapids with iap ids
+            // get only those iap ids from filtered database
+            CArrayFixFlat<TUint32>* wapapid =
+                    new ( ELeave ) CArrayFixFlat<TUint32>( 10 );
+            CleanupStack::PushL( wapapid );
+            GetUintValuesL( wapt, TPtrC(COMMDB_ID), *wapapid );
+
+            // read up access point names, too, just to be as fast as we can...
+            CArrayPtrFlat<HBufC>* wapapname =
+                    new ( ELeave ) CArrayPtrFlat<HBufC>( 10 );
+            CleanupStack::PushL( wapapname );
+            GetTextValuesL( wapt, TPtrC(COMMDB_NAME), *wapapname );
+
+
+            // read up start page, too, just to be as fast as we can...
+            CArrayPtrFlat<HBufC>* wapstartpage =
+                    new ( ELeave ) CArrayPtrFlat<HBufC>( 10 );
+            CleanupStack::PushL( wapstartpage );
+            // as it is LONG text...
+            GetLongTextValuesL( wapt, TPtrC(WAP_START_PAGE), *wapstartpage );
+
+            //read up Read-only flags
+            CArrayFixFlat<TUint32>* protflags =
+                    new ( ELeave ) CArrayFixFlat<TUint32>( 10 );
+            CleanupStack::PushL( protflags );
+            GetProtValuesL( wapt, *protflags );
+
+
+            CArrayFixFlat<TUint32>* ipapid =
+                    new ( ELeave ) CArrayFixFlat<TUint32>( 10 );
+            CleanupStack::PushL( ipapid );
+            GetUintValuesL( ipbearert, TPtrC(WAP_ACCESS_POINT_ID), *ipapid );
+
+            CArrayFixFlat<TUint32>* ipiapid =
+                    new ( ELeave ) CArrayFixFlat<TUint32>( 10 );
+            CleanupStack::PushL( ipiapid );
+            GetUintValuesL( ipbearert, TPtrC(WAP_IAP), *ipiapid );
+
+
+
+
+            // What comes next:::::
+            // for each table:
+            // filter separately for different bearers ->
+            // we know the bearer type...
+            // filter separately for different ISP types ->
+            // we know the ISP type...
+            // now all we have to do is to 'simply' check filtered IAP with
+            // the separate arrays, leave only those that present in
+            // both bearer & isp array
+            // fill up an array of id & an array of bearer type &
+            // an array of isp type
+            // after it, narrow down wap with wapbearer,
+            // create items in order,
+            // check items against remained iap array
+            // fill up values in list.
+            // bearer arrays : 0: csd, 1:hscsd, 2: gprs, 3: cdma
+
+            TInt i( 0 );
+
+            // an array Isp[CSDOut/GPRSIn/GPRSOut/CDMA/VPN]
+            //             [COMMDB_ID, ISP_TYPE, Bearer_type]
+            CArrayFixFlat<TUint32[3]>* ispArray[5];
+            for (i=0; i<5; i++)
+                {
+                ispArray[i] = new ( ELeave ) CArrayFixFlat<TUint32[3]>( 10 );
+                CleanupStack::PushL( ispArray[i] );
+                }
+
+            if ( isptables[KDIALOUT] )
+                {
+                GetIspValuesL( isptables[KDIALOUT], ispArray[KDIALOUT],
+                               TPtrC(ISP_TYPE) );
+                }
+            if ( isptables[KGPRSIN] )
+                {
+                GetIspValuesL( isptables[KGPRSIN], ispArray[KGPRSIN],
+                               TPtrC(GPRS_AP_TYPE) );
+                }
+            if ( isptables[KGPRSOUT] )
+                {
+                GetIspValuesL( isptables[KGPRSOUT], ispArray[KGPRSOUT],
+                               TPtrC(GPRS_AP_TYPE) );
+                }
+            if ( isptables[KCDMA_ISP] )  // NULL if iExt->iCdma==EFalse.
+                {
+                GetIspValuesL( isptables[KCDMA_ISP], ispArray[KCDMA_ISP], 
+                               TPtrC(CDMA_AP_TYPE) );
+                }
+
+
+            // iap arrays, 5 table, needs UID & linked ID for both
+            CArrayFixFlat<TUint32>* iapArrays[5][2];
+            for (i=0; i<5; i++)
+                {
+                iapArrays[i][0] = new ( ELeave ) CArrayFixFlat<TUint32>( 10 );
+                CleanupStack::PushL( iapArrays[i][0] );
+
+                iapArrays[i][1] = new ( ELeave ) CArrayFixFlat<TUint32>( 10 );
+                CleanupStack::PushL( iapArrays[i][1] );
+                }
+            // get iap table data...
+            // needs IAP UID & Iap_service
+            if ( ( iBearer & EApBearerTypeCSD ) ||
+                 ( iBearer & EApBearerTypeHSCSD ) )
+                {
+                iapt = OpenViewMatchingTextL( TPtrC(IAP),
+                                              TPtrC(IAP_SERVICE_TYPE),
+                                              TPtrC(DIAL_OUT_ISP) );
+                CleanupStack::PushL( iapt );
+                GetUintValuesL( iapt, TPtrC(COMMDB_ID),
+                                *iapArrays[KDIALOUT][0] );
+                GetUintValuesL( iapt, TPtrC(IAP_SERVICE),
+                                *iapArrays[KDIALOUT][1] );
+                CleanupStack::PopAndDestroy( iapt ); // iapt;
+                iapt = NULL;
+                }
+
+
+            if ( iBearer & EApBearerTypeGPRS )
+                {
+                iapt = OpenViewMatchingTextL( TPtrC(IAP),
+                                              TPtrC(IAP_SERVICE_TYPE),
+                                              TPtrC(INCOMING_WCDMA) );
+                CleanupStack::PushL( iapt );
+                GetUintValuesL( iapt, TPtrC(COMMDB_ID),
+                                *iapArrays[KGPRSIN][0] );
+                GetUintValuesL( iapt, TPtrC(IAP_SERVICE),
+                                *iapArrays[KGPRSIN][1] );
+                CleanupStack::PopAndDestroy( iapt ); // iapt;
+                iapt = NULL;
+
+                iapt = OpenViewMatchingTextL( TPtrC(IAP),
+                                              TPtrC(IAP_SERVICE_TYPE),
+                                              TPtrC(OUTGOING_WCDMA) );
+                CleanupStack::PushL( iapt );
+                GetUintValuesL( iapt, TPtrC(COMMDB_ID),
+                                *iapArrays[KGPRSOUT][0] );
+                GetUintValuesL( iapt, TPtrC(IAP_SERVICE),
+                                *iapArrays[KGPRSOUT][1] );
+                CleanupStack::PopAndDestroy( iapt ); // iapt;
+                iapt = NULL;
+                }
+
+            if ( ( iExt->iVpnFilterType == EVpnFilterVpnOnly ) ||
+                ( iExt->iVpnFilterType == EVpnFilterBoth ) )
+                {
+                iapt = OpenViewMatchingTextL( TPtrC(IAP),
+                                              TPtrC(IAP_SERVICE_TYPE),
+                                              TPtrC(VPN_SERVICE) );
+                CleanupStack::PushL( iapt );
+                GetUintValuesL( iapt, TPtrC(COMMDB_ID),
+                                *iapArrays[KVPN][0] );
+                GetUintValuesL( iapt, TPtrC(IAP_SERVICE),
+                                *iapArrays[KVPN][1] );
+                CleanupStack::PopAndDestroy( iapt ); // iapt;
+                iapt = NULL;
+                }
+
+
+
+            CArrayFixFlat<TVpnData>* vpnArray = NULL;
+
+            if ( ( iExt->iVpnFilterType == EVpnFilterVpnOnly ) ||
+                ( iExt->iVpnFilterType == EVpnFilterBoth ) )
+                { // get VPN related data, namely Home IAP and name
+                isptables[KVPN] = GetVpnTableViewLC();
+
+                if ( isptables[KVPN] )
+                    {
+
+                    vpnArray = new ( ELeave ) CArrayFixFlat<TVpnData>( 10 );
+                    CleanupStack::PushL( vpnArray );
+
+                    GetVpnValuesL( isptables[KVPN], vpnArray );
+                    }
+                }
+
+
+
+
+            // till this point, we have done what we can.
+            // now we narrow down arrays.
+            // start with iap vs isp arrays, leave what we can in iap array.
+
+            CApListItem* item = NULL;
+            CApListItemList* tmpApList = new( ELeave )CApListItemList();
+            CleanupStack::PushL( tmpApList );
+            TApBearerType bearer (EApBearerTypeAllBearers);
+
+            // iapArrays[5][2]:
+            // 5 table (DialOut, GprsIn, Out, Cdma, VPN),2 id's(Uid,ServiceId)
+            // iapArrays[0] : Dial In service
+            // ispinbearerArrays: 0: csd, 1:hscsd, 2: gprs. 3: cdma
+
+            // 'Merge' iap with isp, create temp. items with bearer types
+            // iap/DialIn/ServiceID : iapArrays[0][1]
+
+            // check all iap/DialIn/ServiceID if it is in isparray ->
+            // array Gives bearer type & isp type
+            TInt j, iappos;
+            // check all iap/DialOut/ServiceID if it is
+            // in ispoutbearerarray[0,1]
+            if ( iapArrays[KDIALOUT][1] )
+                {
+                for (j=0; j<iapArrays[KDIALOUT][1]->Count(); j++)
+                    {
+                    bearer = EApBearerTypeAllBearers;
+                    // check all iap/DialOut/ServiceID if it is in isparray
+                    // check if it is in ispArray[UID, ISP, Bearer]
+                    // & return pos.
+                    iappos = GetIapPos( ispArray[KDIALOUT],
+                                        iapArrays[KDIALOUT][1]->At( j ) );
+                    if ( iappos != KErrNotFound )
+                        { // DialOut, Isp, Bearer...
+                        // create temp. item WITH IAP ID, Bearer type
+                        if ( ispArray[KDIALOUT]->At( iappos )[KBEARERTYPE] ==
+                             EBearerTypeCSD )
+                            {
+                            bearer = EApBearerTypeCSD;
+                            }
+                        else
+                            { // HSCSD bearer
+                            bearer = EApBearerTypeHSCSD;
+                            }
+                        // create temp. item WITH IAP ID, Bearer type
+                        item = CApListItem::NewLC
+                            (
+                            (TCommsDbIspType)
+                                ispArray[KDIALOUT]->At( iappos )[KISPTYPE],
+                            iapArrays[KDIALOUT][0]->At( j ),
+                            KEmpty,
+                            bearer
+                            );
+                        tmpApList->AppendL( item );
+                        CleanupStack::Pop( item ); // item owned by list !
+                        }
+                    }
+                }
+
+
+
+            // check all iap/GprsIn/ServiceID if it is in ispinbearerarray[2]
+            if ( iapArrays[KGPRSIN][1] )
+                {
+                bearer = EApBearerTypeGPRS;
+                for (j=0; j<iapArrays[KGPRSIN][1]->Count(); j++)
+                    {
+                    iappos = GetIapPos( ispArray[KGPRSIN],
+                                        iapArrays[KGPRSIN][1]->At( j ) );
+                    if ( iappos != KErrNotFound )
+                        { // GprsIn, Isp, Bearer...
+                        // create temp. item WITH IAP ID, Bearer type
+                        item = CApListItem::NewLC
+                            (
+                            (TCommsDbIspType)
+                                ispArray[KGPRSIN]->At( iappos )[KISPTYPE],
+                            iapArrays[KGPRSIN][0]->At( j ),
+                            KEmpty,
+                            bearer
+                            );
+                        tmpApList->AppendL( item );
+                        CleanupStack::Pop( item ); // item owned by list !
+                        }
+                    }
+                }
+
+
+            // check all iap/GprsOut/ServiceID if it is in isparray
+            if ( iapArrays[KGPRSOUT][1] )
+                {
+                bearer = EApBearerTypeGPRS;
+                for (j=0; j<iapArrays[KGPRSOUT][1]->Count(); j++)
+                    {
+                    iappos = GetIapPos( ispArray[KGPRSOUT],
+                                        iapArrays[KGPRSOUT][1]->At( j ) );
+                    if ( iappos != KErrNotFound )
+                        { // GprsIn, Isp, Bearer...
+                        // create temp. item WITH IAP ID, Bearer type
+                        item = CApListItem::NewLC
+                            (
+                            (TCommsDbIspType)
+                                ispArray[KGPRSOUT]->At( iappos )[KISPTYPE],
+                            iapArrays[KGPRSOUT][0]->At( j ),
+                            KEmpty,
+                            bearer
+                            );
+                        tmpApList->AppendL( item );
+                        CleanupStack::Pop( item ); // item owned by list !
+                        }
+                    }
+                }
+
+
+            // check all iap/cdma/ServiceID if it is in ispinbearerarray[2]
+            if ( iapArrays[KCDMA_ISP][1] )  // NULL if iExt->iCdma==EFalse.
+                {
+                bearer = EApBearerTypeCDMA;
+                for (j=0; j<iapArrays[KCDMA_ISP][1]->Count(); j++)
+                    {
+                    iappos = GetIapPos( ispArray[KCDMA_ISP],
+                                        iapArrays[KCDMA_ISP][1]->At( j ) );
+                    if ( iappos != KErrNotFound )
+                        { // Cdma, Isp, Bearer...
+                        // create temp. item WITH IAP ID, Bearer type
+                        item = CApListItem::NewLC
+                            (
+                            (TCommsDbIspType)
+                                ispArray[KCDMA_ISP]->At( iappos )[KISPTYPE],
+                            iapArrays[KCDMA_ISP][0]->At( j ),
+                            KEmpty,
+                            bearer
+                            );
+                        tmpApList->AppendL( item );
+                        CleanupStack::Pop( item ); // item owned by list !
+                        }
+                    }
+                }
+
+
+            // Now we have the temporary list filled with
+            // IAP UID, bearer type, ISP type,
+            // So compare it to WAP part and create the REAL list...
+            TInt pos( KErrNotFound );
+            TInt itempos( KErrNotFound );
+            TBool protsupported = FeatureManager::FeatureSupported(
+                                         KFeatureIdSettingsProtection );
+            for (i=0; i< wapapid->Count(); i++)
+                { // as wapapid is sorted, resulting list will be sorted, too !
+                // is it in IP bearer ?
+                if ( IsInArray( ipapid, wapapid->At( i ) ) )
+                    {
+                    // now need to get bearer type & isp type
+                    //
+                    pos = PosInArray(ipapid, wapapid->At( i ) );
+                    if (pos!= KErrNotFound )
+                        { // now we have the index in the
+                        // ipiapid as they are synchronized...
+                        // iapUid = ipiapid[ pos ];
+                        // now have to find a CApListItem in tmpApList
+                        itempos = GetItemPos( tmpApList,
+                                              ipiapid->At( pos ) );
+                        if (itempos != KErrNotFound )
+                            {
+                            TBool prot(EFalse);
+                            if (protsupported)
+                                {
+                                prot = protflags->At( i );
+                                }
+                            item = CApListItem::NewLC
+                                (
+                                (TCommsDbIspType)
+                                    tmpApList->At( itempos )->Type(),
+                                wapapid->At( i ),
+                                *wapapname->At( i ),
+                                tmpApList->At( itempos )->BearerType(),
+                                *wapstartpage->At( i ),
+                                prot );
+                                
+                            iApList->AppendL( item );
+                            CleanupStack::Pop( item ); // item owned by aList !
+                            }
+                        }
+                    }
+                }
+
+            #ifdef __TEST_LAN_BEARER
+                // enable LAN:
+                // ADD THEM AFTER NORMAL QUERYING...
+                if ( ( iBearer & EApBearerTypeLAN ) 
+                    || ( iBearer & EApBearerTypeLANModem ) )
+                    {
+                    AddLanL( EFalse );
+                    }
+            #else
+                // enable LAN:
+                // ADD THEM AFTER NORMAL QUERYING...
+                if ( iBearer & EApBearerTypeLANModem ) 
+                    {
+                    AddLanL( EFalse );
+                    }            
+            #endif // __TEST_LAN_BEARER
+                if ( iBearer & EApBearerTypeWLAN ) 
+                    {
+                    if ( iExt->iWlanSupported )
+                        {
+                        // enable WLAN:
+                        // ADD THEM AFTER NORMAL QUERYING...
+                        AddLanL( ETrue );
+                        }
+                    }
+                
+            // now it has only elements which are OK.
+            // from ALL CSD/GPRS/CDMA tables, still in sorted order...
+            // now it is time to check VPN related stuff, if any
+                if ( ( iExt->iVpnFilterType == EVpnFilterVpnOnly ) ||
+                    ( iExt->iVpnFilterType == EVpnFilterBoth ) )
+                    { // Add VPN access points if needed
+                    // Add ALL VPN access points if needed as requested by
+                    // Nokia, thus incomplete access points to be listed.
+                    TUint32 wapid( 0 );
+                    TInt count = vpnArray->Count();
+                    
+                    CApUtils* util = CApUtils::NewLC( *iDb );
+                    for ( i = 0; i < count; i++ )
+                        {
+                        // get home wap id first
+                        pos = PosInArray( ipiapid, 
+                                          vpnArray->At( i ).iHomeIapId );
+                        TInt foundpos( KErrNotFound );
+                        if ( pos!= KErrNotFound )
+                            { // now we have the index in the
+                            // ipiapid and as they are synchronized...
+                            wapid = ipapid->At( pos );
+                            // now check if we do have it in array...
+                            TInt jcount = iApList->Count();
+                            for ( j = 0; j < jcount; j++ )
+                                {
+                                if ( iApList->At( j )->Uid() == wapid )
+                                    {
+                                    foundpos = j;
+                                    break;
+                                    }
+                                }
+                            }
+                        // should add VPN
+                        // check if VPN-table COMMDB_ID is 
+                        // in iapArrays[VPN][1]
+                        pos = PosInArray( 
+                                iapArrays[KVPN][1], 
+                                vpnArray->At( i ).iVpnIapId );
+                        if ( pos != KErrNotFound )
+                            { // now get VPN IAP ID
+                            TUint32 tempvpniapid = 
+                                iapArrays[KVPN][0]->At( pos );
+                            TUint32 tempvpnwapid ( 0 );
+                            TRAP( err, tempvpnwapid = 
+                                    util->WapIdFromIapIdL( 
+                                           tempvpniapid ) );
+
+                            if ( err == KErrNone )
+                                {
+                                if ( foundpos != KErrNotFound )
+                                    {
+                                    // if not found, it is either an unknown 
+                                    // bearer type, for which we can nto show
+                                    // icon and UI at all, or it does not 
+                                    // fulfill the filtering criteria, so we 
+                                    // ignore them.
+                                    item = CApListItem::NewLC
+                                        (
+                                        iApList->At( foundpos )->Type(),
+                                        tempvpnwapid,
+                                        *vpnArray->At( i ).iName,
+                                        iApList->At( foundpos )
+                                                ->BearerType()
+                                        );
+                                    item->SetVpnFlag( ETrue );
+                                    iApList->AppendL( item );
+                                    // item owned by aList !
+                                    CleanupStack::Pop( item ); 
+                                    }
+                                }
+                            }
+                        }
+                    CleanupStack::PopAndDestroy( util );
+                    }
+
+                if ( iExt->iVpnFilterType == EVpnFilterVpnOnly )
+                    { // remove non-vpn access points if needed
+                    TInt count = iApList->Count();
+                    for ( i = 0; i < count; i++ )
+                        {
+                        if ( !iApList->At( i )->IsVpnAp() )
+                            {
+                            delete iApList->At( i );
+                            iApList->Delete( i );
+                            count--;
+                            i--; // 'cause it is cycled...
+                            }
+                        }
+                    }
+
+
+/*
+#ifdef __WINS__
+                //=============================================================
+                // Support for ethernet in emulator, change 1/2
+                //
+
+                iapt = OpenViewMatchingTextL( TPtrC(IAP),
+                    TPtrC(IAP_SERVICE_TYPE),
+                    TPtrC(LAN_SERVICE) );
+                CleanupStack::PushL( iapt );
+                
+                
+                TBuf<40> name;
+                TUint32 id;
+                TInt err = iapt->GotoFirstRecord();
+                TInt err2;
+                CCommsDbTableView* tmpView = NULL;
+
+                while(err == KErrNone)
+                    {
+                    iapt->ReadTextL(TPtrC(COMMDB_NAME), name);
+                    iapt->ReadUintL(TPtrC(COMMDB_ID), id);
+                    
+                    tmpView = iDb->OpenViewMatchingUintLC(
+                                    TPtrC(WAP_IP_BEARER), TPtrC(WAP_IAP), id);
+                    err2 = tmpView->GotoFirstRecord();
+                    if(err2 == KErrNone)
+                        {
+                        tmpView->ReadUintL(TPtrC(WAP_ACCESS_POINT_ID), id);
+                        CleanupStack::PopAndDestroy( tmpView );
+
+                        tmpView = iDb->OpenViewMatchingUintLC(
+                                TPtrC(WAP_ACCESS_POINT), TPtrC(COMMDB_ID), id);
+                        err2 = tmpView->GotoFirstRecord();
+                        if ( err2 == KErrNone )
+                            {
+                            item = CApListItem::NewLC
+                                (
+                                EIspTypeInternetAndWAP,
+                                id,
+                                name,
+                                EApBearerTypeGPRS
+                                );
+                            iApList->AppendL( item );
+                    
+                            CleanupStack::Pop( item );
+                            }                        
+                        }
+
+                    CleanupStack::PopAndDestroy( tmpView );
+
+                    err = iapt->GotoNextRecord();
+                    }
+                
+                
+                CleanupStack::PopAndDestroy( iapt ); // iapt;
+                iapt = NULL;
+                
+                // End of change 1/2
+                //=============================================================
+                
+#endif // __WINS__
+*/                
+                
+                
+                iCount = iApList->Count();
+                
+            CleanupStack::PopAndDestroy( tmpApList ); // tmpApList
+            
+            if ( vpnArray )
+                {	                
+                CleanupStack::PopAndDestroy( vpnArray->Count() ); 
+                CleanupStack::PopAndDestroy( vpnArray );                 
+                }
+            if ( isptables[KVPN] )
+                {	                
+                CleanupStack::PopAndDestroy( isptables[KVPN] ); 
+                }
+
+            CleanupStack::PopAndDestroy( 10, iapArrays[0][0] ); // iap arrays
+            
+            CleanupStack::PopAndDestroy( 5, ispArray[0] ); // isp arrays
+
+            CleanupStack::Pop( 2, ipapid ); // ipiapid, ipapid
+            CleanupStack::Pop( protflags ); // protflags
+            delete protflags;
+            delete ipiapid;
+            delete ipapid;
+
+// Note: SMS bearer had been dropped.
+            CleanupStack::PopAndDestroy( wapstartpage->Count() );//wapstartpage
+            CleanupStack::PopAndDestroy( wapstartpage ); // wapstartpage
+            CleanupStack::PopAndDestroy( wapapname->Count() ); // wapapname
+            CleanupStack::PopAndDestroy( wapapname ); // wapapname
+            CleanupStack::Pop(); // wapapid
+            delete wapapid;
+
+            if ( isptables[KCDMA_ISP] )
+                {
+                CleanupStack::PopAndDestroy( isptables[KCDMA_ISP] );
+                }
+
+            if ( isptables[KGPRSOUT] )
+                {
+                CleanupStack::PopAndDestroy( isptables[KGPRSOUT] );
+                }
+
+            if ( isptables[KGPRSIN] )
+                {
+                CleanupStack::PopAndDestroy( isptables[KGPRSIN] );
+                }
+
+            if ( isptables[KDIALOUT] )
+                {
+                CleanupStack::PopAndDestroy( isptables[KDIALOUT] );
+                }
+
+            if ( ipbearert )
+                {
+                CleanupStack::PopAndDestroy( ipbearert );
+                }
+            }
+        else
+            {
+            if ( err != KErrNotFound )
+                {
+                User::LeaveIfError( err );
+                }
+            }
+        }
+    else
+        {
+        if ( err != KErrNotFound )
+            {
+            User::Leave( err );
+            }
+        }
+    CleanupStack::PopAndDestroy( wapt );  // wapt
+    iExt->iMaxIndex = iCount-1;
+    if ( OwnTransaction )
+        {
+        ApCommons::RollbackTransactionOnLeave( iDb );
+        CleanupStack::Pop(); // RollbackTransactionOnLeave
+        }
+    CLOG( ( ESelect, 1, _L( "<- CApSelect::DoUpdateL" ) ) );
+
+    return err;
+    }
+
+
+
+
+
+// ---------------------------------------------------------
+// CApSelect::GetFilteredSortedWapTableViewLC
+// ---------------------------------------------------------
+//
+CCommsDbTableView* CApSelect::GetFilteredSortedWapTableViewLC()
+    {
+    CLOG( ( ESelect, 0, 
+        _L( "-> CApSelect::GetFilteredSortedWapTableViewLC" ) ) );
+
+    CCommsDbTableView* wapt = NULL;
+    // Select * from WAP Access Point Table Where
+    // WAP_CURRENT_BEARER=WAP_IP_BEARER
+    if ( ( iBearer & EApBearerTypeCSD ) ||
+         ( iBearer & EApBearerTypeHSCSD ) ||
+         ( iBearer & EApBearerTypeGPRS ) ||
+         ( iExt->iCdma && ( iBearer & EApBearerTypeCDMA ) ) )
+        {
+        wapt = iDb->OpenViewMatchingTextLC( TPtrC(WAP_ACCESS_POINT), 
+                                            TPtrC(WAP_CURRENT_BEARER), 
+                                            TPtrC(WAP_IP_BEARER));
+        }
+    else
+        {
+        wapt = iDb->OpenTableLC( TPtrC(WAP_ACCESS_POINT) );
+        }
+    
+    TInt err;
+    err = wapt->GotoFirstRecord();
+    if ( err != KErrNotFound )
+        {
+        User::LeaveIfError( err );
+        }
+
+    if ( err != KErrNotFound )
+        {
+        // here may come additional AND-ed parts
+        if ( ( iIsp & KEApIspTypeWAPMandatory ) ||
+             ( iIsp & KEApIspTypeMMSMandatory ) )
+            { // add AND ( Hasmandatory..)
+            if ( ( iBearer & EApBearerTypeCSD ) ||
+                 ( iBearer & EApBearerTypeHSCSD ) ||
+                 ( iBearer & EApBearerTypeGPRS ) ||
+                 ( iExt->iCdma && ( iBearer & EApBearerTypeCDMA ) ) )
+                { // Needs IP bearer
+                // ( WAP_CURRENT_BEARER = WAP_IP_BEARER AND
+                //      WAP_START_PAGE != ""
+                //      AND WAP_START_PAGE != "http://"
+                // Filter out unneded records
+                HBufC* buf;
+                do
+                    {
+                    // Add test cases covering this route
+                    buf = wapt->ReadLongTextLC( TPtrC(WAP_START_PAGE) );
+                    if ( ( buf->Compare( KEmpty ) == 0 ) 
+                       || ( buf->Compare( KInvStartPage ) == 0 ) )
+                        {
+                        err = wapt->DeleteRecord();
+                        }
+                    CleanupStack::PopAndDestroy( buf );
+                    err = wapt->GotoNextRecord();
+                    } 
+                    while ( !err );
+                }
+            }
+        }
+    CLOG( ( ESelect, 1, 
+        _L( "<- CApSelect::GetFilteredSortedWapTableViewLC" ) ) );
+
+    return wapt;
+    }
+
+
+
+
+
+// ---------------------------------------------------------
+// CApSelect::GetFilteredSortedIpBearerTableViewLC()
+// ---------------------------------------------------------
+//
+CCommsDbTableView* CApSelect::GetFilteredSortedIpBearerTableViewLC()
+    {
+    CLOG( ( ESelect, 0, 
+        _L( "-> CApSelect::GetFilteredSortedIpBearerTableViewLC" ) ) );
+
+    CCommsDbTableView* table = NULL;
+
+    table = iDb->OpenTableLC( TPtrC(WAP_IP_BEARER) );
+    TInt err;
+    err = table->GotoFirstRecord();
+
+    if ( ( iBearer & EApBearerTypeCSD ) ||
+         ( iBearer & EApBearerTypeHSCSD ) ||
+         ( iBearer & EApBearerTypeGPRS ) ||
+         ( iExt->iCdma && ( iBearer & EApBearerTypeCDMA ) ) )
+        { 
+        // needs ipbearer table
+        // only filtering we can do is about Mandatory
+        // because Isptype & Bearertype are up to
+        // ISP & GPRS tables...
+        if ( iIsp & KEApIspTypeWAPMandatory )
+            { // Hasmandatory..
+            // SELECT * from WAP_IP_BEARER WHERE
+            // WAP_GATEWAY_ADDRESS <> ''
+            //      AND WAP_GATEWAY_ADDRESS != "0.0.0.0" )
+            // AND HIDDEN...
+
+            if ( err != KErrNotFound )
+                {
+                User::LeaveIfError( err );
+
+                HBufC* buf;
+                do
+                    {
+                    buf = table->ReadLongTextLC( TPtrC(WAP_GATEWAY_ADDRESS) );
+                    if ( ( buf->Compare( KEmpty ) == 0 ) 
+                       || ( buf->Compare( KDynIpAddress ) == 0 ) )
+                        {
+                        err = table->DeleteRecord();
+                        }
+                    CleanupStack::PopAndDestroy( buf );
+                    err = table->GotoNextRecord();
+                    } while ( !err );
+                }
+            }
+        }
+
+    CLOG( ( ESelect, 1, 
+        _L( "<- CApSelect::GetFilteredSortedIpBearerTableViewLC" ) ) );
+
+    return table;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSelect::GetFilteredSortedIspOutTableViewLC()
+// ---------------------------------------------------------
+//
+CCommsDbTableView* CApSelect::GetFilteredSortedIspOutTableViewLC()
+    {
+    CLOG( ( ESelect, 0, 
+        _L( "-> CApSelect::GetFilteredSortedIspOutTableViewLC" ) ) );
+    
+    CCommsDbTableView* table = NULL;
+    // ISP-type & bearer type...
+    if ( ( iBearer & EApBearerTypeCSD ) ||
+         ( iBearer & EApBearerTypeHSCSD ) )
+        {
+        // only needed if CSD or HSCSD
+        if ( ( iBearer & EApBearerTypeCSD ) &&
+             (!( iBearer & EApBearerTypeHSCSD )) )
+            { // needs only CSD
+            // WHERE ISP_BEARER_TYPE = EBearerTypeCSD
+            table = iDb->OpenViewMatchingUintLC( TPtrC(DIAL_OUT_ISP),
+                                                 TPtrC(ISP_BEARER_TYPE),
+                                                 EBearerTypeCSD
+                                                 );
+            }
+        else
+            {
+            if ( ( iBearer & EApBearerTypeHSCSD ) &&
+                 (!( iBearer & EApBearerTypeCSD )) )
+                { // needs only HSCSD
+                // WHERE ISP_BEARER_TYPE = EBearerTypeHSCSD
+                table = iDb->OpenViewMatchingUintLC( TPtrC(DIAL_OUT_ISP),
+                                                     TPtrC(ISP_BEARER_TYPE),
+                                                     EBearerTypeHSCSD
+                                                     );
+                }
+            else
+                {
+                table = iDb->OpenTableLC( TPtrC(DIAL_OUT_ISP) );
+                }
+            }
+        TInt err;
+        err = table->GotoFirstRecord();
+        
+        if ( err != KErrNotFound )
+            {
+            User::LeaveIfError( err );
+            // now add isp-type filtering
+            // if Added = ETrue : AND ( ), else : WHERE
+            // KEApIspTypeInternetOnly,
+            // KEApIspTypeWAPOnly,
+            // KEApIspTypeInternetAndWAP,
+            // KEApIspTypeWAPMandatory, KEApIspTypeAll
+            TUint32 isp( 0 );
+            do
+                {
+                table->ReadUintL( TPtrC(ISP_TYPE), isp );
+                if ( ( iIsp & KEApIspTypeInternetOnly ) 
+                     && ( !( iIsp & KEApIspTypeAll ) )
+                     )
+                    {// ( ( ISP_TYPE == EIspTypeInternetOnly )
+                    if ( isp != EIspTypeInternetOnly )
+                        {
+                        err = table->DeleteRecord();
+                        }
+                    }
+                if ( ( iIsp & KEApIspTypeWAPOnly ) 
+                     && ( !( iIsp & KEApIspTypeAll ) )
+                     )
+                    {
+                    if ( isp != EIspTypeWAPOnly )
+                        {
+                        err = table->DeleteRecord();
+                        }
+                    }
+                if ( ( iIsp & KEApIspTypeInternetAndWAP ) 
+                     && ( !( iIsp & KEApIspTypeAll ) )
+                     )
+                    {
+                    if ( isp != EIspTypeInternetAndWAP )
+                        {
+                        err = table->DeleteRecord();
+                        }
+                    }
+                err = table->GotoNextRecord();
+                } while ( !err );
+            }
+        }
+
+    CLOG( ( ESelect, 1, 
+        _L( "<- CApSelect::GetFilteredSortedIspOutTableViewLC" ) ) );
+
+    return table;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSelect::GetFilteredSortedGprsTableViewLC()
+// ---------------------------------------------------------
+//
+CCommsDbTableView* CApSelect::GetFilteredSortedGprsTableViewLC( TBool aIn )
+    {
+    CLOG( ( ESelect, 0, 
+        _L( "-> CApSelect::GetFilteredSortedGprsTableViewLC" ) ) );
+
+    CCommsDbTableView* table = NULL;
+    // ISP-type & bearer type...
+    if ( iBearer & EApBearerTypeGPRS )
+        {
+        // as all other criteria has more than 2 possible values
+        // and all their combinations should be taken into account,
+        // I ask the whole table and then narrow it down
+        // myself with removing the unneded records temporarily
+        if ( aIn )
+            {
+            table = iDb->OpenTableLC( TPtrC( INCOMING_WCDMA ) );
+            }
+        else
+            {
+            table = iDb->OpenTableLC( TPtrC( OUTGOING_WCDMA ) );
+            }
+        TInt err;
+        err = table->GotoFirstRecord();
+        
+        if ( err != KErrNotFound )
+            {
+            User::LeaveIfError( err );
+            // only needed if GPRS
+            // now add isp-type filtering
+            // KEApIspTypeInternetOnly,
+            // KEApIspTypeWAPOnly,
+            // KEApIspTypeInternetAndWAP,
+            // KEApIspTypeWAPMandatory, KEApIspTypeAll
+            TUint32 isp( 0 );
+            TUint32 pdptype( 0 );
+            TBool deleted(EFalse);
+            do
+                {
+                deleted = EFalse;
+                // first check if it fits our isp type criteria
+                TRAPD( res, table->ReadUintL( TPtrC(GPRS_AP_TYPE), isp ) );
+                if ( res != KErrUnknown )
+                    {
+                    if ( ( iIsp & KEApIspTypeInternetOnly ) 
+                         && ( !( iIsp & KEApIspTypeAll ) )
+                         )
+                        {// ( ( ISP_TYPE == EIspTypeInternetOnly )
+                        if ( isp != EIspTypeInternetOnly )
+                            {
+                            err = table->DeleteRecord();
+                            deleted = ETrue;
+                            }
+                        }
+                    if ( ( iIsp & KEApIspTypeWAPOnly ) 
+                         && ( !( iIsp & KEApIspTypeAll ) )
+                         )
+                        {
+                        if ( isp != EIspTypeWAPOnly )
+                            {
+                            err = table->DeleteRecord();
+                            deleted = ETrue;
+                            }
+                        }
+                    if ( ( iIsp & KEApIspTypeInternetAndWAP ) 
+                         && ( !( iIsp & KEApIspTypeAll ) )
+                         )
+                        {
+                        if ( isp != EIspTypeInternetAndWAP )
+                            {
+                            err = table->DeleteRecord();
+                            deleted = ETrue;
+                            }
+                        }
+                    }
+                // now check if it fits IPv4 or IPv6 criteria
+                // Add IPv4 or IPv6 query ONLY if it is supported!!!
+                if ( ( !deleted ) && ( iExt->iIsIpv6Supported ) )
+                    {
+                    // if ONLY IPv4 is requested, 
+                    // filter out where PDP_type IS IPv6
+                    // if both is requested, do nothing
+                    // if IPv6 only is requested, filter IN 
+                    // where PDP_type IS IPv6
+                    if ( ( iExt->iReqIpvType == EIPv4 ) ||
+                         ( iExt->iReqIpvType == EIPv6 ) )
+                        { // not both, needs filtering
+                        table->ReadUintL( TPtrC(GPRS_PDP_TYPE), pdptype );
+                        if ( ( iExt->iReqIpvType == EIPv4 ) 
+                             && ( pdptype == RPacketContext::EPdpTypeIPv6 )
+                             )
+                            {
+                            err = table->DeleteRecord();
+                            deleted = ETrue;
+                            }
+                        if ( ( iExt->iReqIpvType == EIPv6 ) 
+                             && ( pdptype == RPacketContext::EPdpTypeIPv4 )
+                             )
+                            {
+                            err = table->DeleteRecord();
+                            deleted = ETrue;
+                            }
+                        }
+                    }
+                err = table->GotoNextRecord();
+                } while ( !err );
+            }
+        }
+    CLOG( ( ESelect, 1, 
+        _L( "<- CApSelect::GetFilteredSortedGprsTableViewLC" ) ) );
+
+    return table;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSelect::GetUintValuesL
+// ---------------------------------------------------------
+//
+void CApSelect::GetUintValuesL( CCommsDbTableView* aTable,
+                                const TDesC& aField,
+                                CArrayFixFlat<TUint32>& aArray )
+    {
+    CLOG( ( ESelect, 0, _L( "-> CApSelect::GetUintValuesL" ) ) );
+
+    if ( aTable )
+        {
+        TInt err = aTable->GotoFirstRecord();
+        if ( ( err != KErrNone ) && ( err != KErrNotFound ) )
+            {
+            User::Leave( err );
+            }
+        if ( err != KErrNotFound )
+            {
+            TUint32 temp( 0 );
+            TBool goon( ETrue );
+            do
+                {
+                err = ApCommons::ReadUintL( aTable, TPtrC(COMMDB_ID), temp );
+                if ( ( err == KErrNone ) && ( temp ) )
+                    {
+                    // Here I need to TRAP to be able to use 'old'
+                    // database which has no such field !
+                    // Also assigns a 'default' for it in that case
+                    TRAP(err, ApCommons::ReadUintL( aTable, aField, temp ) );
+                    aArray.AppendL( temp );
+                    }
+                err = aTable->GotoNextRecord();
+                if ( err == KErrNotFound )
+                    {
+                    goon = EFalse;
+                    }
+                else
+                    {
+                    User::LeaveIfError( err );
+                    }
+                }
+                while ( goon );
+            }
+        }
+    CLOG( ( ESelect, 1, _L( "<- CApSelect::GetUintValuesL" ) ) );
+
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSelect::GetProtValuesL
+// ---------------------------------------------------------
+//
+void CApSelect::GetProtValuesL( CCommsDbTableView* aTable,
+                                CArrayFixFlat<TUint32>& aArray )
+    {    
+    CLOG( ( ESelect, 0, _L( "-> CApSelect::GetProtValuesL" ) ) );
+
+    CCommsDbProtectTableView* view =
+        (CCommsDbProtectTableView*)aTable;
+    if ( aTable )
+        {
+        TInt err = aTable->GotoFirstRecord();
+        if ( ( err != KErrNone ) && ( err != KErrNotFound ) )
+            {
+            User::Leave( err );
+            }
+        if ( err != KErrNotFound )
+            {
+            TBool goon( ETrue );
+            TInt prot( EFalse );
+            do
+                {
+                err = view->GetRecordAccess( prot );
+                if ( ( err == KErrNone ) )
+                    {
+                    aArray.AppendL( prot );
+                    }
+                err = aTable->GotoNextRecord();
+                if ( err == KErrNotFound )
+                    {
+                    goon = EFalse;
+                    }
+                else
+                    {
+                    User::LeaveIfError( err );
+                    }
+                }
+                while ( goon );
+            }
+        }
+    CLOG( ( ESelect, 1, _L( "<- CApSelect::GetProtValuesL" ) ) );
+
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CApSelect::GetTextValuesL
+// ---------------------------------------------------------
+//
+void CApSelect::GetTextValuesL( CCommsDbTableView* aTable,
+                                const TDesC& aField,
+                                CArrayPtrFlat<HBufC>& aArray )
+    {
+    CLOG( ( ESelect, 0, _L( "-> CApSelect::GetTextValuesL" ) ) );
+
+    if ( aTable )
+        {
+        TInt err = aTable->GotoFirstRecord();
+        if ( ( err != KErrNone ) && ( err != KErrNotFound ) )
+            {
+            User::Leave( err );
+            }
+        if ( err != KErrNotFound )
+            {
+            TBool goon( ETrue );
+            TInt l;
+            TUint32 temp( 0 );
+            HBufC* tmp = NULL;
+            do
+                {
+                err = ApCommons::ReadUintL( aTable, TPtrC(COMMDB_ID), temp );
+                if ( ( err == KErrNone ) && ( temp ) )
+                    {
+                    aTable->ReadColumnLengthL( aField, l );
+                    tmp = HBufC::NewLC( l );
+                    TPtr tmpptr( tmp->Des() );
+                    aTable->ReadTextL( aField, tmpptr );
+                    aArray.AppendL( tmp );
+                    }
+                err = aTable->GotoNextRecord();
+                if ( err == KErrNotFound )
+                    {
+                    goon = EFalse;
+                    }
+                else
+                    {
+                    User::LeaveIfError( err );
+                    }
+                }
+                while ( goon );
+            }
+        }
+    CLOG( ( ESelect, 1, _L( "<- CApSelect::GetTextValuesL" ) ) );
+
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSelect::GetLongTextValuesL
+// ---------------------------------------------------------
+//
+void CApSelect::GetLongTextValuesL( CCommsDbTableView* aTable,
+                                    const TDesC& aField,
+                                    CArrayPtrFlat<HBufC>& aArray )
+    {
+    CLOG( ( ESelect, 0, _L( "-> CApSelect::GetLongTextValuesL" ) ) );
+
+    if ( aTable )
+        {
+        TInt err = aTable->GotoFirstRecord();
+        if ( ( err != KErrNone ) && ( err != KErrNotFound ) )
+            {
+            User::Leave( err );
+            }
+        if ( err != KErrNotFound )
+            {
+            TBool goon( ETrue );
+            TInt l;
+            TUint32 temp( 0 );
+            HBufC* tmp = NULL;
+            do
+                {
+                err = ApCommons::ReadUintL( aTable, TPtrC(COMMDB_ID), temp );
+                if ( ( err == KErrNone ) && ( temp ) )
+                    {
+                    aTable->ReadColumnLengthL( aField, l );
+                    tmp = aTable->ReadLongTextLC( aField );
+                    aArray.AppendL( tmp );
+                    }
+                err = aTable->GotoNextRecord();
+                if ( err == KErrNotFound )
+                    {
+                    goon = EFalse;
+                    }
+                else
+                    {
+                    User::LeaveIfError( err );
+                    }
+                }
+                while ( goon );
+            }
+        }
+    CLOG( ( ESelect, 1, _L( "<- CApSelect::GetLongTextValuesL" ) ) );
+
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSelect::IsInArray
+// ---------------------------------------------------------
+//
+TBool CApSelect::IsInArray( CArrayFixFlat<TUint32>* aArray, TUint32 aValue )
+    {
+    CLOG( ( ESelect, 0, _L( "<-> CApSelect::IsInArray" ) ) );
+
+    return ( PosInArray( aArray, aValue ) >= 0);
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSelect::PosInArray
+// ---------------------------------------------------------
+//
+TInt CApSelect::PosInArray( CArrayFixFlat<TUint32>* aArray, TUint32 aValue )
+    {
+    CLOG( ( ESelect, 0, _L( "-> CApSelect::PosInArray" ) ) );
+
+    TInt retval( KErrNotFound );
+    if ( aArray )
+        {
+        TInt count = aArray->Count();
+        for( TInt i=0; ( ( i<count) && ( retval == KErrNotFound ) ); i++ )
+            {
+            if ( aArray->At( i ) == aValue )
+                {
+                retval = i;
+                }
+            }
+        }
+    CLOG( ( ESelect, 1, _L( "<- CApSelect::PosInArray" ) ) );
+
+    return retval;
+    }
+
+
+// ---------------------------------------------------------
+// CApSelect::GetItemPos
+// ---------------------------------------------------------
+//
+TInt CApSelect::GetItemPos( CApListItemList* aList, TUint32 aId )
+    {
+    CLOG( ( ESelect, 0, _L( "-> CApSelect::GetItemPos" ) ) );
+
+    TInt retval( KErrNotFound );
+    if ( aList )
+        {
+        TInt count = aList->Count();
+        for( TInt i=0; ( ( i<count) && ( retval == KErrNotFound ) ); i++ )
+            {
+            if ( aList->At( i )->Uid() == aId )
+                {
+                retval = i;
+                }
+            }
+        }
+    CLOG( ( ESelect, 1, _L( "<- CApSelect::GetItemPos" ) ) );
+
+    return retval;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSelect::OpenViewMatchingTextL
+// ---------------------------------------------------------
+//
+CCommsDbTableView* CApSelect::OpenViewMatchingTextL(
+                                             const TDesC& aTableName,
+                                             const TDesC& aColumnToMatch,
+                                             const TDesC16& aValueToMatch )
+    {
+    CLOG( ( ESelect, 0, _L( "-> CApSelect::OpenViewMatchingTextL" ) ) );
+
+    CCommsDbTableView* table = NULL;
+    TRAPD( err, { // this leaves if the table is empty....
+                table = iDb->OpenViewMatchingTextLC( aTableName,
+                                                     aColumnToMatch,
+                                                     aValueToMatch );
+                CleanupStack::Pop( table ); // table
+                }
+        );
+    if ( err != KErrNotFound )
+        {
+        User::LeaveIfError( err );
+        }
+    CLOG( ( ESelect, 1, _L( "<- CApSelect::OpenViewMatchingTextL" ) ) );
+
+    return table;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSelect::GetIspValuesL
+// ---------------------------------------------------------
+//
+void CApSelect::GetIspValuesL( CCommsDbTableView* aTable,
+                               CArrayFixFlat<TUint32[3]>* aArray,
+                               const TDesC& aColName )
+    {
+    CLOG( ( ESelect, 0, _L( "-> CApSelect::GetIspValuesL" ) ) );
+
+    if ( aTable )
+        {
+        TInt err = aTable->GotoFirstRecord();
+        if ( ( err != KErrNone ) && ( err != KErrNotFound ) )
+            {
+            User::Leave( err );
+            }
+        if ( err != KErrNotFound )
+            {
+            TUint32 temp[3];
+            TBool goon( ETrue );
+            do
+                {
+                err = ApCommons::ReadUintL( aTable, TPtrC(COMMDB_ID),
+                                             temp[KUID] );
+                if ( ( err == KErrNone ) && ( temp[KUID] ) )
+                    {
+                    // Here I need to TRAP to be able to use 'old'
+                    // database which has no such field !
+                    // Also assigns a 'default' for it in that case
+                    TRAP( err, ApCommons::ReadUintL
+                                        (
+                                        aTable,
+                                        aColName,
+                                        temp[KISPTYPE]
+                                        ) );
+                    if ( err == KErrNotFound )
+                        {
+                        temp[KISPTYPE] = EIspTypeInternetAndWAP;
+                        }
+                    else
+                        {
+                        User::LeaveIfError( err );
+                        }
+                    // if it is CSD/HSCSD, now decide which one
+                    if( !aColName.Compare( TPtrC(ISP_TYPE) ) )
+                        {
+                        err = ApCommons::ReadUintL
+                                            (
+                                            aTable,
+                                            TPtrC(ISP_BEARER_TYPE),
+                                            temp[KBEARERTYPE]
+                                            );
+                        if ( err != KErrNone )
+                            { // only possible if it is NULL,
+                            // for other errors, it leaves...
+                            temp[KBEARERTYPE] = EBearerTypeCSD;
+                            }
+                        }
+                    else
+                        {
+                        temp[KBEARERTYPE] = 0;
+                        }
+                    aArray->AppendL( temp );
+                    }
+                err = aTable->GotoNextRecord();
+                if ( err == KErrNotFound )
+                    {
+                    goon = EFalse;
+                    }
+                else
+                    {
+                    User::LeaveIfError( err );
+                    }
+                }
+                while ( goon );
+            }
+        }
+    CLOG( ( ESelect, 1, _L( "<- CApSelect::GetIspValuesL" ) ) );
+
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CApSelect::GetIapPos
+// ---------------------------------------------------------
+//
+TInt CApSelect::GetIapPos( CArrayFixFlat<TUint32[3]>* aArray, TUint32 aValue )
+    {
+    CLOG( ( ESelect, 0, _L( "-> CApSelect::GetIapPos" ) ) );
+
+    TInt retval( KErrNotFound );
+    if ( aArray )
+        {
+        TInt count = aArray->Count();
+        for( TInt i=0; ( ( i<count) && ( retval == KErrNotFound ) ); i++ )
+            {
+            if ( aArray->At( i )[KUID] == aValue )
+                {
+                retval = i;
+                }
+            }
+        }
+    CLOG( ( ESelect, 1, _L( "<- CApSelect::GetIapPos" ) ) );
+
+    return retval;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSelect::SortLocalisedNameL()
+// ---------------------------------------------------------
+//
+void CApSelect::SortLocalisedNameL( TBool aAscending )
+    {
+    CLOG( ( ESelect, 0, _L( "-> CApSelect::SortLocalisedNameL" ) ) );
+
+    TApListItemNameKey Key( aAscending );
+    Key.SetPtr( iApList );
+    // Sort returns KErrGeneral if stack overflow, otherwise, returns
+    // KErrNone. So we will Leave only if stack overflow,
+    // but then that really does not matter...
+    User::LeaveIfError( iApList->Sort( Key ) );
+    CLOG( ( ESelect, 1, _L( "<- CApSelect::SortLocalisedNameL" ) ) );
+
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CApSelect::SortUidL()
+// ---------------------------------------------------------
+//
+void CApSelect::SortUidL( TBool aAscending )
+    {
+    CLOG( ( ESelect, 0, _L( "-> CApSelect::SortUidL" ) ) );
+
+    TApListItemUidKey Key( aAscending );
+    Key.SetPtr( iApList );
+    // Sort returns KErrGeneral if stack overflow, otherwise, returns
+    // KErrNone. So we will Leave only if stack overflow,
+    // but then that really does not matter...
+    User::LeaveIfError( iApList->Sort( Key ) );
+    CLOG( ( ESelect, 1, _L( "<- CApSelect::SortUidL" ) ) );
+
+    }
+
+// ---------------------------------------------------------
+// CApSelect::NewLC()
+// ---------------------------------------------------------
+//
+EXPORT_C CApSelect* CApSelect::NewLC( CCommsDatabase& aDb,
+                                      TInt aIspFilter,
+                                      TInt aBearerFilter,
+                                      TInt aSortType,
+                                      TInt aReqIpvType
+                                      )
+    {
+    CLOG( ( ESelect, 0, _L( "-> CApSelect::NewLC" ) ) );
+
+    CApSelect* db = new( ELeave ) CApSelect;
+    CleanupStack::PushL( db );
+    db->ConstructL( aDb, aIspFilter, aBearerFilter, 
+                    aSortType, aReqIpvType, EVpnFilterBoth );
+
+    CLOG( ( ESelect, 1, _L( "<- CApSelect::NewLC" ) ) );
+    return db;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSelect::ConstructL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApSelect::ConstructL( CCommsDatabase& aDb,
+                                 TInt aIspFilter,
+                                 TInt aBearerFilter,
+                                 TInt aSortType,
+                                 TInt aReqIpvType )
+
+    {
+    CLOG( ( ESelect, 0, _L( "-> CApSelect::ConstructL" ) ) );
+    
+    ConstructL( aDb, aIspFilter, aBearerFilter, 
+                aSortType, aReqIpvType, EVpnFilterBoth );
+
+    CLOG( ( ESelect, 1, _L( "<- CApSelect::ConstructL" ) ) );
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CApSelect::NewLC()
+// ---------------------------------------------------------
+//
+EXPORT_C CApSelect* CApSelect::NewLC( CCommsDatabase& aDb,
+                                      TInt aIspFilter,
+                                      TInt aBearerFilter,
+                                      TInt aSortType,
+                                      TInt aReqIpvType,
+                                      TVpnFilterType aVpnFilterType
+                                      )
+    {
+    CLOG( ( ESelect, 0, _L( "-> CApSelect::NewLC" ) ) );
+
+    CApSelect* db = new( ELeave ) CApSelect;
+    CleanupStack::PushL( db );
+    db->ConstructL( aDb, aIspFilter, aBearerFilter, 
+                    aSortType, aReqIpvType, aVpnFilterType );
+
+    CLOG( ( ESelect, 1, _L( "<- CApSelect::NewLC" ) ) );
+    return db;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSelect::NewLC()
+// ---------------------------------------------------------
+//
+EXPORT_C CApSelect* CApSelect::NewLC( CCommsDatabase& aDb,
+                                      TInt aIspFilter,
+                                      TInt aBearerFilter,
+                                      TInt aSortType,
+                                      TInt aReqIpvType,
+                                      TVpnFilterType aVpnFilterType,
+                                      TBool aIncludeEasyWlan )
+    {
+    CLOG( ( ESelect, 0, _L( "-> CApSelect::NewLC" ) ) );
+
+    CApSelect* db = new( ELeave ) CApSelect;
+    CleanupStack::PushL( db );
+    db->ConstructL( aDb, aIspFilter, aBearerFilter, 
+                    aSortType, aReqIpvType, aVpnFilterType,
+                    aIncludeEasyWlan );
+
+    CLOG( ( ESelect, 1, _L( "<- CApSelect::NewLC" ) ) );
+    return db;    
+    }
+
+
+// ---------------------------------------------------------
+// CApSelect::ConstructL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApSelect::ConstructL( CCommsDatabase& aDb,
+                                 TInt aIspFilter,
+                                 TInt aBearerFilter,
+                                 TInt aSortType,
+                                 TInt aReqIpvType,
+                                 TVpnFilterType aVpnFilterType )
+    {
+    CLOG( ( ESelect, 0, _L( "-> CApSelect::ConstructL" ) ) );
+    
+    ConstructL( aDb, aIspFilter, aBearerFilter, aSortType, 
+                aReqIpvType, aVpnFilterType, EFalse );
+
+    CLOG( ( ESelect, 1, _L( "<- CApSelect::ConstructL" ) ) );
+    }
+
+
+
+
+
+// ---------------------------------------------------------
+// CApSelect::ConstructL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApSelect::ConstructL( CCommsDatabase& aDb,
+                                 TInt aIspFilter,
+                                 TInt aBearerFilter,
+                                 TInt aSortType,
+                                 TInt aReqIpvType,
+                                 TVpnFilterType aVpnFilterType,
+                                 TBool aIncludeEasyWlan )
+    {
+    CLOG( ( ESelect, 0, _L( "-> CApSelect::ConstructL" ) ) );
+    
+    iExt = new ( ELeave )TSelectExtra;
+    iExt->iExtra = 0;
+    iExt->iIsIpv6Supported = EFalse;
+    iExt->iMaxIndex = 0;
+    iExt->iReqIpvType = EIPv4;
+    iExt->iIsFeatureManagerInitialised = EFalse;
+    iExt->iCdma = EFalse;
+    iExt->iWlanSupported = EFalse;
+    iExt->iIncludeEasyWlan = aIncludeEasyWlan;
+
+    FeatureManager::InitializeLibL();
+    iExt->iIsFeatureManagerInitialised = ETrue;
+
+    iApList = new( ELeave )CApListItemList();
+    iExt->iIsIpv6Supported = 
+            FeatureManager::FeatureSupported( KFeatureIdIPv6 );
+#ifdef __TEST_IPV6_SUPPORT    
+    iExt->iIsIpv6Supported = ETrue;
+#endif //  __TEST_IPV6_SUPPORT    
+    iExt->iCdma = FeatureManager::FeatureSupported( KFeatureIdProtocolCdma );
+#ifdef __TEST_CDMA_SUPPORT
+    iExt->iCdma = ETrue;
+#endif // __TEST_CDMA_SUPPORT
+
+    iExt->iWlanSupported = 
+            FeatureManager::FeatureSupported( KFeatureIdProtocolWlan );
+#ifdef __TEST_WLAN_SUPPORT
+    iExt->iWlanSupported = ETrue;
+#endif // __TEST_WLAN_SUPPORT
+    
+    iDb = &aDb;
+
+    SetFiltersL( aIspFilter, aBearerFilter, aSortType, 
+                 aReqIpvType, aVpnFilterType );
+
+    CLOG( ( ESelect, 1, _L( "<- CApSelect::ConstructL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSelect::SetFiltersL
+// ---------------------------------------------------------
+//
+void CApSelect::SetFiltersL( TInt aIspFilter, TInt aBearerFilter,
+                             TInt aSortType, TInt aReqIpvType,
+                             TInt aVpnFilterType )
+    {
+    CLOG( ( ESelect, 0, _L( "-> CApSelect::SetFilters" ) ) );
+
+    TInt lcode( KErrNone );
+    // as bearer filter might be EApBearerTypeAllBearers, 
+    // there is no point to check bearer filter validity
+    // but we can still check ISP...
+    if ( aIspFilter >= 2*KEApIspTypeMMSMandatory )
+        {
+        lcode = KErrInvalidIspRequest;
+        }
+
+    User::LeaveIfError( lcode );
+
+    if ( !( ( aSortType == KEApSortUidAscending )
+        || ( aSortType == KEApSortUidDescending )
+        || ( aSortType == KEApSortNameAscending )
+        || ( aSortType == KEApSortNameDescending ) )
+        )
+        {
+        // no sorting order specified,
+        // assuming KEApSortUidAscending
+        aSortType = KEApSortUidAscending;
+        }
+
+    if ( !( aBearerFilter & ( EApBearerTypeCSD
+                        + EApBearerTypeCDMA
+                        + EApBearerTypeGPRS
+                        + EApBearerTypeHSCSD
+                        + EApBearerTypeWLAN
+                    #ifdef __TEST_LAN_BEARER
+                        + EApBearerTypeLAN
+                    #endif // __TEST_LAN_BEARER
+                        + EApBearerTypeLANModem
+                    // Check bearertype all case!!!
+                        + EApBearerTypeAll ) )
+        )
+        {
+        // no bearer type specified,
+        // assuming EApBearerTypeAll
+        if ( aBearerFilter != EApBearerTypeAllBearers )
+            {
+            // unknown bearer, Leave
+	        User::Leave( KErrInvalidBearerType );            
+            }
+        }
+
+    if ( !( aIspFilter & ( KEApIspTypeAll
+                         + KEApIspTypeInternetAndWAP
+                         + KEApIspTypeInternetOnly
+                         + KEApIspTypeWAPOnly
+                         + KEApIspTypeMMSMandatory ) )
+        )
+        {
+        // erroneous use, no ISP type specified,
+        // or only KEApIspTypeWAPMandatory,
+        // both cases assuming KEApIspTypeAll
+        aIspFilter += KEApIspTypeAll;
+        }
+
+    iIsp = aIspFilter;
+    iSort = aSortType;
+
+    if ( aBearerFilter & EApBearerTypeAll )
+        {
+        aBearerFilter = EApBearerTypeAllBearers;
+        }
+
+	iBearer = GetSupportedBearerSet( aBearerFilter );
+	
+	if ( !iBearer )
+	    {
+	    User::Leave( KErrInvalidBearerType );
+	    }
+
+    iExt->iReqIpvType = aReqIpvType;
+
+    iExt->iVpnFilterType = aVpnFilterType;
+
+    DoUpdateL();
+
+    if ( iSort == KEApSortNameAscending )
+        {
+        SortLocalisedNameL( ETrue ); // ascending
+        }
+    else
+        {
+        if ( iSort == KEApSortNameDescending )
+            {
+            SortLocalisedNameL( EFalse ); // descending
+            }
+        else
+            {
+            if ( iSort == KEApSortUidAscending )
+                {
+                SortUidL( ETrue );
+                }
+            else
+                {
+                if ( iSort == KEApSortUidDescending )
+                    {
+                    SortUidL( EFalse );
+                    }
+                }
+            }
+        }
+
+    CLOG( ( ESelect, 1, _L( "<- CApSelect::SetFilters" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSelect::GetVpnTableViewLC()
+// ---------------------------------------------------------
+//
+CCommsDbTableView* CApSelect::GetVpnTableViewLC( )
+    {
+    CLOG( ( ESelect, 0, _L( "-> CApSelect::GetVpnTableViewLC" ) ) );
+
+    CCommsDbTableView* table = NULL;
+    table = iDb->OpenTableLC( TPtrC(VPN_SERVICE) );
+    
+    CLOG( ( ESelect, 1, _L( "<- CApSelect::GetVpnTableViewLC" ) ) );
+
+    return table;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSelect::GetVpnValuesL
+// ---------------------------------------------------------
+//
+void CApSelect::GetVpnValuesL( CCommsDbTableView* aTable,
+                               CArrayFixFlat<TVpnData>* aVpnArray )
+    { // get the VPN values
+    CLOG( ( ESelect, 0, _L( "-> CApSelect::GetVpnValuesL" ) ) );
+
+    if ( aTable )
+        {
+        TInt err = aTable->GotoFirstRecord();
+        if ( ( err != KErrNone ) && ( err != KErrNotFound ) )
+            {
+            User::Leave( err );
+            }
+        if ( err != KErrNotFound )
+            {
+            TUint32 tempvpn( 0 );
+            TUint32 temphome( 0 );
+            HBufC*  tempname = NULL;
+            TVpnData data;
+            TBool goon( ETrue );
+            do
+                {
+                err = ApCommons::ReadUintL( aTable, TPtrC(COMMDB_ID), 
+                                            tempvpn );
+                if ( ( err == KErrNone ) && ( tempvpn ) )
+                    {
+                    err = ApCommons::ReadUintL( aTable, 
+                                                TPtrC(VPN_SERVICE_IAP),
+                                                temphome );
+                    if ( ( err == KErrNone ) && ( temphome ) )
+                        {
+                        // now get the name
+
+                        tempname = 
+                            ApCommons::ReadText16ValueLC( aTable, 
+                                                          TPtrC(COMMDB_NAME) );
+                        
+                        // everything is O.K., we can add the item
+                        data.iHomeIapId = temphome;
+                        data.iVpnIapId = tempvpn;
+                        data.iName = tempname;
+                        aVpnArray->AppendL( data ); // array owns it...
+                        }
+                    // Only VPN iaps which point to a real IAP are added to list.
+                    }
+                else
+                    {
+                    User::LeaveIfError( err );
+                    }
+                err = aTable->GotoNextRecord();
+                if ( err == KErrNotFound )
+                    {
+                    goon = EFalse;
+                    }
+                else
+                    {
+                    User::LeaveIfError( err );
+                    }
+                }
+                while ( goon );
+            }
+        }
+    CLOG( ( ESelect, 1, _L( "<- CApSelect::GetVpnValuesL" ) ) );
+
+    }
+
+
+
+
+
+// ---------------------------------------------------------
+// CApSelect::AddLanL
+// ---------------------------------------------------------
+//
+void CApSelect::AddLanL( TBool aWlan )
+    {
+    CLOG( ( ESelect, 0, _L( "-> CApSelect::AddLanL" ) ) );
+
+    // First get the list of all VPN-s
+    // get their WAP-ID, IAPID,  
+    // Also ask their RealIApID, bearertype and filter for it...
+
+    CCommsDbTableView* lant = NULL;
+
+    lant = iDb->OpenViewMatchingTextLC( TPtrC(IAP), 
+                                        TPtrC(IAP_SERVICE_TYPE), 
+                                        TPtrC(LAN_SERVICE) );
+    TInt err = lant->GotoFirstRecord();
+    if ( err != KErrNotFound)
+        {
+        User::LeaveIfError( err );
+
+        CArrayFixFlat<TUint32>* laniapid =
+                new ( ELeave ) CArrayFixFlat<TUint32>( 10 );
+        CleanupStack::PushL( laniapid );
+        GetUintValuesL( lant, TPtrC(COMMDB_ID), *laniapid );
+
+        CArrayFixFlat<TUint32>* lanserviceid =
+                new ( ELeave ) CArrayFixFlat<TUint32>( 10 );
+        CleanupStack::PushL( lanserviceid );
+        GetUintValuesL( lant, TPtrC(IAP_SERVICE), *lanserviceid );
+
+        CArrayFixFlat<TUint32>* iapbearerid =
+                new ( ELeave ) CArrayFixFlat<TUint32>( 10 );
+        CleanupStack::PushL( iapbearerid );
+        GetUintValuesL( lant, TPtrC(IAP_BEARER), *iapbearerid );
+
+        // read up access point names, too, just to be as fast as we can...
+        CArrayPtrFlat<HBufC>* lanapname =
+                new ( ELeave ) CArrayPtrFlat<HBufC>( 10 );
+        CleanupStack::PushL( lanapname );
+        GetTextValuesL( lant, TPtrC(COMMDB_NAME), *lanapname );
+
+        // now get WAP ID's
+//        CArrayFixFlat<TUint32>* lanwapapid =
+//                new ( ELeave ) CArrayFixFlat<TUint32>( 10 );
+//        CleanupStack::PushL( lanwapapid );
+        CApUtils* utils = CApUtils::NewLC( *iDb );
+
+        TUint32 count( laniapid->Count() );
+        TUint32 currlaniapid;
+        TUint32 currwapapid( 0 );
+        CApListItem* item = NULL;
+
+        for ( TUint32 i = 0; i < count; i++)
+            {
+            currlaniapid = laniapid->At( i ); 
+            TRAP( err, currwapapid = utils->WapIdFromIapIdL( currlaniapid ));
+            if ( !err )
+                { // get protection for the given record
+                TInt prot( EFalse );
+                CCommsDbTableView* wt = NULL;
+
+                wt = iDb->OpenViewMatchingUintLC( TPtrC(WAP_ACCESS_POINT), 
+                                                TPtrC(COMMDB_ID), 
+                                                currwapapid );
+                CCommsDbProtectTableView* protview =
+                    (CCommsDbProtectTableView*)wt;
+                                                
+                User::LeaveIfError( wt->GotoFirstRecord() );
+                err = protview->GetRecordAccess( prot );
+                HBufC* wspage = wt->ReadLongTextLC( TPtrC(WAP_START_PAGE) );
+                if ( aWlan )
+                    {
+                    if ( iExt->iWlanSupported )
+                        {
+                        // check if it is a WLAN, add ONLY if it IS
+                        TUint32 lanid = lanserviceid->At( i );
+                        TBool iswlan( EFalse );
+                        TRAP( err, iswlan = utils->IsWlanL( lanid ) );
+                        if ( !err && iswlan )
+                            {
+                            TBool hasssid( EFalse );
+                            err = KErrNone;
+                            TRAP( err, 
+                                   hasssid = utils->HasWlanSSIDL( lanid ));
+                            if ( iExt->iIncludeEasyWlan )
+                                {
+                                hasssid = ETrue;
+                                }
+                            if ( (err == KErrNone) && hasssid )
+                                {                                
+                                item = CApListItem::NewLC( 
+                                       EIspTypeInternetAndWAP,
+                                       currwapapid,
+                                       *lanapname->At( i ),
+                                       EApBearerTypeWLAN,
+                                       *wspage,
+                                       prot );
+                                iApList->AppendL( item );
+                                CleanupStack::Pop( item ); // owned by list
+                                }
+                            }
+                        }
+                    }
+                else
+                    {
+                    // first check if it is a WLAN, add ONLY if it IS NOT
+                    // then check if it is LANModem, 
+                    // then check for LAN, if supported
+                    // check if it is a WLAN, add ONLY if it IS NOT
+                    TUint32 lanid = lanserviceid->At( i );
+                    TBool iswlan( EFalse );
+                    TRAP( err, iswlan = utils->IsWlanL( lanid ) );                    
+                    if ( !err && !iswlan )
+                        {
+                        // then check if it is LANModem, 
+                        CCommsDbTableView* lanbearer;
+                        lanbearer = 
+                            iDb->OpenViewMatchingUintLC( 
+                                        TPtrC(LAN_BEARER),
+                                        TPtrC(COMMDB_ID), 
+                                        iapbearerid->At(i ) );
+                        User::LeaveIfError( 
+                                lanbearer->GotoFirstRecord() );
+                        // LANMODEM? check commdb_name
+                        HBufC* lbuf;
+                        lbuf = ApCommons::ReadText16ValueLC( lanbearer,
+                                                     TPtrC(COMMDB_NAME) );
+                        // if it is KModemBearerLanModem, it is LANModem
+                        if ( *lbuf == KModemBearerLANModem )
+                            {
+                            item = CApListItem::NewLC( EIspTypeInternetAndWAP,
+                                                       currwapapid,
+                                                       *lanapname->At( i ),
+                                                       EApBearerTypeLANModem );
+                            iApList->AppendL( item );
+                            CleanupStack::Pop( item ); // item owned by list !
+                            }
+                        else
+                            {
+
+#ifdef __TEST_LAN_BEARER
+                            // Check for sure it is LAN
+                            // we now it is not WLAN, say it is LAN
+                            item = CApListItem::NewLC( EIspTypeInternetAndWAP,
+                                                       currwapapid,
+                                                       *lanapname->At( i ),
+                                                       EApBearerTypeLAN,
+                                                       *wspage,
+                                                       prot );
+                            iApList->AppendL( item );
+                            CleanupStack::Pop( item ); // item owned by list !
+#endif // __TEST_LAN_BEARER
+                            }
+                        CleanupStack::PopAndDestroy( lbuf );
+                        CleanupStack::PopAndDestroy( lanbearer );
+                        }
+                    }
+                CleanupStack::PopAndDestroy( wspage );
+                CleanupStack::PopAndDestroy( wt );
+                }
+            }
+
+        iCount = iApList->Count();
+        iExt->iMaxIndex = iCount-1;
+
+        CleanupStack::PopAndDestroy( utils );
+//        CleanupStack::PopAndDestroy( lanwapapid );
+        // ResetAndDestroy the array:
+        CleanupStack::PopAndDestroy( lanapname->Count() ); // lanapname
+        CleanupStack::PopAndDestroy( lanapname ); // lanapname
+		CleanupStack::PopAndDestroy( iapbearerid );        
+        CleanupStack::PopAndDestroy( lanserviceid );
+        CleanupStack::PopAndDestroy( laniapid );
+        }
+
+    CleanupStack::PopAndDestroy( lant );
+    CLOG( ( ESelect, 1, _L( "<- CApSelect::AddLanL" ) ) );
+    }
+
+
+// ---------------------------------------------------------
+// CApSelect::GetSupportedBearerSet
+// ---------------------------------------------------------
+//
+TInt CApSelect::GetSupportedBearerSet( TInt aBearerFilter )
+    {
+    TInt retval = aBearerFilter;
+
+    TBool isCsdSupported = 
+          FeatureManager::FeatureSupported( KFeatureIdAppCsdSupport );
+#ifdef __TEST_CSD_SUPPORT
+    isCsdSupported = ETrue;
+#endif // __TEST_CSD_SUPPORT
+
+
+#ifdef __TEST_USE_SHARED_DATA
+    TInt isHscsdSupported = ETrue;
+        /*
+        ApCommons::IsGivenSharedDataSupportL( KGeneralSettingsUid, 
+                                              KGSHSCSDAccessPoints );
+                                             */
+#else
+    TInt isHscsdSupported = ETrue;
+#endif // __TEST_USE_SHARED_DATA
+
+#ifdef __TEST_HSCSD_SUPPORT
+    isHscsdSupported = ETrue;
+#endif // __TEST_HSCSD_SUPPORT
+
+    if ( !isCsdSupported )
+        { // remove CSD, HSCSD, do not allow ALL
+        if ( aBearerFilter & EApBearerTypeAll )
+            {
+            retval &= ~EApBearerTypeCSD;
+            retval &= ~EApBearerTypeHSCSD;            
+            }
+        else
+            {
+            if ( aBearerFilter & EApBearerTypeCSD )
+                {
+                retval &= ~EApBearerTypeCSD;
+                }
+            if ( aBearerFilter & EApBearerTypeHSCSD )
+                {
+                retval &= ~EApBearerTypeHSCSD;
+                }
+            }
+        }
+
+    if ( !isHscsdSupported )
+        { // HSCSD
+        if ( ( aBearerFilter & EApBearerTypeAll )
+        	 || ( aBearerFilter & EApBearerTypeHSCSD ) )
+            {
+			retval &= ~EApBearerTypeHSCSD;
+            }
+        }
+    return retval;
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apeng/src/APUtils.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,1469 @@
+/*
+* Copyright (c) 2002 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 the class CApUtils
+*     Contains utility functions for access point handling
+*
+*/
+
+
+// INCLUDE FILES
+#include "APEngineVariant.hrh"
+
+#include "ApUtils.h"
+#include "ApAccessPointItem.h"
+#include "ApDataHandler.h"
+#include "ApEngineCommons.h"
+#include "ApEngineLogger.h"
+#include <e32des16.h>
+#include <es_sock.h>
+#include <es_enum.h>
+
+#include    <featmgr.h>
+
+#include <WlanCdbCols.h>
+
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// construct/destruct/copy
+// ---------------------------------------------------------
+// CApUtils::NewLC
+// ---------------------------------------------------------
+//
+EXPORT_C CApUtils* CApUtils::NewLC( CCommsDatabase& aDb )
+    {
+    CLOG( ( EUtil, 0, _L( "-> CApUtils::NewLC" ) ) );
+
+    CApUtils* db = new( ELeave ) CApUtils;
+    CleanupStack::PushL( db );
+    db->ConstructL( aDb );
+
+    CLOG( ( EUtil, 1, _L( "<- CApUtils::NewLC" ) ) );
+    return db;
+    }
+
+
+
+// Destructor
+// ---------------------------------------------------------
+// CApUtils::~CApUtils
+// ---------------------------------------------------------
+//
+EXPORT_C CApUtils::~CApUtils()
+    {
+    if ( iExt )
+        {
+        if ( iExt->iIsFeatureManagerInitialised )
+            {
+            FeatureManager::UnInitializeLib();
+            }
+        }    
+    delete iExt;
+    CLOG( ( EUtil, 0, _L( "<-> CApUtils::~CApUtils" ) ) );
+    }
+
+
+// C++ default constructor can NOT contain any code that
+// might leave.
+//
+// ---------------------------------------------------------
+// CApUtils::CApUtils
+// ---------------------------------------------------------
+//
+EXPORT_C CApUtils::CApUtils()
+    {
+    }
+
+
+// Symbian OS default constructor can leave.
+// ---------------------------------------------------------
+// CApUtils::ConstructL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApUtils::ConstructL( CCommsDatabase& aDb )
+    {
+    CLOG( ( EUtil, 0, _L( "-> CApUtils::ConstructL" ) ) );
+
+    iDb = &aDb;
+    iExt = new ( ELeave )TUtilsExtra;
+    
+    FeatureManager::InitializeLibL();
+    iExt->iIsFeatureManagerInitialised = ETrue;    
+
+    iExt->iVariant = ApCommons::GetVariantL();
+#ifdef __TEST_CDMA_WRITE_PROTECT
+    iExt->iVariant |= KApUiEditOnlyVPNs;
+#endif // __TEST_CDMA_WRITE_PROTECT
+
+    iExt->iWlanSupported = 
+        FeatureManager::FeatureSupported( KFeatureIdProtocolWlan );
+    
+    
+#ifdef __TEST_WLAN_SUPPORT
+    iExt->iWlanSupported = ETrue;
+#endif // __TEST_WLAN_SUPPORT
+    
+    CLOG( ( EUtil, 1, _L( "<- CApUtils::ConstructL" ) ) );
+    }
+
+
+
+
+
+// utilities
+
+// ---------------------------------------------------------
+// CApUtils::IsAPInUseL
+// ---------------------------------------------------------
+//
+EXPORT_C TBool CApUtils::IsAPInUseL( TUint32 aUid )
+    {
+    CLOG( ( EUtil, 0, _L( "-> CApUtils::IsAPInUseL" ) ) );
+
+
+
+    TBool retval( EFalse );
+#ifdef __WINS__
+    // just to satisfy compiler...
+    aUid++;
+#else // 
+    RSocketServ rs;
+    RConnection rc;
+
+    TUint32 iap( 0 );
+    TBool ownTransaction = ApCommons::StartPushedTransactionLC( *iDb, ETrue );
+    TRAP_IGNORE( iap = IapIdFromWapIdL( aUid ) );
+
+    User::LeaveIfError( rs.Connect() );    
+    User::LeaveIfError( rc.Open( rs ) );
+
+    TUint count( 0 );
+    User::LeaveIfError( rc.EnumerateConnections( count ) );
+    // Go on only if there is any
+    if ( count )
+        {
+        for( TUint i = 1; i <= count; i++)
+            {
+            TPckgBuf<TConnectionInfo> connInfo;
+            User::LeaveIfError( rc.GetConnectionInfo( i, connInfo ) );
+            if ( iap == connInfo().iIapId )
+                { 
+                // IAP is in use, break
+                retval = ETrue;
+                break;
+                }
+            }
+        }
+
+    rc.Close();
+    rs.Close();    
+
+    if ( ownTransaction )
+        {
+        ApCommons::CommitTransaction( *iDb );
+        CleanupStack::Pop(); // RollbackTransactionOnLeave
+        }
+#endif // __WINS__     
+
+    CLOG( ( EUtil, 1, _L( "<- CApUtils::IsAPInUseL" ) ) );
+    return ( retval );
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CApUtils::WapBearerTypeL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApUtils::WapBearerTypeL( TUint32 aUid, TDes& aBearer )
+    {
+    CLOG( ( EUtil, 0, _L( "-> CApUtils::WapBearerTypeL" ) ) );
+    
+    TBool ownTransaction = ApCommons::StartPushedTransactionLC( *iDb );
+
+    DoWapBearerTypeL( aUid, aBearer );
+
+    if ( ownTransaction )
+        {
+        ApCommons::CommitTransaction( *iDb );
+        CleanupStack::Pop(); // RollbackTransactionOnLeave
+        }
+
+    CLOG( ( EUtil, 1, _L( "<- CApUtils::WapBearerTypeL" ) ) );
+    }
+
+
+// ---------------------------------------------------------
+// CApUtils::BearerTypeL
+// ---------------------------------------------------------
+//
+EXPORT_C TApBearerType CApUtils::BearerTypeL( TUint32 aUid )
+    {
+    CLOG( ( EUtil, 0, _L( "-> CApUtils::BearerTypeL" ) ) );
+    
+    TBool ownTransaction = ApCommons::StartPushedTransactionLC( *iDb );
+    TApBearerType retval = EApBearerTypeAllBearers;
+    retval = DoBearerTypeL( aUid );
+    if ( ownTransaction )
+        {
+        ApCommons::CommitTransaction( *iDb );
+        CleanupStack::Pop(); // RollbackTransactionOnLeave
+        }
+
+    CLOG( ( EUtil, 1, _L( "<- CApUtils::BearerTypeL" ) ) );
+    return retval;
+    }
+
+
+// ---------------------------------------------------------
+// CApUtils::ISPTypeL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApUtils::ISPTypeL( TUint32 aUid, TCommsDbIspType& aIspType )
+    {
+    CLOG( ( EUtil, 0, _L( "-> CApUtils::ISPTypeL" ) ) );
+
+    TBool ownTransaction = ApCommons::StartPushedTransactionLC( *iDb );
+    DoISPTypeL( aUid, aIspType );
+    if ( ownTransaction )
+        {
+        ApCommons::CommitTransaction( *iDb );
+        CleanupStack::Pop(); // RollbackTransactionOnLeave
+        }
+
+    CLOG( ( EUtil, 1, _L( "<- CApUtils::ISPTypeL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApUtils::IsValidNameL
+// ---------------------------------------------------------
+//
+EXPORT_C TBool CApUtils::IsValidNameL( const TDesC& aNameText )
+    {
+    CLOG( ( EUtil, 0, _L( "<-> CApUtils::IsValidNameL" ) ) );
+    
+    return IsValidNameL( aNameText, 0 );
+    }
+
+
+// ---------------------------------------------------------
+// CApUtils::MakeValidName
+// ---------------------------------------------------------
+//
+EXPORT_C TBool CApUtils::MakeValidNameL( TDes& aNameText )
+    {
+    CLOG( ( EUtil, 0, _L( "-> CApUtils::MakeValidNameL" ) ) );
+   
+    TBool ownTransaction = ApCommons::StartPushedTransactionLC( *iDb );
+
+    HBufC* buf = HBufC::NewLC( KModifiableTextLength );
+    TPtr ptr( buf->Des() );
+    ptr.Copy( aNameText );
+    TBool nameChanged( EFalse );
+    HBufC* sgd = ApCommons::DoMakeValidNameL( *iDb,
+                                               nameChanged,
+                                               buf,
+                                               0,
+                                               EFalse );
+
+    if ( nameChanged )
+        {
+        aNameText.Copy( *sgd );
+        }
+    CleanupStack::PopAndDestroy( buf ); // buf
+    delete sgd;
+    if ( ownTransaction )
+        {
+        ApCommons::CommitTransaction( *iDb );
+        CleanupStack::Pop(); // RollbackTransactionOnLeave
+        }
+
+    CLOG( ( EUtil, 1, _L( "<- CApUtils::MakeValidNameL" ) ) );
+    return nameChanged;
+    }
+
+
+// ---------------------------------------------------------
+// CApUtils::NameL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApUtils::NameL( TUint32 aUid, TDes& aName )
+    {
+    CLOG( ( EUtil, 0, _L( "-> CApUtils::NameL" ) ) );
+
+    TBool ownTransaction = ApCommons::StartPushedTransactionLC( *iDb );
+    DoNameL( aUid, aName );
+    if ( ownTransaction )
+        {
+        ApCommons::CommitTransaction( *iDb );
+        CleanupStack::Pop(); // RollbackTransactionOnLeave
+        }
+
+    CLOG( ( EUtil, 1, _L( "<- CApUtils::NameL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApUtils::SetNameL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApUtils::SetNameL( TDes& aName, TUint32 aUid )
+    {
+    CLOG( ( EUtil, 0, _L( "-> CApUtils::SetNameL" ) ) );
+
+    if ( iExt->iVariant & KApUiEditOnlyVPNs )
+        {
+        User::Leave( KErrNotSupported );
+        }
+
+    TBool ownTransaction = ApCommons::StartPushedTransactionLC( *iDb );
+    DoSetNameL( aName, aUid );
+    if ( ownTransaction )
+        {
+        ApCommons::CommitTransaction( *iDb );
+        CleanupStack::Pop(); // RollbackTransactionOnLeave
+        }
+
+    CLOG( ( EUtil, 1, _L( "<- CApUtils::SetNameL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApUtils::SetISPTypeL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApUtils::SetISPTypeL( TUint32 aUid, TCommsDbIspType aIspType )
+    {
+    CLOG( ( EUtil, 0, _L( "-> CApUtils::SetISPTypeL" ) ) );
+
+    if ( iExt->iVariant & KApUiEditOnlyVPNs )
+        {
+        User::Leave( KErrNotSupported );
+        }
+    
+    TBool ownTransaction = ApCommons::StartPushedTransactionLC( *iDb );
+    DoSetISPTypeL( aUid, aIspType );
+    if ( ownTransaction )
+        {
+        ApCommons::CommitTransaction( *iDb );
+        CleanupStack::Pop(); // RollbackTransactionOnLeave
+        }
+
+    CLOG( ( EUtil, 1, _L( "<- CApUtils::SetISPTypeL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApUtils::IapIdFromWapIdL
+// ---------------------------------------------------------
+//
+EXPORT_C TUint32 CApUtils::IapIdFromWapIdL( TUint32 aUid )
+    {
+    CLOG( ( EUtil, 0, _L( "-> CApUtils::IapIdFromWapIdL" ) ) );
+    
+    TBool ownTransaction = ApCommons::StartPushedTransactionLC( *iDb );
+    TUint32 retval( 0 );
+
+    CCommsDbTableView* wapt;
+    wapt = iDb->OpenViewMatchingUintLC( TPtrC(WAP_ACCESS_POINT),
+                                       TPtrC(COMMDB_ID), aUid );
+    User::LeaveIfError( wapt->GotoFirstRecord() );
+
+    HBufC* wapBearer = ApCommons::ReadText16ValueLC
+                                                (
+                                                wapt,
+                                                TPtrC(WAP_CURRENT_BEARER)
+                                                );
+
+    if ( *wapBearer == TPtrC(WAP_IP_BEARER) )
+        {
+        CCommsDbTableView* bearert;
+        bearert = iDb->OpenViewMatchingUintLC( TPtrC(*wapBearer),
+                                            TPtrC(WAP_ACCESS_POINT_ID), aUid );
+        User::LeaveIfError( bearert->GotoFirstRecord() );
+        ApCommons::ReadUintL( bearert, TPtrC(WAP_IAP), retval );
+        CleanupStack::PopAndDestroy( bearert ); // bearert
+        }
+    else
+        {
+        User::Leave( KErrInvalidBearerType );
+        }
+    CleanupStack::PopAndDestroy( 2, wapt ); // wapBearer, wapt
+    if ( ownTransaction )
+        {
+        ApCommons::CommitTransaction( *iDb );
+        CleanupStack::Pop(); // RollbackTransactionOnLeave
+        }
+
+    CLOG( ( EUtil, 1, _L( "<- CApUtils::IapIdFromWapIdL" ) ) );
+    return retval;
+    }
+
+
+// ---------------------------------------------------------
+// CApUtils::WapIdFromIapIdL
+// ---------------------------------------------------------
+//
+EXPORT_C TUint32 CApUtils::WapIdFromIapIdL( TUint32 aUid )
+    {
+    CLOG( ( EUtil, 0, _L( "-> CApUtils::WapIdFromIapIdL" ) ) );
+
+    TBool ownTransaction = ApCommons::StartPushedTransactionLC( *iDb );
+    TUint32 retval( 0 );
+
+    CCommsDbTableView* bearert;
+    bearert = iDb->OpenViewMatchingUintLC( TPtrC(WAP_IP_BEARER),
+                                          TPtrC(WAP_IAP), aUid );
+    User::LeaveIfError( bearert->GotoFirstRecord() );
+    ApCommons::ReadUintL( bearert, TPtrC(WAP_ACCESS_POINT_ID), retval );
+    CleanupStack::PopAndDestroy( bearert ); // bearert
+
+    if ( ownTransaction )
+        {
+        ApCommons::CommitTransaction( *iDb );
+        CleanupStack::Pop(); // RollbackTransactionOnLeave
+        }
+
+    CLOG( ( EUtil, 1, _L( "<- CApUtils::WapIdFromIapIdL" ) ) );
+    return retval;
+    }
+
+
+// ---------------------------------------------------------
+// CApUtils::HasMandatoryFieldsFilledL
+// ---------------------------------------------------------
+//
+EXPORT_C TBool CApUtils::HasMandatoryFieldsFilledL( TUint32 aUid )
+    {
+    CLOG( ( EUtil, 0, _L( "-> CApUtils::HasMandatoryFieldsFilledL" ) ) );
+
+    TBool retval( EFalse );
+    TBool isOwn = ApCommons::StartPushedTransactionLC( *iDb );
+    retval= DoHasMandatoryFieldsFilledL( aUid );
+    if ( isOwn )
+        {
+        ApCommons::CommitTransaction( *iDb );
+        CleanupStack::Pop(); // RollbackTransactionOnLeave
+        }
+
+    CLOG( ( EUtil, 1, _L( "<- CApUtils::HasMandatoryFieldsFilledL" ) ) );
+    return retval;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApUtils::IAPExistsL
+// ---------------------------------------------------------
+//
+EXPORT_C TBool CApUtils::IAPExistsL( TUint32 aUid )
+    {
+    CLOG( ( EUtil, 0, _L( "<-> CApUtils::IAPExistsL" ) ) );
+
+    return DoesExistsL( TPtrC( IAP ), aUid );
+    }
+
+
+// ---------------------------------------------------------
+// CApUtils::WapApExistsL
+// ---------------------------------------------------------
+//
+EXPORT_C TBool CApUtils::WapApExistsL( TUint32 aUid )
+    {
+    CLOG( ( EUtil, 0, _L( "<-> CApUtils::WapApExistsL" ) ) );
+
+    return DoesExistsL( TPtrC( WAP_ACCESS_POINT ), aUid );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApUtils::DoHasMandatoryFieldsFilledL
+// ---------------------------------------------------------
+//
+EXPORT_C TBool CApUtils::DoHasMandatoryFieldsFilledL(
+                                                  TUint32 aUid,
+                                                  CCommsDbTableView* aWapt,
+                                                  TApBearerType aBearertype )
+    {
+    CLOG( ( EUtil, 0, _L( "-> CApUtils::DoHasMandatoryFieldsFilledL" ) ) );
+    
+    TBool retval( EFalse );
+    TInt need2pop( 0 );
+    // if not contains, retval = False...
+    // Mandatory WAP settings are:
+    // CSD: StartPage, GatewayAddr
+    // Note: SMS bearer had been dropped.
+    // SMS: ServerNumber, ServiceNumber
+    // Gprs: StartPage, GatewayAddr
+    // Cdma: StartPage, GatewayAddr
+    // Start with CSD/GPRS:
+
+    if ( aBearertype == EApBearerTypeAllBearers )
+        {
+        aBearertype = BearerTypeL( aUid );
+        }
+    if ( aBearertype == EApBearerTypeAllBearers )
+        {
+        User::Leave( KErrInvalidBearerType );
+        }
+
+    if ( !aWapt )
+        {
+        aWapt = iDb->OpenViewMatchingUintLC( TPtrC(WAP_ACCESS_POINT ),
+                                             TPtrC( COMMDB_ID ), aUid );
+        need2pop++;
+        TInt res = aWapt->GotoFirstRecord();
+        if ( res != KErrNone )
+            {
+            aWapt = NULL;
+            User::Leave( res );
+            }
+        }
+    switch ( aBearertype )
+        {
+        case EApBearerTypeCSD:
+        case EApBearerTypeHSCSD:
+        case EApBearerTypeGPRS:
+        case EApBearerTypeCDMA:
+            {
+            TInt aLength( 0 );
+            aWapt->ReadColumnLengthL( TPtrC(WAP_START_PAGE), aLength );
+            if ( aLength )
+                {
+                CCommsDbTableView* bearert = iDb->OpenViewMatchingUintLC(
+                                                TPtrC(WAP_IP_BEARER),
+                                                TPtrC(WAP_ACCESS_POINT_ID),
+                                                aUid );
+                User::LeaveIfError( bearert->GotoFirstRecord() );
+                bearert->ReadColumnLengthL( TPtrC(WAP_GATEWAY_ADDRESS),
+                                            aLength );
+                if ( aLength )
+                    {
+                    HBufC* txtbuf = HBufC::NewLC( aLength );
+                    TPtr16 txt = txtbuf->Des();
+                    bearert->ReadTextL( TPtrC(WAP_GATEWAY_ADDRESS), txt );
+                    if ( txt.Compare( KDynIpAddress ) )
+                        {
+                        retval = ETrue;
+                        }
+                    }
+                CleanupStack::PopAndDestroy( 2, bearert ); // txtbuf,bearert
+                }
+            break;
+            }
+        default:
+            {
+            User::Leave( KErrInvalidBearerType );
+            break;
+            }
+        }
+    if ( need2pop )
+        {
+        CleanupStack::PopAndDestroy( need2pop );
+        }
+
+    CLOG( ( EUtil, 1, _L( "<- CApUtils::DoHasMandatoryFieldsFilledL" ) ) );
+    return retval;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApUtils::IsValidNameL
+// ---------------------------------------------------------
+//
+EXPORT_C TBool CApUtils::IsValidNameL( const TDesC& aNameText,
+                                       TUint32 aAcceptUid )
+    {
+    CLOG( ( EUtil, 0, _L( "-> CApUtils::IsValidNameL" ) ) );
+
+    // Valid name: it means the name of the Connection,
+    // that is the COMMDB_NAME in WAP_ACCESS_POINT table
+    //
+    TBool ret( ETrue ) ;
+    TBool ownTransaction = ApCommons::StartPushedTransactionLC( *iDb, ETrue );
+
+    HBufC* esc = ApCommons::EscapeTextLC( aNameText );
+    CCommsDbTableView* wapt;
+    wapt = iDb->OpenViewMatchingTextLC( TPtrC(WAP_ACCESS_POINT), 
+                                        TPtrC(COMMDB_NAME), 
+                                        *esc );
+
+    TInt res;
+    res = wapt->GotoFirstRecord(); // OK
+    do
+        {
+        if ( res == KErrNone )
+            {
+            // Check UID
+            TUint32 arecid;
+            ApCommons::ReadUintL( wapt, TPtrC(COMMDB_ID), arecid);
+            if ( arecid != aAcceptUid )
+                {
+                // some other record is already using this name,
+                // need to change it
+                ret = EFalse;
+                }
+            }
+        else
+            {
+            if ( res == KErrNotFound )
+                {
+                ret = ETrue;
+                }
+            else
+                {
+                User::Leave( res );
+                }
+            }
+        if ( ret && ( res == KErrNone ) )
+            {
+            res = wapt->GotoNextRecord();
+            }
+        }while ( ( res == KErrNone ) && ( ret ) );
+
+    CleanupStack::PopAndDestroy( wapt ); // wapt
+    CleanupStack::PopAndDestroy( esc ); // esc
+
+    if ( ownTransaction )
+        {
+        ApCommons::CommitTransaction( *iDb );
+        CleanupStack::Pop(); // RollbackTransactionOnLeave
+        }
+
+    CLOG( ( EUtil, 1, _L( "<- CApUtils::IsValidNameL" ) ) );
+    return ret;
+    }
+
+
+// ---------------------------------------------------------
+// CApUtils::IsReadOnlyL
+// ---------------------------------------------------------
+//
+EXPORT_C TBool CApUtils::IsReadOnlyL( TUint32 aUid )
+    {
+    CLOG( ( EUtil, 0, _L( "-> CApUtils::IsReadOnlyL" ) ) );
+    
+    TBool retval( EFalse );
+    TBool ownTransaction = ApCommons::StartPushedTransactionLC( *iDb, ETrue );
+    CCommsDbTableView* wapt;
+    wapt = iDb->OpenViewMatchingUintLC( TPtrC(WAP_ACCESS_POINT),
+                                       TPtrC(COMMDB_ID), aUid );
+    User::LeaveIfError( wapt->GotoFirstRecord() );
+    retval = ApCommons::DoGetReadOnlyL( *wapt );
+    CleanupStack::PopAndDestroy( wapt ); // wapt
+    if ( ownTransaction )
+        {
+        ApCommons::CommitTransaction( *iDb );
+        CleanupStack::Pop(); // RollbackTransactionOnLeave
+        }
+
+    CLOG( ( EUtil, 1, _L( "<- CApUtils::IsReadOnlyL" ) ) );
+    return retval;
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CApUtils::IsWlanL
+// ---------------------------------------------------------
+//
+TBool CApUtils::IsWlanL( TUint32 aLanCommdbId )
+    {
+    CLOG( ( EUtil, 0, _L( "-> CApUtils::IsWlanL" ) ) );
+    
+    TBool retval( EFalse );
+    TRAPD( err, retval = DoIsWlanL( aLanCommdbId ) );
+    
+    if ( err == KErrNotFound )
+        {
+        retval = EFalse;
+        }
+    else
+        {
+        User::LeaveIfError( err );
+        }
+    
+    CLOG( ( EUtil, 1, _L( "<- CApUtils::IsWlanL" ) ) );
+    return retval;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApUtils::HasWlanSSIDL
+// ---------------------------------------------------------
+//
+TBool CApUtils::HasWlanSSIDL( TUint32 aLanCommdbId )
+    {
+    CLOG( ( EUtil, 0, _L( "-> CApUtils::HasWlanSSIDL" ) ) );
+    
+    TBool retval( EFalse );
+    CCommsDbTableView* wlantable = NULL;
+
+    // WLAN settings table backlinks to LAN service, 
+    // so we query WLAN settings for a record 
+    // where WLAN_SERVICE_ID is LAN_SERVICE's COMMDB_ID, 
+    // which is aApItem.iIapServiceId...
+    wlantable = iDb->OpenViewMatchingUintLC( TPtrC(WLAN_SERVICE),
+                                             TPtrC(WLAN_SERVICE_ID),
+                                             aLanCommdbId );
+    TInt err = wlantable->GotoFirstRecord();
+    if ( err == KErrNotFound )
+        {
+        retval = EFalse;
+        }
+    else
+        {
+        User::LeaveIfError( err );
+        HBufC* wlanssid = ApCommons::ReadText16ValueLC
+                            ( wlantable, TPtrC(NU_WLAN_SSID) );
+        if ( wlanssid->Compare( KEmpty ) != 0 )
+            {            
+            retval = ETrue;
+            }
+        CleanupStack::PopAndDestroy( wlanssid );
+        }
+    CleanupStack::PopAndDestroy( wlantable );
+    
+    CLOG( ( EUtil, 1, _L( "<- CApUtils::HasWlanSSIDL" ) ) );
+    return retval;
+    }
+
+
+// ==== OTHER PRIVATE/protected, NON-EXPORTED FUNCTIONS ====
+
+// ---------------------------------------------------------
+// CApUtils::DoWapBearerTypeL
+// ---------------------------------------------------------
+//
+void CApUtils::DoWapBearerTypeL( TUint32 aUid, TDes& aBearer )
+    {
+    CLOG( ( EUtil, 0, _L( "-> CApUtils::DoWapBearerTypeL" ) ) );
+    
+    CCommsDbTableView* wapt;
+    wapt = iDb->OpenViewMatchingUintLC( TPtrC(WAP_ACCESS_POINT),
+                                       TPtrC(COMMDB_ID), aUid );
+    User::LeaveIfError( wapt->GotoFirstRecord() );
+    HBufC* wapBearer = ApCommons::ReadText16ValueLC
+                                            (
+                                            wapt,
+                                            TPtrC(WAP_CURRENT_BEARER)
+                                            );
+    if ( aBearer.MaxLength() < wapBearer->Length() )
+        {
+        User::Leave( KErrDescOverflow );
+        }
+    else
+        {
+        aBearer.SetLength( wapBearer->Length() );
+        aBearer.Format( KFormat, &*wapBearer );
+        }
+    CleanupStack::PopAndDestroy( 2, wapt );   // wapBearer, wapt
+
+    CLOG( ( EUtil, 1, _L( "<- CApUtils::DoWapBearerTypeL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApUtils::DoBearerTypeL
+// ---------------------------------------------------------
+//
+TApBearerType CApUtils::DoBearerTypeL( TUint32 aUid )
+    {
+    CLOG( ( EUtil, 0, _L( "-> CApUtils::DoBearerTypeL" ) ) );
+    
+    TApBearerType retval = EApBearerTypeAllBearers;
+
+    CCommsDbTableView* wapt;
+    wapt = iDb->OpenViewMatchingUintLC( TPtrC(WAP_ACCESS_POINT), 
+                                        TPtrC(COMMDB_ID), 
+                                        aUid );
+    
+    // TRAPped for some record that doesn't have a WAP -table. 
+    // If KErrNotFound, then just return EApBearerTypeWLAN
+    TInt wapErr = wapt->GotoFirstRecord();
+    if ( wapErr == KErrNotFound )
+        {
+        CleanupStack::PopAndDestroy( wapt );
+        return EApBearerTypeWLAN;
+        }
+    else
+    	{
+    	User::LeaveIfError( wapErr );
+    	}
+    
+    HBufC* wapBearer = ApCommons::ReadText16ValueLC
+                                            (
+                                            wapt,
+                                            TPtrC(WAP_CURRENT_BEARER)
+                                            );
+
+    CCommsDbTableView* bearert = iDb->OpenViewMatchingUintLC( *wapBearer,
+                                          TPtrC(WAP_ACCESS_POINT_ID), aUid );
+
+    User::LeaveIfError( bearert->GotoFirstRecord() );
+    // decide which bearer, read bearer spec. data.
+    if ( *wapBearer == TPtrC(WAP_IP_BEARER) )
+        {
+        TUint32 wapIap;
+        ApCommons::ReadUintL( bearert, TPtrC(WAP_IAP), wapIap );
+
+        CCommsDbTableView* iapt = iDb->OpenViewMatchingUintLC( TPtrC(IAP),
+                                               TPtrC(COMMDB_ID), wapIap );
+
+        User::LeaveIfError( iapt->GotoFirstRecord() );
+        HBufC* aIapServiceType = ApCommons::ReadText16ValueLC
+                                        (
+                                        iapt,
+                                        TPtrC(IAP_SERVICE_TYPE)
+                                        );
+        if ( ( *aIapServiceType == TPtrC(DIAL_OUT_ISP) ) ||
+             ( *aIapServiceType == TPtrC(DIAL_IN_ISP) ) )
+            {
+            // need to get 'speed' data ( HS or normal CSD )
+            TUint32 wapIsp;
+            ApCommons::ReadUintL( iapt, TPtrC(IAP_SERVICE), wapIsp );
+            CCommsDbTableView* ispt = iDb->OpenViewMatchingUintLC(
+                                            *aIapServiceType,
+                                            TPtrC(COMMDB_ID),
+                                            wapIsp );
+            User::LeaveIfError( ispt->GotoFirstRecord() );
+            TUint32 bear;
+            if ( ApCommons::ReadUintL( ispt, TPtrC(ISP_BEARER_TYPE), bear )
+                                  == KErrUnknown )
+                {
+                bear = EBearerTypeCSD;
+                }
+            if ( bear == EBearerTypeCSD )
+                {
+                retval = EApBearerTypeCSD;
+                }
+            else
+                {
+                if ( bear == EBearerTypeHSCSD )
+                    {
+                    retval = EApBearerTypeHSCSD;
+                    }
+                else
+                    {
+                    User::Leave( KErrInvalidBearer );
+                    }
+                }
+            CleanupStack::PopAndDestroy( ispt ); // ispt
+            }
+        else
+            {
+            if ( ( *aIapServiceType == TPtrC(OUTGOING_WCDMA) ) ||
+                 ( *aIapServiceType == TPtrC(INCOMING_WCDMA) ) )
+                {
+                retval = EApBearerTypeGPRS;
+                }
+            else
+                { // some other bearer, currently it might be VPN or WLAN
+                if ( *aIapServiceType == TPtrC(VPN_SERVICE) ) 
+                    { // Get real VPN bearertype...
+                    TUint32 service;
+                    ApCommons::ReadUintL( iapt, TPtrC(IAP_SERVICE), service );
+
+                    CCommsDbTableView* ispt;
+                    ispt = iDb->OpenViewMatchingUintLC( TPtrC(VPN_SERVICE),
+                                                        TPtrC(COMMDB_ID), 
+                                                        service );
+                    User::LeaveIfError( ispt->GotoFirstRecord() );
+                    TUint32 tempint;
+                    HBufC* buf = NULL;
+                    // get the real iap
+                    ApCommons::ReadUintL( ispt, 
+                                          TPtrC(VPN_SERVICE_IAP), 
+                                          tempint );
+
+                    // now open the real IAP an get it's bearer...
+                    CCommsDbTableView* iapt2 = NULL;
+                    iapt2 = iDb->OpenViewMatchingUintLC( TPtrC(IAP),
+                                                         TPtrC(COMMDB_ID), 
+                                                         tempint );                                                         
+                    User::LeaveIfError( iapt2->GotoFirstRecord() );
+
+                    buf = ApCommons::ReadText16ValueLC( iapt2, 
+                                                 TPtrC(IAP_SERVICE_TYPE) );
+                    TUint32 service2;
+                    ApCommons::ReadUintL( iapt2, TPtrC(IAP_SERVICE), 
+                                          service2 );
+
+                    if ( ( buf->Compare( TPtrC(OUTGOING_WCDMA ) ) == 0 ) ||
+                        ( buf->Compare( TPtrC(INCOMING_WCDMA ) ) == 0 ) )
+                        {
+                        retval = EApBearerTypeGPRS;
+                        }
+                    else
+                        {
+                        if ( ( buf->Compare( TPtrC(DIAL_OUT_ISP ) ) == 0 ) ||
+                            ( buf->Compare( TPtrC(DIAL_IN_ISP ) ) == 0 ) )
+                            {
+                            // need to get ISP,
+                            CCommsDbTableView* doutt = NULL;
+                            doutt = iDb->OpenViewMatchingUintLC( 
+                                            *buf,
+                                            TPtrC(COMMDB_ID), 
+                                            service2 );
+                                            
+                            User::LeaveIfError( doutt ->GotoFirstRecord() );
+                            ApCommons::ReadUintL( doutt , 
+                                                  TPtrC(ISP_BEARER_TYPE), 
+                                                  tempint );
+                            if ( tempint == EBearerTypeCSD )
+                                {
+                                retval  = EApBearerTypeCSD;
+                                }
+                            else
+                                {
+                                retval = EApBearerTypeHSCSD;
+                                }
+                            CleanupStack::PopAndDestroy( doutt ); // doutt
+                            }
+                        else
+                            { 
+                            // VPN, having a bearer something 
+                            // else than CSD, HSCSD & GPRS?
+                            // check for WLAN
+                            if ( iExt->iWlanSupported )
+                                {
+                                if ( buf->Compare( TPtrC(LAN_SERVICE) ) == 0 )
+                                    { // LAN or WLAN
+                                    if ( IsWlanL( service2 ) )
+                                        {
+                                        retval = EApBearerTypeWLAN;
+                                        }
+                                    else
+                                        {
+                                        User::Leave( KErrInvalidBearer );
+                                        }
+                                    }
+                                else
+                                    {
+                                    User::Leave( KErrInvalidBearer );
+                                    }
+                                }
+                            else
+                                {
+                                User::Leave( KErrInvalidBearer );
+                                }
+                            }
+                        }
+                    CleanupStack::PopAndDestroy( 3, ispt ); // buf, iapt2, ispt
+                    }
+                else
+                    { // other, but not VPN, check for WLAN
+                    if ( iExt->iWlanSupported )
+                        {
+                        if ( *aIapServiceType == TPtrC(LAN_SERVICE) ) 
+                            { // check existence...
+                            TUint32 service;
+                            TUint32 bearer;
+                            ApCommons::ReadUintL( iapt, TPtrC(IAP_SERVICE), 
+                                                  service );
+                            ApCommons::ReadUintL( iapt, TPtrC(IAP_BEARER), 
+                                                  bearer );
+
+
+                            CCommsDbTableView* ispt;
+                            ispt = iDb->OpenViewMatchingUintLC( 
+                                                    TPtrC(LAN_SERVICE),
+                                                    TPtrC(COMMDB_ID), 
+                                                    service );
+                            User::LeaveIfError( ispt->GotoFirstRecord() );
+                            // now we know it is either WLAN or some kinda LAN
+                            if ( IsWlanL( service ) )
+                                {
+                                retval = EApBearerTypeWLAN;
+                                }
+                            else
+                                { // other, 
+                                // check for LANModem first, then for LAN
+                                CCommsDbTableView* lanbearer;
+                                lanbearer = 
+                                    iDb->OpenViewMatchingUintLC( 
+                                                TPtrC(LAN_BEARER),
+                                                TPtrC(COMMDB_ID), 
+                                                bearer );
+                                User::LeaveIfError( 
+                                        lanbearer->GotoFirstRecord() );
+                                // LANMODEM? check commdb_name
+                                HBufC* lbuf;
+                                lbuf = ApCommons::ReadText16ValueLC( lanbearer,
+                                                         TPtrC(COMMDB_NAME) );
+                                // if it is KModemBearerLANModem, 
+                                // it is LANModem
+                                if ( *lbuf == KModemBearerLANModem )
+                                    {
+                                    retval = EApBearerTypeLANModem;
+                                    }
+                                else
+                                    {
+    #ifdef __TEST_LAN_BEARER
+                                    // LAN?
+                                    if ( *lbuf == KModemBearerLAN )
+                                        {                                
+                                        retval = EApBearerTypeLAN;
+                                        }
+                                    else
+                                        {
+                                        // other, but not VPN, or not supported
+                                        User::Leave( KErrInvalidBearer );
+                                        }
+    #else
+                                // other, but not VPN, or not supported
+                                User::Leave( KErrInvalidBearer );
+    #endif // __TEST_LAN_BEARER           
+                                    }
+                                CleanupStack::PopAndDestroy( lbuf );
+                                CleanupStack::PopAndDestroy( lanbearer );
+                                }
+                            CleanupStack::PopAndDestroy( ispt );
+                            }
+                        }
+                    else
+                        {                        
+    #ifdef __TEST_LAN_BEARER
+                        if ( *aIapServiceType == TPtrC(LAN_SERVICE) ) 
+                            { // check existence...
+                            TUint32 service;
+                            TUint32 bearer;
+                            ApCommons::ReadUintL( iapt, TPtrC(IAP_SERVICE), 
+                                                  service );
+                            ApCommons::ReadUintL( iapt, TPtrC(IAP_BEARER), 
+                                                  bearer );
+
+                            CCommsDbTableView* ispt;
+                            ispt = iDb->OpenViewMatchingUintLC( 
+                                                    TPtrC(LAN_SERVICE),
+                                                    TPtrC(COMMDB_ID), 
+                                                    service );
+                            User::LeaveIfError( ispt->GotoFirstRecord() );
+                            // now we know it is some kinda LAN
+                            // check for LANModem first, then for LAN
+                            CCommsDbTableView* lanbearer;
+                            lanbearer = 
+                                iDb->OpenViewMatchingUintLC( 
+                                            TPtrC(LAN_BEARER),
+                                            TPtrC(COMMDB_ID), 
+                                            bearer );
+                            User::LeaveIfError( 
+                                    lanbearer->GotoFirstRecord() );
+                            // LANMODEM? check commdb_name
+                            HBufC* lbuf;
+                            lbuf = ApCommons::ReadText16ValueLC( lanbearer,
+                                                         TPtrC(COMMDB_NAME) );
+                            // if it is KModemBearerLANModem, it is LANModem
+                            if ( *lbuf == KModemBearerLANModem )
+                                {
+                                retval = EApBearerTypeLANModem;
+                                }
+                            else
+                                {
+                                // LAN?
+                                if ( *lbuf == KModemBearerLANModem )
+                                    {                                
+                                    retval = EApBearerTypeLAN;
+                                    }
+                                else
+                                    {
+                                    // other, but not VPN, or not supported
+                                    User::Leave( KErrInvalidBearer );
+                                    }
+                                }
+                            CleanupStack::PopAndDestroy( lbuf );
+                            CleanupStack::PopAndDestroy( lanbearer );
+                            CleanupStack::PopAndDestroy( ispt );
+                            }
+                        else
+                            {// other, but not LAN
+                            User::Leave( KErrInvalidBearer );
+                            }
+    #endif // __TEST_LAN_BEARER 
+                        }
+                    }
+                }
+            }
+        CleanupStack::PopAndDestroy( 2, iapt );// aIapServiceType, iapt
+        }
+    else
+        {
+        User::Leave( KErrInvalidBearer );
+        }
+
+    CleanupStack::PopAndDestroy( bearert ); // bearert
+    CleanupStack::Pop( wapBearer );    // wapBearer,
+    // cannot PopAndDestroy because it has been re-allocated !
+    delete wapBearer;
+    CleanupStack::PopAndDestroy( wapt );    // wapt
+
+    if ( retval == EApBearerTypeAllBearers )
+        {
+        User::Leave( KErrInvalidBearer );
+        }
+
+    CLOG( ( EUtil, 1, _L( "<- CApUtils::DoBearerTypeL" ) ) );
+    return retval;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApUtils::DoISPTypeL
+// ---------------------------------------------------------
+//
+void CApUtils::DoISPTypeL( TUint32 aUid, TCommsDbIspType& aIspType )
+    {
+    CLOG( ( EUtil, 0, _L( "-> CApUtils::DoISPTypeL" ) ) );
+    
+    TCommsDbIspType retval = EIspTypeInternetAndWAP;
+
+    CCommsDbTableView* wapt;
+    wapt = iDb->OpenViewMatchingUintLC( TPtrC(WAP_ACCESS_POINT), 
+                                        TPtrC(COMMDB_ID), 
+                                        aUid );
+
+    User::LeaveIfError( wapt->GotoFirstRecord() );
+    HBufC* wapBearer = ApCommons::ReadText16ValueLC
+                                        (
+                                        wapt,
+                                        TPtrC(WAP_CURRENT_BEARER)
+                                        );
+
+    if ( *wapBearer == TPtrC(WAP_IP_BEARER) )
+        {
+        CCommsDbTableView* bearert;
+        bearert = iDb->OpenViewMatchingUintLC( TPtrC(*wapBearer), 
+                                               TPtrC(WAP_ACCESS_POINT_ID), 
+                                               aUid );
+
+        User::LeaveIfError( bearert->GotoFirstRecord() );
+        TUint32 aWapIap;
+        ApCommons::ReadUintL( bearert, TPtrC(WAP_IAP), aWapIap );
+        // now we have IAP uid, can go for Service type, ID
+
+        CCommsDbTableView* iapt;
+        iapt = iDb->OpenViewMatchingUintLC( TPtrC(IAP), 
+                                            TPtrC(COMMDB_ID), 
+                                            aWapIap );
+
+        User::LeaveIfError( iapt->GotoFirstRecord() );
+        HBufC* aIapServiceType = ApCommons::ReadText16ValueLC
+                                    (
+                                    iapt,
+                                    TPtrC(IAP_SERVICE_TYPE)
+                                    );
+        // decide which bearer, read bearer spec. data.
+        TUint32 aIsp;
+        ApCommons::ReadUintL( iapt, TPtrC(IAP_SERVICE), aIsp );
+
+        // No need to be defensive, if *aIapServiceType is invalid,
+        // it shall Leave,
+        // otherwise, we will handle the difference...
+        CCommsDbTableView* ispt = iDb->OpenViewMatchingUintLC(
+                                        *aIapServiceType,
+                                        TPtrC(COMMDB_ID), aIsp );
+        User::LeaveIfError( ispt->GotoFirstRecord() );
+        TUint32 sgd;
+        if ( ( *aIapServiceType == TPtrC(DIAL_OUT_ISP) ) ||
+             ( *aIapServiceType == TPtrC(DIAL_IN_ISP) ) )
+            { // get real IspType
+            ApCommons::ReadUintL( ispt, TPtrC(ISP_TYPE), sgd );
+            }
+        else
+            {
+            // OUTGOING_WCDMA/INCOMING_WCDMA
+            // read ISP type
+            ApCommons::ReadUintL( ispt, TPtrC(GPRS_AP_TYPE), sgd );
+            }
+        retval = TCommsDbIspType( sgd );
+        CleanupStack::PopAndDestroy( ispt ); // ispt
+        CleanupStack::Pop( aIapServiceType );// aIapServiceType,
+        // cannot PopAndDestroy because it has been re-allocated !
+        delete aIapServiceType;
+        CleanupStack::PopAndDestroy( 2, bearert ); // iapt, bearert
+        }
+    else
+        {
+        User::Leave( KErrInvalidBearer );
+        }
+
+    CleanupStack::Pop( wapBearer );    // wapBearer,
+    // cannot PopAndDestroy because it has been re-allocated !
+    delete wapBearer;
+    CleanupStack::PopAndDestroy( wapt );    // wapt
+    aIspType = retval;
+
+    CLOG( ( EUtil, 1, _L( "<- CApUtils::DoISPTypeL" ) ) );
+    }
+
+
+// ---------------------------------------------------------
+// CApUtils::DoNameL
+// ---------------------------------------------------------
+//
+void CApUtils::DoNameL( TUint32 aUid, TDes& aName )
+    {
+    CLOG( ( EUtil, 0, _L( "-> CApUtils::DoNameL" ) ) );
+
+    CCommsDbTableView* wapt = iDb->OpenViewMatchingUintLC(
+                                    TPtrC(WAP_ACCESS_POINT),
+                                    TPtrC(COMMDB_ID), aUid );
+    User::LeaveIfError( wapt->GotoFirstRecord() );
+    HBufC* sgd = ApCommons::ReadText16ValueLC( wapt, TPtrC(COMMDB_NAME) );
+
+    if ( aName.MaxLength() < sgd->Length()  )
+        {
+        User::Leave( KErrDescOverflow );
+        }
+    else
+        {
+        aName.SetLength( sgd->Length() );
+        aName.Format( KFormat, &*sgd );
+        }
+    CleanupStack::PopAndDestroy( 2, wapt );   //  sgd, wapt
+
+    CLOG( ( EUtil, 1, _L( "<- CApUtils::DoNameL" ) ) );
+    }
+
+
+// ---------------------------------------------------------
+// CApUtils::DoSetNameL
+// ---------------------------------------------------------
+//
+void CApUtils::DoSetNameL( TDes& aName, TUint32 aUid )
+    {
+    CLOG( ( EUtil, 0, _L( "-> CApUtils::DoSetNameL" ) ) );
+
+    if ( iExt->iVariant & KApUiEditOnlyVPNs )
+        {
+        User::Leave( KErrNotSupported );
+        }
+
+    CCommsDbTableView* wapt;
+
+    wapt = iDb->OpenViewMatchingUintLC( TPtrC(WAP_ACCESS_POINT),
+                                       TPtrC(COMMDB_ID), aUid );
+    User::LeaveIfError( wapt->GotoFirstRecord() );
+    HBufC* aCurrent = ApCommons::ReadText16ValueLC( wapt,
+                                                     TPtrC(COMMDB_NAME) );
+    if ( *aCurrent != aName )
+        {
+        TBool aNameChanged( EFalse );
+        HBufC* namebuf = aName.AllocL();
+        CleanupStack::PushL( namebuf );
+        HBufC* sgd = ApCommons::DoMakeValidNameL
+                                        (
+                                        *iDb,
+                                        aNameChanged,
+                                        namebuf,
+                                        aUid,
+                                        EFalse
+                                        );
+        if ( aNameChanged )
+            {
+            aName.Copy( *sgd );
+            delete sgd;
+            }
+        CleanupStack::PopAndDestroy( namebuf ); // namebuf
+        User::LeaveIfError( wapt->UpdateRecord() );
+        wapt->WriteTextL( TPtrC(COMMDB_NAME), aName );
+        User::LeaveIfError( wapt->PutRecordChanges() );
+        }
+    CleanupStack::PopAndDestroy( 2, wapt );   // aCurrent,wapt
+
+    CLOG( ( EUtil, 1, _L( "<- CApUtils::DoSetNameL" ) ) );
+    }
+
+
+// ---------------------------------------------------------
+// CApUtils::DoSetISPTypeL
+// ---------------------------------------------------------
+//
+void CApUtils::DoSetISPTypeL( TUint32 aUid, TCommsDbIspType aIspType )
+    {
+    CLOG( ( EUtil, 0, _L( "-> CApUtils::DoSetISPTypeL" ) ) );
+
+    if ( iExt->iVariant & KApUiEditOnlyVPNs )
+        {
+        User::Leave( KErrNotSupported );
+        }
+
+    // first check requested ISP-type validity
+    if ( ( aIspType == EIspTypeInternetOnly ) ||
+        ( aIspType == EIspTypeWAPOnly ) ||
+        ( aIspType == EIspTypeInternetAndWAP ) )
+        {
+        CCommsDbTableView* wapt;
+        wapt = iDb->OpenViewMatchingUintLC( TPtrC(WAP_ACCESS_POINT),
+                                           TPtrC(COMMDB_ID), aUid );
+        User::LeaveIfError( wapt->GotoFirstRecord() );
+        HBufC* wapBearer = ApCommons::ReadText16ValueLC
+                                            (
+                                            wapt,
+                                            TPtrC(WAP_CURRENT_BEARER)
+                                            );
+        if ( *wapBearer == TPtrC(WAP_IP_BEARER) )
+            {
+            CCommsDbTableView* bearert;
+            bearert = iDb->OpenViewMatchingUintLC(
+                            *wapBearer,
+                            TPtrC(WAP_ACCESS_POINT_ID), aUid );
+
+            User::LeaveIfError( bearert->GotoFirstRecord() );
+            TUint32 aWapIap;
+            ApCommons::ReadUintL( bearert, TPtrC(WAP_IAP), aWapIap );
+            // now we have IAP uid, can go for Service type, ID
+
+            CCommsDbTableView* iapt;
+            iapt = iDb->OpenViewMatchingUintLC( TPtrC(IAP),
+                                                TPtrC(COMMDB_ID),
+                                                aWapIap );
+            User::LeaveIfError( iapt->GotoFirstRecord() );
+
+            HBufC* aIapServiceType = ApCommons::ReadText16ValueLC
+                                            (
+                                            iapt,
+                                            TPtrC(IAP_SERVICE_TYPE)
+                                            );
+
+            // get ISP ID
+            TUint32 aIsp;
+            ApCommons::ReadUintL( iapt, TPtrC(IAP_SERVICE), aIsp );
+
+            CCommsDbTableView* ispt;
+            ispt = iDb->OpenViewMatchingUintLC( *aIapServiceType,
+                                                TPtrC(COMMDB_ID), aIsp );
+            User::LeaveIfError( ispt->GotoFirstRecord() );
+            // now we have it, just write:
+            User::LeaveIfError( ispt->UpdateRecord() );
+            // decide which bearer, write into bearer spec. column.
+            if ( ( *aIapServiceType == TPtrC(DIAL_OUT_ISP) ) ||
+                 ( *aIapServiceType == TPtrC(DIAL_IN_ISP) ) )
+                { // write real IspType
+                ispt->WriteUintL( TPtrC(ISP_TYPE), aIspType );
+                }
+            else
+                {
+                // OUTGOING_WCDMA / INCOMING_WCDMA
+                ispt->WriteUintL( TPtrC(GPRS_AP_TYPE), aIspType );
+                }
+            User::LeaveIfError( ispt->PutRecordChanges( EFalse, EFalse ) );
+            // ispt, aIapServiceType, iapt, bearert
+            CleanupStack::PopAndDestroy( 4, bearert );
+            }
+        else
+            {
+            User::Leave( KErrInvalidBearer );
+            }
+        CleanupStack::PopAndDestroy( 2, wapt );    // wapBearer, wapt
+        }
+    else
+        {
+        User::Leave( KErrInvalidIspRequest );
+        }
+
+    CLOG( ( EUtil, 1, _L( "<- CApUtils::DoSetISPTypeL" ) ) );
+    }
+
+
+// ---------------------------------------------------------
+// CApUtils::DoesExistsL
+// ---------------------------------------------------------
+//
+TBool CApUtils::DoesExistsL( TPtrC aTable, TUint32 aUid )
+    {
+    CLOG( ( EUtil, 0, _L( "-> CApUtils::DoesExistsL" ) ) );
+    
+    TBool retval( EFalse );
+    TBool ownTransaction = ApCommons::StartPushedTransactionLC( *iDb, ETrue );
+    CCommsDbTableView* table;
+    table = iDb->OpenViewMatchingUintLC( aTable,
+                                       TPtrC(COMMDB_ID), aUid );
+    TInt res = table->GotoFirstRecord();
+    CleanupStack::PopAndDestroy( table ); // table
+    if ( res == KErrNone )
+        {
+        retval = ETrue;
+        }
+    if ( res != KErrNotFound )
+        {
+        User::LeaveIfError( res );
+        }
+    if ( ownTransaction )
+        {
+        ApCommons::CommitTransaction( *iDb );
+        CleanupStack::Pop(); // RollbackTransactionOnLeave
+        }
+
+    CLOG( ( EUtil, 1, _L( "<- CApUtils::DoesExistsL" ) ) );
+    return retval;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApUtils::DoIsWlanL
+// ---------------------------------------------------------
+//
+TBool CApUtils::DoIsWlanL( TUint32 aLanCommdbId )
+    {
+    CLOG( ( EUtil, 1, _L( "-> CApUtils::DoIsWlanL" ) ) );
+    
+    TBool retval( EFalse );
+    
+    CCommsDbTableView* wlantable = NULL;
+
+    // WLAN settings table backlinks to LAN service, 
+    // so we query WLAN settings for a record 
+    // where WLAN_SERVICE_ID is LAN_SERVICE's COMMDB_ID, 
+    // which is aApItem.iIapServiceId...
+    wlantable = iDb->OpenViewMatchingUintLC( TPtrC(WLAN_SERVICE),
+                                             TPtrC(WLAN_SERVICE_ID),
+                                             aLanCommdbId );
+                                             
+    TInt err = wlantable->GotoFirstRecord();        
+    if ( err == KErrNotFound )
+        {
+        retval = EFalse;
+        }
+    else
+        {
+        User::LeaveIfError( err );
+        retval = ETrue;
+        }
+
+    CleanupStack::PopAndDestroy( wlantable );
+    
+    CLOG( ( EUtil, 1, _L( "<- CApUtils::DoIsWlanL" ) ) );
+    return retval;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apeng/src/ActiveApDb.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,229 @@
+/*
+* Copyright (c) 2002 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 CActiveApDb.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <ActiveApDb.h>
+#include "ActiveApDbNotifier.h"
+#include <ApEngineConsts.h>
+#include "ApEngineCommons.h"
+#include "ApEngineLogger.h"
+
+const TInt KObserverArrayGranularity = 1;
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CActiveApDb::NewL
+// ---------------------------------------------------------
+//
+EXPORT_C CActiveApDb* CActiveApDb::NewL( TCommDbDatabaseType /*aType*/ )
+    {
+    CLOG( ( EActiveDb, 0, _L( "-> CActiveApDb::NewL" ) ) );
+
+    CActiveApDb* db = new ( ELeave ) CActiveApDb;
+    CleanupStack::PushL( db );
+    db->ConstructL();
+    CleanupStack::Pop( db ); // db
+
+    CLOG( ( EActiveDb, 1, _L( "<- CActiveApDb::NewL" ) ) );
+    return db;
+    }
+
+// ---------------------------------------------------------
+// CActiveApDb::~CActiveApDb
+// ---------------------------------------------------------
+//
+EXPORT_C CActiveApDb::~CActiveApDb()
+    {
+    CLOG( ( EActiveDb, 0, _L( "-> CActiveApDb::~CActiveApDb" ) ) );
+
+    delete iDbNotifier;
+    delete iObservers;
+    delete iDb;
+
+    CLOG( ( EActiveDb, 1, _L( "<- CActiveApDb::~CActiveApDb" ) ) );
+    }
+
+
+// ---------------------------------------------------------
+// CActiveApDb::CActiveApDb
+// ---------------------------------------------------------
+//
+CActiveApDb::CActiveApDb()
+    {
+    }
+
+
+// ---------------------------------------------------------
+// CActiveApDb::ConstructL
+// ---------------------------------------------------------
+//
+void CActiveApDb::ConstructL()
+    {
+    iDb = CCommsDatabase::NewL( );
+    iObservers = new ( ELeave ) CArrayPtrFlat<MActiveApDbObserver>
+                        ( KObserverArrayGranularity );
+    iDbNotifier = new ( ELeave ) CActiveApDbNotifier( *this );
+
+    iState = EReady;
+    }
+
+
+// ---------------------------------------------------------
+// CActiveApDb::AddObserverL
+// ---------------------------------------------------------
+//
+EXPORT_C void CActiveApDb::AddObserverL( MActiveApDbObserver* anObserver )
+    {
+    CLOG( ( EActiveDb, 0, _L( "-> CActiveApDb::AddObserverL" ) ) );
+
+    if ( !anObserver )
+        {
+        User::Leave( KErrNullPointerPassed );
+        }
+    iObservers->AppendL( anObserver );
+    iDbNotifier->Start();
+
+    CLOG( ( EActiveDb, 1, _L( "<- CActiveApDb::AddObserverL" ) ) );
+    }
+
+
+// ---------------------------------------------------------
+// CActiveApDb::RemoveObserver
+// ---------------------------------------------------------
+//
+EXPORT_C void CActiveApDb::RemoveObserver( MActiveApDbObserver* anObserver )
+    {
+    CLOG( ( EActiveDb, 0, _L( "-> CActiveApDb::RemoveObserver" ) ) );
+
+    __ASSERT_DEBUG( anObserver, ApCommons::Panic( ENullPointer ) );
+    TInt count = iObservers->Count();
+    for ( TInt i = 0; i < count; i++ )
+        {
+        if ( iObservers->At( i ) == anObserver )
+            {
+            iObservers->Delete( i );
+            // leave cycle for faster processing, can not return because
+            // we may have to stop() if it was the last one...
+            break;
+            }
+        }
+    if ( !iObservers->Count() )
+        { // no more observers waiting so stop notification...
+        iDbNotifier->Stop();
+        }
+    // for some reason, observer was not found->
+    // Someone has already removed it
+    // simply ignore it
+    CLOG( ( EActiveDb, 1, _L( "<- CActiveApDb::RemoveObserver" ) ) );
+
+    }
+
+
+// ---------------------------------------------------------
+// CActiveApDb::Database
+// ---------------------------------------------------------
+//
+EXPORT_C CCommsDatabase*  CActiveApDb::Database()
+    {
+    CLOG( ( EActiveDb, 0, _L( "<-> CActiveApDb::Database" ) ) );
+
+    return iDb;
+    }
+
+// ---------------------------------------------------------
+// CActiveApDb::HandleDbEventL
+// ---------------------------------------------------------
+//
+void CActiveApDb::HandleDbEventL( TInt anEvent )
+    {
+    CLOG( ( EActiveDb, 0, _L( "-> CActiveApDb::HandleDbEventL" ) ) );
+
+    // possible events: EClose,EUnlock,ECommit,ERollback,ERecover
+    switch ( anEvent )
+        {
+        case RDbNotifier::EUnlock:
+            {
+            CLOG( ( EActiveDb, 2, _L( "Notifier Unlock" ) ) );
+            NotifyObserversL( MActiveApDbObserver::EDbAvailable );
+            break;
+            }
+        case RDbNotifier::ECommit:
+            {
+            CLOG( ( EActiveDb, 2, _L( "Notifier Commit" ) ) );
+            NotifyObserversL( MActiveApDbObserver::EDbChanged );
+            break;
+            }
+        case RDbNotifier::EClose:
+            {
+            CLOG( ( EActiveDb, 2, _L( "Notifier Close/Rollbac/Recover" ) ) );
+            NotifyObserversL( MActiveApDbObserver::EDbClosing );
+            // Use base class' method to keep the notifier alive.
+            // We need to know when all clients has released the db.
+            break;
+            }
+        case RDbNotifier::ERollback:            
+            {
+            CLOG( ( EActiveDb, 2, _L( "Notifier Close/Rollbac/Recover" ) ) );
+            NotifyObserversL( MActiveApDbObserver::EDbAvailable );
+            break;
+            }
+        case RDbNotifier::ERecover:
+            {
+            CLOG( ( EActiveDb, 2, _L( "Notifier Close/Rollbac/Recover" ) ) );
+            NotifyObserversL( MActiveApDbObserver::EDbClosing );
+            // Use base class' method to keep the notifier alive.
+            // We need to know when all clients has released the db.
+            break;
+            }
+        default:
+            {
+            // Don't know what's happened, but instead of
+            // Panicking, it's better to 'simulate' a change.
+            // 'Defensive' programming.
+            CLOG( ( EActiveDb, 2, _L( "Notifier UNKNOWN" ) ) );
+            NotifyObserversL( MActiveApDbObserver::EDbChanged );
+            break;
+            }
+        }
+    CLOG( ( EActiveDb, 1, _L( "<- CActiveApDb::HandleDbEventL" ) ) );
+
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CActiveApDb::NotifyObserversL
+// ---------------------------------------------------------
+//
+void CActiveApDb::NotifyObserversL( MActiveApDbObserver::TEvent anEvent )
+    {
+
+    TInt i;
+    TInt count = iObservers->Count();
+    // one hazard is that if one client leaves,
+    // the rest of the clients will not be notified this time...
+    for ( i = 0; i < count; i++ )
+        {
+        TRAP_IGNORE( iObservers->At( i )->HandleApDbEventL( anEvent ) );
+        }
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apeng/src/ActiveApDbNotifier.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,121 @@
+/*
+* Copyright (c) 2002 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 CActiveApDbNotifier.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "ActiveApDb.h"
+#include "ActiveApDbNotifier.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CActiveApDbNotifier::CActiveApDbNotifier
+// ---------------------------------------------------------
+//
+CActiveApDbNotifier::CActiveApDbNotifier( CActiveApDb& aDb )
+: CActive( EPriorityStandard )
+    {
+    iActiveDb = &aDb;
+    CActiveScheduler::Add( this );
+    }
+
+// ---------------------------------------------------------
+// CActiveApDbNotifier::~CActiveApDbNotifier
+// ---------------------------------------------------------
+//
+CActiveApDbNotifier::~CActiveApDbNotifier()
+    {
+    Cancel();
+    }
+
+// ---------------------------------------------------------
+// CActiveApDbNotifier::RunL
+// ---------------------------------------------------------
+//
+void CActiveApDbNotifier::RunL()
+    {
+    if ( iStatus == KErrCancel )
+        {
+        // Do nothing.
+        }
+    else
+        {
+        // first store status, because re-schedule will be earlier 
+        // than notifying clients. Reason:
+        // clients can leave but re-schedule MUST happen anyway,
+        // to keep the notifier alive even if any client leaves
+        TRequestStatus tempstatus( iStatus );
+
+        if ( iStatus == RDbNotifier::EClose )
+            {
+            // Finish if the database is closed.
+            NotifyChange();
+            }
+        else
+            {
+            // Reschedule automatically (as long as the database is open).
+            NotifyChange();
+            }
+        // and now let clients handle their stuff...
+        TRAP_IGNORE( iActiveDb->HandleDbEventL( tempstatus.Int() ) );
+        }
+    }
+
+
+// ---------------------------------------------------------
+// CActiveApDbNotifier::DoCancel
+// ---------------------------------------------------------
+//
+void CActiveApDbNotifier::DoCancel()
+    {
+    Stop();
+    }
+
+
+// ---------------------------------------------------------
+// CActiveApDbNotifier::Stop
+// ---------------------------------------------------------
+//
+void CActiveApDbNotifier::Stop()
+    {
+    iActiveDb->Database()->CancelRequestNotification();
+    }
+
+// ---------------------------------------------------------
+// CActiveApDbNotifier::Start
+// ---------------------------------------------------------
+//
+void CActiveApDbNotifier::Start()
+    {
+    NotifyChange();
+    }
+
+// ---------------------------------------------------------
+// CActiveApDbNotifier::NotifyChange
+// ---------------------------------------------------------
+//
+void CActiveApDbNotifier::NotifyChange()
+    {
+    if ( !IsActive() )
+        {
+        iActiveDb->Database()->RequestNotification( iStatus );
+        SetActive();
+        }
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apeng/src/ApEngineCommons.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,571 @@
+/*
+* Copyright (c) 2002 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 some common global functions.
+*
+*/
+
+
+// INCLUDE FILES
+#include <eikdef.h>
+#include <ApEngineConsts.h>
+#include <commdb.h>
+#include <ApUtils.h>
+#include <centralrepository.h> // link against centralrepository.lib
+
+#include "ApEngineCommons.h"
+#include "ApProtHandler.h"
+#include "ApEngineLogger.h"
+#include "ApEnginePrivateCRKeys.h"    
+
+// CONSTANTS
+
+
+// LOCAL CONSTANTS AND MACROS
+_LIT(KFormatPostfix, "%S(%02d)");
+_LIT(KFormatNoPostfix, "%S");
+_LIT(KFormatLargePostfix, "%S(%d)");
+
+void ApCommons::Panic( TApEnginePanicCodes aPanic )
+    {
+    _LIT( kApSet, "APEngine" ) ;
+    User::Panic( kApSet, aPanic ) ;
+    }
+
+
+// ---------------------------------------------------------
+// ApCommons::StartPushedTransactionL
+// ---------------------------------------------------------
+//
+TBool ApCommons::StartPushedTransactionLC( CCommsDatabase& aDb, TBool aRetry )
+    {
+    CLOG( ( ETransaction, 0, 
+            _L( "-> ApCommons::StartPushedTransactionLC" ) ) );
+
+    TBool retval( EFalse );
+    if ( !aDb.InTransaction() )
+        {
+        TInt retriesLeft( aRetry ? KRetryCount : 1 );
+        TInt err = aDb.BeginTransaction();
+        while ( ( ( err == KErrLocked ) || ( err == KErrAccessDenied ) )
+                && --retriesLeft )
+            {
+            User::After( KRetryWait );
+            err = aDb.BeginTransaction();
+            }
+        User::LeaveIfError( err );
+        CleanupStack::PushL
+                (
+                TCleanupItem( ApCommons::RollbackTransactionOnLeave, &aDb )
+                );
+        retval = ETrue;
+        }
+    else
+        {
+        retval = EFalse;
+        }
+    CLOG( ( ETransaction, 1, 
+            _L( "<- ApCommons::StartPushedTransactionLC" ) ) );
+    return retval;
+    }
+
+
+
+// ---------------------------------------------------------
+// ApCommons::RollbackTransactionOnLeave
+// ---------------------------------------------------------
+//
+void ApCommons::RollbackTransactionOnLeave( TAny* aDb )
+    {
+    CLOG( ( ETransaction, 0, 
+            _L( "-> ApCommons::RollbackTransactionOnLeave" ) ) );
+    
+    CCommsDatabase* db = STATIC_CAST( CCommsDatabase*, aDb );
+    db->RollbackTransaction();
+
+    CLOG( ( ETransaction, 1, 
+            _L( "<- ApCommons::RollbackTransactionOnLeave" ) ) );
+    }
+
+
+
+
+// ---------------------------------------------------------
+// ApCommons::DoMakeValidNameL
+// ---------------------------------------------------------
+//
+HBufC* ApCommons::DoMakeValidNameL
+                            (
+                            CCommsDatabase& aDb,
+                            TBool& aChanged,
+                            HBufC* aName,
+                            TUint32 aUid,
+                            TBool aIsNew
+                            )
+    {
+    CLOG( ( ECommons, 0, _L( "-> ApCommons::DoMakeValidNameL" ) ) );
+
+    aChanged = EFalse;
+    HBufC* temp = HBufC::NewLC( KApMaxConnNameLength );
+    HBufC* temp2 = HBufC::NewLC( KApMaxConnNameLength );
+
+    HBufC* corrname = ApCommons::EnsureMaxLengthLC( aName, aChanged );
+    *temp = *corrname;
+    TInt postfix( 0 );
+    TInt pf( 0 );
+    TInt i( 0 );
+    TBool valid ( EFalse );
+
+    TPtrC prefix = ApCommons::GetPrefix( *corrname );
+    
+    CApUtils* utils = CApUtils::NewLC( aDb );
+
+    if ( aIsNew )
+        {
+        aUid = 0;
+        }
+
+    postfix = GetPostfix( *temp, prefix );
+    postfix = -1;
+    do
+        {       
+        valid = utils->IsValidNameL( *temp, aUid );
+        if ( !valid )
+            {
+            aChanged = ETrue;
+            postfix++;
+            // check the length of postfix, check text length accordingly
+            pf = postfix;
+            for (i=1; i<10; i++)
+                {
+                pf /= 10;
+                if ( !pf )
+                    break;
+                }
+            TPtr sgdptr( temp->Des() );
+            TPtr sgdptr2( temp2->Des() );
+            if ( postfix )
+                {
+                if ( postfix < 10 )
+                    {
+                    sgdptr2 = prefix.Left( KApMaxConnNameLength - i - 3 );
+                    }
+                else
+                    {
+                    sgdptr2 = prefix.Left( KApMaxConnNameLength - i - 2 );
+                    }
+                }
+            else
+                {
+                sgdptr2 = prefix.Left( KApMaxConnNameLength );
+                }
+            if ( postfix )
+                {
+                if ( postfix > 9 )
+                    {
+                    sgdptr.Format( KFormatLargePostfix, &sgdptr2,
+                                       postfix );
+                    }
+                else
+                    {
+                    sgdptr.Format( KFormatPostfix, &sgdptr2,
+                                       postfix );
+                    }
+                }
+            else
+                {
+                sgdptr.Format( KFormatNoPostfix, &sgdptr2 );
+                }
+            }
+        } while ( !valid );
+
+    CleanupStack::PopAndDestroy( utils );
+    CleanupStack::PopAndDestroy( corrname );
+    CleanupStack::PopAndDestroy( temp2 );
+
+    if ( aChanged )
+        {
+        CleanupStack::Pop( temp );
+        }
+    else
+        {
+        CleanupStack::PopAndDestroy( temp );
+        temp = NULL;
+        }
+
+    CLOG( ( ECommons, 1, _L( "<- ApCommons::DoMakeValidNameL" ) ) );
+
+    return temp;
+    }
+
+
+
+
+
+// ---------------------------------------------------------
+// ApCommons::EnsureMaxLengthLC
+// ---------------------------------------------------------
+//
+HBufC* ApCommons::EnsureMaxLengthLC( const TDesC* aName, TBool& aChanged )
+    {
+    CLOG( ( ECommons, 0, _L( "-> ApCommons::EnsureMaxLengthLC" ) ) );
+
+    TInt length = aName->Length();
+    
+    aChanged = EFalse;
+    
+    if ( !length )
+        {
+        // Name is required.
+        User::Leave(KErrInvalidName);
+        }
+
+    HBufC* corrname;
+    if ( KApMaxConnNameLength < length )
+        { // name too long, truncate.
+        corrname = aName->Left( KApMaxConnNameLength ).AllocLC();
+        aChanged = ETrue;
+        }
+    else
+        {
+        corrname = aName->AllocLC();
+        corrname->Des().Trim();
+        if ( corrname->Length() == 0 )
+            {
+            User::Leave(KErrInvalidName);
+            }
+        // comes here only if name is valid
+        if ( corrname->Length() != aName->Length() )
+            {
+            aChanged = ETrue;
+            }
+        }
+    CLOG( ( ECommons, 1, _L( "<- ApCommons::EnsureMaxLengthLC" ) ) );
+
+    return corrname;
+    }
+
+
+
+
+/**
+* Given aName in the format <prefix> or <prefix><brace><integer><brace>,
+* return a pointer to the leading part.
+* That is, if there is trailing <space><integer>,
+* then that is excluded; if there is no trailing part, then the original
+* decriptor is returned.
+* Examples:
+*   - "Foo" returns "Foo";
+*   - "Foo 12" returns "Foo 12";
+*   - "Foo(12)" returns "Foo";
+*   - "Foo 12 (34)" returns "Foo 12 ";
+*   - "Foo bar" returns "Foo bar";
+*   - "Foo " returns "Foo ".
+*/
+TPtrC ApCommons::GetPrefix( const TDesC& aName )
+    {
+    TPtrC prefix = aName;
+    TInt lastBrace = aName.LocateReverse('(');
+    if ( lastBrace != KErrNotFound )
+        {
+        // aName looks like "<prefix><brace><something>".
+        // See if <something> is an integer number.
+        TPtrC num = aName.Right( aName.Length() - lastBrace - 1 );
+        TInt val;
+        TLex lex( num );
+        if ( lex.Val( val ) == KErrNone )
+            {
+            // Yes, the trailer is an integer.
+            prefix.Set( aName.Left( lastBrace ) );
+            }
+        }
+    return prefix;
+    }
+
+
+/**
+* If aName is constructed from aPrefix with a postfix, get the numeric
+* value of the postfix, e.g:
+*   - GetPostfix( "Foo (3)", "Foo" ) == 3
+*   - GetPostfix( "Foo 23 (45)", "Foo 23" ) == 45
+* If aName is the same as aPrefix, return 0, e.g.:
+*   - GetPostfix( "Foo", "Foo" ) == 0
+* If aName is not constructed from aPrefix, return -1, e.g.:
+*   - GetPostfix( "Foobar", "Foo" ) == -1
+*   - GetPostfix( "Fo 23 45", "Foo" ) == -1
+*/
+TInt ApCommons::GetPostfix( const TDesC& aName, const TDesC& aPrefix )
+    {
+    TInt postfix( KErrNotFound );
+    TInt nameLength = aName.Length();
+    TInt prefixLength = aPrefix.Length();
+    if ( nameLength >= prefixLength && aName.FindF( aPrefix ) == 0 )
+        {
+        // aName is longer or equal length, and
+        // aPrefix can be found in the beginning of aName.
+        if ( nameLength == prefixLength )
+            {
+            // They have the same length; they equal.
+            postfix = 0;
+            }
+        else
+            {
+            if ( aName[ prefixLength ] == '(' )
+                {
+                // (Now we know that aName is longer than aPrefix.)
+                // aName looks like "aPrefix<brace><something>".
+                // See if <something> is an integer number.
+                TPtrC num = aName.Right( nameLength - prefixLength - 1 );
+                TInt val;
+                TLex lex( num );
+                if ( lex.Val( val ) == KErrNone )
+                    {
+                    // Yes, the trailer is an integer.
+                    if ( val > 0 )
+                        {
+                        postfix = val;
+                        }
+                    else
+                        {
+                        // signal that it is invalid...
+                        postfix = -1;
+                        }
+                    }
+                }
+            }
+        }
+    return postfix;
+    }
+
+
+
+
+// ---------------------------------------------------------
+// ApCommons::ReadUintL
+// ---------------------------------------------------------
+//
+TInt ApCommons::ReadUintL
+                    (
+                    CCommsDbTableView* atable,
+                    const TDesC& aColumn,
+                    TUint32& aValue
+                    )
+    {
+    __ASSERT_DEBUG( (atable), Panic( ENullPointer ) ) ;
+    TRAPD( err, atable->ReadUintL( aColumn, aValue ) );
+    if ( err != KErrNone ) 
+        { // do not leave if readed value is not present in table...
+        if ( ( err != KErrUnknown ) && ( err != KErrNotFound ) )
+            User::Leave( err );
+        }
+    return err;
+    }
+
+
+// ---------------------------------------------------------
+// ApCommons::ReadBoolL
+// ---------------------------------------------------------
+//
+TInt ApCommons::ReadBoolL
+                    (
+                    CCommsDbTableView* atable,
+                    const TDesC& aColumn,
+                    TBool& aValue
+                    )
+    {
+    __ASSERT_DEBUG( (atable), Panic( ENullPointer ) ) ;
+    TRAPD( err, atable->ReadBoolL( aColumn, aValue ) );
+    if ( err != KErrNone )
+        { // do not leave if readed value is not present in table...
+        if ( err != KErrUnknown )
+            User::Leave( err );
+        }
+    return err;
+    }
+
+
+
+// ---------------------------------------------------------
+// ApCommons::ReadLongTextLC
+// ---------------------------------------------------------
+//
+HBufC* ApCommons::ReadLongTextLC
+                        (
+                        CCommsDbTableView* atable,
+                        const TDesC& aColumn,
+                        TInt& aErrCode
+                        )
+    {
+    __ASSERT_DEBUG( (atable), Panic( ENullPointer ) ) ;
+    HBufC* value =  NULL;
+    // because of Trap, we need to call a func
+    // which pops it from the stack & push it back afterwards...
+    TRAP( aErrCode, value = ReadLongTextL( atable, aColumn ) );
+    CleanupStack::PushL( value );
+    if ( aErrCode != KErrNone )
+        { // do not leave if readed value is not present in table...
+        if ( aErrCode != KErrUnknown )
+            User::Leave( aErrCode );
+        }
+    return value;
+    }
+
+
+
+// ---------------------------------------------------------
+// ApCommons::ReadLongTextL
+// ---------------------------------------------------------
+//
+HBufC* ApCommons::ReadLongTextL( CCommsDbTableView* atable,
+                                  const TDesC& aColumn )
+    {
+    __ASSERT_DEBUG( (atable), Panic( ENullPointer ) ) ;
+    HBufC* value = atable->ReadLongTextLC( aColumn );
+    CleanupStack::Pop( value );
+    return value;
+    }
+
+
+
+// ---------------------------------------------------------
+// ApCommons::EscapeTextLC
+// ---------------------------------------------------------
+//
+HBufC* ApCommons::EscapeTextLC( const TDesC& aLiteral )
+    {
+    TInt l( aLiteral.Length() );
+    //> 2*, to ensure correct esc. even if ALL chars are quotes...
+    HBufC* retbuf = HBufC::NewLC( 2*l );
+    TPtr ret = retbuf->Des();
+    TUint quote( '\'' );  // TChar gives warnings in THUMB & ARMI
+    TInt i( 0 );
+
+    for( i=0; i<l; i++ )
+        {
+        ret.Append( aLiteral[i] );
+        if ( aLiteral[i] == quote )
+            {
+            // Duplicate quote.
+            ret.Append( quote );
+            }
+        }
+    return retbuf;
+    }
+
+
+
+// ---------------------------------------------------------
+// ApCommons::ReadText16ValueL
+// ---------------------------------------------------------
+//
+HBufC16* ApCommons::ReadText16ValueLC( CCommsDbTableView* atable,
+                                 const TDesC& aCol )
+    {
+    // Second variant, if always keeping mem usage to minimum.
+    // This case code is a bit slower and more 'complicated'.
+    // First version simpler, faster, less chance for errors
+    // (e.g. if memory is exhausted, can not even create object
+    // that may not be able to hold the values.
+    __ASSERT_DEBUG( (atable), Panic( ENullPointer ) ) ;
+
+    TInt aLength(0);
+    atable->ReadColumnLengthL(aCol, aLength);
+
+    HBufC* buf = HBufC::NewLC(aLength);
+    TPtr ptr( buf->Des() );
+    atable->ReadTextL(aCol, ptr);
+    return buf;
+    }
+
+
+// ---------------------------------------------------------
+// ApCommons::ReadText8ValueLC
+// ---------------------------------------------------------
+//
+HBufC8* ApCommons::ReadText8ValueLC( CCommsDbTableView* atable,
+                                 const TDesC& aCol )
+    {
+    __ASSERT_DEBUG( (atable), Panic( ENullPointer ) ) ;
+    TInt aLength(0);
+    atable->ReadColumnLengthL(aCol, aLength);
+
+    HBufC8* buf = HBufC8::NewLC(aLength);
+    TPtr8 ptr( buf->Des() );
+    atable->ReadTextL(aCol, ptr);
+    return buf;
+    }
+
+
+// ---------------------------------------------------------
+// ApCommons::DoGetReadOnlyL
+// ---------------------------------------------------------
+//
+TBool ApCommons::DoGetReadOnlyL( CCommsDbTableView& aTable )
+    {
+    return CApProtHandler::GetProtectionStateL( aTable );
+    }
+
+
+
+// ---------------------------------------------------------
+// ApCommons::CommitTransaction
+// ---------------------------------------------------------
+//
+TInt ApCommons::CommitTransaction( CCommsDatabase& aDb )
+    {
+    CLOG( ( ETransaction, 0, _L( "-> ApCommons::CommitTransaction" ) ) );
+    TInt err = aDb.CommitTransaction();
+    CLOG( ( ETransaction, 1, _L( "<- ApCommons::CommitTransaction" ) ) );
+    return err;
+    }
+
+
+
+
+//----------------------------------------------------------
+// ApCommons::GetVariantL
+//----------------------------------------------------------
+//
+TInt ApCommons::GetVariantL()
+    {
+    CLOG( ( ETransaction, 0, _L( "-> ApCommons::GetVariantL" ) ) );
+    TInt variant( 0 );
+    // Connecting and initialization:
+    CRepository* repository = CRepository::NewL( KCRUidApEngineLV );
+    repository->Get( KApEngineLVFlags, variant );
+    delete repository;
+
+    CLOG( ( ETransaction, 1, _L( "<- ApCommons::GetVariantL" ) ) );
+
+    return variant;
+    }
+
+
+
+// ---------------------------------------------------------
+// ApCommons::IsGivenSharedDataSupportL
+// ---------------------------------------------------------
+//
+TInt ApCommons::IsGivenSharedDataSupportL( const TUid aUid, 
+                                           const TUint32 aKey )
+    {
+    TInt value( 0 );
+    // Connecting and initialization:
+    CRepository* repository = CRepository::NewL( aUid );
+    repository->Get( aKey, value );
+    delete repository;
+    return value;    
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apeng/src/ApEngineLogger.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,159 @@
+/*
+* Copyright (c) 2002 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 ApEngineLogger.   
+*      
+*
+*/
+
+
+// INCLUDE FILES
+
+#ifdef __TEST_APENGINE_LOG__
+
+    #include "ApEngineLogger.h"
+    #include <flogger.h>
+
+    // ================= CONSTANTS =======================
+
+    /// ApEngine logging directory.
+    _LIT( KApEngineLogDir, "ApEngine" );
+    /// ApEngine log file name.
+    _LIT( KApEngineLogFile, "ApEngine.txt" );
+
+
+    // ================= MEMBER FUNCTIONS =======================
+
+    // ---------------------------------------------------------
+    // ApEngineLogger::Write()
+    // ---------------------------------------------------------
+    //
+    void ApEngineLogger::Write
+    ( TInt32 aMask, TInt aLevel, TRefByValue<const TDesC16> aFmt, ... )
+        {
+        if( (aMask & APENGINE_LOG_MASK) && (aLevel <= APENGINE_LOG_LEVEL) )
+            {
+            VA_LIST list;
+            VA_START( list, aFmt );
+            RFileLogger::WriteFormat
+                (
+                KApEngineLogDir,
+                KApEngineLogFile,
+                EFileLoggingModeAppend,
+                aFmt,
+                list
+                );
+            VA_END( list );
+            }
+        }
+
+
+    // ---------------------------------------------------------
+    // ApEngineLogger::Write()
+    // ---------------------------------------------------------
+    //
+    void ApEngineLogger::Write
+    ( TInt32 aMask, TInt aLevel, 
+      TRefByValue<const TDesC16> aFmt, 
+      VA_LIST& aList )
+        {
+        if( (aMask & APENGINE_LOG_MASK) && (aLevel <= APENGINE_LOG_LEVEL) )
+            {
+            RFileLogger::WriteFormat
+                (
+                KApEngineLogDir,
+                KApEngineLogFile,
+                EFileLoggingModeAppend,
+                aFmt,
+                aList
+                );
+            }
+        }
+
+
+    // ---------------------------------------------------------
+    // ApEngineLogger::Write()
+    // ---------------------------------------------------------
+    //
+    void ApEngineLogger::Write
+    ( TInt32 aMask, TInt aLevel, TRefByValue<const TDesC8> aFmt, ... )
+        {
+        if( (aMask & APENGINE_LOG_MASK) && (aLevel <= APENGINE_LOG_LEVEL) )
+            {
+            VA_LIST list;
+            VA_START( list, aFmt );
+            RFileLogger::WriteFormat
+                (
+                KApEngineLogDir,
+                KApEngineLogFile,
+                EFileLoggingModeAppend,
+                aFmt,
+                list
+                );
+            VA_END( list );
+            }
+        }
+
+
+    // ---------------------------------------------------------
+    // ApEngineLogger::Write()
+    // ---------------------------------------------------------
+    //
+    void ApEngineLogger::Write
+    ( TInt32 aMask, TInt aLevel, 
+      TRefByValue<const TDesC8> aFmt, VA_LIST& aList )
+        {
+        if( (aMask & APENGINE_LOG_MASK) && (aLevel <= APENGINE_LOG_LEVEL) )
+            {
+            RFileLogger::WriteFormat
+                (
+                KApEngineLogDir,
+                KApEngineLogFile,
+                EFileLoggingModeAppend,
+                aFmt,
+                aList
+                );
+            }
+        }
+
+
+    // ---------------------------------------------------------
+    // ApEngineLogger::HexDump()
+    // ---------------------------------------------------------
+    //
+    void ApEngineLogger::HexDump
+            (
+            TInt32 aMask,
+            TInt aLevel, 
+            const TText* aHeader,
+            const TText* aMargin,
+            const TUint8* aPtr,
+            TInt aLen
+            )
+        {
+        if( (aMask & APENGINE_LOG_MASK) && (aLevel <= APENGINE_LOG_LEVEL) )
+            {
+            RFileLogger::HexDump
+                (
+                KApEngineLogDir,
+                KApEngineLogFile,
+                EFileLoggingModeAppend,
+                aHeader,
+                aMargin,
+                aPtr,
+                aLen
+                );
+            }
+        }
+#endif // __TEST_APENGINE_LOG__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apeng/src/ApListItem.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,384 @@
+/*
+* Copyright (c) 2002 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 the CApSelect class.
+*
+*/
+
+
+// INCLUDE FILES
+#include <eikdef.h>
+
+#include "ApListItem.h"
+#include "ApEngineLogger.h"
+#include "ApEngineCommons.h"
+
+// LOCAL FUNCTION PROTOTYPES
+
+// ================= MEMBER FUNCTIONS =======================
+// Two-phased constructor.
+// ---------------------------------------------------------
+// CApListItem::NewLC
+// ---------------------------------------------------------
+//
+EXPORT_C CApListItem* CApListItem::NewLC()
+    {
+    CLOG( ( EUtil, 0, _L( "-> CApListItem::NewLC" ) ) );
+
+    CApListItem* db = new( ELeave ) CApListItem;
+    CleanupStack::PushL( db );
+    db->ConstructL();
+
+    CLOG( ( EUtil, 1, _L( "<- CApListItem::NewLC" ) ) );
+    return db;
+    }
+
+
+// ---------------------------------------------------------
+// CApListItem::NewLC
+// ---------------------------------------------------------
+//
+EXPORT_C CApListItem* CApListItem::NewLC
+                                        (
+                                        TCommsDbIspType aIspType,
+                                        TUint32 aUid,
+                                        const TDesC& aName,
+                                        TApBearerType aBearerType
+                                        )
+    {
+    CLOG( ( EUtil, 0, _L( "-> CApListItem::NewLC" ) ) );
+
+    CApListItem* db = new( ELeave ) CApListItem;
+    CleanupStack::PushL( db );
+    db->ConstructL( aIspType, aUid, aName, aBearerType );
+
+    CLOG( ( EUtil, 1, _L( "<- CApListItem::NewLC" ) ) );
+    return db;
+    }
+
+
+EXPORT_C CApListItem* CApListItem::NewLC
+                                        (
+                                        TCommsDbIspType aIspType,
+                                        TUint32 aUid,
+                                        const TDesC& aName,
+                                        TApBearerType aBearerType,
+                                        const TDesC& aStartPage,
+                                        TBool aReadOnly
+                                        )
+    {
+    CLOG( ( EUtil, 0, _L( "-> CApListItem::NewLC" ) ) );
+
+    CApListItem* db = new( ELeave ) CApListItem;
+    CleanupStack::PushL( db );
+    db->ConstructL( aIspType, aUid, aName, aBearerType, aStartPage );
+    db->iExt->iReadOnly = aReadOnly;
+    
+    CLOG( ( EUtil, 1, _L( "<- CApListItem::NewLC" ) ) );
+    return db;
+    }
+
+// ---------------------------------------------------------
+// CApListItem::NewLC
+// ---------------------------------------------------------
+//
+EXPORT_C CApListItem* CApListItem::NewLC( CApListItem* aItem )
+    {
+    CLOG( ( EUtil, 0, _L( "-> CApListItem::NewLC" ) ) );
+
+    CApListItem* db = new( ELeave ) CApListItem;
+    CleanupStack::PushL( db );
+    db->ConstructL( aItem->iIspType, aItem->iUid, *aItem->iName,
+                    aItem->iBearerType, *aItem->iStartPage );
+    db->iExt->iReadOnly = aItem->IsReadOnly();
+    
+    CLOG( ( EUtil, 1, _L( "<- CApListItem::NewLC" ) ) );
+    return db;
+    }
+
+
+// Destructor
+// ---------------------------------------------------------
+// CApListItem::~CApListItem
+// ---------------------------------------------------------
+//
+EXPORT_C CApListItem::~CApListItem()
+    {
+    CLOG( ( EUtil, 0, _L( "-> CApListItem::NewLC" ) ) );
+
+    delete iName;
+    delete iStartPage;
+    if ( iExt )
+        {
+        delete iExt;
+        }
+
+    CLOG( ( EUtil, 1, _L( "<- CApListItem::NewLC" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApListItem::CopyFromL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApListItem::CopyFromL( const CApListItem& aCopyFrom )
+    {
+    CLOG( ( EUtil, 0, _L( "-> CApListItem::NewLC" ) ) );
+
+    HBufC* temp = NULL;
+    HBufC* temp2 = NULL;
+    temp = aCopyFrom.iName->AllocL();
+    delete iName;
+    iName = temp;
+
+    temp2 = aCopyFrom.iStartPage->AllocL();
+    delete iStartPage;
+    iStartPage = temp2;
+
+    iUid = aCopyFrom.iUid;
+    iIspType =  aCopyFrom.iIspType;
+    iBearerType = aCopyFrom.iBearerType;
+    iExt->iReadOnly = aCopyFrom.iExt->iReadOnly;
+
+    CLOG( ( EUtil, 1, _L( "<- CApListItem::NewLC" ) ) );
+    }
+
+
+// C++ default constructor can NOT contain any code that
+// might leave.
+//
+// ---------------------------------------------------------
+// CApListItem::CApListItem
+// ---------------------------------------------------------
+//
+EXPORT_C CApListItem::CApListItem()
+:iIspType( EIspTypeInternetAndWAP ),
+iUid( 0 ),
+iBearerType( EApBearerTypeGPRS )
+    {
+    }
+
+
+// Symbian OS default constructor can leave.
+// ---------------------------------------------------------
+// CApListItem::ConstructL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApListItem::ConstructL()
+    {
+    CLOG( ( EUtil, 0, _L( "-> CApListItem::NewLC" ) ) );
+
+    iName = HBufC::NewL( 0 );
+    iStartPage = HBufC::NewL( 0 );
+    CreateExtraL();
+    
+    CLOG( ( EUtil, 1, _L( "<- CApListItem::NewLC" ) ) );
+    }
+
+
+// Symbian OS default constructor can leave.
+// ---------------------------------------------------------
+// CApListItem::ConstructL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApListItem::ConstructL( TCommsDbIspType aIspType,
+                                      TUint32 aUid,
+                                      const TDesC& aName,
+                                      TApBearerType aBearerType )
+    {
+    CLOG( ( EUtil, 0, _L( "-> CApListItem::NewLC" ) ) );
+
+    ConstructL();
+    SetItemL( aIspType, aUid, aName, aBearerType );
+    
+    CLOG( ( EUtil, 1, _L( "<- CApListItem::NewLC" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApListItem::ConstructL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApListItem::ConstructL( TCommsDbIspType aIspType,
+                                      TUint32 aUid,
+                                      const TDesC& aName,
+                                      TApBearerType aBearerType,
+                                      const TDesC& aStartPage
+                                      )
+    {
+    CLOG( ( EUtil, 0, _L( "-> CApListItem::ConstructL" ) ) );
+
+    ConstructL();
+    SetItemL( aIspType, aUid, aName, aBearerType, aStartPage );
+
+    CLOG( ( EUtil, 1, _L( "<- CApListItem::ConstructL" ) ) );
+    }
+
+
+// ---------------------------------------------------------
+// CApListItem::SetItemL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApListItem::SetItemL( TCommsDbIspType aIspType,
+                                    TUint32 aUid,
+                                    const TDesC& aName,
+                                    TApBearerType aBearerType )
+    {
+    CLOG( ( EUtil, 0, _L( "-> CApListItem::SetItemL(4)" ) ) );
+
+    SetItemL( aIspType, aUid, aName, aBearerType, KEmpty );
+
+    CLOG( ( EUtil, 1, _L( "<- CApListItem::SetItemL(4)" ) ) );
+    }
+
+
+// ---------------------------------------------------------
+// CApListItem::SetItemL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApListItem::SetItemL( TCommsDbIspType aIspType,
+                                    TUint32 aUid,
+                                    const TDesC& aName,
+                                    TApBearerType aBearerType,
+                                    const TDesC& aStartpage
+                                    )
+    {
+    CLOG( ( EUtil, 0, _L( "-> CApListItem::SetItemL" ) ) );
+
+    HBufC* temp = NULL;
+    temp = aName.AllocL();
+    delete iName;
+    iName = temp;
+
+    HBufC* temp2 = NULL;
+    temp2 = aStartpage.AllocL();
+    delete iStartPage;
+    iStartPage = temp2;
+
+    iIspType = aIspType;
+    iUid = aUid;
+    iBearerType = aBearerType;
+    
+    CLOG( ( EUtil, 1, _L( "<- CApListItem::SetItemL" ) ) );
+    }
+
+
+// ---------------------------------------------------------
+// CApListItem::Name
+// ---------------------------------------------------------
+//
+EXPORT_C const TDesC& CApListItem::Name()
+    {
+    CLOG( ( EUtil, 0, _L( "<-> CApListItem::Name" ) ) );
+
+    return *iName;
+    }
+
+
+// ---------------------------------------------------------
+// CApListItem::Uid
+// ---------------------------------------------------------
+//
+EXPORT_C TUint32 CApListItem::Uid()
+    {
+    CLOG( ( EUtil, 0, _L( "<-> CApListItem::Uid" ) ) );
+
+    return iUid;
+    }
+
+
+// ---------------------------------------------------------
+// CApListItem::Type
+// ---------------------------------------------------------
+//
+EXPORT_C TCommsDbIspType CApListItem::Type()
+    {
+    CLOG( ( EUtil, 0, _L( "<-> CApListItem::Type" ) ) );
+
+    return iIspType;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApListItem::BearerType
+// ---------------------------------------------------------
+//
+EXPORT_C TApBearerType CApListItem::BearerType()
+    {
+    CLOG( ( EUtil, 0, _L( "<-> CApListItem::BearerType" ) ) );
+
+    return iBearerType;
+    }
+
+
+// ---------------------------------------------------------
+// CApListItem::StartPage
+// ---------------------------------------------------------
+//
+EXPORT_C const TDesC& CApListItem::StartPage() const
+    {
+    CLOG( ( EUtil, 0, _L( "<-> CApListItem::StartPage" ) ) );
+
+    return *iStartPage;
+    }
+
+
+// ---------------------------------------------------------
+// CApListItem::IsReadOnly
+// ---------------------------------------------------------
+//
+EXPORT_C TBool CApListItem::IsReadOnly() const
+    {
+    CLOG( ( EUtil, 0, _L( "<-> CApListItem::IsReadOnly" ) ) );
+
+    return iExt->iReadOnly;
+    }
+
+
+// ---------------------------------------------------------
+// CApListItem::IsVpnAp
+// ---------------------------------------------------------
+//
+TBool CApListItem::IsVpnAp() const
+    {
+    return iExt->iIsVpn;
+    }
+
+
+// ---------------------------------------------------------
+// CApListItem::CreateExtraL
+// ---------------------------------------------------------
+//
+void CApListItem::CreateExtraL()
+    {
+    iExt = new ( ELeave )TApListItemExtra;
+    iExt->iIapId = 0;
+    iExt->iIsVpn = EFalse;
+    iExt->iReadOnly = EFalse;
+    }
+
+
+// ---------------------------------------------------------
+// CApListItem::SetVpnFlag
+// ---------------------------------------------------------
+//
+void CApListItem::SetVpnFlag( TBool aIsVpn )
+    {
+    iExt->iIsVpn = aIsVpn;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apeng/src/ApListItemKey.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,148 @@
+/*
+* Copyright (c) 2002 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 the TApListItemKey class.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "ApListItemList.h"
+#include "ApListItem.h"
+#include "ApListItemKey.h"
+
+// CONSTANTS
+
+
+// ================= MEMBER FUNCTIONS =======================
+// ---------------------------------------------------------
+// TApListItemNameKey::SetPtr()
+// ---------------------------------------------------------
+//
+void TApListItemNameKey::SetPtr( CApListItemList* aPtr )
+    {
+    iList = aPtr;
+    }
+
+
+// ---------------------------------------------------------
+// TApListItemNameKey::Compare()
+// ---------------------------------------------------------
+//
+TInt TApListItemNameKey::Compare( TInt aLeft,TInt aRight ) const
+    {
+    TInt retval = 
+        iList->At( aLeft )->Name().CompareC( iList->At( aRight )->Name() );
+    if ( !iAscending )
+        {
+        retval *= -1;
+        }
+    return retval;
+    }
+
+
+// ---------------------------------------------------------
+// TApListItemNameKey::At()
+// ---------------------------------------------------------
+//
+TAny* TApListItemNameKey::At( TInt anIndex ) const
+    {
+    TAny* ptr = MUTABLE_CAST( TDesC16*, &(iList->At( anIndex )->Name()));
+    return ptr;
+    }
+
+
+
+// ---------------------------------------------------------
+// TApListItemNameKey::TApListItemNameKey()
+// ---------------------------------------------------------
+//
+TApListItemNameKey::TApListItemNameKey(  TBool aAscending )
+:TKeyArrayFix( 0, ECmpCollated )
+        {
+        iList = NULL;
+        iAscending = aAscending;
+        }
+
+
+
+
+
+
+// ---------------------------------------------------------
+// TApListItemUidKey 
+// ---------------------------------------------------------
+
+
+// ---------------------------------------------------------
+// TApListItemUidKey::SetPtr
+// ---------------------------------------------------------
+//
+void TApListItemUidKey::SetPtr( CApListItemList* aPtr )
+    {
+    iList = aPtr;
+    }
+
+
+// ---------------------------------------------------------
+// TApListItemUidKey::Compare
+// ---------------------------------------------------------
+//
+TInt TApListItemUidKey::Compare( TInt aLeft,TInt aRight ) const
+    {
+    TInt retval( 1 );
+    if ( iList->At( aLeft )->Uid() < iList->At( aRight )->Uid() )
+        {
+        retval = -1;
+        }
+    else
+        {
+        if ( iList->At( aLeft )->Uid() == iList->At( aRight )->Uid() )
+            {
+            retval = 0;
+            }
+        }
+    if ( !iAscending )
+        {
+        retval *= -1;
+        }
+    return retval;
+    }
+
+
+// ---------------------------------------------------------
+// TApListItemUidKey::At
+// ---------------------------------------------------------
+//
+TAny* TApListItemUidKey::At( TInt anIndex ) const
+    {
+    TAny* ptr = MUTABLE_CAST( TUint32*, &(iList->At( anIndex )->iUid) );
+    return ptr;
+    }
+
+
+
+// ---------------------------------------------------------
+// TApListItemUidKey::TApListItemUidKey
+// ---------------------------------------------------------
+//
+TApListItemUidKey::TApListItemUidKey(  TBool aAscending )
+:TKeyArrayFix( 0, ECmpCollated )
+        {
+        iList = NULL;
+        iAscending = aAscending;
+        }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apeng/src/ApNetworkItem.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,199 @@
+/*
+* Copyright (c) 2002 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 the CApNetworkItem class.
+*
+*/
+
+
+// INCLUDE FILES
+#include <eikdef.h>
+
+#include "ApNetworkItem.h"
+#include "ApEngineLogger.h"
+
+
+// LOCAL FUNCTION PROTOTYPES
+
+// ================= MEMBER FUNCTIONS =======================
+// Two-phased constructor.
+// ---------------------------------------------------------
+// CApNetworkItem::NewLC
+// ---------------------------------------------------------
+//
+EXPORT_C CApNetworkItem* CApNetworkItem::NewLC()
+    {
+    CLOG( ( ENetworks, 0, _L( "-> CApNetworkItem::NewLC()" ) ) );
+
+    CApNetworkItem* db = new( ELeave ) CApNetworkItem;
+    CleanupStack::PushL( db );
+    db->ConstructL();
+
+    CLOG( ( ENetworks, 1, _L( "<- CApNetworkItem::NewLC()" ) ) );
+    return db;
+    }
+
+
+// ---------------------------------------------------------
+// CApNetworkItem::NewLC
+// ---------------------------------------------------------
+//
+EXPORT_C CApNetworkItem* CApNetworkItem::NewLC( CApNetworkItem* aItem )
+    {
+    CLOG( ( ENetworks, 0, _L( "-> CApNetworkItem::NewLC" ) ) );
+
+    CApNetworkItem* db = new( ELeave ) CApNetworkItem;
+    CleanupStack::PushL( db );
+    db->ConstructL( aItem->iUid, *aItem->iName );
+
+    CLOG( ( ENetworks, 1, _L( "<- CApNetworkItem::NewLC" ) ) );
+    return db;
+    }
+
+
+// Destructor
+// ---------------------------------------------------------
+// CApNetworkItem::~CApNetworkItem
+// ---------------------------------------------------------
+//
+EXPORT_C CApNetworkItem::~CApNetworkItem()
+    {
+    CLOG( ( ENetworks, 0, _L( "-> CApNetworkItem::~CApNetworkItem" ) ) );
+
+    delete iName;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApNetworkItem::CopyFromL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApNetworkItem::CopyFromL( const CApNetworkItem& aCopyFrom )
+    {
+    CLOG( ( ENetworks, 0, _L( "-> CApNetworkItem::CopyFromL" ) ) );
+
+    HBufC* temp = NULL;
+    temp = aCopyFrom.iName->AllocL();
+    delete iName;
+    iName = temp;
+
+    iUid = aCopyFrom.iUid;
+
+    CLOG( ( ENetworks, 1, _L( "<- CApNetworkItem::CopyFromL" ) ) );
+    }
+
+
+// C++ default constructor can NOT contain any code that
+// might leave.
+//
+// ---------------------------------------------------------
+// CApNetworkItem::CApNetworkItem
+// ---------------------------------------------------------
+//
+EXPORT_C CApNetworkItem::CApNetworkItem()
+:iUid( 0 )
+    {
+    }
+
+
+// Symbian OS default constructor can leave.
+// ---------------------------------------------------------
+// CApNetworkItem::ConstructL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApNetworkItem::ConstructL()
+    {
+    CLOG( ( ENetworks, 0, _L( "-> CApNetworkItem::ConstructL()" ) ) );
+
+    iName = HBufC::NewL( 0 );
+    
+    CLOG( ( ENetworks, 1, _L( "<- CApNetworkItem::ConstructL()" ) ) );
+    }
+
+
+// Symbian OS default constructor can leave.
+// ---------------------------------------------------------
+// CApNetworkItem::ConstructL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApNetworkItem::ConstructL( TUint32 aUid,
+                                          const TDesC& aName )
+    {
+    CLOG( ( ENetworks, 0, _L( "-> CApNetworkItem::ConstructL" ) ) );
+
+    ConstructL();
+    SetUid( aUid );
+    SetNameL( aName );
+
+    CLOG( ( ENetworks, 1, _L( "<- CApNetworkItem::ConstructL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApNetworkItem::Name
+// ---------------------------------------------------------
+//
+EXPORT_C const TDesC& CApNetworkItem::Name() const
+    {
+    CLOG( ( ENetworks, 0, _L( "<-> CApNetworkItem::Name" ) ) );
+
+    return *iName;
+    }
+
+
+// ---------------------------------------------------------
+// CApNetworkItem::Uid
+// ---------------------------------------------------------
+//
+EXPORT_C TUint32 CApNetworkItem::Uid() const
+    {
+    CLOG( ( ENetworks, 0, _L( "<-> CApNetworkItem::Uid" ) ) );
+
+    return iUid;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApNetworkItem::SetUid
+// ---------------------------------------------------------
+//
+EXPORT_C void CApNetworkItem::SetUid( TUint32 aUid )
+    {
+    CLOG( ( ENetworks, 0, _L( "<-> CApNetworkItem::SetUid" ) ) );
+
+    iUid = aUid;
+    
+    }
+
+
+// ---------------------------------------------------------
+// CApNetworkItem::SetUidL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApNetworkItem::SetNameL( const TDesC& aName )
+    {
+    CLOG( ( ENetworks, 0, _L( "-> CApNetworkItem::SetNameL" ) ) );
+
+    HBufC* temp = NULL;
+    temp = aName.AllocL();
+    delete iName;
+    iName = temp;
+    
+    CLOG( ( ENetworks, 1, _L( "<- CApNetworkItem::SetNameL" ) ) );
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apeng/src/ApProtHandler.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,755 @@
+/*
+* Copyright (c) 2002 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 the CApProtHandler class.
+*
+*/
+
+
+// INCLUDE FILES
+#include <cdbcols.h>
+#include <commdb.h>
+#include <ApEngineConsts.h>
+
+#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include <ProtectDb.h>
+#include <ProtectcpDb.h>
+#else
+#include <comms-infras/commdb/protection/protectdb.h>
+#include <comms-infras/commdb/protection/protectcpdb.h>
+#endif
+
+#include <ApProtHandler.h>
+#include <ApListItem.h>
+#include <ApListItemList.h>
+#include <ApDataHandler.h>
+#include <ApSelect.h>
+
+#include "ApEngineCommons.h"
+#include "APEngineVariant.hrh"
+#include "ApEngineLogger.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CApProtHandler::IsTableProtectedL
+// ---------------------------------------------------------
+//
+EXPORT_C TBool CApProtHandler::IsTableProtectedL( CCommsDatabase* aDb )
+    {
+    CLOG( ( EProtection, 0, _L( "-> CApProtHandler::IsTableProtectedL" ) ) );
+
+    TBool retval( EFalse );
+    retval = IsTableProtectedL( aDb, TPtrC(WAP_ACCESS_POINT) );
+
+    CLOG( ( EProtection, 1, _L( "<- CApProtHandler::IsTableProtectedL" ) ) );
+    return retval;
+    }
+
+
+// ---------------------------------------------------------
+// CApProtHandler::IsApProtectedL
+// ---------------------------------------------------------
+//
+EXPORT_C TBool CApProtHandler::IsApProtectedL( CCommsDatabase* aDb,
+                                                     TUint32 aUid )
+    {
+    CLOG( ( EProtection, 0, _L( "-> CApProtHandler::IsApProtectedL" ) ) );
+
+    TBool retval( EFalse );
+    retval = IsRecordProtectedL( aDb, TPtrC(WAP_ACCESS_POINT), aUid );
+    
+    CLOG( ( EProtection, 1, _L( "<- CApProtHandler::IsApProtectedL" ) ) );
+    return retval;
+    }
+
+
+// ---------------------------------------------------------
+// CApProtHandler::ProtectItemL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApProtHandler::ProtectItemL( CCommsDatabase* aDb,
+                                             TUint32 aUid )
+    {
+    CLOG( ( EProtection, 0, _L( "-> CApProtHandler::ProtectItemL" ) ) );
+
+    if ( ApCommons::GetVariantL() & KApUiEditOnlyVPNs )
+        {
+        User::Leave( KErrNotSupported );
+        }
+#ifdef __TEST_CDMA_WRITE_PROTECT
+    User::Leave( KErrNotSupported );
+#endif // __TEST_CDMA_WRITE_PROTECT
+
+    ProtectRecordL( aDb, TPtrC(WAP_ACCESS_POINT), aUid );
+    
+    CLOG( ( EProtection, 1, _L( "<- CApProtHandler::ProtectItemL" ) ) );
+    }
+
+
+// ---------------------------------------------------------
+// CApProtHandler::UnprotectItemL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApProtHandler::UnprotectItemL( CCommsDatabase* aDb,
+                                               TUint32 aUid )
+    {
+    CLOG( ( EProtection, 0, _L( "-> CApProtHandler::UnprotectItemL" ) ) );
+
+    if ( ApCommons::GetVariantL() & KApUiEditOnlyVPNs )
+        {
+        User::Leave( KErrNotSupported );
+        }
+#ifdef __TEST_CDMA_WRITE_PROTECT
+    User::Leave( KErrNotSupported );
+#endif // __TEST_CDMA_WRITE_PROTECT
+
+    UnprotectRecordL( aDb, TPtrC(WAP_ACCESS_POINT), aUid );
+    
+    CLOG( ( EProtection, 1, _L( "<- CApProtHandler::UnprotectItemL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApProtHandler::ProtectTableL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApProtHandler::ProtectTableL( CCommsDatabase* aDb )
+    {
+    CLOG( ( EProtection, 0, _L( "-> CApProtHandler::ProtectTableL" ) ) );
+
+    if ( ApCommons::GetVariantL() & KApUiEditOnlyVPNs )
+        {
+        User::Leave( KErrNotSupported );
+        }
+#ifdef __TEST_CDMA_WRITE_PROTECT
+    User::Leave( KErrNotSupported );
+#endif // __TEST_CDMA_WRITE_PROTECT
+
+    ProtectTableL( aDb, TPtrC(WAP_ACCESS_POINT) );
+    
+    CLOG( ( EProtection, 1, _L( "<- CApProtHandler::ProtectTableL" ) ) );
+    }
+
+
+// ---------------------------------------------------------
+// CApProtHandler::UnprotectTableL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApProtHandler::UnprotectTableL( CCommsDatabase* aDb )
+    {
+    CLOG( ( EProtection, 0, _L( "-> CApProtHandler::UnprotectTableL" ) ) );
+
+    if ( ApCommons::GetVariantL() & KApUiEditOnlyVPNs )
+        {
+        User::Leave( KErrNotSupported );
+        }
+#ifdef __TEST_CDMA_WRITE_PROTECT
+    User::Leave( KErrNotSupported );
+#endif // __TEST_CDMA_WRITE_PROTECT
+
+    UnprotectTableL( aDb, TPtrC(WAP_ACCESS_POINT) );
+
+    CLOG( ( EProtection, 1, _L( "<- CApProtHandler::UnprotectTableL" ) ) );
+    }
+
+
+// ---------------------------------------------------------
+// CApProtHandler::IsPreferencesProtectedL
+// ---------------------------------------------------------
+//
+EXPORT_C TBool CApProtHandler::IsPreferencesProtectedL( CCommsDatabase* aDb )
+    {
+    CLOG( ( EProtection, 0, 
+        _L( "-> CApProtHandler::IsPreferencesProtectedL" ) ) );
+
+    CCommsDatabase* db = aDb;
+    if ( !aDb )
+        {
+        // create DB object
+        db = CCommsDatabase::NewL( ETrue );
+        CleanupStack::PushL( db );
+        }
+
+    CCommsDbProtectConnectPrefTableView* table = 
+        STATIC_CAST( CCommsDbProtectConnectPrefTableView*, 
+                     db->OpenConnectionPrefTableLC());
+
+    TInt err = table->GotoFirstRecord();
+    if ( err != KErrNotFound )
+        {
+        User::LeaveIfError( err );
+        }
+
+    RDbRowSet::TAccess access;
+    User::LeaveIfError( table->GetTableAccess( access ) ); 
+    CleanupStack::PopAndDestroy( table ); 
+    if ( !aDb )
+        {
+        CleanupStack::PopAndDestroy( db ); //db
+        }
+    
+    //access is EUpdatable if record is updatable
+    TBool retval( !(access == RDbRowSet::EUpdatable) );
+
+    CLOG( ( EProtection, 1, 
+        _L( "<- CApProtHandler::IsPreferencesProtectedL" ) ) );
+    return retval;
+    }
+
+
+// ---------------------------------------------------------
+// CApProtHandler::ProtectPreferencesL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApProtHandler::ProtectPreferencesL( CCommsDatabase* aDb )
+    {
+    CLOG( ( EProtection, 0, _L( "-> CApProtHandler::ProtectPreferencesL" ) ) );
+
+    if ( ApCommons::GetVariantL() & KApUiEditOnlyVPNs )
+        {
+        User::Leave( KErrNotSupported );
+        }
+#ifdef __TEST_CDMA_WRITE_PROTECT
+    User::Leave( KErrNotSupported );
+#endif // __TEST_CDMA_WRITE_PROTECT
+
+    CCommsDatabase* db = aDb;
+    if ( !aDb )
+        {
+        // create DB object
+        db = CCommsDatabase::NewL( ETrue );
+        CleanupStack::PushL( db );
+        }
+
+    CCommsDbProtectConnectPrefTableView* table = 
+        STATIC_CAST( CCommsDbProtectConnectPrefTableView*, 
+                     db->OpenConnectionPrefTableLC());
+
+    User::LeaveIfError( table->GotoFirstRecord() );
+    User::LeaveIfError( table->ProtectTable() );
+    
+    CleanupStack::PopAndDestroy( table ); 
+
+    if ( !aDb )
+        {
+        CleanupStack::PopAndDestroy( db ); //db
+        }
+
+    CLOG( ( EProtection, 1, _L( "<- CApProtHandler::ProtectPreferencesL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApProtHandler::UnprotectPreferencesL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApProtHandler::UnprotectPreferencesL( CCommsDatabase* aDb )
+    {
+    CLOG( ( EProtection, 0, 
+        _L( "-> CApProtHandler::UnprotectPreferencesL" ) ) );
+
+    if ( ApCommons::GetVariantL() & KApUiEditOnlyVPNs )
+        {
+        User::Leave( KErrNotSupported );
+        }
+#ifdef __TEST_CDMA_WRITE_PROTECT
+    User::Leave( KErrNotSupported );
+#endif // __TEST_CDMA_WRITE_PROTECT
+
+    CCommsDatabase* db = aDb;
+    if ( !aDb )
+        {
+        // create DB object
+        db = CCommsDatabase::NewL( ETrue );
+        CleanupStack::PushL( db );
+        }
+    CCommsDbProtectConnectPrefTableView* table = 
+        STATIC_CAST( CCommsDbProtectConnectPrefTableView*, 
+                     db->OpenConnectionPrefTableLC());
+
+    User::LeaveIfError( table->GotoFirstRecord() );
+    User::LeaveIfError( table->UnprotectTable() );
+    
+    CleanupStack::PopAndDestroy( table );
+    if ( !aDb )
+        {
+        CleanupStack::PopAndDestroy( db ); //db
+        }
+    
+    CLOG( ( EProtection, 1, 
+        _L( "<- CApProtHandler::UnprotectPreferencesL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApProtHandler::RemoveProtectedAccessPointsL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApProtHandler::RemoveProtectedAccessPointsL(
+                                          CCommsDatabase* aDb)
+    {
+    CLOG( ( EProtection, 0, 
+        _L( "-> CApProtHandler::RemoveProtectedAccessPointsL" ) ) );
+
+    if ( ApCommons::GetVariantL() & KApUiEditOnlyVPNs )
+        {
+        User::Leave( KErrNotSupported );
+        }
+#ifdef __TEST_CDMA_WRITE_PROTECT
+    User::Leave( KErrNotSupported );
+#endif // __TEST_CDMA_WRITE_PROTECT
+
+    CCommsDatabase* db;
+    if ( !aDb )
+        {
+        // create DB object
+        db = CCommsDatabase::NewL( ETrue );
+        CleanupStack::PushL( db );
+        }
+    else
+        {
+        db = aDb;
+        }
+    DoRemoveProtectedAccessPointsL( *db );
+
+    if ( !aDb )
+        {
+        CleanupStack::PopAndDestroy( db ); // db
+        }
+
+    CLOG( ( EProtection, 1, 
+        _L( "<- CApProtHandler::RemoveProtectedAccessPointsL" ) ) );
+    }
+
+// ================== OTHER MEMBER FUNCTIONS ===============
+
+
+
+
+
+// ---------------------------------------------------------
+// CApProtHandler::IsRecordProtectedL
+// ---------------------------------------------------------
+//
+TBool CApProtHandler::IsRecordProtectedL( CCommsDatabase* aDb,
+                                            const TDesC& aTable,
+                                            TUint32 aUid )
+    {
+    CLOG( ( EProtection, 0, _L( "-> CApProtHandler::IsRecordProtectedL" ) ) );
+
+    CCommsDatabase* db = aDb;
+    if ( !aDb )
+        {
+        // create DB object
+        db = CCommsDatabase::NewL( ETrue );
+        CleanupStack::PushL( db );
+        }
+
+    TBool ownTransaction = ApCommons::StartPushedTransactionLC( *db, ETrue );
+
+    CCommsDbProtectTableView* view =
+        (CCommsDbProtectTableView*)db->OpenViewMatchingUintLC
+                                             (
+                                              aTable,
+                                              TPtrC(COMMDB_ID),
+                                              aUid
+                                             );
+
+    TInt err = view->GotoFirstRecord();
+    User::LeaveIfError( err );
+
+    TInt prot( EFalse );
+    User::LeaveIfError( view->GetRecordAccess( prot ) );
+
+    CleanupStack::PopAndDestroy( view ); // view
+
+    if ( ownTransaction )
+        {
+        ApCommons::CommitTransaction( *db );
+        CleanupStack::Pop(); // RollbackTransactionOnLeave
+        }
+
+    if ( !aDb )
+        {
+        CleanupStack::PopAndDestroy( db ); // db
+        }
+        
+    CLOG( ( EProtection, 1, _L( "<- CApProtHandler::IsRecordProtectedL" ) ) );
+    return prot;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApProtHandler::ProtectRecordL
+// ---------------------------------------------------------
+//
+void CApProtHandler::ProtectRecordL( CCommsDatabase* aDb,
+                                    const TDesC& aTable, TUint32 aUid )
+    {
+    CLOG( ( EProtection, 0, _L( "-> CApProtHandler::ProtectRecordL" ) ) );
+
+    if ( ApCommons::GetVariantL() & KApUiEditOnlyVPNs )
+        {
+        User::Leave( KErrNotSupported );
+        }
+#ifdef __TEST_CDMA_WRITE_PROTECT
+    User::Leave( KErrNotSupported );
+#endif // __TEST_CDMA_WRITE_PROTECT
+
+    CCommsDatabase* db = aDb;
+    if ( !aDb )
+        {
+        // create DB object
+        db = CCommsDatabase::NewL( ETrue );
+        CleanupStack::PushL( db );
+        }
+    TBool ownTransaction = ApCommons::StartPushedTransactionLC( *db, ETrue );
+
+    CCommsDbProtectTableView* view =
+        (CCommsDbProtectTableView*)db->OpenViewMatchingUintLC
+                                                (
+                                                 aTable,
+                                                 TPtrC(COMMDB_ID),
+                                                 aUid
+                                                );
+
+    TInt err = view->GotoFirstRecord();
+    User::LeaveIfError( err );
+
+    User::LeaveIfError( view->ProtectRecord() );
+
+    CleanupStack::PopAndDestroy( view ); // view
+
+    if ( ownTransaction )
+        {
+        ApCommons::CommitTransaction( *db );
+        CleanupStack::Pop(); // RollbackTransactionOnLeave
+        }
+
+    if ( !aDb )
+        {
+        CleanupStack::PopAndDestroy( db ); // db
+        }
+    
+    CLOG( ( EProtection, 1, _L( "<- CApProtHandler::ProtectRecordL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApProtHandler::UnprotectRecordL
+// ---------------------------------------------------------
+//
+void CApProtHandler::UnprotectRecordL( CCommsDatabase* aDb,
+                                      const TDesC& aTable, TUint32 aUid )
+    {
+    CLOG( ( EProtection, 0, _L( "-> CApProtHandler::UnprotectRecordL" ) ) );
+
+    if ( ApCommons::GetVariantL() & KApUiEditOnlyVPNs )
+        {
+        User::Leave( KErrNotSupported );
+        }
+#ifdef __TEST_CDMA_WRITE_PROTECT
+    User::Leave( KErrNotSupported );
+#endif // __TEST_CDMA_WRITE_PROTECT
+
+    CCommsDatabase* db = aDb;
+    if ( !aDb )
+        {
+        // create DB object
+        db = CCommsDatabase::NewL( ETrue );
+        CleanupStack::PushL( db );
+        }
+    TBool ownTransaction = ApCommons::StartPushedTransactionLC( *db, ETrue );
+
+    CCommsDbProtectTableView* view =
+        (CCommsDbProtectTableView*)db->OpenViewMatchingUintLC
+                                             (
+                                              aTable,
+                                              TPtrC(COMMDB_ID),
+                                              aUid
+                                             );
+
+    TInt err = view->GotoFirstRecord();
+    User::LeaveIfError( err );
+
+    User::LeaveIfError( view->UnprotectRecord() );
+
+    CleanupStack::PopAndDestroy( view ); // view
+
+    if ( ownTransaction )
+        {
+        ApCommons::CommitTransaction( *db );
+        CleanupStack::Pop(); // RollbackTransactionOnLeave
+        }
+
+    if ( !aDb )
+        {
+        CleanupStack::PopAndDestroy( db ); // db
+        }
+
+    CLOG( ( EProtection, 1, _L( "<- CApProtHandler::UnprotectRecordL" ) ) );
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CApProtHandler::IsTableProtectedL
+// ---------------------------------------------------------
+//
+TBool CApProtHandler::IsTableProtectedL( CCommsDatabase* aDb,
+                                               const TDesC& aTable )
+    {
+    CLOG( ( EProtection, 0, 
+        _L( "-> CApProtHandler::IsTableProtectedL(table)" ) ) );
+
+    TBool retval( EFalse );
+    CCommsDatabase* db = aDb;
+    if ( !aDb )
+        {
+        // create DB object
+        db = CCommsDatabase::NewL( ETrue );
+        CleanupStack::PushL( db );
+        }
+    TBool ownTransaction = ApCommons::StartPushedTransactionLC( *db, ETrue );
+
+    CCommsDbProtectTableView* view =
+        (CCommsDbProtectTableView*)db->OpenTableLC( aTable );
+
+    RDbRowSet::TAccess aAccessType( RDbRowSet::EUpdatable );
+    
+    User::LeaveIfError( view->GetTableAccess( aAccessType) );
+    
+    if ( aAccessType == RDbRowSet::EUpdatable )
+        {
+        retval = EFalse;
+        }
+    else
+        { // EReadOnly, EInsertOnly
+        retval = ETrue;
+        }
+
+    CleanupStack::PopAndDestroy( view ); // view
+
+    if ( ownTransaction )
+        {
+        ApCommons::CommitTransaction( *db );
+        CleanupStack::Pop(); // RollbackTransactionOnLeave
+        }
+
+    if ( !aDb )
+        {
+        CleanupStack::PopAndDestroy( db ); // db
+        }
+    
+    CLOG( ( EProtection, 1, 
+        _L( "<- CApProtHandler::IsTableProtectedL(table)" ) ) );
+    return retval;
+    }
+
+
+// ---------------------------------------------------------
+// CApProtHandler::ProtectTableL
+// ---------------------------------------------------------
+//
+void CApProtHandler::ProtectTableL( CCommsDatabase* aDb,
+                                     const TDesC& aTable )
+    {
+    CLOG( ( EProtection, 0, 
+        _L( "-> CApProtHandler::ProtectTableL(table)" ) ) );
+
+    if ( ApCommons::GetVariantL() & KApUiEditOnlyVPNs )
+        {
+        User::Leave( KErrNotSupported );
+        }
+#ifdef __TEST_CDMA_WRITE_PROTECT
+    User::Leave( KErrNotSupported );
+#endif // __TEST_CDMA_WRITE_PROTECT
+
+    CCommsDatabase* db = aDb;
+    if ( !aDb )
+        {
+        // create DB object
+        db = CCommsDatabase::NewL( ETrue );
+        CleanupStack::PushL( db );
+        }
+
+    CCommsDbProtectTableView* view =
+        (CCommsDbProtectTableView*)db->OpenTableLC( aTable );
+
+    TInt err = view->GotoFirstRecord();
+    User::LeaveIfError( err );
+
+    User::LeaveIfError( view->ProtectTable() );
+
+    CleanupStack::PopAndDestroy( view ); // view
+
+    if ( !aDb )
+        {
+        CleanupStack::PopAndDestroy( db ); //db
+        }
+
+    CLOG( ( EProtection, 1, 
+        _L( "<- CApProtHandler::ProtectTableL(table)" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApProtHandler::UnprotectTableL
+// ---------------------------------------------------------
+//
+void CApProtHandler::UnprotectTableL( CCommsDatabase* aDb,
+                                       const TDesC& aTable )
+    {
+    CLOG( ( EProtection, 0, 
+        _L( "-> CApProtHandler::UnprotectTableL(table)" ) ) );
+
+    if ( ApCommons::GetVariantL() & KApUiEditOnlyVPNs )
+        {
+        User::Leave( KErrNotSupported );
+        }
+#ifdef __TEST_CDMA_WRITE_PROTECT
+    User::Leave( KErrNotSupported );
+#endif // __TEST_CDMA_WRITE_PROTECT
+
+    CCommsDatabase* db = aDb;
+    if ( !aDb )
+        {
+        // create DB object
+        db = CCommsDatabase::NewL( ETrue );
+        CleanupStack::PushL( db );
+        }
+//    Follow related error rep. and act accordingly:
+//    JBAH-58FCHH
+//    TBool ownTransaction = ApCommons::StartPushedTransactionLC( *db, ETrue );
+
+    CCommsDbProtectTableView* view =
+        (CCommsDbProtectTableView*)db->OpenTableLC( aTable );
+
+
+    TInt err = view->GotoFirstRecord();
+    // If not found, no problem, Unprotect will be carried out correctly
+    // But if no GotoFirstRecord, and no records, it will Panic...
+    if ( err != KErrNotFound )
+        {
+        User::LeaveIfError( err );
+        }
+
+    User::LeaveIfError( view->UnprotectTable() );
+
+    CleanupStack::PopAndDestroy( view ); // view
+
+
+/*
+    if ( ownTransaction )
+        {
+        ApCommons::CommitTransaction( *db );
+        CleanupStack::Pop(); // RollbackTransactionOnLeave
+        }
+*/
+    if ( !aDb )
+        {
+        CleanupStack::PopAndDestroy( db ); // db
+        }
+
+    CLOG( ( EProtection, 1, 
+        _L( "<- CApProtHandler::UnprotectTableL(table)" ) ) );
+    }
+
+
+// ---------------------------------------------------------
+// CApProtHandler::GetProtectionStateL
+// ---------------------------------------------------------
+//
+TBool CApProtHandler::GetProtectionStateL( CCommsDbTableView& aTable )
+    {
+    CLOG( ( EProtection, 0, _L( "-> CApProtHandler::GetProtectionStateL" ) ) );
+
+    TInt aAccess( 0 );
+    User::LeaveIfError(
+        ( (CCommsDbProtectTableView*) &aTable )->GetRecordAccess( aAccess ) );
+    
+    CLOG( ( EProtection, 1, _L( "<- CApProtHandler::GetProtectionStateL" ) ) );
+    return aAccess;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApProtHandler::DoRemoveProtectedAccessPointsL
+// ---------------------------------------------------------
+//
+void CApProtHandler::DoRemoveProtectedAccessPointsL(
+                                          CCommsDatabase& aDb)
+    {
+    CLOG( ( EProtection, 0, 
+        _L( "-> CApProtHandler::DoRemoveProtectedAccessPointsL" ) ) );
+
+    if ( ApCommons::GetVariantL() & KApUiEditOnlyVPNs )
+        {
+        User::Leave( KErrNotSupported );
+        }
+#ifdef __TEST_CDMA_WRITE_PROTECT
+    User::Leave( KErrNotSupported );
+#endif // __TEST_CDMA_WRITE_PROTECT
+
+    // TRANSACTION STARTING IS REMOVED UNTIL ERROR 
+    // JBAH-58FCHH IS CORRECTED BY SYMBIAN
+    // start a transaction, just to make sure
+//    TBool ownTransaction = ApCommons::StartPushedTransactionLC( aDb, ETrue );
+    
+    // make AP table updatable
+    UnprotectTableL( &aDb );
+
+    // remove all protected AP
+    // first get a list of current AP-s
+    CApListItemList* list = new( ELeave )CApListItemList();
+    CleanupStack::PushL( list );
+    CApDataHandler* handler = CApDataHandler::NewLC( aDb );
+    CApSelect* sel = 
+        CApSelect::NewLC( aDb, KEApIspTypeAll, EApBearerTypeAllBearers,
+                         KEApSortNameAscending);
+    sel->AllListItemDataL( *list );
+    // now get protected ones and delete them
+    TInt count( list->Count() );
+    for( TInt i = 0; i<count; i++)
+        {
+        if ( list->At( i )->IsReadOnly() )
+            {
+            UnprotectItemL( &aDb, list->At( i )->Uid() );
+            handler->RemoveAPL( list->At( i )->Uid() );
+            }
+        }
+    CleanupStack::PopAndDestroy( 3, list ); // sel, handler, list
+
+/*
+    if ( ownTransaction )
+        {
+        ApCommons::CommitTransaction( *aDb );
+        CleanupStack::Pop(); // RollbackTransactionOnLeave
+        }
+*/
+    
+    CLOG( ( EProtection, 1, 
+        _L( "<- CApProtHandler::DoRemoveProtectedAccessPointsL" ) ) );
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apeng/src/VpnApEngine.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,1403 @@
+/*
+* Copyright (c) 2002 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 the CVpnApEngine class.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include    "VpnApEngine.h"
+#include    "VpnApItem.h"
+#include    "ApEngineLogger.h"
+#include    "ApEngineConsts.h"
+#include    "ApEngineCommons.h"
+
+#include    <ApDataHandler.h>
+#include    <ApAccessPointItem.h>
+#include    <ApUtils.h>
+
+#include    <txtetext.h>
+
+#include    <vpnapi.h>
+#include    <vpnapidefs.h>
+
+
+// CONSTANTS
+_LIT( KVpnVirtualBearerName, "vpnbearer" );
+_LIT( KVpnVirtualBearerAgent, "vpnconnagt.agt" );
+_LIT( KVpnVirtualBearerNif, "tunnelnif" );
+_LIT( KDefProxyProtocolName, "http" );                      // required !
+_LIT( KDefWapGatewayIpAddress, "0.0.0.0" );
+
+
+
+// constatnts needed for the virtualbearer table
+const TInt KNoTimeout = -1;
+const TUint32 KLastSessionTimeout = 3;
+
+
+// ================= MEMBER FUNCTIONS =======================
+// ---------------------------------------------------------
+// CVpnApEngine::NewLC
+// ---------------------------------------------------------
+//
+EXPORT_C CVpnApEngine* CVpnApEngine::NewLC( CCommsDatabase* aDb )
+    {
+    CLOG( ( EApItem, 0, _L( "-> CVpnApEngine::NewL" ) ) );
+
+    CVpnApEngine* self = new ( ELeave ) CVpnApEngine;
+    CleanupStack::PushL( self );
+    self->ConstructL( aDb );
+
+    CLOG( ( EApItem, 1, _L( "<- CVpnApEngine::NewL" ) ) );
+    
+    return self;
+    }
+
+
+// ---------------------------------------------------------
+// CVpnApEngine::~CVpnApEngine
+// ---------------------------------------------------------
+//
+EXPORT_C CVpnApEngine::~CVpnApEngine()
+    {
+    if ( iOwnDb )
+        {
+        delete iDb;
+        }
+
+    CLOG( ( EApItem, 0, _L( "<-> CVpnApEngine::~CVpnApEngine" ) ) );
+    }
+
+        
+// ---------------------------------------------------------
+// CVpnApEngine::ConstructL
+// ---------------------------------------------------------
+//
+EXPORT_C void CVpnApEngine::ConstructL( CCommsDatabase* aDb )
+    {
+    CLOG( ( EApItem, 0, _L( "-> CVpnApEngine::ConstructL" ) ) );
+
+    if ( aDb )
+        {
+        iDb = aDb;
+        iOwnDb = EFalse;
+        }
+    else
+        {
+        iDb = CCommsDatabase::NewL();
+        iOwnDb = ETrue;
+        }
+
+    CLOG( ( EApItem, 0, _L( "<- CVpnApEngine::ConstructL" ) ) );
+    }
+
+
+// ---------------------------------------------------------
+// CVpnApEngine::CVpnApEngine
+// ---------------------------------------------------------
+//
+EXPORT_C CVpnApEngine::CVpnApEngine()
+:iOwnDb( EFalse )
+    {
+    CLOG( ( EApItem, 0, _L( "<-> CVpnApEngine::CVpnApEngine" ) ) );
+
+    }
+
+
+
+// ---------------------------------------------------------
+// CVpnApEngine::CreateVpnApL
+// ---------------------------------------------------------
+//
+EXPORT_C TUint32 CVpnApEngine::CreateVpnApL( CVpnApItem& aVpnApItem )
+    {
+    CLOG( ( EApItem, 0, _L( "-> CVpnApEngine::CreateVpnApL" ) ) );
+
+    TUint32 retval( 0 );
+
+    // Start  a transaction
+    TBool ownTransaction = ApCommons::StartPushedTransactionLC( *iDb );
+    
+    retval = DoCreateVpnApL( ETrue, aVpnApItem );
+
+    if ( ownTransaction )
+        {
+        ApCommons::CommitTransaction( *iDb );
+        CleanupStack::Pop(); // RollbackTransactionOnLeave
+        }
+
+
+
+    CLOG( ( EApItem, 1, _L( "<- CVpnApEngine::CreateVpnApL" ) ) );
+
+    return retval;
+    }
+
+
+
+
+
+// ---------------------------------------------------------
+// CVpnApEngine::CreateVpnL
+// ---------------------------------------------------------
+//
+EXPORT_C TUint32 CVpnApEngine::CreateVpnApL(  TDesC& aName, 
+                                              TUint32 aIapId, 
+                                              TDesC& aPolicy, 
+                                              TDesC* aProxyServerAddress, 
+                                              TUint32 aProxyPort )
+    {
+    CLOG( ( EApItem, 0, _L( "-> CVpnApEngine::CreateVpnApL..." ) ) );
+    TUint32 retval( 0 );
+
+    CVpnApItem* item = CVpnApItem::NewLC();
+
+    item->WriteTextL( EApVpnWapAccessPointName, aName );
+    item->WriteUint( EApVpnRealIapID, aIapId );
+    item->WriteTextL( EApVpnPolicyId, aPolicy );
+    item->WriteLongTextL( EApVpnProxyServerAddress, *aProxyServerAddress );
+    item->WriteUint( EApVpnProxyPortNumber, aProxyPort );
+    
+    
+    RVpnServ ps;
+    User::LeaveIfError( ps.Connect() );
+    CleanupClosePushL<RVpnServ>( ps );
+    
+    TVpnPolicyDetails det;
+
+    TVpnPolicyName pName( aPolicy );
+
+    TInt err = ps.GetPolicyDetails( pName, det );
+   
+    // When the policy is deleted (err!=0):
+    // have this leave, in UI display a note about needing to be reconfigured
+    // & set it & policyID to none to look like there is NO policy
+    // which will force the reconfiguration if in the UI
+    User::LeaveIfError( err );
+
+    item->WriteTextL( EApVpnPolicy, det.iName );
+
+    CreateVpnApL( *item );
+
+    CleanupStack::PopAndDestroy(); // ps
+
+    CleanupStack::PopAndDestroy( item );
+
+    CLOG( ( EApItem, 1, _L( "<- CVpnApEngine::CreateVpnApL..." ) ) );
+
+    return retval;
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CVpnApEngine::DeleteVpnL
+// ---------------------------------------------------------
+//
+EXPORT_C void CVpnApEngine::DeleteVpnL( TUint32 aVpnApId )
+    {
+    CLOG( ( EApItem, 0, _L( "-> CVpnApEngine::DeleteVpnL" ) ) );
+
+    TBool ownTransaction = ApCommons::StartPushedTransactionLC( *iDb );
+    DoDeleteVpnL( aVpnApId );
+    if ( ownTransaction )
+        {
+        ApCommons::CommitTransaction( *iDb );
+        CleanupStack::Pop(); // RollbackTransactionOnLeave
+        }
+
+    CLOG( ( EApItem, 1, _L( "<- CVpnApEngine::DeleteVpnL" ) ) );
+    }
+
+
+
+
+
+
+// ---------------------------------------------------------
+// CVpnApEngine::VpnDataL
+// ---------------------------------------------------------
+//
+EXPORT_C void CVpnApEngine::VpnDataL( TUint32 aUid, 
+                                      CVpnApItem& aVpnApItem )
+    {
+    CLOG( ( EApItem, 0, _L( "-> CVpnApEngine::VpnDataL" ) ) );
+
+    ReadVpnWapBearerDataL( aUid, aVpnApItem );
+    ReadVpnWapApDataL( aVpnApItem );
+    ReadVpnIapRecordL( aVpnApItem );
+    ReadNetworkDataL( aVpnApItem );
+    ReadVpnDataL( aVpnApItem );
+    ReadProxyDataL( aVpnApItem );
+
+    CLOG( ( EApItem, 1, _L( "<- CVpnApEngine::VpnDataL" ) ) );
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CVpnApEngine::UpdateVpnDataL
+// ---------------------------------------------------------
+//
+EXPORT_C void CVpnApEngine::UpdateVpnDataL( CVpnApItem& aVpnApItem )
+    {
+    CLOG( ( EApItem, 0, _L( "-> CVpnApEngine::UpdateVpnDataL" ) ) );
+
+    // Start  a transaction
+    TBool ownTransaction = ApCommons::StartPushedTransactionLC( *iDb );
+    
+    // ignore return value as it is used only when creating new
+    DoCreateVpnApL( EFalse, aVpnApItem );
+
+    if ( ownTransaction )
+        {
+        ApCommons::CommitTransaction( *iDb );
+        CleanupStack::Pop(); // RollbackTransactionOnLeave
+        }
+
+    CLOG( ( EApItem, 1, _L( "<- CVpnApEngine::UpdateVpnDataL" ) ) );
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CVpnApEngine::IsVpnApL()
+// ---------------------------------------------------------
+//
+EXPORT_C TBool CVpnApEngine::IsVpnApL( const TUint32 aUid )
+    {
+    CLOG( ( EApItem, 0, _L( "-> CVpnApEngine::IsVpnApL" ) ) );
+
+    TBool retval( EFalse );
+    // Start  a transaction
+    TBool ownTransaction = ApCommons::StartPushedTransactionLC( *iDb );
+    
+    CCommsDbTableView* wapt;
+    wapt = iDb->OpenViewMatchingUintLC( TPtrC(WAP_IP_BEARER),
+                                       TPtrC(WAP_ACCESS_POINT_ID), aUid );
+    User::LeaveIfError( wapt->GotoFirstRecord() );
+
+    TUint32 iapid( 0 );
+    ApCommons::ReadUintL( wapt, TPtrC(WAP_IAP), iapid );
+    
+
+    
+    CCommsDbTableView* iapt;
+    iapt = iDb->OpenViewMatchingUintLC( TPtrC(IAP),
+                                       TPtrC(COMMDB_ID), iapid );
+    User::LeaveIfError( iapt->GotoFirstRecord() );
+
+    HBufC* iapServiceType = ApCommons::ReadText16ValueLC
+                                    (
+                                    iapt,
+                                    TPtrC(IAP_SERVICE_TYPE)
+                                    );
+
+    retval = ( iapServiceType->Compare( TPtrC(VPN_SERVICE) ) == 0 );
+
+    CleanupStack::PopAndDestroy( iapServiceType ); // iapServiceType 
+
+    CleanupStack::PopAndDestroy( iapt ); // iapt
+    
+    CleanupStack::PopAndDestroy( wapt ); // wapt
+
+    if ( ownTransaction )
+        {
+        ApCommons::CommitTransaction( *iDb );
+        CleanupStack::Pop(); // RollbackTransactionOnLeave
+        }
+
+    CLOG( ( EApItem, 1, _L( "<- CVpnApEngine::IsVpnApL" ) ) );
+
+    return retval;
+    }
+
+
+
+// ---------------------------------------------------------
+// CVpnApEngine::Cvt()
+// ---------------------------------------------------------
+//
+EXPORT_C TInt CVpnApEngine::Cvt()
+    {
+    return KErrNone;
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CVpnApEngine::DoCreateVpnApL
+// ---------------------------------------------------------
+//
+TUint32 CVpnApEngine::DoCreateVpnApL( TBool aIsNew, CVpnApItem& aVpnApItem )
+    {
+    CLOG( ( EApItem, 0, _L( "-> CVpnApEngine::DoCreateVpnApL" ) ) );
+
+    // internal function, caller MUST initiate a transaction, WE WILL NOT.
+    // create 1 single virtual bearer if not already present
+    // Create a new VPN access point (WAP, etc. with VPN IAP
+    // Create a new VPN record in VPN table
+    
+    CApUtils* util = CApUtils::NewLC( *iDb );        
+    TBool valid = 
+            util->IsValidNameL( *aVpnApItem.iName, aVpnApItem.iVpnWapId );
+    CleanupStack::PopAndDestroy( util );
+
+    if ( !valid )
+        {
+        User::Leave( KErrAlreadyExists );
+        }
+
+    WriteVpnDataL( aIsNew, aVpnApItem );
+    TUint32 virtbearerid = CreateVirtBearerIfNeededL();
+    aVpnApItem.iVirtualBearerID = virtbearerid;
+    WriteNetworkDataL( aIsNew, aVpnApItem );
+    WriteVpnIapRecordL( aIsNew, aVpnApItem );
+ 
+    WriteVpnWapApDataL( aIsNew, aVpnApItem );
+    WriteVpnWapBearerDataL( aIsNew, aVpnApItem );
+    if ( aVpnApItem.HasProxy() )
+        {
+        WriteProxyDataL( aIsNew, aVpnApItem );
+        }
+    else
+        {
+        if ( !aIsNew )
+            {
+            CCommsDbTableView* iapt;
+            iapt = iDb->OpenViewMatchingUintLC( TPtrC(IAP), TPtrC(COMMDB_ID),
+                                                aVpnApItem.iVpnIapId );
+
+            User::LeaveIfError( iapt->GotoFirstRecord() );
+            HBufC* servicetype = HBufC::NewLC( KCommsDbSvrMaxFieldLength );
+            TPtr servptr( servicetype->Des() );
+            iapt->ReadTextL( TPtrC(IAP_SERVICE_TYPE), servptr );
+
+            TRAP_IGNORE( RemoveVpnProxyDataL( aVpnApItem.iVpnTableId ) );
+
+            CleanupStack::PopAndDestroy( servicetype );
+            CleanupStack::PopAndDestroy( iapt );
+            }
+        }
+    
+    CLOG( ( EApItem, 0, _L( "<- CVpnApEngine::DoCreateVpnApL" ) ) );
+
+    return aVpnApItem.iVpnWapId;
+    }
+
+
+// ---------------------------------------------------------
+// CVpnApEngine::WriteVpnDataL
+// ---------------------------------------------------------
+//
+void CVpnApEngine::WriteVpnDataL( TBool aIsNew, CVpnApItem& aVpnApItem )
+    {
+    CLOG( ( EApItem, 0, _L( "-> CVpnApEngine::WriteVpnDataL" ) ) );
+
+    // internal function, caller MUST initiate a transaction, WE WILL NOT.
+    CCommsDbTableView* t;
+
+    if ( aIsNew )
+        {
+        t = iDb->OpenTableLC( TPtrC(VPN_SERVICE) );
+        TInt err = t->InsertRecord( aVpnApItem.iVpnTableId );
+        if ( err )
+            {
+            User::LeaveIfError( err );
+            }
+        }
+    else
+        {
+        t = iDb->OpenViewMatchingUintLC( TPtrC(VPN_SERVICE),
+                                         TPtrC(COMMDB_ID), 
+                                         aVpnApItem.iVpnTableId );
+        User::LeaveIfError( t->GotoFirstRecord() );
+        User::LeaveIfError( t->UpdateRecord() );
+        }
+
+    t->WriteTextL( TPtrC(COMMDB_NAME), *aVpnApItem.iName );
+    
+    t->WriteTextL( TPtrC(VPN_SERVICE_POLICY), *aVpnApItem.iPolicyId );
+
+    t->WriteUintL( TPtrC(VPN_SERVICE_IAP), aVpnApItem.iRealIapId );
+
+    t->WriteUintL( TPtrC(VPN_SERVICE_NETWORKID), aVpnApItem.iHomeNetwork );
+
+    User::LeaveIfError( t->PutRecordChanges( EFalse, EFalse ) );
+
+    CleanupStack::PopAndDestroy( t );   // t
+
+    CLOG( ( EApItem, 0, _L( "<- CVpnApEngine::WriteVpnDataL" ) ) );
+
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CVpnApEngine::CreateVirtBearerIfNeededL
+// ---------------------------------------------------------
+//
+TUint32 CVpnApEngine::CreateVirtBearerIfNeededL()
+    {
+    CLOG( ( EApItem, 0, _L( "-> CVpnApEngine::CreateVirtBearerIfNeededL" ) ) );
+    
+    TUint32 retval( 0 );
+
+    CCommsDbTableView* t = NULL;
+
+    t = iDb->OpenViewMatchingTextLC( TPtrC(VIRTUAL_BEARER), 
+                                     TPtrC(VIRTUAL_BEARER_AGENT), 
+                                     KVpnVirtualBearerAgent );
+    if ( t->GotoFirstRecord() == KErrNotFound )
+        { // no such yet, create one
+        TInt err = t->InsertRecord( retval );
+        if ( err )
+            {
+            User::LeaveIfError( err );
+            }        
+        t->WriteTextL( TPtrC(COMMDB_NAME), KVpnVirtualBearerName );
+        t->WriteTextL( TPtrC(VIRTUAL_BEARER_AGENT), KVpnVirtualBearerAgent );
+        t->WriteTextL( TPtrC(VIRTUAL_BEARER_NIF), KVpnVirtualBearerNif );
+
+        t->WriteUintL( TPtrC(LAST_SOCKET_ACTIVITY_TIMEOUT), 
+                       (TUint32)KNoTimeout ); 
+        t->WriteUintL( TPtrC(LAST_SESSION_CLOSED_TIMEOUT), 
+                       KLastSessionTimeout ); 
+        t->WriteUintL( TPtrC(LAST_SOCKET_CLOSED_TIMEOUT), 
+                       (TUint32)KNoTimeout ); 
+
+        User::LeaveIfError( t->PutRecordChanges( EFalse, EFalse ) );
+
+        }
+    else
+        { // there is one, use it
+        t->ReadUintL( TPtrC(COMMDB_ID), retval );
+        }
+
+    CleanupStack::PopAndDestroy( t );   // t
+    
+    CLOG( ( EApItem, 0, _L( "<- CVpnApEngine::CreateVirtBearerIfNeededL" ) ) );
+
+    return retval;
+    }
+
+
+
+// ---------------------------------------------------------
+// CVpnApEngine::WriteVpnIapRecordL
+// ---------------------------------------------------------
+//
+TUint32 CVpnApEngine::WriteVpnIapRecordL( TBool aIsNew, 
+                                          CVpnApItem& aVpnApItem )
+    {
+    CLOG( ( EApItem, 0, _L( "-> CVpnApEngine::WriteVpnIapRecordL" ) ) );
+
+    // internal function, caller MUST initiate a transaction, WE WILL NOT.
+    CCommsDbTableView* t;
+
+    if ( aIsNew )
+        {
+        t = iDb->OpenTableLC( TPtrC(IAP) );
+        TInt err = t->InsertRecord( aVpnApItem.iVpnIapId );
+        if ( err )
+            {
+            User::LeaveIfError( err );
+            }
+        }
+    else
+        {
+        t = iDb->OpenViewMatchingUintLC( TPtrC(IAP),
+                                         TPtrC(COMMDB_ID), 
+                                         aVpnApItem.iVpnIapId );
+        User::LeaveIfError( t->GotoFirstRecord() );
+        User::LeaveIfError( t->UpdateRecord() );
+        }
+
+    t->WriteTextL( TPtrC(COMMDB_NAME), *aVpnApItem.iName );
+
+    t->WriteUintL( TPtrC(IAP_SERVICE), aVpnApItem.iVpnTableId );
+    t->WriteTextL( TPtrC(IAP_SERVICE_TYPE), TPtrC(VPN_SERVICE) );
+
+    // hardcoded...
+    t->WriteTextL( TPtrC(IAP_BEARER_TYPE), TPtrC(VIRTUAL_BEARER) );
+    t->WriteUintL( TPtrC(IAP_BEARER), aVpnApItem.iVirtualBearerID );
+
+    t->WriteUintL( TPtrC(IAP_NETWORK), aVpnApItem.iVpnIapNetwork );
+
+    // Network weighting hardcoded to 0!
+    t->WriteUintL( TPtrC(IAP_NETWORK_WEIGHTING), 0 );
+    
+    TUint32 loc = GetLocationIdL();
+    t->WriteUintL( TPtrC(IAP_LOCATION), loc );
+
+    User::LeaveIfError( t->PutRecordChanges( EFalse, EFalse ) );
+
+    CleanupStack::PopAndDestroy( t );   // t
+
+   
+    CLOG( ( EApItem, 0, _L( "<- CVpnApEngine::WriteVpnIapRecordL" ) ) );
+
+    return aVpnApItem.iVpnIapId;
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CVpnApEngine::GetLocationIdL
+// ---------------------------------------------------------
+//
+TUint32 CVpnApEngine::GetLocationIdL()
+    {
+    // agreed that the location record having the name 'Mobile' is used
+    CLOG( ( EHandler, 0, _L( "-> CVpnApEngine::GetLocationIdL" ) ) );
+
+    CCommsDbTableView* loc;
+    loc = iDb->OpenViewMatchingTextLC( TPtrC(LOCATION), 
+                                       TPtrC(COMMDB_NAME), 
+                                       KLocation );
+    TInt err = loc->GotoFirstRecord();
+
+    User::LeaveIfError( err );
+    TUint32 id( 0 );
+    loc->ReadUintL( TPtrC(COMMDB_ID), id );
+
+    CleanupStack::PopAndDestroy( loc ); // loc
+
+    CLOG( ( EHandler, 1, _L( "<- CVpnApEngine::GetLocationIdL" ) ) );
+    return id;    
+    }
+
+
+
+// ---------------------------------------------------------
+// CVpnApEngine::WriteVpnWapApDataL
+// ---------------------------------------------------------
+//
+void CVpnApEngine::WriteVpnWapApDataL( TBool aIsNew, CVpnApItem& aVpnApItem )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CVpnApEngine::WriteVpnWapApDataL" ) ) );
+
+    // internal function, caller MUST initiate a transaction, WE WILL NOT.
+    CCommsDbTableView* wapt;
+
+    if ( aIsNew )
+        {
+        wapt = iDb->OpenTableLC( TPtrC(WAP_ACCESS_POINT) );
+        TInt err = wapt->InsertRecord( aVpnApItem.iVpnWapId );
+        if ( err )
+            {
+            User::LeaveIfError( err );
+            }
+        // CommDB's back-link makes returned UID value unusable,
+        // variable needed just to be able to make the call...
+        }
+    else
+        {
+        wapt = iDb->OpenViewMatchingUintLC( TPtrC(WAP_ACCESS_POINT),
+                                            TPtrC(COMMDB_ID), 
+                                            aVpnApItem.iVpnWapId );
+        User::LeaveIfError( wapt->GotoFirstRecord() );
+        User::LeaveIfError( wapt->UpdateRecord() );
+        }
+
+    // it is IP_BEARER
+    wapt->WriteTextL( TPtrC(WAP_CURRENT_BEARER), TPtrC(WAP_IP_BEARER) );
+    wapt->WriteTextL( TPtrC(COMMDB_NAME), *aVpnApItem.iName );
+
+    wapt->WriteLongTextL( TPtrC(WAP_START_PAGE), KEmpty );
+
+    User::LeaveIfError( wapt->PutRecordChanges( EFalse, EFalse ) );
+
+    CleanupStack::PopAndDestroy( wapt );   // wapt
+
+    CLOG( ( EHandler, 1, _L( "<- CVpnApEngine::WriteVpnWapApDataL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CVpnApEngine::WriteWapBearerDataL
+// ---------------------------------------------------------
+//
+void CVpnApEngine::WriteVpnWapBearerDataL( TBool aIsNew, 
+                                           CVpnApItem& aVpnApItem )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CVpnApEngine::WriteWapBearerDataL" ) ) );
+
+    // internal function, caller MUST initiate a transaction, WE WILL NOT.
+    CCommsDbTableView* bearert;
+    if ( aIsNew )
+        {
+        bearert = iDb->OpenTableLC( TPtrC(WAP_IP_BEARER) );
+        // CommDB's back-link makes returned UID value unusable,
+        // variable needed just to be able to make the call...
+        TUint32 alma;
+        User::LeaveIfError( bearert->InsertRecord( alma ) );
+        }
+    else
+        {
+        bearert = iDb->OpenViewMatchingUintLC( TPtrC(WAP_IP_BEARER),
+                                               TPtrC(WAP_ACCESS_POINT_ID),
+                                               aVpnApItem.iVpnWapId );
+        User::LeaveIfError( bearert->GotoFirstRecord() );
+        User::LeaveIfError( bearert->UpdateRecord() );
+        }
+    bearert->WriteTextL( TPtrC(WAP_GATEWAY_ADDRESS), KDefWapGatewayIpAddress );
+
+/*
+    bearert->WriteUintL( TPtrC(WAP_WSP_OPTION), 
+                         aApItem.iIsConnectionTypeContinuous );
+    bearert->WriteBoolL( TPtrC(WAP_SECURITY), aApItem.iIsWTLSSecurityOn );
+*/
+    bearert->WriteUintL( TPtrC(WAP_ACCESS_POINT_ID), aVpnApItem.iVpnWapId );
+
+    bearert->WriteUintL( TPtrC(WAP_IAP), aVpnApItem.iVpnIapId );        
+    
+    // Hardcoded to 0
+    bearert->WriteUintL( TPtrC(WAP_PROXY_PORT), 0 );
+
+    User::LeaveIfError( bearert->PutRecordChanges( EFalse, EFalse ) );
+
+    CleanupStack::PopAndDestroy( bearert );   // bearert
+
+    CLOG( ( EHandler, 1, _L( "<- CVpnApEngine::WriteWapBearerDataL" ) ) );
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CVpnApEngine::ReadVpnWapBearerDataL
+// ---------------------------------------------------------
+//
+void CVpnApEngine::ReadVpnWapBearerDataL( TUint32 aUid, 
+                                          CVpnApItem& aVpnApItem )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CVpnApEngine::ReadVpnWapBearerDataL" ) ) );
+
+    // internal function, caller MUST initiate a transaction, WE WILL NOT.
+    CCommsDbTableView* bearert;
+    bearert = iDb->OpenViewMatchingUintLC( TPtrC(WAP_IP_BEARER),
+                                           TPtrC(WAP_ACCESS_POINT_ID),
+                                           aUid );
+    User::LeaveIfError( bearert->GotoFirstRecord() );
+    aVpnApItem.iVpnWapId = aUid;
+    
+    // for vpn, it is not used....
+    // bearert->WriteTextL( TPtrC(WAP_GATEWAY_ADDRESS), KEmpty );
+
+/*
+    bearert->WriteUintL( TPtrC(WAP_WSP_OPTION), 
+                         aApItem.iIsConnectionTypeContinuous );
+    bearert->WriteBoolL( TPtrC(WAP_SECURITY), aApItem.iIsWTLSSecurityOn );
+*/
+
+    // not neccessary, as we already queried for it and set it...
+    // bearert->ReadUintL( TPtrC(WAP_ACCESS_POINT_ID), aVpnApItem.iVpnWapId );
+
+    bearert->ReadUintL( TPtrC(WAP_IAP), aVpnApItem.iVpnIapId );        
+    
+    // Hardcoded to 0, not used, skip it 
+    // bearert->WriteUintL( TPtrC(WAP_PROXY_PORT), 0 );
+
+    CleanupStack::PopAndDestroy( bearert );   // bearert
+
+    CLOG( ( EHandler, 1, _L( "<- CVpnApEngine::ReadVpnWapBearerDataL" ) ) );
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CVpnApEngine::ReadVpnWapApDataL
+// ---------------------------------------------------------
+//
+void CVpnApEngine::ReadVpnWapApDataL( CVpnApItem& aVpnApItem )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CVpnApEngine::ReadVpnWapApDataL" ) ) );
+
+    // internal function, caller MUST initiate a transaction, WE WILL NOT.
+    CCommsDbTableView* wapt;
+
+    wapt = iDb->OpenViewMatchingUintLC( TPtrC(WAP_ACCESS_POINT),
+                                        TPtrC(COMMDB_ID), 
+                                        aVpnApItem.iVpnWapId );
+    User::LeaveIfError( wapt->GotoFirstRecord() );
+
+    // it is IP_BEARER, but as hardcoded, skip it...
+    // wapt->ReadTextL( TPtrC(WAP_CURRENT_BEARER), TPtrC(WAP_IP_BEARER) );
+
+    HBufC* buf = NULL;
+    buf = ApCommons::ReadText16ValueLC( wapt, TPtrC(COMMDB_NAME) );
+    aVpnApItem.WriteTextL( EApVpnWapAccessPointName, *buf );
+    CleanupStack::PopAndDestroy( buf ); // buf
+
+    // HARDCODED, skip it
+    //wapt->WriteLongTextL( TPtrC(WAP_START_PAGE), KEmpty );
+
+    CleanupStack::PopAndDestroy( wapt );   // wapt
+
+    CLOG( ( EHandler, 1, _L( "<- CVpnApEngine::ReadVpnWapApDataL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CVpnApEngine::ReadVpnIapRecordL
+// ---------------------------------------------------------
+//
+void CVpnApEngine::ReadVpnIapRecordL( CVpnApItem& aVpnApItem )
+    {
+    CLOG( ( EApItem, 0, _L( "-> CVpnApEngine::ReadVpnIapRecordL" ) ) );
+
+    // internal function, caller MUST initiate a transaction, WE WILL NOT.
+    CCommsDbTableView* t;
+
+    t = iDb->OpenViewMatchingUintLC( TPtrC(IAP),
+                                     TPtrC(COMMDB_ID), 
+                                     aVpnApItem.iVpnIapId );
+    User::LeaveIfError( t->GotoFirstRecord() );
+
+    // Name is already set from WAP, skip it
+    // t->WriteTextL( TPtrC(COMMDB_NAME), *aVpnApItem.iName );
+
+    t->ReadUintL( TPtrC(IAP_SERVICE), aVpnApItem.iVpnTableId );
+    
+    // Hardcoded table name, not used, skip it
+    // t->WriteTextL( TPtrC(IAP_SERVICE_TYPE), TPtrC(VPN_SERVICE) );
+
+    // hardcoded..., not used, skip it
+    //t->WriteTextL( TPtrC(IAP_BEARER_TYPE), TPtrC(VIRTUAL_BEARER) );
+
+    t->ReadUintL( TPtrC(IAP_BEARER), aVpnApItem.iVirtualBearerID );
+
+    t->ReadUintL( TPtrC(IAP_NETWORK), aVpnApItem.iHomeNetwork );
+
+    // Network weighting hardcoded to 0!, not used, skip it
+    //t->WriteUintL( TPtrC(IAP_NETWORK_WEIGHTING), 0 );
+    
+    // as location is only written, skip it
+    /*
+    TUint32 loc = GetLocationIdL();
+    t->WriteUintL( TPtrC(IAP_LOCATION), loc );
+    */
+
+    CleanupStack::PopAndDestroy( t );   // t
+   
+    CLOG( ( EApItem, 0, _L( "<- CVpnApEngine::ReadVpnIapRecordL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CVpnApEngine::ReadVpnDataL
+// ---------------------------------------------------------
+//
+void CVpnApEngine::ReadVpnDataL( CVpnApItem& aVpnApItem )
+    {
+    CLOG( ( EApItem, 0, _L( "-> CVpnApEngine::ReadVpnDataL" ) ) );
+
+    // internal function, caller MUST initiate a transaction, WE WILL NOT.
+    CCommsDbTableView* t;
+
+    t = iDb->OpenViewMatchingUintLC( TPtrC(VPN_SERVICE),
+                                     TPtrC(COMMDB_ID), 
+                                     aVpnApItem.iVpnTableId );
+    User::LeaveIfError( t->GotoFirstRecord() );
+
+    // already got from WAP table, skip it here
+    //t->WriteTextL( TPtrC(COMMDB_NAME), *aVpnApItem.iName );
+    
+    HBufC* buf = NULL;
+    buf = ApCommons::ReadText16ValueLC( t, TPtrC(VPN_SERVICE_POLICY) );
+    aVpnApItem.WriteTextL( EApVpnPolicyId, *buf );
+    
+    RVpnServ ps;
+    User::LeaveIfError( ps.Connect() );
+    CleanupClosePushL<RVpnServ>( ps );
+    
+    TVpnPolicyName pName( *buf );
+
+    TInt policyCount(0);
+    TInt err = ps.EnumeratePolicies(policyCount);
+    if ( !err && policyCount)
+        {                
+        CArrayFixFlat<TVpnPolicyInfo>* policyList;
+        policyList = new (ELeave) CArrayFixFlat<TVpnPolicyInfo>(policyCount);
+        CleanupStack::PushL(policyList);
+
+        err = ps.GetPolicyInfoList(policyList);
+        if ( err )
+            {
+            aVpnApItem.WriteTextL( EApVpnPolicy, KEmpty );
+            }
+        else
+            {
+            TBool found(EFalse);
+            for (TInt i(0); i<policyList->Count(); ++i)
+                {
+                if (pName.Compare((*policyList)[i].iId) == 0 )
+                    {
+                    aVpnApItem.WriteTextL( EApVpnPolicy, 
+                        (*policyList)[i].iName );
+                    found = ETrue;
+                    break;    
+                    }
+                }
+            if (!found)
+                {
+    // When the policy is deleted (err!=0):
+    // have this leave, in UI display a note about needing to be reconfigured &
+    // set it & policyID to none to look like there is NO policy
+    // which will force the reconfiguration if in the UI
+    //    User::LeaveIfError( err );
+                aVpnApItem.WriteTextL( EApVpnPolicy, KEmpty );
+                }
+            }
+        CleanupStack::PopAndDestroy(policyList);
+        }
+
+    CleanupStack::PopAndDestroy(); // ps
+
+    CleanupStack::PopAndDestroy( buf ); // buf
+
+    t->ReadUintL( TPtrC(VPN_SERVICE_IAP), aVpnApItem.iRealIapId );    
+
+    t->ReadUintL( TPtrC(VPN_SERVICE_NETWORKID), aVpnApItem.iHomeNetwork );
+
+    CleanupStack::PopAndDestroy( t );   // t
+
+    // Get real IAP name !!!!!
+    CCommsDbTableView* iapt;
+
+    iapt = iDb->OpenViewMatchingUintLC( TPtrC(IAP),
+                                     TPtrC(COMMDB_ID), 
+                                     aVpnApItem.iRealIapId );
+
+    err = iapt->GotoFirstRecord();
+    if ( err == KErrNotFound ) 
+        {
+        aVpnApItem.WriteTextL( EApVpnRealIapName, KEmpty );
+        aVpnApItem.iVpnRealWapId = 0;
+        }
+    else
+        {        
+        User::LeaveIfError( err );
+        buf = ApCommons::ReadText16ValueLC( iapt, TPtrC(COMMDB_NAME) );
+        aVpnApItem.WriteTextL( EApVpnRealIapName, *buf );
+        CleanupStack::PopAndDestroy( buf ); // buf
+
+        CApUtils* util = CApUtils::NewLC( *iDb );
+        
+        TUint32 realwapid = util->WapIdFromIapIdL( aVpnApItem.iRealIapId );
+        aVpnApItem.iVpnRealWapId = realwapid;
+
+        CleanupStack::PopAndDestroy( util );
+
+        }
+
+    CleanupStack::PopAndDestroy( iapt );   // t
+
+    CLOG( ( EApItem, 0, _L( "<- CVpnApEngine::ReadVpnDataL" ) ) );
+    }
+
+
+
+
+
+
+
+
+
+
+
+// ---------------------------------------------------------
+// CVpnApEngine::WriteProxyDataL
+// ---------------------------------------------------------
+//
+void CVpnApEngine::WriteProxyDataL( TBool aIsNew, 
+                                      const CVpnApItem& aVpnApItem )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CVpnApEngine::WriteProxyDataL" ) ) );
+
+    CCommsDbTableView* proxies;
+    if ( aIsNew )
+        {
+        proxies = iDb->OpenTableLC( TPtrC(PROXIES) );
+        // variable needed just to be able to make the call...
+        TUint32 dummy;
+        User::LeaveIfError( proxies->InsertRecord( dummy ) );
+        }
+    else
+        {
+        proxies = iDb->OpenViewMatchingTextLC( TPtrC(PROXIES),
+                                               TPtrC(PROXY_SERVICE_TYPE),
+                                               TPtrC(VPN_SERVICE) );
+        TInt err = proxies->GotoFirstRecord();
+        if ( err == KErrNotFound )
+            { // originally there were NO proxy, but now it is added
+            // variable needed just to be able to make the call...
+            TUint32 dummy;
+            User::LeaveIfError( proxies->InsertRecord( dummy ) );
+            }
+        else
+            { 
+            // check if it is our proxy...
+            // Add test cases covering this route
+            TUint32 uval;
+            TBool found( EFalse );
+            do
+                {
+                // Add test cases covering this route
+                proxies->ReadUintL( TPtrC(PROXY_ISP), uval );
+                if ( uval == aVpnApItem.iVpnTableId )
+                    {
+                    found = ETrue;
+                    }
+                else
+                    {
+                    err = proxies->GotoNextRecord();
+                    }
+                } while ( (!err) && (!found) );
+            if ( !found )
+                { // no proxy record, add it now
+                // variable needed just to be able to make the call...
+                TUint32 alma;
+                User::LeaveIfError( proxies->InsertRecord( alma ) );
+                }
+            else
+                { // we found our proxy, use it...
+                User::LeaveIfError( proxies->UpdateRecord() );
+                }
+            }
+        }
+    proxies->WriteTextL( TPtrC(PROXY_SERVICE_TYPE),
+                         TPtrC(VPN_SERVICE) );
+
+    proxies->WriteUintL( TPtrC(PROXY_ISP), aVpnApItem.iVpnTableId );
+
+
+    proxies->WriteLongTextL( TPtrC(PROXY_SERVER_NAME),
+                            *aVpnApItem.iProxyServerAddress );
+
+    proxies->WriteTextL( TPtrC(PROXY_PROTOCOL_NAME),
+                         KDefProxyProtocolName );
+
+    proxies->WriteUintL( TPtrC(PROXY_PORT_NUMBER),
+                         aVpnApItem.iProxyPort );
+
+    TBool useproxy( EFalse );
+    if ( ( aVpnApItem.iProxyPort ) 
+        || ( aVpnApItem.iProxyServerAddress->Compare( KEmpty ) != 0 ) )
+        {
+        useproxy = ETrue;
+        }
+
+    proxies->WriteBoolL( TPtrC(PROXY_USE_PROXY_SERVER), 
+                         useproxy );
+
+    /*
+    not used, skipped
+    proxies->WriteLongTextL( TPtrC(PROXY_EXCEPTIONS),
+                            *aApItem.iApProxyExceptions );
+    */
+    proxies->WriteLongTextL( TPtrC(PROXY_EXCEPTIONS),
+                            KEmpty );
+
+    User::LeaveIfError( proxies->PutRecordChanges( EFalse, EFalse ) );
+
+    CleanupStack::PopAndDestroy( proxies );   // proxies
+
+    CLOG( ( EHandler, 1, _L( "<- CVpnApEngine::WriteProxyDataL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CVpnApEngine::ReadProxyDataL
+// ---------------------------------------------------------
+//
+void CVpnApEngine::ReadProxyDataL( CVpnApItem& aVpnApItem )
+    {
+    // internal function, caller MUST initiate a transaction, WE WILL NOT.
+    CLOG( ( EHandler, 0, _L( "-> CVpnApEngine::ReadProxyDataL" ) ) );
+
+    CCommsDbTableView* proxies;    
+    proxies = iDb->OpenViewMatchingTextLC( TPtrC(PROXIES),
+                                           TPtrC(PROXY_SERVICE_TYPE),
+                                           TPtrC(VPN_SERVICE) );
+    TInt err = proxies->GotoFirstRecord();
+    if ( err != KErrNotFound )
+        {
+        User::LeaveIfError( err );
+        }
+    if ( err != KErrNotFound )
+        {
+        // check if it is our proxy...
+        // Add test cases covering this route
+        TUint32 uval;
+        TBool found( EFalse );
+        do
+            {
+            // Add test cases covering this route
+            proxies->ReadUintL( TPtrC(PROXY_ISP), uval );
+            if ( uval == aVpnApItem.iVpnTableId )
+                {
+                found = ETrue;
+                }
+            else
+                {
+                err = proxies->GotoNextRecord();
+                }
+            } while ( (!err) && (!found) );
+        if ( found )
+            { // it is our proxy record, use it 
+            HBufC* buf = ApCommons::ReadLongTextLC( proxies,
+                                                    TPtrC(PROXY_SERVER_NAME),
+                                                    err );
+            if ( err != KErrUnknown )
+                {
+                aVpnApItem.WriteLongTextL( EApVpnProxyServerAddress, *buf );
+                }
+
+            CleanupStack::PopAndDestroy( buf ); // buf
+
+            TUint32 tempint;
+
+            ApCommons::ReadUintL( proxies, TPtrC(PROXY_PORT_NUMBER), tempint );
+            aVpnApItem.WriteUint( EApVpnProxyPortNumber, tempint );
+
+            /*
+            buf = ApCommons::ReadLongTextLC( proxies,
+                                             TPtrC(PROXY_EXCEPTIONS),
+                                             err );
+            aVpnApItem.WriteLongTextL( EApProxyExceptions, *buf );
+            CleanupStack::PopAndDestroy( buf ); // buf
+            */
+            }
+        }
+    CleanupStack::PopAndDestroy( proxies ); // proxies
+
+    CLOG( ( EHandler, 1, _L( "<- CVpnApEngine::ReadProxyDataL" ) ) );
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CVpnApEngine::RemoveVpnProxyDataL
+// ---------------------------------------------------------
+//
+void CVpnApEngine::RemoveVpnProxyDataL( TUint32 aIspId )
+    {
+    // internal function, caller MUST initiate a transaction, WE WILL NOT.
+    CLOG( ( EHandler, 0, _L( "-> CVpnApEngine::RemoveProxyDataL" ) ) );
+
+    // Add test cases covering all this functions routes
+
+    CCommsDbTableView* proxies;    
+    proxies = iDb->OpenViewMatchingTextLC( TPtrC(PROXIES), 
+                                           TPtrC(PROXY_SERVICE_TYPE),
+                                           TPtrC(VPN_SERVICE) );
+    TInt err = proxies->GotoFirstRecord();
+    if ( err == KErrNone )
+        { // now get OUR proxy record
+        TUint32 uval;
+        TBool found( EFalse );
+        do
+            {
+            // Add test cases covering this route
+            proxies->ReadUintL( TPtrC(PROXY_ISP), uval );
+            if ( uval == aIspId )
+                {
+                found = ETrue;
+                }
+            else
+                {
+                err = proxies->GotoNextRecord();
+                }
+            } while ( (!err) && (!found) );
+        if ( found )
+            {
+            User::LeaveIfError( proxies->DeleteRecord() );
+            }
+        else
+            { 
+            // silently ignore KErrNotFound. It is caused by incorrect DB,
+            // we are 'repairing it' this way.
+            if ( err != KErrNotFound )
+                {
+                User::LeaveIfError( err );
+                }
+            }
+        }
+    else
+        {
+        // silently ignore KErrNotFound. It is caused by incorrect DB,
+        // we are 'repairing it' this way.
+        if ( err != KErrNotFound )
+            {
+            User::LeaveIfError( err );
+            }
+        }
+    CleanupStack::PopAndDestroy( proxies ); // proxies
+    
+    CLOG( ( EHandler, 1, _L( "<- CVpnApEngine::RemoveProxyDataL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CVpnApEngine::DoDeleteVpnL
+// ---------------------------------------------------------
+//
+void CVpnApEngine::DoDeleteVpnL( TUint32 aUid )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CVpnApEngine::DoDeleteVpnL" ) ) );
+
+    // when deleting, need to delete: 
+    // homenetwork
+    // VPN_TABLE record
+    // IAP's VPN record
+    // WAP's VPN record
+    // IP_BEARER's record
+    // proxy record
+
+    // first make sure that the given AP is not in use
+    CApUtils* utils = CApUtils::NewLC( *iDb );
+    if ( utils->IsAPInUseL( aUid ) )
+        {
+        User::Leave( KErrInUse );
+        }
+    CleanupStack::PopAndDestroy( utils );   // utils
+
+    CCommsDbTableView* wapt;
+    wapt = iDb->OpenViewMatchingUintLC( TPtrC(WAP_ACCESS_POINT),
+                                       TPtrC(COMMDB_ID), aUid );
+    User::LeaveIfError( wapt->GotoFirstRecord() );
+    HBufC* buf = HBufC::NewLC( KCommsDbSvrMaxFieldLength );
+    TPtr ptr( buf->Des() );
+    wapt->ReadTextL( TPtrC(WAP_CURRENT_BEARER),
+                     ptr ); // see declaration for comments!
+
+    if ( *buf == TPtrC(WAP_IP_BEARER) )
+        {
+        // get serviceType
+        CCommsDbTableView* bearert;
+        bearert = iDb->OpenViewMatchingUintLC( TPtrC(WAP_IP_BEARER),
+                                               TPtrC(WAP_ACCESS_POINT_ID),
+                                               aUid );
+
+        User::LeaveIfError( bearert->GotoFirstRecord() );
+
+        TUint32 ipbearerid;
+        ApCommons::ReadUintL( bearert, TPtrC(COMMDB_ID), ipbearerid );
+
+        TUint32 iapid;
+        ApCommons::ReadUintL( bearert, TPtrC(WAP_IAP), iapid );
+
+        CCommsDbTableView* iapt;
+        iapt = iDb->OpenViewMatchingUintLC( TPtrC(IAP), TPtrC(COMMDB_ID),
+                                            iapid );
+
+        User::LeaveIfError( iapt->GotoFirstRecord() );
+        HBufC* servicetype = HBufC::NewLC( KCommsDbSvrMaxFieldLength );
+        TPtr servptr( servicetype->Des() );
+        iapt->ReadTextL( TPtrC(IAP_SERVICE_TYPE), servptr );
+        TUint32 ispid;
+        iapt->ReadUintL( TPtrC(IAP_SERVICE), ispid );
+        TUint32 networkid;
+        iapt->ReadUintL( TPtrC(IAP_NETWORK), networkid );
+
+        RemoveNetworkDataL( networkid );
+
+        if ( *servicetype == TPtrC(VPN_SERVICE) )
+            {
+            RemoveRecordL( TPtrC(VPN_SERVICE), ispid );
+            RemoveRecordL( TPtrC(IAP), iapid );
+            }
+        else
+            { // what to do if none of them???
+            User::Leave( KErrInvalidBearer );
+            }
+        RemoveVpnProxyDataL( ispid );
+        RemoveRecordL( TPtrC(WAP_IP_BEARER), ipbearerid );
+        // servicetype, iapt, bearert
+        CleanupStack::PopAndDestroy( 3, bearert ); 
+        }
+    else
+        { // sms,
+        User::Leave( KErrInvalidBearerType );
+        }
+
+    RemoveRecordL( TPtrC(WAP_ACCESS_POINT), aUid );
+
+    CleanupStack::PopAndDestroy( 2, wapt );   // buf, wapt
+
+    CLOG( ( EHandler, 1, _L( "<- CVpnApEngine::DoDeleteVpnL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CVpnApEngine::RemoveRecordL
+// ---------------------------------------------------------
+//
+void CVpnApEngine::RemoveRecordL( const TDesC& aTable, TUint32 aUid )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CVpnApEngine::RemoveRecordL" ) ) );
+
+    CCommsDbTableView* t = iDb->OpenViewMatchingUintLC( 
+                                            aTable, 
+                                            TPtrC(COMMDB_ID), 
+                                            aUid );
+    TInt res = t->GotoFirstRecord(); // OK.
+    if ( res == KErrNone )
+        { // exists, delete it
+        User::LeaveIfError( t->DeleteRecord() );
+        }
+    else
+        {
+        // silently ignore KErrNotFound. It is caused by incorrect DB,
+        // we are 'repairing it' this way.
+        if ( res != KErrNotFound )
+            {
+            User::Leave( res );
+            }
+        }
+    CleanupStack::PopAndDestroy( t ); // t
+
+    CLOG( ( EHandler, 1, _L( "<- CVpnApEngine::RemoveRecordL" ) ) );
+    }
+
+
+
+
+
+// ---------------------------------------------------------
+// CVpnApEngine::WriteNetworkDataL
+// ---------------------------------------------------------
+//
+void CVpnApEngine::WriteNetworkDataL( TBool aIsNew, 
+                                        CVpnApItem& aVpnApItem )
+    {
+    CLOG( ( EHandler, 0, _L( "-> CVpnApEngine::WriteNetworkDataL" ) ) );
+
+    if ( aVpnApItem.iVpnIapNetwork == 0 )
+        {
+        CCommsDbTableView* networks;
+        HBufC* buf = HBufC::NewLC( KApEngineMaxSql );
+        if ( aIsNew )
+            {
+            networks = iDb->OpenTableLC( TPtrC(NETWORK) );
+            TUint32 netId;
+            User::LeaveIfError( networks->InsertRecord( netId ) );
+            aVpnApItem.iVpnIapNetwork = netId;
+            }
+        else
+            {
+            networks = iDb->OpenViewMatchingUintLC( 
+                                TPtrC(NETWORK), TPtrC(COMMDB_ID), 
+                                aVpnApItem.iVpnIapNetwork );
+
+            TInt err = networks->GotoFirstRecord();
+            if ( err == KErrNotFound )
+                { // originally there were NO network, but now it is added
+                TUint32 netId;
+                User::LeaveIfError( networks->InsertRecord( netId ) );
+                aVpnApItem.iVpnIapNetwork = netId;
+                }
+            else
+                {
+                User::LeaveIfError( networks->UpdateRecord() );
+                }
+            }
+        networks->WriteTextL( TPtrC(COMMDB_NAME), *aVpnApItem.iName );
+
+        User::LeaveIfError( networks->PutRecordChanges( EFalse, EFalse ) );
+
+        CleanupStack::PopAndDestroy( networks );   // networks
+        CleanupStack::PopAndDestroy( buf );   // buf
+        }
+    
+    CLOG( ( EHandler, 1, _L( "<- CVpnApEngine::WriteNetworkDataL" ) ) );
+    }
+
+
+// ---------------------------------------------------------
+// CVpnApEngine::ReadNetworkDataL
+// ---------------------------------------------------------
+//
+void CVpnApEngine::ReadNetworkDataL( CVpnApItem& aVpnApItem )
+    {    
+    // internal function, caller MUST initiate a transaction, WE WILL NOT.
+    CLOG( ( EHandler, 0, _L( "-> CVpnApEngine::ReadNetworkDataL" ) ) );
+        
+    CCommsDbTableView* networks;
+    networks = iDb->OpenViewMatchingUintLC( TPtrC(NETWORK), 
+                                            TPtrC(COMMDB_ID), 
+                                            aVpnApItem.iVpnIapNetwork );
+
+    TInt err = networks->GotoFirstRecord();
+
+    if ( err != KErrNotFound )
+        {
+        User::LeaveIfError( err );
+        }
+    if ( err != KErrNotFound )
+        {
+        HBufC* buf = ApCommons::ReadText16ValueLC( networks, 
+                                                   TPtrC(COMMDB_NAME) );
+        if ( err != KErrUnknown )
+            {
+            aVpnApItem.WriteTextL( EApVpnIapNetworkName, *buf );
+            }
+
+        CleanupStack::PopAndDestroy( buf ); // buf
+        }
+    else
+        { // not found, set to NONE
+        aVpnApItem.WriteTextL( EApVpnIapNetworkName, KEmpty );
+        }
+    CleanupStack::PopAndDestroy( networks ); // networks
+    
+    CLOG( ( EHandler, 1, _L( "<- CVpnApEngine::ReadNetworkDataL" ) ) );
+  }
+
+
+
+// ---------------------------------------------------------
+// CVpnApEngine::RemoveNetworkDataL
+// ---------------------------------------------------------
+//
+void CVpnApEngine::RemoveNetworkDataL( TUint32 aIspId )
+    {
+    // internal function, caller MUST initiate a transaction, WE WILL NOT.
+    CLOG( ( EHandler, 0, _L( "-> CVpnApEngine::RemoveNetworkDataL" ) ) );
+
+    RemoveRecordL( TPtrC(NETWORK), aIspId );
+
+    CLOG( ( EHandler, 1, _L( "<- CVpnApEngine::RemoveNetworkDataL" ) ) );
+    }
+
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apeng/src/VpnApItem.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,680 @@
+/*
+* Copyright (c) 2002 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 the CVpnApItem class.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include    <f32file.h>
+#include    <bautils.h>
+#include    <barsc.h>
+#include    <ApEngine.rsg>
+#include    <txtetext.h>
+#include    <data_caging_path_literals.hrh>
+
+#include    "VpnApItem.h"
+#include    "ApEngineLogger.h"
+#include    "ApEngineConsts.h"
+#include    "ApEngineCommons.h"
+
+
+
+// CONSTANTS
+const TInt KApItemInitialTxtBufSize = 0;
+const TInt KVpnDefProxyPortNumber = 80;
+
+// DUPLCIATE as I can not touch original, but do need the file here, too...
+/// ROM drive.
+_LIT( KApEngineResDriveZ, "z:" );
+/// ApEngine resource file name.
+_LIT( KApEngineResFileName, "ApEngine.rsc" );
+
+
+
+// ================= MEMBER FUNCTIONS =======================
+// ---------------------------------------------------------
+// CVpnApItem::NewLC
+// ---------------------------------------------------------
+//
+EXPORT_C CVpnApItem* CVpnApItem::NewLC()
+    {
+    CLOG( ( EApItem, 0, _L( "-> CVpnApItem::NewL" ) ) );
+
+    CVpnApItem* self = new ( ELeave ) CVpnApItem;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+
+    CLOG( ( EApItem, 1, _L( "<- CVpnApItem::NewL" ) ) );
+    
+    return self;
+    }
+
+
+// ---------------------------------------------------------
+// CVpnApItem::~CVpnApItem
+// ---------------------------------------------------------
+//
+EXPORT_C CVpnApItem::~CVpnApItem()
+    {
+    CLOG( ( EApItem, 0, _L( "<-> CVpnApItem::~CVpnApItem" ) ) );
+
+    delete iName;
+    delete iPolicy;
+    delete iProxyServerAddress;
+    delete iRealIapName;
+    delete iPolicyId;
+    delete iVpnIapNetworkName;
+
+    }
+
+        
+// ---------------------------------------------------------
+// CVpnApItem::ConstructL
+// ---------------------------------------------------------
+//
+EXPORT_C void CVpnApItem::ConstructL()
+    {
+    CLOG( ( EApItem, 0, _L( "-> CVpnApItem::ConstructL" ) ) );
+   
+    // as we are in ConstructL called from NewLC,
+    // 'this' is already on the CleanupStack,
+    // so do not push members onto it!
+    iName = HBufC::NewL( KApItemInitialTxtBufSize );
+    iPolicy = HBufC::NewL( KApItemInitialTxtBufSize );
+    iProxyServerAddress = HBufC::NewL( KApItemInitialTxtBufSize );
+    iRealIapName = HBufC::NewL( KApItemInitialTxtBufSize );
+    iPolicyId = HBufC::NewL( KApItemInitialTxtBufSize );
+    iVpnIapNetworkName = HBufC::NewL( KApItemInitialTxtBufSize );
+
+    RFs fs;
+    CleanupClosePushL<RFs>( fs );
+    User::LeaveIfError( fs.Connect() );
+
+    // can't use resource here because it is not added yet....
+    TFileName resourceFile;
+    resourceFile.Append( KApEngineResDriveZ );
+    resourceFile.Append( KDC_RESOURCE_FILES_DIR );
+    resourceFile.Append( KApEngineResFileName );
+    BaflUtils::NearestLanguageFile( fs, resourceFile );
+
+    RResourceFile rf;
+    CleanupClosePushL<RResourceFile>( rf );
+    rf.OpenL( fs, resourceFile );
+    rf.ConfirmSignatureL( 0 );
+    HBufC8* readBuffer = rf.AllocReadLC( R_APNG_DEFAULT_VPN_AP_NAME );
+    // as we are expecting HBufC16...
+    __ASSERT_DEBUG( ( readBuffer->Length()%2 ) == 0,
+                    ApCommons::Panic( EWrongResourceFormat ) );
+    const TPtrC16 ptrReadBuffer( (TText16*) readBuffer->Ptr(),
+                                 ( readBuffer->Length() + 1 ) >> 1 );
+    HBufC16* textBuffer=HBufC16::NewL( ptrReadBuffer.Length() );
+    *textBuffer=ptrReadBuffer;
+    CleanupStack::PopAndDestroy( readBuffer ); // readbuffer
+    CleanupStack::PushL( textBuffer );
+    
+    WriteTextL( EApVpnWapAccessPointName, *textBuffer );
+
+    WriteUint( EApVpnProxyPortNumber, KVpnDefProxyPortNumber );
+
+    CleanupStack::PopAndDestroy( 3 ); // textbuffer, fs, rf
+
+    CLOG( ( EApItem, 0, _L( "<- CVpnApItem::ConstructL" ) ) );
+
+    }
+
+
+// ---------------------------------------------------------
+// CVpnApItem::CVpnApItem
+// ---------------------------------------------------------
+//
+EXPORT_C CVpnApItem::CVpnApItem()
+    {
+    CLOG( ( EApItem, 0, _L( "<-> CVpnApItem::CVpnApItem" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CVpnApItem::CopyFromL
+// ---------------------------------------------------------
+//
+EXPORT_C void CVpnApItem::CopyFromL( const CVpnApItem& aCopyFrom  )
+    {
+    CLOG( ( EApItem, 0, _L( "-> CVpnApItem::CopyFromL" ) ) );
+
+    iVpnTableId = aCopyFrom.iVpnTableId;
+    iVpnIapId = aCopyFrom.iVpnIapId;
+    iRealIapId = aCopyFrom.iRealIapId;
+    iVpnRealWapId = aCopyFrom.iVpnRealWapId;
+    iVirtualBearerID = aCopyFrom.iVirtualBearerID;
+    iProxyPort = aCopyFrom.iProxyPort;
+    iHomeNetwork = aCopyFrom.iHomeNetwork;
+
+    WriteTextL( EApVpnWapAccessPointName, *aCopyFrom.iName );
+    WriteTextL( EApVpnPolicy, *aCopyFrom.iPolicy );
+    WriteLongTextL( EApVpnProxyServerAddress, *aCopyFrom.iProxyServerAddress );
+    WriteTextL( EApVpnRealIapName, *aCopyFrom.iRealIapName );
+    WriteTextL( EApVpnPolicyId, *aCopyFrom.iPolicyId );
+    WriteTextL( EApVpnIapNetworkName, *aCopyFrom.iVpnIapNetworkName );
+
+    CLOG( ( EApItem, 0, _L( "<- CVpnApItem::CopyFromL" ) ) );
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CVpnApItem::operator==
+// ---------------------------------------------------------
+//
+EXPORT_C TBool CVpnApItem::operator==( const CVpnApItem& aItem ) const
+    {
+    CLOG( ( EApItem, 0, _L( "-> CVpnApItem::operator==" ) ) );
+
+    TBool retval( EFalse );
+
+    if ( ( iVpnTableId == aItem.iVpnTableId ) &&
+         ( iVpnIapId == aItem.iVpnIapId ) &&
+         ( iRealIapId == aItem.iRealIapId ) &&
+         ( iVpnRealWapId == aItem.iVpnRealWapId ) &&
+         ( iVirtualBearerID == aItem.iVirtualBearerID ) &&
+         ( iProxyPort == aItem.iProxyPort ) &&
+         ( iHomeNetwork == aItem.iHomeNetwork )
+         )
+        {
+        if (
+           ( iName->Compare( *aItem.iName ) == 0 )
+           && ( iPolicy->Compare( *aItem.iPolicy ) == 0 )
+           && ( iProxyServerAddress->Compare( 
+                            *aItem.iProxyServerAddress ) == 0 )
+           && ( iRealIapName->Compare( *aItem.iRealIapName ) == 0 )
+           && ( iPolicyId->Compare( *aItem.iPolicyId ) == 0 )
+           && ( iVpnIapNetworkName->Compare( 
+                            *aItem.iVpnIapNetworkName ) == 0 )
+            )
+            {
+            retval = ETrue;
+            }
+        }
+
+    CLOG( ( EApItem, 0, _L( "<- CVpnApItem::operator==" ) ) );
+
+    return ( retval );
+    }
+
+
+// ---------------------------------------------------------
+// CVpnApItem::operator!=
+// ---------------------------------------------------------
+//
+EXPORT_C TBool CVpnApItem::operator!=( const CVpnApItem& aItem ) const
+    {
+    CLOG( ( EApItem, 0, _L( "-> CVpnApItem::operator!=" ) ) );
+
+    TBool ret = ( *this == aItem );
+
+    CLOG( ( EApItem, 1, _L( "<- CVpnApItem::operator!=" ) ) );
+    return ( !ret );
+    }
+
+
+
+// ---------------------------------------------------------
+// CVpnApItem::ReadTextL
+// ---------------------------------------------------------
+//
+EXPORT_C void CVpnApItem::ReadTextL( const TVpnApMember aColumn, 
+                                     TDes16& aValue )
+    {
+    CLOG( ( EApItem, 0, _L( "-> CVpnApItem::ReadTextL" ) ) );
+
+    switch ( aColumn )
+        {
+        case EApVpnWapAccessPointName:
+            {
+            aValue.SetLength( iName->Length() );
+            aValue.Format( KFormat, iName );
+            break;
+            }
+        case EApVpnProxyServerAddress:
+            {
+            // make it large enough to hold
+            aValue.SetLength( iProxyServerAddress->Length() );
+            aValue.Format( KFormat, iProxyServerAddress );
+            break;
+            }
+        case EApVpnPolicy:
+            {
+            aValue.SetLength( iPolicy->Length() );
+            aValue.Format( KFormat, iPolicy );
+            break;
+            }
+        case EApVpnRealIapName:
+            {
+            aValue.SetLength( iRealIapName->Length() );
+            aValue.Format( KFormat, iRealIapName );
+            break;
+            }
+        case EApVpnPolicyId:
+            {
+            aValue.SetLength( iPolicyId->Length() );
+            aValue.Format( KFormat, iPolicyId );
+            break;
+            }
+        case EApVpnIapNetworkName:
+            {
+            aValue.SetLength( iVpnIapNetworkName->Length() );
+            aValue.Format( KFormat, iVpnIapNetworkName );
+            break;
+            }
+        default:
+            {
+            __ASSERT_DEBUG( EFalse, ApCommons::Panic( EInvalidColumn ) );
+            User::Leave( KErrInvalidColumn );
+            }
+        }
+
+    CLOG( ( EApItem, 1, _L( "<- CVpnApItem::ReadTextL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CVpnApItem::ReadConstLongTextL
+// ---------------------------------------------------------
+//
+EXPORT_C const HBufC* CVpnApItem::ReadConstLongTextL( 
+                                         const TVpnApMember aColumn 
+                                                    )
+    {
+    CLOG( ( EApItem, 0, _L( "-> CVpnApItem::ReadConstLongTextL" ) ) );
+
+    HBufC* retval = NULL;
+    switch ( aColumn )
+        {
+        case EApVpnProxyServerAddress:
+            {
+            retval = iProxyServerAddress;
+            break;
+            }
+        default:
+            {
+            __ASSERT_DEBUG( EFalse, ApCommons::Panic( EInvalidColumn ) );
+            User::Leave( KErrInvalidColumn );
+            break;
+            }
+        }
+    
+    CLOG( ( EApItem, 1, _L( "<- CVpnApItem::ReadConstLongTextL" ) ) );
+    return retval;
+    }
+
+
+// ---------------------------------------------------------
+// CVpnApItem::ReadUint
+// ---------------------------------------------------------
+//
+EXPORT_C TInt CVpnApItem::ReadUint( const TVpnApMember aColumn, 
+                                    TUint32& aValue )
+    {
+    CLOG( ( EApItem, 0, _L( "-> CVpnApItem::ReadUint" ) ) );
+
+    TInt retval ( KErrNone );
+    switch ( aColumn )
+    {
+        case EApVpnWapAccessPointID:
+            {
+            aValue = iVpnWapId;
+            break;
+            }
+        case EApVpnIapID:
+            {
+            aValue = iVpnIapId;
+            break;
+            }
+        case EApVpnRealIapID:
+            {
+            aValue = iRealIapId;
+            break;
+            }
+        case EApVpnRealWapID:
+            {
+            aValue = iVpnRealWapId;
+            break;
+            }
+        case EApVpnProxyPortNumber:
+            {
+            aValue = iProxyPort;
+            break;
+            }
+        case EApVpnHomeNetworkID:
+            {
+            aValue = iHomeNetwork;
+            break;
+            }
+        case EApVpnIapNetworkID:
+            {
+            aValue = iVpnIapNetwork;
+            break;
+            }
+        default :
+            {
+            __ASSERT_DEBUG( EFalse, ApCommons::Panic( EInvalidColumn ) );
+            retval = KErrInvalidColumn;
+            break;
+            }
+        }
+
+    CLOG( ( EApItem, 1, _L( "<- CVpnApItem::ReadUint" ) ) );
+    return retval;
+    }
+
+
+
+// ---------------------------------------------------------
+// CVpnApItem::ReadBool
+// ---------------------------------------------------------
+//
+EXPORT_C TInt CVpnApItem::ReadBool( const TVpnApMember /*aColumn*/, 
+                                    TBool& /*aValue*/ )
+    {
+    CLOG( ( EApItem, 0, _L( "-> CVpnApItem::ReadBool" ) ) );
+    
+    // This is just a placeholder API for possible expansion...
+
+    TInt retval( KErrNone );
+
+    __ASSERT_DEBUG( EFalse, ApCommons::Panic( EInvalidColumn ) );
+    retval = KErrInvalidColumn;
+
+    CLOG( ( EApItem, 1, _L( "<- CVpnApItem::ReadBool" ) ) );
+    return retval;
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CVpnApItem::WriteTextL
+// ---------------------------------------------------------
+//
+EXPORT_C TInt CVpnApItem::WriteTextL( const TVpnApMember aColumn,
+                                      const TDesC16& aValue )
+    {
+    CLOG( ( EApItem, 0, _L( "-> CVpnApItem::WriteTextL" ) ) );
+
+    TInt retval( KErrNone );
+    switch ( aColumn )
+    {
+        case EApVpnWapAccessPointName:
+            {
+            HBufC* sgd = aValue.AllocLC();
+            sgd->Des().Trim();
+            ReAllocL( iName, *sgd);
+            CleanupStack::PopAndDestroy( sgd ); // sgd
+            break;
+            }
+        case EApVpnPolicy:
+            {
+            ReAllocL( iPolicy, aValue);
+            break;
+            }
+        case EApVpnProxyServerAddress:
+            {
+            ReAllocL( iProxyServerAddress, aValue);
+            break;
+            }
+        case EApVpnRealIapName:
+            {
+            ReAllocL( iRealIapName, aValue );
+            break;
+            }
+        case EApVpnPolicyId:
+            {
+            ReAllocL( iPolicyId, aValue );
+            break;
+            }
+        case EApVpnIapNetworkName:
+            {
+            ReAllocL( iVpnIapNetworkName, aValue );
+            break;
+            }
+        default:
+            {
+            __ASSERT_DEBUG( EFalse, ApCommons::Panic( EInvalidColumn ) );
+            retval = KErrInvalidColumn;
+            break;
+            }
+        }
+
+    CLOG( ( EApItem, 1, _L( "<- CVpnApItem::WriteTextL" ) ) );
+    return retval;
+    }
+
+
+
+// ---------------------------------------------------------
+// CVpnApItem::WriteLongTextL
+// ---------------------------------------------------------
+//
+EXPORT_C TInt CVpnApItem::WriteLongTextL( const TVpnApMember aColumn,
+                                          const TDesC& aValue )
+    {
+    CLOG( ( EApItem, 0, _L( "-> CVpnApItem::WriteLongTextL" ) ) );
+
+    TInt retval( KErrNone );
+    switch ( aColumn )
+        {
+        case EApVpnProxyServerAddress:
+            {
+            ReAllocL( iProxyServerAddress, aValue);
+            break;
+            }
+        default:
+            {
+            // unknown column...
+            __ASSERT_DEBUG( EFalse, ApCommons::Panic( EInvalidColumn ) );
+            retval = KErrInvalidColumn;
+            break;
+            }
+        }
+
+    CLOG( ( EApItem, 1, _L( "<- CVpnApItem::WriteLongTextL" ) ) );
+    return retval;
+    }
+
+
+
+// ---------------------------------------------------------
+// CVpnApItem::WriteUint
+// ---------------------------------------------------------
+//
+EXPORT_C TInt CVpnApItem::WriteUint( const TVpnApMember aColumn,
+                                     const TUint32& aValue )
+    {
+    CLOG( ( EApItem, 0, _L( "-> CVpnApItem::WriteUint" ) ) );
+
+    TInt retval( KErrNone );
+    switch ( aColumn )
+        {
+        case EApVpnWapAccessPointID:
+            {
+            iVpnWapId = aValue;
+            break;
+            }
+        case EApVpnIapID:
+            {
+            iVpnIapId = aValue;
+            break;
+            }
+        case EApVpnRealIapID:
+            {
+            iRealIapId= aValue;
+            break;
+            }
+        case EApVpnRealWapID:
+            {
+            iVpnRealWapId = aValue;
+            break;
+            }
+        case EApVpnProxyPortNumber:
+            {
+            iProxyPort = aValue;
+            break;
+            }
+        case EApVpnHomeNetworkID:
+            {
+            iHomeNetwork = aValue;
+            break;
+            }
+        case EApVpnIapNetworkID:
+            {
+            iVpnIapNetwork = aValue;
+            break;
+            }
+        default :
+            {
+            __ASSERT_DEBUG( EFalse, ApCommons::Panic( EInvalidColumn ) );
+            retval = KErrInvalidColumn;
+            }
+        }
+
+    CLOG( ( EApItem, 1, _L( "<- CVpnApItem::WriteUint" ) ) );
+    return retval;
+    }
+
+
+
+// ---------------------------------------------------------
+// CVpnApItem::WriteBool
+// ---------------------------------------------------------
+//
+EXPORT_C TInt CVpnApItem::WriteBool( const TVpnApMember /*aColumn*/,
+                                     const TBool& /*aValue*/ )
+    {
+    CLOG( ( EApItem, 0, _L( "-> CVpnApItem::WriteBool" ) ) );
+
+    TInt retval( KErrNone );
+
+    // This is just a placeholder API for possible expansion...
+    
+    __ASSERT_DEBUG( EFalse, ApCommons::Panic( EInvalidColumn ) );
+    retval = KErrInvalidColumn;
+
+    CLOG( ( EApItem, 1, _L( "<- CVpnApItem::WriteBool" ) ) );
+    return retval;
+    }
+
+
+// Query
+// COMMON
+
+// ---------------------------------------------------------
+// CVpnApItem::WapUid
+// ---------------------------------------------------------
+//
+EXPORT_C TUint32 CVpnApItem::WapUid() const
+    {
+    CLOG( ( EApItem, 0, _L( "<-> CVpnApItem::WapUid" ) ) );
+
+    return iVpnWapId;
+    }
+
+
+// ---------------------------------------------------------
+// CVpnApItem::Name
+// ---------------------------------------------------------
+//
+EXPORT_C const TDesC& CVpnApItem::Name() const
+    {
+    CLOG( ( EApItem, 0, _L( "<-> CVpnApItem::Name" ) ) );
+
+    return *iName;
+    }
+
+
+
+// ---------------------------------------------------------
+// CVpnApItem::ReAllocL
+// ---------------------------------------------------------
+//
+void CVpnApItem::ReAllocL(HBufC*& aDes, const TDesC16& aValue)
+    {
+    CLOG( ( EApItem, 0, _L( "-> CVpnApItem::ReAllocL" ) ) );
+
+    // now remove 'invalid' chars (TABs) as they cause problems
+    // in other places, like listboxes...
+    HBufC* tmp = RemoveInvalidCharsLC( aValue );
+    delete aDes;
+    aDes = tmp;
+    CleanupStack::Pop( tmp );
+
+    CLOG( ( EApItem, 1, _L( "<- CVpnApItem::ReAllocL" ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CVpnApItem::RemoveInvalidCharsLC
+// ---------------------------------------------------------
+//
+HBufC* CVpnApItem::RemoveInvalidCharsLC( const TDesC16& aInText )
+    {
+    CLOG( ( EApItem, 0, _L( "-> CVpnApItem::RemoveInvalidCharsLC" ) ) );
+
+    TInt size = aInText.Length();
+    HBufC* aOutText = HBufC::NewLC( size );
+    TPtr ptr = aOutText->Des();
+
+    for ( TInt ii=0; ii<size; ++ii )
+        {
+        TText ch = aInText[ii];
+        if ( ch == CEditableText::ETabCharacter )
+            {
+            ch = ' ';
+            }
+        ptr.Append( ch );
+        }
+
+    CLOG( ( EApItem, 1, _L( "<- CVpnApItem::RemoveInvalidCharsLC" ) ) );
+    return aOutText;
+    }
+
+
+
+// ---------------------------------------------------------
+// CVpnApItem::HasProxy
+// ---------------------------------------------------------
+//
+TBool CVpnApItem::HasProxy() const
+    {
+    CLOG( ( EApItem, 0, _L( "-> CVpnApItem::HasProxy" ) ) );
+    
+    TBool retval ( EFalse );
+
+    if ( ( iProxyServerAddress->Compare( KDynIpAddress ) 
+         && iProxyServerAddress->Compare( KEmpty ) )
+         && ( iProxyPort != 0 ) )
+        {
+        retval = ETrue;
+        }
+
+    CLOG( ( EApItem, 0, _L( "<- CVpnApItem::HasProxy" ) ) );
+
+    return retval;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apeng/src/aplistitemlist.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2002 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 the CApSelect class.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "ApListItemList.h"
+#include "ApListItem.h"
+#include "ApEngineLogger.h"
+
+
+// CONSTANTS
+
+LOCAL_D const TInt KGranularity = 4;    ///< Granularity of the list.
+
+// ================= MEMBER FUNCTIONS =======================
+
+// C++ default constructor can NOT contain any code that
+// might leave.
+//
+// ---------------------------------------------------------
+// CApListItemList::CApListItemList
+// ---------------------------------------------------------
+//
+EXPORT_C CApListItemList::CApListItemList()
+: CArrayPtrFlat<CApListItem>( KGranularity )
+    {
+    }
+
+// Destructor
+// ---------------------------------------------------------
+// CApListItemList::~CApListItemList
+// ---------------------------------------------------------
+//
+EXPORT_C CApListItemList::~CApListItemList()
+    {
+    CLOG( ( EApList, 0, _L( "-> CApListItemList::~CApListItemList" ) ) );
+
+    ResetAndDestroy();
+
+    CLOG( ( EApList, 1, _L( "<- CApListItemList::~CApListItemList" ) ) );
+    }
+
+// ---------------------------------------------------------
+// CApListItemList::ItemByUid
+// ---------------------------------------------------------
+//
+EXPORT_C CApListItem* CApListItemList::ItemForUid( TUint32 aUid ) const
+    {
+    CLOG( ( EApList, 0, _L( "-> CApListItemList::ItemForUid" ) ) );
+
+    // This method cannot return "const CApListItem*", because all methods
+    // of CApListItem are non-const -> if the returned item was const, it
+    // would be unusable.
+    TInt i;
+    TInt count = Count();
+    for ( i = 0; i < count; i++ )
+        {
+        if ( At( i )->Uid() == aUid )
+            {
+            return At( i );
+            }
+        }
+
+    CLOG( ( EApList, 0, _L( "-> CApListItemList::ItemForUid" ) ) );
+    return NULL;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apeng/src/apnetworkitemlist.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2002 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 the CApNetworkItemList class.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "ApNetworkItemList.h"
+#include "ApNetworkItem.h"
+#include "ApEngineLogger.h"
+
+
+// CONSTANTS
+
+LOCAL_D const TInt KGranularity = 4;    ///< Granularity of the list.
+
+// ================= MEMBER FUNCTIONS =======================
+
+// C++ default constructor can NOT contain any code that
+// might leave.
+//
+// ---------------------------------------------------------
+// CApNetworkItemList::CApNetworkItemList
+// ---------------------------------------------------------
+//
+EXPORT_C CApNetworkItemList::CApNetworkItemList()
+: CArrayPtrFlat<CApNetworkItem>( KGranularity )
+    {
+    CLOG( ( ENetworks, 0, _L( "<-> CApNetworkItem::CApNetworkItemList" ) ) );
+    }
+
+// Destructor
+// ---------------------------------------------------------
+// CApNetworkItemList::~CApNetworkItemList
+// ---------------------------------------------------------
+//
+EXPORT_C CApNetworkItemList::~CApNetworkItemList()
+    {
+    CLOG( ( ENetworks, 0, _L( "-> CApNetworkItem::~CApNetworkItemList" ) ) );
+
+    ResetAndDestroy();
+
+    CLOG( ( ENetworks, 1, _L( "<- CApNetworkItem::~CApNetworkItemList" ) ) );
+    }
+
+
+// ---------------------------------------------------------
+// CApNetworkItemList::ItemForUid
+// ---------------------------------------------------------
+//
+EXPORT_C const CApNetworkItem* CApNetworkItemList::ItemForUid
+( TUint32 aUid ) const
+    {
+    CLOG( ( ENetworks, 0, _L( "-> CApNetworkItem::ItemForUid" ) ) );
+
+    TInt i;
+    TInt count = Count();
+    for ( i = 0; i < count; i++ )
+        {
+        if ( At( i )->Uid() == aUid )
+            {
+            return At( i );
+            }
+        }
+
+    CLOG( ( ENetworks, 1, _L( "<- CApNetworkItem::ItemForUid" ) ) );
+    return NULL;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/BMARM/APSETTINGSHANDLERUIU.DEF	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,21 @@
+EXPORTS
+	__18CApSettingsHandleri18TSelectionListType18TSelectionMenuType @ 1 NONAME ; CApSettingsHandler::CApSettingsHandler(int, TSelectionListType, TSelectionMenuType)
+	ConstructL__18CApSettingsHandleriii @ 2 NONAME ; CApSettingsHandler::ConstructL(int, int, int)
+	E32Dll__F10TDllReason @ 3 NONAME R3UNUSED ; E32Dll(TDllReason)
+	NewLC__18CApSettingsHandlerR11CActiveApDbi18TSelectionListType18TSelectionMenuTypeiii @ 4 NONAME ; CApSettingsHandler::NewLC(CActiveApDb &, int, TSelectionListType, TSelectionMenuType, int, int, int)
+	NewLC__18CApSettingsHandleri18TSelectionListType18TSelectionMenuTypeiii @ 5 NONAME ; CApSettingsHandler::NewLC(int, TSelectionListType, TSelectionMenuType, int, int, int)
+	RunSettingsL__18CApSettingsHandlerUlRUl @ 6 NONAME R3UNUSED ; CApSettingsHandler::RunSettingsL(unsigned long, unsigned long &)
+	RunViewerL__18CApSettingsHandlerUl @ 7 NONAME R3UNUSED ; CApSettingsHandler::RunViewerL(unsigned long)
+	SetFilterL__18CApSettingsHandleriii @ 8 NONAME ; CApSettingsHandler::SetFilterL(int, int, int)
+	SetTextOverrideL__18CApSettingsHandler7TTextIDRC7TDesC16 @ 9 NONAME R3UNUSED ; CApSettingsHandler::SetTextOverrideL(TTextID, TDesC16 const &)
+	TextOverrideL__18CApSettingsHandler7TTextID @ 10 NONAME R3UNUSED ; CApSettingsHandler::TextOverrideL(TTextID)
+	"_._18CApSettingsHandler" @ 11 NONAME R3UNUSED ; CApSettingsHandler::~CApSettingsHandler(void)
+	ConstructL__18CApSettingsHandlerR11CActiveApDbiii @ 12 NONAME ; CApSettingsHandler::ConstructL(CActiveApDb &, int, int, int)
+	Cvt__18CApSettingsHandler @ 13 NONAME R3UNUSED ; CApSettingsHandler::Cvt(void)
+	NewLC__18CApSettingsHandlerR11CActiveApDbi18TSelectionListType18TSelectionMenuTypeiiii @ 14 NONAME ; CApSettingsHandler::NewLC(CActiveApDb &, int, TSelectionListType, TSelectionMenuType, int, int, int, int)
+	NewLC__18CApSettingsHandleri18TSelectionListType18TSelectionMenuTypeiiii @ 15 NONAME ; CApSettingsHandler::NewLC(int, TSelectionListType, TSelectionMenuType, int, int, int, int)
+	ConstructL__18CApSettingsHandlerR11CActiveApDbiii14TVpnFilterType @ 16 NONAME ; CApSettingsHandler::ConstructL(CActiveApDb &, int, int, int, TVpnFilterType)
+	ConstructL__18CApSettingsHandleriii14TVpnFilterType @ 17 NONAME ; CApSettingsHandler::ConstructL(int, int, int, TVpnFilterType)
+	NewLC__18CApSettingsHandlerR11CActiveApDbi18TSelectionListType18TSelectionMenuTypeiiii14TVpnFilterType @ 18 NONAME ; CApSettingsHandler::NewLC(CActiveApDb &, int, TSelectionListType, TSelectionMenuType, int, int, int, int, TVpnFilterType)
+	NewLC__18CApSettingsHandleri18TSelectionListType18TSelectionMenuTypeiiii14TVpnFilterType @ 19 NONAME ; CApSettingsHandler::NewLC(int, TSelectionListType, TSelectionMenuType, int, int, int, int, TVpnFilterType)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/BMARM/ApSettingsHandlerUI_EKA2U.def	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,20 @@
+EXPORTS
+	__18CApSettingsHandleri18TSelectionListType18TSelectionMenuType @ 1 NONAME ; CApSettingsHandler::CApSettingsHandler(int, TSelectionListType, TSelectionMenuType)
+	ConstructL__18CApSettingsHandlerR11CActiveApDbiii14TVpnFilterType @ 2 NONAME ; CApSettingsHandler::ConstructL(CActiveApDb &, int, int, int, TVpnFilterType)
+	ConstructL__18CApSettingsHandleriii @ 3 NONAME ; CApSettingsHandler::ConstructL(int, int, int)
+	ConstructL__18CApSettingsHandleriii14TVpnFilterType @ 4 NONAME ; CApSettingsHandler::ConstructL(int, int, int, TVpnFilterType)
+	Cvt__18CApSettingsHandler @ 5 NONAME R3UNUSED ; CApSettingsHandler::Cvt(void)
+	NewLC__18CApSettingsHandlerR11CActiveApDbi18TSelectionListType18TSelectionMenuTypeiii @ 6 NONAME ; CApSettingsHandler::NewLC(CActiveApDb &, int, TSelectionListType, TSelectionMenuType, int, int, int)
+	NewLC__18CApSettingsHandlerR11CActiveApDbi18TSelectionListType18TSelectionMenuTypeiiii @ 7 NONAME ; CApSettingsHandler::NewLC(CActiveApDb &, int, TSelectionListType, TSelectionMenuType, int, int, int, int)
+	NewLC__18CApSettingsHandlerR11CActiveApDbi18TSelectionListType18TSelectionMenuTypeiiii14TVpnFilterType @ 8 NONAME ; CApSettingsHandler::NewLC(CActiveApDb &, int, TSelectionListType, TSelectionMenuType, int, int, int, int, TVpnFilterType)
+	NewLC__18CApSettingsHandleri18TSelectionListType18TSelectionMenuTypeiii @ 9 NONAME ; CApSettingsHandler::NewLC(int, TSelectionListType, TSelectionMenuType, int, int, int)
+	NewLC__18CApSettingsHandleri18TSelectionListType18TSelectionMenuTypeiiii @ 10 NONAME ; CApSettingsHandler::NewLC(int, TSelectionListType, TSelectionMenuType, int, int, int, int)
+	NewLC__18CApSettingsHandleri18TSelectionListType18TSelectionMenuTypeiiii14TVpnFilterType @ 11 NONAME ; CApSettingsHandler::NewLC(int, TSelectionListType, TSelectionMenuType, int, int, int, int, TVpnFilterType)
+	RunSettingsL__18CApSettingsHandlerUlRUl @ 12 NONAME R3UNUSED ; CApSettingsHandler::RunSettingsL(unsigned long, unsigned long &)
+	RunViewerL__18CApSettingsHandlerUl @ 13 NONAME R3UNUSED ; CApSettingsHandler::RunViewerL(unsigned long)
+	SetFilterL__18CApSettingsHandleriii @ 14 NONAME ; CApSettingsHandler::SetFilterL(int, int, int)
+	SetTextOverrideL__18CApSettingsHandler7TTextIDRC7TDesC16 @ 15 NONAME R3UNUSED ; CApSettingsHandler::SetTextOverrideL(TTextID, TDesC16 const &)
+	TextOverrideL__18CApSettingsHandler7TTextID @ 16 NONAME R3UNUSED ; CApSettingsHandler::TextOverrideL(TTextID)
+	"_._18CApSettingsHandler" @ 17 NONAME R3UNUSED ; CApSettingsHandler::~CApSettingsHandler(void)
+	ConstructL__18CApSettingsHandlerR11CActiveApDbiii @ 18 NONAME ; CApSettingsHandler::ConstructL(CActiveApDb &, int, int, int)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/BWINS/APSETTINGSHANDLERUIU.DEF	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,21 @@
+EXPORTS
+	??0CApSettingsHandler@@IAE@HW4TSelectionListType@@W4TSelectionMenuType@@@Z @ 1 NONAME ; protected: __thiscall CApSettingsHandler::CApSettingsHandler(int,enum TSelectionListType,enum TSelectionMenuType)
+	??1CApSettingsHandler@@UAE@XZ @ 2 NONAME ; public: virtual __thiscall CApSettingsHandler::~CApSettingsHandler(void)
+	?ConstructL@CApSettingsHandler@@IAEXHHH@Z @ 3 NONAME ; protected: void __thiscall CApSettingsHandler::ConstructL(int,int,int)
+	?E32Dll@@YAHW4TDllReason@@@Z @ 4 NONAME ; int __cdecl E32Dll(enum TDllReason)
+	?NewLC@CApSettingsHandler@@SAPAV1@HW4TSelectionListType@@W4TSelectionMenuType@@HHH@Z @ 5 NONAME ; public: static class CApSettingsHandler * __cdecl CApSettingsHandler::NewLC(int,enum TSelectionListType,enum TSelectionMenuType,int,int,int)
+	?RunSettingsL@CApSettingsHandler@@QAEHKAAK@Z @ 6 NONAME ; public: int __thiscall CApSettingsHandler::RunSettingsL(unsigned long,unsigned long &)
+	?RunViewerL@CApSettingsHandler@@IAEHK@Z @ 7 NONAME ; protected: int __thiscall CApSettingsHandler::RunViewerL(unsigned long)
+	?SetFilterL@CApSettingsHandler@@QAEXHHH@Z @ 8 NONAME ; public: void __thiscall CApSettingsHandler::SetFilterL(int,int,int)
+	?SetTextOverrideL@CApSettingsHandler@@QAEXW4TTextID@@ABVTDesC16@@@Z @ 9 NONAME ; public: void __thiscall CApSettingsHandler::SetTextOverrideL(enum TTextID,class TDesC16 const &)
+	?TextOverrideL@CApSettingsHandler@@QAEABVTDesC16@@W4TTextID@@@Z @ 10 NONAME ; public: class TDesC16 const & __thiscall CApSettingsHandler::TextOverrideL(enum TTextID)
+	?ConstructL@CApSettingsHandler@@IAEXAAVCActiveApDb@@HHH@Z @ 11 NONAME ; protected: void __thiscall CApSettingsHandler::ConstructL(class CActiveApDb &,int,int,int)
+	?NewLC@CApSettingsHandler@@SAPAV1@AAVCActiveApDb@@HW4TSelectionListType@@W4TSelectionMenuType@@HHH@Z @ 12 NONAME ; public: static class CApSettingsHandler * __cdecl CApSettingsHandler::NewLC(class CActiveApDb &,int,enum TSelectionListType,enum TSelectionMenuType,int,int,int)
+	?Cvt@CApSettingsHandler@@SAHXZ @ 13 NONAME ; public: static int __cdecl CApSettingsHandler::Cvt(void)
+	?NewLC@CApSettingsHandler@@SAPAV1@AAVCActiveApDb@@HW4TSelectionListType@@W4TSelectionMenuType@@HHHH@Z @ 14 NONAME ; public: static class CApSettingsHandler * __cdecl CApSettingsHandler::NewLC(class CActiveApDb &,int,enum TSelectionListType,enum TSelectionMenuType,int,int,int,int)
+	?NewLC@CApSettingsHandler@@SAPAV1@HW4TSelectionListType@@W4TSelectionMenuType@@HHHH@Z @ 15 NONAME ; public: static class CApSettingsHandler * __cdecl CApSettingsHandler::NewLC(int,enum TSelectionListType,enum TSelectionMenuType,int,int,int,int)
+	?ConstructL@CApSettingsHandler@@IAEXAAVCActiveApDb@@HHHW4TVpnFilterType@@@Z @ 16 NONAME ; protected: void __thiscall CApSettingsHandler::ConstructL(class CActiveApDb &,int,int,int,enum TVpnFilterType)
+	?ConstructL@CApSettingsHandler@@IAEXHHHW4TVpnFilterType@@@Z @ 17 NONAME ; protected: void __thiscall CApSettingsHandler::ConstructL(int,int,int,enum TVpnFilterType)
+	?NewLC@CApSettingsHandler@@SAPAV1@AAVCActiveApDb@@HW4TSelectionListType@@W4TSelectionMenuType@@HHHHW4TVpnFilterType@@@Z @ 18 NONAME ; public: static class CApSettingsHandler * __cdecl CApSettingsHandler::NewLC(class CActiveApDb &,int,enum TSelectionListType,enum TSelectionMenuType,int,int,int,int,enum TVpnFilterType)
+	?NewLC@CApSettingsHandler@@SAPAV1@HW4TSelectionListType@@W4TSelectionMenuType@@HHHHW4TVpnFilterType@@@Z @ 19 NONAME ; public: static class CApSettingsHandler * __cdecl CApSettingsHandler::NewLC(int,enum TSelectionListType,enum TSelectionMenuType,int,int,int,int,enum TVpnFilterType)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/BWinsCw/APSETTINGSHANDLERUIU.DEF	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,21 @@
+EXPORTS
+	??0CApSettingsHandler@@IAE@HW4TSelectionListType@@W4TSelectionMenuType@@@Z @ 1 NONAME ; CApSettingsHandler::CApSettingsHandler(int, enum TSelectionListType, enum TSelectionMenuType)
+	??1CApSettingsHandler@@UAE@XZ @ 2 NONAME ; CApSettingsHandler::~CApSettingsHandler(void)
+	?ConstructL@CApSettingsHandler@@IAEXAAVCActiveApDb@@HHH@Z @ 3 NONAME ; void CApSettingsHandler::ConstructL(class CActiveApDb &, int, int, int)
+	?ConstructL@CApSettingsHandler@@IAEXAAVCActiveApDb@@HHHW4TVpnFilterType@@@Z @ 4 NONAME ; void CApSettingsHandler::ConstructL(class CActiveApDb &, int, int, int, enum TVpnFilterType)
+	?ConstructL@CApSettingsHandler@@IAEXHHH@Z @ 5 NONAME ; void CApSettingsHandler::ConstructL(int, int, int)
+	?ConstructL@CApSettingsHandler@@IAEXHHHW4TVpnFilterType@@@Z @ 6 NONAME ; void CApSettingsHandler::ConstructL(int, int, int, enum TVpnFilterType)
+	?Cvt@CApSettingsHandler@@SAHXZ @ 7 NONAME ; int CApSettingsHandler::Cvt(void)
+	?E32Dll@@YAHW4TDllReason@@@Z @ 8 NONAME ; int E32Dll(enum TDllReason)
+	?NewLC@CApSettingsHandler@@SAPAV1@AAVCActiveApDb@@HW4TSelectionListType@@W4TSelectionMenuType@@HHH@Z @ 9 NONAME ; class CApSettingsHandler * CApSettingsHandler::NewLC(class CActiveApDb &, int, enum TSelectionListType, enum TSelectionMenuType, int, int, int)
+	?NewLC@CApSettingsHandler@@SAPAV1@AAVCActiveApDb@@HW4TSelectionListType@@W4TSelectionMenuType@@HHHH@Z @ 10 NONAME ; class CApSettingsHandler * CApSettingsHandler::NewLC(class CActiveApDb &, int, enum TSelectionListType, enum TSelectionMenuType, int, int, int, int)
+	?NewLC@CApSettingsHandler@@SAPAV1@AAVCActiveApDb@@HW4TSelectionListType@@W4TSelectionMenuType@@HHHHW4TVpnFilterType@@@Z @ 11 NONAME ; class CApSettingsHandler * CApSettingsHandler::NewLC(class CActiveApDb &, int, enum TSelectionListType, enum TSelectionMenuType, int, int, int, int, enum TVpnFilterType)
+	?NewLC@CApSettingsHandler@@SAPAV1@HW4TSelectionListType@@W4TSelectionMenuType@@HHH@Z @ 12 NONAME ; class CApSettingsHandler * CApSettingsHandler::NewLC(int, enum TSelectionListType, enum TSelectionMenuType, int, int, int)
+	?NewLC@CApSettingsHandler@@SAPAV1@HW4TSelectionListType@@W4TSelectionMenuType@@HHHH@Z @ 13 NONAME ; class CApSettingsHandler * CApSettingsHandler::NewLC(int, enum TSelectionListType, enum TSelectionMenuType, int, int, int, int)
+	?NewLC@CApSettingsHandler@@SAPAV1@HW4TSelectionListType@@W4TSelectionMenuType@@HHHHW4TVpnFilterType@@@Z @ 14 NONAME ; class CApSettingsHandler * CApSettingsHandler::NewLC(int, enum TSelectionListType, enum TSelectionMenuType, int, int, int, int, enum TVpnFilterType)
+	?RunSettingsL@CApSettingsHandler@@QAEHKAAK@Z @ 15 NONAME ; int CApSettingsHandler::RunSettingsL(unsigned long, unsigned long &)
+	?RunViewerL@CApSettingsHandler@@IAEHK@Z @ 16 NONAME ; int CApSettingsHandler::RunViewerL(unsigned long)
+	?SetFilterL@CApSettingsHandler@@QAEXHHH@Z @ 17 NONAME ; void CApSettingsHandler::SetFilterL(int, int, int)
+	?SetTextOverrideL@CApSettingsHandler@@QAEXW4TTextID@@ABVTDesC16@@@Z @ 18 NONAME ; void CApSettingsHandler::SetTextOverrideL(enum TTextID, class TDesC16 const &)
+	?TextOverrideL@CApSettingsHandler@@QAEABVTDesC16@@W4TTextID@@@Z @ 19 NONAME ; class TDesC16 const & CApSettingsHandler::TextOverrideL(enum TTextID)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/BWinsCw/ApSettingsHandlerUI_EKA2U.def	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,26 @@
+EXPORTS
+	??0CApSettingsHandler@@IAE@HW4TSelectionListType@@W4TSelectionMenuType@@@Z @ 1 NONAME ; CApSettingsHandler::CApSettingsHandler(int, enum TSelectionListType, enum TSelectionMenuType)
+	??1CApSettingsHandler@@UAE@XZ @ 2 NONAME ; CApSettingsHandler::~CApSettingsHandler(void)
+	?ConstructL@CApSettingsHandler@@IAEXAAVCActiveApDb@@HHH@Z @ 3 NONAME ; void CApSettingsHandler::ConstructL(class CActiveApDb &, int, int, int)
+	?ConstructL@CApSettingsHandler@@IAEXAAVCActiveApDb@@HHHW4TVpnFilterType@@@Z @ 4 NONAME ; void CApSettingsHandler::ConstructL(class CActiveApDb &, int, int, int, enum TVpnFilterType)
+	?ConstructL@CApSettingsHandler@@IAEXHHH@Z @ 5 NONAME ; void CApSettingsHandler::ConstructL(int, int, int)
+	?ConstructL@CApSettingsHandler@@IAEXHHHW4TVpnFilterType@@@Z @ 6 NONAME ; void CApSettingsHandler::ConstructL(int, int, int, enum TVpnFilterType)
+	?Cvt@CApSettingsHandler@@SAHXZ @ 7 NONAME ; int CApSettingsHandler::Cvt(void)
+	?NewLC@CApSettingsHandler@@SAPAV1@AAVCActiveApDb@@HW4TSelectionListType@@W4TSelectionMenuType@@HHH@Z @ 8 NONAME ; class CApSettingsHandler * CApSettingsHandler::NewLC(class CActiveApDb &, int, enum TSelectionListType, enum TSelectionMenuType, int, int, int)
+	?NewLC@CApSettingsHandler@@SAPAV1@AAVCActiveApDb@@HW4TSelectionListType@@W4TSelectionMenuType@@HHHH@Z @ 9 NONAME ; class CApSettingsHandler * CApSettingsHandler::NewLC(class CActiveApDb &, int, enum TSelectionListType, enum TSelectionMenuType, int, int, int, int)
+	?NewLC@CApSettingsHandler@@SAPAV1@AAVCActiveApDb@@HW4TSelectionListType@@W4TSelectionMenuType@@HHHHW4TVpnFilterType@@@Z @ 10 NONAME ; class CApSettingsHandler * CApSettingsHandler::NewLC(class CActiveApDb &, int, enum TSelectionListType, enum TSelectionMenuType, int, int, int, int, enum TVpnFilterType)
+	?NewLC@CApSettingsHandler@@SAPAV1@HW4TSelectionListType@@W4TSelectionMenuType@@HHH@Z @ 11 NONAME ; class CApSettingsHandler * CApSettingsHandler::NewLC(int, enum TSelectionListType, enum TSelectionMenuType, int, int, int)
+	?NewLC@CApSettingsHandler@@SAPAV1@HW4TSelectionListType@@W4TSelectionMenuType@@HHHH@Z @ 12 NONAME ; class CApSettingsHandler * CApSettingsHandler::NewLC(int, enum TSelectionListType, enum TSelectionMenuType, int, int, int, int)
+	?NewLC@CApSettingsHandler@@SAPAV1@HW4TSelectionListType@@W4TSelectionMenuType@@HHHHW4TVpnFilterType@@@Z @ 13 NONAME ; class CApSettingsHandler * CApSettingsHandler::NewLC(int, enum TSelectionListType, enum TSelectionMenuType, int, int, int, int, enum TVpnFilterType)
+	?RunSettingsL@CApSettingsHandler@@QAEHKAAK@Z @ 14 NONAME ; int CApSettingsHandler::RunSettingsL(unsigned long, unsigned long &)
+	?RunViewerL@CApSettingsHandler@@IAEHK@Z @ 15 NONAME ; int CApSettingsHandler::RunViewerL(unsigned long)
+	?SetFilterL@CApSettingsHandler@@QAEXHHH@Z @ 16 NONAME ; void CApSettingsHandler::SetFilterL(int, int, int)
+	?SetTextOverrideL@CApSettingsHandler@@QAEXW4TTextID@@ABVTDesC16@@@Z @ 17 NONAME ; void CApSettingsHandler::SetTextOverrideL(enum TTextID, class TDesC16 const &)
+	?TextOverrideL@CApSettingsHandler@@QAEABVTDesC16@@W4TTextID@@@Z @ 18 NONAME ; class TDesC16 const & CApSettingsHandler::TextOverrideL(enum TTextID)
+	?ConstructL@CApSettingsHandler@@IAEXAAVCActiveApDb@@HHHW4TVpnFilterType@@H@Z @ 19 NONAME ; void CApSettingsHandler::ConstructL(class CActiveApDb &, int, int, int, enum TVpnFilterType, int)
+	?NewLC@CApSettingsHandler@@SAPAV1@AAVCActiveApDb@@HW4TSelectionListType@@W4TSelectionMenuType@@HHHHW4TVpnFilterType@@H@Z @ 20 NONAME ; class CApSettingsHandler * CApSettingsHandler::NewLC(class CActiveApDb &, int, enum TSelectionListType, enum TSelectionMenuType, int, int, int, int, enum TVpnFilterType, int)
+	??1CApSettingsUi@@UAE@XZ @ 21 NONAME ; CApSettingsUi::~CApSettingsUi(void)
+	?ConstructL@CApSettingsUi@@IAEXHHHW4TVpnFilterType@@@Z @ 22 NONAME ; void CApSettingsUi::ConstructL(int, int, int, enum TVpnFilterType)
+	?NewLC@CApSettingsUi@@SAPAV1@HW4TSelectionListType@@W4TSelectionMenuType@@HHHHW4TVpnFilterType@@@Z @ 23 NONAME ; class CApSettingsUi * CApSettingsUi::NewLC(int, enum TSelectionListType, enum TSelectionMenuType, int, int, int, int, enum TVpnFilterType)
+	?RunSettingsL@CApSettingsUi@@QAEHKAAK@Z @ 24 NONAME ; int CApSettingsUi::RunSettingsL(unsigned long, unsigned long &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/EABI/ApSettingsHandlerUI_EKA2U.def	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,35 @@
+EXPORTS
+	_ZN18CApSettingsHandler10ConstructLER11CActiveApDbiii @ 1 NONAME
+	_ZN18CApSettingsHandler10ConstructLER11CActiveApDbiii14TVpnFilterType @ 2 NONAME
+	_ZN18CApSettingsHandler10ConstructLEiii @ 3 NONAME
+	_ZN18CApSettingsHandler10ConstructLEiii14TVpnFilterType @ 4 NONAME
+	_ZN18CApSettingsHandler10RunViewerLEm @ 5 NONAME
+	_ZN18CApSettingsHandler10SetFilterLEiii @ 6 NONAME
+	_ZN18CApSettingsHandler12RunSettingsLEmRm @ 7 NONAME
+	_ZN18CApSettingsHandler13TextOverrideLE7TTextID @ 8 NONAME
+	_ZN18CApSettingsHandler16SetTextOverrideLE7TTextIDRK7TDesC16 @ 9 NONAME
+	_ZN18CApSettingsHandler3CvtEv @ 10 NONAME
+	_ZN18CApSettingsHandler5NewLCER11CActiveApDbi18TSelectionListType18TSelectionMenuTypeiii @ 11 NONAME
+	_ZN18CApSettingsHandler5NewLCER11CActiveApDbi18TSelectionListType18TSelectionMenuTypeiiii @ 12 NONAME
+	_ZN18CApSettingsHandler5NewLCER11CActiveApDbi18TSelectionListType18TSelectionMenuTypeiiii14TVpnFilterType @ 13 NONAME
+	_ZN18CApSettingsHandler5NewLCEi18TSelectionListType18TSelectionMenuTypeiii @ 14 NONAME
+	_ZN18CApSettingsHandler5NewLCEi18TSelectionListType18TSelectionMenuTypeiiii @ 15 NONAME
+	_ZN18CApSettingsHandler5NewLCEi18TSelectionListType18TSelectionMenuTypeiiii14TVpnFilterType @ 16 NONAME
+	_ZN18CApSettingsHandlerC1Ei18TSelectionListType18TSelectionMenuType @ 17 NONAME
+	_ZN18CApSettingsHandlerC2Ei18TSelectionListType18TSelectionMenuType @ 18 NONAME
+	_ZN18CApSettingsHandlerD0Ev @ 19 NONAME
+	_ZN18CApSettingsHandlerD1Ev @ 20 NONAME
+	_ZN18CApSettingsHandlerD2Ev @ 21 NONAME
+	_ZTI18CApSettingsHandler @ 22 NONAME ; #<TI>#
+	_ZTV18CApSettingsHandler @ 23 NONAME ; #<VT>#
+	_ZN18CApSettingsHandler10ConstructLER11CActiveApDbiii14TVpnFilterTypei @ 24 NONAME
+	_ZN18CApSettingsHandler5NewLCER11CActiveApDbi18TSelectionListType18TSelectionMenuTypeiiii14TVpnFilterTypei @ 25 NONAME
+	_ZN13CApSettingsUi10ConstructLEiii14TVpnFilterType @ 26 NONAME
+	_ZN13CApSettingsUi12RunSettingsLEmRm @ 27 NONAME
+	_ZN13CApSettingsUi5NewLCEi18TSelectionListType18TSelectionMenuTypeiiii14TVpnFilterType @ 28 NONAME
+	_ZN13CApSettingsUiD0Ev @ 29 NONAME
+	_ZN13CApSettingsUiD1Ev @ 30 NONAME
+	_ZN13CApSettingsUiD2Ev @ 31 NONAME
+	_ZTI13CApSettingsUi @ 32 NONAME ; #<TI>#
+	_ZTV13CApSettingsUi @ 33 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/Rom/ApSettingsHandlerUI.iby	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,24 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef __APSETTINGSHANDLERUI_IBY__
+#define __APSETTINGSHANDLERUI_IBY__
+
+FILE=ABI_DIR\BUILD_DIR\ApSettingsHandlerUi.dll    SHARED_LIB_DIR\ApSettingsHandlerUi.dll
+SCALABLE_IMAGE(APP_BITMAP_DIR,APP_BITMAP_DIR,ApSettings)
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/Rom/ApSettingsHandlerUIResources.iby	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef __APSETTINGSHANDLERUIRESOURCE_IBY__
+#define __APSETTINGSHANDLERUIRESOURCE_IBY__
+
+DATA=DATAZ_\RESOURCE_FILES_DIR\ApSetUi.rsc	RESOURCE_FILES_DIR\ApSetUi.rsc
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/data/apsetui.rss	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,1642 @@
+/*
+* Copyright (c) 2002 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 all the resources for the ApSettings UI.
+*
+*/
+
+
+//  RESOURCE IDENTIFIER
+NAME    ASUI // 4 letter ID
+
+//  INCLUDES
+#include    <data_caging_paths_strings.hrh>
+
+#include <eikon.rh>
+#include <avkon.loc>
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.mbg>
+#include <AvkonIcons.hrh>
+#include "ApSettingsHandlerUI.hrh"
+#include <apsettingshandlerui.loc>
+#include "ApSettingsHandlerConsts.h"
+#include "eikon.rsg"
+//#include <eikon.mbg>
+#include <uikon.rh>
+#include <apsettings.mbg>
+
+
+
+//For Ip address editor
+#define IPADDRESS_MIN_FIRST_FIELD_VALUE     0
+#define IPADDRESS_MIN_SECOND_FIELD_VALUE    0
+#define IPADDRESS_MIN_THIRD_FIELD_VALUE     0
+#define IPADDRESS_MIN_FOURTH_FIELD_VALUE    0
+#define IPADDRESS_MAX_FIRST_FIELD_VALUE     255
+#define IPADDRESS_MAX_SECOND_FIELD_VALUE    255
+#define IPADDRESS_MAX_THIRD_FIELD_VALUE     255
+#define IPADDRESS_MAX_FOURTH_FIELD_VALUE    255
+
+//  RESOURCE DEFINITIONS
+
+RESOURCE RSS_SIGNATURE { }
+
+RESOURCE TBUF { buf="ApSettingsHandlerUI"; }
+
+
+
+//----------------------------------------------------
+//
+//    r_apsettingsui_select_only_menubar
+//
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_BAR r_apsettingsui_select_only_menubar
+    {
+    titles=
+        {
+        MENU_TITLE { menu_pane=r_apsettingsui_menu_select_only; txt="A"; }
+        };
+    }
+
+//----------------------------------------------------
+//
+//    r_apsettingsui_select_normal_menubar
+//
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_BAR r_apsettingsui_select_normal_menubar
+    {
+    titles=
+        {
+        MENU_TITLE { menu_pane=r_apsettingsui_menu_select_normal; txt="A"; }
+        };
+    }
+
+
+
+//----------------------------------------------------
+//
+//    r_apsettingsui_normal_menubar
+//
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_BAR r_apsettingsui_normal_menubar
+    {
+    titles=
+        {
+        MENU_TITLE { menu_pane=r_apsettingsui_menu_normal; txt="A"; }
+        };
+    }
+
+
+
+
+//----------------------------------------------------
+//
+//    r_apsettings_menubar
+//
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_BAR r_apsettings_menubar
+    {
+    titles=
+        {
+        MENU_TITLE { menu_pane=r_apsettings_menu; txt="A"; }
+        };
+    }
+
+
+
+//----------------------------------------------------
+//
+//    r_apsettingsui_menu_select_only
+//
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_PANE r_apsettingsui_menu_select_only
+    {
+    items=
+        {
+        MENU_ITEM { command=EApSelCmdSelect; txt= qtn_set_cmd_select; flags = EEikMenuItemAction; }
+        };
+    }
+
+
+//----------------------------------------------------
+//
+//    r_apsettingsui_menu_select_normal
+//
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_PANE r_apsettingsui_menu_select_normal
+    {
+    items=
+        {
+        MENU_ITEM { command=EApSelCmdSelect; txt= qtn_set_cmd_select; flags = EEikMenuItemAction; },
+        MENU_ITEM { command=EApSelCmdOpen; txt= qtn_set_cmd_edit_ap; flags = EEikMenuItemAction;},
+        MENU_ITEM { command=EApSelCmdNewBlank; txt= qtn_set_cmd_new_ap; }, 
+        MENU_ITEM { command=EApSelCmdDelete; txt= qtn_set_cmd_del_ap; flags = EEikMenuItemSpecific; },
+        MENU_ITEM { command=EApSelCmdNewUseExisting; txt= qtn_netw_options_duplicate_iap; flags = EEikMenuItemSpecific;},
+        MENU_ITEM { command=EAknCmdHelp; txt= qtn_set_options_help; },
+        MENU_ITEM { command=EApSelCmdExit; txt= qtn_set_options_exit; }
+        };
+    }
+
+
+//----------------------------------------------------
+//
+//    r_apsettingsui_menu_normal
+//
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_PANE r_apsettingsui_menu_normal
+    {
+    items=
+        {
+        MENU_ITEM { command=EApSelCmdOpen; txt= qtn_set_cmd_edit_ap; flags = EEikMenuItemAction;},
+        MENU_ITEM { command=EApSelCmdNewBlank; txt= qtn_set_cmd_new_ap; }, 
+        MENU_ITEM { command=EApSelCmdDelete; txt= qtn_set_cmd_del_ap; flags = EEikMenuItemSpecific;},
+        MENU_ITEM { command=EApSelCmdNewUseExisting; txt= qtn_netw_options_duplicate_iap; flags = EEikMenuItemSpecific;},
+        MENU_ITEM { command=EAknCmdHelp; txt= qtn_set_options_help; },
+        MENU_ITEM { command=EApSelCmdExit; txt= qtn_set_options_exit; }
+        };
+    }
+
+
+
+
+
+//----------------------------------------------------
+//
+//    r_apsettings_menu
+//
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_PANE r_apsettings_menu
+    {
+    items=
+        {
+        MENU_ITEM { command=EApSelCmdChange; txt= qtn_set_options_change; flags = EEikMenuItemAction;},
+        MENU_ITEM { command=EApSelCmdAdvanced; txt= qtn_set_options_ap_advanced; flags = EEikMenuItemSpecific;},
+        MENU_ITEM { command=EAknCmdHelp; txt= qtn_set_options_help; },
+        MENU_ITEM { command=EApSelCmdExit; txt= qtn_set_options_exit; }
+        };
+    }
+
+
+
+//----------------------------------------------------
+//
+//    r_apselector_pane_softkeys_options_back_edit
+//
+//
+//----------------------------------------------------
+//
+RESOURCE CBA r_apselector_pane_softkeys_options_back_edit
+    {
+    buttons =
+        {
+        CBA_BUTTON {id=EAknSoftkeyOptions; txt = text_softkey_option;},
+        CBA_BUTTON {id=EAknSoftkeyBack; txt = text_softkey_back; },
+        CBA_BUTTON {id=EApSelCmdOpen; txt = qtn_msk_edit;}
+        };
+    }
+
+//----------------------------------------------------
+//
+//    r_apselector_pane_dialog
+//
+//
+//----------------------------------------------------
+//
+RESOURCE DIALOG r_apselector_pane_dialog
+    {
+
+    flags=  EEikDialogFlagWait | EEikDialogFlagNoDrag | EEikDialogFlagNoTitleBar |
+            EEikDialogFlagFillAppClientRect |
+            EEikDialogFlagCbaButtons;
+    buttons=r_apselector_pane_softkeys_options_back_edit;
+    items=
+        {
+        DLG_LINE
+            {
+            type = KApSelectorListboxType;
+            id = KApSelectorListboxId;
+            control= LISTBOX { flags = EAknListBoxSelectionList; };
+            }
+        };
+    }
+
+
+//----------------------------------------------------
+//
+//    r_apselector_popup_dialog
+//
+//
+//----------------------------------------------------
+//
+RESOURCE DIALOG r_apselector_popup_dialog
+    {
+
+    flags=EEikDialogFlagWait | EEikDialogFlagNoDrag | EEikDialogFlagNoTitleBar |
+          EEikDialogFlagCbaButtons;
+    buttons=r_apselector_pane_softkeys_options_back_edit;
+    items=
+        {
+        DLG_LINE
+            {
+            type = KApSelectorListboxType;
+            id = KApSelectorListboxId;
+            control= LISTBOX { flags = EAknListBoxSelectionList; width = 60; height = 4;};
+            }
+        };
+    }
+
+//----------------------------------------------------
+//
+//    r_apsettings_softkeys_options_back_change
+//
+//
+//----------------------------------------------------
+//
+RESOURCE CBA r_apsettings_softkeys_options_back_change
+    {
+    buttons =
+        {
+        CBA_BUTTON {id=EAknSoftkeyOptions; txt = text_softkey_option;},
+        CBA_BUTTON {id=EAknSoftkeyBack; txt = text_softkey_back; },
+        CBA_BUTTON {id=EApSelCmdQuickChange; txt = qtn_msk_change;}
+        };
+    }
+    
+//----------------------------------------------------
+//
+//    r_apsettings_dialog
+//
+//
+//----------------------------------------------------
+//
+RESOURCE DIALOG r_apsettings_dialog
+    {
+    flags=EEikDialogFlagWait | EEikDialogFlagNoDrag | EEikDialogFlagNoTitleBar |
+          EEikDialogFlagFillAppClientRect |
+          EEikDialogFlagCbaButtons;
+
+    buttons=r_apsettings_softkeys_options_back_change;
+    items=
+        {
+        DLG_LINE
+            {
+            type = EAknCtSettingListBox;
+            id = KApSettingsListboxId;
+            control= LISTBOX { flags = EEikListBoxMultipleSelection;};
+            }
+        };
+    }
+
+
+
+RESOURCE LISTBOX r_listbox_ap_settings
+    {
+    flags = EEikListBoxMultipleSelection;
+    }
+
+
+
+
+
+
+
+RESOURCE DIALOG r_confirmation_query
+    {
+    flags=EGeneralQueryFlags;
+    buttons=R_AVKON_SOFTKEYS_YES_NO__YES;
+     items=
+        {
+        DLG_LINE
+            {
+            type=EAknCtQuery;
+            id=EGeneralQuery;
+            control= AVKON_CONFIRMATION_QUERY
+                {
+                    layout = EConfirmationLayout;
+                };
+            }
+        };
+    }
+
+
+RESOURCE DIALOG r_general_note
+    {
+    flags=EEikDialogFlagNoDrag | EEikDialogFlagNoTitleBar |
+          EEikDialogFlagCbaButtons | EEikDialogFlagWait;
+    buttons=R_AVKON_SOFTKEYS_EMPTY;
+    items=
+        {
+        DLG_LINE
+            {
+            type=EAknCtNote;
+            id = EGeneralNote;
+            control= AVKON_NOTE
+                {
+                layout = EGeneralLayout;
+                singular_label = "";
+                plural_label = "";
+                animation = R_QGN_NOTE_INFO_ANIM;
+                };
+            }
+        };
+    }
+
+ 
+// Ap data editor resources
+// Connection name
+RESOURCE EDWIN r_setting_app_edwin_conn_name
+    {
+    width=KConnNameWidth;
+    lines=KConnNameLines;
+    maxlength=KMaxConnNameLength;
+    allowed_input_modes = EAknEditorTextInputMode | EAknEditorNumericInputMode;
+    default_input_mode = EAknEditorTextInputMode;
+    flags= EEikEdwinAutoSelection | EEikEdwinNoLineOrParaBreaks;
+    }
+RESOURCE AVKON_SETTING_PAGE r_text_setting_page_conn_name
+    {
+    number= EAknSettingPageNoOrdinalDisplayed;
+    softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+    label= qtn_set_ap_conn_name;
+    type = EEikCtEdwin;
+    editor_resource_id = r_setting_app_edwin_conn_name;
+    }
+
+
+
+// GprsAccessPointName
+RESOURCE EDWIN r_setting_app_edwin_gprsap_name
+    {
+    width=KGprsApNameWidth;
+    lines=KGprsApNameLines;
+    maxlength=KMaxGprsApNameLength;
+    allowed_input_modes = EAknEditorTextInputMode | EAknEditorNumericInputMode;
+    default_input_mode = EAknEditorTextInputMode;
+    default_case = EAknEditorLowerCase;
+	avkon_flags = EAknEditorFlagLatinInputModesOnly;
+    flags = EEikEdwinAutoSelection | EEikEdwinNoLineOrParaBreaks;
+    }
+RESOURCE AVKON_SETTING_PAGE r_text_setting_page_gprsap_name
+    {
+    number= EAknSettingPageNoOrdinalDisplayed;
+    softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+    label= qtn_set_access_point_name;
+    type = EEikCtEdwin;
+    editor_resource_id = r_setting_app_edwin_gprsap_name;
+    }
+
+
+
+// LoginName:
+RESOURCE EDWIN r_setting_app_edwin_login_name
+    {
+    width=KLoginNameWidth;
+    lines=KLoginNameLines;
+    maxlength=KMaxLoginNameLength;
+    allowed_input_modes = EAknEditorTextInputMode | EAknEditorNumericInputMode;
+    default_input_mode = EAknEditorTextInputMode;
+    default_case = EAknEditorLowerCase;
+    flags= EEikEdwinAutoSelection | EEikEdwinNoLineOrParaBreaks;
+    avkon_flags=EAknEditorFlagNoT9 | EAknEditorFlagLatinInputModesOnly;    
+    }
+RESOURCE AVKON_SETTING_PAGE r_text_setting_page_login_name
+    {
+    number= EAknSettingPageNoOrdinalDisplayed;
+    softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+    label= qtn_set_ap_username;
+    type = EEikCtEdwin;
+    editor_resource_id = r_setting_app_edwin_login_name;
+    }
+
+
+
+// StartingPage:
+RESOURCE EDWIN r_setting_app_edwin_starting_page
+    {
+    width=KStartPageWidth;
+    lines=KStartPageLines;
+    maxlength=KMaxStartPageLength;
+    numeric_keymap=EAknEditorCalculatorNumberModeKeymap;
+    allowed_input_modes = EAknEditorTextInputMode | EAknEditorNumericInputMode;
+    default_input_mode = EAknEditorTextInputMode;
+    special_character_table = R_AVKON_URL_SPECIAL_CHARACTER_TABLE_DIALOG;
+    default_case = EAknEditorLowerCase;
+    flags= EEikEdwinAutoSelection | EAknEditorLowerCase | EEikEdwinNoLineOrParaBreaks;
+    avkon_flags=EAknEditorFlagNoT9 | EAknEditorFlagLatinInputModesOnly;
+    }
+RESOURCE AVKON_SETTING_PAGE r_text_setting_page_starting_page
+    {
+    number= EAknSettingPageNoOrdinalDisplayed;
+    softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+    label= qtn_set_starting_page;
+    type = EEikCtEdwin;
+    editor_resource_id = r_setting_app_edwin_starting_page;
+    }
+
+
+// Modem init string
+RESOURCE EDWIN r_setting_app_edwin_modem_init_string
+    {
+    width=KModInitStringWidth;
+    lines=KModInitStringLines;
+    maxlength=KMaxModInitStringLength;
+    allowed_input_modes = EAknEditorTextInputMode | EAknEditorNumericInputMode;
+    default_input_mode = EAknEditorTextInputMode;
+    avkon_flags=EAknEditorFlagNoT9 | EAknEditorFlagLatinInputModesOnly;
+    flags= EEikEdwinAutoSelection | EEikEdwinOnlyASCIIChars;
+    }
+RESOURCE AVKON_SETTING_PAGE r_text_setting_page_modem_init_string
+    {
+    number= EAknSettingPageNoOrdinalDisplayed;
+    softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+    label= qtn_set_modem_init_string;
+    type = EEikCtEdwin;
+    editor_resource_id = r_setting_app_edwin_modem_init_string;
+    }
+
+
+
+
+/*
+//        case EApIspDefaultTelNumber:
+//        case EApIspIfCallbackInfo:
+//        case EApWapServiceCentreAddress:
+*/
+
+
+// AccessNumber (edwin):
+RESOURCE EDWIN r_setting_app_edwin_access_num
+    {
+    width=KAccessNumWidth;
+    lines=KAccessNumLines;
+    maxlength=KMaxAccessNumLength;
+    numeric_keymap=EAknEditorStandardNumberModeKeymap;
+    allowed_input_modes=EAknEditorNumericInputMode;
+    default_input_mode=EAknEditorNumericInputMode;
+    avkon_flags=EAknEditorFlagNoT9;
+    flags = EEikEdwinAutoSelection;
+    }
+
+
+RESOURCE AVKON_SETTING_PAGE r_text_setting_page_access_num
+    {
+    number= EAknSettingPageNoOrdinalDisplayed;
+    softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+    label= qtn_set_access_number;
+    type = EEikCtEdwin;
+    editor_resource_id = r_setting_app_edwin_access_num;
+    }
+
+
+
+// CallbackInfo:
+RESOURCE EDWIN r_setting_app_edwin_cb_num
+    {
+    width = KCBInfoWidth;
+    lines = KCBInfoLines;
+    maxlength = KCBInfoLength;
+    numeric_keymap=EAknEditorStandardNumberModeKeymap;
+    allowed_input_modes = EAknEditorNumericInputMode;
+    default_input_mode = EAknEditorNumericInputMode;
+    avkon_flags = EAknEditorFlagNoT9;
+    flags = EEikEdwinAutoSelection;
+    }
+RESOURCE AVKON_SETTING_PAGE r_text_setting_page_cb_num
+    {
+    number= EAknSettingPageNoOrdinalDisplayed;
+    softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+    label= qtn_set_cb_number;
+    type = EEikCtEdwin;
+    editor_resource_id = r_setting_app_edwin_cb_num;
+    }
+
+
+
+// ServiceCentreAddress: qtn_set_server_access
+RESOURCE EDWIN r_setting_app_edwin_server_access
+    {
+    width=KServiceCentreAddrWidth;
+    lines=KServiceCentreAddrLines;
+    maxlength=KMaxServiceCentreAddrLength;
+    numeric_keymap=EAknEditorStandardNumberModeKeymap;
+    allowed_input_modes=EAknEditorNumericInputMode;
+    default_input_mode=EAknEditorNumericInputMode;
+    avkon_flags=EAknEditorFlagNoT9;
+    flags = EEikEdwinAutoSelection;
+    }
+RESOURCE AVKON_SETTING_PAGE r_text_setting_page_server_access
+    {
+    number= EAknSettingPageNoOrdinalDisplayed;
+    softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+    label= qtn_set_server_access;
+    type = EEikCtEdwin;
+    editor_resource_id = r_setting_app_edwin_server_access;
+    }
+
+
+
+
+// ServiceAccessNumber: qtn_set_service_access, SMS WAP Gateway
+RESOURCE EDWIN r_setting_app_edwin_service_access
+    {
+    width=KServiceAccessNumWidth;
+    lines=KServiceAccessNumLines;
+    maxlength=KMaxServiceAccessNumLength;
+    numeric_keymap=EAknEditorStandardNumberModeKeymap;
+    allowed_input_modes=EAknEditorNumericInputMode;
+    default_input_mode=EAknEditorNumericInputMode;
+    avkon_flags=EAknEditorFlagNoT9;
+    flags = EEikEdwinAutoSelection;
+    }
+RESOURCE AVKON_SETTING_PAGE r_text_setting_page_service_access
+    {
+    number= EAknSettingPageNoOrdinalDisplayed;
+    softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+    label= qtn_set_service_access;
+    type = EEikCtEdwin;
+    editor_resource_id = r_setting_app_edwin_service_access;
+    }
+
+
+
+//////////////////////////////////////////////////////////////////////////////
+//       IPEditor
+//////////////////////////////////////////////////////////////////////////////
+RESOURCE IP_FIELD_EDITOR r_setting_app_ip_editor
+    {
+    min_field_values = IP_FIELD
+        {
+        first_field = 0;
+        second_field = 0;
+        third_field = 0;
+        fourth_field = 0;
+        };
+    max_field_values = IP_FIELD
+        {
+        first_field = 255;
+        second_field = 255;
+        third_field = 255;
+        fourth_field = 255;
+        };
+    flags = 0;
+    }
+
+
+// WapGatewayAddress:
+RESOURCE AVKON_SETTING_PAGE r_text_setting_page_gw_addr
+    {
+    number= EAknSettingPageNoOrdinalDisplayed;
+    softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+    label= qtn_set_gateway_ip;
+    type = EAknCtIpFieldEditor;
+    editor_resource_id = r_setting_app_ip_editor;
+    }
+
+
+// IspIPAddr:
+RESOURCE AVKON_SETTING_PAGE r_text_setting_page_ispip_addr
+    {
+    number= EAknSettingPageNoOrdinalDisplayed;
+    softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+    label= qtn_set_ip_address;
+    type = EAknCtIpFieldEditor;
+    editor_resource_id = r_setting_app_ip_editor;
+    }
+
+
+
+// IPNameServer1:
+RESOURCE AVKON_SETTING_PAGE r_text_setting_page_name_serv1
+    {
+    number= EAknSettingPageNoOrdinalDisplayed;
+    softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+    label= qtn_set_primary_dns;
+    type = EAknCtIpFieldEditor;
+    editor_resource_id = r_setting_app_ip_editor;
+    }
+
+
+// IPNameServer2:
+RESOURCE AVKON_SETTING_PAGE r_text_setting_page_name_serv2
+    {
+    number= EAknSettingPageNoOrdinalDisplayed;
+    softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+    label= qtn_set_secondary_dns;
+    type = EAknCtIpFieldEditor;
+    editor_resource_id = r_setting_app_ip_editor;
+    }
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+
+
+
+
+// LoginScript:
+RESOURCE EDWIN r_setting_app_edwin_login_script
+    {
+    width=KLoginScriptWidth;
+    lines=KLoginScriptLines;
+    maxlength=KMaxLoginScriptLength;
+    allowed_input_modes = EAknEditorTextInputMode | EAknEditorNumericInputMode;
+    default_input_mode = EAknEditorTextInputMode;
+	avkon_flags = EAknEditorFlagLatinInputModesOnly;    
+    flags= EEikEdwinAutoSelection;
+    }
+RESOURCE AVKON_SETTING_PAGE r_text_setting_page_login_script
+    {
+    number= EAknSettingPageNoOrdinalDisplayed;
+    softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+    label= qtn_set_login_script;
+    type = EEikCtEdwin;
+    editor_resource_id = r_setting_app_edwin_login_script;
+    }
+
+/*
+special cases
+        case EApIspLoginPass:
+*/
+
+RESOURCE SECRETED r_setting_app_edwin_login_passwd
+    {
+    num_letters=KMaxLoginPasswordLength;
+    }
+
+RESOURCE AVKON_SETTING_PAGE r_text_setting_page_login_passwd
+    {
+    number= EAknSettingPageNoOrdinalDisplayed;
+    softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+    label= qtn_set_ap_passwd;
+    type = EEikCtSecretEd;
+    editor_resource_id = r_setting_app_edwin_login_passwd;
+    }
+
+
+
+
+
+
+// Proxy server address:
+RESOURCE EDWIN r_setting_app_edwin_proxy_server_addr
+    {
+    width=KProxyServerWidth;
+    lines=KProxyServerLines;
+    maxlength=KMaxProxyServerLength;
+    numeric_keymap=EAknEditorCalculatorNumberModeKeymap;
+    allowed_input_modes = EAknEditorTextInputMode | EAknEditorNumericInputMode;
+    default_input_mode = EAknEditorTextInputMode;
+    special_character_table = R_AVKON_URL_SPECIAL_CHARACTER_TABLE_DIALOG;
+    default_case = EAknEditorLowerCase;
+	allowed_case_modes = EAknEditorLowerCase | EAknEditorUpperCase;
+	avkon_flags = EAknEditorFlagLatinInputModesOnly;
+    flags= EEikEdwinAutoSelection | EAknEditorLowerCase | EEikEdwinNoLineOrParaBreaks;
+    }
+RESOURCE AVKON_SETTING_PAGE r_text_setting_page_proxy_server_addr
+    {
+    number= EAknSettingPageNoOrdinalDisplayed;
+    softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+    label= qtn_set_proxy_server_address;
+    type = EEikCtEdwin;
+    editor_resource_id = r_setting_app_edwin_proxy_server_addr;
+    }
+
+
+// Proxy port number
+RESOURCE EDWIN r_setting_app_edwin_proxy_port_number
+    {
+    width=KProxyPortNumberWidth;
+    lines=KProxyPortNumberLines;
+    maxlength=KMaxProxyPortNumberLength;
+    allowed_input_modes = EAknEditorNumericInputMode;
+    default_input_mode = EAknEditorNumericInputMode;
+    default_case = EAknEditorLowerCase;
+    flags = EEikEdwinAutoSelection | EEikEdwinNoLineOrParaBreaks;
+    avkon_flags = EAknEditorFlagLatinInputModesOnly;
+    }
+RESOURCE AVKON_SETTING_PAGE r_text_setting_page_proxy_port_number
+    {
+    number= EAknSettingPageNoOrdinalDisplayed;
+    softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+    label= qtn_set_proxy_port_number;
+    type = EEikCtEdwin;
+    editor_resource_id = r_setting_app_edwin_proxy_port_number;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+RESOURCE DIALOG r_list_query
+    {
+    flags=EGeneralQueryFlags;
+    buttons=R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT;
+    items=
+        {
+
+        DLG_LINE
+            {
+            type = EAknCtListQueryControl;
+            id=EListQueryControl;
+            control = AVKON_LIST_QUERY_CONTROL
+                {
+                listtype = EAknCtSinglePopupMenuListBox;
+                listbox = LISTBOX
+                    {
+                    flags = EAknListBoxMenuList;
+                    height = KListQueryHeight;
+                    width = KListQueryWidth;
+                    };
+                heading = qtn_set_new_ap_prompt_list;
+                };
+            }
+        };
+    }
+
+
+
+RESOURCE LISTBOX r_setting_app_listbox
+    {
+    flags = EEikListBoxMultipleSelection;
+    }
+
+
+RESOURCE AVKON_SETTING_PAGE r_radio_button_setting_page
+    {
+    number = EAknSettingPageNoOrdinalDisplayed;
+    softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+    type =  EAknSetListBox;
+    editor_resource_id= r_setting_app_listbox;
+    }
+
+
+
+//----------------------------------------------------
+//
+//    R_AVKON_SOFTKEYS_OK_CANCEL__OK
+//
+//
+//----------------------------------------------------
+//
+RESOURCE CBA r_apsettings_softkeys_ok_cancel_ok
+    {
+    buttons =
+        {
+        CBA_BUTTON {id=EAknSoftkeyOk; txt = text_softkey_ok;},
+        CBA_BUTTON {id=EAknSoftkeyBack; txt = text_softkey_cancel; },
+        CBA_BUTTON {id=EAknSoftkeyOk; txt = qtn_msk_select;}
+        };
+    }
+
+
+RESOURCE AVKON_SETTING_PAGE r_popup_list_setting_page
+    {
+    number = EAknSettingPageNoOrdinalDisplayed;
+    softkey_resource = r_apsettings_softkeys_ok_cancel_ok;
+    type =  EAknSetListBox;
+    editor_resource_id= r_setting_app_listbox;
+    }
+
+
+
+// ICONARRAYS
+
+RESOURCE AKN_ICON_ARRAY r_setting_ap_bearer_listbox_icons
+    {
+    bmpfile = APP_BITMAP_DIR"\\ApSettings.mbm";
+    icons =
+        {
+        AKN_ICON
+            {
+            iconId = EMbmApsettingsQgn_prop_wml_gprs;
+            maskId = EMbmApsettingsQgn_prop_wml_gprs_mask;
+            },
+        AKN_ICON
+            {
+            iconId = EMbmApsettingsQgn_prop_wml_csd;
+            maskId = EMbmApsettingsQgn_prop_wml_csd_mask;
+            },
+        AKN_ICON
+            {
+            iconId = EMbmApsettingsQgn_prop_wml_hscsd;
+            maskId = EMbmApsettingsQgn_prop_wml_hscsd_mask;
+            },
+        AKN_ICON
+            {
+            iconId = EMbmApsettingsQgn_prop_wml_sms;
+            maskId = EMbmApsettingsQgn_prop_wml_sms_mask;
+            },
+        AKN_ICON
+            {
+            iconId = EMbmApsettingsQgn_prop_wlan_bearer;
+            maskId = EMbmApsettingsQgn_prop_wlan_bearer_mask;
+            },
+        AKN_ICON
+            {
+            iconId = EMbmApsettingsQgn_prop_wlan_easy;
+            maskId = EMbmApsettingsQgn_prop_wlan_easy_mask;
+            }
+        };
+    }
+
+
+RESOURCE AKN_ICON_ARRAY r_setting_ap_protected_listbox_icons
+    {
+    bmpfile = APP_BITMAP_DIR"\\ApSettings.mbm";
+    icons =
+        {
+        AKN_ICON
+            { iconId = EMbmApsettingsQgn_indi_sett_protected_add;
+              maskId = EMbmApsettingsQgn_indi_sett_protected_add_mask;
+            }
+        };
+    }
+
+
+
+RESOURCE TBUF r_apui_view_text_cannot_access_db
+                { buf = qtn_set_err_db_inaccessible; }
+
+
+
+
+// wait note dialog for delete operation...
+RESOURCE DIALOG r_apui_view_wait_note
+    {
+    flags = EAknWaitNoteFlags | EEikDialogFlagModeless;
+    items=
+        {
+        DLG_LINE
+            {
+            type = EAknCtNote;
+            id = EGeneralNote;
+            control= AVKON_NOTE
+                {
+                layout = EWaitLayout;
+                imagefile = AVKON_ICON_FILE;
+                imageid = EMbmAvkonQgn_note_erased;
+                imagemask = EMbmAvkonQgn_note_erased_mask;
+                animation = R_QGN_GRAF_WAIT_BAR_ANIM;
+                };
+            }
+        };
+    }
+
+
+RESOURCE TBUF r_apui_view_deleting_ap                 
+				{ buf = qtn_set_wait_deleting_ap; }
+
+RESOURCE TBUF r_apui_cmd_select                       
+				{ buf = qtn_set_cmd_select; }
+
+RESOURCE TBUF r_apui_cmd_edit_ap                               
+				{ buf = qtn_set_cmd_edit_ap; }
+
+RESOURCE TBUF r_apui_cmd_new                                   
+				{ buf = qtn_set_cmd_new_ap; }
+
+RESOURCE TBUF r_apui_cmd_new_blank                             
+				{ buf = qtn_set_cmd_new_default; }
+
+RESOURCE TBUF r_apui_cmd_new_use_existing                      
+				{ buf = qtn_set_cmd_new_existing; }
+
+RESOURCE TBUF r_apui_cmd_del_iap                               
+				{ buf = qtn_set_cmd_del_ap; }
+
+RESOURCE TBUF r_apui_cmd_help                                  
+				{ buf = qtn_set_options_help; }
+
+RESOURCE TBUF r_apui_cmd_exit                                  
+				{ buf = qtn_set_options_exit; }
+
+
+
+
+
+RESOURCE TBUF r_apui_navi_ap                                  
+				{ buf = qtn_set_navi_ap; }
+
+RESOURCE TBUF r_apui_note_ap_in_use_edit                      
+				{ buf = qtn_set_note_ap_in_use_edit; }
+RESOURCE TBUF r_apui_note_ap_in_use_delete                    
+				{ buf = qtn_set_note_ap_in_use_del; }
+
+RESOURCE TBUF r_apui_note_protected_ap                    
+				{ buf = qtn_set_note_protected_ap; }
+RESOURCE TBUF r_apui_note_protected_ap_sett               
+				{ buf = qtn_set_note_protected_ap_sett; }
+
+RESOURCE TBUF r_apui_note_cannot_use_protected_ap 
+				{ buf = qtn_netw_info_cannot_use_protected_ap; }
+
+
+RESOURCE TBUF r_apui_iap_are_you_sure_to_del                  
+				{ buf = qtn_query_common_conf_delete; }
+
+RESOURCE TBUF r_apui_iap_conf_max_speed_wcdma                 
+				{ buf = qtn_set_conf_max_speed_only_3g; }
+
+RESOURCE TBUF r_apui_iap_del_last_ap                          
+				{ buf = qtn_set_note_delete_last_ap; }
+RESOURCE TBUF r_apui_iap_create_new                            
+				{ buf = qtn_set_ap_create_new; }
+RESOURCE TBUF r_apui_iap_delete_linked                        
+				{ buf = qtn_set_ap_delete_linked; }
+RESOURCE TBUF r_apui_title_access_points                       
+				{ buf = qtn_set_title_access_points; }
+RESOURCE TBUF r_apui_ap_access_number_not                     
+				{ buf = qtn_set_ap_access_number_not; }
+RESOURCE TBUF r_apui_ap_server_access_number_not              
+				{ buf = qtn_set_ap_server_access_number_not; }
+
+RESOURCE TBUF r_apui_options_change                            
+				{ buf = qtn_set_options_change; }
+RESOURCE TBUF r_apui_options_ap_advanced                       
+				{ buf = qtn_set_options_ap_advanced; }
+
+
+// TBUF resources for the setting list
+RESOURCE TBUF r_apui_view_connection_name                      
+				{ buf = qtn_set_ap_conn_name; }
+
+RESOURCE TBUF r_apui_view_bearer_type                          
+				{ buf = qtn_set_ap_bearer; }
+
+RESOURCE TBUF r_apui_view_wtls_security                        
+				{ buf = qtn_set_wtls_security; }
+
+RESOURCE TBUF r_apui_view_connection_type                      
+				{ buf = qtn_set_conn_type; }
+
+
+// for GPRS bearer
+RESOURCE TBUF r_apui_view_ap_name                              
+				{ buf = qtn_set_access_point_name; }
+
+RESOURCE TBUF r_apui_view_user_name                            
+				{ buf = qtn_set_ap_username; }
+
+RESOURCE TBUF r_apui_view_prompt_password                      
+				{ buf = qtn_set_prompt_passwd; }
+
+RESOURCE TBUF r_apui_view_password                             
+				{ buf = qtn_set_ap_passwd; }
+
+RESOURCE TBUF r_apui_view_password_auth                        
+				{ buf = qtn_set_passwd_aut; }
+
+RESOURCE TBUF r_apui_view_wap_gw_ip_addr                       
+				{ buf = qtn_set_gateway_ip; }
+
+RESOURCE TBUF r_apui_view_starting_page                        
+				{ buf = qtn_set_starting_page; }
+
+
+
+// for GPRS Advanced
+RESOURCE TBUF r_apui_view_phone_ip_addr                        
+				{ buf = qtn_set_ip_address; }
+
+RESOURCE TBUF r_apui_view_primary_name_server                  
+				{ buf = qtn_set_primary_dns; }
+
+RESOURCE TBUF r_apui_view_secondary_name_server                
+				{ buf = qtn_set_secondary_dns; }
+
+
+
+// for CSD
+RESOURCE TBUF r_apui_view_access_number                        
+				{ buf = qtn_set_access_number; }
+
+RESOURCE TBUF r_apui_view_data_call_type                       
+				{ buf = qtn_set_data_call_type; }
+
+RESOURCE TBUF r_apui_view_max_conn_speed                       
+				{ buf = qtn_set_max_speed; }
+
+
+// for CSD Advanced
+RESOURCE TBUF r_apui_view_use_call_back                        
+				{ buf = qtn_set_use_cb; }
+
+RESOURCE TBUF r_apui_view_call_back_type                       
+				{ buf = qtn_set_cb_type; }
+
+RESOURCE TBUF r_apui_view_call_back_number                     
+				{ buf = qtn_set_cb_number; }
+
+RESOURCE TBUF r_apui_view_enable_ppp_comp                      
+				{ buf = qtn_set_ppp_comp; }
+
+RESOURCE TBUF r_apui_view_use_login_script                     
+				{ buf = qtn_set_use_logins; }
+
+RESOURCE TBUF r_apui_view_login_script                         
+				{ buf = qtn_set_login_script; }
+
+RESOURCE TBUF r_apui_view_modem_init_string                    
+				{ buf = qtn_set_modem_init_string; }
+
+
+// for SMS
+RESOURCE TBUF r_apui_view_server_access_number                 
+				{ buf = qtn_set_server_access; }
+
+RESOURCE TBUF r_apui_view_service_access_number                
+				{ buf = qtn_set_service_access; }
+
+
+
+
+
+// 'Textual' but fixed values for settings
+RESOURCE TBUF r_apui_view_bearer_type_gprs                     
+				{ buf =  qtn_set_bearer_packet_data; }
+
+RESOURCE TBUF r_apui_view_bearer_type_csd                      
+				{ buf =  qtn_set_bearer_data_call; }
+
+RESOURCE TBUF r_apui_view_bearer_type_hscsd                    
+				{ buf =  qtn_netw_sett_bearer_hscsd; }
+
+RESOURCE TBUF r_apui_view_bearer_type_sms                      
+				{ buf =  qtn_set_bearer_sms; }
+
+
+RESOURCE TBUF r_apui_view_prompt_passwd_yes                    
+				{ buf =  qtn_set_prompt_passwd_yes; }
+
+RESOURCE TBUF r_apui_view_prompt_passwd_no                     
+				{ buf =  qtn_set_prompt_passwd_no; }
+
+RESOURCE TBUF r_apui_view_password_auth_normal                 
+				{ buf =  qtn_set_passwd_aut_normal; }
+
+RESOURCE TBUF r_apui_view_password_auth_secure                 
+				{ buf =  qtn_set_passwd_aut_secure; }
+
+RESOURCE TBUF r_apui_view_ip_addr_dynamic                      
+				{ buf =  qtn_set_ip_address_dynamic; }
+
+RESOURCE TBUF r_apui_view_wtls_security_on                     
+				{ buf =  qtn_set_wtls_security_on; }
+
+RESOURCE TBUF r_apui_view_wtls_security_off                    
+				{ buf =  qtn_set_wtls_security_off; }
+
+
+
+RESOURCE TBUF r_apui_view_conn_type_contin                     
+				{ buf =  qtn_set_conn_type_contin; }
+
+RESOURCE TBUF r_apui_view_conn_type_temp                       
+				{ buf =  qtn_set_conn_type_temp; }
+
+RESOURCE TBUF r_apui_view_datacall_analolgue                   
+				{ buf =  qtn_set_data_call_analolgue; }
+
+RESOURCE TBUF r_apui_view_datacall_isdn_110                    
+				{ buf =  qtn_set_data_call_isdn_110; }
+
+RESOURCE TBUF r_apui_view_datacall_isdn_120                    
+				{ buf =  qtn_set_data_call_isdn_120; }
+
+RESOURCE TBUF r_apui_view_speed_autodetect	{ buf =  qtn_set_speed_auto_detect;}
+RESOURCE TBUF r_apui_view_speed_9600		{ buf =  "9600"; }
+RESOURCE TBUF r_apui_view_speed_14400		{ buf =  "14400"; }
+RESOURCE TBUF r_apui_view_speed_19200		{ buf =  "19200"; }
+RESOURCE TBUF r_apui_view_speed_28800		{ buf =  "28800"; }
+RESOURCE TBUF r_apui_view_speed_38400		{ buf =  "38400"; }
+RESOURCE TBUF r_apui_view_speed_43200		{ buf =  "43200"; }
+RESOURCE TBUF r_apui_view_speed_56000		{ buf =  "56000"; }
+
+
+RESOURCE TBUF r_apui_view_use_cb_yes		{ buf =  qtn_set_use_cb_yes; }
+RESOURCE TBUF r_apui_view_use_cb_no         { buf =  qtn_set_use_cb_no; }
+
+
+RESOURCE TBUF r_apui_view_cb_use_server_number                 
+				{ buf =  qtn_set_use_server_number; }
+
+RESOURCE TBUF r_apui_view_cb_use_other_number                  
+				{ buf =  qtn_set_use_other_number; }
+
+
+RESOURCE TBUF r_apui_view_ppp_comp_yes		{ buf =  qtn_set_ppp_comp_yes; }
+RESOURCE TBUF r_apui_view_ppp_comp_no       { buf =  qtn_set_ppp_comp_no; }
+
+RESOURCE TBUF r_apui_view_use_logins_no     { buf =  qtn_set_use_logins_no; }
+RESOURCE TBUF r_apui_view_use_logins_yes    { buf =  qtn_set_use_logins_yes; }
+
+RESOURCE TBUF r_apui_view_term_win_yes		{ buf =  qtn_set_term_win_yes; }
+RESOURCE TBUF r_apui_view_term_win_no       { buf =  qtn_set_term_win_no; }
+
+RESOURCE TBUF r_apui_view_new_ap_prompt_list                   
+				{ buf =  qtn_set_new_ap_prompt_list; }
+
+RESOURCE TBUF r_apui_view_default_ap		{ buf =  qtn_set_default_ap; }
+
+RESOURCE TBUF r_apui_view_saved             { buf =  qtn_set_ap_saved; }
+
+RESOURCE TBUF r_apui_view_wap_start_page_default      { buf =  "http://"; }
+
+RESOURCE TBUF r_apui_iap_name_already_exists                   
+				{ buf =  qtn_fldr_name_already_used; }
+
+RESOURCE TBUF r_apui_view_compulsory		{ buf =  qtn_set_compulsory; }
+
+RESOURCE TBUF r_apui_view_ap_none                              
+				{ buf = qtn_mce_settings_mms_none; }
+
+RESOURCE TBUF r_apui_view_invalid_number                       
+				{ buf = qtn_info_invalid_number; }
+
+RESOURCE TBUF r_apui_view_invalid_conn_name                    
+				{ buf = qtn_info_invalid_conn_name; }
+
+
+RESOURCE TBUF r_apui_sett_val_field_none                       
+				{ buf = qtn_selec_sett_val_field_none; }
+
+
+
+
+
+RESOURCE TBUF r_apui_view_proxy_server_addr           { buf = qtn_set_proxy_server_address; }
+
+RESOURCE TBUF r_apui_view_proxy_port_number           { buf = qtn_set_proxy_port_number; }
+
+
+RESOURCE TBUF r_apui_view_network_group               { buf = qtn_set_network_group; }
+
+
+RESOURCE TBUF r_apui_sett_home_page_none              { buf = qtn_set_home_page_none; }
+
+
+
+
+RESOURCE TBUF r_apui_view_pdp_type					  { buf = qtn_set_network_type; }
+
+RESOURCE TBUF r_apui_view_pdp_type_ipv4               { buf = qtn_set_nw_type_ipv4; }
+
+RESOURCE TBUF r_apui_view_pdp_type_ipv6               { buf = qtn_set_nw_type_ipv6; }
+
+RESOURCE TBUF r_apui_view_ipv4_settings	              { buf = qtn_set_ipv4_settings; }
+
+RESOURCE TBUF r_apui_view_ipv6_settings	              { buf = qtn_set_ipv6_settings; }
+
+RESOURCE TBUF r_apui_view_set_dns_servers_ip          { buf = qtn_set_dns_servers_ip; }
+
+RESOURCE TBUF r_apui_view_set_info_invalid_ip         { buf = qtn_set_info_invalid_ip; }
+
+RESOURCE TBUF r_apui_view_set_ip_user_defined         { buf = qtn_set_ip_user_defined; }
+
+RESOURCE TBUF r_apui_view_set_ip_well_known           { buf = qtn_set_ip_well_known; }
+
+
+RESOURCE TBUF r_apui_note_vpn_ap_sett				  { buf = qtn_set_note_vpn_ap_sett; }
+
+
+RESOURCE TBUF r_apui_iap_del_iap_associated			  
+				{ buf = qtn_vpn_quest_delete_iap_associated; }
+
+
+
+// WLAN strings & resources
+
+RESOURCE TBUF r_apui_view_bearer_type_wlan
+				{ buf =  qtn_wlan_sett_bearer_wlan; }
+
+RESOURCE TBUF r_apui_view_wlan_network_name
+				{ buf =  qtn_wlan_sett_network_name ; }
+
+
+RESOURCE TBUF r_apui_view_wlan_network_mode
+				{ buf =  qtn_wlan_sett_network_mode ; }
+
+
+RESOURCE TBUF r_apui_view_wlan_security_mode
+				{ buf =  qtn_wlan_sett_security_mode ; }
+
+
+RESOURCE TBUF r_apui_view_wlan_security_settings
+				{ buf =  qtn_wlan_sett_security_settings ; }
+
+
+RESOURCE TBUF r_apui_view_wlan_network_mode_infra
+				{ buf =  qtn_wlan_sett_network_mode_infra ; }
+
+
+RESOURCE TBUF r_apui_view_wlan_network_mode_adhoc
+				{ buf =  qtn_wlan_sett_network_mode_adhoc ; }
+
+
+RESOURCE TBUF r_apui_view_wlan_security_mode_open
+				{ buf =  qtn_wlan_sett_security_mode_open ; }
+
+
+RESOURCE TBUF r_apui_view_wlan_security_mode_wep
+				{ buf =  qtn_wlan_sett_security_mode_wep ; }
+
+
+RESOURCE TBUF r_apui_view_wlan_security_mode_802_1x
+				{ buf =   qtn_wlan_sett_security_mode_802_1x ; }
+
+
+RESOURCE TBUF r_apui_view_wlan_security_mode_wpa
+				{ buf =   qtn_wlan_sett_security_mode_wpa ; }
+
+
+RESOURCE TBUF r_apui_view_wlan_network_name_user
+				{ buf =   qtn_wlan_sett_network_name_user_defined ; }
+
+
+RESOURCE TBUF r_apui_view_wlan_network_name_scan
+				{ buf =   qtn_wlan_sett_network_name_scan ; }
+
+
+RESOURCE TBUF r_apui_ap_wlan_name_not_defined
+				{ buf = qtn_wlan_quest_nw_name_not_defined; }
+
+
+RESOURCE TBUF r_apui_netmask
+				{ buf = qtn_netw_sett_subnet_mask; }
+
+
+RESOURCE TBUF r_apui_ip_gateway
+				{ buf = qtn_netw_sett_default_gateway; }
+
+
+RESOURCE TBUF r_apui_view_wlan_hidden_network
+				{ buf =  qtn_wlan_sett_hidden_network; }
+
+RESOURCE TBUF r_apui_view_hidden_network_yes		
+                { buf =  qtn_wlan_sett_hidden_network_yes; }
+                
+RESOURCE TBUF r_apui_view_hidden_network_no      
+                { buf =  qtn_wlan_sett_hidden_network_no; }
+
+RESOURCE TBUF r_apui_view_netw_quest_iap_incomplete_delete
+                { buf =  qtn_netw_quest_iap_incomplete_delete; }
+
+
+RESOURCE TBUF r_apui_view_ad_hoc
+                { buf = qtn_wlan_sett_adhoc_channel; }
+
+RESOURCE TBUF r_apui_view_ad_hoc_prmpt
+                { buf = qtn_wlan_prmpt_adhoc_channel; }
+
+RESOURCE TBUF r_apui_view_ad_hoc_channel_auto
+                { buf = qtn_wlan_sett_adhoc_channel_automatic; }
+
+RESOURCE TBUF r_apui_view_ad_hoc_channel_user_defined
+                { buf = qtn_wlan_sett_adhoc_channel_user_defined; }
+                
+RESOURCE TBUF r_apui_ap_wlan_sec_sett_empty
+				{ buf = qtn_wlan_quest_security_settings_empty; }
+
+
+RESOURCE TBUF r_apui_view_avkon_compulsory		
+                { buf =  qtn_selec_setting_compulsory; }
+
+
+RESOURCE TBUF r_apui_view_no_iap_defined_info		
+                { buf =  qtn_netw_info_no_iap_defined; }
+
+//----------------------------------------------------
+//
+//    r_apsettingsui_select_network_menubar
+//
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_BAR r_apsettingsui_select_network_menubar
+    {
+    titles=
+        {
+        MENU_TITLE { menu_pane=r_apsettingsui_menu_network; txt="A"; }
+        };
+    }
+
+
+//----------------------------------------------------
+//
+//    r_apsettingsui_menu_network
+//
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_PANE r_apsettingsui_menu_network
+    {
+    items=
+        {
+        MENU_ITEM { command=EApSelCmdSelect; txt= qtn_set_cmd_select; },
+        MENU_ITEM { command=EApSelCmdNew; txt= qtn_set_cmd_new_netw_group;},
+        MENU_ITEM { command=EApSelCmdDelete; txt= qtn_set_cmd_del_ap; },
+        MENU_ITEM { command=EAknCmdHelp; txt= qtn_set_options_help; },
+        MENU_ITEM { command=EApSelCmdExit; txt= qtn_set_options_exit; }
+        };
+    }
+
+RESOURCE AVKON_SETTING_PAGE r_popup_list_network_setting_page
+    {
+    number = EAknSettingPageNoOrdinalDisplayed;
+    softkey_resource = R_AVKON_SOFTKEYS_OPTIONS_BACK__SELECT;
+    menubar = r_apsettingsui_select_network_menubar;
+    type =  EAknSetListBox;
+    editor_resource_id= r_setting_app_listbox;
+    }
+
+
+
+
+
+
+// Network name editor resources
+// Network name
+RESOURCE EDWIN r_setting_app_edwin_netw_name
+    {
+    width=KNetworkNameWidth;
+    lines=KNetworkNameLines;
+    maxlength=KMaxNetworkNameLength;
+    allowed_input_modes = EAknEditorTextInputMode | EAknEditorNumericInputMode;
+    default_input_mode = EAknEditorTextInputMode;
+    flags= EEikEdwinAutoSelection | EEikEdwinNoLineOrParaBreaks;
+    }
+RESOURCE AVKON_SETTING_PAGE r_text_setting_page_netw_name
+    {
+    number= EAknSettingPageNoOrdinalDisplayed;
+    softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+    label= qtn_set_ap_netw_name;
+    type = EEikCtEdwin;
+    editor_resource_id = r_setting_app_edwin_netw_name;
+    }
+
+
+
+
+
+
+RESOURCE DIALOG r_dnsip4_query
+	{
+	flags=EGeneralQueryFlags;
+	buttons=R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+	items=
+		{
+		DLG_LINE
+			{
+			type=EAknExtCtMultilineQuery;
+			id=EMultilineFirstLine;
+			control = AVKON_DATA_QUERY
+				{ 
+				layout = EMultiDataFirstIpEd;
+                label = qtn_set_primary_dns;
+                control = IP_FIELD_EDITOR
+                    {
+ 						min_field_values = IP_FIELD
+ 						{ 
+ 						first_field = IPADDRESS_MIN_FIRST_FIELD_VALUE;
+ 						second_field = IPADDRESS_MIN_SECOND_FIELD_VALUE;
+ 						third_field = IPADDRESS_MIN_THIRD_FIELD_VALUE;
+ 						fourth_field = IPADDRESS_MIN_FOURTH_FIELD_VALUE;
+ 						};
+ 						max_field_values = IP_FIELD
+ 						{
+ 							first_field = IPADDRESS_MAX_FIRST_FIELD_VALUE;
+ 							second_field = IPADDRESS_MAX_SECOND_FIELD_VALUE;
+ 							third_field = IPADDRESS_MAX_THIRD_FIELD_VALUE;
+ 							fourth_field = IPADDRESS_MAX_FOURTH_FIELD_VALUE;
+ 						};
+ 						flags = 0;
+					};
+ 				};
+			},
+		DLG_LINE
+			{
+             type = EAknExtCtMultilineQuery;
+             id = EMultilineSecondLine;
+             control = AVKON_DATA_QUERY
+                 {
+                 layout = EMultiDataSecondIpEd;
+                 label = qtn_set_secondary_dns;
+                 control = IP_FIELD_EDITOR
+                     {
+                     min_field_values = IP_FIELD
+ 						{ 
+ 							first_field = IPADDRESS_MIN_FIRST_FIELD_VALUE;
+ 							second_field = IPADDRESS_MIN_SECOND_FIELD_VALUE;
+ 							third_field = IPADDRESS_MIN_THIRD_FIELD_VALUE;
+ 							fourth_field = IPADDRESS_MIN_FOURTH_FIELD_VALUE;
+ 						};
+ 						max_field_values = IP_FIELD
+ 						{
+ 							first_field = IPADDRESS_MAX_FIRST_FIELD_VALUE;
+ 							second_field = IPADDRESS_MAX_SECOND_FIELD_VALUE;
+ 							third_field = IPADDRESS_MAX_THIRD_FIELD_VALUE;
+ 							fourth_field = IPADDRESS_MAX_FOURTH_FIELD_VALUE;
+ 						};
+ 						flags = 0;
+					};
+ 				};
+			}
+		};
+	}
+
+
+
+
+
+RESOURCE DIALOG r_dnsip6_query
+	{
+	flags=EGeneralQueryFlags;
+	buttons=R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+	items=
+		{
+		DLG_LINE
+			{
+			type=EAknCtMultilineQuery;
+			id=EMultilineFirstLine;
+			control = AVKON_DATA_QUERY
+				{ 
+					layout = EMultiDataFirstEdwin;
+					label = qtn_set_primary_dns;
+					control = EDWIN
+					    {
+				    	avkon_flags = EAknEditorFlagLatinInputModesOnly;
+						flags=0;
+						width=16;
+						lines=1;
+						maxlength=KMaxIPv6NameServerLength;
+						};
+				};
+			},
+		DLG_LINE
+			{
+			type=EAknCtMultilineQuery;
+			id=EMultilineSecondLine;
+			control= AVKON_DATA_QUERY 
+				{ 
+					layout = EMultiDataSecondEdwin;
+					label = qtn_set_secondary_dns;
+					control=EDWIN 
+					    {
+                    	avkon_flags = EAknEditorFlagLatinInputModesOnly;
+						flags= 0;
+						width=16;
+						lines=1;
+						maxlength=KMaxIPv6NameServerLength;
+						};
+				};
+			}
+		};
+	}
+
+
+
+
+RESOURCE TBUF r_apui_view_new_ap_user_name_none
+				{ buf =  qtn_set_ap_username_none; }
+
+RESOURCE TBUF r_apui_view_new_ap_proxy_server_addr_none
+				{ buf =  qtn_set_proxy_server_address_none; }
+
+RESOURCE TBUF r_apui_view_new_ap_cb_number_none 
+				{ buf =  qtn_set_cb_number_none; }
+
+RESOURCE TBUF r_apui_view_new_ap_login_script_none                   
+				{ buf =  qtn_set_login_script_none; }
+
+RESOURCE TBUF r_apui_view_new_ap_modem_init_none 
+				{ buf =  qtn_set_modem_init_none; }
+
+RESOURCE TBUF r_apui_view_new_ap_dns_servers_automatic                   
+				{ buf =  qtn_set_dns_servers_automatic ; }
+
+RESOURCE TBUF r_apui_view_new_ap_dns_server_automatic
+				{ buf =  qtn_set_dns_server_automatic; }
+
+RESOURCE TBUF r_apui_view_no_security_settings
+				{ buf =  qtn_wlan_info_no_security_settings; }
+
+
+
+
+// EApIspIPNetMask:
+RESOURCE AVKON_SETTING_PAGE r_text_setting_page_isp_net_mask
+    {
+    number= EAknSettingPageNoOrdinalDisplayed;
+    softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+    label= qtn_netw_sett_subnet_mask;
+    type = EAknCtIpFieldEditor;
+    editor_resource_id = r_setting_app_ip_editor;
+    }
+
+
+// EApIspIPGateway:
+RESOURCE AVKON_SETTING_PAGE r_text_setting_page_isp_gateway
+    {
+    number= EAknSettingPageNoOrdinalDisplayed;
+    softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+    label= qtn_netw_sett_default_gateway;
+    type = EAknCtIpFieldEditor;
+    editor_resource_id = r_setting_app_ip_editor;
+    }
+
+
+
+RESOURCE DIALOG r_apui_wlan_name_query
+   {
+   flags = EGeneralQueryFlags;
+   buttons = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+   items =
+       {
+       DLG_LINE
+             {
+             type = EAknCtQuery;
+             id = EGeneralQuery;
+             control = AVKON_DATA_QUERY
+                    {
+                    layout = EDataLayout;
+                    label = qtn_wlan_prmpt_network_name;
+                    control = EDWIN
+                        {
+                        maxlength = KMaxWlanNetworkameLength;
+                        flags = EEikEdwinNoWrap;
+                        };
+                    };
+             }
+        };
+    }
+
+
+
+
+RESOURCE DIALOG r_apui_wlan_adhoc_channel_query
+   {
+   flags = EGeneralQueryFlags;
+   buttons = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+   items =
+       {
+       DLG_LINE
+             {
+             type = EAknCtQuery;
+             id = EGeneralQuery;
+             control = AVKON_DATA_QUERY
+                   {
+                   layout = ENumberLayout;
+                   label = qtn_wlan_prmpt_adhoc_channel;
+                   control = AVKON_INTEGER_EDWIN
+                         {
+                         maxlength = KMaxAdhocChannelNumberLength;
+                         min = KAdhocChannelMin;
+	                     max = KAdhocChannelMax;
+                         };
+                   };
+             }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/group/ApSettingsHandlerUiCvt.mmp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,43 @@
+/*
+* 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:  Project specification for Accesspoint UI
+*               Component Validation Test.
+*      
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET      ApSettingsHandlerUICvt.exe
+TARGETTYPE  exe
+
+SOURCEPATH  ../tsrc
+
+SOURCE      ApSettingsHandlerUICvt.cpp
+
+// Component specific internal headers 
+USERINCLUDE			../inc
+
+// ADO-SUBSYSTEM specific internal headers 
+SYSTEMINCLUDE		../../inc
+
+// ADO specific internal headers 
+SYSTEMINCLUDE		../../../inc
+
+//Macro to /epoc32 headers
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY     ApSettingsHandlerUI.lib
+LIBRARY     euser.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/group/Apsettingshandlerui.mmp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,158 @@
+/*
+* Copyright (c) 2002 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 ApSettingsHandler.
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+
+TARGET      ApSettingsHandlerUI.dll
+TARGETTYPE      DLL
+UID         0x1000008d 0x10008d3B
+
+CAPABILITY CAP_GENERAL_DLL
+
+VENDORID VID_DEFAULT
+
+
+SOURCEPATH ../src
+SOURCE  apsettingshandleruiImpl.cpp
+SOURCE  apsettingsui.cpp
+SOURCE  apsettingshandlerui.cpp
+SOURCE  ApSelQueryDialog.cpp
+SOURCE  TextOverrides.cpp
+SOURCE  ApSelectorDialog.cpp
+SOURCE  ApSelectorListBox.cpp
+SOURCE  ApSelectorListBoxModel.cpp
+SOURCE  ApSettingsModel.cpp
+SOURCE  ApSettingsCommons.cpp
+SOURCE  ApSettingsDlg.cpp
+SOURCE  ApSelPopupList.cpp
+SOURCE  apsettingsdeleteoperation.cpp
+SOURCE  AccessPointTextSettingPage.cpp
+SOURCE  ApNetSelPopupList.cpp
+SOURCE  ApNetSelectorListBoxModel.cpp
+SOURCE  FeatureManagerWrapper.cpp
+SOURCE  ApMultiLineDataQueryDialog.cpp
+
+
+START RESOURCE ../data/apsetui.rss
+HEADER
+TARGETPATH RESOURCE_FILES_DIR
+LANGUAGE_IDS
+
+END  // RESOURCE
+
+// 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
+
+LIBRARY euser.lib
+LIBRARY cone.lib
+LIBRARY eikcore.lib
+LIBRARY eikcoctl.lib
+LIBRARY avkon.lib
+LIBRARY eikdlg.lib 
+LIBRARY bafl.lib
+LIBRARY eikctl.lib
+LIBRARY apengine.lib 
+LIBRARY commonengine.lib 
+LIBRARY diskspacereserver.lib
+LIBRARY commdb.lib
+LIBRARY insock.lib
+LIBRARY sysutil.lib
+LIBRARY commonui.lib
+LIBRARY FeatMgr.lib
+LIBRARY AknInputLanguage.lib
+
+LIBRARY WEPSecuritySettingsUi.lib
+LIBRARY WPASecuritySettingsUi.lib
+LIBRARY ConnectionUiUtilities.lib
+LIBRARY centralrepository.lib
+
+
+#if defined(ARMCC)
+    DEFFILE ../EABI/ApSettingsHandlerUI_EKA2.def
+#elif defined( WINSCW )
+    DEFFILE ../BWinsCw/ApSettingsHandlerUI_EKA2.def
+#elif defined( WINS )
+    DEFFILE ../BWins/ApSettingsHandlerUI_EKA2.def
+#else
+    DEFFILE ../BMarm/ApSettingsHandlerUI_EKA2.def
+#endif
+
+
+#ifdef __SERIES60_HELP
+    LIBRARY         hlplch.lib // for "Help" options menu
+#endif // __SERIES60_HELP
+
+
+LIBRARY efsrv.lib
+LIBRARY AknSkins.lib
+LIBRARY charconv.lib
+
+
+// Define this macro if you wish to enable IPv6 support for testing
+// It will override FeatureManager's NOT SUPPORTED....
+// MACRO __TEST_IPV6_SUPPORT    
+
+// Define this macro if you wish to disable HsCSD support for testing
+// It will override shared datakey setting....
+// MACRO __TEST_NO_HSCSD
+
+
+// Define this to test CSD support.
+// MACRO __TEST_CSD_SUPPORT
+
+
+// Define this to test HSCSD support.
+// MACRO __TEST_HSCSD_SUPPORT
+
+// Define this to test CDMA write-protect support.
+//MACRO __TEST_CDMA_WRITE_PROTECT
+
+// Define this to test WLAN support.
+//#define __TEST_WLAN_SUPPORT_ENABLED
+
+// Define this to use logging.
+// #define __TEST_LOGGING_ENABLED
+
+
+#ifdef __TEST_LOGGING_ENABLED
+    MACRO __TEST_LOGGING
+    LIBRARY flogger.lib
+#endif
+
+// Define this to test LAN support.
+#ifdef WINS
+    MACRO __TEST_LAN_BEARER
+#endif
+
+#ifdef __TEST_WLAN_SUPPORT_ENABLED
+    MACRO __TEST_WLAN_SUPPORT
+#endif // __TEST_WLAN_SUPPORT
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/group/apsettingshandleruiicons.mk	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,75 @@
+#
+# Copyright (c) 2004 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: 
+#
+
+ifeq (WINS,$(findstring WINS, $(PLATFORM)))
+ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\Z
+else
+ZDIR=\epoc32\data\z
+endif
+
+# ----------------------------------------------------------------------------
+# Configure these
+# ----------------------------------------------------------------------------
+
+TARGETDIR=$(ZDIR)\SYSTEM\Data
+HEADERDIR=\epoc32\include
+ICONTARGETFILENAME=$(TARGETDIR)\apsettings.mif
+HEADERFILENAME=$(HEADERDIR)\apsettings.mbg
+
+do_nothing :
+	@rem do_nothing
+
+MAKMAKE : do_nothing
+
+BLD : do_nothing
+
+CLEAN : do_nothing
+
+LIB : do_nothing
+
+CLEANLIB : do_nothing
+
+# ----------------------------------------------------------------------------
+# Configure these.
+#
+# 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.
+# The directory \s60\icons is included in the search only if the feature flag
+# __SCALABLE_ICONS is defined.
+# ----------------------------------------------------------------------------
+
+RESOURCE :
+	mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \
+                /c8,1 qgn_prop_wml_gprs.bmp  \
+                /c8,1 qgn_prop_wml_csd.bmp   \
+                /c8,1 qgn_prop_wml_hscsd.bmp \
+                /c8,1 qgn_prop_wml_sms.bmp   \
+		/c8,1 qgn_prop_wlan_bearer.bmp \
+		/c8,1 qgn_prop_wlan_easy.bmp \
+                /c8,1 qgn_indi_sett_protected_add.bmp
+FREEZE : do_nothing
+
+SAVESPACE : do_nothing
+
+RELEASABLES :
+	@echo $(HEADERFILENAME)&& \
+	@echo $(ICONTARGETFILENAME)
+
+FINAL : do_nothing
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/group/apsettingshandleruiicons_dc.mk	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,72 @@
+#
+# 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 ApSettingsHandlerUi
+#
+
+ifeq (WINS,$(findstring WINS, $(PLATFORM)))
+ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\Z
+else
+ZDIR=\epoc32\data\z
+endif
+
+
+TARGETDIR=$(ZDIR)\resource\apps
+ICONTARGETFILENAME=$(TARGETDIR)\apsettings.mif
+
+HEADERDIR=\epoc32\include
+HEADERFILENAME=$(HEADERDIR)\apsettings.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) \
+                /c8,1 qgn_prop_wml_gprs.bmp  \
+                /c8,1 qgn_prop_wml_csd.bmp   \
+                /c8,1 qgn_prop_wml_hscsd.bmp \
+                /c8,1 qgn_prop_wml_sms.bmp   \
+		/c8,1 qgn_prop_wlan_bearer.bmp \
+		/c8,1 qgn_prop_wlan_easy.bmp \
+                /c8,1 qgn_indi_sett_protected_add.bmp
+
+FREEZE : do_nothing
+
+SAVESPACE : do_nothing
+
+RELEASABLES :
+	@echo $(HEADERFILENAME)&& \
+	@echo $(ICONTARGETFILENAME)
+
+FINAL : do_nothing
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*    This file provides the information required for building the
+*    whole of a ApSettingsUI.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+// export iby files
+../Rom/ApSettingsHandlerUI.iby		CORE_MW_LAYER_IBY_EXPORT_PATH(ApSettingsHandlerUI.iby)
+../Rom/ApSettingsHandlerUIResources.iby	LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(ApSettingsHandlerUIResources.iby)
+
+// export localised loc file
+../loc/ApSettingsHandlerUI.loc	MW_LAYER_LOC_EXPORT_PATH(apsettingshandlerui.loc)
+
+PRJ_MMPFILES
+// gnumakefile apsettingshandleruiicons_dc.mk
+
+./Apsettingshandlerui.mmp
+
+
+PRJ_TESTMMPFILES
+
+PRJ_EXTENSIONS
+
+START EXTENSION s60/mifconv
+OPTION TARGETFILE apsettings.mif
+OPTION HEADERFILE apsettings.mbg
+OPTION SOURCES -c8,1 qgn_prop_wml_gprs  \
+               -c8,1 qgn_prop_wml_csd   \
+               -c8,1 qgn_prop_wml_hscsd \
+               -c8,1 qgn_prop_wml_sms   \
+		           -c8,1 qgn_prop_wlan_bearer \
+		           -c8,1 qgn_prop_wlan_easy \
+               -c8,1 qgn_indi_sett_protected_add
+END
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/inc/APSettingsHandlerUIVariant.hrh	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2002 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 variation info for ApSettingsHandlerUi.
+*     The file can be included in C++ or resource file.
+*
+*/
+
+
+#ifndef APSETTINGSHANDLERUIVARIANT_HRH
+#define APSETTINGSHANDLERUIVARIANT_HRH
+
+// This flag indicates whether the Wap related settings are visible 
+// in the Access Point Settings UI or not
+
+#define KWSPSettingsVisible	0x01
+
+
+// feature to disable editing of normal access points and allow it only for VPN
+#define KApUiEditOnlyVPNs 0x02
+
+
+#endif      //  APSETTINGSHANDLERUIVARIANT_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/inc/AccessPointTextSettingPage.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,124 @@
+/*
+* Copyright (c) 2002 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 CAccessPointTextSettingPage.
+*
+*/
+
+
+#ifndef ACCESSPOINT_TEXT_SETTING_PAGE_H
+#define ACCESSPOINT_TEXT_SETTING_PAGE_H
+
+// INCLUDE FILES
+#include <akntextsettingpage.h>
+
+
+// FORWARD DECLARATION
+class CApSelectorListboxModel;
+
+
+// CLASS DECLARATION
+
+/**
+* Model for the access point listbox. It is an array of CApSelectorItem
+* pointers; items are owned.
+*/
+NONSHARABLE_CLASS( CAccessPointTextSettingPage ) : public CAknTextSettingPage
+    {
+public:
+    /**
+    * Simple constructor depending only on a single resource Id. 
+    * Editor resource is given via the link in the setting page resource.
+    *
+    * @param aResourceID Setting Page to use (if present)
+    * @param aText Reference to text for editing
+    * @param aTextSettingPageFlags option flags for miscellaneous things
+    * @param aIsLatin Giving whether the editor should be Latin only
+    */
+    CAccessPointTextSettingPage( TInt aResourceID, TDes& aText,
+                                 TInt aTextSettingPageFlags = 0,
+                                 TBool aIsLatin = EFalse );
+    /**
+    * Constructor that allows separate setting page and editor resources
+    *
+    * This constructor allows the use of setting page using only the editor 
+    * resource. Other combinations are also possible
+    *
+    * In all cases the number (if supplied i.e. <> 0 ) is used.
+    *
+    *   Editor    Setting Page 
+    *  Resource    Resource
+    *   present     present     Both are used (but text & number overridden)
+    *    = 0        present     Editor resource is used via SP resource 
+    *                           (Effectively like the other constructor)
+    *   present      = 0        Default Avkon SP resource if used 
+    *                           + this editor resource
+    *    = 0         = 0        uses default resource for both SP and editor.
+    *                           This is OK if:
+    *   i) control type is present,
+    *   ii) a default resource exists 
+    *       ( OK for text, integer, date, time, duration )
+    *
+    * Note: THe first argument is a TDesC* (rather than TDesC&) because 
+    * the other constructor cannot initialize such a member without allocation
+    * or having an internal dummy buffer.
+    * Note that this buffer must be owned by the client until 
+    * ExecuteLD has been called.
+    *
+    * Rules for text and numbers: The rules are the same for both:  (non-zero
+    * length) text or number other than EAknSettingPageNoOrdinalDisplayed if 
+    * given in this constructor will not override resource (unless that is 
+    * zero length or EAknSettingPageNoOrdinalDisplayed). Note, however, 
+    * that text or number given via the specific API for setting them, 
+    * WILL override resource.
+    * It is assumed that number from resource is very rare. Special text 
+    * is somewhat more likely.
+    *
+    * @param aSettingTitleText      Text at top of setting pane; 
+    *                               OWNED EXTERNALLY
+    * @param aSettingNumber         Number at top left (if present)
+    * @param aControlType           Determines the type constructed 
+    *                               and how its resource is read
+    * @param aEditorResourceId      Editor resource to use in the setting page
+    *                               (if present)
+    * @param aSettingPageResourceId Setting Page to use (if present)
+    * @param aText                  Reference to text for editing
+    * @param aTextSettingPageFlags  option flags for miscellaneous things
+    * @param aIsLatin               Gives whether the editor should accept 
+    *                               only Latin input 
+    */
+    CAccessPointTextSettingPage( const TDesC* aSettingTitleText,
+                                 TInt aSettingNumber,
+                                 TInt aControlType,
+                                 TInt aEditorResourceId,
+                                 TInt aSettingPageResourceId,
+                                 TDes& aText,
+                                 TInt aTextSettingPageFlags = 0,
+                                 TBool aIsLatin = EFalse );
+
+
+
+    /**
+    * 2nd stage construction for this specific type.  Call BaseConstructL in
+    * CAknSettingPage, where the object is constructed from resource.
+    *
+    */
+    virtual void ConstructL();
+
+    TBool iIsLatin;
+    };
+
+
+#endif
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/inc/ApMultiLineDataQueryDialog.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,72 @@
+/*
+* Copyright (c) 2002 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 CApMultiLineDataQueryDialog.
+*
+*/
+
+
+#ifndef AP_MULTILINE_IP_QUERY_DIALOG_H
+#define AP_MULTILINE_IP_QUERY_DIALOG_H
+
+// INCLUDE FILES
+#include <AknQueryDialog.h>
+
+
+// FORWARD DECLARATION
+
+
+// CLASS DECLARATION
+
+/**
+* A new class to extend the functionality of the existing 
+* CAKnMultiLineIpQueryDialog to be able to accept 0 length settings...
+* Nothing else is changed.
+*/
+NONSHARABLE_CLASS( CApMultiLineDataQueryDialog ) : 
+                    public CAknMultiLineDataQueryDialog
+    {
+public:
+    public:
+        /**
+        * Multiline data query dialog, 2 lines
+        * @param aText1 Text1
+        * @param aText2 Text2
+        * @param aTone Tone 
+        * @return A constructed CApMultiLineDataQueryDialog
+        */
+        static CApMultiLineDataQueryDialog* NewL(
+                            TDes&  aText1, TDes&  aText2, 
+                            TTone aTone = ENoTone);
+
+
+    protected:
+        /**
+        * If the query text is ok (retrieved form query controls) then 
+        * display the left soft key, otherwise hide it.
+        */
+        void UpdateLeftSoftKeyL();
+
+    private:
+        /**
+        * Constructor
+        * @param aTone Tone
+        */
+        CApMultiLineDataQueryDialog( const TTone& aTone );
+
+    };
+
+
+#endif
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/inc/ApNetSelPopupList.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,206 @@
+/*
+* Copyright (c) 2002 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: 
+*     Declares CApNetSelPopupList for network selection.
+*
+*/
+
+
+#ifndef APNETSEL_POPUP_LIST_DIALOG_H
+#define APNETSEL_POPUP_LIST_DIALOG_H
+
+// INCLUDES
+
+#include <aknradiobuttonsettingpage.h>
+#include <ActiveApDb.h>  // for MActiveApDbObserver
+
+#include <ApSettingsHandlerCommons.h>
+
+
+// FORWARD DECLARATIONS
+
+class CApNetSelectorListboxModel;
+class CApSettingsHandlerImpl;
+class CApSettingsModel;
+
+
+// CLASS DECLARATION
+/**
+* CApNetSelPopupList class
+* Pop-up network selector 'control' object.
+*/
+NONSHARABLE_CLASS( CApNetSelPopupList ) : public CAknRadioButtonSettingPage, 
+                                          public MActiveApDbObserver
+    {
+
+    public: // Constructors and destructor
+
+        /**
+        * 2 phase construction
+        * @param aModel     The data model object
+        * @param aHandler   The data handler object
+        * @param aCurrentSelectionIndex The required selection index
+        * @param aPreferredUid  The preferred UID
+        * @param aEventStore    Stores the events
+        * @param aItemArray     Itemarray
+        * @param aNeedsNone Gives whether it disoplays the item 'None' or not
+        * @return the constructed CApNetSelPopupList object
+        */
+        static CApNetSelPopupList* NewL
+                                (
+                                CApSettingsModel& aModel,
+                                CApSettingsHandlerImpl& aHandler,
+                                TInt& aCurrentSelectionIndex,
+                                TInt& aPreferredUid,
+                                TUint32& aEventStore,
+                                CDesCArrayFlat* aItemArray,
+                                TBool aNeedsNone
+                                );
+
+        // Two phased construction
+        virtual void ConstructL();
+
+    private:
+        /**
+        * 2 phase construction
+        * @param aModel     The data model object
+        * @param aHandler   The data handler object
+        * @param aCurrentSelectionIndex The required selection index
+        * @param aPreferredUid  The preferred UID
+        * @param aEventStore    Stores the events
+        * @param aItemArray     Itemarray
+        * @param aNeedsNone Gives whether it disoplays the item 'None' or not
+        * @return the constructed CApNetSelPopupList object
+        */
+        CApNetSelPopupList
+            (
+            CApSettingsModel& aModel,
+            CApSettingsHandlerImpl& aHandler,
+            TInt& aIndex,
+            TInt& aPreferredUid,
+            CDesCArrayFlat* aItemArray,
+            TUint32& aEventStore,
+            TBool aNeedsNone
+            );
+
+        virtual ~CApNetSelPopupList();
+
+    public: // New functions
+        void SetHighlighted();
+
+    private:
+        /**
+        * It tells whether the Select menu item needs to be deleted or not
+        * @param aResourcfeId   The menu resource ID
+        * @return Boolean indicating whether the Select menu item 
+        * needs to be deleted or not
+        */
+        TBool Need2DeleteSelect( TInt aResourceId );
+
+        /**
+        * It tells whether the Open & the Dlete menu item needs
+        * to be deleted or not
+        * @param aResourcfeId   The menu resource ID
+        * @return Boolean indicating whether the Delete menu item 
+        * needs to be deleted or not        
+        */
+        TBool Need2DeleteOpenDelete( TInt aResourceId );
+
+
+        /**
+        * Creates a new network group
+        * @return TBool indicating successful creation
+        */
+        TBool HandleCreateNewNetworkGroupL();
+
+
+    public: // Functions from base classes
+        // From CCoeControl
+        virtual void GetHelpContext(TCoeHelpContext& aContext) const;
+
+        /**
+        * Implements the MActiveApDbObserver protocol
+        */
+        virtual void HandleApDbEventL( TEvent anEvent );
+
+
+        /**
+        * Overrides ActivateL
+        */
+        virtual void ActivateL();
+
+    protected:
+        // From CAknRadioButtonPage
+        /*
+        * Needed to know about SELECTION (not HIGHLIGHT!) changes
+        * to be able to update currently valid selection UID.
+        */
+        virtual void SelectCurrentItemL();
+
+    private:
+        /**
+        * From CAknSettingPage
+        */
+        TBool OkToExitL( TInt aButtonId );
+
+    protected:  // New functions
+        /**
+        * Fills up listbox control with data dynamically
+        */
+        void FillListBoxWithDataL();
+
+        /*
+        * Sets the Selected item in the list.
+        * Needed to initialize the list according to the Uid and 
+        * not to 'itemindex'...
+        */
+        void SetSelectedL();
+
+    protected:  // Functions from base classes
+
+        /**
+        * From CAknSettingPage
+        */
+        virtual void DynInitMenuPaneL( TInt aResourceId, 
+                                       CEikMenuPane* aMenuPane );
+
+        // From MEikCommandObserver
+        virtual void ProcessCommandL( TInt aCommandId );
+
+        // From CCoeControl
+        TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, 
+                                     TEventCode aType);
+
+    private: //data
+        CApSettingsModel*           iDataModel; // not owned, passed for usage
+        CAknSetStyleListBox*        iList;
+        
+        CApNetSelectorListboxModel* iModel;     // owns it, just passes 
+                                                // items for usage to list!
+        
+        TInt*                       iSelected;  // not owns it,passed for usage
+        CApSettingsHandlerImpl*     iHandler;   // not owns it,passed for usage
+        TUint32*                    iEventStore;// to hold the events
+        TUint32                     iPreferredUid;
+        TInt                        iPreferredLine;
+        TBool                       iNeedsNone;
+        TBool                       iNeedUnlock;
+        TBool						iHelpSupported;
+        TBool                       iProtectionSupported;
+
+    };
+
+#endif // APNETSEL_POPUP_LIST_DIALOG_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/inc/ApNetSelectorListBoxModel.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,121 @@
+/*
+* Copyright (c) 2002 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 CApNetSelectorListboxModel.
+*
+*/
+
+
+#ifndef APNETSELECTOR_LISTBOX_MODEL_H
+#define APNETSELECTOR_LISTBOX_MODEL_H
+
+// INCLUDE FILES
+#include <eikdialg.h>
+#include <ApNetworkItemList.h>
+
+
+// CONSTANTS
+// Granularity of the model array.
+const TInt KGranularity = 8;
+
+
+_LIT( KListItemFormatGraphicOnOff, "%d\t%*S" );
+
+const TInt KMaxFormatSize = sizeof( KListItemFormatGraphicOnOff );
+const TInt KMaxListItemNameLength = 50; // = KCommsDbSvrMaxFieldLength
+
+
+/**
+* Buffer size for formatting listbox text. Maximum item length
+* plus listbox internals (tabulators for icons etc.) must fit into it.
+*
+* Important note:
+* The model of the listbox is a CAknFilteredTextListBoxModel.
+* The *itemarray* of that model is this class. That is, whatever is in
+* the model (this class), it may not be visible, if it is filtered out.
+* We always must use the listbox's Model() to get visible ones.
+*/
+const TInt KMaxApSelectorListboxName = KMaxListItemNameLength+KMaxFormatSize;
+
+
+// CLASS DECLARATION
+
+/**
+* Model for the network group selection listbox. 
+* It is an array of CApNetworkItem pointers; 
+* items are owned.
+*/
+NONSHARABLE_CLASS( CApNetSelectorListboxModel ) :
+        public CApNetworkItemList,
+        public MDesCArray
+    {
+    public:     // Construct / destruct
+
+        /**
+        * Constructor.
+        */
+        CApNetSelectorListboxModel( );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CApNetSelectorListboxModel();
+
+    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;
+
+
+    public:
+        /**
+        * index <--> Uid conversion
+        * @param aUid UID
+        * @param aErr Error code 
+        * @return The index for the passed UID 
+        */
+        TInt Item4Uid( TUint32 aUid, TInt& aErr ) const;
+
+    private:    // data
+        /**
+        * Formats the text of the listbox.
+        * @param aIndex Index of item.
+        * @param aBuf Buffer to store formatted text.
+        */
+        void FormatListboxText( TInt aIndex, TDes& aBuf ) const;
+
+        /**
+        * MdcaPoint() cannot leave, so this buffer is allocated
+        * to allow formatting. Fortunately, doesn't have to be very
+        * large.
+        * We have to use MUTABLE CAST, as MdcaPoint is const (odd enough),
+        * so wouldn't allow formatting the text in a member...
+        */
+        __MUTABLE TBuf<KMaxApSelectorListboxName> iBuf;
+
+    };
+
+
+#endif
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/inc/ApSelPopupList.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,345 @@
+/*
+* Copyright (c) 2002 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: 
+*     Declares CApSelPopupList for access point selection.
+*/
+
+
+#ifndef APSEL_POPUP_LIST_DIALOG_H
+#define APSEL_POPUP_LIST_DIALOG_H
+
+// INCLUDES
+#include <aknradiobuttonsettingpage.h>
+#include <ApSettingsHandlerCommons.h>
+#include <ActiveApDb.h>  // for MActiveApDbObserver
+
+
+#include <AknIconArray.h>
+
+
+// FORWARD DECLARATIONS
+class CApSelectorListboxModel;
+class CApSettingsHandlerImpl;
+
+
+// CLASS DECLARATION
+/**
+* CApSelPopupList class
+* Pop-up access point selector 'control' object.
+*/
+NONSHARABLE_CLASS( CApSelPopupList ) : public CAknRadioButtonSettingPage, 
+                                       public MActiveApDbObserver
+    {
+
+    public: // Constructors and destructor
+
+        /**
+        * Creates the popup list selector object
+        * @param aModel                 Data model to be used for reading data.
+        *                               Not owned. Must remain intact while 
+        *                               the dialog exists.
+        * @param aHandler               A CApSettingsHandlerImpl handling data
+        * @param aCurrentSelectionIndex The item to highlight
+        * @param aPreferredUid          The preferred Uid to select
+        * @param aSelMenuType           The Options menu type it should have
+        * @param aIspFilter             The ISP filtering criteria
+        * @param aBearerFilter          The bearer filtering criteria
+        * @param aSortType              The ordering type for the list
+        * @param aEventStore            Event information holder
+        * @param aItemArray             The listbox items
+        * @param aNeedsNone             Gives whether 'None' item is present
+        * @param aNoEdit                Gives wether editing is allowed or not
+        * @param aReqIpvType            The IPv types included in the list
+        * @param aVpnFilterType         The VPN filtering type
+        * @return The created popup list selector object
+        */
+        static CApSelPopupList* NewL
+                                (
+                                CApSettingsModel& aModel,
+                                CApSettingsHandlerImpl& aHandler,
+                                TInt& aCurrentSelectionIndex,
+                                TInt& aPreferredUid,
+                                TSelectionMenuType aSelMenuType,
+                                TInt aIspFilter,
+                                TInt aBearerFilter,
+                                TInt aSortType,
+                                TUint32& aEventStore,
+                                CDesCArrayFlat* aItemArray,
+                                TBool aNeedsNone,
+                                TBool aNoEdit,
+                                TInt aReqIpvType = EIPv4,
+                                TVpnFilterType aVpnFilterType = EVpnFilterBoth
+                                );
+
+
+
+        /**
+        * Creates the popup list selector object
+        * @param aModel                 Data model to be used for reading data.
+        *                               Not owned. Must remain intact while 
+        *                               the dialog exists.
+        * @param aHandler               A CApSettingsHandlerImpl handling data
+        * @param aCurrentSelectionIndex The item to highlight
+        * @param aPreferredUid          The preferred Uid to select
+        * @param aSelMenuType           The Options menu type it should have
+        * @param aIspFilter             The ISP filtering criteria
+        * @param aBearerFilter          The bearer filtering criteria
+        * @param aSortType              The ordering type for the list
+        * @param aEventStore            Event information holder
+        * @param aItemArray             The listbox items
+        * @param aNeedsNone             Gives whether 'None' item is present
+        * @param aReqIpvType            The IPv types included in the list
+        * @param aVpnFilterType         The VPN filtering type
+        * @param aIncludeEasyWlan       To include Easy WLAN AP's or not
+        * @param aNoEdit                Gives wether editing is allowed or not
+        * @return The created popup list selector object
+        */
+        static CApSelPopupList* NewL
+                                (
+                                CApSettingsModel& aModel,
+                                CApSettingsHandlerImpl& aHandler,
+                                TInt& aCurrentSelectionIndex,
+                                TInt& aPreferredUid,
+                                TSelectionMenuType aSelMenuType,
+                                TInt aIspFilter,
+                                TInt aBearerFilter,
+                                TInt aSortType,
+                                TUint32& aEventStore,
+                                CDesCArrayFlat* aItemArray,
+                                TBool aNeedsNone,
+                                TInt aReqIpvType,
+                                TVpnFilterType aVpnFilterType,
+                                TBool aIncludeEasyWlan,
+                                TBool aNoEdit
+                                );
+
+        /**
+        * Constructor
+        */
+        virtual void ConstructL();
+
+
+    protected:
+        /**
+        * Creates the popup list selector object
+        * @param aModel                 Data model to be used for reading data.
+        *                               Not owned. Must remain intact while 
+        *                               the dialog exists.
+        * @param aHandler               A CApSettingsHandlerImpl handling data
+        * @param aIndex                 The item to highlight
+        * @param aPreferredUid          The preferred Uid to select
+        * @param aSelMenuType           The Options menu type it should have
+        * @param aIspFilter             The ISP filtering criteria
+        * @param aBearerFilter          The bearer filtering criteria
+        * @param aSortType              The ordering type for the list
+        * @param aItemArray             The listbox items
+        * @param aEventStore            Event information holder
+        * @param aNeedsNone             Gives whether 'None' item is present
+        * @param aNoEdit                Gives wether editing is allowed or not
+        * @param aReqIpvType            The IPv types included in the list
+        * @param aVpnFilterType         The VPN filtering type
+        * @return The created popup list selector object
+        */
+        CApSelPopupList
+            (
+            CApSettingsModel& aModel,
+            CApSettingsHandlerImpl& aHandler,
+            TInt& aIndex,
+            TInt& aPreferredUid,
+            TSelectionMenuType aSelMenuType,
+            TInt aIspFilter,
+            TInt aBearerFilter,
+            TInt aSortType,
+            CDesCArrayFlat* aItemArray,
+            TUint32& aEventStore,
+            TBool aNeedsNone,
+            TBool aNoEdit,
+            TInt aReqIpvType = EIPv4,
+            TVpnFilterType aVpnFilterType = EVpnFilterBoth
+            );
+
+
+
+        /**
+        * Creates the popup list selector object
+        * @param aModel                 Data model to be used for reading data.
+        *                               Not owned. Must remain intact while 
+        *                               the dialog exists.
+        * @param aHandler               A CApSettingsHandlerImpl handling data
+        * @param aIndex                 The item to highlight
+        * @param aPreferredUid          The preferred Uid to select
+        * @param aSelMenuType           The Options menu type it should have
+        * @param aIspFilter             The ISP filtering criteria
+        * @param aBearerFilter          The bearer filtering criteria
+        * @param aSortType              The ordering type for the list
+        * @param aItemArray             The listbox items
+        * @param aEventStore            Event information holder
+        * @param aNeedsNone             Gives whether 'None' item is present
+        * @param aReqIpvType            The IPv types included in the list
+        * @param aVpnFilterType         The VPN filtering type
+        * @param aIncludeEasyWlan       To include Easy WLAN AP's or not
+        * @param aNoEdit                Gives wether editing is allowed or not
+        * @return The created popup list selector object
+        */
+        CApSelPopupList
+            (
+            CApSettingsModel& aModel,
+            CApSettingsHandlerImpl& aHandler,
+            TInt& aIndex,
+            TInt& aPreferredUid,
+            TSelectionMenuType aSelMenuType,
+            TInt aIspFilter,
+            TInt aBearerFilter,
+            TInt aSortType,
+            CDesCArrayFlat* aItemArray,
+            TUint32& aEventStore,
+            TBool aNeedsNone,
+            TInt aReqIpvType,
+            TVpnFilterType aVpnFilterType,
+            TBool aIncludeEasyWlan,
+            TBool aNoEdit
+            );
+
+        /**
+        * Destructor
+        */
+        virtual ~CApSelPopupList();
+
+
+    public: // New functions
+        /**
+        * Sets the highlight.
+        */
+        void SetHighlighted();
+
+    private:
+
+        /**
+        * Loads our own icons
+        * @return The icon offset where they were appended.
+        */
+        TInt LoadIconsL();
+
+
+    public: // Functions from base classes
+        // From CCoeControl
+        virtual void GetHelpContext(TCoeHelpContext& aContext) const;
+
+        /**
+        * Implements the MActiveApDbObserver protocol
+        */
+        virtual void HandleApDbEventL( TEvent anEvent );
+
+
+        /**
+        * Overrides ActivateL
+        */
+        virtual void ActivateL();
+
+        // from CCoeControl
+        virtual void HandleResourceChange(TInt aType);
+
+    protected:
+        // From CAknRadioButtonPage
+        /*
+        * Needed to know about SELECTION (not HIGHLIGHT!) changes
+        * to be able to update currently valid selection UID.
+        */
+        virtual void SelectCurrentItemL();
+        
+    private:
+        /**
+        * From CAknSettingPage
+        */
+        TBool OkToExitL( TInt aButtonId );
+
+
+    protected:  // New functions
+        /**
+        * Fills up listbox control with data dynamically
+        */
+        void FillListBoxWithDataL();
+        
+
+        /*
+        * Sets the Selected item in the list.
+        * Needed to initialize the list according to the Uid 
+        * and not to 'itemindex'...
+        */
+        void SetSelectedL();
+
+
+        /*
+        * Checks for & handles the 'empty list' situation.
+        * According to the spec., prompts for creating a new one...
+        */
+        void CheckIfEmptyL();
+
+    protected:  // Functions from base classes
+
+        /**
+        * From CAknSettingPage
+        */
+        virtual void DynInitMenuPaneL( TInt aResourceId, 
+                                       CEikMenuPane* aMenuPane );
+
+        // From MEikCommandObserver
+        virtual void ProcessCommandL( TInt aCommandId );
+        
+        // From MEikListBoxObserver
+        void HandleListBoxEventL( CEikListBox* aListBox, 
+                MEikListBoxObserver::TListBoxEvent aEventType );
+
+        // From CCoeControl
+        TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, 
+                                     TEventCode aType);
+
+    private: //data
+        CApSettingsModel*               iDataModel; // not owns it, 
+                                                    // just passed for usage!
+        CAknSetStyleListBox*            iList;
+        CApSelectorListboxModel*        iModel;     // owns it, just passes
+                                                    // items for usage to list!
+        TInt*                           iSelected;  // does not owns it, 
+                                                    // just passed for usage!
+        TInt                            iBearerFilter;
+        TInt                            iIspFilter;
+        TInt                            iSortType;
+        TSelectionMenuType              iSelMenuType;
+        CApSettingsHandlerImpl*         iHandler;       // does not owns it, 
+                                                        // passed for usage
+        TUint32*                        iEventStore;    // to hold the events
+        TUint32                         iPreferredUid;
+        TInt                            iPreferredLine;
+        TBool                           iNeedsNone;
+        TBool                           iNeedUnlock;
+
+        TInt                            iReqIpvType; // Default is IPv4
+        TVpnFilterType                  iVpnFilterType;
+        TInt                            iVariant;       /// Local variant value
+
+        CAknIconArray*                  iIcons;
+
+        TBool                           iIncludeEasyWlan;
+        TBool                           iInitialised;
+        TBool                           iNoEdit;
+        TBool							iHelpSupported;
+        TBool							iProtectionSupported;
+        TBool                           iDoExit;
+        TInt                            iOldSelection;
+    };
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/inc/ApSelQueryDialog.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,121 @@
+/*
+* Copyright (c) 2002 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: 
+*     Declares dialog CApSelQueryDialog for access point selection.
+*
+*/
+
+
+#ifndef APSEL_QUERY_DIALOG_H
+#define APSEL_QUERY_DIALOG_H
+
+// INCLUDES
+#include <aknlistquerydialog.h>
+#include <ApSettingsHandlerCommons.h>
+#include <ActiveApDb.h>
+
+// FORWARD DECLARATIONS
+class CApSelectorListboxModel;
+
+// CLASS DECLARATION
+/**
+* CApSelQueryDialog class
+* 
+*/
+NONSHARABLE_CLASS( CApSelQueryDialog ) : public CAknListQueryDialog, 
+                                         public MActiveApDbObserver
+    {
+
+    public: // Constructors and destructor
+
+        /**
+        * Constructor
+        * @param aModel a reference to the data model
+        * @param aIndex a pointer to hold the UID of the selected item
+        * @return The constructed access point selection query dialog
+        */
+        CApSelQueryDialog( CApSettingsModel& aModel, 
+                           TUint32* aIndex );
+
+        /**
+        * Destructor
+        */
+        virtual ~CApSelQueryDialog();
+
+
+    public: // Functions from base classes
+        /**
+        * from MActiveApDbObserver
+        */
+        virtual void HandleApDbEventL( TEvent anEvent );
+
+
+    private:
+        /**
+        * From CAknListQueryDialog
+        */
+        virtual void PreLayoutDynInitL( void );
+
+
+        /**
+        * From CAknListQueryDialog
+        */
+        virtual void PostLayoutDynInitL();
+
+
+        /**
+        * From CAknListQueryDialog 
+        */
+        TBool OkToExitL( TInt aButtonId );
+
+
+        // From CCoeControl
+        TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, 
+                                     TEventCode aType); 
+
+
+        // From MEikCommandObserver
+        void ProcessCommandL( TInt aCommandId );
+
+
+    protected:  // New functions
+        /**
+        * Fills up listbox control with data 
+        */
+        void FillListBoxWithDataL();
+
+
+        /**
+        * Loads protected icons
+        * @return The icon offset where they were appended.
+        */
+        TInt LoadIconsL();
+
+
+    protected:  // Functions from base classes
+
+
+    private: //data
+        CApSettingsModel*               iDataModel; // does not own it, 
+                                                    // just passed for usage!
+        CEikListBox*                    iList;
+        CApSelectorListboxModel*        iModel;
+        TUint32*                        iSelected;
+        TBool                           iNeedUnlock;
+
+    };
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/inc/ApSelectorDialog.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,249 @@
+/*
+* Copyright (c) 2002 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: 
+*     Declares dialog CApSelectorDialog for access point selection.
+*
+*/
+
+
+#ifndef APSELECTORDIALOG_H
+#define APSELECTORDIALOG_H
+
+// INCLUDES
+#include <aknlists.h>
+#include <AknForm.h>
+
+#include <ApSettingsHandlerCommons.h>
+#include <ActiveApDb.h>
+
+// FORWARD DECLARATIONS
+class CApSelectorListboxModel;
+class CApSelectorListbox;
+class CTextOverrides;
+class CEikStatusPane;
+class CAknTitlePane;
+class CAknNavigationControlContainer;
+class CAknNavigationDecorator;
+class CApSettingsModel;
+class CApSettingsHandlerImpl;
+
+
+// CLASS DECLARATION
+/**
+* CApSelectorDialog dialog class
+* 
+*/
+NONSHARABLE_CLASS( CApSelectorDialog ) : 
+        public CAknDialog, public MEikListBoxObserver, 
+        public MActiveApDbObserver
+    {
+
+    public: // Constructors and destructor
+        /**
+        * Create and launch dialog.
+        * @param aModel Model to be used for reading data. Not owned.
+        * Must remain intact while the dialog exists.
+        * @param aHandler A CApSettingsHandlerImpl 
+        * @param aHighLight The item to highlight
+        * @param aSelected  The UID of the selected item. 
+        * @return The dialog's return code
+        */
+        TInt ConstructAndRunLD( CApSettingsModel& aModel, 
+                                CApSettingsHandlerImpl& aHandler,
+                                TUint32 aHighLight, TUint32& aSelected );
+
+
+   
+        /**
+        * Construct the dialog. The passed parameters determine 
+        * the filtering rules it will use.
+        * @param aListType      The list type it should use to display 
+        *                       the list of access points
+        * @param aSelMenuType   The Options menu type it should have
+        * @param aIspFilter     The ISP filtering criteria
+        * @param aBearerFilter  The bearer filtering criteria
+        * @param aSortType      The ordering type for the list
+        * @param aEventStore    Event information holder
+        * @param aNoEdit        Gives wether editing is allowed or not
+        * @param aReqIpvType    The IPv type which are included in the list
+        * @return The constructed dialog object
+        */
+        static CApSelectorDialog* NewL( TSelectionListType aListType,
+                                        TSelectionMenuType aSelMenuType,
+                                        TInt aIspFilter,
+                                        TInt aBearerFilter,
+                                        TInt aSortType,
+                                        TUint32& aEventStore,
+                                        TBool aNoEdit,
+                                        TInt aReqIpvType = EIPv4 
+                                        );
+
+
+        /** 
+        * Destructor.
+        */
+        ~CApSelectorDialog();
+
+    protected:
+        /**
+        * Constructor. The passed parameters determine 
+        * the filtering rules it will use.
+        * @param aListType      The list type it should use to display 
+        *                       the list of access points
+        * @param aSelMenuType   The Options menu type it should have
+        * @param aIspFilter     The ISP filtering criteria
+        * @param aBearerFilter  The bearer filtering criteria
+        * @param aSortType      The ordering type for the list
+        * @param aEventStore    Event information holder
+        * @param aReqIpvType    The IPv type which are included in the list
+        * @param aNoEdit        Gives wether editing is allowed or not
+        */
+        CApSelectorDialog(  TSelectionListType aListType,
+                            TSelectionMenuType aSelMenuType,
+                            TInt aIspFilter,
+                            TInt aBearerFilter,
+                            TInt aSortType,
+                            TUint32& aEventStore,
+                            TInt aReqIpvType,
+                            TBool aNoEdit
+                          );
+
+
+
+    public: // New functions
+
+        /**
+        * Sets initial texts
+        */
+        void InitTextsL();
+
+
+        /**
+        * Handles listbox data changes
+        */
+        void HandleListboxDataChangeL();
+
+        
+        /**
+        * Sets the text overrides.
+        * @param aOverrides An object containing the overriden texts
+        */
+        void SetTextOverrides( CTextOverrides* aOverrides );
+
+        
+        /**
+        * Checks if the list is empty
+        */
+        void CheckIfEmptyL();
+
+        
+        /**
+        * Sets the highlight 
+        */
+        void SetHighlighted();
+
+    public: // Functions from base classes
+        // From CCoeControl
+        virtual void ActivateL();
+        
+        // From CCoeControl
+        virtual void GetHelpContext(TCoeHelpContext& aContext) const;
+
+        // From MActiveApDbObserver
+        virtual void HandleApDbEventL( TEvent anEvent );
+
+        // From MEikCommandObserver
+        virtual void ProcessCommandL( TInt aCommandId ) ; 
+
+        // From MEikListBoxObserver
+        void HandleListBoxEventL( CEikListBox* aListBox, 
+                                  TListBoxEvent aEventType );
+
+        SEikControlInfo CreateCustomControlL( TInt aControlType );
+
+        // From MEikMenuObserver
+        virtual void DynInitMenuPaneL( TInt aResourceId, 
+                                       CEikMenuPane* aMenuPane );
+
+        // From CAknDialog
+        TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,
+                                     TEventCode aType);
+
+
+    protected:
+        // From CEikDialog
+        virtual void PreLayoutDynInitL();
+
+        
+        // From CEikDialog
+        virtual void PostLayoutDynInitL();
+
+        // From CAknDialog
+        TBool OkToExitL( TInt aButtonId );
+
+        /**
+        * Internal representation of the implementation of 
+        * ProcessCommandL from MEikCommandObserver
+        */
+        void DoProcessCommandL( TInt aCommandId );
+
+
+    private: //data
+
+        CEikStatusPane*                 iStatusPane;    // NOT owned
+        CAknTitlePane*                  iTitlePane;     // NOT owned
+        CAknNavigationControlContainer* iNaviPane;      // NOT owned
+        CAknNavigationDecorator*        iNaviDecorator; // owned
+        HBufC*                          iOldTitleText;
+        CApSettingsModel*               iDataModel; // not owned,
+                                                    // passed for usage
+        CApSelectorListbox*             iList;
+
+        CApSettingsHandlerImpl*         iHandler;
+        CApSelectorListboxModel*        iModel;
+        TSelectionListType              iListType;
+        TSelectionMenuType              iSelMenuType;
+
+        TUint32                         iHighLight;
+        TUint32*                        iSelected;        
+
+        TInt                            iIspFilter;
+        TInt                            iBearerFilter;
+        TInt                            iSortType;
+
+        CTextOverrides*                 iTextOverrides; // not owned,
+                                                        // passed for usage
+
+        TUint32                         iPreferredUid;
+        TInt                            iPreferredLine;
+        TUint32*                        iEventStore;
+        TBool                           iNeedUnlock;
+        TBool                           iModelPassed;
+        TApUiExitReason                 iExitReason;
+        
+        TInt                            iReqIpvType; /// Default is IPv4
+        TInt                            iVariant;    /// Local variant value
+
+#ifdef __TEST_OOMDEBUG
+        TBool                           iMemTestOn;
+#endif // __TEST_OOMDEBUG
+        
+        TBool                           iInitialised;
+        TBool                           iNoEdit;
+        TBool							iHelpSupported;
+    };
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/inc/ApSelectorListBoxModel.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,152 @@
+/*
+* Copyright (c) 2002 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 CApSelectorListboxModel.
+*
+*/
+
+
+#ifndef APSELECTOR_LISTBOX_MODEL_H
+#define APSELECTOR_LISTBOX_MODEL_H
+
+// INCLUDE FILES
+#include <eikdialg.h>
+#include <ApListItemList.h>
+
+
+// CONSTANTS
+// Granularity of the model array.
+const TInt KGranularity = 8;
+
+// const TInt KErrInvalidBitmapType = -300;
+
+_LIT( KListItemFormatGraphicBearer, "%d\t%*S\t\t" );
+_LIT( KListItemFormatGraphicNone, "%*S" );
+_LIT( KListItemFormatGraphicOnOff, "%d\t%*S" );
+
+_LIT( KListItemFormatGraphicProtected, "%d\t%*S\t%d\t" );
+_LIT( KListItemFormatGraphicOnOffWithLock, "%d\t%*S\t\t%d\t" );
+_LIT( KListItemFormatGraphicWithLock, "%*S\t\t%d\t" );
+
+const TInt KMaxFormatSize = sizeof( KListItemFormatGraphicBearer );
+const TInt KMaxListItemNameLength = 50; // = KCommsDbSvrMaxFieldLength
+
+/**
+* Buffer size for formatting listbox text. Maximum item length
+* plus listbox internals (tabulators for icons etc.) must fit into it.
+*
+* Important note:
+* The model of the listbox is a CAknFilteredTextListBoxModel.
+* The *itemarray* of that model is this class. That is, whatever is in
+* the model (this class), it may not be visible, if it is filtered out.
+* We always must use the listbox's Model() to get visible ones.
+*/
+const TInt KMaxApSelectorListboxName = KMaxListItemNameLength+KMaxFormatSize;
+
+
+// CLASS DECLARATION
+
+/**
+* Model for the access point listbox. It is an array of CApSelectorItem
+* pointers; items are owned.
+*/
+NONSHARABLE_CLASS( CApSelectorListboxModel ) :
+        public CApListItemList,
+        public MDesCArray
+    {
+    public:     // Construct / destruct
+        enum TGraphicType       /// Events reported to the database observer.
+            {
+            EGraphicNone,       ///< No graphic or icon.
+            EGraphicProtection, ///< Only protected icon.
+            EGraphicBearer,     ///< Bearer specific icon.
+            EGraphicOnOff       ///< Selection specific icon.
+            };
+
+
+        /**
+        * Constructor.
+        * @param aGraphicType   The used graphic type
+        */
+        CApSelectorListboxModel( TGraphicType aGraphicType = EGraphicBearer );
+
+
+        /**
+        * Destructor.
+        */
+        virtual ~CApSelectorListboxModel();
+
+    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;
+
+
+    public:
+        
+        /**
+        * index <--> Uid conversion
+        * @param aUid   The UID of the item 
+        * @param aErr   Error code
+        * @return       The index of the item 
+        */
+        TInt Item4Uid( TUint32 aUid, TInt& aErr ) const;
+
+        
+        /**
+        * Sets the icon offset
+        * @param aOffset    The offset of our icons in the iconarray
+        */
+        void SetOwnIconOffset( TInt aOffset );
+
+
+    private:    // data
+        /**
+        * Formats the text of the listbox.
+        * @param aIndex Index of item.
+        * @param aBuf Buffer to store formatted text.
+        */
+        void FormatListboxText( TInt aIndex, TDes& aBuf ) const;
+
+
+        /**
+        * MdcaPoint() cannot leave, so this buffer is allocated
+        * to allow formatting. Fortunately, doesn't have to be very
+        * large.
+        * We have to use MUTABLE CAST, as MdcaPoint is const (odd enough),
+        * so wouldn't allow formatting the text in a member...
+        */
+        __MUTABLE TBuf<KMaxApSelectorListboxName> iBuf;
+
+
+        TGraphicType    iGraphicType;
+        TInt            iOffset;
+        TBool           iFeatureInitialised;
+        TBool           iProtectionSupported;
+    };
+
+
+#endif
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/inc/ApSelectorListbox.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,114 @@
+/*
+* Copyright (c) 2002 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 CApSelectorListbox.
+*
+*/
+
+
+#ifndef APSELECTOR_LISTBOX_H
+#define APSELECTOR_LISTBOX_H
+
+// INCLUDE FILES
+#include <aknlists.h>
+
+
+// FORWARD DECLARATION
+class CApSelectorListboxModel;
+
+
+// CLASS DECLARATION
+
+/**
+* Model for the access point listbox. It is an array of CApSelectorItem
+* pointers; items are owned.
+*/
+NONSHARABLE_CLASS( CApSelectorListbox ) : public CAknSingleGraphicStyleListBox
+    {
+    public:     // Construct / destruct
+
+
+        /**
+        * Two-phased constructor. Leaves on failure.
+        * @param aParent Parent control.
+        * @return The constructed listbox.
+        */
+        static CApSelectorListbox* NewL
+            ( const CCoeControl* aParent );
+
+
+        /**
+        * Destructor.
+        */
+        virtual ~CApSelectorListbox();
+
+
+        /**
+        * Constructor.
+        */
+        CApSelectorListbox();
+
+    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 );
+
+
+        /**
+        * Loads the icons
+        */
+        void LoadIconsL();
+
+
+        /**
+        * Gets the UID from a given item
+        * @param    The index of the item
+        * @return   The UID of the item given by itemindex
+        */
+        TUint32 Uid4Item( TInt aItem ) const;
+
+
+        /**
+        * Gets the UID of the current item
+        * @return  The UID of the current item
+        */
+        TUint32 CurrentItemUid() const;
+
+
+        /**
+        * Gets the name of the current item
+        * @return The name of the current item
+        */
+        const TDesC& CurrentItemNameL();
+        
+
+        // from CCoeControl
+        void HandleResourceChange(TInt aType);
+
+    };
+
+
+#endif
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/inc/ApSettingsDlg.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,1020 @@
+/*
+* Copyright (c) 2002 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: 
+*     Declares dialog for access point view/edit.
+*
+*/
+
+
+#ifndef APSETTINGS_DLG_H
+#define APSETTINGS_DLG_H
+
+
+
+// INCLUDES
+#include <coecntrl.h>
+#include <coeccntx.h>
+
+#include <eiklbo.h>
+#include <eikapp.h>
+#include <eikdoc.h>
+
+#include <AknDialog.h>
+#include <ApSettingsHandlerCommons.h>
+#include <ActiveApDb.h>
+#include <ApAccessPointItem.h>
+#include <ApEngineConsts.h>
+
+
+// CONSTANTS
+const TInt KBearers     = 4;
+
+
+// FORWARD DECLARATIONS
+class CTextOverrides;
+class CEikStatusPane;
+class CAknTitlePane;
+class CAknNavigationControlContainer;
+class CAknNavigationDecorator;
+class CApSettingsModel;
+class CApSettingsHandlerImpl;
+class CFeatureManagerWrapper;
+
+
+// CLASS DECLARATION
+/**
+* CApSettingsDlg dialog class
+*
+*/
+
+const TInt KEndOfArray = -1;
+
+const TInt KCsdAnalogue[]       = { KSpeedAutobaud, KSpeed9600, KSpeed14400, 
+                                    KEndOfArray };
+
+const TInt KCsdAnalogueWcdma[]  = { KSpeedAutobaud, KSpeed9600, KSpeed14400,
+                                    KSpeed28800, KEndOfArray };
+
+const TInt KCsdIsdn110[]        = { KSpeed9600, KSpeed14400, KEndOfArray };
+
+const TInt KCsdIsdn110Wcdma[]   = { KSpeed9600, KSpeed14400, KSpeed28800, 
+                                    KSpeed38400, KEndOfArray };
+
+const TInt KCsdIsdn120[]        = { KSpeed9600, KSpeed14400, KEndOfArray };
+
+const TInt KCsdIsdn120Wcdma[]   = { KSpeed9600, KSpeed14400, KSpeed28800, 
+                                    KSpeed56000, KEndOfArray };
+
+const TInt KHcsdAnalogue[]      = { KSpeedAutobaud, KSpeed9600, KSpeed14400,
+                                    KSpeed19200, KSpeed28800, KEndOfArray };
+
+const TInt KHcsdIsdn110[]       = { KSpeed9600, KSpeed14400, KSpeed19200, 
+                                    KSpeed28800, KSpeed38400, KEndOfArray };
+
+const TInt KHcsdIsdn120[]       = { KSpeed9600, KSpeed14400, KSpeed19200,
+                                    KSpeed28800, KSpeed43200, KEndOfArray };
+
+//Resources
+const TInt KResCsdAnalogue[]        = { R_APUI_VIEW_SPEED_AUTODETECT,
+                                        R_APUI_VIEW_SPEED_9600, 
+                                        R_APUI_VIEW_SPEED_14400, KEndOfArray };
+
+const TInt KResCsdAnalogueWcdma[]   = { R_APUI_VIEW_SPEED_AUTODETECT, 
+                                        R_APUI_VIEW_SPEED_9600, 
+                                        R_APUI_VIEW_SPEED_14400,
+                                        R_APUI_VIEW_SPEED_28800, KEndOfArray };
+
+const TInt KResCsdIsdn110[]         = { R_APUI_VIEW_SPEED_9600,
+                                        R_APUI_VIEW_SPEED_14400, KEndOfArray };
+
+const TInt KResCsdIsdn110Wcdma[]    = { R_APUI_VIEW_SPEED_9600,
+                                        R_APUI_VIEW_SPEED_14400,
+                                        R_APUI_VIEW_SPEED_28800,
+                                        R_APUI_VIEW_SPEED_38400, KEndOfArray };
+
+const TInt KResCsdIsdn120[]         = { R_APUI_VIEW_SPEED_9600, 
+                                        R_APUI_VIEW_SPEED_14400, KEndOfArray };
+
+const TInt KResCsdIsdn120Wcdma[]    = { R_APUI_VIEW_SPEED_9600, 
+                                        R_APUI_VIEW_SPEED_14400,
+                                        R_APUI_VIEW_SPEED_28800, 
+                                        R_APUI_VIEW_SPEED_56000, KEndOfArray };
+
+const TInt KResHcsdAnalogue[]       = { R_APUI_VIEW_SPEED_AUTODETECT, 
+                                        R_APUI_VIEW_SPEED_9600, 
+                                        R_APUI_VIEW_SPEED_14400,
+                                        R_APUI_VIEW_SPEED_19200,
+                                        R_APUI_VIEW_SPEED_28800, KEndOfArray };
+
+const TInt KResHcsdIsdn110[]        = { R_APUI_VIEW_SPEED_9600, 
+                                        R_APUI_VIEW_SPEED_14400, 
+                                        R_APUI_VIEW_SPEED_19200, 
+                                        R_APUI_VIEW_SPEED_28800, 
+                                        R_APUI_VIEW_SPEED_38400, KEndOfArray };
+
+const TInt KResHcsdIsdn120[]        = { R_APUI_VIEW_SPEED_9600, 
+                                        R_APUI_VIEW_SPEED_14400, 
+                                        R_APUI_VIEW_SPEED_19200,
+                                        R_APUI_VIEW_SPEED_28800,
+                                        R_APUI_VIEW_SPEED_43200, KEndOfArray };
+
+NONSHARABLE_CLASS( CApSettingsDlg ) : public CAknDialog, 
+                                      public MEikListBoxObserver, 
+                                      public MActiveApDbObserver
+    {
+
+    public: // Constructors and destructor
+
+        enum TSaveAction
+            {
+            EApCanSave,
+            EApMustDelete,
+            EApShallGoBack,
+            EApNoAction
+            };
+
+        /**
+        * Create and launch dialog.
+        * @param aModel     Model to be used for handling access point data. 
+        *                   Not owned. Must remain intact while the dialog
+        *                   exists.
+        * @param aHandler   The data handling object
+        * @param aUid       The Wap Access Point ID of the access point 
+        *                   to view/edit.
+        * @param aItem      An optional CApAccessPointItem to edit
+        * @return           The code returned by the dialogs' ExecuteLD
+        */
+        TInt ConstructAndRunLD( CApSettingsModel& aModel,
+                                CApSettingsHandlerImpl& aHandler,
+                                TUint32& aUid,
+                                CApAccessPointItem* aItem = NULL );
+
+
+
+        /**
+        * Two-phase construction.
+        * @param aIspFilter         The Isp filter to be used
+        * @param aBearerFilter      The bearer filter to be used
+        * @param aSortType          The sorting to be used
+        * @param aEventStore        A reference to hold the events happened
+        *                           while running this setting dialog.        
+        * @param aNeedIpv6Support Specifies whether the caller would like to 
+        *   have IPv6 support or not. If it is ETrue, in case of IPv6 support
+        *   is available as a feature, it will be supported. If IPv6 feature 
+        *   is not supported by the phone, it simply defaults to the normal 
+        *   IPv4 version.
+        *   If it is False, it uses the default IPv4 version independently 
+        *   from IPv6 feature beeing available or not.
+        */
+        static CApSettingsDlg* NewL( TInt aIspFilter,
+                                     TInt aBearerFilter,
+                                     TInt aSortType,
+                                     TUint32& aEventStore,
+                                     TInt aNeedIpv6Support = EFalse
+                                     );
+
+
+        /**
+        * Destructor.
+        */
+        ~CApSettingsDlg();
+
+
+        // From CCoeControl
+        TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,
+                                     TEventCode aType ) ;
+
+    protected:
+        /**
+        * Constructor.
+        * @param aIspFilter         The Isp filter to be used
+        * @param aBearerFilter      The bearer filter to be used
+        * @param aSortType          The sorting to be used
+        * @param aEventStore        A reference to hold the events happened
+        *                           while running this setting dialog.        
+        * @param aNeedIpv6Support Specifies whether the caller would like to 
+        *   have IPv6 support or not. If it is ETrue, in case of IPv6 support
+        *   is available as a feature, it will be supported. If IPv6 feature 
+        *   is not supported by the phone, it simply defaults to the normal 
+        *   IPv4 version.
+        *   If it is False, it uses the default IPv4 version independently 
+        *   from IPv6 feature beeing available or not.
+        */
+        CApSettingsDlg(  TInt aIspFilter,
+                         TInt aBearerFilter,
+                         TInt aSortType,
+                         TUint32& aEventStore,
+                         TBool aNeedIpv6Support
+                         );
+
+
+
+    public: // New functions
+
+        /**
+        * Initialises texts.
+        */
+        void InitTextsL();
+
+
+        /**
+        * Handles listbox data change
+        * @param aReRead Boolean indicating whether the data must be re-read
+        * from the database or only 'value' or 'structural' changes
+        */
+        void HandleListboxDataChangeL( TBool aReRead );
+
+
+        /**
+        * Sets the text overrides
+        * @param aOverrides The text overrides object to be used
+        */
+        void SetTextOverrides( CTextOverrides* aOverrides );
+
+
+        /**
+        * Handles database events, implementation of the
+        * MActiveApDbObserver protocol
+        * @param anEvent The event code
+        */
+        virtual void HandleApDbEventL( TEvent anEvent );
+
+        // From CCoeControl
+        virtual void GetHelpContext(TCoeHelpContext& aContext) const;
+
+    private:
+
+        // From CEikDialog
+        virtual void PreLayoutDynInitL();
+
+        // From CAknDialog
+        TBool OkToExitL( TInt aButtonId );
+
+        // From MEikCommandObserver
+        virtual void ProcessCommandL( TInt aCommandId ) ;
+
+        // From MEikMenuObserver
+        virtual void DynInitMenuPaneL( TInt aResourceId, 
+                                       CEikMenuPane* aMenuPane ) ;
+
+        // From MEikListBoxObserver
+        void HandleListBoxEventL( CEikListBox* aListBox, 
+                                  TListBoxEvent aEventType );
+
+    protected:  // New functions
+
+        /**
+        * Fills up the listbox with data
+        * @param aItemArray     The itemarray to fill up
+        * @param arr            A pointer to a TApMember array to be used as 
+        *                       list elements
+        * @param aLength        The number of elements in the above array
+        * @param aRes           A pointer to an array of resource ID's to use 
+        *                       for the elements of the TApMember array
+        * @param aCompulsory    A pointer to an array of TInts indicating that
+        *                       the elements of the TApMember array are 
+        *                       compulsory or not
+        */
+        void    FillListWithDataL
+                    (
+                    CDesCArrayFlat& aItemArray,
+                    const TApMember& arr,
+                    TInt aLength,
+                    const TInt* aRes,
+                    const TInt* aCompulsory
+                    );
+
+
+
+        /**
+        * Adds one textual listbox item for the given member
+        * @param aItemArray     The itemarray to add the item        
+        * @param aMember        A TApMember value specifying which member of 
+        *                       the access point had to be added to the list
+        * @param aRes           Resource ID for the 'title text' for this 
+        *                       member
+        * @param aCompulsory    a TInt indicating whether this member is 
+        *                       compulsory or not
+        */
+        void    AddTextualListBoxItemL
+                        (
+                        CDesCArrayFlat& aItemArray,
+                        TApMember aMember,
+                        TInt aRes,
+                        TInt aCompulsory
+                        );
+
+
+        /**
+        * Adds one 'on/off' listbox item for the given member
+        * @param aItemArray     The itemarray to add the item        
+        * @param aMember        A TApMember value specifying which member of
+        *                       the access point had to be added to the list
+        * @param aRes           Resource ID for the 'title text' for this 
+        *                       member
+        * @param aCompulsory    TInt showing if the member is compulsory or not
+        */
+        void    AddOnOffListBoxItemL
+                        (
+                        CDesCArrayFlat& aItemArray,
+                        TApMember aMember, TInt aRes,
+                        TInt aCompulsory
+                        );
+
+
+        /**
+        * Updates one 'on/off' listbox item for the given member
+        * @param aMember A TApMember value specifying which member of the
+        * access point had to be added to the list
+        * @param aRes Resource ID for the 'title text' for this member
+        * @param aPos The current position of the item in the list
+        * @param aCompulsory a TInt indicating whether
+        * this member is compulsory or not
+        */
+        void    UpdateOnOffListBoxItemL( TApMember aMember, TInt aRes,
+                                         TInt aPos, TInt aCompulsory );
+
+
+        /**
+        * Updates one 'textual' listbox item for the given member
+        * @param aMember A TApMember value specifying which member of the
+        * access point had to be added to the list
+        * @param aRes Resource ID for the 'title text' for this member
+        * @param aPos The current position of the item in the list
+        * @param aCompulsory a TInt indicating whether
+        * this member is compulsory or not
+        */
+        void    UpdateTextualListBoxItemL( TApMember aMember, TInt aRes,
+                                        TInt aPos, TInt aCompulsory );
+
+
+        /**
+        * Creates one 'textual' listbox item for the given member
+        * @param aMember A TApMember value specifying which member of the
+        * access point had to be added to the list
+        * @param aRes Resource ID for the 'title text' for this member
+        * @param aCompulsory a TInt indicating whether
+        * this member is compulsory or not
+        * @return A HBufC* pointing to the created listbox item text.
+        */
+        HBufC*  CreateTextualListBoxItemL( TApMember aMember, TInt aRes,
+                                        TInt aCompulsory );
+
+
+        /**
+        * Creates one 'on/off' listbox item for the given member
+        * @param aMember A TApMember value specifying which member of the
+        * access point had to be added to the list
+        * @param aRes Resource ID for the 'title text' for this member
+        * @param aCompulsory a TInt indicating whether
+        * this member is compulsory or not
+        * @return A HBufC* pointing to the created listbox item text.
+        */
+        HBufC*  CreateOnOffListBoxItemL( TApMember aMember, TInt aRes,
+                                        TInt aCompulsory );
+
+
+        /**
+        * Changes one setting. The setting, which is
+        * highlighted as current in the listbox is changed.
+        * @param aQuick a TBool indicating whether a 'quick' change is needed
+        * or not. Quick changes are not bring up any setting dialog but simply
+        * change the current value to the next available one.
+        * This can be used only for 'on/off' type settings
+        */
+        void    ChangeSettingsL( TBool aQuick );
+
+
+        /**
+        * Sets the internal bearer type, list is re-arranged according to the
+        * newly set bearer type
+        * @param aBearer The new bearertype
+        */
+        void    SetBearerTypeL( TApBearerType aBearer );
+
+
+        /**
+        * Inverts one boolean member of the access point
+        * @param aData the member to invert.
+        * if the member does not exists,
+        * or not a boolean memeber, code will _ASSERT_DEBUG
+        */
+        void    InvertSettingsL( TApMember aData );
+
+
+        /**
+        * Shows a popup setting page (radio buttons) for the given member
+        * @param aDataMember The access point member which need to be changed
+        * @return A boolean indicating whether the current setting
+        * had been changed or not.
+        */
+        TBool   ShowPopupSettingPageL( TApMember aDataMember );
+
+
+        /**
+        * Shows a popup text setting page for the given member
+        * @param aDataMember The access point member which need to be changed
+        * @return A boolean indicating whether the current setting
+        * had been changed or not.
+        */
+        TBool   ShowPopupTextSettingPageL( TApMember aData );
+
+
+        /**
+        * Gets the text for the passed (text-type) member.
+        * @param aDataMember The access point member for which to get the text
+        * @return a HBufC* to the newly allocated text.
+        * Text is placed onto the CleanupStack. Ownership passed to caller.
+        */
+        HBufC*  GetTextLC( TApMember aData );
+
+
+        /**
+        * Gets the resource ID for the passed (text-type) member
+        * along with the setting page flags
+        * @param aDataMember    The access point member for which to get 
+        *                       the resource ID
+        * @param aTextSettingPageFlags A reference to hold the setting 
+        *                       page flags for the given member
+        */
+        void    GetTextResId( TApMember aData, TInt& apage,
+                              TInt& aTextSettingPageFlags );
+
+
+        /**
+        * Gets the resource ID for the passed (NOT text-type) member
+        * @param aDataMember    The access point member for which to get 
+        *                       the resource ID
+        * @param aattr          A reference to hold the resource ID
+        *                       for the given member
+        */
+        void    GetResId( TApMember aData, TInt& aattr );
+
+
+        /**
+        * Fills up a pop-up radio button setting page with the currently
+        * valid and available choices for the given member.
+        * @param aData The member whose chances are needed
+        * @param aCurrvalue The current value of the setting
+        * @return An array of choices for the given member,
+        * pushed to the CleanupStack.
+        */
+        CDesCArrayFlat* FillPopupSettingPageLC( TApMember aData,
+                                                TInt& aCurrvalue );
+
+
+        /**
+        * Updates the given member's data with the new
+        * setting from the setting page.
+        * @param aData the member to update
+        * @param aCurrvalue The new value
+        */
+        void    UpdateFromPopupSettingPageL( TApMember aData, 
+                                             TInt aCurrvalue );
+
+
+        /**
+        * Returns whether the access point in question can be saved or not.
+        * If a compulsory item is missing, user is prompted whether to delete
+        * it or to go back for re-editing.
+        * @param aDataNeeded If the AP can not be saved because a compulsory
+        * item is missing, this holds the TApMember which is not filled.
+        * It lists always the first item causing the 'failure'.
+        * @return a TSaveAction indicating whether it can be saved,
+        * must re-edit or must be deleted.
+        */
+        TSaveAction CanSaveL( TApMember& aDataNeeded );
+
+
+        /**
+        * Handles IP address editing of the given field
+        * Brings up the IP address editor page, fills up with the current
+        * value, handles editing and after editing, it stores the new value
+        * in the AP item.
+        * @param aData The (IP-address) member which needs to be changed
+        */
+        void    ShowPopupIpAddrSettingPageL( TApMember aData );
+
+
+        /**
+        * Handles phone number editing of the given field
+        * Brings up the phone number editor page, fills up with the current
+        * value, handles editing and after editing, it stores the new value
+        * in the AP item.
+        * In case the entered phone number is invalid, an 'invalid number'
+        * note is shown and original value is kept.
+        * @param aData The (phone-number) member which needs to be changed
+        */
+        void    ShowPopupPhoneNumSettingPageL( TApMember aData );
+
+
+        /**
+        * Handles password setting
+        * Brings up the password editor page, handles editing
+        * and after editing, it stores the new value in the AP item.
+        * @param a TApMember specifying the member
+        */
+        void    ShowPopupPasswordPageL( TApMember aData );
+
+
+        /*
+        * Reads up a Boolean type data, ensures that it is in the
+        * required range (0 or 1)
+        * @param aData The member to get
+        * @param aInvert Whether the logic is inverted or not
+        * @param aCurrvalue The current value
+        */
+        void    GetBoolDataValue( TApMember aData, TBool aInvert,
+                                  TInt& aCurrvalue );
+    private:
+
+        /**
+        * Does the bearer change according to
+        * the current value of the selection
+        * @param a TInt specifying the current value
+        */
+        void    DoBearerChangeL( TInt aCurrvalue );
+
+
+        /**
+        * Handles bearer change.
+        * Sets AP item bearer type, re-reads AP data, re-arranges listbox
+        * according to the new bearer type
+        * @param aBearer A TApBearerType specifying the current bearer.
+        */
+        void    HandleBearerChangeL( TApBearerType aBearer );
+
+
+        /*
+        * This part holds functions available only in the case of 
+        * 'multiple bearer support', that means that 
+        * as long as the user does not saves the AP, multiple instances of
+        * the same AP are kept with different bearers...
+        */
+
+        /**
+        * Returns the array index for a bearer type
+        * @param aBearer    The bearer type to get the index of
+        * @return The index
+        */
+        TInt32  BearerToArrayIndexL( TApBearerType aBearer );
+
+        
+        /**
+        * Returns the bearer type for an index
+        * @param aIndex The index to get the bearer type for
+        * @return The bearer type
+        */
+        TApBearerType ArrayIndexToBearer( TInt32 aIndex );
+
+
+        /**
+        * Fills the passed array with the possible bearer speed values.
+        * Array MUST be empty to get correct result as speed values are
+        * simply APPENDED to the end of the list.
+        * Adds only valid and available values according to the current
+        * bearer type and call type.
+        * @param aItems The array to hold the bearer speed values
+        * @param aCurrvalue The index of the current speed value
+        */
+        void    FillUpBearerSpeedValuesL( CDesCArrayFlat& aItems,
+                                          TInt& aCurrvalue );
+
+
+        /**
+        * Tries to save current access point data.
+        * Checks if the data can be saved: each compulsory fields are filled,
+        * Name is valid and does not exist already.
+        * If data can not be saved, pops up query about delete? Yes/No
+        * If user choses delete, AP will be deleted.
+        * If user chooses NO, the 'faulty' item will be highlighted in the
+        * list and it will return to the setting list, giving a chance to edit
+        * the faulty/missing data.
+        * @return Whether the 'Save' procedure had been successfull or not.
+        * It also means that if the user had choosen 'Delete', after deleting
+        * the AP it will return 'ETrue' indicating successfull operation.
+        */
+        TBool   SaveDataL( );
+
+
+        /**
+        * Handles list structure changes.
+        * Refreshes the list of members needed to represent the current AP and
+        * the current settings.
+        */
+        void    HandleListStructureChangeL();
+
+
+        /**
+        * This function 'limits' the connection speed after a bearertype or
+        * calltype change so the current bearer speed will be always valid.
+        */
+        void    LimitSpeed();
+
+
+        /**
+        * Selects one item of the listbox.
+        * @param aItemIndex The index of the item to be select.
+        */
+        void    SelectItem( TInt aItemIndex );
+
+
+
+        /*
+        * Converts EParagraphDelimiter-s to /n-s
+        * Returned text is owned by the caller!
+        * @param aInText The original text where replacement is needed
+        * @return A new HBufC (pushed to the CleanupStack) with
+        * the modified text
+        */
+        HBufC* ConvertDelimToPerNLC( const TDesC& aInText );
+
+
+        /*
+        * Converts /n-s to EParagraphDelimiter-s
+        * Returned text is owned by the caller!
+        * @param aInText The original text where replacement is needed
+        * @return A new HBufC (pushed to the CleanupStack) with
+        * the modified text
+        */
+        HBufC* ConvertPerNToDelimLC( const TDesC& aInText );
+
+
+        /**
+        * Changes one setting. The setting, which is
+        * highlighted as current in the listbox is changed.
+        * @param aQuick a TBool indicating whether a 'quick' change is needed
+        * or not. Quick changes are not bring up any setting dialog but simply
+        * change the current value to the next available one.
+        * This can be used only for 'on/off' type settings
+        */
+        void DoChangeSettingsL( TBool aQuick );
+
+
+        /**
+        * Converts the selected speed index to the current speed value
+        * based on the bearer type (CSD/HSCSD) and whether it is analogue,
+        * ISDN v110 or ISDN v120
+        * @param aCurrvalue TInt The current selection index
+        * @return The TApCallSpeed value
+        */
+        TApCallSpeed GetBearerSpeedForSelection( TInt aCurrvalue );
+
+
+        /**
+        * Calculates the index for the current speed value
+        * based on the bearer type (CSD/HSCSD) and whether it is analogue,
+        * ISDN v110 or ISDN v120
+        * @return TInt the index of the current speed in the list
+        */
+        TInt GetCurrIndexFromBearerSpeed( );
+
+
+        /**
+        * Converts whitespace characters to spaces
+        * Returned text is owned by the caller!
+        * @param aInText The original text where replacement is needed
+        * @return A new HBufC (pushed to the CleanupStack) with
+        * the modified text
+        */
+        HBufC* ReplaceWhiteSpaceCharactersLC(  const TDesC& aInText );
+
+
+        void ChangeNetworkGroupL();
+
+
+        /**
+        * Gets the shareddata value whether HSCSD is enabled or not
+        * @return A TInt stating if it is enabled (1) or not (0)
+        */
+        TInt IsHSCSDEnabledL();
+
+
+        /**
+        * Gets the CSD settings array according to the passed variant
+        * It sets member pointers to Field, Title & Compulsory values
+        * @param variant    Variant
+        */
+        void GetCSDSettingArrays( TInt variant );
+
+
+        /**
+        * Gets the GPRS settings array according to the passed variant
+        * It sets member pointers to Field, Title & Compulsory values
+        * @param aVariant    Variant
+        */
+        void GetGPRSSettingArrays( TInt aVariant );
+
+        
+        /**
+        * Gets the WLAN settings array according to the passed variant
+        * It sets member pointers to Field, Title & Compulsory values
+        * @param variant    Variant
+        */
+        void GetWLANSettingArraysL( TInt variant );
+
+
+        /**
+        * Asks a query if wcdma speed had been selected.
+        * only checks if a speed-related member had been changed.
+        * @param aMember    The member which had been changed
+        * @param aCurrValue The current value of the setting
+        * @return   Whether the query had been accepted or not. 
+        *           Default return value is ETrue
+        */
+        TBool AskQueryIfWcdmaL( TApMember aMember, TInt aCurrvalue  );
+
+
+        /**
+        * Displays the domain name servers data query 
+        * @param AIp6 Determines whether ip4 or ip6 query is to be launched.
+        * Internally takes care about whether IP6 is supported or not.
+        * If IP4 is selected, it uses IP address editor.
+        * If IP6 is selected, it uses standard text editor.
+        * @return The result of the dialog's ExecuteLD
+        */
+        TInt GetNameServersL( TBool aIp6 );
+
+
+        /**
+        * Adds one 'Menu' listbox item (which will open another setting list)
+        * for the given member.
+        * @param aMember A TApMember value specifying which member of the
+        * access point had to be added to the list
+        * @param aRes Resource ID for the 'title text' for this member
+        * @param aCompulsory a TInt indicating whether
+        * this member is compulsory or not
+        */
+        void AddMenuListBoxItemL( 
+                                CDesCArrayFlat& aItemArray,
+                                TApMember aMember,
+                                TInt aRes,
+                                TInt aCompulsory
+                                );
+
+
+        /**
+        * Returns the current domain name server type
+        * It can be 3: Dynamic, Well-known, User defined
+        * Return values are 0, 1, 2, respectively
+        */
+        TInt GetDomainNameServersTypeL();
+
+
+        /**
+        * Pops up an IPv4 IP address multiline query
+        * IP address is entered into IPv4 address editors
+        * @return Returns the returned value of the multiline query
+        */
+        TInt GetIpv4NameServerL();
+
+
+        /**
+        * Pops up an IPv6 IP address multiline query
+        * IP address is entered into TEXT editors
+        * @return Returns the returned value of the multiline query
+        */
+        TInt GetIpv6NameServerL();
+
+
+        /**
+        * Returns the current domain name server type for IPv6 type
+        * It can be 3: Dynamic, Well-known, User defined
+        * Return values are 0, 1, 2, respectively
+        */
+        TInt GetIPv6DNSTypeL();
+
+
+        /**
+        * Returns the current domain name server type for IPv4 type
+        * It can be 3: Dynamic, Well-known, User defined
+        * Return values are 0, 1, 2, respectively
+        */
+        TInt GetIPv4DNSTypeL();
+
+
+        /**
+        * Strips non-number chars from the passed text
+        * @return a HBufC8 holding the new text
+        */
+        HBufC* StripNonNumberLC( const TDesC16& aInText );
+
+
+        /**
+        * Returns the index for the given bearertype in the list of 
+        * currently available bearer types.
+        * Leaves with KErrNotSupported if the passed bearer type currently 
+        * is not supported
+        */
+        TInt BearerType2BearerItemPosL( TApBearerType aBearer );
+
+
+        /**
+        * Returns the bearer type for the given position in the list of 
+        * currently available bearer types.
+        * @param The position in the list
+        * @return The bearer type of the item bbeing in aPos position
+        */
+        TApBearerType BearerItemPos2BearerTypeL( TInt aPos );
+
+
+        /**
+        * Changes WLAN network name.
+        */
+        void ChangeWlanNetworkNameL();
+
+
+        /**
+        * Changes WLAN security settings.
+        * @return TInt giving exit or shutdown required if any, otherwise, 0
+        */
+        TInt ChangeWlanSecuritySettingsL();
+
+
+        /**
+        * Changes WEP security settings.
+        * Leaves on errors.
+        * @return TInt giving exit or shutdown required if any, otherwise, 0
+        */
+        TInt ChangeWepSecuritySettingsL();
+
+
+        /**
+        * Changes WPA security settings.
+        * Leaves on errors.
+        * @return TInt giving exit or shutdown required if any, otherwise, 0
+        */
+        TInt ChangeWpaSecuritySettingsL();
+
+
+        /**
+        * Changes 802.1x security settings.
+        * Leaves on errors.
+        * @return TInt giving exit or shutdown required if any, otherwise, 0
+        */
+        TInt Change8021xSecuritySettingsL();
+
+
+        /**
+        * Returns whether WLAN is supported or not.
+        * @return a boolean indicating whether WLAN is supported or not.
+        */
+        TBool IsWlanSupported();
+
+
+        /**
+        * Get the Wlan network name with a popup query
+        * @return A boolean indicating whether the current setting
+        * had been changed or not.
+        */
+        TBool QueryWlanNetworkNameL();
+
+
+        /**
+        * @return Whether the EApIspIPNetMask and EApIspIPGateway fields 
+        * are visible in the settings or not.
+        */
+        TBool IsNetMaskAndGatewayVisibleL();
+
+        
+        /**
+        * Returns the ad-hoc channel number asked from the user
+        */
+        TUint32 GetAdHocChannelL();
+        
+        
+        /**
+        * Returns whether the ad-hoc channel ID is visible or not
+        */
+        TBool IsAdhocChannelVisible();
+        
+        
+        /**
+        * Returns whether the security settings are filled correctly in case
+        * of a WLAN access point or not.
+        */
+        TBool HasSecuritySettingsFilledL();
+        
+        
+        /**
+        * Limits the security mode when the network mode has changed.
+        * In case of infrastructure, it should not be called
+        * In case of Ad-hoc, it should be called and it will limit the
+        * current security mode into the curren range, which is EOpen and EWep
+        *
+        */
+        void LimitSecMode();
+        
+        
+        /**
+        * Returns whether the access point in question can be saved or not.
+        * If a compulsory item is missing, user is prompted whether to quit 
+        * without saving it or to go back for re-editing.
+        * @param aDataNeeded If the AP can not be saved because a compulsory
+        * item is missing, this holds the TApMember which is not filled.
+        * It lists always the first item causing the 'failure'.
+        * @return a TSaveAction indicating whether it can be saved,
+        * must re-edit or must be quited(deleted).
+        */
+        TSaveAction CanSaveWlanCompulsoriesL( TApMember& aDataNeeded );
+        
+        /**
+        * Restores Ipv4 settings to iApItem from iBackupApItem.
+        */
+        void RestoreIpv4SettingsL();
+        
+protected:  // Functions from base classes
+
+
+
+    private: //data
+        TUint32*                        iUid;
+
+        TUint32                         iLevel;         // current level
+        // when leaving level 0, the two indexes are stored: top & current
+        // to enable getting back to the same position & state
+        TInt                            iOldIndex;    // current index
+        TInt                            iOldTopIndex;   // top index
+
+        TInt                            iAdvIndex;
+
+        TApBearerType                   iBearerType;
+        TInt                            iIspFilter;
+        TInt                            iBearerFilter;
+        TInt                            iSortType;
+
+        CEikStatusPane*                 iStatusPane;    // NOT owned
+        CAknTitlePane*                  iTitlePane;     // NOT owned
+        CAknNavigationControlContainer* iNaviPane;      // NOT owned
+        CAknNavigationDecorator*        iNaviDecorator; // owned
+
+        HBufC*                          iOldTitleText;
+
+        CApSettingsModel*               iDataModel;     // NOT owned
+
+        CAknSettingStyleListBox*        iList;      // owned through resources,
+                                                    // destroyed automatically 
+                                                    // by the dialog
+
+        CApAccessPointItem*             iApItem;        // owned
+        CApAccessPointItem*             iOldApItem;     // owned
+        TUint32*                        iEventStore;
+
+        CArrayPtrFlat<CApAccessPointItem>*  iBearerItemArray; // owned
+
+        TApMember*                      iField;
+        TApMember*                      iFieldAdvanced;
+        TApMember*                      iFieldL2;
+        TInt                            iFieldCount;
+        TInt                            iAdvancedFieldCount;
+        TInt                            iFieldCountL2;
+        TInt*                           iTitles;
+        TInt*                           iTitlesAdvanced;
+        TInt*                           iTitlesL2;
+        TInt*                           iCompulsory;
+        TInt*                           iCompulsoryAdvanced;
+        TInt*                           iCompulsoryL2;
+        TApUiExitReason                 iExitReason;
+
+        CDesCArrayFlat*                 iItemArray; // not owned
+
+        CTextOverrides*                 iTextOverrides;// does not owns it, 
+                                                       // just passed for usage
+        CApSettingsHandlerImpl*         iHandler;
+
+        TInt                            iReqIpvType;    // Default is IPv4
+        TBool                           iL2Ipv4;        // Default is NO 
+        TInt                            iVariant;       /// Local variant value
+       
+        /**
+        * CFeatureManagerWrapper wraps FeatureManager to eliminate maintenance 
+        * of existance of FeatureManager.
+        * Owned.
+        */
+        CFeatureManagerWrapper*         iFeatureManagerWrapper; 
+
+
+#ifdef __TEST_OOMDEBUG
+        TBool                           iMemTestOn;
+#endif // __TEST_OOMDEBUG
+        TInt                            iSecSettingsExitReason;
+        TApBearerType                   iOriginalBearerType;
+        
+        CApAccessPointItem*             iBackupApItem;     // owned
+        TBool							iHelpSupported;
+    };
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/inc/ApSettingsHandlerConsts.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,86 @@
+/*
+* Copyright (c) 2002 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: 
+*     Contains common internal consts, typedefs for the Access Point settings.
+*
+*/
+
+
+#ifndef APSETTINGS_HANDLER_CONSTS_H
+#define APSETTINGS_HANDLER_CONSTS_H
+
+// CONSTANTS
+
+#define KMaxConnNameLength            30
+#define KMaxGprsApNameLength          100
+#define KMaxLoginNameLength           50
+#define KMaxStartPageLength           1000
+#define KMaxAccessNumLength           21
+#define KCBInfoLength                 21
+#define KMaxServiceCentreAddrLength   21
+#define KMaxServiceAccessNumLength    21
+#define KMaxLoginScriptLength         1000
+#define KMaxLoginPasswordLength       50
+#define KMaxModInitStringLength       50
+#define KMaxProxyServerLength         1000
+#define KMaxProxyPortNumberLength     5
+#define KMaxNetworkNameLength         50
+#define KMaxIPv6NameServerLength      40
+#define KMaxIPv4NameServerLength      12
+#define KMaxWlanNetworkameLength      32
+#define KMaxAdhocChannelNumberLength  2
+#define KAdhocChannelMin              1
+#define KAdhocChannelMax              11
+
+#define KConnNameWidth                10
+#define KGprsApNameWidth              10
+#define KLoginNameWidth               10
+#define KStartPageWidth               10
+#define KAccessNumWidth               10
+#define KCBInfoWidth                  10
+#define KServiceCentreAddrWidth       10
+#define KServiceAccessNumWidth        10
+#define KIpAddressWidth               10
+#define KLoginScriptWidth             10
+#define KModInitStringWidth           10
+#define KProxyServerWidth             10
+#define KProxyPortNumberWidth         10
+#define KNetworkNameWidth             10
+
+
+#define KConnNameLines                2
+#define KGprsApNameLines              2
+#define KLoginNameLines               2
+#define KStartPageLines               2
+#define KAccessNumLines               2
+#define KCBInfoLines                  2
+#define KServiceCentreAddrLines       2
+#define KServiceAccessNumLines        2
+#define KIpAddressLines               2
+#define KLoginScriptLines             2
+#define KModInitStringLines           2
+#define KProxyServerLines             2
+#define KProxyPortNumberLines         2
+#define KNetworkNameLines             1
+
+
+
+
+#define KListQueryHeight              6
+#define KListQueryWidth               2
+
+#endif
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/inc/ApSettingsHandlerLogger.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,164 @@
+/*
+* Copyright (c) 2002 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: 
+*       Implemented logger functionality of the module
+*
+*/
+
+
+#ifndef APSETTINGSHANDLER_LOGGER_H
+#define APSETTINGSHANDLER_LOGGER_H
+
+
+
+// INCLUDE FILES
+
+#include <flogger.h>
+#include <eikenv.h>
+
+
+// CONSTANTS
+
+const TInt KApSetUIMajorVersion = 4;
+const TInt KApSetUIMinorVersion = 0;
+const TInt KApSetUIBuildVersion = 16;
+
+_LIT( KApSetUILogMessageAppBanner,   "ApSetUI: (%d.%d.%d) started" );
+_LIT( KApSetUILogEnterFn,            "ApSetUI: -> %S" );
+_LIT( KApSetUILogLeaveFn,            "ApSetUI: <- %S" );
+_LIT( KApSetUILogExit,               "ApSetUI: exit" );
+_LIT( KApSetUILogTimeFormatString,   "%H:%T:%S:%*C3" );
+
+// NOTE! We're depending on FLogger DLL, because it assumes the existence
+// of C:\LOGS directory.
+_LIT( KApSetUIFLoggerDependency,        "c:\\logs\\" );
+_LIT( KApSetUIDoubleBackSlash,      "\\" );
+_LIT( KApSetUILogDir,                "data" );
+_LIT( KApSetUILogFile,               "apui.log" );
+
+
+    enum TApSetUiLogMask                ///< Log mask bits.
+        {
+        ELogOff         = 0x00000000,   ///< Don't log.
+        EDelete         = 0x00000001,   ///< Log delete activity.
+        ESettings       = 0x00000002,   ///< Log Settings
+        EListbox        = 0x00000004,   ///< Log listbox activity.
+        EModel          = 0x00000008,   ///< Log Model activity.
+        EAPI            = 0x00000010,   ///< Log API activity.
+        EApImpl         = 0x00000020,   ///< Log Implementation activity.
+        EDialog         = 0x00000040,   ///< Log dialog activity.
+        EOther          = 0x00000080,   ///< Log other activity.
+        /*
+        EApItem         = 0x00000040,   ///< Log ApItem activity.
+        ECommons        = 0x00000080,   ///< Log transaction activity.
+        EActiveDb       = 0x000000F0,   ///< Log active db & notification 
+                                        ///< activity.
+        */
+        ESpecial        = 0x0FFFF000,   ///< Log special, temp stuff only
+        ELogAll         = 0xFFFFFFFF    ///< Log all.
+        };
+
+    // MACROS
+
+    /// Determines what to log. Construct this from TApSetUiLogMask values.
+//    #define APSETUI_LOG_MASK ELogAll
+//    #define APSETUI_LOG_MASK    EDelete + EModel + EListbox
+//    #define APSETUI_LOG_MASK    EDelete + EModel
+// #define APSETUI_LOG_MASK ESettings +EListbox +EModel +EAPI +EApImpl +EDialog +EOther
+    #define APSETUI_LOG_MASK    EModel
+    
+
+#ifdef __TEST_LOGGING
+    #define APSETUILOGGER_CREATE { \
+                TFileName path( KApSetUIFLoggerDependency );    \
+                path.Append( KApSetUILogDir );                  \
+                path.Append( KApSetUIDoubleBackSlash );         \
+                RFs& fs = CEikonEnv::Static()->FsSession();     \
+                fs.MkDirAll( path );                            \
+                RFileLogger::WriteFormat( KApSetUILogDir, KApSetUILogFile,  \
+                                          EFileLoggingModeOverwrite,        \
+                                          KApSetUILogMessageAppBanner,      \
+                                          KApSetUIMajorVersion,             \
+                                          KApSetUIMinorVersion,             \
+                                          KApSetUIBuildVersion ); }         
+    #define APSETUILOGGER_DELETE {                          \
+                RFileLogger::Write( KApSetUILogDir,         \
+                                    KApSetUILogFile,        \
+                                    EFileLoggingModeAppend, \
+                                    KApSetUILogExit ); }
+    #define APSETUILOGGER_ENTERFN( mask, a ) {                              \
+                _LIT( temp, a );                                            \
+                if (mask & APSETUI_LOG_MASK)                                \
+                    {                                                       \
+                    RFileLogger::WriteFormat( KApSetUILogDir,               \
+                                              KApSetUILogFile,              \
+                                              EFileLoggingModeAppend,       \
+                                              KApSetUILogEnterFn, &temp );  \
+                    } }
+    #define APSETUILOGGER_LEAVEFN( mask, a ) {                              \
+                _LIT( temp, a );                                            \
+                if (mask & APSETUI_LOG_MASK)                                \
+                    {                                                       \
+                    RFileLogger::WriteFormat( KApSetUILogDir,               \
+                                              KApSetUILogFile,              \
+                                              EFileLoggingModeAppend,       \
+                                              KApSetUILogLeaveFn, &temp );  \
+                    } }
+    #define APSETUILOGGER_WRITE( mask, a ) {                                \
+                _LIT( temp, a );                                            \
+                if (mask & APSETUI_LOG_MASK)                                \
+                    {                                                       \
+                    RFileLogger::Write( KApSetUILogDir,                     \
+                                        KApSetUILogFile,                    \
+                                    EFileLoggingModeAppend, temp );         \
+                    } }
+    #define APSETUILOGGER_WRITE_FORMAT( mask, a, b ) {                      \
+                _LIT( temp, a );                                            \
+                if (mask & APSETUI_LOG_MASK)                                \
+                    {                                                       \
+                    RFileLogger::WriteFormat( KApSetUILogDir,               \
+                                              KApSetUILogFile,              \
+                                              EFileLoggingModeAppend,       \
+                                              temp, b );                    \
+                    } }
+    #define APSETUILOGGER_WRITE_TIMESTAMP( mask, a ) {                      \
+                _LIT( temp, a );                                            \
+                if (mask & APSETUI_LOG_MASK)                                \
+                    {                                                       \
+                    TTime time; TBuf<48> buf; time.HomeTime();              \
+                    time.FormatL( buf, KApSetUILogTimeFormatString );       \
+                    buf.Insert( 0, temp );                                  \
+                    RFileLogger::Write( KApSetUILogDir, KApSetUILogFile,    \
+                    EFileLoggingModeAppend, buf);                           \
+                    } }
+    #define APSETUILOGGER_WRITE_BUF( mask, a ) {                            \
+                if (mask & APSETUI_LOG_MASK)                                \
+                    {                                                       \
+                    RFileLogger::Write( KApSetUILogDir, KApSetUILogFile,    \
+                                        EFileLoggingModeAppend, a);         \
+                    } }
+#else
+    #define APSETUILOGGER_CREATE {}
+    #define APSETUILOGGER_DELETE {}
+    #define APSETUILOGGER_ENTERFN( mask, a ) {}
+    #define APSETUILOGGER_LEAVEFN( mask, a ) {}
+    #define APSETUILOGGER_WRITE( mask, a ) {}
+    #define APSETUILOGGER_WRITE_FORMAT( mask, a, b ) {}
+    #define APSETUILOGGER_WRITE_TIMESTAMP( mask, a ) {}
+    #define APSETUILOGGER_WRITE_BUF( mask, a ) {}
+#endif // __TEST_LOGGING
+
+#endif // APSETTINGSHANDLER_LOGGER_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/inc/ApSettingsHandlerUI.hrh	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2002 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 ApSettingsHandlerUi.
+*     The file can be included in C++ or resource file.
+*
+*/
+
+
+#ifndef APSETTINGSHANDLER_HRH
+#define APSETTINGSHANDLER_HRH
+
+#define  KApSelectorListboxType     16543
+#define  KApSettingsListboxType     6544
+
+enum TApSelectorMenuCommands
+    {
+    EApSelCmdSelect = 1234,
+    EApSelCmdOpen,
+    EApSelCmdNew,
+    EApSelCmdNewBlank,
+    EApSelCmdNewUseExisting,
+    EApSelCmdDelete,
+    EApSelCmdExit,
+    EApSelCmdChange,
+    EApSelCmdAdvanced,
+
+    // query commands
+    EApUiCmdRetry,
+    EApUiCmdCancel,
+    
+    EApSelCmdQuickChange
+    };
+
+
+
+
+enum TApSelectorDllDlgLineId // dialog line IDs
+    {
+    KApSelectorListboxId = 2,
+    KApSettingsListboxId,
+    KApGeneralNote,
+    KApWaitNote
+    };
+
+
+
+
+#endif      //  APSELECTOR
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/inc/ApSettingsHandlerUiPrivateCRKeys.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef APSETTINGSHANDLERUIPRIVATECRKEYS_H
+#define APSETTINGSHANDLERUIPRIVATECRKEYS_H
+
+const TUid KCRUidApSettingsHandlerUiLV = {0x10008D3B};
+
+// Local variation for ApSettingsHandlerUi
+const TUint32 KApSettingsHandlerUiLVFlags =            0x00000001;
+
+
+#endif      // APSETTINGSHANDLERUIPRIVATECRKEYS_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/inc/ApSettingsLookups.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,981 @@
+/*
+* Copyright (c) 2002 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 containes the lookup-information for the ApSettingsDlg.
+*       Gives the order of the fields, number of the fields, etc.
+*
+*/
+
+
+
+#ifndef APSETTINGS_LOOKUPS_H
+#define APSETTINGS_LOOKUPS_H
+
+// INCLUDE FILES
+#include <ApAccessPointItem.h>
+#include <ApSetUI.rsg>
+
+#include <ApSettingsHandlerCommons.h>
+
+
+// CONSTANTS
+const TInt KListIndexConnectionName = 0;
+const TInt KListIndexBearerType = 1;
+const TInt KListIndexCSDAccessNumber = 2;
+
+const TInt KListIndexWLANNetworkName = 2;
+
+const TInt KListIndexWLANSubnetMask = 1;
+const TInt KListIndexWLANDefaultGateway = 2;
+const TInt KListIndexWLANSecuritySettings = 6;
+
+
+
+const TInt KApMember = 0;
+const TInt KResourceID = 1;
+const TInt KCompulsory = 2;
+
+
+
+
+
+
+
+const TInt Fields_CSD_L2_IPv4[3][2] =
+    {
+        {
+        EApIspIPAddr,                       ///< Phone IP addr.
+        EApIP6DNSAddrFromServer             ///< Domain name servers
+        },
+        {
+        R_APUI_VIEW_PHONE_IP_ADDR,          ///< Phone IP addr.
+        R_APUI_VIEW_SET_DNS_SERVERS_IP      ///< Domain name servers
+        },
+        {
+        0,                                  ///< Phone IP addr.
+        0                                   ///< Domain name servers
+        }
+    };
+
+
+const TInt Fields_CSD_L2_IPv6[3][1] =
+    {
+        {
+        EApIP6DNSAddrFromServer             ///< Domain name servers
+        },
+        {
+        R_APUI_VIEW_SET_DNS_SERVERS_IP      ///< Domain name servers
+        },
+        {
+        0                                   ///< Domain name servers
+        }
+    };
+
+
+
+//----------------------------------------------------------
+// Settings with the KWSPSettingsVisible flag defined
+//----------------------------------------------------------
+//
+const TInt Fields_GPRS_WSP[3][8] =
+    {
+        {
+        EApWapAccessPointName,      ///< Connection name
+        EApWapCurrentBearer,        ///< Bearer type
+
+        EApGprsAccessPointName,     ///< Access Point Name
+        EApIspIfAuthName,           // username
+        EApIspPromptForLogin,       ///< prompt password
+        EApIspIfAuthPass,           // password
+        EApGprsDisablePlainTextAuth,///< password authentication
+        EApWapStartPage             ///< Starting Page
+        },
+        {
+        R_APUI_VIEW_CONNECTION_NAME,        ///< Connection name
+        R_APUI_VIEW_BEARER_TYPE,            ///< Bearer type
+        R_APUI_VIEW_AP_NAME,                ///< Access Point Name
+        R_APUI_VIEW_USER_NAME,              ///< username
+        R_APUI_VIEW_PROMPT_PASSWORD,        ///< prompt password
+        R_APUI_VIEW_PASSWORD,               ///< password
+        R_APUI_VIEW_PASSWORD_AUTH,          ///< password authentication
+        R_APUI_VIEW_STARTING_PAGE           ///< Starting Page
+        },
+        {
+        1,                                  ///< Connection name
+        0,                                  ///< Bearer type
+        0,                                  ///< Access Point Name
+        0,                                  ///< username
+        0,                                  ///< prompt password
+        0,                                  ///< password
+        0,                                  ///< password authentication
+        0                                   ///< Starting Page
+        }
+    };
+
+
+
+const TInt Fields_GPRS_Advanced_WSP[3][8] =
+    {
+        {
+        EApIspIPAddr,               ///< Phone IP addr.
+        EApGprsIPNameServer1,       ///< Primary Name server
+        EApGprsIPNameServer2,       ///< Secondary Name server
+        EApProxyServerAddress,      ///< Proxy server address
+        EApProxyPortNumber,         ///< Proxy port number
+        EApWapGatewayAddress,       ///< Wap Gateway IP address
+        EApWapSecurity,             ///< WTLS Security
+        EApWapWspOption             ///< Connection type
+        },
+        {
+        R_APUI_VIEW_PHONE_IP_ADDR,          ///< Phone IP addr.
+        R_APUI_VIEW_PRIMARY_NAME_SERVER,    ///< Primary Name server
+        R_APUI_VIEW_SECONDARY_NAME_SERVER,  ///< Secondary Name server
+        R_APUI_VIEW_PROXY_SERVER_ADDR,      ///< Proxy server address
+        R_APUI_VIEW_PROXY_PORT_NUMBER,      ///< Proxy port number
+        R_APUI_VIEW_WAP_GW_IP_ADDR,         ///< Wap Gateway IP address
+        R_APUI_VIEW_WTLS_SECURITY,          ///< WTLS Security
+        R_APUI_VIEW_CONNECTION_TYPE         ///< Connection type
+        },
+        {
+        0,                                  ///< Phone IP addr.
+        0,                                  ///< Primary Name server
+        0,                                  ///< Secondary Name server
+        0,                                  ///< Proxy server address
+        0,                                  ///< Proxy port number
+        0,                                  ///< Wap Gateway IP address
+        0,                                  ///< WTLS Security
+        0                                   ///< Connection type
+        }
+    };
+
+
+
+const TInt Fields_CSD_WSP[3][10] =
+    {
+        {
+        EApWapAccessPointName,          ///< Connection name
+        EApWapCurrentBearer,            ///< Bearer type
+
+        EApIspDefaultTelNumber,         ///< Access Number
+        EApIspIfAuthName,               // username
+        EApIspPromptForLogin,           ///< prompt password
+        EApIspIfAuthPass,               // password
+        EApGprsDisablePlainTextAuth,    ///< password authentication
+        EApWapStartPage,                ///< Starting Page
+        EApIspBearerCallTypeIsdn,       ///< Data call type 
+                                        ///< (analogue/ISDN110/ISDN120)
+        EApIspBearerSpeed               ///< Max. connection speed
+        },
+        {
+        R_APUI_VIEW_CONNECTION_NAME,        ///< Connection name
+        R_APUI_VIEW_BEARER_TYPE,            ///< Bearer type
+        R_APUI_VIEW_ACCESS_NUMBER,          ///< Access Number
+        R_APUI_VIEW_USER_NAME,              ///< username
+        R_APUI_VIEW_PROMPT_PASSWORD,        ///< prompt password
+        R_APUI_VIEW_PASSWORD,               ///< password
+        R_APUI_VIEW_PASSWORD_AUTH,          ///< password authentication
+        R_APUI_VIEW_STARTING_PAGE,          ///< Starting Page
+        R_APUI_VIEW_DATA_CALL_TYPE,         ///< Data call type (analogue/ISDN)
+        R_APUI_VIEW_MAX_CONN_SPEED          ///< Max. connection speed
+        },
+        {
+        1,                                  ///< Connection name
+        0,                                  ///< Bearer type
+        1,                                  ///< Access Number
+        0,                                  ///< username
+        0,                                  ///< prompt password
+        0,                                  ///< password
+        0,                                  ///< password authentication
+        0,                                  ///< Starting Page
+        0,                                  ///< Data call type (analogue/ISDN)
+        0                                   ///< Max. connection speed
+        }
+    };
+
+
+const TInt Fields_CSD_Advanced_WSP[3][15] =
+    {
+        {
+        EApIspIPAddr,               ///< Phone IP addr.
+        EApGprsIPNameServer1,       ///< Primary Name server
+        EApGprsIPNameServer2,       ///< Secondary Name server
+        EApProxyServerAddress,      ///< Proxy server address
+        EApProxyPortNumber,         ///< Proxy port number
+        EApIspIfCallbackEnabled,    ///< use callback
+        EApIspIfCallbackType,       ///< call back type
+        EApIspIfCallbackInfo,       ///< call back number
+        EApIspEnableSWCompression,  ///< Enable SW compression
+        EApIspUseLoginScript,       ///< Use login script
+        EApIspLoginScript,          ///< The login script
+        EApIspInitString,           ///< Modem init string
+        EApWapGatewayAddress,           ///< Wap Gateway IP address
+        EApWapSecurity,                 ///< WTLS Security
+        EApWapWspOption                 ///< Connection type
+        },
+        {
+        R_APUI_VIEW_PHONE_IP_ADDR,          ///< Phone IP addr.
+        R_APUI_VIEW_PRIMARY_NAME_SERVER,    ///< Primary Name server
+        R_APUI_VIEW_SECONDARY_NAME_SERVER,  ///< Secondary Name server
+        R_APUI_VIEW_PROXY_SERVER_ADDR,      ///< Proxy server address
+        R_APUI_VIEW_PROXY_PORT_NUMBER,      ///< Proxy port number
+        R_APUI_VIEW_USE_CALL_BACK,          ///< use callback
+        R_APUI_VIEW_CALL_BACK_TYPE,         ///< call back type
+        R_APUI_VIEW_CALL_BACK_NUMBER,       ///< call back number
+        R_APUI_VIEW_ENABLE_PPP_COMP,        ///< Enable PPP compression
+        R_APUI_VIEW_USE_LOGIN_SCRIPT,       ///< Use login script
+        R_APUI_VIEW_LOGIN_SCRIPT,           ///< The login script
+        R_APUI_VIEW_MODEM_INIT_STRING,      ///< Modem init string
+        R_APUI_VIEW_WAP_GW_IP_ADDR,         ///< Wap Gateway IP address
+        R_APUI_VIEW_WTLS_SECURITY,          ///< WTLS Security
+        R_APUI_VIEW_CONNECTION_TYPE         ///< Connection type
+        },
+        {
+        0,                                  ///< Phone IP addr.
+        0,                                  ///< Primary Name server
+        0,                                  ///< Secondary Name server
+        0,                                  ///< Proxy server address
+        0,                                  ///< Proxy port number
+        0,                                  ///< use callback
+        0,                                  ///< call back type
+        0,                                  ///< call back number
+        0,                                  ///< Enable PPP compression
+        0,                                  ///< Use login script
+        0,                                  ///< The login script
+        0,                                  ///< Modem init string
+        0,                                  ///< Wap Gateway IP address
+        0,                                  ///< WTLS Security
+        0                                   ///< Connection type
+        }
+    };
+
+
+
+
+
+
+//----------------------------------------------------------
+// Normal settings, no flags defined
+//----------------------------------------------------------
+//
+const TInt Fields_GPRS[3][8] =
+    {
+        {
+        EApWapAccessPointName,      ///< Connection name
+        EApWapCurrentBearer,        ///< Bearer type
+
+        EApGprsAccessPointName,     ///< Access Point Name
+        EApIspIfAuthName,           // username
+        EApIspPromptForLogin,       ///< prompt password
+        EApIspIfAuthPass,           // password
+        EApGprsDisablePlainTextAuth,///< password authentication
+        EApWapStartPage             ///< Starting Page
+        },
+        {
+        R_APUI_VIEW_CONNECTION_NAME,        ///< Connection name
+        R_APUI_VIEW_BEARER_TYPE,            ///< Bearer type
+        R_APUI_VIEW_AP_NAME,                ///< Access Point Name
+        R_APUI_VIEW_USER_NAME,              ///< username
+        R_APUI_VIEW_PROMPT_PASSWORD,        ///< prompt password
+        R_APUI_VIEW_PASSWORD,               ///< password
+        R_APUI_VIEW_PASSWORD_AUTH,          ///< password authentication
+        R_APUI_VIEW_STARTING_PAGE           ///< Starting Page
+        },
+        {
+        1,                                  ///< Connection name
+        0,                                  ///< Bearer type
+        0,                                  ///< Access Point Name
+        0,                                  ///< username
+        0,                                  ///< prompt password
+        0,                                  ///< password
+        0,                                  ///< password authentication
+        0                                   ///< Starting Page
+        }
+    };
+
+
+
+const TInt Fields_GPRS_Advanced[3][5] =
+    {
+        {
+        EApIspIPAddr,               ///< Phone IP addr.
+        EApGprsIPNameServer1,       ///< Primary Name server
+        EApGprsIPNameServer2,       ///< Secondary Name server
+        EApProxyServerAddress,      ///< Proxy server address
+        EApProxyPortNumber          ///< Proxy port number
+        },
+        {
+        R_APUI_VIEW_PHONE_IP_ADDR,          ///< Phone IP addr.
+        R_APUI_VIEW_PRIMARY_NAME_SERVER,    ///< Primary Name server
+        R_APUI_VIEW_SECONDARY_NAME_SERVER,  ///< Secondary Name server
+        R_APUI_VIEW_PROXY_SERVER_ADDR,      ///< Proxy server address
+        R_APUI_VIEW_PROXY_PORT_NUMBER       ///< Proxy port number
+        },
+        {
+        0,                                  ///< Phone IP addr.
+        0,                                  ///< Primary Name server
+        0,                                  ///< Secondary Name server
+        0,                                  ///< Proxy server address
+        0                                   ///< Proxy port number
+        }
+    };
+
+
+
+const TInt Fields_CSD[3][10] =
+    {
+        {
+        EApWapAccessPointName,          ///< Connection name
+        EApWapCurrentBearer,            ///< Bearer type
+
+        EApIspDefaultTelNumber,         ///< Access Number
+        EApIspIfAuthName,               // username
+        EApIspPromptForLogin,           ///< prompt password
+        EApIspIfAuthPass,               // password
+        EApGprsDisablePlainTextAuth,    ///< password authentication
+        EApWapStartPage,                ///< Starting Page
+        EApIspBearerCallTypeIsdn,       ///< Data call type 
+                                        ///< (analogue/ISDN110/ISDN120)
+        EApIspBearerSpeed               ///< Max. connection speed
+        },
+        {
+        R_APUI_VIEW_CONNECTION_NAME,        ///< Connection name
+        R_APUI_VIEW_BEARER_TYPE,            ///< Bearer type
+        R_APUI_VIEW_ACCESS_NUMBER,          ///< Access Number
+        R_APUI_VIEW_USER_NAME,              ///< username
+        R_APUI_VIEW_PROMPT_PASSWORD,        ///< prompt password
+        R_APUI_VIEW_PASSWORD,               ///< password
+        R_APUI_VIEW_PASSWORD_AUTH,          ///< password authentication
+        R_APUI_VIEW_STARTING_PAGE,          ///< Starting Page
+        R_APUI_VIEW_DATA_CALL_TYPE,         ///< Data call type 
+                                            ///< (analogue/ISDN)
+        R_APUI_VIEW_MAX_CONN_SPEED          ///< Max. connection speed
+        },
+        {
+        1,                                  ///< Connection name
+        0,                                  ///< Bearer type
+        1,                                  ///< Access Number
+        0,                                  ///< username
+        0,                                  ///< prompt password
+        0,                                  ///< password
+        0,                                  ///< password authentication
+        0,                                  ///< Starting Page
+        0,                                  ///< Data call type (analogue/ISDN)
+        0                                   ///< Max. connection speed
+        }
+    };
+
+
+
+const TInt Fields_CSD_Advanced[3][12] =
+    {
+        {
+        EApIspIPAddr,               ///< Phone IP addr.
+        EApGprsIPNameServer1,       ///< Primary Name server
+        EApGprsIPNameServer2,       ///< Secondary Name server
+        EApProxyServerAddress,      ///< Proxy server address
+        EApProxyPortNumber,         ///< Proxy port number
+        EApIspIfCallbackEnabled,    ///< use callback
+        EApIspIfCallbackType,       ///< call back type
+        EApIspIfCallbackInfo,       ///< call back number
+        EApIspEnableSWCompression,  ///< Enable SW compression
+        EApIspUseLoginScript,       ///< Use login script
+        EApIspLoginScript,          ///< The login script
+        EApIspInitString            ///< Modem init string
+        },
+        {
+        R_APUI_VIEW_PHONE_IP_ADDR,          ///< Phone IP addr.
+        R_APUI_VIEW_PRIMARY_NAME_SERVER,    ///< Primary Name server
+        R_APUI_VIEW_SECONDARY_NAME_SERVER,  ///< Secondary Name server
+        R_APUI_VIEW_PROXY_SERVER_ADDR,      ///< Proxy server address
+        R_APUI_VIEW_PROXY_PORT_NUMBER,      ///< Proxy port number
+        R_APUI_VIEW_USE_CALL_BACK,          ///< use callback
+        R_APUI_VIEW_CALL_BACK_TYPE,         ///< call back type
+        R_APUI_VIEW_CALL_BACK_NUMBER,       ///< call back number
+        R_APUI_VIEW_ENABLE_PPP_COMP,        ///< Enable PPP compression
+        R_APUI_VIEW_USE_LOGIN_SCRIPT,       ///< Use login script
+        R_APUI_VIEW_LOGIN_SCRIPT,           ///< The login script
+        R_APUI_VIEW_MODEM_INIT_STRING       ///< Modem init string
+        },
+        {
+        0,                                  ///< Phone IP addr.
+        0,                                  ///< Primary Name server
+        0,                                  ///< Secondary Name server
+        0,                                  ///< Proxy server address
+        0,                                  ///< Proxy port number
+        0,                                  ///< use callback
+        0,                                  ///< call back type
+        0,                                  ///< call back number
+        0,                                  ///< Enable PPP compression
+        0,                                  ///< Use login script
+        0,                                  ///< The login script
+        0                                   ///< Modem init string
+        }
+    };
+
+
+
+
+
+
+
+
+
+
+
+
+//----------------------------------------------------------
+// Settings with the KWSPSettingsVisible flag defined
+// AND IPv6 Support enabled
+//----------------------------------------------------------
+//
+const TInt Fields_GPRS_WSP_IPv6[3][8] =
+    {
+        {
+        EApWapAccessPointName,      ///< Connection name
+        EApWapCurrentBearer,        ///< Bearer type
+
+        EApGprsAccessPointName,     ///< Access Point Name
+        EApIspIfAuthName,           // username
+        EApIspPromptForLogin,       ///< prompt password
+        EApIspIfAuthPass,           // password
+        EApGprsDisablePlainTextAuth,///< password authentication
+        EApWapStartPage             ///< Starting Page
+        },
+        {
+        R_APUI_VIEW_CONNECTION_NAME,        ///< Connection name
+        R_APUI_VIEW_BEARER_TYPE,            ///< Bearer type
+        R_APUI_VIEW_AP_NAME,                ///< Access Point Name
+        R_APUI_VIEW_USER_NAME,              ///< username
+        R_APUI_VIEW_PROMPT_PASSWORD,        ///< prompt password
+        R_APUI_VIEW_PASSWORD,               ///< password
+        R_APUI_VIEW_PASSWORD_AUTH,          ///< password authentication
+        R_APUI_VIEW_STARTING_PAGE           ///< Starting Page
+        },
+        {
+        1,                                  ///< Connection name
+        0,                                  ///< Bearer type
+        0,                                  ///< Access Point Name
+        0,                                  ///< username
+        0,                                  ///< prompt password
+        0,                                  ///< password
+        0,                                  ///< password authentication
+        0                                   ///< Starting Page
+        }
+    };
+
+
+
+const TInt Fields_GPRS_Advanced_WSP_IPv6[3][8] =
+    {
+        {
+        EApGprsPdpType,             ///< PDP type, IPv4 or IPv6
+        EApIspIPAddr,               ///< Phone IP addr.
+        EApIP6DNSAddrFromServer,    ///< Domain name servers
+        EApProxyServerAddress,      ///< Proxy server address
+        EApProxyPortNumber,         ///< Proxy port number
+        EApWapGatewayAddress,       ///< Wap Gateway IP address
+        EApWapSecurity,             ///< WTLS Security
+        EApWapWspOption             ///< Connection type
+        },
+        {
+        R_APUI_VIEW_PDP_TYPE,               ///< PDP type, IPv4 or IPv6
+        R_APUI_VIEW_PHONE_IP_ADDR,          ///< Phone IP addr.
+        R_APUI_VIEW_SET_DNS_SERVERS_IP,     ///< Domain name servers
+        R_APUI_VIEW_PROXY_SERVER_ADDR,      ///< Proxy server address
+        R_APUI_VIEW_PROXY_PORT_NUMBER,      ///< Proxy port number
+        R_APUI_VIEW_WAP_GW_IP_ADDR,         ///< Wap Gateway IP address
+        R_APUI_VIEW_WTLS_SECURITY,          ///< WTLS Security
+        R_APUI_VIEW_CONNECTION_TYPE         ///< Connection type
+        },
+        {
+        0,                                  ///< PDP type, IPv4 or IPv6
+        0,                                  ///< Phone IP addr.
+        0,                                  ///< Domain name servers
+        0,                                  ///< Proxy server address
+        0,                                  ///< Proxy port number
+        0,                                  ///< Wap Gateway IP address
+        0,                                  ///< WTLS Security
+        0                                   ///< Connection type
+        }
+    };
+
+
+
+
+const TInt Fields_CSD_WSP_IPv6[3][10] =
+    {
+        {
+        EApWapAccessPointName,          ///< Connection name
+        EApWapCurrentBearer,            ///< Bearer type
+
+        EApIspDefaultTelNumber,         ///< Access Number
+        EApIspIfAuthName,               // username
+        EApIspPromptForLogin,           ///< prompt password
+        EApIspIfAuthPass,               // password
+        EApGprsDisablePlainTextAuth,    ///< password authentication
+        EApWapStartPage,                ///< Starting Page
+        EApIspBearerCallTypeIsdn,       ///< Data call type 
+                                        ///< (analogue/ISDN110/ISDN120)
+        EApIspBearerSpeed               ///< Max. connection speed
+        },
+        {
+        R_APUI_VIEW_CONNECTION_NAME,        ///< Connection name
+        R_APUI_VIEW_BEARER_TYPE,            ///< Bearer type
+        R_APUI_VIEW_ACCESS_NUMBER,          ///< Access Number
+        R_APUI_VIEW_USER_NAME,              ///< username
+        R_APUI_VIEW_PROMPT_PASSWORD,        ///< prompt password
+        R_APUI_VIEW_PASSWORD,               ///< password
+        R_APUI_VIEW_PASSWORD_AUTH,          ///< password authentication
+        R_APUI_VIEW_STARTING_PAGE,          ///< Starting Page
+        R_APUI_VIEW_DATA_CALL_TYPE,         ///< Data call type (analogue/ISDN)
+        R_APUI_VIEW_MAX_CONN_SPEED          ///< Max. connection speed
+        },
+        {
+        1,                                  ///< Connection name
+        0,                                  ///< Bearer type
+        1,                                  ///< Access Number
+        0,                                  ///< username
+        0,                                  ///< prompt password
+        0,                                  ///< password
+        0,                                  ///< password authentication
+        0,                                  ///< Starting Page
+        0,                                  ///< Data call type (analogue/ISDN)
+        0                                   ///< Max. connection speed
+        }
+    };
+
+
+const TInt Fields_CSD_Advanced_WSP_IPv6[3][14] =
+    {
+        {
+        EApIpv4Settings,                ///< Ipv4 Settings
+        EApIpv6Settings,                ///< Ipv6 Settings
+        EApProxyServerAddress,          ///< Proxy server address
+        EApProxyPortNumber,             ///< Proxy port number
+        EApIspIfCallbackEnabled,        ///< use callback
+        EApIspIfCallbackType,           ///< call back type
+        EApIspIfCallbackInfo,           ///< call back number
+        EApIspEnableSWCompression,      ///< Enable SW compression
+        EApIspUseLoginScript,           ///< Use login script
+        EApIspLoginScript,              ///< The login script
+        EApIspInitString,               ///< Modem init string
+        EApWapGatewayAddress,           ///< Wap Gateway IP address
+        EApWapSecurity,                 ///< WTLS Security
+        EApWapWspOption                 ///< Connection type
+        },
+        {
+        R_APUI_VIEW_IPV4_SETTINGS,          ///< Ipv4 Settings
+        R_APUI_VIEW_IPV6_SETTINGS,          ///< Ipv6 Settings
+        R_APUI_VIEW_PROXY_SERVER_ADDR,      ///< Proxy server address
+        R_APUI_VIEW_PROXY_PORT_NUMBER,      ///< Proxy port number
+        R_APUI_VIEW_USE_CALL_BACK,          ///< use callback
+        R_APUI_VIEW_CALL_BACK_TYPE,         ///< call back type
+        R_APUI_VIEW_CALL_BACK_NUMBER,       ///< call back number
+        R_APUI_VIEW_ENABLE_PPP_COMP,        ///< Enable PPP compression
+        R_APUI_VIEW_USE_LOGIN_SCRIPT,       ///< Use login script
+        R_APUI_VIEW_LOGIN_SCRIPT,           ///< The login script
+        R_APUI_VIEW_MODEM_INIT_STRING,      ///< Modem init string
+        R_APUI_VIEW_WAP_GW_IP_ADDR,         ///< Wap Gateway IP address
+        R_APUI_VIEW_WTLS_SECURITY,          ///< WTLS Security
+        R_APUI_VIEW_CONNECTION_TYPE         ///< Connection type
+        },
+        {
+        0,                                  ///< Ipv4 Settings
+        0,                                  ///< Ipv6 Settings
+        0,                                  ///< Proxy server address
+        0,                                  ///< Proxy port number
+        0,                                  ///< use callback
+        0,                                  ///< call back type
+        0,                                  ///< call back number
+        0,                                  ///< Enable PPP compression
+        0,                                  ///< Use login script
+        0,                                  ///< The login script
+        0,                                  ///< Modem init string
+        0,                                  ///< Wap Gateway IP address
+        0,                                  ///< WTLS Security
+        0                                   ///< Connection type
+        }
+    };
+
+
+
+
+
+
+
+
+
+//----------------------------------------------------------
+// Normal settings, only Ipv6 defined
+//----------------------------------------------------------
+//
+const TInt Fields_GPRS_IPv6[3][8] =
+    {
+        {
+        EApWapAccessPointName,      ///< Connection name
+        EApWapCurrentBearer,        ///< Bearer type
+
+        EApGprsAccessPointName,     ///< Access Point Name
+        EApIspIfAuthName,           // username
+        EApIspPromptForLogin,       ///< prompt password
+        EApIspIfAuthPass,           // password
+        EApGprsDisablePlainTextAuth,///< password authentication
+        EApWapStartPage             ///< Starting Page
+        },
+        {
+        R_APUI_VIEW_CONNECTION_NAME,        ///< Connection name
+        R_APUI_VIEW_BEARER_TYPE,            ///< Bearer type
+        R_APUI_VIEW_AP_NAME,                ///< Access Point Name
+        R_APUI_VIEW_USER_NAME,              ///< username
+        R_APUI_VIEW_PROMPT_PASSWORD,        ///< prompt password
+        R_APUI_VIEW_PASSWORD,               ///< password
+        R_APUI_VIEW_PASSWORD_AUTH,          ///< password authentication
+        R_APUI_VIEW_STARTING_PAGE           ///< Starting Page
+        },
+        {
+        1,                                  ///< Connection name
+        0,                                  ///< Bearer type
+        0,                                  ///< Access Point Name
+        0,                                  ///< username
+        0,                                  ///< prompt password
+        0,                                  ///< password
+        0,                                  ///< password authentication
+        0                                   ///< Starting Page
+        }
+    };
+
+
+
+const TInt Fields_GPRS_Advanced_IPv6[3][5] =
+    {
+        {
+        EApGprsPdpType,                     ///< PDP type, IPv4 or IPv6
+        EApIspIPAddr,                       ///< Phone IP addr.
+        EApIP6DNSAddrFromServer,            ///< Domain name servers
+        EApProxyServerAddress,              ///< Proxy server address
+        EApProxyPortNumber                  ///< Proxy port number
+        },
+        {
+        R_APUI_VIEW_PDP_TYPE,               ///< PDP type, IPv4 or IPv6
+        R_APUI_VIEW_PHONE_IP_ADDR,          ///< Phone IP addr.
+        R_APUI_VIEW_SET_DNS_SERVERS_IP,     ///< Domain name servers        
+        R_APUI_VIEW_PROXY_SERVER_ADDR,      ///< Proxy server address
+        R_APUI_VIEW_PROXY_PORT_NUMBER       ///< Proxy port number
+        },
+        {
+        0,                                  ///< PDP type, IPv4 or IPv6
+        0,                                  ///< Phone IP addr.
+        0,                                  ///< Domain name servers
+        0,                                  ///< Proxy server address
+        0                                   ///< Proxy port number
+        }
+    };
+
+
+
+const TInt Fields_CSD_IPv6[3][10] =
+    {
+        {
+        EApWapAccessPointName,              ///< Connection name
+        EApWapCurrentBearer,                ///< Bearer type
+
+        EApIspDefaultTelNumber,             ///< Access Number
+        EApIspIfAuthName,                   ///< username
+        EApIspPromptForLogin,               ///< prompt password
+        EApIspIfAuthPass,                   ///< password
+        EApGprsDisablePlainTextAuth,        ///< password authentication
+        EApWapStartPage,                    ///< Starting Page
+        EApIspBearerCallTypeIsdn,           ///< Data call type 
+                                            ///< (analogue/ISDN110/ISDN120)
+        EApIspBearerSpeed                   ///< Max. connection speed
+        },
+        {
+        R_APUI_VIEW_CONNECTION_NAME,        ///< Connection name
+        R_APUI_VIEW_BEARER_TYPE,            ///< Bearer type
+        R_APUI_VIEW_ACCESS_NUMBER,          ///< Access Number
+        R_APUI_VIEW_USER_NAME,              ///< username
+        R_APUI_VIEW_PROMPT_PASSWORD,        ///< prompt password
+        R_APUI_VIEW_PASSWORD,               ///< password
+        R_APUI_VIEW_PASSWORD_AUTH,          ///< password authentication
+        R_APUI_VIEW_STARTING_PAGE,          ///< Starting Page
+        R_APUI_VIEW_DATA_CALL_TYPE,         ///< Data call type (analogue/ISDN)
+        R_APUI_VIEW_MAX_CONN_SPEED          ///< Max. connection speed
+        },
+        {
+        1,                                  ///< Connection name
+        0,                                  ///< Bearer type
+        1,                                  ///< Access Number
+        0,                                  ///< username
+        0,                                  ///< prompt password
+        0,                                  ///< password
+        0,                                  ///< password authentication
+        0,                                  ///< Starting Page
+        0,                                  ///< Data call type (analogue/ISDN)
+        0                                   ///< Max. connection speed
+        }
+    };
+
+
+
+const TInt Fields_CSD_Advanced_IPv6[3][11] =
+    {
+        {
+        EApIpv4Settings,                    ///< Ipv4 Settings
+        EApIpv6Settings,                    ///< Ipv6 Settings
+        EApProxyServerAddress,              ///< Proxy server address
+        EApProxyPortNumber,                 ///< Proxy port number
+        EApIspIfCallbackEnabled,            ///< use callback
+        EApIspIfCallbackType,               ///< call back type
+        EApIspIfCallbackInfo,               ///< call back number
+        EApIspEnableSWCompression,          ///< Enable SW compression
+        EApIspUseLoginScript,               ///< Use login script
+        EApIspLoginScript,                  ///< The login script
+        EApIspInitString                    ///< Modem init string
+        },
+        {
+        R_APUI_VIEW_IPV4_SETTINGS,          ///< Ipv4 Settings
+        R_APUI_VIEW_IPV6_SETTINGS,          ///< Ipv6 Settings
+        R_APUI_VIEW_PROXY_SERVER_ADDR,      ///< Proxy server address
+        R_APUI_VIEW_PROXY_PORT_NUMBER,      ///< Proxy port number
+        R_APUI_VIEW_USE_CALL_BACK,          ///< use callback
+        R_APUI_VIEW_CALL_BACK_TYPE,         ///< call back type
+        R_APUI_VIEW_CALL_BACK_NUMBER,       ///< call back number
+        R_APUI_VIEW_ENABLE_PPP_COMP,        ///< Enable PPP compression
+        R_APUI_VIEW_USE_LOGIN_SCRIPT,       ///< Use login script
+        R_APUI_VIEW_LOGIN_SCRIPT,           ///< The login script
+        R_APUI_VIEW_MODEM_INIT_STRING       ///< Modem init string
+        },
+        {
+        0,                                  ///< Ipv4 Settings
+        0,                                  ///< Ipv6 Settings
+        0,                                  ///< Proxy server address
+        0,                                  ///< Proxy port number
+        0,                                  ///< use callback
+        0,                                  ///< call back type
+        0,                                  ///< call back number
+        0,                                  ///< Enable PPP compression
+        0,                                  ///< Use login script
+        0,                                  ///< The login script
+        0                                   ///< Modem init string
+        }
+    };
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+const TInt Fields_WLAN_IPv6[3][8] =
+    {
+        {
+        EApWapAccessPointName,              ///< Connection name
+        EApWapCurrentBearer,                ///< Bearer type
+        EApWlanNetworkName,                 ///< The network name
+        EApWlanScanSSID,                    ///< need to scan the SSID?
+        EApWlanNetworkMode,                 ///< Gives network mode
+        EApWlanSecurityMode,                ///< The security mode
+        EApWlanSecuritySettings,            ///< The security settings menu
+        EApWapStartPage                     ///< Starting Page
+        },
+        {
+        R_APUI_VIEW_CONNECTION_NAME,        ///< Connection name
+        R_APUI_VIEW_BEARER_TYPE,            ///< Bearer type
+        R_APUI_VIEW_WLAN_NETWORK_NAME,      ///< The network name
+        R_APUI_VIEW_WLAN_HIDDEN_NETWORK,    ///< need to scan the SSID?
+        R_APUI_VIEW_WLAN_NETWORK_MODE,      ///< The network mode
+        R_APUI_VIEW_WLAN_SECURITY_MODE,     ///< The security mode
+        R_APUI_VIEW_WLAN_SECURITY_SETTINGS, ///< The security settings menu
+        R_APUI_VIEW_STARTING_PAGE           ///< Starting Page
+        },
+        {
+        1,                                  ///< Connection name
+        0,                                  ///< Bearer type
+        1,                                  ///< The network name
+        0,                                  ///< need to scan the SSID
+        0,                                  ///< Gives network mode
+        0,                                  ///< The security mode
+        0,                                  ///< The security settings menu
+        0                                   ///< Starting Page
+        }
+    };
+
+
+
+const TInt Fields_WLAN_Advanced_IPv6[3][5] =
+    {
+        {
+        EApIpv4Settings,                    ///< Ipv4 Settings
+        EApIpv6Settings,                    ///< Ipv6 Settings
+        EApWlanChannelId,                   ///< Ad-hoc channel auto/userdef.
+        EApProxyServerAddress,              ///< Proxy server address
+        EApProxyPortNumber                  ///< Proxy port number
+        },
+        {
+        R_APUI_VIEW_IPV4_SETTINGS,          ///< Ipv4 Settings
+        R_APUI_VIEW_IPV6_SETTINGS,          ///< Ipv6 Settings
+        R_APUI_VIEW_AD_HOC,                  ///< Ad-hoc channel auto/userdef.
+        R_APUI_VIEW_PROXY_SERVER_ADDR,      ///< Proxy server address
+        R_APUI_VIEW_PROXY_PORT_NUMBER       ///< Proxy port number
+        },
+        {
+        0,                                  ///< Ipv4 Settings
+        0,                                  ///< Ipv6 Settings
+        0,                                  ///< Ad-hoc channel auto/userdef.
+        0,                                  ///< Proxy server address
+        0                                   ///< Proxy port number
+        }
+    };
+
+
+
+
+const TInt Fields_WLAN_IPv4[3][8] =
+    {
+        {
+        EApWapAccessPointName,              ///< Connection name
+        EApWapCurrentBearer,                ///< Bearer type
+        EApWlanNetworkName,                 ///< The network name
+        EApWlanScanSSID,                    ///< need to scan the SSID?        
+        EApWlanNetworkMode,                 ///< Gives network mode
+        EApWlanSecurityMode,                ///< The security mode
+        EApWlanSecuritySettings,            ///< The security settings menu
+        EApWapStartPage                     ///< Starting Page
+        },
+        {
+        R_APUI_VIEW_CONNECTION_NAME,        ///< Connection name
+        R_APUI_VIEW_BEARER_TYPE,            ///< Bearer type
+        R_APUI_VIEW_WLAN_NETWORK_NAME,      ///< The network name
+        R_APUI_VIEW_WLAN_HIDDEN_NETWORK,    ///< need to scan the SSID?        
+        R_APUI_VIEW_WLAN_NETWORK_MODE,      ///< The network mode
+        R_APUI_VIEW_WLAN_SECURITY_MODE,     ///< The security mode
+        R_APUI_VIEW_WLAN_SECURITY_SETTINGS, ///< The security settings menu
+        R_APUI_VIEW_STARTING_PAGE           ///< Starting Page
+        },
+        {
+        1,                                  ///< Connection name
+        0,                                  ///< Bearer type
+        1,                                  ///< The network name
+        0,                                  ///< need to scan the SSID
+        0,                                  ///< Gives network mode
+        0,                                  ///< The security mode
+        0,                                  ///< The security settings menu
+        0                                   ///< Starting Page
+        }
+    };
+
+
+const TInt Fields_WLAN_Advanced_IPv4[3][8] =
+    {
+        {
+        EApIspIPAddr,               ///< Phone IP addr.
+        EApIspIPNetMask,            ///< Subnet mask
+        EApIspIPGateway,            ///< IP address of gateway
+        EApGprsIPNameServer1,       ///< Primary Name server
+        EApGprsIPNameServer2,       ///< Secondary Name server
+        EApWlanChannelId,           ///< Ad-hoc channel auto/userdef.
+        EApProxyServerAddress,      ///< Proxy server address
+        EApProxyPortNumber          ///< Proxy port number
+        },
+        {
+        R_APUI_VIEW_PHONE_IP_ADDR,          ///< Phone IP addr.
+        R_APUI_NETMASK,                     ///< Subnet mask
+        R_APUI_IP_GATEWAY,                  ///< IP address of gateway        
+        R_APUI_VIEW_PRIMARY_NAME_SERVER,    ///< Primary Name server
+        R_APUI_VIEW_SECONDARY_NAME_SERVER,  ///< Secondary Name server
+        R_APUI_VIEW_AD_HOC,                  ///< Ad-hoc channel auto/userdef.
+        R_APUI_VIEW_PROXY_SERVER_ADDR,      ///< Proxy server address
+        R_APUI_VIEW_PROXY_PORT_NUMBER       ///< Proxy port number
+        },
+        {
+        0,                                  ///< Phone IP addr.
+        1,                                  ///< Subnet mask
+        1,                                  ///< IP address of gateway
+        0,                                  ///< Primary Name server
+        0,                                  ///< Secondary Name server
+        0,                                  ///< Ad-hoc channel auto/userdef.
+        0,                                  ///< Proxy server address
+        0                                   ///< Proxy port number
+        }
+    };
+    
+    
+    
+const TInt Fields_WLAN_L2_IPv4[3][4] =
+    {
+        {
+        EApIspIPAddr,                       ///< Phone IP addr.
+        EApIspIPNetMask,                    ///< Subnet mask
+        EApIspIPGateway,                    ///< IP address of gateway        
+        EApIP6DNSAddrFromServer             ///< Domain name servers
+        },
+        {
+        R_APUI_VIEW_PHONE_IP_ADDR,          ///< Phone IP addr.
+        R_APUI_NETMASK,                     ///< Subnet mask
+        R_APUI_IP_GATEWAY,                  ///< IP address of gateway
+        R_APUI_VIEW_SET_DNS_SERVERS_IP      ///< Domain name servers
+        },
+        {
+        0,                                  ///< Phone IP addr.
+        1,                                  ///< Subnet mask
+        1,                                  ///< IP address of gateway
+        0                                   ///< Domain name servers
+        }
+    };
+
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/inc/ApSettingsModel.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,703 @@
+/*
+* Copyright (c) 2002 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 CApSettingsModel.
+*
+*/
+
+
+#ifndef APSETTINGS_MODEL_H
+#define APSETTINGS_MODEL_H
+
+// INCLUDE FILES
+#include <ApDataHandler.h>
+#include <ApUtils.h>
+#include <ApSelect.h>
+
+#include <ApSettingsHandlerCommons.h>
+
+#include <ApProtHandler.h> //for protection of settings
+
+
+// FORWARD DECLARATION
+class CActiveApDb;
+class CApListItem;
+class CApListItemList;
+class CApAccessPointItem;
+class CApDataHandler;
+class CApSelect;
+class CAknWaitDialog;
+class CApSettingsDeleteOperation;
+class CApNetworkItemList;
+class CFeatureManagerWrapper;
+class CVpnApEngine;
+class CEikonEnv;
+
+class CWEPSecuritySettings;
+class CWEPSecuritySettingsUi;
+
+class CWPASecuritySettings;
+class CWPASecuritySettingsUi;
+
+
+
+/**
+* A structure to hold filtering parameters
+* First, it is possible to specify which ISP-type we are looking for. 
+* The possible values are:
+* <br>
+* KEApIspTypeInternetOnly:  Filter allows only access points that are 
+*                           capable of only internet access.
+* <br>
+* KEApIspTypeWAPOnly:       Filter allows only access points that are 
+*                           capable of only WAP access.
+* <br>
+* KEApIspTypeInternetAndWAP:Filter allows only access points that are 
+*                           capable of internet AND WAP access.
+* <br>
+* KEApIspTypeWAPMandatory:  Filter allows only access points that are 
+*                           capable of WAP access AND contain mandatory
+*                           WAP settings.
+* <br>
+* KEApIspTypeAll:           No filtering is done for the isp-type, 
+*                           all types of access points are shown.
+* <br>
+* It is possible to combine them by simply adding/or-ing together the values,
+* filtering will be done in such a way that only access points with the 
+* listed ISP-types will be shown.
+* Second filtering possibility (aBearerFilter) is the desired bearer type.
+* The possible values are the values of the TApBearerType enum type and their 
+* combinations, as in case of the ISP type.
+* The ordering of the list can be specified with the aSortType parameter. 
+* It can have the following values:
+* KEApSortUidAscending:     The sorting is done according to the ID 
+*                           of the access points in ascending order.
+* KEApSortUidDescending:    The sorting is done according to the ID 
+*                           of the access points in descending order.
+* KEApSortNameAscending:    The sorting is done according to the name 
+*                           of the access points in ascending order.
+* KEApSortNameDescending:   The sorting is done according to the name 
+*                           of the access points in descending order.
+*/
+typedef struct
+    {
+        TInt                iIspFilter;
+        TInt                iBearerFilter;
+        TInt                iSortType;
+    }TApSettingsParams;
+
+
+
+
+
+
+
+// CLASS DECLARATION
+
+/**
+* Model for the access point settings ui.
+*/
+NONSHARABLE_CLASS( CApSettingsModel ) : public CBase
+    {
+    public:     // Construct / destruct
+
+        /**
+        * Two-phased constructor. Leaves on failure.
+        * The following three parameters specify the filtering and ordering 
+        * criteria for the selection list creation. First, it is possible to 
+        * specify which ISP-type we are looking for. The possible values are:
+        * <br>
+        * KEApIspTypeInternetOnly:  Filter allows only access points that are
+        *                           capable of only internet access.
+        * <br>
+        * KEApIspTypeWAPOnly:       Filter allows only access points that are 
+        *                           capable of only WAP access.
+        * <br>
+        * KEApIspTypeInternetAndWAP:Filter allows only access points that are
+        *                           capable of internet AND WAP access.
+        * <br>
+        * KEApIspTypeWAPMandatory:  Filter allows only access points that are 
+        *                           capable of WAP access AND contain 
+        *                           mandatory WAP settings.
+        * <br>
+        * KEApIspTypeAll:           No filtering is done for the isp-type, all
+        *                           types of access points are shown.
+        * <br>
+        * It is possible to combine them by simply adding/or-ing together the 
+        * values, filtering will be done in such a way that only access points 
+        * with the listed ISP-types will be shown.
+        * Second filtering possibility (aBearerFilter) is the desired bearer 
+        * type. The possible values are the values of the TApBearerType enum 
+        * type and their combinations, as in case of the ISP type.
+        * The ordering of the list can be specified with the aSortType 
+        * parameter. It can have the following values:
+        * KEApSortUidAscending:     The sorting is done according to the ID 
+        *                           of the access points in ascending order.
+        * KEApSortUidDescending:    The sorting is done according to the ID 
+        *                           of the access points in descending order.
+        * KEApSortNameAscending:    The sorting is done according to the name 
+        *                           of the access points in ascending order.
+        * KEApSortNameDescending:   The sorting is done according to the name 
+        *                           of the access points in descending order.
+        * Caution! The ordering values can not be combined!
+        * @param aIspTypeFilter Filtering criteria on ISP type
+        * @param aBearerFilter Filtering criteria on bearer type
+        * @param aSortType Specifies the sort order to use.
+        * @param aReqIpvType Specifies whether the caller would like to 
+        *   have IPv4, IPv6 or both access points. If it is IPv6 or Both, 
+        *   in case of IPv6 support is available as a feature, it will be 
+        *   supported. If IPv6 feature is not supported by the phone, it 
+        *   simply defaults to the normal IPv4 version.
+        *   If it is IPv4, it uses the default IPv4 version independently 
+        *   from IPv6 feature beeing available or not.
+        * @param aVpnFilterType a TVpnFilterType representing the possible 
+        *   additional VPN filtering.
+        * @param aVariant The local variant value
+        * @param aIncludeEasyWlan a TBool indicating whether to include the
+        *   EasyWlan AP in the list or not
+        * @param aNoEdit Gives wether editing is allowed or not
+        * @return The constructed listbox.
+        */
+        static CApSettingsModel* NewL(
+                                      TInt aIspFilter,
+                                      TInt aBearerFilter,
+                                      TInt aSortType,
+                                      TInt aReqIpvType,
+                                      TVpnFilterType aVpnFilterType,
+                                      TInt aVariant,
+                                      TBool aIncludeEasyWlan,
+                                      TBool aNoEdit
+                                     );
+
+
+        /**
+        * Two-phased constructor. Leaves on failure.
+        * The following three parameters specify the filtering and ordering 
+        * criteria for the selection list creation. First, it is possible to 
+        * specify which ISP-type we are looking for. The possible values are:
+        * <br>
+        * KEApIspTypeInternetOnly:  Filter allows only access points that are
+        *                           capable of only internet access.
+        * <br>
+        * KEApIspTypeWAPOnly:       Filter allows only access points that are 
+        *                           capable of only WAP access.
+        * <br>
+        * KEApIspTypeInternetAndWAP:Filter allows only access points that are
+        *                           capable of internet AND WAP access.
+        * <br>
+        * KEApIspTypeWAPMandatory:  Filter allows only access points that are 
+        *                           capable of WAP access AND contain 
+        *                           mandatory WAP settings.
+        * <br>
+        * KEApIspTypeAll:           No filtering is done for the isp-type, all
+        *                           types of access points are shown.
+        * <br>
+        * It is possible to combine them by simply adding/or-ing together the 
+        * values, filtering will be done in such a way that only access points 
+        * with the listed ISP-types will be shown.
+        * Second filtering possibility (aBearerFilter) is the desired bearer 
+        * type. The possible values are the values of the TApBearerType enum 
+        * type and their combinations, as in case of the ISP type.
+        * The ordering of the list can be specified with the aSortType 
+        * parameter. It can have the following values:
+        * KEApSortUidAscending:     The sorting is done according to the ID 
+        *                           of the access points in ascending order.
+        * KEApSortUidDescending:    The sorting is done according to the ID 
+        *                           of the access points in descending order.
+        * KEApSortNameAscending:    The sorting is done according to the name 
+        *                           of the access points in ascending order.
+        * KEApSortNameDescending:   The sorting is done according to the name 
+        *                           of the access points in descending order.
+        * Caution! The ordering values can not be combined!
+        * @param aDb The database to work on
+        * @param aIspTypeFilter Filtering criteria on ISP type
+        * @param aBearerFilter Filtering criteria on bearer type
+        * @param aSortType Specifies the sort order to use.
+        * @param aReqIpvType Specifies whether the caller would like to 
+        *   have IPv4, IPv6 or both access points. If it is IPv6 or Both, 
+        *   in case of IPv6 support is available as a feature, it will be 
+        *   supported. If IPv6 feature is not supported by the phone, it 
+        *   simply defaults to the normal IPv4 version.
+        *   If it is IPv4, it uses the default IPv4 version independently 
+        *   from IPv6 feature beeing available or not.
+        * @param aVpnFilterType a TVpnFilterType representing the possible 
+        *   additional VPN filtering.
+        * @param aVariant The local variant value
+        * @param aIncludeEasyWlan a TBool indicating whether to include the
+        *   EasyWlan AP in the list or not
+        * @param aNoEdit Gives wether editing is allowed or not        
+        * @return The constructed listbox model.
+        */
+        static CApSettingsModel* NewL(
+                                      CActiveApDb& aDb,
+                                      TInt aIspFilter,
+                                      TInt aBearerFilter,
+                                      TInt aSortType,
+                                      TInt aReqIpvType,
+                                      TVpnFilterType aVpnFilterType,
+                                      TInt aVariant,
+                                      TBool aIncludeEasyWlan,
+                                      TBool aNoEdit
+                                     );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CApSettingsModel();
+
+
+    protected:
+        /**
+        * Constructor.
+        * @param aIspTypeFilter Filtering criteria on ISP type
+        * @param aBearerFilter Filtering criteria on bearer type
+        * @param aSortType Specifies the sort order to use.
+        * @param aReqIpvType Specifies whether the caller would like to 
+        *   have IPv4, IPv6 or both access points. If it is IPv6 or Both, 
+        *   in case of IPv6 support is available as a feature, it will be 
+        *   supported. If IPv6 feature is not supported by the phone, it 
+        *   simply defaults to the normal IPv4 version.
+        *   If it is IPv4, it uses the default IPv4 version independently 
+        *   from IPv6 feature beeing available or not.
+        * @param aVariant   The variant
+        * @param aVpnFilterType a TVpnFilterType representing the possible 
+        *   additional VPN filtering.
+        * @param aVariant The local variant value
+        * @param aIncludeEasyWlan a TBool indicating whether to include the
+        *   EasyWlan AP in the list or not
+        * @param aNoEdit Gives wether editing is allowed or not
+        */
+        CApSettingsModel(
+                        TInt aIspFilter,
+                        TInt aBearerFilter,
+                        TInt aSortType,
+                        TInt aReqIpvType,
+                        TInt aVariant,
+                        TVpnFilterType aVpnFilterType,
+                        TBool aIncludeEasyWlan,
+                        TBool aNoEdit
+                        );
+
+
+        /**
+        * Second phase constructor. Leaves on failure.
+        * @param aDb Database to use if any, NULL otherwise.
+        */
+        virtual void ConstructL( CActiveApDb* aDb );
+
+
+    public:
+        /**
+        * Returns the database object
+        */
+        CActiveApDb*     Database();
+
+
+        /**
+        * Gets the APs corresponding to the filtering criteria,
+        * already ordered.
+        * @param aFailedLocked a boolean indicating if the operation
+        * had failed because the DB was locked
+        * @param aList a reference to the list of APs.
+        * The passed list will be erased, elements destroyed,
+        * new elements created in it. The list owns the created elements
+        * and the caller maintaines ownership of the list.
+        * @param aIspFilter The isp filter to be used
+        * @param aBearerFilter The bearer filter to be used
+        * @param aSortType The ordering to be used.
+        * @param aReqIpvType Specifies whether the caller would like to 
+        *   have IPv4, IPv6 or both access points. If it is IPv6 or Both, 
+        *   in case of IPv6 support is available as a feature, it will be 
+        *   supported. If IPv6 feature is not supported by the phone, it 
+        *   simply defaults to the normal IPv4 version.
+        *   If it is IPv4, it uses the default IPv4 version independently 
+        *   from IPv6 feature beeing available or not.
+        * @return the number of items in the list.
+        */
+        TInt AllListItemDataL
+                (
+                TBool& aFailedLocked,
+                CApListItemList& aList,
+                TInt aIspFilter,
+                TInt aBearerFilter,
+                TInt aSortType,
+                TInt aReqIpvType
+                );
+
+                
+        /**
+        * Gets the APs corresponding to the filtering criteria,
+        * already ordered.
+        * @param aFailedLocked a boolean indicating if the operation
+        * had failed because the DB was locked
+        * @param aList a reference to the list of APs.
+        * The passed list will be erased, elements destroyed,
+        * new elements created in it. The list owns the created elements
+        * and the caller maintaines ownership of the list.
+        * @param aIspFilter The isp filter to be used
+        * @param aBearerFilter The bearer filter to be used
+        * @param aSortType The ordering to be used.
+        * @param aReqIpvType Specifies whether the caller would like to 
+        *   have IPv4, IPv6 or both access points. If it is IPv6 or Both, 
+        *   in case of IPv6 support is available as a feature, it will be 
+        *   supported. If IPv6 feature is not supported by the phone, it 
+        *   simply defaults to the normal IPv4 version.
+        *   If it is IPv4, it uses the default IPv4 version independently 
+        *   from IPv6 feature beeing available or not.        
+        * @param aVpnFilterType
+        * @param aIncludeEasyWlan a TBool indicating whether to include the
+        *   EasyWlan AP in the list or not        
+        * @return the number of items in the list.
+        */
+        TInt AllListItemDataL
+                (
+                TBool& aFailedLocked,
+                CApListItemList& aList,
+                TInt aIspFilter,
+                TInt aBearerFilter,
+                TInt aSortType,
+                TInt aReqIpvType,
+                TVpnFilterType aVpnFilterType,
+                TBool aIncludeEasyWlan
+                );
+
+
+        /**
+        * Gets the APs corresponding to the filtering criteria,
+        * already ordered.
+        * @param aFailedLocked a boolean indicating if the operation
+        * had failed because the DB was locked
+        * @param aList a reference to the list of APs.
+        * The passed list will be erased, elements destroyed,
+        * new elements created in it. The list owns the created elements
+        * and the caller maintaines ownership of the list.
+        * @return the number of items in the list.
+        */
+        TInt AllListItemDataL( TBool& aFailedLocked, CApListItemList& aList );
+
+
+        /**
+        * Reads up one access point data
+        * @param aUid The UID of the access point to read
+        * @param aApItem A reference to a CApAccessPointItem to hold the
+        * access point item readed from the database
+        */
+        void AccessPointDataL( TUint32 aUid, CApAccessPointItem& aApItem );
+
+
+        /**
+        * Updates one access point item in the database
+        * @param aApItem A reference to a CApAccessPointItem holding the
+        * access point item to be updated in the database
+        */
+        TBool UpdateAccessPointDataL( CApAccessPointItem& aApItem );
+
+
+        /**
+        * Returns a pointer to the CApDataHandler object
+        */
+        CApDataHandler* DataHandler();
+
+
+        /**
+        * Returns a pointer to the CApUtils object
+        */
+        CApUtils*   ApUtils();
+
+
+        /**
+        * Sets the filtering parameters for the model
+        * @param aParams The filtering parameters to be used
+        */
+        void SetParams( TApSettingsParams aParams );
+
+
+        /**
+        * Gets the filtering parameters of the model
+        * @return The used filtering parameters
+        */
+        TApSettingsParams Params();
+
+
+        /**
+        * Returns a pointer to the VPN engine object
+        */
+        CVpnApEngine* VpnEngine();
+
+
+        /**
+        * Launches help
+        */
+        void LaunchHelpL();
+
+        /**
+        * Deletes an access point specified by its UID
+        * @param aUid The UID of the access point to delete.
+        */
+        void RemoveApL( TUint32 aUid );
+
+
+        /**
+        * Starts a transaction
+        * @param aWrite A boolean indicating whether read or write lock is
+        * needed.
+        * @param aShowNote A boolean indicating whether to show
+        * 'Cannot access database' note or not if DB is locked
+        * @param aRetry A boolean indicating whether to retry or not
+        * if DB is locked
+        * @param aLFFSChecking Whether low disk space is checked or not
+        * @return TTransactionResult containing whther it is our
+        * own transaction or not or it has failed with KErrLocked
+        */
+        TTransactionResult StartTransactionLC
+                                (
+                                TBool aWrite,
+                                TBool aShowNote = ETrue,
+                                TBool aRetry = ETrue,
+                                TBool aLFFSChecking = ETrue
+                                );
+
+        /**
+        * Gets write lock on the database
+        */
+        void  GetWriteLockL();
+
+
+        /**
+        * Cleanup function for the transaction.
+        * In case of leave, it will be called and
+        * transaction will be rolled back
+        */
+        static void RollbackTransactionOnLeave( TAny* aDb );
+
+
+        /**
+        * Commits the transaction on the database
+        */
+        TInt CommitTransaction();
+
+
+        /**
+        * Check if Disk space goes below critical level if allocating
+        * more disk space.
+        * @param aShowErrorNote If ETrue, a warning note is shown.
+        * @param aBytesToWrite Amount of disk space to be allocated (use an
+        * estimate if exact amount is not known).
+        * @return ETrue if allocation would go below critical level.
+        */
+        TBool FFSSpaceBelowCriticalLevelL( TBool aShowErrorNote,
+                                           TInt aBytesToWrite /*=0*/ );
+
+
+        /**
+        * Gets the network list
+        * @param aFailedLocked a boolean indicating if the operation
+        * had failed because the DB was locked
+        * @param aList a reference to the list of networks.
+        * The passed list will be erased, elements destroyed,
+        * new elements created in it. The list owns the created elements
+        * and the caller must maintaine ownership of the list.
+        * Leaves on error (Database and memory errors)
+        * @return the number of items in the list.
+        */
+        TInt NetWorkListDataL( TBool& aFailedLocked, 
+                               CApNetworkItemList& aList );
+
+
+        /**
+        * Returns the model's required IPv type (4, 6 or both, bitfield)
+        */
+        TInt RequestedIPvType();
+
+
+        /**
+        * Returns whether the Select menu item should be deleted or not
+        * @param aResourceId The ID of the current menu resource
+        * @param aCount The number of items in the list
+        */
+        TBool Need2DeleteSelect( TInt aResourceId, TInt aCount );
+        
+
+        /**
+        * Returns whether the Open menu item should be deleted or not
+        * @param aResourceId The ID of the current menu resource
+        * @param aCount The number of items in the list
+        * @param aUid The UID of the current item in the list
+        * @param aNeedsNone Gives whether NONE is displayed as an item or not
+        */
+        TBool Need2DeleteOpen( TInt aResourceId, TInt aCount, 
+                               TUint32 aUid, TBool aNeedsNone );
+
+
+        /**
+        * Returns whether the Delete menu item should be deleted or not
+        * @param aResourceId The ID of the current menu resource
+        * @param aCount The number of items in the list
+        * @param aUid The UID of the current item in the list
+        * @param aNeedsNone Gives whether NONE is displayed as an item or not
+        */
+        TBool Need2DeleteDeleteL( TInt aResourceId, TInt aCount, 
+                                  TUint32 aUid, TBool aNeedsNone );
+
+
+        /**
+        * Returns tha the New/Use existing menu item should be deleted or not
+        * @param aResourceId The ID of the current menu resource
+        * @param aCount The number of items in the list
+        */
+        TBool Need2DeleteNewUseExisting(  TInt aResourceId, TInt aCount );
+
+
+        /**
+        * @param aResourceId The ID of the current menu resource
+        * Returns whether the New menu item should be deleted or not
+        */
+        TBool Need2DeleteNewL(  TInt aResourceId );
+
+
+        /**
+        * Returns whether the Help menu item should be deleted or not
+        */
+        TBool Need2DeleteHelp(  TInt aResourceId );
+
+
+    protected:
+    
+
+
+        
+    public:
+        /**
+        * Returns the name of the first VPN accesspoint with which the access
+        * point with the passed WAP UID is associated.
+        * Name is placed on the CleanupStack if not null.
+        * Should not be called upon VPN access points!!!
+        * @param aUid The WAP UID of the normal access point
+        * @return NULL or a pointer to the name of the associated access point.
+        */
+        HBufC* GetLinkedVpnAccessPointLC( TUint32 aUid );
+
+        
+        /*
+        * Returns the current EikEnvironment
+        */
+        CEikonEnv* EikEnv();
+
+
+
+        /**
+        * Creates a new access point from the passed item.
+        * @param aApItem A reference to a CApAccessPointItem holding the
+        * access point item to be added to the database
+        * @return The UID of the newly created and saved access point.
+        */
+        TUint32 CreateFromDataL( CApAccessPointItem& aApItem );
+
+
+        /**
+        * Handles WEP security settings
+        * Leaves on errors
+        * Return TInt giving exit or shutdown required if any, otherwise, 0
+        */
+        TInt ChangeWepSettingsL( CApAccessPointItem* aApItem );
+
+
+        /**
+        * Handles WPA security settings
+        * Leaves on errors
+        * Return TInt giving exit or shutdown required if any, otherwise, 0
+        */
+        TInt ChangeWpaSettingsL( CApAccessPointItem* aApItem );
+
+
+        /**
+        * Handles 802.1x security settings
+        * Leaves on errors
+        * Return TInt giving exit or shutdown required if any, otherwise, 0
+        */
+        TInt Change8021xSettingsL( CApAccessPointItem* aApItem );
+
+        /**
+        * Resets all WEP and WPA settings to NULL, thus forcing their 
+        * re-load
+        */
+        void ClearWEPAndWPASettings();
+
+        /*
+        * Writes the WLAN settings part
+        */
+        void WriteWlanL( CApAccessPointItem& aApItem, TBool aIsNew );
+
+
+        /*
+        * Loads the WLAN settings part
+        */
+        void LoadWlanL( CApAccessPointItem& aApItem );
+
+        /**
+        * Returns whether the passed item has the security settings
+        * filled correctly or not.
+        */
+        TBool HasWlanSecSettingsFilledL( CApAccessPointItem& aApItem );
+        
+        
+        /**
+        * Update the security mode to reflect current state.
+        * Called after the user changed security settings
+        * @param aApItem The access point item containing the current settings
+        */
+        void UpdateSecurityModeL( CApAccessPointItem& aApItem );
+
+
+    private:    // data
+        CActiveApDb*                iDb;
+        CApDataHandler*             iApData;
+        CApUtils*                   iUtils;
+        CApSettingsDeleteOperation* iop;
+        TApSettingsParams           iParams;
+        TBool                       iDbOwned;
+        TInt                        iReqIpvType;
+        TVpnFilterType              iVpnFilterType;
+        CVpnApEngine*               iVpnApEngine;
+        TInt                        iVariant;       /// Local variant value
+        TBool                       iIncludeEasyWlan;
+
+        CEikonEnv*                  iEikEnv;        /// Eikon environment
+
+    public:
+        CWEPSecuritySettings*       iWepSecSettings;    ///< WEP settings data
+        CWEPSecuritySettingsUi*     iWepSecSettingsUi;  ///< WEP settings UI
+        TInt                        iWepUiExitReason;   ///< WEP UI exit reason
+
+        CWPASecuritySettings*       iWpaSecSettings;    ///< WPA settings data
+        CWPASecuritySettingsUi*     iWpaSecSettingsUi;  ///< WPA settings UI
+        TInt                        iWpaUiExitReason;   ///< WPA UI exit reason
+        TBool                       iNoEdit;
+        
+        /**
+        * CFeatureManagerWrapper wraps FeatureManager to eliminate maintenance 
+        * of existance of FeatureManager.
+        * Owned.
+        */
+        CFeatureManagerWrapper*     iFeatureManagerWrapper;
+        
+        TBool                       iInRefresh;
+        TBool                       iNeedRefresh;
+        TBool                       iHelpSupported;
+        TBool                       iProtectionSupported;
+    };
+
+
+#endif
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/inc/Apsettingsdeleteoperation.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,246 @@
+/*
+* Copyright (c) 2002 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 CApSettingsDeleteOperation.
+*
+*/
+
+
+#ifndef APSETTINGS_DELETE_OPERATION_H
+#define APSETTINGS_DELETE_OPERATION_H
+
+// INCLUDE FILES
+#include <ApDataHandler.h>
+#include <AknProgressDialog.h>
+// CONSTANTS
+
+// DATA TYPES
+
+// FORWARD DECLARATION
+class CActiveApDb;
+class CApSettingsModel;
+class CAknWaitDialog;
+class CErrorUI;
+
+// CLASS DECLARATION
+
+/**
+* Model for the access point settings ui.
+*/
+NONSHARABLE_CLASS( CApSettingsDeleteOperation ) : 
+                    public CActive, public MProgressDialogCallback
+    {
+    public:
+        enum TState             /// State of the finite state machine.
+            {
+            EProcOnDialogOn,
+            EProcOffDialogOn,
+            EProcOnDialogOff,
+            EProcOffDialogOff
+            };
+
+    public:     // Construct / destruct
+        /**
+        * Two-phased constructor. Leaves on failure.
+        * @param aNoteControlId The ID of the note control.
+        * @param aResourceID The resource ID of the wait note dialog.
+        * @param aUid The UID of the access point to delete.
+        * @param aNoteText The label for the note text.
+        * @return The constructed CApSettingsDeleteOperation object.
+        */
+        static CApSettingsDeleteOperation* NewL(
+                                TInt aNoteControlId,
+                                TInt aResourceID,
+                                TUint32 aUid,
+                                const TDesC& aNoteText
+                                );
+
+
+        /**
+        * Destructor.
+        */
+        virtual ~CApSettingsDeleteOperation();
+
+
+    protected:  // new functions
+        /**
+        * Constructor.
+        * @param aNoteControlId The ID of the note control.
+        * @param aResourceID The resource ID of the wait note dialog.
+        * @param aUid The UID of the access point to delete.
+        */
+        CApSettingsDeleteOperation(
+                                TInt aNoteControlId,
+                                TInt aResourceID,
+                                TUint32 aUid
+                                );
+
+        /**
+        * Second phase constructor. Leaves on failure.
+        * @param aNoteText The desired text of the note.
+        * events.
+        */
+        void ConstructL( const TDesC& aNoteText );
+
+    protected:  // from CActive
+        /**
+        * Run a step of the observer test.
+        */
+        void RunL();
+
+        /**
+        * Cancel protocol implementation.
+        * must be present although does nothing
+        * as it is pure virtual in base...
+        */
+        void DoCancel();
+
+        /**
+        * Callback for notification of the dismissal of the wait note dialog.
+        * From MProgressDialogCallback.
+        * The passed aButtonId is ignored.
+        */
+        virtual void DialogDismissedL( TInt aButtonId );
+
+    public:     // new methods
+
+        /**
+        * Start the operation.
+        */
+        void StartL();
+
+
+        /**
+        * Moves into next wait round and forces RunL to execute.
+        */
+        void Next();
+
+
+        /**
+        * Starts the wait note with the current params.
+        */
+        void StartWaitNoteL();
+
+
+        /**
+        * Starts the separate delete operation thread with the current params.
+        */
+        void StartDeleteOperationThreadL();
+
+
+        /**
+        * Separate thread for the delete operation.
+        * @param aPtr   A pointer to the operation to be started in the thread
+        * @return The return code of the delete operation
+        */
+        static TInt RunDeleteThread( TAny* aPtr );
+
+
+        /**
+        * Separate thread for the delete operation.
+        * @param aop   A pointer to the operation to be started in the thread
+        * @return The return code of the delete operation
+        */
+        static TInt DoRunDeleteThreadL( CApSettingsDeleteOperation* aop );
+
+
+        /**
+        * Starts a transaction on the given database
+        * @param aDb Pointer to the database object
+        * @param aWrite boolean indicating whether write or read lock is needed
+        * @param aRetry boolean indicating whether retry is needed
+        * @return Whether the transaction is our own or not
+        */
+        static TBool StartTransactionLC
+                            (
+                            CCommsDatabase* aDb,
+                            TBool aWrite,
+                            TBool aRetry /* ETrue */
+                            );
+
+
+        /**
+        * Gets write lock for the given database
+        * @param aDb Pointer to the database object
+        */
+        static void GetWriteLockL( CCommsDatabase* aDb );
+
+
+        /**
+        * Cleanup function for the transaction.
+        * In case of leave, it will be called and
+        * transaction will be rolled back
+        */
+        static void RollbackTransactionOnLeave( TAny* aDb );
+
+
+        /**
+        * Get the list of VPN WAP Access point UID's which are linked to a 
+        * specific normal internet access point WAP ID.
+        * @param aDb a reference of a CCommsDatabase database object 
+        * to operate on
+        * @param aUid a TUint32 containing the WAP UID of the normal 
+        * internet access point
+        * @param aVpnList a TUint32 dynamic array passed by reference to 
+        * hold the WAP UID's of the linked VPN access points.
+        */
+/*
+        static void GetLinkedVpnAccessPointsL( CCommsDatabase& aDb,
+                                        TUint32 aUid, 
+                                        CArrayFixFlat<TUint32> &aVpnList );
+*/
+
+        /**
+        * Reads up an integer from the given table
+        * @param atable The CCommsDbTableView* table to perform the operation
+        * @param aColumn The column to read
+        * @param aValue A TUint32 passed by reference to hold the readed value.
+        * @return TInt Error code. Returns either 0 or KErrnotFound. 
+        * Leaves on any other error
+        */
+        static TInt ReadUintL( CCommsDbTableView* atable,
+                               const TDesC& aColumn,
+                               TUint32& aValue );
+
+        /**
+        * Returns the current state.
+        */
+        TState State(){ return iState;};
+        
+        /**
+        * Set a new UID
+        */
+        void SetUid( TUint32 aUid ) { iUid = aUid;};
+        
+        
+        /**
+        * Set a new note-text
+        */
+        void SetNoteTextL( const TDesC& aNoteText );
+
+    private:    // data
+        TInt                iNoteControlId;
+        TInt                iResourceID;
+        TUint32             iUid;
+        RThread             iDeleteOperation;
+        HBufC*              iNoteText;
+        CAknWaitDialog*     iWaitDialog;
+        TState              iState;
+        CErrorUI*           iErrorUi;
+        TInt                iErr;
+    };
+
+
+#endif
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/inc/ApsettingshandleruiImpl.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,1331 @@
+/*
+* Copyright (c) 2002 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: 
+*     Declares the main implementation, CApSettingsHandlerImpl for the 
+*     Access Point settings.
+*
+*/
+
+
+#ifndef APSETTINGS_HANDLER_IMPL_H
+#define APSETTINGS_HANDLER_IMPL_H
+
+// INCLUDES
+#include <ApSettingsHandlerCommons.h>
+#include <ApEngineConsts.h>
+#include <ApSelect.h>
+
+// CONSTANTS
+/*
+const   TUid    KUidApSettingsHandler = { 0x10008d3B };
+*/
+
+typedef struct      ///< Extra data holder
+    {
+        TInt                iResOffset;
+        TBool               iIsIpv6Supported;       // Default is NO 
+        TBool               iIsFeatureManagerInitialised;
+        TInt                iExtra;
+        TInt                iSortType;
+        TVpnFilterType      iVpnFilterType;
+        TInt                iVariant;               /// Local variant value
+        TBool               iIncludeEasyWlan;
+    }TApSetHandlerImplExtra;
+
+
+// FORWARD DECLARATIONS
+class CActiveApDb;
+class CApSelector;
+class CApSettingsModel;
+class CApSettings;
+class CTextOverrides;
+class CApAccessPointItem;
+
+
+// CLASS DECLARATION
+/**
+* CApSettingsHandlerImpl class: It is the main handler for the Access Point 
+* settings. It contains the implementation of the Access Point Settings for
+* the public API to be used by other (sub)systems.
+*
+*/
+NONSHARABLE_CLASS( CApSettingsHandlerImpl ): public CBase
+    {
+
+    public: // Constructors and destructor
+
+
+        /**
+        * Two-phased constructor. Leaves on failure.
+        * This function shall be used to create the access point 
+        * settings/selection handling UI object. It is customizable through 
+        * the parameters. This object is a small layer above the UI part and
+        * it provides a standard interface to select, edit, create access 
+        * points. It has two main parts, Select and Edit. The first parameter,
+        * aStartWithSelection gives whether we would like to select or edit.
+        * In case of selection, there is the possibility to use this module in
+        * many applications. For this, two layouts are implemented, 
+        * one is list pane used by General Settings which provides the list in
+        * a list-pane. The other layout is for the other applications 
+        * requiring access point selection, a popup-list style as the decision
+        * I know about was that General Settings will use list-pane and all
+        * other apps. popup-list style. It is the caller who selects the style
+        * so if spec. says otherwise, this module still can be used.
+        * It is also possible to start the UI without selection, so if any 
+        * module has a 'linked/default/etc.' access point and stored it's UID,
+        * the module can simply call the editor part of the UI without having
+        * to select the AP once more. In case of editing only, 
+        * (aStartWithSelection is EFalse), all other construction parameters 
+        * are ignored and after construction caller can simply call 
+        * DoRunSettingsL(..). In case of selection, a lot of other parameters 
+        * can be specified to fulfil all requirements. There are three types 
+        * of Options menu available: 
+        * EApSettingsSelMenuNormal, 
+        * EApSettingsSelMenuSelectOnly,
+        * EApSettingsSelMenuSelectNormal.
+        * <br>
+        *-EApSettingsSelMenuSelectOnly: Only Select is visible, 
+        *                               no way to edit, delete, create, etc.
+        * <br>
+        * -EApSettingsSelMenuNormal:    Options menu specified in General 
+        *                               Settings, contains Edit, Delete, 
+        *                               Create new, etc. menu items.
+        * <br>
+        * -EApSettingsSelMenuSelectNormal: Same as in EApSettingsSelMenuNormal
+        *                                BUT the first item is Select. 
+        *                                This one makes it possible to select 
+        *                                an access point and also possible to 
+        *                                edit, create, delete, etc.
+        * <br>
+        * The following three parameters specify the filtering and ordering 
+        * criteria for the selection list creation. First, it is possible to
+        * specify which ISP-type we are looking for. The possible values are:
+        * <br>
+        * KEApIspTypeInternetOnly:  Filter allows only access points that are
+        *                           capable of only internet access.
+        * <br>
+        * KEApIspTypeWAPOnly:       Filter allows only access points that are 
+        *                           capable of only WAP access.
+        * <br>
+        * KEApIspTypeInternetAndWAP: Filter allows only access points that are
+        *                           capable of internet AND WAP access.
+        * <br>
+        * KEApIspTypeWAPMandatory:  Filter allows only access points that are
+        *                           capable of WAP access AND contain 
+        *                           mandatory WAP settings.
+        * <br>
+        * KEApIspTypeAll:           No filtering is done for the isp-type,
+        *                           all types of access points are shown.
+        * <br>
+        * It is possible to combine them by simply adding/or-ing together 
+        * the values, filtering will be done in such a way that only access 
+        * points with the listed ISP-types will be shown. Second filtering
+        * possibility (aBearerFilter) is the desired bearer type. The possible
+        * values are the values of the TApBearerType enum type and their 
+        * combinations, as in case of the ISP type. The ordering of the list
+        * can be specified with the aSortType parameter. It can have the
+        * following values:
+        * KEApSortUidAscending:     The sorting is done according to the ID 
+        *                           of the access points in ascending order.
+        * KEApSortUidDescending:    The sorting is done according to the ID 
+        *                           of the access points in descending order.
+        * KEApSortNameAscending:    The sorting is done according to the name
+        *                           of the access points in ascending order.
+        * KEApSortNameDescending:   The sorting is done according to the name
+        *                           of the access points in descending order.
+        * Caution! The ordering values can not be combined!
+        * @param aStartWithSelection    A boolean value indicating whether to 
+        *                               select or edit an ap.
+        * @param aListType      A TSelectionListType enum indicating the 
+        *                       desired list type.
+        * @param aSelMenuType   A TSelectionMenuType enum indicating the 
+        *                       desired menu type.
+        * @param aIspTypeFilter Filtering criteria on ISP type
+        * @param aBearerFilter Filtering criteria on bearer type
+        * @param aSortType Specifies the sort order to use.
+        * @param aNoEdit            Gives wether editing is allowed or not
+        * @return The constructed CApSettingsHandlerImpl object.
+        */
+        static CApSettingsHandlerImpl* NewLC(
+                        TBool aStartWithSelection,
+                        TSelectionListType aListType,
+                        TSelectionMenuType aSelMenuType,
+                        TInt aIspFilter,
+                        TInt aBearerFilter,
+                        TInt aSortType,
+                        TBool aNoEdit
+                        );
+
+
+
+        /**
+        * Two-phased constructor. Leaves on failure.
+        * This function shall be used to create the access point 
+        * settings/selection handling UI object. It is customizable through 
+        * the parameters. This object is a small layer above the UI part and
+        * it provides a standard interface to select, edit, create 
+        * access points. It has two main parts, Select and Edit. The first 
+        * parameter, aStartWithSelection gives whether we would like to select
+        * or edit. In case of selection, there is the possibility to use this 
+        * module in many applications. For this, two layouts are implemented,
+        * one is list pane used by General Settings which provides the list 
+        * in a list-pane. The other layout is for the other applications 
+        * requiring access point selection, a popup-list style as the 
+        * decision I know about was that General Settings will use list-pane 
+        * and all other apps. popup-list style. It is the caller who selects 
+        * the style so if spec. says otherwise, this module still can be used.
+        * It is also possible to start the UI without selection, so if any 
+        * module has a 'linked/default/etc.' access point and stored it's UID,
+        * the module can simply call the editor part of the UI without having
+        * to select the AP once more.
+        * In case of editing only, (aStartWithSelection is EFalse), all other 
+        * construction parameters are ignored and after construction caller 
+        * can simply call DoRunSettingsL(..).
+        * In case of selection, a lot of other parameters can be specified 
+        * to fulfil all requirements. There are three types of Options menu 
+        * available: 
+        * EApSettingsSelMenuNormal, 
+        * EApSettingsSelMenuSelectOnly,
+        * EApSettingsSelMenuSelectNormal.
+        * <br>
+        *-EApSettingsSelMenuSelectOnly:     Only Select is visible, no way to
+        *                                   edit, delete, create, etc.
+        * <br>
+        * -EApSettingsSelMenuNormal:        Options menu specified in General 
+        *                                   Settings, contains Edit, Delete, 
+        *                                   Create new, etc. menu items.
+        * <br>
+        * -EApSettingsSelMenuSelectNormal:  Same as in EApSettingsSelMenuNormal
+        *                                   BUT the first item is Select. 
+        *                                   This one makes it possible to 
+        *                                   select an access point and also 
+        *                                   possible to edit, create, 
+        *                                   delete, etc.
+        * <br>
+        * The following three parameters specify the filtering and ordering 
+        * criteria for the selection list creation. First, it is possible to 
+        * specify which ISP-type we are looking for. The possible values are:
+        * <br>
+        * KEApIspTypeInternetOnly:      Filter allows only access points that
+        *                               are capable of only internet access.
+        * <br>
+        * KEApIspTypeWAPOnly:           Filter allows only access points that 
+        *                               are capable of only WAP access.
+        * <br>
+        * KEApIspTypeInternetAndWAP:    Filter allows only access points that
+        *                               are capable of internet AND WAP access.
+        * <br>
+        * KEApIspTypeWAPMandatory:      Filter allows only access points that
+        *                               are capable of WAP access AND contain
+        *                               mandatory WAP settings.
+        * <br>
+        * KEApIspTypeAll:               No filtering is done for the isp-type,
+        *                               all types of access points are shown.
+        * <br>
+        * It is possible to combine them by simply adding/or-ing together the
+        * values, filtering will be done in such a way that only access points
+        * with the listed ISP-types will be shown.
+        * Second filtering possibility (aBearerFilter) is the desired bearer 
+        * type. The possible values are the values of the TApBearerType enum 
+        * type and their combinations, as in case of the ISP type.
+        * The ordering of the list can be specified with the aSortType 
+        * parameter. It can have the following values:
+        * KEApSortUidAscending:     The sorting is done according to the ID
+        *                           of the access points in ascending order.
+        * KEApSortUidDescending:    The sorting is done according to the ID 
+        *                           of the access points in descending order.
+        * KEApSortNameAscending:    The sorting is done according to the name 
+        *                           of the access points in ascending order.
+        * KEApSortNameDescending:   The sorting is done according to the name
+        *                           of the access points in descending order.
+        * Caution! The ordering values can not be combined!
+        * @param aDb A database to work on
+        * @param aStartWithSelection A boolean value indicating whether to 
+        * select or edit an ap.
+        * @param aListType A TSelectionListType enum indicating the desired
+        * list type.
+        * @param aSelMenuType A TSelectionMenuType enum indicating the desired
+        * menu type.
+        * @param aIspTypeFilter Filtering criteria on ISP type
+        * @param aBearerFilter Filtering criteria on bearer type
+        * @param aSortType Specifies the sort order to use.
+        * @param aNoEdit            Gives wether editing is allowed or not
+        * @return The constructed CApSettingsHandlerImpl object.
+        */
+        static CApSettingsHandlerImpl* NewLC(
+                        CActiveApDb& aDb,
+                        TBool aStartWithSelection,
+                        TSelectionListType aListType,
+                        TSelectionMenuType aSelMenuType,
+                        TInt aIspFilter,
+                        TInt aBearerFilter,
+                        TInt aSortType,
+                        TBool aNoEdit
+                        );
+
+
+
+
+
+
+
+
+        /**
+        * Two-phased constructor. Leaves on failure.
+        * This function shall be used to create the access point 
+        * settings/selection handling UI object.It is customizable through the
+        * parameters. This object is a small layer above the UI part and
+        * it provides a standard interface to select, edit, create access 
+        * points. It has two main parts, Select and Edit. The first parameter, 
+        * aStartWithSelection gives whether we would like to select or edit.
+        * In case of selection, there is the possibility to use this module in
+        * many applications. For this, two layouts are implemented, one is 
+        * list pane used by General Settings which provides the list in a 
+        * list-pane. The other layout is for the other applications requiring 
+        * access point selection, a popup-list style as the decision was that 
+        * General Settings will use list-pane and all other apps. popup-list 
+        * style. It is the caller who selects the style so if spec. says 
+        * otherwise, this module still can be used.
+        * It is also possible to start the UI without selection, so if any 
+        * module has a 'linked/default/etc.' access point and stored it's UID,
+        * the module can simply call the editor part of the UI without having
+        * to select the AP once more.
+        * In case of editing only, (aStartWithSelection is EFalse), all other 
+        * construction parameters are ignored and after construction caller 
+        * can simply call DoRunSettingsL(..).
+        * In case of selection, a lot of other parameters can be specified to
+        * fulfil all requirements. There are three types of Options menu 
+        * available: EApSettingsSelMenuNormal, EApSettingsSelMenuSelectOnly,
+        * EApSettingsSelMenuSelectNormal.
+        * <br>
+        *-EApSettingsSelMenuSelectOnly: Only Select is visible, no way to edit,
+        *   delete, create, etc.
+        * <br>
+        * -EApSettingsSelMenuNormal:Options menu specified in General Settings,
+        *   contains Edit, Delete, Create new, etc. menu items.
+        * <br>
+        * -EApSettingsSelMenuSelectNormal: Same as in EApSettingsSelMenuNormal 
+        *   BUT the first item is Select. This one makes it possible to select 
+        *   an access point and also possible to edit, create, delete, etc.
+        * <br>
+        * The following three parameters specify the filtering and ordering 
+        * criteria for the selection list creation. First, it is possible to 
+        * specify which ISP-type we are looking for. The possible values are:
+        * <br>
+        * KEApIspTypeInternetOnly: Filter allows only access points that are 
+        *   capable of only internet access.
+        * <br>
+        * KEApIspTypeWAPOnly: Filter allows only access points that are 
+        *   capable of only WAP access.
+        * <br>
+        * KEApIspTypeInternetAndWAP: Filter allows only access points that are 
+        *   capable of internet AND WAP access.
+        * <br>
+        * KEApIspTypeWAPMandatory: Filter allows only access points that are 
+        *   capable of WAP access AND contain mandatory WAP settings.
+        * <br>
+        * KEApIspTypeAll: No filtering is done for the isp-type, all types of
+        *   access points are shown.
+        * <br>
+        * It is possible to combine them by simply adding/or-ing together the 
+        * values, filtering will be done in such a way that only access points 
+        * with the listed ISP-types will be shown.
+        * Second filtering possibility (aBearerFilter) is the desired bearer 
+        * type. The possible values are the values of the TApBearerType enum 
+        * type and their combinations, as in case of the ISP type.
+        * The ordering of the list can be specified with the aSortType 
+        * parameter. It can have the following values:
+        * KEApSortUidAscending: The sorting is done according to the ID of 
+        *   the access points in ascending order.
+        * KEApSortUidDescending: The sorting is done according to the ID of 
+        *   the access points in descending order.
+        * KEApSortNameAscending: The sorting is done according to the name of 
+        *   the access points in ascending order.
+        * KEApSortNameDescending: The sorting is done according to the name of 
+        *   the access points in descending order.
+        * Caution! The ordering values can not be combined!
+        * @param aStartWithSelection A boolean value indicating whether to 
+        *   select or edit an ap.
+        * @param aListType A TSelectionListType enum indicating the desired
+        *   list type.
+        * @param aSelMenuType A TSelectionMenuType enum indicating the desired
+        *   menu type.
+        * @param aIspTypeFilter Filtering criteria on ISP type
+        * @param aBearerFilter Filtering criteria on bearer type
+        * @param aSortType Specifies the sort order to use.
+        * @param aReqIpvType Specifies whether the caller would like to 
+        *   have IPv4, IPv6 or both access points. If it is IPv6 or Both, 
+        *   in case of IPv6 support is available as a feature, it will be 
+        *   supported. If IPv6 feature is not supported by the phone, it 
+        *   simply defaults to the normal IPv4 version.
+        *   If it is IPv4, it uses the default IPv4 version independently 
+        *   from IPv6 feature beeing available or not.
+        * @param aNoEdit            Gives wether editing is allowed or not
+        * @return The constructed CApSettingsHandlerImpl object.
+        */
+        static CApSettingsHandlerImpl* NewLC(
+                        TBool aStartWithSelection,
+                        TSelectionListType aListType,
+                        TSelectionMenuType aSelMenuType,
+                        TInt aIspFilter,
+                        TInt aBearerFilter,
+                        TInt aSortType,
+                        TInt aReqIpvType,
+                        TBool aNoEdit
+                        );
+
+
+
+        /**
+        * Two-phased constructor. Leaves on failure.
+        * This function shall be used to create the access point 
+        * settings/selection handling UI object. It is customizable through 
+        * the parameters. This object is a small layer above the UI part and
+        * it provides a standard interface to select, edit, create access 
+        * points. It has two main parts, Select and Edit. The first parameter,
+        * aStartWithSelection gives whether we would like to select or edit.
+        * In case of selection, there is the possibility to use this module in
+        * many applications. For this, two layouts are implemented, one is list
+        * pane used by General Settings which provides the list in a list-pane.
+        * The other layout is for the other applications requiring access point
+        * selection, a popup-list style as the decision was that General 
+        * Settings will use list-pane and all other apps. popup-list style. 
+        * It is the caller who selects the style so if spec. says otherwise,
+        * this module still can be used. It is also possible to start the UI 
+        * without selection, so if any module has a 'linked/default/etc.'
+        * access point and stored it's UID, the module can simply call the 
+        * editor part of the UI without having to select the AP once more.
+        * In case of editing only, (aStartWithSelection is EFalse), all other 
+        * construction parameters are ignored and after construction caller can
+        * simply call DoRunSettingsL(..). In case of selection, a lot of other
+        * parameters can be specified to fulfil all requirements. There are 
+        * three types of Options menu available: EApSettingsSelMenuNormal, 
+        * EApSettingsSelMenuSelectOnly, EApSettingsSelMenuSelectNormal.
+        * <br>
+        *-EApSettingsSelMenuSelectOnly: Only Select is visible, no way to edit,
+        *   delete, create, etc.
+        * <br>
+        * -EApSettingsSelMenuNormal:Options menu specified in General Settings,
+        *   contains Edit, Delete, Create new, etc. menu items.
+        * <br>
+        * -EApSettingsSelMenuSelectNormal: Same as in EApSettingsSelMenuNormal 
+        *   BUT the first item is Select. This one makes it possible to select
+        *   an access point and also possible to edit, create, delete, etc.
+        * <br>
+        * The following three parameters specify the filtering and ordering
+        * criteria for the selection list creation. First, it is possible to 
+        * specify which ISP-type we are looking for. The possible values are:
+        * <br>
+        * KEApIspTypeInternetOnly: Filter allows only access points that are 
+        *   capable of only internet access.
+        * <br>
+        * KEApIspTypeWAPOnly: Filter allows only access points that are 
+        *   capable of only WAP access.
+        * <br>
+        * KEApIspTypeInternetAndWAP: Filter allows only access points that are 
+        *   capable of internet AND WAP access.
+        * <br>
+        * KEApIspTypeWAPMandatory: Filter allows only access points that are 
+        *   capable of WAP access AND contain mandatory WAP settings.
+        * <br>
+        * KEApIspTypeAll: No filtering is done for the isp-type, all types of
+        *   access points are shown.
+        * <br>
+        * It is possible to combine them by simply adding/or-ing together the
+        * values, filtering will be done in such a way that only access points
+        * with the listed ISP-types will be shown. Second filtering possibility
+        * (aBearerFilter) is the desired bearer type. The possible values are 
+        * the values of the TApBearerType enum type and their combinations, as
+        * in case of the ISP type. The ordering of the list can be specified 
+        * with the aSortType parameter. It can have the following values:
+        * KEApSortUidAscending: The sorting is done according to the ID of 
+        *   the access points in ascending order.
+        * KEApSortUidDescending: The sorting is done according to the ID of 
+        *   the access points in descending order.
+        * KEApSortNameAscending: The sorting is done according to the name of
+        *   the access points in ascending order.
+        * KEApSortNameDescending: The sorting is done according to the name of
+        *   the access points in descending order.
+        * Caution! The ordering values can not be combined!
+        * @param aDb A database to work on
+        * @param aStartWithSelection A boolean value indicating whether to 
+        *   select or edit an ap.
+        * @param aListType A TSelectionListType enum indicating the desired
+        *   list type.
+        * @param aSelMenuType A TSelectionMenuType enum indicating the desired
+        *   menu type.
+        * @param aIspTypeFilter Filtering criteria on ISP type
+        * @param aBearerFilter Filtering criteria on bearer type
+        * @param aSortType Specifies the sort order to use.
+        * @param aReqIpvType Specifies whether the caller would like to 
+        *   have IPv4, IPv6 or both access points. If it is IPv6 or Both, 
+        *   in case of IPv6 support is available as a feature, it will be 
+        *   supported. If IPv6 feature is not supported by the phone, it 
+        *   simply defaults to the normal IPv4 version.
+        *   If it is IPv4, it uses the default IPv4 version independently 
+        *   from IPv6 feature beeing available or not.
+        * @param aNoEdit            Gives wether editing is allowed or not
+        * @return The constructed CApSettingsHandlerImpl object.
+        */
+        static CApSettingsHandlerImpl* NewLC(
+                        CActiveApDb& aDb,
+                        TBool aStartWithSelection,
+                        TSelectionListType aListType,
+                        TSelectionMenuType aSelMenuType,
+                        TInt aIspFilter,
+                        TInt aBearerFilter,
+                        TInt aSortType,
+                        TInt aReqIpvType,
+                        TBool aNoEdit
+                        );
+
+
+
+
+        /**
+        * Two-phased constructor. Leaves on failure.
+        * This function shall be used to create the access point 
+        * settings/selection handling UI object.It is customizable through the
+        * parameters. This object is a small layer above the UI part and
+        * it provides a standard interface to select, edit, create access 
+        * points. It has two main parts, Select and Edit. The first parameter, 
+        * aStartWithSelection gives whether we would like to select or edit.
+        * In case of selection, there is the possibility to use this module in
+        * many applications. For this, two layouts are implemented, one is 
+        * list pane used by General Settings which provides the list in a 
+        * list-pane. The other layout is for the other applications requiring 
+        * access point selection, a popup-list style as the decision was that 
+        * General Settings will use list-pane and all other apps. popup-list 
+        * style. It is the caller who selects the style so if spec. says 
+        * otherwise, this module still can be used.
+        * It is also possible to start the UI without selection, so if any 
+        * module has a 'linked/default/etc.' access point and stored it's UID,
+        * the module can simply call the editor part of the UI without having
+        * to select the AP once more.
+        * In case of editing only, (aStartWithSelection is EFalse), all other 
+        * construction parameters are ignored and after construction caller 
+        * can simply call DoRunSettingsL(..).
+        * In case of selection, a lot of other parameters can be specified to
+        * fulfil all requirements. There are three types of Options menu 
+        * available: EApSettingsSelMenuNormal, EApSettingsSelMenuSelectOnly,
+        * EApSettingsSelMenuSelectNormal.
+        * <br>
+        *-EApSettingsSelMenuSelectOnly: Only Select is visible, no way to edit,
+        *   delete, create, etc.
+        * <br>
+        * -EApSettingsSelMenuNormal:Options menu specified in General Settings,
+        *   contains Edit, Delete, Create new, etc. menu items.
+        * <br>
+        * -EApSettingsSelMenuSelectNormal: Same as in EApSettingsSelMenuNormal 
+        *   BUT the first item is Select. This one makes it possible to select 
+        *   an access point and also possible to edit, create, delete, etc.
+        * <br>
+        * The following three parameters specify the filtering and ordering 
+        * criteria for the selection list creation. First, it is possible to 
+        * specify which ISP-type we are looking for. The possible values are:
+        * <br>
+        * KEApIspTypeInternetOnly: Filter allows only access points that are 
+        *   capable of only internet access.
+        * <br>
+        * KEApIspTypeWAPOnly: Filter allows only access points that are 
+        *   capable of only WAP access.
+        * <br>
+        * KEApIspTypeInternetAndWAP: Filter allows only access points that are 
+        *   capable of internet AND WAP access.
+        * <br>
+        * KEApIspTypeWAPMandatory: Filter allows only access points that are 
+        *   capable of WAP access AND contain mandatory WAP settings.
+        * <br>
+        * KEApIspTypeAll: No filtering is done for the isp-type, all types of
+        *   access points are shown.
+        * <br>
+        * It is possible to combine them by simply adding/or-ing together the 
+        * values, filtering will be done in such a way that only access points 
+        * with the listed ISP-types will be shown.
+        * Second filtering possibility (aBearerFilter) is the desired bearer 
+        * type. The possible values are the values of the TApBearerType enum 
+        * type and their combinations, as in case of the ISP type.
+        * The ordering of the list can be specified with the aSortType 
+        * parameter. It can have the following values:
+        * KEApSortUidAscending: The sorting is done according to the ID of 
+        *   the access points in ascending order.
+        * KEApSortUidDescending: The sorting is done according to the ID of 
+        *   the access points in descending order.
+        * KEApSortNameAscending: The sorting is done according to the name of 
+        *   the access points in ascending order.
+        * KEApSortNameDescending: The sorting is done according to the name of 
+        *   the access points in descending order.
+        * Caution! The ordering values can not be combined!
+        * @param aStartWithSelection A boolean value indicating whether to 
+        *   select or edit an ap.
+        * @param aListType A TSelectionListType enum indicating the desired
+        *   list type.
+        * @param aSelMenuType A TSelectionMenuType enum indicating the desired
+        *   menu type.
+        * @param aIspTypeFilter Filtering criteria on ISP type
+        * @param aBearerFilter Filtering criteria on bearer type
+        * @param aSortType Specifies the sort order to use.
+        * @param aReqIpvType Specifies whether the caller would like to 
+        *   have IPv4, IPv6 or both access points. If it is IPv6 or Both, 
+        *   in case of IPv6 support is available as a feature, it will be 
+        *   supported. If IPv6 feature is not supported by the phone, it 
+        *   simply defaults to the normal IPv4 version.
+        *   If it is IPv4, it uses the default IPv4 version independently 
+        *   from IPv6 feature beeing available or not.
+        * @param aVpnFilterType a TVpnFilterType representing the possible 
+        *   additional VPN filtering.
+        * @param aNoEdit            Gives wether editing is allowed or not
+        * @return The constructed CApSettingsHandlerImpl object.
+        */
+        static CApSettingsHandlerImpl* NewLC(
+                        TBool aStartWithSelection,
+                        TSelectionListType aListType,
+                        TSelectionMenuType aSelMenuType,
+                        TInt aIspFilter,
+                        TInt aBearerFilter,
+                        TInt aSortType,
+                        TInt aReqIpvType,
+                        TVpnFilterType aVpnFilterType,
+                        TBool aNoEdit
+                        );
+
+
+
+        /**
+        * Two-phased constructor. Leaves on failure.
+        * This function shall be used to create the access point 
+        * settings/selection handling UI object. It is customizable through 
+        * the parameters. This object is a small layer above the UI part and
+        * it provides a standard interface to select, edit, create access 
+        * points. It has two main parts, Select and Edit. The first parameter,
+        * aStartWithSelection gives whether we would like to select or edit.
+        * In case of selection, there is the possibility to use this module in
+        * many applications. For this, two layouts are implemented, one is list
+        * pane used by General Settings which provides the list in a list-pane.
+        * The other layout is for the other applications requiring access point
+        * selection, a popup-list style as the decision was that General 
+        * Settings will use list-pane and all other apps. popup-list style. 
+        * It is the caller who selects the style so if spec. says otherwise,
+        * this module still can be used. It is also possible to start the UI 
+        * without selection, so if any module has a 'linked/default/etc.'
+        * access point and stored it's UID, the module can simply call the 
+        * editor part of the UI without having to select the AP once more.
+        * In case of editing only, (aStartWithSelection is EFalse), all other 
+        * construction parameters are ignored and after construction caller can
+        * simply call DoRunSettingsL(..). In case of selection, a lot of other
+        * parameters can be specified to fulfil all requirements. There are 
+        * three types of Options menu available: EApSettingsSelMenuNormal, 
+        * EApSettingsSelMenuSelectOnly, EApSettingsSelMenuSelectNormal.
+        * <br>
+        *-EApSettingsSelMenuSelectOnly: Only Select is visible, no way to edit,
+        *   delete, create, etc.
+        * <br>
+        * -EApSettingsSelMenuNormal:Options menu specified in General Settings,
+        *   contains Edit, Delete, Create new, etc. menu items.
+        * <br>
+        * -EApSettingsSelMenuSelectNormal: Same as in EApSettingsSelMenuNormal 
+        *   BUT the first item is Select. This one makes it possible to select
+        *   an access point and also possible to edit, create, delete, etc.
+        * <br>
+        * The following three parameters specify the filtering and ordering
+        * criteria for the selection list creation. First, it is possible to 
+        * specify which ISP-type we are looking for. The possible values are:
+        * <br>
+        * KEApIspTypeInternetOnly: Filter allows only access points that are 
+        *   capable of only internet access.
+        * <br>
+        * KEApIspTypeWAPOnly: Filter allows only access points that are 
+        *   capable of only WAP access.
+        * <br>
+        * KEApIspTypeInternetAndWAP: Filter allows only access points that are 
+        *   capable of internet AND WAP access.
+        * <br>
+        * KEApIspTypeWAPMandatory: Filter allows only access points that are 
+        *   capable of WAP access AND contain mandatory WAP settings.
+        * <br>
+        * KEApIspTypeAll: No filtering is done for the isp-type, all types of
+        *   access points are shown.
+        * <br>
+        * It is possible to combine them by simply adding/or-ing together the
+        * values, filtering will be done in such a way that only access points
+        * with the listed ISP-types will be shown. Second filtering possibility
+        * (aBearerFilter) is the desired bearer type. The possible values are 
+        * the values of the TApBearerType enum type and their combinations, as
+        * in case of the ISP type. The ordering of the list can be specified 
+        * with the aSortType parameter. It can have the following values:
+        * KEApSortUidAscending: The sorting is done according to the ID of 
+        *   the access points in ascending order.
+        * KEApSortUidDescending: The sorting is done according to the ID of 
+        *   the access points in descending order.
+        * KEApSortNameAscending: The sorting is done according to the name of
+        *   the access points in ascending order.
+        * KEApSortNameDescending: The sorting is done according to the name of
+        *   the access points in descending order.
+        * Caution! The ordering values can not be combined!
+        * @param aDb A database to work on
+        * @param aStartWithSelection A boolean value indicating whether to 
+        *   select or edit an ap.
+        * @param aListType A TSelectionListType enum indicating the desired
+        *   list type.
+        * @param aSelMenuType A TSelectionMenuType enum indicating the desired
+        *   menu type.
+        * @param aIspTypeFilter Filtering criteria on ISP type
+        * @param aBearerFilter Filtering criteria on bearer type
+        * @param aSortType Specifies the sort order to use.
+        * @param aReqIpvType Specifies whether the caller would like to 
+        *   have IPv4, IPv6 or both access points. If it is IPv6 or Both, 
+        *   in case of IPv6 support is available as a feature, it will be 
+        *   supported. If IPv6 feature is not supported by the phone, it 
+        *   simply defaults to the normal IPv4 version.
+        *   If it is IPv4, it uses the default IPv4 version independently 
+        *   from IPv6 feature beeing available or not.
+        * @param aVpnFilterType a TVpnFilterType representing the possible 
+        *   additional VPN filtering.
+        * @param aNoEdit            Gives wether editing is allowed or not
+        * @return The constructed CApSettingsHandlerImpl object.
+        */
+        static CApSettingsHandlerImpl* NewLC(
+                        CActiveApDb& aDb,
+                        TBool aStartWithSelection,
+                        TSelectionListType aListType,
+                        TSelectionMenuType aSelMenuType,
+                        TInt aIspFilter,
+                        TInt aBearerFilter,
+                        TInt aSortType,
+                        TInt aReqIpvType,
+                        TVpnFilterType aVpnFilterType,
+                        TBool aNoEdit
+                        );
+
+
+
+
+
+        /**
+        * Two-phased constructor. Leaves on failure.
+        * This function shall be used to create the access point 
+        * settings/selection handling UI object. It is customizable through 
+        * the parameters. This object is a small layer above the UI part and
+        * it provides a standard interface to select, edit, create access 
+        * points. It has two main parts, Select and Edit. The first parameter,
+        * aStartWithSelection gives whether we would like to select or edit.
+        * In case of selection, there is the possibility to use this module in
+        * many applications. For this, two layouts are implemented, one is list
+        * pane used by General Settings which provides the list in a list-pane.
+        * The other layout is for the other applications requiring access point
+        * selection, a popup-list style as the decision was that General 
+        * Settings will use list-pane and all other apps. popup-list style. 
+        * It is the caller who selects the style so if spec. says otherwise,
+        * this module still can be used. It is also possible to start the UI 
+        * without selection, so if any module has a 'linked/default/etc.'
+        * access point and stored it's UID, the module can simply call the 
+        * editor part of the UI without having to select the AP once more.
+        * In case of editing only, (aStartWithSelection is EFalse), all other 
+        * construction parameters are ignored and after construction caller can
+        * simply call DoRunSettingsL(..). In case of selection, a lot of other
+        * parameters can be specified to fulfil all requirements. There are 
+        * three types of Options menu available: EApSettingsSelMenuNormal, 
+        * EApSettingsSelMenuSelectOnly, EApSettingsSelMenuSelectNormal.
+        * <br>
+        *-EApSettingsSelMenuSelectOnly: Only Select is visible, no way to edit,
+        *   delete, create, etc.
+        * <br>
+        * -EApSettingsSelMenuNormal:Options menu specified in General Settings,
+        *   contains Edit, Delete, Create new, etc. menu items.
+        * <br>
+        * -EApSettingsSelMenuSelectNormal: Same as in EApSettingsSelMenuNormal 
+        *   BUT the first item is Select. This one makes it possible to select
+        *   an access point and also possible to edit, create, delete, etc.
+        * <br>
+        * The following three parameters specify the filtering and ordering
+        * criteria for the selection list creation. First, it is possible to 
+        * specify which ISP-type we are looking for. The possible values are:
+        * <br>
+        * KEApIspTypeInternetOnly: Filter allows only access points that are 
+        *   capable of only internet access.
+        * <br>
+        * KEApIspTypeWAPOnly: Filter allows only access points that are 
+        *   capable of only WAP access.
+        * <br>
+        * KEApIspTypeInternetAndWAP: Filter allows only access points that are 
+        *   capable of internet AND WAP access.
+        * <br>
+        * KEApIspTypeWAPMandatory: Filter allows only access points that are 
+        *   capable of WAP access AND contain mandatory WAP settings.
+        * <br>
+        * KEApIspTypeAll: No filtering is done for the isp-type, all types of
+        *   access points are shown.
+        * <br>
+        * It is possible to combine them by simply adding/or-ing together the
+        * values, filtering will be done in such a way that only access points
+        * with the listed ISP-types will be shown. Second filtering possibility
+        * (aBearerFilter) is the desired bearer type. The possible values are 
+        * the values of the TApBearerType enum type and their combinations, as
+        * in case of the ISP type. The ordering of the list can be specified 
+        * with the aSortType parameter. It can have the following values:
+        * KEApSortUidAscending: The sorting is done according to the ID of 
+        *   the access points in ascending order.
+        * KEApSortUidDescending: The sorting is done according to the ID of 
+        *   the access points in descending order.
+        * KEApSortNameAscending: The sorting is done according to the name of
+        *   the access points in ascending order.
+        * KEApSortNameDescending: The sorting is done according to the name of
+        *   the access points in descending order.
+        * Caution! The ordering values can not be combined!
+        * @param aDb A database to work on
+        * @param aStartWithSelection A boolean value indicating whether to 
+        *   select or edit an ap.
+        * @param aListType A TSelectionListType enum indicating the desired
+        *   list type.
+        * @param aSelMenuType A TSelectionMenuType enum indicating the desired
+        *   menu type.
+        * @param aIspTypeFilter Filtering criteria on ISP type
+        * @param aBearerFilter Filtering criteria on bearer type
+        * @param aSortType Specifies the sort order to use.
+        * @param aReqIpvType Specifies whether the caller would like to 
+        *   have IPv4, IPv6 or both access points. If it is IPv6 or Both, 
+        *   in case of IPv6 support is available as a feature, it will be 
+        *   supported. If IPv6 feature is not supported by the phone, it 
+        *   simply defaults to the normal IPv4 version.
+        *   If it is IPv4, it uses the default IPv4 version independently 
+        *   from IPv6 feature beeing available or not.
+        * @param aVpnFilterType a TVpnFilterType representing the possible 
+        *   additional VPN filtering.
+        * @param aIncludeEasyWlan a TBool indicating whether it should 
+        *   include the easy wlan AP in the list or not.
+        * @param aNoEdit            Gives wether editing is allowed or not
+        * @return The constructed CApSettingsHandlerImpl object.
+        */
+        static CApSettingsHandlerImpl* NewLC(
+                        CActiveApDb& aDb,
+                        TBool aStartWithSelection,
+                        TSelectionListType aListType,
+                        TSelectionMenuType aSelMenuType,
+                        TInt aIspFilter,
+                        TInt aBearerFilter,
+                        TInt aSortType,
+                        TInt aReqIpvType,
+                        TVpnFilterType aVpnFilterType,
+                        TBool aIncludeEasyWlan,
+                        TBool aNoEdit
+                        );
+
+
+
+
+        /**
+        * Destructor.
+        */
+        ~CApSettingsHandlerImpl();
+
+
+    protected:
+        /**
+        * Constructor.
+        * @param aStartWithSelection A boolean value indicating whether to 
+        *   select or edit an ap.
+        * @param aListType A TSelectionListType enum indicating the desired
+        *   list type.
+        * @param aSelMenuType A TSelectionMenuType enum indicating the desired
+        *   menu type.
+        * @param aNoEdit        Gives wether editing is allowed or not
+        */
+        CApSettingsHandlerImpl(
+                                    TBool aStartWithSelection,
+                                    TSelectionListType aListType,
+                                    TSelectionMenuType aSelMenuType,
+                                    TBool aNoEdit
+                                    );
+
+        /**
+        * Constructor.
+        * @param aStartWithSelection A boolean value indicating whether to 
+        *   select or edit an ap.
+        * @param aListType A TSelectionListType enum indicating the desired
+        *   list type.
+        * @param aSelMenuType A TSelectionMenuType enum indicating the desired
+        *   menu type.
+        * @param aHelpMajor     Major help ID
+        * @param aNoEdit        Gives wether editing is allowed or not
+        */
+        CApSettingsHandlerImpl(
+                                    TBool aStartWithSelection,
+                                    TSelectionListType aListType,
+                                    TSelectionMenuType aSelMenuType,
+                                    TUid aHelpMajor,
+                                    TBool aNoEdit
+                                    );
+
+
+        /**
+        * Constructor.
+        * @param aStartWithSelection A boolean value indicating whether to 
+        *   select or edit an ap.
+        * @param aListType A TSelectionListType enum indicating the desired
+        *   list type.
+        * @param aSelMenuType A TSelectionMenuType enum indicating the desired
+        *   menu type.
+        * @param aNeedIpv6Support Whether IPv6 is supported or not
+        * @param aNoEdit        Gives wether editing is allowed or not
+        */
+        CApSettingsHandlerImpl(
+                            TBool aStartWithSelection,
+                            TSelectionListType aListType,
+                            TSelectionMenuType aSelMenuType,
+                            TBool aNeedIpv6Support,
+                            TBool aNoEdit
+                            );
+
+
+
+        /**
+        * Second-phase constructor.
+        * @param aIspTypeFilter Filtering criteria on ISP type
+        * @param aBearerFilter Filtering criteria on bearer type
+        * @param aSortType Specifies the sort order to use.
+        */
+        void ConstructL(
+                                TInt aIspFilter,
+                                TInt aBearerFilter,
+                                TInt aSortType
+                                );
+
+
+        /**
+        * Second-phase constructor.
+        * @param aDb A database to work on
+        * @param aIspTypeFilter Filtering criteria on ISP type
+        * @param aBearerFilter Filtering criteria on bearer type
+        * @param aSortType Specifies the sort order to use.
+        */
+        void ConstructL(
+                                CActiveApDb& aDb,
+                                TInt aIspFilter,
+                                TInt aBearerFilter,
+                                TInt aSortType
+                                );
+
+
+        /**
+        * Second-phase constructor.
+        * @param aIspTypeFilter Filtering criteria on ISP type
+        * @param aBearerFilter Filtering criteria on bearer type
+        * @param aSortType Specifies the sort order to use.
+        * @param aVpnFilterType a TVpnFilterType representing the possible 
+        *   additional VPN filtering.
+        */
+        void ConstructL(
+                                TInt aIspFilter,
+                                TInt aBearerFilter,
+                                TInt aSortType,
+                                TVpnFilterType aVpnFilterType
+                                );
+
+
+        /**
+        * Second-phase constructor.
+        * @param aDb A database to work on
+        * @param aIspTypeFilter Filtering criteria on ISP type
+        * @param aBearerFilter Filtering criteria on bearer type
+        * @param aSortType Specifies the sort order to use.
+        * @param aVpnFilterType a TVpnFilterType representing the possible 
+        *   additional VPN filtering.
+        */
+        void ConstructL(
+                                CActiveApDb& aDb,
+                                TInt aIspFilter,
+                                TInt aBearerFilter,
+                                TInt aSortType,
+                                TVpnFilterType aVpnFilterType
+                                );
+
+
+
+
+        /**
+        * Second-phase constructor.
+        * @param aDb A database to work on
+        * @param aIspTypeFilter Filtering criteria on ISP type
+        * @param aBearerFilter Filtering criteria on bearer type
+        * @param aSortType Specifies the sort order to use.
+        * @param aVpnFilterType a TVpnFilterType representing the possible 
+        *   additional VPN filtering.
+        * @param aIncludeEasyWlan a TBool indicating whether it should 
+        *   include the easy wlan AP in the list or not.
+        */
+        void ConstructL(
+                                CActiveApDb& aDb,
+                                TInt aIspFilter,
+                                TInt aBearerFilter,
+                                TInt aSortType,
+                                TVpnFilterType aVpnFilterType,
+                                TBool aIncludeEasyWlan
+                                );
+
+
+    public: // New functions
+        /**
+        * Sets the filtering used in the access point selection.
+        * @param aIspTypeFilter Filtering criteria on ISP type
+        * @param aBearerFilter Filtering criteria on bearer type
+        * @param aSortType Specifies the sort order to use.
+        * @return No return value. Leaves on error.
+        */
+        void SetFilterL(
+                                TInt aIspFilter,
+                                TInt aBearerFilter,
+                                TInt aSortType
+                                );
+
+
+        /**
+        * Sets possible overrides of some texts.
+        * By default, text is read from resources. This provides a way to 
+        * change some of the text to a caller-supplied one. The text must 
+        * be read from resource and must be already localized.
+        * More than one text can be substituted, they are stored internally
+        * in an array.
+        * Currently not supported and supporting it is under discussion.
+        * @param aText2Change TTextID to identify the text to be replaced with
+        * @param aNewText Reference to the substitute text.
+        */
+        void SetTextOverrideL( TTextID aText2Change, 
+                                        const TDesC& aNewText );
+
+
+        /**
+        * Gets possible overrides of a text.
+        * By default, text is read from resources. This provides a way to 
+        * change some of the text to a caller-supplied one. The text must
+        * be read from resource and must be already localized.
+        * More than one text can be substituted, they are stored internally
+        * in an array.
+        * Currently not supported and supporting it is under discussion
+        * @param aTextID TTextID type to identify the text to be replaced with
+        * @return Reference to the substitute text.
+        */
+        const TDesC& TextOverrideL( TTextID aTextId );
+
+
+        /**
+        * Starts the settings component.
+        * Creates dialog(s) from scratch, launches and executes them.
+        * Can leave with error codes.
+        * @param TUint32 aHighlight The UID of the AP to highlight by default
+        * @param TUint32 aSelected The UID of the access point selected 
+        * by the user.
+        * @return The accomplished task's flag-codes:
+        * <br>
+        * KApUiEventNone,
+        * <br>
+        * KApUiEventSelected,
+        * <br>
+        * KApUiEventCreatedBlank,
+        * <br>
+        * KApUiEventCreatedUsedOld,
+        * <br>
+        * KApUiEventEdited,
+        * <br>
+        * KApUiEventDeleted,
+        * <br>
+        * KApUiEventExitRequested
+        * <br>and their combinations. ( Bitwise OR )
+        * <br>
+        * aSelected will be modified only if KApUiEventSelected is included 
+        * in the flags.
+        * <br>
+        * In case it returns KApUiEventExitRequested, the user had choosen
+        * the Exit option from the Options menu which means
+        * that the caller application MUST exit!
+        * <br>
+        * Returns after completion!
+        */
+        TInt RunSettingsL( TUint32 aHighLight, TUint32& aSelected );
+
+
+        /**
+        * Component Validation Test.
+        * @return KErrNone.
+        */
+        static TInt Cvt();
+
+
+    protected:  // New functions
+        /**
+        * Starts the settings component.
+        * Creates dialog(s) from scratch, launches and executes them.
+        * In case of error, leaves with error codes.
+        * @param TUint32 aHighlight The UID of the AP to highlight by default
+        * @param TUint32 aSelected The UID of the AP selected by the user
+        * @return The accomplished task's flag-codes:
+        * <br>
+        * KApUiEventNone,
+        * <br>
+        * KApUiEventSelected,
+        * <br>
+        * KApUiEventCreatedBlank,
+        * <br>
+        * KApUiEventCreatedUsedOld,
+        * <br>
+        * KApUiEventEdited,
+        * <br>
+        * KApUiEventDeleted
+        * <br>
+        * and their combinations. ( Bitwise OR )
+        * <br>
+        * aSelected will be modified only if KApUiEventSelected is included 
+        * in the flags.
+        * <br>
+        * Returns after completion!
+        */
+        TInt DoRunSettingsL( TUint32 aHighLight, TUint32& aSelected );
+
+
+        /**
+        * Starts the viewer component.
+        * Creates dialog(s) from scratch, launches and executes it.
+        * In case of error, leaves with error codes.
+        * @param TUint32 aUid The UID of the AP to view/edit
+        * @return Returns the completed task's flags
+        * KApUiEventNone, KApUiEventSelected, KApUiEventCreatedBlank,
+        * KApUiEventCreatedUsedOld, KApUiEventEdited, KApUiEventDeleted,
+        * KApUiEventExitRequested and their combinations. ( Bitwise OR )
+        * In case it returns KApUiEventExitRequested, the user had choosen
+        * the Exit option from the Options menu which means
+        * that the caller application MUST exit!
+        * <br>
+        * Returns after completion!
+        */
+        TInt RunViewerL( TUint32 aUid );
+
+
+        /**
+        * Starts the viewer component.
+        * Creates dialog(s) from scratch, launches and executes it.
+        * In case of error, leaves with error codes.
+        * @param TUint32 aUid The UID of the AP to view/edit
+        * @return Returns the completed task's flags
+        * KApUiEventNone, KApUiEventSelected, KApUiEventCreatedBlank,
+        * KApUiEventCreatedUsedOld, KApUiEventEdited, KApUiEventDeleted,
+        * KApUiEventExitRequested and their combinations. ( Bitwise OR )
+        * Returns after completion!
+        */
+        TInt DoRunViewerL( TUint32 aUid );
+
+
+        // handles the Delete access Point command.
+        void HandleApDeleteCmdL( TUint32 aUid, TBool aIsLast );
+
+
+        // handles the Create blank new access Point command.
+        TUint32 HandleApBlankNewL( TInt aBearers, TInt aIsps );
+
+
+        // handles the Create new access Point by using existing one command.
+        TUint32 HandleApUseOldNewL();
+
+
+        // handles the Editing of the newly created access Point.
+        TUint32 EditAfterCreateL( TUint32 aUid, 
+                                  CApAccessPointItem* aItem = NULL );
+
+
+        /**
+        * Second-phase internal constructor.
+        * @param aDb A database to work on
+        * @param aIspTypeFilter Filtering criteria on ISP type
+        * @param aBearerFilter Filtering criteria on bearer type
+        * @param aSortType Specifies the sort order to use.
+        * @param aVpnFilterType a TVpnFilterType representing the possible 
+        *   additional VPN filtering.
+        * @param aIncludeEasyWlan a TBool indicating whether it should 
+        *   include the easy wlan AP in the list or not.
+        */
+        void DoConstructL( CActiveApDb* aDb, TInt aIspFilter,
+                           TInt aBearerFilter, TInt aSortType,
+                           TVpnFilterType aVpnFilterType,
+                           TBool aIncludeEasyWlan );
+
+
+        /**
+        * Starts the selector component as a list
+        * Creates dialog(s) from scratch, launches and executes them.
+        * In case of error, leaves with error codes.
+        * @param TUint32 aHighlight The UID of the AP to highlight by default
+        * @param TUint32 aSelected The UID of the AP selected by the user
+        * @return The accomplished task's flag-codes:
+        * <br>
+        * KApUiEventNone,
+        * <br>
+        * KApUiEventSelected,
+        * <br>
+        * KApUiEventCreatedBlank,
+        * <br>
+        * KApUiEventCreatedUsedOld,
+        * <br>
+        * KApUiEventEdited,
+        * <br>
+        * KApUiEventDeleted
+        * <br>
+        * and their combinations. ( Bitwise OR )
+        * <br>
+        * aSelected will be modified only if KApUiEventSelected is included 
+        * in the flags.
+        * <br>
+        * Returns after completion!
+        */
+        void DoRunListSettingsL( TUint32 aHighLight, TUint32& aSelected );
+
+
+        /**
+        * Starts the selector component in a setting page
+        * Creates dialog(s) from scratch, launches and executes them.
+        * In case of error, leaves with error codes.
+        * @param TUint32 aHighlight The UID of the AP to highlight by default
+        * @param TUint32 aSelected The UID of the AP selected by the user
+        * @return The accomplished task's flag-codes:
+        * <br>
+        * KApUiEventNone,
+        * <br>
+        * KApUiEventSelected,
+        * <br>
+        * KApUiEventCreatedBlank,
+        * <br>
+        * KApUiEventCreatedUsedOld,
+        * <br>
+        * KApUiEventEdited,
+        * <br>
+        * KApUiEventDeleted
+        * <br>
+        * and their combinations. ( Bitwise OR )
+        * <br>
+        * aSelected will be modified only if KApUiEventSelected is included
+        * in the flags.
+        * <br>
+        * Returns after completion!
+        */
+        void DoRunSetPageSettingsL( TUint32 aHighLight, TUint32& aSelected );
+
+
+        /**
+        * handles the Create new access Point by using existing one command.
+        * Called after user has selected the AP to copy
+        * Creates the new Ap and offers it for editing.
+        * @param aSelected The UID of the AP to copy. Shall not be KErrNone.
+        * @return The UID of the newly created Ap
+        */
+        TUint32 DoHandleApUseOldNewL( TUint32 aSelected );
+
+        /**
+        * Selects the Ap to Copy, returns its UID.
+        * If not selected, KErrNone is returned
+        */
+        TUint32 SelectApToCopyL();
+
+
+        /**
+        * handles the Create blank new access Point command.
+        */
+        TUint32 DoHandleApBlankNewL( TInt aBearers, TInt aIsps );
+
+
+        /**
+        * handles the Delete network group command.
+        * @param aUid The uid of the network to delete
+        */
+        void HandleNetworkDeleteCmdL( TUint32 aUid );
+
+
+        /**
+        * Gets the local variant value 
+        * @return A TInt stating the variant
+        */
+        TInt GetVariantL();
+
+
+        /**
+        * Gets confirmation about deleting an access point
+        * @param aUid A TUint32 holding the WAP access point ID of the 
+        * access point to be deleted.
+        * @param aIsLast A TBool specifying whether the access point to be 
+        * deleted is the last one or not.
+        * @return A TInt stating the result
+        */
+        TInt ConfirmDeleteL( TUint32 aUid, TBool aIsLast );
+
+
+        /**
+        * Wrapper for the public API
+        */
+        void HandleRunSettingsL( TUint32 aHighLight, TUint32& aSelected );
+        
+
+    protected:  // Functions from base classes
+
+        friend class CApSettingsDlg;
+        friend class CApSelectorDialog;
+        friend class CApSelPopupList;
+        friend class CApNetSelPopupList;
+        friend class CApSettingsHandler;
+
+    private:
+        /**
+        * Selects an appropriate bearer type for a given item according to 
+        * the current filtering criterias
+        * @param aBearers The current bearer filter set
+        * @param aItem The CApAccessPointItem whoose bearer type is to be set.
+        */
+        void ChooseBearerTypeL( TInt aBearers, CApAccessPointItem& aItem );
+
+        /**
+        * Duplciates an existing access point identified by the passed WAP ID
+        * @param aUid The WAP Access Point ID of the access point to duplicate
+        * @return The WAP Access Point ID of the newly created access point.
+        */
+        TUint32 HandleDuplicateL( TUint32 aUid );
+
+        
+        
+public:        
+        TUint32 EventStore() { return iEventStore; };
+        
+        
+            
+
+    private: //data
+        TBool                   iStartWithSelection;
+        TSelectionListType      iListType;
+        TSelectionMenuType      iSelMenuType;
+ 
+        TInt                    iIspFilter;
+        TInt                    iBearerFilter;
+        TApSetHandlerImplExtra* iExt;           // Extra data holder structure
+
+        TInt                    iReqIpvType;    // Default is IPv4
+
+        CApSettingsModel*       iModel;
+        CTextOverrides*         iTextOverrides;
+        TUint32                 iEventStore;    // to hold the events
+        TUid                    iHelpMajor;
+        TBool                   iNoEdit;
+
+#ifdef __TEST_OOMDEBUG
+        TBool                           iMemTestOn;
+#endif // __TEST_OOMDEBUG
+
+    };
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/inc/FeatureManagerWrapper.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,70 @@
+/*
+* Copyright (c) 2004 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 CFeatureManagerWrapper.
+*
+*/
+
+
+#ifndef FEATURE_MANAGER_WRAPPER_H
+#define FEATURE_MANAGER_WRAPPER_H
+
+// INCLUDE FILES
+#include    <e32base.h>        //CBase
+#include    <featmgr.h>
+
+// CLASS DECLARATION
+
+/**
+* CFeatureManagerWrapper wraps FeatureManager to eliminate 
+* maintenance of existance of FeatureManager.
+*/
+NONSHARABLE_CLASS( CFeatureManagerWrapper ) :  public CBase
+    {  
+   
+   public:
+
+       /**
+       * Destructor. Uninitalize FeatureManager.
+       */
+       virtual ~CFeatureManagerWrapper();
+    
+       /**
+       * Static constructor.
+       */
+       static CFeatureManagerWrapper* NewL();        
+        
+   protected:
+
+       /**
+       * Default constructor.
+       */
+       CFeatureManagerWrapper();
+
+       /**
+       * Second-phase constructor. Initialize FeatureManager
+       */
+       void ConstructL();
+   
+   private:
+
+       /**
+       * Indicates Featuremanger is initialized or not.
+       */
+       TBool iIsFeatureMgrInitialized; 
+    
+    };
+
+#endif
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/inc/TextOverrides.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,124 @@
+/*
+* Copyright (c) 2002 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: 
+*     Declares the CTextOverrides class.
+*
+*/
+
+
+#ifndef TEXT_OVERRIDES_H
+#define TEXT_OVERRIDES_H
+
+
+// INCLUDES
+#include <e32base.h>
+#include <commdb.h>
+
+#include <ApSettingsHandlerCommons.h>
+
+// CONST
+const TInt  KTxtOverrideGran   = KTTextIdMax+1;
+
+
+// CLASS DECLARATION
+/**
+* CTextOverrides class: It is a helper class for the Access Point settings.
+*
+*/
+NONSHARABLE_CLASS( CTextOverrides ) : public CBase
+    {
+
+    public: // Constructors and destructor
+
+
+        /**
+        * Two-phased constructor. Leaves on failure.
+        * @return The constructed CTextOverrides.
+        */
+        static CTextOverrides* NewL();
+
+
+        /**
+        * Destructor.
+        */
+        ~CTextOverrides();
+
+
+    protected:
+        /**
+        * Constructor.
+        */
+        CTextOverrides();
+
+
+        /**
+        * Second-phase constructor.
+        */
+        void ConstructL();
+
+
+
+    public: // New functions
+        /**
+        * Sets possible overrides of some texts.
+        * By default, text is read from resources. This provides a way to 
+        * change some of the text to a caller-supplied one. The text must 
+        * be read from resource and must be already localized.
+        * More than one text can be substituted, they are stored internally 
+        * in an array.
+        * @param aText2Change TTextID to identify the text to be replaced with
+        * @param aNewText Reference to the substitute text.
+        */
+        void SetTextOverrideL( TTextID aText2Change, const TDesC& aNewText );
+
+
+        /**
+        * Gets overrides of the given text.
+        * By default, text is read from resources. This provides a way to 
+        * change some of the text to a caller-supplied one. The text must 
+        * be read from resource and must be already localized.
+        * More than one text can be substituted, they are stored internally 
+        * in an array.
+        * @param aTextId TTextID type to identify the text to get
+        * @return Reference to the overriding text.
+        */
+        const TDesC& TextOverrideL( TTextID aTextId );
+
+        /**
+        * Checks whether a given text is overriden or not.
+        * By default, text is read from resources. This provides a way to 
+        * change some of the text to a caller-supplied one. The text must 
+        * be read from resource and must be already localized.
+        * More than one text can be substituted, they are stored internally
+        * in an array.
+        * @param aTextId TTextID type to identify the text to check
+        * @return Boolean indicatiing whether the given text is 
+        * overriden or not.
+        */
+        TBool IsTextOverridenL( TTextID aTextId );
+
+        /*
+        * Validates the passed ID. If invalid, leaves with KErrInvalidTextId
+        * @param aTextId The text ID to validate
+        */
+        void ValidateIdL( TTextID aTextId );
+
+    private: //data
+        CArrayPtrFlat<HBufC>*   iTxtArray;
+
+    };
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/inc/apsettingsui.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,257 @@
+/*
+* Copyright (c) 2002 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: 
+*     Declares the main handler, CApSettingsHandler and public API for the 
+*     Access Point settings.
+*
+*/
+
+
+#ifndef APSETTINGS_UI_H
+#define APSETTINGS_UI_H
+
+// INCLUDES
+#include <ApSettingsHandlerCommons.h>
+#include <ApEngineConsts.h>
+#include <ApSelect.h>
+
+// CONSTANTS
+
+
+// FORWARD DECLARATIONS
+class CActiveApDb;
+class CTextOverrides;
+
+class CApSettingsHandlerImpl;
+
+// CLASS DECLARATION
+/**
+* CApSettingsUi class: It is the main handler for the Access Point 
+* settings. It contains the only public API for other (sub)systems.
+*
+*/
+class CApSettingsUi : public CBase
+    {
+
+    public: // Constructors and destructor
+
+
+
+        /**
+        * Two-phased constructor. Leaves on failure.
+        * This function shall be used to create the access point 
+        * settings/selection handling UI object.It is customizable through the
+        * parameters. This object is a small layer above the UI part and
+        * it provides a standard interface to select, edit, create access 
+        * points. It has two main parts, Select and Edit. The first parameter, 
+        * aStartWithSelection gives whether we would like to select or edit.
+        * In case of selection, there is the possibility to use this module in
+        * many applications. For this, two layouts are implemented, one is 
+        * list pane used by General Settings which provides the list in a 
+        * list-pane. The other layout is for the other applications requiring 
+        * access point selection, a popup-list style as the decision was that 
+        * General Settings will use list-pane and all other apps. popup-list 
+        * style. It is the caller who selects the style so if spec. says 
+        * otherwise, this module still can be used.
+        * It is also possible to start the UI without selection, so if any 
+        * module has a 'linked/default/etc.' access point and stored it's UID,
+        * the module can simply call the editor part of the UI without having
+        * to select the AP once more.
+        * In case of editing only, (aStartWithSelection is EFalse), all other 
+        * construction parameters are ignored and after construction caller 
+        * can simply call DoRunSettingsL(..).
+        * In case of selection, a lot of other parameters can be specified to
+        * fulfil all requirements. There are three types of Options menu 
+        * available: EApSettingsSelMenuNormal, EApSettingsSelMenuSelectOnly,
+        * EApSettingsSelMenuSelectNormal.
+        * <br>
+        *-EApSettingsSelMenuSelectOnly: Only Select is visible, no way to edit,
+        *   delete, create, etc.
+        * <br>
+        * -EApSettingsSelMenuNormal:Options menu specified in General Settings,
+        *   contains Edit, Delete, Create new, etc. menu items.
+        * <br>
+        * -EApSettingsSelMenuSelectNormal: Same as in EApSettingsSelMenuNormal 
+        *   BUT the first item is Select. This one makes it possible to select 
+        *   an access point and also possible to edit, create, delete, etc.
+        * <br>
+        * The following three parameters specify the filtering and ordering 
+        * criteria for the selection list creation. First, it is possible to 
+        * specify which ISP-type we are looking for. The possible values are:
+        * <br>
+        * KEApIspTypeInternetOnly: Filter allows only access points that are 
+        *   capable of only internet access.
+        * <br>
+        * KEApIspTypeWAPOnly: Filter allows only access points that are 
+        *   capable of only WAP access.
+        * <br>
+        * KEApIspTypeInternetAndWAP: Filter allows only access points that are 
+        *   capable of internet AND WAP access.
+        * <br>
+        * KEApIspTypeWAPMandatory: Filter allows only access points that are 
+        *   capable of WAP access AND contain mandatory WAP settings.
+        * <br>
+        * KEApIspTypeAll: No filtering is done for the isp-type, all types of
+        *   access points are shown.
+        * <br>
+        * It is possible to combine them by simply adding/or-ing together the 
+        * values, filtering will be done in such a way that only access points 
+        * with the listed ISP-types will be shown.
+        * Second filtering possibility (aBearerFilter) is the desired bearer 
+        * type. The possible values are the values of the TApBearerType enum 
+        * type and their combinations, as in case of the ISP type.
+        * The ordering of the list can be specified with the aSortType 
+        * parameter. It can have the following values:
+        * KEApSortUidAscending: The sorting is done according to the ID of 
+        *   the access points in ascending order.
+        * KEApSortUidDescending: The sorting is done according to the ID of 
+        *   the access points in descending order.
+        * KEApSortNameAscending: The sorting is done according to the name of 
+        *   the access points in ascending order.
+        * KEApSortNameDescending: The sorting is done according to the name of 
+        *   the access points in descending order.
+        * Caution! The ordering values can not be combined!
+        * @param aStartWithSelection A boolean value indicating whether to 
+        *   select or edit an ap.
+        * @param aListType A TSelectionListType enum indicating the desired
+        *   list type.
+        * @param aSelMenuType A TSelectionMenuType enum indicating the desired
+        *   menu type.
+        * @param aIspTypeFilter Filtering criteria on ISP type
+        * @param aBearerFilter Filtering criteria on bearer type
+        * @param aSortType Specifies the sort order to use.
+        * @param aReqIpvType Specifies whether the caller would like to 
+        *   have IPv4, IPv6 or both access points. If it is IPv6 or Both, 
+        *   in case of IPv6 support is available as a feature, it will be 
+        *   supported. If IPv6 feature is not supported by the phone, it 
+        *   simply defaults to the normal IPv4 version.
+        *   If it is IPv4, it uses the default IPv4 version independently 
+        *   from IPv6 feature beeing available or not.
+        * @param aVpnFilterType a TVpnFilterType representing the possible 
+        *   additional VPN filtering.
+        * @return The constructed CApSettingsUi object.
+        *
+        * @deprecated
+        */
+        IMPORT_C static CApSettingsUi* NewLC(
+                        TBool aStartWithSelection,
+                        TSelectionListType aListType,
+                        TSelectionMenuType aSelMenuType,
+                        TInt aIspFilter,
+                        TInt aBearerFilter,
+                        TInt aSortType,
+                        TInt aReqIpvType,
+                        TVpnFilterType aVpnFilterType );
+
+
+        /**
+        * Destructor.
+        *
+        * @deprecated
+        */
+        IMPORT_C ~CApSettingsUi();
+
+
+    protected:
+
+        /**
+        * Constructor.
+        * @param aStartWithSelection A boolean value indicating whether to 
+        *   select or edit an ap.
+        * @param aListType A TSelectionListType enum indicating the desired
+        *   list type.
+        * @param aSelMenuType A TSelectionMenuType enum indicating the desired
+        *   menu type.
+        * @param aNeedIpv6Support Whether IPv6 is supported or not
+        */
+        CApSettingsUi( TBool aStartWithSelection,
+                       TSelectionListType aListType,
+                       TSelectionMenuType aSelMenuType,
+                       TBool aNeedIpv6Support );
+
+
+
+        /**
+        * Second-phase constructor.
+        * @param aIspTypeFilter Filtering criteria on ISP type
+        * @param aBearerFilter Filtering criteria on bearer type
+        * @param aSortType Specifies the sort order to use.
+        * @param aVpnFilterType a TVpnFilterType representing the possible 
+        *   additional VPN filtering.
+        *
+        * @deprecated
+        */
+        IMPORT_C void ConstructL(
+                                TInt aIspFilter,
+                                TInt aBearerFilter,
+                                TInt aSortType,
+                                TVpnFilterType aVpnFilterType
+                                );
+
+
+    public: // New functions
+
+        /**
+        * Starts the settings component.
+        * Creates dialog(s) from scratch, launches and executes them.
+        * Can leave with error codes.
+        * @param TUint32 aHighlight The UID of the AP to highlight by default
+        * @param TUint32 aSelected The UID of the access point selected 
+        * by the user.
+        * @return The accomplished task's flag-codes:
+        * <br>
+        * KApUiEventNone,
+        * <br>
+        * KApUiEventSelected,
+        * <br>
+        * KApUiEventCreatedBlank,
+        * <br>
+        * KApUiEventCreatedUsedOld,
+        * <br>
+        * KApUiEventEdited,
+        * <br>
+        * KApUiEventDeleted,
+        * <br>
+        * KApUiEventExitRequested
+        * <br>and their combinations. ( Bitwise OR )
+        * <br>
+        * aSelected will be modified only if KApUiEventSelected is included 
+        * in the flags.
+        * <br>
+        * In case it returns KApUiEventExitRequested, the user had choosen
+        * the Exit option from the Options menu which means
+        * that the caller application MUST exit!
+        * <br>
+        * Returns after completion!
+        *
+        * @deprecated
+        */
+        IMPORT_C TInt RunSettingsL( TUint32 aHighLight, TUint32& aSelected );
+
+
+    private: //data
+        TBool                   iStartWithSelection;
+        TSelectionListType      iListType;
+        TSelectionMenuType      iSelMenuType;
+
+        TInt                    iReqIpvType;    // Default is IPv4
+
+        CApSettingsHandlerImpl* iImpl;          // owned
+        
+
+    };
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/loc/apsettingshandlerui.loc	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,1195 @@
+/*
+* Copyright (c) 2002 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 a localisation file for ApSettingsHandlerUi
+*     A .loc file is the one and only place where the logical strings
+*     to be localised are defined.
+*
+*/
+
+
+
+// LOCALISATION STRINGS
+
+
+//d:Command in options menu.
+//d:Selects the currently selected access point.
+//l:list_single_pane_t1_cp2
+//w:
+//r:2.8
+//
+#define qtn_set_cmd_select "Select"
+
+
+//d:Command in options menu.
+//d:Opens the currently selected access point.
+//l:list_single_pane_t1_cp2
+//w:
+//r:2.8
+//
+#define qtn_set_cmd_edit_ap "Edit"
+
+
+
+//d:Command in options menu.
+//d:Create new access point top menu.
+//l:list_single_pane_t1_cp2
+//w:
+//r:2.8
+//
+#define qtn_set_cmd_new_ap "New access point"
+
+
+//d:Sub-command in options menu's qtn_set_cmd_new_ap.
+//d:Create new access point with default values.
+//l:list_single_popup_submenu_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_cmd_new_default "Default settings"
+
+
+//d:Sub-command in options menu's qtn_set_cmd_new_ap.
+//d:Create access point based on an existing one.
+//l:list_single_popup_submenu_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_cmd_new_existing "Use existing"
+
+
+
+//d:Command in options menu.
+//d:Deletes the currently selected access point.
+//l:list_single_pane_t1_cp2
+//w:
+//r:2.8
+//
+#define qtn_set_cmd_del_ap "Delete"
+
+
+//d:Command in options menu.
+//d:Opens help application with context sensitive help.
+//l:list_single_pane_t1_cp2
+//w:
+//r:2.8
+//
+#define qtn_set_options_help "Help"
+
+
+//d:Command in options menu.
+//d:Exits access point settings.
+//l:list_single_pane_t1_cp2
+//w:
+//r:2.8
+//
+#define qtn_set_options_exit "Exit"
+
+
+
+
+
+
+
+
+
+
+
+//d:Title pane text while in General settings' connection settings.
+//l:title_pane_t2/opt9
+//w:
+//r:2.8
+//
+#define qtn_set_title_settings_inet "Connection settings"
+
+
+
+//d:Title pane text while in General settings' connection settings.
+//l:title_pane_t2/opt9
+//w:
+//r:2.8
+//
+#define qtn_set_navi_ap "Access points"
+
+
+
+
+//d:User has tried to edit active access point.
+//d:Operation is refused with this info note.
+//l:popup_note_window
+//w:
+//r:2.8
+//
+#define qtn_set_note_ap_in_use_edit "Access point in use: Can't be edited."
+
+
+//d:User has tried to delete active access point.
+//d:Operation is refused with this info note.
+//l:popup_note_window
+//w:
+//r:2.8
+//
+#define qtn_set_note_ap_in_use_del "Access point in use: Can't be deleted."
+
+
+
+//d:User trying to delete last access point.
+//d:Operation is confirmed with this info note.
+//d:%U stands for the name of the connection.
+//l:popup_note_window
+//w:
+//r:2.8
+//
+#define qtn_set_note_delete_last_ap "%U connection is the only one. Are you sure to delete it?"
+
+
+
+//d:User enters access points list view and no connections exists.
+//d:User is offered a 'solution' with this info note.
+//l:popup_note_window
+//w:
+//r:3.1
+//
+#define qtn_set_ap_create_new "No access points defined. Define now?"
+
+
+//d:User trying to delete access point which is linked to any other application.
+//d:Operation is confirmed with this info note.
+//l:popup_note_window
+//w:
+//r:2.8
+//
+#define qtn_set_ap_delete_linked "Access point linked to another application.Are you sure to delete?"
+
+
+
+//d:User steps back from access point editing while Access Number field for data call is still empty.
+//d:Operation is confirmed with this confirmation query.
+//l:popup_note_window
+//w:
+//r:2.8
+//
+#define qtn_set_ap_access_number_not "Access point can't\n be saved without \naccess number.\nDelete it?"
+
+
+
+
+
+
+
+//d:Command in options menu in access points view.
+//d:Modifies the currently selected access point.
+//l:list_single_pane_t1_cp2
+//w:
+//r:2.8
+//
+#define qtn_set_options_change "Change"
+
+
+//d:Command in options menu in access points view.
+//d:Opens advanced settings for the access point.
+//l:list_single_pane_t1_cp2
+//w:
+//r:2.8
+//
+#define qtn_set_options_ap_advanced "Advanced settings"
+
+
+
+
+
+// localisation info for the access point setting view/edit part
+// all strings below are items for list_setting_item
+//
+// "Common" for all access point bearer types
+
+//d:Item text in setting list.
+//d:The name of the connection
+//l:list_setting_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_ap_conn_name "Connection name"
+
+
+//d:Item text in setting list.
+//d:The name of the bearer type.
+//l:list_setting_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_ap_bearer "Bearer type"
+
+
+//d:Item text in setting list.
+//d:Indicates whether connection is secure/unsecure (result: On/Off)
+//l:list_setting_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_wtls_security "WTLS security"
+
+
+//d:Item text in setting list.
+//d:Indicates whether the connection type is continuous or temporary
+//l:list_setting_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_conn_type "Connection type"
+
+
+// for GPRS bearer
+//d:Item text in setting list.
+//d:The name of the GPRS access point
+//l:list_setting_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_access_point_name "Access point name"
+
+
+//d:Item text in setting list.
+//d:The user name
+//l:list_setting_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_ap_username "User name"
+
+
+//d:Item text in setting list.
+//d:Prompt password? (Yes/No)
+//l:list_setting_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_prompt_passwd "Prompt password"
+
+
+//d:Item text in setting list.
+//l:list_setting_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_ap_passwd "Password"
+
+
+//d:Item text in setting list.
+//d:Indicates whther password authentication is secure or normal
+//l:list_setting_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_passwd_aut "Password authentication"
+
+
+//d:Item text in setting list.
+//l:list_setting_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_gateway_ip "Wap Gateway IP address"
+
+
+//d:Item text in setting list.
+//d:The starting page for this access point.
+//l:list_setting_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_starting_page "Starting page"
+
+
+// for GPRS Advanced
+//d:Item text in setting list.
+//l:list_setting_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_ip_address "Phone IP address"
+
+
+//d:Item text in setting list.
+//l:list_setting_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_primary_dns "Primary Name Server"
+
+
+//d:Item text in setting list.
+//l:list_setting_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_secondary_dns "Secondary Name Server"
+
+
+
+// for CSD
+//d:Item text in setting list.
+//l:list_setting_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_access_number "Access Number"
+
+
+//d:Item text in setting list.
+//d:Indicates whether data call is analogue or ISDN
+//l:list_setting_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_data_call_type "Data call type"
+
+
+//d:Item text in setting list.
+//d:The max. connection speed
+//l:list_setting_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_max_speed "Max. connection speed"
+
+
+// for CSD Advanced
+//d:Item text in setting list.
+//l:list_setting_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_use_cb "Use call back"
+
+
+//d:Item text in setting list.
+//l:list_setting_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_cb_type "Call back type"
+
+
+//d:Item text in setting list.
+//l:list_setting_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_cb_number "Call back number"
+
+
+//d:Item text in setting list.
+//d:Indicates whether to use PPP compression or not
+//l:list_setting_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_ppp_comp "Enable PPP compression"
+
+
+//d:Item text in setting list.
+//l:list_setting_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_use_logins "Use login script"
+
+
+//d:Item text in setting list.
+//l:list_setting_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_modem_init_string "Modem init string"
+
+
+// 'Textual' but fixed values for settings
+
+//d:The bearer type is packet data
+//l:list_set_graphic_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_bearer_packet_data "Packet data"
+
+//d:The bearer type is data call
+//l:list_set_graphic_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_bearer_data_call "Data call"
+
+
+//d:The bearer type is HSCSD data call
+//l:list_set_graphic_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_netw_sett_bearer_hscsd "HSCSD call"
+
+
+//d:Answer to: Prompt for password?
+//l:list_set_graphic_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_prompt_passwd_yes "Yes"
+
+
+//d:Answer to: Prompt for password?
+//l:list_set_graphic_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_prompt_passwd_no "No"
+
+
+//d:Answer to: qtn_set_passwd_aut,
+//d:whether password authentication is secure or normal
+//l:list_set_graphic_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_passwd_aut_normal "Normal"
+
+
+//d:Answer to: qtn_set_passwd_aut,
+//d:whether password authentication is secure or normal
+//l:list_set_graphic_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_passwd_aut_secure "Secure"
+
+
+//d:The IP address is dynamic.
+//l:list_set_graphic_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_ip_address_dynamic "Dynamic"
+
+
+//d:Answer to: qtn_set_wtls_security
+//d:whether connection is secured or not
+//l:list_set_graphic_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_wtls_security_on "On"
+
+
+//d:Answer to: qtn_set_wtls_security
+//d:whether connection is secured or not
+//l:list_set_graphic_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_wtls_security_off "Off"
+
+
+//d:Answer to: qtn_set_conn_type
+//d:connection type is continuous
+//l:list_set_graphic_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_conn_type_contin "Continuous"
+
+
+//d:Answer to: qtn_set_conn_type
+//d:connection type is temporary
+//l:list_set_graphic_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_conn_type_temp "Temporary"
+
+
+//d:Answer to: qtn_set_data_call_type
+//d:The data call type is analogue
+//l:list_set_graphic_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_data_call_analolgue "Analogue"
+
+
+//d:Answer to: qtn_set_data_call_type
+//d:The data call type is ISDN v.110
+//l:list_set_graphic_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_data_call_isdn_110 "ISDN v.110"
+
+
+//d:Answer to: qtn_set_data_call_type
+//d:The data call type is ISDN v.120
+//l:list_set_graphic_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_data_call_isdn_120 "ISDN v.120"
+
+
+//d:Answer to: qtn_set_max_speed
+//l:list_set_graphic_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_speed_auto_detect "Auto detect"
+
+
+//d:Answer to: qtn_set_use_cb
+//d: Use call back.
+//l:list_set_graphic_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_use_cb_yes "Yes"
+
+
+//d:Answer to: qtn_set_use_cb
+//d:Do not use call back.
+//l:list_set_graphic_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_use_cb_no "No"
+
+
+//d:Answer to: qtn_set_cb_type
+//d:Use server number for call back.
+//l:list_set_graphic_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_use_server_number "Use server number"
+
+
+//d:Answer to: qtn_set_cb_type
+//d:Use other number for call back.
+//l:list_set_graphic_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_use_other_number "Use other number"
+
+
+//d:Answer to: qtn_set_ppp_comp
+//l:list_set_graphic_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_ppp_comp_yes "Yes"
+
+
+//d:Answer to: qtn_set_ppp_comp
+//l:list_set_graphic_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_ppp_comp_no "No"
+
+
+//d:Answer to: qtn_set_use_logins
+//l:list_set_graphic_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_use_logins_no "no"
+
+
+//d:Answer to: qtn_set_use_logins
+//l:list_set_graphic_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_use_logins_yes "yes"
+
+
+//d:Prompt text when creating new access point based on an already existing value
+//l:heading_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_new_ap_prompt_list "Use existing connection:"
+
+
+//d:Item text in setting list.
+//l:list_setting_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_login_script "Login script"
+
+
+
+//d:Text used as prompt text in a text setting item
+//l:list_setting_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_default_ap "Default Access Point"
+
+
+
+// not part of spec but added it
+//d:After editing an access point, info after succesful save
+//l:popup_note_window
+//w:
+//r:2.8
+//
+#define qtn_set_ap_saved "Saved"
+
+
+// not part of spec but added it
+//d:User IS in access points list view and no connections exists.
+//d:User is informed of having 0 access points with this 'empty list text'.
+//l:main_list_empty_pane
+//w:
+//r:2.8
+//
+#define qtn_set_ap_none_defined "No access point connections defined."
+
+
+
+//d:When a compulsory setting is not filled, this string indicates that it is compulsory.
+//l:list_set_graphic_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_compulsory "Compulsory"
+
+
+
+//d:When no access point is selected, the text None indicates this.
+//l:list_set_graphic_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_mce_settings_mms_none "None"
+
+
+//d: When the entered phonennumber is invalid, this information note is shown
+//l: popup_note_window
+//w:
+//r:2.8
+//
+#define qtn_info_invalid_number "Invalid number"
+
+
+//d: When the entered connection name is invalid, this information note is shown
+//l: popup_note_window
+//w:
+//r:2.8
+//
+#define qtn_info_invalid_conn_name "Invalid connection name"
+
+
+//d:%U stands for the name of the connection.
+//l: popup_note_wait_window
+//w:
+//r:2.8
+//
+#define qtn_set_wait_deleting_ap "Deleting %U"
+
+
+
+//d:Error note message: database is inaccessible.
+//l:popup_note_window
+//w:
+//r:2.8
+//
+#define qtn_set_err_db_inaccessible    "Cannot access\ndatabase.\nTry again later."
+
+
+
+
+//d:Item text in setting list.
+//l:list_setting_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_proxy_server_address "Proxy server address"
+
+
+//d:Item text in setting list.
+//l:list_setting_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_proxy_port_number "Port Number"
+
+
+
+//d:Item text in setting list.
+//l:list_setting_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_network_group "Network group"
+
+
+
+//d:Command in options menu.
+//d:Creates a new network group.
+//l:list_single_pane_t1_cp2
+//w:
+//r:2.8
+//
+#define qtn_set_cmd_new_netw_group "Create new group"
+
+
+
+//d:When there is no homepage value set, it is indicated with the text: none 
+//l:list_set_graphic_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_home_page_none "None"
+
+
+//d:If user selected a  WCDMA specific speed, this string presented to confirm it.
+//l:popup_note_window
+//w:
+//r:2.8
+//
+#define qtn_set_conf_max_speed_only_3g "Selected speed is available only in third generation mobile network. Continue?"
+
+
+//d:Item text in setting list. Gives the network type (whether it is IP4 or IP6)
+//l:list_setting_pane_t1
+//w:
+//r:2.8
+//
+#define  qtn_set_network_type "Network type"
+ 
+
+//d: States that the network type is IP4
+//l:list_set_graphic_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_nw_type_ipv4 "IPv4"
+
+
+//d: States that the network type is IP6
+//l:list_set_graphic_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_nw_type_ipv6 "IPv6"
+
+
+//d:Item text in setting list. Offers IPv4 settings to be changed
+//l:list_setting_pane_t1
+//w:
+//r:2.8
+//
+#define  qtn_set_ipv4_settings "IPv4 settings"
+
+
+//d:Item text in setting list. Offers IPv6 settings to be changed
+//l:list_setting_pane_t1
+//w:
+//r:2.8
+//
+#define  qtn_set_ipv6_settings "IPv6 settings"
+
+
+//d:Item text in setting list. Entrance for the Domain name servers settings
+//l:list_setting_pane_t1
+//w:
+//r:2.8
+//
+#define  qtn_set_dns_servers_ip "Domain name servers"
+
+
+//d: When the entered IP address is not a valid IP address, this error note is shown
+//l: popup_note_window
+//w:
+//r:2.8
+//
+#define qtn_set_info_invalid_ip "Invalid IP address"
+
+
+//d: Name server IP address is user defined
+//l:list_set_graphic_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_ip_user_defined "User defined"
+
+
+//d: Name server IP address is well-known
+//l:list_set_graphic_pane_t1
+//w:
+//r:2.8
+//
+#define qtn_set_ip_well_known "Well-known"
+
+
+
+//d:If user selected a  VPN access point for editing, this string presented to inform the user that 
+// to edit a VPN access point, he/she must use the VPN Settings UI
+//l:popup_note_window
+//w:
+//r:2.8
+//
+#define qtn_set_note_vpn_ap_sett "VPN access point, use VPN settings to edit it."
+
+
+//d:User has tried to delete a protected access point.
+//d:Operation is refused with this info note.
+//l:popup_note_window
+//w:
+//r:2.8
+//
+#define qtn_set_note_protected_ap "Protected Access point: Can’t be deleted"
+
+
+//d:User has tried to open a protected access point.
+//d:Operation is refused with this info note.
+//l:popup_note_window
+//w:
+//r:2.8
+//
+#define qtn_set_note_protected_ap_sett  "Protected setting: Can’t be opened"
+
+
+//d:User trying to delete access point, which is linked to an existing another VPN access point.
+//d:Operation is confirmed with this info note.
+//d:%U stands for the name of the VPN connection.
+//l:popup_note_window
+//w:
+//r:2.8
+//
+#define qtn_vpn_quest_delete_iap_associated "Access point is associated with a VPN access point ’%U’. Delete anyway?"
+
+
+//d:User trying to copy a protected access point
+//d:Operation is denied with this info note.
+//l:popup_note_window
+//w:
+//r:2.8
+//
+#define qtn_netw_info_cannot_use_protected_ap "Unable to use protected access point"
+
+
+
+
+//d:User name if left empty
+//l:list_set_graphic_pane_t1
+//w:
+//r:2.8
+#define qtn_set_ap_username_none "None"
+
+
+//d:Domain name servers 'Automatic'
+//l:list_set_graphic_pane_t1
+//w:
+//r:2.8
+#define qtn_set_dns_servers_automatic "Automatic"
+
+
+//d:Primary name server & Secondary name server value 'Automatic' if left empty
+//l:list_set_graphic_pane_t1
+//w:
+//r:2.8
+#define qtn_set_dns_server_automatic "Automatic"
+
+
+//d:Text to be displayed when proxy server address is left empty
+//l:list_set_graphic_pane_t1
+//w:
+//r:2.8
+#define qtn_set_proxy_server_address_none "None"
+
+
+//d:Text to be displayed when the callback number is left empty
+//l:list_set_graphic_pane_t1
+//w:
+//r:2.8
+#define qtn_set_cb_number_none "None"
+
+
+//d:Text to be displayed when the login script number is left empty
+//l:list_set_graphic_pane_t1
+//w:
+//r:2.8
+#define qtn_set_login_script_none "None"
+
+
+//d:Text to be displayed when the modem init string is left empty
+//l:list_set_graphic_pane_t1
+//w:
+//r:2.8
+#define qtn_set_modem_init_none "None"
+
+
+
+
+
+
+// WLAN loc strings
+
+
+
+//d:The bearer type is Wireless LAN
+//l:list_set_graphic_pane_t1
+//w:
+//r:3.0
+//
+#define qtn_wlan_sett_bearer_wlan "Wireless LAN"
+
+
+//d:Item text in setting list.
+//d:The WLAN network name
+//l:list_setting_pane_t1
+//w:
+//r:3.0
+//
+#define qtn_wlan_sett_network_name "WLAN network name"
+
+
+//d:Defines the WLAN network mode, i.e. either infrastructure or ad-hoc.
+//l:list_setting_pane_t1
+//w:
+//r:3.0
+//
+#define qtn_wlan_sett_network_mode "WLAN network mode"
+
+
+//d:Defines the WLAN security mode, i.e. Open, WEP, 802.1x, WPA.
+//l:list_setting_pane_t1
+//w:
+//r:3.0
+//
+#define qtn_wlan_sett_security_mode "WLAN security mode"
+
+
+
+//d:Selecting it will open the WLAN security settings
+//l:list_setting_pane_t1
+//w:
+//r:3.0
+//
+#define qtn_wlan_sett_security_settings "WLAN security settings"
+
+
+//d:Specifies that the network mode is Infrastructure
+//l:list_set_graphic_pane_t1
+//w:
+//r:3.0
+//
+#define qtn_wlan_sett_network_mode_infra "Infrastructure"
+
+
+//d:Specifies that the network mode is Ad-hoc
+//l:list_set_graphic_pane_t1
+//w:
+//r:3.0
+//
+#define qtn_wlan_sett_network_mode_adhoc "Ad-hoc"
+
+
+//d:Specifies that the security mode is Open network
+//l:list_set_graphic_pane_t1
+//w:
+//r:3.0
+//
+#define qtn_wlan_sett_security_mode_open "Open network"
+
+
+//d:Specifies that the security mode is WEP
+//l:list_set_graphic_pane_t1
+//w:
+//r:3.0
+//
+#define qtn_wlan_sett_security_mode_wep "WEP"
+
+
+//d:Specifies that the security mode is 802.1x
+//l:list_set_graphic_pane_t1
+//w:
+//r:3.0
+//
+#define qtn_wlan_sett_security_mode_802_1x "802.1x"
+
+
+//d:Specifies that the security mode is WPA
+//l:list_set_graphic_pane_t1
+//w:
+//r:3.0
+//
+#define qtn_wlan_sett_security_mode_wpa "WPA/WPA2"
+
+
+//d:Specifies that the WLAN network name is user defined
+//l:list_set_graphic_pane_t1
+//w:
+//r:3.0
+//
+#define qtn_wlan_sett_network_name_user_defined "User defined"
+
+
+//d:Specifies that the WLAN network name is selected from a scanned list
+//l:list_set_graphic_pane_t1
+//w:
+//r:3.0
+//
+#define qtn_wlan_sett_network_name_scan "Scan for networks"
+
+
+
+//d:User has tried to save incomplete WLAN access point.
+//d:Operation is refused with this info note.
+//l:popup_note_window
+//w:
+//r:3.0
+//
+#define qtn_wlan_quest_nw_name_not_defined "Incomplete details. WLAN network name must be defined.Delete access point?"
+
+
+
+//d:Defines the WLAN subnet mask to be used
+//l:list_setting_pane_t1
+//w:
+//r:3.0
+//
+#define qtn_netw_sett_subnet_mask "Subnet mask"
+
+
+//d:Defines the WLAN default gateway to be used
+//l:list_setting_pane_t1
+//w:
+//r:3.0
+//
+#define qtn_netw_sett_default_gateway "Default gateway"
+
+
+
+//d:Informs that the selected Open Network does not has security settings.
+//l:popup_note_window
+//w:
+//r:3.0
+//
+#define qtn_wlan_info_no_security_settings "No security settings for ’Open network’"
+
+
+//d:Prompt text for WLAN network name query.
+//l:heading_pane_t1
+//w:
+//r:3.0
+//
+#define qtn_wlan_prmpt_network_name "WLAN network name:"
+
+
+//d:User tries to save an access point which has some compulsory fields which are not filled.
+//d:Operation is confirmed with this confirmation query.
+//l:popup_note_window
+//w:
+//r:3.0
+//
+#define qtn_netw_quest_iap_incomplete_delete "Incomplete access point details. Exit without saving?"
+
+
+
+//d:Prompt text for Ad-hoc channel name query.
+//l:popup_query_data_window
+//w:
+//r:3.0
+//
+#define qtn_wlan_prmpt_adhoc_channel "Ad-hoc channel"
+
+
+//d:Setting item text for Ad-hoc channel.
+//l:list_setting_pane_t1
+//w:
+//r:3.0
+//
+#define qtn_wlan_sett_adhoc_channel "Ad-hoc channel"
+
+
+//d:Defines the ad-hoc channel to be automatic
+//l:list_set_graphic_pane_t1
+//w:
+//r:3.0
+//
+#define qtn_wlan_sett_adhoc_channel_automatic "Automatic"
+
+
+//d:Defines the ad-hoc channel to be user defined
+//l:list_set_graphic_pane_t1
+//w:
+//r:3.0
+//
+#define qtn_wlan_sett_adhoc_channel_user_defined "User defined"
+
+
+//d:User steps back from access point editing while the securuty settings' compulsory fields are not filled.
+//d:Operation is confirmed with this confirmation query.
+//l:popup_note_window
+//w:
+//r:3.0
+//
+#define qtn_wlan_quest_security_settings_empty "Security settings for the selected security mode are incomplete.\nDelete access point?"
+
+
+///d:Item text in setting list "Hidden network"
+//l:list_setting_pane_t1
+//w:
+//r:3.0
+//
+#define qtn_wlan_sett_hidden_network "Hidden network"
+
+
+//d:Option of hidden network
+//l:list_set_graphic_pane_t1
+//w:
+//r:3.0
+//
+#define qtn_wlan_sett_hidden_network_no "No"
+
+
+//d:Option of hidden network
+//l:list_set_graphic_pane_t1
+//w:
+//r:3.0
+//
+#define qtn_wlan_sett_hidden_network_yes "Yes"
+
+
+//d:User is duplicating an access point.
+//d:Options menu item.
+//l:list_single_pane_t1_cp2
+//w:
+//r:3.1
+//
+#define qtn_netw_options_duplicate_iap "Duplicate"
+
+
+//d:User enters access points list view and no connections exists.
+//d:User is informed about it and a 'solution' is offered with this info note.
+//l:popup_note_window
+//w:
+//r:3.1
+//
+#define qtn_netw_info_no_iap_defined "No access points defined. Define one via Connection settings."
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/src/AccessPointTextSettingPage.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,94 @@
+/*
+* Copyright (c) 2002 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 CAccessPointTextSettingPage.
+*
+*/
+
+
+// INCLUDE FILES
+
+
+#include "AccessPointTextSettingPage.h"
+#include <akntextsettingpage.h>
+
+#include <AknInputLanguageInfo.h>  // for AVKON ELAF
+#include <featmgr.h>
+#include "ApSettingsHandlerLogger.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+
+// ---------------------------------------------------------
+// CAccessPointTextSettingPage::CAccessPointTextSettingPage
+// ---------------------------------------------------------
+//
+CAccessPointTextSettingPage::CAccessPointTextSettingPage
+                                        ( TInt aResourceID,
+                                          TDes& aText,
+                                          TInt aTextSettingPageFlags,
+                                          TBool aIsLatin )
+    :CAknTextSettingPage( aResourceID, aText, aTextSettingPageFlags )
+    {
+    APSETUILOGGER_ENTERFN( EOther,"TxtSetPage::CAccessPointTextSettingPage<->")
+    iIsLatin = aIsLatin;
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CAccessPointTextSettingPage::CAccessPointTextSettingPage
+// ---------------------------------------------------------
+//
+CAccessPointTextSettingPage::CAccessPointTextSettingPage
+                                    ( const TDesC* aSettingTitleText,
+                                      TInt aSettingNumber,
+                                      TInt aControlType,
+                                      TInt aEditorResourceId,
+                                      TInt aSettingPageResourceId,
+                                      TDes& aText,
+                                      TInt aTextSettingPageFlags,
+                                      TBool aIsLatin )
+    :CAknTextSettingPage( aSettingTitleText, aSettingNumber, aControlType,
+    aEditorResourceId, aSettingPageResourceId, aText, aTextSettingPageFlags )
+    {
+    APSETUILOGGER_ENTERFN( EOther,"TxtSetPage::CAccessPointTextSettingPage<->")
+    iIsLatin = aIsLatin;
+    }
+
+// ---------------------------------------------------------
+// CAccessPointTextSettingPage::ConstructL
+// ---------------------------------------------------------
+//
+void CAccessPointTextSettingPage::ConstructL()
+    {
+    APSETUILOGGER_ENTERFN( EOther,"TxtSetPage::ConstructL")
+    
+    CAknTextSettingPage::ConstructL();
+    FeatureManager::InitializeLibL();
+    TBool avkonElaf = FeatureManager::FeatureSupported( KFeatureIdAvkonELaf );
+    FeatureManager::UnInitializeLib();
+    if ( avkonElaf && iIsLatin )
+        {
+        CAknInputLanguageInfo* inputLangInfo =
+                AknInputLanguageInfoFactory::CreateInputLanguageInfoL();
+        TextControl()->SetAknEditorLocalLanguage
+                                ( inputLangInfo->UrlLanguage() );
+        delete inputLangInfo;
+        }
+    
+    APSETUILOGGER_LEAVEFN( EOther,"TxtSetPage::ConstructL")
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/src/ApMultiLineDataQueryDialog.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,77 @@
+/*
+* Copyright (c) 2002 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 CApMultiLineDataQueryDialog.
+*
+*/
+
+
+// INCLUDE FILES
+
+
+#include    "ApMultiLineDataQueryDialog.h"
+#include    "ApSettingsHandlerLogger.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+
+// ---------------------------------------------------------
+// CApMultiLineDataQueryDialog::NewL
+// ---------------------------------------------------------
+//
+CApMultiLineDataQueryDialog* CApMultiLineDataQueryDialog::NewL(
+                           TDes&  aText1, TDes&  aText2,
+                           TTone aTone )
+    {
+    APSETUILOGGER_ENTERFN( EOther,"MultiQuery::NewL")
+    
+    CApMultiLineDataQueryDialog* self = 
+        new (ELeave) CApMultiLineDataQueryDialog(aTone);
+    CleanupStack::PushL(self);
+
+    self->SetDataL( aText1, aText2 );
+
+    CleanupStack::Pop(self);
+    
+    APSETUILOGGER_LEAVEFN( EOther,"MultiQuery::NewL")
+    return self;
+    }
+
+
+// ---------------------------------------------------------
+// CApMultiLineDataQueryDialog::CApMultiLineDataQueryDialog
+// ---------------------------------------------------------
+//
+CApMultiLineDataQueryDialog::CApMultiLineDataQueryDialog( const TTone& aTone )
+: CAknMultiLineDataQueryDialog( aTone )
+    {
+    APSETUILOGGER_ENTERFN( EOther,"MultiQuery::CApMultiLineDataQueryDialog<->")
+    }
+
+
+// ---------------------------------------------------------
+// CApMultiLineDataQueryDialog::UpdateLeftSoftKeyL
+// ---------------------------------------------------------
+//
+void CApMultiLineDataQueryDialog::UpdateLeftSoftKeyL()
+    {
+    APSETUILOGGER_ENTERFN( EOther,"MultiQuery::UpdateLeftSoftKeyL")
+    
+    CAknMultiLineDataQueryDialog::UpdateLeftSoftKeyL();
+    MakeLeftSoftkeyVisible( ETrue );
+    
+    APSETUILOGGER_LEAVEFN( EOther,"MultiQuery::UpdateLeftSoftKeyL")
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/src/ApNetSelPopupList.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,682 @@
+/*
+* Copyright (c) 2002 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 CApNetSelPopupList for access point selection.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <ApNetworkItem.h>
+#include <csxhelp/cp.hlp.hrh>
+#include <featmgr.h>
+
+#include "ApSettingsHandlerUI.hrh"
+ 
+
+#include "ApNetSelPopupList.h"
+#include "ApNetSelectorListBoxModel.h"
+#include "ApSettingsModel.h"
+#include <ApSetUI.rsg>
+#include "ApsettingshandleruiImpl.h"
+
+
+#include "ApSettingsHandlerLogger.h"
+
+#include "AccessPointTextSettingPage.h"
+
+
+
+#include <ApProtHandler.h>  // for protection of settings
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CApNetSelPopupList::NewL
+// ---------------------------------------------------------
+//
+CApNetSelPopupList* CApNetSelPopupList::NewL( CApSettingsModel& aModel,
+                                       CApSettingsHandlerImpl& aHandler,
+                                       TInt& aCurrentSelectionIndex,
+                                       TInt& aPreferredUid,
+                                       TUint32& aEventStore,
+                                       CDesCArrayFlat* aItemArray,
+                                       TBool aNeedsNone )
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"NetSelPopup::NewL")
+    
+    CApNetSelPopupList* self = 
+        new ( ELeave ) CApNetSelPopupList(
+                                         aModel, aHandler,
+                                         aCurrentSelectionIndex,
+                                         aPreferredUid, aItemArray,
+                                         aEventStore, aNeedsNone
+                                         );
+//  till that point, object is only partially constructed!
+    
+    APSETUILOGGER_LEAVEFN( EListbox,"NetSelPopup::NewL")
+    return self;
+    }
+
+
+// ---------------------------------------------------------
+// CApNetSelPopupList::ConstructL
+// ---------------------------------------------------------
+//
+void CApNetSelPopupList::ConstructL()
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"NetSelPopup::ConstructL")
+
+    FeatureManager::InitializeLibL();
+    iHelpSupported = FeatureManager::FeatureSupported( KFeatureIdHelp );
+    iProtectionSupported = FeatureManager::FeatureSupported( 
+                                           KFeatureIdSettingsProtection );
+    FeatureManager::UnInitializeLib();
+    
+    CAknRadioButtonSettingPage::ConstructL();
+    iList = ListBoxControl();
+    iModel = new( ELeave )CApNetSelectorListboxModel();
+    iList->Model()->SetItemTextArray( iModel );
+    FillListBoxWithDataL();
+    iDataModel->Database()->AddObserverL( this );
+    
+    APSETUILOGGER_LEAVEFN( EListbox,"NetSelPopup::ConstructL")
+    }
+
+
+// Destructor
+CApNetSelPopupList::~CApNetSelPopupList()
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"NetSelPopup::~CApNetSelPopupList")
+    
+    if ( iDataModel )
+        {
+        if ( iDataModel->Database() )
+            {
+            // must remove observer here as there is a chance that we do not exit
+            // through the standard way but through Leave(KErrLeaveWithoutAlert)...
+            iDataModel->Database()->RemoveObserver( this );            
+            }
+        }
+    if ( iModel )
+        {
+        iModel->ResetAndDestroy();
+        delete iModel;
+        }
+    
+    APSETUILOGGER_LEAVEFN( EListbox,"NetSelPopup::~CApNetSelPopupList")
+    }
+
+
+
+// Constructor
+CApNetSelPopupList::CApNetSelPopupList(
+                                 CApSettingsModel& aModel,
+                                 CApSettingsHandlerImpl& aHandler,
+                                 TInt& aIndex, TInt& aPreferredUid,
+                                 CDesCArrayFlat* aItemArray,
+                                 TUint32& aEventStore, TBool aNeedsNone
+                                 )
+:CAknRadioButtonSettingPage( R_POPUP_LIST_NETWORK_SETTING_PAGE, 
+                             aIndex, aItemArray ),
+iDataModel( &aModel ),
+iSelected( &aPreferredUid ),
+iHandler( &aHandler ),
+iEventStore( &aEventStore ),
+iNeedsNone( aNeedsNone ),
+iNeedUnlock( EFalse )
+    {
+    }
+
+
+
+
+
+// ---------------------------------------------------------
+// CApNetSelPopupList::SetHighlighted()
+// called when needs to change the highlighting
+// ---------------------------------------------------------
+//
+void CApNetSelPopupList::SetHighlighted()
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"NetSelPopup::SetHighlighted")
+    
+    if ( iPreferredUid )
+        {
+        TInt err( KErrNone );
+        TInt idx = iModel->Item4Uid( iPreferredUid, err );
+        // if UID exists, set as current, else set 0 as current.
+        if ( err == KErrNone )
+            {
+            iList->SetCurrentItemIndexAndDraw( idx );
+            iPreferredUid = 0;
+            }
+        else
+            {
+            iList->SetCurrentItemIndexAndDraw( 0 );
+            }
+        }
+    
+    APSETUILOGGER_LEAVEFN( EListbox,"NetSelPopup::SetHighlighted")
+    }
+
+
+// ---------------------------------------------------------
+// CApNetSelPopupList::GetHelpContext()
+// ---------------------------------------------------------
+//
+void CApNetSelPopupList::GetHelpContext(TCoeHelpContext& aContext) const
+    {
+    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")
+    }
+
+
+// ---------------------------------------------------------
+// CApNetSelPopupList::HandleApDbEventL
+// called by the active access point framework
+// ---------------------------------------------------------
+//
+void CApNetSelPopupList::HandleApDbEventL( TEvent anEvent )
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"NetSelPopup::HandleApDbEventL")
+    
+    switch ( anEvent )
+        {
+        case EDbChanged:
+            {
+            FillListBoxWithDataL();
+            break;
+            }
+        case EDbClosing:
+            {
+            break;
+            }
+        case EDbAvailable:
+            {
+            if ( iNeedUnlock )
+                {
+                FillListBoxWithDataL();
+                }
+            break;
+            }
+        default:
+            {
+            __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) );
+            break;
+            }
+        }
+    
+    APSETUILOGGER_LEAVEFN( EListbox,"NetSelPopup::HandleApDbEventL")
+    }
+
+
+// ---------------------------------------------------------
+// CApNetSelPopupList::ActivateL()
+// called after the dialog is shown
+// used to handle empty list - query
+// ---------------------------------------------------------
+//
+void CApNetSelPopupList::ActivateL()
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"NetSelPopup::ActivateL")
+    
+    CAknRadioButtonSettingPage::ActivateL();
+    
+    APSETUILOGGER_LEAVEFN( EListbox,"NetSelPopup::ActivateL")
+    }
+
+
+
+// ---------------------------------------------------------
+// CApNetSelPopupList::SelectCurrentItemL()
+// called after the setting had been changed
+// ---------------------------------------------------------
+//
+void CApNetSelPopupList::SelectCurrentItemL()
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"NetSelPopup::SelectCurrentItemL")
+    
+    CAknRadioButtonSettingPage::SelectCurrentItemL();
+    TInt idx = iList->CurrentItemIndex();
+    if ( idx >= 0 )
+        {
+        *iSelected = iModel->At( idx )->Uid();
+        }
+    
+    APSETUILOGGER_LEAVEFN( EListbox,"NetSelPopup::SelectCurrentItemL")
+    }
+
+
+
+// ---------------------------------------------------------
+// CApNetSelPopupList::OkToExitL( TInt aButtonId )
+// called by framework when the OK button is pressed
+// ---------------------------------------------------------
+//
+TBool CApNetSelPopupList::OkToExitL( TInt aButtonId )
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"NetSelPopup::OkToExitL")
+    
+    // Translate the button presses into commands for the appui & current
+    // view to handle.
+    // This is a very good thing, that aButtonId is a TInt,
+    // but the caller ( CAknSettingPage ) simply uses a TBool.
+    // The value of ETrue means the button usually for Yes, Ok, Options, etc
+    // and EFalse means Back, Cancel, etc.
+    // so we must act according to a boolean value and not
+    // according to the real button id...
+    TBool IsAccepted = aButtonId;
+
+    if ( IsAccepted )
+        {
+        TInt idx = iList->CurrentItemIndex();
+        if ( idx >= 0 )
+            {
+            *iSelected = iModel->At( idx )->Uid();
+            }
+        }
+    
+    APSETUILOGGER_LEAVEFN( EListbox,"NetSelPopup::OkToExitL")
+    return ETrue;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApNetSelPopupList::FillListBoxWithDataL()
+// called when listbox needs to be filled with data
+// ---------------------------------------------------------
+//
+void CApNetSelPopupList::FillListBoxWithDataL()
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"NetSelPopup::FillListBoxWithDataL")
+    
+    iPreferredLine = iList->CurrentItemIndex();
+    if ( iPreferredLine < 0 )
+        {
+        iPreferredLine = 0;
+        }
+
+    if ( !iPreferredUid )
+        { // if not specified explicitly, get current and use as 'preferred'
+        if ( iPreferredLine >= 0 )
+            {
+            if ( iModel->Count() )
+                {
+                iPreferredUid = iModel->At( iPreferredLine )->Uid();
+                }
+            }
+        }
+
+    TBool isLocked(EFalse);
+    iNeedUnlock = EFalse;
+
+    iDataModel->NetWorkListDataL( isLocked, *iModel );
+
+    if ( isLocked )
+        {
+        iNeedUnlock = ETrue;
+        }
+
+    iList->View()->SetDisableRedraw( ETrue );
+
+    if ( iNeedsNone )
+        {
+        HBufC* buf = iEikonEnv->AllocReadResourceLC( R_APUI_VIEW_AP_NONE );
+        CApNetworkItem* NoneItem = CApNetworkItem::NewLC();
+        NoneItem->SetUid( KApNoneUID );
+        NoneItem->SetNameL( *buf );
+        iModel->InsertL( 0, NoneItem );
+        // as InsertL passes ownership of item to array,
+        // remove from cleanupstack
+        CleanupStack::Pop(); // NoneItem, as ownership is passed to array
+        CleanupStack::PopAndDestroy(); // buf, as item has copied it...
+        }
+
+    iList->HandleItemAdditionL();
+
+    SetSelectedL();
+
+    SetHighlighted();
+
+    iList->View()->SetDisableRedraw( EFalse );
+    iList->HandleItemAdditionL();
+
+    APSETUILOGGER_LEAVEFN( EListbox,"NetSelPopup::FillListBoxWithDataL")
+    }
+
+
+// ---------------------------------------------------------
+// CApNetSelPopupList::SetSelectedL()
+// ---------------------------------------------------------
+//
+void CApNetSelPopupList::SetSelectedL()
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"NetSelPopup::SetSelectedL")
+    
+    TInt i( 0 );
+    for( i=0; i<iModel->Count(); i++ )
+        {
+        if ( iModel->At( i )->Uid() == TUint32( *iSelected ) )
+            {
+            iList->SetCurrentItemIndexAndDraw( i );
+            HandleListBoxEventL(iList,
+                                MEikListBoxObserver::EEventItemSingleClicked);
+          /*  HandleListBoxEventL(iList,
+                                            MEikListBoxObserver::EEventItemDoubleClicked);*/
+            return; //exit here
+            }
+        }
+    iList->SetCurrentItemIndexAndDraw( 0 );//set something that does no harm...
+    HandleListBoxEventL(iList,
+        MEikListBoxObserver::EEventItemSingleClicked ); // simulate selection...
+    /*HandleListBoxEventL(iList,
+        MEikListBoxObserver::EEventItemDoubleClicked);*/
+    
+    APSETUILOGGER_LEAVEFN( EListbox,"NetSelPopup::SetSelectedL")
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CApNetSelPopupList::DynInitMenuPaneL
+// ---------------------------------------------------------
+//
+void CApNetSelPopupList::DynInitMenuPaneL( TInt aResourceId,
+                                        CEikMenuPane* aMenuPane )
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"NetSelPopup::DynInitMenuPaneL")
+    
+    CAknSettingPage::DynInitMenuPaneL( aResourceId, aMenuPane );
+    if ( aResourceId == R_APSETTINGSUI_MENU_NETWORK )
+        {
+        if ( Need2DeleteSelect( aResourceId ) )
+            {
+            aMenuPane->DeleteMenuItem( EApSelCmdSelect );
+            }
+        if ( Need2DeleteOpenDelete( aResourceId ) )
+            {
+            aMenuPane->DeleteMenuItem( EApSelCmdDelete );
+            }
+        if ( iProtectionSupported )
+            {
+            if ( CApProtHandler::IsTableProtectedL( 
+                  iDataModel->Database()->Database() ) )
+                {            
+                aMenuPane->DeleteMenuItem( EApSelCmdNew );                
+                }
+            }
+		if ( !iHelpSupported )
+			{
+			aMenuPane->DeleteMenuItem( EAknCmdHelp );
+			}        
+        }
+
+    APSETUILOGGER_LEAVEFN( EListbox,"NetSelPopup::DynInitMenuPaneL")
+    }
+
+
+// From MEikCommandObserver
+// ---------------------------------------------------------
+// CApNetSelPopupList::ProcessCommandL
+// ---------------------------------------------------------
+//
+void CApNetSelPopupList::ProcessCommandL( TInt aCommandId )
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"NetSelPopup::ProcessCommandL")
+    
+    if ( MenuShowing() )
+        {
+        HideMenu();
+        }
+
+    switch ( aCommandId )
+        {
+        case EAknSoftkeyOptions:
+            {
+            DisplayMenuL();
+            break;
+            }
+        case EAknSoftkeyBack:
+            {
+            AttemptExitL( EFalse );
+            break;
+            }
+        case EAknSoftkeyCancel:
+            {
+            *iEventStore |= KApUiEventShutDownRequested;
+            AttemptExitL( EFalse );
+            break;
+            }
+        case EApSelCmdSelect:
+            {
+            *iEventStore |= KApUiEventSelected;
+            AttemptExitL( ETrue );
+            break;
+            }
+        case EApSelCmdNew:
+            {
+            // create a new network group here
+            if ( HandleCreateNewNetworkGroupL() )
+                {
+                SetHighlighted();
+                }
+            break; 
+            }
+        case EApSelCmdDelete:
+            {
+            // As it might have been started by the Clear key,
+            // we must check if there is any...
+            TInt cnt = iModel->Count();
+            if ( ( iNeedsNone & ( cnt > 1 ) ) || ( !iNeedsNone && cnt ) )
+                {
+                // as we must be standing on an item, it must exists...
+                // So no problem on iModel->At( ...)
+                if ( iList->CurrentItemIndex() < ( iModel->Count()-1 ) )
+                    {// move to next one if possible
+                    iPreferredUid = iModel->At(
+                            iList->CurrentItemIndex()+1 )->Uid();
+                    }
+                else
+                    { // if it is the last, move to previous if possible.
+                    // if not, set to 0
+                    if ( iModel->Count()> 1 )
+                        {// move to prev. one if possible
+                        iPreferredUid = iModel->At(
+                            iList->CurrentItemIndex()-1 )->Uid();
+                        }
+                    else
+                        {
+                        iPreferredUid = 0;
+                        }
+                    }
+                iHandler->HandleNetworkDeleteCmdL(
+                            iModel->At( iList->CurrentItemIndex() )->Uid() );
+                }
+            break;
+            }
+        case EAknCmdHelp:
+            {
+			if ( iHelpSupported )
+				{
+				iDataModel->LaunchHelpL();	
+				}
+            break;
+            }
+        default:
+            {
+            // silently ignore it
+            break;
+            }
+        }
+    // check if user wants to Exit....
+    if ( *iEventStore & KApUiEventExitRequested )
+        {
+        AttemptExitL( EFalse );
+        }
+    else
+        {
+        switch ( aCommandId )
+            {
+            case EApSelCmdExit:
+                {
+                *iEventStore |= KApUiEventExitRequested;
+                AttemptExitL( EFalse );
+                break;
+                }
+            case EEikCmdExit:
+                {
+                *iEventStore |= KApUiEventShutDownRequested;
+                AttemptExitL( EFalse );
+                break;
+                }
+            default:
+                {
+                break;
+                }
+            }
+        }
+    
+    APSETUILOGGER_LEAVEFN( EListbox,"NetSelPopup::ProcessCommandL")
+    }
+
+
+
+// From CCoeControl
+// ---------------------------------------------------------
+// CApNetSelPopupList::OfferKeyEventL
+// ---------------------------------------------------------
+//
+TKeyResponse CApNetSelPopupList::OfferKeyEventL( const TKeyEvent& aKeyEvent,
+                                              TEventCode aType)
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"NetSelPopup::OfferKeyEventL")
+    TKeyResponse retval;
+    if ( aType == EEventKey )
+        {
+        if ( ( aKeyEvent.iCode == EKeyDelete ) ||
+            ( aKeyEvent.iCode == EKeyBackspace ) )
+            {
+            ProcessCommandL( EApSelCmdDelete );
+            retval = EKeyWasConsumed;
+            }
+        else
+            {
+            if ( aKeyEvent.iCode == EKeyOK )
+                { // process only if command is available...
+                ProcessCommandL( EApSelCmdSelect );
+                retval = EKeyWasConsumed;
+                }
+            else
+                {
+                retval = CAknRadioButtonSettingPage::OfferKeyEventL(
+                                        aKeyEvent, aType );
+                }
+            }
+        }
+    else
+        {
+        retval = CAknRadioButtonSettingPage::OfferKeyEventL( aKeyEvent, aType );
+        }
+    
+    APSETUILOGGER_LEAVEFN( EListbox,"NetSelPopup::OfferKeyEventL")
+    return retval;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApNetSelPopupList::Need2DeleteSelect
+// ---------------------------------------------------------
+//
+TBool CApNetSelPopupList::Need2DeleteSelect( TInt aResourceId )
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"NetSelPopup::Need2DeleteSelect<->")
+    return ( ( aResourceId == R_APSETTINGSUI_MENU_SELECT_NORMAL ) &&
+             ( iList->Model()->NumberOfItems() == 0 ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApNetSelPopupList::Need2DeleteOpenDelete
+// ---------------------------------------------------------
+//
+TBool CApNetSelPopupList::Need2DeleteOpenDelete( TInt aResourceId )
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"NetSelPopup::Need2DeleteOpenDelete<->")
+    
+    return ( ( aResourceId == R_APSETTINGSUI_MENU_NETWORK ) &&
+             (
+               (
+                 ( iList->Model()->NumberOfItems() == 0) && 
+                 ( iNeedsNone == EFalse )
+               )
+               ||
+               ( ( iNeedsNone ) &&
+                 ( iModel->At( iList->CurrentItemIndex() )->Uid() 
+                                  == KApNoneUID )
+             ) ) );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApNetSelPopupList::HandleCreateNewNetworkGroupL
+// ---------------------------------------------------------
+//
+TBool CApNetSelPopupList::HandleCreateNewNetworkGroupL()
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"NetSelPopup::HandleCreateNewNetworkGroupL")
+    
+    TBool retval( EFalse );
+
+    // must be prepared for the worst case...
+    TBuf<KModifiableLongTextLength> textToChange;    
+
+    TInt TextSettingPageFlags( EAknSettingPageNoOrdinalDisplayed );
+
+    CAccessPointTextSettingPage* dlg =
+        new( ELeave )CAccessPointTextSettingPage( 
+                        R_TEXT_SETTING_PAGE_NETW_NAME, 
+                        textToChange,
+                        TextSettingPageFlags,
+                        EFalse );
+
+    if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenAccepted ) )
+        {
+        CApNetworkItem* network = CApNetworkItem::NewLC();
+        network->SetUid( 0 ); // will be assigned when written toi disk
+        network->SetNameL( textToChange );
+        iDataModel->DataHandler()->CreateNetworkL( *network );
+        iPreferredUid = network->Uid();
+        CleanupStack::PopAndDestroy( network );
+        retval = ETrue;
+        }
+    *iEventStore |= KApUiEventEdited;
+    
+    APSETUILOGGER_LEAVEFN( EListbox,"NetSelPopup::HandleCreateNewNetworkGroupL")
+    return retval;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/src/ApNetSelectorListBoxModel.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,135 @@
+/*
+* Copyright (c) 2002 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 CApNetSelectorListboxModel.
+*
+*/
+
+
+// INCLUDE FILES
+#include "ApNetSelectorListBoxModel.h"
+#include "ApNetworkItem.h"
+#include <ApSettingsHandlerCommons.h>
+
+#include "ApSettingsHandlerLogger.h"
+
+// CONSTANTS
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CApNetSelectorListboxModel::CApNetSelectorListboxModel
+// ---------------------------------------------------------
+//
+CApNetSelectorListboxModel::CApNetSelectorListboxModel( )
+:CApNetworkItemList()
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"NetSelListModel::CApNetSelectorListboxModel<->")
+    }
+
+
+// ---------------------------------------------------------
+// CApNetSelectorListboxModel::~CApNetSelectorListboxModel
+// ---------------------------------------------------------
+//
+CApNetSelectorListboxModel::~CApNetSelectorListboxModel()
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"NetSelListModel::~CApNetSelectorListboxModel")
+    
+    ResetAndDestroy(); // deletes all elements...
+    
+    APSETUILOGGER_LEAVEFN( EListbox,"NetSelListModel::~CApNetSelectorListboxModel")
+    }
+
+
+// ---------------------------------------------------------
+// CApNetSelectorListboxModel::MdcaCount
+// ---------------------------------------------------------
+//
+TInt CApNetSelectorListboxModel::MdcaCount() const
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"NetSelListModel::MdcaCount<->")
+    return Count();
+    }
+
+
+// ---------------------------------------------------------
+// CApNetSelectorListboxModel::MdcaPoint
+// ---------------------------------------------------------
+//
+TPtrC CApNetSelectorListboxModel::MdcaPoint( TInt aIndex ) const
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"NetSelListModel::MdcaPoint")
+    
+    // We need to cast away the const-ness from the buffer.
+    // It was definitely made for formatting!
+    FormatListboxText( aIndex,
+        ( MUTABLE_CAST(  TBuf<KMaxApSelectorListboxName>&, iBuf ) ) );
+
+    
+    APSETUILOGGER_LEAVEFN( EListbox,"NetSelListModel::MdcaPoint")
+    return iBuf;
+    }
+
+
+// ---------------------------------------------------------
+// CApNetSelectorListboxModel::Item4Uid
+// ---------------------------------------------------------
+//
+TInt CApNetSelectorListboxModel::Item4Uid( TUint32 aUid, TInt& aErr ) const
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"NetSelListModel::Item4Uid")
+    
+    aErr = KErrNone;
+    TInt retval( KErrNotFound );
+    for ( TInt i=0; i<Count(); i++ )
+        {
+        if ( At( i )->Uid() == aUid )
+            {
+            retval = i;
+            break;
+            }
+        }
+    if ( retval == KErrNotFound )
+        {
+        aErr = KErrNotFound;
+        }
+    
+    APSETUILOGGER_LEAVEFN( EListbox,"NetSelListModel::Item4Uid")
+    return retval;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApNetSelectorListboxModel::FormatListboxText
+// ---------------------------------------------------------
+//
+void CApNetSelectorListboxModel::FormatListboxText( TInt aIndex,
+                                                TDes& aBuf ) const
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"NetSelListModel::FormatListboxText")
+    
+    aBuf.Format(
+                KListItemFormatGraphicOnOff,
+                1,
+                Min( At( aIndex )->Name().Length(),
+                KMaxListItemNameLength ),
+                &At( aIndex )->Name()
+                );
+    
+    APSETUILOGGER_LEAVEFN( EListbox,"NetSelListModel::FormatListboxText")
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/src/ApSelPopupList.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,975 @@
+/*
+* Copyright (c) 2002 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 CApSelPopupList for access point selection.
+*
+*/
+
+
+// INCLUDE FILES
+#include "APSettingsHandlerUIVariant.hrh"
+
+#include <ApListItem.h>
+#include <ApSetUI.rsg>
+#include <featmgr.h>
+
+#include <csxhelp/cp.hlp.hrh>
+
+
+#include "ApSelectorListBoxModel.h"
+#include "ApSettingsModel.h"
+#include "ApSettingsHandlerUI.hrh"
+#include "ApSelPopupList.h"
+#include "ApsettingshandleruiImpl.h"
+
+
+#include "ApSettingsHandlerLogger.h"
+
+#include <ApProtHandler.h>  // for protection of settings
+
+#include <AknsUtils.h>
+#include <apsettings.mbg>
+#include <data_caging_path_literals.hrh>
+
+
+// CONSTANTS
+// Drive and file name of the MBM file containing icons for Protection
+_LIT( KFileIcons, "z:ApSettings.mbm" );
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CApSelPopupList::NewL
+// ---------------------------------------------------------
+//
+CApSelPopupList* CApSelPopupList::NewL( CApSettingsModel& aModel,
+                                       CApSettingsHandlerImpl& aHandler,
+                                       TInt& aCurrentSelectionIndex,
+                                       TInt& aPreferredUid,
+                                       TSelectionMenuType aSelMenuType,
+                                       TInt aIspFilter, TInt aBearerFilter,
+                                       TInt aSortType, TUint32& aEventStore,
+                                       CDesCArrayFlat* aItemArray,
+                                       TBool aNeedsNone,
+                                       TBool aNoEdit,
+                                       TInt aReqIpvType,
+                                       TVpnFilterType aVpnFilterType
+                                       )
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::NewL")
+    CApSelPopupList* self = 
+        new ( ELeave ) CApSelPopupList( aModel, aHandler,
+                                        aCurrentSelectionIndex,
+                                        aPreferredUid, aSelMenuType,
+                                        aIspFilter, aBearerFilter,
+                                        aSortType, aItemArray,
+                                        aEventStore, aNeedsNone,
+                                        aNoEdit,
+                                        aReqIpvType,
+                                        aVpnFilterType
+                                        );
+//  till that point, object is only partially constructed!
+    
+    APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::NewL")
+    return self;
+    }
+
+
+
+
+
+// ---------------------------------------------------------
+// CApSelPopupList::NewL
+// ---------------------------------------------------------
+//
+CApSelPopupList* CApSelPopupList::NewL( CApSettingsModel& aModel,
+                                       CApSettingsHandlerImpl& aHandler,
+                                       TInt& aCurrentSelectionIndex,
+                                       TInt& aPreferredUid,
+                                       TSelectionMenuType aSelMenuType,
+                                       TInt aIspFilter, TInt aBearerFilter,
+                                       TInt aSortType, TUint32& aEventStore,
+                                       CDesCArrayFlat* aItemArray,
+                                       TBool aNeedsNone,
+                                       TInt aReqIpvType,
+                                       TVpnFilterType aVpnFilterType,
+                                       TBool aIncludeEasyWlan,
+                                       TBool aNoEdit
+                                       )
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::NewL2")
+    
+    CApSelPopupList* self = 
+        new ( ELeave ) CApSelPopupList( aModel, aHandler,
+                                        aCurrentSelectionIndex,
+                                        aPreferredUid, aSelMenuType,
+                                        aIspFilter, aBearerFilter,
+                                        aSortType, aItemArray,
+                                        aEventStore, aNeedsNone,
+                                        aReqIpvType,
+                                        aVpnFilterType,
+                                        aIncludeEasyWlan,
+                                        aNoEdit
+                                        );
+//  till that point, object is only partially constructed!
+    
+    APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::NewL2")
+    return self;
+    }
+    
+    
+
+// ---------------------------------------------------------
+// CApSelPopupList::ConstructL
+// ---------------------------------------------------------
+//
+void CApSelPopupList::ConstructL()
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::ConstructL")
+
+    FeatureManager::InitializeLibL();
+    iHelpSupported = FeatureManager::FeatureSupported( KFeatureIdHelp );
+    iProtectionSupported = FeatureManager::FeatureSupported( 
+                                           KFeatureIdSettingsProtection );
+    FeatureManager::UnInitializeLib();
+    
+    CAknRadioButtonSettingPage::ConstructL();
+    iList = ListBoxControl();
+    iModel = new( ELeave )CApSelectorListboxModel(
+                          CApSelectorListboxModel::EGraphicOnOff );
+    iList->Model()->SetItemTextArray( iModel );
+    if ( iProtectionSupported )
+        {
+        TInt offset = LoadIconsL();
+        iModel->SetOwnIconOffset( offset );
+        }
+    FillListBoxWithDataL();
+    iDataModel->Database()->AddObserverL( this );
+        
+    if ( !iModel->Count() )
+        {
+        // no ap defined, ask query if editable,
+        // show note if not
+        if ( iNoEdit )
+            {
+            // show note first, 
+            ShowNoteL( R_APUI_VIEW_NO_IAP_DEFINED_INFO );
+            // then simply go back:
+            iDoExit = ETrue;
+            }
+        else
+            {
+            if ( !AskQueryL( R_APUI_IAP_CREATE_NEW ) )
+                { // do not create, simply go back
+                iDoExit = ETrue;
+                }
+            else
+                { // create new AP
+                // just ket it pass, later in it will be handled in CheckIfEmptyL()
+                }                        
+            }
+        }    
+    
+    APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::ConstructL")
+    }
+
+
+
+// Destructor
+CApSelPopupList::~CApSelPopupList()
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::~CApSelPopupList")
+    
+    if ( iDataModel )
+        {
+        if ( iDataModel->Database() )
+            {
+            // must remove observer here as there is a chance that we do not exit
+            // through the standard way but through Leave(KErrLeaveWithoutAlert)...
+            iDataModel->Database()->RemoveObserver( this );
+            }
+        }
+
+    if ( iModel )
+        {
+        iModel->ResetAndDestroy();
+        delete iModel;
+        }
+    
+    APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::~CApSelPopupList")
+    }
+
+
+
+// Constructor
+CApSelPopupList::CApSelPopupList(
+                                 CApSettingsModel& aModel,
+                                 CApSettingsHandlerImpl& aHandler,
+                                 TInt& aIndex, TInt& aPreferredUid,
+                                 TSelectionMenuType aSelMenuType,
+                                 TInt aIspFilter, TInt aBearerFilter,
+                                 TInt aSortType, CDesCArrayFlat* aItemArray,
+                                 TUint32& aEventStore, TBool aNeedsNone,
+                                 TBool aNoEdit,
+                                 TInt aReqIpvType,
+                                 TVpnFilterType aVpnFilterType
+                                 )
+:CAknRadioButtonSettingPage( R_POPUP_LIST_SETTING_PAGE,
+                             aIndex, aItemArray ),
+iDataModel( &aModel ),
+iSelected( &aPreferredUid ),
+iBearerFilter( aBearerFilter ),
+iIspFilter( aIspFilter ),
+iSortType( aSortType ),
+iSelMenuType( aSelMenuType ),
+iHandler( &aHandler ),
+iEventStore( &aEventStore ),
+iPreferredUid( aPreferredUid ),
+iNeedsNone( aNeedsNone ),
+iNeedUnlock( EFalse ),
+iReqIpvType( aReqIpvType ),
+iVpnFilterType( aVpnFilterType ),
+iVariant( aHandler.iExt->iVariant ),
+iIncludeEasyWlan( EFalse ),
+iNoEdit( aNoEdit )
+    {
+    }
+
+
+
+
+CApSelPopupList::CApSelPopupList(
+                                 CApSettingsModel& aModel,
+                                 CApSettingsHandlerImpl& aHandler,
+                                 TInt& aIndex, TInt& aPreferredUid,
+                                 TSelectionMenuType aSelMenuType,
+                                 TInt aIspFilter, TInt aBearerFilter,
+                                 TInt aSortType, CDesCArrayFlat* aItemArray,
+                                 TUint32& aEventStore, TBool aNeedsNone,
+                                 TInt aReqIpvType,
+                                 TVpnFilterType aVpnFilterType,
+                                 TBool aIncludeEasyWlan,
+                                 TBool aNoEdit
+                                 )
+:CAknRadioButtonSettingPage( R_POPUP_LIST_SETTING_PAGE,
+                             aIndex, aItemArray ),
+iDataModel( &aModel ),
+iSelected( &aPreferredUid ),
+iBearerFilter( aBearerFilter ),
+iIspFilter( aIspFilter ),
+iSortType( aSortType ),
+iSelMenuType( aSelMenuType ),
+iHandler( &aHandler ),
+iEventStore( &aEventStore ),
+iPreferredUid( aPreferredUid ),
+iNeedsNone( aNeedsNone ),
+iNeedUnlock( EFalse ),
+iReqIpvType( aReqIpvType ),
+iVpnFilterType( aVpnFilterType ),
+iVariant( aHandler.iExt->iVariant ),
+iIncludeEasyWlan( aIncludeEasyWlan ),
+iInitialised( EFalse ),
+iNoEdit( aNoEdit )
+    {
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CApSelPopupList::SetHighlighted()
+// called when needs to change the highlighting
+// ---------------------------------------------------------
+//
+void CApSelPopupList::SetHighlighted()
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::SetHighlighted")
+    
+    TInt err( KErrNone );
+    TInt idx = iModel->Item4Uid( iPreferredUid, err );
+    
+    // if UID exists, set as current, else set 0 as current.
+    iList->SetCurrentItemIndexAndDraw( err == KErrNone ? idx : 0);
+    
+    APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::SetHighlighted")
+    }
+
+
+// ---------------------------------------------------------
+// CApSelPopupList::GetHelpContext()
+// ---------------------------------------------------------
+//
+void CApSelPopupList::GetHelpContext(TCoeHelpContext& aContext) const
+    {
+    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")
+    }
+
+
+// ---------------------------------------------------------
+// CApSelPopupList::HandleApDbEventL
+// called by the active access point framework
+// ---------------------------------------------------------
+//
+void CApSelPopupList::HandleApDbEventL( TEvent anEvent )
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::HandleApDbEventL")
+    
+    switch ( anEvent )
+        {
+        case EDbChanged:
+            {
+            FillListBoxWithDataL();
+            break;
+            }
+        case EDbClosing:
+            {
+            break;
+            }
+        case EDbAvailable:
+            {
+            if ( iNeedUnlock )
+                {
+                FillListBoxWithDataL();
+                }
+            break;
+            }
+        default:
+            {
+            __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) );
+            break;
+            }
+        }
+    
+    APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::HandleApDbEventL")
+    }
+
+
+// ---------------------------------------------------------
+// CApSelPopupList::ActivateL()
+// called after the dialog is shown
+// used to handle empty list - query
+// ---------------------------------------------------------
+//
+void CApSelPopupList::ActivateL()
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::ActivateL")
+    
+    CAknRadioButtonSettingPage::ActivateL();
+
+    if (iDoExit)
+        {
+        User::Leave(KErrNone);
+        return;
+        }
+
+    // put empty list checking & required actions here.
+    CheckIfEmptyL();
+    
+    APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::ActivateL")
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSelPopupList::SelectCurrentItemL()
+// called after the setting had been changed
+// ---------------------------------------------------------
+//
+void CApSelPopupList::SelectCurrentItemL()
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::SelectCurrentItemL")
+    
+    CAknRadioButtonSettingPage::SelectCurrentItemL();
+    TInt idx = iList->CurrentItemIndex();
+    if ( idx >= 0 )
+        {
+        *iSelected = iModel->At( idx )->Uid();
+        }
+    
+    APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::SelectCurrentItemL")
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSelPopupList::OkToExitL( TInt aButtonId )
+// called by framework when the OK button is pressed
+// ---------------------------------------------------------
+//
+TBool CApSelPopupList::OkToExitL( TInt aButtonId )
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::OkToExitL")
+    
+    // Translate the button presses into commands for the appui & current
+    // view to handle.
+    // This is a very good thing, that aButtonId is a TInt,
+    // but the caller ( CAknSettingPage ) simply uses a TBool.
+    // The value of ETrue means the button usually for Yes, Ok, Options, etc
+    // and EFalse means Back, Cancel, etc.
+    // so we must act according to a boolean value and not
+    // according to the real button id...
+    TBool IsAccepted = aButtonId;
+
+    if ( IsAccepted )
+        {
+        TInt idx = iList->CurrentItemIndex();
+        if ( idx >= 0 )
+            {
+            *iSelected = iModel->At( idx )->Uid();
+            }
+        }
+    
+    APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::OkToExitL")
+    return ETrue;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSelPopupList::FillListBoxWithDataL()
+// called when listbox needs to be filled with data
+// ---------------------------------------------------------
+//
+void CApSelPopupList::FillListBoxWithDataL()
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::FillListBoxWithDataL")
+    
+    iPreferredLine = iList->CurrentItemIndex();
+    if ( iPreferredLine < 0 )
+        {
+        iPreferredLine = 0;
+        }
+
+    TBool isLocked(EFalse);
+    iNeedUnlock = EFalse;
+    iDataModel->AllListItemDataL( isLocked, *iModel, iIspFilter, 
+                                  iBearerFilter, iSortType, iReqIpvType,
+                                  iVpnFilterType, iIncludeEasyWlan );
+    if ( isLocked )
+        {
+        iNeedUnlock = ETrue;
+        }
+
+    iList->View()->SetDisableRedraw( ETrue );
+
+    if ( iNeedsNone )
+        {
+        HBufC* buf = iEikonEnv->AllocReadResourceLC( R_APUI_VIEW_AP_NONE );
+        CApListItem* NoneItem = CApListItem::NewLC
+                        (
+                        EIspTypeInternetAndWAP, KApNoneUID,
+                        *buf,
+                        EApBearerTypeHSCSD
+                        );
+        iModel->InsertL( 0, NoneItem );
+        // as InsertL passes ownership of item to array,
+        // remove from cleanupstack
+        CleanupStack::Pop(); // NoneItem, as ownership is passed to array
+        CleanupStack::PopAndDestroy(); // buf, as item has copied it...
+        }
+
+    iList->HandleItemAdditionL();
+
+    iList->View()->SetDisableRedraw( EFalse );
+    iList->HandleItemAdditionL();
+
+    SetSelectedL();
+    iPreferredUid = *iSelected;
+    
+    SetHighlighted();
+
+    SizeChanged();
+    DrawNow();
+    
+    CheckAndSetDataValidity();
+    UpdateCbaL();
+    
+    APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::FillListBoxWithDataL")
+    }
+
+
+// ---------------------------------------------------------
+// CApSelPopupList::SetSelectedL()
+// ---------------------------------------------------------
+//
+void CApSelPopupList::SetSelectedL()
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::SetSelectedL")
+    
+    TInt i( 0 );
+    TInt idx( 0 );//set something that does no harm...
+    TInt count = iModel->Count(); 
+    for( i=0; i<count; i++ )
+        {
+        if ( iModel->At( i )->Uid() == TUint32( *iSelected ) )
+            {
+            idx = i;
+            i = count;
+            }
+        }
+    iList->SetCurrentItemIndexAndDraw( idx );
+    SelectCurrentItemL();
+    iOldSelection = idx;
+    
+    APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::SetSelectedL")
+    }
+
+
+// ---------------------------------------------------------
+// CApSelPopupList::CheckIfEmptyL()
+// ---------------------------------------------------------
+//
+void CApSelPopupList::CheckIfEmptyL()
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::CheckIfEmptyL")
+    
+    if ( !iModel->Count() )
+        {
+        // no ap defined, create new AP
+        ProcessCommandL( EApSelCmdNewBlank );
+        }
+    iInitialised = ETrue;
+    
+    APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::CheckIfEmptyL")
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSelPopupList::DynInitMenuPaneL
+// ---------------------------------------------------------
+//
+void CApSelPopupList::DynInitMenuPaneL( TInt aResourceId,
+                                        CEikMenuPane* aMenuPane )
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::DynInitMenuPaneL")
+    
+    CAknSettingPage::DynInitMenuPaneL( aResourceId, aMenuPane );
+
+    TInt itemCount = iList->Model()->NumberOfItems();
+    TInt idx = iList->CurrentItemIndex();
+    TUint32 itemUid(0);
+    if ( itemCount )
+        {
+        itemUid = iModel->At( idx )->Uid();
+        }
+
+    if ( iHandler->iModel->Need2DeleteSelect( aResourceId, itemCount ) )
+        {
+        aMenuPane->DeleteMenuItem( EApSelCmdSelect );
+        }
+
+    if ( iHandler->iModel->Need2DeleteOpen( aResourceId, itemCount, 
+                                            itemUid, iNeedsNone ) )
+        {
+        aMenuPane->DeleteMenuItem( EApSelCmdOpen );
+        }
+    if ( iHandler->iModel->Need2DeleteDeleteL( aResourceId, itemCount, 
+                                              itemUid, iNeedsNone ) )
+        {
+        aMenuPane->DeleteMenuItem( EApSelCmdDelete );
+        }
+
+    if ( iHandler->iModel->Need2DeleteNewUseExisting( 
+                        aResourceId, itemCount ) )
+        {
+        aMenuPane->DeleteMenuItem( EApSelCmdNewUseExisting );
+        }
+    if ( iHandler->iModel->Need2DeleteNewL( aResourceId ) )
+        {
+        aMenuPane->DeleteMenuItem( EApSelCmdNewBlank );
+        }
+
+    if ( iHandler->iModel->Need2DeleteHelp( aResourceId ) )
+        {
+        aMenuPane->DeleteMenuItem( EAknCmdHelp );                
+        }
+
+    if ( aResourceId == R_APSETTINGSUI_MENU_SELECT_NORMAL )
+        {
+        if ( iSelMenuType == EApSettingsSelMenuSelectOnly )
+            {
+            // Disallow other menues by deleting them
+            aMenuPane->DeleteMenuItem( EApSelCmdExit );
+            }
+        }
+    
+    APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::DynInitMenuPaneL")
+    }
+
+
+// From MEikCommandObserver
+// ---------------------------------------------------------
+// CApSelPopupList::ProcessCommandL
+// ---------------------------------------------------------
+//
+void CApSelPopupList::ProcessCommandL( TInt aCommandId )
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::ProcessCommandL")
+    
+    if ( MenuShowing() )
+        {
+        HideMenu();
+        }
+
+    switch ( aCommandId )
+        {
+        case EAknSoftkeyOptions:
+            {
+            DisplayMenuL();
+            break;
+            }
+        case EAknSoftkeyBack:
+            {
+            AttemptExitL( EFalse );
+            break;
+            }
+        case EAknSoftkeyCancel:
+            {
+            *iEventStore |= KApUiEventShutDownRequested;
+            AttemptExitL( EFalse );
+            break;
+            }
+        case EAknSoftkeyOk:
+        case EApSelCmdSelect:
+            {
+            *iEventStore |= KApUiEventSelected;
+            
+            TUint32 currUid = iModel->At( iList->CurrentItemIndex() )->Uid();
+            if( iPreferredUid != currUid )
+                {
+                iPreferredUid = currUid;
+                SetHighlighted();
+                }
+
+            CAknRadioButtonSettingPage::SelectCurrentItemL();
+            AttemptExitL( ETrue );
+            break;
+            }
+        case EApSelCmdOpen:
+            {// as we must be standing on an item, it must exist...
+            // So no problem on iModel->At( ...)
+            iPreferredUid = iModel->At( iList->CurrentItemIndex() )->Uid();
+            iHandler->DoRunViewerL( iPreferredUid );
+            SetHighlighted();
+            break;
+            }
+        case EApSelCmdNew:
+            {
+            break; // starts a submenu, nothing to do here
+            }
+        case EApSelCmdNewBlank:
+            {
+            iPreferredUid = iHandler->HandleApBlankNewL(
+                                            iBearerFilter, iIspFilter );
+            SetHighlighted();
+            break;
+            }
+        case EApSelCmdNewUseExisting:
+            {
+            TUint32 currid = iModel->At( iList->CurrentItemIndex() )->Uid();
+            iPreferredUid = iHandler->HandleDuplicateL( currid );
+            SetHighlighted();
+            break;
+            }
+        case EApSelCmdDelete:
+            {
+            // As it might have been started by the Clear key,
+            // we must check if there is any...
+            TInt cnt = iModel->Count();
+            if ( ( iNeedsNone & ( cnt > 1 ) ) || ( !iNeedsNone && cnt ) )
+                {
+                // as we must be standing on an item, it must exists...
+                // So no problem on iModel->At( ...)
+                if ( iList->CurrentItemIndex() < ( iModel->Count()-1 ) )
+                    {// move to next one if possible
+                    iPreferredUid = iModel->At(
+                            iList->CurrentItemIndex()+1 )->Uid();
+                    }
+                else
+                    { // if it is the last, move to previous if possible.
+                    // if not, set to 0
+                    if ( iModel->Count()> 1 )
+                        {// move to prev. one if possible
+                        iPreferredUid = iModel->At(
+                            iList->CurrentItemIndex()-1 )->Uid();
+                        }
+                    else
+                        {
+                        iPreferredUid = 0;
+                        }
+                    }
+                iHandler->HandleApDeleteCmdL(
+                            iModel->At( iList->CurrentItemIndex() )->Uid(),
+                            iModel->Count() == (1+iNeedsNone) );
+                }
+            break;
+            }
+        case EAknCmdHelp:
+            {
+			if ( iHelpSupported )
+				{
+            	iDataModel->LaunchHelpL();
+				}
+            break;
+            }
+        default:
+            {
+            // silently ignore it
+            break;
+            }
+        }
+    // check if user wants to Exit....
+    if ( *iEventStore & KApUiEventExitRequested )
+        {
+        if ( iInitialised )
+            {                        
+            AttemptExitL( EFalse );
+            }
+        else
+            {
+            *iEventStore |= KApUiEventInternal;
+            User::Leave(KLeaveWithoutAlert);
+            }            
+        }
+    else
+        {
+        switch ( aCommandId )
+            {
+            case EApSelCmdExit:
+                {
+                *iEventStore |= KApUiEventExitRequested;
+                AttemptExitL( EFalse );
+                break;
+                }
+            case EEikCmdExit:
+                {
+                *iEventStore |= KApUiEventShutDownRequested;
+                AttemptExitL( EFalse );
+                break;
+                }
+            default:
+                {
+                break;
+                }
+            }
+        }
+    
+    APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::ProcessCommandL")
+    }
+
+
+    // From MEikListBoxObserver
+void CApSelPopupList::HandleListBoxEventL( CEikListBox* aListBox,
+                        MEikListBoxObserver::TListBoxEvent aEventType )
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::HandleListBoxEventL")
+    
+    switch ( aEventType )
+        {
+        case EEventEnterKeyPressed:
+        case EEventItemDoubleClicked:
+            {
+            ProcessCommandL( EApSelCmdSelect );
+            break;
+            }
+        case EEventItemSingleClicked:
+            // Second click to the same item makes the selection and closes the
+            // setting page, first click just moves the radio button mark.
+            {
+            if ( ListBoxControl()->CurrentItemIndex() == iOldSelection )
+                {
+                ProcessCommandL( EApSelCmdSelect );
+                }
+            else
+                {
+                CAknRadioButtonSettingPage::HandleListBoxEventL( aListBox, aEventType );
+                iOldSelection = ListBoxControl()->CurrentItemIndex();
+                }
+            break;
+            }
+        case EEventEditingStarted:
+            {
+            break;
+            }
+        case EEventEditingStopped:
+            {
+            break;
+            }
+        default:
+            {
+            CAknRadioButtonSettingPage::HandleListBoxEventL( aListBox, aEventType );
+            };
+        };
+    
+    APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::HandleListBoxEventL")
+    }
+
+
+// From CCoeControl
+// ---------------------------------------------------------
+// CApSelPopupList::OfferKeyEventL
+// ---------------------------------------------------------
+//
+TKeyResponse CApSelPopupList::OfferKeyEventL( const TKeyEvent& aKeyEvent,
+                                              TEventCode aType)
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::OfferKeyEventL")
+    
+    TKeyResponse retval;
+    
+    if ( aType == EEventKey )
+        {
+        if ( ( aKeyEvent.iCode == EKeyDelete ) ||
+            ( aKeyEvent.iCode == EKeyBackspace ) )
+            {
+            if (!iNoEdit)
+                {            
+                ProcessCommandL( EApSelCmdDelete );
+                }
+            retval = EKeyWasConsumed;
+            }
+        else
+            {
+            if ( ( aKeyEvent.iCode == EKeyOK || aKeyEvent.iCode == EKeyEnter ) &&
+                ( ( iSelMenuType == EApSettingsSelMenuSelectOnly ) ||
+                    ( iSelMenuType == EApSettingsSelMenuSelectNormal ) ) )
+                { // process only if command is available...
+                ProcessCommandL( EApSelCmdSelect );
+                retval = EKeyWasConsumed;
+                }
+            else
+                {
+                retval = CAknRadioButtonSettingPage::OfferKeyEventL(
+                                        aKeyEvent, aType );
+                }
+            }
+        }
+    else
+        {
+        retval = CAknRadioButtonSettingPage::OfferKeyEventL( aKeyEvent, aType );
+        }
+        
+    APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::OfferKeyEventL")
+    return retval;
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CApSelPopupList::LoadIconsL
+// ---------------------------------------------------------
+//
+TInt CApSelPopupList::LoadIconsL()
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::LoadIconsL")
+    
+    CArrayPtr< CGulIcon >* icons = 
+                        iList->ItemDrawer()->FormattedCellData()->IconArray();
+
+    TInt count = icons->Count();
+
+    MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
+
+    TParse mbmFile;
+    User::LeaveIfError( mbmFile.Set( KFileIcons, &KDC_APP_BITMAP_DIR, NULL ) );
+
+    icons->AppendL( AknsUtils::CreateGulIconL( 
+                            skinInstance, 
+                            KAknsIIDQgnPropWmlGprs,
+                            mbmFile.FullName(), 
+                            EMbmApsettingsQgn_prop_wml_gprs, 
+                            EMbmApsettingsQgn_prop_wml_gprs_mask ) );
+
+    icons->AppendL( AknsUtils::CreateGulIconL( 
+                            skinInstance, 
+                            KAknsIIDQgnPropWmlCsd,
+                            mbmFile.FullName(), 
+                            EMbmApsettingsQgn_prop_wml_csd, 
+                            EMbmApsettingsQgn_prop_wml_csd_mask ) );
+
+    icons->AppendL( AknsUtils::CreateGulIconL( 
+                            skinInstance, 
+                            KAknsIIDQgnPropWmlHscsd,
+                            mbmFile.FullName(), 
+                            EMbmApsettingsQgn_prop_wml_hscsd, 
+                            EMbmApsettingsQgn_prop_wml_hscsd_mask ) );
+
+    icons->AppendL( AknsUtils::CreateGulIconL( 
+                            skinInstance, 
+                            KAknsIIDQgnPropWmlSms,
+                            mbmFile.FullName(), 
+                            EMbmApsettingsQgn_prop_wml_sms, 
+                            EMbmApsettingsQgn_prop_wml_sms_mask ) );
+
+    icons->AppendL( AknsUtils::CreateGulIconL( 
+                            skinInstance, 
+                            KAknsIIDQgnPropWlanBearer,
+                            mbmFile.FullName(), 
+                            EMbmApsettingsQgn_prop_wlan_bearer, 
+                            EMbmApsettingsQgn_prop_wlan_bearer_mask ) );
+
+    icons->AppendL( AknsUtils::CreateGulIconL( 
+                            skinInstance, 
+                            KAknsIIDQgnPropWlanBearer,
+                            mbmFile.FullName(), 
+                            EMbmApsettingsQgn_prop_wlan_easy, 
+                            EMbmApsettingsQgn_prop_wlan_easy_mask ) );
+
+    icons->AppendL( AknsUtils::CreateGulIconL( 
+                            skinInstance, 
+                            KAknsIIDQgnIndiSettProtectedAdd,
+                            mbmFile.FullName(), 
+                            EMbmApsettingsQgn_indi_sett_protected_add, 
+                            EMbmApsettingsQgn_indi_sett_protected_add_mask ) );
+
+    APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::LoadIconsL")
+    return count;
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CApSelPopupList::HandleResourceChange
+// ---------------------------------------------------------
+//
+void CApSelPopupList::HandleResourceChange(TInt aType)
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"SelPopupList::HandleResourceChange")
+    
+    if ( aType == KAknsMessageSkinChange )
+        {
+        iList->HandleResourceChange( aType );
+        if ( iProtectionSupported )
+            {
+            TRAP_IGNORE( LoadIconsL() );
+            }
+        SizeChanged();
+        }    
+        
+    CAknRadioButtonSettingPage::HandleResourceChange( aType );          
+    
+    APSETUILOGGER_LEAVEFN( EListbox,"SelPopupList::HandleResourceChange")
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/src/ApSelQueryDialog.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,379 @@
+/*
+* Copyright (c) 2002 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 dialog CApSelQueryDialog for access point selection.
+*
+*/
+
+
+// INCLUDE FILES
+#include <aknlists.h>
+#include <ApListItem.h>
+#include <AknIconArray.h>
+#include <AknsUtils.h>
+
+#include <ApSetUI.rsg>
+#include <apsettings.mbg>
+
+#include <featmgr.h>
+
+#include "ApSelectorListBoxModel.h"
+#include "ApSettingsModel.h"
+#include "ApSettingsHandlerUI.hrh"
+#include "ApSelQueryDialog.h"
+
+
+#include "ApSettingsHandlerLogger.h"
+#include <data_caging_path_literals.hrh>
+
+// CONSTANTS
+// Drive and file name of the MBM file containing icons for Protection
+_LIT( KFileIcons, "z:ApSettings.mbm" );
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// Destructor
+CApSelQueryDialog::~CApSelQueryDialog()
+    {
+    APSETUILOGGER_ENTERFN( EOther,"SelQuery::~CApSelQueryDialog")
+    
+    if ( iDataModel )
+        {
+        if ( iDataModel->Database() )
+            {
+            // iModel is deleted by the ListBox because LB owns the model
+            iDataModel->Database()->RemoveObserver( this );
+            }
+        }
+
+    APSETUILOGGER_LEAVEFN( EOther,"SelQuery::~CApSelQueryDialog")
+    }
+
+
+
+// Constructor
+CApSelQueryDialog::CApSelQueryDialog( CApSettingsModel& aModel,
+                                      TUint32* aIndex )
+:CAknListQueryDialog( (TInt*)aIndex ),
+iNeedUnlock( EFalse )
+    {
+    iDataModel = &aModel;
+    iSelected = aIndex;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSelQueryDialog::HandleApDbEventL
+// called by the active access point framework
+// ---------------------------------------------------------
+//
+void CApSelQueryDialog::HandleApDbEventL( TEvent anEvent )
+    {
+    APSETUILOGGER_ENTERFN( EOther,"SelQuery::HandleApDbEventL")
+    
+    switch ( anEvent )
+        {
+        case EDbChanged:
+            {
+            FillListBoxWithDataL();
+            break;
+            }
+        case EDbClosing:
+            {
+            break;
+            }
+        case EDbAvailable:
+            {
+            if ( iNeedUnlock )
+                {
+                FillListBoxWithDataL();
+                }
+            break;
+            }
+        default:
+            {
+            __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) );
+            break;
+            }
+        }
+    
+    APSETUILOGGER_LEAVEFN( EOther,"SelQuery::HandleApDbEventL")
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CApSelQueryDialog::PostLayoutDynInitL();
+// called by framework before dialog is shown
+// ---------------------------------------------------------
+//
+void CApSelQueryDialog::PreLayoutDynInitL()
+    {
+    APSETUILOGGER_ENTERFN( EOther,"SelQuery::PreLayoutDynInitL")
+    
+    // parent creates the private listbox
+    CAknListQueryDialog::PreLayoutDynInitL();
+    // and now we get access to it...
+    CAknListQueryControl *control = 
+            ( CAknListQueryControl* )Control( EListQueryControl );
+    iList = control->Listbox();
+    LoadIconsL();
+    FillListBoxWithDataL();
+    iDataModel->Database()->AddObserverL( this );
+    
+    APSETUILOGGER_LEAVEFN( EOther,"SelQuery::PreLayoutDynInitL")
+    }
+
+
+// ---------------------------------------------------------
+// CApSelQueryDialog::PostLayoutDynInitL();
+// called by framework before dialog is shown
+// ---------------------------------------------------------
+//
+void CApSelQueryDialog::PostLayoutDynInitL()
+    {
+    APSETUILOGGER_ENTERFN( EOther,"SelQuery::PostLayoutDynInitL")
+    
+    CAknListQueryDialog::PostLayoutDynInitL();
+    
+    APSETUILOGGER_LEAVEFN( EOther,"SelQuery::PostLayoutDynInitL")
+    }
+
+
+// ---------------------------------------------------------
+// CApSelQueryDialog::OkToExitL( TInt aButtonId )
+// called by framework when the OK button is pressed
+// ---------------------------------------------------------
+//
+TBool CApSelQueryDialog::OkToExitL( TInt aButtonId )
+    {
+    APSETUILOGGER_ENTERFN( EOther,"SelQuery::OkToExitL")
+    
+    // Translate the button presses into commands for the appui & current
+    // view to handle
+    TBool retval( EFalse );
+    if ( aButtonId == EAknSoftkeySelect )
+        {
+        TInt idx = iList->CurrentItemIndex();
+        if ( idx >= 0 )
+            {
+            if ( iModel->At( iList->CurrentItemIndex() )->IsReadOnly() )
+                { // read only, do not accept
+                // show note
+                ShowNoteL( R_APUI_NOTE_CANNOT_USE_PROTECTED_AP );
+                retval = EFalse;
+                }
+            else
+                {
+                *iSelected = iModel->At( iList->CurrentItemIndex() )->Uid();
+                retval = ETrue;
+                }
+            }
+        }
+    else
+        {
+        if ( aButtonId == EAknSoftkeyBack )
+            {
+            retval = ETrue;
+            }
+        }
+    
+    APSETUILOGGER_LEAVEFN( EOther,"SelQuery::OkToExitL")
+    return retval;
+    }
+
+
+
+
+// From CCoeControl
+// ---------------------------------------------------------
+// CApSelQueryDialog::OfferKeyEventL
+// ---------------------------------------------------------
+//
+TKeyResponse CApSelQueryDialog::OfferKeyEventL( const TKeyEvent& aKeyEvent,
+                                              TEventCode aType)
+    {
+    APSETUILOGGER_ENTERFN( EOther,"SelQuery::OfferKeyEventL")
+    
+    TKeyResponse retval;
+    if ( aType == EEventKey )
+        {
+        if ( aKeyEvent.iCode == EKeyOK )
+            { // process only if command is available...
+            ProcessCommandL( EApSelCmdSelect );
+            retval = EKeyWasConsumed;
+            }
+        else
+            {
+            retval = CAknListQueryDialog::OfferKeyEventL(
+                                    aKeyEvent, aType );
+            }
+        }
+    else
+        {
+        retval = CAknListQueryDialog::OfferKeyEventL( aKeyEvent, aType );
+        }
+    
+    APSETUILOGGER_LEAVEFN( EOther,"SelQuery::OfferKeyEventL")
+    return retval;
+    }
+
+
+
+// From MEikCommandObserver
+// ---------------------------------------------------------
+// CApSelQueryDialog::ProcessCommandL
+// ---------------------------------------------------------
+//
+void CApSelQueryDialog::ProcessCommandL( TInt aCommandId )
+    {
+    APSETUILOGGER_ENTERFN( EOther,"SelQuery::ProcessCommandL")
+    
+    if ( MenuShowing() )
+        {
+        HideMenu();
+        }
+
+    switch ( aCommandId )
+        {
+        case EAknSoftkeyOptions:
+            {
+            DisplayMenuL();
+            break;
+            }
+        case EAknSoftkeyBack:
+            {
+            TryExitL( EFalse );
+            break;
+            }
+        case EApSelCmdSelect:
+            {
+            TryExitL( EAknSoftkeySelect );
+            break;
+            }
+        case EAknCmdHelp:
+            {
+		    FeatureManager::InitializeLibL();
+		    TBool helpSupported = FeatureManager::FeatureSupported( KFeatureIdHelp );
+		    FeatureManager::UnInitializeLib();
+			if ( helpSupported )
+				{            
+            	iDataModel->LaunchHelpL();
+				}
+            break;
+            }
+        case EApSelCmdExit:
+        case EEikCmdExit:
+            {
+            TryExitL( EFalse );
+            break;
+            }
+        default:
+            {
+            // silently ignore it
+            break;
+            }
+        }
+    
+    APSETUILOGGER_LEAVEFN( EOther,"SelQuery::ProcessCommandL")
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSelQueryDialog::FillListBoxWithDataL()
+// called when listbopx needs to be filled with data
+// ---------------------------------------------------------
+//
+void CApSelQueryDialog::FillListBoxWithDataL()
+    {
+    APSETUILOGGER_ENTERFN( EOther,"SelQuery::FillListBoxWithDataL")
+    
+    TBool needtopop( EFalse );
+
+    if ( ! iModel )
+        {
+        // we must use temp var to satisfy CodeScanner
+        CApSelectorListboxModel* tmp = new( ELeave )CApSelectorListboxModel( 
+                                CApSelectorListboxModel::EGraphicProtection );
+        // although it will be member, but mainly owned by the listbox,
+        // so as long as ownership is not transferred, MUST push it
+        CleanupStack::PushL( tmp );
+        iModel = tmp;
+        // we need to Pop after ownership is passed to listbox
+        needtopop = ETrue;
+        }
+    TBool isLocked( EFalse );
+    iNeedUnlock = EFalse;
+    iDataModel->AllListItemDataL( isLocked, *iModel, KEApIspTypeAll,
+                                  EApBearerTypeAll, KEApSortNameAscending,
+                                  iDataModel->RequestedIPvType(), 
+                                  EVpnFilterNoVpn,
+                                  EFalse );
+
+    if ( isLocked )
+        {
+        iNeedUnlock = ETrue;
+        }
+
+    SetItemTextArray( iModel );
+    if ( needtopop )
+        { 
+        // it signals that ownership of iModel had JUST been passed,
+        // so we can Pop it.
+        CleanupStack::Pop( iModel);
+        }
+    
+    APSETUILOGGER_LEAVEFN( EOther,"SelQuery::FillListBoxWithDataL")
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CApSelQueryDialog::LoadIconsL()
+// called when listbox is constructed 
+// ---------------------------------------------------------
+//
+TInt CApSelQueryDialog::LoadIconsL()
+    {
+    APSETUILOGGER_ENTERFN( EOther,"SelQuery::LoadIconsL")
+    
+    CArrayPtr< CGulIcon >* icons = new( ELeave ) CAknIconArray( KGranularity );
+    CleanupStack::PushL( icons );
+
+    MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
+
+    TParse mbmFile;
+    User::LeaveIfError( mbmFile.Set( KFileIcons, &KDC_APP_BITMAP_DIR, NULL ) );
+
+    icons->AppendL( AknsUtils::CreateGulIconL( 
+                            skinInstance, 
+                            KAknsIIDQgnIndiSettProtectedAdd,
+                            mbmFile.FullName(), 
+                            EMbmApsettingsQgn_indi_sett_protected_add, 
+                            EMbmApsettingsQgn_indi_sett_protected_add_mask ) );
+
+    SetIconArrayL( icons );
+
+    CleanupStack::Pop(); // icons
+
+    APSETUILOGGER_LEAVEFN( EOther,"SelQuery::LoadIconsL")
+    return 0;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/src/ApSelectorDialog.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,968 @@
+/*
+* Copyright (c) 2002 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 dialog CApSelectorDialog for access point selection.
+*
+*/
+
+
+// INCLUDE FILES
+#include "APSettingsHandlerUIVariant.hrh"
+
+#include <aknnavide.h>
+#include <akntitle.h>
+#include <eikmenup.h>
+
+#include <ApListItem.h>
+#include <ApSetUI.rsg>
+
+#include <featmgr.h>
+
+#include <csxhelp/cp.hlp.hrh>
+
+#include "ApSelectorDialog.h"
+#include "ApSelectorListBoxModel.h"
+#include "ApSelectorListbox.h"
+#include "ApSettingsModel.h"
+#include "ApsettingshandleruiImpl.h"
+#include "ApSettingsHandlerUI.hrh"
+#include "TextOverrides.h"
+
+#include "ApSettingsHandlerLogger.h"
+
+#include <VpnApEngine.h>
+// CONSTANTS
+
+
+
+// ================= MEMBER FUNCTIONS =======================
+// ---------------------------------------------------------
+// CApSelectorDialog::ConstructAndRunLD
+// Constructs the dialog and runs it.
+// ---------------------------------------------------------
+//
+TInt CApSelectorDialog::ConstructAndRunLD( CApSettingsModel& aModel,
+                                          CApSettingsHandlerImpl& aHandler,
+                                          TUint32 aHighLight,
+                                          TUint32& aSelected )
+    {
+    APSETUILOGGER_ENTERFN( EDialog,"SelDIalog::ConstructAndRunLD")
+    
+    CleanupStack::PushL( this );
+
+    FeatureManager::InitializeLibL();
+    iHelpSupported = FeatureManager::FeatureSupported( KFeatureIdHelp );
+    FeatureManager::UnInitializeLib();
+
+#ifdef __TEST_OOMDEBUG
+    RFs fs;
+    User::LeaveIfError( fs.Connect() );
+    CleanupClosePushL<RFs>( fs );
+    TUint att;
+    if ( fs.Att( KTestFileName, att ) == KErrNone )
+        {
+        iMemTestOn = ETrue;
+        }
+    else
+        {
+        iMemTestOn = EFalse;
+        }
+    CleanupStack::PopAndDestroy(); // fs, will also close it
+#endif // __TEST_OOMDEBUG
+
+
+    TInt retValue = KErrNone;
+
+    iHighLight = aHighLight;
+    iSelected = &aSelected;
+
+    iDataModel = &aModel;
+    iHandler = &aHandler;
+    iVariant = iHandler->iExt->iVariant;
+
+    TInt aMenuTitleResourceId;
+    switch ( iSelMenuType )
+        {
+        case EApSettingsSelMenuSelectOnly:
+            {
+            aMenuTitleResourceId = R_APSETTINGSUI_SELECT_ONLY_MENUBAR;
+            break;
+            }
+        case EApSettingsSelMenuSelectNormal:
+            {
+            aMenuTitleResourceId = R_APSETTINGSUI_SELECT_NORMAL_MENUBAR;
+            break;
+            }
+        case EApSettingsSelMenuNormal:
+        default: // defensive ! treat all error cases like normal!
+            {
+            aMenuTitleResourceId = R_APSETTINGSUI_NORMAL_MENUBAR;
+            break;
+            }
+        }
+    ConstructL( aMenuTitleResourceId );
+
+    TInt aDlgResourceId;
+    switch ( iListType )
+        {
+        case EApSettingsSelListIsPopUp:
+        case EApSettingsSelListIsPopUpWithNone:
+            {
+            aDlgResourceId = R_APSELECTOR_POPUP_DIALOG;
+            break;
+            }
+        case EApSettingsSelListIsListPane:
+        default:// defensive ! treat all error cases like normal!
+            {
+            aDlgResourceId = R_APSELECTOR_PANE_DIALOG;
+            break;
+            }
+        }
+
+    iModel = new( ELeave )CApSelectorListboxModel;
+    
+    TBool islocked;
+    iDataModel->AllListItemDataL( islocked, *iModel, iIspFilter,
+                                  iBearerFilter, iSortType,
+                                  iReqIpvType );
+    
+
+    if ( !iModel->Count() )
+        {
+        // no ap defined, ask query if editable,
+        // show note if not
+        if ( iNoEdit )
+            {
+            // show note first, 
+            ShowNoteL( R_APUI_VIEW_NO_IAP_DEFINED_INFO );
+            // then simply go back:
+            User::Leave(KLeaveWithoutAlert);
+            }
+        else
+            {        
+            // no ap defined, ask query
+            if ( !AskQueryL( R_APUI_IAP_CREATE_NEW ) )
+                { // do not create, simply go back
+                User::Leave(KLeaveWithoutAlert);
+                }
+            else
+                { // create new AP
+                // just ket it pass, later in it will be handled in CheckIfEmptyL()
+                }
+            }
+        }
+    
+    CleanupStack::Pop();  // this, it will be PushL-d by executeLD...
+
+    retValue = ExecuteLD( aDlgResourceId );
+
+    APSETUILOGGER_LEAVEFN( EDialog,"SelDIalog::ConstructAndRunLD")
+
+    return retValue;
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CApSelectorDialog::~CApSelectorDialog
+// Destructor
+// ---------------------------------------------------------
+//
+CApSelectorDialog::~CApSelectorDialog()
+    {
+    APSETUILOGGER_ENTERFN( EDialog,"SelDIalog::~CApSelectorDialog")
+    
+    if ( iDataModel )
+        {
+        if ( iDataModel->Database() )
+            {
+            iDataModel->Database()->RemoveObserver( this );
+            }
+        }
+
+    // iModel is deleted by the ListBox because LB owns the model...
+    // of course only after we passed ownership...
+    if ( !iModelPassed )
+        {
+        delete iModel;
+        }
+    if ( iNaviDecorator )
+        {
+        delete iNaviDecorator;
+        }
+    if ( iTitlePane )
+        {
+        // set old text back, if we have it...
+        if ( iOldTitleText )
+            {
+            if ( iExitReason != EShutDown )
+                {
+                TRAP_IGNORE( iTitlePane->SetTextL( *iOldTitleText ) );
+                }
+            delete iOldTitleText;
+            }
+        }
+    
+    APSETUILOGGER_LEAVEFN( EDialog,"SelDIalog::~CApSelectorDialog")
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSelectorDialog::NewLC
+// Two-phase dconstructor, second phase is ConstructAndRunLD
+// ---------------------------------------------------------
+//
+CApSelectorDialog* CApSelectorDialog::NewL(
+                                        TSelectionListType aListType,
+                                        TSelectionMenuType aSelMenuType,
+                                        TInt aIspFilter,
+                                        TInt aBearerFilter,
+                                        TInt aSortType,
+                                        TUint32& aEventStore,
+                                        TBool aNoEdit,
+                                        TInt aReqIpvType
+                                        )
+    {
+    APSETUILOGGER_ENTERFN( EDialog,"SelDIalog::NewL")
+    
+    CApSelectorDialog* db =
+        new ( ELeave )CApSelectorDialog( aListType, aSelMenuType,
+                                         aIspFilter, aBearerFilter,
+                                         aSortType, aEventStore,
+                                         aNoEdit,
+                                         aReqIpvType );
+
+    APSETUILOGGER_LEAVEFN( EDialog,"SelDIalog::NewL")
+    return db;
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CApSelectorDialog::CApSelectorDialog
+// Constructor
+// ---------------------------------------------------------
+//
+CApSelectorDialog::CApSelectorDialog( TSelectionListType aListType,
+                                      TSelectionMenuType aSelMenuType,
+                                      TInt aIspFilter,
+                                      TInt aBearerFilter,
+                                      TInt aSortType,
+                                      TUint32& aEventStore,
+                                      TBool aNoEdit,
+                                      TInt aReqIpvType
+                                     )
+:iListType( aListType ),
+iSelMenuType( aSelMenuType ),
+iIspFilter( aIspFilter ),
+iBearerFilter( aBearerFilter ),
+iSortType( aSortType ),
+iEventStore( &aEventStore ),
+iNeedUnlock( EFalse ),
+iModelPassed( EFalse ),
+iExitReason( EExitNone ),
+iReqIpvType( aReqIpvType ),
+iInitialised( EFalse ),
+iNoEdit(aNoEdit)
+    {
+
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSelectorDialog::InitTextsL
+// called before the dialog is shown
+// to initialize localized textual data
+// ---------------------------------------------------------
+//
+void CApSelectorDialog::InitTextsL()
+    {
+    APSETUILOGGER_ENTERFN( EDialog,"SelDIalog::InitTextsL")
+    
+    // set pane text if neccessary...
+    // pane text needed if not pop-up...
+    __ASSERT_DEBUG( iTextOverrides, Panic( ENullPointer ) );
+    if ( iListType == EApSettingsSelListIsListPane )
+        {
+        iStatusPane = iEikonEnv->AppUiFactory()->StatusPane();
+        iTitlePane =
+            ( CAknTitlePane* )iStatusPane->ControlL(
+                                TUid::Uid( EEikStatusPaneUidTitle ) );
+
+        iOldTitleText = iTitlePane->Text()->AllocL();
+        iTitlePane->SetTextL( 
+                        *iEikonEnv->AllocReadResourceLC( R_APUI_NAVI_AP ) );
+
+        CleanupStack::PopAndDestroy(); // resource R_APUI_NAVI_AP
+
+        iNaviPane = ( CAknNavigationControlContainer* ) 
+                        iStatusPane->ControlL( 
+                                TUid::Uid( EEikStatusPaneUidNavi ) );
+        iNaviDecorator = iNaviPane->CreateNavigationLabelL( KEmpty );
+        iNaviPane->PushL( *iNaviDecorator );
+        }
+        
+    APSETUILOGGER_LEAVEFN( EDialog,"SelDIalog::InitTextsL")
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSelectorDialog::HandleListboxDataChangeL
+// called before the dialog is shown to initialize listbox data
+// ---------------------------------------------------------
+//
+void CApSelectorDialog::HandleListboxDataChangeL()
+    {
+    APSETUILOGGER_ENTERFN( EDialog,"SelDIalog::HandleListboxDataChangeL")
+    
+    iPreferredLine = iList->CurrentItemIndex();
+    if ( iPreferredLine < 0 )
+        {
+        iPreferredLine = 0;
+        }
+    if ( !iPreferredUid )
+        { // if not specified explicitly, get current and use as 'preferred'
+        if ( iPreferredLine >= 0 )
+            {
+            if ( iModel->Count() )
+                {
+                iPreferredUid = iModel->At( iPreferredLine )->Uid();
+                }
+            }
+        }
+
+
+    TBool isLocked(EFalse);
+    iNeedUnlock = EFalse;
+    iDataModel->AllListItemDataL( isLocked, *iModel, iIspFilter,
+                                  iBearerFilter, iSortType,
+                                  iReqIpvType );
+    if ( isLocked )
+        {
+        iNeedUnlock = ETrue;
+        }
+
+    iList->View()->SetDisableRedraw( ETrue );
+    iList->HandleItemAdditionL();
+
+    SetHighlighted();
+
+    iList->View()->SetDisableRedraw( EFalse );
+    iList->HandleItemAdditionL();
+    
+    APSETUILOGGER_LEAVEFN( EDialog,"SelDIalog::HandleListboxDataChangeL")
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSelectorDialog::SetTextOverrides
+// called by framework before dialog is shown
+// ---------------------------------------------------------
+//
+void CApSelectorDialog::SetTextOverrides( CTextOverrides *aOverrides )
+    {
+    APSETUILOGGER_ENTERFN( EDialog,"SelDIalog::SetTextOverrides<->")
+    
+    __ASSERT_DEBUG( aOverrides, Panic( ENullPointer ) );
+    iTextOverrides = aOverrides;
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CApSelectorDialog::CheckIfEmptyL()
+// called on activation and after the db has changed
+// used to handle empty list - query
+// ---------------------------------------------------------
+//
+void CApSelectorDialog::CheckIfEmptyL()
+    {
+    APSETUILOGGER_ENTERFN( EDialog,"SelDIalog::CheckIfEmptyL")
+    
+    if ( !iModel->Count() )
+        {
+        ProcessCommandL( EApSelCmdNewBlank );
+        }
+    iInitialised = ETrue;
+    
+    APSETUILOGGER_LEAVEFN( EDialog,"SelDIalog::CheckIfEmptyL")
+    }
+
+
+// ---------------------------------------------------------
+// CApSelectorDialog::ActivateL()
+// called after the dialog is shown
+// used to handle empty list - query
+// ---------------------------------------------------------
+//
+void CApSelectorDialog::ActivateL()
+    {
+    APSETUILOGGER_ENTERFN( EDialog,"SelDIalog::ActivateL")
+    
+    CAknDialog::ActivateL();
+    // put empty list checking & required actions here.
+    CheckIfEmptyL();
+    
+    APSETUILOGGER_LEAVEFN( EDialog,"SelDIalog::ActivateL")
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSelectorDialog::GetHelpContext()
+// ---------------------------------------------------------
+//
+void CApSelectorDialog::GetHelpContext(TCoeHelpContext& aContext) const
+    {
+    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
+// called by the active access point framework
+// ---------------------------------------------------------
+//
+void CApSelectorDialog::HandleApDbEventL( TEvent anEvent )
+    {
+    APSETUILOGGER_ENTERFN( EDialog,"SelDIalog::HandleApDbEventL")
+    
+    switch ( anEvent )
+        {
+        case EDbChanged:
+            {
+            HandleListboxDataChangeL();
+            break;
+            }
+        case EDbClosing:
+            {
+            break;
+            }
+        case EDbAvailable:
+            {
+            if ( iNeedUnlock )
+                {
+                HandleListboxDataChangeL();
+                }
+            break;
+            }
+        default:
+            {
+            __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) );
+            break;
+            }
+        }
+    
+    APSETUILOGGER_LEAVEFN( EDialog,"SelDIalog::HandleApDbEventL")
+    }
+
+
+
+// From MEikCommandObserver
+void CApSelectorDialog::ProcessCommandL( TInt aCommandId )
+    {
+    APSETUILOGGER_ENTERFN( EDialog,"SelDIalog::ProcessCommandL")
+    
+    if ( MenuShowing() )
+        {
+        HideMenu();
+        }
+    DoProcessCommandL( aCommandId );
+    
+    APSETUILOGGER_LEAVEFN( EDialog,"SelDIalog::ProcessCommandL")
+    }
+
+
+
+
+// From MEikListBoxObserver
+void CApSelectorDialog::HandleListBoxEventL( CEikListBox* /*aListBox*/,
+                                             TListBoxEvent aEventType )
+    {
+    APSETUILOGGER_ENTERFN( EDialog,"SelDIalog::HandleListBoxEventL")
+    
+    switch ( aEventType )
+        {
+        case EEventItemSingleClicked:            
+        case EEventEnterKeyPressed:
+            // both handled in the same way for now...
+        case EEventItemDoubleClicked:
+            {
+            ProcessCommandL( EApSelCmdOpen );
+            break;
+            }
+        case EEventItemClicked:
+            {
+            break;
+            }
+        case EEventEditingStarted:
+            {
+            break;
+            }
+        case EEventEditingStopped:
+            {
+            break;
+            }
+        default:
+            {
+            };
+        };
+    
+    APSETUILOGGER_LEAVEFN( EDialog,"SelDIalog::HandleListBoxEventL")
+    }
+
+
+
+//----------------------------------------------------------
+// CApSelectorDialog::CreateCustomControlL
+//----------------------------------------------------------
+//
+SEikControlInfo CApSelectorDialog::CreateCustomControlL
+( TInt aControlType )
+    {
+    APSETUILOGGER_ENTERFN( EDialog,"SelDIalog::CreateCustomControlL")
+    
+    SEikControlInfo controlInfo;
+    controlInfo.iTrailerTextId = 0;
+    controlInfo.iFlags = 0;
+    if ( aControlType == KApSelectorListboxType )
+        {
+        controlInfo.iControl = new ( ELeave ) CApSelectorListbox;
+        }
+    else
+        {
+        controlInfo.iControl = NULL;
+        }
+    
+    APSETUILOGGER_LEAVEFN( EDialog,"SelDIalog::CreateCustomControlL")
+    return controlInfo;
+    }
+
+
+//----------------------------------------------------------
+// CApSelectorDialog::DynInitMenuPaneL
+//----------------------------------------------------------
+//
+void CApSelectorDialog::DynInitMenuPaneL( TInt aResourceId,
+                                         CEikMenuPane* aMenuPane )
+    {
+    APSETUILOGGER_ENTERFN( EDialog,"SelDIalog::DynInitMenuPaneL")
+    
+    CAknDialog::DynInitMenuPaneL( aResourceId, aMenuPane );
+
+    TInt itemCount = iList->Model()->NumberOfItems();
+//    TUint32 itemUid = iModel->At( iList->CurrentItemIndex() )->Uid();
+
+    TUint32 itemUid(0);
+    if ( itemCount > 0 )
+        {
+        itemUid = iModel->At( iList->CurrentItemIndex() )->Uid();
+        }
+
+    if ( iHandler->iModel->Need2DeleteSelect( aResourceId, itemCount ) )
+        {
+        aMenuPane->DeleteMenuItem( EApSelCmdSelect );
+        }
+    if ( iHandler->iModel->Need2DeleteOpen( aResourceId, itemCount, 
+                                            itemUid, EFalse ) )
+        {
+        aMenuPane->DeleteMenuItem( EApSelCmdOpen );
+        }
+    if ( iHandler->iModel->Need2DeleteDeleteL( aResourceId, itemCount, 
+                                               itemUid, EFalse ) )
+        {
+        aMenuPane->DeleteMenuItem( EApSelCmdDelete );
+        }
+    if ( iHandler->iModel->Need2DeleteNewUseExisting( aResourceId, 
+                                                      itemCount ) )
+        {
+        aMenuPane->DeleteMenuItem( EApSelCmdNewUseExisting );
+        }
+    if ( iHandler->iModel->Need2DeleteNewL( aResourceId ) )
+        {
+        aMenuPane->DeleteMenuItem( EApSelCmdNewBlank );
+        }
+
+    if ( iHandler->iModel->Need2DeleteHelp( aResourceId ) )
+        {
+        aMenuPane->DeleteMenuItem( EAknCmdHelp );
+        }
+    
+    APSETUILOGGER_LEAVEFN( EDialog,"SelDIalog::DynInitMenuPaneL")
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSelectorDialog::OfferKeyEventL();
+// ---------------------------------------------------------
+//
+TKeyResponse CApSelectorDialog::OfferKeyEventL(const TKeyEvent& aKeyEvent,
+                                               TEventCode aType)
+    {
+    APSETUILOGGER_ENTERFN( EDialog,"SelDIalog::OfferKeyEventL")
+    
+    TKeyResponse retval( EKeyWasConsumed );
+    if ( ( aType == EEventKey ) &&
+         ( ( aKeyEvent.iCode == EKeyDelete ) ||
+           ( aKeyEvent.iCode == EKeyBackspace ) ) )
+        {
+        if (!iNoEdit)
+            {
+            ProcessCommandL( EApSelCmdDelete );
+            }
+        }
+    else
+        {
+        if ( ( aType == EEventKey ) && ( aKeyEvent.iCode == EKeyOK ) )
+            { // process only if command is available...
+            if ( iList->Model()->NumberOfItems() > 0)
+                {
+                if (!iNoEdit)
+                    {
+                    ProcessCommandL( EApSelCmdOpen );
+                    }
+                }
+            }
+        else
+            {
+            if ( iList )
+                {
+                // as list IS consuming, must handle because
+                // it IS the SHUTDOWN...
+                // or, a view switch is shutting us down...
+                if ( aKeyEvent.iCode == EKeyEscape )
+                    {
+                    ProcessCommandL( EEikCmdExit );
+                    retval = EKeyWasConsumed;
+                    }
+                else
+                    {
+                    retval = iList->OfferKeyEventL( aKeyEvent, aType );
+                    }
+                }
+            else
+                {
+                retval = CAknDialog::OfferKeyEventL( aKeyEvent, aType );
+                }
+            }
+        }
+    
+    APSETUILOGGER_LEAVEFN( EDialog,"SelDIalog::OfferKeyEventL")
+    return retval;
+    }
+
+
+// ---------------------------------------------------------
+// CApSelectorDialog::PreLayoutDynInitL();
+// called by framework before dialog is shown
+// ---------------------------------------------------------
+//
+void CApSelectorDialog::PreLayoutDynInitL()
+    {
+    APSETUILOGGER_ENTERFN( EDialog,"SelDIalog::PreLayoutDynInitL")
+    
+    iList =
+        STATIC_CAST( CApSelectorListbox*, Control( KApSelectorListboxId ) );
+    iList->CreateScrollBarFrameL( ETrue );
+    iList->ScrollBarFrame()->SetScrollBarVisibilityL
+        ( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
+    iList->SetListBoxObserver( this );
+
+    iList->Model()->SetItemTextArray( iModel );
+    iModelPassed = ETrue;
+    iList->LoadIconsL();
+    HandleListboxDataChangeL();
+    iList->HandleItemAdditionL();
+    InitTextsL();
+    
+    APSETUILOGGER_LEAVEFN( EDialog,"SelDIalog::PreLayoutDynInitL")
+    }
+
+
+// ---------------------------------------------------------
+// CApSelectorDialog::PreLayoutDynInitL();
+// called by framework before dialog is shown
+// ---------------------------------------------------------
+//
+void CApSelectorDialog::PostLayoutDynInitL()
+    {
+    APSETUILOGGER_ENTERFN( EDialog,"SelDIalog::PostLayoutDynInitL")
+    
+    iDataModel->Database()->AddObserverL( this );
+    
+    APSETUILOGGER_LEAVEFN( EDialog,"SelDIalog::PostLayoutDynInitL")
+    }
+
+
+// ---------------------------------------------------------
+// CApSelectorDialog::OkToExitL( TInt aButtonId )
+// called by framework when the OK button is pressed
+// ---------------------------------------------------------
+//
+TBool CApSelectorDialog::OkToExitL( TInt aButtonId )
+    {
+    APSETUILOGGER_ENTERFN( EDialog,"SelDIalog::OkToExitL")
+    
+    // Translate the button presses into commands for the appui & current
+    // view to handle
+    TBool retval( EFalse );
+
+    if ( aButtonId == EAknSoftkeyOptions )
+        {
+        if ( iSelMenuType == EApSettingsSelMenuSelectOnly )
+            {
+            *iSelected = iList->CurrentItemUid();
+            retval = ETrue;
+            }
+        else
+            {
+            DisplayMenuL();
+            }
+        }
+    else if (aButtonId == EApSelCmdOpen)
+        {
+        ProcessCommandL(aButtonId);
+        retval = EFalse; // don't exit the dialog
+        }
+    else
+        {
+        retval = ETrue;
+        }
+    
+    APSETUILOGGER_LEAVEFN( EDialog,"SelDIalog::OkToExitL")
+    return retval;
+    }
+
+
+// ---------------------------------------------------------
+// CApSelectorDialog::SetHighlighted()
+// called when needs to change the highlighting
+// ---------------------------------------------------------
+//
+void CApSelectorDialog::SetHighlighted()
+    {
+    APSETUILOGGER_ENTERFN( EDialog,"SelDIalog::SetHighlighted")
+    
+    TBool done( EFalse );
+
+    if ( iPreferredUid )
+        {
+        TInt err( KErrNone );
+        TInt idx = iModel->Item4Uid( iPreferredUid, err );
+        // if UID exists, set as current, else set 0 as current.
+        if ( err == KErrNone )
+            {
+            iList->SetCurrentItemIndexAndDraw( idx );
+            iPreferredUid = 0;
+            done = ETrue;
+            }
+        }
+    if ( !done )
+        { // try to use iPreferredLine, as previous selection had been deleted
+        TInt count( iModel->Count() );
+        if ( count <= iPreferredLine )
+            {
+            // less elements, preferred line is out of the screen, 
+            // select last one
+            if ( count )
+                {
+                iList->SetCurrentItemIndexAndDraw( count - 1 );
+                }
+            else
+                {
+                iList->SetCurrentItemIndexAndDraw( 0 );
+                }
+            done = ETrue;
+            }
+        else
+            { // count > iPreferredLine, select preferred line
+            iList->SetCurrentItemIndexAndDraw( iPreferredLine );
+            done = ETrue;
+            }
+        }
+    
+    APSETUILOGGER_LEAVEFN( EDialog,"SelDIalog::SetHighlighted")
+    }
+
+
+
+
+
+
+// ---------------------------------------------------------
+// CApSelectorDialog::DoProcessCommandL
+// called when needs to change the highlighting
+// ---------------------------------------------------------
+//
+void CApSelectorDialog::DoProcessCommandL( TInt aCommandId )
+    {
+    APSETUILOGGER_ENTERFN( EDialog,"SelDIalog::DoProcessCommandL")
+    
+    switch ( aCommandId )
+        {
+        case EApSelCmdSelect:
+            {
+            *iSelected = iList->CurrentItemUid();
+            *iEventStore |= KApUiEventSelected;
+            iPreferredUid = iList->CurrentItemUid();
+            SetHighlighted();
+            // Can not exit here, as it would delete this,
+            // Exit will be handled at the end of this function!
+            // TryExitL( EAknSoftkeyBack );
+            break;
+            }
+        case EApSelCmdOpen:
+            {
+            // when using __UHEAP_MARK;/MARKEND, TitlePane old text setback is
+            // reported as a mem. leak, but it is not as the lifetime of 
+            // the text is longer than this part.
+            iPreferredUid = iList->CurrentItemUid();
+            iHandler->DoRunViewerL( iPreferredUid );
+            break;
+            }
+        case EApSelCmdNewBlank:
+            { // put the new's UID into iPreferredUid to set highlight onto it
+            // when using __UHEAP_MARK;/MARKEND, TitlePane old text setback is
+            // reported as a mem. leak, but it is not as the lifetime of 
+            // the text is longer than this part.
+            iPreferredUid =
+                    iHandler->HandleApBlankNewL( iBearerFilter, iIspFilter );
+            SetHighlighted();
+            break;
+            }
+        case EApSelCmdNewUseExisting:
+            { // put the new's UID into iPreferredUid to set highlight onto it
+            // when using __UHEAP_MARK;/MARKEND, TitlePane old text setback is
+            // reported as a mem. leak, but it is not as the lifetime of 
+            // the text is longer than this part.
+            iPreferredUid = 
+                    iHandler->HandleDuplicateL( iList->CurrentItemUid() );
+            SetHighlighted();
+            break;
+            }
+        case EApSelCmdDelete:
+            { 
+            // put the UID of the next Ap into iPreferredUid to set 
+            // highlight onto it...
+            // if next does not exists, put it onto prev.
+            // if no next & no prev. exists, set it to 0 (don't care).
+            // As it might have been started by the Clear key,
+            // we must check if there is any...
+            if ( iModel->Count() )
+                {
+                // As we must be standing on an item, it must exist...
+                // So no problem on iModel->At( ...)
+                if ( iList->CurrentItemIndex() < ( iModel->Count()-1 ) )
+                    {
+                    // move to next one if possible
+                    iPreferredUid =
+                        iList->Uid4Item( iList->CurrentItemIndex()+1 );
+                    }
+                else
+                    {
+                    // if it is the last, move to previous if possible.
+                    // if not, set to 0
+                    if ( iModel->Count()> 1 )
+                        {
+                        // move to prev. one if possible
+                        iPreferredUid =
+                            iList->Uid4Item( iList->CurrentItemIndex()-1 );
+                        }
+                    else
+                        {
+                        iPreferredUid = 0;
+                        }
+                    }
+                iHandler->HandleApDeleteCmdL( iList->CurrentItemUid(),
+                                              iModel->Count() == 1 );
+                }
+            break;
+            }
+        case EAknCmdHelp:
+            {
+			if ( iHelpSupported )
+				{
+            	iDataModel->LaunchHelpL();
+				}
+            break;
+            }
+        default:
+            {
+            // silently ignore it
+            break;
+            }
+        }
+    // check if user wants to exit...
+    if ( *iEventStore & KApUiEventExitRequested )
+        {
+        if ( iInitialised )
+            {                        
+            TryExitL( EAknSoftkeyBack );
+            }
+        else
+            {
+            *iEventStore |= KApUiEventInternal;
+            User::Leave(KLeaveWithoutAlert);
+            }
+        }
+    else
+        { // handle possible exit reasons/request here.
+        switch ( aCommandId )
+            {
+            case EApSelCmdSelect:
+                {
+                TryExitL( EAknSoftkeyBack );
+                break;
+                }
+            case EApSelCmdExit:
+                {
+                iExitReason = EExit;
+                *iEventStore |= KApUiEventExitRequested;
+                TryExitL( EAknSoftkeyBack );
+                break;
+                }
+            case EEikCmdExit:
+                {
+                iExitReason = EShutDown;
+                *iEventStore |= KApUiEventShutDownRequested;
+                TryExitL( EAknSoftkeyBack );
+                break;
+                }
+            default:
+                {
+                break;
+                }
+            }
+        }
+    
+    APSETUILOGGER_LEAVEFN( EDialog,"SelDIalog::DoProcessCommandL")
+    }
+
+
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/src/ApSelectorListBox.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,297 @@
+/*
+* Copyright (c) 2002 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 CApSelectorListbox.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <eikclbd.h>
+#include <AknIconArray.h>
+//#include <EIKON.mbg>
+#include <avkon.mbg>
+#include <aknkeys.h>
+#include <ApSetUI.rsg>
+#include <featmgr.h>
+
+#include "ApSelectorListbox.h"
+#include "ApSelectorListBoxModel.h"
+#include "ApListItem.h"
+
+#include <AknsUtils.h>
+#include <apsettings.mbg>
+#include <data_caging_path_literals.hrh>
+
+#include "ApSettingsHandlerLogger.h"
+
+// CONSTANTS
+// Drive and file name of the MBM file containing icons for Protection
+_LIT( KFileIcons, "z:ApSettings.mbm" );
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CApSelectorListbox::NewL
+// ---------------------------------------------------------
+//
+CApSelectorListbox* CApSelectorListbox::NewL
+( const CCoeControl* aParent )
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"SelListbox::NewL")
+    
+    CApSelectorListbox* listbox =
+        new ( ELeave ) CApSelectorListbox();
+    CleanupStack::PushL( listbox );
+    listbox->ConstructL( aParent, EAknListBoxSelectionList );
+    CleanupStack::Pop();    // listbox
+    
+    APSETUILOGGER_LEAVEFN( EListbox,"SelListbox::NewL")
+    return listbox;
+    }
+
+
+// ---------------------------------------------------------
+// CApSelectorListbox::CApSelectorListbox
+// ---------------------------------------------------------
+//
+CApSelectorListbox::CApSelectorListbox()
+    {
+    }
+
+
+// ---------------------------------------------------------
+// CApSelectorListbox::~CApSelectorListbox
+// ---------------------------------------------------------
+//
+CApSelectorListbox::~CApSelectorListbox()
+    {
+
+    }
+
+
+// ---------------------------------------------------------
+// CApSelectorListbox::OfferKeyEventL
+// ---------------------------------------------------------
+//
+TKeyResponse CApSelectorListbox::OfferKeyEventL
+( const TKeyEvent& aKeyEvent, TEventCode aType )
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"SelListbox::OfferKeyEventL")
+    
+    TKeyResponse retval;
+    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!
+        retval = EKeyWasConsumed;
+        }
+    else
+        {
+        retval = CAknSingleGraphicStyleListBox::OfferKeyEventL
+            ( aKeyEvent, aType );
+        }
+    
+    APSETUILOGGER_LEAVEFN( EListbox,"SelListbox::OfferKeyEventL")
+    return retval;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSelectorListbox::FocusChanged
+// ---------------------------------------------------------
+//
+void CApSelectorListbox::FocusChanged( TDrawNow aDrawNow )
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"SelListbox::FocusChanged")
+    
+    // Do nothing until the listbox is fully constructed
+    // The dialogpage sets the focus before calling ConstructL
+    if ( iView )
+        {
+        CAknSingleGraphicStyleListBox::FocusChanged( aDrawNow );
+        }
+    
+    APSETUILOGGER_LEAVEFN( EListbox,"SelListbox::FocusChanged")
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSelectorListbox::LoadIconsL
+// ---------------------------------------------------------
+//
+void CApSelectorListbox::LoadIconsL()
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"SelListbox::LoadIconsL")
+
+    CArrayPtr< CGulIcon >* icons = new( ELeave ) CAknIconArray( KGranularity );
+    CleanupStack::PushL( icons );
+
+    MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
+
+    TParse mbmFile;
+    User::LeaveIfError( mbmFile.Set( KFileIcons, &KDC_APP_BITMAP_DIR, NULL ) );
+
+    icons->AppendL( AknsUtils::CreateGulIconL( 
+                                skinInstance, 
+                                KAknsIIDQgnPropWmlGprs,
+                                mbmFile.FullName(), 
+                                EMbmApsettingsQgn_prop_wml_gprs, 
+                                EMbmApsettingsQgn_prop_wml_gprs_mask ) );
+
+    icons->AppendL( AknsUtils::CreateGulIconL( 
+                                skinInstance, 
+                                KAknsIIDQgnPropWmlCsd,
+                                mbmFile.FullName(), 
+                                EMbmApsettingsQgn_prop_wml_csd, 
+                                EMbmApsettingsQgn_prop_wml_csd_mask ) );
+
+    icons->AppendL( AknsUtils::CreateGulIconL( 
+                                skinInstance, 
+                                KAknsIIDQgnPropWmlHscsd,
+                                mbmFile.FullName(), 
+                                EMbmApsettingsQgn_prop_wml_hscsd, 
+                                EMbmApsettingsQgn_prop_wml_hscsd_mask ) );
+
+    icons->AppendL( AknsUtils::CreateGulIconL( 
+                                skinInstance, 
+                                KAknsIIDQgnPropWmlSms,
+                                mbmFile.FullName(), 
+                                EMbmApsettingsQgn_prop_wml_sms, 
+                                EMbmApsettingsQgn_prop_wml_sms_mask ) );
+
+    icons->AppendL( AknsUtils::CreateGulIconL( 
+                                skinInstance, 
+                                KAknsIIDQgnPropWlanBearer,
+                                mbmFile.FullName(), 
+                                EMbmApsettingsQgn_prop_wlan_bearer, 
+                                EMbmApsettingsQgn_prop_wlan_bearer_mask ) );
+                                            
+
+    icons->AppendL( AknsUtils::CreateGulIconL( 
+                                skinInstance, 
+                                KAknsIIDQgnPropWlanBearer,
+                                mbmFile.FullName(), 
+                                EMbmApsettingsQgn_prop_wlan_easy, 
+                                EMbmApsettingsQgn_prop_wlan_easy_mask ) );
+                                            
+
+    FeatureManager::InitializeLibL();
+    TBool protsupported = FeatureManager::FeatureSupported( 
+                                           KFeatureIdSettingsProtection );
+    FeatureManager::UnInitializeLib();
+    if ( protsupported )
+        {
+        icons->AppendL( AknsUtils::CreateGulIconL( 
+                                skinInstance, 
+                                KAknsIIDQgnIndiSettProtectedAdd,
+                                mbmFile.FullName(), 
+                                EMbmApsettingsQgn_indi_sett_protected_add, 
+                                EMbmApsettingsQgn_indi_sett_protected_add_mask ) );
+        }
+
+    ItemDrawer()->ColumnData()->SetIconArray( icons );
+
+    CleanupStack::Pop(); // icons
+    
+    APSETUILOGGER_LEAVEFN( EListbox,"SelListbox::LoadIconsL")
+    }
+
+
+// ---------------------------------------------------------
+// CApSelectorListbox::Uid4Item
+// ---------------------------------------------------------
+//
+TUint32 CApSelectorListbox::Uid4Item( TInt aItem ) const
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"SelListbox::Uid4Item<->")
+    
+    CApSelectorListboxModel* lbmodel =
+        STATIC_CAST( CApSelectorListboxModel*, Model()->ItemTextArray() );
+    return lbmodel->At( aItem )->Uid();
+    }
+
+
+// ---------------------------------------------------------
+// CApSelectorListbox::CurrentItemUid
+// ---------------------------------------------------------
+//
+TUint32 CApSelectorListbox::CurrentItemUid() const
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"SelListbox::CurrentItemUid")
+    
+    CApSelectorListboxModel* lbmodel =
+        STATIC_CAST( CApSelectorListboxModel*, Model()->ItemTextArray() );
+    TInt idx = CurrentItemIndex();
+    TUint32 retval( 0 );
+    if ( idx >= 0 )
+        {
+        retval = lbmodel->At( idx )->Uid();
+        }
+    
+    APSETUILOGGER_LEAVEFN( EListbox,"SelListbox::CurrentItemUid")
+    return retval;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSelectorListbox::CurrentItemNameL
+// ---------------------------------------------------------
+//
+const TDesC& CApSelectorListbox::CurrentItemNameL()
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"SelListbox::CurrentItemNameL")
+    
+    CApSelectorListboxModel* lbmodel = new( ELeave )CApSelectorListboxModel;
+    lbmodel = 
+        STATIC_CAST( CApSelectorListboxModel*, Model()->ItemTextArray() );
+    
+    APSETUILOGGER_LEAVEFN( EListbox,"SelListbox::CurrentItemNameL")
+    return lbmodel->At( CurrentItemIndex() )->Name();
+    }
+
+
+// ---------------------------------------------------------
+// CApSelectorListbox::HandleResourceChange
+// ---------------------------------------------------------
+//
+void CApSelectorListbox::HandleResourceChange(TInt aType)
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"SelListbox::HandleResourceChange")
+    
+    if ( aType == KAknsMessageSkinChange )
+        {
+        TRAP_IGNORE( LoadIconsL() );
+        SizeChanged();
+        }
+        
+    CAknSingleGraphicStyleListBox::HandleResourceChange( aType );
+    
+    APSETUILOGGER_LEAVEFN( EListbox,"SelListbox::HandleResourceChange")
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/src/ApSelectorListBoxModel.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,352 @@
+/*
+* Copyright (c) 2002 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 CApSelectorListboxModel.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "ApSelectorListBoxModel.h"
+#include "ApListItem.h"
+#include <ApSettingsHandlerCommons.h>
+
+#include <featmgr.h>
+
+#include "ApSettingsHandlerLogger.h"
+
+// CONSTANTS
+const TInt  KGPRS_ICON_ID        = 0;
+// No icon for CDMA (yet?) -> use GPRS icon.
+const TInt  KCDMA_ICON_ID        = KGPRS_ICON_ID;
+const TInt  KCSD_ICON_ID         = 1;
+const TInt  KHSCSD_ICON_ID       = 2;
+// const TInt  KSMS_ICON_ID       = 3;   // DEPRECATED
+const TInt  KWLAN_ICON_ID        = 4;
+// fith icon element is the KEASY_WLAN_ICON_ID  but it is not shown 
+// in our UI, but is used by other modules using our 
+// resources!!! const TInt  KEASY_WLAN_ICON_ID   = 5;
+
+const TInt  KPROTECTED_ICON_ID   = 6;
+// get real icons !!! now using GPRS...
+#ifdef __TEST_LAN_BEARER
+    const TInt  KLAN_ICON_ID         = KGPRS_ICON_ID;
+#endif // __TEST_LAN_BEARER
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CApSelectorListboxModel::CApSelectorListboxModel
+// ---------------------------------------------------------
+//
+CApSelectorListboxModel::CApSelectorListboxModel( TGraphicType aGraphicType )
+:CApListItemList(),
+iOffset( 0 ),
+iFeatureInitialised(EFalse),
+iProtectionSupported(EFalse)
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"SelListboxModel::CApSelectorListboxModel<->")
+    iGraphicType = aGraphicType;
+    }
+
+// ---------------------------------------------------------
+// CApSelectorListboxModel::~CApSelectorListboxModel
+// ---------------------------------------------------------
+//
+CApSelectorListboxModel::~CApSelectorListboxModel()
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"SelListboxModel::~CApSelectorListboxModel<->")
+    ResetAndDestroy(); // deletes all elements...
+    }
+
+// ---------------------------------------------------------
+// CApSelectorListboxModel::MdcaCount
+// ---------------------------------------------------------
+//
+TInt CApSelectorListboxModel::MdcaCount() const
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"SelListboxModel::MdcaCount<->")
+    
+    return Count();
+    }
+
+// ---------------------------------------------------------
+// CApSelectorListboxModel::MdcaPoint
+// ---------------------------------------------------------
+//
+TPtrC CApSelectorListboxModel::MdcaPoint( TInt aIndex ) const
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"SelListboxModel::MdcaPoint")
+    
+    // We need to cast away the const-ness from the buffer.
+    // It was definitely made for formatting!
+    FormatListboxText( aIndex,
+        ( MUTABLE_CAST(  TBuf<KMaxApSelectorListboxName>&, iBuf ) ) );
+
+    APSETUILOGGER_LEAVEFN( EListbox,"SelListboxModel::MdcaPoint")
+    return iBuf;
+    }
+
+
+// ---------------------------------------------------------
+// CApSelectorListboxModel::Item4Uid
+// ---------------------------------------------------------
+//
+TInt CApSelectorListboxModel::Item4Uid( TUint32 aUid, TInt& aErr ) const
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"SelListboxModel::Item4Uid")
+    
+    aErr = KErrNone;
+    TInt retval( KErrNotFound );
+    for ( TInt i=0; i<Count(); i++ )
+        {
+        if ( At( i )->Uid() == aUid )
+            {
+            retval = i;
+            break;
+            }
+        }
+    if ( retval == KErrNotFound )
+        {
+        aErr = KErrNotFound;
+        }
+    
+    APSETUILOGGER_LEAVEFN( EListbox,"SelListboxModel::Item4Uid")
+    return retval;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSelectorListboxModel::SetOwnIconOffset
+// ---------------------------------------------------------
+//
+void CApSelectorListboxModel::SetOwnIconOffset( TInt aOffset )
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"SelListboxModel::SetOwnIconOffset<->")
+    
+    iOffset = aOffset;
+    }
+
+
+// ---------------------------------------------------------
+// CApSelectorListboxModel::FormatListboxText
+// ---------------------------------------------------------
+//
+void CApSelectorListboxModel::FormatListboxText( TInt aIndex,
+                                                TDes& aBuf ) const
+    {
+    APSETUILOGGER_ENTERFN( EListbox,"SelListboxModel::FormatListboxText")
+    
+    if ( !iFeatureInitialised )
+        {
+        TRAPD(err, FeatureManager::InitializeLibL());
+        if (err == KErrNone)
+            {
+            CApSelectorListboxModel* tmp = CONST_CAST(CApSelectorListboxModel*, this);
+            tmp->iProtectionSupported = FeatureManager::FeatureSupported( 
+                                            KFeatureIdSettingsProtection );
+            FeatureManager::UnInitializeLib();
+            tmp->iFeatureInitialised = ETrue;
+            }
+        }
+    switch ( iGraphicType )
+        {
+        case EGraphicBearer:
+            {
+            TInt iIconId;
+            switch ( At( aIndex )->BearerType() )
+                {
+                case EApBearerTypeCDMA:
+                    {
+                    iIconId = KCDMA_ICON_ID;
+                    break;
+                    }
+                case EApBearerTypeGPRS:
+                    {
+                    iIconId = KGPRS_ICON_ID;
+                    break;
+                    }
+                case EApBearerTypeCSD:
+                    {
+                    iIconId = KCSD_ICON_ID;
+                    break;
+                    }
+                case EApBearerTypeHSCSD:
+                    {
+                    iIconId = KHSCSD_ICON_ID;
+                    break;
+                    }
+                case EApBearerTypeWLAN:
+                    {
+                    iIconId = KWLAN_ICON_ID;
+                    break;
+                    }
+#ifdef __TEST_LAN_BEARER
+                case EApBearerTypeLAN:
+                    {
+                    iIconId = KLAN_ICON_ID;
+                    break;
+                    }
+#endif // __TEST_LAN_BEARER
+                case EApBearerTypeLANModem:
+                    { // LANMODEM get real icon ID
+                    iIconId = KWLAN_ICON_ID;
+                    break;
+                    }
+                default:
+                    {
+                    // in release, shall not leave here,
+                    // it is checked when filled...
+                    __ASSERT_DEBUG( EFalse, Panic( EInvalidBearerType ) );
+                    iIconId = KGPRS_ICON_ID;
+                    break;
+                    }
+                }
+            if ( iProtectionSupported )
+                {
+                if ( At( aIndex )->IsReadOnly() )
+                    {
+                    TInt iProtectedIconId = KPROTECTED_ICON_ID;
+                    aBuf.Format(
+                                KListItemFormatGraphicProtected,
+                                iOffset+iIconId,
+                                Min( At( aIndex )->Name().Length(),
+                                KMaxListItemNameLength ),
+                                &At( aIndex )->Name(),
+                                iOffset+iProtectedIconId
+                                );
+                    }
+                else
+                    { // protection supported, but not protected
+                    aBuf.Format(
+                                KListItemFormatGraphicBearer,
+                                iOffset+iIconId,
+                                Min( At( aIndex )->Name().Length(),
+                                KMaxListItemNameLength ),
+                                &At( aIndex )->Name()
+                                );
+                    }
+                }
+            else
+                { // protection not supported
+                aBuf.Format(
+                            KListItemFormatGraphicBearer,
+                            iOffset+iIconId,
+                            Min( At( aIndex )->Name().Length(),
+                            KMaxListItemNameLength ),
+                            &At( aIndex )->Name()
+                            );
+                }
+            break;
+            }
+        case EGraphicNone:
+            {
+            aBuf.Format(
+                        KListItemFormatGraphicNone,
+                        Min( At( aIndex )->Name().Length(),
+                        KMaxListItemNameLength ),
+                        &At( aIndex )->Name()
+                        );
+            break;
+            }
+        case EGraphicOnOff:
+            {
+            if ( iProtectionSupported )
+                {
+                TInt ProtectedIconId( 0 );
+                if ( At( aIndex )->IsReadOnly() )
+                    {
+                    ProtectedIconId = KPROTECTED_ICON_ID;
+                    aBuf.Format( 
+                                KListItemFormatGraphicOnOffWithLock,
+                                1, 
+                                Min( At( aIndex )->Name().Length(), 
+                                KMaxListItemNameLength ), 
+                                &At( aIndex )->Name(),
+                                iOffset + ProtectedIconId
+                                );
+                    }
+                else
+                    {
+                    aBuf.Format(
+                            KListItemFormatGraphicOnOff, 
+                            1, 
+                            Min( At( aIndex )->Name().Length(), 
+                            KMaxListItemNameLength ), 
+                            &At( aIndex )->Name() 
+                            ); // magic Number, does not works with anything else
+                    }
+                }
+            else
+                {
+                aBuf.Format(
+                            KListItemFormatGraphicOnOff,
+                            1,
+                            Min( At( aIndex )->Name().Length(),
+                            KMaxListItemNameLength ),
+                            &At( aIndex )->Name()
+                            );
+                }
+            break;
+            }
+        case EGraphicProtection:
+            {
+            if ( iProtectionSupported )
+                {
+                TInt ProtectedIconId( 0 );
+                if ( At( aIndex )->IsReadOnly() )
+                    {
+                    ProtectedIconId = 0;
+                    aBuf.Format( 
+                                KListItemFormatGraphicWithLock,
+                                Min( At( aIndex )->Name().Length(), 
+                                KMaxListItemNameLength ), 
+                                &At( aIndex )->Name(),
+                                iOffset + ProtectedIconId
+                                );
+                    }
+                else
+                    {
+                    aBuf.Format(
+                                KListItemFormatGraphicNone, 
+                                Min( At( aIndex )->Name().Length(), 
+                                KMaxListItemNameLength ), 
+                                &At( aIndex )->Name() 
+                                ); 
+                    }                
+                }
+            else
+                {
+                aBuf.Format(
+                            KListItemFormatGraphicNone, 
+                            Min( At( aIndex )->Name().Length(), 
+                            KMaxListItemNameLength ), 
+                            &At( aIndex )->Name() 
+                            );
+                }
+            break;
+            }
+        default:
+            {
+            __ASSERT_DEBUG( EFalse, Panic( EInvalidBitmapType ) );
+            break;
+            }
+        }
+    
+    APSETUILOGGER_LEAVEFN( EListbox,"SelListboxModel::FormatListboxText")
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/src/ApSettingsCommons.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,151 @@
+/*
+* Copyright (c) 2002 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 common methods.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <e32def.h>
+#include <e32std.h>
+#include <eikenv.h>
+#include <ApSettingsHandlerCommons.h>
+#include "ApSettingsHandlerUI.hrh"
+#include <ApSetUI.rsg>
+#include <AknQueryDialog.h>
+#include <aknnotedialog.h>
+#include <StringLoader.h>
+
+#include <AknProgressDialog.h>
+#include <AknWaitDialog.h>
+
+#include "ApSettingsHandlerLogger.h"
+
+void Panic( TApSettingsHandlerUiPanicCodes aPanic )
+    {
+    APSETUILOGGER_ENTERFN( EOther,"Commons::Panic")
+    
+    _LIT( kApSet, "APSettingsHandlerUi" ) ;
+    User::Panic( kApSet, aPanic ) ;
+    }
+
+
+// ---------------------------------------------------------
+// AskQueryL
+// ---------------------------------------------------------
+//
+TInt AskQueryL( TInt aResId, TDesC* aVar )
+    {
+    APSETUILOGGER_ENTERFN( EOther,"Commons::AskQueryL")
+    
+    HBufC* temp;
+    if ( aVar )
+        {
+        temp = StringLoader::LoadL( aResId, *aVar );
+        CleanupStack::PushL( temp );
+        }
+    else
+        {
+        temp = CEikonEnv::Static()->AllocReadResourceLC( aResId );
+        }
+    CAknQueryDialog* qd = 
+            CAknQueryDialog::NewL( CAknQueryDialog::EConfirmationTone );
+    TInt retval = qd->ExecuteLD( R_CONFIRMATION_QUERY, *temp );
+    CleanupStack::PopAndDestroy();  // temp
+    
+    APSETUILOGGER_LEAVEFN( EOther,"Commons::AskQueryL")
+    return retval;
+    }
+
+
+
+// ---------------------------------------------------------
+// ShowNoteL
+// ---------------------------------------------------------
+//
+TInt ShowNoteL( TInt aResId, TDesC* aVar )
+    {
+    APSETUILOGGER_ENTERFN( EOther,"Commons::ShowNoteL")
+    
+    HBufC* temp;
+    if ( aVar )
+        {
+        temp = StringLoader::LoadL( aResId, *aVar );
+        CleanupStack::PushL( temp );
+        }
+    else
+        {
+        temp = CEikonEnv::Static()->AllocReadResourceLC( aResId );
+        }
+    CAknNoteDialog* dlg =
+        new ( ELeave ) CAknNoteDialog
+                (
+                 REINTERPRET_CAST( CEikDialog**, &dlg ),
+                 CAknNoteDialog::ENoTone,
+                 CAknNoteDialog::EShortTimeout
+                );
+    dlg->PrepareLC( R_GENERAL_NOTE );
+    dlg->SetTextL( *temp );
+    TInt retval = dlg->RunLD();
+    CleanupStack::PopAndDestroy();  // temp
+    
+    APSETUILOGGER_LEAVEFN( EOther,"Commons::ShowNoteL")
+    return retval;
+    }
+
+
+#ifdef __TEST_OOMDEBUG
+    TInt GetTestStateL()
+        {
+        APSETUILOGGER_ENTERFN( EOther,"Commons::GetTestStateL")
+        
+        TInt retval( 0 );
+        RFs fs;
+        User::LeaveIfError( fs.Connect() );
+        CleanupClosePushL<RFs>( fs );
+        TUint att;
+        if ( fs.Att( KTestFileName, att ) == KErrNone )
+            {
+            RFile file;
+            TInt err = file.Open( fs, KTestFileName,
+                                  EFileShareAny | EFileStreamText |
+                                  EFileRead
+                                );
+            if ( err == KErrNone )
+                {
+                TBuf8<256> buf;
+                err = file.Read( buf );
+                if ( err == KErrNone )
+                    {
+                    TInt val;
+                    TLex8 lex( buf );
+                    err = lex.Val( val );
+                    if ( err == KErrNone )
+                        {
+                        retval = val;
+                        }
+                    }
+                }
+            file.Close();
+            }
+        CleanupStack::PopAndDestroy(); // fs, will also close it
+        
+        APSETUILOGGER_LEAVEFN( EOther,"Commons::GetTestStateL")
+        return retval;
+        }
+#endif // __TEST_OOMDEBUG
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/src/ApSettingsDlg.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,6432 @@
+/*
+* Copyright (c) 2002 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 dialog for access point view/edit.
+*
+*/
+
+
+// INCLUDE FILES
+#include "APSettingsHandlerUIVariant.hrh"
+
+
+#include <aknnavide.h>
+#include <akntitle.h>
+#include <AknQueryDialog.h>
+#include <akntextsettingpage.h>
+#include <aknpopupsettingpage.h>
+#include <aknradiobuttonsettingpage.h>
+#include <aknpasswordsettingpage.h>
+#include <aknmfnesettingpage.h>
+
+#include <ApAccessPointItem.h>
+#include <utf.h>
+
+#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include <nifvar_internal.h>
+#endif
+
+
+#include "ApSettingsLookups.h"
+#include "ApSettingsDlg.h"
+#include "ApSettingsModel.h"
+#include <ApSetUI.rsg>
+
+#include <csxhelp/cp.hlp.hrh>
+
+#include "ApSettingsHandlerUI.hrh"
+#include "ApsettingshandleruiImpl.h"
+#include "ApSettingsHandlerConsts.h"
+#include <ApSettingsHandlerCommons.h>
+
+#include "ApSettingsHandlerLogger.h"
+
+#include <commonphoneparser.h>
+
+#include "ApNetSelPopupList.h"
+
+#include "AccessPointTextSettingPage.h"
+
+
+#include <featmgr.h>
+
+#include "FeatureManagerWrapper.h"
+#include "ApMultiLineDataQueryDialog.h"
+
+#include <ConnectionUiUtilities.h>
+#include <wlanmgmtcommon.h>
+#include <centralrepository.h>
+
+// CONSTANTS
+// General Settings UID, Hardcoded
+// const TUid KGeneralSettingsUid={0X100058EC};
+//        const TInt KOptionalDefaultValue    = 1;
+        
+
+
+const TInt KIspCallAnalogue         = 0;
+const TInt KIspCallIsdn110          = 1;
+const TInt KIspCallIsdn120          = 2;
+
+const TInt KBearerListGprs          = 0;
+const TInt KBearerListWLAN          = 1;
+const TInt KBearerListCSD           = 2;
+const TInt KBearerListHSCSD         = 3;
+
+
+
+// They provide the indexes.
+const TInt KBearerArrayCSD           = 0;
+const TInt KBearerArrayGPRS          = 1;
+const TInt KBearerArrayHSCSD         = 2;
+const TInt KBearerArrayWLAN          = 3;
+
+const TInt KBoolMaxNumber           = 1;
+
+_LIT( KEmptyText, "" );
+_LIT( KTxtListItemFormat, " \t%S\t\t%S" );
+_LIT( KTxtMenuListItemFormat, " \t%S\t\t" );
+_LIT( KTxtCompulsory, "\t*" );
+
+_LIT( KTxtNumber, "%d" );
+
+
+_LIT( KKnownNameServer1, "fec0:000:0000:ffff::1" );
+_LIT( KKnownNameServer2, "fec0:000:0000:ffff::2" );
+
+
+const TInt KStaredPasswordLength = 4;
+
+const TUint32 KDefAdhocChannel = 7;
+
+
+const TInt  KItemIndex0 = 0;
+const TInt  KItemIndex1 = 1;
+const TInt  KItemIndex2 = 2;
+const TInt  KItemIndex3 = 3;
+
+// ================= MEMBER FUNCTIONS =======================
+// ---------------------------------------------------------
+// CApSettingsDlg::ConstructAndRunLD
+// Constructs the dialog and runs it.
+// ---------------------------------------------------------
+//
+TInt CApSettingsDlg::ConstructAndRunLD( CApSettingsModel& aModel,
+                                        CApSettingsHandlerImpl& aHandler,
+                                        TUint32& aUid,
+                                        CApAccessPointItem* aItem )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::ConstructAndRunLD")
+    
+    CleanupStack::PushL( this );
+
+    iFeatureManagerWrapper = CFeatureManagerWrapper::NewL();
+    
+    iHelpSupported = FeatureManager::FeatureSupported( KFeatureIdHelp );
+
+#ifdef __TEST_OOMDEBUG
+    RFs fs;
+    User::LeaveIfError( fs.Connect() );
+    CleanupClosePushL<RFs>( fs );
+    TUint att;
+    if ( fs.Att( KTestFileName, att ) == KErrNone )
+        {
+        iMemTestOn = ETrue;
+        }
+    else
+        {
+        iMemTestOn = EFalse;
+        }
+    CleanupStack::PopAndDestroy(); // fs, will also close it
+#endif // __TEST_OOMDEBUG
+
+
+    iUid = &aUid;
+
+    iDataModel = &aModel;
+    iHandler = &aHandler;
+    iVariant = iHandler->iExt->iVariant;
+
+
+    CApAccessPointItem* ap = CApAccessPointItem::NewLC();
+
+    iBearerItemArray = 
+            new( ELeave )CArrayPtrFlat<CApAccessPointItem>( KBearers );
+    iBearerItemArray->ResetAndDestroy();
+    for ( TInt i=0; i<KBearers; i++ )
+        {
+        iBearerItemArray->AppendL( NULL );
+        }
+    TApBearerType ab = ap->BearerTypeL();
+    iBearerItemArray->At( BearerToArrayIndexL( ab ) ) = ap;
+    // Now iApItem is part of array-> destructed member var, pop it.
+    CleanupStack::Pop( ap );
+
+    iApItem = ap;
+    
+    if ( !aItem )
+        {
+        iDataModel->AccessPointDataL( *iUid, *iApItem );
+        }
+    else
+        {
+        iApItem->CopyFromL( *aItem );
+        }
+    iDataModel->ClearWEPAndWPASettings();
+
+    iOldApItem = CApAccessPointItem::NewLC();
+    CleanupStack::Pop(); // member var
+
+    iOldApItem->CopyFromL( *iApItem );
+
+    iOriginalBearerType = iApItem->BearerTypeL();
+
+    ConstructL( R_APSETTINGS_MENUBAR );
+
+    SetBearerTypeL( iApItem->BearerTypeL() );
+    // ExecuteLD will PushL( this ), so we have to Pop it...
+    CleanupStack::Pop(); // this
+
+
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::ConstructAndRunLD")
+    return ExecuteLD( R_APSETTINGS_DIALOG );
+    }
+
+
+
+// Destructor
+CApSettingsDlg::~CApSettingsDlg()
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::~CApSettingsDlg")
+    
+    delete iFeatureManagerWrapper;
+
+    if ( iDataModel )
+        {// Remove ourselves from observers...
+        iDataModel->Database()->RemoveObserver( this );
+        }
+
+    if ( iOldApItem )
+        {
+        delete iOldApItem;
+        }
+
+    if ( iNaviDecorator )
+        {
+        delete iNaviDecorator;
+        }
+
+    if ( iTitlePane )
+        {
+        // set old text back, if we have it...
+        if ( iOldTitleText )
+            {
+            if ( iExitReason != EShutDown )
+                {
+                TRAP_IGNORE( iTitlePane->SetTextL( *iOldTitleText ) );
+                }
+            delete iOldTitleText;
+            }
+        }
+
+    if ( iBearerItemArray )
+        {
+        iBearerItemArray->ResetAndDestroy();
+        delete iBearerItemArray;
+        }
+    
+    if (iBackupApItem)
+        {
+        delete iBackupApItem;
+        }
+
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::~CApSettingsDlg")
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsDlg::OfferKeyEventL( const TKeyEvent& aKeyEvent, 
+//                                 TEventCode aType )
+//  Handles key events
+// ---------------------------------------------------------
+//
+TKeyResponse CApSettingsDlg::OfferKeyEventL( const TKeyEvent& aKeyEvent, 
+                                             TEventCode aType )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::OfferKeyEventL")
+    
+    TKeyResponse retval( EKeyWasNotConsumed );
+    // Only interested in standard key events
+    if ( aType == EEventKey )
+        {
+        // If a menu is showing offer key events to it.
+        if ( CAknDialog::MenuShowing() )
+            {
+            retval = CAknDialog::OfferKeyEventL( aKeyEvent, aType );
+            }
+        else
+            {
+            if ( iList )
+                {
+                // as list IS consuming, must handle because it 
+                // IS the SHUTDOWN...
+                // or, a view switch is shutting us down...
+                if ( aKeyEvent.iCode == EKeyEscape )
+                    {
+                    ProcessCommandL( EEikCmdExit );
+                    retval = EKeyWasConsumed;
+                    }
+                else
+                    {
+                    retval = iList->OfferKeyEventL( aKeyEvent, aType );
+                    if ( iSecSettingsExitReason )
+                        {                        
+                        if ( iSecSettingsExitReason 
+                             & KApUiEventShutDownRequested )
+                            {            
+                            ProcessCommandL( EAknCmdExit );
+                            }
+                        else
+                            {                        
+                            if ( iSecSettingsExitReason 
+                                 & KApUiEventExitRequested )
+                                {            
+                                ProcessCommandL( EApSelCmdExit );
+                                }
+                            }
+                        }
+                    }
+                }
+            else
+                {
+                if ( aKeyEvent.iCode == EKeyOK )
+                    {
+                    ProcessCommandL( EApSelCmdChange );
+                    retval = EKeyWasConsumed;
+                    }
+                }
+            }
+        }
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::OfferKeyEventL")
+    return retval;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsDlg::NewL
+// Two-phase dconstructor, second phase is ConstructAndRunLD
+// ---------------------------------------------------------
+//
+CApSettingsDlg* CApSettingsDlg::NewL( TInt aIspFilter,
+                                      TInt aBearerFilter,
+                                      TInt aSortType,
+                                      TUint32& aEventStore,
+                                      TInt aReqIpvType
+                                      )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::NewL")
+    
+    CApSettingsDlg* db = 
+        new ( ELeave )CApSettingsDlg( aIspFilter, 
+                                      aBearerFilter, 
+                                      aSortType, 
+                                      aEventStore,
+                                      aReqIpvType
+                                      );
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::NewL")
+    return db;
+
+    }
+
+
+
+
+// Constructor
+CApSettingsDlg::CApSettingsDlg( TInt aIspFilter, TInt aBearerFilter, 
+                                TInt aSortType, TUint32& aEventStore,
+                                TInt aReqIpvType )
+:
+iLevel( 0 ),
+iOldIndex( 0 ),
+iOldTopIndex( 0 ),
+iAdvIndex( 0 ),
+iBearerType( EApBearerTypeAll ),
+iIspFilter( aIspFilter ),
+iBearerFilter( aBearerFilter ),
+iSortType( aSortType ),
+iEventStore( &aEventStore ),
+iFieldCount( 0 ),
+iAdvancedFieldCount( 0 ),
+iExitReason( EExitNone ),
+iReqIpvType( aReqIpvType ),
+iL2Ipv4( ETrue ),
+iSecSettingsExitReason(0)
+    {
+    iBackupApItem = NULL;
+    }
+
+
+// ---------------------------------------------------------
+// CApSettingsDlg::OkToExitL( TInt aButtonId)
+// called by framework when the OK button is pressed
+// ---------------------------------------------------------
+//
+TBool CApSettingsDlg::OkToExitL( TInt aButtonId )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::OkToExitL")
+    
+    // Translate the button presses into commands for the appui & current
+    // view to handle
+    TBool retval( EFalse );
+    if ( aButtonId == EAknSoftkeyOptions )
+        {
+        DisplayMenuL() ;
+        }
+    else 
+        {
+        if ( (aButtonId == EApSelCmdChange) 
+            || (aButtonId == EApSelCmdQuickChange))
+            {
+            ProcessCommandL(aButtonId);
+            if ( iSecSettingsExitReason )
+                {                        
+                if ( iSecSettingsExitReason 
+                     & KApUiEventShutDownRequested )
+                    {            
+                    ProcessCommandL( EAknCmdExit );
+//                    retval = ETrue; // exit the dialog
+                    }
+                else
+                    {                        
+                    if ( iSecSettingsExitReason 
+                         & KApUiEventExitRequested )
+                        {            
+                        ProcessCommandL( EApSelCmdExit );
+//                        retval = ETrue; // exit the dialog
+                        }
+                    }
+                }
+            }
+        else
+            {
+            if ( aButtonId == EAknSoftkeyBack )
+                {
+                if ( iLevel )
+                    {
+                    TSaveAction cansave( EApNoAction );
+                    if ( iLevel == 2 )
+                        {// coming back from Ipv4 settings
+                        // check if Wlan and has compulsory fields
+                        if (iBearerType == EApBearerTypeWLAN)
+                            { // WLAN
+                            TApMember member;
+                            cansave = CanSaveWlanCompulsoriesL( member );                        
+                            switch (cansave)
+                                {
+                                case EApCanSave:
+                                    {
+                                    // nothing to do in this case, simply go on.
+                                    iLevel --;
+                                    break;
+                                    }
+                                case EApMustDelete:
+                                    {
+                                    // user said quit without save,
+                                    // restore from iBackupApItem
+                                    RestoreIpv4SettingsL();
+                                    iLevel --;
+                                    break;
+                                    }
+                                case EApShallGoBack:
+                                    {
+                                    // user wants to re-edit, do not come back...
+                                    // no change in iLevel
+                                    
+                                    // Set correct item to edit
+                                    switch ( member )
+                                        {
+                                        case EApWlanIpNetMask:
+                                        case EApIspIPNetMask:
+                                            {
+                                            if ( IsWlanSupported() )
+                                                {                    
+                                                SelectItem( KListIndexWLANSubnetMask );
+                                                retval = EFalse;
+                                                }
+                                            else
+                                                {
+                                                User::Leave( KErrNotSupported );
+                                                }
+                                            break;
+                                            }
+                                        case EApIspIPGateway:
+                                        case EApWlanIpGateway:
+                                            {
+                                            if ( IsWlanSupported() )
+                                                {                    
+                                                SelectItem( KListIndexWLANDefaultGateway );
+                                                retval = EFalse;
+                                                }
+                                            else
+                                                {
+                                                User::Leave( KErrNotSupported );
+                                                }
+                                            break;
+                                            }
+                                        default:
+                                            {// otherwise, nothing to do...
+                                            __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) );
+                                            break;
+                                            }
+                                        }
+                                    break;
+                                    }
+                                case EApNoAction:
+                                default:
+                                    {
+                                    // this is not a valid case as it always one from 
+                                    // the above 3, 
+                                    // nothing to do,
+                                    iLevel --;
+                                    break;
+                                    }
+                                }
+                            }
+                        else
+                            {
+                            iLevel--;
+                            }                        
+                        }
+                    else
+                        {
+                        iLevel--;
+                        }
+                    HandleListboxDataChangeL( EFalse );
+                    if ( iOldIndex >=0 )
+                        {
+                        if ( cansave != EApShallGoBack )
+                            {
+                            iList->SetTopItemIndex( iOldTopIndex );
+                            iList->SetCurrentItemIndexAndDraw( iOldIndex );                        
+                            }
+                        if ( *iEventStore & KApUiEventExitRequested )
+                            {
+                            ProcessCommandL( EApSelCmdExit );
+                            }
+                        }
+                    }
+                else
+                    {
+                    if ( iExitReason == EShutDown )
+                        {
+                        retval = ETrue;
+                        }
+                    else
+                        {
+                        if ( !(*iEventStore & KApUiEventShutDownRequested ) )
+                            {
+                            retval = SaveDataL( );
+                            }
+                        else
+                            {
+                            retval = ETrue;
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::OkToExitL")
+    return retval;
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CApSettingsDlg::InitTextsL
+// called before the dialog is shown
+// to initialize localized textual data
+// ---------------------------------------------------------
+//
+void CApSettingsDlg::InitTextsL()
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::InitTextsL")
+    
+    // set pane texts
+    // first get StatusPane
+    iStatusPane = iEikonEnv->AppUiFactory()->StatusPane();
+    // then get TitlePane
+    iTitlePane = ( CAknTitlePane* ) iStatusPane->ControlL( 
+                                    TUid::Uid( EEikStatusPaneUidTitle ) );
+    // if not already stored, store it for restoring
+    if ( !iOldTitleText )
+        {
+        iOldTitleText = iTitlePane->Text()->AllocL();
+        }
+    // set new titlepane text
+    iTitlePane->SetTextL( iApItem->ConnectionName() );
+    // if not already done, clear NaviPane with adding en empty one
+    if ( !iNaviDecorator )
+        {
+        iNaviPane = ( CAknNavigationControlContainer* ) 
+                        iStatusPane->ControlL( 
+                            TUid::Uid( EEikStatusPaneUidNavi ) );
+        iNaviDecorator = iNaviPane->CreateNavigationLabelL( KEmpty );
+        iNaviPane->PushL( *iNaviDecorator );
+        }
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::InitTextsL")
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CApSettingsDlg::DynInitMenuPaneL
+// ---------------------------------------------------------
+//
+void CApSettingsDlg::DynInitMenuPaneL
+( TInt aResourceId, CEikMenuPane* aMenuPane )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::DynInitMenuPaneL")
+    
+    CAknDialog::DynInitMenuPaneL( aResourceId, aMenuPane );
+    if ( aResourceId == R_APSETTINGS_MENU )
+        {
+        if ( iLevel )
+            {
+            // Disallow Advanced settings item if already in advanced 
+            // or in SMS.
+            aMenuPane->DeleteMenuItem( EApSelCmdAdvanced );
+            }
+		if ( !iHelpSupported )
+			{
+			aMenuPane->DeleteMenuItem( EAknCmdHelp );	
+			}
+        }
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::DynInitMenuPaneL")
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsDlg::HandleListboxDataChangeL
+// called before the dialog is shown to initialize listbox data
+// ---------------------------------------------------------
+//
+void CApSettingsDlg::HandleListboxDataChangeL( TBool aReRead )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::HandleListboxDataChangeL")
+    
+    if ( aReRead && ( *iUid != KApNoneUID ) )
+        { // reload the whole ApItem !
+        // if it does not yet exists, no need to do so...
+        iDataModel->AccessPointDataL( *iUid, *iApItem );
+        iDataModel->ClearWEPAndWPASettings();
+        }
+
+    iBearerType = iApItem->BearerTypeL();
+
+    // fill up our new list with data
+    CDesCArrayFlat* ItemArray = new ( ELeave ) CDesCArrayFlat( 4 );
+    CleanupStack::PushL( ItemArray );
+    switch ( iLevel )
+        {
+        case 0:
+            {
+            FillListWithDataL( *ItemArray, *iField, iFieldCount,
+                               iTitles, iCompulsory );
+            break;
+            }
+        case 1:
+            {
+            FillListWithDataL( *ItemArray, *iFieldAdvanced, 
+                               iAdvancedFieldCount, iTitlesAdvanced, 
+                               iCompulsoryAdvanced );
+            break;
+            }
+        case 2:
+            {
+            FillListWithDataL( *ItemArray, *iFieldL2, iFieldCountL2,
+                               iTitlesL2, iCompulsoryL2 );
+            break;
+            }
+        default:
+            {
+            __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) );
+            break;
+            }
+        }
+
+
+    // if not already stored, store it for restoring
+    if ( !iOldTitleText )
+        {
+        iOldTitleText = iTitlePane->Text()->AllocL();
+        }
+    // set new title text
+    if ( iLevel == 2 )
+        {
+        HBufC* value;
+        if ( iL2Ipv4 )
+            {
+            value = iEikonEnv->AllocReadResourceLC( 
+                            R_APUI_VIEW_IPV4_SETTINGS );
+            }
+        else
+            {                
+            value = iEikonEnv->AllocReadResourceLC( 
+                            R_APUI_VIEW_IPV6_SETTINGS );
+            }
+        iTitlePane->SetTextL( *value );
+        CleanupStack::PopAndDestroy( value );
+        }
+    else
+        {            
+        iTitlePane->SetTextL( iApItem->ConnectionName() );
+        }
+
+    iList->Model()->SetItemTextArray( ItemArray );
+    // now it is owned by the LB, so pop it
+    CleanupStack::Pop(); // do not destroy !
+    iItemArray = ItemArray;
+
+    iList->HandleItemAdditionL();
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::HandleListboxDataChangeL")
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsDlg::SetTextOverrides
+// ---------------------------------------------------------
+//
+void CApSettingsDlg::SetTextOverrides( CTextOverrides* aOverrides )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::SetTextOverrides<->")
+    
+    __ASSERT_DEBUG( aOverrides, Panic( ENullPointer ) );
+    iTextOverrides = aOverrides;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsDlg::HandleApDbEventL
+// called by the active access point framework
+// ---------------------------------------------------------
+//
+void CApSettingsDlg::HandleApDbEventL( TEvent anEvent )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::HandleApDbEventL")
+    
+    switch ( anEvent )
+        {
+        case EDbChanged:
+            {
+            HandleListboxDataChangeL( ETrue );
+            break;
+            }
+        case EDbClosing:
+            {
+            break;
+            }
+        case EDbAvailable:
+            {
+            break;
+            }
+        default:
+            {
+            __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) );
+            break;
+            }
+        }
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::HandleApDbEventL")
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsDlg::GetHelpContext()
+// ---------------------------------------------------------
+//
+void CApSettingsDlg::GetHelpContext(TCoeHelpContext& aContext) const
+    {
+    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")
+    }
+
+
+// ---------------------------------------------------------
+// CApSettingsDlg::PreLayoutDynInitL();
+// called by framework before dialog is shown
+// ---------------------------------------------------------
+//
+void CApSettingsDlg::PreLayoutDynInitL()
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::PreLayoutDynInitL")
+    
+    InitTextsL();
+
+    iList = STATIC_CAST( CAknSettingStyleListBox*, 
+                         Control( KApSettingsListboxId ) );
+
+    iList->CreateScrollBarFrameL( ETrue );
+    iList->ScrollBarFrame()->SetScrollBarVisibilityL
+        ( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
+    HandleListboxDataChangeL( EFalse );
+    iList->SetCurrentItemIndex( 0 );
+    iList->SetListBoxObserver( this );
+
+    iDataModel->Database()->AddObserverL( this );
+
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::PreLayoutDynInitL")
+    }
+
+
+
+
+// From MEikCommandObserver
+void CApSettingsDlg::ProcessCommandL( TInt aCommandId )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::ProcessCommandL")
+    
+    if ( MenuShowing() )
+        {
+        HideMenu();
+        }
+
+    switch ( aCommandId )
+        {
+        case EApSelCmdQuickChange:
+            {
+            ChangeSettingsL( ETrue );
+            break;
+            }
+        case EApSelCmdChange:
+            {
+            ChangeSettingsL( EFalse );
+            break;
+            }
+        case EApSelCmdAdvanced:
+            {
+            if ( iLevel == 0 )
+                {
+                iLevel ++;
+                iOldIndex = iList->CurrentItemIndex();
+                iOldTopIndex = iList->TopItemIndex();
+                iList->SetCurrentItemIndex( 0 );
+                TRAPD( err, HandleListboxDataChangeL( EFalse ) );
+                if ( err )
+                    {
+                    iLevel--;
+                    User::Leave( err );
+                    }
+                }
+            break;
+            }
+        case EAknCmdHelp:
+            {
+            if ( iHelpSupported )
+            	{
+            	iDataModel->LaunchHelpL();
+            	}
+            break;
+            }
+//        case EAknSoftkeyBack:
+        case EApSelCmdExit:
+            {
+            iExitReason = EExit;
+            *iEventStore |= KApUiEventExitRequested;
+            TryExitL( EAknSoftkeyBack );
+            break;
+            }
+        case EAknCmdExit:
+        case EEikCmdExit:
+            {
+            *iEventStore |= KApUiEventShutDownRequested;
+            iExitReason = EShutDown;
+            TryExitL( EAknSoftkeyBack );
+            break;
+            }
+        default:
+            {
+            // silently ignore it
+            break;
+            }
+        }
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::ProcessCommandL")
+    }
+
+
+// From MEikListBoxObserver
+void CApSettingsDlg::HandleListBoxEventL( CEikListBox* /*aListBox*/,
+                                          TListBoxEvent aEventType )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::HandleListBoxEventL")
+    
+    switch ( aEventType )
+        {
+        case EEventEnterKeyPressed:
+            // both handled in the same way for now...
+        case EEventItemDoubleClicked:
+        case EEventItemSingleClicked:
+            {
+            ChangeSettingsL( ETrue );
+            break;
+            }
+        case EEventItemClicked:
+            {
+            break;
+            }
+        case EEventEditingStarted:
+            {
+            break;
+            }
+        case EEventEditingStopped:
+            {
+            break;
+            }
+        default:
+            {
+//            __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) );
+            };
+        };
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::HandleListBoxEventL")
+    }
+
+
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::FillListWithDataL
+//----------------------------------------------------------
+//
+void CApSettingsDlg::FillListWithDataL( CDesCArrayFlat& aItemArray,
+                                        const TApMember& arr, TInt aLength,
+                                        const TInt* aRes,
+                                        const TInt* aCompulsory )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::FillListWithDataL")
+    
+    TInt i;
+    TApMember* sgd = MUTABLE_CAST( TApMember*, &arr );
+    for( i=0; i<aLength; i++ )
+        {
+        switch ( *sgd )
+            {
+            case EApWapGatewayAddress:
+//            case EApIspIPAddr:
+            case EApGprsIPNameServer1:
+            case EApIspIPNameServer1:
+            case EApGprsIPNameServer2:
+            case EApIspIPNameServer2:
+            case EApWapAccessPointName:
+            case EApWapStartPage:
+            case EApGprsAccessPointName:
+            case EApIspLoginName:
+            case EApIspLoginPass:
+            case EApIspIfAuthName:
+            case EApIspIfAuthPass:
+            case EApIspDefaultTelNumber:
+            case EApIspInitString:
+            case EApIspIfCallbackInfo:
+            case EApIspLoginScript:
+            case EApProxyServerAddress:
+            case EApProxyPortNumber:
+            case EApNetworkName:
+            case EApWlanNetworkName:
+//            case EApIspIPNetMask:
+//            case EApWlanIpGateway:
+                {
+                AddTextualListBoxItemL( aItemArray, *sgd, 
+                                        *aRes, *aCompulsory );
+                break;
+                }
+            case EApWlanIpNetMask:
+            case EApIspIPNetMask:
+            case EApIspIPGateway:
+            case EApWlanIpGateway:
+                { // check if they do really needed to be displayed...
+                if ( IsNetMaskAndGatewayVisibleL() )
+                    {
+                    AddTextualListBoxItemL( aItemArray, *sgd, 
+                                        *aRes, *aCompulsory );
+                    }
+                break;
+                }                
+            case EApIspIPAddr:
+                { // GPRS, IPv4 or CSD, IPv4 settings
+                if ( iApItem->BearerTypeL() == EApBearerTypeGPRS )
+                    {
+                    TUint32 tint;
+                    iApItem->ReadUint( EApGprsPdpType, tint );
+                    if ( tint != EIPv6 )
+                        {
+                        AddTextualListBoxItemL( aItemArray, *sgd, 
+                                                *aRes, *aCompulsory );
+                        }
+                    }
+                else
+                    { // CSD
+                    if ( iL2Ipv4 )
+                        {
+                        AddTextualListBoxItemL( aItemArray, *sgd, 
+                                                *aRes, *aCompulsory );
+                        }
+                    }
+                break;
+                }
+            case EApWapCurrentBearer:
+            case EApWapSecurity:
+            case EApWapWspOption:
+            case EApIspPromptForLogin:
+            case EApGprsDisablePlainTextAuth:
+            case EApIspDisablePlainTextAuth:
+            case EApIspBearerCallTypeIsdn:
+            case EApIspIfCallbackEnabled:
+            case EApIspIfCallbackType:
+            case EApIspEnableSWCompression:
+            case EApGprsHeaderCompression:
+            case EApIspUseLoginScript:
+            case EApIspBearerSpeed:
+            case EApGprsPdpType:
+            case EApIP6DNSAddrFromServer:
+            case EApWlanNetworkMode:
+            case EApWlanSecurityMode:
+            case EApWlanScanSSID:
+                {
+                AddOnOffListBoxItemL( aItemArray, *sgd, *aRes, *aCompulsory );
+                break;
+                }
+            case EApWlanChannelId:
+                {
+                if ( IsAdhocChannelVisible() )
+                    {                    
+                    AddOnOffListBoxItemL( aItemArray, *sgd, *aRes, 
+                                          *aCompulsory );
+                    }
+                break;
+                }                
+            case EApIpv4Settings:
+            case EApIpv6Settings:
+                {
+                AddMenuListBoxItemL( aItemArray, *sgd, *aRes, *aCompulsory );
+                break;
+                }
+            case EApWlanSecuritySettings:
+                {
+                AddMenuListBoxItemL( aItemArray, *sgd, *aRes, *aCompulsory );
+                break;
+                }
+            default:
+                {
+                __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) );
+                break;
+                }
+            }
+        sgd++;
+        aRes++;
+        aCompulsory++;
+        }
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::FillListWithDataL")
+    }
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::AddTextualListBoxItemL
+//----------------------------------------------------------
+//
+void CApSettingsDlg::AddTextualListBoxItemL( CDesCArrayFlat& aItemArray,
+                                             TApMember aMember, TInt aRes,
+                                             TInt aCompulsory )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::AddTextualListBoxItemL")
+    
+    HBufC* sgd = CreateTextualListBoxItemL( aMember, aRes, aCompulsory );
+    CleanupStack::PushL( sgd );
+    aItemArray.AppendL( sgd->Des() );
+    CleanupStack::PopAndDestroy( sgd );
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::AddTextualListBoxItemL")
+    }
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::AddOnOffListBoxItem
+//----------------------------------------------------------
+//
+void CApSettingsDlg::AddOnOffListBoxItemL( CDesCArrayFlat& aItemArray,
+                                           TApMember aMember, TInt aRes,
+                                           TInt aCompulsory )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::AddOnOffListBoxItemL")
+    
+    // Read up title text from resource
+    HBufC* sgd = CreateOnOffListBoxItemL( aMember, aRes, aCompulsory );
+    CleanupStack::PushL( sgd );
+    aItemArray.AppendL( sgd->Des() );
+    CleanupStack::PopAndDestroy( sgd );
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::AddOnOffListBoxItemL")
+    }
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::UpdateOnOffListBoxItemL
+//----------------------------------------------------------
+//
+void CApSettingsDlg::UpdateOnOffListBoxItemL( TApMember aMember, TInt aRes, 
+                                              TInt aPos, TInt aCompulsory )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::UpdateOnOffListBoxItemL")
+    
+    // Read up title text from resource
+    HBufC* sgd = CreateOnOffListBoxItemL( aMember, aRes, aCompulsory );
+    CleanupStack::PushL( sgd );
+    // first try to add, if Leaves, list will be untouched
+    iItemArray->InsertL( aPos, sgd->Des() );
+    // if successful, previous item is scrolled up with one,
+    // so delete that one...
+    if ( ++aPos < iItemArray->MdcaCount() )
+        {
+        iItemArray->Delete( aPos );
+        }
+    CleanupStack::PopAndDestroy( sgd );
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::UpdateOnOffListBoxItemL")
+    }
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::TextualListBoxItemL
+//----------------------------------------------------------
+//
+void CApSettingsDlg::UpdateTextualListBoxItemL( TApMember aMember, TInt aRes,
+                                                TInt aPos, TInt aCompulsory  )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::UpdateTextualListBoxItemL")
+
+    HBufC* sgd = CreateTextualListBoxItemL( aMember, aRes, aCompulsory );
+    CleanupStack::PushL( sgd );
+    // first try to add, if Leaves, list will be untouched
+    iItemArray->InsertL( aPos, sgd->Des() );
+    // if successful, previous item is scrolled up with one,
+    // so delete that one...
+    if ( ++aPos < iItemArray->MdcaCount() )
+        {
+        iItemArray->Delete( aPos );
+        }
+    CleanupStack::PopAndDestroy( sgd );
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::UpdateTextualListBoxItemL")
+    }
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::CreateTextualListBoxItem
+//----------------------------------------------------------
+//
+HBufC*  CApSettingsDlg::CreateTextualListBoxItemL( TApMember aMember, 
+                                                   TInt aRes, 
+                                                   TInt aCompulsory )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::CreateTextualListBoxItemL")
+    
+    // both variables needed independently of the following 
+    // conditions so I must declare them here...
+    HBufC16* value;
+    TBool Pushed( EFalse );
+    if ( ( aMember == EApIspLoginScript ) || ( aMember == EApWapStartPage ) 
+         || ( aMember == EApGprsAccessPointName ) 
+         || ( aMember == EApProxyServerAddress ) )
+        {
+        // allocates as much as needed...
+        value = iApItem->ReadConstLongTextL( aMember )->AllocLC();
+        }
+    else
+        {
+        value = HBufC::NewLC( KModifiableTextLength );
+        // handle different 'types' (8 bit or 16 bit) descriptors
+        // and bring them to common base (16 bit...)
+        if ( ( aMember == EApIspIfCallbackInfo ) 
+            || ( aMember == EApIspInitString ) )
+            {
+            HBufC8* tmpValue8 = HBufC8::NewLC( KModifiableTextLength );
+            TPtr8 ptr( tmpValue8->Des() );
+            iApItem->ReadTextL( aMember, ptr );
+            value->Des().Copy( *tmpValue8 );
+            CleanupStack::PopAndDestroy(); // tmpValue8
+            }
+        else
+            {
+            if ( aMember == EApProxyPortNumber )
+                {
+                TUint32 tempint;
+                iApItem->ReadUint( aMember, tempint );
+                TPtr ptr( value->Des() );
+                ptr.Format( KTxtNumber, tempint );
+                }
+            else
+                {
+                TPtr16 ptr( value->Des() );
+                if ( ( aMember == EApIspIfAuthPass ) 
+                    || ( aMember == EApIspLoginPass ) )
+                    {
+                    ptr.SetLength( KStaredPasswordLength );
+                    ptr.Fill( '*' );
+                    }
+                else
+                    {
+                    iApItem->ReadTextL( aMember, ptr );
+                    }
+                }
+            }
+        switch ( aMember )
+            {
+            case EApIspIPAddr:
+                {
+                if ( ( value->Compare( KDynIpAddress ) == 0 )
+                    || ( value->Compare( KEmptyText ) == 0 ) )
+                    {
+                    value = iEikonEnv->AllocReadResourceLC( 
+                                R_APUI_VIEW_IP_ADDR_DYNAMIC );
+                    Pushed = ETrue;
+                    }
+                break;
+                }
+            case EApIspIPNetMask:
+            case EApIspIPGateway:
+            case EApWlanIpNetMask:
+            case EApWlanIpGateway:
+                {
+                if ( ( value->Compare( KDynIpAddress ) == 0 )
+                    || ( value->Compare( KEmptyText ) == 0 ) )
+                    {
+                    value = iEikonEnv->AllocReadResourceLC( 
+                                R_APUI_VIEW_COMPULSORY );
+                    Pushed = ETrue;
+                    }
+                break;
+                }
+            case EApGprsIPNameServer1:
+            case EApIspIPNameServer1:
+            case EApGprsIPNameServer2:
+            case EApIspIPNameServer2:
+                {
+                if ( ( value->Compare( KDynIpAddress ) == 0 ) 
+                     || ( value->Compare( KEmptyText ) == 0 ) )
+                    {
+                    value = iEikonEnv->AllocReadResourceLC( 
+                                R_APUI_VIEW_NEW_AP_DNS_SERVER_AUTOMATIC );
+                    Pushed = ETrue;
+                    }
+                break;
+                }
+            case EApIspDefaultTelNumber:
+            case EApWlanNetworkName:
+                {
+                if ( value->Compare( KEmptyText ) == 0 )
+                    {
+                    value = iEikonEnv->AllocReadResourceLC( 
+                                R_APUI_VIEW_AVKON_COMPULSORY );
+                    Pushed = ETrue;
+                    }
+                break;
+                }
+            default:
+                {
+                break;
+                }
+            }
+        }
+    // Define a heap descriptor to hold all the item text
+    // HBufC is non-modifiable
+    HBufC* title = iEikonEnv->AllocReadResourceLC( aRes );
+
+    HBufC* value1 = ReplaceWhiteSpaceCharactersLC( *value );
+
+    if ( value1->CompareC( KEmpty ) == 0 )
+        { // empty, get 'None' as value
+        HBufC* temp = NULL;
+        switch ( aMember )
+            {
+            case EApWapStartPage:
+                { // get special None for homepage
+                temp = iEikonEnv->AllocReadResourceLC( 
+                                R_APUI_SETT_HOME_PAGE_NONE );
+                break;
+                }
+            case EApIspIfAuthName:
+                { // user name none
+                temp = iEikonEnv->AllocReadResourceLC( 
+                                R_APUI_VIEW_NEW_AP_USER_NAME_NONE );
+                break;
+                }
+            case EApProxyServerAddress:
+                { // proxy server address none
+                temp = iEikonEnv->AllocReadResourceLC( 
+                                R_APUI_VIEW_NEW_AP_PROXY_SERVER_ADDR_NONE );
+                break;
+                }
+            case EApIspIfCallbackInfo:
+                { // callback number none
+                temp = iEikonEnv->AllocReadResourceLC( 
+                                R_APUI_VIEW_NEW_AP_CB_NUMBER_NONE );
+                break;
+                }
+            case EApIspLoginScript:
+                { // login script none
+                temp = iEikonEnv->AllocReadResourceLC( 
+                                R_APUI_VIEW_NEW_AP_LOGIN_SCRIPT_NONE );
+                break;
+                }
+            case EApIspInitString:
+                { // modem init string none
+                temp = iEikonEnv->AllocReadResourceLC( 
+                                R_APUI_VIEW_NEW_AP_MODEM_INIT_NONE );
+                break;
+                }
+            default:
+                { // get 'normal' None for others
+                temp = 
+                    iEikonEnv->AllocReadResourceLC( 
+                                R_APUI_SETT_VAL_FIELD_NONE );
+                break;
+                }
+            }
+        CleanupStack::Pop(); // temp
+        CleanupStack::PopAndDestroy( value1 );
+        CleanupStack::PushL( temp );
+        value1 = temp;
+        }
+
+    // Define a heap descriptor to hold all the item text
+    TInt length = title->Length() + value1->Length() + 10;
+    if ( aCompulsory )
+        {
+        length += 3;
+        }
+    HBufC* itemText = HBufC::NewLC( length );
+
+    // handle exotic language number conversion here
+    TPtr t(title->Des());
+    TPtr v(value1->Des());
+    AknTextUtils::LanguageSpecificNumberConversion( t );
+    AknTextUtils::LanguageSpecificNumberConversion( v );
+    
+    // Define a modifiable pointer descriptor to be able to append text to the
+    // non-modifiable heap descriptor itemText
+    TPtr itemTextPtr = itemText->Des();
+    itemTextPtr.Format( KTxtListItemFormat, title, value1 );
+    if ( aCompulsory )
+        {
+        itemTextPtr.Append( KTxtCompulsory );
+        }
+    CleanupStack::Pop();    // itemtext,
+    if ( Pushed )
+        {
+        // "Dynamic" text from resource if needed
+        CleanupStack::PopAndDestroy();
+        }
+    // title, value, value1.  !value is allocated with LC in both cases...!
+    CleanupStack::PopAndDestroy( 3 );
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::CreateTextualListBoxItemL")
+    return itemText;
+    }
+
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::CreateOnOffListBoxItemL
+//----------------------------------------------------------
+//
+HBufC*  CApSettingsDlg::CreateOnOffListBoxItemL( TApMember aMember, TInt aRes,
+                                                 TInt aCompulsory )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::CreateOnOffListBoxItemL")
+    
+    // Read up title text from resource
+    HBufC* title = iEikonEnv->AllocReadResourceLC( aRes );
+
+    TUint32 aValueResourceID = 0;
+    TBool bvar;
+
+    switch ( aMember )
+        {
+        case EApIspBearerCallTypeIsdn:
+            {// Data call type "Analogue"/"ISDN"
+            TUint32 tempint;
+            iApItem->ReadUint( EApIspBearerCallTypeIsdn, tempint );
+            switch ( tempint )
+                {
+                case ECallTypeISDNv110:
+                    {
+                    aValueResourceID = R_APUI_VIEW_DATACALL_ISDN_110;
+                    break;
+                    }
+                case ECallTypeISDNv120:
+                    {
+                    aValueResourceID = R_APUI_VIEW_DATACALL_ISDN_120;
+                    break;
+                    }
+                case ECallTypeAnalogue:
+                default:
+                    {
+                    aValueResourceID = R_APUI_VIEW_DATACALL_ANALOLGUE;
+                    break;
+                    }
+                }
+            break;
+            }
+        case EApWapWspOption:
+            { // "Continuous"/"Temporary"
+            TUint32 tval;
+            iApItem->ReadUint( aMember, tval );
+            if ( tval ==  EWapWspOptionConnectionOriented )
+                {
+                aValueResourceID = R_APUI_VIEW_CONN_TYPE_CONTIN;
+                }
+            else
+                {
+                aValueResourceID = R_APUI_VIEW_CONN_TYPE_TEMP;
+                }
+            break;
+            }
+        case EApIspIfCallbackType:
+            { // "Use server number"/"Use other number"
+            TUint32 tval;
+            iApItem->ReadUint( aMember, tval );
+            if ( tval == ECallbackActionMSCBCPAcceptServerSpecifiedNumber )
+                {
+                aValueResourceID = R_APUI_VIEW_CB_USE_SERVER_NUMBER;
+                }
+            else
+                {
+                if ( tval == 
+                        ECallbackActionMSCBCPRequireClientSpecifiedNumber )
+                    {
+                    aValueResourceID = R_APUI_VIEW_CB_USE_OTHER_NUMBER;
+                    }
+                }
+            break;
+            }
+        case EApWapSecurity:
+            { // on/off
+            iApItem->ReadBool( aMember, bvar );
+            if ( bvar )
+                {
+                aValueResourceID = R_APUI_VIEW_WTLS_SECURITY_ON;
+                }
+            else
+                {
+                aValueResourceID = R_APUI_VIEW_WTLS_SECURITY_OFF;
+                }
+            break;
+            }
+        case EApIspUseLoginScript:
+            {
+            iApItem->ReadBool( aMember, bvar );
+            if ( bvar )
+                {
+                aValueResourceID = R_APUI_VIEW_USE_LOGINS_YES;
+                }
+            else
+                {
+                aValueResourceID = R_APUI_VIEW_USE_LOGINS_NO;
+                }
+            break;
+            }
+
+        case EApIspEnableSWCompression:
+        case EApGprsHeaderCompression:
+            {
+            iApItem->ReadBool( aMember, bvar );
+            if ( bvar )
+                {
+                aValueResourceID = R_APUI_VIEW_PPP_COMP_YES;
+                }
+            else
+                {
+                aValueResourceID = R_APUI_VIEW_PPP_COMP_NO;
+                }
+            break;
+            }
+        case EApIspPromptForLogin:
+            {
+            iApItem->ReadBool( aMember, bvar );
+            if ( bvar )
+                {
+                aValueResourceID = R_APUI_VIEW_PROMPT_PASSWD_YES;
+                }
+            else
+                {
+                aValueResourceID = R_APUI_VIEW_PROMPT_PASSWD_NO;
+                }
+            break;
+            }
+        case EApIspIfCallbackEnabled:
+            { // yes/no
+            iApItem->ReadBool( aMember, bvar );
+            if ( bvar )
+                {
+                aValueResourceID = R_APUI_VIEW_USE_CB_YES;
+                }
+            else
+                {
+                aValueResourceID = R_APUI_VIEW_USE_CB_NO;
+                }
+            break;
+            }
+        case EApWapCurrentBearer:
+            { // "Packet data"/"SMS"/"Data call"
+            if ( iBearerType == EApBearerTypeCSD )
+                {
+                aValueResourceID = R_APUI_VIEW_BEARER_TYPE_CSD;
+                }
+            else
+                {
+                if ( iBearerType == EApBearerTypeHSCSD )
+                    {
+                    aValueResourceID = R_APUI_VIEW_BEARER_TYPE_HSCSD;
+                    }
+                else
+                    {
+                    if ( iBearerType == EApBearerTypeGPRS )
+                        {
+                        aValueResourceID = R_APUI_VIEW_BEARER_TYPE_GPRS;
+                        }
+                    else
+                        {
+                        if ( IsWlanSupported() )
+                            {
+                            if ( iBearerType == EApBearerTypeWLAN )
+                                {
+                                aValueResourceID = 
+                                            R_APUI_VIEW_BEARER_TYPE_WLAN;
+                                }
+                            else
+                                {
+                                User::Leave( KErrInvalidBearerType );
+                                }
+                            }
+                        else
+                            {    
+                            User::Leave( KErrInvalidBearerType );
+                            }
+                        }
+                    }
+                }
+            break;
+            }
+        case EApGprsDisablePlainTextAuth:
+        case EApIspDisablePlainTextAuth:
+            { // "Normal"/"Secure"
+            iApItem->ReadBool( aMember, bvar );
+            if ( bvar )
+                {
+                aValueResourceID = R_APUI_VIEW_PASSWORD_AUTH_SECURE;
+                }
+            else
+                {
+                aValueResourceID = R_APUI_VIEW_PASSWORD_AUTH_NORMAL;
+                }
+            break;
+            }
+        case EApIspBearerSpeed:
+            {
+            TUint32 uvar;
+            iApItem->ReadUint( aMember, uvar );
+            switch ( TApCallSpeed( uvar ) )
+                {
+                case KSpeedAutobaud:
+                    {
+                    aValueResourceID = R_APUI_VIEW_SPEED_AUTODETECT;
+                    break;
+                    }
+                case KSpeed9600:
+                    {
+                    aValueResourceID = R_APUI_VIEW_SPEED_9600;
+                    break;
+                    }
+                case KSpeed14400:
+                    {
+                    aValueResourceID = R_APUI_VIEW_SPEED_14400;
+                    break;
+                    }
+                case KSpeed19200:
+                    {
+                    aValueResourceID = R_APUI_VIEW_SPEED_19200;
+                    break;
+                    }
+                case KSpeed28800:
+                    {
+                    aValueResourceID = R_APUI_VIEW_SPEED_28800;
+                    break;
+                    }
+                case KSpeed38400:
+                    {
+                    aValueResourceID = R_APUI_VIEW_SPEED_38400;
+                    break;
+                    }
+                case KSpeed43200:
+                    {
+                    aValueResourceID = R_APUI_VIEW_SPEED_43200;
+                    break;
+                    }
+                case KSpeed56000: 
+                    {
+                    aValueResourceID = R_APUI_VIEW_SPEED_56000;
+                    break;
+                    }
+                default:
+                    {
+                    // auto-repair corrupted value
+                    // use 9600 if previous data was not valid...
+                    aValueResourceID = R_APUI_VIEW_SPEED_9600;
+                    }
+                }
+
+            break;
+            }
+        case EApGprsPdpType:
+            {
+            TUint32 uvar( 0 );
+            iApItem->ReadUint( aMember, uvar );
+            if ( uvar == EIPv6 )
+                {
+                aValueResourceID = R_APUI_VIEW_PDP_TYPE_IPV6;
+                }
+            else
+                {
+                aValueResourceID = R_APUI_VIEW_PDP_TYPE_IPV4;
+                }
+            break;
+            }
+        case EApIP6DNSAddrFromServer:
+            {
+            // Change the 'magic numbers'
+            // Add the three possibilities here
+            iApItem->ReadBool( aMember, bvar );
+            TInt stype = GetDomainNameServersTypeL();
+
+            switch ( stype )
+                {
+                case 0:
+                    {
+                    aValueResourceID = 
+                        R_APUI_VIEW_NEW_AP_DNS_SERVERS_AUTOMATIC;
+                    break;
+                    }
+                case 1:
+                    {
+                    aValueResourceID = R_APUI_VIEW_SET_IP_WELL_KNOWN;
+                    break;
+                    }
+                case 2:
+                    {
+                    aValueResourceID = R_APUI_VIEW_SET_IP_USER_DEFINED;
+                    break;
+                    }
+                default:
+                    {
+                    __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) );
+                    break;
+                    }
+                }
+            break;
+            }
+        case EApWlanNetworkMode:
+            {
+            TUint32 netmode( 0 );
+            iApItem->ReadUint( aMember, netmode );
+            if ( netmode == EAdhoc )
+                {
+                aValueResourceID = R_APUI_VIEW_WLAN_NETWORK_MODE_ADHOC;
+                }
+            else
+                {
+                aValueResourceID = R_APUI_VIEW_WLAN_NETWORK_MODE_INFRA;
+                }
+            break;
+            }
+        case EApWlanSecurityMode:
+            {
+            TUint32 secmode( 0 );
+            iApItem->ReadUint( aMember, secmode );
+            switch ( secmode )
+                {
+                case EOpen:
+                    {
+                    aValueResourceID = R_APUI_VIEW_WLAN_SECURITY_MODE_OPEN;
+                    break;
+                    }
+                case EWep:
+                    {
+                    aValueResourceID = R_APUI_VIEW_WLAN_SECURITY_MODE_WEP;
+                    break;
+                    }
+                case E802_1x:
+                    {
+                    aValueResourceID = R_APUI_VIEW_WLAN_SECURITY_MODE_802_1X;
+                    break;
+                    }
+                case EWpa:
+                case EWpa2:
+                    {
+                    aValueResourceID = R_APUI_VIEW_WLAN_SECURITY_MODE_WPA;
+                    break;
+                    }
+                default:
+                    {
+                    aValueResourceID = R_APUI_VIEW_WLAN_SECURITY_MODE_OPEN;
+                    break;
+                    }
+                }
+
+            break;
+            }
+        case EApWlanScanSSID:
+            { // yes/no
+            iApItem->ReadBool( aMember, bvar );
+            if ( bvar )
+                {
+                aValueResourceID = R_APUI_VIEW_HIDDEN_NETWORK_YES;
+                }
+            else
+                {
+                aValueResourceID = R_APUI_VIEW_HIDDEN_NETWORK_NO;
+                }
+            break;
+            }
+        case EApWlanChannelId:
+            { // ad-hoc channel auto / user defined
+            TUint32 channel(0);
+            iApItem->ReadUint( aMember, channel );
+            if ( channel )
+                {
+                aValueResourceID = R_APUI_VIEW_AD_HOC_CHANNEL_USER_DEFINED;
+                }
+            else
+                {
+                aValueResourceID = R_APUI_VIEW_AD_HOC_CHANNEL_AUTO;
+                }
+            break;
+            }
+        default:
+            {
+            __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) );
+            break;
+            }
+        }
+
+    HBufC* value;
+    if ( aValueResourceID )
+        {
+        // Read up value text from resource
+        value = iEikonEnv->AllocReadResourceLC( aValueResourceID );
+        }
+    else
+        {
+        value = HBufC::NewLC( 0 );
+        }
+
+
+    // Define a heap descriptor to hold all the item text
+    TInt length = title->Length() + value->Length() + 10 ;
+    if ( aCompulsory )
+        {
+        length += 3;
+        }
+
+    HBufC* itemText = HBufC::NewLC( length);
+
+    // Define a modifiable pointer descriptor to be able to append text to the
+    // non-modifiable heap descriptor itemText
+    TPtr itemTextPtr = itemText->Des();
+    itemTextPtr.Format( KTxtListItemFormat, title, value);
+    if ( aCompulsory )
+        {
+        itemTextPtr.Append( KTxtCompulsory );
+        }
+
+    CleanupStack::Pop();    // itemText
+    CleanupStack::PopAndDestroy( 2 ); // value, title
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::CreateOnOffListBoxItemL")
+    return itemText;
+    }
+
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::ChangeSettingsL
+//----------------------------------------------------------
+//
+void CApSettingsDlg::ChangeSettingsL( TBool aQuick )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::ChangeSettingsL")
+    
+#ifdef __TEST_OOMDEBUG
+    if ( iMemTestOn )
+        {
+        TInt leavecode( KErrNoMemory );
+
+        TInt ts( GetTestStateL() );
+
+        if ( ts == KEditingTest )
+            {
+            TBuf<48> buf;
+            APSETUILOGGER_WRITE_BUF( _L("Starting Editing memtest") );
+
+            TUint32 rate( 0 );
+            TUint32 retrycount( KOOMRetryCount );
+            TUint32 retryoffset( KOOMRetryOffset );
+            for (
+                rate = 1;
+                ((rate < 50000) && (leavecode == KErrNoMemory)) || retrycount;
+                rate++
+                )
+                {
+                __UHEAP_SETFAIL( RHeap::EDeterministic, rate );
+                TRAP( leavecode, DoChangeSettingsL( aQuick ) );
+                __UHEAP_RESET;
+                if ( !leavecode )
+                    {
+                    retrycount--;
+                    rate += retryoffset;
+                    }
+                }
+            User::LeaveIfError( leavecode );
+            buf.Format( _L("\t Memtest finished, max. rate was: %d )"), rate );
+            APSETUILOGGER_WRITE_BUF( buf );
+            }
+        else
+            {
+            DoChangeSettingsL( aQuick );
+            }
+        }
+    else
+        {
+        DoChangeSettingsL( aQuick );
+        }
+#else
+    DoChangeSettingsL( aQuick );
+#endif // __TEST_OOMDEBUG
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::ChangeSettingsL")
+    }
+
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::SetBearerTypeL
+//----------------------------------------------------------
+//
+void CApSettingsDlg::SetBearerTypeL( TApBearerType aBearer )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::SetBearerTypeL")
+    
+    iBearerType = aBearer;
+
+    HandleListStructureChangeL();
+
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::SetBearerTypeL")
+    }
+
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::InvertSettingsL
+//----------------------------------------------------------
+//
+void CApSettingsDlg::InvertSettingsL( TApMember aDataMember )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::InvertSettingsL")
+    
+    switch ( aDataMember )
+        {
+        case EApIspIfCallbackType:
+            {
+            TUint32 ctype( ECallbackActionMSCBCPRequireClientSpecifiedNumber );
+            iApItem->ReadUint( EApIspIfCallbackType, ctype );
+            if ( ctype == ECallbackActionMSCBCPRequireClientSpecifiedNumber )
+                {
+                iApItem->WriteUint( EApIspIfCallbackType, 
+                         ECallbackActionMSCBCPAcceptServerSpecifiedNumber );
+                }
+            else
+                {
+                iApItem->WriteUint( EApIspIfCallbackType, 
+                         ECallbackActionMSCBCPRequireClientSpecifiedNumber );
+                }            
+            break;
+            }
+        case EApGprsPdpType:
+            {
+            TUint32 ipnettype( 0 );
+            iApItem->ReadUint( EApGprsPdpType, ipnettype );
+            if ( ipnettype == EIPv6 )
+                {
+                iApItem->WriteUint( EApGprsPdpType, EIPv4 );
+                }
+            else
+                {
+                iApItem->WriteUint( EApGprsPdpType, EIPv6 );                
+                }
+            break;
+            }
+        case EApWlanNetworkMode:
+            {
+            TUint32 netmode( 0 );
+            iApItem->ReadUint( EApWlanNetworkMode, netmode );
+            if ( netmode == EAdhoc )
+                {
+                iApItem->WriteUint( EApWlanNetworkMode, EInfra );
+                }
+             else
+                {
+                iApItem->WriteUint( EApWlanNetworkMode, EAdhoc );
+                LimitSecMode();
+                }            
+            break;
+            }
+        case EApWapWspOption:
+            {
+            TUint32 intvar;
+            if ( iApItem->ReadUint( aDataMember, intvar ) == KErrNone )
+                {
+                if ( intvar == EWapWspOptionConnectionless )
+                    {
+                    intvar = EWapWspOptionConnectionOriented;
+                    }
+                else
+                    {
+                    intvar = EWapWspOptionConnectionless;
+                    }
+                iApItem->WriteUint( aDataMember, intvar );
+                }
+            break;
+            }
+        default:
+            {
+            TBool bvar;
+            if ( iApItem->ReadBool( aDataMember, bvar ) == KErrNone )
+                {
+                bvar = !bvar;
+                iApItem->WriteBool( aDataMember, bvar );
+                }
+            }
+        }
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::InvertSettingsL")
+    }
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::ShowPopupSettingPageL
+//----------------------------------------------------------
+//
+TBool CApSettingsDlg::ShowPopupSettingPageL( TApMember aData )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::ShowPopupSettingPageL")
+    
+    TInt currvalue( 0 );
+    TBool retval( EFalse );
+    TBool mustrepeat( EFalse );
+
+    CDesCArrayFlat* items = FillPopupSettingPageLC( aData,  currvalue );
+
+    TInt attr_resid( 0 );
+    GetResId( aData, attr_resid );
+    
+    do
+        {
+        HBufC* titlebuf;
+        CAknRadioButtonSettingPage* dlg;
+        if ( attr_resid )
+            {
+            titlebuf = iEikonEnv->AllocReadResourceLC( attr_resid );
+            dlg = new ( ELeave )CAknRadioButtonSettingPage(
+                                            R_RADIO_BUTTON_SETTING_PAGE, 
+                                            currvalue, 
+                                            items );
+            // must push 'cause SetSettingTextL can leave...
+            CleanupStack::PushL( dlg ); 
+            TPtrC ptr( titlebuf->Des() );
+            dlg->SetSettingTextL( ptr );
+            CleanupStack::Pop(); // dlg
+            }
+        else
+            {
+            dlg = new ( ELeave )CAknRadioButtonSettingPage( 
+                                            R_RADIO_BUTTON_SETTING_PAGE, 
+                                            currvalue, 
+                                            items );
+            }
+        if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenAccepted ) )
+            {
+            if( AskQueryIfWcdmaL( aData , currvalue) )
+                {
+                UpdateFromPopupSettingPageL( aData, currvalue );
+                retval = ETrue;
+                mustrepeat = EFalse;
+                }
+            else
+                {
+                mustrepeat = ETrue;
+                }
+            }
+        else
+            {
+            mustrepeat = EFalse;
+            }
+        if ( attr_resid )
+            {
+            // titlebuf, text title readed from resource...
+            CleanupStack::PopAndDestroy();
+            }
+        }while( mustrepeat );
+
+
+    // items, will also delete all elements in the array!
+    CleanupStack::PopAndDestroy( items );
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::ShowPopupSettingPageL")
+    return retval;
+    }
+
+
+
+
+
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::ShowPopupTextSettingPageL
+//----------------------------------------------------------
+//
+TBool CApSettingsDlg::ShowPopupTextSettingPageL( TApMember aData )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::ShowPopupTextSettingPageL")
+    
+    TBool retval( EFalse );
+
+    // must be prepared for the worst case...
+    TBuf<KModifiableLongTextLength> textToChange;
+
+    HBufC* aBuf1 = GetTextLC( aData );
+
+    HBufC* aBuf = ConvertPerNToDelimLC( aBuf1->Des() );
+
+    TPtr16 ptr( aBuf->Des() );
+    textToChange.Append( ptr );
+
+    TInt page_resid( 0 );
+    TInt TextSettingPageFlags( EAknSettingPageNoOrdinalDisplayed );
+    GetTextResId( aData, page_resid, TextSettingPageFlags );
+
+
+    TBool isLatin ( aData == EApWapStartPage );
+
+    CAccessPointTextSettingPage* dlg =
+        new( ELeave )CAccessPointTextSettingPage( page_resid, textToChange,
+                                                  TextSettingPageFlags,
+                                                  isLatin );
+
+    if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenAccepted ) )
+        {
+        switch ( aData )
+            {
+            case EApWapStartPage:
+            case EApGprsAccessPointName:
+            case EApIspLoginScript:
+            case EApIspInitString:
+            case EApWapAccessPointName:
+            case EApIspLoginName:
+            case EApIspLoginPass:
+            case EApIspIfAuthName:
+            case EApIspIfAuthPass:
+                {
+                HBufC* tmp = ConvertDelimToPerNLC( textToChange );
+                textToChange.Zero();
+                textToChange.Append( tmp->Des() );
+                CleanupStack::PopAndDestroy( tmp );
+                break;
+                }
+            case EApProxyServerAddress:
+                {
+                textToChange.Trim();
+                break;
+                }
+            default:
+                { // no need for conversion
+                break;
+                }
+            }
+        if ( ( aData == EApIspLoginScript ) || ( aData == EApWapStartPage ) 
+            || ( aData == EApGprsAccessPointName ) 
+            || ( aData == EApProxyServerAddress ) )
+            {
+            iApItem->WriteLongTextL( aData, textToChange );
+            }
+        else
+            {
+            if ( aData == EApProxyPortNumber )
+                {
+                // first remove non-number chars
+                HBufC* num = StripNonNumberLC( textToChange );
+                textToChange.Zero();
+                textToChange.Append( num->Des() );
+                CleanupStack::PopAndDestroy( num );
+                // and now get real numberic value
+                TInt tempint;
+                TLex lex;
+                lex.Assign( textToChange );
+                if ( lex.Val( tempint ) )
+                    { // this means some error, set it to 0
+                    tempint = 0;
+                    }
+                iApItem->WriteUint( EApProxyPortNumber, tempint );
+                }
+            else
+                {
+                if ( ( aData == EApIspInitString ) )
+                    {
+                    // must be prepared for the worst case...
+                    TBuf8<KModifiableLongTextLength> textToChange8;
+                    textToChange8.Copy( textToChange );
+                    iApItem->WriteTextL( aData, textToChange8 );
+                    }
+                else
+                    {
+                    if ( aData == EApWapAccessPointName )
+                        {
+                        iApItem->SetNamesL( textToChange );
+                        }
+                    else
+                        {
+                        iApItem->WriteTextL( aData, textToChange );
+                        }
+                    }
+                }
+            }
+        retval = ETrue;
+        }
+    *iEventStore |= KApUiEventEdited;
+    CleanupStack::PopAndDestroy( 2 ); // aBuf, aBuf1
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::ShowPopupTextSettingPageL")
+    return retval;
+    }
+
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::GetTextLC
+//----------------------------------------------------------
+//
+HBufC* CApSettingsDlg::GetTextLC( TApMember aData )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::GetTextLC")
+    
+    HBufC* ret;
+    switch ( aData )
+        {
+        case EApWapStartPage:
+            { // Long text !!!
+            if ( iApItem->ReadTextLengthL( aData ) )
+                {
+                // allocates as much as needed...
+                ret = iApItem->ReadConstLongTextL( aData )->AllocLC();
+                }
+            else
+                {
+                ret = iEikonEnv->AllocReadResourceLC(
+                                        R_APUI_VIEW_WAP_START_PAGE_DEFAULT );
+                }
+            break;
+            }
+        case EApGprsAccessPointName:
+            {
+            // allocates as much as needed...
+            ret = iApItem->ReadConstLongTextL( aData )->AllocLC();
+            break;
+            }
+        case EApIspLoginScript:
+            {
+            // allocates as much as needed...
+            ret = iApItem->ReadConstLongTextL( aData )->AllocLC();
+            break;
+            }
+        case EApProxyServerAddress:
+            {
+            // allocates as much as needed...
+            ret = iApItem->ReadConstLongTextL( aData )->AllocLC();
+            break;
+            }
+        case EApWapGatewayAddress:
+        case EApIspIPAddr:
+        case EApIspIPNetMask:
+        case EApWlanIpNetMask:
+        case EApIspIPGateway:
+        case EApWlanIpGateway:
+        case EApGprsIPNameServer1:
+        case EApIspIPNameServer1:
+        case EApGprsIPNameServer2:
+        case EApIspIPNameServer2:
+            {
+            ret = HBufC::NewLC( KModifiableTextLength );
+            TPtr16 ptr( ret->Des() );
+            iApItem->ReadTextL( aData, ptr );
+            if ( ptr.Compare( KEmptyText ) == 0 )
+                {
+                *ret = KDynIpAddress;
+                }
+            break;
+            }
+        case EApIspInitString:
+            {
+            ret = HBufC::NewLC( KModifiableTextLength );
+            HBufC8* tmpValue8 = HBufC8::NewLC( KModifiableTextLength );
+            TPtr8 ptr( tmpValue8->Des() );
+            iApItem->ReadTextL( aData, ptr );
+            ret->Des().Copy( ptr );
+            CleanupStack::PopAndDestroy(); // tmpValue8
+            break;
+            }
+        case EApProxyPortNumber:
+            {
+            TUint32 tempint;
+            iApItem->ReadUint( EApProxyPortNumber, tempint );
+            ret = HBufC::NewLC( KMaxProxyPortNumberLength );
+            TPtr itemTextPtr = ret->Des();
+            itemTextPtr.Format( KTxtNumber, tempint );
+            break;
+            }
+        default:
+            {
+            ret = HBufC::NewLC( KModifiableTextLength );
+            TPtr16 ptr( ret->Des() );
+            iApItem->ReadTextL( aData, ptr );
+            break;
+            }
+        }
+
+    switch ( aData )
+        {
+        case EApWapStartPage:
+        case EApGprsAccessPointName:
+        case EApIspLoginScript:
+        case EApIspInitString:
+        case EApWapAccessPointName:
+        case EApIspLoginName:
+        case EApIspLoginPass:
+        case EApIspIfAuthName:
+        case EApIspIfAuthPass:
+            {
+            break;
+            }
+        default:
+            {
+            // nothing to do
+            break;
+            }
+        }
+
+
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::GetTextLC")
+    return ret;
+    }
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::GetTextResId
+//----------------------------------------------------------
+//
+void CApSettingsDlg::GetTextResId( TApMember aData, TInt& apage, 
+                                   TInt& aTextSettingPageFlags )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::GetTextResId")
+    
+    if ( ( aData != EApWapAccessPointName )
+         && ( aData != EApIspDefaultTelNumber ) )
+        {
+        aTextSettingPageFlags |= CAknTextSettingPage::EZeroLengthAllowed;
+        }
+    else
+        {
+        aTextSettingPageFlags &= (~CAknTextSettingPage::EZeroLengthAllowed);
+        }
+
+    switch ( aData )
+        {
+        case EApIspInitString:
+            {
+            apage = R_TEXT_SETTING_PAGE_MODEM_INIT_STRING;
+            break;
+            }
+        case EApWapAccessPointName:
+            {
+            apage = R_TEXT_SETTING_PAGE_CONN_NAME;
+            break;
+            }
+        case EApGprsAccessPointName:
+            {
+            apage = R_TEXT_SETTING_PAGE_GPRSAP_NAME;
+            break;
+            }
+        case EApIspLoginScript:// use EDWIN for script.
+            {
+            apage = R_TEXT_SETTING_PAGE_LOGIN_SCRIPT;
+            break;
+            }
+        case EApIspLoginName:
+        case EApIspIfAuthName:
+            {
+            apage = R_TEXT_SETTING_PAGE_LOGIN_NAME;
+            break;
+            }
+        case EApWapStartPage:
+            {
+            apage = R_TEXT_SETTING_PAGE_STARTING_PAGE;
+            break;
+            }
+        // use EDWINS as no such thing as PhoneNumber editor...
+        case EApIspDefaultTelNumber:
+            {
+            apage = R_TEXT_SETTING_PAGE_ACCESS_NUM;
+            break;
+            }
+        case EApIspIfCallbackInfo:
+            {
+            apage = R_TEXT_SETTING_PAGE_CB_NUM;
+            break;
+            }
+        case EApWapGatewayAddress:
+            {
+            apage = R_TEXT_SETTING_PAGE_GW_ADDR;
+            break;
+            }
+        case EApProxyServerAddress:
+            {
+            apage = R_TEXT_SETTING_PAGE_PROXY_SERVER_ADDR;
+            break;
+            }
+        case EApProxyPortNumber:
+            {
+            apage = R_TEXT_SETTING_PAGE_PROXY_PORT_NUMBER;
+            break;
+            }
+        case EApIspIPAddr:
+            {
+            apage = R_TEXT_SETTING_PAGE_ISPIP_ADDR;
+            break;
+            }
+        case EApIspIPNetMask:
+        case EApWlanIpNetMask:
+            {
+            apage = R_TEXT_SETTING_PAGE_ISP_NET_MASK;
+            break;
+            }
+        case EApIspIPGateway:
+        case EApWlanIpGateway:
+            {
+            apage = R_TEXT_SETTING_PAGE_ISP_GATEWAY;
+            break;
+            }            
+        case EApGprsIPNameServer1:
+        case EApIspIPNameServer1:
+            {
+            apage = R_TEXT_SETTING_PAGE_NAME_SERV1;
+            break;
+            }
+        case EApGprsIPNameServer2:
+        case EApIspIPNameServer2:
+            {
+            apage = R_TEXT_SETTING_PAGE_NAME_SERV2;
+            break;
+            }
+        case EApIspLoginPass:
+        case EApIspIfAuthPass:
+            { // use EEikCtSecretEd
+            apage = R_TEXT_SETTING_PAGE_LOGIN_PASSWD;
+            break;
+            }
+
+        case EApIspUseLoginScript:
+            {// use EDWIN:
+            apage = R_SETTING_APP_EDWIN_LOGIN_SCRIPT;
+            break;
+            }
+        case EApWlanNetworkName:
+            {
+            apage = R_TEXT_SETTING_PAGE_NETW_NAME;
+            break;
+            }
+        default:
+            {
+            __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) );
+            apage = 0;
+            break;
+            }
+        }
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::GetTextResId")
+    }
+
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::GetResId
+//----------------------------------------------------------
+//
+void CApSettingsDlg::GetResId( TApMember aData, TInt& aattr )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::GetResId")
+    
+    // not text based ones:
+    switch ( aData )
+        {
+        case EApWapCurrentBearer:
+            {
+            aattr = R_APUI_VIEW_BEARER_TYPE;
+            break;
+            }
+        case EApWapSecurity:
+            {
+            aattr = R_APUI_VIEW_WTLS_SECURITY;
+            break;
+            }
+        case EApWapWspOption:
+            {
+            aattr = R_APUI_VIEW_CONNECTION_TYPE;
+            break;
+            }
+        case EApIspPromptForLogin:
+            {
+            aattr = R_APUI_VIEW_PROMPT_PASSWORD;
+            break;
+            }
+        case EApGprsDisablePlainTextAuth:
+        case EApIspDisablePlainTextAuth:
+            {
+            aattr = R_APUI_VIEW_PASSWORD_AUTH;
+            break;
+            }
+        case EApIspBearerCallTypeIsdn: // used for data call type
+            {
+            aattr = R_APUI_VIEW_DATA_CALL_TYPE;
+            break;
+            }
+        case EApIspBearerSpeed:
+            {
+            aattr = R_APUI_VIEW_MAX_CONN_SPEED;
+            break;
+            }
+        case EApIspIfCallbackEnabled:
+            {
+            aattr = R_APUI_VIEW_USE_CALL_BACK;
+            break;
+            }
+        case EApIspIfCallbackType:
+            {
+            aattr = R_APUI_VIEW_CALL_BACK_TYPE;
+            break;
+            }
+        case EApIspEnableSWCompression:
+        case EApGprsHeaderCompression:
+            {
+            aattr = R_APUI_VIEW_ENABLE_PPP_COMP;
+            break;
+            }
+        case EApIspInitString:
+            {
+            aattr = R_APUI_VIEW_MODEM_INIT_STRING;
+            break;
+            }
+        case EApIspUseLoginScript:
+            {
+            aattr = R_APUI_VIEW_USE_LOGIN_SCRIPT;
+            break;
+            }
+        case EApGprsPdpType:
+            {
+            aattr = R_APUI_VIEW_PDP_TYPE;
+            break;
+            }
+        case EApIP6DNSAddrFromServer:
+            {
+            aattr = R_APUI_VIEW_SET_DNS_SERVERS_IP;
+            break;
+            }
+        case EApWlanNetworkName:
+            {
+            aattr = R_APUI_VIEW_WLAN_NETWORK_NAME;
+            break;
+            }
+        case EApWlanNetworkMode:
+            {
+            aattr = R_APUI_VIEW_WLAN_NETWORK_MODE;
+            break;
+            }
+        case EApWlanSecurityMode:
+            {
+            aattr = R_APUI_VIEW_WLAN_SECURITY_MODE;
+            break;
+            }
+        case EApWlanScanSSID:
+            {
+            aattr = R_APUI_VIEW_WLAN_HIDDEN_NETWORK;
+            break;
+            }
+        case EApWlanChannelId:
+            {
+            aattr = R_APUI_VIEW_AD_HOC;
+            break;
+            }
+        default:
+            {
+            __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) );
+            aattr = 0;
+            break;
+            }
+        }
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::GetResId")
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CApSettingsDlg::FillPopupSettingPageL
+// ---------------------------------------------------------
+//
+CDesCArrayFlat* CApSettingsDlg::FillPopupSettingPageLC( TApMember aData, 
+                                                        TInt& aCurrvalue )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::FillPopupSettingPageLC")
+    
+    CDesCArrayFlat* items = new( ELeave)CDesCArrayFlat( 1 );
+    CleanupStack::PushL( items );
+
+    TUint32 tval( 0 );
+
+    switch ( aData )
+        {
+        case EApIspPromptForLogin:
+            {
+            items->AppendL( *iEikonEnv->AllocReadResourceLC( 
+                                        R_APUI_VIEW_PROMPT_PASSWD_YES ) );
+            CleanupStack::PopAndDestroy();
+            items->AppendL( *iEikonEnv->AllocReadResourceLC( 
+                                        R_APUI_VIEW_PROMPT_PASSWD_NO ) );
+            CleanupStack::PopAndDestroy();
+            GetBoolDataValue( aData, ETrue, aCurrvalue );
+            break;
+            }
+        case EApWapSecurity:
+            {
+            items->AppendL( *iEikonEnv->AllocReadResourceLC(
+                                        R_APUI_VIEW_WTLS_SECURITY_ON ) );
+            CleanupStack::PopAndDestroy();
+            items->AppendL( *iEikonEnv->AllocReadResourceLC( 
+                                        R_APUI_VIEW_WTLS_SECURITY_OFF ) );
+            CleanupStack::PopAndDestroy();
+            GetBoolDataValue( aData, ETrue, aCurrvalue );
+            break;
+            }
+        case EApIspIfCallbackEnabled:
+            {
+            items->AppendL( *iEikonEnv->AllocReadResourceLC( 
+                                        R_APUI_VIEW_USE_CB_YES ) );
+            CleanupStack::PopAndDestroy();
+            items->AppendL( *iEikonEnv->AllocReadResourceLC( 
+                                        R_APUI_VIEW_USE_CB_NO ) );
+            CleanupStack::PopAndDestroy();
+            GetBoolDataValue( aData, ETrue, aCurrvalue );
+            break;
+            }
+        case EApIspEnableSWCompression:
+        case EApGprsHeaderCompression:
+            {
+            items->AppendL( *iEikonEnv->AllocReadResourceLC( 
+                                        R_APUI_VIEW_PPP_COMP_YES  )  );
+            CleanupStack::PopAndDestroy();
+            items->AppendL( *iEikonEnv->AllocReadResourceLC( 
+                                        R_APUI_VIEW_PPP_COMP_NO ) );
+            CleanupStack::PopAndDestroy();
+            GetBoolDataValue( aData, ETrue, aCurrvalue );
+            break;
+            }
+        case EApWapCurrentBearer:
+            {
+            items->AppendL( *iEikonEnv->AllocReadResourceLC( 
+                                        R_APUI_VIEW_BEARER_TYPE_GPRS ) );
+            CleanupStack::PopAndDestroy();
+            
+            if ( IsWlanSupported() )
+                {
+                items->AppendL( *iEikonEnv->AllocReadResourceLC( 
+                                            R_APUI_VIEW_BEARER_TYPE_WLAN ) );
+                CleanupStack::PopAndDestroy();
+                }
+
+            TBool isCsdSupported = 
+                  FeatureManager::FeatureSupported( KFeatureIdAppCsdSupport );
+#ifdef __TEST_CSD_SUPPORT
+            isCsdSupported = ETrue;
+#endif // __TEST_CSD_SUPPORT
+
+            if ( isCsdSupported )
+                {
+                items->AppendL( *iEikonEnv->AllocReadResourceLC(
+                                            R_APUI_VIEW_BEARER_TYPE_CSD ) );
+                CleanupStack::PopAndDestroy();
+                
+                if ( IsHSCSDEnabledL() )
+                    {
+                    items->AppendL( *iEikonEnv->AllocReadResourceLC( 
+                                            R_APUI_VIEW_BEARER_TYPE_HSCSD ) );
+                    CleanupStack::PopAndDestroy();
+                    }
+                }
+            aCurrvalue = BearerType2BearerItemPosL( iBearerType );
+            break;
+            }
+        case EApGprsDisablePlainTextAuth:
+        case EApIspDisablePlainTextAuth:
+            {
+            items->AppendL( *iEikonEnv->AllocReadResourceLC( 
+                                        R_APUI_VIEW_PASSWORD_AUTH_NORMAL ) );
+            CleanupStack::PopAndDestroy();
+            items->AppendL( *iEikonEnv->AllocReadResourceLC( 
+                                        R_APUI_VIEW_PASSWORD_AUTH_SECURE ) );
+            CleanupStack::PopAndDestroy();
+            GetBoolDataValue( aData, EFalse, aCurrvalue );
+            // needs to be inverted?
+            break;
+            }
+        case EApWapWspOption:
+            {
+            items->AppendL( *iEikonEnv->AllocReadResourceLC( 
+                                        R_APUI_VIEW_CONN_TYPE_CONTIN ) );
+            CleanupStack::PopAndDestroy();
+            items->AppendL( *iEikonEnv->AllocReadResourceLC( 
+                                        R_APUI_VIEW_CONN_TYPE_TEMP ) );
+            CleanupStack::PopAndDestroy();
+            iApItem->ReadUint( aData, tval );
+            aCurrvalue = Min( 1, tval );
+            aCurrvalue = !aCurrvalue;
+            break;
+            }
+        case EApIspBearerCallTypeIsdn: // used for data call type
+            {
+            items->AppendL( *iEikonEnv->AllocReadResourceLC(
+                                        R_APUI_VIEW_DATACALL_ANALOLGUE ) );
+            CleanupStack::PopAndDestroy();
+            items->AppendL( *iEikonEnv->AllocReadResourceLC(
+                                        R_APUI_VIEW_DATACALL_ISDN_110 ) );
+            CleanupStack::PopAndDestroy();
+            items->AppendL( *iEikonEnv->AllocReadResourceLC(
+                                        R_APUI_VIEW_DATACALL_ISDN_120 ) );
+            CleanupStack::PopAndDestroy();
+            iApItem->ReadUint( EApIspBearerCallTypeIsdn, tval );
+            switch ( tval )
+                {
+                case ECallTypeISDNv110:
+                    {
+                    aCurrvalue = KIspCallIsdn110;
+                    break;
+                    }
+                case ECallTypeISDNv120:
+                    {
+                    aCurrvalue = KIspCallIsdn120;
+                    break;
+                    }
+                default:
+                case ECallTypeAnalogue:
+                    {
+                    aCurrvalue = KIspCallAnalogue;
+                    break;
+                    }
+                }
+            break;
+            }
+        case EApIspBearerSpeed:
+            {
+            FillUpBearerSpeedValuesL( *items, aCurrvalue );
+            break;
+            }
+        case EApIspIfCallbackType:
+            {
+            items->AppendL( *iEikonEnv->AllocReadResourceLC( 
+                                        R_APUI_VIEW_CB_USE_SERVER_NUMBER ) );
+            CleanupStack::PopAndDestroy();
+            items->AppendL( *iEikonEnv->AllocReadResourceLC( 
+                                        R_APUI_VIEW_CB_USE_OTHER_NUMBER ) );
+            CleanupStack::PopAndDestroy();
+            iApItem->ReadUint( aData, tval );
+            if ( tval == ECallbackActionMSCBCPRequireClientSpecifiedNumber )
+                {
+                aCurrvalue = 1;
+                }
+            else
+                {
+                aCurrvalue = 0;
+                }
+            break;
+            }
+        case EApIspUseLoginScript:
+            {
+            items->AppendL( *iEikonEnv->AllocReadResourceLC( 
+                                        R_APUI_VIEW_USE_LOGINS_YES ) );
+            CleanupStack::PopAndDestroy();
+            items->AppendL( *iEikonEnv->AllocReadResourceLC( 
+                                        R_APUI_VIEW_USE_LOGINS_NO ) );
+            CleanupStack::PopAndDestroy();
+            GetBoolDataValue( aData, ETrue, aCurrvalue );
+            break;
+            }
+        case EApGprsPdpType:
+            {
+            items->AppendL( *iEikonEnv->AllocReadResourceLC( 
+                                        R_APUI_VIEW_PDP_TYPE_IPV4 ) );
+            CleanupStack::PopAndDestroy();
+            items->AppendL( *iEikonEnv->AllocReadResourceLC( 
+                                        R_APUI_VIEW_PDP_TYPE_IPV6 ) );
+            CleanupStack::PopAndDestroy();
+            iApItem->ReadUint( aData, tval );
+            if ( tval == EIPv6 )
+                {
+                aCurrvalue = 1;
+                }
+            else
+                {
+                aCurrvalue = 0;
+                }
+            break;
+            }
+        case EApIP6DNSAddrFromServer:
+            {
+            TApBearerType b = iApItem->BearerTypeL();
+            TBool hasAuto = ( b != EApBearerTypeCSD ) 
+                            && ( b != EApBearerTypeHSCSD ) ;
+            if ( hasAuto )
+                {                
+                items->AppendL( *iEikonEnv->AllocReadResourceLC( 
+                                R_APUI_VIEW_NEW_AP_DNS_SERVERS_AUTOMATIC ) );
+                CleanupStack::PopAndDestroy();
+                }
+            items->AppendL( *iEikonEnv->AllocReadResourceLC( 
+                                        R_APUI_VIEW_SET_IP_WELL_KNOWN ) );
+            CleanupStack::PopAndDestroy();
+            items->AppendL( *iEikonEnv->AllocReadResourceLC( 
+                                        R_APUI_VIEW_SET_IP_USER_DEFINED ) );
+            CleanupStack::PopAndDestroy();
+            TBool bval;
+            iApItem->ReadBool( aData, bval );
+            if ( !bval )
+                {
+                aCurrvalue = GetIPv6DNSTypeL();
+                if ( !hasAuto )
+                    { // no Auto item, dec. currvalue
+                    aCurrvalue--;
+                    }
+                }
+            else
+                {
+                aCurrvalue = 0;
+                }
+            break;
+            }
+        case EApWlanNetworkName:
+            {
+            if ( IsWlanSupported() )
+                {            
+                items->AppendL( *iEikonEnv->AllocReadResourceLC( 
+                                        R_APUI_VIEW_WLAN_NETWORK_NAME_USER ) );
+                CleanupStack::PopAndDestroy();
+                items->AppendL( *iEikonEnv->AllocReadResourceLC( 
+                                        R_APUI_VIEW_WLAN_NETWORK_NAME_SCAN ) );
+                CleanupStack::PopAndDestroy();
+                // set current value as user defined: if not yet given, 
+                // it is true, if it had been already specified, 
+                // we could not know if it was the user or was it scanned
+                aCurrvalue = 0;
+                }
+            else
+                {
+                User::Leave( KErrNotSupported );
+                }
+            break;
+            }
+        case EApWlanNetworkMode:
+            {
+            if ( IsWlanSupported() )
+                {
+                items->AppendL( *iEikonEnv->AllocReadResourceLC( 
+                                    R_APUI_VIEW_WLAN_NETWORK_MODE_INFRA ) );
+                CleanupStack::PopAndDestroy();
+                items->AppendL( *iEikonEnv->AllocReadResourceLC( 
+                                    R_APUI_VIEW_WLAN_NETWORK_MODE_ADHOC ) );
+                CleanupStack::PopAndDestroy();
+                iApItem->ReadUint( aData, tval );
+                if ( tval == EAdhoc )
+                    {
+                    aCurrvalue = 1;
+                    }
+                else
+                    {
+                    aCurrvalue = 0;
+                    }
+                }
+            else
+                {
+                User::Leave( KErrNotSupported );
+                }
+            break;
+            }
+        case EApWlanScanSSID:
+            {
+            if ( IsWlanSupported() )
+                {
+                TBool bval(EFalse);
+                items->AppendL( *iEikonEnv->AllocReadResourceLC( 
+                                    R_APUI_VIEW_HIDDEN_NETWORK_NO ) );
+                CleanupStack::PopAndDestroy();
+                items->AppendL( *iEikonEnv->AllocReadResourceLC( 
+                                    R_APUI_VIEW_HIDDEN_NETWORK_YES ) );
+                CleanupStack::PopAndDestroy();
+                iApItem->ReadBool( aData, bval );
+                if ( bval )
+                    {
+                    aCurrvalue = 1;
+                    }
+                else
+                    {
+                    aCurrvalue = 0;
+                    }
+                }
+            else
+                {
+                User::Leave( KErrNotSupported );
+                }
+            break;
+            }
+        case EApWlanChannelId:
+            {
+            if ( IsWlanSupported() )
+                {
+                TUint32 channel(0);
+                items->AppendL( *iEikonEnv->AllocReadResourceLC( 
+                                R_APUI_VIEW_AD_HOC_CHANNEL_AUTO ) );
+                CleanupStack::PopAndDestroy();
+                items->AppendL( *iEikonEnv->AllocReadResourceLC( 
+                                R_APUI_VIEW_AD_HOC_CHANNEL_USER_DEFINED ) );
+                CleanupStack::PopAndDestroy();
+                iApItem->ReadUint( aData, channel );
+                if ( channel )
+                    {
+                    aCurrvalue = 1;
+                    }
+                else
+                    {
+                    aCurrvalue = 0;
+                    }
+                }
+            else
+                {
+                User::Leave( KErrNotSupported );
+                }
+            break;
+            }
+        case EApWlanSecurityMode:
+            {
+            if ( IsWlanSupported() )
+                {
+                TUint32 netmode(0);
+                
+                items->AppendL( *iEikonEnv->AllocReadResourceLC( 
+                                    R_APUI_VIEW_WLAN_SECURITY_MODE_OPEN ) );
+                CleanupStack::PopAndDestroy();
+                items->AppendL( *iEikonEnv->AllocReadResourceLC( 
+                                    R_APUI_VIEW_WLAN_SECURITY_MODE_WEP ) );
+                CleanupStack::PopAndDestroy();
+
+                iApItem->ReadUint( EApWlanNetworkMode, netmode );
+                if ( netmode == EInfra )
+                    {
+                    items->AppendL( *iEikonEnv->AllocReadResourceLC( 
+                                    R_APUI_VIEW_WLAN_SECURITY_MODE_802_1X ) );
+                    CleanupStack::PopAndDestroy();
+                    items->AppendL( *iEikonEnv->AllocReadResourceLC( 
+                                    R_APUI_VIEW_WLAN_SECURITY_MODE_WPA ) );
+                    CleanupStack::PopAndDestroy();
+                    }
+                    
+                iApItem->ReadUint( aData, tval );
+                switch ( tval )
+                    {
+                    case EOpen:
+                        {
+                        aCurrvalue = 0;
+                        break;
+                        }
+                    case EWep:
+                        {
+                        aCurrvalue = 1;
+                        break;
+                        }
+                    case E802_1x:
+                        {
+                        aCurrvalue = 2;
+                        if ( netmode != EInfra )
+                            {
+                            aCurrvalue--;
+                            }
+                        break;
+                        }
+                    case EWpa:
+                    case EWpa2:
+                        {
+                        aCurrvalue = 3;
+                        if ( netmode != EInfra )
+                            {
+                            aCurrvalue-= 2;
+                            }
+                        break;
+                        }
+                    default:
+                        {
+                        aCurrvalue = 0;
+                        break;
+                        }
+                    }
+                }
+            else
+                {
+                User::Leave( KErrNotSupported );
+                }
+            break;
+            }
+        default:
+            {
+            __ASSERT_DEBUG( EFalse, Panic ( EUnknownCase ) );
+            User::Leave( KErrInvalidColumn );
+            break;
+            }
+        }
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::FillPopupSettingPageLC")
+    return items;
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CApSettingsDlg::UpdateFromPopupSettingPageL
+// ---------------------------------------------------------
+//
+void CApSettingsDlg::UpdateFromPopupSettingPageL( TApMember aData, 
+                                                  TInt aCurrvalue )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::UpdateFromPopupSettingPageL")
+    
+    switch ( aData )
+        {
+        case EApWapSecurity:
+        case EApIspPromptForLogin:
+        case EApIspIfCallbackEnabled:
+        case EApIspEnableSWCompression:
+        case EApGprsHeaderCompression:
+        case EApIspUseLoginScript:
+            { // INVERTED!
+            iApItem->WriteBool( aData, !( TBool( aCurrvalue ) ) );
+            break;
+            }
+        case EApWlanScanSSID:
+        case EApGprsDisablePlainTextAuth:
+        case EApIspDisablePlainTextAuth:
+            { // NOT INVERTED!
+            iApItem->WriteBool( aData, ( TBool( aCurrvalue ) ) );
+            break;
+            }
+        case EApWapWspOption:
+            {
+            if ( aCurrvalue )
+                {
+                iApItem->WriteUint( EApWapWspOption, 
+                                    EWapWspOptionConnectionless );
+                }
+            else
+                {
+                iApItem->WriteUint( EApWapWspOption, 
+                                    EWapWspOptionConnectionOriented );
+                }
+            break;
+            }
+        case EApWapCurrentBearer:
+            {
+            DoBearerChangeL( aCurrvalue );
+            break;
+            }
+        case EApIspBearerSpeed:
+            {
+            iApItem->WriteUint( EApIspBearerSpeed,
+                                GetBearerSpeedForSelection( aCurrvalue )
+                              );
+            break;
+            }
+        case EApIspIfCallbackType:
+            { // UINT
+            if ( aCurrvalue )
+                {
+                iApItem->WriteUint( EApIspIfCallbackType, 
+                        ECallbackActionMSCBCPRequireClientSpecifiedNumber );
+                }
+            else
+                {
+                iApItem->WriteUint( EApIspIfCallbackType, 
+                        ECallbackActionMSCBCPAcceptServerSpecifiedNumber );
+                }
+            break;
+            }
+        case EApIspBearerCallTypeIsdn: // used for data call type
+            {
+            // as order is the same in UI and in enum, simply write it
+            iApItem->WriteUint( EApIspBearerCallTypeIsdn, aCurrvalue );
+            LimitSpeed();
+            break;
+            }
+        case EApGprsPdpType:
+            {
+            // get value to write
+            if ( aCurrvalue )
+                {
+                aCurrvalue = EIPv6;
+                }
+            else
+                {
+                aCurrvalue = EIPv4;
+                }
+            iApItem->WriteUint( EApGprsPdpType, aCurrvalue );
+            break;
+            }
+        case EApIP6DNSAddrFromServer:
+            {
+            // if it is CSD or HSCSD, there is NO AUTOMATIC value, 
+            // just the next two: Well-known & User defined...
+            // So in those cases, aCurrvalue must be 0 & 1, which
+            // corresponds to the normal 1, 2 so it should be incremented
+            TInt realvalue = aCurrvalue;
+            TApBearerType b = iApItem->BearerTypeL();
+            if ( ( b == EApBearerTypeCSD ) || ( b == EApBearerTypeHSCSD ) )
+                {
+                realvalue++;
+                }
+
+            if ( realvalue == 2 )
+                { // user defined!!!
+                TBool isip6( EFalse );
+                if ( iApItem->BearerTypeL() == EApBearerTypeGPRS )
+                    {
+                    TUint32 ival(0);
+                    iApItem->ReadUint( EApGprsPdpType, ival );
+                    if ( ival == EIPv6 )
+                        {
+                        isip6 = ETrue;
+                        }
+                    }
+                else
+                    {
+                    isip6 = !iL2Ipv4;
+                    }
+                GetNameServersL( isip6 );
+                }
+            else
+                {
+                if ( realvalue == 1 )
+                    { // well-known
+                    // write default well known name server values
+                    iApItem->WriteTextL( EApIP6NameServer1, 
+                                         KKnownNameServer1 );
+                    iApItem->WriteTextL( EApIP6NameServer2, 
+                                         KKnownNameServer2 );
+                    }
+                else
+                    {
+                    iApItem->WriteTextL( EApIP6NameServer1, KDynIpv6Address );
+                    iApItem->WriteTextL( EApIP6NameServer2, KDynIpv6Address );
+                    }
+                }
+            break;
+            }
+        case EApWlanNetworkMode:
+            {
+            if ( IsWlanSupported() )
+                {
+                if ( aCurrvalue )
+                    {
+                    iApItem->WriteUint( EApWlanNetworkMode, EAdhoc );
+                    LimitSecMode();
+                    }
+                else
+                    {
+                    iApItem->WriteUint( EApWlanNetworkMode, EInfra );
+                    }
+                
+                }
+            else
+                {
+                User::Leave( KErrNotSupported );
+                }
+            break;
+            }
+        case EApWlanSecurityMode:
+            {
+            if ( IsWlanSupported() )
+                {
+                TInt secmode(EOpen);
+                switch ( aCurrvalue  )
+                    {
+                    case KItemIndex0:
+                        {
+                        secmode = EOpen;
+                        break;
+                        }
+                    case KItemIndex1:
+                        {
+                        secmode = EWep;
+                        break;
+                        }
+                    case KItemIndex2:
+                        {
+                        secmode = E802_1x;
+                        break;
+                        }
+                    case KItemIndex3:
+                        {
+                        secmode = EWpa;
+                        break;
+                        }
+                    default:
+                        {
+                        secmode = EOpen;
+                        break;
+                        }
+                    }
+                iApItem->WriteUint( EApWlanSecurityMode, secmode );
+                }
+            else
+                {
+                User::Leave( KErrNotSupported );
+                }                
+            break;
+            }
+        case EApWlanChannelId:
+            {
+            if ( IsWlanSupported() )
+                {
+                if ( aCurrvalue )
+                    { // user defined, ask number from user, offer 7 as default
+                    TUint32 channel = GetAdHocChannelL();
+                    iApItem->WriteUint( EApWlanChannelId, channel );
+                    }
+                else
+                    { // auto, write 0
+                    iApItem->WriteUint( EApWlanChannelId, aCurrvalue );
+                    }
+                }
+            else
+                {
+                User::Leave( KErrNotSupported );
+                }                
+            break;
+            }
+        default:
+            {
+            __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) );
+            User::Leave( KErrInvalidColumn );
+            break;
+            }
+        }
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::UpdateFromPopupSettingPageL")
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsDlg::CanSaveL( )
+// ---------------------------------------------------------
+//
+CApSettingsDlg::TSaveAction CApSettingsDlg::CanSaveL( TApMember& aDataNeeded )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::CanSaveL")
+    
+    TSaveAction retval( EApCanSave );
+
+    // it is used in two cases, less code by doing it here
+    HBufC *sgd = HBufC::NewLC( KModifiableTextLength );
+    TPtr16 ptr( sgd->Des() );
+
+    switch ( iBearerType )
+        {
+        case EApBearerTypeCSD:
+        case EApBearerTypeHSCSD:
+            {
+            iApItem->ReadTextL( EApIspDefaultTelNumber, ptr );
+            if ( *sgd == KEmptyText ) 
+                {
+                retval = EApMustDelete;
+                if ( !( *iEventStore & KApUiEventExitRequested ) )
+                    {
+                    if ( ! AskQueryL( R_APUI_AP_ACCESS_NUMBER_NOT ) )
+                        {
+                        retval = EApShallGoBack;
+                        aDataNeeded = EApIspDefaultTelNumber;
+                        }
+                    }
+                }
+            break;
+            }
+        case EApBearerTypeGPRS:
+            {
+            //  nothing to do...
+            break;
+            }
+        case EApBearerTypeWLAN:
+            {
+            if ( IsWlanSupported() )
+                {
+                iApItem->ReadTextL( EApWlanNetworkName, ptr );
+                if ( *sgd == KEmptyText ) 
+                    {
+                    retval = EApShallGoBack;
+                    aDataNeeded = EApWlanNetworkName;
+                    if ( !( *iEventStore & KApUiEventExitRequested ) )
+                        {
+                        if ( AskQueryL( R_APUI_AP_WLAN_NAME_NOT_DEFINED ) )
+                            {
+                            retval = EApMustDelete;
+                            }
+                        }
+                    }
+                if ( (retval != EApShallGoBack) && (retval != EApMustDelete) 
+                     && IsNetMaskAndGatewayVisibleL() )
+                    { // now check compulsory fields
+                    iApItem->ReadTextL( EApWlanIpNetMask, ptr );
+                    if ( ( ptr.Compare( KDynIpAddress ) == 0 ) 
+                        || ( ptr.Compare( KEmptyText ) == 0 ) )
+                        {
+                        retval = EApShallGoBack;
+                        aDataNeeded = EApWlanIpNetMask;
+                        if ( AskQueryL( 
+                            R_APUI_VIEW_NETW_QUEST_IAP_INCOMPLETE_DELETE ) )
+                            {
+                            retval = EApMustDelete;
+                            }                                                
+                        }
+                    else
+                        {                        
+                        iApItem->ReadTextL( EApIspIPGateway, ptr );
+                        if ( ( sgd->Compare( KDynIpAddress ) == 0 ) 
+                            || ( sgd->Compare( KEmptyText ) == 0 ) )
+                            {
+                            retval = EApShallGoBack;
+                            aDataNeeded = EApIspIPGateway;
+                            if ( AskQueryL( 
+                                R_APUI_VIEW_NETW_QUEST_IAP_INCOMPLETE_DELETE )
+                               )
+                                {
+                                retval = EApMustDelete;
+                                }                            
+                            }
+                        }
+                    }
+                if ( (retval != EApShallGoBack) && (retval != EApMustDelete) 
+                     && (!HasSecuritySettingsFilledL()) )
+                    {
+                    retval = EApShallGoBack;
+                    aDataNeeded = EApWlanSecuritySettings;
+                    if ( !( *iEventStore & KApUiEventExitRequested ) )
+                        {
+                        if ( AskQueryL( R_APUI_AP_WLAN_SEC_SETT_EMPTY ) )
+                            {
+                            retval = EApMustDelete;
+                            }
+                        }
+                    }
+                }
+            else
+                {
+                User::Leave( KErrNotSupported );
+                }
+            break;            
+            }
+        default:
+            { // in release, leave, in debug, PANIC
+            __ASSERT_DEBUG( EFalse, Panic( EInvalidBearerType ) );
+            User::Leave( KErrInvalidBearerType );
+            break;
+            }
+        }
+    CleanupStack::PopAndDestroy( sgd );  // sgd
+
+    if ( ( retval == EApShallGoBack ) && 
+         ( *iEventStore & KApUiEventExitRequested ) )
+        {
+        retval = EApNoAction;
+        }
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::CanSaveL")
+    return retval;
+    }
+
+
+
+
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::ShowPopupIpAddrSettingPageL
+//----------------------------------------------------------
+//
+void CApSettingsDlg::ShowPopupIpAddrSettingPageL( TApMember aData )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::ShowPopupIpAddrSettingPageL")
+    
+    HBufC* aBuf = HBufC::NewLC( KModifiableTextLength );
+    TPtr16 ptr( aBuf->Des() );
+
+    iApItem->ReadTextL( aData, ptr );
+
+    TBuf<KModifiableTextLength> textToChange;
+
+    textToChange.Append( ptr );
+
+    TInt page_resid( 0 );
+    TInt TextSettingPageFlags( EAknSettingPageNoOrdinalDisplayed );
+    GetTextResId( aData, page_resid, TextSettingPageFlags  );
+
+    TInetAddr AddrToChange;
+    AddrToChange.Input( textToChange );
+    CAknIpFieldSettingPage* dlg = 
+            new( ELeave )CAknIpFieldSettingPage( page_resid, AddrToChange );
+    if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenAccepted ) )
+        {
+        // first need to check phone number validity, if not, 
+        // display error msg,
+        AddrToChange.Output( textToChange );
+        iApItem->WriteTextL( aData, textToChange );
+        }
+    CleanupStack::PopAndDestroy(); // aBuf
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::ShowPopupIpAddrSettingPageL")
+    }
+
+
+
+
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::ShowPopupPhoneNumSettingPageL
+//----------------------------------------------------------
+//
+void CApSettingsDlg::ShowPopupPhoneNumSettingPageL( TApMember aData )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::ShowPopupPhoneNumSettingPageL")
+    
+    HBufC* aBuf = HBufC::NewLC( KModifiableTextLength );
+    TPtr16 ptr( aBuf->Des() );
+
+    if ( aData == EApIspIfCallbackInfo )
+        { // 8 bit text
+        HBufC8* tmpValue8 = HBufC8::NewLC( KModifiableTextLength );
+        TPtr8 ptr8( tmpValue8->Des() );
+        iApItem->ReadTextL( aData, ptr8 );
+        ptr.Copy( ptr8 );
+        CleanupStack::PopAndDestroy(); // tmpvalue8
+        }
+    else
+        {
+        iApItem->ReadTextL( aData, ptr );
+        }
+
+    TBuf<KModifiableTextLength> textToChange;
+
+    textToChange.Append( ptr );
+
+    TInt page_resid( 0 );
+    TInt TextSettingPageFlags( EAknSettingPageNoOrdinalDisplayed );
+    GetTextResId( aData, page_resid, TextSettingPageFlags );
+    TBool mustgoon( ETrue );
+    do
+        {
+        CAknSettingPage* dlg = 
+                new( ELeave )CAknTextSettingPage( page_resid, 
+                                                  textToChange, 
+                                                  TextSettingPageFlags );
+        if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenAccepted ) )
+            {
+            // first need to check phone number validity,
+            // if not, dispaly error msg,
+            // bearing in mind that if empty is not allowed,
+            // we can not got empty text from editor, so IF it is not a valid
+            // phone number, but it is empty, thna it is allowed and
+            // it is the user's wish, so go on as valid...
+            // MNAN-6XBFNB: Digits that are not western should also be accepted
+            // Convert digits to western and check the phone number like this.
+            TBuf<KModifiableTextLength> temp;
+            temp = textToChange;
+            AknTextUtils::ConvertDigitsTo( temp, EDigitTypeWestern );
+            
+            if ( CommonPhoneParser::IsValidPhoneNumber
+                    ( temp, CommonPhoneParser::EContactCardNumber )                   
+                    || ( temp.Compare( KEmpty ) == 0) )
+                {
+                if ( aData == EApIspIfCallbackInfo )
+                    { // 8 bit text
+                    HBufC8* tmpValue8 = HBufC8::NewLC( KModifiableTextLength );
+                    TPtr8 ptr8( tmpValue8->Des() );
+                    iApItem->ReadTextL( aData, ptr8 );
+                    ptr8.Copy( textToChange );
+                    iApItem->WriteTextL( aData, ptr8 );
+                    CleanupStack::PopAndDestroy(); // tmpvalue8
+                    }
+                else
+                    {
+                    iApItem->WriteTextL( aData, textToChange );
+                    }
+                mustgoon = EFalse;
+                }
+            else
+                { // give invalid number message
+                ShowNoteL( R_APUI_VIEW_INVALID_NUMBER );
+                }
+            }
+        else
+            {
+            mustgoon = EFalse;
+            }
+        }
+        while( mustgoon );
+    CleanupStack::PopAndDestroy(); // aBuf
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::ShowPopupPhoneNumSettingPageL")
+    }
+
+
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::ShowPopupPasswordPageL
+//----------------------------------------------------------
+//
+void CApSettingsDlg::ShowPopupPasswordPageL( TApMember aData )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::ShowPopupPasswordPageL")
+    
+    // must be prepared for the worst case...
+    TBuf<KMaxLoginPasswordLength> newpass;
+
+    TUint32 txtLength = iApItem->ReadTextLengthL( aData );
+    // allocates as much as needed...
+    HBufC* oldpass = HBufC::NewLC( txtLength );
+    TPtr16 ptr( oldpass->Des() );
+    iApItem->ReadTextL( aData, ptr );
+
+    CAknAlphaPasswordSettingPage* dlg = 
+            new( ELeave )CAknAlphaPasswordSettingPage(
+                            R_TEXT_SETTING_PAGE_LOGIN_PASSWD, 
+                            newpass, ptr );
+    CleanupStack::PushL(dlg);
+    // As password is asked only once...
+    dlg->SetMaxPasswordLength( KMaxLoginPasswordLength );
+    CleanupStack::Pop();
+    if ( dlg->ExecuteLD(CAknSettingPage::EUpdateWhenChanged) )
+        {
+        iApItem->WriteTextL( aData, newpass );
+        }
+    CleanupStack::PopAndDestroy(); // oldpass
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::ShowPopupPasswordPageL")
+    }
+
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::GetBoolDataValue
+//----------------------------------------------------------
+//
+void CApSettingsDlg::GetBoolDataValue( TApMember aData, TBool aInvert, 
+                                       TInt& aCurrvalue)
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::GetBoolDataValue")
+    
+    iApItem->ReadBool( aData, aCurrvalue);
+    // just to be on the sure side...
+    aCurrvalue = Min( KBoolMaxNumber, aCurrvalue);
+    if ( aInvert)
+        {
+        aCurrvalue = !aCurrvalue;
+        }
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::GetBoolDataValue")
+    }
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::DoBearerChangeL
+//----------------------------------------------------------
+//
+void CApSettingsDlg::DoBearerChangeL( TInt aCurrvalue)
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::DoBearerChangeL")
+    
+    TApBearerType newbearer = BearerItemPos2BearerTypeL( aCurrvalue );
+    HandleBearerChangeL( newbearer );
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::DoBearerChangeL")
+    }
+
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::HandleBearerChangeL
+//----------------------------------------------------------
+//
+void CApSettingsDlg::HandleBearerChangeL( TApBearerType aBearer)
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::HandleBearerChangeL")
+    
+    if ( iBearerItemArray->At( BearerToArrayIndexL( aBearer)) == NULL)
+        {
+        CApAccessPointItem* ap = CApAccessPointItem::NewLC();
+        ap->CopyFromL( *iApItem);
+        ap->WriteUint( EApWapAccessPointID, iApItem->WapUid());
+        iBearerItemArray->At( BearerToArrayIndexL( aBearer)) = ap;
+        iApItem = ap;
+        CleanupStack::Pop(); // ap
+        }
+    else
+        {
+        iApItem = iBearerItemArray->At( BearerToArrayIndexL( aBearer));
+        }
+    iApItem->SetBearerTypeL( aBearer );
+    SetBearerTypeL( aBearer );
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::HandleBearerChangeL")
+    }
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::BearerToArrayIndexL
+//----------------------------------------------------------
+//
+TInt32 CApSettingsDlg::BearerToArrayIndexL( TApBearerType aBearer)
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::BearerToArrayIndexL")
+    
+    TInt32 retval( KBearerArrayGPRS );
+    switch( aBearer )
+        {
+        case EApBearerTypeCSD:
+            {
+            retval = KBearerArrayCSD;
+            break;
+            }
+        case EApBearerTypeGPRS:
+            {
+            retval = KBearerArrayGPRS;
+            break;
+            }
+        case EApBearerTypeHSCSD:
+            {
+            retval = KBearerArrayHSCSD;
+            break;
+            }
+        case EApBearerTypeWLAN:
+            {
+            if ( IsWlanSupported() )
+                {
+                retval = KBearerArrayWLAN;
+                }
+            else
+                {
+                User::Leave( KErrNotSupported );
+                }
+            break;
+            }
+        default:
+            {
+            __ASSERT_DEBUG( EFalse, Panic( EInvalidBearerType ) );
+            User::Leave( KErrInvalidBearerType );
+            break;
+            }
+        }
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::BearerToArrayIndexL")
+    return retval;
+    }
+
+/*
+//----------------------------------------------------------
+// CApSettingsDlg::ArrayIndexToBearer
+//----------------------------------------------------------
+//
+TApBearerType CApSettingsDlg::ArrayIndexToBearer( TInt32 aIndex)
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::ArrayIndexToBearer")
+    
+    TApBearerType retval( EApBearerTypeGPRS );
+    switch( aIndex )
+        {
+        case KBearerArrayCSD:
+            {
+            retval = EApBearerTypeCSD;
+            break;
+            }
+        case KBearerArrayGPRS:
+            {
+            retval = EApBearerTypeGPRS;
+            break;
+            }
+        case KBearerArrayHSCSD:
+            {
+            retval = EApBearerTypeHSCSD;
+            break;
+            }
+        case KBearerArrayWLAN:
+            {
+            if ( IsWlanSupported() )
+                {
+                retval = EApBearerTypeWLAN;
+                }
+            else
+                {
+                User::Leave( KErrNotSupported );
+                }
+            break;
+            }
+        default:
+            {
+            __ASSERT_DEBUG( EFalse, Panic( EInvalidBearerType ) );
+            break;
+            }
+        }
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::ArrayIndexToBearer")
+    return retval;
+    }
+
+*/
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::FillUpBearerSpeedValuesL
+//----------------------------------------------------------
+//
+void CApSettingsDlg::FillUpBearerSpeedValuesL( CDesCArrayFlat& aItems, 
+                                               TInt& aCurrvalue )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::FillUpBearerSpeedValuesL")
+    
+    TUint32 tval( 0 );
+    TUint32 bval( 0 );
+
+    iApItem->ReadUint( EApIspBearerSpeed, tval );
+    iApItem->ReadUint( EApIspBearerCallTypeIsdn, bval );
+    TApBearerType btype = iApItem->BearerTypeL();
+    const TInt* actResSpeeds = NULL;
+    const TInt* actSpeeds = NULL;
+
+    TBool isWcdma = 
+            FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma );
+
+    switch ( bval )
+        {
+        case ECallTypeAnalogue:
+            { // CSD/HSCSD, Analogue
+           if ( btype == EApBearerTypeHSCSD )
+                {
+                actResSpeeds = KResHcsdAnalogue;
+                actSpeeds = KHcsdAnalogue;
+                }
+            else
+                {
+                actResSpeeds = KResCsdAnalogue;
+                actSpeeds = KCsdAnalogue;
+                if ( isWcdma )
+                    {
+                    actResSpeeds = KResCsdAnalogueWcdma;
+                    actSpeeds = KCsdAnalogueWcdma;
+                    }
+                }
+            break;
+            }
+        case ECallTypeISDNv110:
+            { // CSD/HSCSD, ISDN v110:
+            if ( btype == EApBearerTypeHSCSD )
+                {
+                actResSpeeds = KResHcsdIsdn110;
+                actSpeeds = KHcsdIsdn110;
+                }
+            else
+                {
+                actResSpeeds = KResCsdIsdn110;
+                actSpeeds = KCsdIsdn110;
+                if ( isWcdma )
+                    {
+                    actResSpeeds = KResCsdIsdn110Wcdma;
+                    actSpeeds = KCsdIsdn110Wcdma;
+                    }
+                }
+            break;
+            }
+        case ECallTypeISDNv120:
+            {
+           if ( btype == EApBearerTypeHSCSD )
+                {
+                actResSpeeds = KResHcsdIsdn120;
+                actSpeeds = KHcsdIsdn120;
+                }
+            else
+                {
+                actResSpeeds = KResCsdIsdn120;
+                actSpeeds = KCsdIsdn120;
+                if ( isWcdma )
+                    {
+                    actResSpeeds = KResCsdIsdn120Wcdma;
+                    actSpeeds = KCsdIsdn120Wcdma;
+                    }
+                }
+            break;
+            }
+        default:
+            {
+            break;
+            }
+        }
+
+    if ( actResSpeeds )
+        {
+        while ( *actResSpeeds != KEndOfArray )
+            {
+            aItems.AppendL( *iEikonEnv->AllocReadResourceLC( *actResSpeeds ) );
+            CleanupStack::PopAndDestroy();
+            ++actResSpeeds;
+            }
+        }
+
+    if( actSpeeds )
+        {
+        aCurrvalue = 0;
+        TInt nextSpeed = *( actSpeeds + aCurrvalue + 1) ;
+        while ( ( nextSpeed != KEndOfArray ) 
+                && ( *( actSpeeds + aCurrvalue) < ( TInt )tval ) 
+                && ( nextSpeed <= ( TInt )tval ) )
+            {
+            ++aCurrvalue;
+            nextSpeed = *( actSpeeds + aCurrvalue + 1) ;
+            }
+        }
+
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::FillUpBearerSpeedValuesL")
+    }
+
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::SaveDataL
+//----------------------------------------------------------
+//
+TBool CApSettingsDlg::SaveDataL( )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::SaveDataL")
+    
+    TApMember aDataNeeded;
+    TSaveAction action(EApCanSave);
+    TBool retval( ETrue );
+    TInt err (KErrNone );
+    
+    // first handle ALL db stuff because Symbian DB does handles 
+    // consequtive transactions wrongly...
+    TTransactionResult ownTransaction = 
+            iDataModel->StartTransactionLC(
+                                /*aWrite*/EFalse,
+                                /*aShowNote*/ETrue,
+                                /*aRetry*/ETrue );
+    if ( ownTransaction != EFailedWithLocked )
+        {
+        action = CanSaveL(aDataNeeded);
+        switch ( action )
+            {
+            case EApCanSave:
+#ifdef __WINS__ 
+            case EApMustDelete:
+#endif // __WINS__
+                { // save data
+                if ( ( *iOldApItem != *iApItem ) || ( *iUid == KApNoneUID ) 
+                    || iDataModel->iWepSecSettings 
+                    || iDataModel->iWpaSecSettings )
+                    { // save if different or NEW BLANK
+                    *iEventStore |= KApUiEventEdited;
+                    if ( *iUid == KApNoneUID )
+                        {
+                        HBufC* buf = HBufC::NewLC( KApMaxConnNameLength );
+                        // now check if name is unique, if it is, 
+                        // save and commit, if it is not, show note
+                        // and no save at all, Rollback!
+                        TPtr16 ptr( buf->Des() );
+                        iApItem->ReadTextL( EApWapAccessPointName, ptr );
+                        TBool b(EFalse);
+                        TRAP( err, b = 
+                              iDataModel->ApUtils()->IsValidNameL( ptr ) );
+                        CleanupStack::PopAndDestroy( buf );
+                        if ( b )
+                            {
+                            TRAP( err, 
+                                  iDataModel->CreateFromDataL( *iApItem ) );
+                            if ( err == KErrNone )
+                                {
+                                iApItem->ReadUint( EApWapAccessPointID, 
+                                                   *iUid );
+                                *iEventStore |= KApUiEventCreatedBlank;
+                                }
+                            }
+                        else
+                            {
+                            err = KErrAlreadyExists;
+                            // no DB call after this point, as transaction must be rolled back, 
+                            // but we can do it only at the end
+                            if ( ownTransaction == EOwnTransaction )
+                                {
+                                CleanupStack::PopAndDestroy(); //Rollback
+                                // set as if no need to commit...
+                                ownTransaction = EUsingAlreadyStarted;
+                                }                            
+                            }
+                        }
+                    else
+                        {
+                        // If the name is not unique, 
+                        // it will leave with KErrAlreadyExists
+                        TRAP( err, 
+                              iDataModel->UpdateAccessPointDataL( *iApItem ) );
+                        }
+                    }
+                break;
+                }
+#ifndef __WINS__  
+            case EApMustDelete:
+                {
+                if ( *iUid != KApNoneUID )
+                    {
+                    TUint32 WapUid( 0 );
+                    iApItem->ReadUint( EApWapAccessPointID, WapUid );
+                    iDataModel->RemoveApL( WapUid );
+                    }
+                break;
+                }
+#endif // __WINS__
+            case EApShallGoBack:
+                {
+                switch ( aDataNeeded )
+                    {
+                    case EApIspDefaultTelNumber:
+                        {
+                        SelectItem( KListIndexCSDAccessNumber );
+                        retval = EFalse;
+                        break;
+                        }
+                    case EApWlanNetworkName:
+                        {
+                        if ( IsWlanSupported() )
+                            {                    
+                            SelectItem( KListIndexWLANNetworkName );
+                            retval = EFalse;
+                            }
+                        else
+                            {
+                            User::Leave( KErrNotSupported );
+                            }
+                        break;
+                        }
+                    case EApWlanIpNetMask:
+                    case EApIspIPNetMask:
+                        {
+                        if ( IsWlanSupported() )
+                            {                    
+                            SelectItem( KListIndexWLANSubnetMask );
+                            retval = EFalse;
+                            }
+                        else
+                            {
+                            User::Leave( KErrNotSupported );
+                            }
+                        break;
+                        }
+                    case EApIspIPGateway:
+                    case EApWlanIpGateway:
+                        {
+                        if ( IsWlanSupported() )
+                            {                    
+                            SelectItem( KListIndexWLANDefaultGateway );
+                            retval = EFalse;
+                            }
+                        else
+                            {
+                            User::Leave( KErrNotSupported );
+                            }
+                        break;
+                        }
+                    case EApWlanSecuritySettings:
+                        {
+                        if ( IsWlanSupported() )
+                            {                    
+                            SelectItem( KListIndexWLANSecuritySettings );
+                            retval = EFalse;
+                            ChangeSettingsL( EFalse );
+                            }
+                        else
+                            {
+                            User::Leave( KErrNotSupported );
+                            }                    
+                        break;
+                        }
+                    default:
+                        {// otherwise, nothing to do...
+                        __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) );
+                        break;
+                        }
+                    }
+                break;
+                } 
+            case EApNoAction:
+                { // can not save, do not go back: Exit, do nothing but ignore...
+                break;
+                }            
+            default:
+                {
+                __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) );
+                break;
+                }
+            }
+
+        if ( ownTransaction == EOwnTransaction )
+            {
+            err = iDataModel->Database()->Database()->CommitTransaction();
+            User::LeaveIfError( err );
+            CleanupStack::Pop(); // RollbackTransaction
+            }
+        }
+    else
+        {
+        User::Leave( KErrLocked );
+        }
+    // end transaction stuff
+    // and handle possible other stuff like
+    // displaying notifications, redirecting the user, etc...
+    
+    if ( err == KErrAlreadyExists )
+        {
+        // Check if exit and if it is, Exit, 
+        // if it is not, then show note 
+        // and move user back to editor...
+        if ( !( *iEventStore & KApUiEventExitRequested ) )
+            {                        
+            HBufC* buf = HBufC::NewLC( KApMaxConnNameLength );
+            TPtr16 ptr( buf->Des() );
+            iApItem->ReadTextL( EApWapAccessPointName, ptr );
+            ShowNoteL( R_APUI_IAP_NAME_ALREADY_EXISTS, buf );
+            CleanupStack::PopAndDestroy( buf ); // buf
+            SelectItem( KListIndexConnectionName );
+            retval = EFalse;
+            ChangeSettingsL( EFalse );
+            }
+        }
+    else
+        {
+        if ( err == KErrInvalidName )
+            {
+            ShowNoteL( R_APUI_VIEW_INVALID_CONN_NAME );
+            SelectItem( KListIndexConnectionName );
+            retval = EFalse;
+            }
+        else
+            {
+            if ( !( *iEventStore & KApUiEventExitRequested ) )
+                {
+                User::LeaveIfError( err );
+                }                            
+            iOldApItem->CopyFromL( *iApItem );
+            }
+        }
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::SaveDataL")
+    return retval;
+    }
+
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::HandleListStructureChangeL
+//----------------------------------------------------------
+//
+void CApSettingsDlg::HandleListStructureChangeL()
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::HandleListStructureChangeL")
+    
+    TUint32 l = iApItem->ReadTextLengthL( EApWapGatewayAddress );
+    HBufC* buf = HBufC::NewLC( l );
+    TPtr16 ptr( buf->Des() );
+    iApItem->ReadTextL( EApWapGatewayAddress, ptr );
+
+    if ( ( iBearerType == EApBearerTypeCSD ) 
+        || ( iBearerType == EApBearerTypeHSCSD ) )
+        {
+        GetCSDSettingArrays( iVariant );
+        }
+    else
+        {
+        if ( iBearerType == EApBearerTypeGPRS )
+            {
+            GetGPRSSettingArrays( iVariant );
+            }
+        else
+            {
+            if ( IsWlanSupported() )
+                {
+                if ( iBearerType == EApBearerTypeWLAN )
+                    {
+                    GetWLANSettingArraysL( iVariant );
+                    }
+                else
+                    {
+                    User::Leave( KErrInvalidBearer );
+                    }
+                }
+            else
+                {
+                User::Leave( KErrInvalidBearer );
+                }
+            }
+        }
+    CleanupStack::PopAndDestroy( buf );
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::HandleListStructureChangeL")
+    }
+
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::LimitSpeed
+//----------------------------------------------------------
+//
+void CApSettingsDlg::LimitSpeed()
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::LimitSpeed")
+    
+    // now 'limit' the speeds
+    TUint32 speed( 0 );
+    iApItem->ReadUint( EApIspBearerSpeed, speed );
+    TUint32 calltype( EFalse );
+    iApItem->ReadUint( EApIspBearerCallTypeIsdn, calltype );
+    const TInt* actSpeeds = NULL;
+    TBool isWcdma = 
+            FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma ) ;
+    switch ( iBearerType )
+        {
+        case EApBearerTypeCSD:
+            {
+            switch ( calltype )
+                {
+                case ECallTypeISDNv110:
+                    {
+                    actSpeeds = isWcdma ? KCsdIsdn110Wcdma : KCsdIsdn110;
+                    break;
+                    }
+                case ECallTypeISDNv120:
+                    {
+                    actSpeeds = isWcdma ? KCsdIsdn120Wcdma : KCsdIsdn120;
+                    break;
+                    }
+                case ECallTypeAnalogue:
+                default:
+                    {
+                    actSpeeds = isWcdma ? KCsdAnalogueWcdma : KCsdAnalogue;
+                    }
+                }
+            break;
+            }
+        case EApBearerTypeHSCSD:
+            {
+            switch ( calltype )
+                {
+                case ECallTypeISDNv110:
+                    {
+                    actSpeeds = KHcsdIsdn110;
+                    break;
+                    }
+                case ECallTypeISDNv120:
+                    {
+                    actSpeeds = KHcsdIsdn120;
+                    break;
+                    }
+                case ECallTypeAnalogue:
+                default:
+                    {
+                    actSpeeds = KHcsdAnalogue;
+                    }
+                }
+            break;
+            }
+        default:
+            {
+            break;
+            }
+        }
+
+    if( actSpeeds )
+        {
+        TInt tempSpeed = *actSpeeds;
+        TInt nextSpeed = *( actSpeeds + 1 );
+        while ( ( nextSpeed != KEndOfArray ) 
+                && ( tempSpeed < ( TInt )speed )
+                && ( nextSpeed <= ( TInt )speed ) )
+            {
+            tempSpeed = *( ++actSpeeds );
+            nextSpeed = *( actSpeeds + 1 );
+            }
+        speed = tempSpeed ;
+        }
+
+
+    iApItem->WriteUint( EApIspBearerSpeed, speed );
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::LimitSpeed")
+    }
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::SelectItem
+//----------------------------------------------------------
+//
+void CApSettingsDlg::SelectItem( TInt aItemIndex )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::SelectItem")
+    
+    iList->ScrollToMakeItemVisible( aItemIndex );
+    iList->SetCurrentItemIndexAndDraw( aItemIndex );
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::SelectItem")
+    }
+
+
+
+
+
+// Converting EParagraphDelimiters to \ns
+// ---------------------------------------------------------
+// CApSettingsDlg::ConvertDelimToPerNLC
+// ---------------------------------------------------------
+//
+HBufC* CApSettingsDlg::ConvertDelimToPerNLC( const TDesC& aInText )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::ConvertDelimToPerNLC")
+    
+    TInt size = aInText.Length();
+    HBufC* outText = HBufC::NewLC( size );
+    TPtr ptr = outText->Des();
+
+    for ( TInt ii=0; ii<size; ++ii )
+        {
+        TText ch = aInText[ii];
+        if ( ch == CEditableText::ELineBreak ||
+             ch == CEditableText::EParagraphDelimiter )
+            {
+            ch = '\n';
+            }
+        ptr.Append( ch );
+        }
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::ConvertDelimToPerNLC")
+    return outText;
+    }
+
+
+
+// Converting \ns to EParagraphDelimiters
+// ---------------------------------------------------------
+// CApSettingsDlg::ConvertPerNToDelimLC
+// ---------------------------------------------------------
+//
+
+HBufC* CApSettingsDlg::ConvertPerNToDelimLC( const TDesC& aInText )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::ConvertPerNToDelimLC")
+    
+    TInt size = aInText.Length();
+    HBufC* outText = HBufC::NewLC( size );
+    TPtr ptr = outText->Des();
+
+    TText ch;
+    for (TInt ii=0; ii<size; ii++)
+        {
+        ch = TText( aInText[ii] );
+        switch (ch)
+            {
+            case '\r':
+                // ignore
+                ptr.Append(ch);
+                break;
+            case '\n':
+                ptr.Append( CEditableText::EParagraphDelimiter );
+                break;
+            default:
+                ptr.Append(ch);
+                break;
+            }
+        }
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::ConvertPerNToDelimLC")
+    return outText;
+    }
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::DoChangeSettingsL
+//----------------------------------------------------------
+//
+void CApSettingsDlg::DoChangeSettingsL( TBool aQuick )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::DoChangeSettingsL")
+    
+    TInt itemnum = ( Max( iList->CurrentItemIndex(), 0 ) );
+    TApMember* ptr;
+    TInt*   tptr;
+    TInt*   compulsptr;
+    switch ( iLevel )
+        {
+        case 0:
+            {
+            ptr = iField;
+            tptr = iTitles;
+            compulsptr = iCompulsory;
+            break;
+            }
+        case 1:
+            {
+            ptr = iFieldAdvanced;
+            tptr = iTitlesAdvanced;
+            compulsptr = iCompulsoryAdvanced;
+            break;
+            }
+        case 2:
+            {
+            ptr = iFieldL2;
+            tptr = iTitlesL2;
+            compulsptr = iCompulsoryL2;
+            break;
+            }
+        default:
+            {
+            __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) );
+            return; // just to suppress warnings about ptr's 
+                    // beeing used uninitialised
+            }
+        }
+
+
+
+    ptr += itemnum;
+    tptr += itemnum;
+    compulsptr += itemnum;
+    TInt topitem( iList->TopItemIndex() );
+    
+    TApBearerType bearer = iApItem->BearerTypeL();
+    if ( bearer == EApBearerTypeGPRS )
+        {
+        TUint32 tint;
+        iApItem->ReadUint( EApGprsPdpType, tint );
+        if ( tint == EIPv6 )
+            {
+            if ( iLevel == 1 )
+                {
+                if ( itemnum )
+                    {
+                    ptr++;
+                    tptr++;
+                    compulsptr++;
+                    }
+                }
+            }
+        }
+    else
+        { // others
+        if ( bearer == EApBearerTypeWLAN )
+            {
+            // if we are in iL2Ipv4, AND 
+            // EApIspIPNetMask and EApIspIPGateway fields are not added 
+            // skip those items...
+            if ( !IsNetMaskAndGatewayVisibleL() )
+                {                
+                if ( *ptr == EApIspIPNetMask ) 
+                    {
+                    ptr++;
+                    tptr++;
+                    compulsptr++;
+                    }
+                if ( *ptr == EApIspIPGateway ) 
+                    {
+                    ptr++;
+                    tptr++;
+                    compulsptr++;
+                    }
+                }
+            if ( !IsAdhocChannelVisible() )
+                {
+                if ( ( *ptr == EApWlanChannelId ) 
+                    || ( *ptr == EApProxyServerAddress ) )
+                    {
+                    ptr++;
+                    tptr++;
+                    compulsptr++;
+                    }
+                }
+            }
+        else
+            {            
+            // CSD
+            if ( *ptr == EApIspIPAddr ) 
+                {
+                if ( !iL2Ipv4 )
+                    {
+                    ptr++;
+                    tptr++;
+                    compulsptr++;
+                    }
+                }
+            }
+        }
+
+
+    switch ( *ptr  )
+        {
+        case EApIspPromptForLogin:
+        case EApWapSecurity:
+        case EApIspIfCallbackEnabled:
+        case EApIspEnableSWCompression:
+        case EApGprsHeaderCompression:
+        case EApIspUseLoginScript:
+        case EApGprsDisablePlainTextAuth:
+        case EApIspDisablePlainTextAuth:
+        case EApWapWspOption:
+        case EApIspIfCallbackType:
+        case EApGprsPdpType:
+        case EApWlanNetworkMode:
+        case EApWlanScanSSID:
+            { // type 4 setting item with two available values
+            TBool changed( ETrue );
+            if ( aQuick )
+                {
+                InvertSettingsL( *ptr );
+                }
+            else
+                {
+                changed = ShowPopupSettingPageL( *ptr );
+                }
+            if ( changed )
+                {
+                if ( *ptr == EApGprsPdpType )
+                    {
+                    HandleListboxDataChangeL( EFalse );
+                    }
+                UpdateOnOffListBoxItemL( *ptr, *tptr, itemnum, *compulsptr );
+                if ( *ptr == EApWlanNetworkMode )
+                    {
+                    UpdateOnOffListBoxItemL( *( ptr+1 ), *( tptr+1 ),
+                                             itemnum+1, 
+                                             *( compulsptr + 1 ) );
+                    if ( (itemnum+1) <= iList->BottomItemIndex() )
+                        {
+                        iList->DrawItem( itemnum+1 );
+                        }
+                    }
+                }
+            break;
+            }
+        case EApIspDefaultTelNumber:
+        case EApIspIfCallbackInfo:
+            { // type 1, Phone number editor
+            ShowPopupPhoneNumSettingPageL( *ptr );
+            UpdateTextualListBoxItemL( *ptr, *tptr, itemnum, *compulsptr );
+            break;
+            }
+        case EApWapGatewayAddress:
+        case EApIspIPAddr:
+        case EApIspIPNetMask:
+        case EApWlanIpNetMask:
+        case EApIspIPGateway:
+        case EApWlanIpGateway:
+        case EApGprsIPNameServer1:
+        case EApIspIPNameServer1:
+        case EApGprsIPNameServer2:
+        case EApIspIPNameServer2:
+            {// above ones are type 1, IP Address editors!
+            ShowPopupIpAddrSettingPageL( *ptr );
+            UpdateTextualListBoxItemL( *ptr, *tptr, itemnum, *compulsptr );
+            if ( *ptr == EApWapGatewayAddress )
+                {
+                HandleListStructureChangeL();
+                HandleListboxDataChangeL( EFalse );
+                }
+            if ( *ptr == EApIspIPAddr )
+                {
+                HandleListboxDataChangeL( EFalse );
+                }
+            break;
+            }
+        case EApWapAccessPointName:
+        case EApGprsAccessPointName:
+        case EApIspLoginName:
+        case EApIspIfAuthName:
+        case EApIspLoginScript:
+        case EApWapStartPage:
+        case EApIspInitString:
+        case EApProxyServerAddress:
+        case EApProxyPortNumber:
+            { // type 1, Text setting item
+            if ( ShowPopupTextSettingPageL( *ptr ) )
+                {
+                UpdateTextualListBoxItemL( *ptr, *tptr, itemnum, *compulsptr );
+                if ( *ptr == EApWapAccessPointName )
+                    {
+                    iTitlePane->SetTextL( iApItem->ConnectionName() );
+                    }
+                }
+            break;
+            }
+        case EApIspLoginPass:
+        case EApIspIfAuthPass:
+
+            { // re-confirm, secreted, etc,
+            ShowPopupPasswordPageL( *ptr );
+            UpdateTextualListBoxItemL( *ptr, *tptr, itemnum, *compulsptr );
+            break;
+            }
+        case EApWapCurrentBearer:
+        case EApIspBearerCallTypeIsdn: // used for data call type
+        case EApIspBearerSpeed:
+        case EApWlanChannelId:
+            { // type 2, Pop-up setting item
+            if ( ShowPopupSettingPageL( *ptr ) )
+                {
+                if ( *ptr == EApWapCurrentBearer ) 
+                    {
+                    // if ==, the whole list needs to be updated !
+                    SetBearerTypeL( iApItem->BearerTypeL() );
+                    LimitSpeed();
+                    HandleListboxDataChangeL( EFalse );
+                    iList->SetTopItemIndex( topitem );
+                    iList->DrawNow();
+                    }
+                else
+                    {
+                    if ( *ptr == EApIspBearerCallTypeIsdn )
+                        { // first limit the speed if neccessary
+                        LimitSpeed();
+                        // need to redraw EApIspBearerSpeed, too
+                        // because it is possible that it had been changed 
+                        // to keep constrains simply update next field,
+                        // too, 'cause they are next to each other...
+                        UpdateOnOffListBoxItemL( *( ptr+1 ), *( tptr+1 ),
+                                                 itemnum+1, 
+                                                 *( compulsptr + 1 ) );
+                        iList->DrawItem( itemnum+1 );
+                        }
+                    UpdateOnOffListBoxItemL( *ptr, *tptr, 
+                                             itemnum, *compulsptr );
+                    }
+                }
+            break;
+            }
+        case EApWlanSecurityMode:
+            { // type 2, Pop-up setting item
+            if ( ShowPopupSettingPageL( *ptr ) )
+                {
+                // security mode has changed, re-create security settings!
+                UpdateOnOffListBoxItemL( *ptr, *tptr, 
+                                         itemnum, *compulsptr );
+                iHandler->iModel->UpdateSecurityModeL( *iApItem );
+                }
+            break;
+            }
+        case EApIP6DNSAddrFromServer:
+            { 
+            // if GPRS, PDP type Ipv4, DNS data query
+            // if GPRS, PDP type Ipv6, type 2, Pop-up setting item
+            TUint32 ival(0);
+            iApItem->ReadUint( EApGprsPdpType, ival );
+            TBool changed( EFalse );
+            if ( iApItem->BearerTypeL() == EApBearerTypeGPRS )
+                {
+                if ( ival == EIPv6 )
+                    {
+                    // GPRS, PDP type Ipv6, DNS pop-up setting item
+                    changed = ShowPopupSettingPageL( *ptr );
+                    }
+                else
+                    {
+                    // GPRS, PDP type Ipv4, DNS data query
+                    changed = GetNameServersL( EFalse );
+                    }
+                }
+            else
+                { // CSD/HSCSD
+                if ( iL2Ipv4 )
+                    {
+                    changed = GetNameServersL( EFalse );
+                    }
+                else
+                    {
+                    changed = ShowPopupSettingPageL( *ptr );
+                    }
+                }
+            if ( changed )
+                {
+                UpdateOnOffListBoxItemL( *ptr, *tptr, itemnum, *compulsptr );
+                }
+            break;
+            }
+        case EApNetworkName:
+            {
+            ChangeNetworkGroupL();
+            UpdateTextualListBoxItemL( *ptr, *tptr, itemnum, *compulsptr );
+            break;
+            }
+        case EApIpv4Settings:
+        case EApIpv6Settings:
+            {
+            iL2Ipv4 = ( *ptr == EApIpv4Settings );
+            if ( iLevel )
+                {
+                // enter Ipv4 or Ipv6 settings
+                if ( iL2Ipv4 )
+                    {
+                    // save current state so we can roll back to it
+                    // if needed, e.g. if user fills but discards values...
+                    if (!iBackupApItem )
+                        {
+                        iBackupApItem  = CApAccessPointItem::NewLC();
+                        CleanupStack::Pop(); // member var                        
+                        }
+                    iBackupApItem->CopyFromL( *iApItem );
+                    }
+                iLevel++;
+                HandleListStructureChangeL();
+                iOldIndex = iList->CurrentItemIndex();
+                iOldTopIndex = iList->TopItemIndex();
+                iList->SetCurrentItemIndex( 0 );
+                HandleListboxDataChangeL( EFalse );
+                itemnum = 0;
+                }
+            break;
+            }
+        case EApWlanNetworkName:
+            {
+            if ( IsWlanSupported() )
+                {
+                // Temporarily use plain text editor to input 
+                // network name...
+                ChangeWlanNetworkNameL();
+                // as it sets connection mode and security mode, 
+                // we must update the full list...
+                HandleListboxDataChangeL( EFalse );
+                }
+            else
+                {
+                User::Leave( KErrNotSupported );
+                }
+            break;
+            }
+        case EApWlanSecuritySettings:
+            {
+            if ( IsWlanSupported() )
+                {
+                iSecSettingsExitReason = ChangeWlanSecuritySettingsL();
+                }
+            else
+                {
+                User::Leave( KErrNotSupported );
+                }
+            break;
+            }
+/*
+        case EApWlanChannelId:
+            {
+            breaaak; 
+            }
+*/            
+        default:
+            {
+            __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) );
+            break;
+            }
+        }
+    SelectItem( itemnum );
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::DoChangeSettingsL")
+    }
+
+
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::GetSpeedForSelection
+//----------------------------------------------------------
+//
+TApCallSpeed CApSettingsDlg::GetBearerSpeedForSelection( TInt aCurrvalue )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::GetBearerSpeedForSelection")
+    
+    TApCallSpeed sp( KSpeed9600 );
+
+
+    TUint32 tval( 0 );
+    iApItem->ReadUint( EApIspBearerCallTypeIsdn, tval );
+
+    const TInt* actSpeeds = NULL;
+    TBool isWcdma = 
+            FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma );
+
+    switch ( tval )
+        {
+        case ECallTypeAnalogue:
+            { // CSD/HSCSD, Analogue
+            switch ( iBearerType )
+                {
+                case EApBearerTypeCSD:
+                    {
+                    actSpeeds = isWcdma ? KCsdAnalogueWcdma : KCsdAnalogue;
+                    break;
+                    }
+                case EApBearerTypeHSCSD:
+                    {
+                    actSpeeds = KHcsdAnalogue;
+                    break;
+                    }
+                default:
+                    {
+                    // this can only mean programmer error as no other
+                    // bearer type is supperted with speed settings
+                    __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) );
+                    break;
+                    }
+                }
+            break;
+            }
+        case ECallTypeISDNv110:
+            {
+            switch ( iBearerType )
+                {
+                case EApBearerTypeCSD:
+                    {
+                    actSpeeds = isWcdma ? KCsdIsdn110Wcdma : KCsdIsdn110;
+                    break;
+                    }
+                case EApBearerTypeHSCSD:
+                    {
+                    actSpeeds = KHcsdIsdn110;
+                    break;
+                    }
+                default:
+                    {
+                    // this can only mean programmer error as no other
+                    // bearer type is supperted with speed settings
+                    __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) );
+                    break;
+                    }
+                }
+            break;
+            }
+        case ECallTypeISDNv120:
+            {
+            switch ( iBearerType )
+                {
+                case EApBearerTypeCSD:
+                    {
+                    actSpeeds = isWcdma ? KCsdIsdn120Wcdma : KCsdIsdn120;
+                    break;
+                    }
+                case EApBearerTypeHSCSD:
+                    {
+                    actSpeeds = KHcsdIsdn120;
+                    break;
+                    }
+                default:
+                    {
+                    // this can only mean programmer error as no other
+                    // bearer type is supperted with speed settings
+                    __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) );
+                    break;
+                    }
+                }
+            break;
+            }
+        default:
+            {
+            // this can only mean programmer error as no other
+            // bearer type is supperted with speed settings
+            __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) );
+            break;
+            }
+        }
+
+    sp = (TApCallSpeed) *(actSpeeds + aCurrvalue);
+
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::GetBearerSpeedForSelection")
+    return sp;
+    }
+
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::GetCurrIndexFromBearerSpeed
+//----------------------------------------------------------
+//
+TInt CApSettingsDlg::GetCurrIndexFromBearerSpeed( )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::GetCurrIndexFromBearerSpeed")
+    
+    TUint32 tval( 0 );
+    TUint32 bval( 0 );
+    TInt retval( 0 );
+
+    iApItem->ReadUint( EApIspBearerSpeed, tval );
+    iApItem->ReadUint( EApIspBearerCallTypeIsdn, bval );
+
+    TBool isWcdma = 
+            FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma );
+
+    const TInt* actSpeeds = NULL;
+
+    switch ( bval )
+        {
+        case ECallTypeAnalogue:
+            { // CSD/HSCSD, Analogue
+            switch ( iBearerType )
+                {
+                case EApBearerTypeCSD:
+                    {
+                    actSpeeds = isWcdma ? KCsdAnalogueWcdma : KCsdAnalogue;
+                    break;
+                    }
+                case EApBearerTypeHSCSD:
+                    {
+                    actSpeeds = KHcsdAnalogue;
+                    break;
+                    }
+                default:
+                    {
+                    // this can only mean programmer error as no other
+                    // bearer type is supperted with speed settings
+                    __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) );
+                    break;
+                    }
+                }
+            break;
+            }
+        case ECallTypeISDNv110:
+            {
+            switch ( iBearerType )
+                {
+                case EApBearerTypeCSD:
+                    {
+                    actSpeeds = isWcdma ? KCsdIsdn110Wcdma : KCsdIsdn110;
+                    break;
+                    }
+                case EApBearerTypeHSCSD:
+                    {
+                    actSpeeds = KHcsdIsdn110;
+                    break;
+                    }
+                default:
+                    {
+                    // this can only mean programmer error as no other
+                    // bearer type is supperted with speed settings
+                    __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) );
+                    break;
+                    }
+                }
+            break;
+            }
+        case ECallTypeISDNv120:
+            {
+            switch ( iBearerType )
+                {
+                case EApBearerTypeCSD:
+                    {
+                    actSpeeds = isWcdma ? KCsdIsdn120Wcdma : KCsdIsdn120;
+                    break;
+                    }
+                case EApBearerTypeHSCSD:
+                    {
+                    actSpeeds = KHcsdIsdn120;
+                    break;
+                    }
+                default:
+                    {
+                    // this can only mean programmer error as no other
+                    // bearer type is supperted with speed settings
+                    __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) );
+                    break;
+                    }
+                }
+            break;
+            }
+        default:
+            {
+            // this can only mean programmer error as no other
+            // bearer type is supperted with speed settings
+            __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) );
+            break;
+            }
+        }
+
+    if( actSpeeds )
+        {
+        retval = 0;
+        while ( ( *( actSpeeds + retval + 1) != KEndOfArray ) 
+                && ( *( actSpeeds + retval) < ( TInt )tval ) 
+                && ( *( actSpeeds + retval + 1) <= ( TInt )tval ) )
+            {
+            ++retval;
+            }
+        }
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::GetCurrIndexFromBearerSpeed")
+    return retval;
+    }
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::ReplaceNonPrintingCharactersLC
+//----------------------------------------------------------
+//
+HBufC* CApSettingsDlg::ReplaceWhiteSpaceCharactersLC(  const TDesC& aInText )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::ReplaceWhiteSpaceCharactersLC")
+    
+    TInt size = aInText.Length();
+    HBufC* aOutText = HBufC::NewLC( size );
+
+    TPtr ptr = aOutText->Des();
+
+    for ( TInt ii=0; ii<size; ++ii )
+        {
+        TChar ch = aInText[ii];
+        if ( ch.IsSpace() )
+            {
+            ch = ' ';
+            }
+        ptr.Append( ch );
+        }
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::ReplaceWhiteSpaceCharactersLC")
+    return aOutText;
+    }
+
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::ChangeNetworkGroupL
+//----------------------------------------------------------
+//
+void CApSettingsDlg::ChangeNetworkGroupL()
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::ChangeNetworkGroupL")
+    
+    HBufC* titlebuf;
+
+    titlebuf = iHandler->iModel->EikEnv()->AllocReadResourceLC
+                            (
+                            R_APUI_VIEW_NETWORK_GROUP
+                            );
+
+    // needs this Dummy array to pass it to CAknSettingPage's constructor...
+    CDesCArrayFlat* aItemArray = new ( ELeave ) CDesCArrayFlat( 1 );
+    CleanupStack::PushL( aItemArray );
+    TUint32 prefUid( 0 );
+    TInt currsel( -1 );
+    iApItem->ReadUint( EApNetworkID, prefUid );
+
+    TInt prefInt( prefUid );
+    CApNetSelPopupList* dlg = 
+        CApNetSelPopupList::NewL( *iDataModel, *iHandler, currsel, 
+                                  prefInt, *iEventStore, 
+                                  aItemArray, ETrue );
+
+    CleanupStack::PushL( dlg );
+    TPtrC ptr( titlebuf->Des() );
+    dlg->SetSettingTextL( ptr );
+    // dlg must be Pop-ed because ExecuteLD starts with PushL()...
+    CleanupStack::Pop();
+    if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )
+        {
+        // update value in iApItem
+        // get networkitem and add it to item...
+        iApItem->WriteUint( EApNetworkID, prefInt );
+        // update network data according to new ID
+        iDataModel->DataHandler()->ReadNetworkPartL( *iApItem );
+        }
+    CleanupStack::PopAndDestroy( aItemArray ); // aItemArray
+    CleanupStack::PopAndDestroy( titlebuf ); // titlebuf
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::ChangeNetworkGroupL")
+    }
+
+
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::IsHSCSDEnabledL
+//----------------------------------------------------------
+//
+TInt CApSettingsDlg::IsHSCSDEnabledL()
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::IsHSCSDEnabledL")
+    
+    TInt EnableHSCSD( ETrue );
+
+/*
+    // Connecting and initialization:
+    TInt err( KErrNone );
+    CRepository* repository;
+    TRAP( err, repository = CRepository::NewL( KGeneralSettingsUid ) );
+//    repository->Get( KGSHSCSDAccessPoints, EnableHSCSD );
+    delete repository;
+*/
+
+#ifdef __TEST_NO_HSCSD
+    EnableHSCSD = EFalse;
+#endif
+#ifdef __TEST_HSCSD_SUPPORT
+    EnableHSCSD = ETrue;
+#endif // __TEST_HSCSD_SUPPORT
+
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::IsHSCSDEnabledL")
+    return EnableHSCSD;
+    }
+
+
+
+
+
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::GetCSDSettingArrays
+//----------------------------------------------------------
+//
+void CApSettingsDlg::GetCSDSettingArrays( TInt variant )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::GetCSDSettingArrays")
+
+    // If IPv6 support requested, is the only place where L2 level needed, 
+    // so it is the only place when it is variated...
+    if ( iReqIpvType & EIPv6 )
+        {
+        if ( iL2Ipv4 )
+            {
+            iFieldL2 = 
+                (TApMember*) &Fields_CSD_L2_IPv4[KApMember][0];
+            iFieldCountL2 = 
+                sizeof( Fields_CSD_L2_IPv4[KApMember] )/sizeof( TApMember );
+            iTitlesL2 = 
+                MUTABLE_CAST( TInt*, 
+                              &Fields_CSD_L2_IPv4[KResourceID][0] );
+            iCompulsoryL2 = 
+                MUTABLE_CAST( TInt*, 
+                              &Fields_CSD_L2_IPv4[KCompulsory][0] );
+            }
+        else
+            {
+            iFieldL2 = 
+                (TApMember*) &Fields_CSD_L2_IPv6[KApMember][0];
+            iFieldCountL2 = 
+                sizeof( Fields_CSD_L2_IPv6[KApMember] )/sizeof( TApMember );
+            iTitlesL2 = 
+                MUTABLE_CAST( TInt*, 
+                              &Fields_CSD_L2_IPv6[KResourceID][0] );
+            iCompulsoryL2 = 
+                MUTABLE_CAST( TInt*, 
+                              &Fields_CSD_L2_IPv6[KCompulsory][0] );
+            }
+        }
+
+
+
+    if ( variant & KWSPSettingsVisible )
+        {
+        if ( iReqIpvType & EIPv6 )
+            {
+            iField = (TApMember*) &Fields_CSD_WSP_IPv6[KApMember][0];
+            iFieldCount = 
+                sizeof( Fields_CSD_WSP_IPv6[KApMember] )/sizeof( TApMember );
+
+            iFieldAdvanced = 
+                (TApMember*) &Fields_CSD_Advanced_WSP_IPv6[KApMember][0];
+            iAdvancedFieldCount = 
+                sizeof( Fields_CSD_Advanced_WSP_IPv6[KApMember] )
+                    / sizeof( TApMember );
+
+            iTitles = 
+                MUTABLE_CAST( TInt*, &Fields_CSD_WSP_IPv6[KResourceID][0] );
+            iTitlesAdvanced = 
+                MUTABLE_CAST( TInt*, 
+                              &Fields_CSD_Advanced_WSP_IPv6[KResourceID][0] );
+
+            iCompulsory = 
+                MUTABLE_CAST( TInt*, 
+                              &Fields_CSD_WSP_IPv6[KCompulsory][0] );
+            iCompulsoryAdvanced = 
+                MUTABLE_CAST( TInt*, 
+                              &Fields_CSD_Advanced_WSP_IPv6[KCompulsory][0] );
+
+            }
+        else
+            {
+            iField = (TApMember*) &Fields_CSD_WSP[KApMember][0];
+            iFieldCount = 
+                sizeof( Fields_CSD_WSP[KApMember] )/sizeof( TApMember );
+
+            iFieldAdvanced = 
+                (TApMember*) &Fields_CSD_Advanced_WSP[KApMember][0];
+            iAdvancedFieldCount = 
+                sizeof( Fields_CSD_Advanced_WSP[KApMember] )
+                    / sizeof( TApMember );
+
+            iTitles = 
+                MUTABLE_CAST( TInt*, &Fields_CSD_WSP[KResourceID][0] );
+            iTitlesAdvanced = 
+                MUTABLE_CAST( TInt*, 
+                              &Fields_CSD_Advanced_WSP[KResourceID][0] );
+
+            iCompulsory = 
+                MUTABLE_CAST( TInt*, &Fields_CSD_WSP[KCompulsory][0] );
+            iCompulsoryAdvanced = 
+                MUTABLE_CAST( TInt*, 
+                              &Fields_CSD_Advanced_WSP[KCompulsory][0] );
+            }
+        }
+    else
+        {
+        if ( iReqIpvType & EIPv6 )
+            {
+            iField = (TApMember*) &Fields_CSD_IPv6[KApMember][0];
+            iFieldCount = 
+                sizeof( Fields_CSD_IPv6[KApMember] )/sizeof( TApMember );
+
+            iFieldAdvanced = 
+                (TApMember*) &Fields_CSD_Advanced_IPv6[KApMember][0];
+            iAdvancedFieldCount = 
+                sizeof( Fields_CSD_Advanced_IPv6[KApMember] )
+                    / sizeof( TApMember );
+
+            iTitles = 
+                MUTABLE_CAST( TInt*, 
+                              &Fields_CSD_IPv6[KResourceID][0] );
+            iTitlesAdvanced = 
+                MUTABLE_CAST( TInt*, 
+                              &Fields_CSD_Advanced_IPv6[KResourceID][0] );
+
+            iCompulsory = 
+                MUTABLE_CAST( TInt*, 
+                              &Fields_CSD_IPv6[KCompulsory][0] );
+            iCompulsoryAdvanced = 
+                MUTABLE_CAST( TInt*, 
+                              &Fields_CSD_Advanced_IPv6[KCompulsory][0] );
+            }
+        else
+            {
+            iField = (TApMember*) &Fields_CSD[KApMember][0];
+            iFieldCount = sizeof( Fields_CSD[KApMember] )/sizeof( TApMember );
+
+            iFieldAdvanced = (TApMember*) &Fields_CSD_Advanced[KApMember][0];
+            iAdvancedFieldCount = 
+                sizeof( Fields_CSD_Advanced[KApMember] )/sizeof( TApMember );
+
+            iTitles = MUTABLE_CAST( TInt*, &Fields_CSD[KResourceID][0] );
+            iTitlesAdvanced = 
+                MUTABLE_CAST( TInt*, &Fields_CSD_Advanced[KResourceID][0] );
+
+            iCompulsory = MUTABLE_CAST( TInt*, &Fields_CSD[KCompulsory][0] );
+            iCompulsoryAdvanced = 
+                MUTABLE_CAST( TInt*, &Fields_CSD_Advanced[KCompulsory][0] );
+            }
+        }
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::GetCSDSettingArrays")
+    }
+
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::GetGPRSSettingArrays
+//----------------------------------------------------------
+//
+void CApSettingsDlg::GetGPRSSettingArrays( TInt variant )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::GetGPRSSettingArrays")
+    
+    if ( variant & KWSPSettingsVisible )
+        {
+        if ( iReqIpvType & EIPv6 )
+            {
+            iField = ( TApMember* ) &Fields_GPRS_WSP_IPv6[ KApMember ][0];
+            iFieldCount = sizeof( Fields_GPRS_WSP_IPv6[0] )
+                            / sizeof( TApMember );
+            iFieldAdvanced = 
+                ( TApMember* ) &Fields_GPRS_Advanced_WSP_IPv6[ KApMember ][0];
+            iAdvancedFieldCount = 
+                sizeof( Fields_GPRS_Advanced_WSP_IPv6[ KApMember ])
+                    / sizeof( TApMember );
+            iTitles = 
+                MUTABLE_CAST( TInt*, &Fields_GPRS_WSP_IPv6[ KResourceID ][0] );
+            iTitlesAdvanced = 
+                MUTABLE_CAST( 
+                        TInt*, 
+                        &Fields_GPRS_Advanced_WSP_IPv6[ KResourceID ][0] );
+            iCompulsory = 
+                MUTABLE_CAST( TInt*, &Fields_GPRS_WSP_IPv6[ KCompulsory ][0] );
+            iCompulsoryAdvanced = 
+                MUTABLE_CAST( 
+                        TInt*, 
+                        &Fields_GPRS_Advanced_WSP_IPv6[ KCompulsory ][0] );
+            }
+        else
+            {
+            iField = ( TApMember* ) &Fields_GPRS_WSP[ KApMember ][0];
+            iFieldCount = sizeof( Fields_GPRS_WSP[0] )/sizeof( TApMember );
+            iFieldAdvanced = 
+                ( TApMember* ) &Fields_GPRS_Advanced_WSP[ KApMember ][0];
+            iAdvancedFieldCount = 
+                sizeof( Fields_GPRS_Advanced_WSP[ KApMember ])
+                    / sizeof( TApMember );
+            iTitles = 
+                MUTABLE_CAST( TInt*, &Fields_GPRS_WSP[ KResourceID ][0] );
+            iTitlesAdvanced = 
+                MUTABLE_CAST( 
+                        TInt*, 
+                        &Fields_GPRS_Advanced_WSP[ KResourceID ][0] );
+            iCompulsory = 
+                MUTABLE_CAST( TInt*, &Fields_GPRS_WSP[ KCompulsory ][0] );
+            iCompulsoryAdvanced = 
+                MUTABLE_CAST( 
+                        TInt*, 
+                        &Fields_GPRS_Advanced_WSP[ KCompulsory ][0] );
+            }
+        }
+    else
+        {
+        if ( iReqIpvType & EIPv6 )
+            {
+            iField = ( TApMember* ) &Fields_GPRS_IPv6[ KApMember ][0];
+            iFieldCount = sizeof( Fields_GPRS_IPv6[0] )/sizeof( TApMember );
+            iFieldAdvanced = 
+                ( TApMember* ) &Fields_GPRS_Advanced_IPv6[ KApMember ][0];
+            iAdvancedFieldCount = 
+                sizeof( Fields_GPRS_Advanced_IPv6[ KApMember ])
+                    /   sizeof( TApMember );
+            iTitles = 
+                MUTABLE_CAST( TInt*, &Fields_GPRS_IPv6[ KResourceID ][0] );
+            iTitlesAdvanced = 
+                MUTABLE_CAST( TInt*, 
+                              &Fields_GPRS_Advanced_IPv6[ KResourceID ][0] );
+            iCompulsory = 
+                MUTABLE_CAST( TInt*, &Fields_GPRS_IPv6[ KCompulsory ][0] );
+            iCompulsoryAdvanced = 
+                MUTABLE_CAST( TInt*, 
+                              &Fields_GPRS_Advanced_IPv6[ KCompulsory ][0] );
+            }
+        else
+            {
+            iField = ( TApMember* ) &Fields_GPRS[ KApMember ][0];
+            iFieldCount = sizeof( Fields_GPRS[0] )/sizeof( TApMember );
+            iFieldAdvanced = 
+                ( TApMember* ) &Fields_GPRS_Advanced[ KApMember ][0];
+            iAdvancedFieldCount = 
+                sizeof( Fields_GPRS_Advanced[ KApMember ])/sizeof( TApMember );
+            iTitles = 
+                MUTABLE_CAST( TInt*, &Fields_GPRS[ KResourceID ][0] );
+            iTitlesAdvanced = 
+                MUTABLE_CAST( TInt*, &Fields_GPRS_Advanced[ KResourceID ][0] );
+            iCompulsory = 
+                MUTABLE_CAST( TInt*, &Fields_GPRS[ KCompulsory ][0] );
+            iCompulsoryAdvanced = 
+                MUTABLE_CAST( TInt*, &Fields_GPRS_Advanced[ KCompulsory ][0] );
+            }
+        }
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::GetGPRSSettingArrays")
+    }
+
+
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::GetWLANSettingArraysL
+//----------------------------------------------------------
+//
+void CApSettingsDlg::GetWLANSettingArraysL( TInt /*aVariant*/ )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::GetWLANSettingArraysL")
+    
+    if ( IsWlanSupported() )
+        {        
+        // If IPv6 support requested, is the only place where L2 level needed, 
+        // so it is the only place when it is variated...
+        if ( iReqIpvType & EIPv6 )
+            {
+            if ( iL2Ipv4 )
+                {
+                iFieldL2 = 
+                    (TApMember*) &Fields_WLAN_L2_IPv4[KApMember][0];
+                iFieldCountL2 = 
+                    sizeof( Fields_WLAN_L2_IPv4[KApMember] )
+                        / sizeof( TApMember );
+                iTitlesL2 = 
+                    MUTABLE_CAST( TInt*, 
+                                  &Fields_WLAN_L2_IPv4[KResourceID][0] );
+                iCompulsoryL2 = 
+                    MUTABLE_CAST( TInt*, 
+                                  &Fields_WLAN_L2_IPv4[KCompulsory][0] );
+                }
+            else
+                {
+                iFieldL2 = 
+                    (TApMember*) &Fields_CSD_L2_IPv6[KApMember][0];
+                iFieldCountL2 = 
+                    sizeof( Fields_CSD_L2_IPv6[KApMember] )
+                        / sizeof( TApMember );
+                iTitlesL2 = 
+                    MUTABLE_CAST( TInt*, 
+                                  &Fields_CSD_L2_IPv6[KResourceID][0] );
+                iCompulsoryL2 = 
+                    MUTABLE_CAST( TInt*, 
+                                  &Fields_CSD_L2_IPv6[KCompulsory][0] );
+                }
+            }
+
+
+        if ( iReqIpvType & EIPv6 )
+            {
+            iField = ( TApMember* ) &Fields_WLAN_IPv6[ KApMember ][0];
+            iFieldCount = sizeof( Fields_WLAN_IPv6[0] )/sizeof( TApMember );
+            iFieldAdvanced = 
+                ( TApMember* ) &Fields_WLAN_Advanced_IPv6[ KApMember ][0];
+            iAdvancedFieldCount = 
+                sizeof( Fields_WLAN_Advanced_IPv6[ KApMember ])
+                    / sizeof( TApMember );
+            iTitles = 
+                MUTABLE_CAST( TInt*, &Fields_WLAN_IPv6[ KResourceID ][0] );
+            iTitlesAdvanced = 
+                MUTABLE_CAST( TInt*, 
+                              &Fields_WLAN_Advanced_IPv6[ KResourceID ][0] );
+            iCompulsory = 
+                MUTABLE_CAST( TInt*, &Fields_WLAN_IPv6[ KCompulsory ][0] );
+            iCompulsoryAdvanced = 
+                MUTABLE_CAST( TInt*, 
+                              &Fields_WLAN_Advanced_IPv6[ KCompulsory ][0] );
+            }
+        else
+            {
+            iField = ( TApMember* ) &Fields_WLAN_IPv4[ KApMember ][0];
+            iFieldCount = sizeof( Fields_WLAN_IPv4[0] )/sizeof( TApMember );
+            iFieldAdvanced = 
+                ( TApMember* ) &Fields_WLAN_Advanced_IPv4[ KApMember ][0];
+            iAdvancedFieldCount = 
+                sizeof( Fields_WLAN_Advanced_IPv4[ KApMember ])
+                    / sizeof( TApMember );
+            iTitles = 
+                MUTABLE_CAST( TInt*, &Fields_WLAN_IPv4[ KResourceID ][0] );
+            iTitlesAdvanced = 
+                MUTABLE_CAST( TInt*, 
+                              &Fields_WLAN_Advanced_IPv4[ KResourceID ][0] );
+            iCompulsory = 
+                MUTABLE_CAST( TInt*, &Fields_WLAN_IPv4[ KCompulsory ][0] );
+            iCompulsoryAdvanced = 
+                MUTABLE_CAST( TInt*, 
+                              &Fields_WLAN_Advanced_IPv4[ KCompulsory ][0] );
+            }
+        }
+    else
+        {
+        User::Leave( KErrNotSupported );
+        }
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::GetWLANSettingArraysL")
+    }
+
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::GetNameServersL
+//----------------------------------------------------------
+//
+TInt CApSettingsDlg::GetNameServersL( TBool aIp6 )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::GetNameServersL")
+    
+    TInt retval( 0 );
+
+    if ( (iReqIpvType & EIPv6) && aIp6 )
+        {
+        retval = GetIpv6NameServerL();
+        }
+    else
+        {
+        retval = GetIpv4NameServerL();
+        }
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::GetNameServersL")
+    return retval;
+    }
+
+
+
+
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::AddMenuListBoxItemL
+//----------------------------------------------------------
+//
+void CApSettingsDlg::AddMenuListBoxItemL( CDesCArrayFlat& aItemArray,
+                                          TApMember /*aMember*/, TInt aRes,
+                                          TInt aCompulsory )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::AddMenuListBoxItemL")
+    
+    // Define a heap descriptor to hold all the item text
+    // HBufC is non-modifiable
+    HBufC* title = iEikonEnv->AllocReadResourceLC( aRes );
+
+    // Define a heap descriptor to hold all the item text
+    TInt length = title->Length() + 10;
+    if ( aCompulsory )
+        {
+        length += 3;
+        }
+    HBufC* itemText = HBufC::NewLC( length );
+
+
+    // Define a modifiable pointer descriptor to be able to append text to the
+    // non-modifiable heap descriptor itemText
+    TPtr itemTextPtr = itemText->Des();
+    itemTextPtr.Format( KTxtMenuListItemFormat, title );
+    if ( aCompulsory )
+        {
+        itemTextPtr.Append( KTxtCompulsory );
+        }
+
+    aItemArray.AppendL( *itemText );
+    CleanupStack::PopAndDestroy( itemText );
+    CleanupStack::PopAndDestroy( title ); // title
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::AddMenuListBoxItemL")
+    }
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::AskQueryIfWcdmaL
+//----------------------------------------------------------
+//
+TBool CApSettingsDlg::AskQueryIfWcdmaL( TApMember aMember, TInt aCurrvalue  )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::AskQueryIfWcdmaL")
+    
+    TBool accept = ETrue ;
+    TBool isWcdma = 
+            FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma );
+    if ( isWcdma && iBearerType == EApBearerTypeCSD && 
+         aMember == EApIspBearerSpeed )
+        {
+        TApCallSpeed newSpeed = GetBearerSpeedForSelection( aCurrvalue );
+        switch ( newSpeed)
+            {
+            case KSpeed28800:
+            case KSpeed38400:
+            case KSpeed56000: 
+                {
+                accept = AskQueryL( R_APUI_IAP_CONF_MAX_SPEED_WCDMA );
+                break;
+                }
+            default:
+                {
+                break;
+                }
+
+            }
+        }
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::AskQueryIfWcdmaL")
+    return accept;
+    }
+
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::GetDomainNameServersTypeL
+//----------------------------------------------------------
+//
+TInt CApSettingsDlg::GetDomainNameServersTypeL()
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::GetDomainNameServersTypeL")
+    
+    TInt retval( 0 );
+    // GPRS, net type 4:
+    //      if IspNameServ <> 0.0.0.0 => User defined
+    // GPRS, net type 6: 
+    //      if IspIPv6NameServ <> 0.0.0.0 => User defined OR well-known
+    // CSD: 
+    //      if in IPv4settings: 
+    //          if IspNameServ <> 0.0.0.0 => User defined
+    // CSD: 
+    //      if in IPv6settings: 
+    //          if IspIPv6NameServ <> 0.0.0.0 => User defined OR well-known
+
+    if ( iApItem->BearerTypeL() == EApBearerTypeGPRS )
+        {
+        TUint32 ipnettype( 0 );
+        iApItem->ReadUint( EApGprsPdpType, ipnettype );
+        if ( ipnettype == EIPv6 )
+            {
+            retval = GetIPv6DNSTypeL();
+            }
+        else
+            {
+            retval = GetIPv4DNSTypeL();
+            }
+        }
+    else
+        { // CSD
+        // IPv4settings: IspNameServ <> 0.0.0.0 => User defined
+        // IPv6settings: 
+        //      IspIPv6NameServ <> 0.0.0.0 => User defined OR well-known
+        if ( iL2Ipv4 )
+            { // IPv4 settings
+            retval = GetIPv4DNSTypeL();
+            }
+        else
+            { // IPv6 settings
+            retval = GetIPv6DNSTypeL();
+            }
+        }
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::GetDomainNameServersTypeL")
+    return retval;
+    }
+
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::GetIpv4NameServerL
+//----------------------------------------------------------
+//
+TInt CApSettingsDlg::GetIpv4NameServerL()
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::GetIpv4NameServerL")
+    
+    HBufC* dns1 = HBufC::NewLC( KModifiableTextLength );
+    HBufC* dns2 = HBufC::NewLC( KModifiableTextLength );
+    TPtr dns1ptr( dns1->Des() );
+    TPtr dns2ptr( dns2->Des() );
+    
+    TInt ResId( 0 );
+
+    iApItem->ReadTextL( EApGprsIPNameServer1, dns1ptr );
+    iApItem->ReadTextL( EApGprsIPNameServer2, dns2ptr );
+    ResId = R_DNSIP4_QUERY;
+
+    TInetAddr dns1Addr;
+    TInetAddr dns2Addr;
+    dns1Addr.Input( dns1ptr );
+    dns2Addr.Input( dns2ptr );
+
+    CAknMultiLineIpQueryDialog* ipquery = 
+        CAknMultiLineIpQueryDialog::NewL( dns1Addr, dns2Addr );
+
+    TInt retval = ipquery->ExecuteLD( ResId );
+    if ( retval )
+        {
+        dns1Addr.Output( dns1ptr );
+        dns2Addr.Output( dns2ptr );
+        if ( dns1ptr.Compare( KDynIpAddress )  == 0 )
+            { // move 2nd to first, set second to Dynamic...
+            iApItem->WriteTextL( EApGprsIPNameServer1, dns2ptr );
+            iApItem->WriteTextL( EApGprsIPNameServer2, KDynIpAddress );
+            }
+        else
+            {
+            iApItem->WriteTextL( EApGprsIPNameServer1, dns1ptr );
+            iApItem->WriteTextL( EApGprsIPNameServer2, dns2ptr );
+            }
+        }   
+    CleanupStack::PopAndDestroy( 2 ); // dns1, dns2
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::GetIpv4NameServerL")
+    return retval;
+    }
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::GetIpv6NameServerL
+//----------------------------------------------------------
+//
+TInt CApSettingsDlg::GetIpv6NameServerL()
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::GetIpv6NameServerL")
+    
+    HBufC* dns1 = HBufC::NewLC( KModifiableTextLength );
+    HBufC* dns2 = HBufC::NewLC( KModifiableTextLength );
+    TPtr dns1ptr( dns1->Des() );
+    TPtr dns2ptr( dns2->Des() );
+    
+    TInt ResId( 0 );
+
+    iApItem->ReadTextL( EApIP6NameServer1, dns1ptr );
+    iApItem->ReadTextL( EApIP6NameServer2, dns2ptr );
+    ResId = R_DNSIP6_QUERY;
+
+    if ( ( dns1ptr.Compare( KKnownNameServer1 ) == 0 )
+        && ( dns2ptr.Compare( KKnownNameServer2 ) == 0 ) )
+        { // special value, well-known
+        // in this case 'dynamic' string must be offered so 
+        // temp data must be changed to 'dynamic'
+        dns1ptr = KDynIpv6Address;
+        dns2ptr = KDynIpv6Address;
+        }
+
+    CApMultiLineDataQueryDialog* ipquery = 
+        CApMultiLineDataQueryDialog::NewL( dns1ptr, dns2ptr );
+
+    TInt retval = ipquery->ExecuteLD( ResId );
+    if ( retval )
+        {
+        TInetAddr dns1Addr;
+        TInetAddr dns2Addr;
+        TInt err1( KErrNone );
+        TInt err2( KErrNone );
+        if ( dns1ptr.Compare( KEmpty )  != 0 )
+            {
+            err1 = dns1Addr.Input( dns1ptr );
+            }
+        if ( dns2ptr.Compare( KEmpty )  != 0 )
+            {
+            err2 = dns2Addr.Input( dns2ptr );
+            }
+        if ( err1 || err2 )
+            {
+            ShowNoteL( R_APUI_VIEW_SET_INFO_INVALID_IP );
+            GetIpv6NameServerL();
+            }
+        else
+            {
+            if ( 
+                ( dns1ptr.Compare( KDynIpv6Address )  == 0 ) ||
+                ( dns1ptr.Compare( KEmpty )  == 0 ) 
+               )
+                { // swap them: move 2nd to first, set second to Dynamic...
+                iApItem->WriteTextL( EApIP6NameServer1, dns2ptr );
+                iApItem->WriteTextL( EApIP6NameServer2, KDynIpv6Address );
+                }
+            else
+                { // keep the original order
+                iApItem->WriteTextL( EApIP6NameServer1, dns1ptr );
+                iApItem->WriteTextL( EApIP6NameServer2, dns2ptr );
+                }
+            }
+        }   
+    CleanupStack::PopAndDestroy( 2 ); // dns1, dns2
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::GetIpv6NameServerL")
+    return retval;
+    }
+
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::GetIPv6DNSTypeL
+//----------------------------------------------------------
+//
+TInt CApSettingsDlg::GetIPv6DNSTypeL()
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::GetIPv6DNSTypeL")
+    
+    TInt retval( 0 );
+
+    HBufC* buf1 = HBufC::NewLC( KModifiableTextLength );
+    TPtr16 ptr1( buf1->Des() );
+
+    HBufC* buf2 = HBufC::NewLC( KModifiableTextLength );
+    TPtr16 ptr2( buf2->Des() );
+
+    // net type 6: if IspIPv6NameServ <> 0.0.0.0 
+    // => User defined OR well-known
+    iApItem->ReadTextL( EApIP6NameServer1, ptr1 );
+    iApItem->ReadTextL( EApIP6NameServer2, ptr2 );
+
+    if ( ( ptr1.Compare( KKnownNameServer1 ) == 0 )
+        && ( ptr2.Compare( KKnownNameServer2 ) == 0 ) )
+        { // special value, well-known
+        retval = 1;
+        }
+    else
+        { 
+        // dynamic, if 0:0:...
+        // OR EMPTY text...
+        if ( ( ( ptr1.Compare( KDynIpv6Address ) == 0 )
+               || ( ptr1.Compare( KEmpty ) == 0 ) )
+           &&( ( ptr2.Compare( KDynIpv6Address ) == 0 ) 
+               ||( ptr2.Compare( KEmpty ) == 0 ) ) )
+            { // dynamic, 0:0:...
+            // OR in case of CSD, HSCSD, it might be user defined, 
+            // as for those bearers Dynamic is not possible...
+            TApBearerType bt = iApItem->BearerTypeL();
+            switch (bt) 
+                {
+                case EApBearerTypeCSD:
+                case EApBearerTypeHSCSD:
+                    {
+                    retval = 2; // consider it user defined
+                    break;
+                    }
+                default:
+                    {
+                    retval = 0;
+                    break;
+                    }
+                }
+            }
+        else
+            { // other value, user defined
+            retval = 2;
+            }
+        }
+
+    CleanupStack::PopAndDestroy( 2 );
+
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::GetIPv6DNSTypeL")
+    return retval;
+    }
+
+
+
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::GetIPv4DNSTypeL
+//----------------------------------------------------------
+//
+TInt CApSettingsDlg::GetIPv4DNSTypeL()
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::GetIPv4DNSTypeL")
+    
+    TInt retval( 0 );
+
+    HBufC* buf1 = HBufC::NewLC( KModifiableTextLength );
+    TPtr16 ptr1( buf1->Des() );
+
+    HBufC* buf2 = HBufC::NewLC( KModifiableTextLength );
+    TPtr16 ptr2( buf2->Des() );
+
+    // net type 4: if IspNameServ <> 0.0.0.0 => User defined
+    iApItem->ReadTextL( EApGprsIPNameServer1, ptr1 );
+    iApItem->ReadTextL( EApGprsIPNameServer2, ptr2 );
+
+    if ( ( ptr1.Compare( KDynIpAddress ) == 0 )
+    && ( ptr2.Compare( KDynIpAddress ) == 0 ) )
+        { // dynamic, 0:0:...
+        retval = 0;
+        }
+    else
+        { // other value, user defined
+        retval = 2;
+        }
+
+    CleanupStack::PopAndDestroy( 2 );
+
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::GetIPv4DNSTypeL")
+    return retval;
+    }
+
+
+
+
+
+// ---------------------------------------------------------
+// CApSettingsDlg::StripNonNumberLC
+// ---------------------------------------------------------
+//
+HBufC* CApSettingsDlg::StripNonNumberLC( const TDesC16& aInText )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::StripNonNumberLC")
+    
+//    CLOG( ( EApItem, 0, _L( "-> CApSettingsDlg::StripNonNumberLC" ) ) );
+
+    TInt size = aInText.Length();
+    HBufC* aOutText = HBufC::NewLC( size );
+    TPtr ptr = aOutText->Des();
+
+    for ( TInt ii=0; ii<size; ++ii )
+        {
+        // TText ch = aInText[ii];
+        TChar ch = aInText[ii];
+        if ( ch.IsDigit() )
+            {
+            ptr.Append( ch );
+            }
+        }
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::StripNonNumberLC")
+    return aOutText;
+    }
+    
+
+//----------------------------------------------------------
+// CApSettingsDlg::BearerType2BearerItemPosL
+//----------------------------------------------------------
+//
+TInt CApSettingsDlg::BearerType2BearerItemPosL( TApBearerType aBearer )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::BearerType2BearerItemPosL")
+    
+    TInt pos(0);
+    switch ( aBearer )
+        {
+        case EApBearerTypeGPRS:
+            {
+            pos = KBearerListGprs;
+            break;
+            }
+        case EApBearerTypeWLAN:
+            {
+            if ( IsWlanSupported() )
+                {                
+                pos = KBearerListWLAN;
+                }
+            else
+                {
+                User::Leave( KErrNotSupported );
+                }
+            break;
+            }            
+        case EApBearerTypeCSD:
+            {
+            TBool isCsdSupported = 
+                  FeatureManager::FeatureSupported( KFeatureIdAppCsdSupport );
+            if ( isCsdSupported )
+                {
+                pos = KBearerListCSD;
+	            if ( !IsWlanSupported() )
+	                {
+	                pos--;
+	                }
+                }
+            else
+                { // To be determined, what is correct
+                }
+            break;
+            }
+        case EApBearerTypeHSCSD:
+            {
+            if ( IsHSCSDEnabledL() )
+                {
+                pos = KBearerListHSCSD;
+				if ( !IsWlanSupported() )
+                	{
+                	pos--;
+                	}                
+                }
+            else
+                { // should not be possible, but be defensive, 
+                // correct it to CSD, if possible...
+                TBool isCsdSupported = 
+                      FeatureManager::FeatureSupported( 
+                                        KFeatureIdAppCsdSupport );
+                if ( isCsdSupported )
+                    {
+                    pos = KBearerListCSD;
+					if ( !IsWlanSupported() )
+	                	{
+	                	pos--;
+	                	}
+                    }
+                else
+                    { // To be determined, what is correct
+                    }
+                }
+            break;
+            }
+        default:
+            {
+            __ASSERT_DEBUG( EFalse, Panic( EInvalidBearerType ) );
+            User::Leave( KErrInvalidBearerType );
+            break;
+            }
+        }
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::BearerType2BearerItemPosL")
+    return pos;
+    }
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::BearerItemPos2BearerTypeL
+//----------------------------------------------------------
+//
+TApBearerType CApSettingsDlg::BearerItemPos2BearerTypeL( TInt aPos )
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::BearerItemPos2BearerTypeL")
+    
+    TApBearerType bearer;
+    CArrayFixFlat<TApBearerType>* bearerlist = 
+                new(ELeave) CArrayFixFlat<TApBearerType>(4);
+    CleanupStack::PushL( bearerlist );
+
+    bearerlist->AppendL( EApBearerTypeGPRS );
+  
+    if ( IsWlanSupported() )
+        {
+        bearerlist->AppendL( EApBearerTypeWLAN );
+        }
+    
+    TBool isCsdSupported = 
+          FeatureManager::FeatureSupported( KFeatureIdAppCsdSupport );
+    if ( isCsdSupported )
+        {
+        bearerlist->AppendL( EApBearerTypeCSD );
+        }
+    if ( IsHSCSDEnabledL() && isCsdSupported )
+        {
+        bearerlist->AppendL( EApBearerTypeHSCSD );
+        }
+
+    __ASSERT_DEBUG( ( aPos < bearerlist->Count() ), \
+                      Panic( EInvalidBearerType ) );
+    __ASSERT_DEBUG( ( aPos >= 0 ), Panic( EInvalidBearerType ) );
+    
+    aPos = Max( aPos, 0 );
+    aPos = Min( aPos, ( bearerlist->Count() - 1 ) );
+
+    bearer = bearerlist->At( aPos );
+
+    CleanupStack::PopAndDestroy( bearerlist );
+
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::BearerItemPos2BearerTypeL")
+    return bearer;
+    }
+
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::ChangeWlanNetworkNameL
+//----------------------------------------------------------
+//
+void CApSettingsDlg::ChangeWlanNetworkNameL()
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::ChangeWlanNetworkNameL")
+    
+    // Implement WLAN network name change 
+    TInt currvalue( 0 );
+    CDesCArrayFlat* items = FillPopupSettingPageLC( EApWlanNetworkName,  
+                                                    currvalue );
+
+    TInt attr_resid( 0 );
+    GetResId( EApWlanNetworkName, attr_resid );
+    HBufC* titlebuf;
+    CAknRadioButtonSettingPage* dlg;
+    if ( attr_resid )
+        {
+        titlebuf = iEikonEnv->AllocReadResourceLC( attr_resid );
+        dlg = new ( ELeave )CAknRadioButtonSettingPage(
+                                R_RADIO_BUTTON_SETTING_PAGE, 
+                                currvalue, items );
+        // must push 'cause SetSettingTextL can leave...
+        CleanupStack::PushL( dlg );
+        TPtrC ptr( titlebuf->Des() );
+        dlg->SetSettingTextL( ptr );
+        CleanupStack::Pop(); // dlg
+        }
+    else
+        {
+        dlg = new ( ELeave )CAknRadioButtonSettingPage(
+                            R_RADIO_BUTTON_SETTING_PAGE, currvalue, items );
+        }
+    if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenAccepted ) )
+        {
+        if ( !currvalue )
+            {// user defined
+            QueryWlanNetworkNameL();
+            }
+        else
+            { // scan for, select one!
+            CConnectionUiUtilities* connUiUtils = 
+                CConnectionUiUtilities::NewL();
+            CleanupStack::PushL( connUiUtils );
+
+            TWlanSsid ssid;
+            TWlanConnectionMode connmode;
+            TWlanConnectionSecurityMode secmode;
+            TBool ret = connUiUtils->SearchWLANNetwork( ssid, 
+                                                        connmode, 
+                                                        secmode );
+            if ( ret )
+                {
+                HBufC* tmp = HBufC::NewLC( KCommsDbSvrMaxFieldLength );
+                TPtr16 tmpPtr16 = tmp->Des();
+                CnvUtfConverter::ConvertToUnicodeFromUtf8( tmpPtr16, ssid);
+                
+                iApItem->WriteTextL( EApWlanNetworkName, *tmp );
+                CleanupStack::PopAndDestroy( tmp );
+                // now handle connmode & secmode settings
+                if ( connmode == EWlanConnectionModeInfrastructure )
+                    {
+                    iApItem->WriteUint( EApWlanNetworkMode, EInfra );
+                    }
+                else
+                    {
+                    if ( connmode == EWlanConnectionModeAdhoc )
+                        {
+                        iApItem->WriteUint( EApWlanNetworkMode, EAdhoc );
+                        }
+                    else
+                        {
+                        User::Leave( KErrNotSupported );
+                        }                    
+                    }
+                switch (secmode)
+                    {
+                    case EWlanConnectionSecurityOpen:
+                        {
+                        iApItem->WriteUint( EApWlanSecurityMode, EOpen );
+                        break;
+                        }
+                    case EWlanConnectionSecurityWep:
+                        {
+                        iApItem->WriteUint( EApWlanSecurityMode, EWep );
+                        break;
+                        }
+                    case EWlanConnectionSecurity802d1x:
+                        {
+                        iApItem->WriteUint( EApWlanSecurityMode, E802_1x );
+                        break;
+                        }
+                    case EWlanConnectionSecurityWpa:
+                        {
+                        iApItem->WriteUint( EApWlanSecurityMode, EWpa );
+                        break;
+                        }
+                    case EWlanConnectionSecurityWpaPsk:
+                        {
+                        iApItem->WriteUint( EApWlanSecurityMode, EWpa );
+                        break;
+                        }
+                    default:
+                        {
+                        break;
+                        }                            
+                    }
+             
+              }
+            CleanupStack::PopAndDestroy( connUiUtils );
+            }
+        }
+    if ( attr_resid )
+        {
+        // titlebuf, text title readed from resource...
+        CleanupStack::PopAndDestroy();
+        }
+    // items, will also delete all elements in the array!
+    CleanupStack::PopAndDestroy( items ); 
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::ChangeWlanNetworkNameL")
+    }
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::ChangeWlanSecuritySettings
+//----------------------------------------------------------
+//
+TInt CApSettingsDlg::ChangeWlanSecuritySettingsL()
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::ChangeWlanSecuritySettingsL")
+    
+    TInt retval(0);
+    TUint32 secmode( 0 );
+    iApItem->ReadUint( EApWlanSecurityMode, secmode );
+
+    TBool need2changeid( EFalse );
+    TUint32 origServiceId(0);
+    iApItem->ReadUint( EApIapServiceId, origServiceId );
+    if ( iOriginalBearerType != iApItem->BearerTypeL() )
+        {
+        need2changeid = ETrue;
+        iApItem->WriteUint( EApIapServiceId, 0 );        
+        }
+        
+    switch ( secmode )
+        {
+        case EOpen:
+            {
+            ShowNoteL( R_APUI_VIEW_NO_SECURITY_SETTINGS );
+            break;
+            }
+        case EWep:
+            {
+            retval = ChangeWepSecuritySettingsL();
+            break;
+            }
+        case E802_1x:
+            {
+            retval = Change8021xSecuritySettingsL();
+            break;
+            }
+        case EWpa:
+        case EWpa2:
+            {
+            retval = ChangeWpaSecuritySettingsL();
+            break;
+            }
+        default:
+            {
+            // some weird error, repair it...
+            __ASSERT_DEBUG( EFalse, Panic( EInvalidBearerType ) );
+            break;
+            }
+        }
+    if ( need2changeid )
+        {
+        iApItem->WriteUint( EApIapServiceId, origServiceId );
+        }
+
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::ChangeWlanSecuritySettingsL")
+    return retval;
+    }
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::ChangeWepSecuritySettingsL
+//----------------------------------------------------------
+//
+TInt CApSettingsDlg::ChangeWepSecuritySettingsL()
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::ChangeWepSecuritySettingsL<->")
+    
+    return iHandler->iModel->ChangeWepSettingsL( iApItem );
+    }
+
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::ChangeWpaSecuritySettingsL
+//----------------------------------------------------------
+//
+TInt CApSettingsDlg::ChangeWpaSecuritySettingsL()
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::ChangeWpaSecuritySettingsL<->")
+    
+    return iHandler->iModel->ChangeWpaSettingsL( iApItem );
+    }
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::Change8021xSecuritySettingsL
+//----------------------------------------------------------
+//
+TInt CApSettingsDlg::Change8021xSecuritySettingsL()
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::Change8021xSecuritySettingsL<->")
+    
+    return iHandler->iModel->Change8021xSettingsL( iApItem );
+    }
+
+
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::IsWlanSupported
+//----------------------------------------------------------
+//
+TBool CApSettingsDlg::IsWlanSupported()
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::IsWlanSupported")
+    
+    TBool retval = FeatureManager::FeatureSupported( KFeatureIdProtocolWlan );
+#ifdef __TEST_WLAN_SUPPORT
+    retval = ETrue;
+#endif // __TEST_WLAN_SUPPORT
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::IsWlanSupported")
+    return retval;
+    }
+    
+    
+
+//----------------------------------------------------------
+// CApSettingsDlg::QueryWlanNetworkNameL
+//----------------------------------------------------------
+//
+TBool CApSettingsDlg::QueryWlanNetworkNameL()
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::QueryWlanNetworkNameL")
+    
+    TBool retval( EFalse );
+    
+    HBufC* buff = HBufC::NewLC( KModifiableTextLength );
+    TPtr16 ptr( buff->Des() );
+    iApItem->ReadTextL( EApWlanNetworkName, ptr );   
+
+    CAknQueryDialog* dlg = 
+                CAknQueryDialog::NewL( ptr, CAknQueryDialog::ENoTone );
+    
+    if ( dlg->ExecuteLD( R_APUI_WLAN_NAME_QUERY ) )
+        {
+        iApItem->WriteTextL( EApWlanNetworkName, ptr );
+        retval = ETrue;
+        }
+    CleanupStack::PopAndDestroy( buff );
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::QueryWlanNetworkNameL")
+    return retval;
+    }
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::IsNetMaskAndGatewayVisible
+//----------------------------------------------------------
+//
+TBool CApSettingsDlg::IsNetMaskAndGatewayVisibleL()
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::IsNetMaskAndGatewayVisibleL")
+    
+    TBool retval(EFalse);
+    // display only if:
+    // Phone IP Addr. <> Automatic (0.0.0.0)
+    HBufC* tmpValue = HBufC::NewLC( KModifiableTextLength );
+    TPtr ptr( tmpValue->Des() );
+    iApItem->ReadTextL( EApIspIPAddr, ptr );
+    if ( ( tmpValue->Compare( KDynIpAddress ) != 0 ) 
+        && ( tmpValue->Compare( KEmptyText ) != 0 ) )    
+        {
+        retval = ETrue;
+        }
+    CleanupStack::PopAndDestroy( tmpValue );
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::IsNetMaskAndGatewayVisibleL")
+    return retval;
+    }
+
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::GetAdHocChannelL
+//----------------------------------------------------------
+//
+TUint32 CApSettingsDlg::GetAdHocChannelL()
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::GetAdHocChannelL")
+    
+    // Get real ad-hoc channel
+    // Default: KDefAdhocChannel
+    TInt channel( KDefAdhocChannel );
+    TUint32 retval(0);
+    iApItem->ReadUint( EApWlanChannelId, retval );
+    channel = TInt(retval);
+    if ( !channel )
+        {
+        channel = KDefAdhocChannel;
+        }
+
+    CAknNumberQueryDialog* dlg = 
+            CAknNumberQueryDialog::NewL( channel, CAknQueryDialog::ENoTone );
+    
+    if ( dlg->ExecuteLD( R_APUI_WLAN_ADHOC_CHANNEL_QUERY ) )
+        {
+        retval = channel;
+        }
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::GetAdHocChannelL")
+    return retval;
+    }
+    
+    
+    
+//----------------------------------------------------------
+// CApSettingsDlg::IsAdhocChannelVisible
+//----------------------------------------------------------
+//
+TBool CApSettingsDlg::IsAdhocChannelVisible() 
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::IsAdhocChannelVisible")
+    
+    TBool retval(EFalse);
+    TUint32 netmode( 0 );
+    iApItem->ReadUint( EApWlanNetworkMode, netmode );
+    if ( netmode == EAdhoc )
+        {
+        retval = ETrue;
+        }
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::IsAdhocChannelVisible")
+    return retval;
+    }
+    
+    
+
+//----------------------------------------------------------
+// CApSettingsDlg::HasSecuritySettingsFilledL
+//----------------------------------------------------------
+//
+TBool CApSettingsDlg::HasSecuritySettingsFilledL()
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::HasSecuritySettingsFilledL<->")
+    
+    return iDataModel->HasWlanSecSettingsFilledL( *iApItem );
+    }
+
+
+
+//----------------------------------------------------------
+// CApSettingsDlg::LimitSecMode
+//----------------------------------------------------------
+//
+void CApSettingsDlg::LimitSecMode()
+    {
+    APSETUILOGGER_ENTERFN( ESettings,"Settings::LimitSecMode")
+    
+    TUint32 secmode( 0 );
+    iApItem->ReadUint( EApWlanSecurityMode, secmode );
+    switch ( secmode )
+        {
+        case EOpen:
+        case EWep:
+        // nothing to do in this case 
+            {
+            break;
+            }
+        case E802_1x:
+        case EWpa:
+        case EWpa2:
+        default:
+            {
+            iApItem->WriteUint( EApWlanSecurityMode, EOpen );
+            break;
+            }
+        }
+    
+    APSETUILOGGER_LEAVEFN( ESettings,"Settings::LimitSecMode")
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CApSettingsDlg::CanSaveWlanCompulsoriesL( )
+// ---------------------------------------------------------
+//
+CApSettingsDlg::TSaveAction CApSettingsDlg::CanSaveWlanCompulsoriesL( 
+                                                TApMember& aDataNeeded )
+    {
+    TSaveAction retval( EApCanSave );
+
+    HBufC *sgd = HBufC::NewLC( KModifiableTextLength );
+    TPtr16 ptr( sgd->Des() );
+
+    if ( (retval != EApShallGoBack) && (retval != EApMustDelete) 
+         && IsNetMaskAndGatewayVisibleL() )
+        { // now check compulsory fields
+        iApItem->ReadTextL( EApWlanIpNetMask, ptr );
+        if ( ( ptr.Compare( KDynIpAddress ) == 0 ) 
+            || ( ptr.Compare( KEmptyText ) == 0 ) )
+            {
+            retval = EApShallGoBack;
+            aDataNeeded = EApWlanIpNetMask;
+            if ( AskQueryL( 
+                R_APUI_VIEW_NETW_QUEST_IAP_INCOMPLETE_DELETE ) )
+                {
+                retval = EApMustDelete;
+                }                                                
+            }
+        else
+            {                        
+            iApItem->ReadTextL( EApIspIPGateway, ptr );
+            if ( ( sgd->Compare( KDynIpAddress ) == 0 ) 
+                || ( sgd->Compare( KEmptyText ) == 0 ) )
+                {
+                retval = EApShallGoBack;
+                aDataNeeded = EApIspIPGateway;
+                if ( AskQueryL( 
+                    R_APUI_VIEW_NETW_QUEST_IAP_INCOMPLETE_DELETE )
+                   )
+                    {
+                    retval = EApMustDelete;
+                    }                            
+                }
+            }
+        }
+    CleanupStack::PopAndDestroy( sgd );  // sgd
+        
+    return retval;
+    }
+
+
+// ---------------------------------------------------------
+// CApSettingsDlg::RestoreIpv4SettingsL()
+// ---------------------------------------------------------
+//
+void CApSettingsDlg::RestoreIpv4SettingsL()
+    {
+    HBufC* buf = HBufC::NewLC( KModifiableTextLength );
+    TPtr ptr( buf->Des() );
+    
+    iBackupApItem->ReadTextL( EApIspIPAddr, ptr );
+    iApItem->WriteTextL( EApIspIPAddr, ptr );
+    
+    iBackupApItem->ReadTextL( EApIspIPNetMask, ptr );
+    iApItem->WriteTextL( EApIspIPNetMask, ptr );
+    
+    iBackupApItem->ReadTextL( EApIspIPGateway, ptr );
+    iApItem->WriteTextL( EApIspIPGateway, ptr );
+
+    iBackupApItem->ReadTextL( EApIspIPNameServer1, ptr );
+    iApItem->WriteTextL( EApIspIPNameServer1, ptr );
+
+    iBackupApItem->ReadTextL( EApIspIPNameServer2, ptr );
+    iApItem->WriteTextL( EApIspIPNameServer2, ptr );
+
+    CleanupStack::PopAndDestroy( buf );
+    
+    }
+
+
+    
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/src/ApSettingsModel.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,1577 @@
+/*
+* Copyright (c) 2002 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 CApSettingsModel.
+*
+*/
+
+
+// INCLUDE FILES
+#include "APSettingsHandlerUIVariant.hrh"
+
+#include <ActiveApDb.h>
+#include <ApListItemList.h>
+#include <ApListItem.h>
+#include <ApSelect.h>
+#include <ApSetUI.rsg>
+#include <VpnApEngine.h>
+#include <hlplch.h>
+#include <eikenv.h>
+#include <eikappui.h>
+#include <StringLoader.h>
+#include <featmgr.h>
+
+#include "ApSettingsHandlerUI.hrh"
+
+#include "ApSettingsModel.h"
+#include <ApSettingsHandlerCommons.h>
+#include "Apsettingsdeleteoperation.h"
+
+#include <sysutil.h>
+#include <ErrorUI.h>
+
+
+#include "ApNetworks.h"
+#include "FeatureManagerWrapper.h"
+
+#include <WEPSecuritySettingsUI.h>
+#include <WPASecuritySettingsUI.h>
+
+#include <ApAccessPointItem.h>
+
+#include "ApSettingsHandlerLogger.h"
+
+//#define __TEST_PERFORMANCE
+
+// CONSTANTS
+
+
+
+
+/**
+* Estimated number of bytes in FFS for one writing operation. This amount
+* is checked to be available before each transaction which places write-lock.
+* Exact size is not known (because what happens in a transaction is unknown).
+* A typical access point is estimated to be less than ~2000 bytes; 
+* so assuming the typical operation of adding one access point 
+* (with database transaction overhead and safety) is estimated 
+* to be 2000 bytes. This should be a safe guess.
+*/
+LOCAL_C const TInt KEstimatedFfsUsage = 2000;
+
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CApSettingsModel::NewL
+// ---------------------------------------------------------
+//
+CApSettingsModel* CApSettingsModel::NewL( TInt aIspFilter, TInt aBearerFilter,
+                                          TInt aSortType, TInt aReqIpvType,
+                                          TVpnFilterType aVpnFilterType,
+                                          TInt aVariant,
+                                          TBool aIncludeEasyWlan,
+                                          TBool aNoEdit )
+    {
+    APSETUILOGGER_ENTERFN( EModel,"Model::NewL")    
+    CApSettingsModel* db = 
+        new( ELeave ) CApSettingsModel( aIspFilter, aBearerFilter, 
+                                        aSortType, aReqIpvType, aVariant,
+                                        aVpnFilterType, aIncludeEasyWlan,
+                                        aNoEdit );
+    CleanupStack::PushL( db );
+    db->ConstructL( NULL );
+    CleanupStack::Pop(); // db
+    APSETUILOGGER_LEAVEFN( EModel,"Model::NewL")    
+    return db;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsModel::NewL
+// ---------------------------------------------------------
+//
+CApSettingsModel* CApSettingsModel::NewL( CActiveApDb& aDb, TInt aIspFilter,
+                                          TInt aBearerFilter, TInt aSortType,
+                                          TInt aReqIpvType, 
+                                          TVpnFilterType aVpnFilterType,
+                                          TInt aVariant,
+                                          TBool aIncludeEasyWlan,
+                                          TBool aNoEdit )
+    {
+    APSETUILOGGER_ENTERFN( EModel,"Model::NewL2")
+    CApSettingsModel* db = 
+        new( ELeave ) CApSettingsModel( aIspFilter, aBearerFilter, 
+                                        aSortType, aReqIpvType, aVariant,
+                                        aVpnFilterType, aIncludeEasyWlan,
+                                        aNoEdit );
+    CleanupStack::PushL( db );
+    db->ConstructL( &aDb );
+    CleanupStack::Pop(); // db
+    APSETUILOGGER_LEAVEFN( EModel,"Model::NewL2")    
+    return db;
+    }
+
+
+/**
+* Destructor.
+*/
+CApSettingsModel::~CApSettingsModel( )
+    {
+    APSETUILOGGER_ENTERFN( EModel,"~Model")
+    delete iFeatureManagerWrapper;
+
+    delete iApData;
+    delete iUtils;
+    delete iVpnApEngine;
+    if ( iDbOwned )
+        {
+        delete iDb;
+        }
+    if (iop)
+        {
+        delete iop;
+        }
+
+    delete iWepSecSettings;
+    delete iWepSecSettingsUi;
+
+    delete iWpaSecSettings;
+    delete iWpaSecSettingsUi;
+    APSETUILOGGER_LEAVEFN( EModel,"~Model")    
+    }
+
+
+/**
+* Constructor
+*/
+CApSettingsModel::CApSettingsModel( TInt aIspFilter, TInt aBearerFilter, 
+                                    TInt aSortType, TInt aReqIpvType,
+                                    TInt aVariant,
+                                    TVpnFilterType aVpnFilterType,
+                                    TBool aIncludeEasyWlan,
+                                    TBool aNoEdit )
+
+    {
+    APSETUILOGGER_ENTERFN( EModel,"Model")
+    
+    iWepUiExitReason = 0;
+    iParams.iIspFilter = aIspFilter;
+    iParams.iBearerFilter = aBearerFilter;
+    iParams.iSortType = aSortType;
+    iReqIpvType = aReqIpvType;
+    iApData = NULL;
+    iDb = NULL;
+    iUtils = NULL;
+    iDbOwned = ETrue;
+    iVpnFilterType = aVpnFilterType;
+    iVariant = aVariant;
+    iIncludeEasyWlan = aIncludeEasyWlan;
+    iNoEdit = aNoEdit;
+    iInRefresh = EFalse;
+    iNeedRefresh = EFalse;
+    APSETUILOGGER_LEAVEFN( EModel,"Model")    
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsModel::ConstructL
+// ---------------------------------------------------------
+//
+void CApSettingsModel::ConstructL( CActiveApDb* aDb )
+    {
+    APSETUILOGGER_ENTERFN( EModel,"Model::ConstructL")
+    if ( aDb )
+        {
+        iDbOwned = EFalse;
+        iDb = aDb;
+        }
+    else
+        {
+        iDb = CActiveApDb::NewL( EDatabaseTypeIAP );
+        iDbOwned = ETrue;
+        }
+    iApData = CApDataHandler::NewLC( *iDb->Database() );
+    CleanupStack::Pop( iApData ); // as it is a member
+    iUtils = CApUtils::NewLC( *iDb->Database() );
+    CleanupStack::Pop( iUtils ); //
+    iVpnApEngine = CVpnApEngine::NewLC( iDb->Database() );
+    CleanupStack::Pop( iVpnApEngine ); //
+
+    iFeatureManagerWrapper = CFeatureManagerWrapper::NewL();
+    iHelpSupported = FeatureManager::FeatureSupported( KFeatureIdHelp );
+    iProtectionSupported = FeatureManager::FeatureSupported( 
+                                            KFeatureIdSettingsProtection );
+    
+    APSETUILOGGER_LEAVEFN( EModel,"Model::ConstructL")    
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsModel::Database
+// ---------------------------------------------------------
+//
+CActiveApDb* CApSettingsModel::Database()
+    {
+    APSETUILOGGER_ENTERFN( EModel,"Model::Database<->")
+    return iDb;
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CApSettingsModel::AllListItemDataL
+// ---------------------------------------------------------
+//
+TInt CApSettingsModel::AllListItemDataL( TBool& aFailedLocked, 
+                                         CApListItemList& aList, 
+                                         TInt aIspFilter, TInt aBearerFilter,
+                                         TInt aSortType, TInt aReqIpvType )
+    {
+    APSETUILOGGER_ENTERFN( EModel,"Model::AllListItemDataL<->")
+    return AllListItemDataL( aFailedLocked, aList, aIspFilter, 
+                             aBearerFilter, aSortType, aReqIpvType,
+                             iVpnFilterType, iIncludeEasyWlan );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsModel::AllListItemDataL
+// ---------------------------------------------------------
+//
+TInt CApSettingsModel::AllListItemDataL( 
+                                        TBool& aFailedLocked,
+                                        CApListItemList& aList,
+                                        TInt aIspFilter,
+                                        TInt aBearerFilter,
+                                        TInt aSortType,
+                                        TInt aReqIpvType,
+                                        TVpnFilterType aVpnFilterType,
+                                        TBool aIncludeEasyWlan
+                                        )
+    {
+    APSETUILOGGER_ENTERFN( EModel,"Model::AllListItemDataL2")
+    TInt retval( 0 );
+    if (iInRefresh)
+        {
+        APSETUILOGGER_WRITE( EModel,"AllListItemData overrun->");
+        iNeedRefresh = ETrue;
+        }
+    else
+        {
+        iInRefresh = ETrue;
+        aFailedLocked = EFalse;
+        CApSelect* apselect = CApSelect::NewLC( *iDb->Database(), aIspFilter, 
+                                                aBearerFilter, aSortType,
+                                                aReqIpvType,
+                                                aVpnFilterType,
+                                                aIncludeEasyWlan );
+        APSETUILOGGER_WRITE( EModel,"ApSelect::NewLC returned");
+        
+        retval = apselect->AllListItemDataL( aList );
+        
+        APSETUILOGGER_WRITE( EModel,"ApSelect::AllListItemDataL returned");
+
+        CleanupStack::PopAndDestroy( apselect ); // apselect
+        retval = aList.Count();
+    
+        iInRefresh = EFalse;
+        }
+    if (iNeedRefresh && !iInRefresh)
+        {
+        APSETUILOGGER_WRITE( EModel,"add. refresh starts");
+        retval = AllListItemDataL( aFailedLocked, aList, aIspFilter, 
+                                   aBearerFilter, aSortType, aReqIpvType,
+                                   aVpnFilterType, aIncludeEasyWlan );
+        iNeedRefresh = EFalse;
+        APSETUILOGGER_WRITE( EModel,"add. refresh ends");
+        }
+    APSETUILOGGER_LEAVEFN( EModel,"Model::AllListItemDataL2")
+    return retval;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsModel::AllListItemDataL
+// ---------------------------------------------------------
+//
+TInt CApSettingsModel::AllListItemDataL( TBool& aFailedLocked, 
+                                         CApListItemList& aList )
+    {
+    APSETUILOGGER_ENTERFN( EModel,"Model::AllListItemDataL ->")
+    return AllListItemDataL( aFailedLocked, aList,  iParams.iIspFilter, 
+                                                iParams.iBearerFilter, 
+                                                iParams.iSortType,
+                                                iReqIpvType, iVpnFilterType,
+                                                iIncludeEasyWlan );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsModel::AccessPointDataL
+// ---------------------------------------------------------
+//
+void CApSettingsModel::AccessPointDataL( TUint32 aUid, 
+                                         CApAccessPointItem& aApItem )
+    {
+    APSETUILOGGER_ENTERFN( EModel,"Model::AccessPointDataL")
+    TTransactionResult ownTransaction = StartTransactionLC( /*aWrite*/EFalse,
+                                               /*aShowNote*/ETrue,
+                                               /*aRetry*/ETrue );
+    if ( ownTransaction != EFailedWithLocked )
+        {
+        iApData->AccessPointDataL( aUid, aApItem );    // adds normal ap
+        // Load wlan data, only loads if WLAN ap.
+        TRAPD( err, LoadWlanL( aApItem ) );
+        if ( err != KErrUnknown)
+            {
+            User::LeaveIfError( err );
+            }
+
+        if ( ownTransaction == EOwnTransaction )
+            {
+            TInt err = CommitTransaction();
+            User::LeaveIfError( err );
+            CleanupStack::Pop(); // RollbackTransactionOnLeave
+            }
+        }
+    
+    APSETUILOGGER_LEAVEFN( EModel,"Model::AccessPointDataL")    
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsModel::UpdateAccessPointDataL
+// ---------------------------------------------------------
+//
+TBool CApSettingsModel::UpdateAccessPointDataL( CApAccessPointItem& aApItem )
+    {
+    APSETUILOGGER_ENTERFN( EModel,"Model::UpdateAccessPointDataL")
+    TBool nameChanged( EFalse );
+// It should be aWrite ETrue, but there is an error in Symbian stuff
+// causing a memory leak
+//    TTransactionResult ownTransaction = StartTransactionLC( /*aWrite*/ETrue,
+    TTransactionResult ownTransaction = StartTransactionLC( /*aWrite*/EFalse,
+                                               /*aShowNote*/ETrue,
+                                               /*aRetry*/ETrue );
+    if ( ownTransaction != EFailedWithLocked )
+        {
+        TBool isnew(EFalse);
+        if ( aApItem.BearerTypeL() == EApBearerTypeWLAN )
+            { // it is WLAN...
+            // check that there were no bearer-change, because if orig. bearer
+            // was NOT wlan, then we shouls consider it as a new record!!!
+            if ( iUtils->BearerTypeL( aApItem.WapUid() ) != EApBearerTypeWLAN )
+                {
+                isnew = ETrue;
+                }
+            }
+        iApData->UpdateAccessPointDataL( aApItem, nameChanged );
+        // write wlan data, only writes if WLAN ap.
+        WriteWlanL( aApItem, isnew );
+
+#ifdef __WINS__
+        ShowNoteL( R_APUI_VIEW_SAVED );
+#endif
+        if ( ownTransaction == EOwnTransaction )
+            {
+            TInt err = CommitTransaction();
+            User::LeaveIfError( err );
+            CleanupStack::Pop(); // RollbackTransactionOnLeave
+            }
+        }
+
+    APSETUILOGGER_LEAVEFN( EModel,"Model::UpdateAccessPointDataL")
+    return nameChanged;
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CApSettingsModel::DataHandler
+// ---------------------------------------------------------
+//
+CApDataHandler* CApSettingsModel::DataHandler()
+    {
+    APSETUILOGGER_ENTERFN( EModel,"Model::DataHandler <->")
+    return iApData;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsModel::ApUtils
+// ---------------------------------------------------------
+//
+CApUtils* CApSettingsModel::ApUtils()
+    {
+    APSETUILOGGER_ENTERFN( EModel,"Model::ApUtils <->")
+    return iUtils;
+    }
+
+
+// ---------------------------------------------------------
+// CApSettingsModel::SetParams
+// ---------------------------------------------------------
+//
+void CApSettingsModel::SetParams( TApSettingsParams aParams )
+    {
+    APSETUILOGGER_ENTERFN( EModel,"Model::SetParams <->")
+    iParams = aParams;
+    }
+
+
+// ---------------------------------------------------------
+// CApSettingsModel::Params
+// ---------------------------------------------------------
+//
+TApSettingsParams CApSettingsModel::Params()
+    {
+    APSETUILOGGER_ENTERFN( EModel,"Model::Params <->")
+    return iParams;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsModel::VpnEngine
+// ---------------------------------------------------------
+//
+CVpnApEngine* CApSettingsModel::VpnEngine()
+    {
+    APSETUILOGGER_ENTERFN( EModel,"Model::VpnEngine <->")
+    return iVpnApEngine;
+    }
+
+
+// ---------------------------------------------------------
+// CApSettingsModel::LaunchHelpL
+// ---------------------------------------------------------
+//
+void CApSettingsModel::LaunchHelpL()
+    {
+#ifdef __SERIES60_HELP
+    APSETUILOGGER_ENTERFN( EModel,"Model::LaunchHelpL")
+    HlpLauncher::LaunchHelpApplicationL(
+                        EikEnv()->WsSession(),
+                        EikEnv()->EikAppUi()->AppHelpContextL() );
+    APSETUILOGGER_LEAVEFN( EModel,"Model::LaunchHelpL")    
+#endif // __SERIES60_HELP
+    }
+
+
+// ---------------------------------------------------------
+// CApSettingsModel::RemoveApL
+// ---------------------------------------------------------
+//
+void CApSettingsModel::RemoveApL( TUint32 aUid )
+    {
+    APSETUILOGGER_ENTERFN( EModel,"Model::RemoveApL")
+// DELETE OPERATION STARTS HERE
+    TBuf<KModifiableTextLength> sgd;
+    iUtils->NameL( aUid, sgd );
+    HBufC* temp = StringLoader::LoadLC( R_APUI_VIEW_DELETING_AP, sgd );    
+
+    APSETUILOGGER_WRITE( EModel,"Creating thread");
+    
+    if (!iop)
+        {
+        iop = CApSettingsDeleteOperation::NewL(
+                        KApWaitNote, R_APUI_VIEW_WAIT_NOTE,
+                        aUid, *temp
+                        );
+        APSETUILOGGER_WRITE( EModel,"Thread created");
+        }
+    else
+        {
+        if (iop->State() != CApSettingsDeleteOperation::EProcOffDialogOff )
+            {
+            ShowNoteL( R_APUI_VIEW_TEXT_CANNOT_ACCESS_DB );
+            User::Leave( KErrInUse );
+            }
+        else
+            {
+            iop->SetUid( aUid );
+            iop->SetNoteTextL( *temp );
+            }
+        }
+    
+    TRAPD(err, iop->StartL() );
+    
+    APSETUILOGGER_WRITE_FORMAT( EModel, "Thread StartL returned, code:%d", err);
+    
+    if ( err != KErrNone )
+        { 
+        User::Leave( err );
+        }
+    
+    CleanupStack::PopAndDestroy( temp );
+    APSETUILOGGER_LEAVEFN( EModel,"Model::RemoveApL")    
+// DELETE OPERATION ENDS HERE
+
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CApSettingsModel::StarTransactionLC
+// ---------------------------------------------------------
+//
+TTransactionResult CApSettingsModel::StartTransactionLC(
+                        TBool aWrite, TBool aShowNote,
+                        TBool aRetry, TBool aLFFSChecking /* ETrue */ )
+    {
+    APSETUILOGGER_ENTERFN( EModel,"Model::StartTransactionLC")
+    TTransactionResult retval( EOwnTransaction );
+
+    // Before attempting db modification, check if we would go below Critical
+    // Level in FFS (disk). The value used for checking is an estimate.
+    // Reading the db also allocates some bytes (transaction log), but
+    // this is not estimated and not checked, because it should be small
+    // enough, and would slow down operation. (Typical use is to read a lot
+    // and write much less.)
+    if (    aLFFSChecking &&
+            aWrite &&
+            FFSSpaceBelowCriticalLevelL
+                ( /*aShowErrorNote=*/EFalse, KEstimatedFfsUsage )
+       )
+        {
+        User::Leave( KErrDiskFull );
+        }
+
+    CCommsDatabase* aDb = iDb->Database();
+    TInt err( KErrNone );
+    if ( !aDb->InTransaction() )
+        {
+        TInt retriesLeft( aRetry ? KRetryCount : 1 );
+        err = aDb->BeginTransaction();
+        while ( ( ( err == KErrLocked ) || ( err == KErrAccessDenied ) )
+                && --retriesLeft )
+            {
+            User::After( KRetryWait );
+            err = aDb->BeginTransaction();
+            if (aWrite )
+                {
+                TRAP(err, GetWriteLockL() );
+                }
+            }
+        if ( err && aShowNote )
+            {
+            ShowNoteL( R_APUI_VIEW_TEXT_CANNOT_ACCESS_DB );
+            }
+        switch ( err )
+            {
+            case KErrNone:
+                {
+                CleanupStack::PushL( 
+                    TCleanupItem( RollbackTransactionOnLeave, aDb ) );
+                break;
+                }
+            case KErrLocked:
+            case KErrAccessDenied:
+                {
+                retval = EFailedWithLocked;
+                break;
+                }
+            default:
+                {
+                User::LeaveIfError( err );
+                break;
+                }
+            }
+        }
+    else
+        {
+        if ( aWrite )
+            {
+            TRAP(err, GetWriteLockL() );
+            }
+        if ( err && aShowNote )
+            {
+            ShowNoteL( R_APUI_VIEW_TEXT_CANNOT_ACCESS_DB );
+            }
+        if ( err != KErrLocked )
+            {
+            User::LeaveIfError( err );
+            }
+        if ( err )
+            {
+            retval = EFailedWithLocked;
+            }
+        else
+            {
+            retval = EUsingAlreadyStarted;
+            }
+        }
+    APSETUILOGGER_LEAVEFN( EModel,"Model::StartTransactionLC")    
+    return retval;
+    }
+
+
+// ---------------------------------------------------------
+// CApSettingsModel::GetWriteLockL
+// ---------------------------------------------------------
+//
+void CApSettingsModel::GetWriteLockL( )
+    {
+    APSETUILOGGER_ENTERFN( EModel,"Model::GetWriteLockL")
+    CCommsDbTableView* v = 
+        iDb->Database()->OpenTableLC( TPtrC(WAP_ACCESS_POINT ) );
+    TUint32 dummyUid( KApNoneUID );
+    TInt err = v->InsertRecord( dummyUid );
+    User::LeaveIfError( err );
+    v->CancelRecordChanges();
+    User::LeaveIfError( err );
+    CleanupStack::PopAndDestroy( v );
+    APSETUILOGGER_LEAVEFN( EModel,"Model::GetWriteLockL")    
+    }
+
+// ---------------------------------------------------------
+// CApSettingsModel::RollbackTransactionOnLeave
+// ---------------------------------------------------------
+//
+void CApSettingsModel::RollbackTransactionOnLeave( TAny* aDb )
+    {
+    APSETUILOGGER_ENTERFN( EModel,"Model::RollbackTransactionOnLeave")
+    CCommsDatabase* db = STATIC_CAST( CCommsDatabase*, aDb );
+    db->RollbackTransaction();
+    APSETUILOGGER_LEAVEFN( EModel,"Model::RollbackTransactionOnLeave")    
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsModel::CommitTransaction
+// ---------------------------------------------------------
+//
+TInt CApSettingsModel::CommitTransaction()
+    {
+    APSETUILOGGER_ENTERFN( EModel,"Model::CommitTransaction")
+    TInt err = iDb->Database()->CommitTransaction();
+    APSETUILOGGER_LEAVEFN( EModel,"Model::CommitTransaction")    
+    return err;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsModel::FFSSpaceBelowCriticalLevelL
+// ---------------------------------------------------------
+//
+TBool CApSettingsModel::FFSSpaceBelowCriticalLevelL
+        ( TBool aShowErrorNote, TInt aBytesToWrite /*=0*/ )
+    {
+    APSETUILOGGER_ENTERFN( EModel,"Model::FFSSpaceBelowCriticalLevelL")
+    TBool ret( EFalse );
+    if ( SysUtil::FFSSpaceBelowCriticalLevelL
+                ( &( EikEnv()->FsSession()), aBytesToWrite ) )
+        {
+        ret = ETrue;
+        if ( aShowErrorNote )
+            {
+            CErrorUI* errorUi = CErrorUI::NewLC( *EikEnv() );
+            errorUi->ShowGlobalErrorNoteL( KErrDiskFull );
+            CleanupStack::PopAndDestroy();  // errorUi
+            }
+        }
+    APSETUILOGGER_LEAVEFN( EModel,"Model::FFSSpaceBelowCriticalLevelL")    
+    return ret;
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CApSettingsModel::NetWorkListDataL
+// ---------------------------------------------------------
+//
+TInt CApSettingsModel::NetWorkListDataL( TBool& aFailedLocked, 
+                                         CApNetworkItemList& aList )
+    {
+    APSETUILOGGER_ENTERFN( EModel,"Model::NetWorkListDataL")
+    TInt retval( KErrNone );
+    aFailedLocked = EFalse;
+    TTransactionResult ownTransaction = StartTransactionLC( /*aWrite*/EFalse,
+                                               /*aShowNote*/EFalse,
+                                               /*aRetry*/ETrue );
+    if ( ownTransaction != EFailedWithLocked )
+        {
+        CApNetworks* apnet = CApNetworks::NewLC( *iDb->Database() );
+        retval = apnet->AllListItemDataL( aList );
+        CleanupStack::PopAndDestroy( apnet ); // apSelect
+        if ( ownTransaction == EOwnTransaction )
+            {
+            TInt err = CommitTransaction();
+            User::LeaveIfError( err );
+            CleanupStack::Pop(); // RollbackTransactionOnLeave
+            }
+        }
+    else
+        {
+        aFailedLocked = ETrue;
+        }
+    APSETUILOGGER_LEAVEFN( EModel,"Model::NetWorkListDataL")    
+    return retval;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsModel::RequestedIPvType
+// ---------------------------------------------------------
+//
+TInt CApSettingsModel::RequestedIPvType( )
+    {
+    APSETUILOGGER_ENTERFN( EModel,"Model::RequestedIPvType<->")
+    return iReqIpvType;
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CApSettingsModel::Need2DeleteSelect
+// called when menu needs to be displayed
+// ---------------------------------------------------------
+//
+TBool CApSettingsModel::Need2DeleteSelect(  TInt aResourceId, TInt aCount )
+    {
+    APSETUILOGGER_ENTERFN( EModel,"Model::Need2DeleteSelect")
+    TBool retval( EFalse );
+
+    if ( ( aCount == 0 )
+         &&
+         ( aResourceId == R_APSETTINGSUI_MENU_SELECT_NORMAL ) )
+        {
+        retval = ETrue;
+        }
+    APSETUILOGGER_LEAVEFN( EModel,"Model::Need2DeleteSelect")    
+    return retval;
+    }
+
+
+// ---------------------------------------------------------
+// CApSettingsModel::Need2DeleteOpen
+// called when menu needs to be displayed
+// ---------------------------------------------------------
+//
+TBool CApSettingsModel::Need2DeleteOpen(  TInt aResourceId, TInt aCount, 
+                                          TUint32 aUid, TBool aNeedsNone )
+    {
+    APSETUILOGGER_ENTERFN( EModel,"Model::Need2DeleteOpen")
+    TBool retval( EFalse );
+    TBool noItem( EFalse );
+    TBool onlyItemIsNone( EFalse );
+    TBool editOnlyVPN( EFalse );
+    TBool noEdit( EFalse );
+
+    noItem = ( aCount == 0) && 
+            ( ( aResourceId == R_APSETTINGSUI_MENU_NORMAL ) ||
+              ( aResourceId == R_APSETTINGSUI_MENU_SELECT_NORMAL ) );
+    
+    onlyItemIsNone = ( aNeedsNone ) && ( aUid == KApNoneUID ) 
+         && ( ( aResourceId == R_APSETTINGSUI_MENU_SELECT_ONLY ) ||
+              ( aResourceId == R_APSETTINGSUI_MENU_SELECT_NORMAL ) ||
+              ( aResourceId == R_APSETTINGSUI_MENU_NORMAL ) );
+
+    editOnlyVPN = ( iVariant & KApUiEditOnlyVPNs ) 
+        && ( ( aResourceId == R_APSETTINGSUI_SELECT_ONLY_MENUBAR ) ||
+             ( aResourceId == R_APSETTINGSUI_SELECT_NORMAL_MENUBAR ) ||
+             ( aResourceId == R_APSETTINGSUI_MENU_NORMAL ) );
+    noEdit = ( iNoEdit )
+        && ( ( aResourceId == R_APSETTINGSUI_MENU_SELECT_NORMAL ) ||
+             ( aResourceId == R_APSETTINGSUI_MENU_NORMAL ) );
+
+    retval = noItem || onlyItemIsNone || editOnlyVPN || noEdit;
+    
+    APSETUILOGGER_LEAVEFN( EModel,"Model::Need2DeleteOpen")    
+    return retval;
+    }
+
+
+// ---------------------------------------------------------
+// CApSettingsModel::Need2DeleteDeleteL
+// called when menu needs to be displayed
+// ---------------------------------------------------------
+//
+TBool CApSettingsModel::Need2DeleteDeleteL(  TInt aResourceId, TInt aCount, 
+                                             TUint32 aUid, TBool aNeedsNone )
+    {
+    APSETUILOGGER_ENTERFN( EModel,"Model::Need2DeleteDeleteL")
+    TBool retval( EFalse );
+    TBool noItem( EFalse );
+    TBool onlyItemIsNone( EFalse );    
+    TBool editOnlyVPN( EFalse );
+    TBool noEdit( EFalse );
+
+    noItem = ( aCount == 0) && 
+            ( ( aResourceId == R_APSETTINGSUI_MENU_NORMAL ) ||
+              ( aResourceId == R_APSETTINGSUI_MENU_SELECT_NORMAL ) );
+
+    onlyItemIsNone = ( aNeedsNone ) && ( aUid == KApNoneUID ) 
+        && ( ( aResourceId == R_APSETTINGSUI_MENU_SELECT_ONLY ) ||
+             ( aResourceId == R_APSETTINGSUI_MENU_SELECT_NORMAL ) ||
+             ( aResourceId == R_APSETTINGSUI_MENU_NORMAL ) );
+
+    editOnlyVPN = ( iVariant & KApUiEditOnlyVPNs )
+        && ( ( aResourceId == R_APSETTINGSUI_SELECT_ONLY_MENUBAR ) ||
+             ( aResourceId == R_APSETTINGSUI_SELECT_NORMAL_MENUBAR ) ||
+             ( aResourceId == R_APSETTINGSUI_MENU_NORMAL ) );
+             
+    noEdit = ( iNoEdit )
+        && ( ( aResourceId == R_APSETTINGSUI_MENU_SELECT_NORMAL ) ||
+             ( aResourceId == R_APSETTINGSUI_MENU_NORMAL ) );
+
+    if ( editOnlyVPN )
+        {
+        // check if current item is VPN...        
+        if ( ( aCount != 0 ) && ( aUid != KApNoneUID ) )
+            {
+            retval = ! iVpnApEngine->IsVpnApL( aUid );                
+            }
+        else
+            {
+            retval = ETrue;
+            }
+        }
+    else
+        {
+        if ( onlyItemIsNone || noItem )
+            {
+            retval = ETrue;
+            }
+        }
+    if ( !retval )
+        {
+        if (noEdit)
+            {
+            retval = ETrue;
+            }
+        }        
+    APSETUILOGGER_LEAVEFN( EModel,"Model::Need2DeleteDeleteL")    
+    return retval;
+    }
+
+
+// ---------------------------------------------------------
+// CApSettingsModel::Need2DeleteNewUseExisting
+// called when menu needs to be displayed
+// ---------------------------------------------------------
+//
+TBool CApSettingsModel::Need2DeleteNewUseExisting(  
+                                            TInt aResourceId, 
+                                            TInt aCount )
+    {
+    APSETUILOGGER_ENTERFN( EModel,"Model::Need2DeleteNewUseExisting")
+    TBool noEdit( EFalse );
+    TBool retval( EFalse );
+    
+    if ( iProtectionSupported )
+        {
+        if (  aResourceId == R_APSETTINGSUI_MENU_SELECT_NORMAL  ||
+                aResourceId == R_APSETTINGSUI_MENU_NORMAL )
+            {
+            TRAP_IGNORE( retval = CApProtHandler::IsTableProtectedL( iDb->Database() ));
+            }
+        }
+
+    if ( aCount == 0)
+        {
+        if ( ( aResourceId == R_APSETTINGSUI_MENU_NORMAL ) ||
+            ( aResourceId == R_APSETTINGSUI_MENU_SELECT_NORMAL ) )
+            {
+            retval = ETrue;
+            }
+        }
+
+    noEdit = ( iNoEdit )
+        && ( ( aResourceId == R_APSETTINGSUI_MENU_SELECT_NORMAL ) ||
+             ( aResourceId == R_APSETTINGSUI_MENU_NORMAL ) );
+
+    if (noEdit)
+        {
+        retval = ETrue;
+        }
+    APSETUILOGGER_LEAVEFN( EModel,"Model::Need2DeleteNewUseExisting")    
+    return retval;
+    }
+
+
+// ---------------------------------------------------------
+// CApSettingsModel::Need2DeleteNewL
+// called when menu needs to be displayed
+// ---------------------------------------------------------
+//
+TBool CApSettingsModel::Need2DeleteNewL(  TInt aResourceId )
+    {
+    APSETUILOGGER_ENTERFN( EModel,"Model::Need2DeleteNewL")
+    TBool noEdit( EFalse );
+    TBool retval( EFalse );
+
+    if ( iProtectionSupported )
+        {
+        if (  aResourceId == R_APSETTINGSUI_MENU_SELECT_NORMAL  ||
+                aResourceId == R_APSETTINGSUI_MENU_NORMAL )
+            {      
+            if ( CApProtHandler::IsTableProtectedL( iDb->Database() ))
+                {
+                retval = ETrue;
+                }
+            }
+        }
+
+    if ( iVariant & KApUiEditOnlyVPNs )
+        {
+        if ( ( aResourceId == R_APSETTINGSUI_MENU_SELECT_NORMAL ) ||
+             ( aResourceId == R_APSETTINGSUI_MENU_NORMAL ) 
+           )
+            {
+            retval = ETrue;
+            }
+        }
+
+    noEdit = ( iNoEdit )
+        && ( ( aResourceId == R_APSETTINGSUI_MENU_SELECT_NORMAL ) ||
+             ( aResourceId == R_APSETTINGSUI_MENU_NORMAL ) );
+
+    if (noEdit)
+        {
+        retval = ETrue;
+        }
+    APSETUILOGGER_LEAVEFN( EModel,"Model::Need2DeleteNewL")    
+    return retval;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsModel::Need2DeleteHelp
+// called when menu needs to be displayed
+// ---------------------------------------------------------
+//
+TBool CApSettingsModel::Need2DeleteHelp(  TInt aResourceId )
+    {
+    APSETUILOGGER_ENTERFN( EModel,"Model::Need2DeleteHelp")
+    TBool retval( EFalse );
+
+	if ( !iHelpSupported )
+		{
+	    if ( aResourceId == R_APSETTINGSUI_MENU_NORMAL )
+	        {
+	        retval = ETrue;
+	        }
+		}
+    
+    APSETUILOGGER_LEAVEFN( EModel,"Model::Need2DeleteHelp")    
+    return retval;
+    }
+
+
+
+
+
+
+
+
+
+// ---------------------------------------------------------
+// CApSettingsModel::GetLinkedVpnAccessPointLC
+// ---------------------------------------------------------
+//
+HBufC* CApSettingsModel::GetLinkedVpnAccessPointLC( TUint32 aUid )
+    {
+    APSETUILOGGER_ENTERFN( EModel,"Model::GetLinkedVpnAccessPointLC")
+    HBufC* retval = HBufC::NewLC( KCommsDbSvrMaxFieldLength );    
+    
+    // Get iap for the above WAP, aUid
+    TUint32 homeiap = iUtils->IapIdFromWapIdL( aUid );
+
+    // now get ALL VPN_SERVICE entry ID where HOME_IAP == iap
+    // Select * from VPN_SERVICE where HOME_IAP == homeiap
+    CCommsDbTableView* t;
+    t = iDb->Database()->OpenViewMatchingUintLC( TPtrC(VPN_SERVICE), 
+                                                 TPtrC(VPN_SERVICE_IAP), 
+                                                 homeiap );
+    TInt err = t->GotoFirstRecord();
+    // if not found, no such, simply exit, no change in passed array
+    if ( err != KErrNotFound )
+        {
+        User::LeaveIfError( err );
+        TPtr sgd = retval->Des();
+        t->ReadTextL( TPtrC(COMMDB_NAME), sgd );
+        CleanupStack::PopAndDestroy( t );//t
+        }
+    else
+        {
+        CleanupStack::PopAndDestroy( 2, retval );// retval, t
+        retval = NULL;
+        }
+    
+    APSETUILOGGER_LEAVEFN( EModel,"Model::GetLinkedVpnAccessPointLC")    
+    return retval;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsModel::EikEnv
+// ---------------------------------------------------------
+//
+CEikonEnv* CApSettingsModel::EikEnv()
+    {
+    APSETUILOGGER_ENTERFN( EModel,"Model::EikEnv<->")
+    if ( !iEikEnv )
+        {
+        iEikEnv = CEikonEnv::Static();
+        }
+    return iEikEnv;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsModel::CreateFromDataL
+// ---------------------------------------------------------
+//
+TUint32 CApSettingsModel::CreateFromDataL( CApAccessPointItem& aApItem )
+    {
+    APSETUILOGGER_ENTERFN( EModel,"Model::CreateFromDataL")
+    TTransactionResult ownTransaction = StartTransactionLC( /*aWrite*/EFalse,
+                                               /*aShowNote*/ETrue,
+                                               /*aRetry*/ETrue );
+    if ( ownTransaction != EFailedWithLocked )
+        {
+        iApData->CreateFromDataL( aApItem );    // adds normal ap
+        // write wlan data, only writes if WLAN ap.
+        WriteWlanL( aApItem, ETrue );
+
+        if ( ownTransaction == EOwnTransaction )
+            {
+            TInt err = CommitTransaction();
+            User::LeaveIfError( err );
+            CleanupStack::Pop(); // RollbackTransactionOnLeave
+            }
+        }
+
+    APSETUILOGGER_LEAVEFN( EModel,"Model::CreateFromDataL")    
+    return aApItem.WapUid();
+    }
+
+
+
+
+
+// ---------------------------------------------------------
+// CApSettingsModel::ChangeWepSettingsL
+// ---------------------------------------------------------
+//
+TInt CApSettingsModel::ChangeWepSettingsL( CApAccessPointItem* aApItem )
+    {
+    APSETUILOGGER_ENTERFN( EModel,"Model::ChangeWepSettingsL")
+    TInt retval(0);
+        
+    if ( !iWepSecSettings )
+        {
+        iWepSecSettings = CWEPSecuritySettings::NewL();
+        TUint32 iapid( 0 );
+        aApItem->ReadUint( EApIapServiceId, iapid );
+        iWepSecSettings->LoadL( iapid, *Database()->Database() );        
+        }
+
+    if ( !iWepSecSettingsUi )
+        {
+        iWepSecSettingsUi = CWEPSecuritySettingsUi::NewL( *EikEnv() );
+        }
+
+    iWepUiExitReason = iWepSecSettings->EditL( *iWepSecSettingsUi, 
+                                               aApItem->ConnectionName() );
+                                               
+    if ( iWepUiExitReason & CWEPSecuritySettings::EExitReq )
+        {
+        retval += KApUiEventExitRequested;
+        }
+    if ( iWepUiExitReason & CWEPSecuritySettings::EShutDownReq )
+        {
+        retval += KApUiEventShutDownRequested;
+        }
+    APSETUILOGGER_LEAVEFN( EModel,"Model::ChangeWepSettingsL")
+    return retval;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsModel::ChangeWpaSettingsL
+// ---------------------------------------------------------
+//
+TInt CApSettingsModel::ChangeWpaSettingsL( CApAccessPointItem* aApItem )
+    {
+    APSETUILOGGER_ENTERFN( EModel,"Model::ChangeWpaSettingsL")
+    TInt retval(0);
+
+    if ( !iWpaSecSettings )
+        {
+        iWpaSecSettings = CWPASecuritySettings::NewL( ESecurityModeWpa );
+        TUint32 iapid( 0 );
+        aApItem->ReadUint( EApIapServiceId, iapid );
+        iWpaSecSettings->LoadL( iapid, *Database()->Database() );
+        }
+
+    if ( !iWpaSecSettingsUi )
+        {
+        iWpaSecSettingsUi = CWPASecuritySettingsUi::NewL( *EikEnv() );
+        }
+
+    iWpaUiExitReason = iWpaSecSettings->EditL( *iWpaSecSettingsUi, 
+                                               aApItem->ConnectionName() );
+                                               
+    if ( iWpaUiExitReason & CWPASecuritySettings::EExitReq )
+        {
+        retval += KApUiEventExitRequested;
+        }
+    if ( iWpaUiExitReason & CWPASecuritySettings::EShutDownReq )
+        {
+        retval += KApUiEventShutDownRequested;
+        }
+    APSETUILOGGER_LEAVEFN( EModel,"Model::ChangeWpaSettingsL")    
+    return retval;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsModel::Change8021xSettingsL
+// ---------------------------------------------------------
+//
+TInt CApSettingsModel::Change8021xSettingsL( CApAccessPointItem* aApItem )
+    {
+    APSETUILOGGER_ENTERFN( EModel,"Model::Change8021xSettingsL")
+    TInt retval(0);
+
+    if ( !iWpaSecSettings )
+        {
+        iWpaSecSettings = CWPASecuritySettings::NewL( ESecurityMode8021x );
+        TUint32 iapid( 0 );
+        aApItem->ReadUint( EApIapServiceId, iapid );
+        iWpaSecSettings->LoadL( iapid, *Database()->Database() );        
+        }
+        
+    if ( !iWpaSecSettingsUi )
+        {
+        iWpaSecSettingsUi = CWPASecuritySettingsUi::NewL( *EikEnv() );
+        }
+        
+    iWpaUiExitReason = iWpaSecSettings->EditL( *iWpaSecSettingsUi, 
+                                               aApItem->ConnectionName() );
+
+    if ( iWpaUiExitReason & CWPASecuritySettings::EExitReq )
+        {
+        retval += KApUiEventExitRequested;
+        }
+    if ( iWpaUiExitReason & CWPASecuritySettings::EShutDownReq )
+        {
+        retval += KApUiEventShutDownRequested;
+        }
+    APSETUILOGGER_LEAVEFN( EModel,"Model::Change8021xSettingsL")       
+    return retval;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsModel::ClearWEPAndWPASettings
+// ---------------------------------------------------------
+//
+void CApSettingsModel::ClearWEPAndWPASettings()
+    {
+    APSETUILOGGER_ENTERFN( EModel,"Model::ClearWEPAndWPASettings")
+    
+    delete iWepSecSettings;
+    iWepSecSettings = NULL;
+
+    delete iWpaSecSettings;
+    iWpaSecSettings = NULL;
+    
+    APSETUILOGGER_LEAVEFN( EModel,"Model::ClearWEPAndWPASettings") 
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsModel::WriteWlanL
+// ---------------------------------------------------------
+//
+void CApSettingsModel::WriteWlanL( CApAccessPointItem& aApItem,
+                                   TBool aIsNew )
+    {
+    APSETUILOGGER_ENTERFN( EModel,"Model::WriteWlanL")
+    // now check if it is WLAN and handle security savings...
+    if ( aApItem.BearerTypeL() == EApBearerTypeWLAN )
+        { // it is WLAN...
+        // check that there were no bearer-change, because if orig. bearer 
+        // was NOT wlan, then we shouls consider it as a new record!!!
+        TUint32 wlanid(0);
+        aApItem.ReadUint( EApIapServiceId, wlanid );        
+        
+        TUint32 oldwlanid(wlanid);
+        
+        TTypeOfSaving savetype( ESavingEditedAP );
+        
+        if ( aIsNew )
+            {
+            savetype = ESavingBrandNewAP;
+            oldwlanid = 0;
+            }
+        // now check if it is WEP...
+        // read up security mode
+        TUint32 secmode( 0 );
+        aApItem.ReadUint( EApWlanSecurityMode, secmode );
+        
+        
+        TBool fresh(EFalse); 
+        
+        
+        switch ( secmode )
+            {
+            case EOpen:
+                {
+                break;
+                }
+            case EWep:
+                {
+                // we have to try to save if:
+                // 1. it is a changed AP, it is possible that only 
+                // sec. settings have been changed. 
+                // In this case, iWepSecSettings might be NULL!!
+                // 2. it's sec. settings had been edited
+                
+                if ( !iWepSecSettings )
+                    {
+                    iWepSecSettings = CWEPSecuritySettings::NewL();
+                    fresh = ETrue;
+                    iWepSecSettings->LoadL( oldwlanid, 
+                                            *Database()->Database() );
+                    }
+                
+                if ( ( iWepUiExitReason & CWEPSecuritySettings::EValid ) 
+                    || ( fresh ) )
+                    { // save WEP settings, too, into same transaction...
+                    iWepSecSettings->SaveL( wlanid, *iDb->Database() );
+                    }
+                break;
+                }
+            case E802_1x:
+                {
+                
+                if ( !iWpaSecSettings )
+                    {
+                    iWpaSecSettings = 
+                        CWPASecuritySettings::NewL( ESecurityMode8021x );
+                    fresh = ETrue;
+                    iWpaSecSettings->LoadL( oldwlanid, 
+                                            *Database()->Database() );
+                    }                
+                
+                if ( ( iWpaUiExitReason & CWPASecuritySettings::EValid )
+                    || ( fresh ) )
+                    { // save WPA settings, too, into same transaction...
+                    iWpaSecSettings->SaveL( wlanid, *iDb->Database(), 
+                                            savetype, oldwlanid );
+                    }
+                break;
+                }
+            case EWpa:
+            case EWpa2:
+                {
+                
+                if ( !iWpaSecSettings )
+                    {
+                    iWpaSecSettings = 
+                          CWPASecuritySettings::NewL( ESecurityModeWpa );
+                    fresh = ETrue;
+                    iWpaSecSettings->LoadL( oldwlanid, 
+                                            *Database()->Database() );
+                    }                
+                
+                if ( ( iWpaUiExitReason & CWPASecuritySettings::EValid )
+                    || ( fresh ) )
+                    { // save WPA settings, too, into same transaction...
+                    iWpaSecSettings->SaveL( wlanid, *iDb->Database(),
+                                            savetype, oldwlanid );
+                    }
+                break;
+                }
+            default:
+                {
+                __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) );
+                // do nothing in urel
+                break;
+                }
+            }
+        }
+    APSETUILOGGER_LEAVEFN( EModel,"Model::WriteWlanL")    
+    }
+
+
+
+
+
+// ---------------------------------------------------------
+// CApSettingsModel::LoadWlanL
+// ---------------------------------------------------------
+//
+void CApSettingsModel::LoadWlanL( CApAccessPointItem& aApItem )
+    {
+    APSETUILOGGER_ENTERFN( EModel,"Model::LoadWlanL")
+    // now check if it is WLAN and handle security savings...
+    if ( aApItem.BearerTypeL() == EApBearerTypeWLAN )
+        { // it is WLAN...
+        // now check if it is WEP...
+        // read up security mode
+        TUint32 secmode( 0 );
+        aApItem.ReadUint( EApWlanSecurityMode, secmode );
+        switch ( secmode )
+            {
+            case EOpen:
+                {
+                break;
+                }
+            case EWep:
+                {
+                if ( !iWepSecSettings )
+                    {
+                    iWepSecSettings = CWEPSecuritySettings::NewL();
+                    }
+    
+                if ( !iWepSecSettingsUi )
+                    {
+                    iWepSecSettingsUi = 
+                        CWEPSecuritySettingsUi::NewL( *EikEnv() );
+                    }
+                TUint32 wlanid( 0 );
+                aApItem.ReadUint( EApIapServiceId, wlanid );
+                iWepSecSettings->LoadL( wlanid, *Database()->Database() );
+                break;
+                }
+            case E802_1x:
+                {
+                if ( !iWpaSecSettings )
+                    {
+                    iWpaSecSettings = 
+                        CWPASecuritySettings::NewL( ESecurityMode8021x );
+                    }
+    
+                if ( !iWpaSecSettingsUi )
+                    {
+                    iWpaSecSettingsUi = 
+                        CWPASecuritySettingsUi::NewL( *EikEnv() );
+                    }
+                TUint32 wlanid( 0 );
+                aApItem.ReadUint( EApIapServiceId, wlanid );
+                iWpaSecSettings->LoadL( wlanid, *Database()->Database() );
+                break;
+                }
+            case EWpa:
+            case EWpa2:
+                {
+                if ( !iWpaSecSettings )
+                    {
+                    iWpaSecSettings = 
+                        CWPASecuritySettings::NewL( ESecurityModeWpa );
+                    }
+    
+                if ( !iWpaSecSettingsUi )
+                    {
+                    iWpaSecSettingsUi = 
+                        CWPASecuritySettingsUi::NewL( *EikEnv() );
+                    }
+                TUint32 wlanid( 0 );
+                aApItem.ReadUint( EApIapServiceId, wlanid );
+                iWpaSecSettings->LoadL( wlanid, *Database()->Database() );
+                break;
+                }
+            default:
+                {
+                __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) );
+                // do nothing in urel
+                break;
+                }
+            }
+        }
+    APSETUILOGGER_LEAVEFN( EModel,"Model::LoadWlanL")    
+    }
+
+
+
+
+
+//----------------------------------------------------------
+// CApSettingsModel::HasWlanSecSettingsFilledL
+//----------------------------------------------------------
+//
+TBool CApSettingsModel::HasWlanSecSettingsFilledL( CApAccessPointItem& aApItem )
+    {
+    APSETUILOGGER_ENTERFN( EModel,"Model::HasWlanSecSettingsFilledL")
+    TBool retval(EFalse);
+    
+    TUint32 secmode( 0 );
+    aApItem.ReadUint( EApWlanSecurityMode, secmode );
+    
+    TUint32 wlanid(0);
+    aApItem.ReadUint( EApIapServiceId, wlanid );        
+        
+    TUint32 oldwlanid(wlanid);
+
+    TUint32 wapuid = aApItem.WapUid();
+
+    if ( ( wapuid == KApNoneUID )
+        || ( iUtils->BearerTypeL( wapuid ) != EApBearerTypeWLAN ) )
+        {
+        oldwlanid = 0;
+        }
+
+    switch ( secmode )
+        {
+        case EOpen:
+            {
+            retval = ETrue;
+            break;
+            }
+        case EWep:
+            {
+            if ( !iWepSecSettings )
+                {
+                iWepSecSettings = CWEPSecuritySettings::NewL();
+                iWepSecSettings->LoadL( oldwlanid, 
+                                        *Database()->Database() );
+                }
+            retval = iWepSecSettings->IsValid();
+            break;
+            }
+        case E802_1x:
+            {
+            if ( !iWpaSecSettings )
+                {
+                iWpaSecSettings = 
+                    CWPASecuritySettings::NewL( ESecurityMode8021x );
+                iWpaSecSettings->LoadL( oldwlanid, 
+                                        *Database()->Database() );
+                }
+            retval = iWpaSecSettings->IsValid();
+            break;
+            }
+        case EWpa:
+        case EWpa2:
+            {
+            if ( !iWpaSecSettings )
+                {
+                iWpaSecSettings = 
+                      CWPASecuritySettings::NewL( ESecurityModeWpa );
+                iWpaSecSettings->LoadL( oldwlanid, 
+                                        *Database()->Database() );
+                }                
+            retval = iWpaSecSettings->IsValid();                
+            break;
+            }
+        default:
+            {
+            __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) );
+            // do nothing in urel
+            break;
+            }
+        }
+    APSETUILOGGER_LEAVEFN( EModel,"Model::HasWlanSecSettingsFilledL")    
+    return retval;
+    }
+
+
+//----------------------------------------------------------
+// CApSettingsModel::UpdateSecurityModeL
+//----------------------------------------------------------
+//
+void CApSettingsModel::UpdateSecurityModeL( CApAccessPointItem& aApItem )
+    {
+    APSETUILOGGER_ENTERFN( EModel,"Model::UpdateSecurityModeL")
+    TUint32 secmode( 0 );
+    aApItem.ReadUint( EApWlanSecurityMode, secmode );
+
+    TUint32 wlanid(0);
+    aApItem.ReadUint( EApIapServiceId, wlanid );
+
+    switch ( secmode )
+        {
+        case EOpen:
+            {
+            break;
+            }
+        case EWep:
+            {
+            if ( iWepSecSettings )
+                {
+                delete iWepSecSettings;
+                iWepSecSettings = NULL; // to satisfy CodeScanner
+                }
+            iWepSecSettings = CWEPSecuritySettings::NewL();
+            iWepSecSettings->LoadL( wlanid, 
+                                    *Database()->Database() );
+            break;
+            }
+        case E802_1x:
+            {
+            if ( iWpaSecSettings )
+                {
+                delete iWpaSecSettings;
+                iWpaSecSettings = NULL; // to satisfy CodeScanner
+                }
+            iWpaSecSettings = 
+                CWPASecuritySettings::NewL( ESecurityMode8021x );
+            iWpaSecSettings->LoadL( wlanid, 
+                                    *Database()->Database() );
+            break;
+            }
+        case EWpa:
+        case EWpa2:
+            {
+            if ( iWpaSecSettings )
+                {
+                delete iWpaSecSettings;
+                iWpaSecSettings = NULL; // to satisfy CodeScanner
+                }
+            iWpaSecSettings = 
+                  CWPASecuritySettings::NewL( ESecurityModeWpa );
+            iWpaSecSettings->LoadL( wlanid, 
+                                    *Database()->Database() );
+            break;
+            }
+        default:
+            {
+            __ASSERT_DEBUG( EFalse, Panic( EUnknownCase ) );
+            // do nothing in urel
+            break;
+            }
+        }
+    APSETUILOGGER_LEAVEFN( EModel,"Model::UpdateSecurityModeL")    
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/src/FeatureManagerWrapper.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,85 @@
+/*
+* Copyright (c) 2004 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 CFeatureManagerWrapper.
+*
+*/
+
+
+// INCLUDE FILES
+#include    "FeatureManagerWrapper.h"
+#include    "ApSettingsHandlerLogger.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CFeatureManagerWrapper::CFeatureManagerWrapper
+// ---------------------------------------------------------
+//
+CFeatureManagerWrapper::CFeatureManagerWrapper() : CBase()
+    {
+    APSETUILOGGER_ENTERFN( EOther,"FeatureWrapper::CFeatureManagerWrapper<->")
+    }
+
+// ---------------------------------------------------------
+// CFeatureManagerWrapper::~CFeatureManagerWrapper
+// ---------------------------------------------------------
+//
+CFeatureManagerWrapper::~CFeatureManagerWrapper() 
+    {
+    APSETUILOGGER_ENTERFN( EOther,"FeatureWrapper::~CFeatureManagerWrapper")
+    
+    if ( iIsFeatureMgrInitialized )
+        {
+        FeatureManager::UnInitializeLib();    
+        }
+    
+    APSETUILOGGER_LEAVEFN( EOther,"FeatureWrapper::~CFeatureManagerWrapper")
+    }
+
+
+// ---------------------------------------------------------
+// CFeatureManagerWrapper::ConstructL
+// ---------------------------------------------------------
+//
+void CFeatureManagerWrapper::ConstructL()
+    {
+    APSETUILOGGER_ENTERFN( EOther,"FeatureWrapper::ConstructL")
+    
+    FeatureManager::InitializeLibL();
+    iIsFeatureMgrInitialized = ETrue ;
+    
+    APSETUILOGGER_LEAVEFN( EOther,"FeatureWrapper::ConstructL")
+    }
+
+
+// ---------------------------------------------------------
+// CFeatureManagerWrapper::NewL
+// ---------------------------------------------------------
+//
+CFeatureManagerWrapper*  CFeatureManagerWrapper::NewL()
+    {
+    APSETUILOGGER_ENTERFN( EOther,"FeatureWrapper::NewL")
+    
+    CFeatureManagerWrapper* self = new ( ELeave ) CFeatureManagerWrapper;
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    APSETUILOGGER_LEAVEFN( EOther,"FeatureWrapper::NewL")
+    return self;
+    }
+
+//End of file.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/src/TextOverrides.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,166 @@
+/*
+* Copyright (c) 2002 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: 
+*     Declares the CTextOverrides class.
+*
+*/
+
+
+// INCLUDE FILES
+#include "TextOverrides.h"
+#include <ApSettingsHandlerCommons.h>
+#include "ApSettingsHandlerLogger.h"
+
+// CLASS DECLARATION
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CTextOverrides::NewL
+// ---------------------------------------------------------
+//
+CTextOverrides* CTextOverrides::NewL( )
+    {
+    APSETUILOGGER_ENTERFN( EOther,"TxtOverride::NewL")
+    
+    CTextOverrides* db = new( ELeave ) CTextOverrides();
+    CleanupStack::PushL( db );
+    db->ConstructL( );
+    CleanupStack::Pop(); // db
+    
+    APSETUILOGGER_LEAVEFN( EOther,"TxtOverride::NewL")
+    return db;
+    }
+
+
+
+// Destructor
+CTextOverrides::~CTextOverrides()
+    {
+    APSETUILOGGER_ENTERFN( EOther,"TxtOverride::~CTextOverrides")
+    
+    if ( iTxtArray )
+        {
+        iTxtArray->ResetAndDestroy();
+        }
+    delete iTxtArray;
+    
+    APSETUILOGGER_LEAVEFN( EOther,"TxtOverride::~CTextOverrides")
+    }
+
+
+// Constructor
+CTextOverrides::CTextOverrides()
+    {
+    }
+
+
+// ---------------------------------------------------------
+// CTextOverrides::ConstructL
+// ---------------------------------------------------------
+//
+void CTextOverrides::ConstructL( )
+    {
+    APSETUILOGGER_ENTERFN( EOther,"TxtOverride::ConstructL")
+    
+    iTxtArray = new( ELeave ) CArrayPtrFlat<HBufC>( KTxtOverrideGran );
+    for (TInt i=0; i<=KTTextIdMax; i++ )
+        {
+        iTxtArray->AppendL( NULL);
+        }
+    
+    APSETUILOGGER_LEAVEFN( EOther,"TxtOverride::ConstructL")
+    }
+
+
+// ---------------------------------------------------------
+// CTextOverrides::SetTextOverridesL
+// ---------------------------------------------------------
+//
+void CTextOverrides::SetTextOverrideL( TTextID aText2Change,
+                                                const TDesC& aNewText )
+    {
+    APSETUILOGGER_ENTERFN( EOther,"TxtOverride::SetTextOverrideL")
+    
+    ValidateIdL( aText2Change );
+
+    HBufC* a = aNewText.AllocL();
+    iTxtArray->Delete( aText2Change );
+    iTxtArray->InsertL( aText2Change, a );
+
+    APSETUILOGGER_LEAVEFN( EOther,"TxtOverride::SetTextOverrideL")
+    }
+
+
+// ---------------------------------------------------------
+// CTextOverrides::TextOverridesL
+// ---------------------------------------------------------
+//
+const TDesC& CTextOverrides::TextOverrideL( TTextID aTextId )
+    {
+    APSETUILOGGER_ENTERFN( EOther,"TxtOverride::TextOverrideL")
+    
+    ValidateIdL( aTextId );
+    if ( !IsTextOverridenL( aTextId ) )
+        {
+        User::Leave( KTxtNotOverriden );
+        }
+    
+    APSETUILOGGER_LEAVEFN( EOther,"TxtOverride::TextOverrideL")
+    return *iTxtArray->At( aTextId );
+    }
+
+
+// ---------------------------------------------------------
+// CTextOverrides::IsTextOverridenL
+// ---------------------------------------------------------
+//
+TBool CTextOverrides::IsTextOverridenL( TTextID aTextId )
+    {
+    APSETUILOGGER_ENTERFN( EOther,"TxtOverride::IsTextOverridenL")
+    
+    TBool retval( EFalse );
+    ValidateIdL( aTextId );
+    if ( iTxtArray->At( aTextId ) )
+        {
+        retval = ETrue;
+        }
+    else
+        {
+        retval = EFalse;
+        }
+    
+    APSETUILOGGER_LEAVEFN( EOther,"TxtOverride::IsTextOverridenL")
+    return retval;
+    }
+
+
+// ---------------------------------------------------------
+// CTextOverrides::ValidateIdL
+// ---------------------------------------------------------
+//
+void CTextOverrides::ValidateIdL( TTextID aTextId )
+    {
+    APSETUILOGGER_ENTERFN( EOther,"TxtOverride::ValidateIdL")
+    
+    if ( ( aTextId < KTTextIdMin ) || ( aTextId > KTTextIdMax ) )
+        {
+        User::Leave( KErrInvalidTextId );
+        }
+    
+    APSETUILOGGER_LEAVEFN( EOther,"TxtOverride::ValidateIdL")
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/src/apsettingsdeleteoperation.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,630 @@
+/*
+* Copyright (c) 2002 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 CApSettingsDeleteOperation
+*
+*/
+
+
+// INCLUDE FILES
+#include <ApDataHandler.h>
+#include <ApUtils.h>
+#include <ActiveApDb.h>
+#include <ApSettingsHandlerCommons.h>
+#include <VpnApEngine.h>
+#include <AknWaitDialog.h>
+#include <AknProgressDialog.h>
+#include <cdbcols.h>
+#include <ErrorUI.h>
+#include "Apsettingsdeleteoperation.h"
+
+#include <WEPSecuritySettingsUI.h>
+#include <WPASecuritySettingsUI.h>
+#include <ApAccessPointItem.h>
+
+// Following includes are needed only for the test
+// when ALL APs are deleted (checking delays, etc.)
+// For testing purpose only, to make process time longer.
+//  TEST STARTS
+#include <ActiveApDb.h>
+#include <ApSelect.h>
+#include <ApListItem.h>
+#include "ApSelectorListBoxModel.h"
+#include "ApSettingsHandlerLogger.h"
+
+#include <ApSetUI.rsg>
+//  TEST ENDS
+
+
+// Stack size of the receiver thread.
+LOCAL_C const TInt KDeleteThreadStackSize = 40960;
+
+// Name of the receiver thread.
+_LIT( KDeleteThreadName, "Access Point Settings UI Delete Operation" );
+
+
+// ---------------------------------------------------------
+// CApSettingsDeleteOperation::NewL
+// ---------------------------------------------------------
+//
+CApSettingsDeleteOperation* CApSettingsDeleteOperation::NewL(
+                                TInt aNoteControlId,
+                                TInt aResourceID,
+                                TUint32 aUid,
+                                const TDesC& aNoteText
+                                )
+    {
+    APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::NewL")
+    
+    CApSettingsDeleteOperation* db =
+            new ( ELeave ) CApSettingsDeleteOperation(
+                            aNoteControlId,
+                            aResourceID,
+                            aUid
+                            );
+    CleanupStack::PushL( db );
+    db->ConstructL( aNoteText );
+    CleanupStack::Pop();
+    
+    APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::NewL")
+    return db;
+    }
+
+
+// ---------------------------------------------------------
+// CApSettingsDeleteOperation::ConstructL
+// ---------------------------------------------------------
+//
+void CApSettingsDeleteOperation::ConstructL( const TDesC& aNoteText )
+    {
+    APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::ConstructL")
+    
+    iErrorUi = CErrorUI::NewL( *CCoeEnv::Static() );
+    iNoteText = aNoteText.AllocL();
+    
+    APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::ConstructL")
+    }
+
+
+// ---------------------------------------------------------
+// CApSettingsDeleteOperation::CApSettingsDeleteOperation
+// ---------------------------------------------------------
+//
+CApSettingsDeleteOperation::CApSettingsDeleteOperation(
+                                 TInt aNoteControlId,
+                                 TInt aResourceID,
+                                 TUint32 aUid
+                                 )
+: CActive( EPriorityLow ),
+  iNoteControlId( aNoteControlId ),
+  iResourceID( aResourceID ),
+  iUid( aUid )
+    {
+    CActiveScheduler::Add(this);
+    APSETUILOGGER_WRITE( EModel,"Thread added to scheduler");
+    }
+
+
+// ---------------------------------------------------------
+// CApSettingsDeleteOperation::~CApSettingsDeleteOperation
+// ---------------------------------------------------------
+//
+CApSettingsDeleteOperation::~CApSettingsDeleteOperation()
+    {
+    APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::~CApSettingsDeleteOperation")
+    
+    if(iDeleteOperation.Handle() != 0)
+        {
+        // wait for deletion to finish
+        TRequestStatus status;          
+        iDeleteOperation.Logon(status);
+        User::WaitForRequest(status);
+        
+        iDeleteOperation.Close();
+        }
+        
+    Cancel();                        
+    
+    delete iWaitDialog;
+
+    delete iNoteText;
+    delete iErrorUi;
+    
+    APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::~CApSettingsDeleteOperation")
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CApSettingsDeleteOperation::RunL
+// ---------------------------------------------------------
+//
+void CApSettingsDeleteOperation::RunL()
+    {
+    APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::RunL")
+    
+    switch ( iState )
+        {
+        case EProcOnDialogOn:
+            { // two chances :
+            // 1. Process finished normally
+            // 2. Process leaved with error
+            iState = EProcOffDialogOn;
+            if ( iWaitDialog )
+                {
+                iWaitDialog->ProcessFinishedL();
+                }
+            if ( iStatus.Int() != KErrNone )
+                {
+                // some error has occured
+                iErr = iStatus.Int();
+                }
+            Next();
+            break;
+            }
+        case EProcOffDialogOn:
+            {
+            // now we wait for the dialog to be dismissed
+            // just to be able to delete it
+            // stays in this state as long as DialogDismissedL()
+            // is not called, it will move it out into
+            // EProcOffDialogOff and it also deletes
+            Next();
+            break;
+            }
+        case EProcOnDialogOff:
+            { // this can't be, as dialog MUST stay as long as operation...
+            iState = EProcOffDialogOff;
+            Next();
+            break;
+            }
+        case EProcOffDialogOff:
+            { // now we can safely delete the dialog
+            if ( iWaitDialog )
+                {
+                delete iWaitDialog;
+                }
+            if ( iErr != KErrNone )
+                {
+                // some error has occured
+                iErrorUi->ShowGlobalErrorNoteL( iErr );
+                }
+            iDeleteOperation.Kill( iErr );
+            iDeleteOperation.Close();            
+//            delete this;
+            break;
+            }
+        default:
+            {
+            __ASSERT_DEBUG( EFalse, Panic( EInvalidState ) );
+            break;
+            }
+        }
+    
+    APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::RunL")
+    }
+
+
+// ---------------------------------------------------------
+// CApSettingsDeleteOperation::DoCancel
+// ---------------------------------------------------------
+//
+void CApSettingsDeleteOperation::DoCancel()
+    { // must be here as it is pure virtual in base...    
+    APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::DoCancel")
+    
+    if (iDeleteOperation.Handle() != 0 && iStatus == KRequestPending)
+        {
+        iDeleteOperation.LogonCancel(iStatus);
+        } 
+    
+    APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::DoCancel")
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsDeleteOperation::DialogDismissedL
+// ---------------------------------------------------------
+//
+void CApSettingsDeleteOperation::DialogDismissedL( TInt /*aButtonId*/ )
+    {
+    APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::DialogDismissedL")
+    
+    switch ( iState )
+        {
+        case EProcOnDialogOn:
+            { // can't be, it means that dialog is dismissed by user
+            // but process is still runing...
+            iState = EProcOnDialogOff;
+            break;
+            }
+        case EProcOffDialogOn:
+            {
+            // set dialog off
+            iState = EProcOffDialogOff;
+            // as proc is already off, it circles in RunL,
+            break;
+            }
+        case EProcOnDialogOff:
+            { // can't be, it is already off...
+            iState = EProcOnDialogOff;
+            Next();
+            break;
+            }
+        case EProcOffDialogOff:
+            {// can't be, it is already off...
+            iState = EProcOffDialogOff;
+            Next();
+            break;
+            }
+        default:
+            {
+            __ASSERT_DEBUG( EFalse, Panic( EInvalidState ) );
+            break;
+            }
+        }
+    
+    APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::DialogDismissedL")
+    }
+
+
+// ---------------------------------------------------------
+// CApSettingsDeleteOperation::StartL
+// ---------------------------------------------------------
+//
+void CApSettingsDeleteOperation::StartL()
+    {
+    APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::StartL")
+    
+    iStatus = KRequestPending;
+    // set the internal state as both is running
+    iState = EProcOnDialogOn;
+
+    // now we can start wait note...
+    StartWaitNoteL();
+
+    // now start new thread with operation
+    StartDeleteOperationThreadL();
+
+    SetActive();
+    // now we can wait on it...
+    // wait until the started thread completes (delete operation completes)
+    // and it will enter RunL. RunL will notify the wait dialog about the
+    // completion of the process.
+    // As the dialog shall wait ~0.5 sec till display AND must be visible
+    // for ~1.5 sec. as a minimum, but must stay up as long as the 'process'
+    // on it is waiting for does not completes, we have the following chances:
+    // if the process is shorter than 0.5,
+        // after operation completes, state moves to EProcOffDialogOn,
+        // dialog will be notified about completion by RunL, and RunL starts
+        // circle and wait for the dialog to finish, multiply re-entering
+        // and leaving RunL, as long as the state is EProcOffDialogOn.
+        // As time was shorter than 0.5, thus dialog will not show itself
+        // and will call DialogDismissedL, which will change the
+        // state to EProcOffDialogOff, which, on entering
+        // RunL again, will delete the dialog and kill the thread.
+    // if the process was longer than 0.5 but shorter than 0.5+1.5sec,
+        // after operation completes, state moves to EProcOffDialogOn,
+        // dialog will be notified about completion by RunL, and RunL starts
+        // circle and wait for the dialog to finish, multiply re-entering
+        // and leaving RunL, as long as the state is EProcOffDialogOn.
+        // As time was longer than 0.5, thus dialog will show itself
+        // and will stay up for 1.5 sec, as process ended between
+        // 0.5 and (0.5+1.5). After it dialog will call DialogDismissedL,
+        // which will change the state to EProcOffDialogOff, which, on
+        // entering RunL again, will delete the dialog and kill the thread.
+    // if the process was longer than 0.5+1.5
+        // after operation completes, state moves to EProcOffDialogOn,
+        // dialog will be notified about completion by RunL, and RunL starts
+        // circle and wait for the dialog to finish, multiply re-entering
+        // and leaving RunL, as long as the state is EProcOffDialogOn.
+        // As time was longer than 0.5+1.5, thus dialog will show itself
+        // and will stay up for as long as 'process/operation' is not finished.
+        // As thread completes, notifies dialog, after it dialog will
+        // call back DialogDismissedL, which will change the state
+        // to EProcOffDialogOff, which, on entering RunL again,
+        // will delete the dialog and kill the thread.
+    
+    APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::StartL")
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsDeleteOperation::Next
+// ---------------------------------------------------------
+//
+void CApSettingsDeleteOperation::Next()
+    {
+    APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::Next")
+    
+    iStatus = KRequestPending;
+    SetActive();
+    TRequestStatus *status = &iStatus;
+    User::RequestComplete( status, KErrNone );  // Invoke RunL()
+    
+    APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::Next")
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CApSettingsDeleteOperation::RunDeleteThread
+// ---------------------------------------------------------
+//
+TInt CApSettingsDeleteOperation::RunDeleteThread( TAny* aPtr )
+    {
+    APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::RunDeleteThread")
+    
+    CApSettingsDeleteOperation* aop = 
+            STATIC_CAST( CApSettingsDeleteOperation*, aPtr );
+
+
+    CTrapCleanup* TheTrapCleanup = CTrapCleanup::New(); // get cleanup stack
+
+    TRAPD(r, aop->DoRunDeleteThreadL( aop ) );
+
+    delete TheTrapCleanup; // destroy cleanup stack
+
+    aop->iErr = r;
+    
+    APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::RunDeleteThread")
+    return ( r );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsDeleteOperation::DoRunDeleteThreadL
+// ---------------------------------------------------------
+//
+TInt CApSettingsDeleteOperation::DoRunDeleteThreadL( 
+                                    CApSettingsDeleteOperation* aop )
+    {
+    APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::DoRunDeleteThreadL")
+    
+    CCommsDatabase* db = CCommsDatabase::NewL( EDatabaseTypeIAP );
+    CleanupStack::PushL( db );
+    
+    APSETUILOGGER_WRITE( EDelete,"Commsdb created");
+
+    CApDataHandler* handler = CApDataHandler::NewLC( *db );
+    
+    APSETUILOGGER_WRITE( EDelete,"CApDataHandler created");
+    
+    CVpnApEngine* vpnengine = CVpnApEngine::NewLC( db );
+
+    APSETUILOGGER_WRITE( EDelete,"CVpnApEngine created");
+
+    TBool ownTransaction = StartTransactionLC( db, 
+                                               /*aWrite*/ETrue, 
+                                               /*aRetry*/ETrue );
+
+    APSETUILOGGER_WRITE( EDelete,"Tr.started");
+
+//  NORMAL OPERATION STARTS
+    TBool isvpn = vpnengine->IsVpnApL( aop->iUid );
+
+    APSETUILOGGER_WRITE( EDelete,"IsVpnApL returned");
+    
+    // if linked to a VPN, the VPN also must be deleted
+    // deleting the VPN part is the delete operation's responsibility...
+    if ( isvpn )
+        {
+        vpnengine->DeleteVpnL( aop->iUid );
+        }
+    else
+        {
+        handler->RemoveAPL( aop->iUid );
+        }
+    
+    APSETUILOGGER_WRITE( EDelete,"RemoveAPL returned");
+
+
+    if ( ownTransaction )
+        {
+        TInt err = db->CommitTransaction();
+        User::LeaveIfError( err );
+        CleanupStack::Pop(); // RollbackTransactionOnLeave
+        }
+
+    APSETUILOGGER_WRITE( EDelete," delete finished");
+
+    CleanupStack::PopAndDestroy( 3, db ); //db,handler,vpnengine
+
+//  NORMAL OPERATION ENDS
+
+
+    APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::DoRunDeleteThreadL")
+    return KErrNone;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsDeleteOperation::StartWaitNoteL
+// ---------------------------------------------------------
+//
+void CApSettingsDeleteOperation::StartWaitNoteL()
+    {
+    APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::StartWaitNoteL")
+    
+    if ( iWaitDialog )
+        {
+        delete iWaitDialog;
+        iWaitDialog = NULL;
+        }
+    iWaitDialog =
+        new ( ELeave ) CAknWaitDialog
+                ( REINTERPRET_CAST(CEikDialog**,&iWaitDialog) );
+    iWaitDialog->PrepareLC( iResourceID );
+    iWaitDialog->SetTone( CAknNoteDialog::ENoTone );
+    iWaitDialog->SetTextL( *iNoteText );
+    iWaitDialog->SetCallback( this );
+    iWaitDialog->RunLD();
+    
+    APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::StartWaitNoteL")
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsDeleteOperation::StartDeleteOperationThreadL
+// ---------------------------------------------------------
+//
+void CApSettingsDeleteOperation::StartDeleteOperationThreadL()
+    {
+    APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::StartDeleteOperationThreadL")
+    
+    TInt err = iDeleteOperation.Create
+            (
+            KDeleteThreadName, // aName
+            RunDeleteThread, // aFunction
+            KDeleteThreadStackSize, // aStackSize
+            NULL,         // Use this heap.
+            this // aPtr
+            );
+    APSETUILOGGER_WRITE_FORMAT( EDelete, "iDeleteOperation create returned, code:%d", err);    
+    
+    User::LeaveIfError( err );
+    // on termination/death of this thread, it will call RunL
+    iDeleteOperation.Logon( iStatus );
+    // let's start the thread
+    iDeleteOperation.Resume();
+    // set the internal state as both is running
+    iState = EProcOnDialogOn;
+    
+    APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::StartDeleteOperationThreadL")
+    }
+
+
+
+
+
+// ---------------------------------------------------------
+// CApSettingsDeleteOperation::StarTransactionLC
+// ---------------------------------------------------------
+//
+TBool CApSettingsDeleteOperation::StartTransactionLC( CCommsDatabase* aDb,
+                                                      TBool aWrite, 
+                                                      TBool aRetry /*ETrue*/ )
+    {
+    APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::StartTransactionLC")
+    
+    TBool retval( EFalse );
+    if ( !aDb->InTransaction() )
+        {
+        TInt retriesLeft( aRetry ? KRetryCount : 1 );
+        TInt err = aDb->BeginTransaction();
+        while ( ( err == KErrLocked ) && --retriesLeft )
+            {
+            User::After( KRetryWait );
+            err = aDb->BeginTransaction();
+            if (aWrite )
+                {
+                TRAP_IGNORE( GetWriteLockL( aDb ) );
+                }
+            }
+        if ( err )
+            {
+            ShowNoteL( R_APUI_VIEW_TEXT_CANNOT_ACCESS_DB );
+            }
+        User::LeaveIfError( err );
+        CleanupStack::PushL( TCleanupItem( RollbackTransactionOnLeave, aDb ) );
+        retval = ETrue;
+        }
+    else
+        {
+        retval = EFalse;
+        }
+        
+    APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::StartTransactionLC")
+    return retval;
+    }
+
+
+// ---------------------------------------------------------
+// CApSettingsDeleteOperation::GetWriteLockL
+// ---------------------------------------------------------
+//
+void CApSettingsDeleteOperation::GetWriteLockL( CCommsDatabase* aDb )
+    {
+    APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::GetWriteLockL")
+    
+    CCommsDbTableView* v = aDb->OpenTableLC( TPtrC(WAP_ACCESS_POINT ) );
+    TUint32 aDummyUid( KApNoneUID );
+    TInt err = v->InsertRecord( aDummyUid );
+    User::LeaveIfError( err );
+    v->CancelRecordChanges();
+    User::LeaveIfError( err );
+    CleanupStack::PopAndDestroy(); // v
+    
+    APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::GetWriteLockL")
+    }
+
+// ---------------------------------------------------------
+// CApSettingsDeleteOperation::RollbackTransactionOnLeave
+// ---------------------------------------------------------
+//
+void CApSettingsDeleteOperation::RollbackTransactionOnLeave( TAny* aDb )
+    {
+    APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::RollbackTransactionOnLeave")
+    
+    CCommsDatabase* db = STATIC_CAST( CCommsDatabase*, aDb );
+    db->RollbackTransaction();
+    
+    APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::RollbackTransactionOnLeave")
+    }
+
+
+// ---------------------------------------------------------
+// CApSettingsDeleteOperation::ReadUintL
+// ---------------------------------------------------------
+//
+TInt CApSettingsDeleteOperation::ReadUintL( CCommsDbTableView* atable,
+                                            const TDesC& aColumn,
+                                            TUint32& aValue )
+    {
+    APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::ReadUintL")
+    
+    __ASSERT_DEBUG( (atable), Panic( ENullPointer ) ) ;
+    TRAPD( err, atable->ReadUintL( aColumn, aValue ) );
+    if ( err != KErrNone )
+        { // do not leave if readed value is not present in table...
+        if ( err != KErrUnknown )
+            User::Leave( err );
+        }
+    
+    APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::ReadUintL")
+    return err;
+    }
+
+
+// ---------------------------------------------------------
+// CApSettingsDeleteOperation::SetNoteTextL
+// ---------------------------------------------------------
+//
+void CApSettingsDeleteOperation::SetNoteTextL( const TDesC& aNoteText )
+    {
+    APSETUILOGGER_ENTERFN( EDelete,"DeleteOp::SetNoteTextL")
+    
+    delete iNoteText;
+    iNoteText = NULL; // must NULL it to satisfy CodeScanner...
+    iNoteText = aNoteText.AllocL();
+    
+    APSETUILOGGER_LEAVEFN( EDelete,"DeleteOp::SetNoteTextL")
+    }
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/src/apsettingshandlerui.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,839 @@
+/*
+* Copyright (c) 2002 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 the main handler, CApSettingsHandler and public API for 
+*       the Access Point settings.
+*
+*/
+
+
+// INCLUDE FILES
+#include <ActiveApDb.h>
+
+#include "ApSettingsHandlerUI.h"
+#include "ApsettingshandleruiImpl.h"
+#include "ApSettingsHandlerLogger.h"
+#include <data_caging_path_literals.hrh>
+
+
+// UID of general settings app, in which help texts are included
+const   TUid    KHelpUidApSettingsHandler = { 0x100058EC };
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CApSettingsHandler::NewLC
+// ---------------------------------------------------------
+//
+EXPORT_C CApSettingsHandler* CApSettingsHandler::NewLC(
+                                         TBool aStartWithSelection,
+                                         TSelectionListType aListType,
+                                         TSelectionMenuType aSelMenuType,
+                                         TInt aIspFilter,
+                                         TInt aBearerFilter,
+                                         TInt aSortType )
+    {
+    APSETUILOGGER_CREATE;
+    APSETUILOGGER_ENTERFN( EAPI,"Handler::NewLC")
+    
+    CApSettingsHandler* db = 
+            new( ELeave ) CApSettingsHandler( aStartWithSelection,
+                                              aListType,
+                                              aSelMenuType );
+    CleanupStack::PushL( db );
+
+    
+
+    db->ConstructL( aIspFilter, aBearerFilter, aSortType );
+    
+    APSETUILOGGER_LEAVEFN( EAPI,"Handler::NewLC")
+    
+    return db;
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CApSettingsHandler::NewLC
+// ---------------------------------------------------------
+//
+EXPORT_C CApSettingsHandler* CApSettingsHandler::NewLC(
+                                            CActiveApDb& aDb,
+                                            TBool aStartWithSelection,
+                                            TSelectionListType aListType,
+                                            TSelectionMenuType aSelMenuType,
+                                            TInt aIspFilter,
+                                            TInt aBearerFilter,
+                                            TInt aSortType
+                                            )
+    {
+    APSETUILOGGER_CREATE;
+    APSETUILOGGER_ENTERFN( EAPI,"Handler::NewLC2")
+    
+    CApSettingsHandler* db = 
+            new( ELeave ) CApSettingsHandler( aStartWithSelection,
+                                              aListType,
+                                              aSelMenuType );
+    CleanupStack::PushL( db );
+
+    db->ConstructL( aDb, aIspFilter, aBearerFilter, aSortType );
+    
+    APSETUILOGGER_LEAVEFN( EAPI,"Handler::NewLC2")
+    
+    return db;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsHandler::NewLC
+// ---------------------------------------------------------
+//
+EXPORT_C CApSettingsHandler* CApSettingsHandler::NewLC(
+                                         TBool aStartWithSelection,
+                                         TSelectionListType aListType,
+                                         TSelectionMenuType aSelMenuType,
+                                         TInt aIspFilter,
+                                         TInt aBearerFilter,
+                                         TInt aSortType,
+                                         TInt aReqIpvType
+                                         )
+    {
+    APSETUILOGGER_CREATE;
+    APSETUILOGGER_ENTERFN( EAPI,"Handler::NewLC3")
+    
+    CApSettingsHandler* db = 
+        new( ELeave ) CApSettingsHandler( aStartWithSelection,
+                                          aListType,
+                                          aSelMenuType,
+                                          aReqIpvType
+                                          );
+    CleanupStack::PushL( db );
+
+    db->ConstructL( aIspFilter, aBearerFilter, aSortType );
+    
+    APSETUILOGGER_LEAVEFN( EAPI,"Handler::NewLC3")
+    
+    return db;
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CApSettingsHandler::NewLC
+// ---------------------------------------------------------
+//
+EXPORT_C CApSettingsHandler* CApSettingsHandler::NewLC(
+                                            CActiveApDb& aDb,
+                                            TBool aStartWithSelection,
+                                            TSelectionListType aListType,
+                                            TSelectionMenuType aSelMenuType,
+                                            TInt aIspFilter,
+                                            TInt aBearerFilter,
+                                            TInt aSortType,
+                                            TInt aReqIpvType
+                                            )
+    {
+    APSETUILOGGER_CREATE;
+    APSETUILOGGER_ENTERFN( EAPI,"Handler::NewLC4")
+    
+    CApSettingsHandler* db = 
+        new( ELeave ) CApSettingsHandler( aStartWithSelection,
+                                          aListType,
+                                          aSelMenuType,
+                                          aReqIpvType
+                                          );
+    CleanupStack::PushL( db );
+
+    db->ConstructL( aDb, aIspFilter, aBearerFilter, aSortType );
+    
+    APSETUILOGGER_LEAVEFN( EAPI,"Handler::NewLC4")
+    
+    return db;
+    }
+
+
+
+
+
+// ---------------------------------------------------------
+// CApSettingsHandler::NewLC
+// ---------------------------------------------------------
+//
+EXPORT_C CApSettingsHandler* CApSettingsHandler::NewLC(
+                                        TBool aStartWithSelection,
+                                        TSelectionListType aListType,
+                                        TSelectionMenuType aSelMenuType,
+                                        TInt aIspFilter,
+                                        TInt aBearerFilter,
+                                        TInt aSortType,
+                                        TInt aReqIpvType,
+                                        TVpnFilterType aVpnFilterType
+                                            )
+    {
+    APSETUILOGGER_CREATE;
+    APSETUILOGGER_ENTERFN( EAPI,"Handler::NewLC5")
+
+    CApSettingsHandler* db = 
+        new( ELeave ) CApSettingsHandler( aStartWithSelection,
+                                          aListType,
+                                          aSelMenuType,
+                                          aReqIpvType
+                                          );
+    CleanupStack::PushL( db );
+
+    db->ConstructL( aIspFilter, aBearerFilter, 
+                    aSortType, aVpnFilterType );
+    
+    APSETUILOGGER_LEAVEFN( EAPI,"Handler::NewLC5")
+    
+    return db;
+    }
+
+
+// ---------------------------------------------------------
+// CApSettingsHandler::NewLC
+// ---------------------------------------------------------
+//
+EXPORT_C CApSettingsHandler* CApSettingsHandler::NewLC(
+                                            CActiveApDb& aDb,
+                                            TBool aStartWithSelection,
+                                            TSelectionListType aListType,
+                                            TSelectionMenuType aSelMenuType,
+                                            TInt aIspFilter,
+                                            TInt aBearerFilter,
+                                            TInt aSortType,
+                                            TInt aReqIpvType,
+                                            TVpnFilterType aVpnFilterType
+                                            )
+    {
+    APSETUILOGGER_CREATE;
+    APSETUILOGGER_ENTERFN( EAPI,"Handler::NewLC6")
+    
+    CApSettingsHandler* db = 
+        new( ELeave ) CApSettingsHandler( aStartWithSelection,
+                                          aListType,
+                                          aSelMenuType,
+                                          aReqIpvType
+                                          );
+    CleanupStack::PushL( db );
+    
+    db->ConstructL( aDb, aIspFilter, aBearerFilter, 
+                    aSortType, aVpnFilterType );
+    
+    APSETUILOGGER_LEAVEFN( EAPI,"Handler::NewLC6")
+    
+    return db;
+    }
+
+
+
+
+
+
+// ---------------------------------------------------------
+// CApSettingsHandler::NewLC
+// ---------------------------------------------------------
+//
+EXPORT_C CApSettingsHandler* CApSettingsHandler::NewLC(
+                                        CActiveApDb& aDb,
+                                        TBool aStartWithSelection,
+                                        TSelectionListType aListType,
+                                        TSelectionMenuType aSelMenuType,
+                                        TInt aIspFilter,
+                                        TInt aBearerFilter,
+                                        TInt aSortType,
+                                        TInt aReqIpvType,
+                                        TVpnFilterType aVpnFilterType,
+                                        TBool aIncludeEasyWlan
+                                        )
+    {
+    APSETUILOGGER_CREATE;
+    APSETUILOGGER_ENTERFN( EAPI,"Handler::NewLC7")
+    
+    CApSettingsHandler* db = 
+        new( ELeave ) CApSettingsHandler( aStartWithSelection,
+                                          aListType,
+                                          aSelMenuType,
+                                          aReqIpvType
+                                          );
+    CleanupStack::PushL( db );
+    
+    db->ConstructL( aDb, aIspFilter, aBearerFilter, 
+                    aSortType, aVpnFilterType, aIncludeEasyWlan );
+    
+    APSETUILOGGER_LEAVEFN( EAPI,"Handler::NewLC7")
+    return db;    
+    }
+
+
+// Destructor
+EXPORT_C CApSettingsHandler::~CApSettingsHandler()
+    {
+    APSETUILOGGER_DELETE;
+
+    APSETUILOGGER_WRITE( EAPI,"Handler:: deleting implementation");
+    
+    delete iImpl;
+    
+    APSETUILOGGER_WRITE( EAPI,"Handler::~finished");
+    }
+
+
+
+// Constructor
+EXPORT_C CApSettingsHandler::CApSettingsHandler( TBool aStartWithSelection,
+                                                TSelectionListType aListType,
+                                                TSelectionMenuType aSelMenuType
+                                                )
+:iStartWithSelection( aStartWithSelection ),
+iListType( aListType ),
+iSelMenuType( aSelMenuType ),
+iIspFilter( KEApIspTypeAll ),
+iBearerFilter( EApBearerTypeAll ),
+iReqIpvType( EIPv4 ),
+iEventStore( KApUiEventNone )
+    {
+    iHelpMajor = KHelpUidApSettingsHandler;
+    }
+
+
+
+
+
+// Constructor
+CApSettingsHandler::CApSettingsHandler( TBool aStartWithSelection,
+                                        TSelectionListType aListType,
+                                        TSelectionMenuType aSelMenuType,
+                                        TInt aReqIpvType
+                                        )
+:iStartWithSelection( aStartWithSelection ),
+iListType( aListType ),
+iSelMenuType( aSelMenuType ),
+iIspFilter( KEApIspTypeAll ),
+iBearerFilter( EApBearerTypeAll ),
+iReqIpvType( aReqIpvType ),
+iEventStore( KApUiEventNone )
+    {
+    iHelpMajor = KHelpUidApSettingsHandler;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsHandler::ConstructL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApSettingsHandler::ConstructL(   TInt aIspFilter,
+                                                TInt aBearerFilter,
+                                                TInt aSortType )
+    {
+    APSETUILOGGER_ENTERFN( EAPI,"Handler::ConstructL")
+    
+    DoConstructL( NULL, aIspFilter, aBearerFilter, 
+                  aSortType, EVpnFilterBoth, EFalse );
+    
+    APSETUILOGGER_LEAVEFN( EAPI,"Handler::ConstructL")
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsHandler::ConstructL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApSettingsHandler::ConstructL(   CActiveApDb& aDb,
+                                                TInt aIspFilter,
+                                                TInt aBearerFilter,
+                                                TInt aSortType )
+    {
+    APSETUILOGGER_ENTERFN( EAPI,"Handler::ConstructL2")
+    
+    DoConstructL( &aDb, aIspFilter, aBearerFilter, 
+                  aSortType, EVpnFilterBoth, EFalse );
+    
+    APSETUILOGGER_LEAVEFN( EAPI,"Handler::ConstructL2")
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsHandler::ConstructL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApSettingsHandler::ConstructL(   
+                                             TInt aIspFilter,
+                                             TInt aBearerFilter,
+                                             TInt aSortType,
+                                             TVpnFilterType aVpnFilterType
+                                            )
+    {
+    APSETUILOGGER_ENTERFN( EAPI,"Handler::ConstructL3")
+    
+    DoConstructL( NULL, aIspFilter, aBearerFilter, 
+                  aSortType, aVpnFilterType, EFalse );
+    
+    APSETUILOGGER_LEAVEFN( EAPI,"Handler::ConstructL3")
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsHandler::ConstructL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApSettingsHandler::ConstructL(
+                                             CActiveApDb& aDb,
+                                             TInt aIspFilter,
+                                             TInt aBearerFilter,
+                                             TInt aSortType,
+                                             TVpnFilterType aVpnFilterType
+                                             )
+    {
+    APSETUILOGGER_ENTERFN( EAPI,"Handler::ConstructL4")
+    
+    DoConstructL( &aDb, aIspFilter, aBearerFilter, 
+                  aSortType, aVpnFilterType, EFalse );
+    
+    APSETUILOGGER_LEAVEFN( EAPI,"Handler::ConstructL4")
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CApSettingsHandler::ConstructL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApSettingsHandler::ConstructL(
+                                        CActiveApDb& aDb,
+                                        TInt aIspFilter,
+                                        TInt aBearerFilter,
+                                        TInt aSortType,
+                                        TVpnFilterType aVpnFilterType,
+                                        TBool aIncludeEasyWlan
+                                        )
+    {
+    APSETUILOGGER_ENTERFN( EAPI,"Handler::ConstructL5")
+    
+    DoConstructL( &aDb, aIspFilter, aBearerFilter, 
+                  aSortType, aVpnFilterType, aIncludeEasyWlan );
+    
+    APSETUILOGGER_LEAVEFN( EAPI,"Handler::ConstructL5")
+    }
+
+
+// ---------------------------------------------------------
+// CApSettingsHandler::SetFilter
+// ---------------------------------------------------------
+//
+EXPORT_C void CApSettingsHandler::SetFilterL(   TInt aIspFilter,
+                                                TInt aBearerFilter,
+                                                TInt aSortType )
+    {
+    APSETUILOGGER_ENTERFN( EAPI,"Handler::SetFilterL")
+    
+    iImpl->SetFilterL( aIspFilter, aBearerFilter, aSortType ); 
+    
+    APSETUILOGGER_LEAVEFN( EAPI,"Handler::SetFilterL")   
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CApSettingsHandler::SetTextOverrideL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApSettingsHandler::SetTextOverrideL( TTextID aText2Change,
+                                                    const TDesC& aNewText )
+    {
+    APSETUILOGGER_ENTERFN( EAPI,"Handler::SetTextOverrideL")
+    
+    __ASSERT_DEBUG( iImpl, Panic( ENullPointer ) );
+    iImpl->SetTextOverrideL( aText2Change, aNewText );
+    
+    APSETUILOGGER_LEAVEFN( EAPI,"Handler::SetTextOverrideL")
+    }
+
+
+// ---------------------------------------------------------
+// CApSettingsHandler::TextOverrideL
+// ---------------------------------------------------------
+//
+EXPORT_C const TDesC& CApSettingsHandler::TextOverrideL( TTextID aTextId )
+    {
+    APSETUILOGGER_ENTERFN( EAPI,"Handler::TextOverrideL<->")
+    
+    __ASSERT_DEBUG( iImpl, Panic( ENullPointer ) );
+    return iImpl->TextOverrideL( aTextId );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsHandler::RunSettingsL
+// ---------------------------------------------------------
+//
+EXPORT_C TInt CApSettingsHandler::RunSettingsL( TUint32 aHighLight,
+                                                TUint32& aSelected )
+    {
+    APSETUILOGGER_ENTERFN( EAPI,"Handler::RunSettingsL")
+    
+    iImpl->RunSettingsL( aHighLight, aSelected );
+    
+    APSETUILOGGER_LEAVEFN( EAPI,"Handler::RunSettingsL")
+    
+    return iImpl->EventStore();
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsHandler::Cvt()
+// ---------------------------------------------------------
+//
+EXPORT_C TInt CApSettingsHandler::Cvt()
+    {
+    APSETUILOGGER_ENTERFN( EAPI,"Handler::Cvt<->")
+    return KErrNone;
+    }
+
+
+// ---------------------------------------------------------
+// CApSettingsHandler::DoRunSettingsL
+// ---------------------------------------------------------
+//
+TInt CApSettingsHandler::DoRunSettingsL( TUint32 /*aHighLight*/,
+                                         TUint32& /*aSelected*/ )
+    {
+    APSETUILOGGER_ENTERFN( EAPI,"Handler::DoRunSettingsL@Deprecated")
+    
+    //  Deprecated as moved to iImpl
+    __ASSERT_DEBUG( EFalse, Panic( ENullPointer ) );
+    User::Leave(KErrNotSupported);
+    return KErrNone;
+    }
+
+
+// ---------------------------------------------------------
+// CApSettingsHandler::RunViewerL
+// ---------------------------------------------------------
+//
+EXPORT_C TInt CApSettingsHandler::RunViewerL( TUint32 aUid )
+    {
+    APSETUILOGGER_ENTERFN( EAPI,"Handler::RunViewerL")
+    
+    iImpl->RunViewerL( aUid );    
+    
+    APSETUILOGGER_LEAVEFN( EAPI,"Handler::RunViewerL")
+    
+    return iImpl->EventStore();
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsHandler::DoRunViewerL
+// ---------------------------------------------------------
+//
+TInt CApSettingsHandler::DoRunViewerL( TUint32 /*aUid*/ )
+    {
+    APSETUILOGGER_ENTERFN( EAPI,"Handler::DoRunViewerL@Deprecated")
+    
+    //  Deprecated as moved to iImpl
+    __ASSERT_DEBUG( EFalse, Panic( ENullPointer ) );
+    User::Leave(KErrNotSupported);
+    return KErrNone;
+    }
+
+
+
+//----------------------------------------------------------
+// CApSettingsHandler::HandleApDeleteCmdL
+//----------------------------------------------------------
+//
+void CApSettingsHandler::HandleApDeleteCmdL( TUint32 /*aUid*/, 
+                                             TBool /*aIsLast*/ )
+    {
+    APSETUILOGGER_ENTERFN( EAPI,"Handler::HandleApDeleteCmdL@Deprecated")
+    
+    //  Deprecated as moved to iImpl
+    __ASSERT_DEBUG( EFalse, Panic( ENullPointer ) );
+    User::Leave(KErrNotSupported);
+    }
+
+
+//----------------------------------------------------------
+// CApSettingsHandler::HandleApBlankNewL
+//----------------------------------------------------------
+//
+TUint32 CApSettingsHandler::HandleApBlankNewL( TInt /*aBearers*/, 
+                                               TInt /*aIsps*/ )
+    {
+    APSETUILOGGER_ENTERFN( EAPI,"Handler::HandleApBlankNewL@Deprecated")
+    
+    //  Deprecated as moved to iImpl
+    __ASSERT_DEBUG( EFalse, Panic( ENullPointer ) );
+    User::Leave(KErrNotSupported);
+    return KErrNone;
+    }
+
+
+
+//----------------------------------------------------------
+// CApSettingsHandler::HandleApUseOldNewL
+//----------------------------------------------------------
+//
+TUint32 CApSettingsHandler::HandleApUseOldNewL()
+    {
+    APSETUILOGGER_ENTERFN( EAPI,"Handler::HandleApUseOldNewL@Deprecated")
+    
+    //  Deprecated as moved to iImpl
+    __ASSERT_DEBUG( EFalse, Panic( ENullPointer ) );
+    User::Leave(KErrNotSupported);
+    return KErrNone;
+    }
+
+
+
+//----------------------------------------------------------
+// CApSettingsHandler::EditAfterCreateL
+//----------------------------------------------------------
+//
+TUint32 CApSettingsHandler::EditAfterCreateL( TUint32 /*aUid*/,
+                                              CApAccessPointItem* /*aItem*/ )
+    {
+    APSETUILOGGER_ENTERFN( EAPI,"Handler::EditAfterCreateL@Deprecated")
+    
+    //  Deprecated as moved to iImpl
+    __ASSERT_DEBUG( EFalse, Panic( ENullPointer ) );
+    User::Leave(KErrNotSupported);
+    return KErrNone;  
+    }
+
+
+
+//----------------------------------------------------------
+// CApSettingsHandler::DoConstructL
+//----------------------------------------------------------
+//
+void CApSettingsHandler::DoConstructL( CActiveApDb* aDb,
+                                       TInt aIspFilter,
+                                       TInt aBearerFilter,
+                                       TInt aSortType,
+                                       TVpnFilterType aVpnFilterType,
+                                       TBool aIncludeEasyWlan )
+    {
+    APSETUILOGGER_ENTERFN( EAPI,"Handler::DoConstructL")
+    
+    // must place it to a temp variable, otherwise CodeScanner reports 
+    // it as a bad practice putting up member to Cleanupstack, but 
+    // we have NO NewL so we must use this.
+    CApSettingsHandlerImpl* tmp = CApSettingsHandlerImpl::NewLC( 
+                                           *aDb, iStartWithSelection,
+                                           iListType, iSelMenuType,
+                                           aIspFilter, aBearerFilter, 
+                                           aSortType, iReqIpvType,
+                                           aVpnFilterType, aIncludeEasyWlan,
+                                           ETrue );
+    CleanupStack::Pop(tmp);   // will soon be a member, need to pop
+    iImpl = tmp;                                           
+    
+    APSETUILOGGER_LEAVEFN( EAPI,"Handler::DoConstructL")
+    }
+
+
+
+
+//----------------------------------------------------------
+// CApSettingsHandler::DoRunSetPageSettingsL
+//----------------------------------------------------------
+//
+void CApSettingsHandler::DoRunSetPageSettingsL( TUint32 /*aHighLight*/,
+                                                TUint32& /*aSelected*/ )
+    {
+    APSETUILOGGER_ENTERFN( EAPI,"Handler::DoRunSetPageSettingsL@Deprecated")
+    
+    //  Deprecated as moved to iImpl
+    __ASSERT_DEBUG( EFalse, Panic( ENullPointer ) );
+    User::Leave(KErrNotSupported);
+    }
+
+
+
+//----------------------------------------------------------
+// CApSettingsHandler::DoRunListSettingsL
+//----------------------------------------------------------
+//
+void CApSettingsHandler::DoRunListSettingsL( TUint32 /*aHighLight*/,
+                                             TUint32& /*aSelected*/ )
+    {
+    APSETUILOGGER_ENTERFN( EAPI,"Handler::DoRunListSettingsL@Deprecated")
+    
+    //  Deprecated as moved to iImpl
+    __ASSERT_DEBUG( EFalse, Panic( ENullPointer ) );
+    User::Leave(KErrNotSupported);
+    }
+
+
+
+//----------------------------------------------------------
+// CApSettingsHandler::DoHandleApUseOldNewL
+//----------------------------------------------------------
+//
+TUint32 CApSettingsHandler::DoHandleApUseOldNewL( TUint32 /*aSelected*/ )
+    {
+    APSETUILOGGER_ENTERFN( EAPI,"Handler::DoHandleApUseOldNewL@Deprecated")
+    
+    //  Deprecated as moved to iImpl
+    __ASSERT_DEBUG( EFalse, Panic( ENullPointer ) );
+    User::Leave(KErrNotSupported);
+    return KErrNone;
+    }
+
+
+
+//----------------------------------------------------------
+// CApSettingsHandler::SelectApToCopyL
+//----------------------------------------------------------
+//
+TUint32 CApSettingsHandler::SelectApToCopyL()
+    {
+    APSETUILOGGER_ENTERFN( EAPI,"Handler::SelectApToCopyL@Deprecated")
+    
+    //  Deprecated as moved to iImpl
+    __ASSERT_DEBUG( EFalse, Panic( ENullPointer ) );
+    User::Leave(KErrNotSupported);
+    return KErrNone;
+    }
+
+
+
+//----------------------------------------------------------
+// CApSettingsHandler::DoHandleApBlankNewL
+//----------------------------------------------------------
+//
+TUint32 CApSettingsHandler::DoHandleApBlankNewL( TInt /*aBearers*/, TInt /*aIsps*/ )
+    {
+    APSETUILOGGER_ENTERFN( EAPI,"Handler::DoHandleApBlankNewL@Deprecated")
+    
+    //  Deprecated as moved to iImpl
+    __ASSERT_DEBUG( EFalse, Panic( ENullPointer ) );
+    User::Leave(KErrNotSupported);
+    return KErrNone;
+    }
+
+
+
+
+//----------------------------------------------------------
+// CApSettingsHandler::HandleNetworkDeleteCmdL
+//----------------------------------------------------------
+//
+void CApSettingsHandler::HandleNetworkDeleteCmdL( TUint32 /*aUid*/ )
+    {
+    APSETUILOGGER_ENTERFN( EAPI,"Handler::HandleNetworkDeleteCmdL@Deprecated")
+    
+    //  Deprecated as moved to iImpl
+    __ASSERT_DEBUG( EFalse, Panic( ENullPointer ) );
+    User::Leave(KErrNotSupported);
+    }
+
+
+
+//----------------------------------------------------------
+// CApSettingsHandler::GetVariantL
+//----------------------------------------------------------
+//
+TInt CApSettingsHandler::GetVariantL()
+    {
+    APSETUILOGGER_ENTERFN( EAPI,"Handler::GetVariantL@Deprecated")
+    
+    //  Deprecated as moved to iImpl
+    __ASSERT_DEBUG( EFalse, Panic( ENullPointer ) );
+    User::Leave(KErrNotSupported);
+    return KErrNone;
+    }
+
+
+//----------------------------------------------------------
+// CApSettingsHandler::ConfirmDeleteL
+//----------------------------------------------------------
+//
+TInt CApSettingsHandler::ConfirmDeleteL( TUint32 /*aUid*/, TBool /*aIsLast*/ )
+    {
+    APSETUILOGGER_ENTERFN( EAPI,"Handler::ConfirmDeleteL@Deprecated")
+    
+    //  Deprecated as moved to iImpl
+    __ASSERT_DEBUG( EFalse, Panic( ENullPointer ) );
+    User::Leave(KErrNotSupported);
+    return KErrNone;
+    }
+
+
+
+//----------------------------------------------------------
+// CApSettingsHandler::HandleRunSettingsL
+//----------------------------------------------------------
+//
+void CApSettingsHandler::HandleRunSettingsL( TUint32 /*aHighLight*/, 
+                                             TUint32& /*aSelected*/ )
+    {
+    APSETUILOGGER_ENTERFN( EAPI,"Handler::HandleRunSettingsL@Deprecated")
+    
+    //  Deprecated as moved to iImpl
+    __ASSERT_DEBUG( EFalse, Panic( ENullPointer ) );
+    User::Leave(KErrNotSupported);
+    }
+
+
+
+//----------------------------------------------------------
+// CApSettingsHandler::ChooseBearerTypeL
+//----------------------------------------------------------
+//
+void CApSettingsHandler::ChooseBearerTypeL( TInt /*aBearers*/, 
+                                            CApAccessPointItem& /*aItem*/ )
+    {
+    APSETUILOGGER_ENTERFN( EAPI,"Handler::ChooseBearerTypeL@Deprecated")
+    
+    //  Deprecated as moved to iImpl
+    __ASSERT_DEBUG( EFalse, Panic( ENullPointer ) );
+    User::Leave(KErrNotSupported);
+    }
+
+
+
+
+//----------------------------------------------------------
+// CApSettingsHandler::HandleDuplicateL
+//----------------------------------------------------------
+//
+TUint32 CApSettingsHandler::HandleDuplicateL( TUint32 /*aUid*/ )
+    {
+    APSETUILOGGER_ENTERFN( EAPI,"Handler::HandleDuplicateL@Deprecated")
+    
+    //  Deprecated as moved to iImpl
+    __ASSERT_DEBUG( EFalse, Panic( ENullPointer ) );    
+    User::Leave(KErrNotSupported);
+    return KErrNone;
+    }
+
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/src/apsettingshandleruiImpl.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,2020 @@
+/*
+* Copyright (c) 2002 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 the main handler, CApSettingsHandlerImpl for 
+*       the Access Point settings.
+*
+*/
+
+
+// INCLUDE FILES
+#include "APSettingsHandlerUIVariant.hrh"
+
+#include <bautils.h>
+#include <StringLoader.h>
+#include <ApSetUI.rsg>
+#include <ActiveApDb.h>
+
+#include "ApsettingshandleruiImpl.h"
+#include "ApSettingsHandlerUI.hrh"
+#include "ApSelectorDialog.h"
+
+#include "ApSettingsDlg.h"
+
+#include "TextOverrides.h"
+#include "ApSettingsModel.h"
+#include "ApSelPopupList.h"
+#include "ApSelQueryDialog.h"
+
+#include <aknnotedialog.h>
+#include <ApListItemList.h>
+
+#include <f32file.h>
+
+#include "ApSettingsHandlerLogger.h"
+#include <ApSettingsHandlerCommons.h>
+
+
+#include "ApSettingsHandlerUiPrivateCRKeys.h"
+#include <centralrepository.h>
+
+#include <sysutil.h>
+
+#include <ApNetworkItem.h>
+
+#include <featmgr.h>
+#include <VpnApEngine.h>
+
+#include <data_caging_path_literals.hrh>
+
+#include <shareddataclient.h>
+
+// UID of general settings app, in which help texts are included
+const   TUid    KHelpUidApSettingsHandler = { 0x100058EC };
+
+
+//#define __TEST_PERFORMANCE
+/// ROM drive.
+_LIT( KApSettingsResDriveZ, "z:" );
+/// Access point settings handler UI resource file name.
+_LIT( KApSettingsResFileName, "apsetui.rsc" );
+
+
+
+/// Estimated FFS overhead for deleting (in bytes).
+LOCAL_C const TInt KEstimatedDeleteFfsOverhead = 48 * 1024;
+
+
+
+//KFeatureIdIPv6
+// #define KFeatureIdIPv6 KOtherFeatureFirst+88
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CApSettingsHandlerImpl::NewLC
+// ---------------------------------------------------------
+//
+CApSettingsHandlerImpl* CApSettingsHandlerImpl::NewLC(
+                                         TBool aStartWithSelection,
+                                         TSelectionListType aListType,
+                                         TSelectionMenuType aSelMenuType,
+                                         TInt aIspFilter,
+                                         TInt aBearerFilter,
+                                         TInt aSortType,
+                                         TBool aNoEdit )
+    {
+    APSETUILOGGER_CREATE;
+    
+    CApSettingsHandlerImpl* db = 
+            new( ELeave ) CApSettingsHandlerImpl( aStartWithSelection,
+                                              aListType,
+                                              aSelMenuType,
+                                              aNoEdit );
+    CleanupStack::PushL( db );
+
+    db->ConstructL( aIspFilter, aBearerFilter, aSortType );
+    
+    APSETUILOGGER_LEAVEFN( EApImpl,"Impl::NewLC")
+    
+    return db;
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CApSettingsHandlerImplImpl::NewLC
+// ---------------------------------------------------------
+//
+CApSettingsHandlerImpl* CApSettingsHandlerImpl::NewLC(
+                                            CActiveApDb& aDb,
+                                            TBool aStartWithSelection,
+                                            TSelectionListType aListType,
+                                            TSelectionMenuType aSelMenuType,
+                                            TInt aIspFilter,
+                                            TInt aBearerFilter,
+                                            TInt aSortType,
+                                            TBool aNoEdit
+                                            )
+    {
+    APSETUILOGGER_CREATE;
+
+    CApSettingsHandlerImpl* db = 
+            new( ELeave ) CApSettingsHandlerImpl( aStartWithSelection,
+                                              aListType,
+                                              aSelMenuType,
+                                              aNoEdit );
+    CleanupStack::PushL( db );
+
+    db->ConstructL( aDb, aIspFilter, aBearerFilter, aSortType );
+    
+    APSETUILOGGER_LEAVEFN( EApImpl,"Impl::NewLC2")
+    
+    return db;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsHandlerImpl::NewLC
+// ---------------------------------------------------------
+//
+CApSettingsHandlerImpl* CApSettingsHandlerImpl::NewLC(
+                                         TBool aStartWithSelection,
+                                         TSelectionListType aListType,
+                                         TSelectionMenuType aSelMenuType,
+                                         TInt aIspFilter,
+                                         TInt aBearerFilter,
+                                         TInt aSortType,
+                                         TInt aReqIpvType,
+                                         TBool aNoEdit
+                                         )
+    {
+    APSETUILOGGER_CREATE;
+    
+    CApSettingsHandlerImpl* db = 
+        new( ELeave ) CApSettingsHandlerImpl( aStartWithSelection,
+                                          aListType,
+                                          aSelMenuType,
+                                          aReqIpvType,
+                                          aNoEdit
+                                          );
+    CleanupStack::PushL( db );
+    
+    db->ConstructL( aIspFilter, aBearerFilter, aSortType );
+    
+    APSETUILOGGER_LEAVEFN( EApImpl,"Impl::NewLC3")
+    
+    return db;
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CApSettingsHandlerImpl::NewLC
+// ---------------------------------------------------------
+//
+CApSettingsHandlerImpl* CApSettingsHandlerImpl::NewLC(
+                                            CActiveApDb& aDb,
+                                            TBool aStartWithSelection,
+                                            TSelectionListType aListType,
+                                            TSelectionMenuType aSelMenuType,
+                                            TInt aIspFilter,
+                                            TInt aBearerFilter,
+                                            TInt aSortType,
+                                            TInt aReqIpvType,
+                                            TBool aNoEdit
+                                            )
+    {
+    APSETUILOGGER_CREATE;
+    
+    CApSettingsHandlerImpl* db = 
+        new( ELeave ) CApSettingsHandlerImpl( aStartWithSelection,
+                                          aListType,
+                                          aSelMenuType,
+                                          aReqIpvType,
+                                          aNoEdit
+                                          );
+    CleanupStack::PushL( db );
+
+    db->ConstructL( aDb, aIspFilter, aBearerFilter, aSortType );
+    
+    APSETUILOGGER_LEAVEFN( EApImpl,"Impl::NewLC4")
+    
+    return db;
+    }
+
+
+
+
+
+// ---------------------------------------------------------
+// CApSettingsHandlerImpl::NewLC
+// ---------------------------------------------------------
+//
+CApSettingsHandlerImpl* CApSettingsHandlerImpl::NewLC(
+                                        TBool aStartWithSelection,
+                                        TSelectionListType aListType,
+                                        TSelectionMenuType aSelMenuType,
+                                        TInt aIspFilter,
+                                        TInt aBearerFilter,
+                                        TInt aSortType,
+                                        TInt aReqIpvType,
+                                        TVpnFilterType aVpnFilterType,
+                                        TBool aNoEdit
+                                            )
+    {
+    APSETUILOGGER_CREATE;
+    
+    CApSettingsHandlerImpl* db = 
+        new( ELeave ) CApSettingsHandlerImpl( aStartWithSelection,
+                                          aListType,
+                                          aSelMenuType,
+                                          aReqIpvType,
+                                          aNoEdit
+                                          );
+    CleanupStack::PushL( db );
+
+    db->ConstructL( aIspFilter, aBearerFilter, 
+                    aSortType, aVpnFilterType );
+                    
+    APSETUILOGGER_LEAVEFN( EApImpl,"Impl::NewLC5")
+    
+    return db;
+    }
+
+
+// ---------------------------------------------------------
+// CApSettingsHandlerImpl::NewLC
+// ---------------------------------------------------------
+//
+CApSettingsHandlerImpl* CApSettingsHandlerImpl::NewLC(
+                                            CActiveApDb& aDb,
+                                            TBool aStartWithSelection,
+                                            TSelectionListType aListType,
+                                            TSelectionMenuType aSelMenuType,
+                                            TInt aIspFilter,
+                                            TInt aBearerFilter,
+                                            TInt aSortType,
+                                            TInt aReqIpvType,
+                                            TVpnFilterType aVpnFilterType,
+                                            TBool aNoEdit
+                                            )
+    {
+    APSETUILOGGER_CREATE;
+    
+    CApSettingsHandlerImpl* db = 
+        new( ELeave ) CApSettingsHandlerImpl( aStartWithSelection,
+                                          aListType,
+                                          aSelMenuType,
+                                          aReqIpvType,
+                                          aNoEdit
+                                          );
+    CleanupStack::PushL( db );
+
+    db->ConstructL( aDb, aIspFilter, aBearerFilter, 
+                    aSortType, aVpnFilterType );
+    
+    APSETUILOGGER_LEAVEFN( EApImpl,"Impl::NewLC6")
+    
+    return db;
+    }
+
+
+
+
+
+
+// ---------------------------------------------------------
+// CApSettingsHandlerImpl::NewLC
+// ---------------------------------------------------------
+//
+CApSettingsHandlerImpl* CApSettingsHandlerImpl::NewLC(
+                                        CActiveApDb& aDb,
+                                        TBool aStartWithSelection,
+                                        TSelectionListType aListType,
+                                        TSelectionMenuType aSelMenuType,
+                                        TInt aIspFilter,
+                                        TInt aBearerFilter,
+                                        TInt aSortType,
+                                        TInt aReqIpvType,
+                                        TVpnFilterType aVpnFilterType,
+                                        TBool aIncludeEasyWlan,
+                                        TBool aNoEdit
+                                        )
+    {
+    APSETUILOGGER_CREATE;
+    
+    CApSettingsHandlerImpl* db = 
+        new( ELeave ) CApSettingsHandlerImpl( aStartWithSelection,
+                                          aListType,
+                                          aSelMenuType,
+                                          aReqIpvType,
+                                          aNoEdit
+                                          );
+    CleanupStack::PushL( db );
+    db->ConstructL( aDb, aIspFilter, aBearerFilter, 
+                    aSortType, aVpnFilterType, aIncludeEasyWlan );
+    
+    APSETUILOGGER_LEAVEFN( EApImpl,"Impl::NewLC7")
+    
+    return db;    
+    }
+
+
+
+// Destructor
+CApSettingsHandlerImpl::~CApSettingsHandlerImpl()
+    {
+    APSETUILOGGER_DELETE;
+
+    if ( iTextOverrides )
+        {
+        delete iTextOverrides;
+        iTextOverrides = NULL;
+        APSETUILOGGER_WRITE( EAPI,"EApImpl::txtoverrides deleted");
+        }
+    if ( iExt )
+        {
+        if ( iExt->iResOffset )
+            {
+            iModel->EikEnv()->DeleteResourceFile( iExt->iResOffset );
+            APSETUILOGGER_WRITE( EAPI,"EApImpl::Resource file deleted");
+            }
+        if ( iExt->iIsFeatureManagerInitialised )
+            {
+            FeatureManager::UnInitializeLib();
+            APSETUILOGGER_WRITE( EAPI,"EApImpl::FeatMan. uninitialised");
+            }
+        }
+
+    if ( iModel )
+        {
+        delete iModel;
+        iModel = NULL;
+        }
+
+    APSETUILOGGER_WRITE( EAPI,"EApImpl::imodel deleted");
+
+    delete iExt;
+    
+    APSETUILOGGER_WRITE( EAPI,"EApImpl::iext deleted");
+    }
+
+
+// Constructor
+CApSettingsHandlerImpl::CApSettingsHandlerImpl( TBool aStartWithSelection,
+                                                TSelectionListType aListType,
+                                                TSelectionMenuType aSelMenuType,
+                                                TBool aNoEdit
+                                                )
+:iStartWithSelection( aStartWithSelection ),
+iListType( aListType ),
+iSelMenuType( aSelMenuType ),
+iIspFilter( KEApIspTypeAll ),
+iBearerFilter( EApBearerTypeAll ),
+iReqIpvType( EIPv4 ),
+iEventStore( KApUiEventNone ),
+iNoEdit( aNoEdit )
+    {
+    iHelpMajor = KHelpUidApSettingsHandler;
+    }
+
+
+
+
+
+// Constructor
+CApSettingsHandlerImpl::CApSettingsHandlerImpl( TBool aStartWithSelection,
+                                        TSelectionListType aListType,
+                                        TSelectionMenuType aSelMenuType,
+                                        TInt aReqIpvType,
+                                        TBool aNoEdit 
+                                        )
+:iStartWithSelection( aStartWithSelection ),
+iListType( aListType ),
+iSelMenuType( aSelMenuType ),
+iIspFilter( KEApIspTypeAll ),
+iBearerFilter( EApBearerTypeAll ),
+iReqIpvType( aReqIpvType ),
+iEventStore( KApUiEventNone ),
+iNoEdit( aNoEdit )
+    {
+    iHelpMajor = KHelpUidApSettingsHandler;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsHandlerImpl::ConstructL
+// ---------------------------------------------------------
+//
+void CApSettingsHandlerImpl::ConstructL(   TInt aIspFilter,
+                                                TInt aBearerFilter,
+                                                TInt aSortType )
+    {
+    APSETUILOGGER_ENTERFN( EApImpl,"Impl::ConstructL")
+    
+    DoConstructL( NULL, aIspFilter, aBearerFilter, 
+                  aSortType, EVpnFilterBoth, EFalse );
+                  
+    APSETUILOGGER_LEAVEFN( EApImpl,"Impl::ConstructL")
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsHandlerImpl::ConstructL
+// ---------------------------------------------------------
+//
+void CApSettingsHandlerImpl::ConstructL(   CActiveApDb& aDb,
+                                                TInt aIspFilter,
+                                                TInt aBearerFilter,
+                                                TInt aSortType )
+    {
+    APSETUILOGGER_ENTERFN( EApImpl,"Impl::ConstructL2")
+    
+    DoConstructL( &aDb, aIspFilter, aBearerFilter, 
+                  aSortType, EVpnFilterBoth, EFalse );
+
+    APSETUILOGGER_LEAVEFN( EApImpl,"Impl::ConstructL2")    
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsHandlerImpl::ConstructL
+// ---------------------------------------------------------
+//
+void CApSettingsHandlerImpl::ConstructL(   
+                                             TInt aIspFilter,
+                                             TInt aBearerFilter,
+                                             TInt aSortType,
+                                             TVpnFilterType aVpnFilterType
+                                            )
+    {
+    APSETUILOGGER_ENTERFN( EApImpl,"Impl::ConstructL3")
+    
+    DoConstructL( NULL, aIspFilter, aBearerFilter, 
+                  aSortType, aVpnFilterType, EFalse );
+    
+    APSETUILOGGER_LEAVEFN( EApImpl,"Impl::ConstructL3")
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsHandlerImpl::ConstructL
+// ---------------------------------------------------------
+//
+void CApSettingsHandlerImpl::ConstructL(
+                                             CActiveApDb& aDb,
+                                             TInt aIspFilter,
+                                             TInt aBearerFilter,
+                                             TInt aSortType,
+                                             TVpnFilterType aVpnFilterType
+                                             )
+    {
+    APSETUILOGGER_ENTERFN( EApImpl,"Impl::ConstructL4")
+    
+    DoConstructL( &aDb, aIspFilter, aBearerFilter, 
+                  aSortType, aVpnFilterType, EFalse );
+    
+    APSETUILOGGER_LEAVEFN( EApImpl,"Impl::ConstructL4")
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CApSettingsHandlerImpl::ConstructL
+// ---------------------------------------------------------
+//
+void CApSettingsHandlerImpl::ConstructL(
+                                        CActiveApDb& aDb,
+                                        TInt aIspFilter,
+                                        TInt aBearerFilter,
+                                        TInt aSortType,
+                                        TVpnFilterType aVpnFilterType,
+                                        TBool aIncludeEasyWlan
+                                        )
+    {
+    APSETUILOGGER_ENTERFN( EApImpl,"Impl::ConstructL5")
+    
+    DoConstructL( &aDb, aIspFilter, aBearerFilter, 
+                  aSortType, aVpnFilterType, aIncludeEasyWlan );
+    
+    APSETUILOGGER_LEAVEFN( EApImpl,"Impl::ConstructL5")
+    }
+
+
+// ---------------------------------------------------------
+// CApSettingsHandlerImpl::SetFilter
+// ---------------------------------------------------------
+//
+void CApSettingsHandlerImpl::SetFilterL(   TInt aIspFilter,
+                                                TInt aBearerFilter,
+                                                TInt aSortType )
+    {
+    APSETUILOGGER_ENTERFN( EApImpl,"Impl::SetFilterL")
+    
+    iIspFilter = aIspFilter;
+    iBearerFilter = aBearerFilter;
+    iExt->iSortType = aSortType;
+    
+    APSETUILOGGER_LEAVEFN( EApImpl,"Impl::SetFilterL")
+    }
+
+
+
+
+// ---------------------------------------------------------
+// CApSettingsHandlerImpl::SetTextOverrideL
+// ---------------------------------------------------------
+//
+void CApSettingsHandlerImpl::SetTextOverrideL( TTextID aText2Change,
+                                                    const TDesC& aNewText )
+    {
+    APSETUILOGGER_ENTERFN( EApImpl,"Impl::SetTextOverrideL")
+    
+    __ASSERT_DEBUG( iTextOverrides, Panic( ENullPointer ) );
+    iTextOverrides->SetTextOverrideL( aText2Change, aNewText );
+    
+    APSETUILOGGER_LEAVEFN( EApImpl,"Impl::SetTextOverrideL")
+    }
+
+
+// ---------------------------------------------------------
+// CApSettingsHandlerImpl::TextOverrideL
+// ---------------------------------------------------------
+//
+const TDesC& CApSettingsHandlerImpl::TextOverrideL( TTextID aTextId )
+    {
+    APSETUILOGGER_ENTERFN( EApImpl,"Impl::TextOverrideL <- ->")
+    
+    __ASSERT_DEBUG( iTextOverrides, Panic( ENullPointer ) );
+    return iTextOverrides->TextOverrideL( aTextId );
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsHandlerImpl::RunSettingsL
+// ---------------------------------------------------------
+//
+TInt CApSettingsHandlerImpl::RunSettingsL( TUint32 aHighLight,
+                                                TUint32& aSelected )
+    {    
+    APSETUILOGGER_ENTERFN( EApImpl,"Impl::RunSettingsL")
+    
+    // this function is only called from outside, need to init iEventStore
+    iEventStore = KApUiEventNone;
+
+    TRAPD( err, HandleRunSettingsL( aHighLight, aSelected ) );
+    if ( iEventStore & KApUiEventInternal )
+        {
+        // internal 'exit', not an error, 
+        // clear flag and return normally
+        iEventStore &= (~KApUiEventInternal);
+        }
+    else
+        {
+        User::LeaveIfError(err);
+        }
+
+    APSETUILOGGER_LEAVEFN( EApImpl,"Impl::RunSettingsL")
+
+    return iEventStore;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsHandlerImpl::Cvt()
+// ---------------------------------------------------------
+//
+TInt CApSettingsHandlerImpl::Cvt()
+    {
+    APSETUILOGGER_ENTERFN( EApImpl,"Impl::Cvt")
+    
+    return KErrNone;
+    }
+
+
+// ---------------------------------------------------------
+// CApSettingsHandlerImpl::DoRunSettingsL
+// ---------------------------------------------------------
+//
+TInt CApSettingsHandlerImpl::DoRunSettingsL( TUint32 aHighLight,
+                                         TUint32& aSelected )
+    {
+    APSETUILOGGER_ENTERFN( EApImpl,"Impl::DoRunSettingsL")
+    
+    __ASSERT_DEBUG( iTextOverrides, Panic( ENullPointer ) );
+
+    if ( ( iListType == EApSettingsSelListIsPopUp ) ||
+         ( iListType == EApSettingsSelListIsPopUpWithNone ) )
+        {
+        DoRunSetPageSettingsL( aHighLight, aSelected );
+        }
+    else
+        {
+        DoRunListSettingsL( aHighLight, aSelected );
+        }
+    
+    APSETUILOGGER_LEAVEFN( EApImpl,"Impl::DoRunSettingsL")
+    return 0;
+    }
+
+
+// ---------------------------------------------------------
+// CApSettingsHandlerImpl::RunViewerL
+// ---------------------------------------------------------
+//
+TInt CApSettingsHandlerImpl::RunViewerL( TUint32 aUid )
+    {
+    APSETUILOGGER_ENTERFN( EApImpl,"Impl::RunViewerL")
+    
+    // this function is only called from outside, need to init iEventStore
+    iEventStore = KApUiEventNone;
+
+#ifdef __TEST_OOMDEBUG
+    if ( iMemTestOn )
+        {
+        TInt leavecode( KErrNoMemory );
+        TInt ts( GetTestStateL() );
+
+        TBuf<48> buf;
+        buf.Format( _L("\r\n\t( ts: %d )"), ts );
+        APSETUILOGGER_WRITE_BUF( EApImpl, buf );
+
+        if ( ts == KViewerTest )
+            {
+            TBuf<48> buf;
+            APSETUILOGGER_WRITE_BUF( EApImpl, _L("Starting KViewerTest memtest") );
+
+            TUint32 rate( 0 );
+            TUint32 retrycount( KOOMRetryCount );
+            TUint32 retryoffset( KOOMRetryOffset );
+            for (
+                rate = 1;
+                ((rate < 50000) && (leavecode == KErrNoMemory))
+                    || retrycount;
+                rate++
+                )
+                {
+                __UHEAP_SETFAIL( RHeap::EDeterministic, rate );
+                TRAP( leavecode, DoRunViewerL( aUid ) );
+                __UHEAP_RESET;
+                if ( !leavecode )
+                    {
+                    retrycount--;
+                    rate += retryoffset;
+                    }
+                }
+            User::LeaveIfError( leavecode );
+            buf.Format( _L("\t Memtest finished, max. rate was: %d )"), rate );
+            APSETUILOGGER_WRITE_BUF( EApImpl, buf );
+            }
+        else
+            {
+            DoRunViewerL( aUid );
+            }
+        }
+    else
+        {
+        DoRunViewerL( aUid );
+        }
+#else
+    DoRunViewerL( aUid );
+#endif // __TEST_OOMDEBUG
+
+    APSETUILOGGER_LEAVEFN( EApImpl,"Impl::RunViewerL")
+    
+    return iEventStore;
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsHandlerImpl::DoRunViewerL
+// ---------------------------------------------------------
+//
+TInt CApSettingsHandlerImpl::DoRunViewerL( TUint32 aUid )
+    {
+    APSETUILOGGER_ENTERFN( EApImpl,"Impl::DoRunViewerL")
+    
+    TInt retval( KErrNone );
+
+    TBool protSupported = FeatureManager::FeatureSupported( 
+                                           KFeatureIdSettingsProtection );
+
+
+    TTransactionResult ownTransaction = iModel->StartTransactionLC
+                                                    (
+                                                    /*aWrite*/EFalse,
+                                                    /*aShowNote*/ETrue,
+                                                    /*aRetry*/ETrue
+                                                    );
+    if ( ownTransaction != EFailedWithLocked )
+        {
+        TBool isinuse = iModel->ApUtils()->IsAPInUseL( aUid );
+        TBool isprotected(EFalse);
+        if ( protSupported )
+            {
+            isprotected = iModel->ApUtils()->IsReadOnlyL( aUid );
+            isprotected |= CApProtHandler::IsTableProtectedL( 
+                                iModel->Database()->Database() );
+            }
+
+        TBool isvpn = iModel->VpnEngine()->IsVpnApL( aUid );
+
+        if ( ownTransaction == EOwnTransaction )
+            {
+            TInt err = iModel->CommitTransaction();
+            User::LeaveIfError( err );
+            CleanupStack::Pop(); // RollbackTransactionOnLeave
+            }
+
+        if ( isinuse )
+            {
+            // Ap is in use right now, can not edit or delete,
+            // show information note qtn_set_note_iap_in_use
+            ShowNoteL( R_APUI_NOTE_AP_IN_USE_EDIT );
+            }
+        else 
+            {
+            if ( protSupported && isprotected )
+                {
+                ShowNoteL( R_APUI_NOTE_PROTECTED_AP_SETT );
+                }
+            else
+                { // not in use, not protected, check if it is vpn
+                if ( isvpn )
+                    {
+                    ShowNoteL( R_APUI_NOTE_VPN_AP_SETT );
+                    }
+                else
+                    { // may start wondering about editing...
+                    TApBearerType bearer = iModel->ApUtils()->BearerTypeL( aUid );
+#ifdef __TEST_LAN_BEARER
+                    if ( bearer == EApBearerTypeLAN )
+                        {
+                        User::Leave( KErrNotSupported );
+        //                ShowNoteL( R_APUI_AP_LAN_NOT_SUPPORTED );
+                        // Leave needed?
+                        }
+                    else
+                        {
+                        CApSettingsDlg* iMyDialog = 
+                                CApSettingsDlg::NewL( iIspFilter,
+                                                      iBearerFilter,
+                                                      iExt->iSortType,
+                                                      iEventStore,
+                                                      iReqIpvType
+                                                      );
+
+                        iMyDialog->SetTextOverrides( iTextOverrides );
+
+                        retval = iMyDialog->ConstructAndRunLD( 
+                                                *iModel, *this, aUid );
+                        }
+#else
+                    if ( bearer == EApBearerTypeLANModem )
+                        {
+                        User::Leave( KErrNotSupported );
+        //                ShowNoteL( R_APUI_AP_LAN_NOT_SUPPORTED );
+                        // Leave needed?
+                        }
+                    else
+                        {
+                        CApSettingsDlg* iMyDialog = 
+                                CApSettingsDlg::NewL( iIspFilter,
+                                                      iBearerFilter,
+                                                      iExt->iSortType,
+                                                      iEventStore,
+                                                      iReqIpvType
+                                                      );
+
+                        iMyDialog->SetTextOverrides( iTextOverrides );
+
+                        retval = iMyDialog->ConstructAndRunLD( 
+                                                *iModel, *this, aUid );
+                        }
+#endif // __TEST_LAN_BEARER
+                    }
+                }
+            }
+        }
+    
+    APSETUILOGGER_LEAVEFN( EApImpl,"Impl::DoRunViewerL")
+    
+    return retval;
+    }
+
+
+
+//----------------------------------------------------------
+// CApSettingsHandlerImpl::HandleApDeleteCmdL
+//----------------------------------------------------------
+//
+void CApSettingsHandlerImpl::HandleApDeleteCmdL( TUint32 aUid, TBool aIsLast )
+    {
+    APSETUILOGGER_ENTERFN( EApImpl,"Impl::HandleApDeleteCmdL")
+    
+    // OOD handling. If disk space is low,
+    // we try to get some spare.
+    RFs fs;
+    User::LeaveIfError( fs.Connect() );
+    CleanupClosePushL<RFs>( fs );
+    TBool diskLow = SysUtil::FFSSpaceBelowCriticalLevelL
+            ( &fs, KEstimatedDeleteFfsOverhead );
+
+    RSharedDataClient sdClient;
+    if ( diskLow )
+        {
+        User::LeaveIfError( sdClient.Connect() );
+        CleanupClosePushL<RSharedDataClient>( sdClient );
+        sdClient.RequestFreeDiskSpaceLC
+                    ( KEstimatedDeleteFfsOverhead );
+        }
+    
+        // check that the Ap is not used so it can be deleted!!
+    TTransactionResult ownTransaction = iModel->StartTransactionLC(
+                                                /*aWrite*/EFalse,
+                                                /*aShowNote*/ETrue,
+                                                /*aRetry*/ETrue );
+    if ( ownTransaction != EFailedWithLocked )
+        {
+        TBool isinuse = iModel->ApUtils()->IsAPInUseL( aUid );
+        TApBearerType bearer = iModel->ApUtils()->BearerTypeL( aUid );
+#ifdef __TEST_LAN_BEARER        
+        if ( bearer == EApBearerTypeLAN )
+            {
+            User::Leave( KErrNotSupported );
+            }
+#endif // __TEST_LAN_BEARER
+        if ( bearer == EApBearerTypeLANModem )
+            {
+            User::Leave( KErrNotSupported );
+            // Leave needed?
+            }
+
+        TBool protSupported = FeatureManager::FeatureSupported( 
+                                               KFeatureIdSettingsProtection );
+        TBool isprotected(EFalse);
+        if ( protSupported )
+            {
+            isprotected = iModel->ApUtils()->IsReadOnlyL( aUid );
+            }
+
+        if ( ownTransaction == EOwnTransaction )
+            {
+            TInt err = iModel->CommitTransaction();
+            User::LeaveIfError( err );
+            CleanupStack::Pop(); // RollbackTransactionOnLeave
+            }
+
+        if ( isinuse )
+            {
+            // Ap is in use right now, can not edit or delete,
+            // show information note qtn_set_note_iap_in_use
+            ShowNoteL( R_APUI_NOTE_AP_IN_USE_DELETE );
+            }
+        else
+            { // not in use, maybe protected?
+            if ( protSupported && isprotected )
+                {
+                ShowNoteL( R_APUI_NOTE_PROTECTED_AP );
+                }
+            else
+                { // not in use or protected, may start wondering about delete...
+                // need to check whether it is the last one...
+                TBool candelete( ETrue );
+                // Linked to VPN? 
+                TBool isvpn = iModel->VpnEngine()->IsVpnApL( aUid );
+                if ( !isvpn )
+                    {
+                    if ( iExt->iVariant & KApUiEditOnlyVPNs )
+                        {
+                        candelete = EFalse;
+                        }
+                    else
+                        {
+                        HBufC* sgd = NULL;
+                        sgd = iModel->GetLinkedVpnAccessPointLC( aUid ); 
+                        if ( sgd )
+                            {// has linked VPN, 
+                            // According to current spec. there should
+                            // be something like linked to VPN, Delete? 
+                            // BUT it causes incomplete access point to exist
+                            // hard to handle, therefore last minute change
+                            // is that it can not be delted.
+                            /*
+                            if ( !AskQueryL( R_APUI_IAP_DEL_IAP_ASSOCIATED, sgd ) )
+                                {
+                                candelete = EFalse;
+                                }
+                            */
+                            ShowNoteL( R_APUI_NOTE_AP_IN_USE_DELETE );
+                            candelete = EFalse;
+                            
+                            CleanupStack::PopAndDestroy( sgd );
+                            }
+                        else
+                            { // simply confirm
+                            candelete = ConfirmDeleteL( aUid, aIsLast );
+                            }
+                        }
+                    }
+                else
+                    { // simply confirm
+                    candelete = ConfirmDeleteL( aUid, aIsLast );
+                    }
+                if ( candelete )
+                    { // seems that we can delete it, so let's go on
+                    iModel->RemoveApL( aUid );
+                    iEventStore |= KApUiEventDeleted;
+                    }
+                }
+            }
+        }
+    
+    if ( diskLow )
+        {
+        // Cancel RequestFreeDiskSpaceLC (by popping off an destroy);
+        // close sdClient.
+        CleanupStack::PopAndDestroy( 2 );
+        }
+    CleanupStack::PopAndDestroy(); // fs, will also close it
+    
+    APSETUILOGGER_LEAVEFN( EApImpl,"Impl::HandleApDeleteCmdL")
+    }
+
+
+//----------------------------------------------------------
+// CApSettingsHandlerImpl::HandleApBlankNewL
+//----------------------------------------------------------
+//
+TUint32 CApSettingsHandlerImpl::HandleApBlankNewL( TInt aBearers, TInt aIsps )
+    {
+    APSETUILOGGER_ENTERFN( EApImpl,"Impl::HandleApBlankNewL")
+    
+    TUint32 retval( KErrNone );
+
+#ifdef __TEST_OOMDEBUG
+    if ( iMemTestOn )
+        {
+        TInt leavecode( KErrNoMemory );
+
+        TInt ts( GetTestStateL() );
+
+        if ( ts == KCreateBlankTest )
+            {
+            TBuf<48> buf;
+            APSETUILOGGER_WRITE_BUF( EApImpl, _L("Starting KCreateBlankTest memtest") );
+
+            TUint32 rate( 0 );
+            TUint32 retrycount( KOOMRetryCount );
+            TUint32 retryoffset( KOOMRetryOffset );
+            for (
+                rate = 1;
+                ((rate < 50000) && (leavecode == KErrNoMemory))
+                    || retrycount;
+                rate++
+                )
+                {
+                __UHEAP_SETFAIL( RHeap::EDeterministic, rate );
+                TRAP( leavecode,
+                      retval = DoHandleApBlankNewL( aBearers, aIsps ) );
+                __UHEAP_RESET;
+                if ( !leavecode )
+                    {
+                    retrycount--;
+                    rate += retryoffset;
+                    }
+                }
+            User::LeaveIfError( leavecode );
+            buf.Format( _L("\t Memtest finished, max. rate was: %d )"), rate );
+            APSETUILOGGER_WRITE_BUF( EApImpl, buf );
+            }
+        else
+            {
+            retval = DoHandleApBlankNewL( aBearers, aIsps );
+            }
+        }
+    else
+        {
+        retval = DoHandleApBlankNewL( aBearers, aIsps );
+        }
+#else
+    retval = DoHandleApBlankNewL( aBearers, aIsps );
+#endif // __TEST_OOMDEBUG
+
+    APSETUILOGGER_LEAVEFN( EApImpl,"Impl::HandleApBlankNewL")
+    return retval;
+    }
+
+
+
+
+//----------------------------------------------------------
+// CApSettingsHandlerImpl::HandleApUseOldNewL
+//----------------------------------------------------------
+//
+TUint32 CApSettingsHandlerImpl::HandleApUseOldNewL()
+    {
+    APSETUILOGGER_ENTERFN( EApImpl,"Impl::HandleApUseOldNewL")
+    
+    TUint32 retval = KErrNone;
+
+#ifdef __TEST_OOMDEBUG
+    if ( iMemTestOn )
+        {
+        TInt leavecode( KErrNoMemory );
+        TInt ts( GetTestStateL() );
+
+        TBuf<48> buf;
+        buf.Format( _L("\r\n\t( ts: %d )"), ts );
+        APSETUILOGGER_WRITE_BUF( EApImpl, buf );
+
+        if ( ts == KQueryTest )
+            {
+            TBuf<48> buf;
+            APSETUILOGGER_WRITE_BUF( EApImpl, _L("Starting KQueryTest memtest") );
+            TUint32 rate( 0 );
+            TUint32 retrycount( KOOMRetryCount );
+            TUint32 retryoffset( KOOMRetryOffset );
+            for (
+                rate = 1;
+                ((rate < 50000) && (leavecode == KErrNoMemory))
+                    || retrycount;
+                rate++
+                )
+                {
+                __UHEAP_MARK;
+                __UHEAP_SETFAIL( RHeap::EDeterministic, rate );
+                TRAP( leavecode, retval = SelectApToCopyL() );
+                __UHEAP_RESET;
+                __UHEAP_MARKEND;
+                if ( !leavecode )
+                    {
+                    retrycount--;
+                    rate += retryoffset;
+                    }
+                }
+            User::LeaveIfError( leavecode );
+            buf.Format( _L("\t Memtest finished, max. rate was: %d )"), rate );
+            APSETUILOGGER_WRITE_BUF( EApImpl, buf );
+            }
+        else
+            {
+            retval = SelectApToCopyL();
+            }
+        }
+    else
+        {
+        retval = SelectApToCopyL();
+        }
+#else
+    retval = SelectApToCopyL();
+#endif // __TEST_OOMDEBUG
+
+    if ( retval != (TUint32)KErrNone )
+        { // so user had chosen something
+#ifdef __TEST_OOMDEBUG
+        if ( iMemTestOn )
+            {
+            TInt leavecode( KErrNoMemory );
+            TInt ts( GetTestStateL() );
+            if ( ts == KCreateUseExistTest )
+                {
+                TBuf<48> buf;
+                APSETUILOGGER_WRITE_BUF
+                    ( _L("Starting KCreateUseExistTest memtest") );
+                TUint32 rate( 0 );
+                TUint32 retrycount( KOOMRetryCount );
+                TUint32 retryoffset( KOOMRetryOffset );
+                for (
+                    rate = 1;
+                    ((rate < 50000) && (leavecode == KErrNoMemory))
+                        || retrycount;
+                    rate++
+                    )
+                    {
+                    __UHEAP_SETFAIL( RHeap::EDeterministic, rate );
+                    TRAP( leavecode, retval = DoHandleApUseOldNewL( retval ) );
+                    __UHEAP_RESET;
+                    if ( !leavecode )
+                        {
+                        retrycount--;
+                        rate += retryoffset;
+                        }
+                    }
+                User::LeaveIfError( leavecode );
+                buf.Format( _L("\t Memtest finished, max. rate was: %d )"),
+                            rate );
+                APSETUILOGGER_WRITE_BUF( EApImpl, buf );
+                }
+            else
+                {
+                retval = DoHandleApUseOldNewL( retval );
+                }
+            }
+        else
+            {
+            retval = DoHandleApUseOldNewL( retval );
+            }
+#else
+        retval = DoHandleApUseOldNewL( retval );
+#endif // __TEST_OOMDEBUG
+        }
+    
+    APSETUILOGGER_LEAVEFN( EApImpl,"Impl::HandleApUseOldNewL")
+    
+    return retval;
+    }
+
+
+
+//----------------------------------------------------------
+// CApSettingsHandlerImpl::EditAfterCreateL
+//----------------------------------------------------------
+//
+TUint32 CApSettingsHandlerImpl::EditAfterCreateL( TUint32 aUid,
+                                              CApAccessPointItem* aItem )
+    {
+    APSETUILOGGER_ENTERFN( EApImpl,"Impl::EditAfterCreateL")
+    
+    CApSettingsDlg* iMySetDialog = CApSettingsDlg::NewL
+                                                    (
+                                                    KEApIspTypeAll,
+                                                    EApBearerTypeAll,
+                                                    KEApSortNameAscending,
+                                                    iEventStore,
+                                                    iReqIpvType
+                                                    );
+
+    iMySetDialog->SetTextOverrides( iTextOverrides );
+    iMySetDialog->ConstructAndRunLD( *iModel, *this, aUid, aItem );
+    
+    APSETUILOGGER_LEAVEFN( EApImpl,"Impl::EditAfterCreateL")
+    
+    return aUid;
+    }
+
+
+
+//----------------------------------------------------------
+// CApSettingsHandlerImpl::DoConstructL
+//----------------------------------------------------------
+//
+void CApSettingsHandlerImpl::DoConstructL( CActiveApDb* aDb,
+                                       TInt aIspFilter,
+                                       TInt aBearerFilter,
+                                       TInt aSortType,
+                                       TVpnFilterType aVpnFilterType,
+                                       TBool aIncludeEasyWlan )
+    {
+    APSETUILOGGER_ENTERFN( EApImpl,"Impl::DoConstructL")
+    
+    iExt = new ( ELeave )TApSetHandlerImplExtra;
+    iExt->iResOffset = 0;
+    iExt->iIsIpv6Supported = EFalse;
+    iExt->iIsFeatureManagerInitialised = EFalse;
+    iExt->iExtra = 0;
+    iExt->iSortType = KEApSortNameAscending;
+    iExt->iVpnFilterType = aVpnFilterType;
+    iExt->iVariant = GetVariantL();
+    iExt->iIncludeEasyWlan = aIncludeEasyWlan;
+    
+#ifdef __TEST_CDMA_WRITE_PROTECT
+    iExt->iVariant |= KApUiEditOnlyVPNs;
+#endif // __TEST_CDMA_WRITE_PROTECT
+    iIspFilter = KEApIspTypeAll;
+    iBearerFilter = aBearerFilter;
+
+    // get IPv6 features from feature manager
+    FeatureManager::InitializeLibL();
+    iExt->iIsFeatureManagerInitialised = ETrue;
+
+    iExt->iIsIpv6Supported = 
+            FeatureManager::FeatureSupported( KFeatureIdIPv6 );
+#ifdef __TEST_IPV6_SUPPORT    
+    iExt->iIsIpv6Supported = ETrue;
+#endif //  __TEST_IPV6_SUPPORT    
+
+    // we ask IPv6 only if it is asked by client AND supported by the phone
+    iReqIpvType = iExt->iIsIpv6Supported ? iReqIpvType : EIPv4;
+
+
+#ifdef __TEST_OOMDEBUG
+    RFs fs;
+    User::LeaveIfError( fs.Connect() );
+    CleanupClosePushL<RFs>( fs );
+    TUint att;
+    if ( fs.Att( KTestFileName, att ) == KErrNone )
+        {
+        iMemTestOn = ETrue;
+        }
+    else
+        {
+        iMemTestOn = EFalse;
+        }
+    CleanupStack::PopAndDestroy(); // fs, will also close it
+#endif // __TEST_OOMDEBUG
+    iTextOverrides = CTextOverrides::NewL();
+    // No need to PushL( iTextOverrides ), it's pointer is owned
+    // & will be deleted in destructor, because 'this' is already
+    // on the CleanupStack...
+    if ( aDb )
+        {
+        iModel = CApSettingsModel::NewL( *aDb, aIspFilter,
+                                         aBearerFilter, aSortType, 
+                                         iReqIpvType,
+                                         iExt->iVpnFilterType,
+                                         iExt->iVariant,
+                                         iExt->iIncludeEasyWlan,
+                                         iNoEdit );
+        }
+    else
+        {
+        iModel = CApSettingsModel::NewL( aIspFilter, aBearerFilter,
+                                         aSortType, iReqIpvType,
+                                         iExt->iVpnFilterType,
+                                         iExt->iVariant,
+                                         iExt->iIncludeEasyWlan,
+                                         iNoEdit );
+        }
+    SetFilterL( aIspFilter, aBearerFilter, aSortType );
+
+    // can't use resource here because it has not been added yet....
+    TFileName resourceFile;
+    resourceFile.Append( KApSettingsResDriveZ );
+    resourceFile.Append( KDC_RESOURCE_FILES_DIR );
+    resourceFile.Append( KApSettingsResFileName );
+    BaflUtils::NearestLanguageFile( iModel->EikEnv()->FsSession(),
+                                    resourceFile );
+    // as we are not an Application having iCoeEnv, we must figure it out,
+    // no matter what it takes. Also it is getted once per construction...
+    iExt->iResOffset = iModel->EikEnv()->AddResourceFileL( resourceFile );
+    
+    APSETUILOGGER_LEAVEFN( EApImpl,"Impl::DoConstructL")    
+    }
+
+
+
+
+//----------------------------------------------------------
+// CApSettingsHandlerImpl::DoRunSetPageSettingsL
+//----------------------------------------------------------
+//
+void CApSettingsHandlerImpl::DoRunSetPageSettingsL( TUint32 aHighLight,
+                                                TUint32& aSelected )
+    {
+    APSETUILOGGER_ENTERFN( EApImpl,"Impl::DoRunSetPageSettingsL")
+    
+    TInt aHigh = aHighLight;
+
+    HBufC* titlebuf;
+
+    if ( iTextOverrides->IsTextOverridenL( EPopupPromptText ) )
+        {
+        titlebuf = iTextOverrides->TextOverrideL(
+                                                EPopupPromptText
+                                                ).AllocLC();
+        }
+    else
+        {
+        titlebuf = iModel->EikEnv()->AllocReadResourceLC
+                                (
+                                R_APUI_VIEW_DEFAULT_AP
+                                );
+        }
+    /*
+    * We need to pass an int& as starting selection to
+    * CAknRadioButtonSettingPage
+    * But we use preferred UID & not list-item nuber...
+    * Also it sets selection in it's ConstructL() but our list is filled
+    * up dynamically and it must be done after ConstructL()
+    * (list must be already constructed...)
+    * Therefore we pass a dummy int& initialized to 0 as
+    * selecting the 0th element does no harm...
+    */
+    TInt Dummy( -1 );
+    // needs this Dummy array to pass it to CAknSettingPage's constructor...
+    CDesCArrayFlat* aItemArray = new ( ELeave ) CDesCArrayFlat( 1 );
+    CleanupStack::PushL( aItemArray );
+    CApSelPopupList* dlg = CApSelPopupList::NewL
+                            (
+                            *iModel,
+                            *this,
+                            Dummy,
+                            aHigh,
+                            iSelMenuType,
+                            iIspFilter,
+                            iBearerFilter,
+                            iExt->iSortType,
+                            iEventStore,
+                            aItemArray,
+                            iListType == EApSettingsSelListIsPopUpWithNone,
+                            iReqIpvType,
+                            iExt->iVpnFilterType,
+                            iExt->iIncludeEasyWlan,
+                            iNoEdit
+                            );
+    CleanupStack::PushL( dlg );
+    TPtrC ptr( titlebuf->Des() );
+    dlg->SetSettingTextL( ptr );
+    // dlg must be Pop-ed because ExecuteLD starts with PushL()...
+    CleanupStack::Pop();
+    if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )
+        {
+        aSelected = aHigh;
+        }
+    CleanupStack::PopAndDestroy( 2 ); // aItemArray, titlebuf
+    
+    APSETUILOGGER_LEAVEFN( EApImpl,"Impl::DoRunSetPageSettingsL")
+    }
+
+
+
+//----------------------------------------------------------
+// CApSettingsHandlerImpl::DoRunListSettingsL
+//----------------------------------------------------------
+//
+void CApSettingsHandlerImpl::DoRunListSettingsL( TUint32 aHighLight,
+                                             TUint32& aSelected )
+    {
+    APSETUILOGGER_ENTERFN( EApImpl,"Impl::DoRunListSettingsL")
+    
+    CApSelectorDialog* iMyDialog = CApSelectorDialog::NewL
+                                            (
+                                            iListType,
+                                            iSelMenuType,
+                                            iIspFilter,
+                                            iBearerFilter,
+                                            iExt->iSortType,
+                                            iEventStore,
+                                            iNoEdit,
+                                            iReqIpvType
+                                            );
+    iMyDialog->SetTextOverrides( iTextOverrides );
+
+    iMyDialog->ConstructAndRunLD( *iModel, *this, aHighLight, aSelected );
+    
+    APSETUILOGGER_LEAVEFN( EApImpl,"Impl::DoRunListSettingsL")
+    }
+
+
+
+//----------------------------------------------------------
+// CApSettingsHandlerImpl::DoHandleApUseOldNewL
+//----------------------------------------------------------
+//
+TUint32 CApSettingsHandlerImpl::DoHandleApUseOldNewL( TUint32 aSelected )
+    {
+    APSETUILOGGER_ENTERFN( EApImpl,"Impl::DoHandleApUseOldNewL")
+    
+    TInt retval = KErrNone;
+
+    TTransactionResult ownTransaction = iModel->StartTransactionLC
+                                                        ( /*aWrite*/ETrue,
+                                                        /*aShowNote*/ETrue,
+                                                        /*aRetry*/ETrue
+                                                        );
+    if ( ownTransaction != EFailedWithLocked )
+        {
+        // check the original bearer's type
+        TApBearerType bearer = iModel->ApUtils()->BearerTypeL( aSelected );
+#ifdef __TEST_LAN_BEARER        
+        if ( bearer == EApBearerTypeLAN )
+            {
+            User::Leave( KErrNotSupported );
+//            ShowNoteL( R_APUI_AP_LAN_NOT_SUPPORTED );
+//            User::Leave( KLeaveWithoutAlert );
+            }
+#endif // __TEST_LAN_BEARER
+        if ( bearer == EApBearerTypeLANModem )
+            {
+            User::Leave( KErrNotSupported );
+//            ShowNoteL( R_APUI_AP_LAN_NOT_SUPPORTED );
+//            User::Leave( KLeaveWithoutAlert );
+            }
+        TBool isprotected( EFalse );
+
+        TBool protSupported = FeatureManager::FeatureSupported( 
+                                               KFeatureIdSettingsProtection );
+
+        if ( protSupported )
+            {
+            isprotected = iModel->ApUtils()->IsReadOnlyL( aSelected );
+            isprotected |= CApProtHandler::IsTableProtectedL( 
+                                iModel->Database()->Database() );
+            }
+        if ( isprotected )
+            {
+            ShowNoteL( R_APUI_NOTE_PROTECTED_AP_SETT );
+            }
+        if ( !isprotected )
+            {
+            TUint32 aUid = iModel->DataHandler()->CreateCopyFromL( aSelected );
+            if ( ownTransaction == EOwnTransaction )
+                {
+                TInt err = iModel->CommitTransaction();
+                User::LeaveIfError( err );
+                CleanupStack::Pop(); // RollbackTransactionOnLeave
+                }
+            iEventStore |= KApUiEventCreatedUsedOld;
+            retval = aUid;
+            EditAfterCreateL( aUid );
+            }
+        else
+            {
+            if ( ownTransaction == EOwnTransaction )
+                {
+                TInt err = iModel->CommitTransaction();
+                User::LeaveIfError( err );
+                CleanupStack::Pop(); // RollbackTransactionOnLeave
+                }
+            }
+        }
+
+    APSETUILOGGER_LEAVEFN( EApImpl,"Impl::DoHandleApUseOldNewL")
+    return retval;
+    }
+
+
+
+//----------------------------------------------------------
+// CApSettingsHandlerImpl::SelectApToCopyL
+//----------------------------------------------------------
+//
+TUint32 CApSettingsHandlerImpl::SelectApToCopyL()
+    {
+    APSETUILOGGER_ENTERFN( EApImpl,"Impl::SelectApToCopyL")
+    
+    // = KErrNone just to suppress compiler warning C4701
+    TUint32 aSelected = KErrNone;
+    TUint32 retval = KErrNone;
+
+    CApSelQueryDialog* dlg = new ( ELeave ) CApSelQueryDialog( *iModel,
+                                                               &aSelected );
+    TInt iQueryOk = dlg->ExecuteLD( R_LIST_QUERY );
+    if ( iQueryOk )
+        {
+        retval = aSelected;
+        }
+    
+    APSETUILOGGER_LEAVEFN( EApImpl,"Impl::SelectApToCopyL")
+    return retval;
+    }
+
+
+
+
+
+//----------------------------------------------------------
+// CApSettingsHandlerImpl::DoHandleApBlankNewL
+//----------------------------------------------------------
+//
+TUint32 CApSettingsHandlerImpl::DoHandleApBlankNewL( TInt aBearers, TInt aIsps )
+    {
+    APSETUILOGGER_ENTERFN( EApImpl,"Impl::DoHandleApBlankNewL")
+
+    CApAccessPointItem* apitem = CApAccessPointItem::NewLC();
+/*
+KEApIspTypeInternetOnly:
+    EApBearerTypeCSD, EApBearerTypeHSCSD, EApBearerTypeGPRS
+
+KEApIspTypeInternetAndWAP
+    EApBearerTypeCSD, EApBearerTypeHSCSD, EApBearerTypeGPRS
+
+KEApIspTypeWAPOnly
+    EApBearerTypeCSD, EApBearerTypeHSCSD, EApBearerTypeSMS, EApBearerTypeGPRS
+
+KEApIspTypeWAPMandatory
+    EApBearerTypeCSD, EApBearerTypeHSCSD, EApBearerTypeSMS, EApBearerTypeGPRS
+
+KEApIspTypeAll
+    All
+
+
+    EIspTypeInternetOnly,
+    EIspTypeWAPOnly,
+    EIspTypeInternetAndWAP
+
+*/
+    ChooseBearerTypeL( aBearers, *apitem );
+    
+    if ( aIsps & KEApIspTypeAll )
+        {
+        apitem->WriteUint( EApIspIspType, EIspTypeInternetAndWAP );
+        }
+    else
+        {
+        if ( aIsps & KEApIspTypeWAPOnly )
+            { // EApBearerTypeCSD, EApBearerTypeHSCSD, EApBearerTypeGPRS,
+            apitem->WriteUint( EApIspIspType, EIspTypeWAPOnly );
+            }
+        else
+            {
+            if ( aIsps & 
+                     ( KEApIspTypeWAPMandatory | KEApIspTypeMMSMandatory ) )
+                { // EApBearerTypeCSD, EApBearerTypeHSCSD, EApBearerTypeGPRS
+                apitem->WriteUint( EApIspIspType, EIspTypeInternetAndWAP );
+                }
+            else
+                {
+                if ( aIsps & KEApIspTypeInternetAndWAP )
+                    {
+                    apitem->WriteUint( EApIspIspType, EIspTypeInternetAndWAP );
+                    }
+                else
+                    {
+                    if ( aIsps & KEApIspTypeInternetOnly )
+                        {
+                        apitem->WriteUint( EApIspIspType,
+                                           EIspTypeInternetOnly );
+                        }
+                    else
+                        {
+                        __ASSERT_DEBUG( EFalse, Panic( EInvalidIspRequest ) );
+                        }
+                    }
+                }
+            }
+        }
+/*
+KEApIspTypeInternetOnly
+KEApIspTypeWAPOnly
+KEApIspTypeInternetAndWAP
+KEApIspTypeWAPMandatory
+KEApIspTypeAll
+*/
+
+//    apitem->WriteUint( EApIspIspType, EIspTypeInternetOnly );
+
+    TUint32 aUid( KApNoneUID );
+    HBufC* buf = HBufC::NewLC( KApMaxConnNameLength );
+    TPtr16 ptr( buf->Des() );
+    apitem->ReadTextL( EApWapAccessPointName, ptr );
+
+    TTransactionResult ownTransaction = iModel->StartTransactionLC(
+                                                    ETrue, // aWrite
+                                                    ETrue, // aShowNote
+                                                    ETrue ); // aRetry
+    if ( ownTransaction != EFailedWithLocked )
+        {
+        if ( iModel->ApUtils()->MakeValidNameL( ptr ) )
+            {
+            apitem->SetNamesL( ptr );
+            }
+        if ( ownTransaction == EOwnTransaction )
+            {
+            TInt err = iModel->CommitTransaction();
+            User::LeaveIfError( err );
+            CleanupStack::Pop(); // RollbackTransactionOnLeave
+            }
+        }
+
+    aUid = EditAfterCreateL( KApNoneUID, apitem );
+    CleanupStack::PopAndDestroy( 2 ); // apitem, buf
+    
+    APSETUILOGGER_LEAVEFN( EApImpl,"Impl::DoHandleApBlankNewL")
+    return aUid;
+    }
+
+
+
+
+//----------------------------------------------------------
+// CApSettingsHandlerImpl::HandleNetworkDeleteCmdL
+//----------------------------------------------------------
+//
+void CApSettingsHandlerImpl::HandleNetworkDeleteCmdL( TUint32 aUid )
+    {
+    APSETUILOGGER_ENTERFN( EApImpl,"Impl::HandleNetworkDeleteCmdL")
+    
+        // check that the Ap is not used so it can be deleted!!
+    TTransactionResult ownTransaction = iModel->StartTransactionLC(
+                                                /*aWrite*/EFalse,
+                                                /*aShowNote*/ETrue,
+                                                /*aRetry*/ETrue );
+    if ( ownTransaction != EFailedWithLocked )
+        {
+        TBool protSupported = FeatureManager::FeatureSupported( 
+                                               KFeatureIdSettingsProtection );
+        if ( protSupported )
+            {
+            TBool isprotected = iModel->ApUtils()->IsReadOnlyL( aUid );
+            if ( isprotected )
+                {
+                ShowNoteL( R_APUI_NOTE_PROTECTED_AP );
+                return;
+                }
+            }
+        if ( ownTransaction == EOwnTransaction )
+            {
+            TInt err = iModel->CommitTransaction();
+            User::LeaveIfError( err );
+            CleanupStack::Pop(); // RollbackTransactionOnLeave
+            }
+
+        // not protected, may start wondering about delete...
+        // simply confirm
+
+        // OOD handling. If disk space is low,
+        // we try to get some spare.
+        RFs fs;
+        User::LeaveIfError( fs.Connect() );
+        CleanupClosePushL<RFs>( fs );
+        TBool diskLow = SysUtil::FFSSpaceBelowCriticalLevelL
+                ( &fs, KEstimatedDeleteFfsOverhead );
+        RSharedDataClient sdClient;
+        if ( diskLow )
+            {
+            User::LeaveIfError( sdClient.Connect() );
+            CleanupClosePushL<RSharedDataClient>( sdClient );
+            sdClient.RequestFreeDiskSpaceLC
+                        ( KEstimatedDeleteFfsOverhead );
+            }
+        // Handle getting the name, showing the query,
+        // and deleting the network group.
+        // get the name:
+        CApNetworkItem* net = CApNetworkItem::NewLC();
+        iModel->DataHandler()->ReadNetworkL( aUid, *net );
+        HBufC* buf = net->Name().AllocLC();
+        if ( AskQueryL( R_APUI_IAP_ARE_YOU_SURE_TO_DEL, buf ) )
+            {
+            iModel->DataHandler()->RemoveNetworkL( aUid );
+            }
+        CleanupStack::PopAndDestroy( buf ); // buf
+        CleanupStack::PopAndDestroy( net );
+        if ( diskLow )
+            {
+            // Cancel RequestFreeDiskSpaceLC (by popping off an destroy);
+            // close scClient.
+            CleanupStack::PopAndDestroy( 2 );
+            }
+        CleanupStack::PopAndDestroy(); // fs, will also close it
+        }
+    
+    APSETUILOGGER_LEAVEFN( EApImpl,"Impl::HandleNetworkDeleteCmdL")
+    }
+
+
+
+//----------------------------------------------------------
+// CApSettingsHandlerImpl::GetVariantL
+//----------------------------------------------------------
+//
+TInt CApSettingsHandlerImpl::GetVariantL()
+    {
+    APSETUILOGGER_ENTERFN( EApImpl,"Impl::GetVariantL")
+    
+    TInt variant( 0 );
+    // Connecting and initialization:
+    CRepository* repository = 
+            CRepository::NewL( KCRUidApSettingsHandlerUiLV );
+    repository->Get( KApSettingsHandlerUiLVFlags, variant );
+    delete repository;
+
+    APSETUILOGGER_LEAVEFN( EApImpl,"Impl::GetVariantL")
+    return variant;
+    }
+
+
+//----------------------------------------------------------
+// CApSettingsHandlerImpl::ConfirmDeleteL
+//----------------------------------------------------------
+//
+TInt CApSettingsHandlerImpl::ConfirmDeleteL( TUint32 aUid, TBool aIsLast )
+    {
+    APSETUILOGGER_ENTERFN( EApImpl,"Impl::ConfirmDeleteL")
+    
+    TInt retval( 0 );
+    HBufC* sgd = HBufC::NewLC( KModifiableTextLength );
+    TPtr ptr( sgd->Des() );
+
+    // OOD handling. If disk space is low,
+    // we try to get some spare.
+    RFs fs;
+    User::LeaveIfError( fs.Connect() );
+    CleanupClosePushL<RFs>( fs );
+    TBool diskLow = SysUtil::FFSSpaceBelowCriticalLevelL
+            ( &fs, KEstimatedDeleteFfsOverhead );
+
+    RSharedDataClient sdClient;
+    if ( diskLow )
+        {
+        User::LeaveIfError( sdClient.Connect() );
+        CleanupClosePushL<RSharedDataClient>( sdClient );
+        sdClient.RequestFreeDiskSpaceLC
+                    ( KEstimatedDeleteFfsOverhead );
+        }
+
+    TTransactionResult ownTransaction = iModel->StartTransactionLC
+                                               (
+                                               /*aWrite*/ETrue,
+                                               /*aShowNote*/ETrue,
+                                               /*aRetry*/ETrue,
+                                               /*aLFFSChecking*/EFalse
+                                               );
+    if ( ownTransaction != EFailedWithLocked )
+        {
+        iModel->ApUtils()->NameL( aUid, ptr );
+        if ( ownTransaction == EOwnTransaction )
+            {
+            TInt err = iModel->CommitTransaction();
+            User::LeaveIfError( err );
+            CleanupStack::Pop(); // RollbackTransactionOnLeave
+            }
+
+        if ( aIsLast )
+            { // we are deleting the last one, needs to confirm
+            retval = AskQueryL( R_APUI_IAP_DEL_LAST_AP, sgd );
+            }
+        else
+            { // not the last one, simply confirm
+            // handle exotic language number conversion here
+            TPtr t(sgd->Des());
+            AknTextUtils::LanguageSpecificNumberConversion( t );
+            retval = AskQueryL( R_APUI_IAP_ARE_YOU_SURE_TO_DEL, sgd );
+            }
+        }
+
+
+    CleanupStack::PopAndDestroy(); // sgd
+    if ( diskLow )
+        {
+        // Cancel RequestFreeDiskSpaceLC (by popping off an destroy);
+        // close scClient.
+        CleanupStack::PopAndDestroy( 2 );
+        }
+    CleanupStack::PopAndDestroy(); // fs, will also close it
+    
+    APSETUILOGGER_LEAVEFN( EApImpl,"Impl::ConfirmDeleteL")
+    return retval;
+    }
+
+
+
+
+
+//----------------------------------------------------------
+// CApSettingsHandlerImpl::HandleRunSettingsL
+//----------------------------------------------------------
+//
+void CApSettingsHandlerImpl::HandleRunSettingsL( TUint32 aHighLight, 
+                                             TUint32& aSelected )
+    {
+    APSETUILOGGER_ENTERFN( EApImpl,"Impl::HandleRunSettingsL")
+    
+    if ( iStartWithSelection == EFalse )
+        {
+        RunViewerL( aHighLight );
+        }
+    else
+        {
+#ifdef __TEST_OOMDEBUG
+        if ( iMemTestOn )
+            {
+            TInt leavecode( KErrNoMemory );
+            TInt state( GetTestStateL() );
+
+            if ( ( (
+                   ( iListType == EApSettingsSelListIsPopUp ) ||
+                   ( iListType == EApSettingsSelListIsPopUpWithNone ) ) &&
+                   ( state == KPopupListTest ) )
+                 ||
+                 (
+                 ( iListType == EApSettingsSelListIsListPane ) &&
+                 ( state == KDialogListTest ) ) )
+                {
+                TBuf<48> buf;
+                if ( state == KDialogListTest )
+                    {
+                    APSETUILOGGER_WRITE_BUF( EApImpl, \
+                        _L("Doing memtest KDialogListTest") );
+                    }
+                if ( state == KPopupListTest )
+                    {
+                    APSETUILOGGER_WRITE_BUF( EApImpl, \ 
+                        _L("Doing memtest KPopupListTest") );
+                    }
+                TUint32 rate( 0 );
+                TUint32 retrycount( KOOMRetryCount );
+                TUint32 retryoffset( KOOMRetryOffset );
+                for (
+                    rate = 1;
+                    ((rate < 50000) && (leavecode == KErrNoMemory))
+                        || retrycount;
+                    rate++
+                    )
+                    {
+                    __UHEAP_SETFAIL( RHeap::EDeterministic, rate );
+                    TRAP( leavecode,
+                          DoRunSettingsL( aHighLight, aSelected ) );
+                    __UHEAP_RESET;
+                    if ( !leavecode )
+                        {
+                        retrycount--;
+                        rate += retryoffset;
+                        }
+                    }
+                User::LeaveIfError( leavecode );
+                buf.Format( _L("\t Memtest finished, max. rate was: %d )"), 
+                           rate );
+                APSETUILOGGER_WRITE_BUF( EApImpl, buf );
+                }
+            else
+                {
+                DoRunSettingsL( aHighLight, aSelected );
+                }
+            }
+        else
+            {
+            DoRunSettingsL( aHighLight, aSelected );
+            }
+#else
+        DoRunSettingsL( aHighLight, aSelected );
+#endif // __TEST_OOMDEBUG
+        }
+    
+    APSETUILOGGER_LEAVEFN( EApImpl,"Impl::HandleRunSettingsL")
+    }
+
+
+//----------------------------------------------------------
+// CApSettingsHandlerImpl::ChooseBearerTypeL
+//----------------------------------------------------------
+//
+void CApSettingsHandlerImpl::ChooseBearerTypeL( TInt aBearers, 
+                                            CApAccessPointItem& aItem )
+    {
+    APSETUILOGGER_ENTERFN( EApImpl,"Impl::ChooseBearerTypeL")
+    
+    // Check for support in each case!!!!!
+    TBool gprssupported = ETrue;
+    TBool csdsupported = ETrue;         // OK
+    TBool hscsdsupported = ETrue;       // NO WAY TO CHECK IT
+    TBool wlansupported = ETrue;        // OK
+    TBool lansupported = ETrue;         // NO WAY TO CHECK IT
+    TBool lanmodemsupported = ETrue;    // NO WAY TO CHECK IT
+    TBool cdmasupported = ETrue;        // OK
+    
+    if ( iExt->iIsFeatureManagerInitialised )
+        {
+        cdmasupported = FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma );
+        csdsupported = FeatureManager::FeatureSupported( KFeatureIdAppCsdSupport );
+        wlansupported = FeatureManager::FeatureSupported( KFeatureIdProtocolWlan );
+        }
+
+    if ( ( ( aBearers & EApBearerTypeAll ) || 
+        ( aBearers & EApBearerTypeGPRS ) ) &&
+        gprssupported )
+        {
+        aItem.SetBearerTypeL( EApBearerTypeGPRS );
+        }
+    else
+        {
+        if ( ( ( aBearers & EApBearerTypeAll ) || 
+            ( aBearers & EApBearerTypeHSCSD ) ) 
+            && hscsdsupported ) 
+            {
+            aItem.SetBearerTypeL( EApBearerTypeHSCSD );
+            }
+        else
+            {
+            if ( ( ( aBearers & EApBearerTypeAll ) || 
+                (aBearers & EApBearerTypeCSD ) ) && csdsupported )
+                {
+                aItem.SetBearerTypeL( EApBearerTypeCSD );
+                }
+            else
+                {
+                if ( ( ( aBearers & EApBearerTypeAll ) || 
+                    ( aBearers & EApBearerTypeWLAN ) ) 
+                    && wlansupported )
+                    {
+                    aItem.SetBearerTypeL( EApBearerTypeWLAN );
+                    }
+                else
+                    {
+                    if ( ( ( aBearers & EApBearerTypeAll ) || 
+                        ( aBearers & EApBearerTypeLAN ) ) 
+                        && lansupported )
+                        {
+                        aItem.SetBearerTypeL( EApBearerTypeLAN );
+                        }
+                    else
+                        {
+                        if ( ( ( aBearers & EApBearerTypeAll ) || 
+                            ( aBearers & EApBearerTypeLANModem ) )
+                            && lanmodemsupported )
+                            {
+                            aItem.SetBearerTypeL( EApBearerTypeLANModem );
+                            }
+                        else
+                            {
+                            if ( ( ( aBearers & EApBearerTypeAll ) || 
+                                ( aBearers & EApBearerTypeCDMA ) )
+                                && cdmasupported )
+                                {
+                                aItem.SetBearerTypeL( EApBearerTypeCDMA );
+                                }
+                            else
+                                {
+                                User::Leave( KErrInvalidBearerType );
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }    
+    
+    APSETUILOGGER_LEAVEFN( EApImpl,"Impl::ChooseBearerTypeL")
+    }
+
+
+
+
+//----------------------------------------------------------
+// CApSettingsHandlerImpl::HandleDuplicateL
+//----------------------------------------------------------
+//
+TUint32 CApSettingsHandlerImpl::HandleDuplicateL( TUint32 aUid )
+    {
+    APSETUILOGGER_ENTERFN( EApImpl,"Impl::HandleDuplicateL")
+    
+    TUint32 retval(KErrNone);
+    // so user had chosen something
+#ifdef __TEST_OOMDEBUG
+    if ( iMemTestOn )
+        {
+        TInt leavecode( KErrNoMemory );
+        TInt ts( GetTestStateL() );
+        if ( ts == KCreateUseExistTest )
+            {
+            TBuf<48> buf;
+            APSETUILOGGER_WRITE_BUF
+                ( _L("Starting KCreateUseExistTest memtest") );
+            TUint32 rate( 0 );
+            TUint32 retrycount( KOOMRetryCount );
+            TUint32 retryoffset( KOOMRetryOffset );
+            for (
+                rate = 1;
+                ((rate < 50000) && (leavecode == KErrNoMemory))
+                    || retrycount;
+                rate++
+                )
+                {
+                __UHEAP_SETFAIL( RHeap::EDeterministic, rate );
+                TRAP( leavecode, retval = DoHandleApUseOldNewL( aUid ) );
+                __UHEAP_RESET;
+                if ( !leavecode )
+                    {
+                    retrycount--;
+                    rate += retryoffset;
+                    }
+                }
+            User::LeaveIfError( leavecode );
+            buf.Format( _L("\t Memtest finished, max. rate was: %d )"),
+                        rate );
+            APSETUILOGGER_WRITE_BUF( EApImpl, buf );
+            }
+        else
+            {
+            retval = DoHandleApUseOldNewL( aUid );
+            }
+        }
+    else
+        {
+        retval = DoHandleApUseOldNewL( aUid );
+        }
+#else
+        retval = DoHandleApUseOldNewL( aUid );
+#endif // __TEST_OOMDEBUG
+    
+    APSETUILOGGER_LEAVEFN( EApImpl,"Impl::HandleDuplicateL")
+    return retval;
+    }
+
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingshandlerui/src/apsettingsui.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,146 @@
+/*
+* Copyright (c) 2002 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 the handler, CApSettingsUi and oem API for 
+*       the Access Point settings.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <e32base.h>
+
+#include <ApSettingsHandlerCommons.h>
+#include "apsettingsui.h"
+#include "ApsettingshandleruiImpl.h"
+
+#include "ApSettingsHandlerLogger.h"
+#include <data_caging_path_literals.hrh>
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CApSettingsUi::NewLC
+// ---------------------------------------------------------
+//
+EXPORT_C CApSettingsUi* CApSettingsUi::NewLC(
+                                        TBool aStartWithSelection,
+                                        TSelectionListType aListType,
+                                        TSelectionMenuType aSelMenuType,
+                                        TInt aIspFilter,
+                                        TInt aBearerFilter,
+                                        TInt aSortType,
+                                        TInt aReqIpvType,
+                                        TVpnFilterType aVpnFilterType
+                                            )
+    {
+    APSETUILOGGER_CREATE;
+    APSETUILOGGER_ENTERFN( EAPI,"SettingsUi::NewLC")
+
+    CApSettingsUi* db = 
+        new( ELeave ) CApSettingsUi( aStartWithSelection,
+                                          aListType,
+                                          aSelMenuType,
+                                          aReqIpvType
+                                          );
+    CleanupStack::PushL( db );
+    
+
+    db->ConstructL( aIspFilter, aBearerFilter, 
+                    aSortType, aVpnFilterType );
+    APSETUILOGGER_LEAVEFN( EAPI,"SettingsUi::NewLC")    
+    return db;
+    }
+
+
+
+// Destructor
+EXPORT_C CApSettingsUi::~CApSettingsUi()
+    {
+    APSETUILOGGER_DELETE;
+
+    delete iImpl;    
+    }
+
+
+
+
+// Constructor
+CApSettingsUi::CApSettingsUi( TBool aStartWithSelection,
+                            TSelectionListType aListType,
+                            TSelectionMenuType aSelMenuType,
+                            TInt aReqIpvType )
+:iStartWithSelection( aStartWithSelection ),
+iListType( aListType ),
+iSelMenuType( aSelMenuType ),
+iReqIpvType( aReqIpvType )
+    {
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsUi::ConstructL
+// ---------------------------------------------------------
+//
+EXPORT_C void CApSettingsUi::ConstructL( TInt aIspFilter,
+                                         TInt aBearerFilter,
+                                         TInt aSortType,
+                                         TVpnFilterType aVpnFilterType
+                                        )
+    {
+    APSETUILOGGER_ENTERFN( EAPI,"SettingsUi::ConstructL");
+
+    // must place it to a temp variable, otherwise CodeScanner reports 
+    // it as a bad practice putting up member to Cleanupstack, but 
+    // we have NO NewL so we must use this.
+    CApSettingsHandlerImpl* tmp = CApSettingsHandlerImpl::NewLC( 
+                                     iStartWithSelection,
+                                     iListType, iSelMenuType,
+                                     aIspFilter, aBearerFilter, 
+                                     aSortType, iReqIpvType,
+                                     aVpnFilterType,
+                                     EFalse );
+                                     
+    CleanupStack::Pop( tmp );   // soon will be a member, need to pop
+    iImpl = tmp;
+    
+    APSETUILOGGER_LEAVEFN( EAPI,"SettingsUi::ConstructL")    
+    }
+
+
+
+// ---------------------------------------------------------
+// CApSettingsUi::RunSettingsL
+// ---------------------------------------------------------
+//
+EXPORT_C TInt CApSettingsUi::RunSettingsL( TUint32 aHighLight,
+                                                TUint32& aSelected )
+    {
+    APSETUILOGGER_ENTERFN( EAPI,"SettingsUi::RunSettingsL")
+    __ASSERT_DEBUG( iImpl, Panic( ENullPointer ) );
+
+    iImpl->RunSettingsL( aHighLight, aSelected );
+    
+    APSETUILOGGER_LEAVEFN( EAPI,"SettingsUi::RunSettingsL")
+    
+    return iImpl->EventStore();
+    }
+
+
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingsplugin/data/1020736C.rss	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,44 @@
+/*
+* 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: 
+*        ECOM plugin resource file for AP Settings plugin.
+*
+*
+*/
+
+#include <ecom/registryinfo.rh>
+
+RESOURCE REGISTRY_INFO theInfo
+	{
+	dll_uid     = 0x1020736C; // Plugin dll UID
+	interfaces  = 
+		{
+		INTERFACE_INFO
+			{
+			interface_uid   = 0x10207236; // UID for CGSPluginInterface
+			implementations = 
+				{
+				IMPLEMENTATION_INFO
+					{
+					implementation_uid  = 0x1020736B; // Plugin UID 
+					version_no          = 1;
+					display_name        = "AP Settings Plugin"; // Plugin debug name
+					default_data        = "0x200255B9"; // Parent UID (gsconnsettingsplugin)
+					opaque_data         = "60"; // Order number
+					}
+				};
+			}
+		};
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingsplugin/data/ApSettingsPluginRsc.rss	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,65 @@
+/*
+* 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: 
+*        Resource file for ApSettingsPlugin
+*
+*/
+
+
+//  RESOURCE IDENTIFIER
+NAME    PAPS // 4 letter ID
+
+//  INCLUDES
+#include    <bldvariant.hrh>
+#include    <avkon.rh>
+#include    <avkon.rsg>
+#include    <EIKCORE.rsg>
+#include    <eikon.rh>
+#include    <eikon.rsg>
+#include    <data_caging_paths_strings.hrh>
+
+#include    <apsettingsplugin.loc>
+
+//  RESOURCE DEFINITIONS 
+
+//---------------------------------------------------- 
+//    
+//    Needed or loading the resource fails!
+//
+//----------------------------------------------------
+//
+RESOURCE RSS_SIGNATURE
+    {
+    }
+
+//----------------------------------------------------
+//   
+//    qtn_set_access_points 
+//    Caption for Plugin.
+//
+//----------------------------------------------------
+//
+RESOURCE TBUF r_qtn_netw_conset_network_connections 
+    { buf = qtn_netw_conset_network_connections ; }
+
+//----------------------------------------------------
+//   
+//    r_qtn_err_os_general 
+//    Caption for Plugin.
+//
+//----------------------------------------------------
+//
+RESOURCE TBUF r_qtn_err_os_general { buf = qtn_err_os_general ; }
+
+//End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingsplugin/group/ApSettingsPlugin.mmp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,77 @@
+/*
+* 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 ApSettingsPlugin.
+*
+*
+*/
+
+#include <data_caging_paths.hrh>    //this is needed for RESOURCE_FILES_DIR
+#include <platform_paths.hrh>
+
+CAPABILITY          CAP_ECOM_PLUGIN
+TARGET              ApSettingsPlugin.dll
+TARGETTYPE          PLUGIN
+UID                 0x10009D8D 0x1020736C
+VENDORID            VID_DEFAULT
+
+SOURCEPATH          ../src
+SOURCE              APSettingsPlugin.cpp
+SOURCE              ApSettingsPluginImplementationTable.cpp
+SOURCE              utilities.cpp
+
+// Component specific internal headers 
+USERINCLUDE			../inc
+
+// ADO specific internal headers 
+SYSTEMINCLUDE		../../../inc
+
+//Macro to /epoc32 headers
+MW_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH          ../data
+
+//ECOM resource definition
+START RESOURCE      1020736C.rss
+TARGET              ApSettingsPlugin.rsc
+END // ECOM resource definition
+
+//ApSettingsPlugin resources
+START RESOURCE      ApSettingsPluginRsc.rss
+HEADER
+TARGETPATH          RESOURCE_FILES_DIR
+LANGUAGE_IDS
+END // ApSettingsPlugin resources
+
+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             commonengine.lib//For RConeResourceLoader
+LIBRARY             GSFramework.lib
+LIBRARY             egul.lib // CGulIcon
+LIBRARY             aknskins.lib // AknsUtils.h
+LIBRARY             ApSettingsHandlerUI.lib //ApSettingsHandlerUI.h
+LIBRARY             GSEcomPlugin.lib
+LIBRARY             commonui.lib 
+LIBRARY 			aknnotify.lib
+LIBRARY	            centralrepository.lib
+LIBRARY             cmmanager.lib
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingsplugin/group/apsettingspluginicons.mk	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,66 @@
+#
+# 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 ApSettingsPlugin
+#
+
+ifeq (WINS,$(findstring WINS, $(PLATFORM)))
+ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\Z
+else
+ZDIR=\epoc32\data\z
+endif
+
+
+TARGETDIR=$(ZDIR)\resource\apps
+ICONTARGETFILENAME=$(TARGETDIR)\apsettingsplugin.mif
+
+HEADERDIR=\epoc32\include
+HEADERFILENAME=$(HEADERDIR)\apsettingsplugin.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_accp.bmp 
+
+FREEZE : do_nothing
+
+SAVESPACE : do_nothing
+
+RELEASABLES :
+	@echo $(HEADERFILENAME)&& \
+	@echo $(ICONTARGETFILENAME)
+
+FINAL : do_nothing
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingsplugin/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,46 @@
+/*
+* 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 ApSettingsPlugin
+*
+*/
+
+
+#ifdef RD_GS_RENOVATION // This is the GS_RENOVATION
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT  
+
+PRJ_EXPORTS
+// export iby files
+../rom/ApSettingsPlugin.iby		CORE_MW_LAYER_IBY_EXPORT_PATH(ApSettingsPlugin.iby)
+../rom/ApSettingsPluginResources.iby	LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(ApSettingsPluginResources.iby)
+
+// export localised loc file
+../loc/ApSettingsPlugin.loc	MW_LAYER_LOC_EXPORT_PATH(apsettingsplugin.loc)
+
+PRJ_MMPFILES
+./ApSettingsPlugin.mmp
+
+PRJ_EXTENSIONS
+START EXTENSION s60/mifconv
+OPTION TARGETFILE apsettingsplugin.mif
+OPTION HEADERFILE apsettingsplugin.mbg
+OPTION SOURCES -c16,8 qgn_prop_set_conn_accp
+END
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingsplugin/inc/APSettingsPlugin.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,113 @@
+/*
+* 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: 
+*        Header file for CApSettingsPlugin class.
+*
+*/
+
+#ifndef __AP_SETTINGS_PLUGIN_H__
+#define __AP_SETTINGS_PLUGIN_H__
+
+// System includes
+#include <e32def.h>
+#include <e32cmn.h>
+#include <GSPluginInterface.h>
+#include <ConeResLoader.h>
+
+// Forward declaration
+class CApSettingsPluginContainer;
+
+/**
+* Wrapper class for AP Settings Handler UI. 
+*/
+class CApSettingsPlugin : public CGSPluginInterface
+    {
+    public://Constructors & destructors
+
+        /**
+        * First phase constructor
+        * Creates new Plugin and Launches APSettingsHandlerUI
+        * with default parameters
+        */ 
+        static CApSettingsPlugin* NewL( TAny* aInitParams );
+                        
+        /**
+        * Destructor
+        */
+        ~CApSettingsPlugin();
+        
+    public: // Functions from base class
+        
+        /**
+        * from CAknView
+        */
+        TUid Id() const;
+        
+        void DoActivateL( const TVwsViewId& aPrevViewId, 
+                          TUid aCustomMessageId, 
+                          const TDesC8& aCustomMessage );
+    
+        void DoDeactivate();
+
+    public:
+    
+        /**
+        * from CGSPluginInterface
+        */
+
+        void GetCaptionL( TDes& aCaption ) const;
+
+        TBool HasBitmap() const;
+  
+        void GetBitmapL( CFbsBitmap* aBitmap, CFbsBitmap* aMask ) const;
+        
+        TInt PluginProviderCategory() const; 
+        
+        void HandleSelection( const TGSSelectionTypes aSelectionType );
+          
+        TGSListboxItemTypes ItemType();
+        
+        CGulIcon* CreateIconL( const TUid aIconType );
+            
+        TBool Visible() const;
+
+    protected:
+    
+        /**
+        * Constructor
+        */
+        CApSettingsPlugin();
+
+    private:
+    
+        /**
+        * Second phase constructor
+        */
+        TAny ConstructL();
+        
+        /**
+        * Creates and starts WLAN Settings UI 
+        */
+        void DoSettingsL();
+                     
+    private: //data
+        
+        //@var resource loader
+        RConeResourceLoader iResources;
+        TInt iApSettingsSupported;
+
+    };
+
+#endif //__AP_SETTINGS_PLUGIN_H__
+//End of file
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingsplugin/inc/utilities.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,59 @@
+/*
+* 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: 
+*        Header file for Utilities class.
+*
+*/
+
+#ifndef __UTILITIES_H__
+#define __UTILITIES_H__
+
+// System includes
+#include <e32def.h>
+
+/**
+* Utilities class.
+*/
+class Utilities
+    {
+    public:
+
+        /**
+        * Shows an error note if it can be resolved by the error resolver or
+        * a general error note if the given error code cannot be resolved.
+        * @param aErrorCode Error code.
+        */ 
+        static void ShowErrorNote(TInt errorCode);
+       
+    private:
+    
+        /**
+        * Shows an error note if it can be resolved by the error resolver.
+        * @param aErrorCode Error code.
+        * @return True if the error note was showned, 
+        *         false if not showed.
+        */
+        static TBool ShowErrorNoteL(TInt aErrorCode);
+        
+        /**
+        * Shows a general error note "System error" (qtn.err.os.general).
+        */
+        static void ShowGeneralErrorNoteL();
+         
+    private: //data
+
+    };
+
+#endif //__WLAN_SETTINGS_PLUGIN_H__
+//End of file
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingsplugin/loc/apsettingsplugin.loc	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,48 @@
+/*
+* 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: 
+*		Localization strings for Plugin
+*
+*/
+
+
+//  LOCALISATION STRINGS
+
+
+//d:Text of a list item in Connection view's list
+//d:Item opens Access points view
+//l:list_single_large_graphic_pane_t1
+//r:3.1
+//
+#define qtn_set_folder_conn_accpoints "Access points"
+        
+//d: In case of error, the error code is passed to error resolver
+//d: and the error note is displayed accordingly. If error resolver
+//d: cannot resolve the error, an error note "System error" is displayed.
+//l: popup_note_window/opt2
+//w:
+//r:3.1
+//
+#define qtn_err_os_general "System error"
+
+//d:Text of a list item in Connection view's list
+//d:Item opens Access points view
+//l:list_single_large_graphic_pane_t1_cp2
+//r:3.2
+//
+#define qtn_netw_conset_network_connections "Network destinations"
+
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingsplugin/rom/ApSettingsPlugin.iby	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* 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 ApSettingsPlugin
+*
+*/
+
+
+#ifndef __APSETTINGSPLUGIN_IBY__
+#define __APSETTINGSPLUGIN_IBY__
+
+ECOM_PLUGIN(ApSettingsPlugin.DLL,1020736C.rsc)
+
+SCALABLE_IMAGE(APP_BITMAP_DIR,APP_BITMAP_DIR,apsettingsplugin)
+
+
+#endif __APSETTINGSPLUGIN_IBY__
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingsplugin/rom/ApSettingsPluginResources.iby	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,24 @@
+/*
+* 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 ApSettingsPlugin
+*
+*/
+
+
+#ifndef __APSETTINGSPLUGIN_RESOURCES_IBY__
+#define __APSETTINGSPLUGIN_RESOURCES_IBY__
+
+data=DATAZ_\RESOURCE_FILES_DIR\ApSettingsPluginRsc.rsc RESOURCE_FILES_DIR\ApSettingsPluginRsc.rsc
+
+#endif __APSETTINGSPLUGIN_RESOURCES_IBY__
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingsplugin/src/APSettingsPlugin.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,264 @@
+/*
+* 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:  ApSettingsPlugin class.
+*
+*/
+
+
+// INCLUDE FILES
+
+// User includes
+#include "APSettingsPlugin.h"
+#include "StringLoader.h"
+#include "utilities.h"
+
+#include <cmsettingsui.h>
+
+// System includes
+#include <eikon.hrh>
+#include <f32file.h>
+#include <ConeResLoader.h>
+#include <ApSettingsPluginRsc.rsg>
+#include <data_caging_path_literals.hrh>
+#include <apsettingsplugin.mbg>
+#include <SettingsInternalCRKeys.h>
+#include <centralrepository.h>
+
+
+const TInt KDefaultAPSettingsValue 	  = 1;	// AP settings UI supported
+
+// Resource file location
+_LIT( KApSettingsPluginRscFileName, "ApSettingsPluginRsc.rsc" );
+
+// This UID is used for both the view UID 
+// and the ECOM plugin implementation ID.
+const TUid KApSettingsPluginUid = { 0x1020736B };
+
+// ROM folder
+_LIT( KDriveZ, "z:" );
+
+// Name of the MBM file containing icons
+_LIT( KFileIcons, "apsettingsplugin.mbm");
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CApSettingsPlugin::NewL
+// First phase constructor
+// ---------------------------------------------------------
+CApSettingsPlugin* CApSettingsPlugin::NewL( TAny* /*aInitParams*/ )
+    {
+    CApSettingsPlugin* self = new ( ELeave ) CApSettingsPlugin();
+    CleanupStack::PushL( self );
+    
+    self->ConstructL();
+                      
+    CleanupStack::Pop( self );
+    return self;     
+    }
+
+// ---------------------------------------------------------
+// CApSettingsPlugin::~CApSettingsPlugin
+// Destructor
+// ---------------------------------------------------------
+CApSettingsPlugin::~CApSettingsPlugin()
+    {
+    iResources.Close();
+#ifdef _DEBUG
+    RDebug::Print( _L( "[CApSettingsPlugin] ~CApSettingsPlugin()" ) );
+#endif
+    }
+
+// ---------------------------------------------------------
+// CApSettingsPlugin::Id
+// ---------------------------------------------------------
+TUid CApSettingsPlugin::Id() const
+    {
+    return KApSettingsPluginUid;
+    }
+ 
+// ---------------------------------------------------------
+// CApSettingsPlugin::DoActivateL()
+// ---------------------------------------------------------      
+void CApSettingsPlugin::DoActivateL( const TVwsViewId& /*aPrevViewId*/, 
+                          TUid /*aCustomMessageId*/, 
+                          const TDesC8& /*aCustomMessage*/ )
+    {
+    //no implementation required
+    }
+    
+// ---------------------------------------------------------
+// CApSettingsPlugin::DoDeactivate()
+// ---------------------------------------------------------
+void CApSettingsPlugin::DoDeactivate()
+    {
+    //no implementation required
+    }
+       
+// ---------------------------------------------------------
+// CApSettingsPlugin::GetCaption
+// ---------------------------------------------------------
+void CApSettingsPlugin::GetCaptionL( TDes& aCaption ) const
+    {
+    StringLoader::Load( aCaption, R_QTN_NETW_CONSET_NETWORK_CONNECTIONS  );
+    }
+
+// ---------------------------------------------------------
+// CApSettingsPlugin::HasBitmap
+// ---------------------------------------------------------
+TBool CApSettingsPlugin::HasBitmap() const
+    {
+    return EFalse;
+    }
+
+// ---------------------------------------------------------
+// CApSettingsPlugin::GetBitmapL
+// ---------------------------------------------------------
+void CApSettingsPlugin::GetBitmapL( CFbsBitmap* /*aBitmap*/, 
+                                    CFbsBitmap* /*aMask*/ ) const
+    {
+    //no bitmap
+    User::Leave( KErrNotFound );
+    }
+    
+// ---------------------------------------------------------
+// CApSettingsPlugin::PluginProviderCategory
+// ---------------------------------------------------------
+TInt CApSettingsPlugin::PluginProviderCategory() const
+    {
+    return EGSPluginProviderOEM;
+    }
+    
+// ---------------------------------------------------------
+// CApSettingsPlugin::HandleSelection
+// ---------------------------------------------------------   
+void CApSettingsPlugin::HandleSelection(
+            const TGSSelectionTypes /*aSelectionType*/ )
+    {
+    TRAPD( error, DoSettingsL() );
+    
+    if( error && error != KLeaveWithoutAlert )
+        {
+        Utilities::ShowErrorNote(error);
+        }    
+    }
+
+// ---------------------------------------------------------
+// CApSettingsPlugin::ItemType
+// ---------------------------------------------------------
+TGSListboxItemTypes CApSettingsPlugin::ItemType()
+    {
+    return EGSItemTypeSettingDialog;
+    }
+    
+// ---------------------------------------------------------
+// CApSettingsPlugin::CreateIconL
+// ---------------------------------------------------------    
+CGulIcon* CApSettingsPlugin::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,
+        EMbmApsettingspluginQgn_prop_set_conn_accp,
+        EMbmApsettingspluginQgn_prop_set_conn_accp_mask );
+        }
+     else
+        {
+        icon = CGSPluginInterface::CreateIconL( aIconType );
+        }
+	
+	return icon;
+    }    
+
+// ---------------------------------------------------------
+// CApSettingsPlugin::Visible
+// -----------------------------------------------
+TBool CApSettingsPlugin::Visible() const
+    {
+  	if ( iApSettingsSupported == KDefaultAPSettingsValue )
+  		{
+  		return ETrue;
+		}
+	else
+		{
+		return EFalse;
+		}
+    }
+
+// ---------------------------------------------------------
+// CApSettingsPlugin::CApSettingsPlugin
+// ---------------------------------------------------------
+CApSettingsPlugin::CApSettingsPlugin():
+    iResources( *CCoeEnv::Static() )
+    {
+    // no implementation required
+    }
+
+// ---------------------------------------------------------
+// CApSettingsPlugin::ConstructL
+// ---------------------------------------------------------
+TAny CApSettingsPlugin::ConstructL()
+    {
+    
+#ifdef _DEBUG    
+    RDebug::Print( _L("[CApSettingsPlugin] ConstructL()" ) );
+    RDebug::Print( _L( "[CApSettingsPlugin] Loading resource from :" ) );
+    RDebug::Print( KApSettingsPluginRscFileName );
+#endif
+    
+    BaseConstructL();
+        
+    TFileName fileName;
+    TDriveUnit drive( EDriveZ );
+    
+    fileName.Append( drive.Name() );
+    fileName.Append( KDC_RESOURCE_FILES_DIR );
+    fileName.Append( KApSettingsPluginRscFileName );
+    
+    iResources.OpenL( fileName );
+    
+  	iApSettingsSupported = KDefaultAPSettingsValue;
+    }
+    
+// ---------------------------------------------------------
+// CApSettingsPlugin::DoSettingsL
+// ---------------------------------------------------------
+void CApSettingsPlugin::DoSettingsL()
+    {
+    CCmSettingsUi* settings = CCmSettingsUi::NewL();
+    CleanupStack::PushL( settings );
+    
+    if( settings->RunSettingsL() == CCmSettingsUi::EExit )
+        {
+        //exit from General Settings
+        ProcessCommandL( EAknCmdExit );
+        }
+    
+    CleanupStack::PopAndDestroy( settings );
+    }
+    
+
+//End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingsplugin/src/ApSettingsPluginImplementationTable.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,45 @@
+/*
+* 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: 
+*        ECOM proxy table for this plugin
+*
+*/
+
+
+// System includes
+#include <e32std.h>
+#include <ecom/implementationproxy.h>
+
+// User includes
+#include "APSettingsPlugin.h"
+
+// Constants
+const TImplementationProxy KApSettingsPluginImplementationTable[] = 
+    {
+    IMPLEMENTATION_PROXY_ENTRY(0x1020736B,    CApSettingsPlugin::NewL)
+    };
+
+
+// ---------------------------------------------------------------------------
+// ImplementationGroupProxy
+// Gate/factory function
+//
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+    {
+    aTableCount = sizeof(KApSettingsPluginImplementationTable) 
+        / sizeof(TImplementationProxy);
+    return KApSettingsPluginImplementationTable;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/apsettingsplugin/src/utilities.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,78 @@
+/*
+* Copyright (c) 2004 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 utilities functions.   
+*      
+*
+*/
+
+
+// INCLUDE FILES
+#include "utilities.h"
+
+#include <ErrorUI.h>
+#include <AknGlobalNote.h>
+#include <StringLoader.h>
+#include <ApSettingsPluginRsc.rsg>
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// Utilities::ShowErrorNote
+// ---------------------------------------------------------
+//
+void Utilities::ShowErrorNote(TInt aErrorCode)
+    {
+    TBool errorNoteShowed = EFalse;
+        
+    TRAPD(error, errorNoteShowed = ShowErrorNoteL(aErrorCode));
+            
+    if(error || !errorNoteShowed) 
+        {
+        TRAP_IGNORE( ShowGeneralErrorNoteL() );
+        }    
+    }
+
+// ---------------------------------------------------------
+// Utilities::ShowErrorNoteL
+// ---------------------------------------------------------
+//
+TBool Utilities::ShowErrorNoteL(TInt aErrorCode)
+    {
+    CErrorUI* errorUi = CErrorUI::NewLC();
+    
+    TBool errorNoteShowed = errorUi->ShowGlobalErrorNoteL( aErrorCode );
+    
+    CleanupStack::PopAndDestroy( errorUi );
+        
+    return errorNoteShowed;
+    }    
+
+// ---------------------------------------------------------
+// Utilities::ShowGeneralErrorNoteL
+// ---------------------------------------------------------
+//
+void Utilities::ShowGeneralErrorNoteL()
+    {
+    HBufC *msg = StringLoader::LoadLC( R_QTN_ERR_OS_GENERAL );
+
+    CAknGlobalNote *note = CAknGlobalNote::NewLC();
+    
+    
+    note->ShowNoteL( EAknGlobalErrorNote, *msg );
+
+
+    CleanupStack::PopAndDestroy( note );
+    CleanupStack::PopAndDestroy( msg );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apengine/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+#include "../apeng/group/bld.inf"
+#include "../apsettingshandlerui/group/bld.inf"
+#include "../apsettingsplugin/group/bld.inf"
+
+PRJ_TESTMMPFILES
\ No newline at end of file
Binary file bearermanagement/S60MCPR/data/s60mcpr.confml has changed
Binary file bearermanagement/S60MCPR/data/s60mcpr_101F6D4A.crml has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/S60MCPR/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2008 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: S60 MCPR and TM
+*
+*/
+
+#include <platform_paths.hrh>
+
+#ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
+
+PRJ_EXPORTS
+../rom/s60mcpr.iby     CORE_MW_LAYER_IBY_EXPORT_PATH(s60mcpr.iby)
+
+../data/s60mcpr.confml          MW_LAYER_CONFML(s60mcpr.confml)
+../data/s60mcpr_101F6D4A.crml   MW_LAYER_CRML(s60mcpr_101F6D4A.crml)
+
+PRJ_MMPFILES
+../group/s60mcpr.mmp
+
+PRJ_TESTMMPFILES
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/S60MCPR/group/s60mcpr.mmp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: S60 MCPR and TM
+ *
+ */
+
+
+#include <cflog.mmh>
+#include <platform_paths.hrh>
+
+TARGET            s60mcpr.dll
+TARGETTYPE        PLUGIN
+
+UID               0x10009D8D 0x101F6D4A 
+VENDORID          0x70000001
+
+// Enable the utrace logging
+MACRO             SYMBIAN_TRACE_ENABLE
+
+USERINCLUDE       ../inc
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE   ../../../inc
+
+SOURCEPATH        ../src
+
+SOURCE            s60mcpr.cpp
+SOURCE            s60mcprfactory.cpp
+SOURCE            s60mcprstates.cpp
+SOURCE            s60mcpractivities.cpp
+SOURCE            s60mcprmobilityactivity.cpp
+SOURCE            s60mcprerrorrecoveryactivity.cpp
+SOURCE            s60mcprsimpleselectactivity.cpp
+SOURCE            s60mpmrequests.cpp
+SOURCE            s60mpmnotifications.cpp
+SOURCE            s60tiermanager.cpp
+SOURCE            s60tiermanagerfactory.cpp
+SOURCE            s60tiermanagerselector.cpp
+SOURCE            s60extendedtmselector.cpp
+SOURCE            s60tmactivities.cpp
+SOURCE            s60tmprovideractivity.cpp
+SOURCE            ecom_impl.cpp
+#ifdef SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
+SOURCE            s60tcprecvwin.cpp
+#endif
+
+
+START RESOURCE 101F6D4A.rss
+TARGET            s60mcpr.rsc
+END
+
+LIBRARY euser.lib
+LIBRARY esocksvr.lib
+LIBRARY serverden.lib
+LIBRARY esock.lib
+LIBRARY netmeta.lib
+LIBRARY netsm.lib
+LIBRARY commsfw.lib
+LIBRARY coreproviders.lib
+LIBRARY mobilitycoreproviders.lib
+LIBRARY esock_api_ext.lib
+LIBRARY commsdat.lib
+LIBRARY simpleselectorbase.lib
+LIBRARY insock.lib
+LIBRARY nodemessages.lib
+LIBRARY meshmachine.lib
+LIBRARY netinterfaces.lib
+LIBRARY virtualconstructors.lib
+LIBRARY factories.lib
+LIBRARY mpm.lib
+LIBRARY commdb.lib
+LIBRARY extendedconnpref.lib
+#ifdef SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
+LIBRARY centralrepository.lib
+#endif
+
+//MI support
+#include <elements/sd_mintercept.mmh>
+
+
+
+CAPABILITY CommDD PowerMgmt ReadDeviceData WriteDeviceData TrustedUI ProtServ NetworkControl NetworkServices LocalServices ReadUserData WriteUserData
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/S60MCPR/inc/s60extendedtmselector.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2008 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: S60 IP tier manager selector
+*
+*/
+
+/**
+@file s60tiermanagerselector.h
+S60 IP TM selector.
+*/
+
+#ifndef S60EXTENDEDTMSELECTOR_H
+#define S60EXTENDEDTMRSELECTOR_H
+
+#include <comms-infras/simpleselectorbase.h>
+
+// Forward declaration
+class ESock::CMetaConnectionProviderBase;
+
+/**
+ * TS60ProviderSelectorFactory
+ */
+class TS60ProviderSelectorFactory
+    {
+public:
+    static ESock::MProviderSelector* NewSelectorL(const Meta::SMetaData& aSelectionPreferences);
+    };
+
+/**
+ * CExtendedS60SelectorBase
+ * Base for simple selectors.
+ */
+class CExtendedS60SelectorBase : public CBase, public ASimpleSelectorBase
+    {
+public:
+    explicit CExtendedS60SelectorBase( TUid aTierId, const ESock::RConnPrefList& aConnPrefList );
+    virtual ~CExtendedS60SelectorBase();
+
+protected:
+    ESock::ISelectionNotify iSelectionNotify; //Needed as a member because of the asynch selection
+private:
+    /**
+     * Implements the selection logic
+     */
+    virtual void SelectL( ESock::ISelectionNotify& aSelectionNotify );
+    /**
+     * Instantiates the MCPR or finds an old one that can be reused.
+     */
+    ESock::CMetaConnectionProviderBase* FindOrCreateProviderL( TUint aAccessPoint );
+private:
+    TUint32 iDefaultAp;    
+    ESock::RConnPrefList iConnPrefList;
+    TUid iTierId;
+    TSubSessionUniqueId iSubSessionUniqueId;
+    };
+
+#endif // S60IPTIERMANAGERSELECTOR_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/S60MCPR/inc/s60mcpr.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,271 @@
+/*
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: S60 MCPR class that represents the MCPR NODE in MeshMachine
+*
+*/
+
+/**
+@file s60mcpr.h
+S60 MCPR class that represents the MCPR NODE in MeshMachine
+*/
+
+#ifndef S60MCPR_H
+#define S60MCPR_H
+
+// MCPR includes 
+#include <comms-infras/mobilitymcpr.h>
+
+#include "s60mpmpolicyinterfaces.h" // MMPMPolicyNotificationUser
+#include "s60mcprmpmlog.h"
+
+// S60MCPR Panic definitions.
+_LIT(KS60MCprPanic, "S60MCprPanic");
+static const TInt KPanicNoActivity = 1;
+static const TInt KPanicNoContext = 2;
+static const TInt KPanicNoServiceProvider = 3;
+static const TInt KPanicInvalidCActiveUsage = 4;
+static const TInt KPanicUnsupportedMCPRState = 5;
+static const TInt KPanicInConsistentMCPRState = 6;
+static const TInt KPanicNoDataClient = 7;
+static const TInt KPanicPeerMessage = 8;
+
+// Forward declaration
+class CMPMPolicyRequests;
+class RConnPrefList;
+
+/**
+ * Message realm of S60MCPR.
+ */
+class TCFS60MCPRMessage 
+    {         
+  public: 
+    enum { ERealmId = 0x101F6D4B };
+  private: 
+          enum 
+            {         
+            EMPMReselectBestIAPCompletedMsg = 1,
+            EMPMIAPConnectionStartedCompletedMsg,
+            EMPMIAPConnectionStoppedCompletedMsg,
+            EMPMChooseBestIAPCompletedMsg,
+            EMPMProcessErrorCompletedMsg,
+            EMPMPreferredCarrierAvailableMsg,
+            EMPMStartIAPNotificationMsg,
+            EMPMErrorNotificationMsg,
+            };
+  public: 
+    typedef Messages::TMessageSigVoid<EMPMReselectBestIAPCompletedMsg, TCFS60MCPRMessage::ERealmId>     TMPMReselectBestIAPCompletedMsg;
+    typedef Messages::TMessageSigVoid<EMPMChooseBestIAPCompletedMsg, TCFS60MCPRMessage::ERealmId>       TMPMChooseBestIAPCompletedMsg;
+    typedef Messages::TMessageSigNumber<EMPMProcessErrorCompletedMsg, TCFS60MCPRMessage::ERealmId>      TMPMProcessErrorCompletedMsg;
+    typedef Messages::TMessageSigAny<EMPMPreferredCarrierAvailableMsg, TCFS60MCPRMessage::ERealmId>     TMPMPreferredCarrierAvailableMsg;
+    typedef Messages::TMessageSigNumber<EMPMStartIAPNotificationMsg, TCFS60MCPRMessage::ERealmId>       TMPMStartIAPNotificationMsg;
+    typedef Messages::TMessageSigNumber<EMPMErrorNotificationMsg, TCFS60MCPRMessage::ERealmId>          TMPMErrorNotificationMsg;
+    };
+
+/**
+ * CS60MetaConnectionProvider
+ * 
+ * CMobilityMetaConnectionProvider implements Symbian core code for MCPR classes.
+ * MMPMPolicyNotificationUser is the callback interface implementation for MPM notifications.
+ * 
+ * Class manages one Network-level connection using activities and MPM.
+ */
+NONSHARABLE_CLASS(CS60MetaConnectionProvider)
+    :   public CMobilityMetaConnectionProvider, 
+        public MMPMPolicyNotificationUser
+    {
+    friend class CS60MobilityActivity;
+public:
+    /**
+     * Two-phased constructor.
+     * @param aFactory reference to CMetaConnectionProviderFactoryBase
+     * @param aProviderInfo reference to TProviderInfo
+     */
+    static CS60MetaConnectionProvider* NewL( ESock::CMetaConnectionProviderFactoryBase& aFactory,
+                                             const ESock::TProviderInfo& aProviderInfo );
+    /**
+     * Copies selection preferences to S60MCPR member variable
+     * @param aPrefs reference to selection preferences
+     */
+    void SetSelectionPrefs( ESock::TSelectionPrefs& aPrefs );
+    /**
+     * Gets selection preferences from S60MCPR member variable
+     * @return reference to original selection preferences
+     */
+    const ESock::TSelectionPrefs& SelectionPrefs();
+    /**
+     * Set connection preference list
+     * @param aConnPrefList New connection preference list
+     */    
+    void SetConnPrefList( const ESock::RConnPrefList &aConnPrefList );
+    /**
+     * Get connection preference list
+     * @return reference to original selection preferences
+     */    
+    ESock::RConnPrefList ConnPrefList() const;
+    /**
+     * Set sub-session unique id
+     * @param aSubSessionUniqueId
+     */    
+    void SetSubSessionUniqueId( const TSubSessionUniqueId aSubSessionUniqueId);
+    /**
+     * Get sub-session unique id
+     * @return sub session unique id
+     */    
+    TSubSessionUniqueId SubSessionUniqueId() const;
+
+    /**
+     * Copies policy preferences to S60MCPR member variable
+     * @param aPrefs reference to policy preferences
+     */
+    void SetPolicyPrefs( TPolicyConnPref& aPrefs );
+    /**
+     * Gets policy preferences from S60MCPR member variable
+     * @return reference to policy selection preferences
+     */
+    TPolicyConnPref& PolicyPrefs();
+    /**
+     * Gets pointer to CMPMPolicyRequests.
+     * @return pointer to CMPMPolicyRequests instance. 
+     */
+    CMPMPolicyRequests* Policy();
+    /**
+     * Used by DataClientStatusNotification only.
+     * Modifies iDataClientStatusStarted.
+     * 
+     * @return ETrue if allowed to send status notification "started"
+     */
+    TBool RequestPermissionToSendStarted();
+    /**
+     * Used by DataClientStatusNotification only.
+     * Modifies iDataClientStatusStarted.
+     * 
+     * @return ETrue if allowed to send status notification "stopped"
+     */
+    TBool RequestPermissionToSendStopped();
+    
+    /**
+     * S60 MCPR implementation of CMobilityMetaConnectionProvider IsHandshakingNow()
+     * 
+     * @return ETrue if in the middle of mobility handshake
+     */
+    TBool IsHandshakingNow() const; //Used by other activities to check the mobility status
+    
+    /**
+     * Sets handshaking flag. 
+     */
+    void SetHandshakingFlag();
+    
+    /**
+     * Clears handshaking flag. 
+     */
+    void ClearHandshakingFlag();
+    
+    /**
+     * Re-send last received policy notification if it exists.
+     */
+    void ReSendPolicyNotification();
+    
+    /**
+     * Clears last received policy notification.
+     */
+    void ClearPolicyNotification();
+    
+public: // from MMPMPolicyNotificationUser
+    
+    /**
+    * Called by AO listening MPM notifications.
+    * @param aNotification Generic nsotification structure class
+    */
+    void PolicyNotification( TMpmNotification& aNotification );
+    
+protected:
+    /**
+     * C++ default constructor.
+     * 
+     * @param aFactory reference to CMetaConnectionProviderFactoryBase
+     * @param aProviderInfo reference to TProviderInfo
+     * @param aActivityMap reference to activities
+     */
+    CS60MetaConnectionProvider( ESock::CMetaConnectionProviderFactoryBase& aFactory,
+                                const ESock::TProviderInfo& aProviderInfo,
+                                const MeshMachine::TNodeActivityMap& aActivityMap );
+    /**
+    * 2nd phase constructor.
+    */
+    void ConstructL();
+    
+    /**
+    * Destructor.
+    */
+    virtual ~CS60MetaConnectionProvider();
+    
+    /**
+    * Message receiving function which is implemented in the base class.
+    * 
+    * @param aSender
+    * @param aRecipient
+    * @param aMessage
+    */
+    virtual void ReceivedL( const Messages::TRuntimeCtxId& aSender, 
+                            const Messages::TNodeId& aRecipient, 
+                            Messages::TSignatureBase& aMessage );
+    
+    /**
+     * Stores the received policy notification.
+     */
+    void StorePolicyNotification( TMpmNotification& aNotification );
+    
+private:
+    /**
+     * Handle to Policy Server interaction implementation
+     */
+    CMPMPolicyRequests*     iPolicy;
+    /**
+     * Original selection preferences from IP TierMgr/application
+     */
+    ESock::TSelectionPrefs  iOrigPrefs;
+    /**
+     * Selection preferences from MPM. Contains selected AP,
+     * IAP & NET for reconnect, startup or for roaming.
+     */
+    TPolicyConnPref         iPolicyPrefs;
+    
+    /**
+     * In case PolicyServer sends preferred IAP faster than state machine allows,
+     * the preferred IAP Id is stored for further 
+     */
+    TMPMMessageBuffer       iPendingNotification;
+
+    /**
+     * Used to filter out extra notifications because MPM only needs one 
+     * started/stopped event. Implement as simple FlipFlop -flag.
+     */
+    TBool                   iDataClientStatusStarted : 1;
+    /**
+     * Synchronisation flags, private by design, can be modified only by CMobilityActivity
+     */
+    TBool                   iIsHandshakingNow : 1; 
+    
+    /**
+     * Connection preference list
+     */
+    ESock::RConnPrefList    iConnPrefList;
+        
+    /**
+     * Sub-session unique id
+     */
+    TSubSessionUniqueId iSubSessionUniqueId;        
+    };
+
+#endif //S60MCPR_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/S60MCPR/inc/s60mcpractivities.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,817 @@
+/*
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: S60 MCPR's activities.
+*
+*/
+
+/**
+@file s60mcpractivities.h
+S60 MCPR's activities.
+*/
+
+#ifndef S60MCPR_ACTIVITIES_H
+#define S60MCPR_ACTIVITIES_H
+
+#include <comms-infras/mobilitymcpractivities.h>
+
+#include "s60mcprstates.h"
+
+// Forward declarations
+class CS60MetaConnectionProvider;
+
+enum TS60MCprActivities
+    {
+    ECFActivityS60McprServiceIdMessage2Handler = ESock::ECFActivityCustom + 10
+    };
+
+/**
+ * S60MCprActivities namespace contains the 
+ * definition of S60MCPR's activity map. 
+ */
+namespace S60MCprActivities
+    {
+    DECLARE_ACTIVITY_MAP(S60MCprActivityMap)
+    } // namespace S60MCprActivities
+
+
+/**
+ * S60MCprSelectActivity namespace packages the
+ * S60 MCPR's connection selection activity related
+ * states, transitions and forks.
+ * 
+ * The activity doesn't need activity class because it
+ * reuses the Symbian's core implementation for 
+ * selection.
+ * 
+ */
+namespace S60MCprSelectActivity
+    {
+    /**
+     * Execution context definition for meshmachine activities. 
+     */
+    typedef MeshMachine::TNodeContext<CS60MetaConnectionProvider, MobilityMCprStates::TContext> TContext;
+
+    /**
+     * STATE: Waits for valid select message.
+     * @return ETrue if message is accepted.
+     */
+    DECLARE_SMELEMENT_HEADER( TAwaitingSelectNextLayer, 
+                              MeshMachine::TState<TContext>, 
+                              NetStateMachine::MState, 
+                              TContext)
+    virtual TBool Accept();
+    DECLARE_SMELEMENT_FOOTER( TAwaitingSelectNextLayer )
+
+    /**
+     * TRANSITION/ACTION: Makes the selection for next layer based on policy or other obtained preferences. 
+     */
+    DECLARE_SMELEMENT_HEADER( TSelectNextLayer, 
+                              MeshMachine::TStateTransition<TContext>, 
+                              NetStateMachine::MStateTransition, 
+                              TContext )
+    virtual void DoL();
+    DECLARE_SMELEMENT_FOOTER( TSelectNextLayer )
+
+    /**
+     * TRANSITION/ACTION: Requests PolicyServer for Best IAP.  
+     */
+    DECLARE_SMELEMENT_HEADER( TSimpleSelect, 
+                              MeshMachine::TStateTransition<TContext>, 
+                              NetStateMachine::MStateTransition, 
+                              TContext )
+    virtual void DoL();
+    DECLARE_SMELEMENT_FOOTER( TSimpleSelect )
+
+    /**
+     * STATE: Waits for PolicyServer response
+     * @return ETrue if valid message policyresponse is received.
+     */
+    DECLARE_SMELEMENT_HEADER( TAwaitingSimpleSelectComplete, 
+                              MeshMachine::TState<TContext>, 
+                              NetStateMachine::MState, 
+                              TContext)
+    virtual TBool Accept();
+    DECLARE_SMELEMENT_FOOTER( TAwaitingSimpleSelectComplete )
+    }
+
+/**
+ * S60MCprSimpleSelectActivity namespace packages the
+ * S60 MCPR's connection selection activity related
+ * states, transitions and forks.
+ * 
+ * The activity doesn't need activity class because it
+ * reuses the Symbian's core implementation for 
+ * selection.
+ * 
+ */
+namespace S60MCprSimpleSelectActivity
+    {
+    /**
+     * Execution context definition for meshmachine activities. 
+     */
+    typedef MeshMachine::TNodeContext<CS60MetaConnectionProvider, MobilityMCprStates::TContext> TContext;
+    /**
+     * STATE: Waits for valid select message.
+     * @return ETrue if message is accepted.
+     */
+    DECLARE_SMELEMENT_HEADER( TAwaitingSelectNextLayer, 
+                              MeshMachine::TState<TContext>, 
+                              NetStateMachine::MState, 
+                              TContext)
+    virtual TBool Accept();
+    DECLARE_SMELEMENT_FOOTER( TAwaitingSelectNextLayer )
+    /**
+     * TRANSITION/ACTION: Makes the selection for next layer based on policy or other obtained preferences. 
+     */
+    DECLARE_SMELEMENT_HEADER( TSelectNextLayer, 
+                              MeshMachine::TStateTransition<TContext>, 
+                              NetStateMachine::MStateTransition, 
+                              TContext )
+    virtual void DoL();
+    DECLARE_SMELEMENT_FOOTER( TSelectNextLayer )
+    /**
+     * TRANSITION/ACTION: Requests PolicyServer for Best IAP.  
+     */
+    DECLARE_SMELEMENT_HEADER( TChooseBestIAP, 
+                              MeshMachine::TStateTransition<TContext>, 
+                              NetStateMachine::MStateTransition, 
+                              TContext )
+    virtual void DoL();
+    DECLARE_SMELEMENT_FOOTER( TChooseBestIAP )
+    /**
+     * STATE: Waits for PolicyServer response
+     * @return ETrue if valid message policyresponse is received.
+     */
+    DECLARE_SMELEMENT_HEADER( TAwaitingChooseBestIAP, 
+                              MeshMachine::TState<TContext>, 
+                              NetStateMachine::MState, 
+                              TContext)
+    virtual TBool Accept();
+    DECLARE_SMELEMENT_FOOTER( TAwaitingChooseBestIAP )
+    /**
+     * FORK/DECISION: Decides between three different activity execution paths: 
+     * 1. Request PolicyServer for connection preferences.
+     * 2. Proceed and use existing connection preferences.
+     * 3. Bypass selection and just mark new AP active.
+     * @return TransitionTag of the selected transition.
+     */
+    DECLARE_SMELEMENT_HEADER( TChooseBestIAPRequiredOrNoTagOrSetChosenApActive, 
+                              MeshMachine::TStateFork<TContext>, 
+                              NetStateMachine::MStateFork, 
+                              TContext )
+    TInt TransitionTag();
+    DECLARE_SMELEMENT_FOOTER( TChooseBestIAPRequiredOrNoTagOrSetChosenApActive )
+    /**
+     * FORK/DECISION: Decides between two different activity execution path.  
+     * 1. Mark new chose AP active.
+     * 2. Reverse back to next layer tiermanager selection.
+     * @return TransitionTag of the selected transition.
+     */
+    DECLARE_SMELEMENT_HEADER( TSetChosenApActiveOrSelectedProviderBackward, 
+                              MeshMachine::TStateFork<TContext>, 
+                              NetStateMachine::MStateFork, 
+                              TContext )
+    TInt TransitionTag();
+    DECLARE_SMELEMENT_FOOTER( TSetChosenApActiveOrSelectedProviderBackward )
+    /**
+     * TRANSITION/ACTION: Marks the chosen AP active.
+     * 
+     * Transition assumes that the chose AP is already bound to the MCPR 
+     * and will be found from the ServiceProvider -list.
+     */
+    DECLARE_SMELEMENT_HEADER( TSetChosenApActive, 
+                              MeshMachine::TStateTransition<TContext>, 
+                              NetStateMachine::MStateTransition, 
+                              TContext )
+    virtual void DoL();
+    DECLARE_SMELEMENT_FOOTER( TSetChosenApActive )
+    /**
+     * CChooseBestIAPCb is a callback class that receives the policy server response
+     * and converts PolicyResponse -event into meshmachine compatible message. 
+     * 
+     * PolicyServer wrapper API takes pointer of the class implementing the 
+     * MMPMPolicyRequestsUser -interface. The ownership is passed to the wrapper API
+     * because the answer may be delayed and live longer than the execution context 
+     * of the MCPR.
+     */
+    class CChooseBestIAPCb 
+        :   public CBase, 
+            public MMPMPolicyRequestsUser
+        {
+        public:
+            /**
+             * C++ constructor.
+             * 
+             * @param aNode reference to S60 MCPR running the Activity.
+             * @param aActivity pointer to the Activity that requests for PolicyResponse. 
+             */
+            CChooseBestIAPCb( CS60MetaConnectionProvider& aNode, 
+                              MeshMachine::CNodeActivityBase* aActivity )
+                :   iNode(aNode) 
+                { 
+                iLastRequestOriginator.Open( aNode.SelfInterface(), 
+                                             Messages::TNodeCtxId( aActivity->ActivityId(), 
+                                                                   aNode.Id() ));
+                }
+        public: // From MMPMPolicyRequestsUser
+            /**
+             * Called when Policy Server responds to the request.
+             * @param aCompletedRequest contains reference to answer from Policy Server.
+             */
+            virtual void PolicyResponse( PolicyRequest& aCompletedRequest );
+            /**
+             * Interface function that calls CBase-destructor
+             */
+            virtual void Delete() { delete this; }
+        protected: // From CBase
+            /**
+             * C++ destructor.
+             */
+            virtual ~CChooseBestIAPCb() {}
+        private:
+            /**
+             * Valid reference to CS60MetaConnectionProvider
+             */ 
+            CS60MetaConnectionProvider& iNode;
+            /**
+             * Valid reference to request originator.
+             */ 
+            Messages::RRequestOriginator iLastRequestOriginator;
+        };
+
+    } // namespace S60MCprSimpleSelectActivity
+
+/**
+ * S60MCprErrorRecoveryActivity namespace packages the
+ * S60 MCPR's error recovery activity related
+ * states, transitions and forks.
+ */
+namespace S60MCprErrorRecoveryActivity
+    {
+    /**
+     * Execution context definition for meshmachine activities. 
+     */
+    typedef MeshMachine::TNodeContext<CS60MetaConnectionProvider, MCprStates::TContext> TContext;
+    /**
+     * Mutex that blocks the activity during the mobility handshake.  
+     */
+    class THandshakingMobilityMutex
+        {
+        public:
+            /**
+             * @param aContext execution context.
+             * @return ETrue if mobility handshake is in progress.
+             */
+            static TBool IsBlocked(MeshMachine::TNodeContextBase& aContext);
+        };
+    /**
+     * Serialized state. 
+     * Idea is to wait in this state until the mobility handshake is done. 
+     */
+    DECLARE_SERIALIZABLE_STATE( TProcessErrorBlockedByMobilityHandshaking,
+                                THandshakingMobilityMutex,
+                                MeshMachine::TTag<S60MCprStates::KProcessError> )
+
+    /**
+     * CS60ConnectionRecoveryActivity is the S60 version of the ErrorRecovery -activity
+     * that is responsible to process connection errors whenever it happens.
+     *  
+     * -jl- TODO Either finalize or remove S60CConnectionRecoveryActivity after EC158(?) 
+     */
+    class CS60ConnectionRecoveryActivity : public S60MCprStates::CS60ErrorRecoveryActivity
+        {
+        public:
+
+            /**
+             * Symbian two-phase constructor.
+             */
+            static MeshMachine::CNodeActivityBase* NewL( const MeshMachine::TNodeActivity& aActivitySig, 
+                                                         MeshMachine::AMMNodeBase& aNode );
+            /**
+             * Sends response to request originators.
+             */
+            void ReplyToOriginators( Messages::TEErrorRecovery::TErrorRecoveryResponse& aCFMessageSig );
+
+        protected:
+            /**
+             * Context definition
+             */
+            typedef MeshMachine::TNodeContext<CMobilityMetaConnectionProvider, MCprStates::TContext> TContext;
+
+        public:
+            /**
+             * STATE: Waits for reconnect activity to complete.
+             */
+            DECLARE_SMELEMENT_HEADER( TAwaitingReConnectComplete, 
+                                      MeshMachine::TState<TContext>, 
+                                      NetStateMachine::MState, 
+                                      TContext )
+            virtual TBool Accept();
+            DECLARE_SMELEMENT_FOOTER( TAwaitingReConnectComplete )
+            /**
+             * TTransitionBase from Symbian error recovery
+             */
+            class TTransitionBase : public MeshMachine::TStateTransition<TContext>
+                {
+                public:
+                    TTransitionBase( TContext& aContext )
+                    :   MeshMachine::TStateTransition<TContext>(aContext) { /*EMPTY*/ }
+                    virtual void Error(TInt aError);
+                };
+            /**
+             * TRANSITION/ACTION: Stores error context.
+             */
+            DECLARE_SMELEMENT_HEADER( TStoreErrorContext, 
+                                      CS60ConnectionRecoveryActivity::TTransitionBase, 
+                                      NetStateMachine::MStateTransition, 
+                                      TContext )
+            virtual void DoL();
+            DECLARE_SMELEMENT_FOOTER( TStoreErrorContext )
+            /**
+             * TRANSITION/ACTION: Sends RETRY as RecoveryResponse
+             */
+            DECLARE_SMELEMENT_HEADER( TSendRetryRecoveryResponse, 
+                                      CS60ConnectionRecoveryActivity::TTransitionBase, 
+                                      NetStateMachine::MStateTransition, 
+                                      TContext )
+            virtual void DoL();
+            DECLARE_SMELEMENT_FOOTER( TSendRetryRecoveryResponse )
+            /**
+             * TRANSITION/ACTION: Sends PROPAGATE as RecoveryResponse
+             */
+
+            DECLARE_SMELEMENT_HEADER( TSendPropagateRecoveryResponse, 
+                                      CS60ConnectionRecoveryActivity::TTransitionBase, 
+                                      NetStateMachine::MStateTransition, 
+                                      TContext)
+            virtual void DoL();
+            DECLARE_SMELEMENT_FOOTER( TSendPropagateRecoveryResponse )
+            
+        protected:
+            /**
+             * C++ constructor.
+             */
+            CS60ConnectionRecoveryActivity( const MeshMachine::TNodeActivity& aActivitySig, 
+                                            MeshMachine::AMMNodeBase& aNode );
+        };
+    
+    /**
+     * TRANSITION/ACTION: Sends IGNORE as RecoveryResponse
+     */
+    DECLARE_SMELEMENT_HEADER( TSendIgnoreRecoveryResponse, 
+                              MeshMachine::TStateTransition<TContext>, 
+                              NetStateMachine::MStateTransition, 
+                              TContext )
+    virtual void DoL();
+    DECLARE_SMELEMENT_FOOTER( TSendIgnoreRecoveryResponse )
+    
+    /**
+     * STATE: Wait for valid error recovery request.
+     */
+    DECLARE_SMELEMENT_HEADER( TAwaitingNotGoneDownErrorRecoveryRequest, 
+                              MeshMachine::TState<TContext>, 
+                              NetStateMachine::MState, 
+                              TContext )
+    virtual TBool Accept();
+    DECLARE_SMELEMENT_FOOTER( TAwaitingNotGoneDownErrorRecoveryRequest )
+
+    
+    /**
+     * FORK/DECISION: Decides between three different activity execution paths: 
+     * 1. Continue to next transition. ( reselection of AP )
+     * 2. Sendiong of IGNORE to originators.
+     * 3. Error handling.
+     * @return TransitionTag of the selected transition.
+     */
+    DECLARE_SMELEMENT_HEADER( TNoTagOrIgnoreErrorOrErrorTag, 
+                              MeshMachine::TStateFork<TContext>, 
+                              NetStateMachine::MStateFork, 
+                              TContext )
+    TInt TransitionTag();
+    DECLARE_SMELEMENT_FOOTER( TNoTagOrIgnoreErrorOrErrorTag )
+    
+    /**
+     * FORK/DECISION: Decides between three different activity execution paths: 
+     * 1. Continue to next transition. ( selection of IAP )
+     * 2. Retrying of currently bound MCPR
+     * 3. Error handling
+     * @return TransitionTag of the selected transition.
+     */
+    DECLARE_SMELEMENT_HEADER( TNoTagOrRetryConnectionTagOrErrorTag, 
+                              MeshMachine::TStateFork<TContext>, 
+                              NetStateMachine::MStateFork, 
+                              TContext )
+    TInt TransitionTag();
+    DECLARE_SMELEMENT_FOOTER( TNoTagOrRetryConnectionTagOrErrorTag )
+    
+    /**
+     * FORK/DECISION: Decides between two different activity execution paths: 
+     * 1. Retrying of currently bound MCPR
+     * 2. Error handling through process error
+     * @return TransitionTag of the selected transition.
+     */
+    DECLARE_SMELEMENT_HEADER( TRetryConnectionOrProcessErrorTagBackward, 
+                              MeshMachine::TStateFork<TContext>, 
+                              NetStateMachine::MStateFork, 
+                              TContext )
+    TInt TransitionTag();
+    DECLARE_SMELEMENT_FOOTER( TRetryConnectionOrProcessErrorTagBackward )
+
+    /**
+     * FORK/DECISION: Decides between two different activity execution paths: 
+     * 1. Error handling through process error
+     * 2. Else continue
+     * @return TransitionTag of the selected transition.
+     */
+    DECLARE_SMELEMENT_HEADER( TNoTagOrProcessErrorBackwardTag, 
+                              MeshMachine::TStateFork<TContext>, 
+                              NetStateMachine::MStateFork, 
+                              TContext )
+    TInt TransitionTag();
+    DECLARE_SMELEMENT_FOOTER( TNoTagOrProcessErrorBackwardTag )
+
+    } // namespace S60MCprErrorRecoveryActivity
+
+/**
+ * S60MCprMobilityActivity namespace packages the
+ * S60 MCPR's mobility activity related
+ * states, transitions and forks.
+ */
+namespace S60MCprMobilityActivity
+    {
+    /**
+     * Execution context definition for meshmachine activities. 
+     */
+    typedef MeshMachine::TNodeContext<CS60MetaConnectionProvider, MCprStates::TContext> TContext;
+    
+    /**
+     * TRANSITION/ACTION: Does nothing or resends the earlier received notification.
+     */
+    DECLARE_SMELEMENT_HEADER( TDoNothingOrReSendPendingNotification, 
+                              MeshMachine::TStateTransition<TContext>, 
+                              NetStateMachine::MStateTransition, 
+                              TContext )
+    virtual void DoL();
+    DECLARE_SMELEMENT_FOOTER( TDoNothingOrReSendPendingNotification )
+    
+    /**
+     * TRANSITION/ACTION: Responds back to IPCPR that mobility session has been started.
+     */
+    DECLARE_SMELEMENT_HEADER( TReplyMobilityStarted, 
+                              MeshMachine::TStateTransition<TContext>, 
+                              NetStateMachine::MStateTransition, 
+                              TContext )
+    virtual void DoL();
+    DECLARE_SMELEMENT_FOOTER( TReplyMobilityStarted )
+    
+    /**
+     * TRANSITION/ACTION: Registers to preferred carrier notifications.
+     */
+    DECLARE_SMELEMENT_HEADER( TSendAvailabilityRequest, 
+                              MeshMachine::TStateTransition<TContext>, 
+                              NetStateMachine::MStateTransition, 
+                              TContext )
+    virtual void DoL();
+    DECLARE_SMELEMENT_FOOTER( TSendAvailabilityRequest )
+
+    /**
+     * TRANSITION/ACTION: Application rejects active carrier.
+     */
+    DECLARE_SMELEMENT_HEADER( TSendInitialApplicationReject, 
+                              MeshMachine::TStateTransition<TContext>, 
+                              NetStateMachine::MStateTransition, 
+                              TContext )
+    virtual void DoL();
+    DECLARE_SMELEMENT_FOOTER( TSendInitialApplicationReject )
+
+    /**
+     * STATE: Waits for TStartMobility message.
+     * @return ETrue if message is valid.
+     */
+    DECLARE_SMELEMENT_HEADER( TAwaitingStartMobility, 
+                              MeshMachine::TState<TContext>, 
+                              NetStateMachine::MState, 
+                              TContext)
+    virtual TBool Accept();
+    DECLARE_SMELEMENT_FOOTER( TAwaitingStartMobility )
+
+    /**
+     * STATE: Waits for TAwaitingMigrationRequestedOrRejectedOrCancel.
+     * @return ETrue if message is valid either of those or cancel.
+     */
+    DECLARE_SMELEMENT_HEADER( TAwaitingMigrationRequestedOrRejectedOrCancel, 
+                              MeshMachine::TState<TContext>, 
+                              NetStateMachine::MState, 
+                              TContext)
+    virtual TBool Accept();
+    DECLARE_SMELEMENT_FOOTER( TAwaitingMigrationRequestedOrRejectedOrCancel )
+
+    /**
+     * STATE: Watis for application response.
+     * @return ETrue if Migration Accepted or Rejected. 
+     */
+    DECLARE_SMELEMENT_HEADER( TAwaitingMigrationAcceptedOrRejectedOrCancel, 
+                              MeshMachine::TState<TContext>, 
+                              NetStateMachine::MState, 
+                              TContext )
+    virtual TBool Accept();
+    DECLARE_SMELEMENT_FOOTER( TAwaitingMigrationAcceptedOrRejectedOrCancel )
+
+    /**
+     * FORK/DECISION: Returns the KStartMobilityHandshake backwards or error
+     * @return KStartMobilityHandshake backwards or error
+     */
+    DECLARE_SMELEMENT_HEADER( TStartMobilityHandshakeBackwardsOrError, 
+                              MeshMachine::TStateFork<TContext>, 
+                              NetStateMachine::MStateFork, 
+                              TContext )
+    virtual TInt TransitionTag();
+    DECLARE_SMELEMENT_FOOTER( TStartMobilityHandshakeBackwardsOrError )
+
+    /**
+     * FORK/DECISION: Decides if needs cancel or not.
+     */
+    DECLARE_SMELEMENT_HEADER( TInformMigrationAvailableOrCancelTag, 
+                              MeshMachine::TStateFork<TContext>, 
+                              NetStateMachine::MStateFork, 
+                              TContext )
+    virtual TInt TransitionTag();
+    DECLARE_SMELEMENT_FOOTER( TInformMigrationAvailableOrCancelTag )
+
+    /**
+     * FORK/DECISION: Decides what happens after IPCPR application completes the 
+     * three way handshake.
+     * 1. Application accepted, continue to send accept to policy server.
+     * 2. Error
+     * 3. Application rejected, continue to send reject to policy server.
+     * @return TransitionTag of the selected transition.
+     */
+    DECLARE_SMELEMENT_HEADER( TNoTagOrErrorTagOrApplicationRejected, 
+                              MeshMachine::TStateFork<TContext>, 
+                              NetStateMachine::MStateFork, 
+                              TContext )
+    virtual TInt TransitionTag();
+    DECLARE_SMELEMENT_FOOTER( TNoTagOrErrorTagOrApplicationRejected )
+    
+    /**
+     * FORK/DECISION: Decides whether to wait MPM actions or report an error. 
+     * 1. Wait for further actions. ReSelect is NOT supported.
+     * 2. Error
+     * @return TransitionTag of the selected transition.
+     */
+    DECLARE_SMELEMENT_HEADER( TWaitPolicyServerResponseBackwardOrErrorTag, 
+                              MeshMachine::TStateFork<TContext>, 
+                              NetStateMachine::MStateFork, 
+                              TContext )
+    virtual TInt TransitionTag();
+    DECLARE_SMELEMENT_FOOTER( TWaitPolicyServerResponseBackwardOrErrorTag )
+
+    /**
+     * FORK/DECISION: 
+     * 1. Continue with handshake to select new AP for MCPR.
+     * 2. Return back to migration-phase with new preferred IAP.
+     * 3. Close down the system in case of mobilityerror.
+     * @return  //TODO Cancel from IPCPR.
+     */
+    DECLARE_SMELEMENT_HEADER( TNoTagOrInformMigrationAvailableBackwardsOrErrorOrCancel, 
+                              MeshMachine::TStateFork<TContext>, 
+                              NetStateMachine::MStateFork, 
+                              TContext )
+    virtual TInt TransitionTag();
+    DECLARE_SMELEMENT_FOOTER( TNoTagOrInformMigrationAvailableBackwardsOrErrorOrCancel )
+
+    /**
+     * Class that is responsible for managing mobility on MCPR side.
+     * CS60MobilityActivity is the S60 version of the CMobilityActivity -class
+     */
+    class CS60MobilityActivity : public S60MCprStates::CS60ErrorRecoveryActivity
+        {
+        public:
+            /**
+             * Symbian two-phase constructor
+             */
+            static MeshMachine::CNodeActivityBase* NewL( const MeshMachine::TNodeActivity& aActivitySig, 
+                                                         MeshMachine::AMMNodeBase& aNode );
+
+            /**
+             * CS60MobilityActivity -context definition 
+             */
+            typedef MeshMachine::TNodeContext<CS60MetaConnectionProvider, MCprStates::TContext> TContext;
+
+            /**
+             * Inner mutex class. Takes care that mobility is not started while 
+             * activity/node is doing something more important.
+             */
+            class TConnectionRecoveryOrMobilityPreferenceOrErrorMutex
+                {
+                public:
+                    /**
+                     * @return ETrue if mobility activity can't run
+                     */
+                    static TBool IsBlocked(MeshMachine::TNodeContextBase& aContext);
+                };
+
+        public: // Mesh Machine elements
+
+            /**
+             * TRANSITION/ACTION: Sends migration rejected message 
+             */
+            DECLARE_SMELEMENT_HEADER( TSendMigrationRejected, 
+                                      MeshMachine::TStateTransition<TContext>, 
+                                      NetStateMachine::MStateTransition, 
+                                      TContext )
+            virtual void DoL();
+            DECLARE_SMELEMENT_FOOTER( TSendMigrationRejected )
+
+            /**
+             * TRANSITION/ACTION: Sends migration rejected message 
+             */
+            DECLARE_SMELEMENT_HEADER( TSendMigrationAccepted, 
+                                      MeshMachine::TStateTransition<TContext>, 
+                                      NetStateMachine::MStateTransition, 
+                                      TContext )
+            virtual void DoL();
+            DECLARE_SMELEMENT_FOOTER( TSendMigrationAccepted )
+
+            /**
+             * TRANSITION/ACTION: Clears the handshaking flag
+             */
+            DECLARE_SMELEMENT_HEADER( TClearHandshakingFlag, 
+                                      MeshMachine::TStateTransition<TContext>, 
+                                      NetStateMachine::MStateTransition, 
+                                      CS60MobilityActivity::TContext )
+            virtual void DoL();
+            DECLARE_SMELEMENT_FOOTER( TClearHandshakingFlag )
+
+            // EMPTY
+            DECLARE_SMELEMENT_HEADER( TSendAvailabilityRequest, 
+                                      MeshMachine::TStateTransition<TContext>, 
+                                      NetStateMachine::MStateTransition, 
+                                      CS60MobilityActivity::TContext )
+            virtual void DoL();
+            DECLARE_SMELEMENT_FOOTER( TSendAvailabilityRequest )
+
+            /**
+             * TRANSITION/ACTION: Sends migration available notification to IPCPR. 
+             */
+            DECLARE_SMELEMENT_HEADER( TInformMigrationAvailableAndSetHandshakingFlag, 
+                                      MeshMachine::TStateTransition<TContext>, 
+                                      NetStateMachine::MStateTransition, 
+                                      CS60MobilityActivity::TContext )
+            virtual void DoL();
+            DECLARE_SMELEMENT_FOOTER( TInformMigrationAvailableAndSetHandshakingFlag )
+
+            // Symbian comment: For the moment it is sufficient to use the re-connect activity, in the future we may want to
+            // customise the behavior, for example start the new layer before rebinding it, etc.
+            // EMPTY
+            DECLARE_SMELEMENT_HEADER(TRequestReConnect, 
+                                     MeshMachine::TStateTransition<TContext>, 
+                                     NetStateMachine::MStateTransition,
+                                     CS60MobilityActivity::TContext)
+            virtual void DoL();
+            DECLARE_SMELEMENT_FOOTER(TRequestReConnect)
+
+            /**
+             * TRANSITION/ACTION: Informs IPCPR that MCPR has migrated. 
+             */
+            DECLARE_SMELEMENT_HEADER( TInformMigrationCompleted, 
+                                      MeshMachine::TStateTransition<TContext>, 
+                                      NetStateMachine::MStateTransition, 
+                                      CS60MobilityActivity::TContext )
+            virtual void DoL();
+            DECLARE_SMELEMENT_FOOTER( TInformMigrationCompleted )
+
+            /**
+             * TRANSITION/ACTION: Sends Application Accepted Connection 
+             */
+            DECLARE_SMELEMENT_HEADER( TSendApplicationAccept, 
+                                      MeshMachine::TStateTransition<TContext>, 
+                                      NetStateMachine::MStateTransition, 
+                                      CS60MobilityActivity::TContext )
+            virtual void DoL();
+            DECLARE_SMELEMENT_FOOTER( TSendApplicationAccept )
+            
+            /**
+             * TRANSITION/ACTION: Sends Application Rejected Connection 
+             */
+            DECLARE_SMELEMENT_HEADER( TSendApplicationReject, 
+                                      MeshMachine::TStateTransition<TContext>, 
+                                      NetStateMachine::MStateTransition, 
+                                      CS60MobilityActivity::TContext )
+            virtual void DoL();
+            DECLARE_SMELEMENT_FOOTER( TSendApplicationReject )
+            
+            /**
+             * TRANSITION/ACTION: Unregister preferred carrier notifications.
+             */
+            DECLARE_SMELEMENT_HEADER( TCancelMobilityActivity, 
+                                      MeshMachine::TStateTransition<TContext>, 
+                                      NetStateMachine::MStateTransition, 
+                                      CS60MobilityActivity::TContext )
+            virtual void DoL();
+            DECLARE_SMELEMENT_FOOTER( TCancelMobilityActivity )
+            
+            /**
+             * STATE: Waits for response to the MigrationAccepted message.
+             * @return ETrue if new PreferredCarrier arrives, new StartIAPNotification arrives or error arrives.
+             */
+            DECLARE_SMELEMENT_HEADER( TAwaitingPreferredCarrierOrStartIAPNotificationOrErrorNotificationOrCancel, 
+                                      MeshMachine::TState<TContext>, 
+                                      NetStateMachine::MState, 
+                                      CS60MobilityActivity::TContext)
+            virtual TBool Accept();
+            DECLARE_SMELEMENT_FOOTER( TAwaitingPreferredCarrierOrStartIAPNotificationOrErrorNotificationOrCancel )
+
+            /**
+             * STATE: Waits for preferred carrier message.
+             * @return ETrue if preferred carrier notification is received.
+             */
+            DECLARE_SMELEMENT_HEADER( TAwaitingPreferredCarrierOrCancelOrRejected, 
+                                      MeshMachine::TState<TContext>, 
+                                      NetStateMachine::MState, 
+                                      CS60MobilityActivity::TContext)
+            virtual TBool Accept();
+            DECLARE_SMELEMENT_FOOTER( TAwaitingPreferredCarrierOrCancelOrRejected )
+            
+            /**
+             * FORK/DECISION: Decides what happens after IPCPR responds to migration offer.
+             * 1. Proceed to migration if asked.
+             * 2. Proceed to cancel.
+             * 3. Go back to wait for new preferred connection.
+             * @return TransitionTag of the selected transition.
+             */
+            DECLARE_SMELEMENT_HEADER( TNoTagOrApplicationRejectedMigrationOrCancel, 
+                                      MeshMachine::TStateFork<TContext>, 
+                                      NetStateMachine::MStateFork, 
+                                      CS60MobilityActivity::TContext )
+            virtual TInt TransitionTag();
+            DECLARE_SMELEMENT_FOOTER( TNoTagOrApplicationRejectedMigrationOrCancel )
+
+            /**
+             * Mutex protected TRANSITION.
+             * Mopility scenario should wait until the connection recovery finishes.
+             */
+            DECLARE_SERIALIZABLE_TRANSITION( TInformMigrationAvailableAndSetHandshakingFlagBlockedByConnectionRecoveryOrNoMobilityPreferenceOrError,
+                                             CS60MobilityActivity::TConnectionRecoveryOrMobilityPreferenceOrErrorMutex,
+                                             CS60MobilityActivity::TInformMigrationAvailableAndSetHandshakingFlag )
+
+        protected: // Methods.
+            
+            /**
+             * C++ constructor
+             */
+            CS60MobilityActivity( const MeshMachine::TNodeActivity& aActivitySig, 
+                                  MeshMachine::AMMNodeBase& aNode );
+            
+            //TBool Signal( MeshMachine::TNodeContextBase& aContext );
+
+        private: // Private methods.
+            
+            /**
+             * Sets on MCPR wide mobility handshaking flag.  
+             */
+            void SetHandshakingFlag();
+
+            /**
+             * Clears MCPR wide mobility handshaking flag.  
+             */
+            void ClearHandshakingFlag();
+
+        private: // Member variables.
+            
+            /**
+             * Pointer to IPProtocoMCPR which is currently active 
+             */
+            ESock::RMetaServiceProviderInterface* iCurrent;
+
+            /**
+             * Pointer to IPProtocoMCPR which is about to become the active. 
+             */
+            ESock::RMetaServiceProviderInterface* iPreferred;
+
+            TUint iCurrentAssumedAPId;  // Current IAP Id
+            TUint iPreferredAPId;       // New IAP Id system should roam to.
+            TBool iIsUpgrade;           // If the active iPreferredAPId is upgrade to old one.
+            TBool iIsSeamless;          // *not used* if the roaming is seamless from the IP point of view 
+        
+        };
+
+	DECLARE_SMELEMENT_HEADER( TProcessSimpleSelectionPolicy, MeshMachine::TStateTransition<TContext>, NetStateMachine::MStateTransition, TContext )
+    virtual void DoL();
+    DECLARE_SMELEMENT_FOOTER( TProcessSimpleSelectionPolicy )
+
+    } // namespace S60MCprMobilityActivity
+
+#endif // S60MCPR_ACTIVITIES_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/S60MCPR/inc/s60mcprfactory.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2008 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: S60 MCPR's factory
+*
+*/
+
+/**
+@file s60mcprfactory.h
+S60 MCPR's factory.
+*/
+
+
+#ifndef S60MCPRFACTORY_H
+#define S60MCPRFACTORY_H
+
+#include <comms-infras/ss_metaconnprov.h>
+
+/**
+ * CS60MetaConnectionProviderFactory factory class.
+ */
+class CS60MetaConnectionProviderFactory : public ESock::CMetaConnectionProviderFactoryBase
+    {
+public:
+    enum { iUid = 0x101F6D4B };
+    /** 
+     * Factory function for the factory which manages network level meta connection providers.
+     * This function also acts as the single ECom entry point into this object.
+     * @param aParentContainer the parent factory container which owns this factory
+     * @return factory for IP level meta connection providers
+     */
+    static CS60MetaConnectionProviderFactory* NewL(TAny* aParentContainer);
+protected:
+    /** 
+     * Constructor for Network level meta connection providers.
+     * @param aFactoryId the ID which this factory can be looked up by
+     * @param aParentContainer the parent factory container which owns this factory
+     */
+    CS60MetaConnectionProviderFactory(TUid aFactoryUid, ESock::CMetaConnectionFactoryContainer& aParentContainer);
+    /** 
+     * Constructor for Network level meta connection provider.
+     * @return pointer to new S60 MCPR.
+     */
+    ESock::ACommsFactoryNodeId* DoCreateObjectL(ESock::TFactoryQueryBase& aQuery);
+    };
+
+#endif //S60MCPRFACTORY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/S60MCPR/inc/s60mcprmpmlog.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,114 @@
+/*
+* Copyright (c) 2008 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 header defines logging macros for S60MCPR
+*
+*/
+
+
+/**
+@file s60mcprlog.h
+This header defines logging macros for S60MCPR.
+*/
+
+#ifndef S60MCPRLOG_H
+#define S60MCPRLOG_H
+
+// Logging tag
+#if defined __CFLOG_ACTIVE || defined SYMBIAN_TRACE_ENABLE
+#include <comms-infras/ss_logext.h>
+#define KS60MCprTag KESockMetaConnectionTag
+_LIT8(KS60MCprSubTag, "netmcpr");
+#endif
+
+#ifndef _DEBUG
+
+// UREL BUILD:
+#define S60MCPR_LOGGING_METHOD  0   // No logging in UREL builds
+
+#else
+
+// UDEB BUILD:
+#define S60MCPR_LOGGING_METHOD  1     // 0 = No logging,
+                                      // 1 = CDU
+                                      // 2 = RDebug
+#endif // _DEBUG
+
+#if S60MCPR_LOGGING_METHOD == 1 // Flogger
+
+#include <cflog.h>
+
+#define S60MCPRLOGTEXT(x)\
+    {\
+    RFileLogger::Write(KBMLogFolder(),KBMLogFile(),EFileLoggingModeAppend,\
+    x);\
+    }
+
+#define S60MCPRLOGSTRING(x)\
+    {\
+    _LIT(tempLogDes,x);\
+    __CFLOG_0(KS60MCprTag,KS60MCprSubTag, tempLogDes());\
+    }
+
+#define S60MCPRLOGSTRING1(x,y)\
+    { _LIT(tempLogDes,x);\
+    __CFLOG_1(KS60MCprTag,KS60MCprSubTag, tempLogDes(), y);\
+    }
+
+#define S60MCPRLOGSTRING2(x,y,z)\
+    { _LIT(tempLogDes,x);\
+    __CFLOG_2(KS60MCprTag,KS60MCprSubTag, tempLogDes(), y, z);\
+    }
+
+#define S60MCPRLOGSTRING3(w,x,y,z)\
+    { _LIT(tempLogDes,w);\
+    __CFLOG_3(KS60MCprTag,KS60MCprSubTag, tempLogDes(), x, y, z);\
+    }
+
+#define S60MCPRLOGSTRING4(w,x,y,z,v)\
+    { _LIT(tempLogDes,w);\
+    __CFLOG_4(KS60MCprTag,KS60MCprSubTag, tempLogDes(), x, y, z, v);\
+    }
+
+#define S60MCPRLOGTEXT(x)\
+    {\
+    RFileLogger::Write(KBMLogFolder(),KBMLogFile(),EFileLoggingModeAppend,\
+    x);\
+    }
+
+#elif S60MCPR_LOGGING_METHOD == 2    // RDebug
+
+#include <e32svr.h>
+
+#define S60MCPRLOGTEXT(x) RDebug::Print(x);
+#define S60MCPRLOGSTRING(x) RDebug::Print(_L(x));
+#define S60MCPRLOGSTRING1(x,y) RDebug::Print(_L(x),y);
+#define S60MCPRLOGSTRING2(x,y,z) RDebug::Print(_L(x),y,z);
+#define S60MCPRLOGSTRING3(w,x,y,z) RDebug::Print(_L(w),x,y,z);
+#define S60MCPRLOGSTRING4(w,x,y,z,v) RDebug::Print(_L(w),x,y,z,v);
+
+#else // S60MCPR_LOGGING_METHOD == 0 or invalid
+
+#define S60MCPRLOGTEXT(x)
+#define S60MCPRLOGSTRING(x)
+#define S60MCPRLOGSTRING1(x,y)
+#define S60MCPRLOGSTRING2(x,y,z)
+#define S60MCPRLOGSTRING3(w,x,y,z)
+#define S60MCPRLOGSTRING4(w,x,y,z,v)
+
+#endif // S60MCPR_LOGGING_METHOD
+
+#endif  // S60MCPRLOG_H
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/S60MCPR/inc/s60mcprstates.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,291 @@
+/*
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: S60 MCPR's states
+*
+*/
+
+
+/**
+@file s60mcprstates.h
+S60 MCPR's states.
+*/
+
+#ifndef S60MCPRSTATES_H
+#define S60MCPRSTATES_H
+
+#include <comms-infras/mobilitymcprstates.h>
+#include <comms-infras/ss_nodemessages_legacy.h>
+#include <elements/nm_messages_errorrecovery.h>
+
+#include "s60mcpr.h"
+#include "s60mpmrequests.h"
+
+/**
+ * S60McprState namespace packages all S60 specific state, forks and 
+ * transitions which can be utilized from all S60MCPR activities.
+ */
+namespace S60MCprStates
+    {
+    /**
+     * Network Meta Connection Provider Transition Ids 11000..20000
+     */
+    //const TInt KAwaitAvailabilityNotification = 11000;
+    //const TInt KProcessAvailabilityNotification = 11001;
+    // Transition IDs for ChooseBestIAP
+    const TInt KReselectBestIAPNeeded = 11002;
+    const TInt KChooseBestIAPRequired = 11003;
+    // Transition IDs for ErrorRecoveryRequest
+    const TInt KIgnoreError = 11020;
+    const TInt KRetryConnection = 11021; 
+    const TInt KSetChosenApActive = 11022;
+    const TInt KProcessError = 11023;
+    // Mobility transition ids.
+    const TInt KApplicationRejectedMigration = 11050;
+    const TInt KWaitPolicyServerResponse = 11051;
+    const TInt KInformMigrationAvailable = 11052;
+    const TInt KSendInitialApplicationReject = 11053; 
+    /**
+     * Execution context
+     */
+    typedef MeshMachine::TNodeContext<CS60MetaConnectionProvider, MobilityMCprStates::TContext> TContext;
+    /**
+     * Status change information.
+     * TRANSITION/ACTION: Sends IAP status notification to MPM.
+     * 
+     * Actually the notification is not directly IAP related but without any other
+     * information we must try to interpret the IPCPR status messages. 
+     */
+    DECLARE_SMELEMENT_HEADER( THandleMPMStatusChange, 
+                              MeshMachine::TStateTransition<TContext>, 
+                              NetStateMachine::MStateTransition, 
+                              TContext )
+    void DoL();
+    DECLARE_SMELEMENT_FOOTER( THandleMPMStatusChange )
+    /**
+     * Combined transition that handles the MPM interaction and core functionality. 
+     */
+    DECLARE_AGGREGATED_TRANSITION3( THandleMPMAndCoreDataClientStatusChangeAndDestroyOrphans,
+                                    S60MCprStates::THandleMPMStatusChange,
+                                    PRStates::THandleDataClientStatusChange,
+                                    PRStates::TDestroyOrphanedDataClients )
+
+    /**
+     * Generic ReselectBestIAP state that can be used before JustInTimeSelection.
+     * TRANSITION/ACTION: Sends Reselect IAP request to Policy Server.
+     */
+    DECLARE_SMELEMENT_HEADER( TReselectBestIAP, 
+                              MeshMachine::TStateTransition<TContext>, 
+                              NetStateMachine::MStateTransition, 
+                              TContext )
+    virtual void DoL();
+    DECLARE_SMELEMENT_FOOTER( TReselectBestIAP )
+
+    /**
+     * TRANSITION/ACTION: Starts ReConnect -activity
+     * Checks the IPProto MCPR tree below and picks the current one
+     * and the active one and makes a reconnect request for them.
+     */
+    DECLARE_SMELEMENT_HEADER( TRequestReConnect, 
+                              MeshMachine::TStateTransition<TContext>, 
+                              NetStateMachine::MStateTransition, 
+                              TContext )
+    virtual void DoL();
+    DECLARE_SMELEMENT_FOOTER( TRequestReConnect )
+
+    /**
+     * TRANSITION/ACTION: Requests Policy Server to process the error.
+     * The error is taken from the error context or activity error in that order.
+     */
+    DECLARE_SMELEMENT_HEADER( TProcessError, 
+                              MeshMachine::TStateTransition<TContext>, 
+                              NetStateMachine::MStateTransition,
+                              TContext )
+    virtual void DoL();
+    DECLARE_SMELEMENT_FOOTER( TProcessError )
+    
+    /**
+     * STATE: Waits for valid select or error message.
+     * @return ETrue if message is accepted or error is observed.
+     */
+    DECLARE_SMELEMENT_HEADER( TAwaitingSelectNextLayerCompletedOrError, 
+                              MeshMachine::TState<TContext>, 
+                              NetStateMachine::MState, 
+                              TContext )
+    virtual TBool Accept();
+    DECLARE_SMELEMENT_FOOTER( TAwaitingSelectNextLayerCompletedOrError )
+    
+    /**
+     * STATE: Waits for valid select or error message.
+     * @return ETrue if message is accepted or error is observed.
+     */
+    DECLARE_SMELEMENT_HEADER( TAwaitingReselectBestIAPCompleteOrError, 
+                              MeshMachine::TState<TContext>, 
+                              NetStateMachine::MState, 
+                              TContext )
+    virtual TBool Accept();
+    DECLARE_SMELEMENT_FOOTER( TAwaitingReselectBestIAPCompleteOrError )
+    
+    /**
+     * STATE: Waits for PolicyServer response for the process error request.
+     * @return ETrue if message is accepted.
+     */
+    DECLARE_SMELEMENT_HEADER( TAwaitingProcessErrorCompleteOrError, 
+                              MeshMachine::TState<TContext>, 
+                              NetStateMachine::MState, 
+                              TContext)
+    virtual TBool Accept();
+    DECLARE_SMELEMENT_FOOTER( TAwaitingProcessErrorCompleteOrError )
+    
+    /**
+     * STATE: Waits for ServiceId request. 
+     * @return ETrue if message is accepted. 
+     */
+    DECLARE_SMELEMENT_HEADER( TAwaitingServiceIdRequest, 
+                              MeshMachine::TState<TContext>, 
+                              NetStateMachine::MState, 
+                              TContext )
+    virtual TBool Accept();
+    DECLARE_SMELEMENT_FOOTER( TAwaitingServiceIdRequest )
+
+    /**
+     * TRANSITION/ACTION: Retrieve ServiceId.
+     */
+    DECLARE_SMELEMENT_HEADER( TRetrieveServiceId, 
+                              MeshMachine::TStateTransition<TContext>, 
+                              NetStateMachine::MStateTransition, 
+                              TContext )
+    virtual void DoL();
+    DECLARE_SMELEMENT_FOOTER( TRetrieveServiceId )
+
+    class CS60ErrorRecoveryActivity : public MeshMachine::CNodeRetryActivity
+        {
+        public:
+            CS60ErrorRecoveryActivity( const MeshMachine::TNodeActivity& aActivitySig, 
+                                       MeshMachine::AMMNodeBase& aNode )
+                :   MeshMachine::CNodeRetryActivity( aActivitySig, aNode )
+                {}
+            /**
+             * Error context on which this activity started
+             */
+            Messages::TErrContext iOriginalErrContext;
+        };
+    
+    /**
+     * CReselectBestIAPCb is a callback class that receives the policy server response
+     * and converts PolicyResponse -event into meshmachine compatible message. 
+     * 
+     * PolicyServer wrapper API takes pointer of the class implementing the 
+     * MMPMPolicyRequestsUser -interface. The ownership is passed to the wrapper API
+     * because the answer may be delayed and live longer than the execution context 
+     * of the MCPR.
+     */
+    class CReselectBestIAPCb : public CBase, public MMPMPolicyRequestsUser
+        {
+        public:
+            /**
+             * C++ constructor.
+             * 
+             * @param aNode reference to S60 MCPR running the Activity.
+             * @param aActivity pointer to the Activity that requests for PolicyResponse. 
+             */
+            CReselectBestIAPCb( CS60MetaConnectionProvider& aNode, 
+                                MeshMachine::CNodeActivityBase* aActivity )
+                :   iNode(aNode) 
+                { 
+                iLastRequestOriginator.Open( aNode.SelfInterface(),
+                                             Messages::TNodeCtxId( aActivity->ActivityId(), 
+                                                                   aNode.Id() ));
+                }
+            /**
+             * Called when Policy Server responds to the request.
+             * @param aCompletedRequest contains reference to answer from Policy Server.
+             */
+            virtual void PolicyResponse( PolicyRequest& aCompletedRequest );
+            /**
+             * Interface function that calls CBase-destructor
+             */
+            virtual void Delete() { delete this; }
+        protected:
+            /**
+             * C++ destructor
+             */
+            virtual ~CReselectBestIAPCb() {}
+        private:
+            /**
+             * Valid reference to CS60MetaConnectionProvider
+             */ 
+            CS60MetaConnectionProvider& iNode;
+            /**
+             * Valid reference to request originator.
+             */ 
+            Messages::RRequestOriginator iLastRequestOriginator;
+        };
+    
+    /**
+     * CProcessErrorCb is a callback class that receives the policy server response
+     * and converts PolicyResponse -event into meshmachine compatible message. 
+     * 
+     * PolicyServer wrapper API takes pointer of the class implementing the 
+     * MMPMPolicyRequestsUser -interface. The ownership is passed to the wrapper API
+     * because the answer may be delayed and live longer than the execution context 
+     * of the MCPR.
+     */
+    class CProcessErrorCb
+        :   public CBase, 
+            public MMPMPolicyRequestsUser
+        {
+        public:
+            /**
+             * C++ constructor.
+             * 
+             * @param aNode reference to S60 MCPR running the Activity.
+             * @param aActivity pointer to the Activity that requests for PolicyResponse. 
+             */
+            CProcessErrorCb( CS60MetaConnectionProvider& aNode, 
+                             MeshMachine::CNodeActivityBase* aActivity )
+                :   iNode(aNode) 
+                { 
+                iLastRequestOriginator.Open( aNode.SelfInterface(), 
+                                             Messages::TNodeCtxId( aActivity->ActivityId(), 
+                                                                   aNode.Id() ));
+                }
+            /**
+             * Called when Policy Server responds to the request.
+             * @param aCompletedRequest contains reference to answer from Policy Server.
+             */
+            virtual void PolicyResponse( PolicyRequest& aCompletedRequest );
+            /**
+             * Interface function that calls CBase-destructor
+             */
+            virtual void Delete() { delete this; }
+        protected:
+            /**
+             * C++ destructor
+             */
+            virtual ~CProcessErrorCb() {}
+        private:
+            /**
+             * Valid reference to CS60MetaConnectionProvider
+             */ 
+            CS60MetaConnectionProvider& iNode;
+            /**
+             * Valid reference to request originator.
+             */ 
+            Messages::RRequestOriginator iLastRequestOriginator;
+        };
+
+    } // namespace S60MCprStates
+
+#endif //S60MCPRSTATES_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/S60MCPR/inc/s60mpmnotifications.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,88 @@
+/*
+* Copyright (c) 2008 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: Interface to Mobility Policy Manager notifications.
+*
+*/
+
+/**
+@file s60mpmnotifications.h
+Interface to Mobility Policy Manager notifications.
+*/
+
+#ifndef S60MCPR_NOTIFICATIONS_H
+#define S60MCPR_NOTIFICATIONS_H
+
+// System includes
+#include <e32base.h>
+
+// User includes
+#include "s60mpmpolicyinterfaces.h"
+#include "s60mcprmpmlog.h"
+
+// Forward declarations
+class RMPM;
+
+/**
+*  MPM interface notification management Class
+*/
+NONSHARABLE_CLASS( CMPMPolicyNotifications ) : public CActive
+    {
+    public:
+        /**
+        * Two-phased constructor.
+        * 
+        * @param aUser reference to class implementing the callback interface.
+        * @param aMpm MPM session to be used.
+        */
+        static CMPMPolicyNotifications *NewL( MMPMPolicyNotificationUser& aUser, RMPM& aMpm );
+        /**
+        * Asynchronous Destructor.
+        * After calling this function the object takes responsibility to destroy itself.
+        */
+        void CancelRequestAndDestroyD( TRequestStatus* aStatus = NULL );
+        /**
+        * Activates notifications.
+        */
+        void Activate();
+    private:
+        /**
+        * C++ default constructor.
+        * 
+        * @param aUser reference to class implementing the callback interface.
+        * @param aMpm MPM session to be used.
+        */
+        CMPMPolicyNotifications( MMPMPolicyNotificationUser& aUser, RMPM& aMpm );
+        /**
+        * Destructor.
+        */
+        ~CMPMPolicyNotifications();
+    private: // from CActive
+        /**
+        * Active Object RunL.
+        */
+        void RunL();
+        /**
+        * Active Object DoCancel.
+        */
+        void DoCancel();
+    private:
+        MMPMPolicyNotificationUser& iNotificationUser;
+        RMPM&                       iMpm;
+        TMPMMessageBuffer           iMsgBuffer;
+        TBool                       iCommitedToDeleteItself;
+        TRequestStatus*             iDeletedStatus;
+    };
+
+#endif // S60MCPR_NOTIFICATIONS_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/S60MCPR/inc/s60mpmpolicyinterfaces.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,149 @@
+/*
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This header defines inteface needed by MCPR to use MPM.
+*
+*/
+
+/**
+@file s60mpmpolicyinterfaces.h
+This header defines inteface needed by MCPR to use MPM.
+*/
+#ifndef S60MPMPOLICYINTERFACES_H
+#define S60MPMPOLICYINTERFACES_H
+
+// Reusing MPM function code definitions
+#include <rmpm.h>
+
+// FORWARD DECLARATIONS
+class PolicyRequest;
+class CMPMPolicyRequests;
+
+/**
+ * Notication interface of S60MCPR
+ */
+class MMPMPolicyNotificationUser
+    {
+    public:
+        /**
+        * Notification
+        * 
+        * @param aNotification notification buffer from MPM.
+        */
+        virtual void PolicyNotification( TMpmNotification& aNotification ) = 0;
+    };
+
+/**
+ *  Callback class.
+ *
+ *  @since xx
+ */
+class MMPMPolicyRequestsUser
+    {
+    friend class PolicyRequest;
+public:
+    virtual void PolicyResponse( PolicyRequest& aCompletedRequest ) = 0;
+protected:
+    virtual void Delete() = 0;
+    };
+
+/**
+ * Lists the supported MPM operations of the MPM API wrapper
+ * In order to simplify cancellation, match the cancellable requests to MPM's AsyncRequests. 
+ */
+namespace S60MCPRMPMOperations
+    {
+    enum TPolicyServerOperations
+        {
+        EPolicyRequestChooseBestIAP = EMPMChooseBestIAP,
+        EPolicyRequestReselectBestIAP = EMPMReselectBestIAP,
+        EPolicyRequestProcessError = EMPMProcessError,
+        EPolicyRequestWaitNotification = EMPMWaitNotification,
+        EPolicyRequestIAPConnectionStarted = 200,
+        EPolicyRequestIAPConnectionStopped,
+        EPolicyRequestApplicationJoinsConnection,
+        EPolicyRequestApplicationLeavesConnection,
+        EPolicyRequestApplicationConnectionEnds,
+        EPolicyRequestConnect,
+        EPolicyRequestRegisterPrefIAPNotif,
+        EPolicyRequestUnregisterPrefIAPNotif,
+        EPolicyRequestApplicationMigratesToCarrier,
+        EPolicyRequestApplicationIgnoredTheCarrier,
+        EPolicyRequestApplicationAcceptedTheCarrier,
+        EPolicyRequestApplicationRejectedTheCarrier,
+        };
+    }
+
+/**
+ *  Request container class.
+ */
+class PolicyRequest
+    {
+    public:
+        /**
+         * c++ constructor 
+         */
+        PolicyRequest()
+            :   iConnPref(NULL),
+                iIapId(0),
+                iConnId(0),
+                iAppUid(KNullUid),
+                iError(KErrNone),
+                iPolicyPref(NULL),
+                iStatus(KErrNone),
+                iUser(NULL)
+            {}
+
+        /**
+         * Deletes heap data. 
+         */
+        void Cleanup()
+            {
+            delete iConnPref;
+            delete iPolicyPref;
+            // below is type specific destructor of iUser that handles the cleanup of derived object
+            if( iUser )
+                iUser->Delete(); 
+            }
+        
+        /**
+         * Does not actually cancel MPM request but prevents
+         * PolicyResponse() -calls to request originator. 
+         */
+        void Cancel()
+            {
+            if( iUser )
+                iUser->Delete();
+            iUser = NULL;
+            }
+
+    public:
+        // Information for MPM  
+        S60MCPRMPMOperations::TPolicyServerOperations iRequestType;
+        TConnPref*              iConnPref;
+        TUint                   iIapId;
+        TConnectionId           iConnId;
+        TUid                    iAppUid;
+        TInt                    iError;
+        // Information from MPM
+        TConnPref*              iPolicyPref;
+        TBMNeededAction         iNeededAction;
+        TInt                    iStatus;
+        // Interface back to requestor.
+        MMPMPolicyRequestsUser* iUser;
+    };
+
+#endif  // S60MPMPOLICYINTERFACES_H
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/S60MCPR/inc/s60mpmrequests.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,275 @@
+/*
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Interface to Mobility Policy Manager definitions.
+*
+*/
+
+/**
+@file s60mpmrequests.h
+Interface to Mobility Policy Manager definitions.
+*/
+
+#ifndef S60MPMREQUESTS_H
+#define S60MPMREQUESTS_H
+
+// System includes
+#include <e32base.h>
+//#include <ss_log.h>
+#include <rmpm.h>
+
+// User includes
+#include "s60mpmpolicyinterfaces.h"
+#include "s60mcprmpmlog.h"
+
+// Namespaces
+using namespace S60MCPRMPMOperations;
+
+// Forward declaration
+class CMPMPolicyNotifications;
+
+/**
+*  S60 NetMCPR MPM interface management Class inherits from CActive
+*/
+NONSHARABLE_CLASS( CMPMPolicyRequests ) 
+    :   public CActive, 
+        public MMPMPolicyNotificationUser
+    {
+    public:
+        /**
+         * Two-phased constructor.
+         * @param aUser reference to class implementing MMPMPolicyNotificationsUser interface  
+         */
+        static CMPMPolicyRequests *NewL( MMPMPolicyNotificationUser& aUser );
+
+        /**
+         * Asynchronous destructor.
+         * At the point of return the object may or may not be deleted
+         * but MUST NOT be used by the owner anymore.
+         */
+        void RequestDelete();
+        
+        /**
+         * Notifies MPM a certain IAP started.
+         * forward the call to MPM
+         *
+         * @param aIapId IAP Id of the connection.
+         */
+        void IAPConnectionStartedL( const TUint32 aIapId );
+
+        /**
+        * Notifies MPM a certain IAP stopped.
+        * forward the call to MPM
+        * 
+        * @param aIapId IAP Id of the connection.
+        */
+        void IAPConnectionStoppedL( const TUint32 aIapId );
+
+        /**
+        * Notifies MPM of new RConnection joining to connection
+        * forward the call to MPM
+        * 
+        * @param aIapId IAP Id of the connection.
+        */
+        void ApplicationJoinsConnectionL( const TUint32 aIapId );
+
+        /**
+        * Notifies MPM that RConnection is leaving the connection provider
+        * forward the call to MPM
+        * 
+        * @param aIapId IAP Id of the connection.
+        */
+        void ApplicationLeavesConnectionL( const TUint32 aIapId );
+        
+        /**
+        * Notifies MPM that RConnection is closing down
+        * forward the call to MPM
+        */
+        void ApplicationConnectionEndsL();
+        
+        /**
+         * Register to Preferred IAP Notifications which are delivered through 
+         * the CMPMPolicyNotification -class's PolicyNotification -call.
+         */
+        void RegisterPreferredIAPNotificationL();
+
+        /**
+         * Unregister from Preferred IAP Notifications. 
+         */
+        void UnregisterPreferredIAPNotificationL();
+
+        /**
+         * Informs MPM that application want to ignore the carrier.
+         * @param aIapId Ignored IAP 
+         */
+        void ApplicationIgnoredTheCarrierL( const TUint32 aIapId );
+        
+        /**
+         * Informs MPM that application wants to migrate to carrier. 
+         * @param aIapId IAP to migrate to 
+         */
+        void ApplicationMigratesToCarrierL( const TUint32 aIapId);
+        
+        /**
+         * Informs MPM that application rejected the carrier
+         * @param aIapId Rejected IAP 
+         */
+        void ApplicationRejectedTheCarrierL( const TUint32 aIapId );
+        
+        /**
+         * Informs MPM that application accepted the carrier
+         * @param aIapId Accepted IAP  
+         */
+        void ApplicationAcceptedTheCarrierL( const TUint32 aIapId);
+
+        /**
+        * Request for best iap from MPM
+        * 
+        * @param aConnPref connection preference chosen by user
+        * @param aConnId ID of a connection
+        * @param aAppUid application uid of the application using the connection
+        * @param aPolicyPref connection preference chosen by MPM
+        * @param aUser object requesting the answer
+        */
+        void ChooseBestIAPL( TConnPref*            aConnPref,
+                            const TUid&           aAppUid,
+                            TConnPref*            aPolicyPref,
+                            MMPMPolicyRequestsUser* aUser );
+
+        /**
+        * Cancel Request for best iap from MPM
+        */
+        void CancelReselectBestIAP();
+
+        /**
+        * Cancel Request for best iap from MPM
+        */
+        void CancelChooseBestIAPL();
+
+        /**
+        * Cancel ProcessError request.
+        */
+        void CancelProcessError();
+        
+        /**
+         * Request MPM to choose another IAP
+         * 
+         * @param aPolicyPref connection preference chosen by MPM
+         * @param aUser object requesting the answer.
+         */
+        void ReselectIAPL( TConnPref*              aPolicyPref,
+                           MMPMPolicyRequestsUser* aUser );
+
+        /**
+        * Request MPM to process the error
+        *
+        * @param anError error occured at connection
+        * @param aUser object requesting the answer
+        */
+        void ProcessErrorL( TInt&                   anError,
+                            MMPMPolicyRequestsUser* aUser );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CMPMPolicyRequests();
+        
+    public: // from MMPMPolicyNotificationUser
+        /**
+        * Called by AO listening MPM notifications.
+        * @param aNotification Generic nsotification structure class
+        */
+        virtual void PolicyNotification( TMpmNotification& aNotification );
+
+    private:
+        /**
+        * C++ default constructor.
+        */
+        CMPMPolicyRequests();
+
+        /**
+        * 2nd phase constructor.
+        * 
+        * @param aUser reference to class implementing MMPMPolicyNotificationsUser interface  
+        */
+        void ConstructL( MMPMPolicyNotificationUser& aUser );
+
+    private: // from CActive
+
+        /**
+        * Active Object RunL.
+        * @since 5.2
+        */
+        void RunL();
+
+        /**
+        * Active Object DoCancel. 
+        * CActive::Cancel() must not be called.
+        * CMPMPolicyRequests::DoCancel() must not be called.
+        * CMPMPolicyRequests::CancelRequest( TMpmAsynchCodes ) is ok.
+        * @since 5.2
+        */
+        void DoCancel();
+        
+        /**
+        * Active Object RunError
+        * @since 5.2
+        * @param aError Error Leave code from RunL()
+        */
+        TInt RunError( TInt aError );
+
+    private: // private methods
+        
+        /**
+        * Cancels asynchronous request.
+        * @param aRequestCode asynchronous request to be cancelled.
+        * @since 5.2
+        */
+        void CancelRequest( TMpmAsynchCodes aRequestCode );
+
+        /**
+         * Creates a request with iapid and connid and takes it forward.
+         * @param TMpmAsynchCodes a request type
+         * @param aIapId IAP
+         * @since 5.2
+         */
+        void CreatePolicyRequestL( TPolicyServerOperations aRequestCode, 
+                                   const TUint32& aIapId );
+
+        /**
+        * Issue the first request in the policy data list
+        * @since 5.2
+        */
+        
+        void IssueRequest();
+        /**
+        * Delete object asynchronously
+        * @since 5.2
+        */
+        void IssueDeleteRequest();
+
+    private:
+        // policy request list
+        RArray<PolicyRequest>       iPolicyRequests;
+        // client handle to mpm
+        RMPM                        iMpm;
+        TConnectionId               iConnId;
+        // handle MPM notifications
+        //CBearerManPolicyNotif*      iBearerManPolicyNotif;
+        TBool                       iCommitedToDeleteItself;
+        CMPMPolicyNotifications*    iPolicyNotifications;
+        MMPMPolicyNotificationUser* iPolicyNotificationsUser;
+    };
+
+#endif // S60MPMREQUESTS_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/S60MCPR/inc/s60tcprecvwin.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: S60Mcpr's implementation of the TCP receive window interface.
+ * Reads the receive window sizes from Central repository.
+ *
+ */
+
+/**
+ @file s60tcprecvwin.h
+ S60 MCPR's TCP receive window interface.
+ */
+
+#ifndef S60TCPRECVWIN_H
+#define S60TCPRECVWIN_H
+
+#include <tcprecvwin.h>
+#include <e32hashtab.h> 
+
+
+const TUid KCRUIDTcpWindowSizes =
+    {
+    0x101F6D4A
+    };
+const TUint KWlanBearer = 0x3C;
+const TUint KDefaultBearerKey = 0xFF;
+
+class CRepository;
+/**
+ * Default TCP receive window implementation. 
+ * 
+ */
+class CS60TCPReceiveWindowSize : public CTCPReceiveWindowSize
+    {
+
+public:
+    //Default constructor 
+    CS60TCPReceiveWindowSize();
+
+    //Destructor
+    ~CS60TCPReceiveWindowSize();
+
+    //Populates TCP window lookup table for different bearers
+    void Init();
+
+    //Set TCP window size
+    void SetTcpWin( TUint aBearerType );
+
+    //Set max TCP receive window for a network bearer
+    void SetMaxWinSize( TUint aBearerType );
+
+private:
+
+    void SetInfoMapValue( TUint aKey,
+                          CRepository* aRepository,
+                          TInt aDefaultWin );
+
+    //Associative array for storing TCP window size.
+    RHashMap<TUint, TUint> iBearerInfoMap;
+
+    };
+
+#endif //S60TCPRECVWIN_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/S60MCPR/inc/s60tiermanager.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 2008 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: S60 IP tier manager
+*
+*/
+
+/**
+@file s60tiermanager.h
+S60 IP TM.
+*/
+
+#ifndef S60TIERMANAGER_H
+#define S60TIERMANAGER_H
+
+#include <comms-infras/coretiermanager.h>
+
+/**
+ * CS60 Tier Manager selects the MCPR for the connection. 
+ * In practise it creates a new S60 MCPR and provisions selection preferences.
+ */
+class CS60TierManager : public CCoreTierManager
+    {
+public:
+    /**
+     * Symbian two-phase constructor.
+     * @return pointer to new CS60TierManager
+     */
+    static CS60TierManager* NewL( ESock::CTierManagerFactoryBase& aFactory );
+    /**
+     * C++ destructor
+     */
+    ~CS60TierManager();
+protected:
+    /**
+     * C++ constructor
+     */
+    CS60TierManager( ESock::CTierManagerFactoryBase& aFactory, 
+                     const MeshMachine::TNodeActivityMap& aActivityMap );
+    /**
+     * Decide which selector to create  and creates it based on the information available.
+     * @param aSelectionPreferences selection preferences that tell which kind of selection should be done.
+     * @return CSimpleS60SelectorBase 
+     */
+    virtual ESock::MProviderSelector* DoCreateProviderSelectorL( const Meta::SMetaData& aSelectionPreferences );
+    /**
+     * Receives message.
+     */
+    virtual void ReceivedL( const Messages::TRuntimeCtxId& aSender, 
+                            const Messages::TNodeId& aRecipient, 
+                            Messages::TSignatureBase& aMessage );
+    };
+
+#endif // S60TIERMANAGER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/S60MCPR/inc/s60tiermanagerfactory.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,60 @@
+/*
+* Copyright (c) 2008 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: S60 IP tier manager factory
+*
+*/
+
+/**
+@file s60tiermanagerfactory.h
+S60 IP TM factory
+*/
+
+#ifndef S60TIERMANAGERFACTORY_H
+#define S60TIERMANAGERFACTORY_H
+
+#include <comms-infras/ss_tiermanager.h>
+#include <in_sock.h>
+
+/**
+ * Factory for TM.
+ */
+class CS60TierManagerFactory : public ESock::CTierManagerFactoryBase
+    {
+public:
+
+	enum {
+		iTypeId = KAfInet ,
+		iUid = 0x101F6D4A };
+    /** 
+     * Factory function for the factory which manages ip level meta connection providers.
+     * This function also acts as the single ECom entry point into this object.
+     * @param aParentContainer the parent factory container which owns this factory
+     * @return factory for IP level meta connection providers
+     */
+    static CS60TierManagerFactory* NewL( TAny* aParentContainer );
+protected:
+    /** 
+     * Constructor for Ip level meta connection providers.
+     * @param aFactoryId the ID which this factory can be looked up by
+     * @param aParentContainer the parent factory container which owns this factory
+     */
+	CS60TierManagerFactory( TUid aTierTypeId, TUid aFactoryUid, ESock::CTierManagerFactoryContainer& aParentContainer );
+    /**
+     * DoCreateObjectL
+     */
+    virtual ESock::ACommsFactoryNodeId* DoCreateObjectL( ESock::TFactoryQueryBase& aQuery );
+    };
+
+#endif //S60TIERMANAGERFACTORY_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/S60MCPR/inc/s60tiermanagerselector.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 2008 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: S60 IP tier manager selector
+*
+*/
+
+/**
+@file s60tiermanagerselector.h
+S60 IP TM selector.
+*/
+
+#ifndef S60TIERMANAGERSELECTOR_H
+#define S60TIERMANAGERSELECTOR_H
+
+#include <comms-infras/simpleselectorbase.h>
+
+// Forward declaration
+class ESock::CMetaConnectionProviderBase;
+
+/**
+ * TS60ProviderSelectorFactory
+ */
+class TS60ProviderSelectorFactory
+    {
+public:
+    static ESock::MProviderSelector* NewSelectorL(const Meta::SMetaData& aSelectionPreferences);
+    };
+
+/**
+ * CSimpleS60SelectorBase
+ * Base for simple selectors.
+ */
+class CSimpleS60SelectorBase : public CBase, public ASimpleSelectorBase
+    {
+public:
+    explicit CSimpleS60SelectorBase( const Meta::SMetaData& aSelectionPreferences );
+    virtual ~CSimpleS60SelectorBase();
+
+protected:
+    ESock::ISelectionNotify iSelectionNotify; //Needed as a member because of the asynch selection
+private:
+    /**
+     * Implements the selection logic
+     */
+    virtual void SelectL( ESock::ISelectionNotify& aSelectionNotify );
+    /**
+     * Instantiates the MCPR or finds an old one that can be reused.
+     */
+    ESock::CMetaConnectionProviderBase* FindOrCreateProviderL( TUint aAccessPoint );
+private:
+    TUint32 iDefaultAp;    
+    };
+
+#endif // S60IPTIERMANAGERSELECTOR_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/S60MCPR/inc/s60tmactivities.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: S60 MCPR's activities.
+*
+*/
+
+/**
+@file s60mcpractivities.h
+S60 MCPR's activities.
+*/
+
+#ifndef S60TM_ACTIVITIES_H
+#define S60TM_ACTIVITIES_H
+
+#include <comms-infras/mobilitymcpractivities.h>
+#include <comms-infras/ss_tiermanager.h>
+#include <comms-infras/coretiermanagerstates.h>
+#include <comms-infras/coretiermanageractivities.h>
+
+#include "s60mcprstates.h"
+#include "s60tiermanager.h"
+
+// Forward declarations
+class CS60MetaConnectionProvider;
+
+namespace S60TierManagerActivities
+    {
+    DECLARE_ACTIVITY_MAP(S60TierManagerMap)
+    }
+
+namespace S60TmProviderActivitySuper
+    {
+
+    typedef MeshMachine::TNodeContext<CCoreTierManager, CoreNetStates::TContext> TContext;
+
+    DECLARE_SMELEMENT_HEADER(TSelectProviderSuper,
+                             MeshMachine::TStateTransition<TContext>,
+                             NetStateMachine::MStateTransition,
+                             TMStates::TContext)
+	
+	virtual void DoL();
+
+    DECLARE_SMELEMENT_FOOTER( TSelectProviderSuper )
+    }
+
+#endif // S60TM_ACTIVITIES_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/S60MCPR/rom/s60mcpr.iby	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: S60 MCPR IP TM 
+*
+*/
+#ifndef S60MCPR_IPTRANSPORT_IBY
+#define S60MCPR_IPTRANSPORT_IBY
+
+#include <mobilitycoreproviders.iby>
+
+#ifdef _DEBUG
+ECOM_PLUGIN_UDEB(s60mcpr.dll,101F6D4A.rss)
+#else
+ECOM_PLUGIN(s60mcpr.dll,101F6D4A.rss)
+#endif
+#endif //S60MCPR_IPTRANSPORT_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/S60MCPR/src/101F6D4A.rss	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2008 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: Registry info for S60 Meta Connection Provider plug-in
+*
+*/
+
+/**
+@file
+Registry info for S60 Meta Connection Provider plug-in
+*/
+
+#include <ecom/registryinfo.rh>
+
+RESOURCE REGISTRY_INFO theInfo
+{
+dll_uid = 0x101F6D4A;
+interfaces = 
+    {
+    INTERFACE_INFO
+        {
+        interface_uid =  0x10274546;
+        implementations = 
+            {
+           IMPLEMENTATION_INFO
+                {
+                implementation_uid = 0x101F6D4B;
+                version_no = 1;
+                display_name = "S60 Connection Provider Factory";
+                default_data = "S60MCprFactory";
+                opaque_data = "";
+                }
+            };
+        },
+    INTERFACE_INFO
+        {
+        interface_uid =  0x10281DD7;
+        implementations = 
+            {
+           IMPLEMENTATION_INFO
+                {
+                implementation_uid = 0x101F6D4A;
+                version_no = 1;
+                display_name = "S60 Tier Manager";
+                default_data = "S60TierManager";
+                opaque_data = "";
+                }
+            };
+        }
+    };
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/S60MCPR/src/ecom_impl.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2008 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
+*
+*/
+
+/**
+@file ecom_impl.cpp
+ECOM plugin
+*/
+
+#include <ecom/implementationproxy.h>
+#include <ecom/ecom.h>
+
+#include "s60mcprfactory.h"
+#include "s60tiermanagerfactory.h"
+
+//
+// ECOM Implementation
+//
+
+const TImplementationProxy ImplementationTable[] =
+    {   
+    IMPLEMENTATION_PROXY_ENTRY(CS60MetaConnectionProviderFactory::iUid, CS60MetaConnectionProviderFactory::NewL),
+    IMPLEMENTATION_PROXY_ENTRY(CS60TierManagerFactory::iUid, CS60TierManagerFactory::NewL), 
+    };
+
+
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+    {
+    aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+    return ImplementationTable;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/S60MCPR/src/s60extendedtmselector.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,213 @@
+/*
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: S60 IP TM selector implementation
+*
+*/
+
+/**
+@file s60tiermanagerselector.cpp
+S60 IP TM selector implementation
+*/
+
+#include <comms-infras/ss_log.h>
+#include <comms-infras/ss_tiermanagerutils.h>
+#include <commsdattypesv1_1.h> // CommsDat
+#include <es_connpref.h>    //TConnIdList
+#include <commdbconnpref.h>
+#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include <commsdattypeinfov1_1_internal.h>
+#include <commsdattypesv1_1_partner.h> 
+#endif
+#include <extendedconnpref.h>
+
+#include "s60extendedtmselector.h"
+#include "s60tiermanagerfactory.h"
+#include "s60mcpr.h"
+
+#include <comms-infras/esock_params_internal.h>
+
+
+using namespace ESock;
+using namespace CommsDat;
+
+// -----------------------------------------------------------------------------
+// IpProto Tier Manager's UID.
+// Since meaning of the selection policy id changes with
+// the legacy flavor it is difficult to derive the next layer
+// tier's id dynamically when supporting all of the legacy scenarios.
+// At the same time it is known that for all of these legacy
+// setups this is and always will be the only next layer tier manager.
+// -----------------------------------------------------------------------------
+static const TUid KLegacyNextLayerTierId = { 0x10281DF0 }; //CIPProtoTierManagerFactory::iUid
+
+// -----------------------------------------------------------------------------
+// CExtendedS60SelectorBase::CExtendedS60SelectorBase
+// -----------------------------------------------------------------------------
+//
+CExtendedS60SelectorBase::CExtendedS60SelectorBase(  TUid aTierId, const ESock::RConnPrefList& aConnPrefList )
+    :    ASimpleSelectorBase( )
+    {
+    iTierId = aTierId;
+    iConnPrefList = aConnPrefList;
+    }
+
+// -----------------------------------------------------------------------------
+// CExtendedS60SelectorBase::~CExtendedS60SelectorBase
+// -----------------------------------------------------------------------------
+//
+CExtendedS60SelectorBase::~CExtendedS60SelectorBase()
+    {
+    }
+        
+// -----------------------------------------------------------------------------
+// CExtendedS60SelectorBase::SelectL
+// -----------------------------------------------------------------------------
+//
+void CExtendedS60SelectorBase::SelectL(ISelectionNotify& aSelectionNotify)
+    {
+    //This code doesn't need to be in a seperate selector. It could be moved to
+    //a transition if the method FindOrCreateProviderL was re-created in
+    //another file (it is currently inherited from ASimpleSelectorBase)
+
+    CMDBSession* dbs = CMDBSession::NewLC(KCDVersion1_2);
+
+    iTierRecord = TierManagerUtils::LoadTierRecordL(iTierId,*dbs);
+    CleanupStack::Pop();
+    iDbs = dbs;
+
+    //__ASSERT_DEBUG(iDbs, User::Panic(KSpecAssert_ESockCrPrvTMSelC, 1));
+    //__ASSERT_DEBUG(iTierRecord, User::Panic(KSpecAssert_ESockCrPrvTMSelC, 2));
+
+    TUint accessPoint = 0;
+    CCDAccessPointRecord* apRec;
+    TUid tierId;
+    TUint selected = 0;
+
+    // Get sub session unique id
+    ESock::RConnPrefList::TIter<TConnCSRPref> iterCSR = iConnPrefList.getIter<TConnCSRPref>();
+
+    // If no prefs in list return error
+    if (iterCSR.IsEnd())
+        {
+        User::Leave(KErrArgument);
+        }
+    
+    //This iterator runs through all the instances of TConnCSRPref
+    while(!iterCSR.IsEnd())
+        {
+        iSubSessionUniqueId = iterCSR->SubSessionUniqueId();
+        iterCSR++;
+        }
+    
+    //This iterator links to all the elements of TExtendedConnPref that exist in the list
+    ESock::RConnPrefList::TIter<TExtendedConnPref> iterAP = iConnPrefList.getIter<TExtendedConnPref>();
+
+    // If no prefs in list return error
+    if (iterAP.IsEnd())
+        {
+        User::Leave(KErrArgument);
+        }
+    
+    //This iterator runs through all the instances of TExtendedConnPref
+    while(!iterAP.IsEnd())
+        {
+        accessPoint = iTierRecord->iDefaultAccessPoint;
+        //The access point record that that access point represents is retrived
+        apRec = TierManagerUtils::LoadAccessPointRecordL(accessPoint,*iDbs);
+        tierId = TierManagerUtils::MapElementIdToTagId(apRec->iTier, *iDbs);
+
+        delete apRec;
+        // If the access point is related to this tier manager the provider
+        // is created
+        if(iTierId == tierId)
+            {
+            aSelectionNotify.SelectComplete(this, FindOrCreateProviderL(accessPoint));
+            ++selected;
+            iterAP++;
+            // For now we accept only one instance of TExtendedConnPref 
+            break;
+            }
+        else
+            {
+            LOG_DETAILED( ESockLog::Printf(KCoreTMgrSelSupSubTag, _L("CCoreProviderSelectorSuper %08x:\t AP %d not in tier %08x"), this, accessPoint, iTierId) );
+            iterAP++;
+            }
+        }
+
+    if (selected == 0)
+        {
+        LOG_DETAILED( ESockLog::Printf(KCoreTMgrSelSupSubTag, _L("CCoreProviderSelectorSuper %08x:\t No APs selected [Tier: %08x]"), this, iTierId) );
+        User::Leave(KErrArgument);
+        }
+    
+    aSelectionNotify.SelectComplete(this, NULL);
+    return;
+    }
+
+// -----------------------------------------------------------------------------
+// CExtendedS60SelectorBase::FindOrCreateProviderL
+// -----------------------------------------------------------------------------
+//
+CMetaConnectionProviderBase* CExtendedS60SelectorBase::FindOrCreateProviderL( TUint aAccessPoint )
+    {
+    ASSERT(aAccessPoint); //Should not be 0 now.
+
+    //Find factory
+    TUid mCprUid = TierManagerUtils::ReadMCprUidL( aAccessPoint, *iDbs );
+    CMetaConnectionProviderFactoryBase* factory = 
+        static_cast<CMetaConnectionProviderFactoryBase*>(iMetaContainer.FindOrCreateFactoryL( mCprUid ));
+
+    //Create the provider
+    TUid tierId = TUid::Uid( iTierRecord->iRecordTag );
+    TProviderInfo providerInfo( tierId, aAccessPoint );
+    TUid tierImplUid = TierManagerUtils::MapTierIdtoTierImplIdL(tierId,*iDbs);
+    TMetaConnectionFactoryQuery query( providerInfo, tierImplUid );
+    
+    //We are not looking for an existing provider, we always create a new one.
+    //This is the legacy selection (can also be the legacy attach, one layer deep selection)
+    CMetaConnectionProviderBase* provider = static_cast<CMetaConnectionProviderBase*>( factory->CreateObjectL( query ));
+    CS60MetaConnectionProvider* prov = static_cast<CS60MetaConnectionProvider*>( provider );
+    
+    CleanupStack::PushL( provider );
+    
+    // Provision selection preferences to S60 NetMCPR.
+    prov->SetConnPrefList( iConnPrefList );
+    prov->SetSubSessionUniqueId( iSubSessionUniqueId );
+    
+    // Change the provider info so that this provider is never found by other selections
+    const TProviderInfo& pi = provider->ProviderInfo();
+    provider->SetProviderInfo( TProviderInfo( pi.TierId(), pi.APId(), provider )); //This provider will never be found
+   
+    // Override the selection policy as we always do for legacy prefs
+    ASSERT(provider->AccessPointConfig().FindExtension(TOverridenSelectionPrefsExt::TypeId())==NULL);
+
+    RMetaExtensionContainer mec;
+    mec.Open(provider->AccessPointConfig());
+    CleanupClosePushL(mec);
+
+    TOverridenSelectionPrefsExt* ext = new (ELeave) TOverridenSelectionPrefsExt( KLegacyNextLayerTierId, iSelectionPrefs );
+    CleanupStack::PushL( ext );
+    mec.AppendExtensionL( ext ); //The ownership of the extension goes to AccessPointConfig now.
+    CleanupStack::Pop( ext );
+
+    provider->AccessPointConfig().Close();
+    provider->AccessPointConfig().Open(mec);
+    CleanupStack::PopAndDestroy(&mec);
+    
+    CleanupStack::Pop( provider );
+    provider->IncrementBlockingDestroy();
+    return provider;
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/S60MCPR/src/s60mcpr.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,482 @@
+/*
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: S60 MCPR implementation
+*
+*/
+
+
+/**
+@file s60mcpr.cpp
+S60 MCPR implementation
+*/
+
+#include <comms-infras/ss_msgintercept.h>
+
+#include "s60mcpr.h"
+#include "s60mcprstates.h"
+#include "s60mcpractivities.h"
+
+#ifdef SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
+
+#include <comms-infras/ss_protopt.h>
+#include "s60tcprecvwin.h"
+
+#endif //SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
+
+using namespace Messages;
+using namespace MeshMachine;
+using namespace ESock;
+using namespace MCprActivities;
+
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// CS60MetaConnectionProvider::NewL
+// -----------------------------------------------------------------------------
+//
+CS60MetaConnectionProvider* CS60MetaConnectionProvider::NewL( CMetaConnectionProviderFactoryBase& aFactory, 
+                                                              const TProviderInfo& aProviderInfo )
+    {
+    S60MCPRLOGSTRING("S60MCPR::NewL()");
+
+    CS60MetaConnectionProvider* self =
+        new (ELeave) CS60MetaConnectionProvider( aFactory,
+                                                 aProviderInfo,
+                                                 S60MCprActivities::S60MCprActivityMap::Self());
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CS60MetaConnectionProvider::CS60MetaConnectionProvider
+// -----------------------------------------------------------------------------
+//
+CS60MetaConnectionProvider::CS60MetaConnectionProvider( CMetaConnectionProviderFactoryBase& aFactory,
+                                                        const TProviderInfo& aProviderInfo, 
+                                                        const MeshMachine::TNodeActivityMap& aActivityMap )
+    :   CMobilityMetaConnectionProvider( aFactory, aProviderInfo, aActivityMap ),
+        iDataClientStatusStarted( EFalse )
+    {
+    LOG_NODE_CREATE(KS60MCprTag, CS60MetaConnectionProvider);
+    }
+
+// -----------------------------------------------------------------------------
+// CS60MetaConnectionProvider::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CS60MetaConnectionProvider::ConstructL()
+    {
+    CCoreMetaConnectionProvider::ConstructL();
+    iPolicy = CMPMPolicyRequests::NewL( *(MMPMPolicyNotificationUser*)this );
+    S60MCPRLOGSTRING2("S60MCPR<%x>::ConstructL() iPolicy=%x",(TInt*)this, (TInt*)iPolicy);
+    
+#ifdef SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
+    
+    RMetaExtensionContainer mec;
+    mec.Open(iAccessPointConfig);
+    CleanupClosePushL(mec);
+ 
+    //Append pointer to lookup table which holds the various TCP receive window sizes for different bearer types.
+    CTCPReceiveWindowSize* receiveWindow;
+    receiveWindow = new (ELeave)CS60TCPReceiveWindowSize();
+        
+    CleanupStack::PushL(receiveWindow);
+    mec.AppendExtensionL(receiveWindow);
+    CleanupStack::Pop(receiveWindow);
+    
+    //Append the pointer of CSAPSetOpt which provides generic SetOpt( ) implementation
+    CSAPSetOpt* protoOption = new (ELeave)CSAPSetOpt();
+    CleanupStack::PushL(protoOption);
+    mec.AppendExtensionL(protoOption);
+    CleanupStack::Pop(protoOption);
+
+    iAccessPointConfig.Close();
+    iAccessPointConfig.Open(mec);
+    CleanupStack::PopAndDestroy(&mec);
+#endif //SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
+    }
+
+// -----------------------------------------------------------------------------
+// CS60MetaConnectionProvider::~CS60MetaConnectionProvider
+// -----------------------------------------------------------------------------
+//
+CS60MetaConnectionProvider::~CS60MetaConnectionProvider()
+    {
+    if ( iPolicy )
+        {
+        iPolicy->RequestDelete();
+        }
+    S60MCPRLOGSTRING1("S60MCPR<%x>::~CS60MetaConnectionProvider",(TInt*)this);
+    LOG_NODE_DESTROY(KS60MCprTag, CS60MetaConnectionProvider);
+    }
+
+// -----------------------------------------------------------------------------
+// CS60MetaConnectionProvider::ReceivedL
+// -----------------------------------------------------------------------------
+//
+void CS60MetaConnectionProvider::ReceivedL( const TRuntimeCtxId& aSender, 
+                                            const TNodeId& aRecipient, 
+                                            TSignatureBase& aMessage )
+    {
+    S60MCPRLOGSTRING2("S60MCPR<%x>::ReceivedL() aMessage=%d",(TInt*)this, aMessage.MessageId().MessageId());
+    ESOCK_DEBUG_MESSAGE_INTERCEPT(aSender, aMessage, aRecipient);
+
+    TNodeContext<CS60MetaConnectionProvider> ctx( *this, aMessage, aSender, aRecipient );
+    CMobilityMetaConnectionProvider::Received( ctx );
+    User::LeaveIfError( ctx.iReturn );
+    }
+
+// -----------------------------------------------------------------------------
+// CS60MetaConnectionProvider::Policy
+// -----------------------------------------------------------------------------
+//
+CMPMPolicyRequests* CS60MetaConnectionProvider::Policy()
+    {
+    return iPolicy;
+    }
+
+// -----------------------------------------------------------------------------
+// CS60MetaConnectionProvider::RequestPermissionToSendStarted
+// -----------------------------------------------------------------------------
+//
+TBool CS60MetaConnectionProvider::RequestPermissionToSendStarted()
+    {
+    if ( !iDataClientStatusStarted )
+        {
+        iDataClientStatusStarted = ETrue;
+        return ETrue;
+        }
+    else
+        {
+        return EFalse; 
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CS60MetaConnectionProvider::RequestPermissionToSendStopped
+// -----------------------------------------------------------------------------
+//
+TBool CS60MetaConnectionProvider::RequestPermissionToSendStopped()
+    {
+    if ( iDataClientStatusStarted )
+        {
+        iDataClientStatusStarted = EFalse;
+        return ETrue;
+        }
+    else
+        {
+        return EFalse; 
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CS60MetaConnectionProvider::PolicyPrefs
+// -----------------------------------------------------------------------------
+//
+TPolicyConnPref& CS60MetaConnectionProvider::PolicyPrefs()
+    {
+    return iPolicyPrefs;
+    }
+
+// -----------------------------------------------------------------------------
+// CS60MetaConnectionProvider::SetPolicyPrefs
+// -----------------------------------------------------------------------------
+//
+void CS60MetaConnectionProvider::SetPolicyPrefs( TPolicyConnPref& aPrefs )
+    {
+    iPolicyPrefs = aPrefs;
+    }
+
+// -----------------------------------------------------------------------------
+// CS60MetaConnectionProvider::SetSelectionPrefs
+// -----------------------------------------------------------------------------
+//
+void CS60MetaConnectionProvider::SetSelectionPrefs( TSelectionPrefs& aPrefs )
+    {
+    iOrigPrefs = aPrefs;
+    }
+
+// -----------------------------------------------------------------------------
+// CS60MetaConnectionProvider::SelectionPrefs
+// -----------------------------------------------------------------------------
+//
+const TSelectionPrefs& CS60MetaConnectionProvider::SelectionPrefs()
+    { 
+    return iOrigPrefs; 
+    }
+
+// -----------------------------------------------------------------------------
+// CS60MetaConnectionProvider::SetConnPrefList
+// -----------------------------------------------------------------------------
+//
+void CS60MetaConnectionProvider::SetConnPrefList( const ESock::RConnPrefList &aConnPrefList )
+    {
+    iConnPrefList = aConnPrefList;
+    }
+
+// -----------------------------------------------------------------------------
+// CS60MetaConnectionProvider::ConnPrefList
+// -----------------------------------------------------------------------------
+//
+ESock::RConnPrefList CS60MetaConnectionProvider::ConnPrefList() const
+    {
+    return iConnPrefList;
+    }
+
+// -----------------------------------------------------------------------------
+// CS60MetaConnectionProvider::SetSubSessionUniqueId
+// -----------------------------------------------------------------------------
+//
+void CS60MetaConnectionProvider::SetSubSessionUniqueId( const TSubSessionUniqueId aSubSessionUniqueId)
+    {
+    iSubSessionUniqueId = aSubSessionUniqueId;
+    }
+
+// -----------------------------------------------------------------------------
+// CS60MetaConnectionProvider::SubSessionUniqueId
+// -----------------------------------------------------------------------------
+//
+TSubSessionUniqueId CS60MetaConnectionProvider::SubSessionUniqueId() const
+    {
+    return iSubSessionUniqueId;
+    }
+
+// -----------------------------------------------------------------------------
+// CS60MetaConnectionProvider::IsHandshakingNow
+// -----------------------------------------------------------------------------
+//
+TBool CS60MetaConnectionProvider::IsHandshakingNow() const
+    {
+    return iIsHandshakingNow;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CS60MetaConnectionProvider::SetHandshakingFlag
+// -----------------------------------------------------------------------------
+//
+void CS60MetaConnectionProvider::SetHandshakingFlag()
+    {
+    iIsHandshakingNow = ETrue;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CS60MetaConnectionProvider::ClearHandshakingFlag
+// -----------------------------------------------------------------------------
+//
+void CS60MetaConnectionProvider::ClearHandshakingFlag()
+    {
+    iIsHandshakingNow = EFalse;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CS60MetaConnectionProvider::PolicyNotification
+// -----------------------------------------------------------------------------
+//
+void CS60MetaConnectionProvider::PolicyNotification( TMpmNotification& aNotification )
+    {
+    switch ( aNotification.iMPMNotificationType )
+        {
+        case EMPMPreferredIAPAvailable:
+            {
+            TMpmNotificationPrefIAPAvailable& notification = 
+                static_cast<TMpmNotificationPrefIAPAvailable&>(
+                             const_cast<TMpmNotification&>( aNotification ) );
+
+            //HandlePreferredIAPAvailable( const_cast<TMpmNotificationPrefIAPAvailable&>( notification ) );
+
+            // Check if the TPrefIAPNotifInfo contains new or old IAP. 
+            //
+            if ( ServiceProvider() &&
+                 ((RMetaServiceProviderInterface*)ServiceProvider())->ProviderInfo().APId() != notification.iNewIapId )
+                {
+                S60MCPRLOGSTRING2("S60MCPR<%x>::PolicyNotification() EMPMPreferredIAPAvailable IAP %d",(TInt*)this,notification.iNewIapId);
+
+                // Store PolicyNotification
+                // This could happen if PolicyServer sends notification too early.
+                //
+                StorePolicyNotification( aNotification );
+                
+                // Send preferred carrier message into meshmachine.
+                //
+                RNodeInterface ni;
+                ni.OpenPostMessageClose( NodeId(), 
+                                         NodeId(), 
+                                         TCFS60MCPRMessage::TMPMPreferredCarrierAvailableMsg( (TAny*)&notification ).CRef() );
+                }
+#ifdef _DEBUG
+            else
+                {
+                S60MCPRLOGSTRING2("S60MCPR<%x>::PolicyNotification() EMPMPreferredIAPAvailable SAME IAP %d",(TInt*)this,notification.iNewIapId );
+                }
+#endif
+            break;
+            }
+        case EMPMMobilityErrorNotification:
+            {
+            TMpmNotificationError& notification = 
+                static_cast<TMpmNotificationError&>(
+                             const_cast<TMpmNotification&>( aNotification ) );
+            
+                S60MCPRLOGSTRING2("S60MCPR<%x>::PolicyNotification() EMPMMobilityErrorNotification %d",(TInt*)this,notification.iError);
+
+            // Store PolicyNotification
+            // This could happen if PolicyServer sends notification too early.
+            //
+            StorePolicyNotification( aNotification );
+
+            // Send error notification into meshmachine.
+            //
+            RNodeInterface ni;
+            ni.OpenPostMessageClose( NodeId(), 
+                                     NodeId(), 
+                                     TCFS60MCPRMessage::TMPMErrorNotificationMsg( notification.iError ).CRef() );
+            break;
+            }
+
+        case EMPMClientErrorNotification:
+            {
+            TMpmNotificationError& notification = 
+                static_cast<TMpmNotificationError&>(
+                             const_cast<TMpmNotification&>( aNotification ) );
+                        
+            S60MCPRLOGSTRING2("S60MCPR<%x>::PolicyNotification() EMPMClientErrorNotification %d",(TInt*)this,notification.iError);
+
+            PostToClients<TDefaultClientMatchPolicy>( TNodeCtxId( 0, Id() ),
+                                                      TCFDataClient::TStop( notification.iError ).CRef(),
+                                                      TClientType( TCFClientType::EData) );
+            break;
+            }
+
+        case EMPMStartIAPNotification:
+            {
+            TMpmNotificationStartIAP& notification = 
+                static_cast<TMpmNotificationStartIAP&>(
+                             const_cast<TMpmNotification&>( aNotification ) );
+
+            const TStartIAPNotifInfo& info = notification.iInfo;
+
+            S60MCPRLOGSTRING2("S60MCPR<%x>::PolicyNotification() EMPMStartIAPNotification IAP %d",(TInt*)this,info.iIap);
+
+            // Store PolicyNotification
+            // This could happen if PolicyServer sends notification too early.
+            //
+            StorePolicyNotification( aNotification );
+            
+            // The TMPMStartIAPNotificationMsg only has effect if there's an activity waiting for it.
+            //
+            RNodeInterface ni;
+            ni.OpenPostMessageClose( NodeId(), 
+                                     NodeId(), 
+                                     TCFS60MCPRMessage::TMPMStartIAPNotificationMsg( info.iIap ).CRef() ); 
+            break;
+            }
+        case EMPMStopIAPNotification:
+            {
+            TMpmNotificationStopIAP& notification = 
+                static_cast<TMpmNotificationStopIAP&>( const_cast<TMpmNotification&>( aNotification ) );
+
+            // Allow TStop message only when ServiceProvider exists and the IAP matches or is unspecified. 
+            // 
+            if ( ServiceProvider() && 
+                    (((RMetaServiceProviderInterface*)ServiceProvider())->ProviderInfo().APId() == notification.iInfo.iIap ||
+                    notification.iInfo.iIap == 0 )) 
+                {
+                S60MCPRLOGSTRING2("S60MCPR<%x>::PolicyNotification() EMPMStopIAPNotification IAP %d",(TInt*)this,notification.iInfo.iIap);
+
+                //TODO migrate to use MCPR's TStop and vertical msg down. Not supported at the moment.
+                /*PostToClients<TDefaultClientMatchPolicy>( TNodeCtxId( 0, Id() ),
+                                                          TCFServiceProvider::TStop( KErrCancel ).CRef(),
+                                                          TClientType( TCFClientType::EData) );*/
+                }
+#ifdef _DEBUG
+            else
+                {
+                S60MCPRLOGSTRING2("S60MCPR<%x>::PolicyNotification() EMPMStopIAPNotification NO MATCH! IAP %d",(TInt*)this,notification.iInfo.iIap);
+                }
+#endif
+            break;
+            }
+        default:
+            {
+#ifdef _DEBUG
+            // In debug builds, panic
+            _LIT( KPanicMsg,
+                  "S60MCPR::NotificationReceived: Invalid case" );
+            User::Panic( KPanicMsg, KErrNotSupported );
+#endif
+            break;
+            }
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CS60MetaConnectionProvider::ReSendPolicyNotification
+// -----------------------------------------------------------------------------
+//
+void CS60MetaConnectionProvider::ReSendPolicyNotification()
+    {
+    if ( iPendingNotification.Length() > 0 )
+        {
+        // Typically deliver the notification and resubmit a request for new one.
+        TUint8* msgBufferPtr = const_cast<TUint8*>( iPendingNotification.Ptr() );
+        TMpmNotification* notification = reinterpret_cast<TMpmNotification*>( msgBufferPtr );
+
+        S60MCPRLOGSTRING1("S60MCPR<%x>::ReSendPolicyNotification()",(TInt*)this);
+        
+        PolicyNotification( *const_cast<TMpmNotification*>( notification ) );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CS60MetaConnectionProvider::ClearPolicyNotification
+// -----------------------------------------------------------------------------
+//
+void CS60MetaConnectionProvider::ClearPolicyNotification()
+    {
+    iPendingNotification.Zero();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CS60MetaConnectionProvider::StorePolicyNotification
+// -----------------------------------------------------------------------------
+//
+void CS60MetaConnectionProvider::StorePolicyNotification( TMpmNotification& aNotification )
+    {
+    // Store PolicyNotification
+    // This could happen if PolicyServer sends notification too early.
+    //
+    if ( iPendingNotification.Length() == 0 )
+        {
+        ASSERT(Mem::Copy((TAny*)iPendingNotification.Ptr(), &aNotification, aNotification.Length()));
+        iPendingNotification.SetLength( aNotification.Length() );
+        }
+#ifdef _DEBUG
+    else
+        {
+        S60MCPRLOGSTRING2("S60MCPR<%x>::StorePolicyNotification() Notification already exists",
+                  (TInt*)this, reinterpret_cast<TMpmNotification*>( &iPendingNotification )->iMPMNotificationType);
+        }
+#endif
+    }
+	
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/S60MCPR/src/s60mcpractivities.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,425 @@
+/*
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: S60 MCPR activities implementation
+*
+*/
+
+/**
+@file s60mcpractivities.cpp
+S60 MCPR activities implementation
+*/
+
+#include "s60mcpractivities.h"
+
+using namespace Messages;
+using namespace MeshMachine;
+using namespace ESock;
+using namespace MCprActivities;
+
+// -----------------------------------------------------------------------------
+// S60MCprSelectActivity
+// -----------------------------------------------------------------------------
+//
+namespace S60MCprSelectActivity
+    {
+	namespace Simple = S60MCprSimpleSelectActivity;
+	
+	DECLARE_DEFINE_CUSTOM_NODEACTIVITY( ECFActivitySelect, 
+	                                    S60MCprSelect,
+	                                    TCFSelector::TSelect,
+	                                    CSelectNextLayerActivity::NewL )
+    
+    // Reply from TAwaitingSelectNextLayer if no choices, otherwise accept
+    FIRST_NODEACTIVITY_ENTRY( TAwaitingSelectNextLayer,
+                              Simple::TChooseBestIAPRequiredOrNoTagOrSetChosenApActive )
+    
+    // Execute ChooseBestIAPL() to MPM to resolve the most preferred IAP.
+    NODEACTIVITY_ENTRY( S60MCprStates::KChooseBestIAPRequired,
+                        Simple::TChooseBestIAP,
+                        Simple::TAwaitingChooseBestIAP,
+                        MeshMachine::TNoTag )
+    
+    // ChooseBestIAP done or not required
+    THROUGH_NODEACTIVITY_ENTRY( KNoTag,
+                                MeshMachine::TDoNothing,
+                                MCprStates::TSelectedProvider )
+    
+    // Start the selection main loop
+    NODEACTIVITY_ENTRY( MCprStates::KSelectedProvider, 
+                        CSelectNextLayerActivity::TFindOrCreateTierManager, 
+                        MCprStates::TAwaitingTierManagerCreated, 
+                        MeshMachine::TNoTag )
+    
+    // Join the newly created tier manager
+    NODEACTIVITY_ENTRY( KNoTag, 
+                        CSelectNextLayerActivity::TJoinTierManager, 
+                        CoreStates::TAwaitingJoinComplete, 
+                        MeshMachine::TNoTag )
+    
+    // Select next provider and enter the selection internal loop if provider received. Break if SelectComplete(NULL).
+    // Then post the selection list to TM.
+    NODEACTIVITY_ENTRY( KNoTag,
+                        TSelectNextLayer,
+                        MCprStates::TAwaitingSelectComplete, 
+                        CSelectNextLayerActivity::TNoTagOrSelectedProviderIsNull )
+    
+    // Add provider info
+    NODEACTIVITY_ENTRY( KNoTag, 
+                        CSelectNextLayerActivity::TAddProviderInfo, 
+                        MCprStates::TAwaitingSelectComplete, 
+                        CSelectNextLayerActivity::TNoTagBackwardsOrJoinServiceProvider )
+    
+    // Break the selection internal loop if SelectComplete(NULL), otherwise stay in this tripple
+    NODEACTIVITY_ENTRY( MCprStates::KJoinServiceProvider,
+                        CSelectNextLayerActivity::TJoinServiceProvider,
+                        CoreStates::TAwaitingJoinComplete,
+                        MeshMachine::TNoTag )
+    
+    // Send select complete
+    THROUGH_NODEACTIVITY_ENTRY( KNoTag, 
+                                CSelectNextLayerActivity::TSendSelectComplete,
+                                CSelectNextLayerActivity::TSelectedProviderIsNullOrJoinServiceProviderBackward )
+    
+    // Break the selection main loop if no more choices, otherwise go back again
+    THROUGH_NODEACTIVITY_ENTRY( MCprStates::KSelectedProviderIsNull,
+                                CSelectNextLayerActivity::TLeaveTierManager, 
+                                Simple::TSetChosenApActiveOrSelectedProviderBackward )
+    
+    // Set Selected Node Active
+    THROUGH_NODEACTIVITY_ENTRY( S60MCprStates::KSetChosenApActive,
+                                Simple::TSetChosenApActive, 
+                                MeshMachine::TNoTag )
+    
+    // Finish the activity
+    LAST_NODEACTIVITY_ENTRY( KNoTag,
+                             MCprStates::TSendFinalSelectComplete )
+    
+    NODEACTIVITY_END()
+    }
+
+// -----------------------------------------------------------------------------
+// S60MCprSimpleSelectActivity
+// -----------------------------------------------------------------------------
+//
+namespace S60MCprSimpleSelectActivity
+    {
+    DECLARE_DEFINE_CUSTOM_NODEACTIVITY( ECFActivitySelect, 
+                                        MCprSimpleSelect, 
+		                                TCFSelector::TSimpleSelect,
+                                        CSelectNextLayerActivity::NewL )
+    // Reply from TAwaitingSelectNextLayer if no choices, otherwise accept
+    FIRST_NODEACTIVITY_ENTRY( S60MCprSimpleSelectActivity::TAwaitingSelectNextLayer,
+                              S60MCprSimpleSelectActivity::TChooseBestIAPRequiredOrNoTagOrSetChosenApActive )
+    // Execute ChooseBestIAPL() to MPM to resolve the most preferred IAP.
+    NODEACTIVITY_ENTRY( S60MCprStates::KChooseBestIAPRequired,
+                        S60MCprSimpleSelectActivity::TChooseBestIAP,
+                        S60MCprSimpleSelectActivity::TAwaitingChooseBestIAP,
+                        MeshMachine::TNoTag )
+    // ChooseBestIAP done or not required
+    THROUGH_NODEACTIVITY_ENTRY( KNoTag, 
+		                        MeshMachine::TDoNothing,
+                                MCprStates::TSelectedProvider )
+    // Start the selection main loop
+    NODEACTIVITY_ENTRY( MCprStates::KSelectedProvider, 
+                        CSelectNextLayerActivity::TFindOrCreateTierManager, 
+                        MCprStates::TAwaitingTierManagerCreated, 
+                        MeshMachine::TNoTag )
+    // Join the newly created tier manager
+    NODEACTIVITY_ENTRY( KNoTag,
+                        CSelectNextLayerActivity::TJoinTierManager, 
+                        CoreStates::TAwaitingJoinComplete, 
+                        MeshMachine::TNoTag )
+    // Select next provider and enter the selection internal loop if provider received. Break if SelectComplete(NULL).
+    // Then post the selection list to TM.
+    NODEACTIVITY_ENTRY( KNoTag, 
+                        S60MCprSimpleSelectActivity::TSelectNextLayer, 
+                        MCprStates::TAwaitingSelectComplete, 
+                        CSelectNextLayerActivity::TNoTagOrSelectedProviderIsNull )
+    // Add provider info
+    NODEACTIVITY_ENTRY( KNoTag, 
+                        CSelectNextLayerActivity::TAddProviderInfo, 
+                        MCprStates::TAwaitingSelectComplete, 
+                        CSelectNextLayerActivity::TNoTagBackwardsOrJoinServiceProvider )
+    // Break the selection internal loop if SelectComplete(NULL), otherwise stay in this tripple
+    NODEACTIVITY_ENTRY( MCprStates::KJoinServiceProvider, 
+                        CSelectNextLayerActivity::TJoinServiceProvider, 
+                        CoreStates::TAwaitingJoinComplete, 
+                        MeshMachine::TNoTag )
+    // Send select complete
+    THROUGH_NODEACTIVITY_ENTRY( KNoTag, 
+                                CSelectNextLayerActivity::TSendSelectComplete, 
+                                CSelectNextLayerActivity::TSelectedProviderIsNullOrJoinServiceProviderBackward )
+    // Break the selection main loop if no more choices, otherwise go back again
+    THROUGH_NODEACTIVITY_ENTRY( MCprStates::KSelectedProviderIsNull, 
+                                CSelectNextLayerActivity::TLeaveTierManager, 
+                                S60MCprSimpleSelectActivity::TSetChosenApActiveOrSelectedProviderBackward )
+    // Set Selected Node Active
+    THROUGH_NODEACTIVITY_ENTRY( S60MCprStates::KSetChosenApActive,
+                                S60MCprSimpleSelectActivity::TSetChosenApActive,
+                                MeshMachine::TNoTag )
+    // Finish the activity
+    LAST_NODEACTIVITY_ENTRY( KNoTag, 
+                             MCprStates::TSendFinalSelectComplete )
+    NODEACTIVITY_END()
+    }
+
+// -----------------------------------------------------------------------------
+// Connection Status Notification to MPM.
+// -----------------------------------------------------------------------------
+//
+namespace S60MCprMonitorDataClientStatusActivity
+    {
+    DECLARE_DEFINE_NODEACTIVITY( ECFActivityMonitorProviderStatus, 
+                                 MCprDataClientStatusChange, 
+                                 TCFControlProvider::TDataClientStatusChange )
+    SINGLE_NODEACTIVITY_ENTRY( S60MCprStates::THandleMPMAndCoreDataClientStatusChangeAndDestroyOrphans, 
+                               CoreNetStates::TAwaitingDataClientStatusChange )
+    NODEACTIVITY_END()
+    }
+
+// -----------------------------------------------------------------------------
+// MCprConnectionStartRecovery -activity is overriden error processing activity 
+// based on Symbian's mobilitymcpr implementation.
+// -----------------------------------------------------------------------------
+//
+namespace S60MCprErrorRecoveryActivity
+    {
+    DECLARE_DEFINE_CUSTOM_NODEACTIVITY( ECFActivityConnectionStartRecovery, 
+                                        MCprConnectionStartRecovery,
+                                        TEErrorRecovery::TErrorRecoveryRequest, 
+                                        S60MCprErrorRecoveryActivity::CS60ConnectionRecoveryActivity::NewL )
+    // Intercept the reconnection request if appropriate
+    FIRST_NODEACTIVITY_ENTRY( //MCprStates::TAwaitingConnectionStartRecoveryRequest,
+                              S60MCprErrorRecoveryActivity::TAwaitingNotGoneDownErrorRecoveryRequest,
+                              MeshMachine::TNoTag )
+    // Store error context but do not do proceed during mobility handshake.
+    THROUGH_NODEACTIVITY_ENTRY( KNoTag, 
+                                S60MCprErrorRecoveryActivity::CS60ConnectionRecoveryActivity::TStoreErrorContext,
+                                MeshMachine::TTag<S60MCprStates::KProcessError|NetStateMachine::EForward> )
+                                //S60MCprErrorRecoveryActivity::TProcessErrorBlockedByMobilityHandshaking ) // can't block here.
+    // Decide if it it possible/sensible to reconnect and retry
+    NODEACTIVITY_ENTRY( S60MCprStates::KProcessError,
+                        S60MCprStates::TProcessError,
+                        S60MCprStates::TAwaitingProcessErrorCompleteOrError,
+                        S60MCprErrorRecoveryActivity::TNoTagOrIgnoreErrorOrErrorTag )
+    // ReSelection state, first execute reselect best IAP.
+    NODEACTIVITY_ENTRY( KNoTag,
+                        S60MCprStates::TReselectBestIAP,
+                        S60MCprStates::TAwaitingReselectBestIAPCompleteOrError,
+                        S60MCprErrorRecoveryActivity::TNoTagOrRetryConnectionTagOrErrorTag )
+    // Then execute simpleselect.            
+    NODEACTIVITY_ENTRY( KNoTag, 
+                        MCprStates::TSelectNextLayer,
+                        S60MCprStates::TAwaitingSelectNextLayerCompletedOrError,
+                        S60MCprErrorRecoveryActivity::TNoTagOrProcessErrorBackwardTag ) 
+    // This transition will leave if not possible to recover (==TSendPropagateRecoveryResponse from Transition::Error())
+    NODEACTIVITY_ENTRY( KNoTag, 
+                        S60MCprStates::TRequestReConnect,
+                        MCprStates::TAwaitingReConnectCompleteOrError, 
+                        S60MCprErrorRecoveryActivity::TRetryConnectionOrProcessErrorTagBackward )
+    // Respond with ignore error
+    LAST_NODEACTIVITY_ENTRY( S60MCprStates::KIgnoreError, 
+                             S60MCprErrorRecoveryActivity::TSendIgnoreRecoveryResponse )
+    // Respond with retry
+    LAST_NODEACTIVITY_ENTRY( S60MCprStates::KRetryConnection, 
+                             S60MCprErrorRecoveryActivity::CS60ConnectionRecoveryActivity::TSendRetryRecoveryResponse )
+    // Respond with propagate - the reconnect failed.
+    LAST_NODEACTIVITY_ENTRY( KErrorTag, 
+                             S60MCprErrorRecoveryActivity::CS60ConnectionRecoveryActivity::TSendPropagateRecoveryResponse )
+    NODEACTIVITY_END()
+    } // namespace S60MCprErrorRecoveryActivity
+
+// -----------------------------------------------------------------------------
+// S60MCprMobilityActivity
+// -----------------------------------------------------------------------------
+//
+namespace S60MCprMobilityActivity
+    {
+    // Wait for start mobility message that is the representative of mobility API registration.
+    DECLARE_DEFINE_CUSTOM_NODEACTIVITY( ECFActivityMCprMobility, 
+                                        MCprMobility, 
+                                        TCFMobilityProvider::TStartMobility, 
+                                        S60MCprMobilityActivity::CS60MobilityActivity::NewL )
+    // The activity only makes sense after the startup sequence completed on this layer
+    FIRST_NODEACTIVITY_ENTRY( S60MCprMobilityActivity::TAwaitingStartMobility, 
+                              MeshMachine::TNoTag/*BlockedByNoServiceProviderStarted*/ )
+    // Report to the client that we have successfully started
+    THROUGH_NODEACTIVITY_ENTRY( KNoTag, 
+                                S60MCprMobilityActivity::TReplyMobilityStarted, 
+                                MeshMachine::TNoTag )
+    // Register for preferred carrier
+    THROUGH_NODEACTIVITY_ENTRY( KNoTag, 
+                                S60MCprMobilityActivity::TSendAvailabilityRequest, 
+                                TTag<MobilityMCprStates::KStartMobilityHandshake> )
+    // Clear handshake status and wait for preferred carrier or mobility API close.
+    NODEACTIVITY_ENTRY( MobilityMCprStates::KStartMobilityHandshake, 
+                        CS60MobilityActivity::TClearHandshakingFlag,
+                        CS60MobilityActivity::TAwaitingPreferredCarrierOrCancelOrRejected, // Ok. Error is fatal.
+                        S60MCprMobilityActivity::TInformMigrationAvailableOrCancelTag )
+    // Application rejected active carrier
+    THROUGH_NODEACTIVITY_ENTRY( S60MCprStates::KSendInitialApplicationReject, 
+                                S60MCprMobilityActivity::TSendInitialApplicationReject, 
+                                TTag<S60MCprStates::KWaitPolicyServerResponse> )
+    // Start mobility handshake if there is a better carrier available
+    NODEACTIVITY_ENTRY( S60MCprStates::KInformMigrationAvailable, 
+                        CS60MobilityActivity::TInformMigrationAvailableAndSetHandshakingFlagBlockedByConnectionRecoveryOrNoMobilityPreferenceOrError,
+                        S60MCprMobilityActivity::TAwaitingMigrationRequestedOrRejectedOrCancel, // Ok. Error is fatal. 
+                        CS60MobilityActivity::TNoTagOrApplicationRejectedMigrationOrCancel )
+    // Informs policy server that application does not migrate
+    THROUGH_NODEACTIVITY_ENTRY( S60MCprStates::KApplicationRejectedMigration,
+                                CS60MobilityActivity::TSendMigrationRejected, // Ok. Error is fatal
+                                S60MCprMobilityActivity::TStartMobilityHandshakeBackwardsOrError )
+    // Consults policy server if the user wants to migrate or not.
+    THROUGH_NODEACTIVITY_ENTRY( KNoTag,
+                                CS60MobilityActivity::TSendMigrationAccepted,
+                                TTag<S60MCprStates::KWaitPolicyServerResponse> )
+    // Wait for Policy Server Response
+    NODEACTIVITY_ENTRY( S60MCprStates::KWaitPolicyServerResponse,
+                        S60MCprMobilityActivity::TDoNothingOrReSendPendingNotification,
+                        CS60MobilityActivity::TAwaitingPreferredCarrierOrStartIAPNotificationOrErrorNotificationOrCancel, // Ok. Error is fatal
+                        S60MCprMobilityActivity::TNoTagOrInformMigrationAvailableBackwardsOrErrorOrCancel )
+    // Select the next layer MCPR.
+    NODEACTIVITY_ENTRY( KNoTag, 
+                        MCprStates::TSelectNextLayer,
+                        MCprStates::TAwaitingSelectNextLayerCompleted, // Ok. Error is fatal.
+                        MeshMachine::TNoTagOrErrorTag )
+                        //S60MCprStates::TAwaitingSelectNextLayerCompletedOrError, // Not required Error is fatal. MPM should only give valid IAPs.
+                        //MeshMachine::TNoTagOrErrorTag )// Not required Error is fatal. MPM should only give valid IAPs.
+    // For the moment it is sufficient to use the re-connect activity, in the future we may want to
+    // customise the behavior, for example start the new layer before rebinding it, etc.
+    NODEACTIVITY_ENTRY( KNoTag, 
+                        S60MCprStates::TRequestReConnect,
+                        MCprStates::TAwaitingReConnectCompleteOrError,  // Ok. Error is fatal.
+                        MeshMachine::TNoTagOrErrorTag ) //Own error handling MPM must be informed when error happens.
+    // Select or activation failed, Ask MPM to decide if it it possible/sensible to ignore the error and continue.
+    // EDoReselect return will fall into EIgnoreError branch. MPM shouldn't return Reselect in this case.
+    // And if it does, then the use of startiapnotification in mobility scenarios should be
+    // removed and only reselect should be used.
+    /* Not required. PolicyServer should only give valid IAPs.
+    NODEACTIVITY_ENTRY( KErrorTag,
+                        S60MCprStates::TProcessError,
+                        S60MCprStates::TAwaitingProcessErrorCompleteOrError,  
+                        S60MCprMobilityActivity::TWaitPolicyServerResponseBackwardOrErrorTag )
+                        */
+    // If the migration was acepted we loop again waiting for a new, preferred one
+    NODEACTIVITY_ENTRY( KNoTag, 
+                        CS60MobilityActivity::TInformMigrationCompleted, 
+                        S60MCprMobilityActivity::TAwaitingMigrationAcceptedOrRejectedOrCancel,
+                        S60MCprMobilityActivity::TNoTagOrErrorTagOrApplicationRejected ) //-jl- TODO cancel here?
+    // Informs policy server that application has accepted the carrier
+    THROUGH_NODEACTIVITY_ENTRY( KNoTag,
+                                CS60MobilityActivity::TSendApplicationAccept,
+                                TTag<MobilityMCprStates::KStartMobilityHandshake|NetStateMachine::EBackward> )
+    // Informs policy server that application has rejected the carrier
+    THROUGH_NODEACTIVITY_ENTRY( S60MCprStates::KApplicationRejectedMigration,
+                                CS60MobilityActivity::TSendApplicationReject,
+                                TTag<S60MCprStates::KWaitPolicyServerResponse|NetStateMachine::EBackward> )
+    // On error, we do not terminate the activity.
+    // We need to inform the client and propose a new handshake should the client wish to continue
+    THROUGH_NODEACTIVITY_ENTRY( KErrorTag, 
+                                MeshMachine::TRaiseAndClearActivityError,
+                                TTag<MeshMachine::KCancelTag> )
+//                                S60MCprMobilityActivity::TStartMobilityHandshakeBackwards )
+    // When closing, always continue to cancel the activity.
+    LAST_NODEACTIVITY_ENTRY( KCancelTag,
+                             CS60MobilityActivity::TCancelMobilityActivity )
+    NODEACTIVITY_END()
+    } // namespace S60MCprMobilityActivity
+
+// -----------------------------------------------------------------------------
+// S60MCprConnectionGoneDownRecoveryActivity
+// -----------------------------------------------------------------------------
+//
+namespace S60MCprConnectionGoneDownRecoveryActivity
+    {
+    // MCprConnectionGoneDownRecovery activity belongs to a group of Error Recovery Activities.
+    // Error Recovery Activities need to handle their own errors (generated as well as returned).
+    DECLARE_DEFINE_CUSTOM_NODEACTIVITY( ECFActivityConnectionGoneDownRecovery,
+                                        MCprConnectionGoneDownRecovery,
+                                        TEErrorRecovery::TErrorRecoveryRequest,
+                                        S60MCprErrorRecoveryActivity::CS60ConnectionRecoveryActivity::NewL )
+    // Wait for GoneDown recovery request. GoneDown handles connection errors during active connection.
+    // S60MCprConnectionGoneDownRecoveryActivity only needs to run if there's a mobility activity.
+    FIRST_NODEACTIVITY_ENTRY( MCprStates::TAwaitingConnectionGoneDownRecoveryRequest,
+                              MeshMachine::TNoTag )
+    // Either TStoreErrorContext 
+    THROUGH_NODEACTIVITY_ENTRY( KNoTag, 
+                                S60MCprErrorRecoveryActivity::CS60ConnectionRecoveryActivity::TStoreErrorContext, 
+                                CoreStates::TNoTagOrNoPeer )
+    LAST_NODEACTIVITY_ENTRY( CoreStates::KNoPeer,
+                             S60MCprErrorRecoveryActivity::CS60ConnectionRecoveryActivity::TSendPropagateRecoveryResponse ) //Take error codes directly from the request
+    THROUGH_NODEACTIVITY_ENTRY( KNoTag,
+                                MeshMachine::TDoNothing,
+                                S60MCprErrorRecoveryActivity::TProcessErrorBlockedByMobilityHandshaking )
+    // TProcessError assumes that errorcontext is stored in CS60ConnectionRecoveryActivity
+    // The response from the policy server should always be ignore in this case.
+    NODEACTIVITY_ENTRY( S60MCprStates::KProcessError,
+                        S60MCprStates::TProcessError,
+                        S60MCprStates::TAwaitingProcessErrorCompleteOrError,
+                        S60MCprErrorRecoveryActivity::TNoTagOrIgnoreErrorOrErrorTag )
+    // We have gone down. PolicyServer response EDoReselect means nothing here and
+    // will be converted to propagate error.
+    // Ignore is sensible in the case of mobility API where the mobility API can cause error.
+    LAST_NODEACTIVITY_ENTRY( S60MCprStates::KIgnoreError, 
+                             S60MCprErrorRecoveryActivity::TSendIgnoreRecoveryResponse )
+    LAST_NODEACTIVITY_ENTRY( KNoTag, 
+                             S60MCprErrorRecoveryActivity::CS60ConnectionRecoveryActivity::TSendPropagateRecoveryResponse )
+    LAST_NODEACTIVITY_ENTRY( KErrorTag, 
+                             S60MCprErrorRecoveryActivity::CS60ConnectionRecoveryActivity::TSendPropagateRecoveryResponse )
+    NODEACTIVITY_END()
+    } // namespace S60MCprConnectionGoneDownRecoveryActivity
+
+// -----------------------------------------------------------------------------
+// S60MCprServiceIdRMessage2HandlerActivity
+// -----------------------------------------------------------------------------
+//
+namespace S60MCprServiceIdRMessage2HandlerActivity
+    {
+    DECLARE_DEFINE_CUSTOM_NODEACTIVITY( ECFActivityS60McprServiceIdMessage2Handler, 
+                                        S60MCprServiceIdLegacyRMessage2Handler, 
+                                        TNodeSignal::TNullMessageId, 
+                                        MeshMachine::CNodeParallelMessageStoreActivityBase::NewL )
+
+    FIRST_NODEACTIVITY_ENTRY( S60MCprStates::TAwaitingServiceIdRequest, 
+                              MeshMachine::TNoTag )
+
+    NODEACTIVITY_ENTRY( KNoTag, 
+                        S60MCprStates::TRetrieveServiceId, 
+                        CoreNetStates::TAwaitingRMessage2Processed, 
+                        MeshMachine::TNoTag )
+
+    LAST_NODEACTIVITY_ENTRY( KNoTag, 
+                             CoreStates::TPostToOriginators )
+
+    NODEACTIVITY_END()
+    } // S60MCprServiceIdRMessage2HandlerActivity
+
+// -----------------------------------------------------------------------------
+// S60MCprActivities - activitymap
+// -----------------------------------------------------------------------------
+//
+namespace S60MCprActivities
+    {
+    DEFINE_ACTIVITY_MAP(S60MCprActivityMap)
+    ACTIVITY_MAP_ENTRY(S60MCprMonitorDataClientStatusActivity, MCprDataClientStatusChange)
+	ACTIVITY_MAP_ENTRY(S60MCprSelectActivity, S60MCprSelect) // in s60mcprsimpleselectactivity.cpp
+    ACTIVITY_MAP_ENTRY(S60MCprSimpleSelectActivity, MCprSimpleSelect) // in s60mcprsimpleselectactivity.cpp
+    ACTIVITY_MAP_ENTRY(S60MCprErrorRecoveryActivity, MCprConnectionStartRecovery) // in s60mcprerrorrecoveryactivity.cpp
+    ACTIVITY_MAP_ENTRY(S60MCprMobilityActivity, MCprMobility) // in s60mcprmobilityactivity.cpp
+    ACTIVITY_MAP_ENTRY(S60MCprConnectionGoneDownRecoveryActivity, MCprConnectionGoneDownRecovery)
+    ACTIVITY_MAP_ENTRY(S60MCprServiceIdRMessage2HandlerActivity, S60MCprServiceIdLegacyRMessage2Handler)
+    ACTIVITY_MAP_END_BASE(MobilityMCprActivities, mobilityMCprActivities)
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/S60MCPR/src/s60mcprerrorrecoveryactivity.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,365 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: S60 MCPR error recovery activity implementation
+*
+*/
+
+/**
+@file s60mcprerrorrecoveryactivity.cpp
+S60 MCPR error recovery activity implementation
+*/
+
+#include "s60mcpractivities.h"
+#include "s60mcprstates.h"
+
+using namespace Messages;
+using namespace MeshMachine;
+using namespace ESock;
+
+// -----------------------------------------------------------------------------
+// S60MCprErrorRecoveryActivity
+// -----------------------------------------------------------------------------
+//
+namespace S60MCprErrorRecoveryActivity
+    {
+    TBool THandshakingMobilityMutex::IsBlocked(TNodeContextBase& aContext)
+        {
+        return static_cast<CS60MetaConnectionProvider&>(aContext.iNode).IsHandshakingNow();
+        }
+    
+
+    // -----------------------------------------------------------------------------
+    // TSendIgnoreRecoveryResponse::DoL
+    // -----------------------------------------------------------------------------
+    //
+    DEFINE_SMELEMENT( TSendIgnoreRecoveryResponse, NetStateMachine::MStateTransition, TContext )
+    void TSendIgnoreRecoveryResponse::DoL()  // codescanner::leave
+        {
+        CS60ConnectionRecoveryActivity* ac = 
+            static_cast<CS60ConnectionRecoveryActivity*>(iContext.iNodeActivity);
+
+        S60MCPRLOGSTRING2("S60MCPR<%x>::TSendIgnoreRecoveryResponse::DoL() Ignore Error %d",
+                  (TInt*)&iContext.Node(),ac->iOriginalErrContext.iStateChange.iError );
+
+        __ASSERT_DEBUG( iContext.iNodeActivity, User::Panic( KS60MCprPanic, KPanicNoActivity ) );
+        TEErrorRecovery::TErrorRecoveryResponse err( TErrResponse( TErrResponse::EIgnore, 
+                                                                   KErrNone, 
+                                                                   ac->iOriginalErrContext.iMessageId ) );
+        // We must clear out the activity error to prevent last automatic error message from the node.
+        iContext.iNodeActivity->SetError( KErrNone );
+        ac->ReplyToOriginators( err );
+        }
+
+    // -----------------------------------------------------------------------------
+    // TAwaitingNotGoneDownErrorRecoveryRequest::Accept
+    // -----------------------------------------------------------------------------
+    //
+    DEFINE_SMELEMENT(TAwaitingNotGoneDownErrorRecoveryRequest, 
+                     NetStateMachine::MState, 
+                     TContext)
+    TBool TAwaitingNotGoneDownErrorRecoveryRequest::Accept()
+        {
+        TEErrorRecovery::TErrorRecoveryRequest* msg = 
+            message_cast<TEErrorRecovery::TErrorRecoveryRequest>(&iContext.iMessage);
+        // Validata error recovery request.
+        // This state will accept other error recovery request besides the one meant for GoneDown.
+        //
+        if ( msg )
+            {
+            TErrContext& errCtx = msg->iErrContext;
+/*            if (errCtx.iActivitySigId == ECFActivityNoBearer || errCtx.iActivitySigId == ECFActivityStart
+                || errCtx.iStateChange.iError == KErrCouldNotConnect)
+*/
+            if ( errCtx.iActivitySigId != ECFActivityGoneDown )
+                {
+                S60MCPRLOGSTRING1("S60MCPR<%x>::TAwaitingNotGoneDownErrorRecoveryRequest::Accept()",(TInt*)&iContext.Node());
+                return ETrue;
+                }
+            }
+        return EFalse;
+        }
+
+    
+    // -----------------------------------------------------------------------------
+    // TNoTagOrIgnoreErrorOrErrorTag::TransitionTag
+    // -----------------------------------------------------------------------------
+    //
+    DEFINE_SMELEMENT(TNoTagOrIgnoreErrorOrErrorTag, NetStateMachine::MStateFork, TContext)
+    TInt TNoTagOrIgnoreErrorOrErrorTag::TransitionTag()
+        {
+        TCFS60MCPRMessage::TMPMProcessErrorCompletedMsg* msg = NULL;
+
+        if ( iContext.iMessage.IsMessage<TCFS60MCPRMessage::TMPMProcessErrorCompletedMsg>() )
+            {
+            msg = message_cast<TCFS60MCPRMessage::TMPMProcessErrorCompletedMsg>(&iContext.iMessage);
+            }
+
+        // Sanity check.
+        if ( iContext.iMessage.IsMessage<TEBase::TError>() && iContext.iNodeActivity->Error() == KErrNone )
+            {
+            // Should never end up here!!
+            __ASSERT_DEBUG( EFalse, User::Panic( KS60MCprPanic, KPanicUnsupportedMCPRState ) );
+            iContext.iNodeActivity->SetError( KErrGeneral );
+            }
+
+        // Error transition
+        //
+        if ( !msg )
+            {
+            return KErrorTag | NetStateMachine::EForward;
+            }
+        // Transition to ignore error
+        //
+        else if ( (TBMNeededAction)msg->iValue == EIgnoreError )
+            {
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TNoTagOrIgnoreErrorOrErrorTag::TransitionTag() KIgnoreError",(TInt*)&iContext.Node());
+            return S60MCprStates::KIgnoreError | NetStateMachine::EForward;
+            }
+        // Transition to reselection
+        //
+        else
+            {
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TNoTagOrIgnoreErrorOrErrorTag::TransitionTag() KNoTag",(TInt*)&iContext.Node());
+            return MeshMachine::KNoTag | NetStateMachine::EForward;
+            }
+        }
+
+    // -----------------------------------------------------------------------------
+    // TNoTagOrRetryConnectionTagOrErrorTag::TransitionTag
+    // -----------------------------------------------------------------------------
+    //
+    DEFINE_SMELEMENT(TNoTagOrRetryConnectionTagOrErrorTag, NetStateMachine::MStateFork, TContext)
+    TInt TNoTagOrRetryConnectionTagOrErrorTag::TransitionTag()
+        {
+        CS60MetaConnectionProvider& node = (CS60MetaConnectionProvider&)iContext.Node();
+        TCFS60MCPRMessage::TMPMReselectBestIAPCompletedMsg* msg = NULL;
+        if ( iContext.iMessage.IsMessage<TCFS60MCPRMessage::TMPMReselectBestIAPCompletedMsg>() )
+            {
+            msg = message_cast<TCFS60MCPRMessage::TMPMReselectBestIAPCompletedMsg>(&iContext.iMessage);
+            }
+        
+        if ( !msg )
+            {
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TNoTagOrRetryConnectionTagOrErrorTag::TransitionTag() KErrorTag",(TInt*)&iContext.Node());
+            return KErrorTag | NetStateMachine::EForward;
+            }
+        else if ( ((RMetaServiceProviderInterface*)node.ServiceProvider())
+                    ->ProviderInfo().APId() == node.PolicyPrefs().IapId() )
+            {
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TNoTagOrRetryConnectionTagOrErrorTag::TransitionTag() KRetryConnection",(TInt*)&iContext.Node());
+            return S60MCprStates::KRetryConnection | NetStateMachine::EForward;
+            }
+        else
+            {
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TNoTagOrRetryConnectionTagOrErrorTag::TransitionTag() KNoTag",(TInt*)&iContext.Node());
+            return KNoTag | NetStateMachine::EForward;
+            }
+        }
+    
+    // -----------------------------------------------------------------------------
+    // TRetryConnectionOrErrorTag::TransitionTag
+    // -----------------------------------------------------------------------------
+    //
+    DEFINE_SMELEMENT(TRetryConnectionOrProcessErrorTagBackward, NetStateMachine::MStateFork, TContext)
+    TInt TRetryConnectionOrProcessErrorTagBackward::TransitionTag()
+        {
+        CS60MetaConnectionProvider& node = (CS60MetaConnectionProvider&)iContext.Node();
+        TCFMcpr::TReConnectComplete* msg = NULL;
+        if ( iContext.iMessage.IsMessage<TCFMcpr::TReConnectComplete>() )
+            {
+            msg = message_cast<TCFMcpr::TReConnectComplete>(&iContext.iMessage);
+            }
+
+        if ( !msg )
+            {
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TRetryConnectionOrProcessErrorTagBackward::TransitionTag() KProcessError",(TInt*)&iContext.Node());
+            return S60MCprStates::KProcessError | NetStateMachine::EBackward;
+            //return KErrorTag | NetStateMachine::EForward;
+            }
+        else// if ( node.ServiceProvider()->ProviderInfo().APId() == node.PolicyPrefs().IapId() )
+            {
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TRetryConnectionOrProcessErrorTagBackward::TransitionTag() KRetryConnection",(TInt*)&iContext.Node());
+            return S60MCprStates::KRetryConnection | NetStateMachine::EForward;
+            }
+        }
+
+    // -----------------------------------------------------------------------------
+    // TNoTagOrProcessErrorBackwardTag::TransitionTag
+    // -----------------------------------------------------------------------------
+    //
+    DEFINE_SMELEMENT(TNoTagOrProcessErrorBackwardTag, NetStateMachine::MStateFork, TContext)
+    TInt TNoTagOrProcessErrorBackwardTag::TransitionTag()
+        {
+        if ( iContext.iMessage.IsMessage<TEBase::TError>() )
+            {
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TNoTagOrProcessErrorBackwardTag::TransitionTag() KProcessError",(TInt*)&iContext.Node());
+            return S60MCprStates::KProcessError | NetStateMachine::EBackward;
+            }
+        else
+            {
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TNoTagOrProcessErrorBackwardTag::TransitionTag() KNoTag",(TInt*)&iContext.Node());
+            return MeshMachine::KNoTag | NetStateMachine::EForward;
+            }
+        }
+
+
+    // -----------------------------------------------------------------------------
+    // CS60ConnectionRecoveryActivity::NewL
+    // -----------------------------------------------------------------------------
+    //
+    MeshMachine::CNodeActivityBase* CS60ConnectionRecoveryActivity::NewL( const MeshMachine::TNodeActivity& aActivitySig,  // codescanner::leave
+                                                                          MeshMachine::AMMNodeBase& aNode )
+        {
+        return new (ELeave) CS60ConnectionRecoveryActivity( aActivitySig, aNode );  // codescanner::leave
+        }
+
+    // -----------------------------------------------------------------------------
+    // CS60ConnectionRecoveryActivity::CS60ConnectionRecoveryActivity
+    // -----------------------------------------------------------------------------
+    //
+    CS60ConnectionRecoveryActivity::CS60ConnectionRecoveryActivity( const MeshMachine::TNodeActivity& aActivitySig, 
+                                                                    MeshMachine::AMMNodeBase& aNode )
+        :   S60MCprStates::CS60ErrorRecoveryActivity( aActivitySig, aNode )
+        {
+        }
+
+    // -----------------------------------------------------------------------------
+    // CS60ConnectionRecoveryActivity::ReplyToOriginators
+    // -----------------------------------------------------------------------------
+    //
+    void CS60ConnectionRecoveryActivity::ReplyToOriginators( TEErrorRecovery::TErrorRecoveryResponse& aCFMessageSig )
+        {
+        NM_LOG_START_BLOCK(KESockMeshMachine, _L8("CS60ConnectionRecoveryActivity::ReplyToOriginators"));
+        NM_LOG((KESockMeshMachine, _L8("[this=0x%08x] "), this));
+        NM_LOG_MESSAGE(KESockMeshMachine, aCFMessageSig);
+        NM_LOG_END_BLOCK(KESockMeshMachine, _L8("CS60ConnectionRecoveryActivity::ReplyToOriginators"));
+        for ( TInt n = iOriginators.Count() - 1; n >= 0; n-- )
+            {
+            Messages::TNodePeerId& peerId = iOriginators[n];
+            TCFSafeMessage::TResponseCarrierWest<TEErrorRecovery::TErrorRecoveryResponse> resp(aCFMessageSig, peerId.RecipientId());
+            peerId.PostMessage( iNode.Id(), resp );
+            }
+        }
+
+    // -----------------------------------------------------------------------------
+    // CS60ConnectionRecoveryActivity::TAwaitingReConnectComplete::Accept
+    // -----------------------------------------------------------------------------
+    //
+    DEFINE_SMELEMENT( CS60ConnectionRecoveryActivity::TAwaitingReConnectComplete, 
+                      NetStateMachine::MState, 
+                      CS60ConnectionRecoveryActivity::TContext )
+    TBool CS60ConnectionRecoveryActivity::TAwaitingReConnectComplete::Accept()
+        {
+        __ASSERT_DEBUG(iContext.iNodeActivity, User::Panic(KS60MCprPanic, KPanicNoActivity));
+        TEBase::TError* msg = message_cast<TEBase::TError>(&iContext.iMessage);
+        if ( msg )
+            {
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TAwaitingReConnectComplete::TransitionTag() NOT Accept sending TErrorRecoveryResponse",(TInt*)&iContext.Node());
+            CS60ConnectionRecoveryActivity& ac = static_cast<CS60ConnectionRecoveryActivity&>(*iContext.iNodeActivity);
+            TErrResponse propagateResp( TErrResponse::EPropagate,
+                                        ac.iOriginalErrContext.iStateChange.iError,
+                                        ac.iOriginalErrContext.iMessageId );
+            TEErrorRecovery::TErrorRecoveryResponse errResp( propagateResp );
+            ac.ReplyToOriginators( errResp );
+            ac.SetIdle();
+            iContext.iMessage.ClearMessageId();
+            return EFalse;
+            }
+        if ( iContext.iMessage.IsMessage<TCFMcpr::TReConnectComplete>() )
+            {
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TAwaitingReConnectComplete::TransitionTag() Accept",(TInt*)&iContext.Node());
+            return ETrue;
+            }
+        else
+            {
+            return EFalse;
+            }
+        }
+    // -----------------------------------------------------------------------------
+    // CS60ConnectionRecoveryActivity::TTransitionBase::Error
+    // -----------------------------------------------------------------------------
+    //
+    void CS60ConnectionRecoveryActivity::TTransitionBase::Error( TInt /*aError*/ )
+        {
+        //Reply to the Error Activity and terminate
+        __ASSERT_DEBUG(iContext.iNodeActivity, User::Panic(KS60MCprPanic, KPanicNoActivity));
+        CS60ConnectionRecoveryActivity& ac = static_cast<CS60ConnectionRecoveryActivity&>(*iContext.iNodeActivity);
+        TEErrorRecovery::TErrorRecoveryResponse errResp( TErrResponse( TErrResponse::EPropagate, 
+                                                                       ac.iOriginalErrContext.iStateChange.iError,
+                                                                       ac.iOriginalErrContext.iMessageId ));
+        ac.ReplyToOriginators( errResp );
+        S60MCPRLOGSTRING1("S60MCPR<%x>::TTransitionBase::Error()",(TInt*)&iContext.Node());
+        iContext.iNodeActivity->SetIdle();
+        }
+
+    // -----------------------------------------------------------------------------
+    // CS60ConnectionRecoveryActivity::TStoreErrorContext::DoL
+    // -----------------------------------------------------------------------------
+    //
+    DEFINE_SMELEMENT( CS60ConnectionRecoveryActivity::TStoreErrorContext, 
+                      NetStateMachine::MStateTransition, 
+                      CS60ConnectionRecoveryActivity::TContext )
+    void CS60ConnectionRecoveryActivity::TStoreErrorContext::DoL()  // codescanner::leave
+        {
+        __ASSERT_DEBUG(iContext.iNodeActivity, User::Panic(KS60MCprPanic, KPanicNoActivity));
+        CS60ConnectionRecoveryActivity& activity = static_cast<CS60ConnectionRecoveryActivity&>(*iContext.iNodeActivity);
+        activity.iOriginalErrContext = message_cast<TEErrorRecovery::TErrorRecoveryRequest>(iContext.iMessage).iErrContext;
+        }
+
+    // -----------------------------------------------------------------------------
+    // CS60ConnectionRecoveryActivity::TSendRetryRecoveryResponse::DoL
+    // -----------------------------------------------------------------------------
+    //
+    DEFINE_SMELEMENT( CS60ConnectionRecoveryActivity::TSendRetryRecoveryResponse, 
+                      NetStateMachine::MStateTransition, 
+                      CS60ConnectionRecoveryActivity::TContext )
+    void CS60ConnectionRecoveryActivity::TSendRetryRecoveryResponse::DoL()  // codescanner::leave
+        {
+        __ASSERT_DEBUG(iContext.iNodeActivity, User::Panic(KS60MCprPanic, KPanicNoActivity));
+        CS60ConnectionRecoveryActivity& activity = static_cast<CS60ConnectionRecoveryActivity&>(*iContext.iNodeActivity);
+        TEErrorRecovery::TErrorRecoveryResponse err( TErrResponse( TErrResponse::ERetry,
+                                                                   KErrNone,
+                                                                   activity.iOriginalErrContext.iMessageId ) );
+        S60MCPRLOGSTRING2("S60MCPR<%x>::TSendRetryRecoveryResponse<%x>::DoL()",(TInt*)&iContext.Node(),(TInt*)this);
+        // We must clear out the activity error to prevent last automatic error message from the node.
+        iContext.iNodeActivity->SetError( KErrNone );
+        activity.ReplyToOriginators( err );
+        }
+
+    
+    // -----------------------------------------------------------------------------
+    // CS60ConnectionRecoveryActivity::TSendPropagateRecoveryResponse::DoL
+    // -----------------------------------------------------------------------------
+    //
+    DEFINE_SMELEMENT( CS60ConnectionRecoveryActivity::TSendPropagateRecoveryResponse, 
+                      NetStateMachine::MStateTransition, 
+                      CS60ConnectionRecoveryActivity::TContext )
+    void CS60ConnectionRecoveryActivity::TSendPropagateRecoveryResponse::DoL()  // codescanner::leave
+        {
+        __ASSERT_DEBUG(iContext.iNodeActivity, User::Panic(KS60MCprPanic, KPanicNoActivity));
+        CS60ConnectionRecoveryActivity& activity = 
+            static_cast<CS60ConnectionRecoveryActivity&>(*iContext.iNodeActivity);
+        // Override original error with activity error.
+        TEErrorRecovery::TErrorRecoveryResponse err( TErrResponse( TErrResponse::EPropagate,
+                                                                   activity.Error(),
+                                                                   activity.iOriginalErrContext.iMessageId ) );
+        S60MCPRLOGSTRING2("S60MCPR<%x>::TSendPropagateRecoveryResponse::DoL() %d",(TInt*)&iContext.Node(),(TInt)activity.Error());
+        // We must clear out the activity error to prevent last automatic error message from the node.
+        iContext.iNodeActivity->SetError( KErrNone );
+        activity.ReplyToOriginators( err );
+        }
+
+    } // namespace S60MCprErrorRecoveryActivity
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/S60MCPR/src/s60mcprfactory.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2008 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: S60 MCPR factory implementation
+*
+*/
+
+/**
+@file s60mcprfactory.cpp
+S60 MCPR factory implementation
+*/
+
+#include <ecom/ecom.h>
+#include <ecom/implementationproxy.h>
+
+#include <comms-infras/ss_log.h>
+#include <comms-infras/ss_msgintercept.h>
+
+#include "s60mcprfactory.h"
+#include "s60mcpr.h"
+
+using namespace ESock;
+
+#ifdef __CFLOG_ACTIVE
+#define KS60MCprFactoryTag KESockMetaConnectionTag
+_LIT8(KS60MCprFactorySubTag, "s60mcprfactory");
+#endif
+
+// -----------------------------------------------------------------------------
+// CS60MetaConnectionProviderFactory::NewL
+// -----------------------------------------------------------------------------
+//
+CS60MetaConnectionProviderFactory* CS60MetaConnectionProviderFactory::NewL( TAny* aParentContainer )
+    {
+    __CFLOG_VAR((KS60MCprFactoryTag, KS60MCprFactorySubTag, _L8("CS60MetaConnectionProviderFactory::NewL(%08x)"), aParentContainer));
+     return new (ELeave) CS60MetaConnectionProviderFactory( TUid::Uid(CS60MetaConnectionProviderFactory::iUid),
+                                                            *(reinterpret_cast<CMetaConnectionFactoryContainer*>(aParentContainer)) );
+    }
+
+// -----------------------------------------------------------------------------
+// CS60MetaConnectionProviderFactory::CS60MetaConnectionProviderFactory
+// -----------------------------------------------------------------------------
+//
+CS60MetaConnectionProviderFactory::CS60MetaConnectionProviderFactory( TUid aFactoryUid, 
+                                                                      CMetaConnectionFactoryContainer& aParentContainer )
+    :   CMetaConnectionProviderFactoryBase( aFactoryUid, aParentContainer )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CS60MetaConnectionProviderFactory::DoCreateObjectL
+// -----------------------------------------------------------------------------
+//
+ACommsFactoryNodeId* CS60MetaConnectionProviderFactory::DoCreateObjectL( TFactoryQueryBase& aQuery )
+    {
+    const TMetaConnectionFactoryQuery& query = static_cast<const TMetaConnectionFactoryQuery&>(aQuery);
+    CMetaConnectionProviderBase* provider = CS60MetaConnectionProvider::NewL( *this, query.iProviderInfo );
+
+    ESOCK_DEBUG_REGISTER_GENERAL_NODE(iUid, provider);
+
+    return provider;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/S60MCPR/src/s60mcprmobilityactivity.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,696 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: S60 MCPR mobility activity implementation
+*
+*/
+
+/**
+@file s60mcprmobilityactivity.cpp
+S60 MCPR mobility activity implementation
+*/
+
+#include "s60mcpractivities.h"
+#include "s60mcprstates.h"
+
+using namespace Messages;
+using namespace MeshMachine;
+using namespace ESock;
+
+// -----------------------------------------------------------------------------
+// S60MCprMobilityActivity
+// -----------------------------------------------------------------------------
+//
+namespace S60MCprMobilityActivity
+    {
+    // -----------------------------------------------------------------------------
+    // S60MCprMobilityActivity::TDoNothingOrReSendPendingNotification::DoL
+    // -----------------------------------------------------------------------------
+    //
+    DEFINE_SMELEMENT( TDoNothingOrReSendPendingNotification, NetStateMachine::MStateTransition, TContext )
+    void TDoNothingOrReSendPendingNotification::DoL()
+        {
+        S60MCPRLOGSTRING1("S60MCPR<%x>::TDoNothingOrReSendPendingNotification::DoL()",(TInt*)&iContext.Node())
+        __ASSERT_DEBUG(iContext.iNodeActivity, User::Panic(KS60MCprPanic, KPanicNoActivity));
+        CS60MetaConnectionProvider& node = (CS60MetaConnectionProvider&)iContext.Node();
+
+        // Process the pending request first.
+        //
+        node.ReSendPolicyNotification();
+        node.ClearPolicyNotification();
+        }
+
+    
+    // -----------------------------------------------------------------------------
+    // S60MCprMobilityActivity::TReplyMobilityStarted::DoL
+    // -----------------------------------------------------------------------------
+    //
+    DEFINE_SMELEMENT( TReplyMobilityStarted, NetStateMachine::MStateTransition, TContext )
+    void TReplyMobilityStarted::DoL()
+        {
+        S60MCPRLOGSTRING1("S60MCPR<%x>::TReplyMobilityStarted::DoL()",(TInt*)&iContext.Node())
+        __ASSERT_DEBUG(iContext.iNodeActivity, User::Panic(KS60MCprPanic, KPanicNoActivity));
+        iContext.iNodeActivity->PostToOriginators( TCFMobilityProvider::TMobilityStarted().CRef() );
+        iContext.iNodeActivity->ClearPostedTo();
+        }
+
+
+    // -----------------------------------------------------------------------------
+    // S60MCprMobilityActivity::TSendAvailabilityRequest::DoL
+    // -----------------------------------------------------------------------------
+    //
+    DEFINE_SMELEMENT( TSendAvailabilityRequest, NetStateMachine::MStateTransition, TContext )
+    void TSendAvailabilityRequest::DoL()
+        {
+        S60MCPRLOGSTRING1("S60MCPR<%x>::TSendAvailabilityRequest::DoL()", (TInt*)&iContext.Node())
+        CS60MetaConnectionProvider& node = (CS60MetaConnectionProvider&)iContext.Node();
+        node.Policy()->RegisterPreferredIAPNotificationL();
+        }
+    
+
+    // -----------------------------------------------------------------------------
+    // S60MCprMobilityActivity::TSendInitialApplicationReject::DoL
+    // -----------------------------------------------------------------------------
+    //
+    DEFINE_SMELEMENT( TSendInitialApplicationReject, 
+                      NetStateMachine::MStateTransition, 
+                      TContext )
+    void TSendInitialApplicationReject::DoL()
+        {
+        S60MCPRLOGSTRING1("S60MCPR<%x>::TSendInitialApplicationReject::DoL()", (TInt*)&iContext.Node())
+        CS60MetaConnectionProvider& node = (CS60MetaConnectionProvider&)iContext.Node();
+
+        RMetaServiceProviderInterface* sp = NULL;
+        // Set service provider to point to active service provider.
+        sp = (RMetaServiceProviderInterface*) node.ServiceProvider();
+        TInt iapid = sp ? sp->ProviderInfo().APId() : 0;
+        
+        node.Policy()->ApplicationRejectedTheCarrierL( iapid );
+        }
+    
+
+    // -----------------------------------------------------------------------------
+    // S60MCprMobilityActivity::TAwaitingStartMobility::Accept
+    // -----------------------------------------------------------------------------
+    //
+    DEFINE_SMELEMENT( TAwaitingStartMobility, NetStateMachine::MState, TContext )
+    TBool TAwaitingStartMobility::Accept()
+        {
+        if (!iContext.iMessage.IsMessage<TCFMobilityProvider::TStartMobility>())
+            {
+            return EFalse;
+            }
+        if (iContext.Node().ServiceProvider()==NULL)
+            {
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TAwaitingStartMobility::Accept() no Provider!",(TInt*)&iContext.Node())
+            //There is no mobility on the lowest layer of the stack
+            iContext.iMessage.ClearMessageId();
+            return EFalse;
+            }
+        S60MCPRLOGSTRING1("S60MCPR<%x>::TAwaitingStartMobility::Accept()", (TInt*)&iContext.Node() );
+        return ETrue;
+        }
+
+    
+    // -----------------------------------------------------------------------------
+    // S60MCprMobilityActivity::TAwaitingMigrationRequestedOrRejectedOrCancel::Accept
+    // -----------------------------------------------------------------------------
+    //
+    DEFINE_SMELEMENT( TAwaitingMigrationRequestedOrRejectedOrCancel, 
+                      NetStateMachine::MState, TContext )
+    TBool TAwaitingMigrationRequestedOrRejectedOrCancel::Accept()
+        {
+        S60MCPRLOGSTRING1("S60MCPR<%x>::TAwaitingMigrationRequestedOrRejectedOrCancel::Accept()", 
+                (TInt*)&iContext.Node())
+        return (iContext.iMessage.IsMessage<TCFMobilityProvider::TMigrationRequested>()) ||
+               (iContext.iMessage.IsMessage<TCFMobilityProvider::TMigrationRejected>()) ||
+               (iContext.iMessage.IsMessage<TEBase::TCancel>());
+//               (iContext.iMessage.IsMessage<TEBase::TError>());
+        }
+
+
+    // -----------------------------------------------------------------------------
+    // S60MCprMobilityActivity::TAwaitingMigrationAcceptedOrRejectedOrCancel::Accept
+    // -----------------------------------------------------------------------------
+    //
+    DEFINE_SMELEMENT( TAwaitingMigrationAcceptedOrRejectedOrCancel, NetStateMachine::MState, TContext )
+    TBool TAwaitingMigrationAcceptedOrRejectedOrCancel::Accept()
+        {
+        if ( (iContext.iMessage.IsMessage<TCFMobilityProvider::TMigrationAccepted>()) ||
+             (iContext.iMessage.IsMessage<TCFMobilityProvider::TMigrationRejected>()) ||
+             (iContext.iMessage.IsMessage<TEBase::TCancel>()) )
+            {
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TAwaitingMigrationAcceptedOrRejectedOrCancel::Accept()",(TInt*)&iContext.Node())
+            return ETrue;
+            }
+        return EFalse;
+        }
+
+
+    // -----------------------------------------------------------------------------
+    // S60MCprMobilityActivity::TNoTagOrInformMigrationAvailableBackwardsOrErrorOrCancel::TransitionTag
+    // -----------------------------------------------------------------------------
+    //
+    DEFINE_SMELEMENT( TNoTagOrInformMigrationAvailableBackwardsOrErrorOrCancel, NetStateMachine::MStateFork, TContext )
+    TBool TNoTagOrInformMigrationAvailableBackwardsOrErrorOrCancel::TransitionTag()
+        {
+        // Error notification falls into the error -case.
+        if ( iContext.iNodeActivity->Error() ) 
+            {
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TNoTagOrInformMigrationAvailableBackwardsOrErrorOrCancel::TransitionTag() Error",(TInt*)&iContext.Node());    
+            return MeshMachine::KErrorTag | NetStateMachine::EForward;
+            }
+        if ( iContext.iMessage.IsMessage<TCFS60MCPRMessage::TMPMStartIAPNotificationMsg>() ) 
+            {
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TNoTagOrInformMigrationAvailableBackwardsOrErrorOrCancel::TransitionTag() TMPMStartIAPNotificationMsg",(TInt*)&iContext.Node())    
+            return KNoTag | NetStateMachine::EForward;
+            }
+        if ( iContext.iMessage.IsMessage<TCFS60MCPRMessage::TMPMPreferredCarrierAvailableMsg>() )
+            {
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TNoTagOrInformMigrationAvailableBackwardsOrErrorOrCancel::TransitionTag() TMPMPreferredCarrierAvailableMsg",(TInt*)&iContext.Node())    
+            return S60MCprStates::KInformMigrationAvailable | NetStateMachine::EBackward;
+            }
+        // else cancel
+        return KCancelTag | NetStateMachine::EForward;
+        }
+
+
+    // -----------------------------------------------------------------------------
+    // S60MCprMobilityActivity::TStartMobilityHandshakeBackwardsOrError::TransitionTag
+    // -----------------------------------------------------------------------------
+    //
+    DEFINE_SMELEMENT( TStartMobilityHandshakeBackwardsOrError, NetStateMachine::MStateFork, TContext )
+    TBool TStartMobilityHandshakeBackwardsOrError::TransitionTag()
+        {
+        if ( iContext.iNodeActivity->Error() )
+            {
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TStartMobilityHandshakeBackwardsOrError::TransitionTag() KErrorTag",(TInt*)&iContext.Node())
+            return MeshMachine::KErrorTag | NetStateMachine::EForward;
+            }
+        S60MCPRLOGSTRING1("S60MCPR<%x>::TStartMobilityHandshakeBackwardsOrError::TransitionTag() KStartMobilityHandshake",(TInt*)&iContext.Node())
+        return MobilityMCprStates::KStartMobilityHandshake | NetStateMachine::EBackward;
+        }
+
+
+    // -----------------------------------------------------------------------------
+    // S60MCprMobilityActivity::TInformMigrationAvailableOrCancelTag::TransitionTag
+    // -----------------------------------------------------------------------------
+    //
+    DEFINE_SMELEMENT( TInformMigrationAvailableOrCancelTag, NetStateMachine::MStateFork, TContext )
+    TBool TInformMigrationAvailableOrCancelTag::TransitionTag()
+        {
+        if ( iContext.iMessage.IsMessage<TEBase::TCancel>() )
+            {
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TInformMigrationAvailableOrCancelTag::TransitionTag() KCancelTag",(TInt*)&iContext.Node())
+            return KCancelTag | NetStateMachine::EForward;
+            }
+        else if ( iContext.iMessage.IsMessage<TCFMobilityProvider::TMigrationRejected>() )
+            {
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TInformMigrationAvailableOrCancelTag::TransitionTag() KSendInitialApplicationReject",
+                    (TInt*)&iContext.Node())
+            return S60MCprStates::KSendInitialApplicationReject | NetStateMachine::EForward;
+            }
+        else
+            {
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TInformMigrationAvailableOrCancelTag::TransitionTag() KInformMigrationAvailable",(TInt*)&iContext.Node())
+            return S60MCprStates::KInformMigrationAvailable | NetStateMachine::EForward;
+            }
+        }
+
+
+    // -----------------------------------------------------------------------------
+    // S60MCprMobilityActivity::TNoTagOrErrorTagOrApplicationRejected::TransitionTag
+    // -----------------------------------------------------------------------------
+    //
+    DEFINE_SMELEMENT( TNoTagOrErrorTagOrApplicationRejected, NetStateMachine::MStateFork, TContext )
+    TBool TNoTagOrErrorTagOrApplicationRejected::TransitionTag()
+        {
+        if ( iContext.iNodeActivity->Error() )
+            {
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TNoTagOrErrorTagOrApplicationRejected::TransitionTag() KErrorTag",(TInt*)&iContext.Node())
+            return MeshMachine::KErrorTag | NetStateMachine::EForward;
+            }
+        if ( message_cast<TCFMobilityProvider::TMigrationAccepted>(&iContext.iMessage) )
+            {
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TNoTagOrErrorTagOrApplicationRejected::TransitionTag() KNoTag",(TInt*)&iContext.Node())
+            return MeshMachine::KNoTag | NetStateMachine::EForward;
+            }
+        else if ( message_cast<TCFMobilityProvider::TMigrationRejected>(&iContext.iMessage) )
+            {
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TNoTagOrErrorTagOrApplicationRejected::TransitionTag() KApplicationRejectedMigration",(TInt*)&iContext.Node())
+            return S60MCprStates::KApplicationRejectedMigration | NetStateMachine::EForward; 
+            }
+        else
+            {
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TNoTagOrErrorTagOrApplicationRejected::TransitionTag() KCancelTag",(TInt*)&iContext.Node())
+            return MeshMachine::KCancelTag | NetStateMachine::EForward;
+            }
+        }
+
+
+    // -----------------------------------------------------------------------------
+    // S60MCprMobilityActivity::TWaitPolicyServerResponseBackwardOrErrorTag::TransitionTag
+    // -----------------------------------------------------------------------------
+    //
+    DEFINE_SMELEMENT( TWaitPolicyServerResponseBackwardOrErrorTag, NetStateMachine::MStateFork, TContext )
+    TBool TWaitPolicyServerResponseBackwardOrErrorTag::TransitionTag()
+        {
+        if ( iContext.iMessage.IsMessage<TCFS60MCPRMessage::TMPMProcessErrorCompletedMsg>() )
+            {
+            // Make sure policy server doesn't say, reselect.
+            ASSERT( message_cast<TCFS60MCPRMessage::TMPMProcessErrorCompletedMsg>(&iContext.iMessage)->iValue !=
+                    (TInt)EDoReselection );
+            // Make sure we're are no longer in error state.
+            iContext.iNodeActivity->SetError( KErrNone );
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TWaitPolicyServerResponseBackwardOrErrorTag::TransitionTag() KWaitPolicyServerResponse",(TInt*)&iContext.Node())
+            return S60MCprStates::KWaitPolicyServerResponse | NetStateMachine::EBackward;
+            }
+        else
+            {
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TWaitPolicyServerResponseBackwardOrErrorTag::TransitionTag() KErrorTag",(TInt*)&iContext.Node())
+            return MeshMachine::KErrorTag | NetStateMachine::EForward;
+            }
+        }
+
+
+    // -----------------------------------------------------------------------------
+    // CS60MobilityActivity::NewL
+    // -----------------------------------------------------------------------------
+    //
+    MeshMachine::CNodeActivityBase* CS60MobilityActivity::NewL( const MeshMachine::TNodeActivity& aActivitySig, 
+                                                                       MeshMachine::AMMNodeBase& aNode )
+        {
+        CS60MobilityActivity* self = new(ELeave) CS60MobilityActivity( aActivitySig, aNode );
+        return self;
+        }
+
+    // -----------------------------------------------------------------------------
+    // CS60MobilityActivity::CS60MobilityActivity
+    // -----------------------------------------------------------------------------
+    //
+    CS60MobilityActivity::CS60MobilityActivity( const MeshMachine::TNodeActivity& aActivitySig, 
+                                                MeshMachine::AMMNodeBase& aNode )
+        :   S60MCprStates::CS60ErrorRecoveryActivity( aActivitySig, aNode )
+        {}
+
+
+    // -----------------------------------------------------------------------------
+    // CS60MobilityActivity::TInformMigrationAvailableAndSetHandshakingFlag::DoL
+    // -----------------------------------------------------------------------------
+    //
+    DEFINE_SMELEMENT( CS60MobilityActivity::TInformMigrationAvailableAndSetHandshakingFlag, 
+                      NetStateMachine::MStateTransition, 
+                      CS60MobilityActivity::TContext )
+    void CS60MobilityActivity::TInformMigrationAvailableAndSetHandshakingFlag::DoL()
+        {
+        S60MCPRLOGSTRING1("S60MCPR<%x>::TInformMigrationAvailableAndSetHandshakingFlag::DoL()",(TInt*)&iContext.Node())
+        __ASSERT_DEBUG(iContext.iNodeActivity, User::Panic(KS60MCprPanic, KPanicNoActivity));
+        CS60MobilityActivity& activity = static_cast<CS60MobilityActivity&>(*iContext.iNodeActivity);
+
+        //Inform the CPR that a potential migration is available. We only support a single data client
+        //in this implementation.
+        __ASSERT_DEBUG(activity.iPreferredAPId, User::Panic(KS60MCprPanic, KPanicNoServiceProvider));
+
+        //Compute all this here to keep EvaluatePreference() as fast as possible
+        activity.iCurrent = static_cast<RMetaServiceProviderInterface*>(
+                iContext.Node().GetFirstClient<TDefaultClientMatchPolicy>(
+                        TClientType( TCFClientType::EServProvider, TCFClientType::EStarted )));
+
+        __ASSERT_DEBUG(activity.iCurrent, User::Panic(KS60MCprPanic, KPanicNoServiceProvider));
+/*  Not valid ASSERT
+        __ASSERT_DEBUG(activity.iCurrent->ProviderInfo().APId() == activity.iCurrentAssumedAPId, 
+                       User::Panic(KS60MCprPanic, KPanicInConsistentMCPRState));
+*/
+        // Activity received the necessary information from the policy server earlier 
+        // and now holds that information which we'll send to IPCPR.
+        TCFMobilityControlClient::TMigrationNotification msg( activity.iCurrentAssumedAPId,
+                                                              //activity.iCurrent->ProviderInfo().APId(),
+                                                              activity.iPreferredAPId,
+                                                              activity.iIsUpgrade, 
+                                                              activity.iIsSeamless );
+
+        activity.PostToOriginators(msg);
+        activity.ClearPostedTo();
+        activity.SetHandshakingFlag();
+        }
+
+    
+    // -----------------------------------------------------------------------------
+    // CS60MobilityActivity::TSendMigrationRejected::DoL
+    // -----------------------------------------------------------------------------
+    //
+    DEFINE_SMELEMENT( CS60MobilityActivity::TSendMigrationRejected, 
+                      NetStateMachine::MStateTransition, 
+                      CS60MobilityActivity::TContext )
+    void CS60MobilityActivity::TSendMigrationRejected::DoL()
+        {
+        S60MCPRLOGSTRING1("S60MCPR<%x>::TSendMigrationRejected::DoL()",(TInt*)&iContext.Node())
+        CS60MetaConnectionProvider& node = (CS60MetaConnectionProvider&)iContext.Node();
+        CS60MobilityActivity& activity = static_cast<CS60MobilityActivity&>(*iContext.iNodeActivity);
+        node.Policy()->ApplicationIgnoredTheCarrierL( activity.iPreferredAPId );
+        }
+
+
+    // -----------------------------------------------------------------------------
+    // CS60MobilityActivity::TSendMigrationAccepted::DoL
+    // -----------------------------------------------------------------------------
+    //
+    DEFINE_SMELEMENT( CS60MobilityActivity::TSendMigrationAccepted, 
+                      NetStateMachine::MStateTransition, 
+                      CS60MobilityActivity::TContext )
+    void CS60MobilityActivity::TSendMigrationAccepted::DoL()
+        {
+        S60MCPRLOGSTRING1("S60MCPR<%x>::TSendMigrationAccepted::DoL()",(TInt*)&iContext.Node())
+        CS60MetaConnectionProvider& node = (CS60MetaConnectionProvider&)iContext.Node();
+        CS60MobilityActivity& activity = static_cast<CS60MobilityActivity&>(*iContext.iNodeActivity);
+        node.Policy()->ApplicationMigratesToCarrierL( activity.iPreferredAPId );
+        }
+
+
+    // -----------------------------------------------------------------------------
+    // CS60MobilityActivity::TSendApplicationAccept::DoL
+    // -----------------------------------------------------------------------------
+    //
+    DEFINE_SMELEMENT( CS60MobilityActivity::TSendApplicationAccept, 
+                      NetStateMachine::MStateTransition, 
+                      CS60MobilityActivity::TContext )
+    void CS60MobilityActivity::TSendApplicationAccept::DoL()
+        {
+        S60MCPRLOGSTRING1("S60MCPR<%x>::TSendApplicationAccept::DoL()",(TInt*)&iContext.Node())
+        CS60MetaConnectionProvider& node = (CS60MetaConnectionProvider&)iContext.Node();
+        CS60MobilityActivity& activity = static_cast<CS60MobilityActivity&>(*iContext.iNodeActivity);
+        node.Policy()->ApplicationAcceptedTheCarrierL( activity.iPreferredAPId );
+        }
+    
+    
+    // -----------------------------------------------------------------------------
+    // CS60MobilityActivity::TSendApplicationReject::DoL
+    // -----------------------------------------------------------------------------
+    //
+    DEFINE_SMELEMENT( CS60MobilityActivity::TSendApplicationReject, 
+                      NetStateMachine::MStateTransition, 
+                      CS60MobilityActivity::TContext )
+    void CS60MobilityActivity::TSendApplicationReject::DoL()
+        {
+        S60MCPRLOGSTRING1("S60MCPR<%x>::TSendApplicationReject::DoL()",(TInt*)&iContext.Node())
+        CS60MetaConnectionProvider& node = (CS60MetaConnectionProvider&)iContext.Node();
+        CS60MobilityActivity& activity = static_cast<CS60MobilityActivity&>(*iContext.iNodeActivity);
+        node.Policy()->ApplicationRejectedTheCarrierL( activity.iPreferredAPId );
+        }
+
+    
+    // -----------------------------------------------------------------------------
+    // CS60MobilityActivity::TClearHandshakingFlag::DoL
+    // -----------------------------------------------------------------------------
+    //
+    DEFINE_SMELEMENT( CS60MobilityActivity::TClearHandshakingFlag, 
+                      NetStateMachine::MStateTransition, CS60MobilityActivity::TContext )
+    void CS60MobilityActivity::TClearHandshakingFlag::DoL()
+        {
+        S60MCPRLOGSTRING1("S60MCPR<%x>::TClearHandshakingFlag::DoL()",(TInt*)&iContext.Node())
+        __ASSERT_DEBUG(iContext.iNodeActivity, User::Panic(KS60MCprPanic, KPanicNoActivity));
+        CS60MobilityActivity& activity = static_cast<CS60MobilityActivity&>(*iContext.iNodeActivity);
+        activity.ClearHandshakingFlag();
+        }
+
+
+    // -----------------------------------------------------------------------------
+    // CS60MobilityActivity::TInformMigrationCompleted::DoL
+    // -----------------------------------------------------------------------------
+    //
+    DEFINE_SMELEMENT( CS60MobilityActivity::TInformMigrationCompleted, 
+                      NetStateMachine::MStateTransition, CS60MobilityActivity::TContext )
+    void CS60MobilityActivity::TInformMigrationCompleted::DoL()
+        {
+        S60MCPRLOGSTRING1("S60MCPR<%x>::TInformMigrationCompleted::DoL()",(TInt*)&iContext.Node())
+        __ASSERT_DEBUG(iContext.iNodeActivity, User::Panic(KS60MCprPanic, KPanicNoActivity));
+        iContext.iNodeActivity->PostToOriginators(TCFMobilityProvider::TMigrationComplete().CRef());
+        iContext.iNodeActivity->ClearPostedTo();
+        }
+    
+    
+    // -----------------------------------------------------------------------------
+    // CS60MobilityActivity::TCancelMobilityActivity::DoL
+    // -----------------------------------------------------------------------------
+    //
+    DEFINE_SMELEMENT( CS60MobilityActivity::TCancelMobilityActivity, 
+                      NetStateMachine::MStateTransition, CS60MobilityActivity::TContext )
+    void CS60MobilityActivity::TCancelMobilityActivity::DoL()
+        {
+        S60MCPRLOGSTRING1("S60MCPR<%x>::TCancelAvailabilityRequest::DoL()",(TInt*)&iContext.Node())
+        CS60MetaConnectionProvider& node = (CS60MetaConnectionProvider&)iContext.Node();
+        // Unregister from preferred IAP Notifications.
+        //
+        node.Policy()->UnregisterPreferredIAPNotificationL();
+        // Clear the mobility handshaking flag.
+        // 
+        CS60MobilityActivity& activity = static_cast<CS60MobilityActivity&>(*iContext.iNodeActivity);
+        activity.ClearHandshakingFlag();
+        // At last we must set the activity in error since we're ready to go down.
+        //
+        iContext.iNodeActivity->SetError( KErrCancel );
+        }
+
+    
+    // -----------------------------------------------------------------------------
+    // CS60MobilityActivity::TAwaitingPreferredCarrierOrCancelOrRejected::Accept
+    // -----------------------------------------------------------------------------
+    //
+    DEFINE_SMELEMENT( CS60MobilityActivity::TAwaitingPreferredCarrierOrCancelOrRejected, 
+                      NetStateMachine::MState, TContext )
+    TBool CS60MobilityActivity::TAwaitingPreferredCarrierOrCancelOrRejected::Accept()
+        {
+        TBool result( EFalse );
+        
+        if ( iContext.iMessage.IsMessage<TCFS60MCPRMessage::TMPMPreferredCarrierAvailableMsg>() )
+            {
+            CS60MobilityActivity& activity = static_cast<CS60MobilityActivity&>(*iContext.iNodeActivity);
+            
+            TCFS60MCPRMessage::TMPMPreferredCarrierAvailableMsg* msg = 
+                message_cast<TCFS60MCPRMessage::TMPMPreferredCarrierAvailableMsg>( &iContext.iMessage );
+
+            TMpmNotificationPrefIAPAvailable* notif = (TMpmNotificationPrefIAPAvailable*)msg->iPtr;
+
+            S60MCPRLOGSTRING4("S60MCPR<%x>::TAwaitingPreferredCarrierOrCancelOrRejected::Accept() TMPMPreferredCarrierAvailableMsg %d -> %d upgrade=%d",
+                       (TInt*)&iContext.Node(), notif->iOldIapId, notif->iNewIapId, notif->iIsUpgrade)
+            // notif must be there.
+            ASSERT(notif);
+            
+            // Message received ok, clear the pending preferred IAP.
+            //
+            ((CS60MetaConnectionProvider&)iContext.Node()).ClearPolicyNotification();
+            
+            // Store the message preferences.
+            //
+            activity.iPreferredAPId         = notif->iNewIapId;
+            activity.iCurrentAssumedAPId    = notif->iOldIapId;
+            activity.iIsUpgrade             = notif->iIsUpgrade;
+            activity.iIsSeamless            = notif->iIsSeamless;
+            
+            result = ETrue;
+            }
+        else if ( iContext.iMessage.IsMessage<TEBase::TCancel>() )
+            {
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TAwaitingPreferredCarrierOrCancelOrRejected::Accept() TCancel", 
+                    (TInt*)&iContext.Node())
+            
+            result = ETrue;
+            }
+        else if ( iContext.iMessage.IsMessage<TCFMobilityProvider::TMigrationRejected>() )
+            {
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TAwaitingPreferredCarrierOrCancelOrRejected::Accept() TMigrationRejected", 
+                    (TInt*)&iContext.Node())
+            
+            result = ETrue;
+            }
+
+        return result;
+        }
+
+
+    // -----------------------------------------------------------------------------
+    // CS60MobilityActivity::TAwaitingPreferredCarrierOrStartIAPNotificationOrErrorNotificationOrCancel::Accept
+    // -----------------------------------------------------------------------------
+    //
+    DEFINE_SMELEMENT( CS60MobilityActivity::TAwaitingPreferredCarrierOrStartIAPNotificationOrErrorNotificationOrCancel, 
+                      NetStateMachine::MState, 
+                      CS60MobilityActivity::TContext )
+    TBool CS60MobilityActivity::TAwaitingPreferredCarrierOrStartIAPNotificationOrErrorNotificationOrCancel::Accept()
+        {
+        CS60MetaConnectionProvider& node = (CS60MetaConnectionProvider&)iContext.Node();
+        // Clear the pending at the end if the msg was accepted.
+        //
+        TBool result( EFalse );
+
+        if ( iContext.iMessage.IsMessage<TCFS60MCPRMessage::TMPMErrorNotificationMsg>() )
+            {
+            CS60MobilityActivity& activity = static_cast<CS60MobilityActivity&>(*iContext.iNodeActivity);
+            TCFS60MCPRMessage::TMPMErrorNotificationMsg* msg = 
+                message_cast<TCFS60MCPRMessage::TMPMErrorNotificationMsg>( &iContext.iMessage );
+            S60MCPRLOGSTRING2("S60MCPR<%x>::TAwaitingPreferredCarrierOrStartIAPNotificationOrErrorNotificationOrCancel::Accept() TMPMErrorNotificationMsg %d",(TInt*)&iContext.Node(),msg->iValue)
+            ASSERT( msg->iValue != KErrNone );
+            activity.SetError( msg->iValue );
+            result = ETrue;
+            }
+                
+        if ( iContext.iMessage.IsMessage<TCFS60MCPRMessage::TMPMPreferredCarrierAvailableMsg>() )
+            {
+            CS60MobilityActivity& activity = static_cast<CS60MobilityActivity&>(*iContext.iNodeActivity);
+            
+            TCFS60MCPRMessage::TMPMPreferredCarrierAvailableMsg* msg = 
+                message_cast<TCFS60MCPRMessage::TMPMPreferredCarrierAvailableMsg>( &iContext.iMessage );
+
+            TMpmNotificationPrefIAPAvailable* notif = (TMpmNotificationPrefIAPAvailable*)msg->iPtr;
+
+            S60MCPRLOGSTRING4("S60MCPR<%x>::TAwaitingPreferredCarrierOrStartIAPNotificationOrErrorNotificationOrCancel::Accept() TMPMPreferredCarrierAvailableMsg %d -> %d upgrade=%d",
+                       (TInt*)&iContext.Node(), notif->iOldIapId, notif->iNewIapId, notif->iIsUpgrade)
+
+            // info must be there.
+            ASSERT(notif);
+
+            activity.iPreferredAPId         = notif->iNewIapId;
+            activity.iCurrentAssumedAPId    = notif->iOldIapId;
+            activity.iIsUpgrade             = notif->iIsUpgrade;
+            activity.iIsSeamless            = notif->iIsSeamless;
+            result = ETrue;
+            }
+        
+        if ( iContext.iMessage.IsMessage<TCFS60MCPRMessage::TMPMStartIAPNotificationMsg>() )
+            {
+            TCFS60MCPRMessage::TMPMStartIAPNotificationMsg* msg = 
+                message_cast<TCFS60MCPRMessage::TMPMStartIAPNotificationMsg>( &iContext.iMessage );
+
+            CS60MetaConnectionProvider& node = (CS60MetaConnectionProvider&)iContext.Node();
+
+            S60MCPRLOGSTRING2("S60MCPR<%x>::TAwaitingPreferredCarrierOrStartIAPNotificationOrErrorNotificationOrCancel::Accept() TMPMStartIAPNotificationMsg IAP=%d NET=%d",(TInt*)&iContext.Node(), msg->iValue)
+
+            node.PolicyPrefs().SetIapId( msg->iValue );
+            result = ETrue;
+            }
+        
+        if ( iContext.iMessage.IsMessage<TEBase::TCancel>() )
+            {
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TAwaitingPreferredCarrierOrStartIAPNotificationOrErrorNotificationOrCancel::Accept() TCancel",(TInt*)&iContext.Node())
+            // There's nothing to cancel as we're waiting for notification only.
+            // Cancelling the notifications in standard cancel-transition is enough.
+            result = ETrue;
+            }
+        
+        // Ok, we can clear the msg.
+        //
+        if ( result )
+            {
+            // Clear.
+            node.ClearPolicyNotification();
+            }
+
+        // other messages.
+        //
+        return result;
+        }
+
+
+    // -----------------------------------------------------------------------------
+    // CS60MobilityActivity::TNoTagOrErrorTagOrApplicationRejectedMigrationOrCancel::TransitionTag
+    // -----------------------------------------------------------------------------
+    //
+    DEFINE_SMELEMENT( CS60MobilityActivity::TNoTagOrApplicationRejectedMigrationOrCancel, 
+                      NetStateMachine::MStateFork, CS60MobilityActivity::TContext )
+    TInt CS60MobilityActivity::TNoTagOrApplicationRejectedMigrationOrCancel::TransitionTag()
+        {
+        if ( message_cast<TCFMobilityProvider::TMigrationRequested>(&iContext.iMessage) )
+            {
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TNoTagOrApplicationRejectedMigrationOrCancel::TransitionTag() KNoTag",(TInt*)&iContext.Node())
+            return MeshMachine::KNoTag | NetStateMachine::EForward;
+            }
+        if ( message_cast<TCFMobilityProvider::TMigrationRejected>(&iContext.iMessage) )
+            {
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TNoTagOrApplicationRejectedMigrationOrCancel::TransitionTag() KApplicationRejectedMigration",(TInt*)&iContext.Node())
+            return S60MCprStates::KApplicationRejectedMigration | NetStateMachine::EForward; 
+            }
+        if ( message_cast<TEBase::TCancel>(&iContext.iMessage) )
+            {
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TNoTagOrApplicationRejectedMigrationOrCancel::TransitionTag() KCancelTag Generating ApplicationIgnoredTheCarrier",(TInt*)&iContext.Node())
+            
+            // Need to put MPM in consistent state and continue.
+            CS60MetaConnectionProvider& node = (CS60MetaConnectionProvider&)iContext.Node();
+            CS60MobilityActivity& activity = static_cast<CS60MobilityActivity&>(*iContext.iNodeActivity);
+            TRAP_IGNORE( node.Policy()->ApplicationIgnoredTheCarrierL( activity.iPreferredAPId ) );
+
+            return MeshMachine::KCancelTag | NetStateMachine::EForward;
+            }
+/*        else
+            {
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TNoTagOrErrorTagOrApplicationRejectedMigrationOrCancel::TransitionTag() Generating ApplicationIgnoredTheCarrier", (TInt*)&iContext.Node() );
+
+            // Need to put MPM in consistent state and continue.
+            CS60MetaConnectionProvider& node = (CS60MetaConnectionProvider&)iContext.Node();
+            CS60MobilityActivity& activity = static_cast<CS60MobilityActivity&>(*iContext.iNodeActivity);
+            TRAP_IGNORE( node.Policy()->ApplicationIgnoredTheCarrierL( activity.iPreferredAPId ) );
+            
+            if ( iContext.iNodeActivity->Error() == KErrNone )
+                {
+                ASSERT(EFalse); // should not happend
+                iContext.iNodeActivity->SetError( KErrGeneral ); // doesn't have effect if already set.
+                return MeshMachine::KErrorTag | NetStateMachine::EForward;
+                }
+            
+            return MeshMachine::KErrorTag | NetStateMachine::EForward;
+            }*/
+        S60MCPRLOGSTRING1("S60MCPR<%x>::TNoTagOrApplicationRejectedMigrationOrCancel::TransitionTag() KErrorTag ESock_IP Panic",(TInt*)&iContext.Node())
+        ASSERT(EFalse); // error, IPCPR should not send TError in this case.
+        return MeshMachine::KErrorTag | NetStateMachine::EForward;
+        }
+
+    
+    // -----------------------------------------------------------------------------
+    // CS60MobilityActivity::ClearHandshakingFlag
+    // -----------------------------------------------------------------------------
+    //
+    void CS60MobilityActivity::SetHandshakingFlag()
+        {
+        static_cast<CS60MetaConnectionProvider&>(iNode).SetHandshakingFlag();
+        }
+
+
+    // -----------------------------------------------------------------------------
+    // CS60MobilityActivity::ClearHandshakingFlag
+    // -----------------------------------------------------------------------------
+    //
+    void CS60MobilityActivity::ClearHandshakingFlag()
+        {
+        static_cast<CS60MetaConnectionProvider&>(iNode).ClearHandshakingFlag();
+        }
+
+
+    // -----------------------------------------------------------------------------
+    // CS60MobilityActivity::TConnectionRecoveryOrMobilityPreferenceOrErrorMutex::IsBlocked
+    // -----------------------------------------------------------------------------
+    //
+    TBool CS60MobilityActivity::TConnectionRecoveryOrMobilityPreferenceOrErrorMutex::IsBlocked( MeshMachine::TNodeContextBase& aContext ) 
+        {
+        if ( aContext.iNode.CountActivities( ECFActivityConnectionStartRecovery ) != 0 ||
+             aContext.iNode.CountActivities( ECFActivityConnectionGoneDownRecovery ) != 0 )
+            {
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TConnectionRecoveryOrMobilityPreferenceOrErrorMutex::IsBlocked() BLOCKED!",(TInt*)&aContext.Node())
+            return ETrue;
+            }
+        // In all other cases we have received a preferred carrier available from 
+        // policy server and we need to act on it. 
+        return EFalse;
+        }
+
+    } // namespace S60MCprMobilityActivity
+
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/S60MCPR/src/s60mcprsimpleselectactivity.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,635 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: S60 MCPR simple select activity implementation
+*
+*/
+
+/**
+@file s60mcprsimpleselectactivity.cpp
+S60 MCPR simple select activity implementation
+*/
+
+#include <comms-infras/ss_api_ext.h>
+#include <comms-infras/esock_params_internal.h>
+#include <comms-infras/esock_params.h>
+#include <commdbconnpref.h>
+
+#include <extendedconnpref.h>
+
+#include "s60mcpractivities.h"
+#include "s60mcprstates.h"
+
+using namespace Messages;
+using namespace MeshMachine;
+using namespace ESock;
+using namespace MCprActivities;
+using namespace S60MCprActivities;
+
+// -----------------------------------------------------------------------------
+// S60MCprSelectActivity
+// -----------------------------------------------------------------------------
+//
+namespace S60MCprSelectActivity
+    {
+    // -----------------------------------------------------------------------------
+    // TAwaitingSelectNextLayer
+    // -----------------------------------------------------------------------------
+    //
+    DEFINE_SMELEMENT(TAwaitingSelectNextLayer, NetStateMachine::MState, TContext)
+    TBool TAwaitingSelectNextLayer::Accept()
+        {
+		if ( !iContext.iMessage.IsMessage<TCFSelector::TSelect>() )
+            {
+            return EFalse;
+            }
+
+        __ASSERT_DEBUG( iContext.iPeer || iContext.iSender == iContext.NodeId(),
+                        User::Panic(KS60MCprPanic, KPanicPeerMessage) );
+
+        // Get MCPR
+        CS60MetaConnectionProvider& node = (CS60MetaConnectionProvider&)iContext.Node();
+
+        // Next find out if our selection needed update. 
+        
+        // Get's the active service provider.
+        RMetaServiceProviderInterface* sp = (RMetaServiceProviderInterface*) node.ServiceProvider();
+        // Initially NULL.
+        if ( sp && sp->ProviderInfo().APId() != node.PolicyPrefs().IapId() )
+            {
+            // Active sp exists but it differs from the required.
+            // Do not select complete yet.
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TAwaitingSelectNextLayer::Accept() Active ServiceProvider but not the correct one.",(TInt*)&iContext.Node())
+            return ETrue;
+            }
+
+        // If this node has any service providers (has already received some SelectComplete messages)
+        // we forward these to the requesting client. The service providers forwarded here may include
+        // all (selection has completed) or just a subset (selection still in progress) of this node's
+        // possible service providers.
+        TClientIter<TDefaultClientMatchPolicy> iter = 
+            iContext.Node().GetClientIter<TDefaultClientMatchPolicy>( TClientType(TCFClientType::EServProvider) );
+        RMetaServiceProviderInterface* serviceProvider = static_cast<RMetaServiceProviderInterface*>( iter++ );
+        TCFSelector::TSelectComplete msg( TNodeId::NullId(), TProviderInfo() );
+        while ( serviceProvider )
+            {
+            msg.iNodeId = serviceProvider->RecipientId();
+            msg.iProviderInfo = serviceProvider->ProviderInfo();
+            iContext.PostToSender( msg ); //We do not expect any answer so do not remember the peers TNodeId (SetPostedTo()).
+            serviceProvider = static_cast<RMetaServiceProviderInterface*>( iter++ );
+            }
+
+        //If this node has already completed selection, we send a final SelectComplete(NULL).
+        //if ( iContext.Node().IsSelectionCompleted() ) // private
+        if ( sp )  // If active sp exists, the selection is completed
+            {
+            iContext.PostToSender( TCFSelector::TSelectComplete( TNodeId::NullId(),
+                                                                 TProviderInfo()).CRef() );
+            //We do not expect any answer so do not remember the peers TNodeId (SetPostedTo()).
+            iContext.iMessage.ClearMessageId();
+            return EFalse;
+            }
+
+        //Otherwise we perform the selection (start the activity or add the originator to the list).
+        S60MCPRLOGSTRING1("S60MCPR<%x>::TAwaitingSelectNextLayer::Accept()",(TInt*)&iContext.Node())
+        return ETrue;
+        }    
+    
+    // -----------------------------------------------------------------------------
+    // Post ChooseBestIAP to MPM.
+    // -----------------------------------------------------------------------------
+    //
+    DEFINE_SMELEMENT(TSimpleSelect, NetStateMachine::MStateTransition, TContext)
+    void TSimpleSelect::DoL()
+        {
+        S60MCPRLOGSTRING1("S60MCPR<%x>::TSimpleSelect::DoL()",(TInt*)&iContext.Node())
+        
+        // Send simple select to self
+        iContext.iNodeActivity->PostRequestTo( iContext.NodeId(),
+                                               TCFSelector::TSimpleSelect().CRef() );
+        }
+
+    // -----------------------------------------------------------------------------
+    // Accepts state completion.
+    // -----------------------------------------------------------------------------
+    //
+    DEFINE_SMELEMENT(TAwaitingSimpleSelectComplete, NetStateMachine::MState, TContext)
+    TBool TAwaitingSimpleSelectComplete::Accept()
+        {
+        return EFalse;
+        }
+
+    // -----------------------------------------------------------------------------
+    // S60 Selection logic in MCPR instead of TM!
+    // -----------------------------------------------------------------------------
+    //
+    DEFINE_SMELEMENT(TSelectNextLayer, NetStateMachine::MStateTransition, TContext)
+    void TSelectNextLayer::DoL()
+        {
+        __ASSERT_DEBUG(iContext.iNodeActivity, User::Panic(KS60MCprPanic, KPanicNoActivity));
+        CSelectNextLayerActivity& ac = 
+            static_cast<CSelectNextLayerActivity&>( *iContext.iNodeActivity );
+
+        // Get MCPR
+        CS60MetaConnectionProvider& node = (CS60MetaConnectionProvider&)iContext.Node();
+
+        // SNAP Attach
+#ifdef _DEBUG    
+        if ( node.SelectionPrefs().Prefs().ExtensionId() == TConnPref::EConnPrefProviderInfo &&
+             node.SelectionPrefs().Scope()&TSelectionPrefs::ESelectFromExisting )
+            {
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TSelectNextLayer::DoL() SNAP Attach problem!!!!",(TInt*)&iContext.Node())
+            __ASSERT_DEBUG(EFalse, User::Panic(KS60MCprPanic, KPanicUnsupportedMCPRState));
+            }
+#endif //_DEBUG
+
+		TSelectionPrefs prefs;
+
+		ESock::RConnPrefList::TIter<TConnCSRPref> iterCSR = node.ConnPrefList().getIter<TConnCSRPref>();
+		//There should be one and only one CSR pref
+		ASSERT(iterCSR[0] != NULL && iterCSR[1] == NULL);
+		TConnCSRPref* csrprefs = iterCSR[0];
+
+		prefs.SetSubSessionUniqueId(csrprefs->SubSessionUniqueId());
+		prefs.SetFlags(csrprefs->Flags());
+		prefs.SetScope(csrprefs->Scope());
+
+		/*** HACK ALERT!
+
+		 */
+		TConnAPPref* nextAP = TConnAPPref::NewL(node.PolicyPrefs().IapId());
+		CleanupStack::PushL(nextAP);
+		node.ConnPrefList().AppendL(nextAP);
+		CleanupStack::Pop();
+		/* END OF HACK */
+
+		
+        // Attach. 399 attach shouldn't be visible here.
+        if ( prefs.Scope()&TSelectionPrefs::ESelectFromExisting )
+            {
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TSelectNextLayer::DoL() Attach ",(TInt*)&iContext.Node())
+            TCFSelector::TSimpleSelect msg( prefs );
+            iContext.iNodeActivity->PostRequestTo( ac.iTierManager, msg );
+            }
+        // Start
+        else
+            {
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TSelectNextLayer::DoL() Start",(TInt*)&iContext.Node())
+            TCommDbConnPref ippprefs;
+            ippprefs.SetIapId( node.PolicyPrefs().IapId() );
+            ippprefs.SetNetId( node.PolicyPrefs().NetId() );
+            //node.MapPolicyPrefsToConnPrefL( node.PolicyPrefs(), tmppref );
+            // don't use reference we want to preserve the original TSelectionPrefs.
+            TSelectionPrefs newPrefs;
+            newPrefs = prefs;
+            newPrefs.SetPrefs( ippprefs );
+            TCFSelector::TSimpleSelect msg(newPrefs);
+            iContext.iNodeActivity->PostRequestTo(ac.iTierManager, msg);
+
+            //TODO Clarify, if the SelectionChoices is actually needed...
+            //if (ac.SelectionChoices().Count() == 0)
+            //ac.SelectionChoices().Append(node.iIAPList[0]);
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// S60MCprSimpleSelectActivity
+// -----------------------------------------------------------------------------
+//
+namespace S60MCprSimpleSelectActivity
+    {
+    // -----------------------------------------------------------------------------
+    // TAwaitingSelectNextLayer
+    // -----------------------------------------------------------------------------
+    //
+    DEFINE_SMELEMENT(TAwaitingSelectNextLayer, NetStateMachine::MState, TContext)
+    TBool TAwaitingSelectNextLayer::Accept()
+        {
+        if ( !iContext.iMessage.IsMessage<TCFSelector::TSimpleSelect>() )
+            {
+            return EFalse;
+            }
+
+        __ASSERT_DEBUG( iContext.iPeer || iContext.iSender == iContext.NodeId(),
+                        User::Panic(KS60MCprPanic, KPanicPeerMessage) );
+
+        // Get MCPR
+        CS60MetaConnectionProvider& node = (CS60MetaConnectionProvider&)iContext.Node();
+
+        // Next find out if our selection needed update. 
+        
+        // Get's the active service provider.
+        RMetaServiceProviderInterface* sp = (RMetaServiceProviderInterface*) node.ServiceProvider();
+        // Initially NULL.
+        if ( sp && sp->ProviderInfo().APId() != node.PolicyPrefs().IapId() )
+            {
+            // Active sp exists but it differs from the required.
+            // Do not select complete yet.
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TAwaitingSelectNextLayer::Accept() Active ServiceProvider but not the correct one.",(TInt*)&iContext.Node())
+            return ETrue;
+            }
+
+        // If this node has any service providers (has already received some SelectComplete messages)
+        // we forward these to the requesting client. The service providers forwarded here may include
+        // all (selection has completed) or just a subset (selection still in progress) of this node's
+        // possible service providers.
+        TClientIter<TDefaultClientMatchPolicy> iter = 
+            iContext.Node().GetClientIter<TDefaultClientMatchPolicy>( TClientType(TCFClientType::EServProvider) );
+        RMetaServiceProviderInterface* serviceProvider = static_cast<RMetaServiceProviderInterface*>( iter++ );
+        TCFSelector::TSelectComplete msg( TNodeId::NullId(), TProviderInfo() );
+        while ( serviceProvider )
+            {
+            msg.iNodeId = serviceProvider->RecipientId();
+            msg.iProviderInfo = serviceProvider->ProviderInfo();
+            iContext.PostToSender( msg ); //We do not expect any answer so do not remember the peers TNodeId (SetPostedTo()).
+            serviceProvider = static_cast<RMetaServiceProviderInterface*>( iter++ );
+            }
+
+        //If this node has already completed selection, we send a final SelectComplete(NULL).
+        //if ( iContext.Node().IsSelectionCompleted() ) // private
+        if ( sp )  // If active sp exists, the selection is completed
+            {
+            iContext.PostToSender( TCFSelector::TSelectComplete( TNodeId::NullId(),
+                                                                 TProviderInfo()).CRef() );
+            //We do not expect any answer so do not remember the peers TNodeId (SetPostedTo()).
+            iContext.iMessage.ClearMessageId();
+            return EFalse;
+            }
+
+        //Otherwise we perform the selection (start the activity or add the originator to the list).
+        S60MCPRLOGSTRING1("S60MCPR<%x>::TAwaitingSelectNextLayer::Accept()",(TInt*)&iContext.Node())
+        return ETrue;
+        }
+
+    // -----------------------------------------------------------------------------
+    // S60 Selection logic in MCPR instead of TM!
+    // -----------------------------------------------------------------------------
+    //
+    DEFINE_SMELEMENT(TSelectNextLayer, NetStateMachine::MStateTransition, TContext)
+    void TSelectNextLayer::DoL()
+        {
+        __ASSERT_DEBUG(iContext.iNodeActivity, User::Panic(KS60MCprPanic, KPanicNoActivity));
+        CSelectNextLayerActivity& ac = 
+            static_cast<CSelectNextLayerActivity&>( *iContext.iNodeActivity );
+
+        // Get MCPR
+        CS60MetaConnectionProvider& node = (CS60MetaConnectionProvider&)iContext.Node();
+
+        // SNAP Attach
+#ifdef _DEBUG    
+        if ( node.SelectionPrefs().Prefs().ExtensionId() == TConnPref::EConnPrefProviderInfo &&
+             node.SelectionPrefs().Scope()&TSelectionPrefs::ESelectFromExisting )
+            {
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TSelectNextLayer::DoL() SNAP Attach problem!!!!",(TInt*)&iContext.Node())
+            __ASSERT_DEBUG(EFalse, User::Panic(KS60MCprPanic, KPanicUnsupportedMCPRState));
+            }
+#endif //_DEBUG
+
+        // Attach. 399 attach shouldn't be visible here.
+        if ( node.SelectionPrefs().Scope()&TSelectionPrefs::ESelectFromExisting )
+            {
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TSelectNextLayer::DoL() Attach ",(TInt*)&iContext.Node())
+            TCFSelector::TSimpleSelect msg( node.SelectionPrefs() );
+            iContext.iNodeActivity->PostRequestTo( ac.iTierManager, msg );
+            }
+        // Start
+        else
+            {
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TSelectNextLayer::DoL() Start",(TInt*)&iContext.Node())
+            TCommDbConnPref ippprefs;
+            ippprefs.SetIapId( node.PolicyPrefs().IapId() );
+            ippprefs.SetNetId( node.PolicyPrefs().NetId() );
+            //node.MapPolicyPrefsToConnPrefL( node.PolicyPrefs(), tmppref );
+            // don't use reference we want to preserve the original TSelectionPrefs.
+            TSelectionPrefs newPrefs;
+            newPrefs = node.SelectionPrefs();
+            newPrefs.SetPrefs( ippprefs );
+            TCFSelector::TSimpleSelect msg(newPrefs);
+            iContext.iNodeActivity->PostRequestTo(ac.iTierManager, msg);
+
+            //TODO Clarify, if the SelectionChoices is actually needed...
+            //if (ac.SelectionChoices().Count() == 0)
+            //ac.SelectionChoices().Append(node.iIAPList[0]);
+            }
+        }
+
+    // -----------------------------------------------------------------------------
+    // Post ChooseBestIAP to MPM.
+    // -----------------------------------------------------------------------------
+    //
+    DEFINE_SMELEMENT(TChooseBestIAP, NetStateMachine::MStateTransition, TContext)
+    void TChooseBestIAP::DoL()
+        {
+        S60MCPRLOGSTRING1("S60MCPR<%x>::TChooseBestIAP::DoL()",(TInt*)&iContext.Node())
+        
+        // Get MCPR
+        CS60MetaConnectionProvider& node = (CS60MetaConnectionProvider&)iContext.Node();
+
+        // Build up the PolicyRequest.
+        TConnPref* pref = new ( ELeave ) TMpmConnPref();
+        CleanupStack::PushL( pref );
+        TConnPref* polpref = (TConnPref*)new ( ELeave ) TPolicyConnPref();
+        CleanupStack::PushL( polpref );
+
+        // Is it Ok to store references of both node and activity?
+        // It should be ok since this is the activity we want to response for.
+        CChooseBestIAPCb* cb = new( ELeave ) CChooseBestIAPCb( node, iContext.iNodeActivity );
+
+        CleanupStack::PushL( cb );
+
+        // Resolve application uid.
+        TSubSessionUniqueId subSessionUniqueId = node.SelectionPrefs().SubSessionUniqueId();
+
+		if ( !node.ConnPrefList().Count() )
+			{
+            subSessionUniqueId = node.SelectionPrefs().SubSessionUniqueId();
+            }
+        else
+            {
+            subSessionUniqueId = node.SubSessionUniqueId();
+            }
+
+        TSecureId secureId( 0 );
+        
+        // Note that we use Symbian internal API to resolve the uid. 
+        AIPCClientInfo clientinfo;
+        TInt ret = clientinfo.ClientSid( subSessionUniqueId, secureId );
+        if ( ret != KErrNone )
+            {
+            S60MCPRLOGSTRING2("S60MCPR<%x>::TChooseBestIAP::DoL() Failed to resolve Application UID %d",(TInt*)&iContext.Node(),ret)
+            // Application UID may not exist. Use null id.
+            secureId = KNullUid;
+            }
+        
+        TUid id = TUid::Uid( secureId );
+        
+        S60MCPRLOGSTRING2("S60MCPR<%x>::TChooseBestIAP::DoL() Application UID=%x",(TInt*)&iContext.Node(),id);        
+
+        // Copy original TConnPref.
+        if (!node.ConnPrefList().Count())
+            {
+            *pref = node.SelectionPrefs().Prefs();
+            }
+        else
+            {
+            ESock::RConnPrefList::TIter<TExtendedConnPref> iterAP = node.ConnPrefList().getIter<TExtendedConnPref>();
+            TExtendedConnPref *ptr = &(*iterAP);
+            static_cast<TMpmConnPref*>(pref)->SetSnapPurpose ( ptr->SnapPurpose() );
+            static_cast<TMpmConnPref*>(pref)->SetSnapId ( ptr->SnapId() );
+            static_cast<TMpmConnPref*>(pref)->SetIapId ( ptr->IapId() );
+            static_cast<TMpmConnPref*>(pref)->SetBearerSet ( ptr->BearerSet() );
+            static_cast<TMpmConnPref*>(pref)->SetNoteBehaviour ( ptr->NoteBehaviour() );
+            static_cast<TMpmConnPref*>(pref)->SetDisconnectDialog ( ptr->DisconnectDialog() );
+            static_cast<TMpmConnPref*>(pref)->SetConnSelectionDialog ( ptr->ConnSelectionDialog() );
+            static_cast<TMpmConnPref*>(pref)->SetForcedRoaming ( ptr->ForcedRoaming() );
+            }
+
+        // Send request
+        node.Policy()->ChooseBestIAPL( pref, id, polpref, cb );
+
+        // Pop three objects.
+        CleanupStack::Pop( cb );
+        CleanupStack::Pop( polpref );
+        CleanupStack::Pop( pref );
+        }
+
+    // -----------------------------------------------------------------------------
+    // Accepts state completion.
+    // -----------------------------------------------------------------------------
+    //
+    DEFINE_SMELEMENT(TAwaitingChooseBestIAP, NetStateMachine::MState, TContext)
+    TBool TAwaitingChooseBestIAP::Accept()
+        {
+        if ( iContext.iMessage.IsMessage<TCFS60MCPRMessage::TMPMChooseBestIAPCompletedMsg>() )
+            {
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TAwaitingChooseBestIAP::Accept() TMPMChooseBestIAPCompletedMsg Accepted", (TInt*)&iContext.Node())
+
+            // MPM ChooseBestIAP completed.
+            return ETrue;
+            }
+        else if ( iContext.iMessage.IsMessage<TEBase::TError>() )
+            {
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TAwaitingChooseBestIAP::Accept() NOT Accept TError", (TInt*)&iContext.Node())
+            // Some error possibly sent by the MPM. We can let the core handle this.
+            return EFalse;
+            }
+        else if ( iContext.iMessage.IsMessage<TEBase::TCancel>() )
+            {
+            // Cancellation from the RConnection::Start(). 
+            // Cancel MPM asynch.
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TAwaitingChooseBestIAP::Accept() NOT Accept TCancel, Cancelling ChooseBestIAPL()", (TInt*)&iContext.Node())
+
+            // Get the MCPR
+            CS60MetaConnectionProvider& node = (CS60MetaConnectionProvider&)iContext.Node();
+
+            node.Policy()->CancelChooseBestIAPL();
+
+            return EFalse;
+            }
+        else
+            {
+            // Else
+            return EFalse;
+            }
+        }
+
+    // -----------------------------------------------------------------------------
+    // Decides if ChooseBestIAP is required.
+    // -----------------------------------------------------------------------------
+    //
+    DEFINE_SMELEMENT(TChooseBestIAPRequiredOrNoTagOrSetChosenApActive, NetStateMachine::MStateFork, TContext)
+    TInt TChooseBestIAPRequiredOrNoTagOrSetChosenApActive::TransitionTag()
+        {
+        __ASSERT_DEBUG(iContext.iNodeActivity, User::Panic(KS60MCprPanic, KPanicNoActivity));
+
+        // Initialize
+		CS60MetaConnectionProvider& node = (CS60MetaConnectionProvider&)iContext.Node();
+        TInt iapid = node.PolicyPrefs().IapId();
+        TInt result = MeshMachine::KNoTag;
+        RMetaServiceProviderInterface* sp = NULL;
+        TBool boundButNotActiveMCPRfound = EFalse;
+
+        // Search desired&bound MCPRs and check that EActive flag is not set.
+        TClientIter<TDefaultClientMatchPolicy> iter = 
+            node.GetClientIter<TDefaultClientMatchPolicy>(TCFClientType::EServProvider);
+        for ( TInt i = 0; iter[i]; i++ )
+            {
+            sp = static_cast<RMetaServiceProviderInterface*>( iter[i] );
+            // Make sure sp is not active and it exists
+            if ( !( sp->Flags() & TCFClientType::EActive ) && 
+                 sp->ProviderInfo().APId() == iapid )
+                {
+                boundButNotActiveMCPRfound = ETrue;
+                break;
+                }
+            }
+        
+        // Set service provider to point to active service provider.
+        sp = (RMetaServiceProviderInterface*) node.ServiceProvider();
+        
+        // If we are attaching to existing, we can use the passthrough preferences
+        //
+        if ( node.SelectionPrefs().Scope()&TSelectionPrefs::ESelectFromExisting )
+            {
+            S60MCPRLOGSTRING2("S60MCPR<%x>::TChooseBestIAPRequiredOrNoTagOrSetChosenApActive<%x>::TransitionTag() Selecting from existing",
+                      (TInt*)&iContext.Node(),(TInt*)this);
+            result = MeshMachine::KNoTag;
+            }
+        // If our policy selection doesn't match with the existing selection,
+        // but we have one ( i.e. we're roaming or recovering from error ) 
+        // We just need to select our IP Proto MCPRs.
+        // Preferences should be in place and choose best iap is not required.
+        //
+        else if ( sp && sp->ProviderInfo().APId() != iapid )
+            {
+            S60MCPRLOGSTRING2("S60MCPR<%x>::TChooseBestIAPRequiredOrNoTagOrSetChosenApActive<%x>::TransitionTag() Selecting with existing preferences",(TInt*)&iContext.Node(),(TInt*)this);
+            result = MeshMachine::KNoTag;
+            }
+        // If MCPR can be found but it's not active we can
+        // just jump into setting it active.
+        //
+        else if ( boundButNotActiveMCPRfound )
+            {
+            S60MCPRLOGSTRING2("S60MCPR<%x>::TChooseBestIAPRequiredOrNoTagOrSetChosenApActive::TransitionTag() IP Proto MCPR of AP %d found but not Active",(TInt*)&iContext.Node(),iapid)
+            result = S60MCprStates::KSetChosenApActive;
+            }
+        // We should execute the ChooseBestIAP query.
+        //
+        else
+            {
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TChooseBestIAPRequiredOrNoTagOrSetChosenApActive::TransitionTag() Selection from MPM required",(TInt*)&iContext.Node())
+            result = S60MCprStates::KChooseBestIAPRequired;
+            }
+        
+//  In other words:
+//         return ( ( passThrough || justSelect ) ? 
+//                    MeshMachine::KNoTag 
+//                  : justSetActive ? 
+//                          S60MCprStates::KSetChosenApActive
+//                        : S60MCprStates::KChooseBestIAPRequired ) 
+//               | NetStateMachine::EForward;
+
+        return result | NetStateMachine::EForward;
+        }
+
+    // -----------------------------------------------------------------------------
+    // TSetChosenApActiveOrSelectedProviderBackward
+    // -----------------------------------------------------------------------------
+    //
+    DEFINE_SMELEMENT(TSetChosenApActiveOrSelectedProviderBackward, NetStateMachine::MStateFork, TContext)
+    TInt TSetChosenApActiveOrSelectedProviderBackward::TransitionTag()
+        {
+        __ASSERT_DEBUG(iContext.iNodeActivity, User::Panic(KS60MCprPanic, KPanicNoActivity));
+        CSelectNextLayerActivity& ac = static_cast<CSelectNextLayerActivity&>( *iContext.iNodeActivity );
+        if ( ac.SelectionChoices().Count() > ( ac.iCurrentIndex + 1 ) )
+            {
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TSetChosenApActiveOrSelectedProviderBackward::TransitionTag() KSelectedProvider",(TInt*)&iContext.Node())
+            return MCprStates::KSelectedProvider | NetStateMachine::EBackward;
+            }
+        S60MCPRLOGSTRING1("S60MCPR<%x>::TSetChosenApActiveOrSelectedProviderBackward::TransitionTag() KSetChosenApActive",(TInt*)&iContext.Node())
+        return S60MCprStates::KSetChosenApActive | NetStateMachine::EForward;
+        }
+
+    // -----------------------------------------------------------------------------
+    // Sets the chosen AP as active.
+    // -----------------------------------------------------------------------------
+    //
+    DEFINE_SMELEMENT(TSetChosenApActive, NetStateMachine::MStateTransition, TContext)
+    void TSetChosenApActive::DoL()
+        {
+        S60MCPRLOGSTRING1("S60MCPR<%x>::TSetChosenApActive::DoL()",(TInt*)&iContext.Node())
+
+        // Get the MCPR
+        CS60MetaConnectionProvider& node = (CS60MetaConnectionProvider&)iContext.Node();
+
+        // Get the policy server's selection result 
+        TInt iapid = node.PolicyPrefs().IapId();
+        // Get iterator from the base class.
+        TClientIter<TDefaultClientMatchPolicy> iter = node.GetClientIter<TDefaultClientMatchPolicy>(TCFClientType::EServProvider);
+        // Introduce handle to IPProtoMCPR
+        RMetaServiceProviderInterface* sp = NULL;
+        // Iterate and set the EActive flag when needed
+        for ( TInt i = 0; iter[i]; i++ )
+            {
+            sp = static_cast<RMetaServiceProviderInterface*>(iter[i]);
+            if ( sp->ProviderInfo().APId() == iapid ) // In IPProto the runtime APId is the IapId.
+                {
+                S60MCPRLOGSTRING2("S60MCPR<%x>::TSetChosenApActive::DoL() IP Proto MCPR of AP %d set Active",(TInt*)&iContext.Node(),iapid)
+                sp->SetFlags( TCFClientType::EActive );
+                break; // Leave sp selected
+                }
+            else if ( node.SelectionPrefs().Scope()&TSelectionPrefs::ESelectFromExisting &&
+                      iapid == 0 ) // Not selected by MPM. Legacy Attach.
+                {
+                // Set IapId.
+                node.PolicyPrefs().SetIapId( sp->ProviderInfo().APId() );
+                // Inform MPM of used AP.
+                node.Policy()->ApplicationJoinsConnectionL( node.PolicyPrefs().IapId() );
+                break;
+                }
+#ifdef _DEBUG // allow urel use any in case of error. The missing TSetChosenApActive -log above indicates a problem.
+            else
+                {
+                sp = NULL;
+                }
+#endif
+            }
+        // At this point we're not doing reconnect or anything like that. 
+        // Therefore the Selected provider must be the same as the one picked by MPM and must be found.
+        __ASSERT_DEBUG(sp, User::Panic(KS60MCprPanic, KPanicInConsistentMCPRState));
+        }
+
+    // -----------------------------------------------------------------------------
+    // CChooseBestIAPCb::PolicyResponse
+    // -----------------------------------------------------------------------------
+    //
+    void CChooseBestIAPCb::PolicyResponse( PolicyRequest& aCompletedRequest )
+        {
+        S60MCPRLOGSTRING1("S60MCPR<%x>::CChooseBestIAPCb::PolicyResponse()",(TInt*)&iNode)
+
+        // Request to MPM failed for some reason
+        if( aCompletedRequest.iStatus != KErrNone )
+            {
+            S60MCPRLOGSTRING2("S60MCPR<%x>::CChooseBestIAPCb::PolicyResponse() MPM Error %d",(TInt*)&iNode,aCompletedRequest.iStatus)
+
+            TEBase::TError msg( TCFS60MCPRMessage::TMPMChooseBestIAPCompletedMsg::Id(), 
+                                aCompletedRequest.iStatus );
+            if ( iLastRequestOriginator.IsOpen() )
+                {
+                iLastRequestOriginator.ReplyTo( iNode.Id(), msg );
+                iLastRequestOriginator.Close();
+                }
+            return;
+            }
+
+        // We only accept TPolicyConnPref from MPM.
+        ASSERT( aCompletedRequest.iPolicyPref->ExtensionId() == TPolicyConnPref::EConnS60PolicyPref );
+
+        TPolicyConnPref* policypref = (TPolicyConnPref*)aCompletedRequest.iPolicyPref;
+
+        iNode.SetPolicyPrefs( *policypref );
+
+        S60MCPRLOGSTRING3("S60MCPR<%x>::CChooseBestIAPCb::PolicyResponse() IAP %d NET %d",
+                  (TInt*)&iNode,policypref->IapId(),policypref->NetId())
+
+        TCFS60MCPRMessage::TMPMChooseBestIAPCompletedMsg req;
+        if ( iLastRequestOriginator.IsOpen() )
+            {
+            iLastRequestOriginator.ReplyTo( iNode.Id(), req );
+            iLastRequestOriginator.Close();
+            }
+        }
+    } // namespace S60MCprSimpleSelectActivity
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/S60MCPR/src/s60mcprstates.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,486 @@
+/*
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: S60 MCPR states implementation
+*
+*/
+
+/**
+@file s60mcprstates.cpp
+S60 MCPR states implementation
+*/
+
+#include <cdblen.h>
+
+#include "s60mcprstates.h"
+
+using namespace S60MCprStates;
+using namespace ESock;
+using namespace Messages;
+using namespace MeshMachine;
+
+// -----------------------------------------------------------------------------
+// THandleMPMStatusChange::DoL
+// -----------------------------------------------------------------------------
+//
+DEFINE_SMELEMENT(THandleMPMStatusChange, NetStateMachine::MStateTransition, TContext)
+void THandleMPMStatusChange::DoL()
+    {
+    TCFControlProvider::TDataClientStatusChange& msg = 
+        Messages::message_cast<TCFControlProvider::TDataClientStatusChange>(iContext.iMessage);
+
+    // Get MCPR
+    CS60MetaConnectionProvider& node = iContext.Node();
+
+    // Get the policy server's selection result 
+    TInt iapid = node.PolicyPrefs().IapId();
+    
+    if ( iapid == 0 )
+        {
+        // Filter zeros out.
+        // We don't need information of IPCPR status, we only care real connections.
+        }
+    else if ( msg.iValue == TCFControlProvider::TDataClientStatusChange::EStarted && 
+              node.RequestPermissionToSendStarted() )
+        {
+        S60MCPRLOGSTRING2("S60MCPR<%x>::THandleMPMStatusChange::DoL() calling IAPConnectionStartedL IAP %d",(TInt*)&iContext.Node(),iapid)
+        // TODO use progress notification KLinkLayerOpen once Symbian provides them.
+        node.Policy()->IAPConnectionStartedL( iapid );  // codescanner::leave
+        
+        /** HACK ALERT
+        *
+        * Due to regression in MOBILITY the EStartedFlag for serviceprovider is set here!
+        * TODO Remove this hack whenever possible!!!
+        */
+        node.ServiceProvider()->SetFlags( TCFClientType::EStarted );       
+        }
+    else if ( msg.iValue == TCFControlProvider::TDataClientStatusChange::EStopped &&
+              node.RequestPermissionToSendStopped() )
+        {
+        S60MCPRLOGSTRING2("S60MCPR<%x>::THandleMPMStatusChange::DoL() calling IAPConnectionStoppedL IAP %d",(TInt*)&iContext.Node(),iapid)
+        // Send request.
+        // The problem with IAPConnectionStoppedL() is that to MPM it means
+        // that IAP has gone down but actually the provider has just left.
+        // policy->IAPConnectionStoppedL( node.iIapId );
+        // Hence we mimic the situtation that application leaves the connection.
+        node.Policy()->ApplicationLeavesConnectionL( iapid );  // codescanner::leave
+        node.Policy()->ApplicationConnectionEndsL();  // codescanner::leave
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// TReselectBestIAP::DoL
+// -----------------------------------------------------------------------------
+//
+DEFINE_SMELEMENT(TReselectBestIAP, NetStateMachine::MStateTransition, TContext)
+void TReselectBestIAP::DoL()
+    {
+    S60MCPRLOGSTRING1("S60MCPR<%x>::TReselectBestIAP::DoL()",(TInt*)&iContext.Node())
+    
+    // Get MCPR
+    CS60MetaConnectionProvider& node = (CS60MetaConnectionProvider&)iContext.Node();
+
+    // Build up the PolicyRequest.
+    TConnPref* polpref = (TConnPref*)new ( ELeave ) TPolicyConnPref();  // codescanner::leave
+    CleanupStack::PushL( polpref );  // codescanner::leave
+
+    CReselectBestIAPCb* cb = new( ELeave ) CReselectBestIAPCb( node, iContext.iNodeActivity );  // codescanner::leave
+    CleanupStack::PushL( cb );  // codescanner::leave
+
+    // Send request
+    node.Policy()->ReselectIAPL( polpref, cb );  // codescanner::leave
+
+    // Pop three objects.
+    CleanupStack::Pop( cb );
+    CleanupStack::Pop( polpref );
+    // Pop pref and cb objects.
+    }
+
+
+// -----------------------------------------------------------------------------
+// TRequestReConnect::DoL
+// -----------------------------------------------------------------------------
+//
+DEFINE_SMELEMENT( TRequestReConnect, NetStateMachine::MStateTransition, TContext )
+void TRequestReConnect::DoL() // codescanner::leave
+    {
+    __ASSERT_DEBUG(iContext.iNodeActivity, User::Panic(KS60MCprPanic, KPanicNoActivity));
+    S60MCPRLOGSTRING1("S60MCPR<%x>::TRequestReConnect::DoL()",(TInt*)&iContext.Node())
+    // We have AP that will go down. 
+    // And the other AP that will go up.
+    RNodeInterface* stoppingSP = NULL;
+    RNodeInterface* startingSP = NULL;
+
+    // The one that will be started is the one MPM selected.
+    // Both must be present in the MCPR -plane.
+
+    // Choose Service Providers to work on
+    TClientIter<TDefaultClientMatchPolicy> iter = 
+        iContext.Node().GetClientIter<TDefaultClientMatchPolicy>(TClientType(TCFClientType::EServProvider));
+
+    RNodeInterface* itf = NULL;
+    for ( itf = iter++; ( itf != NULL && ( stoppingSP == NULL || startingSP == NULL ) ); itf = iter++ )
+        {
+        // Only one of the selected MCPRs can be EStarted.
+        //
+        if ( itf->Flags() & TCFClientType::EStarted )
+            {
+            stoppingSP = itf; //Our current started Service Provider.
+            itf->ClearFlags( TCFClientType::EActive );
+            }
+        // The other which is not EStarted must be EActive.
+        //
+        else if ( itf->Flags() & TCFClientType::EActive )
+            {
+            startingSP = itf; //And the new one to try next
+            }
+        }
+    // One must be started since this is already a reconnection
+    if ( stoppingSP==NULL )
+        { 
+        // Indication of a serious problem.
+        S60MCPRLOGSTRING1("S60MCPR<%x>::TRequestReConnect::DoL() - started service provider not found.",(TInt*)&iContext.Node())
+        ASSERT( EFalse );
+        User::Leave( KErrCorrupt );  // codescanner::leave
+        }
+
+    //Sanity check.
+    //The new provider must not be started, there can be only one started at a time.
+    ASSERT( startingSP == NULL || ( startingSP->Flags() & TCFClientType::EStarted ) == 0 );
+
+    //If there is no other Service Provider to try, return KErrNotFound
+    if ( startingSP == NULL )
+        {
+        S60MCPRLOGSTRING1("S60MCPR<%x>::TRequestReConnect::DoL() - no more choices, abandoning recovery.",(TInt*)&iContext.Node())
+        User::Leave( KErrNotFound );  // codescanner::leave
+        }
+
+    //Diagnostinc - there must be a data client or we cannot be here
+    __ASSERT_DEBUG(iContext.Node().GetFirstClient<TDefaultClientMatchPolicy>(TClientType(TCFClientType::EData)),
+                   User::Panic(KS60MCprPanic, KPanicNoDataClient));
+
+    iContext.iNodeActivity->PostRequestTo( iContext.NodeId(),
+                                           TCFMcpr::TReConnect( stoppingSP->RecipientId(), 
+                                                                startingSP->RecipientId()).CRef() );
+    }
+
+
+// -----------------------------------------------------------------------------
+// TProcessError::DoL
+// -----------------------------------------------------------------------------
+//
+DEFINE_SMELEMENT( TProcessError, NetStateMachine::MStateTransition, TContext )
+void TProcessError::DoL() // codescanner::leave
+    {
+    __ASSERT_DEBUG(iContext.iNodeActivity, User::Panic(KS60MCprPanic, KPanicNoActivity));
+    // Get the MCPR
+    CS60MetaConnectionProvider& node = (CS60MetaConnectionProvider&)iContext.Node();
+
+    TInt error( KErrNone );
+
+    // Get the error from the message or from the activity.
+    // Since this transition could be triggered from almost anywhere, 
+    // give preference to current Message.
+    if ( iContext.iMessage.IsMessage<Messages::TEBase::TError>() )
+        {
+        S60MCPRLOGSTRING1("S60MCPR<%x>::TProcessError::DoL() Using iMessage as error source",(TInt*)&iContext.Node())
+        error = message_cast<TEBase::TError>(&iContext.iMessage)->iValue;
+        }
+    else
+        {
+        S60MCPRLOGSTRING1("S60MCPR<%x>::TProcessError::DoL() Using CS60ErrorRecoveryActivity as error source",(TInt*)&iContext.Node())
+        // Get the activity.
+        CS60ErrorRecoveryActivity& activity = 
+            static_cast<CS60ErrorRecoveryActivity&>(*iContext.iNodeActivity);
+        Messages::TErrContext err =  activity.iOriginalErrContext;
+        error = err.iStateChange.iError;
+        }
+
+    ASSERT( error != KErrNone );
+    
+    // Create the callback that will eventually create the message that completes this state.
+    CProcessErrorCb* cb = new( ELeave ) CProcessErrorCb( node, iContext.iNodeActivity );  // codescanner::leave
+    CleanupStack::PushL( cb );  // codescanner::leave
+    // We always need to ask MPM to handle the error.
+    node.Policy()->ProcessErrorL( error, cb );  // codescanner::leave
+    CleanupStack::Pop( cb );
+    // After this we wait for cancellation/error/completion.
+    }
+
+
+// -----------------------------------------------------------------------------
+// TAwaitingSelectNextLayerCompletedOrError::Accept
+// -----------------------------------------------------------------------------
+//
+DEFINE_SMELEMENT( TAwaitingSelectNextLayerCompletedOrError, NetStateMachine::MState, TContext )
+TBool TAwaitingSelectNextLayerCompletedOrError::Accept()
+    {
+    TEBase::TError* msg = message_cast<TEBase::TError>(&iContext.iMessage);
+    if( msg )
+        {
+        S60MCPRLOGSTRING1("S60MCPR<%x>::TAwaitingSelectNextLayerCompletedOrError::Accept() TError",(TInt*)&iContext.Node())
+        iContext.iNodeActivity->SetError(msg->iValue);
+        return ETrue;
+        }
+    if (iContext.iMessage.IsMessage<TCFSelector::TSelectComplete>())
+        {
+        if (message_cast<TCFSelector::TSelectComplete>(iContext.iMessage).iNodeId.IsNull())
+            {
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TAwaitingSelectNextLayerCompletedOrError::Accept() TSelectComplete",(TInt*)&iContext.Node())
+            return ETrue;
+            }
+        //Consume any other TSelectComplete messages
+        iContext.iMessage.ClearMessageId();
+        }
+    return EFalse;
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// TAwaitingReselectBestIAPCompleteOrError::Accept
+// -----------------------------------------------------------------------------
+//
+DEFINE_SMELEMENT( TAwaitingReselectBestIAPCompleteOrError, NetStateMachine::MState, TContext )
+TBool TAwaitingReselectBestIAPCompleteOrError::Accept()
+    {
+    if ( iContext.iMessage.IsMessage<TCFS60MCPRMessage::TMPMReselectBestIAPCompletedMsg>() )
+        {
+        S60MCPRLOGSTRING1("S60MCPR<%x>::TAwaitingReselectBestIAPCompleteOrError::Accept() TMPMReselectBestIAPCompletedMsg Accepted",(TInt*)&iContext.Node())
+        
+        // Reselect completed.
+        return ETrue;
+        }
+    else if ( iContext.iMessage.IsMessage<Messages::TEBase::TError>() )
+        {
+        S60MCPRLOGSTRING1("S60MCPR<%x>::TAwaitingReselectBestIAPCompleteOrError::Accept() TError",(TInt*)&iContext.Node())
+        // Some error possibly sent by the MPM. Must be handled by the activity.
+        Messages::TEBase::TError* msg = message_cast<TEBase::TError>(&iContext.iMessage);
+        iContext.iNodeActivity->SetError(msg->iValue);
+        return ETrue;
+        }
+    else if ( iContext.iMessage.IsMessage<Messages::TEBase::TCancel>() )
+        {
+        // Cancellation from the RConnection::Start(). 
+        // Cancel MPM asynch.
+        S60MCPRLOGSTRING1("S60MCPR<%x>::TAwaitingReselectBestIAPCompleteOrError::Accept() NOT Accept TCancel, Cancelling ReselectBestIAPL()",(TInt*)&iContext.Node())
+
+        // Get the MCPR
+        CS60MetaConnectionProvider& node = (CS60MetaConnectionProvider&)iContext.Node();
+        
+        node.Policy()->CancelReselectBestIAP();
+        
+        return EFalse;
+        }
+    else
+        {
+        // else
+        return EFalse;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// TAwaitingProcessErrorCompleteOrError::Accept
+// -----------------------------------------------------------------------------
+//
+DEFINE_SMELEMENT( TAwaitingProcessErrorCompleteOrError, NetStateMachine::MState, TContext )
+TBool TAwaitingProcessErrorCompleteOrError::Accept()
+    {
+    if ( iContext.iMessage.IsMessage<TCFS60MCPRMessage::TMPMProcessErrorCompletedMsg>() )
+        {
+        S60MCPRLOGSTRING1("S60MCPR<%x>::TAwaitingProcessErrorCompleteOrError::Accept() TMPMProcessErrorCompletedMsg or Error", (TInt*)&iContext.Node())
+        // ProcessErrorComplete completed.
+        return ETrue;
+        }
+    else if ( iContext.iMessage.IsMessage<TEBase::TError>() )
+        {
+        // Processing continue in error transition.
+        TEBase::TError* msg = message_cast<TEBase::TError>( &iContext.iMessage );
+        iContext.iNodeActivity->SetError( msg->iValue );
+        S60MCPRLOGSTRING2("S60MCPR<%x>::TAwaitingProcessErrorCompleteOrError::Accept() Error %d", (TInt*)&iContext.Node(),msg->iValue)
+        return ETrue;
+        }
+    else if ( iContext.iMessage.IsMessage<TEBase::TCancel>() )
+        {
+        // Get the MCPR
+        CS60MetaConnectionProvider& node = (CS60MetaConnectionProvider&)iContext.Node();
+
+        node.Policy()->CancelProcessError();
+        // should this be the same as ignore?
+        S60MCPRLOGSTRING1("S60MCPR<%x>::TAwaitingProcessErrorCompleteOrError::Accept() NOT Accepted TCancel Cancelling ProcessError", (TInt*)&iContext.Node())
+        return EFalse;
+        }
+    else
+        {
+        return EFalse;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// TAwaitingServiceIdRequest::Accept
+// -----------------------------------------------------------------------------
+//
+DEFINE_SMELEMENT( TAwaitingServiceIdRequest, NetStateMachine::MState, TContext )
+TBool TAwaitingServiceIdRequest::Accept()
+    {
+    ESock::TMCprGetConnectionSetting* msg = NULL;
+
+    S60MCPRLOGSTRING2("TAwaitingServiceIdRequest: iContext.iMessage( %x %x )", 
+            iContext.iMessage.MessageId().MessageId(), 
+            iContext.iMessage.MessageId().Realm());
+    S60MCPRLOGSTRING2(" == ( %x %x )?\n", 
+            ESock::TMCprGetConnectionSetting::EId, 
+            ESock::TMCprGetConnectionSetting::ERealm);
+
+    if ( iContext.iMessage.IsMessage<ESock::TMCprGetConnectionSetting>() )  
+        {
+        S60MCPRLOGSTRING1("S60MCPR<%x>::TAwaitingServiceIdRequest::Accept() TMCprGetConnectionSetting", 
+            (TInt*)&iContext.Node())
+        msg = message_cast<ESock::TMCprGetConnectionSetting>(&iContext.iMessage);
+
+        // Get MCPR
+        CS60MetaConnectionProvider& node = (CS60MetaConnectionProvider&)iContext.Node();
+
+        // Only EIntSetting is supported 
+        // 
+        if ( ( TMCprGetConnectionSetting::TConnectionSettingType)msg->iSettingType == 
+               TMCprGetConnectionSetting::EIntSetting
+               && node.PolicyPrefs().ServiceId() != 0 )
+            {
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TAwaitingServiceIdRequest::Accept() TMCprGetConnectionSetting EIntSetting", 
+                (TInt*)&iContext.Node())
+            return ETrue;
+            }
+        else
+            {
+            S60MCPRLOGSTRING1("S60MCPR<%x>::TAwaitingServiceIdRequest::Accept() TMCprGetConnectionSetting not processing EIntSetting", 
+                (TInt*)&iContext.Node())
+            return EFalse;
+            }
+        }
+    else
+        {
+        return EFalse;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// TRetrieveServiceId::DoL
+// -----------------------------------------------------------------------------
+//
+DEFINE_SMELEMENT( TRetrieveServiceId, NetStateMachine::MStateTransition, TContext )
+void TRetrieveServiceId::DoL()
+    {
+    S60MCPRLOGSTRING1("S60MCPR<%x>::TRetrieveServiceId::DoL()", (TInt*)&iContext.Node())
+
+    // Get MCPR
+    CS60MetaConnectionProvider& node = (CS60MetaConnectionProvider&)iContext.Node();
+
+    // Get the policy server's selection result 
+    TUint32 serviceId = node.PolicyPrefs().ServiceId();
+    S60MCPRLOGSTRING2("S60MCPR<%x>::TRetrieveServiceId::DoL() ServiceId = %d", 
+            (TInt*)&iContext.Node(), serviceId )
+
+    TPckg<TUint32> pckg( serviceId );
+
+    S60MCPRLOGSTRING1("S60MCPR<%x>::TRetrieveServiceId::DoL() Write ServiceId to ResponseMsg", 
+            (TInt*)&iContext.Node())
+    TCFSigLegacyRMessage2Ext& msg = static_cast<TCFSigLegacyRMessage2Ext&>( iContext.iMessage );
+    msg.iMessage.WriteL( 1, pckg ); // codescanner::leave
+
+    S60MCPRLOGSTRING1("S60MCPR<%x>::TRetrieveServiceId::DoL() Complete ResponseMsg", 
+            (TInt*)&iContext.Node())
+    RLegacyResponseMsg responseMsg( iContext, msg.iMessage, msg.iMessage.Int0() );
+    responseMsg.Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CReselectBestIAPCb::PolicyResponse 
+// -----------------------------------------------------------------------------
+//
+void CReselectBestIAPCb::PolicyResponse( PolicyRequest& aCompletedRequest )
+    {
+    using namespace ESock;
+    TPolicyConnPref* policypref = (TPolicyConnPref*)aCompletedRequest.iPolicyPref;
+
+    // Request to MPM failed for some reason
+    if( aCompletedRequest.iStatus != KErrNone )
+        {
+        S60MCPRLOGSTRING2("S60MCPR<%x>::CReselectBestIAPCb::PolicyResponse() MPM Error %d",(TInt*)&iNode,aCompletedRequest.iStatus)
+        Messages::TEBase::TError msg( TCFS60MCPRMessage::TMPMReselectBestIAPCompletedMsg::Id(), 
+                                      aCompletedRequest.iStatus );
+        if ( iLastRequestOriginator.IsOpen() )
+            {
+            iLastRequestOriginator.ReplyTo( iNode.Id(), msg );
+            iLastRequestOriginator.Close();
+            }
+        return;
+        }
+
+    S60MCPRLOGSTRING3("S60MCPR<%x>::CReselectBestIAPCb::PolicyResponse() IAP %d NET %d",
+            (TInt*)&iNode,policypref->IapId(),policypref->NetId())
+    
+    iNode.SetPolicyPrefs( *policypref );
+    
+    TCFS60MCPRMessage::TMPMReselectBestIAPCompletedMsg msg;
+    if ( iLastRequestOriginator.IsOpen() )
+        {
+        iLastRequestOriginator.ReplyTo( iNode.Id(), msg );
+        iLastRequestOriginator.Close();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CProcessErrorCb::PolicyResponse
+// -----------------------------------------------------------------------------
+//
+void CProcessErrorCb::PolicyResponse( PolicyRequest& aCompletedRequest )
+    {
+    S60MCPRLOGSTRING3("S60MCPR<%x>::CProcessErrorCb::PolicyResponse() status=%d action=%d",
+              (TInt*)&iNode,aCompletedRequest.iStatus,(TInt)aCompletedRequest.iNeededAction)
+    // Validate that we can send a response.
+    //
+    if ( !iLastRequestOriginator.IsOpen() )
+        {
+        // response can't be sent.
+        return;
+        }
+    // Request ok and valid one
+    //
+    if ( aCompletedRequest.iStatus == KErrNone &&
+         ( aCompletedRequest.iNeededAction == EIgnoreError ||
+           aCompletedRequest.iNeededAction == EDoReselection ))
+        {
+        TCFS60MCPRMessage::TMPMProcessErrorCompletedMsg msg( (TInt)aCompletedRequest.iNeededAction );
+        iLastRequestOriginator.ReplyTo( iNode.Id(), msg );
+        iLastRequestOriginator.Close();
+        }
+    // Propagate error
+    //
+    else
+        {
+        // Initialize
+        TInt err = aCompletedRequest.iStatus;
+        if ( err == KErrNone )
+            {
+            ASSERT( aCompletedRequest.iError != KErrNone );
+            err = aCompletedRequest.iError != KErrNone ? aCompletedRequest.iError : KErrGeneral;
+            }
+        TEBase::TError msg( TCFS60MCPRMessage::TMPMProcessErrorCompletedMsg::Id(), err );
+        iLastRequestOriginator.ReplyTo( iNode.Id(), msg );
+        iLastRequestOriginator.Close();
+        }
+    }
+
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/S60MCPR/src/s60mpmnotifications.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,143 @@
+/*
+* Copyright (c) 2008 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: Handling of Mobility Policy Manager notifications.
+*
+*/
+
+/**
+@file s60mpmnotifications.cpp
+Handling of Mobility Policy Manager notifications.
+*/
+#include <rmpm.h>
+
+#include "s60mpmnotifications.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CMPMPolicyNotifications::NewL
+// -----------------------------------------------------------------------------
+//
+CMPMPolicyNotifications* CMPMPolicyNotifications::NewL( MMPMPolicyNotificationUser& aUser, RMPM& aMpm )
+    {
+    CMPMPolicyNotifications* self = new ( ELeave ) CMPMPolicyNotifications( aUser, aMpm );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMPolicyNotifications::CMPMPolicyNotifications
+// -----------------------------------------------------------------------------
+//
+CMPMPolicyNotifications::CMPMPolicyNotifications( MMPMPolicyNotificationUser& aUser, RMPM& aMpm )
+    : CActive( EPriorityStandard ),
+      iNotificationUser( aUser ),
+      iMpm( aMpm ),
+      iCommitedToDeleteItself( EFalse )
+    {
+    CActiveScheduler::Add( this );
+    S60MCPRLOGSTRING1( "S60MCPR::CMPMPolicyNotifications<%x>::CMPMPolicyNotifications()", this )
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMPolicyNotifications::~CMPMPolicyNotifications
+// -----------------------------------------------------------------------------
+//
+CMPMPolicyNotifications::~CMPMPolicyNotifications()
+    {
+    S60MCPRLOGSTRING1( "S60MCPR::CMPMPolicyNotifications<%x>::~CMPMPolicyNotifications", this )
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMPolicyNotifications::CancelRequestAndDestroyD
+// -----------------------------------------------------------------------------
+//
+void CMPMPolicyNotifications::CancelRequestAndDestroyD( TRequestStatus* aStatus )
+    {
+    S60MCPRLOGSTRING1( "S60MCPR::CMPMPolicyNotifications<%x>::CancelRequestAndDestroyD", this )
+    iDeletedStatus = aStatus;
+    if ( iMpm.Connected() && IsActive() )
+        {
+        S60MCPRLOGSTRING1( "S60MCPR::CMPMPolicyNotifications<%x>::CancelRequestAndDestroyD Start asynch delete", this )
+        iMpm.SendCancelRequest( EMPMWaitNotification );
+        iCommitedToDeleteItself = ETrue;
+        *iDeletedStatus = KRequestPending;
+        }
+    else
+        {
+        S60MCPRLOGSTRING1( "S60MCPR::CMPMPolicyNotifications<%x>::CancelRequestAndDestroyD Delete immediately", this )
+        ASSERT( !IsActive() );
+        ASSERT( !aStatus );
+        delete this;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMPolicyNotifications::Activate
+// -----------------------------------------------------------------------------
+//
+void CMPMPolicyNotifications::Activate()
+    {
+    if ( !IsActive() )
+        {
+        S60MCPRLOGSTRING1( "S60MCPR::CMPMPolicyNotifications<%x>::Activate Wait notification", this )
+        iMpm.WaitNotification( iMsgBuffer, iStatus );
+        SetActive();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMPolicyNotifications::RunL
+// -----------------------------------------------------------------------------
+//
+void CMPMPolicyNotifications::RunL()
+    {
+    ASSERT( iMpm.Connected() );
+
+    if ( iCommitedToDeleteItself )
+        {
+        S60MCPRLOGSTRING2( "S60MCPR::CMPMPolicyNotifications<%x>::RunL Completing iDeletedStatus %d", this, KErrNone )
+        User::RequestComplete( iDeletedStatus, KErrNone );
+        delete this;
+        return;
+        }
+    // In case notification, is errored we shouldn't resubmit any request. 
+    if ( iStatus.Int() != KErrNone )
+        {
+        S60MCPRLOGSTRING2( "S60MCPR::CMPMPolicyNotifications<%x>::RunL status %d", this, iStatus.Int() )
+        return;
+        }
+    // Typically deliver the notification and resubmit a request for new one.
+    TUint8* msgBufferPtr = const_cast<TUint8*>( iMsgBuffer.Ptr() );
+    TMpmNotification* notification = 
+                          reinterpret_cast<TMpmNotification*>( msgBufferPtr );
+
+    iNotificationUser.PolicyNotification( *const_cast<TMpmNotification*>( notification ) );
+
+    S60MCPRLOGSTRING1( "S60MCPR::CMPMPolicyNotifications<%x>::RunL Wait notification", this )
+    iMpm.WaitNotification( iMsgBuffer, iStatus );
+    SetActive();
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMPolicyNotifications::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CMPMPolicyNotifications::DoCancel()
+    {
+    // Not allowed! Cancel() may cause deadlock!
+    _LIT( KPanicMsg, "CMPMPolicyNotifications::DoCancel" );
+    User::Panic( KPanicMsg, KErrNotSupported );
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/S60MCPR/src/s60mpmrequests.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,889 @@
+/*
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Handling of the MPM interface.
+ *
+*/
+
+
+/**
+ @file s60mpmrequests.cpp
+ Handling of the MPM interface.
+ */
+
+// Project includes
+#include "s60mpmrequests.h"
+#include "s60mcpr.h"
+#include "s60mpmnotifications.h"
+
+// Namespace
+using namespace S60MCPRMPMOperations;
+
+// ============================ MEMBER FUNCTIONS ===============================
+// -----------------------------------------------------------------------------
+// CMPMPolicyRequests::NewL
+// -----------------------------------------------------------------------------
+//
+CMPMPolicyRequests* CMPMPolicyRequests::NewL( MMPMPolicyNotificationUser& aUser )
+    {
+    CMPMPolicyRequests* self = new ( ELeave ) CMPMPolicyRequests();
+    CleanupStack::PushL( self );
+    self->ConstructL( aUser );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMPolicyRequests::PolicyNotification
+// -----------------------------------------------------------------------------
+//
+void CMPMPolicyRequests::PolicyNotification( TMpmNotification& aNotification )
+    {
+    if ( !iCommitedToDeleteItself )
+        {
+        S60MCPRLOGSTRING1( "S60MCPR::CMPMPolicyRequests<%x>::PolicyNotification() forwarding call tocalling MCPR", this )
+        iPolicyNotificationsUser->PolicyNotification( aNotification );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMPolicyRequests::RequestDelete
+// -----------------------------------------------------------------------------
+//
+void CMPMPolicyRequests::RequestDelete()
+    {
+    iCommitedToDeleteItself = ETrue;
+    // Either we have pending requests
+    // (we always have at least notifications if we're connected.)
+    //
+    if ( iPolicyRequests.Count() > 0 )
+        {
+        S60MCPRLOGSTRING2( "S60MCPR::CMPMPolicyRequests<%x>::RequestDelete() %d pending requests,  IssueRequest", this, iPolicyRequests.Count() )
+        IssueRequest();
+        }
+    // Or we are free to delete this.
+    //
+    else
+        {
+        S60MCPRLOGSTRING1( "S60MCPR::CMPMPolicyRequests<%x>::RequestDelete() IssueDeleteRequest", this )
+        IssueDeleteRequest();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMPolicyRequests::CMPMPolicyRequests
+// -----------------------------------------------------------------------------
+//
+CMPMPolicyRequests::CMPMPolicyRequests() :
+                                    CActive( EPriorityStandard ),
+                                    iCommitedToDeleteItself( EFalse )
+    {
+    S60MCPRLOGSTRING1( "S60MCPR::CMPMPolicyRequests<%x>::CMPMPolicyRequests()", this )
+    CActiveScheduler::Add( this );
+    iConnId = (TConnectionId)this;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMPolicyRequests::~CMPMPolicyRequests
+// -----------------------------------------------------------------------------
+//
+CMPMPolicyRequests::~CMPMPolicyRequests()
+    {
+    //LOG( ESockLog::Printf(KESockMetaConnectionTag, _L8("CMPMPolicyRequests<%x>::~CMPMPolicyRequests"), this ); )
+    S60MCPRLOGSTRING1( "S60MCPR::CMPMPolicyRequests<%x>::~CMPMPolicyRequests()", this )
+
+    __ASSERT_ALWAYS(!IsActive(), User::Panic(KS60MCprPanic, KPanicInvalidCActiveUsage));
+    __ASSERT_DEBUG(iPolicyRequests.Count() == 0, User::Panic(KS60MCprPanic, KPanicInvalidCActiveUsage));
+
+    // Clean up all objects in the list
+    // Normally there shouldn't be any.
+    TInt count = iPolicyRequests.Count();
+    for (TInt i = 0; i < count; i++)
+        {
+        S60MCPRLOGSTRING2( "S60MCPR::CMPMPolicyRequests<%x>::~CMPMPolicyRequests() deleting request %d", 
+                           this, (TInt)iPolicyRequests[i].iRequestType )
+        // Delete prefs
+        delete iPolicyRequests[i].iConnPref;
+        delete iPolicyRequests[i].iPolicyPref;
+        // PolicyRequest owns this class and can delete it.
+        // MCPR must have cancelled its activity when this happens.
+        delete iPolicyRequests[i].iUser;
+        }
+
+    // Reset the array.
+    iPolicyRequests.Close();
+
+    // Close the MPM handle 
+    if ( iMpm.Connected() )
+        {
+        S60MCPRLOGSTRING1( "S60MCPR::CMPMPolicyRequests<%x>::~CMPMPolicyRequests() closing MPM session", this )
+        iMpm.Close();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMPolicyRequests::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CMPMPolicyRequests::ConstructL( MMPMPolicyNotificationUser& aUser )
+    {
+    // Force MPMNotifications to go through CMPMPolicyRequests
+    iPolicyNotificationsUser = &aUser;
+    iPolicyNotifications = CMPMPolicyNotifications::NewL( *(MMPMPolicyNotificationUser*)this, 
+                                                          iMpm );
+    S60MCPRLOGSTRING2( "S60MCPR::CMPMPolicyRequests<%x>::ConstructL() using iPolicyNotifications<%x>", 
+                       this, iPolicyNotifications )
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMPolicyRequests::IAPConnectionStartedL
+// -----------------------------------------------------------------------------
+//
+void CMPMPolicyRequests::IAPConnectionStartedL( const TUint32 aIapId )
+    {
+    S60MCPRLOGSTRING2( "S60MCPR::CMPMPolicyRequests<%x>::IAPConnectionStartedL() IAP %d", this, aIapId )
+    CreatePolicyRequestL( EPolicyRequestIAPConnectionStarted, aIapId );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMPolicyRequests::IAPConnectionStoppedL
+// -----------------------------------------------------------------------------
+//
+void CMPMPolicyRequests::IAPConnectionStoppedL( const TUint32 aIapId )
+    {
+    S60MCPRLOGSTRING2( "S60MCPR::CMPMPolicyRequests<%x>::IAPConnectionStoppedL() IAP %d", this, aIapId )
+    CreatePolicyRequestL( EPolicyRequestIAPConnectionStopped, aIapId );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMPolicyRequests::ApplicationJoinsConnectionL
+// -----------------------------------------------------------------------------
+//
+void CMPMPolicyRequests::ApplicationJoinsConnectionL( const TUint32 aIapId )
+    {
+    // Can't use CreatePolicyRequest() here because this could
+    // be the first call to MPM.
+
+    PolicyRequest policydata = PolicyRequest();
+    policydata.iRequestType = EPolicyRequestApplicationJoinsConnection;
+    policydata.iConnId      = iConnId;
+    policydata.iIapId       = aIapId;
+
+    // Add request to array of uncompleted requests
+    iPolicyRequests.AppendL( policydata );
+
+    S60MCPRLOGSTRING2( "S60MCPR::CMPMPolicyRequests<%x>::ApplicationJoinsConnectionL() IAP %d", this, aIapId )
+    
+    // Submit it.
+    IssueRequest();
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMPolicyRequests::ApplicationLeavesConnectionL
+// -----------------------------------------------------------------------------
+//
+void CMPMPolicyRequests::ApplicationLeavesConnectionL( const TUint32 aIapId )
+    {
+    S60MCPRLOGSTRING2( "S60MCPR::CMPMPolicyRequests<%x>::ApplicationLeavesConnectionL() IAP %d", this, aIapId )
+    CreatePolicyRequestL( EPolicyRequestApplicationLeavesConnection, aIapId );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMPolicyRequests::ApplicationLeavesConnectionL
+// -----------------------------------------------------------------------------
+//
+void CMPMPolicyRequests::ApplicationConnectionEndsL()
+    {
+    // This is only a notification. Thus, if the session doesn't exist, don't create one
+    if ( !iMpm.Connected() )
+        {
+        return;
+        }
+
+    S60MCPRLOGSTRING1( "S60MCPR::CMPMPolicyRequests<%x>::ApplicationConnectionEndsL() IAP %d", this )
+    
+    PolicyRequest policydata = PolicyRequest();
+    policydata.iRequestType  = EPolicyRequestApplicationConnectionEnds;
+    policydata.iConnId       = iConnId;
+//    policydata.iIapId               = aIapId;
+    // Nothing to cleanup so it's ok to Leave in AppendL
+
+    // Add request to array of uncompleted requests
+    iPolicyRequests.AppendL( policydata );
+
+    // Submit it.
+    IssueRequest();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMPolicyRequests::RegisterPreferredIAPNotificationL
+// -----------------------------------------------------------------------------
+//
+void CMPMPolicyRequests::RegisterPreferredIAPNotificationL()
+    {
+    S60MCPRLOGSTRING1( "S60MCPR::CMPMPolicyRequests<%x>::RegisterPreferredIAPNotificationL()", this )
+
+    PolicyRequest policydata = PolicyRequest();
+    
+    policydata.iRequestType  = EPolicyRequestRegisterPrefIAPNotif;
+    policydata.iConnId       = iConnId;
+
+    // Add request to array of uncompleted requests
+    iPolicyRequests.AppendL( policydata );
+
+    // Submit it.
+    IssueRequest();
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMPolicyRequests::UnregisterPreferredIAPNotificationL
+// -----------------------------------------------------------------------------
+//
+void CMPMPolicyRequests::UnregisterPreferredIAPNotificationL()
+    {
+    // Sanity check that we're still in business. 
+    if ( !iMpm.Connected() )
+        {
+        return;
+        }
+
+    S60MCPRLOGSTRING1( "S60MCPR::CMPMPolicyRequests<%x>::UnregisterPreferredIAPNotificationL()", this )
+
+    PolicyRequest policydata = PolicyRequest();
+    
+    policydata.iRequestType  = EPolicyRequestUnregisterPrefIAPNotif;
+    policydata.iConnId       = iConnId;
+
+    // Add request to array of uncompleted requests
+    iPolicyRequests.AppendL( policydata );
+
+    // Submit it.
+    IssueRequest();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMPolicyRequests::ApplicationIgnoredTheCarrierL
+// -----------------------------------------------------------------------------
+//
+void CMPMPolicyRequests::ApplicationIgnoredTheCarrierL( const TUint32 aIapId )
+    {
+    S60MCPRLOGSTRING1( "S60MCPR::CMPMPolicyRequests<%x>::ApplicationIgnoredTheCarrierL()", this )
+    CreatePolicyRequestL( EPolicyRequestApplicationIgnoredTheCarrier, aIapId );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMPolicyRequests::ApplicationMigratesToCarrierL
+// -----------------------------------------------------------------------------
+//
+void CMPMPolicyRequests::ApplicationMigratesToCarrierL( const TUint32 aIapId )
+    {
+    S60MCPRLOGSTRING1( "S60MCPR::CMPMPolicyRequests<%x>::ApplicationMigratesToCarrierL()", this )
+    CreatePolicyRequestL( EPolicyRequestApplicationMigratesToCarrier, aIapId );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMPolicyRequests::ApplicationRejectedTheCarrierL
+// -----------------------------------------------------------------------------
+//
+void CMPMPolicyRequests::ApplicationRejectedTheCarrierL( const TUint32 aIapId )
+    {
+    S60MCPRLOGSTRING1( "S60MCPR::CMPMPolicyRequests<%x>::ApplicationRejectedTheCarrierL()", this )
+    CreatePolicyRequestL( EPolicyRequestApplicationRejectedTheCarrier, aIapId );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMPolicyRequests::ApplicationAcceptedTheCarrierL
+// -----------------------------------------------------------------------------
+//
+void CMPMPolicyRequests::ApplicationAcceptedTheCarrierL( const TUint32 aIapId)
+    {
+    S60MCPRLOGSTRING1( "S60MCPR::CMPMPolicyRequests<%x>::ApplicationAcceptedTheCarrierL()", this )
+    CreatePolicyRequestL( EPolicyRequestApplicationAcceptedTheCarrier, aIapId );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMPolicyRequests::ChooseBestIAP
+// -----------------------------------------------------------------------------
+//
+void CMPMPolicyRequests::ChooseBestIAPL( TConnPref*             aConnPref,
+                                        const TUid&             aAppUid,
+                                        TConnPref*              aPolicyPref,
+                                        MMPMPolicyRequestsUser* aUser )
+    {
+    S60MCPRLOGSTRING1( "S60MCPR::CMPMPolicyRequests<%x>::ChooseBestIAPL()", this )
+    
+    // Define policydata
+    PolicyRequest policydata = PolicyRequest();
+    policydata.iRequestType         = EPolicyRequestChooseBestIAP;
+    policydata.iConnId              = iConnId;
+    policydata.iAppUid              = aAppUid;
+
+    // Heap allocated objects
+    policydata.iConnPref            = aConnPref;
+    policydata.iPolicyPref          = aPolicyPref;
+    policydata.iUser                = aUser;
+
+    // Nothing to cleanup so it's ok to Leave in AppendL
+    // Heap allocated objects are on callers responsibility if we Leave.
+    
+    // Add it to the array of uncompleted requests
+    iPolicyRequests.AppendL( policydata );
+
+    IssueRequest();
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMPolicyRequests::CancelReselectBestIAP()
+// -----------------------------------------------------------------------------
+//
+void CMPMPolicyRequests::CancelReselectBestIAP()
+    {
+    S60MCPRLOGSTRING1( "S60MCPR::CMPMPolicyRequests<%x>::CancelReselectBestIAPL()", this )
+    ASSERT( iPolicyRequests.Count() > 0 );
+    CancelRequest( EMPMReselectBestIAP );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMPolicyRequests::CancelChooseBestIAPL()
+// -----------------------------------------------------------------------------
+//
+void CMPMPolicyRequests::CancelChooseBestIAPL()
+    {
+    S60MCPRLOGSTRING1( "S60MCPR::CMPMPolicyRequests<%x>::CancelChooseBestIAPL()", this )
+    ASSERT( iPolicyRequests.Count() > 0 );
+    CancelRequest( EMPMChooseBestIAP );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMPolicyRequests::CancelProcessError()
+// -----------------------------------------------------------------------------
+//
+void CMPMPolicyRequests::CancelProcessError()
+    {
+    S60MCPRLOGSTRING1( "S60MCPR::CMPMPolicyRequests<%x>::CancelProcessErrorL()", this )
+    ASSERT( iPolicyRequests.Count() > 0 );
+    CancelRequest( EMPMProcessError );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMPolicyRequests::ReselectIAPL()
+// -----------------------------------------------------------------------------
+//
+void CMPMPolicyRequests::ReselectIAPL( TConnPref* aPolicyPref,
+                                       MMPMPolicyRequestsUser* aUser )
+    {
+    S60MCPRLOGSTRING1( "S60MCPR::CMPMPolicyRequests<%x>::ReselectIAPL()", this )
+    //Call MPM to get the list of potential IAPs for the connection
+    //
+    PolicyRequest policydata = PolicyRequest();
+
+    policydata.iRequestType = EPolicyRequestReselectBestIAP;
+    policydata.iConnId      = iConnId;
+    policydata.iPolicyPref  = aPolicyPref;
+    policydata.iUser        = aUser;
+
+    // Add it to the array of uncompleted requests
+    iPolicyRequests.AppendL( policydata );
+
+    IssueRequest();
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMPolicyRequests::ProcessErrorL
+// -----------------------------------------------------------------------------
+//
+void CMPMPolicyRequests::ProcessErrorL( TInt& anError,
+                                        MMPMPolicyRequestsUser* aUser )
+    {
+    S60MCPRLOGSTRING2( "S60MCPR::CMPMPolicyRequests<%x>::ProcessErrorL() %d", this, anError )
+
+    // insert into array of pending policy request
+    PolicyRequest policydata = PolicyRequest();
+
+    policydata.iRequestType = EPolicyRequestProcessError;
+    policydata.iError       = anError;
+    policydata.iConnId      = iConnId;
+    policydata.iUser        = aUser;
+
+    // Add it to the array of uncompleted requests
+    iPolicyRequests.AppendL( policydata );
+
+    IssueRequest();
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMPolicyRequests::IssueDeleteRequest
+// -----------------------------------------------------------------------------
+//
+void CMPMPolicyRequests::IssueDeleteRequest()
+    {
+    ASSERT( !IsActive() );
+    // Always cancel & delete policynotifications.
+    if ( iMpm.Connected() && iPolicyNotifications->IsActive() )
+        {
+        S60MCPRLOGSTRING1( "S60MCPR::CMPMPolicyRequests<%x>::IssueDeleteRequest() Asynch", this )
+        iPolicyNotifications->CancelRequestAndDestroyD( &iStatus );
+        iPolicyNotifications = NULL;
+        SetActive();
+        }
+    else if ( iPolicyNotifications )
+        {
+        S60MCPRLOGSTRING1( "S60MCPR::CMPMPolicyRequests<%x>::IssueDeleteRequest() Immediate", this )
+        iPolicyNotifications->CancelRequestAndDestroyD();
+        iPolicyNotifications = NULL;
+        delete this;
+        }
+    else
+        {
+        S60MCPRLOGSTRING1( "S60MCPR::CMPMPolicyRequests<%x>::IssueDeleteRequest() Invalid state", this )
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMPolicyRequests::IssueRequest
+// -----------------------------------------------------------------------------
+//
+void CMPMPolicyRequests::IssueRequest()
+    {
+    //__ASSERT_ALWAYS(IsActive() || iPolicyRequests.Count() > 0,User::Panic(KNetMCprPanic, KPanicInvalidCActiveUsage));
+
+    // If we have a pending request, back off.
+    //
+    if ( IsActive() || iPolicyRequests.Count() == 0 )
+        {
+        S60MCPRLOGSTRING1( "S60MCPR::CMPMPolicyRequests<%x>::IssueRequest() Unnecessary call, back off", this )
+        return;
+        }
+    
+    if ( !iMpm.Connected() )
+        {
+        PolicyRequest policydata = PolicyRequest();
+        policydata.iRequestType  = EPolicyRequestConnect;
+        // OK because default granularity is 8 and this is done when first request arrives.
+        iPolicyRequests.Insert(policydata, 0);
+        }
+
+    S60MCPRLOGSTRING2( "S60MCPR::CMPMPolicyRequests<%x>::IssueRequest() iRequestType %d", this, (TInt)iPolicyRequests[0].iRequestType )
+    //
+    // else we submit a new one.
+    switch ( iPolicyRequests[0].iRequestType )
+        {
+        case EPolicyRequestConnect:
+            {
+            iMpm.Connect( iStatus );
+            SetActive();
+            break;
+            }
+        case EPolicyRequestChooseBestIAP:
+            {
+            //LOG(ESockLog::Printf(KESockMetaConnectionTag, _L8("\tcall MPM ChooseBestIAP")));
+            iMpm.ChooseBestIAP( ( *iPolicyRequests[0].iConnPref ),
+                                iPolicyRequests[0].iConnId,
+                                iPolicyRequests[0].iAppUid,
+                                ( *iPolicyRequests[0].iPolicyPref ),
+                                iStatus );
+            SetActive();
+            break;
+            }
+        case EPolicyRequestReselectBestIAP:
+            {
+            iMpm.ReselectBestIAP( iPolicyRequests[0].iConnId,
+                                  ( *iPolicyRequests[0].iPolicyPref ),
+                                  iStatus );
+            SetActive();
+            break;
+            }
+        case EPolicyRequestIAPConnectionStarted:
+            {
+            iMpm.IAPConnectionStarted( iPolicyRequests[0].iIapId,
+                                       iPolicyRequests[0].iConnId,
+                                       iStatus );
+            SetActive();
+            break;
+            }
+        case EPolicyRequestIAPConnectionStopped:
+            {
+            iMpm.IAPConnectionStopped( iPolicyRequests[0].iIapId,
+                                       iPolicyRequests[0].iConnId,
+                                       iStatus );
+            SetActive();
+            break;
+            }
+        case EPolicyRequestApplicationJoinsConnection:
+            {
+            iMpm.ApplicationJoinsConnection( iPolicyRequests[0].iIapId,
+                                             iPolicyRequests[0].iConnId,
+                                             iStatus );
+            SetActive();
+            break;
+            }
+        case EPolicyRequestApplicationLeavesConnection:
+            {
+            iMpm.ApplicationLeavesConnection( iPolicyRequests[0].iIapId,
+                                              iPolicyRequests[0].iConnId,
+                                              iStatus );
+            SetActive();
+            break;
+            }
+        case EPolicyRequestApplicationConnectionEnds:
+            {
+            iMpm.ApplicationConnectionEnds( iPolicyRequests[0].iConnId,
+                                            iStatus );
+            SetActive();
+            break;
+            }
+        case EPolicyRequestRegisterPrefIAPNotif:
+            {
+            iMpm.RegisterPrefIAPNotif( iPolicyRequests[0].iConnId,
+                                       iStatus );
+            SetActive();
+            break;
+            }
+        case EPolicyRequestUnregisterPrefIAPNotif:
+            {
+            iMpm.UnregisterPrefIAPNotif( iPolicyRequests[0].iConnId,
+                                         iStatus );
+            SetActive();
+            break;
+            }
+        case EPolicyRequestApplicationIgnoredTheCarrier:
+            {
+            iMpm.ApplicationIgnoredTheCarrier( iPolicyRequests[0].iIapId,
+                                               iPolicyRequests[0].iConnId,
+                                               iStatus );
+            SetActive();
+            break;
+            }
+        case EPolicyRequestApplicationMigratesToCarrier:
+            {
+            iMpm.ApplicationMigratesToCarrier( iPolicyRequests[0].iIapId,
+                                               iPolicyRequests[0].iConnId,
+                                               iStatus );
+            SetActive();
+            break;
+            }
+        case EPolicyRequestApplicationRejectedTheCarrier:
+            {
+            iMpm.ApplicationRejectedTheCarrier( iPolicyRequests[0].iIapId,
+                                                iPolicyRequests[0].iConnId,
+                                                iStatus );
+            SetActive();
+            break;
+            }
+        case EPolicyRequestApplicationAcceptedTheCarrier:
+            {
+            iMpm.ApplicationAcceptedTheCarrier( iPolicyRequests[0].iIapId,
+                                                iPolicyRequests[0].iConnId,
+                                                iStatus );
+            SetActive();
+            break;
+            }
+        case EPolicyRequestProcessError:
+            {
+            //LOG(ESockLog::Printf(KESockMetaConnectionTag, _L8("\tcall MPM ProcessError")));
+            iMpm.ProcessError( iPolicyRequests[0].iError, 
+                               iPolicyRequests[0].iConnId,
+                               iPolicyRequests[0].iNeededAction, 
+                               iStatus );
+            SetActive();
+            break;
+            }
+        default:
+            {
+#ifdef _DEBUG
+            // In debug builds, panic
+            _LIT( KPanicMsg, "CMPMPolicyRequests::IssueRequestL: Invalid case" );
+            User::Panic( KPanicMsg, KErrNotSupported );
+#endif
+            break;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMPolicyRequests::RunL
+// -----------------------------------------------------------------------------
+//
+void CMPMPolicyRequests::RunL()
+    {
+    S60MCPRLOGSTRING2( "S60MCPR::CMPMPolicyRequests<%x>::RunL() iStatus %d", this, iStatus.Int() )
+
+    // If there's a request waiting and is now completed
+    //
+    if ( iPolicyRequests.Count() > 0 && !iCommitedToDeleteItself)
+        {
+        S60MCPRLOGSTRING1( "S60MCPR::CMPMPolicyRequests<%x>::RunL() Standard processing", this )
+        PolicyRequest& policydata = iPolicyRequests[0];
+        // Process the response
+        //
+        switch ( policydata.iRequestType )
+            {
+            case EPolicyRequestConnect:
+                {
+                if ( iStatus.Int() != KErrNone )
+                    {
+                    //-jl- MPM connection failed, set MPM connection required again.
+                    iMpm.Close();
+                    //-jl- Go to RunError
+                    User::Leave( iStatus.Int() );
+                    }
+                else
+                    {
+                    // Otherwise MPM ok and start listening for notifications
+                    iPolicyNotifications->Activate();
+                    }
+                break;
+                }
+            case EPolicyRequestProcessError:
+            case EPolicyRequestChooseBestIAP:
+            case EPolicyRequestReselectBestIAP:
+                {
+                if ( policydata.iUser )
+                    {
+                    // ChooseBest IAP is completed by iUser.
+                    //
+                    policydata.iStatus = iStatus.Int();
+                    policydata.iUser->PolicyResponse( policydata );
+                    }
+                break;
+                }
+            // With these messages we ignore the result.
+            case EPolicyRequestRegisterPrefIAPNotif:
+            case EPolicyRequestUnregisterPrefIAPNotif:
+            case EPolicyRequestApplicationIgnoredTheCarrier:
+            case EPolicyRequestApplicationMigratesToCarrier:
+            case EPolicyRequestApplicationRejectedTheCarrier:
+            case EPolicyRequestApplicationAcceptedTheCarrier:
+            case EPolicyRequestIAPConnectionStarted:
+            case EPolicyRequestIAPConnectionStopped:
+            case EPolicyRequestApplicationJoinsConnection:
+            case EPolicyRequestApplicationLeavesConnection:
+            case EPolicyRequestApplicationConnectionEnds:
+                {
+#ifdef _DEBUG                
+                if ( iStatus.Int() != KErrNone )
+                    {
+                    S60MCPRLOGSTRING3( "S60MCPR::CMPMPolicyRequests<%x>::RunL() Request %d failed %d", 
+                                       this, (TInt) policydata.iRequestType, iStatus.Int() )
+                    }
+#endif // _DEBUG
+                break;
+                }
+            default:
+                {
+#ifdef _DEBUG
+                // In debug builds, panic
+                _LIT( KPanicMsg, "CMPMPolicyRequests::RunL: Invalid case" );
+                User::Panic( KPanicMsg, KErrNotSupported );
+#endif
+                break;
+                }
+            }
+        // Then cleanup
+        //
+        policydata.Cleanup();
+        iPolicyRequests.Remove( 0 ); // remove request from the array
+        // And if there are still pending request, cotinue with the next one
+        //
+        if ( iPolicyRequests.Count() > 0 )
+             {
+             IssueRequest();
+             }
+        }
+    // We have pending requests but we have commited to delete itself
+    // 
+    else if ( iPolicyRequests.Count() > 0 && iCommitedToDeleteItself )
+        {
+        S60MCPRLOGSTRING1( "S60MCPR::CMPMPolicyRequests<%x>::RunL() Processing pending requests before delete", this )
+        // Submit pending requests to keep MPM in consistent state.
+        // First cleanup the old one
+        //
+        iPolicyRequests[0].Cleanup();
+        iPolicyRequests.Remove( 0 ); // remove request from the array
+        // And if there are still pending request, cotinue with the next one
+        //
+        if ( iPolicyRequests.Count() > 0 )
+            {
+            IssueRequest();
+            }
+        // In this case we've processed everything and can close.
+        //
+        else
+            {
+            IssueDeleteRequest();
+            }
+        }
+    else if ( iPolicyRequests.Count() == 0 && iCommitedToDeleteItself )
+        {
+        S60MCPRLOGSTRING1( "S60MCPR::CMPMPolicyRequests<%x>::RunL() About to delete itself", this )
+        ASSERT( !iPolicyNotifications );
+        delete this;
+        }
+    else
+        {
+        // INVALID STATE
+#ifdef _DEBUG
+        // In debug builds, panic
+        _LIT( KPanicMsg, "CMPMPolicyRequests::RunL: Invalid state" );
+        User::Panic( KPanicMsg, KErrNotSupported );
+#endif
+        // Even still, make sure we don't leak memory 
+        //
+        iPolicyNotifications->CancelRequestAndDestroyD();
+        iPolicyNotifications = NULL;
+        delete this;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMPolicyRequests::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CMPMPolicyRequests::DoCancel()
+    {
+    // Not allowed! Cancel() may cause deadlock!
+    _LIT( KPanicMsg, "CMPMPolicyRequests::DoCancel" );
+    User::Panic( KPanicMsg, KErrNotSupported );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMPolicyRequests::RunError
+// -----------------------------------------------------------------------------
+//
+TInt CMPMPolicyRequests::RunError( TInt aError )
+    {
+    S60MCPRLOGSTRING1( "S60MCPR::CMPMPolicyRequests<%x>::RunError()", this )
+    // Connect has failed, cleanup and deliver errors
+    TInt count = iPolicyRequests.Count();
+    for ( TInt i = 0; i < count; i++ )
+        {
+        if ( iPolicyRequests[i].iUser )
+            {
+            S60MCPRLOGSTRING2( "S60MCPR::CMPMPolicyRequests<%x>::RunError() Sending error %d in PolicyResponse", this, aError )
+            iPolicyRequests[i].iStatus = aError;
+            iPolicyRequests[i].iUser->PolicyResponse( iPolicyRequests[i] );
+            }
+        
+        // Delete prefs
+        iPolicyRequests[i].Cleanup();
+        }
+    iPolicyRequests.Reset();
+
+    return KErrNone;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMPolicyRequests::CancelRequest
+// -----------------------------------------------------------------------------
+//
+void CMPMPolicyRequests::CancelRequest( TMpmAsynchCodes aRequestCode )
+    {
+    // Semantics of asynchronous cancellations:
+    //
+    // The biggest difference is that asynchronous cancellation will
+    // cause RunL() -call for original request. Because of this the 
+    // PolicyResponse() calls must be prevented.
+    //
+    // Asynch Cancellation cannot be queued along with the other requests.
+    // Precondition for cancellation call to MPM is that there's an active request
+    // and that request code matches to the given parameter.
+    //
+    // Cancellation of the unsent requests is simple. Just remove it from the queue.
+    //
+    // Asynchronous cancellation adds message to MPMServer's IPC queue but since we
+    // queue all requests we can safely always call the SendCancelRequest()
+    
+    // If the cancelled request is the active one.
+    //
+    S60MCPRLOGSTRING2( "S60MCPR::CMPMPolicyRequests<%x>::CancelRequest() %d", this, (TInt)aRequestCode )
+    if ( iPolicyRequests[0].iRequestType == aRequestCode )
+        {
+        // Cancel the query if active
+        //
+        if ( IsActive() )
+            {
+            S60MCPRLOGSTRING1( "S60MCPR::CMPMPolicyRequests<%x>::CancelRequest() Cancelling active request", this )
+#ifdef _DEBUG
+            TInt ret = iMpm.SendCancelRequest( aRequestCode );
+#else
+            iMpm.SendCancelRequest( aRequestCode );
+#endif
+            __ASSERT_DEBUG( ret == KErrNone,  User::Panic( KS60MCprPanic, ret ) );
+            // Prevent the callback.
+            iPolicyRequests[0].Cancel();
+            }
+        // Completed or not started. Just remove the request.
+        //
+        else
+            {
+            S60MCPRLOGSTRING1( "S60MCPR::CMPMPolicyRequests<%x>::CancelRequest() Cancelling non-active request", this )
+            iPolicyRequests[0].Cleanup();
+            // remove it.
+            iPolicyRequests.Remove(0);
+            }
+        }
+    // Else we need to find it from the queue
+    //
+    else 
+        {
+        S60MCPRLOGSTRING1( "S60MCPR::CMPMPolicyRequests<%x>::CancelRequest() Cancelling pending request", this )
+        TInt count = iPolicyRequests.Count();
+        for (TInt i = 1; i < count; i++)
+            {
+            if ( iPolicyRequests[i].iRequestType == aRequestCode )
+                {
+                // Cancellable request found, clean it up
+                iPolicyRequests[i].Cleanup();
+                // remove it.
+                iPolicyRequests.Remove(i);
+                break; // first occurence is enough.
+                }
+            }
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMPolicyRequests::CreatePolicyRequestL
+// -----------------------------------------------------------------------------
+//
+void CMPMPolicyRequests::CreatePolicyRequestL( TPolicyServerOperations aRequestCode, 
+                                               const TUint32& aIapId )
+    {
+    // Sanity check that we're still in business. 
+    if ( !iMpm.Connected() )
+        {
+        return;
+        }
+
+    PolicyRequest policydata = PolicyRequest();
+    
+    policydata.iRequestType         = aRequestCode;
+    policydata.iConnId              = iConnId;
+    policydata.iIapId               = aIapId;
+
+    // Add request to array of uncompleted requests
+    iPolicyRequests.AppendL( policydata );
+
+    // Submit it.
+    IssueRequest();
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/S60MCPR/src/s60tcprecvwin.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,177 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: S60Mcpr's implementation of the TCP receive window interface.
+ * Reads the receive window sizes from Central repository.
+ *
+ */
+
+/**
+ @file s60tcprecvwin.cpp
+ S60 MCPR's TCP receive window interface.
+ */
+
+#include <e32base.h>
+#include <es_sock.h>
+
+#include "s60tcprecvwin.h"
+
+#include <networking/cfbearers.h>
+#include <centralrepository.h>
+#include <comms-infras/metatype.h>
+
+const TUint KDefaultTcpRecvWinGprs = 32768;
+const TUint KDefaultTcpRecvWinEGprs = 32768;
+const TUint KDefaultTcpRecvWinUmts = 32768;
+const TUint KDefaultTcpRecvWinHsdpa = 131070;
+const TUint KDefaultTcpRecvWinWlan = 98302;
+const TUint KDefaultTcpRecvWinEthernet = 65535;
+
+using namespace ESock;
+
+// -----------------------------------------------------------------------------
+// CS60TCPReceiveWindowSize::CS60TCPReceiveWindowSize
+// -----------------------------------------------------------------------------
+//
+CS60TCPReceiveWindowSize::CS60TCPReceiveWindowSize() :
+    CTCPReceiveWindowSize()
+    {
+    //  Populate TCP window lookup table.
+    Init();
+    }
+
+// -----------------------------------------------------------------------------
+// CS60TCPReceiveWindowSize::Init
+// -----------------------------------------------------------------------------
+//
+void CS60TCPReceiveWindowSize::Init()
+    {
+    TInt err = KErrNone;
+    CRepository* repository = NULL;
+
+    // No need to use CleanupStack because no possibility to leave
+    TRAP( err, repository = CRepository::NewL( KCRUIDTcpWindowSizes ) );
+
+    if ( err != KErrNone )
+        {
+        //TCP receive window size for GPRS
+        iBearerInfoMap.Insert( KGprsBearer, KDefaultTcpRecvWinGprs );
+        //TCP receive window size for EGPRS
+        iBearerInfoMap.Insert( KEGprsBearer, KDefaultTcpRecvWinEGprs );
+        //TCP receive window size for UMTS
+        iBearerInfoMap.Insert( KUmtsBearer, KDefaultTcpRecvWinUmts );
+        //TCP receive window size for HSDPA
+        iBearerInfoMap.Insert( KHsdpaBearer, KDefaultTcpRecvWinHsdpa );
+        //TCP receive window size for WLAN
+        iBearerInfoMap.Insert( KWlanBearer, KDefaultTcpRecvWinWlan );
+        //TCP receive window size for ethernet
+        iBearerInfoMap.Insert( KEthernetBearer, KDefaultTcpRecvWinEthernet );
+        //TCP receive window size for other bearer
+        iBearerInfoMap.Insert( KDefaultBearer, KBearerDefaultWinSize );
+        }
+    else
+        {
+        SetInfoMapValue( KGprsBearer, repository, KDefaultTcpRecvWinGprs );
+        SetInfoMapValue( KEGprsBearer, repository, KDefaultTcpRecvWinEGprs );
+        SetInfoMapValue( KUmtsBearer, repository, KDefaultTcpRecvWinUmts );
+        SetInfoMapValue( KHsdpaBearer, repository, KDefaultTcpRecvWinHsdpa );
+        SetInfoMapValue( KWlanBearer, repository, KDefaultTcpRecvWinWlan );
+        SetInfoMapValue( KEthernetBearer, repository, KDefaultTcpRecvWinEthernet );
+        SetInfoMapValue( KDefaultBearerKey, repository, KBearerDefaultWinSize );
+        }
+    delete repository;
+    }
+
+// -----------------------------------------------------------------------------
+// CS60TCPReceiveWindowSize::SetInfoMapValue
+// -----------------------------------------------------------------------------
+//
+void CS60TCPReceiveWindowSize::SetInfoMapValue( TUint aKey,
+                                                CRepository* aRepository,
+                                                TInt aDefaultWin )
+    {
+    // Set an information map value to an element found in
+    // the central repository
+    TInt err = KErrNone;
+    TInt win_size = 0;
+
+    err = aRepository->Get( aKey, win_size );
+    if ( err != KErrNone || win_size <= 0 )
+        {
+        win_size = aDefaultWin;
+        }
+    iBearerInfoMap.Insert( aKey, win_size );
+    }
+
+// -----------------------------------------------------------------------------
+// CS60TCPReceiveWindowSize::SetTcpWin
+// -----------------------------------------------------------------------------
+//
+void CS60TCPReceiveWindowSize::SetTcpWin( TUint aBearerType )
+    {
+    //Set the TCP Receive Window.
+    TUint* i;
+    i = static_cast<TUint*> ( iBearerInfoMap.Find( aBearerType ) );
+    if ( i )
+        {
+        iWinSize = *i;
+        }
+    else
+        {
+        iWinSize = KBearerDefaultWinSize;
+        }
+    //Set the Max TCP receive Window.
+    SetMaxWinSize( aBearerType );
+    }
+
+// -----------------------------------------------------------------------------
+// CS60TCPReceiveWindowSize::SetMaxWinSize
+// -----------------------------------------------------------------------------
+//
+void CS60TCPReceiveWindowSize::SetMaxWinSize( TUint aBearerType )
+    {
+    switch ( aBearerType )
+        {
+        case KGprsBearer:
+        case KEGprsBearer:
+        case KUmtsBearer:
+        case KHsdpaBearer:
+            iMaxWinSize = *static_cast<TUint*> ( iBearerInfoMap.Find( KHsdpaBearer ) );
+            break;
+        case KWlanBearer:
+            iMaxWinSize = *static_cast<TUint*> ( iBearerInfoMap.Find( KWlanBearer ) );
+            break;
+        case KEthernetBearer:
+        case KDefaultBearer:
+        default:
+            iMaxWinSize = KBearerDefaultMaxWinSize;
+            break;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CS60TCPReceiveWindowSize::~CS60TCPReceiveWindowSize
+// -----------------------------------------------------------------------------
+//
+CS60TCPReceiveWindowSize::~CS60TCPReceiveWindowSize()
+    {
+    iBearerInfoMap.Close();
+    }
+
+// Register the variables of TCP receive window class,
+// since it derives from SMetaData class
+START_ATTRIBUTE_TABLE(CTCPReceiveWindowSize,CTCPReceiveWindowSize::ERealmId, CTCPReceiveWindowSize::iId)
+  REGISTER_ATTRIBUTE(CTCPReceiveWindowSize, iMaxWinSize, TMetaNumber)
+  REGISTER_ATTRIBUTE(CTCPReceiveWindowSize, iWinSize, TMetaNumber)
+END_ATTRIBUTE_TABLE()
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/S60MCPR/src/s60tiermanager.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,94 @@
+/*
+* Copyright (c) 2008 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: S60 IP TM implementation
+*
+*/
+
+/**
+@file s60tiermanager.cpp
+S60 IP TM implementation
+*/
+
+#define SYMBIAN_NETWORKING_UPS
+
+#include <comms-infras/ss_log.h>
+#include <comms-infras/coretiermanagerstates.h>
+#include <comms-infras/coretiermanageractivities.h>
+
+#include "s60tiermanager.h"
+#include "s60tiermanagerselector.h"
+#include "s60tmactivities.h"
+
+#ifdef SYMBIAN_TRACE_ENABLE
+    #define KS60TierMgrTag KESockMetaConnectionTag
+    // _LIT8(KS60TierMgrSubTag, "iptiermgr");
+#endif
+
+using namespace Messages;
+using namespace MeshMachine;
+using namespace ESock;
+using namespace NetStateMachine;
+
+// -----------------------------------------------------------------------------
+// CS60TierManager::NewL
+// -----------------------------------------------------------------------------
+//
+CS60TierManager* CS60TierManager::NewL( ESock::CTierManagerFactoryBase& aFactory )
+    {
+     return new (ELeave) CS60TierManager( aFactory, 
+                                          S60TierManagerActivities::S60TierManagerMap::Self() );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CS60TierManager::CS60TierManager
+// -----------------------------------------------------------------------------
+//
+CS60TierManager::CS60TierManager( ESock::CTierManagerFactoryBase& aFactory,
+                                  const MeshMachine::TNodeActivityMap& aActivityMap )
+    :    CCoreTierManager( aFactory, aActivityMap )
+    {
+    LOG_NODE_CREATE(KS60TierMgrTag, CS60TierManager);
+    }
+
+// -----------------------------------------------------------------------------
+// CS60TierManager::~CS60TierManager
+// -----------------------------------------------------------------------------
+//
+CS60TierManager::~CS60TierManager()
+    {
+    LOG_NODE_DESTROY(KS60TierMgrTag, CS60TierManager);
+    }
+
+// -----------------------------------------------------------------------------
+// CS60TierManager::DoCreateProviderSelectorL
+// -----------------------------------------------------------------------------
+//
+MProviderSelector* CS60TierManager::DoCreateProviderSelectorL( const Meta::SMetaData& aSelectionPreferences )
+    {
+    return TS60ProviderSelectorFactory::NewSelectorL( aSelectionPreferences );
+    }
+
+// -----------------------------------------------------------------------------
+// CS60TierManager::ReceivedL
+// -----------------------------------------------------------------------------
+//
+void CS60TierManager::ReceivedL( const TRuntimeCtxId& aSender, 
+                                 const TNodeId& aRecipient, 
+                                 TSignatureBase& aMessage )
+    {
+    TNodeContext<CS60TierManager> ctx( *this, aMessage, aSender, aRecipient );
+    CCoreTierManager::Received( ctx );
+    User::LeaveIfError( ctx.iReturn );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/S60MCPR/src/s60tiermanagerfactory.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 2008 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: S60 IP TM factory implementation
+*
+*/
+
+
+/**
+@file s60tiermanagerfactory.cpp
+S60 IP TM factory implementation
+*/
+
+#include <comms-infras/ss_log.h>
+
+#include "s60tiermanagerfactory.h"
+#include "s60tiermanager.h"
+
+#ifdef __CFLOG_ACTIVE
+#define KS60TierMgrFactoryTag KESockMetaConnectionTag
+_LIT8(KS60TierMgrSubTag, "s60tiermanager");
+#endif // __CFLOG_ACTIVE
+
+using namespace ESock;
+
+// -----------------------------------------------------------------------------
+// CS60TierManagerFactory::NewL
+// -----------------------------------------------------------------------------
+//
+CS60TierManagerFactory* CS60TierManagerFactory::NewL(TAny* aParentContainer)
+    {
+    __CFLOG_VAR((KS60TierMgrFactoryTag, KS60TierMgrSubTag, _L8("S60MCPR::CS60TierManagerFactory::\tNewL(%08x)"), aParentContainer));
+     return new (ELeave) CS60TierManagerFactory(
+		 TUid::Uid(CS60TierManagerFactory::iTypeId),
+		 TUid::Uid(CS60TierManagerFactory::iUid),
+		 *(reinterpret_cast<CTierManagerFactoryContainer*>(aParentContainer)) );
+    }
+
+// -----------------------------------------------------------------------------
+// CS60TierManagerFactory::CS60TierManagerFactory
+// -----------------------------------------------------------------------------
+//
+CS60TierManagerFactory::CS60TierManagerFactory( TUid aTierTypeId, TUid aFactoryUid, CTierManagerFactoryContainer& aParentContainer )
+    :   CTierManagerFactoryBase( aTierTypeId, aFactoryUid, aParentContainer )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CS60TierManagerFactory::DoCreateObjectL
+// -----------------------------------------------------------------------------
+//
+ESock::ACommsFactoryNodeId* CS60TierManagerFactory::DoCreateObjectL(ESock::TFactoryQueryBase& /* aQuery */)
+    {
+    return CS60TierManager::NewL(*this);
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/S60MCPR/src/s60tiermanagerselector.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,228 @@
+/*
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: S60 IP TM selector implementation
+*
+*/
+
+/**
+@file s60tiermanagerselector.cpp
+S60 IP TM selector implementation
+*/
+
+#include <comms-infras/ss_log.h>
+#include <comms-infras/ss_tiermanagerutils.h>
+#include <commsdattypesv1_1.h> // CommsDat
+#include <es_connpref.h>    //TConnIdList
+#include <commdbconnpref.h>
+#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include <commsdattypeinfov1_1_internal.h>
+#include <commsdattypesv1_1_partner.h> 
+#endif
+
+#include "s60tiermanagerselector.h"
+#include "s60tiermanagerfactory.h"
+#include "s60mcpr.h"
+
+using namespace ESock;
+using namespace CommsDat;
+
+// -----------------------------------------------------------------------------
+// IpProto Tier Manager's UID.
+// Since meaning of the selection policy id changes with
+// the legacy flavor it is difficult to derive the next layer
+// tier's id dynamically when supporting all of the legacy scenarios.
+// At the same time it is known that for all of these legacy
+// setups this is and always will be the only next layer tier manager.
+// -----------------------------------------------------------------------------
+static const TUid KLegacyNextLayerTierId = { 0x10281DF0 }; //CIPProtoTierManagerFactory::iUid
+
+#ifdef __CFLOG_ACTIVE
+#define KS60TierMgrTag KESockMetaConnectionTag
+_LIT8(KS60TierMgrSubTag, "netmcpr");
+#endif
+
+//Panic codes
+#ifdef _DEBUG
+_LIT(KS60SelectorPanic, "S60TMSelector");
+enum TS60SelectorPanic
+    {
+    EExpectedAccessPointAwareSystem = 0,     //
+    EUnExpectedSelectionPreferences = 1,
+    };
+#endif // _DEBUG
+
+// -----------------------------------------------------------------------------
+// CSimpleS60SelectorBase::CSimpleS60SelectorBase
+// -----------------------------------------------------------------------------
+//
+CSimpleS60SelectorBase::CSimpleS60SelectorBase( const Meta::SMetaData& aSelectionPreferences )
+    :    ASimpleSelectorBase( aSelectionPreferences )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CSimpleS60SelectorBase::~CSimpleS60SelectorBase
+// -----------------------------------------------------------------------------
+//
+CSimpleS60SelectorBase::~CSimpleS60SelectorBase()
+    {
+    }
+    
+// -----------------------------------------------------------------------------
+// CSimpleS60SelectorBase::SelectL
+// -----------------------------------------------------------------------------
+//
+void CSimpleS60SelectorBase::SelectL( ISelectionNotify& aSelectionNotify )
+    {
+    ASSERT(iDbs);
+    ASSERT(iTierRecord);
+
+    // Default access point is required as it will point the correct node UIDs for the next layer.
+    iDefaultAp = iTierRecord->iDefaultAccessPoint;
+    //Since we do not understand the preferences, we create a provider based on a default Access Point,
+    //like in the implicit case, but we also pass the preferences down.
+    __CFLOG_VAR((KS60TierMgrTag, KS60TierMgrSubTag, _L8("S60MCPR::CSimpleS60SelectorBase %08x::\tSelectL() Using Default AP:%d"),this,iDefaultAp));
+
+    //Legacy Attach -case handling is in NetMCPR and IPProtoTM
+    // 399 Attach is not supported
+    const TConnPref& prefs = iSelectionPrefs.Prefs();
+    switch ( prefs.ExtensionId() )
+        {
+        case TConnPref::EConnPrefCommDbMulti:
+            {
+            // Sanity check.
+            TCommDbMultiConnPref& multiPrefs = TCommDbMultiConnPref::Cast( prefs );
+            TCommDbConnPref connpref;
+            TInt error = multiPrefs.GetPreference( 1, connpref );
+            // if bad connpref
+            if ( error != KErrNone )
+                {
+                User::Leave( error );
+                }
+            //else ok. MPM handles the TConnPref parsing.
+            break;
+            }
+        case TConnPref::EConnPrefUnknown: // same as IsEmpty() == ETrue
+        case TConnPref::EConnPrefCommDb:
+        case TConnPref::EConnPrefSnap:
+            {
+            // Supported. MPM handles the parsing.
+            break;
+            }
+        case TConnPref::EConnPrefIdList:
+        case TConnPref::EConnPrefSip:
+        case TConnPref::EConnPrefProviderInfo:
+        default:
+            {
+            // Unsupported
+            User::Leave( KErrNotSupported );
+            break;
+            }
+        }
+    // We do the default behavior. AP is only needed to get proper UIds for TM etc..
+    // TODO: change to use AP.
+    aSelectionNotify.SelectComplete( this, FindOrCreateProviderL( iDefaultAp ));
+    aSelectionNotify.SelectComplete( this, NULL );
+    }
+    
+// -----------------------------------------------------------------------------
+// CSimpleS60SelectorBase::FindOrCreateProviderL
+// -----------------------------------------------------------------------------
+//
+CMetaConnectionProviderBase* CSimpleS60SelectorBase::FindOrCreateProviderL( TUint aAccessPoint )
+    {
+    ASSERT(aAccessPoint); //Should not be 0 now.
+
+    //Find factory
+    TUid mCprUid = TierManagerUtils::ReadMCprUidL( aAccessPoint, *iDbs );
+    CMetaConnectionProviderFactoryBase* factory = 
+        static_cast<CMetaConnectionProviderFactoryBase*>(iMetaContainer.FindOrCreateFactoryL( mCprUid ));
+
+    //Create the provider
+    TUid tierId = TUid::Uid( iTierRecord->iRecordTag );
+	TProviderInfo providerInfo( tierId, aAccessPoint );
+	TUid tierImplUid = TierManagerUtils::MapTierIdtoTierImplIdL(tierId,*iDbs);
+    TMetaConnectionFactoryQuery query( providerInfo, tierImplUid );
+    
+    //We are not looking for an existing provider, we always create a new one.
+    //This is the legacy selection (can also be the legacy attach, one layer deep selection)
+    CMetaConnectionProviderBase* provider = static_cast<CMetaConnectionProviderBase*>( factory->CreateObjectL( query ));
+    CS60MetaConnectionProvider* prov = static_cast<CS60MetaConnectionProvider*>( provider );
+    
+    CleanupStack::PushL( provider );
+    
+    // Provision selection preferences to S60 NetMCPR.
+    prov->SetSelectionPrefs( iSelectionPrefs );
+
+    // Change the provider info so that this provider is never found by other selections
+    const TProviderInfo& pi = provider->ProviderInfo();
+    provider->SetProviderInfo( TProviderInfo( pi.TierId(), pi.APId(), provider )); //This provider will never be found
+    
+    // Override the selection policy as we always do for legacy prefs
+    ASSERT(provider->AccessPointConfig().FindExtension(TOverridenSelectionPrefsExt::TypeId())==NULL);
+
+	RMetaExtensionContainer mec;
+	mec.Open(provider->AccessPointConfig());
+	CleanupClosePushL(mec);
+	
+    TOverridenSelectionPrefsExt* ext = new (ELeave) TOverridenSelectionPrefsExt( KLegacyNextLayerTierId, iSelectionPrefs );
+    CleanupStack::PushL( ext );
+    mec.AppendExtensionL( ext ); //The ownership of the extension goes to AccessPointConfig now.
+    CleanupStack::Pop( ext );
+
+	provider->AccessPointConfig().Close();
+	provider->AccessPointConfig().Open(mec);
+	CleanupStack::PopAndDestroy(&mec);
+	
+    CleanupStack::Pop( provider );
+    provider->IncrementBlockingDestroy();
+    return provider;
+    }
+
+// -----------------------------------------------------------------------------
+// TS60ProviderSelectorFactory::NewSelectorL
+// -----------------------------------------------------------------------------
+//
+MProviderSelector* TS60ProviderSelectorFactory::NewSelectorL(const Meta::SMetaData& aSelectionPreferences)
+    {
+    __CFLOG_VAR((KS60TierMgrTag, KS60TierMgrSubTag, _L8("S60MCPR::CS60ProviderSelectorBase::\tNewSelectorL()")));
+    ASSERT(aSelectionPreferences.IsTypeOf(TSelectionPrefs::TypeId()));
+    //const ESock::TSelectionPrefs& sp = static_cast<const ESock::TSelectionPrefs&>(aSelectionPreferences);
+    ASimpleSelectorBase* self = NULL;
+    CBase* selfCleanupItem = NULL;
+    CMDBSession* dbs = CMDBSession::NewLC(KCDVersion1_2);
+
+    // Reveal hidden or private IAP records if a licensee has chosen to protect a record
+    // using one of these flags - the API to do this is public so internal components
+    // have to support the use of such records.
+    dbs->SetAttributeMask( ECDHidden | ECDPrivate );
+
+    // In all cases with S60 IP TM we want to use the S60 selector.
+    // This means that it's pointless to allow any other selector to run besides CSimpleS60SelectorBase
+    __CFLOG_VAR((KS60TierMgrTag, KS60TierMgrSubTag, _L8("S60MCPR::TIpProviderSelectorFactory::\tNewSelectorL() - Using S60 Simple Selector")));
+    CSimpleS60SelectorBase* ipSelSelf = new (ELeave) CSimpleS60SelectorBase( aSelectionPreferences );
+    selfCleanupItem = ipSelSelf;
+    self = ipSelSelf;
+
+    CleanupStack::PushL( selfCleanupItem );
+    self->iTierRecord = TierManagerUtils::LoadTierRecordL( TUid::Uid(KAfInet), *dbs );
+    __ASSERT_DEBUG(static_cast<TUint32>(self->iTierRecord->iDefaultAccessPoint)!=0,User::Panic(KS60SelectorPanic,EExpectedAccessPointAwareSystem));
+
+    CleanupStack::Pop( selfCleanupItem );
+    CleanupStack::Pop( dbs );
+    ASSERT(self->iDbs==NULL);
+    self->iDbs = dbs;
+    return self;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/S60MCPR/src/s60tmactivities.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,66 @@
+/*
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: S60 MCPR activities implementation
+*
+*/
+
+/**
+@file s60mcpractivities.cpp
+S60 MCPR activities implementation
+*/
+
+#include "s60tmactivities.h"
+
+using namespace Messages;
+using namespace MeshMachine;
+using namespace ESock;
+using namespace TMActivities;
+
+// -----------------------------------------------------------------------------
+// S60TmProviderActivitySuper
+// -----------------------------------------------------------------------------
+//
+namespace S60TmProviderActivitySuper
+{ //Simple parallel activity provider selection, waits untill selection completes (via ISelectionNotify), then gets destroyed
+    DECLARE_DEFINE_CUSTOM_NODEACTIVITY(ECFActivitySelect,
+                                       TMSelectProvider,
+                                       TCFSelector::TSelect,
+                                       CSelectProviderActivity::NewL)
+                                       
+	FIRST_NODEACTIVITY_ENTRY(TMStates::TAwaitingSelectProviderSuper,
+	                         MeshMachine::TNoTag)
+	
+	NODEACTIVITY_ENTRY(KNoTag,
+	                   S60TmProviderActivitySuper::TSelectProviderSuper,
+	                   CoreStates::TNeverAccept,
+	                   MeshMachine::TNoTag)
+	
+	LAST_NODEACTIVITY_ENTRY(KNoTag,
+	                        MeshMachine::TDoNothing)
+
+    NODEACTIVITY_END()
+}
+
+// -----------------------------------------------------------------------------
+// S60TierManagerActivities - activitymap
+// -----------------------------------------------------------------------------
+//
+namespace S60TierManagerActivities
+{
+    DEFINE_ACTIVITY_MAP(S60TierManagerMap)
+    ACTIVITY_MAP_ENTRY(S60TmProviderActivitySuper, TMSelectProvider)
+    ACTIVITY_MAP_END_BASE(TMActivities, coreTMActivities)
+}
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/S60MCPR/src/s60tmprovideractivity.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: S60 MCPR simple select activity implementation
+*
+*/
+
+/**
+@file s60mcprsimpleselectactivity.cpp
+S60 MCPR simple select activity implementation
+*/
+
+#include "s60mcpractivities.h"
+#include "s60mcprstates.h"
+#include "s60extendedtmselector.h"
+#include "s60tmactivities.h"
+
+#include <comms-infras/ss_api_ext.h>
+
+using namespace Messages;
+using namespace MeshMachine;
+using namespace ESock;
+using namespace MCprActivities;
+using namespace TMActivities;
+
+// -----------------------------------------------------------------------------
+// S60TmProviderActivitySuper
+// -----------------------------------------------------------------------------
+//
+namespace S60TmProviderActivitySuper
+    {
+    DEFINE_SMELEMENT(TSelectProviderSuper, NetStateMachine::MStateTransition, TMStates::TContext)
+    void TSelectProviderSuper::DoL() // codescanner::leave
+	    {
+	    /*__ASSERT_DEBUG(iContext.iNodeActivity, User::Panic(KCoreTMPanic, KPanicNoActivity));*/
+	    CSelectProviderActivity* act = static_cast<CSelectProviderActivity*>(iContext.iNodeActivity);
+
+	    //Creates the core selector - this selector is not required, it is always the
+	    //same selector created so the code could be moving into this transition.
+	    //The method FindOrCreateProviderL would need to be recreated somewhere else
+	    //for this to be possible (currently inherited off ASimpleSelectorBase.
+
+        act->iSelector = new (ELeave /*codescanner::leave*/) CExtendedS60SelectorBase( 
+		    iContext.Node().TierId(),
+		    message_cast<TCFSelector::TSelect>(iContext.iMessage).iConnPrefList
+		    ); 
+
+	    ISelectionNotify selectionNotify(act,act->InterfaceVTable());
+	    act->iSelector->SelectL(selectionNotify); // codescanner::leave
+	    //Do not do any further processing here as selectors may be returning synchronously (via ISelectionNotify).
+	    }
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/data/ip.providers.esk	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,3 @@
+[providers]
+subconn= IpSubConnectionProviderFactory
+connprov= BearerManProviderFactory,IpConnectionFactoryShim
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/extendedconnpref/bwins/extendedconnprefu.def	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,22 @@
+EXPORTS
+	?SetDisconnectDialog@TExtendedConnPref@@QAEXH@Z @ 1 NONAME ; void TExtendedConnPref::SetDisconnectDialog(int)
+	?SetSnapPurpose@TExtendedConnPref@@QAEXW4TSnapPurpose@CMManager@@@Z @ 2 NONAME ; void TExtendedConnPref::SetSnapPurpose(enum CMManager::TSnapPurpose)
+	?DisconnectDialog@TExtendedConnPref@@QBEHXZ @ 3 NONAME ; int TExtendedConnPref::DisconnectDialog(void) const
+	?SnapId@TExtendedConnPref@@QBEKXZ @ 4 NONAME ; unsigned long TExtendedConnPref::SnapId(void) const
+	?SetForcedRoaming@TExtendedConnPref@@QAEXH@Z @ 5 NONAME ; void TExtendedConnPref::SetForcedRoaming(int)
+	?ForcedRoaming@TExtendedConnPref@@QBEHXZ @ 6 NONAME ; int TExtendedConnPref::ForcedRoaming(void) const
+	?IapId@TExtendedConnPref@@QBEKXZ @ 7 NONAME ; unsigned long TExtendedConnPref::IapId(void) const
+	?SetBearerSet@TExtendedConnPref@@QAEXK@Z @ 8 NONAME ; void TExtendedConnPref::SetBearerSet(unsigned long)
+	?SetIapId@TExtendedConnPref@@QAEXK@Z @ 9 NONAME ; void TExtendedConnPref::SetIapId(unsigned long)
+	?ConnSelectionDialog@TExtendedConnPref@@QBEHXZ @ 10 NONAME ; int TExtendedConnPref::ConnSelectionDialog(void) const
+	?SetSnapId@TExtendedConnPref@@QAEXK@Z @ 11 NONAME ; void TExtendedConnPref::SetSnapId(unsigned long)
+	??0TExtendedConnPref@@QAE@XZ @ 12 NONAME ; TExtendedConnPref::TExtendedConnPref(void)
+	?GetAttribPtr@TExtendedConnPref@@MBEPAEH@Z @ 13 NONAME ; unsigned char * TExtendedConnPref::GetAttribPtr(int) const
+	?GetVDataTable@TExtendedConnPref@@MBEPBUSVDataTableEntry@Meta@@XZ @ 14 NONAME ; struct Meta::SVDataTableEntry const * TExtendedConnPref::GetVDataTable(void) const
+	?SetNoteBehaviour@TExtendedConnPref@@QAEXK@Z @ 15 NONAME ; void TExtendedConnPref::SetNoteBehaviour(unsigned long)
+	?GetVDataTableStatic@TExtendedConnPref@@KAPBUSVDataTableEntry@Meta@@XZ @ 16 NONAME ; struct Meta::SVDataTableEntry const * TExtendedConnPref::GetVDataTableStatic(void)
+	?NoteBehaviour@TExtendedConnPref@@QBEKXZ @ 17 NONAME ; unsigned long TExtendedConnPref::NoteBehaviour(void) const
+	?BearerSet@TExtendedConnPref@@QBEKXZ @ 18 NONAME ; unsigned long TExtendedConnPref::BearerSet(void) const
+	?SetConnSelectionDialog@TExtendedConnPref@@QAEXH@Z @ 19 NONAME ; void TExtendedConnPref::SetConnSelectionDialog(int)
+	?SnapPurpose@TExtendedConnPref@@QBE?AW4TSnapPurpose@CMManager@@XZ @ 20 NONAME ; enum CMManager::TSnapPurpose TExtendedConnPref::SnapPurpose(void) const
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/extendedconnpref/eabi/extendedconnprefu.def	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,27 @@
+EXPORTS
+	_ZN17TExtendedConnPref12SetBearerSetEm @ 1 NONAME
+	_ZN17TExtendedConnPref14SetSnapPurposeEN9CMManager12TSnapPurposeE @ 2 NONAME
+	_ZN17TExtendedConnPref16SetForcedRoamingEi @ 3 NONAME
+	_ZN17TExtendedConnPref16SetNoteBehaviourEm @ 4 NONAME
+	_ZN17TExtendedConnPref19GetVDataTableStaticEv @ 5 NONAME
+	_ZN17TExtendedConnPref19SetDisconnectDialogEi @ 6 NONAME
+	_ZN17TExtendedConnPref22SetConnSelectionDialogEi @ 7 NONAME
+	_ZN17TExtendedConnPref8SetIapIdEm @ 8 NONAME
+	_ZN17TExtendedConnPref9SetSnapIdEm @ 9 NONAME
+	_ZN17TExtendedConnPrefC1Ev @ 10 NONAME
+	_ZN17TExtendedConnPrefC2Ev @ 11 NONAME
+	_ZNK17TExtendedConnPref11SnapPurposeEv @ 12 NONAME
+	_ZNK17TExtendedConnPref12GetAttribPtrEi @ 13 NONAME
+	_ZNK17TExtendedConnPref13ForcedRoamingEv @ 14 NONAME
+	_ZNK17TExtendedConnPref13GetVDataTableEv @ 15 NONAME
+	_ZNK17TExtendedConnPref13NoteBehaviourEv @ 16 NONAME
+	_ZNK17TExtendedConnPref16DisconnectDialogEv @ 17 NONAME
+	_ZNK17TExtendedConnPref19ConnSelectionDialogEv @ 18 NONAME
+	_ZNK17TExtendedConnPref5IapIdEv @ 19 NONAME
+	_ZNK17TExtendedConnPref6SnapIdEv @ 20 NONAME
+	_ZNK17TExtendedConnPref9BearerSetEv @ 21 NONAME
+	_ZTI17TExtendedConnPref @ 22 NONAME
+	_ZTIN4Meta5TMetaIiEE @ 23 NONAME
+	_ZTV17TExtendedConnPref @ 24 NONAME
+	_ZTVN4Meta5TMetaIiEE @ 25 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/extendedconnpref/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Build info for Extended Connection Preferences interface
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../rom/extendedconnpref.iby     CORE_MW_LAYER_IBY_EXPORT_PATH(extendedconnpref.iby)
+../rom/extendedconnprefecom.iby     CORE_MW_LAYER_IBY_EXPORT_PATH(extendedconnprefecom.iby)
+
+PRJ_MMPFILES
+extendedconnpref.mmp
+extendedconnprefecom.mmp
+
+PRJ_TESTMMPFILES
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/extendedconnpref/group/extendedconnpref.mmp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Extended Connection Preferences interface library
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET            extendedconnpref.dll
+TARGETTYPE        DLL
+
+UID               0x10009D8D 0x20027034
+
+VENDORID          VID_DEFAULT
+CAPABILITY        ALL -TCB
+
+SOURCEPATH        ../src
+SOURCE            extendedconnpref.cpp
+
+MW_LAYER_SYSTEMINCLUDE 
+SYSTEMINCLUDE   /epoc32/include/ecom
+
+DEFFILE extendedconnpref.def
+
+LIBRARY           euser.lib
+LIBRARY           efsrv.lib
+LIBRARY           c32root.lib
+LIBRARY           commsfw.lib
+LIBRARY           netmeta.lib
+DEBUGLIBRARY      flogger.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/extendedconnpref/group/extendedconnprefecom.mmp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Extended Connection Preferences interface library
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET            extendedconnprefecom.dll
+TARGETTYPE        PLUGIN
+
+UID               0x10009D8D 0x2002429F
+
+VENDORID          VID_DEFAULT
+CAPABILITY        ALL -TCB
+
+SOURCEPATH        ../src
+SOURCE            extendedconnpreffactory.cpp
+
+MW_LAYER_SYSTEMINCLUDE 
+SYSTEMINCLUDE   /epoc32/include/ecom
+
+START RESOURCE 2002429F.rss
+TARGET extendedconnprefecom.rsc
+END
+
+LIBRARY           euser.lib
+LIBRARY           efsrv.lib
+LIBRARY           c32root.lib
+LIBRARY           commsfw.lib
+LIBRARY           netmeta.lib
+LIBRARY           extendedconnpref.lib
+DEBUGLIBRARY      flogger.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/extendedconnpref/rom/extendedconnpref.iby	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Extended Connection Preferences
+*
+*/
+
+
+#ifndef __EXTENDEDCONNPREF_IBY__
+#define __EXTENDEDCONNPREF_IBY__
+
+file=ABI_DIR\BUILD_DIR\extendedconnpref.dll      SHARED_LIB_DIR\extendedconnpref.dll
+
+#endif
+
+//  End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/extendedconnpref/rom/extendedconnprefecom.iby	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Extended Connection Preferences ECOM Plugin
+*
+*/
+
+
+#ifndef __EXTENDEDCONNPREFECOM_IBY__
+#define __EXTENDEDCONNPREFECOM_IBY__
+
+ECOM_PLUGIN(extendedconnprefecom.dll,extendedconnprefecom.rsc)
+
+#endif
+
+//  End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/extendedconnpref/src/2002429F.rss	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,45 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Registry info for Esock parameter plug-in
+// 
+//
+
+/**
+ @file 2002429F.RSS
+*/
+
+#include "registryinfo.rh"
+
+RESOURCE REGISTRY_INFO theInfo
+    {
+    dll_uid = 0x2002429F;
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = 0x20016A81;
+            implementations = 
+                {
+               IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x20016A82;
+                    version_no = 1;
+                    display_name = "Extended Connection Preference ECOM Plugin";
+                    default_data = "text/wml";
+                    opaque_data = "";
+                    }
+                };
+            }
+        };
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/extendedconnpref/src/extendedconnpref.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,202 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Extended Connection Preferences interface
+*
+*/
+
+
+/**
+@file extendedconnpref.cpp
+Extended Connection Preferences interface.
+*/
+
+// INCLUDE FILES
+#include "extendedconnpref.h"
+#include <comms-infras/metatype.h>
+
+EXPORT_START_ATTRIBUTE_TABLE_AND_FN( TExtendedConnPref, TExtendedConnPref::EUid, TExtendedConnPref::ETypeId )
+    REGISTER_ATTRIBUTE( TExtendedConnPref, iSnapPurpose, TMetaNumber )
+    REGISTER_ATTRIBUTE( TExtendedConnPref, iSnapId, TMetaNumber )
+    REGISTER_ATTRIBUTE( TExtendedConnPref, iIapId, TMetaNumber )
+    REGISTER_ATTRIBUTE( TExtendedConnPref, iBearerSet, TMetaNumber )
+    REGISTER_ATTRIBUTE( TExtendedConnPref, iNoteBehaviour, TMetaNumber )
+    REGISTER_ATTRIBUTE( TExtendedConnPref, iDisconnectDialog, TMetaNumber )
+    REGISTER_ATTRIBUTE( TExtendedConnPref, iConnSelectionDialog, TMetaNumber )
+    REGISTER_ATTRIBUTE( TExtendedConnPref, iForcedRoaming, TMetaNumber )
+END_ATTRIBUTE_TABLE()
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// TExtendedConnPref::NewL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TExtendedConnPref::TExtendedConnPref():
+    iSnapPurpose(CMManager::ESnapPurposeUnknown),
+    iSnapId(0),
+    iIapId(0),
+    iBearerSet( EExtendedConnBearerUnknown ),
+    iNoteBehaviour( ENoteBehaviourDefault ),
+    iDisconnectDialog( ETrue ),
+    iConnSelectionDialog( EFalse ),
+    iForcedRoaming( ETrue )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// TExtendedConnPref::SetSnapPurpose
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void TExtendedConnPref::SetSnapPurpose( CMManager::TSnapPurpose aSnapPurpose )
+    {
+    iSnapPurpose = aSnapPurpose;
+    }
+
+// -----------------------------------------------------------------------------
+// TExtendedConnPref::SnapPurpose
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CMManager::TSnapPurpose TExtendedConnPref::SnapPurpose() const
+    {
+    return iSnapPurpose;
+    }
+
+// -----------------------------------------------------------------------------
+// TExtendedConnPref::SetSnapId
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void TExtendedConnPref::SetSnapId( TUint32 aSnapId )
+    {
+    iSnapId = aSnapId;
+    }
+
+// -----------------------------------------------------------------------------
+// TExtendedConnPref::SnapId
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TUint32 TExtendedConnPref::SnapId() const
+    {
+    return iSnapId;
+    }
+
+// -----------------------------------------------------------------------------
+// TExtendedConnPref::SetIapId
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void TExtendedConnPref::SetIapId( TUint32 aIapId )
+    {
+    iIapId = aIapId;
+    }
+
+// -----------------------------------------------------------------------------
+// TExtendedConnPref::IapId
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TUint32 TExtendedConnPref::IapId() const
+    {
+    return iIapId;
+    }
+
+// -----------------------------------------------------------------------------
+// TExtendedConnPref::SetBearerSet
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void TExtendedConnPref::SetBearerSet( const TUint32 aBearerSet )
+    {
+    iBearerSet = aBearerSet;
+    }
+
+// -----------------------------------------------------------------------------
+// TExtendedConnPref::BearerSet
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TUint32 TExtendedConnPref::BearerSet() const
+    {
+    return iBearerSet;
+    }
+
+// -----------------------------------------------------------------------------
+// TExtendedConnPref::SetNoteBehaviour
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void TExtendedConnPref::SetNoteBehaviour( const TUint32 aNoteBehaviour )
+    {
+    iNoteBehaviour = aNoteBehaviour;
+    }
+
+// -----------------------------------------------------------------------------
+// TExtendedConnPref::NoteBehaviour
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TUint32 TExtendedConnPref::NoteBehaviour() const
+    {
+    return iNoteBehaviour;
+    }
+
+// -----------------------------------------------------------------------------
+// TExtendedConnPref::SetDisconnectDialog
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void TExtendedConnPref::SetDisconnectDialog( TBool aDisconnectDialog )
+    {
+    iDisconnectDialog = aDisconnectDialog;
+    }
+
+// -----------------------------------------------------------------------------
+// TExtendedConnPref::DisconnectDialog
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool TExtendedConnPref::DisconnectDialog() const
+    {
+    return iDisconnectDialog;
+    }
+
+// -----------------------------------------------------------------------------
+// TExtendedConnPref::SetConnSelectionDialog
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void TExtendedConnPref::SetConnSelectionDialog( TBool aConnSelectionDialog )
+    {
+    iConnSelectionDialog = aConnSelectionDialog;
+    }
+
+// -----------------------------------------------------------------------------
+// TExtendedConnPref::ConnSelectionDialog
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool TExtendedConnPref::ConnSelectionDialog() const
+    {
+    return iConnSelectionDialog;
+    }
+
+// -----------------------------------------------------------------------------
+// TExtendedConnPref::SetForcedRoaming
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void TExtendedConnPref::SetForcedRoaming( TBool aForcedRoaming )
+    {
+    iForcedRoaming = aForcedRoaming;
+    }
+
+// -----------------------------------------------------------------------------
+// TExtendedConnPref::ForcedRoaming
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool TExtendedConnPref::ForcedRoaming() const
+    {
+    return iForcedRoaming;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/extendedconnpref/src/extendedconnpreffactory.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,67 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include <extendedconnpref.h>
+#include <ecom/implementationproxy.h>
+#include <comms-infras/metatype.h>
+
+
+// SMetaDataECom macros
+
+
+NONSHARABLE_CLASS( CExtendedConnPrefFactory ) : public CBase
+/** Connection generic parameter set factory.
+
+@internalComponent
+*/
+    {
+public:
+    static Meta::SMetaDataECom* NewL( TAny* aConstructionParameters );
+    };
+
+const TImplementationProxy ImplementationTable[] = 
+	{
+	IMPLEMENTATION_PROXY_ENTRY(TExtendedConnPref::EUid, CExtendedConnPrefFactory::NewL),
+	};
+
+/**
+ECOM Implementation Factories
+*/
+
+// -----------------------------------------------------------------------------
+// CExtendedConnPrefFactory::NewL
+// -----------------------------------------------------------------------------
+//
+Meta::SMetaDataECom* CExtendedConnPrefFactory::NewL(TAny* aConstructionParameters)
+    {
+    TInt32 type = reinterpret_cast<TInt32>(aConstructionParameters);
+    switch (type)
+        {
+    case (TExtendedConnPref::ETypeId):
+        return new (ELeave) TExtendedConnPref;
+    default:
+        User::Leave(KErrNotFound);
+        return NULL;
+        }
+    }
+    
+//extern "C" { IMPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount); }
+
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+    {
+    aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+
+    return ImplementationTable;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build info for all Bearer Management modules.
+*
+*/
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_MMPFILES
+
+#include "../mpm/group/bld.inf"
+#include "../extendedconnpref/group/bld.inf"
+#include "../S60MCPR/group/bld.inf"
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/bwins/MPMSERVERU.DEF	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+	?WinsMain@@YAHXZ @ 1 NONAME ; int __cdecl WinsMain(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/bwins/mpmdefaultconnectionu.def	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,7 @@
+EXPORTS
+	?ClearDefaultIAP@RMPMDefaultConnection@@QAEHXZ @ 1 NONAME ; int RMPMDefaultConnection::ClearDefaultIAP(void)
+	?Close@RMPMDefaultConnection@@QAEXXZ @ 2 NONAME ; void RMPMDefaultConnection::Close(void)
+	?Connect@RMPMDefaultConnection@@QAEHXZ @ 3 NONAME ; int RMPMDefaultConnection::Connect(void)
+	?SetDefaultIAP@RMPMDefaultConnection@@QAEHH@Z @ 4 NONAME ; int RMPMDefaultConnection::SetDefaultIAP(int)
+	?Version@RMPMDefaultConnection@@QBE?AVTVersion@@XZ @ 5 NONAME ; class TVersion RMPMDefaultConnection::Version(void) const
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/bwins/mpmu.def	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,42 @@
+EXPORTS
+	?ApplicationLeavesConnection@RMPM@@QAEHKK@Z @ 1 NONAME ; int RMPM::ApplicationLeavesConnection(unsigned long, unsigned long)
+	?Cancel@RMPM@@QBEXW4TMpmAsynchCodes@@@Z @ 2 NONAME ; void RMPM::Cancel(enum TMpmAsynchCodes) const
+	?ChooseBestIAP@RMPM@@QAEXAAVTConnPref@@KVTUid@@0AAVTRequestStatus@@@Z @ 3 NONAME ; void RMPM::ChooseBestIAP(class TConnPref &, unsigned long, class TConnPref &, class TRequestStatus &)
+	?Close@RMPM@@QAEXXZ @ 4 NONAME ; void RMPM::Close(void)
+	?Connect@RMPM@@QAEHXZ @ 5 NONAME ; int RMPM::Connect(void)
+	?IAPConnectionStopped@RMPM@@QAEHKK@Z @ 6 NONAME ; int RMPM::IAPConnectionStopped(unsigned long, unsigned long)
+	?LaunchServer@RMPM@@QAEHXZ @ 7 NONAME ; int RMPM::LaunchServer(void)
+	?ProcessError@RMPM@@QAEXAAVTConnPref@@AAHKAAW4TBMNeededAction@@AAVTRequestStatus@@@Z @ 8 NONAME ; void RMPM::ProcessError(class TConnPref &, int &, unsigned long, enum TBMNeededAction &, class TRequestStatus &)
+	?RegisterPrefIAPNotif@RMPM@@QAEHABVTConnPref@@K@Z @ 9 NONAME ; int RMPM::RegisterPrefIAPNotif(class TConnPref &, unsigned long)
+	?UnregisterPrefIAPNotif@RMPM@@QAEXK@Z @ 10 NONAME ; void RMPM::UnregisterPrefIAPNotif(unsigned long)
+	?Version@RMPM@@QBE?AVTVersion@@XZ @ 11 NONAME ; class TVersion RMPM::Version(void) const
+	?WaitNotification@RMPM@@QAEXAAV?$TBuf8@$0CAA@@@AAVTRequestStatus@@@Z @ 12 NONAME ; void RMPM::WaitNotification(class TBuf8<512> &, class TRequestStatus &)
+	?SortSNAP@RMPM@@QAEHKAAVTMpmSnapBuffer@@@Z @ 13 NONAME ; int RMPM::SortSNAP(unsigned long, class TMpmSnapBuffer &)
+	?ApplicationJoinsConnection@RMPM@@QAEHKK@Z @ 14 NONAME ; int RMPM::ApplicationJoinsConnection(unsigned long, unsigned long)
+	?IAPConnectionStarted@RMPM@@QAEHKK@Z @ 15 NONAME ; int RMPM::IAPConnectionStarted(unsigned long, unsigned long)
+	?ApplicationConnectionEnds@RMPM@@QAEHK@Z @ 16 NONAME ; int RMPM::ApplicationConnectionEnds(unsigned long)
+	?ApplicationAcceptedTheCarrier@RMPM@@QAEHKK@Z @ 17 NONAME ; int RMPM::ApplicationAcceptedTheCarrier(unsigned long, unsigned long)
+	?ApplicationIgnoredTheCarrier@RMPM@@QAEHKK@Z @ 18 NONAME ; int RMPM::ApplicationIgnoredTheCarrier(unsigned long, unsigned long)
+	?ApplicationMigratesToCarrier@RMPM@@QAEHKK@Z @ 19 NONAME ; int RMPM::ApplicationMigratesToCarrier(unsigned long, unsigned long)
+	?ApplicationRejectedTheCarrier@RMPM@@QAEHKK@Z @ 20 NONAME ; int RMPM::ApplicationRejectedTheCarrier(unsigned long, unsigned long)
+	?IAPConnectionActivated@RMPM@@QAEHKK@Z @ 21 NONAME ; int RMPM::IAPConnectionActivated(unsigned long, unsigned long)
+	?EasyWlanSsid@RMPM@@QAEHABV?$TBuf8@$0CA@@@@Z @ 22 NONAME ; int RMPM::EasyWlanSsid(class TBuf8<32> const &)
+	?Connect@RMPM@@QAEXAAVTRequestStatus@@@Z @ 23 NONAME ; void RMPM::Connect(class TRequestStatus &)
+	?RegisterPrefIAPNotif@RMPM@@QAEHK@Z @ 24 NONAME ; int RMPM::RegisterPrefIAPNotif(unsigned long)
+	?UnregisterPrefIAPNotif@RMPM@@QAEXKAAVTRequestStatus@@@Z @ 25 NONAME ; void RMPM::UnregisterPrefIAPNotif(unsigned long, class TRequestStatus &)
+	?IAPConnectionStarted@RMPM@@QAEXKKAAVTRequestStatus@@@Z @ 26 NONAME ; void RMPM::IAPConnectionStarted(unsigned long, unsigned long, class TRequestStatus &)
+	?SendCancelRequest@RMPM@@QBEHW4TMpmAsynchCodes@@@Z @ 27 NONAME ; int RMPM::SendCancelRequest(enum TMpmAsynchCodes) const
+	?IAPConnectionStopped@RMPM@@QAEXKKAAVTRequestStatus@@@Z @ 28 NONAME ; void RMPM::IAPConnectionStopped(unsigned long, unsigned long, class TRequestStatus &)
+	?ProcessError@RMPM@@QAEXAAHKAAW4TBMNeededAction@@AAVTRequestStatus@@@Z @ 29 NONAME ; void RMPM::ProcessError(int &, unsigned long, enum TBMNeededAction &, class TRequestStatus &)
+	?ReselectBestIAP@RMPM@@QAEXKAAVTConnPref@@AAVTRequestStatus@@@Z @ 30 NONAME ; void RMPM::ReselectBestIAP(unsigned long, class TConnPref &, class TRequestStatus &)
+	?ApplicationRejectedTheCarrier@RMPM@@QAEXKKAAVTRequestStatus@@@Z @ 31 NONAME ; void RMPM::ApplicationRejectedTheCarrier(unsigned long, unsigned long, class TRequestStatus &)
+	?Connected@RMPM@@QAEHXZ @ 32 NONAME ; int RMPM::Connected(void)
+	?RegisterPrefIAPNotif@RMPM@@QAEXKAAVTRequestStatus@@@Z @ 33 NONAME ; void RMPM::RegisterPrefIAPNotif(unsigned long, class TRequestStatus &)
+	?ApplicationLeavesConnection@RMPM@@QAEXKKAAVTRequestStatus@@@Z @ 34 NONAME ; void RMPM::ApplicationLeavesConnection(unsigned long, unsigned long, class TRequestStatus &)
+	?ApplicationJoinsConnection@RMPM@@QAEXKKAAVTRequestStatus@@@Z @ 35 NONAME ; void RMPM::ApplicationJoinsConnection(unsigned long, unsigned long, class TRequestStatus &)
+	?ApplicationIgnoredTheCarrier@RMPM@@QAEXKKAAVTRequestStatus@@@Z @ 36 NONAME ; void RMPM::ApplicationIgnoredTheCarrier(unsigned long, unsigned long, class TRequestStatus &)
+	?ApplicationConnectionEnds@RMPM@@QAEXKAAVTRequestStatus@@@Z @ 37 NONAME ; void RMPM::ApplicationConnectionEnds(unsigned long, class TRequestStatus &)
+	?ApplicationAcceptedTheCarrier@RMPM@@QAEXKKAAVTRequestStatus@@@Z @ 38 NONAME ; void RMPM::ApplicationAcceptedTheCarrier(unsigned long, unsigned long, class TRequestStatus &)
+	?ApplicationMigratesToCarrier@RMPM@@QAEXKKAAVTRequestStatus@@@Z @ 39 NONAME ; void RMPM::ApplicationMigratesToCarrier(unsigned long, unsigned long, class TRequestStatus &)
+	?SortSNAP@RMPM@@QAEXKAAVTMpmSnapBuffer@@AAVTRequestStatus@@K@Z @ 40 NONAME ; void RMPM::SortSNAP(unsigned long, class TMpmSnapBuffer &, class TRequestStatus &, unsigned long)
+
Binary file bearermanagement/mpm/conf/mpm.confml has changed
Binary file bearermanagement/mpm/conf/mpm_101f6d12.crml has changed
Binary file bearermanagement/mpm/conf/mpm_101f6d50.crml has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/eabi/MPMU.DEF	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,42 @@
+EXPORTS
+	_ZN4RMPM12LaunchServerEv @ 1 NONAME
+	_ZN4RMPM12ProcessErrorER9TConnPrefRimR15TBMNeededActionR14TRequestStatus @ 2 NONAME
+	_ZN4RMPM13ChooseBestIAPER9TConnPrefm4TUidS1_R14TRequestStatus @ 3 NONAME
+	_ZN4RMPM16WaitNotificationER5TBuf8ILi512EER14TRequestStatus @ 4 NONAME
+	_ZN4RMPM20IAPConnectionStoppedEmm @ 5 NONAME
+	_ZN4RMPM20RegisterPrefIAPNotifERK9TConnPrefm @ 6 NONAME
+	_ZN4RMPM22UnregisterPrefIAPNotifEm @ 7 NONAME
+	_ZN4RMPM27ApplicationLeavesConnectionEmm @ 8 NONAME
+	_ZN4RMPM5CloseEv @ 9 NONAME
+	_ZN4RMPM7ConnectEv @ 10 NONAME
+	_ZNK4RMPM6CancelE15TMpmAsynchCodes @ 11 NONAME
+	_ZNK4RMPM7VersionEv @ 12 NONAME
+	_ZN4RMPM8SortSNAPEmR14TMpmSnapBuffer @ 13 NONAME
+	_ZN4RMPM20IAPConnectionStartedEmm @ 14 NONAME
+	_ZN4RMPM26ApplicationJoinsConnectionEmm @ 15 NONAME
+	_ZN4RMPM25ApplicationConnectionEndsEm @ 16 NONAME
+	_ZN4RMPM28ApplicationMigratesToCarrierEmm @ 17 NONAME
+	_ZN4RMPM28ApplicationIgnoredTheCarrierEmm @ 18 NONAME
+	_ZN4RMPM29ApplicationAcceptedTheCarrierEmm @ 19 NONAME
+	_ZN4RMPM29ApplicationRejectedTheCarrierEmm @ 20 NONAME
+	_ZN4RMPM22IAPConnectionActivatedEmm @ 21 NONAME
+	_ZN4RMPM12EasyWlanSsidERK5TBuf8ILi32EE @ 22 NONAME
+	_ZN4RMPM12ProcessErrorERimR15TBMNeededActionR14TRequestStatus @ 23 NONAME
+	_ZN4RMPM15ReselectBestIAPEmR9TConnPrefR14TRequestStatus @ 24 NONAME
+	_ZN4RMPM20IAPConnectionStartedEmmR14TRequestStatus @ 25 NONAME
+	_ZN4RMPM20IAPConnectionStoppedEmmR14TRequestStatus @ 26 NONAME
+	_ZN4RMPM20RegisterPrefIAPNotifEm @ 27 NONAME
+	_ZN4RMPM20RegisterPrefIAPNotifEmR14TRequestStatus @ 28 NONAME
+	_ZN4RMPM22UnregisterPrefIAPNotifEmR14TRequestStatus @ 29 NONAME
+	_ZN4RMPM25ApplicationConnectionEndsEmR14TRequestStatus @ 30 NONAME
+	_ZN4RMPM26ApplicationJoinsConnectionEmmR14TRequestStatus @ 31 NONAME
+	_ZN4RMPM27ApplicationLeavesConnectionEmmR14TRequestStatus @ 32 NONAME
+	_ZN4RMPM28ApplicationIgnoredTheCarrierEmmR14TRequestStatus @ 33 NONAME
+	_ZN4RMPM28ApplicationMigratesToCarrierEmmR14TRequestStatus @ 34 NONAME
+	_ZN4RMPM29ApplicationAcceptedTheCarrierEmmR14TRequestStatus @ 35 NONAME
+	_ZN4RMPM29ApplicationRejectedTheCarrierEmmR14TRequestStatus @ 36 NONAME
+	_ZN4RMPM7ConnectER14TRequestStatus @ 37 NONAME
+	_ZN4RMPM9ConnectedEv @ 38 NONAME
+	_ZNK4RMPM17SendCancelRequestE15TMpmAsynchCodes @ 39 NONAME
+	_ZN4RMPM8SortSNAPEmR14TMpmSnapBufferR14TRequestStatusm @ 40 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/eabi/mpmdefaultconnectionu.def	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,7 @@
+EXPORTS
+	_ZN21RMPMDefaultConnection13SetDefaultIAPEi @ 1 NONAME
+	_ZN21RMPMDefaultConnection15ClearDefaultIAPEv @ 2 NONAME
+	_ZN21RMPMDefaultConnection5CloseEv @ 3 NONAME
+	_ZN21RMPMDefaultConnection7ConnectEv @ 4 NONAME
+	_ZNK21RMPMDefaultConnection7VersionEv @ 5 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Build info for MPM
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../inc/rmpm.h                   |../../../inc/rmpm.h
+../inc/rmpm.inl                 |../../../inc/rmpm.inl
+../rom/mpm.iby                  CORE_MW_LAYER_IBY_EXPORT_PATH(mpm.iby)
+../rom/mpmdefaultconnection.iby CORE_MW_LAYER_IBY_EXPORT_PATH(mpmdefaultconnection.iby)
+../rom/mpmserver.iby            CORE_MW_LAYER_IBY_EXPORT_PATH(mpmserver.iby)
+../conf/mpm.confml              MW_LAYER_CONFML(mpm.confml)
+../conf/mpm_101f6d12.crml       MW_LAYER_CRML(mpm_101f6d12.crml)
+../conf/mpm_101f6d50.crml       MW_LAYER_CRML(mpm_101f6d50.crml)
+
+PRJ_MMPFILES
+mpmclient.mmp
+mpmserver.mmp
+mpmdefaultconnectionclient.mmp
+mpmserver_platsim.mmp // mpmserver-variant for Platsim
+
+PRJ_TESTMMPFILES
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/group/mpmclient.mmp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: MPM server client interface library
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET            mpm.dll
+TARGETTYPE        dll
+
+UID               0x1000008d 0x101f6d13
+
+VENDORID          VID_DEFAULT
+CAPABILITY        CAP_CLIENT_DLL
+
+SOURCEPATH        ../src
+SOURCE            rmpm.cpp
+SOURCE            mpmlauncher.cpp
+
+USERINCLUDE       ../inc
+MW_LAYER_SYSTEMINCLUDE 
+
+LIBRARY           euser.lib
+LIBRARY           commdb.lib
+LIBRARY           esock.lib
+DEBUGLIBRARY      flogger.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/group/mpmdefaultconnectionclient.mmp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: MPM server client interface library
+*
+*/
+
+#include <platform_paths.hrh>
+
+TARGET            mpmdefaultconnection.dll
+TARGETTYPE        dll
+
+UID               0x1000008d 0x101F6D33
+
+VENDORID          VID_DEFAULT
+CAPABILITY        CAP_CLIENT_DLL
+
+SOURCEPATH        ../src
+SOURCE            rmpmdefaultconnection.cpp
+
+USERINCLUDE       ../inc
+MW_LAYER_SYSTEMINCLUDE 
+
+LIBRARY           euser.lib
+DEBUGLIBRARY      flogger.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/group/mpmserver.mmp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,88 @@
+/*
+* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: MPM server
+*
+*/
+
+#include <platform_paths.hrh>
+
+#ifdef PLATFORM_SIMULATOR
+MACRO             _PLATFORM_SIMULATOR_
+TARGET            mpmserver_platsim.exe
+#else
+TARGET            mpmserver.exe
+#endif
+
+TARGETTYPE        exe
+
+UID               0x1000008d 0x101f6d12
+
+VENDORID          VID_DEFAULT
+CAPABILITY        CAP_SERVER NetworkControl
+
+epocstacksize 0x5000
+
+SOURCEPATH        ../src
+SOURCE            mpmdialog.cpp
+SOURCE            mpmconnmonevents.cpp
+SOURCE            mpmconnmonreqs.cpp
+SOURCE            mpmserversession.cpp
+SOURCE            mpmserver.cpp
+SOURCE            mpmstarter.cpp
+SOURCE            mpmdisconnectdlg.cpp
+SOURCE            mpmdtmwatcher.cpp
+SOURCE            mpmroamingwatcher.cpp 
+SOURCE            mpmconfirmdlg.cpp
+SOURCE            mpmconfirmdlgstarting.cpp
+SOURCE            mpmconfirmdlgroaming.cpp
+SOURCE            mpmdefaultconnection.cpp
+SOURCE            mpmdefaultconnserver.cpp
+SOURCE            mpmdefaultconnserversession.cpp
+SOURCE            mpmcommsdataccess.cpp
+SOURCE            mpmwlanquerydialog.cpp
+SOURCE            mpmiapselection.cpp
+SOURCE            mpmcsidwatcher.cpp
+SOURCE            mpmdialogbase.cpp
+SOURCE            mpmwlanavailability.cpp
+
+USERINCLUDE       ../inc
+
+// Default system include paths for middleware layer modules.
+MW_LAYER_SYSTEMINCLUDE 
+
+// Path for internal headers of the networking ADO. 
+SYSTEMINCLUDE     ../../../inc
+
+LIBRARY           euser.lib
+LIBRARY           agentdialog.lib
+LIBRARY           commdb.lib
+LIBRARY           commsdat.lib
+LIBRARY           esock.lib
+LIBRARY           connmon.lib
+LIBRARY           disconnectdlgclient.lib
+LIBRARY           commonengine.lib
+LIBRARY           featmgr.lib
+LIBRARY           centralrepository.lib
+LIBRARY           etel.lib 
+LIBRARY           etelmm.lib
+LIBRARY           etel3rdparty.lib
+LIBRARY           etelpckt.lib
+LIBRARY           connectionuiutilities.lib
+LIBRARY           cmmanagerdatabase.lib
+LIBRARY           charconv.lib
+LIBRARY           wifiprotclient.lib
+LIBRARY           wifiprotplugin.lib
+LIBRARY           cmmanager.lib
+DEBUGLIBRARY      flogger.lib
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/group/mpmserver_platsim.mmp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,19 @@
+/*
+* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: MPM server
+*
+*/
+
+#define		PLATFORM_SIMULATOR
+#include	"mpmserver.mmp"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/inc/mpmcommon.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,122 @@
+/*
+* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This header defines common definitions for MPM
+*
+*/
+
+/**
+@file mpmcommon.h
+Mobility Policy Manager common definitions.
+*/
+
+#ifndef MPMCOMMON_H
+#define MPMCOMMON_H
+
+//  INCLUDES
+#include <e32base.h>
+
+// CONSTANTS
+// Server name
+_LIT( KMPMServerName,"!MPMServer" );
+// MPM Default Connection server name
+_LIT( KMPMDefaultConnectionServerName,"!MPMDefaultConnectionServer" );
+
+// EXE name
+_LIT( KMPMServerImg,"MPMServer" );
+
+const TUid KServerUid2={0x1000008d};
+const TUid KServerUid3={0x101f6d12};
+
+const TInt KMPMServerStackSize    = 0x2000;    //  8KB
+const TInt KMPMServerInitHeapSize = 0x1000;    //  4KB
+const TInt KMPMServerMaxHeapSize  = 0x1000000; // 16MB
+
+// The server version. A version must be specified when 
+// creating a session with the server
+const TUint KMPMServerMajorVersionNumber = 5;
+const TUint KMPMServerMinorVersionNumber = 2;
+const TUint KMPMServerBuildVersionNumber = 0;
+
+// The number of message slots allocated for a client session
+// Number of necessary message slots is determined as follows. 
+// If these conditions change number of message slots may need to be increased. 
+// 3 for asyncronous methods (ChooseBestIAP, ProcessError, WaitNotification)
+// 1 for cancelling asynchronous requests
+// 5 for synchronous requests. Following functions use Send and could 
+// theoretically be called before previous syncronous call has completed: 
+//
+// ApplicationLeavesConnection, UnregisterPrefIAPNotif, 
+// IAPConnectionActivated, ApplicationMigratesToCarrier,
+//  
+// and one of following (These use SendReceive):
+// RegisterPrefIAPNotif, ApplicationIgnoredTheCarrier, 
+// ApplicationAcceptedTheCarrier, ApplicationRejectedTheCarrier, 
+// ApplicationConnectionEnds, SortSNAP, ApplicationJoinsConnection, 
+// IAPConnectionStopped, IAPConnectionStarted, EasyWlanSsid
+//
+const TUint KNumMessageSlots = 9;
+
+// The number of message slots allocated for MPM Default Connection 
+// client session
+const TUint KNumDefConnMessageSlots = 1;
+
+// MACROS
+
+// DATA TYPES
+// Opcodes used in message passing between client and server
+enum TMPMServerRequests
+    {
+    EMPMServerChooseIap,
+    EMPMServerCancelRequest,
+    EMPMServerApplicationLeavesConnection,
+    EMPMServerIapConnectionStopped,
+    EMPMServerProcessError,
+    EMPMServerRegisterPrefIAPNotif,
+    EMPMServerUnregisterPrefIAPNotif,
+    EMPMServerWaitNotification, 
+    EMPMServerSortSNAP,
+    EMPMServerApplicationJoinsConnection,
+    EMPMServerIapConnectionActivated, 
+    EMPMServerIapConnectionStarted, 
+    EMPMServerApplicationConnectionEnds, 
+    EMPMServerApplicationMigratesToCarrier, 
+    EMPMServerApplicationIgnoredTheCarrier, 
+    EMPMServerApplicationAcceptedTheCarrier, 
+    EMPMServerApplicationRejectedTheCarrier, 
+    EMPMServerEasyWlanSsid,
+    EMPMServerReselectIap
+    };
+
+/**  Request codes for MPM Default Connection server */
+enum TMPMDefaultConnectionRequests
+    {
+    EMPMDefaultConnectionSetDefaultIap,
+    EMPMDefaultConnectionClearDefaultIap
+    };
+
+// Panic codes used for server and client
+// Code values selected just for being different
+// than some normal common error or return values. 
+enum TMPMPanic
+    {
+    // Server
+    EMPMReceiveAlreadyActive     = 100,
+    
+    // Client
+    ERMPMPanicClientNotConnected = 150    
+    };
+      
+#endif // MPMCOMMON_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/inc/mpmcommsdataccess.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,600 @@
+/*
+* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: MPM CommsDat Access class definitions
+*
+*/
+
+/**
+@file mpmcommsdataccess.h
+Mobility Policy Manager CommsDat Access class definitions.
+*/
+
+#ifndef MPMCOMMSDATACCESS_H
+#define MPMCOMMSDATACCESS_H
+
+
+//  INCLUDES
+//
+#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include <commsdat_partner.h>
+#endif
+#include <e32base.h>
+#include <commsdattypesv1_1.h>
+#include <cmpluginwlandef.h>
+#include <cmmanager.h>
+
+#include "mpmserversession.h"
+#include "mpmlogger.h"
+
+class CCDWlanServiceRecord;
+
+using namespace CommsDat;
+using namespace CMManager;
+
+const TInt KMpmDoubleLength = 2;
+
+// Modem bearer names for WLAN Access Points
+_LIT( KModemBearerWLAN, "WLANBearer" );
+
+// Length for allocating space for commsdat text fields
+//
+const TInt KCommsDatTextBufferLength = KMaxTextLength + 1;
+
+enum TWlanIapType
+    {
+    ENotWlanIap,
+    EWlanIap,
+    EEasyWlanIap
+    };
+
+// Structure containing WLAN WEP key data
+// 
+class TWepKeyData
+    {
+public:
+    inline TWepKeyData(): 
+    iWep1(),
+    iWep2(),
+    iWep3(),
+    iWep4(),
+    iWepFormat1( 0 ),
+    iWepFormat2( 0 ),
+    iWepFormat3( 0 ),
+    iWepFormat4( 0 ),
+    iDefaultWep( EWlanDefaultWepKey1 )
+    {};
+    
+    TWlanWepKey iWep1;
+    TWlanWepKey iWep2;
+    TWlanWepKey iWep3;
+    TWlanWepKey iWep4;
+    TUint iWepFormat1;
+    TUint iWepFormat2;
+    TUint iWepFormat3;
+    TUint iWepFormat4;
+    TWlanDefaultWepKey iDefaultWep;
+    };
+
+// CLASS DECLARATION
+/**
+*  
+*  @lib MPMServer.exe
+*  @since 
+*/
+class CMPMCommsDatAccess : public CBase
+    {
+
+    public: // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CMPMCommsDatAccess* NewL();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CMPMCommsDatAccess();
+
+    public: // New methods
+
+        /**
+        * Validates the given IAP.
+        * @since 3.1
+        * @param aConnId Connection Id
+        * @param aIapId IAP Id to be validated
+        * @param aNetId Network ID for the IAP
+        * @param aLanOrWlan IAP uses either LAN or WLAN bearer
+        * @param aSession Handle to session class
+        */
+
+        void ValidateIapL( const TConnectionId      aConnId, 
+                           TUint32&                 aIapId, 
+                           TUint32&                 aNetId, 
+                           TBool&                   aLanOrWlan,
+                           CMPMServerSession&       aSession );
+
+        /**
+        * Checks the bearer type of given IAP.
+        * @since 3.1
+        * @param aIapId IAP Id to be checked
+        * @param aLanOrWlan IAP uses either LAN or WLAN bearer
+        * @param aAvailableIAPList List of IAPs
+        */
+        void CheckBearerL( TUint32&                 aIapId, 
+                           TBool&                   aLanOrWlan, 
+                           const RAvailableIAPList& aAvailableIAPList,
+                           CMPMServerSession&       aSession );
+    
+        /**
+        * Checks if given IAP is Easy WLan.
+        * @since 3.1
+        * @param aIapId IAP Id to be checked
+        * @return ETrue if IAP Id is Easy WLan, otherwise EFalse.
+        */
+        TBool CheckEasyWLanL( TUint32 aIapId ) const;
+
+        /**
+        * Find all snap ids
+        *
+        * @since 3.2
+        * @param aSnapIds Array which will be set to 
+        * contain the snap ids
+        */
+        void FindAllSnapsL( RArray<TUint>& aSnapIds );
+
+        /**
+        * Dump CommsDat IAPs to log in order to support testing.
+        * @since 3.0
+        */
+        void DumpIAPsL() const;
+
+        /**
+        * Dump CommsDat Snaps to log in order to support 
+        * testing.
+        * @since 3.1
+        */
+        void DumpSnapsL();
+
+        /**
+        * Determine the priority for the Iap Id.
+        * @since 3.1
+        * @param aDNIaps List of found DN-IAP entries
+        * @param aAvailableIAPs List of IAPs
+		* @param aSession Handle to session class.
+        */
+        void DeterminePrioritiesL( RArray<TNetIap>&         aDNIaps, 
+                                   const RAvailableIAPList& aAvailableIAPs,
+                                   CMPMServerSession&       aSession );
+
+        /**
+        * Finds the service type for the IAP and returns the global 
+        * bearer priority for that service type.
+        * @since 3.1
+        * @param aIapId Given Iap Id
+        * @param aPriority Global bearer priority for the service type
+        */
+        void GlobalBearerPriorityL( const TUint32    aIapId,
+                                    TUint32&         aPriority);
+
+        /**
+        * Checks if there is a WLAN IAP in CommsDat.
+        * @since 3.2
+        * @param Handle to session class.
+        */
+        void CheckWLANIapL(CMPMServerSession& aSession);
+
+        /**
+        * Checks whether there is a wlan iap which matches the 
+        * parameter settings.
+        *
+        * @since 3.2
+        * @param aSsid Wlan iap ssid
+        * @param aSecMode Wlan iap security mode
+        * @param aConnMode Wlan iap connection mode
+        */
+        TUint32 CheckWLANIapWithSsidL( TWlanSsid& aSsid, 
+                                       TUint32 aSecMode,
+                                       TWlanNetMode aConnMode );
+
+        /**
+        * Stores easy wlan settings into commsdat. 
+        *
+        * @since 3.2
+        * @param aSsid Wlan iap ssid, stored in used ssid field
+        * @param aSecMode Wlan iap security mode
+        * @param aConnMode Wlan iap connection mode
+        * @param aWepData WEP key data
+        * @param aEnableWpaPsk Wlan iap enable psk mode
+        * @param aWpaPsk Wlan iap wpa psk
+        * @param aWpaKeyLen Wlan iap wpa key length
+        */
+        void SetEasyWlanDataL( const TWlanSsid& aSsid,
+                               TUint            aSecMode,
+                               TWlanNetMode     aConnMode,
+                               TWepKeyData      aWepData,
+                               TUint            aEnableWpaPsk,
+                               const TDesC8&    aWpaPsk,
+                               TUint            aWpaKeyLen  );
+
+        /**
+        * Returns Easy wlan service record id.
+        * @since 3.2
+        * @param aDb DB session
+        * return Easy wlan service record id
+        */
+        TUint32 FindEasyWlanServiceIdL( CMDBSession* aDb );
+        
+        /**
+        * Checks if the HiddenAgent metadata is set for this IAP.
+        * @since 3.2
+        * @param aIapId Given Iap Id 
+        * return ETrue if HiddenAgent metadata is set, otherwise EFalse.
+        */
+        TBool CheckHiddenAgentL( const TUint32 aIapId ) const;
+
+        /**
+        * Checks if the given IAP Id shares the same SSID 
+        * as the active WLAN connection.
+        * @since 3.2
+        * @param aSSID the id of active wlan network.
+        * @param aIapId IAP Id to be checked.
+        * @param aMatchFound ETrue if the given IAP Id shares the same SSID 
+        * as the active WLAN connection, otherwise EFalse.
+        * @param aSession Handle to session class.
+        */
+        void MatchSSIDL( const TWlanSsid&   aSSID,
+                         TUint32            aIapId, 
+                         TBool&             aMatchFound,
+                         CMPMServerSession& aSession );
+        /**
+        * Determines whether the IAP is a virtual IAP.
+        * @since 3.2
+        * @param aVirtualIapId Given virtual Iap Id
+        */
+        TBool IsVirtualIapL( const TUint32 aVirtualIapId ) const;
+
+        /**
+        * Determines whether the SNAP contains at least the 
+        * specified number of WLAN IAPs.
+        * @since 3.2
+        * @param aSnapRecord Id of the SNAP record
+        * @param aIapPath Chain of Iaps traversed this far. 
+        * @param aMinNrWlan Minimum number of WLAN IAPs to search for 
+        * Used for detecting loops in configuration
+        */
+        TBool SnapContainsWlanL( TUint32		aSnapRecord, 
+        						 RArray<TUint>& aIapPath,
+        						 TInt 			aMinNrWlan );
+        
+        /**
+        * Calls SearchDNEntries for SNAP and if the SNAP contains
+        * embedded SNAP also calls SearchDNEntries for that.
+        * @since 3.2
+        * @param aSnap SNAP id
+        * @param aDestNetIaps Iaps of original SNAP are store here
+        * @param aEmbeddedIaps Iaps of embedded SNAP are store here
+        */
+        void SearchDNEntriesWithEmbeddedL( TUint32 aSnap, 
+                                           RArray<TNetIap>& aDestNetIaps,
+                                           RArray<TNetIap>& aEmbeddedIaps );
+
+        /**
+        * Checks if given IAP is WLAN and whether it is EasyWLAN IAP.
+        * @since 3.2
+        * @param aIapId IAP Id to be checked
+        * @return One of TWlanIapType values depending on 
+        * whether IAP is WLAN or Easy WLAN
+        */
+        TWlanIapType CheckWlanL( TUint32 aIapId ) const;
+
+        /**
+        * Removes categorised IAPs from the list of available IAPs.
+        * @since 3.2
+        * @param aIAPList List of IAPs
+        */
+        void RemoveCategorisedIapsL( RAvailableIAPList& aIAPList );
+
+       /**
+        * Get service id of an iap.
+        * @since 3.2
+        * @param aIapId Id of an Iap.
+        */
+       TUint32 GetIapServiceIdL( TUint32 aIapId );
+
+       /**
+        * Returns ElementId of the record with attribute and flags bit 
+        * removed. 
+        * 
+        * THIS METHOD MUST BE USED INSTEAD OF COMMSDAT ElementId() 
+        * in order to clear possible attribute/flag bits. 
+        * Otherwise Find may fail if incorrect element id is used.
+        *
+        * @since 3.2
+        * @param aRecord A record to get the element id from
+        * @return Element id value
+        */        
+        static TUint32 GetRealElementId( CMDBRecordBase* aRecord );
+        
+        /**
+         * Check if the Wlan background scan is on.
+         * @return ETrue if set.
+         */
+        TBool WlanBackgroundScanIsOnL();
+
+       /**
+        * Returns true if destination is internet or 
+        * iap belongs to internet destination.
+        * @since 5.1
+        * @param aIapId IAP id
+        * @param aSnapId Snap id
+        * @return True or false depending on destination type.
+        */
+        TBool IsInternetSnapL( TUint32 aIapId, TUint32 aSnapId );
+
+       /**
+        * Used to get bearer type of the iap.
+        *
+        * @since 5.0
+        * @param aIapId Iap id of the connection.
+        * @return Type of the bearer.
+        */
+        TMPMBearerType GetBearerTypeL( TUint32 aIapId );
+        
+       /**
+        * Check if all active connections are in same snap.
+        *
+        * @since 5.0
+        * @param aActiveBMConns Array of active connections.
+        * @param aSnapId Destination where connections are located is returned
+        *                to this parameter.
+        * @return ETrue if all active connections are in same snap.
+        */
+        TBool AreActiveIapsInSameSnapL ( RArray<TActiveBMConn>& aActiveBMConns,
+                                         TUint32& aSnapId );
+
+       /**
+        * Select active connection according to snap priorities.
+        *
+        * @since 5.0
+        * @param aSnapId Snap id of the connection.
+        * @param aActiveBMConns Array of active connections.
+        * @param aActiveIapId Iap id of the selected active connection.
+        * @param aActiveSnapId Snap id of the selected active connection.
+        * @param aActiveBearerType Bearer type of the selected active connection.
+        * @param aSession Handle to session class.
+        */
+        void SelectActiveConnectionL ( const TUint32 aSnapId,
+                                       RArray<TActiveBMConn>& aActiveBMConns,
+                                       TUint32& aActiveIapId,
+                                       TUint32& aActiveSnapId,
+                                       TMPMBearerType& aActiveBearerType,
+                                       CMPMServerSession& aSession );
+
+       /**
+        * Check if snap is empty.
+        *
+        * @since 5.0
+        * @param aSnapId Snap id of the connection.
+        * @return ETrue if snap is empty.
+        */
+        TBool IsSnapEmptyL( TUint32 aSnapId );
+
+       /**
+        * Verifies that Iap exists. Leaves with error code otherwise
+        * @since 9.1
+        * @param aIapId Iap
+        */        
+        void VerifyIapExistsL( TUint32 aIapId );
+
+        /**
+         * Gets SnapTierTagId
+         * @param aDbs commsdat session
+         * @param ElementId
+         * @return TagId
+         */
+        TInt TierLinktoTagIdL( CMDBSession* aDbs, TUint32 aElementId ); 
+
+        /**
+         * Maps SNAP RecId to SNAP AP
+         * @since 9.1
+         * @param aApRecId netid
+         * @return SNAP AP
+         */
+         TInt MapAPRecIdtoSnapAPL( TInt aApRecId );
+
+        /**
+         * Maps NetId to SNAP AP
+         * @since 9.1
+         * @param aNetId netid
+         * @return SNAP AP
+         */
+         TInt MapNetIdtoSnapAPL( TInt aNetId );
+
+        /**
+         * Maps SNAP AP to NetId
+         * @since 9.1
+         * @param aAP APId
+         * @return NetId
+         */
+         TInt MapSnapAPtoNetIdL( TInt aAP );
+
+
+        /**
+        * Finds DN-IAP entries based on given Snap Id.
+        * @since 3.1
+        * @param aSnapId Given Snap Id
+        * @param aDestNetIds List of found DN-IAP entries
+        */
+        void SearchDNEntriesL( const TUint32&   aSnapId,
+                               RArray<TNetIap>& aDestNetIds );
+
+        /**
+         * Get current forced roam setting
+         * @since 5.2
+         * @return Current forced roam setting in commsdat.
+         */
+        TCmUsageOfWlan ForcedRoamingL() const;
+                
+        /**
+         * Read current general connection settings from CommsDat
+         * @since 5.2
+         * @return Current general connection settings from CommsDat.
+         */        
+        TCmGenConnSettings ReadGenConnSettingsL() const;
+        
+        /**
+         * Write general connection settings to CommsDat
+         * @since 5.2
+         * @param aGenConnSettings General connection settings to written to CommsDat
+         */
+        void WriteGenConnSettingsL(TCmGenConnSettings& aGenConnSettings);
+        
+        /**
+        * Returns Snap id of destination requested in Snap purpose.
+        * @since 5.2
+        * @return Snap id.
+        */
+        TUint32 DestinationIdL( CMManager::TSnapPurpose aSnapPurpose );
+        	
+    private:
+
+       /**
+        * Loads Iap record based on record id.
+        * @since 3.2
+        * @param aIapId Id of an Iap.
+        * @param aDb DB session.
+        * @return Iap record
+        */
+        CCDIAPRecord* LoadIapRecordLC( const TUint32 aIapId, CMDBSession* aDb ) const;
+
+        /**
+        * Finds access network Id based on given IAP Id.
+        * @since 3.1
+        * @param aIapId Given IAP Id
+        * @param aNetId Found access network Id
+        */
+        void SearchAccessNetIdL( const TUint32&  aIapId,
+                                 TUint32&        aNetId );
+
+        /**
+        * Checks if given virtual IAP may use underlying WLAN IAP.
+        * @since 3.2
+        * @param aVirtualIapId IAP Id to be checked
+        * @param aIapPath Chain of Iaps traversed this far. 
+        * Used for detecting loops in configuration
+        * @return ETrue WLAN IAP exists under the virtual IAP, 
+        * otherwise EFalse.
+        */
+        TBool WlanUnderVirtualL( const TUint32 aVirtualIapId, RArray<TUint>& aIapPath  );
+
+        /**
+        * Finds the real IAP behind the virtual IAP.
+        * @since 3.1
+        * @param aVirtualIapId Given virtual Iap Id
+        * @param aRealIapId Real Iap Id
+        * @param aAvailableIAPList List of IAPs
+        * @param aSession Handle to session class
+        */
+        void FindRealIapL( const TUint32             aVirtualIapId,
+                           TUint32&                  aRealIapId, 
+                           const RAvailableIAPList&  aAvailableIAPList,
+                           CMPMServerSession&        aSession );
+
+       /**
+        * loads linked record using element id.
+        * @since 3.2
+        * @param aSession DB Session to use
+        * @param aElementId Link element id 
+        * @return Pointer to allocated record structure.
+        */        
+        CCDRecordBase* LoadLinkedRecordL( CMDBSession&  aSession, 
+                                          TMDBElementId aElementId );
+
+        /**
+         * Sets WEP key data for WLAN service record
+         * @since 9.1
+         * @param aFormatId Id of the field where WEP format is stored
+         * @param aKeyId Id of the field where WEP key is stored
+         * @param aWepData WEP key value
+         * @param aWepFormat WEP key format value
+         * @param aRecord WLAN service record where data is stored
+         */        
+       void SetWepKeyL( TMDBElementId       aFormatId,
+                        TMDBElementId       aKeyId, 
+                        TWlanWepKey         aWepData,
+                        TUint               aWepFormat,
+                        CMDBGenericRecord*  aRecord );
+        
+       /**
+        * Converts ascii data to hex
+        * @since 3.2
+        * @param aSource Ascii data
+        * @param aDest hex data to be filled in
+        */        
+        void ConvertAsciiToHex( const TDesC8& aSource, 
+				                HBufC8*      aDest );
+
+       /**
+        * Returns true if destination is internet.
+        * @since 5.1
+        * @param aDb Handle to database session. 
+        * @param aSnapId Destination id
+        * @return True or false depending on destination type.
+        */
+        TBool IsInternetSnapL( CMDBSession& aDb, TUint32 aSnapId );
+
+       /**
+        * Check whether bearer type is wlan
+        *
+        * @since 5.0
+        * @param aWlanArray Array of wlan bearers
+        * @param aBearerId Bearer id
+        * @return Returns ETrue in case of wlan bearer
+        */
+        TBool IsWlanBearer(RArray<TUint32>& aWlanArray, TInt aBearerId);
+
+       /**
+        * Builds wlan bearer array
+        * 
+        * @since 5.0
+        * @param aDb Handle to database session
+        * @param aWlanArray Array of wlan bearers
+        */
+        void BuildWlanArrayL(CMDBSession& aDb, RArray<TUint32>& aWlanArray);
+        
+       /**
+        * Get snap id for the iap
+        * 
+        * @since 5.0
+        * @param aIapId Id of the iap
+        * @return Id of the snap
+        */
+        TUint32 GetSnapIdL( TUint32 aIapId );
+
+        /**
+        * C++ default constructor.
+        */
+        CMPMCommsDatAccess();
+
+        /**
+        * 2nd phase constructor.
+        */
+        void ConstructL();
+
+    };
+
+#endif // MPMCOMMSDATACCESS_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/inc/mpmconfirmdlg.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,137 @@
+/*
+* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Confirm Dialog definition.
+*
+*/
+
+/**
+@file mpmconfirmdlg.h
+UI Note Handler definition.
+*/
+
+#ifndef MPMCONFIRMDLG_H
+#define MPMCONFIRMDLG_H
+
+// INCLUDES
+#include <e32base.h>
+#include <ConnectionUiUtilities.h>
+
+#include "mpmdialogbase.h"
+
+// CLASS DECLARATION
+/**
+*  MPM Confirmation Dialog abstract base class
+*
+*  @lib MPMServer.exe
+*  @since 3.2
+*/
+class MMPMConfirmDlg
+    {
+    public:
+        /**
+        * Confirmation Dialog response
+        * @since 3.2
+        * @param aError generic Symbian error response code
+        * @param aResult Result of user selection
+        * @return void
+        */
+        virtual void ConfirmDlgResponse( const TInt                   aError, 
+                                         const TMsgQueryLinkedResults aResult ) = 0;
+        /**
+        * Confirmation Dialog response
+        * @since 5.2
+        * @param aDlg previously completed aDlg
+        * @return ETrue if response accepted
+        */
+        virtual TBool ConfirmDlgResponse( MMPMConfirmDlg* aDlg ) = 0;
+    };
+
+// CLASS DECLARATION
+/**
+*  MPM Confirmation Dialog base class
+*
+*  @lib MPMServer.exe
+*  @since 3.2
+*/
+NONSHARABLE_CLASS( CMPMConfirmDlg ) : protected CMPMDialogBase
+    {
+    public:
+
+        enum TDialogType
+            {
+            EConfirmDlgHomeNetwork = 0,
+            EConfirmDlgVisitorNetwork
+            };
+
+        /**
+        * Two-phased constructor.
+        */
+        static CMPMConfirmDlg* NewL( CArrayPtrFlat<CMPMDialogBase>& aQueue,
+                                     MMPMConfirmDlg&       aConfirmDlgUser,
+                                     const TUint32         aNetId,
+                                     const TUint32         aIAP,
+                                     const TDialogType     aDialogType );
+
+        /**
+        * Destructor.
+        */
+        ~CMPMConfirmDlg();
+    protected:
+        /**
+        * For starting the active object.
+        * @since 3.1
+        * @param aDlg Dialog.
+         */
+        virtual void Start( CMPMDialogBase* aDlg );
+        
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CMPMConfirmDlg( CArrayPtrFlat<CMPMDialogBase>& aQueue,
+                        MMPMConfirmDlg&       aConfirmDlgUser,
+                        const TUint32         aNetId,
+                        const TUint32         aIAP,
+                        const TDialogType     aDialogType );
+
+        /**
+        * 2nd phase constructor.
+        */
+        void ConstructL();
+
+    private: // from CActive
+
+        /**
+        * Active Object RunL.
+        * @since 3.2
+        */
+        void RunL();
+
+        /**
+        * Active Object DoCancel.
+        * @since 3.2
+        */
+        void DoCancel();
+
+    private:
+        MMPMConfirmDlg&         iConfirmDlgUser;
+        TUint32                 iSnapId;
+        TUint32                 iIAP;
+        TDialogType             iDialogType;
+        CConnectionUiUtilities* iUtils;
+        TMsgQueryLinkedResults  iResult;
+    };
+
+#endif // MPMCONFIRMDLG_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/inc/mpmconfirmdlgroaming.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,118 @@
+/*
+* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Confirm Dialog definition.
+*
+*/
+
+/**
+@file mpmconfirmdlgroaming.h
+UI Note Handler definition.
+*/
+
+#ifndef MPMCONFIRMDLGROAMING_H
+#define MPMCONFIRMDLGROAMING_H
+
+// INCLUDES
+#include <e32base.h>
+#include "mpmconfirmdlg.h"
+
+// FORWARD DECLARATIONS
+class CMPMServerSession;
+
+// CLASS DECLARATION
+/**
+*  MPM Confirmation Dialog for roaming connection class
+*
+*  @lib MPMServer.exe
+*  @since 3.2
+*/
+NONSHARABLE_CLASS( CMPMConfirmDlgRoaming ) : public CBase, 
+                                             public MMPMConfirmDlg
+  {
+    public:
+
+        /**
+        * Two-phased constructor.
+        */
+        static CMPMConfirmDlgRoaming* NewL( 
+                        CMPMServerSession&                  aSession,
+                        const TUint32                       aSnapId,
+                        const TUint32                       aIAP,
+                        const CMPMConfirmDlg::TDialogType   aDialogType, 
+                        const TBool                         aReconnect );
+
+        /**
+        * Destructor.
+        */
+        ~CMPMConfirmDlgRoaming();
+
+    private:
+
+        /**
+        * Handles confirmation query response.
+        * @since 3.2
+        * @param aError generic Symbian error response code
+        * @param aResult Result of user selection
+        */
+        void HandleResponse( const TInt                      aError,
+                             const TMsgQueryLinkedResults    aResult );
+
+        /**
+        * C++ default constructor.
+        */
+        CMPMConfirmDlgRoaming( 
+                        CMPMServerSession&                  aSession,
+                        const TUint32                       aSnapId,
+                        const TUint32                       aIAP,
+                        const CMPMConfirmDlg::TDialogType   aDialogType, 
+                        const TBool                         aReconnect );
+
+        /**
+        * 2nd phase constructor.
+        */
+        void ConstructL();
+
+    private: // from MMPMConfirmDlg
+
+        /**
+        * Confirmation Dialog response
+        * @since 3.2
+        * @param aError generic Symbian error response code
+        * @param aResult Result of user selection
+        * @return void
+        */
+	    void ConfirmDlgResponse( const TInt                     aError, 
+	                             const TMsgQueryLinkedResults   aResult );
+
+	    /**
+        * Confirmation Dialog response
+        * @since 5.2
+        * @param aDlg previously completed aDlg
+        * @return ETrue if response accepted
+        */
+        TBool ConfirmDlgResponse( MMPMConfirmDlg* aDlg );
+        
+    private:
+        CMPMServerSession&          iSession;
+        TUint32                     iSnapId;
+        TUint32                     iIAP;
+        CMPMConfirmDlg::TDialogType iDialogType;
+        CMPMConfirmDlg*             iConfirmDlg;
+        TMsgQueryLinkedResults      iMsgQuery;
+        TInt                        iError;
+        TBool                       iReconnect;
+
+    };
+
+#endif // MPMCONFIRMDLGROAMING_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/inc/mpmconfirmdlgstarting.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,148 @@
+/*
+* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Confirm Dialog definition.
+*
+*/
+
+/**
+@file mpmconfirmdlgstarting.h
+UI Note Handler definition.
+*/
+
+#ifndef MPMCONFIRMDLGSTARTING_H
+#define MPMCONFIRMDLGSTARTING_H
+
+// INCLUDES
+#include <e32base.h>
+#include "mpmconfirmdlg.h"
+#include "mpmiapselection.h"
+
+// FORWARD DECLARATIONS
+class CMPMIapSelection;
+class CMPMServer;
+class CMPMServerSession;
+
+// CLASS DECLARATION
+/**
+*  MPM Confirmation Dialog for establishing connection class
+*
+*  @lib MPMServer.exe
+*  @since 3.2
+*/
+NONSHARABLE_CLASS( CMPMConfirmDlgStarting ) : public CBase, 
+                                              public MMPMConfirmDlg
+  {
+    public:
+
+        /**
+        * Two-phased constructor.
+        */
+        static CMPMConfirmDlgStarting* NewL( 
+                    CMPMIapSelection&                   aIapSelection,
+                    const TUint32                       aConnId,
+                    const TUint32                       aSnapId,
+                    const TUint32                       aIAP,
+                    const CMPMConfirmDlg::TDialogType   aDialogType, 
+                    const TMpmConnPref&                 aPref,
+                    CMPMServer&                         aServer,
+                    CMPMServerSession&                  aSession,
+                    const TInt                          aIapState );
+
+        /**
+        * Destructor.
+        */
+        ~CMPMConfirmDlgStarting();
+
+    private:
+
+        /**
+        * User selected Cancel in Starting Dialog.
+        * @since 3.2
+        * @param aError generic Symbian error response code
+        */
+        void UserSelectedCancel( const TInt       aError );
+        
+        /**
+        * User selected "Connect this time" in Starting Dialog.
+        * @since 5.2
+        */
+        void UserSelectedConnectThisTime();
+        
+        /**
+        * User selected "Connect automatically" in Starting Dialog.
+        * @since 5.2
+        */
+        void UserSelectedConnectAutomatically();
+        
+        /**
+        * Starts displaying Starting Dialog.
+        * @since 3.2
+        */
+        void StartL();
+
+        /**
+        * C++ default constructor.
+        */
+        CMPMConfirmDlgStarting( 
+                    CMPMIapSelection&                   aIapSelection,
+                    const TUint32                       aConnId,
+                    const TUint32                       aSnapId,
+                    const TUint32                       aIAP,
+                    const CMPMConfirmDlg::TDialogType   aDialogType, 
+                    const TMpmConnPref&                 aPref,
+                    CMPMServer&                         aServer,
+                    CMPMServerSession&                  aSession,
+                    const TInt                          aIapState );
+
+        /**
+        * 2nd phase constructor.
+        */
+        void ConstructL();
+
+    private: // from MMPMConfirmDlg
+
+        /**
+        * Confirmation Dialog response
+        * @since 3.2
+        * @param aError generic Symbian error response code
+        * @param aResult Result of user selection
+        * @return void
+        */
+    	void ConfirmDlgResponse( const TInt                     aError, 
+    	                         const TMsgQueryLinkedResults   aResult );
+
+    	/**
+        * Confirmation Dialog response
+        * @since 5.2
+        * @param aDlg previously completed aDlg
+        * @return ETrue if response accepted
+        */
+        TBool ConfirmDlgResponse( MMPMConfirmDlg* aDlg );
+
+    private:
+        CMPMIapSelection&           iIapSelection;
+        TUint32                     iConnId;
+        TUint32                     iSnapId;
+        TUint32                     iIAP;
+        CMPMConfirmDlg::TDialogType iDialogType;
+        CMPMConfirmDlg*             iConfirmDlg;
+        TMsgQueryLinkedResults      iMsgQuery;
+        TMpmConnPref                iPref;
+        CMPMServer&                 iServer;
+        CMPMServerSession&          iSession;
+        TInt                        iError;
+        TInt                        iIapState;
+    };
+
+#endif // MPMCONFIRMDLGSTARTING_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/inc/mpmconnmonevents.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,408 @@
+/*
+* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Interface for receiving ConnMon events in MPM.
+*
+*/
+
+/**
+@file mpmconnmonevents.h
+Interface for receiving ConnMon events in MPM.
+*/
+
+#ifndef MPMCONNMONEVENTS_H
+#define MPMCONNMONEVENTS_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <rconnmon.h>
+#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include <commsdat.h>
+#else
+#include <commsdat.h>
+#include <commsdat_partner.h>
+#endif
+#include <NIFVAR.H>
+#include "mpmserver.h"
+
+// FORWARD DECLARATIONS
+class CMPMConnMonReqs;
+class CWlanAvailability;
+class MWlanAvailability;
+
+// CONSTANTS
+
+// CLASS DECLARATION
+/**
+*  TConnInfo
+*  Record for connection information storage
+*  @lib MPMServer.exe
+*  @since 3.1
+*/
+class TConnInfo
+    { 
+    public: // Constructors and destructor
+
+        /**
+        * Constructor.
+        */
+        TConnInfo();
+
+    public: // Data
+        // Connection Id
+        TUint iConnId;
+
+        // IAP Id
+        TUint32 iIapId;
+
+        // Presumed IAP Id which connection thinks it's using. 
+        // The actual IAP Id ( iIapId ) maybe different because 
+        // of SSID sharing or PDP context management.  
+        TUint32 iPresumedIapId;
+
+        // Network Id
+        TUint32 iNetId;
+        
+        // Access point name
+        TBuf<CommsDat::KMaxMedTextLength> iAPN;
+
+        // SSID of WLAN
+        TWlanSsid iSSID;
+
+        // Connection type
+        TConnectionType iConnType; 
+    };
+
+// CLASS DECLARATION
+/**
+*  MPM ConnMon interface class definition.
+*
+*  @lib MPMServer.exe
+*  @since 3.0
+*/
+class CMPMConnMonEvents : public CBase, public MConnectionMonitorObserver
+    {
+
+    public:    // Constructors and destructor
+    
+        /**
+        * Two-phased constructor.
+        */
+        static CMPMConnMonEvents* NewL( CMPMServer& aServer, 
+                                        CMPMServerSession& aSession );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CMPMConnMonEvents();
+        
+    public: // New methods
+    
+        /**
+        * Remove pointer from the array.
+        * @since 3.1
+        * @param aReq
+        */                
+        void RemoveReqPtr( const CMPMConnMonReqs* aReq );
+
+        /**
+        * Appending connection info.
+        * @since 3.2
+        * @param aConnId Connection Id.
+        */                
+        void AppendConnInfo( const TUint& aConnId );
+
+        /**
+        * Removing connection info.
+        * @since 3.2
+        * @param aConnId Connection Id.
+        */                
+        void RemoveConnInfo( const TUint& aConnId );
+
+        /**
+        * Setting connection info.
+        * @since 3.2
+        * @param aConnId Connection Id
+        * @param aIapId IAP Id
+        * @param aPresumedIapId The IAP Id that application presumes to use
+        * @param aNetId Network Id
+        * @param aAPN Access Point Name
+        */                
+        void SetConnInfo( const TUint& aConnId, 
+                          const TUint& aIapId, 
+                          const TUint& aPresumedIapId, 
+                          const TUint& aNetId, 
+                          const TDesC& aAPN );
+
+        /**
+        * Setting connection info in case of SSID, 
+        * in other words WLAN IAP.
+        * @since 3.2
+        * @param aConnId Connection Id
+        * @param aIapId IAP id
+        * @param aPresumedIapId The IAP Id that application presumes to use
+        * @param aNetId Network id
+        * @param aSSID the id of selected wlan network
+        */
+        void SetConnInfo( const TUint&      aConnId, 
+                          const TUint&      aIapId, 
+                          const TUint&      aPresumedIapId, 
+                          const TUint&      aNetId, 
+                          const TWlanSsid&   aSSID );
+
+        /**
+        * Setting SSID for certain iap
+        * @since 3.2
+        * @param aIapId IAP id
+        * @param aSSID the id of selected wlan network
+        */
+        void SetConnInfoIapSsid( const TUint&       aIapId, 
+                                 const TWlanSsid&    aSSID  );
+
+        /**
+        * Reset connection info.
+        * @since 3.2
+        * @param aConnId Connection Id
+        */
+        void ResetConnInfo( const TUint& aConnId );
+
+        /**
+        * Reset connection info for all connections using given IAP.
+        * @since 3.2
+        * @param aIapId IAP id
+        */
+        void ResetIapConnInfo( const TUint32 aIapId );
+
+        /**
+        * Getting IDs of available IAPs.
+        * @since 3.1
+        * @return IDs of available IAPs 
+        */                                              
+        const TConnMonIapInfo& GetAvailableIAPs();
+        
+        /**
+        * Setting IDs of available IAPs.
+        * @since 3.1
+        * @param aAvailableIAPs IDs of available IAPs
+        */                                              
+        void SetAvailableIAPs( const TConnMonIapInfo& aAvailableIAPs );
+        
+        /**
+        * Find if connection to APN already exists
+        * @since 3.1
+        * @param aDes APN to be checked
+        * @param aIapId On return contains the changed IAP Id
+        * @param aNetId On return contains the changed Network Id
+        */        
+        void FindAPN( const TDesC& aDes, TUint32& aIapId, TUint32& aNetId );
+
+        /**
+        * Find if connection to SSID already exists
+        * @since 3.2
+        * @param aSSID the id of selected wlan network
+        * @param aIapId On return contains the changed IAP Id
+        * @param aNetId On return contains the changed Network Id
+        */        
+        void FindSSID( const TWlanSsid&  aSSID, 
+                       TUint32&         aIapId, 
+                       TUint32&         aNetId );
+
+        /**
+        * Checks if there is active WLAN connection.
+        * @since 3.2
+        * @param aSSID the id of active wlan network
+        * @param aIapId the IAP Id of active wlan network
+        */        
+        TBool ActiveWlanConnection( TWlanSsid&  aSSID, 
+                                    TUint32&    aIapId );
+
+        /**
+        * Starts WLANNetworks request towards Connection monitor.
+        * @since 3.2
+        * @param aSession MPM server session requesting the wlan scan, Null if none.
+        * @param aId ConnectionId.
+        * @param aCallback Callback type to use after WLAN scan completed
+        * @param aForceRefreshIntervalSeconds if the last interval is executed withing this time
+        * the scan is not executed. 0 to do available iap query always.  
+        */
+        void ScanWLANNetworksL( CMPMServerSession* aSession,
+                                const TConnectionId& aId,
+                                TWlanScanCallback aCallback,
+                                TInt aForceRefreshIntervalSeconds = 0 );
+
+        /**
+        * Cancels WLANNetworks request towards Connection monitor.
+        * @param aSession Pointer to session
+        * @since 3.1
+        */
+        void CancelScanL( CMPMServerSession& aSession );
+
+        /**
+        * Gets the presumed Iap Id of Connection Id.
+        * @since 3.2
+        * @param aConnId Connection Id
+        * @param aIapId IAP id
+        */
+        TUint32 PresumedIapId( const TUint& aConnId, 
+                               const TUint& aIapId );
+
+        /**
+        * Updates the internal IAP refresh time stamp.
+        * @since 3.2
+        */
+        void UpdateIAPRefreshTime();
+        
+        /**
+        * Gets the internal IAP refresh time stamp.
+        * @since 3.2
+        * @return TTime latest refresh time
+        */
+        TTime& GetIAPRefreshTime();
+
+        /**
+        * Sets connection count.
+        * @since 3.2
+        * @param aValue Connection count value.
+        */
+        void SetConnectionCounter( const TUint aValue ); 
+
+        /**
+        * Enables discarding availability notifications from Connection Monitor.
+        * @since 3.2
+        */
+        inline void EnableDiscarding(); 
+
+        /**
+        * Disables discarding availability notifications from Connection Monitor.
+        * @since 3.2
+        */
+        inline void DisableDiscarding(); 
+
+        /**
+        * Returns the setting for discarding availability notifications. 
+        * @since 3.2
+        * @return ETrue if availability notifications are discarded. 
+        */
+        inline TBool DiscardAvailabilityNotification(); 
+        
+        /**
+         * Creates preferred carrier available notification when needed.
+         * @since 5.1
+         */
+        void IapAvailabilityChange();
+
+        /**
+         * Asks WLAN bearer availability info from Connection monitor.
+         * @since 5.2
+         * @param aObserver pointer to the caller
+         */
+        void CheckWlanAvailabilityL( MWlanAvailability* aObserver );
+        
+        /**
+         * Cancels WLAN bearer availability check for an observer.
+         * @since 5.2
+         * @param aObserver pointer to the caller
+         */
+        void CancelCheckWlanWlanAvailability( MWlanAvailability* aObserver );
+    
+        /**
+         * Sets iWlanAvailability pointer to NULL because object has
+         * deleted itself.
+         * @since 5.2
+         */
+        void SetWlanAvailabilityPtrNull();
+
+        
+    public: // Functions from base classes
+    
+        /**
+        * From MConnectionMonitorObserver. Event from Connection Monitor.
+        * @since 3.1
+        * @param aConnMonEvent
+        */                
+        void EventL( const CConnMonEventBase& aConnMonEvent );
+        
+    private: // New methods
+
+        /**
+        * C++ default constructor.
+        */
+        CMPMConnMonEvents( CMPMServer& aServer );
+
+        /**
+        * 2nd phase constructor.
+        */
+        void ConstructL( CMPMServerSession& aSession );
+
+    private: // Data
+        // Handle to connection monitor
+        RConnectionMonitor              iConnMon;
+
+        // Server object reference
+        CMPMServer&                     iMyServer;
+        
+        // Request object pointer array
+        RPointerArray<CMPMConnMonReqs>  iReqPtrs;
+        
+        // Info about connections
+        RArray<TConnInfo>               iConnInfoArray;
+        
+        // Available IAPs
+        TConnMonIapInfo                 iAvailableIAPs;
+        
+        // Time stamp of last IAP availability check
+        TTime                           iLastIAPRefreshTime;
+        
+        // Discard availability notifications from Connection Monitor 
+        // until MPM initiated WLAN scan request has completed. 
+        TBool iDiscardAvailabilityNotification;
+
+#ifdef _DEBUG 
+        TBool iFilterEvents; // by default off. (CBase)
+    public:
+        void FilterAvailableIAPEvents( const TBool aVal ) { iFilterEvents = aVal; }
+#endif //_DEBUG
+
+       CWlanAvailability*               iWlanAvailability;
+    };
+
+// -----------------------------------------------------------------------------
+// CMPMConnMonEvents::EnableDiscarding
+// -----------------------------------------------------------------------------
+//
+inline void CMPMConnMonEvents::EnableDiscarding()
+    {
+    iDiscardAvailabilityNotification = ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMConnMonEvents::DisableDiscarding
+// -----------------------------------------------------------------------------
+//
+inline void CMPMConnMonEvents::DisableDiscarding()
+    {
+    iDiscardAvailabilityNotification = EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMConnMonEvents::DiscardAvailabilityNotification
+// -----------------------------------------------------------------------------
+//
+inline TBool CMPMConnMonEvents::DiscardAvailabilityNotification()
+    {
+    return iDiscardAvailabilityNotification;
+    }
+
+#endif // MPMCONNMONEVENTS_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/inc/mpmconnmonreqs.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,189 @@
+/*
+* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: MPM class used for ConnMon requests
+*
+*/
+
+/**
+@file mpmconnmonreqs.h
+MPM class used for ConnMon requests.
+*/
+
+#ifndef MPMCONNMONREQS_H
+#define MPMCONNMONREQS_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <rconnmon.h>
+#include "mpmconnmonevents.h"
+
+// CLASS DECLARATION
+/**
+*  MPM class definition for ConnMon requests.
+*
+*  @lib MPMServer.exe
+*  @since 3.1
+*/
+class CMPMConnMonReqs : public CActive
+    {
+
+    public:    // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CMPMConnMonReqs* NewL( CMPMConnMonEvents& aParent,
+                                      RConnectionMonitor& aConnMon,
+                                      TUint aConnId,
+                                      CMPMServerSession& aSession );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CMPMConnMonReqs();
+
+    public: // New functions
+        
+        /**
+        * Starts IapAvailability request towards Connection monitor. 
+        * Calls active sceduler wait to wait until the request completes.
+        * This is used when first session is starting and MPMServer registers 
+        * to ConnMonitor services. In this case the information 
+        * will not be accurate, unless the session creation waits for the 
+        * first update from ConnMon. 
+        *
+        * If registering to ConnMon is moved to MPMServer start, 
+        * remove this function.
+        *
+        * @since 3.1
+        */
+        void AvailableIapsSync();
+        
+        /**
+        * Requests available IAPs from Connection monitor.
+        * This also includes scanning available WLAN networks.
+        * @param aCallback Type of callback to use after completing 
+        * @param aForceRefreshIntervalSeconds
+        * @since 3.2
+        */
+        void RefreshAvailableIAPs( TWlanScanCallback aCallback, TInt aForceRefreshIntervalSeconds );
+
+        /**
+        * Compare request object connection ids
+        * @since 3.1
+        * @param aReq1
+        * @param aReq2
+        * @return ETrue if ids are equal, otherwise EFalse
+        */
+        static TBool CompareConnIds( const CMPMConnMonReqs& aReq1,
+                                     const CMPMConnMonReqs& aReq2 );
+
+        /**
+        * Marks the request as obsolete but allows it run to its completion
+        * @since 3.2
+        */
+        void MyCancel();
+
+    private:
+        /**
+        * Completes the error case and handles cancellation.
+        * @since 3.2
+        */
+        void ErrorCallbackL( TInt aStatus );
+            
+    public: // Functions from base classes
+
+        /**
+        * From CActive. Cancels request.
+        * @since 3.1
+        */
+        void DoCancel();
+
+        /**
+        * From CActive. Run when request completes.
+        * @since 3.1
+        */
+        void RunL();
+
+        /**
+        * From CActive. Run if RunL leaves.
+        * @since 3.1
+        * @param aError Error that caused leave.
+        * @return KErrNone
+        */
+        TInt RunError( TInt aError );
+
+    private: // New methods
+
+        /**
+        * C++ default constructor.
+        */
+        CMPMConnMonReqs( CMPMConnMonEvents&  aParent,
+                         RConnectionMonitor& aConnMon,
+                         TUint aConnId, 
+                         CMPMServerSession&  aSession );
+
+        /**
+        * 2nd phase constructor.
+        */
+        void ConstructL();
+
+    private: // Data
+
+        // Internal states types for this object
+        enum TRequestState
+            {
+            EGetIapAvailState, 
+            EScanWLANNetworksState,
+            EScanWLANNetworksStateCached,
+            EGetConnectionCountState, 
+            EObsolete
+            };
+
+        // Internal state
+        TRequestState iNextState;
+
+        // ConnMon request cancel code
+        TInt iLastCancelCode;
+
+        // Parent object reference
+        CMPMConnMonEvents& iParent;
+
+        // Reference to the Connection Monitor If
+        RConnectionMonitor& iConnMon;
+
+        // Connection identifier
+        TUint iConnId;
+
+        // Iap availability info buffer
+        TConnMonIapInfoBuf iIapBuf;
+
+        // MPM server session which requested the service
+        // After service completes callback function is called through 
+        // the reference.
+        CMPMServerSession& iSession;
+
+        // Used for first session start to wait until necessary data available
+        CActiveSchedulerWait iActiveSchedulerWait;        
+
+        // Callback type to be used when WLAN scan has been completed
+        TWlanScanCallback iWlanScanCallback;
+
+        // Keeps track of the number of connections
+        TUint iConnectionCount; 
+    };
+
+#endif // MPMCONNMONREQS_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/inc/mpmcsidwatcher.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,86 @@
+/*
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Listen connect screen id key changes in central repository.
+*
+*/
+
+#ifndef MPMCSIDWATCHER_H
+#define MPMCSIDWATCHER_H
+
+class CRepository;
+
+/**
+ *  Class for accessing central repository
+ *  Follows KMpmConnectScreenId key in central repository.
+ *  @since 5.1
+ */
+class CMpmCsIdWatcher : public CActive
+    {
+
+public:
+
+    static CMpmCsIdWatcher* NewL();
+
+    /**
+    * Destructor.
+    */
+    virtual ~CMpmCsIdWatcher();
+
+    /**
+     * Call this when you want to start listen event.
+     * @since 5.1
+     */
+    void StartL();
+    
+    /**
+     * Returns connect screen id.
+     * @since 5.1
+	 * @return Connect screen id
+     */
+    TUint32 ConnectScreenId() const;
+    
+// from base class CActive
+
+    void RunL();
+
+    TInt RunError( TInt aError );
+
+    void DoCancel();
+
+private:
+
+    CMpmCsIdWatcher();
+
+    void ConstructL();
+
+private: // data
+
+    /**
+     * Id of the connect screen process
+     */
+    TInt iConnectScreenId;
+
+    /**
+     * Central repository handle
+     * Own.
+     */
+    CRepository* iRepository;
+
+    /**
+     * Set when user connection is enabled
+     */
+    TBool iUserConnectionSupported;
+    };
+
+#endif // MPMCSIDWATCHER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/inc/mpmdefaultconnection.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,180 @@
+/*
+* 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: Handles logic of selecting default connection, 
+*              stores selected default connection when necessary.
+*
+*/
+
+#ifndef C_DEFAULTCONNECTION_H
+#define C_DEFAULTCONNECTION_H
+
+#include <e32base.h>
+#include <cmdefconnvalues.h>
+
+const TCmDefConnType KDefaultMode = ECmDefConnAlwaysAsk;
+const TUint32 KDefaultConnectionId = 0;
+
+class CMPMServer;
+/**
+ *  Class handling default connection
+ *  The class handles logic of selecting default connection
+ *  based on the registered Default connections, user selection 
+ *  stored in CommsDat and values queried from user.
+ *
+ *  The default connection can be queried from the class by 
+ *  MPM Server session starting a connection. Following 
+ *  example describes the behaviour expected from the session.
+ *
+ *  @code
+ *  TCmDefConnType mode(0);
+ *  TUint id(0);
+ *  iMyServer.DefaultConnection().GetDefaultConnection( mode, id );
+ *  if( mode == ECmDefConnAlwaysAsk )
+ *      {
+ *      //implicit connection start
+ *      }
+ *  else if (mode == ECmDefConnAskOnce)
+ *      {
+ *      if( id == 0 )
+ *          {
+ *          // Implicit connection start
+ *          //
+ *          // User selection must be registered by the session 
+ *          // with call:
+ *          MyServer().DefaultConnection().
+ *                 SetAskOnceDefaultConnection( aId );
+ *
+ *          // When BM connection is added under the MPM server object
+ *          // the parameter aUsingAskOnce must be set to ETrue in call
+ *          MyServer().CMAppendBMConnection( connId, snap, iapId, 
+ *                                           state, ETrue );
+ *          }
+ *      else  
+ *          {
+ *          // Explicit connection start using SNAP or IAP from
+ *          // parameters.    
+ *          //
+ *          // When BM connection is added under the MPM server object
+ *          // the parameter aUsingAskOnce must be set to ETrue in call
+ *          MyServer().CMAppendBMConnection( connId, snap, iapId, 
+ *                                           state, ETrue );
+ *          }
+ *      }
+ *      else // snap or iap
+ *          {
+ *          // Explicit connection start using SNAP or IAP from
+ *          //parameters
+ *          }
+ *      } 
+ *  @endcode
+ *
+ *  @lib mpmserver.exe
+ *  @since S60 v3.2
+ */
+class CMPMDefaultConnection : public CBase
+    {
+
+public:
+
+    /**
+     * Two-phased constructor.
+     * @param aServer Reference to MPM Server
+     */
+    static CMPMDefaultConnection* NewL( const CMPMServer* aServer );
+    
+
+    /**
+    * Destructor.
+    */
+    virtual ~CMPMDefaultConnection();
+
+    /**
+     * Sets IAP to be used as default connection
+     *
+     * @since S60 v3.2
+     * @param aIapId The IAP to be set as default connection
+     * return KErrNone if succesful, KErrArgument if id was not accepted
+     */
+    TInt SetDefaultIAP( TInt aIapId );
+
+    /**
+     * Clear IAP from being used as default connection,
+     * if one is set
+     *
+     * @since S60 v3.2
+     */
+    void ClearDefaultIAP();
+
+    /**
+     * Get the current default connection value 
+     *
+     * @since S60 v3.2
+     * @param aMode Points to snap or specific iap.
+     * @param aConnection CommsDat elementId of the IAP or SNAP to be used. 
+     * 0 if not defined.
+     *
+     */
+    void GetDefaultConnectionL( TCmDefConnType& aMode, 
+                                TUint32& aConnection );
+    
+private:
+
+    /**
+     * Converts int value to TCmDefaultConnection
+     * Leaves with KErrArgument is value no in the range
+     *
+     * @since S60 v3.2
+     * @param aInt Int value
+     * @return TCmDefConn value
+     */    
+    TCmDefConnType IntToCmDefConnTypeL( const TUint& aInt );
+
+    /**
+     * Reads default connection setting from commsdat.
+     * If no entry is found default values are returned.
+     *
+     * @since S60 v3.2
+     * @param aType Default connection setting type
+     * @param aId Default connection id
+     */    
+    void ReadDefConnSettingL( TCmDefConnType& aType,
+                              TUint32&          aId );
+    /**
+     * C++ default constructor.
+     */
+    CMPMDefaultConnection( const CMPMServer* aServer );
+    
+    /**
+     * 2nd phase constructor.
+     */
+    void ConstructL();
+    
+
+private: // data
+
+    /**
+     * CommsDat element id of IAP registered by Wlan active idle plugin, 
+     * 0 if not defined
+     */
+    TUint32 iDefaultIapId;
+
+    /**
+     * Pointer to the MPM Server object
+     * Not own
+     */
+    const CMPMServer* iServer;
+
+    };
+
+#endif // CMPMDEFAULTCONNECTION
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/inc/mpmdefaultconnserver.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,90 @@
+/*
+* 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: Server allows registering IAP to be used as default connection
+*
+*/
+
+#ifndef CMPMDEFAULTCONNSERVER_H
+#define CMPMDEFAULTCONNSERVER_H
+
+#include <e32base.h>
+
+#include "mpmserver.h"
+
+class CMPMServer;
+
+/**
+ *  Server allows registering IAP to be used as default connection.
+ *  Server allows WLAN Active Idle plug-in to register the started 
+ *  WLAN IAP as default connection. Only one client is served at the time.
+ *
+ *
+ *  @lib MPMServer.exe
+ *  @since S60 v3.2
+ */
+class CMPMDefaultConnServer : public CPolicyServer
+    {
+
+public:
+
+    /**
+     * Two-phased constructor.
+     */
+    static CMPMDefaultConnServer* NewL( CMPMServer* aMPMServer );
+
+    /**
+    * Destructor.
+    */
+    virtual ~CMPMDefaultConnServer();
+
+    /**
+     * Creates new session
+     *
+     * @since S60 v3.2
+     * @return MPMServer object
+     */
+    CMPMServer* MPMServer();
+
+// from base class CServer2
+
+
+    /**
+     * From CServer2
+     * Creates new session
+     *
+     * @since S60 v3.2
+     * @param aVersion Version information
+     * @param aMessage Message, not used here
+     */
+    CSession2* NewSessionL( const TVersion& aVersion,
+                            const RMessage2& aMessage) const;
+
+private:
+
+    CMPMDefaultConnServer( CMPMServer* aMPMServer );
+
+    void ConstructL();
+
+
+private: // data
+
+    /**
+     * Reference to MPM Server for storing the default IAP. 
+     * Not own.
+     */
+    CMPMServer* iMPMServer;
+
+    };
+
+#endif // CMPMDEFAULTCONNSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/inc/mpmdefaultconnserversession.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,100 @@
+/*
+* 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: Session to MPM Default Connection server
+*
+*/
+
+#ifndef CMPMDEFAULTCONNSERVERSESSION_H
+#define CMPMDEFAULTCONNSERVERSESSION_H
+
+#include <e32base.h>
+#include "mpmdefaultconnserver.h"
+
+
+/**
+ *  Session to MPM Default Connection server
+ *
+ *  @lib MPMServer.exe
+ *  @since S60 v3.2
+ */
+class CMPMDefaultConnServerSession : public CSession2
+    {
+
+public:
+
+    /**
+     * Two-phased constructor.
+     */
+    static CMPMDefaultConnServerSession* NewL( CMPMDefaultConnServer* aServer );
+    
+
+    /**
+    * Destructor.
+    */
+    virtual ~CMPMDefaultConnServerSession();
+
+   /**
+     * Returns the default connection server object
+     *
+     * @since S60 v3.2
+     * @return Default Connection server pointer
+     */
+     CMPMDefaultConnServer* DefaultConnServer();
+
+
+// from base class CSession2
+
+      /**
+       * From CSession2.
+       * Serves client request
+       *
+       * @since S60 v3.2
+       * @param aMessage Message from client
+       */
+       void ServiceL( const RMessage2& aMessage );
+
+
+private:
+
+    CMPMDefaultConnServerSession( CMPMDefaultConnServer* aServer );
+
+    void ConstructL();
+    
+    /**
+     * Store IAP to be used as default connection in MPM Server
+     *
+     * @since S60 v3.2
+     * @param aMessage Client message containing the IAP
+     */
+    void SetDefaultIAP( const RMessage2& aMessage );
+
+    /**
+     * Clear IAP from being used as default connection in MPM Server
+     *
+     * @since S60 v3.2
+     */
+    void ClearDefaultIAP( const RMessage2& aMessage );
+
+
+private: // data
+
+    
+    /**
+     * Poiter to DefaultConnServer object. Not own
+     */
+    CMPMDefaultConnServer* iDefaultConnServer;
+
+    };
+
+#endif // CMPMDEFAULTCONNSERVERSESSION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/inc/mpmdialog.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,161 @@
+/*
+* Copyright (c) 2004-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: MPM class used for agent dialog initiation
+*
+*/
+
+/**
+@file mpmdialog.h
+Mobility Policy Manager agent dialog initiation class.
+*/
+
+#ifndef MPMDIALOG_H
+#define MPMDIALOG_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <agentdialog.h>
+
+#include "mpmiapselection.h"
+#include "mpmdialogbase.h" 
+
+// CLASS DECLARATION
+/**
+*  MPM dialog initiation class definition.
+*
+*  @lib MPMServer.exe
+*  @since 3.0
+*/
+class CMPMDialog : protected CMPMDialogBase
+    {    
+public:
+
+    /**
+     * Two-phased constructor.
+     * @param aCommDbConnPref Connection preferences
+     */
+    static CMPMDialog* NewL( CMPMIapSelection&          aIapSelection,
+                             const RAvailableIAPList&   aIAPList,
+                             TUint32                    aBearerSet,
+                             CArrayPtrFlat<CMPMDialog>& aQueue,
+                             CMPMServer&                aServer );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPMDialog();
+
+    /**
+     * Write sort snap information to publish and subscribe.
+     * 
+     * Publish and subscribe is used as there is otherwise circular 
+     * reference between MPM and connection dialogs which causes 
+     * @since 3.2 
+     */
+    void PublishSortSnapInfoL();
+
+protected: // Functions from base classes
+    /**
+     * Called from the Base class implementation 
+     * when dialog is started. In the current
+     * call stack it's possible to query aDlg for 
+     * more information and after that pointer is 
+     * invalid.
+     */
+    virtual void Start( CMPMDialogBase* aDlg = NULL );
+
+    
+    /**
+     * From CActive. Cancels UI dialog.
+     * @since 3.0
+     */        
+    void DoCancel();
+
+    /**
+     * From CActive. Run when UI dialog finished.
+     * @since 3.0
+     */               
+    void RunL();
+
+    /**
+     * From CActive. Run if RunL leaves.
+     * @since 3.0
+     * @param aError Error that caused leave.
+     * @return KErrNone
+     */
+    TInt RunError( TInt aError );
+
+private: // New methods
+    /**
+     * Initiates a UI dialog towards Agent Dialog Server.
+     * @since 3.0
+     */
+    void InitSelectConnection();
+
+    /**
+     * C++ default constructor.
+     * @param aCommDbConnPref Connection preferences
+     */
+    CMPMDialog( CMPMIapSelection&           aIapSelection,
+                TUint32                     aBearerSet,
+                CArrayPtrFlat<CMPMDialog>&  aQueue,
+                CMPMServer&                 aServer );
+
+    /**
+     * 2nd phase constructor.
+     */
+    void ConstructL( const RAvailableIAPList& aIAPList );
+
+    /**
+     * Copies aOrigin to aCopy. 
+     * @since 3.2 
+     * @param aOrigin Original RAvailableIAPList.
+     * @param aCopy Copy RAvailableIAPList.
+     * @return KErrNone if successful, otherwise one of the 
+     * system-wide error codes.
+     */
+    TInt CopyArray( const RAvailableIAPList& aOrigin, 
+                    RAvailableIAPList&       aCopy );
+
+    /**
+     * Clean sort snap information from publish and subscribe.
+     * 
+     * @since 3.2 
+     */
+    void CleanSortSnapInfo();
+
+private: // Data
+    // Agent Dialog server
+    RGenConAgentDialogServer    iDlgServ;
+
+    // Iap selection object reference
+    CMPMIapSelection&           iIapSelection;
+
+    // SNAP or IAP id
+    TUint32                     iSnapOrIAPId;
+
+    // Bearer set as a combination of
+    // TExtendedConnPref::TExtendedConnBearer values.
+    TUint32                     iBearerSet;
+
+    // Handle to server class
+    CMPMServer&                 iServer;
+
+    RAvailableIAPList           iIAPList;
+    };
+
+
+#endif // MPMDIALOG_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/inc/mpmdialogbase.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,97 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPM class used for agent dialog initiation
+*
+*/
+
+
+/**
+@file mpmdialogbase.h
+Mobility Policy Manager agent dialog initiation class.
+*/
+
+#ifndef MPMDIALOGBASE_H
+#define MPMDIALOGBASE_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <agentdialog.h>
+
+#include "mpmlogger.h"
+
+// CLASS DECLARATION
+/**
+*  MPM dialog initiation class definition.
+*
+*  @lib MPMServer.exe
+*/
+class CMPMDialogBase : public CActive
+    {
+protected: // Constructors and destructor
+
+    /**
+     * C++ default constructor.
+     * @param aQueue Dialog queue.
+     */
+    CMPMDialogBase( CArrayPtrFlat<CMPMDialogBase>& aQueue );
+
+    /**
+     * 2phase constructor
+     */
+    virtual void ConstructL();
+    
+    /**
+     * C++ destructor.
+     */
+    virtual ~CMPMDialogBase();
+
+protected: // Functions from base classes
+
+    /**
+     * From CActive. Cancels UI dialog.
+     * @since 3.0
+     */        
+    virtual void DoCancel() = 0;
+
+    /**
+     * From CActive. Run when UI dialog finished.
+     * @since 3.0
+     */               
+    virtual void RunL() = 0;
+
+    /**
+     * From CActive. Run if RunL leaves.
+     * @since 3.0
+     * @param aError Error that caused leave.
+     * @return KErrNone
+     */
+    virtual TInt RunError( TInt aError ) { return CActive::RunError( aError ); }
+
+    /**
+     * Called automatically from the Base class implementation.
+     * Creates the dialog and request.
+     */
+    virtual void Start( CMPMDialogBase* aDlg = NULL ) = 0;
+
+    /**
+     * @return ETrue if the instance of dialog is first in the queue.
+     */
+    TBool IsFirst();
+
+private: // member variables
+
+    CArrayPtrFlat<CMPMDialogBase>& iQueue;
+    };
+
+#endif //MPMDIALOGBASE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/inc/mpmdisconnectdlg.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,136 @@
+/*
+* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: MPM class used for disconnect dialog initiation
+*
+*/
+
+/**
+@file mpmdisconnectdlg.h
+Mobility Policy Manager disconnect dialog initiation class.
+*/
+
+#ifndef MPMDISCONNECTDLG_H
+#define MPMDISCONNECTDLG_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <DisconnectDlgClient.h>
+#include "mpmserversession.h"
+#include "mpmdialogbase.h"
+
+// CLASS DECLARATION
+/**
+*  MPM disconnect dialog initiation class definition.
+*
+*  @lib MPMServer.exe
+*  @since 3.1
+*/
+class CMPMDisconnectDlg : protected CMPMDialogBase
+    {
+    public:    // Constructors and destructor
+        /**
+        * Two-phased constructor.
+        */
+        static CMPMDisconnectDlg* NewL(
+		    CMPMServerSession&                aSession,
+            TInt                              aOrigError,
+            CArrayPtrFlat<CMPMDisconnectDlg>& aDisconnectQueue );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CMPMDisconnectDlg();
+
+    protected: // New functions
+
+        /**
+         * Start Dlg.
+         * @param aDlg previous same type of dlg in case its response could
+		 *             be utilized.
+         */
+        virtual void Start( CMPMDialogBase* aDlg );
+
+        /**
+        * User selected Ok in Disconnect Dialog.
+        * @since 3.2
+        * @param aError Error code from dialog
+        * @param aIapId Id of the Iap from terminated connection
+        */
+        void UserSelectedOk( TInt aError );
+
+        /**
+        * User selected Cancel in Disconnect Dialog.
+        * @since 3.2
+        * @param aError Error code from dialog
+        */
+        void UserSelectedCancel( TInt aError );
+
+    protected: // Functions from base classes
+
+        /**
+        * From CActive. Cancels UI dialog.
+        * @since 3.1
+        */        
+        void DoCancel();
+
+        /**
+        * From CActive. Run when UI dialog finished.
+        * @since 3.1
+        */               
+        void RunL();
+
+        /**
+        * From CActive. Run if RunL leaves.
+        * @since 3.1
+        * @param aError Error that caused leave.
+        * @return KErrNone
+        */
+        TInt RunError (TInt aError);
+
+    private: // New methods
+
+        /**
+        * C++ default constructor.
+        */
+        CMPMDisconnectDlg(
+		    CMPMServerSession&                aSession,
+            TInt                              aOrigError,
+            CArrayPtrFlat<CMPMDisconnectDlg>& aDisconnectQueue );
+
+        /**
+        * 2nd phase constructor.
+        */
+        void ConstructL();
+    protected:
+        TInt        iUserStatus;
+        TInt        iUserIap;
+        
+    private: // Data
+        // Disconnect Dialog Server
+        RDisconnectDlgServer        iDlgServ;
+
+        // Session object reference
+        CMPMServerSession&          iSession;
+
+        // IAP of the closed connection
+        TUint32                     iIapId;
+
+        // Original error code reported by Bearer Manager
+        TInt                        iOrigError;
+    };
+
+
+#endif // MPMDISCONNECTDLG_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/inc/mpmdtmwatcher.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,107 @@
+/*
+* Copyright (c) 2005-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: MPM Dual Transfer Mode watcher
+*
+*/
+
+/**
+@file mpmdtmwatcher.h
+Mobility Policy Manager Dual Transfer Mode watcher class definitions.
+*/
+
+#ifndef MPMDTMWATCHER_H
+#define MPMDTMWATCHER_H
+
+//  INCLUDES
+#include <etelpckt.h>
+
+// FORWARD DECLARATIONS
+class CMPMServer;
+
+// CLASS DECLARATION
+/**
+*  Mobility Policy Manager Dual Transfer Mode watcher.
+*  @lib MPMServer.exe
+*  @since 3.1
+*/
+class CMPMDtmWatcher : public CActive
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        *
+        * @return An initialized instance of this class.
+        */
+        static CMPMDtmWatcher* NewL( RPacketService& aPacketService );
+
+        /**
+        * Destructor.
+        */
+        ~CMPMDtmWatcher();
+
+    public: // New methods
+
+        /**
+        * Checks if phone supports Dual Transfer Mode.
+        * @since 3.1
+        * @return ETrue phone supports DTM, otherwise EFalse.
+        */
+        TBool IsInDualMode() const;
+
+    protected: // Functions from base classes
+
+        /**
+        * From CActive. Cancels request.
+        * @since 3.1
+        */
+        void DoCancel();
+
+        /**
+        * From CActive. Run when request completes.
+        * @since 3.1
+        */
+        void RunL();
+
+    private: // New methods
+
+        /**
+        * Constructor.
+        */
+        CMPMDtmWatcher( RPacketService& aPacketService );
+
+        /**
+        * C++ default constructor. Not implemented.
+        */
+        CMPMDtmWatcher();
+
+        /**
+        * 2nd phase constructor.
+        */
+        void ConstructL();
+
+        /**
+        * Writes the packet class to log.
+        * @since 3.1
+        */
+        void LogPacketClass() const;
+
+    private: // Data
+
+        RPacketService&             iPacketService;
+        RPacketService::TMSClass    iMsClass;
+        RPacketService::TMSClass    iMaxMsClass;
+    };
+
+#endif // MPMDTMWATCHER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/inc/mpmiapselection.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,394 @@
+/*
+* Copyright (c) 2008 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: Handles IAP selection logic
+*
+*/
+
+#ifndef MPMIAPSELECTION_H
+#define MPMIAPSELECTION_H
+
+#include <e32base.h>
+
+#include "mpmserversession.h"
+#include "mpmcommsdataccess.h"
+#include "mpmwlanavailability.h"
+
+class CMPMDialog;
+class CMPMWlanQueryDialog;
+class CMPMConfirmDlgStarting;
+class MWlanAvailability;
+class TMpmConnPref;
+
+enum TOfflineNoteResponse
+    {
+    EOfflineResponseUndefined,
+    EOfflineResponseYes,
+    EOfflineResponseNo
+    };
+
+/**
+ * Handles IAP selection. MPM Server session
+ * uses the class to select the best available 
+ * IAP.
+ *
+ *  @lib mpmserver.exe
+ *  @since S60 v3.2
+ */
+class CMPMIapSelection : public CBase,
+                         public MWlanAvailability
+    {
+
+public:
+    // Enumeration describes session state at choosing best IAP.
+    // Choosing best IAP may use asyncrous services and once 
+    // and these states define at which point the choosing iap is
+    // proceeding.
+    // 
+    enum TChooseIapState
+        {
+        ENoConnection,
+        EExplicitConnection,
+        EImplicitConnection
+        };
+
+    enum TImplicitConnectionState
+        {
+        EImplicitStart,
+        EImplicitWlanScan,
+        EImplicitUserSelection,
+        EImplicitWlanQuery
+        };
+
+
+public: // CMPMServerSession interface    
+    /**
+     * Two-phased constructor.
+     */
+    static CMPMIapSelection* NewL( CMPMCommsDatAccess*  aCommsDatAccess,
+                                   CMPMServerSession*   aSession );
+    
+    /**
+     * Destructor.
+     */
+    virtual ~CMPMIapSelection();
+
+    /**
+     * Chooses best available IAP when connection is starting.
+     * @param aChooseIapPref Connection preferences.
+     *
+     * @since S60 v3.2
+     */
+    void ChooseIapL( const TMpmConnPref& aChooseIapPref );
+
+    /**
+     * Handles IAP selection for explicit connection.
+     * If necessary performs Wlan scan. 
+     *
+     * @since S60 v3.2
+     */
+    void ExplicitConnectionL();
+
+    /**
+     * Updates connection dialog contents if 
+     * the dilog is shown
+     *
+     * @since S60 v3.2
+     */
+    void UpdateConnectionDialogL();
+
+public:
+    /**
+     * Starts Wlan query if Iap is wlan iap.
+     *
+     * @param aIapId Id of Iap
+     * @param aIsRoaming True if wlan query is for roaming
+     * @return ETrue if wlan query was started
+     * @since S60 v3.2
+     */
+    TBool StartWlanQueryIfNeededL(
+        TUint32 aIapId,
+        TBool aIsRoaming = EFalse );
+
+    /**
+     * Part of selecting best IAP at connection start. Called when WLAN scan
+     * is completed. Continues IAP selection according to the iChooseIapState.
+     *
+     * @since 3.1
+     * @param aStatus Error code of completing the request.
+     */
+    void ChooseIapWLANScanCompletedL( TInt aStatus );
+
+    /**
+     * Completing choose iap request. Uses corresponding function
+     * of CMPMServerSession
+     *
+     * @since 3.2
+     * @param aError Message status
+     * @param aPolicyPref Policy preference to be returned, NULL if no 
+     * preference should be passed
+     */
+    void ChooseIapComplete( TInt aError, const TMpmConnPref* aPolicyPref );
+
+    /**
+     * Callback function used after Wlan network has been selected. 
+     * Uses HandleUserIapSelectionL to complete IAP selection.
+     *
+     * @since 3.2
+     * @param aError Error code from selection
+     * @param aIapId Element id of IAP record if different than reported before. 
+     * May be 0, when error occurred in selection or when no new Iap id is set.
+     *
+     */
+    void UserWlanSelectionDoneL( TInt aError, TUint32 aIapId );
+
+    /**
+     * Stops displaying the starting dialog.
+     *
+     * @since 3.2
+     */
+    void StopDisplayingStartingDlg();
+
+    /**
+     * Selects the best IAP for the connection.
+     *
+     * @since 3.0
+     * @param aMpmConnPref Connection preferences
+     * @param aAvailableIAPs Array of available IAPs
+     * @return KErrNone if successful, otherwise one of the
+     * system-wide error codes
+     */
+    void ChooseBestIAPL( TMpmConnPref&          aMpmConnPref,
+                         const RArray<TUint32>& aAvailableIAPs);
+
+    /**
+     * Selects the best IAP for the connection.
+     * @since 3.2
+     * @param aMpmConnPref Connection preferences.
+     * @param aAvailableIAPs Array of available IAPs.
+     * @param aNextBestExists ETrue if there is another available 
+     * IAP inside the destination that could be used.
+     * @return KErrNone if successful, otherwise one of the
+     * system-wide error codes.
+     */
+    void ChooseBestIAPL( TMpmConnPref&           aMpmConnPref,
+                         const RArray<TUint32>&  aAvailableIAPs, 
+                         TBool&                  aNextBestExists );
+
+    /**
+     * Sets confirmation dialog ponter to NULL.
+     *
+     * @since 3.0
+     */
+    void SetConfirmDlgStartingPtrNull();
+
+    /**
+     * Returns reference to CMPMServerSession
+     *
+     * @since S60 3.2
+     */
+    CMPMServerSession* Session();
+
+    /**
+     * Handles user IAP/SNAP selection error and completes the request.
+     *
+     * @since 3.2
+     * @param aError Error value 
+     *
+     */
+    void HandleUserSelectionError( TInt aError );
+
+    /**
+     * Handles user IAP/SNAP selection and completes the request.
+     *
+     * @since 3.2
+     * @param aIsIap ETrue if selection is iap
+     * @param aId Id of IAP or SNAP record. May be 0, when error
+     * occurred in selection
+     * @param aError Error value 
+     *
+     */
+    void HandleUserSelectionL( TBool aIsIap, TUint32 aId, TInt aError  );
+
+    /**
+     * Returns the stored user response to the offline note
+     * @since 3.2
+     */
+    TOfflineNoteResponse OfflineNoteResponse();
+
+    /**
+     * Stores the user response to the offline note
+     * @since 3.2
+     * @param aResponse Offline note response
+     */
+    void SetOfflineNoteResponse( TOfflineNoteResponse aResponse );
+
+    /**
+     * Iap selection is notified that conenction is started. 
+     * Offline note response is reseted.
+     *
+     * @since 3.2
+     */
+    void ConnectionStarted();
+    
+    /**
+     * Triggers an information note. Note disappears automatically. 
+     *
+     * @since 5.2
+     */
+    void TriggerInformationNoteL();
+
+    /**
+     * Get original MPM connection preferences
+     * @since 5.2
+     */
+     TMpmConnPref MpmConnPref();
+     
+     /**
+      * Completing implicit connection.
+      * @since 3.2
+      */
+     void CompleteImplicitConnectionL();
+         
+
+    // internal functions
+private:
+    /**
+     * Handles IAP selection for implicit connection.
+     * If necessary performs Wlan scan. 
+     *
+     * @since 3.2
+     *
+     */
+    void ImplicitConnectionCheckWlanScanNeededL();
+
+    /**
+     * Completes IAP selection with explicit 
+     * SNAP connection. If necessary, displays 
+     * confirmation query.
+     *
+     * @since S60 v3.2
+     */
+    void CompleteExplicitSnapConnectionL();
+
+    /**
+     * Check whether GPRS services are allowed or not.
+     * @since 3.2
+     * @param aIapLanOrWlan IAP service type is either LANService or not 
+     * @return ETrue if GPRS services are allowed
+     */
+    TBool CheckGprsServicesAllowedL( TBool aIapLanOrWlan );
+
+    /**
+     * Handles implicit connection IAP selection
+     * @since 3.2
+     */
+    void ImplicitConnectionIapSelectionL();
+
+    /**
+     * Handles implicit connection start
+     * @since 3.2
+     */
+    void ImplicitConnectionL();
+
+    /**
+     * Handles implicit connection wlan note displaying
+     * @since 3.2
+     */
+    void ImplicitConnectionWlanNoteL();
+    
+private: // from MWlanAvailability
+
+       /**
+       * WLAN availability check response
+       * @since 3.2
+       * @param aError generic Symbian error response code
+       * @param aResult Result of WLAN availability check
+       * @return void
+       */
+       void WlanAvailabilityResponse( const TInt  aError, 
+                                      const TBool aResult );
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CMPMIapSelection( CMPMCommsDatAccess*   aCommsDatAccess,
+                      CMPMServerSession*    aSession );
+
+    /**
+     * ConstructL
+     */
+    void ConstructL();
+
+private:
+
+    // Connection preferences used for connection selection.
+    // This is stored when ChooseIapL() is called and is used by methods 
+    // selecting the best iap. This member variable is also used 
+    // to store selection before writing it back to client message.
+    TMpmConnPref iChooseIapPref;
+
+    // Keeps state of choosing iap
+    TChooseIapState iChooseIapState;
+
+    // Used for commsdat related functionalities
+    CMPMCommsDatAccess* iCommsDatAccess;
+
+    // Contains state info whether PrefIapnotifs can be sent 
+    // and saved IAP info structure.
+    TStoredIapInfo iStoredIapInfo;
+
+    // Stored available Iaps
+    RAvailableIAPList iStoredAvailableIaps;
+
+    // pointer to Session
+    CMPMServerSession* iSession;
+
+    // Pointer to Confirmation dialog.
+    CMPMConfirmDlgStarting* iConfirmDlgStarting;
+
+    // Pointer to the dialog active object.
+    CMPMDialog* iDialog;
+
+    // Pointer to Wlan query dialog.
+    CMPMWlanQueryDialog* iWlanDialog;
+
+    // Stores the boolean value whether next best iaps 
+    // exists in explicit connection start.
+    TBool iNextBestExists;
+
+    // Iap selected by user.
+    TUint32 iUserSelectionIapId;
+
+    // Snap selected by user.
+    TUint32 iUserSelectionSnapId;
+
+    // State of impilict connection start
+    TImplicitConnectionState iImplicitState;
+
+    // Offline note response for the connection. 
+    // Offline note must be displayed only once 
+    // during the connection (not for each wlan iap of a snap).
+    TOfflineNoteResponse iOfflineNoteResponse;
+
+    // True if connection is roaming (set when displaying offline note)
+    TBool iIsRoaming;
+
+    // True if user has selected "Known and new" for join wlan networks
+	// setting in Connectivity settings plugin.
+    TBool iNewWlansAllowed;
+    };
+
+#endif // MPMIAPSELECTION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/inc/mpmlauncher.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2004-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 header defines server launcher for MPM client.
+*
+*/
+
+/**
+@file mpmlauncher.h
+Mobility Policy Manager server laucher for the client.
+*/
+
+#ifndef MPMLAUNCHER_H
+#define MPMLAUNCHER_H
+
+//  INCLUDES
+#include <e32std.h>
+
+// CLASS DECLARATION
+/**
+*  Mobility Policy Manager server laucher for client.
+*  @lib MPM.lib
+*  @since 3.0
+*/
+NONSHARABLE_CLASS(MPMLauncher)
+    {
+    public: // New methods
+
+        /**
+        * Initiates MPM server starting.
+        * @since 3.0
+        * @param aServerFileName
+        * @param aServerUid2
+        * @param aServerUid3
+        * @return KErrNone if starting OK.
+        */
+        static TInt LaunchServer(
+            const TDesC& aServerFileName,
+            const TUid& aServerUid2,
+            const TUid& aServerUid3);
+
+    };
+
+#endif // MPMLAUNCHER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/inc/mpmlogger.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,141 @@
+/*
+* Copyright (c) 2004-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 header defines logging macros for MPM
+*
+*/
+
+/**
+@file mpmlogger.h
+Mobility Policy Manager debug logging definitions.
+*/
+
+#ifndef MPMLOGGER_H
+#define MPMLOGGER_H
+
+// MACROS
+#ifndef _DEBUG
+
+// UREL BUILD:
+#define MPM_LOGGING_METHOD  0   // No logging in UREL builds
+
+#else
+
+// UDEB BUILD:
+#define MPM_LOGGING_METHOD  1  // 0 = No logging, 
+                               // 1 = Flogger, 
+                               // 2 = RDebug
+#endif // _DEBUG
+
+// Macro usage examples
+// Example: MPMLOGTEXT(own_desc) ;
+// Example: MPMLOGSTRING("Test") ;
+// Example: MPMLOGSTRING2("Test %i", aValue) ;
+// Example: MPMLOGSTRING3("Test %i %i", aValue1, aValue2) ;
+
+#if MPM_LOGGING_METHOD == 1      // Flogger
+
+#include <flogger.h>
+_LIT(KMPMLogFolder,"MPM");
+_LIT(KMPMLogFile,"MPMLOG.TXT");
+
+#define MPMLOGTEXT(x)\
+    {\
+    RFileLogger::Write(KMPMLogFolder(),KMPMLogFile(),EFileLoggingModeAppend,\
+    x);\
+    }
+
+#define MPMLOGSTRING(x)\
+    {\
+    _LIT(tempLogDes,x);\
+    RFileLogger::Write(KMPMLogFolder(),KMPMLogFile(),EFileLoggingModeAppend,\
+    tempLogDes());\
+    }
+
+#define MPMLOGSTRING2(x,y)\
+    { _LIT(tempLogDes,x);\
+    RFileLogger::WriteFormat(KMPMLogFolder(),\
+                             KMPMLogFile(),\
+                             EFileLoggingModeAppend,\
+    TRefByValue<const TDesC>(tempLogDes()),y);\
+    }
+
+#define MPMLOG8STRING2(x,y)\
+    { _LIT8(tempLogDes,x);\
+    RFileLogger::WriteFormat(KMPMLogFolder(),\
+                             KMPMLogFile(),\
+                             EFileLoggingModeAppend,\
+    TRefByValue<const TDesC8>(tempLogDes()),y);\
+    }
+
+#define MPMLOGSSID(x,y,z)\
+    { _LIT8(tempLogDes,x);\
+    RFileLogger::WriteFormat(KMPMLogFolder(),\
+                             KMPMLogFile(),\
+                             EFileLoggingModeAppend,\
+    TRefByValue<const TDesC8>(tempLogDes()),y,z);\
+    }
+
+#define MPMLOGSTRING3(x,y,z)\
+    { _LIT(tempLogDes,x);\
+    RFileLogger::WriteFormat(KMPMLogFolder(),\
+                             KMPMLogFile(),\
+                             EFileLoggingModeAppend,\
+    TRefByValue<const TDesC>(tempLogDes()),y,z);\
+    }
+
+#define MPMLOGSTRING4(w,x,y,z)\
+    { _LIT(tempLogDes,w);\
+    RFileLogger::WriteFormat(KMPMLogFolder(),\
+                             KMPMLogFile(),\
+                             EFileLoggingModeAppend,\
+    TRefByValue<const TDesC>(tempLogDes()),x,y,z);\
+    }
+
+#define MPMLOGSTRING5(w,x,y,z,s)\
+    { _LIT(tempLogDes,w);\
+    RFileLogger::WriteFormat(KMPMLogFolder(),\
+                             KMPMLogFile(),\
+                             EFileLoggingModeAppend,\
+    TRefByValue<const TDesC>(tempLogDes()),x,y,z,s);\
+    }
+
+#elif MPM_LOGGING_METHOD == 2    // RDebug
+
+#include <e32svr.h>
+
+#define MPMLOGTEXT(x) RDebug::Print(x);
+#define MPMLOGSTRING(x) RDebug::Print(_L(x));
+#define MPMLOGSTRING2(x,y) RDebug::Print(_L(x),(y));
+#define MPMLOG8STRING2(x,y) RDebug::Print(_L8(x),(y));
+#define MPMLOGSSID(x,y,z) RDebug::Print(_L(x),(y),(z));
+#define MPMLOGSTRING3(x,y,z) RDebug::Print(_L(x),(y),(z));
+#define MPMLOGSTRING4(w,x,y,z) RDebug::Print(_L(w),(x),(y),(z));
+#define MPMLOGSTRING5(w,x,y,z,s) RDebug::Print(_L(w),(x),(y),(z),(s));
+
+#else // MPM_LOGGING_METHOD == 0 or invalid
+
+#define MPMLOGTEXT(x)
+#define MPMLOGSTRING(x)
+#define MPMLOGSTRING2(x,y)
+#define MPMLOG8STRING2(x,y)
+#define MPMLOGSSID(x,y,z)
+#define MPMLOGSTRING3(x,y,z)
+#define MPMLOGSTRING4(w,x,y,z)
+#define MPMLOGSTRING5(w,x,y,z,s)
+
+#endif // MPM_LOGGING_METHOD
+
+#endif // MPMLOGGER_H
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/inc/mpmprivatecrkeys.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Contains private Central Repository keys.
+*
+*/
+
+
+#ifndef MPMPRIVATECRKEYS_H
+#define MPMPRIVATECRKEYS_H
+
+
+const TUid KCRUidMPM = {0x101F6D12}; 
+
+// Wlan scan feature on or off.
+const TUint32 KMpmWlanScanEnabled  = 0x00000001;
+
+// Wlan scan interval in low mode
+const TUint32 KMpmWlanScanLowInterval = 0x00000002;
+
+// Wlan scan interval in high mode
+const TUint32 KMpmWlanScanHighInterval = 0x00000003;
+
+// First entry for the dedicated clients
+const TUint32 KMpmDedicatedClientBase = 0x00001000;
+
+#endif      // MPMPRIVATECRKEYS_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/inc/mpmroamingwatcher.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,163 @@
+/*
+* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Observes terminals roaming status.
+*
+*/
+
+
+#ifndef MPMROAMINGWATCHER_H
+#define MPMROAMINGWATCHER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <etel.h>
+#include <etelmm.h>
+
+// Possible roaming status values
+enum TMPMRoamingStatus 
+    { 
+    EMPMHomenetwork = 0, 
+    EMPMNationalRoaming, 
+    EMPMInternationalRoaming,
+    EMPMRoamingStatusUnknown
+    };
+
+// CONSTANTS
+// None.
+
+// MACROS
+// None.
+
+// DATA TYPES
+// None.
+
+// FUNCTION PROTOTYPES
+// None.
+
+// FORWARD DECLARATIONS
+// None.
+
+// CLASS DECLARATION
+/**
+*  Mobility Policy Manager network roaming status watcher.
+*  @lib MPMServer.exe
+*  @since 5.2
+*/
+class CMPMRoamingWatcher : public CActive
+	{
+    public: // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        * @param aMobilePhone Reference to RMobilePhone object
+        */
+        static CMPMRoamingWatcher* NewL( RMobilePhone& aMobilePhone );
+        
+        /**
+        * Destructor.
+        */
+        ~CMPMRoamingWatcher();
+    
+    public: // New functions
+        
+        /**
+        * Returns the current roaming status.
+        * @return The current roaming status        
+        */
+        TMPMRoamingStatus RoamingStatus() const;
+        
+        TBool AskCellularDataUsageAbroad() const;
+        
+        void SetAskCellularDataUsageAbroad(TBool aAskUsage);
+        
+        
+    protected: // Constructors and destructor
+        	    
+	    /**
+        * Second-phase constructor.
+        */
+	    void ConstructL();
+    
+    protected: // from CActive
+    
+        /**
+        * Handles completions of async requests.
+        */
+        void RunL();
+        
+        /**
+        * Handles a leave occurring in RunL.
+        * @param aError Leave code of RunL method.
+        * @return KErrNone
+        */
+        TInt RunError( TInt aError );
+        
+        /**
+        * Cancels async requests.
+        */
+        void DoCancel();
+        
+    private: // Data
+        
+        /**
+        * C++ default constructor.  Not implemented.
+        */
+        CMPMRoamingWatcher();
+        
+        /**
+        * Constructor.
+        */
+        CMPMRoamingWatcher( RMobilePhone& aMobilePhone );
+        
+        /**
+        * Maps registration value received from ETEL.
+        * @param aStatus Registration value to be mapped
+        * @return Roaming status
+        */
+        TMPMRoamingStatus MapRegistrationStatus(  RMobilePhone::TMobilePhoneRegistrationStatus aStatus );
+    
+        //data
+
+        /**
+        * Reference to ETEL object
+        */
+        RMobilePhone& iMobilePhone;
+
+        /**
+        * This variable is used to store registration status from async request to ETEL
+        */
+        RMobilePhone::TMobilePhoneRegistrationStatus iRegistrationStatus;   	            
+
+        /**
+        * Current roaming status
+        */
+        TMPMRoamingStatus iRoamingStatus;
+
+        /**
+        * Current country
+        */
+        RMobilePhone::TMobilePhoneNetworkCountryCode iCurrentCountryCode;
+        
+        /**
+         * This variable indicates wheather cellular data usage abroad must be confirmed from the user
+         * This variable is set to TRUE when roaming to visitor network happens and it is set to FALSE when
+         * Confirm Dialog is presented first time in current foreign country. It is also set to FALSE every
+         * time when mobile comes back to home network or moves to other foreign country
+         */
+        TBool iAskCellularDataUsageAbroad;
+	};
+
+#endif // MPMROAMINGWATCHER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/inc/mpmserver.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,961 @@
+/*
+* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: MPM Server class definition
+*
+*/
+
+/**
+@file mpmserver.h
+Mobility Policy Manager server class definitions.
+*/
+
+#ifndef MPMSERVER_H
+#define MPMSERVER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <rconnmon.h>
+#include <etel.h>           // RTelServer
+#include <etelmm.h>         // RMobilePhone
+#include <etelpckt.h>       // RPacketService
+
+#include "mpmcommon.h"
+#include "rmpm.h"
+#include "mpmroamingwatcher.h"
+
+
+class CMPMCommsDatAccess;
+class CMpmCsIdWatcher;
+
+// CONSTANTS
+_LIT( KMPMPanicCategory, "Mobility Policy Manager Server" );
+
+const TInt    KPhoneRetryCount   = 7;
+// 0.1 seconds
+//
+const TInt    KPhoneRetryTimeout = 100000;
+
+// The granularity with which iDisconnectQueue will allocate memory chunks. 
+// If set to two there will be space for two instances of CMPMDisconnectDlg
+// before new memory will be allocated.
+const TInt    KGranularity       = 2;
+
+// Security policy definitions
+
+//Total number of ranges
+const TUint KMPMPolicyRangeCount = 2;
+ 
+//Definition of the ranges of IPC numbers
+const TInt KMPMPolicyRanges[KMPMPolicyRangeCount] = 
+    {
+    0, // 0 -> 19 ; EMPMServerChooseIap,
+       //           EMPMServerCancelRequest,
+       //           EMPMServerApplicationLeavesConnection,
+       //           EMPMServerIapConnectionStopped,
+       //           EMPMServerProcessError,
+       //           EMPMServerRegisterPrefIAPNotif,
+       //           EMPMServerUnregisterPrefIAPNotif,
+       //           EMPMServerWaitNotification, 
+       //           EMPMServerSortSNAP, 
+       //           EMPMServerApplicationJoinsConnection,
+       //           EMPMServerIapConnectionActivated,
+       //           EMPMServerIapConnectionStarted, 
+       //           EMPMServerApplicationConnectionEnds,
+       //           EMPMServerApplicationMigratesToCarrier, 
+       //           EMPMServerApplicationIgnoredTheCarrier, 
+       //           EMPMServerApplicationAcceptedTheCarrier, 
+       //           EMPMServerApplicationRejectedTheCarrier, 
+       //           EMPMServerEasyWlanSsid,
+       //           EMPMServerReselectIap
+#ifndef _DEBUG
+    19 // 19 up ; non implemented function end of range check ; ENotSupported
+#else
+    600 // 20 up ; non implemented function end of range check ; ENotSupported
+#endif
+    };
+    
+//Policy to implement for each of the above ranges        
+const TUint8 KMPMPolicyElementsIndex[KMPMPolicyRangeCount] = 
+    {
+    0, //applies to 0th range
+    CPolicyServer::ENotSupported //applies to 1st range (out of range IPC)
+    };
+
+//Specific capability checks
+const CPolicyServer::TPolicyElement KMPMPolicyElements[] = 
+    {
+    //policy "0"; fail call if NetworkControl not present
+    {_INIT_SECURITY_POLICY_C1(ECapabilityNetworkControl),
+      CPolicyServer::EFailClient
+    }
+    };
+
+//Package all the above together into a policy
+const CPolicyServer::TPolicy KMPMPolicy =
+    {
+    0, //specifies policy "0" for connect attempts
+    KMPMPolicyRangeCount, //number of ranges
+    KMPMPolicyRanges, //ranges array
+    KMPMPolicyElementsIndex, //elements<->ranges index
+    KMPMPolicyElements, //array of elements
+    };
+
+// DATA TYPES 
+// Connection state types
+enum TConnectionState
+    {
+    EIdle = 0, 
+    EStarting, 
+    EStarted, 
+    ERoaming 
+    };
+
+// Which component initiated sending preferred IAP notifications
+enum TPrefIAPNotifCaller
+    {
+    EConnMon = 0, 
+    EBearerMan, 
+    EConfirmDlgRoaming, 
+    EConfirmDlgStarting
+    };
+
+// Blacklisting expires when connection is terminated (user/application) 
+// or when connection error is no longer a problem (IapConnectionStarted). 
+// 
+enum TBlacklistCategory
+    {
+    EConnectionLifetime = 0, 
+    ETemporary
+    };
+
+//  Types of callback to be used after wlan scan has been completed
+enum TWlanScanCallback
+    {
+    EWlanScanCallbackNone,
+    EWlanScanCallbackChooseIap,
+    EWlanScanCallbackProcessErr,
+    EWlanScanCallbackCarrierRejected,
+    EWlanScanCallbackSortSnap,
+    EWlanScanCallbackGenerateEvent
+    };
+
+// Enums used with active connection selection
+enum TMPMBearerType
+    {
+    // Set to none when there are no active connections
+    EMPMBearerTypeNone,
+    // VPN bearer
+    EMPMBearerTypeVpn,
+    // WLAN bearer
+    EMPMBearerTypeWlan,
+    // Packet data bearer
+    EMPMBearerTypePacketData,
+    // Something else than previous ones
+    EMPMBearerTypeOther
+    };
+
+// FUNCTION PROTOTYPES
+void PanicServer( TInt aPanic );
+
+// FORWARD DECLARATIONS
+class CMPMConnMonEvents;
+class CMPMServerSession;
+class CMPMDtmWatcher;
+class CMPMDisconnectDlg;
+class CMPMConfirmDlgRoaming;
+class CMPMConfirmDlgStarting;
+class CMPMDefaultConnection;
+class CMPMWlanQueryDialog;
+class CMPMDialog;
+
+// CLASS DECLARATION
+/**
+*  Class structure to associate Connection Id 
+*  and the list of blacklisted IAPs 
+* 
+*  @since 3.1
+*/
+class TMPMBlackListConnId
+    {
+    public:
+        void Append( TUint32 aIap, TBlacklistCategory aCategory );
+        void Remove( TInt index );
+        void Close();
+        TInt Count() const;
+        inline TUint32 Iap( TInt aIndex) const;
+        inline TBlacklistCategory Category( TInt aIndex) const;
+
+    public:
+        TConnectionId               iConnId;
+    private:
+        RArray<TUint32>             iBlackListIap;
+        RArray<TBlacklistCategory>  iCategory;
+    };
+    
+// CLASS DECLARATION
+/**
+*  Class structure containing application information.
+*
+*  @since 3.1
+*/
+class TConnectionInfo
+    {
+    public:
+        TConnectionInfo();
+        static TBool MatchId( const TConnectionInfo& aFirst,
+                              const TConnectionInfo& aSecond );
+                               
+        static TBool MatchIdSnap( const TConnectionInfo& aFirst,
+                                  const TConnectionInfo& aSecond );        
+    public:
+        TConnectionId       iConnId;
+        TUint32             iSnap; 
+        TUint32             iIapId;
+        TConnectionState    iState;
+        TUint32             iAppUid;
+    };
+
+// CLASS DECLARATION
+/**
+*  Class structure to associate IAP with 
+*  the list of application information.
+*  Used for book-keeping of active BM connections.
+*
+*  @since 3.1
+*/
+class TActiveBMConn
+    {
+    public:
+        TActiveBMConn();
+        static TBool MatchIapId( const TActiveBMConn& aFirst,
+                                 const TActiveBMConn& aSecond );
+
+        static TBool MatchConnInfo( const TActiveBMConn& aFirst,
+                                    const TActiveBMConn& aSecond );
+    public:
+        TConnectionInfo     iConnInfo;
+    };
+
+// CLASS DECLARATION
+/**
+*  MPM Server class definition.
+*
+*  @lib MPMServer.exe
+*  @since 3.0
+*/
+class CMPMServer : public CPolicyServer
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CMPMServer* NewL();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CMPMServer();
+
+    public: // New functions
+        
+        /**
+        * Panics the client thread in case of a wrong client request.
+        * @since 3.0
+        * @param aPanic Panic code
+        */
+        void PanicClient( const TInt aPanic ) const;
+
+        /**
+        * Adding info about active BM connection.
+        * @since 3.1
+        * @param aConnId Connection Id
+        * @param aSnap Snap Id of the connection
+        * @param aIapId IAP Id of the connection
+        * @param aState State of the connection
+        * @param aSession Handle to session class
+        */
+        void AppendBMConnection( const TConnectionId aConnId,
+                                 const TUint32       aSnap,
+                                 const TUint32       aIapId, 
+                                 TConnectionState    aState,
+                                 CMPMServerSession&  aSession );
+
+        /**
+        * Reset the Iap Id as zero and update connection state as EIdle.
+        * @since 3.2
+        * @param aConnId Connection Id
+        * @param aIapId IAP Id of the connection
+        * @param aSession Handle to session class        
+        */
+        void ResetBMConnection( const TConnectionId aConnId, 
+                                const TUint32       aIapId,
+                                CMPMServerSession&  aSession );
+
+        /**
+        * Removing info about an active BM connection.
+        * @since 3.1
+        * @param aConnId Connection Id
+        * @param aSession Handle to session class        
+        */
+        void RemoveBMConnection( const TConnectionId aConnId,
+                                 CMPMServerSession&  aSession );
+
+        /**
+        * Getting Iap Id of an active BM connection.
+        * @since 3.1
+        * @param aConnId Connection Id
+        * @return Iap Id if connection found, else 0
+        */
+        TUint32 GetBMIap( const TConnectionId aConnId );
+
+        /**
+        * Getting SNAP of an active BM connection.
+        * @since 3.1
+        * @param aConnId Connection Id
+        * @return SNAP if connection found, else 0
+        */
+        TUint32 GetBMSnap( const TConnectionId aConnId );
+
+        /**
+        * Getting the connection state for the Connection Id.
+        * @since 3.2
+        * @param aConnId Connection Id
+        * @param aState State of the connection
+        */
+        void GetConnectionState( const TConnectionId aConnId,
+                                 TConnectionState&   aState );
+
+        /**
+        * Checks if the connection is started for the Iap Id.
+        * @since 3.2
+        * @param aIapId IAP Id of the connection
+        */
+        TBool CheckIfStarted( const TUint32 aIapId );
+
+        /**
+        * Checks if a connection is started with wlan iap.
+        * @since 3.2
+        * @param aCdbAccess
+        */
+        TUint32 IsWlanConnectionStartedL( const CMPMCommsDatAccess* aCdbAccess );
+        
+        /**
+        * Appending the whole IAP info about an active BM connection.
+        * @since 3.2 
+        * @param aIapId IAP Id of the connection 
+        * @param aConnId Connection Id
+        * @param aSession Handle to session class        
+        */
+        void AppendBMIAPConnectionL( const TUint32       aIapId, 
+                                     const TConnectionId aConnId,
+                                     CMPMServerSession&  aSession );
+
+        /**
+        * Removing the whole IAP info about an active BM connection.
+        * @since 3.1 
+        * @param aIapId IAP Id of the connection
+        * @param aConnId Connection Id
+        * @param aSession Handle to session class        
+        */
+        void RemoveBMIAPConnection( const TUint32       aIapId, 
+                                    const TConnectionId aConnId,
+                                    CMPMServerSession&  aSession );
+
+        /**
+        * Adding info about active BM preferred IAP notification registration.
+        * @since 3.1
+        * @param aConnId Connection Id
+        * @param aSnap Snap Id of the connection
+        * @param aCurrentIapId IAP Id of the connection
+        */
+        void AppendBMPrefIAP( const TConnectionId aConnId,
+                              const TUint32       aSnap,
+                              const TUint32       aCurrentIapId );
+
+        /**
+        * Removing info about active BM preferred IAP notification 
+        * registration.
+        * @since 3.1
+        * @param aConnId Connection Id
+        */
+        void RemoveBMPrefIAP( const TConnectionId aConnId );
+
+        /**
+        * Resets current IAP Id info of an active BM preferred IAP 
+        * notification registration.
+        * @since 3.2
+        * @param aConnId Connection Id
+        */
+        void ResetBMPrefIAP( const TConnectionId aConnId );
+
+        /**
+        * Checks whether given connection has registered for 
+        * preferred IAP notifications.
+        * @since 3.2
+        * @param aConnId Connection Id
+        */
+        TBool RegisteredForBMPrefIAP( const TConnectionId aConnId );
+
+        /**
+        * Sets last notified IAP for BMPrefIAPNotif related to a connection
+        * 
+        * @since 3.2
+        * @param aConnId Connection Id
+        * @param aIapId Last notified IAP id.
+        * @return KErrNone if successfull. otherwise one of the system wide error
+        * codes
+        */
+        TInt SetConnectionBMPrefLastNotifedIap( TConnectionId aConnId, TUint32 aIapId );
+
+        /**
+        * Adding session pointer.
+        * @since 3.2
+        * @param aSession Pointer to session
+        */
+        void AppendSessionL(const CMPMServerSession* aSession);
+
+        /**
+        * Removing session pointer.
+        * @since 3.2
+        * @param aSession Pointer to session
+        */
+        void RemoveSession( const CMPMServerSession* aSession );
+
+        /**
+        * Notify each session about IAP availability change.
+        * @since 3.1
+        * @param aIapInfo Info about available IAPs 
+        */
+        void NotifyBMPrefIapL( const TConnMonIapInfo& aIapInfo );
+
+        /**
+        * Update Connection dialog of each session
+        * @since 3.2
+        */
+        void UpdateSessionConnectionDlgL();
+
+        /**
+        * Handling of blacklisting certain IAP and the presumed IAP for 
+        * the certain connection.
+        * @since 3.1
+        * @param aConnId Connection Id
+        * @param aIapId IAP Id of the connection.
+        * @param aCategory Either connection lifetime or temporary. 
+        * @return KErrNone if successful, otherwise one of the
+        * system-wide error codes 
+        */
+        TInt HandleServerBlackListIap( const TConnectionId   aConnId, 
+                                       TUint32               aIapId, 
+                                       TBlacklistCategory    aCategory );
+
+        /**
+        * Handling of blacklisting certain IAP for the certain connection.
+        * @since 3.1
+        * @param aConnId Connection Id
+        * @param aIapId IAP Id of the connection.
+        * @param aCategory Either connection lifetime or temporary. 
+        * @return KErrNone if successful, otherwise one of the
+        * system-wide error codes 
+        */
+        TInt BlackListIap( const TConnectionId   aConnId, 
+                           TUint32               aIapId, 
+                           TBlacklistCategory    aCategory );
+
+        /**
+        * Handling of unblacklisting certain IAP or all IAPs 
+        * for the certain connection.
+        * @since 3.1
+        * @param aConnId Connection Id
+        * @param aIapId IAP Id of the connection.
+        * @return KErrNone if successful, otherwise one of the
+        * system-wide error codes 
+        */
+        TInt HandleServerUnblackListIap( const TConnectionId aConnId, 
+                                         TUint32             aIapId );
+
+        /**
+        * Handling of unblacklisting all IAPs for certain category.
+        * @since 3.2
+        * @param aConnId Connection Id
+        * @param aCategory Either connection lifetime or temporary. 
+        * @return KErrNone if successful, otherwise one of the
+        * system-wide error codes 
+        */
+        TInt HandleServerUnblackListIap( const TConnectionId aConnId, 
+                                         TBlacklistCategory  aCategory );
+
+        /**
+        * Handling of unblacklisting all IAPs for certain category.
+        * @since 3.2
+        * @param aCategory Either connection lifetime or temporary. 
+        */
+        void HandleServerUnblackListIap( TBlacklistCategory  aCategory );
+
+        /**
+        * Get blacklisted iap based on the Connection Id.
+        * @since 3.1
+        * @param aConnId Connection Id
+        * @param aBlacklistedIAP returns blacklisted iaps.
+        * @return KErrNone if successful.
+        */
+        TInt GetBlacklistedIAP( TConnectionId    aConnId, 
+                                RArray<TUint32> &aBlacklistedIAP );
+
+        /**
+        * Get all blacklisted IAPs.
+        * @since 3.2
+        * @param aBlacklistedIAP returns blacklisted iaps.
+        * @return KErrNone if successful.
+        */
+        TInt GetBlacklistedIAP( RArray<TUint32> &aBlacklistedIAP );
+
+        /**
+        * Set the ConnMonEvents object.
+        * @since 3.1
+        * @param aEvents Pointer to the ConnMonEvents object.
+        */
+        inline void SetEvents( CMPMConnMonEvents* aEvents );
+
+        /**
+        * Get the ConnMonEvents object.
+        * @since 3.1
+        * @return Pointer to the ConnMonEvents object.
+        */
+        inline CMPMConnMonEvents* Events();
+
+        /**
+        * Find the correct Connection Id from the list of blacklisted 
+        * Connection Id's.
+        * @since 3.1
+        * @param aConnId Connection Id
+        * @param aIndex returns index of Connection Id in the list.
+        * @return ETrue if successful.
+        */
+        TBool FindBlacklistedConnIndex( const TConnectionId aConnId, TInt &aIndex );
+
+        /**
+        * Checks if voice call is active or not.
+        * @since 3.1
+        * @return ETrue if voice call is active, otherwise EFalse.
+        */
+        TBool IsVoiceCallActiveL() const;
+
+        /**
+        * Checks if mode is GSM or not.
+        * @since 3.1
+        * @return ETrue if mode is GSM, otherwise EFalse.
+        */
+        TBool IsModeGSM() const;
+
+        /**
+        * Checks if phone supports Dual Transfer Mode or not.
+        * @since 3.1
+        * @return ETrue if phone supports DTM, otherwise EFalse.
+        */
+        TBool IsDTMSupported() const;
+                
+        /**
+        * Dump array of active connections to log in order to support 
+        * testing.
+        * @since 3.2
+        */
+        void DumpActiveBMConns();
+
+        /**
+        * Sets WLAN scan required On/Off.
+        * @since 3.2
+        * @param aValue True or false.
+        */
+        inline void SetWLANScanRequired( const TBool aValue );
+
+        /**
+        * Checks if there is a need to scan WLAN networks.
+        * @since 3.2
+        * @return ETrue if yes, otherwise EFalse.
+        */
+        inline TBool IsWLANScanRequired() const;
+
+        /**
+        * Get the DisconnectQueue.
+        * @since 3.2
+        * @return Pointer to the DisconnectQueue.
+        */
+        inline CArrayPtrFlat<CMPMDisconnectDlg>* DisconnectQueue();
+
+        /**
+        * Get the RoamingQueue.
+        * @since 3.2
+        * @return Pointer to the RoamingQueue.
+        */
+        inline CArrayPtrFlat<CMPMConfirmDlgRoaming>* RoamingQueue();
+
+        /**
+        * Get the StartingQueue.
+        * @since 3.2
+        * @return Pointer to the StartingQueue.
+        */
+        inline CArrayPtrFlat<CMPMConfirmDlgStarting>* StartingQueue();
+
+        /**
+        * Appends aDlg to the iWlanQueryQueue.
+        * @since 3.2
+        * @param aDlg Pointer to the CMPMConfirmDlgWlanQuery object.
+        */
+        void AppendWlanQueryQueueL( CMPMWlanQueryDialog* aDlg );
+
+        /**
+        * Removes the first item from the iWlanQueryQueue.
+        * @since 3.2
+        */
+        inline void RemoveFromWlanQueryQueue( CMPMWlanQueryDialog* aDlg );
+
+        /**
+        * Get the WlanQueryQueue.
+        * @since 3.2
+        * @return Pointer to the WlanQueryQueue.
+        */
+        inline CArrayPtrFlat<CMPMWlanQueryDialog>* WlanQueryQueue();
+
+        /**
+        * Get the first item in iWlanQueryQueue.
+        * @since 3.2
+        * @return Pointer to the first item in iWlanQueryQueue.
+        */
+        inline CMPMWlanQueryDialog* FirstInWlanQueryQueue();
+
+        /**
+        * Get the ConnectDialogQueue.
+        * @since 3.2
+        * @return Pointer to the CMPMDialogQueue.
+        */
+        inline CArrayPtrFlat<CMPMDialog>* ConnectDialogQueue();
+
+        /**
+        * Get the Default Connection object.
+        * @since 3.2
+        * @return Pointer to the Default Connection object.
+        */
+        CMPMDefaultConnection* DefaultConnection(); 
+
+        /**
+        * Returns true if there is a started connection
+        * 
+        * @since 3.2
+        * @param aIapId Optional searched IapId. If it doesn't exist,
+        * returns first found and started connection iapid
+        * @return IapId, KErrNotFound if doesn't exist
+        */
+        TInt StartedConnectionExists( TInt aIapId = KErrNotFound ); 
+        
+        /**
+        * Increments connection count.
+        * @since 3.2
+        */
+        inline void IncrementConnections();
+
+        /**
+        * Decrements connection count.
+        * @since 3.2
+        */
+        inline void DecrementConnections(); 
+
+        /**
+        * Returns connection count.
+        * @since 3.2
+        * @return Connection count.
+        */
+        inline TUint ConnectionCounter(); 
+
+        /**
+        * Sets connection count.
+        * @since 3.2
+        * @param aValue Connection count value.
+        */
+        inline void SetConnectionCounter( const TUint aValue );
+
+        /**
+        * Returns array of dedicated clients.
+        *
+        * @since 5.0
+        * @return Reference to array of dedicated clients.
+        */
+        inline RArray<TUint32>& DedicatedClients();
+
+        /**
+        * Returns the Commsdat access instance
+        *
+        * @since 3.2
+        */
+        inline CMPMCommsDatAccess* CommsDatAccess();
+
+        /**
+        * Starts forced roaming sequence to wlan
+        *
+        * @param aIapInfo Info about available IAPs
+        * @since 5.2
+        */
+        void StartForcedRoamingToWlanL( const TConnMonIapInfo& aIapInfo );
+        
+        /**
+        * Starts forced roaming sequence from WLAN if necessary
+        *
+        * @param aIapInfo Info about available IAPs
+        * @since 5.2
+        */
+        void StartForcedRoamingFromWlanL( const TConnMonIapInfo& aIapInfo );
+        
+        /**
+        * Checks whether phone is in visitor network.
+        *
+        * @since 5.2
+        */
+        TBool IsVisitorNetwork() const;
+        
+        /**
+        * Returns the RoamingWatcher pointer
+        *
+        * @since 5.2
+        */
+        inline CMPMRoamingWatcher* RoamingWatcher() const;
+        
+        
+        
+    public: // Functions from base classes
+
+        /**
+        * From CServer2. Creates a new session for a client.
+        * @since 3.0
+        * @param aVersion Version information
+        * @param aMessage Not really used here
+        * @return Pointer to the new client session
+        */
+        CSession2* NewSessionL( const TVersion& aVersion,
+                                const RMessage2& aMessage) const;
+
+        // Stops connection of certain IAP, zero for all connections
+        void StopConnections( TInt aIapId = 0 );
+
+    public:
+
+        /**
+         * Mark that there is an active user connection.
+         * @since 5.1
+         */
+        inline void SetUserConnection();
+        
+        /**
+         * Mark that user connection is not active
+         * @since 5.1
+         */
+        inline void ClearUserConnection();
+        
+        /**
+         * Check if user connection is active
+         * @since 5.1
+         * @return ETrue if user connection is active.
+         */
+        inline TBool UserConnection() const;
+
+        /**
+         * Set connection preferences used by user connection
+         * @since 5.1
+         * @param aUserConnPref User connection prefernces.
+         */
+        inline void SetUserConnPref( const TMpmConnPref& aUserConnPref );
+        
+        /**
+         * Returns connection preferences used by user connection
+         * @since 5.1
+         * @return User connection preferences.
+         */
+        inline const TMpmConnPref* UserConnPref() const;
+        
+        /**
+         * Checks whether user connection is in internet snap.
+         * @since 5.1
+         * @return ETrue if user connection is in internet snap
+         */
+        TBool UserConnectionInInternet() const;
+                
+        /**
+         * Handle to central repository watcher
+         * @since 5.1
+         * @return Pointer to watcher object.
+         */
+        inline CMpmCsIdWatcher* CsIdWatcher();
+
+        /**
+        * Change state of the P&S keys according to active connection.
+        * @since 5.0
+        * @param aSession Handle to session used by connection.
+        */
+        void UpdateActiveConnectionL( CMPMServerSession& aSession );
+
+        /**
+        * Map bearer type between MPM and commsdat.
+        * @since 5.0
+        * @param aBearerType Bearer type used by MPM for active connection selection.
+        * @return Bearer type used by commsdat
+        */
+        TUint32 MapBearerType( TMPMBearerType aBearerType );
+
+        /**
+        * Writes new active connection to the P&S keys
+        * @since 5.0
+        */    
+        void PublishActiveConnection();
+        
+        /**
+        * Returns number of active connections.
+        * @since 5.0
+        * @return Number of active connections
+        */
+        TInt NumberOfActiveConnections();
+        
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CMPMServer();
+
+        /**
+        * 2nd phase constructor.
+        */
+        void ConstructL();
+        
+        /**
+        * Send error notification with KErrDisconnect error code.
+        * @since 5.2
+        * @param aConnIndex Active connection index
+        * @param aAvailWlanIapIds Array of available wlan iap ids
+        * @param aIapList Array of all available iap ids
+        * @param aCheckForBestIap Whether check if current iap is already
+        *                         the best should be done
+        * @param aDestinationBearerType Destination iap bearer type
+        */
+        void NotifyDisconnectL( TInt aConnIndex, 
+                                RArray<TUint32>& aAvailWlanIapIds,
+                                RAvailableIAPList& aIapList,
+                                TBool aCheckForBestIap,
+                                TMPMBearerType aDestinationBearerType );
+        
+        /**
+        * Returns server session instance that corresponds to given
+        * connection id.
+        * @since 5.2
+        * @param aConnId Id of the connection. The id must belong to an
+        *                existing server session.
+        * @return Server session instance
+        */
+        CMPMServerSession* GetServerSession( TConnectionId aConnId ) const;
+
+    private: // Data
+        // Pointer to the ConnMonEvents object
+        CMPMConnMonEvents* iEvents;
+
+        // Array of active connections requested by BM
+        RArray<TActiveBMConn> iActiveBMConns;
+        
+        // Array of all sessions
+        //
+        RPointerArray<CMPMServerSession> iSessions;
+
+        // Array of blacklisted IAPs
+        // 
+        RArray<TMPMBlackListConnId>      iBlackListIdList;
+
+        // Handle to the telephony server
+        RTelServer iTelServer;
+
+        // RMobilePhone handle
+        RMobilePhone iMobilePhone;
+
+        // Handle to the packet service
+        RPacketService iPacketService;
+
+        // True if mmtsy is loaded
+        TBool iTSYLoaded;
+
+        // True if packet services are loaded
+        TBool iPacketServLoaded;
+
+        // Dual Transfer Mode watcher
+        CMPMDtmWatcher* iDtmWatcher;
+        
+		//Cellular network roaming watcher
+        CMPMRoamingWatcher* iRoamingWatcher;
+
+        // Is WLAN scan required or not before displaying Connection Dialog
+        TBool iWLANScanRequired;
+
+        // Solves problem with overlapping Disconnect Dialogs
+        CArrayPtrFlat<CMPMDisconnectDlg>* iDisconnectQueue;
+
+        // Solves problem with overlapping Roaming Dialogs
+        CArrayPtrFlat<CMPMConfirmDlgRoaming>* iRoamingQueue;
+
+        // Solves problem with overlapping Starting Dialogs
+        CArrayPtrFlat<CMPMConfirmDlgStarting>* iStartingQueue;
+
+        // Solves problem with overlapping Wlan Queries
+        CArrayPtrFlat<CMPMWlanQueryDialog>* iWlanQueryQueue;
+
+        // Solves problem with overlapping Connection Dialogs
+        CArrayPtrFlat<CMPMDialog>* iConnectDialogQueue;
+        
+        // Handles Default Connection selection
+        CMPMDefaultConnection* iDefaultConnection;
+
+        // Keeps track of the number of connections
+        TUint iConnectionCounter;
+
+        // Set when there is user connection exist
+        TBool iUserConnection;
+
+        // Preferences selected for the user connection
+        TMpmConnPref iUserConnPref;
+
+        // Set when user connection in internet snap
+        TBool iUserConnectionInInternet;
+        
+        /**
+         * Handle to central repository watcher
+         * Own.
+         */
+        CMpmCsIdWatcher* iMpmCsIdWatcher;
+
+        // Iap id of the active connection
+        TUint32 iActiveIapId;
+        
+        // Snap id of the active connection
+        TUint32 iActiveSnapId;
+
+        // Bearer type of the active connection
+        TMPMBearerType iActiveBearerType;
+
+        // Dedicated clients
+        RArray<TUint32> iDedicatedClients;
+
+        // Used for commsdat related functionalities
+        CMPMCommsDatAccess* iCommsDatAccess;
+    };
+
+#include "mpmserver.inl"
+
+
+#endif // MPMSERVER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/inc/mpmserver.inl	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,270 @@
+/*
+* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Inline functions for CMPMServer class
+*
+*/
+
+// -----------------------------------------------------------------------------
+// TMPMBlackListConnId::Iap
+// -----------------------------------------------------------------------------
+//
+inline TUint32 TMPMBlackListConnId::Iap( TInt aIndex) const
+    {
+    return iBlackListIap[aIndex];
+    }
+
+// -----------------------------------------------------------------------------
+// TMPMBlackListConnId::Category
+// -----------------------------------------------------------------------------
+//
+inline TBlacklistCategory TMPMBlackListConnId::Category( TInt aIndex) const
+    {
+    return iCategory[aIndex];
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServer::SetEvents
+// -----------------------------------------------------------------------------
+//
+inline void CMPMServer::SetEvents( CMPMConnMonEvents* aEvents )
+    {
+    iEvents = aEvents;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServer::Events
+// -----------------------------------------------------------------------------
+//
+inline CMPMConnMonEvents* CMPMServer::Events()
+    {
+    return iEvents;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServer::SetWLANScanRequired
+// -----------------------------------------------------------------------------
+//
+inline void CMPMServer::SetWLANScanRequired( const TBool aValue )
+    {
+    iWLANScanRequired = aValue;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServer::IsWLANScanRequired
+// -----------------------------------------------------------------------------
+//
+inline TBool CMPMServer::IsWLANScanRequired() const
+    {
+    return iWLANScanRequired;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServer::DisconnectQueue
+// -----------------------------------------------------------------------------
+//
+inline CArrayPtrFlat<CMPMDisconnectDlg>* CMPMServer::DisconnectQueue()
+    {
+    return iDisconnectQueue;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServer::RoamingQueue
+// -----------------------------------------------------------------------------
+//
+inline CArrayPtrFlat<CMPMConfirmDlgRoaming>* CMPMServer::RoamingQueue()
+    {
+    return iRoamingQueue;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServer::StartingQueue
+// -----------------------------------------------------------------------------
+//
+inline CArrayPtrFlat<CMPMConfirmDlgStarting>* CMPMServer::StartingQueue()
+    {
+    return iStartingQueue;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServer::RemoveFromWlanQueryQueue
+// -----------------------------------------------------------------------------
+//
+inline void CMPMServer::RemoveFromWlanQueryQueue( CMPMWlanQueryDialog* aDlg )
+    {
+    for ( TInt i = 0; i < iWlanQueryQueue->Count(); i++ )
+        {
+        if ( iWlanQueryQueue->At( i ) == aDlg )
+            {
+            iWlanQueryQueue->Delete( i );
+            break;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServer::WlanQueryQueue
+// -----------------------------------------------------------------------------
+//
+inline CArrayPtrFlat<CMPMWlanQueryDialog>* CMPMServer::WlanQueryQueue()
+    {
+    return iWlanQueryQueue;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServer::FirstInWlanQueryQueue
+// -----------------------------------------------------------------------------
+//
+inline CMPMWlanQueryDialog* CMPMServer::FirstInWlanQueryQueue()
+    {
+    if ( iWlanQueryQueue->Count() == 0 )
+        return NULL;
+    else
+        return iWlanQueryQueue->At( 0 );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServer::ConnectDialogQueue
+// -----------------------------------------------------------------------------
+//
+inline CArrayPtrFlat<CMPMDialog>* CMPMServer::ConnectDialogQueue()
+    {
+    return iConnectDialogQueue;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServer::IncrementConnections
+// -----------------------------------------------------------------------------
+//
+inline void CMPMServer::IncrementConnections()
+    {
+    iConnectionCounter++;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServer::DecrementConnections
+// -----------------------------------------------------------------------------
+//
+inline void CMPMServer::DecrementConnections()
+    {
+    if ( ConnectionCounter() > 0 )
+        {
+        iConnectionCounter--;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServer::ConnectionCounter
+// -----------------------------------------------------------------------------
+//
+inline TUint CMPMServer::ConnectionCounter()
+    {
+    return iConnectionCounter;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServer::SetConnectionCounter
+// -----------------------------------------------------------------------------
+//
+inline void CMPMServer::SetConnectionCounter( const TUint aValue )
+    {
+    iConnectionCounter = aValue;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServer::SetUserConnection
+// -----------------------------------------------------------------------------
+//
+inline void CMPMServer::SetUserConnection()
+    {
+    iUserConnection = ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServer::ClearUserConnection
+// -----------------------------------------------------------------------------
+//
+inline void CMPMServer::ClearUserConnection()
+    {
+    iUserConnection = EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServer::UserConnection
+// -----------------------------------------------------------------------------
+//
+inline TBool CMPMServer::UserConnection() const
+    {
+    return iUserConnection;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServer::SetUserConnPref
+// -----------------------------------------------------------------------------
+//
+inline void CMPMServer::SetUserConnPref( const TMpmConnPref& aUserConnPref )
+    {
+    iUserConnPref = aUserConnPref;
+    }
+        
+// -----------------------------------------------------------------------------
+// CMPMServer::UserConnPref
+// -----------------------------------------------------------------------------
+//
+inline const TMpmConnPref* CMPMServer::UserConnPref() const
+    {
+    return &iUserConnPref;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServer::CsIdWatcher
+// -----------------------------------------------------------------------------
+//
+inline CMpmCsIdWatcher* CMPMServer::CsIdWatcher()
+    {
+    return iMpmCsIdWatcher;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServer::DedicatedClients
+// -----------------------------------------------------------------------------
+//
+inline RArray<TUint32>& CMPMServer::DedicatedClients()
+    {
+    return iDedicatedClients;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServer::CommsDatAccess
+// -----------------------------------------------------------------------------
+//
+inline CMPMCommsDatAccess* CMPMServer::CommsDatAccess()
+    {
+    return iCommsDatAccess;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServer::RoamingWatcher()
+// -----------------------------------------------------------------------------
+//
+CMPMRoamingWatcher* CMPMServer::RoamingWatcher() const
+    {
+    return iRoamingWatcher;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/inc/mpmserversession.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,968 @@
+/*
+* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: MPM server session class definitions
+*
+*/
+
+/**
+@file mpmserversession.h
+Mobility Policy Manager server session class definitions.
+*/
+
+#ifndef MPMSERVERSESSION_H
+#define MPMSERVERSESSION_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <commdbconnpref.h> // for TCommDbConnPref
+#include <connpref.h>       // for TConnPref
+#include <rconnmon.h>       // for TConnMonIapInfo
+#include <ConnectionUiUtilities.h> //TMsgQueryLinkedResults
+#include "rmpm.h"
+#include "mpmserver.h"
+
+// CONSTANTS
+const TUint32 KLowestPriority       = 2147483647; // 0x7FFFFFFF
+const TInt    KFirstArgument        = 0;
+const TInt    KSecondArgument       = 1;
+const TInt    KThirdArgument        = 2;
+const TInt    KFourthArgument       = 3;
+const TInt    KShift8               = 8;
+const TInt    KSmaller              = -1;
+const TInt    KEqual                = 0;
+const TInt    KBigger               = 1;
+const TUint32 KUidAlwaysOnlineStarter  = 0x101F85EE;
+const TUint32 KUidSimApplicationToolkit  = 0x1000A833;
+const TUint32 KUidBrowser           = 0x10008D39;
+const TUint32 KUidDVBH  = 0x10208413;
+const TUint32 KSortUncategorisedIaps  = 0;
+const TUint   KMPMNrWlansOne        = 1;
+const TUint   KMPMNrWlansTwo        = 2;
+const TInt    KMaxGetIntSettingLength = KCommsDbSvrMaxColumnNameLength * 2;
+_LIT( KIapProxyServiceSetting, "IAP\\IAPService" );
+
+// FORWARD DECLARATIONS
+class CMPMDisconnectDlg;
+class CMPMConfirmDlgRoaming;
+class CMPMCommsDatAccess;
+class CMPMIapSelection;
+
+// CLASS DECLARATION
+/**
+*  TNetIap
+*  Record for commdb IAP table search storage
+*  @lib MPMServer.exe
+*  @since 3.0
+*/
+class TNetIap
+    { 
+    public: // Constructors and destructor
+
+        /**
+        * Constructor.
+        */
+        TNetIap();
+
+    public: // New methods
+
+        /**
+        * Ordering method of class objects.
+        * @since 3.2
+        * @param aFirst First object for comparison
+        * @param aSecond Second object for comparison
+        * @return -1 if aFirst.iRanking >  aSecond.iRanking
+        *          1 if aFirst.iRanking <  aSecond.iRanking
+        *          0 if aFirst.iRanking == aSecond.iRanking
+        */
+        static TInt CompareRanking(const TNetIap& aFirst, const TNetIap& aSecond);
+
+
+        /**
+        * Ordering method of class objects. Compares iGlobalPriority and if those values 
+        * are equal return value is determined based on iRanking by CompareRanking function.
+        * @since 3.2
+        * @param aFirst First object for comparison
+        * @param aSecond Second object for comparison
+        * @return -1 if aFirst is higher
+        *          1 if aFirst is lower
+        *          0 if argument objects are equal
+        */
+        static TInt CompareGlobalAndLocalPriority(const TNetIap& aFirst, const TNetIap& aSecond);
+
+    public: // Data
+        // SNAP
+        TUint32 iSnap;
+        
+        // Embedded SNAP
+        TUint32 iEmbeddedSnap;
+        
+        // IAP Id
+        TUint32 iIapId;
+
+        // Priority
+        TUint32 iRanking;
+
+        // Global bearer priority
+        TUint32 iGlobalPriority;
+    };
+
+/**
+* Stores data of whether Preferred IAP Notifications may 
+* be sent immediately and stores IAP information for later handling.
+* 
+* @lib MPMServer.exe
+* @since 3.2
+*/
+class TStoredIapInfo
+    {
+    public:
+        /**
+        * Constructor.
+        */
+        TStoredIapInfo();
+        
+        /**
+        * Checks if Preferred IAP notification can 
+        * be sent immediately or not
+        *
+        * @return ETrue if preferred IAP notification 
+        * can't be sent immediately
+        */
+        TBool HoldPrefIapNotif() const;
+
+        /**
+        * Sets iHoldPrefIapNotif to true, so that notifications 
+        * won't be sent.
+        *
+        */
+        void SetHoldPrefIapNotif();
+
+        /**
+        * Checks if there is stored IAP info to be handled.
+        * Sets iHoldPrefIapNotif to false so notifications can be sent. 
+        *
+        * @param aStoredIapInfo If stored IAP info exists it is 
+        * written to this argument.
+        * @return ETrue if IAP info to be handled exists
+        */
+        TBool HandleIapInfoWaiting( TConnMonIapInfo& aStoredIapInfo );
+
+        /**
+        * Sets iStoredIapInfo 
+        *
+        * @param aStoredIapInfo IAP info to be stored
+        */
+        void SetStoredIapInfo( const TConnMonIapInfo& aStoredIapInfo );
+
+        /**
+        * Clears data so that Pref IAP notifs can be sent 
+        * and no IAP info is stored.
+        *
+        */
+        void ResetStoredIapInfo();
+
+    private:
+    
+        // True if Preferred IAP Notifications 
+	    // should be stored for later handling
+	    TBool iHoldPrefIapNotif;
+	    
+	    // True if there is an IAP info waiting 
+	    // for handling
+	    TBool iIapInfoWaiting;
+	    
+	    // Stored IAP info
+	    TConnMonIapInfo iStoredIapInfo;
+    };
+
+// States for migrating
+//
+enum TMigrateToCarrierState
+    {
+    EMigrateNone,
+    EMigrateUserConfirmation,
+    EMigrateOfflineConfirmation
+    };
+    
+// CLASS DECLARATION
+/**
+*  Mobility Policy Manager server session.
+*  An instance of class CMPMServerSession is created for each client
+*  @lib MPMServer.exe
+*  @since 3.0
+*/
+class CMPMServerSession : public CSession2
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CMPMServerSession* NewL(CMPMServer& aServer);
+
+        /**
+        * Destructor.
+        */
+        virtual ~CMPMServerSession();
+
+    public: // New methods
+
+        /**
+        * Sets iDisconnectDlg pointer to NULL.
+        * @since 3.1
+        */
+        inline void SetDisconnectDlgPtrNull();
+
+        /**
+        * Sets iConfirmDlgRoaming pointer to NULL.
+        * @since 3.2
+        */
+        inline void SetConfirmDlgRoamingPtrNull();
+
+        /**
+        * Gets the value of iMyServer.
+        * @since 3.1
+        * @return Value of iMyServer
+        */
+        inline CMPMServer& MyServer();
+
+        /**
+        * Returns iIapSelection.
+        *
+        * @since 3.2
+        * @return Value of iIapSelection
+        */
+        CMPMIapSelection* IapSelectionL();
+
+        /**
+        * Gets the value of iConnId.
+        * @since 3.1
+        * @return Value of iConnId
+        */
+        inline TConnectionId ConnectionId() const;
+
+        /**
+        * Checks the need for preferred IAP notification.
+        * @since 3.1
+        * @param aIapInfo Info about available IAPs
+        * @param aCaller Info about component which initiated this call
+        */
+        void PrefIAPNotificationL( const TConnMonIapInfo&    aIapInfo,
+                                   const TPrefIAPNotifCaller aCaller );
+
+        /**
+        * Starts sending preferred IAP notification.
+        * @since 3.2
+        * @param aIapId IAP Id 
+        */
+        void StartIAPNotificationL( const TUint32 aIapId );
+
+        /**
+        * Sends Stop IAP notification.
+        * @param aIapId IAP Id 
+        */
+        void StopIAPNotificationL( TInt aIapId = 0 );
+
+        /**
+        * Sends mobility error notification.
+        * @since 5.2
+        * @param aError Error code
+        */
+        void MobilityErrorNotificationL( TInt aError );
+        
+        /**
+        * Sends client error notification.
+        * @since 5.2
+        * @param aError Error code
+        */
+        void ClientErrorNotificationL( TInt aError );
+
+        /**
+        * Checks if phone is in offline mode or not.
+        * @since 3.1
+        * @return ETrue if phone is in offline mode, otherwise EFalse.
+        */
+        TBool IsPhoneOfflineL() const;
+
+        /**
+        * Returns the list of available IAPs, where the blacklisted IAPs 
+        * have already been removed.
+        * @since 3.2
+        * @param aAvailableIAPs List of IAPs 
+        * @param aConnId Connection Id
+        */
+        void AvailableUnblacklistedIapsL( RAvailableIAPList&  aAvailableIAPs,
+                                          const TConnectionId aConnId );
+
+        /**
+        * Completing sorting request.
+        * @since 3.2
+        */
+        void CompleteServerSortSNAP();
+
+        /**
+        * Completing process error call after WLAN scan.
+        * @since 3.2
+        */
+        void ProcessErrorWlanScanCompletedL();
+
+        /**
+        * Sort Snap functionality
+        *
+        * @since 3.2
+        * @param aSnapId Snap to be sorted
+        * @param aSortedIaps Buffer which will be set to 
+        * contain the sorted iaps
+        */
+        void SortSnapL( const TUint32   aSnapId, 
+                        TMpmSnapBuffer& aSortedIaps );
+
+        /**
+        * If session is displaying connection selection dialog
+        * updated contents for it are written to publish& subscribe API.
+        *
+        * @since 3.2
+        */
+        void UpdateConnectionDialogL();
+
+        /**
+        * Returns a reference to iStoredIapInfo. 
+        *
+        * @since 3.2
+        * @return Reference to iStoredIapInfo
+        */        
+        inline TStoredIapInfo& StoredIapInfo();
+
+        /**
+        * Completes carrier rejected request. Attempts to select
+        * new IAP to use and if successful sends a preferred iap
+        * notification. If not successful, sends error notification. 
+        *
+        * @since 3.2
+        */        
+        void CompleteCarrierRejected();
+
+        /**
+        * Handling of whether it is required to display 
+        * a confirmation dialog or not.
+        * @since 3.2
+        * @param aIapId IAP Id of the connection.
+        */
+        TBool IsConfirmFirstL( const TUint32 aIapId );
+
+        /**
+        * Completing choose iap request. Status and resulting
+        * preferences (if preferences exist) are passed back to client.
+        * @since 3.2
+        * @param aError Message status
+        * @param aPolicyPref Policy preference to be returned, NULL if no 
+        * preference should be passed
+        */
+        void ChooseIapComplete( TInt                aError,
+                                const TMpmConnPref* aPolicyPref );
+
+        /**
+        * Completing process error request. Error value and needed action
+        * are passed back to client.
+        * @since 3.2
+        * @param aError Message status
+        * @param aErrorReturned Error value to be returned, NULL if no 
+        * value should be passed
+        * @param aNeededAction Needed action to be returned, NULL if no 
+        * value should be passed
+        */
+        void ProcessErrorComplete( TInt             aError, 
+                                   TInt*            aErrorReturned,
+                                   TBMNeededAction* aNeededAction );
+
+        /**
+        * Callback for handling migrate state transitions.
+        *
+        * @param aError Error code
+        */
+        void MigrateCallbackL( TInt aError );
+
+        /**
+        * Callback for roaming user confirmation.
+        *
+        * @param aError Error code
+        * @param aResponse User response
+        * @param aReconnect True if confirmation was a reconnect dialog
+        */
+        void RoamingConfirmationCompletedL( TInt aError, TMsgQueryLinkedResults aResponse, TBool aReconnect );
+        
+        /**
+         * Set user connection flag
+         * @since 5.1
+         */
+        inline void SetUserConnection();
+        
+        /**
+         * Set when this session has user connection flag set
+         * @since 5.1
+         * @return ETrue if user connection is active in this session.
+         */
+        inline TBool UserConnection() const;
+        
+        /**
+         * Clear user connection flag
+         * @since 5.1
+         */        
+        inline void ClearUserConnection();
+
+        /**
+         * Use user connection preferences
+         * @since 5.1
+         */
+        TBool UseUserConnPref();
+        
+        /**
+        * Returns id of the client.
+        *
+        * @since 5.0
+        * @return Id of the client
+        */
+        inline TUint32 AppUid() const;
+
+        /**
+        * To determine whether choose best iap is called for this ession..
+        *
+        * @since 5.2
+        * @return True is choose best iap is called for this session
+        */
+        inline TBool ChooseBestIapCalled() const;
+
+#ifdef _DEBUG
+        /**
+         * Forces MPM to send StopIAPNotification in DEBUG MODE only
+         */
+        void HandleDebugGenerateStopIAPNotification( const RMessage2& aMessage );
+        /**
+         * Forces MPM to filter connmon events
+         */
+        void HandleDebugFilterConnMonEvents( const RMessage2& aMessage, const TBool aVal );       
+        /**
+         * Forces MPM to shutdown
+         */
+        void HandleDebugShutdown( const RMessage2& aMessage, const TBool aVal );
+#endif //_DEBUG
+
+        /**
+         * Stops connection
+         */                
+        TInt StopConnection();
+        
+        /**
+        * Returns true if preferred iap notification is requested.
+        *
+        * @since 5.2
+        * @return Ture or false depending on state.
+        */
+        inline TBool PreferredIapRequested() const;
+        
+        /**
+        * To determine whether only WLAN is allowed in current network
+        *
+        * @since 5.2
+        * @param aNewWlansAllowed ETrue if new WLANs can be prompted to the user by MPM
+        * @return ETrue if only WLAN is allowed 
+        */
+        TBool IsWlanOnlyL( TBool& aNewWlansAllowed );
+        
+        /**
+        * Returns custom preference's forced roaming value
+        * @since 5.2
+        * @return forced roaming state
+        */
+        TBool ForcedRoaming();
+
+        /**
+         * Get available iaps
+         * @since 5.2
+         * @return Returns list of available iaps.
+         */
+        TConnMonIapInfo GetAvailableIAPs();
+
+        /**
+         * Is bearer accepted
+         * @since 5.2
+         * @param aBearerType Bearer type to be checked (WLAN or packet data)
+         * @return Returns true if given bearer is accepted by this session.
+         */
+        TBool IsBearerAccepted( TMPMBearerType aBearerType );
+        
+        /**
+        * To determine whether IAP is used for MMS
+        *
+        * @since 5.2
+        * @param aIap Iap to be checked
+        * @return ETrue if Iap is used for MMS 
+        */
+        TBool IsMMSIap( TUint32 aIap );
+        
+    public: // Functions from base classes
+
+        /**
+        * From CSession2. Service dispathcer.
+        * @since 3.0
+        * @param aMessage Message from the client
+        */
+        void ServiceL(const RMessage2& aMessage);
+
+        /**
+        * From CSession2. Service error handling.
+        * @since 3.2
+        * @param aMessage Message from the client
+        * @param aError Error code
+        */
+        void ServiceError(const RMessage2& aMessage, TInt aError);
+
+    private: // Constructors
+
+        /**
+        * C++ default constructor.
+        */
+        CMPMServerSession(CMPMServer& aServer);
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL() ;
+
+    private: // New methods
+
+        /**
+        * Handling of IAP selection.
+        * @since 3.0
+        * @param aMessage message from client
+        */
+        void HandleServerChooseIapL(const RMessage2& aMessage);
+
+        /**
+        * Handling of request canceling.
+        * @since 3.0
+        * @param aMessage message from client
+        */
+        void HandleServerCancelRequest(const RMessage2& aMessage);
+
+        /**
+        * Handling of BM application specific connection addition.
+        * @since 3.2
+        * @param aMessage message from client
+        */
+        void HandleServerApplicationJoinsConnection( 
+                const RMessage2& aMessage);
+
+        /**
+        * Handling of BM application specific connection removal.
+        * @since 3.1
+        * @param aMessage message from client
+        */
+        void HandleServerApplicationLeavesConnection(
+                const RMessage2& aMessage);
+
+        /**
+        * Handling of total BM IAP connection addition.
+        * @since 3.2
+        * @param aMessage message from client
+        */
+        void HandleServerIapConnectionActivatedL(const RMessage2& aMessage);
+
+        /**
+        * Handling of total BM IAP connection addition.
+        * @since 3.2
+        * @param aMessage message from client
+        */
+        void HandleServerIapConnectionStartedL(const RMessage2& aMessage);
+
+        /**
+        * Handling of total BM IAP connection removal.
+        * @since 3.1
+        * @param aMessage message from client
+        */
+        void HandleServerIapConnectionStopped( const RMessage2& aMessage );
+
+        /**
+        * Handling of application connection ending.
+        * @since 3.2
+        * @param aMessage message from client
+        */
+        void HandleServerApplicationConnectionEnds(
+                                            const RMessage2& aMessage );
+        /**
+        * Handling of error processing.
+        * @since 3.1
+        * @param aMessage message from client
+        */
+        void HandleServerProcessErrorL(const RMessage2& aMessage);
+
+        /**
+        * Handling of prefered IAP notification registration.
+        * @since 3.1
+        * @param aMessage message from client
+        */
+        void HandleServerRegisterPrefIAPNotifL(const RMessage2& aMessage);
+
+        /**
+        * Handling of preferred IAP notification unregistration.
+        * @since 3.1
+        * @param aMessage message from client
+        */
+        void HandleServerUnregisterPrefIAPNotif(const RMessage2& aMessage);
+
+        /**
+        * Handling of notification request.
+        * @since 3.1
+        * @param aMessage message from client
+        */
+        void HandleServerWaitNotificationL(const RMessage2& aMessage);
+
+        /**
+        * Handling of sorting request.
+        * @since 3.2
+        * @param aMessage message from client
+        */
+        void HandleServerSortSNAPL(const RMessage2& aMessage);
+
+        /**
+        * Handling of application migrating to carrier.
+        * @since 3.2
+        * @param aMessage message from client
+        */
+        void HandleServerApplicationMigratesToCarrierL(
+                                                const RMessage2& aMessage);
+
+        /**
+        * Handling of application ignoring the carrier.
+        * @since 3.2
+        * @param aMessage message from client
+        */
+        void HandleServerApplicationIgnoredTheCarrier(
+                                                const RMessage2& aMessage);
+
+        /**
+        * Handling of application accepting the carrier.
+        * @since 3.2
+        * @param aMessage message from client
+        */
+        void HandleServerApplicationAcceptedTheCarrier(
+                                                const RMessage2& aMessage);
+
+        /**
+        * Handling of application rejecting the carrier.
+        * @since 3.2
+        * @param aMessage message from client
+        */
+        void HandleServerApplicationRejectedTheCarrierL(
+                                                const RMessage2& aMessage);
+
+        /**
+        * Handling of ReselectBestIap call.
+        * @since 9.1
+        * @param aMessage message from client
+        */
+        void HandleServerReselectIapL( const RMessage2& aMessage);
+
+        /**
+        * Extracts connection preferences into format suitable for MPM
+        * and validates that connection preferences are valid.
+        * All different type of connection preferences are mapped and
+        * converted into TMpmConnPref.
+        * Only a a single TMpmConnPref is extracted from the given TConnPref.
+        * That is, only one connection attempt is tried and thus only the
+        * first preferences are taken if TCommDbMultiConnPref is provided.
+        * This function also sets connection type which MPM uses later to 
+        * select correct IAP in the requested manner.
+        * @since 3.0
+        * @param aBasePref Connection preferences to be extracted.
+        * @param aMpmConnPref Extracted connection preferences.
+        * @return KErrNone if successful, otherwise one of the
+        * system-wide error codes
+        */
+        TInt ExtractConnPref(
+            const TConnPref& aBasePref,
+            TMpmConnPref& aMpmConnPref ) const;
+
+        /**
+        * Extracts TCommDBConnPref connection preferences into format suitable
+        * for MPM and validates that connection preferences are valid.
+        * @since 3.0
+        * @param aBasePref TCommDBConnPref connection preferences.
+        * @param aMpmConnPref Extracted connection preferences.
+        * @return KErrNone if successful, otherwise KErrArgument.
+        */
+        TInt ExtractConnPrefCommDb(
+            const TConnPref& aBasePref,
+            TMpmConnPref& aMpmConnPref ) const;
+
+        /**
+        * Extracts TCommDbMultiConnPref connection preferences into format
+        * suitable for MPM and validates that connection preferences are
+        * valid.
+        * @since 3.0
+        * @param aBasePref TCommDbMultiConnPref connection preferences.
+        * @param aMpmConnPref Extracted connection preferences.
+        * @return KErrNone if successful, otherwise KErrArgument.
+        */
+        TInt ExtractConnPrefCommDbMulti(
+            const TConnPref& aBasePref,
+            TMpmConnPref& aMpmConnPref ) const;
+
+        /**
+        * Extracts TConnSnapPref connection preferences into format suitable
+        * for MPM and validates that connection preferences are valid.
+        * @since 3.0
+        * @param aBasePref TConnSnapPref connection preferences.
+        * @param aMpmConnPref Extracted connection preferences.
+        * @return KErrNone if successful, otherwise one of the
+        *         system-wide error codes.
+        */
+        TInt ExtractConnPrefSnap(
+            const TConnPref& aBasePref,
+            TMpmConnPref& aMpmConnPref ) const;
+
+        /**
+        * Extracts TMpmConnPref connection preferences into format suitable
+        * for MPM and validates that connection preferences are valid.
+        * It's obvious that aBasePref is already in right format.
+        * This function, however, fills in some of the extra field not
+        * existing in TExtendedConnPref and validates preferences.
+        * @since 5.2
+        * @param aBasePref TMpmConnPref connection preferences.
+        * @param aMpmConnPref MPM connection preferences.
+        * @param KErrNone in success, otherwise one of the
+        *         system-wide error codes.
+        */
+        TInt ExtractConnPrefMpm(
+            const TConnPref& aBasePref,
+            TMpmConnPref& aMpmConnPref ) const;
+
+        /**
+        * Validates extended connection preferences.
+        * Although the input for this function is TMpmConnPref,
+        * the purpose of this function is to verify TExtendedConnPref
+        * into which TMpmConnPref object's first fields match exactly.
+        * @since 5.2
+        * @param aMpmConnPref Custom preferences to be validated.
+        * @return KErrNone if extended connection preferences are valid.
+        *         Otherwise KErrArgument.
+        */
+        TInt ValidateExtendedConnPref( TMpmConnPref& aMpmConnPref ) const;
+
+        /**
+        * Resolves connection type based on the other attributes
+        * in MPM connection preferences.
+        * @since 3.0
+        * @param aMpmConnPref Extracted connection preferences.
+        */
+        void ResolveConnType( TMpmConnPref& aMpmConnPref ) const;
+
+        /**
+        * Resolves original Service Id.
+        * @since 5.2
+        * @return The found service id. KErrNotFound if not ok.
+        */
+        TInt GetServiceIdSettingL();
+
+        /**
+        * Returns the list of available IAPs, where the blacklisted IAPs 
+        * have already been removed.
+        * @since 3.2
+        * @param aAvailableIAPs List of IAPs 
+        * @param aIapInfo Info about available IAPs
+        * @param aConnId Connection Id
+        */
+        void AvailableUnblacklistedIapsL( RAvailableIAPList&        aAvailableIAPs,
+                                          const TConnMonIapInfo&    aIapInfo, 
+                                          const TConnectionId       aConnId );
+
+        /**
+        * Checks if the given Iap Id is an upgrade or downgrade.
+        * @since 3.2
+        * @param aIapId Given Iap Id 
+        * @param aMigrateIapId Iap Id where application is roaming 
+        * @param aAvailableIAPs List of IAPs 
+        * return ETrue if upgrade, otherwise EFalse.
+        */
+        TBool IsUpgrade( const TUint32            aIapId, 
+                         const TUint32            aMigrateIapId,
+                         const RAvailableIAPList& aAvailableIAPs ) const;
+
+        /**
+        * Checks if there is a need to send preferred IAP notification.
+        * @since 3.2
+        * @param aCurrentIap Current Iap Id of connection
+        * @param aLastNotifiedIap Last notified Iap Id
+        * @param aValidatedIap Iap validated by MPM for roaming
+        * @return ETrue if necessary, otherwise EFalse.
+        */
+        TBool CheckNotifNeed( const TUint32       aCurrentIap,
+                              const TUint32       aLastNotifiedIap,
+                              const TUint32       aValidatedIap );
+
+        /**
+        * Returns the list of unavailable IAPs.
+        * @since 3.2
+        * @param aAvailableIAPs Array of available IAPs
+        * @param aUnavailableIAPs Array of unavailable IAPs
+        */
+        void UnavailableIAPsL( const RAvailableIAPList aAvailableIAPs, 
+                               RAvailableIAPList&      aUnavailableIAPs );
+
+        /**
+        * Removes unavailable IAP Id.
+        * @since 3.2
+        * @param aIapInfo Info about available IAPs 
+        * @param aIapId IAP Id to be removed
+        */
+        void RemoveUnavailableIap( TConnMonIapInfo& aIapInfo, 
+                                   const TUint32    aIapId );
+
+        /**
+        * Determines whether the process uid belongs 
+        * to a background application.
+        * @since 3.2
+        * @param aUid Application Uid
+        */
+        TBool IsBackgroundApplication( TUint32 aUid ) const;
+
+        /**
+        * Checks if disconnect dialog should be displayed for this error
+        * @since 3.2
+        * @param aError Error code
+        */
+        TBool DisconnectDlgErrorCode( TInt aError ) const;
+        
+        /**
+        * Gets presumed Iap Id of this connection
+        *
+        * @since 3.2
+        * @return Presumed Iap Id
+        */
+        TUint32 GetPresumedIap();
+
+        /**
+        * Finshing migration. If no error, updates BM pref iap structure 
+        * and sends start iap notification.
+        *
+        * @param aError KErrNone if migration was succesful
+        */
+        void MigrateDoneL( TInt aError );
+        
+        /**
+        * Sends error notification.
+        * @since 5.2
+        * @param aNotificationType Type of the notification
+        * @param aError Error code
+        */
+        void ErrorNotificationL( TInt aError,
+                                 TMpmNotifications aNotificationType );
+        
+        /**
+         * Removes iaps not according to bearer set
+         * @since 5.2
+         * @param aAvailableIAPs List of available iaps.
+         */
+        void RemoveIapsAccordingToBearerSetL( TConnMonIapInfo& aAvailableIAPs );
+		
+        /**
+         * Checks whether preferences allow using WLAN connection
+         * @since 5.2
+         * @return ETrue if preferences allow WLAN otherwise EFalse
+         */
+        TBool PrefsAllowWlan();
+
+    private: // Data
+    
+        // Server class reference
+        CMPMServer& iMyServer;
+
+        // Pointer to the disconnect dialog active object
+        CMPMDisconnectDlg* iDisconnectDlg;
+
+        // Pointer to the roaming confirmation dialog active object
+        CMPMConfirmDlgRoaming* iConfirmDlgRoaming;
+
+        // Connection Id
+        TConnectionId iConnId;
+
+        // Flag for notification request activity
+        TBool iNotifRequested;
+        
+        // Flag for indicating mobility API support.
+        TBool iPreferredIAPRequested;
+
+        // Notification message
+        RMessage2 iNotifMessage;
+
+        // If offline feature is supported then this is ETrue
+        TBool iOfflineFeatureSupported;
+
+        // Iap Id of Easy WLAN
+        TUint32 iEasyWlanIap;
+
+        // Uid of the application
+        TUint32 iAppUid;
+
+        // Choose iap request message to be completed when 
+        // once MPM has received the asyncronous services from 
+        // other servers
+        // 
+        RMessage2 iChooseIapMessage;
+
+        // Process error request message to be completed when 
+        // MPM has received the asyncronous services from 
+        // other servers
+        //
+        // These messages are stored separately 
+        // 
+        RMessage2 iProcessErrorMessage;
+
+        // ServerSortSNAPL() request message to be completed  
+        // when MPM has received the asyncronous services 
+        // from other servers
+        //
+        RMessage2 iServerSortSNAPMessage;
+      
+        // Contains state info whether PrefIapnotifs can be sent 
+        // and saved IAP info structure.
+        //
+        TStoredIapInfo iStoredIapInfo;
+            
+        // Iap selection object
+        //    
+        CMPMIapSelection* iIapSelection;
+
+		// Stored state of migrating to carrier
+		// 
+		TMigrateToCarrierState iMigrateState;
+
+		// Last Iap notified using PreferredIap-notification
+		//
+		TUint32 iLastNotifiedIap;
+		
+		// Iap to which connection is migrating
+        //
+        TUint32 iMigrateIap;
+
+        // Set when this session is user connection
+		//
+        TBool iUserConnection;
+    };
+
+#include "mpmserversession.inl"
+    
+#endif // MPMSERVERSESSION_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/inc/mpmserversession.inl	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,116 @@
+/*
+* 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: Inline functions for CMPMServerSession class
+*
+*/
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::SetDisconnectDlgPtrNull
+// -----------------------------------------------------------------------------
+//
+inline void CMPMServerSession::SetDisconnectDlgPtrNull()
+    {
+    iDisconnectDlg = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::SetConfirmDlgRoamingPtrNull
+// -----------------------------------------------------------------------------
+//
+inline void CMPMServerSession::SetConfirmDlgRoamingPtrNull()
+    {
+    iConfirmDlgRoaming = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::MyServer
+// -----------------------------------------------------------------------------
+//
+inline CMPMServer& CMPMServerSession::MyServer()
+    {
+    return iMyServer;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::ConnectionId
+// -----------------------------------------------------------------------------
+//
+inline TConnectionId CMPMServerSession::ConnectionId() const
+    {
+    return iConnId;
+    }
+    
+// -----------------------------------------------------------------------------
+// CMPMServerSession::StoredIapInfo
+// -----------------------------------------------------------------------------
+//
+inline TStoredIapInfo& CMPMServerSession::StoredIapInfo()
+    {
+    return iStoredIapInfo;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::SetUserConnection
+// -----------------------------------------------------------------------------
+//
+inline void CMPMServerSession::SetUserConnection()
+    {
+    iUserConnection = ETrue;        
+    }
+        
+// -----------------------------------------------------------------------------
+// CMPMServerSession::ClearUserConnection
+// -----------------------------------------------------------------------------
+//
+inline void CMPMServerSession::ClearUserConnection()
+    {
+    iUserConnection = EFalse;
+    }
+        
+// -----------------------------------------------------------------------------
+// CMPMServerSession::UserConnection
+// -----------------------------------------------------------------------------
+//
+inline TBool CMPMServerSession::UserConnection() const
+    {
+    return iUserConnection;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::AppUid
+// -----------------------------------------------------------------------------
+//
+inline TUint32 CMPMServerSession::AppUid() const
+    {
+    return iAppUid;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::PreferredIapRequested
+// -----------------------------------------------------------------------------
+//
+inline TBool CMPMServerSession::PreferredIapRequested() const
+    {
+    return iPreferredIAPRequested;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::ChooseBestIapCalled
+// -----------------------------------------------------------------------------
+//
+inline TBool CMPMServerSession::ChooseBestIapCalled() const
+    {
+    return ( iIapSelection != NULL );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/inc/mpmstarter.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2004-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 header defines starter for MPM server
+*
+*/
+
+/**
+@file mpmstarter.h
+Mobility Policy Manager server starter definitions.
+*/
+
+#ifndef MPMSTARTER_H
+#define MPMSTARTER_H
+
+//  INCLUDES
+#include <e32svr.h>
+class CMPMServer;
+// CLASS DECLARATION
+/**
+*  Mobility Policy Manager server starter.
+*  @lib MPMServer.exe
+*  @since 3.0
+*/
+class MPMStarter
+    {
+    public: // New methods
+
+        /**
+        * Creates and starts server.
+        * @since 3.0
+        * @return Pointer to the server object.
+        */
+        static CServer2* CreateAndStartServerL();
+
+        /**
+        * Creates and starts server Default connection server.
+        * @since 3.2
+        * @return Pointer to the server object.
+        */
+        static CServer2* CreateDefaultConnServerL( CMPMServer* aMPMServer );
+
+        /**
+        * Gets server name.
+        * @since 3.0
+        * @return Descriptor of the server name.
+        */
+        static TPtrC ServerName();
+    };
+
+#endif // MPMSTARTER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/inc/mpmwlanavailability.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,123 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: WLAN availability check.
+*
+*/
+
+/**
+@file mpmwlanavailability.h
+WLAN availability check definition.
+*/
+
+#ifndef MPMWLANAVAILABILITY_H
+#define MPMWLANAVAILABILITY_H
+
+// INCLUDES
+#include <e32base.h>
+#include <rconnmon.h>
+#include "mpmconnmonevents.h"
+
+// FORWARD DECLARATIONS
+class CMPMConnMonEvents;
+
+// CLASS DECLARATION
+/**
+*  WLAN availability check
+*
+*  @lib MPMServer.exe
+*  @since 5.2
+*/
+class MWlanAvailability
+    {
+    public:
+        /**
+        * WLAN availability check response
+        * @since 5.2
+        * @param aError generic Symbian error response code
+        * @param aResult Result of WLAN availability check
+        * @return void
+        */
+        virtual void WlanAvailabilityResponse( const TInt  aError, 
+                                               const TBool aResult ) = 0;
+    };
+
+// CLASS DECLARATION
+/**
+*  WLAN availability check implementation
+*
+*  @lib MPMServer.exe
+*  @since 5.2
+*/
+NONSHARABLE_CLASS( CWlanAvailability ) : public CActive
+    {
+    public:
+
+        /**
+        * Two-phased constructor.
+        */
+        static CWlanAvailability* NewL( CMPMConnMonEvents*  aConnMonEvents,
+                                        RConnectionMonitor& aConnMon );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CWlanAvailability();
+
+        /**
+        * For starting the active object.
+        * @since 5.2
+        */
+        void Start( MWlanAvailability* aObserver );
+        
+        /**
+         * For cancelling the request for an observer.
+         * @since 5.2
+         */
+        void CancelObserver( MWlanAvailability* aObserver );
+        
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CWlanAvailability( CMPMConnMonEvents*  aConnMonEvents,
+                           RConnectionMonitor& aConnMon );
+
+        /**
+        * 2nd phase constructor.
+        */
+        void ConstructL();
+
+    private: // from CActive
+
+        /**
+        * Active Object RunL.
+        */
+        void RunL();
+
+        /**
+        * Active Object DoCancel.
+        */
+        void DoCancel();
+
+    private:
+        
+        CMPMConnMonEvents*                  iConnMonEvents;
+        RConnectionMonitor&                 iConnMon;
+        RPointerArray< MWlanAvailability >  iObserver;
+        TRequestStatus                      iRequestStatus;
+        TBool                               iResult;
+    };
+
+#endif // MPMWLANAVAILABILITY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/inc/mpmwlanquerydialog.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,290 @@
+/*
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Handles displaying wlan related dialogs
+*
+*/
+
+
+#ifndef MPMWLANQUERYDIALOG_H
+#define MPMWLANQUERYDIALOG_H
+
+#include <e32std.h>
+#include <wdbifwlansettings.h> //for struct
+#include <ConnectionUiUtilities.h>
+#include <wifiprotuiclient.h>
+#include <wifiprotreturn.h>
+
+#include "mpmiapselection.h" // for TOfflineNoteResponse
+
+// ID of Easy Wep dialog
+const TUid KUidEasyWepDlg = { 0x101FD673 };
+
+// ID of Easy Wpa dialog
+const TUid KUidEasyWpaDlg = { 0x101FD674 };
+
+// ID of OfflineWlanNote dialog
+const TUid KUidCOfflineWlanNoteDlg = { 0x101FD671 };
+
+/**
+ * This structure is copied from ConnectionUiUtilitiesCommon.h,
+ * but given here a different name.
+ * Defines preferences of the Wlan Network
+ */
+class TMpmWlanNetworkPrefs
+    {
+public:
+    TWlanSsid                           iSsId;        ///< Ssid of Wlan network
+    TWlanConnectionMode                 iNetworkMode; ///< mode of Wlan network
+    TWlanConnectionSecurityMode         iSecMode;     ///< Security mode of Wlan network
+    TBool                               iProtectedSetupSupported; 
+                                        ///< Wlan network supports Protected Setup
+    };
+
+const TInt KEasyWepQuery256BitMaxLength = 58;
+
+class TWlanAgtWepKeyData
+    {
+public:
+    TBuf< KEasyWepQuery256BitMaxLength > iKey;
+    TBool iHex;
+    };
+
+class CMPMIapSelection;
+/**
+ *  Handles displaying wlan related dialogs
+ *
+ *  @lib mpmserver.exe
+ *  @since S60 v3.2
+ */
+class CMPMWlanQueryDialog : public CActive
+    {
+
+enum TWlanQueryState
+    {
+    EOffline,
+    EWlanNetwork,
+    EWepSettings,
+    EWpaSettings, 
+    EWPS,
+    ERetrySettingsStorage
+    };
+
+public:
+
+    static CMPMWlanQueryDialog* NewL( CMPMIapSelection&  aSession,
+                                      TUint32            aSelectedWlanIap );
+
+    /**
+    * Destructor.
+    */
+    virtual ~CMPMWlanQueryDialog();
+
+public: // Functions from base classes
+
+        /**
+        * From CActive. Cancels UI dialogs.
+        * @since 3.2
+        */        
+        void DoCancel();
+        
+        /**
+        * From CActive. Run when UI dialog finished.
+        * @since 3.2
+        */               
+        void RunL();
+        
+        /**
+        * From CActive. Run if RunL leaves.
+        * @since 3.2
+        * @param aError Error that caused leave.
+        * @return KErrNone
+        */
+        TInt RunError( TInt aError );
+
+public:
+
+        /**
+        * Starts displaying wlan dialogs if necessary
+        * @since 3.2
+        */
+        void StartWlanQueryL();
+        
+        /**
+        * Stores user defined easy wlan parameters to commsdat
+        * if easy wlan has been selected.
+        *
+        * @since 3.2
+        */
+        void StoreEasyWlanSelectionL();
+
+private:
+
+        /**
+         * Propagates wlan network selection as an initial value for the dialog,
+         * Used if there are several dialogs queued.
+         *
+         * @param aWlanIapId     Selected WLAN IAP
+         * @param aOfflineStatus Offline note response
+         * @param aDialogStatus  Status of the dialog when destroyed.
+         * @since 3.2
+         */
+        void OfferInformation( TUint32 aWlanIapId, 
+                               TOfflineNoteResponse aOfflineStatus,
+                               TInt aDialogStatus );
+
+        CMPMWlanQueryDialog( CMPMIapSelection&  aSession,
+                             TUint32            aSelectedWlanIap );
+
+        void ConstructL();
+
+        /**
+        * Gets Easy Wlan data from member variables and stores 
+        * it to arguments
+        *
+        * @since 9.1
+        * @param aSsid Wlan iap ssid, stored in used ssid field
+        * @param aSecMode Wlan iap security mode
+        * @param aConnMode Wlan iap connection mode
+        * @param aWepKeyData Wlan iap wep key data
+        * @param aEnableWpaPsk Wlan iap enable psk mode
+        * @param aWpaPsk Wlan iap wpa psk
+        * @param aWpaKeyLen Wlan iap wpa key length
+        */
+        void GetEasyWlanDataL( TWlanSsid&    aSsid,
+                               TUint&        aSecMode,
+                               TWlanNetMode& aConnMode,
+                               TWepKeyData&  aWepKeyData, 
+                               TUint&        aEnableWpaPsk,
+                               TDes8&        aWpaPsk,
+                               TUint&        aWpaKeyLen  );
+
+        /**
+        * Maps TWlanConnectionSecurityMode to security mode stored in CommsDat
+        *
+        * @since 9.1
+        * @param aConnSecmode Security mode in TWlanConnectionSecurityMode format
+        * @param aCommsdatSecMode returned security mode value in CommsDat format
+        */
+        TInt ConnSecModeToCommsDatSecMode( TWlanConnectionSecurityMode aConnSecmode,
+                                           TUint& aCommsdatSecMode ) const;
+
+        /**
+        * Maps TWlanIapSecurityMode to security mode stored in CommsDat
+        *
+        * @since 9.1
+        * @param aConnSecmode Security mode in TWlanIapSecurityMode format
+        * @param aCommsdatSecMode returned security mode value in CommsDat format
+        */
+        TInt IapSecModeToCommsDatSecMode( TWlanIapSecurityMode aConnSecmode,
+                                          TUint& aCommsdatSecMode ) const;
+
+        /**
+        * Gets Easy Wlan data from member variables when WPS has been used 
+        * and stores it to arguments
+        *
+        * @since 9.1
+        * @param aSsid Wlan iap ssid, stored in used ssid field
+        * @param aSecMode Wlan iap security mode
+        * @param aConnMode Wlan iap connection mode
+        * @param aWepKeyData WEP key data
+        * @param aEnableWpaPsk Wlan iap enable psk mode
+        * @param aWpaPsk Wlan iap wpa psk
+        * @param aWpaKeyLen Wlan iap wpa key length
+        */
+        void GetEasyWlanDataForWpsL( TWlanSsid&    aSsid,
+                                     TUint&        aSecMode,
+                                     TWlanNetMode& aConnMode,
+                                     TWepKeyData&  aWepKeyData, 
+                                     TUint&        aEnableWpaPsk,
+                                     TDes8&        aWpaPsk,
+                                     TUint&        aWpaKeyLen  );
+
+        /**
+        * Starts WPS dialog and sets the active object active.
+        *
+        * @since 9.1
+        */
+        void StartWpsDlgL();
+
+        /**
+        * Determines whether WEP key is hex format based on the length
+        *
+        * @since 9.1
+        * @param aLength 
+        * @return ETrue if format is hex, otherwise EFalse
+        */
+        TBool IsWepFormatHexL( TInt aLength ) const;
+
+        /**
+        * Get the network preferences using ConnectionUiUtilities API.
+        *
+        * @since 5.1
+        */
+        void GetNetworkPrefs();
+
+private: // data
+
+        // Reference to iap selection object
+        CMPMIapSelection& iIapSelection;
+
+        // Stores data for offline note
+        TPckgBuf<TBool> iOfflineReply;
+        
+        // Stores data for wlan network guery
+        TPckgBuf<TMpmWlanNetworkPrefs> iNetworkPrefs;
+        
+        // Stores data for wep query
+        TPckgBuf<TWlanAgtWepKeyData> iNotifWep;
+        
+        // Stores data for wpa query
+        TPckgBuf< TBuf< KWLMMaxWpaPskLength > > iNotifWpaKey;
+
+        //Interfce to Notifier
+        RNotifier iNotifier;
+
+        //State of querying Wlan settings
+        TWlanQueryState iWlanQueryState;
+            
+        // selected wlan iap id
+        TUint32 iWlanIapId;
+            
+        // ETrue if user has selected easy wlan
+        TBool iEasyWlanSelected;
+            
+        // Flag that can be used to cancel the dialog startup based on earlier dialog
+        TInt iOverrideStatus;
+            
+        // Connection Ui Utilities pointer
+        CConnectionUiUtilities* iConnUiUtils;
+
+        // Contains WLAN settings received through WPS
+        TWlanProtectedSetupCredentialAttribute iWpsAttribute;
+
+        // WPS client pointer for displaying WPS dialogs
+        CWiFiProtUiClient* iWps;
+
+        // Contains WPS return value
+        WiFiProt::TWiFiReturn iWpsReturn;
+
+        // True if wps has been completed. 
+        TBool iWpsCompleted;
+        
+        // Retry count
+        TUint32 iRetryCount;
+        
+        // Retry timer
+        RTimer iTimer;
+    };
+
+#endif // MPMWLANQUERYDIALOG_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/inc/rmpm.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,976 @@
+/*
+* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This header defines the client API for MPM server
+*
+*/
+
+/**
+@file rmpm.h
+Mobility Policy Manager server client interface definitions.
+*/
+
+#ifndef RMPM_H
+#define RMPM_H
+
+// INCLUDES
+#include <e32base.h>
+#include <e32std.h>
+#include <wlanmgmtcommon.h> // TWlanSsid
+#include <e32property.h>    //publish and subscribe
+#include <cmmanagerdef.h>
+#include <extendedconnpref.h>
+
+// FORWARD DECLARATIONS
+
+// CONSTANTS
+// Number of pointers allocated for client-server inter-thread reads/writes
+const TUint KNumPtrs = 8;
+// Event buffer, adjust size to the proper value
+const TUint KMpmMessageLength   = 512;
+const TUint KMpmMaxIAPCount     = 25;
+
+// Definitions for Reading/Writing sort snap data 
+// to publish and subscribe API
+//
+// UID of the category
+const TUid KMPMSortSnapCategory = { 0x101f6d3a };
+
+// Property type. Each key contains binary data in 
+// TMpmSnapPubSubFormat format
+const TInt KMPMSortSnapType = RProperty::EByteArray;
+
+// Maximum property key value. Key values start from 0.
+// MPM will always write data at least for uncategorised 
+// entry (iap list may be empty). 
+const TInt KMPMSortSnapMaxKey = 25;
+
+// Read policy, no capabilities required
+// This format is used instead of _LIT_SECURITY_POLICY_PASS, which 
+// produces pclint warnings
+_LIT_SECURITY_POLICY_C1( KMPMSortSnapReadPolicy, ECapability_None );
+
+// Write policy
+_LIT_SECURITY_POLICY_C1( KMPMSortSnapWritePolicy, ECapabilityNetworkControl );
+
+// Definitions for Reading/Writing user connection data
+// to publish and subscribe API
+//
+// UID of the category (note that uid is the same as sort snap category)
+const TUid KMPMUserConnectionCategory = { 0x101f6d3a };
+
+// Keys for this category
+const TUint KMPMPSKeyUserConnectionSnap = 10001;
+const TUint KMPMPSKeyUserConnectionIap = 10002;
+
+// Property types
+const TInt KMPMUserConnectionSnapType = RProperty::EInt;
+const TInt KMPMUserConnectionIapType = RProperty::EInt;
+
+// Read policy, no capabilities required
+// This format is used instead of _LIT_SECURITY_POLICY_PASS, which 
+// produces pclint warnings
+_LIT_SECURITY_POLICY_C1( KMPMUserConnectionReadPolicy, ECapability_None );
+
+// Write policy
+_LIT_SECURITY_POLICY_C1( KMPMUserConnectionWritePolicy, ECapabilityNetworkControl );
+
+// Definitions for Reading/Writing active connection data 
+// to publish and subscribe API
+//
+// UID of the category
+const TUid KMPMActiveConnectionCategory = { 0x101f6d3a };
+
+// Property types
+const TInt KMPMActiveConnectionIapType = RProperty::EInt;
+const TInt KMPMActiveConnectionSnapType = RProperty::EInt;
+const TInt KMPMActiveConnectionBearerType = RProperty::EInt;
+
+// Keys for active connection category
+
+/**
+ * Iap Id of the active connection.
+ * If set to zero then no active connection
+ */
+const TUint KMPMPSKeyActiveConnectionIap = 10003;
+
+/**
+ * Snap Id of the active connection.
+ * If set to zero then possible iap connection
+ */
+const TUint KMPMPSKeyActiveConnectionSnap = 10004;
+
+/**
+ * Possible values:
+ * 0,
+ * KCommDbBearerVirtual,
+ * KCommDbBearerWLAN,
+ * KCommDbBearerWcdma,
+ * KCommDbBearerUnknown,
+ */
+const TUint KMPMPSKeyActiveConnectionBearer = 10005;
+
+// Read policy, no capabilities required
+// This format is used instead of _LIT_SECURITY_POLICY_PASS, which 
+// produces pclint warnings
+_LIT_SECURITY_POLICY_C1( KMPMActiveConnectionReadPolicy, ECapability_None );
+
+// Write policy
+_LIT_SECURITY_POLICY_C1( KMPMActiveConnectionWritePolicy, ECapabilityNetworkControl );
+
+// MACROS
+_LIT( KPanicCategory, "MPM Client" );
+
+// DATA TYPES
+typedef RArray<TUint32>             RAvailableIAPList;
+typedef TBuf8<KMpmMessageLength>    TMPMMessageBuffer;
+typedef TUint32                     TConnectionId;
+
+// Notification codes
+enum TMpmNotifications
+    {
+    EMPMNotificationNone = 0, // NOP
+    EMPMPreferredIAPAvailable,
+    EMPMMobilityErrorNotification,
+    EMPMClientErrorNotification,
+    EMPMStartIAPNotification,
+    EMPMStopIAPNotification
+    };
+
+// Asynchronous codes
+enum TMpmAsynchCodes
+    {
+    EMPMChooseBestIAP = 1,
+    EMPMReselectBestIAP,
+    EMPMProcessError,
+    EMPMWaitNotification,
+    EMPMSortSNAP,
+#ifdef _DEBUG
+    EMPMDebugGenerateStopIAPNotification = 500,
+    EMPMDebugSwitchConnMonEventsOn = 501,
+    EMPMDebugSwitchConnMonEventsOff = 502,
+    EMPMDebugShutdown = 503,
+#endif
+    };
+
+enum TBMNeededAction
+    {
+    EIgnoreError = 0,
+    EPropagateError,
+    EDoReselection
+    };
+
+// CLASS DECLARATION
+/**
+*  Contains the sorted list of IAPs belonging to the specified SNAP. 
+*  Used by method SortSNAP.
+*
+*  @since 3.2
+*/
+NONSHARABLE_CLASS( TMpmSnapBuffer )
+    {
+    public:
+        // Zero values 
+        inline void Reset();    
+        inline const TInt Count() const;
+
+    public:
+        TUint   iCount;
+        TUint32 iIapId[KMpmMaxIAPCount];
+    };
+
+// CLASS DECLARATION
+/**
+*  Contains the sorted list of IAPs belonging to the specified SNAP. 
+*  Used by method SortSNAP.
+*
+*  @since 3.2
+*/
+NONSHARABLE_CLASS( TMpmSnapPubSubFormat )
+    {
+    public:
+        // Snap id. 0 is used for uncategorised
+        TUint32           iSnap;
+        // Iap ids
+        TMpmSnapBuffer  iSortedIaps;
+    };
+            
+// CLASS DECLARATION
+/**
+*  Helper class.
+*
+*  @since 3.2
+*/
+NONSHARABLE_CLASS( TStartIAPNotifInfo )
+    {
+    public:
+        // Zero values 
+        inline void Reset();    
+    public:
+        TUint32         iIap;
+        TConnectionId   iConnId; // useless
+        TUint32         iServiceId;
+    };
+    
+// CLASS DECLARATION
+/**
+*  Helper class.
+*
+*  @since 3.2
+*/
+NONSHARABLE_CLASS( TStopIAPNotifInfo )
+    {
+    public:
+        // Zero values 
+        inline void Reset();    
+    public:
+        TUint32         iIap;
+        TConnectionId   iConnId;
+    };
+    
+// CLASS DECLARATION
+/**
+*  Helper class.
+*
+*  @since 3.1
+*/
+NONSHARABLE_CLASS( TMpmNotification )
+    {
+    public:
+        TMpmNotifications iMPMNotificationType;
+        virtual TInt Length() = 0;
+    };
+
+// CLASS DECLARATION
+/**
+*  Helper class.
+*
+*  @since 3.1
+*/
+NONSHARABLE_CLASS( TMpmNotificationPrefIAPAvailable ) : 
+    public TMpmNotification
+    {
+    public:
+        inline TInt Length();
+
+    public:
+        TUint32      iOldIapId;
+        TUint32      iNewIapId;
+        TBool        iIsUpgrade;
+        TBool        iIsSeamless;
+        TUint32      iConnId;
+    };
+    
+// CLASS DECLARATION
+/**
+*  Helper class.
+*
+*  @since 3.2
+*/
+NONSHARABLE_CLASS( TMpmNotificationError ) : public TMpmNotification
+    {
+    public:
+        inline TInt Length();
+
+    public:
+        TInt    iError;
+        TUint32 iConnId;
+    };
+    
+
+// CLASS DECLARATION
+/**
+*  Helper class.
+*
+*  @since 3.2
+*/
+NONSHARABLE_CLASS( TMpmNotificationStartIAP ) : public TMpmNotification
+    {
+    public:
+        inline TInt Length();
+    public:
+        TStartIAPNotifInfo iInfo;
+    };
+    
+// CLASS DECLARATION
+/**
+*  Helper class.
+*
+*  @since 3.2
+*/
+NONSHARABLE_CLASS( TMpmNotificationStopIAP ) : public TMpmNotification
+    {
+    public:
+        inline TInt Length();
+    public:
+        TStopIAPNotifInfo iInfo;
+    };
+
+// CLASS DECLARATION
+/**
+*  ChooseBestIAPPolicyResponse
+*  Identical in size with the TConnPref but contains different fields
+*  
+*  @since 5.2
+*/
+struct SPolicyConnPref
+    {
+    TUint32 iIapId;
+    TUint32 iNetId;
+    TUint32 iSnapAPId;
+    TUint32 iServiceId; // Is the original IAP's Service ID
+    };
+
+NONSHARABLE_CLASS( TPolicyConnPref ) : public TConnPref
+    {
+protected:
+    inline SPolicyConnPref* PrefPtr() const {
+    return reinterpret_cast<SPolicyConnPref*>(UserPtr());
+    }
+    
+public:
+    enum { EConnS60PolicyPref = 0x0f }; // TConnPref has defined up to 0x07.
+    inline TPolicyConnPref::TPolicyConnPref()
+    : TConnPref( TPolicyConnPref::EConnS60PolicyPref )
+        {
+        SetIapId( 0 );
+        SetNetId( 0 );
+        SetSnapAPId( 0 );
+        SetServiceId( 0 );
+        }
+
+public:
+    inline void SetIapId( TUint32 aIapId ) { PrefPtr()->iIapId = aIapId; };
+    inline TUint32 IapId() const { return PrefPtr()->iIapId; };
+
+    inline void SetNetId( TUint32 aNetId ) { PrefPtr()->iNetId = aNetId; };
+    inline TUint32 NetId() const { return PrefPtr()->iNetId; };
+
+    inline void SetSnapAPId( TUint32 aSnapAPId ) { PrefPtr()->iSnapAPId = aSnapAPId; };
+    inline TUint32 SnapAPId() const { return PrefPtr()->iSnapAPId; };
+
+    inline void SetServiceId( TUint32 aServiceId ) { PrefPtr()->iServiceId = aServiceId; };
+    inline TUint32 ServiceId() const { return PrefPtr()->iServiceId; };
+    };
+    
+// CLASS DECLARATION
+/**
+*  ChooseBestIAPPolicyResponse
+*  Identical in size with the TConnPref but contains different fields
+*  
+*  @since 5.2
+*/
+struct SMpmConnPref
+    {
+    /** SNAP purpose. */
+    CMManager::TSnapPurpose iSnapPurpose;
+    /** SNAP id. */
+    TUint32 iSnapId;
+    /** IAP id. */
+    TUint32 iIapId;
+    /** Bearer set. */
+    TUint32 iBearerSet;
+    /** UI behaviour. */
+    TUint32 iNoteBehaviour;
+    /** Indicates whether UI disconnect dialog is shown. */
+    TBool iDisconnectDialog;
+    /** Indicates whether UI connection selection dialog is shown. */    
+    TBool iConnSelectionDialog;
+    /** Indicates whether forced roaming is enabled. */
+    TBool iForcedRoaming;
+    
+    // The following variables are used for internal functionality of the MPM.
+    // Client should not set these but leave it to MPM to fullfil them based
+    // on the above variables.
+
+    /**
+     * Connection type that has been requested from the MPM. This is used
+     * internally by MPM to select correct IAP in the requested manner.
+     */
+    TUint32 iConnType;
+    
+    /**
+     * Indicates whether the given IAP is forced to be used or whether other
+     * IAPs can be used. IAP is set to "mandated" when IAP id is given
+     * through TMpmConnPref (meaning it was given as TExtendedConnPref
+     * to RConnection::Start()). Otherwise IAP is not mandated
+     * because in the old way existing connection was allowed to be
+     * taken into use whenever an IAP was given.
+     */
+    TBool iMandateIap;
+
+    /**
+     * Access network id. Notice that this field always contains the access
+     * network id and this is not mixed with SNAP id into the same field as
+     * it used to be. SNAP id is in its own field. 
+     */
+    TUint32 iNetId;
+    };
+
+NONSHARABLE_CLASS( TMpmConnPref ) : public TConnPref
+    {
+    
+protected:
+    inline SMpmConnPref* PrefPtr() const {
+        return reinterpret_cast< SMpmConnPref* >( UserPtr() );
+    }
+
+public:
+    /**
+     * Extension id for MPM connection preferences.
+     * All connection preferences derived from TConnPref has an extension id. 
+     * TConnPref has defined up to 0x07 and TPolicyconnPref has 0x0f.
+     */
+    enum { EConnPrefMpm = 0x0e };
+
+    /**
+     * Connection type that has been requested from the MPM.
+     * This is used internally by MPM to select correct IAP
+     * in the requested manner.
+     */
+    enum EConnType {
+        /**
+         * Default connection is requested, that is, nobody requests
+         * specification connection.
+         */
+        EConnTypeDefault = 0,
+        /**
+         * User selects the connection by utilizing Connection Selection
+         * Dialog.
+         */
+        EConnTypeImplicit,
+        /**
+         * Client selects the connection by passing it via connection
+         * preferences.
+         */
+        EConnTypeExplicit
+    };
+    
+    inline TMpmConnPref::TMpmConnPref()
+    : TConnPref( TMpmConnPref::EConnPrefMpm )
+        {
+        SetSnapPurpose( CMManager::ESnapPurposeUnknown );
+        SetSnapId( 0 );
+        SetIapId( 0 );
+        SetBearerSet( TExtendedConnPref::EExtendedConnBearerUnknown );
+        SetNoteBehaviour( TExtendedConnPref::ENoteBehaviourDefault );
+        SetDisconnectDialog( ETrue );
+        SetConnSelectionDialog( EFalse );
+        SetForcedRoaming( ETrue );
+        SetConnType( EConnTypeDefault );
+        SetMandateIap( EFalse );
+        SetNetId( 0 );
+        }
+
+public:
+    inline void SetSnapPurpose( CMManager::TSnapPurpose aSnapPurpose ) { PrefPtr()->iSnapPurpose = aSnapPurpose; };
+    inline CMManager::TSnapPurpose SnapPurpose() const { return PrefPtr()->iSnapPurpose; };
+
+    inline void SetSnapId( TUint32 aSnapId ) { PrefPtr()->iSnapId = aSnapId; };
+    inline TUint32 SnapId() const { return PrefPtr()->iSnapId; };
+
+    inline void SetIapId( TUint32 aIapId ) { PrefPtr()->iIapId = aIapId; };
+    inline TUint32 IapId() const { return PrefPtr()->iIapId; };
+
+    inline void SetBearerSet( TUint32 aBearerSet ) { PrefPtr()->iBearerSet = aBearerSet; };
+    inline TUint32 BearerSet() const { return PrefPtr()->iBearerSet; };
+    
+    inline void SetNoteBehaviour( TUint32 aNoteBehaviour ) { PrefPtr()->iNoteBehaviour = aNoteBehaviour; };
+    inline TUint32 NoteBehaviour() const { return PrefPtr()->iNoteBehaviour; };
+
+    inline void SetDisconnectDialog( TBool aDisconnectDialog ) { PrefPtr()->iDisconnectDialog = aDisconnectDialog; };
+    inline TBool DisconnectDialog() const { return PrefPtr()->iDisconnectDialog; };
+    
+    inline void SetConnSelectionDialog( TBool aConnSelectionDialog ) { PrefPtr()->iConnSelectionDialog = aConnSelectionDialog; };
+    inline TBool ConnSelectionDialog() const { return PrefPtr()->iConnSelectionDialog; };
+
+    inline void SetForcedRoaming( TBool aForcedRoaming ) { PrefPtr()->iForcedRoaming = aForcedRoaming; };
+    inline TBool ForcedRoaming() const { return PrefPtr()->iForcedRoaming; };
+
+    inline void SetConnType( TMpmConnPref::EConnType aConnType ) { PrefPtr()->iConnType = (TUint32)aConnType; };
+    inline TMpmConnPref::EConnType ConnType() const { return (TMpmConnPref::EConnType)PrefPtr()->iConnType; };
+
+    inline void SetMandateIap( TBool aMandateIap ) { PrefPtr()->iMandateIap = aMandateIap; };
+    inline TBool MandateIap() const { return PrefPtr()->iMandateIap; };
+
+    inline void SetNetId( TUint32 aNetId ) { PrefPtr()->iNetId = aNetId; };
+    inline TUint32 NetId() const { return PrefPtr()->iNetId; };
+    };
+
+// CLASS DECLARATION
+/**
+*  Mobility Policy Manager server client interface.
+*
+*  @lib RMPM.lib
+*  @since 3.0
+*/
+class RMPM : public RSessionBase
+    {
+    public:   // Constructor
+
+        inline RMPM() : RSessionBase(), iConnected( EFalse ),
+                        iPtrArray(), iIndex( 0 ) {};
+
+    public: // New functions
+ 
+        /**
+         * Deprecated, doesn't do anything
+         * @since 3.0
+         * @return KErrNone
+         */
+        IMPORT_C TInt LaunchServer();
+
+        /**
+        * Connects client to a server session. It must be called
+        * before using other session specific methods.
+        * @since 3.0
+        * @return KErrNone if successful, otherwise one of the
+        * system-wide error codes
+        */
+        IMPORT_C TInt Connect();
+
+        /**
+        * Queries whether MPM is connected.
+        * @since 5.2
+        * @return ETrue if connected
+        */
+        IMPORT_C TBool Connected();
+
+        /**
+        * Connects client to a server session. It must be called
+        * before using other session specific methods.
+        * @since 5.2
+        * @return KErrNone if successful, otherwise one of the
+        * system-wide error codes
+        */
+        IMPORT_C void Connect( TRequestStatus& aStatus );
+
+        /**
+        * Returns MPM server version.
+        * @since 3.0
+        * @return Version of the MPM server
+        */
+        IMPORT_C TVersion Version() const;
+
+        /**
+        * Cancels asynchronous request. In the risk of deadlock use the SendCancelRequest()
+        * @since 3.1
+        * @param aReqToCancel request to be canceled
+        */
+        IMPORT_C void Cancel( TMpmAsynchCodes aReqToCancel ) const;
+
+        /**
+        * Asynchronous cancellation
+        * @since 5.2
+        * @param aReqToCancel request to be canceled
+        * @return KErrNone if cancel message sending was successful, otherwise one of the
+        * system-wide error codes
+        */
+        IMPORT_C TInt SendCancelRequest( TMpmAsynchCodes aReqToCancel ) const;
+
+        /**
+        * Closes MPM server session.
+        * @since 3.0
+        */        
+        IMPORT_C void Close();
+        
+        /**
+        * Initial select of the most prefered IAP for the connection.
+        * @since 3.1
+        * @param aConnPref Connection preferences from application 
+        * @param aConnId Connection Id
+        * @param aAppUid Application UId
+        * @param aPolicyPref Connection preferences chosen by MPM
+        * @param aStatus KErrNone if successful, otherwise one of the
+        * system-wide error codes
+        */
+        IMPORT_C void ChooseBestIAP( TConnPref&             aConnPref,
+                                     const TConnectionId    aConnId,
+                                     const TUid             aAppUid,
+                                     TConnPref&             aPolicyPref,
+                                     TRequestStatus&        aStatus );
+
+        /**
+        * Re-selectBestIAP. Same as ChooseBestIAP but can be called multiple times.
+        * resubmit of 
+        * @since 5.2
+        * @param aConnId Connection Id
+        * @param aPolicyPref Connection preferences chosen by MPM
+        * @param aStatus KErrNone if successful, otherwise one of the
+        * system-wide error codes
+        */
+        IMPORT_C void ReselectBestIAP( const TConnectionId    aConnId,
+                                       TConnPref&             aPolicyPref,
+                                       TRequestStatus&        aStatus );
+
+        /**
+        * Error processing of connection initiation.
+        * @since 3.1
+        * @param aError Error code
+        * @param aConnId Connection Id
+        * @param aNeededAction Ignore error, propagate error or perform a reselection
+        * @param aStatus KErrNone if successful, otherwise one of the
+        * system-wide error codes
+        */
+        IMPORT_C void ProcessError( TInt&                   aError,
+                                    const TConnectionId     aConnId,
+                                    TBMNeededAction&        aNeededAction,
+                                    TRequestStatus&         aStatus );
+
+        /**
+        * Error processing of connection initiation.
+        * @deprecated In 5.2, aConnPref not required.
+        * @since 3.1
+        * @param aConnPref Connection preferences
+        * @param aError Error code
+        * @param aConnId Connection Id
+        * @param aNeededAction Ignore error, propagate error or perform a reselection
+        * @param aStatus KErrNone if successful, otherwise one of the
+        * system-wide error codes
+        */
+        IMPORT_C void ProcessError( TConnPref&              aConnPref,
+                                    TInt&                   aError,
+                                    const TConnectionId     aConnId,
+                                    TBMNeededAction&        aNeededAction,
+                                    TRequestStatus&         aStatus );
+
+        /**
+        * Application leaves connection.
+        * @since 3.1
+        * @param aIapId IAP Id of the connection.
+        * @param aConnId Connection Id
+        * @return KErrNone if successful, otherwise one of the
+        * system-wide error codes
+        */
+        IMPORT_C TInt ApplicationLeavesConnection( const TUint32       aIapId,
+                                                   const TConnectionId aConnId );
+
+        /**
+        * The whole IAP connection is stopped.
+        * @since 3.1
+        * @param aIapId IAP Id of the connection.
+        * @param aConnId Connection Id
+        * @return KErrNone if successful, otherwise one of the
+        * system-wide error codes
+        */
+        IMPORT_C TInt IAPConnectionStopped( const TUint32       aIapId,
+                                            const TConnectionId aConnId );
+
+        /**
+        * Bearer manager provides message buffer for MPM notifications,
+        * must be called before registering for notifications.
+        * @since 3.1
+        * @param aMpmNotification notification for BM
+        * @param aStatus KErrNone if successful, otherwise one of the
+        * system-wide error codes
+        */
+        IMPORT_C void WaitNotification( TMPMMessageBuffer& aMpmNotification,
+                                        TRequestStatus&    aStatus );
+
+        /**
+        * Register for getting preferred IAP notifications.
+        * @since 3.1
+        * @param aConnId Connection Id
+        * @return KErrNone if successful, otherwise one of the
+        * system-wide error codes
+        */
+        IMPORT_C TInt RegisterPrefIAPNotif( const TConnectionId aConnId );
+
+        /**
+        * Register for getting preferred IAP notifications.
+        * @since 5.2
+        * @param aConnId Connection Id
+        * @param aStatus KErrNone if successful, otherwise one of the
+        * system-wide error codes
+        */
+        IMPORT_C void RegisterPrefIAPNotif( const TConnectionId aConnId,
+                                            TRequestStatus&     aStatus );
+        /**
+        * Register for getting preferred IAP notifications.
+        * @deprecated In 5.2, aConnPref not required.
+        * @since 3.1
+        * @param aConnPref Connection preferences
+        * @param aConnId Connection Id
+        * @return KErrNone if successful, otherwise one of the
+        * system-wide error codes
+        */
+        IMPORT_C TInt RegisterPrefIAPNotif( const TConnPref&    aConnPref,
+                                            const TConnectionId aConnId );
+
+        /**
+        * Unregister preferred IAP notifications.
+        * @since 3.1
+        * @param aConnId Connection Id
+        */
+        IMPORT_C void UnregisterPrefIAPNotif( const TConnectionId aConnId );
+
+        /**
+        * Unregister preferred IAP notifications.
+        * @since 5.2
+        * @param aConnId Connection Id
+        */
+        IMPORT_C void UnregisterPrefIAPNotif( const TConnectionId aConnId,
+                                              TRequestStatus&     aStatus );
+
+        /**
+        * Sort available IAPs belonging to the specified SNAP.
+        * @since 3.2
+        * @param aSNAP Service Network Access Point
+        * @param aSortedList on return contains the sorted list of IAPs
+        * @return KErrNone if successful, otherwise one of the
+        * system-wide error codes
+        */
+        IMPORT_C TInt SortSNAP( const TUint32   aSNAP, 
+                                TMpmSnapBuffer& aSortedList );
+
+        /**
+        * Application joins connection.
+        * @since 3.2
+        * @param aIapId IAP Id of the connection.
+        * @param aConnId Connection Id
+        * @return KErrNone if successful, otherwise one of the
+        * system-wide error codes
+        */                
+        IMPORT_C TInt ApplicationJoinsConnection( const TUint32       aIapId,
+                                                  const TConnectionId aConnId );
+
+        /**
+        * The whole IAP connection is activated.
+        * @since 3.2
+        * @param aIapId IAP Id of the connection.
+        * @param aConnId Connection Id
+        * @return KErrNone if successful, otherwise one of the
+        * system-wide error codes
+        */        
+        IMPORT_C TInt IAPConnectionActivated( const TUint32       aIapId,
+                                              const TConnectionId aConnId );
+
+        /**
+        * The whole IAP connection is started.
+        * @since 3.2
+        * @param aIapId IAP Id of the connection.
+        * @param aConnId Connection Id
+        * @return KErrNone if successful, otherwise one of the
+        * system-wide error codes
+        */        
+        IMPORT_C TInt IAPConnectionStarted( const TUint32       aIapId,
+                                            const TConnectionId aConnId );
+
+        /**
+        * Application connection ends.
+        * @since 3.2
+        * @param aConnId Connection Id
+        * @return KErrNone if successful, otherwise one of the
+        * system-wide error codes
+        */
+        IMPORT_C TInt ApplicationConnectionEnds( 
+                                        const TConnectionId aConnId ); 
+
+        /**
+        * Application migrates to carrier.
+        * @since 3.2
+        * @param aIapId IAP Id of the new carrier.
+        * @param aConnId Connection Id
+        * @return KErrNone if successful, otherwise one of the
+        * system-wide error codes
+        */                
+        IMPORT_C TInt ApplicationMigratesToCarrier( const TUint32       aIapId,
+                                                    const TConnectionId aConnId );
+
+        /**
+        * Application ignored the carrier.
+        * @since 3.2
+        * @param aIapId IAP Id of the new carrier.
+        * @param aConnId Connection Id
+        * @return KErrNone if successful, otherwise one of the
+        * system-wide error codes
+        */                
+        IMPORT_C TInt ApplicationIgnoredTheCarrier( const TUint32       aIapId,
+                                                    const TConnectionId aConnId );
+
+        /**
+        * Application accepted the carrier.
+        * @since 3.2
+        * @param aIapId IAP Id of the new carrier.
+        * @param aConnId Connection Id
+        * @return KErrNone if successful, otherwise one of the
+        * system-wide error codes
+        */                
+        IMPORT_C TInt ApplicationAcceptedTheCarrier( const TUint32       aIapId,
+                                                     const TConnectionId aConnId );
+
+        /**
+        * Application rejected the carrier.
+        * @since 3.2
+        * @param aIapId IAP Id of the new carrier.
+        * @param aConnId Connection Id
+        * @return KErrNone if successful, otherwise one of the
+        * system-wide error codes
+        */                
+        IMPORT_C TInt ApplicationRejectedTheCarrier( const TUint32       aIapId,
+                                                     const TConnectionId aConnId );
+
+        /**
+        * Displays connecting wait note for Easy WLAN connection.
+        * @since 3.2
+        * @param aSSID the id of selected wlan network
+        */                
+        IMPORT_C TInt EasyWlanSsid( const TWlanSsid& aSSID );
+
+        /**
+        * The whole IAP connection is started.
+        * @since 5.2
+        * @param aIapId IAP Id of the connection.
+        * @param aConnId Connection Id
+        * @param aStatus KErrNone if successful, otherwise one of the
+        * system-wide error codes
+        */        
+        IMPORT_C void IAPConnectionStarted( const TUint32       aIapId,
+                                            const TConnectionId aConnId,
+                                            TRequestStatus&     aStatus );
+                                            
+        /**
+        * The whole IAP connection is stopped.
+        * @since 5.2
+        * @param aIapId IAP Id of the connection.
+        * @param aConnId Connection Id
+        * @param aStatus KErrNone if successful, otherwise one of the
+        * system-wide error codes
+        */
+        IMPORT_C void IAPConnectionStopped( const TUint32       aIapId,
+                                            const TConnectionId aConnId,
+                                            TRequestStatus&     aStatus );
+
+        /**
+        * Application joins connection.
+        * @since 5.2
+        * @param aIapId IAP Id of the connection.
+        * @param aConnId Connection Id
+        * @param aStatus KErrNone if successful, otherwise one of the
+        * system-wide error codes
+        */                
+        IMPORT_C void ApplicationJoinsConnection( const TUint32       aIapId,
+                                                  const TConnectionId aConnId,
+                                                  TRequestStatus&     aStatus );
+        /**
+        * Application leaves connection.
+        * @since 5.2
+        * @param aIapId IAP Id of the connection.
+        * @param aConnId Connection Id
+        * @param aStatus KErrNone if successful, otherwise one of the
+        * system-wide error codes
+        */
+        IMPORT_C void ApplicationLeavesConnection( const TUint32       aIapId,
+                                                   const TConnectionId aConnId,
+                                                   TRequestStatus&     aStatus );
+
+        /**
+        * Application connection ends.
+        * @since 5.2
+        * @param aConnId Connection Id
+        * @param aStatus KErrNone if successful, otherwise one of the
+        * system-wide error codes
+        */
+        IMPORT_C void ApplicationConnectionEnds( const TConnectionId aConnId,
+                                                 TRequestStatus&     aStatus );
+
+        /**
+        * Application migrates to carrier.
+        * @since 3.2
+        * @param aIapId IAP Id of the new carrier.
+        * @param aConnId Connection Id
+        * @param aStatus KErrNone if successful, otherwise one of the
+        * system-wide error codes
+        */                
+        IMPORT_C void ApplicationMigratesToCarrier( const TUint32       aIapId,
+                                                    const TConnectionId aConnId,
+                                                    TRequestStatus&     aStatus );
+
+        /**
+        * Application ignored the carrier.
+        * @since 3.2
+        * @param aIapId IAP Id of the new carrier.
+        * @param aConnId Connection Id
+        * @param aStatus KErrNone if successful, otherwise one of the
+        * system-wide error codes
+        */                
+        IMPORT_C void ApplicationIgnoredTheCarrier( const TUint32       aIapId,
+                                                    const TConnectionId aConnId,
+                                                    TRequestStatus&     aStatus );
+
+        /**
+        * Application rejected the carrier.
+        * @since 3.2
+        * @param aIapId IAP Id of the rejected carrier.
+        * @param aConnId Connection Id
+        * @param aStatus KErrNone if successful, otherwise one of the
+        * system-wide error codes
+        */                
+        IMPORT_C void ApplicationRejectedTheCarrier( const TUint32       aIapId,
+                                                     const TConnectionId aConnId,
+                                                     TRequestStatus&     aStatus );
+
+        /**
+        * Application accpeted the carrier.
+        * @since 3.2
+        * @param aIapId IAP Id of the accepted carrier.
+        * @param aConnId Connection Id
+        * @param aStatus KErrNone if successful, otherwise one of the
+        * system-wide error codes
+        */                
+        IMPORT_C void ApplicationAcceptedTheCarrier( const TUint32       aIapId,
+                                                     const TConnectionId aConnId,
+                                                     TRequestStatus&     aStatus );
+
+        /**
+        * Asynchronously sort available IAPs belonging to the specified SNAP.
+        * @since 5.2
+        * @param aSNAP Service Network Access Point
+        * @param aSortedList on return contains the sorted list of IAPs
+        * @param aStatus KErrNone if successful, otherwise one of the
+        * system-wide error codes
+        * @param aMaxAgeSeconds how many seconds old availability data MPM is
+        * allowed to use for priorization.
+        */
+        IMPORT_C void SortSNAP( const TUint32   aSNAP, 
+                                TMpmSnapBuffer& aSortedList,
+                                TRequestStatus& aStatus,
+                                const TUint32   aMaxAgeSeconds = 5 );
+
+#ifdef _DEBUG
+        /**
+         * Sends calls into MPM. Only for debugging purposes. Must not be compiled for UREL 
+         */
+        inline void SendReq( TMpmAsynchCodes aReq, TInt aValue );
+#endif //_DEBUG
+    private: // New functions
+
+        TPtr8& NextPtr();       
+
+    private: // Data
+    
+        // Is Client connected
+        TBool iConnected;
+
+        // Ptr array for IPC messaging
+        RArray< TPtr8 > iPtrArray;
+
+        // Used for indexing iPtrArray elements
+        TInt iIndex;
+    };
+
+#include "rmpm.inl"
+
+#endif // RMPM_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/inc/rmpm.inl	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,91 @@
+/*
+* 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: Inline functions for RMPM class
+*
+*/
+
+
+// -----------------------------------------------------------------------------
+// TMpmSnapBuffer::Reset
+// -----------------------------------------------------------------------------
+//
+inline void TMpmSnapBuffer::Reset()
+    {
+    iCount = 0;
+    for ( TUint i( 0 ); i < KMpmMaxIAPCount; i++ )
+        {
+        iIapId[i] = 0;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// TMpmSnapBuffer::Count
+// -----------------------------------------------------------------------------
+//
+inline const TInt TMpmSnapBuffer::Count() const
+    {
+    return iCount;
+    }
+    
+// -----------------------------------------------------------------------------
+// TMpmNotificationPrefIAPAvailable::Length
+// -----------------------------------------------------------------------------
+//
+inline TInt TMpmNotificationPrefIAPAvailable::Length()
+    {
+    return sizeof( TMpmNotificationPrefIAPAvailable );
+    }
+
+// -----------------------------------------------------------------------------
+// TMpmNotificationError::Length
+// -----------------------------------------------------------------------------
+//
+inline TInt TMpmNotificationError::Length()
+    {
+    return sizeof( TMpmNotificationError );
+    }
+
+// -----------------------------------------------------------------------------
+// TMpmNotificationStartIAP::Length
+// -----------------------------------------------------------------------------
+//
+inline TInt TMpmNotificationStartIAP::Length()
+    {
+    return sizeof( TMpmNotificationStartIAP );
+    }
+
+    
+// -----------------------------------------------------------------------------
+// TMpmNotificationStopIAP::Length
+// -----------------------------------------------------------------------------
+//
+inline TInt TMpmNotificationStopIAP::Length()
+    {
+    return sizeof( TMpmNotificationStopIAP );
+    }
+
+#ifdef _DEBUG
+// -----------------------------------------------------------------------------
+// RMPM::SendReq
+// -----------------------------------------------------------------------------
+//
+inline void RMPM::SendReq( TMpmAsynchCodes aReq, TInt aValue )
+    {
+    //TPckg<TInt> intPckg( aValue );
+    TInt err = SendReceive( aReq, 
+                            TIpcArgs( aValue ) );
+    ASSERT( err == KErrNone );
+    }
+#endif //_DEBUG
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/rom/mpm.iby	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2004-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:  MPM client
+*
+*/
+
+
+#ifndef MPM_IBY
+#define MPM_IBY
+
+#include <bldvariant.hrh>
+
+file=ABI_DIR\BUILD_DIR\mpm.dll  SHARED_LIB_DIR\mpm.dll
+
+#endif // MPM_IBY
+
+//  End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/rom/mpmdefaultconnection.iby	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* 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:  Image description file for project MPM Default Connection client
+*
+*/
+
+
+#ifndef MPMDEFAULTCONNECTION_IBY
+#define MPMDEFAULTCONNECTION_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+file=ABI_DIR\BUILD_DIR\mpmdefaultconnection.dll        SHARED_LIB_DIR\mpmdefaultconnection.dll
+
+#endif // MPMDEFAULTCONNECTION_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/rom/mpmserver.iby	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: MPM server
+*
+*/
+
+#ifndef MPMSERVER_IBY
+#define MPMSERVER_IBY
+
+#include <bldvariant.hrh>
+
+#ifdef FF_PLATFORM_SIMULATOR
+file=ABI_DIR\BUILD_DIR\mpmserver_platsim.exe  PROGRAMS_DIR\mpmserver.exe
+#else
+file=ABI_DIR\BUILD_DIR\mpmserver.exe  PROGRAMS_DIR\mpmserver.exe
+#endif
+
+#endif //MPMSERVER_IBY
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/src/mpmcommsdataccess.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,3109 @@
+/*
+* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: MPM CommsDat access functions
+*
+*/
+
+/**
+@file mpmcommsdataccess.cpp
+Mobility Policy Manager CommsDat access functions.
+*/
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <commdb.h>
+#include <metadatabase.h>
+#include <commsdattypeinfov1_1.h>
+#include <commsdattypesv1_1.h>
+#include <datamobilitycommsdattypes.h>
+#include <cmpluginbaseeng.h>
+#include <WlanCdbCols.h>
+#include <cmmanagerdef.h>
+#include <cmconnectionmethoddef.h>
+#include <wlancontainer.h>
+#include <utf.h>
+#include <cmpluginwlandef.h>
+#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include <commsdattypeinfov1_1_internal.h>
+#include <commsdattypesv1_1_partner.h>
+#endif
+
+#include <in_sock.h>
+#include <cmgenconnsettings.h>
+#include <cmdestination.h>
+
+#include "mpmcommsdataccess.h"
+#include "mpmserversession.h"
+#include "mpmconnmonevents.h"
+#include "mpmiapselection.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CMPMCommsDatAccess::NewL
+// -----------------------------------------------------------------------------
+//
+CMPMCommsDatAccess* CMPMCommsDatAccess::NewL()
+    {
+    CMPMCommsDatAccess* self = new ( ELeave ) CMPMCommsDatAccess();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMCommsDatAccess::CMPMCommsDatAccess
+// -----------------------------------------------------------------------------
+//
+CMPMCommsDatAccess::CMPMCommsDatAccess()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMCommsDatAccess::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CMPMCommsDatAccess::ConstructL()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMCommsDatAccess::~CMPMCommsDatAccess
+// -----------------------------------------------------------------------------
+//
+CMPMCommsDatAccess::~CMPMCommsDatAccess()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMCommsDatAccess::FindAllSnapsL
+// -----------------------------------------------------------------------------
+//
+void CMPMCommsDatAccess::FindAllSnapsL( RArray<TUint>& aSnapIds )
+    {
+    MPMLOGSTRING( "CMPMCommsDatAccess::FindAllSnapsL " )
+
+    CMDBSession* db = CMDBSession::NewLC( KCDVersion1_1 );
+    
+    // Get the table id from generic
+    // 
+    CMDBGenericRecord* generic = static_cast<CMDBGenericRecord*>
+        ( CCDRecordBase::RecordFactoryL( 0 ) );
+    CleanupStack::PushL( generic );
+    generic->InitializeL( TPtrC( KCDTypeNameDataMobilitySelectionPolicy ), 
+                          NULL );
+    generic->LoadL( *db );
+
+    // Create the DN-IAP record set
+    // 
+    CMDBRecordSet<CCDDataMobilitySelectionPolicyRecord>* dnIAPRecordSet = 
+        new ( ELeave ) CMDBRecordSet<CCDDataMobilitySelectionPolicyRecord>( 
+        generic->TableId() );
+    CleanupStack::PushL( dnIAPRecordSet );
+
+    dnIAPRecordSet->LoadL( *db );
+    for ( TInt i = 0; i < dnIAPRecordSet->iRecords.Count(); i++ )
+        {
+        CCDDataMobilitySelectionPolicyRecord* dnRecord = new ( ELeave ) 
+        CCDDataMobilitySelectionPolicyRecord( generic->TableId() );
+                
+        dnRecord->SetElementId( GetRealElementId( dnIAPRecordSet->iRecords[i] ) );
+        dnRecord->LoadL( *db );
+
+        TUint snapId = dnRecord->iSNAP;
+        MPMLOGSTRING2( "CMPMCommsDatAccess::FindAllSnapsL snap %d", snapId )
+
+        // Insert unique ids to array
+        //
+        aSnapIds.InsertInOrder( snapId );
+        delete dnRecord;
+        }
+
+    CleanupStack::PopAndDestroy( dnIAPRecordSet );
+    CleanupStack::PopAndDestroy( generic );
+    CleanupStack::PopAndDestroy( db );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMCommsDatAccess::ValidateIapL
+// -----------------------------------------------------------------------------
+//
+void CMPMCommsDatAccess::ValidateIapL( 
+    const TConnectionId         aConnId,
+    TUint32&                    aIapId, 
+    TUint32&                    aNetId, 
+    TBool&                      aLanOrWlan,
+    CMPMServerSession&          aSession )
+    {
+    MPMLOGSTRING2(
+        "CMPMCommsDatAccess::ValidateIapL: Validating chosen IAP Id = %i", 
+        aIapId )
+
+    aLanOrWlan = EFalse;
+
+    SearchAccessNetIdL( aIapId, aNetId );
+
+    CCommsDatabase* commsDatabase = CCommsDatabase::NewL();
+    CleanupStack::PushL( commsDatabase );
+
+    // Make hidden records visible
+    // 
+    commsDatabase->ShowHiddenRecords();
+
+    CCommsDbTableView* commsDbIapTableView = 
+        commsDatabase->OpenViewMatchingUintLC( TPtrC( IAP ),
+                                               TPtrC( COMMDB_ID ),
+                                               aIapId );
+
+    User::LeaveIfError( commsDbIapTableView->GotoFirstRecord() );
+
+    TInt length1( 0 );
+
+    commsDbIapTableView->ReadColumnLengthL( TPtrC( IAP_SERVICE_TYPE ), 
+                                            length1 );
+    HBufC* buf1 = HBufC::NewLC( length1 );
+    TPtr ptr1( buf1->Des() );
+
+    // Read IAP's service type
+    //
+    commsDbIapTableView->ReadTextL(TPtrC( IAP_SERVICE_TYPE ), ptr1 );
+    MPMLOGSTRING2(
+        "CMPMCommsDatAccess::ValidateIapL: IAP service type = %S",
+        &ptr1)
+
+    // In case offline mode is enabled, we need to find out what type 
+    // of bearer is used. Only LAN or WLAN is allowed in offline mode.
+    // 
+    if ( ptr1.Compare( TPtrC( LAN_SERVICE ) ) == KErrNone )
+        {
+        aLanOrWlan = ETrue;
+
+        TUint32 service( 0 );
+        commsDbIapTableView->ReadUintL( TPtrC( IAP_SERVICE ), service );
+
+        // Now open a view to LAN_SERVICE table
+        //
+        CCommsDbTableView* commsDbLanTableView = 
+            commsDatabase->OpenViewMatchingUintLC( TPtrC( LAN_SERVICE ),
+                                                   TPtrC( COMMDB_ID ),
+                                                   service );
+
+        User::LeaveIfError( commsDbLanTableView->GotoFirstRecord() );
+
+        TUint32 commDbId( 0 );
+
+        commsDbLanTableView->ReadUintL( TPtrC( COMMDB_ID ), commDbId );
+
+        // Now open a view to WLAN_SERVICE table
+        //
+        // If non wlan product, wlan tables won't exist and this will 
+        // leave. In that case do not check WLAN related issues 
+        //
+        CCommsDbTableView* commsDbWlanTableView( NULL );
+        TRAPD( err2, commsDbWlanTableView = 
+                    commsDatabase->OpenViewMatchingUintLC( TPtrC( WLAN_SERVICE ),
+                                                   TPtrC( WLAN_SERVICE_ID ),
+                                                   commDbId );
+                    CleanupStack::Pop( commsDbWlanTableView ) );
+        if( err2 == KErrNone )
+            {
+            // Push back to cleanup stack. Object must be popped within 
+            // TRAP, to avoid unbalance in cleanup stack and panic 71
+            CleanupStack::PushL( commsDbWlanTableView );
+            
+            TInt err = commsDbWlanTableView->GotoFirstRecord();
+
+            if ( err == KErrNone )
+                {
+                TWlanSsid ssid;
+                commsDbWlanTableView->ReadTextL( TPtrC( NU_WLAN_SSID ), ssid );
+
+                MPMLOGSSID( "CMPMCommsDatAccess<0x%x>::ValidateIapL: SSID = %S", 
+                    aSession.ConnectionId(), &ssid )
+
+                TUint32 presumedIapId = aIapId; 
+
+                // Find and change Iap and Net Id if SSID exist
+                //
+                if ( !CheckEasyWLanL( aIapId ) )
+                    {
+                    aSession.MyServer().Events()->FindSSID( ssid, aIapId, aNetId );
+                    }
+
+                // Store Iap Id, Net Id and empty APN to TConnInfo, 
+                // so that FindAPN can utilise the information 
+                // during the validation of next IAP to support 
+                // using existing WLAN connection SSID.
+                //
+                aSession.MyServer().Events()->AppendConnInfo( aConnId );
+                aSession.MyServer().Events()->SetConnInfo( aConnId, 
+                                                           aIapId, 
+                                                           presumedIapId, 
+                                                           aNetId, 
+                                                           ssid );
+                }
+            else
+                {
+                MPMLOGSTRING2( "CMPMCommsDatAccess::ValidateIapL\
+ GotoFirstRecord returned %d", err )
+                }
+            CleanupStack::PopAndDestroy( commsDbWlanTableView );
+            }
+        else
+            {
+            MPMLOGSTRING2(
+                        "CMPMCommsDatAccess::ValidateIapL: WLAN table view failed, err %d", err2 )
+            }                
+        CleanupStack::PopAndDestroy( commsDbLanTableView );
+        }
+
+    // If this IAP needs PDP Context management, we'll do it here
+    // 
+    else if ( ptr1.Compare(TPtrC(OUTGOING_WCDMA)) == KErrNone )
+        {
+        TUint32 service;
+        commsDbIapTableView->ReadUintL( TPtrC( IAP_SERVICE ), service );
+
+        // Now open a view to OUTGOING_WCDMA table
+        //
+        CCommsDbTableView* commsDbPsdTableView = 
+            commsDatabase->OpenViewMatchingUintLC( TPtrC( OUTGOING_WCDMA ),
+                                                   TPtrC( COMMDB_ID ),
+                                                   service );
+
+        User::LeaveIfError( commsDbPsdTableView->GotoFirstRecord() );
+
+        TInt length2( 0 );
+
+        commsDbPsdTableView->ReadColumnLengthL( TPtrC( GPRS_APN ), length2 );
+
+        HBufC* buf2 = HBufC::NewLC( length2 );
+        TPtr ptr2( buf2->Des() );
+
+        // Read APN
+        //
+        commsDbPsdTableView->ReadTextL( TPtrC( GPRS_APN ), ptr2 );
+        MPMLOGSTRING2(
+            "CMPMCommsDatAccess::ValidateIapL: APN = %S", &ptr2)
+
+        TUint32 presumedIapId = aIapId; 
+
+        // Find and change Iap and Net Id if APN exist
+        //
+        aSession.MyServer().Events()->FindAPN( ptr2, aIapId, aNetId ); 
+
+        // Store Iap Id, Net Id and APN to TConnInfo, 
+        // so that FindAPN can utilise the information 
+        // during the validation of next IAP to support 
+        // using existing PDP context per APN.
+        //
+        aSession.MyServer().Events()->AppendConnInfo( aConnId );
+        aSession.MyServer().Events()->SetConnInfo( aConnId, 
+                                                   aIapId, 
+                                                   presumedIapId, 
+                                                   aNetId, 
+                                                   ptr2 );
+        CleanupStack::PopAndDestroy( buf2 );
+        CleanupStack::PopAndDestroy( commsDbPsdTableView );
+        }
+    else if ( ptr1.Compare(TPtrC( VPN_SERVICE )) == KErrNone )
+        {
+        MPMLOGSTRING(
+            "CMPMCommsDatAccess::ValidateIapL: Enable VPN in offline mode" )
+        aLanOrWlan = ETrue;
+        }
+    else
+        {
+        MPMLOGSTRING(
+            "CMPMCommsDatAccess::ValidateIapL: Service Type out of range" )
+        }
+
+    CleanupStack::PopAndDestroy( buf1 );
+    CleanupStack::PopAndDestroy( commsDbIapTableView );
+    CleanupStack::PopAndDestroy( commsDatabase );
+
+    MPMLOGSTRING2(
+        "CMPMCommsDatAccess::ValidateIapL: Validated IAP Id = %i", aIapId )
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMCommsDatAccess::CheckBearerL
+// -----------------------------------------------------------------------------
+//
+void CMPMCommsDatAccess::CheckBearerL( 
+    TUint32&                    aIapId, 
+    TBool&                      aLanOrWlan, 
+    const RAvailableIAPList&    aAvailableIAPList,
+    CMPMServerSession&          aSession )
+    {
+    MPMLOGSTRING2( "CMPMCommsDatAccess::CheckBearerL: IAP Id = %i", aIapId )
+
+    aLanOrWlan = EFalse;
+
+    // Use FindRealIapL to find the real IAP behind the virtual IAP.
+    // 
+    TUint32 realIapId( 0 );
+    FindRealIapL( aIapId, 
+                  realIapId, 
+                  aAvailableIAPList,
+                  aSession );
+
+    if ( ( realIapId != 0 ) && ( aIapId != realIapId ) )
+        {
+        aIapId = realIapId;
+        MPMLOGSTRING2(
+            "CMPMCommsDatAccess::CheckBearerL: Found real IAP Id = %i", 
+            aIapId )
+        }
+
+    CCommsDatabase* commsDatabase = CCommsDatabase::NewL();
+    CleanupStack::PushL(commsDatabase);
+
+    // Make hidden records visible
+    // 
+    commsDatabase->ShowHiddenRecords();
+
+    CCommsDbTableView* commsDbIapTableView = 
+        commsDatabase->OpenViewMatchingUintLC( TPtrC(IAP),
+                                               TPtrC(COMMDB_ID),
+                                               aIapId);
+
+    User::LeaveIfError( commsDbIapTableView->GotoFirstRecord() );
+
+    TInt length1( 0 );
+
+    commsDbIapTableView->ReadColumnLengthL(TPtrC(IAP_SERVICE_TYPE), length1);
+    HBufC* buf1 = HBufC::NewLC(length1);
+    TPtr ptr1( buf1->Des() );
+
+    // Read IAP's service type
+    //
+    commsDbIapTableView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), ptr1);
+    MPMLOGSTRING2(
+        "CMPMCommsDatAccess::CheckBearerL: IAP_SERVICE_TYPE from CommsDat = %S",
+        &ptr1 )
+
+    // In case offline mode is enabled, we need to find out what type 
+    // of bearer is used. Only LAN or WLAN is allowed in offline mode.
+    // 
+    if ( ptr1.Compare(TPtrC(LAN_SERVICE)) == KErrNone )
+        {
+        aLanOrWlan = ETrue;
+        MPMLOGSTRING( "CMPMCommsDatAccess::CheckBearerL: Bearer type LAN/WLAN" )
+        }
+    else
+        {
+        aLanOrWlan = EFalse;
+        MPMLOGSTRING( "CMPMCommsDatAccess::CheckBearerL: Bearer type GSM/UMTS" )
+        }
+
+    CleanupStack::PopAndDestroy(buf1);
+    CleanupStack::PopAndDestroy(commsDbIapTableView);    
+    CleanupStack::PopAndDestroy(commsDatabase);
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMCommsDatAccess::CheckEasyWLanL
+// -----------------------------------------------------------------------------
+//
+TBool CMPMCommsDatAccess::CheckEasyWLanL( TUint32 aIapId ) const
+    {
+    MPMLOGSTRING2( "CMPMCommsDatAccess::CheckEasyWLanL: IAP Id = %i", aIapId)
+
+    TBool easyWlan = EFalse;
+    CCommsDatabase* commsDatabase = CCommsDatabase::NewL();
+    CleanupStack::PushL( commsDatabase );
+
+    // Make hidden records visible
+    // 
+    commsDatabase->ShowHiddenRecords();
+
+    CCommsDbTableView* commsDbIapTableView = 
+        commsDatabase->OpenViewMatchingUintLC( TPtrC( IAP ),
+                                               TPtrC( COMMDB_ID ),
+                                               aIapId );
+
+    User::LeaveIfError( commsDbIapTableView->GotoFirstRecord() );
+
+    TInt length1( 0 );
+
+    commsDbIapTableView->ReadColumnLengthL( TPtrC( IAP_SERVICE_TYPE ), 
+                                            length1 );
+
+    HBufC* buf1 = HBufC::NewLC( length1 );
+    TPtr ptr1( buf1->Des() );
+
+    // Read IAP's service type
+    //
+    commsDbIapTableView->ReadTextL(TPtrC( IAP_SERVICE_TYPE ), ptr1 );
+    MPMLOGSTRING2(
+        "CMPMCommsDatAccess::CheckEasyWLanL: IAP service type = %S", &ptr1 )
+
+    if ( ptr1.Compare( TPtrC( LAN_SERVICE ) ) == KErrNone )
+        {
+        TUint32 service( 0 );
+        commsDbIapTableView->ReadUintL( TPtrC( IAP_SERVICE ), service );
+
+        // Now open a view to LAN_SERVICE table
+        //
+        CCommsDbTableView* commsDbLanTableView = 
+            commsDatabase->OpenViewMatchingUintLC( TPtrC( LAN_SERVICE ),
+                                                   TPtrC( COMMDB_ID ),
+                                                   service );
+
+        User::LeaveIfError( commsDbLanTableView->GotoFirstRecord() );
+
+        TUint32 commDbId( 0 );
+
+        commsDbLanTableView->ReadUintL( TPtrC( COMMDB_ID ), commDbId );
+
+        // Now open a view to WLAN_SERVICE table
+        //
+        // If non wlan product, wlan tables won't exist and this will 
+        // leave. In that case do not check WLAN related issues 
+        //
+        CCommsDbTableView* commsDbWlanTableView( NULL );
+        TRAPD( err2, commsDbWlanTableView =
+                     commsDatabase->OpenViewMatchingUintLC( TPtrC( WLAN_SERVICE ),
+                                                            TPtrC( WLAN_SERVICE_ID ),
+                                                            commDbId );
+                     CleanupStack::Pop( commsDbWlanTableView ) );
+        if ( err2 == KErrNone )
+            {
+            // Push back to cleanup stack. Object must be popped within 
+            // TRAP, to avoid unbalance in cleanup stack and panic 71
+            CleanupStack::PushL( commsDbWlanTableView );
+
+            TInt err = commsDbWlanTableView->GotoFirstRecord();
+
+            if ( err == KErrNone )
+                {
+                TInt ssidLength( 0 );
+                commsDbWlanTableView->ReadColumnLengthL( TPtrC( NU_WLAN_SSID ), 
+                                                                ssidLength );
+                if ( ssidLength == 0 )
+                    {
+                    MPMLOGSTRING(
+                        "CMPMCommsDatAccess::CheckEasyWLanL: IAP is Easy WLAN" )
+                    easyWlan = ETrue;
+                    }
+                else
+                    {
+                    MPMLOGSTRING(
+                        "CMPMCommsDatAccess::CheckEasyWLanL: IAP isn't Easy WLAN" )
+                    easyWlan = EFalse;
+                    }
+                }
+            else
+                {
+                MPMLOGSTRING2( "CMPMCommsDatAccess::CheckEasyWLanL\
+ GotoFirstRecord returned %d", err )
+                }
+
+            // Release memory
+            //
+            CleanupStack::PopAndDestroy( commsDbWlanTableView );
+            }
+        else
+            {
+            MPMLOGSTRING2(
+                        "CMPMCommsDatAccess::CheckEasyWLanL: WLAN table view failed, err %d", err2 )
+            }    
+        CleanupStack::PopAndDestroy( commsDbLanTableView );
+        }
+
+    // Release memory
+    //
+    CleanupStack::PopAndDestroy( buf1 );
+    CleanupStack::PopAndDestroy( commsDbIapTableView );
+    CleanupStack::PopAndDestroy( commsDatabase );
+
+    return easyWlan;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMCommsDatAccess::DumpIAPsL
+// -----------------------------------------------------------------------------
+//
+void CMPMCommsDatAccess::DumpIAPsL() const
+    {
+#ifdef _DEBUG
+
+    // Dump CommsDat IAPs to log in order to support testing
+    // 
+    TInt err( KErrNone );
+
+    MPMLOGSTRING( "Display CommsDat IAPs - Start" )
+    MPMLOGSTRING( "" )
+
+    CCommsDatabase* commsDatabase = CCommsDatabase::NewL();
+    CleanupStack::PushL(commsDatabase);
+
+    // Make hidden records visible
+    // 
+    commsDatabase->ShowHiddenRecords();
+
+    // Iterate the IAP table from CommsDat
+    CCommsDbTableView* table = NULL;
+    table = commsDatabase->OpenTableLC( TPtrC( IAP ) );
+
+    err = table->GotoFirstRecord();
+
+    while ( !err )
+        {
+        TUint32 iapId( 0 );
+        TInt    length1( 0 );
+        TInt    length2( 0 );
+
+        // Read IAP's ID
+        //
+        table->ReadUintL( TPtrC( COMMDB_ID ), iapId );
+
+        // Read IAP's connection name
+        //
+        table->ReadColumnLengthL( TPtrC( COMMDB_NAME ), length1 );
+        HBufC* buf1 = HBufC::NewLC( length1 );
+        TPtr ptr1( buf1->Des() );
+        table->ReadTextL( TPtrC( COMMDB_NAME ), ptr1 );
+
+        // Read IAP's service type
+        //
+        table->ReadColumnLengthL(TPtrC( IAP_SERVICE_TYPE ), length2 );
+        HBufC* buf2 = HBufC::NewLC( length2 );
+        TPtr ptr2( buf2->Des() );
+        table->ReadTextL(TPtrC( IAP_SERVICE_TYPE ), ptr2 );
+
+        // Dump information to log
+        // 
+        MPMLOGSTRING3( "IAP %i: Name = %S", iapId, &ptr1 )
+        MPMLOGSTRING2( "Service type = %S", &ptr2 )
+
+        MPMLOGSTRING( "" )
+        
+        err = table->GotoNextRecord();
+
+        CleanupStack::PopAndDestroy( buf2 );
+        CleanupStack::PopAndDestroy( buf1 );
+        }
+
+    MPMLOGSTRING( "Display CommsDat IAPs - End" )
+
+    CleanupStack::PopAndDestroy( table );
+    CleanupStack::PopAndDestroy( commsDatabase );
+#endif // _DEBUG
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMCommsDatAccess::DumpSnapsL
+// -----------------------------------------------------------------------------
+//
+void CMPMCommsDatAccess::DumpSnapsL()
+    {
+#ifdef _DEBUG
+
+    // Dump CommsDat Snaps to log in order to support testing
+    // 
+    MPMLOGSTRING( "Display CommsDat Snaps - Start" )
+    MPMLOGSTRING( "" )
+
+    // Creating a session with the latest version
+    // 
+    CMDBSession* db = CMDBSession::NewLC( KCDVersion1_1 );
+
+    db->SetAttributeMask( ECDHidden | ECDProtectedWrite );
+
+    // Create the generic record set
+    // 
+    CMDBGenericRecord* generic = static_cast<CMDBGenericRecord*>
+        ( CCDRecordBase::RecordFactoryL( 0 ) ); 
+    CleanupStack::PushL( generic );  
+    generic->InitializeL( TPtrC( KCDTypeNameDataMobilitySelectionPolicy ), 
+                          NULL );
+    generic->LoadL( *db );
+
+    // Create the DN-IAP record set
+    // 
+    CMDBRecordSet<CCDDataMobilitySelectionPolicyRecord>* dnIAPRecordSet = 
+        new ( ELeave ) CMDBRecordSet<CCDDataMobilitySelectionPolicyRecord>( 
+        generic->TableId() );
+    CleanupStack::PushL( dnIAPRecordSet ); 
+
+    CCDDataMobilitySelectionPolicyRecord* dnIAPRecord = new ( ELeave ) 
+        CCDDataMobilitySelectionPolicyRecord( generic->TableId() );
+    CleanupStack::PushL( dnIAPRecord );
+
+    // Find all the DN-IAP records
+    // 
+    dnIAPRecordSet->LoadL( *db );
+
+    CCDIAPRecord*       linkedIAP;
+    //CCDNetworkRecord*   linkedDN;
+    //CCDNetworkRecord*   linkedDN2;
+    CCDAccessPointRecord*   linkedAP;
+    CCDAccessPointRecord*   linkedAP2;
+    RArray<TInt>        prevRecordIds;
+    CleanupClosePushL( prevRecordIds );
+
+    for ( TInt i = 0; i < dnIAPRecordSet->iRecords.Count(); i++ )
+        {
+        // Load each DN-IAP entry based on the elementId in the record set
+        // 
+        dnIAPRecord->SetElementId( GetRealElementId( dnIAPRecordSet->iRecords[i] ) );
+        dnIAPRecord->LoadL( *db );
+
+
+        linkedAP =  static_cast<CCDAccessPointRecord*>( CCDAccessPointRecord::RecordFactoryL( KCDTIdAccessPointRecord ) );
+        CleanupStack::PushL( linkedAP );
+
+        // Find the SNAP AP pointed by DN-IAP entry
+        //
+        linkedAP->iRecordTag = (TInt)dnIAPRecord->iSNAP;
+        TBool found = linkedAP->FindL( *db );
+
+        // Don't print duplicates
+        // 
+        if ( found && KErrNotFound == prevRecordIds.Find( linkedAP->RecordId() ) )
+            {
+            prevRecordIds.Append( linkedAP->RecordId() );
+            
+            // Print the DN and host name pointed by DN-IAP entry.
+            // HostName is EText field.
+            // 
+            TBuf<KCommsDatTextBufferLength> dn = linkedAP->iRecordName.GetL();
+            MPMLOGSTRING3( "Snap: %d Snap Name = %s", (TInt)linkedAP->iRecordTag, dn.PtrZ() )
+            
+            // Related DN-IAP records 
+            // Get the table id from generic record
+            // 
+            CMDBGenericRecord* generic2 = static_cast<CMDBGenericRecord*>
+                ( CCDRecordBase::RecordFactoryL( 0 ) ); 
+            CleanupStack::PushL( generic2 );  
+            generic2->InitializeL( TPtrC( 
+                KCDTypeNameDataMobilitySelectionPolicy ), NULL );
+            generic2->LoadL( *db );
+            
+            // Doesn't quite work with generic records
+            // 
+            CMDBRecordSet<CCDDataMobilitySelectionPolicyRecord>* 
+                dnIAPRecordSet2 = new ( ELeave ) 
+                CMDBRecordSet<CCDDataMobilitySelectionPolicyRecord>( 
+                generic2->TableId() );
+            CleanupStack::PushL( dnIAPRecordSet2 ); 
+            
+            // Prime one record with DN 
+            // 
+            CCDDataMobilitySelectionPolicyRecord* dnIAPRecord2 = 
+                new ( ELeave ) CCDDataMobilitySelectionPolicyRecord( 
+                generic2->TableId() );
+            CleanupStack::PushL( dnIAPRecord2 );
+            dnIAPRecord2->iSNAP = (TInt)linkedAP->iRecordTag;
+            dnIAPRecordSet2->iRecords.Append( dnIAPRecord2 );
+            CleanupStack::Pop( dnIAPRecord2 );
+
+            if ( dnIAPRecordSet2->FindL( *db ) )
+                {
+                for (TInt j = 0; j < dnIAPRecordSet2->iRecords.Count(); j++)
+                    {
+                    dnIAPRecord2->SetElementId( GetRealElementId( dnIAPRecordSet2->iRecords[j] ) );
+                    dnIAPRecord2->LoadL( *db );
+
+                    if ( dnIAPRecord2->iIAP != 0 )
+                        {
+                        linkedIAP = static_cast<CCDIAPRecord*>
+                            ( LoadLinkedRecordL( *db, dnIAPRecord2->iIAP ) );
+                        MPMLOGSTRING3( "IAP = %d Priority = %d", 
+                            linkedIAP->RecordId(), 
+                            static_cast<TUint32>( dnIAPRecord2->iPriority ) )
+                        delete linkedIAP;
+                        dnIAPRecord2->iIAP = 0;
+                        }
+                    else if( dnIAPRecord2->iEmbeddedSNAP != 0 )
+                        {
+                        linkedAP2 =  static_cast<CCDAccessPointRecord*>( 
+                                CCDAccessPointRecord::RecordFactoryL( KCDTIdAccessPointRecord ) );
+                        CleanupStack::PushL( linkedAP2 );
+                        TInt esnap = dnIAPRecord2->iEmbeddedSNAP;
+                        linkedAP2->iRecordTag = esnap;
+                        if ( !linkedAP->FindL( *db ))
+                            {
+                            User::Leave( KErrNotFound );
+                            }
+                        
+                        MPMLOGSTRING3( "Embedded Snap = %d Priority = %d", 
+                            (TInt)linkedAP2->iRecordTag, 
+                            static_cast<TUint32>( dnIAPRecord2->iPriority ) )
+                        CleanupStack::PopAndDestroy( linkedAP2 );
+                        dnIAPRecord2->iEmbeddedSNAP = 0;
+                        }
+                    else
+                        {
+                        // Each Snap has an initial entry in this table,
+                        // where both the IAP and EmbeddedSNAP links 
+                        // have null value. 
+                        }
+                    }
+                }
+            CleanupStack::PopAndDestroy( dnIAPRecordSet2 );
+            CleanupStack::PopAndDestroy( generic2 );
+            MPMLOGSTRING( "" )
+            }
+        CleanupStack::PopAndDestroy( linkedAP );
+        }
+
+    MPMLOGSTRING( "Display CommsDat Snaps - End" )
+
+    CleanupStack::PopAndDestroy( &prevRecordIds );
+    CleanupStack::PopAndDestroy( dnIAPRecord );
+    CleanupStack::PopAndDestroy( dnIAPRecordSet );
+    CleanupStack::PopAndDestroy( generic );
+    CleanupStack::PopAndDestroy( db );
+#endif // _DEBUG
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMCommsDatAccess::DeterminePrioritiesL
+// -----------------------------------------------------------------------------
+//
+void CMPMCommsDatAccess::DeterminePrioritiesL( 
+    RArray<TNetIap>&          aDNIaps, 
+    const RAvailableIAPList&  aAvailableIAPList,
+    CMPMServerSession&        aSession )
+    {
+    MPMLOGSTRING( "CMPMCommsDatAccess::DeterminePrioritiesL" )
+
+    TBool useGlobalPriorities( EFalse );
+
+    for( TInt i( 0 ); ( i < aDNIaps.Count() ) && !useGlobalPriorities; i++ )
+        {
+        if( aDNIaps[i].iRanking == 
+            CMManager::KDataMobilitySelectionPolicyPriorityWildCard )
+            {
+            // If any of the IAPs in the array has wildcard priority, 
+            // then global bearer priorities should be used. 
+            //
+            useGlobalPriorities = ETrue;
+            }
+        }
+
+    if( !useGlobalPriorities )
+        {
+        // If not a single IAP in the array had wildcard priority, 
+        // then local priorities defined by user should be used. 
+        //
+        return;
+        }
+
+    for( TInt i( 0 ); i < aDNIaps.Count() ; i++ )
+        {
+        MPMLOGSTRING2(
+            "CMPMCommsDatAccess::DeterminePrioritiesL: IapId = %i \
+has wildcard priority", aDNIaps[i].iIapId )
+
+        // Find out the real IAP Id and check 
+        // the global bearer priority for that.
+        // 
+        TUint32 priority( KLowestPriority );
+        TUint32 iapId;
+        FindRealIapL( aDNIaps[i].iIapId, 
+                      iapId, 
+                      aAvailableIAPList,
+                      aSession );
+
+        GlobalBearerPriorityL( iapId, 
+                               priority );
+
+        aDNIaps[i].iGlobalPriority = priority;
+
+        MPMLOGSTRING3(
+            "CMPMCommsDatAccess::DeterminePrioritiesL: IapId = %i \
+has global priority: %i", aDNIaps[i].iIapId, priority )
+        }
+
+    // Finally, sort the array according to global bearer priorities. 
+    // 
+    aDNIaps.Sort( TNetIap::CompareGlobalAndLocalPriority );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMCommsDatAccess::GlobalBearerPriorityL
+// -----------------------------------------------------------------------------
+//
+void CMPMCommsDatAccess::GlobalBearerPriorityL( const TUint32   aIapId,
+                                               TUint32&        aPriority )
+    {
+    MPMLOGSTRING2( "CMPMCommsDatAccess::GlobalBearerPriorityL: IapId: %i", 
+        aIapId )
+
+    CMDBSession* db = CMDBSession::NewLC( KCDVersion1_1 );
+
+    db->SetAttributeMask( ECDHidden | ECDProtectedWrite );
+
+    // Get the IAP record
+    // 
+    CCDIAPRecord* iap = LoadIapRecordLC( aIapId, db );
+
+    // Get the service type of aIapId
+    // 
+    TBuf<KMaxTextLength + 1> service;
+    service = iap->iServiceType.GetL();
+    MPMLOGSTRING2(
+        "CMPMCommsDatAccess::GlobalBearerPriorityL: Service type = %s",
+        service.PtrZ() )
+
+    // Get the table id from generic
+    // 
+    CMDBGenericRecord* record = static_cast<CMDBGenericRecord*>
+        ( CCDRecordBase::RecordFactoryL( 0 ) );
+    CleanupStack::PushL( record );
+    record->InitializeL( TPtrC( KCDTypeNameGlobalService ), NULL );
+    record->SetRecordId( KCDInitialRecordId );
+    record->LoadL( *db );
+
+    // Create Global Bearer Type Priorization Record
+    // 
+    CCDGlobalBearerTypePriorizationRecord* globalBearer = new ( ELeave ) 
+        CCDGlobalBearerTypePriorizationRecord( record->TableId() );
+    CleanupStack::PushL( globalBearer );
+
+    // Set the service type of aIapId to Global 
+    // Bearer Type Priorization Record
+    // 
+    globalBearer->iServiceType.SetL( service );
+
+    if( globalBearer->FindL( *db ) )
+        {
+        // Get the priority of specified service type
+        // 
+        aPriority = ( TUint32 )globalBearer->iPriority;
+        MPMLOGSTRING2(
+            "CMPMCommsDatAccess::GlobalBearerPriorityL: Priority = %i", 
+            aPriority )
+        }
+
+    // Release memory
+    //
+    CleanupStack::PopAndDestroy( globalBearer );
+    CleanupStack::PopAndDestroy( record );
+    CleanupStack::PopAndDestroy( iap );
+    CleanupStack::PopAndDestroy( db );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMCommsDatAccess::CheckWLANIapL
+// -----------------------------------------------------------------------------
+//
+void CMPMCommsDatAccess::CheckWLANIapL(CMPMServerSession& aSession)
+    {
+    MPMLOGSTRING( "CMPMCommsDatAccess::CheckWLANIapL" )
+
+    TInt err( KErrNone );
+    TBool found( EFalse );
+
+    CCommsDatabase* commsDatabase = CCommsDatabase::NewL();
+    CleanupStack::PushL( commsDatabase );
+
+    // Make hidden records visible
+    // 
+    commsDatabase->ShowHiddenRecords();
+
+    // Iterate the IAP table from CommsDat
+    CCommsDbTableView* table = NULL;
+    table = commsDatabase->OpenTableLC( TPtrC( IAP ) );
+
+    err = table->GotoFirstRecord();
+
+    while ( !err && !found )
+        {
+        TUint32 iapId( 0 );
+        TInt    length( 0 );
+
+        // Read IAP's ID
+        //
+        table->ReadUintL( TPtrC( COMMDB_ID ), iapId );
+
+        // Read IAP's service type
+        //
+        table->ReadColumnLengthL(TPtrC( IAP_SERVICE_TYPE ), length );
+        HBufC* buf = HBufC::NewLC( length );
+        TPtr ptr( buf->Des() );
+        table->ReadTextL(TPtrC( IAP_SERVICE_TYPE ), ptr );
+
+        if ( ptr.Compare( TPtrC( LAN_SERVICE ) ) == KErrNone )
+            {
+            TUint32 service( 0 );
+            table->ReadUintL( TPtrC( IAP_SERVICE ), service );
+
+            // Now open a view to LAN_SERVICE table
+            //
+            CCommsDbTableView* commsDbLanTableView = 
+                commsDatabase->OpenViewMatchingUintLC( TPtrC( LAN_SERVICE ),
+                                                       TPtrC( COMMDB_ID ),
+                                                       service );
+
+            User::LeaveIfError( commsDbLanTableView->GotoFirstRecord() );
+
+            TUint32 commDbId( 0 );
+
+            commsDbLanTableView->ReadUintL( TPtrC( COMMDB_ID ), commDbId );
+
+            // Now open a view to WLAN_SERVICE table
+            //
+            // If non wlan product, wlan tables won't exist and this will 
+            // leave. In that case do not check WLAN related issues 
+            //
+
+            CCommsDbTableView* commsDbWlanTableView( NULL );
+            TRAP( err, commsDbWlanTableView = 
+                         commsDatabase->OpenViewMatchingUintLC( 
+                                                TPtrC( WLAN_SERVICE ),
+                                                TPtrC( WLAN_SERVICE_ID ),
+                                                commDbId ); 
+                         CleanupStack::Pop( commsDbWlanTableView ); );
+            if ( err == KErrNone )
+                {
+                // Push back to cleanup stack. Object must be popped within 
+                // TRAP, to avoid unbalance in cleanup stack and panic 71
+                CleanupStack::PushL( commsDbWlanTableView );
+                
+                TInt error = commsDbWlanTableView->GotoFirstRecord();
+
+                if ( error == KErrNone )
+                    {
+                    // Easy WLAN is not considered to be "real" WLAN IAP
+                    // 
+                    TInt ssidLength( 0 );
+                    commsDbWlanTableView->ReadColumnLengthL( 
+                                                    TPtrC( NU_WLAN_SSID ), 
+                                                    ssidLength );
+                    if ( ssidLength != 0 )
+                        {
+                        found = ETrue;
+
+                        MPMLOGSTRING( "CMPMCommsDatAccess::CheckWLANIapL:\
+ Found WLAN IAP" )
+
+                        // If a single WLAN IAP was found in CommsDat, 
+                        // then set the need to scan WLAN networks as true.
+                        // 
+                        aSession.MyServer().SetWLANScanRequired( ETrue );
+                        }
+                    }
+
+                
+
+                // Release memory
+                //
+                CleanupStack::PopAndDestroy( commsDbWlanTableView );
+                }
+            else
+                {
+                MPMLOGSTRING2(
+                            "CMPMCommsDatAccess::CheckWLANIapL: WLAN table view failed, err %d", err )
+                }
+            CleanupStack::PopAndDestroy( commsDbLanTableView );
+            }
+        err = table->GotoNextRecord();
+
+        CleanupStack::PopAndDestroy( buf );
+        }
+
+    // If not a single WLAN IAP was found in CommsDat, 
+    // then set the need to scan WLAN networks as false.
+    // 
+    if ( !found )
+        {
+        MPMLOGSTRING( "CMPMCommsDatAccess::CheckWLANIapL: Not found WLAN IAP" )
+        aSession.MyServer().SetWLANScanRequired( EFalse );
+        }
+
+    CleanupStack::PopAndDestroy( table );
+    CleanupStack::PopAndDestroy( commsDatabase );
+    }
+        
+// -----------------------------------------------------------------------------
+// CMPMCommsDatAccess::CheckWLANIapWithSsidL
+// -----------------------------------------------------------------------------
+//
+
+TUint32 CMPMCommsDatAccess::CheckWLANIapWithSsidL( TWlanSsid& aSsid, 
+                                                   TUint32 aSecMode,
+                                                   TWlanNetMode aConnMode )
+    {
+    MPMLOGSTRING( "CMPMCommsDatAccess::CheckWLANIapWithSsidL" )
+    TUint iapId( 0 );
+
+    // Creating a session with the latest version
+    //     
+    CMDBSession* db = CMDBSession::NewLC( KCDVersion1_1 );
+
+    db->SetAttributeMask( ECDHidden | ECDProtectedWrite );
+
+    // Find Wlan service record
+    //
+    TBuf<KWlanMaxSsidLength> ssid16;
+    CnvUtfConverter::ConvertToUnicodeFromUtf8( ssid16, aSsid );
+    MPMLOGSTRING4( "CMPMCommsDatAccess::CheckWLANIapWithSsidL sec:%d, conn:%d ssid %S", 
+                   aSecMode, 
+                   aConnMode, 
+                   &ssid16 )
+    CMDBRecordSet<CCDWlanServiceRecord>* wlanSet = 
+        new ( ELeave ) CMDBRecordSet<CCDWlanServiceRecord>( 
+         CCDWlanServiceRecord::TableIdL( *db ) );
+    CleanupStack::PushL( wlanSet ); 
+
+    CCDWlanServiceRecord* wlanRecord = new ( ELeave ) 
+        CCDWlanServiceRecord( CCDWlanServiceRecord::TableIdL( *db ) );
+
+    CleanupStack::PushL( wlanRecord ); 
+    wlanSet->LoadL( *db );
+    
+    MPMLOGSTRING2( "CMPMCommsDatAccess::CheckWLANIapWithSsidL, record count:%d", 
+                   wlanSet->iRecords.Count() )
+    TBool matchFound( EFalse );
+    for (TInt i = 0; ( i < wlanSet->iRecords.Count() ) && !matchFound; i++ )
+        {
+        wlanRecord->SetElementId( GetRealElementId( wlanSet->iRecords[i] ) );
+        wlanRecord->LoadL( *db );
+        TBuf<KWlanMaxSsidLength> ssid;
+        ssid = wlanRecord->iWLanSSID;
+        //if not easywlan, continue
+        //
+        if( ssid.Compare( KNullDesC() ) )
+            {
+            ssid = wlanRecord->iWLanSSID.GetL();
+            TUint32 secMode = wlanRecord->iWlanSecMode;
+            TUint32 connMode = wlanRecord->iWlanConnMode;
+        
+            if ( connMode )
+                {
+                connMode = 1;    
+                }
+            MPMLOGSTRING3( "CMPMCommsDatAccess::CheckWLANIapWithSsidL CommsDat secmode:%d, connmode:%d ", 
+        				   secMode, 
+        				   connMode )
+
+            if ( !ssid.Compare( ssid16 ) && ( aConnMode == connMode ) )
+        	    {
+        	    //compare sec mode
+        	    if ( aSecMode == EWlanSecModeOpen || aSecMode == EWlanSecModeWep )
+        		    {
+        		    if ( aSecMode == secMode )
+        		        {
+        		        MPMLOGSTRING( "CMPMCommsDatAccess::CheckWLANIapWithSsidL match found, open/wep " )
+        		        matchFound = ETrue;
+        		        }
+        			    
+        		    }
+            	//WPA PSK case
+            	else if ( aSecMode == EWlanSecModeWpa2 )
+            		{
+        	    	if ( ( secMode > EWlanSecModeWep ) && (wlanRecord->iWlanEnableWpaPsk) )
+        	    	    {
+        	    	    MPMLOGSTRING( "CMPMCommsDatAccess::CheckWLANIapWithSsidL match found, wpa psk " )
+        	    	    matchFound = ETrue;
+        	    	    }
+            		}
+            	//aSecMode = EWlanSecModeWpa
+            	else
+            		{
+        	    	if ( secMode > EWlanSecModeWep )
+        	    	    {
+        	    	    MPMLOGSTRING( "CMPMCommsDatAccess::CheckWLANIapWithSsidL match found, wpa " )
+        	    	    matchFound = ETrue;
+        	    	    }
+            		}
+        			
+        		}
+        	}
+        }
+    
+    if ( matchFound )
+        {
+        // load Iap record
+        //
+        CCDIAPRecord* iapRecord = static_cast<CCDIAPRecord*> ( 
+            CCDRecordBase::RecordFactoryL( KCDTIdIAPRecord ) );
+        CleanupStack::PushL( iapRecord );
+
+        CCDLANServiceRecord* lanRecord = static_cast<CCDLANServiceRecord*> (
+            CCDRecordBase::RecordFactoryL( KCDTIdLANServiceRecord ));
+        CleanupStack::PushL( lanRecord );
+        
+        iapRecord->iServiceType.SetL( TPtrC( KCDTypeNameLANService ) );
+        
+        lanRecord->SetRecordId( wlanRecord->iWlanServiceId );
+        lanRecord->LoadL( *db );
+
+        iapRecord->iService = lanRecord->ElementId();
+
+/*        iapRecord->iServiceType.SetL( TPtrC( KCDTypeNameLANService ) );
+        iapRecord->iService = wlanRecord->iWlanServiceId;
+*/
+        if( iapRecord->FindL( *db ) )
+            {
+            MPMLOGSTRING( "CMPMCommsDatAccess::CheckWLANIapWithSsidL iap found" )
+            // Iap record found
+            //
+            iapId = iapRecord->RecordId();
+            }
+        CleanupStack::PopAndDestroy( lanRecord );
+        CleanupStack::PopAndDestroy( iapRecord );
+        }
+    CleanupStack::PopAndDestroy( wlanRecord );
+    CleanupStack::PopAndDestroy( wlanSet );
+    CleanupStack::PopAndDestroy( db );
+    
+    return iapId;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMCommsDatAccess::SetEasyWlanDataL
+// -----------------------------------------------------------------------------
+//
+void CMPMCommsDatAccess::SetEasyWlanDataL( const TWlanSsid& aSsid,
+                                           TUint            aSecMode,
+                                           TWlanNetMode     aConnMode,
+                                           TWepKeyData      aWepData,
+                                           TUint            aEnableWpaPsk,
+                                           const TDesC8&    aWpaPsk,
+                                           TUint            aWpaKeyLen )
+    {
+    MPMLOGSTRING( "CMPMCommsDatAccess::SetEasyWlanDataL" )
+    CMDBSession* dbSession = CMDBSession::NewL( KCDVersion1_1 );
+    CleanupStack::PushL(dbSession);
+
+    // Try to open a transaction to obtain write lock
+    dbSession->OpenTransactionL();
+
+    TUint32 wlanId = FindEasyWlanServiceIdL( dbSession );
+    if( !wlanId )
+        {
+        MPMLOGSTRING( "CMPMCommsDatAccess::SetEasyWlanDataL unable to store \
+ easy wlan settings" )
+        dbSession->Close();		
+		CleanupStack::PopAndDestroy( dbSession );
+        return;
+        }
+    
+    CMDBGenericRecord* record = static_cast<CMDBGenericRecord*> 
+				    ( CCDRecordBase::RecordFactoryL( 0));
+    CleanupStack::PushL( record );
+    record->InitializeL( TPtrC( WLAN_SERVICE ),NULL );
+    record->SetRecordId( wlanId );
+    record->LoadL( *dbSession );
+
+        TBuf<KWlanMaxSsidLength> ssid16;
+        CnvUtfConverter::ConvertToUnicodeFromUtf8( ssid16, aSsid );
+        CMDBField<TDesC>* textField = (CMDBField<TDesC>*)record->GetFieldByIdL(KCDTIdWlanUsedSSID);
+        textField->SetMaxLengthL( ssid16.Length());
+        textField->SetL( ssid16 );
+    
+        *((CMDBField<TUint32>*)record->GetFieldByIdL(KCDTIdWlanSecMode)) = aSecMode;
+        *((CMDBField<TUint32>*)record->GetFieldByIdL(KCDTIdWlanConnMode)) = aConnMode;
+    
+        if (aEnableWpaPsk)
+    	    {
+    	    MPMLOGSTRING( "CMPMCommsDatAccess::SetEasyWlanDataL wpa psk" )
+    	    CMDBField<TDesC8>* binField = (CMDBField<TDesC8>*)
+		   									record->GetFieldByIdL(KCDTIdWlanWpaPreSharedKey);
+		    binField->SetMaxLengthL( aWpaKeyLen );
+		    binField->SetL( aWpaPsk );
+
+		    *((CMDBField<TUint32>*)record->GetFieldByIdL(KCDTIdWlanWpaKeyLength)) = aWpaKeyLen;
+		    *((CMDBField<TUint32>*)record->GetFieldByIdL(KCDTIdWlanEnableWpaPsk)) = aEnableWpaPsk;
+    	    }
+        else if (aSecMode == EWlanSecModeWep)
+    	    {
+    	    MPMLOGSTRING( "CMPMCommsDatAccess::SetEasyWlanDataL wep psk" )
+     	    *((CMDBField<TUint32>*)record->GetFieldByIdL( KCDTIdWlanWepIndex )) = 
+     	        aWepData.iDefaultWep;
+ 
+    	    SetWepKeyL( KCDTIdWlanFormatKey1, KCDTIdWlanWepKey1, 
+    	                aWepData.iWep1, aWepData.iWepFormat1, record );
+            SetWepKeyL( KCDTIdWlanFormatKey2, KCDTIdWlanWepKey2, 
+                        aWepData.iWep2, aWepData.iWepFormat2, record );
+            SetWepKeyL( KCDTIdWlanFormatKey3, KCDTIdWlanWepKey3, 
+                        aWepData.iWep3, aWepData.iWepFormat3, record );
+            SetWepKeyL( KCDTIdWlanFormatKey4, KCDTIdWlanWepKey4, 
+                        aWepData.iWep4, aWepData.iWepFormat4, record );
+    	    }
+    	else
+    	    {
+    	    MPMLOGSTRING2( "CMPMCommsDatAccess::SetEasyWlanDataL sec mode %d, no key data written",
+    	         aSecMode )
+    	    }
+    
+        //Finally save all to commsdat.
+        record->ModifyL( *dbSession );
+        dbSession->CommitTransactionL();
+        dbSession->Close();
+        CleanupStack::PopAndDestroy( record );
+        CleanupStack::PopAndDestroy( dbSession );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMCommsDatAccess::SetWepKeyL
+// -----------------------------------------------------------------------------
+//
+void CMPMCommsDatAccess::SetWepKeyL( TMDBElementId       aFormatId,
+                                     TMDBElementId       aKeyId, 
+                                     TWlanWepKey         aWepKey,
+                                     TUint               aWepFormat,
+                                     CMDBGenericRecord*  aRecord )
+    {
+    CMDBField<TUint32>* formatField = static_cast<CMDBField<TUint32>*>
+            ( aRecord->GetFieldByIdL( aFormatId ) );
+    formatField->SetL( aWepFormat );
+    CMDBField<TDesC8>* wepKey = static_cast<CMDBField<TDesC8>*>
+            ( aRecord->GetFieldByIdL( aKeyId ) );
+    if ( aWepFormat )
+        {
+        wepKey->SetL( aWepKey );
+        }
+    else
+        {
+        //Convert Ascii to Hex format, as only Hex value to be stored in CommsDat
+        HBufC8* buf8Conv = HBufC8::NewLC( aWepKey.Length() * KMpmDoubleLength );
+        ConvertAsciiToHex( aWepKey, buf8Conv );
+        wepKey->SetL( buf8Conv->Des() );
+        CleanupStack::PopAndDestroy( buf8Conv );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMCommsDatAccess::ConvertAsciiToHex
+// -----------------------------------------------------------------------------
+//
+void CMPMCommsDatAccess::ConvertAsciiToHex( const TDesC8& aSource, 
+        							        HBufC8* aDest )
+    {
+    MPMLOGSTRING( "CMPMCommsDatAccess::ConvertAsciiToHex" )
+    _LIT( hex, "0123456789ABCDEF" );
+    TInt size = aSource.Size();
+    TPtr8 ptr = aDest->Des();
+    for ( TInt ii = 0; ii < size; ii++ )
+    	{
+    	TText8 ch = aSource[ii];
+    	ptr.Append( hex()[(ch/16)&0x0f] );
+    	ptr.Append( hex()[ch&0x0f] );
+    	}
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMCommsDatAccess::FindEasyWlanServiceIdL
+// -----------------------------------------------------------------------------
+//
+TUint32 CMPMCommsDatAccess::FindEasyWlanServiceIdL( CMDBSession* aDb )
+    {
+    // if the method returns the record container there is for 
+    // some reason garbage data in the key values
+    //
+    TUint32 wlanId( 0 );
+    MPMLOGSTRING( "CMPMCommsDatAccess::FindEasyWlanServiceIdL" )    
+
+    CMDBRecordSet<CCDWlanServiceRecord>* wlanSet = 
+        new ( ELeave ) CMDBRecordSet<CCDWlanServiceRecord>( 
+         CCDWlanServiceRecord::TableIdL( *aDb ) );
+    CleanupStack::PushL( wlanSet ); 
+    wlanSet->LoadL( *aDb );
+    
+    TBool found( EFalse );
+    for ( TInt i = 0; i < wlanSet->iRecords.Count() && !found; i++ )
+        {
+        CCDWlanServiceRecord* wlanRecord = new ( ELeave ) 
+            CCDWlanServiceRecord( CCDWlanServiceRecord::TableIdL( *aDb ) );
+        CleanupStack::PushL( wlanRecord );
+
+        wlanRecord->SetElementId( GetRealElementId( wlanSet->iRecords[i] ) );
+        wlanRecord->LoadL( *aDb );
+        
+        TDesC ssid = wlanRecord->iWLanSSID;
+        if( !ssid.Compare( KNullDesC() ) )
+            {
+            MPMLOGSTRING2( "CMPMCommsDatAccess::FindEasyWlanServiceIdL: \
+found service entry %i", wlanRecord->RecordId() )
+            wlanId = wlanRecord->RecordId();
+            found = ETrue;
+            }
+        CleanupStack::PopAndDestroy( wlanRecord );
+        }
+    CleanupStack::PopAndDestroy( wlanSet );
+    return wlanId;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMCommsDatAccess::CheckHiddenAgentL
+// -----------------------------------------------------------------------------
+//
+TBool CMPMCommsDatAccess::CheckHiddenAgentL( const TUint32 aIapId ) const
+    {
+    MPMLOGSTRING2( "CMPMCommsDatAccess::CheckHiddenAgentL: IapId: %i", aIapId )
+
+    TBool retValue( EFalse );
+
+    CMDBSession* db = CMDBSession::NewLC( KCDVersion1_1 );
+
+    db->SetAttributeMask( ECDHidden | ECDProtectedWrite );
+
+    // First check that IAP exists
+    // 
+    CCDIAPRecord* iap = LoadIapRecordLC( aIapId, db );
+
+    // Initialize generic record
+    // 
+    CMDBGenericRecord* generic = static_cast<CMDBGenericRecord*> ( 
+        CCDRecordBase::RecordFactoryL( 0 ) );
+    CleanupStack::PushL( generic );
+    generic->InitializeL( TPtrC( KCDTypeNameIAPMetadata ), NULL );
+    generic->LoadL( *db );
+
+    CCDIAPMetadataRecord* record = new( ELeave ) CCDIAPMetadataRecord( 
+        generic->TableId() );
+    CleanupStack::PushL( record );
+
+    // Check if the metadata entry exists
+    // 
+    record->iIAP.SetL( GetRealElementId( iap ) );
+    if ( record->FindL( *db ) )
+        {
+        // Metadata is specified, check is it true or false.
+        // 
+        if ( record->iMetadata & EMetaHiddenAgent )
+            {
+            MPMLOGSTRING( "CMPMCommsDatAccess::CheckHiddenAgentL: True" )
+            retValue = ETrue;
+            }
+        else
+            {
+            MPMLOGSTRING( "CMPMCommsDatAccess::CheckHiddenAgentL: False" )
+            retValue = EFalse;
+            }
+        }
+    else
+        {
+        // Metadata unspecified, use default value.
+        // 
+        MPMLOGSTRING( "CMPMCommsDatAccess::CheckHiddenAgentL: False" )
+        retValue = EFalse;
+        }
+
+    // Release memory
+    //
+    CleanupStack::PopAndDestroy( record );
+    CleanupStack::PopAndDestroy( generic );
+    CleanupStack::PopAndDestroy( iap );
+    CleanupStack::PopAndDestroy( db );
+
+    return retValue;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMCommsDatAccess::MatchSSIDL
+// -----------------------------------------------------------------------------
+//
+void CMPMCommsDatAccess::MatchSSIDL( const TWlanSsid&   aSSID,
+                                     TUint32            aIapId, 
+                                     TBool&             aMatchFound,
+                                     CMPMServerSession& aSession )
+    {
+#ifdef __WINS__    	
+    // To suppress compilation warning in WINSCW UREL build. aSession is used only for logging. 
+    aSession;
+#endif
+    
+    MPMLOGSSID( "CMPMCommsDatAccess<0x%x>::MatchSSIDL: aSSID = %S", 
+        aSession.ConnectionId(), &aSSID )
+
+    MPMLOGSTRING3( "CMPMCommsDatAccess<0x%x>::MatchSSIDL: aIapId = %d", 
+        aSession.ConnectionId(), aIapId )
+
+    aMatchFound = EFalse;
+
+    CCommsDatabase* commsDatabase = CCommsDatabase::NewL();
+    CleanupStack::PushL( commsDatabase );
+
+    // Make hidden records visible
+    // 
+    commsDatabase->ShowHiddenRecords();
+
+    CCommsDbTableView* commsDbIapTableView = 
+        commsDatabase->OpenViewMatchingUintLC( TPtrC( IAP ),
+                                               TPtrC( COMMDB_ID ),
+                                               aIapId );
+
+    User::LeaveIfError( commsDbIapTableView->GotoFirstRecord() );
+
+    TInt length1( 0 );
+
+    commsDbIapTableView->ReadColumnLengthL( TPtrC( IAP_SERVICE_TYPE ), 
+                                            length1 );
+    HBufC* buf1 = HBufC::NewLC( length1 );
+    TPtr ptr1( buf1->Des() );
+
+    // Read IAP's service type
+    //
+    commsDbIapTableView->ReadTextL(TPtrC( IAP_SERVICE_TYPE ), ptr1 );
+
+    MPMLOGSTRING3(
+        "CMPMCommsDatAccess<0x%x>::MatchSSIDL: IAP service type = %S",
+        aSession.ConnectionId(), &ptr1 )
+
+    // In case offline mode is enabled, we need to find out what type 
+    // of bearer is used. Only LAN or WLAN is allowed in offline mode.
+    // 
+    if ( ptr1.Compare( TPtrC( LAN_SERVICE ) ) == KErrNone )
+        {
+        TUint32 service( 0 );
+        commsDbIapTableView->ReadUintL( TPtrC( IAP_SERVICE ), service );
+
+        // Now open a view to LAN_SERVICE table
+        //
+        CCommsDbTableView* commsDbLanTableView = 
+            commsDatabase->OpenViewMatchingUintLC( TPtrC( LAN_SERVICE ),
+                                                   TPtrC( COMMDB_ID ),
+                                                   service );
+
+        User::LeaveIfError( commsDbLanTableView->GotoFirstRecord() );
+
+        TUint32 commDbId( 0 );
+
+        commsDbLanTableView->ReadUintL( TPtrC( COMMDB_ID ), commDbId );
+
+        // Now open a view to WLAN_SERVICE table
+        //
+        CCommsDbTableView* commsDbWlanTableView = 
+            commsDatabase->OpenViewMatchingUintLC( TPtrC( WLAN_SERVICE ),
+                                                   TPtrC( WLAN_SERVICE_ID ),
+                                                   commDbId );
+
+        TInt err = commsDbWlanTableView->GotoFirstRecord();
+
+        if ( err == KErrNone )
+            {
+            TWlanSsid ssid;
+            commsDbWlanTableView->ReadTextL( TPtrC( NU_WLAN_SSID ), ssid );
+
+            if ( aSSID.Compare( ssid ) == KErrNone )
+                {
+                aMatchFound = ETrue;
+                MPMLOGSTRING2(
+                    "CMPMCommsDatAccess<0x%x>::MatchSSIDL Found matching SSID",
+                    aSession.ConnectionId() )
+                }
+            }
+        else
+            {
+            MPMLOGSTRING3( "CMPMCommsDatAccess<0x%x>::MatchSSID\
+ GotoFirstRecord returned %d", aSession.ConnectionId(), err )
+            }
+
+        // Release memory
+        //
+        CleanupStack::PopAndDestroy( commsDbWlanTableView );
+        CleanupStack::PopAndDestroy( commsDbLanTableView );
+        }
+
+    // Release memory
+    //
+    CleanupStack::PopAndDestroy( buf1 );
+    CleanupStack::PopAndDestroy( commsDbIapTableView );
+    CleanupStack::PopAndDestroy( commsDatabase );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMCommsDatAccess::IsVirtualIapL
+// -----------------------------------------------------------------------------
+//
+TBool CMPMCommsDatAccess::IsVirtualIapL( const TUint32 aVirtualIapId ) const
+    {
+    MPMLOGSTRING2( "CMPMCommsDatAccess::IsVirtualIapL: VirtualIapId: %i", 
+        aVirtualIapId )
+    TBool isVirtual( EFalse );
+
+    // Open transaction
+    // 
+    CMDBSession* db = CMDBSession::NewLC( KCDVersion1_1 );
+
+    db->SetAttributeMask( ECDHidden | ECDProtectedWrite );
+
+    // Get IAP
+    // 
+    CCDIAPRecord* iap = LoadIapRecordLC( aVirtualIapId, db );
+
+    TDesC& type = iap->iBearerType.GetL();
+
+    if( type.Compare( TPtrC ( KCDTypeNameVirtualBearer ) ) == 0 )
+        {
+        isVirtual = ETrue;
+        MPMLOGSTRING( "CMPMCommsDatAccess::IsVirtualIapL: \
+is virtual" )
+        }
+    CleanupStack::PopAndDestroy( iap );
+    CleanupStack::PopAndDestroy( db );
+    return isVirtual;
+    }
+    
+// -----------------------------------------------------------------------------
+// CMPMCommsDatAccess::SnapContainsWlanL
+// -----------------------------------------------------------------------------
+//
+TBool CMPMCommsDatAccess::SnapContainsWlanL( TUint32			aSnapRecord, 
+                                             RArray<TUint>& 	aIapPath, 
+                                             TInt 		    	aMinNrWlan )
+    {
+    MPMLOGSTRING3( "CMPMCommsDatAccess::SnapContainsWlanL: snap %d, nr Wlans %d", 
+        aSnapRecord, aMinNrWlan )
+    TInt wlanFound(0);
+    RArray<TNetIap> destNetIaps;
+    CleanupClosePushL( destNetIaps );
+
+    // Find the valid IAPs belonging to the Snap 
+    // and possible embedded SNAP. Store both in same array.
+    //
+    SearchDNEntriesWithEmbeddedL( aSnapRecord, destNetIaps, destNetIaps );
+
+    // Check type of each IAP 
+    // Stop when specified number of WLAN IAPs has been found
+    // 
+    for( TInt j( 0 ); ( j < destNetIaps.Count() ) && 
+                      ( wlanFound < aMinNrWlan ); j++ )
+        {
+        // If entry is for embedded SNAP there are more than two chained 
+        // embedded snaps. This is illegal configuration. Skip this entry.
+        // 
+        if ( destNetIaps[j].iEmbeddedSnap != 0 )
+            {
+            MPMLOGSTRING( "CMPMCommsDatAccess::SnapContainsWlanL: \
+Illegal configuration, more than one chained SNAP" )
+            }
+        else
+            {
+            if( CheckWlanL( destNetIaps[j].iIapId ) != ENotWlanIap )
+                {
+                MPMLOGSTRING(
+                    "CMPMCommsDatAccess::SnapContainsWlanL: WLAN IAP found" )
+                wlanFound++;
+                }
+            // If virtual IAP, check whether it may be using WLAN
+            // 
+            if( wlanFound < aMinNrWlan && IsVirtualIapL( destNetIaps[j].iIapId ) )
+                {
+                if ( WlanUnderVirtualL( destNetIaps[j].iIapId,
+                                        aIapPath ) )
+                    {
+                    MPMLOGSTRING( "CMPMCommsDatAccess::SnapContainsWlanL: \
+WLAN IAP under virtual IAP found" )
+                    wlanFound++;
+                    }
+            
+                }
+            }
+        }
+    CleanupStack::PopAndDestroy( &destNetIaps );
+    if( wlanFound < aMinNrWlan ) 
+        {
+        MPMLOGSTRING( "CMPMCommsDatAccess::SnapContainsWlanL: result false" )
+        return EFalse;
+        }
+    else
+        {
+        MPMLOGSTRING( "CMPMCommsDatAccess::SnapContainsWlanL: result true" )
+        return ETrue;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMCommsDatAccess::SearchDNEntriesWithEmbeddedL
+// -----------------------------------------------------------------------------
+//
+void CMPMCommsDatAccess::SearchDNEntriesWithEmbeddedL( TUint32 aSnap, 
+                                                      RArray<TNetIap>& aDestNetIaps,
+                                                      RArray<TNetIap>& aEmbeddedIaps )
+    {
+    // Find the valid IAPs belonging to the Snap.
+    //
+    SearchDNEntriesL( aSnap, aDestNetIaps );
+
+    TBool embeddedFound( EFalse );
+
+    // Find the valid IAPs belonging to the embedded Snaps.
+    // 
+    for( TInt j = 0;( ( j < aDestNetIaps.Count() ) && !embeddedFound ); j++ )
+        {
+        // Go through the destNetIaps-array looking for EmbeddedId.
+        // 
+        if( aDestNetIaps[j].iEmbeddedSnap != 0 )
+            {
+            MPMLOGSTRING2( "CMPMCommsDatAccess::SearchDNEntriesWithEmbeddedL: \
+Search Embedded SNAP: %i", aDestNetIaps[j].iEmbeddedSnap )
+
+            TUint32 embedded = aDestNetIaps[j].iEmbeddedSnap;
+            // Exclude embedded Snap from destNetIaps, since 
+            // the IAPs it contains are listed in embeddedIaps. 
+            // 
+            aDestNetIaps.Remove( j );
+
+            // If found, then search the IAPs belonging 
+            // to that embedded Snap.
+            // 
+            SearchDNEntriesL( embedded, aEmbeddedIaps );
+            embeddedFound = ETrue;
+            }
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMCommsDatAccess::CheckWLanL
+// -----------------------------------------------------------------------------
+//
+TWlanIapType CMPMCommsDatAccess::CheckWlanL( TUint32 aIapId ) const
+    {
+    MPMLOGSTRING2( "CMPMCommsDatAccess::CheckWlanL: IAP Id = %i", aIapId)
+
+    TWlanIapType wlan( ENotWlanIap );
+    CCommsDatabase* commsDatabase = CCommsDatabase::NewL();
+    CleanupStack::PushL( commsDatabase );
+
+    // Make hidden records visible
+    // 
+    commsDatabase->ShowHiddenRecords();
+
+    CCommsDbTableView* commsDbIapTableView = 
+        commsDatabase->OpenViewMatchingUintLC( TPtrC( IAP ),
+                                               TPtrC( COMMDB_ID ),
+                                               aIapId );
+
+    User::LeaveIfError( commsDbIapTableView->GotoFirstRecord() );
+
+    TInt length1( 0 );
+
+    commsDbIapTableView->ReadColumnLengthL( TPtrC( IAP_SERVICE_TYPE ), 
+                                            length1 );
+
+    HBufC* buf1 = HBufC::NewLC( length1 );
+    TPtr ptr1( buf1->Des() );
+
+    // Read IAP's service type
+    //
+    commsDbIapTableView->ReadTextL(TPtrC( IAP_SERVICE_TYPE ), ptr1 );
+    MPMLOGSTRING2(
+        "CMPMCommsDatAccess::CheckWlanL: IAP service type = %S", &ptr1 )
+
+    if ( ptr1.Compare( TPtrC( LAN_SERVICE ) ) == KErrNone )
+        {
+        TUint32 service( 0 );
+        commsDbIapTableView->ReadUintL( TPtrC( IAP_SERVICE ), service );
+
+        // Now open a view to LAN_SERVICE table
+        //
+        CCommsDbTableView* commsDbLanTableView = 
+            commsDatabase->OpenViewMatchingUintLC( TPtrC( LAN_SERVICE ),
+                                                   TPtrC( COMMDB_ID ),
+                                                   service );
+
+        User::LeaveIfError( commsDbLanTableView->GotoFirstRecord() );
+
+        TUint32 commDbId( 0 );
+
+        commsDbLanTableView->ReadUintL( TPtrC( COMMDB_ID ), commDbId );
+
+        // Now open a view to WLAN_SERVICE table
+        //
+        // If non wlan product, wlan tables won't exist and this will 
+        // leave. In that case do not check WLAN related issues 
+        //
+
+        CCommsDbTableView* commsDbWlanTableView( NULL );
+        TRAPD( err2, commsDbWlanTableView = 
+                     commsDatabase->OpenViewMatchingUintLC( TPtrC( WLAN_SERVICE ),
+                                                            TPtrC( WLAN_SERVICE_ID ),
+                                                            commDbId );
+                     CleanupStack::Pop( commsDbWlanTableView ) );
+        if ( err2 == KErrNone )
+            {
+            // Push back to cleanup stack. Object must be popped within 
+            // TRAP, to avoid unbalance in cleanup stack and panic 71
+            CleanupStack::PushL( commsDbWlanTableView );
+
+            TInt err = commsDbWlanTableView->GotoFirstRecord();
+
+            if ( err == KErrNone )
+                {
+                MPMLOGSTRING( "CMPMCommsDatAccess::CheckWlanL: IAP is WLAN" )
+                wlan = EWlanIap;
+                TInt ssidLength( 0 );
+                commsDbWlanTableView->ReadColumnLengthL( TPtrC( NU_WLAN_SSID ), 
+                                                     ssidLength );
+                if ( ssidLength == 0 )
+                    {
+                    MPMLOGSTRING(
+                        "CMPMCommsDatAccess::CheckWlanL: IAP is Easy WLAN" )
+                    wlan = EEasyWlanIap;
+                    }
+                }
+            else
+                {
+                MPMLOGSTRING2( "CMPMCommsDatAccess::CheckWlanL\
+ GotoFirstRecord returned %d", err )
+               }
+            // Release memory
+            //
+            CleanupStack::PopAndDestroy( commsDbWlanTableView );            
+            }
+        else
+            {
+            MPMLOGSTRING2(
+                        "CMPMCommsDatAccess::CheckWlanL: WLAN table view failed, err %d", err2 )
+            }                
+        CleanupStack::PopAndDestroy( commsDbLanTableView );
+        }
+
+    // Release memory
+    //
+    CleanupStack::PopAndDestroy( buf1 );
+    CleanupStack::PopAndDestroy( commsDbIapTableView );
+    CleanupStack::PopAndDestroy( commsDatabase );
+
+    return wlan;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMCommsDatAccess::RemoveCategorisedIapsL
+// -----------------------------------------------------------------------------
+//
+void CMPMCommsDatAccess::RemoveCategorisedIapsL( RAvailableIAPList& aIAPList )
+    {
+    MPMLOGSTRING( "CMPMCommsDatAccess::RemoveCategorisedIapsL" )
+
+    // Creating a session with the latest version
+    // 
+    CMDBSession* db = CMDBSession::NewLC( KCDVersion1_1 );
+
+    db->SetAttributeMask( ECDHidden | ECDProtectedWrite );
+
+    // Create the generic record set
+    // 
+    CMDBGenericRecord* generic = static_cast<CMDBGenericRecord*>
+        ( CCDRecordBase::RecordFactoryL( 0 ) ); 
+    CleanupStack::PushL( generic );  
+    generic->InitializeL( TPtrC( KCDTypeNameDataMobilitySelectionPolicy ), 
+                          NULL );
+    generic->LoadL( *db );
+
+    // Create the DN-IAP record set
+    // 
+    CMDBRecordSet<CCDDataMobilitySelectionPolicyRecord>* dnIAPRecordSet = 
+        new ( ELeave ) CMDBRecordSet<CCDDataMobilitySelectionPolicyRecord>( 
+        generic->TableId() );
+    CleanupStack::PushL( dnIAPRecordSet ); 
+
+    CCDDataMobilitySelectionPolicyRecord* dnIAPRecord = new ( ELeave ) 
+        CCDDataMobilitySelectionPolicyRecord( generic->TableId() );
+    CleanupStack::PushL( dnIAPRecord );
+
+    // Find all the DN-IAP records
+    // Trap leave in case no records exist
+    // 
+    TRAPD( err, dnIAPRecordSet->LoadL( *db ) )
+    if( err != KErrNone )
+        {
+        // print error code to log
+        //
+        MPMLOGSTRING2( "CMPMCommsDatAccess::RemoveCategorisedIapsL, \
+loading DM selection policy records failed with %d", err )
+        CleanupStack::PopAndDestroy( dnIAPRecord );
+        CleanupStack::PopAndDestroy( dnIAPRecordSet );
+        CleanupStack::PopAndDestroy( generic );
+        CleanupStack::PopAndDestroy( db );
+        return;
+        }
+
+    CCDIAPRecord*           linkedIAP;
+    CCDAccessPointRecord*   linkedAP;
+    RArray<TInt>            prevRecordIds;
+    CleanupClosePushL( prevRecordIds );
+
+    // prepare for searching APs.
+
+    for ( TInt i = 0; i < dnIAPRecordSet->iRecords.Count(); i++ )
+        {
+        linkedAP =  static_cast<CCDAccessPointRecord*>( CCDAccessPointRecord::RecordFactoryL( KCDTIdAccessPointRecord ) );
+        CleanupStack::PushL( linkedAP );
+        // Load each DN-IAP entry based on the elementId in the record set
+        // 
+        dnIAPRecord->SetElementId( GetRealElementId( dnIAPRecordSet->iRecords[i] ) );
+        dnIAPRecord->LoadL( *db );
+
+        // Find the SNAP AP pointed by DN-IAP entry
+        //
+        linkedAP->iRecordTag = (TInt)dnIAPRecord->iSNAP;
+        TBool found = linkedAP->FindL( *db );
+
+        if ( found && KErrNotFound == prevRecordIds.Find( linkedAP->RecordId() ) )
+            {
+            prevRecordIds.Append( linkedAP->RecordId() );
+            
+            // Print the DN and host name pointed by DN-IAP entry.
+            // HostName is EText field.
+            // 
+            TBuf<KMaxTextLength + 1> dn = linkedAP->iRecordName.GetL();
+            MPMLOGSTRING3( "    Snap: %d Snap Name = %s", (TInt)linkedAP->iRecordTag, dn.PtrZ() )
+            
+            // Related DN-IAP records 
+            // Get the table id from generic record
+            // 
+            CMDBGenericRecord* generic2 = static_cast<CMDBGenericRecord*>
+                ( CCDRecordBase::RecordFactoryL( 0 ) ); 
+            CleanupStack::PushL( generic2 );  
+            generic2->InitializeL( TPtrC( 
+                KCDTypeNameDataMobilitySelectionPolicy ), NULL );
+            generic2->LoadL( *db );
+            
+            // Doesn't quite work with generic records
+            // 
+            CMDBRecordSet<CCDDataMobilitySelectionPolicyRecord>* 
+                dnIAPRecordSet2 = new ( ELeave ) 
+                CMDBRecordSet<CCDDataMobilitySelectionPolicyRecord>( 
+                generic2->TableId() );
+            CleanupStack::PushL( dnIAPRecordSet2 ); 
+            
+            // Prime one record with DN 
+            // 
+            CCDDataMobilitySelectionPolicyRecord* dnIAPRecord2 = 
+                new ( ELeave ) CCDDataMobilitySelectionPolicyRecord( generic2->TableId() );
+            CleanupStack::PushL( dnIAPRecord2 );
+            dnIAPRecord2->iSNAP = (TInt)linkedAP->iRecordTag;
+            dnIAPRecordSet2->iRecords.Append( dnIAPRecord2 );
+            CleanupStack::Pop( dnIAPRecord2 );
+
+            if ( dnIAPRecordSet2->FindL( *db ) )
+                {
+                for (TInt j = 0; j < dnIAPRecordSet2->iRecords.Count(); j++)
+                    {
+                    dnIAPRecord2->SetElementId( GetRealElementId( dnIAPRecordSet2->iRecords[j] ) );
+                    dnIAPRecord2->LoadL( *db );
+
+                    if ( dnIAPRecord2->iIAP != 0 )
+                        {
+                        linkedIAP = static_cast<CCDIAPRecord*>
+                            ( LoadLinkedRecordL( *db, dnIAPRecord2->iIAP ) );
+
+                        // Remove categorised IAP from aIAPList
+                        // 
+                        TInt index = KErrNotFound;
+                        index = aIAPList.Find( linkedIAP->RecordId() );
+                        if ( index != KErrNotFound )
+                            {
+                            MPMLOGSTRING2(
+                                "        Remove categorised IAP = %i", 
+                                linkedIAP->RecordId() )
+                            aIAPList.Remove( index );
+                            }
+
+                        delete linkedIAP;
+                        dnIAPRecord2->iIAP = 0;
+                        }
+                    }
+                }
+            CleanupStack::PopAndDestroy( dnIAPRecordSet2 );
+            CleanupStack::PopAndDestroy( generic2 );
+            }
+        CleanupStack::PopAndDestroy( linkedAP );
+        }
+
+    CleanupStack::PopAndDestroy( &prevRecordIds );
+    CleanupStack::PopAndDestroy( dnIAPRecord );
+    CleanupStack::PopAndDestroy( dnIAPRecordSet );
+    CleanupStack::PopAndDestroy( generic );
+    CleanupStack::PopAndDestroy( db );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMCommsDatAccess::GetIapServiceIdL
+// -----------------------------------------------------------------------------
+//
+TUint32 CMPMCommsDatAccess::GetIapServiceIdL( TUint32 aIapId )
+    {
+    TUint32 serviceId( 0 );
+    CMDBSession* db = CMDBSession::NewLC( KCDVersion1_1 );
+
+    db->SetAttributeMask( ECDHidden | ECDProtectedWrite );
+
+    // First check that IAP exists
+    // 
+    CCDIAPRecord* iap = LoadIapRecordLC( aIapId, db );
+    serviceId = iap->iService;
+    CleanupStack::PopAndDestroy( iap );
+    CleanupStack::PopAndDestroy( db );
+
+    MPMLOGSTRING3( "CMPMCommsDatAccess::GetiapServiceIdL - IAP Id: %d, service id: %d",     
+        aIapId, serviceId )
+
+    return serviceId;
+    }
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CMPMCommsDatAccess::LoadIapRecordLC
+// -----------------------------------------------------------------------------
+//
+CCDIAPRecord* CMPMCommsDatAccess::LoadIapRecordLC( const TUint32 aIapId, CMDBSession* aDb ) const
+    {
+    CCDIAPRecord* iap = static_cast<CCDIAPRecord*> ( 
+        CCDRecordBase::RecordFactoryL( KCDTIdIAPRecord ) );
+    CleanupStack::PushL( iap );
+    iap->SetRecordId( aIapId );
+    iap->LoadL( *aDb );
+    return iap;    
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMCommsDatAccess::SearchAccessNetIdL
+// -----------------------------------------------------------------------------
+//
+void CMPMCommsDatAccess::SearchAccessNetIdL( const TUint32&  aIapId,
+                                            TUint32&        aNetId )
+    {
+    MPMLOGSTRING2( "CMPMCommsDatAccess::SearchAccessNetIdL - IAP Id: %d", 
+        aIapId )
+
+    CCommsDatabase* commsDatabase = CCommsDatabase::NewL();
+    CleanupStack::PushL(commsDatabase);
+
+    // Make hidden records visible
+    // 
+    commsDatabase->ShowHiddenRecords();
+
+    // Open IAP table view by matching IAP Id
+    //
+    CCommsDbTableView* commsDbTableView = 
+        commsDatabase->OpenViewMatchingUintLC( TPtrC( IAP ),
+                                               TPtrC( COMMDB_ID ),
+                                               aIapId );
+
+    User::LeaveIfError( commsDbTableView->GotoFirstRecord() );
+
+    commsDbTableView->ReadUintL(TPtrC( IAP_NETWORK ), aNetId );
+    MPMLOGSTRING2(
+        "CMPMCommsDatAccess::SearchAccessNetIdL - Found Access NetId: %d", 
+        aNetId )
+
+    CleanupStack::PopAndDestroy(commsDbTableView);
+    CleanupStack::PopAndDestroy(commsDatabase);
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMCommsDatAccess::WlanUnderVirtualL
+// -----------------------------------------------------------------------------
+//
+TBool CMPMCommsDatAccess::WlanUnderVirtualL( const TUint32  aVirtualIapId, 
+                                             RArray<TUint>& aIapPath )
+    {
+    MPMLOGSTRING2( "CMPMCommsDatAccess::WlanUnderVirtualL: VirtualIapId: %i", 
+        aVirtualIapId )
+    // Check that this Iap has not already traversed
+    //
+    if( aIapPath.Find( aVirtualIapId ) == KErrNotFound )
+        {
+        // append this Iap to path
+        //
+        aIapPath.Append( aVirtualIapId );
+        }
+    else
+        {
+        MPMLOGSTRING( "CMPMCommsDatAccess::WlanUnderVirtualL: Error, loop\
+detected in configuration. Iap handling not continued" )
+        return EFalse;
+        }
+
+    TBool wlan( EFalse );
+
+    // Open session
+    // 
+    CMDBSession* db = CMDBSession::NewLC( KCDVersion1_1 );
+
+    db->SetAttributeMask( ECDHidden | ECDProtectedWrite );
+
+    CMDBGenericRecord * generic = static_cast<CMDBGenericRecord*>
+        ( CCDRecordBase::RecordFactoryL( 0 ) );
+    CleanupStack::PushL( generic );
+    generic->InitializeL( TPtrC( KCDTypeNameVirtualIAPNextLayer ), 
+                          NULL );
+    generic->LoadL( *db );
+
+    CCDVirtualIAPNextLayerRecord* virtualNext = new ( ELeave ) 
+        CCDVirtualIAPNextLayerRecord( generic->TableId() );
+
+    CleanupStack::PushL( virtualNext );
+    virtualNext->iIAP = aVirtualIapId;
+    if ( virtualNext->FindL( *db ) )
+        {
+        if ( virtualNext->iNextLayerSNAP != 0 )
+            {
+            // SNAP
+            // 
+            TInt snap = virtualNext->iNextLayerSNAP;
+            MPMLOGSTRING2(
+                "CMPMCommsDatAccess::WlanUnderVirtualL: SNAP: %i", snap )
+
+            // Check if SNAP contains WLAN
+            // 
+            wlan = SnapContainsWlanL( snap, aIapPath, KMPMNrWlansOne );
+            
+            }
+        else if ( virtualNext->iNextLayerIAP != 0 )
+            {
+            // IAP
+            // 
+            TInt iap = virtualNext->iNextLayerIAP;
+            MPMLOGSTRING2(
+                "CMPMCommsDatAccess::WlanUnderVirtualL: IAP: %i", iap )
+            if( CheckWlanL( iap ) != ENotWlanIap )
+                {
+                wlan = ETrue;
+                }
+        
+            // If virtual IAP, check whether it may be using WLAN
+            // 
+            if( !wlan && IsVirtualIapL( iap ) )
+                {
+                wlan = WlanUnderVirtualL( iap, aIapPath );
+                }
+            }
+        else
+            {
+            MPMLOGSTRING( "CMPMCommsDatAccess::WlanUnderVirtualL: No underlying IAP\
+ defined for virtual IapId" )
+            }
+        }
+    // Remove this Iap from path 
+    //
+    MPMLOGSTRING2( "CMPMCommsDatAccess::WlanUnderVirtualL: removing %d from iap path", 
+                aIapPath.Count() - 1 )
+    aIapPath.Remove( aIapPath.Count() - 1 );
+
+    // Release memory
+    //
+    CleanupStack::PopAndDestroy( virtualNext );
+    CleanupStack::PopAndDestroy( generic );
+    CleanupStack::PopAndDestroy( db );
+    MPMLOGSTRING2(
+                "CMPMCommsDatAccess::WlanUnderVirtualL: found: %i", wlan )
+    return wlan;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMCommsDatAccess::SearchDNEntriesL
+// -----------------------------------------------------------------------------
+//
+void CMPMCommsDatAccess::SearchDNEntriesL( const TUint32&   aSnapId,
+                                           RArray<TNetIap>& aDestNetIds )
+    {
+    MPMLOGSTRING2( "CMPMCommsDatAccess::SearchDNEntriesL: SNAP: %d", 
+        aSnapId )
+
+    CCDAccessPointRecord* snapAPr =  static_cast<CCDAccessPointRecord*>( 
+            CCDAccessPointRecord::RecordFactoryL( KCDTIdAccessPointRecord ) );
+    
+    snapAPr->iRecordTag = aSnapId;
+    CleanupStack::PushL( snapAPr );
+
+//    CCDNetworkRecord* dnRecord = static_cast<CCDNetworkRecord*>
+//        ( CCDRecordBase::RecordFactoryL( KCDTIdNetworkRecord ) );
+//        dnRecord->SetRecordId( aSnapId );
+
+    CMDBSession* db = CMDBSession::NewLC( KCDVersion1_1 );
+
+    db->SetAttributeMask( ECDHidden | ECDProtectedWrite );
+
+//    TRAPD( err, snapAPr->LoadL( *db ) );
+//    if ( err != KErrNone )
+    if ( !snapAPr->FindL( *db ) )
+        {
+        MPMLOGSTRING("CMPMCommsDatAccess::SearchDNEntriesL: SNAP not found")
+        CleanupStack::PopAndDestroy( db );
+        CleanupStack::PopAndDestroy( snapAPr );
+        return;
+        }
+
+    // Get the table id from generic
+    // 
+    CMDBGenericRecord* generic = static_cast<CMDBGenericRecord*>
+        ( CCDRecordBase::RecordFactoryL( 0 ) );
+    CleanupStack::PushL( generic );
+    generic->InitializeL( TPtrC( KCDTypeNameDataMobilitySelectionPolicy ), 
+                          NULL );
+    generic->LoadL( *db );
+
+    // Create the DN-IAP record set
+    // 
+    CMDBRecordSet<CCDDataMobilitySelectionPolicyRecord>* dnIAPRecordSet = 
+        new ( ELeave ) CMDBRecordSet<CCDDataMobilitySelectionPolicyRecord>( generic->TableId() );
+    CleanupStack::PushL( dnIAPRecordSet );
+
+    CCDDataMobilitySelectionPolicyRecord* dnIAPRecord = new ( ELeave ) 
+        CCDDataMobilitySelectionPolicyRecord( generic->TableId() );
+    CleanupStack::PushL( dnIAPRecord );
+    dnIAPRecord->iSNAP = (TInt)snapAPr->iRecordTag;
+    dnIAPRecordSet->iRecords.Append( dnIAPRecord );
+    CleanupStack::Pop( dnIAPRecord );
+
+    if ( dnIAPRecordSet->FindL( *db ) )
+        {
+        for ( TInt i = 0; i < dnIAPRecordSet->iRecords.Count(); i++ )
+            {
+            TNetIap elem;
+            dnIAPRecord->SetElementId( GetRealElementId( dnIAPRecordSet->iRecords[i] ) );
+            dnIAPRecord->LoadL( *db );
+
+            if ( dnIAPRecord->iIAP != 0 )
+                {
+                // Add values to elem
+                // 
+                TUint32 iapElementId( dnIAPRecord->iIAP ); 
+                elem.iSnap      = aSnapId;
+                elem.iIapId     = ( iapElementId & 
+                                    KCDMaskShowRecordId ) >> KShift8;
+                elem.iRanking   = static_cast<TUint32>( dnIAPRecord->iPriority );
+                dnIAPRecord->iIAP = 0;
+                }
+            else if( dnIAPRecord->iEmbeddedSNAP != 0 )
+                {
+                // Add values to elem
+                // 
+                elem.iSnap          = aSnapId;
+                elem.iEmbeddedSnap  = dnIAPRecord->iEmbeddedSNAP;
+                elem.iRanking       = static_cast<TUint32>( dnIAPRecord->iPriority );
+                dnIAPRecord->iEmbeddedSNAP = 0;
+                }
+            else
+                {
+                // Each Snap has an initial entry in this table,
+                // where both the IAP and EmbeddedSNAP links 
+                // have null value. 
+                }
+
+            // MPM should treat IAPs with Network Weight zero as the deleted 
+            // ones. If an IAP seems to belong to a group but it has weight 
+            // zero, it means that the IAP is not actually added to the group 
+            // but an IAP from that group is deleted and a new one is created 
+            // and this new IAP has got the same access network id that used 
+            // to belong to the deleted IAP.
+            // 
+            if ( elem.iRanking > 0 )
+                {
+                // Insert elem into RArray
+                // 
+                aDestNetIds.InsertInOrderAllowRepeats(elem, TNetIap::CompareRanking);
+                }
+            else
+                {
+                if ( elem.iIapId != 0 )
+                    {
+                    MPMLOGSTRING2( "CMPMCommsDatAccess::SearchDNEntriesL: \
+IapId %i removed because ranking is zero", elem.iIapId )
+                    }
+                if ( elem.iEmbeddedSnap != 0 )
+                    {
+                    MPMLOGSTRING2( "CMPMCommsDatAccess::SearchDNEntriesL: \
+EmbeddedSnap %i removed because ranking is zero", elem.iEmbeddedSnap )
+                    }
+                }
+            }
+        }
+
+    // Release memory
+    //
+    CleanupStack::PopAndDestroy( dnIAPRecordSet );
+    CleanupStack::PopAndDestroy( generic );
+    CleanupStack::PopAndDestroy( db );
+    CleanupStack::PopAndDestroy( snapAPr );
+
+#ifdef _DEBUG
+    // Print info into the log file
+    //
+    for ( TInt j = 0; j < aDestNetIds.Count(); j++ )
+        {
+        MPMLOGSTRING2(
+            "CMPMCommsDatAccess::SearchDNEntriesL: SNAP to array     = %i", 
+            aDestNetIds[j].iSnap )
+        MPMLOGSTRING2(
+            "CMPMCommsDatAccess::SearchDNEntriesL: Embedded to array = %i", 
+            aDestNetIds[j].iEmbeddedSnap )
+        MPMLOGSTRING2(
+            "CMPMCommsDatAccess::SearchDNEntriesL: IapId to array    = %i", 
+            aDestNetIds[j].iIapId )
+        MPMLOGSTRING2(
+            "CMPMCommsDatAccess::SearchDNEntriesL: Ranking to array  = %i", 
+            aDestNetIds[j].iRanking )
+        }
+#endif // _DEBUG
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMCommsDatAccess::FindRealIapL
+// -----------------------------------------------------------------------------
+//
+void CMPMCommsDatAccess::FindRealIapL( 
+    const TUint32               aVirtualIapId,
+    TUint32&                    aRealIapId, 
+    const RAvailableIAPList&    aAvailableIAPList,
+    CMPMServerSession&          aSession )
+    {
+    MPMLOGSTRING2( "CMPMCommsDatAccess::FindRealIapL: VirtualIapId: %i", 
+        aVirtualIapId )
+
+    // Open transaction
+    // 
+    CMDBSession* db = CMDBSession::NewLC( KCDVersion1_1 );
+
+    db->SetAttributeMask( ECDHidden | ECDProtectedWrite );
+
+    // Get IAP
+    // 
+    CCDIAPRecord* iap = LoadIapRecordLC( aVirtualIapId, db );
+
+    TDesC& type = iap->iBearerType.GetL();
+
+    if( type.Compare( TPtrC ( KCDTypeNameVirtualBearer ) ) != 0 )
+        {
+        MPMLOGSTRING( "CMPMCommsDatAccess::FindRealIapL: \
+aVirtualIapId is not virtual, return as aRealIapId" )
+
+        aRealIapId = aVirtualIapId;
+
+        // Release memory
+        //
+        CleanupStack::PopAndDestroy( iap );
+        CleanupStack::PopAndDestroy( db );
+        return;
+        }
+
+    CMDBGenericRecord * generic = static_cast<CMDBGenericRecord*>
+        ( CCDRecordBase::RecordFactoryL( 0 ) );
+    CleanupStack::PushL( generic );
+    generic->InitializeL( TPtrC( KCDTypeNameVirtualIAPNextLayer ), 
+                          NULL );
+    generic->LoadL( *db );
+
+    CCDVirtualIAPNextLayerRecord* virtualNext = new ( ELeave ) 
+        CCDVirtualIAPNextLayerRecord( generic->TableId() );
+
+    CleanupStack::PushL( virtualNext );
+    virtualNext->iIAP = iap->RecordId();
+    if ( virtualNext->FindL( *db ) )
+        {
+        if ( virtualNext->iNextLayerSNAP != 0 )
+            {
+            // SNAP
+            // 
+            TInt snap = virtualNext->iNextLayerSNAP;
+            MPMLOGSTRING2(
+                "CMPMCommsDatAccess::FindRealIapL: SNAP: %i", snap )
+            MPMLOGSTRING(
+                "CMPMCommsDatAccess::FindRealIapL: Call ChooseBestIAPL" )
+
+            TMpmConnPref tempMpmConnPref;
+            tempMpmConnPref.SetSnapId( snap );
+            aSession.IapSelectionL()->ChooseBestIAPL( tempMpmConnPref, aAvailableIAPList );
+            aRealIapId = tempMpmConnPref.IapId();
+            }
+        else if ( virtualNext->iNextLayerIAP != 0 )
+            {
+            // IAP
+            // 
+            CCDIAPRecord* iap2 = LoadIapRecordLC( virtualNext->iNextLayerIAP, db );
+            TDesC& type2 = iap2->iBearerType.GetL();
+            if( type2.Compare( TPtrC ( KCDTypeNameVirtualBearer ) ) == 0 )
+                {
+                // Virtual IAP
+                // 
+                MPMLOGSTRING2(
+                    "CMPMCommsDatAccess::FindRealIapL: Virtual IAP: %i", 
+                    iap2->RecordId() )
+                MPMLOGSTRING(
+                    "CMPMCommsDatAccess::FindRealIapL: Call FindRealIapL" )
+
+                FindRealIapL( iap2->RecordId(), 
+                              aRealIapId, 
+                              aAvailableIAPList,
+                              aSession );
+                }
+            else
+                {
+                aRealIapId = iap2->RecordId();
+
+                MPMLOGSTRING2(
+                    "CMPMCommsDatAccess::FindRealIapL: NextLayerIAP: %i", 
+                    aRealIapId )
+                }
+            // Release memory
+            //
+            CleanupStack::PopAndDestroy( iap2 );
+            }
+        else
+            {
+            MPMLOGSTRING( "CMPMCommsDatAccess::FindRealIapL: No underlying IAP\
+ defined for virtual IapId" )
+            }
+        }
+
+    // Release memory
+    //
+    CleanupStack::PopAndDestroy( virtualNext );
+    CleanupStack::PopAndDestroy( generic );
+    CleanupStack::PopAndDestroy( iap );
+    CleanupStack::PopAndDestroy( db );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMCommsDatAccess::LoadLinkedRecordL
+// -----------------------------------------------------------------------------
+//
+CCDRecordBase* CMPMCommsDatAccess::LoadLinkedRecordL( CMDBSession&  aSession, 
+                                  TMDBElementId aElementId )
+    {
+    // This is copied from commsdatSnapTests.cpp. 
+    // Loading linked records does not work currently.
+    // 
+    CCDRecordBase *record = static_cast<CCDRecordBase*>( 
+        CCDRecordBase::RecordFactoryL( aElementId ) );
+    CleanupStack::PushL( record );
+    record->LoadL( aSession );
+    CleanupStack::Pop( record );
+    return record;
+    }
+    
+// -----------------------------------------------------------------------------
+// CMPMCommsDatAccess::GetRealElementId
+// -----------------------------------------------------------------------------
+//
+TUint32 CMPMCommsDatAccess::GetRealElementId( CMDBRecordBase* aRecord )
+    {
+    return aRecord->ElementId() & KCDMaskShowField;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMCommsDatAccess::WlanBackgroundScanIsOnL
+// -----------------------------------------------------------------------------
+//
+TBool CMPMCommsDatAccess::WlanBackgroundScanIsOnL()
+    {
+    CCommsDatabase*    commDB = NULL;
+    CCommsDbTableView* table  = NULL;
+
+    // Open commDB
+    commDB = CCommsDatabase::NewL();
+    CleanupStack::PushL( commDB );
+
+    // from connmondef.h
+    _LIT( KCmWlanDeviceSettings,        "WLANDeviceTable" );
+    _LIT( KCmWlanDeviceSettingsType,    "WlanDeviceSettingsType" );
+    _LIT( KCmBgScanInterval,            "WlanBgScanInterval" );
+    const TUint32 KCmWlanUserSettings  = 1;
+
+    table = commDB->OpenViewMatchingUintLC( KCmWlanDeviceSettings,
+                                            KCmWlanDeviceSettingsType,
+                                            KCmWlanUserSettings );
+
+    TInt err = table->GotoFirstRecord();
+
+    if ( err )
+        {
+        User::Leave( err );  
+        }
+    
+    TUint32 scanInterval;
+    table->ReadUintL( KCmBgScanInterval, scanInterval ); 
+
+    // cleanup
+    CleanupStack::PopAndDestroy( table );
+    CleanupStack::PopAndDestroy( commDB );
+    
+    return scanInterval != 0 ? ETrue : EFalse;
+    
+    }
+
+// -----------------------------------------------------------------------------
+// IsInternetSnapL
+// -----------------------------------------------------------------------------
+//
+TBool CMPMCommsDatAccess::IsInternetSnapL( TUint32 aIapId, TUint32 aSnapId )
+    {
+    MPMLOGSTRING3( 
+        "CMPMCommsDatAccess::IsInternetSnapL - aIapId = %d, aSnapId = %d", 
+        aIapId, aSnapId )
+
+    TBool ret = EFalse;
+    
+    // Open transaction
+    CMDBSession* db = CMDBSession::NewLC( KCDVersion1_1 );
+
+    if ( aSnapId )
+        {
+        // Check that snap purpose is internet
+        ret = IsInternetSnapL( *db, aSnapId );
+        }
+    else if ( aIapId )
+        {
+        RArray<TUint> snapIds;
+        
+        // Get destinations
+        FindAllSnapsL( snapIds );
+        CleanupClosePushL( snapIds );
+        
+        for (TInt index = 0; index < snapIds.Count(); index++)
+            {
+            RArray<TNetIap> ids;
+            // Get iaps belonging to this destination
+            SearchDNEntriesL( snapIds[index], ids );
+            CleanupClosePushL( ids );
+            
+            for (TInt index2 = 0; index2 < ids.Count(); index2++)
+                {
+                // Check if iap belongs to this destination
+                if (ids[index2].iIapId == aIapId)
+                    {
+                    ret = IsInternetSnapL( *db, snapIds[index] );
+
+                    if (ret)
+                        {
+                        break;
+                        }
+                    }
+                }            
+            
+            CleanupStack::PopAndDestroy( &ids );
+            
+            if (ret)
+                {
+                break;
+                }
+            }
+        
+        CleanupStack::PopAndDestroy( &snapIds );
+        }
+
+    CleanupStack::PopAndDestroy( db );
+    
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// IsInternetSnapL
+// -----------------------------------------------------------------------------
+//
+TBool CMPMCommsDatAccess::IsInternetSnapL(CMDBSession& db, TUint32 aSnapId)
+    {
+    MPMLOGSTRING( "CMPMCommsDatAccess::IsInternetSnapL" )        
+    TBool ret = EFalse;
+    
+    CCDAccessPointRecord* snapAPr =  static_cast<CCDAccessPointRecord*>( 
+            CCDAccessPointRecord::RecordFactoryL( KCDTIdAccessPointRecord ) );
+    
+    snapAPr->iRecordTag = aSnapId;
+    CleanupStack::PushL( snapAPr );
+
+    if ( !snapAPr->FindL( db ) )
+        {
+        MPMLOGSTRING("CMPMCommsDatAccess::IsInternetSnapL: SNAP not found")
+        CleanupStack::PopAndDestroy( snapAPr );
+        return ret;
+        }
+
+    // Create snap metadata record
+    CMDBRecordSet<CCDSNAPMetadataRecord>* metaSet = 
+           new ( ELeave ) CMDBRecordSet<CCDSNAPMetadataRecord>( 
+            CCDSNAPMetadataRecord::TableIdL( db ) );
+    CleanupStack::PushL( metaSet );
+
+    // Load snap metedata record
+    metaSet->LoadL( db );
+
+    for ( TInt i = 0; i < metaSet->iRecords.Count(); ++i )
+        {
+        // Get value
+        TInt meta = QUERY_INT_FIELD( metaSet->iRecords[i], 
+                                     KCDTIdSNAPMetadataMetadata );
+        
+        TInt snap = QUERY_INT_FIELD( metaSet->iRecords[i],
+                                     KCDTIdSNAPMetadataSNAP ); 
+        // Check whether internet
+        if( meta & ESnapMetadataInternet )
+            {            
+            MPMLOGSTRING("CMPMCommsDatAccess::IsInternetSnapL: Internet snap found")
+            
+            if ( snap == aSnapId )
+                {
+                MPMLOGSTRING2("CMPMCommsDatAccess::IsInternetSnapL: This is internet snap: %d",
+                              aSnapId)
+                ret = ETrue;
+                break;
+                }
+            }
+        }
+        
+    CleanupStack::PopAndDestroy( metaSet );
+    CleanupStack::PopAndDestroy( snapAPr );
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMCommsDatAccess::GetBearerTypeL
+// -----------------------------------------------------------------------------
+//
+TMPMBearerType CMPMCommsDatAccess::GetBearerTypeL( TUint32 aIapId )
+    {
+    MPMLOGSTRING( "CMPMCommsDatAccess::GetBearerTypeL" )
+    TMPMBearerType bearerType = EMPMBearerTypeOther;
+    RArray<TUint32> wlanArray;
+    
+    CMDBSession* db = CMDBSession::NewLC( KCDVersion1_1 );
+    
+    CleanupClosePushL( wlanArray );
+    BuildWlanArrayL(*db, wlanArray);
+    
+    CCDIAPRecord* record = LoadIapRecordLC( aIapId, db );
+    
+    TBuf<KMaxTextLength> bearerTypeName( record->iBearerType.GetL() );
+    TBuf<KMaxTextLength> serviceTypeName( record->iServiceType.GetL() );
+        
+    if ( ( serviceTypeName == TPtrC( KCDTypeNameOutgoingWCDMA ) ) ||
+         ( serviceTypeName == TPtrC( KCDTypeNameIncomingWCDMA ) ) )
+        {
+        // Packet data
+        bearerType = EMPMBearerTypePacketData;
+        }
+    else if ( serviceTypeName == TPtrC( KCDTypeNameLANService ) )
+        {
+        // LAN or WLAN
+        TUint32 bearerId( record->iBearer );
+            
+        if ( ( bearerTypeName == TPtrC( KCDTypeNameLANBearer ) ) &&
+             ( IsWlanBearer( wlanArray, record->iBearer ) ) )
+            {
+            // WLAN
+            bearerType = EMPMBearerTypeWlan;
+            }
+        }
+    else if ( ( bearerTypeName == TPtrC( KCDTypeNameVirtualBearer ) ) &&
+              ( serviceTypeName == TPtrC ( KCDTypeNameVPNService ) ) )
+        {
+        // VPN
+        bearerType = EMPMBearerTypeVpn;
+        }
+    
+    CleanupStack::PopAndDestroy( record );
+    CleanupStack::PopAndDestroy( &wlanArray );
+    CleanupStack::PopAndDestroy( db );
+    
+    return bearerType;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMCommsDatAccess::IsWlanBearerL
+// -----------------------------------------------------------------------------
+//
+TBool CMPMCommsDatAccess::IsWlanBearer(RArray<TUint32>& aWlanArray, TInt aBearerId)
+    {
+    MPMLOGSTRING( "CMPMCommsDatAccess::IsWlanBearer" )
+
+    TInt index = aWlanArray.Find( aBearerId );
+
+    if ( index != KErrNotFound )
+        {
+        return ETrue;
+        }
+    
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMCommsDatAccess::BuildWlanArrayL
+// -----------------------------------------------------------------------------
+//
+void CMPMCommsDatAccess::BuildWlanArrayL(CMDBSession& aDb, 
+                                         RArray<TUint32>& aWlanArray)
+    {
+    MPMLOGSTRING( "CMPMCommsDatAccess::BuildWlanArrayL" )
+    
+    CMDBRecordSet<CCDLANBearerRecord>* ptrLanBearerRecordSet = new( ELeave )
+            CMDBRecordSet<CCDLANBearerRecord>( KCDTIdLANBearerRecord );
+    CleanupStack::PushL( ptrLanBearerRecordSet );
+    ptrLanBearerRecordSet->LoadL( aDb );
+
+    for ( TInt i = 0; i < ptrLanBearerRecordSet->iRecords.Count(); i++ )
+        {
+        TBuf<KMaxTextLength> bearerRecordName(
+                ( (CCDLANBearerRecord*)ptrLanBearerRecordSet->iRecords[i] )->iRecordName.GetL() );
+
+        // Check if bearer is WLAN
+        if ( bearerRecordName == TPtrC( KModemBearerWLAN ) )
+            {
+            aWlanArray.AppendL( ptrLanBearerRecordSet->iRecords[i]->RecordId() );
+            }
+        }
+    
+    CleanupStack::PopAndDestroy( ptrLanBearerRecordSet );    
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMCommsDatAccess::AreActiveIapsInSameSnapL
+// -----------------------------------------------------------------------------
+//
+TBool CMPMCommsDatAccess::AreActiveIapsInSameSnapL ( RArray<TActiveBMConn>& aActiveBMConns,
+                                                     TUint32& aSnapId )
+    {
+    MPMLOGSTRING( "CMPMCommsDatAccess::AreActiveIapsInSameSnapL" )
+    TBool same = ETrue;
+    TUint32 snapId = 0;
+    TUint32 prevSnapId = 0;
+            
+    // Go through all active connections
+    for (TInt index = 0; index < aActiveBMConns.Count(); index++ )
+        {
+        // Do check only for active connections
+        if ( aActiveBMConns[index].iConnInfo.iState != EStarted )
+            {
+            continue;
+            }
+        
+        // Iap id must be nonzero
+        if ( aActiveBMConns[index].iConnInfo.iIapId )
+            {
+            prevSnapId = snapId;
+            // Get destination id for the iap
+            snapId = GetSnapIdL( aActiveBMConns[index].iConnInfo.iIapId );
+                        
+            // Check if previous iap's destination is different
+            if ( ( ( prevSnapId != snapId ) && prevSnapId && snapId ) ||
+                 !snapId )
+                {
+                // Set return value to false and leave loop
+                same = EFalse;
+                break;
+                }
+            }
+        }
+    
+    // Return destId for later use
+    aSnapId = snapId;
+    
+    return same;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMCommsDatAccess::SelectActiveConnectionL
+// -----------------------------------------------------------------------------
+//
+void CMPMCommsDatAccess::SelectActiveConnectionL ( const TUint32 aSnapId,
+                                                   RArray<TActiveBMConn>& aActiveBMConns,
+                                                   TUint32& aActiveIapId,
+                                                   TUint32& aActiveSnapId,
+                                                   TMPMBearerType& aActiveBearerType,
+                                                   CMPMServerSession& aSession )
+    {
+    MPMLOGSTRING( "CMPMCommsDatAccess::SelectActiveConnectionL" )
+    RArray<TUint32> activeIaps;
+    RArray<TNetIap> iapIds;
+    
+    // Reset output parameters
+    aActiveIapId = 0;
+    aActiveSnapId = 0;
+    aActiveBearerType = EMPMBearerTypeNone;
+
+    CleanupClosePushL( activeIaps );
+        
+    for (TInt index = 0; index < aActiveBMConns.Count(); index++ )
+        {
+        // Add only started iaps to array
+        if ( aActiveBMConns[index].iConnInfo.iState == EStarted )
+            {
+            activeIaps.AppendL ( aActiveBMConns[index].iConnInfo.iIapId );
+            }
+        }
+        
+    CleanupClosePushL( iapIds );
+    SearchDNEntriesL( aSnapId, iapIds );
+    
+    // Remove any deactived IAP from iapIds
+    TInt ret        = KErrNotFound;
+    TInt destCount  = iapIds.Count();
+    
+    // Decrement by one, because count is n, 
+    // but indexes in array are 0 .. n-1.
+    // 
+    destCount--;
+
+    // This time we are browsing the array from the end to the beginning, 
+    // because removing one element from array affects index numbering.
+    for ( TInt k = destCount; k >= 0; k-- )
+        {
+        ret = activeIaps.Find( iapIds[k].iIapId );
+        if ( ret == KErrNotFound )
+            {
+            MPMLOGSTRING2( "CMPMCommsDatAccess::SelectActiveConnectionL: \
+Remove deactived IAP = %i", iapIds[k].iIapId )
+            iapIds.Remove( k );
+            }
+        }
+
+    // Determine the actual priorities for IAPs
+    DeterminePrioritiesL( iapIds, activeIaps, aSession );
+
+    // Check if a matching available IAP is found.
+    if( iapIds.Count() )
+        {
+        // Go through all iaps
+        for ( TInt index = 0; index < iapIds.Count(); index++ )
+            {
+            // Get bearer type
+            TMPMBearerType bearerType = GetBearerTypeL( iapIds[index].iIapId );
+        
+            // If iap is not vpn, wlan or packet then skip it
+            if ( bearerType == EMPMBearerTypeOther )
+                {
+                continue;
+                }
+            
+            // Set bearer type, iap id and snap id
+            for (TInt index2 = 0; index2 < aActiveBMConns.Count(); index2++ )
+                {
+                if ( ( aActiveBMConns[index2].iConnInfo.iIapId ==
+                       iapIds[index].iIapId ) )
+                    {
+                    if ( aSession.MyServer().DedicatedClients().Find(
+                         aActiveBMConns[index2].iConnInfo.iAppUid ) != KErrNone )
+                        {
+                        aActiveSnapId = aActiveBMConns[index2].iConnInfo.iSnap;
+                        aActiveIapId = aActiveBMConns[index2].iConnInfo.iIapId;
+                        aActiveBearerType = bearerType;
+                        }
+                    break;
+                    }
+                }
+            
+            break;
+            }
+        }
+
+    MPMLOGSTRING4(
+        "CMPMCommsDatAccess::SelectActiveConnectionL: Iap id = %i, Snap id = %i, \
+Bearer type = %i",
+        aActiveIapId, aActiveSnapId, aActiveBearerType )
+    
+    CleanupStack::PopAndDestroy( &iapIds );
+    CleanupStack::PopAndDestroy( &activeIaps );
+    }
+    
+// -----------------------------------------------------------------------------
+// CMPMCommsDatAccess::GetSnapIdL
+// -----------------------------------------------------------------------------
+//
+TUint32 CMPMCommsDatAccess::GetSnapIdL( TUint32 aIapId )
+    {
+    MPMLOGSTRING( "CMPMCommsDatAccess::GetSnapIdL" )
+    TUint32 snapId = 0;
+    RArray<TUint> snapIds;
+        
+    CleanupClosePushL( snapIds );
+    // Get destinations
+    FindAllSnapsL( snapIds );
+
+    for (TInt index = 0; index < snapIds.Count(); index++)
+        {
+        RArray<TNetIap> ids;
+        // Get iaps belonging to this snap
+        CleanupClosePushL( ids );
+        SearchDNEntriesL( snapIds[index], ids );
+            
+        for (TInt index2 = 0; index2 < ids.Count(); index2++)
+            {
+            // Check if iap belongs to this destination
+            if (ids[index2].iIapId == aIapId)
+                {
+                snapId = snapIds[index];
+                CleanupStack::PopAndDestroy( &ids );                    
+                CleanupStack::PopAndDestroy( &snapIds );
+                return snapId;
+                }
+            }
+        
+        CleanupStack::PopAndDestroy( &ids );
+        }
+
+    CleanupStack::PopAndDestroy( &snapIds );
+    
+    return snapId;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMCommsDatAccess::IsSnapEmptyL
+// -----------------------------------------------------------------------------
+//
+TBool CMPMCommsDatAccess::IsSnapEmptyL( TUint32 aSnapId )
+    {
+    MPMLOGSTRING( "CMPMCommsDatAccess::IsSnapEmptyL" )
+    TBool empty = ETrue;
+    
+    RArray<TNetIap> ids;
+    // Get iaps belonging to this snap
+    CleanupClosePushL( ids );
+    SearchDNEntriesL( aSnapId, ids );
+    
+    if ( ids.Count() )
+        {
+        empty = EFalse;
+        }
+    
+    CleanupStack::PopAndDestroy( &ids );    
+    
+    return empty;
+    }
+        
+// -----------------------------------------------------------------------------
+// VerifyIapExistsL
+// -----------------------------------------------------------------------------
+//
+void CMPMCommsDatAccess::VerifyIapExistsL( TUint32 aIapId )
+    {
+    MPMLOGSTRING2( "CMPMCommsDatAccess::VerifyIapExistsL: aIapId %d", aIapId )
+    CMDBSession* db = CMDBSession::NewLC( KCDVersion1_1 );
+    db->SetAttributeMask( ECDProtectedWrite );
+    CCDIAPRecord* iapRecord = LoadIapRecordLC( aIapId, db );
+    CleanupStack::PopAndDestroy( iapRecord );
+    CleanupStack::PopAndDestroy( db );
+    }
+
+// -----------------------------------------------------------------------------
+// ForcedRoamingL
+// -----------------------------------------------------------------------------
+//
+TCmUsageOfWlan CMPMCommsDatAccess::ForcedRoamingL() const
+    {
+    TCmGenConnSettings cmGenConnSettings;
+    RCmManager rCmManager;
+    
+    rCmManager.CreateTablesAndOpenL();
+    CleanupClosePushL( rCmManager ); 
+    rCmManager.ReadGenConnSettingsL( cmGenConnSettings );
+    CleanupStack::PopAndDestroy( &rCmManager );
+    
+    return cmGenConnSettings.iUsageOfWlan;
+    }
+
+// -----------------------------------------------------------------------------
+// MapAPRecIdtoSnapAPL
+// -----------------------------------------------------------------------------
+//
+TInt CMPMCommsDatAccess::TierLinktoTagIdL( CMDBSession* aDbs, TUint32 aElementId )
+    {
+    ASSERT(aDbs);
+    
+    // declare tier record
+    CCDTierRecord* tier = static_cast<CCDTierRecord*>( 
+            CCDTierRecord::RecordFactoryL( KCDTIdTierRecord ) );
+    
+    CleanupStack::PushL( tier );
+    
+    tier->SetElementId( aElementId );
+    tier->LoadL( *aDbs );
+    TInt tag = tier->iRecordTag;
+
+    CleanupStack::PopAndDestroy( tier );
+    return  tag;
+    }
+
+// -----------------------------------------------------------------------------
+// MapAPRecIdtoSnapAPL
+// -----------------------------------------------------------------------------
+//
+TInt CMPMCommsDatAccess::MapAPRecIdtoSnapAPL( TInt aApRecId )
+    {
+    CMDBSession* dbs = CMDBSession::NewLC( KCDVersion1_1 );
+        
+    CCDAccessPointRecord* ipt =  static_cast<CCDAccessPointRecord*>( 
+            CCDAccessPointRecord::RecordFactoryL( KCDTIdAccessPointRecord ) );
+
+    CleanupStack::PushL( ipt );
+
+    ipt->SetElementId( aApRecId );
+    
+    TBool found = ipt->FindL( *dbs );
+    if ( !found )
+        User::Leave( KErrNotFound );
+    
+    if ( TierLinktoTagIdL( dbs, ipt->iTier ) == KAfInet )  // ipprototm = 271064560 , iptm = 271064536
+        {
+        User::Leave( KErrArgument );
+        }
+
+    TInt ap = ipt->iRecordTag;
+    
+    CleanupStack::PopAndDestroy( ipt );
+    CleanupStack::PopAndDestroy( dbs );
+
+    return ap;
+    }
+
+// -----------------------------------------------------------------------------
+// MapNetIdtoSnapAPL
+// -----------------------------------------------------------------------------
+//
+TInt CMPMCommsDatAccess::MapNetIdtoSnapAPL( TInt aNetId )
+    {
+    CMDBSession* dbs = CMDBSession::NewLC( KCDVersion1_1 );
+        
+    CCDAccessPointRecord* ipt =  static_cast<CCDAccessPointRecord*>( 
+            CCDAccessPointRecord::RecordFactoryL( KCDTIdAccessPointRecord ) );
+
+    CleanupStack::PushL( ipt );
+    ipt->iCustomSelectionPolicy = aNetId;
+
+    TBool found = ipt->FindL( *dbs );
+    if ( !found )
+        User::Leave( KErrNotFound );
+    
+    if ( TierLinktoTagIdL( dbs, ipt->iTier ) == KAfInet )  // ipprototm = 271064560 , iptm = 271064536
+        {
+        User::Leave( KErrArgument );
+        }
+
+    TInt ap = ipt->iRecordTag;
+    
+    CleanupStack::PopAndDestroy( ipt );
+    CleanupStack::PopAndDestroy( dbs );
+
+    return ap;
+    }
+
+// -----------------------------------------------------------------------------
+// MapSnapAPtoNetIdL
+// -----------------------------------------------------------------------------
+//
+TInt CMPMCommsDatAccess::MapSnapAPtoNetIdL( TInt aAP )
+    {
+    CMDBSession* dbs = CMDBSession::NewLC( KCDVersion1_1 );
+        
+    CCDAccessPointRecord* ipt =  static_cast<CCDAccessPointRecord*>( 
+            CCDAccessPointRecord::RecordFactoryL( KCDTIdAccessPointRecord ) );
+    CleanupStack::PushL( ipt );
+    ipt->iRecordTag = aAP;
+    TBool found = ipt->FindL( *dbs );
+    if ( !found )
+        User::Leave( KErrNotFound );
+    
+    if ( TierLinktoTagIdL( dbs, ipt->iTier ) == KAfInet )  // ipprototm = 271064560 , iptm = 271064536
+        {
+        User::Leave( KErrArgument );
+        }
+
+    TInt netid = ipt->iSelectionPolicy;
+    
+    CleanupStack::PopAndDestroy( ipt );
+    CleanupStack::PopAndDestroy( dbs );
+
+    return netid;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMCommsDatAccess::ReadGenConnSettings
+// -----------------------------------------------------------------------------
+//
+TCmGenConnSettings CMPMCommsDatAccess::ReadGenConnSettingsL() const
+    {
+    TCmGenConnSettings cmGenConnSettings;
+    RCmManager rCmManager;
+    
+    rCmManager.CreateTablesAndOpenL();
+    CleanupClosePushL( rCmManager ); 
+    rCmManager.ReadGenConnSettingsL( cmGenConnSettings );
+    CleanupStack::PopAndDestroy( &rCmManager );
+    
+    return cmGenConnSettings;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMCommsDatAccess::WriteGenConnSettings
+// -----------------------------------------------------------------------------
+//
+void CMPMCommsDatAccess::WriteGenConnSettingsL(TCmGenConnSettings& aGenConnSettings )
+    {
+    RCmManager rCmManager;
+    rCmManager.CreateTablesAndOpenL();
+    CleanupClosePushL( rCmManager ); 
+    rCmManager.WriteGenConnSettingsL( aGenConnSettings );
+    CleanupStack::PopAndDestroy( &rCmManager );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMCommsDatAccess::DestinationIdL
+// -----------------------------------------------------------------------------
+//
+TUint32 CMPMCommsDatAccess::DestinationIdL( CMManager::TSnapPurpose aSnapPurpose )
+    {
+    MPMLOGSTRING( "CMPMCommsDatAccess::DestinationIdL" )
+    TUint32 destinationId = 0;
+    TInt snapMetadata = 0;
+    
+    RArray<TUint32> snapIds;    
+    CleanupClosePushL( snapIds );
+
+    RCmManager rCmManager;
+    CleanupClosePushL( rCmManager ); 
+    rCmManager.CreateTablesAndOpenL();
+
+    rCmManager.AllDestinationsL( snapIds );
+
+    for ( TInt index = 0; index < snapIds.Count(); index++ )
+         {
+         RCmDestination dest;
+         CleanupClosePushL( dest );
+
+         dest = rCmManager.DestinationL( snapIds[index] );
+         
+         snapMetadata = dest.MetadataL( CMManager::ESnapMetadataPurpose );
+         
+         if ( snapMetadata == aSnapPurpose )
+             {
+             destinationId = snapIds[index];
+             CleanupStack::PopAndDestroy( &dest );
+             break;
+             }        
+         CleanupStack::PopAndDestroy( &dest );
+         }
+    
+    CleanupStack::PopAndDestroy( &rCmManager );
+    CleanupStack::PopAndDestroy( &snapIds );
+
+    if (!destinationId)
+        {
+        User::Leave(KErrNotFound);
+        }
+    
+    return destinationId;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/src/mpmconfirmdlg.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,160 @@
+/*
+* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Confirm Dialog implementation
+*
+*/
+
+/**
+@file mpmconfirmdlg.cpp
+UI Note Handler implementation
+*/
+
+// INCLUDE FILES
+#include "mpmconfirmdlg.h"
+#include "mpmlogger.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CMPMConfirmDlg::NewL
+// -----------------------------------------------------------------------------
+//
+CMPMConfirmDlg* CMPMConfirmDlg::NewL( CArrayPtrFlat<CMPMDialogBase>& aQueue,
+                                      MMPMConfirmDlg&     aConfirmDlgUser,
+                                      const TUint32       aSnapId,
+                                      const TUint32       aIAP,
+                                      const TDialogType   aDialogType )
+    {
+    CMPMConfirmDlg* self = new ( ELeave ) CMPMConfirmDlg( aQueue,
+                                                          aConfirmDlgUser,
+                                                          aSnapId,
+                                                          aIAP,
+                                                          aDialogType );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMConfirmDlg::CMPMConfirmDlg
+// -----------------------------------------------------------------------------
+//
+CMPMConfirmDlg::CMPMConfirmDlg( CArrayPtrFlat<CMPMDialogBase>& aQueue,
+                                MMPMConfirmDlg&     aConfirmDlgUser,
+                                const TUint32       aSnapId,
+                                const TUint32       aIAP,
+                                const TDialogType   aDialogType )
+    : CMPMDialogBase( *(CArrayPtrFlat<CMPMDialogBase>*)&aQueue ),
+      iConfirmDlgUser( aConfirmDlgUser),
+      iSnapId( aSnapId ),
+      iIAP( aIAP ),
+      iDialogType( aDialogType ),
+      iUtils( NULL ),
+      iResult( EMsgQueryCancelled )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMConfirmDlg::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CMPMConfirmDlg::ConstructL()
+    {
+    iUtils = CConnectionUiUtilities::NewL();
+    CMPMDialogBase::ConstructL();
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMConfirmDlg::Start
+// -----------------------------------------------------------------------------
+//
+void CMPMConfirmDlg::Start( CMPMDialogBase* aDlg )
+    {
+    //  Start the dialog if previous dialog does not exist: !aDlg
+    //  OR
+    //  if ConfirmDlgResponse is not accepted by the iConfirmDlgUser.
+    //
+    if ( !aDlg || !iConfirmDlgUser.ConfirmDlgResponse( &((CMPMConfirmDlg*)aDlg)->iConfirmDlgUser ) )
+        {
+        MPMLOGSTRING3( "CMPMConfirmDlg::Start Display dialog: SNAP %d, IAP %d", 
+                       iSnapId, iIAP )
+
+        switch ( iDialogType )
+            {
+            case EConfirmDlgHomeNetwork:
+                {                
+                MPMLOGSTRING( "    normal confirm dialog" )
+                iUtils->ConfirmMethodUsageQuery( iResult,
+                                                 true,
+                                                 iStatus);
+                break;
+                }
+                
+            case EConfirmDlgVisitorNetwork:
+                {
+                MPMLOGSTRING( "    normal confirm dialog" )
+                iUtils->ConfirmMethodUsageQuery( iResult,
+                                                 false,
+                                                 iStatus);
+                break;
+                }
+                
+            default: 
+                {
+                return;
+                }
+            }
+        SetActive();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMConfirmDlg::~CMPMConfirmDlg
+// -----------------------------------------------------------------------------
+//
+CMPMConfirmDlg::~CMPMConfirmDlg()
+    {
+    MPMLOGSTRING( "CMPMConfirmDlg::~CMPMConfirmDlg" )
+
+    Cancel();
+    delete iUtils;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMConfirmDlg::RunL
+// -----------------------------------------------------------------------------
+//
+void CMPMConfirmDlg::RunL()
+    {
+    if ( iStatus.Int() != KErrNone )
+        {
+        MPMLOGSTRING2( "CMPMConfirmDlg::RunL status %d", iStatus.Int() )
+        }
+    iConfirmDlgUser.ConfirmDlgResponse( iStatus.Int(), iResult );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMConfirmDlg::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CMPMConfirmDlg::DoCancel()
+    {
+    MPMLOGSTRING( "CMPMConfirmDlg::DoCancel" )
+    MPMLOGSTRING( "    Cancel normal confirm dialog" )
+
+    iUtils->CancelConfirmMethodUsageQuery();
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/src/mpmconfirmdlgroaming.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,178 @@
+/*
+* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Confirm Dialog implementation
+*
+*/
+
+/**
+@file mpmconfirmdlgroaming.cpp
+Roaming Dialog implementation
+*/
+
+// INCLUDE FILES
+#include "mpmconfirmdlgroaming.h"
+#include "mpmserversession.h"
+#include "mpmconnmonevents.h"
+#include "mpmlogger.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CMPMConfirmDlgRoaming::NewL
+// -----------------------------------------------------------------------------
+//
+CMPMConfirmDlgRoaming* CMPMConfirmDlgRoaming::NewL( 
+    CMPMServerSession&                  aSession,
+    const TUint32                       aSnapId,
+    const TUint32                       aIAP,
+    const CMPMConfirmDlg::TDialogType   aDialogType, 
+    const TBool                         aReconnect )
+    {
+    CMPMConfirmDlgRoaming* self = new ( ELeave ) CMPMConfirmDlgRoaming( 
+                                                          aSession,
+                                                          aSnapId,
+                                                          aIAP,
+                                                          aDialogType, 
+                                                          aReconnect );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMConfirmDlgRoaming::CMPMConfirmDlgRoaming
+// -----------------------------------------------------------------------------
+//
+CMPMConfirmDlgRoaming::CMPMConfirmDlgRoaming( 
+    CMPMServerSession&                  aSession,
+    const TUint32                       aSnapId,
+    const TUint32                       aIAP,
+    const CMPMConfirmDlg::TDialogType   aDialogType, 
+    const TBool                         aReconnect )
+    : iSession( aSession),
+      iSnapId( aSnapId ),
+      iIAP( aIAP ),
+      iDialogType( aDialogType ),
+      iConfirmDlg( NULL ),
+      iReconnect( aReconnect )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMConfirmDlgRoaming::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CMPMConfirmDlgRoaming::ConstructL()
+    {
+    MPMLOGSTRING2("CMPMConfirmDlgRoaming<0x%x>::ConstructL()", iSession.ConnectionId())
+    CArrayPtrFlat<CMPMDialogBase>* queue = ((CArrayPtrFlat<CMPMDialogBase>*)iSession.MyServer().RoamingQueue());
+    iConfirmDlg = CMPMConfirmDlg::NewL( *queue,
+                                        *this,
+                                        iSnapId, 
+                                        iIAP, 
+                                        iDialogType );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMConfirmDlgRoaming::~CMPMConfirmDlgRoaming
+// -----------------------------------------------------------------------------
+//
+CMPMConfirmDlgRoaming::~CMPMConfirmDlgRoaming()
+    {
+    MPMLOGSTRING2( "CMPMConfirmDlgRoaming<0x%x>::~CMPMConfirmDlgRoaming", 
+        iSession.ConnectionId() )
+    delete iConfirmDlg;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMConfirmDlgRoaming::ConfirmDlgResponse
+// -----------------------------------------------------------------------------
+//
+void CMPMConfirmDlgRoaming::ConfirmDlgResponse( 
+    const TInt                      aError,
+    const TMsgQueryLinkedResults    aResult )
+    {
+    MPMLOGSTRING4( "CMPMConfirmDlgRoaming<0x%x>::ConfirmDlgResponse\
+ error: %d result: %d", iSession.ConnectionId(), aError, aResult )
+
+    // Store results
+    //
+    iError = aError;
+    iMsgQuery = aResult;
+
+    HandleResponse( aError, aResult );
+
+    // We are done
+    // 
+    iSession.SetConfirmDlgRoamingPtrNull();
+    delete this;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMConfirmDlgRoaming::ConfirmDlgResponse
+// -----------------------------------------------------------------------------
+//
+TBool CMPMConfirmDlgRoaming::ConfirmDlgResponse( MMPMConfirmDlg* aDlg )
+    {
+    TBool ret( EFalse );
+    CMPMConfirmDlgRoaming* dlg = (CMPMConfirmDlgRoaming*)aDlg;
+    if ( dlg && iIAP == dlg->iIAP )
+        {
+        ConfirmDlgResponse( dlg->iError, dlg->iMsgQuery );
+        ret = ETrue;
+        }
+    return ret;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMConfirmDlgRoaming::HandleResponse
+// -----------------------------------------------------------------------------
+//
+void CMPMConfirmDlgRoaming::HandleResponse( const TInt                      aError,
+                                            const TMsgQueryLinkedResults    aResult )
+    {
+    MPMLOGSTRING5( "CMPMConfirmDlgRoaming<0x%x>::HandleResponse: aError %d, aResult %d, dlg type %d", 
+                   iSession.ConnectionId(),
+                   aError,
+                   aResult,
+                   iDialogType )
+                   
+    TInt error( KErrNone );
+
+    if( aError == KErrCancel )
+        {
+        TRAP(error, iSession.RoamingConfirmationCompletedL( KErrNone, 
+                                                            EMsgQueryCancelled, 
+                                                            iReconnect ) )        
+        }
+    else
+        {
+        TRAP(error, iSession.RoamingConfirmationCompletedL( aError, 
+                                                            aResult, 
+                                                            iReconnect ) )        
+        }
+    if( error != KErrNone )
+        {
+        MPMLOGSTRING2( "CMPMConfirmDlgRoaming<0x%x>::HandleResponse: error occurred %d", 
+                       error )
+        }
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/src/mpmconfirmdlgstarting.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,321 @@
+/*
+* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Confirm Dialog implementation
+*
+*/
+
+/**
+@file mpmconfirmdlgstarting.cpp
+Starting Dialog implementation
+*/
+
+// INCLUDE FILES
+
+#include "mpmconfirmdlgstarting.h"
+#include "mpmconnmonevents.h"
+#include "mpmlogger.h"
+#include "mpmiapselection.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CMPMConfirmDlgStarting::NewL
+// -----------------------------------------------------------------------------
+//
+CMPMConfirmDlgStarting* CMPMConfirmDlgStarting::NewL( 
+    CMPMIapSelection&                   aIapSelection,
+    const TUint32                       aConnId,
+    const TUint32                       aSnapId,
+    const TUint32                       aIAP,
+    const CMPMConfirmDlg::TDialogType   aDialogType, 
+    const TMpmConnPref&                 aPref,
+    CMPMServer&                         aServer,
+    CMPMServerSession&                  aSession,
+    const TInt                          aIapState )
+    {
+    CMPMConfirmDlgStarting* self = new ( ELeave ) CMPMConfirmDlgStarting( 
+                                                          aIapSelection,
+                                                          aConnId,
+                                                          aSnapId,
+                                                          aIAP,
+                                                          aDialogType,
+                                                          aPref,
+                                                          aServer,
+                                                          aSession,
+                                                          aIapState);
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMConfirmDlgStarting::CMPMConfirmDlgStarting
+// -----------------------------------------------------------------------------
+//
+CMPMConfirmDlgStarting::CMPMConfirmDlgStarting( 
+    CMPMIapSelection&                   aIapSelection,
+    const TUint32                       aConnId,
+    const TUint32                       aSnapId,
+    const TUint32                       aIAP,
+    const CMPMConfirmDlg::TDialogType   aDialogType, 
+    const TMpmConnPref&                 aPref,
+    CMPMServer&                         aServer,
+    CMPMServerSession&                  aSession,
+    const TInt                          aIapState )
+    : iIapSelection( aIapSelection ),
+      iConnId( aConnId ),
+      iSnapId( aSnapId ),
+      iIAP( aIAP ),
+      iDialogType( aDialogType ),
+      iConfirmDlg( NULL ),
+      iPref( aPref ),
+      iServer( aServer ),
+      iSession ( aSession ),
+      iIapState( aIapState )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMConfirmDlgStarting::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CMPMConfirmDlgStarting::ConstructL()
+    {
+    CArrayPtrFlat<CMPMDialogBase>* queue = ((CArrayPtrFlat<CMPMDialogBase>*)iServer.StartingQueue());
+    iConfirmDlg = CMPMConfirmDlg::NewL( *queue,
+                                        *this, 
+                                        iSnapId, 
+                                        iIAP, 
+                                        iDialogType );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMConfirmDlgStarting::~CMPMConfirmDlgStarting
+// -----------------------------------------------------------------------------
+//
+CMPMConfirmDlgStarting::~CMPMConfirmDlgStarting()
+    {
+    MPMLOGSTRING2( "CMPMConfirmDlgStarting<0x%x>::~CMPMConfirmDlgStarting", 
+        iConnId )
+    delete iConfirmDlg;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMConfirmDlgStarting::ConfirmDlgResponse
+// -----------------------------------------------------------------------------
+//
+void CMPMConfirmDlgStarting::ConfirmDlgResponse( 
+    const TInt                      aError,
+    const TMsgQueryLinkedResults    aResult )
+    {
+    MPMLOGSTRING4( "CMPMConfirmDlgStarting<0x%x>::ConfirmDlgResponse\
+ error: %d result: %d", iConnId, aError, aResult )
+
+    // Store value to be verified in destructor 
+    // 
+    iMsgQuery = aResult;
+    iError = aError;
+   
+    // First case, we are asking the confirmation dialog when the connection 
+    // is starting. 
+    // 
+
+    if ( aError == KErrNone )
+        {
+        switch (aResult)
+            {
+            case EMsgQueryThisTime:
+                UserSelectedConnectThisTime();
+                break;
+
+            case EMsgQueryAutomatically:
+                UserSelectedConnectAutomatically();
+                break;
+
+            case EMsgQueryCancelled:
+                UserSelectedCancel( KErrCancel );
+                break;
+
+            default:
+                UserSelectedCancel( KErrCancel );
+                break;            
+            }
+
+        } 
+    else
+        {
+        UserSelectedCancel( aError );
+        }
+    
+    // We are done
+    // 
+    iIapSelection.SetConfirmDlgStartingPtrNull();
+    delete this;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMConfirmDlgStarting::ConfirmDlgResponse
+// -----------------------------------------------------------------------------
+//
+TBool CMPMConfirmDlgStarting::ConfirmDlgResponse( MMPMConfirmDlg* aDlg )
+    {
+    TBool ret( EFalse );
+    CMPMConfirmDlgStarting* dlg = (CMPMConfirmDlgStarting*)aDlg;
+    if ( dlg && iIAP == dlg->iIAP )
+        {
+        ConfirmDlgResponse( dlg->iError, dlg->iMsgQuery );
+        ret = ETrue;
+        }
+    return ret;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMConfirmDlgStarting::UserSelectedCancel
+// -----------------------------------------------------------------------------
+//
+void CMPMConfirmDlgStarting::UserSelectedCancel( const TInt aError )
+    {
+    MPMLOGSTRING2( "CMPMConfirmDlgStarting<0x%x>::UserSelectedCancel", 
+        iConnId )
+    MPMLOGSTRING3( "CMPMConfirmDlgStarting<0x%x>::UserSelectedCancel:\
+ Complete %d", iConnId, aError )
+    iIapSelection.ChooseIapComplete( aError, NULL );
+    }
+
+
+void CMPMConfirmDlgStarting::UserSelectedConnectThisTime()
+    {
+    MPMLOGSTRING2( "CMPMConfirmDlgStarting<0x%x>::UserSelectedConnectThisTime", iConnId )
+    
+    TBool wlanNeeded( EFalse );
+    TRAPD( err, wlanNeeded = iIapSelection.StartWlanQueryIfNeededL( iIAP ) )
+    if( err == KErrNone )
+        {
+        if( !wlanNeeded )
+            {
+            if ( iIapState == CMPMIapSelection::EImplicitConnection )
+                {
+                TRAP( err, iIapSelection.CompleteImplicitConnectionL() )
+                
+                if ( err )
+                    {
+                    MPMLOGSTRING2( "iIapSelection.CompleteImplicitConnectionL failed with %d", 
+                    err )
+                    iIapSelection.ChooseIapComplete( err, NULL );
+                    }
+                }
+            else
+                {
+                iServer.AppendBMConnection( iConnId, 
+                                            iSnapId, 
+                                            iIAP, 
+                                            EStarting,
+                                            iSession );
+
+                // Complete the ChooseBestIAP message with 
+                // KErrNone if user selected yes.
+                // 
+                MPMLOGSTRING2( "CMPMConfirmDlgStarting<0x%x>::UserSelectedConnectThisTime:\
+Complete KErrNone", iConnId )
+                iIapSelection.ChooseIapComplete( KErrNone, &iPref );                        
+                }
+            }
+        
+        }
+    else
+        {
+        MPMLOGSTRING3( "CMPMConfirmDlgStarting<0x%x>::UserSelectedConnectThisTime:\
+ StartWlanQueryIfNeededL failed with %d", iConnId, err )
+        iIapSelection.ChooseIapComplete( err, &iPref );       
+        }
+    }
+
+
+void CMPMConfirmDlgStarting::UserSelectedConnectAutomatically()
+    {
+    MPMLOGSTRING2( "CMPMConfirmDlgStarting<0x%x>::UserSelectedConnectAutomatically", iConnId )
+    //Store selected value to commsdat if we are in home network
+    if (iDialogType == CMPMConfirmDlg::EConfirmDlgHomeNetwork )
+        {
+        TCmGenConnSettings genConnSettings;
+
+        TRAPD(errorCode,genConnSettings = iServer.CommsDatAccess()->ReadGenConnSettingsL()); // call a function
+
+        //If reading of database failed we do not write back to the database to prevent random values
+        if (errorCode == KErrNone)
+            {
+            genConnSettings.iSeamlessnessHome = ECmSeamlessnessShowprogress;        
+            TRAP_IGNORE(iServer.CommsDatAccess()->WriteGenConnSettingsL( genConnSettings )); 
+            }
+        } 
+    else
+        {
+        //In foreign country connect automatically is not stored in commsdat
+        //even user selected so. We just do not ask confirmation for the cellular
+        //connection again in this country:
+        iServer.RoamingWatcher()->SetAskCellularDataUsageAbroad( false );            
+        }
+    
+    TBool wlanNeeded( EFalse );
+    TRAPD( err, wlanNeeded = iIapSelection.StartWlanQueryIfNeededL( iIAP ) )
+    if( err == KErrNone )
+        {
+        if( !wlanNeeded )
+            {
+            if ( iIapState == CMPMIapSelection::EImplicitConnection )
+                {
+                TRAP( err, iIapSelection.CompleteImplicitConnectionL() )
+                
+                if ( err )
+                    {
+                    MPMLOGSTRING2( "iIapSelection.CompleteImplicitConnectionL failed with %d", 
+                    err )
+                    iIapSelection.ChooseIapComplete( err, NULL );
+                    }
+                }
+            else
+                {
+                iServer.AppendBMConnection( iConnId, 
+                                            iSnapId, 
+                                            iIAP, 
+                                            EStarting,
+                                            iSession );
+
+                 // Complete the ChooseBestIAP message with 
+                 // KErrNone if user selected yes.
+                 // 
+                 MPMLOGSTRING2( "CMPMConfirmDlgStarting<0x%x>::UserSelectedConnectAutomatically:\
+Complete KErrNone", iConnId )
+                iIapSelection.ChooseIapComplete( KErrNone, &iPref );    
+                }
+            }
+        }
+    else
+        {
+        MPMLOGSTRING3( "CMPMConfirmDlgStarting<0x%x>::UserSelectedConnectAutomatically:\
+ StartWlanQueryIfNeededL failed with %d", iConnId, err )
+        iIapSelection.ChooseIapComplete( err, &iPref );       
+        }
+       
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/src/mpmconnmonevents.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,748 @@
+/*
+* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Get events from Connection Monitor
+*
+*/
+
+/**
+@file mpmconnmonevents.cpp
+Get events from Connection Monitor.
+*/
+
+// INCLUDE FILES
+#include "mpmconnmonevents.h"
+#include "mpmconnmonreqs.h"
+#include "mpmserver.h"
+#include "mpmserversession.h"
+#include "mpmlogger.h"
+#include "mpmwlanavailability.h"
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CMPMConnMonEvents::NewL
+// -----------------------------------------------------------------------------
+//             
+CMPMConnMonEvents* CMPMConnMonEvents::NewL( CMPMServer& aServer, 
+                                            CMPMServerSession& aSession )
+    {
+    CMPMConnMonEvents* self = new ( ELeave ) CMPMConnMonEvents( aServer );
+    CleanupStack::PushL( self );
+    self->ConstructL( aSession );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMConnMonEvents::CMPMConnMonEvents
+// -----------------------------------------------------------------------------
+// 
+CMPMConnMonEvents::CMPMConnMonEvents( CMPMServer& aServer )
+    : iMyServer( aServer ),
+      iDiscardAvailabilityNotification( EFalse )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMConnMonEvents::~CMPMConnMonEvents
+// -----------------------------------------------------------------------------
+// 
+CMPMConnMonEvents::~CMPMConnMonEvents()
+    {
+    iConnMon.CancelNotifications();
+    iConnMon.Close();
+    iReqPtrs.ResetAndDestroy();
+    iConnInfoArray.Close();
+    delete iWlanAvailability;
+    iWlanAvailability = NULL;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMConnMonEvents::ConstructL
+// -----------------------------------------------------------------------------
+// 
+void CMPMConnMonEvents::ConstructL( CMPMServerSession& aSession )
+    {
+    MPMLOGSTRING( "CMPMConnMonEvents::ConstructL" )
+    // Connect to Connection Monitor
+    //
+    TInt rv = iConnMon.ConnectL();
+    if ( rv != KErrNone )
+        {
+        MPMLOGSTRING2(
+            "CMPMConnMonEvents::ConstructL error connecting to ConnMon %d",
+            rv )
+        User::Leave( rv );
+        }
+
+    // Request for available IAPs
+    //
+    CMPMConnMonReqs* req = CMPMConnMonReqs::NewL( 
+                                *const_cast<CMPMConnMonEvents*>( this ),
+                                iConnMon,
+                                aSession.ConnectionId(), aSession );
+    CleanupStack::PushL( req );
+    iReqPtrs.AppendL( req ); 
+    req->AvailableIapsSync();
+
+    UpdateIAPRefreshTime();
+    
+    // Activate event notifications
+    //
+    iConnMon.NotifyEventL( *this );
+    CleanupStack::Pop( req );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMConnMonEvents::RemoveReqPtr
+// -----------------------------------------------------------------------------
+// 
+void CMPMConnMonEvents::RemoveReqPtr( const CMPMConnMonReqs* aReq )
+    {
+    TInt index( KErrNotFound );
+
+    index = iReqPtrs.Find( aReq );
+    if ( index != KErrNotFound )
+        {
+        iReqPtrs.Remove( index );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMConnMonEvents::AppendConnInfo
+// -----------------------------------------------------------------------------
+// 
+void CMPMConnMonEvents::AppendConnInfo( const TUint& aConnId  )
+    {
+    TInt index( KErrNotFound );
+    TConnInfo info;
+    
+    info.iConnId = aConnId;
+    index = iConnInfoArray.Find( info );
+
+    if ( index == KErrNotFound )
+        {
+        iConnInfoArray.Append( info );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMConnMonEvents::RemoveConnInfo
+// -----------------------------------------------------------------------------
+// 
+void CMPMConnMonEvents::RemoveConnInfo( const TUint& aConnId  )
+    {
+    TInt index( KErrNotFound );
+    TConnInfo info;
+    
+    info.iConnId = aConnId;
+    index = iConnInfoArray.Find( info );
+
+    if ( ( index != KErrNotFound ) && ( index < iConnInfoArray.Count() ) )
+        {
+        iConnInfoArray.Remove( index );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMConnMonEvents::SetConnInfo
+// -----------------------------------------------------------------------------
+// 
+void CMPMConnMonEvents::SetConnInfo( const TUint& aConnId, 
+                                     const TUint& aIapId, 
+                                     const TUint& aPresumedIapId, 
+                                     const TUint& aNetId, 
+                                     const TDesC& aAPN )
+    {
+    TInt index( KErrNotFound );
+    TConnInfo info;
+
+    info.iConnId = aConnId;
+    index = iConnInfoArray.Find( info );
+
+    if ( ( index != KErrNotFound ) && ( index < iConnInfoArray.Count() ) )
+        {
+        MPMLOGSTRING3(
+            "CMPMConnMonEvents::SetConnInfo - aConnId = 0x%x, APN = %S", 
+            aConnId, &aAPN )
+        iConnInfoArray[index].iIapId = TUint32( aIapId );
+        iConnInfoArray[index].iNetId = TUint32( aNetId );
+        iConnInfoArray[index].iAPN.Copy( aAPN );
+        iConnInfoArray[index].iSSID.FillZ();
+        iConnInfoArray[index].iSSID.Zero();
+        iConnInfoArray[index].iPresumedIapId = TUint32( aPresumedIapId );
+        iConnInfoArray[index].iConnType = EConnectionGPRS; 
+        }
+    else
+        {
+        MPMLOGSTRING2(
+            "CMPMConnMonEvents::SetConnInfo - aConnId = 0x%x not found", 
+            aConnId )
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMConnMonEvents::SetConnInfo
+// -----------------------------------------------------------------------------
+// 
+void CMPMConnMonEvents::SetConnInfo( const TUint&       aConnId, 
+                                     const TUint&       aIapId, 
+                                     const TUint&       aPresumedIapId, 
+                                     const TUint&       aNetId, 
+                                     const TWlanSsid&   aSSID  )
+    {
+    TInt index( KErrNotFound );
+    TConnInfo info;
+
+    info.iConnId = aConnId;
+    index = iConnInfoArray.Find( info );
+
+    if ( ( index != KErrNotFound ) && ( index < iConnInfoArray.Count() ) )
+        {
+        MPMLOGSSID(
+            "CMPMConnMonEvents::SetConnInfo - aConnId = 0x%x, SSID = %S",
+            aConnId, &aSSID )
+
+        iConnInfoArray[index].iIapId = TUint32( aIapId );
+        iConnInfoArray[index].iNetId = TUint32( aNetId );
+        iConnInfoArray[index].iAPN.FillZ();
+        iConnInfoArray[index].iAPN.Zero();
+        iConnInfoArray[index].iSSID.Copy( aSSID );
+        iConnInfoArray[index].iPresumedIapId = TUint32( aPresumedIapId );
+        iConnInfoArray[index].iConnType = EConnectionWLAN; 
+        }
+    else
+        {
+        MPMLOGSTRING2(
+            "CMPMConnMonEvents::SetConnInfo - aConnId = 0x%x not found", 
+            aConnId )
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMConnMonEvents::SetConnInfoIapSsid
+// -----------------------------------------------------------------------------
+// 
+void CMPMConnMonEvents::SetConnInfoIapSsid( const TUint&       aIapId, 
+                                            const TWlanSsid&    aSSID  )
+    {
+
+    for ( TInt i( 0 ); ( i < iConnInfoArray.Count() ); i++ )
+        {
+        if ( iConnInfoArray[i].iIapId == aIapId )
+            {
+            iConnInfoArray[i].iSSID.Copy( aSSID );
+            }
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMConnMonEvents::ResetConnInfo
+// -----------------------------------------------------------------------------
+// 
+void CMPMConnMonEvents::ResetConnInfo( const TUint& aConnId )
+    {
+    TInt index( KErrNotFound );
+    TConnInfo info;
+
+    info.iConnId = aConnId;
+    index = iConnInfoArray.Find( info );
+
+    if ( ( index != KErrNotFound ) && ( index < iConnInfoArray.Count() ) )
+        {
+        MPMLOGSTRING2(
+            "CMPMConnMonEvents::ResetConnInfo - aConnId = 0x%x reset", 
+            aConnId )
+        iConnInfoArray[index].iIapId = 0;
+        iConnInfoArray[index].iNetId = 0;
+        iConnInfoArray[index].iPresumedIapId = 0;
+        iConnInfoArray[index].iAPN.FillZ();
+        iConnInfoArray[index].iAPN.Zero();
+        iConnInfoArray[index].iSSID.FillZ();
+        iConnInfoArray[index].iSSID.Zero();
+        iConnInfoArray[index].iConnType = EConnectionGeneric; 
+        }
+    else
+        {
+        MPMLOGSTRING2(
+            "CMPMConnMonEvents::ResetConnInfo - aConnId = 0x%x not found", 
+            aConnId )
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMConnMonEvents::ResetIapConnInfo
+// -----------------------------------------------------------------------------
+// 
+void CMPMConnMonEvents::ResetIapConnInfo( const TUint32 aIapId )
+    {
+
+    // Reset all connections using aIapId
+    // 
+    for ( TInt index( 0 ); ( index < iConnInfoArray.Count() ); index++ )
+        {
+        if ( iConnInfoArray[index].iIapId == aIapId )
+            {
+            MPMLOGSTRING2(
+                "CMPMConnMonEvents::ResetIapConnInfo - ConnId = 0x%x reset", 
+                iConnInfoArray[index].iConnId )
+            iConnInfoArray[index].iIapId = 0;
+            iConnInfoArray[index].iNetId = 0;
+            iConnInfoArray[index].iPresumedIapId = 0;
+            iConnInfoArray[index].iAPN.FillZ();
+            iConnInfoArray[index].iAPN.Zero();
+            iConnInfoArray[index].iSSID.FillZ();
+            iConnInfoArray[index].iSSID.Zero();
+            iConnInfoArray[index].iConnType = EConnectionGeneric; 
+            }
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMConnMonEvents::GetAvailableIAPs
+// -----------------------------------------------------------------------------
+// 
+const TConnMonIapInfo& CMPMConnMonEvents::GetAvailableIAPs()
+    {
+    return iAvailableIAPs;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMConnMonEvents::SetAvailableIAPs
+// -----------------------------------------------------------------------------
+// 
+void CMPMConnMonEvents::SetAvailableIAPs(
+    const TConnMonIapInfo& aAvailableIAPs )
+    {
+    iAvailableIAPs = aAvailableIAPs;
+    
+    UpdateIAPRefreshTime();
+    
+    MPMLOGSTRING2( "CMPMConnMonEvents::SetAvailableIAPs - IAPs count: %d", 
+        iAvailableIAPs.Count() )
+
+#ifdef _DEBUG
+    for ( TUint i = 0; i < iAvailableIAPs.Count(); i++ )
+        {
+        MPMLOGSTRING2( "CMPMConnMonEvents::SetAvailableIAPs - IAP: %d", 
+            iAvailableIAPs.iIap[i].iIapId)
+        }
+#endif // _DEBUG
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMConnMonEvents::FindAPN
+// -----------------------------------------------------------------------------
+//
+void CMPMConnMonEvents::FindAPN( const TDesC&   aDes,
+                                 TUint32&       aIapId,
+                                 TUint32&       aNetId )
+    {
+    TBool apnFound( EFalse );
+
+    for ( TInt i( 0 ); ( (i < iConnInfoArray.Count()) && !apnFound ); i++ )
+        {
+        if ( ( aDes.Compare( iConnInfoArray[i].iAPN ) == KErrNone ) && 
+             ( iConnInfoArray[i].iConnType == EConnectionGPRS ) )
+            {
+            aIapId = iConnInfoArray[i].iIapId;
+            aNetId = iConnInfoArray[i].iNetId;
+            MPMLOGSTRING2( "CMPMConnMonEvents::FindAPN found Iap Id: %i", 
+                            aIapId)
+            MPMLOGSTRING2( "CMPMConnMonEvents::FindAPN found Net Id: %i",
+                            aNetId)
+            apnFound = ETrue;
+            }
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMConnMonEvents::FindSSID
+// -----------------------------------------------------------------------------
+//
+void CMPMConnMonEvents::FindSSID( const TWlanSsid&   aSSID,
+                                  TUint32&          aIapId,
+                                  TUint32&          aNetId )
+    {
+    TBool ssidFound( EFalse );
+
+    for ( TInt i( 0 ); ( (i < iConnInfoArray.Count()) && !ssidFound ); i++ )
+        {
+        if ( ( aSSID.Compare( iConnInfoArray[i].iSSID ) == KErrNone ) && 
+             ( iConnInfoArray[i].iConnType == EConnectionWLAN ) )
+            {
+            aIapId = iConnInfoArray[i].iIapId;
+            aNetId = iConnInfoArray[i].iNetId;
+            MPMLOGSTRING2( "CMPMConnMonEvents::FindSSID found Iap Id: %i", 
+                            aIapId)
+            MPMLOGSTRING2( "CMPMConnMonEvents::FindSSID found Net Id: %i",
+                            aNetId)
+            ssidFound = ETrue;
+            }
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMConnMonEvents::ActiveWlanConnection
+// -----------------------------------------------------------------------------
+//
+TBool CMPMConnMonEvents::ActiveWlanConnection( TWlanSsid&   aSSID, 
+                                               TUint32&     aIapId )
+    {
+    TWlanSsid   emptySSID;
+    TBool       activeWlanFound( EFalse );
+
+    emptySSID.FillZ();
+    emptySSID.Zero();
+
+    for ( TInt i( 0 ); ( (i < iConnInfoArray.Count()) && !activeWlanFound );
+          i++ )
+        {
+        if ( emptySSID.Compare( iConnInfoArray[i].iSSID ) != KErrNone )
+            {
+            // Cross check that a started connection with the wlan IAP 
+            // is found from ActiveBMConnections
+            // 
+            TUint32 connIap = iMyServer.GetBMIap( iConnInfoArray[i].iConnId );
+            TConnectionState connState; 
+            iMyServer.GetConnectionState( iConnInfoArray[i].iConnId, connState );
+            if( connIap == iConnInfoArray[i].iIapId && 
+                connState == EStarted )
+                {
+                aSSID.Copy( iConnInfoArray[i].iSSID );
+                aIapId = iConnInfoArray[i].iIapId;
+                activeWlanFound = ETrue;
+
+                MPMLOGSSID( "CMPMConnMonEvents::ActiveWlanConnection found\
+ ConnId = 0x%x, SSID = %S", iConnInfoArray[i].iConnId, &aSSID )
+
+                MPMLOGSTRING2(
+                    "CMPMConnMonEvents::ActiveWlanConnection found Iap Id: %i",
+                iConnInfoArray[i].iIapId )
+                }
+            else
+                {
+                MPMLOGSSID( "CMPMConnMonEvents::ActiveWlanConnection found\
+ but connection not in started state ConnId = 0x%x, SSID = %S", 
+                    iConnInfoArray[i].iConnId, &aSSID )
+                }
+            }
+        }
+    return activeWlanFound;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMConnMonEvents::IapAvailabilityChange
+// -----------------------------------------------------------------------------
+// 
+void CMPMConnMonEvents::IapAvailabilityChange()
+    {
+    if ( ( iAvailableIAPs.Count() > 0 ) && 
+         !DiscardAvailabilityNotification() )
+        {
+        // Remove temporary blacklistings as fresh availability 
+        // info is available.
+        // 
+        iMyServer.HandleServerUnblackListIap( ETemporary );
+        
+        // Send preferred IAP notifications, but DO NOT LEAVE 
+        // or Connection Monitor CConnMonEventHandler::RunL() 
+        // will also leave, which will make mpmserver.exe CRASH.
+        // 
+        TRAP_IGNORE( iMyServer.NotifyBMPrefIapL( iAvailableIAPs ) )
+        }
+    else
+        {
+        MPMLOGSTRING2( "CMPMConnMonEvents::EventL - IAPs count: %d", 
+            iAvailableIAPs.Count() )
+        MPMLOGSTRING2( 
+            "CMPMConnMonEvents::EventL - DiscardAvailabilityNotification = %d", 
+            DiscardAvailabilityNotification() )
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMConnMonEvents::EventL
+// -----------------------------------------------------------------------------
+// 
+void CMPMConnMonEvents::EventL( const CConnMonEventBase& aConnMonEvent )
+    {
+    MPMLOGSTRING2( "CMPMConnMonEvents::EventL %d", aConnMonEvent.EventType())
+
+    switch ( aConnMonEvent.EventType() )
+        {
+        case EConnMonCreateConnection: 
+            {
+            MPMLOGSTRING( "    EConnMonCreateConnection" )
+            iMyServer.IncrementConnections();
+            break; 
+            }
+        case EConnMonDeleteConnection:
+            {
+            MPMLOGSTRING( "    EConnMonDeleteConnection" )
+            iMyServer.DecrementConnections(); 
+            break; 
+            }
+        case EConnMonIapAvailabilityChange:
+            {
+#ifdef __DEBUG
+            if ( iFilterEvents == ETrue )
+                {
+                MPMLOGSTRING( "    EConnMonIapAvailabilityChange FILTERED OUT" )
+                return;
+                }
+#endif //__DEBUG
+            // IAP Availability has changed 
+            // 
+            MPMLOGSTRING( "    EConnMonIapAvailabilityChange" )
+
+            const CConnMonIapAvailabilityChange* eventIap;
+
+            // Following line is correct, even though 
+            // PC-Lint claims that here is a problem:
+            // 
+            // Suspicious pointer-to-pointer conversion (area too small)
+            // 
+            eventIap = static_cast<const CConnMonIapAvailabilityChange*>( 
+                                                         &aConnMonEvent );
+
+            iAvailableIAPs = eventIap->IapAvailability();
+            UpdateIAPRefreshTime();
+            IapAvailabilityChange();
+            
+            TRAPD( err, iMyServer.UpdateSessionConnectionDlgL() )
+            if( err != KErrNone )
+                {
+                MPMLOGSTRING2( "CMPMConnMonEvents::EventL UpdateSessionConnectionDlgL \
+error code %d", err )
+                }
+            break;
+            }
+        default:
+            {
+            MPMLOGSTRING( "CMPMConnMonEvents::RunL: default" )
+            break;
+            }
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMConnMonEvents::ScanWLANNetworksL
+// -----------------------------------------------------------------------------
+// 
+void CMPMConnMonEvents::ScanWLANNetworksL( CMPMServerSession* aSession,
+                                           const TConnectionId& aId,
+                                           TWlanScanCallback aCallback,
+                                           TInt aForceRefreshIntervalSeconds )
+    {
+    MPMLOGSTRING( "CMPMConnMonEvents::ScanWLANNetworksL" )
+    // Sanity check null pointer 
+    ASSERT( aSession != NULL 
+            || aCallback == EWlanScanCallbackNone 
+            || aCallback == EWlanScanCallbackGenerateEvent );
+    // Request for available WLAN Networks
+    //
+    CMPMConnMonReqs* req = CMPMConnMonReqs::NewL( 
+                                *const_cast<CMPMConnMonEvents*>( this ),
+                                iConnMon,
+                                aId, 
+                                *aSession );
+    CleanupStack::PushL( req );
+    iReqPtrs.AppendL( req ); 
+    req->RefreshAvailableIAPs( aCallback, aForceRefreshIntervalSeconds );
+    CleanupStack::Pop( req );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMConnMonEvents::CancelScanL
+// -----------------------------------------------------------------------------
+// 
+void CMPMConnMonEvents::CancelScanL( CMPMServerSession& aSession )
+    {
+    MPMLOGSTRING( "CMPMConnMonEvents::CancelScanL" )
+
+    // Disable discarding availability notifications from Connection Monitor.
+    // 
+    DisableDiscarding(); 
+
+    CMPMConnMonReqs* req = CMPMConnMonReqs::NewL( 
+                                *const_cast<CMPMConnMonEvents*>( this ),
+                                iConnMon,
+                                aSession.ConnectionId(), 
+                                aSession );
+    // Delete ongoing req, if found
+    TInt index = iReqPtrs.Find(req, CMPMConnMonReqs::CompareConnIds);
+    if (index != KErrNotFound)
+        {
+        // Instead of delete iReqPtrs[index]
+        // We just mark it as obsolete.
+        iReqPtrs[index]->MyCancel();
+        // And we can remove the index as the request will handle the deletion.
+        iReqPtrs.Remove(index);
+        }
+    // Finally delete the temporary object.
+    delete req;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMConnMonEvents::PresumedIapId
+// -----------------------------------------------------------------------------
+// 
+TUint32 CMPMConnMonEvents::PresumedIapId( const TUint& aConnId, 
+                                          const TUint& aIapId )
+    {
+
+    for ( TInt i( 0 ); ( i < iConnInfoArray.Count() ); i++ )
+        {
+        if ( iConnInfoArray[i].iConnId == aConnId &&
+             iConnInfoArray[i].iIapId == aIapId )
+            {
+            if ( iConnInfoArray[i].iPresumedIapId == 0 )
+                {
+                // Iap Id zero is not a valid Iap Id
+                // 
+                return aIapId; 
+                }
+            else
+                {
+                MPMLOGSTRING2(
+                    "CMPMConnMonEvents::PresumedIapId found Iap: %i", 
+                    iConnInfoArray[i].iPresumedIapId )
+
+                return iConnInfoArray[i].iPresumedIapId;
+                }
+            }
+        }
+
+    // PresumedIapId returns aIapId in case no presumed IAP info is found. 
+    // 
+    return aIapId; 
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMConnMonEvents::UpdateIAPRefreshTime
+// -----------------------------------------------------------------------------
+// 
+void CMPMConnMonEvents::UpdateIAPRefreshTime()
+    {
+    iLastIAPRefreshTime.UniversalTime();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMConnMonEvents::GetIAPRefreshTime
+// -----------------------------------------------------------------------------
+// 
+TTime& CMPMConnMonEvents::GetIAPRefreshTime()
+    {
+    return iLastIAPRefreshTime;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMConnMonEvents::SetConnectionCounter
+// -----------------------------------------------------------------------------
+// 
+void CMPMConnMonEvents::SetConnectionCounter( const TUint aValue )
+    {
+    iMyServer.SetConnectionCounter( aValue );
+    }
+
+
+// -----------------------------------------------------------------------------
+// TConnInfo::TConnInfo
+// -----------------------------------------------------------------------------
+//
+TConnInfo::TConnInfo() 
+    : iConnId( 0 ),
+      iIapId( 0 ),
+      iPresumedIapId( 0 ),
+      iNetId( 0 ), 
+      iAPN(), 
+      iSSID(), 
+      iConnType( EConnectionGeneric )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMConnMonEvents::CheckWlanAvailabilityL
+// -----------------------------------------------------------------------------
+// 
+void CMPMConnMonEvents::CheckWlanAvailabilityL( MWlanAvailability* aObserver )
+    {
+    MPMLOGSTRING( "CMPMConnMonEvents::CheckWlanAvailabilityL" )
+    // Sanity check null pointer 
+    ASSERT( aObserver != NULL );
+
+    // Request for WLAN bearer availability info
+    //
+    if ( !iWlanAvailability )
+        {
+        iWlanAvailability = CWlanAvailability::NewL( this, iConnMon );
+        }
+    
+    iWlanAvailability->Start( aObserver );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMConnMonEvents::CancelCheckWlanWlanAvailability
+// -----------------------------------------------------------------------------
+//
+void CMPMConnMonEvents::CancelCheckWlanWlanAvailability( MWlanAvailability* aObserver )
+    {
+    MPMLOGSTRING( "CMPMConnMonEvents::CancelCheckWlanWlanAvailability" )
+    // Sanity check null pointer 
+    ASSERT( aObserver != NULL );
+
+    // Cancel WLAN bearer availability check for this observer
+    //
+    if ( iWlanAvailability )
+        {
+        iWlanAvailability->CancelObserver( aObserver );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMConnMonEvents::SetWlanAvailabilityPtrNull
+// -----------------------------------------------------------------------------
+//
+void CMPMConnMonEvents::SetWlanAvailabilityPtrNull()
+    {
+    iWlanAvailability = NULL;
+    }
+
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/src/mpmconnmonreqs.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,454 @@
+/*
+* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: MPM ConnMon request handling
+*
+*/
+
+/**
+@file mpmconnmonreqs.cpp
+Mobility Policy Manager ConnMon request handling.
+*/
+
+// INCLUDE FILES
+#include "mpmconnmonreqs.h"
+#include "mpmlogger.h"
+#include "mpmserversession.h"
+#include "mpmiapselection.h"
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CMPMConnMonReqs::NewL
+// -----------------------------------------------------------------------------
+//
+CMPMConnMonReqs* CMPMConnMonReqs::NewL(CMPMConnMonEvents& aParent,
+                                       RConnectionMonitor& aConnMon,
+                                       TUint aConnId, 
+                                       CMPMServerSession& aSession )
+    {
+    CMPMConnMonReqs* self = new (ELeave) CMPMConnMonReqs(
+                                aParent, aConnMon, aConnId, aSession );
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMConnMonReqs::CMPMConnMonReqs
+// -----------------------------------------------------------------------------
+//
+CMPMConnMonReqs::CMPMConnMonReqs(CMPMConnMonEvents& aParent,
+                                 RConnectionMonitor& aConnMon,
+                                 TUint aConnId, 
+                                 CMPMServerSession& aSession )
+    : CActive(CActive::EPriorityStandard), 
+      iParent(aParent), 
+      iConnMon(aConnMon), 
+      iConnId(aConnId), 
+      iSession(aSession), 
+      iWlanScanCallback( EWlanScanCallbackNone ), 
+      iConnectionCount( 0 )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMConnMonReqs::~CMPMConnMonReqs
+// -----------------------------------------------------------------------------
+//
+CMPMConnMonReqs::~CMPMConnMonReqs()
+    {
+    MPMLOGSTRING( "CMPMConnMonReqs::~CMPMConnMonReqs" )
+    Cancel();
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMConnMonReqs::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CMPMConnMonReqs::ConstructL()
+    {
+    MPMLOGSTRING( "CMPMConnMonReqs::ConstructL" )
+    CActiveScheduler::Add(this);
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMConnMonReqs::AvailableIapsSync
+// -----------------------------------------------------------------------------
+//
+void CMPMConnMonReqs::AvailableIapsSync()
+    {
+    MPMLOGSTRING( "CMPMConnMonReqs::AvailableIapsSync" )
+    iNextState = EGetIapAvailState;
+    iLastCancelCode = EConnMonGetPckgAttribute;
+    iConnMon.GetPckgAttribute( EBearerIdAll, 0, KIapAvailability,
+                               iIapBuf, iStatus);
+    SetActive();
+    
+    // Since CodeScanner does not recognise method IsStarted(), 
+    // it claims that here is a problem:
+    // 
+    // Problem: Active object called without checking 
+    // whether it is active or cancelling it first.
+    // 
+    if ( !iActiveSchedulerWait.IsStarted() )
+        {
+        iActiveSchedulerWait.Start();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMConnMonReqs::RefreshAvailableIAPs
+// -----------------------------------------------------------------------------
+//
+void CMPMConnMonReqs::RefreshAvailableIAPs( TWlanScanCallback aCallback, 
+                                            TInt aForceRefreshIntervalSeconds )
+    {
+    MPMLOGSTRING2( "CMPMConnMonReqs::RefreshAvailableIAPs callback %d", aCallback )
+    // set the type of callback to determine afterwards which function to call
+    iWlanScanCallback = aCallback;
+    iNextState      = EScanWLANNetworksState;   // Default value
+    iLastCancelCode = EConnMonGetPckgAttribute;
+
+    TTime time;
+    time.UniversalTime();
+    TTimeIntervalSeconds interval( 0 );
+    
+    TInt ret( KErrNone );
+        
+    // Calculate the elapsed time.
+    ret = time.SecondsFrom( iParent.GetIAPRefreshTime(), interval );
+    if ( ret != KErrNone )
+        {
+        MPMLOGSTRING2( "CMPMConnMonReqs::RefreshAvailableIAPs interval error %d ", ret )
+        // problem with interval, force iapavailability.
+        interval = 0;
+        aForceRefreshIntervalSeconds = 0;
+        }
+    // Default behavior is to query KIapAvailability from ConnMon always
+    // or if the availability information has aged at least aForceRefreshIntervalSeconds
+    //
+    if ( aForceRefreshIntervalSeconds == 0 || 
+       ( interval.Int() >= aForceRefreshIntervalSeconds ) )
+        {
+        // Discard availability notifications from Connection Monitor 
+        // until MPM initiated WLAN scan request has completed.
+        // 
+        iParent.EnableDiscarding();
+
+        MPMLOGSTRING2( "CMPMConnMonReqs::RefreshAvailableIAPs interval %d, executing scan", 
+            interval.Int() )
+        iConnMon.GetPckgAttribute( EBearerIdAll, 0, KIapAvailability,
+                                   iIapBuf, iStatus );
+        SetActive();
+        }
+    // With consecutive calls we allow MPM to use cached value.
+    //
+    else
+        {
+        MPMLOGSTRING2( "CMPMConnMonReqs::RefreshAvailableIAPs interval %d, using cached value",
+            interval.Int() )
+
+        // iIapBuf is empty, thus we need a new state.
+        iNextState = EScanWLANNetworksStateCached;
+        TRequestStatus* statusPtr;
+        statusPtr = &iStatus;
+        // We can just complete the request.
+        SetActive();
+        User::RequestComplete( statusPtr, KErrNone );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMConnMonReqs::CompareConnIds
+// -----------------------------------------------------------------------------
+//
+TBool CMPMConnMonReqs::CompareConnIds( const CMPMConnMonReqs& aReq1,
+                                       const CMPMConnMonReqs& aReq2 )
+    {
+    if ( aReq1.iConnId == aReq2.iConnId )
+        {
+        return ETrue;
+        }
+    else
+        {
+        return EFalse;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMConnMonReqs::MyCancel()
+// -----------------------------------------------------------------------------
+//
+void CMPMConnMonReqs::MyCancel()
+    {
+    // Handle cancellation here.
+    MPMLOGSTRING( "CMPMConnMonReqs::MyCancel()" )
+    ASSERT( iNextState != EGetIapAvailState && iNextState != EObsolete );
+    // Allow the availability update when the connmon request completes.
+    iNextState = EObsolete;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMConnMonReqs::ErrorCallbackL()
+// -----------------------------------------------------------------------------
+//
+void CMPMConnMonReqs::ErrorCallbackL( TInt aStatus )
+    {
+    switch ( iNextState )
+        {
+        case EGetIapAvailState:
+        case EGetConnectionCountState: 
+            {
+            MPMLOGSTRING( "CMPMConnMonReqs::ErrorCallbackL: EGetIapAvailState failed" )
+            if ( iActiveSchedulerWait.IsStarted() )
+                {
+                iActiveSchedulerWait.AsyncStop();
+                }
+            break;
+            }
+        case EScanWLANNetworksState:
+        case EScanWLANNetworksStateCached:
+            {
+            MPMLOGSTRING( "CMPMConnMonReqs::ErrorCallbackL: EScanWLANNetworksState failed" )
+
+            // Disable discarding availability notifications from Connection Monitor.
+            // 
+            iParent.DisableDiscarding(); 
+
+            // check which callback function to use and continue
+            // handling the request if possible.
+            // 
+            if( iWlanScanCallback == EWlanScanCallbackChooseIap )
+                {
+                iSession.IapSelectionL()->ChooseIapWLANScanCompletedL( aStatus );
+                }
+            else if( iWlanScanCallback == EWlanScanCallbackProcessErr )
+                {
+                iSession.ProcessErrorWlanScanCompletedL();
+                }
+            else if( iWlanScanCallback == EWlanScanCallbackCarrierRejected )
+                {
+                // No fresh IAP info available but try to select new IAP
+                // based on whatever existing info there is
+                // 
+                iSession.CompleteCarrierRejected();
+                }
+            else if( iWlanScanCallback == EWlanScanCallbackSortSnap )
+                {
+                // SortSnap was called with old availability information.
+                iSession.CompleteServerSortSNAP();
+                }
+            else
+                {
+                MPMLOGSTRING(
+                    "CMPMConnMonReqs::ErrorCallbackL: iWlanScanCallback EWlanScanCallbackNone" )
+                }
+            // reset callback type
+            //
+            iWlanScanCallback = EWlanScanCallbackNone;
+            break;
+            }
+        case EObsolete:
+            MPMLOGSTRING( "CMPMConnMonReqs::ErrorCallbackL: EObsolete" )
+            break;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMConnMonReqs::RunL
+// -----------------------------------------------------------------------------
+//
+void CMPMConnMonReqs::RunL()
+    {
+    MPMLOGSTRING( "CMPMConnMonReqs::RunL" )
+    if ( iStatus != KErrNone )
+        {
+        // Nok
+        MPMLOGSTRING2( "CMPMConnMonReqs::RunL: \
+ConnMon request completed with error code = %i", iStatus.Int() )
+
+        // Does nothing if state is obsolete.
+        ErrorCallbackL( iStatus.Int() );
+
+        // RemoveReqPtr is safe if "this" doesn't exist
+        iParent.RemoveReqPtr( this );
+        delete this;
+        }
+    else
+        {
+        // Ok
+        switch (iNextState)
+            {
+            case EGetIapAvailState:
+                {
+                MPMLOGSTRING( "CMPMConnMonReqs::RunL: EGetIapAvailState" )
+                iParent.SetAvailableIAPs( iIapBuf() );
+
+                if ( iActiveSchedulerWait.IsStarted() )
+                    {
+                    iActiveSchedulerWait.AsyncStop();
+                    }
+
+                iNextState      = EGetConnectionCountState;
+                iLastCancelCode = EConnMonGetConnectionCount;
+                iConnMon.GetConnectionCount( iConnectionCount, iStatus );
+                SetActive();
+                break;
+                }
+            case EGetConnectionCountState: 
+                {
+                MPMLOGSTRING( "CMPMConnMonReqs::RunL: EGetConnectionCountState" )
+                MPMLOGSTRING2( "CMPMConnMonReqs::RunL: Connection Count: %i", 
+                    iConnectionCount )
+                iParent.SetConnectionCounter( iConnectionCount );
+                iParent.RemoveReqPtr( this );
+                delete this;
+                break;
+                }
+            case EScanWLANNetworksState:
+            case EScanWLANNetworksStateCached:
+                {
+                MPMLOGSTRING( "CMPMConnMonReqs::RunL: EScanWLANNetworksState and EScanWLANNetworksStateCached" )
+                if ( iNextState == EScanWLANNetworksState )
+                    {
+                    MPMLOGSTRING( "CMPMConnMonReqs::RunL: EScanWLANNetworksState fresh data available from ConnMon" )
+                    iParent.SetAvailableIAPs( iIapBuf() );
+
+                    // Disable discarding availability notifications from Connection Monitor.
+                    // 
+                    iParent.DisableDiscarding(); 
+
+                    // Generate event only if we got new iaps from ConnMon.
+                    // 
+                    if ( iWlanScanCallback == EWlanScanCallbackGenerateEvent )
+                        {
+                        MPMLOGSTRING( "CMPMConnMonReqs::RunL: iWlanScanCallback EWlanScanCallbackGenerateEvent" )
+                        // Generate event only if not 
+                        //
+                        iParent.IapAvailabilityChange();
+                        }
+                    }
+                // check which callback function to use
+                // 
+                if( iWlanScanCallback == EWlanScanCallbackChooseIap )
+                    {
+                    iSession.IapSelectionL()->ChooseIapWLANScanCompletedL( iStatus.Int() );
+                    }
+                else if( iWlanScanCallback == EWlanScanCallbackProcessErr )
+                    {
+                    iSession.ProcessErrorWlanScanCompletedL();
+                    }
+                else if( iWlanScanCallback == EWlanScanCallbackCarrierRejected )
+                    {
+                    iSession.CompleteCarrierRejected();
+                    }
+                else if( iWlanScanCallback == EWlanScanCallbackSortSnap )
+                    {
+                    iSession.CompleteServerSortSNAP();
+                    }
+                else
+                    {
+                    MPMLOGSTRING(
+                    "CMPMConnMonReqs::RunL: iWlanScanCallback default processing" )
+                    }
+                // reset callback type
+                //
+                iWlanScanCallback = EWlanScanCallbackNone;
+                
+                iParent.RemoveReqPtr( this );
+                delete this;
+                break;
+                }
+            case EObsolete:
+                iParent.SetAvailableIAPs( iIapBuf() );
+                delete this;
+                break;
+            default:
+                {
+                MPMLOGSTRING( "CMPMConnMonReqs::RunL: default" )
+                PanicServer( KErrNotSupported );
+                break;
+                }
+            }
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMConnMonReqs::RunError
+// -----------------------------------------------------------------------------
+//
+
+TInt CMPMConnMonReqs::RunError( TInt aError )
+    {
+    MPMLOGSTRING2(
+        "CMPMConnMonReqs::RunError: RunL made a leave with error = %i", 
+        aError )
+
+    // Disable discarding availability notifications from Connection Monitor.
+    // 
+    iParent.DisableDiscarding(); 
+
+    // check which callback function was used when leave occurred
+    // 
+    if( iWlanScanCallback == EWlanScanCallbackChooseIap )
+        {
+        iSession.ChooseIapComplete( aError, NULL );
+        }
+    else if( iWlanScanCallback == EWlanScanCallbackProcessErr )
+        {
+        TBMNeededAction neededAction( EPropagateError );
+        iSession.ProcessErrorComplete( KErrNone, &aError, &neededAction );
+        }
+    else
+        {
+        MPMLOGSTRING(
+        "CMPMConnMonReqs::RunError: iWlanScanCallback EWlanScanCallbackNone" )
+        }
+
+    // We are done
+    iParent.RemoveReqPtr( this );
+    delete this;
+
+    // Return KErrNone to prevent panic 
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMConnMonReqs::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CMPMConnMonReqs::DoCancel()
+    {
+    MPMLOGSTRING( "CMPMConnMonReqs::DoCancel" )
+
+    // Disable discarding availability notifications from Connection Monitor.
+    // 
+    iParent.DisableDiscarding(); 
+
+    iConnMon.CancelAsyncRequest( iLastCancelCode );
+    
+    if ( iActiveSchedulerWait.IsStarted() )
+        {
+        iActiveSchedulerWait.AsyncStop();
+        }
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/src/mpmcsidwatcher.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,147 @@
+/*
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Listen connect screen id key changes in central repository.
+*
+*/
+
+#include <e32base.h>
+#include <centralrepository.h>
+#include <mpmconnectscreenid.h>
+#include <featmgr.h>                     // FeatureManager
+#include "mpmcsidwatcher.h"
+#include "mpmlogger.h"
+
+// ---------------------------------------------------------------------------
+// Default constructor
+// ---------------------------------------------------------------------------
+//
+CMpmCsIdWatcher::CMpmCsIdWatcher()
+    : CActive( EPriorityStandard )
+    {
+    CActiveScheduler::Add( this );    
+    }
+
+
+// ---------------------------------------------------------------------------
+// Creates central repositor object
+// ---------------------------------------------------------------------------
+//
+void CMpmCsIdWatcher::ConstructL()
+    {
+    iRepository = CRepository::NewL( KMpmOccCenRepUid );
+
+    // Check whether user connection is supported
+    FeatureManager::InitializeLibL();
+    iUserConnectionSupported = FeatureManager::FeatureSupported( 
+                                   KFeatureIdFfConnectionOverride );
+ 
+     FeatureManager::UnInitializeLib();
+    }
+
+
+// ---------------------------------------------------------------------------
+// Creates new object
+// ---------------------------------------------------------------------------
+//
+CMpmCsIdWatcher* CMpmCsIdWatcher::NewL()
+    {
+    CMpmCsIdWatcher* self = new( ELeave ) CMpmCsIdWatcher();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMpmCsIdWatcher::~CMpmCsIdWatcher()
+    {    
+    Cancel();
+    delete iRepository;
+    }
+
+// ---------------------------------------------------------------------------
+// Order notification from changes
+// ---------------------------------------------------------------------------
+//
+void CMpmCsIdWatcher::StartL()
+    {
+    // Request notification
+    User::LeaveIfError( iRepository->NotifyRequest( KMpmConnectScreenId,
+                        iStatus ));
+    SetActive();
+
+    // Get value from central repository
+    User::LeaveIfError(iRepository->Get(KMpmConnectScreenId, iConnectScreenId));
+    }
+
+// ---------------------------------------------------------------------------
+// Return connect screen id
+// ---------------------------------------------------------------------------
+//
+TUint32 CMpmCsIdWatcher::ConnectScreenId() const
+    {
+    if ( iUserConnectionSupported )
+        {
+        // Return real value if user connection is supported
+        return iConnectScreenId;
+        }
+    else
+        {
+        // Return 0xFFFFFFFF if user connection is not supported
+        return 0xFFFFFFFF;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From class CActive.
+// When there is a change in central repository key, event is received in here
+// ---------------------------------------------------------------------------
+//
+void CMpmCsIdWatcher::RunL()
+    {
+    // Leave if error
+    User::LeaveIfError( iStatus.Int() );
+
+    // Request new notification
+    User::LeaveIfError( iRepository->NotifyRequest( KMpmConnectScreenId,
+        iStatus ));
+    SetActive();
+    
+    // Get value from central repository
+    iRepository->Get( KMpmConnectScreenId, iConnectScreenId );
+    }
+
+// ---------------------------------------------------------------------------
+// From class CActive.
+// Nothing to do over here
+// ---------------------------------------------------------------------------
+//
+TInt CMpmCsIdWatcher::RunError( TInt /*aError*/ )
+    {
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// From class CActive.
+// Cancel outstanding request
+// ---------------------------------------------------------------------------
+//
+void CMpmCsIdWatcher::DoCancel()
+    {
+    iRepository->NotifyCancel( KMpmConnectScreenId );
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/src/mpmdefaultconnection.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,210 @@
+/*
+* 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: Handles defualt connection logic
+*
+*/
+
+#include <metadatabase.h>
+#include <datamobilitycommsdattypes.h>
+#include <cmdefconnvalues.h>
+#include "mpmdefaultconnection.h"
+#include "mpmserversession.h" //KShift8
+#include "mpmserver.h" 
+#include "mpmlogger.h"
+#include "mpmcommsdataccess.h"
+
+using namespace CommsDat;
+// ---------------------------------------------------------------------------
+// CMPMDefaultConnection::NewL
+// ---------------------------------------------------------------------------
+//
+CMPMDefaultConnection* CMPMDefaultConnection::NewL( const CMPMServer* aServer)
+    {
+    CMPMDefaultConnection * self = new (ELeave) 
+    CMPMDefaultConnection( aServer );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+    
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+CMPMDefaultConnection::~CMPMDefaultConnection()
+    {
+    }
+// ---------------------------------------------------------------------------
+// CMPMDefaultConnection::SetDefaultIAP
+// ---------------------------------------------------------------------------
+//
+TInt CMPMDefaultConnection::SetDefaultIAP( TInt aIapId )
+    {
+    TInt err( KErrNone );
+    //check validity
+    if( ( aIapId ) > 0 && ( aIapId <= KCDMaxRecords ) )
+        {
+        iDefaultIapId = aIapId;
+        MPMLOGSTRING2(
+            "CMPMDefaultConnection::SetDefaultIAP Set default connection iap: %d", 
+            aIapId)
+        }
+    else
+        {
+        err = KErrArgument;
+        MPMLOGSTRING2(
+            "CMPMDefaultConnection::SetDefaultIAP Invalid iap: %d", 
+            aIapId)
+        }    
+    return err;
+    }
+// ---------------------------------------------------------------------------
+// CMPMDefaultConnection::ClearDefaultIAP
+// ---------------------------------------------------------------------------
+//
+void CMPMDefaultConnection::ClearDefaultIAP()
+    {
+    iDefaultIapId = 0;
+    MPMLOGSTRING( "CMPMDefaultConnection::ClearDefaultIAP:\
+ cleared default iap" )
+    }
+// ---------------------------------------------------------------------------
+// CMPMDefaultConnection::GetDefaultConnectionL
+// ---------------------------------------------------------------------------
+//
+void CMPMDefaultConnection::GetDefaultConnectionL( TCmDefConnType& aMode, 
+                                                   TUint32& aConnection )
+    {
+    // first option is registered default iap
+    if( iDefaultIapId )
+        {
+        MPMLOGSTRING2( "CMPMDefaultConnection::GetDefaultConnectionL:\
+ default iap set as id %d", iDefaultIapId )
+        aMode = ECmDefConnConnectionMethod;
+        aConnection = iDefaultIapId;
+        }
+    else
+        {
+        MPMLOGSTRING( "CMPMDefaultConnection::GetDefaultConnectionL:\
+ getting value from commsdat" )
+
+        // read global commsdat setting     
+        //
+        TRAPD( err, ReadDefConnSettingL( aMode, aConnection ) )
+
+        if( err != KErrNone )
+            {
+            //use default values
+            //
+            aMode = KDefaultMode;
+            aConnection = KDefaultConnectionId;
+            }
+
+        MPMLOGSTRING3( "CMPMDefaultConnection::GetDefaultConnectionL: \
+found type %d, id %d", aMode, aConnection )                
+          
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CMPMDefaultConnection::CMPMDefaultConnection( const CMPMServer* aServer ) : 
+    iServer( aServer )
+    {
+    
+    }
+
+// ---------------------------------------------------------------------------
+// CMPMDefaultConnection::ConstructL
+// ---------------------------------------------------------------------------
+//    
+void CMPMDefaultConnection::ConstructL()
+    {
+    
+    }
+    
+// ---------------------------------------------------------------------------
+// CMPMDefaultConnection::IntToCmDefConnType
+// ---------------------------------------------------------------------------
+//
+TCmDefConnType CMPMDefaultConnection::IntToCmDefConnTypeL( const TUint& aInt )
+    {
+    TCmDefConnType type( TCmDefConnType ( 0 ) );
+
+    if( aInt == ECmDefConnDestination )
+        {
+        type = ECmDefConnDestination;
+        }
+    else if( aInt == ECmDefConnConnectionMethod )
+        {
+        type = ECmDefConnConnectionMethod;
+        }
+    else
+        {
+        MPMLOGSTRING2( "CMPMDefaultConnection::IntToCmDefConnType:\
+ incorrect value %d", aInt )
+        User::Leave( KErrArgument );
+        }
+    
+    return type;    
+    }
+
+// ---------------------------------------------------------------------------
+// CMPMDefaultConnection::ReadDefConnSetting
+// ---------------------------------------------------------------------------
+//
+void CMPMDefaultConnection::ReadDefConnSettingL( TCmDefConnType& aType,
+                                                 TUint32&        aId )
+    {
+    MPMLOGSTRING( "CMPMDefaultConnection::ReadDefConnSettingL " )
+    CMDBSession* db = CMDBSession::NewLC( CMDBSession::LatestVersion() ); 
+    TMDBElementId tableId = CCDDefConnRecord::TableIdL( *db );     
+
+    // fetch value from commsdat using record set to be able 
+    // to load any and all records in the table.
+    // we don't want to make assumptions on id
+    //
+    CMDBRecordSet<CMDBGenericRecord> * recordSet = new ( ELeave )
+    CMDBRecordSet<CMDBGenericRecord>( tableId );
+    CleanupStack::PushL( recordSet );
+    recordSet->LoadL( *db );
+    
+    CCDDefConnRecord* dconn = new (ELeave) CCDDefConnRecord( tableId );
+    CleanupStack::PushL( dconn );
+    if( recordSet->iRecords.Count() )
+        {
+        // load the first entry found
+        dconn->SetElementId( CMPMCommsDatAccess::GetRealElementId( recordSet->iRecords[0] ) );
+        dconn->LoadL( *db );
+        aType = IntToCmDefConnTypeL( dconn->iDefConnType );
+        aId = dconn->iDefConnUid;
+        }
+    else
+        {
+        // nothing found, use default value
+        // 
+        MPMLOGSTRING( "CMPMDefaultConnection::ReadDefConnSettingL \
+no entry found" )
+        aType = KDefaultMode;
+        aId = KDefaultConnectionId;
+        }
+    db->Close();
+    CleanupStack::PopAndDestroy( dconn );
+    CleanupStack::PopAndDestroy( recordSet );
+    CleanupStack::PopAndDestroy( db );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/src/mpmdefaultconnserver.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,91 @@
+/*
+* 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: Default connection server implementation
+*
+*/
+
+#include "mpmdefaultconnserver.h"
+#include "mpmdefaultconnserversession.h"
+#include "mpmlogger.h"
+#include "mpmserver.h"
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CMPMDefaultConnServer::CMPMDefaultConnServer( CMPMServer* aMPMServer )
+    : CPolicyServer( CPolicyServer::EPriorityStandard, KMPMPolicy ),
+    iMPMServer( aMPMServer )
+    {        
+    }
+
+
+// ---------------------------------------------------------------------------
+// CMPMDefaultConnServer::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CMPMDefaultConnServer::ConstructL()
+    {
+    MPMLOGSTRING( "MPMDefConnServer starting" )
+    StartL(KMPMDefaultConnectionServerName);
+    }
+
+
+// ---------------------------------------------------------------------------
+// CMPMDefaultConnServer::NewL
+// ---------------------------------------------------------------------------
+//
+CMPMDefaultConnServer* CMPMDefaultConnServer::NewL( CMPMServer* aMPMServer )
+    {
+    CMPMDefaultConnServer* self = new ( ELeave ) CMPMDefaultConnServer( aMPMServer );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPMDefaultConnServer::~CMPMDefaultConnServer()
+    {
+
+    }
+
+// ---------------------------------------------------------------------------
+// CMPMDefaultConnServer::MPMServer
+// ---------------------------------------------------------------------------
+//
+CMPMServer* CMPMDefaultConnServer::MPMServer()
+    {
+    return iMPMServer;
+    }
+
+// ---------------------------------------------------------------------------
+// CMPMDefaultConnServer::NewSessionL
+// From class CServer2.
+// ---------------------------------------------------------------------------
+//
+CSession2* CMPMDefaultConnServer::NewSessionL( const TVersion& /*aVersion*/,
+                                               const RMessage2& /*aMessage*/) const
+    {
+    //create session
+    return CMPMDefaultConnServerSession::NewL( 
+        const_cast<CMPMDefaultConnServer*> ( this ) );
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/src/mpmdefaultconnserversession.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,135 @@
+/*
+* 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: Session to MPM Default Connection server
+*
+*/
+
+#include <featmgr.h>
+
+#include "mpmdefaultconnserversession.h"
+#include "mpmdefaultconnserver.h"
+#include "mpmdefaultconnection.h"
+#include "mpmcommon.h"
+#include "mpmserver.h"
+#include "mpmlogger.h"
+
+// ---------------------------------------------------------------------------
+// CMPMDefaultConnServerSession::NewL
+// ---------------------------------------------------------------------------
+//
+CMPMDefaultConnServerSession* CMPMDefaultConnServerSession::NewL( 
+    CMPMDefaultConnServer* aServer )
+    {
+    MPMLOGSTRING( "CMPMDefaultConnServerSession::NewL" )
+    CMPMDefaultConnServerSession* self = new ( ELeave ) CMPMDefaultConnServerSession( aServer );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPMDefaultConnServerSession::~CMPMDefaultConnServerSession()
+    {
+    MPMLOGSTRING( "CMPMDefaultConnServerSession::~CMPMDefaultConnServerSession" )
+    DefaultConnServer()->MPMServer()->DefaultConnection()->ClearDefaultIAP();
+    }
+
+// ---------------------------------------------------------------------------
+// CMPMDefaultConnServerSession::DefaultConnServer
+// ---------------------------------------------------------------------------
+//
+CMPMDefaultConnServer* CMPMDefaultConnServerSession::DefaultConnServer()
+    {
+    MPMLOGSTRING( "CMPMDefaultConnServerSession::DefaultConnServer" )
+    return iDefaultConnServer; 
+    }
+
+// ---------------------------------------------------------------------------
+// CMPMDefaultConnServerSession::ServiceL
+// ---------------------------------------------------------------------------
+//
+void CMPMDefaultConnServerSession::ServiceL( const RMessage2& aMessage )
+    {
+    MPMLOGSTRING2( "CMPMDefaultConnServerSession::ServiceL %d ", 
+                   aMessage.Function() )
+    switch ( aMessage.Function() )
+        {
+        case EMPMDefaultConnectionSetDefaultIap:
+            {
+            SetDefaultIAP( aMessage );
+            break;
+            }
+        case EMPMDefaultConnectionClearDefaultIap:
+            {
+            ClearDefaultIAP( aMessage);
+            break;
+            }
+        default:
+            {
+            aMessage.Complete( KErrNotSupported );
+			MPMLOGSTRING( 
+			    "CMPMDefaultConnServerSession::ServiceL: Unsupported message type" )
+            }                   
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CMPMDefaultConnServerSession::CMPMDefaultConnServerSession( 
+CMPMDefaultConnServer* aServer )
+    : CSession2(), 
+      iDefaultConnServer( aServer ) 
+    {
+    MPMLOGSTRING( "CMPMDefaultConnServerSession::CMPMDefaultConnServerSession" )
+    }
+
+// ---------------------------------------------------------------------------
+// CMPMDefaultConnServerSession::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CMPMDefaultConnServerSession::ConstructL()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CMPMDefaultConnServerSession::SetDefaultIAP
+// Store IAP to be used as default connection in MPM Server
+// ---------------------------------------------------------------------------
+//
+void CMPMDefaultConnServerSession::SetDefaultIAP( const RMessage2& aMessage )
+    {
+    MPMLOGSTRING( "CMPMDefaultConnServerSession::SetDefaultIAP" )
+    TInt iap( 0 ), err( KErrNone );
+    iap = aMessage.Int0();
+    err = DefaultConnServer()->MPMServer()->DefaultConnection()->SetDefaultIAP( iap );
+    aMessage.Complete( err );
+    }
+
+// ---------------------------------------------------------------------------
+// CMPMDefaultConnServerSession::ClearDefaultIAP
+// Clear IAP from being used as default connection in MPM Server
+// ---------------------------------------------------------------------------
+//
+void CMPMDefaultConnServerSession::ClearDefaultIAP( const RMessage2& aMessage )
+    {
+    MPMLOGSTRING( "CMPMDefaultConnServerSession::ClearDefaultIAP" )
+    DefaultConnServer()->MPMServer()->DefaultConnection()->ClearDefaultIAP();
+    aMessage.Complete( KErrNone );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/src/mpmdialog.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,374 @@
+/*
+* Copyright (c) 2004-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: MPM user dialog handling
+*
+*/
+
+/**
+@file mpmdialog.cpp
+Mobility Policy Manager user dialog initiation.
+*/
+
+// INCLUDE FILES
+#include <connpref.h> // for TConnPref
+#include <gsmerror.h>
+#include <metadatabase.h>
+#include <datamobilitycommsdattypes.h>
+#include <commdb.h>
+#include <bldvariant.hrh>   // For feature flags
+#include <e32property.h>    //publish and subscribe
+
+#include "mpmdialog.h"
+#include "mpmlogger.h"
+#include "mpmdefaultconnection.h"
+#include "rmpm.h"
+#include "mpmcommsdataccess.h"
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CMPMDialog::NewL
+// -----------------------------------------------------------------------------
+//
+CMPMDialog* CMPMDialog::NewL( CMPMIapSelection&             aIapSelection,
+                              const RAvailableIAPList&      aIAPList,
+                              TUint32                       aBearerSet,
+                              CArrayPtrFlat<CMPMDialog>&    aQueue,
+                              CMPMServer&                   aServer )
+    {
+    CMPMDialog* self = new ( ELeave ) CMPMDialog( aIapSelection, 
+                                                  aBearerSet,
+                                                  aQueue,
+                                                  aServer );
+    CleanupStack::PushL( self );
+    self->ConstructL( aIAPList );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMDialog::CMPMDialog
+// -----------------------------------------------------------------------------
+//
+CMPMDialog::CMPMDialog( CMPMIapSelection&           aIapSelection,
+                        TUint32                     aBearerSet,
+                        CArrayPtrFlat<CMPMDialog>&  aQueue,
+                        CMPMServer&                 aServer )
+    :   CMPMDialogBase( *(CArrayPtrFlat<CMPMDialogBase>*)&aQueue ),
+        iIapSelection( aIapSelection ), 
+        iSnapOrIAPId( 0 ),
+        iBearerSet( aBearerSet ),
+        iServer ( aServer )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMDialog::~CMPMDialog
+// -----------------------------------------------------------------------------
+//
+CMPMDialog::~CMPMDialog()
+    {
+    Cancel();
+    MPMLOGSTRING2( "CMPMDialog::~CMPMDialog: deleted, Completing with code = %i", 
+                       iStatus.Int() )
+    iDlgServ.Close();
+    // Clean up all other stuff
+    iIAPList.Close();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMDialog::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CMPMDialog::ConstructL( const RAvailableIAPList& aIAPList )
+    {
+    User::LeaveIfError( CopyArray( aIAPList, iIAPList ) );
+    CMPMDialogBase::ConstructL();
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMDialog::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CMPMDialog::Start( CMPMDialogBase* /*aDlg*/ )
+    {
+    InitSelectConnection();
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMDialog::IntSelectConnection
+// -----------------------------------------------------------------------------
+//
+void CMPMDialog::InitSelectConnection()
+    {
+    TInt err = iDlgServ.Connect();
+    // Try to publish sort snap data
+    //
+    if ( err == KErrNone )
+        {
+        TRAP( err, PublishSortSnapInfoL() )
+        }
+    if ( err != KErrNone )
+        {
+        // Jump to RunL()
+        TRequestStatus* status = &iStatus;
+        User::RequestComplete( status, err );
+        SetActive();
+        return;
+        }
+
+    // Map bearer set. bearerSet variable is a combination of values
+    // mapped to TCommDbBearer while iBearerSet is a combination of
+    // TExtendedConnPref::TExtendedConnBearer values.
+
+    TUint32 bearerSet( ECommDbBearerVirtual );
+    if ( iBearerSet == TExtendedConnPref::EExtendedConnBearerUnknown )
+        {
+        bearerSet |= ECommDbBearerCSD | ECommDbBearerWcdma |
+                     ECommDbBearerWLAN;
+        }
+    else
+        {
+        if ( iBearerSet & TExtendedConnPref::EExtendedConnBearerWLAN )
+            {
+            bearerSet |= ECommDbBearerWLAN;
+            }
+        if ( iBearerSet & TExtendedConnPref::EExtendedConnBearerCellular )
+            {
+            bearerSet |= ECommDbBearerWcdma;
+            }
+        }
+
+    // API definition was provided by Symbian, but we don't really need 
+    // these parameters with AccessPointConnection. 
+    // 
+    TUint32 unusedVariable( 0 );
+
+    /*  AccessPointConnection API implements also the ChangeConnection in 
+     *  the ALR "world", you should also be careful of the input value of 
+     *  iSnapOrIAPId, because the Destination with the input ElementID is 
+     *  considered the "current Destination in use", so it will not be 
+     *  listed by the notifier. So if you really want to see the ALR 
+     *  version of AccessPointConnection, in input iSnapOrIAPId MUST be  
+     *  an invalid ElementID (e.g. 0), to be sure that no Destinations 
+     *  will be removed from the list. 
+     */
+    iDlgServ.AccessPointConnection( unusedVariable,
+                                    unusedVariable,
+                                    iSnapOrIAPId,
+                                    bearerSet,
+                                    iStatus );
+
+    SetActive();
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMDialog::PublishSortSnapInfoL
+// -----------------------------------------------------------------------------
+//
+void CMPMDialog::PublishSortSnapInfoL()
+    {
+    // allow PublishSortSnapInfoL to run only 
+    // if the dialog is the first one in the queue.
+    // => First one is active one.
+    if ( !IsFirst() )
+        {
+        return;
+        }
+        
+    MPMLOGSTRING( "CMPMDialog::PublishSortSnapInfoL" )
+    RArray<TUint> snaps;
+    CleanupClosePushL( snaps );
+    
+    // set first snap to 0 as ungathegorised
+    //
+    snaps.AppendL( KSortUncategorisedIaps );
+    
+    // Find Snap ids
+    //
+    iServer.CommsDatAccess()->FindAllSnapsL( snaps );
+    
+    // Write iaps for each snap, also 0 is 
+    // included for uncategorised
+    //
+    TMpmSnapPubSubFormat snapData;
+    TInt i( 0 ), err( KErrNone );
+    for(; ( i < snaps.Count() ) && 
+          ( i < KMPMSortSnapMaxKey ); i++ )
+        {
+        snapData.iSnap = snaps[ i ];
+        snapData.iSortedIaps.Reset();
+        // Get sorted iaps
+        //
+        iIapSelection.Session()->SortSnapL( snaps[ i ], snapData.iSortedIaps );
+        
+        // Define pub&sub key if not already defined
+        //
+        err = RProperty::Define( KMPMSortSnapCategory, 
+                                 i,
+                                 KMPMSortSnapType,
+                                 KMPMSortSnapReadPolicy,
+                                 KMPMSortSnapWritePolicy );
+        
+        if ( err != KErrAlreadyExists &&
+             err != KErrNone )
+            {
+            MPMLOGSTRING2( "CMPMDialog::PublishSortSnapInfoL: error in define: %d ", err )
+            }
+        
+        TPtrC8 dataPtr( reinterpret_cast< TUint8* >( &snapData  ), sizeof( snapData ) );
+
+        err = RProperty::Set( KMPMSortSnapCategory, 
+                              i, 
+                              dataPtr );
+        if ( err != KErrNone )
+            {
+            MPMLOGSTRING2( "CMPMDialog::PublishSortSnapInfoL: error in set: %d ", err )
+            }    
+        MPMLOGSTRING3( "CMPMDialog::PublishSortSnapInfoL: snap %d iap count %d",
+                       snapData.iSnap, snapData.iSortedIaps.Count() )
+        }
+
+    // set rest of the keys to undefined
+    // 
+    while( i < KMPMSortSnapMaxKey )
+        {
+        err = RProperty::Delete( KMPMSortSnapCategory, i );
+        if ( err != KErrNotFound &&
+             err != KErrNone )
+            {
+            MPMLOGSTRING2( "CMPMDialog::PublishSortSnapInfoL: error in delete: %d ", err )
+            }
+        i++;
+        }
+    CleanupStack::PopAndDestroy( &snaps );    
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMDialog::RunL
+// -----------------------------------------------------------------------------
+//
+void CMPMDialog::RunL()
+    {
+    MPMLOGSTRING2( "CMPMDialog::RunL: status = %i", 
+        iStatus.Int() )
+        
+    TMDBElementId tableId = iSnapOrIAPId & KCDMaskShowRecordType; 
+    TBool isIap( EFalse );
+    if ( tableId == KCDTIdIAPRecord )
+        {
+        isIap = ETrue;
+        }
+    
+    // Clean data from publish & subscribe
+    //
+    CleanSortSnapInfo();
+        
+    TUint32 id = ( iSnapOrIAPId & KCDMaskShowRecordId ) >> KShift8;
+    iIapSelection.HandleUserSelectionL( isIap, id, iStatus.Int() );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMDialog::RunError
+// -----------------------------------------------------------------------------
+//
+TInt CMPMDialog::RunError(TInt aError)
+    {
+    // Handles a leave occurring in the request completion event handler 
+    // RunL(). The active scheduler calls this function if this active 
+    // object's RunL() function leaves. This gives this active object 
+    // the opportunity to perform any necessary cleanup.
+    // 
+    MPMLOGSTRING2( "CMPMDialog::RunError: RunL left with error = %i", aError )
+    iIapSelection.HandleUserSelectionError( aError );
+
+    // Clean data from publish & subscribe
+    //
+    CleanSortSnapInfo();
+
+    // Return KErrNone to prevent panic 
+    // 
+    return KErrNone;
+    }
+    
+    
+// -----------------------------------------------------------------------------
+// CMPMDialog::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CMPMDialog::DoCancel()
+    {
+    iDlgServ.CancelAccessPointConnection();
+    // Clean data from publish & subscribe
+    //
+    CleanSortSnapInfo();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMDialog::CopyArray
+// -----------------------------------------------------------------------------
+//
+TInt CMPMDialog::CopyArray( const RAvailableIAPList& aOrigin, 
+                            RAvailableIAPList&       aCopy )
+	{
+	TInt err( KErrNone );
+
+    // Clean array first
+    // 
+	aCopy.Reset(); 
+
+	for( TInt i( 0 ); ( i < aOrigin.Count() ) && ( err == KErrNone ); ++i )
+		{
+		err = aCopy.Append( aOrigin[i] );
+		if ( err != KErrNone )
+			{
+			// Cleanup and return
+			// 
+            MPMLOGSTRING2( "CMPMDialog::CopyArray: Append error = %i", err )
+			aCopy.Reset();
+			}
+		}
+
+	return err;
+	} 
+
+// -----------------------------------------------------------------------------
+// CMPMDialog::CleanSortSnapInfoL
+// -----------------------------------------------------------------------------
+//
+void CMPMDialog::CleanSortSnapInfo()
+    {
+    MPMLOGSTRING( "CMPMDialog::CleanSortSnapInfoL" )
+
+    // Clean info from all keys
+    //
+    for( TInt i(0); i < KMPMSortSnapMaxKey; i++ )
+        {
+        TInt err = RProperty::Delete( KMPMSortSnapCategory, i );
+        if ( err != KErrNotFound &&
+             err != KErrNone )
+            {
+            MPMLOGSTRING2( "CMPMDialog::CleanSortSnapInfoL: error in delete: %d ", err )
+            }
+        }
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/src/mpmdialogbase.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,117 @@
+/*
+* Copyright (c) 2008 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: MPM user dialog handling
+*
+*/
+
+/**
+@file mpmdialogbase.cpp
+Mobility Policy Manager user dialog initiation.
+*/
+
+// INCLUDE FILES
+#include "mpmdialogbase.h"
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CMPMDialogBase::CMPMDialogBase
+// -----------------------------------------------------------------------------
+//
+CMPMDialogBase::CMPMDialogBase( CArrayPtrFlat<CMPMDialogBase>& aQueue )
+    :   CActive( CActive::EPriorityStandard ),
+        iQueue( aQueue )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMDialog::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CMPMDialogBase::ConstructL()
+    {
+    // Start dialog immediately if the first one and otherwise
+    // just append this dialog into the queue
+    if ( iQueue.Count() == 0 ) 
+        {
+        MPMLOGSTRING2( "CMPMDialogBase<0x%x>::ConstructL() Display Dialog immediately", this )
+        iQueue.AppendL( this );
+        Start();
+        }
+    else
+        {
+        MPMLOGSTRING2( "CMPMDialog<0x%x>::ConstructL() Append Dialog to queue", this )
+        iQueue.AppendL( this );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMDialog::~CMPMDialog
+// -----------------------------------------------------------------------------
+//
+CMPMDialogBase::~CMPMDialogBase()
+    {
+    // Cancel everything first if we were running.
+    //
+    if ( iQueue.Count() > 0 && iQueue.At( 0 ) == this )
+        {
+        Cancel();
+        MPMLOGSTRING2( "CMPMDialogBase::~CMPMDialogBase: deleted, Completing with code = %i", 
+                       iStatus.Int() )
+        // Remove this from the queue
+        iQueue.Delete( 0 );
+        // And if there are still pending dialogs, start the first one.
+        if ( iQueue.Count() > 0 )
+            {
+            // Give pointer to this dialog in case
+            // the starting dialog can utilize the
+            // result from this dialog.
+            iQueue.At(0)->Start( this );
+            }
+        }
+    // We're not the first one. We can just delete ourselves.
+    //
+    else 
+        {
+        for ( TInt i = 0; i < iQueue.Count(); i++ )
+            {
+            if ( iQueue.At( i ) == this )
+                {
+                iQueue.Delete( i );
+                break;
+                }
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMDialog::IsFirst
+// -----------------------------------------------------------------------------
+//
+TBool CMPMDialogBase::IsFirst()
+    {
+    if ( iQueue.Count() == 0 )
+        {
+        return EFalse;
+        }
+    else
+        {
+        return iQueue.At( 0 ) == this;
+        }
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/src/mpmdisconnectdlg.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,282 @@
+/*
+* Copyright (c) 2005-2008 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: MPM disconnect dialog handling
+*
+*/
+
+/**
+@file mpmdisconnectdlg.cpp
+Mobility Policy Manager disconnect dialog initiation.
+*/
+
+// INCLUDE FILES
+#include "mpmdisconnectdlg.h"
+#include "mpmconnmonevents.h"
+#include "mpmlogger.h"
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CMPMDisconnectDlg::NewL
+// -----------------------------------------------------------------------------
+//
+CMPMDisconnectDlg* CMPMDisconnectDlg::NewL(
+    CMPMServerSession&                aSession,
+    TInt                              aOrigError,
+    CArrayPtrFlat<CMPMDisconnectDlg>& aDisconnectQueue )
+    {
+    CMPMDisconnectDlg* self = new (ELeave) CMPMDisconnectDlg( aSession,
+                                                              aOrigError,
+                                                              aDisconnectQueue );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMDisconnectDlg::CMPMDisconnectDlg
+// -----------------------------------------------------------------------------
+//
+CMPMDisconnectDlg::CMPMDisconnectDlg(
+    CMPMServerSession&                aSession,
+    TInt                              aOrigError,
+    CArrayPtrFlat<CMPMDisconnectDlg>& aDisconnectQueue )
+    :   CMPMDialogBase( *(CArrayPtrFlat<CMPMDialogBase>*)&aDisconnectQueue ), 
+        iSession( aSession ),
+        iOrigError( aOrigError )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMDisconnectDlg::~CMPMDisconnectDlg
+// -----------------------------------------------------------------------------
+//
+CMPMDisconnectDlg::~CMPMDisconnectDlg()
+    {
+    MPMLOGSTRING( "CMPMDisconnectDlg::~CMPMDisconnectDlg" )
+    Cancel();
+    iDlgServ.Close();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMDisconnectDlg::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CMPMDisconnectDlg::ConstructL()
+    {
+    User::LeaveIfError( iDlgServ.Connect() );
+    CMPMDialogBase::ConstructL();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMDisconnectDlg::RunL
+// -----------------------------------------------------------------------------
+//
+void CMPMDisconnectDlg::RunL()
+    {
+    MPMLOGSTRING2( "CMPMDisconnectDlg::RunL status %d", iStatus.Int() )
+
+    TInt error = iStatus.Int();
+    if ( error == KErrNone )
+        {
+        UserSelectedOk( iStatus.Int() );
+        }
+    else
+        {
+        UserSelectedCancel( iStatus.Int() );
+        }
+    // Store selection
+    iUserStatus = iStatus.Int();
+    iUserIap = iIapId;
+    }
+
+    
+// -----------------------------------------------------------------------------
+// CMPMDisconnectDlg::UserSelectedOk
+// -----------------------------------------------------------------------------
+//
+void CMPMDisconnectDlg::UserSelectedOk( TInt aError )
+    {
+    MPMLOGSTRING( "CMPMDisconnectDlg::UserSelectedOk: \
+Tell BM to ignore error and do reselection" )
+
+    TBMNeededAction neededAction( EDoReselection );
+    TInt error = aError;
+
+    iSession.ProcessErrorComplete( KErrNone,
+                                   &error,
+                                   &neededAction );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMDisconnectDlg::UserSelectedCancel
+// -----------------------------------------------------------------------------
+//
+void CMPMDisconnectDlg::UserSelectedCancel( TInt aError )
+    {
+    // User has selected Cancel
+    // 
+    // Read the Connection Id of the application
+    // 
+    TConnectionId connId = iSession.ConnectionId();
+
+    TBMNeededAction neededAction( EDoReselection );
+
+    TInt error = aError;
+    TInt* errorPtr( NULL );
+    
+    if ( error == KErrNotFound )
+        {
+        MPMLOGSTRING2( "CMPMDisconnectDlg::UserSelectedCancelL: \
+Use original error code %i", iOrigError )
+
+        error = iOrigError;
+        }
+
+    // Get the state of the connection for this Iap Id.
+    // 
+    TConnectionState state;
+    iSession.MyServer().GetConnectionState( connId, state );
+
+    if ( state == EStarting )
+        {
+        MPMLOGSTRING2( "CMPMDisconnectDlg::UserSelectedCancelL: \
+Tell BM to end the client connection with error code %i", error )
+
+        neededAction = EPropagateError;
+        errorPtr = &error;
+        }
+    else if ( state == ERoaming )
+        {
+        // New notification will be attempted with latest
+        // available IAPs
+        //
+        iSession.StoredIapInfo().ResetStoredIapInfo();
+        neededAction = EIgnoreError;
+
+        // Get the current connection IapId for this connId 
+        //
+        TUint32 currentIap = iSession.MyServer().GetBMIap( connId );
+
+        TConnMonIapInfo availableIAPs;
+        availableIAPs = iSession.GetAvailableIAPs();
+
+        iSession.MyServer().HandleServerBlackListIap( connId, 
+                                                      currentIap, 
+                                                      ETemporary );
+        TRAP( error, iSession.PrefIAPNotificationL( availableIAPs, 
+                                                    EBearerMan ) );
+        if ( error == KErrNotFound )
+            {
+            neededAction = EPropagateError;
+
+            errorPtr = &error;
+            TRAP_IGNORE( iSession.MobilityErrorNotificationL( KErrNotFound ) )
+            MPMLOGSTRING2(
+                "CMPMDisconnectDlg::UserSelectedCancelL: \
+Tell BM to end the client connection with error code %i", error )
+            }
+        else
+            {
+            MPMLOGSTRING(
+                "CMPMDisconnectDlg::UserSelectedCancelL: \
+Tell BM to ignore error and let MPM notify application about preferred IAP" )
+            }
+        }
+    else
+        {
+        MPMLOGSTRING2( "CMPMDisconnectDlg::UserSelectedCancelL: \
+Unsupported state %d", state )
+        }
+
+    iSession.ProcessErrorComplete( KErrNone,
+                                   errorPtr,
+                                   &neededAction );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMDisconnectDlg::RunError
+// -----------------------------------------------------------------------------
+//
+TInt CMPMDisconnectDlg::RunError(TInt aError)
+    {
+    // Handles a leave occurring in the request completion event handler 
+    // RunL(). The active scheduler calls this function if this active 
+    // object's RunL() function leaves. This gives this active object 
+    // the opportunity to perform any necessary cleanup.
+    // 
+    MPMLOGSTRING2(
+        "CMPMDisconnectDlg::RunError: RunL made a leave with error = %i", 
+        aError )
+
+    iSession.ProcessErrorComplete( aError, NULL, NULL );
+
+    // Return KErrNone to prevent panic 
+    // 
+    return KErrNone;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMDisconnectDlg::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CMPMDisconnectDlg::DoCancel()
+    {
+    MPMLOGSTRING( "CMPMDisconnectDlg::DoCancel" )
+    iDlgServ.CancelDisconnectDlg();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMDisconnectDlg::Start
+// -----------------------------------------------------------------------------
+//
+void CMPMDisconnectDlg::Start( CMPMDialogBase* aDlg )
+    {
+    // If there are no outstanding CMPMDisconnectDlg, then 
+    // start CMPMDisconnectDlg immediately.
+    //
+    if ( aDlg )
+        {
+        CMPMDisconnectDlg* dlg = (CMPMDisconnectDlg*) aDlg;
+        iUserStatus = dlg->iUserStatus;
+        iUserIap = dlg->iUserIap;
+        }
+    if ( iUserStatus == KErrNone && iUserIap != 0 )
+        {
+        UserSelectedOk( iUserStatus );
+        }
+    else if ( iUserStatus != KErrNone )
+        {
+        UserSelectedCancel( iUserStatus );
+        }
+    else
+        {
+        iDlgServ.DisconnectDlg( iStatus, iIapId, ETrue );
+        SetActive();
+        }
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/src/mpmdtmwatcher.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,203 @@
+/*
+* 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: MPM Dual Transfer Mode watcher
+*
+*/
+
+/**
+@file mpmdtmwatcher.cpp
+Mobility Policy Manager Dual Transfer Mode watcher.
+*/
+
+// INCLUDE FILES
+#include "mpmdtmwatcher.h"
+#include "mpmserver.h"
+#include "mpmlogger.h"
+#include <pcktcs.h> // This header has to be the last in the include file list 
+                    // in order to avoid this error: 
+                    // \EPOC32\include\pcktcs.h:26: undefined identifier 'TLitC'
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CMPMDtmWatcher::NewL
+// -----------------------------------------------------------------------------
+//
+CMPMDtmWatcher* CMPMDtmWatcher::NewL( RPacketService&   aPacketService )
+    {
+    CMPMDtmWatcher* self = new( ELeave ) CMPMDtmWatcher( aPacketService );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMDtmWatcher::CMPMDtmWatcher
+// -----------------------------------------------------------------------------
+//
+CMPMDtmWatcher::CMPMDtmWatcher( RPacketService& aPacketService )
+    : CActive( CActive::EPriorityStandard ),
+      iPacketService( aPacketService ),
+      iMsClass( RPacketService::EMSClassUnknown ),
+      iMaxMsClass( RPacketService::EMSClassUnknown )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMDtmWatcher::~CMPMDtmWatcher
+// -----------------------------------------------------------------------------
+//
+CMPMDtmWatcher::~CMPMDtmWatcher()
+    {
+    MPMLOGSTRING( "CMPMDtmWatcher::~CMPMDtmWatcher" )
+    Cancel();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMDtmWatcher::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CMPMDtmWatcher::ConstructL()
+    {
+    MPMLOGSTRING( "CMPMDtmWatcher::ConstructL" )
+
+    // Request current MS class from ETel
+    //
+    TRequestStatus status;
+    MPMLOGSTRING( "CMPMDtmWatcher::ConstructL GetMSClass" )
+    iPacketService.GetMSClass( status, iMsClass, iMaxMsClass );
+    MPMLOGSTRING( "CMPMDtmWatcher::ConstructL WaitForRequest" )
+    // This information is needed before the server is started.
+    // 
+    User::WaitForRequest( status );
+    MPMLOGSTRING2( "CMPMDtmWatcher::ConstructL LeaveIfError: %d", status.Int() )
+    User::LeaveIfError( status.Int() );
+
+    LogPacketClass();
+
+    // Request notification from ETel about MS class change
+    iPacketService.NotifyMSClassChange( iStatus, iMsClass );
+    SetActive();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMDtmWatcher::IsInDualMode
+// -----------------------------------------------------------------------------
+//
+TBool CMPMDtmWatcher::IsInDualMode() const
+    {
+    MPMLOGSTRING( "CMPMDtmWatcher::IsInDualMode" )
+
+    LogPacketClass();
+
+    return ( iMsClass == RPacketService::EMSClassDualMode );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMDtmWatcher::RunL
+// -----------------------------------------------------------------------------
+//
+void CMPMDtmWatcher::RunL()
+    {
+    MPMLOGSTRING( "CMPMDtmWatcher::RunL" )
+
+    LogPacketClass();
+
+    // Request notification from ETel about MS class change
+    iPacketService.NotifyMSClassChange( iStatus, iMsClass );
+    SetActive();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMDtmWatcher::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CMPMDtmWatcher::DoCancel()
+    {
+    MPMLOGSTRING( "CMPMDtmWatcher::DoCancel" )
+
+    iPacketService.CancelAsyncRequest( EPacketNotifyMSClassChange );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMDtmWatcher::LogPacketClass
+// -----------------------------------------------------------------------------
+//    
+void CMPMDtmWatcher::LogPacketClass() const
+    {
+#ifdef _DEBUG
+    switch ( iMsClass )
+        {
+        // Active simultaneous PS and CS calls supported (Class A)
+        case RPacketService::EMSClassDualMode:
+            {
+            MPMLOGSTRING( "CMPMDtmWatcher::LogPacketClass EMSClassDualMode" )
+            break;
+            }
+        // Active CS and Suspended PS simultaneous calls supported (Class B)
+        case RPacketService::EMSClassSuspensionRequired:
+            {
+            MPMLOGSTRING(
+                "CMPMDtmWatcher::LogPacketClass EMSClassSuspensionRequired" )
+            break;
+            }
+        // Active CS or Active PS only call supported (Class C)
+        case RPacketService::EMSClassAlternateMode:
+            {
+            MPMLOGSTRING(
+                "CMPMDtmWatcher::LogPacketClass EMSClassAlternateMode" )
+            break;
+            }
+        // Active CS only call supported (Class C)
+        case RPacketService::EMSClassCircuitSwitchedOnly:
+            {
+            MPMLOGSTRING(
+                "CMPMDtmWatcher::LogPacketClass EMSClassCircuitSwitchedOnly" )
+            break;
+            }
+        // Active PS only call supported (Class C)
+        case RPacketService::EMSClassPacketSwitchedOnly:
+            {
+            MPMLOGSTRING(
+                "CMPMDtmWatcher::LogPacketClass EMSClassPacketSwitchedOnly" )
+            break;
+            }
+        // Unknown what configuration is supported
+        case RPacketService::EMSClassUnknown:
+            {
+            MPMLOGSTRING( "CMPMDtmWatcher::LogPacketClass EMSClassUnknown" )
+            break;
+            }
+        default:
+            {
+            MPMLOGSTRING(
+                "CMPMDtmWatcher::LogPacketClass Packet class unspecified" )
+            break;
+            }
+        }
+#endif // _DEBUG
+
+    return;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/src/mpmiapselection.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,1401 @@
+/*
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Handles selecting Iap for connection
+*
+*/
+
+#include "mpmiapselection.h"
+#include "mpmlogger.h"
+#include "mpmdialog.h"
+#include "mpmserversession.h"
+#include "mpmcommsdataccess.h"
+#include "mpmconnmonevents.h"
+#include "mpmconfirmdlgstarting.h"
+#include "mpmdefaultconnection.h"
+#include "mpmwlanquerydialog.h"
+#include "extendedconnpref.h"
+
+// ---------------------------------------------------------------------------
+// CMPMIapSelection::CMPMIapSelection
+// ---------------------------------------------------------------------------
+//
+CMPMIapSelection::CMPMIapSelection( CMPMCommsDatAccess*  aCommsDatAccess,
+                                    CMPMServerSession*   aSession )
+    : iChooseIapState( ENoConnection ),
+      iCommsDatAccess( aCommsDatAccess ),
+      iStoredIapInfo(),
+      iSession( aSession ),
+      iConfirmDlgStarting( NULL ),
+      iDialog( NULL ),
+      iWlanDialog( NULL ),
+      iNextBestExists( EFalse ),
+      iUserSelectionIapId( 0 ),
+      iUserSelectionSnapId( 0 ),
+      iImplicitState( EImplicitStart ),
+      iOfflineNoteResponse( EOfflineResponseUndefined ),
+      iIsRoaming( EFalse ),
+      iNewWlansAllowed ( EFalse )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CMPMIapSelection::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CMPMIapSelection::ConstructL()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CMPMIapSelection::NewL
+// ---------------------------------------------------------------------------
+//
+CMPMIapSelection* CMPMIapSelection::NewL( CMPMCommsDatAccess*  aCommsDatAccess,
+                                          CMPMServerSession*   aSession )
+    {
+    CMPMIapSelection* self = new ( ELeave ) CMPMIapSelection( aCommsDatAccess,
+                                                              aSession );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CMPMIapSelection::~CMPMIapSelection
+// ---------------------------------------------------------------------------
+//
+CMPMIapSelection::~CMPMIapSelection()
+    {
+    // stop confirm dialog in case one exists
+    //
+    StopDisplayingStartingDlg();
+    
+    // Cancel WLAN availability check in case it is active
+    //
+    if ( iSession )
+        {
+    	  iSession->MyServer().Events()->CancelCheckWlanWlanAvailability( this );	
+        }	
+    
+    delete iConfirmDlgStarting;
+    delete iDialog;
+    delete iWlanDialog;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMIapSelection::ChooseIapL
+// -----------------------------------------------------------------------------
+//
+void CMPMIapSelection::ChooseIapL( const TMpmConnPref& aChooseIapPref )
+    {
+#ifdef _DEBUG
+    // Dump CommsDat IAPs to log in order to support testing
+    // 
+    iCommsDatAccess->DumpIAPsL();
+    TRAPD( err, iCommsDatAccess->DumpSnapsL() );
+    if ( err != KErrNone )
+        {
+        MPMLOGSTRING2(
+            "CMPMIapSelection::ChooseIapL: DumpSnapsL fail %d",
+            err )
+        }
+#endif // _DEBUG
+    
+    iChooseIapPref = aChooseIapPref;
+
+    if ( iSession->IsWlanOnlyL( iNewWlansAllowed ) )
+        {
+        if ( iChooseIapPref.BearerSet() ==
+             TExtendedConnPref::EExtendedConnBearerUnknown )
+            {
+            // Force bearerset to WLAN if received bearerset was empty
+            iChooseIapPref.SetBearerSet(
+                TExtendedConnPref::EExtendedConnBearerWLAN );
+            }
+        else if ( iChooseIapPref.BearerSet() &
+                  TExtendedConnPref::EExtendedConnBearerWLAN )
+            {
+            // Force bearerset to WLAN only in case where wlan was included
+            // in the received bearerset.
+            iChooseIapPref.SetBearerSet(
+                TExtendedConnPref::EExtendedConnBearerWLAN );          
+            }
+        else
+            {
+            // If wlan was not included in received bearerset,
+            // complete selection with error code
+            ChooseIapComplete( KErrPermissionDenied,
+                               iSession->MyServer().UserConnPref() );
+            return; 
+            }
+        }
+    
+    // Always use stored connection info.
+    // If stored information doesn't exist, a normal sequence is used.
+    TUint32 snap( 0 );
+    TUint32 iap ( 0 );
+    
+    snap = iSession->MyServer().GetBMSnap( iSession->ConnectionId() );
+    iap = iSession->MyServer().GetBMIap( iSession->ConnectionId() );
+    if ( snap )
+        {
+        MPMLOGSTRING2( "CMPMIapSelection::ChooseIapL: Set snap %i to preferences",
+            snap )
+        iChooseIapPref.SetSnapId( snap );
+        iChooseIapPref.SetIapId( 0 );
+        }
+    else if ( iap ) 
+        {      
+        MPMLOGSTRING2( "CMPMIapSelection::ChooseIapL: Set iap %i to preferences",
+                iap )
+        iChooseIapPref.SetIapId( iap );
+        iChooseIapPref.SetSnapId( 0 );
+        }
+
+    MPMLOGSTRING2( "CMPMIapSelection::ChooseIapL: IapID: %i",
+            iChooseIapPref.IapId() )
+    
+    // Check if direct IAP connection is tried to make
+    if ( iChooseIapPref.IapId() != 0 )
+        { 
+        TMPMBearerType bearerType = iSession->MyServer().CommsDatAccess()->GetBearerTypeL( iChooseIapPref.IapId() );
+        MPMLOGSTRING2( "CMPMIapSelection::ChooseIapL: bearerType: %i", bearerType )
+
+        // Complete selection with error code if wlan only was set and cellular IAP other 
+        // than MMS IAP was tried to access  
+        if ( ( iChooseIapPref.BearerSet() ==
+               TExtendedConnPref::EExtendedConnBearerWLAN ) && 
+                ( bearerType == EMPMBearerTypePacketData ) && 
+                ( iSession->IsMMSIap( iChooseIapPref.IapId() ) == EFalse ) ) 
+            {
+            ChooseIapComplete( KErrPermissionDenied, NULL );
+            return;
+            }
+        }
+        
+    MPMLOGSTRING2( "CMPMIapSelection::ChooseIapL:\
+ connection type %d", iChooseIapPref.ConnType() )
+
+    if ( iChooseIapPref.ConnType() == TMpmConnPref::EConnTypeDefault )
+        {
+        // Default connection is requested.
+
+        MPMLOGSTRING( "CMPMIapSelection::ChooseIapL:\
+ Default Connection" )
+
+        if ( iSession->UseUserConnPref() )
+            {
+            // User connection active -> use it
+            // Add info into the BM connections
+            iSession->MyServer().AppendBMConnection(iSession->ConnectionId(),
+                iSession->MyServer().UserConnPref()->SnapId(),
+                iSession->MyServer().UserConnPref()->IapId(), 
+                EStarting,
+				*iSession );
+
+            ChooseIapComplete( KErrNone, iSession->MyServer().UserConnPref());
+            return;
+            }
+
+        TCmDefConnType type( TCmDefConnType( 0 ) );
+        TUint32 id( 0 );
+        iSession->MyServer().DefaultConnection()->GetDefaultConnectionL( type, id );
+        
+        MPMLOGSTRING3( "CMPMIapSelection::ChooseIapL:\
+ default connection type %d id %d", type, id )
+       
+        if( type == ECmDefConnConnectionMethod )
+            {
+            iChooseIapPref.SetIapId( id );
+            iChooseIapPref.SetSnapId( 0 );
+            ExplicitConnectionL();
+            }
+        else if( type == ECmDefConnDestination )
+            { 
+            iChooseIapPref.SetSnapId( id );
+            ExplicitConnectionL();
+            }
+        else
+            {
+            if( iCommsDatAccess->IsSnapEmptyL( id ) )
+                {
+                // start implicit connection
+                ImplicitConnectionL();
+                return;
+                }
+
+            iChooseIapPref.SetSnapId( id );
+
+            // start connection as if explicitly defined 
+            // by application
+            ExplicitConnectionL();
+            }       
+        }
+    else if ( iChooseIapPref.ConnType() == TMpmConnPref::EConnTypeExplicit )
+        {
+        // Client has defined SNAP or IAP connection to be used.
+        
+        // If usage of given IAP is mandated, do not allow user connection.
+        if ( !iChooseIapPref.MandateIap() )
+            {
+            TBool useUCPref = iSession->UseUserConnPref();
+
+            // Check that user connection is active, it is not in internet snap 
+            // and destination id is something else than zero.
+            // OR
+            // User connection is active and iap id is non-zero.
+            if ( ( useUCPref &&
+                   !iSession->MyServer().UserConnectionInInternet() &&
+                   iChooseIapPref.SnapId() ) ||
+                 ( useUCPref && iChooseIapPref.IapId() ) )
+                 {
+                 // Add info into the BM connections
+                 iSession->MyServer().AppendBMConnection(
+                     iSession->ConnectionId(),
+                     iSession->MyServer().UserConnPref()->SnapId(),
+                     iSession->MyServer().UserConnPref()->IapId(), 
+                     EStarting,
+                     *iSession );
+    
+                 ChooseIapComplete( KErrNone, iSession->MyServer().UserConnPref() );
+                 return;                
+                 }
+            }
+        ExplicitConnectionL();
+        }
+    else
+        {
+        // Used connection will be asked from the user.
+        ASSERT( iChooseIapPref.ConnType() == TMpmConnPref::EConnTypeImplicit );
+
+        if ( iSession->UseUserConnPref() )
+            {
+            // Do not prompt the user in this case.
+            // Add info into the BM connections
+            iSession->MyServer().AppendBMConnection(
+                iSession->ConnectionId(),
+                iSession->MyServer().UserConnPref()->SnapId(),
+                iSession->MyServer().UserConnPref()->IapId(), 
+                EStarting,
+				*iSession );
+
+            ChooseIapComplete( KErrNone, iSession->MyServer().UserConnPref() );
+            return;
+            }
+        
+        ImplicitConnectionL();
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMIapSelection::ExplicitConnectionL
+// -----------------------------------------------------------------------------
+//
+void CMPMIapSelection::ExplicitConnectionL()
+    {
+    TBool   iapTypeLanOrWlan = EFalse;
+    TUint32 validateIapId    = iChooseIapPref.IapId();
+    
+    MPMLOGSTRING2(
+        "CMPMIapSelection::ExplicitConnectionL - Connection Id = 0x%x",
+        iSession->ConnectionId() )
+
+    TUint32 snap( 0 );
+    
+    if ( validateIapId == 0 )
+        {
+        if ( iChooseIapPref.SnapId() )
+            {
+            snap = iChooseIapPref.SnapId();
+            }
+        else
+            {
+            // Neither defined -> attempt to use 
+            // already stored connection info
+            snap = iSession->MyServer().GetBMSnap( iSession->ConnectionId() );
+            iChooseIapPref.SetSnapId( snap );
+            if( !snap )
+                {
+                // If snap not defined, this must be iap connection
+                //
+                validateIapId = iSession->MyServer().GetBMIap( iSession->ConnectionId() );
+                iChooseIapPref.SetIapId( validateIapId );
+                }
+            }
+        }
+
+    // IAP Id explicitly defined
+    // 
+    if ( validateIapId )
+        {
+        MPMLOGSTRING2(
+            "CMPMIapSelection::ExplicitConnectionL - IAP Id = %i", 
+            validateIapId )
+
+        TUint32 retNetId = 0;
+        iCommsDatAccess->ValidateIapL( iSession->ConnectionId(), 
+                                       validateIapId, 
+                                       retNetId, 
+                                       iapTypeLanOrWlan,
+                                       *iSession );
+
+        // Set validated IAP Id and returned Access Network Id
+        // in connection preferences
+        //
+        iChooseIapPref.SetIapId( validateIapId );
+        iChooseIapPref.SetNetId( retNetId );
+
+        // In case offline mode is enabled, only LAN or WLAN is allowed.
+        // If some other bearer has been requested, then error code 
+        // KErrGprsOfflineMode should be returned instead of KErrNone.
+        // 
+        
+        if ( !iapTypeLanOrWlan && iSession->IsPhoneOfflineL() )
+            {
+            ChooseIapComplete( KErrGprsOfflineMode, &iChooseIapPref );
+            }
+        else
+            {
+            TWlanIapType wlanType = iCommsDatAccess->CheckWlanL( validateIapId );
+            if( wlanType != ENotWlanIap )
+                {
+                iChooseIapState = EExplicitConnection;
+                iWlanDialog = CMPMWlanQueryDialog::NewL( *this, validateIapId );
+                iWlanDialog->StartWlanQueryL();
+                return;                
+                }
+
+            // Check whether confirmation from user is needed for allowing cellular usage.
+            // When application is starting an IAP confirmation is asked only when roaming.
+            if ( iSession->IsConfirmFirstL( validateIapId ) )
+                {
+                // Check whether queries are disabled
+                if ( !( iChooseIapPref.NoteBehaviour() & TExtendedConnPref::ENoteBehaviourConnDisableQueries ) )
+                    {
+                    if ( iSession->MyServer().RoamingWatcher()->RoamingStatus() == EMPMInternationalRoaming )
+                        {
+                        // Check if cellular data usage query has already been presented to the user in this country
+                       if ( iSession->MyServer().RoamingWatcher()->AskCellularDataUsageAbroad() == true )
+                            {
+                            TConnectionId connId = iSession->ConnectionId();
+                                                            
+                            // International roaming
+                            iConfirmDlgStarting = CMPMConfirmDlgStarting::NewL( 
+                                                  *this, 
+                                                  connId,
+                                                  snap, 
+                                                  validateIapId, 
+                                                  CMPMConfirmDlg::EConfirmDlgVisitorNetwork,
+                                                  iChooseIapPref,
+                                                  iSession->MyServer(),
+                                                  *iSession,
+                                                  EExplicitConnection );
+                            return;    
+                            }
+                        }
+                    }
+                }
+                           
+            // Add info into the BM connections
+            //
+            iSession->MyServer().AppendBMConnection( iSession->ConnectionId(), 
+                                                     snap, 
+                                                     validateIapId, 
+                                                     EStarting,
+                                                     *iSession );
+            ChooseIapComplete( KErrNone, &iChooseIapPref );
+            }
+        }
+    // Snap Id explicitly defined
+    // 
+    else
+        {
+        MPMLOGSTRING2(
+            "CMPMIapSelection::ExplicitConnectionL - SNAP = %i", snap )
+
+        // If the SNAP contains WLAN IAP, 
+        // scan wlan networks
+        //
+        RArray<TUint> iapPath;
+        CleanupClosePushL( iapPath ); 
+   
+        //Check if WLAN bearerset is in use
+        if ( ( iChooseIapPref.BearerSet() & TExtendedConnPref::EExtendedConnBearerWLAN ) ||
+             ( iChooseIapPref.BearerSet() == TExtendedConnPref::EExtendedConnBearerUnknown ) )
+            {
+            if ( iNewWlansAllowed )
+                {
+                // User allows only WLAN connections, check WLAN availability.
+                // A note will be shown if no WLANs are available.
+                //
+                iSession->MyServer().Events()->CheckWlanAvailabilityL( this );
+                }
+            else if( iCommsDatAccess->SnapContainsWlanL( snap, iapPath, KMPMNrWlansOne ) )
+                {
+                // Scan wlan networks. After that execution continues 
+                // in CompleteExplicitSnapConnectionL()
+                //
+                iChooseIapState = EExplicitConnection; 
+                iSession->MyServer().Events()->ScanWLANNetworksL( iSession,
+                        iSession->ConnectionId(),
+                        EWlanScanCallbackChooseIap );
+                }
+            else
+                {
+                CompleteExplicitSnapConnectionL();
+                }
+            }
+        else
+            {
+            CompleteExplicitSnapConnectionL();
+            }
+        CleanupStack::PopAndDestroy( &iapPath );
+        }        
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMIapSelection::UpdateConnectionDialog
+// -----------------------------------------------------------------------------
+//
+void CMPMIapSelection::UpdateConnectionDialogL()
+    {
+    if( iDialog )
+        {
+        MPMLOGSTRING( "CMPMIapSelection::UpdateConnectionDialogL data will be updated" )
+        iDialog->PublishSortSnapInfoL();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMIapSelection::CompleteExplicitSnapConnectionL
+// -----------------------------------------------------------------------------
+//
+void CMPMIapSelection::CompleteExplicitSnapConnectionL()
+    {
+    MPMLOGSTRING( "CMPMIapSelection::CompleteExplicitSnapConnectionL" )
+
+    // Store Snap id
+    // 
+    TUint32 snap = iChooseIapPref.SnapId();
+
+    RAvailableIAPList availableIAPList;
+    CleanupClosePushL( availableIAPList );
+    iSession->AvailableUnblacklistedIapsL( availableIAPList, iSession->ConnectionId() );
+
+    TBool   iapTypeLanOrWlan = EFalse;
+    TConnectionId connId = iSession->ConnectionId();
+
+    ChooseBestIAPL( iChooseIapPref, availableIAPList, iNextBestExists );
+    TUint32 validateIapId = iChooseIapPref.IapId();
+    // Check if any suitable IAP's were found, if not then complete selection with error code
+    if (validateIapId == 0 )
+        {
+        ChooseIapComplete( KErrNotFound, NULL );
+        CleanupStack::PopAndDestroy( &availableIAPList );
+        return;
+        }
+    
+    TUint32 retNetId( 0 );
+    iCommsDatAccess->ValidateIapL( connId, 
+            validateIapId, 
+            retNetId, 
+            iapTypeLanOrWlan,
+            *iSession );
+    
+    // Set validated IAP Id and returned Access Network Id
+    // in connection preferences
+    //
+    iChooseIapPref.SetIapId( validateIapId );
+    iChooseIapPref.SetNetId( retNetId );
+
+    if ( !CheckGprsServicesAllowedL( iapTypeLanOrWlan ) )
+        {
+        ChooseIapComplete( KErrGprsServicesNotAllowed, NULL );
+        }
+    else if ( !iapTypeLanOrWlan && iSession->IsPhoneOfflineL() )
+        {
+        // In case offline mode is enabled, only LAN or WLAN is allowed.
+        // If some other bearer has been requested, then error code 
+        // KErrGprsOfflineMode should be returned instead of KErrNone.
+        // 
+        ChooseIapComplete( KErrGprsOfflineMode, &iChooseIapPref );
+        }
+    else
+        {
+        // Check whether confirmation from user is needed for allowing cellular usage
+        if ( ( iSession->IsConfirmFirstL( validateIapId ) ) && 
+             ( iSession->MyServer().CommsDatAccess()->CheckWlanL( validateIapId ) == ENotWlanIap ) )
+            {
+            // Check whether queries are disabled
+            if ( !( iChooseIapPref.NoteBehaviour() & TExtendedConnPref::ENoteBehaviourConnDisableQueries ) )
+                {
+                if ( iSession->MyServer().RoamingWatcher()->RoamingStatus() == EMPMInternationalRoaming )
+                    {
+                    // Check if cellular data usage query has already been presented to the user in this country
+                    if ( iSession->MyServer().RoamingWatcher()->AskCellularDataUsageAbroad() == true )
+                        {
+                        // International roaming
+                        iConfirmDlgStarting = CMPMConfirmDlgStarting::NewL( 
+                                *this, 
+                                connId,
+                                snap, 
+                                validateIapId, 
+                                CMPMConfirmDlg::EConfirmDlgVisitorNetwork,
+                                iChooseIapPref,
+                                iSession->MyServer(),
+                                *iSession,
+                                EExplicitConnection );
+                        }
+                    else
+                        {
+                        // If user has already been queried in this country just complete the IAP selection.
+    
+                        iSession->MyServer().AppendBMConnection( connId, 
+                                snap, 
+                                validateIapId, 
+                                EStarting,
+                                *iSession );
+    
+                        ChooseIapComplete( KErrNone, &iChooseIapPref );
+                        }
+    
+                    }
+                else
+                    {
+                    // Home network
+                    iConfirmDlgStarting = CMPMConfirmDlgStarting::NewL( 
+                            *this, 
+                            connId,
+                            snap, 
+                            validateIapId, 
+                            CMPMConfirmDlg::EConfirmDlgHomeNetwork, 
+                            iChooseIapPref,
+                            iSession->MyServer(),
+                            *iSession,
+                            EExplicitConnection );
+    
+                    }
+                }
+            else
+                {
+                // Queries are disabled and connection creation will fail
+                ChooseIapComplete( KErrPermissionDenied, &iChooseIapPref );
+                }
+            }
+        else
+            {
+            if ( !StartWlanQueryIfNeededL( validateIapId ) )
+                {
+                // Add info into the BM connections
+                //
+                iSession->MyServer().AppendBMConnection( connId, 
+                        snap, 
+                        validateIapId, 
+                        EStarting,
+                        *iSession );
+                ChooseIapComplete( KErrNone, &iChooseIapPref );
+
+                }
+
+            }
+        }
+
+    CleanupStack::PopAndDestroy( &availableIAPList );    
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMIapSelection::CheckGprsServicesAllowedL
+// -----------------------------------------------------------------------------
+//
+TBool CMPMIapSelection::CheckGprsServicesAllowedL( TBool aIapLanOrWlan )
+    {
+    if ( iSession->MyServer().IsVoiceCallActiveL() )
+        {
+        // Check whether we are in GSM or 3G mode.
+        // Connection request during voice call is always allowed 
+        // in 3G. In GSM it's allowed in case phone supports dual 
+        // transfer mode (DTM)
+        // 
+        if ( iSession->MyServer().IsModeGSM() )
+            {
+            // If phone doesn't support DTM, then 
+            // return KErrGprsServicesNotAllow
+            // 
+            if ( !iSession->MyServer().IsDTMSupported() )
+                {
+                if ( !aIapLanOrWlan )
+                    {
+                    MPMLOGSTRING( "CMPMIapSelection::CheckGprsServicesAllowedL not allowed" )
+                    return EFalse;
+                    }
+                }
+            }
+        }
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMIapSelection::StartWlanQueryIfNeededL
+// -----------------------------------------------------------------------------
+//
+TBool CMPMIapSelection::StartWlanQueryIfNeededL( TUint32 aIapId, TBool aIsRoaming )
+    {
+    MPMLOGSTRING3( "CMPMIapSelection::StartWlanQueryIfNeededL iap %d, isRoaming %d ", 
+                   aIapId,
+                   aIsRoaming )
+    TBool wlanQueryNeeded( EFalse );
+    // If wlan iap check if offline note needed
+    TWlanIapType wlanType = iCommsDatAccess->CheckWlanL( aIapId );
+    if( wlanType != ENotWlanIap )
+        {
+        iIsRoaming = aIsRoaming;
+        iChooseIapState = EExplicitConnection;
+        iWlanDialog = CMPMWlanQueryDialog::NewL( *this, aIapId );
+        iWlanDialog->StartWlanQueryL();
+        wlanQueryNeeded = ETrue;
+        }
+    return wlanQueryNeeded;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMIapSelection::ImplicitConnectionCheckWlanScanNeededL
+// -----------------------------------------------------------------------------
+//
+void CMPMIapSelection::ImplicitConnectionCheckWlanScanNeededL()
+    {
+    __ASSERT_DEBUG( !iDialog, PanicServer( EMPMReceiveAlreadyActive ) );
+
+    MPMLOGSTRING( "CMPMIapSelection::ImplicitConnectionCheckWlanScanNeededL" )
+
+    iCommsDatAccess->CheckWLANIapL( *iSession );
+
+    // Scan WLAN networks before displaying Connection Dialog in case: 
+    //  - there is a WLAN IAP configured in the phone (other than Easy WLAN)
+    // 
+    if ( iSession->MyServer().IsWLANScanRequired() )
+        {
+        // Store state of choose iap during 
+        // asynchronous calls. 
+        // 
+        iChooseIapState = EImplicitConnection;
+        // In case of offline mode hidden WLAN networks will 
+        // not be discovered by this WLAN scan.
+        //
+        iSession->MyServer().Events()->ScanWLANNetworksL( iSession, 
+                                                          iSession->ConnectionId(),
+                                                          EWlanScanCallbackChooseIap );
+        return;
+        }
+    ImplicitConnectionL();
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMIapSelection::ChooseIapWLANScanCompletedL
+// -----------------------------------------------------------------------------
+//
+void CMPMIapSelection::ChooseIapWLANScanCompletedL( TInt aStatus )
+    {
+    MPMLOGSTRING( "CMPMIapSelection::ChooseIapWLANScanCompletedL" )
+    if( iChooseIapState == EExplicitConnection )
+        {
+        MPMLOGSTRING( "CMPMIapSelection::ChooseIapWLANScanCompletedL: explicit " )
+        CompleteExplicitSnapConnectionL(  );
+        }
+    else if( iChooseIapState == EImplicitConnection )
+        {
+        // If getting available IAPs failed, complete request with error code
+        // 
+        if( aStatus != KErrNone )
+            {
+            MPMLOGSTRING2( "CMPMIapSelection::ChooseIapWLANScanCompletedL: implicit, err %d", 
+                aStatus )
+            ChooseIapComplete( aStatus, NULL ); 
+            }
+        else
+            {
+            MPMLOGSTRING( "CMPMIapSelection::ChooseIapWLANScanCompletedL: implicit " )
+            ImplicitConnectionL();            
+            }
+        }
+    else
+        {
+        MPMLOGSTRING( "CMPMIapSelection::ChooseIapWLANScanCompletedL: no state \
+to complete connection" )        
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMIapSelection::ChooseIapComplete
+// -----------------------------------------------------------------------------
+//
+void CMPMIapSelection::ChooseIapComplete( 
+    TInt                aError,
+    const TMpmConnPref* aPolicyPref )
+    {
+    MPMLOGSTRING2( "CMPMIapSelection::ChooseIapComplete aError = %d", aError )
+    
+    if ( ( aError == KErrNone ) &&
+        !( iChooseIapPref.NoteBehaviour() &
+           TExtendedConnPref::ENoteBehaviourConnDisableNotes ) )
+        {
+        TBool connectionAlreadyActive =
+            iSession->MyServer().CheckIfStarted( aPolicyPref->IapId() );
+        CConnectionUiUtilities* connUiUtils = NULL;
+        TRAPD( popupError,
+               connUiUtils = CConnectionUiUtilities::NewL();
+               connUiUtils->ConnectingViaDiscreetPopup(
+                   aPolicyPref->IapId(),
+                   connectionAlreadyActive );
+               delete connUiUtils; );
+        if ( popupError && connUiUtils )
+            {
+            delete connUiUtils;
+            }
+        }
+    
+    if( iWlanDialog )
+        {
+        delete iWlanDialog;
+        iWlanDialog = NULL;
+        }
+
+    iSession->ChooseIapComplete( aError, aPolicyPref );
+    // Set choose iap state to none
+    iChooseIapState = ENoConnection;
+    iNextBestExists = EFalse;
+    iUserSelectionSnapId = 0;
+    iUserSelectionIapId = 0;
+    iImplicitState = EImplicitStart;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMIapSelection::UserWlanSelectionDoneL
+// -----------------------------------------------------------------------------
+//
+void CMPMIapSelection::UserWlanSelectionDoneL( TInt aError, TUint32 aIapId )
+    {
+    MPMLOGSTRING( "CMPMIapSelection::UserWlanSelectionDoneL" )
+
+    if( iIsRoaming )
+        {
+        iIsRoaming = EFalse;
+        iSession->MigrateCallbackL( aError );
+        delete iWlanDialog;
+        iWlanDialog = NULL;
+        }
+    else
+        {
+        if( aError != KErrNone )
+            {
+            MPMLOGSTRING2( "CMPMIapSelection::UserWlanSelectionDoneL - Error = %d, completing", aError ) 
+            ChooseIapComplete( aError, NULL );        
+            }
+        else
+            {
+            if( iChooseIapState == EImplicitConnection )
+                {
+                iUserSelectionIapId = aIapId;
+                ImplicitConnectionL();    
+                }
+            else if( iChooseIapState == EExplicitConnection )
+                {
+                MPMLOGSTRING( "CMPMIapSelection::UserWlanSelectionDoneL completing explicit iap connection" ) 
+                iChooseIapPref.SetIapId( aIapId );
+                // Add info into the BM connections
+                //
+                iSession->MyServer().AppendBMConnection( iSession->ConnectionId(), 
+                                                         iChooseIapPref.SnapId(),
+                                                         aIapId,
+                                                         EStarting,
+                                                         *iSession );
+                iWlanDialog->StoreEasyWlanSelectionL();
+                delete iWlanDialog;
+                iWlanDialog = NULL;
+
+                ChooseIapComplete( KErrNone, &iChooseIapPref );
+                }
+            else
+                {
+                MPMLOGSTRING( "CMPMIapSelection::UserWlanSelectionDoneL - error, no connection state" ) 
+                }
+            
+            }
+        
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMIapSelection::HandleUserSelectionError
+// -----------------------------------------------------------------------------
+//
+void CMPMIapSelection::HandleUserSelectionError( TInt aError  )
+    {
+    MPMLOGSTRING2( "CMPMIapSelection::HandleUserIapSelectionError - error %d", 
+        aError )
+    
+    ChooseIapComplete( aError, NULL );
+    delete iDialog;
+    iDialog = NULL;
+    }
+
+       
+// -----------------------------------------------------------------------------
+// CMPMIapSelection::HandleUserIapSelectionL
+// -----------------------------------------------------------------------------
+//
+void CMPMIapSelection::HandleUserSelectionL( TBool aIsIap, TUint32 aId, TInt aError  )
+    {
+    MPMLOGSTRING2( "CMPMIapSelection::HandleUserSelectionL - Connection Id = 0x%x", 
+        iSession->ConnectionId() )
+
+    if( aError != KErrNone )
+        {
+        HandleUserSelectionError( aError );
+        return;
+        }
+    
+    if ( !aIsIap )
+        {
+        // User selected SNAP
+        // 
+        TMpmConnPref userPref;
+        iUserSelectionSnapId = iCommsDatAccess->MapNetIdtoSnapAPL( aId );
+        userPref.SetSnapId( iUserSelectionSnapId );
+
+        
+// Agreed that MPM will be migrated to SNAP TAG ID SNAPS.
+//        if ( iUserSelectionSnapId < 0x1000 )  // TODO: remove when connection dialog return valid SNAP TAG ID.
+//            {
+//            // legacy snaps ok
+//            userPref.SetNetId( aId );
+//            iUserSelectionSnapId = aId;
+//            }
+//        else
+//            {
+//            // 5.2 snaps, MPM uses internally legacy snaps. Convert back. -jl- TODO: use CommsDat mapping in future.
+//            userPref.SetNetId( aId - 3000 );
+//            iUserSelectionSnapId = aId - 3000;
+//            }
+        
+        MPMLOGSTRING2(
+                "CMPMIapSelection::HandleUserSelectionL: Snap = %i selected by the User", 
+                iUserSelectionSnapId )
+
+//        userPref.SetNetId( aId );
+        userPref.SetIapId( 0 );
+
+        ChooseBestIAPL( userPref, iStoredAvailableIaps );
+        iUserSelectionIapId = userPref.IapId();
+
+        }
+    else
+        {
+        // User explicit selection of IAP
+        // 
+        iUserSelectionIapId = aId;
+        iUserSelectionSnapId = 0; 
+        MPMLOGSTRING2(
+                "CMPMIapSelection::HandleUserSelectionL: IAP Id <%i> selected by the User", 
+                iUserSelectionIapId )
+
+        }
+    
+    // We are done
+    // 
+    delete iDialog;
+    iDialog = NULL;
+    
+    ImplicitConnectionL();
+    }
+    
+// -----------------------------------------------------------------------------
+// CMPMIapSelection::ImplicitConnectionWlanNoteL
+// -----------------------------------------------------------------------------
+//
+void CMPMIapSelection::ImplicitConnectionWlanNoteL()
+    {
+    MPMLOGSTRING( "CMPMIapSelection::ImplicitConnectionWlanNoteL" )
+    
+    TWlanIapType wlanType = iCommsDatAccess->CheckWlanL( iUserSelectionIapId );
+    // In case offline mode is enabled, only LAN or WLAN is allowed.
+    // If some other bearer has been requested, then error code 
+    // KErrGprsOfflineMode should be returned instead of KErrNone.
+    // 
+    if( wlanType != ENotWlanIap )
+        {
+        iChooseIapState = EImplicitConnection;
+        iWlanDialog = CMPMWlanQueryDialog::NewL( *this, iUserSelectionIapId );
+        iWlanDialog->StartWlanQueryL();
+        return;                
+        }
+    else
+        {
+        // Check whether confirmation from user is needed for allowing cellular usage.
+        // When user is starting implicit IAP/SNAP confirmation is asked only when roaming.
+        if ( iSession->IsConfirmFirstL( iUserSelectionIapId ) )
+            {
+            // Check whether queries are disabled
+            if ( !( iChooseIapPref.NoteBehaviour() & TExtendedConnPref::ENoteBehaviourConnDisableQueries ) )
+                {
+                if ( iSession->MyServer().RoamingWatcher()->RoamingStatus() == EMPMInternationalRoaming )
+                    {
+                    // Check if cellular data usage query has already been presented to the user in this country
+                    if ( iSession->MyServer().RoamingWatcher()->AskCellularDataUsageAbroad() == true )
+                        {
+                        TConnectionId connId = iSession->ConnectionId();
+                                                                    
+                        // International roaming
+                        iConfirmDlgStarting = CMPMConfirmDlgStarting::NewL( 
+                                              *this, 
+                                              connId,
+                                              iUserSelectionSnapId, 
+                                              iUserSelectionIapId, 
+                                              CMPMConfirmDlg::EConfirmDlgVisitorNetwork,
+                                              iChooseIapPref,
+                                              iSession->MyServer(),
+                                              *iSession,
+                                              EImplicitConnection );
+                        return;    
+                        }
+                    }
+                }
+            }
+
+        CompleteImplicitConnectionL();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMIapSelection::OfflineNoteResponse
+// -----------------------------------------------------------------------------
+//
+TOfflineNoteResponse CMPMIapSelection::OfflineNoteResponse()
+    {
+#ifndef _PLATFORM_SIMULATOR_
+    MPMLOGSTRING2( "CMPMIapSelection::OfflineNoteResponse: %d",
+                   iOfflineNoteResponse )
+    return iOfflineNoteResponse;
+#else
+    // Platsim simulates WLAN and offline-mode. To ease automated testing,
+    // offline connection confirmation is not asked in Platsim-variant
+    MPMLOGSTRING( "CMPMIapSelection::OfflineNoteResponse: yes for Platsim" )
+    return EOfflineResponseYes;
+#endif
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMIapSelection::ConnectionStarted
+// -----------------------------------------------------------------------------
+//
+void CMPMIapSelection::ConnectionStarted()
+    {
+    MPMLOGSTRING( "CMPMIapSelection::ConnectionStarted: reset offline response" )
+    SetOfflineNoteResponse( EOfflineResponseUndefined );
+    }
+    
+// -----------------------------------------------------------------------------
+// CMPMIapSelection::SetOfflineNoteShown
+// -----------------------------------------------------------------------------
+//
+void CMPMIapSelection::SetOfflineNoteResponse( TOfflineNoteResponse aResponse )
+    {
+    MPMLOGSTRING2( "CMPMIapSelection::SetOfflineNoteResponse %d ", aResponse )
+    iOfflineNoteResponse = aResponse;
+    }
+// -----------------------------------------------------------------------------
+// CMPMIapSelection::CompleteImplicitConnectionL
+// -----------------------------------------------------------------------------
+//
+
+void CMPMIapSelection::CompleteImplicitConnectionL()
+    {
+    TBool   iapTypeLanOrWlan( EFalse );
+    TUint32 retNetId( 0 );
+    iCommsDatAccess->ValidateIapL( iSession->ConnectionId(), 
+                                   iUserSelectionIapId, 
+                                   retNetId, 
+                                   iapTypeLanOrWlan,
+                                   *iSession );
+                                   
+    if ( !iapTypeLanOrWlan && iSession->IsPhoneOfflineL() )
+        {
+        MPMLOGSTRING2( "CMPMIapSelection::CompleteImplicitConnectionL: Completing with code = %i",
+                KErrGprsOfflineMode )
+        ChooseIapComplete( KErrGprsOfflineMode, NULL );
+        }
+    else
+        {
+        // Add info into the BM connections
+        //
+        iSession->MyServer().AppendBMConnection( iSession->ConnectionId(),
+                                                 iUserSelectionSnapId,
+                                                 iUserSelectionIapId, 
+                                                 EStarting,
+                                                 *iSession );
+                                                 
+        // Set validated IAP Id and returned Access Network Id
+        // in connection preferences
+        //            
+        iChooseIapPref.SetIapId( iUserSelectionIapId );
+        iChooseIapPref.SetNetId( retNetId );
+            
+        
+        if( iWlanDialog )
+            {
+            iWlanDialog->StoreEasyWlanSelectionL();
+            delete iWlanDialog;
+            iWlanDialog = NULL;
+            }
+        
+        ChooseIapComplete( KErrNone, &iChooseIapPref );
+        }
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMIapSelection::ImplicitConnectionIapSelectionL
+// -----------------------------------------------------------------------------
+//
+void CMPMIapSelection::ImplicitConnectionIapSelectionL()
+    {
+    MPMLOGSTRING( "CMPMIapSelection::ImplicitConnectionIapSelectionL" )
+    iSession->AvailableUnblacklistedIapsL( iStoredAvailableIaps, iSession->ConnectionId() );
+
+    // Create and initiate user dialog
+    //
+    iDialog = CMPMDialog::NewL( *this,
+                                iStoredAvailableIaps,
+                                iChooseIapPref.BearerSet(),
+                                *iSession->MyServer().ConnectDialogQueue(),
+                                iSession->MyServer() );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMIapSelection::ImplicitConnectionL
+// -----------------------------------------------------------------------------
+//
+void CMPMIapSelection::ImplicitConnectionL()
+    {
+    if( iImplicitState  == EImplicitStart )
+        {
+        MPMLOGSTRING( "CMPMIapSelection::ImplicitConnectionIapSelectionL EImplicitStart" )
+        iImplicitState = EImplicitWlanScan;
+        ImplicitConnectionCheckWlanScanNeededL();
+        }
+    else if( iImplicitState  == EImplicitWlanScan )
+        {
+        MPMLOGSTRING( "CMPMIapSelection::ImplicitConnectionIapSelectionL EImplicitWlanScan" )
+        iImplicitState = EImplicitUserSelection;
+        ImplicitConnectionIapSelectionL();
+        }
+    else if( iImplicitState  == EImplicitUserSelection )
+        {
+        MPMLOGSTRING( "CMPMIapSelection::ImplicitConnectionIapSelectionL EImplicitUserSelection" )
+        iImplicitState = EImplicitWlanQuery;
+        ImplicitConnectionWlanNoteL();
+        }
+    else //EImplicitWlanQuery
+        {
+        MPMLOGSTRING( "CMPMIapSelection::ImplicitConnectionIapSelectionL EImplicitWlanQuery" )
+        CompleteImplicitConnectionL();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMIapSelection::StopDisplayingStartingDlg
+// -----------------------------------------------------------------------------
+//
+void CMPMIapSelection::StopDisplayingStartingDlg()
+    {
+    MPMLOGSTRING( "CMPMIapSelection::StopDisplayingStartingDlg" )
+
+    if ( iConfirmDlgStarting )
+        {
+        // We probably have to complete the ChooseBestIAP message with KErrCancel
+        // 
+        ChooseIapComplete( KErrCancel, NULL );
+        }
+    
+    delete iConfirmDlgStarting;
+    iConfirmDlgStarting = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMIapSelection::ChooseBestIAPL
+// -----------------------------------------------------------------------------
+//
+void CMPMIapSelection::ChooseBestIAPL(
+    TMpmConnPref&               aMpmConnPref,
+    const RAvailableIAPList&    aAvailableIAPs )
+    {
+    MPMLOGSTRING( "CMPMIapSelection::ChooseBestIAPL" )
+    TBool nextBestExists( EFalse );
+    // reuse different version of this function
+    //
+    ChooseBestIAPL( aMpmConnPref, aAvailableIAPs, nextBestExists ); 
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMIapSelection::ChooseBestIAPL
+// -----------------------------------------------------------------------------
+//
+void CMPMIapSelection::ChooseBestIAPL(
+    TMpmConnPref&               aMpmConnPref,
+    const RAvailableIAPList&    aAvailableIAPs, 
+    TBool&                      aNextBestExists )
+    {
+    MPMLOGSTRING2( "CMPMIapSelection::ChooseBestIAPL: SNAP: %d", 
+        aMpmConnPref.SnapId() )
+
+    RArray<TNetIap> destNetIaps, embeddedIaps;
+    CleanupClosePushL( destNetIaps );
+    CleanupClosePushL( embeddedIaps );
+
+    // Find the valid IAPs belonging to the Snap.
+    //
+    iCommsDatAccess->SearchDNEntriesWithEmbeddedL( aMpmConnPref.SnapId(),
+                                                   destNetIaps, 
+                                                   embeddedIaps );
+
+    // Remove any unavailable IAP from destNetIaps
+    // 
+    TInt ret        = KErrNotFound;
+    TInt destCount  = destNetIaps.Count();
+    
+    // Decrement by one, because count is n, 
+    // but indexes in array are 0 .. n-1.
+    // 
+    destCount--;
+
+    // This time we are browsing the array from the end to the beginning, 
+    // because removing one element from array affects index numbering.
+    // 
+    for ( TInt k = destCount; k >= 0; k-- )
+        {
+        ret = aAvailableIAPs.Find( destNetIaps[k].iIapId );
+        if ( ret == KErrNotFound )
+            {
+            MPMLOGSTRING2( "CMPMIapSelection::ChooseBestIAPL: \
+Remove unavailable IAP = %i", destNetIaps[k].iIapId )
+            destNetIaps.Remove( k );
+            }
+        }
+
+    // Remove any unavailable IAP from embeddedIaps
+    // 
+    if ( embeddedIaps.Count() > 0 )
+        {
+        TInt embedCount = embeddedIaps.Count();
+        embedCount--;
+
+        for ( TInt m = embedCount; m >= 0; m-- )
+            {
+            ret = aAvailableIAPs.Find( embeddedIaps[m].iIapId );
+            if ( ret == KErrNotFound )
+                {
+                // Remove IapId because it's not available
+                // 
+                MPMLOGSTRING2( "CMPMIapSelection::ChooseBestIAPL: \
+Remove unavailable IAP = %i", embeddedIaps[m].iIapId )
+                              embeddedIaps.Remove( m );
+                }
+            }
+        }
+
+    // Determine the actual priorities for virtual IAPs and embedded Snaps
+    // 
+    iCommsDatAccess->DeterminePrioritiesL( destNetIaps, aAvailableIAPs, 
+                                           *iSession );
+    if ( embeddedIaps.Count() > 0 )
+        {
+        iCommsDatAccess->DeterminePrioritiesL( embeddedIaps, aAvailableIAPs,
+                                               *iSession );
+        }
+
+    // Start checking if a matching available IAP is found.
+    // 
+    // Pick the first item from both arrays and check the global bearer 
+    // priority for both destNetIaps and embeddedIaps.
+    // 
+    TUint32 destNetPriority( KLowestPriority );
+    TUint32 embeddedPriority( KLowestPriority );
+
+    if( destNetIaps.Count() > 0 )
+        {
+        iCommsDatAccess->GlobalBearerPriorityL( destNetIaps[0].iIapId, 
+                               destNetPriority );
+        }
+
+    if( embeddedIaps.Count() > 0 )
+        {
+        iCommsDatAccess->GlobalBearerPriorityL( embeddedIaps[0].iIapId, 
+                               embeddedPriority );
+        }
+
+    // Compare the global bearer priorities of the selected IAPs and 
+    // select the better. 
+    // 
+    // If the priorities are equal, prioritize the Snap 
+    // over the embedded Snap.
+    // 
+    // When comparing the priorities, smaller value is better.
+    // 
+    // Set found IAP Id and Access Network Id
+    // in connection preferences
+    //
+    if( destNetPriority <= embeddedPriority )
+        {
+        if( destNetIaps.Count() > 0 )
+            {
+            aMpmConnPref.SetIapId( destNetIaps[0].iIapId );
+            aMpmConnPref.SetSnapId( destNetIaps[0].iSnap );
+
+            MPMLOGSTRING2(
+                "CMPMIapSelection::ChooseBestIAPL: Found IapId = %i", 
+                destNetIaps[0].iIapId )
+            MPMLOGSTRING2(
+                "CMPMIapSelection::ChooseBestIAPL: Found SNAP  = %i", 
+                destNetIaps[0].iSnap )
+            }
+        }
+    else
+        {
+        if( embeddedIaps.Count() > 0 )
+            {
+            aMpmConnPref.SetIapId( embeddedIaps[0].iIapId );
+            aMpmConnPref.SetSnapId( embeddedIaps[0].iSnap );
+
+            MPMLOGSTRING2(
+                "CMPMIapSelection::ChooseBestIAPL: Found IapId = %i", 
+                embeddedIaps[0].iIapId )
+            MPMLOGSTRING2(
+                "CMPMIapSelection::ChooseBestIAPL: Found SNAP  = %i", 
+                embeddedIaps[0].iSnap )
+            }
+        }
+
+    if( ( destNetIaps.Count() + embeddedIaps.Count() ) > 1 )
+        {
+        MPMLOGSTRING(
+            "CMPMIapSelection::ChooseBestIAPL: aNextBestExists = ETrue" )
+        aNextBestExists = ETrue;
+        }
+    else
+        {
+        MPMLOGSTRING(
+            "CMPMIapSelection::ChooseBestIAPL: aNextBestExists = EFalse" )
+        aNextBestExists = EFalse;
+        }
+
+    if ( iSession->UseUserConnPref() &&
+         iSession->MyServer().UserConnectionInInternet() )
+        {
+        MPMLOGSTRING3(
+            "CMPMIapSelection::ChooseBestIAPL: Change iap id %d to %d\
+ when user connection exists",
+            aMpmConnPref.IapId(),
+            iSession->MyServer().UserConnPref()->IapId() )
+        aMpmConnPref.SetIapId( iSession->MyServer().UserConnPref()->IapId() );
+        }
+    
+    // Release memory
+    //
+    CleanupStack::PopAndDestroy( &embeddedIaps );
+    CleanupStack::PopAndDestroy( &destNetIaps );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMIapSelection::SetConfirmDlgStartingPtrNull
+// -----------------------------------------------------------------------------
+//
+void CMPMIapSelection::SetConfirmDlgStartingPtrNull()
+    {
+    iConfirmDlgStarting = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMIapSelection::Session
+// -----------------------------------------------------------------------------
+//
+CMPMServerSession* CMPMIapSelection::Session()
+    {
+    return iSession;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMIapSelection::TriggerInformationNote
+// -----------------------------------------------------------------------------
+//
+void CMPMIapSelection::TriggerInformationNoteL()
+    {
+    // ConnectioUiUtilities client side has a nonblocking active object 
+    // implementation
+    //
+    CConnectionUiUtilities* connUiUtils = CConnectionUiUtilities::NewL();        
+                            
+    connUiUtils->NoWLANNetworksAvailableNote();
+                            
+    delete connUiUtils;            
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMIapSelection::WlanAvailabilityResponse
+// -----------------------------------------------------------------------------
+//
+void CMPMIapSelection::WlanAvailabilityResponse( const TInt  aError, 
+                                                 const TBool aResult )
+    {
+    if ( ( aError == KErrNone && aResult == EFalse )
+          || ( aError == KErrNotSupported ) )
+        {
+        // no WLANs are available and user allows only
+        // WLAN connections
+        TRAPD( err, TriggerInformationNoteL() );
+        
+        if ( err )
+            {
+            MPMLOGSTRING2( "TriggerInformationNoteL leaved %d", err )
+            }
+            
+        ChooseIapComplete( KErrNotFound, NULL );
+        }
+    else
+        {
+        // Some WLANs are available,
+        // or an error has occured while requesting available WLANs.
+        //
+        TRAPD( err, CompleteExplicitSnapConnectionL() );
+        
+        if ( err )
+            {
+            MPMLOGSTRING2( "CompleteExplicitSnapConnectionL leaved %d", err )
+            ChooseIapComplete( KErrCancel, NULL );
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMIapSelection::MpmConnPref
+// -----------------------------------------------------------------------------
+//
+TMpmConnPref CMPMIapSelection::MpmConnPref()
+    {
+    return iChooseIapPref;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/src/mpmlauncher.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,81 @@
+/*
+* Copyright (c) 2004-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: MPM Client DLL Entry Point
+*
+*/
+
+/**
+@file mpmlauncher.cpp
+Mobility Policy Manager client DLL entry point.
+*/
+
+// INCLUDE FILES
+#include <e32std.h>
+#include "mpmlauncher.h"
+#include "mpmlogger.h"
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// MPMLauncher::LaunchServer
+// -----------------------------------------------------------------------------
+//
+TInt MPMLauncher::LaunchServer(
+    const TDesC& aServerFileName,
+    const TUid& aServerUid2,
+    const TUid& aServerUid3)
+    {
+    MPMLOGSTRING("MPMLauncher::LaunchServer")
+    const TUidType serverUid(KNullUid,aServerUid2,aServerUid3);
+
+    // We just create a new server process. Simultaneous
+    // launching of two such processes should be detected when the second one
+    // attempts to create the server object, failing with KErrAlreadyExists.
+    //
+    MPMLOGSTRING("Create a new server process")
+    RProcess server;
+    TInt r=server.Create(aServerFileName,KNullDesC,serverUid);
+
+    if ( r != KErrNone )
+        {
+        MPMLOGSTRING2("Server process creation returned error: %d", r)
+        return r;
+        }
+    TRequestStatus stat;
+    server.Rendezvous(stat);
+    if ( stat != KRequestPending )
+        {
+        server.Kill(0);        // abort startup
+        }
+    else
+        {
+        server.Resume();    // logon OK - start the server
+        }
+    User::WaitForRequest(stat);        // wait for start or death
+    // we can't use the 'exit reason' if the server panicked as this
+    // is the panic 'reason' and may be '0' which cannot be distinguished
+    // from KErrNone
+    r = ( server.ExitType() == EExitPanic ) ? KErrGeneral : stat.Int();
+    server.Close();
+    return r;
+    }
+
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+
+//  End of File 
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/src/mpmroamingwatcher.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,276 @@
+/*
+* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Observes terminals roaming status.
+*
+*/
+
+
+// INCLUDE FILES
+#include "mpmroamingwatcher.h"
+#include "mpmlogger.h"
+
+// EXTERNAL DATA STRUCTURES
+// None.
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None.
+
+// CONSTANTS
+
+// MACROS
+// None.
+
+// LOCAL CONSTANTS AND MACROS
+// None.
+
+// MODULE DATA STRUCTURES
+// None.
+
+// LOCAL FUNCTION PROTOTYPES
+// None.
+
+// FORWARD DECLARATIONS
+// None.
+
+// ============================= LOCAL FUNCTIONS ===============================
+// None.
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CMPMRoamingWatcher::CMPMRoamingWatcher
+// C++ default constructor can NOT contain any code, that might leave.
+// -----------------------------------------------------------------------------
+//
+CMPMRoamingWatcher::CMPMRoamingWatcher( RMobilePhone& aMobilePhone )
+    : CActive( CActive::EPriorityStandard ),
+      iMobilePhone( aMobilePhone ),
+      iRegistrationStatus( RMobilePhone::ERegistrationUnknown ),
+      iRoamingStatus( EMPMRoamingStatusUnknown ),
+      iCurrentCountryCode( 0 ),
+      iAskCellularDataUsageAbroad( true )
+    {
+    MPMLOGSTRING( "CMPMRoamingWatcher::CMPMRoamingWatcher" )
+    CActiveScheduler::Add( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMRoamingWatcher::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CMPMRoamingWatcher::ConstructL()
+    {
+    MPMLOGSTRING( "CMPMRoamingWatcher::ConstructL" )
+    // Retrieve current status
+    TRequestStatus status( KErrNone );
+    RMobilePhone::TMobilePhoneRegistrationStatus registrationStatus ( RMobilePhone::ERegistrationUnknown );
+    iMobilePhone.GetNetworkRegistrationStatus( status, registrationStatus );
+    User::WaitForRequest( status );
+        
+    if( status.Int() == KErrNone )
+        {
+        iRoamingStatus = MapRegistrationStatus( registrationStatus );
+        MPMLOGSTRING2( "CMPMRoamingWatcher::ConstructL iRoamingStatus: %d", iRoamingStatus )
+        }
+
+    //Start waiting notification    
+    iMobilePhone.NotifyNetworkRegistrationStatusChange( iStatus, iRegistrationStatus );
+    SetActive();
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMRoamingWatcher::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CMPMRoamingWatcher* CMPMRoamingWatcher::NewL( RMobilePhone& aMobilePhone )
+    {
+    MPMLOGSTRING( "CMPMRoamingWatcher::NewL" )
+    CMPMRoamingWatcher* self = new( ELeave ) CMPMRoamingWatcher( aMobilePhone );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMRoamingWatcher::~CIpdcRoamingObserver
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CMPMRoamingWatcher::~CMPMRoamingWatcher()
+    {
+    MPMLOGSTRING( "CMPMRoamingWatcher::~CMPMRoamingWatcher" )
+    Cancel();
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMRoamingWatcher::RunL
+//
+// -----------------------------------------------------------------------------
+//
+void CMPMRoamingWatcher::RunL()
+    {
+    MPMLOGSTRING( "CMPMRoamingWatcher::RunL" )
+
+    TMPMRoamingStatus roamingStatus = EMPMRoamingStatusUnknown;
+    RMobilePhone::TMobilePhoneRegistrationStatus registrationStatus = RMobilePhone::ERegistrationUnknown;
+
+    TInt status = iStatus.Int();
+
+    //store current value if there was no error
+    if( status == KErrNone )
+        {
+        registrationStatus = iRegistrationStatus;
+        }
+
+    //Start listening next status change
+    iMobilePhone.NotifyNetworkRegistrationStatusChange( iStatus, iRegistrationStatus );
+    SetActive();
+
+    //Map current value
+    roamingStatus = MapRegistrationStatus( registrationStatus ); 
+
+    if( roamingStatus != iRoamingStatus )
+        {
+        iRoamingStatus = roamingStatus;
+        MPMLOGSTRING2( "CMPMRoamingWatcher::RunL iRoamingStatus: %d", iRoamingStatus )
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMRoamingWatcher::RunError
+//
+// -----------------------------------------------------------------------------
+//
+TInt CMPMRoamingWatcher::RunError( TInt /*aError*/ )
+    {
+    MPMLOGSTRING( "CMPMRoamingWatcher::RunError" )
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMRoamingWatcher::DoCancel
+//
+// -----------------------------------------------------------------------------
+//
+void CMPMRoamingWatcher::DoCancel()
+    {
+    MPMLOGSTRING( "CMPMRoamingWatcher::DoCancel" )
+    iMobilePhone.CancelAsyncRequest( EMobilePhoneNotifyNetworkRegistrationStatusChange );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMRoamingWatcher::MapRegistrationStatus
+//
+// -----------------------------------------------------------------------------
+//
+TMPMRoamingStatus CMPMRoamingWatcher::MapRegistrationStatus( RMobilePhone::TMobilePhoneRegistrationStatus aStatus )
+    {
+    MPMLOGSTRING( "CMPMRoamingWatcher::MapRegistrationStatus" )
+    TMPMRoamingStatus roamingStatus = EMPMRoamingStatusUnknown;
+
+    switch (aStatus)
+        {
+        case RMobilePhone::ERegisteredOnHomeNetwork:
+            {
+            roamingStatus = EMPMHomenetwork;
+            iAskCellularDataUsageAbroad = false;
+            break;
+            }
+            
+        case RMobilePhone::ERegisteredRoaming:
+            {
+            RMobilePhone::TMobilePhoneNetworkInfoV1 network;
+            RMobilePhone::TMobilePhoneNetworkInfoV1Pckg networkPckg( network );
+
+            RMobilePhone::TMobilePhoneNetworkInfoV1 homeNetwork;
+            RMobilePhone::TMobilePhoneNetworkInfoV1Pckg homeNetworkPckg( homeNetwork );
+
+            TRequestStatus status( KErrNone );
+
+            iMobilePhone.GetCurrentNetwork(status, networkPckg);
+            User::WaitForRequest( status );
+
+            if(status.Int() == KErrNone)
+                {
+                iMobilePhone.GetHomeNetwork(status, homeNetworkPckg);
+                User::WaitForRequest( status );        
+
+                if(status.Int() == KErrNone)
+                    {
+                    RMobilePhone::TMobilePhoneNetworkCountryCode countryCode = network.iCountryCode;
+                    
+                    if(countryCode.Compare(homeNetwork.iCountryCode) == 0)
+                        {
+                        roamingStatus = EMPMNationalRoaming;
+                        }
+                    else
+                        {
+                        roamingStatus = EMPMInternationalRoaming;
+                        //
+                        if ( iCurrentCountryCode != countryCode )
+                            {
+                            iAskCellularDataUsageAbroad = ETrue;
+                            }                        
+                        }
+                    iCurrentCountryCode = countryCode; 
+                    }                
+                }
+            break;
+            }
+            
+        default:
+            {
+            roamingStatus = EMPMRoamingStatusUnknown;
+            break;
+            }            
+        }
+    MPMLOGSTRING2( "CMPMRoamingWatcher::MapRegistrationStatus roamingStatus: %d", roamingStatus )
+
+    return roamingStatus;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMRoamingWatcher::RoamingStatus
+//
+// -----------------------------------------------------------------------------
+//
+TMPMRoamingStatus CMPMRoamingWatcher::RoamingStatus() const
+    {
+    MPMLOGSTRING2( "CMPMRoamingWatcher::RoamingStatus iRoamingStatus: %d", iRoamingStatus )
+    return iRoamingStatus;
+    }
+
+
+TBool CMPMRoamingWatcher::AskCellularDataUsageAbroad() const
+    {
+    MPMLOGSTRING2( "CMPMRoamingWatcher::AskCellularDataUsageAbroad iAskCellularDataUsageAbroad: %d", iAskCellularDataUsageAbroad )
+    return iAskCellularDataUsageAbroad;
+    }
+
+void CMPMRoamingWatcher::SetAskCellularDataUsageAbroad(TBool aAskUsage)
+    {
+    iAskCellularDataUsageAbroad = aAskUsage;
+    MPMLOGSTRING2( "CMPMRoamingWatcher::SetAskCellularDataUsageAbroad iAskCellularDataUsageAbroad: %d", iAskCellularDataUsageAbroad )
+    }
+
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+// None.
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/src/mpmserver.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,2191 @@
+/*
+* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: MPM server implementation
+*
+*/
+
+/**
+@file mpmserver.cpp
+Mobility Policy Manager server implementation.
+*/
+
+// INCLUDE FILES
+#include <commdb.h>
+#include <etel3rdparty.h>                // Voice call notification
+#include <mmtsy_names.h>                 // KMmTsyModuleName
+#include <centralrepository.h>
+
+#include "mpmserver.h"
+#include "mpmserversession.h"
+#include "mpmconnmonevents.h"
+#include "mpmlogger.h"
+#include "mpmdtmwatcher.h"
+#include "mpmroamingwatcher.h"
+#include "mpmdisconnectdlg.h"
+#include "mpmconfirmdlgroaming.h"
+#include "mpmconfirmdlgstarting.h"
+#include "mpmdefaultconnection.h"
+#include "mpmcommsdataccess.h"
+#include "mpmwlanquerydialog.h"
+#include "mpmdialog.h"
+#include "mpmprivatecrkeys.h"
+#include "mpmcsidwatcher.h"
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// PanicServer 
+// Panics the server in case of programming error.
+// -----------------------------------------------------------------------------
+//
+void PanicServer( TInt aPanic )
+    {
+    User::Panic( KMPMPanicCategory, aPanic );
+    }
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CMPMServer::NewL
+// -----------------------------------------------------------------------------
+//
+CMPMServer* CMPMServer::NewL()
+    {
+    CMPMServer* self = new ( ELeave ) CMPMServer();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServer::CMPMServer
+// -----------------------------------------------------------------------------
+//
+CMPMServer::CMPMServer()
+    : CPolicyServer( CPolicyServer::EPriorityStandard, KMPMPolicy ),
+      iEvents( NULL ), 
+      iTSYLoaded( EFalse ),
+      iPacketServLoaded( EFalse ), 
+      iDtmWatcher( NULL ), 
+      iWLANScanRequired( EFalse ), 
+      iDisconnectQueue( NULL ), 
+      iRoamingQueue( NULL ), 
+      iStartingQueue( NULL ),
+      iWlanQueryQueue( NULL ),
+      iConnectDialogQueue( NULL ),
+      iDefaultConnection( NULL ), 
+      iConnectionCounter( 0 )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServer::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CMPMServer::ConstructL()
+    {
+    // identify ourselves and open for service
+    MPMLOGSTRING( "MPMServer is starting" )
+    StartL( KMPMServerName );
+
+    // Connect to ETel server
+    // The RTelServer::Connect() might not always work with the first trial,
+    // because of a coding error related to using semaphores in the method.
+    TInt err( KErrNotReady );
+    TInt a = 0;
+    while( a < KPhoneRetryCount && err != KErrNone )
+        {
+        User::After( KPhoneRetryTimeout );
+        err = iTelServer.Connect();
+        a++;       
+        }
+    User::LeaveIfError( err );
+       
+    // Try to load phone.tsy
+    TBuf< KCommsDbSvrMaxColumnNameLength > tsyName;
+    tsyName.Copy( KMmTsyModuleName );
+    err = iTelServer.LoadPhoneModule( tsyName );
+
+    if ( err == KErrNone )
+        {
+        iTSYLoaded = ETrue;
+        // Phone info can be retrieved with value 0 if there is only 1 phone
+        RTelServer::TPhoneInfo info;
+        User::LeaveIfError( iTelServer.GetPhoneInfo( 0, info ) );
+        User::LeaveIfError( iMobilePhone.Open( iTelServer, info.iName ) );
+
+        // Open packet service
+        err = iPacketService.Open( iMobilePhone );
+        if ( err == KErrNone )
+            {
+            iPacketServLoaded = ETrue;
+            iDtmWatcher = CMPMDtmWatcher::NewL( iPacketService );
+            }
+#ifdef _DEBUG
+        else
+            {
+            MPMLOGSTRING2( 
+                "CMPMServer::ConstructL iPacketService.Open error: %d", err )  
+            }
+#endif // _DEBUG
+        }
+    
+    iRoamingWatcher = CMPMRoamingWatcher::NewL(iMobilePhone);
+
+    iCommsDatAccess = CMPMCommsDatAccess::NewL( );
+    
+    iDisconnectQueue = new ( ELeave ) CArrayPtrFlat<CMPMDisconnectDlg>( KGranularity );
+    iDisconnectQueue->Reset();
+
+    iRoamingQueue = new ( ELeave ) CArrayPtrFlat<CMPMConfirmDlgRoaming>( KGranularity );
+    iRoamingQueue->Reset();
+
+    iStartingQueue = new ( ELeave ) CArrayPtrFlat<CMPMConfirmDlgStarting>( KGranularity ); 
+    iStartingQueue->Reset();
+
+    iWlanQueryQueue = new ( ELeave ) CArrayPtrFlat<CMPMWlanQueryDialog>( KGranularity );
+    iWlanQueryQueue->Reset();
+
+    iConnectDialogQueue = new ( ELeave ) CArrayPtrFlat<CMPMDialog>( KGranularity );
+    iConnectDialogQueue->Reset();
+    
+    iDefaultConnection = CMPMDefaultConnection::NewL( this );    
+
+    // Create central repository watcher and start it
+    iMpmCsIdWatcher = CMpmCsIdWatcher::NewL();
+    iMpmCsIdWatcher->StartL();
+
+    // Define P&S keys (snap & iap) for the user connection
+    TInt ret = RProperty::Define( KMPMUserConnectionCategory,
+                                  KMPMPSKeyUserConnectionSnap,
+                                  KMPMUserConnectionSnapType,
+                                  KMPMUserConnectionReadPolicy,
+                                  KMPMUserConnectionWritePolicy );
+    
+    if ( (ret != KErrNone) && (ret != KErrAlreadyExists) )
+        {
+        User::Leave(err);
+        }
+    
+    ret = RProperty::Define( KMPMUserConnectionCategory,
+                             KMPMPSKeyUserConnectionIap,
+                             KMPMUserConnectionIapType,
+                             KMPMUserConnectionReadPolicy,
+                             KMPMUserConnectionWritePolicy );
+                                          
+    if ( (ret != KErrNone) && (ret != KErrAlreadyExists) )
+        {
+        User::Leave(err);
+        }
+
+    // Set initial values for the keys
+    User::LeaveIfError(RProperty::Set( KMPMUserConnectionCategory,
+                                       KMPMPSKeyUserConnectionSnap,
+                                       0 ));
+
+    User::LeaveIfError(RProperty::Set( KMPMUserConnectionCategory,
+                                       KMPMPSKeyUserConnectionIap,
+                                       0 ));
+
+    // Read dedicated clients from the central repository
+    CRepository* repository = CRepository::NewL( KCRUidMPM );
+    
+    CleanupStack::PushL( repository );
+    
+    TUint32 baseKey = KMpmDedicatedClientBase;
+    TInt value;
+    ret = KErrNone;
+    
+    while ( ret == KErrNone )
+        {
+        ret = repository->Get ( baseKey, value );
+
+        if ( ret == KErrNone )
+            {
+            iDedicatedClients.AppendL( value );
+            MPMLOGSTRING2( "CMPMServer::ConstructL: Dedicated client id: %d", value)
+            }
+
+        baseKey++;
+        }
+    
+    CleanupStack::PopAndDestroy ( repository );
+    
+    // Define P&S keys for the connection dialogs
+    ret = RProperty::Define( KMPMActiveConnectionCategory,
+                             KMPMPSKeyActiveConnectionIap,
+                             KMPMActiveConnectionIapType,
+                             KMPMActiveConnectionReadPolicy,
+                             KMPMActiveConnectionWritePolicy );
+    
+    if ( (ret != KErrNone) && (ret != KErrAlreadyExists) )
+        {
+        User::Leave(err);
+        }
+    
+    ret = RProperty::Define( KMPMActiveConnectionCategory,
+                             KMPMPSKeyActiveConnectionSnap,
+                             KMPMActiveConnectionSnapType,
+                             KMPMActiveConnectionReadPolicy,
+                             KMPMActiveConnectionWritePolicy );
+    
+    if ( (ret != KErrNone) && (ret != KErrAlreadyExists) )
+        {
+        User::Leave(err);
+        }
+
+    ret = RProperty::Define( KMPMActiveConnectionCategory,
+                             KMPMPSKeyActiveConnectionBearer,
+                             KMPMActiveConnectionBearerType,
+                             KMPMActiveConnectionReadPolicy,
+                             KMPMActiveConnectionWritePolicy );
+                                          
+    if ( (ret != KErrNone) && (ret != KErrAlreadyExists) )
+        {
+        User::Leave(err);
+        }
+        
+    PublishActiveConnection();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServer::~CMPMServer
+// -----------------------------------------------------------------------------
+//
+CMPMServer::~CMPMServer()
+    {
+    if ( iDisconnectQueue )
+        {
+        iDisconnectQueue->ResetAndDestroy();
+        }
+    delete iDisconnectQueue;
+
+    if ( iRoamingQueue )
+        {
+        iRoamingQueue->ResetAndDestroy();
+        }
+    delete iRoamingQueue;
+
+    if ( iStartingQueue )
+        {
+        iStartingQueue->ResetAndDestroy();
+        }
+    delete iStartingQueue;
+
+    while ( iWlanQueryQueue && iWlanQueryQueue->Count() > 0 )
+        {
+        iWlanQueryQueue->Delete( 0 );
+        }
+    delete iWlanQueryQueue;
+    
+    if ( iConnectDialogQueue )
+        {
+        iConnectDialogQueue->ResetAndDestroy();
+        }
+    delete iConnectDialogQueue;
+
+    delete iEvents;
+
+    for ( TInt i = 0; i < iBlackListIdList.Count(); i++ )
+        {
+        iBlackListIdList[i].Close();
+        }
+
+    iActiveBMConns.Close();
+    iSessions.Close();
+
+    delete iDtmWatcher;
+    delete iRoamingWatcher;
+
+    // Close "global" ETEL objects
+    if ( iPacketServLoaded )
+        {
+        iPacketService.Close();
+        }    
+
+    iMobilePhone.Close();
+    iTelServer.Close();
+    
+    delete iDefaultConnection;
+    
+    delete iMpmCsIdWatcher;    
+    
+    iDedicatedClients.Close();
+
+    delete iCommsDatAccess;    
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServer::NewSessionL
+// -----------------------------------------------------------------------------
+//
+CSession2* CMPMServer::NewSessionL(
+    const TVersion& aVersion,
+    const RMessage2& /*aMessage*/) const
+    {
+    MPMLOGSTRING( "CMPMServer::NewSessionL" )
+    // Check we're the right version
+    if ( !User::QueryVersionSupported(TVersion(KMPMServerMajorVersionNumber,
+                                               KMPMServerMinorVersionNumber,
+                                               KMPMServerBuildVersionNumber ),
+                                     aVersion ) )
+        {
+        User::Leave( KErrNotSupported );
+        }
+
+    CSession2* session = CMPMServerSession::NewL( 
+                             *const_cast<CMPMServer*>( this ));
+    return session;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServer::PanicClient
+// -----------------------------------------------------------------------------
+//
+void CMPMServer::PanicClient(
+    const TInt aPanic) const
+    {
+    // let's have a look before we panic the client
+    __DEBUGGER()
+    // ok, go for it
+    RThread clientThread;
+
+    TInt err = Message().Client( clientThread );
+
+    if ( err == KErrNone )
+        {
+        clientThread.Panic( KMPMServerName, aPanic );
+        clientThread.Close();
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServer::AppendBMConnection
+// -----------------------------------------------------------------------------
+//
+void CMPMServer::AppendBMConnection( const TConnectionId aConnId, 
+                                     const TUint32       aSnap,
+                                     const TUint32       aIapId, 
+                                     TConnectionState    aState,
+                                     CMPMServerSession&  aSession )
+    {
+    MPMLOGSTRING3(
+        "CMPMServer::AppendBMConnection - aConnId = 0x%x, aSnap = %i",
+        aConnId, aSnap )
+
+    // Set the Connection Id, SNAP, Iap Id and connection state
+    // 
+    TConnectionInfo connInfo;
+    connInfo.iConnId = aConnId;
+    connInfo.iSnap   = aSnap;
+    connInfo.iIapId  = aIapId;
+    connInfo.iState  = aState;
+
+    // Package into TActiveBMConn //TODO Redundant.. remove the other one.
+    // 
+    TActiveBMConn conn;
+    conn.iConnInfo          = connInfo;
+
+    TInt index1 = iActiveBMConns.Find( conn, TActiveBMConn::MatchConnInfo );
+
+    if ( index1 == KErrNotFound )
+        {
+        // If this connInfo is not yet there, insert it at the end of array
+        //
+        iActiveBMConns.Append( conn );
+        }
+    else
+        {
+        // connInfo already active, check whether Connection Id is there
+        //
+        if ( index1 < iActiveBMConns.Count() )
+            {
+            // Set the Iap Id and connection state
+            // 
+            iActiveBMConns[index1].iConnInfo.iIapId = aIapId;
+            iActiveBMConns[index1].iConnInfo.iState = aState;
+            iActiveBMConns[index1].iConnInfo.iAppUid = aSession.AppUid();
+            }
+        }
+
+    if ( aState == EStarted )
+        {
+        TInt ret = KErrNone;
+        
+        TRAP ( ret, UpdateActiveConnectionL( aSession ) );
+        
+        if ( ret != KErrNone )
+            {
+            iActiveBearerType = EMPMBearerTypeNone;
+            iActiveIapId = 0;
+            iActiveSnapId = 0;            
+            }
+        }
+
+#ifdef _DEBUG
+    // Dump array of active connections to log in order to support testing.
+    // 
+    DumpActiveBMConns();
+#endif // _DEBUG
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServer::ResetBMConnection
+// -----------------------------------------------------------------------------
+//
+void CMPMServer::ResetBMConnection( const TConnectionId aConnId,
+                                    const TUint32       aIapId,
+                                    CMPMServerSession&  aSession )
+    {
+    MPMLOGSTRING3(
+        "CMPMServer::ResetBMConnection - aConnId = 0x%x, aIapId = %i", 
+        aConnId, aIapId )
+
+    // Get the current connection SNAP for this Connection Id
+    //
+    TUint32 snap = GetBMSnap( aConnId );
+
+    // Set the Connection Id and SNAP
+    // 
+    TConnectionInfo connInfo;
+    connInfo.iConnId = aConnId;
+    connInfo.iSnap   = snap;
+
+    // Set the Iap Id 
+    // 
+    TActiveBMConn conn;
+    conn.iConnInfo          = connInfo;
+    conn.iConnInfo.iIapId   = aIapId;
+
+    TInt index1 = iActiveBMConns.Find( conn, TActiveBMConn::MatchConnInfo );
+
+    if ( ( index1 != KErrNotFound ) && ( index1 < iActiveBMConns.Count() ) )
+//       && ( aIapId == iActiveBMConns[index1].iConnInfo.iIapId ) )
+        {
+        // If connInfo found, reset the Iap Id as zero and 
+        // update connection state as EIdle.
+        // 
+        // It is expected that MPM keeps the Connection Id and SNAP 
+        // relationship in a database entry and that this entry survives 
+        // a roaming event (an ApplicationLeavesConnection call).
+        //
+        iActiveBMConns[index1].iConnInfo.iIapId = 0;
+        iActiveBMConns[index1].iConnInfo.iState = EIdle;
+        
+        // Change state of P&S keys if needed
+        TInt ret = KErrNone;
+        
+        TRAP ( ret, UpdateActiveConnectionL( aSession ) );
+        
+        if ( ret != KErrNone )
+            {
+            iActiveBearerType = EMPMBearerTypeNone;
+            iActiveIapId = 0;
+            iActiveSnapId = 0;            
+            }
+        }
+#ifdef _DEBUG
+    // Dump array of active connections to log in order to support testing.
+    // 
+    DumpActiveBMConns();
+#endif // _DEBUG
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServer::RemoveBMConnection
+// -----------------------------------------------------------------------------
+//
+void CMPMServer::RemoveBMConnection( const TConnectionId aConnId,
+                                     CMPMServerSession&  aSession )
+    {
+    MPMLOGSTRING2( "CMPMServer::RemoveBMConnection - aConnId = 0x%x", 
+        aConnId )
+
+    TInt count = iActiveBMConns.Count();
+    
+    // Decrement by one, because count is n, 
+    // but indexes in array are 0 .. n-1.
+    // 
+    count--;
+
+    // This time we are browsing the array from the end to the beginning, 
+    // because removing one element from array affects index numbering.
+    // 
+    for ( TInt i = count; i >= 0; i-- )
+        {
+        if ( iActiveBMConns[i].iConnInfo.iConnId == aConnId )
+            {
+            // If Connection Id found, remove it. 
+            //
+            iActiveBMConns.Remove( i );
+
+            // Update active connection
+            TInt ret = KErrNone;
+        
+            TRAP ( ret, UpdateActiveConnectionL( aSession ) );
+        
+            if ( ret != KErrNone )
+                {
+                iActiveBearerType = EMPMBearerTypeNone;
+                iActiveIapId = 0;
+                iActiveSnapId = 0;            
+                }
+            }
+        }
+
+#ifdef _DEBUG
+    // Dump array of active connections to log in order to support testing.
+    // 
+    DumpActiveBMConns();
+#endif // _DEBUG
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServer::GetBMIap
+// -----------------------------------------------------------------------------
+//
+TUint32 CMPMServer::GetBMIap( const TConnectionId aConnId )
+    {
+    MPMLOGSTRING2( "CMPMServer::GetBMIap - aConnId = 0x%x", aConnId )
+
+    TUint32 connectionIapId( 0 );
+
+    // Set the Connection Id and SNAP
+    // 
+    TConnectionInfo connInfo;
+    connInfo.iConnId = aConnId;
+
+    TActiveBMConn conn;
+    conn.iConnInfo = connInfo;
+
+    TInt index1 = iActiveBMConns.Find( conn, TActiveBMConn::MatchConnInfo );
+
+    if ( ( index1 != KErrNotFound ) && ( index1 < iActiveBMConns.Count() ) )
+        {
+        // If connInfo found, set the Iap Id as connectionIapId
+        //
+        connectionIapId = iActiveBMConns[index1].iConnInfo.iIapId;
+        }
+
+    MPMLOGSTRING2( "CMPMServer::GetBMIap - connectionIapId = %i", 
+        connectionIapId )
+    return connectionIapId;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServer::GetBMSnap
+// -----------------------------------------------------------------------------
+//
+TUint32 CMPMServer::GetBMSnap( const TConnectionId aConnId )
+    {
+    MPMLOGSTRING2( "CMPMServer::GetBMSnap - aConnId = 0x%x", aConnId )
+
+    TUint32 snap( 0 );
+    TBool   snapFound( EFalse );
+
+    for ( TInt i = 0; ( ( i < iActiveBMConns.Count() ) && !snapFound ); i++ )
+        {
+        if ( iActiveBMConns[i].iConnInfo.iConnId == aConnId )
+            {
+            snap = iActiveBMConns[i].iConnInfo.iSnap;
+            snapFound = ETrue;
+            }
+        }
+    MPMLOGSTRING2( "CMPMServer::GetBMSnap - SNAP = %i", snap )
+    return snap;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServer::GetConnectionState
+// -----------------------------------------------------------------------------
+//
+void CMPMServer::GetConnectionState( const TConnectionId    aConnId,
+                                     TConnectionState&      aState )
+    {
+    MPMLOGSTRING2( "CMPMServer::GetConnectionState - aConnId = 0x%x", 
+        aConnId )
+
+    TConnectionInfo connInfo;
+    connInfo.iConnId = aConnId; 
+
+    TActiveBMConn conn;
+    conn.iConnInfo = connInfo;
+
+    TInt index1 = iActiveBMConns.Find( conn, TActiveBMConn::MatchConnInfo );
+
+    if ( ( index1 != KErrNotFound ) && ( index1 < iActiveBMConns.Count() ) )
+        {
+        // If connInfo found
+        //
+        aState = iActiveBMConns[index1].iConnInfo.iState;
+        }
+    else
+        {
+        // Since connInfo has no entry in iActiveBMConns, then 
+        // the state of connection must be EStarting.
+        // 
+        aState = EStarting;
+        }
+
+#ifdef _DEBUG
+    switch( aState )
+        {
+        case EStarting:
+            {
+            MPMLOGSTRING( "CMPMServer::GetConnectionState - Starting" )
+            break;
+            }
+        case EStarted:
+            {
+            MPMLOGSTRING( "CMPMServer::GetConnectionState - Started" )
+            break;
+            }
+        case EIdle:
+            {
+            MPMLOGSTRING( "CMPMServer::GetConnectionState - Idle" )
+            break;
+            }
+        case ERoaming:
+            {
+            MPMLOGSTRING( "CMPMServer::GetConnectionState - Roaming" )
+            break;
+            }
+        default:
+            {
+            MPMLOGSTRING( "CMPMServer::GetConnectionState - Unknown" )
+            break;
+            }
+        }
+#endif // _DEBUG
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServer::CheckIfStarted
+// -----------------------------------------------------------------------------
+//
+TBool CMPMServer::CheckIfStarted( const TUint32 aIapId )
+    {
+    MPMLOGSTRING2( "CMPMServer::CheckIfStarted - aIapId = %i", aIapId )
+
+    TConnectionState state( EIdle );
+    TBool stopLoop( EFalse );
+
+    // Loop all connections until EStarted is found or no more connections
+    // 
+    for ( TInt i = 0; ( ( i < iActiveBMConns.Count() ) && !stopLoop ); i++ )
+        {
+        // Check if IAP Id matches
+        // 
+        if ( iActiveBMConns[i].iConnInfo.iIapId == aIapId )
+            {
+            state = iActiveBMConns[i].iConnInfo.iState;  
+
+            // Stop looping if EStarted found
+            // 
+            if ( state == EStarted )
+                {
+                stopLoop = ETrue;
+                }
+            }
+        }
+
+#ifdef _DEBUG
+    switch( state )
+        {
+        case EStarting:
+            {
+            MPMLOGSTRING( "CMPMServer::CheckIfStarted - Starting" )
+            break;
+            }
+        case EStarted:
+            {
+            MPMLOGSTRING( "CMPMServer::CheckIfStarted - Started" )
+            break;
+            }
+        case EIdle:
+            {
+            MPMLOGSTRING( "CMPMServer::CheckIfStarted - Idle" )
+            break;
+            }
+        case ERoaming:
+            {
+            MPMLOGSTRING( "CMPMServer::CheckIfStarted - Roaming" )
+            break;
+            }
+        default:
+            {
+            MPMLOGSTRING( "CMPMServer::CheckIfStarted - Unknown" )
+            break;
+            }
+        }
+#endif // _DEBUG
+
+    if ( state == EStarted )
+        {
+        return ETrue;
+        }
+    else
+        {
+        return EFalse;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServer::IsWlanConnectionStartedL
+// -----------------------------------------------------------------------------
+//
+TUint32 CMPMServer::IsWlanConnectionStartedL( const CMPMCommsDatAccess* aCdbAccess )
+    {
+    TUint32 iapId( 0 );
+    
+    MPMLOGSTRING( "CMPMServer::IsWlanConnectionStartedL" )
+
+    TBool stopLoop( EFalse );
+
+    // Loop all connections until EStarted is found or no more connections
+    // 
+    for ( TInt i = 0; ( ( i < iActiveBMConns.Count() ) && !stopLoop ); i++ )
+        {
+        // Check if IAP Id matches
+        // 
+        if ( iActiveBMConns[i].iConnInfo.iState == EStarting ||
+             iActiveBMConns[i].iConnInfo.iState == EStarted )
+            {
+            if ( aCdbAccess->CheckWlanL( iActiveBMConns[i].iConnInfo.iIapId ) != ENotWlanIap )
+                {
+                stopLoop = ETrue;
+                iapId = iActiveBMConns[i].iConnInfo.iIapId;
+                MPMLOGSTRING2( "CMPMServer::IsWlanConnectionStartedL, found wlan iap %d", iapId )
+                }
+            }
+        }
+
+    
+    return iapId;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServer::AppendBMIAPConnectionL
+// -----------------------------------------------------------------------------
+//
+void CMPMServer::AppendBMIAPConnectionL( const TUint32       aIapId, 
+                                         const TConnectionId aConnId,
+                                         CMPMServerSession& aSession )
+    {
+    MPMLOGSTRING3(
+        "CMPMServer::AppendBMIAPConnectionL - aIapId = %i, aConnId = 0x%x", 
+        aIapId, aConnId )
+
+    TActiveBMConn conn;
+    conn.iConnInfo.iIapId = aIapId;
+    conn.iConnInfo.iState = EStarted;
+    conn.iConnInfo.iAppUid = aSession.AppUid();
+    
+    TInt index1 = iActiveBMConns.Find( conn, TActiveBMConn::MatchIapId );
+
+    if ( index1 == KErrNotFound )
+        {
+        // If this Iap is not yet there, insert it at the end of array
+        //
+        iActiveBMConns.AppendL( conn );
+        }
+    else
+        {
+        // Iap already active, update connection state as started. 
+        // This Iap could be shared by multiple applications, but 
+        // update only the one with matching connection id.
+        //
+        for ( TInt i = 0; i < iActiveBMConns.Count(); i++ )
+            {
+            if ( iActiveBMConns[i].iConnInfo.iConnId == aConnId )
+                {
+                iActiveBMConns[i].iConnInfo.iState = EStarted;
+                }
+            else if ( iActiveBMConns[i].iConnInfo.iSnap == 0 &&
+                    iActiveBMConns[i].iConnInfo.iIapId == aIapId )
+                {
+                iActiveBMConns[i].iConnInfo.iState = EStarted;
+                }
+            }
+        }
+
+    TInt ret = KErrNone;
+        
+    TRAP ( ret, UpdateActiveConnectionL( aSession ) );
+        
+    if ( ret != KErrNone )
+        {
+        iActiveBearerType = EMPMBearerTypeNone;
+        iActiveIapId = 0;
+        iActiveSnapId = 0;            
+        }
+
+#ifdef _DEBUG
+    // Dump array of active connections to log in order to support testing.
+    // 
+    DumpActiveBMConns();
+#endif // _DEBUG
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServer::RemoveBMIAPConnection
+// -----------------------------------------------------------------------------
+//
+void CMPMServer::RemoveBMIAPConnection( const TUint32       aIapId, 
+                                        const TConnectionId aConnId,
+                                        CMPMServerSession&  aSession )
+    {
+    MPMLOGSTRING3(
+        "CMPMServer::RemoveBMIAPConnection - aIapId = %i, aConnId = 0x%x", 
+        aIapId, aConnId )
+
+    TActiveBMConn conn;
+    conn.iConnInfo.iIapId = aIapId;
+
+    // The IAP connection lifetime is determined by the two calls 
+    // IAPConnectionStarted and IAPConnectionStopped. 
+    //
+    TInt count = iActiveBMConns.Count();
+
+    // Decrement by one, because count is n, 
+    // but indexes in array are 0 .. n-1.
+    // 
+    count--;
+
+    // This time we are browsing the array from the end to the beginning, 
+    // because removing one element from array affects index numbering.
+    // 
+    for ( TInt i = count; i >= 0; i-- )
+        {
+        if ( iActiveBMConns[i].iConnInfo.iIapId == aIapId )
+            {
+            if ( iActiveBMConns[i].iConnInfo.iSnap == 0 )
+                {
+                // If IAPConnectionStopped has been called and SNAP is zero,
+                // then this entry can be removed from database.
+                // 
+                iActiveBMConns.Remove( i );
+                }
+            else
+                {
+                // If IAP found, reset the Iap Id as zero and 
+                // update connection state as idle.
+                // This Iap could be shared by multiple applications, 
+                // but update only the one with matching connection id.
+                // 
+                if ( iActiveBMConns[i].iConnInfo.iConnId == aConnId )
+                    {
+                    iActiveBMConns[i].iConnInfo.iIapId = 0;
+                    iActiveBMConns[i].iConnInfo.iState = EIdle;
+                    }
+                }
+            
+            // Update active connection
+            TInt ret = KErrNone;
+        
+            TRAP ( ret, UpdateActiveConnectionL( aSession ) );
+        
+            if ( ret != KErrNone )
+                {
+                iActiveBearerType = EMPMBearerTypeNone;
+                iActiveIapId = 0;
+                iActiveSnapId = 0;            
+                }
+            }
+        }
+
+#ifdef _DEBUG
+    // Dump array of active connections to log in order to support testing.
+    // 
+    DumpActiveBMConns();
+#endif // _DEBUG
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServer::AppendSessionL
+// -----------------------------------------------------------------------------
+//
+void CMPMServer::AppendSessionL( const CMPMServerSession* aSession )
+    {
+    MPMLOGSTRING( "CMPMServer::AppendSession" )
+    
+    iSessions.AppendL( aSession );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServer::RemoveSession
+// -----------------------------------------------------------------------------
+//
+void CMPMServer::RemoveSession( const CMPMServerSession* aSession )
+    {
+    MPMLOGSTRING( "CMPMServer::RemoveSession" )
+
+    TInt index = iSessions.Find( aSession );
+    if ( index != KErrNotFound )
+        {
+        iSessions.Remove( index );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServer::NotifyBMPrefIapL
+// -----------------------------------------------------------------------------
+//
+void CMPMServer::NotifyBMPrefIapL( const TConnMonIapInfo& aIapInfo )
+    {
+    MPMLOGSTRING2( "CMPMServer::NotifyBMPrefIapL - IAPs count: %d", 
+        aIapInfo.iCount)
+    TConnMonIapInfo iapInfo = aIapInfo;
+    
+#ifdef _DEBUG
+    for (TUint i = 0; i < iapInfo.Count(); i++)
+        {
+        MPMLOGSTRING2( "CMPMServer::NotifyBMPrefIap - IAP: %d", 
+            iapInfo.iIap[i].iIapId) 
+        }
+#endif // _DEBUG
+
+    // Start possible forced roaming
+    TCmUsageOfWlan usageOfWlan = CommsDatAccess()->ForcedRoamingL();
+    if ( usageOfWlan == ECmUsageOfWlanKnown || usageOfWlan == ECmUsageOfWlanKnownAndNew )
+        {
+        StartForcedRoamingToWlanL( iapInfo );
+        StartForcedRoamingFromWlanL( iapInfo );
+        }
+    
+    MPMLOGSTRING2(
+    "CMPMServer::NotifyBMPrefIapL - Send notifications for %d sessions", 
+        iSessions.Count() )
+
+    for ( TInt i = 0; i < iSessions.Count(); i++ )
+        {
+        iapInfo = iSessions[i]->GetAvailableIAPs( );
+        iSessions[i]->PrefIAPNotificationL( iapInfo, EConnMon );
+        }
+
+    // If a session is displaying connection selection dialog 
+    // the contents of the dialog should be updated according to the 
+    // current iap availability
+    //
+    for ( TInt i( 0 ); i < iSessions.Count(); i++ )
+        {
+        iSessions[i]->UpdateConnectionDialogL();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServer::UpdateSessionConnectionDlgL
+// -----------------------------------------------------------------------------
+//
+void CMPMServer::UpdateSessionConnectionDlgL()
+    {
+    MPMLOGSTRING( "CMPMServer::UpdateSessionConnectionDlgL" )
+
+    // If a session is displaying connection selection dialog 
+    // the contents of the dialog should be updated according to the 
+    // current iap availability
+    //
+    for ( TInt i( 0 ); i < iSessions.Count(); i++ )
+        {
+        iSessions[i]->UpdateConnectionDialogL();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServer::HandleServerBlackListIap
+// -----------------------------------------------------------------------------
+//
+TInt CMPMServer::HandleServerBlackListIap( const TConnectionId  aConnId,
+                                           TUint32              aIapId, 
+                                           TBlacklistCategory   aCategory )
+    {
+    MPMLOGSTRING3(
+        "CMPMServer::HandleServerBlackListIap - aConnId = 0x%x, iapId = %i",
+        aConnId, aIapId )
+
+    MPMLOGSTRING2(
+        "CMPMServer::HandleServerBlackListIap - aCategory = %i", aCategory )
+
+    BlackListIap( aConnId, aIapId, aCategory ); 
+
+    TUint32 presumedIap = Events()->PresumedIapId( aConnId, 
+                                                   aIapId );
+    if ( ( presumedIap != 0 ) && 
+         ( presumedIap != aIapId ) )
+        {
+        MPMLOGSTRING2(
+            "CMPMServer::HandleServerBlackListIap - presumedIap = %i",
+            presumedIap )
+        BlackListIap( aConnId, presumedIap, aCategory ); 
+        }
+
+    return KErrNone;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServer::BlackListIap
+// -----------------------------------------------------------------------------
+//
+TInt CMPMServer::BlackListIap( const TConnectionId  aConnId,
+                               TUint32              aIapId, 
+                               TBlacklistCategory   aCategory )
+    {
+    TInt i;
+    TBool found = EFalse;
+
+    found = FindBlacklistedConnIndex( aConnId, i );
+    if ( found )
+        {
+        TMPMBlackListConnId connIdInfo = iBlackListIdList[i];
+        connIdInfo.Append( aIapId, aCategory );
+        iBlackListIdList.Remove( i );
+        iBlackListIdList.Insert( connIdInfo, 0 );
+        }
+    else
+        {
+        TMPMBlackListConnId connIdInfo;
+        connIdInfo.iConnId = aConnId;
+        connIdInfo.Append( aIapId, aCategory );
+        iBlackListIdList.Insert( connIdInfo, 0 );
+        }
+
+    return KErrNone;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServer::HandleServerUnblackListIap
+// -----------------------------------------------------------------------------
+//
+TInt CMPMServer::HandleServerUnblackListIap( 
+    const TConnectionId aConnId,
+    TUint32             aIapId )
+    {
+    MPMLOGSTRING3(
+        "CMPMServer::HandleServerUnblackListIap - aConnId = 0x%x, iapId = %i"
+        ,aConnId, aIapId )
+
+    TInt i;
+    TBool found = EFalse;
+
+    found = FindBlacklistedConnIndex( aConnId, i );
+    if ( found )
+        {
+        // found blacklisted Connection Id
+        TMPMBlackListConnId connIdInfo = iBlackListIdList[i];
+        iBlackListIdList.Remove( i ); // remove from the list 
+
+        if ( aIapId == 0 )
+            { // 0 will reset Connection Id blacklisted iap list 
+            connIdInfo.Close();
+            return KErrNone;
+            }
+
+        found = EFalse;
+        for (TInt j = 0; j < connIdInfo.Count(); j++)
+            {
+            if ( connIdInfo.Iap( j ) == aIapId )
+                {
+                // found and remove blacklisted iap
+                connIdInfo.Remove( j ); 
+                if ( connIdInfo.Count() == 0 )
+                    {
+                    return KErrNone;
+                    }
+
+                // reinsert connIdInfo at the beginning to reflect activeness
+                iBlackListIdList.Insert( connIdInfo, 0 ); 
+                return KErrNone;
+                }
+            }
+        // nothing found and reinsert at the beginning 
+        // connIdInfo to reflect activeness
+        iBlackListIdList.Insert( connIdInfo, 0 ); 
+        return KErrNotFound;
+        }
+    else
+        {
+        return KErrNotFound;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServer::HandleServerUnblackListIap
+// -----------------------------------------------------------------------------
+//
+TInt CMPMServer::HandleServerUnblackListIap( 
+    const TConnectionId aConnId,
+    TBlacklistCategory  aCategory )
+    {
+    MPMLOGSTRING3( "CMPMServer::HandleServerUnblackListIap -\
+ aConnId = 0x%x, aCategory = %i", aConnId, aCategory )
+
+    TInt i;
+    TBool found = EFalse;
+
+    found = FindBlacklistedConnIndex( aConnId, i );
+    if ( found )
+        {
+        // found blacklisted Connection Id
+        TMPMBlackListConnId connIdInfo = iBlackListIdList[i];
+        iBlackListIdList.Remove( i ); // remove from the list 
+
+        found = EFalse;
+        for (TInt j = 0; j < connIdInfo.Count(); j++)
+            {
+            if ( connIdInfo.Category( j ) == aCategory ) 
+                {
+                // found and remove blacklisted iap
+                connIdInfo.Remove( j ); 
+                if ( connIdInfo.Count() == 0 )
+                    {
+                    return KErrNone;
+                    }
+
+                // reinsert connIdInfo at the beginning to reflect activeness
+                iBlackListIdList.Insert( connIdInfo, 0 ); 
+                return KErrNone;
+                }
+            }
+        // nothing found and reinsert at the beginning 
+        // connIdInfo to reflect activeness
+        iBlackListIdList.Insert( connIdInfo, 0 ); 
+        return KErrNotFound;
+        }
+    else
+        {
+        return KErrNotFound;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServer::HandleServerUnblackListIap
+// -----------------------------------------------------------------------------
+//
+void CMPMServer::HandleServerUnblackListIap( 
+    TBlacklistCategory  aCategory )
+    {
+    MPMLOGSTRING2( "CMPMServer::HandleServerUnblackListIap -\
+ aCategory = %i", aCategory )
+
+    for( TInt i( 0 ); i < iBlackListIdList.Count(); i++ )
+        {
+        // found blacklisted Connection Id
+        TMPMBlackListConnId connIdInfo = iBlackListIdList[i];
+        iBlackListIdList.Remove( i ); // remove from the list 
+
+        for (TInt j = 0; j < connIdInfo.Count(); j++)
+            {
+            if ( connIdInfo.Category( j ) == aCategory ) 
+                {
+                // found and remove blacklisted iap
+                connIdInfo.Remove( j ); 
+                }
+            }
+        // If any blacklisted iaps remain reinsert at the 
+        // beginning connIdInfo to reflect activeness
+        //
+        if( connIdInfo.Count() > 0 )
+            {
+            iBlackListIdList.Insert( connIdInfo, 0 );             
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServer::GetBlacklistedIAP
+// -----------------------------------------------------------------------------
+//
+TInt CMPMServer::GetBlacklistedIAP( TConnectionId    aConnId, 
+                                    RArray<TUint32> &aBlacklistedIAP )
+    {
+    TInt  i;
+    TBool found = EFalse;
+
+    found = FindBlacklistedConnIndex( aConnId, i );
+    if ( !found )
+        {
+        return KErrNotFound;
+        }
+
+    TMPMBlackListConnId connIdInfo = iBlackListIdList[i];
+    iBlackListIdList.Remove( i );
+    iBlackListIdList.Insert( connIdInfo, 0 );
+
+    for (TInt j = 0; j < connIdInfo.Count(); j++)
+        {
+        aBlacklistedIAP.Append( connIdInfo.Iap( j ) );
+        }
+
+    return KErrNone;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServer::GetBlacklistedIAP
+// -----------------------------------------------------------------------------
+//
+TInt CMPMServer::GetBlacklistedIAP( RArray<TUint32> &aBlacklistedIAP )
+    {
+    // Returns all blacklisted IAPs regardless of Connection Id 
+    // 
+    for ( TInt i( 0 ); i < iBlackListIdList.Count(); i++ )
+        {
+        for ( TInt j( 0 ); j < iBlackListIdList[i].Count(); 
+              j++ )
+            {
+            // Inserts an object into the array in ascending unsigned 
+            // key order. No duplicate entries are permitted. 
+            // 
+            // The array remains unchanged following an attempt to 
+            // insert a duplicate entry.
+            // 
+            aBlacklistedIAP.InsertInUnsignedKeyOrder( 
+                                    iBlackListIdList[i].Iap( j ) );
+            }
+        }
+    return KErrNone;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServer::FindId
+// -----------------------------------------------------------------------------
+//
+TBool CMPMServer::FindBlacklistedConnIndex( const TConnectionId aConnId, 
+                                            TInt                &aIndex )
+    {
+    TInt  i;
+    TBool found = EFalse;
+
+    for (i = 0;( (i < iBlackListIdList.Count()) && !found ); i++)
+        {
+        if ( iBlackListIdList[i].iConnId == aConnId )
+            {
+            found = ETrue;
+            }
+        }
+    i--; // Since i is incremented after finding the correct iConnId
+    aIndex = i;
+    return found;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServer::IsVoiceCallActiveL
+// 
+// Checks if voice call is active or not.
+// Return ETrue if voice call is active.
+// Return EFalse if voice call is not active.
+// -----------------------------------------------------------------------------
+//
+TBool CMPMServer::IsVoiceCallActiveL() const
+    {
+    MPMLOGSTRING( "CMPMServer::IsVoiceCallActiveL" )
+
+    CTelephony*                   telephony = CTelephony::NewLC();
+    CTelephony::TCallStatusV1     callStatusV1;
+    CTelephony::TCallStatusV1Pckg callStatusV1Pckg( callStatusV1 );
+    CTelephony::TPhoneLine        line = CTelephony::EVoiceLine;
+
+    telephony->GetLineStatus( line, callStatusV1Pckg );
+    CTelephony::TCallStatus voiceLineStatus = callStatusV1.iStatus;
+
+    CleanupStack::PopAndDestroy( telephony );
+
+    if ( voiceLineStatus == CTelephony::EStatusDialling         ||
+         voiceLineStatus == CTelephony::EStatusRinging          ||
+         voiceLineStatus == CTelephony::EStatusAnswering        ||
+         voiceLineStatus == CTelephony::EStatusConnecting       ||
+         voiceLineStatus == CTelephony::EStatusConnected        ||
+         voiceLineStatus == CTelephony::EStatusReconnectPending ||
+         voiceLineStatus == CTelephony::EStatusDisconnecting    ||
+         voiceLineStatus == CTelephony::EStatusHold             ||
+         voiceLineStatus == CTelephony::EStatusTransferring     ||
+         voiceLineStatus == CTelephony::EStatusTransferAlerting  )
+        {
+        MPMLOGSTRING2(
+            "CMPMServer::IsVoiceCallActiveL Voice call is active: %d", 
+            voiceLineStatus )
+        return ETrue;
+        }
+    else if ( voiceLineStatus == CTelephony::EStatusIdle ||
+              voiceLineStatus == CTelephony::EStatusUnknown )
+        {
+        MPMLOGSTRING2(
+            "CMPMServer::IsVoiceCallActiveL Voice call is not active: %d", 
+            voiceLineStatus )
+        return EFalse;
+        }
+    else
+        {
+        MPMLOGSTRING2(
+            "CMPMServer::IsVoiceCallActiveL Unknown voice line status: %d", 
+            voiceLineStatus )
+        return EFalse;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServer::IsModeGSM
+// 
+// Checks if mode is GSM or not.
+// Return ETrue if mode is GSM.
+// Return EFalse if mode is something else.
+// -----------------------------------------------------------------------------
+//
+TBool CMPMServer::IsModeGSM() const
+    {
+    MPMLOGSTRING( "CMPMServer::IsModeGSM" )
+
+    if ( iTSYLoaded )
+        {
+        RMobilePhone::TMobilePhoneNetworkMode mode( 
+            RMobilePhone::ENetworkModeUnknown );
+
+        TInt ret = iMobilePhone.GetCurrentMode( mode );
+
+        if ( ( ret == KErrNone ) && 
+             ( mode == RMobilePhone::ENetworkModeGsm ) )
+            {
+            MPMLOGSTRING( "CMPMServer::IsModeGSM Mode is GSM" )
+            return ETrue;
+            }
+        else
+            {
+            MPMLOGSTRING( "CMPMServer::IsModeGSM Mode is not GSM" )
+            return EFalse;
+            }
+        }
+    MPMLOGSTRING( "CMPMServer::IsModeGSM phone.tsy not loaded" )
+    return EFalse;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServer::IsDTMSupported
+// 
+// Checks if phone supports Dual Transfer Mode or not.
+// Return ETrue if phone supports DTM.
+// Return EFalse if phone does not support DTM.
+// -----------------------------------------------------------------------------
+//
+TBool CMPMServer::IsDTMSupported() const
+    {
+    MPMLOGSTRING( "CMPMServer::IsDTMSupported" )
+
+    if ( iPacketServLoaded )
+        {
+        TBool rv = iDtmWatcher->IsInDualMode();
+        if ( rv )
+            {
+            MPMLOGSTRING( "CMPMServer::IsDTMSupported DTM is supported" )
+            }
+        else
+            {
+            MPMLOGSTRING( "CMPMServer::IsDTMSupported DTM is not supported" )
+            }
+        return rv;
+        }
+ 
+    MPMLOGSTRING( "CMPMServer::IsDTMSupported Packet service not loaded" )
+    return EFalse;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServer::DumpActiveBMConns
+// -----------------------------------------------------------------------------
+//
+void CMPMServer::DumpActiveBMConns()
+    {
+#ifdef _DEBUG
+    // Dump array of active connections to log in order to support testing.
+    // 
+    MPMLOGSTRING( "Display array of active connections - Start" )
+    MPMLOGSTRING( "" )
+
+    if ( iActiveBMConns.Count() == 0 )
+        {
+        MPMLOGSTRING( "Array of active connections is empty" )
+        MPMLOGSTRING( "" )
+        }
+
+    for ( TInt i = 0; i < iActiveBMConns.Count(); i++ )
+        {
+        MPMLOGSTRING3( "Connection Id = 0x%x Snap = %i", 
+            iActiveBMConns[i].iConnInfo.iConnId, 
+            iActiveBMConns[i].iConnInfo.iSnap )
+
+        switch( iActiveBMConns[i].iConnInfo.iState )
+            {
+            case EStarting:
+                {
+                MPMLOGSTRING2( "IAP %i: Connection state = Starting", 
+                    iActiveBMConns[i].iConnInfo.iIapId )
+                break;
+                }
+            case EStarted:
+                {
+                MPMLOGSTRING2( "IAP %i: Connection state = Started", 
+                    iActiveBMConns[i].iConnInfo.iIapId )
+                break;
+                }
+            case EIdle:
+                {
+                MPMLOGSTRING2( "IAP %i: Connection state = Idle", 
+                    iActiveBMConns[i].iConnInfo.iIapId )
+                break;
+                }
+            case ERoaming:
+                {
+                MPMLOGSTRING2( "IAP %i: Connection state = Roaming", 
+                    iActiveBMConns[i].iConnInfo.iIapId )
+                break;
+                }
+            default:
+                {
+                MPMLOGSTRING2( "IAP %i: Unknown connection state", 
+                    iActiveBMConns[i].iConnInfo.iIapId )
+                break;
+                }
+            }
+
+        MPMLOGSTRING( "" )
+        }
+
+    MPMLOGSTRING( "Display array of active connections - End" )
+#endif // _DEBUG
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServer::DefaultConnection
+// -----------------------------------------------------------------------------
+//
+CMPMDefaultConnection* CMPMServer::DefaultConnection()
+    {
+    MPMLOGSTRING( "CMPMServer::DefaultConnection:\
+ Default Connection" )
+    return iDefaultConnection;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServer::StartedConnectionExists
+// -----------------------------------------------------------------------------
+//
+TInt CMPMServer::StartedConnectionExists( TInt aIapId )
+    {
+    MPMLOGSTRING( "CMPMServer::StartedConnectionExists" )
+
+    // Loop all connections until EStarted is found or no more connections
+    // 
+    for ( TInt i = 0; ( i < iActiveBMConns.Count() ); i++ )
+        {
+        if ( iActiveBMConns[i].iConnInfo.iState == EStarted &&
+                ( aIapId == KErrNotFound || aIapId == iActiveBMConns[i].iConnInfo.iIapId ) )
+            {
+            MPMLOGSTRING( "CMPMServer::StartedConnectionExists: True" )
+            return iActiveBMConns[i].iConnInfo.iIapId;
+            }
+        }
+    // Modem connection may exist, check from connection counter
+    // 
+    if ( ConnectionCounter() > 0 )
+        {
+        MPMLOGSTRING( "CMPMServer::StartedConnectionExists: True (modem connection)" )
+        return KMaxTInt; // arbitrary high number that is NOT from Iap range[0:255] 
+        }
+    else
+        {
+        MPMLOGSTRING( "CMPMServer::StartedConnectionExists: False" )
+        return KErrNotFound;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServer::AppendWlanQueryQueueL
+// -----------------------------------------------------------------------------
+//
+void CMPMServer::AppendWlanQueryQueueL( CMPMWlanQueryDialog* aDlg )
+    {
+    if( aDlg )
+        {
+        iWlanQueryQueue->AppendL( aDlg );
+        }
+    else
+        {
+        MPMLOGSTRING( "CMPMServer::AppendWlanQueryQueueL argument NULL, Error" )
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServer::StopConnections
+// -----------------------------------------------------------------------------
+//
+void CMPMServer::StopConnections( TInt aIapId )
+    {
+    for (TInt index = 0; index < iSessions.Count(); index++)
+        {
+/*        if (iSessions[index]->UserConnection())
+            continue;
+  */          
+        // Stop connection
+        if ( aIapId == 0 )
+            {
+            iSessions[index]->StopConnection();
+            }
+        else
+            {
+            TRAP_IGNORE( iSessions[index]->StopIAPNotificationL( aIapId ));
+            }
+        
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServer::UpdateActiveConnectionL
+// -----------------------------------------------------------------------------
+//
+void CMPMServer::UpdateActiveConnectionL( CMPMServerSession& aSession )
+    {
+    MPMLOGSTRING( "CMPMServer::UpdateActiveConnectionL" )
+    TUint32 snapId;
+
+    if ( !NumberOfActiveConnections() )
+        {
+        // If no active connections then just reset keys and publish
+        iActiveBearerType = EMPMBearerTypeNone;
+        iActiveIapId = 0;
+        iActiveSnapId = 0;
+        PublishActiveConnection();
+        return;
+        }
+
+    // Check if all active connections are in same snap
+    if ( CommsDatAccess()->AreActiveIapsInSameSnapL(
+         iActiveBMConns, snapId ) )
+        {
+        // Select active connection according to priority
+        CommsDatAccess()->SelectActiveConnectionL (
+            snapId,
+            iActiveBMConns,
+            iActiveIapId,
+            iActiveSnapId,
+            iActiveBearerType,
+            aSession );
+
+        PublishActiveConnection();
+        return;
+        }
+
+    // Reset active connections
+    iActiveBearerType = EMPMBearerTypeNone;
+    iActiveIapId = 0;
+    iActiveSnapId = 0;
+            
+    // Active connections locating in different snaps
+    // Use priority order vpn, wlan and packet
+    for ( TInt index = 0; index < iActiveBMConns.Count(); index++ )
+        {
+        // Do check only for active connections
+        if ( iActiveBMConns[index].iConnInfo.iState == EStarted )
+            {
+            TMPMBearerType bearerType = EMPMBearerTypeOther;
+        
+            if ( iDedicatedClients.Find( iActiveBMConns[index].iConnInfo.iAppUid ) == 
+                 KErrNone )
+                {
+                // Skip dedicated client
+                continue;
+                }
+
+            bearerType = CommsDatAccess()->GetBearerTypeL( 
+                         iActiveBMConns[index].iConnInfo.iIapId );
+        
+            if ( bearerType == EMPMBearerTypeOther )
+                {
+                // Don't publish this connection
+                continue;
+                }
+                    
+            // This is true if,
+            // bearer type is smaller or different than none
+            // or
+            // bearer type is same and iap is different.
+            if ( ( bearerType < iActiveBearerType ) || 
+                 ( iActiveBearerType == EMPMBearerTypeNone ) ||
+                 ( ( bearerType == iActiveBearerType) &&
+                   ( iActiveIapId != iActiveBMConns[index].iConnInfo.iIapId ) ) )
+                {
+                iActiveBearerType = bearerType;
+                iActiveIapId = iActiveBMConns[index].iConnInfo.iIapId;
+                iActiveSnapId = iActiveBMConns[index].iConnInfo.iSnap;
+                }
+            }
+
+        PublishActiveConnection();  
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServer::MapBearerType
+// -----------------------------------------------------------------------------
+//
+TUint32 CMPMServer::MapBearerType(TMPMBearerType aBearerType)
+    {
+    MPMLOGSTRING( "CMPMServer::MapBearerType" )
+    
+    switch ( aBearerType )
+        {
+        case EMPMBearerTypeNone:
+            return 0;
+
+        case EMPMBearerTypeVpn:
+            return KCommDbBearerVirtual;
+            
+        case EMPMBearerTypeWlan:
+            return KCommDbBearerWLAN;
+            
+        case EMPMBearerTypePacketData:
+            return KCommDbBearerWcdma;
+
+        case EMPMBearerTypeOther:
+            return KCommDbBearerUnknown;
+            
+        default:
+            MPMLOGSTRING( "CMPMServer::MapBearerType: Unknown bearer type" )
+            break;
+        }
+    
+    return KCommDbBearerUnknown;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServer::PublishActiveConnection
+// -----------------------------------------------------------------------------
+//
+void CMPMServer::PublishActiveConnection()
+    {
+    MPMLOGSTRING( "CMPMServer::PublishActiveConnection" )
+    
+    // update active connection keys
+    RProperty::Set( KMPMActiveConnectionCategory,
+                    KMPMPSKeyActiveConnectionIap,
+                    iActiveIapId );
+
+    RProperty::Set( KMPMActiveConnectionCategory,
+                    KMPMPSKeyActiveConnectionSnap,
+                    iActiveSnapId );
+
+    RProperty::Set( KMPMActiveConnectionCategory,
+                    KMPMPSKeyActiveConnectionBearer,
+                    MapBearerType( iActiveBearerType ) );    
+
+    MPMLOGSTRING4( "CMPMServer::PublishActiveConnection: Set to: %d, %d, %d",
+                   iActiveIapId, iActiveSnapId, iActiveBearerType )
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServer::NumberOfActiveConnections
+// -----------------------------------------------------------------------------
+//
+TInt CMPMServer::NumberOfActiveConnections()
+    {
+    MPMLOGSTRING( "CMPMServer::NumberOfActiveConnections" )
+    
+    TInt count( 0 );
+    
+    for ( TInt index = 0; index < iActiveBMConns.Count(); index++ )
+        {
+        if ( iActiveBMConns[index].iConnInfo.iState == EStarted )
+            {
+            count++;
+            }
+        }
+    
+    return count;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServer::UserConnectionInInternet
+// -----------------------------------------------------------------------------
+//
+TBool CMPMServer::UserConnectionInInternet() const
+    {
+    TBool isInternet = EFalse;
+    TInt ret = KErrNone;
+        
+    TRAP( ret, isInternet = iCommsDatAccess->IsInternetSnapL(
+          UserConnPref()->IapId(), UserConnPref()->SnapId() ) );
+
+    if ( ret != KErrNone )
+        {
+        isInternet = EFalse;
+        }
+    
+    return isInternet;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServer::StartForcedRoamingToWlanL
+// -----------------------------------------------------------------------------
+//
+void CMPMServer::StartForcedRoamingToWlanL( const TConnMonIapInfo& aIapInfo )
+    {
+    MPMLOGSTRING( "CMPMServer::StartForcedRoamingToWlan" )
+
+    // First check that there is no active wlan connection
+    if ( IsWlanConnectionStartedL( CommsDatAccess() ) )
+        {
+        // Wlan already active can't roam to it
+        return;
+        }
+
+    // Copy all available wlan iap ids to own array
+    RArray<TUint32> wlanIapIds;
+    CleanupClosePushL( wlanIapIds );
+    RAvailableIAPList iapList;
+    CleanupClosePushL( iapList );
+
+    for ( TInt index = 0; index < aIapInfo.iCount; index++ )
+        {
+        if ( CommsDatAccess()->CheckWlanL( aIapInfo.iIap[index].iIapId ) != ENotWlanIap )
+            {
+            // Accept only wlan iaps in internet snap
+            if ( iCommsDatAccess->IsInternetSnapL( aIapInfo.iIap[index].iIapId, 0 ) )
+                {
+                wlanIapIds.AppendL( aIapInfo.iIap[index].iIapId );
+                }
+            }
+        // Fill iap list to be used later to check best iap
+        iapList.AppendL( aIapInfo.iIap[index].iIapId );
+        }
+
+    // No wlans available -> no reason to continue
+    if ( !wlanIapIds.Count() )
+        {
+        CleanupStack::PopAndDestroy( &iapList );
+        CleanupStack::PopAndDestroy( &wlanIapIds );
+        return;
+        }
+
+    // Go through all active connections and start roaming for the ones connected
+    // to snap containing wlan and not using mobility api
+    for ( TInt index = 0; index < iActiveBMConns.Count(); index++ )
+        {
+        // Check if snap is internet snap
+        TBool internetSnap =
+            iCommsDatAccess->IsInternetSnapL(
+                iActiveBMConns[index].iConnInfo.iIapId,
+                iActiveBMConns[index].iConnInfo.iSnap );
+
+        CMPMServerSession* serverSession = GetServerSession(
+                iActiveBMConns[index].iConnInfo.iConnId );
+
+        // Check that connection is started, established to snap and
+        // choose best iap is called for the connection
+        if ( ( iActiveBMConns[index].iConnInfo.iState == EStarted ) &&
+             ( iActiveBMConns[index].iConnInfo.iSnap ) && 
+             ( serverSession->ChooseBestIapCalled() ) &&
+             ( internetSnap ) )
+            {
+            // Notify client to disconnect
+            NotifyDisconnectL( index, wlanIapIds, iapList, ETrue,
+                EMPMBearerTypeWlan );
+            }
+        }
+    CleanupStack::PopAndDestroy( &iapList );
+    CleanupStack::PopAndDestroy( &wlanIapIds );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServer::StartForcedRoamingFromWlanL
+// -----------------------------------------------------------------------------
+//
+void CMPMServer::StartForcedRoamingFromWlanL( const TConnMonIapInfo& aIapInfo )
+    {
+    MPMLOGSTRING( "CMPMServer::StartForcedRoamingFromWlan" )
+
+    // Copy all available packet data iap ids to own array
+    RArray<TUint32> packetDataIapIds;
+    CleanupClosePushL( packetDataIapIds );
+
+    for ( TInt index = 0; index < aIapInfo.iCount; index++ )
+        {
+        if ( CommsDatAccess()->GetBearerTypeL( aIapInfo.iIap[index].iIapId ) ==
+            EMPMBearerTypePacketData )
+            {
+            // Accept only packet data iaps in internet snap
+            if ( iCommsDatAccess->IsInternetSnapL( aIapInfo.iIap[index].iIapId, 0 ) )
+                {
+                packetDataIapIds.AppendL( aIapInfo.iIap[index].iIapId );
+                }
+            }
+        }
+
+    // No packet data iaps available -> no reason to continue
+    if ( !packetDataIapIds.Count() )
+        {
+        CleanupStack::PopAndDestroy( &packetDataIapIds );
+        return;
+        }
+    
+    // Go through all active connections and start roaming for the ones connected
+    // to a wlan not anymore listed in available iaps and not using mobility api
+    for ( TInt index = 0; index < iActiveBMConns.Count(); index++ )
+        {
+        if ( iCommsDatAccess->CheckWlanL( iActiveBMConns[index].iConnInfo.iIapId )
+            == EWlanIap )
+            {
+            // Check if used WLAN is still available
+            TBool currentWlanIapAvailable = EFalse;
+            for ( TInt iapIndex = 0; iapIndex < aIapInfo.iCount; iapIndex++ )
+                {
+                if ( aIapInfo.iIap[iapIndex].iIapId ==
+                    iActiveBMConns[index].iConnInfo.iIapId )
+                    {
+                    // Current WLAN IAP found from list of available IAPs
+                    currentWlanIapAvailable = ETrue;
+                    break;
+                    }
+                }
+            
+            if ( !currentWlanIapAvailable )
+                {
+                // Current WLAN not available anymore
+                // Check if snap is internet snap
+                TBool internetSnap = iCommsDatAccess->IsInternetSnapL(
+                    iActiveBMConns[index].iConnInfo.iIapId,
+                    iActiveBMConns[index].iConnInfo.iSnap );
+    
+                CMPMServerSession* serverSession = GetServerSession(
+                    iActiveBMConns[index].iConnInfo.iConnId );
+                
+                // Check that connection is started, established to snap,
+                // choose best iap is called for the connection
+                if ( ( iActiveBMConns[index].iConnInfo.iState == EStarted ) &&
+                    ( iActiveBMConns[index].iConnInfo.iSnap ) && 
+                    ( serverSession->ChooseBestIapCalled() ) &&
+                    ( internetSnap ) )
+                    {
+                    // Notify client to disconnect, don't check if current
+                    // WLAN IAP is the best because we want to disconnect
+                    // it anyway (it was not included in available IAP
+                    // list anymore)
+                    RAvailableIAPList iapList;
+                    CleanupClosePushL( iapList );
+                    NotifyDisconnectL( index, packetDataIapIds, iapList, EFalse,
+                        EMPMBearerTypePacketData );
+                    CleanupStack::PopAndDestroy( &iapList );
+                    }
+                }
+            }
+        }
+    CleanupStack::PopAndDestroy( &packetDataIapIds );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServer::NotifyDisconnectL
+// -----------------------------------------------------------------------------
+//
+void CMPMServer::NotifyDisconnectL( TInt aConnIndex,
+                                    RArray<TUint32>& aAvailIapIds,
+                                    RAvailableIAPList& aIapList,
+                                    TBool aCheckForBestIap,
+                                    TMPMBearerType aDestinationBearerType )
+    {
+    MPMLOGSTRING( "CMPMServer::NotifyDisconnectL" )
+    
+    // Get iaps in internet snap
+    RArray<TNetIap> destNetIds;
+    CleanupClosePushL( destNetIds );
+    CommsDatAccess()->SearchDNEntriesL( iActiveBMConns[aConnIndex].iConnInfo.iSnap,
+                                        destNetIds );
+
+    // Save available iaps in internet snap
+    RArray<TUint32> iapIdsInInternet;
+    CleanupClosePushL( iapIdsInInternet );
+                        
+    for ( TInt iIndex = 0; iIndex < destNetIds.Count(); iIndex++ )
+        {
+        for ( TInt wIndex = 0; wIndex < aAvailIapIds.Count(); wIndex++ )
+            {
+            if ( destNetIds[iIndex].iIapId == aAvailIapIds[wIndex] )
+                {
+                iapIdsInInternet.AppendL( destNetIds[iIndex].iIapId );
+                break;
+                }
+            }
+                    
+        if ( iapIdsInInternet.Count() )
+            {
+            // Leave loop when count is non-zero
+            break;
+            }
+        }
+
+    // Check if an iap in internet snap is available
+    if ( iapIdsInInternet.Count() )
+        {
+        // Find session and notify error
+        for (TInt sIndex = 0; sIndex < iSessions.Count(); sIndex++ )
+            {
+            // Check that CMPMIapSelection object exists for the session.
+            TRAPD( error, iSessions[sIndex]->IapSelectionL() );
+            if ( error == KErrNone )
+                {
+                MPMLOGSTRING( "CMPMServer::NotifyDisconnectL: IapSelectionL() != NULL" )
+                // Check the connection preferences for forced roaming
+                if ( iSessions[sIndex]->ForcedRoaming() )
+                    {
+                    MPMLOGSTRING( "CMPMServer::NotifyDisconnectL: ForcedRoaming == ETrue" )
+                    // Notify disconnect error for session,
+                    // if mobility api is not used
+                    if ( ( iSessions[sIndex]->ConnectionId() ==
+                        iActiveBMConns[aConnIndex].iConnInfo.iConnId ) &&
+                        !iSessions[sIndex]->PreferredIapRequested() &&
+                        iSessions[sIndex]->IsBearerAccepted( aDestinationBearerType ) )
+                        {
+                        if ( aCheckForBestIap )
+                            {
+                            // Check whether current IAP and the best IAP are the same.
+                            // Disconnection not done if IAPs are the same   
+                            TMpmConnPref connPref;
+                            connPref.SetIapId( 0 );
+                            connPref.SetSnapId(
+                                iActiveBMConns[aConnIndex].iConnInfo.iSnap );
+
+                            iSessions[sIndex]->IapSelectionL()->ChooseBestIAPL( connPref, aIapList );
+
+                            // if the best iap is the current iap, don't roam, move to next item
+                            if ( ( aIapList.Count() > 0 ) && 
+                                ( connPref.IapId() == iActiveBMConns[aConnIndex].iConnInfo.iIapId ) )
+                                {
+                                MPMLOGSTRING( "CMPMServer::NotifyDisconnectL: Same IAP selected. Disconnection not done." )
+                                break;
+                                }
+                            }
+    
+                        MPMLOGSTRING2( "CMPMServer::NotifyDisconnectL: \
+Disconnected Connection Id = 0x%x", iSessions[sIndex]->ConnectionId() )
+                        iSessions[sIndex]->ClientErrorNotificationL( KErrDisconnected );
+                        }
+                    }
+                }
+            }
+        }
+            
+    CleanupStack::PopAndDestroy( &iapIdsInInternet );
+    CleanupStack::PopAndDestroy( &destNetIds );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServer::IsVisitorNetwork
+// 
+// Checks if phone is in visitor network or in home network.
+// Return ETrue if phone is in visitor network.
+// Return EFalse if phone is not in visitor network.
+// -----------------------------------------------------------------------------
+//
+TBool CMPMServer::IsVisitorNetwork() const
+    {
+    MPMLOGSTRING( "CMPMServer::IsVisitorNetwork" )
+    
+    if ( iRoamingWatcher->RoamingStatus()== EMPMInternationalRoaming )
+        {
+        MPMLOGSTRING( "CMPMServer::IsVisitorNetwork: TRUE" )
+        return ETrue;
+        } 
+    else
+        {
+        MPMLOGSTRING( "CMPMServer::IsVisitorNetwork: FALSE" )
+        return EFalse;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServer::GetServerSession
+// -----------------------------------------------------------------------------
+//
+CMPMServerSession* CMPMServer::GetServerSession( TConnectionId aConnId ) const
+    {
+    MPMLOGSTRING2( "CMPMServer::GetServerSession: \
+Connection Id = 0x%x", aConnId );
+
+    CMPMServerSession* serverSession = NULL;
+    for ( TInt sIndex = 0; sIndex < iSessions.Count(); sIndex++ )
+        {
+        if ( iSessions[sIndex]->ConnectionId() == aConnId )
+            {
+            serverSession = iSessions[sIndex];
+            }
+        }
+
+    ASSERT( serverSession != NULL );
+
+    return serverSession;
+    }
+
+// -----------------------------------------------------------------------------
+// TMPMBlackListConnId::Append
+// -----------------------------------------------------------------------------
+//
+void TMPMBlackListConnId::Append( TUint32 aIap, TBlacklistCategory aCategory )
+    {
+    iBlackListIap.Append( aIap );
+    iCategory.Append( aCategory );
+    }
+
+// -----------------------------------------------------------------------------
+// TMPMBlackListConnId::Remove
+// -----------------------------------------------------------------------------
+//
+void TMPMBlackListConnId::Remove( TInt aIndex )
+    {
+    iBlackListIap.Remove( aIndex );
+    iCategory.Remove( aIndex );    
+    }
+
+// -----------------------------------------------------------------------------
+// TMPMBlackListConnId::Close
+// -----------------------------------------------------------------------------
+//
+void TMPMBlackListConnId::Close()
+    {
+    iBlackListIap.Close();
+    iCategory.Close();    
+    }
+
+// -----------------------------------------------------------------------------
+// TMPMBlackListConnId::Count
+// -----------------------------------------------------------------------------
+//
+TInt TMPMBlackListConnId::Count() const
+    {
+    return iBlackListIap.Count();
+    }
+
+// -----------------------------------------------------------------------------
+// TConnectionInfo::TConnectionInfo
+// -----------------------------------------------------------------------------
+//
+TConnectionInfo::TConnectionInfo() 
+    : iConnId( 0 ),
+      iSnap( 0 ),
+      iIapId( 0 ), 
+      iState( EIdle ),
+      iAppUid( 0 )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// TConnectionInfo::MatchId
+// -----------------------------------------------------------------------------
+//
+TBool TConnectionInfo::MatchId( const TConnectionInfo& aFirst,
+                                       const TConnectionInfo& aSecond )
+    {
+    if ( aFirst.iConnId == aSecond.iConnId )
+        {
+        return ETrue;
+        }
+    else
+        {
+        return EFalse;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// TConnectionInfo::MatchIdSnap
+// -----------------------------------------------------------------------------
+//
+TBool TConnectionInfo::MatchIdSnap( const TConnectionInfo& aFirst,
+                                    const TConnectionInfo& aSecond )
+    {
+    if ( ( aFirst.iConnId  == aSecond.iConnId ) &&
+         ( aFirst.iSnap    == aSecond.iSnap ) )
+        {
+        return ETrue;
+        }
+    else
+        {
+        return EFalse;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// TActiveBMConn::TActiveBMConn
+// -----------------------------------------------------------------------------
+//
+TActiveBMConn::TActiveBMConn() 
+    : iConnInfo()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// TActiveBMConn::MatchIapId
+// -----------------------------------------------------------------------------
+//
+TBool TActiveBMConn::MatchIapId( const TActiveBMConn& aFirst,
+                                 const TActiveBMConn& aSecond )
+    {
+    if ( aFirst.iConnInfo.iIapId == aSecond.iConnInfo.iIapId )
+        {
+        return ETrue;
+        }
+    else
+        {
+        return EFalse;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// TActiveBMConn::MatchConnInfo
+// -----------------------------------------------------------------------------
+//
+TBool TActiveBMConn::MatchConnInfo( const TActiveBMConn& aFirst,
+                                    const TActiveBMConn& aSecond )
+    { 
+    if ( TConnectionInfo::MatchId( aFirst.iConnInfo, aSecond.iConnInfo ) )
+        {
+        return ETrue;
+        }
+    else
+        {
+        return EFalse;
+        }
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/src/mpmserversession.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,3838 @@
+/*
+* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: MPM server session implementation
+*
+*/
+
+/**
+@file mpmserversession.cpp
+Mobility Policy Manager server session implementation.
+*/
+
+// INCLUDE FILES
+#include <e32svr.h>
+#include <gsmerror.h>     // KErrPacketDataTsyMaxPdpContextsReached 
+#include <etelpckt.h>     // KErrUmtsMaxNumOfContextExceededByNetwork
+#include <bldvariant.hrh>                // For feature flags
+#include <featmgr.h>                     // FeatureManager
+#include <centralrepository.h>           // CRepository 
+#include <CoreApplicationUIsSDKCRKeys.h> // KCRUidCoreApplicationUIs, 
+                                         // KCoreAppUIsNetworkConnectionAllowed
+#include <es_sock.h>
+#include <commdb.h>
+#include <commdbconnpref.h>
+#include <cmpluginbaseeng.h>
+#include <cdblen.h>
+#include <cmgenconnsettings.h>
+
+#include "mpmcommsdataccess.h"
+#include "mpmserversession.h"
+#include "mpmconnmonevents.h"
+#include "mpmdialog.h"
+#include "mpmdisconnectdlg.h"
+#include "mpmconfirmdlgstarting.h"
+#include "mpmconfirmdlgroaming.h"
+#include "mpmlogger.h"
+#include "mpmpropertydef.h"
+#include "mpmdefaultconnection.h"
+#include "mpmiapselection.h"
+#include "mpmcsidwatcher.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::NewL
+// -----------------------------------------------------------------------------
+//
+CMPMServerSession* CMPMServerSession::NewL(CMPMServer& aServer)
+    {
+    CMPMServerSession* self = new ( ELeave ) CMPMServerSession(aServer);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::CMPMServerSession
+// -----------------------------------------------------------------------------
+//
+CMPMServerSession::CMPMServerSession(CMPMServer& aServer)
+    : CSession2(), 
+      iMyServer( aServer ),
+      iDisconnectDlg( NULL ),
+      iConfirmDlgRoaming( NULL ),
+      iStoredIapInfo(),
+      iIapSelection( NULL ),
+      iMigrateState( EMigrateNone )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CMPMServerSession::ConstructL()
+    {
+    MPMLOGSTRING( "CMPMServerSession::ConstructL" )
+    if ( !iMyServer.Events() )
+        {
+        iMyServer.SetEvents(CMPMConnMonEvents::NewL(
+            *const_cast<CMPMServer*>( &iMyServer ), *this ));
+        }
+
+    FeatureManager::InitializeLibL();
+    iOfflineFeatureSupported = FeatureManager::FeatureSupported( 
+                                   KFeatureIdOfflineMode );
+ 
+     FeatureManager::UnInitializeLib();
+                                       
+    // Append session pointer to server
+    // 
+    iMyServer.AppendSessionL( this );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::~CMPMServerSession
+// -----------------------------------------------------------------------------
+//
+CMPMServerSession::~CMPMServerSession()
+    {
+    delete iDisconnectDlg;
+    delete iConfirmDlgRoaming;
+    delete iIapSelection;
+
+    // Remove serverside objects for notification session.
+    // 
+    iMyServer.RemoveSession( this );
+
+    if (UserConnection())
+        {
+        iMyServer.ClearUserConnection();
+        ClearUserConnection();
+        
+        // Set PS keys to zero
+        RProperty::Set( KMPMUserConnectionCategory,
+                        KMPMPSKeyUserConnectionSnap,
+                        0 );
+        
+        RProperty::Set( KMPMUserConnectionCategory,
+                        KMPMPSKeyUserConnectionIap,
+                        0 );
+        
+        MPMLOGSTRING( "CMPMServerSession::HandleServerApplicationConnectionEnds -\
+User connection deactivated" )
+        }   
+
+    // Make sure the connection is removed from server's information array.
+    iMyServer.RemoveBMConnection( iConnId, *this );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::ServiceL
+// -----------------------------------------------------------------------------
+//
+void CMPMServerSession::ServiceL( const RMessage2& aMessage )
+    {
+    switch ( aMessage.Function() )
+        {
+        case EMPMServerChooseIap:
+            {
+            HandleServerChooseIapL( aMessage );
+            break;
+            }
+        case EMPMServerCancelRequest:
+            {
+            HandleServerCancelRequest( aMessage );
+            break;
+            }
+        case EMPMServerApplicationLeavesConnection:
+            {
+            HandleServerApplicationLeavesConnection( aMessage );
+            break;
+            }
+        case EMPMServerIapConnectionStopped:
+            {
+            HandleServerIapConnectionStopped( aMessage );
+            break;
+            }
+        case EMPMServerProcessError:
+            {
+            HandleServerProcessErrorL( aMessage );
+            break;
+            }
+        case EMPMServerRegisterPrefIAPNotif:
+            {
+            HandleServerRegisterPrefIAPNotifL( aMessage ); 
+            break;
+            }
+        case EMPMServerUnregisterPrefIAPNotif:
+            {
+            HandleServerUnregisterPrefIAPNotif( aMessage );
+            break;
+            }
+        case EMPMServerWaitNotification:
+            {
+            HandleServerWaitNotificationL( aMessage );
+            break;                                              
+            }
+        case EMPMServerSortSNAP:
+            {
+            HandleServerSortSNAPL( aMessage ); 
+            break;
+            }
+        case EMPMServerApplicationJoinsConnection:
+            {
+            HandleServerApplicationJoinsConnection( aMessage );
+            break;
+            }
+        case EMPMServerIapConnectionActivated:
+            {
+            HandleServerIapConnectionActivatedL( aMessage );
+            break;
+            }
+        case EMPMServerIapConnectionStarted:
+            {
+            HandleServerIapConnectionStartedL( aMessage );
+            break;
+            }
+        case EMPMServerApplicationConnectionEnds:
+            {
+            HandleServerApplicationConnectionEnds( aMessage );
+            break;
+            }
+        case EMPMServerApplicationMigratesToCarrier:
+            {
+            HandleServerApplicationMigratesToCarrierL( aMessage );
+            break;
+            }
+        case EMPMServerApplicationIgnoredTheCarrier:
+            {
+            HandleServerApplicationIgnoredTheCarrier( aMessage );
+            break;
+            }
+        case EMPMServerApplicationAcceptedTheCarrier:
+            {
+            HandleServerApplicationAcceptedTheCarrier( aMessage );
+            break;
+            }
+        case EMPMServerApplicationRejectedTheCarrier:
+            {
+            HandleServerApplicationRejectedTheCarrierL( aMessage );
+            break;
+            }
+        case EMPMServerEasyWlanSsid:
+            {
+            // Easy WLAN SSID not used anymore as connecting 
+            // notes have been removed
+            //
+            MPMLOGSTRING( "CMPMServerSession::ServiceL \
+completing EMPMServerEasyWlanSsid" )
+            aMessage.Complete( KErrNone );
+            break;
+            }
+        case EMPMServerReselectIap:
+            {
+            HandleServerReselectIapL( aMessage );
+            break;
+            }
+#ifdef _DEBUG
+        case EMPMDebugGenerateStopIAPNotification:
+            {
+            HandleDebugGenerateStopIAPNotification( aMessage );
+            break;
+            }
+        case EMPMDebugSwitchConnMonEventsOn:
+            {
+            HandleDebugFilterConnMonEvents( aMessage, EFalse );
+            break;
+            }
+        case EMPMDebugSwitchConnMonEventsOff:
+            {
+            HandleDebugFilterConnMonEvents( aMessage, ETrue );
+            break;
+            }
+        case EMPMDebugShutdown:
+            {
+            HandleDebugShutdown( aMessage, ETrue );
+            break;
+            }    
+#endif //_DEBUG
+        default:
+            {
+            iMyServer.PanicClient( KErrNotSupported );
+            }
+        }
+    }
+
+#ifdef _DEBUG
+void CMPMServerSession::HandleDebugGenerateStopIAPNotification( const RMessage2& aMessage )
+    {
+    MPMLOGSTRING( "CMPMServerSession::HandleDebugGenerateStopIAPNotification" )
+    TInt iap = static_cast<TInt>( aMessage.Int0() );
+    MyServer().StopConnections( iap );
+    aMessage.Complete( KErrNone );
+    }
+	
+void CMPMServerSession::HandleDebugFilterConnMonEvents( const RMessage2& aMessage, const TBool aVal )
+    {
+    MPMLOGSTRING2( "CMPMServerSession::HandleDebugFilterConnMonEvents FilteringEnabled=%d", aVal )
+    TInt iap = static_cast<TInt>( aMessage.Int0() );
+    MyServer().Events()->FilterAvailableIAPEvents( aVal );
+    aMessage.Complete( KErrNone );
+    }
+    
+void CMPMServerSession::HandleDebugShutdown( const RMessage2& aMessage, const TBool /*aVal*/ )
+    {
+    MPMLOGSTRING( "CMPMServerSession::HandleDebugShutdown" )
+    aMessage.Complete( KErrNone );
+    
+    TFindProcess processFinder( _L("*MPMServer*") );
+    TFullName    name;
+    
+    if ( processFinder.Next( name ) == KErrNone ) 
+        {
+        RProcess process;
+        
+        TInt err = process.Open( name );
+        
+        if ( err == KErrNone ) 
+            {
+            process.Kill( 0 );
+            }
+                
+        process.Close();
+        }    
+    }    
+#endif //_DEBUG
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::ServiceError
+// -----------------------------------------------------------------------------
+//
+void CMPMServerSession::ServiceError( const RMessage2& aMessage, 
+                                      TInt             aError )
+
+    {
+    // Handles the situation when a call to CSession2::ServiceL(), 
+    // which services a client request, leaves.
+    // 
+    // The default behaviour of this function is to complete the message, 
+    // using the leave value, if it has not already been completed.
+    // 
+    // Servers can re-implement this as appropriate.
+    // 
+    MPMLOGSTRING3(
+        "CMPMServerSession::ServiceError: Service %d failed with error: %d",
+         aMessage.Function(),
+         aError )
+    if( aMessage.Function() == EMPMServerChooseIap ||
+        aMessage.Function() == EMPMServerReselectIap )
+        {
+        // complete locally stored iChooseIapMessage
+        //
+        ChooseIapComplete( aError, NULL );
+        }
+    else if( aMessage.Function() == EMPMServerProcessError )
+        {
+        // complete locally stored iProcessErrorMessage
+        //
+        ProcessErrorComplete( aError, NULL, NULL );
+        }
+    else if( !aMessage.IsNull() )
+        {
+        // Complete message if it hasn't been 
+        // already completed
+        //
+        aMessage.Complete( aError );        
+        }
+    else
+        {
+        MPMLOGSTRING(
+        "CMPMServerSession::ServiceError: Message has already been completed" )
+        }    
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::HandleServerChooseIapL
+// -----------------------------------------------------------------------------
+//
+void CMPMServerSession::HandleServerChooseIapL( const RMessage2& aMessage )
+    {
+    MPMLOGSTRING2( "CMPMServerSession::HandleServerChooseIapL session <0x%x>", this )
+
+    // Read the Connection Id of the application
+    //
+    iConnId = aMessage.Int1();
+    MPMLOGSTRING2( "CMPMServerSession::HandleServerChooseIapL: \
+Connection Id = 0x%x", iConnId )
+
+    // Sanity check that client only has one outstanding ChooseBestIAP() or ReselectBestIAP() -call.
+    //
+    if ( !iChooseIapMessage.IsNull() )
+        {
+        MPMLOGSTRING2( "CMPMServerSession::HandleServerChooseIapL: - Error \
+ChooseBestIAP() or ReselectBestIAP() already exists %d", KErrServerBusy );
+        aMessage.Complete( KErrServerBusy );
+        }
+
+    // Sanity check that client doesn't call ChooseBestIAPL() twice for the same session.
+    //
+    if ( ChooseBestIapCalled() )
+        {
+        MPMLOGSTRING2( "CMPMServerSession::HandleServerChooseIapL: - Error \
+ChooseBestIAP() already completed or in progress %d", KErrAlreadyExists )
+        aMessage.Complete( KErrAlreadyExists );
+        return;
+        }
+
+    // We must save the RMessage in order to complete it later.
+    //
+    iChooseIapMessage = aMessage;
+    TConnPref connPref;
+    aMessage.ReadL( KFirstArgument, connPref );
+
+    // Extract connection preferences
+    //
+    TMpmConnPref mpmConnPref;
+    TInt error = ExtractConnPref( connPref, mpmConnPref );
+    
+    if ( error != KErrNone )
+        {
+        MPMLOGSTRING( "CMPMServerSession::HandleServerChooseIapL - Error \
+while extracting TCommDbConnPref from TConnPref" )
+        aMessage.Complete( error );
+        return;
+        }
+
+    // Store the Uid of the application to the member variable so 
+    // that it can be used to avoid DisconnectDialog popping up when 
+    // AlwaysOnline connection is being established.
+    // 
+    iAppUid = aMessage.Int2();
+
+    if ( !iIapSelection )
+        {
+        iIapSelection = CMPMIapSelection::NewL( iMyServer.CommsDatAccess(),
+                                                this ); 
+        }
+    
+    MPMLOGSTRING3( "CMPMServerSession::HandleServerChooseIapL - iap %d \
+connType %d", mpmConnPref.IapId(), mpmConnPref.ConnType() )
+
+    iIapSelection->ChooseIapL( mpmConnPref );
+
+    if ( iAppUid == iMyServer.CsIdWatcher()->ConnectScreenId() )
+        {
+        MPMLOGSTRING( "CMPMServerSession::HandleServerChooseIapL -\
+ User connection activated" )
+        
+        // This is user connection
+        iMyServer.SetUserConnection();
+        SetUserConnection();
+        iMyServer.SetUserConnPref( mpmConnPref );
+        
+        // Set PS keys according to user connection
+        // Do not check return values. Can do nothing in case of failing.
+        RProperty::Set( KMPMUserConnectionCategory,
+                        KMPMPSKeyUserConnectionSnap,
+                        mpmConnPref.SnapId() );
+        
+        RProperty::Set( KMPMUserConnectionCategory,
+                        KMPMPSKeyUserConnectionIap,
+                        mpmConnPref.IapId() );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::HandleServerCancelRequest
+// -----------------------------------------------------------------------------
+//
+void CMPMServerSession::HandleServerCancelRequest( const RMessage2& aMessage )
+    {
+    TInt cancelcode = aMessage.Int0();
+    MPMLOGSTRING2(
+        "CMPMServerSession::HandleServerCancelRequest - Request code = %i", 
+        cancelcode )
+
+    switch ( cancelcode )
+        {
+        case EMPMReselectBestIAP:
+        case EMPMChooseBestIAP:
+            {
+            // Complete original request
+            // 
+            ChooseIapComplete( KErrCancel, NULL );
+            
+            // Complete cancel request 
+            //
+            MPMLOGSTRING(
+            "CMPMServerSession::HandleServerCancelRequest - Complete with KErrNone" )
+            aMessage.Complete( KErrNone );
+            
+            // Cancel WLAN scan request if one exists
+            //
+            TRAP_IGNORE( iMyServer.Events()->CancelScanL( *this ) )
+            
+            if ( iIapSelection )
+                {
+                delete iIapSelection;
+                iIapSelection = NULL;
+                }
+            return;
+            }
+        case EMPMProcessError:
+            {
+            ProcessErrorComplete( KErrCancel,
+                                  NULL,
+                                  NULL );
+            // Complete cancel request 
+            //
+            MPMLOGSTRING(
+            "CMPMServerSession::HandleServerCancelRequest - Complete with KErrNone" )
+            aMessage.Complete( KErrNone );
+
+            // Cancel WLAN scan request if one exists
+            //
+            TRAP_IGNORE( iMyServer.Events()->CancelScanL( *this ) )
+
+            if ( iDisconnectDlg )
+                {
+                MPMLOGSTRING( "CMPMServerSession::HandleServerCancelRequest: \
+removing dconn dlg" )
+                delete iDisconnectDlg;
+                iDisconnectDlg = NULL;
+                }
+            return;
+            }
+        case EMPMWaitNotification:
+            {
+            if ( iNotifRequested )
+                {
+                iNotifRequested = EFalse;
+                iNotifMessage.Complete( KErrCancel );
+                }
+            break;
+            }
+        case EMPMSortSNAP:
+            {
+            if ( !iServerSortSNAPMessage.IsNull() )
+                {
+                // TODO Change CancelScanL to non-leaving.
+                // Otherwise, nothing clever can be done here.
+                // And OOM may risk MPM stability.
+                TRAP_IGNORE( iMyServer.Events()->CancelScanL( *this ))
+                iServerSortSNAPMessage.Complete( KErrCancel );
+                }
+            break;
+            }
+        default:
+            {
+            MPMLOGSTRING( "CMPMServerSession::HandleServerCancelRequest - \
+Unknown cancel request received" )
+            }
+        }
+    MPMLOGSTRING( 
+    "CMPMServerSession::HandleServerCancelRequest - Complete with KErrNone" )
+    aMessage.Complete( KErrNone );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::HandleServerApplicationJoinsConnection
+// -----------------------------------------------------------------------------
+//
+void CMPMServerSession::HandleServerApplicationJoinsConnection(
+    const RMessage2& aMessage )
+    {
+    // Read Iap Id
+    //
+    TUint32 joinIap = static_cast<TUint32>( aMessage.Int0() );
+
+    // Read the Connection Id of the application
+    //
+    TConnectionId joinId = aMessage.Int1();
+    
+    //-jl- Make sure id is known & assert it stays the same.
+    ASSERT(iConnId == joinId || iConnId == NULL);
+    iConnId = joinId;
+
+    MPMLOGSTRING3(
+        "CMPMServerSession::HandleServerApplicationJoinsConnection \
+- IAP Id = %i, Connection Id = 0x%x", joinIap, joinId )
+
+    // Get the current connection SNAP for this Connection Id
+    //
+    TUint32 snapId = iMyServer.GetBMSnap( joinId );
+
+    
+    // Decides the correct state by the IAP status.
+    if ( iMyServer.StartedConnectionExists( joinIap ) == joinIap )
+        {
+        iMyServer.AppendBMConnection( joinId, 
+                                  snapId, 
+                                  joinIap, 
+                                  EStarted,
+								  *this );
+        }
+    else
+        {
+        iMyServer.AppendBMConnection( joinId, 
+                                  snapId, 
+                                  joinIap, 
+                                  EStarting,
+								  *this );
+        }
+
+    aMessage.Complete( KErrNone );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::HandleServerApplicationLeavesConnection
+// -----------------------------------------------------------------------------
+//
+void CMPMServerSession::HandleServerApplicationLeavesConnection(
+    const RMessage2& aMessage )
+    {
+    // Read Iap Id
+    //
+    TUint32 leaveIap = static_cast<TUint32>( aMessage.Int0() );
+
+    // Read the Connection Id of the application
+    //
+    TConnectionId leaveId = aMessage.Int1();
+
+    MPMLOGSTRING3(
+        "CMPMServerSession::HandleServerApplicationLeavesConnectionL \
+- IAP Id = %i, Connection Id = 0x%x", leaveIap, leaveId )
+
+    iMyServer.Events()->ResetConnInfo( leaveId );
+    iMyServer.ResetBMConnection( leaveId, leaveIap, *this );
+
+    aMessage.Complete( KErrNone );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::HandleServerIapConnectionActivatedL
+// -----------------------------------------------------------------------------
+//
+void CMPMServerSession::HandleServerIapConnectionActivatedL(
+    const RMessage2& aMessage )
+    {
+    // Read Iap Id
+    //
+    TUint32 activatedIap = static_cast<TUint32>( aMessage.Int0() );
+
+    // Read the Connection Id of the application
+    //
+    TConnectionId activatedId = aMessage.Int1();
+
+    //-jl- Make sure id is known & assert it stays the same.
+    ASSERT(iConnId == activatedId || iConnId == NULL);
+    iConnId = activatedId;
+    
+    MPMLOGSTRING3(
+        "CMPMServerSession::HandleServerIapConnectionActivatedL \
+- IAP Id = %i, Connection Id = 0x%x", activatedIap, activatedId )
+
+    MPMLOGSTRING(
+        "CMPMServerSession::HandleServerIapConnectionActivatedL \
+- Complete IapConnectionActivated" )
+    aMessage.Complete( KErrNone );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::HandleServerIapConnectionStarted
+// -----------------------------------------------------------------------------
+//
+void CMPMServerSession::HandleServerIapConnectionStartedL(
+    const RMessage2& aMessage )
+    {
+    // Read Iap Id
+    //
+    TUint32 startedIap = static_cast<TUint32>( aMessage.Int0() );
+
+    // Read the Connection Id of the application
+    //
+    TConnectionId startedId = aMessage.Int1();
+
+    //-jl- Make sure id is known & assert it stays the same.
+    ASSERT(iConnId == startedId || iConnId == NULL);
+    iConnId = startedId;
+    
+    MPMLOGSTRING3( "CMPMServerSession::HandleServerIapConnectionStarted\
+ - IAP Id = %i, Connection Id = 0x%x", startedIap, startedId )
+
+    iMyServer.AppendBMIAPConnectionL( startedIap, startedId, *this );
+
+    // Unblacklist all IAPs related to the connection error 
+    // when connection has started.
+    // 
+    iMyServer.HandleServerUnblackListIap( startedId, ETemporary );
+
+    // Complete the message as soon as possible to avoid latency in BM
+    // 
+    aMessage.Complete( KErrNone );
+    
+    IapSelectionL()->ConnectionStarted();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::HandleServerIapConnectionStopped
+// -----------------------------------------------------------------------------
+//
+void CMPMServerSession::HandleServerIapConnectionStopped(
+    const RMessage2& aMessage )
+    {
+    // Read Iap Id
+    //
+    TUint32 stoppedIap = static_cast<TUint32>( aMessage.Int0() );
+
+    // Read the Connection Id of the application
+    //
+    TConnectionId stoppedId = aMessage.Int1();
+
+    MPMLOGSTRING3( "CMPMServerSession::HandleServerIapConnectionStopped\
+ - IAP Id = %i, Connection Id = 0x%x", stoppedIap, stoppedId )
+
+    iMyServer.RemoveBMIAPConnection( stoppedIap, stoppedId, *this );
+
+    // Complete the message as soon as possible to avoid latency in BM
+    // 
+    aMessage.Complete( KErrNone );
+
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::HandleServerApplicationConnectionEnds
+// -----------------------------------------------------------------------------
+//
+void CMPMServerSession::HandleServerApplicationConnectionEnds( 
+    const RMessage2& aMessage )
+    {
+    // Read the Connection Id of the application
+    //
+    TConnectionId endId = aMessage.Int0();
+
+    if (UserConnection())
+        {
+        iMyServer.ClearUserConnection();
+        ClearUserConnection();
+        
+        // Set PS keys to zero
+        RProperty::Set( KMPMUserConnectionCategory,
+                        KMPMPSKeyUserConnectionSnap,
+                        0 );
+        
+        RProperty::Set( KMPMUserConnectionCategory,
+                        KMPMPSKeyUserConnectionIap,
+                        0 );
+        
+        MPMLOGSTRING( "CMPMServerSession::HandleServerApplicationConnectionEnds -\
+User connection deactivated" )
+        }   
+
+    MPMLOGSTRING2( "CMPMServerSession::HandleServerApplicationConnectionEnds\
+ - Connection Id = 0x%x", endId )
+
+    // Unblacklist all IAPs related to this connection  
+    // when connection closes.
+    // 
+    iMyServer.HandleServerUnblackListIap( endId, 0 );
+
+    // Remove info about this connection
+    // 
+    iMyServer.Events()->RemoveConnInfo( endId );
+
+    // SNAP lifetime is determined by the two calls ChooseBestIAP 
+    // and ApplicationConnectionEnds.
+    // 
+    iMyServer.RemoveBMConnection( endId, *this );
+
+    // Clear notification registration if one exists for the connection
+    //
+    iPreferredIAPRequested = EFalse;
+    
+    // Complete message before calling synchronous Cancel functions
+    aMessage.Complete( KErrNone );
+
+    delete iConfirmDlgRoaming;
+    iConfirmDlgRoaming = NULL;
+    
+    if( iIapSelection )
+        {
+        delete iIapSelection;
+        iIapSelection = NULL;        
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::IsConfirmFirstL
+// -----------------------------------------------------------------------------
+//
+TBool CMPMServerSession::IsConfirmFirstL( const TUint32 aIapId )
+    {
+    TCmGenConnSettings  genConnSettings;
+    TBool               isConfirmFirst( EFalse );
+
+    MPMLOGSTRING3( "CMPMServerSession::IsConfirmFirstL - IAP Id = %i Connection Id = 0x%x", 
+                   aIapId,
+                   iConnId )
+
+    // check whether a started connection exists which already 
+    // uses this IAP. If so, it won't need to be confirmed again
+    // 
+    if( iMyServer.CheckIfStarted( aIapId ) )
+        {
+        MPMLOGSTRING(
+        "CMPMServerSession::IsConfirmFirstL - IAP already started, \
+confirm not necesary - False" )
+        return EFalse;
+        }
+
+    if ( IsBackgroundApplication( iAppUid ) || IsMMSIap( aIapId ) )
+        {
+        MPMLOGSTRING(
+        "CMPMServerSession::IsConfirmFirstL - background IAP, \
+should not be confirmed - False" )
+        return EFalse;
+        }
+
+    // Read global OCC seamlessness values from CommsDat's DefConn table
+    genConnSettings = iMyServer.CommsDatAccess()->ReadGenConnSettingsL();
+
+    TUint32 currentSeamlessness( genConnSettings.iSeamlessnessHome );
+    
+    if ( iMyServer.IsVisitorNetwork() )
+        {
+        currentSeamlessness = genConnSettings.iSeamlessnessVisitor; 
+        }
+
+    if ( currentSeamlessness == ECmSeamlessnessShowprogress ||
+         currentSeamlessness == ECmSeamlessnessFullySeamless )
+        {
+        MPMLOGSTRING( "CMPMServerSession::IsConfirmFirstL - False" )
+        isConfirmFirst = EFalse;
+        }
+    else 
+        {
+        // The currentSeamlessness value ECmSeamlessnessConfirmFirst 
+        // matches with need to display confirmation dialog.
+        // 
+        MPMLOGSTRING(
+            "CMPMServerSession::IsConfirmFirstL - True" )
+        isConfirmFirst = ETrue;
+        }
+    return isConfirmFirst;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::HandleServerApplicationMigratesToCarrierL
+// -----------------------------------------------------------------------------
+//
+void CMPMServerSession::HandleServerApplicationMigratesToCarrierL(
+    const RMessage2& aMessage )
+    {
+    // Read Iap Id
+    //
+    iMigrateIap = static_cast<TUint32>( aMessage.Int0() );
+
+    // Complete the message ApplicationMigratesToCarrier already here, 
+    // otherwise MPM would be hanging Esock thread when displaying the 
+    // confirmation dialog while roaming.
+    // 
+    aMessage.Complete( KErrNone );
+
+    MPMLOGSTRING3(
+        "CMPMServerSession::HandleServerApplicationMigratesToCarrierL\
+ - IAP Id = %i, Connection Id = 0x%x", iMigrateIap, iConnId )
+
+    delete iConfirmDlgRoaming;
+    iConfirmDlgRoaming = NULL;
+
+    // Get the current connection SNAP for this Connection Id
+    //
+    TUint32 snapId = iMyServer.GetBMSnap( iConnId );
+
+    // We have to find out the current IAP of connection in order 
+    // to determine whether this is an upgrade or downgrade.
+    // 
+    TUint32 currentIap = iMyServer.GetBMIap( iConnId );
+
+    iMyServer.AppendBMConnection( iConnId, 
+                                  snapId, 
+                                  iMigrateIap, 
+                                  ERoaming,
+                                  *this );
+
+    iMigrateState = EMigrateUserConfirmation;
+
+    // Confirm only if this IAP is not already in use
+    //
+    if ( ( currentIap != iMigrateIap ) && 
+         IsConfirmFirstL( iMigrateIap ) )
+        {
+        TBool             nextBestExists( EFalse );
+        TMpmConnPref      mpmConnPref;
+        RAvailableIAPList availableIAPList;
+
+        CleanupClosePushL( availableIAPList );
+        AvailableUnblacklistedIapsL( availableIAPList, 
+                                     iConnId );
+
+        mpmConnPref.SetSnapId( snapId );
+
+        IapSelectionL()->ChooseBestIAPL( mpmConnPref, availableIAPList, nextBestExists );
+
+        TBool reconnect ( EFalse );      
+        if ( !IsUpgrade( currentIap, iMigrateIap, availableIAPList ) )
+                    {
+                    reconnect = ETrue;
+                    }
+
+        //Display confirm dialog only if we are moving to cellular IAP
+        if ( MyServer().CommsDatAccess()->CheckWlanL( iMigrateIap ) == ENotWlanIap )
+            {
+            if ( !( iIapSelection->MpmConnPref().NoteBehaviour() & TExtendedConnPref::ENoteBehaviourConnDisableQueries ) )
+                {
+                if ( MyServer().RoamingWatcher()->RoamingStatus() == EMPMInternationalRoaming )
+                    {
+                    //Check if cellular data usage query has already been presented to the user in this country
+                    if ( MyServer().RoamingWatcher()->AskCellularDataUsageAbroad() == true )
+                        {
+                        //International roaming
+                        iConfirmDlgRoaming = CMPMConfirmDlgRoaming::NewL( 
+                                *this, 
+                                snapId, 
+                                iMigrateIap, 
+                                CMPMConfirmDlg::EConfirmDlgVisitorNetwork, 
+                                reconnect );
+                        }
+                    else
+                        {
+                        //Handle like user would have answered "Connect this time" to dialog
+                        RoamingConfirmationCompletedL( KErrNone, EMsgQueryThisTime, reconnect );
+                        }
+                    }
+                else
+                    {
+                    //Home network
+                    iConfirmDlgRoaming = CMPMConfirmDlgRoaming::NewL( 
+                            *this, 
+                            snapId, 
+                            iMigrateIap, 
+                            CMPMConfirmDlg::EConfirmDlgHomeNetwork,
+                            reconnect );
+                    }
+                }
+            
+            else
+                {
+                RoamingConfirmationCompletedL( KErrCancel, EMsgQueryCancelled, reconnect );
+                }
+            }
+        //IAP was WLAN IAP
+        else
+            {
+            //Handle like user would have answered "Connect this time" to dialog
+            RoamingConfirmationCompletedL( KErrNone, EMsgQueryThisTime, reconnect );
+            }
+                
+        // Release memory
+        //
+        CleanupStack::PopAndDestroy( &availableIAPList );
+        }
+    else
+        {
+        // Handle next state in migration
+        //
+        MigrateCallbackL( KErrNone );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::MigrateCallbackL
+// -----------------------------------------------------------------------------
+//
+void CMPMServerSession::MigrateCallbackL( TInt aError )
+	{
+	if( iMigrateState == EMigrateUserConfirmation )
+	    {
+	    MPMLOGSTRING2( "CMPMServerSession<0x%x>::MigrateCallbackL: State user confirmation",
+	                   iConnId )
+	    if( aError == KErrNone )
+	        {
+	        iMigrateState = EMigrateOfflineConfirmation;
+    	    if( IapSelectionL()->StartWlanQueryIfNeededL( iMigrateIap, ETrue ) )
+	            {
+	            return;
+                }
+	        }
+	    }
+	else if( iMigrateState == EMigrateOfflineConfirmation )
+	    {
+	    MPMLOGSTRING3( "CMPMServerSession<0x%x>::MigrateCallbackL: State offline confirmation error: %d", 
+	                   iConnId,
+	                   aError )
+        if( aError != KErrNone )
+            {
+            ErrorNotificationL( aError, EMPMMobilityErrorNotification );
+            }
+	    }
+	else // EMigrateNone
+	    {
+        MPMLOGSTRING2( "CMPMServerSession<0x%x>::MigrateCallbackL: State none",
+                       iConnId )
+	    
+	    }
+    MigrateDoneL( aError );
+	}
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::RoamingConfirmationCompletedL
+// -----------------------------------------------------------------------------
+//
+void CMPMServerSession::RoamingConfirmationCompletedL( TInt                   aError, 
+                                                      TMsgQueryLinkedResults aResponse,
+                                                      TBool                  aReconnect )
+    {
+    TInt error( KErrNone);
+    MPMLOGSTRING5( "CMPMServerSession<0x%x>::RoamingConfirmationCompleted: \
+aError %d, aResponse %d, aReconnect %d", 
+                   iConnId,
+                   aError,
+                   aResponse,
+                   aReconnect )
+
+    if( aError == KErrNone )
+        {
+        if( aResponse == EMsgQueryCancelled )
+            {
+            if( !aReconnect )
+                {
+                // Send a preferred IAP notification
+                // 
+                TConnMonIapInfo availableIAPs;
+                availableIAPs = GetAvailableIAPs();
+
+                // Get the current and presumed IapId for this connId 
+                //
+                TUint32 currentIap  = iMyServer.GetBMIap( ConnectionId() );
+                TUint32 presumedIap = MyServer().Events()->PresumedIapId( 
+                                          ConnectionId(), iMigrateIap );
+
+                MyServer().HandleServerBlackListIap( ConnectionId(), 
+                                                     currentIap, 
+                                                     EConnectionLifetime );
+                if ( ( presumedIap != 0 ) && 
+                     ( presumedIap != currentIap ) )
+                    {
+                    iMyServer.HandleServerBlackListIap( ConnectionId(), 
+                                                        presumedIap, 
+                                                        EConnectionLifetime );
+                    }
+
+                TRAPD( err, PrefIAPNotificationL( availableIAPs, 
+                                                  EConfirmDlgRoaming ) );
+                if ( err == KErrNotFound )
+                    {
+                    // We need to send a notification error to BearerMan 
+                    // if sending preferred IAP notifications failed. 
+                    // 
+                    ErrorNotificationL( KErrNotFound,
+                                        EMPMMobilityErrorNotification );
+
+                    }
+                }
+            else // aReconnect
+                {
+                ErrorNotificationL( KErrCancel,
+                                    EMPMMobilityErrorNotification );
+                }
+      
+            error = KErrCancel;
+            }
+        //User selected Connect automatically
+        else if  ( aResponse == EMsgQueryAutomatically ) 
+            {
+            //Store selected value to commsdat if we are in home network
+            if ( MyServer().RoamingWatcher()->RoamingStatus() == EMPMHomenetwork )
+                {
+                TCmGenConnSettings genConnSettings;
+
+                TRAPD(errorCode,genConnSettings = MyServer().CommsDatAccess()->ReadGenConnSettingsL()); // call a function
+
+                //If reading of database failed we do not write back to the database to prevent random values
+                if (errorCode == KErrNone)
+                    {
+                    genConnSettings.iSeamlessnessHome = ECmSeamlessnessShowprogress;        
+                    TRAP_IGNORE(MyServer().CommsDatAccess()->WriteGenConnSettingsL( genConnSettings )); 
+                    }
+                } 
+            else
+                {
+                //In foreign country connect automatically is not stored in commsdat
+                //even user selected so. We just do not ask confirmation for the cellular
+                //connection again in this country:
+                MyServer().RoamingWatcher()->SetAskCellularDataUsageAbroad( false );            
+                }
+            }
+        
+        //user selected connect this time
+        else
+            {
+            MPMLOGSTRING3( "CMPMServerSession<0x%x>::RoamingConfirmationCompleted: \
+Unknown response: %d", iConnId, aResponse )
+            }
+        }
+    else // error occurred
+        {
+        ErrorNotificationL( aError, EMPMMobilityErrorNotification );
+        error = KErrCancel;
+        }
+    MigrateCallbackL( error ); 
+    }
+    
+// -----------------------------------------------------------------------------
+// CMPMServerSession::StopConnection
+// -----------------------------------------------------------------------------
+//
+TInt CMPMServerSession::StopConnection()
+    { 
+    TInt ret = KErrNone;
+    MPMLOGSTRING( "CMPMServerSession::StopConnection" )
+    
+    TConnectionState state( EIdle );
+       
+    iMyServer.GetConnectionState( iConnId, state );
+        
+    if ( state == EStarted || state == EStarting )
+        {
+        TRAP(ret, StopIAPNotificationL());
+        }
+            
+    return ret;
+    } 
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::HandleServerApplicationIgnoredTheCarrier
+// -----------------------------------------------------------------------------
+//
+void CMPMServerSession::HandleServerApplicationIgnoredTheCarrier(
+    const RMessage2& aMessage )
+    {
+    TInt error( KErrNotFound );
+    
+    // MPM has been waiting for the response to preferred.
+    // Release the possible new notifications.
+    //
+    iStoredIapInfo.ResetStoredIapInfo();
+    
+    // Read Iap Id
+    //
+    TUint32 ignoredIap = static_cast<TUint32>( aMessage.Int0() );
+
+    // Read the Connection Id of the application
+    //
+    TConnectionId ignoredId = aMessage.Int1();
+
+    MPMLOGSTRING3(
+        "CMPMServerSession::HandleServerApplicationIgnoredTheCarrier \
+- IAP Id = %i, Connection Id = 0x%x", ignoredIap, ignoredId )
+
+    // Blacklisting should be done before ResetConnInfo(), 
+    // since iPresumedIapId is reset during ResetConnInfo(). 
+    // 
+    iMyServer.HandleServerBlackListIap( ignoredId, 
+                                        ignoredIap, 
+                                        EConnectionLifetime );
+
+    iMyServer.Events()->ResetConnInfo( ignoredId );
+
+    TConnMonIapInfo availableIAPs;
+    availableIAPs = GetAvailableIAPs();
+
+    if ( availableIAPs.iCount > 0 ) 
+        {
+        TRAP( error, PrefIAPNotificationL( availableIAPs, EBearerMan ) );
+        if ( error == KErrNotFound )
+            {
+            TRAP( error, ErrorNotificationL( KErrNotFound,
+                                             EMPMMobilityErrorNotification ) );
+            }
+        }
+    else
+        {
+        MPMLOGSTRING(
+            "CMPMServerSession::HandleServerApplicationIgnoredTheCarrier - \
+No IAPs available, send error notification" )
+        TRAP( error, ErrorNotificationL( KErrNotFound, 
+                                         EMPMMobilityErrorNotification ) );
+        }
+    aMessage.Complete( error );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::HandleServerApplicationAcceptedTheCarrier
+// -----------------------------------------------------------------------------
+//
+void CMPMServerSession::HandleServerApplicationAcceptedTheCarrier(
+    const RMessage2& aMessage )
+    {    
+    // Read Iap Id
+    //
+    TUint32 acceptedIap = static_cast<TUint32>( aMessage.Int0() );
+
+    // Read the Connection Id of the application
+    //
+    TConnectionId acceptedId = aMessage.Int1();
+
+    MPMLOGSTRING3(
+        "CMPMServerSession::HandleServerApplicationAcceptedTheCarrier \
+- IAP Id = %i, Connection Id = 0x%x", acceptedIap, acceptedId )
+
+    // Get the current connection SNAP for this Connection Id
+    //
+    TUint32 snapId = iMyServer.GetBMSnap( acceptedId );
+
+    iMyServer.AppendBMConnection( acceptedId, 
+                                  snapId, 
+                                  acceptedIap, 
+                                  EStarted,
+                                  *this );
+
+    aMessage.Complete( KErrNone );
+    
+    // If there is saved IAP info, handle it now
+    //
+    TConnMonIapInfo iapInfo;
+    if( iStoredIapInfo.HandleIapInfoWaiting( iapInfo ) )
+        {
+        iStoredIapInfo.ResetStoredIapInfo();
+        // Attempt to send the preferred IAP notification 
+        // if notification has arrived during roaming. 
+        //
+        TRAPD( error, PrefIAPNotificationL( iapInfo, EConnMon ) );
+        if( error != KErrNone )
+            {
+            MPMLOGSTRING2(
+            "CMPMServerSession::HandleServerApplicationAcceptedTheCarrier \
+PrefIAPNotification error = %i, ", error )            
+            }
+        }
+    else 
+        {
+        iStoredIapInfo.ResetStoredIapInfo();
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::HandleServerApplicationRejectedTheCarrierL
+// -----------------------------------------------------------------------------
+//
+void CMPMServerSession::HandleServerApplicationRejectedTheCarrierL(
+    const RMessage2& aMessage )
+    {
+    // PrefIAPNotif will be attempted with latest available IAPs
+    //
+    iStoredIapInfo.ResetStoredIapInfo();
+
+    TInt error( KErrNone );
+
+    // Read Iap Id
+    //
+    TUint32 rejectedIap = static_cast<TUint32>( aMessage.Int0() );
+
+    // Read the Connection Id of the application
+    //
+    TConnectionId rejectedId = aMessage.Int1();
+
+    MPMLOGSTRING3(
+        "CMPMServerSession::HandleServerApplicationRejectedTheCarrierL \
+- IAP Id = %i, Connection Id = 0x%x", rejectedIap, rejectedId )
+
+    // Blacklisting should be done before ResetConnInfo(), 
+    // since iPresumedIapId is reset during ResetConnInfo(). 
+    // 
+    iMyServer.HandleServerBlackListIap( rejectedId, 
+                                        rejectedIap, 
+                                        EConnectionLifetime );
+
+    iMyServer.Events()->ResetConnInfo( rejectedId );
+    iMyServer.ResetBMConnection( rejectedId, rejectedIap, *this );
+
+    // If possible to roam from a WLAN IAP to another WLAN IAP
+    // perform WLAN scan first.
+    // Currently ConnMon can't send notifications during this time as it 
+    // handles requests syncronously. So, that shouldn't cause problems now, 
+    // but issue should be reviewed if that changes. 
+    //
+    TUint32 snapId = iMyServer.GetBMSnap( rejectedId );
+    RArray<TUint> iapPath;
+    CleanupClosePushL( iapPath );
+    if( ( iMyServer.CommsDatAccess()->CheckWlanL( rejectedIap ) != ENotWlanIap ) && 
+          iMyServer.CommsDatAccess()->SnapContainsWlanL( snapId, iapPath, KMPMNrWlansTwo ) )
+        {
+            // perform WLAN scan 
+            // message is completed in callback function 
+            // CompleteCarrierRejected
+            // 
+            iMyServer.Events()->ScanWLANNetworksL( this, 
+                                                   ConnectionId(), 
+                                                   EWlanScanCallbackCarrierRejected );
+            CleanupStack::PopAndDestroy( &iapPath );
+            aMessage.Complete( error );
+            return;    
+        }
+    else 
+        {
+        CompleteCarrierRejected();
+        }
+    CleanupStack::PopAndDestroy( &iapPath );
+    aMessage.Complete( error );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::GetServiceIdSettingL
+// -----------------------------------------------------------------------------
+//
+TInt CMPMServerSession::GetServiceIdSettingL()
+    {
+    TUint32 iap( 0 );
+    TInt id( KErrNotFound );
+
+    MPMLOGSTRING2( "CMPMServerSession::GetServiceIdSettingL - \
+Setting name %S", &KIapProxyServiceSetting() )
+
+    iap = GetPresumedIap();
+    if( !iap )
+        {
+        MPMLOGSTRING( "CMPMServerSession::HandleServerGetIntSetting - \
+        Iap for the connection not found" )
+        id = KErrNotFound;
+        }
+    else
+        {
+        id = iMyServer.CommsDatAccess()->GetIapServiceIdL( iap );
+        // validate commsdat value.
+        id = id > 0 && id <= 256 ? id : KErrNotFound;
+        }
+    return id;  
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::HandleServerReselectIapL
+// -----------------------------------------------------------------------------
+//
+void CMPMServerSession::HandleServerReselectIapL( const RMessage2& aMessage )
+    {
+    MPMLOGSTRING2( "CMPMServerSession::HandleServerReselectIapL session <0x%x>", this )
+    // Sanity check that client only has one outstanding ChooseBestIAP() or ReselectBestIAP() -call.
+    //
+    if ( !iChooseIapMessage.IsNull() )
+        {
+        MPMLOGSTRING2( "CMPMServerSession::HandleServerReselectIapL: - Error \
+ ChooseBestIAP() or ReselectBestIAP() already exists %d", KErrServerBusy )
+        aMessage.Complete( KErrServerBusy );
+        }
+
+    // We must save the RMessage in order to complete it later.
+    //
+    iChooseIapMessage = aMessage;
+
+    if ( !ChooseBestIapCalled() )
+        {
+        MPMLOGSTRING( "CMPMServerSession::HandleServerReselectIapL - Error: \
+ChooseBestIap hasn't been called yet" )
+        aMessage.Complete( KErrNotReady );
+        return;
+        }
+
+    MPMLOGSTRING3( "CMPMServerSession::HandleServerReselectIapL - iap %d \
+connType %d", iIapSelection->MpmConnPref().IapId(), iIapSelection->MpmConnPref().ConnType() )
+
+    iIapSelection->ChooseIapL( iIapSelection->MpmConnPref() );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::HandleServerProcessErrorL
+// -----------------------------------------------------------------------------
+//
+void CMPMServerSession::HandleServerProcessErrorL(
+    const RMessage2& aMessage )
+    {
+    // Store message. This is used to complete the message later 
+    // if asynchronous services are needed first or in Service error
+    iProcessErrorMessage = aMessage;
+    
+    if ( iIapSelection )
+        {
+        iIapSelection->StopDisplayingStartingDlg();
+        }
+
+    // Read Error code
+    //
+    TInt error( KErrNone );
+    TPtr8 errorPtr( reinterpret_cast< TUint8* >( NULL ), 0 );
+    errorPtr.Set( reinterpret_cast< TUint8* >( &error ),
+                  sizeof( error ),
+                  sizeof( error ) );
+
+    // Read the contents of the client pointer into a TPtr8.
+    // 
+    TInt res = iProcessErrorMessage.Read( KFirstArgument, errorPtr );
+    if ( res != KErrNone )
+        {
+        iMyServer.PanicClient( KErrBadDescriptor );
+        return;
+        }
+
+    if ( !ChooseBestIapCalled() )
+        {
+        MPMLOGSTRING( "CMPMServerSession::HandleServerProcessErrorL - \
+Warning: ChooseBestIap has not been called yet" )
+        TBMNeededAction neededAction( EPropagateError );
+        ProcessErrorComplete( KErrNone, &error, &neededAction );
+        return;
+        }
+
+    // Show error popup if it's allowed per client request
+    if ( !( iIapSelection->MpmConnPref().NoteBehaviour() &
+            TExtendedConnPref::ENoteBehaviourConnDisableNotes ) )
+        {
+        CConnectionUiUtilities* connUiUtils = CConnectionUiUtilities::NewL();
+        // Note: Below function shows the discreet popup only if the error code
+        // belongs to the set of errors that are shown to the user.
+        // Otherwise the popup is not shown.
+        connUiUtils->ConnectionErrorDiscreetPopup( error );
+        delete connUiUtils;
+        connUiUtils = NULL;
+        }
+
+    // Read the Connection Id of the application
+    // 
+    TConnectionId connId = iProcessErrorMessage.Int1();
+
+    MPMLOGSTRING3( "CMPMServerSession::HandleServerProcessErrorL\
+ - error code = %i, Connection Id = 0x%x", error, connId )
+
+    // Get the current connection IapId for this connId 
+    //
+    TUint32 currentIap = iMyServer.GetBMIap( connId );
+
+    // Get the current connection SNAP for this Connection Id
+    //
+    TUint32 snapId = iMyServer.GetBMSnap( connId );
+
+    TConnMonIapInfo availableIAPs;
+    availableIAPs = GetAvailableIAPs();
+
+    RemoveUnavailableIap( availableIAPs, currentIap );
+
+    TBMNeededAction neededAction( EIgnoreError );
+
+    // Get the state of the connection for this Iap Id.
+    // 
+    TConnectionState state;
+    iMyServer.GetConnectionState( connId, state );
+
+    // We need to blacklist the presumed IAP too
+    // 
+    TUint32 presumedIap = MyServer().Events()->PresumedIapId( connId, 
+                                                              currentIap );
+
+    // Reset connection info.
+    // 
+    iMyServer.Events()->ResetIapConnInfo( currentIap );
+
+    // Check if IAP is reported by MMS
+    //
+    TBool isMMSIap = IsMMSIap( currentIap );
+    if ( isMMSIap )
+        {
+        MPMLOGSTRING( "CMPMServerSession::HandleServerProcessErrorL\
+        - DisconnectDialog is not started because of MMS reported IAP" )
+        }
+
+    TInt* returnError( NULL );
+    if ( ( state == EStarting ) || ( state == ERoaming ) )
+        {
+        // Process error according to the fact that the connection 
+        // has not yet been started.
+        // 
+        if ( DisconnectDlgErrorCode( error ) &&
+             !IsBackgroundApplication( iAppUid ) &&
+             !isMMSIap && 
+             iIapSelection->MpmConnPref().DisconnectDialog() &&
+             iMyServer.StartedConnectionExists() != KErrNotFound )
+            {
+            // Start the Disconnect dialog
+            // 
+            MPMLOGSTRING( "CMPMServerSession::HandleServerProcessErrorL\
+ - Start Disconnect dialog" )
+            iDisconnectDlg = CMPMDisconnectDlg::NewL( *const_cast<CMPMServerSession*>(this),
+                                                      error,
+                                                      *MyServer().DisconnectQueue() );
+            return;
+            }
+        else
+            {
+            MPMLOGSTRING( "CMPMServerSession::HandleServerProcessErrorL - \
+Error not handled with disconnect dialog" )
+
+            if ( state == EStarting ) 
+                {
+                if ( ( snapId == 0 ) || ( error == KErrCancel ) )
+                    {
+                    neededAction = EPropagateError;
+
+                    MPMLOGSTRING(
+                        "CMPMServerSession::HandleServerProcessErrorL - \
+Tell BM to end the client connection with appropriate error code" )
+                    }
+                else
+                    {
+                    neededAction = EDoReselection;
+
+                    MPMLOGSTRING(
+                        "CMPMServerSession::HandleServerProcessErrorL - \
+Tell BM to ignore error and do reselection" )
+
+                    iMyServer.HandleServerBlackListIap( connId, 
+                                                        currentIap, 
+                                                        ETemporary );
+                    if ( ( presumedIap != 0 ) && 
+                         ( presumedIap != currentIap ) )
+                        {
+                        iMyServer.HandleServerBlackListIap( connId, 
+                                                            presumedIap, 
+                                                            ETemporary );
+                        }
+                    }
+                }
+            else if ( state == ERoaming ) 
+                {
+                // ERoaming means commsfw stack is moving to new IAP and failed.
+                // Hence, MPM should mark to current iap as zero. 
+                //
+                iMyServer.ResetBMConnection( iConnId, currentIap, *this );
+                
+                // Notification will be sent with latest 
+                // availability info
+                //
+                iStoredIapInfo.ResetStoredIapInfo();
+
+                neededAction = EIgnoreError;
+
+                iMyServer.HandleServerBlackListIap( connId, 
+                                                    currentIap, 
+                                                    ETemporary );
+                if ( ( presumedIap != 0 ) && 
+                     ( presumedIap != currentIap ) )
+                    {
+                    iMyServer.HandleServerBlackListIap( connId, 
+                                                        presumedIap, 
+                                                        ETemporary );
+                    }
+                TRAP( error, PrefIAPNotificationL( availableIAPs, 
+                                                   EBearerMan ) );
+                if ( error == KErrNotFound )
+                    {
+                    neededAction = EPropagateError;
+
+                    returnError = &error;
+
+                    TRAP_IGNORE( ErrorNotificationL( KErrNotFound, 
+                                                     EMPMMobilityErrorNotification ) );
+                    MPMLOGSTRING(
+                        "CMPMServerSession::HandleServerProcessErrorL - \
+Tell BM to end the client connection with appropriate error code" )
+                    }
+                else
+                    {
+                    MPMLOGSTRING(
+                        "CMPMServerSession::HandleServerProcessErrorL - \
+Tell BM to ignore error and let MPM notify application about preferred IAP" )
+                    }
+                }
+            else
+                {
+                MPMLOGSTRING2(
+                    "CMPMServerSession::HandleServerProcessErrorL - \
+Unknown state %d", state )
+                }
+
+            // Error might be different from KErrNone if there 
+            // is no preferred IAP among the available IAPs.
+            // 
+            ProcessErrorComplete( KErrNone,
+                                  returnError,
+                                  &neededAction );
+            return;
+            }
+        }
+    else if ( state == EStarted )
+        {
+        // Process error according to the fact that the connection 
+        // has already been started.
+        //         
+        if ( ( error == KErrCancel ) || ( error == KErrTimedOut ) )
+            {
+            neededAction = EPropagateError;
+
+            MPMLOGSTRING(
+                "CMPMServerSession::HandleServerProcessErrorL - \
+Tell BM to end the client connection with appropriate error code" )
+
+            // Send error notification. 
+            // Not sent if connection not registered
+            // 
+            TRAP_IGNORE( ErrorNotificationL( error,
+                                             EMPMMobilityErrorNotification ) )
+            }
+        else if ( iPreferredIAPRequested )
+            {
+            // IAP connection
+            //
+            if( snapId == 0 )
+                {
+                neededAction = EPropagateError;
+    
+                MPMLOGSTRING(
+                    "CMPMServerSession::HandleServerProcessErrorL - \
+Tell BM to end the client connection with appropriate error code" )
+
+                TRAP_IGNORE( ErrorNotificationL( KErrNotFound,
+                                                 EMPMMobilityErrorNotification ) )
+                }
+            // SNAP connection
+            //
+            else
+                {
+                // If this has been WLAN IAP and the SNAP contains 
+                // other WLAN IAPs, we need to perform WLAN scan before
+                // knowing the availability of those
+                //
+                RArray<TUint> iapPath;
+                CleanupClosePushL( iapPath );
+
+                iMyServer.HandleServerBlackListIap( connId, 
+                                                    currentIap, 
+                                                    ETemporary );
+                if ( ( presumedIap != 0 ) && 
+                     ( presumedIap != currentIap ) )
+                    {
+                    iMyServer.HandleServerBlackListIap( connId, 
+                                                        presumedIap, 
+                                                        ETemporary );
+                    }
+
+                // current iap is either WLAN or EasyWlan
+                // 
+                if( ( iMyServer.CommsDatAccess()->CheckWlanL( currentIap ) != ENotWlanIap ) && 
+                      iMyServer.CommsDatAccess()->SnapContainsWlanL( snapId, iapPath, KMPMNrWlansTwo ) )
+                    {
+                    // perform WLAN scan 
+                    // message is completed in callback function 
+                    // ProcessErrorWlanScanCompletedL
+                    // 
+                    iMyServer.Events()->ScanWLANNetworksL( this, 
+                                                           ConnectionId(), 
+                                                           EWlanScanCallbackProcessErr );
+                    CleanupStack::PopAndDestroy( &iapPath );
+                    return;
+                    }
+
+                CleanupStack::PopAndDestroy( &iapPath );
+                neededAction = EIgnoreError;
+
+                TRAPD( err2, PrefIAPNotificationL( availableIAPs, EBearerMan ) );
+                if ( err2 == KErrNotFound )
+                    {
+                    error = err2;
+                    neededAction = EPropagateError;
+
+                    TRAP_IGNORE( ErrorNotificationL( KErrNotFound,
+                                                     EMPMMobilityErrorNotification ) )
+                    MPMLOGSTRING(
+                        "CMPMServerSession::HandleServerProcessErrorL - \
+Tell BM to end the client connection with appropriate error code" )   
+                    }
+                else
+                    {
+                    MPMLOGSTRING(
+                        "CMPMServerSession::HandleServerProcessErrorL - \
+Tell BM to ignore error and let MPM notify application about preferred IAP" )
+                    }
+                }
+            }
+        else
+            {
+            neededAction = EPropagateError;
+
+            MPMLOGSTRING(
+                "CMPMServerSession::HandleServerProcessErrorL - \
+Tell BM to end the client connection with appropriate error code" )
+
+            }
+        ProcessErrorComplete( KErrNone, &error, &neededAction );
+        
+        }
+    else
+        {
+        MPMLOGSTRING2(
+            "CMPMServerSession::HandleServerProcessErrorL Unknown state %d",
+            state )
+        ProcessErrorComplete( KErrCorrupt,
+                              NULL,
+                              NULL );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::HandleServerRegisterPrefIAPNotifL
+// -----------------------------------------------------------------------------
+//
+void CMPMServerSession::HandleServerRegisterPrefIAPNotifL(
+    const RMessage2& aMessage )
+    {
+    MPMLOGSTRING( "CMPMServerSession::HandleServerRegisterPrefIAPNotifL" )
+
+    // Read the Connection Id of the application
+    //
+    TConnectionId regId = aMessage.Int0();
+    MPMLOGSTRING2( "CMPMServerSession::HandleServerRegisterPrefIAPNotifL \
+- regId = 0x%x", regId )
+
+    // Get the current connection SNAP for this Connection Id
+    //
+    TUint32 regNetId = iMyServer.GetBMSnap( regId );
+
+    // Get the current connection IapId for this Connection Id 
+    //
+    TUint32 currentIap = iMyServer.GetBMIap( regId );
+    MPMLOGSTRING2( "CMPMServerSession::HandleServerRegisterPrefIAPNotifL \
+- currentIap = %i", currentIap)
+
+    // Check that there is a connection using 
+    // either IAP or SNAP
+    // 
+    if ( regNetId == 0 && currentIap == 0 )
+        {
+        MPMLOGSTRING( "CMPMServerSession::\
+        HandleServerRegisterPrefIAPNotifL - return KErrNotSupported" )
+        aMessage.Complete( KErrNotSupported );
+        return;
+        }
+
+    // Append info about registration
+    iPreferredIAPRequested = ETrue;
+
+    TConnMonIapInfo availableIAPs;
+    availableIAPs = GetAvailableIAPs();
+
+    MPMLOGSTRING2( "CMPMServerSession::HandleServerRegisterPrefIAPNotifL \
+- IAPs count: %d", availableIAPs.iCount)
+
+#ifdef _DEBUG
+    for (TUint i = 0; i < availableIAPs.Count(); i++)
+        {
+        MPMLOGSTRING2(
+                "CMPMServerSession::HandleServerRegisterPrefIAPNotifL \
+- IAP: %d", availableIAPs.iIap[i].iIapId)
+        }
+#endif // _DEBUG
+
+    // Call now the method that handles notifications for
+    // checking if notification is already triggered
+    // If SNAP is 0, don't try sending notifications 
+    //
+    if ( availableIAPs.iCount > 0 && regNetId )
+        {
+        PrefIAPNotificationL( availableIAPs, EBearerMan );
+        }
+
+    // In case the mobility application register to preferred IAP notification
+    // we have to make sure we get availability every once in a while.
+    // 
+    RArray<TUint> iapPath;
+    CleanupClosePushL( iapPath );
+    CleanupStack::PopAndDestroy( &iapPath );
+    aMessage.Complete( KErrNone );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::HandleServerUnregisterPrefIAPNotif
+// -----------------------------------------------------------------------------
+//
+void CMPMServerSession::HandleServerUnregisterPrefIAPNotif(
+    const RMessage2& aMessage )
+    {
+    // Read the Connection Id of the application
+    //
+    TConnectionId unregId = aMessage.Int0();
+    MPMLOGSTRING2( "CMPMServerSession::HandleServerUnregisterPrefIAPNotif\
+ - unregId = 0x%x", unregId )
+
+    // Currently will remove all registration for this Connection Id. 
+    // If needed change BM-MPM API to support unregistration for certain SNAP
+    //
+    iPreferredIAPRequested = EFalse;
+    iLastNotifiedIap = 0;
+    // Unblacklist all IAPs related to this connection 
+    // when unregistering from preferred IAP notification.
+    // 
+    iMyServer.HandleServerUnblackListIap( unregId, 0 );
+
+    aMessage.Complete( KErrNone );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::HandleServerWaitNotificationL
+// -----------------------------------------------------------------------------
+//
+void CMPMServerSession::HandleServerWaitNotificationL(
+    const RMessage2& aMessage )
+    {
+    MPMLOGSTRING2( "CMPMServerSession::HandleServerWaitNotification - \
+iNotifRequested = %i", iNotifRequested )
+
+    if ( !iNotifRequested )
+        {
+        // Save message for later completion
+        //
+        iNotifMessage = aMessage;
+
+        // Set requested flag
+        //
+        iNotifRequested = ETrue;
+        }
+    else
+        {
+        aMessage.Complete( KErrServerBusy );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::HandleServerSortSNAPL
+// -----------------------------------------------------------------------------
+//
+void CMPMServerSession::HandleServerSortSNAPL( const RMessage2& aMessage )
+    {
+    MPMLOGSTRING( "CMPMServerSession::HandleServerSortSNAPL()" )
+    if ( !iServerSortSNAPMessage.IsNull() )
+        {
+        MPMLOGSTRING2(
+        "CMPMServerSession::HandleServerSortSNAPL: Failed with: %d",KErrNotReady )
+
+        // Error, only one request of each type per session.
+        aMessage.Complete( KErrNotReady );
+        }
+    
+        // Store message for later usage.
+    iServerSortSNAPMessage = aMessage;
+
+    TUint32 aSeconds = static_cast<TUint32>( iServerSortSNAPMessage.Int2() );
+    
+    // To display up to date information the WLAN scan should be done first
+    iMyServer.Events()->ScanWLANNetworksL( this, 
+                                           ConnectionId(), 
+                                           EWlanScanCallbackSortSnap, 
+                                           aSeconds );
+    }
+    
+// -----------------------------------------------------------------------------
+// CMPMServerSession::CompleteServerSortSNAPL
+// -----------------------------------------------------------------------------
+//
+void CMPMServerSession::CompleteServerSortSNAP()
+    {
+    if ( iServerSortSNAPMessage.IsNull() )
+        {
+        return;
+        }
+
+    // Read SNAP
+    //
+    TUint32 snapId = static_cast<TUint32>( iServerSortSNAPMessage.Int0() );
+
+    MPMLOGSTRING2( "CMPMServerSession::CompleteServerSortSNAPL - SNAP = %i", 
+        snapId )
+
+    TMpmSnapBuffer sortedIapList;
+
+    TRAPD( err, SortSnapL( snapId, sortedIapList ) )
+    if ( err != KErrNone )
+        {
+        MPMLOGSTRING2(
+            "CMPMServerSession::CompleteServerSortSNAPL: Sorting failed with: %d", err )
+        iServerSortSNAPMessage.Complete( err );
+        return;
+        }
+
+    // Write results to message
+    // 
+    TPtrC8 e( reinterpret_cast< TUint8* >( &sortedIapList ), 
+              sizeof( sortedIapList ) );
+    TRAP( err, iServerSortSNAPMessage.WriteL( KSecondArgument, e ) )
+    if ( err != KErrNone )
+        {
+        MPMLOGSTRING2(
+            "CMPMServerSession::CompleteServerSortSNAPL: RMessage.WriteL() Failure: %d", err )
+        iServerSortSNAPMessage.Complete( err );
+        return;
+        }
+
+    MPMLOGSTRING(
+        "CMPMServerSession::CompleteServerSortSNAPL: Sorting available uncategorised IAPs completed" )
+    iServerSortSNAPMessage.Complete( KErrNone );
+    return;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::ProcessErrorWlanScanCompletedL
+// -----------------------------------------------------------------------------
+//
+void CMPMServerSession::ProcessErrorWlanScanCompletedL()
+    {
+    MPMLOGSTRING( "CMPMServerSession::ProcessErrorWlanScanCompletedL" )
+    TBMNeededAction neededAction( EIgnoreError );
+
+    // Read the Connection Id of the application
+    // 
+    TConnectionId connId = iProcessErrorMessage.Int1();
+
+    // Read Error code
+    //
+    TInt error( KErrNone);
+    
+    TPtr8 errorPtr( reinterpret_cast< TUint8* >( NULL ), 0 );
+    errorPtr.Set( reinterpret_cast< TUint8* >( &error ),
+                  sizeof( error ),
+                  sizeof( error ) );
+
+    // Read the contents of the client pointer into a TPtr8.
+    // 
+    TInt res = iProcessErrorMessage.Read( KFirstArgument, errorPtr );
+    if ( res != KErrNone )
+        {
+        iMyServer.PanicClient( KErrBadDescriptor );
+        return;
+        }
+
+    // Get the current connection IapId for this connId 
+    //
+    TUint32 currentIap = iMyServer.GetBMIap( connId );
+
+    // get available iaps
+    TConnMonIapInfo availableIAPs;
+    availableIAPs = GetAvailableIAPs();
+
+    RemoveUnavailableIap( availableIAPs, currentIap );
+
+    TRAPD( err2, PrefIAPNotificationL( availableIAPs, EBearerMan ) );
+    if ( err2 == KErrNotFound )
+        {
+        error = err2;
+        neededAction = EPropagateError;
+
+        TRAP_IGNORE( ErrorNotificationL( KErrNotFound,
+                                         EMPMMobilityErrorNotification ) )
+       MPMLOGSTRING( "CMPMServerSession::ProcessErrorWlanScanCompletedL - \
+Tell BM to end the client connection with appropriate error code" )
+       }
+    else
+       {
+       MPMLOGSTRING( "CMPMServerSession::ProcessErrorWlanScanCompletedL - \
+Tell BM to ignore error and let MPM notify application about preferred IAP" )
+        }
+        
+    ProcessErrorComplete( KErrNone, &error, &neededAction );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::SortSnapL
+// -----------------------------------------------------------------------------
+//
+void CMPMServerSession::SortSnapL( const TUint32 aSnapId, 
+                                   TMpmSnapBuffer& aSortedIaps )
+    {
+    MPMLOGSTRING2( "CMPMServerSession::SortSnapL - SNAP = %i", 
+        aSnapId )
+
+    TBool hideIap( EFalse ); 
+
+    // In case snapId is zero, return the 
+    // list of available uncategorised IAPs 
+    // 
+    if ( aSnapId == KSortUncategorisedIaps )
+        {
+        RAvailableIAPList availableUncatIAPList;
+        CleanupClosePushL( availableUncatIAPList );
+        AvailableUnblacklistedIapsL( availableUncatIAPList, iConnId );
+
+        iMyServer.CommsDatAccess()->RemoveCategorisedIapsL( availableUncatIAPList );
+
+        aSortedIaps.Reset();
+
+        for ( TInt i( 0 ); ( (i < availableUncatIAPList.Count()) ); i++ )
+            {
+            // Check first if metadata EMetaHiddenAgent is enabled.
+            // 
+            hideIap = iMyServer.CommsDatAccess()->CheckHiddenAgentL( availableUncatIAPList[i] );
+            if ( hideIap )
+                {
+                // In that case IAP can't be shown in Connection Dialog.
+                // 
+                MPMLOGSTRING2( 
+                    "CMPMServerSession::SortSnapL: Remove HiddenAgent IAP = %i", 
+                    availableUncatIAPList[i] )
+                }
+            else
+                {
+                aSortedIaps.iIapId[aSortedIaps.iCount] = availableUncatIAPList[i];
+                aSortedIaps.iCount++;
+                }
+            }
+
+#ifdef _DEBUG
+        // Print info into the log file
+        //
+        MPMLOGSTRING( "CMPMServerSession::SortSnapL: Sorted IAPs" )
+        for ( TInt p = 0; p < aSortedIaps.Count(); p++ )
+            {
+            MPMLOGSTRING2(
+                "CMPMServerSession::SortSnapL: IapId = %i", 
+                aSortedIaps.iIapId[p] )
+            }
+#endif // _DEBUG
+
+        // Release memory
+        //
+        CleanupStack::PopAndDestroy( &availableUncatIAPList );
+        return;
+        }
+
+    RArray<TNetIap> destNetIaps, embeddedIaps;
+    CleanupClosePushL( destNetIaps );
+    CleanupClosePushL( embeddedIaps );
+
+    // Find the valid IAPs belonging to the Snap.
+    //
+    iMyServer.CommsDatAccess()->SearchDNEntriesWithEmbeddedL( aSnapId, destNetIaps, embeddedIaps );
+
+    RAvailableIAPList availableIAPList;
+    CleanupClosePushL( availableIAPList );
+    AvailableUnblacklistedIapsL( availableIAPList, iConnId );
+
+    // Remove any unavailable IAP from destNetIaps
+    // 
+    TInt ret        = KErrNotFound;
+    TInt destCount  = destNetIaps.Count();
+    
+    // Decrement by one, because count is n, 
+    // but indexes in array are 0 .. n-1.
+    // 
+    destCount--;
+
+    // This time we are browsing the array from the end to the beginning, 
+    // because removing one element from array affects index numbering.
+    // 
+    for ( TInt k = destCount; k >= 0; k-- )
+        {
+        ret = availableIAPList.Find( destNetIaps[k].iIapId );
+        if ( ret == KErrNotFound )
+            {
+            MPMLOGSTRING2( "CMPMServerSession::SortSnapL: \
+Remove unavailable IAP = %i", destNetIaps[k].iIapId )
+            destNetIaps.Remove( k );
+            }
+        else
+            {
+            // Check first if metadata EMetaHiddenAgent is enabled.
+            // 
+            hideIap = iMyServer.CommsDatAccess()->CheckHiddenAgentL( destNetIaps[k].iIapId );
+            if ( hideIap )
+                {
+                // In that case IAP can't be shown in Connection Dialog.
+                // 
+                MPMLOGSTRING2( 
+                    "CMPMServerSession::SortSnapL: Remove HiddenAgent IAP = %i", 
+                    destNetIaps[k].iIapId )
+                destNetIaps.Remove( k );
+                }
+            }
+        }
+
+    // Remove any unavailable IAP from embeddedIaps
+    // 
+    if ( embeddedIaps.Count() > 0 )
+        {
+        TInt embedCount = embeddedIaps.Count();
+        embedCount--;
+
+        for ( TInt m = embedCount; m >= 0; m-- )
+            {
+            ret = availableIAPList.Find( embeddedIaps[m].iIapId );
+            if ( ret == KErrNotFound )
+                {
+                MPMLOGSTRING2( "CMPMServerSession::SortSnapL: \
+Remove unavailable IAP = %i", embeddedIaps[m].iIapId )
+                embeddedIaps.Remove( m );
+                }
+            else
+                {
+                // Check first if metadata EMetaHiddenAgent is enabled.
+                // 
+                hideIap = iMyServer.CommsDatAccess()->CheckHiddenAgentL( embeddedIaps[m].iIapId );
+                if ( hideIap )
+                    {
+                    // In that case IAP can't be shown in Connection Dialog.
+                    // 
+                    MPMLOGSTRING2( 
+                        "CMPMServerSession::SortSnapL: Remove HiddenAgent IAP = %i", 
+                        embeddedIaps[m].iIapId )
+                    embeddedIaps.Remove( m );
+                    }
+                }
+            }
+        }
+
+    // Determine the actual priorities for virtual IAPs and embedded Snaps
+    // 
+    iMyServer.CommsDatAccess()->DeterminePrioritiesL( destNetIaps, availableIAPList,
+                                                      *this );
+    if ( embeddedIaps.Count() > 0 )
+        {
+        iMyServer.CommsDatAccess()->DeterminePrioritiesL( embeddedIaps,
+                                                          availableIAPList,
+                                                          *this );
+        }
+
+    aSortedIaps.Reset();
+
+    // Start sorting destNetIaps and embeddedIaps.
+    // 
+    for( TInt p = 0; ( destNetIaps.Count()  > 0 ) || 
+                     ( embeddedIaps.Count() > 0 ); p++ )
+        {
+        // Go through the destNetIaps-array and check the global bearer 
+        // priority for both destNetIaps and embeddedIaps until the best 
+        // available IAP is found.
+        // 
+        TUint32 destNetPriority( KLowestPriority );
+        TUint32 embeddedPriority( KLowestPriority );
+
+        if( destNetIaps.Count() > 0 )
+            {
+            iMyServer.CommsDatAccess()->GlobalBearerPriorityL( destNetIaps[0].iIapId, 
+                                   destNetPriority );
+            }
+
+        if( embeddedIaps.Count() > 0 )
+            {
+            iMyServer.CommsDatAccess()->GlobalBearerPriorityL( embeddedIaps[0].iIapId, 
+                                   embeddedPriority );
+            }
+
+        // Compare the global bearer priorities of the first IAPs and 
+        // select the better. 
+        // 
+        // If the priorities are equal, prioritize the Snap 
+        // over the embedded Snap.
+        // 
+        // When comparing the priorities, smaller value is better.
+        // 
+        // Finally, append IapId to sortedList.
+        //
+        if( destNetPriority <= embeddedPriority )
+            {
+            if( destNetIaps.Count() > 0 )
+                {
+                aSortedIaps.iIapId[p] = destNetIaps[0].iIapId;
+                aSortedIaps.iCount++;
+                MPMLOGSTRING2(
+                    "CMPMServerSession::SortSnapL: IapId = %i", 
+                    destNetIaps[0].iIapId )
+                MPMLOGSTRING2(
+                    "CMPMServerSession::SortSnapL: Snap  = %i", 
+                    destNetIaps[0].iSnap )
+                destNetIaps.Remove( 0 );
+                }
+            }
+        else
+            {
+            if( embeddedIaps.Count() > 0 )
+                {
+                aSortedIaps.iIapId[p] = embeddedIaps[0].iIapId;
+                aSortedIaps.iCount++;
+                MPMLOGSTRING2(
+                    "CMPMServerSession::SortSnapL: IapId = %i", 
+                    embeddedIaps[0].iIapId )
+                MPMLOGSTRING2(
+                    "CMPMServerSession::SortSnapL: Snap  = %i", 
+                    embeddedIaps[0].iSnap )
+                embeddedIaps.Remove( 0 );
+                }
+            }
+        }
+
+    // Release memory
+    //
+    CleanupStack::PopAndDestroy( &availableIAPList );
+    CleanupStack::PopAndDestroy( &embeddedIaps );
+    CleanupStack::PopAndDestroy( &destNetIaps );
+
+#ifdef _DEBUG
+    // Print info into the log file
+    //
+    MPMLOGSTRING( "CMPMServerSession::SortSnapL: Sorted IAPs" )
+    for ( TInt n = 0; n < aSortedIaps.Count(); n++ )
+        {
+        MPMLOGSTRING2(
+            "CMPMServerSession::SortSnapL: IapId = %i", 
+            aSortedIaps.iIapId[n] )
+        }
+#endif // _DEBUG
+
+    MPMLOGSTRING(
+            "CMPMServerSession::SortSnapL: Sorting completed" )
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::UpdateConnectionDialog
+// -----------------------------------------------------------------------------
+//
+void CMPMServerSession::UpdateConnectionDialogL()
+    {
+    if( iIapSelection )
+        {
+        iIapSelection->UpdateConnectionDialogL();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::CompleteCarrierRejected
+// -----------------------------------------------------------------------------
+//
+void CMPMServerSession::CompleteCarrierRejected()
+    {
+    TInt error( KErrNotFound );
+
+    MPMLOGSTRING( "CMPMServerSession::CompleteCarrierRejected" )
+
+    TConnMonIapInfo availableIAPs;
+    availableIAPs = GetAvailableIAPs();
+
+    if ( availableIAPs.iCount > 0 ) 
+        {
+        TRAP( error, PrefIAPNotificationL( availableIAPs, EBearerMan ) );
+        if ( error == KErrNotFound )
+            {
+            TRAP( error, ErrorNotificationL( KErrNotFound,
+                                             EMPMMobilityErrorNotification ) );
+            }
+        }
+    else
+        {
+        MPMLOGSTRING(
+            "CMPMServerSession::CompleteCarrierRejected - \
+No IAPs available, send error notification" )
+        TRAP( error, ErrorNotificationL( KErrNotFound,
+                                         EMPMMobilityErrorNotification ) );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::ExtractConnPref
+// -----------------------------------------------------------------------------
+//
+TInt CMPMServerSession::ExtractConnPref(
+    const TConnPref& aBasePref,
+    TMpmConnPref& aMpmConnPref ) const
+    {
+    TInt error( KErrNone );
+
+    // Extract connection preferences from TConnPref to TMpmConnPref
+    // based on the type of the connection preferences.
+    //
+    switch ( aBasePref.ExtensionId() )
+        {
+        case TConnPref::EConnPrefCommDb: // TCommDbConnPref
+            {
+            MPMLOGSTRING(
+                "CMPMServerSession::ExtractConnPref - EConnPrefCommDb" )
+            error = ExtractConnPrefCommDb( aBasePref, aMpmConnPref );
+            break;
+            }
+        case TConnPref::EConnPrefCommDbMulti: // TCommDbMultiConnPref
+            {
+            MPMLOGSTRING(
+                "CMPMServerSession::ExtractConnPref - EConnPrefCommDbMulti" )
+            error = ExtractConnPrefCommDbMulti( aBasePref, aMpmConnPref );
+            break;
+            }
+        case TConnPref::EConnPrefSnap: // TConnSnapPref
+            {
+            MPMLOGSTRING(
+                "CMPMServerSession::ExtractConnPref - EConnPrefSnap" )
+            error = ExtractConnPrefSnap( aBasePref, aMpmConnPref );
+            break;
+            }
+        case TMpmConnPref::EConnPrefMpm: // TMpmConnPref
+            {
+            MPMLOGSTRING(
+                "CMPMServerSession::ExtractConnPref - EConnPrefMpm" )
+            error = ExtractConnPrefMpm( aBasePref, aMpmConnPref );
+            break;
+            }
+        case TConnPref::EConnPrefUnknown: // Default connection
+            {
+            MPMLOGSTRING( "CMPMServerSession::ExtractConnPref - \
+EConnPrefUnknown overriding to default conn" )
+            break;
+            }
+        default:
+            {
+            MPMLOGSTRING( "CMPMServerSession::ExtractConnPref - \
+Unrecognised connection preference type" )
+            error = KErrArgument;
+            }
+        }
+
+    ResolveConnType( aMpmConnPref );
+
+    MPMLOGSTRING2( "CMPMServerSession::ExtractConnPref - \
+Error code in the end: %d", error )
+    return error;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::ExtractConnPrefCommDb
+// -----------------------------------------------------------------------------
+//
+TInt CMPMServerSession::ExtractConnPrefCommDb(
+    const TConnPref& aBasePref,
+    TMpmConnPref& aMpmConnPref ) const
+    {
+    ASSERT( aBasePref.ExtensionId() == TConnPref::EConnPrefCommDb );
+    TInt error( KErrNone );
+
+    // Cast down to a TCommDbConnPref
+    TCommDbConnPref commDbPref;
+    commDbPref = TCommDbConnPref::Cast( aBasePref );
+
+    // This is an old sanity check which is not complete but we cannot
+    // expand it to keep backwards compatibility.
+    if ( commDbPref.IapId() == 0 && commDbPref.NetId() != 0 &&
+         commDbPref.DialogPreference() != ECommDbDialogPrefPrompt )
+        {
+        error = KErrArgument;
+        }
+    else
+        {
+        // Map dialog preference. Only request for connection selection
+        // dialog is needed as other values either match the default values of TMpmConnPref
+        // or are ignored (ECommDbDialogPrefWarn and
+        // ECommDbDialogPrefPromptIfWrongMode).
+        if ( commDbPref.DialogPreference() == ECommDbDialogPrefPrompt )
+            {
+            aMpmConnPref.SetConnSelectionDialog( ETrue );
+            }
+        else
+            {
+            // Map IAP id.
+            aMpmConnPref.SetIapId( commDbPref.IapId() );
+            }
+
+        // commDbPref.NetId() is ignored as it's retrieved by MPM based on
+        // final selection.
+        // commDbPref.Direction() is ignored as it's not used in MPM.
+
+        // Transfer bearerset from aCommDbPref to aMpmConnPref
+        // in case 'prompt from user' or 'explicit SNAP requested'.
+        // If only IAP is given, bearer set is ignored and not set.
+        // If bearer set is set for IAP connection here, implementation of
+        // "WLAN Only" setting feature will prevent cellular IAP connection
+        // from happening
+        if ( commDbPref.DialogPreference() != ECommDbDialogPrefUnknown &&
+             ( commDbPref.IapId() == 0 ||
+               commDbPref.DialogPreference() == ECommDbDialogPrefPrompt ) )
+            {
+            if ( commDbPref.BearerSet() & ECommDbBearerWLAN )
+                {
+                aMpmConnPref.SetBearerSet( aMpmConnPref.BearerSet() | 
+                        TExtendedConnPref::EExtendedConnBearerWLAN );
+                }
+
+            if ( commDbPref.BearerSet() & ECommDbBearerWcdma ||
+                 commDbPref.BearerSet() & DeprecatedCDMA2000 )
+                {
+                aMpmConnPref.SetBearerSet( aMpmConnPref.BearerSet() | 
+                        TExtendedConnPref::EExtendedConnBearerCellular );
+                }
+            }
+        }
+
+    return error;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::ExtractConnPrefCommDbMulti
+// -----------------------------------------------------------------------------
+//
+TInt CMPMServerSession::ExtractConnPrefCommDbMulti(
+    const TConnPref& aBasePref,
+    TMpmConnPref& aMpmConnPref ) const
+    {
+    ASSERT( aBasePref.ExtensionId() == TConnPref::EConnPrefCommDbMulti );
+    TInt error( KErrNone );
+
+    // Cast down to a TCommDbMultiConnPref
+    TCommDbMultiConnPref multiPrefs;
+    multiPrefs = TCommDbMultiConnPref::Cast( aBasePref );
+
+    // Try to retrieve the connection preference for the first attempt
+    TCommDbConnPref commDbPref;
+    error = multiPrefs.GetPreference( 1, commDbPref );
+
+    if ( error == KErrNone )
+        {
+        error = ExtractConnPrefCommDb( commDbPref, aMpmConnPref );
+        }
+
+    return error;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::ExtractConnPrefSnap
+// -----------------------------------------------------------------------------
+//
+TInt CMPMServerSession::ExtractConnPrefSnap(
+    const TConnPref& aBasePref,
+    TMpmConnPref& aMpmConnPref ) const
+    {
+    ASSERT( aBasePref.ExtensionId() == TConnPref::EConnPrefSnap );
+
+    // Cast down to a TConnSnapPref
+    TConnSnapPref snapPref;
+    snapPref = *reinterpret_cast<TCommSnapPref*>(
+            const_cast<TConnPref*>( &aBasePref ) );
+
+    // Check whether old net id, new snap id, or zero is given.
+    // If snap id equals to zero, doing nothing here implies default
+    // connection is used. We cannot give error in this case because it has
+    // worked as default connection request earlier.
+    TInt snapid(0);
+    TInt error( KErrNone );
+    if ( snapPref.Snap() > 0 &&
+         snapPref.Snap() <= 0x100 )
+        {
+        // Old Destination network id passed. Convert to SNAP id.
+        TRAP( error,
+              snapid = iMyServer.CommsDatAccess()->MapNetIdtoSnapAPL(
+                  snapPref.Snap() ) );
+        }
+    else if ( snapPref.Snap() != 0 )
+        {
+        // Snap id passed.
+        snapid = snapPref.Snap();
+        }
+
+    aMpmConnPref.SetSnapId( snapid );
+
+    return error;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::ExtractConnPrefMpm
+// -----------------------------------------------------------------------------
+//
+TInt CMPMServerSession::ExtractConnPrefMpm(
+    const TConnPref& aBasePref,
+    TMpmConnPref& aMpmConnPref ) const
+    {    
+    ASSERT( aBasePref.ExtensionId() == TMpmConnPref::EConnPrefMpm );
+    TInt error( KErrNone );
+
+    aMpmConnPref = *reinterpret_cast<TMpmConnPref*>(
+        const_cast<TConnPref*>( &aBasePref ) );
+
+    // Validate connection preferences and if they are valid, resolve needed
+    // information into more practical format for MPM.
+    error = ValidateExtendedConnPref( aMpmConnPref );
+    if ( error == KErrNone )
+        {
+        // Find the SNAP id based on SNAP purpose.
+        CMManager::TSnapPurpose aSnapPurpose = aMpmConnPref.SnapPurpose();
+        TInt error = KErrNone;
+        
+        // MPM searches SnapId for requested purpose by going through all
+        // destinations in CommsDat.
+        if ( aSnapPurpose != CMManager::ESnapPurposeUnknown )
+            {
+            TUint32 snapId(0);
+            TRAP( error, snapId = iMyServer.CommsDatAccess()->DestinationIdL(
+                                      aSnapPurpose ) );
+            if ( error == KErrNone )
+                {
+                aMpmConnPref.SetSnapId( snapId );
+                }
+            }
+
+        // Mark IAP as mandated if IAP id is given. 
+        if ( aMpmConnPref.IapId() != 0 )
+            {
+            aMpmConnPref.SetMandateIap( ETrue );
+            }
+        }
+
+    return error;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::ValidateExtendedConnPref
+// 
+// Makes a sanity check to the custom preferences and return KErrArgument
+// if there are illegal combinations in the connection preferences
+// -----------------------------------------------------------------------------
+//
+TInt CMPMServerSession::ValidateExtendedConnPref(
+    TMpmConnPref& aMpmConnPref ) const
+    {     
+    // If iap id is set, neither snap nor bearer set can be defined
+    if ( aMpmConnPref.IapId() != 0 )
+        {
+        if ( ( aMpmConnPref.SnapId() != 0 ) ||
+             ( aMpmConnPref.BearerSet() !=
+               TExtendedConnPref::EExtendedConnBearerUnknown ) )
+            {
+            return KErrArgument;
+            }
+        }
+    
+    // If snap purpose is set, then neither iap nor snap id should be defined
+    if ( aMpmConnPref.SnapPurpose() != CMManager::ESnapPurposeUnknown )
+        {
+        if ( ( aMpmConnPref.IapId() != 0 )  || 
+             ( aMpmConnPref.SnapId() != 0 ) )
+            {
+            return KErrArgument;
+            }
+        }
+    
+    // If selection dialog is enabled, Snap id, iap id and snap purpose
+    // should not be set
+    if ( aMpmConnPref.ConnSelectionDialog() )
+        {
+        if ( ( aMpmConnPref.SnapId() != 0 )  || 
+             ( aMpmConnPref.IapId() != 0 ) || 
+             ( aMpmConnPref.SnapPurpose() != CMManager::ESnapPurposeUnknown ) )
+            {
+            return KErrArgument;
+            }
+        }
+    
+    // Check that the given enumerations are within the enumeration ranges
+    if ( ( aMpmConnPref.SnapPurpose() < CMManager::ESnapPurposeUnknown ) ||
+         ( aMpmConnPref.SnapPurpose() > CMManager::ESnapPurposeIntranet ) ||
+         ( aMpmConnPref.NoteBehaviour() >
+           TExtendedConnPref::ENoteBehaviourConnSilent ) ||
+         ( aMpmConnPref.BearerSet() > 
+               ( TExtendedConnPref::EExtendedConnBearerCellular + 
+                 TExtendedConnPref::EExtendedConnBearerWLAN ) ) )
+        {
+        return KErrArgument;
+        }
+    
+    // Check that one of SNAP purpose, SNAP id, IAP id or Connection selection
+    // dialog is given
+    if ( ( aMpmConnPref.SnapPurpose() == CMManager::ESnapPurposeUnknown ) &&
+         ( aMpmConnPref.SnapId() == 0 ) &&
+         ( aMpmConnPref.IapId() == 0 ) &&
+         ( aMpmConnPref.ConnSelectionDialog() == EFalse ) )
+        {
+        return KErrArgument;
+        }
+    
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::ResolveConnType
+// -----------------------------------------------------------------------------
+//
+void CMPMServerSession::ResolveConnType( TMpmConnPref& aMpmConnPref ) const
+    {
+    // Define the connection type based on the connection preferences.
+    if ( aMpmConnPref.ConnSelectionDialog() )
+        {
+        // Connection selection dialog was requested.
+        aMpmConnPref.SetConnType( TMpmConnPref::EConnTypeImplicit );
+        }
+    else if ( aMpmConnPref.IapId() != 0 ||
+              aMpmConnPref.SnapId() != 0 ||
+              aMpmConnPref.SnapPurpose() != CMManager::ESnapPurposeUnknown )
+        {
+        // Either IAP id, SNAP id or SNAP purpose was given.
+        aMpmConnPref.SetConnType( TMpmConnPref::EConnTypeExplicit );
+        }
+    else
+        {
+        // Otherwise this is handled as a request to default connection.
+        aMpmConnPref.SetConnType( TMpmConnPref::EConnTypeDefault );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::IapSelectionL
+// -----------------------------------------------------------------------------
+//
+CMPMIapSelection* CMPMServerSession::IapSelectionL()
+    {
+    if( !iIapSelection )
+        {
+        MPMLOGSTRING( "CMPMServerSession::IapSelectionL error, no connection started" )
+        User::Leave( KErrNotFound );
+        }
+    return iIapSelection;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::PrefIAPNotificationL
+// -----------------------------------------------------------------------------
+//
+void CMPMServerSession::PrefIAPNotificationL(
+    const TConnMonIapInfo&      aIapInfo,
+    const TPrefIAPNotifCaller   aCaller )
+    {
+    MPMLOGSTRING( "CMPMServerSession::PrefIAPNotificationL" )
+
+    if ( !iNotifRequested || !iPreferredIAPRequested )
+        {
+        MPMLOGSTRING( "CMPMServerSession::PrefIAPNotificationL - \
+No notification requested" )
+        return;
+        }
+    
+    // Dig out the state of this connection.
+    //
+    TConnectionState state;
+    iMyServer.GetConnectionState( iConnId, state );
+    
+    // If session is roaming, notification must be delayed.
+    // But, only ConnMon initiated notifications need to be delayed.
+    // Required notifications must go through whenever MPM decides
+    // to initiate them.
+    //
+    if( ( iStoredIapInfo.HoldPrefIapNotif() && aCaller == EConnMon)  ||
+        ( state == ERoaming && aCaller == EConnMon ) )
+        {
+        MPMLOGSTRING( "CMPMServerSession::PrefIAPNotificationL - \
+Mobility ongoing, notification will be handled later" )
+        iStoredIapInfo.SetStoredIapInfo( aIapInfo );
+        return;
+        }
+
+    TInt err(0);
+    TInt currentIap = MyServer().GetBMIap( iConnId );
+    MPMLOGSTRING4( "CMPMServerSession::PrefIAPNotificationL - \
+current iap %d, last notified %d, err %d ", currentIap, iLastNotifiedIap, err )
+    if( err != KErrNone )
+        {
+        MPMLOGSTRING( "CMPMServerSession::PrefIAPNotificationL: Connection is not \
+registered for notifications" )
+        return;
+        }
+        
+    TBool iapTypeLanOrWlan( EFalse );
+    RAvailableIAPList  availableIAPList;
+    CleanupClosePushL( availableIAPList );
+    TUint32 validateIapId( 0 );
+    TUint32 oldIapId( 0 );
+
+    TMpmNotificationPrefIAPAvailable notifInfo;
+    notifInfo.iMPMNotificationType = EMPMPreferredIAPAvailable;
+
+    AvailableUnblacklistedIapsL( availableIAPList, aIapInfo, iConnId);
+    oldIapId = currentIap;
+            
+    // If connection is using SNAP
+    // 
+    TUint32 snap = iMyServer.GetBMSnap( iConnId );
+    if( snap != 0 )
+        {
+        TMpmConnPref tempMpmConnPref;
+        tempMpmConnPref.SetIapId( 0 );
+        tempMpmConnPref.SetSnapId( snap );
+        IapSelectionL()->ChooseBestIAPL( tempMpmConnPref, availableIAPList );
+        validateIapId = tempMpmConnPref.IapId();
+        if ( ( validateIapId == 0 ) && ( aCaller == EConnMon ) )
+            {
+            // Since Connection Monitor is the only component which 
+            // is unaware of Connection Id and SNAP, it can't send 
+            // the error notification in case ChooseBestIAPL could 
+            // not find any available IAP for this SNAP. 
+            // 
+            // All the other components take responsibility of 
+            // sending the error notification. 
+            // 
+            TRAP_IGNORE( ErrorNotificationL( KErrNotFound,
+                                             EMPMMobilityErrorNotification ) )
+            }
+
+        TUint32 retNetId = 0;
+        iMyServer.CommsDatAccess()->ValidateIapL( iConnId, 
+                                       validateIapId, 
+                                       retNetId, 
+                                       iapTypeLanOrWlan,
+                                       *this );
+        
+        if ( CheckNotifNeed( currentIap,
+                             iLastNotifiedIap,
+                             validateIapId ) )
+            {
+            MPMLOGSTRING2( "CMPMServerSession::PrefIAPNotificationL: \
+Sending pref iap notification connId: 0x%x", iConnId )
+
+            iLastNotifiedIap = validateIapId; 
+
+            notifInfo.iIsUpgrade = IsUpgrade( oldIapId, 
+                                              validateIapId, 
+                                              availableIAPList );
+
+            // Put real value of iIsSeamless here for NLR.
+            // 
+            notifInfo.iIsSeamless = EFalse;
+            notifInfo.iConnId = iConnId;
+
+            MPMLOGSTRING3( "CMPMServerSession::PrefIAPNotificationL: \
+Roaming from Iap %i to Iap %i", oldIapId, validateIapId )
+
+            notifInfo.iNewIapId = validateIapId;
+            notifInfo.iOldIapId = oldIapId;
+                    
+            if ( aCaller != EConfirmDlgRoaming )
+                {
+                delete iConfirmDlgRoaming;
+                iConfirmDlgRoaming = NULL;
+                }
+
+            // Write buffer to BM
+            //
+            TPtrC8 d( reinterpret_cast< TUint8* >( &notifInfo ),
+                      notifInfo.Length() );
+            iNotifMessage.WriteL( KFirstArgument, d );
+
+            // Reset flag
+            //
+            iNotifRequested = EFalse;
+
+            // Hold the preferred IAP already during the preferred IAP notification.
+            // In Freeway new PreferredCarrier can only be processed after the
+            // response for the previous one is received.
+            //
+            iStoredIapInfo.SetHoldPrefIapNotif();
+            
+            // Now complete WaitNotification to BM
+            //
+            MPMLOGSTRING( "CMPMServerSession::PrefIAPNotificationL - \
+Send preferred IAP notification" )
+            iNotifMessage.Complete( KErrNone );
+            }
+        }
+        // Connection is using IAP
+        // In this case only check if the current IAP is found 
+        // in available IAP list.
+        // If it's not, then notify error.
+        // 
+    else 
+        {
+        err = availableIAPList.Find( oldIapId );
+        if( err == KErrNotFound )
+            {
+            MPMLOGSTRING2( "CMPMServerSession::PrefIAPNotificationL: \
+SNAP 0 and IAP %d not available, notifying error", oldIapId )
+            TRAP_IGNORE( ErrorNotificationL( KErrNotFound,
+                                             EMPMMobilityErrorNotification ) )
+            }
+        }
+
+    // Release memory
+    //
+    CleanupStack::PopAndDestroy( &availableIAPList );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::StartIAPNotificationL
+// -----------------------------------------------------------------------------
+//
+void CMPMServerSession::StartIAPNotificationL( const TUint32 aIapId )
+    {
+    MPMLOGSTRING3( "CMPMServerSession::StartIAPNotificationL: aConnId = 0x%x,\
+ aIapId = %i", iConnId, aIapId )
+
+    iStoredIapInfo.SetHoldPrefIapNotif();
+    
+    if ( !iNotifRequested )
+        {
+        MPMLOGSTRING( "CMPMServerSession::StartIAPNotificationL - \
+No notification requested" )
+        return;
+        }
+
+    TMpmNotificationStartIAP notifInfo;
+    notifInfo.iMPMNotificationType = EMPMStartIAPNotification;
+    notifInfo.iInfo.iIap = aIapId;
+    notifInfo.iInfo.iConnId = iConnId;
+    notifInfo.iInfo.iServiceId = GetServiceIdSettingL();    
+
+    // Write buffer to BM
+    //
+    TPtrC8 d(reinterpret_cast< TUint8* >( &notifInfo ),
+                notifInfo.Length() );
+    iNotifMessage.WriteL( KFirstArgument, d );
+
+    // Reset flag
+    //
+    iNotifRequested = EFalse;
+
+    // Now complete WaitNotification to BM
+    //
+    MPMLOGSTRING( "CMPMServerSession::StartIAPNotificationL - \
+Send start IAP notification" )
+    iNotifMessage.Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::StopIAPNotificationL
+// -----------------------------------------------------------------------------
+//
+void CMPMServerSession::StopIAPNotificationL( TInt aIapId )
+    {
+    MPMLOGSTRING2( "CMPMServerSession::StopIAPNotificationL: aConnId = 0x%x", iConnId)
+    
+    if ( !iNotifRequested )
+        {
+        MPMLOGSTRING( "CMPMServerSession::StopIAPNotificationL - \
+No notification requested" )
+        return;
+        }
+
+    TMpmNotificationStopIAP notifInfo;
+    notifInfo.iMPMNotificationType = EMPMStopIAPNotification;
+    notifInfo.iInfo.iConnId = iConnId;
+    notifInfo.iInfo.iIap = aIapId;
+
+    // Write buffer to BM
+    //
+    TPtrC8 d(reinterpret_cast< TUint8* >( &notifInfo ),
+                notifInfo.Length() );
+    iNotifMessage.WriteL( KFirstArgument, d );
+
+    // Reset flag
+    //
+    iNotifRequested = EFalse;
+
+    // Now complete WaitNotification to BM
+    //
+    MPMLOGSTRING( "CMPMServerSession::StopIAPNotificationL - \
+Send stop IAP notification" )
+    iNotifMessage.Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::ErrorMobilityNotificationL
+// -----------------------------------------------------------------------------
+//
+void CMPMServerSession::MobilityErrorNotificationL( TInt aError )
+    {
+    MPMLOGSTRING2(
+        "CMPMServerSession::MobilityErrorNotificationL: aError = %i ",
+        aError )
+        
+    ErrorNotificationL( aError, EMPMMobilityErrorNotification );
+    }
+    
+// -----------------------------------------------------------------------------
+// CMPMServerSession::ErrorClientNotificationL
+// -----------------------------------------------------------------------------
+//
+void CMPMServerSession::ClientErrorNotificationL( TInt aError )
+    {
+    MPMLOGSTRING2(
+        "CMPMServerSession::ClientErrorNotificationL: aError = %i ",
+        aError )
+        
+    ErrorNotificationL( aError, EMPMClientErrorNotification );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::ErrorNotificationL
+// -----------------------------------------------------------------------------
+//
+void CMPMServerSession::ErrorNotificationL( TInt aError, 
+                                            TMpmNotifications aNotificationType )
+    {
+    MPMLOGSTRING3(
+        "CMPMServerSession::ErrorNotificationL: aError = %i, aNotificationType = %i",
+        aError, aNotificationType )
+
+    if ( !iNotifRequested )
+        {
+        MPMLOGSTRING( "CMPMServerSession::ErrorNotificationL - \
+No notification requested" )
+        return;
+        }
+
+    TMpmNotificationError errorNotif;
+    
+    errorNotif.iMPMNotificationType = aNotificationType;
+    errorNotif.iError = aError;
+    errorNotif.iConnId = iConnId;
+
+    // Write buffer to BM
+    TPtrC8 d(reinterpret_cast< TUint8* >( &errorNotif ),
+             errorNotif.Length() );
+    iNotifMessage.WriteL( KFirstArgument, d );
+
+    // Reset flag
+    iNotifRequested = EFalse;
+
+    // Now complete error notification to BM
+    MPMLOGSTRING("CMPMServerSession::ErrorNotificationL - Send error notification" )
+    iNotifMessage.Complete( KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::IsPhoneOfflineL
+// 
+// Checks if phone is in offline mode or not.
+// Return ETrue if phone is in offline mode.
+// Return EFalse if phone is not in offline mode.
+// -----------------------------------------------------------------------------
+//
+TBool CMPMServerSession::IsPhoneOfflineL() const
+    {
+    MPMLOGSTRING( "CMPMServerSession::IsPhoneOfflineL" )
+    if ( iOfflineFeatureSupported )
+        {
+        CRepository* repository = CRepository::NewLC(KCRUidCoreApplicationUIs);
+        TInt connAllowed = ECoreAppUIsNetworkConnectionAllowed;
+        repository->Get( KCoreAppUIsNetworkConnectionAllowed, connAllowed );
+        CleanupStack::PopAndDestroy( repository ); 
+        if ( !connAllowed )
+            {
+            MPMLOGSTRING(
+                "CMPMServerSession::IsPhoneOfflineL Phone is in offline mode" )
+            return ETrue;
+            }
+        }
+    MPMLOGSTRING(
+        "CMPMServerSession::IsPhoneOfflineL Phone is not in offline mode" )
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::AvailableUnblacklistedIapsL
+// -----------------------------------------------------------------------------
+//
+void CMPMServerSession::AvailableUnblacklistedIapsL( 
+    RAvailableIAPList&  aAvailableIAPs, 
+    const TConnectionId aConnId )
+    {
+    MPMLOGSTRING( "CMPMServerSession::AvailableUnblacklistedIapsL" )
+
+    TConnMonIapInfo availableIAPList;
+    availableIAPList = GetAvailableIAPs();
+
+    AvailableUnblacklistedIapsL( aAvailableIAPs, 
+                                 availableIAPList, 
+                                 aConnId );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::AvailableUnblacklistedIapsL
+// -----------------------------------------------------------------------------
+//
+void CMPMServerSession::AvailableUnblacklistedIapsL( 
+    RAvailableIAPList&  aAvailableIAPs, 
+    const TConnMonIapInfo&    aIapInfo, 
+    const TConnectionId aConnId )
+    {
+    RArray<TUint32> blacklistiaps;
+    CleanupClosePushL( blacklistiaps );
+    TWlanSsid       ssid;
+    TUint32         iapId( 0 );
+
+    aAvailableIAPs.Reset();
+
+    for (TUint i = 0; i < aIapInfo.iCount; i++)
+        {
+        aAvailableIAPs.AppendL( aIapInfo.iIap[i].iIapId );
+        }
+
+    // Get list of blacklisted IAPs.
+    // 
+    iMyServer.GetBlacklistedIAP( aConnId, blacklistiaps );
+
+    // If there is an active WLAN connection
+    // 
+    if ( iMyServer.Events()->ActiveWlanConnection( ssid, iapId ) )
+        {
+        RAvailableIAPList unavailableIAPs;
+        CleanupClosePushL( unavailableIAPs );
+        TRAP_IGNORE( UnavailableIAPsL( aAvailableIAPs, 
+                                   unavailableIAPs ) )
+        
+        TBool activeAvailable( ETrue );
+        if (unavailableIAPs.Find(iapId) != KErrNotFound)
+            {
+            MPMLOGSTRING( "CMPMServerSession::AvailableUnblacklistedIapsL: Active IAP unavailable" )
+            activeAvailable = EFalse;
+            }
+    
+        // If the active WLAN connection is blacklisted, then 
+        // there is no need to check if any of the unavailable 
+        // WLAN IAPs have same SSID as active WLAN connection.
+        //
+        // Same goes for unavailable active connection.
+        // 
+        if ( activeAvailable && 
+             blacklistiaps.Find( iapId ) == KErrNotFound )
+            {
+            for ( TInt i( 0 ); ( (i < unavailableIAPs.Count()) ); i++ )
+                {
+                // Check if any of the unavailable WLAN IAPs have 
+                // the same SSID as the active WLAN connection.
+                //
+                TBool usesSame( EFalse ); 
+
+                if ( !iMyServer.CommsDatAccess()->CheckEasyWLanL( unavailableIAPs[i] ) )
+                    {
+                    TRAP_IGNORE( iMyServer.CommsDatAccess()->MatchSSIDL( ssid, 
+                                                              unavailableIAPs[i], 
+                                                              usesSame,
+                                                              *this ) )
+                                                              
+                    if ( usesSame )
+                        {
+                        // Append unavailable IAP to list of available IAPs
+                        // if it uses same SSID as active WLAN connection.
+                        // 
+                        MPMLOGSTRING2(
+                            "CMPMServerSession::AvailableUnblacklistedIapsL:\
+ Append unavailable IapId = %i", unavailableIAPs[i] )
+                        aAvailableIAPs.AppendL( unavailableIAPs[i] );
+                        }
+                    }
+                }
+            }
+        CleanupStack::PopAndDestroy( &unavailableIAPs );
+        }
+
+    TInt index( KErrNotFound );
+
+    // Remove any blacklisted IAP.
+    // 
+    for (TInt i = 0; i < blacklistiaps.Count(); i++)
+        {
+        index = aAvailableIAPs.Find( blacklistiaps[i] );
+        if (( index != KErrNotFound ) && ( index < aAvailableIAPs.Count() ))
+            {
+            MPMLOGSTRING2( "CMPMServerSession::AvailableUnblacklistedIapsL: \
+Remove blacklisted IapId = %i", aAvailableIAPs[index] )
+            aAvailableIAPs.Remove( index );
+            }
+        }
+    CleanupStack::PopAndDestroy( &blacklistiaps );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::IsUpgrade
+// -----------------------------------------------------------------------------
+//
+TBool CMPMServerSession::IsUpgrade( 
+    const TUint32               aIapId, 
+    const TUint32               aMigrateIapId,
+    const RAvailableIAPList&    aAvailableIAPs ) const
+    {
+    if ( aIapId == aMigrateIapId )
+        {
+        // If the current Iap Id and migrate Iap Id are identical, 
+        // then it is considered that this a downgrade. 
+        // 
+        MPMLOGSTRING( "CMPMServerSession::IsUpgrade - Downgrade" )
+        return EFalse;
+        }
+
+    if ( aAvailableIAPs.Find( aIapId ) == KErrNotFound )
+        {
+        // If the registered Iap Id is not found in the list of 
+        // available IAPs, then it is considered that the new 
+        // validated IAP is a downgrade compared to previous.
+        // 
+        MPMLOGSTRING( "CMPMServerSession::IsUpgrade - Downgrade" )
+        return EFalse;
+        }
+    else
+        {
+        // If the registered Iap Id is found in the list of 
+        // available IAPs, then it is considered that the new 
+        // validated IAP is an upgrade compared to previous.
+        // 
+        MPMLOGSTRING( "CMPMServerSession::IsUpgrade - Upgrade" )
+        return ETrue;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::CheckNotifNeed
+// -----------------------------------------------------------------------------
+//
+TBool CMPMServerSession::CheckNotifNeed( const TUint32       aCurrentIap,
+                                         const TUint32       aLastNotifiedIap,
+                                         const TUint32       aValidatedIap )
+    {
+    TBool retValue( EFalse );
+
+    // Get the state of the connection for this Connection Id
+    // 
+    TConnectionState state;
+    iMyServer.GetConnectionState( iConnId, 
+                                  state );
+    // New IAP to be notified is different from last
+    if ( aValidatedIap != aLastNotifiedIap )
+        {
+        if( aCurrentIap == aValidatedIap)
+            {
+            MPMLOGSTRING( "CMPMServerSession::CheckNotifNeed: current IAP is same preferred IAP, no need to send notification" )
+            retValue = EFalse;
+            }
+        else
+            {
+            MPMLOGSTRING( "CMPMServerSession::CheckNotifNeed: notif needed" )
+            retValue = ETrue;
+            }
+       }
+    else
+        {
+        MPMLOGSTRING( "CMPMServerSession::CheckNotifNeed: Last notified IAP is same as preferred IAP, no need to send notification" )
+        }
+    return retValue;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::UnavailableIAPsL
+// -----------------------------------------------------------------------------
+//
+void CMPMServerSession::UnavailableIAPsL( 
+    const RAvailableIAPList aAvailableIAPs, 
+    RAvailableIAPList&      aUnavailableIAPs )
+    {
+    TInt err( KErrNone );
+
+    CCommsDatabase* commsDatabase = CCommsDatabase::NewL();
+    CleanupStack::PushL(commsDatabase);
+
+    // Make hidden records visible
+    // 
+    commsDatabase->ShowHiddenRecords();
+
+    // Iterate the IAP table from CommsDat
+    CCommsDbTableView* table = NULL;
+    table = commsDatabase->OpenTableLC( TPtrC( IAP ) );
+
+    err = table->GotoFirstRecord();
+
+    while ( !err )
+        {
+        TUint32 iapId( 0 );
+
+        // Read IAP's ID
+        //
+        table->ReadUintL( TPtrC( COMMDB_ID ), iapId );
+        
+        if ( aAvailableIAPs.Find( iapId ) == KErrNotFound )
+            {
+            aUnavailableIAPs.AppendL( iapId );
+            }
+
+        err = table->GotoNextRecord();
+        }
+
+    // Release memory
+    //
+    CleanupStack::PopAndDestroy( table );
+    CleanupStack::PopAndDestroy( commsDatabase );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::RemoveUnavailableIap
+// -----------------------------------------------------------------------------
+//
+void CMPMServerSession::RemoveUnavailableIap( TConnMonIapInfo& aIapInfo, 
+                                              const TUint32    aIapId )
+    {
+    TConnMonIapInfo iapInfo = aIapInfo;
+    TBool found( EFalse );
+
+    for ( TUint i( 0 );( ( i < iapInfo.Count() ) && !found ); i++ )
+        {
+        if ( iapInfo.iIap[i].iIapId == aIapId )
+            {
+            found = ETrue;
+
+            MPMLOGSTRING2( "CMPMServerSession::RemoveUnavailableIap - IAP: %d", 
+                iapInfo.iIap[i].iIapId ) 
+            
+            // Since iapInfo.Remove( i ) is not supported
+            // 
+            TUint k( 0 );
+            for ( k = i; ( ( k + 1 ) < iapInfo.Count() ); k++ )
+                {
+                iapInfo.iIap[k] = iapInfo.iIap[k+1];
+                }
+            iapInfo.iIap[k].iIapId = 0;
+            iapInfo.iCount--;
+            }
+        }
+
+    aIapInfo = iapInfo;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::IsBackgroundApplication
+// -----------------------------------------------------------------------------
+//
+TBool CMPMServerSession::IsBackgroundApplication( TUint32 aUid ) const
+    {
+    if( aUid == KUidSimApplicationToolkit || 
+        aUid == KUidDVBH ||
+        aUid == KUidAlwaysOnlineStarter)
+        {
+        return ETrue;
+        }
+    else
+        {
+        return EFalse;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::ChooseIapComplete
+// -----------------------------------------------------------------------------
+//
+void CMPMServerSession::ChooseIapComplete( 
+    TInt                aError,
+    const TMpmConnPref* aPolicyPref )
+    {
+    MPMLOGSTRING2( "CMPMServerSession::ChooseIapComplete aError = %d", aError )
+
+    // Show error popup if it's allowed per client request
+    if ( !( iIapSelection->MpmConnPref().NoteBehaviour() &
+            TExtendedConnPref::ENoteBehaviourConnDisableNotes )
+            && ( aError != KErrNone ) )
+        {
+        CConnectionUiUtilities* connUiUtils = CConnectionUiUtilities::NewL();
+        // Note: Below function shows the discreet popup only if the error code
+        // belongs to the set of errors that are shown to the user.
+        // Otherwise the popup is not shown.
+        connUiUtils->ConnectionErrorDiscreetPopup( aError );
+        delete connUiUtils;
+        connUiUtils = NULL;
+        }
+    
+    // Try to write back arguments and complete message.
+    // 
+    if ( !iChooseIapMessage.IsNull() )
+        {
+        if ( aError == KErrNone && aPolicyPref )
+            {
+            MPMLOGSTRING4( "CMPMServerSession::ChooseIapComplete \
+IAP Id = %d, SNAP Id = %d, Net Id = %d",
+                aPolicyPref->IapId(),
+                aPolicyPref->SnapId(),
+                aPolicyPref->NetId() )
+
+            TPolicyConnPref pref;
+            pref.SetIapId( aPolicyPref->IapId() );
+            pref.SetNetId( aPolicyPref->NetId() );
+            TInt serviceid(0);
+            
+            // Resolve the original serviceid for the application.
+            //
+            TRAPD( err, serviceid = GetServiceIdSettingL() )
+            if ( err != KErrNone )
+                {
+                MPMLOGSTRING2( "CMPMServerSession::ChooseIapComplete GetServiceIdSettingL Leaved %d", err )
+                pref.SetServiceId( 0 );
+                }
+            else
+                {
+                pref.SetServiceId( serviceid );
+                }
+            MPMLOGSTRING4( "CMPMServerSession::ChooseIapComplete writing policy pref \
+iap %d net id %d service id %d", pref.IapId(), pref.NetId(), pref.ServiceId() )
+            switch ( iChooseIapMessage.Function() )
+                {
+                case EMPMServerChooseIap:
+                    {
+                    TRAP( aError, iChooseIapMessage.WriteL( KFourthArgument, pref ) )
+                    break;
+                    }
+                case EMPMServerReselectIap:
+                    {
+                    TRAP( aError, iChooseIapMessage.WriteL( KSecondArgument, pref ) )
+                    break;
+                    }
+                default:
+                    {
+                    MPMLOGSTRING2( "CMPMServerSession::ChooseIapComplete - Error \
+Inconsistent state %d", KErrGeneral )
+                    aError = KErrGeneral;
+                    }
+                }
+            }
+        MPMLOGSTRING( "CMPMServerSession::ChooseIapComplete Message completed" )
+        iChooseIapMessage.Complete( aError );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::ProcessErrorComplete
+// -----------------------------------------------------------------------------
+//
+void CMPMServerSession::ProcessErrorComplete( TInt             aError, 
+                                              TInt*            aErrorReturned,
+                                              TBMNeededAction* aNeededAction )
+    {
+    MPMLOGSTRING2( "CMPMServerSession::ProcessErrorComplete aError = %d", aError )
+
+    delete iDisconnectDlg;
+    iDisconnectDlg = NULL;
+    
+    if ( !iProcessErrorMessage.IsNull() )
+        {
+        // Try to write back arguments and complete message.
+        // Traps are not necesary here. If WriteL functions leave the
+        // message is still completed in ServiceError
+        //
+        if( aErrorReturned )
+            {
+            MPMLOGSTRING2( "CMPMServerSession::ProcessErrorComplete returned error = %d", 
+                           *aErrorReturned )
+
+            TPtrC8 d( reinterpret_cast< TUint8* >( aErrorReturned ), 
+                                                   sizeof( aErrorReturned ) );
+            TRAP_IGNORE( iProcessErrorMessage.WriteL( KFirstArgument, d ) )
+                        }
+        if( aNeededAction )
+            {
+            MPMLOGSTRING2( "CMPMServerSession::ProcessErrorComplete needed action = %d", 
+                           *aNeededAction )
+            TPtrC8 c( reinterpret_cast< TUint8* >( aNeededAction ), 
+                                                   sizeof( aNeededAction ) );
+            TRAP_IGNORE( iProcessErrorMessage.WriteL( KThirdArgument, c ) )
+            }
+        MPMLOGSTRING( "CMPMServerSession::ProcessErrorComplete completing message" )
+        iProcessErrorMessage.Complete( aError );    
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::DisconnectDlgErrorCode
+// -----------------------------------------------------------------------------
+//
+TBool CMPMServerSession::DisconnectDlgErrorCode( TInt aError ) const
+    {
+    if ( aError == KErrGprsInsufficientResources               || // -4154
+         aError == KErrPacketDataTsyMaxPdpContextsReached      || // -6000
+         aError == KErrUmtsMaxNumOfContextExceededByNetwork    || // -4179
+         aError == KErrUmtsMaxNumOfContextExceededByPhone )       // -4178
+        {
+        MPMLOGSTRING2( "CMPMServerSession::DisconnectDlgErrorCode - \
+Error %d, is disconnect dlg error code", aError )
+        return ETrue;
+        }
+    else
+        {
+        MPMLOGSTRING2( "CMPMServerSession::DisconnectDlgErrorCode - \
+Error %d, is not disconnect dlg error code", aError )
+        return EFalse;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::GetPresumedIap
+// -----------------------------------------------------------------------------
+//
+TUint32 CMPMServerSession::GetPresumedIap()
+    {
+    TUint32 presumedIap( 0 ), realIap = iMyServer.GetBMIap( iConnId );
+    if( realIap != 0 )
+        {
+        presumedIap = iMyServer.Events()->PresumedIapId( iConnId, realIap );
+        }
+    MPMLOGSTRING3( "CMPMServerSession::GetPresumedIap - \
+Real IAP %d, presumed Iap %d", realIap, presumedIap )
+    return presumedIap;
+    }
+    
+// -----------------------------------------------------------------------------
+// CMPMServerSession::MigrateDoneL
+// -----------------------------------------------------------------------------
+//
+void CMPMServerSession::MigrateDoneL( TInt aError )
+    {
+    MPMLOGSTRING3( "CMPMServerSession<0x%x>::MigrateCompleteL: error %d",
+	               iConnId,
+	               aError )
+
+    if( aError == KErrNone )
+        {
+        // Send a notification to BearerMan 
+        // to start the Iap
+        //
+        TRAP_IGNORE( StartIAPNotificationL( iMigrateIap ) )        
+        }
+    iMigrateState = EMigrateNone;
+    iMigrateIap = 0;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::UseUserConnPref
+// -----------------------------------------------------------------------------
+//
+TBool CMPMServerSession::UseUserConnPref()
+    {
+    if ((iAppUid != iMyServer.CsIdWatcher()->ConnectScreenId()) &&
+        iMyServer.UserConnection())
+        {
+        MPMLOGSTRING( "CMPMServerSession::UseUserConnPref - User connection active" );
+        
+        // Check whether default connection will be used
+        if ( iIapSelection->MpmConnPref().ConnType() == TMpmConnPref::EConnTypeDefault )
+            {
+            return ETrue;
+            }
+        else if ( ( iIapSelection->MpmConnPref().ConnType() ==
+                    TMpmConnPref::EConnTypeImplicit ) &&
+                  PrefsAllowWlan() )
+            {            
+            MPMLOGSTRING( "CMPMServerSession::UseUserConnPref -\
+ Prompt from the user" );
+            // Prompt from the user -> use user connection
+            return ETrue;
+            }
+        else
+            {
+            MPMLOGSTRING( "CMPMServerSession::UseUserConnPref -\
+ Application preferencies" );
+            TBool isInternetSnap = EFalse;
+            TInt error = KErrNone;
+    
+            // Check whether iap belongs to internet snap
+            TRAP( error, isInternetSnap =
+                             iMyServer.CommsDatAccess()->IsInternetSnapL(
+                                     iIapSelection->MpmConnPref().IapId(),
+                                     iIapSelection->MpmConnPref().SnapId() ) );
+
+            if ( ( error == KErrNone ) && ( isInternetSnap ) && PrefsAllowWlan() )
+                {
+                // Iap belongs to internet snap -> use user connection
+                return ETrue;
+                }
+            }
+        }
+    
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::IsWlanOnlyL
+// -----------------------------------------------------------------------------
+//
+TBool CMPMServerSession::IsWlanOnlyL( TBool& aNewWlansAllowed )
+    {
+    TCmGenConnSettings  genConnSettings;
+
+    MPMLOGSTRING( "CMPMServerSession::IsWlanOnlyL")
+
+    // Read global OCC seamlessness values from CommsDat's DefConn table
+    genConnSettings = iMyServer.CommsDatAccess()->ReadGenConnSettingsL();
+
+    // Find out if new wlans can be prompted
+    if ( genConnSettings.iUsageOfWlan == ECmUsageOfWlanKnownAndNew )
+        {
+        aNewWlansAllowed = ETrue;
+        MPMLOGSTRING( "CMPMServerSession::IsWlanOnlyL: aNewWlansAllowed: True" )
+        }
+    else
+        {
+        aNewWlansAllowed = EFalse;
+        MPMLOGSTRING( "CMPMServerSession::IsWlanOnlyL: aNewWlansAllowed: False" )
+        }
+        
+    // Find out is only WLAN connection is allowed in current network
+    TUint32 currentSeamlessness( genConnSettings.iSeamlessnessHome );
+    
+    if ( iMyServer.IsVisitorNetwork() )
+        {
+        currentSeamlessness = genConnSettings.iSeamlessnessVisitor;  
+        }
+    
+    if ( currentSeamlessness == ECmSeamlessnessDisabled )
+        {
+        MPMLOGSTRING( "CMPMServerSession::IsWlanOnlyL: True" )
+        return ETrue;
+        }
+    else 
+        {
+        MPMLOGSTRING( "CMPMServerSession::IsWlanOnlyL: False" )
+        return EFalse;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::ForcedRoaming()
+// -----------------------------------------------------------------------------
+//
+TBool CMPMServerSession::ForcedRoaming()
+    {
+    TBool forcedRoaming( EFalse );
+    if ( iIapSelection != NULL )
+        {
+        forcedRoaming = iIapSelection->MpmConnPref().ForcedRoaming();
+        }
+    return forcedRoaming;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::RemoveIapsAccordingToBearerSetL()
+// -----------------------------------------------------------------------------
+//
+void CMPMServerSession::RemoveIapsAccordingToBearerSetL( TConnMonIapInfo& aIapInfo )
+    {
+    if (!iIapSelection)
+        {
+        // Iap selection hasn't done for this session -> just return
+        return;
+        }
+    
+    // Drop iaps not according to bearer set
+    if ( iIapSelection->MpmConnPref().BearerSet() != 
+         TExtendedConnPref::EExtendedConnBearerUnknown )
+        {
+        TInt index = 0;
+        
+        while ( index != aIapInfo.iCount )
+            {
+            // Get bearer type
+            TMPMBearerType bearerType = EMPMBearerTypeOther;
+            bearerType =
+                iMyServer.CommsDatAccess()->GetBearerTypeL ( aIapInfo.iIap[index].iIapId );
+            
+            if ( (( bearerType == EMPMBearerTypePacketData ) &&
+                  ( iIapSelection->MpmConnPref().BearerSet() & 
+                    TExtendedConnPref::EExtendedConnBearerCellular )) )
+                {
+                // Don't remove this iap
+                index++;
+                continue;
+                }
+            else if ( (( bearerType == EMPMBearerTypeWlan ) &&
+                  ( iIapSelection->MpmConnPref().BearerSet() & 
+                    TExtendedConnPref::EExtendedConnBearerWLAN )) )
+                {
+                // Don't remove this iap
+                index++;
+                continue;
+                }
+            else
+                {
+                // Remove this iap from the list
+                for ( TInt index2 = index; index2 < aIapInfo.iCount; index2++ )
+                    {
+                    aIapInfo.iIap[index2].iIapId = aIapInfo.iIap[index2 + 1].iIapId;
+                    }
+                
+                aIapInfo.iCount--;
+                }
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::GetAvailableIAPs()
+// -----------------------------------------------------------------------------
+//
+TConnMonIapInfo CMPMServerSession::GetAvailableIAPs()
+    {
+    TConnMonIapInfo availableIAPs;
+    
+    availableIAPs = MyServer().Events()->GetAvailableIAPs();
+    
+    // Remove iaps not according to bearer set
+    TRAP_IGNORE ( RemoveIapsAccordingToBearerSetL ( availableIAPs ) );
+    
+    return availableIAPs;
+    }
+    
+// -----------------------------------------------------------------------------
+// CMPMServerSession::IsBearerAccepted()
+// -----------------------------------------------------------------------------
+//
+TBool CMPMServerSession::IsBearerAccepted( TMPMBearerType aBearerType )
+    {
+    TBool returnValue = EFalse;
+    
+    if ( !iIapSelection ||
+        ( iIapSelection->MpmConnPref().BearerSet() == 
+        TExtendedConnPref::EExtendedConnBearerUnknown ) )
+        {
+        // Iap selection hasn't been done for this session or all bearers
+        // are accepted -> just return true
+        returnValue = ETrue;
+        }
+    else
+        {
+        switch ( aBearerType )
+            {
+            case EMPMBearerTypeWlan:
+                if ( iIapSelection->MpmConnPref().BearerSet() & 
+                    TExtendedConnPref::EExtendedConnBearerWLAN )
+                    {
+                    returnValue = ETrue;
+                    }
+                break;
+                
+            case EMPMBearerTypePacketData:
+                if ( iIapSelection->MpmConnPref().BearerSet() & 
+                    TExtendedConnPref::EExtendedConnBearerCellular )
+                    {
+                    returnValue = ETrue;
+                    }
+                break;
+                
+            default:
+                break;
+            }
+        }
+    
+    return returnValue;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::IsMMSIap()
+// -----------------------------------------------------------------------------
+//
+TBool CMPMServerSession::IsMMSIap( TUint32 aIap )
+    {
+    // Check if IAP is reported by MMS
+    //
+    TBool isMMSIap = EFalse;
+    if( aIap != 0 )
+        {
+        // get property if it's defined 
+        TInt err( KErrNone );
+        TInt mmsIap( 0 );
+        err = RProperty::Get( KMPMCathegory, KMPMPropertyKeyMMS, mmsIap);    
+                            
+        // If successful compare IAPs
+        if( err == KErrNone ) 
+            {
+            if( aIap == mmsIap )
+                {
+                isMMSIap = ETrue;
+                }
+            }
+        } 
+    MPMLOGSTRING2( "CMPMServerSession::IsMmsIap: Returning bool value: %d",
+                   isMMSIap )
+    return isMMSIap;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMServerSession::PrefsAllowWlan
+// -----------------------------------------------------------------------------
+//
+TBool CMPMServerSession::PrefsAllowWlan()
+    {
+    // WLAN connection can be used if application has not specified any bearerset
+    // or when bearerset has WLAN enabled.
+    //
+    if ( ( iIapSelection->MpmConnPref().BearerSet() == 
+           TExtendedConnPref::EExtendedConnBearerUnknown ) 
+         ||
+         ( iIapSelection->MpmConnPref().BearerSet() &
+           TExtendedConnPref::EExtendedConnBearerWLAN ) )
+        {
+        return ETrue;
+        }
+    else
+        {
+        return EFalse;
+        }
+    }
+        
+// -----------------------------------------------------------------------------
+// TNetIap::TNetIap
+// -----------------------------------------------------------------------------
+//
+TNetIap::TNetIap() 
+    : iSnap( 0 ),
+      iEmbeddedSnap( 0 ),
+      iIapId( 0 ),
+      iRanking( 0 ),
+      iGlobalPriority( 0 )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// TNetIap::CompareRanking
+// -----------------------------------------------------------------------------
+//
+TInt TNetIap::CompareRanking( const TNetIap& aFirst,
+                              const TNetIap& aSecond )
+    {
+    if ( aFirst.iRanking < aSecond.iRanking )
+        {
+        return KSmaller;
+        }
+    else if ( aFirst.iRanking > aSecond.iRanking )
+        {
+        return KBigger;
+        }
+    else
+        {
+        return KEqual;
+        }
+    }
+    
+// -----------------------------------------------------------------------------
+// TNetIap::CompareGlobalAndLocalPriority
+// -----------------------------------------------------------------------------
+//
+TInt TNetIap::CompareGlobalAndLocalPriority( const TNetIap& aFirst,
+                                             const TNetIap& aSecond )
+    {
+    if ( aFirst.iGlobalPriority < aSecond.iGlobalPriority )
+        {
+        return KSmaller;
+        }
+    else if ( aFirst.iGlobalPriority > aSecond.iGlobalPriority )
+        {
+        return KBigger;
+        }
+    else
+        {
+        // If global priorities are equal,
+        // order based on ranking
+        // 
+        return TNetIap::CompareRanking( aFirst, aSecond );
+        }
+    }    
+// -----------------------------------------------------------------------------
+// TStoredIapInfo::TStoredIapInfo
+// -----------------------------------------------------------------------------
+//
+TStoredIapInfo::TStoredIapInfo()
+    : iHoldPrefIapNotif( EFalse ),
+      iIapInfoWaiting( EFalse ),
+      iStoredIapInfo()
+    {
+    }
+    
+// -----------------------------------------------------------------------------
+// TStoredIapInfo::HoldPrefIapNotif
+// -----------------------------------------------------------------------------
+//      
+TBool TStoredIapInfo::HoldPrefIapNotif() const
+    {
+    MPMLOGSTRING2( "TStoredIapInfo::HoldPrefIapNotif value %d", iHoldPrefIapNotif )
+    return iHoldPrefIapNotif;
+    }
+
+// -----------------------------------------------------------------------------
+// TStoredIapInfo::SetHoldPrefIapNotif
+// -----------------------------------------------------------------------------
+//
+void TStoredIapInfo::SetHoldPrefIapNotif()
+    {
+    MPMLOGSTRING( "TStoredIapInfo::SetHoldPrefIapNotif" )
+    iHoldPrefIapNotif = ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// TStoredIapInfo::HandleIapInfoWaiting
+// -----------------------------------------------------------------------------
+//
+TBool TStoredIapInfo::HandleIapInfoWaiting( TConnMonIapInfo& aStoredIapInfo )
+    {
+    if( iIapInfoWaiting )
+        {
+        iHoldPrefIapNotif = EFalse;
+        aStoredIapInfo = iStoredIapInfo; 
+        }
+    MPMLOGSTRING2( "TStoredIapInfo::HandleIapInfoWaiting value %d", iIapInfoWaiting )
+    return iIapInfoWaiting;
+    }
+
+// -----------------------------------------------------------------------------
+// TStoredIapInfo::SetStoredIapInfo
+// -----------------------------------------------------------------------------
+//
+void TStoredIapInfo::SetStoredIapInfo( const TConnMonIapInfo& aStoredIapInfo )
+    {
+    MPMLOGSTRING( "TStoredIapInfo::SetStoredIapInfo" )
+    iIapInfoWaiting = ETrue;
+    iStoredIapInfo = aStoredIapInfo;
+    }
+
+// -----------------------------------------------------------------------------
+// TStoredIapInfo::ResetStoredIapInfo
+// -----------------------------------------------------------------------------
+//
+void TStoredIapInfo::ResetStoredIapInfo()
+    {
+    MPMLOGSTRING( "TStoredIapInfo::ResetStoredIapInfo" )
+    iHoldPrefIapNotif = EFalse;
+    iIapInfoWaiting = EFalse;
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/src/mpmstarter.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,136 @@
+/*
+* Copyright (c) 2004-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: MPM Server Entry Point
+*
+*/
+
+/**
+@file mpmstarter.cpp
+Mobility Policy Manager server entry point.
+*/
+
+// INCLUDE FILES
+#include <e32svr.h>
+
+#include "mpmstarter.h"
+#include "mpmserver.h"
+#include "mpmlogger.h"
+#include "mpmdefaultconnserver.h"
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// Perform all server initialisation, in particular creation of the
+// scheduler and server and then run the scheduler
+// -----------------------------------------------------------------------------
+//
+static void RunServerL()
+    {
+    MPMLOGSTRING( "MPMStarter::RunServerL" )
+    // create and install the active scheduler we need
+    CActiveScheduler* s=new( ELeave ) CActiveScheduler;
+    CleanupStack::PushL( s );
+    CActiveScheduler::Install( s );
+    //
+    // create the server
+    CServer2* server = MPMStarter::CreateAndStartServerL();
+    CleanupStack::PushL( server );
+       
+    // create default connection server
+    CServer2* server2 = MPMStarter::CreateDefaultConnServerL( 
+    static_cast<CMPMServer*> ( server ) );
+    CleanupStack::PushL( server2 );
+
+    User::LeaveIfError( RThread::RenameMe( MPMStarter::ServerName() ) );
+
+    // Initialisation complete, now signal the client
+    RProcess::Rendezvous( KErrNone );
+
+    // Ready to run
+    CActiveScheduler::Start();
+    //
+    // Cleanup the server and scheduler
+    CleanupStack::PopAndDestroy( server2 );
+    CleanupStack::PopAndDestroy( server );
+    CleanupStack::PopAndDestroy( s );
+    }
+
+
+// -----------------------------------------------------------------------------
+// Server process entry-point
+// -----------------------------------------------------------------------------
+//
+GLDEF_C TInt E32Main()
+    {
+    __UHEAP_MARK;
+    
+    CTrapCleanup* cleanup=CTrapCleanup::New();
+    TInt r=KErrNoMemory;
+    if ( cleanup )
+        {
+        TRAP( r, RunServerL() );
+        delete cleanup;
+        }
+#ifdef _DEBUG
+    else
+        {
+        MPMLOGSTRING( "E32Main - null cleanup pointer!" )
+        }
+#endif // _DEBUG
+    __UHEAP_MARKEND;
+#ifdef _DEBUG
+    if ( ( r != KErrNone ) && ( r != KErrAlreadyExists ) )
+        {
+        MPMLOGSTRING2( "E32Main - RunServerL made a leave: %i", r )
+        }
+#endif // _DEBUG
+    return r;
+    }
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// MPMStarter::CreateAndStartServerL
+// create server object
+// -----------------------------------------------------------------------------
+//
+CServer2* MPMStarter::CreateAndStartServerL()
+    {
+    MPMLOGSTRING( "MPMStarter::CreateAndStartServerL" )
+    return CMPMServer::NewL();
+    }
+
+// -----------------------------------------------------------------------------
+// MPMStarter::CreateDefaultConnServerL
+// create default connection server object
+// -----------------------------------------------------------------------------
+//
+CServer2* MPMStarter::CreateDefaultConnServerL( CMPMServer* aMPMServer )
+    {
+    MPMLOGSTRING( "MPMStarter::CreateDefaultConnServerL" )
+    return CMPMDefaultConnServer::NewL( aMPMServer );
+    }
+
+// -----------------------------------------------------------------------------
+// MPMStarter::ServerName
+// return server name
+// -----------------------------------------------------------------------------
+//
+TPtrC MPMStarter::ServerName()
+    {
+    return KMPMServerName().Mid( 0 );
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/src/mpmwlanavailability.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,156 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: WLAN bearer availability check
+*
+*/
+
+/**
+@file mpmwlanavailability.cpp
+WLAN bearer availability check
+*/
+
+// INCLUDE FILES
+#include "mpmwlanavailability.h"
+#include "mpmlogger.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CWlanAvailability::NewL
+// -----------------------------------------------------------------------------
+//
+CWlanAvailability* CWlanAvailability::NewL( CMPMConnMonEvents*  aConnMonEvents,
+                                            RConnectionMonitor& aConnMon )
+    {
+    CWlanAvailability* self = new ( ELeave ) CWlanAvailability( aConnMonEvents,
+                                                                aConnMon );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanAvailability::CWlanAvailability
+// -----------------------------------------------------------------------------
+//
+CWlanAvailability::CWlanAvailability( CMPMConnMonEvents*  aConnMonEvents,
+                                      RConnectionMonitor& aConnMon )
+    : CActive( CActive::EPriorityStandard ),
+      iConnMonEvents( aConnMonEvents ),
+      iConnMon( aConnMon )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanAvailability::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CWlanAvailability::ConstructL()
+    {
+    iObserver.Reset();
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanAvailability::Start
+// -----------------------------------------------------------------------------
+//
+void CWlanAvailability::Start( MWlanAvailability* aObserver )
+    {
+    MPMLOGSTRING( "CWlanAvailability::Start" )
+
+    iObserver.Append( aObserver );
+
+    if ( !IsActive() )
+        {
+        iConnMon.GetBoolAttribute( EBearerIdWLAN, 
+                                   0, 
+                                   KBearerAvailability,
+                                   iResult,
+                                   iStatus );
+        SetActive();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanAvailability::CancelObserver
+// -----------------------------------------------------------------------------
+//
+void CWlanAvailability::CancelObserver( MWlanAvailability* aObserver )
+    {
+    MPMLOGSTRING( "CWlanAvailability::CancelObserver" )
+    
+    for ( TInt i=0; i < iObserver.Count(); i++ )
+        {
+        if ( iObserver[ i ] == aObserver )
+            {
+            iObserver.Remove( i );        
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanAvailability::~CWlanAvailability
+// -----------------------------------------------------------------------------
+//
+CWlanAvailability::~CWlanAvailability()
+    {
+    MPMLOGSTRING( "CWlanAvailability::~CWlanAvailability" )
+
+    Cancel();
+
+    iObserver.Close();
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanAvailability::RunL
+// -----------------------------------------------------------------------------
+//
+void CWlanAvailability::RunL()
+    {
+    if ( iStatus.Int() != KErrNone )
+        {
+        MPMLOGSTRING2( "CWlanAvailability::RunL status %d", iStatus.Int() )
+        }
+
+    for ( TInt i=0; i < iObserver.Count(); i++ )
+        {
+        iObserver[ i ]->WlanAvailabilityResponse( iStatus.Int(), iResult );
+        }
+
+    iObserver.Reset();
+
+    // we are done
+    iConnMonEvents->SetWlanAvailabilityPtrNull();
+    delete this;
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanAvailability::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CWlanAvailability::DoCancel()
+    {
+    MPMLOGSTRING( "CWlanAvailability::DoCancel" )
+
+    iConnMon.CancelAsyncRequest( KBearerAvailability );
+
+    for ( TInt i=0; i < iObserver.Count(); i++ )
+        {
+        iObserver[ i ]->WlanAvailabilityResponse( KErrCancel, iResult );
+        }
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/src/mpmwlanquerydialog.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,845 @@
+/*
+* Copyright (c) 2008 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: Handles displaying wlan dialogs
+*
+*/
+
+
+#include <wlanmgmtcommon.h>
+#include <e32std.h>
+#include <utf.h>
+#include <cmpluginwlandef.h>
+#include <ctsydomainpskeys.h>
+
+#include "mpmwlanquerydialog.h"
+#include "mpmiapselection.h"
+#include "mpmconnmonevents.h"
+#include "mpmlogger.h"
+
+// valid Wep key lengths, to check wep key format
+// (wep key format depends on key length)
+const TInt KConnUiUtilsWepLengthASCII5 = 5;
+const TInt KConnUiUtilsWepLengthASCII13 = 13;
+const TInt KConnUiUtilsWepLengthASCII29 = 29;
+const TInt KConnUiUtilsWepLengthHEX10 = 10;
+const TInt KConnUiUtilsWepLengthHEX26 = 26;
+const TInt KConnUiUtilsWepLengthHEX58 = 58; 
+
+// Retry count and delay for storing Easy WLAN data
+const TInt KStoreRetryCount = 10;
+const TInt KStoreRetryDelay = 100000;
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CMPMWlanQueryDialog::CMPMWlanQueryDialog
+// ---------------------------------------------------------------------------
+//
+CMPMWlanQueryDialog::CMPMWlanQueryDialog( CMPMIapSelection&  aSession,
+                                          TUint32            aWlanIapId )
+  : CActive( CActive::EPriorityStandard ),
+    iIapSelection( aSession ),
+    iNetworkPrefs(),
+    iNotifWep(),
+    iWlanQueryState( EWlanNetwork ),
+    iWlanIapId( aWlanIapId ),
+    iEasyWlanSelected( EFalse ),
+    iOverrideStatus( KErrNone ),
+    iConnUiUtils( NULL ), 
+    iWps( NULL ),
+    iWpsReturn( WiFiProt::EWiFiOK ),
+    iWpsCompleted( EFalse ),
+    iRetryCount( 0 )
+    {
+    
+    }
+    
+// ---------------------------------------------------------------------------
+// CMPMWlanQueryDialog::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CMPMWlanQueryDialog::ConstructL()
+    {
+    User::LeaveIfError(iNotifier.Connect());
+    CActiveScheduler::Add( this );
+    iConnUiUtils = CConnectionUiUtilities::NewL();
+    User::LeaveIfError( iTimer.CreateLocal() );
+    }
+
+// ---------------------------------------------------------------------------
+// CMPMWlanQueryDialog::NewL
+// ---------------------------------------------------------------------------
+//
+CMPMWlanQueryDialog* CMPMWlanQueryDialog::NewL( CMPMIapSelection&  aSession,
+                                                TUint32            aWlanIapElementId )
+    {
+    CMPMWlanQueryDialog* self = new( ELeave ) CMPMWlanQueryDialog( aSession,
+                                                                   aWlanIapElementId );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CMPMWlanQueryDialog::~CMPMWlanQueryDialog
+// ---------------------------------------------------------------------------
+//
+CMPMWlanQueryDialog::~CMPMWlanQueryDialog()
+    {
+    MPMLOGSTRING( "CMPMWlanQueryDialog::~CMPMWlanQueryDialog enters" )
+    // Check if this dialog instance was not started but only added to the queue
+    if ( iIapSelection.Session()->MyServer().FirstInWlanQueryQueue() != this )
+        {
+        MPMLOGSTRING( "CMPMWlanQueryDialog::~CMPMWlanQueryDialog, not a active delete" )
+
+        // Close notifier and timer
+        iNotifier.Close();
+        iTimer.Close();
+        
+        // We're not first in the queue, thus we can just delete.
+        // But remember the pointer in the array.
+        iIapSelection.Session()->MyServer().RemoveFromWlanQueryQueue( this );
+        MPMLOGSTRING( "CMPMWlanQueryDialog::~CMPMWlanQueryDialog exits (break)" )
+        return;
+        }
+
+    // Cancel previous dialogs if any.
+    Cancel();
+
+    // Close notifier and timer
+    iNotifier.Close();
+    iTimer.Close();
+
+    delete iConnUiUtils;
+
+    delete iWps;
+    // Remove self from the queue
+    iIapSelection.Session()->MyServer().RemoveFromWlanQueryQueue( this );
+    
+    // Start the next query
+    CMPMWlanQueryDialog* dlg = iIapSelection.Session()->MyServer().FirstInWlanQueryQueue();
+    if ( dlg )
+        {
+        MPMLOGSTRING( "CMPMWlanQueryDialog::~CMPMWlanQueryDialog starts new dialog" )
+        dlg->OfferInformation( iWlanIapId, 
+                               iIapSelection.OfflineNoteResponse(),
+                               iStatus.Int() );
+        // In destructor we cannot let the query leave
+        TRAPD( err, dlg->StartWlanQueryL(); )
+        if ( err != KErrNone )
+            {
+            MPMLOGSTRING2( "CMPMWlanQueryDialog::~CMPMWlanQueryDialog caught Leave %d, executing RunError()", err )
+            dlg->RunError( err );
+            }
+        }
+
+    MPMLOGSTRING( "CMPMWlanQueryDialog::~CMPMWlanQueryDialog exits" )
+    }
+
+// ---------------------------------------------------------------------------
+// CMPMWlanQueryDialog::DoCancel
+// ---------------------------------------------------------------------------
+//
+void CMPMWlanQueryDialog::DoCancel()
+    {
+    MPMLOGSTRING2( "CMPMWlanQueryDialog::DoCancel state %d", iWlanQueryState )
+    if ( iWlanQueryState == EOffline )
+        {
+        iNotifier.CancelNotifier( KUidCOfflineWlanNoteDlg );
+        }
+    else if ( iWlanQueryState == EWlanNetwork )    
+        {
+        iConnUiUtils->CancelSearchWLANNetwork();
+        }
+    else if ( iWlanQueryState == EWepSettings )    
+        {
+        iNotifier.CancelNotifier( KUidEasyWepDlg );
+        }
+    else if( iWlanQueryState == EWPS )
+        {
+        iWps->CancelWiFiProt();
+        }
+    else if ( iWlanQueryState == EWpaSettings )
+        {
+        iNotifier.CancelNotifier( KUidEasyWpaDlg );
+        }
+    else // ERetrySettingsStorage
+        {
+        iTimer.Cancel();
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// CMPMWlanQueryDialog::RunL
+// ---------------------------------------------------------------------------
+//
+void CMPMWlanQueryDialog::RunL()
+    {
+    MPMLOGSTRING3( "CMPMWlanQueryDialog::RunL status %d state %d", 
+                   iStatus.Int(), 
+                   iWlanQueryState )
+    if( iWlanQueryState == EOffline )
+        {
+        if( iStatus.Int() == KErrNone )
+            {
+            iIapSelection.SetOfflineNoteResponse( EOfflineResponseYes );
+            if( iIapSelection.Session()->MyServer().CommsDatAccess()->CheckEasyWLanL( iWlanIapId ) )
+                {
+                MPMLOGSTRING( "CMPMWlanQueryDialog::RunL starting wlan network query" )
+                GetNetworkPrefs();
+                return;
+                }
+            }
+        else if ( iStatus.Int() == KErrCancel )
+            {
+            iIapSelection.SetOfflineNoteResponse( EOfflineResponseNo );
+            MPMLOGSTRING2( "CMPMWlanQueryDialog::RunL offline query returned %d", 
+                           iStatus.Int() )
+            }
+        else
+            {
+            MPMLOGSTRING2( "CMPMWlanQueryDialog::RunL offline query returned %d", 
+                           iStatus.Int() )
+            }
+        }
+    else if( iWlanQueryState == EWlanNetwork )
+        {
+        if( iStatus.Int() == KErrNone )
+            {
+            
+            TUint secMode( 0 );
+            TWlanNetMode connMode( EInfra );
+            TInt err = ConnSecModeToCommsDatSecMode( iNetworkPrefs().iSecMode,
+                                                     secMode );
+            if( err != KErrNone )
+       	    	{
+       	    	MPMLOGSTRING( "CMPMWlanQueryDialog::RunL, Unknown security mode" )
+       	    	iWlanIapId = 0;
+                iWlanQueryState = EWlanNetwork;
+       	    	iIapSelection.UserWlanSelectionDoneL( KErrCouldNotConnect, iWlanIapId );
+       	    	return;
+       	    	}
+            
+            TUint32 configuredIap = iIapSelection.Session()->MyServer().
+                CommsDatAccess()->CheckWLANIapWithSsidL( iNetworkPrefs().iSsId, 
+                                                         secMode,
+                                                         connMode );
+            // If previously unknown IAP, query wep/wpa parameters
+            //
+            if( !configuredIap )
+                {
+                iEasyWlanSelected = ETrue;
+                if ( iNetworkPrefs().iProtectedSetupSupported && 
+                     iNetworkPrefs().iNetworkMode != EWlanConnectionModeAdhoc )
+                    {
+                    StartWpsDlgL();
+                    return;                                    
+                    }         
+                // WEP
+                //
+                if( iNetworkPrefs().iSecMode == EWlanConnectionSecurityWep )
+                    {
+                    MPMLOGSTRING( "CMPMWlanQueryDialog::RunL unknown wep network" )
+                    iWlanQueryState = EWepSettings;
+                    iNotifier.StartNotifierAndGetResponse( iStatus, 
+                                                           KUidEasyWepDlg, 
+                                                           iNotifWep, 
+                                                           iNotifWep );
+                    SetActive();
+                    return;
+                    }
+                // WPA
+                //
+                else if ( iNetworkPrefs().iSecMode == EWlanConnectionSecurityWpaPsk )
+                    {
+                    MPMLOGSTRING( "CMPMWlanQueryDialog::RunL unknown wpa network" )
+                    iWlanQueryState = EWpaSettings;
+                    iNotifier.StartNotifierAndGetResponse( iStatus, 
+                                                           KUidEasyWpaDlg, 
+                                                           iNotifWpaKey, 
+                                                           iNotifWpaKey );
+                    SetActive();
+                    return;
+
+                    }
+                else
+                    {
+                    MPMLOGSTRING2( "CMPMWlanQueryDialog::RunL security mode %d", 
+                                   iNetworkPrefs().iSecMode )
+                    }
+                }
+        	
+        	else
+        	    {
+        	    iWlanIapId = configuredIap;
+        	    MPMLOGSTRING2( "CMPMWlanQueryDialog::RunL found configured iap matching ssid, id %d", 
+        	                   iWlanIapId )
+        	    
+        	    }
+            }
+        else if( iStatus.Int() == KErrCancel )
+            {
+            iEasyWlanSelected = EFalse;
+            MPMLOGSTRING( "CMPMWlanQueryDialog::RunL easy wlan dialog cancelled, \
+setting easy wlan as not selected" )
+            }
+        else
+            {
+            MPMLOGSTRING2( "CMPMWlanQueryDialog::RunL EWlanNetwork error %d", 
+                iStatus.Int() )
+            }
+        
+        }
+    else if( iWlanQueryState == EWepSettings || iWlanQueryState == EWpaSettings )
+        {
+        if( iStatus.Int() == KErrCancel )
+      	   {
+            MPMLOGSTRING( "CMPMWlanQueryDialog::Key dialog cancelled,back to easy wlan" )
+            iNetworkPrefs().iSsId.FillZ();
+            iNetworkPrefs().iNetworkMode = EWlanConnectionModeNotConnected;
+            iNetworkPrefs().iSecMode = EWlanConnectionSecurityOpen;
+            GetNetworkPrefs();
+            return;
+            }
+        }
+    else if( iWlanQueryState == EWPS )
+        {
+        MPMLOGSTRING2( "CMPMWlanQueryDialog::RunL WPS, status %d", iStatus.Int() )
+        if( iStatus.Int()  == KErrNone )
+            {
+            if( iWpsReturn == WiFiProt::EWiFiOK)
+                {
+                MPMLOGSTRING( "CMPMWlanQueryDialog::RunL WPS ok" )
+                iWpsCompleted = ETrue;
+                }
+            else if ( iWpsReturn == WiFiProt::EWiFiCancel )
+                {
+                MPMLOGSTRING( "CMPMWlanQueryDialog::RunL WPS cancelled" )
+                iStatus = KErrCancel;
+                }
+            else // WiFiProt::EWiFiNoAuto
+                {
+                MPMLOGSTRING( "CMPMWlanQueryDialog::RunL No Auto, starting WPA key query" )
+                iWlanQueryState = EWpaSettings;
+                iNotifier.StartNotifierAndGetResponse( iStatus, 
+                                                       KUidEasyWpaDlg, 
+                                                       iNotifWpaKey, 
+                                                       iNotifWpaKey );
+                SetActive();
+                return;
+                }
+            }
+        }
+    else if ( iWlanQueryState == ERetrySettingsStorage )
+        {
+        // Retry settings storage
+        MPMLOGSTRING( "CMPMWlanQueryDialog::RunL Retry settings storage" )
+        }
+    else
+        {
+		MPMLOGSTRING2( "CMPMWlanQueryDialog::RunL, unknown state: %d", iWlanQueryState )
+        User::Leave( KErrCancel );
+        }
+        
+    TRAPD( leaveCode, iIapSelection.UserWlanSelectionDoneL( iStatus.Int(), iWlanIapId ) );
+    if( leaveCode != KErrNone )
+        {
+        // Something caused method to leave, if CommsDat was locked we should retry 
+        if ( iStatus.Int() == KErrNone &&
+             leaveCode == KErrLocked &&
+             iRetryCount > 0 )
+            {
+            MPMLOGSTRING2( "CMPMWlanQueryDialog::RunL Start retry timer, retry count %d", iRetryCount )
+            iWlanQueryState = ERetrySettingsStorage;
+            iRetryCount--;
+            iTimer.After( iStatus, KStoreRetryDelay );
+            SetActive();
+            return;
+            }
+        else
+            {
+            User::Leave( leaveCode );
+            }
+        }
+    
+    iWlanIapId = 0;
+    iWlanQueryState = EWlanNetwork;
+    }
+
+// ---------------------------------------------------------------------------
+// CMPMWlanQueryDialog::RunError
+// ---------------------------------------------------------------------------
+//
+TInt CMPMWlanQueryDialog::RunError( TInt aError )
+    {
+    MPMLOGSTRING2( "CMPMWlanQueryDialog::RunError failed with %d", aError )
+    iEasyWlanSelected = EFalse;    
+    iIapSelection.ChooseIapComplete( aError, NULL );    
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMWlanQueryDialog::StartWlanQueryL
+// -----------------------------------------------------------------------------
+//
+void CMPMWlanQueryDialog::StartWlanQueryL()
+    {
+    MPMLOGSTRING( "CMPMWlanQueryDialog::StartWlanQuery" )
+
+    iRetryCount = KStoreRetryCount;
+    
+    // if first dialog user, add it to the array and continue.
+    //
+    if ( iIapSelection.Session()->MyServer().WlanQueryQueue()->Count() == 0 )
+        {
+        MPMLOGSTRING( "CMPMWlanQueryDialog::StartWlanQuery First one, start immediately" )
+        iIapSelection.Session()->MyServer().AppendWlanQueryQueueL( this );
+        }
+    // if another dialog should be processed before this, just add and return.
+    //
+    else if ( iIapSelection.Session()->MyServer().FirstInWlanQueryQueue() != this )
+        {
+        MPMLOGSTRING( "CMPMWlanQueryDialog::StartWlanQuery Latter, process later" )
+        iIapSelection.Session()->MyServer().AppendWlanQueryQueueL( this );
+        return;
+        }
+    // else Continue to process the first dialog.(this one)
+    // FirstInWlanQueryQueue() == this && Count() > 0
+    
+    TUint32 activeWlanIap = iIapSelection.Session()->MyServer().IsWlanConnectionStartedL( 
+        iIapSelection.Session()->MyServer().CommsDatAccess() );
+
+    // Get EmergencyCallInfo via Publish & Subscribe
+    // 
+    TInt emergencyCallEstablished( 0 );
+    RProperty::Get( KPSUidCtsyEmergencyCallInfo, 
+                    KCTSYEmergencyCallInfo, 
+                    emergencyCallEstablished );  
+    MPMLOGSTRING2( "CMPMWlanQueryDialog::StartWlanQuery KCTSYEmergencyCallInfo = %d", 
+                   emergencyCallEstablished )
+
+    if( !emergencyCallEstablished && 
+        iIapSelection.Session()->IsPhoneOfflineL() && 
+        !activeWlanIap && 
+        iIapSelection.OfflineNoteResponse() != EOfflineResponseYes &&
+        iOverrideStatus == KErrNone )
+        {
+        // if user has already refused offline note complete immediately
+        //
+        if ( iIapSelection.OfflineNoteResponse() == EOfflineResponseNo )
+            {
+            MPMLOGSTRING( "CMPMWlanQueryDialog::StartWlanQuery user has already refused offline" )
+            iIapSelection.UserWlanSelectionDoneL( KErrCancel, iWlanIapId );
+            }
+        else
+            {
+            MPMLOGSTRING( "CMPMWlanQueryDialog::StartWlanQuery, starting offline note" )            
+            iWlanQueryState = EOffline;
+            iNotifier.StartNotifierAndGetResponse( iStatus, 
+                                                   KUidCOfflineWlanNoteDlg, 
+                                                   KNullDesC8(), 
+                                                   iOfflineReply );
+            SetActive();
+            }
+        }
+    // if easy wlan iap and some wlan iap started, use existing connection
+    //
+    else if( iIapSelection.Session()->MyServer().CommsDatAccess()->CheckEasyWLanL( iWlanIapId )  && 
+             activeWlanIap )
+        {
+        MPMLOGSTRING2( "CMPMWlanQueryDialog::StartWlanQuery using active WLAN IAP %d", 
+                      activeWlanIap )
+        iIapSelection.UserWlanSelectionDoneL( KErrNone, activeWlanIap );      
+        }
+    // if easy wlan iap and easy wlan is not already started
+    // 
+    else if( iIapSelection.Session()->MyServer().CommsDatAccess()->CheckEasyWLanL( iWlanIapId )  && 
+             !iIapSelection.Session()->MyServer().CheckIfStarted( iWlanIapId ) &&
+             iNetworkPrefs().iSsId.Length() == 0 &&
+             iOverrideStatus == KErrNone )
+        {
+        MPMLOGSTRING( "CMPMWlanQueryDialog::StartWlanQuery starting network query" )
+        GetNetworkPrefs();
+        }
+    // if an error was given through OfferInformation() -call we abort the execution.
+    //
+    else if ( iOverrideStatus != KErrNone )
+        {
+        MPMLOGSTRING2( "CMPMWlanQueryDialog::StartWlanQuery inherited error %d", iOverrideStatus )
+        iIapSelection.UserWlanSelectionDoneL( iOverrideStatus, iWlanIapId );
+        }
+    else
+        {
+        MPMLOGSTRING( "CMPMWlanQueryDialog::StartWlanQuery no wlan dialog to show" )
+        iIapSelection.UserWlanSelectionDoneL( KErrNone, iWlanIapId );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMWlanQueryDialog::OfferInformation
+// -----------------------------------------------------------------------------
+//
+void CMPMWlanQueryDialog::OfferInformation(
+                TUint32 aWlanIapId, 
+                TOfflineNoteResponse aOfflineStatus,
+                TInt aDialogStatus )
+    {
+    TBool isEasyWlan( EFalse );
+    // Take information from earlier note into use
+    // if the selected IAP is EasyWLAN or Offline note response was No.
+    //
+    TRAP_IGNORE( isEasyWlan = 
+        iIapSelection.Session()->MyServer().CommsDatAccess()->CheckEasyWLanL( iWlanIapId ); )
+    if ( isEasyWlan ) 
+        {
+        // iEasyWlanSelected is not passed as only the first connection 
+        // should write the easy wlan settings to commsdat if easy wlan is used.
+        // 
+        MPMLOGSTRING3( "CMPMWlanQueryDialog<0x%x>::OfferInformation: EasyWLAN, iap %d", 
+                       iIapSelection.Session()->ConnectionId(),
+                       aWlanIapId ) 
+
+        iWlanIapId      = aWlanIapId;
+        iOverrideStatus = aDialogStatus;
+        }
+    if ( aOfflineStatus != EOfflineResponseUndefined )
+        {
+        MPMLOGSTRING3( "CMPMWlanQueryDialog<0x%x>::OfferInformation: offline response %d",
+                       iIapSelection.Session()->ConnectionId(),
+                       aOfflineStatus ) 
+        iIapSelection.SetOfflineNoteResponse( aOfflineStatus );        
+        iOverrideStatus = aDialogStatus;
+        }
+
+#ifdef _LOG
+    else
+        {
+        MPMLOGSTRING( "CMPMWlanQueryDialog::OfferInformation, information not taken." ) 
+        }
+#endif 
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMWlanQueryDialog::StoreEasyWlanSelectionL
+// -----------------------------------------------------------------------------
+//
+void CMPMWlanQueryDialog::StoreEasyWlanSelectionL()
+    {
+    if( iEasyWlanSelected )
+        {
+        TWlanSsid ssid;
+        TWepKeyData wepData;
+        TUint wpaPskEnabled( 0 );
+        TUint wpaPskLen( 0 );
+        TBuf8<KWLMMaxWpaPskLength> wpa;       
+        TUint secMode( 0 );
+        TWlanNetMode connMode( EInfra );
+
+        if( iWpsCompleted )
+            {
+            GetEasyWlanDataForWpsL( ssid,
+                                    secMode,
+                                    connMode, 
+                                    wepData,
+                                    wpaPskEnabled, 
+                                    wpa, 
+                                    wpaPskLen );
+            MPMLOGSTRING3( "CMPMWlanQueryDialog::StoreEasyWlanSelection: \
+wps used, connection iap %d, ssid %S", iWlanIapId, &iWpsAttribute.iSsid )
+            iIapSelection.Session()->MyServer().Events()->
+                SetConnInfoIapSsid( iWlanIapId, 
+                                    iWpsAttribute.iSsid );
+            iIapSelection.Session()->MyServer().CommsDatAccess()->SetEasyWlanDataL( ssid,
+                                                                         secMode,
+                                                                         connMode, 
+                                                                         wepData,
+                                                                         wpaPskEnabled, 
+                                                                         wpa, 
+                                                                         wpaPskLen );
+            return;
+            }
+
+        MPMLOGSTRING( "CMPMWlanQueryDialog::StoreEasyWlanSelection: setting easy wlan data" )
+        GetEasyWlanDataL( ssid,
+                          secMode,
+                          connMode, 
+                          wepData,
+                          wpaPskEnabled, 
+                          wpa, 
+                          wpaPskLen );
+
+        MPMLOGSTRING3( "CMPMWlanQueryDialog::StoreEasyWlanSelection: \
+setting easy wlan iap %d ssid %S in connmon events", iWlanIapId, &iNetworkPrefs().iSsId )
+        iIapSelection.Session()->MyServer().Events()->SetConnInfoIapSsid( iWlanIapId, 
+                                                                          iNetworkPrefs().iSsId );
+        iIapSelection.Session()->MyServer().CommsDatAccess()->SetEasyWlanDataL( ssid,
+                                                                     secMode,
+                                                                     connMode, 
+                                                                     wepData,
+                                                                     wpaPskEnabled, 
+                                                                     wpa, 
+                                                                     wpaPskLen );
+                    
+        }
+    else
+        {
+        MPMLOGSTRING( "CMPMWlanQueryDialog::StoreEasyWlanSelection: no easy wlan selected by user" )
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPMWlanQueryDialog::GetEasyWlanDataL
+// -----------------------------------------------------------------------------
+//
+void CMPMWlanQueryDialog::GetEasyWlanDataL( TWlanSsid&    aSsid,
+                                            TUint&        aSecMode,
+                                            TWlanNetMode& aConnMode,
+                                            TWepKeyData&  aWepData,
+                                            TUint&        aEnableWpaPsk,
+                                            TDes8&        aWpaPsk,
+                                            TUint&        aWpaKeyLen  )
+    {
+    aSsid.Copy( iNetworkPrefs().iSsId );
+    if ( iNetworkPrefs().iNetworkMode == EWlanConnectionModeAdhoc )
+        {
+        aConnMode = EAdhoc;
+        }
+
+    // Set security mode
+    TInt err = ConnSecModeToCommsDatSecMode( iNetworkPrefs().iSecMode,
+                                             aSecMode );
+
+    if( err != KErrNone )
+        {
+        MPMLOGSTRING2( "CMPMWlanQueryDialog::StoreEasyWlanSelection: \
+unsupported sec mode %d. leaving", iNetworkPrefs().iSecMode )
+        User::Leave( KErrNotSupported );
+        }
+
+    if( iNetworkPrefs().iSecMode == EWlanConnectionSecurityWep )
+        {
+        CnvUtfConverter::ConvertFromUnicodeToUtf8( aWepData.iWep1, iNotifWep().iKey );
+        //MPMLOG8STRING2( "CMPMWlanQueryDialog::StoreEasyWlanSelection:wep-key8:%S ", &aWepData.iWep1 )
+        if( iNotifWep().iHex )
+            {
+        	aWepData.iWepFormat1 = 1;
+        	MPMLOGSTRING( "CMPMWlanQueryDialog::StoreEasyWlanSelection: wep format is 1 (hex)") 
+        	}
+        aWepData.iDefaultWep = EWlanDefaultWepKey1;
+        }
+    else if( iNetworkPrefs().iSecMode == EWlanConnectionSecurityWpaPsk )
+        {        
+        CnvUtfConverter::ConvertFromUnicodeToUtf8( aWpaPsk, iNotifWpaKey() );
+        aEnableWpaPsk = 1;
+        aWpaKeyLen = aWpaPsk.Length();
+        MPMLOGSTRING3( "CMPMWlanQueryDialog::StoreEasyWlanSelection:wpapsk-key:%s, len:%d", 
+                       &iNotifWpaKey(), 
+                       aWpaKeyLen )
+        }
+    else
+        {
+        MPMLOGSTRING2( "CMPMWlanQueryDialog::StoreEasyWlanSelection: \
+no key handling needed for sec mode %d", iNetworkPrefs().iSecMode )
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CMPMWlanQueryDialog::ConnSecModeToCommsDatSecMode
+// ---------------------------------------------------------------------------
+//
+TInt CMPMWlanQueryDialog::ConnSecModeToCommsDatSecMode( TWlanConnectionSecurityMode aConnSecmode,
+                                                        TUint& aCommsdatSecMode ) const
+    {
+
+    if ( aConnSecmode == EWlanConnectionSecurityOpen )
+        {
+        aCommsdatSecMode = EWlanSecModeOpen;
+        }
+    else if ( aConnSecmode == EWlanConnectionSecurityWep )
+        {
+        aCommsdatSecMode = EWlanSecModeWep;
+        }
+    else if ( aConnSecmode == EWlanConnectionSecurityWpaPsk )
+       	{
+       	aCommsdatSecMode = EWlanSecModeWpa2;
+       	}
+    else if ( aConnSecmode == EWlanConnectionSecurityWpa )
+       	{
+       	aCommsdatSecMode = EWlanSecModeWpa;
+        }
+    else
+       	{
+       	MPMLOGSTRING( "CMPMWlanQueryDialog::RunL, Unknown security mode" )
+       	return KErrCouldNotConnect;
+       	}
+    return KErrNone;    
+    }
+
+
+// ---------------------------------------------------------------------------
+// CMPMWlanQueryDialog::IapSecModeToCommsDatSecMode
+// ---------------------------------------------------------------------------
+//
+TInt CMPMWlanQueryDialog::IapSecModeToCommsDatSecMode( TWlanIapSecurityMode aIapSecmode,
+                                                       TUint& aCommsdatSecMode ) const
+    {
+    switch( aIapSecmode )
+        {
+        case EWlanIapSecurityModeAllowUnsecure:
+    	    aCommsdatSecMode |= EWlanSecModeOpen;
+            break;
+        case EWlanIapSecurityModeWep:
+            aCommsdatSecMode |= EWlanSecModeWep;
+            break;
+        case EWlanIapSecurityModeWpa:
+            aCommsdatSecMode |= EWlanSecModeWpa;
+            break;
+        case EWlanIapSecurityModeWpa2Only:
+            aCommsdatSecMode |= EWlanSecModeWpa2;
+            break;
+        default:
+            MPMLOGSTRING2( "CMPMWlanQueryDialog::IapSecModeToCommsDatSecMode: \
+unsupported sec mode %d ", aIapSecmode )
+            return KErrNotSupported;
+        }
+    return KErrNone;    
+    }
+
+// -----------------------------------------------------------------------------
+// CMPMWlanQueryDialog::GetEasyWlanDataForWpsL
+// -----------------------------------------------------------------------------
+//
+void CMPMWlanQueryDialog::GetEasyWlanDataForWpsL( TWlanSsid&    aSsid,
+                                                  TUint&        aSecMode,
+                                                  TWlanNetMode& aConnMode,
+                                                  TWepKeyData&  aWepKeyData, 
+                                                  TUint&        aEnableWpaPsk,
+                                                  TDes8&        aWpaPsk,
+                                                  TUint&        aWpaKeyLen  )
+    {
+    aSsid.Copy( iWpsAttribute.iSsid );
+    if ( iWpsAttribute.iOperatingMode == EWlanOperatingModeAdhoc )
+        {
+        aConnMode = EAdhoc;
+        }
+    TInt err = IapSecModeToCommsDatSecMode( iWpsAttribute.iSecurityMode, 
+                                            aSecMode );
+    if( err != KErrNone )
+        {
+        MPMLOGSTRING( "CMPMWlanQueryDialog::GetEasyWlanDataForWpsL: \
+unsupported wps sec mode leaving" )
+        User::Leave( KErrNotSupported );
+        }
+
+    if( iWpsAttribute.iSecurityMode == EWlanIapSecurityModeWep )
+        {
+        if( iWpsAttribute.iWepKey1.Length() && 
+            IsWepFormatHexL( iWpsAttribute.iWepKey1.Length() ) )
+            {
+            aWepKeyData.iWepFormat1 = 1;
+            }
+        if( iWpsAttribute.iWepKey2.Length() && 
+            IsWepFormatHexL( iWpsAttribute.iWepKey2.Length() ) )
+            {
+            aWepKeyData.iWepFormat2 = 1;
+            }
+        if( iWpsAttribute.iWepKey3.Length() && 
+            IsWepFormatHexL( iWpsAttribute.iWepKey3.Length() ) )
+            {
+            aWepKeyData.iWepFormat3 = 1;
+            }
+        if( iWpsAttribute.iWepKey4.Length() && 
+            IsWepFormatHexL( iWpsAttribute.iWepKey4.Length() ) )
+            {
+            aWepKeyData.iWepFormat4 = 1;
+            }
+        aWepKeyData.iWep1.Copy( iWpsAttribute.iWepKey1 );
+        aWepKeyData.iWep2.Copy( iWpsAttribute.iWepKey2 );
+        aWepKeyData.iWep3.Copy( iWpsAttribute.iWepKey3 );
+        aWepKeyData.iWep4.Copy( iWpsAttribute.iWepKey4 );
+        aWepKeyData.iDefaultWep = iWpsAttribute.iWepDefaultKey;        
+        }
+    if( iWpsAttribute.iWpaPreSharedKey.Length() )
+        {
+        aEnableWpaPsk = 1;
+        aWpaPsk.Copy( iWpsAttribute.iWpaPreSharedKey );
+        aWpaKeyLen = aWpaPsk.Length();
+        }
+
+    }
+
+// ---------------------------------------------------------------------------
+// CMPMWlanQueryDialog::StartWpsDlgL
+// ---------------------------------------------------------------------------
+//
+void CMPMWlanQueryDialog::StartWpsDlgL()
+    {
+    MPMLOGSTRING( "CMPMWlanQueryDialog::StartWpsDlgL, Starting WPS" )
+    iWlanQueryState = EWPS;
+    iWps = CWiFiProtUiClient::NewL();
+    iWps->StartWiFiProtConnL( iNetworkPrefs().iSsId, // TWlanSsid&,
+                              iWpsAttribute,
+                              iWpsReturn,
+                              iStatus );
+    SetActive();
+    }
+
+// ---------------------------------------------------------------------------
+// CMPMWlanQueryDialog::IsWepFormatHexL
+// ---------------------------------------------------------------------------
+//
+TBool CMPMWlanQueryDialog::IsWepFormatHexL( TInt aLength ) const
+    {
+    MPMLOGSTRING2( "CMPMWlanQueryDialog::IsWepFormatHexL length %d", aLength )
+
+    if ( ( aLength == KConnUiUtilsWepLengthASCII5 ) ||
+        ( aLength == KConnUiUtilsWepLengthASCII13 ) ||
+        ( aLength == KConnUiUtilsWepLengthASCII29 ) )
+        {
+        return EFalse;
+        }
+    else if ( ( aLength == KConnUiUtilsWepLengthHEX10 ) ||
+        ( aLength == KConnUiUtilsWepLengthHEX26 ) ||
+        ( aLength == KConnUiUtilsWepLengthHEX58 ) )
+        {
+        return ETrue;
+        }
+    else
+        {
+        User::Leave( KErrNotSupported );
+        }            
+    return EFalse;
+    }
+    
+// ---------------------------------------------------------------------------
+// CMPMWlanQueryDialog::GetNetworkPrefs
+// ---------------------------------------------------------------------------
+//
+void CMPMWlanQueryDialog::GetNetworkPrefs()
+    {
+    iWlanQueryState = EWlanNetwork;
+    iConnUiUtils->SearchWLANNetworkAsync( iStatus,
+                                          iNetworkPrefs().iSsId,
+                                          iNetworkPrefs().iNetworkMode,
+                                          iNetworkPrefs().iSecMode, 
+                                          iNetworkPrefs().iProtectedSetupSupported
+                                        );
+    SetActive();
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/src/rmpm.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,766 @@
+/*
+* Copyright (c) 2004-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: MPM server client interface
+*
+*/
+
+
+/**
+@file rmpm.cpp
+Mobility Policy Manager server client interface.
+*/
+
+// INCLUDE FILES
+#include "rmpm.h"
+#include "mpmcommon.h"
+#include "mpmlauncher.h"
+#include "mpmlogger.h"
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// Panic 
+// Panics the client in case of programming error.
+// -----------------------------------------------------------------------------
+//
+void Panic( TInt aPanic )
+    {
+    User::Panic( KPanicCategory, aPanic );
+    }
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// RMPM::LaunchServer
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RMPM::LaunchServer()
+    {
+    return KErrNone;
+    }
+
+
+// -----------------------------------------------------------------------------
+// RMPM::Connect
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RMPM::Connect(  )
+    {
+    TRequestStatus status;
+    Connect( status );
+    User::WaitForRequest( status );
+    TInt err = status.Int();
+    if ( err != KErrNone )
+        {
+        iConnected = EFalse;
+        MPMLOGSTRING2( "RMPM::Connect - Error <%i> in CreateSession", err )
+        } 
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// RMPM::Connect
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RMPM::Connect( TRequestStatus& aStatus )
+    {
+    TInt err( KErrNone );
+
+    if ( !iConnected )
+        {
+        MPMLOGSTRING( "RMPM::Connect: Client connecting to MPM Server" )
+        err = CreateSession( 
+                KMPMServerName,
+                Version(),
+                KNumMessageSlots,
+                EIpcSession_Unsharable,
+                (TSecurityPolicy*)0,
+                &aStatus );
+        if ( err != KErrNone )
+            {
+            //Connecting failed, probably because this is the first Connect() attempt.
+            TVersion version = Version();
+            MPMLOGSTRING3("Mobility Policy Manager version %d.%d", version.iMajor, 
+                                                                   version.iMinor )
+            err = MPMLauncher::LaunchServer( KMPMServerImg, 
+                                             KServerUid2, 
+                                             KServerUid3 );
+            if ( err != KErrNone )
+                {
+                MPMLOGSTRING2( "RMPM::Connect - Error <%i> in LaunchServer", err )
+                }
+            else
+                {
+                err = CreateSession( 
+                    KMPMServerName,
+                    Version(),
+                    KNumMessageSlots,
+                    EIpcSession_Unsharable,
+                    (TSecurityPolicy*)0,
+                    &aStatus );
+#ifdef _DEBUG
+                if (err != KErrNone)
+                    MPMLOGSTRING2( "RMPM::Connect - Error <%i> in CreateSession", err )
+#endif
+                }
+            }   
+        
+        //This can't be else, in case the inner CreateSession() succeeds.
+        if (err == KErrNone)
+           {
+           // session ok but waiting for MPM startup.
+           // We have to assume that it'll be ok.
+           TPtr8 ptr( reinterpret_cast< TUint8* >( NULL ), 0 );
+           TBool errFound = EFalse;
+           for (TUint i=0; ( (i < KNumPtrs) && !errFound ); i++)
+               {
+               err = iPtrArray.Append( ptr );
+               if ( err != KErrNone )
+                   {
+                   MPMLOGSTRING2(
+                       "RMPM::Connect - Error <%i> in ptrArray Append", err )
+                    errFound = ETrue;
+                   }
+               }
+           // If everything is fine, set client connected to true.
+           if ( err == KErrNone )
+               {
+               iConnected = ETrue;
+               }
+           // Else close the created session.
+           else
+               {
+               Close();
+               }
+           }
+        }
+    else
+        {
+        MPMLOGSTRING( "RMPM::Connect: Already connected to MPM Server" )
+        err = KErrNone;
+        }
+
+    // Finally, always complete the failing connects 
+    if ( err != KErrNone )
+        {
+        TRequestStatus* status = &aStatus;
+        User::RequestComplete( status, err );
+        }
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// RMPM::ChooseBestIAP
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RMPM::ChooseBestIAP( TConnPref&           aConnPref,
+                                   const TConnectionId  aConnId,
+                                   const TUid           aAppUid,
+                                   TConnPref&           aPolicyPref,
+                                   TRequestStatus&      aStatus )
+    {
+    __ASSERT_ALWAYS( iConnected, Panic( ERMPMPanicClientNotConnected ) );
+    MPMLOGSTRING( "RMPM::ChooseBestIAP: Client asking iap" )
+
+    SendReceive( EMPMServerChooseIap,
+                 TIpcArgs( &aConnPref,
+                           aConnId, 
+                           aAppUid.iUid, 
+                           &aPolicyPref ),
+                 aStatus );
+    }
+
+// -----------------------------------------------------------------------------
+// RMPM::ReselectBestIAP
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RMPM::ReselectBestIAP( const TConnectionId    aConnId,
+                                     TConnPref&             aPolicyPref,
+                                     TRequestStatus&        aStatus ) 
+    {
+    __ASSERT_ALWAYS( iConnected, Panic( ERMPMPanicClientNotConnected ) );
+
+    MPMLOGSTRING( "RMPM::ReselectBestIAP: Client asking iap" )
+
+    SendReceive( EMPMServerReselectIap,
+                 TIpcArgs( aConnId, &aPolicyPref ),
+                 aStatus );
+    }
+
+// -----------------------------------------------------------------------------
+// RMPM::ApplicationLeavesConnection
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RMPM::ApplicationLeavesConnection( const TUint32       aIapId,
+                                                 const TConnectionId aConnId )
+    {
+    TRequestStatus status;
+    ApplicationLeavesConnection( aIapId, aConnId, status );
+    User::WaitForRequest( status );
+    return status.Int();
+    }
+
+
+// -----------------------------------------------------------------------------
+// RMPM::IAPConnectionStopped
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RMPM::IAPConnectionStopped( const TUint32         aIapId,
+                                          const TConnectionId   aConnId )
+    {
+    TRequestStatus status;
+    IAPConnectionStopped( aIapId, aConnId, status );
+    User::WaitForRequest( status );
+    return status.Int();
+    }
+
+
+EXPORT_C void RMPM::IAPConnectionStopped( const TUint32         aIapId,
+                                          const TConnectionId   aConnId,
+                                          TRequestStatus&       aStatus )
+    {
+    __ASSERT_ALWAYS( iConnected, Panic( ERMPMPanicClientNotConnected ) );
+
+    TIpcArgs args( aIapId, aConnId );
+
+    SendReceive( EMPMServerIapConnectionStopped, args, aStatus );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RMPM::ProcessError
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RMPM::ProcessError( TInt&                 aError,
+                                  const TConnectionId   aConnId,
+                                  TBMNeededAction&      aNeededAction,
+                                  TRequestStatus&       aStatus )
+    {
+    __ASSERT_ALWAYS( iConnected, Panic( ERMPMPanicClientNotConnected ) );
+
+    TPtr8& pkg = NextPtr();
+    pkg.Set( reinterpret_cast< TUint8* >( &aError ),
+             sizeof( aError ),
+             sizeof( aError ) );
+
+    TPtr8& pkgAction = NextPtr();
+    pkgAction.Set( reinterpret_cast< TUint8* >( &aNeededAction ),
+                   sizeof( aNeededAction ),
+                   sizeof( aNeededAction ) );
+
+    TIpcArgs args( &pkg, aConnId, &pkgAction );
+
+    SendReceive( EMPMServerProcessError, args, aStatus );
+    }
+
+// -----------------------------------------------------------------------------
+// RMPM::ProcessError
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RMPM::ProcessError( TConnPref&           /*aConnPref*/,
+                                  TInt&                /*aError*/,
+                                  const TConnectionId  /*aConnId*/,
+                                  TBMNeededAction&     /*aNeededAction*/,
+                                  TRequestStatus&      /*aStatus*/ )
+    {
+    __ASSERT_ALWAYS( EFalse, Panic( KErrNotSupported ) );
+    //-jl- TODO remove this function from the API.
+    }
+
+// -----------------------------------------------------------------------------
+// RMPM::RegisterPrefIAPNotif
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RMPM::RegisterPrefIAPNotif( const TConnectionId   aConnId )
+    {
+    __ASSERT_ALWAYS( iConnected, Panic( ERMPMPanicClientNotConnected ) );
+
+    TIpcArgs args( aConnId );
+
+    // SendReceive used here. MPM first sends preferred iap notifs before 
+    // completing this
+    // 
+    TRequestStatus status;
+    RegisterPrefIAPNotif( aConnId, status );
+    User::WaitForRequest( status );
+    return status.Int();
+    }
+
+// -----------------------------------------------------------------------------
+// RMPM::RegisterPrefIAPNotif
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RMPM::RegisterPrefIAPNotif( const TConnectionId   aConnId,
+                                          TRequestStatus&       aStatus )
+    {
+    __ASSERT_ALWAYS( iConnected, Panic( ERMPMPanicClientNotConnected ) );
+
+    TIpcArgs args( aConnId );
+
+    // SendReceive used here. MPM first sends preferred iap notifs before 
+    // completing this
+    // 
+    return SendReceive( EMPMServerRegisterPrefIAPNotif, args, aStatus );
+    }
+
+// -----------------------------------------------------------------------------
+// RMPM::RegisterPrefIAPNotif
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RMPM::RegisterPrefIAPNotif( const TConnPref&     /*aConnPref*/,
+                                          const TConnectionId  /*aConnId*/ )
+    {
+    __ASSERT_ALWAYS( EFalse, Panic( KErrNotSupported ) );
+    //-jl- TODO remove this function from the API.
+    return NULL;
+    }
+
+
+// -----------------------------------------------------------------------------
+// RMPM::UnregisterPrefIAPNotif
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RMPM::UnregisterPrefIAPNotif( const TConnectionId aConnId )
+    {
+    __ASSERT_ALWAYS( iConnected, Panic( ERMPMPanicClientNotConnected ) );
+
+    TIpcArgs args( aConnId );
+
+    // Server should update the connection state before function returns 
+    // No time consuming activities are done.
+    //
+    TRequestStatus status;
+    UnregisterPrefIAPNotif( aConnId, status );
+    User::WaitForRequest( status );
+    }
+
+// -----------------------------------------------------------------------------
+// RMPM::UnregisterPrefIAPNotif
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RMPM::UnregisterPrefIAPNotif( const TConnectionId aConnId,
+                                            TRequestStatus&     aStatus )
+    {
+    __ASSERT_ALWAYS( iConnected, Panic( ERMPMPanicClientNotConnected ) );
+
+    TIpcArgs args( aConnId );
+
+    // Server should update the connection state before function returns 
+    // No time consuming activities are done.
+    //
+    SendReceive( EMPMServerUnregisterPrefIAPNotif, args, aStatus );
+    }
+
+// -----------------------------------------------------------------------------
+// RMPM::WaitNotification
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RMPM::WaitNotification( TMPMMessageBuffer& aMpmNotification,
+                                      TRequestStatus&    aStatus )
+    {
+    __ASSERT_ALWAYS( iConnected, Panic( ERMPMPanicClientNotConnected ) );
+
+    TIpcArgs args( &aMpmNotification );
+
+    SendReceive( EMPMServerWaitNotification, args, aStatus );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RMPM::SortSNAP
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RMPM::SortSNAP( const TUint32     aSNAP, 
+                              TMpmSnapBuffer&   aSortedList )
+    {
+    __ASSERT_ALWAYS( iConnected, Panic( ERMPMPanicClientNotConnected ) );
+    TRequestStatus status;
+    SortSNAP( aSNAP, aSortedList, status );
+    User::WaitForRequest( status );
+    return status.Int();
+    }
+
+
+// -----------------------------------------------------------------------------
+// RMPM::ApplicationJoinsConnection
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RMPM::ApplicationJoinsConnection( const TUint32       aIapId,
+                                                const TConnectionId aConnId )
+    {
+    __ASSERT_ALWAYS( iConnected, Panic( ERMPMPanicClientNotConnected ) );
+    TRequestStatus status;
+    ApplicationJoinsConnection( aIapId, aConnId, status );
+    User::WaitForRequest( status );
+    return status.Int();
+    }
+
+// -----------------------------------------------------------------------------
+// RMPM::IAPConnectionActivated
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RMPM::IAPConnectionActivated( const TUint32       aIapId,
+                                            const TConnectionId aConnId )
+    {
+    __ASSERT_ALWAYS( iConnected, Panic( ERMPMPanicClientNotConnected ) );
+
+    // Server response not necessary for the client, using Send
+    //
+    return Send( EMPMServerIapConnectionActivated, 
+                 TIpcArgs( aIapId, 
+                           aConnId ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RMPM::IAPConnectionStarted
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RMPM::IAPConnectionStarted( const TUint32         aIapId,
+                                          const TConnectionId   aConnId )
+    {
+    TRequestStatus status;
+    IAPConnectionStarted( aIapId, aConnId, status );
+    User::WaitForRequest( status );
+    return status.Int();
+    }
+
+
+EXPORT_C void RMPM::IAPConnectionStarted( const TUint32         aIapId,
+                                          const TConnectionId   aConnId,
+                                          TRequestStatus&       aStatus )
+    {
+    __ASSERT_ALWAYS( iConnected, Panic( ERMPMPanicClientNotConnected ) );
+
+    // Server should update the connection state before function returns 
+    // No time consuming activities are done.
+    //
+    return SendReceive( EMPMServerIapConnectionStarted, 
+                        TIpcArgs( aIapId, aConnId ),
+                        aStatus );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RMPM::ApplicationConnectionEnds
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RMPM::ApplicationConnectionEnds( const TConnectionId aConnId ) 
+    {
+    TRequestStatus status;
+    ApplicationConnectionEnds( aConnId, status );
+    User::WaitForRequest( status );
+    return status.Int();
+    }
+
+
+// -----------------------------------------------------------------------------
+// RMPM::ApplicationMigratesToCarrier
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RMPM::ApplicationMigratesToCarrier( 
+    const TUint32         aIapId,
+    const TConnectionId   aConnId )
+    {
+    TRequestStatus status;
+    ApplicationMigratesToCarrier( aIapId, aConnId, status );
+    User::WaitForRequest( status );
+    return status.Int();
+    }
+
+
+// -----------------------------------------------------------------------------
+// RMPM::ApplicationIgnoredTheCarrier
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RMPM::ApplicationIgnoredTheCarrier( 
+    const TUint32         aIapId,
+    const TConnectionId   aConnId )
+    {
+    TRequestStatus status;
+    ApplicationIgnoredTheCarrier( aIapId, aConnId, status );
+    User::WaitForRequest( status );
+    return status.Int();
+    }
+
+
+// -----------------------------------------------------------------------------
+// RMPM::ApplicationAcceptedTheCarrier
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RMPM::ApplicationAcceptedTheCarrier( 
+    const TUint32        aIapId,
+    const TConnectionId  aConnId )
+    {
+    TRequestStatus status;
+    ApplicationAcceptedTheCarrier( aIapId, aConnId, status );
+    User::WaitForRequest( status );
+    return status.Int();
+    }
+
+
+// -----------------------------------------------------------------------------
+// RMPM::ApplicationRejectedTheCarrier
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RMPM::ApplicationRejectedTheCarrier( 
+    const TUint32        aIapId,
+    const TConnectionId  aConnId )
+    {
+    TRequestStatus status;
+    ApplicationRejectedTheCarrier( aIapId, aConnId, status );
+    User::WaitForRequest( status );
+    return status.Int();
+    }
+
+
+// -----------------------------------------------------------------------------
+// RMPM::EasyWlanSsid
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RMPM::EasyWlanSsid( const TWlanSsid& aSSID )
+    {
+    __ASSERT_ALWAYS( iConnected, Panic( ERMPMPanicClientNotConnected ) );
+
+    return SendReceive( EMPMServerEasyWlanSsid, 
+                        TIpcArgs( &aSSID ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RMPM::Version
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TVersion RMPM::Version() const
+    {
+    return TVersion( KMPMServerMajorVersionNumber,
+                     KMPMServerMinorVersionNumber,
+                     KMPMServerBuildVersionNumber );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RMPM::Cancel
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RMPM::Cancel( TMpmAsynchCodes aReqToCancel ) const
+    {
+    __ASSERT_ALWAYS( iConnected, Panic(ERMPMPanicClientNotConnected) );
+    MPMLOGSTRING("RMPM::Cancel: Client canceling the request")
+    SendReceive( EMPMServerCancelRequest, TIpcArgs( aReqToCancel ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RMPM::Close
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RMPM::Close()
+    {
+    MPMLOGSTRING("RMPM::Close: Client closing connection")
+
+    iPtrArray.Close() ;
+    iConnected = EFalse;
+
+    RSessionBase::Close();
+    }
+
+
+// -----------------------------------------------------------------------------
+// RMPM::Connected
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool RMPM::Connected()
+    {
+    return iConnected;
+    }
+
+
+// -----------------------------------------------------------------------------
+// RMPM::ApplicationJoinsConnection
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RMPM::ApplicationJoinsConnection( const TUint32       aIapId,
+                                                const TConnectionId aConnId,
+                                                TRequestStatus&     aStatus )
+    {
+    __ASSERT_ALWAYS( iConnected, Panic( ERMPMPanicClientNotConnected ) );
+
+    // Server should update the connection state before function returns 
+    // No time consuming activities are done.
+    //
+    return SendReceive( EMPMServerApplicationJoinsConnection, 
+                        TIpcArgs( aIapId, aConnId ),
+                        aStatus );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RMPM::ApplicationLeavesConnection
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RMPM::ApplicationLeavesConnection( const TUint32       aIapId,
+                                                 const TConnectionId aConnId,
+                                                 TRequestStatus&     aStatus )
+    {
+    __ASSERT_ALWAYS( iConnected, Panic( ERMPMPanicClientNotConnected ) );
+
+    TIpcArgs args( aIapId, aConnId );
+
+    return SendReceive( EMPMServerApplicationLeavesConnection, args, aStatus );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RMPM::ApplicationConnectionEnds
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RMPM::ApplicationConnectionEnds( const TConnectionId aConnId,
+                                               TRequestStatus&     aStatus ) 
+    {
+    __ASSERT_ALWAYS( iConnected, Panic( ERMPMPanicClientNotConnected ) );
+
+    // Server should update the connection state before function returns 
+    // No time consuming activities are done.
+    //
+    return SendReceive( EMPMServerApplicationConnectionEnds, 
+                        TIpcArgs( aConnId ), aStatus );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RMPM::SendCancelRequest
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RMPM::SendCancelRequest( TMpmAsynchCodes aReqToCancel ) const
+    {
+    __ASSERT_ALWAYS( iConnected, Panic(ERMPMPanicClientNotConnected) );
+    MPMLOGSTRING("RMPM::SendCancelRequest: Client canceling the request")
+    // There must always be one free slot.
+    return Send( EMPMServerCancelRequest, TIpcArgs( aReqToCancel ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RMPM::ApplicationMigratesToCarrier
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RMPM::ApplicationMigratesToCarrier( const TUint32         aIapId,
+                                                  const TConnectionId   aConnId,
+                                                  TRequestStatus&       aStatus )
+    {
+    __ASSERT_ALWAYS( iConnected, Panic( ERMPMPanicClientNotConnected ) );
+
+    return SendReceive( EMPMServerApplicationMigratesToCarrier,  
+                        TIpcArgs( aIapId, aConnId ), 
+                        aStatus );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RMPM::ApplicationIgnoredTheCarrier
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RMPM::ApplicationIgnoredTheCarrier( const TUint32         aIapId,
+                                                  const TConnectionId   aConnId,
+                                                  TRequestStatus&       aStatus )
+    {
+    __ASSERT_ALWAYS( iConnected, Panic( ERMPMPanicClientNotConnected ) );
+
+    // SendReceive used here. MPM sends preferred iap or error notification 
+    // before completing this
+    // 
+    return SendReceive( EMPMServerApplicationIgnoredTheCarrier,  
+                        TIpcArgs( aIapId, aConnId ), 
+                        aStatus );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RMPM::ApplicationAcceptedTheCarrier
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RMPM::ApplicationAcceptedTheCarrier( const TUint32        aIapId,
+                                                   const TConnectionId  aConnId,
+                                                   TRequestStatus&      aStatus )
+    {
+    __ASSERT_ALWAYS( iConnected, Panic( ERMPMPanicClientNotConnected ) );
+
+    // Server should update the connection state before function returns 
+    // No time consuming activities are done.
+    //
+    return SendReceive( EMPMServerApplicationAcceptedTheCarrier, 
+                        TIpcArgs( aIapId, aConnId ),
+                        aStatus );
+    }
+
+
+// -----------------------------------------------------------------------------
+// RMPM::ApplicationRejectedTheCarrier
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RMPM::ApplicationRejectedTheCarrier( const TUint32        aIapId,
+                                                   const TConnectionId  aConnId,
+                                                   TRequestStatus&      aStatus )
+    {
+    __ASSERT_ALWAYS( iConnected, Panic( ERMPMPanicClientNotConnected ) );
+
+    // SendReceive used here. MPM sends preferred iap or error notifications 
+    // before completing this
+    // 
+    return SendReceive( EMPMServerApplicationRejectedTheCarrier, 
+                        TIpcArgs( aIapId, aConnId ),
+                        aStatus);
+    }
+
+// -----------------------------------------------------------------------------
+// RMPM::SortSNAP
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RMPM::SortSNAP( const TUint32   aSNAP, 
+                              TMpmSnapBuffer& aSortedList,
+                              TRequestStatus& aStatus,
+                              const TUint32   aMaxAgeSeconds )
+    {
+    __ASSERT_ALWAYS( iConnected, Panic( ERMPMPanicClientNotConnected ) );
+
+    TPtr8 n( reinterpret_cast< TUint8* >( &aSortedList ), sizeof( aSortedList ) );
+    TIpcArgs args( aSNAP, &n, aMaxAgeSeconds );
+
+    // Server response is needed before returning from the call
+    //
+    return SendReceive( EMPMServerSortSNAP, args, aStatus );
+    }
+
+// -----------------------------------------------------------------------------
+// RMPM::NextPtr
+// -----------------------------------------------------------------------------
+//
+TPtr8& RMPM::NextPtr()
+    {
+    __ASSERT_ALWAYS( iConnected, Panic(ERMPMPanicClientNotConnected) );
+
+    if ( iIndex >= iPtrArray.Count() )
+        {
+        iIndex = 0;
+        }
+
+    return iPtrArray[ iIndex++ ];
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bearermanagement/mpm/src/rmpmdefaultconnection.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,102 @@
+/*
+* 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: Client interface to MPM Default Connection server
+*
+*/
+
+#include "rmpmdefaultconnection.h"
+#include "mpmcommon.h"
+#include "mpmlogger.h"
+
+_LIT( KPanicCategory, "MPM Default Connection Client" );
+
+// ---------------------------------------------------------------------------
+// RMPMDefaultConnection::Connect
+// Creates connection to server
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt RMPMDefaultConnection::Connect()
+    {
+    MPMLOGSTRING("RMPMDefaultConnection::Connect" )
+    TInt r( KErrNone );
+    if( !iClientConnected ) 
+        {
+        MPMLOGSTRING("RMPMDefaultConnection::Connect: Connecting to server")
+        r = CreateSession( KMPMDefaultConnectionServerName, Version(), KNumDefConnMessageSlots );
+        if(r == KErrNone)
+            {
+            iClientConnected = ETrue;
+            }
+        else
+            {
+            MPMLOGSTRING2("RMPMDefaultConnection::Connect: \
+Error occurred %d", r )
+            Close();
+            }
+        }
+    return r;
+    }
+
+// ---------------------------------------------------------------------------
+// RMPMDefaultConnection::Close
+// Closes connection to server
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void RMPMDefaultConnection::Close()
+    {
+    MPMLOGSTRING("RMPMDefaultConnection::Close" )
+    RSessionBase::Close();
+    iClientConnected = EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// RMPMDefaultConnection::SetDefaultIAP
+// Sets IAP to be used as default connection
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt RMPMDefaultConnection::SetDefaultIAP( TInt aIapId )
+    {
+    __ASSERT_ALWAYS( iClientConnected, 
+                     User::Panic( KPanicCategory, 
+                                  ERMPMPanicClientNotConnected ) );
+    MPMLOGSTRING("RMPMDefaultConnection::SetDefaultIAP" )
+    return SendReceive( EMPMDefaultConnectionSetDefaultIap, TIpcArgs( aIapId ) );
+    }
+
+// ---------------------------------------------------------------------------
+//RMPMDefaultConnection::ClearDefaultIAP
+// Clears IAP from being used as default connection
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt RMPMDefaultConnection::ClearDefaultIAP()
+    {
+    __ASSERT_ALWAYS( iClientConnected, 
+                     User::Panic( KPanicCategory, 
+                                  ERMPMPanicClientNotConnected ) );
+    MPMLOGSTRING("RMPMDefaultConnection::ClearDefaultIAP" )
+    return SendReceive( EMPMDefaultConnectionClearDefaultIap );
+    }
+
+// -----------------------------------------------------------------------------
+// RMPMDefaultConnection::Version
+// Returns version number
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TVersion RMPMDefaultConnection::Version() const
+    {
+    MPMLOGSTRING("RMPMDefaultConnection::Version" )
+    return TVersion(KMPMServerMajorVersionNumber,
+                    KMPMServerMinorVersionNumber,
+                    KMPMServerBuildVersionNumber);
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/BWinsCw/CmManager_prot_setupU.DEF	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,392 @@
+EXPORTS
+	??0CCmPluginBaseEng@@IAE@PAVTCmPluginInitParam@@@Z @ 1 NONAME ; CCmPluginBaseEng::CCmPluginBaseEng(class TCmPluginInitParam *)
+	??0CCmPluginLanBase@@IAE@PAVTCmPluginInitParam@@@Z @ 2 NONAME ; CCmPluginLanBase::CCmPluginLanBase(class TCmPluginInitParam *)
+	??0CmPluginBaseSettingsDlg@@QAE@AAVCCmPluginBaseEng@@@Z @ 3 NONAME ; CmPluginBaseSettingsDlg::CmPluginBaseSettingsDlg(class CCmPluginBaseEng &)
+	??0CmPluginBaseSettingsDlgAdv@@QAE@AAVCCmPluginBaseEng@@@Z @ 4 NONAME ; CmPluginBaseSettingsDlgAdv::CmPluginBaseSettingsDlgAdv(class CCmPluginBaseEng &)
+	??0CmPluginBaseSettingsDlgIp@@QAE@AAVCCmPluginBaseEng@@@Z @ 5 NONAME ; CmPluginBaseSettingsDlgIp::CmPluginBaseSettingsDlgIp(class CCmPluginBaseEng &)
+	??0RCmDestination@@QAE@ABV0@@Z @ 6 NONAME ; RCmDestination::RCmDestination(class RCmDestination const &)
+	??0RCmDestinationExt@@QAE@ABV0@@Z @ 7 NONAME ; RCmDestinationExt::RCmDestinationExt(class RCmDestinationExt const &)
+	??1CCmApplicationSettingsUi@@UAE@XZ @ 8 NONAME ; CCmApplicationSettingsUi::~CCmApplicationSettingsUi(void)
+	??1CCmPluginBaseEng@@UAE@XZ @ 9 NONAME ; CCmPluginBaseEng::~CCmPluginBaseEng(void)
+	??1CCmPluginLanBase@@MAE@XZ @ 10 NONAME ; CCmPluginLanBase::~CCmPluginLanBase(void)
+	??1CCmSettingsUi@@UAE@XZ @ 11 NONAME ; CCmSettingsUi::~CCmSettingsUi(void)
+	??1CmPluginBaseSettingsDlg@@UAE@XZ @ 12 NONAME ; CmPluginBaseSettingsDlg::~CmPluginBaseSettingsDlg(void)
+	??1CmPluginBaseSettingsDlgAdv@@UAE@XZ @ 13 NONAME ; CmPluginBaseSettingsDlgAdv::~CmPluginBaseSettingsDlgAdv(void)
+	??1CmPluginBaseSettingsDlgIp@@UAE@XZ @ 14 NONAME ; CmPluginBaseSettingsDlgIp::~CmPluginBaseSettingsDlgIp(void)
+	??1RCmDestination@@QAE@XZ @ 15 NONAME ; RCmDestination::~RCmDestination(void)
+	??1RCmDestinationExt@@QAE@XZ @ 16 NONAME ; RCmDestinationExt::~RCmDestinationExt(void)
+	??4RCmDestination@@QAEAAV0@ABV0@@Z @ 17 NONAME ; class RCmDestination & RCmDestination::operator=(class RCmDestination const &)
+	??4RCmDestinationExt@@QAEAAV0@ABV0@@Z @ 18 NONAME ; class RCmDestinationExt & RCmDestinationExt::operator=(class RCmDestinationExt const &)
+	?AddCommonConversionTableL@CCmPluginBaseEng@@IAEXPBUTCmCommonAttrConvArrayItem@@@Z @ 19 NONAME ; void CCmPluginBaseEng::AddCommonConversionTableL(struct TCmCommonAttrConvArrayItem const *)
+	?AddConnectionMethodL@RCmDestinationExt@@QAEHVRCmConnectionMethodExt@@@Z @ 20 NONAME ; int RCmDestinationExt::AddConnectionMethodL(class RCmConnectionMethodExt)
+	?AddConverstionTableL@CCmPluginBaseEng@@IAEXPAPAVCCDRecordBase@CommsDat@@PAHPBUTCmAttribConvTable@@@Z @ 21 NONAME ; void CCmPluginBaseEng::AddConverstionTableL(class CommsDat::CCDRecordBase * *, int *, struct TCmAttribConvTable const *)
+	?AddEmbeddedDestinationL@RCmDestinationExt@@QAEHABV1@@Z @ 22 NONAME ; int RCmDestinationExt::AddEmbeddedDestinationL(class RCmDestinationExt const &)
+	?AddResourceFileL@CCmPluginBaseEng@@IAEXABVTDesC16@@@Z @ 23 NONAME ; void CCmPluginBaseEng::AddResourceFileL(class TDesC16 const &)
+	?AllDestinationsL@CCmManagerImpl@@QAEXAAV?$RArray@K@@@Z @ 24 NONAME ; void CCmManagerImpl::AllDestinationsL(class RArray<unsigned long> &)
+	?AllDestinationsL@RCmManager@@QBEXAAV?$RArray@K@@@Z @ 25 NONAME ; void RCmManager::AllDestinationsL(class RArray<unsigned long> &) const
+	?AllDestinationsL@RCmManagerExt@@QAEXAAV?$RArray@K@@@Z @ 26 NONAME ; void RCmManagerExt::AllDestinationsL(class RArray<unsigned long> &)
+	?AllocReadL@CCmPluginBaseEng@@IBEPAVHBufC16@@H@Z @ 27 NONAME ; class HBufC16 * CCmPluginBaseEng::AllocReadL(int) const
+	?AppendSettingTextsL@CmPluginBaseSettingsDlg@@IAEXAAVCDesC16Array@@HH@Z @ 28 NONAME ; void CmPluginBaseSettingsDlg::AppendSettingTextsL(class CDesC16Array &, int, int)
+	?AppendSettingTextsL@CmPluginBaseSettingsDlg@@IAEXAAVCDesC16Array@@HPBVHBufC16@@@Z @ 29 NONAME ; void CmPluginBaseSettingsDlg::AppendSettingTextsL(class CDesC16Array &, int, class HBufC16 const *)
+	?AppendSettingTextsL@CmPluginBaseSettingsDlg@@IBEXAAVCDesC16Array@@HHABVTDesC16@@H@Z @ 30 NONAME ; void CmPluginBaseSettingsDlg::AppendSettingTextsL(class CDesC16Array &, int, int, class TDesC16 const &, int) const
+	?AppendSettingTextsL@CmPluginBaseSettingsDlg@@IBEXAAVCDesC16Array@@HHHH@Z @ 31 NONAME ; void CmPluginBaseSettingsDlg::AppendSettingTextsL(class CDesC16Array &, int, int, int, int) const
+	?BearerPriorityArrayL@RCmManager@@QBEXAAV?$RArray@VTBearerPriority@@@@@Z @ 32 NONAME ; void RCmManager::BearerPriorityArrayL(class RArray<class TBearerPriority> &) const
+	?BearerPriorityArrayL@RCmManagerExt@@QBEXAAV?$RArray@VTBearerPriority@@@@@Z @ 33 NONAME ; void RCmManagerExt::BearerPriorityArrayL(class RArray<class TBearerPriority> &) const
+	?BearerRecordIdLC@CCmPluginLanBase@@MAEXAAPAVHBufC16@@AAK@Z @ 34 NONAME ; void CCmPluginLanBase::BearerRecordIdLC(class HBufC16 * &, unsigned long &)
+	?CheckDNSServerAddressL@CCmPluginBaseEng@@QAEXHAAV?$CMDBField@VTDesC16@@@CommsDat@@0AAV?$CMDBField@H@3@@Z @ 35 NONAME ; void CCmPluginBaseEng::CheckDNSServerAddressL(int, class CommsDat::CMDBField<class TDesC16> &, class CommsDat::CMDBField<class TDesC16> &, class CommsDat::CMDBField<int> &)
+	?CheckIPv4ValidityL@@YAHPAVCCmPluginBaseEng@@KPBX@Z @ 36 NONAME ; int CheckIPv4ValidityL(class CCmPluginBaseEng *, unsigned long, void const *)
+	?CheckIPv6ValidityL@@YAHPAVCCmPluginBaseEng@@KPBX@Z @ 37 NONAME ; int CheckIPv6ValidityL(class CCmPluginBaseEng *, unsigned long, void const *)
+	?CheckIfAlreadyConnected@CCmPluginBaseEng@@MBEHXZ @ 38 NONAME ; int CCmPluginBaseEng::CheckIfAlreadyConnected(void) const
+	?CheckIfNameModifiedL@CCmPluginBaseEng@@IBEXPAVCCDRecordBase@CommsDat@@@Z @ 39 NONAME ; void CCmPluginBaseEng::CheckIfNameModifiedL(class CommsDat::CCDRecordBase *) const
+	?CheckPortNumberValidityL@@YAHPAVCCmPluginBaseEng@@KPBX@Z @ 40 NONAME ; int CheckPortNumberValidityL(class CCmPluginBaseEng *, unsigned long, void const *)
+	?CheckRecordIdValidityL@@YAHPAVCCmPluginBaseEng@@KPBX@Z @ 41 NONAME ; int CheckRecordIdValidityL(class CCmPluginBaseEng *, unsigned long, void const *)
+	?CheckWAPWspOptionValidityL@@YAHPAVCCmPluginBaseEng@@KPBX@Z @ 42 NONAME ; int CheckWAPWspOptionValidityL(class CCmPluginBaseEng *, unsigned long, void const *)
+	?ClassifyIPv6Address@@YA?AW4TIPv6Types@CMManager@@ABVTDesC16@@@Z @ 43 NONAME ; enum CMManager::TIPv6Types ClassifyIPv6Address(class TDesC16 const &)
+	?CleanupGlobalPriorityArray@RCmManager@@QBEXAAV?$RArray@VTBearerPriority@@@@@Z @ 44 NONAME ; void RCmManager::CleanupGlobalPriorityArray(class RArray<class TBearerPriority> &) const
+	?CleanupGlobalPriorityArray@RCmManagerExt@@QBEXAAV?$RArray@VTBearerPriority@@@@@Z @ 45 NONAME ; void RCmManagerExt::CleanupGlobalPriorityArray(class RArray<class TBearerPriority> &) const
+	?Close@CCmTransactionHandler@@QAEXXZ @ 46 NONAME ABSENT ; void CCmTransactionHandler::Close(void)
+	?Close@RCmConnectionMethod@@QAEXXZ @ 47 NONAME ; void RCmConnectionMethod::Close(void)
+	?Close@RCmConnectionMethodExt@@QAEXXZ @ 48 NONAME ; void RCmConnectionMethodExt::Close(void)
+	?Close@RCmDestination@@QAEXXZ @ 49 NONAME ; void RCmDestination::Close(void)
+	?Close@RCmDestinationExt@@QAEXXZ @ 50 NONAME ; void RCmDestinationExt::Close(void)
+	?Close@RCmManager@@QAEXXZ @ 51 NONAME ; void RCmManager::Close(void)
+	?Close@RCmManagerExt@@QAEXXZ @ 52 NONAME ; void RCmManagerExt::Close(void)
+	?ConnectionMethodByIDL@RCmDestination@@QBE?AVRCmConnectionMethod@@H@Z @ 53 NONAME ; class RCmConnectionMethod RCmDestination::ConnectionMethodByIDL(int) const
+	?ConnectionMethodByIDL@RCmDestinationExt@@QAE?AVRCmConnectionMethodExt@@H@Z @ 54 NONAME ; class RCmConnectionMethodExt RCmDestinationExt::ConnectionMethodByIDL(int)
+	?ConnectionMethodCount@CCmDestinationImpl@@QAEHXZ @ 55 NONAME ; int CCmDestinationImpl::ConnectionMethodCount(void)
+	?ConnectionMethodCount@RCmDestination@@QBEHXZ @ 56 NONAME ; int RCmDestination::ConnectionMethodCount(void) const
+	?ConnectionMethodCount@RCmDestinationExt@@QAEHXZ @ 57 NONAME ; int RCmDestinationExt::ConnectionMethodCount(void)
+	?ConnectionMethodL@CCmDestinationImpl@@QAEPAVCCmPluginBaseEng@@H@Z @ 58 NONAME ; class CCmPluginBaseEng * CCmDestinationImpl::ConnectionMethodL(int)
+	?ConnectionMethodL@CCmManagerImpl@@QAEPAVCCmPluginBaseEng@@K@Z @ 59 NONAME ; class CCmPluginBaseEng * CCmManagerImpl::ConnectionMethodL(unsigned long)
+	?ConnectionMethodL@CCmManagerImpl@@QAEXAAV?$RArray@K@@HHHH@Z @ 60 NONAME ; void CCmManagerImpl::ConnectionMethodL(class RArray<unsigned long> &, int, int, int, int)
+	?ConnectionMethodL@RCmDestination@@QBE?AVRCmConnectionMethod@@H@Z @ 61 NONAME ; class RCmConnectionMethod RCmDestination::ConnectionMethodL(int) const
+	?ConnectionMethodL@RCmDestinationExt@@QAE?AVRCmConnectionMethodExt@@H@Z @ 62 NONAME ; class RCmConnectionMethodExt RCmDestinationExt::ConnectionMethodL(int)
+	?ConnectionMethodL@RCmManager@@QBE?AVRCmConnectionMethod@@K@Z @ 63 NONAME ; class RCmConnectionMethod RCmManager::ConnectionMethodL(unsigned long) const
+	?ConnectionMethodL@RCmManager@@QBEXAAV?$RArray@K@@HHH@Z @ 64 NONAME ; void RCmManager::ConnectionMethodL(class RArray<unsigned long> &, int, int, int) const
+	?ConnectionMethodL@RCmManagerExt@@QAE?AVRCmConnectionMethodExt@@K@Z @ 65 NONAME ; class RCmConnectionMethodExt RCmManagerExt::ConnectionMethodL(unsigned long)
+	?ConnectionMethodL@RCmManagerExt@@QAEXAAV?$RArray@K@@HHH@Z @ 66 NONAME ; void RCmManagerExt::ConnectionMethodL(class RArray<unsigned long> &, int, int, int)
+	?ConstructAndRunLD@CmPluginBaseSettingsDlg@@QAEHXZ @ 67 NONAME ; int CmPluginBaseSettingsDlg::ConstructAndRunLD(void)
+	?ConstructL@CCmPluginBaseEng@@MAEXXZ @ 68 NONAME ; void CCmPluginBaseEng::ConstructL(void)
+	?ConstructL@CCmPluginLanBase@@MAEXXZ @ 69 NONAME ; void CCmPluginLanBase::ConstructL(void)
+	?ConvTableItem@CCmPluginBaseEng@@QAEPBUTCmAttribConvTable@@K@Z @ 70 NONAME ; struct TCmAttribConvTable const * CCmPluginBaseEng::ConvTableItem(unsigned long)
+	?CopyConnectionMethodL@RCmManagerExt@@QAEHAAVRCmDestinationExt@@AAVRCmConnectionMethodExt@@@Z @ 71 NONAME ; int RCmManagerExt::CopyConnectionMethodL(class RCmDestinationExt &, class RCmConnectionMethodExt &)
+	?CreateConnectionMethodL@RCmDestinationExt@@QAE?AVRCmConnectionMethodExt@@K@Z @ 72 NONAME ; class RCmConnectionMethodExt RCmDestinationExt::CreateConnectionMethodL(unsigned long)
+	?CreateConnectionMethodL@RCmManagerExt@@QAE?AVRCmConnectionMethodExt@@K@Z @ 73 NONAME ; class RCmConnectionMethodExt RCmManagerExt::CreateConnectionMethodL(unsigned long)
+	?CreateCopyL@CCmPluginBaseEng@@UBEPAV1@XZ @ 74 NONAME ; class CCmPluginBaseEng * CCmPluginBaseEng::CreateCopyL(void) const
+	?CreateCopyL@RCmConnectionMethodExt@@QAE?AV1@XZ @ 75 NONAME ; class RCmConnectionMethodExt RCmConnectionMethodExt::CreateCopyL(void)
+	?CreateDestinationL@RCmManagerExt@@QAE?AVRCmDestinationExt@@ABVTDesC16@@@Z @ 76 NONAME ; class RCmDestinationExt RCmManagerExt::CreateDestinationL(class TDesC16 const &)
+	?CreateNewL@CCmPluginBaseEng@@UAEXXZ @ 77 NONAME ; void CCmPluginBaseEng::CreateNewL(void)
+	?CreateNewServiceRecordL@CCmPluginLanBase@@MAEXXZ @ 78 NONAME ; void CCmPluginLanBase::CreateNewServiceRecordL(void)
+	?DeleteConnectionMethodL@RCmDestinationExt@@QAEXAAVRCmConnectionMethodExt@@@Z @ 79 NONAME ; void RCmDestinationExt::DeleteConnectionMethodL(class RCmConnectionMethodExt &)
+	?DeleteL@CCmPluginBaseEng@@UAEHHH@Z @ 80 NONAME ; int CCmPluginBaseEng::DeleteL(int, int)
+	?DeleteL@RCmConnectionMethodExt@@QAEHXZ @ 81 NONAME ; int RCmConnectionMethodExt::DeleteL(void)
+	?DeleteLD@CCmDestinationImpl@@QAEXXZ @ 82 NONAME ; void CCmDestinationImpl::DeleteLD(void)
+	?DeleteLD@RCmDestinationExt@@QAEXXZ @ 83 NONAME ; void RCmDestinationExt::DeleteLD(void)
+	?Destination@CCmPluginBaseEng@@UBEPAVCCmDestinationImpl@@XZ @ 84 NONAME ; class CCmDestinationImpl * CCmPluginBaseEng::Destination(void) const
+	?DestinationL@CCmManagerImpl@@QAEPAVCCmDestinationImpl@@K@Z @ 85 NONAME ; class CCmDestinationImpl * CCmManagerImpl::DestinationL(unsigned long)
+	?DestinationL@RCmConnectionMethod@@QBE?AVRCmDestination@@XZ @ 86 NONAME ; class RCmDestination RCmConnectionMethod::DestinationL(void) const
+	?DestinationL@RCmConnectionMethodExt@@QBE?AVRCmDestinationExt@@XZ @ 87 NONAME ; class RCmDestinationExt RCmConnectionMethodExt::DestinationL(void) const
+	?DestinationL@RCmManager@@QBE?AVRCmDestination@@K@Z @ 88 NONAME ; class RCmDestination RCmManager::DestinationL(unsigned long) const
+	?DestinationL@RCmManagerExt@@QAE?AVRCmDestinationExt@@K@Z @ 89 NONAME ; class RCmDestinationExt RCmManagerExt::DestinationL(unsigned long)
+	?DynInitMenuPaneL@CmPluginBaseSettingsDlg@@MAEXHPAVCEikMenuPane@@@Z @ 90 NONAME ; void CmPluginBaseSettingsDlg::DynInitMenuPaneL(int, class CEikMenuPane *)
+	?DynInitMenuPaneL@CmPluginBaseSettingsDlgAdv@@UAEXHPAVCEikMenuPane@@@Z @ 91 NONAME ; void CmPluginBaseSettingsDlgAdv::DynInitMenuPaneL(int, class CEikMenuPane *)
+	?DynInitMenuPaneL@CmPluginBaseSettingsDlgIp@@UAEXHPAVCEikMenuPane@@@Z @ 92 NONAME ; void CmPluginBaseSettingsDlgIp::DynInitMenuPaneL(int, class CEikMenuPane *)
+	?EasyWlanIdL@CCmManagerImpl@@QAEKXZ @ 93 NONAME ; unsigned long CCmManagerImpl::EasyWlanIdL(void)
+	?EasyWlanIdL@RCmManager@@QBEKXZ @ 94 NONAME ; unsigned long RCmManager::EasyWlanIdL(void) const
+	?EasyWlanIdL@RCmManagerExt@@QAEKXZ @ 95 NONAME ; unsigned long RCmManagerExt::EasyWlanIdL(void)
+	?ElementId@RCmDestination@@QBEKXZ @ 96 NONAME ; unsigned long RCmDestination::ElementId(void) const
+	?ElementId@RCmDestinationExt@@QAEKXZ @ 97 NONAME ; unsigned long RCmDestinationExt::ElementId(void)
+	?EnableChargeCardL@CCmPluginBaseEng@@AAEXH@Z @ 98 NONAME ABSENT ; void CCmPluginBaseEng::EnableChargeCardL(int)
+	?EnableLocationL@CCmPluginBaseEng@@AAEXH@Z @ 99 NONAME ABSENT ; void CCmPluginBaseEng::EnableLocationL(int)
+	?EnableProxyL@CCmPluginBaseEng@@AAEXH@Z @ 100 NONAME ABSENT ; void CCmPluginBaseEng::EnableProxyL(int)
+	?FeatureSupported@CCmPluginBaseEng@@SAHH@Z @ 101 NONAME ; int CCmPluginBaseEng::FeatureSupported(int)
+	?GetBearerInfoBoolL@CCmManagerImpl@@QBEHKK@Z @ 102 NONAME ; int CCmManagerImpl::GetBearerInfoBoolL(unsigned long, unsigned long) const
+	?GetBearerInfoBoolL@RCmManager@@QBEHKK@Z @ 103 NONAME ; int RCmManager::GetBearerInfoBoolL(unsigned long, unsigned long) const
+	?GetBearerInfoBoolL@RCmManagerExt@@QBEHKK@Z @ 104 NONAME ; int RCmManagerExt::GetBearerInfoBoolL(unsigned long, unsigned long) const
+	?GetBearerInfoIntL@CCmManagerImpl@@QBEKKK@Z @ 105 NONAME ; unsigned long CCmManagerImpl::GetBearerInfoIntL(unsigned long, unsigned long) const
+	?GetBearerInfoIntL@RCmManager@@QBEKKK@Z @ 106 NONAME ; unsigned long RCmManager::GetBearerInfoIntL(unsigned long, unsigned long) const
+	?GetBearerInfoIntL@RCmManagerExt@@QBEKKK@Z @ 107 NONAME ; unsigned long RCmManagerExt::GetBearerInfoIntL(unsigned long, unsigned long) const
+	?GetBearerInfoString8L@CCmManagerImpl@@QBEPAVHBufC8@@KK@Z @ 108 NONAME ; class HBufC8 * CCmManagerImpl::GetBearerInfoString8L(unsigned long, unsigned long) const
+	?GetBearerInfoString8L@RCmManager@@QBEPAVHBufC8@@KK@Z @ 109 NONAME ; class HBufC8 * RCmManager::GetBearerInfoString8L(unsigned long, unsigned long) const
+	?GetBearerInfoString8L@RCmManagerExt@@QBEPAVHBufC8@@KK@Z @ 110 NONAME ; class HBufC8 * RCmManagerExt::GetBearerInfoString8L(unsigned long, unsigned long) const
+	?GetBearerInfoStringL@CCmManagerImpl@@QBEPAVHBufC16@@KK@Z @ 111 NONAME ; class HBufC16 * CCmManagerImpl::GetBearerInfoStringL(unsigned long, unsigned long) const
+	?GetBearerInfoStringL@RCmManager@@QBEPAVHBufC16@@KK@Z @ 112 NONAME ; class HBufC16 * RCmManager::GetBearerInfoStringL(unsigned long, unsigned long) const
+	?GetBearerInfoStringL@RCmManagerExt@@QBEPAVHBufC16@@KK@Z @ 113 NONAME ; class HBufC16 * RCmManagerExt::GetBearerInfoStringL(unsigned long, unsigned long) const
+	?GetBoolAttributeL@CCmPluginBaseEng@@UBEHK@Z @ 114 NONAME ; int CCmPluginBaseEng::GetBoolAttributeL(unsigned long) const
+	?GetBoolAttributeL@RCmConnectionMethod@@QBEHK@Z @ 115 NONAME ; int RCmConnectionMethod::GetBoolAttributeL(unsigned long) const
+	?GetBoolAttributeL@RCmConnectionMethodExt@@QBEHK@Z @ 116 NONAME ; int RCmConnectionMethodExt::GetBoolAttributeL(unsigned long) const
+	?GetConnectionMethodInfoBoolL@CCmManagerImpl@@QBEHKK@Z @ 117 NONAME ; int CCmManagerImpl::GetConnectionMethodInfoBoolL(unsigned long, unsigned long) const
+	?GetConnectionMethodInfoBoolL@RCmManager@@QBEHKK@Z @ 118 NONAME ; int RCmManager::GetConnectionMethodInfoBoolL(unsigned long, unsigned long) const
+	?GetConnectionMethodInfoBoolL@RCmManagerExt@@QBEHKK@Z @ 119 NONAME ; int RCmManagerExt::GetConnectionMethodInfoBoolL(unsigned long, unsigned long) const
+	?GetConnectionMethodInfoIntL@CCmManagerImpl@@QBEKKK@Z @ 120 NONAME ; unsigned long CCmManagerImpl::GetConnectionMethodInfoIntL(unsigned long, unsigned long) const
+	?GetConnectionMethodInfoIntL@RCmManager@@QBEKKK@Z @ 121 NONAME ; unsigned long RCmManager::GetConnectionMethodInfoIntL(unsigned long, unsigned long) const
+	?GetConnectionMethodInfoIntL@RCmManagerExt@@QBEKKK@Z @ 122 NONAME ; unsigned long RCmManagerExt::GetConnectionMethodInfoIntL(unsigned long, unsigned long) const
+	?GetConnectionMethodInfoString8L@CCmManagerImpl@@QBEPAVHBufC8@@KK@Z @ 123 NONAME ; class HBufC8 * CCmManagerImpl::GetConnectionMethodInfoString8L(unsigned long, unsigned long) const
+	?GetConnectionMethodInfoString8L@RCmManager@@QBEPAVHBufC8@@KK@Z @ 124 NONAME ; class HBufC8 * RCmManager::GetConnectionMethodInfoString8L(unsigned long, unsigned long) const
+	?GetConnectionMethodInfoString8L@RCmManagerExt@@QBEPAVHBufC8@@KK@Z @ 125 NONAME ; class HBufC8 * RCmManagerExt::GetConnectionMethodInfoString8L(unsigned long, unsigned long) const
+	?GetConnectionMethodInfoStringL@CCmManagerImpl@@QBEPAVHBufC16@@KK@Z @ 126 NONAME ; class HBufC16 * CCmManagerImpl::GetConnectionMethodInfoStringL(unsigned long, unsigned long) const
+	?GetConnectionMethodInfoStringL@RCmManager@@QBEPAVHBufC16@@KK@Z @ 127 NONAME ; class HBufC16 * RCmManager::GetConnectionMethodInfoStringL(unsigned long, unsigned long) const
+	?GetConnectionMethodInfoStringL@RCmManagerExt@@QBEPAVHBufC16@@KK@Z @ 128 NONAME ; class HBufC16 * RCmManagerExt::GetConnectionMethodInfoStringL(unsigned long, unsigned long) const
+	?GetHelpContext@CmPluginBaseSettingsDlg@@UBEXAAVTCoeHelpContext@@@Z @ 129 NONAME ; void CmPluginBaseSettingsDlg::GetHelpContext(class TCoeHelpContext &) const
+	?GetIPv6DNSTypeL@CmPluginBaseSettingsDlg@@QAEHKK@Z @ 130 NONAME ; int CmPluginBaseSettingsDlg::GetIPv6DNSTypeL(unsigned long, unsigned long)
+	?GetIntAttributeL@CCmPluginBaseEng@@UBEKK@Z @ 131 NONAME ; unsigned long CCmPluginBaseEng::GetIntAttributeL(unsigned long) const
+	?GetIntAttributeL@RCmConnectionMethod@@QBEKK@Z @ 132 NONAME ; unsigned long RCmConnectionMethod::GetIntAttributeL(unsigned long) const
+	?GetIntAttributeL@RCmConnectionMethodExt@@QBEKK@Z @ 133 NONAME ; unsigned long RCmConnectionMethodExt::GetIntAttributeL(unsigned long) const
+	?GetString8AttributeL@CCmPluginBaseEng@@UBEPAVHBufC8@@K@Z @ 134 NONAME ; class HBufC8 * CCmPluginBaseEng::GetString8AttributeL(unsigned long) const
+	?GetString8AttributeL@RCmConnectionMethod@@QBEPAVHBufC8@@K@Z @ 135 NONAME ; class HBufC8 * RCmConnectionMethod::GetString8AttributeL(unsigned long) const
+	?GetString8AttributeL@RCmConnectionMethodExt@@QBEPAVHBufC8@@K@Z @ 136 NONAME ; class HBufC8 * RCmConnectionMethodExt::GetString8AttributeL(unsigned long) const
+	?GetStringAttributeL@CCmPluginBaseEng@@UBEPAVHBufC16@@K@Z @ 137 NONAME ; class HBufC16 * CCmPluginBaseEng::GetStringAttributeL(unsigned long) const
+	?GetStringAttributeL@RCmConnectionMethod@@QBEPAVHBufC16@@K@Z @ 138 NONAME ; class HBufC16 * RCmConnectionMethod::GetStringAttributeL(unsigned long) const
+	?GetStringAttributeL@RCmConnectionMethodExt@@QBEPAVHBufC16@@K@Z @ 139 NONAME ; class HBufC16 * RCmConnectionMethodExt::GetStringAttributeL(unsigned long) const
+	?GlobalBearerPriority@CCmPluginBaseEng@@IBEHABVTDesC16@@@Z @ 140 NONAME ; int CCmPluginBaseEng::GlobalBearerPriority(class TDesC16 const &) const
+	?GlobalUiBearerPriority@CCmPluginBaseEng@@IBEHABVTDesC16@@@Z @ 141 NONAME ; int CCmPluginBaseEng::GlobalUiBearerPriority(class TDesC16 const &) const
+	?HandleListBoxEventL@CmPluginBaseSettingsDlg@@MAEXPAVCEikListBox@@W4TListBoxEvent@MEikListBoxObserver@@@Z @ 142 NONAME ; void CmPluginBaseSettingsDlg::HandleListBoxEventL(class CEikListBox *, enum MEikListBoxObserver::TListBoxEvent)
+	?HandleListboxDataChangeL@CmPluginBaseSettingsDlg@@QAEXXZ @ 143 NONAME ; void CmPluginBaseSettingsDlg::HandleListboxDataChangeL(void)
+	?IAPRecordElementId@CCmPluginBaseEng@@QBEKXZ @ 144 NONAME ; unsigned long CCmPluginBaseEng::IAPRecordElementId(void) const
+	?IconL@CCmDestinationImpl@@QAEPAVCGulIcon@@XZ @ 145 NONAME ; class CGulIcon * CCmDestinationImpl::IconL(void)
+	?IconL@RCmDestination@@QBEPAVCGulIcon@@XZ @ 146 NONAME ; class CGulIcon * RCmDestination::IconL(void) const
+	?IconL@RCmDestinationExt@@QAEPAVCGulIcon@@XZ @ 147 NONAME ; class CGulIcon * RCmDestinationExt::IconL(void)
+	?Id@RCmDestination@@QBEKXZ @ 148 NONAME ; unsigned long RCmDestination::Id(void) const
+	?Id@RCmDestinationExt@@QAEKXZ @ 149 NONAME ; unsigned long RCmDestinationExt::Id(void)
+	?InitTextsL@CmPluginBaseSettingsDlg@@UAEXXZ @ 150 NONAME ; void CmPluginBaseSettingsDlg::InitTextsL(void)
+	?InitializeWithUiL@CCmPluginLanBase@@UAEHH@Z @ 151 NONAME ; int CCmPluginLanBase::InitializeWithUiL(int)
+	?IsConnectedL@CCmDestinationImpl@@QBEHXZ @ 152 NONAME ; int CCmDestinationImpl::IsConnectedL(void) const
+	?IsConnectedL@RCmDestination@@QBEHXZ @ 153 NONAME ; int RCmDestination::IsConnectedL(void) const
+	?IsConnectedL@RCmDestinationExt@@QBEHXZ @ 154 NONAME ; int RCmDestinationExt::IsConnectedL(void) const
+	?IsHidden@CCmDestinationImpl@@QAEHXZ @ 155 NONAME ; int CCmDestinationImpl::IsHidden(void)
+	?IsHidden@RCmDestination@@QBEHXZ @ 156 NONAME ; int RCmDestination::IsHidden(void) const
+	?IsHidden@RCmDestinationExt@@QAEHXZ @ 157 NONAME ; int RCmDestinationExt::IsHidden(void)
+	?IsProtected@CCmPluginBaseEng@@QBEHXZ @ 158 NONAME ; int CCmPluginBaseEng::IsProtected(void) const
+	?IsUnspecifiedIPv4Address@@YAHABVTDesC16@@@Z @ 159 NONAME ; int IsUnspecifiedIPv4Address(class TDesC16 const &)
+	?LoadL@CCmPluginBaseEng@@UAEXK@Z @ 160 NONAME ; void CCmPluginBaseEng::LoadL(unsigned long)
+	?LoadResourceL@CmPluginBaseSettingsDlg@@IAEHABVTDesC16@@@Z @ 161 NONAME ; int CmPluginBaseSettingsDlg::LoadResourceL(class TDesC16 const &)
+	?LoadServiceSettingL@CCmPluginBaseEng@@MAEXXZ @ 162 NONAME ; void CCmPluginBaseEng::LoadServiceSettingL(void)
+	?LoadServiceSettingL@CCmPluginLanBase@@UAEXXZ @ 163 NONAME ; void CCmPluginLanBase::LoadServiceSettingL(void)
+	?MetadataL@RCmDestination@@QBEKW4TSnapMetadataField@CMManager@@@Z @ 164 NONAME ; unsigned long RCmDestination::MetadataL(enum CMManager::TSnapMetadataField) const
+	?MetadataL@RCmDestinationExt@@QBEKW4TSnapMetadataField@CMManager@@@Z @ 165 NONAME ; unsigned long RCmDestinationExt::MetadataL(enum CMManager::TSnapMetadataField) const
+	?ModifyPriorityL@RCmDestinationExt@@QAEXAAVRCmConnectionMethodExt@@I@Z @ 166 NONAME ; void RCmDestinationExt::ModifyPriorityL(class RCmConnectionMethodExt &, unsigned int)
+	?MoveConnectionMethodL@RCmManagerExt@@QAEHAAVRCmDestinationExt@@0AAVRCmConnectionMethodExt@@@Z @ 167 NONAME ; int RCmManagerExt::MoveConnectionMethodL(class RCmDestinationExt &, class RCmDestinationExt &, class RCmConnectionMethodExt &)
+	?NameLC@CCmDestinationImpl@@QAEPAVHBufC16@@XZ @ 168 NONAME ; class HBufC16 * CCmDestinationImpl::NameLC(void)
+	?NameLC@RCmDestination@@QBEPAVHBufC16@@XZ @ 169 NONAME ; class HBufC16 * RCmDestination::NameLC(void) const
+	?NameLC@RCmDestinationExt@@QAEPAVHBufC16@@XZ @ 170 NONAME ; class HBufC16 * RCmDestinationExt::NameLC(void)
+	?NewL@CCmApplicationSettingsUi@@SAPAV1@XZ @ 171 NONAME ; class CCmApplicationSettingsUi * CCmApplicationSettingsUi::NewL(void)
+	?NewL@CCmApplicationSettingsUiImpl@@SAPAV1@XZ @ 172 NONAME ; class CCmApplicationSettingsUiImpl * CCmApplicationSettingsUiImpl::NewL(void)
+	?NewL@CCmConnSettingsUiImpl@@SAPAV1@PAVCCmManagerImpl@@@Z @ 173 NONAME ; class CCmConnSettingsUiImpl * CCmConnSettingsUiImpl::NewL(class CCmManagerImpl *)
+	?NewL@CCmDestinationImpl@@SAPAV1@AAVCCmManagerImpl@@ABVTDesC16@@@Z @ 174 NONAME ; class CCmDestinationImpl * CCmDestinationImpl::NewL(class CCmManagerImpl &, class TDesC16 const &)
+	?NewL@CCmDestinationImpl@@SAPAV1@AAVCCmManagerImpl@@I@Z @ 175 NONAME ; class CCmDestinationImpl * CCmDestinationImpl::NewL(class CCmManagerImpl &, unsigned int)
+	?NewL@CCmPluginMultiLineDialog@@SAPAV1@AAVTDes16@@0W4TTone@CAknQueryDialog@@@Z @ 176 NONAME ; class CCmPluginMultiLineDialog * CCmPluginMultiLineDialog::NewL(class TDes16 &, class TDes16 &, enum CAknQueryDialog::TTone)
+	?NewL@CCmSettingsUi@@SAPAV1@XZ @ 177 NONAME ; class CCmSettingsUi * CCmSettingsUi::NewL(void)
+	?NewLC@CCmApplicationSettingsUi@@SAPAV1@XZ @ 178 NONAME ; class CCmApplicationSettingsUi * CCmApplicationSettingsUi::NewLC(void)
+	?NumOfConnMethodReferencesL@CCmPluginBaseEng@@UAEHXZ @ 179 NONAME ; int CCmPluginBaseEng::NumOfConnMethodReferencesL(void)
+	?OkToExitL@CmPluginBaseSettingsDlg@@MAEHH@Z @ 180 NONAME ; int CmPluginBaseSettingsDlg::OkToExitL(int)
+	?OpenL@RCmManager@@QAEXXZ @ 181 NONAME ; void RCmManager::OpenL(void)
+	?OpenL@RCmManagerExt@@QAEXXZ @ 182 NONAME ; void RCmManagerExt::OpenL(void)
+	?OpenLC@RCmManager@@QAEXXZ @ 183 NONAME ; void RCmManager::OpenLC(void)
+	?OpenLC@RCmManagerExt@@QAEXXZ @ 184 NONAME ; void RCmManagerExt::OpenLC(void)
+	?PreLayoutDynInitL@CmPluginBaseSettingsDlg@@MAEXXZ @ 185 NONAME ; void CmPluginBaseSettingsDlg::PreLayoutDynInitL(void)
+	?PrepareToLoadRecordsL@CCmPluginBaseEng@@MAEXXZ @ 186 NONAME ; void CCmPluginBaseEng::PrepareToLoadRecordsL(void)
+	?PrepareToUpdateRecordsL@CCmPluginBaseEng@@MAEXXZ @ 187 NONAME ; void CCmPluginBaseEng::PrepareToUpdateRecordsL(void)
+	?PrepareToUpdateRecordsL@CCmPluginLanBase@@UAEXXZ @ 188 NONAME ; void CCmPluginLanBase::PrepareToUpdateRecordsL(void)
+	?PriorityL@CCmDestinationImpl@@QAEIAAVCCmPluginBaseEng@@@Z @ 189 NONAME ABSENT ; unsigned int CCmDestinationImpl::PriorityL(class CCmPluginBaseEng &)
+	?PriorityL@RCmDestination@@QBEIABVRCmConnectionMethod@@@Z @ 190 NONAME ; unsigned int RCmDestination::PriorityL(class RCmConnectionMethod const &) const
+	?PriorityL@RCmDestinationExt@@QAEIABVRCmConnectionMethodExt@@@Z @ 191 NONAME ; unsigned int RCmDestinationExt::PriorityL(class RCmConnectionMethodExt const &)
+	?ProcessCommandL@CmPluginBaseSettingsDlg@@UAEXH@Z @ 192 NONAME ; void CmPluginBaseSettingsDlg::ProcessCommandL(int)
+	?ProtectionLevel@CCmDestinationImpl@@QAE?AW4TProtectionLevel@CMManager@@XZ @ 193 NONAME ; enum CMManager::TProtectionLevel CCmDestinationImpl::ProtectionLevel(void)
+	?ProtectionLevel@RCmDestination@@QBE?AW4TProtectionLevel@CMManager@@XZ @ 194 NONAME ; enum CMManager::TProtectionLevel RCmDestination::ProtectionLevel(void) const
+	?ProtectionLevel@RCmDestinationExt@@QAE?AW4TProtectionLevel@CMManager@@XZ @ 195 NONAME ; enum CMManager::TProtectionLevel RCmDestinationExt::ProtectionLevel(void)
+	?ReadDefConnL@RCmManager@@QAEXAAUTCmDefConnValue@@@Z @ 196 NONAME ; void RCmManager::ReadDefConnL(struct TCmDefConnValue &)
+	?ReadDefConnL@RCmManagerExt@@QAEXAAUTCmDefConnValue@@@Z @ 197 NONAME ; void RCmManagerExt::ReadDefConnL(struct TCmDefConnValue &)
+	?ReadOnlyAttributeL@@YAHPAVCCmPluginBaseEng@@KPBX@Z @ 198 NONAME ; int ReadOnlyAttributeL(class CCmPluginBaseEng *, unsigned long, void const *)
+	?RemoveAllReferencesL@RCmManagerExt@@QAEXAAVRCmConnectionMethodExt@@@Z @ 199 NONAME ; void RCmManagerExt::RemoveAllReferencesL(class RCmConnectionMethodExt &)
+	?RemoveCommonConversionTable@CCmPluginBaseEng@@IAEXPBUTCmCommonAttrConvArrayItem@@@Z @ 200 NONAME ; void CCmPluginBaseEng::RemoveCommonConversionTable(struct TCmCommonAttrConvArrayItem const *)
+	?RemoveConnectionMethodL@RCmDestinationExt@@QAEXVRCmConnectionMethodExt@@@Z @ 201 NONAME ; void RCmDestinationExt::RemoveConnectionMethodL(class RCmConnectionMethodExt)
+	?RemoveConnectionMethodL@RCmManagerExt@@QAEXAAVRCmDestinationExt@@AAVRCmConnectionMethodExt@@@Z @ 202 NONAME ; void RCmManagerExt::RemoveConnectionMethodL(class RCmDestinationExt &, class RCmConnectionMethodExt &)
+	?RemoveConversionTable@CCmPluginBaseEng@@IAEXPBUTCmAttribConvTable@@@Z @ 203 NONAME ; void CCmPluginBaseEng::RemoveConversionTable(struct TCmAttribConvTable const *)
+	?RemoveFromPool@CCmDestinationImpl@@QAEXXZ @ 204 NONAME ; void CCmDestinationImpl::RemoveFromPool(void)
+	?RemoveResourceFile@CCmPluginBaseEng@@IAEXABVTDesC16@@@Z @ 205 NONAME ; void CCmPluginBaseEng::RemoveResourceFile(class TDesC16 const &)
+	?Reset@CCmPluginBaseEng@@IAEXXZ @ 206 NONAME ; void CCmPluginBaseEng::Reset(void)
+	?RestoreAttributeL@CCmPluginBaseEng@@UAEXK@Z @ 207 NONAME ; void CCmPluginBaseEng::RestoreAttributeL(unsigned long)
+	?RunAdvancedSettingsL@CmPluginBaseSettingsDlgAdv@@UAEXXZ @ 208 NONAME ; void CmPluginBaseSettingsDlgAdv::RunAdvancedSettingsL(void)
+	?RunAdvancedSettingsL@CmPluginBaseSettingsDlgIp@@UAEXXZ @ 209 NONAME ; void CmPluginBaseSettingsDlgIp::RunAdvancedSettingsL(void)
+	?RunApplicationSettingsL@CCmApplicationSettingsUi@@QAEHAAUTCmSettingSelection@@@Z @ 210 NONAME ; int CCmApplicationSettingsUi::RunApplicationSettingsL(struct TCmSettingSelection &)
+	?RunApplicationSettingsL@CCmApplicationSettingsUi@@QAEHAAUTCmSettingSelection@@IAAV?$RArray@K@@@Z @ 211 NONAME ; int CCmApplicationSettingsUi::RunApplicationSettingsL(struct TCmSettingSelection &, unsigned int, class RArray<unsigned long> &)
+	?RunApplicationSettingsL@CCmApplicationSettingsUiImpl@@QAEHAAUTCmSettingSelection@@@Z @ 212 NONAME ; int CCmApplicationSettingsUiImpl::RunApplicationSettingsL(struct TCmSettingSelection &)
+	?RunApplicationSettingsL@CCmConnSettingsUiImpl@@QAEHAAUTCmSettingSelection@@IAAV?$RArray@K@@@Z @ 213 NONAME ; int CCmConnSettingsUiImpl::RunApplicationSettingsL(struct TCmSettingSelection &, unsigned int, class RArray<unsigned long> &)
+	?RunSettingsL@CCmPluginLanBase@@UAEHXZ @ 214 NONAME ; int CCmPluginLanBase::RunSettingsL(void)
+	?RunSettingsL@CCmSettingsUi@@QAE?AW4TResult@1@XZ @ 215 NONAME ; enum CCmSettingsUi::TResult CCmSettingsUi::RunSettingsL(void)
+	?SelectDestinationDlgL@CCmSettingsUi@@QAEHAAK@Z @ 216 NONAME ; int CCmSettingsUi::SelectDestinationDlgL(unsigned long &)
+	?SelectItem@CmPluginBaseSettingsDlg@@IAEXH@Z @ 217 NONAME ; void CmPluginBaseSettingsDlg::SelectItem(int)
+	?ServiceRecord@CCmPluginLanBase@@ABEAAVCCDLANServiceRecord@CommsDat@@XZ @ 218 NONAME ; class CommsDat::CCDLANServiceRecord & CCmPluginLanBase::ServiceRecord(void) const
+	?ServiceRecordIdLC@CCmPluginLanBase@@MAEXAAPAVHBufC16@@AAK@Z @ 219 NONAME ; void CCmPluginLanBase::ServiceRecordIdLC(class HBufC16 * &, unsigned long &)
+	?Session@CCmPluginBaseEng@@QBEAAVCMDBSession@CommsDat@@XZ @ 220 NONAME ; class CommsDat::CMDBSession & CCmPluginBaseEng::Session(void) const
+	?SetBoolAttributeL@CCmPluginBaseEng@@UAEXKH@Z @ 221 NONAME ; void CCmPluginBaseEng::SetBoolAttributeL(unsigned long, int)
+	?SetBoolAttributeL@RCmConnectionMethodExt@@QAEXKH@Z @ 222 NONAME ; void RCmConnectionMethodExt::SetBoolAttributeL(unsigned long, int)
+	?SetDNSServerAddressL@CCmPluginBaseEng@@QAEXKABVTDesC16@@K0KH@Z @ 223 NONAME ; void CCmPluginBaseEng::SetDNSServerAddressL(unsigned long, class TDesC16 const &, unsigned long, class TDesC16 const &, unsigned long, int)
+	?SetHiddenL@CCmDestinationImpl@@QAEXH@Z @ 224 NONAME ; void CCmDestinationImpl::SetHiddenL(int)
+	?SetHiddenL@RCmDestinationExt@@QAEXH@Z @ 225 NONAME ; void RCmDestinationExt::SetHiddenL(int)
+	?SetIconL@CCmDestinationImpl@@QAEXK@Z @ 226 NONAME ; void CCmDestinationImpl::SetIconL(unsigned long)
+	?SetIconL@RCmDestinationExt@@QAEXK@Z @ 227 NONAME ; void RCmDestinationExt::SetIconL(unsigned long)
+	?SetIntAttributeL@CCmPluginBaseEng@@UAEXKK@Z @ 228 NONAME ; void CCmPluginBaseEng::SetIntAttributeL(unsigned long, unsigned long)
+	?SetIntAttributeL@RCmConnectionMethodExt@@QAEXKK@Z @ 229 NONAME ; void RCmConnectionMethodExt::SetIntAttributeL(unsigned long, unsigned long)
+	?SetMetadataL@RCmDestinationExt@@QAEXW4TSnapMetadataField@CMManager@@K@Z @ 230 NONAME ; void RCmDestinationExt::SetMetadataL(enum CMManager::TSnapMetadataField, unsigned long)
+	?SetNameL@CCmDestinationImpl@@QAEXABVTDesC16@@@Z @ 231 NONAME ; void CCmDestinationImpl::SetNameL(class TDesC16 const &)
+	?SetNameL@RCmDestinationExt@@QAEXABVTDesC16@@@Z @ 232 NONAME ; void RCmDestinationExt::SetNameL(class TDesC16 const &)
+	?SetProtectionL@CCmDestinationImpl@@QAEXW4TProtectionLevel@CMManager@@@Z @ 233 NONAME ; void CCmDestinationImpl::SetProtectionL(enum CMManager::TProtectionLevel)
+	?SetProtectionL@RCmDestinationExt@@QAEXW4TProtectionLevel@CMManager@@@Z @ 234 NONAME ; void RCmDestinationExt::SetProtectionL(enum CMManager::TProtectionLevel)
+	?SetProxyServerNameL@@YAHPAVCCmPluginBaseEng@@KPBX@Z @ 235 NONAME ; int SetProxyServerNameL(class CCmPluginBaseEng *, unsigned long, void const *)
+	?SetString8AttributeL@CCmPluginBaseEng@@UAEXKABVTDesC8@@@Z @ 236 NONAME ; void CCmPluginBaseEng::SetString8AttributeL(unsigned long, class TDesC8 const &)
+	?SetString8AttributeL@RCmConnectionMethodExt@@QAEXKABVTDesC8@@@Z @ 237 NONAME ; void RCmConnectionMethodExt::SetString8AttributeL(unsigned long, class TDesC8 const &)
+	?SetStringAttributeL@CCmPluginBaseEng@@UAEXKABVTDesC16@@@Z @ 238 NONAME ; void CCmPluginBaseEng::SetStringAttributeL(unsigned long, class TDesC16 const &)
+	?SetStringAttributeL@RCmConnectionMethodExt@@QAEXKABVTDesC16@@@Z @ 239 NONAME ; void RCmConnectionMethodExt::SetStringAttributeL(unsigned long, class TDesC16 const &)
+	?ShowConfirmationQueryL@TCmCommonUi@@SAHH@Z @ 240 NONAME ; int TCmCommonUi::ShowConfirmationQueryL(int)
+	?ShowConfirmationQueryL@TCmCommonUi@@SAHHABVTDesC16@@@Z @ 241 NONAME ; int TCmCommonUi::ShowConfirmationQueryL(int, class TDesC16 const &)
+	?ShowConfirmationQueryWithInputL@TCmCommonUi@@SAHHAAVTDes16@@@Z @ 242 NONAME ; int TCmCommonUi::ShowConfirmationQueryWithInputL(int, class TDes16 &)
+	?ShowNoteL@TCmCommonUi@@SAHABVTDesC16@@W4TCmNoteType@1@@Z @ 243 NONAME ; int TCmCommonUi::ShowNoteL(class TDesC16 const &, enum TCmCommonUi::TCmNoteType)
+	?ShowNoteL@TCmCommonUi@@SAHHABVTDesC16@@W4TCmNoteType@1@@Z @ 244 NONAME ; int TCmCommonUi::ShowNoteL(int, class TDesC16 const &, enum TCmCommonUi::TCmNoteType)
+	?ShowNoteL@TCmCommonUi@@SAHHW4TCmNoteType@1@@Z @ 245 NONAME ; int TCmCommonUi::ShowNoteL(int, enum TCmCommonUi::TCmNoteType)
+	?ShowPopupIPv4DNSEditorL@CmPluginBaseSettingsDlg@@QAEHKKKK@Z @ 246 NONAME ; int CmPluginBaseSettingsDlg::ShowPopupIPv4DNSEditorL(unsigned long, unsigned long, unsigned long, unsigned long)
+	?ShowPopupIPv6DNSEditorL@CmPluginBaseSettingsDlg@@QAEHPBKKKK@Z @ 247 NONAME ; int CmPluginBaseSettingsDlg::ShowPopupIPv6DNSEditorL(unsigned long const *, unsigned long, unsigned long, unsigned long)
+	?ShowPopupIpSettingPageL@CmPluginBaseSettingsDlg@@QAEHKK@Z @ 248 NONAME ; int CmPluginBaseSettingsDlg::ShowPopupIpSettingPageL(unsigned long, unsigned long)
+	?ShowPopupListL@TCmCommonUi@@SAHABVTDesC16@@PAVCDesC16ArrayFlat@@PAV?$CArrayPtr@VCGulIcon@@@@IAAH@Z @ 249 NONAME ; int TCmCommonUi::ShowPopupListL(class TDesC16 const &, class CDesC16ArrayFlat *, class CArrayPtr<class CGulIcon> *, unsigned int, int &)
+	?ShowPopupPasswordSettingPageL@CmPluginBaseSettingsDlg@@QAEHKK@Z @ 250 NONAME ; int CmPluginBaseSettingsDlg::ShowPopupPasswordSettingPageL(unsigned long, unsigned long)
+	?ShowPopupPortNumSettingPageL@CmPluginBaseSettingsDlg@@QAEHKK@Z @ 251 NONAME ; int CmPluginBaseSettingsDlg::ShowPopupPortNumSettingPageL(unsigned long, unsigned long)
+	?ShowPopupSettingPageL@CmPluginBaseSettingsDlg@@MAEHKH@Z @ 252 NONAME ; int CmPluginBaseSettingsDlg::ShowPopupSettingPageL(unsigned long, int)
+	?ShowPopupSettingPageL@CmPluginBaseSettingsDlgAdv@@MAEHHH@Z @ 253 NONAME ; int CmPluginBaseSettingsDlgAdv::ShowPopupSettingPageL(int, int)
+	?ShowPopupTextSettingPageL@CmPluginBaseSettingsDlg@@QAEHKK@Z @ 254 NONAME ; int CmPluginBaseSettingsDlg::ShowPopupTextSettingPageL(unsigned long, unsigned long)
+	?ShowRadioButtonSettingPageL@CmPluginBaseSettingsDlg@@QAEHAAVCDesC16ArrayFlat@@AAHK@Z @ 255 NONAME ; int CmPluginBaseSettingsDlg::ShowRadioButtonSettingPageL(class CDesC16ArrayFlat &, int &, unsigned long)
+	?ShowRadioButtonSettingPageL@CmPluginBaseSettingsDlg@@QAEHPBKAAHK@Z @ 256 NONAME ; int CmPluginBaseSettingsDlg::ShowRadioButtonSettingPageL(unsigned long const *, int &, unsigned long)
+	?StringAttributeWithDefaultL@CmPluginBaseSettingsDlg@@IAEPAVHBufC16@@KK@Z @ 257 NONAME ; class HBufC16 * CmPluginBaseSettingsDlg::StringAttributeWithDefaultL(unsigned long, unsigned long)
+	?SupportedBearersL@RCmManagerExt@@QBEXAAV?$RArray@K@@@Z @ 258 NONAME ; void RCmManagerExt::SupportedBearersL(class RArray<unsigned long> &) const
+	?UncategorizedIconL@RCmManagerExt@@QBEPAVCGulIcon@@XZ @ 259 NONAME ; class CGulIcon * RCmManagerExt::UncategorizedIconL(void) const
+	?UpdateBearerPriorityArrayL@RCmManagerExt@@QAEXABV?$RArray@VTBearerPriority@@@@@Z @ 260 NONAME ; void RCmManagerExt::UpdateBearerPriorityArrayL(class RArray<class TBearerPriority> const &)
+	?UpdateL@CCmDestinationImpl@@QAEXXZ @ 261 NONAME ; void CCmDestinationImpl::UpdateL(void)
+	?UpdateL@CCmPluginBaseEng@@UAEXXZ @ 262 NONAME ; void CCmPluginBaseEng::UpdateL(void)
+	?UpdateL@RCmConnectionMethodExt@@QAEXXZ @ 263 NONAME ; void RCmConnectionMethodExt::UpdateL(void)
+	?UpdateL@RCmDestinationExt@@QAEXXZ @ 264 NONAME ; void RCmDestinationExt::UpdateL(void)
+	?UpdateListBoxContentL@CmPluginBaseSettingsDlg@@MAEXXZ @ 265 NONAME ; void CmPluginBaseSettingsDlg::UpdateListBoxContentL(void)
+	?UpdateListBoxContentL@CmPluginBaseSettingsDlgAdv@@MAEXXZ @ 266 NONAME ; void CmPluginBaseSettingsDlgAdv::UpdateListBoxContentL(void)
+	?UpdateListBoxContentL@CmPluginBaseSettingsDlgIp@@MAEXXZ @ 267 NONAME ; void CmPluginBaseSettingsDlgIp::UpdateListBoxContentL(void)
+	?UpdateProxyRecordL@CCmPluginBaseEng@@AAEXXZ @ 268 NONAME ABSENT ; void CCmPluginBaseEng::UpdateProxyRecordL(void)
+	?UpdateServiceRecordL@CCmPluginBaseEng@@MAEXXZ @ 269 NONAME ; void CCmPluginBaseEng::UpdateServiceRecordL(void)
+	?WriteDefConnL@RCmManagerExt@@QAEXABUTCmDefConnValue@@@Z @ 270 NONAME ; void RCmManagerExt::WriteDefConnL(struct TCmDefConnValue const &)
+	??0RCmDestination@@QAE@XZ @ 271 NONAME ; RCmDestination::RCmDestination(void)
+	??0RCmDestinationExt@@QAE@XZ @ 272 NONAME ; RCmDestinationExt::RCmDestinationExt(void)
+	??8RCmDestination@@QBEHABV0@@Z @ 273 NONAME ; int RCmDestination::operator==(class RCmDestination const &) const
+	??8RCmDestinationExt@@QBEHABV0@@Z @ 274 NONAME ; int RCmDestinationExt::operator==(class RCmDestinationExt const &) const
+	??9RCmDestination@@QBEHABV0@@Z @ 275 NONAME ; int RCmDestination::operator!=(class RCmDestination const &) const
+	??9RCmDestinationExt@@QBEHABV0@@Z @ 276 NONAME ; int RCmDestinationExt::operator!=(class RCmDestinationExt const &) const
+	??0CCmPluginBase@@QAE@PAVCCmPluginBaseEng@@@Z @ 277 NONAME ; CCmPluginBase::CCmPluginBase(class CCmPluginBaseEng *)
+	??1CCmPluginBase@@UAE@XZ @ 278 NONAME ; CCmPluginBase::~CCmPluginBase(void)
+	?AddResourceFileL@CCmPluginBase@@IAEXABVTDesC16@@@Z @ 279 NONAME ; void CCmPluginBase::AddResourceFileL(class TDesC16 const &)
+	?AllocReadL@CCmPluginBase@@IBEPAVHBufC16@@H@Z @ 280 NONAME ; class HBufC16 * CCmPluginBase::AllocReadL(int) const
+	?CmMgr@CCmPluginBase@@QBEAAVCCmManagerImpl@@XZ @ 281 NONAME ; class CCmManagerImpl & CCmPluginBase::CmMgr(void) const
+	?ConstructL@CCmPluginBase@@IAEXXZ @ 282 NONAME ; void CCmPluginBase::ConstructL(void)
+	?CreateCopyL@CCmPluginBase@@QBEPAV1@XZ @ 283 NONAME ; class CCmPluginBase * CCmPluginBase::CreateCopyL(void) const
+	?CreateNewL@CCmPluginBase@@QAEXXZ @ 284 NONAME ; void CCmPluginBase::CreateNewL(void)
+	?DeleteL@CCmPluginBase@@QAEHHH@Z @ 285 NONAME ; int CCmPluginBase::DeleteL(int, int)
+	?Destination@CCmPluginBase@@QBEPAVCCmDestinationImpl@@XZ @ 286 NONAME ; class CCmDestinationImpl * CCmPluginBase::Destination(void) const
+	?EnableChargeCardL@CCmPluginBase@@AAEXH@Z @ 287 NONAME ; void CCmPluginBase::EnableChargeCardL(int)
+	?EnableLocationL@CCmPluginBase@@AAEXH@Z @ 288 NONAME ; void CCmPluginBase::EnableLocationL(int)
+	?EnableProxyL@CCmPluginBase@@AAEXH@Z @ 289 NONAME ; void CCmPluginBase::EnableProxyL(int)
+	?GetBoolAttributeL@CCmPluginBase@@QBEHK@Z @ 290 NONAME ; int CCmPluginBase::GetBoolAttributeL(unsigned long) const
+	?GetConnectionMethodL@CCmDestinationImpl@@QAEPAVCCmPluginBase@@H@Z @ 291 NONAME ; class CCmPluginBase * CCmDestinationImpl::GetConnectionMethodL(int)
+	?GetConnectionMethodL@CCmManagerImpl@@QAEPAVCCmPluginBase@@K@Z @ 292 NONAME ; class CCmPluginBase * CCmManagerImpl::GetConnectionMethodL(unsigned long)
+	?GetIntAttributeL@CCmPluginBase@@QBEKK@Z @ 293 NONAME ; unsigned long CCmPluginBase::GetIntAttributeL(unsigned long) const
+	?GetString8AttributeL@CCmPluginBase@@QBEPAVHBufC8@@K@Z @ 294 NONAME ; class HBufC8 * CCmPluginBase::GetString8AttributeL(unsigned long) const
+	?GetStringAttributeL@CCmPluginBase@@QBEPAVHBufC16@@K@Z @ 295 NONAME ; class HBufC16 * CCmPluginBase::GetStringAttributeL(unsigned long) const
+	?IAPRecordElementId@CCmPluginBase@@QBEKXZ @ 296 NONAME ; unsigned long CCmPluginBase::IAPRecordElementId(void) const
+	?LoadL@CCmPluginBase@@QAEXK@Z @ 297 NONAME ; void CCmPluginBase::LoadL(unsigned long)
+	?LoadServiceSettingL@CCmPluginBase@@IAEXXZ @ 298 NONAME ; void CCmPluginBase::LoadServiceSettingL(void)
+	?NumOfConnMethodReferencesL@CCmPluginBase@@QAEHXZ @ 299 NONAME ; int CCmPluginBase::NumOfConnMethodReferencesL(void)
+	?ParentDestination@CCmPluginBase@@QBEPAVCCmDestinationImpl@@XZ @ 300 NONAME ; class CCmDestinationImpl * CCmPluginBase::ParentDestination(void) const
+	?Plugin@CCmPluginBase@@QBEPAVCCmPluginBaseEng@@XZ @ 301 NONAME ; class CCmPluginBaseEng * CCmPluginBase::Plugin(void) const
+	?PrepareToLoadRecordsL@CCmPluginBase@@IAEXXZ @ 302 NONAME ; void CCmPluginBase::PrepareToLoadRecordsL(void)
+	?PrepareToUpdateRecordsL@CCmPluginBase@@IAEXXZ @ 303 NONAME ; void CCmPluginBase::PrepareToUpdateRecordsL(void)
+	?RemoveResourceFile@CCmPluginBase@@IAEXABVTDesC16@@@Z @ 304 NONAME ; void CCmPluginBase::RemoveResourceFile(class TDesC16 const &)
+	?RestoreAttributeL@CCmPluginBase@@QAEXK@Z @ 305 NONAME ; void CCmPluginBase::RestoreAttributeL(unsigned long)
+	?Session@CCmPluginBase@@QBEAAVCMDBSession@CommsDat@@XZ @ 306 NONAME ; class CommsDat::CMDBSession & CCmPluginBase::Session(void) const
+	?SetBoolAttributeL@CCmPluginBase@@QAEXKH@Z @ 307 NONAME ; void CCmPluginBase::SetBoolAttributeL(unsigned long, int)
+	?SetIntAttributeL@CCmPluginBase@@QAEXKK@Z @ 308 NONAME ; void CCmPluginBase::SetIntAttributeL(unsigned long, unsigned long)
+	?SetString8AttributeL@CCmPluginBase@@QAEXKABVTDesC8@@@Z @ 309 NONAME ; void CCmPluginBase::SetString8AttributeL(unsigned long, class TDesC8 const &)
+	?SetStringAttributeL@CCmPluginBase@@QAEXKABVTDesC16@@@Z @ 310 NONAME ; void CCmPluginBase::SetStringAttributeL(unsigned long, class TDesC16 const &)
+	?UpdateL@CCmPluginBase@@QAEXXZ @ 311 NONAME ; void CCmPluginBase::UpdateL(void)
+	?UpdateProxyRecordL@CCmPluginBase@@AAEXXZ @ 312 NONAME ; void CCmPluginBase::UpdateProxyRecordL(void)
+	?UpdateServiceRecordL@CCmPluginBase@@IAEXXZ @ 313 NONAME ; void CCmPluginBase::UpdateServiceRecordL(void)
+	??0RCmConnectionMethod@@QAE@XZ @ 314 NONAME ; RCmConnectionMethod::RCmConnectionMethod(void)
+	??0RCmConnectionMethodExt@@QAE@XZ @ 315 NONAME ; RCmConnectionMethodExt::RCmConnectionMethodExt(void)
+	??4RCmConnectionMethod@@QAEAAV0@ABV0@@Z @ 316 NONAME ; class RCmConnectionMethod & RCmConnectionMethod::operator=(class RCmConnectionMethod const &)
+	??4RCmConnectionMethodExt@@QAEAAV0@ABV0@@Z @ 317 NONAME ; class RCmConnectionMethodExt & RCmConnectionMethodExt::operator=(class RCmConnectionMethodExt const &)
+	??8RCmConnectionMethod@@QBEHAAV0@@Z @ 318 NONAME ; int RCmConnectionMethod::operator==(class RCmConnectionMethod &) const
+	??8RCmConnectionMethodExt@@QBEHAAV0@@Z @ 319 NONAME ; int RCmConnectionMethodExt::operator==(class RCmConnectionMethodExt &) const
+	??9RCmConnectionMethod@@QBEHAAV0@@Z @ 320 NONAME ; int RCmConnectionMethod::operator!=(class RCmConnectionMethod &) const
+	??9RCmConnectionMethodExt@@QBEHAAV0@@Z @ 321 NONAME ; int RCmConnectionMethodExt::operator!=(class RCmConnectionMethodExt &) const
+	??1RCmConnectionMethod@@QAE@XZ @ 322 NONAME ; RCmConnectionMethod::~RCmConnectionMethod(void)
+	??1RCmConnectionMethodExt@@QAE@XZ @ 323 NONAME ; RCmConnectionMethodExt::~RCmConnectionMethodExt(void)
+	?ClearDestinationArrayToUse@CCmConnSettingsUiImpl@@QAEXXZ @ 324 NONAME ; void CCmConnSettingsUiImpl::ClearDestinationArrayToUse(void)
+	?SetDestinationArrayToUseL@CCmConnSettingsUiImpl@@QAEXV?$RArray@K@@@Z @ 325 NONAME ; void CCmConnSettingsUiImpl::SetDestinationArrayToUseL(class RArray<unsigned long>)
+	?GetAdditionalUids@CCmPluginBase@@QAEXAAV?$RArray@K@@@Z @ 326 NONAME ; void CCmPluginBase::GetAdditionalUids(class RArray<unsigned long> &)
+	?GetAdditionalUids@CCmPluginBaseEng@@UAEXAAV?$RArray@K@@@Z @ 327 NONAME ; void CCmPluginBaseEng::GetAdditionalUids(class RArray<unsigned long> &)
+	?WrapCmManager@CCmManagerImpl@@QAEXAAVRCmManagerExt@@@Z @ 328 NONAME ; void CCmManagerImpl::WrapCmManager(class RCmManagerExt &)
+	?CombineArraysForPriorityOrderL@CCmManagerImpl@@AAEXAAV?$RPointerArray@VCCmPluginBase@@@@0@Z @ 329 NONAME ; void CCmManagerImpl::CombineArraysForPriorityOrderL(class RPointerArray<class CCmPluginBase> &, class RPointerArray<class CCmPluginBase> &)
+	?CreateFlatCMListL@CCmManagerImpl@@QAEXKAAV?$RPointerArray@VCCmPluginBase@@@@@Z @ 330 NONAME ; void CCmManagerImpl::CreateFlatCMListL(unsigned long, class RPointerArray<class CCmPluginBase> &)
+	?FilterOutVirtualsL@CCmManagerImpl@@QAEXAAV?$RPointerArray@VCCmPluginBase@@@@@Z @ 331 NONAME ; void CCmManagerImpl::FilterOutVirtualsL(class RPointerArray<class CCmPluginBase> &)
+	?CreateFlatCMListLC@CCmManagerImpl@@QAEXKAAV?$RPointerArray@VCCmPluginBase@@@@@Z @ 332 NONAME ; void CCmManagerImpl::CreateFlatCMListLC(unsigned long, class RPointerArray<class CCmPluginBase> &)
+	??0RCmConnectionMethod@@QAE@ABV0@@Z @ 333 NONAME ; RCmConnectionMethod::RCmConnectionMethod(class RCmConnectionMethod const &)
+	??0RCmConnectionMethodExt@@QAE@ABV0@@Z @ 334 NONAME ; RCmConnectionMethodExt::RCmConnectionMethodExt(class RCmConnectionMethodExt const &)
+	?IsLinkedToIap@CCmPluginBase@@QAEHK@Z @ 335 NONAME ; int CCmPluginBase::IsLinkedToIap(unsigned long)
+	?IsLinkedToSnap@CCmPluginBase@@QAEHK@Z @ 336 NONAME ; int CCmPluginBase::IsLinkedToSnap(unsigned long)
+	?ParentDestination@CCmPluginBaseEng@@QBEPAVCCmDestinationImpl@@XZ @ 337 NONAME ; class CCmDestinationImpl * CCmPluginBaseEng::ParentDestination(void) const
+	?CreateTablesAndOpenL@RCmManagerExt@@QAEXXZ @ 338 NONAME ; void RCmManagerExt::CreateTablesAndOpenL(void)
+	?CreateConnectionMethodL@RCmDestinationExt@@QAE?AVRCmConnectionMethodExt@@KK@Z @ 339 NONAME ; class RCmConnectionMethodExt RCmDestinationExt::CreateConnectionMethodL(unsigned long, unsigned long)
+	?CreateConnectionMethodL@RCmManagerExt@@QAE?AVRCmConnectionMethodExt@@KK@Z @ 340 NONAME ; class RCmConnectionMethodExt RCmManagerExt::CreateConnectionMethodL(unsigned long, unsigned long)
+	?CreateDestinationL@RCmManagerExt@@QAE?AVRCmDestinationExt@@ABVTDesC16@@K@Z @ 341 NONAME ; class RCmDestinationExt RCmManagerExt::CreateDestinationL(class TDesC16 const &, unsigned long)
+	?SetPreDefinedId@CCmPluginBaseEng@@QAEXK@Z @ 342 NONAME ; void CCmPluginBaseEng::SetPreDefinedId(unsigned long)
+	?HandleResourceChange@CmPluginBaseSettingsDlg@@UAEXH@Z @ 343 NONAME ; void CmPluginBaseSettingsDlg::HandleResourceChange(int)
+	?Execute@CmPluginBaseSettingsDlg@@UAEXXZ @ 344 NONAME ; void CmPluginBaseSettingsDlg::Execute(void)
+	?CheckSpaceBelowCriticalLevelL@CCmPluginBaseEng@@QBEHXZ @ 345 NONAME ; int CCmPluginBaseEng::CheckSpaceBelowCriticalLevelL(void) const
+	?HandleLeaveError@CmPluginBaseSettingsDlg@@UAEXH@Z @ 346 NONAME ; void CmPluginBaseSettingsDlg::HandleLeaveError(int)
+	?AddConnectionMethodL@RCmDestination@@QAEHVRCmConnectionMethod@@@Z @ 347 NONAME ; int RCmDestination::AddConnectionMethodL(class RCmConnectionMethod)
+	?AddEmbeddedDestinationL@RCmDestination@@QAEHABV1@@Z @ 348 NONAME ; int RCmDestination::AddEmbeddedDestinationL(class RCmDestination const &)
+	?CopyConnectionMethodL@RCmManager@@QAEHAAVRCmDestination@@AAVRCmConnectionMethod@@@Z @ 349 NONAME ; int RCmManager::CopyConnectionMethodL(class RCmDestination &, class RCmConnectionMethod &)
+	?CreateConnectionMethodL@RCmDestination@@QAE?AVRCmConnectionMethod@@K@Z @ 350 NONAME ; class RCmConnectionMethod RCmDestination::CreateConnectionMethodL(unsigned long)
+	?CreateConnectionMethodL@RCmDestination@@QAE?AVRCmConnectionMethod@@KK@Z @ 351 NONAME ; class RCmConnectionMethod RCmDestination::CreateConnectionMethodL(unsigned long, unsigned long)
+	?CreateConnectionMethodL@RCmManager@@QAE?AVRCmConnectionMethod@@K@Z @ 352 NONAME ; class RCmConnectionMethod RCmManager::CreateConnectionMethodL(unsigned long)
+	?CreateConnectionMethodL@RCmManager@@QAE?AVRCmConnectionMethod@@KK@Z @ 353 NONAME ; class RCmConnectionMethod RCmManager::CreateConnectionMethodL(unsigned long, unsigned long)
+	?CreateCopyL@RCmConnectionMethod@@QAE?AV1@XZ @ 354 NONAME ; class RCmConnectionMethod RCmConnectionMethod::CreateCopyL(void)
+	?CreateDestinationL@RCmManager@@QAE?AVRCmDestination@@ABVTDesC16@@@Z @ 355 NONAME ; class RCmDestination RCmManager::CreateDestinationL(class TDesC16 const &)
+	?CreateDestinationL@RCmManager@@QAE?AVRCmDestination@@ABVTDesC16@@K@Z @ 356 NONAME ; class RCmDestination RCmManager::CreateDestinationL(class TDesC16 const &, unsigned long)
+	?CreateTablesAndOpenL@RCmManager@@QAEXXZ @ 357 NONAME ; void RCmManager::CreateTablesAndOpenL(void)
+	?DeleteConnectionMethodL@RCmDestination@@QAEXAAVRCmConnectionMethod@@@Z @ 358 NONAME ; void RCmDestination::DeleteConnectionMethodL(class RCmConnectionMethod &)
+	?DeleteL@RCmConnectionMethod@@QAEHXZ @ 359 NONAME ; int RCmConnectionMethod::DeleteL(void)
+	?DeleteLD@RCmDestination@@QAEXXZ @ 360 NONAME ; void RCmDestination::DeleteLD(void)
+	?ModifyPriorityL@RCmDestination@@QAEXAAVRCmConnectionMethod@@I@Z @ 361 NONAME ; void RCmDestination::ModifyPriorityL(class RCmConnectionMethod &, unsigned int)
+	?MoveConnectionMethodL@RCmManager@@QAEHAAVRCmDestination@@0AAVRCmConnectionMethod@@@Z @ 362 NONAME ; int RCmManager::MoveConnectionMethodL(class RCmDestination &, class RCmDestination &, class RCmConnectionMethod &)
+	?RemoveAllReferencesL@RCmManager@@QAEXAAVRCmConnectionMethod@@@Z @ 363 NONAME ; void RCmManager::RemoveAllReferencesL(class RCmConnectionMethod &)
+	?RemoveConnectionMethodL@RCmDestination@@QAEXVRCmConnectionMethod@@@Z @ 364 NONAME ; void RCmDestination::RemoveConnectionMethodL(class RCmConnectionMethod)
+	?RemoveConnectionMethodL@RCmManager@@QAEXAAVRCmDestination@@AAVRCmConnectionMethod@@@Z @ 365 NONAME ; void RCmManager::RemoveConnectionMethodL(class RCmDestination &, class RCmConnectionMethod &)
+	?SetBoolAttributeL@RCmConnectionMethod@@QAEXKH@Z @ 366 NONAME ; void RCmConnectionMethod::SetBoolAttributeL(unsigned long, int)
+	?SetHiddenL@RCmDestination@@QAEXH@Z @ 367 NONAME ; void RCmDestination::SetHiddenL(int)
+	?SetIconL@RCmDestination@@QAEXK@Z @ 368 NONAME ; void RCmDestination::SetIconL(unsigned long)
+	?SetIntAttributeL@RCmConnectionMethod@@QAEXKK@Z @ 369 NONAME ; void RCmConnectionMethod::SetIntAttributeL(unsigned long, unsigned long)
+	?SetMetadataL@RCmDestination@@QAEXW4TSnapMetadataField@CMManager@@K@Z @ 370 NONAME ; void RCmDestination::SetMetadataL(enum CMManager::TSnapMetadataField, unsigned long)
+	?SetNameL@RCmDestination@@QAEXABVTDesC16@@@Z @ 371 NONAME ; void RCmDestination::SetNameL(class TDesC16 const &)
+	?SetProtectionL@RCmDestination@@QAEXW4TProtectionLevel@CMManager@@@Z @ 372 NONAME ; void RCmDestination::SetProtectionL(enum CMManager::TProtectionLevel)
+	?SetString8AttributeL@RCmConnectionMethod@@QAEXKABVTDesC8@@@Z @ 373 NONAME ; void RCmConnectionMethod::SetString8AttributeL(unsigned long, class TDesC8 const &)
+	?SetStringAttributeL@RCmConnectionMethod@@QAEXKABVTDesC16@@@Z @ 374 NONAME ; void RCmConnectionMethod::SetStringAttributeL(unsigned long, class TDesC16 const &)
+	?SupportedBearersL@RCmManager@@QBEXAAV?$RArray@K@@@Z @ 375 NONAME ; void RCmManager::SupportedBearersL(class RArray<unsigned long> &) const
+	?UncategorizedIconL@RCmManager@@QBEPAVCGulIcon@@XZ @ 376 NONAME ; class CGulIcon * RCmManager::UncategorizedIconL(void) const
+	?UpdateBearerPriorityArrayL@RCmManager@@QAEXABV?$RArray@VTBearerPriority@@@@@Z @ 377 NONAME ; void RCmManager::UpdateBearerPriorityArrayL(class RArray<class TBearerPriority> const &)
+	?UpdateL@RCmConnectionMethod@@QAEXXZ @ 378 NONAME ; void RCmConnectionMethod::UpdateL(void)
+	?UpdateL@RCmDestination@@QAEXXZ @ 379 NONAME ; void RCmDestination::UpdateL(void)
+	?WriteDefConnL@RCmManager@@QAEXABUTCmDefConnValue@@@Z @ 380 NONAME ; void RCmManager::WriteDefConnL(struct TCmDefConnValue const &)
+	?WriteGenConnSettingsL@RCmManager@@QAEXABUTCmGenConnSettings@@@Z @ 381 NONAME ; void RCmManager::WriteGenConnSettingsL(struct TCmGenConnSettings const &)
+	?ReadGenConnSettingsL@RCmManager@@QAEXAAUTCmGenConnSettings@@@Z @ 382 NONAME ; void RCmManager::ReadGenConnSettingsL(struct TCmGenConnSettings &)
+	?WatcherRegisterL@CCmManagerImpl@@QAEXPAVMCmCommsDatWatcher@@@Z @ 383 NONAME ; void CCmManagerImpl::WatcherRegisterL(class MCmCommsDatWatcher *)
+	?DestinationStillExistedL@CCmManagerImpl@@QAEHPAVCCmDestinationImpl@@@Z @ 384 NONAME ; int CCmManagerImpl::DestinationStillExistedL(class CCmDestinationImpl *)
+	?IsIapStillInDestL@CCmManagerImpl@@QAEHPAVCCmDestinationImpl@@ABVCCmPluginBaseEng@@@Z @ 385 NONAME ; int CCmManagerImpl::IsIapStillInDestL(class CCmDestinationImpl *, class CCmPluginBaseEng const &)
+	?IapStillExistedL@CCmManagerImpl@@QAEHABVCCmPluginBaseEng@@@Z @ 386 NONAME ; int CCmManagerImpl::IapStillExistedL(class CCmPluginBaseEng const &)
+	?WatcherUnRegister@CCmManagerImpl@@QAEXXZ @ 387 NONAME ; void CCmManagerImpl::WatcherUnRegister(void)
+	?RemoveDestFromPool@CCmManagerImpl@@QAEXPAVCCmDestinationImpl@@@Z @ 388 NONAME ; void CCmManagerImpl::RemoveDestFromPool(class CCmDestinationImpl *)
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/EABI/CmManager_prot_setupU.def	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,437 @@
+EXPORTS
+	_Z18CheckIPv4ValidityLP16CCmPluginBaseEngmPKv @ 1 NONAME
+	_Z18CheckIPv6ValidityLP16CCmPluginBaseEngmPKv @ 2 NONAME
+	_Z18ReadOnlyAttributeLP16CCmPluginBaseEngmPKv @ 3 NONAME
+	_Z19ClassifyIPv6AddressRK7TDesC16 @ 4 NONAME
+	_Z19SetProxyServerNameLP16CCmPluginBaseEngmPKv @ 5 NONAME
+	_Z22CheckRecordIdValidityLP16CCmPluginBaseEngmPKv @ 6 NONAME
+	_Z24CheckPortNumberValidityLP16CCmPluginBaseEngmPKv @ 7 NONAME
+	_Z24IsUnspecifiedIPv4AddressRK7TDesC16 @ 8 NONAME
+	_Z26CheckWAPWspOptionValidityLP16CCmPluginBaseEngmPKv @ 9 NONAME
+	_ZN10RCmManager12ReadDefConnLER15TCmDefConnValue @ 10 NONAME
+	_ZN10RCmManager5CloseEv @ 11 NONAME
+	_ZN10RCmManager5OpenLEv @ 12 NONAME
+	_ZN10RCmManager6OpenLCEv @ 13 NONAME
+	_ZN11TCmCommonUi14ShowPopupListLERK7TDesC16P16CDesC16ArrayFlatP9CArrayPtrI8CGulIconEjRi @ 14 NONAME
+	_ZN11TCmCommonUi22ShowConfirmationQueryLEi @ 15 NONAME
+	_ZN11TCmCommonUi22ShowConfirmationQueryLEiRK7TDesC16 @ 16 NONAME
+	_ZN11TCmCommonUi31ShowConfirmationQueryWithInputLEiR6TDes16 @ 17 NONAME
+	_ZN11TCmCommonUi9ShowNoteLERK7TDesC16NS_11TCmNoteTypeE @ 18 NONAME
+	_ZN11TCmCommonUi9ShowNoteLEiNS_11TCmNoteTypeE @ 19 NONAME
+	_ZN11TCmCommonUi9ShowNoteLEiRK7TDesC16NS_11TCmNoteTypeE @ 20 NONAME
+	_ZN13CCmSettingsUi12RunSettingsLEv @ 21 NONAME
+	_ZN13CCmSettingsUi21SelectDestinationDlgLERm @ 22 NONAME
+	_ZN13CCmSettingsUi4NewLEv @ 23 NONAME
+	_ZN13CCmSettingsUiD0Ev @ 24 NONAME
+	_ZN13CCmSettingsUiD1Ev @ 25 NONAME
+	_ZN13CCmSettingsUiD2Ev @ 26 NONAME
+	_ZN13RCmManagerExt11EasyWlanIdLEv @ 27 NONAME
+	_ZN13RCmManagerExt12DestinationLEm @ 28 NONAME
+	_ZN13RCmManagerExt12ReadDefConnLER15TCmDefConnValue @ 29 NONAME
+	_ZN13RCmManagerExt13WriteDefConnLERK15TCmDefConnValue @ 30 NONAME
+	_ZN13RCmManagerExt16AllDestinationsLER6RArrayImE @ 31 NONAME
+	_ZN13RCmManagerExt17ConnectionMethodLER6RArrayImEiii @ 32 NONAME
+	_ZN13RCmManagerExt17ConnectionMethodLEm @ 33 NONAME
+	_ZN13RCmManagerExt18CreateDestinationLERK7TDesC16 @ 34 NONAME
+	_ZN13RCmManagerExt20RemoveAllReferencesLER22RCmConnectionMethodExt @ 35 NONAME
+	_ZN13RCmManagerExt21CopyConnectionMethodLER17RCmDestinationExtR22RCmConnectionMethodExt @ 36 NONAME
+	_ZN13RCmManagerExt21MoveConnectionMethodLER17RCmDestinationExtS1_R22RCmConnectionMethodExt @ 37 NONAME
+	_ZN13RCmManagerExt23CreateConnectionMethodLEm @ 38 NONAME
+	_ZN13RCmManagerExt23RemoveConnectionMethodLER17RCmDestinationExtR22RCmConnectionMethodExt @ 39 NONAME
+	_ZN13RCmManagerExt26UpdateBearerPriorityArrayLERK6RArrayI15TBearerPriorityE @ 40 NONAME
+	_ZN13RCmManagerExt5CloseEv @ 41 NONAME
+	_ZN13RCmManagerExt5OpenLEv @ 42 NONAME
+	_ZN13RCmManagerExt6OpenLCEv @ 43 NONAME
+	_ZN14CCmManagerImpl11EasyWlanIdLEv @ 44 NONAME
+	_ZN14CCmManagerImpl12DestinationLEm @ 45 NONAME
+	_ZN14CCmManagerImpl16AllDestinationsLER6RArrayImE @ 46 NONAME
+	_ZN14CCmManagerImpl17ConnectionMethodLER6RArrayImEiiii @ 47 NONAME
+	_ZN14CCmManagerImpl17ConnectionMethodLEm @ 48 NONAME
+	_ZN14RCmDestination5CloseEv @ 49 NONAME
+	_ZN14RCmDestinationC1ERKS_ @ 50 NONAME
+	_ZN14RCmDestinationC2ERKS_ @ 51 NONAME
+	_ZN14RCmDestinationD1Ev @ 52 NONAME
+	_ZN14RCmDestinationD2Ev @ 53 NONAME
+	_ZN14RCmDestinationaSERKS_ @ 54 NONAME
+	_ZN16CCmPluginBaseEng10ConstructLEv @ 55 NONAME
+	_ZN16CCmPluginBaseEng10CreateNewLEv @ 56 NONAME
+	_ZN16CCmPluginBaseEng12EnableProxyLEi @ 57 NONAME ABSENT
+	_ZN16CCmPluginBaseEng13ConvTableItemEm @ 58 NONAME
+	_ZN16CCmPluginBaseEng15EnableLocationLEi @ 59 NONAME ABSENT
+	_ZN16CCmPluginBaseEng16AddResourceFileLERK7TDesC16 @ 60 NONAME
+	_ZN16CCmPluginBaseEng16FeatureSupportedEi @ 61 NONAME
+	_ZN16CCmPluginBaseEng16SetIntAttributeLEmm @ 62 NONAME
+	_ZN16CCmPluginBaseEng17EnableChargeCardLEi @ 63 NONAME ABSENT
+	_ZN16CCmPluginBaseEng17RestoreAttributeLEm @ 64 NONAME
+	_ZN16CCmPluginBaseEng17SetBoolAttributeLEmi @ 65 NONAME
+	_ZN16CCmPluginBaseEng18RemoveResourceFileERK7TDesC16 @ 66 NONAME
+	_ZN16CCmPluginBaseEng18UpdateProxyRecordLEv @ 67 NONAME ABSENT
+	_ZN16CCmPluginBaseEng19LoadServiceSettingLEv @ 68 NONAME
+	_ZN16CCmPluginBaseEng19SetStringAttributeLEmRK7TDesC16 @ 69 NONAME
+	_ZN16CCmPluginBaseEng20AddConverstionTableLEPPN8CommsDat13CCDRecordBaseEPiPK18TCmAttribConvTable @ 70 NONAME
+	_ZN16CCmPluginBaseEng20SetDNSServerAddressLEmRK7TDesC16mS2_mi @ 71 NONAME
+	_ZN16CCmPluginBaseEng20SetString8AttributeLEmRK6TDesC8 @ 72 NONAME
+	_ZN16CCmPluginBaseEng20UpdateServiceRecordLEv @ 73 NONAME
+	_ZN16CCmPluginBaseEng21PrepareToLoadRecordsLEv @ 74 NONAME
+	_ZN16CCmPluginBaseEng21RemoveConversionTableEPK18TCmAttribConvTable @ 75 NONAME
+	_ZN16CCmPluginBaseEng22CheckDNSServerAddressLEiRN8CommsDat9CMDBFieldI7TDesC16EES4_RNS1_IiEE @ 76 NONAME
+	_ZN16CCmPluginBaseEng23PrepareToUpdateRecordsLEv @ 77 NONAME
+	_ZN16CCmPluginBaseEng25AddCommonConversionTableLEPK26TCmCommonAttrConvArrayItem @ 78 NONAME
+	_ZN16CCmPluginBaseEng26NumOfConnMethodReferencesLEv @ 79 NONAME
+	_ZN16CCmPluginBaseEng27RemoveCommonConversionTableEPK26TCmCommonAttrConvArrayItem @ 80 NONAME
+	_ZN16CCmPluginBaseEng5LoadLEm @ 81 NONAME
+	_ZN16CCmPluginBaseEng5ResetEv @ 82 NONAME
+	_ZN16CCmPluginBaseEng7DeleteLEii @ 83 NONAME
+	_ZN16CCmPluginBaseEng7UpdateLEv @ 84 NONAME
+	_ZN16CCmPluginBaseEngC2EP18TCmPluginInitParam @ 85 NONAME
+	_ZN16CCmPluginBaseEngD0Ev @ 86 NONAME
+	_ZN16CCmPluginBaseEngD1Ev @ 87 NONAME
+	_ZN16CCmPluginBaseEngD2Ev @ 88 NONAME
+	_ZN16CCmPluginLanBase10ConstructLEv @ 89 NONAME
+	_ZN16CCmPluginLanBase12RunSettingsLEv @ 90 NONAME
+	_ZN16CCmPluginLanBase16BearerRecordIdLCERP7HBufC16Rm @ 91 NONAME
+	_ZN16CCmPluginLanBase17InitializeWithUiLEi @ 92 NONAME
+	_ZN16CCmPluginLanBase17ServiceRecordIdLCERP7HBufC16Rm @ 93 NONAME
+	_ZN16CCmPluginLanBase19LoadServiceSettingLEv @ 94 NONAME
+	_ZN16CCmPluginLanBase23CreateNewServiceRecordLEv @ 95 NONAME
+	_ZN16CCmPluginLanBase23PrepareToUpdateRecordsLEv @ 96 NONAME
+	_ZN16CCmPluginLanBaseC2EP18TCmPluginInitParam @ 97 NONAME
+	_ZN16CCmPluginLanBaseD0Ev @ 98 NONAME
+	_ZN16CCmPluginLanBaseD1Ev @ 99 NONAME
+	_ZN16CCmPluginLanBaseD2Ev @ 100 NONAME
+	_ZN17RCmDestinationExt10SetHiddenLEi @ 101 NONAME
+	_ZN17RCmDestinationExt12SetMetadataLEN9CMManager18TSnapMetadataFieldEm @ 102 NONAME
+	_ZN17RCmDestinationExt14SetProtectionLEN9CMManager16TProtectionLevelE @ 103 NONAME
+	_ZN17RCmDestinationExt15ModifyPriorityLER22RCmConnectionMethodExtj @ 104 NONAME
+	_ZN17RCmDestinationExt15ProtectionLevelEv @ 105 NONAME
+	_ZN17RCmDestinationExt17ConnectionMethodLEi @ 106 NONAME
+	_ZN17RCmDestinationExt20AddConnectionMethodLE22RCmConnectionMethodExt @ 107 NONAME
+	_ZN17RCmDestinationExt21ConnectionMethodByIDLEi @ 108 NONAME
+	_ZN17RCmDestinationExt21ConnectionMethodCountEv @ 109 NONAME
+	_ZN17RCmDestinationExt23AddEmbeddedDestinationLERKS_ @ 110 NONAME
+	_ZN17RCmDestinationExt23CreateConnectionMethodLEm @ 111 NONAME
+	_ZN17RCmDestinationExt23DeleteConnectionMethodLER22RCmConnectionMethodExt @ 112 NONAME
+	_ZN17RCmDestinationExt23RemoveConnectionMethodLE22RCmConnectionMethodExt @ 113 NONAME
+	_ZN17RCmDestinationExt2IdEv @ 114 NONAME
+	_ZN17RCmDestinationExt5CloseEv @ 115 NONAME
+	_ZN17RCmDestinationExt5IconLEv @ 116 NONAME
+	_ZN17RCmDestinationExt6NameLCEv @ 117 NONAME
+	_ZN17RCmDestinationExt7UpdateLEv @ 118 NONAME
+	_ZN17RCmDestinationExt8DeleteLDEv @ 119 NONAME
+	_ZN17RCmDestinationExt8IsHiddenEv @ 120 NONAME
+	_ZN17RCmDestinationExt8SetIconLEm @ 121 NONAME
+	_ZN17RCmDestinationExt8SetNameLERK7TDesC16 @ 122 NONAME
+	_ZN17RCmDestinationExt9ElementIdEv @ 123 NONAME
+	_ZN17RCmDestinationExt9PriorityLERK22RCmConnectionMethodExt @ 124 NONAME
+	_ZN17RCmDestinationExtC1ERKS_ @ 125 NONAME
+	_ZN17RCmDestinationExtC2ERKS_ @ 126 NONAME
+	_ZN17RCmDestinationExtD1Ev @ 127 NONAME
+	_ZN17RCmDestinationExtD2Ev @ 128 NONAME
+	_ZN17RCmDestinationExtaSERKS_ @ 129 NONAME
+	_ZN18CCmDestinationImpl10SetHiddenLEi @ 130 NONAME
+	_ZN18CCmDestinationImpl14RemoveFromPoolEv @ 131 NONAME
+	_ZN18CCmDestinationImpl14SetProtectionLEN9CMManager16TProtectionLevelE @ 132 NONAME
+	_ZN18CCmDestinationImpl15ProtectionLevelEv @ 133 NONAME
+	_ZN18CCmDestinationImpl17ConnectionMethodLEi @ 134 NONAME
+	_ZN18CCmDestinationImpl21ConnectionMethodCountEv @ 135 NONAME
+	_ZN18CCmDestinationImpl4NewLER14CCmManagerImplRK7TDesC16 @ 136 NONAME
+	_ZN18CCmDestinationImpl4NewLER14CCmManagerImplj @ 137 NONAME
+	_ZN18CCmDestinationImpl5IconLEv @ 138 NONAME
+	_ZN18CCmDestinationImpl6NameLCEv @ 139 NONAME
+	_ZN18CCmDestinationImpl7UpdateLEv @ 140 NONAME
+	_ZN18CCmDestinationImpl8DeleteLDEv @ 141 NONAME
+	_ZN18CCmDestinationImpl8IsHiddenEv @ 142 NONAME
+	_ZN18CCmDestinationImpl8SetNameLERK7TDesC16 @ 143 NONAME
+	_ZN18CCmDestinationImpl9PriorityLER16CCmPluginBaseEng @ 144 NONAME ABSENT
+	_ZN19RCmConnectionMethod5CloseEv @ 145 NONAME
+	_ZN21CCmConnSettingsUiImpl23RunApplicationSettingsLER19TCmSettingSelectionjR6RArrayImE @ 146 NONAME
+	_ZN21CCmConnSettingsUiImpl4NewLEP14CCmManagerImpl @ 147 NONAME
+	_ZN21CCmTransactionHandler5CloseEv @ 148 NONAME ABSENT
+	_ZN22RCmConnectionMethodExt11CreateCopyLEv @ 149 NONAME
+	_ZN22RCmConnectionMethodExt16SetIntAttributeLEmm @ 150 NONAME
+	_ZN22RCmConnectionMethodExt17SetBoolAttributeLEmi @ 151 NONAME
+	_ZN22RCmConnectionMethodExt19SetStringAttributeLEmRK7TDesC16 @ 152 NONAME
+	_ZN22RCmConnectionMethodExt20SetString8AttributeLEmRK6TDesC8 @ 153 NONAME
+	_ZN22RCmConnectionMethodExt5CloseEv @ 154 NONAME
+	_ZN22RCmConnectionMethodExt7DeleteLEv @ 155 NONAME
+	_ZN22RCmConnectionMethodExt7UpdateLEv @ 156 NONAME
+	_ZN23CmPluginBaseSettingsDlg10InitTextsLEv @ 157 NONAME
+	_ZN23CmPluginBaseSettingsDlg10SelectItemEi @ 158 NONAME
+	_ZN23CmPluginBaseSettingsDlg13LoadResourceLERK7TDesC16 @ 159 NONAME
+	_ZN23CmPluginBaseSettingsDlg15GetIPv6DNSTypeLEmm @ 160 NONAME
+	_ZN23CmPluginBaseSettingsDlg15ProcessCommandLEi @ 161 NONAME
+	_ZN23CmPluginBaseSettingsDlg16DynInitMenuPaneLEiP12CEikMenuPane @ 162 NONAME
+	_ZN23CmPluginBaseSettingsDlg17ConstructAndRunLDEv @ 163 NONAME
+	_ZN23CmPluginBaseSettingsDlg17PreLayoutDynInitLEv @ 164 NONAME
+	_ZN23CmPluginBaseSettingsDlg19AppendSettingTextsLER12CDesC16ArrayiPK7HBufC16 @ 165 NONAME
+	_ZN23CmPluginBaseSettingsDlg19AppendSettingTextsLER12CDesC16Arrayii @ 166 NONAME
+	_ZN23CmPluginBaseSettingsDlg19HandleListBoxEventLEP11CEikListBoxN19MEikListBoxObserver13TListBoxEventE @ 167 NONAME
+	_ZN23CmPluginBaseSettingsDlg21ShowPopupSettingPageLEmi @ 168 NONAME
+	_ZN23CmPluginBaseSettingsDlg21UpdateListBoxContentLEv @ 169 NONAME
+	_ZN23CmPluginBaseSettingsDlg23ShowPopupIPv4DNSEditorLEmmmm @ 170 NONAME
+	_ZN23CmPluginBaseSettingsDlg23ShowPopupIPv6DNSEditorLEPKmmmm @ 171 NONAME
+	_ZN23CmPluginBaseSettingsDlg23ShowPopupIpSettingPageLEmm @ 172 NONAME
+	_ZN23CmPluginBaseSettingsDlg24HandleListboxDataChangeLEv @ 173 NONAME
+	_ZN23CmPluginBaseSettingsDlg25ShowPopupTextSettingPageLEmm @ 174 NONAME
+	_ZN23CmPluginBaseSettingsDlg27ShowRadioButtonSettingPageLEPKmRim @ 175 NONAME
+	_ZN23CmPluginBaseSettingsDlg27ShowRadioButtonSettingPageLER16CDesC16ArrayFlatRim @ 176 NONAME
+	_ZN23CmPluginBaseSettingsDlg27StringAttributeWithDefaultLEmm @ 177 NONAME
+	_ZN23CmPluginBaseSettingsDlg28ShowPopupPortNumSettingPageLEmm @ 178 NONAME
+	_ZN23CmPluginBaseSettingsDlg29ShowPopupPasswordSettingPageLEmm @ 179 NONAME
+	_ZN23CmPluginBaseSettingsDlg9OkToExitLEi @ 180 NONAME
+	_ZN23CmPluginBaseSettingsDlgC2ER16CCmPluginBaseEng @ 181 NONAME
+	_ZN23CmPluginBaseSettingsDlgD0Ev @ 182 NONAME
+	_ZN23CmPluginBaseSettingsDlgD1Ev @ 183 NONAME
+	_ZN23CmPluginBaseSettingsDlgD2Ev @ 184 NONAME
+	_ZN24CCmApplicationSettingsUi23RunApplicationSettingsLER19TCmSettingSelection @ 185 NONAME
+	_ZN24CCmApplicationSettingsUi23RunApplicationSettingsLER19TCmSettingSelectionjR6RArrayImE @ 186 NONAME
+	_ZN24CCmApplicationSettingsUi4NewLEv @ 187 NONAME
+	_ZN24CCmApplicationSettingsUi5NewLCEv @ 188 NONAME
+	_ZN24CCmApplicationSettingsUiD0Ev @ 189 NONAME
+	_ZN24CCmApplicationSettingsUiD1Ev @ 190 NONAME
+	_ZN24CCmApplicationSettingsUiD2Ev @ 191 NONAME
+	_ZN24CCmPluginMultiLineDialog4NewLER6TDes16S1_N15CAknQueryDialog5TToneE @ 192 NONAME
+	_ZN25CmPluginBaseSettingsDlgIp16DynInitMenuPaneLEiP12CEikMenuPane @ 193 NONAME
+	_ZN25CmPluginBaseSettingsDlgIp20RunAdvancedSettingsLEv @ 194 NONAME
+	_ZN25CmPluginBaseSettingsDlgIp21UpdateListBoxContentLEv @ 195 NONAME
+	_ZN25CmPluginBaseSettingsDlgIpC1ER16CCmPluginBaseEng @ 196 NONAME
+	_ZN25CmPluginBaseSettingsDlgIpC2ER16CCmPluginBaseEng @ 197 NONAME
+	_ZN25CmPluginBaseSettingsDlgIpD0Ev @ 198 NONAME
+	_ZN25CmPluginBaseSettingsDlgIpD1Ev @ 199 NONAME
+	_ZN25CmPluginBaseSettingsDlgIpD2Ev @ 200 NONAME
+	_ZN26CmPluginBaseSettingsDlgAdv16DynInitMenuPaneLEiP12CEikMenuPane @ 201 NONAME
+	_ZN26CmPluginBaseSettingsDlgAdv20RunAdvancedSettingsLEv @ 202 NONAME
+	_ZN26CmPluginBaseSettingsDlgAdv21ShowPopupSettingPageLEii @ 203 NONAME
+	_ZN26CmPluginBaseSettingsDlgAdv21UpdateListBoxContentLEv @ 204 NONAME
+	_ZN26CmPluginBaseSettingsDlgAdvC1ER16CCmPluginBaseEng @ 205 NONAME
+	_ZN26CmPluginBaseSettingsDlgAdvC2ER16CCmPluginBaseEng @ 206 NONAME
+	_ZN26CmPluginBaseSettingsDlgAdvD0Ev @ 207 NONAME
+	_ZN26CmPluginBaseSettingsDlgAdvD1Ev @ 208 NONAME
+	_ZN26CmPluginBaseSettingsDlgAdvD2Ev @ 209 NONAME
+	_ZN28CCmApplicationSettingsUiImpl23RunApplicationSettingsLER19TCmSettingSelection @ 210 NONAME
+	_ZN28CCmApplicationSettingsUiImpl4NewLEv @ 211 NONAME
+	_ZNK10RCmManager11EasyWlanIdLEv @ 212 NONAME
+	_ZNK10RCmManager12DestinationLEm @ 213 NONAME
+	_ZNK10RCmManager16AllDestinationsLER6RArrayImE @ 214 NONAME
+	_ZNK10RCmManager17ConnectionMethodLER6RArrayImEiii @ 215 NONAME
+	_ZNK10RCmManager17ConnectionMethodLEm @ 216 NONAME
+	_ZNK10RCmManager17GetBearerInfoIntLEmm @ 217 NONAME
+	_ZNK10RCmManager18GetBearerInfoBoolLEmm @ 218 NONAME
+	_ZNK10RCmManager20BearerPriorityArrayLER6RArrayI15TBearerPriorityE @ 219 NONAME
+	_ZNK10RCmManager20GetBearerInfoStringLEmm @ 220 NONAME
+	_ZNK10RCmManager21GetBearerInfoString8LEmm @ 221 NONAME
+	_ZNK10RCmManager26CleanupGlobalPriorityArrayER6RArrayI15TBearerPriorityE @ 222 NONAME
+	_ZNK10RCmManager27GetConnectionMethodInfoIntLEmm @ 223 NONAME
+	_ZNK10RCmManager28GetConnectionMethodInfoBoolLEmm @ 224 NONAME
+	_ZNK10RCmManager30GetConnectionMethodInfoStringLEmm @ 225 NONAME
+	_ZNK10RCmManager31GetConnectionMethodInfoString8LEmm @ 226 NONAME
+	_ZNK13RCmManagerExt17GetBearerInfoIntLEmm @ 227 NONAME
+	_ZNK13RCmManagerExt17SupportedBearersLER6RArrayImE @ 228 NONAME
+	_ZNK13RCmManagerExt18GetBearerInfoBoolLEmm @ 229 NONAME
+	_ZNK13RCmManagerExt18UncategorizedIconLEv @ 230 NONAME
+	_ZNK13RCmManagerExt20BearerPriorityArrayLER6RArrayI15TBearerPriorityE @ 231 NONAME
+	_ZNK13RCmManagerExt20GetBearerInfoStringLEmm @ 232 NONAME
+	_ZNK13RCmManagerExt21GetBearerInfoString8LEmm @ 233 NONAME
+	_ZNK13RCmManagerExt26CleanupGlobalPriorityArrayER6RArrayI15TBearerPriorityE @ 234 NONAME
+	_ZNK13RCmManagerExt27GetConnectionMethodInfoIntLEmm @ 235 NONAME
+	_ZNK13RCmManagerExt28GetConnectionMethodInfoBoolLEmm @ 236 NONAME
+	_ZNK13RCmManagerExt30GetConnectionMethodInfoStringLEmm @ 237 NONAME
+	_ZNK13RCmManagerExt31GetConnectionMethodInfoString8LEmm @ 238 NONAME
+	_ZNK14CCmManagerImpl17GetBearerInfoIntLEmm @ 239 NONAME
+	_ZNK14CCmManagerImpl18GetBearerInfoBoolLEmm @ 240 NONAME
+	_ZNK14CCmManagerImpl20GetBearerInfoStringLEmm @ 241 NONAME
+	_ZNK14CCmManagerImpl21GetBearerInfoString8LEmm @ 242 NONAME
+	_ZNK14CCmManagerImpl27GetConnectionMethodInfoIntLEmm @ 243 NONAME
+	_ZNK14CCmManagerImpl28GetConnectionMethodInfoBoolLEmm @ 244 NONAME
+	_ZNK14CCmManagerImpl30GetConnectionMethodInfoStringLEmm @ 245 NONAME
+	_ZNK14CCmManagerImpl31GetConnectionMethodInfoString8LEmm @ 246 NONAME
+	_ZNK14RCmDestination12IsConnectedLEv @ 247 NONAME
+	_ZNK14RCmDestination15ProtectionLevelEv @ 248 NONAME
+	_ZNK14RCmDestination17ConnectionMethodLEi @ 249 NONAME
+	_ZNK14RCmDestination21ConnectionMethodByIDLEi @ 250 NONAME
+	_ZNK14RCmDestination21ConnectionMethodCountEv @ 251 NONAME
+	_ZNK14RCmDestination2IdEv @ 252 NONAME
+	_ZNK14RCmDestination5IconLEv @ 253 NONAME
+	_ZNK14RCmDestination6NameLCEv @ 254 NONAME
+	_ZNK14RCmDestination8IsHiddenEv @ 255 NONAME
+	_ZNK14RCmDestination9ElementIdEv @ 256 NONAME
+	_ZNK14RCmDestination9MetadataLEN9CMManager18TSnapMetadataFieldE @ 257 NONAME
+	_ZNK14RCmDestination9PriorityLERK19RCmConnectionMethod @ 258 NONAME
+	_ZNK16CCmPluginBaseEng10AllocReadLEi @ 259 NONAME
+	_ZNK16CCmPluginBaseEng11CreateCopyLEv @ 260 NONAME
+	_ZNK16CCmPluginBaseEng11DestinationEv @ 261 NONAME
+	_ZNK16CCmPluginBaseEng16GetIntAttributeLEm @ 262 NONAME
+	_ZNK16CCmPluginBaseEng17GetBoolAttributeLEm @ 263 NONAME
+	_ZNK16CCmPluginBaseEng19GetStringAttributeLEm @ 264 NONAME
+	_ZNK16CCmPluginBaseEng20CheckIfNameModifiedLEPN8CommsDat13CCDRecordBaseE @ 265 NONAME
+	_ZNK16CCmPluginBaseEng20GetString8AttributeLEm @ 266 NONAME
+	_ZNK16CCmPluginBaseEng20GlobalBearerPriorityERK7TDesC16 @ 267 NONAME
+	_ZNK16CCmPluginBaseEng22GlobalUiBearerPriorityERK7TDesC16 @ 268 NONAME
+	_ZNK16CCmPluginBaseEng23CheckIfAlreadyConnectedEv @ 269 NONAME
+	_ZNK16CCmPluginBaseEng7SessionEv @ 270 NONAME
+	_ZNK16CCmPluginLanBase13ServiceRecordEv @ 271 NONAME
+	_ZNK17RCmDestinationExt12IsConnectedLEv @ 272 NONAME
+	_ZNK17RCmDestinationExt9MetadataLEN9CMManager18TSnapMetadataFieldE @ 273 NONAME
+	_ZNK18CCmDestinationImpl12IsConnectedLEv @ 274 NONAME
+	_ZNK19RCmConnectionMethod12DestinationLEv @ 275 NONAME
+	_ZNK19RCmConnectionMethod16GetIntAttributeLEm @ 276 NONAME
+	_ZNK19RCmConnectionMethod17GetBoolAttributeLEm @ 277 NONAME
+	_ZNK19RCmConnectionMethod19GetStringAttributeLEm @ 278 NONAME
+	_ZNK19RCmConnectionMethod20GetString8AttributeLEm @ 279 NONAME
+	_ZNK22RCmConnectionMethodExt12DestinationLEv @ 280 NONAME
+	_ZNK22RCmConnectionMethodExt16GetIntAttributeLEm @ 281 NONAME
+	_ZNK22RCmConnectionMethodExt17GetBoolAttributeLEm @ 282 NONAME
+	_ZNK22RCmConnectionMethodExt19GetStringAttributeLEm @ 283 NONAME
+	_ZNK22RCmConnectionMethodExt20GetString8AttributeLEm @ 284 NONAME
+	_ZNK23CmPluginBaseSettingsDlg14GetHelpContextER15TCoeHelpContext @ 285 NONAME
+	_ZNK23CmPluginBaseSettingsDlg19AppendSettingTextsLER12CDesC16ArrayiiRK7TDesC16i @ 286 NONAME
+	_ZNK23CmPluginBaseSettingsDlg19AppendSettingTextsLER12CDesC16Arrayiiii @ 287 NONAME
+	_ZTI16CCmPluginBaseEng @ 288 NONAME ; #<TI>#
+	_ZTI16CCmPluginLanBase @ 289 NONAME ; #<TI>#
+	_ZTI23CmPluginBaseSettingsDlg @ 290 NONAME ; #<TI>#
+	_ZTI25CmPluginBaseSettingsDlgIp @ 291 NONAME ; #<TI>#
+	_ZTI26CmPluginBaseSettingsDlgAdv @ 292 NONAME ; #<TI>#
+	_ZTIN11TCmCommonUi12CCmDesCArrayE @ 293 NONAME ; #<TI>#
+	_ZTV16CCmPluginBaseEng @ 294 NONAME ; #<VT>#
+	_ZTV16CCmPluginLanBase @ 295 NONAME ; #<VT>#
+	_ZTV23CmPluginBaseSettingsDlg @ 296 NONAME ; #<VT>#
+	_ZTV25CmPluginBaseSettingsDlgIp @ 297 NONAME ; #<VT>#
+	_ZTV26CmPluginBaseSettingsDlgAdv @ 298 NONAME ; #<VT>#
+	_ZTVN11TCmCommonUi12CCmDesCArrayE @ 299 NONAME ; #<VT>#
+	_ZThn156_N23CmPluginBaseSettingsDlg15ProcessCommandLEi @ 300 NONAME ; #<thunk>#
+	_ZThn156_N23CmPluginBaseSettingsDlg16DynInitMenuPaneLEiP12CEikMenuPane @ 301 NONAME ; #<thunk>#
+	_ZThn156_N25CmPluginBaseSettingsDlgIp16DynInitMenuPaneLEiP12CEikMenuPane @ 302 NONAME ; #<thunk>#
+	_ZThn156_N26CmPluginBaseSettingsDlgAdv16DynInitMenuPaneLEiP12CEikMenuPane @ 303 NONAME ; #<thunk>#
+	_ZThn176_N23CmPluginBaseSettingsDlg19HandleListBoxEventLEP11CEikListBoxN19MEikListBoxObserver13TListBoxEventE @ 304 NONAME ; #<thunk>#
+	_ZN14RCmDestinationC1Ev @ 305 NONAME
+	_ZN14RCmDestinationC2Ev @ 306 NONAME
+	_ZN17RCmDestinationExtC1Ev @ 307 NONAME
+	_ZN17RCmDestinationExtC2Ev @ 308 NONAME
+	_ZNK14RCmDestinationeqERKS_ @ 309 NONAME
+	_ZNK14RCmDestinationneERKS_ @ 310 NONAME
+	_ZNK17RCmDestinationExteqERKS_ @ 311 NONAME
+	_ZNK17RCmDestinationExtneERKS_ @ 312 NONAME
+	_ZN13CCmPluginBase10ConstructLEv @ 313 NONAME
+	_ZN13CCmPluginBase10CreateNewLEv @ 314 NONAME
+	_ZN13CCmPluginBase12EnableProxyLEi @ 315 NONAME
+	_ZN13CCmPluginBase15EnableLocationLEi @ 316 NONAME
+	_ZN13CCmPluginBase16AddResourceFileLERK7TDesC16 @ 317 NONAME
+	_ZN13CCmPluginBase16SetIntAttributeLEmm @ 318 NONAME
+	_ZN13CCmPluginBase17EnableChargeCardLEi @ 319 NONAME
+	_ZN13CCmPluginBase17RestoreAttributeLEm @ 320 NONAME
+	_ZN13CCmPluginBase17SetBoolAttributeLEmi @ 321 NONAME
+	_ZN13CCmPluginBase18RemoveResourceFileERK7TDesC16 @ 322 NONAME
+	_ZN13CCmPluginBase18UpdateProxyRecordLEv @ 323 NONAME
+	_ZN13CCmPluginBase19LoadServiceSettingLEv @ 324 NONAME
+	_ZN13CCmPluginBase19SetStringAttributeLEmRK7TDesC16 @ 325 NONAME
+	_ZN13CCmPluginBase20SetString8AttributeLEmRK6TDesC8 @ 326 NONAME
+	_ZN13CCmPluginBase20UpdateServiceRecordLEv @ 327 NONAME
+	_ZN13CCmPluginBase21PrepareToLoadRecordsLEv @ 328 NONAME
+	_ZN13CCmPluginBase23PrepareToUpdateRecordsLEv @ 329 NONAME
+	_ZN13CCmPluginBase26NumOfConnMethodReferencesLEv @ 330 NONAME
+	_ZN13CCmPluginBase5LoadLEm @ 331 NONAME
+	_ZN13CCmPluginBase7DeleteLEii @ 332 NONAME
+	_ZN13CCmPluginBase7UpdateLEv @ 333 NONAME
+	_ZN13CCmPluginBaseC1EP16CCmPluginBaseEng @ 334 NONAME
+	_ZN13CCmPluginBaseC2EP16CCmPluginBaseEng @ 335 NONAME
+	_ZN13CCmPluginBaseD0Ev @ 336 NONAME
+	_ZN13CCmPluginBaseD1Ev @ 337 NONAME
+	_ZN13CCmPluginBaseD2Ev @ 338 NONAME
+	_ZN14CCmManagerImpl20GetConnectionMethodLEm @ 339 NONAME
+	_ZN18CCmDestinationImpl20GetConnectionMethodLEi @ 340 NONAME
+	_ZNK13CCmPluginBase10AllocReadLEi @ 341 NONAME
+	_ZNK13CCmPluginBase11CreateCopyLEv @ 342 NONAME
+	_ZNK13CCmPluginBase11DestinationEv @ 343 NONAME
+	_ZNK13CCmPluginBase16GetIntAttributeLEm @ 344 NONAME
+	_ZNK13CCmPluginBase17GetBoolAttributeLEm @ 345 NONAME
+	_ZNK13CCmPluginBase17ParentDestinationEv @ 346 NONAME
+	_ZNK13CCmPluginBase19GetStringAttributeLEm @ 347 NONAME
+	_ZNK13CCmPluginBase20GetString8AttributeLEm @ 348 NONAME
+	_ZNK13CCmPluginBase5CmMgrEv @ 349 NONAME
+	_ZNK13CCmPluginBase6PluginEv @ 350 NONAME
+	_ZNK13CCmPluginBase7SessionEv @ 351 NONAME
+	_ZTI13CCmPluginBase @ 352 NONAME ; #<TI>#
+	_ZTV13CCmPluginBase @ 353 NONAME ; #<VT>#
+	_ZN19RCmConnectionMethodC1Ev @ 354 NONAME
+	_ZN19RCmConnectionMethodC2Ev @ 355 NONAME
+	_ZN19RCmConnectionMethodaSERKS_ @ 356 NONAME
+	_ZN22RCmConnectionMethodExtC1Ev @ 357 NONAME
+	_ZN22RCmConnectionMethodExtC2Ev @ 358 NONAME
+	_ZN22RCmConnectionMethodExtaSERKS_ @ 359 NONAME
+	_ZNK19RCmConnectionMethodeqERS_ @ 360 NONAME
+	_ZNK19RCmConnectionMethodneERS_ @ 361 NONAME
+	_ZNK22RCmConnectionMethodExteqERS_ @ 362 NONAME
+	_ZNK22RCmConnectionMethodExtneERS_ @ 363 NONAME
+	_ZN19RCmConnectionMethodD1Ev @ 364 NONAME
+	_ZN19RCmConnectionMethodD2Ev @ 365 NONAME
+	_ZN22RCmConnectionMethodExtD1Ev @ 366 NONAME
+	_ZN22RCmConnectionMethodExtD2Ev @ 367 NONAME
+	_ZN21CCmConnSettingsUiImpl25SetDestinationArrayToUseLE6RArrayImE @ 368 NONAME
+	_ZN21CCmConnSettingsUiImpl26ClearDestinationArrayToUseEv @ 369 NONAME
+	_ZN13CCmPluginBase17GetAdditionalUidsER6RArrayImE @ 370 NONAME
+	_ZN14CCmManagerImpl13WrapCmManagerER13RCmManagerExt @ 371 NONAME
+	_ZN16CCmPluginBaseEng17GetAdditionalUidsER6RArrayImE @ 372 NONAME
+	_ZN14CCmManagerImpl17CreateFlatCMListLEmR13RPointerArrayI13CCmPluginBaseE @ 373 NONAME
+	_ZN14CCmManagerImpl18FilterOutVirtualsLER13RPointerArrayI13CCmPluginBaseE @ 374 NONAME
+	_ZN14CCmManagerImpl30CombineArraysForPriorityOrderLER13RPointerArrayI13CCmPluginBaseES3_ @ 375 NONAME
+	_ZN14CCmManagerImpl18CreateFlatCMListLCEmR13RPointerArrayI13CCmPluginBaseE @ 376 NONAME
+	_ZN19RCmConnectionMethodC1ERKS_ @ 377 NONAME
+	_ZN19RCmConnectionMethodC2ERKS_ @ 378 NONAME
+	_ZN22RCmConnectionMethodExtC1ERKS_ @ 379 NONAME
+	_ZN22RCmConnectionMethodExtC2ERKS_ @ 380 NONAME
+	_ZN13CCmPluginBase13IsLinkedToIapEm @ 381 NONAME
+	_ZN13CCmPluginBase14IsLinkedToSnapEm @ 382 NONAME
+	_ZNK16CCmPluginBaseEng17ParentDestinationEv @ 383 NONAME
+	_ZN13RCmManagerExt20CreateTablesAndOpenLEv @ 384 NONAME
+	_ZN13RCmManagerExt18CreateDestinationLERK7TDesC16m @ 385 NONAME
+	_ZN13RCmManagerExt23CreateConnectionMethodLEmm @ 386 NONAME
+	_ZN16CCmPluginBaseEng15SetPreDefinedIdEm @ 387 NONAME
+	_ZN17RCmDestinationExt23CreateConnectionMethodLEmm @ 388 NONAME
+	_ZN23CmPluginBaseSettingsDlg20HandleResourceChangeEi @ 389 NONAME
+	_ZN23CmPluginBaseSettingsDlg7ExecuteEv @ 390 NONAME
+	_ZThn180_N23CmPluginBaseSettingsDlg7ExecuteEv @ 391 NONAME ; #<thunk>#
+	_ZN23CmPluginBaseSettingsDlg16HandleLeaveErrorEi @ 392 NONAME
+	_ZThn180_N23CmPluginBaseSettingsDlg16HandleLeaveErrorEi @ 393 NONAME ; #<thunk>#
+	_ZN10RCmManager13WriteDefConnLERK15TCmDefConnValue @ 394 NONAME
+	_ZN10RCmManager18CreateDestinationLERK7TDesC16 @ 395 NONAME
+	_ZN10RCmManager18CreateDestinationLERK7TDesC16m @ 396 NONAME
+	_ZN10RCmManager20CreateTablesAndOpenLEv @ 397 NONAME
+	_ZN10RCmManager20RemoveAllReferencesLER19RCmConnectionMethod @ 398 NONAME
+	_ZN10RCmManager21CopyConnectionMethodLER14RCmDestinationR19RCmConnectionMethod @ 399 NONAME
+	_ZN10RCmManager21MoveConnectionMethodLER14RCmDestinationS1_R19RCmConnectionMethod @ 400 NONAME
+	_ZN10RCmManager23CreateConnectionMethodLEm @ 401 NONAME
+	_ZN10RCmManager23CreateConnectionMethodLEmm @ 402 NONAME
+	_ZN10RCmManager23RemoveConnectionMethodLER14RCmDestinationR19RCmConnectionMethod @ 403 NONAME
+	_ZN10RCmManager26UpdateBearerPriorityArrayLERK6RArrayI15TBearerPriorityE @ 404 NONAME
+	_ZN14RCmDestination10SetHiddenLEi @ 405 NONAME
+	_ZN14RCmDestination12SetMetadataLEN9CMManager18TSnapMetadataFieldEm @ 406 NONAME
+	_ZN14RCmDestination14SetProtectionLEN9CMManager16TProtectionLevelE @ 407 NONAME
+	_ZN14RCmDestination15ModifyPriorityLER19RCmConnectionMethodj @ 408 NONAME
+	_ZN14RCmDestination20AddConnectionMethodLE19RCmConnectionMethod @ 409 NONAME
+	_ZN14RCmDestination23AddEmbeddedDestinationLERKS_ @ 410 NONAME
+	_ZN14RCmDestination23CreateConnectionMethodLEm @ 411 NONAME
+	_ZN14RCmDestination23CreateConnectionMethodLEmm @ 412 NONAME
+	_ZN14RCmDestination23DeleteConnectionMethodLER19RCmConnectionMethod @ 413 NONAME
+	_ZN14RCmDestination23RemoveConnectionMethodLE19RCmConnectionMethod @ 414 NONAME
+	_ZN14RCmDestination7UpdateLEv @ 415 NONAME
+	_ZN14RCmDestination8DeleteLDEv @ 416 NONAME
+	_ZN14RCmDestination8SetIconLEm @ 417 NONAME
+	_ZN14RCmDestination8SetNameLERK7TDesC16 @ 418 NONAME
+	_ZN19RCmConnectionMethod11CreateCopyLEv @ 419 NONAME
+	_ZN19RCmConnectionMethod16SetIntAttributeLEmm @ 420 NONAME
+	_ZN19RCmConnectionMethod17SetBoolAttributeLEmi @ 421 NONAME
+	_ZN19RCmConnectionMethod19SetStringAttributeLEmRK7TDesC16 @ 422 NONAME
+	_ZN19RCmConnectionMethod20SetString8AttributeLEmRK6TDesC8 @ 423 NONAME
+	_ZN19RCmConnectionMethod7DeleteLEv @ 424 NONAME
+	_ZN19RCmConnectionMethod7UpdateLEv @ 425 NONAME
+	_ZNK10RCmManager17SupportedBearersLER6RArrayImE @ 426 NONAME
+	_ZNK10RCmManager18UncategorizedIconLEv @ 427 NONAME
+	_ZN10RCmManager20ReadGenConnSettingsLER18TCmGenConnSettings @ 428 NONAME
+	_ZN10RCmManager21WriteGenConnSettingsLERK18TCmGenConnSettings @ 429 NONAME
+	_ZN14CCmManagerImpl16IapStillExistedLERK16CCmPluginBaseEng @ 430 NONAME
+	_ZN14CCmManagerImpl16WatcherRegisterLEP18MCmCommsDatWatcher @ 431 NONAME
+	_ZN14CCmManagerImpl17IsIapStillInDestLEP18CCmDestinationImplRK16CCmPluginBaseEng @ 432 NONAME
+	_ZN14CCmManagerImpl17WatcherUnRegisterEv @ 433 NONAME
+	_ZN14CCmManagerImpl18RemoveDestFromPoolEP18CCmDestinationImpl @ 434 NONAME
+	_ZN14CCmManagerImpl24DestinationStillExistedLEP18CCmDestinationImpl @ 435 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2006-2008 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 file for Connection Method Manager's framework.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+// export localised loc file
+../loc/cmmanager.loc	MW_LAYER_LOC_EXPORT_PATH(cmmanager.loc)
+
+PRJ_MMPFILES
+cmmanager.mmp
+
+PRJ_EXTENSIONS
+START EXTENSION s60/mifconv
+OPTION TARGETFILE cmmanager.mif
+OPTION HEADERFILE cmmanager.mbg
+OPTION SOURCES -c8,8 qgn_indi_sett_protected_add\
+               -c8,8 qgn_prop_set_conn_dest_add\
+               -c8,8 qgn_prop_set_conn_dest_internet\
+               -c8,8 qgn_prop_set_conn_dest_wap\
+               -c8,8 qgn_prop_set_conn_dest_mms\
+               -c8,8 qgn_prop_set_conn_dest_intranet\
+               -c8,8 qgn_prop_set_conn_dest_operator\
+               -c8,8 qgn_prop_set_conn_dest_icon1\
+               -c8,8 qgn_prop_set_conn_dest_icon2\
+               -c8,8 qgn_prop_set_conn_dest_icon3\
+               -c8,8 qgn_prop_set_conn_dest_icon4\
+               -c8,8 qgn_prop_set_conn_dest_icon5\
+               -c8,8 qgn_prop_set_conn_dest_icon6\
+               -c8,8 qgn_prop_set_conn_dest_default\
+               -c8,8 qgn_prop_set_conn_dest_uncategorized\
+               -c8,8 qgn_prop_set_conn_bearer_avail_wlan\
+               -c8,8 qgn_prop_set_conn_bearer_avail_packetdata\
+               -c8,8 qgn_prop_set_conn_wlan_easy\
+               -c8,8 qgn_prop_set_conn_dest_internet_small\
+               -c8,8 qgn_prop_set_conn_dest_wap_small\
+               -c8,8 qgn_prop_set_conn_dest_mms_small\
+               -c8,8 qgn_prop_set_conn_dest_intranet_small\
+               -c8,8 qgn_prop_set_conn_dest_operator_small\
+               -c8,8 qgn_prop_set_conn_dest_icon1_small\
+               -c8,8 qgn_prop_set_conn_dest_icon2_small\
+               -c8,8 qgn_prop_set_conn_dest_icon3_small\
+               -c8,8 qgn_prop_set_conn_dest_icon4_small\
+               -c8,8 qgn_prop_set_conn_dest_icon5_small\
+               -c8,8 qgn_prop_set_conn_dest_icon6_small\
+               -c8,8 qgn_prop_set_conn_dest_default_small\
+               -c8,8 qgn_indi_cb_hot_add\
+               -c8,8 qgn_indi_default_conn_add
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Group/cmmanager.mmp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,130 @@
+/*
+* Copyright (c) 2006-2008 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 of Connection Method Manager's framework.
+*
+*/
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+TARGET        	cmmanager.dll
+TARGETTYPE    	dll
+UID           	0x1000008d 0x10207376
+CAPABILITY		CAP_GENERAL_DLL
+VENDORID VID_DEFAULT
+
+SOURCEPATH      ../Src
+
+SOURCE 			cmmanager.cpp
+SOURCE 			cmmanagerext.cpp
+SOURCE          cmmanagerimpl.cpp
+SOURCE 			cmdestination.cpp
+SOURCE          cmdestinationext.cpp
+SOURCE          cmdestinationimpl.cpp
+SOURCE 			ccmpluginbaseeng.cpp
+SOURCE 			cmpluginbase.cpp
+SOURCE 			cmsettingsui.cpp
+SOURCE 			cmapplicationsettingsui.cpp
+SOURCE 			cmapplicationsettingsuiimpl.cpp //just here to avoid bc break
+SOURCE 			cmsettingsuiimpl.cpp
+SOURCE 			cmconnsettingsuiimpl.cpp
+SOURCE          cmlogger.cpp
+SOURCE          destdlg.cpp
+SOURCE          destlistbox.cpp
+SOURCE          destlistboxmodel.cpp
+SOURCE          destlistitem.cpp
+SOURCE          destlistitemlist.cpp
+SOURCE          cmdlg.cpp
+SOURCE          cmlistbox.cpp
+SOURCE          cmlistboxmodel.cpp
+SOURCE          cmlistitem.cpp
+SOURCE          cmlistitemlist.cpp
+SOURCE          cmpbasesettingsdlg.cpp
+SOURCE          cmconnectionmethod.cpp
+SOURCE          cmconnectionmethodext.cpp
+SOURCE          cmcommonui.cpp
+SOURCE          cmwizard.cpp
+SOURCE 			cmconnselectrbpage.cpp
+SOURCE          cmconnectionmethodinfo.cpp
+SOURCE          cmtransactionhandler.cpp
+SOURCE          uncatdlg.cpp
+SOURCE          selectdestination.cpp
+SOURCE          cmdesticondialog.cpp
+SOURCE          cmdesticonmap.cpp
+SOURCE 			cmpluginlanbase.cpp
+SOURCE 			cmpbasesettingsdlgadv.cpp
+SOURCE 			cmpbasesettingsdlgip.cpp
+SOURCE 			cmpluginmultilinedialog.cpp
+SOURCE 			cmobjectpool.cpp
+SOURCE          ccmdexec.cpp
+SOURCE          cmcommsdatnotifier.cpp
+
+START RESOURCE ../SrcData/cmmanager.rss
+HEADER
+TARGETPATH   RESOURCE_FILES_DIR
+LANGUAGE_IDS
+END  // RESOURCE
+
+USERINCLUDE		../SrcData
+USERINCLUDE		../../Plugins/cmpluginembdestination/inc    // cmpluginembdestinationdef.h
+
+// 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
+
+LIBRARY         hlplch.lib
+
+LIBRARY       	euser.lib
+LIBRARY         ECom.lib
+LIBRARY         COMMSDAT.lib
+LIBRARY         flogger.lib
+LIBRARY         FeatMgr.lib
+
+
+LIBRARY eikcore.lib egul.lib
+LIBRARY eikcoctl.lib avkon.lib eikdlg.lib
+LIBRARY eikctl.lib  cone.lib CommonEngine.lib
+LIBRARY bafl.lib fbscli.lib efsrv.lib CommonUI.LIB
+LIBRARY AknSkins.lib CdlEngine.lib
+LIBRARY ESock.lib
+LIBRARY AknLayout.lib
+LIBRARY AknLayout2.lib
+LIBRARY AknLayout2scalable.lib
+LIBRARY aknicon.lib
+LIBRARY ws32.lib
+LIBRARY cmmanagerdatabase.lib
+LIBRARY insock.lib
+LIBRARY sysutil.lib
+LIBRARY connectionuiutilities.lib
+LIBRARY touchfeedback.lib
+LIBRARY centralrepository.lib
+
+#if defined(ARMCC)
+    DEFFILE ../EABI/CmManager_prot_setup.def
+#elif defined( WINSCW )
+    DEFFILE ../BWinsCw/CmManager_prot_setup.DEF
+#elif defined( WINS )
+    DEFFILE ../BWins/CmManager_prot_setup.def
+#else
+    DEFFILE ../BMarm/CmManager_prot_setup.def
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Group/framework_icons.mk	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,96 @@
+#
+# Copyright (c)  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:  icons makefile for project CMManager Framework
+#
+ifeq (WINS,$(findstring WINS, $(PLATFORM)))
+ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\Z
+else
+ZDIR=\epoc32\data\z
+endif
+
+
+TARGETDIR=$(ZDIR)\resource\apps
+ICONTARGETFILENAME=$(TARGETDIR)\cmmanager.mif
+
+HEADERDIR=\epoc32\include
+HEADERFILENAME=$(HEADERDIR)\cmmanager.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)  \
+                /c8,8 qgn_indi_sett_protected_add.bmp\
+                /c8,8 qgn_prop_set_conn_dest_add.bmp\
+                /c8,8 qgn_prop_set_conn_dest_internet.bmp\
+                /c8,8 qgn_prop_set_conn_dest_wap.bmp\
+                /c8,8 qgn_prop_set_conn_dest_mms.bmp\
+                /c8,8 qgn_prop_set_conn_dest_intranet.bmp\
+                /c8,8 qgn_prop_set_conn_dest_operator.bmp\
+                /c8,8 qgn_prop_set_conn_dest_icon1.bmp\
+                /c8,8 qgn_prop_set_conn_dest_icon2.bmp\
+                /c8,8 qgn_prop_set_conn_dest_icon3.bmp\
+                /c8,8 qgn_prop_set_conn_dest_icon4.bmp\
+                /c8,8 qgn_prop_set_conn_dest_icon5.bmp\
+                /c8,8 qgn_prop_set_conn_dest_icon6.bmp\
+                /c8,8 qgn_prop_set_conn_dest_default.bmp\
+                /c8,8 qgn_prop_set_conn_dest_uncategorized.bmp\
+                /c8,8 qgn_prop_set_conn_bearer_avail_wlan.bmp\
+                /c8,8 qgn_prop_set_conn_bearer_avail_packetdata.bmp\
+                /c8,8 qgn_prop_set_conn_wlan_easy.bmp\
+                /c8,8 qgn_prop_set_conn_dest_internet_small.bmp\
+                /c8,8 qgn_prop_set_conn_dest_wap_small.bmp\
+                /c8,8 qgn_prop_set_conn_dest_mms_small.bmp\
+                /c8,8 qgn_prop_set_conn_dest_intranet_small.bmp\
+                /c8,8 qgn_prop_set_conn_dest_operator_small.bmp\
+                /c8,8 qgn_prop_set_conn_dest_icon1_small.bmp\
+                /c8,8 qgn_prop_set_conn_dest_icon2_small.bmp\
+                /c8,8 qgn_prop_set_conn_dest_icon3_small.bmp\
+                /c8,8 qgn_prop_set_conn_dest_icon4_small.bmp\
+                /c8,8 qgn_prop_set_conn_dest_icon5_small.bmp\
+                /c8,8 qgn_prop_set_conn_dest_icon6_small.bmp\
+                /c8,8 qgn_prop_set_conn_dest_default_small.bmp\
+                /c8,8 qgn_indi_cb_hot_add.bmp\
+                /c8,8 qgn_indi_default_conn_add.bmp
+
+FREEZE : do_nothing
+
+SAVESPACE : do_nothing
+
+RELEASABLES :
+	@echo $(HEADERFILENAME)&& \
+	@echo $(ICONTARGETFILENAME)
+
+FINAL : do_nothing
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Inc/ccmdexec.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2008 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:  Signaling class for destination edit.
+*
+*/
+
+
+#ifndef C_CCMDEXEC_H
+#define C_CCMDEXEC_H
+
+class MCmdExec;
+
+NONSHARABLE_CLASS(CCmdExec) : public CActive
+    {
+
+public:
+
+    /**
+    * Destructor.
+    */
+    virtual ~CCmdExec();
+    
+    void Execute();
+    
+// from base class CActive
+public:
+    virtual void RunL();
+
+    virtual TInt RunError( TInt /*aError*/ );
+
+    virtual void DoCancel();
+
+    CCmdExec(MCmdExec& aOwner);
+
+protected: // data
+
+    /**
+     * Owner
+     * Not own.
+     */
+    MCmdExec& iOwner;
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Inc/cmapplicationsettingsuiimpl.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,155 @@
+/*
+* 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 application selection dialog
+*
+*/
+
+#ifndef C_CMAPLICATIONSETTINGSUIIMPL_H
+#define C_CMAPLICATIONSETTINGSUIIMPL_H
+
+#include <e32def.h>
+#include <e32base.h>
+#include <ConeResLoader.h>
+#include <badesca.h>    // CDesCArrayFlat
+#include "cmmanager.hrh"
+#include "cmapplicationsettingsui.h"
+
+class TCmSettingSelection;
+class CCmManagerImpl;
+class CCmDestinationImpl;
+
+
+//IMPLEMENTATION REMOVED!!!!
+//JUST HERE TO MANTAIN BC COMPATIBILITY!!!
+/**
+ *  Implementation of application setting UI.
+ *
+ *  @lib cmmanage.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS(CCmApplicationSettingsUiImpl) : public CBase
+    {
+
+    public:
+
+        IMPORT_C static CCmApplicationSettingsUiImpl* NewL();
+
+
+    //=========================================================================    
+    // UI API
+    //
+    public:
+
+        /**
+        * Launches the 'easy to use' Settings UI provided for applications
+        * for handling Destinations and Connection Methods
+        * @since 3.1U
+        * @params aSelection User selection.
+        * @returns ETrue if a selection was made
+        */
+        TBool RunApplicationSettingsL( TCmSettingSelection& aSelection );
+
+
+        /**
+        * Enables/Disabled AlwaysAsk
+        * 
+        * @param ETrue enables
+        * @since S60 3.2
+        */
+        inline void EnableAlwaysAsk( TBool aEnable ) 
+                                        { iShowAlwaysAsk = aEnable; }
+        
+        /**
+        * Enables/Disabled EasyWlan
+        * 
+        * @param ETrue enables
+        * @since S60 3.2
+        */
+        inline void EnableEasyWlan( TBool aEnable )
+                                        { iShowEasyWlan = aEnable; }
+        
+        /**
+        * Enables/Disabled VirtualCMs
+        * 
+        * @param ETrue enables
+        * @since S60 3.2
+        */
+        inline void EnableVirtualCMs( TBool aEnable )
+                                        { iShowVirtualCMs = aEnable; }
+        
+        /**
+        * Enables/Disabled EmptyDestinations
+        * 
+        * @param ETrue enables
+        * @since S60 3.2
+        */
+        inline void EnableEmptyDestinations( TBool aEnable ) 
+                                        { iShowEmptyDestinations = aEnable; }
+                                        
+        /**
+        * Sets a destination id which should be omitted from the list
+        * typically this will be the parent destination of a virtual CM
+        * 
+        * @param aDestinationId
+        * @since S60 3.2
+        */
+        inline void SetDestinationToOmit( TUint32 aDestinationId )
+                                    { iDestinationToOmit = aDestinationId; }
+
+                         
+    private: // data
+
+        /**
+         * pointer to the CmManager - OWNED
+         */
+        CCmManagerImpl* iCmManagerImpl;
+        
+        /**
+         * resource loader
+         */
+        RConeResourceLoader iResourceReader;
+        
+        /**
+         * List of destination IDs to show
+         */ 
+        RArray<TUint32> iDestinations;
+                
+        /**
+         * Indicates whether Always Ask should be shown in the page
+         */
+        TBool iShowAlwaysAsk;
+        
+        /**
+         * Indicates whether EasyWlan should be shown in the page
+         */
+        TBool iShowEasyWlan;
+        
+        /**
+         * Indicates whether virtual iaps should be shown in the page
+         */
+        TBool iShowVirtualCMs;
+        
+        /**
+         * Indicates whether Empty destinations should be shown in the page
+         */
+        TBool iShowEmptyDestinations;
+        
+        /**
+         * Indicates the id of destination to specifically omit (usually a parent destination)
+         * if zero, it can be ignored
+         */
+        TUint iDestinationToOmit;
+    };
+
+#endif // C_CMAPLICATIONSETTINGSUIIMPL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Inc/cmcommsdatnotifier.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Listens for changes in one CommsDat table through CenRep.
+*
+*/
+
+#ifndef CMCOMMSDATNOTIFIER_H
+#define CMCOMMSDATNOTIFIER_H
+
+_LIT( KIapDisappear, "Iap disappears from CommsDat" );
+_LIT( KDestDisappear, "Destination disappears from CommsDat" );
+
+class CCmManagerImpl;
+class CRepository;
+class MCmCommsDatWatcher;
+
+// A stack to store watchers
+typedef CArrayPtrFlat<MCmCommsDatWatcher> CCmCallBackArray;
+
+// Used to notify parent view what happens during son's view editing.
+const TInt KCmNotifiedNone = 0;
+const TInt KCmNotifiedDestinationDisappear = 1;
+const TInt KCmNotifiedIapIsNotInThisDestination = 2;
+const TInt KCmNotifiedIapDisappear = 3;
+
+class MCmCommsDatWatcher
+    {
+public:
+    // watcher should implement this function to get the notification of CommsDat changes.
+    // see class CCmManagerImpl for watcher registration
+    virtual void CommsDatChangesL() = 0;
+    };
+
+// Used for son's watcher to notify parent watcher that CommsDat has changes
+// if farther watcher wants to know what heppens when son's watcher exiting
+class CCmParentViewNotifier
+    {
+public:
+    virtual void NotifyParentView( TInt aValue ) = 0;
+    };
+
+/*
+ * CommsDat can suddenly change with some reasons, e.g., an application may suddenly add/delete a destination
+ * and Iap. Those changes may affect CmManager. This class will listen to changes in one CommsDat table
+ * through CenRep and inform related watcher that is interesting in CommsDat changes.
+ */
+NONSHARABLE_CLASS( CCmCommsDatNotifier ) : public CActive
+    {
+public:
+
+    static CCmCommsDatNotifier* NewL( TUint32 aTableId );
+
+    static CCmCommsDatNotifier* NewLC( TUint32 aTableId );
+
+    virtual ~CCmCommsDatNotifier();
+    
+    void WatcherRegisterL( MCmCommsDatWatcher* aWatcher );
+    void WatcherUnRegister( );
+
+private:
+    CCmCommsDatNotifier( TUint32 aTableId );
+
+    void ConstructL();
+    TInt RequestNotifications();
+    
+    void DeleteCallBackArray();
+
+private: // Methods from base class
+    void DoCancel();
+    void RunL();
+
+private:
+    TUint32 iTableId;
+    CRepository* iRepository;
+    MCmCommsDatWatcher* iWatcher; // callback object that wants to see changes in CommsDat
+    CCmCallBackArray* iCallBackArray; // used as stack to go to the next view
+    };
+
+#endif // CMCOMMSDATNOTIFIER_H
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Inc/cmconnectionmethodinfo.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,98 @@
+/*
+* 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:  Connection Method interface class.
+*
+*/
+
+#ifndef CMCONNECTIONMETHODINFO_H
+#define CMCONNECTIONMETHODINFO_H
+
+#include <cmpluginbaseeng.h>
+
+/**
+ *  Acts as a connection method that has no bearer type.
+ *  Client applications can query connection method, but non-bearer specific
+ *  attributes by calling RCmManager/Ext::GetConnectionMethodInfoXXXL()
+ *  functions.
+ *  Modification and update of a connetion method is not supported.
+ *  Common records of a connection method are loaded, and kept in memory
+ *  as long as the client application queries attribute of another connection
+ *  method.
+ *
+ *  @lib cmmanager.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CCmConnectionMethodInfo ) : public CCmPluginBaseEng
+    {
+    public:
+    
+        static CCmConnectionMethodInfo* NewL( TCmPluginInitParam *aInitParam );
+
+        static CCmConnectionMethodInfo* NewLC( TCmPluginInitParam *aInitParam );
+
+        virtual ~CCmConnectionMethodInfo();
+
+        virtual CCmPluginBaseEng* 
+                CreateInstanceL( TCmPluginInitParam& /*aInitParam*/ ) const;
+        virtual CCmPluginBaseEng* CreateCopyL() const;
+
+    public: // new functions
+    
+        virtual TUint32 GetConnectionInfoIntL( const TUint32 aIapId, 
+                                          const TUint32 aAttribute );
+                                          
+        virtual TBool GetConnectionInfoBoolL( const TUint32 aIapId, 
+                                         const TUint32 aAttribute );
+                                         
+        virtual HBufC* GetConnectionInfoStringL( const TUint32 aIapId, 
+                                            const TUint32 aAttribute );
+        
+        virtual HBufC8* GetConnectionInfoString8L( const TUint32 aIapId, 
+                                             const TUint32 aAttribute );
+        
+        virtual void AdditionalReset(){};
+
+        void ResetIfInMemory( CCmPluginBaseEng* aCM );
+
+    private: // from CCmPluginBaseEng
+    
+        virtual TInt RunSettingsL();
+        virtual TBool InitializeWithUiL( TBool aManuallyConfigure );
+        virtual TBool CanHandleIapIdL( TUint32 aIapId ) const;
+        virtual TBool CanHandleIapIdL( CommsDat::CCDIAPRecord* aIapRecord ) const;
+        virtual void CopyAdditionalDataL( CCmPluginBaseEng* aDestInst );
+
+    private:
+    
+        virtual void ServiceRecordIdLC( HBufC* &aServiceName, 
+                                       TUint32& aRecordId );
+        virtual void BearerRecordIdLC( HBufC* &aBearerName, 
+                                           TUint32& aRecordId );
+        virtual void CreateNewServiceRecordL();
+        
+        void ResetAndLoadL( TUint32 aIapId );
+        
+    private:
+
+        CCmConnectionMethodInfo( TCmPluginInitParam *aInitParam );
+
+        void ConstructL();
+
+    private:    // new functions
+    
+    private: // data
+    };
+
+
+#endif // CMCONNECTIONMETHODINFO_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Inc/cmconnselectrbpage.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,164 @@
+/*
+* 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:  Dialog for setting the gateway. It's used temporarily.
+*
+*/
+
+#ifndef C_CMCONNSELECTRBPAGE_H
+#define C_CMCONNSELECTRBPAGE_H
+
+#include <aknradiobuttonsettingpage.h>
+#include <csxhelp/cp.hlp.hrh>
+#include <cmcommonconstants.h>
+
+#include "cmmanagerimpl.h"
+#include "cmconnsettingsuiimpl.h"
+
+/**
+ * Application Settings UI radio button page
+ *
+ *  @lib cmmanager.lib
+ *  @since S60 3.2
+ */
+NONSHARABLE_CLASS(CCMConnSelectRBPage) : public CAknRadioButtonSettingPage
+    {
+    
+   public: // construction/destruction
+    
+        /**
+         * Constructor
+         *
+         * @since S60 3.2
+         * @param aDialogResourceId resource id for the dialog
+         * @param aCurrentSelectionIndex the item to be highlighted
+         * @param aItemArray the items to be displayed
+         * @param aCmManagerImpl reference to the cm manager
+         * @param aSelectionMode the selected item type
+         * @param aHelpContext help context to use when Help menuitem is selected
+         */
+        CCMConnSelectRBPage( TInt aDialogResourceId,
+                          TInt& aCurrentSelectionIndex, 
+                          const MDesCArray* aItemArray, 
+                          CCmManagerImpl& aCmManagerImpl, 
+                          CMManager::TCmDCSettingSelectionMode& aSelectionMode,
+                          RArray<TUint32>& aDestinations,
+                          TBool areDestinations, 
+                          TBool aOpenDestination,
+                          TCoeContextName& aHelpContext );
+        
+        /**
+         * Destructor
+         */
+        ~CCMConnSelectRBPage();
+    
+    public: // derived functions
+    
+        /**
+        * From CCoeControl
+        *
+        * @since S60 3.2
+        * @param aKeyEvent The key event.
+        * @param aType Key event type.
+        * @return key response (was the key event consumed?).
+        */
+        TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, 
+                                     TEventCode aType );    
+        
+        /**
+        * Returns the help context
+        * From CCoeControl
+        * 
+        * @since S60 3.2
+        * @param aContext the returned help context
+        */
+        void GetHelpContext( TCoeHelpContext& aContext ) const;
+        
+        /**
+        * Handle list box events
+        * From CCoeControl
+        * 
+        * @since S60 5.0
+        * @param aListBox Reference to list box object.
+        * @param aEventType Type of event.
+        */
+        void HandleListBoxEventL(CEikListBox* aListBox, MEikListBoxObserver::TListBoxEvent aEventType);
+		
+    private: // derived functions
+        
+        /*
+        * From CEikDialog
+        *
+        * @since S60 3.2
+        * @param aButtonId
+        */
+        TBool OkToExitL( TInt aButtonId );
+        
+        /*
+         * From MEikMenuObserver
+         *
+         * @since S60 3.2
+         * @param aResourceId
+         * @param aMenuPane
+         */
+        void DynInitMenuPaneL( TInt aResourceId,
+                               CEikMenuPane* aMenuPane );    
+        
+        /**
+        * From MEikCommandObserver
+        *
+        * @since S60 3.2
+        * @param aCommandId
+        */
+        void ProcessCommandL( TInt aCommandId );
+
+    private: // data
+            
+        /**
+         * Resource id of the used dialog type
+         */
+		TInt iDialogResourceId;
+		
+        /**
+         * reference to the cm manager
+         */
+        CCmManagerImpl& iCmManagerImpl;
+        
+        /**
+         * The selection made by the user
+         */
+        CMManager::TCmDCSettingSelectionMode& iSelectionMode;
+        
+        /**
+         * A list of destination ids
+         */
+        RArray<TUint32>& iDestinations;
+        /**
+         * Indicates whether iDestinations holds destinatos or CMs
+         */
+        TBool iAreDestinations;
+        /**
+         * Indicates whether iDestinations should be openable
+         */
+        TBool iOpenDestination;
+        /**
+         * help context
+         */        
+        TCoeContextName iHelpContext;
+        /**
+         * Previously selected item
+         */
+        TInt iPrevItem;
+    };
+    
+#endif // C_CMAPPSETTRBPAGE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Inc/cmconnsettingsuiimpl.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,566 @@
+/*
+* 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 application selection dialog
+*
+*/
+
+#ifndef C_CMCONNSETTINGSUIIMPL_H
+#define C_CMCONNSETTINGSUIIMPL_H
+
+#include <e32def.h>
+#include <e32base.h>
+#include <ConeResLoader.h>
+#include <badesca.h>    // CDesCArrayFlat
+#include <cmdefconnvalues.h>
+#include <hlplch.h>
+
+#include "cmmanager.hrh"
+#include "cmapplicationsettingsui.h"
+
+class TCmDCSettingSelection;
+class CCmManagerImpl;
+class CCmDestinationImpl;
+class CCmPluginBase;
+
+//CONSTS
+const TInt KCmDefConnIndex = 0;
+const TInt KCmUserDefinedIndex  = 1;
+
+namespace CMManager
+    {
+    enum TCmDCSettingSelectionMode
+        {
+        EDCAlwaysAsk,         /**<
+                            * The user selected Always Ask
+                            */
+        EDCAskOnce,         /**<
+                            * The user selected Ask Once
+                            */
+        EDCDestination,       /**<
+                            * The user selected a destination
+                            */
+        EDCConnectionMethod,   /**<
+                            * The user selected a connection method
+                            */
+        EDCDefaultConnection   /**<
+                            * The user selected a connection method
+                            */
+        };
+    } //namespace CmManager
+    
+/**
+ * Stores the details of a setting selection
+ *
+ *  @since S60 3.2
+ */
+NONSHARABLE_STRUCT( TCmDCSettingSelection ) //extended with Ask Once
+    {
+    /**
+    * Selection that the user made
+    */
+    CMManager::TCmDCSettingSelectionMode iResult;
+    
+    /**
+    * Id of the selected destination or connection method
+    */
+    TUint iId;
+    // -----------------------------------------------------------------------------
+    // TCmDCSettingSelection::operator==
+    // -----------------------------------------------------------------------------
+    //
+    inline TBool TCmDCSettingSelection::operator==( TCmDCSettingSelection& aDCSettingSelection ) const
+        {
+        return ( (iResult == aDCSettingSelection.iResult) && ( iId == aDCSettingSelection.iId ) );
+        };
+
+    // -----------------------------------------------------------------------------
+    // TCmDCSettingSelection::operator!=
+    // -----------------------------------------------------------------------------
+    //
+    inline TBool TCmDCSettingSelection::operator!=( TCmDCSettingSelection& aDCSettingSelection ) const
+        {
+        return (!( (iResult == aDCSettingSelection.iResult) && ( iId == aDCSettingSelection.iId ) ));
+        };    
+    // -----------------------------------------------------------------------------
+    // TCmDCSettingSelection::ConvertToDefConn
+    // -----------------------------------------------------------------------------
+    //
+    inline TCmDefConnValue TCmDCSettingSelection::ConvertToDefConn( ) const
+        {
+        TCmDefConnValue defConnValue;
+        defConnValue.iType = ECmDefConnAlwaysAsk;
+        defConnValue.iId = 0;
+        switch ( iResult )
+            {
+            case CMManager::EDCAlwaysAsk :       
+                {
+                defConnValue.iType = ECmDefConnAlwaysAsk;
+                break;
+                }
+            case CMManager::EDCAskOnce :   
+                {
+                defConnValue.iType = ECmDefConnAskOnce;
+                break;
+                }
+            case CMManager::EDCDestination :
+                {
+                defConnValue.iType = ECmDefConnDestination;
+                defConnValue.iId = iId;
+                break;
+                }
+            case CMManager::EDCConnectionMethod :
+                {
+                defConnValue.iType = ECmDefConnConnectionMethod;
+                defConnValue.iId = iId;
+                break;
+                }
+            case CMManager::EDCDefaultConnection : 
+                {
+                defConnValue.iType = ECmDefConnAlwaysAsk; //default value
+                break;
+                }
+            default:
+                {
+                defConnValue.iType = ECmDefConnAlwaysAsk; //default value
+                break;
+                }
+            };
+        return defConnValue; 
+        };
+     };    
+    
+
+        
+/**
+ *  Implementation of application setting UI.
+ *
+ *  @lib cmmanage.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS(CCmConnSettingsUiImpl) : public CBase
+    {
+
+    public:
+
+        IMPORT_C static CCmConnSettingsUiImpl* NewL( CCmManagerImpl* aCCmManagerImpl = NULL );
+        static CCmConnSettingsUiImpl* NewWithoutTablesL();
+
+        virtual ~CCmConnSettingsUiImpl();
+
+    //=========================================================================    
+    // UI API
+    //
+    public:
+
+        /**
+        * Launches the 'easy to use' Settings UI provided for applications
+        * for handling Destinations and Connection Methods
+        *
+        * @since 3.2
+        * @param aSelection If initialised to a valid value, sets the higlight to the
+        * corresponding list item at startup. If a list of Destinations is displayed, and
+        * the initial highlight is set to a Connection Method, the parent Destination
+        * gets highlighted. On return, holds user selection.
+        * @param aListItems A bit field which indicates which items shoud be
+        *                   shown in the selection dialog. The bitmasks are 
+        *                   defined in the TCmSelectionDialogItems enum.
+        *
+        * The function leaves with KErrNotSupported  if all the items which 
+        * were set to be shown are not supported/enabled. 
+        * E.g. Default Connection availability/support is controlled by the 
+        * Feature Manager so if only EShowDefaultConnection is set and the 
+        * Default Connection feature is not enabled than the function leaves
+        * with KErrNotSupported.
+        *
+        * In other cases (when an item or items are not supported/enabled but
+        * not all) the selected but not supported/enabled items are not added
+        * to the list. The request to show such an item is silently ignored.
+        *
+        *
+        * Special note about the EShowDestinations and EShowConnectionMethods
+        * bitmasks:      
+        *   The following enumerations controls how how destinations and 
+        *   Connection Methods are presented in the selection UI.
+        *   General rule about the EShowDestinations:
+        *     Destinations which does not contain any Connection Methods are 
+        *     not shown in the selection dialog. The same rule is applied if
+        *     the Destination containes Connection Methods but all of them 
+        *     are filtered out by the filtering criteria.
+        *   EShowDestinations is set and EShowConnectionMethods is set:
+        *     Destination list is added to the selection UI and a Connection
+        *     Method can be selected inside a Destination.
+        *   EShowDestinations is set and EShowConnectionMethods is not set:
+        *     Destination list is added to the selection UI and no Connection
+        *     Method can be selected inside a Destination. 
+        *   EShowDestinations is not set and EShowConnectionMethods is set:
+        *     Connection Method list is added to the selection UI. Connection
+        *     Methods are ordered according to the global bearer type 
+        *     priorities. Destination cannot be selected.
+        *   EShowDestinations is not set and EShowConnectionMethods is not set:
+        *     The selection UI will not contain any Destination or Connection 
+        *     Method. E.g. If EShowAlwaysAsk and EShowDefaultConnection was 
+        *     set then the selection UI will contain two entries (AlwaysAsk
+        *     and DefaultConnection).
+        *
+        * @param aFilterArray Only Connection Methods with bearer types from
+        *                     the aFilterArray will be showed. 
+        *                     All Connection Methods will be listed if the 
+        *                     array has no element.
+        * @return TBool seleceted or not.
+        *
+        * @leave KErrArgument If the selection dialog would have zero 
+        *                     elements based on the aListItems bitmask
+        *                     (aListItems is equal to zero). 
+        *
+        * @leave KErrNotSupported 
+        *                     If the selection dialog would have zero 
+        *                     elements based on the aListItems bitmask
+        *                     (all the selected elements in aListItems  
+        *	                  are not supported/disabled).
+        *                     E.g. aListItems = EShowDefaultConnection but 
+        *                     Default Connection feature is not enabled.
+        *
+        * @leave KErrNotFound If the selection dialog would have zero 
+        *                     elements caused by filtering out all the 
+        *                     Connection Methods with the aFilterArray
+        *                     and not requesting other list elements by 
+        *                     the aListItems bitfield than an error note
+        *                     is shown and the function call leaves with 
+        *                     KErrNotFound error code. 
+        *                     E.g. 
+        *                       - aListItems = EShowConnectionMethods
+        *                     but all Connection Methods are filtered 
+        *                     out by the aFilterArray.
+        */
+        IMPORT_C TBool RunApplicationSettingsL( 
+                                        TCmSettingSelection& aSelection, 
+                                        TUint aListItems,
+                                        TBearerFilterArray& aFilterArray);
+
+        /**
+        * Launches the Default Connection Radio Button Page
+        * for use in Destinations View
+        * @since 3.1U
+        * @params aSelection User selection.
+        * @returns ETrue if a selection was made
+        */
+        TBool RunDefaultConnecitonRBPageL ( TCmDCSettingSelection& aSelection );
+        
+        /**
+        * Creates and returns a string which contains the default connection name
+        * for use in Destinations View
+        * @since 3.1U
+        * @params aSelection User selection.
+        * @returns the default connection name
+        */        
+        HBufC* CreateDefaultConnectionNameL( TCmDefConnValue aSelection );
+        
+        /**
+        * Enables/Disables AlwaysAsk
+        * 
+        * @param ETrue enables
+        * @since S60 3.2
+        */
+        inline void EnableAlwaysAsk( TBool aEnable ) 
+                                        { iShowAlwaysAsk = aEnable; }
+        
+        /**
+        * Enables/Disables EasyWlan
+        * 
+        * @param ETrue enables
+        * @since S60 3.2
+        */
+        inline void EnableEasyWlan( TBool aEnable )
+                                        { iShowEasyWlan = aEnable; }
+        
+        /**
+        * Enables/Disables VirtualCMs
+        * 
+        * @param ETrue enables
+        * @since S60 3.2
+        */
+        inline void EnableVirtualCMs( TBool aEnable )
+                                        { iShowVirtualCMs = aEnable; }
+        
+        /**
+        * Enables/Disables EmptyDestinations
+        * 
+        * @param ETrue enables
+        * @since S60 3.2
+        */
+        inline void EnableEmptyDestinations( TBool aEnable ) 
+                                        { iShowEmptyDestinations = aEnable; }
+                                        
+        /**
+        * Sets a destination id which should be omitted from the list
+        * typically this will be the parent destination of a virtual CM
+        * 
+        * @param aDestinationId
+        * @since S60 3.2
+        */
+        inline void SetDestinationToOmit( TUint32 aDestinationId )
+                                    { iDestinationToOmit = aDestinationId; }
+        
+        /**
+        * Enables/Disables Ask Once
+        * 
+        * @param ETrue enables
+        * @since S60 3.2
+        */
+        inline void EnableAskOnce( TBool aEnable ) 
+                                        { iShowAskOnce = aEnable; }
+                                        
+        /**
+        * Enables/Disables Uncategorised item
+        * 
+        * @param ETrue enables
+        * @since S60 3.2
+        */
+        inline void EnableUncat( TBool aEnable ) 
+                                        { iShowUncat = aEnable; }
+                                        
+        /**
+        * Enables/Disables Default Connection item
+        * 
+        * @param ETrue enables
+        * @since S60 3.2
+        */
+        inline void EnableDefConn( TBool aEnable ) 
+                                        { iShowDefConn = aEnable; }
+
+
+
+        /**
+        * Sets the array of destinations to be used.
+        * Typically this routine will be used by plugins having 
+        * restrictions on possible destinations.
+        * 
+        * @param aDestinationArray
+        * @since S60 3.2
+        */
+        IMPORT_C void SetDestinationArrayToUseL( RArray<TUint32> aDestinationArray );
+
+        /**
+        * Clear previously passed destinations and return to normal use.
+        *
+        * @since S60 3.2
+        */
+        IMPORT_C void ClearDestinationArrayToUse();
+                                                
+    private:
+
+        CCmConnSettingsUiImpl();
+
+        void ConstructL( CCmManagerImpl* aCCmManagerImpl = NULL );
+
+        TInt LoadResourceL ();
+        
+        /**
+        * Displays a set of destinations for selecting a network connection
+        *
+        * @param aSelection If initialised to a valid value, sets the higlight to the
+        * corresponding list item at startup. If a list of Destinations is displayed, and
+        * the initial highlight is set to a Connection Method, the parent Destination
+        * gets highlighted. On return, holds user selection.
+        * @return soft key selection
+        */
+        TBool ShowConnSelectRadioPageL( TCmDCSettingSelection& aSelection, 
+                        const TInt aTitleStringResource, 
+                        TBearerFilterArray& aFilterArray );
+
+        /**
+        * Displays a the Default Connection/User Defined radio button page 
+        *
+        * @param aSelection If initialised to a valid value, sets the higlight to the
+        * corresponding list item at startup. If a list of Destinations is displayed, and
+        * the initial highlight is set to a Connection Method, the parent Destination
+        * gets highlighted. On return, holds user selection.
+        * @return soft key selection
+        */
+    //    TBool ShowDefConnRadioPageL( TInt& aSelection );
+
+        
+        /**
+        * Return array of destination of which have at least connection method
+        * @param aItems array of destination names
+        */
+        void BuildDestinationArrayL( CDesCArrayFlat* aItems, 
+                                        TBearerFilterArray& aFilterArray );
+
+        /**
+        * Return array of CMs of which have at least connection method
+        * @param aItems array of destination names
+        */
+        void BuildCMArrayL( CDesCArrayFlat* aItems, 
+                            TBearerFilterArray& aFilterArray );
+
+        /**
+        * Put the array of CMs into iConnMethods
+        */
+        void GetCMArrayL( );
+
+        /**
+        * Build uncategorized connection method array and append
+        * 'Uncategorized' item if there's any.
+        * @param aUncatArray array of uncategorized connection method ids.
+        * @param aItems array of destination names
+        */
+        void BuildUncatArrayL( RPointerArray<CCmPluginBase>& aUncatArray,
+                               CDesCArrayFlat* aItems, 
+                               TBearerFilterArray& aFilterArray );
+        /**
+        * Show destination selection dialog.
+        * @param aDestSelected index of selected destination
+        * @param aItems array of destination names
+        * @param aSelection If initialised to a valid value, sets the higlight to the
+        * corresponding list item at startup. If a list of Destinations is displayed, and
+        * the initial highlight is set to a Connection Method, the parent Destination
+        * gets highlighted. On return, holds user selection.
+        * @return ETrue if a selection was made
+        */
+        TBool UserSelectionDlgL( TInt& aDestSelected, 
+                                 CDesCArrayFlat* aItems, 
+                                 TCmDCSettingSelection& aSelection,
+                                 const TInt aTitleStringResource,
+                                 TBool aOpenDestination );
+
+        /**
+        * Show uncategorized connection method selection dialog
+        * @param aUncatArray list of uncategorized connection methods.
+        * @param aSelection If initialised to a valid value, sets the higlight to the
+        * corresponding list item at startup. On return, holds user selection.
+        * @return softkey selection.
+        */
+        TBool UserSelectedUncatItemL( RPointerArray<CCmPluginBase>& aUncatArray,
+                                      TCmDCSettingSelection& aSelection, 
+                                        const TInt aTitleStringResource );
+                                      
+        /**
+        * A radio button page of all the connection methods belonging to
+        * a the specified destination
+        *
+        * @param aDestinationId the destination from which a connection
+        *                       method will be selected
+        * @param aSelection If initialised to a valid value, sets the higlight to the
+        * corresponding list item at startup. On return, holds user selection.
+        * @return soft key selection
+        */
+        TBool ShowConnectionMethodsL( RPointerArray<CCmPluginBase>& aCmArray, 
+                                      TCmDCSettingSelection& aSelection, 
+                                      const TInt aTitleStringResource,
+                                      TBearerFilterArray& aFilterArray );
+
+        /**
+        * Checks if a Connection method is virtual
+        *
+        * @since S60 3.2
+        * @param aCmIapId the iap id of the CM
+        * @return ETrue if virtual
+        */
+        TBool IsCmVirtualL( TUint32 aCmIapId );
+                         
+    private: // data
+
+        /**
+         * pointer to the CmManager - OWNED
+         */
+        CCmManagerImpl* iCmManagerImpl;
+        
+        /**
+         * resource loader
+         */
+        RConeResourceLoader iResourceReader;
+        
+        /**
+         * List of destination or CM IDs to show
+         */ 
+        RArray<TUint32> iItems;
+        /**
+         * Indicates whether iItems holds destinatos or CMs
+         */
+        TBool iAreDestinations;
+                        
+        /**
+         * Indicates whether Always Ask should be shown in the page
+         */
+        TBool iShowAlwaysAsk;
+        
+        /**
+         * Indicates whether EasyWlan should be shown in the page
+         */
+        TBool iShowEasyWlan;
+        
+        /**
+         * Indicates whether virtual iaps should be shown in the page
+         */
+        TBool iShowVirtualCMs;
+        
+        /**
+         * Indicates whether Empty destinations should be shown in the page
+         */
+        TBool iShowEmptyDestinations;
+        
+        /**
+         * Indicates the id of destination to specifically omit (usually a parent destination)
+         * if zero, it can be ignored
+         */
+        TUint iDestinationToOmit;
+        
+        /**
+         * Indicates whether Ask Once item should be shown in the page
+         */
+        TBool iShowAskOnce;
+
+        /**
+         * Indicates whether Uncategorized item should be shown in the page
+         */
+        TBool iShowUncat;
+        
+        /**
+         * Indicates whether Default Connection item should be shown in the page
+         */
+        TBool iShowDefConn;
+                
+        /**
+         * Indicates whether we have an own CmManager that we have to create and destroy
+         */
+        TBool iOwnCmManager;
+
+        /**
+         * Indicates whether the selected destinaton should be opened
+         */
+        TBool iOpenDestination;
+        
+        /**
+        * Indicates whether to use a passed list of destinations 
+        * or use our own algorithm to get the list of possible destinations.
+        */
+        TBool iUsePassedDestinationArray;
+        
+        /**
+        * An Array to hold the passed destinations.
+        */
+        RArray<TUint32> iPassedDestinations;
+        
+        /**
+         * help context
+         */        
+        TCoeContextName iHelpContext;        
+
+        /**
+         * Indicates whether the tables should be created
+         */
+        TBool iCreateTables;
+    };
+#endif // C_CMCONNSETTINGSUIIMPL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Inc/cmdesticondialog.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,97 @@
+/*
+* 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:  Destination icon dialog
+*
+*/
+
+#ifndef CMDESTICONDIALOG_H
+#define CMDESTICONDIALOG_H
+
+#include <AknDialog.h>// <eikdialg.h>
+
+/**
+ * Change Icon table for destinations.Contains all the icon available
+ */
+NONSHARABLE_CLASS(CCmDestinationIconDialog) : public CAknDialog
+    {
+    public:
+
+        /**
+        * Destinations change Icon table constructor. 
+        *
+        * @param aIconIndex selected icon index. 
+        *
+        */
+        CCmDestinationIconDialog( TInt& aIconIndex );
+
+        /**
+        * Destinations change Icon table destructor. 
+        * C++ destructor
+        */
+        ~CCmDestinationIconDialog();
+
+    public: // from CEikDialog
+
+        /**
+        * Prepares and runs the dialog and returns the id of the button used to 
+        * dismiss it. The dialog is constructed from the resource with id 
+        * aResourceId and is destroyed on exit.
+        *
+        * @return Id of the button used to dismiss dialog.
+        */
+        TInt ExecuteLD();
+        
+#ifdef RD_SCALABLE_UI_V2
+
+	    //From MCoeControlObserver
+	    void HandleControlEventL( CCoeControl* aControl,
+	                              TCoeEvent aEventType );
+	    void HandleDialogPageEventL( TInt aEventID );
+	    
+#endif // RD_SCALABLE_UI_V2 	
+
+    public: // from CCoeControl
+
+        TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, 
+                                      TEventCode /*aType*/ );
+        void HandleResourceChange(TInt aType);
+        SEikControlInfo CreateCustomControlL(TInt aControlType);
+
+    protected: // from CEikDialog
+    
+         virtual TBool OkToExitL(TInt);
+         virtual void PreLayoutDynInitL();
+         virtual void SetSizeAndPosition(const TSize& aSize);
+
+    private: 
+
+         virtual void CEikDialog_Reserved_1();
+         virtual void CEikDialog_Reserved_2();
+
+    private: // new function
+    
+         virtual void CAknIconMapDialog_Reserved();
+
+    private:
+    
+        TInt* iIconIndex;
+
+#ifdef RD_SCALABLE_UI_V2     
+
+    	TBool iConSelected;
+
+#endif // RD_SCALABLE_UI_V2  
+    };
+
+#endif  // LMKICONDIALOG_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Inc/cmdesticonmap.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,251 @@
+/*
+* 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:  Destination icon map
+*
+*/
+
+#ifndef CMDESTICONMAP_H
+#define CMDESTICONMAP_H
+
+#include <coecntrl.h>
+#include <AknUtils.h>
+#include <gulicon.h>
+#include <AknIconArray.h>
+
+
+class CCmDestinationIconMapExtension;
+class CEikScrollBarFrame;
+class CCmDestinationIconMapExtension;
+
+
+/**
+ * Change Icon Dialog table Destination UI.
+ *
+ */
+NONSHARABLE_CLASS(CCmDestinationIconMap) : public CCoeControl
+                                         , public MEikScrollBarObserver
+    {
+    public: 
+        
+        /** 
+        * CCmDestinationIconMap two phase constructor
+        */
+        static CCmDestinationIconMap* NewL();    
+        
+        /** 
+        * CCmDestinationIconMap destructor
+        */
+         ~CCmDestinationIconMap();
+        
+        /** 
+        * CCmDestinationIconMap resource constructor.
+        * @param aReader Icon Dialog table Resource
+        */
+         void ConstructFromResourceL( TResourceReader& aReader );
+
+        /**
+        * Number of rows in the icon table.
+        * @return Number of rows in icon table.
+        */
+         TInt HeightInRows();
+        
+        /**
+        * Create the scrollbar Ptr and set the No of Rows in the 
+        * Icon table depends upon the Icon array count.
+        */
+         void CreateScrollBarAndIconRowL();
+        
+        /**
+        * Sets reference to the index where selected icon index is put.
+        * @param aIconIndex Reference to the integer where selected icon 
+        * index is put.
+        */
+         void SetIndex(TInt& aIconIndex);
+
+    private:
+    
+        /** 
+        * CCmDestinationIconMap constructor
+        */
+         CCmDestinationIconMap();
+
+        /** 
+        * CCmDestinationIconMap two phase constructor
+        */
+        void ConstructL();
+        
+    public: // from CCoeControl
+    
+         TSize MinimumSize();
+         TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode);
+         TCoeInputCapabilities InputCapabilities() const;
+         virtual void ActivateL();
+
+#ifdef RD_SCALABLE_UI_V2
+
+ 	    void HandlePointerEventL( const TPointerEvent& aPointerEvent );
+ 	    void SetObserver( MCoeControlObserver* aObserver  );
+ 	    
+#endif //RD_SCALABLE_UI_V2
+
+    protected: // from CCoeControl
+    
+         void SizeChanged();
+         void HandleResourceChange(TInt aType);
+         TInt CountComponentControls() const;
+         CCoeControl* ComponentControl(TInt aIndex) const;
+
+    public: 
+
+        /**
+        * DrawOffscreenBackgroundIfRequired().
+        *
+        * @Description:Draw the offscreen bitmap if applicable.
+        *              Specially in case of Skin change
+        */
+        void DrawOffscreenBackgroundIfRequired() const;
+
+        /**
+        * DoLayout()
+        * @Description: Sets the Layout of the Icon table.
+        */
+        void DoLayout();
+
+    private:
+    
+        /**
+        * Draw().
+        *
+        * @Description:
+        */
+        void Draw(const TRect& aRect) const;
+
+        /**
+        * DrawItem().
+        *
+        * @Description:
+        */
+        void DrawItem( CWindowGc& aGc,
+                       const TRect& aSctPosition,
+                       TInt aIconIndex,
+                       TBool aHighlighted,
+                       TBool aDrawBackground ) const;
+
+        /**
+        * DrawCursor().
+        *
+        * @Description:
+        */
+        void DrawCursor() const;
+        
+        /**
+        * MoveCursorL().
+        *
+        * @Description:
+        */
+        void MoveCursorL( TInt aX, TInt aY );
+
+        /**
+        * DrawCell().
+        *
+        * @Description:
+        */
+        void DrawCell( TInt aCursorPos, TBool aHighLighted ) const;
+        
+        /**
+        * CursorRect().
+        *
+        * @Description:
+        */
+        TRect CursorRect( TInt aCursorPos ) const;
+        
+        /**
+        * CursorPoint().
+        *
+        * @Description:
+        */
+        TPoint CursorPoint( TInt aCursorPos ) const;
+
+        /**
+        * UpdateScrollIndicatorL().
+        *
+        * @Description:
+        */
+        void UpdateScrollIndicatorL();
+
+        /**
+        * CountMaxColumnsAndCellSizes().
+        *
+        * @Description:
+        */
+        void CountMaxColumnsAndCellSizes();
+
+        /**
+        * LoadIconL().
+        * This fucton leaves if the client does not have a valid UI context
+        *
+        * @Description:
+        */
+        void LoadIconL();
+
+        /**
+        * Extension().
+        *
+        * @Description:
+        */
+        CCmDestinationIconMapExtension* Extension() const;        
+     
+    private: //from CCoeContrl
+
+        void Reserved_1();
+        void Reserved_2();
+        
+    public:
+
+        void HandleScrollEventL( CEikScrollBar* aScrollBar, 
+                                 TEikScrollEvent aEventType);
+
+    private:
+        TInt                iGridItemWidth;
+        TInt                iGridItemHeight;
+        TBool               iIsMirrored;
+        TInt                iRows;
+        TInt                iFirstVisibleRow;
+        TPoint              iOffset;
+        TPoint              iGridTopLeft;
+
+        TPoint              iCursorPos;
+        TPoint              iOldCursorPos;
+        mutable TBool       iDrawnBefore;
+
+        CEikScrollBarFrame* iSBFrame;
+        TInt*               iIconIndex;
+
+        TBool               iAnimated;
+
+        CFbsBitmap*         iOffscreenBg;
+        CFbsBitmapDevice*   iBitmapDevice;
+        CFbsBitGc*          iBitmapGc;
+        TBool               iHasBitmapBackground;
+        mutable TBool       iOffscreenBgDrawn;
+
+        TInt                iMaxColumns;
+        TInt                iCurrentPage;
+        TInt                iNumPages;
+        CCmDestinationIconMapExtension*   iExtension;
+        CArrayPtr<CGulIcon>*  iConsArray;
+        TBool               iDragAlreadyActive;
+    };
+
+#endif // __CMDESTICONMAP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Inc/cmdestinationimpl.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,992 @@
+/*
+* 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 destination class.
+*
+*/
+
+#ifndef DESTINATIONIMPL_H
+#define DESTINATIONIMPL_H
+
+// User includes
+#include "cmmanager.hrh"
+#include <cmmanagerdef.h>
+
+// System includes
+#include <e32def.h>
+#include <e32base.h>
+#include <metadatabase.h>
+#include <commsdattypesv1_1.h>
+
+// CONSTANTS
+const TInt KCmInitIndex =  1;
+const TInt KNumOfIcons = 12;
+
+#define RECORD_FROM_ELEMENT_ID( elementId ) \
+                                    (( elementId & KCDMaskShowRecordId ) >> 8 )
+
+enum TSnapMetadataProtecionLevel
+    {
+    EProtectionLevel0 = 0x00000000,
+    EProtectionLevel1 = 0x10000000,
+    EProtectionLevel2 = 0x20000000
+    };
+    
+#define KSnapMetadataProtecionLevelMask 0xF0000000;
+
+// DATA TYPES    
+    
+// FORWARD DECLARATIONS
+class CCmManagerImpl;
+class CCmPluginBaseEng;
+class CCmPluginBase;
+class TCmPluginInitParam;
+class CPluginItem;
+class CCDDataMobilitySelectionPolicyRecord;
+class CGulIcon;
+class CCmTransactionHandler;
+class CCDSNAPMetadataRecord;
+
+typedef CArrayPtrFlat<CPluginItem> CCmArray;
+
+#define KFlagRemove 0x00000001
+
+typedef CCDDataMobilitySelectionPolicyRecord CCDSnapRecord;
+
+const TUint32 KCmDefaultDestinationAPTagId = 0x1000;
+
+// CLASS DECLARATION
+NONSHARABLE_CLASS(CPluginItem) : public CBase
+    {
+    public:
+    
+        enum
+            {
+            ERemoveCm   = 0x00000001
+            };
+            
+    public:
+        
+        CCDSnapRecord*     iDNRecord;
+        CCmPluginBase*   iPlugin;
+        TUint32             iFlags;
+    };        
+
+/**
+ * Holds all the destination specific data of the CCmDestinationImpl
+ * This class is put in the object pool and may be shared
+ * among CCmDestinationImpl objects
+ */
+NONSHARABLE_CLASS( CCmDestinationData ): public CBase
+    {
+    //=====================================================================
+    // Constructors/Destructors
+    // 
+    public:
+        CCmDestinationData( CCmManagerImpl& aCmMgr );
+        ~CCmDestinationData();
+        /**
+        * Increments the reference counter. Used by the object pool.
+        */
+        void IncrementRefCounter();
+        /**
+        * Increments the reference counter. Used by the object pool.
+        */
+        void DecrementRefCounter();
+    private:
+        /**
+        * Reset and, if needed, destroy the passed array.
+        * @since S60 3.2
+        * @param aArray array to be reseted and deleted
+        * @parar aDestroy ETrue if array has to be deleted
+        */
+        void ResetAndDestroyArray( CCmArray* &aArray, TBool aDestroy );
+        
+    public:
+        /**
+        * Returns the number of connection methods of the destination
+        * @param None
+        * @return TInt        
+        */                  
+        TInt ConnectionMethodCount();
+        
+        /**
+        * Returns the destination's Id attribute
+        * @param None
+        * @return TUint32        
+        */            
+        inline TUint32 Id(){return iDestAPRecord->iRecordTag;};
+                
+        /**
+        * Returns the destination's ElementId attribute
+        * @param None
+        * @return TUint32        
+        */            
+        inline TUint32 ElementId() 
+        { return iNetworkRecord->ElementId() & KCDMaskShowField;};
+    
+        /**
+        * Returns that the destination is protected or not.
+        * @return protection level   
+        */
+        CMManager::TProtectionLevel ProtectionLevel();
+        
+        /**
+        * Returns that the destination is hidden or not.
+        * @param None
+        * @return TBool   
+        */
+        TBool IsHiddenL(); 
+
+        /**
+        * Indicates if the Id is valid or if this is a new object which sitll
+        * haven't been updated. 
+        * Used by the object pool.
+        * @return TBool
+        */
+        TBool IdIsValid();
+
+        /**
+        * Returns the reference counter. Used by the object pool.
+        * @return TInt
+        */
+        TInt GetRefCounter();
+        /** 
+        * Returns pointer to the CmManager object
+        * Used in 'R' classes
+        */
+        CCmManagerImpl* Cmmgr();
+
+        /**
+        * Returns the Metadata
+        * @param None
+        * @return TUint32        
+        */            
+        TUint32 MetadataL( CMManager::TSnapMetadataField aMetaField ) const;
+
+    private:
+        CCmManagerImpl&               iCmMgr;         //< Not owned
+        CommsDat::CCDNetworkRecord*   iNetworkRecord;
+                
+        //To store Connection methods that belong to this destination
+        CCmArray* iConnMethodArray;
+        CCmArray* iDeleteCmArray;
+        
+        // DN_IAP Table has to be update if
+        // - new CM is added to the destination
+        // - CM is delete from the destination
+        // - CM priority modified
+        TBool iDNTableChanged;
+        
+        //Protection changed
+        TBool   iProtectionChanged;
+        //The last protection level of the destination
+        TUint   iLastProtectionLevel;
+        
+        CCDSNAPMetadataRecord* iMetaDataRec;
+        //Reference counter for the object pool
+        TInt                iRefCounter;
+        //indicates if the Id is valid or not (for the object pool)
+        TBool               iIdIsValid;                
+        CommsDat::CCDAccessPointRecord* iDestAPRecord;
+
+        friend class CCmDestinationImpl;
+        friend class CCmManagerImpl;
+        TBool               iNewWithId;
+    };
+/**
+ *  RCmDestination is for getting/setting values of a network destination.
+ *  @lib cmmanager.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CCmDestinationImpl ) : public CBase
+    {
+    public:
+    //=====================================================================
+    // Constructors/Destructors
+    // 
+    public:
+    
+        /** Destructor. */
+        ~CCmDestinationImpl();
+        
+        /** Epoc constructor 
+        * This should be used only by the object pool
+        */
+        IMPORT_C static CCmDestinationImpl* NewL( CCmManagerImpl& aCmMgr,
+                                                  const TDesC& aName );
+        
+        /** Epoc constructor 
+        * This should be used only by the object pool
+        */
+        static CCmDestinationImpl* NewL( CCmManagerImpl& aCmMgr,
+                                         CCmDestinationData* aData );
+        
+        /** Epoc constructor 
+        * This should be used only by the 'R' classes
+        */
+        static CCmDestinationImpl* NewLC( CCmDestinationData* aData );
+        
+        /** Epoc constructor 
+        * This should be used only by the object pool
+        */
+        IMPORT_C static CCmDestinationImpl* NewL( CCmManagerImpl& aCmMgr,
+                                                  TUint aDestinationId );
+        
+    public:
+        /** 
+        * Returns pointer to the CmManager object
+        * Used in 'R' classes
+        */
+        CCmManagerImpl* Cmmgr();
+        //=====================================================================
+        // Conn method handling
+        
+        /**
+        * Create a connection method belonging to the destination
+        * @param aImplementationUid - implementation uid of the connection 
+        * method
+        * @return CCmPluginBaseEng*
+        */
+        CCmPluginBase* CreateConnectionMethodL( TUint32 aBearerType );
+
+        /**
+        * Create a connection method belonging to the destination
+        * @param aBearerType - implementation uid of the connection 
+        * method
+        * @param aConnMethId - Predefined id for the connection method.
+        * @return CCmPluginBaseEng*
+        */
+        CCmPluginBase* CreateConnectionMethodL( TUint32 aBearerType,
+                                                TUint32 aConnMethId );
+        /*
+        * Adds an existing connection method to a destination
+        * @param
+        * @return TInt - index in the Connection Method list
+        */
+        TInt AddConnectionMethodL( CCmPluginBase& aConnectionMethod );
+        
+        /*
+        * Embeds an existing destination to the destination
+        * @param CCmDestinationImpl - Destinatio to be embedded
+        * @return TInt - index in the Connection Method list
+        */
+        TInt AddEmbeddedDestinationL( CCmDestinationImpl& aDestination );        
+        
+        /**
+        * Remove a connection method from a destination and delete it
+        * on update. 
+        * Exception: conenction method is not deleted  if it's referenced 
+        * from any other destination.
+        * @param aConnectionMethod the connection method to be deleted
+        * @return none.
+        */
+        void DeleteConnectionMethodL( CCmPluginBase& aConnectionMethod ); 
+    
+        /**
+        * Remove connection method from the destination
+        * @param aConnectionMethod connection method to be removed
+        */
+        void RemoveConnectionMethodL( const CCmPluginBase& aConnectionMethod );
+    
+        /**
+        * Remove connection method from the destination
+        * @param aConnectionMethod connection method to be removed
+        */
+        void RemoveConnectionMethodL( const CCmPluginBaseEng& aConnectionMethod );
+        
+        /**
+        * Notification from child plugin that it was deleted.
+        * Remove it from the array and update priorities.
+        * @param aConnectionMethod child connection method that was deleted.
+        */
+        void ConnectionMethodDeletedL( const CCmPluginBase& aConnectionMethod );
+        
+        /**
+        * Set the CCMItem's priority based on the passed new index
+        * @param aCCMItem The connection method item
+        * @param aIndex The new index of the item in the list
+        */
+        void ModifyPriorityL( CCmPluginBase& aCCMItem, TUint aIndex );
+
+        /**
+        * Obsolete 
+        */
+        TUint PriorityL( CCmPluginBaseEng& aCCMItem );
+
+        /**
+        * Return the priority of the passed connection method
+        * @param aCCMItem queried connection method
+        * @return the priority of the queried connection method 
+        */
+        TUint PriorityL( CCmPluginBase& aCCMItem );
+        
+        /**
+        * Returns the number of connection methods of the destination
+        * @param None
+        * @return TInt        
+        */                  
+        IMPORT_C TInt ConnectionMethodCount();
+        
+        //Operator
+
+        /**
+        * Obsolete
+        */
+        IMPORT_C CCmPluginBaseEng* ConnectionMethodL( TInt anIndex );
+
+        /**
+        * Returns a reference to the connection method. 
+        * The index must be less than the return value of ConnMethodCount()
+        * @param anIndex
+        * @return plugin instance - ownership NOT passed
+        */         
+        IMPORT_C CCmPluginBase* GetConnectionMethodL( TInt anIndex );
+
+        /**
+        * Returns a reference to the connection method. 
+        * The index must be less than the return value of ConnMethodCount()
+        * @param anIapId IAP id of the queried connection method
+        * @return plugin instance - ownership NOT passed
+        */         
+        CCmPluginBase* ConnectionMethodByIDL( TUint32 anIapId );
+
+        void ConnectMethodIdArrayL( RArray<TUint32>& aCmIds );
+        
+        //Getting attributes
+
+        /**
+        * Returns the destination's Name attribute
+        * HBuf ownership is passed to the caller
+        * @param None
+        * @return name of the destination. ownership is passed.
+        */      
+        IMPORT_C HBufC* NameLC();                        
+        
+        /**
+        * Returns the destination's Id attribute
+        * @param None
+        * @return TUint32        
+        */
+        inline TUint32 Id(){return iData->Id();};
+
+        /**
+        * Returns the destination's ElementId attribute
+        * @param None
+        * @return TUint32
+        */            
+        inline TUint32 ElementId(){ return iData->ElementId();};
+     
+        /**
+        * Returns the Icon pointer
+        * This fucton leaves if the client does not have a valid UI context
+        * @param None
+        * @return TUint32  
+        */ 
+        IMPORT_C CGulIcon* IconL();
+
+        /**
+        * Returns the Metadata
+        * @param None
+        * @return TUint32        
+        */            
+        TUint32 MetadataL( CMManager::TSnapMetadataField aMetaField ) const;
+        
+        /**
+        * Returns if there's connection created with any of the destination's
+        * connection method.
+        * @return ETrue if there's connection with any of the destination's
+        * connection method.
+        */
+        IMPORT_C TBool IsConnectedL() const;
+
+        //=====================================================================
+        //Setting Attributes
+        
+        /**
+        * Set the destination's Name attribute. Leaves if the name already 
+        * exists
+        * @param aDestinationName value to set
+        * @return None   
+        */
+        IMPORT_C void SetNameL( const TDesC& aName );
+           
+        /**
+        * Set the destination's Icon index.
+        * This fucton leaves if the client does not have a valid UI context
+        * @param aIconIndex value to set
+        * @return None   
+        */
+        IMPORT_C void SetIconL( TUint32 anIndex );
+    
+        /**
+        * Set the Metadata
+        * @param aMetaField field to be modified
+        * @param aValue value to be set
+        */            
+        void SetMetadataL( CMManager::TSnapMetadataField aMetaField, 
+                           TUint32 aValue );    
+    
+        /**
+        * Returns that the destination is protected or not.
+        * @return protection level   
+        */
+        IMPORT_C CMManager::TProtectionLevel ProtectionLevel();
+        
+        /**
+        * Set the protection of the destination.
+        * @param aProtectionLevel
+        * @return None   
+        */
+        IMPORT_C void SetProtectionL( CMManager::TProtectionLevel aProtectionLevel );
+        
+        /**
+        * Update all the attributes of the Connection Methods and the 
+        * Destination.
+        * @return None   
+        */        
+        IMPORT_C void UpdateL();         
+    
+        /**
+        * Deletes it's connection methods from comms.dat (unless shared)
+        * then deletes itself
+        */
+        IMPORT_C void DeleteLD();
+        
+        /**
+        * Performs RollbackTransactionL().
+        */
+        void Close();
+        
+        /**
+        * Set iPlugin to NULL in plugin array, but not delete it.
+        * Next reference to this connection method will load the
+        * plugin again.
+        */
+        void PluginClosed( CCmPluginBase* aPlugin );
+        
+        /**
+        * Returns that the destination is hidden or not.
+        * @param None
+        * @return TBool   
+        */
+        IMPORT_C TBool IsHidden(); 
+        
+        /**
+        * Set that the destination is hidden or not.
+        * @param aHidden - True if it is hidden.
+        * @return None   
+        */
+        IMPORT_C void SetHiddenL( TBool aHidden );         
+        
+        /**
+        * Check if the destination element id is already embeded.
+        * Leaves with KErrNotSupported (multiple levels of embedding is not 
+        * supported)
+        */
+        void CheckIfEmbeddedL( TInt aId );
+        
+        
+        static CGulIcon* IconIdL( CCmManagerImpl& aCmMgr,
+                                  CommsDat::TMDBElementId aId );
+                
+        static CMManager::TProtectionLevel ProtectionLevelL( CCmManagerImpl& aCmMgr,
+                                                  CommsDat::TMDBElementId aId );
+        
+        /**
+        * Removes this destination from the object pool.
+        */
+        IMPORT_C void RemoveFromPool();
+
+        /**
+        * Increments the reference counter. Used by the object pool.
+        */
+        void IncrementRefCounter();
+        /**
+        * Increments the reference counter. Used by the object pool.
+        */
+        void DecrementRefCounter();
+        /**
+        * Returns the reference counter. Used by the object pool.
+        * @return TInt
+        */
+        TInt GetRefCounter();
+
+        /**
+        * Returns iData. Used by the object pool and the API oprators.
+        * @return TInt
+        */
+        CCmDestinationData* GetData();
+        /**
+        * Used by the object pool and the API oprators.
+        */
+        void SetData(CCmDestinationData* aData);
+        /**
+        * Indicates if the Id is valid or if this is a new object which sitll
+        * haven't been updated. 
+        * Used by the object pool.
+        * @return TBool
+        */
+        TBool IdIsValid();
+
+        /**
+        * Returns pointer to embedded destination if there is any
+        * @return CCmDestinationImpl* Pointer to embedded destination
+        * Contains NULL if there is no destination embedded
+        */        
+        CCmDestinationImpl* EmbeddedL();
+        
+        /**
+        * Checks if this destination plus a possible embedded destinaion
+        * contains a connection method which can be used for a connection
+        * Doesn't check VPNs!
+        * @return TBool ETrue if this destination or a destination embedded into
+        * it contains a connection method. Otherwise returns EFalse
+        */            
+        TBool CanUseToConnectL();
+        
+        
+        /**
+        * Reload connection method under this destination so as to
+        * keep synchronization with CommsDat
+        */
+        void ReLoadConnectionMethodsL();
+
+        /** Epoc constructor 
+        * This should be used only by the object pool
+        */
+        static CCmDestinationImpl* NewL( CCmManagerImpl& aCmMgr,
+                                         const TDesC& aName,
+                                         TUint32 aDestId);
+                                         
+
+        /**
+        * Returns the Id of this Destination which is used to identify the Destination.
+        * It is the Id saved to Destination Access Point's Tag field.
+        */            
+        TUint32 GetDestinationAPTagId();
+
+        /**
+        * Checks if this destination already contains the given Connection Method
+        * @param aConnectionMethod Connection Method to be checked whether it 
+        * already exists.
+        * @return TBool ETrue if this Destination contais already the given CM. If the
+        * Destination does not contain the given CM returns EFalse. Otherwise leaves
+        * with system-wide error code.
+        */            
+        TBool CheckIfCMExistsL( CCmPluginBase& aConnectionMethod );
+
+            
+    //=========================================================================
+    // Construction
+    //
+    private:    
+    
+        /**
+        * Default constructor. 
+        * @param aCmManager connection method manager
+        */
+        CCmDestinationImpl( CCmManagerImpl& aCmMgr );
+
+        /*
+        * Create a new destination with the specified name
+        */
+        void ConstructL( const TDesC& aName );
+
+        void ConstructL( const TDesC& aName, TUint32 aDestId );
+
+        /*
+        * Create a destination and initializes it 
+        * from the commsdat based on the id
+        */
+        void ConstructL( TUint aDestinationId );
+
+    //=========================================================================
+    // New functions
+    //
+    private:
+                          
+        /**
+        * Check if the destination contains and embedded destination
+        * @since S60 3.2
+        * @return ETrue if the destination contains and embedded destination   
+        */
+        TBool HasEmbeddedL();        
+    
+        /**
+        * - Check if transaction is already opened
+        * - Set iOwnTransaction is not and opens it and
+            put 'this' on cleanup&close stack
+        */
+        void OpenTransactionLC();
+        
+        /**
+        * - Check if the transaction is ours.
+        * - If yes, commits the transaction.
+        * - anyway does nothing
+        * @praram aError - error id
+        */
+        void CommitTransactionL( TInt aError );
+        
+        /**
+        * Rollback transaction.
+        */
+        void RollbackTransaction();
+
+        /**
+        * Returns the CommsDat session.
+        * Do not close!
+        * @return commsdat session
+        */
+        CommsDat::CMDBSession& Session()const;
+        
+        /**
+        * Find the connection method in iConnMethodArray.
+        * @param aConnectionMethod connection method to be searched for
+        * @return index of the found item
+        */
+        TInt FindConnectionMethodL( const CCmPluginBase& aConnectionMethod );
+        
+        /**
+        * Find the connection method in iConnMethodArray.
+        * @param aConnectionMethod connection method to be searched for
+        * @return index of the found item
+        */
+        TInt FindConnectionMethodL( const CCmPluginBaseEng& aConnectionMethod );
+        
+        /**
+        * Update protection attributes of every connection method if changed.
+        */
+        void UpdateProtectionL();
+
+        /**
+        * Update every connection method.
+        */
+        void UpdateConnectionMethodsL();
+        
+        /**
+        * Create or update the record of the network table for this 
+        * destination.
+        */
+        void UpdateNetworkRecordL();
+
+        /**
+        * Update the SNAP table
+        */
+        void UpdateSNAPTableL();
+        
+        /**
+        * Update the SNAP Metadata table
+        */        
+        void UpdateSNAPMetadataTableL();
+        
+        /**
+        * Load network record. Destination id is passed, because
+        * id is from the client application, and destinaion id
+        * is the network id for them. :)
+        * @param aDestinationId network record id
+        */        
+        void LoadNetworkRecordL( TUint32 aDestinationId );
+
+        /**
+        * Load Destination AP record. Destination id is passed, because
+        * id is from the client application, and destinaion id
+        * is the network id for them. :)
+        * @param aDestinationId network record id
+        */        
+        void LoadDestAPRecordL( TUint32 aDestinationId );
+
+        /**
+        * Load connection methods of the destination
+        */        
+        void LoadConnectionMethodsL();
+        
+        /**
+        * Load SNAP Metadata table
+        */        
+        void LoadSNAPMetadataTableL();        
+        
+        /**
+        * Create a connection method belonging to the destination
+        * @param aImplementationUid - implementation uid of the connection 
+        * method
+        * @param aParams - plugin init param
+        * @return CCmPluginBaseEng*
+        */        
+        CCmPluginBase* CreateConnectionMethodL( TUid aImplementationUid, 
+                                                   TCmPluginInitParam& aParams );
+                
+        /**
+        * Compare two records from DNIAP by their priority field.
+        * @param aLeft one record from DN_IAP table.
+        * @param aRight one record from DN_IAP table.
+        * @return
+        *   - negative value, if aLeft is less than aRight;
+        *   - 0,              if aLeft equals to aRight;
+        *   - positive value, if aLeft is greater than aRight.
+        */
+        static TInt SortRecordsByPriority( const CommsDat::CMDBRecordBase& aLeft, 
+                                           const CommsDat::CMDBRecordBase& aRight);
+        
+        /**
+        * Add an item to the Connection Method array based on bearer priority 
+        * table.
+        * @param aItem An item to be added.
+        * @return TInt the index of the added item. The array contains an initial item,
+        * so always SUBTRACT KCmInitIndex to get the connection method index number!!!
+        */        
+        TInt AddToArrayL( CPluginItem* aItem );
+        
+        /**
+        * IAP is considered to be removed from the commsdat by third 
+        * party (someone else external).
+        * Seamlessness entries should also be removed.
+        * @param aIapId Iap was removed        
+        */        
+        void CleanUpSeamlessnessTableL( TUint32 aIapId );
+        
+        /**
+        * Embedded dest is considered to be removed from the commsdat 
+        * by third party (someone else external).
+        * Snap Metadata entries should also be removed.
+        * @param aSnap Id was removed        
+        */          
+        void CleanUpSnapMetadataTableL( TUint32 aSnap );        
+        
+        /**
+        * Embedded dest is considered to be removed from the commsdat 
+        * by third party (someone else external).
+        * Snap Metadata entries should also be removed.
+        * @param aSnap Id was removed        
+        */          
+        void CleanUpEmbeddedL( TUint32 aDestId );        
+        
+        /**
+        * Create and load plugin.
+        * @param item where plugin has to be loaded.
+        */
+        void LoadPluginL( CPluginItem& aItem );
+        
+        
+        /**
+        * Create embedded destination plugin.
+        * @param aItem - plugin item
+        * @param TUint32 destination id
+        */        
+        void CreateEmbeddedDestinationPluginL( CPluginItem& aItem, 
+                                               TInt aDestinationId );
+        /**
+        * Load embedded destination plugin.
+        * @param aItem - plugin item
+        */        
+        void LoadEmbeddedDestinationPluginL( CPluginItem& aItem );
+        
+        /**
+        * Check if there is destination with this name. 
+        * Leaves with KErrAlreadyExists if name already exists
+        * @param aName destination name
+        */        
+        void CheckIfDestinationNameExistL( const TDesC& aName );
+        
+        /**
+        * Set or clear attribute
+        * @aRecord record of which the attribute is to be set or clear
+        * @aAttribute attribute to be set or clear
+        * @aSet ETrue to set
+        */        
+        void SetAttribute( CommsDat::CMDBRecordBase* aRecord, 
+                           TUint32 aAttribute, 
+                           TBool aSet );
+
+
+        /**
+        * Delete all connection methods.
+        * @since S60 3.2
+        */
+        void DeleteConnectionMethodsL();
+        
+        /**
+        * Reference to a non-existing IAP found in the SNAP table.
+        * Remove the SNAP record and the metadata record of this
+        * IAP. IAP is most probably deleted by APEngine.
+        * @param aSnapRecord SNAP record point to a non-existing IAP
+        */
+        void DeleteIAPRecordsL( CommsDat::CMDBRecordBase* aSnapRecord );
+        
+        /**
+        * Check if the name of the passed record is the same as the name of 
+        * network one, and update it if not.
+        * @param aRecord record to be checked and updated if needed
+        */
+        void CheckIfNameModifiedL( CCDSnapRecord* aRecord );
+        
+        /**
+        * Checks if there's another SNAP with Internet bit set.
+        * Leaves with KErrAlreadyExists if so.
+        */
+        void CheckIfInternetExistsL();
+        
+        /**
+        * Return the index value of the connection method.
+        * @param aCmId id of the connection method
+        * @return index value in iConnMethodArray
+        */
+        TInt ConnectionMethodIndex( TUint32 aCmId );
+        
+        /**
+        * Retrieves the base of the priority counts in cm list
+        * It is the data of the plugin in case of none VPN.
+        * It is the data of the underlying cm in case of VPN over cm.
+        * It is "wildcard" in case of VPN over destination. 
+        * aRetBearer and aRetExtLevel are not filled in this case 
+        * @param aItem the plugin list item which data is get
+        * @param aRetPrio the default priority of the cm in return
+        * @param aRetBearer the bearer of the cm in return
+        * @param aRetExtLevel the extenson level of the cm in return
+        * @return ETrue if the cm is virtual else EFalse
+        */
+        TBool PrioDataL( CPluginItem* aItem, TUint32& aRetPrio, 
+                        TUint32& aRetBearer, TUint32& aRetExtLevel );
+                        
+                            
+                            
+        /**
+        * Determines the position of the inserted item into the cm list.
+        * This determination is based on the similarity of the bearer types.
+        * The inserted position is just after the last item with the
+        * same bearer type and virtuality - if exist else -1. 
+        * @param aBearerType bearer type od the inserted cm
+        * @param aIsVirtual virtuality of the inserted cm 
+        * @return The position in the cm list where the item should be inserted.
+        * If there is no cm with same bearer type in the list then it
+        * returns -1;
+        */
+        TInt InsertSameMethodL( TUint32 aBearerType, TBool aIsVirtual );
+
+        /**
+        * Determines the position of the inserted item into the cm list.
+        * This determination is based on the priority and the extension
+        * level of the cm's. 
+        * @param aPrio default bearer type of the inserted cm
+        * @param aExtLevel extension level of the inserted cm 
+        * @return The position in the cm list where the item should be inserted.
+        */
+        TInt InsertPriorityMethodL( TUint32 aPrio, TUint32 aExtLevel );
+                                 
+        /**
+        * Checks if there's another SNAP with the same localised bit set.
+        * Leaves with KErrAlreadyExists if so.
+        */
+        void CheckIfLocalisedDestExistL( TUint32 aValue );
+
+        /**
+        * Checks if there's another SNAP with the same purpose bit set.
+        * Leaves with KErrAlreadyExists if so.
+        */
+        void CheckIfPurposeExistL( TUint32 aValue );
+
+        static CGulIcon* IconL( TInt aIconIndex );
+        static CMManager::TProtectionLevel ProtectionLevel( CCDSNAPMetadataRecord* aMetaDataRec );
+
+        /**
+        * Deletes all the recordsrelated to this Destination to be
+        * deleted.
+        * @param None
+        * @return        
+        */
+        void DeleteRelatedRecordsL( TInt aCount );
+
+        /**
+        * Checks if this(current) destination is referenced by any
+        * Virtual Connection Method.
+        * @param None
+        * Leaves with KErrLocked if it's referenced.
+        */
+        void CheckIfReferencedByVirtualCML();
+
+        /**
+        * Initializes the Destination AccessPoint record
+        * deleted.
+        * @param aDestAPRecord Record to be initialized
+        * @return
+        */
+        void InitializeDestAPRecordL();
+
+        /**
+        * Sets the given (tag)id to the accesspoint record
+        * @param aDestId Id to be set
+        * @return
+        */
+        void SetIdL( TInt aDestId );
+
+        /**
+        * Checks that there isn't any destination with the given (tag)id.
+        * @param aDestId Id to be checked
+        * @return
+        */
+        void CheckIfDestinationIdExistsL( TUint32 aDestId );
+
+        /**
+        * Create or update the record of the accesspoint table for this 
+        * destination.
+        */
+        void UpdateDestAPRecordL();
+
+        /**
+        * Creates an unique (tag)id to the record of the accesspoint table for this 
+        * destination.
+        */
+        TUint32 CreateDestinationAPTagIdL();
+
+        /**
+        * Sets the default Tier Manager to the accesspoint record for this 
+        * destination.
+        */
+        void SetDefaultTierManagerL();
+
+        /**
+        * Sets the default Meta Connection Provider to the accesspoint record for this 
+        * destination.
+        */
+        void SetDefaultMCprL();
+
+        /**
+        * Sets the default Connection Provider to the accesspoint record for this 
+        * destination.
+        */
+        void SetDefaultCprL();
+
+        /**
+        * Sets the default Subconnection Provider to the accesspoint record for this 
+        * destination.
+        */
+        void SetDefaultSCprL();
+
+        /**
+        * Sets the default Protocol to the accesspoint record for this 
+        * destination.
+        */
+        void SetDefaultProtocolL();
+        
+    //=========================================================================        
+    // Member variables
+    //
+    private: 
+        CCmManagerImpl&     iCmMgr;         //< Not owned
+        CCmDestinationData* iData;
+    private:
+    
+        friend class CCmManagerImpl;
+    };
+    
+#endif // DESTINATIONIMPL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Inc/cmdlg.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,279 @@
+/*
+* 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:  Dialog for setting the gateway. It's used temporarily.
+*
+*/
+
+#ifndef CMDIALOG_H
+#define CMDIALOG_H
+
+//  INCLUDES
+
+#include <AknForm.h>
+#include <AknInfoPopupNoteController.h>
+#include "cmlistboxmodel.h"
+#include "cmlistbox.h"
+#include "cmdestinationimpl.h"
+#include "cmmanagerimpl.h"
+#include <mcmdexec.h>
+#include "cmcommsdatnotifier.h"
+
+//#include <EIKLBO.H>
+
+// CLASS DECLARATION
+class CEikStatusPane;
+class CAknTitlePane;
+class CAknNavigationControlContainer;
+class CAknNavigationDecorator;
+class CCmWizard;
+class CCmdExec;
+class CDestDlg;
+
+/**
+ *  Dialog for displaying and editing connection methods
+ *  also base class for CUncatDlg
+ *  @lib cmmanager.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CCmDlg ) : public CAknDialog
+                            , MEikListBoxObserver
+                            , MAknInfoPopupNoteObserver
+                            , public MCmdExec
+                            , public MCmCommsDatWatcher
+    {
+    public :    // construction
+        CCmDlg( CCmManagerImpl* aCmManager, TUint32 aDestUid,
+                CDestDlg* aDestDlg );
+
+        ~CCmDlg();
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CCmDlg* NewL( CCmManagerImpl* aCmManager, TUint32 aDestUid,
+                             CDestDlg* aDestDlg );
+        
+        TInt ConstructAndRunLD( TUint32 aHighLight, TUint32& aSelected );        
+
+        // From MEikMenuObserver
+        virtual void DynInitMenuPaneL( TInt aResourceId, 
+                                       CEikMenuPane* aMenuPane );
+        // From MEikCommandObserver
+        virtual void ProcessCommandL( TInt aCommandId ) ;
+        
+        /**
+        * Updates listbox data
+        */
+        virtual void HandleListboxDataChangeL();   
+        
+        /**
+        * 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 );
+
+	public:
+        /**
+         * From base class MCmdExec
+         */
+        void Execute();
+
+    public: // From CCoeControl
+    
+        /**
+        * Returns the help context
+        * From CCoeControl
+        * 
+        * @since S60 3.2
+        * @param aContext the returned help context
+        */
+        void GetHelpContext( TCoeHelpContext& aContext ) const;
+        
+        /**
+        * Handles the resource change
+        * From CCoeControl
+        * 
+        * @since S60 5.0
+        * @param aType Type of the resource change
+        */
+		void HandleResourceChange( TInt aType );
+        
+    public: // From MCmCommsDatWatcher
+        
+        /**
+         * Watch changes in CommsDat
+         */
+        virtual void CommsDatChangesL();
+                 
+    protected :    // from CEikDialog
+        TBool OkToExitL( TInt aButtonId ) ;
+        
+        virtual void PreLayoutDynInitL();
+        
+        SEikControlInfo CreateCustomControlL ( TInt aControlType );
+
+        // From MEikListBoxObserver
+        void HandleListBoxEventL( CEikListBox* aListBox, 
+                                  TListBoxEvent aEventType );
+        
+        /**
+        * Initialises listbox texts
+        */
+        virtual void InitTextsL();
+        
+        /**
+        * Sets the number of conn methods text on navi pane
+        */
+        void SetNoOfCMsL(TInt aCount);
+        
+    
+        //from MAknInfoPopupNoteObserver
+        /* Handles events reported from info popup note.
+        * @param aController The controller that controls the note, from
+        *   where the event originates.
+        * @param aEvent The event.
+        */
+        void HandleInfoPopupNoteEvent(
+            CAknInfoPopupNoteController* aController,
+            TAknInfoPopupNoteEvent aEvent ); 
+
+        /**
+        * Shows the 'bearer type: ' popup note
+        */
+        void ShowPopupNoteL();          
+        
+        /**
+        * @return the currently focused connection method in the list
+        */
+        virtual CCmPluginBase* CurrentCML();  
+        
+        /**
+        * @return the connection method in the list at the specified index
+        */
+        virtual CCmPluginBase* CMByIndexL( TInt aIndex );
+        
+        /**
+        * @return the connection mehtod count
+        */
+        virtual TInt CMCount();     
+        
+        /**
+        * deletes the currently highlighted conneciton method
+        */
+        void DeleteCurrentCmL();
+        
+        void RenameConnectionMethodL();
+        void PrioritiseConnectionMethodL();
+        void AddConnectionMethodL();
+        void CopyConnectionMethodL();
+        void MoveConnectionMethodL();
+        void EditConnectionMethodL();
+        
+        /**
+        * Indicates if a connection is in use and displays and error message
+        *
+        * @return ETrue if in use
+        */
+        TBool CurrentCmInUseL();
+        
+        virtual void ConstructCMArrayL( RArray<TUint32>& aCmIds );
+
+    public:
+        /**
+         * From base class MCmdExec
+         */
+        void HandleLeaveError( TInt aError );
+        
+    private:
+     
+        /**
+        * Finishes the priorizing method
+        *
+        * @param aOkPushed ETrue if the OK button pushed.
+        *                  EFalse if the Cancel button pushed. 
+        *
+        */
+        void FinishPriorizingL( TBool aOkPushed );    
+
+        /**
+         * Rebuild item index array to remove some Iap that has been deleted from
+         * CommsDat by other application
+         */
+        void ReBuildItemIndexArrayL();
+        
+        /**
+         * Reorder connection methods according to underlying connection in case of vpn
+         */
+        void ReOrderCMsL();
+        
+        /**
+         * Remove hidden Connection Methods from the Array
+         */
+        void ClearHiddenCMsFromArrayL( RArray<TUint32>& aCmIds );
+        
+        /**
+         * Get a proper index in list for priority
+         */
+        TInt GetInsertIndexL( TInt aCount, TUint32 aPriority );
+        
+    protected:
+        CCmListboxModel*    iModel;
+        TUint32             iHighlight;
+        TUint32*            iSelected;           
+        TBool               iModelPassed;
+        CCmListbox*         iListbox;
+        CEikStatusPane*     iStatusPane;    // NOT owned
+        CAknTitlePane*      iTitlePane;     // NOT owned
+        CAknNavigationControlContainer* iNaviPane;      // NOT owned
+        CAknNavigationDecorator*        iNaviDecorator; // owned
+        HBufC*              iOldTitleText;  
+        CCmManagerImpl*     iCmManager;   // NOT owned   
+        TUint32             iDestUid;  // uid of the destination the
+                                       // connection mehtods belong to
+        TBool               iPrioritising;
+        TInt                iExitReason; // Exit reason, can be KUserExit or 
+                                         // KUserBack used to pass user exit 
+                                         // event                                         
+        CAknInfoPopupNoteController*    iInfoPopupNoteController;
+        
+    private:        
+    
+        TInt                iCmToPrioritise; // connection mehthod index 
+                                            // selected to prioritise
+        CCmDestinationImpl* iCmDestinationImpl; // the destination the 
+
+        CCmWizard*          iCmWizard; // wizard for connection method creation
+        // Indicated that Escape has arrived and it should be forwarded when CmWizard
+        // finished its work
+        TBool               iEscapeArrived;
+        
+        TBool 				iProcessing;
+        TBool               iAlreadyConfirmedDelete;
+                                                // connection mehtods belongs to
+        TBool               iExitduringProcessing;
+        TBool               iBackduringProcessing;
+        CDestDlg*           iDestDlg;
+        
+    protected:
+        // This is nescessary becaue in case of not supported CMs the data base 
+        // and the lisbox content is different.(The listbox doesn' show the
+        // unsupported ones.)
+        RArray<TInt>        iItemIndex;
+        CCmdExec*           iCmdExec;
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Inc/cmlistbox.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,97 @@
+/*
+* 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 CCmListbox.
+*
+*/
+
+#ifndef CM_LISTBOX_H
+#define CM_LISTBOX_H
+
+// INCLUDE FILES
+#include <aknlists.h>
+
+// FORWARD DECLARATION
+class CCmListboxModel;
+
+/**
+ *  Model for the connection methods listbox. It is an array of CCmListItem
+ *  pointers; items are owned.
+ *  @lib cmmanager.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CCmListbox ) : public CAknDoubleGraphicStyleListBox
+    {
+    public:     // Construct / cmruct
+
+        /**
+        * Two-phased constructor. Leaves on failure.
+        * @param aParent Parent control.
+        * @return The constructed listbox.
+        */
+        static CCmListbox* NewL
+            ( const CCoeControl* aParent );
+
+        /**
+        * Cmructor.
+        */
+        virtual ~CCmListbox();
+
+        /**
+        * Constructor.
+        */
+        CCmListbox();
+
+    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 );
+
+        /**
+        * Gets the UID from a given item
+        * @param    The index of the item
+        * @return   The UID of the item given by itemindex
+        */
+        TUint32 Uid4Item( TInt aItem ) const;
+
+        /**
+        * Gets the UID of the current item
+        * @return  The UID of the current item
+        */
+        TUint32 CurrentItemUid() const;
+
+        /**
+        * Gets the name of the current item
+        * @return The name of the current item
+        */
+        const TDesC& CurrentItemNameL();
+        
+        // from CCoeControl
+        void HandleResourceChange(TInt aType);
+    };
+
+
+#endif
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Inc/cmlistboxmodel.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,134 @@
+/*
+* 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 CCmListboxModel.
+*
+*/
+
+#ifndef CMLISTBOX_LISTBOX_MODEL_H
+#define CMLISTBOX_LISTBOX_MODEL_H
+
+// INCLUDE FILES
+#include <eikdialg.h>
+#include "cmlistitemlist.h"
+#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include <commsdat.h>
+#else
+#include <commsdat.h>
+#include <commsdat_partner.h>
+#endif
+
+// CONSTANTS
+// Granularity of the model array.
+const TInt KCMGranularity = 8;
+
+//"1\tFirstLabel\tSecondLabel\t0\t0" /**/
+_LIT( KListItemFormatCmProt, "%d\t%S\t%S\t%d" );
+//"0\tFirstLabel\tSecondLabel" /*\t%d*/
+_LIT( KListItemFormatCm, "%d\t%S\t%S" );
+//"0\tFirstLabel" /*\t%d*/
+_LIT( KListItemFormatEmbDest, "%d\t%S\t" );
+//"0\tFirstLabel\t0\t0" /*\t%d*/
+_LIT( KListItemFormatEmbDestProt, "%d\t%S\t\t%d" );
+
+const TInt KCMMaxFormatSize = sizeof( KListItemFormatCm );
+const TInt KCMMaxListItemNameLength = CommsDat::KMaxTextLength;
+const TInt KMaxCmListboxName = KCMMaxListItemNameLength+KCMMaxFormatSize;
+
+
+/**
+* Buffer size for formatting listbox text. Maximum item length
+* plus listbox internals (tabulators for icons etc.) must fit into it.
+*
+* Important note:
+* The model of the listbox is a CAknFilteredTextListBoxModel.
+* The *itemarray* of that model is this class. That is, whatever is in
+* the model (this class), it may not be visible, if it is filtered out.
+* We always must use the listbox's Model() to get visible ones.
+*/
+
+
+// CLASS DECLARATION
+
+/**
+ * Model for the connection methods listbox.
+ * pointers; items are owned.
+ *  @lib cmmanager.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CCmListboxModel ) : public CCmListItemList
+                                     , public MDesCArray
+    {
+    public:     // Construct
+
+        /**
+        * Constructor.
+        */
+        CCmListboxModel();
+
+        /**
+        * CCmListboxructor.
+        */
+        virtual ~CCmListboxModel();
+
+    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 for this item text (text owned by the model).
+        */
+        TPtrC MdcaPoint( TInt aIndex ) const;
+
+    public:        
+        
+        /**
+        * Sets the icon offset
+        * @param aOffset the offset of our icons in the iconarray
+        */
+        void SetOwnIconOffset( TInt aOffset );
+
+    protected:    // data
+    
+        /**
+        * Formats the text of the listbox, calls the leaving version trapped.
+        * @param aIndex Index of item.
+        * @param aBuf Buffer to store formatted text.
+        */
+        void FormatListboxText( TInt aIndex, TDes& aBuf ) const;
+
+        /**
+        * Formats the text of the listbox, leaving version.
+        * @param aIndex Index of item.
+        * @param aBuf Buffer to store formatted text.
+        */
+        void FormatListboxTextL( TInt aIndex, TDes& aBuf ) const;
+
+        /**
+        * MdcaPoint() cannot leave, so this buffer is allocated
+        * to allow formatting. Fortunately, doesn't have to be very
+        * large.
+        * We have to use MUTABLE CAST, as MdcaPoint is const (odd enough),
+        * so wouldn't allow formatting the text in a member...
+        */
+        __MUTABLE TBuf<KMaxCmListboxName> iBuf;
+        TInt iOffset;
+    };
+
+#endif // CMLISTBOX_LISTBOX_MODEL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Inc/cmlistitem.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,147 @@
+/*
+* 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 the CCmListItem class.
+*
+*/
+
+#ifndef CCMLISTITEM_H
+#define CCMLISTITEM_H
+
+//  INCLUDES
+#include <e32base.h>
+
+/**
+ *  Representation of a list item.
+ *  This class is used to hold the main information of a connection method.
+ *  It is used in CCmSelect.
+ *  @lib cmmanager.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CCmListItem ) :public CBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor. Leaves on failure, places instance
+        * on cleanup stack.
+        * @param aUid The ID of the connection method
+        * @param aName The name of the connection method
+        * @param aPriority The priority of the connection method
+        * @param aIconIndex The icon index of the connection method's 
+        * bearer's icon
+        * @param aIsProtected Whether the given item is read-only or not
+        * @param aIsSingleLine Whether the given item has one line only      
+        * @return The constructed CCmListItem.
+        */
+        static CCmListItem* NewLC( TUint32 aUid,
+                                    HBufC* aName,
+                                    TInt aPriority, 
+                                    TUint aIconIndex, 
+                                    TBool aIsProtected, 
+                                    TBool aIsVPNOverDestination,
+                                    TBool aIsSingleLine, 
+                                    TBool aIsDefault);
+        /**
+        * Destructor.
+        */
+        virtual ~CCmListItem();
+
+    protected:      // Constructors
+    
+        /**
+        * C++ default constructor.
+        */
+        CCmListItem( HBufC* aName );
+
+        /**
+        * Second-phase constructor.
+        * @param aUid The ID of the connection method
+        * @param aPriority The priority of the connection method
+        * @param aIconIndex The icon index of the connection method's 
+        * bearer's icon
+        * @param aIsProtected Whether the given item is read-only or not
+        * @param aIsSingleLine Whether the given item has one line only
+        */
+        void ConstructL( TUint32 aUid,
+                         TInt aPriority, 
+                         TUint aIconIndex, 
+                         TBool aIsProtected, 
+                         TBool aIsVPNOverDestination,
+                         TBool aIsSingleLine, 
+                         TBool aIsDefault);
+    
+    public: // New functions
+
+        /**
+        * Gets the name of the 'current' connection method
+        * Ownership of the returned text is not passed.
+        * @return The name of the current connection method
+        */
+        const TDesC& Name();
+
+        /**
+        * Gets the UID of the current connection method
+        * @return The UID of the current connection method
+        */
+        TUint32 Uid();
+
+        /**
+        * Gets the Priority of the current connection method
+        * @return The Priority of the current connection method
+        */
+        TInt Priority();
+         
+        /**
+        * Gets the IconIndex of the current connection method's bearer icon
+        * @return The IconIndex of the current connection method's bearer icon
+        */
+        TUint IconIndex();
+        
+        /**
+        * Returns the connection method's protected flag
+        * @return ETrue if the connection method is protected
+        */       
+        TBool IsProtected();
+        
+        /**
+        * Returns the connection method's destination flag
+        * @return ETrue if the item has one line only
+        */       
+        TBool IsSingleLine();
+
+        /**
+        * Returns the connection method's default flag
+        * @return ETrue if the item is the default connection
+        */       
+        TBool IsDefault();
+
+        /**
+        * Used to figure out whether connection is VPN over destination.
+        * @return ETrue if the item is VPN over destination
+        */       
+        TBool IsVpnOverDestination();
+                
+    private:    // Data
+
+        TUint32         iUid;            // The ID of the access point
+        HBufC*          iName;           // The name of the access point
+        TInt            iPriority;       // The Priority of the access point
+        TUint           iIconIndex;      // The IconIndex of the access point
+        TBool           iIsProtected;    // The IsProtected flag of the access point
+        TBool           iIsSingleLine;   // ETrue if the item has one line only
+        TBool           iIsDefault;      // ETrue if the item is the default connection
+        TBool           iIsVpnOverDestination; // ETrue if the item is VPN over destination
+    };
+
+#endif      // CCMLISTITEM_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Inc/cmlistitemlist.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,60 @@
+/*
+* 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 the CCmListItemList class.
+*
+*/
+
+#ifndef CCMLISTITEMLIST_H
+#define CCMLISTITEMLIST_H
+
+//  INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATION
+class CCmListItem;
+
+/**
+ *  A list of CCmListItem-s pointers; items are owned.
+ *  @lib cmmanager.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CCmListItemList ) : public CArrayPtrFlat<CCmListItem>
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * C++ default constructor.
+        */
+        CCmListItemList();
+
+        /**
+        * Destructor. Items in the list are destroyed.
+        */
+        virtual ~CCmListItemList();
+
+    public:  // New methods
+
+        /**
+        * Get pointer to the item having aUid, or NULL if no such item is in the
+        * list.
+        * @param aUid Uid of item to get.
+        * @return Pointer to the item having uid aUid, or NULL. Ownership
+        * not passed (the list still owns the item).
+        */
+        CCmListItem* ItemForUid( TUint32 aUid ) const;
+    };
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Inc/cmlogger.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,165 @@
+/*
+* 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 logger
+*
+*/
+
+#ifndef CONNECTIONMETHODLOGGER_H
+#define CONNECTIONMETHODLOGGER_H
+
+// INCLUDE FILES
+#include <e32svr.h>
+
+#ifdef _DEBUG
+
+#define __CONNECTION_METHOD_LOG__
+#include <flogger.h>
+
+// CONSTANTS
+
+class CFunctionEntryExit;
+
+//Logging to file in THUMB UDEB
+class TLogger
+    {
+    public: // methods
+
+        static void CreateLogger( TAny* aOwner );
+        static void CloseLogger( TAny* aOwner );
+
+        static void AttachLogger( const TAny* aOwner, 
+                                   const TAny* aAttach1,
+                                   const TAny* aAttach2 );
+       
+        static void NameIt( const TAny* aOwner, 
+                            TRefByValue<const TDesC> aNameFmt, 
+                            ... );
+        
+        static void LogIt( const TAny* aOwner, 
+                           TRefByValue<const TDesC> aFmt, 
+                           ... );
+        static void LogIt( const TAny* aOwner, 
+                           TRefByValue<const TDesC8> aFmt, 
+                           ... );
+        static void LogIt( const TAny* aOwner, 
+                           TRefByValue<const TDesC> aFmt, 
+                           VA_LIST aList );
+        static void LogIt( const TAny* aOwner, 
+                           TRefByValue<const TDesC8> aFmt, 
+                           VA_LIST aList );
+
+    private:       
+
+        TBuf<2048>      iLogBuf;
+        TBuf8<2048>     iLogBuf8;
+        TInt            iRefCounter;
+        TAny*           iOwner;
+    };
+
+NONSHARABLE_CLASS( CFunctionEntryExit ): public CBase
+    {
+    public:
+
+        CFunctionEntryExit( const TAny* aOwner, 
+                            TRefByValue<const TDesC> aFunc );
+        ~CFunctionEntryExit();
+
+    public:
+    
+        TPtrC       iFunc;  // function name
+        const TAny* iOwner;
+        TTime       iEntryTime;
+    };
+
+#define LOGGER_ENTERFN( a )     CFunctionEntryExit entryExit( this, _L(a) );
+#define CLOG_ENTERFN_PTR( a )   CFunctionEntryExit entryExit( NULL, _L(a) );
+
+#define CLOG_CREATE             TLogger::CreateLogger( this );
+#define CLOG_CREATE_PTR         TLogger::CreateLogger( NULL );
+#define CLOG_ATTACH( attach1, attach2 )  TLogger::AttachLogger( this, \
+                                                                   attach1, \
+                                                                   attach2 );
+#define CLOG_NAME( a )           TLogger::NameIt( this, a );
+#define CLOG_NAME_1( a, b )      TLogger::NameIt( this, a, b );
+#define CLOG_NAME_2( a, b, c )   TLogger::NameIt( this, a, b, c );
+#define CLOG_NAME_3( a, b, c, d )   TLogger::NameIt( this, a, b, c, d );
+#define CLOG_CLOSE               TLogger::CloseLogger( this );
+#define CLOG_WRITE( a )          TLogger::LogIt( this, _L(a) );
+#define CLOG_WRITE_FORMAT( a, b )   TLogger::LogIt( this, _L(a), b );
+#define CLOG_WRITE_1( a, b )     TLogger::LogIt( this, _L(a), b );
+#define CLOG_WRITE_2( a, b, c )  TLogger::LogIt( this, _L(a), b, c );
+#define CLOG_WRITE_3( a, b, c, d )  TLogger::LogIt( this, _L(a), b, c, d );
+#define CLOG_WRITE_4( a, b, c, d, e )   TLogger::LogIt( this, \
+                                                          _L(a), b, c, d, e );
+#define CLOG_WRITE8( a )         TLogger::LogIt( this, _L8(a) );
+#define CLOG_WRITE8_1( a, b )    TLogger::LogIt( this, _L8(a), b );
+#define CLOG_WRITE8_2( a, b, c ) TLogger::LogIt( this, _L8(a), b, c );
+#define CLOG_WRITE8_3( a, b, c, d ) TLogger::LogIt( this, _L8(a), b, c, d );
+#define CLOG_WRITE8_4( a, b, c, d, e )  TLogger::LogIt( this, \
+                                                          _L8(a), b, c, d, e );
+
+#define CLOG_NAME_PTR( ptr, a )                     TLogger::NameIt( ptr, a );
+#define CLOG_ATTACH_PTR( ptr, attach1, attach2 )    TLogger::AttachLogger( \
+                                                        ptr, attach1, attach2 );
+#define CLOG_WRITE_PTR( ptr, a )                    TLogger::LogIt( ptr, \
+                                                                      _L(a) );
+#define CLOG_WRITE_1_PTR( ptr, a, b )               TLogger::LogIt( ptr, \
+                                                                    _L(a), b );
+#define CLOG_WRITE_2_PTR( ptr, a, b, c )            TLogger::LogIt( ptr, \
+                                                                  _L(a), b, c );
+#define CLOG_WRITE_3_PTR( ptr, a, b, c, d )         TLogger::LogIt( ptr, \
+                                                               _L(a), b, c, d );
+#define CLOG_WRITE_4_PTR( ptr, a, b, c, d, e )      TLogger::LogIt( ptr, \
+                                                            _L(a), b, c, d, e );
+#define CLOG_WRITE_FORMAT_PTR( ptr, a, b )          TLogger::LogIt( ptr, \
+                                                                    _L(a), b );
+#define CLOG_CLOSE_PTR( ptr )   TLogger::CloseLogger( ptr );
+
+#else   // _DEBUG
+
+#define LOGGER_ENTERFN( a )
+#define CLOG_ENTERFN_PTR( a )
+
+#define CLOG_CREATE
+#define CLOG_CREATE_PTR
+#define CLOG_ATTACH( attach1, attach2 )
+#define CLOG_NAME( a )
+#define CLOG_NAME_1( a, b )
+#define CLOG_NAME_2( a, b, c )
+#define CLOG_NAME_3( a, b, c, d )
+#define CLOG_CLOSE
+#define CLOG_WRITE( a )                   
+#define CLOG_WRITE_FORMAT( a, b )              
+#define CLOG_WRITE_1( a, b )
+#define CLOG_WRITE_2( a, b, c )           
+#define CLOG_WRITE_3( a, b, c, d )        
+#define CLOG_WRITE_4( a, b, c, d, e )     
+#define CLOG_WRITE8( a )                  
+#define CLOG_WRITE8_1( a, b )             
+#define CLOG_WRITE8_2( a, b, c )          
+#define CLOG_WRITE8_3( a, b, c, d )       
+#define CLOG_WRITE8_4( a, b, c, d, e )    
+
+#define CLOG_NAME_PTR( ptr, a )
+#define CLOG_ATTACH_PTR( ptr, attach1, attach2 )
+#define CLOG_WRITE_PTR( ptr, a )
+#define CLOG_WRITE_1_PTR( ptr, a, b )
+#define CLOG_WRITE_2_PTR( ptr, a, b, c )
+#define CLOG_WRITE_3_PTR( ptr, a, b, c, d )
+#define CLOG_WRITE_4_PTR( ptr, a, b, c, d, e )
+#define CLOG_WRITE_FORMAT_PTR( ptr, a, b )
+#define CLOG_CLOSE_PTR( ptr )
+
+#endif // _DEBUG
+#endif // CONNECTIONMETHODLOGGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Inc/cmmanager.hrh	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,64 @@
+/*
+* 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 definitions for connection method manager
+*
+*/
+
+#ifndef CMMANAGER_HRH
+#define CMMANAGER_HRH
+
+#define  KDestListboxType     3432
+#define  KCmListboxType     3432
+#define  KCmDestIconMapType     3433
+
+enum TCmManagerUiMenuCommands  /// Commands.
+    {
+    ECmManagerUiCmdCmEdit =1234,
+    ECmManagerUiCmdCmAdd,
+    ECmManagerUiCmdCmRename,
+    ECmManagerUiCmdCmDelete,
+    ECmManagerUiCmdCmUserExit,
+    ECmManagerUiCmdCmPrioritise,
+    ECmManagerUiCmdCmMoveToOtherDestination,
+    ECmManagerUiCmdCmCopyToOtherDestination,
+    ECmManagerUiCmdDestEdit,
+    ECmManagerUiCmdDestDefaultConnection,
+    ECmManagerUiCmdDestUserExit,
+    ECmManagerUiCmdDestAdd,
+    ECmManagerUiCmdDestRename,
+    ECmManagerUiCmdDestChangeIcon,
+    ECmManagerUiCmdDestDelete,
+    ECmManagerUiCmdDestSelect,
+    ECmManagerUiCmdCMSelect,
+    ECmManagerUiCmdCmPrioOk,
+    ECmManagerUiCmdCmPrioCancel
+    };
+ 
+#include "cmpluginmenucommands.hrh"
+    
+enum TCmManagerUiDlgLineIds // dialog line IDs
+    {
+    KDestListboxId = 1,
+    KCmListboxId,
+    KPluginBaseListboxId,
+    ECmDestIconMapContentId
+    };
+
+enum TCmDialogIds
+    {
+    ECmWaitDialog = 1
+    };
+    
+    
+#endif // CMMANAGER_HRH
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Inc/cmmanagerimpl.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,1009 @@
+/*
+* 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 connection method manager
+*
+*/
+
+#ifndef CMMANAGERIMPL_H
+#define CMMANAGERIMPL_H
+
+// User Includes
+#include "cmmanager.hrh"
+#include "cmobjectpool.h"
+#include "cmconnectionmethodinfo.h"
+#include <datamobilitycommsdattypes.h>
+#include <cmmanagerdef.h>
+#include <cmdefconnvalues.h>
+#include <cmgenconnsettings.h>
+
+// System Includes
+#include <e32std.h>
+#include <e32base.h>
+#include <e32cmn.h>
+#include <f32file.h>    // RFs
+#include <barsc.h>      // RResourceFile
+#include <metadatabase.h>
+#include <commsdattypesv1_1.h>
+
+// Forward Declarations
+class CCmTransactionHandler;
+class CCmDestination;
+class CCmDestinationExt;
+class CCmDestinationImpl;
+class CCmPluginBaseEng;
+class CCmPluginBase;
+class CImplementationInformation;
+class TBearerPriority;
+class RConeResourceLoader;
+class CCmConnectionMethodInfo;
+class CGulIcon;
+class CCDGlobalBearerTypePriorizationRecord;
+class CCDDataMobilitySelectionPolicyRecord;
+class TCmPluginInitParam;
+class CCmDestinationData;
+class RCmManagerExt;
+class MCmCommsDatWatcher;
+class CCmCommsDatNotifier;
+
+// DATA TYPES
+typedef RPointerArray<CImplementationInformation>   RImplInfoPtrArray;
+typedef CCDGlobalBearerTypePriorizationRecord       CCmBearerPriRec;
+typedef CCDDataMobilitySelectionPolicyRecord        CCDSnapRecord;
+
+typedef struct
+    {
+    RResourceFile       iFile;  // resource file handler
+    TFileName           iFName; // resource filename
+    TInt                iRefs;  // number of references to this res file
+    }TResourceFiles;
+    
+/*#ifdef _DEBUG
+void DumIapTableL( CommsDat::CMDBSession& aSession );
+#define DUMP_IAP_TBL( session )  DumIapTableL( (session) );
+#else   // _DEBUG
+#define DUMP_IAP_TBL( session )
+#endif  // _DEBUG*/
+
+/**
+ *  Implementation of connection method manager
+ *
+ *  @lib cmmanager.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CCmManagerImpl ) : public CBase
+      {          
+    // Construction/Destruction
+    public:
+    
+        /** Epoc constructor */
+        static CCmManagerImpl* NewL( TBool aCreateTables = ETrue );
+        
+        /** Destructor */
+        virtual ~CCmManagerImpl();
+        
+    protected:
+    
+        /** First stage constructor */
+        CCmManagerImpl();
+    
+        /** Epoc constructor */
+        void ConstructL(); // second-phase constructor
+        
+    public: // Transaction handling API
+    
+        void OpenTransactionLC( TBool aSetAttribs = ETrue );
+        void CommitTransactionL( TInt aError );
+        void RollbackTransaction();
+        
+        // This will be called when the first UI view is on
+        void StartCommsDatNotifierL();
+        
+    public: // Basic CM attribute query API
+    
+        /**
+        * GetBearerInfoXXX function can be used to query
+        * bearer informantion that doesn't belong
+        * to a specific connection method, such as 
+        * ECmCoverage or ECmDefaultPriority etc.
+        * HBuf ownership is passed to the caller
+        */
+        IMPORT_C TUint32 GetBearerInfoIntL( TUint32 aBearerType,
+                                            TUint32 aAttribute ) const;
+        IMPORT_C TBool GetBearerInfoBoolL( TUint32 aBearerType,
+                                           TUint32 aAttribute ) const;
+        IMPORT_C HBufC* GetBearerInfoStringL( TUint32 aBearerType,
+                                              TUint32 aAttribute ) const;
+        IMPORT_C HBufC8* GetBearerInfoString8L( TUint32 aBearerType,
+                                                TUint32 aAttribute ) const;
+                    
+        /**
+        * GetConnectionMethodInfoXXX function can be used to 
+        * query any, non-bearer specific information about
+        * a given connection method. This can be e.g. ECmBearerType,
+        * ECmName, ECmStartPage etc.
+        * HBuf ownership is passed to the caller
+        */
+        IMPORT_C TUint32 GetConnectionMethodInfoIntL( 
+                                                TUint32 aCmId,
+                                                TUint32 aAttribute ) const;
+        IMPORT_C TBool GetConnectionMethodInfoBoolL( 
+                                                TUint32 aCmId,
+                                                TUint32 aAttribute ) const;
+        IMPORT_C HBufC* GetConnectionMethodInfoStringL( 
+                                                TUint32 aCmId,
+                                                TUint32 aAttribute ) const;
+        IMPORT_C HBufC8* GetConnectionMethodInfoString8L( 
+                                                TUint32 aCmId,
+                                                TUint32 aAttribute ) const;
+                
+                    
+    //=========================================================================
+    // Creation/Destruction API
+    //
+    public:
+              
+        /**
+        * Creates a Destination by the given name
+        *
+        * @since 3.2
+        * @param aName the name of the new destination
+        * @return CCmDestination*, ownership is passed to the caller
+        */
+        CCmDestinationImpl* CreateDestinationL( const TDesC& aName );
+
+        /**
+        * Creates a Destination by the given name
+        *
+        * @since 3.2
+        * @param aName the name of the new destination
+        * @param aDestId Predefined id for the destination
+        * @return CCmDestination*, ownership is passed to the caller
+        */
+        CCmDestinationImpl* CreateDestinationL( const TDesC& aName,
+                                                TUint32      aDestId );
+
+        
+        /**
+        * Creates a connection method does not belong to any destination
+        *
+        * @since 3.2
+        * @param aImplementationUid - implementation uid of the connection 
+        * method
+        * @param aParentDestination - the destination which holds the 
+        *                             connection method, NULL means there is
+        *                             no parent
+        * @return CCmPluginBase*
+        */
+        CCmPluginBase* CreateConnectionMethodL( TUint32 aBearerType,
+                            CCmDestinationImpl* aParentDestination = NULL );
+
+        /**
+        * Creates a connection method does not belong to any destination
+        *
+        * @since 3.2
+        * @param aImplementationUid - implementation uid of the connection 
+        * method
+        * @param aConnMethodId Predefined id for the connection method
+        * @param aParentDestination - the destination which holds the 
+        *                             connection method, NULL means there is
+        *                             no parent
+        * @return CCmPluginBase*
+        */
+        CCmPluginBase* CreateConnectionMethodL( TUint32 aBearerType,
+        		            TUint32 aConnMethodId,             
+                            CCmDestinationImpl* aParentDestination = NULL );
+        
+        /**
+        * Creates a connection method does not belong to any destination
+        *
+        * @since 3.2
+        * @param pluginBaseEng - Object to put in the pool
+        * @return CCmPluginBase*
+        */
+        CCmPluginBase* CreateConnectionMethodL( 
+                            CCmPluginBaseEng* pluginBaseEng );
+
+        /**
+        * Insert a connection method does not belong to any destination
+        * API doesn't use CCmPluginBase. So, nothing returns
+        *
+        * @param pluginBaseEng - Object to put in the pool
+        */
+        void InsertConnectionMethodL( 
+                            CCmPluginBaseEng* pluginBaseEng );
+        
+        /**
+        * Creates a connection method does not belong to any destination
+        *
+        * @since 3.2
+        * @param aBearerType - implementation uid of the connection 
+        * method
+        * @param aParams - the destination which holds the 
+        *                             connection method, NULL means there is
+        *                             no parent
+        * @return CCmPluginBaseEng*
+        */
+        CCmPluginBaseEng* DoCreateConnectionMethodL( TUint32 aBearerType,
+                                       TCmPluginInitParam& aParams );
+
+        /**
+        * Creates a connection method does not belong to any destination
+        *
+        * @since 3.2
+        * @param aBearerType Implementation uid of the connection 
+        * method
+        * @param aParams Initialization params for the plugin.
+        * @param aConnMethodId Predefined id for the connection method.
+        * @return CCmPluginBaseEng*
+        */
+        CCmPluginBaseEng* DoCreateConnectionMethodL( TUint32 aBearerType,
+            TCmPluginInitParam& aParams, TUint32 aConnMethodId );
+
+    //=========================================================================
+    // Getter-Setter API
+    //
+    public:    
+            
+        /**
+        * Calls FeatureManager::FeatureSupported directly.
+        *
+        * @since 3.2
+        * @param aFeature feature ID
+        * @return feature support status
+        * @since 3.2
+        */
+        static TBool FeatureSupported( TInt aFeature );
+        
+        /**
+        * Obsolete
+        */
+        IMPORT_C CCmPluginBaseEng* ConnectionMethodL( TUint32 aCmId );
+
+        /**
+        * Return the connection method queried by it's ID
+        *
+        * @since 3.2
+        * @param aCmId
+        * @return CCmPluginBase*
+        */
+        IMPORT_C CCmPluginBase* GetConnectionMethodL( TUint32 aCmId );
+        
+        /**
+        * Return the list of connection methods do not belongs to any 
+        * destination
+        *
+        * @since 3.2
+        * @param aCMArray on return it is the array of IAP ids.
+        * @param aCheckBearerType If ETrue only connection methods with 
+        *                         supported bearer types are returned
+        * @param aLegacyOnly when set to ETrue only Legacy IAP ids will
+        *                         be returned
+        * @param aEasyWlan when set to ETrue EasyWlan id is returned, too
+        * @param aSortByBearer if ETrue the CMs will be ordered according
+        *                      to global bearer priority
+        */        
+        IMPORT_C void ConnectionMethodL( RArray<TUint32>& aCMArray,
+                                         TBool aCheckBearerType = ETrue,
+                                         TBool aLegacyOnly = ETrue,
+                                         TBool aEasyWlan = EFalse,
+                                         TBool aSortByBearer = EFalse );
+        /**
+        * Return an array of all destinations
+        *
+        * @since 3.2
+        * @param aDestArray on return it returns an array of destination ids
+        */
+        IMPORT_C void AllDestinationsL( RArray<TUint32>& aDestArray );
+
+        /**
+        * Return the number of destinations
+        *
+        * @since 3.2
+        * @return the number of destinations
+        */
+        inline TUint DestinationCountL() { return iDestinationCount; }
+
+        /**
+        * Return the destination implementation to which a specified 
+        * connection method belongs, search is by destination ID ( the
+        * id which is made by RECORD_FROM_ELEMENT_ID from the elementID)
+        * If the  destination implementation is allready in the  object
+        * pool returns it. If it is not in the pool than puts it in the
+        * pool using the GetDestinationL funciton.
+        *
+        * @since 3.2
+        * @param aId
+        * @return a pointer to a destination
+        */
+        IMPORT_C CCmDestinationImpl* DestinationL( TUint32 aId );
+        
+        /**
+        * Removes the destination implementation 
+        * from the object pool
+        *
+        * @since 3.2
+        * @param aId
+        */
+        IMPORT_C void RemoveDestFromPool( CCmDestinationImpl* aDestination );
+        
+        /**
+        * Removes the destination implementation 
+        * from the object pool
+        *
+        * @since 3.2
+        * @param aId
+        */
+        void RemoveDestFromPool( CCmDestinationData* aDestination );
+        
+        /**
+        * Removes the cm 
+        * from the object pool
+        *
+        * @since 3.2
+        */
+        void RemoveCMFromPoolL( CCmPluginBaseEng* aCM );
+        
+        /**
+        * Removes the cm 
+        * from the object pool
+        *
+        * @since 3.2
+        */
+        void RemoveCMFromPoolL( CCmPluginBase* aCM );
+
+        /**
+        * The destination have been updated if it was a new destination
+        * than the zero id must be changed to the new one 
+        *
+        * @param aDestination - the destination to change
+        */         
+        void DestinationUpdated( CCmDestinationImpl* aDestination );
+              
+        /**
+        * Copie a connection method belonging to one destination to 
+        * another. The connection method becomes shared.
+        *
+        * @since 3.2
+        * @param aTargetDestination target destination
+        * @param aConnectionMethodId connection method to be copied
+        * @return index in the Connection Method list
+        */
+        TInt CopyConnectionMethodL( CCmDestinationImpl& aTargetDestination,
+                                    CCmPluginBase& aConnectionMethod );
+        
+        /**
+        * Move a connection method belonging to one destination to 
+        * another. The connection method is removed from the source destination
+        *
+        * @since 3.2
+        * @param aSourceDestination source destination
+        * @param aTargetDestination target destination
+        * @param aConnectionMethod connection method to be moved
+        * @return index in the Connection Method list which the connection 
+        *         method has been moved to
+        */
+        TInt MoveConnectionMethodL( CCmDestinationImpl& aSourceDestination,
+                                    CCmDestinationImpl& aTargetDestination,
+                                    CCmPluginBase& aConnectionMethod );
+        
+        /**
+        * Remove connection method from the destination
+        *
+        * @since 3.2
+        * @param aDestination destination the connection method is attached to
+        * @param aConnectionMethod connection method to be removed
+        */
+        void RemoveConnectionMethodL( CCmDestinationImpl& aDestination,
+                                      CCmPluginBase& aConnectionMethod );
+
+        /**
+        * Return the copy of the bearer priority array. Ownership is passed.
+        *
+        * @since 3.2
+        * @param aArray bearer priority array
+        */          
+        void BearerPriorityArrayL( RArray<TBearerPriority>& aArray ) const;
+        
+        /*
+        * Update bearer priority array
+        *
+        * @since 3.2
+        * @param aArray array with new global bearer priority
+        */          
+        void UpdateBearerPriorityArrayL( const RArray<TBearerPriority>& aArray );
+        
+        /**
+        * Clean up passed global bearer priority array. Delete
+        * the elements and calls Reset and Close on the array.
+        *
+        * @since 3.2
+        * @param aArray array to be cleaned up
+        */
+        void CleanupGlobalPriorityArray( RArray<TBearerPriority>& aArray ) const;
+        
+        /**
+        * Search service type in the global priority table and
+        * Return its priority.
+        *
+        * @since 3.2
+        * @param aUiPriority ETrue if UI priority is requested
+        * @param aServiceType serched service type 
+        * @return priority of the service type or KErrNotFound
+        */
+        TInt GlobalBearerPriority( TBool aUiPriority, 
+                                   const TDesC& aServiceType ) const;
+                                   
+        /*
+        * Query all of the supported bearer types.
+        *
+        * @since 3.2
+        * @param aArray list of all supported bearer types.
+        */          
+        void SupportedBearersL( RArray<TUint32>& aArray ) const;
+        
+        /*
+        * Return "Uncategorized" icon.
+        * This fucton leaves if the client does not have a valid UI context
+        *
+        * @since 3.2
+        * @return CGulIcon icon of uncategorized connection methods.
+        */          
+        CGulIcon* UncategorizedIconL() const;
+
+        /**
+        * Returns the id of the EasyWlan connection method.
+        *
+        * @since S60 3.2
+        * @return id of the EasyWLan connection method. 0 if not found
+        */
+        IMPORT_C TUint32 EasyWlanIdL();
+
+        /**
+        * Create a SNAP record object and load it if record id not 0.
+        * @param aRecordId record Id. 0 means create only
+        * @return created/loaded SNAP record
+        */
+        CCDSnapRecord* SNAPRecordL( TUint32 aRecordId ) const;
+
+        CCDSnapRecord* CreateSNAPRecordL( TUint32 aRecordId ) const;
+    
+        /**
+        * Tells the CmManager that the given default connection is deleted,
+        * and it sets Default Connection to Always Ask (default value).
+        *
+        * @since S60 3.2
+        */
+        void HandleDefConnDeletedL( TCmDefConnValue& aDCSetting );
+        /**
+        * Returns the default connection method/SNAP.
+        *
+        * @since S60 3.2
+        */
+        void ReadDefConnL( TCmDefConnValue& aDCSetting );   
+        /**
+        * Stores the default connection method/SNAP.
+        *
+        * @since S60 3.2
+        */
+        void WriteDefConnL( const TCmDefConnValue& aDCSetting );  
+        /**
+        * Returns the default connection method/SNAP.
+        *
+        * @since S60 3.2
+        */
+        void ReadDefConnWoTransL( TCmDefConnValue& aDCSetting );   
+        /**
+        * Stores the default connection method/SNAP.
+        *
+        * @since S60 3.2
+        */
+        void WriteDefConnWoTransL( const TCmDefConnValue& aDCSetting );  
+        /**
+        * Returs ETrue if Default Connection feature is supported.
+        *
+        * @since S60 3.2
+        */        
+        TBool IsDefConnSupported();
+        /**
+        * Check if memory low so that process can continue
+        */
+        TBool IsMemoryLow(); 
+        /**
+        * Returns the general connection settings.
+        */
+        void ReadGenConnSettingsL( TCmGenConnSettings& aGenConnSettings );
+        /**
+        * Replaces the general connection settings.
+        */
+        void ReplaceGenConnSettingsL( const TCmGenConnSettings& aGenConnSettings );
+        /**
+        * Writes the general connection settings.
+        */
+        void WriteGenConnSettingsL( const TCmGenConnSettings& aGenConnSettings );
+        
+                
+    //=========================================================================
+    // Resource handling
+    //
+    public:
+        
+        /** add resource file */
+        void AddResourceFileL( TFileName& aName );
+        
+        /** 
+        * Remove resource file from array only if
+        * the reference count is zero.
+        * @param aName name of the resource file to be removed
+        */
+        void RemoveResourceFile( TFileName& aName );
+
+        /**
+        * Read string from resource
+        *
+        * @since 3.2
+        * @param aResourceId resource id of the localized string
+        * @return localized string
+        */
+        HBufC* AllocReadL( TInt aResourceId ) const;    
+    
+    //=========================================================================
+    // CM related functions
+    //
+    public:
+        
+        /**
+        * Return the number of references to the given connection method id
+        * in the DN_IAP table
+        *
+        * @since 3.2
+        * @param aId ID of the connection method        
+        * @param aRecSet entire record set of the detination table
+        * @return number of references to the connection method in DN_IAP table
+        */
+        TUint32 NumOfConnMethodReferencesL( 
+            TUint32 aId,
+            CommsDat::CMDBRecordSet<CCDDataMobilitySelectionPolicyRecord>* aRecSet = NULL 
+            );
+        
+        /**
+        * Indicates is at least one non-"level 1 protected" destinations
+        *
+        * @since S60 3.2
+        * @return ETrue if at least one level 1 protected destination
+        */
+        TBool HasUnprotectedDestinationsL();
+        
+        /**
+        * Walks through every connection methods to find out
+        * if the passed connection method is linked to any of them.
+        * @param aPlugin connection method to be checked
+        * @return ETrue if linked
+        */
+        TBool IsIapLinkedL( const CCmPluginBaseEng& aPlugin );
+        
+        /**
+        * Removes all references to this CM from SNAP table.
+        */
+        void RemoveAllReferencesL( const CCmPluginBaseEng& aPlugin );
+
+        /**
+        * Removes all references to this CM from SNAP table without
+        * transaction to commsdat.
+        */
+        void RemoveAllReferencesWoTransL( const CCmPluginBaseEng& aPlugin );
+
+        /**
+        * Return the bearer type of connection method.
+        *
+        * @since 3.2
+        * @param aId id of the connection method
+        * @return bearer type of the connection method
+        */
+        TUint32 BearerTypeFromCmIdL( TUint32 aCmId );
+                
+        /**
+        * Return the bearer type of connection method.
+        *
+        * @since 3.2
+        * @param aIapRecord CommsDat record of the connection method
+        * @return bearer type of the connection method
+        */
+        TUint32 BearerTypeFromIapRecordL( CommsDat::CCDIAPRecord* aIapRecord ) const;
+
+    private:
+    
+        /**
+        * Find and create a connection method.
+        *
+        * @since 3.2
+        * @param aCmId id of the connection method
+        * @aParentDest parent destination of the connection method. Can be NULL.
+        */
+        CCmPluginBase* DoFindConnMethodL( TUint32 aCmId, 
+                              CCmDestinationImpl* aParentDest );
+    
+        /**
+        * Find and create a connection method.
+        *
+        * @since 3.2
+        * @param aCmId id of the connection method
+        * @aParentDest parent destination of the connection method. Can be NULL.
+        */
+        CCmPluginBaseEng* DoFindConnMethL( TUint32 aCmId, 
+                               CCmDestinationImpl* aParentDest );
+
+        /**
+        * Check the existence of tables we need.
+        * Creates if it is not exist, get the table id otherwise
+        */
+        void CheckTablesL();
+
+    public:
+    
+        /**
+        * Return the destination network table ID
+        *
+        * @since 3.2
+        * @return iDestinationTableId element id of the destination table
+        */        
+        inline CommsDat::TMDBElementId DestinationTableId() const { return iDestinationTableId; };
+        
+        /**
+        * Return Global Bearer Type Priorization Table ID
+        *
+        * @since 3.2
+        * @return element id of the bearer type priority.
+        */        
+        inline CommsDat::TMDBElementId BearerTypePriorizationTableId() const { return iBearerTypePriorizationTableId; };
+        
+        /**
+        * Return the Destination network - Icon table ID
+        *
+        * @since 3.2
+        * @return element id of the icon table.
+        */        
+        inline CommsDat::TMDBElementId IconTableId() const { return iIconTableId; };
+        
+        /**
+        * Return true if help is on in the FeatureManager
+        *
+        * @since 3.2
+        * @return TBool.
+        */        
+        inline TBool IsHelpOn() const { return iHelp; };
+
+        /**
+        * Return the Seamlessness table ID
+        *
+        * @since 3.2
+        * @return element id of the seamlessness table.
+        */        
+        inline CommsDat::TMDBElementId SeamlessnessTableId() const { return iSeamlessnessTableId; };
+        
+        /**
+        * Checks if the current environment has the given capability.
+        * Leaves with KErrPermissionDenied if capability is missing. 
+        *
+        * @since 3.2
+        * @param aCapability capability to be checked
+        */
+        static void HasCapabilityL( TCapability aCapability );
+        
+        /**
+        * Return an array of all IAP records.
+        * @return array of all IAP records
+        */
+        CommsDat::CMDBRecordSet<CommsDat::CCDIAPRecord>* AllIapsL();
+        
+        /**
+        * Return all the SNAP record. Filtering can be made on 
+        * passed SNAP elemented id.
+        * @return array of SNAP records
+        */
+        CommsDat::CMDBRecordSet<CCDDataMobilitySelectionPolicyRecord>* 
+                    CCmManagerImpl::AllSNAPRecordsL( TUint32 aSnapElementId );
+        
+    public:
+    
+        CommsDat::CMDBSession& Session() const;
+
+        /**
+        * Wraps this implementation to an RCmManagerExt. OWNERSHIP IS NOT PASSED
+        * , SO NEVER CLOSE aCmManagerExt!!!
+        *
+        * @since 3.2
+        * @param aCmManagerExt class to wrap implementation into
+        */
+        
+        IMPORT_C void WrapCmManager( RCmManagerExt& aCmManagerExt );
+     
+        /** Remove the virtual methods from the passed list
+        *
+        * @since 3.2
+        * @param aCmDataArray array that contains the connection methods to be filtered
+        */
+        IMPORT_C void FilterOutVirtualsL( RPointerArray<CCmPluginBase>& aCmDataArray );
+
+        /** Create a 'flat list' of connection methods of a given destination
+        * ( connection methods inside embedded destinations which are in the destination,
+        * are also present in the list ) and
+        * order them according to the bearer type prioritisation rules
+        * and return the result in aCmArray.        
+        *
+        * @since 3.2
+        * @param aDestination destination that contains the connection methods
+        * for uncategorised connection methods, use KDestItemUncategorized
+        * @param aCmArray array to return the result
+        */
+
+        IMPORT_C void CreateFlatCMListL( TUint32 aDestination ,
+                                        RPointerArray<CCmPluginBase>& aCmArray );        
+                                        
+        /** Create a 'flat list' of connection methods of a given destination
+        * ( connection methods inside embedded destinations which are in the destination,
+        * are also present in the list ) and
+        * order them according to the bearer type prioritisation rules
+        * and return the result in aCmArray.        
+        * LC version        
+        *
+        * @since 3.2
+        * @param aDestination destination that contains the connection methods
+        * for uncategorised connection methods, use KDestItemUncategorized
+        * @param aCmArray array to return the result
+        */
+        IMPORT_C void CreateFlatCMListLC( TUint32 aDestination ,
+                                        RPointerArray<CCmPluginBase>& aCmArray );        
+      
+        
+        /** Get a list of uncategorised connection methods in an RPointerArray 
+        * contains the parameters passed to ConnectionMethodL
+        *
+        * @since 3.2
+        * @param aCmArray the returned list of uncategorised connection methods
+        * @param aCheckBearerType see ConnectionMethodL
+        * @param aLegacyOnly see ConnectionMethodL
+        * @param aEasyWlan see ConnectionMethodL
+        * @param aSortByBearer see ConnectionMethodL
+        */
+        void AppendUncatCmListL(RPointerArray<CCmPluginBase>& aCmArray,
+                                         TBool aCheckBearerType = ETrue,
+                                         TBool aLegacyOnly = ETrue,
+                                         TBool aEasyWlan = EFalse,
+                                         TBool aSortByBearer = EFalse );
+        
+        /** Get a list of uncategorised connection methods in an RPointerArray 
+        * contains the parameters passed to ConnectionMethodL
+        * LC version
+        *
+        * @since 3.2
+        * @param aCmArray the returned list of uncategorised connection methods
+        * @param aCheckBearerType see ConnectionMethodL
+        * @param aLegacyOnly see ConnectionMethodL
+        * @param aEasyWlan see ConnectionMethodL
+        * @param aSortByBearer see ConnectionMethodL
+        */
+        void AppendUncatCmListLC(RPointerArray<CCmPluginBase>& aCmArray,
+                                         TBool aCheckBearerType = ETrue,
+                                         TBool aLegacyOnly = ETrue,
+                                         TBool aEasyWlan = EFalse,
+                                         TBool aSortByBearer = EFalse );
+        
+        /**
+        * Returns a list of references to the connection methods in the destination. 
+        *
+        * @since 3.2
+        * @param aPluginArray A pointer array to hold the values
+        * ownership is passed
+        */
+        void AppendCmListL( TUint32 aDestintaionId, RPointerArray<CCmPluginBase>& aCmArray);
+        
+        /**
+        * Returns a list of references to the connection methods in the destination. 
+        *
+        * @since 3.2
+        * @param aPluginArray A pointer array to hold the values
+        * ownership is passed
+        */
+        // and puts it on the CleanupStack
+        void AppendCmListLC( TUint32 aDestintaionId, RPointerArray<CCmPluginBase>& aCmArray);
+
+        /**
+        * Returns a list of references to the connection methods in the supported uid list . 
+        *
+        * @since 3.2
+        * @param aPluginArray A pointer array to hold the values
+        * ownership is passed
+        */
+        void AppendCmListFromUidsL( RArray<TUint32>& cmIdList, RPointerArray<CCmPluginBase>& aCMArray );        
+
+        /**
+        * Returns internet destination id. If internety destination is not found then -1 is returned.
+        *
+        * @since 5.0
+        * @return Internet destination id
+        */
+        TUint32 GetInternetDestinationIdL();
+        
+        /**
+        * Register aWatcher as watcher for change of CommsDat
+        */
+        IMPORT_C void WatcherRegisterL( MCmCommsDatWatcher* aWatcher );
+        
+        /**
+         * UnRegister current watcher
+         */
+        IMPORT_C void WatcherUnRegister();
+        
+        /*
+         * Find if aDest is still existed if some change is watched
+         */
+        IMPORT_C TBool DestinationStillExistedL( CCmDestinationImpl* aDest );
+        
+        /*
+         * Find if an Iap is still existed if some change is watched
+         * 
+         * The Iap, as parameter, is contained in the instance aPlugin
+         */        
+        IMPORT_C TBool IapStillExistedL( const CCmPluginBaseEng& aPlugin );
+        
+        /*
+         * Find if an Iap is still in aDest if some change is watched
+         * 
+         * The Iap, as parameter, is contained in the instance aPlugin
+         */
+        IMPORT_C TBool IsIapStillInDestL( CCmDestinationImpl* aDest, const CCmPluginBaseEng& aPlugin );
+
+    private:
+            
+        /**
+        * Creates bearer priority array
+        *
+        * @since 3.2
+        */          
+        void CreateBearerPriorityArrayL();   
+        
+        /**
+        * Look for the given resource file in the resource
+        * file array and return the index value of it.
+        *
+        * @since 3.2
+        * @param aName resource file name, not localized
+        * @return index of the resource file in the array
+        */
+        TInt FindResourceFile( TFileName& aName ) const;
+        
+        /**
+        * Build an array of all bearer specific plugins.
+        *
+        * @since 3.2
+        */
+        void BuildPluginArrayL();
+    
+        /**
+        * Return the copy of the bearer priority array. Ownership is passed.
+        *
+        * @since 3.2
+        * @param aArray bearer priority array
+        */          
+        void CopyBearerPriorityArrayL( RArray<TBearerPriority>& aArray ) const;
+        
+        /**
+        * Return if the IAP record points to an EasyWLan service record.
+        *
+        * @since 3.2
+        * @param aIapRecord IAP record to be checked
+        * @return ETrue if AP is EasyWLan
+        */
+        TBool IsEasyWLanL( CommsDat::CCDIAPRecord* aIapRecord ) const;
+        
+        /**
+        * Replaces the Default Connection record with the new one.
+        *
+        * @since 3.2
+        * @param aDCSetting Default Connection value to set
+        */
+        void ReplaceDefConnRecordL( const TCmDefConnValue aDCSetting );
+        
+        /**
+        * Combines two lists of CCmPluginBase pointers into one, according to default
+        * priority order
+        *
+        * @since 3.2
+        * @param aCmArray first list of connection methods to combine
+        * @param aCmLinkedArray second list of connection methods to combine
+        */
+        void CombineArraysForPriorityOrderL( 
+                                        RPointerArray<CCmPluginBase>& aCmArray , 
+                                        RPointerArray<CCmPluginBase>& aCmLinkedArray );        
+
+
+        /**
+        * Gets the destination for the given element ID
+        *
+        * @since 3.2
+        * @param aCmId The element ID of the destination
+        * @return Id of the parent
+        */
+        TUint32 ParentDestinationL( TUint32 aCmId );
+                
+        /**
+        * Returns the default general connection values.
+        *
+        * @since 9.2
+        * @param aGenConnSettings The general connection settings structure
+        */
+        void SetGenConnSettingsToDefault( TCmGenConnSettings& aGenConnSettings );
+        
+        /** 
+         * Leaves if no sufficient is available for creation operations
+         * 
+         * @since 9.2
+         */
+        void CheckAvailableSpaceL();
+        
+	    /**
+         * Get Snap Table ID from CommsDat
+         */
+        TUint32 GetSnapTableIdL();
+        
+#include "cmmanagerimpl.inl"               
+    //=========================================================================
+    // Member data
+        
+    private:
+    
+        CCmTransactionHandler*          iTrans;
+        
+        RFs                             iFs;
+        CArrayPtrFlat<TResourceFiles>*  iResourceFiles;
+        
+        // Destination network table ID
+        CommsDat::TMDBElementId iDestinationTableId;
+        //Global Bearer Type Priorization Table
+        CommsDat::TMDBElementId iBearerTypePriorizationTableId;
+        // Destination network - Icon table
+        CommsDat::TMDBElementId iIconTableId;
+        // Destination network - Icon table
+        CommsDat::TMDBElementId iSeamlessnessTableId;        
+        // Default Connection table
+        CommsDat::TMDBElementId iDefConnTableId;        
+        // Bearer priorities
+        RArray<TBearerPriority>* iBearerPriorityArray;
+        
+        CArrayPtrFlat<const CCmPluginBaseEng>* iPlugins;
+        
+        CCmConnectionMethodInfo* iPluginImpl;
+        
+        TUint iDestinationCount;
+        
+        CCMObjectPool* iObjectPool;
+              
+        // for the FeatureManager
+        TBool iIsFeatureManagerInitialised;
+        TBool iHelp;
+        TBool iDefConnSupported;
+        TBool iCreateTables;
+        TBool iWLan;
+               
+        // For CommsDat watcher
+        CCmCommsDatNotifier* iCommsDatIapNotifier;
+        CCmCommsDatNotifier* iCommsDatSnapNotifier;
+    private:
+    
+        friend class CCmDestinationImpl;
+        friend class CCMObjectPool;
+        friend class CCmConnectionMethodInfo;
+    };
+
+#endif // CMMANAGERIMPL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Inc/cmmanagerimpl.inl	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,59 @@
+/*
+* 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 connection method manager
+*
+*/
+
+#ifndef CMMANAGERIMPL_INL
+#define CMMANAGERIMPL_INL
+
+public:
+        /**
+        * The cm have been updated if it was a new cm
+        * than the zero id must be changed to the new one 
+        *
+        * @param aCM - the cm to change
+        */         
+        inline void ConnMethodUpdatedL( CCmPluginBaseEng* aCM )
+            {
+            iObjectPool->ConnMethodUpdatedL( aCM );
+            iPluginImpl->ResetIfInMemory( aCM );
+            }
+
+public:
+        template<typename TArrayToCleanup>
+        /*
+        * Pushes an array to the CleanupStack, calling it's ResetAndDestroy
+        * when destroying it.
+        */
+        static void CleanupResetAndDestroyPushL(TArrayToCleanup& aPtr)
+            {
+            void (*p)(TAny*) = CCmManagerImpl::ResetAndDestroy<TArrayToCleanup>;
+            CleanupStack::PushL( TCleanupItem(p, (void*)(&aPtr)) );
+            }
+private:
+        /**
+        * A cleanup function for TCleanupItem construction for
+        * cleanup of pointers in an RPointerArray
+        * usage: 
+        * CleanupStack::PushL( TCleanupItem( CCmManagerImpl::DestroyRPointerArray<ItemTypeName>, (void*)(PointerToArray)) )
+        * @return TInt
+        */        
+        template<typename TArrayToCleanup>
+        static void ResetAndDestroy(TAny* aPtr)
+        {
+        TArrayToCleanup *p = static_cast <TArrayToCleanup*> (aPtr);
+        p->ResetAndDestroy();
+        }   
+#endif // CMMANAGERIMPL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Inc/cmobjectpool.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,188 @@
+/*
+* 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:  Object pool for storing destinations and connection
+*                methods.
+*
+*/
+
+#ifndef CMOBJECTPOOL_H
+#define CMOBJECTPOOL_H
+
+class CCmPluginBaseEng;
+class CCmPluginBase;
+class CCmManagerImpl;
+
+// User includes
+#include "cmdestinationimpl.h"
+#include <e32def.h>
+
+/**
+ *  Object pool to  hold destination implementations and 
+ *  connetion method implementations
+ *
+ *  The get and remove functions must be used in pairs
+ */
+NONSHARABLE_CLASS( CCMObjectPool ) : public CBase
+	{
+
+	public:
+		CCMObjectPool(CCmManagerImpl& aCmManagerImpl);
+		virtual ~CCMObjectPool();
+        /**
+        * If the destinaton impl is in the pool returns a pointer to it. 
+        * If the destinaton impl is not in the pool creates it.
+        *
+        * @param aDestinationId - ID of the destination requested
+        * @return pointer to the destination - ownership passed
+        */         
+        CCmDestinationImpl* GetDestinationL( TUint32 aDestinationId );
+        /**
+        * If the destinaton impl is in the pool returns a pointer to it. 
+        * If the destinaton impl is not in the pool creates it.
+        *
+        * @param aName - name of the destination requested
+        * @return pointer to the destination - ownership passed
+        */         
+        CCmDestinationImpl* GetDestinationL( const TDesC& aName );
+
+        /**
+        * Creates a destination if it does not exist.
+        * 
+        * @param aName - name of the destination requested
+        * @param aDestId - predefined id for the destination
+        * @return pointer to the destination - ownership passed
+        */         
+        CCmDestinationImpl* CreateDestinationL( const TDesC& aName, TUint32 aDestId );
+
+        /**
+        * Returns a pointer to an allready existing connecton method
+        *
+        * @param aCmId - ID of the CM requested
+        * @param aParentDest - parent destination
+        * @return plugin instance - ownership passed
+        */         
+        CCmPluginBase* GetConnectionMethodL( TUint32             aCmId, 
+                                             CCmDestinationImpl* aParentDest );
+        /**
+        * Creates cm and places it into the pool.
+        *
+        * @param aImplementationUid - Bearer Type
+        * @param aParams Init params for the plugin
+        * @return plugin instance - ownership passed
+        */         
+        CCmPluginBase* CreateConnectionMethodL( TUint32 aImplementationUid, 
+                                 TCmPluginInitParam& aParams );
+
+        /**
+        * Creates cm and places it into the pool.
+        *
+        * @param aImplementationUid - Bearer Type
+        * @param aParams Init params for the plugin
+        * @param aConnMethodId Predefined id for the connection method.
+        * @return plugin instance - ownership passed
+        */         
+        CCmPluginBase* CreateConnectionMethodL( TUint32 aImplementationUid, 
+                                                TCmPluginInitParam& aParams,
+                                                TUint32 aConnMethodId );
+
+        /**
+        * Creates cm and places it into the pool.
+        *
+        * @param pluginBaseEng - Object to put in the pool
+        * @return plugin instance - ownership passed
+        */         
+        CCmPluginBase* CreateConnectionMethodL( CCmPluginBaseEng* pluginBaseEng );
+
+        /**
+        * Insert cm and places it into the pool.
+        * API doesn't use CCmPluginBase. So, nothing returns
+        *
+        * @param pluginBaseEng - Object to put in the pool
+        */         
+        void InsertConnectionMethodL( CCmPluginBaseEng* pluginBaseEng );
+
+        /**
+        * Removes a destination impl from the object pool. 
+        *
+        * @param aDestination - the destination to remove
+        */         
+        void RemoveDestination( CCmDestinationImpl* aDestination );
+        
+        /**
+        * Removes a destination data from the object pool. 
+        *
+        * @param aDestination - the destination to remove
+        */         
+        void RemoveDestination( CCmDestinationData* aDestination );
+        
+        /**
+        * Removes a connection method impl from the object pool. 
+        *
+        * @param aDestinationId - ID of the connection method to remove
+        */         
+        void RemoveConnectionMethodL( CCmPluginBase* aCM );
+        
+        /**
+        * Removes a connection method impl from the object pool. 
+        *
+        * @param aDestinationId - ID of the connection method to remove
+        */         
+        void RemoveConnectionMethodL( CCmPluginBaseEng* aCM );
+
+        /**
+        * This is called after the new destination have been updated 
+        * This function updates the iDestinationId 
+        * field in the TObjectPoolDestinationItem
+        *
+        * @param aDestination - the destination to change
+        */         
+        void DestinationUpdated( CCmDestinationImpl* aDestination );
+
+        /**
+        * This is called after the new cm have been updated 
+        * This function updates the Id 
+        * field
+        *
+        * @param aCM - the CM to change
+        */         
+        void ConnMethodUpdatedL( CCmPluginBaseEng* aCM );
+        
+    private:
+		class TObjectPoolDestinationItem  
+		    {
+		    public:
+                TObjectPoolDestinationItem(
+                        CCmDestinationData* aDestinationItem, 
+                        TUint32             aDestinationId);  
+    		    TInt                iDestinationId;
+    		    CCmDestinationData* iDestinationItem;
+		    };
+		class TObjectPoolCMItem  
+		    {
+		    public:
+                TObjectPoolCMItem(
+                        CCmPluginBaseEng* iConnectionMethodItem, 
+                        TUint32           iConnectionMethodId); 
+    		    TInt                iConnectionMethodId;
+    		    CCmPluginBaseEng*   iConnectionMethodItem;
+		    };
+	private:
+	    CCmManagerImpl&                     iCmManagerImpl;
+	    // object pool for holding destination implementations
+	    RArray<TObjectPoolDestinationItem>  iDestinationArray;
+	    // object pool for holding connetion method implementations
+	    RArray<TObjectPoolCMItem>           iConnectionMethodArray;
+};
+
+#endif // CMOBJECTPOOL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Inc/cmpluginmenucommands.hrh	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* 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:  Menu command ids for connection method plugins
+*
+*/
+
+#ifndef CMPLUGINMENUCOMMANDS_HRH
+#define CMPLUGINMENUCOMMANDS_HRH
+
+enum TCmPluginMenuCommands  /// Commands.
+    {
+    EPluginBaseCmdChange = 202,
+    EPluginBaseCmdAdvanced,
+    EPluginBaseCmdExit
+    };
+
+#endif // CMPLUGINMENUCOMMANDS_HRH
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Inc/cmpluginmultilinedialog.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,65 @@
+/*
+* 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 CCmPluginMultiLineDialog.
+*
+*/
+
+#ifndef CM_PLUGIN_MULTILINE_DIALOG_H
+#define CM_PLUGIN_MULTILINE_DIALOG_H
+
+// INCLUDE FILES
+#include <AknQueryDialog.h>
+
+/**
+ *  A new class to extend the functionality of the existing 
+ *  CAKnMultiLineIpQueryDialog to be able to accept 0 length settings...
+ *  Nothing else is changed.
+ *
+ *  @lib cmmanager.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CCmPluginMultiLineDialog ) : 
+                    public CAknMultiLineDataQueryDialog
+    {
+    public:
+
+        /**
+        * Multiline data query dialog, 2 lines
+        * @param aText1 Text1
+        * @param aText2 Text2
+        * @param aTone Tone 
+        * @return A constructed CCmPluginMultiLineDialog
+        */
+       IMPORT_C static CCmPluginMultiLineDialog* NewL(
+                            TDes&  aText1, TDes&  aText2, 
+                            TTone aTone = ENoTone);
+
+    protected:
+
+        /**
+        * If the query text is ok (retrieved form query controls) then 
+        * display the left soft key, otherwise hide it.
+        */
+        void UpdateLeftSoftKeyL();
+
+    private:
+
+        /**
+        * Constructor
+        * @param aTone Tone
+        */
+        CCmPluginMultiLineDialog( const TTone& aTone );
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Inc/cmsettingsuiimpl.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,80 @@
+/*
+* 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 setting UI
+*
+*/
+
+#ifndef C_CMSETTINGSUIIMPL_H
+#define C_CMSETTINGSUIIMPL_H
+
+#include <e32def.h>
+#include <e32base.h>
+#include <ConeResLoader.h>
+
+class CCmManagerImpl;
+
+/**
+ *  Implementation of setting UI
+ *
+ *  @lib cmmanager.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS(CCmSettingsUiImpl) : public CBase
+    {
+    public:
+
+        /** Epoc constructor */
+        static CCmSettingsUiImpl* NewL();
+
+        /** Destructor */
+        virtual ~CCmSettingsUiImpl();
+
+    //=========================================================================    
+    // UI API
+    //
+    public:
+
+        /**
+        * Launches the Settings UI 
+        * for handling Destinations and Connection Methods
+        * @since 3.2
+        */
+        TInt RunSettingsL();
+        
+        /**
+        * Launches a dialog with a list of Destination
+        * @since 3.2
+        * @param  aDestinationId ID of the selected Destination
+        * @return TBool
+        */
+        TBool SelectDestinationDlgL( TUint32& aDestinationId );
+
+    private:
+
+        /** First stage constructor */
+        CCmSettingsUiImpl();
+
+        /** Epoc constructor */
+        void ConstructL();
+
+        /** Load resource */
+        TInt LoadResourceL ();
+
+    private: // data
+
+        CCmManagerImpl* iCmManagerImpl;
+        RConeResourceLoader iResourceReader;
+    };
+
+#endif // C_CMSETTINGSUIIMPL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Inc/cmtransactionhandler.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,83 @@
+/*
+* 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 transaction handler
+*
+*/
+
+#ifndef CMTRANSACTION_HANDLER_H
+#define CMTRANSACTION_HANDLER_H
+
+#include <commsdattypesv1_1.h>
+
+/**
+ *  Transaction handler.
+ *
+ *  @lib cmmanager.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CCmTransactionHandler ) : public CBase
+    {
+    public:
+
+        /** Epoc constructor */
+        static CCmTransactionHandler* NewL( CommsDat::CMDBSession& aDb );
+        
+        // destructor is intentionally not virtual.
+        ~CCmTransactionHandler();
+
+    public:
+    
+        /**
+        * @return commsdat session
+        */
+        CommsDat::CMDBSession& Session()const{ return iDb; };
+        
+        /**
+        * - Checks if transaction is already opened
+        * - Set iOwnTransaction is not and opens it and
+        *   put 'this' on cleanup&close stack
+        */
+        void OpenTransactionLC( TBool aSetAttribs = ETrue );
+        
+        /**
+        * - Checks if the transaction is ours.
+        * - If yes, commits the transaction.
+        * - anyway does nothing
+        * @praram aError - error id
+        */
+        void CommitTransactionL( TInt aError = KErrNone );
+        
+        /**
+        * Performs RollbackTransactionL().
+        */
+        void Close();     
+
+    private:
+    
+        /** Constructor. */
+        CCmTransactionHandler( CommsDat::CMDBSession& aDb );
+
+        /**
+        * Second phase constructor. Leaves on failure.
+        */      
+        void ConstructL();
+
+    private: // data
+    
+        CommsDat::CMDBSession&    iDb;   ///< Not owned CommsDat session pointer
+        TUint32         iRefCount;
+        TUint32         iProtectionFlag;
+    };
+
+#endif // CMTRANSACTION_HANDLER
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Inc/cmwizard.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,128 @@
+/*
+* 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:  Wizard used for adding connection methods
+*
+*/
+
+#ifndef T_TCMWIZARD_H
+#define T_TCMWIZARD_H
+
+// INCLUDE FILES
+#include <e32def.h>
+#include <AknProgressDialog.h>
+
+// FORWARD DECLARATIONS
+class CAknWaitDialog;
+class CCmDestinationImpl;
+class CCmManagerImpl;
+class CCmPluginBase;
+
+/**
+ *  Connection Method wizard
+ *
+ *  Wizard used for creating a new Connection Method.
+ *
+ *  @lib cmmanager.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CCmWizard ) : public CBase,
+                                 public MProgressDialogCallback
+    {
+    public: // constructor
+
+        /**
+         * Constructor.
+         *
+         * @param aCmManager Connection Method Manager implementation passed
+         * for queries.
+         */
+        CCmWizard( CCmManagerImpl& aCmManager );
+
+        /**
+        * Destructor.
+        */
+        ~CCmWizard();
+
+    public: // public methods
+    
+        /**
+        * Key method for creating a new Connection Method. This function
+        * guides the user through several steps and then finally creates
+        * a new Connection Method based on the information the user has given.
+         * @param aTargetDestination Target destination to which the new
+         * connection method will be added. Can be NULL if the
+         * destination is to be selected by the user later on (via a dialog).
+        */
+        TInt CreateConnectionMethodL
+                            ( CCmDestinationImpl* aTargetDestination = NULL );
+
+    public: // from MProgressDialogCallback
+    
+        /**
+        * @see MProgressDialogCallback mixin for more details.
+        */
+        void DialogDismissedL( TInt aButtonId );
+
+    private: // internal helper methods
+    
+        /**
+        * Shows a dialog asking the user if he/she wants to have the available
+        * connection methods automatically checked for.
+        * @return ETrue if the user wants the conn methods be automatically
+        * discovered, EFalse if he/she wants to discover them manually.
+        */
+        TBool AutoCheckForCmsL() const;
+
+        /**
+        * If automatic CM detection has failed, the user is prompted a dialog
+        * asking if he/she wants to proceed with manual configuration.
+        * @return ETrue if the user wants to proceed with manual configuration,
+        * EFalse otherwise.
+        */
+        TBool ManualCheckForCmsL() const;
+
+        /**
+        * Checks for availability of packet data and WLAN bearer types. Shows
+        * a wait dialog until discovery is not complete.
+        * @param aCoverageArray This array is supposed to hold the UIDs of
+        * bearers that have network coverage for the moment.
+        */
+        void CheckForCmsL( RArray<TUint32>& aCoverageArray );
+        
+        
+        /**
+         * Finds the target destination to which the currently creted VPN
+         * connection method points. It can be a destination or the destination
+         * which includes the connection method to which the VPN points.
+         * @param aPlugin VPN plugin.
+         * @return the Id of the destination 
+         */
+        TUint32 FindTargetDestinationL( CCmPluginBase* aPlugin );
+
+        /**
+         * Finds the parent destination of a connection method.
+         * @param Id of the connection method
+         * @return Id of the destination which contains cmId 
+         */
+        TUint32 FindParentDestinationL( TUint32 aCmId );
+
+    private: // data
+    
+        CAknWaitDialog* iCheckConnDlg;  ///< Owned.
+        TBool iCheckConnDlgCancelled;
+        
+        CCmManagerImpl& iCmManager;     ///< Only a reference == not owned.
+    };
+
+#endif // T_TCMWIZARD_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Inc/destdlg.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,249 @@
+/*
+* 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:  Dialog for displaying and editing destinations.
+*
+*/
+
+#ifndef DESTDIALOG_H
+#define DESTDIALOG_H
+
+//  INCLUDES
+#include <AknForm.h>
+#include <cmsettingsui.h>
+#include "destlistboxmodel.h"
+#include "destlistbox.h"
+#include "cmmanagerimpl.h"
+#include "cmconnsettingsuiimpl.h"
+#include <mcmdexec.h>
+#include "cmcommsdatnotifier.h"
+
+// CLASS DECLARATION
+class CEikStatusPane;
+class CAknTitlePane;
+class CAknNavigationControlContainer;
+class CAknNavigationDecorator;
+class CCmWizard;
+class CCmdExec;
+
+/**
+*  Dialog for setting the gateway's IP address
+*/
+NONSHARABLE_CLASS( CDestDlg ) : public CAknDialog
+                              , MEikListBoxObserver
+                              , public MCmdExec
+                              , public MCmCommsDatWatcher
+    {
+    public :    // construction
+    
+        /**
+        * Default constructor.
+        */
+        CDestDlg();
+
+        /**
+        * Destructor.
+        */
+        ~CDestDlg();
+        
+         /**
+        * Create and launch dialog.
+        * @return           The code returned by the dialogs' ExecuteLD
+        */
+        TInt ConstructAndRunLD( CCmManagerImpl* aCmManager, TUint32 aHighLight, 
+                                TUint32& aSelected, TBool& aExiting );
+
+        // From MEikMenuObserver
+        virtual void DynInitMenuPaneL( TInt aResourceId, 
+                                       CEikMenuPane* aMenuPane );
+
+        // From MEikCommandObserver
+        virtual void ProcessCommandL( TInt aCommandId ) ; 
+
+        /**
+        * Updates listbox data
+        */
+        void HandleListboxDataChangeL();
+
+        /**
+        * 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 );        
+        
+     
+	public:
+        /**
+         * From base class MCmdExec
+         */
+        void Execute();
+
+        /**
+         * From base class MCmdExec
+         */
+        void CDestDlg::HandleLeaveError( TInt aError );
+
+    public: // From CCoeControl
+    
+        /**
+        * Returns the help context
+        * From CCoeControl
+        * 
+        * @since S60 3.2
+        * @param aContext the returned help context
+        */
+        void GetHelpContext( TCoeHelpContext& aContext ) const;
+        
+        /**
+        * Handles the resource change
+        * From CCoeControl
+        * 
+        * @since S60 5.0
+        * @param aType Type of the resource change
+        */
+		void HandleResourceChange( TInt aType );
+        
+        /**
+        * Show default connection note
+        * 
+        * @since S60 5.0
+        * @param aOldConn Old default connection
+        */
+        void ShowDefaultConnectionNoteL(TCmDefConnValue aOldDefConn);
+        
+    public: // From MCmCommsDatWatcher
+        
+        /**
+         * Watch changes in CommsDat
+         */
+        void CommsDatChangesL();
+        
+    protected :    // from CEikDialog
+    
+        /**
+        * Set the gateway's IP address, if the user pressed OK.
+        * @param aButtonId The ID of the pressed button.
+        * @return May the dialog exit?
+        */
+        TBool OkToExitL( TInt aButtonId ) ;
+        
+        void PreLayoutDynInitL();
+        
+        SEikControlInfo CreateCustomControlL ( TInt aControlType );
+
+        // From MEikListBoxObserver
+        void HandleListBoxEventL( CEikListBox* aListBox, 
+                                  TListBoxEvent aEventType );
+                                  
+        /**
+        * Sets the number of connections text on navi pane
+        */                                  
+        void SetNoOfDestsL(TInt aCount);                                  
+
+    private:
+    
+        /**
+        * Initialises listbox texts
+        */    
+        void InitTextsL();
+
+        /**
+        * Creates a new destination and adds it to Destination view.
+        */
+        void AddDestinationL();
+        
+        /**
+        * Called when user selected edit on a destination.
+        */
+        void OnCommandDestinationEditL();
+        
+        /**
+        * Called when user selected delete on a destination.
+        */
+        void OnCommandDestinationDeleteL();
+        
+        /**
+        * Called when user selected rename on a destination.
+        */
+        void OnCommandDestinationRenameL();
+        
+        /**
+        * Called when destination is about to be deleted.
+        */
+        TBool IsThereProtectedMethodL( CCmDestinationImpl* aDest );
+        
+        /**
+        * Sets the text of the middle soft key by the text resource. 
+        */
+        void CDestDlg::SetMskL( TInt aResourceId );
+        
+        /**
+        * Shows the 'Default set to:' note.
+        */
+        void ShowDefaultSetNoteL(TCmDefConnValue aSelection);
+        
+        /**
+        * Shows the 'Default:' in navi pane.
+        */
+        void SetDefaultNaviL( TCmDefConnValue aSelection );
+        
+        /**
+        * Counts how many CMs can be displayed.(Shouldn't display
+        * CMs for which the plugin is not loaded.)
+        */
+        TUint32 NumberOfCMsL( RArray<TUint32> cmArray );
+
+        /**
+        * Enforced to release allocated memory and reset protection
+        * when some exceptions occur
+        */
+        void EnforcedResetCDestDlg();
+     
+    protected:
+    
+        CDestListboxModel*      iModel;
+        CDestListbox*           iListbox;
+        TUint32                 iHighlight;
+        TUint32*                iSelected;           
+        TBool                   iModelPassed;
+        CEikStatusPane*         iStatusPane;    // NOT owned
+        CAknTitlePane*          iTitlePane;     // NOT owned
+        CAknNavigationControlContainer* iNaviPane;      // NOT owned
+        CAknNavigationDecorator*        iNaviDecorator; // owned
+        HBufC*                  iOldTitleText;
+        CCmManagerImpl*         iCmManagerImpl; // NOT owned
+        TInt                    iExitReason;    // Exit reason, can be 
+                                                // KUserExit or KUserBack
+                                                // used to pass user exit event   
+        CCmConnSettingsUiImpl* iConnSettingsImpl;
+        CCmdExec*             iCmdExec;        
+        
+     private:     
+
+        CCmWizard*          iCmWizard; // wizard for connection method creation
+        // Indicated that Escape has arrived and it should be forwarded when CmWizard
+        // finished its work
+        TBool               iEscapeArrived;
+        
+        // Indicates whether the Exit button was pressed. Not owned.
+        TBool*              iExiting;
+        
+        // This dialog shouldn't exit while processing in a plugin
+        // Indicates whether processing or not
+        TBool               iProcessing;
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Inc/destlistbox.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,97 @@
+/*
+* 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 CDestListbox.
+*
+*/
+
+#ifndef APSELECTOR_LISTBOX_H
+#define APSELECTOR_LISTBOX_H
+
+// INCLUDE FILES
+#include <aknlists.h>
+
+// FORWARD DECLARATION
+class CDestListboxModel;
+
+/**
+ *  Model for the destinations listbox. It is an array of CDestListItem
+ *  pointers; items are owned.
+ *
+ *  @lib cmmanager.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CDestListbox ) : public CAknDoubleLargeStyleListBox
+    {
+    public:     // Construct / destruct
+
+        /**
+        * Two-phased constructor. Leaves on failure.
+        * @param aParent Parent control.
+        * @return The constructed listbox.
+        */
+        static CDestListbox* NewL
+            ( const CCoeControl* aParent );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CDestListbox();
+
+        /**
+        * Constructor.
+        */
+        CDestListbox();
+
+    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 );
+
+        /**
+        * Gets the UID from a given item
+        * @param    The index of the item
+        * @return   The UID of the item given by itemindex
+        */
+        TUint32 Uid4Item( TInt aItem ) const;
+
+        /**
+        * Gets the UID of the current item
+        * @return  The UID of the current item
+        */
+        TUint32 CurrentItemUid() const;
+
+        /**
+        * Gets the name of the current item
+        * @return The name of the current item
+        */
+        const TDesC& CurrentItemNameL();
+        
+
+        // from CCoeControl
+        void HandleResourceChange(TInt aType);
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Inc/destlistboxmodel.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,113 @@
+/*
+* 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 CDestListboxModel.
+*
+*/
+
+#ifndef DESTLISTBOX_LISTBOX_MODEL_H
+#define DESTLISTBOX_LISTBOX_MODEL_H
+
+// INCLUDE FILES
+#include <eikdialg.h>
+#include "destlistitemlist.h"
+#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include <commsdat.h>
+#else
+#include <commsdat.h>
+#include <commsdat_partner.h>
+#endif
+
+// CONSTANTS
+// Granularity of the model array.
+const TInt KGranularity = 8;
+_LIT( KListItemFormatDestProt, "%d\t%S\t%S\t%d" );
+_LIT( KListItemFormatDest, "%d\t%S\t%S" );
+const TInt KMaxFormatSize = sizeof( KListItemFormatDest );
+const TInt KMaxListItemNameLength = CommsDat::KMaxTextLength;
+const TInt KMaxDestListboxName = KMaxListItemNameLength+KMaxFormatSize;
+
+/**
+ *  Model for the destinations listbox.
+ *  pointers; items are owned.
+ *
+ *  @lib cmmanager.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CDestListboxModel ) : public CDestListItemList
+                                       , public MDesCArray
+    {
+    public:     // Construct / Destruct
+
+        /**
+        * Constructor.
+        * @param aGraphicType   The used graphic type
+        */
+        CDestListboxModel();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CDestListboxModel();
+
+    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;
+
+    public:        
+        
+        /**
+        * Sets the icon offset
+        * @param aOffset    The offset of our icons in the iconarray
+        */
+        void SetOwnIconOffset( TInt aOffset );
+
+    private:    // data
+    
+        /**
+        * Formats the text of the listbox, calls the leaving version trapped.
+        * @param aIndex Index of item.
+        * @param aBuf Buffer to store formatted text.
+        */
+        void FormatListboxText( TInt aIndex, TDes& aBuf ) const;
+
+        /**
+        * Formats the text of the listbox, leaving version.
+        * @param aIndex Index of item.
+        * @param aBuf Buffer to store formatted text.
+        */
+        void FormatListboxTextL( TInt aIndex,
+                                                TDes& aBuf ) const;
+        /**
+        * MdcaPoint() cannot leave, so this buffer is allocated
+        * to allow formatting. Fortunately, doesn't have to be very
+        * large.
+        * We have to use MUTABLE CAST, as MdcaPoint is const (odd enough),
+        * so wouldn't allow formatting the text in a member...
+        */
+        __MUTABLE TBuf<KMaxDestListboxName> iBuf;
+        TInt iOffset;
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Inc/destlistitem.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,130 @@
+/*
+* Copyright (c) 2002 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 the CDestSelect class.
+*
+*/
+
+
+#ifndef CDESTLISTITEM_H
+#define CDESTLISTITEM_H
+
+#include <e32base.h>
+#include <cmmanagerdef.h>
+
+/**
+ *  Representation of a destinations list item.
+ *  This class is used to hold the main information of a destination.
+ *
+ *  @lib cmmanager.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CDestListItem ) : public CBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor. Leaves on failure, places instance
+        * on cleanup stack.
+        * @param aUid The ID of the destination
+        * @param aName The name of the destination
+        * @param aNumOfCMs the number of connection methods belonging to the destination
+        * @param aIconIndex The icon index of the destination
+        * @param aIsProtected Whether the given item is read-only or not
+        * @return The constructed CDestListItem.
+        */
+         static CDestListItem* NewLC( TUint32 aUid,
+                                      HBufC* aName,
+                                      TInt aNumOfCMs, 
+                                      TUint aIconIndex, 
+                                      CMManager::TProtectionLevel aProtectionLevel,
+                                      TBool aIsDefault );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CDestListItem();
+
+    protected:      // Constructors
+    
+        /**
+        * C++ default constructor.
+        */
+        CDestListItem( HBufC* aName );
+        
+        /**
+        * Second-phase constructor.
+        * @param aUid The ID of the destination
+        * @param aNumOfCMs the number of connection methods belonging to the destination
+        * @param aIconIndex The icon index of the destination
+        * @param aIsProtected Whether the given item is read-only or not
+        * @return The constructed CDestListItem.
+        */
+        void ConstructL( TUint32 aUid,
+                         TInt aNumOfCMs, 
+                         TUint aIconIndex, 
+                         CMManager::TProtectionLevel aProtectionLevel,
+                         TBool aIsDefault );
+    public: // New functions
+
+        /**
+        * Gets the name of the 'current' destination
+        * Ownership of the returned text is not passed.
+        * @return The name of the current destination
+        */
+        const TDesC& Name();
+
+        /**
+        * Gets the UID of the current destination
+        * @return The UID of the current destination
+        */
+        TUint32 Uid();
+
+        /**
+        * Gets the number of connection mehtods belonging to the current destination
+        * @return The number of connection mehtods belonging to the current destination
+        */
+        TInt NumOfCMs();
+         
+        /**
+        * Gets the IconIndex of the current destination
+        * @return The IconIndex of the current destination
+        */
+        TUint IconIndex();
+
+        /**
+        * Returns the destination's protected flag
+        * @return ETrue if the destination is protected
+        */ 
+        TUint IsProtected();
+        /**
+        * Returns the Protection Level
+        * @return TProtectionLevel
+        */ 
+        CMManager::TProtectionLevel GetProtectionLevel();
+        TUint IsDefault();
+
+    private:    // Data
+
+        TUint32         iUid;           ///< The ID of the destination
+        HBufC*          iName;          ///< The name of the destination
+        TInt            iNumOfCMs;      ///< The number of connection mehtods belonging to the
+                                        //// destination
+        TUint           iIconIndex;     ///< The iIconIndex of the destination
+        TBool           iIsProtected;   ///< The IsProtected flag of the destination
+        TBool           iIsDefault;   ///< The IsDefault flag of the destination
+        CMManager::TProtectionLevel iProtectionLevel;
+    };
+
+#endif      // CDESTLISTITEM_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Inc/destlistitemlist.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,60 @@
+/*
+* 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 the CDestListItemList class.
+*
+*/
+
+#ifndef CDestLISTITEMLIST_H
+#define CDestLISTITEMLIST_H
+
+//  INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATION
+class CDestListItem;
+
+/**
+ *  A list of CDestListItem-s pointers; items are owned.
+ *
+ *  @lib cmmanager.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CDestListItemList ) : public CArrayPtrFlat<CDestListItem>
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * C++ default constructor.
+        */
+        CDestListItemList();
+
+        /**
+        * Destructor. Items in the list are destroyed.
+        */
+        virtual ~CDestListItemList();
+
+    public:  // New methods
+
+        /**
+        * Get pointer to the item having aUid,
+        * or NULL if no such item is in the
+        * list.
+        * @param aUid Uid of item to get.
+        * @return Pointer to the item having uid aUid, or NULL. Ownership
+        * not passed (the list still owns the item).
+        */
+        CDestListItem* ItemForUid( TUint32 aUid ) const;
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Inc/selectdestinationdlg.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,122 @@
+/*
+* 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:  Shows the "Select destination:" dialog, where the user can 
+                 select one of the available destinations.
+*
+*/
+
+#ifndef SELECTDESTINATIONDLG_H
+#define SELECTDESTINATIONDLG_H
+
+// INCLUDES
+#include <aknlistquerydialog.h>
+
+// FORWARD DECLARATIONS
+class CCmManagerImpl;
+class CCmDestinationImpl;
+
+// CLASS DECLARATION
+
+/**
+ *  Show a query containing a title, a message box (contain a short explanation
+ *  of the query) and a listbox. The listbox contains a list of available
+ *  destinations from which the user can choose.
+ *
+ *  @lib cmmanager.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CSelectDestinationDlg ) : public CAknListQueryDialog
+    {
+    public: // Constructors, destructor
+    
+        /**
+        * Two-phase constructor.
+        * @param aDestinationId Variable reference used to hold the return
+        * value of list selection.
+        * @param aCmManager Reference to CM Manager implementation used for
+        * querying destination specific data.
+        * @return Newly created dialog object.
+        */
+        static CSelectDestinationDlg* NewL( 
+                                        TUint32& aDestinationId,
+                                        CCmManagerImpl& aCmManager,
+                                        RArray<TUint32>* aDestArray = NULL);
+
+        /**
+        * Two-phase constructor.
+        * @param aDestinationId Variable reference used to hold the return
+        * value of list selection.
+        * @param aCmManager Reference to CM Manager implementation used for
+        * querying destination specific data.
+        * @return Newly created dialog object.
+        */
+        static CSelectDestinationDlg* NewLC( 
+                                        TUint32& aDestinationId,
+                                        CCmManagerImpl& aCmManager,
+                                        RArray<TUint32>* aDestArray = NULL);
+
+        /**
+        * Destructor.
+        */
+        ~CSelectDestinationDlg();
+
+    private: // constructors
+    
+        /**
+        * Constructor.
+        */
+        CSelectDestinationDlg( TInt aDummyIndex, TUint32& aDestinationId );
+
+        /**
+        * Second-phase constructor.
+        * @param aCmManager Reference to CM Manager implementation used for
+        * querying destination specific data.
+        */
+        void ConstructL( CCmManagerImpl& aCmManager, 
+                         RArray<TUint32>* aDestArray );
+
+    private: // From CAknListQueryDialog
+    
+        /**
+        * @see CAknListQueryDialog
+        */
+        virtual void PreLayoutDynInitL();
+
+        /**
+        * @see CAknListQueryDialog
+        */
+        TBool OkToExitL( TInt aButtonId );
+
+    private: // internal helper methods
+    
+        /**
+        * Handle resource change events. 
+        * @param aType: The type of resources that have changed
+        */
+        void HandleResourceChange( TInt aType );
+
+    private:  // New functions
+
+        /**
+        * Sets graphic icons
+        */
+        void SetIconsL();
+
+    private: //data
+
+        TUint32& iDestinationId;
+        RPointerArray<CCmDestinationImpl> iDestinations;
+    };
+
+#endif  // SELECTDESTINATIONDLG_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Inc/uncatdlg.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,125 @@
+/*
+* 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:  Dialog for displaying and editing legacy connection methods
+*
+*/
+
+#ifndef UNCATDIALOG_H
+#define UNCATDIALOG_H
+
+//  INCLUDES
+#include "cmdlg.h"
+
+// CLASS DECLARATION
+class CEikStatusPane;
+class CAknTitlePane;
+class CAknNavigationControlContainer;
+class CAknNavigationDecorator;
+
+typedef struct
+    {
+    CCmPluginBase*      iPlugin;
+    TUint32             iCmId;
+    }TUncatItem;
+    
+/**
+ *  Dialog for displaying and editing legacy iaps
+ *
+ *  @lib cmmanager.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CUncatDlg ) : public CCmDlg
+    {
+    public :    // construction
+    
+        /** Epoc constructor */
+        static CUncatDlg* NewL( CCmManagerImpl* aCmManager );
+
+        /** Destructor. */
+        ~CUncatDlg();
+        
+    public: // New functions
+    
+        /**
+        * Create and launch dialog.
+        * @return The code returned by the dialogs' ExecuteLD
+        */
+        TInt ConstructAndRunLD( TUint32 aHighLight, TUint32& aSelected );        
+
+        // From MEikMenuObserver
+        void DynInitMenuPaneL( TInt aResourceId, 
+                               CEikMenuPane* aMenuPane );
+
+        // From MEikCommandObserver
+        void ProcessCommandL( TInt aCommandId ) ; 
+        
+        /**
+        * Updates listbox data
+        */
+        void ConstructCMArrayL( RArray<TUint32>& aCmIds );
+        
+    public: // From MCmCommsDatWatcher
+        
+        /**
+         * Watch changes in CommsDat
+         */        
+        void CommsDatChangesL();
+                
+       private:    // Constructor 
+        
+        /**
+        * Default constructor.
+        */
+        CUncatDlg( CCmManagerImpl* aCmManager );
+
+    private :    // from CEikDialog
+    
+        /**
+        * Set the gateway's IP address, if the user pressed OK.
+        * @param aButtonId The ID of the pressed button.
+        * @return May the dialog exit?
+        */
+        void InitTextsL();   
+        
+        /**
+        * Returns the currently focused connection method in the list
+        */
+        CCmPluginBase* CurrentCML(); 
+                
+        /**
+        * Returns the connection method in the list at the specified index
+        */
+        CCmPluginBase* CMByIndexL( TInt aIndex );
+       
+        /**
+        * Returns the connection mehtod count
+        */
+        TInt CMCount();
+        
+        /**
+        * Cleans up iCmUncatItems
+        *
+        * @param aReuse whether the array will be used again or not
+        * @since S60 3.2
+        */
+        void CleanupUncatArray( TBool aReuseArray = EFalse );
+
+    protected:
+    
+        RArray<TUncatItem>   iCmUncatItems;
+    };
+
+#endif
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Src/ccmdexec.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,69 @@
+/*
+* Copyright (c) 2008 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:  Execute command without blocking the process. Needed for
+*                touch UI implementation.
+*
+*/
+
+#include <e32base.h>
+#include <mcmdexec.h>
+#include "ccmdexec.h"
+
+// ----------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that might leave.
+// ----------------------------------------------------------------------------
+//
+CCmdExec::CCmdExec(MCmdExec& aOwner) :
+    CActive( CActive::EPriorityStandard ),
+    iOwner(aOwner)
+    {
+    CActiveScheduler::Add(this);
+    }
+
+// ----------------------------------------------------------------------------
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CCmdExec::~CCmdExec()
+    {
+    Cancel();
+    }
+
+void CCmdExec::Execute()
+    {
+    // Cancel possible previous request
+    Cancel();
+    
+    // Do request
+    TRequestStatus *requestStatus = &iStatus;
+    User::RequestComplete(requestStatus, KErrNone);
+    SetActive();
+    }
+            
+void CCmdExec::RunL()
+    {
+    iOwner.Execute();
+    }
+
+TInt CCmdExec::RunError( TInt aError )
+    {
+    if (aError != 0)
+        iOwner.HandleLeaveError( aError );
+    return KErrNone;
+    }
+
+void CCmdExec::DoCancel()
+    {
+    
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Src/ccmpluginbaseeng.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,3553 @@
+/*
+* 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 plugin base class
+*
+*/
+#include <cmmanager.rsg>
+#include <es_sock.h>    // RSocketServ, RConnection
+#include <in_sock.h>    // KAfInet
+#include <es_enum.h>    // TConnectionInfo
+#include <StringLoader.h>
+#include <AknUtils.h>
+#include <data_caging_path_literals.hrh>
+#include <sysutil.h> 
+
+#include <cmmanager.h>
+#include "cmmanagerimpl.h"
+#include "cmdestinationimpl.h"
+#include <cmpluginbaseeng.h>
+#include <cmpsettingsconsts.h>
+#include "cmlogger.h"
+#include <cmcommonui.h>
+
+using namespace CMManager;
+using namespace CommsDat;
+
+// EXTERNAL LINKS
+
+// MACROS
+
+#undef _IPV6_DISABLED
+
+// CONSTANTS
+const TInt KApMaxConnNameLength = 30;
+_LIT(KFormatPostfix, "%02d");
+_LIT(KFormatLargePostfix, "%d");
+_LIT(KFormatNameWithPostfix, "%S(%S)" );
+_LIT(KFormatNoPostfix, "%S");
+const TInt KMaxPostfixLength = 5;
+const TInt KEstimatedOverhead = 8192;
+
+_LIT( KDefWapGatewayIpAddress, "0.0.0.0" );
+    
+_LIT( KLocationName, "Mobile" );
+
+static const TCmAttribConvTable SIapConvTbl[] = 
+    {
+    // iAttribId, iCommsDatId, iValidFuncL, 
+    // iTitleId, 
+    // iMaxLength, iAttribFlags, iDefValueResId, iEditorResId, iNotUsed1, iNotUsed2
+    // first element describes the min-max values, does not connects to DB!
+    { ECmName, ECmIapId, NULL },
+    { ECmName, KCDTIdRecordName, NULL,
+        R_CMMANAGERUI_CONNECTION_NAME,
+        KMaxConnNameLength, EConvNoZeroLength | EConvCompulsory, 
+        0, R_TEXT_SETTING_PAGE_CONN_NAME, NULL, NULL },
+    { ECmIapId, KCDTIdRecordTag, NULL },
+    { 0, 0, NULL },
+    };
+
+static const TCmAttribConvTable SProxyConvTbl[] = 
+    {
+    // iAttribId, iCommsDatId, iValidFuncL, 
+    // iTitleId, 
+    // iMaxLength, iAttribFlags, iDefValueResId, iEditorResId, iNotUsed1, iNotUsed2
+    { ECmProxyUsageEnabled, ECmProxyRangeMax, NULL },
+    { ECmProxyUsageEnabled, KCDTIdUseProxyServer, NULL },
+    { ECmProxyServerName,   KCDTIdServerName, &SetProxyServerNameL, 
+        R_QTN_SET_PROXY_SERVER_ADDRESS, 
+        KMaxProxyServerLength, 0, R_QTN_SET_PROXY_SERVER_ADDRESS_NONE, R_TEXT_SETTING_PAGE_PROXY_SERVER_ADDR, NULL, NULL },
+    { ECmProxyProtocolName, KCDTIdProtocolName, NULL },
+    { ECmProxyPortNumber,   KCDTIdPortNumber, &CheckPortNumberValidityL,
+        R_QTN_SET_PROXY_PORT_NUMBER,
+        KMaxProxyPortNumberLength, EConvNumber, 0, 0, NULL, NULL },
+    { ECmProxyExceptions,   KCDTIdExceptions, NULL },
+    { 0, 0, NULL },
+    };
+
+static const TCmAttribConvTable SChargeCardConvTbl[] =
+    {
+    { ECmChargeCardUsageEnabled, ECmChargeCardRangeMax, NULL },
+    { ECmChargeCardAccountNumber, KCDTIdAccountNo, NULL },
+    { ECmChargeCardPIN, KCDTIdPin, NULL },
+    { ECmChargeCardLocalRule, KCDTIdLocalRule, NULL },
+    { ECmChargeCardNatRule, KCDTIdNatRule, NULL },
+    { ECmChargeCardIntlRule, KCDTIdIntlRule, NULL },
+    { 0, 0, NULL },
+    };
+
+static const TCmAttribConvTable SLocationConvTbl[] =
+    {
+    { ECmLocationUsageEnabled, ECmLocationRangeMax, NULL },
+    { ECmLocationIntlPrefixCode, KCDTIdIntlPrefixCode, NULL },
+    { ECmLocationNatPrefixCode, KCDTIdNatPrefixCode, NULL },
+    { ECmLocationNatCode, KCDTIdNatCode, NULL },
+    { ECmLocationAreaCode, KCDTIdAreaCode, NULL },
+    { ECmLocationDialOutCode, KCDTIdDialOutCode, NULL },
+    { ECmLocationDisableCallWaitingCode, KCDTIdDisableCallWaitingCode, NULL },
+    { ECmLocationMobile, KCDTIdMobile, NULL },
+    { ECmLocationUsePulseDial, KCDTIdUsePulseDial, NULL },
+    { ECmLocationWaitForDialTone, KCDTIdWaitForDialTone, NULL },
+    { ECmLocationPauseAfterDialOut, KCDTIdPauseAfterDialOut, NULL },
+    { 0, 0, NULL },
+    };
+
+static const TCmAttribConvTable SWapConvTbl[] = 
+    {
+    { ECmWapIPGatewayAddress, ECmWapRangeMax, NULL },
+    { ECmWapIPGatewayAddress, KCDTIdWAPGatewayAddress, &CheckIPv4ValidityL },
+    { ECmWapIPWSPOption, KCDTIdWAPWSPOption, &CheckWAPWspOptionValidityL },
+    { ECmWapIPSecurity, KCDTIdWAPSecurity, NULL },
+    { ECmWapIPProxyPort, KCDTIdWAPProxyPort, &CheckPortNumberValidityL },
+    { ECmWapIPProxyLoginName, KCDTIdWAPProxyLoginName, NULL },
+    { ECmWapIPProxyLoginPass, KCDTIdWAPProxyLoginPass, NULL },
+    { 0, 0, NULL },
+    };
+
+static const TCmAttribConvTable SUiTable[] = 
+    {
+    { ECmName, 0, NULL,
+        R_CMMANAGERUI_CONNECTION_NAME,
+        KMaxConnNameLength, EConvNoZeroLength | EConvCompulsory, 0, R_TEXT_SETTING_PAGE_CONN_NAME, NULL, NULL },
+    { ECmBearerSettingName, 0, NULL,
+        R_PLUGIN_BASE_SET_AP_BEARER,
+        0, 0, 0, 0, NULL, NULL },
+    { ECmStartPage, 0, NULL,
+        R_QTN_SET_STARTING_PAGE,
+        KMaxStartPageLength, 0, R_QTN_SET_HOME_PAGE_NONE, R_TEXT_SETTING_PAGE_STARTING_PAGE, 
+        R_START_PAGE_DEF_VALUE, NULL, NULL },
+    { 0, 0, NULL,
+        0, 
+        0, 0, 0, NULL, NULL },
+    };
+
+/**
+ * Private data of plugin base
+ */
+NONSHARABLE_CLASS( CCmPluginBasePrivate ) : public CBase
+    {
+    public:
+    
+        CCmPluginBasePrivate();
+        ~CCmPluginBasePrivate();
+    
+    public:
+    
+        CCDWAPAccessPointRecord*    iWapAPRecord;
+        CCDWAPIPBearerRecord*       iWapIPBearerRecord;
+        CCDIAPMetadataRecord*       iMetaDataRecord;
+        
+        TNamingMethod   iNamingMethod;
+        
+        CArrayPtrFlat<TCmAttrConvArrayItem>*        iConvTblArray;
+        RArray<const TCmCommonAttrConvArrayItem*>   iCommonConvTblArray;
+        
+        TInt    iLoadResult;
+    };    
+
+// ======== LOCAL FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// ReadOnlyAttributeL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool ReadOnlyAttributeL( CCmPluginBaseEng* aThis, 
+                                  TUint32 aAttribute,
+                                  const TAny* aValue )
+    {
+    User::Leave( KErrNotSupported );
+
+    (void)aThis;
+    (void)aAttribute;
+    (void)aValue;
+    
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// CheckIPv4ValidityL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CheckIPv4ValidityL( CCmPluginBaseEng* aThis, 
+                                  TUint32 aAttribute,
+                                  const TAny* aValue )
+    {
+    (void)aThis;
+    (void)aAttribute;
+    (void)aValue;
+    
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// CheckIPv6ValidityL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CheckIPv6ValidityL( CCmPluginBaseEng* aThis, 
+                                  TUint32 aAttribute,
+                                  const TAny* aValue )
+    {
+    (void)aThis;
+    (void)aAttribute;
+    (void)aValue;
+    
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// CheckPortNumberValidityL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CheckPortNumberValidityL( CCmPluginBaseEng* aThis, 
+                                        TUint32 aAttribute,
+                                        const TAny* aValue )
+    {
+    (void)aThis;
+    (void)aAttribute;
+    (void)aValue;
+    
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// CheckRecordIdValidityL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CheckRecordIdValidityL( CCmPluginBaseEng* aThis, 
+                                      TUint32 aAttribute,
+                                      const TAny* aValue )
+    {
+    TUint32 recId = *(TUint32*)aValue;
+    
+    if( recId < 1 || recId > 254 )
+        {
+        CLOG_WRITE_1_PTR( aThis, "Not valid Rec id: [%d]", recId );
+        User::Leave( KErrArgument );
+        }
+
+    (void)aThis;
+    (void)aAttribute;
+    (void)aValue;
+    
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// CheckWAPWspOptionValidityL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CheckWAPWspOptionValidityL( CCmPluginBaseEng* aThis, 
+                                          TUint32 aAttribute,
+                                          const TAny* aValue )
+    {
+    TUint32 wspOpt = (TUint32)aValue;
+    
+    
+    if( wspOpt != ECmWapWspOptionConnectionless &&
+        wspOpt != ECmWapWspOptionConnectionOriented )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    (void)aThis;
+    (void)aAttribute;
+    (void)aValue;
+    
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// IsUnspecifiedIPv4Address
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool IsUnspecifiedIPv4Address( const TDesC& aIpv4Address )
+    {
+    if( aIpv4Address.Length() == 0 ||
+        !aIpv4Address.CompareF( KUnspecifiedIPv4 ) )
+        {
+        return ETrue;
+        }
+        
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// ClassifyIPv6Address
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TIPv6Types ClassifyIPv6Address( const TDesC& aIpv6Address )
+    {
+    if( aIpv6Address.Length() == 0 ||
+        !aIpv6Address.CompareF( KDynamicIpv6Address ) )
+        {
+        return EIPv6Unspecified;
+        }
+    else if( !aIpv6Address.CompareF( KKnownIp6NameServer1 ) ||
+             !aIpv6Address.CompareF( KKnownIp6NameServer2 ) )
+        {
+        return EIPv6WellKnown;
+        }
+        
+    return EIPv6UserDefined;
+    }
+
+// ---------------------------------------------------------------------------
+// SetProxyServerNameL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool SetProxyServerNameL( CCmPluginBaseEng* aThis, 
+                                   TUint32 /*aAttribute*/, 
+                                   const TAny* aValue )
+    {
+    const TDesC* proxyServer = (const TDesC*)aValue;
+    
+    return aThis->SetProxyServerNameL( *proxyServer );
+    }
+    
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// TCmPluginInitParam::TCmPluginInitParam
+// ---------------------------------------------------------------------------
+//
+TCmPluginInitParam::TCmPluginInitParam( CCmManagerImpl& aCmMgr )
+    : iCmMgr( aCmMgr )
+    {
+    iParentDest = 0;
+    iNotused1 = NULL;
+    iNotused2 = NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBasePrivate::CCmPluginBasePrivate
+// ---------------------------------------------------------------------------
+//
+CCmPluginBasePrivate::CCmPluginBasePrivate()
+    : iNamingMethod( ENamingUnique )
+    , iCommonConvTblArray( KDefAttrsArrayGranSize )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBasePrivate::~CCmPluginBasePrivate
+// ---------------------------------------------------------------------------
+//
+CCmPluginBasePrivate::~CCmPluginBasePrivate()
+    {
+    delete iWapAPRecord;
+    delete iWapIPBearerRecord;
+    delete iMetaDataRecord;
+    
+    if ( iConvTblArray )
+        {
+        iConvTblArray->ResetAndDestroy();
+        delete iConvTblArray;
+        }
+        
+    iCommonConvTblArray.Reset();
+    iCommonConvTblArray.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::CCmPluginBaseEng
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmPluginBaseEng::CCmPluginBaseEng( TCmPluginInitParam *aInitParam )
+    : iCmMgr( aInitParam->iCmMgr )
+    , iParentDest( aInitParam->iParentDest )
+    {
+    CLOG_CREATE;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::~CCmPluginBaseEng
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmPluginBaseEng::~CCmPluginBaseEng()
+    {
+    Reset();
+    
+    delete iPriv;
+    
+    REComSession::DestroyedImplementation( iDtor_ID_Key );
+    CLOG_CLOSE;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::ConstructL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmPluginBaseEng::ConstructL()
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::ConstructL" );
+
+    iPriv = new (ELeave) CCmPluginBasePrivate;
+    
+    // 4 for our tables + 4 for bearer specific ones.
+    iPriv->iConvTblArray = new (ELeave)CArrayPtrFlat<TCmAttrConvArrayItem>( 8 );
+
+    AddConverstionTableL( (CCDRecordBase**)&iIapRecord, 
+                          NULL, SIapConvTbl );
+    AddConverstionTableL( (CCDRecordBase**)&iProxyRecord, 
+                          NULL, SProxyConvTbl );
+    AddConverstionTableL( (CCDRecordBase**)&iChargeCardRecord, 
+                          &iChargeCardEnabled, SChargeCardConvTbl );
+    AddConverstionTableL( (CCDRecordBase**)&iLocationRecord, 
+                          &iLocationEnabled, SLocationConvTbl );
+    AddConverstionTableL( (CCDRecordBase**)&iPriv->iWapIPBearerRecord, 
+                          NULL, SWapConvTbl );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::GetIntAttributeL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TUint32 
+            CCmPluginBaseEng::GetIntAttributeL( const TUint32 aAttribute ) const
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::GetIntAttributeL" );
+
+    TUint32 retVal( 0 );
+    
+    switch ( aAttribute )
+        {
+        case ECmBearerIcon:
+            {
+            retVal = 0; // bearer doesn't provide any icon
+            }
+            break;
+            
+        case ECmBearerAvailableIcon:            
+            {
+            retVal = 0; // bearer doesn't provide any icon
+            }
+            break;
+            
+        case ECmId: // if the CM has an IapId than the ECmId is the ECmId
+        case ECmIapId:
+            {
+            retVal = iIapId;
+            }
+            break;
+        case ECmWapId:
+            {
+            retVal = iPriv->iWapIPBearerRecord->iWAPAccessPointId;
+            }
+            break;
+        case ECmIapServiceId:
+            {
+            retVal = TUint32(iIapRecord->iService);
+            }
+            break;
+        case ECmBearerType:
+            {
+            retVal = iBearerType;
+            }
+            break;
+            
+        case ECmDefaultPriority:
+            {
+            retVal = KDataMobilitySelectionPolicyPriorityWildCard;
+            }
+            break;
+            
+        case ECmDefaultUiPriority:
+            {
+            retVal = KDataMobilitySelectionPolicyPriorityWildCard;
+            }
+            break;
+            
+        case ECmNamingMethod:
+            {
+            retVal = iPriv->iNamingMethod;
+            }
+            break;
+            
+        case ECmExtensionLevel:
+            {
+            retVal = KExtensionBaseLevel;
+            }
+            break;
+            
+        case ECmInvalidAttribute:
+            {
+            retVal = iInvalidAttribute;
+            }
+            break;
+            
+        case ECmCommsDBBearerType:
+            {
+            User::Leave( KErrUnknown );
+            }
+            break;
+            
+        case ECmSeamlessnessLevel:
+            {
+            retVal = iPriv->iMetaDataRecord->iSeamlessness;
+            }
+            break;
+            
+        case ECmElementID:
+            {
+            if ( !iIapRecord )
+                {
+                User::Leave( KErrNotReady );
+                }
+                
+            retVal = (KCDMaskShowField & iIapRecord->ElementId());
+            }
+            break;
+            
+        case ECmLoadResult:
+            {
+            retVal = iPriv->iLoadResult;
+            }
+            break;
+            
+        case ECmNetworkId:
+            {
+            retVal = iIapRecord->iNetwork;
+            }
+            break;
+            
+        default:
+            {
+            TUint32 attribute = CheckForCommonAttribute( aAttribute );            
+            CMDBField<TUint32>* field;
+
+            FindFieldL( attribute, ECmInt, (CMDBElement*&)field );
+
+            retVal = *field;        
+            }
+            break;
+        }
+        
+    return retVal;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::GetBoolAttributeL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool 
+        CCmPluginBaseEng::GetBoolAttributeL( const TUint32 aAttribute ) const
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::GetBoolAttributeL" );
+
+    TBool retVal;
+
+    switch ( aAttribute )
+        {
+        case ECmProtected:
+            {
+            retVal = IsProtected();
+            }
+            break;
+            
+        case ECmHidden:
+            {
+            retVal = iIapRecord->Attributes() & ECDHidden;
+            }
+            break;
+
+        case ECmDestination:
+            {
+            retVal = EFalse;
+            }
+            break;
+            
+        case ECmChargeCardUsageEnabled:
+            {
+            retVal = iChargeCardEnabled;
+            }
+            break;
+            
+        case ECmCoverage:
+            // In default the plugin has no network coverage
+            {
+            retVal = EFalse;
+            }
+            break;
+            
+        case ECmAddToAvailableList:
+            {
+            retVal = EFalse;
+            }
+            break;
+            
+        case ECmBearerHasUi:
+            {
+            retVal = EFalse;
+            }
+            break;
+            
+        case ECmMetaHighlight:
+            {
+            retVal = iPriv->iMetaDataRecord->iMetadata & EMetaHighlight;
+            }
+            break;
+            
+        case ECmMetaHiddenAgent:
+            {
+            retVal = iPriv->iMetaDataRecord->iMetadata & EMetaHiddenAgent;
+            }
+            break;
+            
+        case ECmIPv6Supported:
+            {
+            retVal = FeatureSupported( KFeatureIdIPv6 );
+            }
+            break;
+            
+        case ECmConnected:
+            {
+            retVal = CheckIfAlreadyConnected();
+            }
+            break;
+
+        case ECmVirtual:
+            {
+            retVal = EFalse;
+            }
+            break;
+            
+        case ECmIsLinked:
+            {
+            retVal = iCmMgr.IsIapLinkedL( *this );
+            }
+            break;
+            
+        default:
+            {
+            TUint32 attribute = CheckForCommonAttribute( aAttribute );            
+            CMDBField<TBool>* field;
+
+            FindFieldL( attribute, ECmBool, (CMDBElement*&)field );
+
+            retVal = *field;        
+            }
+        }
+
+    return retVal;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::GetStringAttributeL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C HBufC* 
+    CCmPluginBaseEng::GetStringAttributeL( const TUint32 aAttribute ) const
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::GetStringAttributeL" );
+
+    HBufC* retVal = NULL;
+    
+    switch ( aAttribute )
+        {
+        case ECmStartPage:
+            {
+            retVal = TPtrC(iPriv->iWapAPRecord->iWAPStartPage).AllocL();
+            }
+            break;
+            
+        case ECmName:
+            {
+            retVal = TPtrC(iIapRecord->iRecordName).AllocL();
+            }
+            break;
+
+        default:
+            {
+            TUint32 attribute = CheckForCommonAttribute( aAttribute );
+            CMDBField<TDesC>* field;
+            
+            FindFieldL( attribute, ECmText, (CMDBElement*&)field );
+
+            if ( !field->IsNull() )
+                {
+                retVal = field->GetL().AllocL();
+                }
+            else
+                {
+                retVal = KNullDesC().AllocL();
+                }
+            }
+        }
+        
+    return retVal;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::GetString8AttributeL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C HBufC8* 
+    CCmPluginBaseEng::GetString8AttributeL( const TUint32 aAttribute ) const
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::GetString8AttributeL" );
+
+    HBufC8* retVal = NULL;
+    
+    switch ( aAttribute )
+        {
+        default:
+            {
+            TUint32 attribute = CheckForCommonAttribute( aAttribute );
+            CMDBField<TDesC8>* field;
+                        
+            FindFieldL( attribute, ECmText8, (CMDBElement*&)field );
+
+            if ( !field->IsNull() )
+                {
+                retVal = field->GetL().AllocL();
+                }
+            else
+                {
+                retVal = KNullDesC8().AllocL();
+                }
+            }
+        }
+        
+    return retVal;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::SetIntAttributeL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmPluginBaseEng::SetIntAttributeL( const TUint32 aAttribute, 
+                                                  TUint32 aValue )
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::SetIntAttributeL" );
+
+    switch ( aAttribute )
+        {
+        case ECmNamingMethod:
+            {
+            iPriv->iNamingMethod = (TNamingMethod)aValue;
+            }
+            break;
+
+        case ECmCommsDBBearerType:
+        case ECmElementID:
+        case ECmIapId:
+        case ECmId:
+            {
+            User::Leave( KErrNotSupported );
+            }
+            break;
+            
+        case ECmSeamlessnessLevel:
+            {
+            if ( aValue == ESeamlessnessConfirmFirst ||
+                 aValue == ESeamlessnessShowprogress )
+                {
+                iPriv->iMetaDataRecord->iSeamlessness = aValue;
+                }
+            else
+                {
+                User::Leave( KErrNotSupported );
+                }
+            }
+            break;
+                                   
+        case ECmNetworkId:
+            {
+            User::Leave( KErrNotSupported );
+            }
+            break;
+           
+        default:
+            {
+            TUint32 attribute = CheckForCommonAttribute( aAttribute );
+            CMDBField<TUint32>* field;
+            
+            TValidationFunctionL func = 
+                        FindFieldL( attribute, ECmInt, (CMDBElement*&)field );
+            
+            if( func )
+                {
+                func( this, attribute, (TAny*)aValue );
+                }
+                
+            *field = aValue;
+            }
+            break;
+        }
+        
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::SetBoolAttributeL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmPluginBaseEng::SetBoolAttributeL( const TUint32 aAttribute, 
+                                                   TBool aValue )
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::SetBoolAttributeL" );
+
+    switch ( aAttribute )
+        {
+        case ECmProtected:
+            {
+            SetAttribute( iIapRecord, ECDProtectedWrite, aValue );
+            }
+            break;
+            
+        case ECmHidden:
+            {
+            // Check that this is not Default Connection
+            TCmDefConnValue defConn;
+            iCmMgr.ReadDefConnL( defConn );
+            if ( defConn.iType == ECmDefConnConnectionMethod &&
+                 defConn.iId == iIapRecord->RecordId() )
+                {
+                User::Leave( KErrArgument );
+                }
+            
+            SetAttribute( iIapRecord, ECDHidden, aValue );
+            }
+            break;
+            
+        case ECmProxyUsageEnabled:
+            {
+            EnableProxyL( aValue );
+            }
+            break;
+            
+        case ECmChargeCardUsageEnabled:
+            {
+            EnableChargeCardL( aValue );
+            }
+            break;
+            
+        case ECmLocationUsageEnabled:
+            {
+            EnableLocationL( aValue );
+            }
+            break;
+            
+        case ECmMetaHighlight:
+            {
+            if( aValue )
+                {
+                iPriv->iMetaDataRecord->iMetadata =
+                          EMetaHighlight | iPriv->iMetaDataRecord->iMetadata;
+                }
+            else
+                {
+                iPriv->iMetaDataRecord->iMetadata =
+                        ~EMetaHighlight & iPriv->iMetaDataRecord->iMetadata;
+                }
+            }
+            break;
+            
+        case ECmMetaHiddenAgent:
+            {
+            if( aValue )
+                {
+                iPriv->iMetaDataRecord->iMetadata =
+                        EMetaHiddenAgent | iPriv->iMetaDataRecord->iMetadata;
+                }
+            else
+                {
+                iPriv->iMetaDataRecord->iMetadata = 
+                      ~EMetaHiddenAgent & iPriv->iMetaDataRecord->iMetadata;
+                }
+            }
+            break;
+            
+        default:
+            {
+            TUint32 attribute = CheckForCommonAttribute( aAttribute );
+            CMDBField<TBool>* field;
+            
+            TValidationFunctionL func = 
+                        FindFieldL( attribute, ECmBool, (CMDBElement*&)field );
+            
+            if( func )
+                {
+                func( this, attribute, (const TAny*)aValue );
+                }
+                
+
+            *field = aValue;
+            }
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::SetStringAttributeL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmPluginBaseEng::SetStringAttributeL( const TUint32 aAttribute, 
+                                                     const TDesC16& aValue )
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::SetStringAttributeL" );
+
+    TUint32 commonattribute = MappedCommonAttribute( aAttribute );
+    switch ( commonattribute )
+        {
+        case ECmStartPage:
+            {
+            iPriv->iWapAPRecord->iWAPStartPage.SetL( aValue );
+            }
+            break;
+            
+        case ECmName:
+            {
+            SetNameL( aValue );
+            }
+            break;
+        case ECmIPAddress:
+            {
+            GenericStringWriterL( commonattribute, aValue );
+            if (( aValue.Compare(KUnspecifiedIPv4) == 0) || ( aValue.Compare(KNullDesC)==0 ) )
+                {
+                SetBoolAttributeL( ECmIPAddFromServer, ETrue );
+                }
+            else
+                {
+                SetBoolAttributeL( ECmIPAddFromServer, EFalse );
+                }
+            }
+            break;
+        default:
+            {
+            GenericStringWriterL( commonattribute, aValue );
+            }
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::SetString8AttributeL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmPluginBaseEng::SetString8AttributeL( const TUint32 aAttribute, 
+                                                      const TDesC8& aValue )
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::SetString8AttributeL" );
+
+    switch ( aAttribute )
+        {
+        default:
+            {
+            TUint32 attribute = CheckForCommonAttribute( aAttribute );
+            CMDBField<TDesC8>* field;
+            
+            TValidationFunctionL func = 
+                        FindFieldL( attribute, ECmText8, (CMDBElement*&)field );
+            
+            if( func )
+                {
+                func( this, attribute, (const TAny*)&aValue );
+                }
+
+            field->SetL( aValue );
+            }
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::RestoreAttributeL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmPluginBaseEng::RestoreAttributeL( const TUint32 aAttribute )
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::RestoreAttributeL" );
+
+    TCmAttrConvArrayItem* item = ConversionTable( aAttribute );
+
+    TInt index( 0 );
+    CMDBElement& field = FieldByAttributeL( item, aAttribute, index );
+    
+    TRAPD( err, field.LoadL( Session() ) );
+    if( err == KErrNotFound )
+        {
+        switch ( field.Type() )
+            {
+            case EText:
+            case EMedText:
+            case ELongText:
+                {
+                CMDBField<TDesC>* textField = static_cast<CMDBField<TDesC>*>( &field );
+                
+                textField->SetL( KNullDesC );
+                }
+                break;
+
+            case EDesC8:
+                {
+                CMDBField<TDesC8>* textField = static_cast<CMDBField<TDesC8>*>( &field );
+                
+                textField->SetL( KNullDesC8 );
+                }
+                break;
+                
+            case EUint32:
+            case EInt:
+            case EBool:
+                {
+                CMDBField<TInt>* intField = static_cast<CMDBField<TInt>*>( &field );
+                
+                intField->SetL( 0 );
+                }
+                break;
+                
+            default:
+                {
+                User::Leave( KErrArgument );
+                }
+                break;
+            }
+        }
+    else
+        {
+        User::LeaveIfError( err );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::Destination
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmDestinationImpl* CCmPluginBaseEng::Destination() const
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::Destination" );
+
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::UpdateL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmPluginBaseEng::UpdateL()
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::UpdateL" );
+
+    CheckSpaceBelowCriticalLevelL();
+
+    OpenTransactionLC();
+    
+    PrepareToUpdateRecordsL();
+    
+    UpdateChargeCardRecordL();
+    UpdateServiceRecordL();
+    
+    UpdateLocationRecordL();
+    UpdateNetworkRecordL();
+    
+    UpdateIAPRecordL();
+
+    UpdateWapRecordL();
+    UpdateProxyRecordL();
+    UpdateSeamlessnessRecordL();
+    UpdateConnPrefSettingL();
+    
+    UpdateAdditionalRecordsL();
+    
+    CommitTransactionL( 0 );
+    iCmMgr.ConnMethodUpdatedL( this );
+    iIdIsValid = ETrue;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::NumOfConnMethodReferencesL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmPluginBaseEng::NumOfConnMethodReferencesL()
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::NumOfConnMethodReferencesL" );
+
+    return iCmMgr.NumOfConnMethodReferencesL( iIapId );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::Session
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CMDBSession& CCmPluginBaseEng::Session()const
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::Session" );
+
+    return iCmMgr.Session();
+    }
+
+// ---------------------------------------------------------------------------
+// Delete this connection methond.
+// Record ids are checked to be sure that we delete only records
+// that were loaded before.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CCmPluginBaseEng::DeleteL( TBool aForced,
+                                          TBool aOneRefAllowed )
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::DeleteL" );
+    
+    if ( CheckIfAlreadyConnected() )
+        {
+        User::Leave( KErrInUse );
+        }
+
+    if( iPriv->iLoadResult )
+        // previous load failed -> do NOT delete this partially loaded cm.
+        {
+        User::Leave( KErrNotReady );
+        }
+        
+    if( GetBoolAttributeL( ECmIsLinked ) )
+        {
+        User::Leave( KErrLocked );
+        }
+        
+    // If there is no parent destination, we can delete
+    TBool retVal(ETrue);
+    
+    if( !aForced )
+        {
+        TInt refs = NumOfConnMethodReferencesL();
+        
+        switch ( refs )
+            {
+            case 0:
+                // no referencies to this cm
+                {
+                CLOG_WRITE( "No ref -> do delete it" );
+                }
+                break;
+                
+            case 1: 
+                // one reference
+                {
+                if ( !aOneRefAllowed )
+                    // this is not a legacy cm -> cannot be deleted.
+                    {
+                    retVal = EFalse;
+                    }
+                }
+                break;
+                
+            default:
+                // connection method is multiple referenced from
+                // destinations -> no delete
+                {
+                retVal = EFalse;
+                }
+                break;
+            }
+        }
+        
+    if ( retVal )
+        {
+        TCmDefConnValue deletedItem;
+        deletedItem.iType = ECmDefConnConnectionMethod;
+        deletedItem.iId = iIapId;
+        iCmMgr.HandleDefConnDeletedL( deletedItem );       
+
+        if( aForced )
+            {
+            iCmMgr.RemoveAllReferencesWoTransL( *this );
+            }
+
+        OpenTransactionLC();
+        // And now we have everything from CommsDat, 
+        // so we delete only those records.
+        PrepareToDeleteRecordsL();
+
+        if ( iIapRecord && iIapRecord->RecordId() )
+            {
+            iIapRecord->DeleteL( Session() );
+            }
+        
+        if ( iProxyRecord && iProxyRecord->RecordId() )
+            {
+            iProxyRecord->DeleteL( Session() );
+            }
+            
+        if ( iServiceRecord && iServiceRecord->RecordId() )
+            {
+            iServiceRecord->DeleteL( Session() );
+            }
+        
+        if ( iChargeCardRecord && iChargeCardRecord->RecordId() )
+            {
+            iChargeCardRecord->DeleteL( Session() );
+            }
+        
+        if ( iNetworkRecord && iNetworkRecord->RecordId() )
+            {
+            iNetworkRecord->DeleteL( Session() );
+            }
+        
+        if ( iLocationRecord && iLocationRecord->RecordId() )
+            {
+            iLocationRecord->DeleteL( Session() );
+            }
+        
+        if ( iPriv->iWapAPRecord && 
+            iPriv->iWapAPRecord->RecordId() )
+            {
+            iPriv->iWapAPRecord->DeleteL( Session() );
+            }
+        
+        if ( iPriv->iWapIPBearerRecord && 
+            iPriv->iWapIPBearerRecord->RecordId() )
+            {
+            iPriv->iWapIPBearerRecord->DeleteL( Session() );
+            }
+
+        if ( iPriv->iMetaDataRecord &&
+             iPriv->iMetaDataRecord->RecordId() )
+            {
+            iPriv->iMetaDataRecord->DeleteL( Session() );
+            }
+        
+        DeleteAdditionalRecordsL();
+
+        CommitTransactionL( KErrNone );
+        }
+
+    return retVal;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::LoadL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmPluginBaseEng::LoadL( TUint32 aIapId )
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::LoadL" );
+    CLOG_NAME_2( _L("plugin_0x%x_%d"), this, aIapId );
+
+    OpenTransactionLC();
+
+    // trap it to set iPriv->iLoadResult
+    TRAP( iPriv->iLoadResult, DoLoadL( aIapId ) );
+
+    User::LeaveIfError( iPriv->iLoadResult );
+    
+    RollbackTransaction();
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::CreateNewL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmPluginBaseEng::CreateNewL()
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::CreateNewL" );
+
+    CheckSpaceBelowCriticalLevelL();
+    
+    if ( iIapId )
+        // we already have IAP id ->
+        {
+        User::Leave( KErrAlreadyExists );
+        }
+
+    iPreDefIapId = 0;
+
+    // optional record are disable in default
+    iChargeCardEnabled = EFalse;
+    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));
+    NewWapRecordL();
+    iPriv->iWapIPBearerRecord->iWAPGatewayAddress.SetL( 
+                                                    KDefWapGatewayIpAddress );
+    
+    iPriv->iMetaDataRecord = NewSeamlessnessRecordL( ETrue );
+
+    // call plugin to create its own records
+    CreateNewServiceRecordL();
+    CreateAdditionalRecordsL();
+
+    EnableProxyL( EFalse );
+
+    // Load default CM name from resource
+    HBufC* defApName = AllocReadL( R_CMMANAGERENG_DEFAULT_AP_NAME );
+    CleanupStack::PushL( defApName );
+
+    SetNameL( *defApName );
+
+    CleanupStack::PopAndDestroy( defApName );
+
+    iIapRecord->iNetworkWeighting = 0; // it's always 0.
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::CreateCopyL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmPluginBaseEng* CCmPluginBaseEng::CreateCopyL() const
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::CreateCopyL" );
+    CheckSpaceBelowCriticalLevelL();
+    
+    TCmPluginInitParam params( iCmMgr );
+    
+    CCmPluginBaseEng* copyInst = CreateInstanceL( params );
+    CleanupStack::PushL( copyInst );
+    
+    copyInst->CreateNewL();
+
+    TInt err( KErrNone );
+    TRAP( err, copyInst->SetBoolAttributeL( ECmChargeCardUsageEnabled, iChargeCardEnabled ) );
+    if( err != KErrNotSupported )
+        {
+        User::LeaveIfError( err );
+        }
+    TRAP( err, copyInst->SetBoolAttributeL( ECmLocationUsageEnabled, iLocationEnabled ) );
+    if( err != KErrNotSupported )
+        {
+        User::LeaveIfError( err );
+        }
+    copyInst->SetIntAttributeL( ECmNamingMethod, iPriv->iNamingMethod );
+    copyInst->SetStringAttributeL( ECmName, TPtrC( iIapRecord->iRecordName ) );
+    copyInst->SetStringAttributeL( ECmStartPage, TPtrC( iPriv->iWapAPRecord->iWAPStartPage ) );
+
+
+    PrepareToCopyDataL( *copyInst );
+
+    for ( TInt tblInd = 0; tblInd < iPriv->iConvTblArray->Count(); ++tblInd )
+        {
+        const TCmAttrConvArrayItem* item = (*iPriv->iConvTblArray)[tblInd];
+        
+        if ( item->iEnabled && !(*item->iEnabled) )
+            // Enabled flag is set to 'disabled' state
+            {
+            continue;
+            }
+            
+        if( !item->iRecord || 
+            (item->iRecord && !(*item->iRecord)) )
+            // no record
+            {
+            continue;
+            }
+                
+        for ( TInt attrInd = 1; item->iConvTable[attrInd].iAttribId; ++attrInd )
+            {
+            if( item->iConvTable[attrInd].iAttribFlags & EConvReadOnly )
+                // Read-only flags are not copied.
+                {
+                continue;
+                }
+                
+            TInt commsdatid( item->iConvTable[attrInd].iCommsDatId );
+
+            if ( !commsdatid )
+                { // not connected to the DB, calculated field, no copy
+                continue;
+                }
+                
+            CMDBElement* field = (*item->iRecord)->GetFieldByIdL( commsdatid );
+    
+            if( field->IsNull() )
+                {
+                continue;
+                }
+                
+            switch ( field->Type() )
+                {
+                case EText:
+                case EMedText:
+                case ELongText:
+                    {
+                    CMDBField<TDesC>* textField = (CMDBField<TDesC>*)field;
+                
+                    TRAP( err, copyInst->SetStringAttributeL( 
+                                            item->iConvTable[attrInd].iAttribId,
+                                            *textField ) );
+                    if( err != KErrNotSupported )
+                        {
+                        User::LeaveIfError( err );
+                        }
+                    }
+                    break;
+                    
+                case EDesC8:
+                    {
+                    CMDBField<TDesC8>* textField = (CMDBField<TDesC8>*)field;
+                
+                    TRAP( err, copyInst->SetString8AttributeL( 
+                                            item->iConvTable[attrInd].iAttribId,
+                                            *textField ) );
+                    if( err != KErrNotSupported )
+                        {
+                        User::LeaveIfError( err );
+                        }
+                    }
+                    break;
+                    
+                case EUint32:
+                case EInt:
+                    {
+                    CMDBField<TUint32>* intField = (CMDBField<TUint32>*)field;
+                    
+                    TRAP( err, copyInst->SetIntAttributeL( 
+                                            item->iConvTable[attrInd].iAttribId,
+                                            *intField ) );
+                    if ( !(( err == KErrNotSupported ) || ( err == KErrArgument )) )
+                        {
+                        User::LeaveIfError( err );
+                        }
+                    }
+                    break;
+                    
+                case EBool:
+                    {
+                    CMDBField<TBool>* intField = (CMDBField<TBool>*)field;
+                    
+                    TRAP( err, copyInst->SetBoolAttributeL( 
+                                            item->iConvTable[attrInd].iAttribId,
+                                            *intField ) );
+                    if( err != KErrNotSupported )
+                        {
+                        User::LeaveIfError( err );
+                        }
+                    }
+                    break;
+                    
+                case ELink: // links are not copied!
+                default:
+                    {
+                    }
+                    break;
+                }
+            }                    
+        }
+
+    CopyAdditionalDataL( *copyInst );
+    
+    CleanupStack::Pop( copyInst );
+    
+    return copyInst;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::AddResourceFileL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmPluginBaseEng::AddResourceFileL( const TDesC& aName )
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::AddResourceFileL" );
+    
+    CLOG_WRITE_1( "[%S]", &aName );
+    
+    TParse fp;
+    TInt err = fp.Set( aName, 
+                        &KDC_RESOURCE_FILES_DIR, 
+                        NULL ); 
+    if ( err != KErrNone)
+        {
+        User::Leave( err );
+        }
+        
+    TFileName fName;
+    
+    fName.Copy( fp.FullName() );
+
+    iCmMgr.AddResourceFileL( fName );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::RemoveResourceFile
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmPluginBaseEng::RemoveResourceFile( const TDesC& aName )
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::RemoveResourceFileL" );
+
+    TParse fp;
+    TInt err = fp.Set( aName, 
+                        &KDC_RESOURCE_FILES_DIR, 
+                        NULL ); 
+    CLOG_WRITE_1( "Set: [%d]", err );
+        
+    TFileName fName;
+    
+    fName.Copy( fp.FullName() );
+
+    iCmMgr.RemoveResourceFile( fName );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::AllocReadL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C HBufC* CCmPluginBaseEng::AllocReadL( TInt aResourceId ) const
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::AllocReadL" );
+
+    return iCmMgr.AllocReadL( aResourceId );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::OpenTransactionLC
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBaseEng::OpenTransactionLC()
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::OpenTransactionL" );
+
+    iCmMgr.OpenTransactionLC( ETrue );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::CommitTransactionL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBaseEng::CommitTransactionL( TInt aError )
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::CommitTransactionL" );
+    
+    iCmMgr.CommitTransactionL( aError );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::RollbackTransaction
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBaseEng::RollbackTransaction()
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::RollbackTransaction" );
+    
+    iCmMgr.RollbackTransaction();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::PrepareToLoadRecordsL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBaseEng::DoLoadL( TUint32 aIapId )
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::DoLoadL" );
+
+    PrepareToLoadRecordsL();
+    
+    LoadIAPRecordL( aIapId );
+    LoadWapRecordL();
+    LoadSeamlessnessRecordL();
+    LoadNetworkSettingL();
+    LoadLocationSettingL();
+
+    // This is a connectionmethodinfo instance, that has no
+    // service and proxy setting.
+    if( KDummyBearerType != iBearerType )
+        {
+        LoadServiceSettingL();
+        LoadProxySettingL();
+        }
+
+    LoadAdditionalRecordsL();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::PrepareToLoadRecordsL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmPluginBaseEng::PrepareToLoadRecordsL()
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::PrepareToLoadRecordsL" );
+
+    iChargeCardEnabled = EFalse;
+    iLocationEnabled = EFalse;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::LoadIAPRecordL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBaseEng::LoadIAPRecordL( TUint32 aIapId )
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::LoadIAPRecordL" );
+
+    iIapId = aIapId;
+    
+    // Load IAP record
+    CCDIAPRecord *iapRecord = static_cast<CCDIAPRecord *>
+                            (CCDRecordBase::RecordFactoryL(KCDTIdIAPRecord));
+                            
+    CleanupStack::PushL( iapRecord );
+    
+    iapRecord->SetRecordId( iIapId );
+    
+    iapRecord->LoadL( Session() );
+    
+    CleanupStack::Pop( iapRecord );
+    
+    iIapRecord = iapRecord;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::LoadProxySettingL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBaseEng::LoadProxySettingL()
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::LoadProxySettingL" );
+    
+    // Load Proxy record
+    CMDBRecordSet<CCDProxiesRecord>* proxieRS = 
+              new(ELeave) CMDBRecordSet<CCDProxiesRecord>(KCDTIdProxiesRecord);
+    CleanupStack::PushL(proxieRS);
+
+    // Now try to find the linked proxy record
+    // create new record
+    CCDProxiesRecord* proxyRecord = static_cast<CCDProxiesRecord *>
+                          (CCDRecordBase::RecordFactoryL(KCDTIdProxiesRecord));
+
+    CleanupStack::PushL( proxyRecord );
+    
+    // Prime record
+    TPtrC serviceType( iIapRecord->iServiceType );
+    
+    proxyRecord->iServiceType.SetL( serviceType );
+    
+    proxieRS->iRecords.AppendL( proxyRecord );
+
+    CleanupStack::Pop( proxyRecord );
+    
+    proxyRecord = NULL;
+    
+    CLOG_WRITE_1( "Looking for proxy: [%d]", TUint32(iIapRecord->iService) );
+    
+    if ( proxieRS->FindL(Session()) )
+        {
+        TInt i(0);
+        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.
+            {
+            CCDProxiesRecord* proxyRecord = (*proxieRS)[i];
+            
+            // Compare the record id of these 2 services
+            if ( TUint32(proxyRecord->iService) == 
+                TUint32(iIapRecord->iService) )
+                {
+                iProxyRecord = proxyRecord;
+                // take ownership of this record
+                proxieRS->iRecords.Remove( i );
+                break;
+                }
+            ++i;
+            }
+        }
+    
+    proxieRS->iRecords.ResetAndDestroy();
+    
+    if( !iProxyRecord )
+        {
+        // This creates a proxy record, where usage is disabled.
+        EnableProxyL( EFalse );
+        }
+
+    CleanupStack::PopAndDestroy( proxieRS );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::LoadServiceSettingL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmPluginBaseEng::LoadServiceSettingL()
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::LoadServiceSettingL" );
+    
+    if ( iServiceRecord )
+        {
+        iServiceRecord->SetRecordId( iIapRecord->iService );
+        TRAPD( err, iServiceRecord->LoadL( Session() ) );
+        if( err == KErrNotFound )
+            // record not found -> create a default one
+            {
+            CreateNewServiceRecordL();
+            }
+        else
+            {
+            User::LeaveIfError( err );
+            }
+        }
+    else
+        {
+        CLOG_WRITE( "CCmPluginBaseEng::LoadServiceSettingL: No service rec" );
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::LoadChargeCardSettingL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBaseEng::LoadChargeCardSettingL( TUint32 aRecordId )
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::LoadChargeCardSettingL" );
+
+    if ( !aRecordId )
+        // No charge card is link to this IAP
+        {
+        iChargeCardEnabled = EFalse;
+        
+        CLOG_WRITE( "CCmPluginBaseEng::LoadChargeCardSettingL: No charge card" );
+        return;
+        }
+        
+    iChargeCardRecord = static_cast<CCDChargecardRecord *>
+                       (CCDRecordBase::RecordFactoryL(KCDTIdChargecardRecord));
+    iChargeCardRecord->SetRecordId( aRecordId );
+    TRAPD( err, iChargeCardRecord->LoadL( Session() ) );
+    if( err == KErrNotFound )
+        // referenced but doesn't exist. Try to fix it.
+        {
+        iChargeCardRecord->SetRecordId( KCDNewRecordRequest );
+        
+        // if it fails we can't do anything to solve this problem
+        iChargeCardRecord->StoreL( Session() );
+        }
+    else
+        {
+        User::LeaveIfError( err );
+        }
+    
+    iChargeCardEnabled = ETrue;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::LoadNetworkSettingL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBaseEng::LoadNetworkSettingL()
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::LoadNetworkSettingL" );
+    
+    CCDNetworkRecord* networkRecord = static_cast<CCDNetworkRecord*>
+                          (CCDRecordBase::RecordFactoryL(KCDTIdNetworkRecord));
+    CleanupStack::PushL( networkRecord );
+                       
+    networkRecord->SetRecordId( iIapRecord->iNetwork );
+    TRAPD( err, networkRecord->LoadL( Session() ) );
+    if( err == KErrNotFound )
+        {
+        CleanupStack::PopAndDestroy( networkRecord );
+
+        networkRecord = static_cast<CCDNetworkRecord*>
+                          (CCDRecordBase::RecordFactoryL(KCDTIdNetworkRecord));
+        }
+    else
+        // KErrNotFound -> doesn't matter. We will do it UpdateL()
+        {
+        User::LeaveIfError( err );
+
+        CleanupStack::Pop( networkRecord );
+        }
+
+    iNetworkRecord = networkRecord;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::LoadLocationSettingL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBaseEng::LoadLocationSettingL()
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::LoadLocationSettingL" );
+
+    CCDLocationRecord* locationRecord = static_cast<CCDLocationRecord*>
+                         (CCDRecordBase::RecordFactoryL(KCDTIdLocationRecord));
+         
+    CleanupStack::PushL( locationRecord );
+
+    locationRecord->SetRecordId( iIapRecord->iLocation );
+    if ( locationRecord->FindL(Session()) )
+        {
+        iLocationEnabled = ETrue;
+        
+        iLocationRecord = locationRecord;
+        
+        CleanupStack::Pop( locationRecord );
+        }
+    else
+        {
+        iLocationEnabled = EFalse;
+
+        CleanupStack::PopAndDestroy( locationRecord );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::PrepareToUpdateRecordsL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmPluginBaseEng::PrepareToUpdateRecordsL()
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::PrepareToUpdateRecordsL" );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::UpdateIAPRecordL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBaseEng::UpdateIAPRecordL()
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::UpdateIAPRecordL" );
+
+    if ( !iIapId )
+        {
+        if ( iPreDefIapId )
+            {
+            iIapRecord->SetRecordId( iPreDefIapId );
+            iPreDefIapId = 0;
+            }
+        else
+            {
+            iIapRecord->SetRecordId( KCDNewRecordRequest );
+            }
+
+        TUint32 id;
+        HBufC* name;
+        
+        ServiceRecordIdLC( name, id );
+        iIapRecord->iService = id;
+        iIapRecord->iServiceType.SetL( *name );
+        CleanupStack::PopAndDestroy( name );
+            
+        BearerRecordIdLC( name, id );
+        iIapRecord->iBearer = id;
+        iIapRecord->iBearerType.SetL( *name );
+        CleanupStack::PopAndDestroy( name );
+
+        iIapRecord->iNetwork = iNetworkRecord->RecordId();
+        
+        if ( iLocationRecord )
+            {
+            iIapRecord->iLocation = iLocationRecord->RecordId();
+            }
+            
+        iIapRecord->iLocation = GetLocationIdL();
+        
+        iIapRecord->StoreL( Session() );
+        iIapId = iIapRecord->RecordId();
+        
+        CLOG_NAME_2( _L("plugin_0x%x_%d"), this, iIapId );
+        CLOG_WRITE_1( "New IapId: [%d]", iIapId );
+        }
+    else
+        {
+        iIapRecord->ModifyL( Session() );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::UpdateProxyRecordL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBaseEng::UpdateProxyRecordL()
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::UpdateProxyRecordL" );
+
+    CopyAttributes( iIapRecord, iProxyRecord );
+    CheckIfNameModifiedL( iProxyRecord );
+    
+    if ( iProxyRecord->iUseProxyServer )
+        {
+        if ( !iProxyRecord->RecordId() )
+            // new proxy setting -> create new record
+            {
+            iProxyRecord->iService = iServiceRecord->RecordId();
+            iProxyRecord->iServiceType.SetL( iIapRecord->iServiceType );
+
+            // By default protocol is set to "http"
+            if ( TPtrC(iProxyRecord->iProtocolName).Length() == 0 )
+                {
+                iProxyRecord->iProtocolName.SetL(KDefProxyProtocolName);
+                }
+
+            iProxyRecord->SetRecordId( KCDNewRecordRequest );
+
+            iProxyRecord->StoreL( Session() );
+            }
+        else
+            // already existing record -> update only
+            {
+            iProxyRecord->ModifyL( Session() );
+            }        
+        }
+    else
+        {
+        if ( iProxyRecord->RecordId() )
+            {
+            iProxyRecord->DeleteL( Session() );
+            }
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::UpdateSeamlessnessRecordL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBaseEng::UpdateSeamlessnessRecordL()
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::UpdateSeamlessnessRecordL" );
+
+    CopyAttributes( iIapRecord, iPriv->iMetaDataRecord );
+    CheckIfNameModifiedL( iPriv->iMetaDataRecord );
+    
+    if ( !iPriv->iMetaDataRecord->RecordId() )
+        {
+        iPriv->iMetaDataRecord->iIAP = IAPRecordElementId();
+        iPriv->iMetaDataRecord->SetRecordId( KCDNewRecordRequest );
+        iPriv->iMetaDataRecord->StoreL( Session() );
+        }
+    else
+        {
+        iPriv->iMetaDataRecord->ModifyL( Session() );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::UpdateChargeCardRecordL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBaseEng::UpdateChargeCardRecordL()
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::UpdateChargeCardRecordL" );
+    if ( iChargeCardEnabled )
+        {
+        CopyAttributes( iIapRecord, iChargeCardRecord );
+        CheckIfNameModifiedL( iChargeCardRecord );
+        
+        if ( !iChargeCardRecord->RecordId() )
+            {
+            iChargeCardRecord->SetRecordId( KCDNewRecordRequest );
+            iChargeCardRecord->StoreL( Session() );
+            }
+        else
+            {
+            iChargeCardRecord->ModifyL( Session() );
+            }
+        }
+    else
+        {
+        if ( iChargeCardRecord )
+            {
+            iChargeCardRecord->DeleteL( Session() );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::UpdateServiceRecordL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmPluginBaseEng::UpdateServiceRecordL()
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::UpdateServiceRecordL" );
+    
+    if ( iServiceRecord )
+        {
+        CopyAttributes( iIapRecord, iServiceRecord );
+        CheckIfNameModifiedL( iServiceRecord );
+        
+        if ( !iServiceRecord->RecordId() )
+            {
+            iServiceRecord->SetRecordId( KCDNewRecordRequest );
+            iServiceRecord->StoreL( Session() );
+            }
+        else
+            {
+            iServiceRecord->ModifyL( Session() );
+            }
+        }
+    else
+        {
+        CLOG_WRITE( "No service record" );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::UpdateNetworkRecordL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBaseEng::UpdateNetworkRecordL()
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::UpdateNetworkRecordL" );
+    
+    CopyAttributes( iIapRecord, iNetworkRecord );
+    if ( !iNetworkRecord->RecordId() )
+        {
+        CheckIfNameModifiedL( iNetworkRecord );
+        
+        iNetworkRecord->SetRecordId( KCDNewRecordRequest );
+        iNetworkRecord->StoreL( Session() );
+        }
+    else
+        {
+        iNetworkRecord->ModifyL( Session() );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::UpdateLocationRecordL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBaseEng::UpdateLocationRecordL()
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::UpdateLocationRecordL" );
+    if ( iLocationEnabled )
+        {
+        CopyAttributes( iIapRecord, iLocationRecord );
+        CheckIfNameModifiedL( iLocationRecord );
+                        
+        if ( !iLocationRecord->RecordId() )
+            {
+            iLocationRecord->SetRecordId( KCDNewRecordRequest );
+            iLocationRecord->StoreL( Session() );
+            }
+        else
+            {
+            iLocationRecord->ModifyL( Session() );
+            }
+        }
+    else
+        {
+        if ( iLocationRecord )
+            {
+            iLocationRecord->DeleteL( Session() );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::UpdateConnPrefSettingL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBaseEng::UpdateConnPrefSettingL()
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::UpdateConnPrefSettingL" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::EnableProxyL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBaseEng::EnableProxyL( TBool aEnable )
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::EnableProxyL" );
+
+    if ( !iServiceRecord )
+        {
+        CLOG_WRITE( "No service record -> no proxy" );
+        User::Leave( KErrNotSupported );
+        }
+
+    if( !iProxyRecord )
+        {
+        iProxyRecord = static_cast<CCDProxiesRecord *>
+                      (CCDRecordBase::RecordFactoryL(KCDTIdProxiesRecord));
+        }
+        
+    iProxyRecord->iUseProxyServer = aEnable;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::EnableChargeCardL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBaseEng::EnableChargeCardL( TBool aEnable )
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::EnableChargeCardL" );
+
+    if ( aEnable )
+        {
+        if ( !iChargeCardRecord )
+            {
+            iChargeCardRecord = static_cast<CCDChargecardRecord *>
+                       (CCDRecordBase::RecordFactoryL(KCDTIdChargecardRecord));
+            }
+        }
+    else
+        // charge card is disabled. To be deleted in UpdateL
+        // Nothing to do here
+        {
+        }
+        
+    iChargeCardEnabled = aEnable;        
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::EnableLocationL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBaseEng::EnableLocationL( TBool aEnable )
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::EnableLocationL" );
+
+    if ( aEnable )
+        {
+        if ( !iLocationRecord )
+            {
+            iLocationRecord = static_cast<CCDLocationRecord *>
+                         (CCDRecordBase::RecordFactoryL(KCDTIdLocationRecord));
+            }
+        }
+    else
+        // location is disabled. To be deleted in UpdateL.
+        // Nothing to do here
+        {
+        }
+        
+    iLocationEnabled = aEnable;        
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::LoadWapRecordL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBaseEng::LoadWapRecordL()
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::LoadWapRecordL" );
+
+    iPriv->iWapIPBearerRecord = FindWAPRecordL();
+    if ( iPriv->iWapIPBearerRecord )
+        {
+        CCDWAPAccessPointRecord *wapApRecord = static_cast<CCDWAPAccessPointRecord *>
+                   (CCDRecordBase::RecordFactoryL(KCDTIdWAPAccessPointRecord));
+                   
+        CleanupStack::PushL( wapApRecord );
+                                        
+        wapApRecord->SetRecordId( 
+                                iPriv->iWapIPBearerRecord->iWAPAccessPointId );
+        TRAPD( err, wapApRecord->LoadL( Session() ) );
+        if( err == KErrNotFound )
+            {
+            CleanupStack::PopAndDestroy( wapApRecord );
+            
+            wapApRecord = static_cast<CCDWAPAccessPointRecord *>
+                   (CCDRecordBase::RecordFactoryL(KCDTIdWAPAccessPointRecord));
+            }
+        else
+            {
+            CLOG_WRITE( "WAP bearer record found, WAP AP Not??" );
+
+            User::LeaveIfError( err );
+
+            CleanupStack::Pop( wapApRecord );
+            }
+        
+        iPriv->iWapAPRecord = wapApRecord;
+        }
+    else
+        // No WAP record found -> create a new one
+        {
+        NewWapRecordL();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::LoadSeamlessnessRecordL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBaseEng::LoadSeamlessnessRecordL()
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::LoadSeamlessnessRecordL" );
+
+    iPriv->iMetaDataRecord = FindSeamlessnessRecordL();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::UpdateWapRecordL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBaseEng::UpdateWapRecordL()
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::UpdateWapRecordL" );
+    
+    if ( !iPriv->iWapIPBearerRecord )
+        // nothing to update
+        {
+        return;
+        }
+    
+    // we have the bearer but to make sure that we have WAP_AP, too.    
+    NewWapRecordL();
+    
+    CopyAttributes( iIapRecord, iPriv->iWapAPRecord );
+    CopyAttributes( iIapRecord, iPriv->iWapIPBearerRecord );
+    
+    CheckIfNameModifiedL( iPriv->iWapAPRecord );
+    CheckIfNameModifiedL( iPriv->iWapIPBearerRecord );
+
+    if ( !iPriv->iWapAPRecord->RecordId() )
+        {
+        iPriv->iWapAPRecord->SetRecordId( KCDNewRecordRequest );
+        iPriv->iWapAPRecord->StoreL( Session() );
+        }
+    else
+        {
+        iPriv->iWapAPRecord->ModifyL( Session() );
+        }
+    
+    if ( !iPriv->iWapIPBearerRecord->RecordId() )
+        {
+        iPriv->iWapIPBearerRecord->iWAPAccessPointId = iPriv->iWapAPRecord->RecordId();
+        iPriv->iWapIPBearerRecord->iWAPIAP = iIapId;
+        
+        iPriv->iWapIPBearerRecord->SetRecordId( KCDNewRecordRequest );
+        iPriv->iWapIPBearerRecord->StoreL( Session() );
+        }
+    else
+        {
+        iPriv->iWapIPBearerRecord->ModifyL( Session() );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::NewWapRecordL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBaseEng::NewWapRecordL()
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::NewWapBearerRecordL" );
+
+    if ( !iPriv->iWapIPBearerRecord )
+        {
+        iPriv->iWapIPBearerRecord = static_cast<CCDWAPIPBearerRecord *>
+                      (CCDRecordBase::RecordFactoryL(KCDTIdWAPIPBearerRecord));
+        iPriv->iWapIPBearerRecord->iWAPProxyPort = 0;
+        iPriv->iWapIPBearerRecord->iWAPWSPOption = ECmWapWspOptionConnectionOriented;
+        iPriv->iWapIPBearerRecord->iWAPSecurity = EFalse;
+        }
+
+    if ( !iPriv->iWapAPRecord )
+        {
+        iPriv->iWapAPRecord = static_cast<CCDWAPAccessPointRecord *>
+                   (CCDRecordBase::RecordFactoryL(KCDTIdWAPAccessPointRecord));
+        // SMS bearer is not supported by this version
+        iPriv->iWapAPRecord->iWAPCurrentBearer.SetL( 
+                                               TPtrC(KCDTypeNameWAPIPBearer) );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::NewSeamlessnessRecordL
+// ---------------------------------------------------------------------------
+//
+CCDIAPMetadataRecord* CCmPluginBaseEng::NewSeamlessnessRecordL( TBool aSetDef )
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::NewSeamlessnessRecordL" );
+
+    CCDIAPMetadataRecord* record = new (ELeave) CCDIAPMetadataRecord( 
+                                          iCmMgr.SeamlessnessTableId() );
+                                          
+    if( aSetDef )
+        {
+        record->iSeamlessness = ESeamlessnessConfirmFirst;
+        }
+        
+    return record;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::SetAttribute
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBaseEng::SetAttribute( CCDRecordBase* aRecord, 
+                                     TUint32 aAttribute, 
+                                     TBool aSet )
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::SetAttribute" );
+   
+    if ( aSet )
+        {
+        aRecord->SetAttributes( aAttribute );
+        }
+    else
+        {
+        aRecord->ClearAttributes( aAttribute );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::CopyAttributes
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBaseEng::CopyAttributes( CCDRecordBase* aSrcRecord, 
+                                       CCDRecordBase* aDstRecord )
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::CopyAttributes" );
+
+    TMDBAttributeFlags attr( aSrcRecord->Attributes() );
+    
+    aDstRecord->SetAttributes( attr );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::FindWAPRecordL
+// ---------------------------------------------------------------------------
+//
+CCDWAPIPBearerRecord* CCmPluginBaseEng::FindWAPRecordL()
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::FindWAPRecordL" );
+
+    CMDBRecordSet<CCDWAPIPBearerRecord>* wapRS = 
+            new(ELeave) 
+                   CMDBRecordSet<CCDWAPIPBearerRecord>(KCDTIdWAPIPBearerRecord);
+    CleanupStack::PushL( wapRS );
+    
+    CCDWAPIPBearerRecord* wapBearerRecord = static_cast<CCDWAPIPBearerRecord *>
+                      (CCDRecordBase::RecordFactoryL(KCDTIdWAPIPBearerRecord));
+                      
+    CleanupStack::PushL( wapBearerRecord );
+    
+    wapBearerRecord->iWAPIAP = iIapId;
+    wapRS->iRecords.AppendL( wapBearerRecord );
+    
+    CleanupStack::Pop( wapBearerRecord );
+    wapBearerRecord = NULL;
+    
+    if ( wapRS->FindL(Session()) )
+        {
+        CLOG_WRITE( "WAP bearer record found" );
+        
+        wapBearerRecord = 
+                        static_cast<CCDWAPIPBearerRecord *>(wapRS->iRecords[0]);
+
+        // we take over the ownership of this record
+        wapRS->iRecords.Remove( 0 );
+        }
+
+    CleanupStack::PopAndDestroy( wapRS );
+        
+    return wapBearerRecord;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::FindSeamlessnessRecordL
+// ---------------------------------------------------------------------------
+//
+CCDIAPMetadataRecord* CCmPluginBaseEng::FindSeamlessnessRecordL()
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::FindSeamlessnessRecordL" );
+
+    CMDBRecordSet<CCDIAPMetadataRecord>* slnRS = 
+      new(ELeave) CMDBRecordSet<CCDIAPMetadataRecord>(iCmMgr.SeamlessnessTableId());
+    CleanupStack::PushL( slnRS );
+    
+    CCDIAPMetadataRecord* slnRecord = 
+            new (ELeave) CCDIAPMetadataRecord( iCmMgr.SeamlessnessTableId() );
+                                                                  
+    slnRecord->iIAP = IAPRecordElementId();
+    slnRS->iRecords.AppendL( slnRecord );
+    
+    slnRecord = NULL;
+    
+    if ( slnRS->FindL(Session()) )
+        {
+        CMDBRecordBase* record = slnRS->iRecords[0];
+
+        slnRecord = NewSeamlessnessRecordL( EFalse );
+        slnRecord->SetRecordId( record->RecordId() );
+        
+        // This can leave only in case of OOM.
+        slnRecord->LoadL( Session() );
+        }
+    else
+        {
+        slnRecord = NewSeamlessnessRecordL( ETrue );
+        }
+
+    CleanupStack::PopAndDestroy( slnRS );
+        
+    return slnRecord;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::DoMakeValidNameL
+// ---------------------------------------------------------------------------
+//
+HBufC* CCmPluginBaseEng::DoMakeValidNameL( const TDesC& aName )
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::DoMakeValidNameL" );
+
+    TBool changed( EFalse );
+    HBufC* temp = HBufC::NewLC( KApMaxConnNameLength );
+    HBufC* temp2 = HBufC::NewLC( KApMaxConnNameLength );
+
+    HBufC* corrname = EnsureMaxLengthLC( aName, changed );
+    *temp = *corrname;
+    TInt postfix( 0 );
+    TInt pf( 0 );
+    TInt i( 0 );
+    TBool valid ( EFalse );
+
+    TPtrC prefix = GetPrefix( *corrname );
+    
+    postfix = GetPostfix( *temp, prefix );
+    postfix = -1;
+    do
+        {       
+        valid = IsValidNameL( *temp );
+        if ( !valid )
+            {
+            changed = ETrue;
+            postfix++;
+            // check the length of postfix, check text length accordingly
+            pf = postfix;
+            for (i=1; i<10; i++)
+                {
+                pf /= 10;
+                if ( !pf )
+                    break;
+                }
+            TPtr sgdptr( temp->Des() );
+            TPtr sgdptr2( temp2->Des() );
+            if ( postfix )
+                {
+                if ( postfix < 10 )
+                    {
+                    sgdptr2 = prefix.Left( KApMaxConnNameLength - i - 3 );
+                    }
+                else
+                    {
+                    sgdptr2 = prefix.Left( KApMaxConnNameLength - i - 2 );
+                    }
+                }
+            else
+                {
+                sgdptr2 = prefix.Left( KApMaxConnNameLength );
+                }
+            if ( postfix )
+                {
+                TBuf< KMaxPostfixLength > postfixString;
+                if ( postfix > 9 )
+                    {
+                    postfixString.Format( KFormatLargePostfix, postfix );
+                    AknTextUtils::LanguageSpecificNumberConversion( postfixString );
+                    }
+                else
+                    {
+                    postfixString.Format( KFormatPostfix, postfix );
+                    AknTextUtils::LanguageSpecificNumberConversion( postfixString );
+                    }
+                sgdptr.Format( KFormatNameWithPostfix, &sgdptr2,
+                                   &postfixString );
+                }
+            else
+                {
+                sgdptr.Format( KFormatNoPostfix, &sgdptr2 );
+                }
+            }
+        } while ( !valid );
+
+    CleanupStack::PopAndDestroy( corrname );
+    CleanupStack::PopAndDestroy( temp2 );
+
+    if ( changed )
+        {
+        CLOG_WRITE_1( "New name: [%S]", temp );
+        CleanupStack::Pop( temp );
+        }
+    else
+        {
+        CleanupStack::PopAndDestroy( temp );
+        temp = NULL;
+        }
+
+    return temp;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::EnsureMaxLengthLC
+// ---------------------------------------------------------------------------
+//
+HBufC* CCmPluginBaseEng::EnsureMaxLengthLC( const TDesC& aName, 
+                                            TBool& aChanged )
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::EnsureMaxLengthLC" );
+
+    TInt length = aName.Length();
+    
+    aChanged = EFalse;
+    
+    if ( !length )
+        {
+        // Name is required.        
+        User::Leave( KErrArgument );
+        }
+
+    HBufC* corrname;
+    if ( KApMaxConnNameLength < length )
+        { // name too long, truncate.
+        corrname = aName.Left( KApMaxConnNameLength ).AllocLC();
+        aChanged = ETrue;
+        }
+    else
+        {
+        corrname = aName.AllocLC();
+        corrname->Des().Trim();
+        if ( corrname->Length() == 0 )
+            {
+            User::Leave( KErrArgument );
+            }
+        // comes here only if name is valid
+        if ( corrname->Length() != aName.Length() )
+            {
+            aChanged = ETrue;
+            }
+        }
+
+    return corrname;
+    }
+
+// ---------------------------------------------------------------------------
+// Given aName in the format <prefix> or <prefix><brace><integer><brace>,
+// return a pointer to the leading part.
+// That is, if there is trailing <space><integer>,
+// then that is excluded; if there is no trailing part, then the original
+// decriptor is returned.
+// Examples:
+//   - "Foo" returns "Foo";
+//   - "Foo 12" returns "Foo 12";
+//   - "Foo(12)" returns "Foo";
+//   - "Foo 12 (34)" returns "Foo 12 ";
+//   - "Foo bar" returns "Foo bar";
+//   - "Foo " returns "Foo ".
+// ---------------------------------------------------------------------------
+TPtrC CCmPluginBaseEng::GetPrefix( const TDesC& aName )
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::GetPrefix" );
+
+    TPtrC prefix = aName;
+    TInt lastBrace = aName.LocateReverse('(');
+    if ( lastBrace != KErrNotFound )
+        {
+        // aName looks like "<prefix><brace><something>".
+        // See if <something> is an integer number.
+        TPtrC num = aName.Right( aName.Length() - lastBrace - 1 );
+        TInt val;
+        TLex lex( num );
+        if ( lex.Val( val ) == KErrNone )
+            {
+            // Yes, the trailer is an integer.
+            prefix.Set( aName.Left( lastBrace ) );
+            }
+        }
+    return prefix;
+    }
+
+
+// ---------------------------------------------------------------------------
+// If aName is constructed from aPrefix with a postfix, get the numeric
+// value of the postfix, e.g:
+//   - GetPostfix( "Foo (3)", "Foo" ) == 3
+//   - GetPostfix( "Foo 23 (45)", "Foo 23" ) == 45
+// If aName is the same as aPrefix, return 0, e.g.:
+//   - GetPostfix( "Foo", "Foo" ) == 0
+// If aName is not constructed from aPrefix, return -1, e.g.:
+//   - GetPostfix( "Foobar", "Foo" ) == -1
+//   - GetPostfix( "Fo 23 45", "Foo" ) == -1
+// ---------------------------------------------------------------------------
+TInt CCmPluginBaseEng::GetPostfix( const TDesC& aName, const TDesC& aPrefix )
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::GetPostfix" );
+    TInt postfix( KErrNotFound );
+    TInt nameLength = aName.Length();
+    TInt prefixLength = aPrefix.Length();
+    if ( nameLength >= prefixLength && aName.FindF( aPrefix ) == 0 )
+        {
+        // aName is longer or equal length, and
+        // aPrefix can be found in the beginning of aName.
+        if ( nameLength == prefixLength )
+            {
+            // They have the same length; they equal.
+            postfix = 0;
+            }
+        else
+            {
+            if ( prefixLength > 0 )
+                {
+                if ( aName[ prefixLength ] == '(' )
+                    {
+                    // (Now we know that aName is longer than aPrefix.)
+                    // aName looks like "aPrefix<brace><something>".
+                    // See if <something> is an integer number.
+                    TPtrC num = aName.Right( nameLength - prefixLength - 1 );
+                        TBuf< KApMaxConnNameLength > pf;
+                    pf = num;
+                    AknTextUtils::ConvertDigitsTo( pf, EDigitTypeWestern );
+                    TInt val;
+                    TLex lex( pf );
+                    if ( lex.Val( val ) == KErrNone )
+                        {
+                        // Yes, the trailer is an integer.
+                        if ( val > 0 )
+                            {
+                            postfix = val;
+                            }
+                        else
+                            {
+                            // signal that it is invalid...
+                            postfix = -1;
+                            }
+                        }
+	                }
+                }
+            else
+                {
+                postfix = -1;
+                }
+            }
+        }
+    return postfix;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::IsValidNameL
+// ---------------------------------------------------------------------------
+//
+TBool CCmPluginBaseEng::IsValidNameL( const TDesC& aNameText )
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::IsValidNameL" );
+
+    TBool retVal( ETrue );
+    
+    OpenTransactionLC();
+    
+    CMDBRecordSet<CCDIAPRecord>* iapRS = 
+                      new(ELeave) CMDBRecordSet<CCDIAPRecord>(KCDTIdIAPRecord);
+    CleanupStack::PushL(iapRS);
+
+    CCDIAPRecord* iapRecord = static_cast<CCDIAPRecord *>
+                            (CCDRecordBase::RecordFactoryL(KCDTIdIAPRecord));
+
+    CleanupStack::PushL( iapRecord );
+    
+    // Prime record
+    iapRecord->iRecordName.SetL( aNameText );
+    
+    iapRS->iRecords.AppendL( iapRecord );
+
+    CleanupStack::Pop( iapRecord );
+    
+    iapRecord = NULL;
+    
+    if ( iapRS->FindL(Session()) )
+        {
+        if ( iIapId )
+            // this is not a new CM
+            {
+            for ( TInt i = 0; i < iapRS->iRecords.Count(); ++i )
+                {
+                if ( iapRS->iRecords[i]->RecordId() != iIapId )
+                    // duplication because it's not our name
+                    {
+                    retVal = EFalse;
+                    break;
+                    }
+                }
+            }
+        else
+            // new CM -> any occurence is a duplication
+            {
+            retVal = EFalse;
+            }
+        }
+        
+    CleanupStack::PopAndDestroy( iapRS );
+    
+    RollbackTransaction();
+        
+    return retVal;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::EscapeTextLC
+// ---------------------------------------------------------------------------
+//
+HBufC* CCmPluginBaseEng::EscapeTextLC( const TDesC& aLiteral )
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::EscapeTextLC" );
+
+    TInt l( aLiteral.Length() );
+    //> 2*, to ensure correct esc. even if ALL chars are quotes...
+    HBufC* retbuf = HBufC::NewLC( 2*l );
+    TPtr ret = retbuf->Des();
+    TUint quote( '\'' );  // TChar gives warnings in THUMB & ARMI
+    TInt i( 0 );
+
+    for ( i=0; i<l; i++ )
+        {
+        ret.Append( aLiteral[i] );
+        if ( aLiteral[i] == quote )
+            {
+            // Duplicate quote.
+            ret.Append( quote );
+            }
+        }
+    return retbuf;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::SetNameL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBaseEng::SetNameL( const TDesC& aName )
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::SetNameL" );
+    
+    if ( iPriv->iNamingMethod == ENamingNothing )
+        {
+        iIapRecord->iRecordName.SetL( aName );
+        }
+    else if ( iPriv->iNamingMethod == ENamingUnique )
+        {
+        HBufC* newName = DoMakeValidNameL( aName );
+        
+        if ( newName )
+            // name converted to unique
+            {
+            CleanupStack::PushL( newName );
+            iIapRecord->iRecordName.SetL( *newName );
+            CleanupStack::PopAndDestroy( newName );
+            }
+        else
+            {
+            iIapRecord->iRecordName.SetL( aName );
+            }
+        }
+    else if ( iPriv->iNamingMethod == ENamingNotAccept )
+        {
+        if ( IsValidNameL( aName ) )
+            {
+            iIapRecord->iRecordName.SetL( aName );
+            }
+        else
+            {
+            User::Leave( KErrArgument );
+            }
+        }
+    else
+        {
+        User::Leave( KErrCorrupt );
+        }
+        
+    CLOG_WRITE_1( "Finale name: [%S]", &FIELD_TO_TDESC(iIapRecord->iRecordName) );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::AddConverstionTableL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmPluginBaseEng::AddConverstionTableL( CCDRecordBase* *aRecord,
+                           TBool* aEnabled,
+                           const TCmAttribConvTable* aConvTable )
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::AddConverstionTableL" );
+    TCmAttrConvArrayItem* item = new (ELeave) TCmAttrConvArrayItem;
+    
+    item->iRecord = aRecord;
+    item->iEnabled = aEnabled;
+    item->iConvTable = aConvTable;
+    
+    iPriv->iConvTblArray->AppendL( item );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::AddConverstionTableL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmPluginBaseEng::AddCommonConversionTableL( 
+                                const TCmCommonAttrConvArrayItem* aConvTable )
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::AddCommonConversionTableL" );
+
+    User::LeaveIfError( iPriv->iCommonConvTblArray.Append( aConvTable ) );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::RemoveConversionTable
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmPluginBaseEng::RemoveConversionTable( 
+                                    const TCmAttribConvTable* aConvTable )
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::RemoveConversionTable" );
+
+    for ( TInt i = 0; i < iPriv->iConvTblArray->Count(); ++i )
+        {
+        if ( (*iPriv->iConvTblArray)[i]->iConvTable == aConvTable )
+            {
+            delete (*iPriv->iConvTblArray)[i];
+            iPriv->iConvTblArray->Delete( i );
+            }
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::RemoveCommonConversionTable
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmPluginBaseEng::RemoveCommonConversionTable( 
+                                 const TCmCommonAttrConvArrayItem* aConvTable )
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::RemoveCommonConversionTable" );
+
+    for ( TInt i = 0; i < iPriv->iCommonConvTblArray.Count(); ++i )
+        {
+        if ( iPriv->iCommonConvTblArray[i] == aConvTable )
+            {
+            iPriv->iCommonConvTblArray.Remove( i );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::FindFieldL
+// ---------------------------------------------------------------------------
+//
+TValidationFunctionL CCmPluginBaseEng::FindFieldL( TUint32 aAttribute,
+                                           TCMFieldTypes aType,
+                                           CMDBElement* &aElement ) const
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::FindFieldL" );
+
+    TValidationFunctionL func = NULL;
+    const TCmAttrConvArrayItem* foundItem = ConversionTable( aAttribute );
+    
+    aElement = NULL;
+    
+    if( !foundItem )
+        {
+        User::Leave( KErrNotSupported );
+        }
+        
+    if ( foundItem->iEnabled )
+        {
+        if ( !(*foundItem->iEnabled) )
+            {
+            User::Leave( KErrNotSupported );
+            }
+        }
+
+    if ( !(*foundItem->iRecord) )
+        {
+        User::Leave( KErrNotSupported );
+        }
+            
+    TInt index( 0 );
+    CMDBElement& field = FieldByAttributeL( foundItem, aAttribute, index );
+    switch ( field.Type() )
+        {
+        case EText:
+        case EMedText:
+        case ELongText:
+            {
+            if ( aType == ECmText )
+                {
+                aElement = &field;
+                }
+            else
+                {
+                User::Leave( KErrNotSupported );
+                }
+            }
+            break;
+
+        case EDesC8:
+            {
+            if ( aType == ECmText8 )
+                {
+                aElement = &field;
+                }
+            else
+                {
+                User::Leave( KErrNotSupported );
+                }
+            }
+            break;
+            
+        case EUint32:
+        case EInt:
+        case EBool:
+            {
+            if ( aType == ECmInt ||
+                 aType == ECmBool )
+                {
+                aElement = &field;
+                }
+            else
+                {
+                User::Leave( KErrNotSupported );
+                }
+            }
+            break;
+            
+        default:
+            {
+            User::Leave( KErrArgument );
+            }
+            break;
+        }
+        
+    if( aElement )
+        {
+        func = foundItem->iConvTable[index].iValidFuncL;
+        }
+    else
+        {
+        User::Leave( KErrNotSupported );
+        }
+    
+    return func;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::Reset
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmPluginBaseEng::Reset()
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::Reset" );
+
+    iIapId = 0;
+    
+    delete iIapRecord; iIapRecord = NULL;
+    delete iProxyRecord; iProxyRecord = NULL;
+    delete iServiceRecord; iServiceRecord = NULL;
+    delete iChargeCardRecord; iChargeCardRecord = NULL;
+    delete iNetworkRecord; iNetworkRecord = NULL;
+    delete iLocationRecord; iLocationRecord = NULL;
+    if ( iPriv )
+        {
+        iPriv->iLoadResult = KErrNone;
+        delete iPriv->iWapAPRecord; iPriv->iWapAPRecord = NULL;
+        delete iPriv->iWapIPBearerRecord; iPriv->iWapIPBearerRecord = NULL;
+        delete iPriv->iMetaDataRecord; iPriv->iMetaDataRecord = NULL;            
+        }
+    
+    iChargeCardEnabled = EFalse;
+    iLocationEnabled = EFalse;
+    }
+    
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::CheckIfAlreadyConnected
+// ---------------------------------------------------------------------------
+EXPORT_C TBool CCmPluginBaseEng::CheckIfAlreadyConnected() const
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::CheckIfAlreadyConnected" );
+
+    TBool retVal( EFalse );
+    RSocketServ serv;
+    RConnection connection;
+    TUint   count;
+
+    if ( serv.Connect() == KErrNone )
+        {
+        if ( connection.Open( serv, KAfInet ) == KErrNone )
+            {
+            if ( connection.EnumerateConnections( count ) == KErrNone )
+                {
+                TPckgBuf<TConnectionInfo> connInfo;
+
+                for ( TUint32 i = 1; i <= count; ++i )
+                    {
+                    connection.GetConnectionInfo( i, connInfo );
+
+                    if ( connInfo().iIapId == iIapId )
+                        {
+                        CLOG_WRITE( "Found connection" );
+                        retVal = ETrue;
+                        break;
+                        }
+                    }
+                }
+
+            connection.Close();
+            }
+
+        serv.Close();
+        }
+
+    return retVal;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::CheckIfNameModifiedL
+// ---------------------------------------------------------------------------
+EXPORT_C void 
+        CCmPluginBaseEng::CheckIfNameModifiedL( CCDRecordBase* aRecord ) const
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::CheckIfNameModifiedL" );
+
+    if ( !TPtrC(iIapRecord->iRecordName).CompareF( TPtrC(aRecord->iRecordName)) )
+        // names matche
+        {
+        return;
+        }
+    
+    aRecord->iRecordName.SetL( TPtrC(iIapRecord->iRecordName) );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::IAPRecordElementId
+// ---------------------------------------------------------------------------
+TMDBElementId CCmPluginBaseEng::IAPRecordElementId() const
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::IAPRecordElementId" );
+    
+    return ( KCDMaskShowField & iIapRecord->ElementId() );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::IsProtected
+// ---------------------------------------------------------------------------
+TBool CCmPluginBaseEng::IsProtected() const
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::IsProtected" );
+
+    return ( iIapRecord->Attributes() & ECDProtectedWrite );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::GetLocationIdL
+// ---------------------------------------------------------------------------
+TUint32 CCmPluginBaseEng::GetLocationIdL() const
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::GetLocationIdL" );
+
+    TUint32 locId( 0 );
+    CMDBRecordSet<CCDLocationRecord>* locRS = 
+            new(ELeave) CMDBRecordSet<CCDLocationRecord>(KCDTIdLocationRecord);
+    CleanupStack::PushL( locRS );
+    
+    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(Session()) )
+        {
+        locRecord = static_cast<CCDLocationRecord *>(locRS->iRecords[0]);
+        
+        locId = locRecord->RecordId();
+        }
+    else
+        {
+        CLOG_WRITE( "Loc id not found" );
+        User::Leave( KErrNotFound );
+        }
+        
+    CleanupStack::PopAndDestroy( locRS );
+        
+    return locId;
+    }            
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::CheckForCommonAttribute
+// ---------------------------------------------------------------------------
+TUint32 
+    CCmPluginBaseEng::CheckForCommonAttribute( const TUint32 aAttribute ) const
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::CheckForCommonAttribute" );
+
+    TUint32 convAttr( aAttribute );
+    
+    if ( iPriv->iCommonConvTblArray.Count() &&
+        aAttribute > ECmCommonAttributesStart &&
+        aAttribute < ECmCommonAttributesEnd )
+        {
+        for ( TInt i = 0; i < iPriv->iCommonConvTblArray.Count(); ++i )
+            {
+            const TCmCommonAttrConvArrayItem* convArray = 
+                                                iPriv->iCommonConvTblArray[i];
+            for ( TInt item = 0; convArray[item].iCommonAttribId; ++item )
+                {
+                if ( convArray[item].iCommonAttribId == aAttribute )
+                    {
+                    return convArray[item].iAttribId;
+                    }
+                }
+            }
+        }
+        
+    return convAttr;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::CommonAttribute
+// ---------------------------------------------------------------------------
+/*TUint32 CCmPluginBaseEng::CommonAttributeL( const TUint32 aAttribute ) const
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::CommonAttribute" );
+
+    if ( iPriv->iCommonConvTblArray.Count() )
+        {
+        for ( TInt i = 0; i < iPriv->iCommonConvTblArray.Count(); ++i )
+            {
+            const TCmCommonAttrConvArrayItem* convArray = 
+                                                iPriv->iCommonConvTblArray[i];
+            for ( TInt item = 0; convArray[item].iCommonAttribId; ++item )
+                {
+                if ( convArray[item].iAttribId == aAttribute )
+                    {
+                    return convArray[item].iCommonAttribId;
+                    }
+                }
+            }
+        }
+        
+    User::Leave( KErrArgument );
+    
+    return 0;
+    }*/
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::FeatureSupported
+// ---------------------------------------------------------------------------
+EXPORT_C TBool CCmPluginBaseEng::FeatureSupported( TInt aFeature )
+    {
+#ifdef _IPV6_DISABLED
+    if( aFeature == KFeatureIdIPv6 )
+        {
+        return EFalse;
+        }
+#endif
+    return CCmManagerImpl::FeatureSupported( aFeature );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::GlobalBearerPriority
+// ---------------------------------------------------------------------------
+EXPORT_C TInt 
+    CCmPluginBaseEng::GlobalBearerPriority( const TDesC& aServiceType ) const
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::GlobalBearerPriority" );
+
+    return iCmMgr.GlobalBearerPriority( EFalse, aServiceType );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::GlobalUiBearerPriority
+// ---------------------------------------------------------------------------
+EXPORT_C TInt 
+    CCmPluginBaseEng::GlobalUiBearerPriority( const TDesC& aServiceType ) const
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::GlobalUiBearerPriority" );
+
+    return iCmMgr.GlobalBearerPriority( ETrue, aServiceType );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::SetProxyServerNameL
+// ---------------------------------------------------------------------------
+TBool CCmPluginBaseEng::SetProxyServerNameL( const TDesC& aProxyServer )
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::SetProxyServerNameL" );
+
+    iProxyRecord->iServerName.SetL( aProxyServer );
+    if( !aProxyServer.Length() )
+        {
+        iProxyRecord->iPortNumber = 0;
+        iProxyRecord->iUseProxyServer = EFalse;
+        }
+    else
+        {
+        iProxyRecord->iUseProxyServer = ETrue;
+        }
+        
+    return ETrue;        
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::ConvTableItemL
+// ---------------------------------------------------------------------------
+EXPORT_C const TCmAttribConvTable* 
+                        CCmPluginBaseEng::ConvTableItem( TUint32 aAttribute )
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::ConvTableItem" );
+
+    TInt i;
+    TCmAttrConvArrayItem* foundItem = ConversionTable( aAttribute );
+         
+    if( foundItem )
+        {
+        // From 2nd item, because the first one is for the range.            
+        for ( i = 1; foundItem->iConvTable[i].iAttribId; ++i )
+            {
+            if ( foundItem->iConvTable[i].iAttribId == aAttribute )
+                {
+                return &foundItem->iConvTable[i];
+                }
+            }
+        }
+    else
+        {
+        // I know that this is a not nice solution, but 
+        // I couldn't find any more inteligent way of adding
+        // ECmBearerSettingName to the array.
+        const TCmAttribConvTable* item = SUiTable;
+        
+        // This is a where use 
+        for ( i = 0; item[i].iAttribId; ++i )
+            {
+            if( item[i].iAttribId == aAttribute )
+                {
+                return &item[i];
+                }
+            }
+        }
+        
+    return NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::ConversionTable
+// ---------------------------------------------------------------------------
+TCmAttrConvArrayItem* 
+                CCmPluginBaseEng::ConversionTable( TUint32 aAttribute ) const
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::ConversionTable" );
+
+    TCmAttrConvArrayItem* foundItem = NULL;
+    TInt i;
+    
+    for ( i = 0; i < iPriv->iConvTblArray->Count(); ++i )
+        {
+        TCmAttrConvArrayItem* item = (*iPriv->iConvTblArray)[i];
+        
+        if ( item->iConvTable[0].iAttribId <= aAttribute &&
+             item->iConvTable[0].iCommsDatId >= aAttribute )
+            {
+            foundItem = item;
+            break;
+            }
+        }
+        
+    return foundItem;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::FieldByAttributeL
+// ---------------------------------------------------------------------------
+CMDBElement& CCmPluginBaseEng::FieldByAttributeL( 
+                                            const TCmAttrConvArrayItem* aItem,
+                                            const TUint32 aAttribute,
+                                            TInt& aIndex ) const
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::FieldByAttributeL" );
+
+    // From 2nd item, because the first one is for the range.            
+    for ( aIndex = 1; aItem->iConvTable[aIndex].iAttribId; ++aIndex )
+        {
+        if ( aItem->iConvTable[aIndex].iAttribId == aAttribute )
+            {
+            return *(*aItem->iRecord)->GetFieldByIdL( 
+                                      aItem->iConvTable[aIndex].iCommsDatId );
+            }
+        }
+        
+    User::Leave( KErrNotFound );
+    // Dead code
+    return *(CMDBElement*)1;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::SetDNSServerAddressL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmPluginBaseEng::SetDNSServerAddressL( TUint32 aSrv1Attr,
+                                                      const TDesC& aSrv1,
+                                                      TUint32 aSrv2Attr,
+                                                      const TDesC& aSrv2,
+                                                      TUint32 aAddrFromSrvAttr,
+                                                      TBool aIPv6 )
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::SetDNSServerAddressL" );
+
+    TBool undef1;
+    TBool undef2;
+    TPtrC dynamic;
+    
+    if( aIPv6 )
+        // IPv6
+        {
+        undef1 = ClassifyIPv6Address( aSrv1 ) == EIPv6Unspecified;
+        undef2 = ClassifyIPv6Address( aSrv2 ) == EIPv6Unspecified;
+        
+        dynamic.Set( KDynamicIpv6Address );
+        }
+    else
+        {
+        undef1 = IsUnspecifiedIPv4Address( aSrv1 );
+        undef2 = IsUnspecifiedIPv4Address( aSrv2 );
+        
+        dynamic.Set( KUnspecifiedIPv4 );
+        }
+        
+    if( undef1 )
+        {
+        SetStringAttributeL( aSrv1Attr, aSrv2 );
+        SetStringAttributeL( aSrv2Attr, dynamic );
+        
+        SetBoolAttributeL( aAddrFromSrvAttr, undef2 );
+        }
+    else
+        {
+        SetStringAttributeL( aSrv1Attr, aSrv1 );
+        SetStringAttributeL( aSrv2Attr, aSrv2 );
+
+        SetBoolAttributeL( aAddrFromSrvAttr, EFalse );
+        }        
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::CheckDNSServerAddressL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmPluginBaseEng::CheckDNSServerAddressL( TBool aIPv6,
+                                                        CMDBField<TDesC>& aDNS1,
+                                                        CMDBField<TDesC>& aDNS2,
+                                                        CMDBField<TBool>& /*aDNSFromServer*/ )
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::CheckDNSServerAddressL" );
+
+    // aDNSFromServer is commented out because the API must not set this
+    // field any more. It is only set from the UI
+    if( !(aDNS1.ElementId() & KCDChangedFlag) &&
+        !(aDNS2.ElementId() & KCDChangedFlag) )
+        // No change
+        {
+        return;
+        }
+
+    if( aIPv6 )
+        {
+        if( ClassifyIPv6Address( aDNS1 ) == EIPv6Unspecified )
+            {
+            if( ClassifyIPv6Address( aDNS2 ) != EIPv6Unspecified )
+                {
+                aDNS1.SetL( aDNS2 );
+                aDNS2.SetL( KDynamicIpv6Address );
+                }
+            }
+        }
+    else // IPv4
+        {
+        if( IsUnspecifiedIPv4Address( aDNS1 ) )
+            {
+            if( !IsUnspecifiedIPv4Address( aDNS2 ) )
+                {
+                aDNS1.SetL( aDNS2 );
+                aDNS2.SetL( KUnspecifiedIPv4 );
+                }
+            }
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::CheckSpaceBelowCriticalLevelL
+// ---------------------------------------------------------------------------
+//
+TBool CCmPluginBaseEng::CheckSpaceBelowCriticalLevelL() const
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::CheckSpaceBelowCriticalLevelL" );
+
+    // OOD handling. If disk space is low user is notified.
+    RFs fs;
+    User::LeaveIfError( fs.Connect() );
+    CleanupClosePushL<RFs>( fs );
+    
+    // Checks the FFS space "after" addition
+    TBool belowCL = SysUtil::FFSSpaceBelowCriticalLevelL
+            ( &fs, KEstimatedOverhead );
+    
+    CleanupStack::PopAndDestroy(); // fs
+    
+    if( belowCL )
+        {
+        // Raise a dialog to notify the user.
+        TCmCommonUi::ShowMemoryFullConfirmationQueryL();
+        // It must leave because it is the only way to notify the caller about
+        // the operation failed. (Its caller does not return indicator.)
+        // KLeaveWithoutAlert means no more dialog will raise
+        User::Leave( KLeaveWithoutAlert );
+        }
+        
+    // Return value keept to have a suitable API    
+    return belowCL;    
+    
+    }
+    
+// -----------------------------------------------------------------------------
+// CCmPluginBaseEng::IncrementRefCounter
+// -----------------------------------------------------------------------------
+void CCmPluginBaseEng::IncrementRefCounter()
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::IncrementRefCounter" );
+
+    iRefCounter++;
+    }
+// -----------------------------------------------------------------------------
+// CCmPluginBaseEng::DecrementRefCounter
+// -----------------------------------------------------------------------------
+void CCmPluginBaseEng::DecrementRefCounter()
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::DecrementRefCounter" );
+
+    iRefCounter--;
+    }
+// -----------------------------------------------------------------------------
+// CCmPluginBaseEng::GetRefCounter
+// -----------------------------------------------------------------------------
+TInt CCmPluginBaseEng::GetRefCounter()
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::GetRefCounter" );
+
+    return iRefCounter;
+    }
+
+// -----------------------------------------------------------------------------
+// CCmPluginBaseEng::IdIsValid
+// -----------------------------------------------------------------------------
+TBool CCmPluginBaseEng::IdIsValid()
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::IdIsValid" );
+
+    return iIdIsValid;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCmPluginBaseEng::IdIsValid
+// -----------------------------------------------------------------------------
+void CCmPluginBaseEng::SetIdValidity(TBool validity)
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::SetIdValidity" );
+
+    iIdIsValid = validity;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCmPluginBaseEng::GetRefCounter
+// -----------------------------------------------------------------------------
+void CCmPluginBaseEng::GenericStringWriterL( const TUint32 aAttribute, 
+                                             const TDesC16& aValue )
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::GenericStringWriterL" );
+
+    TUint32 attribute = CheckForCommonAttribute( aAttribute );
+    CMDBField<TDesC>* field;
+    
+    TValidationFunctionL func = 
+                FindFieldL( attribute, ECmText, (CMDBElement*&)field );
+    
+    if( func )
+        {
+        func( this, attribute, (const TAny*)&aValue );
+        }
+        
+    field->SetL( aValue );    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBaseEng::MappedCommonAttribute
+// ---------------------------------------------------------------------------
+TUint32 
+    CCmPluginBaseEng::MappedCommonAttribute( const TUint32 aAttribute ) const
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::MappedCommonAttribute" );
+
+    TUint32 convAttr( aAttribute );
+    
+    if ( iPriv->iCommonConvTblArray.Count() )
+        {
+        for ( TInt i = 0; i < iPriv->iCommonConvTblArray.Count(); ++i )
+            {
+            const TCmCommonAttrConvArrayItem* convArray = 
+                                                iPriv->iCommonConvTblArray[i];
+            for ( TInt item = 0; convArray[item].iCommonAttribId; ++item )
+                {
+                if ( convArray[item].iAttribId == aAttribute )
+                    {
+                    return convArray[item].iCommonAttribId;
+                    }
+                }
+            }
+        }
+        
+    return convAttr;
+    }
+//-----------------------------------------------------------------------------
+// CCmPluginBaseEng::ParentDestination
+// -----------------------------------------------------------------------------
+EXPORT_C CCmDestinationImpl* CCmPluginBaseEng::ParentDestination() const
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::ParentDestination" );
+
+    if (iParentDest)
+        {
+        CCmDestinationImpl* parentDest = NULL;
+        TRAPD( err, parentDest = iCmMgr.DestinationL( iParentDest ) );
+        if ( !err )
+            {
+            return parentDest;
+            }
+        }
+    
+    return NULL;
+    }
+   
+//-----------------------------------------------------------------------------
+// CCmPluginBaseEng::GetAdditionalUids
+// -----------------------------------------------------------------------------
+EXPORT_C void CCmPluginBaseEng::GetAdditionalUids( RArray<TUint32>& /*aIapIds*/ )
+    {
+    LOGGER_ENTERFN( "CCmPluginBaseEng::GetAdditionalUids" );
+    }
+
+//-----------------------------------------------------------------------------
+// CCmPluginBaseEng::SetPreDefinedId
+// -----------------------------------------------------------------------------
+EXPORT_C void CCmPluginBaseEng::SetPreDefinedId( const TUint32 aPreDefId )
+	{
+    LOGGER_ENTERFN( "CCmPluginBaseEng::SetPreDefinedId" );
+
+	iPreDefIapId = aPreDefId;
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Src/cmapplicationsettingsui.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,102 @@
+/*
+* 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:  Application Setting UI
+*
+*/
+
+#include "cmapplicationsettingsui.h"
+#include <cmmanager.h>
+#include "cmconnsettingsuiimpl.h"
+#include "cmmanager.hrh"
+
+using namespace CMManager;
+//-----------------------------------------------------------------------------
+//  CCmApplicationSettingsUi::NewL()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C CCmApplicationSettingsUi* CCmApplicationSettingsUi::NewL()
+    {
+    CCmApplicationSettingsUi* self = new (ELeave) CCmApplicationSettingsUi();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );   // self
+    return self;
+    }
+    
+//-----------------------------------------------------------------------------
+//  CCmApplicationSettingsUi::NewLC()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C CCmApplicationSettingsUi* CCmApplicationSettingsUi::NewLC()
+    {
+    CCmApplicationSettingsUi* self = new (ELeave) CCmApplicationSettingsUi();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+//-----------------------------------------------------------------------------
+//  CCmApplicationSettingsUi::CCmApplicationSettingsUi()
+//-----------------------------------------------------------------------------
+//
+CCmApplicationSettingsUi::CCmApplicationSettingsUi()
+    {
+    }
+
+//-----------------------------------------------------------------------------
+//  CCmApplicationSettingsUi::~CCmApplicationSettingsUi()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C CCmApplicationSettingsUi::~CCmApplicationSettingsUi()
+    {
+    delete iImpl;
+    }
+
+//-----------------------------------------------------------------------------
+//  CCmApplicationSettingsUi::ConstructL()
+//-----------------------------------------------------------------------------
+//
+void CCmApplicationSettingsUi::ConstructL()
+    {
+    iImpl = CCmConnSettingsUiImpl::NewWithoutTablesL();
+    }
+    
+//-----------------------------------------------------------------------------
+//  CCmApplicationSettingsUi::RunSettingsL()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C TBool CCmApplicationSettingsUi::RunApplicationSettingsL( 
+                                               TCmSettingSelection& aSelection )
+    {
+    TBearerFilterArray aFilterArray;
+    return iImpl->RunApplicationSettingsL(  aSelection,
+                                            EShowDefaultConnection | 
+                                            EShowDestinations | 
+                                            EShowConnectionMethods,
+                                            aFilterArray );
+    }    
+    
+//-----------------------------------------------------------------------------
+//  CCmApplicationSettingsUi::RunSettingsL()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C TBool CCmApplicationSettingsUi::RunApplicationSettingsL( 
+                                        TCmSettingSelection& aSelection, 
+                                        TUint aListItems,
+                                        TBearerFilterArray& aFilterArray)
+    {
+    return iImpl->RunApplicationSettingsL(  aSelection,
+                                            aListItems,
+                                            aFilterArray );
+    }    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Src/cmapplicationsettingsuiimpl.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,56 @@
+/*
+* 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 application setting UI.
+*
+*/
+
+#include <coemain.h>
+#include <featmgr.h>
+#include <data_caging_path_literals.hrh>
+#include <AknsUtils.h>
+
+#include "cmapplicationsettingsui.h"
+#include <cmmanager.h>
+#include "cmmanagerimpl.h"
+#include <cmpluginbaseeng.h>
+#include "cmapplicationsettingsuiimpl.h"
+
+using namespace CMManager;
+
+typedef struct
+    {
+    TInt                iCmIapId;
+    TInt                iCmDefaultPriority;
+    }TCmListItem;
+
+//---------------------------------------------------------------------------
+//  CCmApplicationSettingsUiImpl::NewL
+//---------------------------------------------------------------------------
+//
+EXPORT_C CCmApplicationSettingsUiImpl* CCmApplicationSettingsUiImpl::NewL()
+    {
+    return NULL;
+    }
+
+
+//---------------------------------------------------------------------------
+//  CCmApplicationSettingsUiImpl::RunSettingsL()
+//---------------------------------------------------------------------------
+//
+EXPORT_C TBool CCmApplicationSettingsUiImpl::RunApplicationSettingsL( 
+                                          TCmSettingSelection& /*aSelection*/ )
+    {
+    return EFalse;
+    }    
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Src/cmcommonui.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,687 @@
+/*
+* 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:  Defines common UI methods.
+*
+*/
+
+#include <aknlists.h>       // CAknDoubleLargeGraphicPopupMenuStyleListBox
+#include <aknPopup.h>       // CAknPopupList
+#include <AknQueryDialog.h>
+#include <aknnotedialog.h>
+#include <badesca.h>        // CDesCArray
+#include <e32def.h>
+#include <e32std.h>
+#include <eikfrlb.h>        // CEikFormattedCellListBox
+#include <eiklbm.h>         // ELbmDoesNotOwnItemArray
+#include <gulicon.h>
+#include <StringLoader.h>
+#include <cmmanager.rsg>
+
+#include <cmcommonconstants.h>
+#include <cmcommonui.h>
+#include "cmlogger.h"
+#include "cmmanagerimpl.h"
+#include "cmmanager.hrh"
+#include <cmconnectionmethoddef.h>
+
+using namespace CMManager;
+
+const TInt KDefaultListBoxFlags = 0;
+
+
+// ---------------------------------------------------------------------------
+// TCmCommonUi::CCmDesCArray::CCmDesCArray
+// ---------------------------------------------------------------------------
+//
+TCmCommonUi::CCmDesCArray::CCmDesCArray()
+    : CDesCArrayFlat( KCmArraySmallGranularity )
+    , iUids( KCmArraySmallGranularity )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// TCmCommonUi::CCmDesCArray::~CCmDesCArray
+// ---------------------------------------------------------------------------
+//
+TCmCommonUi::CCmDesCArray::~CCmDesCArray()
+    {
+    iUids.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// TCmCommonUi::CCmDesCArray::AppendL
+// ---------------------------------------------------------------------------
+//
+void TCmCommonUi::CCmDesCArray::AppendL( TUint aUid, const TDesC& aItem )
+    {
+    iUids.AppendL( aUid );
+    CDesCArray::AppendL( aItem );
+    }
+
+// ---------------------------------------------------------------------------
+// TCmCommonUi::CCmDesCArray::Uid
+// ---------------------------------------------------------------------------
+//
+TUint TCmCommonUi::CCmDesCArray::Uid( TInt aIndex ) const
+    {
+    return iUids[ aIndex ];
+    }
+
+// ---------------------------------------------------------------------------
+// TCmCommonUi::ShowConfirmationQueryWithInputL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt TCmCommonUi::ShowConfirmationQueryWithInputL( TInt aResId, 
+                                                            TDes& aInput )
+    {
+    CLOG_ENTERFN_PTR( "ShowConfirmationQueryWithInputL" );
+    HBufC* prompt = CEikonEnv::Static()->AllocReadResourceAsDes16LC( aResId );
+    
+    CAknTextQueryDialog* dlg =
+                 CAknTextQueryDialog::NewL( aInput, CAknQueryDialog::ENoTone );
+    
+    // Handle the allowable enterable length of the text
+    CLOG_WRITE_1_PTR( NULL, "max length input: [%d   ]", aInput.MaxLength() );
+    dlg->SetMaxLength( aInput.MaxLength() );
+    
+    TInt retval = dlg->ExecuteLD( R_TEXT_QUERY, *prompt );
+    
+    CleanupStack::PopAndDestroy( prompt );
+    
+    return retval;
+    }
+
+// ---------------------------------------------------------------------------
+// TCmCommonUi::ShowConfirmationQueryL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt TCmCommonUi::ShowConfirmationQueryL( TInt aResId )
+    {
+    CLOG_ENTERFN_PTR( "ShowConfirmationQueryL" );
+    HBufC* prompt = CEikonEnv::Static()->AllocReadResourceL( aResId );
+
+    // Ownership (of 'prompt') is handed over to callee. That's why we don't
+    // bother with cleanup stack either - let it be the callee's problem.
+    return ShowConfirmationQueryL( prompt );
+    }    
+    
+// ---------------------------------------------------------------------------
+// TCmCommonUi::ShowConfirmationQueryL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt TCmCommonUi::ShowConfirmationQueryL( TInt aResId, 
+                                                   const TDesC& aString )
+    {
+    CLOG_ENTERFN_PTR( "ShowConfirmationQueryL" );
+    HBufC* prompt = StringLoader::LoadL( aResId, aString );
+    
+    // Ownership (of 'prompt') is handed over to callee.
+    return ShowConfirmationQueryL( prompt );
+    }    
+    
+// ---------------------------------------------------------------------------
+// TCmCommonUi::ShowAvailableMethodsL
+// ---------------------------------------------------------------------------
+//
+TUint32 TCmCommonUi::ShowAvailableMethodsL(
+                                    const RArray<TUint32>& aAvailableBearers,
+                                    const CCmManagerImpl& aCmManager )
+    {
+    CLOG_ENTERFN_PTR( "ShowAvailableMethodsL" );
+
+    TUint32 retval = 0;
+
+    // Create listbox and popup list and perform some initialization on them.
+    CEikFormattedCellListBox* listBox =
+                    new (ELeave) CAknDoubleLargeGraphicPopupMenuStyleListBox();
+    CleanupStack::PushL( listBox );
+    
+    CAknPopupList* popupList =
+         CAknPopupList::NewL( listBox,
+                              R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT,
+                              AknPopupLayouts::EMenuDoubleLargeGraphicWindow );
+    CleanupStack::PushL( popupList );
+
+    listBox->ConstructL( popupList, KDefaultListBoxFlags );
+    listBox->CreateScrollBarFrameL( ETrue );
+    listBox->ScrollBarFrame()->SetScrollBarVisibilityL(
+                                                   CEikScrollBarFrame::EOff,
+                                                   CEikScrollBarFrame::EAuto );
+
+    // Create the icon and item text arrays.
+    CArrayPtr<CGulIcon>* icons =
+                new(ELeave) CArrayPtrFlat<CGulIcon>( KCmArraySmallGranularity );
+    CleanupStack::PushL( icons );
+
+    CCmDesCArray* itemArray = new (ELeave) CCmDesCArray();
+    listBox->Model()->SetItemTextArray( itemArray );
+    // just to be on the safe side: next line is not mandatory, but advisable
+    listBox->Model()->SetOwnershipType( ELbmOwnsItemArray );
+
+    // Note: we don't have to put 'itemArray' on to the cleanup stack, as the
+    // model has already taken this object over.
+
+    // Fill up the arrays
+    for ( TInt i = 0; i < aAvailableBearers.Count(); i++ )
+        {
+        TUint32 bearerUid = aAvailableBearers[i];
+
+        // Add icons to the icon array
+        CGulIcon* icon = (CGulIcon*)(aCmManager.GetBearerInfoIntL(
+                                                  bearerUid,
+                                                  ECmBearerAvailableIcon ) );
+
+        if( !icon )
+            {
+            continue;
+            }
+                
+        CleanupStack::PushL( icon );
+        icons->AppendL( icon );
+        CleanupStack::Pop( icon );  // icon array took over ownership
+
+        // Add item text to the array.
+        // Query the name of the bearer first.
+        HBufC* firstLine = aCmManager.GetBearerInfoStringL(
+                                                  bearerUid,
+                                                  ECmBearerAvailableName );
+        CleanupStack::PushL( firstLine );
+
+        // Query the availability string of the bearer second.
+        HBufC* secondLine = aCmManager.GetBearerInfoStringL(
+                                                  bearerUid,
+                                                  ECmBearerAvailableText );
+        CleanupStack::PushL( secondLine );
+
+        // Third, combine these two strings along with an icon index.
+        HBufC* listBoxLine = FormattedTextForListBoxLC( i,
+                                                        *firstLine,
+                                                        *secondLine );
+
+        // Finally add the resulting string to the item array.
+        itemArray->AppendL( bearerUid, *listBoxLine );
+        
+        CLOG_WRITE_1_PTR( NULL, 
+                          "ShowAvailableMethodsL new listbox item: [%S]",
+                          listBoxLine );
+
+        // Clean-up: firstLine, secondLine, listBoxLine.
+        CleanupStack::PopAndDestroy( 3, firstLine );
+        }
+
+    // Handing over the ownership of the icon array to the listbox
+    listBox->ItemDrawer()->FormattedCellData()->SetIconArrayL( icons );
+    
+    CleanupStack::Pop( icons ); // ownership already handed over
+
+    // Set title
+    HBufC* title = StringLoader::LoadLC( R_CMWIZARD_AVAILABLE_METHODS );
+    popupList->SetTitleL( *title );
+    CleanupStack::PopAndDestroy( title );
+    
+    if ( popupList->ExecuteLD() )
+        {
+        retval = itemArray->Uid( listBox->CurrentItemIndex() );
+        }
+
+    CleanupStack::Pop( popupList ); // ExecuteLD has already destroyed it
+    CleanupStack::PopAndDestroy( listBox );
+
+    CLOG_WRITE_1_PTR( NULL, "ShowAvailableMethodsL exit, retval: [%d]", retval );
+
+    return retval;
+    }
+
+// ---------------------------------------------------------------------------
+// TCmCommonUi::SelectBearerL
+// ---------------------------------------------------------------------------
+//
+TUint32 TCmCommonUi::SelectBearerL( const CCmManagerImpl& aCmManager )
+    {
+    CLOG_ENTERFN_PTR( "SelectBearerL" );
+    TUint32 retval = 0;
+
+    CEikFormattedCellListBox* listBox =
+                    new (ELeave) CAknSingleGraphicPopupMenuStyleListBox();
+    CleanupStack::PushL( listBox );
+    
+    CAknPopupList* popupList =
+         CAknPopupList::NewL( listBox,
+                              R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT,
+                              AknPopupLayouts::EMenuGraphicWindow );
+    CleanupStack::PushL( popupList );
+
+    listBox->ConstructL( popupList, KDefaultListBoxFlags );
+    listBox->CreateScrollBarFrameL( ETrue );
+    listBox->ScrollBarFrame()->SetScrollBarVisibilityL(
+                                                   CEikScrollBarFrame::EOff,
+                                                   CEikScrollBarFrame::EAuto );
+
+    RArray<TUint32> bearers( KCmArrayMediumGranularity );
+    CleanupClosePushL( bearers );
+    aCmManager.SupportedBearersL( bearers );
+    
+    TInt i;
+    
+    for ( i = 0; i < bearers.Count(); ++i )
+        {
+        if( !aCmManager.GetBearerInfoBoolL( bearers[i],
+                                            ECmBearerHasUi ) )
+            {
+            bearers.Remove( i );
+            --i;
+            }
+            
+        }
+
+    CArrayPtr<CGulIcon>* icons =
+              new(ELeave) CArrayPtrFlat<CGulIcon>( KCmArrayMediumGranularity );
+    CleanupStack::PushL( icons );
+
+    // Note: it's interesting that we, in fact, set up an *ordered* list of
+    // icons. Ordering of the icon array is based on the order of supported
+    // bearers.
+    for ( i = 0; i < bearers.Count(); ++i )
+        {
+        CGulIcon* icon = (CGulIcon*)(aCmManager.GetBearerInfoIntL(
+                                                bearers[i],
+                                                ECmBearerIcon ) );
+
+        if( !icon )
+            {
+            bearers.Remove( i );
+            --i;
+            continue;
+            }
+            
+        CleanupStack::PushL( icon );
+
+        icons->AppendL( icon );
+
+        CleanupStack::Pop( icon );  // icon array took over ownership
+        }
+
+    // Handing over the ownership of the icon array to the listbox
+    listBox->ItemDrawer()->FormattedCellData()->SetIconArrayL( icons );
+    
+    CleanupStack::Pop( icons ); // ownership already handed over
+
+    CCmDesCArray* itemArray = new (ELeave) CCmDesCArray();
+    listBox->Model()->SetItemTextArray( itemArray );
+    // just to be on the safe side: next line is not mandatory, but advisable
+    listBox->Model()->SetOwnershipType( ELbmOwnsItemArray );
+
+    // Note: we don't have to put 'itemArray' on to the cleanup stack, as the
+    // model has already taken this object over.
+
+    for ( TInt i = 0; i < bearers.Count(); i++ )
+        {
+        // Here we take advantage of the fact that our icon array is ordered.
+        // That is, the indices of the icons in the array will always be
+        // in sync with those in the item text array (i.e. each bearer will
+        // have the right icon associated with it).
+        HBufC* bearerName = aCmManager.GetBearerInfoStringL( bearers[i],
+                                                      ECmBearerSupportedName );
+        CleanupStack::PushL( bearerName );
+
+        HBufC* lineText = FormattedTextForListBoxLC( i, *bearerName );
+
+        itemArray->AppendL( bearers[i], *lineText );
+
+        CLOG_WRITE_1_PTR( NULL, "SelectBearerL new listbox item: [%S]",
+                               lineText );
+        
+        CleanupStack::PopAndDestroy( 2, bearerName ); // lineText, bearerName
+        }
+
+    CleanupStack::PopAndDestroy( &bearers );
+
+    // Set title
+    HBufC* title = StringLoader::LoadLC( R_CMWIZARD_SELECT_CONN_METHOD );
+    popupList->SetTitleL( *title );
+    CleanupStack::PopAndDestroy( title );
+    
+    if ( popupList->ExecuteLD() )
+        {
+        retval = itemArray->Uid( listBox->CurrentItemIndex() );
+        }
+
+    CleanupStack::Pop( popupList ); // ExecuteLD has already destroyed it
+    CleanupStack::PopAndDestroy( listBox );
+
+    CLOG_WRITE_1_PTR( NULL, "SelectBearerL exit, retval: [%d]", retval );
+
+    return retval;
+    }
+
+// ---------------------------------------------------------------------------
+// TCmCommonUi::ShowConfirmationQueryL
+// ---------------------------------------------------------------------------
+//
+TInt TCmCommonUi::ShowConfirmationQueryL( HBufC* aPrompt )
+    {
+    CLOG_ENTERFN_PTR( "ShowConfirmationQueryL" );
+
+    CleanupStack::PushL( aPrompt );
+    
+    CAknQueryDialog* dlg = 
+            CAknQueryDialog::NewL( CAknQueryDialog::EConfirmationTone );
+    TInt retval = dlg->ExecuteLD( R_CONFIRMATION_QUERY, *aPrompt );
+
+    CleanupStack::PopAndDestroy( aPrompt );
+
+    return retval;
+    }
+
+// ---------------------------------------------------------------------------
+// TCmCommonUi::ShowMemoryFullConfirmationQueryL
+// ---------------------------------------------------------------------------
+//
+TInt TCmCommonUi::ShowMemoryFullConfirmationQueryL()
+    {
+    CLOG_ENTERFN_PTR( "ShowMemoryFullConfirmationQueryL" );
+
+    //  need to check if EikonEnv exists in this context
+    CEikonEnv* eikPtr = CEikonEnv::Static();
+    TInt retval( KErrNone ); 
+    if( eikPtr )
+        {        
+        HBufC* prompt = eikPtr->AllocReadResourceL( R_QTN_MEMLO_MEMORY_FULL );        
+        CleanupStack::PushL( prompt );
+        CAknQueryDialog* dlg = 
+            CAknQueryDialog::NewL( CAknQueryDialog::EConfirmationTone );
+        retval = dlg->ExecuteLD( R_MEMORY_FULL_CONFIRMATION_QUERY, *prompt );
+        CleanupStack::PopAndDestroy( prompt );
+        }
+
+    return retval;
+    }
+
+// ---------------------------------------------------------------------------
+// TCmCommonUi::ShowNoteL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt TCmCommonUi::ShowNoteL( TInt aResId, TCmNoteType aNoteType )
+    {
+    CLOG_ENTERFN_PTR( "ShowNoteL" );
+    HBufC* prompt = CEikonEnv::Static()->AllocReadResourceLC( aResId );
+
+    TInt result = ShowNoteL( *prompt, aNoteType );
+
+    CleanupStack::PopAndDestroy( prompt );
+
+    return result;
+    }    
+    
+// ---------------------------------------------------------------------------
+// TCmCommonUi::ShowNoteL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt TCmCommonUi::ShowNoteL( TInt aResId, const TDesC& aString,
+                                      TCmNoteType aNoteType )
+    {
+    CLOG_ENTERFN_PTR( "ShowNoteL" );
+    HBufC* prompt = StringLoader::LoadLC( aResId, aString );
+    
+    TInt result = ShowNoteL( *prompt, aNoteType );
+
+    CleanupStack::PopAndDestroy( prompt );
+
+    return result;
+    }
+
+// ---------------------------------------------------------------------------
+// TCmCommonUi::ShowNoteL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt TCmCommonUi::ShowNoteL( const TDesC& aPrompt, TCmNoteType aNoteType )
+    {
+    CLOG_ENTERFN_PTR( "ShowNoteL" );
+
+    CAknNoteDialog* dlg = new (ELeave) CAknNoteDialog(
+                             CAknNoteDialog::ENoTone,
+                             CAknNoteDialog::ELongTimeout );
+
+    TInt resId;
+    switch ( aNoteType )
+        {
+        case ECmOkNote:
+            {
+            resId = R_OK_NOTE;
+            break;
+            }
+        case ECmWarningNote:
+            {
+            resId = R_WARNING_NOTE;
+            break;
+            }
+        case ECmErrorNote:
+            {
+            resId = R_ERROR_NOTE;
+            break;
+            }
+        default:
+            {
+            resId = R_INFO_NOTE;
+            }
+        }
+
+    // no need to worry about LC (PrepareLC), RunLD takes care of it
+    dlg->PrepareLC( resId );
+    dlg->SetTextL( aPrompt );
+
+    return dlg->RunLD();
+    }
+
+// ---------------------------------------------------------------------------
+// TCmCommonUi::FormattedTextForListBoxLC
+// ---------------------------------------------------------------------------
+//
+HBufC* TCmCommonUi::FormattedTextForListBoxLC( TInt aIconIndex,
+                                               const TDesC& aLineText )
+    {
+    HBufC* formattedString =
+                HBufC::NewL( KNumberOfStaticCharsIn1LineFormattedString +
+                             aLineText.Length() );
+
+    TPtr des = formattedString->Des();
+    des.AppendFormat( KSingleNumberAsString, aIconIndex );
+    des.Append( TChar( KSettingsListBoxItemPrefix ) );
+    des.Append( aLineText );
+
+    CleanupStack::PushL( formattedString );
+
+    return formattedString;
+    }
+
+// ---------------------------------------------------------------------------
+// TCmCommonUi::FormattedTextForListBoxLC
+// ---------------------------------------------------------------------------
+//
+HBufC* TCmCommonUi::FormattedTextForListBoxLC( TInt aIconIndex,
+                                               const TDesC& aFirstLine,
+                                               const TDesC& aSecondLine )
+    {
+    HBufC* formattedString =
+                HBufC::NewL( KNumberOfStaticCharsIn2LineFormattedString +
+                             aFirstLine.Length() +
+                             aSecondLine.Length() );
+
+    TPtr des = formattedString->Des();
+    des.AppendFormat( KSingleNumberAsString, aIconIndex );
+    des.Append( TChar( KSettingsListBoxItemPrefix ) );
+    des.Append( aFirstLine );
+    des.Append( TChar( KSettingsListBoxItemPrefix ) );
+    des.Append( aSecondLine );
+
+    CleanupStack::PushL( formattedString );
+
+    return formattedString;
+    }
+
+// ---------------------------------------------------------------------------
+// TCmCommonUi::FormattedTextForListBoxLC
+// ---------------------------------------------------------------------------
+//
+HBufC* TCmCommonUi::FormattedTextForListBoxLC( TInt aIconIndex,
+                                               TInt aFirstLineResId,
+                                               TInt aSecondLineResId )
+    {
+    HBufC* secondLine = StringLoader::LoadLC( aSecondLineResId );
+
+    HBufC* formattedString = FormattedTextForListBoxL( aIconIndex,
+                                                       aFirstLineResId,
+                                                       *secondLine );
+
+    CleanupStack::PopAndDestroy( secondLine );
+
+    CleanupStack::PushL( formattedString );
+
+    return formattedString;
+    }
+
+
+// ---------------------------------------------------------------------------
+// TCmCommonUi::FormattedTextForListBoxLC
+// ---------------------------------------------------------------------------
+//
+HBufC* TCmCommonUi::FormattedTextForListBoxLC( TInt aIconIndex,
+                                               TInt aFirstLineResId,
+                                               TInt aSecondLineResId,
+                                               TInt aReplacementInSecondLine )
+    {
+    HBufC* secondLine = StringLoader::LoadLC( aSecondLineResId,
+                                              aReplacementInSecondLine );
+
+    HBufC* formattedString = FormattedTextForListBoxL( aIconIndex,
+                                                       aFirstLineResId,
+                                                       *secondLine );
+
+    CleanupStack::PopAndDestroy( secondLine );
+
+    CleanupStack::PushL( formattedString );
+
+    return formattedString;
+    }
+
+
+// ---------------------------------------------------------------------------
+// TCmCommonUi::FormattedTextForListBoxL
+// ---------------------------------------------------------------------------
+//
+HBufC* TCmCommonUi::FormattedTextForListBoxL( TInt aIconIndex,
+                                               TInt aFirstLineResId,
+                                               const TDesC& aSecondLine )
+    {
+    HBufC* firstLine = StringLoader::LoadLC( aFirstLineResId );
+    
+    HBufC* formattedString =
+                HBufC::NewL( KNumberOfStaticCharsIn2LineFormattedString +
+                             firstLine->Length() +
+                             aSecondLine.Length() );
+
+    TPtr des = formattedString->Des();
+    des.AppendFormat( KSingleNumberAsString, aIconIndex );
+    des.Append( TChar( KSettingsListBoxItemPrefix ) );
+    des.Append( *firstLine );
+    des.Append( TChar( KSettingsListBoxItemPrefix ) );
+    des.Append( aSecondLine );
+    
+    CleanupStack::PopAndDestroy( firstLine );
+
+    return formattedString;
+    }
+
+
+// --------------------------------------------------------------------------
+// TCmCommonUi::ShowPopupListL
+// --------------------------------------------------------------------------
+//
+EXPORT_C TBool TCmCommonUi::ShowPopupListL( const TDesC& aTitle,
+                                            CDesCArrayFlat* aTextItems,
+                                            CArrayPtr<CGulIcon>* aIconArray,
+                                            const TUint aSoftKeys,
+                                            TInt& aSelection )
+    {
+    TBool retVal ( EFalse );
+    
+    // Prepare the dialog
+    CEikFormattedCellListBox* list = NULL;
+    if ( aIconArray )
+        {
+        list = new ( ELeave ) CAknSingleGraphicPopupMenuStyleListBox;
+        }
+    else
+        {
+        list = new ( ELeave ) CAknSinglePopupMenuStyleListBox;
+        }
+        
+    CleanupStack::PushL( list );
+    
+    CAknPopupList* popupList = CAknPopupList::NewL(
+                                       list, aSoftKeys,
+                                       AknPopupLayouts::EMenuWindow );
+    CleanupStack::PushL( popupList );
+
+    // initialise listbox.
+    list->ConstructL( popupList, CEikListBox::ELeftDownInViewRect );
+    list->CreateScrollBarFrameL( ETrue );
+    list->ScrollBarFrame()->SetScrollBarVisibilityL(
+                                               CEikScrollBarFrame::EOff,
+                                               CEikScrollBarFrame::EAuto );
+                                               
+    // Handing over the ownership of the icon array to the listbox
+    if ( aIconArray )
+        {
+        list->ItemDrawer()->FormattedCellData()->SetIconArrayL( aIconArray );
+        }
+	
+	// Items
+    list->Model()->SetItemTextArray( aTextItems );
+   
+    // Title
+    popupList->SetTitleL( aTitle );
+    
+    // Show the dialog
+    if ( popupList->ExecuteLD() )
+        {
+        aSelection = list->CurrentItemIndex();
+        retVal = ETrue;
+        }
+
+    CleanupStack::Pop( popupList );
+    CleanupStack::PopAndDestroy( list );
+    
+    return retVal;
+    }
+
+// ---------------------------------------------------------------------------
+// TCmCommonUi::ShowAlwaysAskNoteL
+// ---------------------------------------------------------------------------
+//
+TBool TCmCommonUi::ShowAlwaysAskNoteL( TCmDefConnValue aOldDefConn,
+                                        CCmManagerImpl& aCmManagerImpl )
+    {
+    TCmDefConnValue newConn;
+    aCmManagerImpl.ReadDefConnL( newConn );
+    if ( newConn != aOldDefConn )
+        {
+         ShowNoteL( R_CMMANAGERUI_CONF_DEFAULT_ALWAYS_ASK,
+                                                TCmCommonUi::ECmOkNote );
+        return ETrue;
+        }
+    return EFalse;
+    }
+   
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Src/cmcommsdatnotifier.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,168 @@
+/*
+* Copyright (c) 2009- Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Listens for changes in one CommsDat table through CenRep.
+*
+*/
+
+#include <commsdat.h>
+#include <centralrepository.h>
+#include <cmcommonconstants.h>
+
+#include "cmcommsdatnotifier.h"
+#include "cmmanagerimpl.h"
+
+// Repository for CommsDat
+const TUid KCDCommsRepositoryId = { 0xCCCCCC00 };
+
+CCmCommsDatNotifier* CCmCommsDatNotifier::NewL( TUint32 aTableId )
+    {
+    CCmCommsDatNotifier* self = CCmCommsDatNotifier::NewLC( aTableId );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+CCmCommsDatNotifier* CCmCommsDatNotifier::NewLC( TUint32 aTableId )
+    {
+    CCmCommsDatNotifier* self = new( ELeave ) CCmCommsDatNotifier( aTableId );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+CCmCommsDatNotifier::~CCmCommsDatNotifier()
+    {
+    // Cancel outstanding request, if exists
+    if( iWatcher )
+        {
+        Cancel();
+        }
+    delete iRepository;
+    
+    DeleteCallBackArray();
+    
+    iWatcher = NULL;
+    }
+
+void CCmCommsDatNotifier::DeleteCallBackArray()
+    {
+    TInt count = iCallBackArray->Count();
+    TInt index( 0 );
+    while( count > 0 )
+        {
+        iCallBackArray->Delete( index );
+        iCallBackArray->Compress();
+        
+        count = iCallBackArray->Count();
+        }
+    
+    delete iCallBackArray;
+    iCallBackArray = NULL;
+    }
+
+CCmCommsDatNotifier::CCmCommsDatNotifier( TUint32 aTableId )
+        :
+        CActive( EPriorityStandard ),
+        iTableId( aTableId ),
+        iWatcher( NULL )
+    {
+    iRepository = NULL;
+    }
+
+void CCmCommsDatNotifier::ConstructL()
+    {
+    iCallBackArray = new (ELeave) CCmCallBackArray( KCmArrayBigGranularity );
+    
+    iRepository = CRepository::NewL( KCDCommsRepositoryId );
+    CActiveScheduler::Add( this );
+    }
+
+void CCmCommsDatNotifier::WatcherRegisterL( MCmCommsDatWatcher* aWatcher )
+    {
+    if( !aWatcher )
+        {
+        return;
+        }
+    
+    if( !iWatcher )
+        {
+        TInt err( RequestNotifications() );
+        User::LeaveIfError( err );
+        }
+    
+    iCallBackArray->AppendL( aWatcher );
+    
+    iWatcher = aWatcher;
+    }
+
+void CCmCommsDatNotifier::WatcherUnRegister( )
+    {
+    TInt index = iCallBackArray->Count();
+    index --;
+    
+    if (index >= 0)
+        {
+        iCallBackArray->Delete( index );
+        iCallBackArray->Compress();
+        }
+    
+    index = iCallBackArray->Count();
+    index --;
+    if (index >= 0)
+        {
+        iWatcher = (*iCallBackArray)[index];
+        }
+    else
+        {
+        iWatcher = NULL;
+        }
+    
+    if( !iWatcher )
+        {
+        Cancel();
+        }
+    }
+
+TInt CCmCommsDatNotifier::RequestNotifications()
+    {
+    TInt err = iRepository->NotifyRequest( iTableId, KCDMaskShowRecordType, iStatus );
+
+    if ( KErrNone == err )
+        {
+        SetActive();
+        }
+        
+    return err;
+    }
+
+void CCmCommsDatNotifier::DoCancel()
+    {
+    iRepository->NotifyCancel( iTableId, KCDMaskShowRecordType );
+    }
+
+void CCmCommsDatNotifier::RunL()
+    {
+    if ( iStatus.Int() < KErrNone )
+        {
+        return;
+        }
+
+    if ( iWatcher )
+        {
+        iWatcher->CommsDatChangesL();
+        
+        RequestNotifications();
+        }
+    }
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Src/cmconnectionmethod.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,433 @@
+/*
+* 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 RCmConnectionMethod
+*
+*/
+
+// INCLUDES
+#include "cmmanagerimpl.h"
+#include <cmdestination.h>
+#include <cmpluginbase.h>
+#include <cmpluginbaseeng.h>
+#include <cmconnectionmethod.h>
+#include "cmdestinationimpl.h"
+
+using namespace CMManager;
+// ======== MEMBER FUNCTIONS ========
+
+
+// -----------------------------------------------------------------------------
+// RCmConnectionMethod::RCmConnectionMethod()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C RCmConnectionMethod::RCmConnectionMethod(
+                                const RCmConnectionMethod& aItem)
+    : iImplementation( aItem.iImplementation )
+    {
+    iImplementation->IncrementRefCounter();
+    }
+
+
+// -----------------------------------------------------------------------------
+// RCmConnectionMethod::Close()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RCmConnectionMethod::Close()
+    {
+    if( !iImplementation )
+        {
+        return;
+        }
+
+    TRAP_IGNORE( iImplementation->CmMgr().RemoveCMFromPoolL(iImplementation) );
+    iImplementation = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// RCmConnectionMethod::~RCmConnectionMethod()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C RCmConnectionMethod::~RCmConnectionMethod()
+    {
+    Close();
+    }
+
+// -----------------------------------------------------------------------------
+// RCmConnectionMethod::GetIntAttributeL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TUint32 
+            RCmConnectionMethod::GetIntAttributeL( TUint32 aAttribute ) const
+    {
+    if (!iImplementation)
+        {
+        User::Leave(KErrBadHandle);
+        }
+    
+    return iImplementation->GetIntAttributeL( aAttribute );
+    }
+
+// -----------------------------------------------------------------------------
+// RCmConnectionMethod::GetBoolAttributeL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool 
+            RCmConnectionMethod::GetBoolAttributeL( TUint32 aAttribute ) const
+    {
+    if (!iImplementation)
+        {
+        User::Leave(KErrBadHandle);
+        }
+    
+    return iImplementation->GetBoolAttributeL( aAttribute );
+    }
+
+// -----------------------------------------------------------------------------
+// RCmConnectionMethod::GetStringAttributeL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C HBufC* 
+            RCmConnectionMethod::GetStringAttributeL( TUint32 aAttribute ) const
+    {
+    if (!iImplementation)
+        {
+        User::Leave(KErrBadHandle);
+        }
+    
+    return iImplementation->GetStringAttributeL( aAttribute );
+    }
+
+// -----------------------------------------------------------------------------
+// RCmConnectionMethod::GetString8AttributeL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C HBufC8* RCmConnectionMethod::GetString8AttributeL( TUint32 aAttribute ) const
+    {
+    if (!iImplementation)
+        {
+        User::Leave(KErrBadHandle);
+        }
+    
+    return iImplementation->GetString8AttributeL( aAttribute );
+    }
+
+// -----------------------------------------------------------------------------
+// RCmConnectionMethod::SetIntAttributeL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RCmConnectionMethod::SetIntAttributeL( TUint32 aAttribute, 
+                                                        TUint32 aValue )
+    {
+    if (!iImplementation)
+        {
+        User::Leave(KErrBadHandle);
+        }
+    
+    if( iImplementation->GetBoolAttributeL( ECmProtected ) )
+        {
+        // Only clients with NetworkControl capability can modify
+        // protection setting!
+        CCmManagerImpl::HasCapabilityL( ECapabilityNetworkControl );
+        }
+
+    iImplementation->SetIntAttributeL( aAttribute, aValue );
+    }
+
+// -----------------------------------------------------------------------------
+// RCmConnectionMethod::SetBoolAttributeL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RCmConnectionMethod::SetBoolAttributeL( TUint32 aAttribute, 
+                                                      TBool aValue )
+    {
+    if (!iImplementation)
+        {
+        User::Leave(KErrBadHandle);
+        }
+
+    if( iImplementation->GetBoolAttributeL( ECmProtected ) )
+        {
+        // Only clients with NetworkControl capability can modify
+        // protection setting!
+        CCmManagerImpl::HasCapabilityL( ECapabilityNetworkControl );
+        }
+        
+    iImplementation->SetBoolAttributeL( aAttribute, aValue );
+    }
+
+// -----------------------------------------------------------------------------
+// RCmConnectionMethod::SetStringAttributeL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RCmConnectionMethod::SetStringAttributeL( TUint32 aAttribute, 
+                                                        const TDesC16& aValue )
+    {
+    if (!iImplementation)
+        {
+        User::Leave(KErrBadHandle);
+        }
+    
+    if( iImplementation->GetBoolAttributeL( ECmProtected ) )
+        {
+        // Only clients with NetworkControl capability can modify
+        // protection setting!
+        CCmManagerImpl::HasCapabilityL( ECapabilityNetworkControl );
+        }
+
+    iImplementation->SetStringAttributeL( aAttribute, aValue );
+    }
+
+// -----------------------------------------------------------------------------
+// RCmConnectionMethod::SetString8AttributeL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RCmConnectionMethod::SetString8AttributeL( TUint32 aAttribute, 
+                                                         const TDesC8& aValue )
+    {
+    if (!iImplementation)
+        {
+        User::Leave(KErrBadHandle);
+        }
+    
+    if( iImplementation->GetBoolAttributeL( ECmProtected ) )
+        {
+        // Only clients with NetworkControl capability can modify
+        // protection setting!
+        CCmManagerImpl::HasCapabilityL( ECapabilityNetworkControl );
+        }
+        
+    iImplementation->SetString8AttributeL( aAttribute, aValue );
+    }
+
+// -----------------------------------------------------------------------------
+// RCmConnectionMethod::UpdateL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RCmConnectionMethod::UpdateL()
+    {
+    if (!iImplementation)
+        {
+        User::Leave(KErrBadHandle);
+        }
+    
+    iImplementation->UpdateL();
+    }
+
+// -----------------------------------------------------------------------------
+// RCmConnectionMethod::DeleteL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool RCmConnectionMethod::DeleteL()
+    {
+    if (!iImplementation)
+        {
+        User::Leave(KErrBadHandle);
+        }
+
+    if( iImplementation->GetBoolAttributeL( ECmProtected ) )
+        {
+        // Only clients with NetworkControl capability can delete
+        // this destination
+        CCmManagerImpl::HasCapabilityL( ECapabilityNetworkControl );
+        }
+            
+    // Check it's not connected
+    if ( iImplementation->GetBoolAttributeL( ECmConnected ) )
+        {
+        User::Leave( KErrInUse );
+        }
+
+    // Check it's not referenced by Virtual CM
+    if( iImplementation->GetBoolAttributeL( ECmIsLinked ) )
+        {
+        User::Leave( KErrLocked );
+        }
+
+    // Check that it's not the last CM in a destination which is
+    // referenced by Virtual CM
+    CCmDestinationImpl* destImpl = iImplementation->ParentDestination();
+    TUint32 destId ( 0 );
+    TUint32 count( 0 ); 
+    
+    if ( destImpl )
+        {
+        destId = destImpl->Id();
+        count = destImpl->ConnectionMethodCount();
+        }
+    delete destImpl;
+    destImpl = NULL;
+
+    if ( count  == 1 )
+        {
+        // The IAP is in destination and it's the last one
+            // for each IAP in CM manager
+            //   1. check if it is virtual
+            //      if not => goto 1.
+            //      if yes:
+            //      2. check if it links to the destination of this CM
+            //         if yes => carryOn = EFalse, ERROR
+            //         if not: carryOn = ETrue
+        TBool carryOn = ETrue;
+        
+        CommsDat::CMDBRecordSet<CommsDat::CCDIAPRecord>* iaps = iImplementation->CmMgr().AllIapsL();
+        CleanupStack::PushL( iaps );
+
+        // for each IAP in CM manager
+        for ( TInt i = KCmInitIndex; carryOn && i < iaps->iRecords.Count(); ++i )
+            {
+            CommsDat::CCDIAPRecord* rec = (*iaps)[i];
+            TUint32 bearerType = 0;
+
+            TRAP_IGNORE( bearerType = iImplementation->CmMgr().BearerTypeFromIapRecordL( rec ) );
+            if ( !bearerType )
+                {
+                continue;
+                }
+
+            // check if it is virtual
+            if ( iImplementation->CmMgr().GetBearerInfoBoolL( bearerType, ECmVirtual ) )
+                {
+                // check if it links to the current destination
+                CCmPluginBase* plugin = NULL;            
+                TRAP_IGNORE( plugin = iImplementation->CmMgr().GetConnectionMethodL( rec->RecordId() ) );
+
+                if ( !plugin )
+                    {
+                    continue;
+                    }
+
+                if ( plugin->IsLinkedToSnap( destId ) )
+                    {
+                    // the CM links to this destination, deletion not allowed
+                    carryOn = EFalse;
+                    }
+
+                delete plugin;
+                }
+            }
+
+        CleanupStack::PopAndDestroy( iaps );
+
+        if ( !carryOn )
+            {
+            User::Leave( KErrLocked );
+            }
+        }
+        
+    // ETrue = delete it. It doesn't matter how many referencies there are.
+    TBool deleteRes = iImplementation->DeleteL( ETrue );
+    if( deleteRes )
+        {
+        CCmDestinationImpl* dest = iImplementation->ParentDestination();
+        if( dest )
+            {
+            CCmPluginBase* connMethod = new (ELeave) 
+                                    CCmPluginBase(iImplementation);
+            CleanupStack::PushL( connMethod );        
+            dest->ConnectionMethodDeletedL( *connMethod );
+            CleanupStack::PopAndDestroy(connMethod);//deletes iImplementation
+            iImplementation = NULL;
+            }
+        delete dest;
+        }
+        
+    return deleteRes;
+    }
+
+// -----------------------------------------------------------------------------
+// RCmConnectionMethod::Destination()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C RCmDestination RCmConnectionMethod::DestinationL() const
+    {
+    if (!iImplementation)
+        {
+        User::Leave(KErrBadHandle);
+        }        
+    if (!iImplementation->Destination())
+        {
+        User::Leave(KErrNotSupported);
+        }
+    
+    RCmDestination dest;
+    dest.iDestinatonData = 
+                iImplementation->Destination()->GetData();
+    dest.iDestinatonData->IncrementRefCounter();
+    return dest;
+    }
+// --------------------------------------------------------------------------
+// RCmConnectionMethod::RCmConnectionMethod
+// --------------------------------------------------------------------------
+//
+EXPORT_C RCmConnectionMethod::RCmConnectionMethod()
+    : iImplementation( NULL )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// RCmConnectionMethod::operator=()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C RCmConnectionMethod& RCmConnectionMethod::operator=(
+                                const RCmConnectionMethod& aConnMethod)
+    {
+    if (this != &aConnMethod) 
+        {
+        Close();
+        iImplementation = aConnMethod.iImplementation;
+        iImplementation->IncrementRefCounter();
+        }
+    return *this;
+    }
+
+// --------------------------------------------------------------------------
+// RCmConnectionMethod::operator==
+// --------------------------------------------------------------------------
+//
+EXPORT_C TBool RCmConnectionMethod::operator==( 
+                                    RCmConnectionMethod& aConnMethod ) const
+    {
+    return ( iImplementation == aConnMethod.iImplementation );
+    };
+
+
+// --------------------------------------------------------------------------
+// RCmConnectionMethod::operator!=
+// --------------------------------------------------------------------------
+//
+EXPORT_C TBool RCmConnectionMethod::operator!=( 
+                                    RCmConnectionMethod& aConnMethod ) const
+    {
+    return !( iImplementation == aConnMethod.iImplementation );
+    };
+
+// -----------------------------------------------------------------------------
+// RCmConnectionMethod::CreateCopyL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C RCmConnectionMethod RCmConnectionMethod::CreateCopyL()
+    {
+    if (!iImplementation)
+        {
+        User::Leave(KErrBadHandle);
+        }
+
+    RCmConnectionMethod cm;
+
+    cm.iImplementation = iImplementation->CreateCopyL();
+    cm.iImplementation->CmMgr().InsertConnectionMethodL(cm.iImplementation);
+
+    return cm;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Src/cmconnectionmethodext.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,438 @@
+/*
+* 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 RCmConnectionMethodExt
+*
+*/
+
+// INCLUDES
+#include "cmmanagerimpl.h"
+#include <cmdestinationext.h>
+#include <cmpluginbase.h>
+#include <cmconnectionmethodext.h>
+#include "cmdestinationimpl.h"
+
+using namespace CMManager;
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// RCmConnectionMethodExt::RCmConnectionMethodExt()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C RCmConnectionMethodExt::RCmConnectionMethodExt(
+                                const RCmConnectionMethodExt& aItem)
+    : iImplementation( aItem.iImplementation )
+    {
+    iImplementation->IncrementRefCounter();
+    }
+
+
+// -----------------------------------------------------------------------------
+// RCmConnectionMethodExt::Close()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RCmConnectionMethodExt::Close()
+    {
+    if( !iImplementation )
+        {
+        return;
+        }
+
+    TRAP_IGNORE( iImplementation->CmMgr().RemoveCMFromPoolL(iImplementation) );
+    iImplementation = NULL;
+    }
+
+
+// -----------------------------------------------------------------------------
+// RCmConnectionMethodExt::CreateCopyL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C RCmConnectionMethodExt RCmConnectionMethodExt::CreateCopyL()
+    {
+    if (!iImplementation)
+        {
+        User::Leave(KErrBadHandle);
+        }
+    
+    RCmConnectionMethodExt cm;
+    
+    cm.iImplementation = iImplementation->CreateCopyL();
+
+    cm.iImplementation->CmMgr().InsertConnectionMethodL(cm.iImplementation);
+    
+    return cm;
+    }
+    
+
+// -----------------------------------------------------------------------------
+// RCmConnectionMethodExt::GetIntAttributeL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TUint32 
+            RCmConnectionMethodExt::GetIntAttributeL( TUint32 aAttribute ) const
+    {
+    if (!iImplementation)
+        {
+        User::Leave(KErrBadHandle);
+        }
+    
+    return iImplementation->GetIntAttributeL( aAttribute );
+    }
+
+// -----------------------------------------------------------------------------
+// RCmConnectionMethodExt::GetBoolAttributeL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool 
+           RCmConnectionMethodExt::GetBoolAttributeL( TUint32 aAttribute ) const
+    {
+    if (!iImplementation)
+        {
+        User::Leave(KErrBadHandle);
+        }
+
+    
+    return iImplementation->GetBoolAttributeL( aAttribute );
+    }
+
+// -----------------------------------------------------------------------------
+// RCmConnectionMethodExt::GetStringAttributeL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C HBufC* 
+        RCmConnectionMethodExt::GetStringAttributeL( TUint32 aAttribute ) const
+    {
+    if (!iImplementation)
+        {
+        User::Leave(KErrBadHandle);
+        }
+
+    
+    return iImplementation->GetStringAttributeL( aAttribute );
+    }
+
+// -----------------------------------------------------------------------------
+// RCmConnectionMethodExt::GetString8AttributeL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C HBufC8* 
+        RCmConnectionMethodExt::GetString8AttributeL( TUint32 aAttribute ) const
+    {
+    if (!iImplementation)
+        {
+        User::Leave(KErrBadHandle);
+        }
+    
+    return iImplementation->GetString8AttributeL( aAttribute );
+    }
+
+// -----------------------------------------------------------------------------
+// RCmConnectionMethodExt::SetIntAttributeL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RCmConnectionMethodExt::SetIntAttributeL( TUint32 aAttribute, 
+                                                        TUint32 aValue )
+    {
+    if (!iImplementation)
+        {
+        User::Leave(KErrBadHandle);
+        }
+    
+    if( iImplementation->GetBoolAttributeL( ECmProtected ) )
+        {
+        // Only clients with NetworkControl capability can modify
+        // protection setting!
+        CCmManagerImpl::HasCapabilityL( ECapabilityNetworkControl );
+        }
+
+    iImplementation->SetIntAttributeL( aAttribute, aValue );
+    }
+
+// -----------------------------------------------------------------------------
+// RCmConnectionMethodExt::SetBoolAttributeL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RCmConnectionMethodExt::SetBoolAttributeL( TUint32 aAttribute, 
+                                                         TBool aValue )
+    {
+    if (!iImplementation)
+        {
+        User::Leave(KErrBadHandle);
+        }
+
+    if( iImplementation->GetBoolAttributeL( ECmProtected ) )
+        {
+        // Only clients with NetworkControl capability can modify
+        // protection setting!
+        CCmManagerImpl::HasCapabilityL( ECapabilityNetworkControl );
+        }
+        
+    iImplementation->SetBoolAttributeL( aAttribute, aValue );
+    }
+
+// -----------------------------------------------------------------------------
+// RCmConnectionMethodExt::SetStringAttributeL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void 
+            RCmConnectionMethodExt::SetStringAttributeL( TUint32 aAttribute, 
+                                                         const TDesC16& aValue )
+    {
+    if (!iImplementation)
+        {
+        User::Leave(KErrBadHandle);
+        }
+    
+    if( iImplementation->GetBoolAttributeL( ECmProtected ) )
+        {
+        // Only clients with NetworkControl capability can modify
+        // protection setting!
+        CCmManagerImpl::HasCapabilityL( ECapabilityNetworkControl );
+        }
+
+    iImplementation->SetStringAttributeL( aAttribute, aValue );
+    }
+
+// -----------------------------------------------------------------------------
+// RCmConnectionMethodExt::SetString8AttributeL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void 
+            RCmConnectionMethodExt::SetString8AttributeL( TUint32 aAttribute, 
+                                                          const TDesC8& aValue )
+    {
+    if (!iImplementation)
+        {
+        User::Leave(KErrBadHandle);
+        }
+    
+    if( iImplementation->GetBoolAttributeL( ECmProtected ) )
+        {
+        // Only clients with NetworkControl capability can modify
+        // protection setting!
+        CCmManagerImpl::HasCapabilityL( ECapabilityNetworkControl );
+        }
+        
+    iImplementation->SetString8AttributeL( aAttribute, aValue );
+    }
+
+// -----------------------------------------------------------------------------
+// RCmConnectionMethodExt::UpdateL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RCmConnectionMethodExt::UpdateL()
+    {
+    if (!iImplementation)
+        {
+        User::Leave(KErrBadHandle);
+        }
+    
+    iImplementation->UpdateL();
+    }
+
+// -----------------------------------------------------------------------------
+// RCmConnectionMethodExt::DeleteL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool RCmConnectionMethodExt::DeleteL()
+    {
+    if (!iImplementation)
+        {
+        User::Leave(KErrBadHandle);
+        }
+
+    if( iImplementation->GetBoolAttributeL( ECmProtected ) )
+        {
+        // Only clients with NetworkControl capability can delete
+        // this destination
+        CCmManagerImpl::HasCapabilityL( ECapabilityNetworkControl );
+        }
+
+    // Check it's not connected
+    if ( iImplementation->GetBoolAttributeL( ECmConnected ) )
+        {
+        User::Leave( KErrInUse );
+        }
+
+    // Check it's not referenced by Virtual CM
+    if( iImplementation->GetBoolAttributeL( ECmIsLinked ) )
+        {
+        User::Leave( KErrLocked );
+        }
+
+    // Check that it's not the last CM in a destination which is
+    // referenced by Virtual CM
+    CCmDestinationImpl* destImpl = iImplementation->ParentDestination();
+    TUint32 destId ( 0 );
+    TUint32 count( 0 ); 
+    
+    if ( destImpl )
+        {
+        destId = destImpl->Id();
+        count = destImpl->ConnectionMethodCount();
+        }
+    delete destImpl;
+    destImpl = NULL;
+
+    if ( count  == 1 )
+        {
+        // The IAP is in destination and it's the last one
+            // for each IAP in CM manager
+            //   1. check if it is virtual
+            //      if not => goto 1.
+            //      if yes:
+            //      2. check if it links to the destination of this CM
+            //         if yes => carryOn = EFalse, ERROR
+            //         if not: carryOn = ETrue
+        TBool carryOn = ETrue;
+        
+        CommsDat::CMDBRecordSet<CommsDat::CCDIAPRecord>* iaps = iImplementation->CmMgr().AllIapsL();
+        CleanupStack::PushL( iaps );
+
+        // for each IAP in CM manager
+        for ( TInt i = KCmInitIndex; carryOn && i < iaps->iRecords.Count(); ++i )
+            {
+            CommsDat::CCDIAPRecord* rec = (*iaps)[i];
+            TUint32 bearerType = 0;
+
+            TRAP_IGNORE( bearerType = iImplementation->CmMgr().BearerTypeFromIapRecordL( rec ) );
+            if ( !bearerType )
+                {
+                continue;
+                }
+
+            // check if it is virtual
+            if ( iImplementation->CmMgr().GetBearerInfoBoolL( bearerType, ECmVirtual ) )
+                {
+                // check if it links to the current destination
+                CCmPluginBase* plugin = NULL;            
+                TRAP_IGNORE( plugin = iImplementation->CmMgr().GetConnectionMethodL( rec->RecordId() ) );
+
+                if ( !plugin )
+                    {
+                    continue;
+                    }
+
+                if ( plugin->IsLinkedToSnap( destId ) )
+                    {
+                    // the CM links to this destination, deletion not allowed
+                    carryOn = EFalse;
+                    }
+
+                delete plugin;
+                }
+            }
+
+        CleanupStack::PopAndDestroy( iaps );
+
+        if ( !carryOn )
+            {
+            User::Leave( KErrLocked );
+            }
+        }
+
+    // ETrue = delete it. It doesn't matter how many referencies there are.
+    TBool deleteRes = iImplementation->DeleteL( ETrue );
+    if( deleteRes )
+        {
+        CCmDestinationImpl* dest = iImplementation->ParentDestination();
+        if( dest )
+            {
+            CCmPluginBase* connMethod = new (ELeave) 
+                                    CCmPluginBase(iImplementation);
+            CleanupStack::PushL( connMethod );        
+            dest->ConnectionMethodDeletedL( *connMethod );
+            CleanupStack::PopAndDestroy(connMethod);//deletes iImplementation
+            iImplementation = NULL;
+            }
+        delete dest;
+        }
+        
+    return deleteRes;
+    }
+
+// -----------------------------------------------------------------------------
+// RCmConnectionMethod::Destination()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C RCmDestinationExt RCmConnectionMethodExt::DestinationL() const
+    {
+    if (!iImplementation)
+        {
+        User::Leave(KErrBadHandle);
+        }        
+    if (!iImplementation->Destination())
+        {
+        User::Leave(KErrNotSupported);
+        }
+    
+    RCmDestinationExt dest;
+    dest.iDestinatonData = 
+                iImplementation->Destination()->GetData();
+    dest.iDestinatonData->IncrementRefCounter();
+    return dest;
+    }
+// --------------------------------------------------------------------------
+// RCmConnectionMethod::RCmConnectionMethod
+// --------------------------------------------------------------------------
+//
+EXPORT_C RCmConnectionMethodExt::RCmConnectionMethodExt()
+    : iImplementation( NULL )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// RCmConnectionMethodExt::~RCmConnectionMethodExt()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C RCmConnectionMethodExt::~RCmConnectionMethodExt()
+    {
+    Close();
+    }
+
+// -----------------------------------------------------------------------------
+// RCmConnectionMethod::operator=()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C RCmConnectionMethodExt& RCmConnectionMethodExt::operator=(
+                                const RCmConnectionMethodExt& aConnMethod)
+    {
+    if (this != &aConnMethod) 
+        {
+        Close();
+        iImplementation = aConnMethod.iImplementation;
+        iImplementation->IncrementRefCounter();
+        }
+    return *this;
+    }
+
+// --------------------------------------------------------------------------
+// RCmConnectionMethod::operator==
+// --------------------------------------------------------------------------
+//
+EXPORT_C TBool RCmConnectionMethodExt::operator==( 
+                                    RCmConnectionMethodExt& aConnMethod ) const
+    {
+    return ( iImplementation == aConnMethod.iImplementation );
+    };
+
+
+// --------------------------------------------------------------------------
+// RCmConnectionMethod::operator!=
+// --------------------------------------------------------------------------
+//
+EXPORT_C TBool RCmConnectionMethodExt::operator!=( 
+                                    RCmConnectionMethodExt& aConnMethod ) const
+    {
+    return !( iImplementation == aConnMethod.iImplementation );
+    };
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Src/cmconnectionmethodinfo.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,315 @@
+/*
+* 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 CCmConnectionMethodInfo
+*
+*/
+#include <cmpluginbase.h>
+#include "cmmanagerimpl.h"
+#include "cmlogger.h"
+#include "cmconnectionmethodinfo.h"
+
+using namespace CommsDat;
+
+// ======== LOCAL FUNCTIONS ========
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CCmConnectionMethodInfo::CCmConnectionMethodInfo
+// ---------------------------------------------------------------------------
+//
+CCmConnectionMethodInfo::CCmConnectionMethodInfo( 
+                                                TCmPluginInitParam *aInitParam )
+    : CCmPluginBaseEng( aInitParam )
+    {
+    CLOG_CREATE;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmConnectionMethodInfo::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CCmConnectionMethodInfo::ConstructL()
+    {
+    // Dummy bearer type
+    iBearerType = KDummyBearerType;
+    
+    CCmPluginBaseEng::ConstructL();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmConnectionMethodInfo::NewL
+// ---------------------------------------------------------------------------
+//
+CCmConnectionMethodInfo* 
+                CCmConnectionMethodInfo::NewL( TCmPluginInitParam *aInitParam )
+    {
+    CCmConnectionMethodInfo* self = CCmConnectionMethodInfo::NewLC( aInitParam );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmConnectionMethodInfo::NewLC
+// ---------------------------------------------------------------------------
+//
+CCmConnectionMethodInfo* 
+                CCmConnectionMethodInfo::NewLC( TCmPluginInitParam *aInitParam )
+    {
+    CCmConnectionMethodInfo* self = 
+                            new( ELeave ) CCmConnectionMethodInfo( aInitParam );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmConnectionMethodInfo::~CCmConnectionMethodInfo
+// ---------------------------------------------------------------------------
+//
+CCmConnectionMethodInfo::~CCmConnectionMethodInfo()
+    {
+    CLOG_CLOSE;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmConnectionMethodInfo::GetConnectionInfoIntL
+// ---------------------------------------------------------------------------
+//
+TUint32 CCmConnectionMethodInfo::GetConnectionInfoIntL( const TUint32 aIapId, 
+                                                 const TUint32 aAttribute )
+    {
+    CCmPluginBase* plugin = CmMgr().GetConnectionMethodL( aIapId );
+    CleanupStack::PushL( plugin );
+     
+    if ( !plugin ) 
+        {
+        User::Leave( KErrNotFound );
+        }
+
+    ResetAndLoadL( aIapId );
+        
+    TUint32 info = plugin->GetIntAttributeL( aAttribute );
+    CleanupStack::PopAndDestroy( plugin );
+
+    return info;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmConnectionMethodInfo::GetConnectionInfoBoolL
+// ---------------------------------------------------------------------------
+//
+TBool CCmConnectionMethodInfo::GetConnectionInfoBoolL( const TUint32 aIapId, 
+                                                const TUint32 aAttribute )
+    {
+    CCmPluginBase* plugin = CmMgr().GetConnectionMethodL( aIapId );
+    CleanupStack::PushL( plugin );
+    
+    if ( !plugin ) 
+        {
+        User::Leave( KErrNotFound );
+        }
+
+    ResetAndLoadL( aIapId );
+        
+	TBool info = plugin->GetBoolAttributeL( aAttribute );
+    CleanupStack::PopAndDestroy( plugin );
+    
+    return info;
+	}
+                                 
+// ---------------------------------------------------------------------------
+// CCmConnectionMethodInfo::GetConnectionInfoStringL
+// ---------------------------------------------------------------------------
+//
+HBufC* 
+   CCmConnectionMethodInfo::GetConnectionInfoStringL( const TUint32 aIapId, 
+                                                      const TUint32 aAttribute )
+    {
+    CCmPluginBase* plugin = CmMgr().GetConnectionMethodL( aIapId );
+    CleanupStack::PushL( plugin );
+    
+    if ( !plugin ) 
+        {
+        User::Leave( KErrNotFound );
+        }
+
+    ResetAndLoadL( aIapId );
+
+    HBufC* info = plugin->GetStringAttributeL( aAttribute );
+    CleanupStack::PopAndDestroy( plugin );
+    
+    return info;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmConnectionMethodInfo::GetConnectionInfoStringL
+// ---------------------------------------------------------------------------
+//
+HBufC8* CCmConnectionMethodInfo::GetConnectionInfoString8L( 
+                                                     const TUint32 aIapId, 
+                                                     const TUint32 aAttribute )
+    {
+    CCmPluginBase* plugin = CmMgr().GetConnectionMethodL( aIapId );
+    CleanupStack::PushL( plugin );
+    
+    if ( !plugin ) 
+        {
+        User::Leave( KErrNotFound );
+        }
+
+    ResetAndLoadL( aIapId );
+
+    HBufC8* info = plugin->GetString8AttributeL( aAttribute );
+    CleanupStack::PopAndDestroy( plugin );
+    
+    return info;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmConnectionMethodInfo::RunSettingsL
+// ---------------------------------------------------------------------------
+//
+TInt CCmConnectionMethodInfo::RunSettingsL()
+    {
+    User::Leave( KErrNotSupported );
+    return KErrNotSupported;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmConnectionMethodInfo::InitializeWithUiL
+// ---------------------------------------------------------------------------
+//
+TBool CCmConnectionMethodInfo::InitializeWithUiL( TBool /*aManuallyConfigure*/ )
+    {
+    User::Leave( KErrNotSupported );
+
+    return ETrue;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmConnectionMethodInfo::CanHandleIapIdL
+// ---------------------------------------------------------------------------
+//
+TBool CCmConnectionMethodInfo::CanHandleIapIdL( TUint32 /*aIapId*/ ) const
+    {
+    User::Leave( KErrNotSupported );
+    
+    return EFalse;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmConnectionMethodInfo::CanHandleIapIdL
+// ---------------------------------------------------------------------------
+//
+TBool CCmConnectionMethodInfo::CanHandleIapIdL( 
+                                            CCDIAPRecord* /*aIapRecord*/ ) const
+    {
+    User::Leave( KErrNotSupported );
+    
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmConnectionMethodInfo::ServiceRecordIdLC
+// ---------------------------------------------------------------------------
+//
+void CCmConnectionMethodInfo::ServiceRecordIdLC( HBufC* &/*aBearerName*/, 
+                                         TUint32& /*aRecordId*/ )
+    {
+    User::Leave( KErrNotSupported );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmConnectionMethodInfo::BearerRecordIdLC
+// ---------------------------------------------------------------------------
+//
+void CCmConnectionMethodInfo::BearerRecordIdLC( HBufC* &/*aBearerName*/, 
+                                         TUint32& /*aRecordId*/ )
+    {
+    User::Leave( KErrNotSupported );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmConnectionMethodInfo::CreateNewServiceRecordL
+// ---------------------------------------------------------------------------
+//
+void CCmConnectionMethodInfo::CreateNewServiceRecordL()
+    {
+    User::Leave( KErrNotSupported );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmConnectionMethodInfo::ResetAndLoadL
+// ---------------------------------------------------------------------------
+//
+void CCmConnectionMethodInfo::ResetAndLoadL( TUint32 aIapId )
+    {
+    if( iIapId != aIapId )
+        {
+        Reset();
+        LoadL( aIapId );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmConnectionMethodInfo::CopyAdditionalDataL
+// ---------------------------------------------------------------------------
+//
+void CCmConnectionMethodInfo::CopyAdditionalDataL( CCmPluginBaseEng* /*aDestInst*/ )
+    {
+    User::Leave( KErrNotSupported );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmConnectionMethodInfo::CreateInstanceL
+// ---------------------------------------------------------------------------
+//
+CCmPluginBaseEng* CCmConnectionMethodInfo::
+                CreateInstanceL( TCmPluginInitParam& /*aInitParam*/ ) const
+    {
+    User::Leave( KErrNotSupported );
+    
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmConnectionMethodInfo::CreateCopyL
+// ---------------------------------------------------------------------------
+//
+CCmPluginBaseEng* CCmConnectionMethodInfo::CreateCopyL() const
+    {
+    User::Leave( KErrNotSupported );
+    
+    return NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmConnectionMethodInfo::ResetIfInMemory
+// ---------------------------------------------------------------------------
+//
+void CCmConnectionMethodInfo::ResetIfInMemory( CCmPluginBaseEng* aCM )
+    {
+    TUint32 cmId = 0;
+    TRAPD( err, cmId = aCM->GetIntAttributeL( CMManager::ECmId ) );
+    if ( KErrNone == err )
+        {
+        if( cmId > 0 && iIapId == cmId )
+            {
+            Reset();
+            TRAP_IGNORE( LoadL( cmId ) );
+            }
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Src/cmconnselectrbpage.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,403 @@
+/*
+* 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 plugin base class
+*
+*/
+
+
+#include <cmmanager.rsg>
+#include <StringLoader.h>
+
+#include "cmconnselectrbpage.h"
+#include "cmmanager.hrh"
+#include "cmconnsettingsuiimpl.h"
+#include "cmlogger.h"
+
+using namespace CMManager;
+
+// ---------------------------------------------------------------------------
+// CCMConnSelectRBPage::CCMConnSelectRBPage
+// ---------------------------------------------------------------------------
+//
+CCMConnSelectRBPage::CCMConnSelectRBPage( TInt aDialogResourceId, 
+                                    TInt& aCurrentSelectionIndex, 
+                                    const MDesCArray* aItemArray, 
+                                    CCmManagerImpl& aCmManagerImpl, 
+                                    TCmDCSettingSelectionMode& aSelectionMode,
+                                    RArray<TUint32>& aDestinations,
+                                    TBool areDestinations,
+                                    TBool aOpenDestination,
+                                    TCoeContextName& aContext )
+    : CAknRadioButtonSettingPage( aDialogResourceId, 
+                                  aCurrentSelectionIndex, 
+                                  aItemArray )
+	, iDialogResourceId (aDialogResourceId)
+    , iCmManagerImpl( aCmManagerImpl )
+    , iSelectionMode( aSelectionMode )
+    , iDestinations( aDestinations )
+    , iAreDestinations( areDestinations )
+    , iOpenDestination( aOpenDestination )
+    , iHelpContext ( aContext )
+    {
+    CLOG_CREATE;
+    iPrevItem = iDestinations[aCurrentSelectionIndex];
+    }
+
+// ---------------------------------------------------------------------------
+// CCMConnSelectRBPage::~CCMConnSelectRBPage
+// ---------------------------------------------------------------------------
+//
+CCMConnSelectRBPage::~CCMConnSelectRBPage()
+    {
+    CLOG_CLOSE;    
+    }
+
+// ---------------------------------------------------------------------------
+// CCMConnSelectRBPage::OkToExitL
+// Good to know : EAknSoftkeyCancel is never called, because
+// EEikDialogFlagNotifyEsc flag is not set in the resource.
+// ---------------------------------------------------------------------------
+//
+TBool CCMConnSelectRBPage::OkToExitL( TInt aButtonId )
+    {
+    LOGGER_ENTERFN("CCMConnSelectRBPage::OkToExitL");
+
+    // Convert the button presses into commands for the appui & current
+    // view to handle
+    TBool retval( EFalse );
+    if ( aButtonId ==  EAknSoftkeyOk )
+        {
+        ProcessCommandL( ECmManagerUiCmdDestSelect );
+        retval = ETrue;        
+        }
+    else 
+        {
+        if ( aButtonId == EAknSoftkeyOptions )
+            {
+            //*iSelected = iListbox->CurrentItemUid();
+            //retval = ETrue;
+            DisplayMenuL();
+            retval = EFalse;  
+            }
+        else
+            {
+           	retval = ETrue;
+            }
+        }
+
+    return retval;
+    }
+
+// ---------------------------------------------------------------------------
+// CCMConnSelectRBPage::ProcessCommandL
+// ---------------------------------------------------------------------------
+//
+void CCMConnSelectRBPage::ProcessCommandL( TInt aCommandId )
+    {
+    LOGGER_ENTERFN("CCMConnSelectRBPage::ProcessCommandL");
+    
+    if ( MenuShowing() )
+        {
+        HideMenu();
+        }
+
+    switch ( aCommandId )
+        {
+        case EAknSoftkeyOptions:
+            {
+            DisplayMenuL();
+            break;
+            }
+
+        case EAknSoftkeyCancel:
+            {
+            AttemptExitL(EFalse);   
+            break;
+            }
+
+        case EAknSoftkeyOk:                   
+        case EAknSoftkeySelect:                   
+        case ECmManagerUiCmdDestSelect:
+            {
+            TUint selectedItem = 
+                    iDestinations[ ListBoxControl()->CurrentItemIndex() ];
+            if ( selectedItem == KDestItemAlwaysAsk )
+                {
+                iSelectionMode = EDCAlwaysAsk;
+                }
+            else if ( selectedItem == KDestItemAskOnce )
+                {
+                iSelectionMode = EDCAskOnce;
+                }
+            else if ( selectedItem == KDestItemDefaultConnection )
+                {
+                iSelectionMode = EDCDefaultConnection;
+                }
+            else if ( selectedItem == KDestItemUncategorized )
+                {
+                iSelectionMode = EDCConnectionMethod;
+                }
+            else 
+                {
+                if (iAreDestinations)
+                    {
+                    iSelectionMode = EDCDestination;
+                    }
+                else
+                    {
+                    iSelectionMode = EDCConnectionMethod;                        
+                    }    
+                }
+            //iId is to be defined in the caller class   
+            SelectCurrentItemL();         
+            AttemptExitL(ETrue);
+            break;
+            }
+
+        case ECmManagerUiCmdCMSelect:
+            {
+            iSelectionMode = EDCConnectionMethod;
+            SelectCurrentItemL();         
+            AttemptExitL( ETrue );                   
+            break;
+            }
+        case EAknCmdHelp:
+            {
+            HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(),
+                                    iEikonEnv->EikAppUi()->AppHelpContextL() );
+            }
+            break;
+        default:
+            {
+            break;
+            }
+        }
+    }    
+
+// ---------------------------------------------------------------------------
+// CCMConnSelectRBPage::DynInitMenuPaneL
+// ---------------------------------------------------------------------------
+//
+void CCMConnSelectRBPage::DynInitMenuPaneL( TInt aResourceId,
+                                         CEikMenuPane* aMenuPane )
+    {
+    LOGGER_ENTERFN("CCMConnSelectRBPage::DynInitMenuPaneL");
+
+    CAknSettingPage::DynInitMenuPaneL( aResourceId, aMenuPane );
+    if ( aResourceId == R_SELECT_NETW_CONN_MENU )
+        {
+    	if (!iCmManagerImpl.IsHelpOn())
+            {
+            aMenuPane->DeleteMenuItem( EAknCmdHelp );		    
+            }
+        TUint32 currentItem = 
+                    iDestinations[ ListBoxControl()->CurrentItemIndex() ];
+        
+        // Always Ask ( always the first item )
+        if ( (currentItem == KDestItemAlwaysAsk) || 
+             (currentItem == KDestItemAskOnce) || 
+             (currentItem == KDestItemDefaultConnection) ||
+              !iOpenDestination )
+            {
+            aMenuPane->SetItemDimmed( ECmManagerUiCmdCMSelect, ETrue );
+            }        
+        else if ( ( currentItem != KDestItemAlwaysAsk ) && 
+                  ( currentItem != KDestItemAskOnce ) && 
+                  ( currentItem != KDestItemDefaultConnection ) &&
+                  ( currentItem != KDestItemUncategorized ))
+            {
+            CCmDestinationImpl* destImpl = iCmManagerImpl.DestinationL( currentItem );
+            
+            if ( !destImpl->ConnectionMethodCount() )
+                {
+                aMenuPane->SetItemDimmed( ECmManagerUiCmdCMSelect, ETrue );                
+                }
+                
+            delete destImpl;
+            }
+        else
+            {
+            RArray<TUint32> uncatArray( KCmArraySmallGranularity );
+            CleanupClosePushL( uncatArray );
+            iCmManagerImpl.ConnectionMethodL( uncatArray );
+            
+            // Uncategorised - cannot be selected
+            if ( currentItem == KDestItemUncategorized )
+                {
+                aMenuPane->SetItemDimmed( ECmManagerUiCmdDestSelect, ETrue );
+                }
+            CleanupStack::PopAndDestroy( &uncatArray );
+            }
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCMConnSelectRBPage::OfferKeyEventL
+// ---------------------------------------------------------------------------
+//
+TKeyResponse CCMConnSelectRBPage::OfferKeyEventL( const TKeyEvent& aKeyEvent, 
+                                               TEventCode aType )    
+    {
+    LOGGER_ENTERFN("CCMConnSelectRBPage::OfferKeyEventL");
+    
+    TKeyResponse retVal ( EKeyWasNotConsumed );
+    // save for the future use
+    iPrevItem = iDestinations[ListBoxControl()->CurrentItemIndex()];
+    
+    switch ( aKeyEvent.iScanCode )
+        {
+        case EStdKeyDownArrow:
+        case EStdKeyUpArrow:
+            {
+            if ( iOpenDestination ) //only if we are on 'destination level' and we are able to
+                //open destinations
+                {            
+                // If focus is on the 'uncategorised' destination, 
+                // change the soft key to 'Open'
+                if ( iDestinations[ ListBoxControl()->CurrentItemIndex() ] == 
+                                                        KDestItemUncategorized )
+                    {
+                    HBufC* text = StringLoader::LoadLC( R_QTN_MSK_OPEN );
+                    Cba()->SetCommandL( EAknSoftkeySelect, *text );
+                    Cba()->DrawNow();
+                    CleanupStack::PopAndDestroy( text );                
+                    }
+                else
+                    {
+                    HBufC* text = StringLoader::LoadLC( R_QTN_MSK_SELECT );
+                    Cba()->SetCommandL( EAknSoftkeySelect, *text );
+                    Cba()->DrawNow();
+                    CleanupStack::PopAndDestroy( text );
+                    }
+                }
+            break;
+            }
+        default:
+            {
+            break;
+            }
+        }
+    retVal = CAknRadioButtonSettingPage::OfferKeyEventL( aKeyEvent, aType );
+    
+    return retVal;
+    }
+
+// --------------------------------------------------------------------------
+// CCMConnSelectRBPage::GetHelpContext
+// --------------------------------------------------------------------------
+//
+void CCMConnSelectRBPage::GetHelpContext( TCoeHelpContext& aContext ) const
+    {
+    LOGGER_ENTERFN("CCMConnSelectRBPage::GetHelpContext");
+        
+    aContext.iMajor = KHelpUidPlugin;
+    aContext.iContext = iHelpContext; 
+    }
+
+// ---------------------------------------------------------------------------
+// CCMConnSelectRBPage::HandleListBoxEventL
+// ---------------------------------------------------------------------------
+//
+void CCMConnSelectRBPage::HandleListBoxEventL(CEikListBox* aListBox, 
+		MEikListBoxObserver::TListBoxEvent aEventType)
+	{
+    LOGGER_ENTERFN("CCMConnSelectRBPage::HandleListBoxEventL");
+        
+    if ( AknLayoutUtils::PenEnabled() )
+        {
+
+		if (iDialogResourceId == R_RADIO_BUTTON_SETTING_PAGE_OK_CANCEL)
+			{
+			// Call base class implementation and return if no options menu
+			CAknRadioButtonSettingPage::HandleListBoxEventL(aListBox, aEventType);
+		
+	    	switch ( aEventType )
+    	    	{
+        		case EEventEnterKeyPressed:
+        		case EEventItemDoubleClicked:
+				case EEventItemClicked:        	
+            		{
+            		ProcessCommandL(ECmManagerUiCmdDestSelect);
+            		break;
+            		}
+
+        		default:
+	            	{
+    	        	break;
+            		}
+        		}
+			return;
+			}
+		
+        switch ( aEventType )
+            {
+            // All these actions are activating the listbox item
+            case MEikListBoxObserver::EEventEnterKeyPressed:
+            case MEikListBoxObserver::EEventItemActioned:
+                CAknRadioButtonSettingPage::HandleListBoxEventL(aListBox, aEventType);
+                break;
+
+            case MEikListBoxObserver::EEventItemClicked:
+            case MEikListBoxObserver::EEventItemSingleClicked:
+                if (iPrevItem == iDestinations[ListBoxControl()->CurrentItemIndex()])
+                    {
+                    ProcessCommandL(ECmManagerUiCmdDestSelect);
+                    }
+                else
+                    {
+                    // save for the later use
+                    iPrevItem = iDestinations[ListBoxControl()->CurrentItemIndex()];
+					    
+		            if ( iOpenDestination ) //only if we are on 'destination level' and we are able to
+        		        //open destinations
+                		{            
+                		// If focus is on the 'uncategorised' destination, 
+                		// change the soft key to 'Open'
+                		if ( iDestinations[ ListBoxControl()->CurrentItemIndex() ] == 
+		                                                        KDestItemUncategorized )
+        		            {
+                		    HBufC* text = StringLoader::LoadLC( R_QTN_MSK_OPEN );
+                    		Cba()->SetCommandL( EAknSoftkeySelect, *text );
+                    		Cba()->DrawNow();
+                    		CleanupStack::PopAndDestroy( text );                
+                    		}
+                		else
+                    		{
+                    		HBufC* text = StringLoader::LoadLC( R_QTN_MSK_SELECT );
+                    		Cba()->SetCommandL( EAknSoftkeySelect, *text );
+                    		Cba()->DrawNow();
+                    		CleanupStack::PopAndDestroy( text );
+                    		}
+                		}
+		            CAknRadioButtonSettingPage::HandleListBoxEventL(aListBox, aEventType);
+                	}
+                break;
+                
+            case MEikListBoxObserver::EEventItemDoubleClicked:
+                ProcessCommandL(ECmManagerUiCmdDestSelect);
+                break;
+
+            default:
+                CAknRadioButtonSettingPage::HandleListBoxEventL(aListBox, aEventType);            
+                break;
+            }
+        }
+    else
+        {
+        CAknRadioButtonSettingPage::HandleListBoxEventL(aListBox, aEventType);
+		}		
+	}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Src/cmconnsettingsuiimpl.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,1156 @@
+/*
+* 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 application setting UI.
+*
+*/
+
+#include <coemain.h>
+#include <featmgr.h>
+#include <data_caging_path_literals.hrh>
+#include <StringLoader.h>
+#include <cmmanager.rsg>
+#include <AknsUtils.h>
+#include <ConnectionUiUtilities.h>
+
+
+#include <cmcommonconstants.h>
+#include "cmapplicationsettingsui.h"
+#include <cmmanager.h>
+#include "cmmanagerimpl.h"
+#include "cmdestinationimpl.h"
+#include "cmmanagerimpl.h"
+#include <cmpluginbaseeng.h>
+#include <cmpluginbase.h>
+#include "cmconnsettingsuiimpl.h"
+#include "cmconnselectrbpage.h"
+
+using namespace CMManager;
+
+typedef struct
+    {
+    TInt                iCmIapId;
+    TInt                iCmDefaultPriority;
+    }TCmListItem;
+
+//---------------------------------------------------------------------------
+//  CCmConnSettingsUiImpl::NewL
+//---------------------------------------------------------------------------
+//
+EXPORT_C CCmConnSettingsUiImpl* CCmConnSettingsUiImpl::NewL( CCmManagerImpl* aCCmManagerImpl )
+    {
+    CCmConnSettingsUiImpl* self = 
+                                new (ELeave) CCmConnSettingsUiImpl();
+    CleanupStack::PushL( self );
+    self->ConstructL( aCCmManagerImpl );
+    CleanupStack::Pop( self );   // self
+    return self;
+    }
+    
+//---------------------------------------------------------------------------
+//  CCmConnSettingsUiImpl::NewL
+//---------------------------------------------------------------------------
+//
+CCmConnSettingsUiImpl* CCmConnSettingsUiImpl::NewWithoutTablesL()
+    {
+    CCmConnSettingsUiImpl* self = 
+                                new (ELeave) CCmConnSettingsUiImpl();
+    CleanupStack::PushL( self );
+    self->iCreateTables = EFalse;
+    self->ConstructL( NULL );
+    CleanupStack::Pop( self );   // self
+    return self;
+    }    
+
+//---------------------------------------------------------------------------
+//  CCmConnSettingsUiImpl::TCmDCSettingSelection
+//---------------------------------------------------------------------------
+//
+CCmConnSettingsUiImpl::CCmConnSettingsUiImpl()
+    : iResourceReader( *CCoeEnv::Static() )
+    , iAreDestinations ( ETrue )
+    , iShowAlwaysAsk( EFalse )
+    , iShowEasyWlan( EFalse )
+    , iShowVirtualCMs( ETrue )
+    , iShowEmptyDestinations( EFalse )
+    , iShowAskOnce( EFalse )
+    , iShowUncat( EFalse )
+    , iShowDefConn( EFalse )
+    , iUsePassedDestinationArray( EFalse )
+    , iHelpContext ( KSET_HLP_APP_DEST_ASSOC_VIEW )
+    , iCreateTables( ETrue )
+    {
+    }
+
+//---------------------------------------------------------------------------
+//  CCmConnSettingsUiImpl::~TCmDCSettingSelection
+//---------------------------------------------------------------------------
+//
+CCmConnSettingsUiImpl::~CCmConnSettingsUiImpl()
+    {
+    if ( iOwnCmManager )
+        {
+        delete iCmManagerImpl;
+        }    
+    iResourceReader.Close();
+    iItems.Close();
+    iPassedDestinations.Close();
+    }
+
+//---------------------------------------------------------------------------
+// CCmConnSettingsUiImpl::LoadResourceL
+// Load the resource for the dll module
+//---------------------------------------------------------------------------
+//
+TInt CCmConnSettingsUiImpl::LoadResourceL ()
+    {    
+    // Add resource file.
+    TParse* fp = new(ELeave) TParse(); 
+    TInt err = fp->Set( KACMManagerResDirAndFileName, 
+                        &KDC_RESOURCE_FILES_DIR, 
+                        NULL ); 
+    if ( err != KErrNone)
+        {
+        User::Leave( err );
+        }   
+
+    TFileName resourceFileNameBuf = fp->FullName();
+    delete fp;
+
+    iResourceReader.OpenL( resourceFileNameBuf );
+    return err;
+    }
+
+//---------------------------------------------------------------------------
+//  CCmConnSettingsUiImpl::ConstructL()
+//---------------------------------------------------------------------------
+//
+void CCmConnSettingsUiImpl::ConstructL( CCmManagerImpl* aCCmManagerImpl )
+    {
+    iOwnCmManager = !(aCCmManagerImpl);
+    if ( iOwnCmManager )
+        {
+        if (iCreateTables)
+            {
+            iCmManagerImpl = CCmManagerImpl::NewL();            
+            }
+        else
+            {
+            iCmManagerImpl = CCmManagerImpl::NewL(EFalse);                            
+            }
+        }
+    else
+        {
+        iCmManagerImpl = aCCmManagerImpl;
+        }
+    LoadResourceL();
+    AknsUtils::SetAvkonSkinEnabledL( ETrue );
+    }
+
+//---------------------------------------------------------------------------
+// CCmConnSettingsUiImpl::ShowConnSelectRadioPageL
+//---------------------------------------------------------------------------
+//
+TBool CCmConnSettingsUiImpl::ShowConnSelectRadioPageL( 
+                                           TCmDCSettingSelection& aSelection, 
+                                           const TInt aTitleStringResource,
+                                           TBearerFilterArray& aFilterArray )
+    {
+    TBool retVal( EFalse );
+//    aSelection.iResult = EDCAlwaysAsk;
+
+    CDesCArrayFlat* items = 
+                    new ( ELeave ) CDesCArrayFlat( KCmArrayBigGranularity );
+    CleanupStack::PushL( items );
+    
+    if (iAreDestinations)
+        {
+        BuildDestinationArrayL( items, aFilterArray );        
+        }
+    else    
+        {
+        BuildCMArrayL( items, aFilterArray ); 
+               
+        }
+    // Uncategorized connection methods
+    RPointerArray<CCmPluginBase> uncatArray( KCmArraySmallGranularity );
+    CCmManagerImpl::CleanupResetAndDestroyPushL< RPointerArray<CCmPluginBase> >( uncatArray );
+    if ( iShowUncat )
+        {
+        BuildUncatArrayL( uncatArray, items,
+                    aFilterArray);
+        }
+    //appending items in reverse order of priority    
+    // Check if Ask Once should be shown 
+    if ( iShowAskOnce )
+        {
+        HBufC* buf = StringLoader::LoadLC( R_CMMANAGERUI_SETT_ASK_ONCE );
+        items->InsertL( 0, *buf );
+        iItems.InsertL( KDestItemAskOnce, 0 );
+        CleanupStack::PopAndDestroy( buf );    
+        }
+
+    // Check if Always Ask should be shown
+    if ( iShowAlwaysAsk )
+        {
+        HBufC* buf = StringLoader::LoadLC( R_CMMANAGERUI_SETT_ALWAYS_ASK );
+        items->InsertL( 0, *buf );
+        iItems.InsertL( KDestItemAlwaysAsk, 0 );
+        CleanupStack::PopAndDestroy( buf );    
+        }
+    // Check if Default Connection should be shown 
+    //feautre flag
+    if ( iCmManagerImpl->IsDefConnSupported() )
+        {
+        //client's selection
+        if ( iShowDefConn )
+            {
+            HBufC* buf = StringLoader::LoadLC( R_CMMANAGERUI_SETT_DEFAULT_CONNECTION );
+            items->InsertL( 0, *buf );
+            iItems.InsertL( KDestItemDefaultConnection, 0 );
+            CleanupStack::PopAndDestroy( buf );    
+            } 
+        }
+    if (!items->Count())
+        {
+        User::Leave(KErrConnectionNotFound);           
+        }
+    
+    TInt listIndex(0);
+    
+    if (iAreDestinations)
+        {
+        switch ( aSelection.iResult )
+                {
+                case EDCDestination:
+                    {
+                    TInt newIndex = iItems.Find(aSelection.iId);
+                    if (newIndex >=0)
+                        {
+                        listIndex = newIndex;
+                        }
+                    break;
+                    }
+                case EDCConnectionMethod:
+                    {
+                    TInt err(KErrNotFound);
+                    CCmPluginBase* cm = NULL;
+                    TRAP( err, cm = iCmManagerImpl->GetConnectionMethodL(aSelection.iId));
+                    if ( err == KErrNone )
+                        {
+                        // connection method is valid
+                        CleanupStack::PushL( cm );
+                        TUint32 parentId = 0;
+                        CCmDestinationImpl* parent = cm->ParentDestination();
+                        if (parent)
+                            {
+                            // it has a parent, get it's id
+                            parentId = parent->Id();
+                            delete parent;
+                            }
+                        else
+                            {
+                            // no parent means Uncategorised
+                            parentId = KDestItemUncategorized;
+                            }
+                        // get the index based on id    
+                        TInt tempIndex = iItems.Find( parentId );
+                        if ( tempIndex != KErrNotFound )
+                            {
+                            // found destination id in list
+                            listIndex = tempIndex;
+                            }                            
+                        CleanupStack::PopAndDestroy( cm );
+                        }
+                    break;
+                    }
+                case EDCDefaultConnection:
+                    {
+                    TInt newIndex = iItems.Find(KDestItemDefaultConnection);
+                    if (newIndex >=0)
+                        {
+                        listIndex = newIndex;
+                        }
+                    break;
+                    }
+                case EDCAlwaysAsk:
+                    {
+                    TInt newIndex = iItems.Find(KDestItemAlwaysAsk);
+                    if (newIndex >=0)
+                        {
+                        listIndex = newIndex;
+                        }
+                    break;
+                    }
+                case EDCAskOnce:
+                    {
+                    TInt newIndex = iItems.Find(KDestItemAskOnce);
+                    if (newIndex >=0)
+                        {
+                        listIndex = newIndex;
+                        }
+                    break;
+                    }                
+                default: // use default value (0)
+                    {
+                    break;
+                    }                            
+                }
+            }
+         else
+            {
+            if (aSelection.iResult == EDCConnectionMethod)
+                {
+                TInt newIndex = iItems.Find(aSelection.iId);
+                if (newIndex >=0)
+                    {
+                    listIndex = newIndex;
+                    }
+                }
+            }
+    
+    
+    if ( UserSelectionDlgL( listIndex, items, aSelection, 
+                            aTitleStringResource,
+                            iOpenDestination) )
+        {
+        // Handle selection
+        
+        switch ( aSelection.iResult )
+            {
+            case EDCConnectionMethod:
+                {
+                // from the first list?
+                if (!iAreDestinations)
+                    {
+                    aSelection.iId = iItems[listIndex];
+                    retVal = ETrue;                    
+                    }
+                else
+                    {
+                    // Uncategorised?
+                    TUint32 destId = iItems[ listIndex ];
+                    if ( destId == KDestItemUncategorized )
+                        {
+                        TBearerFilterArray emptyFilter;
+                        retVal = ShowConnectionMethodsL( uncatArray, 
+                                        aSelection, aTitleStringResource, emptyFilter );
+                        }
+                    else
+                        {
+                        RPointerArray<CCmPluginBase> cmArray ( KCmArrayMediumGranularity );
+                        if ( iShowVirtualCMs ) //create a flat list to show cms in embedded destinations
+                            {
+                            iCmManagerImpl->CreateFlatCMListLC( destId, cmArray);
+                            }
+                         else
+                            {
+                            //append only the cms in the destination
+                            iCmManagerImpl->AppendCmListLC( destId, cmArray ); 
+                            }
+                        retVal = ShowConnectionMethodsL( cmArray, 
+                                        aSelection, aTitleStringResource,
+                                        aFilterArray );
+                        CleanupStack::PopAndDestroy( &cmArray );
+                        }                    
+                    }
+                break;
+                }
+            case EDCDestination:
+                {
+                // Store the destination Id
+                aSelection.iId = iItems[listIndex];
+                retVal = ETrue;
+                break;
+                }
+            case EDCAlwaysAsk:
+                {
+                // nothing more to do
+                retVal = ETrue;
+                break;
+                }        
+            case EDCDefaultConnection:
+                {
+                // nothing more to do
+                retVal = ETrue;
+                break;
+                }            
+            case EDCAskOnce:
+                {
+                // nothing more to do
+                retVal = ETrue;
+                break;
+                }            
+            default:
+                {
+                break;
+                }
+            }
+        }
+
+    CleanupStack::PopAndDestroy( &uncatArray );
+    CleanupStack::PopAndDestroy( items );
+
+    return retVal;
+    }
+
+
+//---------------------------------------------------------------------------
+//  CCmConnSettingsUiImpl::RunSettingsL()
+//---------------------------------------------------------------------------
+//
+EXPORT_C TBool CCmConnSettingsUiImpl::RunApplicationSettingsL( 
+                                        TCmSettingSelection& aSelection, 
+                                        TUint aListItems,
+                                        TBearerFilterArray& aFilterArray)
+    {
+    iItems.Close();
+    iAreDestinations = ETrue;
+    if (!aListItems)
+        {
+        User::Leave(KErrArgument);        
+        }
+    if ( !iCmManagerImpl->IsDefConnSupported() &&
+         !(aListItems & EShowAlwaysAsk) &&  
+         !(aListItems & EShowConnectionMethods) &&  
+         !(aListItems & EShowDestinations) 
+         )
+        {
+        // default conn would be the only one but not supported
+        User::Leave(KErrNotSupported);   
+        }
+
+    if ( aListItems & EShowDefaultConnection )
+        {
+        EnableDefConn( ETrue );        
+        }
+    else
+        {
+        EnableDefConn( EFalse );                
+        }
+    if (aListItems & EShowAlwaysAsk)
+        {
+        EnableAlwaysAsk( ETrue );
+        }
+    else
+        {
+        EnableAlwaysAsk( EFalse );
+        }
+    if ( (aListItems & EShowConnectionMethods) && (aListItems & EShowDestinations) )
+        {
+        iOpenDestination = ETrue;
+        iShowUncat = ETrue;
+        }
+    else
+        {
+        iOpenDestination = EFalse;
+        }
+    if ( (aListItems & EShowConnectionMethods) && !(aListItems & EShowDestinations) )
+        {
+        iAreDestinations = EFalse;
+        GetCMArrayL( );            
+        }
+    else if ( aListItems & EShowDestinations )
+        {
+        if (iUsePassedDestinationArray)
+            {
+            // now fill up iItems
+            for( TInt i=0; i<iPassedDestinations.Count(); i++)
+                {
+                iItems.Append(iPassedDestinations[i]);
+                }
+            }
+        else
+            {
+            iCmManagerImpl->AllDestinationsL( iItems );
+            TInt i( 0 );
+            TInt count = iItems.Count();
+            for ( i=0; i < count; i++ )
+                {
+                if ( iItems[i] > 0 && iItems[i] < 255 )
+                    {
+                    CCmDestinationImpl* dest = 
+        	                            iCmManagerImpl->DestinationL( iItems[i] );
+                    CleanupStack::PushL( dest );
+        	        if ( dest->IsHidden() )
+                        {
+                        iItems.Remove(i);
+                        i--;
+                        count = count-1;
+                        }
+                    CleanupStack::PopAndDestroy();
+                    }
+                }
+            iItems.Compress();
+            }
+        }
+
+    TBool ret = EFalse;
+    TCmDCSettingSelection userDefSelection;
+
+    // convert selection
+    switch ( aSelection.iResult )
+        {
+        case EDestination: 
+            {
+            userDefSelection.iResult = EDCDestination; 
+            userDefSelection.iId = aSelection.iId;        
+            break;
+            }
+            
+        case EConnectionMethod: 
+            {
+            userDefSelection.iResult = EDCConnectionMethod; 
+            userDefSelection.iId = aSelection.iId;        
+            break;
+            }
+
+        case EDefaultConnection: 
+            {
+            userDefSelection.iResult = EDCDefaultConnection; 
+            userDefSelection.iId = 0;
+            break;
+            }
+
+        case EAlwaysAsk: 
+            {
+            userDefSelection.iResult = EDCAlwaysAsk; 
+            userDefSelection.iId = 0;
+            break;
+            }
+
+        default: 
+            {
+            // do not leave, perhaps there was no default selection
+            }                            
+        }
+    
+    
+    
+    if ( ShowConnSelectRadioPageL( userDefSelection, 
+            R_CMMANAGERUI_SETT_DESTINATION , aFilterArray))
+        {
+        switch ( userDefSelection.iResult )
+            {
+            case EDCDestination:
+                {
+                aSelection.iResult = EDestination;
+                aSelection.iId = userDefSelection.iId;
+                break;
+                }
+            case EDCConnectionMethod:
+                {
+                aSelection.iResult = EConnectionMethod;
+                aSelection.iId = userDefSelection.iId;
+                break;
+                }
+            case EDCDefaultConnection:
+                {
+                aSelection.iResult = EDefaultConnection;
+                aSelection.iId = 0;
+                break;
+                }
+            case EDCAlwaysAsk:
+                {
+                aSelection.iResult = EAlwaysAsk;
+                aSelection.iId = 0;
+                break;
+                }
+            default: //should not ever get here, unhandled branch
+                {
+                User::Leave( KErrGeneral );
+                break;
+                }                            
+            }
+        ret = ETrue;
+        }
+    else
+        {
+        ret = EFalse;
+        }
+    return ret;        
+    }    
+
+    
+//---------------------------------------------------------------------------
+//  CCmConnSettingsUiImpl::RunDefaultConnecitonRBPageL()
+//---------------------------------------------------------------------------
+//
+TBool CCmConnSettingsUiImpl::RunDefaultConnecitonRBPageL( 
+                                          TCmDCSettingSelection& aSelection )
+    {
+    iHelpContext = KSET_HLP_DEFAULT_CONN;
+    iItems.Close();
+    iOpenDestination = ETrue;
+    iCmManagerImpl->AllDestinationsL( iItems );
+    EnableAlwaysAsk( EFalse );
+    EnableAskOnce( EFalse );
+    EnableUncat( EFalse );
+    TBearerFilterArray aFilterArray;
+    iAreDestinations = ETrue;
+    iShowEmptyDestinations = ETrue;
+    return  ShowConnSelectRadioPageL( aSelection , 
+        R_CMMANAGERUI_DEFAULT_CONNECTION_TITLE, aFilterArray );
+    }
+//---------------------------------------------------------------------------
+//  CCmConnSettingsUiImpl::GetCMArrayL()
+//---------------------------------------------------------------------------
+//
+void CCmConnSettingsUiImpl::GetCMArrayL( )
+    {
+    iCmManagerImpl->ConnectionMethodL( iItems, ETrue, EFalse,EFalse, ETrue );
+    TInt count = iItems.Count();
+
+    if ( !iShowVirtualCMs )
+        {
+        // Don't show virtual CMs
+        for ( TInt i = 0; i < count; i++ )
+            {
+            if ( IsCmVirtualL( iItems[i] ) )
+                {
+                iItems.Remove( i );
+                count--;
+                i--;
+                }
+            }
+        }
+    }
+
+//---------------------------------------------------------------------------
+//  CCmConnSettingsUiImpl::BuildCMArrayL()
+//---------------------------------------------------------------------------
+//
+void CCmConnSettingsUiImpl::BuildCMArrayL( CDesCArrayFlat* aItems, 
+                                           TBearerFilterArray& aFilterArray )
+    {
+    // Add the New Connection Item        
+    for ( TInt i = 0; i < iItems.Count(); i++ )
+        {
+        CCmPluginBase* cm = NULL;
+        TInt err(KErrNone);
+        TRAP( err, cm = iCmManagerImpl->GetConnectionMethodL(iItems[i]));
+        if (err == KErrNoMemory)
+        {
+            User::Leave(KErrNoMemory);
+        }
+        else if (err != KErrNone)
+        {
+            continue;
+        }                            
+        CleanupStack::PushL( cm );
+        if (aFilterArray.Count())
+            {
+            TUint cmBearerType = cm->GetIntAttributeL( ECmBearerType );
+            if ( aFilterArray.Find( cmBearerType ) == KErrNotFound )
+                {
+                CleanupStack::PopAndDestroy( cm );            
+                iItems.Remove(i);
+                i--;
+                continue;    
+                }
+            }
+        // CM Iap Id
+        TUint32 cmId = cm->GetIntAttributeL( ECmId );
+                                
+        // Should virtual bearer types be shown?
+        if ( iShowVirtualCMs || !IsCmVirtualL( cmId ) )
+            {
+            // CM name
+            HBufC* cmName = cm->GetStringAttributeL( ECmName );
+            CleanupStack::PushL( cmName );
+            // embedded destination has a special text format
+            aItems->AppendL( *cmName );
+            CleanupStack::PopAndDestroy( cmName );
+            }
+        CleanupStack::PopAndDestroy( cm );            
+        }
+    }
+
+//---------------------------------------------------------------------------
+//  CCmConnSettingsUiImpl::BuildDestinationArray()
+//---------------------------------------------------------------------------
+//
+void CCmConnSettingsUiImpl::BuildDestinationArrayL( CDesCArrayFlat* aItems, 
+                                         TBearerFilterArray& aFilterArray )
+    {
+    /*
+     * The behavior of this function is as follow.
+     * 1. If aFilterArray.Count() == 0 (This just means no filter provided by user) then the function will
+     *    show all of available destinations (if iShowVirtualCMs == ETrue; Otherwise, destination with only
+     *    virtualCMs will be filted out) (default).
+     * 2. If aFilterArray.Count() != 0 then destination with only unavailable bearer-type IAPs will be 
+     *    filted out.
+     */
+    TInt count = iItems.Count();           
+    // Add the New Connection Item
+    for ( TInt i = 0; i < count; i++ )
+        {
+        // Get the destinations from their IDs
+        CCmDestinationImpl* dest = 
+                            iCmManagerImpl->DestinationL( iItems[i] );
+        CleanupStack::PushL( dest );
+
+        TInt cmCount = dest->ConnectionMethodCount();
+        TInt validCmCount = cmCount;
+        
+        if ( !iUsePassedDestinationArray )
+            {
+            // Check if empty destinations should be displayed
+            if ( !iShowVirtualCMs || aFilterArray.Count())
+                {            
+                for ( TInt j = 0; j < cmCount; j++ )
+                    {
+                    CCmPluginBase& cm = *dest->GetConnectionMethodL(j);
+                    // check if this destination only contains virtual CMs
+                    if (!iShowVirtualCMs)// See if the virtual CM (Default in case no filter provided by user)
+                        {
+                        // CM Iap Id
+                        TUint32 cmIapId = cm.GetIntAttributeL( ECmId );                
+                        // real CMs were found
+                        if ( IsCmVirtualL( cmIapId ) )
+                            {
+                            validCmCount--;
+                            continue;
+                            }
+                        // We can not break the loop with else case here
+                        // for cm might be filted out by aFilterArray
+                        }
+                    
+                    if (aFilterArray.Count()) // See if the CM is filtered out
+                        {                       
+                        TUint cmBearerType = cm.GetIntAttributeL( ECmBearerType );
+                        if ( aFilterArray.Find( cmBearerType ) == KErrNotFound )
+                            {
+                            validCmCount--;
+                            }
+                        else
+                            {
+                            break;//there is at least one CM in this dest    
+                            }                    
+                        }
+                    }
+                }
+            }
+        
+        // check if the destination should be omitted
+        // check if empty destinations should be displayed
+        
+        // We can use a destination to make a connection only
+        // if it contains something else than an empty embedded
+        // destination. Otherwise, consider it empty.
+        TBool canUseDestToConnect = dest->CanUseToConnectL();
+        
+        if ( iDestinationToOmit != iItems[i] && 
+                            ( ( validCmCount && canUseDestToConnect )
+                               || iShowEmptyDestinations ) )
+            {
+            // Check whether the MMS SNAP is in question. 
+            // It should not be shown on the UI in the destinations list
+            TInt snapMetadata = 0;
+            TRAPD( metaErr, snapMetadata = dest->MetadataL( CMManager::ESnapMetadataPurpose ));
+            if ( metaErr == KErrNone && snapMetadata == CMManager::ESnapPurposeMMS )
+                {
+                iItems.Remove(i);
+                count--;
+                i--;
+                }
+            else
+                {
+                HBufC* destName = dest->NameLC();
+
+                aItems->AppendL( *destName );
+                CleanupStack::PopAndDestroy( destName );
+                }
+            }
+        else
+            {
+            iItems.Remove(i);
+            count--;
+            i--;
+            }
+            
+        CleanupStack::PopAndDestroy( dest );
+        }
+    }
+    
+//---------------------------------------------------------------------------
+//  CCmConnSettingsUiImpl::BuildUncatArrayL()
+//---------------------------------------------------------------------------
+//
+void CCmConnSettingsUiImpl::BuildUncatArrayL( RPointerArray<CCmPluginBase>& aUncatArray,
+                                           CDesCArrayFlat* aItems, 
+                                           TBearerFilterArray& aFilterArray )
+    {
+    if ( iShowEasyWlan )
+        {
+        // Get the uncategorised CMs including EasyWLAN
+        iCmManagerImpl->AppendUncatCmListL( aUncatArray, ETrue, ETrue, ETrue );
+        }
+    else
+        {
+        iCmManagerImpl->AppendUncatCmListL( aUncatArray );
+        }
+    
+    // Remove hidden Connection Methods
+    for ( TInt i = 0; i < aUncatArray.Count(); i++ )
+        {
+        if ( aUncatArray[i]->GetBoolAttributeL( ECmHidden ) )
+            {
+            delete aUncatArray[i];
+            aUncatArray.Remove(i);
+            i--;
+            }
+        }
+        
+    if (aFilterArray.Count())
+        {
+        for ( TInt i = 0; i < aUncatArray.Count(); i++ )
+            {
+            CCmPluginBase* cm = aUncatArray[i];
+            TUint cmBearerType = cm->GetIntAttributeL( ECmBearerType );
+            if ( aFilterArray.Find( cmBearerType ) == KErrNotFound )
+                {
+                delete aUncatArray[i];
+                aUncatArray.Remove(i);
+                i--;
+                }
+            }
+        }
+    TInt count = aUncatArray.Count();
+
+    if ( !iShowVirtualCMs )
+        {
+        // Don't show virtual CMs
+        for ( TInt i = 0; i < count; i++ )
+            {
+            if ( IsCmVirtualL( aUncatArray[i]->GetIntAttributeL( ECmId ) ) )
+                {
+                delete aUncatArray[i];
+                aUncatArray.Remove( i );
+                count--;
+                i--;
+                }
+            }
+        }
+    // Show the 'Uncategorised' destination
+    if ( count )
+        {
+        HBufC* buf = StringLoader::LoadLC( R_CMMANAGERUI_DEST_UNCATEGORIZED );
+        aItems->AppendL( *buf );
+        CleanupStack::PopAndDestroy( buf );        
+        iItems.AppendL( KDestItemUncategorized );
+        }
+    }
+
+//---------------------------------------------------------------------------
+//  CCmConnSettingsUiImpl::UserSelectionDlgL()
+//---------------------------------------------------------------------------
+//
+TBool CCmConnSettingsUiImpl::UserSelectionDlgL( 
+                                        TInt& aDestSelected, 
+                                        CDesCArrayFlat* aItems, 
+                                        TCmDCSettingSelection& aSelection, 
+                                        const TInt aTitleStringResource, 
+                                        TBool aOpenDestination)
+    {
+    // Should an item be highlighted?
+    if ( aSelection.iResult == EDCDestination )
+        {
+        for ( TInt i = 0; i < iItems.Count(); i++ )
+            {
+            if ( iItems[i] == aSelection.iId )
+                {
+                aDestSelected = i;
+                }
+            }
+        }
+    
+    HBufC* buf = StringLoader::LoadLC( aTitleStringResource );
+    TInt dialogResourceId = R_RADIO_BUTTON_SETTING_PAGE_OK_CANCEL;
+    if ( aOpenDestination ) // OPTIONS/CANCEL is available only if we can open
+                            //destinations
+        {
+        dialogResourceId = R_RADIO_BUTTON_SETTING_PAGE;
+        }
+    CCMConnSelectRBPage* page = 
+                        new ( ELeave ) CCMConnSelectRBPage( dialogResourceId,
+                                                         aDestSelected, 
+                                                         aItems,
+                                                         *iCmManagerImpl,
+                                                         aSelection.iResult,
+                                                         iItems,
+                                                         iAreDestinations,
+                                                         aOpenDestination ,
+                                                         iHelpContext );
+    CleanupStack::PushL( page );
+    page->SetSettingTextL( *buf );
+    CleanupStack::Pop( page );
+    
+    CleanupStack::PopAndDestroy( buf );
+    buf = NULL;
+    
+    return page->ExecuteLD( CAknSettingPage::EUpdateWhenChanged );
+    }    
+
+//---------------------------------------------------------------------------
+//  CCmConnSettingsUiImpl::UserSelectedUncatItemL()
+//---------------------------------------------------------------------------
+//
+TBool CCmConnSettingsUiImpl::UserSelectedUncatItemL(
+                                           RPointerArray<CCmPluginBase>& aUncatArray,
+                                           TCmDCSettingSelection& aSelection, 
+                                        const TInt aTitleStringResource )
+    {
+    TBool retVal( EFalse );
+    CDesCArrayFlat* items = 
+                    new ( ELeave ) CDesCArrayFlat( KCmArrayBigGranularity );
+    CleanupStack::PushL( items );
+
+    TInt cmSelected( 0 );
+
+    TInt count = aUncatArray.Count();
+    for ( TInt i = 0; i < count; ++i )     
+        {
+        CCmPluginBase* cm = NULL;
+        TRAPD( err,
+               cm = iCmManagerImpl->GetConnectionMethodL( aUncatArray[i]->GetIntAttributeL( ECmId) ) 
+               );
+        
+        if ( !err )
+            {
+            CleanupStack::PushL( cm );
+            HBufC* cmName = cm->GetStringAttributeL( ECmName );
+            CleanupStack::PushL( cmName );
+            items->AppendL( *cmName );
+            
+            // Virtual CMs have underlying CMs, highlight
+            if ( cm->GetBoolAttributeL( ECmVirtual ) )
+                {
+                TUint32 iapId (0);
+                iapId = cm->GetIntAttributeL( ECmNextLayerIapId );
+                if ( iapId && iapId == aSelection.iId )
+                    {
+                    cmSelected = i;
+                    }
+                }            
+            CleanupStack::PopAndDestroy( 2, cm );
+            }
+        else
+            {
+            //not handled iap, remove from list
+            aUncatArray.Remove( i );
+            count--;
+            i--;
+            }
+        }
+    
+    
+    CAknRadioButtonSettingPage* rbPage = 
+                new ( ELeave ) CAknRadioButtonSettingPage(
+                                    R_RADIO_BUTTON_SETTING_PAGE_OK_CANCEL, 
+                                    cmSelected, 
+                                    items );
+    CleanupStack::PushL( rbPage );
+                        
+    HBufC* buf = StringLoader::LoadLC( aTitleStringResource );    
+    rbPage->SetSettingTextL( *buf );
+    CleanupStack::PopAndDestroy( buf );
+    
+    if ( rbPage->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )
+        {
+        CCmPluginBase* cm = 
+                iCmManagerImpl->GetConnectionMethodL( aUncatArray[cmSelected]->GetIntAttributeL( ECmId) );
+
+        // ECmIapId can be surely queried here. It won't leave, but PushL to be
+        // on the safe side
+        CleanupStack::PushL( cm );
+        aSelection.iId = cm->GetIntAttributeL( ECmId );
+        CleanupStack::PopAndDestroy( cm );
+
+        aSelection.iResult = EDCConnectionMethod; 
+        
+        retVal = ETrue;
+        }
+    CleanupStack::Pop( rbPage );
+    CleanupStack::PopAndDestroy( items );
+    
+    return retVal;
+    }
+
+
+//---------------------------------------------------------------------------
+//  CCmConnSettingsUiImpl::ShowConnectionMethodsL()
+//---------------------------------------------------------------------------
+//
+TBool CCmConnSettingsUiImpl::ShowConnectionMethodsL( 
+                    RPointerArray<CCmPluginBase>& aCmArray, TCmDCSettingSelection& aSelection, 
+                    const TInt aTitleStringResource,
+                    TBearerFilterArray& aFilterArray  )
+    {
+    TInt retVal ( EFalse );
+    
+    // List texts
+    CDesCArrayFlat* items = 
+            new ( ELeave ) CDesCArrayFlat( KCmArrayMediumGranularity );
+    CleanupStack::PushL( items );
+    
+    // keeps track of the CMs in the list
+    
+    // idArray is used to put valid IAP ID.
+    // aFilterArray might filt some of IAPs (e.g., virtual IAPs) out. In this case,
+    // aCmArray can not be used to select IAP. So, idArray may be used for IAP selection
+    // for it only stores valid IAPs (i.e., not filted-out IAPs).
+    RArray<TUint32> idArray;
+    TInt cmSelected( 0 );
+    TInt j( 0 );
+    
+    // Collect item texts
+    TInt cmCount = aCmArray.Count();
+    for ( TInt i = 0; i < cmCount; i++ )
+        {
+        // CM info
+        if (aFilterArray.Count())
+            {
+            TUint cmBearerType = aCmArray[i]->GetIntAttributeL( ECmBearerType );
+            if ( aFilterArray.Find( cmBearerType ) == KErrNotFound )
+                {
+                continue;    
+                }
+            }
+        
+        // CM Iap Id
+        TUint32 cmIapId = aCmArray[i]->GetIntAttributeL( ECmId );
+        
+        // Should virtual bearer types be shown?
+        if ( iShowVirtualCMs || !IsCmVirtualL( cmIapId ) )
+            {
+            // CM name
+            HBufC* name = aCmArray[i]->GetStringAttributeL( ECmName );
+            CleanupStack::PushL( name );
+            
+            items->AppendL( *name );
+            idArray.Append( cmIapId );
+            
+             // Virtual CMs have underlying CMs, highlight
+            if ( cmIapId == aSelection.iId )
+                {
+                cmSelected = j;
+                j++;
+                }
+            
+            CleanupStack::PopAndDestroy( name );
+            }
+        }
+    
+    // create the dialog             
+    CAknRadioButtonSettingPage* dlg = 
+                            new ( ELeave ) CAknRadioButtonSettingPage(
+                                    R_RADIO_BUTTON_SETTING_PAGE_OK_CANCEL,
+                                    cmSelected, 
+                                    items );
+    CleanupStack::PushL( dlg );
+    
+    // Title
+    HBufC* title = StringLoader::LoadLC ( aTitleStringResource );
+    dlg->SetSettingTextL( *title );
+    
+    // Show the dialog
+    if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )
+        {
+        aSelection.iId = idArray[cmSelected];
+        aSelection.iResult = EDCConnectionMethod; 
+        retVal = ETrue;
+        }
+    idArray.Close();
+    
+    CleanupStack::PopAndDestroy( title );
+    CleanupStack::Pop( dlg );
+    CleanupStack::PopAndDestroy( items );
+    
+    return retVal;
+    }
+
+
+//---------------------------------------------------------------------------
+//  CCmConnSettingsUiImpl::IsCmVirtualL
+//---------------------------------------------------------------------------
+//
+TBool CCmConnSettingsUiImpl::IsCmVirtualL( TUint32 aIapId )
+    {
+    // check if bearer is virtual
+    TInt bearerType = iCmManagerImpl->GetConnectionMethodInfoIntL( 
+                                                aIapId, ECmBearerType );
+    return iCmManagerImpl->GetBearerInfoBoolL( bearerType, ECmVirtual );
+    }
+
+
+//---------------------------------------------------------------------------
+//  CCmConnSettingsUiImpl::CreateDefaultConnectionNameL
+//---------------------------------------------------------------------------
+//
+HBufC* CCmConnSettingsUiImpl::CreateDefaultConnectionNameL( 
+                                            TCmDefConnValue aSelection )
+    {
+    HBufC* ret = NULL;
+    switch ( aSelection.iType )
+        {
+        case ECmDefConnDestination:
+            {
+            CCmDestinationImpl* dest = 
+                        iCmManagerImpl->DestinationL( aSelection.iId );
+            CleanupStack::PushL( dest );
+            ret = dest->NameLC();
+            CleanupStack::Pop( ret );
+            CleanupStack::PopAndDestroy( dest );
+            break;
+            }
+        case ECmDefConnConnectionMethod:
+            {
+            ret = iCmManagerImpl->GetConnectionMethodInfoStringL( 
+                                                aSelection.iId, ECmName );
+            break;
+            }
+        }
+    return ret;
+    }
+   
+
+
+//---------------------------------------------------------------------------
+//  CCmConnSettingsUiImpl::SetDestinationArrayToUseL
+//---------------------------------------------------------------------------
+//
+EXPORT_C void CCmConnSettingsUiImpl::SetDestinationArrayToUseL(
+                                         RArray<TUint32> aDestinationArray )
+    {
+    iPassedDestinations.Close();
+    for (TInt i=0; i<aDestinationArray.Count(); i++)
+        {
+        iPassedDestinations.AppendL(aDestinationArray[i]);
+        }
+    
+    iUsePassedDestinationArray = ETrue;
+    }
+
+
+//---------------------------------------------------------------------------
+//  CCmConnSettingsUiImpl::ClearDestinationArrayToUse
+//---------------------------------------------------------------------------
+//
+EXPORT_C void CCmConnSettingsUiImpl::ClearDestinationArrayToUse()
+    {
+    iPassedDestinations.Close();
+    iUsePassedDestinationArray = EFalse;
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Src/cmdesticondialog.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,268 @@
+/*
+* 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 CCmDestinationIconDialog
+*
+*/
+
+// INCLUDE FILES
+#include <uikon.hrh>
+#include <e32std.h>
+#include <eikcapc.h>
+
+#include <aknlayoutscalable_avkon.cdl.h>
+#include <layoutmetadata.cdl.h>
+
+#include <aknborders.h>
+#include <aknconsts.h>
+#include <AknUtils.h>
+#include <aknPopupHeadingPane.h>
+#include <AknSettingCache.h>
+
+#include <AknLayout.lag>
+#include <e32property.h>
+
+#include <cmmanager.rsg>
+
+#include "cmmanager.hrh"
+#include "cmdesticondialog.h"
+#include "cmdesticonmap.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// ----------------------------------------------------------------------------
+// CCmDestinationIconDialog class
+// CCmDestinationIconDialog() - constructor
+// ----------------------------------------------------------------------------
+//
+CCmDestinationIconDialog::CCmDestinationIconDialog( TInt& aIconIndex )
+    : iIconIndex(&aIconIndex)
+    {
+    CEikDialog::SetBorder( AknBorderId::EAknBorderNotePopup );
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconDialog::~CCmDestinationIconDialog()
+// -----------------------------------------------------------------------------
+//
+CCmDestinationIconDialog::~CCmDestinationIconDialog()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconDialog::HandleResourceChange()
+// -----------------------------------------------------------------------------
+//
+void CCmDestinationIconDialog::HandleResourceChange(TInt aType)
+    {
+    CAknDialog::HandleResourceChange(aType);
+
+    if (aType==KEikDynamicLayoutVariantSwitch)
+        {
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconDialog::OkToExitL()
+// -----------------------------------------------------------------------------
+//
+TBool CCmDestinationIconDialog::OkToExitL(TInt aButtonId)
+    {
+    CCmDestinationIconMap* iconmapControl = 
+        STATIC_CAST(CCmDestinationIconMap*, Control(ECmDestIconMapContentId));
+    // Selection key / select softkey adds a iconacter only if 5-key was not 
+    // used to select multiple icons before.
+    if ( aButtonId == EAknSoftkeyOk || aButtonId == EAknSoftkeySelect )
+        {
+        TKeyEvent key;
+        key.iCode=EKeyOK;
+        key.iModifiers=0;
+        iconmapControl->OfferKeyEventL(key, EEventKey);
+        }
+    return(ETrue);
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconDialog::PreLayoutDynInitL()
+// -----------------------------------------------------------------------------
+//
+void CCmDestinationIconDialog::PreLayoutDynInitL()
+    {
+    CCmDestinationIconMap* iconmapControl = 
+       STATIC_CAST( CCmDestinationIconMap*, Control( ECmDestIconMapContentId ));
+    CAknPopupHeadingPane* headingPane =
+       STATIC_CAST( CAknPopupHeadingPane*, Control( EAknSCTQueryHeadingId ));
+
+    iconmapControl->SetIndex(*iIconIndex);    
+
+    SetLineNonFocusing(EAknSCTQueryHeadingId);
+
+    // add title    
+    CEikonEnv* env = CEikonEnv::Static();
+    HBufC* title = env->AllocReadResourceL( R_CMMANAGERUI_PRMPT_SELECT_ICON );
+    CleanupStack::PushL( title );
+    headingPane->SetTextL( *title );
+    CleanupStack::PopAndDestroy( title );
+    title = NULL;
+
+#ifdef RD_SCALABLE_UI_V2
+
+	iconmapControl->SetObserver(this);
+	
+#endif // RD_SCALABLE_UI_V2
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconDialog::SetSizeAndPosition()
+// -----------------------------------------------------------------------------
+//
+void CCmDestinationIconDialog::SetSizeAndPosition( const TSize& aSize )
+    {
+    SetBorder( TGulBorder::ENone ); // No Dialog borders in SCT.
+    CAknDialog::SetSizeAndPosition( aSize );
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconDialog::OfferKeyEventL()
+// -----------------------------------------------------------------------------
+//
+TKeyResponse CCmDestinationIconDialog::OfferKeyEventL(
+                             const TKeyEvent& aKeyEvent, TEventCode aModifiers )
+    {
+    if ( aModifiers == EEventKey )
+        {
+        TUint code=aKeyEvent.iCode;
+        CCmDestinationIconMap* iconmapControl =
+                            STATIC_CAST( CCmDestinationIconMap*, 
+                                         Control( ECmDestIconMapContentId ));
+
+        switch ( code )
+            {
+            case EKeyLeftArrow:
+            case EKeyRightArrow:
+            case EKeyUpArrow:
+            case EKeyDownArrow:
+                {
+                TKeyResponse res(
+                    iconmapControl->OfferKeyEventL( aKeyEvent, aModifiers ));
+                return res;
+                }
+                
+            case EKeyEnter:
+                // change fro EKeyEnter to EKeyOK
+                {
+                TKeyEvent keyEvent;
+                keyEvent.iCode = EKeyOK;
+                keyEvent.iScanCode = aKeyEvent.iScanCode;
+                keyEvent.iModifiers = aKeyEvent.iModifiers;
+                keyEvent.iRepeats = aKeyEvent.iRepeats;
+                return CEikDialog::OfferKeyEventL( keyEvent, aModifiers );
+                }
+                
+            default:
+                break;
+            }
+        }
+        
+    return CEikDialog::OfferKeyEventL( aKeyEvent, aModifiers );
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconDialog::ExecuteLD()
+// -----------------------------------------------------------------------------
+//
+TInt CCmDestinationIconDialog::ExecuteLD()
+    {
+    // Prepare real icon map
+    CEikDialog::PrepareLC( R_ICONSEL_DIALOG );
+    return(RunLD());
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconDialog::CEikDialog_Reserved_1()
+// -----------------------------------------------------------------------------
+//
+void CCmDestinationIconDialog::CEikDialog_Reserved_1()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconDialog::CEikDialog_Reserved_2()
+// -----------------------------------------------------------------------------
+//
+void CCmDestinationIconDialog::CEikDialog_Reserved_2()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconDialog::CCmDestinationIconDialog_Reserved()
+// -----------------------------------------------------------------------------
+//
+void CCmDestinationIconDialog::CAknIconMapDialog_Reserved()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconDialog::CreateCustomControlL()
+// Virtual function override from the base class to implement the custom control
+// -----------------------------------------------------------------------------
+//    
+SEikControlInfo CCmDestinationIconDialog::CreateCustomControlL(
+    TInt aControlType)
+    {
+    CCmDestinationIconMap *control= NULL;
+    if ( aControlType == KCmDestIconMapType )
+        {
+        control = CCmDestinationIconMap::NewL();
+        }
+    SEikControlInfo info;
+    info.iControl = control;
+    info.iFlags = 0;
+    info.iTrailerTextId = 0;
+    return info;
+    }
+
+#ifdef RD_SCALABLE_UI_V2
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconDialog::HandleControlEventL
+// Handles the event.
+// -----------------------------------------------------------------------------
+//
+void CCmDestinationIconDialog::HandleControlEventL( 
+                                                CCoeControl* /*aControl*/,
+                                                TCoeEvent aEventType )
+    {
+    if( aEventType == EEventStateChanged)
+		{
+	    iConSelected = ETrue;
+		}
+    } 
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconDialog::HandleDialogPageEventL
+// Handles the event.
+// -----------------------------------------------------------------------------
+//
+void CCmDestinationIconDialog::HandleDialogPageEventL(TInt aEventID)
+	{
+    if ( AknLayoutUtils::PenEnabled() && ( aEventID == 
+         MEikDialogPageObserver::EDialogPageTapped && iConSelected ) )
+	    {
+	    TryExitL( EAknSoftkeyOk );
+	    }
+	}
+	
+#endif //RD_SCALABLE_UI_V2
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Src/cmdesticonmap.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,2061 @@
+/*
+* 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 CCmDestinationIconMap
+*
+*/
+
+#include <eikenv.h>
+#include <eiksbfrm.h>
+#include <eikscrlb.h>
+#include <bidivisual.h>
+#include <avkon.rsg>
+#include <AknPanic.h>
+#include <avkon.hrh>
+#include <AknUtils.h>
+#include <aknlayoutscalable_avkon.cdl.h>
+#include <layoutmetadata.cdl.h>
+#include <AknLayout.lag>
+#include <data_caging_path_literals.hrh>
+#include <aknappui.h>
+#include <aknconsts.h>
+#include <AknDef.h>
+#include <PUAcodes.hrh>
+#include <s32file.h>
+#include <eikscrlb.h>   // TEikScrollBarModelType
+#include <AknsDrawUtils.h>
+#include <featmgr.h>
+#include <AknsFrameBackgroundControlContext.h>
+#include <cmmanager.mbg>
+#include <cmcommonconstants.h>
+#include <touchfeedback.h>
+#include "cmdesticonmap.h"
+#include "cmmanagerimpl.h"
+
+// The offset because of CEikDialogPage
+const TInt KHorizontalDialogMargin = 0;
+const TInt KVerticalDialogMargin = 0;
+const TInt KAknSctCBaButtonDirections = 3; // bottom, right and left
+
+/**
+ * Extension class to CCmDestinationIconMap
+ *
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CCmDestinationIconMapExtension ) : public CBase, 
+                                                      public MObjectProvider
+    {
+    public:
+    
+        CCmDestinationIconMapExtension();
+        ~CCmDestinationIconMapExtension();
+    
+    protected:
+    
+        TTypeUid::Ptr MopSupplyObject( TTypeUid aId );
+        MObjectProvider* MopNext();
+    
+    public: // data
+        
+        MCoeControlObserver *iObserver;
+        
+        TUint iFlags;
+        MObjectProvider* iIconMap;       
+        TInt iMaxVisibleRows;
+        CAknsFrameBackgroundControlContext* iBgContext;
+    };
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconMapExtension::CCmDestinationIconMapExtension
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CCmDestinationIconMapExtension::CCmDestinationIconMapExtension()
+    : iMaxVisibleRows( 0 )
+    {
+    iObserver = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconMapExtension::MopSupplyObject()
+// -----------------------------------------------------------------------------
+//
+TTypeUid::Ptr CCmDestinationIconMapExtension::MopSupplyObject( TTypeUid aId )
+    {
+    return MAknsControlContext::SupplyMopObject( aId, iBgContext );
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconMapExtension::MopNext()
+// -----------------------------------------------------------------------------
+//    
+MObjectProvider* CCmDestinationIconMapExtension::MopNext()
+    {
+    return iIconMap;
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconMapExtension::~CCmDestinationIconMapExtension()
+// -----------------------------------------------------------------------------
+//
+CCmDestinationIconMapExtension::~CCmDestinationIconMapExtension()
+    {
+    delete iBgContext;
+    iBgContext = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconMap::CCmDestinationIconMap
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CCmDestinationIconMap::CCmDestinationIconMap() 
+    : iCursorPos( TPoint( 0,0 ) )
+    , iOldCursorPos( TPoint( 0,0 ) )
+    , iMaxColumns( -1 )
+    , iDragAlreadyActive( EFalse )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconMap::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCmDestinationIconMap* CCmDestinationIconMap::NewL()
+    {
+    CCmDestinationIconMap* self = new( ELeave ) CCmDestinationIconMap();
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self ); //self
+    return self;    
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconMap::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CCmDestinationIconMap::ConstructL()
+    {
+    // Must be created here to get the member variables available
+    iExtension = new ( ELeave ) CCmDestinationIconMapExtension;
+    iExtension->iIconMap = this;
+        
+    iConsArray = new( ELeave ) CAknIconArray( KNumOfIcons );
+    
+    iExtension->iFlags = 0x00;
+        
+    DoLayout();
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconMap::~CCmDestinationIconMap()
+// -----------------------------------------------------------------------------
+//
+CCmDestinationIconMap::~CCmDestinationIconMap()
+    {
+    delete iSBFrame; iSBFrame = NULL;
+    
+    delete iOffscreenBg;
+    delete iBitmapDevice;
+    delete iBitmapGc;
+
+    delete iExtension; 
+    iExtension = ( CCmDestinationIconMapExtension* )NULL;
+    
+    if ( iConsArray )
+        {
+        iConsArray->ResetAndDestroy();
+        delete iConsArray;
+        iConsArray = NULL;
+        }
+   }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconMap::DoLayout()
+// -----------------------------------------------------------------------------
+//
+void CCmDestinationIconMap::DoLayout() 
+    {
+    TRAPD( err,LoadIconL() );
+    if ( err )
+        {
+        return;
+        }
+    
+    iIsMirrored = AknLayoutUtils::LayoutMirrored();
+    iDrawnBefore = EFalse;
+    CountMaxColumnsAndCellSizes();
+    SizeChanged();
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconMap::ConstructFromResourceL()
+// -----------------------------------------------------------------------------
+//
+void CCmDestinationIconMap::ConstructFromResourceL( 
+                                                TResourceReader& /*aReader*/ )
+    {
+    LoadIconL();
+    CreateScrollBarAndIconRowL();
+
+    iExtension->iBgContext = CAknsFrameBackgroundControlContext::NewL( 
+                                                            KAknsIIDQsnFrPopup, 
+                                                            TRect( 0, 0, 1, 1 ), 
+                                                            TRect( 0, 0, 1, 1 ), 
+                                                            EFalse );
+
+    if ( DrawableWindow() && AknLayoutUtils::PenEnabled() )
+        {
+        EnableDragEvents();       
+        SetGloballyCapturing( ETrue );
+        SetPointerCapture( ETrue );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconMap::LoadIcons()
+// This actually load the all icons to be shown on dialog from icon file
+// -----------------------------------------------------------------------------
+//
+void CCmDestinationIconMap::LoadIconL()
+    {
+    if ( iConsArray )
+        {
+        iConsArray->ResetAndDestroy();
+        }
+    // Draw all the Icons.
+    TParse mbmFile;
+    User::LeaveIfError( mbmFile.Set( KManagerIconFilename, 
+                                     &KDC_APP_BITMAP_DIR, NULL ) );
+        
+    // Create icon bitmap and mask.
+    for ( TInt i( 0 ); i < ( KNumOfIcons * 2 ); i++ )
+        {
+        CFbsBitmap* bitmap = NULL;
+        CFbsBitmap* bitmapMask = NULL;
+        AknIconUtils::CreateIconLC( 
+                   bitmap, 
+                   bitmapMask, mbmFile.FullName(),
+                   EMbmCmmanagerQgn_prop_set_conn_dest_internet_small + i, 
+                   EMbmCmmanagerQgn_prop_set_conn_dest_internet_small + i + 1 );
+        i++;
+        AknIconUtils::SetSize( bitmap, 
+                               TSize( iGridItemWidth, iGridItemHeight ) );
+        AknIconUtils::SetSize( bitmapMask, 
+                               TSize( iGridItemWidth, iGridItemHeight ) );
+        CGulIcon* icon = CGulIcon::NewL( bitmap, bitmapMask );
+        CleanupStack::PushL( icon );
+        iConsArray->AppendL( icon );       
+        CleanupStack::Pop( 3, bitmap );
+        }        
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconMap::HeightInRows()
+// This actually returns the no of rows to be shown on a page
+// Depends upon the Layout size
+// -----------------------------------------------------------------------------
+//
+TInt CCmDestinationIconMap::HeightInRows()
+    {
+    return ( iRows );
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconMap::CreateScrollBarAndIconRowL()
+// This actually creates the scroll bar sets the number of 
+// pages and rows on a page to be shown
+// -----------------------------------------------------------------------------
+//
+void CCmDestinationIconMap::CreateScrollBarAndIconRowL()
+    {
+    iRows = ( ( iConsArray->Count() - 1 ) / iMaxColumns ) + 1 ;
+    iFirstVisibleRow = 0;
+    iAnimated = EFalse;
+    iCursorPos = TPoint( 0, 0 );
+    iNumPages = ( iRows / iExtension->iMaxVisibleRows ) + 
+                ( iRows % iExtension->iMaxVisibleRows ? 1 : 0 );
+    iCurrentPage = 1;
+    
+    // Create and set the scb visible even though there is nothing to scroll   
+    delete iSBFrame; iSBFrame=NULL;
+
+    if ( AknLayoutUtils::PenEnabled() )
+        {
+        iSBFrame=new( ELeave ) CEikScrollBarFrame( this, this, ETrue ); 
+        }
+    else
+        {
+        iSBFrame=new( ELeave ) CEikScrollBarFrame( this, NULL, ETrue );
+        }
+    // Decide which type of scrollbar is shown
+    CAknAppUi* appUi = iAvkonAppUi;
+    if ( AknLayoutUtils::DefaultScrollBarType( appUi ) == 
+         CEikScrollBarFrame::EDoubleSpan )
+        {
+        // For EDoubleSpan type scrollbar
+        if ( AknLayoutUtils::PenEnabled() )
+            {
+            // window owning scrollbar
+            iSBFrame->CreateDoubleSpanScrollBarsL( ETrue, 
+                                                   EFalse, 
+                                                   ETrue, 
+                                                   EFalse );
+            }
+        else
+            {
+            // non-window owning scrollbar
+            iSBFrame->CreateDoubleSpanScrollBarsL( EFalse, 
+                                                   EFalse, 
+                                                   ETrue, 
+                                                   EFalse ); 
+            }
+        iSBFrame->SetTypeOfVScrollBar( CEikScrollBarFrame::EDoubleSpan );
+        }
+    else
+        {
+        // For EArrowHead type scrollbar
+        iSBFrame->SetTypeOfVScrollBar( CEikScrollBarFrame::EArrowHead );
+        }
+    
+    iSBFrame->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff,
+                                       CEikScrollBarFrame::EAuto );
+    iSBFrame->VerticalScrollBar()->SetMopParent( iExtension );
+    UpdateScrollIndicatorL();
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconMap::SetIndex
+// set the reference of the selected icon index from the table
+// -----------------------------------------------------------------------------
+// 
+void CCmDestinationIconMap::SetIndex( TInt& aIconIndex )
+    {
+    iIconIndex = &aIconIndex;
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconMap::MinimumSize
+// 
+// -----------------------------------------------------------------------------
+//
+TSize CCmDestinationIconMap::MinimumSize()
+    {    
+    iIsMirrored = AknLayoutUtils::LayoutMirrored();
+    CountMaxColumnsAndCellSizes();
+
+    TRect rect;
+    // Used the set rect, but resolution changes cannot be handled when it is used
+              
+    TAknLayoutRect dialogLayRect;
+        
+    // Main pane without softkeys
+    TRect mainPaneRect;
+    if ( !AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, mainPaneRect ) )
+    {
+    mainPaneRect = iAvkonAppUi->ClientRect();
+    }
+    
+    // Dialog layout, check variety first
+    TAknLayoutScalableParameterLimits iconMapDialogVariety = 
+               AknLayoutScalable_Avkon::popup_grid_graphic_window_ParamLimits();
+    
+    // Calc the variety
+    TInt maxVariety = iconMapDialogVariety.LastVariety();
+    
+    // Check the CBA, if the orientation is not landscape 
+    // there is not so much varieties
+    AknLayoutUtils::TAknCbaLocation location = AknLayoutUtils::CbaLocation();
+    // the offset for the certain cba location variety
+    TInt maxVarietyOffset = 0; 
+    // the number of varieties
+    TInt varietyOffset = maxVariety + 1;
+    
+    // landscape variety number must be calculated offset == number of varieties
+    // same applies to the variety number for the biggest sized layout for the 
+    // variety
+    if ( Layout_Meta_Data::IsLandscapeOrientation() )
+       {
+       // the offset for one variety
+       varietyOffset = ( maxVariety + 1 ) / KAknSctCBaButtonDirections;
+       }
+    
+    // for right and left cba buttons the max variety is not zero
+    // the varities are ordered by the location of the cba and the descending order
+    // e.g the biggest sized layout first, the smallest last
+    if ( location == AknLayoutUtils::EAknCbaLocationRight )
+       {
+       maxVarietyOffset = varietyOffset;
+       }
+    else if ( location == AknLayoutUtils::EAknCbaLocationLeft )
+       {
+       maxVarietyOffset = varietyOffset + varietyOffset; // 2*
+       }
+    
+    TInt varietyNumber = varietyOffset - iRows - 1; 
+    
+    // if more lines than possible to show, use the default 
+    // ( the biggest grid ) variety
+    if ( varietyNumber < 0 )
+       varietyNumber = 0;
+    // if zero rows, use the minimum
+    else if ( iRows<=0 )
+       varietyNumber -= 1;
+    
+    //add the varietyoffset
+    varietyNumber += maxVarietyOffset;
+
+    if ( Layout_Meta_Data::IsLandscapeOrientation() && 
+        location == AknLayoutUtils::EAknCbaLocationRight )
+       {
+       varietyNumber = 10;
+       }
+    else
+        {
+        if( iRows == 0 )
+            {
+            varietyNumber = 5;
+            }
+        else
+            {
+            varietyNumber = 3;
+            }
+        }       
+    // Layout the dialog size
+    dialogLayRect.LayoutRect( mainPaneRect, 
+       AknLayoutScalable_Avkon::popup_grid_graphic_window( varietyNumber ) );
+       
+    // Layout the grid
+    TAknLayoutRect gridWithScrollLayRect;
+    gridWithScrollLayRect.LayoutRect( dialogLayRect.Rect(), 
+       AknLayoutScalable_Avkon::listscroll_popup_graphic_pane() );
+    
+    return TSize( dialogLayRect.Rect().Width(), 
+        gridWithScrollLayRect.Rect().Height() );
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconMap::ActivateL()
+// This method is needed to set correct initial value to scroll indicator.
+// -----------------------------------------------------------------------------
+//
+ void CCmDestinationIconMap::ActivateL()
+    {
+    CCoeControl::ActivateL();
+    if ( iRows > iExtension->iMaxVisibleRows )
+        {
+        UpdateScrollIndicatorL();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconMap::OfferKeyEventL
+// Handles all the Keypad events
+// -----------------------------------------------------------------------------
+//
+TKeyResponse CCmDestinationIconMap::OfferKeyEventL( const TKeyEvent& aKeyEvent, 
+                                                    TEventCode /*aModifiers*/ )
+    {
+    TUint code=aKeyEvent.iCode;
+    
+    switch ( code )
+        {
+        case EKeyLeftArrow:
+        case '4':
+            MoveCursorL( -1,0 );
+            break;
+        case EKeyRightArrow:
+        case '6':
+            MoveCursorL( 1,0 );
+            break;
+        case EKeyUpArrow:
+        case '2':
+            MoveCursorL( 0,-1 );
+            break;
+        case EKeyDownArrow:
+        case '8':
+            MoveCursorL( 0,1 );
+            break;
+        case EKeyOK:
+        case '5':  
+        case EKeySpace:
+            {
+            if ( iConsArray )
+                {
+                TInt ret = iMaxColumns * 
+                           ( iFirstVisibleRow + iCursorPos.iY ) + 
+                           iCursorPos.iX;
+                if ( ret <= iConsArray->Count() )
+                    {
+                    *iIconIndex = ret;    
+                    }
+                else
+                    {
+                    *iIconIndex = -1;
+                    }
+                }
+               
+            }
+            break;
+        default:
+            return EKeyWasNotConsumed;
+
+        }
+    return EKeyWasConsumed;
+    }
+
+#ifdef RD_SCALABLE_UI_V2 
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconMap::HandlePointerEventL
+// Handles all the Keypad events
+// -----------------------------------------------------------------------------
+//
+void CCmDestinationIconMap::HandlePointerEventL(
+                                const TPointerEvent& aPointerEvent )
+    {
+    if ( AknLayoutUtils::PenEnabled() )
+        {
+        TInt newGridX; // For the whole
+        TInt newGridY; // For the whole grid.
+        TInt yInPixels = aPointerEvent.iPosition.iY - iGridTopLeft.iY;
+        newGridY = yInPixels / iGridItemHeight;
+        if ( ( aPointerEvent.iPosition.iX - iGridTopLeft.iX ) < 0 )
+            {
+            newGridX = -1;
+            }
+        else
+            {
+            newGridX = ( aPointerEvent.iPosition.iX - iGridTopLeft.iX )
+                                                        / iGridItemWidth;
+            }
+
+        // The pointer has been set down or dragged into the area of the grid. 
+        // (it might be in the "white space" at the end of the grid)
+        if ( ( yInPixels >= 0 && yInPixels < iGridItemHeight 
+                * iExtension->iMaxVisibleRows) &&
+            // When the pointer is in rows except the recent icon row
+                ( ( ( ( newGridY + iFirstVisibleRow ) != 0 ) && 
+                newGridX < iMaxColumns && newGridX >= 0 ) ||
+            // When the pointer is in the recent icon row
+                ( ( newGridY + iFirstVisibleRow == 0 ) && 
+                ( newGridX < iMaxColumns ) ) ) )
+            {
+            TUint globalY = newGridY + iFirstVisibleRow;
+            // For any action to be taken, the pointer event must either be a
+            // Button1Down or a drag event which has originated from a
+            // Button1Down in to the grid.
+            if ( aPointerEvent.iType == TPointerEvent::EButton1Down ||
+                 aPointerEvent.iType == TPointerEvent::EDrag )
+                {
+                if ( aPointerEvent.iType == TPointerEvent::EDrag ) 
+                    {
+                    iDragAlreadyActive = ETrue;
+                    }
+
+                // The user tapps a cell which has no icon. it is ignored.
+                if ( iConsArray->Count() > globalY * iMaxColumns + newGridX )
+                    {
+              	    // If icon is already selected then on single tap it
+              	    // should select the icon.
+                    if( iCursorPos.iY == newGridY && 
+                        iCursorPos.iX == newGridX &&
+                        aPointerEvent.iType != TPointerEvent::EDrag )
+                        {
+                        if ( iExtension->iObserver )
+                            {
+                            iExtension->iObserver->HandleControlEventL( 
+                                  this, 
+                                  MCoeControlObserver::EEventStateChanged );
+                            } 
+                        }
+                    else if ( iCursorPos.iX + ( iCursorPos.iY + 
+                              iFirstVisibleRow ) * iMaxColumns  < 
+                              iConsArray->Count() )
+                        {
+                        iOldCursorPos = iCursorPos;
+                        iCursorPos.iY = newGridY;
+                        iCursorPos.iX = newGridX;
+                        DrawCursor();
+                        }
+                    else
+                        {
+                        iOldCursorPos.iX = 0;
+                        iOldCursorPos.iY = 0;
+                        }
+				    }
+                }
+            else if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
+                {
+                // The pointer has been set and dragged into the area of 
+                // the grid.
+                if ( yInPixels >= 0 && yInPixels < iGridItemHeight * 
+                     iExtension->iMaxVisibleRows && 
+                     iDragAlreadyActive && 
+                     iOldCursorPos == iCursorPos &&
+                     (iConsArray->Count() > (globalY * iMaxColumns + newGridX)))
+                    {
+                    if ( iExtension->iObserver )
+                        {
+                        iExtension->iObserver->HandleControlEventL( 
+                                this, 
+                                MCoeControlObserver::EEventStateChanged );
+                        }
+                	iDragAlreadyActive = EFalse;    
+                    }
+                }
+
+            MTouchFeedback* feedback = MTouchFeedback::Instance();
+        
+            if ( feedback )
+                {
+                if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
+                    {
+                    feedback->InstantFeedback( this, ETouchFeedbackBasic );
+                    }
+                else if ( aPointerEvent.iType == TPointerEvent::EDrag && iCursorPos != iOldCursorPos )
+                    {
+                    feedback->InstantFeedback( this, ETouchFeedbackSensitive );	
+                    }
+                }
+            }
+        else // For a non window owning scrollbar.
+            {
+            if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
+                {
+                iDragAlreadyActive = EFalse;
+                }
+            }
+        
+        CCoeControl::HandlePointerEventL( aPointerEvent );
+        }
+    }
+    
+// -----------------------------------------------------------------------------
+// CCmDestinationIconMap::SetObserver
+// Sets the observer.
+// -----------------------------------------------------------------------------
+//
+void CCmDestinationIconMap::SetObserver( MCoeControlObserver* aObserver  )
+    {
+    if ( iExtension )
+        {
+        iExtension->iObserver = aObserver;
+        }
+    }
+
+#endif //RD_SCALABLE_UI_V2    
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconMap::InputCapabilities()
+//
+// -----------------------------------------------------------------------------
+//
+TCoeInputCapabilities CCmDestinationIconMap::InputCapabilities() const
+    {
+    return TCoeInputCapabilities( TCoeInputCapabilities::EAllText );
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconMap::SizeChanged()
+// Control position of this control is registered for skin library when 
+// necessary in CEikDialogPage::SetDataPosition, so we do not do that in this 
+// method.
+// -----------------------------------------------------------------------------
+//
+void CCmDestinationIconMap::SizeChanged()
+    {
+    // Get the layout
+    
+    // Main pane without softkeys
+    TRect mainPaneRect;
+   
+    if ( !AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, 
+                                             mainPaneRect ) )
+       {
+       mainPaneRect = iAvkonAppUi->ClientRect();
+       }
+    
+    // Dialog layout, check variety first
+    TAknLayoutScalableParameterLimits iconMapDialogVariety = 
+               AknLayoutScalable_Avkon::popup_grid_graphic_window_ParamLimits();
+    
+    TInt maxVariety = iconMapDialogVariety.LastVariety();
+    
+    // Check the CBA, if the orientation is not landscape 
+    // there is not so much varieties
+    AknLayoutUtils::TAknCbaLocation location = AknLayoutUtils::CbaLocation();
+    // the offset for the certain cba location variety
+    TInt maxVarietyOffset = 0;
+    TInt varietyOffset = maxVariety + 1;
+    
+    // landscape variety number must be calculated offset == number of varieties
+    // same applies to the variety number for the biggest sized layout for the 
+    // variety
+    if ( Layout_Meta_Data::IsLandscapeOrientation() )
+       {
+       // the offset for one variety
+       varietyOffset = ( maxVariety + 1 ) / KAknSctCBaButtonDirections;
+       }
+    
+    // for right and left cba buttons the max variety is not zero
+    // the varities are ordered by the location of the cba and the descending 
+    // order e.g the biggest sized layout first, the smallest last
+    if ( location == AknLayoutUtils::EAknCbaLocationRight )
+       {
+       maxVarietyOffset = varietyOffset;
+       }
+    else if ( location == AknLayoutUtils::EAknCbaLocationLeft )
+       {
+       maxVarietyOffset = varietyOffset + varietyOffset; // 2*
+       }
+    
+    TInt varietyNumber = varietyOffset - iRows - 1; 
+    
+    // if more lines than possible to show, use the default 
+    // ( the biggest grid ) variety
+    if ( varietyNumber < 0 )
+       varietyNumber = 0;
+    // if zero rows, use the minimum
+    else if ( iRows<=0 )
+       varietyNumber -= 1;
+    
+    //add the varietyoffset
+    varietyNumber += maxVarietyOffset;
+    
+    if ( Layout_Meta_Data::IsLandscapeOrientation() && 
+         location == AknLayoutUtils::EAknCbaLocationRight )
+       {
+       varietyNumber = 10;
+       }
+    else
+        {
+        if ( iRows == 0 )
+            {
+            varietyNumber = 5;
+            }
+        else
+            {
+            varietyNumber = 3;
+            }            
+        
+        }       
+    
+    TAknLayoutRect popupGridLayRect;
+    popupGridLayRect.LayoutRect( mainPaneRect, 
+          AknLayoutScalable_Avkon::popup_grid_graphic_window( varietyNumber ) );
+    
+    // Calculate the size relatively
+    TRect relativeDialog( TPoint( 0,0 ),popupGridLayRect.Rect().Size() );
+    
+    // Get the layout of the actual icon grid with scrollbar
+    TAknLayoutRect gridWithScrollLayRect;
+    gridWithScrollLayRect.LayoutRect( relativeDialog, 
+       AknLayoutScalable_Avkon::listscroll_popup_graphic_pane() );
+            
+    // Then the grid area without scrollbar
+    // NOTE: The grid with scroll bar is used as reference
+    TAknLayoutRect gridLayRect;
+    gridLayRect.LayoutRect( gridWithScrollLayRect.Rect(), 
+       AknLayoutScalable_Avkon::grid_graphic_popup_pane( 0 ) );
+
+    // Different parent if SCT inside editing menu.
+    TRect contentRect = gridLayRect.Rect();
+
+    // The x coordinate is 3 pixels to right and y coordinate 3 pixels up 
+    // so substract from x coordinate and add to y coordinate
+    if ( iIsMirrored ) 
+        {
+        iOffset = TPoint( 
+            contentRect.iBr.iX - KHorizontalDialogMargin - iGridItemWidth + 1,  
+            contentRect.iTl.iY - KVerticalDialogMargin + 1 );
+        
+        iGridTopLeft.iX = contentRect.iBr.iX - 
+                          KHorizontalDialogMargin - 
+                          ( iMaxColumns * iGridItemWidth );
+        iGridTopLeft.iY = contentRect.iTl.iY - KVerticalDialogMargin;
+        }
+    else  // not mirrored
+        {
+        iOffset = TPoint( contentRect.iTl.iX - KHorizontalDialogMargin + 1, 
+                         contentRect.iTl.iY - KVerticalDialogMargin + 1 );
+        iGridTopLeft.iX = contentRect.iTl.iX - KHorizontalDialogMargin;
+        iGridTopLeft.iY = contentRect.iTl.iY - KVerticalDialogMargin;
+        }
+    
+       
+    // The last, update background context
+    if ( iExtension->iBgContext )
+       {            
+        TInt bgVariety = 0;
+        if ( Layout_Meta_Data::IsLandscapeOrientation() )
+            {
+            bgVariety = 1;
+            }
+            
+        TAknLayoutRect innerRect;
+        innerRect.LayoutRect( 
+                relativeDialog, 
+                AknLayoutScalable_Avkon::bg_popup_window_pane_g1( bgVariety ) );
+
+       iExtension->iBgContext->SetFrameRects( relativeDialog, 
+                                              innerRect.Rect() );
+       }
+    
+    TRAPD( err,UpdateScrollIndicatorL() );
+    if ( err )
+        {
+        return;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconMap::HandleResourceChange()
+// -----------------------------------------------------------------------------
+//
+void CCmDestinationIconMap::HandleResourceChange( TInt aType )
+    {
+    if ( aType == KEikDynamicLayoutVariantSwitch )
+        {
+        // save the old info for the magnitudes of the SCT grid
+        TInt oldMaxColumns = iMaxColumns;
+        //TInt oldMaxRows = 0;
+        //oldMaxRows = iRows;
+        // calculate the new magnitudes
+        DoLayout();
+        
+        // then calculate the index position of the cursor in the icon table
+        // and update the x and y positions for the new grid with it
+        
+        TInt oldCursorPosition = ( iFirstVisibleRow + iOldCursorPos.iY ) * 
+                                 oldMaxColumns +
+                                 iOldCursorPos.iX;
+        
+        TInt currentCursorPosition = ( iFirstVisibleRow + iCursorPos.iY ) * 
+                                     oldMaxColumns +
+                                     iCursorPos.iX;
+        
+        // the new first row is the top row on the page where the new focus is
+        iFirstVisibleRow = iExtension->iMaxVisibleRows * 
+                           ( currentCursorPosition / 
+                           ( iMaxColumns * iExtension->iMaxVisibleRows ) );
+        
+        // the cursor positions are relative to current page
+        iCursorPos.iY = ( currentCursorPosition - 
+                        ( iMaxColumns * iFirstVisibleRow ) ) / 
+                        iMaxColumns;
+        iCursorPos.iX = currentCursorPosition - 
+                        ( iMaxColumns * iFirstVisibleRow ) - 
+                        ( iMaxColumns * iCursorPos.iY );
+           
+        iOldCursorPos.iY = ( oldCursorPosition - 
+                           ( iMaxColumns * iFirstVisibleRow ) ) / 
+                           iMaxColumns;
+        iOldCursorPos.iX = oldCursorPosition - 
+                           ( iMaxColumns * iFirstVisibleRow ) - 
+                           ( iMaxColumns * iOldCursorPos.iY );
+        }
+
+    if ( aType == KAknsMessageSkinChange )
+        {
+        iOffscreenBgDrawn = EFalse;
+        }
+        
+    CCoeControl::HandleResourceChange( aType );   
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconMap::Draw()
+// -----------------------------------------------------------------------------
+//
+void CCmDestinationIconMap::Draw( const TRect& /*aRect*/ ) const
+    {    
+    TInt cursorPos = 0;
+    CWindowGc& gc=SystemGc();
+    
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+    MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
+    
+    TRect rect = Rect();
+    
+    // Main pane without softkeys
+    TRect mainPaneRect;
+    if ( !AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, 
+                                             mainPaneRect ) )
+       {
+       mainPaneRect = iAvkonAppUi->ClientRect();
+       }
+    
+    // Dialog layout, check variety first
+    TAknLayoutScalableParameterLimits iconMapDialogVariety = 
+       AknLayoutScalable_Avkon::popup_grid_graphic_window_ParamLimits();
+       
+    // The variety starts from 0 so add +1
+    TInt maxVariety = iconMapDialogVariety.LastVariety();
+    
+    // Check the CBA, if the orientation is not landscape 
+    // there is not so much varieties
+    AknLayoutUtils::TAknCbaLocation location = AknLayoutUtils::CbaLocation();
+    // the offset for the certain cba location variety
+    TInt maxVarietyOffset = 0;
+    TInt varietyOffset = maxVariety + 1;
+    
+    // landscape variety number must be calculated offset == number of varieties
+    // same applies to the variety number for the biggest sized layout for the 
+    // variety
+    if ( Layout_Meta_Data::IsLandscapeOrientation() )
+       {
+       // the offset for one variety
+       varietyOffset = ( maxVariety + 1 )/KAknSctCBaButtonDirections;
+       }
+    
+    // for right and left cba buttons the max variety is not zero
+    // the varities are ordered by the location of the cba and the descending 
+    // order e.g the biggest sized layout first, the smallest last
+    if ( location == AknLayoutUtils::EAknCbaLocationRight )
+       {
+       maxVarietyOffset = varietyOffset;
+       }
+    else if ( location == AknLayoutUtils::EAknCbaLocationLeft )
+       {
+       maxVarietyOffset = varietyOffset + varietyOffset; // 2*
+       }
+    
+    TInt varietyNumber = varietyOffset - iRows - 1; 
+    
+    // if more lines than possible to show, use the default 
+    // ( the biggest grid ) variety
+    if ( varietyNumber < 0 )
+        {
+        varietyNumber = 0;
+        }
+    // if zero rows, use the minimum
+    else if ( iRows<=0 )
+        {
+        varietyNumber -= 1;
+        }
+    
+    //add the varietyoffset
+    varietyNumber += maxVarietyOffset;
+
+    if ( Layout_Meta_Data::IsLandscapeOrientation() && 
+         location == AknLayoutUtils::EAknCbaLocationRight )
+        {
+        varietyNumber = 10;
+        }
+    else
+        {
+        varietyNumber = 3;
+        }    
+    // Layout the dialog size
+    TAknLayoutRect dialogLayRect;
+    dialogLayRect.LayoutRect( 
+           mainPaneRect, 
+          AknLayoutScalable_Avkon::popup_grid_graphic_window( varietyNumber ) );
+    
+    // Get the missing height for the background
+    TInt backgroundHeightOffset = dialogLayRect.Rect().Height() - rect.iBr.iY;
+    
+    rect.iBr.iY += backgroundHeightOffset;
+
+    // Check if we got an offscreen bitmap allocated for skin background and
+    // there is bitmap background in the current skin.
+    if ( iOffscreenBg && iHasBitmapBackground )
+        {
+        DrawOffscreenBackgroundIfRequired();
+        gc.BitBlt( rect.iTl, iOffscreenBg );
+        }
+    else
+        {
+        AknsDrawUtils::Background( skin, cc, this, gc, rect );
+        }
+
+    TInt numberOfIconsToBeDrawn = iConsArray->Count();
+    numberOfIconsToBeDrawn -= ( iFirstVisibleRow * iMaxColumns );
+    if ( numberOfIconsToBeDrawn > 0 )
+        {
+        if ( numberOfIconsToBeDrawn > 
+            ( iExtension->iMaxVisibleRows * iMaxColumns ) )
+            {
+            numberOfIconsToBeDrawn = iExtension->iMaxVisibleRows * iMaxColumns;
+            }
+
+        gc.SetPenStyle( CGraphicsContext::ESolidPen );    
+        gc.SetBrushStyle( CGraphicsContext::ENullBrush );
+        gc.SetPenSize( TSize( 1,1 ) );
+
+        // 2 ) Draw the grid
+        const TSize gridItemRectSize( iGridItemWidth + 1, iGridItemHeight + 1 );
+             
+        TInt numberOfGridCellsToBeDrawn = numberOfIconsToBeDrawn;
+
+        TRgb colorLine = AKN_LAF_COLOR( 219 );
+        AknsUtils::GetCachedColor( skin, 
+                                   colorLine, 
+                                   KAknsIIDQsnLineColors, 
+                                   EAknsCIQsnLineColorsCG5 );
+        TRgb colorRecentLine = AKN_LAF_COLOR( 215 );
+        AknsUtils::GetCachedColor( skin, 
+                                   colorRecentLine, 
+                                   KAknsIIDQsnLineColors, 
+                                   EAknsCIQsnLineColorsCG7 );
+
+        // default pen color
+        gc.SetPenColor( colorLine );
+        
+        TInt fullRows = numberOfGridCellsToBeDrawn / iMaxColumns;
+
+        // how many left after the full rows
+        numberOfGridCellsToBeDrawn -= fullRows * iMaxColumns;
+
+        TPoint pos = iGridTopLeft;
+
+        TInt endX = pos.iX + iGridItemWidth * iMaxColumns + 1;
+        TInt endY = pos.iY + iGridItemHeight * fullRows;
+
+        TInt ii = 0;
+
+        if ( fullRows )
+            {
+            // Draw full vertical lines
+            for ( ii = 0 ; ii <= iMaxColumns ; ii++ )
+                {
+                gc.SetPenColor( colorLine );
+                gc.SetPenSize( TSize( 1,1 ) );
+                gc.DrawLine( pos, TPoint( pos.iX, endY ) );
+                pos.iX += iGridItemWidth;
+                }
+
+                pos = iGridTopLeft;
+
+            // Draw full horizontal lines
+            for ( ii = 0 ; ii <= fullRows ; ii++ )
+                {
+                gc.SetPenSize( TSize( 1,1 ) );    
+                gc.SetPenColor( colorLine );
+                gc.DrawLine( pos, TPoint( endX, pos.iY ) );
+                pos.iY += iGridItemHeight;
+                }
+            gc.SetPenColor( colorLine );
+            gc.SetPenSize( TSize( 1,1 ) );    
+            }
+
+        if ( numberOfGridCellsToBeDrawn )
+            {
+            // Remaining cells in the last, non-full row
+            pos = iOffset;
+            // iOffset is cell area topLeft, grid is not included in it
+            pos.iX--;
+            pos.iY--;
+
+            pos.iY += iGridItemHeight * fullRows;
+
+            for ( ii = 0 ; ii < numberOfGridCellsToBeDrawn ; ii++ )
+                {
+                gc.DrawRect( TRect( pos, gridItemRectSize ) );
+
+                if ( iIsMirrored ) 
+                    pos.iX -= iGridItemWidth;
+                else // not mirrored
+                    pos.iX += iGridItemWidth; 
+                }
+            }
+        
+        TInt iconIndex = ( iCurrentPage - 1 ) * 
+                         ( iMaxColumns * iExtension->iMaxVisibleRows );
+        TInt lCnt =  iConsArray->Count(); 
+        cursorPos = iCursorPos.iX + iCursorPos.iY * iMaxColumns;
+        if ( lCnt > 0 )
+            {
+            TRect cellRect( TPoint( 0,0 ), 
+                            TSize( iGridItemWidth - 1, iGridItemHeight - 1 ) );
+            for ( TInt j = iconIndex, i = 0; 
+                  j < lCnt && i < numberOfIconsToBeDrawn;
+                  j++, i++ )
+                {
+                DrawItem( gc, CursorRect( i ), j, cursorPos == i, EFalse );        
+                }     
+            }
+            
+        }
+    iDrawnBefore = ETrue;
+    gc.DiscardFont();
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconMap::DrawItem()
+// -----------------------------------------------------------------------------
+//
+void CCmDestinationIconMap::DrawItem( 
+    CWindowGc& aGc,
+    const TRect& aSctPosition,
+    TInt aIconIndex,
+    TBool aHighlighted,
+    TBool aDrawBackground ) const
+    {
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+    MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
+    
+    TBool skins = AknsDrawUtils::Background( skin,cc,aGc, aSctPosition );    
+    TRgb color;
+    if ( !skins )
+        aGc.SetBrushStyle( CGraphicsContext::ESolidBrush );
+    if ( aHighlighted )
+        {
+        TRgb colorHightLightRect = AKN_LAF_COLOR( 215 );
+        AknsUtils::GetCachedColor( skin, 
+                                   colorHightLightRect, 
+                                   KAknsIIDQsnLineColors, 
+                                   EAknsCIQsnLineColorsCG7 );
+        aGc.SetPenColor( colorHightLightRect );
+        aGc.DrawRect( aSctPosition );
+
+        // Shrink by one pixel in all directions.
+        TRect innerRect = aSctPosition;
+        innerRect.Shrink( 1,1 );
+
+        color = AKN_LAF_COLOR( 210 );
+        AknsUtils::GetCachedColor( skin, 
+                                   color, 
+                                   KAknsIIDQsnHighlightColors, 
+                                   EAknsCIQsnHighlightColorsCG1 ); 
+        aGc.SetBrushColor( color );       
+        aGc.Clear( innerRect );
+        }
+    else if ( aDrawBackground )
+        {
+        TRect innerRect = aSctPosition;
+        aGc.SetBrushColor( AKN_LAF_COLOR( 0 ) );
+        if ( !skins )
+            {
+            aGc.Clear( innerRect );
+            }
+        else 
+            {
+            AknsDrawUtils::Background( skin, cc, this, aGc, innerRect );
+            }
+        }
+    
+    if ( iConsArray )
+        {
+        TInt lCnt =  iConsArray->Count(); 
+        if ( lCnt > 0 && aIconIndex < lCnt && aIconIndex >= 0 )
+            {
+            TRect cellRect( TPoint( 0,0 ), 
+                            TSize( iGridItemWidth - 1, iGridItemHeight - 1 ) );
+
+            CGulIcon* bitmap = NULL;
+            bitmap = iConsArray->At( aIconIndex );
+            TInt numIconsInaPage = iExtension->iMaxVisibleRows * iMaxColumns;
+            TInt cellIndex = aIconIndex;
+            if ( aIconIndex >= numIconsInaPage )
+                {
+                cellIndex = aIconIndex % numIconsInaPage;
+                }
+            aGc.BitBltMasked( CursorPoint( cellIndex ),
+                            bitmap->Bitmap(),
+                            cellRect,
+                            bitmap->Mask(),
+                            EFalse );
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconMap::DrawCursor()
+// Optimizes drawing. Only cursor is drawn.
+// -----------------------------------------------------------------------------
+void CCmDestinationIconMap::DrawCursor() const
+    {
+    // Whole Icon Map has to be drawn at least once. 
+    // If the user presses arrow key before Icon Map has been drawn,
+    // only cursor position is drawn without this check.
+    if ( !iDrawnBefore )
+        {
+        DrawNow();
+        }
+    // Only redraw old and new cursor position cells
+    ActivateGc();
+    CWindowGc& gc = SystemGc();
+
+    TInt cursorPos = iOldCursorPos.iX + iOldCursorPos.iY * iMaxColumns;   
+    DrawCell( cursorPos, EFalse );
+
+    cursorPos = iCursorPos.iX + iCursorPos.iY * iMaxColumns;
+    DrawCell( cursorPos, ETrue );
+
+    gc.DiscardFont();
+    DeactivateGc();
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconMap::DrawCell
+// -----------------------------------------------------------------------------
+//
+void CCmDestinationIconMap::DrawCell( 
+    TInt aCursorPos,
+    TBool aHighlighted ) const
+    {
+    // calculate icon index
+    TInt iconIndex = aCursorPos + iFirstVisibleRow * iMaxColumns;
+
+    // If we are only redrawing for animations, no need to draw non-animated
+    // items.
+    TRect rect = CursorRect( aCursorPos );
+
+    Window().Invalidate( rect );
+    Window().BeginRedraw( rect );
+    DrawItem( SystemGc(), rect, iconIndex, aHighlighted, ETrue );
+    Window().EndRedraw();
+    SystemGc().DiscardFont();
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconMap::CursorRect
+// -----------------------------------------------------------------------------
+//
+TRect CCmDestinationIconMap::CursorRect( TInt aCursorPos ) const
+    {
+    TPoint pos = iOffset;
+
+    if ( iIsMirrored )
+        {
+        pos.iX -= ( aCursorPos % iMaxColumns ) * iGridItemWidth;
+        }
+    else // Not mirrored
+        {
+        pos.iX += ( aCursorPos % iMaxColumns ) * iGridItemWidth;
+        }
+
+    pos.iY += ( aCursorPos / iMaxColumns ) * iGridItemHeight; 
+    return TRect( pos, TSize( iGridItemWidth - 1, iGridItemHeight - 1 ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconMap::CursorPoint
+// -----------------------------------------------------------------------------
+//
+TPoint CCmDestinationIconMap::CursorPoint( TInt aCursorPos ) const
+    {
+    TPoint pos = iOffset;
+
+    if ( iIsMirrored )
+        {
+        pos.iX -= ( aCursorPos % iMaxColumns ) * iGridItemWidth;
+        }
+    else // Not mirrored
+        {
+        pos.iX += ( aCursorPos % iMaxColumns ) * iGridItemWidth;
+        }
+
+    pos.iY += ( aCursorPos / iMaxColumns ) * iGridItemHeight; 
+    return pos;
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconMap::MoveCursorL
+// -----------------------------------------------------------------------------
+//
+void CCmDestinationIconMap::MoveCursorL( TInt aDeltaX, TInt aDeltaY )
+    {           
+    if ( iIsMirrored )
+        aDeltaX = -aDeltaX;
+    
+    if ( ( iConsArray->Count() < 8 ) )
+       return;
+
+    iOldCursorPos = iCursorPos;
+    TInt oldFirstVisibleRow = iFirstVisibleRow;
+
+    TInt globalYPos = iCursorPos.iY + iFirstVisibleRow;
+    TInt lastColumnOnLastRow = ( ( iConsArray->Count() - 1 ) % iMaxColumns );
+
+    TInt skipicon = aDeltaX != 0 ? 1: 0;
+
+    if ( aDeltaX < 0 )
+        {
+        // Cursor was moved to left.
+        if ( iCursorPos.iX > skipicon - 1 )
+            {
+            iCursorPos.iX -= skipicon;
+            }
+        else
+            {
+            if ( skipicon > iMaxColumns )
+                {
+                globalYPos--;
+                iCursorPos.iX = iMaxColumns;
+                }
+            // Go to previous line
+            globalYPos--;
+            if ( globalYPos < 0 )
+                {
+                // Cursor was on the first line - go to last line.
+                globalYPos = iRows - 1;
+                // x - position to the last item on the last row.
+                iCursorPos.iX = lastColumnOnLastRow;
+                }
+            else
+                {
+                // x - position to last column.
+                iCursorPos.iX = iMaxColumns - skipicon;
+                }
+            }
+        }
+
+    if ( aDeltaX > 0 )
+        {
+        // Cursor was moved to right.
+        if ( globalYPos < iRows - 1 )
+            {
+            // Not in the last row.
+            if ( iCursorPos.iX < iMaxColumns - skipicon )
+                {
+                // If not on the last columns, move cursor to next column.
+                iCursorPos.iX += skipicon;
+                }
+            else
+                {
+                // Cursor was on last column,
+                // move to first column of the next line.
+                iCursorPos.iX = 0;
+                globalYPos++;
+                }
+            }
+        else
+            {
+            // Currently on the last row.
+            if ( iCursorPos.iX < lastColumnOnLastRow )
+                {
+                // If there are more items on this row, move cursor to next item.
+                iCursorPos.iX++;
+                }
+            else
+                {
+                // No more item on the current row.
+                // Move to first item on the first row.
+                iCursorPos.iX = 0;
+                globalYPos = 0;
+                }
+            }
+        }
+
+    if ( aDeltaY < 0 )
+        {
+        iCursorPos.iX -= skipicon;
+        if ( iCursorPos.iX < 0 )
+            {
+            iCursorPos.iX += ( iMaxColumns - 1 );
+            globalYPos--;
+            }
+        // Cursor was moved to up.
+        if ( globalYPos > 0 )
+            {
+            // Cursor was not on the first line - move it to previous row.
+            globalYPos--;
+            }
+        else
+            {
+            // Move cursot to last to row.
+            globalYPos = iRows - 1;
+            if ( iCursorPos.iX > lastColumnOnLastRow )
+                {
+                // No items in the current column on the last row - 
+                // move cursor to last item on the row.
+                iCursorPos.iX = lastColumnOnLastRow;
+                }
+            }
+        }
+    
+    if ( aDeltaY > 0 )
+        {
+        iCursorPos.iX = ( iCursorPos.iX + skipicon ) % iMaxColumns;
+        globalYPos += ( iCursorPos.iX + skipicon ) / iMaxColumns;
+        // Cursor was moved to down.
+        if ( globalYPos < iRows - 1 )
+            {
+            // Cursor is not on the last row. Move cursor to next row.
+            globalYPos++;
+            if ( globalYPos == iRows - 1 && 
+                 iCursorPos.iX > lastColumnOnLastRow )
+                {
+                // No items in the current column on the last row - 
+                // move cursor to last item on the row.
+                iCursorPos.iX = lastColumnOnLastRow;
+                }
+            }
+        else 
+            {
+            // Cursor was at the last row - move it to the first row.
+            globalYPos = 0;
+            }        
+        }
+    iCursorPos.iY = globalYPos - iFirstVisibleRow;
+
+    if ( globalYPos < iFirstVisibleRow )
+        {
+        // Cursor was moved from the top row.
+        if ( globalYPos <= 0 )
+            {
+            iFirstVisibleRow = 0;
+            iCursorPos = TPoint( iCursorPos.iX, 0 );
+            }
+        else
+            {
+            // If cursor was moved up out of the visible area - show it again.
+            iFirstVisibleRow -= iExtension->iMaxVisibleRows;
+            iCursorPos = TPoint( iCursorPos.iX, 
+                                 iExtension->iMaxVisibleRows - 1 );
+            }
+        }
+    
+    if ( globalYPos > iFirstVisibleRow + iExtension->iMaxVisibleRows - 1 )
+        {
+        if ( globalYPos == iRows - 1 )
+            {
+            // When cursor has moved from the top line,
+            // it is adjusted to a page boundary.
+            iCursorPos = TPoint( 
+                iCursorPos.iX,
+                ( iRows - 1 ) % iExtension->iMaxVisibleRows
+                );
+            iFirstVisibleRow = ( ( iRows - 1 ) / iExtension->iMaxVisibleRows ) * 
+                               iExtension->iMaxVisibleRows;
+            }
+        else
+            {
+            // If cursor was moved down out of the visible area - show it again.
+            iFirstVisibleRow += iExtension->iMaxVisibleRows;
+            iCursorPos = TPoint( iCursorPos.iX, 0 );
+            }
+        }
+       
+    //TInt increment( 1 );
+    //if ( aDeltaY < 0 || aDeltaX < 0 )
+    //    {
+    ////    increment = -1;
+    //    }
+    if ( iRows > iExtension->iMaxVisibleRows && 
+        ( iOldCursorPos.iY + oldFirstVisibleRow != 
+          iCursorPos.iY + iFirstVisibleRow ) )
+        {
+        UpdateScrollIndicatorL();
+        }
+
+    if ( oldFirstVisibleRow == iFirstVisibleRow )
+        {
+        // Draw only cursor if the view to the content was not scrolled.
+        DrawCursor();
+        }
+    else
+        {
+        DrawNow();
+        }
+
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconMap::UpdateScrollIndicatorL()
+// -----------------------------------------------------------------------------
+//
+void CCmDestinationIconMap::UpdateScrollIndicatorL()
+    {    
+    if ( !iSBFrame )
+        {
+        return;
+        }
+    TEikScrollBarModel hSbarModel;
+    TEikScrollBarModel vSbarModel;
+    
+    TEikScrollBarFrameLayout layout;
+    
+    // Main pane without softkeys
+    TRect mainPaneRect;
+    if ( !AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, 
+                                             mainPaneRect ) )
+       {
+       mainPaneRect = iAvkonAppUi->ClientRect();
+       }
+        
+    // Dialog layout, check variety first
+    TAknLayoutScalableParameterLimits iconMapDialogVariety = 
+       AknLayoutScalable_Avkon::popup_grid_graphic_window_ParamLimits();
+    
+    TInt maxVariety = iconMapDialogVariety.LastVariety();
+    
+    // Check the CBA, if the orientation is not landscape 
+    // there is not so much varieties
+    AknLayoutUtils::TAknCbaLocation location = AknLayoutUtils::CbaLocation();
+    // the offset for the certain cba location variety
+    TInt maxVarietyOffset = 0;
+    TInt varietyOffset = maxVariety + 1;
+    
+    // landscape variety number must be calculated offset == number of varieties
+    // same applies to the variety number for the biggest sized layout for the 
+    // variety
+    if ( Layout_Meta_Data::IsLandscapeOrientation() )
+       {
+       // the offset for one variety
+       varietyOffset = ( maxVariety + 1 )/KAknSctCBaButtonDirections;
+       }
+    
+    // for right and left cba buttons the max variety is not zero
+    // the varities are ordered by the location of the cba and the descending 
+    // order e.g the biggest sized layout first, the smallest last
+    if ( location == AknLayoutUtils::EAknCbaLocationRight )
+       {
+       maxVarietyOffset = varietyOffset;
+       }
+    else if ( location == AknLayoutUtils::EAknCbaLocationLeft )
+       {
+       maxVarietyOffset = varietyOffset + varietyOffset; // 2*
+       }
+    
+    TInt varietyNumber = varietyOffset - iRows - 1; 
+    
+    // if more lines than possible to show, use the default 
+    // ( the biggest grid ) variety
+    if ( varietyNumber < 0 )
+        {
+        varietyNumber = 0;
+        }
+    // if zero rows, use the minimum
+    else if ( iRows <= 0 )
+        {
+        varietyNumber -= 1;
+        }
+    
+    //add the varietyoffset
+    varietyNumber += maxVarietyOffset;
+
+    if ( Layout_Meta_Data::IsLandscapeOrientation() && 
+         location == AknLayoutUtils::EAknCbaLocationRight )
+       {
+       varietyNumber = 10;
+       }
+    else
+        {
+        varietyNumber = 3;
+        }     
+    // Layout the dialog size
+    TAknLayoutRect dialogLayRect;
+    dialogLayRect.LayoutRect( mainPaneRect, 
+       AknLayoutScalable_Avkon::popup_grid_graphic_window( varietyNumber ) );
+    
+    TRect dialogRect = dialogLayRect.Rect();
+    
+    // Get the layout of the actual icon grid with scrollbar
+    TAknLayoutRect gridWithScrollLayRect;
+       
+    gridWithScrollLayRect.LayoutRect( 
+                    TRect( TPoint( 0,0 ),
+                    TSize( dialogRect.Size() ) ), 
+                    AknLayoutScalable_Avkon::listscroll_popup_graphic_pane() );
+
+    // Calculate the relative rect for the grid
+    TRect parent = gridWithScrollLayRect.Rect();
+    
+    TAknWindowComponentLayout scrollbarLayout = 
+                                    AknLayoutScalable_Avkon::scroll_pane_cp5();
+    
+    iCurrentPage = ( iFirstVisibleRow / iExtension->iMaxVisibleRows ) + 1;
+
+    vSbarModel.iScrollSpan = iNumPages * iExtension->iMaxVisibleRows;
+    vSbarModel.iThumbSpan = iExtension->iMaxVisibleRows;
+    
+    if ( iSBFrame && iSBFrame->TypeOfVScrollBar() == 
+         CEikScrollBarFrame::EDoubleSpan )
+        {    
+        // For EDoubleSpan type scrollbar
+        vSbarModel.iThumbPosition = ( iCurrentPage - 1 ) * 
+                                    iExtension->iMaxVisibleRows;
+        TAknDoubleSpanScrollBarModel hDsSbarModel( hSbarModel );
+        TAknDoubleSpanScrollBarModel vDsSbarModel( vSbarModel );
+        
+        // The y coordinate must be sifted 3 pixels up and x 3 to left
+        parent.iTl.iY -= KVerticalDialogMargin;
+        parent.iBr.iY -= KVerticalDialogMargin;        
+        parent.iTl.iX -= KHorizontalDialogMargin;
+        parent.iBr.iX -= KHorizontalDialogMargin;
+        
+        layout.iTilingMode = TEikScrollBarFrameLayout::EInclusiveRectConstant;
+        iSBFrame->Tile( &vDsSbarModel ); 
+        AknLayoutUtils::LayoutVerticalScrollBar( iSBFrame, 
+                                                 parent, 
+                                                 scrollbarLayout );       
+        iSBFrame->SetVFocusPosToThumbPos( vDsSbarModel.FocusPosition() );
+        }
+    else
+        {
+        // For EArrowHead type scrollbar
+        vSbarModel.iThumbPosition = iCursorPos.iY + iFirstVisibleRow;
+        iSBFrame->TileL( &hSbarModel,&vSbarModel,parent,parent,layout );        
+        iSBFrame->SetVFocusPosToThumbPos( vSbarModel.iThumbPosition );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconMap::Reserved_1()
+// -----------------------------------------------------------------------------
+//
+void CCmDestinationIconMap::Reserved_1()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconMap::Reserved_2()
+// -----------------------------------------------------------------------------
+//
+void CCmDestinationIconMap::Reserved_2()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconMap::DrawOffscreenBackgroundIfRequired
+// 
+// -----------------------------------------------------------------------------
+//
+void CCmDestinationIconMap::DrawOffscreenBackgroundIfRequired() const
+    {
+    if ( iOffscreenBg && iHasBitmapBackground )
+        {
+        if ( !iOffscreenBgDrawn )
+            {
+            TRect mainPaneRect;
+            if ( !AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, 
+                                                     mainPaneRect ) )
+               {
+               mainPaneRect = iAvkonAppUi->ClientRect();
+               }
+            
+            // Dialog layout, check variety first
+            TAknLayoutScalableParameterLimits iconMapDialogVariety = 
+               AknLayoutScalable_Avkon::popup_grid_graphic_window_ParamLimits();
+            
+            TInt maxVariety = iconMapDialogVariety.LastVariety();
+            
+            // Check the CBA, if the orientation is not landscape 
+            // there is not so much varieties
+            AknLayoutUtils::TAknCbaLocation location = 
+                                                  AknLayoutUtils::CbaLocation();
+            // the offset for the certain cba location variety
+            TInt maxVarietyOffset = 0;
+            TInt varietyOffset = maxVariety + 1;
+            
+            // landscape variety number must be calculated offset == number of 
+            // varieties same applies to the variety number for the biggest 
+            // sized layout for the variety
+            if ( Layout_Meta_Data::IsLandscapeOrientation() )
+               {
+               // the offset for one variety
+               varietyOffset = ( maxVariety + 1 )/KAknSctCBaButtonDirections;
+               }
+            
+            // for right and left cba buttons the max variety is not zero
+            // the varities are ordered by the location of the cba and the 
+            // descending order e.g the biggest sized layout first, the smallest last
+            if ( location == AknLayoutUtils::EAknCbaLocationRight )
+               {
+               maxVarietyOffset = varietyOffset;
+               }
+            else if ( location == AknLayoutUtils::EAknCbaLocationLeft )
+               {
+               maxVarietyOffset = varietyOffset + varietyOffset; // 2*
+               }   
+            TInt varietyNumber = varietyOffset - iRows - 1; 
+            
+            // if more lines than possible to show, use the default 
+            // ( the biggest grid ) variety
+            if ( varietyNumber < 0 )
+                {
+                varietyNumber = 0;
+                }
+            // if zero rows, use the minimum
+            else if ( iRows<=0 )
+                {
+                varietyNumber -= 1;
+                }
+            
+            //add the varietyoffset
+            varietyNumber += maxVarietyOffset;
+                   
+            TAknLayoutRect popupGridLayRect;
+            popupGridLayRect.LayoutRect( mainPaneRect, 
+               AknLayoutScalable_Avkon::popup_grid_graphic_window( 5 ) );
+            
+            TRect popupGridRect = popupGridLayRect.Rect();
+            
+            // set the top left height as the control starting point
+            popupGridRect.iTl.iY = Rect().iTl.iY;
+            
+            //if ( popupGridRect.iBr.iY < mainPaneRect.iBr.iY )
+            //    popupGridRect.iBr.iY = mainPaneRect.iBr.iY
+            MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+            MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
+            
+            // draw to upper left corner, and normalize the retangle to 
+            // fact that the dialog starts from coordinates ( 0,0 ), 
+            // so the y-coordinate is correct ( heading pane ) 
+            // but x must be set to zero
+            TPoint point = TPoint( 0, 0 );
+            popupGridRect.Move( -popupGridRect.iTl.iX,0 );
+            
+            AknsDrawUtils::DrawBackground( skin,
+                                           cc,
+                                           this,
+                                           *iBitmapGc,
+                                           point,
+                                           popupGridRect,
+                                           KAknsDrawParamDefault );
+
+            iOffscreenBgDrawn = ETrue;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconMap::ComponentControl( TInt aIndex ) const
+// Return the controll pointer
+// -----------------------------------------------------------------------------
+//
+CCoeControl* CCmDestinationIconMap::ComponentControl( TInt aIndex ) const
+    {
+    if ( aIndex == 0 && 
+         iSBFrame && 
+         iSBFrame->TypeOfVScrollBar() == CEikScrollBarFrame::EDoubleSpan )
+        {    
+        return iSBFrame->VerticalScrollBar();
+        }
+    else
+        {
+        return NULL;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconMap::CountComponentControls()
+// Return no of controll to be placed on the container control
+// -----------------------------------------------------------------------------
+// 
+TInt CCmDestinationIconMap::CountComponentControls() const
+    {
+    if ( iSBFrame && 
+         iSBFrame->TypeOfVScrollBar() == CEikScrollBarFrame::EDoubleSpan )
+        {    
+        return 1;
+        }
+    else
+        {
+        return 0;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconMap::CountMaxColumnsAndCellSizes
+// Counts no of columns and the cell size will be displayed in the icon table
+// -----------------------------------------------------------------------------
+//
+void CCmDestinationIconMap::CountMaxColumnsAndCellSizes()
+    {    
+    TRect cellRect; // retangle of one item in grid
+    TRect gridRect; // retangle of the grid contaning the items
+    
+    // 1. Get the layout 
+    
+    // Get the parent rect
+    TRect mainPaneRect;
+    if ( !AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, 
+                                             mainPaneRect ) )
+       {
+       mainPaneRect = iAvkonAppUi->ClientRect();
+       }
+    
+    // Calculate the layout of the whole popup with the biggest possible -> 0
+    // Dialog layout, check variety first
+    
+    // Get the layout rect of the dialog
+    
+    // Check variety first
+    TAknLayoutScalableParameterLimits iconMapDialogVariety = 
+        AknLayoutScalable_Avkon::popup_grid_graphic_window_ParamLimits();
+    
+    TInt maxVariety = iconMapDialogVariety.LastVariety();
+    
+    // Check the CBA, if the orientation is not landscape 
+    // there is not so much varieties
+    AknLayoutUtils::TAknCbaLocation location = AknLayoutUtils::CbaLocation();
+    // the offset for the certain cba location variety
+    TInt maxVarietyOffset = 0;
+    TInt varietyOffset = maxVariety + 1; // the number of varieties
+        
+    // landscape variety number must be calculated offset == number of varieties
+    // same applies to the variety number for the biggest sized layout for the 
+    // variety
+    if ( Layout_Meta_Data::IsLandscapeOrientation() )
+       {
+       // the offset for one variety
+       varietyOffset = ( maxVariety + 1 ) / KAknSctCBaButtonDirections;
+       }
+       
+    if ( location == AknLayoutUtils::EAknCbaLocationRight )
+       {
+       maxVarietyOffset = varietyOffset;
+       }
+    else if ( location == AknLayoutUtils::EAknCbaLocationLeft )
+       {
+       maxVarietyOffset = varietyOffset + varietyOffset; // 2*
+       }
+    
+    TAknLayoutRect popupGridLayRect;
+    popupGridLayRect.LayoutRect( mainPaneRect,
+       AknLayoutScalable_Avkon::popup_grid_graphic_window( maxVarietyOffset ) );
+    
+    // Get the layout of the actual icon grid with scrollbar
+    TAknLayoutRect gridWithScrollLayRect;
+    gridWithScrollLayRect.LayoutRect( popupGridLayRect.Rect(), 
+       AknLayoutScalable_Avkon::listscroll_popup_graphic_pane() );
+    
+    // Then the grid area without scrollbar
+    // NOTE: The grid with scroll bar is used as reference
+    TAknLayoutRect gridLayRect;
+    gridLayRect.LayoutRect( gridWithScrollLayRect.Rect(), 
+       AknLayoutScalable_Avkon::grid_graphic_popup_pane( 0 ) );
+
+    // Different parent if SCT inside editing menu.
+    TRect rect = Rect();
+    gridRect = gridLayRect.Rect();
+    // cell size, AGAIN 7 item
+    TAknLayoutRect cellLayRect;
+    cellLayRect.LayoutRect( 
+                    gridRect, 
+                    AknLayoutScalable_Avkon::cell_graphic_popup_pane( 0,0,0 ) );
+
+    cellRect = cellLayRect.Rect();
+        
+    // 2. Calculate width related
+    // - item width
+    // - max number of columns
+    
+    // Width of the items area
+    TInt gridWidth = gridRect.Width();
+    
+    // Width of one item
+    TInt cellWidth = cellRect.Width();
+  
+     // ensure the item width and store it
+    TAknLayoutRect secondCellLayRect;
+    secondCellLayRect.LayoutRect( gridRect, 
+                    AknLayoutScalable_Avkon::cell_graphic_popup_pane( 0,1,0 ) );
+       
+    iGridItemWidth = secondCellLayRect.Rect().iTl.iX - 
+                     cellLayRect.Rect().iTl.iX;
+    
+    if ( iGridItemWidth < 0 )
+        {
+        // The result is negative with lay file data if the layout is mirrored.
+        iGridItemWidth = -iGridItemWidth;
+        }
+    
+    // Calculate the amount of columns
+    iMaxColumns = gridWidth / cellWidth;
+    
+    
+    // 2. Calculate height related
+    // - item height
+    // - max number of rows
+        
+    // Get the grid height
+    // NOTE: in landscape the LAF is wrong so use the main panes height
+    TInt gridHeight = gridRect.Height();
+    
+    // get the item height
+    TInt cellHeight = cellRect.Height();
+    
+    // calculate the number of items fitting to grid
+    iExtension->iMaxVisibleRows = 3;//gridHeight / cellHeight;
+    
+    // Store the item height
+    TAknLayoutRect secondRowLayRect;
+    secondRowLayRect.LayoutRect( gridLayRect.Rect(), 
+       AknLayoutScalable_Avkon::cell_graphic_popup_pane( 0,0,1 ) );
+
+    iGridItemHeight = secondRowLayRect.Rect().iTl.iY - 
+                      cellLayRect.Rect().iTl.iY;
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconMap::HandleScrollEventL
+// Handles the different scroll events so that the map reacts accordingly.
+// -----------------------------------------------------------------------------
+// 
+void CCmDestinationIconMap::HandleScrollEventL( CEikScrollBar* aScrollBar, 
+                                                TEikScrollEvent aEventType )
+    {
+    TBool update = EFalse;
+    
+    switch ( aEventType )
+        {       
+        case EEikScrollUp:
+        case EEikScrollPageUp:
+            {           
+            // nothing done if we are already on the first page.
+            if ( iFirstVisibleRow != 0 )
+                {               
+                iFirstVisibleRow -= iExtension->iMaxVisibleRows;             
+                update = ETrue;
+                }
+            UpdateScrollIndicatorL();
+            }
+            break;
+        
+        case EEikScrollDown:
+        case EEikScrollPageDown:
+            {           
+            // nothing done if we are already on the last page.
+            if ( iFirstVisibleRow != iRows/iExtension->iMaxVisibleRows * 
+                                     iExtension->iMaxVisibleRows )
+                {
+                iFirstVisibleRow += iExtension->iMaxVisibleRows;
+                update = ETrue;
+                }
+            UpdateScrollIndicatorL();
+            }
+            break;   
+               
+        case EEikScrollThumbDragVert:
+            {           
+            TInt thumbPosition;         
+            TInt halfPage = iExtension->iMaxVisibleRows/2;
+            // Ask which type of scrollbar is shown
+            //CAknAppUi* appUi = iAvkonAppUi;            
+            TBool isDoubleSpan = 
+                CEikScrollBarFrame::EDoubleSpan == iSBFrame->TypeOfVScrollBar();
+            if ( isDoubleSpan )
+                {
+                thumbPosition = static_cast <const TAknDoubleSpanScrollBarModel*>( 
+                                            aScrollBar->Model() )->FocusPosition();
+                }
+            else
+                {
+                thumbPosition = aScrollBar->Model()->iThumbPosition;
+                }
+
+            // If the slider is in the range of less then a half page from a 
+            // possible correct thumb position. thus 0 <= iFirstVisibleRow - 
+            // thumbPosition < halfPage. Or in the other direction:
+            // 0 <= thumbPosition - iFirstVisibleRow < halfPage
+            if ( !( ( 0 <= iFirstVisibleRow - thumbPosition &&
+                        iFirstVisibleRow - thumbPosition < halfPage )||                         
+                  ( 0 <= thumbPosition - iFirstVisibleRow && 
+                        thumbPosition - iFirstVisibleRow < halfPage ) ) )
+                {               
+                TReal toRound = thumbPosition / 
+                                ( TReal )iExtension->iMaxVisibleRows;
+                if ( toRound * 2 > ( TInt )toRound * 2 + 1 )
+                    {
+                    toRound++;
+                    }                  
+                iFirstVisibleRow = ( TInt )toRound * 
+                                   iExtension->iMaxVisibleRows;
+                update = ETrue;
+                }
+            }
+            break;
+        
+        case EEikScrollThumbReleaseVert:
+            {
+            UpdateScrollIndicatorL();
+            }
+            break;
+        
+        case EEikScrollLeft: // flow through            
+        case EEikScrollRight: // flow through
+        case EEikScrollPageLeft: // flow through
+        case EEikScrollPageRight: // flow through
+        case EEikScrollThumbDragHoriz: // flow through
+        case EEikScrollThumbReleaseHoriz: // flow through
+            // do nothing
+            break;  
+            
+        default: 
+            // do nothing
+            break; 
+        }
+        
+    // If we have moved down to the last page we check that the cursor is in 
+    // a place where it can be drawn.       
+    if ( iFirstVisibleRow == 
+         iRows/iExtension->iMaxVisibleRows * iExtension->iMaxVisibleRows )
+        {
+        // the old cursor is set to a "safe" position where it at least can be.
+        iOldCursorPos.iX = 0;
+        iOldCursorPos.iY = 0;                                                    
+        // if the last page has only one line which isn't filled complitely.
+        if ( ( iConsArray->Count() % iMaxColumns - 1 < iCursorPos.iX ) && 
+             ( iRows % iExtension->iMaxVisibleRows ) == 1 )
+            {
+            iCursorPos.iX = iConsArray->Count()%iMaxColumns - 1;
+            }                        
+        // If the cursor is in a position where it would go unto a spot without 
+        // a icon when scrolled.
+        if ( iCursorPos.iY + iFirstVisibleRow >= iRows )
+            {                        
+            if ( iConsArray->Count() % iMaxColumns > iCursorPos.iX )
+                {                                                      
+                iCursorPos.iY = iRows - 1 - iFirstVisibleRow;                             
+                }
+            else
+                {                            
+                iCursorPos.iY = iRows - 2 - iFirstVisibleRow;
+                } 
+            }
+        // If the cursor is actually on the last row, but is still in the
+        // area where there is now icons. ( the rest of the last row )
+        if ( ( iConsArray->Count() <= ( iFirstVisibleRow + iCursorPos.iY ) 
+                                        * iMaxColumns + iCursorPos.iX ) &&
+             ( iCursorPos.iY + iFirstVisibleRow + 1 == iRows ) )
+            {
+            iCursorPos.iY--;
+            }
+        // if the corrections did not help and the cursor is in the area
+        // where there is a valid row, but no icons anymore
+        }
+        
+    // to avoid flicker we draw only if there really was something new to draw.
+    if ( update )
+        {              
+        if ( iExtension->iObserver )
+            {
+            iExtension->iObserver->HandleControlEventL( 
+                                      this, 
+                                      MCoeControlObserver::EEventRequestFocus );
+            } 
+        DrawDeferred();    
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationIconMap::Extension
+// -----------------------------------------------------------------------------
+//
+CCmDestinationIconMapExtension* CCmDestinationIconMap::Extension() const
+    {
+    return iExtension;
+    }    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Src/cmdestination.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,662 @@
+/*
+* 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 RCmDestination
+*
+*/
+
+#include <cmdestination.h>
+#include "cmdestinationimpl.h"
+#include "cmmanagerimpl.h"
+#include <cmpluginbaseeng.h>
+#include <cmpluginbase.h>
+
+using namespace CMManager;
+
+// -----------------------------------------------------------------------------
+// RCmDestination::Close()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RCmDestination::Close()
+    {
+    if( !iDestinatonData )
+        {
+        return;
+        }
+
+    iDestinatonData->Cmmgr()->RemoveDestFromPool(iDestinatonData);     
+    iDestinatonData = NULL;
+    }
+    
+
+// -----------------------------------------------------------------------------
+// RCmDestination::~RCmDestination()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C RCmDestination::~RCmDestination()
+    {
+    Close();
+    }
+
+
+// -----------------------------------------------------------------------------
+// RCmDestination::RCmDestination( RCmDestination& )
+// -----------------------------------------------------------------------------
+//
+EXPORT_C RCmDestination::RCmDestination(
+                                const RCmDestination& aCmDestination)    
+    : iDestinatonData( aCmDestination.iDestinatonData )
+    {
+    iDestinatonData->IncrementRefCounter();
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// RCmDestination::RCmDestination::operator=()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C RCmDestination& RCmDestination::operator=(
+                                const RCmDestination& aCmDestination)
+    {
+    if (this != &aCmDestination) 
+        {
+        delete iDestinatonData;
+        iDestinatonData = aCmDestination.iDestinatonData;        
+        iDestinatonData->IncrementRefCounter();
+        }
+    return *this;
+    }
+
+// -----------------------------------------------------------------------------
+// RCmDestination::ConnectionMethodCount()
+// -----------------------------------------------------------------------------
+//        
+EXPORT_C TInt RCmDestination::ConnectionMethodCount() const    
+    {
+    __ASSERT_ALWAYS( iDestinatonData, User::Panic(_L( "CMManager" ), KErrBadHandle ) );
+
+    return iDestinatonData->ConnectionMethodCount();
+    };
+        
+// -----------------------------------------------------------------------------
+// RCmDestination::ConnectionMethodL
+// -----------------------------------------------------------------------------
+//     
+EXPORT_C RCmConnectionMethod 
+                            RCmDestination::ConnectionMethodL( TInt anIndex ) const
+    {
+    if (!iDestinatonData)
+        {
+        User::Leave(KErrBadHandle);
+        }
+
+    RCmConnectionMethod cm;
+    CCmDestinationImpl* aImplementation = 
+            CCmDestinationImpl::NewLC(iDestinatonData);
+    // Deleting aImplementation will decrement the ref counter
+    iDestinatonData->IncrementRefCounter();
+    cm.iImplementation = 
+        aImplementation->GetConnectionMethodL( anIndex )->Plugin();
+    //CCmDestinationImpl::GetConnectionMethodL doesn't give ownership
+    cm.iImplementation->IncrementRefCounter();
+    CleanupStack::PopAndDestroy(aImplementation);
+    
+    return cm;
+    }
+
+// -----------------------------------------------------------------------------
+// RCmDestination::ConnectionMethodByIDL
+// -----------------------------------------------------------------------------
+//     
+EXPORT_C RCmConnectionMethod 
+                        RCmDestination::ConnectionMethodByIDL( TInt aIapId ) const
+    {
+    if (!iDestinatonData)
+        {
+        User::Leave(KErrBadHandle);
+        }
+
+    RCmConnectionMethod cm;
+    
+    CCmDestinationImpl* aImplementation = 
+            CCmDestinationImpl::NewLC(iDestinatonData);
+    // Deleting aImplementation will decrement the ref counter
+    iDestinatonData->IncrementRefCounter();
+    cm.iImplementation = 
+        aImplementation->ConnectionMethodByIDL( aIapId )->Plugin();
+    //CCmDestinationImpl::ConnectionMethodByIDL doesn't give ownership
+    cm.iImplementation->IncrementRefCounter();
+    CleanupStack::PopAndDestroy(aImplementation);
+    
+    return cm;
+    }
+
+// -----------------------------------------------------------------------------
+// RCmDestination::PriorityL()
+// -----------------------------------------------------------------------------
+//        
+EXPORT_C TUint RCmDestination::PriorityL(const RCmConnectionMethod& aCCMItem ) const
+    {
+    if (!iDestinatonData)
+        {
+        User::Leave(KErrBadHandle);
+        }
+
+    CCmDestinationImpl* aImplementation = 
+            CCmDestinationImpl::NewLC(iDestinatonData);
+    // Deleting aImplementation will decrement the ref counter
+    iDestinatonData->IncrementRefCounter();
+    TUint retValue = aImplementation->PriorityL( *aCCMItem.iImplementation );
+    CleanupStack::PopAndDestroy(aImplementation);
+    return retValue;
+    }
+
+// -----------------------------------------------------------------------------
+// RCmDestination::NameLC()
+// -----------------------------------------------------------------------------
+//        
+EXPORT_C HBufC* RCmDestination::NameLC ( ) const
+    {
+    if (!iDestinatonData)
+        {
+        User::Leave(KErrBadHandle);
+        }
+
+    CCmDestinationImpl* aImplementation = 
+            CCmDestinationImpl::NewLC(iDestinatonData);
+    // Deleting aImplementation will decrement the ref counter
+    iDestinatonData->IncrementRefCounter();
+    HBufC* retValue = aImplementation->NameLC();
+    CleanupStack::Pop(retValue);
+    CleanupStack::PopAndDestroy(aImplementation);
+    CleanupStack::PushL(retValue);
+    return retValue;
+    };
+
+// -----------------------------------------------------------------------------
+// RCmDestination::Id()
+// -----------------------------------------------------------------------------
+//        
+EXPORT_C TUint32 RCmDestination::Id() const
+    {
+    __ASSERT_ALWAYS( iDestinatonData, User::Panic(_L( "CMManager" ), 
+                                                  KErrBadHandle ) );
+    
+    return iDestinatonData->Id();
+    }
+
+// -----------------------------------------------------------------------------
+// RCmDestination::ElementId()
+// -----------------------------------------------------------------------------
+//        
+EXPORT_C TUint32 RCmDestination::ElementId() const
+    {
+    __ASSERT_ALWAYS( iDestinatonData, User::Panic(_L( "CMManager" ), 
+                                                  KErrBadHandle ) );
+
+    return iDestinatonData->ElementId();
+    }
+
+// -----------------------------------------------------------------------------
+// RCmDestination::IconL()
+// -----------------------------------------------------------------------------
+//      
+EXPORT_C CGulIcon* RCmDestination::IconL() const
+    {
+    if (!iDestinatonData)
+        {
+        User::Leave(KErrBadHandle);
+        }
+
+    CCmDestinationImpl* aImplementation = 
+            CCmDestinationImpl::NewLC(iDestinatonData);
+    // Deleting aImplementation will decrement the ref counter
+    iDestinatonData->IncrementRefCounter();
+    CGulIcon* retValue = aImplementation->IconL();
+    CleanupStack::PopAndDestroy(aImplementation);
+    return retValue;
+    }
+
+
+// -----------------------------------------------------------------------------
+// RCmDestination::MetadataL()
+// -----------------------------------------------------------------------------
+//      
+EXPORT_C 
+    TUint32 RCmDestination::MetadataL( TSnapMetadataField aMetaField ) const
+    {
+    if (!iDestinatonData)
+        {
+        User::Leave(KErrBadHandle);
+        }
+    return iDestinatonData->MetadataL( aMetaField );
+    }
+
+// -----------------------------------------------------------------------------
+// RCmDestination::ProtectionLevel()
+// -----------------------------------------------------------------------------
+//  
+EXPORT_C TProtectionLevel RCmDestination::ProtectionLevel() const
+    {
+    __ASSERT_ALWAYS( iDestinatonData, User::Panic(_L( "CMManager" ), 
+                                                  KErrBadHandle ) );
+
+    return iDestinatonData->ProtectionLevel();
+    }
+
+// -----------------------------------------------------------------------------
+// RCmDestination::IsHidden()
+// -----------------------------------------------------------------------------
+//          
+EXPORT_C TBool RCmDestination::IsHidden() const
+    {
+    __ASSERT_ALWAYS( iDestinatonData, User::Panic(_L( "CMManager" ), 
+                                                  KErrBadHandle ) );
+
+    TBool hidden( EFalse );
+    TRAPD( err, hidden = iDestinatonData->IsHiddenL() );
+    __ASSERT_ALWAYS( err == KErrNone, User::Panic(_L( "CMManager" ), 
+                                                  KErrArgument ) );
+                                                  
+    return hidden;
+    }
+
+// -----------------------------------------------------------------------------
+// RCmDestination::CreateConnectionMethodL()
+// -----------------------------------------------------------------------------
+//  
+EXPORT_C RCmConnectionMethod RCmDestination::CreateConnectionMethodL
+   ( TUint32 aImplementationUid )
+    {
+    if (!iDestinatonData)
+        {
+        User::Leave(KErrBadHandle);
+        }
+
+    RCmConnectionMethod cm;
+    CCmDestinationImpl* aImplementation = 
+            CCmDestinationImpl::NewLC(iDestinatonData);
+    // Deleting aImplementation will decrement the ref counter
+    iDestinatonData->IncrementRefCounter();
+    CCmPluginBase* imp = aImplementation->CreateConnectionMethodL( 
+                                        aImplementationUid );
+    imp->IncrementRefCounter();
+    CleanupStack::PushL(imp);                                    
+    cm.iImplementation = imp->Plugin();
+    CleanupStack::PopAndDestroy(imp);
+    
+    CleanupStack::PopAndDestroy(aImplementation);
+    return cm;
+    }
+
+// -----------------------------------------------------------------------------
+// RCmDestinationExt::CreateConnectionMethodL()
+// -----------------------------------------------------------------------------
+//  
+EXPORT_C RCmConnectionMethod RCmDestination::CreateConnectionMethodL( 
+    TUint32 aImplementationUid,
+    TUint32  aConnMethId )
+    {
+    if (!iDestinatonData)
+        {
+        User::Leave(KErrBadHandle);
+        }
+
+    RCmConnectionMethod cm;
+    CCmDestinationImpl* implementation = 
+                                     CCmDestinationImpl::NewLC( iDestinatonData );
+    // Deleting aImplementation will decrement the ref counter
+    iDestinatonData->IncrementRefCounter();
+    CCmPluginBase* imp = implementation->CreateConnectionMethodL( 
+                                                            aImplementationUid,
+                                                            aConnMethId );
+    imp->IncrementRefCounter();
+    CleanupStack::PushL(imp);                                    
+    cm.iImplementation = imp->Plugin();
+    CleanupStack::PopAndDestroy(imp);
+
+    CleanupStack::PopAndDestroy(implementation);
+    return cm;
+    }
+
+// -----------------------------------------------------------------------------
+// RCmDestination::AddConnectionMethodL()
+// -----------------------------------------------------------------------------
+// 
+EXPORT_C TInt RCmDestination::AddConnectionMethodL( 
+    RCmConnectionMethod aConnectionMethod )
+    {
+    if (!iDestinatonData)
+        {
+        User::Leave(KErrBadHandle);
+        }
+        
+    CCmDestinationImpl* implementation = 
+            CCmDestinationImpl::NewLC(iDestinatonData);
+    // Deleting aImplementation will decrement the ref counter
+    iDestinatonData->IncrementRefCounter();
+
+    CCmPluginBase* connMethod = new (ELeave) 
+                            CCmPluginBase(aConnectionMethod.iImplementation);
+    connMethod->IncrementRefCounter();    
+    CleanupStack::PushL( connMethod );        
+
+    // Check if the given connection method exists already in this destination
+    if ( aConnectionMethod.iImplementation->IdIsValid() &&
+         implementation->CheckIfCMExistsL( *connMethod ) )
+        {
+        CleanupStack::PopAndDestroy( connMethod );
+        CleanupStack::PopAndDestroy( implementation );
+        User::Leave( KErrAlreadyExists );
+        }
+
+    TInt retValue =  implementation->AddConnectionMethodL( *connMethod );
+    CleanupStack::PopAndDestroy( connMethod );
+    CleanupStack::PopAndDestroy( implementation );
+    return retValue;
+    }
+
+// -----------------------------------------------------------------------------
+// RCmDestination::AddEmbeddedDestinationL()
+// -----------------------------------------------------------------------------
+// 
+EXPORT_C TInt RCmDestination::AddEmbeddedDestinationL( 
+    const RCmDestination& aDestination )
+    {
+    if (!iDestinatonData)
+        {
+        User::Leave(KErrBadHandle);
+        }
+    
+    if ( this == &aDestination )
+        {
+        User::Leave( KErrArgument );
+        }
+    
+    CCmDestinationImpl* aImplementation = 
+            CCmDestinationImpl::NewLC(iDestinatonData);
+    // Deleting will decrement the ref counter
+    aImplementation->IncrementRefCounter();
+    CCmDestinationImpl* aDestToAdd = 
+            CCmDestinationImpl::NewLC(aDestination.iDestinatonData);
+    // Deleting will decrement the ref counter
+    aDestToAdd->IncrementRefCounter();
+        
+    TInt retValue =  aImplementation->AddEmbeddedDestinationL( 
+                                                *aDestToAdd );        
+    CleanupStack::PopAndDestroy(aDestToAdd);
+    CleanupStack::PopAndDestroy(aImplementation);
+    return retValue;
+    }
+
+// -----------------------------------------------------------------------------
+// RCmDestination::DeleteConnectionMethodL()
+// -----------------------------------------------------------------------------
+// 
+EXPORT_C void RCmDestination::DeleteConnectionMethodL( 
+    RCmConnectionMethod& aConnectionMethod )
+    {
+    if (!iDestinatonData)
+        {
+        User::Leave(KErrBadHandle);
+        }
+
+    CCmDestinationImpl* aImplementation = 
+            CCmDestinationImpl::NewLC(iDestinatonData);
+    // Deleting aImplementation will decrement the ref counter
+    iDestinatonData->IncrementRefCounter();
+    CCmPluginBase* connMethod = new (ELeave) 
+                            CCmPluginBase(aConnectionMethod.iImplementation);
+    connMethod->IncrementRefCounter();    
+    CleanupStack::PushL( connMethod );        
+    aImplementation->DeleteConnectionMethodL( 
+                                           *connMethod );
+    CleanupStack::PopAndDestroy(connMethod);
+    CleanupStack::PopAndDestroy(aImplementation);
+    }
+    
+// -----------------------------------------------------------------------------
+// RCmDestination::RemoveConnectionMethodL()
+// -----------------------------------------------------------------------------
+// 
+EXPORT_C void RCmDestination::RemoveConnectionMethodL( 
+    RCmConnectionMethod aConnectionMethod )
+    {
+    if (!iDestinatonData)
+        {
+        User::Leave(KErrBadHandle);
+        }
+
+    CCmDestinationImpl* aImplementation = 
+            CCmDestinationImpl::NewLC(iDestinatonData);
+    // Deleting aImplementation will decrement the ref counter
+    iDestinatonData->IncrementRefCounter();
+    aImplementation->RemoveConnectionMethodL( 
+                                           *aConnectionMethod.iImplementation );
+    CleanupStack::PopAndDestroy(aImplementation);
+    }
+    
+// -----------------------------------------------------------------------------
+// RCmDestination::ModifyPriorityL()
+// -----------------------------------------------------------------------------
+//      
+EXPORT_C void RCmDestination::ModifyPriorityL( 
+    RCmConnectionMethod& aCCmItem, 
+    TUint aIndex )
+    {
+    if (!iDestinatonData)
+        {
+        User::Leave(KErrBadHandle);
+        }
+
+    CCmDestinationImpl* aImplementation = 
+            CCmDestinationImpl::NewLC(iDestinatonData);
+    // Deleting aImplementation will decrement the ref counter
+    iDestinatonData->IncrementRefCounter();
+    CCmPluginBase* connMethod = new (ELeave) 
+                            CCmPluginBase(aCCmItem.iImplementation);
+    connMethod->IncrementRefCounter();    
+    CleanupStack::PushL( connMethod );        
+    aImplementation->ModifyPriorityL( *connMethod, aIndex );
+    CleanupStack::PopAndDestroy(connMethod);
+    CleanupStack::PopAndDestroy(aImplementation);
+    }
+    
+// -----------------------------------------------------------------------------
+// RCmDestination::SetNameL()
+// -----------------------------------------------------------------------------
+//        
+EXPORT_C void RCmDestination::SetNameL( const TDesC& aName )
+    {
+    if (!iDestinatonData)
+        {
+        User::Leave(KErrBadHandle);
+        }
+
+    CCmDestinationImpl* aImplementation = 
+            CCmDestinationImpl::NewLC(iDestinatonData);
+    // Deleting aImplementation will decrement the ref counter
+    iDestinatonData->IncrementRefCounter();
+    aImplementation->SetNameL( aName );
+    CleanupStack::PopAndDestroy(aImplementation);
+    }
+
+// -----------------------------------------------------------------------------
+// RCmDestination::SetIconL()
+// -----------------------------------------------------------------------------
+//      
+EXPORT_C void RCmDestination::SetIconL( TUint32 anIndex )
+    {
+    if (!iDestinatonData)
+        {
+        User::Leave(KErrBadHandle);
+        }
+
+    if ( anIndex > KNumOfIcons )
+        {
+        User::Leave( KErrArgument );
+        }
+        
+    CCmDestinationImpl* aImplementation = 
+            CCmDestinationImpl::NewLC(iDestinatonData);
+    // Deleting aImplementation will decrement the ref counter
+    iDestinatonData->IncrementRefCounter();
+    aImplementation->SetIconL( anIndex );        
+    CleanupStack::PopAndDestroy(aImplementation);
+    }
+
+// -----------------------------------------------------------------------------
+// RCmDestination::SetMetadataL()
+// -----------------------------------------------------------------------------
+//      
+EXPORT_C void RCmDestination::SetMetadataL( TSnapMetadataField aMetaField, 
+                                            TUint32 aValue ) 
+    {
+    if (!iDestinatonData)
+        {
+        User::Leave(KErrBadHandle);
+        }
+
+    CCmDestinationImpl* aImplementation = 
+            CCmDestinationImpl::NewLC(iDestinatonData);
+    // Deleting aImplementation will decrement the ref counter
+    iDestinatonData->IncrementRefCounter();
+    aImplementation->SetMetadataL( aMetaField, aValue );
+    CleanupStack::PopAndDestroy(aImplementation);
+    }
+
+// -----------------------------------------------------------------------------
+// RCmDestination::SetProtectionL()
+// -----------------------------------------------------------------------------
+//  
+EXPORT_C void RCmDestination::SetProtectionL( TProtectionLevel aProtLevel )
+    {
+    if (!iDestinatonData)
+        {
+        User::Leave(KErrBadHandle);
+        }
+
+    CCmDestinationImpl* aImplementation = 
+            CCmDestinationImpl::NewLC(iDestinatonData);
+    // Deleting aImplementation will decrement the ref counter
+    iDestinatonData->IncrementRefCounter();
+    aImplementation->SetProtectionL( aProtLevel );
+    CleanupStack::PopAndDestroy(aImplementation);
+    }
+
+// -----------------------------------------------------------------------------
+// RCmDestination::SetHiddenL()
+// -----------------------------------------------------------------------------
+//          
+EXPORT_C void RCmDestination::SetHiddenL( TBool aHidden )
+    {
+    if (!iDestinatonData)
+        {
+        User::Leave(KErrBadHandle);
+        }
+
+    CCmDestinationImpl* aImplementation = 
+            CCmDestinationImpl::NewLC(iDestinatonData);
+    // Deleting aImplementation will decrement the ref counter
+    iDestinatonData->IncrementRefCounter();
+    aImplementation->SetHiddenL( aHidden );         
+    CleanupStack::PopAndDestroy(aImplementation);
+    }
+
+// -----------------------------------------------------------------------------
+// RCmDestination::UpdateL()
+// -----------------------------------------------------------------------------
+//          
+EXPORT_C void RCmDestination::UpdateL()
+    {
+    if (!iDestinatonData)
+        {
+        User::Leave(KErrBadHandle);
+        }
+
+    CCmDestinationImpl* aImplementation = 
+            CCmDestinationImpl::NewLC(iDestinatonData);
+    // Deleting aImplementation will decrement the ref counter
+    iDestinatonData->IncrementRefCounter();
+    aImplementation->UpdateL();
+    CleanupStack::PopAndDestroy(aImplementation);
+    }
+
+// -----------------------------------------------------------------------------
+// RCmDestination::DeleteLD()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RCmDestination::DeleteLD()
+    {
+    if (!iDestinatonData)
+        {
+        User::Leave(KErrBadHandle);
+        }
+
+    CCmDestinationImpl* aImplementation = 
+            CCmDestinationImpl::NewLC(iDestinatonData);
+    iDestinatonData->IncrementRefCounter();
+    aImplementation->DeleteLD();  
+    CleanupStack::Pop(aImplementation);
+    iDestinatonData = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// RCmDestination::IsConnectedL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool RCmDestination::IsConnectedL() const 
+    {
+    if (!iDestinatonData)
+        {
+        User::Leave(KErrBadHandle);
+        }
+
+    CCmDestinationImpl* aImplementation = 
+            CCmDestinationImpl::NewLC(iDestinatonData);
+    // Deleting aImplementation will decrement the ref counter
+    iDestinatonData->IncrementRefCounter();
+    TBool retValue = aImplementation->IsConnectedL();    
+    CleanupStack::PopAndDestroy(aImplementation);
+    return retValue;
+    }
+    
+// -----------------------------------------------------------------------------
+// RCmDestination::RCmDestination
+// -----------------------------------------------------------------------------
+//
+EXPORT_C RCmDestination::RCmDestination()    
+    : iDestinatonData( NULL )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// RCmDestination::operator==
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool RCmDestination::operator==(const RCmDestination& aDestination ) const
+    {
+    return ( iDestinatonData == aDestination.iDestinatonData );
+    };
+
+// -----------------------------------------------------------------------------
+// RCmDestination::operator!=
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool RCmDestination::operator!=(const RCmDestination& aDestination ) const
+    {
+    return !( iDestinatonData == aDestination.iDestinatonData );
+    };
+    
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Src/cmdestinationext.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,665 @@
+/*
+* 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 RCmDestinationExt
+*
+*/
+
+#include <cmdestinationext.h>
+#include "cmdestinationimpl.h"
+#include <cmconnectionmethodext.h>
+#include <cmpluginbaseeng.h>
+#include <cmpluginbase.h>
+#include "cmmanagerimpl.h"
+
+using namespace CMManager;
+
+// -----------------------------------------------------------------------------
+// RCmDestinationExt::Close()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RCmDestinationExt::Close()
+    {
+    if( !iDestinatonData )
+        {
+        return;
+        }
+
+    iDestinatonData->Cmmgr()->RemoveDestFromPool(iDestinatonData);     
+    iDestinatonData = NULL;
+    }
+    
+
+// -----------------------------------------------------------------------------
+// RCmDestinationExt::~RCmDestinationExt()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C RCmDestinationExt::~RCmDestinationExt()
+    {
+    Close();
+    }
+
+
+// -----------------------------------------------------------------------------
+// RCmDestinationExt::RCmDestinationExt( RCmDestinationExt& )
+// -----------------------------------------------------------------------------
+//
+EXPORT_C RCmDestinationExt::RCmDestinationExt(
+                                const RCmDestinationExt& aCmDestination)    
+    : iDestinatonData( aCmDestination.iDestinatonData )
+    {
+    iDestinatonData->IncrementRefCounter();
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// RCmDestinationExt::RCmDestinationExt::operator=()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C RCmDestinationExt& RCmDestinationExt::operator=(
+                                const RCmDestinationExt& aCmDestination)
+    {
+    if (this != &aCmDestination) 
+        {
+        Close();
+        iDestinatonData = aCmDestination.iDestinatonData;        
+        iDestinatonData->IncrementRefCounter();
+        }
+    return *this;
+    }
+    
+
+// -----------------------------------------------------------------------------
+// RCmDestinationExt::ConnectionMethodCount()
+// -----------------------------------------------------------------------------
+//        
+EXPORT_C TInt RCmDestinationExt::ConnectionMethodCount()    
+    {
+    __ASSERT_ALWAYS( iDestinatonData, User::Panic(_L( "CMManager" ), 
+                                                  KErrBadHandle ) );
+
+    return iDestinatonData->ConnectionMethodCount();
+    };
+    
+// -----------------------------------------------------------------------------
+// RCmDestinationExt::ConnectionMethodL
+// -----------------------------------------------------------------------------
+//     
+EXPORT_C RCmConnectionMethodExt 
+                            RCmDestinationExt::ConnectionMethodL( TInt anIndex )
+    {
+    if (!iDestinatonData)
+        {
+        User::Leave(KErrBadHandle);
+        }
+
+    RCmConnectionMethodExt cm;
+    CCmDestinationImpl* aImplementation = 
+            CCmDestinationImpl::NewLC(iDestinatonData);
+    // Deleting aImplementation will decrement the ref counter
+    iDestinatonData->IncrementRefCounter();
+    cm.iImplementation = 
+        aImplementation->GetConnectionMethodL( anIndex )->Plugin();
+    //CCmDestinationImpl::GetConnectionMethodL doesn't give ownership
+    cm.iImplementation->IncrementRefCounter();
+    CleanupStack::PopAndDestroy(aImplementation);    
+    return cm;
+    }
+
+// -----------------------------------------------------------------------------
+// RCmDestinationExt::ConnectionMethodByIDL
+// -----------------------------------------------------------------------------
+//     
+EXPORT_C RCmConnectionMethodExt 
+                        RCmDestinationExt::ConnectionMethodByIDL( TInt aIapId )
+    {
+    if (!iDestinatonData)
+        {
+        User::Leave(KErrBadHandle);
+        }
+
+    RCmConnectionMethodExt cm;
+    
+    CCmDestinationImpl* aImplementation = 
+            CCmDestinationImpl::NewLC(iDestinatonData);
+    // Deleting aImplementation will decrement the ref counter
+    iDestinatonData->IncrementRefCounter();
+    cm.iImplementation = 
+        aImplementation->ConnectionMethodByIDL( aIapId )->Plugin();
+    //CCmDestinationImpl::ConnectionMethodByIDL doesn't give ownership
+    cm.iImplementation->IncrementRefCounter();
+    CleanupStack::PopAndDestroy(aImplementation);
+    
+    return cm;
+    }
+
+// -----------------------------------------------------------------------------
+// RCmDestinationExt::PriorityL()
+// -----------------------------------------------------------------------------
+//        
+EXPORT_C TUint RCmDestinationExt::PriorityL(const RCmConnectionMethodExt& aCCMItem )
+    {
+    if (!iDestinatonData)
+        {
+        User::Leave(KErrBadHandle);
+        }
+
+    CCmDestinationImpl* aImplementation = 
+            CCmDestinationImpl::NewLC(iDestinatonData);
+    // Deleting aImplementation will decrement the ref counter
+    iDestinatonData->IncrementRefCounter();
+    TUint retValue = aImplementation->PriorityL( *aCCMItem.iImplementation );
+    CleanupStack::PopAndDestroy(aImplementation);
+    return retValue;
+    }
+
+// -----------------------------------------------------------------------------
+// RCmDestinationExt::NameLC()
+// -----------------------------------------------------------------------------
+//        
+EXPORT_C HBufC* RCmDestinationExt::NameLC ( )
+    {
+    if (!iDestinatonData)
+        {
+        User::Leave(KErrBadHandle);
+        }
+
+    CCmDestinationImpl* aImplementation = 
+            CCmDestinationImpl::NewLC(iDestinatonData);
+    // Deleting aImplementation will decrement the ref counter
+    iDestinatonData->IncrementRefCounter();
+    HBufC* retValue = aImplementation->NameLC();
+    CleanupStack::Pop(retValue);
+    CleanupStack::PopAndDestroy(aImplementation);
+    CleanupStack::PushL(retValue);
+    return retValue;
+    };
+
+// -----------------------------------------------------------------------------
+// RCmDestinationExt::Id()
+// -----------------------------------------------------------------------------
+//        
+EXPORT_C TUint32 RCmDestinationExt::Id() 
+    {
+    __ASSERT_ALWAYS( iDestinatonData, User::Panic(_L( "CMManager" ), 
+                                                  KErrBadHandle ) );
+
+    return iDestinatonData->Id();
+    }
+
+// -----------------------------------------------------------------------------
+// RCmDestinationExt::ElementId()
+// -----------------------------------------------------------------------------
+//        
+EXPORT_C TUint32 RCmDestinationExt::ElementId() 
+    {
+    __ASSERT_ALWAYS( iDestinatonData, User::Panic(_L( "CMManager" ), 
+                                                  KErrBadHandle ) );
+
+    return iDestinatonData->ElementId();
+    }
+
+// -----------------------------------------------------------------------------
+// RCmDestinationExt::IconL()
+// -----------------------------------------------------------------------------
+//      
+EXPORT_C CGulIcon* RCmDestinationExt::IconL() 
+    {
+    if (!iDestinatonData)
+        {
+        User::Leave(KErrBadHandle);
+        }
+
+    CCmDestinationImpl* aImplementation = 
+            CCmDestinationImpl::NewLC(iDestinatonData);
+    // Deleting aImplementation will decrement the ref counter
+    iDestinatonData->IncrementRefCounter();
+    CGulIcon* retValue = aImplementation->IconL();
+    CleanupStack::PopAndDestroy(aImplementation);
+    return retValue;
+    }
+
+
+// -----------------------------------------------------------------------------
+// RCmDestinationExt::MetadataL()
+// -----------------------------------------------------------------------------
+//      
+EXPORT_C 
+    TUint32 RCmDestinationExt::MetadataL( TSnapMetadataField aMetaField ) const
+    {
+    if (!iDestinatonData)
+        {
+        User::Leave(KErrBadHandle);
+        }
+    return iDestinatonData->MetadataL( aMetaField );
+    }
+
+// -----------------------------------------------------------------------------
+// RCmDestinationExt::ProtectionLevel()
+// -----------------------------------------------------------------------------
+//  
+EXPORT_C TProtectionLevel RCmDestinationExt::ProtectionLevel()
+    {
+    __ASSERT_ALWAYS( iDestinatonData, User::Panic(_L( "CMManager" ), 
+                                                  KErrBadHandle ) );
+
+    return iDestinatonData->ProtectionLevel();
+    }
+
+// -----------------------------------------------------------------------------
+// RCmDestinationExt::IsHidden()
+// -----------------------------------------------------------------------------
+//          
+EXPORT_C TBool RCmDestinationExt::IsHidden()
+    {
+    __ASSERT_ALWAYS( iDestinatonData, User::Panic(_L( "CMManager" ), 
+                                                  KErrBadHandle ) );
+
+    TBool hidden( EFalse );
+    TRAPD( err, hidden = iDestinatonData->IsHiddenL() );
+    __ASSERT_ALWAYS( err == KErrNone, User::Panic(_L( "CMManager" ), 
+                                                  KErrArgument ) );
+                                                  
+    return hidden;
+    }
+
+// -----------------------------------------------------------------------------
+// RCmDestinationExt::CreateConnectionMethodL()
+// -----------------------------------------------------------------------------
+//  
+EXPORT_C RCmConnectionMethodExt 
+        RCmDestinationExt::CreateConnectionMethodL( TUint32 aImplementationUid )
+    {
+    if (!iDestinatonData)
+        {
+        User::Leave(KErrBadHandle);
+        }
+
+    RCmConnectionMethodExt cm;
+    CCmDestinationImpl* aImplementation = 
+            CCmDestinationImpl::NewLC(iDestinatonData);
+    // Deleting aImplementation will decrement the ref counter
+    iDestinatonData->IncrementRefCounter();
+    CCmPluginBase* imp = aImplementation->CreateConnectionMethodL( 
+                                        aImplementationUid );
+    imp->IncrementRefCounter();
+    CleanupStack::PushL(imp);                                    
+    cm.iImplementation = imp->Plugin();
+    CleanupStack::PopAndDestroy(imp);
+    
+    CleanupStack::PopAndDestroy(aImplementation);
+    return cm;
+    }
+
+// -----------------------------------------------------------------------------
+// RCmDestinationExt::CreateConnectionMethodL()
+// -----------------------------------------------------------------------------
+//  
+EXPORT_C RCmConnectionMethodExt RCmDestinationExt::CreateConnectionMethodL( 
+    TUint32 aImplementationUid,
+    TUint32  aConnMethId )
+    {
+    if (!iDestinatonData)
+        {
+        User::Leave(KErrBadHandle);
+        }
+
+    RCmConnectionMethodExt cm;
+    CCmDestinationImpl* implementation = 
+                                     CCmDestinationImpl::NewLC( iDestinatonData );
+    // Deleting aImplementation will decrement the ref counter
+    iDestinatonData->IncrementRefCounter();
+    CCmPluginBase* imp = implementation->CreateConnectionMethodL( 
+                                                            aImplementationUid,
+                                                            aConnMethId );
+    imp->IncrementRefCounter();
+    CleanupStack::PushL(imp);                                    
+    cm.iImplementation = imp->Plugin();
+    CleanupStack::PopAndDestroy(imp);
+
+    CleanupStack::PopAndDestroy(implementation);
+    return cm;
+    }
+
+// -----------------------------------------------------------------------------
+// RCmDestinationExt::AddConnectionMethodL()
+// -----------------------------------------------------------------------------
+// 
+EXPORT_C TInt RCmDestinationExt::AddConnectionMethodL( 
+                                      RCmConnectionMethodExt aConnectionMethod )
+    {
+    if (!iDestinatonData)
+        {
+        User::Leave(KErrBadHandle);
+        }
+        
+    CCmDestinationImpl* implementation = 
+            CCmDestinationImpl::NewLC(iDestinatonData);
+    // Deleting aImplementation will decrement the ref counter
+    iDestinatonData->IncrementRefCounter();
+
+    CCmPluginBase* connMethod = new (ELeave) 
+                            CCmPluginBase(aConnectionMethod.iImplementation);
+    connMethod->IncrementRefCounter();    
+    CleanupStack::PushL( connMethod );        
+
+    // Check if the given connection method exists already in this destination
+    if ( aConnectionMethod.iImplementation->IdIsValid() &&
+         implementation->CheckIfCMExistsL( *connMethod ) )
+        {
+        CleanupStack::PopAndDestroy( connMethod );
+        CleanupStack::PopAndDestroy( implementation );
+        User::Leave( KErrAlreadyExists );
+        }
+
+    TInt retValue =  implementation->AddConnectionMethodL( *connMethod );
+    CleanupStack::PopAndDestroy( connMethod );
+    CleanupStack::PopAndDestroy( implementation );
+    return retValue;
+    }
+
+// -----------------------------------------------------------------------------
+// RCmDestinationExt::AddEmbeddedDestinationL()
+// -----------------------------------------------------------------------------
+// 
+EXPORT_C TInt RCmDestinationExt::AddEmbeddedDestinationL( 
+                                           const RCmDestinationExt& aDestination )
+    {
+    if ( !iDestinatonData )
+        {
+        User::Leave(KErrBadHandle);
+        }
+    
+    if ( this == &aDestination )
+        {
+        User::Leave( KErrArgument );
+        }
+    
+    CCmDestinationImpl* aImplementation = 
+            CCmDestinationImpl::NewLC(iDestinatonData);
+    // Deleting will decrement the ref counter
+    aImplementation->IncrementRefCounter();
+    CCmDestinationImpl* aDestToAdd = 
+            CCmDestinationImpl::NewLC(aDestination.iDestinatonData);
+    // Deleting will decrement the ref counter
+    aDestToAdd->IncrementRefCounter();
+        
+    TInt retValue =  aImplementation->AddEmbeddedDestinationL( 
+                                                *aDestToAdd );        
+    CleanupStack::PopAndDestroy(aDestToAdd);
+    CleanupStack::PopAndDestroy(aImplementation);
+    return retValue;
+    }
+
+// -----------------------------------------------------------------------------
+// RCmDestinationExt::DeleteConnectionMethodL()
+// -----------------------------------------------------------------------------
+// 
+EXPORT_C void RCmDestinationExt::DeleteConnectionMethodL( 
+                                      RCmConnectionMethodExt& aConnectionMethod )
+    {
+    if (!iDestinatonData)
+        {
+        User::Leave(KErrBadHandle);
+        }
+
+    CCmDestinationImpl* aImplementation = 
+            CCmDestinationImpl::NewLC(iDestinatonData);
+    // Deleting aImplementation will decrement the ref counter
+    iDestinatonData->IncrementRefCounter();
+    CCmPluginBase* connMethod = new (ELeave) 
+                            CCmPluginBase(aConnectionMethod.iImplementation);
+    connMethod->IncrementRefCounter();    
+    CleanupStack::PushL( connMethod );        
+    aImplementation->DeleteConnectionMethodL( 
+                                           *connMethod );
+    CleanupStack::PopAndDestroy(connMethod);
+    CleanupStack::PopAndDestroy(aImplementation);
+    }
+    
+// -----------------------------------------------------------------------------
+// RCmDestinationExt::RemoveConnectionMethodL()
+// -----------------------------------------------------------------------------
+// 
+EXPORT_C void RCmDestinationExt::RemoveConnectionMethodL( 
+                                      RCmConnectionMethodExt aConnectionMethod )
+    {
+    if (!iDestinatonData)
+        {
+        User::Leave(KErrBadHandle);
+        }
+
+    CCmDestinationImpl* aImplementation = 
+            CCmDestinationImpl::NewLC(iDestinatonData);
+    // Deleting aImplementation will decrement the ref counter
+    iDestinatonData->IncrementRefCounter();
+    aImplementation->RemoveConnectionMethodL( 
+                                           *aConnectionMethod.iImplementation );
+    CleanupStack::PopAndDestroy(aImplementation);
+    }
+    
+// -----------------------------------------------------------------------------
+// RCmDestinationExt::ModifyPriorityL()
+// -----------------------------------------------------------------------------
+//      
+EXPORT_C void RCmDestinationExt::ModifyPriorityL( 
+                                                RCmConnectionMethodExt& aCCmItem, 
+                                                TUint aIndex )
+    {
+    if (!iDestinatonData)
+        {
+        User::Leave(KErrBadHandle);
+        }
+
+
+    CCmDestinationImpl* aImplementation = 
+            CCmDestinationImpl::NewLC(iDestinatonData);
+    // Deleting aImplementation will decrement the ref counter
+    iDestinatonData->IncrementRefCounter();
+    CCmPluginBase* connMethod = new (ELeave) 
+                            CCmPluginBase(aCCmItem.iImplementation);
+    connMethod->IncrementRefCounter();    
+    CleanupStack::PushL( connMethod );        
+    aImplementation->ModifyPriorityL( *connMethod, aIndex );
+    CleanupStack::PopAndDestroy(connMethod);
+    CleanupStack::PopAndDestroy(aImplementation);
+    }
+    
+// -----------------------------------------------------------------------------
+// RCmDestinationExt::SetNameL()
+// -----------------------------------------------------------------------------
+//        
+EXPORT_C void RCmDestinationExt::SetNameL( const TDesC& aName )
+    {
+    if (!iDestinatonData)
+        {
+        User::Leave(KErrBadHandle);
+        }
+
+    CCmDestinationImpl* aImplementation = 
+            CCmDestinationImpl::NewLC(iDestinatonData);
+    // Deleting aImplementation will decrement the ref counter
+    iDestinatonData->IncrementRefCounter();
+    aImplementation->SetNameL( aName );
+    CleanupStack::PopAndDestroy(aImplementation);
+    }
+
+// -----------------------------------------------------------------------------
+// RCmDestinationExt::SetIconL()
+// -----------------------------------------------------------------------------
+//      
+EXPORT_C void RCmDestinationExt::SetIconL( TUint32 anIndex )
+    {
+    if (!iDestinatonData)
+        {
+        User::Leave(KErrBadHandle);
+        }
+        
+    if ( anIndex > KNumOfIcons )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    CCmDestinationImpl* aImplementation = 
+            CCmDestinationImpl::NewLC(iDestinatonData);
+    // Deleting aImplementation will decrement the ref counter
+    iDestinatonData->IncrementRefCounter();
+    aImplementation->SetIconL( anIndex );        
+    CleanupStack::PopAndDestroy(aImplementation);
+    }
+
+// -----------------------------------------------------------------------------
+// RCmDestinationExt::SetMetadataL()
+// -----------------------------------------------------------------------------
+//      
+EXPORT_C void RCmDestinationExt::SetMetadataL( TSnapMetadataField aMetaField, 
+		                                       TUint32 aValue ) 
+    {
+    if (!iDestinatonData)
+        {
+        User::Leave(KErrBadHandle);
+        }
+
+    CCmDestinationImpl* aImplementation = 
+            CCmDestinationImpl::NewLC(iDestinatonData);
+    // Deleting aImplementation will decrement the ref counter
+    iDestinatonData->IncrementRefCounter();
+    aImplementation->SetMetadataL( aMetaField, aValue );
+    CleanupStack::PopAndDestroy(aImplementation);
+    }
+
+// -----------------------------------------------------------------------------
+// RCmDestinationExt::SetProtectionL()
+// -----------------------------------------------------------------------------
+//  
+EXPORT_C void RCmDestinationExt::SetProtectionL( TProtectionLevel aProtLevel )
+    {
+    if (!iDestinatonData)
+        {
+        User::Leave(KErrBadHandle);
+        }
+
+    CCmDestinationImpl* aImplementation = 
+            CCmDestinationImpl::NewLC(iDestinatonData);
+    // Deleting aImplementation will decrement the ref counter
+    iDestinatonData->IncrementRefCounter();
+    aImplementation->SetProtectionL( aProtLevel );
+    CleanupStack::PopAndDestroy(aImplementation);
+    }
+
+// -----------------------------------------------------------------------------
+// RCmDestinationExt::SetHiddenL()
+// -----------------------------------------------------------------------------
+//          
+EXPORT_C void RCmDestinationExt::SetHiddenL( TBool aHidden )
+    {
+    if (!iDestinatonData)
+        {
+        User::Leave(KErrBadHandle);
+        }
+
+    CCmDestinationImpl* aImplementation = 
+            CCmDestinationImpl::NewLC(iDestinatonData);
+    // Deleting aImplementation will decrement the ref counter
+    iDestinatonData->IncrementRefCounter();
+    aImplementation->SetHiddenL( aHidden );         
+    CleanupStack::PopAndDestroy(aImplementation);
+    }
+
+// -----------------------------------------------------------------------------
+// RCmDestinationExt::UpdateL()
+// -----------------------------------------------------------------------------
+//          
+EXPORT_C void RCmDestinationExt::UpdateL()
+    {
+    if (!iDestinatonData)
+        {
+        User::Leave(KErrBadHandle);
+        }
+
+    CCmDestinationImpl* aImplementation = 
+            CCmDestinationImpl::NewLC(iDestinatonData);
+    // Deleting aImplementation will decrement the ref counter
+    iDestinatonData->IncrementRefCounter();
+    aImplementation->UpdateL();
+    CleanupStack::PopAndDestroy(aImplementation);
+    }
+
+// -----------------------------------------------------------------------------
+// RCmDestinationExt::DeleteLD()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RCmDestinationExt::DeleteLD()
+    {
+    if (!iDestinatonData)
+        {
+        User::Leave(KErrBadHandle);
+        }
+
+    CCmDestinationImpl* aImplementation = 
+            CCmDestinationImpl::NewLC(iDestinatonData);
+    iDestinatonData->IncrementRefCounter();
+    aImplementation->DeleteLD();  
+    CleanupStack::Pop(aImplementation);
+    iDestinatonData = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// RCmDestinationExt::IsConnectedL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool RCmDestinationExt::IsConnectedL() const 
+    {
+    if (!iDestinatonData)
+        {
+        User::Leave(KErrBadHandle);
+        }
+
+    CCmDestinationImpl* aImplementation = 
+            CCmDestinationImpl::NewLC(iDestinatonData);
+    // Deleting aImplementation will decrement the ref counter
+    iDestinatonData->IncrementRefCounter();
+    TBool retValue = aImplementation->IsConnectedL();    
+    CleanupStack::PopAndDestroy(aImplementation);
+    return retValue;
+    }
+    
+// -----------------------------------------------------------------------------
+// RCmDestinationExt::RCmDestinationExt
+// -----------------------------------------------------------------------------
+//
+EXPORT_C RCmDestinationExt::RCmDestinationExt()    
+    : iDestinatonData( NULL )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// RCmDestinationExt::operator==
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool RCmDestinationExt::operator==(const RCmDestinationExt& aDestination ) const
+    {
+    return ( iDestinatonData == aDestination.iDestinatonData );
+    };
+
+// -----------------------------------------------------------------------------
+// RCmDestinationExt::operator!=
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool RCmDestinationExt::operator!=(const RCmDestinationExt& aDestination ) const
+    {
+    return !( iDestinatonData == aDestination.iDestinatonData );
+    };
+    
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Src/cmdestinationimpl.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,3478 @@
+/*
+* 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 CCmDestinationImpl
+*
+*/
+
+#include "cmdestinationimpl.h"
+#include "cmmanagerimpl.h"
+#include <cmpluginbaseeng.h>
+#include <cmpluginbase.h>
+#include <cmmanager.h>
+#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include <commsdattypeinfov1_1_internal.h>
+#include <commsdattypesv1_1_partner.h> 
+#endif
+#include "cmlogger.h"
+#include "cmmanager.hrh"
+#include <cmcommonconstants.h>
+#include "datamobilitycommsdattypes.h"
+#include <cmpluginembdestinationdef.h>
+#include <cmmanagerdef.h>
+#include <data_caging_path_literals.hrh>
+#include <cmmanager.rsg>
+#include <cmmanager.mbg>   // icons
+#include <AknsUtils.h>
+#include <e32cmn.h>
+
+// System includes
+#include <ecom/ecom.h>        // For REComSession
+#include <commsdattypesv1_1.h>
+
+#include <in_sock.h>
+
+using namespace CMManager;
+using namespace CommsDat;
+
+const TUint KDefaultTierManagerTagId = KAfInet;
+
+const TInt KDestinationIconConvTable[][4] = {
+    { EAknsMajorGeneric, 
+      EAknsMinorGenericQgnIndiSettProtectedAdd,
+      EMbmCmmanagerQgn_prop_set_conn_dest_internet, 
+      EMbmCmmanagerQgn_prop_set_conn_dest_internet_mask },
+      
+    { EAknsMajorGeneric, 
+      EAknsMinorGenericQgnPropWmlGprs,
+      EMbmCmmanagerQgn_prop_set_conn_dest_wap, 
+      EMbmCmmanagerQgn_prop_set_conn_dest_wap_mask },                   
+      
+    { EAknsMajorGeneric, 
+      EAknsMinorGenericQgnPropWmlGprs,
+      EMbmCmmanagerQgn_prop_set_conn_dest_mms, 
+      EMbmCmmanagerQgn_prop_set_conn_dest_mms_mask },
+      
+    { EAknsMajorGeneric, 
+      EAknsMinorGenericQgnPropWmlGprs,
+      EMbmCmmanagerQgn_prop_set_conn_dest_intranet, 
+      EMbmCmmanagerQgn_prop_set_conn_dest_intranet_mask },          
+      
+    { EAknsMajorGeneric, 
+      EAknsMinorGenericQgnPropWmlGprs,
+      EMbmCmmanagerQgn_prop_set_conn_dest_operator, 
+      EMbmCmmanagerQgn_prop_set_conn_dest_operator_mask },
+      
+    { EAknsMajorGeneric, 
+      EAknsMinorGenericQgnPropWmlGprs,
+      EMbmCmmanagerQgn_prop_set_conn_dest_icon1, 
+      EMbmCmmanagerQgn_prop_set_conn_dest_icon1_mask },     
+      
+    { EAknsMajorGeneric, 
+      EAknsMinorGenericQgnPropWmlGprs,
+      EMbmCmmanagerQgn_prop_set_conn_dest_icon2, 
+      EMbmCmmanagerQgn_prop_set_conn_dest_icon2_mask },
+      
+    { EAknsMajorGeneric, 
+      EAknsMinorGenericQgnPropWmlGprs,
+      EMbmCmmanagerQgn_prop_set_conn_dest_icon3, 
+      EMbmCmmanagerQgn_prop_set_conn_dest_icon3_mask },            
+      
+    { EAknsMajorGeneric, 
+      EAknsMinorGenericQgnPropWmlGprs,
+      EMbmCmmanagerQgn_prop_set_conn_dest_icon4, 
+      EMbmCmmanagerQgn_prop_set_conn_dest_icon4_mask },       
+
+    { EAknsMajorGeneric, 
+      EAknsMinorGenericQgnPropWmlGprs,
+      EMbmCmmanagerQgn_prop_set_conn_dest_icon5, 
+      EMbmCmmanagerQgn_prop_set_conn_dest_icon5_mask }, 
+             
+    { EAknsMajorGeneric, 
+      EAknsMinorGenericQgnPropWmlGprs,
+      EMbmCmmanagerQgn_prop_set_conn_dest_icon6, 
+      EMbmCmmanagerQgn_prop_set_conn_dest_icon6_mask }, 
+      
+    { EAknsMajorGeneric, 
+      EAknsMinorGenericQgnPropWmlGprs,
+      EMbmCmmanagerQgn_prop_set_conn_dest_default, 
+      EMbmCmmanagerQgn_prop_set_conn_dest_default_mask },            
+    {0, 0, 0, 0}
+    };
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::NewL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CCmDestinationImpl* 
+                           CCmDestinationImpl::NewL( CCmManagerImpl& aCmMgr,
+                                                     const TDesC& aName )
+    {
+    CCmDestinationImpl* dest = 
+                    new (ELeave) CCmDestinationImpl( aCmMgr );
+    CleanupStack::PushL( dest );
+    
+    dest->ConstructL( aName );
+    
+    CleanupStack::Pop( dest );
+    return dest;        
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::NewL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CCmDestinationImpl* 
+                        CCmDestinationImpl::NewL( CCmManagerImpl& aCmMgr,
+                                                  TUint aDestinationId )
+    {
+    CCmDestinationImpl* dest = 
+                    new (ELeave) CCmDestinationImpl( aCmMgr );
+    CleanupStack::PushL( dest );
+    
+    dest->ConstructL( aDestinationId );
+    
+    CleanupStack::Pop( dest );
+    return dest;        
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::NewL()
+// -----------------------------------------------------------------------------
+//
+CCmDestinationImpl* CCmDestinationImpl::NewL( CCmManagerImpl& aCmMgr,
+                                              CCmDestinationData* aData )
+    {
+    CCmDestinationImpl* dest = 
+                    new (ELeave) CCmDestinationImpl( aCmMgr );
+    dest->iData = aData;
+    return dest;        
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::NewL()
+// -----------------------------------------------------------------------------
+//
+CCmDestinationImpl* CCmDestinationImpl::NewL( CCmManagerImpl& aCmMgr,
+                                              const TDesC& aName,
+                                              TUint32 aDestId)
+    {
+    CCmDestinationImpl* dest = 
+                              new (ELeave) CCmDestinationImpl( aCmMgr );
+    CleanupStack::PushL( dest );
+
+    dest->ConstructL( aName, aDestId );
+
+    CleanupStack::Pop( dest );
+    return dest;        
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::NewLC()
+// -----------------------------------------------------------------------------
+//
+CCmDestinationImpl* CCmDestinationImpl::NewLC( CCmDestinationData* aData )
+    {
+    CCmDestinationImpl* dest = 
+                    new (ELeave) CCmDestinationImpl( aData->iCmMgr );
+    CleanupStack::PushL( dest );
+    dest->iData = aData;
+    return dest;        
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::CCmDestinationImpl()
+// -----------------------------------------------------------------------------
+//
+CCmDestinationImpl::CCmDestinationImpl( CCmManagerImpl& aCmMgr )
+    : iCmMgr( aCmMgr )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationData::CCmDestinationData()
+// -----------------------------------------------------------------------------
+//
+CCmDestinationData::CCmDestinationData( CCmManagerImpl& aCmMgr )
+    : iCmMgr( aCmMgr ),
+    iNewWithId ( EFalse )
+    {
+    }
+    
+// -----------------------------------------------------------------------------
+// CCmDestinationData::~CCmDestinationData()
+// -----------------------------------------------------------------------------
+//
+CCmDestinationData::~CCmDestinationData()
+    {
+    delete iMetaDataRec;
+    delete iNetworkRecord;
+    delete iDestAPRecord;
+
+    if (iConnMethodArray)
+        {
+        ResetAndDestroyArray( iConnMethodArray, ETrue );        
+        }
+    if (iDeleteCmArray)
+        {
+        ResetAndDestroyArray( iDeleteCmArray, ETrue );        
+        }
+    
+    CLOG_CLOSE;
+    }
+    
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::~CCmDestinationImpl()
+// -----------------------------------------------------------------------------
+//
+CCmDestinationImpl::~CCmDestinationImpl()
+    {
+    if (iData)
+        {
+        if (GetRefCounter())
+            {
+            iCmMgr.RemoveDestFromPool(this);        
+            }
+        else //if leaves during construction refcounter is 0
+            {
+            delete iData; 
+            }        
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::ConstructL()
+// -----------------------------------------------------------------------------
+//    
+void CCmDestinationImpl::ConstructL( const TDesC& aName )
+    {
+    CLOG_CREATE;
+    CLOG_NAME_2( _L("Destination_0x%x_%S"), this, &aName );
+    
+    iData =  new (ELeave) CCmDestinationData(iCmMgr);
+    iData->iNetworkRecord = static_cast<CCDNetworkRecord *>(
+                         CCDRecordBase::RecordFactoryL( KCDTIdNetworkRecord ) );
+    
+    iData->iConnMethodArray = new (ELeave) CCmArray( KCmArrayBigGranularity );
+    iData->iDeleteCmArray = new (ELeave) CCmArray( KCmArrayBigGranularity );
+    
+    iData->iMetaDataRec = new (ELeave) CCDSNAPMetadataRecord( 
+                                       iCmMgr.IconTableId() );
+
+    iData->iDestAPRecord = static_cast<CCDAccessPointRecord *>(
+                    CCDRecordBase::RecordFactoryL( KCDTIdAccessPointRecord ) );
+
+    SetNameL( aName );
+
+    InitializeDestAPRecordL();
+
+    CPluginItem* item = new (ELeave) CPluginItem;
+    CleanupStack::PushL( item );
+
+    // create the new record
+    item->iDNRecord = iCmMgr.SNAPRecordL( 0 );
+    CleanupStack::PushL( item->iDNRecord );
+    
+    AddToArrayL( item );
+    
+    CleanupStack::Pop( 2, item );  // iDNRecord, item
+    iData->iIdIsValid = EFalse;// the Id is still zero here
+    } 
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::ConstructL()
+// -----------------------------------------------------------------------------
+//    
+void CCmDestinationImpl::ConstructL( const TDesC& aName, TUint32 aDestId )
+    {
+    CLOG_CREATE;
+    CLOG_NAME_2( _L("Destination_0x%x_%S"), this, &aName );
+
+    iData =  new (ELeave) CCmDestinationData(iCmMgr);
+    iData->iNetworkRecord = static_cast<CCDNetworkRecord *>(
+                    CCDRecordBase::RecordFactoryL( KCDTIdNetworkRecord ) );
+
+    iData->iConnMethodArray = new (ELeave) CCmArray( KCmArrayBigGranularity );
+    iData->iDeleteCmArray = new (ELeave) CCmArray( KCmArrayBigGranularity );
+
+    iData->iMetaDataRec = new (ELeave) CCDSNAPMetadataRecord( iCmMgr.IconTableId() );
+
+    iData->iDestAPRecord = static_cast<CCDAccessPointRecord *>(
+                    CCDRecordBase::RecordFactoryL( KCDTIdAccessPointRecord ) );
+
+    SetNameL( aName );
+    
+    TInt correctAPId = aDestId;
+    TInt correctNetworkId = aDestId;
+	
+    if ( aDestId > 0 && aDestId < 255 )
+        {
+        correctAPId = aDestId + KCmDefaultDestinationAPTagId;
+        }
+    else if ( aDestId > KCmDefaultDestinationAPTagId 
+              && ( aDestId < ( KCmDefaultDestinationAPTagId+255 ) ) )
+        {
+        correctNetworkId = aDestId - KCmDefaultDestinationAPTagId;
+        }
+    else
+        {
+        User::Leave( KErrArgument );
+        }
+    
+    SetIdL( correctAPId );
+
+    InitializeDestAPRecordL();
+
+    CPluginItem* item = new (ELeave) CPluginItem;
+    CleanupStack::PushL( item );
+
+    // create the new record
+    iData->iNetworkRecord->SetRecordId( correctNetworkId );
+    iData->iNewWithId = ETrue;
+    item->iDNRecord = iCmMgr.SNAPRecordL( 0 );
+    CleanupStack::PushL( item->iDNRecord );
+
+    AddToArrayL( item );
+
+    CleanupStack::Pop( 2, item );  // iDNRecord, item
+    iData->iIdIsValid = EFalse;// the Id is still zero here
+    } 
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::SetIdL()
+// -----------------------------------------------------------------------------
+//        
+void CCmDestinationImpl::SetIdL( TInt aDestId )
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::SetIdL" );
+
+    TInt correctAPId( aDestId );
+    if ( aDestId > 0 && aDestId < 255 )
+        {
+        correctAPId = aDestId + KCmDefaultDestinationAPTagId;
+        }
+    else if ( aDestId < KCmDefaultDestinationAPTagId + 1
+             || aDestId > KCmDefaultDestinationAPTagId + 255 )
+        {
+        User::Leave( KErrArgument );
+        }
+        
+    CheckIfDestinationIdExistsL( correctAPId );
+
+    iData->iDestAPRecord->iRecordTag = correctAPId;
+    };
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::CheckIfDestinationIdExistsL()
+// -----------------------------------------------------------------------------
+//
+void CCmDestinationImpl::CheckIfDestinationIdExistsL( TUint32 aDestId )
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::CheckIfDestinationNameExistL" );
+
+    CMDBRecordSet<CCDAccessPointRecord>*  ptrRecordSet = 
+          new (ELeave) CMDBRecordSet<CCDAccessPointRecord>( KCDTIdAccessPointRecord );
+    CleanupStack::PushL( ptrRecordSet );    
+
+    // Prime record
+    CCDAccessPointRecord* record = static_cast<CCDAccessPointRecord *>
+                                   ( CCDRecordBase::RecordFactoryL( KCDTIdAccessPointRecord ) );
+    CleanupStack::PushL( record );
+
+    record->iRecordTag = ( TInt )aDestId;
+
+    ptrRecordSet->iRecords.AppendL( record );
+
+    CleanupStack::Pop( record );
+    record = NULL;
+
+    if ( ptrRecordSet->FindL( Session() ) )
+        {
+        User::Leave( KErrAlreadyExists );      
+        }
+
+    ptrRecordSet->iRecords.ResetAndDestroy();
+    CleanupStack::PopAndDestroy( ptrRecordSet );
+
+    iData->iDestAPRecord->iRecordTag = aDestId;
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::CheckIfDestinationNameExistL()
+// -----------------------------------------------------------------------------
+//
+void CCmDestinationImpl::CheckIfDestinationNameExistL( const TDesC& aName )
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::CheckIfDestinationNameExistL" );
+    
+    CMDBRecordSet<CCDSnapRecord>*  ptrRecordSet = 
+                            new (ELeave) CMDBRecordSet<CCDSnapRecord>( 
+                                 iCmMgr.DestinationTableId() );
+    CleanupStack::PushL( ptrRecordSet );    
+    
+    // Prime record
+    CCDSnapRecord* record = iCmMgr.SNAPRecordL( 0 );
+    CleanupStack::PushL( record );
+    
+    record->iRecordName.SetL( aName );
+    
+    ptrRecordSet->iRecords.AppendL( record );
+
+    CleanupStack::Pop( record );
+    record = NULL;
+                
+    if ( ptrRecordSet->FindL( Session() ) )
+        {
+        User::Leave( KErrAlreadyExists );          
+        }
+        
+    ptrRecordSet->iRecords.ResetAndDestroy();
+    CleanupStack::PopAndDestroy( ptrRecordSet );            
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::ConstructL()
+// -----------------------------------------------------------------------------
+//    
+void CCmDestinationImpl::ConstructL( TUint aDestinationId )
+    {
+    CLOG_CREATE;
+    CLOG_NAME_2( _L("Destination_0x%x_%d"), this, aDestinationId );
+    iData =  new (ELeave) CCmDestinationData(iCmMgr);
+    OpenTransactionLC();
+    
+    iData->iNetworkRecord = static_cast<CCDNetworkRecord *>(
+                         CCDRecordBase::RecordFactoryL( KCDTIdNetworkRecord ) );
+
+    iData->iDestAPRecord = static_cast<CCDAccessPointRecord *>(
+                         CCDRecordBase::RecordFactoryL( KCDTIdAccessPointRecord ) );
+    
+    iData->iConnMethodArray = new (ELeave) CCmArray( KCmArrayBigGranularity );
+    iData->iDeleteCmArray = new (ELeave) CCmArray( KCmArrayBigGranularity );
+
+    TInt correctAPId = aDestinationId;
+    TInt correctNetworkId = aDestinationId;
+	
+    if ( aDestinationId > 0 && aDestinationId < 255 )
+        {
+        correctAPId = aDestinationId + KCmDefaultDestinationAPTagId;
+        }
+    else if ( aDestinationId > KCmDefaultDestinationAPTagId 
+              && ( aDestinationId < ( KCmDefaultDestinationAPTagId+255 ) ) )
+        {
+        correctNetworkId = aDestinationId - KCmDefaultDestinationAPTagId;
+        }
+    else
+        {
+        User::Leave( KErrArgument );
+        }
+        
+    LoadDestAPRecordL( correctAPId );
+    
+    LoadNetworkRecordL( correctNetworkId );
+
+    LoadConnectionMethodsL();
+    LoadSNAPMetadataTableL();
+    
+    RollbackTransaction();
+    
+    iData->iIdIsValid = ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::Session()
+// -----------------------------------------------------------------------------
+//        
+CMDBSession& CCmDestinationImpl::Session()const
+    {
+    return iCmMgr.Session();
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmDestinationImpl::OpenTransactionLC
+// ---------------------------------------------------------------------------
+//
+void CCmDestinationImpl::OpenTransactionLC()
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::OpenTransactionL" );
+    // Do NOT call OpenTransactionLC() more then once!
+    iCmMgr.OpenTransactionLC( ETrue );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDestinationImpl::CommitTransactionL
+// ---------------------------------------------------------------------------
+//
+void CCmDestinationImpl::CommitTransactionL( TInt aError )
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::CommitTransactionL" );
+    
+    iCmMgr.CommitTransactionL( aError );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDestinationImpl::RollbackTransaction
+// ---------------------------------------------------------------------------
+//
+void CCmDestinationImpl::RollbackTransaction()
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::RollbackTransaction" );
+    
+    iCmMgr.RollbackTransaction();
+    }
+
+    
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::NameLC()
+// -----------------------------------------------------------------------------
+//        
+EXPORT_C HBufC* CCmDestinationImpl::NameLC( )
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::NameLC" );
+
+    HBufC* name = NULL;
+    const TUint32 KSnapMetadataNameMask = 0x0000000F;
+
+    TUint32 val = TUint32(iData->iMetaDataRec->iMetadata) & KSnapMetadataNameMask;
+    TUint32 val2 = (TUint32(iData->iMetaDataRec->iMetadata) & ESnapMetadataDestinationIsLocalised)
+                     >> 4;                   
+    
+    if( (val == ESnapMetadataInternet) ||
+        (val2 == ELocalisedDestInternet) )
+        {
+        name = iCmMgr.AllocReadL( R_CMMANAGERUI_DEST_INTERNET );
+        }
+    else if ( val2 == ELocalisedDestWap )
+        {
+        name = iCmMgr.AllocReadL( R_CMMANAGERUI_DEST_WAP );
+        }
+    else if ( val2 == ELocalisedDestMMS )
+        {
+        name = iCmMgr.AllocReadL( R_CMMANAGERUI_DEST_MMS );
+        }
+    else if ( val2 == ELocalisedDestIntranet )
+        {
+        name = iCmMgr.AllocReadL( R_CMMANAGERUI_DEST_INTRANET );
+        }
+    else
+        {
+        name = TPtrC(iData->iNetworkRecord->iRecordName).AllocL();
+        }
+        
+    CleanupStack::PushL( name );
+        
+    return name;
+    };
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::SetNameL()
+// -----------------------------------------------------------------------------
+//        
+EXPORT_C void CCmDestinationImpl::SetNameL( const TDesC& aName )
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::SetNameL" );
+
+    // Destination cannot be renamed if it's
+    // - protected
+    // - Internet    
+    if ( ProtectionLevel() == EProtLevel1 ||
+         ProtectionLevel() == EProtLevel2 ||
+         MetadataL( ESnapMetadataInternet ) )
+        {
+        CCmManagerImpl::HasCapabilityL( ECapabilityNetworkControl );
+        }
+
+    OpenTransactionLC();
+    CheckIfDestinationNameExistL( aName );
+    CommitTransactionL( KErrNone );        
+
+    iData->iNetworkRecord->iRecordName.SetL( aName );
+    iData->iDestAPRecord->iRecordName.SetL( aName );
+    };
+    
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::ConnectionMethodCount()
+// -----------------------------------------------------------------------------
+//        
+TInt CCmDestinationData::ConnectionMethodCount()
+    {    
+    LOGGER_ENTERFN( "CCmDestinationImpl::ConnectionMethodCount" );
+
+    return iConnMethodArray->Count() - KCmInitIndex;
+    };
+    
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::ConnectionMethodCount()
+// -----------------------------------------------------------------------------
+//        
+EXPORT_C TInt CCmDestinationImpl::ConnectionMethodCount()
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::ConnectionMethodCount" );
+    
+    return iData->ConnectionMethodCount();
+    };
+    
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::ConnectionMethodL
+// -----------------------------------------------------------------------------
+//     
+EXPORT_C CCmPluginBaseEng* CCmDestinationImpl::ConnectionMethodL( TInt /*aIndex*/ )
+    {
+    LOGGER_ENTERFN( "Error: Obsolete function CCmDestinationImpl::ConnectionMethodL used" );
+    User::Panic( _L("CMManager"), KErrNotSupported );
+    return NULL;    
+    }
+    
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::ConnectionMethodL
+// -----------------------------------------------------------------------------
+//     
+EXPORT_C CCmPluginBase* CCmDestinationImpl::GetConnectionMethodL( TInt aIndex )
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::ConnectionMethodL" );
+    // Initial entry!
+   
+    CCmPluginBase* retVal = NULL;    
+    TInt index = KCmInitIndex + aIndex;
+    CPluginItem* item = (*(iData->iConnMethodArray))[index];
+
+    LoadPluginL( *item );
+    retVal = item->iPlugin;
+    
+    return retVal;
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::ConnectionMethodByIDL
+// -----------------------------------------------------------------------------
+//     
+CCmPluginBase* CCmDestinationImpl::ConnectionMethodByIDL( TUint32 aCmId )
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::ConnectionMethodByIDL" );
+
+    TInt found = ConnectionMethodIndex( aCmId );
+
+    if( found == KErrNotFound )
+        {
+        User::Leave( KErrNotFound );
+        }
+        
+    CPluginItem* item = (*(iData->iConnMethodArray))[found];
+
+    LoadPluginL( *item );
+    
+    return item->iPlugin;
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::ConnectMethodIdArrayL
+// -----------------------------------------------------------------------------
+//     
+void CCmDestinationImpl::ConnectMethodIdArrayL( RArray<TUint32>& aCmIds )
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::ConnectMethodIdArrayL" );
+
+    TInt count = iData->iConnMethodArray->Count();    
+
+    for( TInt i = KCmInitIndex; i < count; ++i )
+        {
+        CPluginItem* item = (*(iData->iConnMethodArray))[i];
+
+        TUint32 elementId = item->iDNRecord->iIAP ?
+                          RECORD_FROM_ELEMENT_ID( TUint32(item->iDNRecord->iIAP) ) :
+                          TUint32( item->iDNRecord->iEmbeddedSNAP );
+                          
+        User::LeaveIfError( aCmIds.Append( elementId ) );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::AddToArrayL
+// -----------------------------------------------------------------------------
+// 
+TInt CCmDestinationImpl::AddToArrayL( CPluginItem* aItem )
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::AddToArrayL" );
+
+    TInt count = iData->iConnMethodArray->Count();    
+    if ( 0 == count  )
+        {
+        iData->iConnMethodArray->AppendL( aItem );
+        CLOG_WRITE_1( "inserted: [%d]", count );
+        return count;
+        }
+        
+    // Fill in SNAP record with IAP/EmbSNAP/SNAP values    
+    TMDBElementId iapElemetid( 0 );
+    TInt embDestId( 0 );
+
+    // No plugin means this is the template record.
+    TBool isDestination = aItem->iPlugin->GetBoolAttributeL( ECmDestination );
+    if ( isDestination )
+        {
+        embDestId = aItem->iPlugin->Destination()->Id();    
+        }
+    else
+        {
+        iapElemetid = aItem->iPlugin->IAPRecordElementId();   
+        }
+        
+    aItem->iDNRecord->iIAP = iapElemetid;
+    aItem->iDNRecord->iEmbeddedSNAP = embDestId;
+
+    TUint32 prio = 0;
+    TUint32 bearerType = 0;
+    TUint32 extLevel = 0;
+    
+    TBool isVirtual( EFalse );
+    
+    if ( count == KCmInitIndex )
+        {
+        if( !aItem->iDNRecord->iIAP && !aItem->iDNRecord->iEmbeddedSNAP )
+            {
+            iData->iConnMethodArray->AppendL( aItem );
+            }
+        else
+            {
+            isVirtual = PrioDataL( aItem, prio, bearerType, extLevel );
+            aItem->iDNRecord->iPriority = prio;
+            iData->iConnMethodArray->AppendL( aItem );
+            }
+        return count;
+        }
+    
+    TInt insertedAt( -1 );
+
+    if ( !isDestination )
+        {
+        // This function returns the info necessary for determining the priority
+        // It is the cm data in none VPN case 
+        // It is the data of the underlying cm in case of VPN over cm
+        // It is wildcard prio in case of VPN over destination
+        isVirtual = PrioDataL( aItem, prio, bearerType, extLevel );
+
+        CLOG_WRITE_3( "inserted item prio: [%d], bearer: [%x] ext: [%d]", 
+                       prio, bearerType, extLevel );
+
+        // wildcard priority goes to back
+        if ( KDataMobilitySelectionPolicyPriorityWildCard == prio ) 
+            {
+            // Set the default priority of a wildcard bearer
+            aItem->iDNRecord->iPriority = prio;
+            }   
+        else 
+            {
+            insertedAt = InsertSameMethodL( bearerType, isVirtual );
+            if( insertedAt == -1 )
+                {
+                insertedAt = InsertPriorityMethodL( prio, extLevel );
+                }
+ 
+            } // if wildcard
+        } // if !destination
+   
+    if( insertedAt == -1 )
+        {
+        //Add to the end of the list        
+        iData->iConnMethodArray->AppendL( aItem );
+        insertedAt = iData->iConnMethodArray->Count()-1;
+        CLOG_WRITE_1( "inserted as last: [%d]", insertedAt );
+        }
+    else
+        {
+        iData->iConnMethodArray->InsertL( insertedAt, aItem );
+        }    
+
+    CLOG_WRITE_1( "inserted at: [%d]", insertedAt );
+        
+    return insertedAt;
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::PrioDataL
+// -----------------------------------------------------------------------------
+// 
+TBool CCmDestinationImpl::PrioDataL( CPluginItem* aItem,  TUint32& aRetPrio, 
+                                     TUint32& aRetBearer, TUint32& aRetExtLevel )
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::PrioDataL" );
+
+    // Gets the data affecting the priority of the plugin in the list.
+    // It means the VPN priory based on the barer priority of the underlying cm
+    // or "wildcard" if VPN points to a destination      
+    aRetPrio   = aItem->iPlugin->GetIntAttributeL( ECmDefaultPriority );
+    aRetBearer = aItem->iPlugin->GetIntAttributeL( ECmBearerType );
+    aRetExtLevel = aItem->iPlugin->GetIntAttributeL( ECmExtensionLevel );
+    
+    TBool isVirtual = aItem->iPlugin->GetBoolAttributeL( ECmVirtual );
+    if( isVirtual )
+        {
+        // Embeded destination is also virtual but further checking should
+        // not be done. 
+        TBool isDestination = aItem->iPlugin->GetBoolAttributeL( ECmDestination );
+        if( !isDestination )
+            {
+            TUint32 underlying = aItem->iPlugin->GetIntAttributeL( 
+                                                           ECmNextLayerIapId );
+            if ( underlying != 0 )
+                {
+                // Gets the bearer of the underlying cm
+                aRetBearer = iCmMgr.BearerTypeFromCmIdL( underlying );
+                // Gets the prio of the bearer
+                aRetPrio = 
+                iCmMgr.GetBearerInfoIntL( aRetBearer, ECmDefaultPriority );
+                aRetExtLevel = 
+                iCmMgr.GetBearerInfoIntL( aRetBearer, ECmExtensionLevel );
+                }
+            else
+                {
+                // VPN points to a destination so its priority is "wildcard"
+                aRetPrio = KDataMobilitySelectionPolicyPriorityWildCard;
+                }    
+            }
+        }
+
+    return isVirtual;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::InsertSameMethodL
+// -----------------------------------------------------------------------------
+// 
+TInt CCmDestinationImpl::InsertSameMethodL( TUint32 aBearerType, TBool aIsVirtual )
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::InsertSameMethodL" );
+
+    TInt insertedAt( -1 );
+    TUint32 bearerInList( 0 );
+    TUint32 prioInList( 0 );
+    TUint32 extLevelInList( 0 ); 
+    TBool isVirtualInList( EFalse );
+     
+    TInt count = iData->iConnMethodArray->Count();    
+    // Loops throught the items in the list
+    for ( TInt i = count-1; ( i >= KCmInitIndex ) && ( insertedAt == -1) ; i-- )
+        {
+        // Loads the plugin
+        CPluginItem* item = (*(iData->iConnMethodArray))[i];
+        LoadPluginL( *item );
+        
+        // Gets the data of the list item    
+        isVirtualInList = PrioDataL( item, 
+                                    prioInList, bearerInList, extLevelInList );
+
+        CLOG_WRITE_4( "actual item [%d] prio: [%d], bearer: [%x] ext: [%d]", 
+                            i, prioInList, bearerInList, extLevelInList );
+          
+        // Bearer type the same
+        if( aBearerType == bearerInList )
+            {
+            // puts Virt/Virt or !Virt/!Virt or !Virt/Virt
+            if( ( aIsVirtual == isVirtualInList ) || ( aIsVirtual && !isVirtualInList ))
+                {
+                insertedAt = i+1;
+                CLOG_WRITE_1( "inserted same bearer: [%d]", insertedAt );
+                }
+            } // if bearer
+        } // for
+        return insertedAt;
+    }
+    
+    
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::InsertPriorityMethodL
+// -----------------------------------------------------------------------------
+// 
+TInt CCmDestinationImpl::InsertPriorityMethodL( TUint32 aPrio, TUint32 aExtLevel )
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::InsertPriorityMethodL" );
+
+    TInt insertedAt = -1;
+    TUint32 bearerInList( 0 );
+    TUint32 prioInList( 0 );
+    TUint32 extLevelInList( 0 );
+
+    TInt count = iData->iConnMethodArray->Count();    
+    // Loops throught the items in the list
+    ////for ( TInt i = KCmInitIndex; ( i < count ) && ( insertedAt == -1) ; i++ )
+    TInt i ( count-1 );
+    for ( ; ( i >= KCmInitIndex ) && ( insertedAt == -1) ; i-- )
+        {
+        // Loads the plugin
+        CPluginItem* item = (*(iData->iConnMethodArray))[i];
+        LoadPluginL( *item );
+
+        // Gets the data of the list item    
+        PrioDataL( item, prioInList, bearerInList, extLevelInList );
+
+        CLOG_WRITE_4( "actual item [%d] prio: [%d], bearer: [%x] ext: [%d]", 
+                        i, prioInList, bearerInList, extLevelInList );
+        
+        // If the priority is the same then it should be inserted near here
+        if ( aPrio == prioInList )
+            {
+            if( aExtLevel <= extLevelInList )
+                {
+                insertedAt = i+1;
+                CLOG_WRITE_1( "inserted same bearer non virtual: [%d]", insertedAt );
+                }
+            }
+        // Insert in front of the higher priority (prio 1 is the highest ...)    
+        else if ( aPrio > prioInList )
+            {
+            insertedAt = i+1;
+            CLOG_WRITE_1( "inserted higher prio: [%d]", insertedAt );
+            } // if same prio
+            
+        } // for
+        
+    // This is the highest priority one. It should be inserted at the first pos. 
+    if( -1 == insertedAt )
+        {
+        insertedAt = KCmInitIndex;
+        CLOG_WRITE_1( "inserted first position: [%d]", insertedAt );
+        } // if same prio
+
+    return insertedAt;
+    }
+    
+// -----------------------------------------------------------------------------
+// CCmDestinationData::ProtectionLevel()
+// -----------------------------------------------------------------------------
+//  
+TProtectionLevel CCmDestinationData::ProtectionLevel()
+    {
+    TInt protection = TUint32(iMetaDataRec->iMetadata) & 
+                      KSnapMetadataProtecionLevelMask;
+    return TProtectionLevel(protection >> 28);
+    }
+    
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::ProtectionLevel()
+// -----------------------------------------------------------------------------
+//  
+EXPORT_C 
+    TProtectionLevel CCmDestinationImpl::ProtectionLevel()
+    {
+    return iData->ProtectionLevel();
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::SetAttributeL()
+// -----------------------------------------------------------------------------
+//  
+EXPORT_C void CCmDestinationImpl::SetProtectionL( TProtectionLevel aProtectionLevel )
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::SetProtectionL" );
+    
+    CLOG_WRITE_1( "Level: [%d]", aProtectionLevel );
+
+    CCmManagerImpl::HasCapabilityL( ECapabilityNetworkControl );
+    
+    // Make a destination protected.
+    TUint32 mask = ~KSnapMetadataProtecionLevelMask;
+    TUint32 temp = TUint32(iData->iMetaDataRec->iMetadata) & mask;    
+    iData->iMetaDataRec->iMetadata = aProtectionLevel << 28;
+    iData->iMetaDataRec->iMetadata = temp | TUint32(iData->iMetaDataRec->iMetadata);
+    
+    iData->iProtectionChanged = ETrue;
+    }
+        
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::CreateConnectionMethodL()
+// -----------------------------------------------------------------------------
+//  
+CCmPluginBase* CCmDestinationImpl::CreateConnectionMethodL( 
+                                                   TUint32 aImplementationUid )
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::CreateConnectionMethodL" );
+
+    CCmPluginBase* retval = NULL;
+    if( ProtectionLevel() == EProtLevel1 )
+        {
+        CCmManagerImpl::HasCapabilityL( ECapabilityNetworkControl );
+        }
+    retval = iCmMgr.CreateConnectionMethodL(aImplementationUid, this);
+    CleanupStack::PushL(retval); 
+    AddConnectionMethodL(*retval);
+    CleanupStack::Pop(retval);
+    return retval;
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::CreateConnectionMethodL()
+// -----------------------------------------------------------------------------
+//  
+CCmPluginBase* CCmDestinationImpl::CreateConnectionMethodL( 
+    TUint32 aImplementationUid,
+    TUint32 aConnMthId )
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::CreateConnectionMethodL" );
+
+    CCmPluginBase* retval = NULL;
+    if( ProtectionLevel() == EProtLevel1 )
+        {
+        CCmManagerImpl::HasCapabilityL( ECapabilityNetworkControl );
+        }
+
+    retval = iCmMgr.CreateConnectionMethodL( aImplementationUid,
+                                             aConnMthId,
+                                             this );
+    CleanupStack::PushL(retval);
+    AddConnectionMethodL(*retval);
+    CleanupStack::Pop(retval);
+    return retval;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::AddConnectionMethodL()
+// -----------------------------------------------------------------------------
+//
+TInt CCmDestinationImpl::AddConnectionMethodL( 
+                                           CCmPluginBase& aConnectionMethod )
+    {    
+    LOGGER_ENTERFN( "CCmDestinationImpl::AddConnectionMethodL" );
+
+    if( ProtectionLevel() == EProtLevel1 )
+        {
+        CCmManagerImpl::HasCapabilityL( ECapabilityNetworkControl );
+        }
+        
+    TUint cmId = aConnectionMethod.GetIntAttributeL( ECmId );
+    
+    CPluginItem* item = new (ELeave) CPluginItem;
+    CleanupStack::PushL( item ); // 1
+    
+    // get the plugin
+    CCmPluginBase* connMethod = new (ELeave) 
+                            CCmPluginBase(aConnectionMethod.Plugin());
+    CleanupStack::PushL( connMethod );// 2           
+    connMethod->IncrementRefCounter();    
+    item->iPlugin = connMethod;
+        
+    CleanupStack::PushL( item->iPlugin ); // 3         
+    // create the new record
+    item->iDNRecord = iCmMgr.SNAPRecordL( 0 );
+
+    CleanupStack::PushL( item->iDNRecord ); // 4
+    
+    // if the destination is protection level 1, the connection method must be protected
+    if ( ProtectionLevel() == EProtLevel1 )
+        {
+        item->iPlugin->SetBoolAttributeL( ECmProtected, ETrue );
+        }
+    
+    TInt index = AddToArrayL( item );
+    index = index - KCmInitIndex; //the array contains one initial item, so subtract KCmInitIndex from the index to get cm index!
+    
+    CleanupStack::Pop( 4, item ); // item, connMethod, iDNRecord, iPlugin
+    
+    return index;
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::AddEmbeddedDestinationL()
+// -----------------------------------------------------------------------------
+//
+TInt CCmDestinationImpl::AddEmbeddedDestinationL( 
+                                             CCmDestinationImpl& aDestination )
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::AddEmbeddedDestinationL" );
+    
+    if( ProtectionLevel() == EProtLevel1 )
+        {
+        CCmManagerImpl::HasCapabilityL( ECapabilityNetworkControl );
+        }
+        
+    //Check to avoid multiple levels of embedding
+    CheckIfEmbeddedL( Id() );
+    
+    //Check to avoid multiple levels of embedding
+    if ( aDestination.HasEmbeddedL() )
+        {
+        User::Leave( KErrNotSupported );
+        }
+        
+    // Only one embedded destination per destination is allowed
+    if ( HasEmbeddedL() )
+        {
+        User::Leave( KErrNotSupported );
+        }
+           
+    CPluginItem* item = new (ELeave) CPluginItem;
+    CleanupStack::PushL( item ); // 1
+
+    CreateEmbeddedDestinationPluginL( *item, aDestination.Id() );
+     // create the new record
+    item->iDNRecord = iCmMgr.SNAPRecordL( 0 );
+    item->iDNRecord->iPriority = KDataMobilitySelectionPolicyPriorityWildCard;
+
+    CleanupStack::PushL( item->iDNRecord ); // 2    
+    TInt index = AddToArrayL( item );
+    index = index - KCmInitIndex; //the array contains one initial item, so subtract KCmInitIndex from the index to get cm index!
+    
+    CleanupStack::Pop( 2, item ); // item, iDNRecord
+    
+    return index;   
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::DeleteConnectionMethodL()
+// -----------------------------------------------------------------------------
+// 
+void CCmDestinationImpl::DeleteConnectionMethodL( 
+                                        CCmPluginBase& aConnectionMethod )
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::DeleteConnectionMethodL" );
+    
+    if( ProtectionLevel() == EProtLevel1 ||
+        ProtectionLevel() == EProtLevel3 )
+        {
+        CCmManagerImpl::HasCapabilityL( ECapabilityNetworkControl );
+        }
+        
+    if ( aConnectionMethod.GetBoolAttributeL( ECmConnected ) )
+        {
+        User::Leave( KErrInUse );
+        }
+        
+    TInt index = FindConnectionMethodL( aConnectionMethod );
+
+    // move this method to the 'to be deleted' array         
+    CPluginItem* item = (*(iData->iConnMethodArray))[index];
+    
+    LoadPluginL( *item );
+    
+    if( item->iPlugin->GetBoolAttributeL( ECmIsLinked ) )
+        {
+        User::Leave( KErrLocked );
+        }
+
+    if ( ConnectionMethodCount() == 1 )
+        {
+        // Check if this destination is referenced by Virtual CM 
+        CheckIfReferencedByVirtualCML();
+        }
+
+    iData->iDeleteCmArray->AppendL( item );
+    iData->iConnMethodArray->Delete( index );
+    }
+    
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::RemoveConnectionMethodL()
+// -----------------------------------------------------------------------------
+// 
+void CCmDestinationImpl::RemoveConnectionMethodL( 
+                                     const CCmPluginBase& aConnectionMethod )
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::DeleteConnectionMethodL" );
+
+    if( ProtectionLevel() == EProtLevel1 ||
+        ProtectionLevel() == EProtLevel3 )
+        {
+        CCmManagerImpl::HasCapabilityL( ECapabilityNetworkControl );
+        }
+    
+    if ( ConnectionMethodCount() == 1 )
+        {
+        // Check if this destination is referenced by Virtual CM 
+        CheckIfReferencedByVirtualCML();
+        }
+        
+    TInt index = FindConnectionMethodL( aConnectionMethod );
+
+    // move this method to the 'to be deleted' array, but
+    // set remove only from, not to delete it on update.
+    CPluginItem* item = (*(iData->iConnMethodArray))[index];
+    
+    item->iFlags |= CPluginItem::ERemoveCm;
+   
+    iData->iDeleteCmArray->AppendL( item );
+    iData->iConnMethodArray->Delete( index );
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::CheckIfReferencedByVirtualCML()
+// -----------------------------------------------------------------------------
+// 
+void CCmDestinationImpl::CheckIfReferencedByVirtualCML()
+    {
+    // for each IAP in CM manager
+    //   1. check if it is virtual
+    //      if not => goto 1.
+    //      if yes:
+    //      2. check if it links to the destination of this CM
+    //         if yes => carryOn = EFalse, ERROR
+    //         if not: carryOn = ETrue
+    CommsDat::CMDBRecordSet<CommsDat::CCDIAPRecord>* iaps = iCmMgr.AllIapsL();
+    CleanupStack::PushL( iaps );
+
+    TBool carryOn = ETrue;
+    TUint32 destId = Id();
+
+    // for each IAP in CM manager
+    for ( TInt i = KCmInitIndex; carryOn && i < iaps->iRecords.Count(); ++i )
+        {
+        CommsDat::CCDIAPRecord* rec = (*iaps)[i];
+        TUint32 bearerType = 0;
+
+        TRAP_IGNORE( bearerType = iCmMgr.BearerTypeFromIapRecordL( rec ) );
+        if ( !bearerType )
+            {
+            continue;
+            }
+
+        // check if it is virtual
+        if ( iCmMgr.GetBearerInfoBoolL( bearerType, ECmVirtual ) )
+            {
+            // check if it links to the current destination
+            CCmPluginBase* plugin = NULL;            
+            TRAP_IGNORE( plugin = iCmMgr.GetConnectionMethodL( rec->RecordId() ) );
+
+            if ( !plugin )
+                {
+                continue;
+                }
+
+            if ( plugin->IsLinkedToSnap( destId ) )
+                {
+                // the CM links to this destination, deletion not allowed
+                carryOn = EFalse;
+                }
+
+            delete plugin;
+            }
+        }
+
+    CleanupStack::PopAndDestroy( iaps );
+
+    if ( !carryOn )
+        {
+        User::Leave( KErrLocked );
+        }
+    }
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::RemoveConnectionMethodL()
+// -----------------------------------------------------------------------------
+// 
+void CCmDestinationImpl::RemoveConnectionMethodL( 
+                                     const CCmPluginBaseEng& aConnectionMethod )
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::DeleteConnectionMethodL" );
+
+    if( ProtectionLevel() == EProtLevel1 ||
+        ProtectionLevel() == EProtLevel3 )
+        {
+        CCmManagerImpl::HasCapabilityL( ECapabilityNetworkControl );
+        }
+        
+    TInt index = FindConnectionMethodL( aConnectionMethod );
+
+    // move this method to the 'to be deleted' array, but
+    // set remove only from, not to delete it on update.
+    CPluginItem* item = (*(iData->iConnMethodArray))[index];
+    
+    item->iFlags |= CPluginItem::ERemoveCm;
+   
+    iData->iDeleteCmArray->AppendL( item );
+    iData->iConnMethodArray->Delete( index );
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::ConnectionMethodDeletedL()
+// -----------------------------------------------------------------------------
+// 
+void CCmDestinationImpl::ConnectionMethodDeletedL( 
+                                    const CCmPluginBase& aConnectionMethod )
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::ConnectionMethodDeletedL" );
+
+    TInt found( KErrNotFound );
+    TUint32 aCmId = aConnectionMethod.GetIntAttributeL( ECmId );
+
+    found = ConnectionMethodIndex( aCmId );
+
+    if( found != KErrNotFound )
+        {
+        CPluginItem* item = (*(iData->iConnMethodArray))[found];
+        
+        (*(iData->iConnMethodArray))[found] = NULL;
+        iData->iConnMethodArray->Delete( found );
+        iData->iConnMethodArray->Compress();
+        
+        // The iPlugin is deleted in plugin interface function
+        // that called this function.
+        delete item->iDNRecord;
+        delete item;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::FindConnectionMethodL()
+// -----------------------------------------------------------------------------
+// 
+TInt CCmDestinationImpl::FindConnectionMethodL( 
+                                     const CCmPluginBase& aConnectionMethod )
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::FindConnectionMethodL" );
+
+    TInt cmId = aConnectionMethod.GetIntAttributeL( ECmId );
+    TBool embeded = aConnectionMethod.GetBoolAttributeL( ECmDestination ) ?
+                      ETrue :
+                      EFalse;
+
+    CLOG_WRITE_2( "ID: [%d], embDest: [%d]", 
+                  cmId, 
+                  aConnectionMethod.GetBoolAttributeL( ECmDestination ) );
+    
+    for ( TInt i = KCmInitIndex; i < iData->iConnMethodArray->Count(); ++i )
+        {
+        CPluginItem* item = (*(iData->iConnMethodArray))[i];
+        if( embeded )
+            {
+            if( item->iDNRecord->iEmbeddedSNAP == cmId )
+                {
+                return i;
+                }        
+            }
+        else
+            {
+            if( RECORD_FROM_ELEMENT_ID(item->iDNRecord->iIAP) == cmId )
+                {
+                return i;
+                }
+            }
+        }
+        
+    CLOG_WRITE( "Not found" );
+    User::Leave( KErrNotFound );
+    
+    // dummy return value. never used.
+    return -1;
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::FindConnectionMethodL()
+// -----------------------------------------------------------------------------
+// 
+TInt CCmDestinationImpl::FindConnectionMethodL( 
+                                     const CCmPluginBaseEng& aConnectionMethod )
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::FindConnectionMethodL" );
+
+    TInt cmId = aConnectionMethod.GetIntAttributeL( ECmId );
+    TBool embeded = aConnectionMethod.GetBoolAttributeL( ECmDestination ) ?
+                      ETrue :
+                      EFalse;
+
+    CLOG_WRITE_2( "ID: [%d], embDest: [%d]", 
+                  cmId, 
+                  aConnectionMethod.GetBoolAttributeL( ECmDestination ) );
+    
+    for ( TInt i = KCmInitIndex; i < iData->iConnMethodArray->Count(); ++i )
+        {
+        CPluginItem* item = (*(iData->iConnMethodArray))[i];
+        if( embeded )
+            {
+            if( item->iDNRecord->iEmbeddedSNAP == cmId )
+                {
+                return i;
+                }        
+            }
+        else
+            {
+            if( RECORD_FROM_ELEMENT_ID(item->iDNRecord->iIAP) == cmId )
+                {
+                return i;
+                }
+            }
+        }
+        
+    CLOG_WRITE( "Not found" );
+    User::Leave( KErrNotFound );
+    
+    // dummy return value. never used.
+    return -1;
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::ModifyPriorityL()
+// -----------------------------------------------------------------------------
+//      
+void CCmDestinationImpl::ModifyPriorityL( CCmPluginBase& aCCMItem, 
+                                          TUint aIndex )
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::ModifyPriorityL" );
+    
+    if (aCCMItem.GetBoolAttributeL(ECmDestination) ||
+        (aCCMItem.GetBoolAttributeL(ECmVirtual) &&
+         aCCMItem.GetIntAttributeL(ECmNextLayerSNAPId)))
+        {
+        // Priority can not be changed for this cm
+        return;
+        }
+        
+    if( ProtectionLevel() == EProtLevel1 ||
+        ProtectionLevel() == EProtLevel3 )
+        {
+        CCmManagerImpl::HasCapabilityL( ECapabilityNetworkControl );
+        }
+        
+    TBool found( EFalse );
+    TInt cm2 = aCCMItem.GetIntAttributeL( ECmId );
+    
+    if ( aIndex >= ( iData->iConnMethodArray->Count() - KCmInitIndex ) )
+        {
+        User::Leave( KErrArgument );
+        }
+    
+    for ( TInt i = KCmInitIndex; i < iData->iConnMethodArray->Count(); i++ )
+        {
+        LoadPluginL( *(*(iData->iConnMethodArray))[i] );
+            
+        // Compare the IAP IDs
+        TInt cm1 = (*(iData->iConnMethodArray))[i]->iPlugin->GetIntAttributeL( ECmId );        
+        
+        if ( cm1 == cm2 )
+            {
+            CPluginItem* item = (*(iData->iConnMethodArray))[i];
+            
+            TInt pri = (*(iData->iConnMethodArray))[i]->iDNRecord->iPriority;
+            if ( pri == KDataMobilitySelectionPolicyPriorityWildCard )
+                {
+                TUint32 prio = 0;
+                TUint32 bearerType = 0;
+                TUint32 extLevel = 0;
+                
+                TBool isVirtual = PrioDataL( item, prio, bearerType, extLevel );
+                if (prio != KDataMobilitySelectionPolicyPriorityWildCard)
+                    {
+                    // The priority will be changed later when UpdateL is called
+                    // So, the priority will simply be chnaged from
+                    // KDataMobilitySelectionPolicyPriorityWildCard to value i
+                    (*(iData->iConnMethodArray))[i]->iDNRecord->iPriority = i; 
+                    }
+                }
+            
+            (*(iData->iConnMethodArray))[i] = NULL;
+            
+            // remove from array
+            iData->iConnMethodArray->Delete( i );
+            iData->iConnMethodArray->Compress();
+            iData->iConnMethodArray->InsertL( KCmInitIndex + aIndex, item );
+            
+            found = ETrue;           
+            break;
+            }
+        }
+        
+    if ( !found )
+        {
+        User::Leave( KErrArgument );
+        }
+        
+    }
+    
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::PriorityL()
+// -----------------------------------------------------------------------------
+//          
+TUint CCmDestinationImpl::PriorityL( CCmPluginBaseEng& aCCMItem )
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::PriorityL" );
+
+    TInt index = FindConnectionMethodL( aCCMItem );
+    
+    return (*(iData->iConnMethodArray))[index]->iDNRecord->iPriority;
+    }
+    
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::PriorityL()
+// -----------------------------------------------------------------------------
+//          
+TUint CCmDestinationImpl::PriorityL( CCmPluginBase& aCCMItem )
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::PriorityL" );
+
+    TInt index = FindConnectionMethodL( aCCMItem );
+    
+    return (*(iData->iConnMethodArray))[index]->iDNRecord->iPriority;
+    }
+    
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::UpdateL()
+// -----------------------------------------------------------------------------
+//          
+EXPORT_C void CCmDestinationImpl::UpdateL()
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::UpdateL" );
+
+    // Connection methods and destination records are updated in 
+    // one transaction.
+    OpenTransactionLC();
+    
+    DeleteConnectionMethodsL();
+
+    // Update protection level of connection methods if it's changed in 
+    // the destination
+    UpdateProtectionL();
+    // Updates all modified connection methods.
+    UpdateConnectionMethodsL();
+    UpdateNetworkRecordL();
+    UpdateDestAPRecordL();
+    UpdateSNAPTableL();
+    UpdateSNAPMetadataTableL();
+        
+    CommitTransactionL( KErrNone );
+    
+    // set the last updated protection level of the destination
+    iData->iLastProtectionLevel = ProtectionLevel();
+
+    // Clear the modified flag
+    iData->iProtectionChanged = EFalse;
+
+    // empty the array, but do not delete it
+    iData->ResetAndDestroyArray( iData->iDeleteCmArray, EFalse );
+        
+    iCmMgr.DestinationUpdated(this);
+    iData->iIdIsValid = ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::DeleteLD()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CCmDestinationImpl::DeleteLD()
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::DeleteLD" );
+
+    if( ProtectionLevel() == EProtLevel1 )
+        {
+        CCmManagerImpl::HasCapabilityL( ECapabilityNetworkControl );
+        }
+        
+    TInt count = iData->iConnMethodArray->Count();
+
+    if( IsConnectedL() )
+        {
+        User::Leave( KErrInUse );
+        }
+
+    // Check first that any of the CMs in this Destination is not
+    // referenced by Virtual CM
+    TInt i( 0 );
+    
+    for( i = KCmInitIndex; i < count; ++i )
+        {
+        CPluginItem* item = (*(iData->iConnMethodArray))[i];
+        
+        LoadPluginL( *item );
+            
+        if( item->iPlugin->GetBoolAttributeL( ECmIsLinked ) )
+            {
+            User::Leave( KErrLocked );
+            }
+        }
+    // Check that this Destination is not referenced by any Virtual CM
+    if ( ConnectionMethodCount() > 0 )
+        {
+        CheckIfReferencedByVirtualCML();
+        }
+
+    OpenTransactionLC();
+    TRAPD( err, DeleteRelatedRecordsL( count ) );
+    if ( err )
+        {
+        RollbackTransaction();
+        User::Leave( err );
+        }
+    CommitTransactionL(KErrNone);
+
+    delete this;
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::DeleteRelatedRecordsL()
+// -----------------------------------------------------------------------------
+//
+void CCmDestinationImpl::DeleteRelatedRecordsL( TInt aCount )
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::DeleteRelatedRecordsL" );
+
+    CleanUpEmbeddedL( Id() );
+
+    TCmDefConnValue deletedItem;
+    deletedItem.iType = ECmDefConnDestination;
+    deletedItem.iId = Id();
+    iCmMgr.HandleDefConnDeletedL( deletedItem );       
+    CMDBRecordBase* dnIapRecord;
+    TInt i;
+    
+    // Here we don't use KCmInitIndex becouse initial entry should be deleted
+    // too!
+    for ( i = 0; i < aCount; i++ )
+        {
+        CPluginItem* item = (*(iData->iConnMethodArray))[i];
+        
+        // Delete the plugin
+        if ( i >= KCmInitIndex )
+            {
+            if ( !item->iPlugin->Plugin()->IdIsValid() )
+                {
+                // Delete incomplete plugin 
+                delete item->iPlugin;
+                item->iPlugin = NULL;
+                }
+            else
+                {
+                TRAPD( err, item->iPlugin->DeleteL( EFalse ) );
+                
+                if( err != KErrLocked &&
+                    err != KErrNotReady )
+                    {
+                    User::LeaveIfError( err );
+                    }
+                    
+                delete item->iPlugin;
+                item->iPlugin = NULL;
+                }
+            }  
+        
+        // Delete the DN-IAP record
+        dnIapRecord = item->iDNRecord;
+        
+        if ( dnIapRecord->RecordId() )
+            // If we have record Id, this record is already in CommsDat
+            {
+            dnIapRecord->DeleteL( Session() );
+            }   
+        delete item->iDNRecord;
+        item->iDNRecord = NULL;
+        }
+
+    iData->iDestAPRecord->DeleteL( Session() ); // deletes a record
+    iData->iNetworkRecord->DeleteL( Session() ); // deletes a record
+    
+    // Delete SNAPMetadata table    
+    CMDBRecordSet<CCDSNAPMetadataRecord>*  ptrRecordSet = 
+                    new (ELeave) CMDBRecordSet<CCDSNAPMetadataRecord>( 
+                                                 iCmMgr.IconTableId() );
+    CleanupStack::PushL( ptrRecordSet );
+
+    // Prime record
+    CCDSNAPMetadataRecord* record = 
+        new (ELeave) CCDSNAPMetadataRecord( iCmMgr.IconTableId() );
+    CleanupStack::PushL( record );
+    record->iSNAP = Id();
+    ptrRecordSet->iRecords.AppendL( record );
+
+    CleanupStack::Pop( record );
+    record = NULL;
+                
+    if ( ptrRecordSet->FindL( Session() ) )
+        {
+        (*ptrRecordSet)[0]->DeleteL( Session() );          
+        }
+        
+    ptrRecordSet->iRecords.ResetAndDestroy();
+    CleanupStack::PopAndDestroy( ptrRecordSet );
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::CheckIfEmbeddedL()
+// -----------------------------------------------------------------------------
+//
+void CCmDestinationImpl::CheckIfEmbeddedL( TInt aId )
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::CheckIfEmbeddedL" );
+    
+    CMDBRecordSet<CCDSnapRecord>*  ptrRecordSet = 
+                    new (ELeave) CMDBRecordSet<CCDSnapRecord>( 
+                                          iCmMgr.DestinationTableId() );
+    CleanupStack::PushL( ptrRecordSet );
+
+    // Prime record
+    CCDSnapRecord* record = iCmMgr.SNAPRecordL( 0 );
+    CleanupStack::PushL( record );
+    record->iEmbeddedSNAP = aId;
+    ptrRecordSet->iRecords.AppendL( record );
+
+    CleanupStack::Pop( record );
+    record = NULL;
+        
+    OpenTransactionLC();    
+    if( ptrRecordSet->FindL( Session() ) )
+        // Match found - it's embedded
+        {
+        User::Leave( KErrNotSupported );          
+        }
+    RollbackTransaction();
+
+    ptrRecordSet->iRecords.ResetAndDestroy();
+    
+    CleanupStack::PopAndDestroy( ptrRecordSet );
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::HasEmbeddedL
+// -----------------------------------------------------------------------------
+//
+TBool CCmDestinationImpl::HasEmbeddedL()
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::HasEmbeddedL" );
+
+    return ( EmbeddedL() != NULL )? ETrue : EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::EmbeddedL
+// -----------------------------------------------------------------------------
+//
+CCmDestinationImpl* CCmDestinationImpl::EmbeddedL()
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::EmbeddedL" );
+
+    CCmDestinationImpl* retVal = NULL;
+    // Check if the destination contains embedded destinations
+    for ( TInt i = KCmInitIndex; i < iData->iConnMethodArray->Count(); i++ )
+        {
+        LoadPluginL( *(*(iData->iConnMethodArray))[i] );
+        // It's an embedded destination ( this is also true for VPN CMs )
+        retVal = (*(iData->iConnMethodArray))[i]->iPlugin->Destination();
+        if ( retVal )
+            {
+            // as there can be only one
+            // embedded destination, the first one is enough
+            break;
+            }
+        }
+    
+    return retVal;
+    }
+ 
+ // -----------------------------------------------------------------------------
+// CCmDestinationImpl::CanUseToConnectL
+// -----------------------------------------------------------------------------
+//
+TBool CCmDestinationImpl::CanUseToConnectL()
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::CanUseToConnectL" );
+
+    const TInt KZeroItem = 0;
+    const TInt KOneItem = 1;
+    TInt cmCount = ConnectionMethodCount(); //without KCmInitIndex !!!
+    switch ( cmCount )
+        {
+        case KZeroItem:// no items at all
+            {
+            return EFalse;
+            }
+        case KOneItem:// One item, a possible empty embedded destination!
+            {
+            CCmDestinationImpl* embeddedDest = EmbeddedL();
+            if ( embeddedDest )
+                {
+                // If embeddedDest->ConnectionMethodCount() is not zero,
+                // we have something in the embedded destination
+                // which cannot be another embedded destination, 
+                // since multiple embedding is not allowed.
+                return embeddedDest->ConnectionMethodCount();
+                }
+             else
+                {
+                return ETrue; //not an embedded destination
+                }
+            }
+        default: // more than one item, only one can be an empty embedded
+                 // destination, so we surely contain a valid cm
+            {
+            return ETrue;
+            }
+            
+        }
+    }
+    
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::UpdateNetworkRecordL()
+// -----------------------------------------------------------------------------
+//
+void CCmDestinationImpl::UpdateNetworkRecordL()
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::UpdateNetworkRecordL" );
+
+    if ( !iData->iNetworkRecord->RecordId() || iData->iNewWithId )
+        {
+        CLOG_WRITE( "New Destination, create it!" );
+        //Create a network record, set the host name and add it to the database    
+
+        if ( !iData->iNewWithId )
+        	{
+        	iData->iNetworkRecord->SetRecordId(KCDNewRecordRequest);
+        	}
+
+        SetAttribute( iData->iNetworkRecord, 
+                      ECDProtectedWrite, 
+                      ProtectionLevel() == EProtLevel1 );
+
+        iData->iNetworkRecord->StoreL( Session() ); //adds a new record
+        iData->iNewWithId = EFalse;
+        }
+    else
+        {
+        SetAttribute( iData->iNetworkRecord, 
+                      ECDProtectedWrite, 
+                      ProtectionLevel() == EProtLevel1 );
+
+        iData->iNetworkRecord->ModifyL( Session() );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::UpdateDestAPRecordL()
+// -----------------------------------------------------------------------------
+//
+void CCmDestinationImpl::UpdateDestAPRecordL()
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::UpdateDestAPRecordL" );
+
+    if ( !iData->iDestAPRecord->RecordId() )
+        {
+        CLOG_WRITE( "New Destination, create AP for it!" );
+        //Create an AP record, set the selection policy(network id)
+        //and add it to the database
+        iData->iDestAPRecord->SetRecordId(KCDNewRecordRequest);
+        iData->iDestAPRecord->iRecordTag = CreateDestinationAPTagIdL();
+        iData->iDestAPRecord->iCustomSelectionPolicy = iData->iNetworkRecord->RecordId();
+        iData->iDestAPRecord->iRecordName.SetL(iData->iNetworkRecord->iRecordName);
+        iData->iDestAPRecord->StoreL( Session() ); //adds a new record
+        }
+    else
+        {
+        iData->iDestAPRecord->iCustomSelectionPolicy = iData->iNetworkRecord->RecordId();
+        iData->iDestAPRecord->iRecordName.SetL(iData->iNetworkRecord->iRecordName);
+        iData->iDestAPRecord->ModifyL( Session() ); //modifies the existing
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::CreateDestinationAPTagId()
+// -----------------------------------------------------------------------------
+//
+TUint32 CCmDestinationImpl::CreateDestinationAPTagIdL()
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::CreateDestinationAPTagId" );
+
+    return KCmDefaultDestinationAPTagId + iData->iNetworkRecord->RecordId();
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::GetDestinationAPTagId()
+// -----------------------------------------------------------------------------
+//
+TUint32 CCmDestinationImpl::GetDestinationAPTagId( )
+    {
+    return iData->iNetworkRecord->RecordId() + KCmDefaultDestinationAPTagId;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::UpdateProtectionL()
+// -----------------------------------------------------------------------------
+//
+void CCmDestinationImpl::UpdateProtectionL()
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::UpdateProtectionL" );
+
+    if( !iData->iProtectionChanged )
+        // protection level not changed -> nothing to update here
+        {
+        return;
+        }
+        
+    for ( TInt i = KCmInitIndex; i < iData->iConnMethodArray->Count(); i++ )
+        {
+        CPluginItem* item = (*(iData->iConnMethodArray))[i];
+        
+        LoadPluginL( *item );
+        
+        switch ( ProtectionLevel() ) 
+            {
+            case EProtLevel0:
+            case EProtLevel2:
+                {
+                // from the protection level 0 to 2 and vice versa 
+                // the ECmProtected value of the CM is not changed                
+                if( iData->iLastProtectionLevel == EProtLevel1 ||
+                    iData->iLastProtectionLevel == EProtLevel3 )
+                    {
+                    item->iPlugin->SetBoolAttributeL( ECmProtected, EFalse );
+                    }
+                }
+              break;
+            case EProtLevel1:
+            case EProtLevel3:
+                {
+                item->iPlugin->SetBoolAttributeL( ECmProtected, ETrue );
+                }
+              break;
+            default:
+                {
+                //
+                }
+              break;              
+             }                      
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::UpdateConnectionMethodsL()
+// -----------------------------------------------------------------------------
+//
+void CCmDestinationImpl::UpdateConnectionMethodsL()
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::UpdateConnectionMethodsL" );
+
+    for( TInt i = KCmInitIndex; i < iData->iConnMethodArray->Count(); ++i )
+        {
+        CPluginItem* item = (*(iData->iConnMethodArray))[i];
+        
+        // If the plugin is not loaded, it means that this a old one, or nothing
+        // modified in it -> there's no need to update it.
+        if( item->iPlugin )
+            {
+            item->iPlugin->UpdateL();
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::SetAttribute()
+// -----------------------------------------------------------------------------
+//
+void CCmDestinationImpl::SetAttribute( CMDBRecordBase* aRecord, 
+                                       TUint32 aAttribute, TBool aSet )
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::SetAttribute" );
+    
+    if ( aSet && !aRecord->IsSetAttribute( aAttribute ) )
+        {
+        aRecord->SetAttributes( aAttribute );
+        }
+    else if( !aSet && aRecord->IsSetAttribute( aAttribute ) )
+        {
+        aRecord->ClearAttributes( aAttribute );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::UpdateSNAPTableL()
+// -----------------------------------------------------------------------------
+//
+void CCmDestinationImpl::UpdateSNAPTableL()
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::UpdateSNAPTableL" );
+    
+    TInt i;
+    CCDSnapRecord* dnIapRecord;
+
+    // Now we have only records of which are new or needs to be updated
+    for ( i = KCmInitIndex; i < iData->iConnMethodArray->Count(); ++i )
+        {
+        TInt pri = (*(iData->iConnMethodArray))[i]->iDNRecord->iPriority;
+
+        if ( pri != i &&
+             pri != KDataMobilitySelectionPolicyPriorityWildCard )
+            // wildcard priority CM have to be the last one in the array.
+            // In theory they cannot be re-prioritized.
+            {
+            (*(iData->iConnMethodArray))[i]->iDNRecord->iPriority = i;
+            }
+        }
+
+    // Here we don't use KCmInitIndex becouse initial entry should be updated 
+    // too!
+    for ( i = 0; i < iData->iConnMethodArray->Count(); ++i )
+        {
+        dnIapRecord = (*(iData->iConnMethodArray))[i]->iDNRecord;
+        
+        if( dnIapRecord->iIAP )
+            {
+            if( !RECORD_FROM_ELEMENT_ID( dnIapRecord->iIAP ) )
+                {
+                dnIapRecord->iIAP = (*(iData->iConnMethodArray))[i]->iPlugin->IAPRecordElementId();
+                }
+            }
+        
+        // Set protection on connection methods 
+        SetAttribute( dnIapRecord, 
+                      ECDProtectedWrite, 
+                      ProtectionLevel() == EProtLevel1 ? ETrue : EFalse );
+        // Metadata is used instead of ECDHidden Attribute                      
+        //SetAttribute( dnIapRecord, ECDHidden, iData->iNetworkRecord->Attributes() & ECDHidden );
+        CheckIfNameModifiedL( dnIapRecord );
+             
+        if ( dnIapRecord->RecordId() )
+            {           
+            dnIapRecord->ModifyL( Session() );
+            }
+        else
+            // this is a new record
+            {
+            dnIapRecord->SetRecordId(KCDNewRecordRequest);
+            dnIapRecord->iSNAP = Id();
+            dnIapRecord->StoreL( Session() );
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::UpdateSNAPMetadataTableL()
+// -----------------------------------------------------------------------------
+//
+void CCmDestinationImpl::UpdateSNAPMetadataTableL()
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::UpdateSNAPMetadataTableL" );
+    
+    if( !iData->iMetaDataRec->RecordId() )
+        // new record
+        {
+        iData->iMetaDataRec->iSNAP = Id();
+        iData->iMetaDataRec->SetRecordId( KCDNewRecordRequest );
+        iData->iMetaDataRec->StoreL( Session() );
+        }
+    else
+        {
+        iData->iMetaDataRec->ModifyL( Session() );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::LoadSNAPMetadataTableL()
+// -----------------------------------------------------------------------------
+//
+void CCmDestinationImpl::LoadSNAPMetadataTableL()
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::LoadSNAPMetadataTableL" );
+
+    iData->iMetaDataRec = new (ELeave) CCDSNAPMetadataRecord( 
+                                            iCmMgr.IconTableId() );
+
+    iData->iMetaDataRec->iSNAP = Id();
+                
+    if ( !iData->iMetaDataRec->FindL( Session() ) )
+        // Not found -> fill in with default values
+        {
+        iData->iMetaDataRec->iSNAP = Id();
+        iData->iMetaDataRec->iIcon = 0;
+        iData->iMetaDataRec->iMetadata = 0;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::LoadNetworkRecordL()
+// -----------------------------------------------------------------------------
+//
+void CCmDestinationImpl::LoadNetworkRecordL( TUint32 /*aDestinationId*/ )
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::LoadNetworkRecordL" );
+
+    // set the record ID
+    iData->iNetworkRecord->SetRecordId( iData->iDestAPRecord->iCustomSelectionPolicy );
+  
+    // load the record ID
+    iData->iNetworkRecord->LoadL( Session() );
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::LoadDestAPRecordL()
+// -----------------------------------------------------------------------------
+//
+void CCmDestinationImpl::LoadDestAPRecordL( TUint32 aDestinationId )
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::LoadDestAPRecordL" );
+
+    if ( aDestinationId > KCmDefaultDestinationAPTagId )
+        {
+        // set the record ID
+        iData->iDestAPRecord->iRecordTag = aDestinationId;
+        // load the record ID
+        if ( iData->iDestAPRecord->FindL( Session() ) )
+            {
+            iData->iDestAPRecord->LoadL( Session() );
+            }
+        else
+            {
+            User::Leave( KErrNotFound );
+            }
+        }
+    else
+        {
+        User::Leave( KErrArgument );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::LoadConnectionMethodsL()
+// -----------------------------------------------------------------------------
+//    
+void CCmDestinationImpl::LoadConnectionMethodsL()
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::LoadConnectionMethodsL" );
+    
+    CMDBRecordSet<CCDSnapRecord>*  ptrRecordSet = 
+                        new (ELeave) CMDBRecordSet<CCDSnapRecord>( 
+                                          iCmMgr.DestinationTableId() );
+    CleanupStack::PushL( ptrRecordSet );
+
+    // Prime record
+    CCDSnapRecord* snapRec = iCmMgr.SNAPRecordL( 0 );
+    CleanupStack::PushL( snapRec );
+    snapRec->iSNAP = Id();
+    ptrRecordSet->iRecords.AppendL( snapRec );
+
+    CleanupStack::Pop( snapRec );
+    snapRec = NULL;
+
+    OpenTransactionLC();            
+    if ( !ptrRecordSet->FindL(Session()) )
+        // no conn method is to this destination -> it was not us who made it
+        {
+        CLOG_WRITE( "Empty destination" );
+        User::Leave( KErrUnderflow );
+        }
+
+    TLinearOrder<CMDBRecordBase> orderbyId( 
+                                    CCmDestinationImpl::SortRecordsByPriority );
+    ptrRecordSet->iRecords.Sort(orderbyId);
+
+    TInt count = ptrRecordSet->iRecords.Count();
+    
+    //Load IAP records to be used to check if the IAPs are existing
+    CMDBRecordSet<CCDIAPRecord>*  ptrIapSet = 
+                    new (ELeave) CMDBRecordSet<CCDIAPRecord>( KCDTIdIAPRecord );
+    CleanupStack::PushL( ptrIapSet );
+    
+    TRAPD( err, ptrIapSet->LoadL( Session() ) );
+
+    if( !err )
+        {
+        CLOG_WRITE_1_PTR( NULL, "Record num [%d]", ptrIapSet->iRecords.Count() );
+        
+        // Here we don't use CM_INIT_INDEX because initial entry should be 
+        // loaded too!
+        for ( TInt i = 0; i < count; i++ )
+            {
+            snapRec = (*ptrRecordSet)[i];
+            TBool exist( EFalse );
+            
+            // Check if CM really exists, if not 
+            // it should be cleared from selection policy table
+            TInt32 embedded = QUERY_INT_FIELD( 
+                                snapRec, 
+                                KCDTIdDataMobilitySelectionPolicyEmbeddedSNAP );
+            TInt32 iap = RECORD_FROM_ELEMENT_ID( 
+                            QUERY_INT_FIELD( 
+                                       snapRec, 
+                                       KCDTIdDataMobilitySelectionPolicyIAP ) );
+            // Item could be embedded destination or iap
+            if ( embedded )
+                {
+                CCDAccessPointRecord * destAPRecord = static_cast<CCDAccessPointRecord *>(
+                                CCDRecordBase::RecordFactoryL( KCDTIdAccessPointRecord ) );
+                CleanupStack::PushL( destAPRecord );
+                destAPRecord->iRecordTag = embedded;
+                if ( !destAPRecord->FindL( Session() ) )
+                    {
+                    CleanUpSnapMetadataTableL( embedded );
+                    (*ptrRecordSet)[i]->DeleteL( Session() );
+                    }
+                else
+                    {
+                    exist = ETrue;
+                    }
+                    
+                CleanupStack::PopAndDestroy( destAPRecord );
+                }                
+            else if ( iap )
+                // This is an AP
+                {
+                for ( TInt iapInd = 0; iapInd < ptrIapSet->iRecords.Count(); ++iapInd )
+                    {
+                    CMDBRecordBase* iapRec = (*ptrIapSet)[iapInd];
+
+                    if ( iap == iapRec->RecordId() )
+                        {
+                        exist = ETrue;
+                        delete iapRec;
+                        // this way we can filter out duplicated CMs
+                        ptrIapSet->iRecords.Remove( iapInd );
+                        break;
+                        }
+                    }
+                if ( !exist )
+                    {
+                    DeleteIAPRecordsL( snapRec );
+                    }
+                }
+            
+            // The first record is a dummy one where iap and snap are zero
+            if ( exist || ( !embedded && !iap ) )
+                {
+                // The item may have to be loaded at this stage so that the supported can be checked 
+                // before it is put into iData->iConnMethodArray for the item may be unsupported.
+                TInt err( 0 );
+                
+                if ( i != 0 )
+                    {
+                    if ( embedded )
+                        {
+                        TRAP( err, TUint32 bearerType = iCmMgr.BearerTypeFromCmIdL( embedded ) );
+                        }
+                    else if ( iap )
+                        {
+                        TRAP( err, TUint32 bearerType = iCmMgr.BearerTypeFromCmIdL( iap ) );
+                        }
+                    }
+               
+                if ( !err )
+                    {
+                    CPluginItem* item = new (ELeave) CPluginItem;
+                    CleanupStack::PushL( item );
+                    
+                    item->iDNRecord = iCmMgr.SNAPRecordL( snapRec->RecordId() );
+                    item->iPlugin = NULL;
+
+                    iData->iConnMethodArray->AppendL( item );
+                
+                    CleanupStack::Pop( item );
+                    }
+                }
+            }
+        }
+    else
+        // There's no connection method in the phone
+        {
+        CPluginItem* item = new (ELeave) CPluginItem;
+        
+        CleanupStack::PushL( item );
+        
+        item->iDNRecord = iCmMgr.SNAPRecordL( (*ptrRecordSet)[0]->RecordId() );
+
+        iData->iConnMethodArray->AppendL( item );       
+        
+        CleanupStack::Pop( item );                 
+        }
+        
+    CleanupStack::PopAndDestroy( ptrIapSet );
+    RollbackTransaction();
+        
+    ptrRecordSet->iRecords.ResetAndDestroy();
+    CleanupStack::PopAndDestroy( ptrRecordSet );
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::ReLoadConnectionMethodsL()
+// -----------------------------------------------------------------------------
+//
+void CCmDestinationImpl::ReLoadConnectionMethodsL()
+    {
+    TInt count = iData->iConnMethodArray->Count();
+    //TInt index = KCmInitIndex;
+    TInt index = 0;
+    
+    while ( index < count )
+        {
+        CPluginItem* item = (*(iData->iConnMethodArray))[index];
+        item->iFlags |= CPluginItem::ERemoveCm;
+        
+        iData->iDeleteCmArray->AppendL( item );
+        iData->iConnMethodArray->Delete( index );
+        iData->iConnMethodArray->Compress();
+        
+        count = iData->iConnMethodArray->Count();
+        }
+    
+    // Empty the array, but do not delete it
+    iData->ResetAndDestroyArray( iData->iDeleteCmArray, EFalse );
+    
+    LoadConnectionMethodsL();
+    }
+    
+// ---------------------------------------------------------
+// CCmDestinationImpl::CleanUpEmbeddedL
+// ---------------------------------------------------------
+//
+void CCmDestinationImpl::CleanUpEmbeddedL(TUint32 aDestId)
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::CleanUpEmbeddedL" );
+
+    TBool found = EFalse;
+    CMDBRecordSet<CCDSnapRecord>*  ptrRecordSet = 
+                        new (ELeave) CMDBRecordSet<CCDSnapRecord>( 
+                                          iCmMgr.DestinationTableId() );
+    CleanupStack::PushL( ptrRecordSet );
+    // Prime record
+    CCDSnapRecord* snapRec = iCmMgr.SNAPRecordL( 0 );
+    CleanupStack::PushL( snapRec );
+    snapRec->iEmbeddedSNAP = aDestId;
+    ptrRecordSet->iRecords.AppendL( snapRec );
+    CleanupStack::Pop( snapRec );
+    snapRec = NULL;
+
+    if ( ptrRecordSet->FindL(Session()) )
+        {
+        for ( TInt i = 0; i <ptrRecordSet->iRecords.Count(); i++ )
+            {
+            (*ptrRecordSet)[i]->DeleteL( Session() );
+            }
+        found = ETrue;
+        }
+    CleanupStack::PopAndDestroy( ptrRecordSet );
+    if (found)
+        {
+        CleanUpSnapMetadataTableL(aDestId);    
+        }
+    }
+// ---------------------------------------------------------
+// CCmDestinationImpl::CleanUpSnapMetadataTableL
+// ---------------------------------------------------------
+//
+void CCmDestinationImpl::CleanUpSnapMetadataTableL( TUint32 aSnap )
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::CleanUpSnapMetadataTableL" );
+    
+    // Just to test how many record we have
+    CMDBRecordSet<CCDSNAPMetadataRecord>*  ptrRecordSet 
+                = new (ELeave) CMDBRecordSet<CCDSNAPMetadataRecord>( 
+                                                iCmMgr.IconTableId() );
+    CleanupStack::PushL( ptrRecordSet );
+        
+    // Prime record
+    CCDSNAPMetadataRecord* record = 
+            new (ELeave) CCDSNAPMetadataRecord( iCmMgr.IconTableId() );
+    CleanupStack::PushL( record );
+    
+    record->iSNAP = aSnap;
+    ptrRecordSet->iRecords.AppendL( record );
+    
+    CleanupStack::Pop( record );
+    record = NULL;
+    
+    if ( ptrRecordSet->FindL( Session() ) )
+        {
+        for ( TInt i = 0; i <ptrRecordSet->iRecords.Count(); i++ )
+            {
+            (*ptrRecordSet)[i]->DeleteL( Session() );
+            }
+        }
+        
+    CleanupStack::PopAndDestroy( ptrRecordSet );    //ptrRecordSet 
+    }
+
+// ---------------------------------------------------------
+// CCmDestinationImpl::CleanUpSeamlessnessTableL
+// ---------------------------------------------------------
+//
+void CCmDestinationImpl::CleanUpSeamlessnessTableL( TUint32 aIapId )
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::CleanUpSeamlessnesstableL" );
+    
+    // Just to test how many record we have
+    CMDBRecordSet<CCDIAPMetadataRecord>*  ptrRecordSet 
+        = new (ELeave) CMDBRecordSet<CCDIAPMetadataRecord>( 
+                                        iCmMgr.SeamlessnessTableId() );
+    CleanupStack::PushL( ptrRecordSet );
+        
+    // Prime record
+    CCDIAPMetadataRecord* record = 
+      new (ELeave) CCDIAPMetadataRecord( iCmMgr.SeamlessnessTableId() );
+    CleanupStack::PushL( record );
+    
+    TMDBElementId elementid = iCmMgr.SeamlessnessTableId() & 
+                              KCDTIdIAPMetadataIAP & 
+                              aIapId;
+    record->iSeamlessness = elementid;
+    ptrRecordSet->iRecords.AppendL( record );
+    
+    CleanupStack::Pop( record );
+    record = NULL;
+    
+    if ( ptrRecordSet->FindL( Session() ) )
+        {
+        for ( TInt i = 0; i <ptrRecordSet->iRecords.Count(); i++ )
+            {
+            (*ptrRecordSet)[i]->DeleteL( Session() );
+            }
+        }
+        
+    CleanupStack::PopAndDestroy( ptrRecordSet );
+    }
+    
+// ---------------------------------------------------------
+// CCmDestinationImpl::SortRecordsByPriority
+// ---------------------------------------------------------
+//
+TInt CCmDestinationImpl::SortRecordsByPriority( const CMDBRecordBase& aLeft, 
+                                                const CMDBRecordBase& aRight )
+    {
+    TUint left = QUERY_INT_FIELD( const_cast<CMDBRecordBase*>(&aLeft), 
+                                  KCDTIdDataMobilitySelectionPolicyPriority );
+    TUint right = QUERY_INT_FIELD( const_cast<CMDBRecordBase*>(&aRight),
+                                   KCDTIdDataMobilitySelectionPolicyPriority );
+
+    /*
+    *   - negative value, if aLeft is less than aRight;
+    *   - 0,              if aLeft equals to aRight;
+    *   - positive value, if aLeft is greater than aRight.
+    */
+    if ( left == right )
+        {
+        return 0;
+        }
+    
+    return ( left < right ) ? -1 : 1;
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::IconL()
+// -----------------------------------------------------------------------------
+//      
+EXPORT_C CGulIcon* CCmDestinationImpl::IconL() 
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::IconL" );
+
+    return IconL( iData->iMetaDataRec->iIcon );
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::SetIconL()
+// -----------------------------------------------------------------------------
+//      
+void CCmDestinationImpl::SetIconL( TUint32 anIndex )
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::SetIconL" )
+    
+    if( ProtectionLevel() == EProtLevel1 )
+        {
+        CCmManagerImpl::HasCapabilityL( ECapabilityNetworkControl );
+        }
+        
+    iData->iMetaDataRec->iIcon = anIndex;
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationData::MetadataL()
+// -----------------------------------------------------------------------------
+//
+TUint32 CCmDestinationData::MetadataL( TSnapMetadataField aMetaField ) const
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::MetadataL" )
+
+    TUint retVal( 0 );
+
+    switch( aMetaField )
+        {
+        case ESnapMetadataInternet:
+            {
+            retVal = TUint32(iMetaDataRec->iMetadata) & 
+                     ESnapMetadataInternet;
+            }
+            break;
+            
+        case ESnapMetadataHighlight:
+            {
+            retVal = TUint32(iMetaDataRec->iMetadata) & 
+                     ESnapMetadataHighlight;
+            }
+            break;
+            
+        case ESnapMetadataHiddenAgent:
+            {
+            retVal = TUint32(iMetaDataRec->iMetadata) &
+                     ESnapMetadataHiddenAgent;
+            }
+            break;
+
+        case ESnapMetadataDestinationIsLocalised:
+            {
+            retVal = (TUint32(iMetaDataRec->iMetadata) &
+                      ESnapMetadataDestinationIsLocalised) >> 4;
+            }
+            break;
+            
+        case ESnapMetadataPurpose:
+            {
+            retVal = (TUint32(iMetaDataRec->iMetadata) &
+                     ESnapMetadataPurpose) >> 8;
+            }
+            break;
+
+        default:
+            {
+            User::Leave( KErrArgument );
+            }
+        }
+    
+    return retVal;
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::MetadataL()
+// -----------------------------------------------------------------------------
+//
+TUint32 CCmDestinationImpl::MetadataL( TSnapMetadataField aMetaField ) const
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::MetadataL" )
+    return iData->MetadataL(aMetaField);
+    }
+    
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::SetMetadataL()
+// -----------------------------------------------------------------------------
+//
+void CCmDestinationImpl::SetMetadataL( TSnapMetadataField aMetaField, 
+		                               TUint32 aValue )
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::SetMetadata" );
+    
+    if( ProtectionLevel() == EProtLevel1 )
+        {
+        CCmManagerImpl::HasCapabilityL( ECapabilityNetworkControl );
+        }
+        
+    switch( aMetaField )
+        {
+        case ESnapMetadataInternet:
+            {
+            if( aValue )
+                {
+                CheckIfInternetExistsL();
+                
+                iData->iMetaDataRec->iMetadata = 
+                        ESnapMetadataInternet | iData->iMetaDataRec->iMetadata;
+
+                // Set the new way, too!!!
+                SetMetadataL( ESnapMetadataDestinationIsLocalised, 
+                              ELocalisedDestInternet );
+                }
+            else
+                {
+                iData->iMetaDataRec->iMetadata =
+                        ~ESnapMetadataInternet & iData->iMetaDataRec->iMetadata;
+                // Clear the new way, too!!!
+                SetMetadataL( ESnapMetadataDestinationIsLocalised, 
+                              ENotLocalisedDest );                
+                }
+            }
+            break;
+
+        case ESnapMetadataDestinationIsLocalised:
+            {
+            TUint32 oldVal = TUint32(iData->iMetaDataRec->iMetadata) & 
+                             ESnapMetadataInternet;
+            if ( aValue != ENotLocalisedDest )
+                {
+                // check if already exists...
+                CheckIfLocalisedDestExistL( aValue );
+                // does not exists, first clear original value
+                // if old one was Internet, clear that, too:
+                if ( oldVal )
+                    {
+                    // copied here to avoid recursivity!!!
+                    // SetMetadataL(ESnapMetadataInternet, 0 );
+                    iData->iMetaDataRec->iMetadata =
+                        ~ESnapMetadataInternet & iData->iMetaDataRec->iMetadata;
+                    }
+                // clearing
+                iData->iMetaDataRec->iMetadata =
+                                                ~ESnapMetadataDestinationIsLocalised &
+                                                iData->iMetaDataRec->iMetadata;
+                // set new value
+                TUint32 mask = aValue << 4; 
+                iData->iMetaDataRec->iMetadata = 
+                                                mask | 
+                                                iData->iMetaDataRec->iMetadata;
+                // for backward compatibility, if it is internet, 
+                // set it the old way, too
+                if ( aValue == ELocalisedDestInternet )
+                    {
+                    // copied here to avoid recursivity!!!
+                    iData->iMetaDataRec->iMetadata = 
+                        ESnapMetadataInternet | iData->iMetaDataRec->iMetadata;
+                    // SetMetadataL(ESnapMetadataInternet, 1 );
+                    }
+                }
+            else
+                {
+                // not localised, set to ENotLocalisedDest = 0
+                // for backward compatibility, if it was internet, 
+                // set it the old way, too
+                if ( oldVal )
+                    {
+                    SetMetadataL(ESnapMetadataInternet, 0 );
+                    }
+                // clear the new way...
+                iData->iMetaDataRec->iMetadata =
+                                                ~ESnapMetadataDestinationIsLocalised &
+                                                iData->iMetaDataRec->iMetadata;
+                }
+
+            break;
+            }
+
+        case ESnapMetadataPurpose:
+            {
+            // ESnapPurposeInternet and ESnapPurposeMMS need special
+            // handling
+            switch( aValue )
+                {
+                case ESnapPurposeInternet:
+                    {
+                    // This sets ESnapMetadataInternet and
+                    // ELocalisedDestInternet
+                    SetMetadataL( ESnapMetadataInternet, 1 );
+                    }
+                    break;
+                case ESnapPurposeOperator:
+                    {
+                    SetMetadataL( ESnapMetadataDestinationIsLocalised, 
+                                  ELocalisedDestWap );
+                    }
+                	break;
+                case ESnapPurposeMMS:
+                    {
+                    SetMetadataL( ESnapMetadataDestinationIsLocalised, 
+                                  ELocalisedDestMMS );
+                    SetMetadataL( ESnapMetadataHiddenAgent, 1 );
+                    }
+                    break;
+                case ESnapPurposeIntranet:
+                    {
+                    SetMetadataL( ESnapMetadataDestinationIsLocalised,
+                                  ELocalisedDestIntranet );
+                    }
+                    break;
+                default:
+                    break;
+                }
+            
+            // Check if destination with the given purpose already
+            // exists
+            CheckIfPurposeExistL( aValue );
+            
+            TUint32 value = aValue << 8;
+            // reset the purpose bit
+            iData->iMetaDataRec->iMetadata = ~ESnapMetadataPurpose & iData->iMetaDataRec->iMetadata;
+            // set the purpose bit
+            iData->iMetaDataRec->iMetadata = value | iData->iMetaDataRec->iMetadata;
+            }
+            break;
+
+        case ESnapMetadataHighlight:
+            {
+            if( aValue )
+                {
+                iData->iMetaDataRec->iMetadata = 
+                        ESnapMetadataHighlight | iData->iMetaDataRec->iMetadata;
+                }
+            else
+                {
+                iData->iMetaDataRec->iMetadata =
+                        ~ESnapMetadataHighlight & iData->iMetaDataRec->iMetadata;
+                }
+            }
+            break;
+            
+        case ESnapMetadataHiddenAgent:
+            {
+            if( aValue )
+                {
+                if ( iData->iMetaDataRec->iMetadata & ESnapMetadataInternet
+                     || ( ( iData->iMetaDataRec->iMetadata >> 4 ) & ELocalisedDestInternet )
+                     || ( ( iData->iMetaDataRec->iMetadata >> 8 ) & ESnapPurposeInternet ) )
+                    {
+                    User::Leave( KErrArgument );
+                    }
+
+                iData->iMetaDataRec->iMetadata = 
+                        ESnapMetadataHiddenAgent | iData->iMetaDataRec->iMetadata;
+                }
+            else
+                {
+                iData->iMetaDataRec->iMetadata = 
+                        ~ESnapMetadataHiddenAgent & iData->iMetaDataRec->iMetadata;
+                }
+            }
+            break;
+            
+        default:
+            {
+            User::Leave( KErrArgument );
+            }
+        }
+    }
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::CreateEmbeddedDestinationPluginL()
+// -----------------------------------------------------------------------------
+//      
+void CCmDestinationImpl::CreateEmbeddedDestinationPluginL( 
+                                                        CPluginItem& aItem, 
+                                                        TInt aDestinationId )
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::CreateEmbeddedDestinationPluginL" );
+
+    aItem.iPlugin = iCmMgr.CreateConnectionMethodL(KUidEmbeddedDestination, this); 
+    CleanupStack::PushL( aItem.iPlugin );
+    // Load this destination
+    aItem.iPlugin->LoadL( aDestinationId );
+    CleanupStack::Pop( aItem.iPlugin );        
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::LoadEmbeddedDestinationPluginL()
+// -----------------------------------------------------------------------------
+//      
+void CCmDestinationImpl::LoadEmbeddedDestinationPluginL( 
+                                                        CPluginItem& aItem )
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::LoadEmbeddedDestinationPluginL" );
+
+    CreateEmbeddedDestinationPluginL(aItem, aItem.iDNRecord->ElementId());
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::LoadPluginL()
+// -----------------------------------------------------------------------------
+//      
+void CCmDestinationImpl::LoadPluginL( CPluginItem& aItem )
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::LoadPluginL" );
+    
+    if( aItem.iPlugin )
+        {
+        return;
+        }
+        
+    TUint32 cmId;
+    if ( aItem.iDNRecord->iEmbeddedSNAP )
+        // This is an embedded destination
+        {
+        cmId = aItem.iDNRecord->iEmbeddedSNAP;
+        
+        }
+    else
+        // Normal IAP id
+        {
+        cmId = RECORD_FROM_ELEMENT_ID( aItem.iDNRecord->iIAP );
+        }
+
+    aItem.iPlugin = iCmMgr.DoFindConnMethodL( 
+                        cmId, 
+                        this );
+                        
+    CLOG_ATTACH( aItem.iPlugin, this );
+    }    
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::PluginClosed()
+// -----------------------------------------------------------------------------
+//
+void CCmDestinationImpl::PluginClosed( CCmPluginBase* aPlugin )
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::PluginClosed" );
+
+    if (iData->iConnMethodArray)
+        {
+        for ( TInt i = 0; i < iData->iConnMethodArray->Count(); ++i )
+            {
+            if ( (*(iData->iConnMethodArray))[i]->iPlugin == aPlugin )
+                {
+                // Must NOT delete it here. Simply forget that
+                // we had this plugin instance.
+                (*(iData->iConnMethodArray))[i]->iPlugin = NULL;
+                
+                break;
+                }
+            }        
+        }
+    }
+    
+// -----------------------------------------------------------------------------
+// CCmDestinationData::IsHiddenL()
+// -----------------------------------------------------------------------------
+//          
+TBool CCmDestinationData::IsHiddenL()
+    {
+    TSnapMetadataField hiddenValue = ( TSnapMetadataField )MetadataL( ESnapMetadataHiddenAgent );
+    if ( hiddenValue == ESnapMetadataHiddenAgent )
+        {
+    	return ETrue;
+        }
+    else
+        {
+    	return EFalse;
+        }
+    }    
+    
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::IsHiddenL()
+// -----------------------------------------------------------------------------
+//          
+EXPORT_C TBool CCmDestinationImpl::IsHidden()
+    {
+    TBool hidden( EFalse );
+    TRAPD( err, hidden = iData->IsHiddenL() );
+    __ASSERT_ALWAYS( err == KErrNone, User::Panic(_L( "CMManager" ), err ) );
+    
+    return hidden;
+    }    
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::SetHiddenL()
+// -----------------------------------------------------------------------------
+//          
+EXPORT_C void CCmDestinationImpl::SetHiddenL( TBool aHidden )
+    {
+    if( ProtectionLevel() == EProtLevel1 )
+        {
+        CCmManagerImpl::HasCapabilityL( ECapabilityNetworkControl );
+        }
+    SetMetadataL( ESnapMetadataHiddenAgent, aHidden );
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::DeleteConnectionMethodsL
+//
+// Can be called only during opened transaction. 
+// Array is emptied only after transaction commited!
+//
+// -----------------------------------------------------------------------------
+//          
+void CCmDestinationImpl::DeleteConnectionMethodsL()
+    {
+    LOGGER_ENTERFN( "DeleteConnectionMethodsL" );
+    
+    TInt i;
+    
+    for ( i = 0; i < iData->iDeleteCmArray->Count(); ++i )
+        {
+        CPluginItem* item = (*iData->iDeleteCmArray)[i];
+        
+        LoadPluginL( *item );   
+
+        if( !(item->iFlags & CPluginItem::ERemoveCm) )
+            {
+            item->iPlugin->DeleteL( EFalse );
+            }
+            
+        item->iDNRecord->DeleteL( Session() );
+        }
+    }
+    
+// -----------------------------------------------------------------------------
+// CCmDestinationData::ResetAndDestroyArray
+// -----------------------------------------------------------------------------
+//          
+void CCmDestinationData::ResetAndDestroyArray( CCmArray* &aArray, TBool aDestroy )
+    {
+    if( aArray )
+        {
+        for ( TInt i = 0; i < aArray->Count(); ++i )
+            {
+            CPluginItem* item = (*aArray)[i];
+            
+            delete item->iPlugin;
+            delete item->iDNRecord;
+            }
+            
+        aArray->ResetAndDestroy();
+        
+        if( aDestroy )
+            {
+            delete aArray; aArray = NULL;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::DeleteIAPRecordsL
+// -----------------------------------------------------------------------------
+//          
+void CCmDestinationImpl::DeleteIAPRecordsL( CMDBRecordBase* aSnapRecord )
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::DeleteIAPRecordsL" );
+
+    // First delete the metadata record
+    CCDIAPMetadataRecord* metaRec = new (ELeave) CCDIAPMetadataRecord( 
+                                        iCmMgr.SeamlessnessTableId() );
+                                        
+    CleanupStack::PushL( metaRec );
+
+    metaRec->iIAP = RECORD_FROM_ELEMENT_ID( 
+                                QUERY_INT_FIELD( 
+                                       aSnapRecord, 
+                                       KCDTIdDataMobilitySelectionPolicyIAP ) );
+
+    if( metaRec->FindL( Session() ) )
+        {
+        metaRec->DeleteL( Session() );
+        }
+        
+    CleanupStack::PopAndDestroy( metaRec );
+    
+    // and now delete the SNAP record
+    aSnapRecord->DeleteL( Session() );
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::CheckIfNameModifiedL
+// -----------------------------------------------------------------------------
+void CCmDestinationImpl::CheckIfNameModifiedL( CCDSnapRecord* aRecord )
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::CheckIfNameModifiedL" );
+            
+    if ( !TPtrC(iData->iDestAPRecord->iRecordName).CompareF( TPtrC(aRecord->iRecordName) ) )
+        // names matches
+        {
+        return;
+        }
+    
+    aRecord->iRecordName.SetL( TPtrC(iData->iDestAPRecord->iRecordName) );
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::IsConnectedL
+// -----------------------------------------------------------------------------
+EXPORT_C TBool CCmDestinationImpl::IsConnectedL() const
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::IsConnectedL" );
+
+    CCmDestinationImpl* myThis = const_cast<CCmDestinationImpl*>( this );
+    TBool retVal( EFalse );
+    TInt i;
+    
+    for( i = KCmInitIndex; i < iData->iConnMethodArray->Count(); ++i )
+        {
+        CPluginItem* item = (*(iData->iConnMethodArray))[i];
+        
+        myThis->LoadPluginL( *item );
+            
+        if( item->iPlugin->GetBoolAttributeL( ECmConnected ) )
+            {
+            retVal = ETrue;
+            break;
+            }
+        }
+        
+    return retVal;
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::CheckIfInternetExistsL
+//
+// There can be only one SNAP with Internet metadata field set.
+// -----------------------------------------------------------------------------
+void CCmDestinationImpl::CheckIfInternetExistsL()
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::CheckIfInternetExistsL" );
+
+    OpenTransactionLC();
+
+    CMDBRecordSet<CCDSNAPMetadataRecord>* metaSet = 
+           new ( ELeave ) CMDBRecordSet<CCDSNAPMetadataRecord>( 
+                                                 iCmMgr.IconTableId() );
+    CleanupStack::PushL( metaSet );
+
+    TRAP_IGNORE( metaSet->LoadL( Session() ) );
+
+    for ( TInt i = 0; i < metaSet->iRecords.Count(); ++i )
+        {
+        TInt meta = QUERY_INT_FIELD( metaSet->iRecords[i], 
+                                     KCDTIdSNAPMetadataMetadata );
+
+        if( meta & ESnapMetadataInternet )
+            {
+            if( Id() != QUERY_INT_FIELD( metaSet->iRecords[i], 
+                                                KCDTIdSNAPMetadataSNAP ) )
+                {
+                User::Leave( KErrAlreadyExists );
+                }
+            }
+        }
+    
+    CleanupStack::PopAndDestroy( metaSet );
+    
+    RollbackTransaction();
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::ConnectionMethodIndex
+// -----------------------------------------------------------------------------
+TInt CCmDestinationImpl::ConnectionMethodIndex( TUint32 aCmId )
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::ConnectionMethodIndex" );
+
+    TInt found( KErrNotFound );
+    
+    for ( TInt i = KCmInitIndex; i < iData->iConnMethodArray->Count(); ++i )
+        {
+        CPluginItem* item = (*(iData->iConnMethodArray))[i];
+        if ( RECORD_FROM_ELEMENT_ID(item->iDNRecord->iIAP) == aCmId ||
+             (item->iDNRecord->iEmbeddedSNAP == aCmId && aCmId != 0) )
+            {
+            found = i;
+            break;
+            }        
+        }
+        
+    return found;
+    }        
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::IconIdL
+// -----------------------------------------------------------------------------
+CGulIcon* CCmDestinationImpl::IconIdL( CCmManagerImpl& aCmMgr,
+                                       TMDBElementId aId )
+    {
+    CGulIcon* retVal = NULL;
+    CCDSNAPMetadataRecord* metaDataRec = new (ELeave) CCDSNAPMetadataRecord( 
+                                                        aCmMgr.IconTableId() );
+    CleanupStack::PushL( metaDataRec );
+    metaDataRec->iSNAP = aId;
+                
+    if ( metaDataRec->FindL( aCmMgr.Session() ) )
+        // Not found -> fill in with default values
+        {
+        retVal = IconL( metaDataRec->iIcon );
+        }
+    else
+        {
+        User::Leave( KErrNotFound );
+        }
+        
+    CleanupStack::PopAndDestroy( metaDataRec );
+    
+    return retVal;
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::ProtectionLevelL
+// -----------------------------------------------------------------------------
+TProtectionLevel CCmDestinationImpl::ProtectionLevelL( CCmManagerImpl& aCmMgr, 
+                                                       TMDBElementId aId ) 
+    {
+    TProtectionLevel retVal( EProtLevel0 );
+    CCDSNAPMetadataRecord* metaDataRec = new (ELeave) CCDSNAPMetadataRecord( 
+                                                        aCmMgr.IconTableId() );
+    CleanupStack::PushL( metaDataRec );
+    metaDataRec->iSNAP = aId;
+                
+    if ( metaDataRec->FindL( aCmMgr.Session() ) )
+        // Not found -> fill in with default values
+        {
+        retVal = ProtectionLevel( metaDataRec );
+        }
+    else
+        {
+        User::Leave( KErrNotFound );
+        }
+        
+    CleanupStack::PopAndDestroy( metaDataRec );
+    return retVal;
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::ProtectionLevel
+// -----------------------------------------------------------------------------
+TProtectionLevel CCmDestinationImpl::ProtectionLevel( 
+                                           CCDSNAPMetadataRecord* aMetaDataRec )
+    {
+    TInt protection = TUint32(aMetaDataRec->iMetadata) & 
+                      KSnapMetadataProtecionLevelMask;
+    return TProtectionLevel(protection >> 28);
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::ProtectionLevelL
+// -----------------------------------------------------------------------------
+CGulIcon* CCmDestinationImpl::IconL( TInt aIconIndex )
+    {
+    MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
+           
+    TParse mbmFile;
+    User::LeaveIfError( mbmFile.Set( KManagerIconFilename, 
+                                     &KDC_BITMAP_DIR, 
+                                     NULL ) );
+                                     
+    TAknsItemID aknItemID;
+    aknItemID.Set( KDestinationIconConvTable[aIconIndex][0],
+                   KDestinationIconConvTable[aIconIndex][1] );
+           
+    CGulIcon* icon = AknsUtils::CreateGulIconL( 
+                            skinInstance, 
+                            aknItemID,
+                            mbmFile.FullName(), 
+                            KDestinationIconConvTable[aIconIndex][2], 
+                            KDestinationIconConvTable[aIconIndex][3] );
+                            
+    return icon;
+    }
+    
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::RemoveFromPool
+// -----------------------------------------------------------------------------
+EXPORT_C void CCmDestinationImpl::RemoveFromPool()
+    {
+    iCmMgr.RemoveDestFromPool(this);            
+    }
+    
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::IncrementRefCounter
+// -----------------------------------------------------------------------------
+void CCmDestinationImpl::IncrementRefCounter()
+    {
+    iData->IncrementRefCounter();
+    }
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::DecrementRefCounter
+// -----------------------------------------------------------------------------
+void CCmDestinationImpl::DecrementRefCounter()
+    {
+    iData->DecrementRefCounter();
+    }
+// -----------------------------------------------------------------------------
+// CCmDestinationData::IncrementRefCounter
+// -----------------------------------------------------------------------------
+void CCmDestinationData::IncrementRefCounter()
+    {
+    iRefCounter++;
+    }
+// -----------------------------------------------------------------------------
+// CCmDestinationData::DecrementRefCounter
+// -----------------------------------------------------------------------------
+void CCmDestinationData::DecrementRefCounter()
+    {
+    iRefCounter--;
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationData::GetRefCounter
+// -----------------------------------------------------------------------------
+TInt CCmDestinationData::GetRefCounter()
+    {
+    return iRefCounter;
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::GetRefCounter
+// -----------------------------------------------------------------------------
+TInt CCmDestinationImpl::GetRefCounter()
+    {
+    return iData->iRefCounter;
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::GetData
+// -----------------------------------------------------------------------------
+CCmDestinationData* CCmDestinationImpl::GetData()
+    {
+    return iData;
+    }
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::SetData
+// -----------------------------------------------------------------------------
+void CCmDestinationImpl::SetData(CCmDestinationData* aData)
+    {
+    iData = aData;
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationData::IdIsValid
+// -----------------------------------------------------------------------------
+TBool CCmDestinationData::IdIsValid()
+    {
+    return iIdIsValid;
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::IdIsValid
+// -----------------------------------------------------------------------------
+TBool CCmDestinationImpl::IdIsValid()
+    {
+    return iData->iIdIsValid;
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::Cmmgr
+// -----------------------------------------------------------------------------
+CCmManagerImpl* CCmDestinationData::Cmmgr()
+    {
+    return &iCmMgr;    
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::Cmmgr
+// -----------------------------------------------------------------------------
+CCmManagerImpl* CCmDestinationImpl::Cmmgr()
+    {
+    return &iCmMgr;    
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::CheckIfLocalisedDestExistL
+//
+// There can be only one SNAP with a certain localised metadata field set.
+// -----------------------------------------------------------------------------
+void CCmDestinationImpl::CheckIfLocalisedDestExistL( TUint32 aValue )
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::CheckIfLocalisedDestExistL" );
+
+    OpenTransactionLC();
+
+    CMDBRecordSet<CCDSNAPMetadataRecord>* metaSet = 
+                new ( ELeave ) CMDBRecordSet<CCDSNAPMetadataRecord>( iCmMgr.IconTableId() );
+    CleanupStack::PushL( metaSet );
+
+    TRAP_IGNORE( metaSet->LoadL( Session() ) );
+
+    for ( TInt i = 0; i < metaSet->iRecords.Count(); ++i )
+        {
+        TInt meta = QUERY_INT_FIELD( metaSet->iRecords[i], 
+                                     KCDTIdSNAPMetadataMetadata );
+
+        if ( meta & ESnapMetadataDestinationIsLocalised )
+            {
+            TInt locval = (meta & ESnapMetadataDestinationIsLocalised) >> 4;
+            if ( aValue == locval )
+                {
+                if( Id() != QUERY_INT_FIELD( metaSet->iRecords[i], KCDTIdSNAPMetadataSNAP ) )
+                    {
+                    User::Leave( KErrAlreadyExists );
+                    }
+                }
+            if ( aValue ==  ELocalisedDestInternet )
+                { // internet might also be set the 'old way', check it!
+                if( meta & ESnapMetadataInternet )
+                    {
+                    if( Id() != QUERY_INT_FIELD( metaSet->iRecords[i], KCDTIdSNAPMetadataSNAP ) )
+                        {
+                        User::Leave( KErrAlreadyExists );
+                        }
+                    }                
+                }
+            }            
+        }
+
+    CleanupStack::PopAndDestroy( metaSet );
+
+    RollbackTransaction();
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::CheckIfPurposeExistL
+//
+// There can be only one SNAP with a certain purpose metadata field set.
+// -----------------------------------------------------------------------------
+void CCmDestinationImpl::CheckIfPurposeExistL( TUint32 aValue )
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::CheckIfPurposeExistL" );
+
+    OpenTransactionLC();
+
+    CMDBRecordSet<CCDSNAPMetadataRecord>* metaSet = 
+                new ( ELeave ) CMDBRecordSet<CCDSNAPMetadataRecord>( iCmMgr.IconTableId() );
+    CleanupStack::PushL( metaSet );
+
+    TRAP_IGNORE( metaSet->LoadL( Session() ) );
+
+    for ( TInt i = 0; i < metaSet->iRecords.Count(); ++i )
+        {
+        TInt meta = QUERY_INT_FIELD( metaSet->iRecords[i], 
+                                     KCDTIdSNAPMetadataMetadata );
+
+        if ( meta & ESnapMetadataPurpose )
+            {
+            TInt purVal = ( meta & ESnapMetadataPurpose ) >> 8;
+            if ( aValue == purVal )
+                {
+                if( Id() != QUERY_INT_FIELD( metaSet->iRecords[i], 
+                                        KCDTIdSNAPMetadataSNAP ) )
+                    {
+                    User::Leave( KErrAlreadyExists );
+                    }
+                }
+            }            
+        }
+
+    CleanupStack::PopAndDestroy( metaSet );
+
+    RollbackTransaction();
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::InitializeDestAPRecordL
+//
+// 
+// -----------------------------------------------------------------------------
+void CCmDestinationImpl::InitializeDestAPRecordL()
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::InitializeDestAPRecordL" );
+
+    SetDefaultTierManagerL();
+    SetDefaultMCprL();
+    SetDefaultCprL();
+    SetDefaultSCprL();
+    SetDefaultProtocolL();
+    iData->iDestAPRecord->iCustomSelectionPolicy = 0;
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::SetDefaultTierManagerL
+//
+// 
+// -----------------------------------------------------------------------------
+void CCmDestinationImpl::SetDefaultTierManagerL()
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::SetDefaultTierManagerL" );
+
+    CCDTierRecord* tierRec = static_cast<CCDTierRecord *>
+                               ( CCDRecordBase::RecordFactoryL( KCDTIdTierRecord ) );
+    CleanupStack::PushL( tierRec );
+
+    tierRec->iRecordTag = KDefaultTierManagerTagId;
+
+    if ( tierRec->FindL( Session() ) )
+        {
+        iData->iDestAPRecord->iTier = tierRec->ElementId();
+        }
+    else
+        {
+        User::Leave( KErrNotFound );
+        }
+
+    CleanupStack::PopAndDestroy();
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::SetDefaultMCprL
+//
+// 
+// -----------------------------------------------------------------------------
+void CCmDestinationImpl::SetDefaultMCprL()
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::SetDefaultMCprL" );
+
+    CCDMCprRecord* mcprRec = static_cast<CCDMCprRecord *>
+                             ( CCDRecordBase::RecordFactoryL( KCDTIdMCprRecord ) );
+    CleanupStack::PushL( mcprRec );
+
+    mcprRec->SetRecordId( 1 );
+
+    mcprRec->LoadL( Session() );
+	
+	iData->iDestAPRecord->iMCpr = mcprRec->ElementId();
+
+    CleanupStack::PopAndDestroy();
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::SetDefaultCprL
+//
+// 
+// -----------------------------------------------------------------------------
+void CCmDestinationImpl::SetDefaultCprL()
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::SetDefaultCprL" );
+
+    CCDCprRecord* cprRec = static_cast<CCDCprRecord *>
+                             ( CCDRecordBase::RecordFactoryL( KCDTIdCprRecord ) );
+    CleanupStack::PushL( cprRec );
+
+    cprRec->SetRecordId( 1 );
+
+    cprRec->LoadL( Session() );
+	iData->iDestAPRecord->iCpr = cprRec->ElementId();
+
+    CleanupStack::PopAndDestroy();
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::SetDefaultSCprL
+//
+// 
+// -----------------------------------------------------------------------------
+void CCmDestinationImpl::SetDefaultSCprL()
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::SetDefaultSCprL" );
+
+    CCDSCprRecord* scprRec = static_cast<CCDSCprRecord *>
+                             ( CCDRecordBase::RecordFactoryL( KCDTIdSCprRecord ) );
+    CleanupStack::PushL( scprRec );
+
+    scprRec->SetRecordId( 1 );
+
+    scprRec->LoadL( Session() );
+	iData->iDestAPRecord->iSCpr = scprRec->ElementId();
+
+    CleanupStack::PopAndDestroy();
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::SetDefaultProtocolL
+//
+// 
+// -----------------------------------------------------------------------------
+void CCmDestinationImpl::SetDefaultProtocolL()
+    {
+    LOGGER_ENTERFN( "CCmDestinationImpl::SetDefaultProtocolL" );
+
+    CCDProtocolRecord* protocolRec = static_cast<CCDProtocolRecord *>
+                             ( CCDRecordBase::RecordFactoryL( KCDTIdProtocolRecord ) );
+    CleanupStack::PushL( protocolRec );
+
+    protocolRec->SetRecordId( 1 );
+
+    protocolRec->LoadL( Session() );
+	iData->iDestAPRecord->iProtocol = protocolRec->ElementId();
+
+    CleanupStack::PopAndDestroy();
+    }
+
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::CheckIfCMExists
+//
+// 
+// -----------------------------------------------------------------------------
+TBool CCmDestinationImpl::CheckIfCMExistsL( CCmPluginBase& aConnectionMethod )
+    {
+    TRAPD( err, (void)FindConnectionMethodL( aConnectionMethod ) );
+    if ( err )
+        {
+        if ( err == KErrNotFound )
+            {
+            return EFalse;
+            }
+        else
+            {
+            User::Leave( err );
+            }
+        }
+
+    return ETrue;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Src/cmdlg.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,2044 @@
+/*
+* Copyright (c) 2006-2008 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 CCmDlg
+*
+*/
+
+#include <avkon.hrh>
+#include <eikdef.h>
+#include <eikenv.h>
+#include <eikedwin.h>
+#include <cmmanager.rsg>
+#include <data_caging_path_literals.hrh>
+#include <aknnavide.h>
+#include <akntitle.h>
+#include <eikmenup.h>
+#include <StringLoader.h>
+#include <AknIconArray.h>
+#include <aknnavilabel.h>
+#include <cmmanager.mbg>
+#include <cmpluginembdestinationdef.h>
+#include <featmgr.h>
+
+#include <hlplch.h>
+#include <csxhelp/cp.hlp.hrh>
+
+#include "cmdlg.h"
+#include "cmmanager.hrh"
+#include "cmlistitem.h"
+#include "cmlistitemlist.h"
+#include <cmpluginbaseeng.h>
+#include <cmpluginbase.h>
+#include "cmdestinationimpl.h"
+#include <cmcommonui.h>
+#include <cmcommonconstants.h>
+#include <cmpbasesettingsdlg.h>
+#include "cmwizard.h"
+#include "selectdestinationdlg.h"
+#include <cmmanagerdef.h>
+#include <mcmdexec.h>
+#include "ccmdexec.h"
+#include "destdlg.h"
+#include "cmlogger.h"
+#include "cmconnsettingsuiimpl.h"
+
+using namespace CMManager;
+using namespace CommsDat;
+
+// ---------------------------------------------------------------------------
+// CCmDlg::ConstructAndRunLD
+// Constructs the dialog and runs it.
+// ---------------------------------------------------------------------------
+//
+TInt CCmDlg::ConstructAndRunLD(  TUint32 aHighlight,
+                                          TUint32& aSelected )
+    {
+    CleanupStack::PushL( this );
+
+    iHighlight = aHighlight;
+    iSelected = &aSelected;
+    
+    ConstructL( R_CM_MENUBAR );
+    PrepareLC( R_CM_DIALOG );
+    CleanupStack::Pop( this );
+
+    iModel = new( ELeave )CCmListboxModel();
+    
+    iCmDestinationImpl = iCmManager->DestinationL( iDestUid );
+    
+    iInfoPopupNoteController = CAknInfoPopupNoteController::NewL();
+    
+    // Trace changes in CommsDat
+    iCmManager->WatcherRegisterL( this );
+        
+    return RunLD();
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmDlg::NewL()
+// Two-phase dconstructor, second phase is ConstructAndRunLD
+// ---------------------------------------------------------------------------
+//
+CCmDlg* CCmDlg::NewL(CCmManagerImpl* aCmManager, TUint32 aDestUid,
+                     CDestDlg* aDestDlg)
+    {
+    CCmDlg* self = new (ELeave) CCmDlg( aCmManager, aDestUid, aDestDlg );
+    return self;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmDlg::CCmDlg()
+// ---------------------------------------------------------------------------
+//
+CCmDlg::CCmDlg( CCmManagerImpl* aCmManager, TUint32 aDestUid,
+                CDestDlg* aDestDlg )
+    : iModelPassed( EFalse )
+    , iCmManager( aCmManager )
+    , iDestUid ( aDestUid )
+    , iPrioritising ( EFalse )
+    , iExitReason( KDialogUserBack )
+    , iEscapeArrived( EFalse )
+    , iExitduringProcessing( EFalse )
+    , iBackduringProcessing( EFalse )
+    , iDestDlg( aDestDlg )
+    {
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmDlg::~CCmDlg
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CCmDlg::~CCmDlg()
+    {
+    // iModel is deleted by the ListBox because LB owns the model...
+    // of course only after we passed ownership...
+    if ( !iModelPassed )
+        {
+        delete iModel;
+        }
+        
+    delete iNaviDecorator;
+    
+    if ( iTitlePane )
+        {
+        // set old text back, if we have it...
+        if ( iOldTitleText )
+            {
+            TRAP_IGNORE( iTitlePane->SetTextL( *iOldTitleText ) );
+            delete iOldTitleText; iOldTitleText = NULL;
+            }
+        }    
+        
+    delete iOldTitleText;
+    
+    if(iCmDestinationImpl)
+        {
+        delete iCmDestinationImpl;
+        iCmDestinationImpl = NULL;
+        }    
+    
+    if ( iInfoPopupNoteController )
+        {
+        delete iInfoPopupNoteController;
+        }
+        
+    if( iCmWizard )
+        {
+        delete iCmWizard;
+        }
+    iItemIndex.Close();
+    
+    delete iCmdExec;
+    iCmdExec = NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDlg::PreLayoutDynInitL();
+// called by framework before dialog is shown
+// ---------------------------------------------------------------------------
+//
+void CCmDlg::PreLayoutDynInitL()
+    {
+    iListbox = STATIC_CAST( CCmListbox*, Control( KCmListboxId ) );
+    iListbox->CreateScrollBarFrameL( ETrue );
+    iListbox->ScrollBarFrame()->SetScrollBarVisibilityL
+                        ( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
+    iListbox->SetListBoxObserver( this );
+
+    iListbox->Model()->SetItemTextArray( iModel );
+    iModelPassed = ETrue;
+    InitTextsL();
+    HandleListboxDataChangeL();
+    iListbox->HandleItemAdditionL();
+    
+    if ( iHighlight )
+        {
+        iListbox->ScrollToMakeItemVisible( iHighlight );
+        iListbox->SetCurrentItemIndexAndDraw( iHighlight );
+        }
+    ShowPopupNoteL();        
+    }
+    
+// --------------------------------------------------------------------------
+// CCmDlg::DynInitMenuPaneL
+// --------------------------------------------------------------------------
+//
+void CCmDlg::DynInitMenuPaneL( TInt aResourceId,
+                                        CEikMenuPane* aMenuPane )
+    {
+    CAknDialog::DynInitMenuPaneL( aResourceId, aMenuPane );        
+    if ( aResourceId == R_CM_MENU )
+        {
+    	if (aResourceId == R_CM_MENU && !iCmManager->IsHelpOn())
+            {
+            aMenuPane->DeleteMenuItem( EAknCmdHelp );		    
+            }
+        // Menu items
+        TBool hideAdd       ( EFalse );
+        TBool hideRename    ( EFalse );
+        TBool hideDelete    ( EFalse );
+        TBool hideCopy      ( EFalse );
+        TBool hideMove      ( EFalse );
+        TBool hidePrioritise( EFalse );
+           
+        // Edit, Rename, Delete and Organise menu items are hidden if:
+        // 1. CM List is empty
+        // 2. Embedded Destinations
+        if ( !( iListbox->Model()->ItemTextArray()->MdcaCount() ) )
+            {
+            hideRename  = ETrue;
+            hideDelete  = ETrue;
+            hideCopy = ETrue;
+            hideMove = ETrue; 
+            }
+        // Embedded destinations can be deleted but not edited
+        else if ( ( CurrentCML()->GetBoolAttributeL(ECmDestination) ) )
+            {
+            hideRename  = ETrue;
+            }
+        // Only one CM in the list OR highlighted CM is a virtual CM
+        else if ( ( iListbox->Model()->ItemTextArray()->MdcaCount() == 1 ) )
+            {
+            hidePrioritise = ETrue;
+            }            
+        // virtual CMs pointing to destinations
+        else if ( CurrentCML()->GetBoolAttributeL( ECmVirtual ) )
+            {
+            if ( CurrentCML()->GetIntAttributeL( ECmNextLayerSNAPId ) )
+                {
+                hidePrioritise = ETrue;
+                }
+            }
+        // No available destination to copy/move the CM to
+        RArray<TUint32> destinations( KCmArrayMediumGranularity );
+        CleanupClosePushL( destinations );
+        iCmManager->AllDestinationsL( destinations );
+        for ( TInt i = 0; i < destinations.Count(); i++ )
+            {            
+            CCmDestinationImpl* dest = 
+                                    iCmManager->DestinationL( destinations[i] );
+            CleanupStack::PushL( dest );
+            // Not allowed to copy/move CMs into Level1 protected destinations
+            if ( dest->ProtectionLevel() != CMManager::EProtLevel1 )
+                {
+                // iCmDestinationImpl is null in Uncat dlg - ignore
+                // Don't count the current destination
+                if ( !iCmDestinationImpl || 
+                     dest->Id() != iCmDestinationImpl->Id() ) 
+                    {
+                    hideCopy = EFalse;
+                    hideMove = EFalse;
+                    CleanupStack::PopAndDestroy( dest );
+                    break;
+                    }
+                }
+            CleanupStack::PopAndDestroy( dest );                
+            }
+        CleanupStack::PopAndDestroy( &destinations );    
+        
+        // Show or hide menu items
+        if ( aResourceId == R_CM_MENU )
+            {            
+            aMenuPane->SetItemDimmed( ECmManagerUiCmdCmAdd,     hideAdd );
+            aMenuPane->SetItemDimmed( ECmManagerUiCmdCmRename,  hideRename );            
+            aMenuPane->SetItemDimmed( ECmManagerUiCmdCmDelete,  hideDelete );    
+            aMenuPane->SetItemDimmed( ECmManagerUiCmdCmPrioritise, hidePrioritise );
+            aMenuPane->SetItemDimmed( ECmManagerUiCmdCmMoveToOtherDestination, hideMove );
+            aMenuPane->SetItemDimmed( ECmManagerUiCmdCmCopyToOtherDestination, hideCopy ); 
+            }
+        }   
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmDlg::InitTextsL
+// called before the dialog is shown
+// to initialize localized textual data
+// ---------------------------------------------------------------------------
+//
+void CCmDlg::InitTextsL()
+    {
+    // set pane text if neccessary...
+    // pane text needed if not pop-up...
+    HBufC* primary = 
+              iEikonEnv->AllocReadResourceLC( R_CMMANAGERUI_EMPTY_METHOD_VIEW_PRIMARY );
+    HBufC* secondary = 
+              iEikonEnv->AllocReadResourceLC( R_CMMANAGERUI_EMPTY_METHOD_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);              
+    iListbox->View()->SetListEmptyTextL( *emptyText );    
+    CleanupStack::PopAndDestroy( emptyText );
+    CleanupStack::PopAndDestroy( items );
+    CleanupStack::PopAndDestroy( secondary );
+    CleanupStack::PopAndDestroy( primary );
+
+    iStatusPane = iEikonEnv->AppUiFactory()->StatusPane();
+    iTitlePane = ( CAknTitlePane* )iStatusPane->ControlL(
+                                          TUid::Uid( EEikStatusPaneUidTitle ) );
+
+    iOldTitleText = iTitlePane->Text()->AllocL();
+    HBufC* name = iCmDestinationImpl->NameLC();
+    iTitlePane->SetTextL( *name );
+    CleanupStack::PopAndDestroy( name );
+
+    iNaviPane = ( CAknNavigationControlContainer* ) 
+                    iStatusPane->ControlL( 
+                            TUid::Uid( EEikStatusPaneUidNavi ) );
+    iNaviDecorator = iNaviPane->CreateNavigationLabelL( KNullDesC );
+    iNaviPane->PushL( *iNaviDecorator );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDlg::SetNoOfCMsL
+// ---------------------------------------------------------------------------
+//
+
+void CCmDlg::SetNoOfCMsL(TInt aCount)
+    {
+    if ( iNaviDecorator )
+        {
+        if ( iNaviDecorator->ControlType() == 
+             CAknNavigationDecorator::ENaviLabel)
+            {
+            CAknNaviLabel* naviLabel = 
+                            (CAknNaviLabel*)iNaviDecorator->DecoratedControl();
+            if (aCount)
+                {
+                HBufC* title = NULL;
+                
+                if (aCount == 1)
+                    {
+                    title = StringLoader::LoadLC( 
+                                           R_CMMANAGERUI_NAVI_ONE_CONN_METHOD );
+                    }
+                else
+                    {
+                    title = StringLoader::LoadLC( 
+                                           R_CMMANAGERUI_NAVI_MANY_CONN_METHODS, 
+                                           aCount );
+                    }
+                    
+                naviLabel->SetTextL(*title);
+                  CleanupStack::PopAndDestroy( title );
+                }
+            else
+                {
+                naviLabel->SetTextL(KNullDesC);
+                }
+                
+            iNaviPane->PushL( *iNaviDecorator );
+            }
+        }
+      
+    }
+
+//----------------------------------------------------------
+// CCmDlg::CreateCustomControlL
+//----------------------------------------------------------
+//
+SEikControlInfo CCmDlg::CreateCustomControlL( TInt aControlType )
+    {
+    SEikControlInfo controlInfo;
+    controlInfo.iTrailerTextId = 0;
+    controlInfo.iFlags = 0;
+    if ( aControlType == KCmListboxType )
+        {
+        controlInfo.iControl = new ( ELeave ) CCmListbox;
+        }
+    else
+        {
+        controlInfo.iControl = NULL;
+        }
+    return controlInfo;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDlg::OkToExitL
+// Good to know : EAknSoftkeyCancel is never called, because
+// EEikDialogFlagNotifyEsc flag is not set in the resource.
+// ---------------------------------------------------------------------------
+//
+TBool CCmDlg::OkToExitL( TInt aButtonId )
+    {
+    LOGGER_ENTERFN( "CCmDlg::OkToExitL" );
+
+    // Translate the button presses into commands for the appui & current
+    // view to handle
+    // Dialog should not exit
+    TBool retVal( EFalse );
+    
+    switch ( aButtonId )
+        {
+        case EAknSoftkeyOk:
+        case ECmManagerUiCmdCmEdit:
+            {
+            if ( !iProcessing )
+                {
+                if ( CMCount() )
+                    {
+                    iProcessing = ETrue;
+                    ProcessCommandL( aButtonId );
+                    iProcessing = EFalse;
+                    }
+                else
+                    {
+                    iProcessing = ETrue;
+                    AddConnectionMethodL();
+                    iProcessing = EFalse;
+                    }
+                }
+            break;
+            }
+        case EAknSoftkeyClear:
+            {
+            ProcessCommandL( aButtonId );
+            break;
+            }
+        case ECmManagerUiCmdCmPrioOk:
+            {
+            if ( iPrioritising )
+                {
+                FinishPriorizingL( ETrue );
+                }
+                
+            break;
+            }               
+       case ECmManagerUiCmdCmPrioCancel:            
+            {
+            if ( !MenuShowing() )            
+                {
+                if ( iPrioritising )
+                    {
+                    FinishPriorizingL( EFalse );
+                    }
+                }            
+            break;
+            }           
+        case ECmManagerUiCmdCmUserExit:
+            {
+            iCmManager->WatcherUnRegister();
+                        
+            iExitReason = KDialogUserExit;
+            break;
+            }
+        case EAknSoftkeyBack:
+            {
+            iCmManager->WatcherUnRegister();
+            
+            if ( !iProcessing )
+                {
+                *iSelected = 0;
+                TryExitL( iExitReason );
+                }
+            else
+                {
+                iBackduringProcessing = ETrue;
+                }
+            break;
+            }
+        default:
+            {
+            if ( !iProcessing )
+                {
+                if ( aButtonId == EAknSoftkeyOptions )
+                    {
+                    DisplayMenuL();
+                    }
+                else
+                    {
+                    retVal = ETrue;
+                    }
+                }
+            if ( iProcessing )
+                {
+                iExitduringProcessing = ETrue;
+                if( aButtonId == KDialogUserExit )
+                    {
+                    retVal = ETrue;
+                    } 
+                }
+            break;
+            }
+        }
+    return retVal;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDlg::HandleListBoxEventL
+// ---------------------------------------------------------------------------
+//
+void CCmDlg::HandleListBoxEventL( CEikListBox* /*aListBox*/,
+                                  TListBoxEvent aEventType )
+    {
+    LOGGER_ENTERFN( "CCmDlg::HandleListBoxEventL" );
+
+    switch ( aEventType )
+        {
+        case EEventEnterKeyPressed:
+            {
+            if ( iPrioritising )
+                {
+                FinishPriorizingL( ETrue );
+                }
+            else
+                {
+                if ( !iProcessing )
+                    {
+                    delete iCmdExec;
+                    iCmdExec = NULL;
+                    iCmdExec = new (ELeave) CCmdExec(*this);
+                    iCmdExec->Execute();
+                    }
+                }           
+            break;            
+            }
+        case EEventItemSingleClicked:
+            {
+            if ( !iProcessing )
+                {
+                delete iCmdExec;
+                iCmdExec = NULL;
+                iCmdExec = new (ELeave) CCmdExec(*this);
+                iCmdExec->Execute();
+                }
+            break;
+            }
+        case EEventEditingStarted:
+            {
+            break;
+            }
+        case EEventEditingStopped:
+            {
+            break;
+            }
+        default:
+            {
+            break;
+            };
+        };
+    }
+       
+    
+// ---------------------------------------------------------------------------
+// CCmDlg::ProcessCommandL
+// ---------------------------------------------------------------------------
+//
+void CCmDlg::ProcessCommandL( TInt aCommandId )
+    {
+    LOGGER_ENTERFN( "CCmDlg::ProcessCommandL" );
+
+    if ( MenuShowing() )
+        {
+        HideMenu();
+        }
+
+    switch ( aCommandId )
+        {        
+        // Connection Method Modification Commands
+        case ECmManagerUiCmdCmAdd:
+            {
+            if ( !iProcessing )
+                {
+                iProcessing = ETrue;
+                TRAPD( err, AddConnectionMethodL() );
+                // Memory full
+                if (err == KLeaveWithoutAlert || err == KErrNoMemory)
+                    {
+                    iProcessing = EFalse;
+                    return;
+                    }
+                iProcessing = EFalse;
+
+                if ( iBackduringProcessing )
+                    {
+                    iBackduringProcessing = EFalse;
+                    TryExitL( KDialogUserBack );
+                    }
+                }
+            break;
+            }
+
+        case ECmManagerUiCmdCmRename:            
+            {
+            RenameConnectionMethodL();
+            break;
+            }
+            
+        case EAknSoftkeyClear:
+        case ECmManagerUiCmdCmDelete:            
+            {
+            if ( iPrioritising )
+                {
+                // Delete cannot be done if priorising has started.
+                break;
+                }
+            DeleteCurrentCmL();         
+            break;
+            }
+            
+        case ECmManagerUiCmdCmPrioritise:            
+            {
+            PrioritiseConnectionMethodL();
+            break;
+            }
+            
+        case ECmManagerUiCmdCmCopyToOtherDestination:            
+            {
+            CopyConnectionMethodL();            
+            break;
+            }
+            
+        case ECmManagerUiCmdCmMoveToOtherDestination:            
+            {            
+            MoveConnectionMethodL();
+            break;
+            }
+            
+        case EAknSoftkeyOk:
+        case ECmManagerUiCmdCmEdit:
+            {
+            EditConnectionMethodL();
+            break;
+            }   
+
+        // Button Selection commands
+        case EAknSoftkeyOptions:
+            {
+            DisplayMenuL();
+            break;
+            }
+            
+        case ECmManagerUiCmdCmUserExit:
+            {
+            iExitReason = KDialogUserExit;
+            }
+            
+        case EAknSoftkeyBack:
+            {
+            if (!iProcessing)
+                {
+                *iSelected = 0;
+                TryExitL( iExitReason );
+                }
+            break;
+            }
+        case EAknCmdHelp:
+            {
+            HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(),
+                                    iEikonEnv->EikAppUi()->AppHelpContextL() );
+            }
+            break;
+
+        default:
+            {
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDlg::DeleteCurrentCmL
+// ---------------------------------------------------------------------------
+//
+void CCmDlg::DeleteCurrentCmL( )
+    {
+    LOGGER_ENTERFN( "CCmDlg::DeleteCurrentCmL" );
+
+    TCmDefConnValue oldConn;
+    if (iCmManager->IsDefConnSupported())
+        {
+        iCmManager->ReadDefConnL( oldConn );
+        }
+    CCmPluginBase* cm = CurrentCML();
+    if ( !cm )
+    	{
+    	return;
+    	}
+
+    if ( cm->GetBoolAttributeL( ECmProtected ) )
+        {
+        TCmCommonUi::ShowNoteL( R_CMWIZARD_CANNOT_PERFORM_FOR_PROTECTED,
+                                TCmCommonUi::ECmErrorNote );
+                                
+        return;
+        }
+   
+    if ( cm->GetBoolAttributeL( ECmIsLinked ) )//same check as KErrLocked below
+        {
+        TCmCommonUi::ShowNoteL( 
+                            R_QTN_NETW_CONSET_INFO_CANNOT_DELETE_VIRTUAL_REF,
+                            TCmCommonUi::ECmErrorNote );
+        
+        return;
+        }
+   
+    if ( cm->GetBoolAttributeL( ECmConnected ) )//same check as KErrInUse below
+        {
+        TCmCommonUi::ShowNoteL( R_CMMANAGERUI_INFO_CM_IN_USE_CANNOT_DELETE,
+                                TCmCommonUi::ECmErrorNote );
+        
+        return;
+        }
+
+    // EKOA-74KC3L: check if it is the last CM in a destination being referenced
+    // by a VPN
+    if ( iCmDestinationImpl &&
+         iCmDestinationImpl->ConnectionMethodCount() == 1 )
+        {
+        // it is definitely the last, but is it referenced?
+
+        // for each IAP in CM manager
+        //   1. check if it is virtual
+        //      if not => goto 1.
+        //      if yes:
+        //      2. check if it links to the destination of this CM
+        //         if yes => carryOn = EFalse, ERROR
+        //         if not: carryOn = ETrue
+
+        CommsDat::CMDBRecordSet<CommsDat::CCDIAPRecord>* iaps = 
+                                                    iCmManager->AllIapsL();
+        
+        CleanupStack::PushL( iaps );
+        
+        TBool carryOn = ETrue;
+        TUint32 destId = iCmDestinationImpl->Id();
+
+        // for each IAP in CM manager
+        for ( TInt i = 0; carryOn && i < iaps->iRecords.Count(); ++i )
+            {
+            CommsDat::CCDIAPRecord* rec = (*iaps)[i];
+            TUint32 bearerType = 0;
+            
+            TRAP_IGNORE( bearerType = 
+                             iCmManager->BearerTypeFromIapRecordL( rec ) );
+            if ( !bearerType )
+                {
+                continue;
+                }
+                
+            // check if it is virtual
+            if ( iCmManager->GetBearerInfoBoolL( bearerType, ECmVirtual ) )
+                {
+                // check if it links to the current destination
+                CCmPluginBase* plugin = NULL;            
+                TRAP_IGNORE( plugin = iCmManager->GetConnectionMethodL( 
+                                                           rec->RecordId() ) );
+
+                if ( !plugin )
+                    {
+                    continue;
+                    }
+                
+                if ( plugin->IsLinkedToSnap( destId ) )
+                    {
+                    // the CM links to this destination, deletion not allowed
+                    carryOn = EFalse;
+                    }
+
+                delete plugin;
+                }
+                    
+            }
+            
+        CleanupStack::PopAndDestroy( iaps );
+        
+        if ( !carryOn )
+            {
+            TCmCommonUi::ShowNoteL( R_QTN_NETW_CONSET_INFO_CANNOT_DELETE_VIRTUAL_REF,
+                                TCmCommonUi::ECmErrorNote );
+            return;            
+            }
+        
+        }
+    
+
+    // If it's an embedded destination, show a warning
+    TBool showCmDeleteQuery( ETrue );
+    if ( cm->GetBoolAttributeL( ECmDestination ) )
+        {
+        if ( TCmCommonUi::ShowConfirmationQueryL(
+                            R_CMMANAGERUI_QUEST_EMBEDDED_DEST_DELETE ) )
+            {
+            // user wants to delete, set flag to avoid 2nd query message
+            showCmDeleteQuery = EFalse;
+            }
+        else
+            {
+            return; // user cancelled delete request
+            }
+        }
+
+    HBufC* cmName = cm->GetStringAttributeL( ECmName );
+    CleanupStack::PushL( cmName );
+    
+    // Query for CM deletion - which will be skipped in the case of embedded 
+    // destintations
+    // Protected CM's cannot be deleted either
+    if ( !showCmDeleteQuery || iAlreadyConfirmedDelete ||
+         TCmCommonUi::ShowConfirmationQueryL( 
+                                    R_CMMANAGERUI_QUEST_CM_DELETE,
+                                    *cmName ) )
+        {
+        TInt err = KErrNone;
+        if ( iCmDestinationImpl )
+            {
+            TRAP( err, iCmDestinationImpl->DeleteConnectionMethodL( *cm ) );
+            }
+        else
+            {
+            TRAP( err, (void)cm->DeleteL( ETrue ) );
+            }
+        
+        switch ( err )
+            {
+            case KErrInUse: //shouldn't get here, already checked above
+                {
+                TCmCommonUi::ShowNoteL
+                    ( R_CMMANAGERUI_INFO_CM_IN_USE_CANNOT_DELETE,
+                    TCmCommonUi::ECmErrorNote );
+                }
+                break;
+                
+            case KErrLocked://shouldn't get here, already checked above
+                {
+                TCmCommonUi::ShowNoteL
+                    ( R_QTN_NETW_CONSET_INFO_CANNOT_DELETE_VIRTUAL_REF,
+                      TCmCommonUi::ECmErrorNote );
+                }
+                break;
+                
+            case KErrNone:
+                {
+                if ( iCmDestinationImpl )
+                    {
+                    iCmDestinationImpl->UpdateL();
+                    }
+                if (iCmManager->IsDefConnSupported())
+                    {
+                    iDestDlg->ShowDefaultConnectionNoteL( oldConn );
+                    }
+                HandleListboxDataChangeL();
+                }
+                break;
+
+            default:
+                {
+                }
+                break;
+            }
+        }
+
+    CleanupStack::PopAndDestroy( cmName );
+    }
+
+// --------------------------------------------------------------------------
+// CCmDlg::RenameConnectionMethodL    
+// --------------------------------------------------------------------------
+//
+void CCmDlg::RenameConnectionMethodL()
+    {
+    LOGGER_ENTERFN( "CCmDlg::RenameConnectionMethodL" );
+
+    CCmPluginBase* cm = CurrentCML();
+    if ( !cm )
+        {
+        return;
+        }
+
+    if ( cm->GetBoolAttributeL( ECmProtected ) )
+        {
+        TCmCommonUi::ShowNoteL( R_CMWIZARD_CANNOT_PERFORM_FOR_PROTECTED,
+                                TCmCommonUi::ECmErrorNote );
+        return;
+        }
+
+    if ( CurrentCmInUseL() )
+        {
+        return;
+        } 
+           
+    TBuf<KConnMethodNameMaxLength> buf;
+    
+    HBufC* cmName = cm->GetStringAttributeL(ECmName);
+    CleanupStack::PushL(cmName);
+    buf.Copy(*cmName);
+    
+    // Saves the recent naming method and set it to "Not accept"
+    TUint32 savedNM = cm->GetIntAttributeL( ECmNamingMethod );
+    cm->SetIntAttributeL( ECmNamingMethod, ENamingNotAccept );
+
+    // Asks the new name
+    TBool go = ETrue;
+    TInt ret = TCmCommonUi::ShowConfirmationQueryWithInputL(
+                                                R_CMMANAGERUI_PRMPT_CM_MAME,
+                                                buf );
+    
+    // While the name is not unique or cancel pressed
+    while( ret && go )
+        {
+        // Tries to save the nem name. If it is not unique
+        // then ret == KErrArgument
+        TRAPD( err, cm->SetStringAttributeL( ECmName, buf ) );
+
+        if( KErrArgument == err )
+            {
+            // Opens a info note
+            HBufC* noteLine = StringLoader::LoadLC(
+                    R_CMMANAGERUI_INFO_CM_ALREADY_IN_USE, buf );
+
+            TCmCommonUi::ShowNoteL( *noteLine, TCmCommonUi::ECmInfoNote );
+
+            CleanupStack::PopAndDestroy( noteLine );
+
+            // Asks the new name again
+            ret = TCmCommonUi::ShowConfirmationQueryWithInputL(
+                                                R_CMMANAGERUI_PRMPT_CM_MAME,
+                                                buf );
+            }
+        else
+            {
+            // New name is unique loop can stop
+            go = EFalse;
+            }    
+        }
+
+    // Sets back the original naming method
+    cm->SetIntAttributeL( ECmNamingMethod, savedNM );
+
+    // If not cancel pressed the new name is set
+    if( ret )
+        {
+        cm->UpdateL();
+        
+        HandleListboxDataChangeL();
+        }
+   
+    CleanupStack::PopAndDestroy( cmName );
+    }
+
+// --------------------------------------------------------------------------
+// CCmDlg::PrioritiseConnectionMethodL    
+// --------------------------------------------------------------------------
+//
+void CCmDlg::PrioritiseConnectionMethodL()
+    {
+    LOGGER_ENTERFN( "CCmDlg::PrioritiseConnectionMethodL" );
+    
+    ButtonGroupContainer().SetCommandSetL( R_SOFTKEYS_PRIO_OK_CANCEL__OK );
+    iListbox->View()->SelectItemL( iListbox->CurrentItemIndex() );
+    iListbox->View()->DrawItem( iListbox->CurrentItemIndex() );
+    ButtonGroupContainer().DrawNow();
+    iPrioritising = ETrue;
+    iCmToPrioritise = iListbox->CurrentItemIndex();
+    }
+
+// --------------------------------------------------------------------------
+// CCmDlg::AddConnectionMethodL    
+// --------------------------------------------------------------------------
+//
+void CCmDlg::AddConnectionMethodL()
+    {
+    LOGGER_ENTERFN( "CCmDlg::AddConnectionMethodL" );
+
+    // Check first if parent destination is protected
+    if ( iCmDestinationImpl && 
+         iCmDestinationImpl->ProtectionLevel() == CMManager::EProtLevel1 )
+        {
+        TCmCommonUi::ShowNoteL( R_CMWIZARD_CANNOT_PERFORM_FOR_PROTECTED,
+                                TCmCommonUi::ECmErrorNote );
+        return;
+        }
+
+    // Opens a Connection method creation wizard
+    iCmWizard = new (ELeave) CCmWizard( *iCmManager );
+
+    TInt itemstemp = iListbox->Model()->NumberOfItems();
+
+    TInt ret( KErrNone );
+    TRAPD( err, ret = iCmWizard->CreateConnectionMethodL( iCmDestinationImpl ) );
+    if ( err )
+        {
+        TCmCommonUi::ShowNoteL( R_CMWIZARD_CANNOT_PERFORM_FOR_PROTECTED,
+                TCmCommonUi::ECmErrorNote );
+        ret = KErrCancel;
+        }
+    delete iCmWizard;
+    iCmWizard = NULL;
+
+
+    // If application wanted to be closed before then RunAppShutter()
+    // should be called here                
+    if( iEscapeArrived )
+        {
+        ( ( CAknAppUi* )iEikonEnv->EikAppUi() )->RunAppShutter();
+        }
+    
+    if( ret != KErrCancel )
+        {
+        iHighlight = ret;
+
+
+        // Update the middle soft key if this is the first cm added
+        if ( CMCount() == 1 )
+            {
+            HBufC* text = StringLoader::LoadLC( R_QTN_MSK_EDIT );
+            ButtonGroupContainer().SetCommandL( ECmManagerUiCmdCmEdit, 
+                                                    *text );
+            CleanupStack::PopAndDestroy( text );
+            }
+        
+        //HandleListboxDataChangeL();
+        TRAP( err, HandleListboxDataChangeL() );
+        if ( err )
+            {
+            TCmCommonUi::ShowNoteL( R_CMWIZARD_CANNOT_PERFORM_FOR_PROTECTED,
+                    TCmCommonUi::ECmErrorNote );
+            return;
+            }
+        iListbox->HandleItemAdditionL();
+    
+        if (itemstemp < iListbox->Model()->NumberOfItems())
+            {
+            //first item cannot be deleted
+            iListbox->ScrollToMakeItemVisible( 
+                                    iListbox->Model()->NumberOfItems() -1 );
+            iListbox->SetCurrentItemIndexAndDraw( iHighlight );
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CCmDlg::CopyConnectionMethodL    
+// --------------------------------------------------------------------------
+//
+void CCmDlg::CopyConnectionMethodL()
+    {
+    LOGGER_ENTERFN( "CCmDlg::CopyConnectionMethodL" );
+
+    CCmPluginBase* cm = CurrentCML();
+    if ( !cm )
+        {
+        return;
+        }
+
+    if ( cm->GetBoolAttributeL( ECmProtected ) ||
+        ( iCmDestinationImpl && 
+         iCmDestinationImpl->ProtectionLevel() == CMManager::EProtLevel1 ) )
+        {
+        TCmCommonUi::ShowNoteL( R_CMWIZARD_CANNOT_PERFORM_FOR_PROTECTED,
+                                TCmCommonUi::ECmErrorNote );
+        return;
+        }
+
+    TUint32 destId( 0 );
+    
+    // build an array of possible parent destinations
+    TInt destCount=0;
+    TRAPD( retVal, destCount = iCmManager->DestinationCountL() );
+    if( retVal != KErrNone || destCount < 1 )
+        {
+        TCmCommonUi::ShowNoteL( R_CMWIZARD_NO_DESTINATION,
+                                TCmCommonUi::ECmErrorNote );
+        return;
+        }
+        
+    RArray<TUint32> destArray( iCmManager->DestinationCountL() );
+    CleanupClosePushL( destArray );
+    
+    iCmManager->AllDestinationsL( destArray );
+    
+    // drop current destination (don't ask why)
+    if ( iCmDestinationImpl ) 
+        {
+        destId = iCmDestinationImpl->Id();
+        
+        TInt index = destArray.Find( destId );
+        if ( index != KErrNotFound )
+            {
+            destArray.Remove( index );
+            }
+        }
+    
+    
+    // now filter the destinations
+    CurrentCML()->FilterPossibleParentsL( destArray );
+
+    // check if there are any remaining destinations
+    if ( !destArray.Count() )
+        {
+        TCmCommonUi::ShowNoteL( R_CMWIZARD_NO_VPN_STACKING,
+                                TCmCommonUi::ECmErrorNote );        
+        CleanupStack::PopAndDestroy( &destArray );
+        return;
+        }
+    
+    // ok, there is at least 1, pop up the dialog
+    CSelectDestinationDlg* dlg = CSelectDestinationDlg::NewL( destId, 
+                                                              *iCmManager, 
+                                                              &destArray );
+
+    if ( dlg->ExecuteLD( R_CMMANAGER_LIST_QUERY_WITH_MSGBOX ) )
+        {
+        CCmDestinationImpl* dest = iCmManager->DestinationL( destId );
+        CleanupStack::PushL( dest ); 
+        if ( iCmDestinationImpl )
+            {
+            // create a copy of the current connection method
+            CCmPluginBase* cmCopy = cm->CreateCopyL();
+            CleanupStack::PushL( cmCopy );
+            // store it in commsdat
+            cmCopy->UpdateL();
+            dest->AddConnectionMethodL( *cmCopy );
+            
+            CleanupStack::PopAndDestroy( cmCopy );
+            }
+        else
+            {
+            iCmManager->CopyConnectionMethodL( *dest, *( cm ) );
+            }
+
+        // Rare but UpdateL can leave that cause crash
+        TRAPD( err, dest->UpdateL() );
+        if( err < 0 )
+            {
+            CLOG_WRITE_1( "CCmDlg::CopyConnectionMethodL UpdateL: %d", err );
+            }
+    
+        CleanupStack::PopAndDestroy( dest );
+        HandleListboxDataChangeL();                             
+        }
+    else
+        {
+        CleanupStack::PopAndDestroy( &destArray );
+        User::Leave( KErrCancel );
+        }
+
+    CleanupStack::PopAndDestroy( &destArray );
+    }
+
+// --------------------------------------------------------------------------
+// CCmDlg::MoveConnectionMethodL
+// --------------------------------------------------------------------------
+//
+void CCmDlg::MoveConnectionMethodL()
+    {
+    LOGGER_ENTERFN( "CCmDlg::MoveConnectionMethodL" );
+
+    CCmPluginBase* cm = CurrentCML();
+    if ( !cm )
+        {
+        return;
+        }
+
+    if ( cm->GetBoolAttributeL( ECmProtected ) ||
+         iCmDestinationImpl->ProtectionLevel() == CMManager::EProtLevel1 )
+        {
+        TCmCommonUi::ShowNoteL( R_CMWIZARD_CANNOT_PERFORM_FOR_PROTECTED,
+                                TCmCommonUi::ECmErrorNote );
+        return;
+        }
+
+    if ( CurrentCmInUseL() )
+        {
+        return;
+        }
+
+    // build an array of possible parent destinations
+    RArray<TUint32> destArray( iCmManager->DestinationCountL() );
+    CleanupClosePushL( destArray );
+    
+    iCmManager->AllDestinationsL( destArray );
+    
+    TUint32 destId( 0 );
+
+    // first remove the current parent (makes no sense moving a CM to its
+    // original destination)
+    if ( iCmDestinationImpl ) 
+        {
+        destId = iCmDestinationImpl->Id();
+        
+        TInt index = destArray.Find( destId );
+        if ( index != KErrNotFound )
+            {
+            destArray.Remove( index );
+            }
+        }
+    
+    // now filter the destinations
+    CurrentCML()->FilterPossibleParentsL( destArray );
+
+    // check if there are any remaining destinations
+    if ( !destArray.Count() )
+        {
+        TCmCommonUi::ShowNoteL( R_CMWIZARD_NO_VPN_STACKING,
+                                TCmCommonUi::ECmErrorNote );        
+        CleanupStack::PopAndDestroy( &destArray );
+        return;
+        }
+
+        
+    CSelectDestinationDlg* dlg = CSelectDestinationDlg::NewL( destId, 
+                                                              *iCmManager, 
+                                                              &destArray );
+                    
+    if ( dlg->ExecuteLD( R_CMMANAGER_LIST_QUERY_WITH_MSGBOX ) )
+        {
+        CCmDestinationImpl* dest = iCmManager->DestinationL( destId );
+        CleanupStack::PushL( dest );
+        iCmManager->MoveConnectionMethodL( *iCmDestinationImpl,
+                                            *dest,
+                                            *( CurrentCML() ) );
+        CleanupStack::PopAndDestroy( dest );
+        iCmDestinationImpl->UpdateL();                            
+
+        HandleListboxDataChangeL();
+        }
+
+    CleanupStack::PopAndDestroy( &destArray );
+    }
+
+// --------------------------------------------------------------------------
+// CCmDlg::EditConnectionMethodL
+// --------------------------------------------------------------------------
+//
+void CCmDlg::EditConnectionMethodL()
+    {
+    LOGGER_ENTERFN( "CCmDlg::EditConnectionMethodL" );
+
+    CCmPluginBase* cm = NULL;
+    
+    TRAPD( err, cm = CurrentCML() );
+    
+    if( err == KErrNotSupported )
+        {
+        return;
+        }
+    else
+        {
+        User::LeaveIfError( err );
+        }
+        
+    // Must reload here in case another app changed the data (CurrentCML loads
+    // only if not already loaded)   
+    cm->ReLoadL();
+    
+    if ( cm->GetBoolAttributeL( ECmProtected ) ||
+         cm->GetBoolAttributeL( ECmDestination ) )
+        {
+        TCmCommonUi::ShowNoteL( R_CMWIZARD_CANNOT_PERFORM_FOR_PROTECTED,
+                                TCmCommonUi::ECmErrorNote );        
+        }
+    else if ( cm->GetBoolAttributeL( ECmBearerHasUi ) )
+        {
+        // check if the cm is in use
+        if ( !CurrentCmInUseL() )
+            {
+            TInt ret = cm->RunSettingsL();
+            if ( ret == KDialogUserExit )
+                {
+                TryExitL( KDialogUserExit );
+                }
+            else
+                {
+                if ( ret == KDialogUserDeleteConfirmed )
+                    {
+                    iAlreadyConfirmedDelete = ETrue;
+                    DeleteCurrentCmL();
+                    iAlreadyConfirmedDelete = EFalse;
+                    }
+                if ( ret == KDialogUserDelete )
+                    {
+                    DeleteCurrentCmL();
+                    }
+                
+                // Reorder according to priorities, if needed
+                ReOrderCMsL();
+                
+                HandleListboxDataChangeL();
+                }
+            }
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmDlg::ShowPopupNote
+// ---------------------------------------------------------------------------
+//
+void CCmDlg::ShowPopupNoteL()
+    {
+    if ( iInfoPopupNoteController )
+        {
+        if ( iListbox->Model()->NumberOfItems() && !iPrioritising )
+            {
+            // Value is only shown for concrete bearer types - allow to leave
+            HBufC* bearer = NULL;
+            TRAPD( err, bearer = 
+                CurrentCML()->GetStringAttributeL( ECmBearerNamePopupNote ) );
+
+            if ( !err )
+                {
+                CleanupStack::PushL( bearer );
+                
+                HBufC* title = StringLoader::LoadLC( 
+                                    R_CMMANAGERUI_POPUP_TITLE_DATA_BEARER );
+
+                HBufC* noteText = HBufC::NewLC( title->Size() + 
+                                               1 + 
+                                               bearer->Size() );
+                noteText->Des().Append( *title );
+                noteText->Des().Append( KCmNewLine );
+                noteText->Des().Append( *bearer );        
+                iInfoPopupNoteController->SetTextL( *noteText );
+                iInfoPopupNoteController->ShowInfoPopupNote();
+                
+                CleanupStack::PopAndDestroy( 3, bearer );
+                }
+            else
+                {
+                iInfoPopupNoteController->HideInfoPopupNote();
+                }
+            }
+        }  
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDlg::OfferKeyEventL
+// ---------------------------------------------------------------------------
+//
+TKeyResponse CCmDlg::OfferKeyEventL( const TKeyEvent& aKeyEvent, 
+                                     TEventCode aType )    
+    {
+    LOGGER_ENTERFN( "CCmDlg::OfferKeyEventL" );
+    CLOG_WRITE_1("Key iCode: %d", aKeyEvent.iCode );
+
+    TKeyResponse retVal ( EKeyWasNotConsumed );
+
+    if ( aKeyEvent.iCode == EKeyBackspace )
+        {
+        // While priorising delete item is disabled
+        if( !iPrioritising )
+            {
+            ProcessCommandL( ECmManagerUiCmdCmDelete );
+            }
+        retVal = EKeyWasConsumed;
+        }
+    else if ( aKeyEvent.iCode == EKeyEscape )
+        {
+        // Handling application close needs special care 
+        // because of iCmWizard 
+        if ( iCmWizard )
+            {
+            // if wizard alives then escape should do after wizard has ended.
+            CLOG_WRITE( "CCmDlg::OfferKeyEventL: Wizard in long process" );
+            iEscapeArrived = ETrue;
+            retVal = EKeyWasConsumed;
+            }
+        else    
+            {
+            CLOG_WRITE( "CCmDlg::OfferKeyEventL:Escape" );
+            retVal = CAknDialog::OfferKeyEventL( aKeyEvent, aType );
+            }
+        }
+    else
+        {
+        retVal = iListbox->OfferKeyEventL(aKeyEvent, aType);
+        if ( aKeyEvent.iCode == EKeyUpArrow || 
+             aKeyEvent.iCode == EKeyDownArrow )
+            {
+            ShowPopupNoteL();
+            }            
+        }
+
+    return retVal;
+    }
+// ---------------------------------------------------------------------------
+// CCmDlg::HandleInfoPopupNoteEvent
+// called before the dialog is shown to initialize listbox data
+// ---------------------------------------------------------------------------
+//    
+void CCmDlg::HandleInfoPopupNoteEvent(
+                                CAknInfoPopupNoteController* /*aController*/,
+                                TAknInfoPopupNoteEvent /*aEvent*/ )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDlg::CurrentCML
+// Currently selected connection method in the list
+// ---------------------------------------------------------------------------
+//
+CCmPluginBase* CCmDlg::CurrentCML()
+    {
+    if ( iItemIndex.Count() == 0 )
+    	{
+    	return NULL;
+    	}
+    return iCmDestinationImpl->GetConnectionMethodL( 
+        iItemIndex[iListbox->CurrentItemIndex()]);
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDlg::CMByIndexL
+// a connection method in the list
+// ---------------------------------------------------------------------------
+//
+CCmPluginBase* CCmDlg::CMByIndexL( TInt aIndex )
+    {
+    return iCmDestinationImpl->GetConnectionMethodL( aIndex );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDlg::CMCount
+// number of cms in the list
+// ---------------------------------------------------------------------------
+//
+TInt CCmDlg::CMCount()
+    {
+    return iCmDestinationImpl->ConnectionMethodCount();
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmDlg::HandleListboxDataChangeL
+// called before the dialog is shown to initialize listbox data
+// ---------------------------------------------------------------------------
+//
+void CCmDlg::HandleListboxDataChangeL()
+    {
+    TInt selected = 0;
+    if ( iListbox->CurrentItemIndex() )
+        {
+        selected = iListbox->CurrentItemIndex();
+        }
+    
+    LOGGER_ENTERFN( "CCmDlg::HandleListboxDataChangeL" );
+    iCmManager->OpenTransactionLC();
+
+    RArray<TUint32> cmIds;
+    ConstructCMArrayL( cmIds );
+    CleanupClosePushL( cmIds );
+    
+    // Remove hidden Connection Methods from the array if uncat folder
+    if ( !iCmDestinationImpl )
+        {
+        ClearHiddenCMsFromArrayL( cmIds );
+        }
+    
+    /// Using test values for now.
+    CArrayPtr< CGulIcon >* icons = new( ELeave ) CAknIconArray( KCMGranularity );
+    CleanupStack::PushL( icons );
+    iModel->ResetAndDestroy();
+    
+    MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();        
+    TParse mbmFile;
+    User::LeaveIfError( mbmFile.Set( KManagerIconFilename, 
+                                     &KDC_APP_BITMAP_DIR, 
+                                     NULL ) );        
+
+    
+    icons->AppendL( AknsUtils::CreateGulIconL( 
+                              skinInstance, 
+                              KAknsIIDQgnIndiSettProtectedAdd,
+                              mbmFile.FullName(), 
+                              EMbmCmmanagerQgn_indi_sett_protected_add, 
+                              EMbmCmmanagerQgn_indi_sett_protected_add_mask ) );  
+
+    //0..1 are reserved indexes!
+    CFbsBitmap* bitmap = NULL;
+    CFbsBitmap* mask = NULL;
+
+    AknsUtils::CreateColorIconLC( skinInstance,
+                                  KAknsIIDQgnIndiDefaultConnAdd,
+                                  KAknsIIDQsnIconColors,
+                                  EAknsCIQsnIconColorsCG13,
+                                  bitmap,
+                                  mask,
+                                  mbmFile.FullName(),
+                                  EMbmCmmanagerQgn_indi_default_conn_add,
+                                  EMbmCmmanagerQgn_indi_default_conn_add_mask,
+                                  AKN_LAF_COLOR( 215 ) );
+
+    CGulIcon* icon = CGulIcon::NewL( bitmap, mask ); // Ownership transferred
+    CleanupStack::Pop( 2 ); // bitmap, mask
+
+    CleanupStack::PushL( icon );
+    icons->AppendL( icon );
+    CleanupStack::Pop( icon );
+
+    RArray<TUint> bearerIdArray = RArray<TUint>( KCmArrayBigGranularity );
+    CleanupClosePushL( bearerIdArray );    
+    
+    TCmDefConnValue sel;
+    TInt defUid = KErrNotFound;
+    if ( iCmManager->IsDefConnSupported() )
+        {
+        iCmManager->ReadDefConnL(sel);
+        if ( sel.iType == EDCConnectionMethod )
+            {
+            defUid = sel.iId;
+            }
+        }
+    iItemIndex.Reset();
+    for ( TInt i = 0; i < cmIds.Count(); i++ )
+        {
+        TInt iconId = KErrNotFound;
+        CCDAccessPointRecord* destAPRecord = NULL;
+        CCDIAPRecord* iapRecord = NULL;
+        HBufC* name = NULL;
+        TBool isDest( cmIds[i] > KCmDefaultDestinationAPTagId );
+        TUint recId( 0 );
+        TBool protect;
+        TUint32 bearerType( 0 );
+        
+        if( isDest )
+            {
+            destAPRecord = static_cast<CCDAccessPointRecord *>(
+                           CCDRecordBase::RecordFactoryL( KCDTIdAccessPointRecord ) );
+            CleanupStack::PushL( destAPRecord );
+            destAPRecord->iRecordTag = cmIds[i];
+            if ( !destAPRecord->FindL( iCmManager->Session() ) )
+                {
+                User::Leave( KErrNotFound );
+                }
+            
+            name = TPtrC( destAPRecord->iRecordName ).AllocLC();
+
+            TProtectionLevel protLev = CCmDestinationImpl::ProtectionLevelL( *iCmManager, cmIds[i] );
+            
+            protect = (protLev == EProtLevel1) || (protLev == EProtLevel2);
+
+            HBufC* destName = StringLoader::LoadL( R_QTN_NETW_CONSET_EMBEDDED_DEST,
+                                                   *name );
+                                                   
+            CleanupStack::PopAndDestroy( name );            
+            name = destName;            
+            CleanupStack::PushL( name );
+            
+            bearerType = KUidEmbeddedDestination;
+            }
+        else
+            {
+            recId = cmIds[i];
+            iapRecord = static_cast<CCDIAPRecord *>
+                          (CCDRecordBase::RecordFactoryL(KCDTIdIAPRecord));
+            CleanupStack::PushL( iapRecord );
+            
+            iapRecord->SetRecordId( recId );
+            iapRecord->LoadL( iCmManager->Session() );
+            
+            TRAPD( err, bearerType = iCmManager->BearerTypeFromIapRecordL( iapRecord ) );
+            
+            if( err == KErrNotSupported )
+                // This is unsupported connection method -> don't add it to the list
+                {
+                CleanupStack::PopAndDestroy( iapRecord );
+                continue;
+                }
+            else
+                {
+                User::LeaveIfError( err );
+                }
+            name = TPtrC( iapRecord->iRecordName ).AllocLC();
+            protect = iapRecord->Attributes() & ECDProtectedWrite;
+
+            if ( bearerIdArray.Count() )
+                {
+                for ( TInt j = 0; j<bearerIdArray.Count(); j++ )
+                    {
+                    if ( bearerType == bearerIdArray[j] )
+                        {
+                        iconId = j+KCmReservedIconIndexCount;
+                        }
+                    }
+                }
+            }
+
+        if ( iconId == KErrNotFound )
+            {
+            TInt iconInt( 0 );
+            if( isDest )
+                // Embedded destinations has not constant icon.
+                {
+                iconInt = (TInt)CCmDestinationImpl::IconIdL( *iCmManager,
+                                                             cmIds[i] );
+                }
+            else
+                {
+                iconInt = iCmManager->GetBearerInfoIntL( bearerType, 
+                                                         ECmBearerIcon );
+                }
+
+            if (iconInt) 
+                {
+                if ( isDest )
+                    {
+                    // append zero - assuming that bearer type values differ from zero
+                    bearerIdArray.Append( 0 ); 
+                    }
+                else
+                    {
+                    bearerIdArray.Append( bearerType );
+                    }
+
+                icons->AppendL( (CGulIcon*)iconInt );
+                iconId = bearerIdArray.Count()-1+KCmReservedIconIndexCount;
+                }
+            else 
+                {
+                iconId = KCmReservedIconIndexCount;
+                }
+            }
+        TBool def = EFalse;
+        if ( defUid == recId ) 
+            {
+            def = ETrue;
+            }
+        
+        TInt nextLayerSnapId = 0;
+        if( !isDest ) 
+            {
+            // Check if it is VPN over destination    
+            // If yes the list item should have single line 
+            CCmPluginBase* plugin = iCmManager->GetConnectionMethodL( cmIds[i] );
+            CleanupStack::PushL( plugin );
+                   
+            if( plugin->GetBoolAttributeL( ECmVirtual ) )
+                {
+                nextLayerSnapId = plugin->GetIntAttributeL( ECmNextLayerSNAPId );
+                }
+                
+            CleanupStack::PopAndDestroy( plugin );
+            }
+
+        CCmListItem* item = 
+                CCmListItem::NewLC( 
+                            recId, 
+                            name,
+                            i, 
+                            iconId,
+                            protect,
+                            (nextLayerSnapId ? ETrue : EFalse),
+                            // reasons for single line
+                            ( isDest || !iCmDestinationImpl), 
+                            def );
+        CleanupStack::Pop( item );
+        CleanupStack::Pop( name );
+        CleanupStack::PopAndDestroy(); // iapRecord or nwRecord
+        CleanupStack::PushL( item );
+        iModel->AppendL( item );
+        CleanupStack::Pop( item );
+        iItemIndex.Append(i);
+        }
+    
+    TInt cmCount = iItemIndex.Count();
+    SetNoOfCMsL( cmCount );
+    
+    if ( !cmCount && iCmDestinationImpl )
+        {
+        HBufC* buf = 0;
+        // rare case probably only caused by bad configuration
+        if ( iCmDestinationImpl->ProtectionLevel() == EProtLevel1 )
+            {
+            buf = StringLoader::LoadLC( R_TEXT_SOFTKEY_OPTION );
+            }
+        else
+            {    
+            buf = StringLoader::LoadLC( R_CMMANAGERUI_MSK_ADD_METHOD );
+            }
+        ButtonGroupContainer().SetCommandL( ECmManagerUiCmdCmEdit, *buf );
+        ButtonGroupContainer().DrawDeferred();                                                    
+        CleanupStack::PopAndDestroy( buf );
+        }
+
+    CleanupStack::PopAndDestroy( &bearerIdArray );
+    
+    CArrayPtr<CGulIcon>* oldIcons = 
+                            iListbox->ItemDrawer()->ColumnData()->IconArray();
+    if ( oldIcons )
+        {
+        oldIcons->ResetAndDestroy();
+        delete oldIcons;
+        }
+    
+    iListbox->ItemDrawer()->ColumnData()->SetIconArray( icons );
+
+    CleanupStack::Pop( icons );
+    CleanupStack::PopAndDestroy( &cmIds ); 
+    
+    iCmManager->CommitTransactionL( KErrNone );
+    
+    iListbox->DrawNow();
+    iListbox->UpdateScrollBarsL();
+    
+    TInt count = iListbox->Model()->NumberOfItems();
+    if ( count )
+        {
+        if ( count <= selected )
+            {
+            selected = count - 1; // index, so --
+            }
+        if ( selected >= 0 )
+            {
+            iListbox->ScrollToMakeItemVisible( selected);
+            iListbox->SetCurrentItemIndexAndDraw( selected );            
+            }
+        }
+    }
+    
+
+// --------------------------------------------------------------------------
+// CCmDlg::CurrentCmInUseL
+// --------------------------------------------------------------------------
+//
+TBool CCmDlg::CurrentCmInUseL()
+    {
+    TBool retVal = CurrentCML()->GetBoolAttributeL( ECmConnected );
+    if ( retVal )
+        {
+        TCmCommonUi::ShowNoteL( R_QTN_SET_NOTE_AP_IN_USE_EDIT,
+                                TCmCommonUi::ECmErrorNote );
+        retVal = ETrue;
+        }
+    return retVal;
+    }
+
+// --------------------------------------------------------------------------
+// CCmDlg::ConstructCMArrayL
+// --------------------------------------------------------------------------
+//
+void CCmDlg::ConstructCMArrayL( RArray<TUint32>& aCmIds )
+    {
+    iCmDestinationImpl->ReLoadConnectionMethodsL();
+    iCmDestinationImpl->ConnectMethodIdArrayL( aCmIds );
+    }
+
+// --------------------------------------------------------------------------
+// CCmDlg::ClearHiddenCMsFromArrayL
+// --------------------------------------------------------------------------
+//
+void CCmDlg::ClearHiddenCMsFromArrayL( RArray<TUint32>& aCmIds )
+    {
+    TBool hidden( EFalse );
+    TInt err( KErrNone );
+    for ( TInt index = 0; index < aCmIds.Count(); index++ )
+        {
+        TUint recId = aCmIds[index];
+        TRAP( err, hidden = iCmManager->GetConnectionMethodInfoBoolL( recId, ECmHidden ) );
+        if ( err || hidden )
+            {
+            aCmIds.Remove( index );
+            index--;
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CCmDlg::GetHelpContext
+// --------------------------------------------------------------------------
+//
+void CCmDlg::GetHelpContext( TCoeHelpContext& aContext ) const
+    {
+    aContext.iMajor = KHelpUidPlugin;
+    aContext.iContext = KSET_HLP_CONN_METHODS_VIEW;
+    }
+    
+// --------------------------------------------------------------------------
+// CCmDlg::FinishPriorizingL
+// --------------------------------------------------------------------------
+//
+void CCmDlg::FinishPriorizingL( TBool aOkPushed )
+    {
+    LOGGER_ENTERFN( "CCmDlg::FinishPriorizing" );
+
+    iListbox->ClearSelection();
+    iPrioritising = EFalse;
+    
+    if( aOkPushed )
+        {
+        if ( CurrentCML()->GetBoolAttributeL( ECmDestination ) ||
+             (CurrentCML()->GetBoolAttributeL( ECmVirtual ) &&
+              CurrentCML()->GetIntAttributeL( ECmNextLayerSNAPId )) )
+            {
+            // Priorising not possible
+            TCmCommonUi::ShowNoteL( R_CMMANAGERUI_INFO_PRIO_NOT_POSSIBLE,
+                                    TCmCommonUi::ECmInfoNote );
+            }
+        else
+            {
+            CCmPluginBase* cm = CMByIndexL(iCmToPrioritise);
+            iCmDestinationImpl->ModifyPriorityL( 
+                                *cm, 
+                                iListbox->CurrentItemIndex());
+            iCmDestinationImpl->UpdateL();
+            HandleListboxDataChangeL();
+            ShowPopupNoteL();
+            }
+        }
+     // Set the softkeys back    
+     ButtonGroupContainer().SetCommandSetL(
+                                    R_SOFTKEYS_OPTIONS_BACK__EDIT );
+     ButtonGroupContainer().DrawDeferred();
+     }
+
+
+// --------------------------------------------------------------------------
+// CCmDlg::Execute
+// --------------------------------------------------------------------------
+//
+void CCmDlg::Execute()
+    {
+    LOGGER_ENTERFN( "CCmDlg::Execute" );
+
+    iInfoPopupNoteController->HideInfoPopupNote();
+    
+    if(iPrioritising)
+    	{
+    	TRAPD( err, FinishPriorizingL( ETrue ) );
+    	if ( err )
+    	    {
+    	    HandleLeaveError( err );
+    	    }
+    	}
+    else
+    	{
+        iProcessing = ETrue;
+        
+        TRAPD( err, ProcessCommandL(ECmManagerUiCmdCmEdit) );
+    	if ( err )
+    	    {
+    	    HandleLeaveError( err );
+    	    }
+
+        iProcessing = EFalse;
+    	}
+    }
+
+// --------------------------------------------------------------------------
+// CCmDlg::HandleLeaveError
+// --------------------------------------------------------------------------
+//
+void CCmDlg::HandleLeaveError( TInt /*aError*/ )
+    {
+    if(iProcessing)
+        {
+        iProcessing = EFalse;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CCmDlg::HandleResourceChange
+// --------------------------------------------------------------------------
+//
+void CCmDlg::HandleResourceChange( TInt aType )
+    {
+    CCoeControl::HandleResourceChange( aType ); 
+
+    if( aType == KEikDynamicLayoutVariantSwitch )
+        {
+        DrawNow(); 
+        }
+        
+    CAknDialog::HandleResourceChange(aType);        
+    }
+
+// --------------------------------------------------------------------------
+// CCmDlg::GetInsertIndexL
+// --------------------------------------------------------------------------
+//
+TInt CCmDlg::GetInsertIndexL( TInt aCount, TUint32 aPriority )
+    {
+    TInt ret = -1;
+    TUint32 priority;
+    
+    for ( TInt index = 0; index < aCount; index++ )
+        {
+        CCmPluginBase* cm = iCmDestinationImpl->GetConnectionMethodL( iItemIndex[index] );
+        
+        if ( cm->GetBoolAttributeL( ECmVirtual ) &&
+             !cm->GetIntAttributeL( ECmNextLayerSNAPId ) )
+             {
+             TUint32 underlying = cm->GetIntAttributeL( ECmNextLayerIapId );
+             if ( underlying != 0 )
+                {
+                // Find the index that this VPN Iap should be inserted
+                TUint32 underlyingBearer = iCmManager->BearerTypeFromCmIdL( underlying );
+                priority = iCmManager->GetBearerInfoIntL( underlyingBearer, ECmDefaultPriority );
+                }
+             else
+                {
+                priority = KDataMobilitySelectionPolicyPriorityWildCard;
+                }
+             }
+        else
+            {
+            priority = cm->Plugin()->GetIntAttributeL( ECmDefaultPriority );
+            }
+        
+        if (priority > aPriority)
+            {
+            ret = index;
+            break;
+            }
+        }
+    
+    return ret;
+    }
+
+// --------------------------------------------------------------------------
+// CCmDlg::ReBuildItemIndexArrayL
+// --------------------------------------------------------------------------
+//
+void CCmDlg::ReBuildItemIndexArrayL()
+    {
+    iCmManager->OpenTransactionLC();
+
+    RArray<TUint32> cmIds;
+    ConstructCMArrayL( cmIds );
+    CleanupClosePushL( cmIds );
+    
+    // Remove hidden Connection Methods from the array if uncat folder
+    if ( !iCmDestinationImpl )
+        {
+        ClearHiddenCMsFromArrayL( cmIds );
+        }
+
+    iItemIndex.Reset();
+    for ( TInt i = 0; i < cmIds.Count(); i++ )
+        {
+        iItemIndex.Append(i);
+        }
+
+    CleanupStack::PopAndDestroy( &cmIds ); 
+    
+    iCmManager->CommitTransactionL( KErrNone );
+    }
+
+// --------------------------------------------------------------------------
+// CCmDlg::ReOrderCMsL
+// --------------------------------------------------------------------------
+//
+void CCmDlg::ReOrderCMsL()
+    {
+    ReBuildItemIndexArrayL();
+    
+    TBool prioAllowed = ETrue;
+    TInt firstNotAllowedEntry = 0;
+    TInt index = 0;
+    TInt count = iItemIndex.Count();
+    
+    if (!iCmDestinationImpl)
+        {
+        return;
+        }
+   
+    // This part is to move a SANP-referred VPN Iap to the end of list if the VPN Iap is changed from
+    // IAP-referred to SNAP-referred. 
+    for ( index = 0; index < count; index++ )
+        {
+        CCmPluginBase* cm = iCmDestinationImpl->GetConnectionMethodL( iItemIndex[index] );
+        
+        if ( cm->GetBoolAttributeL( ECmDestination ) ||
+             (cm->GetBoolAttributeL( ECmVirtual ) &&
+              cm->GetIntAttributeL( ECmNextLayerSNAPId )) )
+            {
+            prioAllowed = EFalse;
+            firstNotAllowedEntry = index;
+            }
+        else
+            {
+            if ( !prioAllowed )
+                {
+                iCmDestinationImpl->ModifyPriorityL(*cm, firstNotAllowedEntry);
+                iCmDestinationImpl->UpdateL();
+                // start from the beginning
+                index = 0;
+                prioAllowed = ETrue;
+                continue;
+                }
+            }
+        }
+
+    // This part is to move a IAP-referred VPN Iap to a proper location of priority in list
+    // if the VAP Iap is changed from SNAP-referred to IAP-referred.
+    for ( index = 0; index < count; index++ )
+        {
+        CCmPluginBase* cm = iCmDestinationImpl->GetConnectionMethodL( iItemIndex[index] );
+
+        if ( cm->GetBoolAttributeL( ECmVirtual ) &&
+             !cm->GetIntAttributeL( ECmNextLayerSNAPId ) )
+            {
+            TUint32 underlying = cm->GetIntAttributeL( ECmNextLayerIapId );
+            if ( underlying != 0 )
+                {
+                // Find the index that this VPN Iap should be inserted
+                TUint32 underlyingBearer = iCmManager->BearerTypeFromCmIdL( underlying );
+                TUint32 underlyingPrio = iCmManager->GetBearerInfoIntL( underlyingBearer, ECmDefaultPriority );
+                TInt insertAt = GetInsertIndexL( index, underlyingPrio );
+                
+                // Modify the priority of this VPN Iap
+                if (insertAt != -1)
+                    {
+                    iCmDestinationImpl->ModifyPriorityL( *cm, insertAt );
+                    iCmDestinationImpl->UpdateL();
+                    break;
+                    }
+                }
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CCmDlg::CommsDatChanges
+// --------------------------------------------------------------------------
+//
+void CCmDlg::CommsDatChangesL()
+    {
+    if (iCmDestinationImpl)
+        {
+        // If the destination that is currently working on disappears
+        // with some reason then go back to parent view
+        if( !iCmManager->DestinationStillExistedL( iCmDestinationImpl ) )
+            {
+            iCmManager->WatcherUnRegister();
+            TryExitL( iExitReason );
+            return;
+            }
+        }
+    
+    // Update list box
+    HandleListboxDataChangeL();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Src/cmlistbox.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,150 @@
+/*
+* 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 CCmListbox
+*
+*/
+
+#include <eikclbd.h>
+#include <avkon.mbg>
+#include <aknkeys.h>
+#include <data_caging_path_literals.hrh>
+
+#include "cmlistbox.h"
+#include "cmlistboxmodel.h"
+#include "cmlistitem.h"
+
+
+// ---------------------------------------------------------------------------
+// CCmListbox::NewL
+// ---------------------------------------------------------------------------
+//
+CCmListbox* CCmListbox::NewL( const CCoeControl* aParent )
+    {
+    CCmListbox* listbox = new ( ELeave ) CCmListbox();
+    CleanupStack::PushL( listbox );
+    listbox->ConstructL( aParent, EAknListBoxSelectionList );
+    CleanupStack::Pop( listbox );    
+    return listbox;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmListbox::CCmListbox
+// ---------------------------------------------------------------------------
+//
+CCmListbox::CCmListbox()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CCmListbox::~CCmListbox
+// ---------------------------------------------------------------------------
+//
+CCmListbox::~CCmListbox()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CCmListbox::OfferKeyEventL
+// ---------------------------------------------------------------------------
+//
+TKeyResponse CCmListbox::OfferKeyEventL
+( const TKeyEvent& aKeyEvent, TEventCode aType )
+    {
+    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!
+        return EKeyWasConsumed;
+        }
+    else
+        {
+        return CAknDoubleGraphicStyleListBox::OfferKeyEventL
+            ( aKeyEvent, aType );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmListbox::FocusChanged
+// ---------------------------------------------------------------------------
+//
+void CCmListbox::FocusChanged( TDrawNow aDrawNow )
+    {
+    // Do nothing until the listbox is fully constructed
+    // The dialogpage sets the focus before calling ConstructL
+    if ( iView )
+        {
+        CAknDoubleGraphicStyleListBox::FocusChanged( aDrawNow );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmListbox::Uid4Item
+// ---------------------------------------------------------------------------
+//
+TUint32 CCmListbox::Uid4Item( TInt aItem ) const
+    {
+    CCmListboxModel* lbmodel =
+        STATIC_CAST( CCmListboxModel*, Model()->ItemTextArray() );
+    return lbmodel->At( aItem )->Uid();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmListbox::CurrentItemUid
+// ---------------------------------------------------------------------------
+//
+TUint32 CCmListbox::CurrentItemUid() const
+    {
+    CCmListboxModel* lbmodel =
+        STATIC_CAST( CCmListboxModel*, Model()->ItemTextArray() );
+    TInt idx = CurrentItemIndex();
+    TUint32 retval( 0 );
+    if ( idx >= 0 )
+        {
+        retval = lbmodel->At( idx )->Uid();
+        }
+    return retval;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmListbox::CurrentItemNameL
+// ---------------------------------------------------------------------------
+//
+const TDesC& CCmListbox::CurrentItemNameL()
+    {
+    CCmListboxModel* lbmodel = new( ELeave )CCmListboxModel;
+    lbmodel = STATIC_CAST( CCmListboxModel*, Model()->ItemTextArray() );
+    return lbmodel->At( CurrentItemIndex() )->Name();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmListbox::HandleResourceChange
+// ---------------------------------------------------------------------------
+//
+void CCmListbox::HandleResourceChange(TInt aType)
+    {
+    if ( aType == KAknsMessageSkinChange )
+        {
+        SizeChanged();
+        }
+        
+    CAknDoubleGraphicStyleListBox::HandleResourceChange( aType );     
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Src/cmlistboxmodel.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,159 @@
+/*
+* 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 CCmListboxModel
+*
+*/
+
+#include <AknIconArray.h>
+#include <aknlists.h>
+#include <StringLoader.h>
+#include <cmmanager.rsg>
+
+#include "cmlistboxmodel.h"
+#include "cmlistitem.h"
+#include <cmcommonconstants.h>
+#include "cmlistitemlist.h"
+
+// ---------------------------------------------------------------------------
+// CCmListboxModel::CCmListboxModel
+// ---------------------------------------------------------------------------
+//
+CCmListboxModel::CCmListboxModel()
+    : iOffset( 0 )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CCmListboxModel::~CCmListboxModel
+// ---------------------------------------------------------------------------
+//
+CCmListboxModel::~CCmListboxModel()
+    {
+    //ResetAndCmroy(); // deletes all elements...
+    }
+
+// ---------------------------------------------------------------------------
+// CCmListboxModel::MdcaCount
+// ---------------------------------------------------------------------------
+//
+TInt CCmListboxModel::MdcaCount() const
+    {
+    return Count();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmListboxModel::SetOwnIconOffset
+// ---------------------------------------------------------------------------
+//
+void CCmListboxModel::SetOwnIconOffset( TInt aOffset )
+    {
+    iOffset = aOffset;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmListboxModel::MdcaPoint
+// ---------------------------------------------------------------------------
+//
+TPtrC CCmListboxModel::MdcaPoint( TInt aIndex ) const
+    {
+    // We need to cast away the const-ness from the buffer.
+    // It was definitely made for formatting!
+    FormatListboxText( aIndex,
+                       MUTABLE_CAST( TBuf<KMaxCmListboxName>&, iBuf ) );
+
+    return iBuf;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmListboxModel::FormatListboxText
+// ---------------------------------------------------------------------------
+//
+void CCmListboxModel::FormatListboxText( TInt aIndex,
+                                         TDes& aBuf ) const
+    {
+    TRAP_IGNORE( FormatListboxTextL( aIndex, aBuf ) );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmListboxModel::FormatListboxTextL
+// ---------------------------------------------------------------------------
+//
+void CCmListboxModel::FormatListboxTextL( TInt aIndex,
+                                          TDes& aBuf ) const
+    {
+    aBuf.Zero();
+    TUint icon = At( aIndex )->IconIndex();
+    if ( At(aIndex)->IsSingleLine() )
+        {
+        if ( At(aIndex)->IsProtected() )
+            {
+            aBuf.Format( KListItemFormatEmbDestProt, 
+                         icon, 
+                         &At( aIndex )->Name(), 
+                         KCmReservedIconIndexProtected );
+            }
+        else            
+            {
+            aBuf.Format( KListItemFormatEmbDest, 
+                         icon,
+                         &At( aIndex )->Name() );            
+            }
+        }
+     else
+        {
+        HBufC* secondLine;
+        secondLine = StringLoader::LoadLC( R_CMMANAGERUI_METHOD_PRIORITY_OTHER,
+                                           At( aIndex )->Priority() + 1 );
+    if ( At( aIndex )->IsDefault() )
+        {
+            aBuf.Format( KListItemFormatCmProt,
+                         icon, 
+                         &At( aIndex )->Name(), 
+                         secondLine, 
+                         KCmReservedIconIndexDefaultConn );
+        }
+    else
+        {
+        if ( At(aIndex)->IsProtected() )
+            {
+            aBuf.Format( KListItemFormatCmProt, 
+                         icon, 
+                         &At( aIndex )->Name(), 
+                         secondLine, 
+                         KCmReservedIconIndexProtected );    
+            }
+        else if ( At(aIndex)->IsVpnOverDestination() )
+            {
+            CleanupStack::PopAndDestroy( secondLine );
+            
+            secondLine = StringLoader::LoadLC( R_QTN_NETW_CONSET_METHOD_PRIORITY_AUTO);
+
+            aBuf.Format( KListItemFormatCm, 
+                         icon,
+                         &At( aIndex )->Name(),
+                         secondLine );
+            }
+        else
+            {
+            aBuf.Format( KListItemFormatCm, 
+                         icon, 
+                         &At( aIndex )->Name(), 
+                         secondLine );
+            }
+         }
+            
+        CleanupStack::PopAndDestroy( secondLine );
+        }
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Src/cmlistitem.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,158 @@
+/*
+* 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 CCmListItem
+*
+*/
+
+#include <eikdef.h>
+#include "cmlistitem.h"
+
+// ---------------------------------------------------------
+// CCmListItem::NewLC
+// ---------------------------------------------------------
+//
+CCmListItem* CCmListItem::NewLC( TUint32 aUid,
+                                 HBufC* aName,
+                                 TInt aPriority, 
+                                 TUint aIconIndex, 
+                                 TBool aIsProtected, 
+                                 TBool aIsVpnOverDestination,
+                                 TBool aIsSingleLine,
+                                 TBool aIsDefault )
+    {
+
+    CCmListItem* db = new( ELeave ) CCmListItem( aName );
+    CleanupStack::PushL( db );
+    db->ConstructL( aUid, 
+                    aPriority, 
+                    aIconIndex, 
+                    aIsProtected,
+                    aIsVpnOverDestination, 
+                    aIsSingleLine,
+                    aIsDefault );
+    return db;
+    }
+// ---------------------------------------------------------
+// CCmListItem::~CCmListItem
+// ---------------------------------------------------------
+//
+CCmListItem::~CCmListItem()
+    {
+    delete iName;
+    }
+
+// ---------------------------------------------------------
+// CCmListItem::CCmListItem
+// ---------------------------------------------------------
+//
+CCmListItem::CCmListItem( HBufC* aName )
+    : iName( aName )
+    {
+    }
+
+// ---------------------------------------------------------
+// CCmListItem::ConstructL
+// ---------------------------------------------------------
+//
+void CCmListItem::ConstructL( TUint32 aUid,
+                              TInt aPriority, 
+                              TUint aIconIndex, 
+                              TBool aIsProtected, 
+                              TBool aIsVpnOverDestination,
+                              TBool aIsSingleLine,
+                              TBool aIsDefault )
+    {
+    iPriority = aPriority;
+    iIconIndex = aIconIndex;
+    iIsProtected =  aIsProtected;
+    iIsSingleLine =  aIsSingleLine;
+    iIsDefault =  aIsDefault;
+    iIsVpnOverDestination = aIsVpnOverDestination;
+        
+    iUid = aUid;
+    }
+// ---------------------------------------------------------
+// CCmListItem::Name
+// ---------------------------------------------------------
+//
+const TDesC& CCmListItem::Name()
+    {
+    return *iName;
+    }
+
+
+// ---------------------------------------------------------
+// CCmListItem::Uid
+// ---------------------------------------------------------
+//
+TUint32 CCmListItem::Uid()
+    {
+    return iUid;
+    }
+    
+// ---------------------------------------------------------
+// CCmListItem::IconIndex
+// ---------------------------------------------------------
+//
+TUint CCmListItem::IconIndex()
+    {
+    return iIconIndex;
+    }
+
+// ---------------------------------------------------------
+// CCmListItem::Priority
+// ---------------------------------------------------------
+//
+TInt CCmListItem::Priority()
+    {
+    return iPriority;
+    }
+
+// ---------------------------------------------------------
+// CCmListItem::IsProtected
+// ---------------------------------------------------------
+//
+TBool CCmListItem::IsProtected()
+    {
+    return iIsProtected;
+    }
+    
+// ---------------------------------------------------------
+// CCmListItem::IsSingleLine
+// ---------------------------------------------------------
+//
+TBool CCmListItem::IsSingleLine()
+    {
+    return iIsSingleLine;
+    }
+
+// ---------------------------------------------------------
+// CCmListItem::IsDefault
+// ---------------------------------------------------------
+//    
+TBool CCmListItem::IsDefault()
+    {
+    return iIsDefault;
+    }
+
+// ---------------------------------------------------------
+// CCmListItem::IsVpnOverDestination
+// ---------------------------------------------------------
+//    
+TBool CCmListItem::IsVpnOverDestination()
+    {
+    return iIsVpnOverDestination;
+    }
+
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Src/cmlistitemlist.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,62 @@
+/*
+* 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 CCmListItemList
+*
+*/
+
+#include "cmlistitemlist.h"
+#include "cmlistitem.h"
+
+
+LOCAL_D const TInt KGranularity = 4;    ///< Granularity of the list.
+
+// ---------------------------------------------------------
+// CCmListItemList::CCmListItemList
+// ---------------------------------------------------------
+//
+CCmListItemList::CCmListItemList()
+    : CArrayPtrFlat<CCmListItem>( KGranularity )
+    {
+    }
+
+// ---------------------------------------------------------
+// CCmListItemList::~CCmListItemList
+// ---------------------------------------------------------
+//
+CCmListItemList::~CCmListItemList()
+    {
+    ResetAndDestroy();
+    }
+
+// ---------------------------------------------------------
+// CCmListItemList::ItemForUid
+// ---------------------------------------------------------
+//
+CCmListItem* CCmListItemList::ItemForUid( TUint32 aUid ) const
+    {
+    // This method cannot return "const CCmListItem*", because all methods
+    // of CCmListItem are non-const -> if the returned item was const, it
+    // would be unusable.
+    TInt i;
+    TInt count = Count();
+    for ( i = 0; i < count; i++ )
+        {
+        if ( At( i )->Uid() == aUid )
+            {
+            return At( i );
+            }
+        }
+
+    return NULL;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Src/cmlogger.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,220 @@
+/*
+* 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 TLogger
+*
+*/
+
+#include    "cmlogger.h"
+
+#ifdef __CONNECTION_METHOD_LOG__
+
+_LIT( KDeclareLoggerName, "<DECLARE_LOGGER_NAME>< %S >" );
+_LIT( KAttachLogger, "<ATTACH_LOGGER><%x>to<%x>" );
+_LIT( KOwnerLog, "<%x> -\t" );
+_LIT8( KOwnerLog8, "<%x> -\t" );
+_LIT( KLoggerCreated, "<LOGGER_CREATED>" );
+_LIT( KLoggerClosed, "<LOGGER_CLOSED>" );
+_LIT( KLoggerName, "[CMManager]" );
+_LIT8( KLoggerName8, "[CMManager]" );
+
+// ---------------------------------------------------------
+// CFunctionEntryExit::CFunctionEntryExit()
+// ---------------------------------------------------------
+//
+CFunctionEntryExit::CFunctionEntryExit( const TAny* aOwner, 
+                                        TRefByValue<const TDesC> aFunc )
+    : iOwner( aOwner )
+    {
+    iEntryTime.UniversalTime();
+
+    iFunc.Set( aFunc );
+        
+    TLogger::LogIt( aOwner, _L("-> <%S>"), &iFunc );
+    }
+    
+// ---------------------------------------------------------
+// CFunctionEntryExit::~CFunctionEntryExit()
+// ---------------------------------------------------------
+//
+CFunctionEntryExit::~CFunctionEntryExit() 
+    {
+    TTime exitTime;
+    
+    exitTime.UniversalTime();
+    TLogger::LogIt( iOwner, _L("<- <%S><%d>"), 
+                      &iFunc, 
+                      I64LOW( exitTime.MicroSecondsFrom( iEntryTime ).Int64()));
+    }
+
+// ---------------------------------------------------------
+// TLogger::CreateFlogger()
+// ---------------------------------------------------------
+//
+void TLogger::CreateLogger( TAny* aOwner )
+    {
+    LogIt( aOwner, KLoggerCreated );
+    }
+    
+// ---------------------------------------------------------
+// TLogger::CloseLogger()
+// ---------------------------------------------------------
+//
+void TLogger::CloseLogger( TAny* aOwner )
+    {
+    LogIt( aOwner, KLoggerClosed );
+    }
+
+// ---------------------------------------------------------
+// TLogger::AttachFLogger()
+// ---------------------------------------------------------
+//
+void TLogger::AttachLogger( const TAny* aOwner,
+                               const TAny* aAttach1, 
+                               const TAny* aAttach2 )
+    {
+    LogIt( aOwner, KAttachLogger, aAttach1, aAttach2 );
+    }
+    
+// ---------------------------------------------------------
+// TLogger::NameIt()
+// ---------------------------------------------------------
+//
+void TLogger::NameIt( const TAny* aOwner, TRefByValue<const TDesC> aFmt, ...)
+    {
+    VA_LIST list;
+    VA_START(list,aFmt);
+    
+    TBuf<KLogBufferSize> nameBuf;
+    TBuf<KLogBufferSize> logBuf;
+    
+    nameBuf.FormatList( aFmt, list );
+    logBuf.Format( KDeclareLoggerName, &nameBuf );
+
+    VA_END(list);
+    
+    TBuf<32> tempBuf;
+    
+#ifdef _LOG_MICRO_TIME_
+    TTime timeNull( 0 );
+    TTime timeNow;
+    
+    timeNow.UniversalTime();
+    
+    tempBuf.Format( _L(" - %Li - "), timeNow.MicroSecondsFrom(timeNull));
+    
+    logBuf.Insert( 0, timeBuf );
+#endif    
+
+    tempBuf.Format( KOwnerLog, aOwner );
+    logBuf.Insert( 0, tempBuf );
+    logBuf.Insert( 0, KLoggerName );
+
+    RDebug::Print( logBuf );
+    }
+    
+// ---------------------------------------------------------
+// TLogger::LogIt()
+// ---------------------------------------------------------
+//
+void TLogger::LogIt( const TAny* aOwner, 
+                       TRefByValue<const TDesC> aFmt, 
+                       VA_LIST aList )
+    {
+    TBuf<KLogBufferSize> logBuf;
+
+    logBuf.FormatList( aFmt, aList );
+
+    TBuf<32> tempBuf;
+
+#ifdef _LOG_MICRO_TIME_
+    TTime timeNull( 0 );
+    TTime timeNow;
+    
+    timeNow.UniversalTime();
+    
+    tempBuf.Format( _L(" - %Li - "), timeNow.MicroSecondsFrom(timeNull));
+    
+    logBuf.Insert( 0, timeBuf );
+#endif    
+
+    tempBuf.Format( KOwnerLog, aOwner );
+    logBuf.Insert( 0, tempBuf );
+    logBuf.Insert( 0, KLoggerName );
+
+    RDebug::Print( logBuf );
+    }
+    
+// ---------------------------------------------------------
+// TLogger::LogIt()
+// ---------------------------------------------------------
+//
+void TLogger::LogIt( const TAny* aOwner, 
+                     TRefByValue<const TDesC8> aFmt, 
+                     VA_LIST aList )
+    {
+    TBuf8<KLogBufferSize> logBuf;
+    
+    logBuf.FormatList( aFmt, aList );
+
+    TBuf8<32> tempBuf8;
+
+#ifdef _LOG_MICRO_TIME_
+    TTime timeNull( 0 );
+    TTime timeNow;
+    
+    timeNow.UniversalTime();
+    
+    
+    tempBuf8.Format( _L8(" - %Li - "), timeNow.MicroSecondsFrom(timeNull));
+    
+    logBuf.Insert( 0, tempBuf );
+#endif    
+
+    tempBuf8.Format( KOwnerLog8, aOwner );
+    logBuf.Insert( 0, tempBuf8 );
+    logBuf.Insert( 0, KLoggerName8 );
+
+    RDebug::RawPrint( logBuf );
+    }
+
+// ---------------------------------------------------------
+// TLogger::LogIt()
+// ---------------------------------------------------------
+//
+void TLogger::LogIt( const TAny* aOwner, TRefByValue<const TDesC> aFmt, ...)
+
+    {
+    VA_LIST list;
+    VA_START(list,aFmt);
+    
+    TLogger::LogIt( aOwner, aFmt, list );
+
+    VA_END(list);
+    }
+
+// ---------------------------------------------------------
+// TLogger::LogIt()
+// ---------------------------------------------------------
+//
+void TLogger::LogIt( const TAny* aOwner, TRefByValue<const TDesC8> aFmt, ...)
+    {
+    VA_LIST list;
+    VA_START(list,aFmt);
+    
+    TLogger::LogIt( aOwner, aFmt, list );
+
+    VA_END(list);
+    }
+
+#endif  // __CONNECTION_METHOD_LOG__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Src/cmmanager.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,555 @@
+/*
+* 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 RCmManager.
+*
+*/
+
+#include <cmmanager.h>
+#include <cmconnectionmethod.h>
+#include <cmdestination.h>
+#include "cmlogger.h"
+#include "cmmanagerimpl.h"
+#include "cmdestinationimpl.h"
+#include "cmmanager.hrh"
+#include <cmcommonconstants.h>
+#include <cmpluginbaseeng.h>
+#include <cmpluginbase.h>
+
+//-----------------------------------------------------------------------------
+//  RCmManager::Close()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C void RCmManager::Close()
+    {
+    CLOG_WRITE( "RCmManagerExt::Close()" );
+    delete iImplementation;
+    iImplementation = NULL;
+    
+    CLOG_CLOSE;
+    }
+
+//-----------------------------------------------------------------------------
+//  RCmManager::OpenL()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C void RCmManager::OpenL()
+    {
+    CLOG_CREATE;
+    CLOG_NAME_1( _L("Manager_0x%x"), this );
+    iImplementation = CCmManagerImpl::NewL(EFalse);
+    CLOG_ATTACH( iImplementation, this );
+    }
+
+//-----------------------------------------------------------------------------
+//  RCmManagerExt::CreateTablesAndOpenL()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C void RCmManager::CreateTablesAndOpenL()
+    {
+    CLOG_CREATE;
+    CLOG_NAME_1( _L("Manager_0x%x"), this );
+    iImplementation = CCmManagerImpl::NewL();
+    CLOG_ATTACH( iImplementation, this );
+    }
+
+//-----------------------------------------------------------------------------
+//  RCmManager::OpenLC()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C void RCmManager::OpenLC()
+    {
+    CLOG_CREATE;
+    CLOG_NAME_1( _L("Manager_0x%x"), this );
+    CleanupClosePushL(*this);
+    iImplementation = NULL;
+    iImplementation = CCmManagerImpl::NewL();
+    CLOG_ATTACH( iImplementation, this );
+    }
+
+//-----------------------------------------------------------------------------
+//  RCmManager::ConnectionMethodL( TUint aId )
+//-----------------------------------------------------------------------------
+//
+EXPORT_C RCmConnectionMethod RCmManager::ConnectionMethodL( 
+                                                    TUint32 aIapId ) const
+    {
+    RCmConnectionMethod cm;
+    CCmPluginBase* cM =  iImplementation->GetConnectionMethodL( aIapId );
+    cm.iImplementation = cM->Plugin();
+    cm.iImplementation->IncrementRefCounter();
+    delete cM;
+    
+    return cm;
+    }
+
+//-----------------------------------------------------------------------------
+//  RCmManager::GetBearerInfoIntL()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C TUint32 RCmManager::GetBearerInfoIntL( TUint32 aBearerType,
+                                                TUint32 aAttribute ) const
+    {
+    return iImplementation->GetBearerInfoIntL( aBearerType,
+                                                       aAttribute );
+    }
+
+//-----------------------------------------------------------------------------
+//  RCmManager::GetBearerInfoBoolL()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C TBool RCmManager::GetBearerInfoBoolL( TUint32 aBearerType,
+                                               TUint32 aAttribute ) const
+    {
+    return iImplementation->GetBearerInfoBoolL( aBearerType,
+                                                       aAttribute );
+    }
+
+//-----------------------------------------------------------------------------
+//  RCmManager::GetBearerInfoStringL()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C HBufC* RCmManager::GetBearerInfoStringL( TUint32 aBearerType,
+                                                  TUint32 aAttribute ) const
+    {
+    return iImplementation->GetBearerInfoStringL( aBearerType,
+                                                       aAttribute );
+    }
+
+//-----------------------------------------------------------------------------
+//  RCmManager::GetBearerInfoStringL()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C HBufC8* RCmManager::GetBearerInfoString8L( TUint32 aBearerType,
+                                                    TUint32 aAttribute ) const
+    {
+    return iImplementation->GetBearerInfoString8L( aBearerType,
+                                                       aAttribute );
+    }
+
+// -----------------------------------------------------------------------------
+// RCmManager::GetConnectionMethodInfoIntL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TUint32 RCmManager::GetConnectionMethodInfoIntL( 
+                                                    TUint32 aIapId,
+                                                    TUint32 aAttribute ) const
+    {
+    return iImplementation->GetConnectionMethodInfoIntL( aIapId, aAttribute );
+    }
+    
+// -----------------------------------------------------------------------------
+// RCmManager::GetConnectionMethodInfoBoolL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool RCmManager::GetConnectionMethodInfoBoolL( 
+                                                    TUint32 aIapId,
+                                                    TUint32 aAttribute ) const
+    {
+    return iImplementation->GetConnectionMethodInfoBoolL( aIapId, aAttribute );
+    }
+    
+// -----------------------------------------------------------------------------
+// RCmManager::GetConnectionMethodInfoStringL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C HBufC* RCmManager::GetConnectionMethodInfoStringL( 
+                                                    TUint32 aIapId,
+                                                    TUint32 aAttribute ) const
+    {
+    return iImplementation->GetConnectionMethodInfoStringL( aIapId, aAttribute );
+    }
+    
+// -----------------------------------------------------------------------------
+// RCmManager::GetConnectionMethodInfoString8L()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C HBufC8* RCmManager::GetConnectionMethodInfoString8L( 
+                                                    TUint32 aIapId,
+                                                    TUint32 aAttribute ) const
+    {
+    return iImplementation->GetConnectionMethodInfoString8L( aIapId, aAttribute );
+    }
+    
+//=============================================================================
+// CREATION / DELETION API
+//=============================================================================
+//
+
+//-----------------------------------------------------------------------------
+//  RCmManager::CreateDestinationL( const TDesC& aName )
+//-----------------------------------------------------------------------------
+//
+EXPORT_C RCmDestination RCmManager::CreateDestinationL( const TDesC& aName )
+    {
+    LOGGER_ENTERFN( "RCmManager::CreateDestinationL" );
+
+    RCmDestination dest;
+    
+    CCmDestinationImpl* destImp = iImplementation->CreateDestinationL( aName );
+    dest.iDestinatonData = destImp->GetData();
+    dest.iDestinatonData->IncrementRefCounter();
+    delete destImp;
+    
+    return dest;
+    }
+
+// -----------------------------------------------------------------------------
+// RCmManager::CreateConnectionMethodL()
+// -----------------------------------------------------------------------------
+//  
+EXPORT_C RCmConnectionMethod RCmManager::CreateConnectionMethodL(
+    TUint32 aImplementationUid )
+    {
+    LOGGER_ENTERFN( "RCmManager::CreateConnectionMethodL" );
+
+    RCmConnectionMethod cm;
+        
+    CCmPluginBase* cM =  
+        iImplementation->CreateConnectionMethodL( aImplementationUid );
+    cm.iImplementation = cM->Plugin();
+    cm.iImplementation->IncrementRefCounter();
+    delete cM;
+
+    return cm;
+    }
+
+//-----------------------------------------------------------------------------
+// RCmManager::CopyL()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C TInt RCmManager::CopyConnectionMethodL(
+    RCmDestination& aTargetDestination,
+    RCmConnectionMethod& aConnectionMethod )
+    {
+    LOGGER_ENTERFN( "RCmManager::CopyConnectionMethodL" );
+
+    CCmDestinationImpl* aImplementation = 
+            CCmDestinationImpl::NewLC(aTargetDestination.iDestinatonData);
+    // Deleting aImplementation will decrement the ref counter
+    aImplementation->IncrementRefCounter();
+    CCmPluginBase* connMethod = new (ELeave) 
+                            CCmPluginBase(aConnectionMethod.iImplementation);
+    connMethod->IncrementRefCounter();    
+    CleanupStack::PushL( connMethod );        
+    TInt retVal = iImplementation->CopyConnectionMethodL( 
+                                           *aImplementation, 
+                                           *connMethod );
+    CleanupStack::PopAndDestroy(connMethod);
+    CleanupStack::PopAndDestroy(aImplementation);
+    return retVal;
+    }
+
+//-----------------------------------------------------------------------------
+// RCmManager::MoveConnMethodL()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C TInt RCmManager::MoveConnectionMethodL( 
+    RCmDestination& aSourceDestination,
+    RCmDestination& aTargetDestination,
+    RCmConnectionMethod& aConnectionMethod )
+    {
+    LOGGER_ENTERFN( "RCmManager::MoveConnectionMethodL" );
+
+    CCmDestinationImpl* aSourceImpl = 
+            CCmDestinationImpl::NewLC(aSourceDestination.iDestinatonData);
+    aSourceImpl->IncrementRefCounter();
+    CCmDestinationImpl* aTargetImpl = 
+            CCmDestinationImpl::NewLC(aTargetDestination.iDestinatonData);
+    aTargetImpl->IncrementRefCounter();
+    CCmPluginBase* connMethod = new (ELeave) 
+                            CCmPluginBase(aConnectionMethod.iImplementation);
+    connMethod->IncrementRefCounter();    
+    CleanupStack::PushL( connMethod );        
+    TInt retVal = iImplementation->MoveConnectionMethodL( 
+                    *aSourceImpl, 
+                    *aTargetImpl, 
+                    *connMethod );
+    CleanupStack::PopAndDestroy(connMethod);
+    CleanupStack::PopAndDestroy(aTargetImpl);
+    CleanupStack::PopAndDestroy(aSourceImpl);
+    return retVal;
+    }
+
+//-----------------------------------------------------------------------------
+// RCmManager::RemoveConnectionMethodL()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C void RCmManager::RemoveConnectionMethodL( 
+    RCmDestination& aDestination,
+    RCmConnectionMethod& aConnectionMethod )
+    {
+    LOGGER_ENTERFN( "RCmManager::RemoveConnectionMethodL" );
+
+    CCmDestinationImpl* aDestImpl = 
+            CCmDestinationImpl::NewLC(aDestination.iDestinatonData);
+    aDestImpl->IncrementRefCounter();
+    CCmPluginBase* connMethod = new (ELeave) 
+                            CCmPluginBase(aConnectionMethod.iImplementation);
+    connMethod->IncrementRefCounter();    
+    CleanupStack::PushL( connMethod );        
+
+    iImplementation->RemoveConnectionMethodL( *aDestImpl, *connMethod );
+
+    CleanupStack::PopAndDestroy(connMethod);
+    CleanupStack::PopAndDestroy(aDestImpl);
+    }
+
+//-----------------------------------------------------------------------------
+// RCmManager::RemoveAllReferencesL()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C void RCmManager::RemoveAllReferencesL( 
+    RCmConnectionMethod& aConnectionMethod )
+    {
+    LOGGER_ENTERFN( "RCmManager::RemoveAllReferencesL" );
+
+    iImplementation->RemoveAllReferencesL( *aConnectionMethod.iImplementation );
+    }
+
+//-----------------------------------------------------------------------------
+//  RCmManager::ConnectionMethodL()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C void RCmManager::ConnectionMethodL( RArray<TUint32>& aCMArray,
+                                             TBool aCheckBearerType,
+                                             TBool aLegacyOnly,
+                                             TBool aEasyWlan ) const
+    {
+    LOGGER_ENTERFN( "RCmManager::ConnectionMethodL" );
+
+    return iImplementation->ConnectionMethodL( aCMArray, 
+                                               aCheckBearerType, 
+                                               aLegacyOnly,
+                                               aEasyWlan );
+    }
+
+//-----------------------------------------------------------------------------
+//  RCmManager::AllDestinationsL()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C void RCmManager::AllDestinationsL( RArray<TUint32>& aDestArray ) const
+    {
+    LOGGER_ENTERFN( "RCmManager::AllDestinationsL" );
+
+    return iImplementation->AllDestinationsL( aDestArray );
+    }
+
+
+//-----------------------------------------------------------------------------
+//  RCmManager::DestinationL()
+//-----------------------------------------------------------------------------
+//  
+EXPORT_C RCmDestination RCmManager::DestinationL( TUint32 aId ) const
+    {
+    LOGGER_ENTERFN( "RCmManager::DestinationL" );
+
+    RCmDestination dest;
+    
+    CCmDestinationImpl* aDestImpl = iImplementation->DestinationL( aId );
+    dest.iDestinatonData = aDestImpl->GetData( );
+    dest.iDestinatonData->IncrementRefCounter();
+    delete aDestImpl;
+    
+    return dest;
+    }
+
+//-----------------------------------------------------------------------------
+//  RCmManager::BearerPriorityArrayL()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C void RCmManager::BearerPriorityArrayL( 
+                                        RArray<TBearerPriority>& aArray ) const
+    {
+    LOGGER_ENTERFN( "RCmManager::BearerPriorityArray" );
+
+    iImplementation->BearerPriorityArrayL( aArray ); 
+    }
+
+//-----------------------------------------------------------------------------
+//  RCmManager::UpdateBearerPriorityArrayL()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C void RCmManager::UpdateBearerPriorityArrayL( 
+    const RArray<TBearerPriority>& aArray )
+    {
+    LOGGER_ENTERFN( "RCmManager::UpdateBearerPriorityArray" );    
+
+    iImplementation->UpdateBearerPriorityArrayL( aArray );
+    }
+
+//-----------------------------------------------------------------------------
+//  RCmManager::CleanupGlobalPriorityArray()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C void RCmManager::CleanupGlobalPriorityArray( 
+    RArray<TBearerPriority>& aArray ) const
+    {
+    LOGGER_ENTERFN( "RCmManager::CleanupGlobalPriorityArray" );
+
+    iImplementation->CleanupGlobalPriorityArray( aArray ); 
+    }
+
+//-----------------------------------------------------------------------------
+//  RCmManager::SupportedBearers()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C void RCmManager::SupportedBearersL( RArray<TUint32>& aArray ) const
+    {
+    LOGGER_ENTERFN( "RCmManager::SupportedBearersL" );
+
+    return iImplementation->SupportedBearersL( aArray );        
+    }
+
+//-----------------------------------------------------------------------------
+//  RCmManagerExt::UncategorizedIconL()
+//-----------------------------------------------------------------------------
+//    
+EXPORT_C CGulIcon* RCmManager::UncategorizedIconL() const
+    {
+    LOGGER_ENTERFN( "RCmManager::UncategorizedIconL" );
+
+    return iImplementation->UncategorizedIconL();        
+    }
+
+//-----------------------------------------------------------------------------
+//  RCmManager::EasyWlanIdL()
+//-----------------------------------------------------------------------------
+//    
+EXPORT_C TUint32 RCmManager::EasyWlanIdL() const
+    {
+    LOGGER_ENTERFN( "RCmManager::EasyWlanIdL" );
+
+    return iImplementation->EasyWlanIdL();        
+    }
+    
+//-----------------------------------------------------------------------------
+//  RCmManagerExt::ReadDefConnL()
+//-----------------------------------------------------------------------------
+//    
+EXPORT_C void RCmManager::ReadDefConnL( TCmDefConnValue& aDCSetting )
+    {
+    LOGGER_ENTERFN( "RCmManager::ReadDefConnL" );
+
+    return iImplementation->ReadDefConnL( aDCSetting );        
+    }
+    
+//-----------------------------------------------------------------------------
+//  RCmManager::WriteDefConnL()
+//-----------------------------------------------------------------------------
+//    
+EXPORT_C void RCmManager::WriteDefConnL( const  TCmDefConnValue& aDCSetting )
+    {
+    LOGGER_ENTERFN( "RCmManager::WriteDefConnL" );
+
+    return iImplementation->WriteDefConnL( aDCSetting );        
+    }
+
+//-----------------------------------------------------------------------------
+//  RCmManager::ReadGenConnSettingsL()
+//-----------------------------------------------------------------------------
+//  
+EXPORT_C void RCmManager::ReadGenConnSettingsL( TCmGenConnSettings& aGenConnSettings )
+{
+    LOGGER_ENTERFN( "RCmManager::ReadGenConnSettingsL" );
+
+    return iImplementation->ReadGenConnSettingsL( aGenConnSettings ); 
+}
+
+//-----------------------------------------------------------------------------
+//  RCmManager::WriteGenConnSettingsL()
+//-----------------------------------------------------------------------------
+//  
+EXPORT_C void RCmManager::WriteGenConnSettingsL( const TCmGenConnSettings& aGenConnSettings )
+{
+    LOGGER_ENTERFN( "RCmManager::WriteGenConnSettingsL" );
+
+    return iImplementation->WriteGenConnSettingsL( aGenConnSettings ); 
+}
+
+//-----------------------------------------------------------------------------
+//  RCmManager::CreateDestinationL( const TDesC& aName,
+//                                     TUint32 aDestId )
+//-----------------------------------------------------------------------------
+//
+EXPORT_C RCmDestination RCmManager::CreateDestinationL(
+    const TDesC& aName,
+    TUint32 aDestId )
+    {
+    LOGGER_ENTERFN( "RCmManager::CreateDestinationL" );
+
+    if ( aDestId == 0 )
+        {
+        return CreateDestinationL( aName );
+        }
+
+    // Check if there already exists a destination with the same Id
+    RArray<TUint32> destIdArray = RArray<TUint32>( KCmArrayBigGranularity );
+    iImplementation->AllDestinationsL( destIdArray );
+    for ( TInt i = 0; i < destIdArray.Count(); i++ )
+        {
+        if ( aDestId > 0 && aDestId < 255 )
+            {
+            aDestId = aDestId + KCmDefaultDestinationAPTagId;
+            }
+        else if ( aDestId < KCmDefaultDestinationAPTagId+1 
+                  && ( aDestId > ( KCmDefaultDestinationAPTagId+255 ) ) )
+            {
+            User::Leave( KErrArgument );
+            }
+        if ( aDestId == destIdArray[i] )
+            {
+            destIdArray.Close();
+            User::Leave( KErrAlreadyExists );
+            }
+        }
+    destIdArray.Close();
+
+    RCmDestination dest;
+
+    CCmDestinationImpl* destImp =
+                        iImplementation->CreateDestinationL( aName,
+                                                             aDestId );
+    dest.iDestinatonData = destImp->GetData();
+    dest.iDestinatonData->IncrementRefCounter();
+    delete destImp;
+
+    return dest;
+    }
+
+// -----------------------------------------------------------------------------
+// RCmManager::CreateConnectionMethodL()
+// -----------------------------------------------------------------------------
+//  
+EXPORT_C RCmConnectionMethod RCmManager::CreateConnectionMethodL(
+    TUint32 aImplementationUid,
+    TUint32 aConnMethodId )
+    {
+    LOGGER_ENTERFN( "RCmManager::CreateConnectionMethodL" );
+
+    if ( aConnMethodId == 0 )
+        {
+        return CreateConnectionMethodL( aImplementationUid );
+        }
+
+    RCmConnectionMethod cm;
+
+    CCmPluginBase* cM =
+                   iImplementation->CreateConnectionMethodL( aImplementationUid,
+                                                             aConnMethodId );
+    cm.iImplementation = cM->Plugin();
+    cm.iImplementation->IncrementRefCounter();
+    delete cM;
+
+    return cm;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Src/cmmanagerext.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,503 @@
+/*
+* 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 RCmManagerExt
+*
+*/
+
+#include <cmmanagerext.h>
+#include <cmpluginbaseeng.h>
+#include <cmpluginbase.h>
+#include <cmdestinationext.h>
+#include "cmlogger.h"
+#include "cmmanager.hrh"
+#include <cmcommonconstants.h>
+#include "cmmanagerimpl.h"
+#include "cmdestinationimpl.h"
+#include "cmmanager.hrh"
+#include <data_caging_path_literals.hrh>
+
+#include <StringLoader.h>
+#include <e32cmn.h>
+#include <cmmanager.rsg>    // resource
+
+//-----------------------------------------------------------------------------
+//  RCmManagerExt::~RCmManagerExt()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C void RCmManagerExt::Close()
+    {
+    CLOG_WRITE( "RCmManagerExt::Close()" );
+    delete iImplementation;
+    iImplementation = NULL;
+    
+    CLOG_CLOSE;
+    }
+
+//-----------------------------------------------------------------------------
+//  RCmManagerExt::ConstructL()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C void RCmManagerExt::OpenL()
+    {
+    CLOG_CREATE;
+    CLOG_NAME_1( _L("ManagerExt_0x%x"), this );
+    iImplementation = CCmManagerImpl::NewL(EFalse);
+    CLOG_ATTACH( iImplementation, this );
+    }
+
+//-----------------------------------------------------------------------------
+//  RCmManagerExt::ConstructL()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C void RCmManagerExt::CreateTablesAndOpenL()
+    {
+    CLOG_CREATE;
+    CLOG_NAME_1( _L("ManagerExt_0x%x"), this );
+    iImplementation = CCmManagerImpl::NewL();
+    CLOG_ATTACH( iImplementation, this );
+    }
+    
+//-----------------------------------------------------------------------------
+//  RCmManagerExt::OpenLC()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C void RCmManagerExt::OpenLC()
+    {
+    CLOG_CREATE;
+    CLOG_NAME_1( _L("Manager_0x%x"), this );
+    CleanupClosePushL(*this);
+    iImplementation = NULL;
+    iImplementation = CCmManagerImpl::NewL();
+    CLOG_ATTACH( iImplementation, this );
+    }
+
+//-----------------------------------------------------------------------------
+//  RCmManagerExt::GetBearerInfoIntL()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C TUint32 RCmManagerExt::GetBearerInfoIntL( TUint32 aBearerType,
+                                                   TUint32 aAttribute ) const
+    {
+    return iImplementation->GetBearerInfoIntL( aBearerType,
+                                                       aAttribute );
+    }
+
+//-----------------------------------------------------------------------------
+//  RCmManagerExt::GetBearerInfoBoolL()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C TBool RCmManagerExt::GetBearerInfoBoolL( TUint32 aBearerType,
+                                                  TUint32 aAttribute ) const
+    {
+    return iImplementation->GetBearerInfoBoolL( aBearerType,
+                                                       aAttribute );
+    }
+
+//-----------------------------------------------------------------------------
+//  RCmManagerExt::GetBearerInfoStringL()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C HBufC* RCmManagerExt::GetBearerInfoStringL( TUint32 aBearerType,
+                                                     TUint32 aAttribute ) const
+    {
+    return iImplementation->GetBearerInfoStringL( aBearerType,
+                                                       aAttribute );
+    }
+
+//-----------------------------------------------------------------------------
+//  RCmManagerExt::GetBearerInfoString8L()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C HBufC8* 
+                RCmManagerExt::GetBearerInfoString8L( TUint32 aBearerType,
+                                                      TUint32 aAttribute ) const
+    {
+    return iImplementation->GetBearerInfoString8L( aBearerType,
+                                                   aAttribute );
+    }
+
+// -----------------------------------------------------------------------------
+// RCmManagerExt::GetConnectionMethodInfoIntL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TUint32 RCmManagerExt::GetConnectionMethodInfoIntL( TUint32 aIapId,
+                                     TUint32 aAttribute ) const
+    {
+    return iImplementation->GetConnectionMethodInfoIntL( aIapId, aAttribute );
+    }
+    
+// -----------------------------------------------------------------------------
+// RCmManagerExt::GetConnectionMethodInfoBoolL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool RCmManagerExt::GetConnectionMethodInfoBoolL( TUint32 aIapId,
+                                    TUint32 aAttribute ) const
+    {
+    return iImplementation->GetConnectionMethodInfoBoolL( aIapId, aAttribute );
+    }
+    
+// -----------------------------------------------------------------------------
+// RCmManagerExt::GetConnectionMethodInfoStringL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C HBufC* RCmManagerExt::GetConnectionMethodInfoStringL( TUint32 aIapId,
+                                       TUint32 aAttribute ) const
+    {
+    return iImplementation->GetConnectionMethodInfoStringL( aIapId, 
+                                                            aAttribute );
+    }
+    
+// -----------------------------------------------------------------------------
+// RCmManagerExt::GetConnectionMethodInfoStringL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C HBufC8* 
+    RCmManagerExt::GetConnectionMethodInfoString8L( TUint32 aIapId,
+                                                    TUint32 aAttribute ) const
+    {
+    return iImplementation->GetConnectionMethodInfoString8L( aIapId, aAttribute );
+    }
+    
+//=============================================================================
+// CREATION / DELETION API
+//=============================================================================
+//
+
+//-----------------------------------------------------------------------------
+//  RCmManagerExt::CreateDestinationL( const TDesC& aName )
+//-----------------------------------------------------------------------------
+//
+EXPORT_C 
+    RCmDestinationExt RCmManagerExt::CreateDestinationL( const TDesC& aName )
+    {
+    RCmDestinationExt dest;
+    
+    CCmDestinationImpl* destImp = iImplementation->CreateDestinationL( aName );
+    dest.iDestinatonData = destImp->GetData();
+    dest.iDestinatonData->IncrementRefCounter();
+    delete destImp;
+    
+    return dest;
+    }
+
+// -----------------------------------------------------------------------------
+// RCmManagerExt::CreateConnectionMethodL()
+// -----------------------------------------------------------------------------
+//  
+EXPORT_C RCmConnectionMethodExt 
+        RCmManagerExt::CreateConnectionMethodL( TUint32 aImplementationUid )
+    {
+    RCmConnectionMethodExt cm;
+        
+    CCmPluginBase* cM =  
+        iImplementation->CreateConnectionMethodL( aImplementationUid );
+    cm.iImplementation = cM->Plugin();
+    cm.iImplementation->IncrementRefCounter();
+    delete cM;
+
+    return cm;
+    }
+
+//-----------------------------------------------------------------------------
+// RCmManagerExt::CopyL()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C TInt RCmManagerExt::CopyConnectionMethodL( 
+                                      RCmDestinationExt& aTargetDestination,
+                                      RCmConnectionMethodExt& aConnectionMethod )
+    {
+    CCmDestinationImpl* aImplementation = 
+            CCmDestinationImpl::NewLC(aTargetDestination.iDestinatonData);
+    // Deleting aImplementation will decrement the ref counter
+    aImplementation->IncrementRefCounter();
+    CCmPluginBase* connMethod = new (ELeave) 
+                            CCmPluginBase(aConnectionMethod.iImplementation);
+    connMethod->IncrementRefCounter();    
+    CleanupStack::PushL( connMethod );        
+    TInt retVal = iImplementation->CopyConnectionMethodL( 
+                                           *aImplementation, 
+                                           *connMethod );
+    CleanupStack::PopAndDestroy(connMethod);
+    CleanupStack::PopAndDestroy(aImplementation);
+    return retVal;
+    }
+
+//-----------------------------------------------------------------------------
+// RCmManagerExt::MoveConnMethodL()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C TInt RCmManagerExt::MoveConnectionMethodL( 
+                                      RCmDestinationExt& aSourceDestination,
+                                      RCmDestinationExt& aTargetDestination,
+                                      RCmConnectionMethodExt& aConnectionMethod )
+    {
+    CCmDestinationImpl* aSourceImpl = 
+            CCmDestinationImpl::NewLC(aSourceDestination.iDestinatonData);
+    aSourceImpl->IncrementRefCounter();
+    CCmDestinationImpl* aTargetImpl = 
+            CCmDestinationImpl::NewLC(aTargetDestination.iDestinatonData);
+    aTargetImpl->IncrementRefCounter();
+    CCmPluginBase* connMethod = new (ELeave) 
+                            CCmPluginBase(aConnectionMethod.iImplementation);
+    connMethod->IncrementRefCounter();    
+    CleanupStack::PushL( connMethod );        
+    TInt retVal = iImplementation->MoveConnectionMethodL( 
+                    *aSourceImpl, 
+                    *aTargetImpl, 
+                    *connMethod );
+    CleanupStack::PopAndDestroy(connMethod);
+    CleanupStack::PopAndDestroy(aTargetImpl);
+    CleanupStack::PopAndDestroy(aSourceImpl);
+    return retVal;
+    }
+
+//-----------------------------------------------------------------------------
+// RCmManagerExt::RemoveConnectionMethodL()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C void RCmManagerExt::RemoveConnectionMethodL( 
+                                      RCmDestinationExt& aDestination,
+                                      RCmConnectionMethodExt& aConnectionMethod )
+    {
+    CCmDestinationImpl* aDestImpl = 
+            CCmDestinationImpl::NewLC(aDestination.iDestinatonData);
+    aDestImpl->IncrementRefCounter();
+    CCmPluginBase* connMethod = new (ELeave) 
+                            CCmPluginBase(aConnectionMethod.iImplementation);
+    connMethod->IncrementRefCounter();    
+    CleanupStack::PushL( connMethod );        
+    iImplementation->RemoveConnectionMethodL( 
+                    *aDestImpl, 
+                    *connMethod );
+    CleanupStack::PopAndDestroy(connMethod);
+    CleanupStack::PopAndDestroy(aDestImpl);
+    }
+
+//-----------------------------------------------------------------------------
+// RCmManagerExt::RemoveAllReferencesL()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C void RCmManagerExt::RemoveAllReferencesL( 
+                                    RCmConnectionMethodExt& aConnectionMethod )
+    {
+    iImplementation->RemoveAllReferencesL( *aConnectionMethod.iImplementation );
+    }
+
+//-----------------------------------------------------------------------------
+//  RCmManagerExt::ConnectionMethodExtL()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C RCmConnectionMethodExt 
+                              RCmManagerExt::ConnectionMethodL( TUint32 aIapId )
+    {
+    RCmConnectionMethodExt cm;
+    CCmPluginBase* cM =  iImplementation->GetConnectionMethodL( aIapId );
+    cm.iImplementation = cM->Plugin();
+    cm.iImplementation->IncrementRefCounter();
+    delete cM;
+        
+    return cm;
+    }
+
+//-----------------------------------------------------------------------------
+//  RCmManagerExt::ConnectionMethodL()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C void RCmManagerExt::ConnectionMethodL( RArray<TUint32>& aCMArray,
+                                                TBool aCheckBearerType,
+                                                TBool aLegacyOnly,
+                                                TBool aEasyWlan )
+    {
+    iImplementation->ConnectionMethodL( aCMArray, 
+                                               aCheckBearerType,
+                                               aLegacyOnly,
+                                               aEasyWlan );
+    }
+
+//-----------------------------------------------------------------------------
+//  RCmManagerExt::DestinationL()
+//-----------------------------------------------------------------------------
+//  
+EXPORT_C RCmDestinationExt RCmManagerExt::DestinationL( TUint32 aId )
+    {
+    RCmDestinationExt dest;
+    
+    CCmDestinationImpl* aDestImpl = iImplementation->DestinationL( aId );
+    dest.iDestinatonData = aDestImpl->GetData( );
+    dest.iDestinatonData->IncrementRefCounter();
+    delete aDestImpl;
+    
+    return dest;
+    }
+
+//-----------------------------------------------------------------------------
+//  RCmManagerExt::AllDestinationsL()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C void RCmManagerExt::AllDestinationsL( RArray<TUint32>& aDestArray )
+    {   
+    return iImplementation->AllDestinationsL( aDestArray );
+    }
+
+//-----------------------------------------------------------------------------
+//  RCmManagerExt::BearerPriorityArrayL()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C void RCmManagerExt::BearerPriorityArrayL( 
+                                        RArray<TBearerPriority>& aArray ) const
+    {
+    LOGGER_ENTERFN( "RCmManagerExt:BearerPriorityArray" );
+    iImplementation->BearerPriorityArrayL( aArray ); 
+    }
+
+//-----------------------------------------------------------------------------
+//  RCmManagerExt::UpdateBearerPriorityArrayL()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C void RCmManagerExt::UpdateBearerPriorityArrayL( 
+                                        const RArray<TBearerPriority>& aArray )
+    {
+    LOGGER_ENTERFN( "RCmManagerExt::UpdateBearerPriorityArray" );    
+    iImplementation->UpdateBearerPriorityArrayL( aArray );
+    }
+
+//-----------------------------------------------------------------------------
+//  RCmManagerExt::CleanupGlobalPriorityArray()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C void RCmManagerExt::CleanupGlobalPriorityArray( 
+                                        RArray<TBearerPriority>& aArray ) const
+    {
+    LOGGER_ENTERFN( "RCmManagerExt:CleanupGlobalPriorityArray" );
+    iImplementation->CleanupGlobalPriorityArray( aArray ); 
+    }
+
+//-----------------------------------------------------------------------------
+//  RCmManagerExt::SupportedBearers()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C void RCmManagerExt::SupportedBearersL( RArray<TUint32>& aArray ) const
+    {
+    return iImplementation->SupportedBearersL( aArray );        
+    }
+
+//-----------------------------------------------------------------------------
+//  RCmManagerExt::UncategorizedIconL()
+//-----------------------------------------------------------------------------
+//    
+EXPORT_C CGulIcon* RCmManagerExt::UncategorizedIconL() const
+    {
+    return iImplementation->UncategorizedIconL();        
+    }
+
+//-----------------------------------------------------------------------------
+//  RCmManagerExt::EasyWlanIdL()
+//-----------------------------------------------------------------------------
+//    
+EXPORT_C TUint32 RCmManagerExt::EasyWlanIdL()
+    {
+    return iImplementation->EasyWlanIdL();        
+    }
+    
+//-----------------------------------------------------------------------------
+//  RCmManagerExt::ReadDefConnL()
+//-----------------------------------------------------------------------------
+//    
+EXPORT_C void RCmManagerExt::ReadDefConnL( TCmDefConnValue& aDCSetting )
+    {
+    return iImplementation->ReadDefConnL( aDCSetting );        
+    }
+    
+//-----------------------------------------------------------------------------
+//  RCmManagerExt::WriteDefConnL()
+//-----------------------------------------------------------------------------
+//    
+EXPORT_C void RCmManagerExt::WriteDefConnL( const  TCmDefConnValue& aDCSetting )
+    {
+    return iImplementation->WriteDefConnL( aDCSetting );        
+    }
+
+ 
+//-----------------------------------------------------------------------------
+//  RCmManagerExt::CreateDestinationL( const TDesC& aName,
+//                                     TUint32 aDestId )
+//-----------------------------------------------------------------------------
+//
+EXPORT_C RCmDestinationExt RCmManagerExt::CreateDestinationL(
+    const TDesC& aName,
+    TUint32 aDestId )
+    {
+    if ( aDestId == 0 )
+        {
+        return CreateDestinationL( aName );
+        }
+
+    // Check if there already exists a destination with the same Id
+    RArray<TUint32> destIdArray = RArray<TUint32>( KCmArrayBigGranularity );
+    iImplementation->AllDestinationsL( destIdArray );
+    for ( TInt i = 0; i < destIdArray.Count(); i++ )
+        {
+        if ( aDestId > 0 && aDestId < 255 )
+            {
+            aDestId = aDestId + KCmDefaultDestinationAPTagId;
+            }
+        else if ( aDestId < KCmDefaultDestinationAPTagId+1 
+                  && ( aDestId > ( KCmDefaultDestinationAPTagId+255 ) ) )
+            {
+            User::Leave( KErrArgument );
+            }
+        if ( aDestId == destIdArray[i] )
+            {
+            destIdArray.Close();
+            User::Leave( KErrAlreadyExists );
+            }
+        }
+    destIdArray.Close();
+
+    RCmDestinationExt dest;
+
+    CCmDestinationImpl* destImp =
+                        iImplementation->CreateDestinationL( aName,
+                                                             aDestId );
+    dest.iDestinatonData = destImp->GetData();
+    dest.iDestinatonData->IncrementRefCounter();
+    delete destImp;
+
+    return dest;
+    }
+
+// -----------------------------------------------------------------------------
+// RCmManagerExt::CreateConnectionMethodL()
+// -----------------------------------------------------------------------------
+//  
+EXPORT_C RCmConnectionMethodExt RCmManagerExt::CreateConnectionMethodL(
+    TUint32 aImplementationUid,
+    TUint32 aConnMethodId )
+    {
+    if ( aConnMethodId == 0 )
+        {
+        return CreateConnectionMethodL( aImplementationUid );
+        }
+
+    RCmConnectionMethodExt cm;
+
+    CCmPluginBase* cM =
+                   iImplementation->CreateConnectionMethodL( aImplementationUid,
+                                                             aConnMethodId );
+    cm.iImplementation = cM->Plugin();
+    cm.iImplementation->IncrementRefCounter();
+    delete cM;
+
+    return cm;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Src/cmmanagerimpl.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,2982 @@
+/*
+* 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 CCmManagerImpl.
+*
+*/
+
+#include "cmmanagerimpl.h"
+#include <cmpluginbaseeng.h>
+#include <cmpluginbase.h>
+#include <cmdestination.h>
+#include <cmdestinationext.h>
+#include "cmdestinationimpl.h"
+#include "cmtransactionhandler.h"
+#include "cmlogger.h"
+#include "cmmanager.hrh"
+#include <cmcommonconstants.h>
+#include <cmmanagerext.h>
+#include <cmpluginembdestinationdef.h>
+#include "cmobjectpool.h"
+#include "cmcommsdatnotifier.h"
+
+#include <sysutil.h>
+#include <featmgr.h>
+#include <wlancontainer.h>  // CCDWlanServiceRecord
+#include <StringLoader.h>
+#include <commsdattypesv1_1.h>
+#include <e32cmn.h>
+#include <bautils.h>        // BaflUtils
+#include <cmmanager.rsg>    // resource
+#include <data_caging_path_literals.hrh>
+#include <ecom/ecom.h>        // For REComSession
+#include <cmmanagerext.h> 
+
+#include <cmmanager.mbg>   // icons
+#include <AknsUtils.h>
+
+#include <commsdattypesv1_1.h>
+#include <rconnmon.h>
+
+using namespace CMManager;
+using namespace CommsDat;
+
+// CONSTANTS
+
+const TInt KResFileGranularity = 5;
+const TInt KPluginGranularity = 3;
+// if a CmId is grater than KMaxIapId, than it has no iap record
+// Otherwise cmId is the same as the IapId
+const TUint32 KMaxIapID = 255;
+// Safety margin when checking disk space
+const TUint32 KBytesToWrite = 8000; 
+
+// -----------------------------------------------------------------------------
+// Test functions
+// -----------------------------------------------------------------------------
+//
+/*#ifdef _DEBUG
+void DumIapTableL( CMDBSession& aSession )
+    {
+    CMDBRecordSet<CCDIAPRecord>*  ptrRecordSet = 
+                    new (ELeave) CMDBRecordSet<CCDIAPRecord>( KCDTIdIAPRecord );
+    CleanupStack::PushL( ptrRecordSet );
+    
+    TRAP_IGNORE( ptrRecordSet->LoadL( aSession ) );
+    
+    TInt iapRecords = ptrRecordSet->iRecords.Count();
+    CLOG_WRITE_1_PTR( NULL, "Dumping IAP Table\nNo. of IAPs: [%d]", iapRecords );
+    for ( TInt i = 0; i < iapRecords; i++ )
+        {
+        CCDIAPRecord* iapRecord = (*ptrRecordSet)[i];
+
+        CLOG_WRITE_4_PTR( NULL, "Rec id:[%d] - Name: [%S] - Service Type: [%S] - Bearer Type: [%S]",
+                                iapRecord->RecordId(),
+                                &FIELD_TO_TDESC( iapRecord->iRecordName ),
+                                &FIELD_TO_TDESC( iapRecord->iServiceType ),
+                                &FIELD_TO_TDESC( iapRecord->iBearerType )
+                                );
+        }
+
+    CleanupStack::PopAndDestroy( ptrRecordSet );
+    }
+#endif */ // _DEBUG
+
+//=============================================================================
+// CONSTRUCTION / DESTRUCTION API
+//=============================================================================
+//
+
+//-----------------------------------------------------------------------------
+//  CCmManagerImpl::NewL()
+//-----------------------------------------------------------------------------
+//
+CCmManagerImpl* CCmManagerImpl::NewL( TBool aCreateTables )
+    {
+    CCmManagerImpl* self = new (ELeave) CCmManagerImpl();
+    CleanupStack::PushL( self );
+    self->iCreateTables = aCreateTables;
+    self->ConstructL();
+    CleanupStack::Pop( self );   // self
+    
+    return self;
+    }
+
+//-----------------------------------------------------------------------------
+//  CCmManagerImpl::CCmManagerImpl()
+//-----------------------------------------------------------------------------
+//
+CCmManagerImpl::CCmManagerImpl()
+:iDefConnSupported(EFalse),iCreateTables(ETrue)
+    {
+    CLOG_CREATE;
+
+    Dll::SetTls( this );
+    }
+
+//-----------------------------------------------------------------------------
+//  CCmManagerImpl::CCmManagerImpl()
+//-----------------------------------------------------------------------------
+//
+CCmManagerImpl::~CCmManagerImpl()
+    {
+    CLOG_WRITE( "CCmManagerImpl::~CCmManagerImpl" );
+    
+    if ( iBearerPriorityArray )
+        {
+        CleanupGlobalPriorityArray( *iBearerPriorityArray );
+        delete iBearerPriorityArray;
+        }
+
+    if ( iPlugins )
+        {
+        iPlugins->ResetAndDestroy();
+        delete iPlugins;
+        }
+    
+    
+    if ( iResourceFiles )
+        {
+        TInt resCount = iResourceFiles->Count();
+        for ( TInt i = 0; i < resCount; ++i )
+            {
+            // close the resource file
+            (*iResourceFiles)[0]->iFile.Close();
+            // delete the structure
+            delete (*iResourceFiles)[0];
+            // delete array item
+            iResourceFiles->Delete( 0 );
+            }
+            
+        iResourceFiles->Reset();        
+        delete iResourceFiles;
+        }
+    
+    iFs.Close();
+    
+    delete iPluginImpl;
+
+    delete &Session();
+    delete iTrans;
+
+    if( iIsFeatureManagerInitialised )
+        {
+        FeatureManager::UnInitializeLib();
+        }
+
+    REComSession::FinalClose();
+    
+    delete iObjectPool;
+    
+    delete iCommsDatIapNotifier;
+    delete iCommsDatSnapNotifier;
+
+    CLOG_CLOSE;
+    }
+
+      
+// -----------------------------------------------------------------------------
+// CCmManagerImpl::CheckTablesL()
+// -----------------------------------------------------------------------------
+//     
+void CCmManagerImpl::CheckTablesL()
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::CheckDestinationNetworkTableL" );
+    
+    TInt err( 0 );
+
+    CLOG_WRITE( "Destination network" );
+    if (iCreateTables)
+        {
+        TRAP( err, iDestinationTableId = 
+                        CCDDataMobilitySelectionPolicyRecord::TableIdL( Session() ));
+        CLOG_WRITE_1( "err: [%d]", err );
+        if( err == KErrNotFound )
+            {
+            iDestinationTableId = 
+                       CCDDataMobilitySelectionPolicyRecord::CreateTableL( Session() );
+            }
+        else
+            {
+            User::LeaveIfError( err );
+            }        
+        }
+    else
+        {
+        iDestinationTableId = 
+                        CCDDataMobilitySelectionPolicyRecord::TableIdL( Session() );        
+        }
+        
+    CLOG_WRITE( "Global Bearer Type Priorization Table" );
+    TRAP( err, iBearerTypePriorizationTableId = 
+                CCDGlobalBearerTypePriorizationRecord::TableIdL( Session() ) );
+    CLOG_WRITE_1( "err: [%d]", err );
+    if( err == KErrNotFound )
+        {
+        iBearerTypePriorizationTableId = 
+               CCDGlobalBearerTypePriorizationRecord::CreateTableL( Session() );
+        }
+    else
+        {
+        User::LeaveIfError( err );
+        }
+    
+    CLOG_WRITE( "Destination network - Icon table" );        
+    TRAP( err, iIconTableId = CCDSNAPMetadataRecord::TableIdL( Session() ) );
+    if( err == KErrNotFound )
+        {
+        iIconTableId = CCDSNAPMetadataRecord::CreateTableL( Session() );
+        }
+    else
+        {
+        User::LeaveIfError( err );
+        }
+        
+    CLOG_WRITE( "Seamlessness table" );
+    TRAP( err, iSeamlessnessTableId = CCDIAPMetadataRecord::TableIdL( Session() ) );
+    CLOG_WRITE_1( "err: [%d]", err );
+    if( err == KErrNotFound )
+        {
+        iSeamlessnessTableId = CCDIAPMetadataRecord::CreateTableL( Session() );
+        }
+    else
+        {
+        User::LeaveIfError( err );
+        }
+    if ( IsDefConnSupported() )
+        {
+        CLOG_WRITE( "Default connection table" );
+        TRAP( err, iDefConnTableId = CCDDefConnRecord::TableIdL( Session() ) );
+        CLOG_WRITE_1( "err: [%d]", err );
+        if( err == KErrNotFound )
+            {
+            iDefConnTableId = CCDDefConnRecord::CreateTableL( Session() );
+            }
+        else
+            {
+            User::LeaveIfError( err );
+            }   
+        }
+    }
+     
+//-----------------------------------------------------------------------------
+//  CCmManagerImpl::CreateBearerPriorityArrayL()
+//-----------------------------------------------------------------------------
+//
+void CCmManagerImpl::CreateBearerPriorityArrayL()
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl:CreateBearerPriorityArray" );
+
+    iBearerPriorityArray = 
+                new ( ELeave ) RArray<TBearerPriority>( KCmArrayBigGranularity );
+
+    CMDBRecordSet<CCmBearerPriRec>* bpRS = 
+                new (ELeave) CMDBRecordSet<CCmBearerPriRec>( 
+                                               iBearerTypePriorizationTableId );
+    CleanupStack::PushL( bpRS );
+        
+    OpenTransactionLC();        
+    TRAP_IGNORE( bpRS->LoadL( Session() ) );
+    RollbackTransaction();
+    
+    TInt bpCount = bpRS->iRecords.Count();
+    TInt i( 0 );
+    
+    while ( i < bpCount ) // loop the Bearer Priority table
+        {
+        // Bearer Priority record ID
+        HBufC* bpServiceType = QUERY_HBUFC_FIELD( (*bpRS)[i], 
+                                                  KCDTIdGlobalServiceType );
+        
+        TInt bpPriority = ( QUERY_INT_FIELD( (*bpRS)[i], 
+                                             KCDTIdGlobalServicePriority ) );
+        TInt uiPriority = ( QUERY_INT_FIELD( (*bpRS)[i], 
+                                             KCDTIdGlobalServiceUIPriority ) );                                    
+        CLOG_WRITE( "Bearer Priority Table Values" );
+        CLOG_WRITE_1( "Service Type: [%S]", bpServiceType );
+        CLOG_WRITE_1( "Bearer Priority: [%d]", bpPriority );
+        CLOG_WRITE_1( "UI Priority: [%d]", uiPriority );                          
+        TBearerPriority bp;
+        bp.iServiceType = bpServiceType->AllocL();
+        bp.iPriority = bpPriority;
+        bp.iUIPriority = uiPriority;
+        iBearerPriorityArray->AppendL( bp );
+        i++;
+        }
+    
+    CleanupStack::PopAndDestroy( bpRS );
+    }
+
+//-----------------------------------------------------------------------------
+//  CCmManagerImpl::BearerPriorityArrayL()
+//-----------------------------------------------------------------------------
+//
+void CCmManagerImpl::BearerPriorityArrayL( RArray<TBearerPriority>& aArray ) const
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl:BearerPriorityArray" );
+    TRAPD( err, CopyBearerPriorityArrayL( aArray ) );
+    if( err )
+        // in case of any problem we clean up this array
+        {
+        User::Leave( err );
+        }
+    }
+
+//-----------------------------------------------------------------------------
+//  CCmManagerImpl::CopyBearerPriorityArrayL()
+//-----------------------------------------------------------------------------
+//
+void CCmManagerImpl::CopyBearerPriorityArrayL( 
+                                        RArray<TBearerPriority>& aArray ) const
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl:BearerPriorityArray" );
+    for ( TInt i = 0; i < iBearerPriorityArray->Count(); i++ )
+        {
+        TBearerPriority item;
+        
+        TBearerPriority* orgItem = &(*iBearerPriorityArray)[i];
+        
+        item.iServiceType = HBufC::NewLC( orgItem->iServiceType->Length() );
+        item.iServiceType->Des().Copy( *orgItem->iServiceType );
+        item.iPriority = orgItem->iPriority;
+        item.iUIPriority = orgItem->iUIPriority;
+                          
+        User::LeaveIfError( aArray.Append( item ) );
+        
+        CleanupStack::Pop(); // item->iServiceType
+        }
+    }
+
+//-----------------------------------------------------------------------------
+//  CCmManagerImpl::UpdateBearerPriorityArrayL()
+//-----------------------------------------------------------------------------
+//
+void CCmManagerImpl::UpdateBearerPriorityArrayL( 
+                                        const RArray<TBearerPriority>& aArray )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::UpdateBearerPriorityArray" );    
+    
+    OpenTransactionLC();
+
+    CMDBRecordSet<CCmBearerPriRec>* bpRS = new (ELeave) 
+            CMDBRecordSet<CCmBearerPriRec>( iBearerTypePriorizationTableId );
+    CleanupStack::PushL( bpRS ); // 1
+    TRAP_IGNORE( bpRS->LoadL( Session() ) );
+    
+    // Delete the old record
+    for ( TInt i = 0; i < bpRS->iRecords.Count(); ++i )
+        {
+        bpRS->iRecords[i]->DeleteL( Session() );
+        }
+    
+    CleanupGlobalPriorityArray( *iBearerPriorityArray );
+            
+    CleanupStack::PopAndDestroy( bpRS );
+    bpRS = NULL;
+    
+    // Add the new content
+    CCmBearerPriRec* bpRcd = 
+            new (ELeave) CCmBearerPriRec( iBearerTypePriorizationTableId );
+    CleanupStack::PushL( bpRcd ); // 2
+
+    CLOG_WRITE( "Store bearer info to table" );
+    for ( TInt i = 0; i < aArray.Count(); ++i )
+        {        
+        bpRcd->SetRecordId( KCDNewRecordRequest );
+        
+        HBufC* serviceTypeVal = aArray[i].iServiceType;
+        TInt priorityVal = aArray[i].iPriority;
+        TInt uiPriorityVal = aArray[i].iUIPriority;
+        
+        CLOG_WRITE_FORMAT( "Set service type: [%S   ]", serviceTypeVal );
+        SET_HBUFC_FIELD(    bpRcd, 
+                            KCDTIdGlobalServiceType, 
+                            serviceTypeVal );
+        CLOG_WRITE_1( "Set priority: [%d]", priorityVal );
+        SET_INT_FIELD(  bpRcd, 
+                        KCDTIdGlobalServicePriority, 
+                        priorityVal );
+        CLOG_WRITE_1( "Set uipriority: [%d]", uiPriorityVal );
+        SET_INT_FIELD(  bpRcd, 
+                        KCDTIdGlobalServiceUIPriority, 
+                        uiPriorityVal );                        
+        bpRcd->StoreL( Session() );
+        
+        TBearerPriority item;
+        
+        item.iServiceType = serviceTypeVal->AllocLC();
+        item.iPriority = priorityVal;
+        item.iUIPriority = uiPriorityVal;
+        iBearerPriorityArray->AppendL( item );
+        CleanupStack::Pop( item.iServiceType );
+        }
+
+    CleanupStack::PopAndDestroy( bpRcd );
+
+    CommitTransactionL( KErrNone );
+    }
+    
+//-----------------------------------------------------------------------------
+//  CCmManagerImpl::GlobalBearerPriority()
+//-----------------------------------------------------------------------------
+//
+TInt CCmManagerImpl::GlobalBearerPriority( TBool aUiPriority, 
+                                           const TDesC& aServiceType ) const
+    {
+    for ( TInt i = 0; i < iBearerPriorityArray->Count(); ++i )
+        {
+        if ( !aServiceType.CompareF( *(*iBearerPriorityArray)[i].iServiceType ) )
+            {
+            if( aUiPriority )
+                {
+                return (*iBearerPriorityArray)[i].iUIPriority;
+                }
+            else
+                {
+                return (*iBearerPriorityArray)[i].iPriority;
+                }
+            }
+        }
+        
+    return KDataMobilitySelectionPolicyPriorityWildCard;
+    }
+
+//-----------------------------------------------------------------------------
+//  CCmManagerImpl::CleanupGlobalPriorityArray()
+//-----------------------------------------------------------------------------
+//
+void CCmManagerImpl::CleanupGlobalPriorityArray(
+                                        RArray<TBearerPriority>& aArray ) const
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::CleanupGlobalPriorityArray" );
+
+    for ( TInt i = 0; i < aArray.Count(); ++i )
+        {
+        delete aArray[i].iServiceType;
+        }
+        
+    aArray.Reset();
+    aArray.Close();
+    }
+    
+//-----------------------------------------------------------------------------
+//  CCmManagerImpl::AddResourceFileL()
+//-----------------------------------------------------------------------------
+//
+void CCmManagerImpl::AddResourceFileL( TFileName& aName )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::AddResourceFileL" );
+    
+    TInt index = FindResourceFile( aName );
+    
+    if ( index != KErrNotFound )
+        {
+        ++(*iResourceFiles)[index]->iRefs;
+        return;
+        }
+        
+    TResourceFiles* newRes = new (ELeave) TResourceFiles;
+    CleanupStack::PushL( newRes );
+
+    RResourceFile resFile;
+    resFile.OpenL( iFs, aName );
+    CleanupClosePushL( resFile );
+    
+    resFile.ConfirmSignatureL(0); 
+    
+    newRes->iFile = resFile;
+    newRes->iFName.Copy( aName );
+    newRes->iRefs = 1;  // 1 reference to this resource file
+    
+    iResourceFiles->AppendL( newRes );
+    
+    CleanupStack::Pop( 2 ); // resFile, newRes
+    }
+
+//-----------------------------------------------------------------------------
+//  CCmManagerImpl::RemoveResourceFile()
+//-----------------------------------------------------------------------------
+//
+void CCmManagerImpl::RemoveResourceFile( TFileName& aName )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::RemoveResourceFile" );
+
+    TInt index = FindResourceFile( aName );
+    
+    if ( index == KErrNotFound )
+        {
+        return;
+        }
+        
+    if ( !--(*iResourceFiles)[index]->iRefs )
+        // it was the last reference
+        {
+        (*iResourceFiles)[index]->iFile.Close();
+        delete (*iResourceFiles)[index];
+        
+        iResourceFiles->Delete( index );
+        }
+    }
+
+//-----------------------------------------------------------------------------
+//  CCmManagerImpl::FindResourceFile()
+//-----------------------------------------------------------------------------
+//
+TInt CCmManagerImpl::FindResourceFile( TFileName& aName ) const
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::FindResourceFile" );
+
+    BaflUtils::NearestLanguageFile( iFs, aName );
+    
+    for ( TInt i = 0; i < iResourceFiles->Count(); ++i )
+        {
+        if ( !(*iResourceFiles)[i]->iFName.CompareF( aName ) )
+            {
+            return i;
+            }
+        }
+    
+    return KErrNotFound;
+    }
+    
+//-----------------------------------------------------------------------------
+//  CCmManagerImpl::AllocReadL()
+//-----------------------------------------------------------------------------
+//
+HBufC* CCmManagerImpl::AllocReadL( TInt aResourceId ) const
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::AllocReadL" );
+
+    HBufC* retVal = NULL;
+    
+    // Scan all resource files to find owner
+    for (TInt i=0; i < iResourceFiles->Count(); i++)
+        { 
+        RResourceFile& file=(*iResourceFiles)[i]->iFile;
+        if ( file.OwnsResourceId(aResourceId) )
+            {
+            HBufC8* readBuffer = file.AllocReadLC( aResourceId );
+            // as we are expecting HBufC16...
+            const TPtrC16 ptrReadBuffer( (TText16*) readBuffer->Ptr(),
+                                         readBuffer->Length() >> 1 );
+            retVal=HBufC16::NewL( ptrReadBuffer.Length() );
+            retVal->Des().Copy( ptrReadBuffer );
+            CleanupStack::PopAndDestroy( readBuffer ); // readBuffer
+            
+            // exit from loop
+            break;
+            }
+        }
+
+    return retVal;
+    }
+
+//-----------------------------------------------------------------------------
+//  CCmManagerImpl::ConstructL()
+//-----------------------------------------------------------------------------
+//
+void CCmManagerImpl::ConstructL()
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::ConstructL" );
+    CLOG_NAME_1( _L("ManagerImpl_0x%x"), this );
+    
+    iObjectPool = new (ELeave) CCMObjectPool(*this);
+            
+    FeatureManager::InitializeLibL();
+    iIsFeatureManagerInitialised = ETrue;
+    iHelp = FeatureManager::FeatureSupported( KFeatureIdHelp ); 
+    iDefConnSupported = ETrue;
+    //iDefConnSupported = FeatureManager::FeatureSupported( KFeatureIdDefaultConnection );    
+    iWLan = FeatureManager::FeatureSupported( KFeatureIdProtocolWlan );
+
+    CMDBSession* db = CMDBSession::NewL( KCDVersion1_2 );
+    
+    iTrans = CCmTransactionHandler::NewL( *db );
+    CLOG_ATTACH( iTrans, this );
+    
+    User::LeaveIfError( iFs.Connect() );
+  
+    iResourceFiles = new (ELeave) CArrayPtrFlat<TResourceFiles>( 
+                                                          KResFileGranularity );
+    
+    TParse fp;
+    TInt err = fp.Set( KACMManagerResDirAndFileName, 
+                        &KDC_RESOURCE_FILES_DIR, 
+                        NULL ); 
+    CLOG_WRITE_1( "Set: [%d]", err );
+    if ( err != KErrNone)
+        {
+        User::Leave( err );
+        }
+        
+    TFileName fName;
+    
+    fName.Copy( fp.FullName() );
+    
+    AddResourceFileL( fName );
+        
+    CheckTablesL();
+    CreateBearerPriorityArrayL();
+        
+    BuildPluginArrayL();
+        
+    TCmPluginInitParam params( *this );
+    
+    params.iParentDest = NULL;
+    iPluginImpl = CCmConnectionMethodInfo::NewL( &params );
+    CLOG_ATTACH( iPluginImpl, this );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmManagerImpl::OpenTransactionLC
+// ---------------------------------------------------------------------------
+//
+void CCmManagerImpl::OpenTransactionLC( TBool aSetAttribs )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::OpenTransactionL" );
+
+    iTrans->OpenTransactionLC(  aSetAttribs );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDestinationImpl::CommitTransactionL
+// ---------------------------------------------------------------------------
+//
+void CCmManagerImpl::CommitTransactionL( TInt aError )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::CommitTransactionL" );
+
+    iTrans->CommitTransactionL( aError );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDestinationImpl::CommitTransactionL
+// ---------------------------------------------------------------------------
+//
+void CCmManagerImpl::RollbackTransaction()
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::RollbackTransaction" );
+    CleanupStack::Pop( iTrans );
+    iTrans->Close();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmDestinationImpl::StartCommsDatNotifier
+// ---------------------------------------------------------------------------
+//
+void CCmManagerImpl::StartCommsDatNotifierL()
+    {
+    // Two instances of class CCmCommsDatNotifier are created here and
+    // referred by all watchers in CmManager. One is to watch change in Iap Table
+    // and the other is to watch change in Snap Table.
+    iCommsDatIapNotifier = CCmCommsDatNotifier::NewL( KCDTIdIAPRecord );
+    
+    TUint32 snapTableId = GetSnapTableIdL();
+    iCommsDatSnapNotifier = CCmCommsDatNotifier::NewL( snapTableId );
+    }
+
+//=============================================================================
+// CREATION / DELETION API
+//=============================================================================
+//
+
+//-----------------------------------------------------------------------------
+//  CCmManagerImpl::CreateDestinationL( const TDesC& aName )
+//-----------------------------------------------------------------------------
+//
+CCmDestinationImpl* CCmManagerImpl::CreateDestinationL( const TDesC& aName )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::CreateDestinationL" );
+    
+    CheckAvailableSpaceL();
+    
+    if ( aName.Length() == 0 )
+        {
+        User::Leave( KErrArgument );
+        }
+    
+    return iObjectPool->GetDestinationL( aName );
+    }
+
+//-----------------------------------------------------------------------------
+//  CCmManagerImpl::CreateDestinationL( const TDesC& aName, TUint32
+//  aDestId )
+//-----------------------------------------------------------------------------
+//
+CCmDestinationImpl* CCmManagerImpl::CreateDestinationL(
+    const TDesC& aName,
+    TUint32 aDestId )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::CreateDestinationL" );
+
+    CheckAvailableSpaceL();
+    
+    if ( aName.Length() == 0 )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    if ( aDestId == 0 )
+        {
+        return CreateDestinationL( aName );
+        }
+
+    return iObjectPool->CreateDestinationL( aName, aDestId );
+    }
+
+
+//-----------------------------------------------------------------------------
+//  CCmManagerImpl::DestinationUpdated( CCmDestinationImpl* aDestination )
+//-----------------------------------------------------------------------------
+//
+void CCmManagerImpl::DestinationUpdated( CCmDestinationImpl* aDestination )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::DestinationUpdatedL" );
+    iObjectPool->DestinationUpdated( aDestination );
+    }
+
+// --------------------------------------------------------------------------
+// CCmManagerImpl::CreateConnectionMethodL()
+// --------------------------------------------------------------------------
+//  
+CCmPluginBase* 
+        CCmManagerImpl::CreateConnectionMethodL( CCmPluginBaseEng* pluginBaseEng )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::CreateConnectionMethodL 2" );
+
+    CheckAvailableSpaceL();        
+
+    return iObjectPool->CreateConnectionMethodL( pluginBaseEng );
+    }
+
+// --------------------------------------------------------------------------
+// CCmManagerImpl::InsertConnectionMethodL()
+// --------------------------------------------------------------------------
+//
+void CCmManagerImpl::InsertConnectionMethodL( CCmPluginBaseEng* pluginBaseEng )
+    {
+    iObjectPool->InsertConnectionMethodL( pluginBaseEng );
+    }
+
+// --------------------------------------------------------------------------
+// CCmManagerImpl::CreateConnectionMethodL()
+// --------------------------------------------------------------------------
+//  
+CCmPluginBase* 
+        CCmManagerImpl::CreateConnectionMethodL( TUint32 aImplementationUid,
+                                    CCmDestinationImpl* aParentDestination )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::CreateConnectionMethodL" );
+    
+    CheckAvailableSpaceL();
+    
+    TCmPluginInitParam params( *this );
+    if (aParentDestination)
+        {
+        params.iParentDest = aParentDestination->Id();        
+        }
+
+    return iObjectPool->CreateConnectionMethodL( aImplementationUid, params );
+    }
+
+// --------------------------------------------------------------------------
+// CCmManagerImpl::CreateConnectionMethodL()
+// --------------------------------------------------------------------------
+//  
+CCmPluginBase* 
+        CCmManagerImpl::CreateConnectionMethodL( TUint32 aImplementationUid,
+                                    TUint32 aConnMethodId,
+                                    CCmDestinationImpl* aParentDestination )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::CreateConnectionMethodL" );
+    
+    CheckAvailableSpaceL();
+         
+    TCmPluginInitParam params( *this );
+    if ( aParentDestination )
+        {
+        params.iParentDest = aParentDestination->Id();        
+        }
+
+    return iObjectPool->CreateConnectionMethodL( aImplementationUid,
+    		                                     params,
+    		                                     aConnMethodId);
+    }
+
+// --------------------------------------------------------------------------
+// CCmManagerImpl::DoCreateConnectionMethodL()
+// --------------------------------------------------------------------------
+//  
+CCmPluginBaseEng* 
+        CCmManagerImpl::DoCreateConnectionMethodL( TUint32 aImplementationUid,
+                                     TCmPluginInitParam& aParams )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::DoCreateConnectionMethodL" );
+
+    const TUid KMCMmImplementationUid = { aImplementationUid };    
+    TAny* ptr = REComSession::CreateImplementationL( KMCMmImplementationUid, 
+                                                     _FOFF( CCmPluginBaseEng, 
+                                                            iDtor_ID_Key ), 
+                                                     (TAny*)&aParams );
+
+    CCmPluginBaseEng* plugin = STATIC_CAST( CCmPluginBaseEng*, ptr );
+    CleanupStack::PushL( plugin );
+
+    plugin->CreateNewL(); 
+    plugin->SetIdValidity(EFalse);   
+    CleanupStack::Pop( plugin );  // plugin
+        
+    return plugin;
+    }
+
+// --------------------------------------------------------------------------
+// CCmManagerImpl::DoCreateConnectionMethodL()
+// --------------------------------------------------------------------------
+//  
+CCmPluginBaseEng* 
+   CCmManagerImpl::DoCreateConnectionMethodL( TUint32 aImplementationUid,
+                                              TCmPluginInitParam& aParams,
+                                              TUint32 aConnMethodId )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::DoCreateConnectionMethodL" );
+
+    const TUid KMCMmImplementationUid = { aImplementationUid };    
+    TAny* ptr = REComSession::CreateImplementationL( KMCMmImplementationUid, 
+                                                    _FOFF( CCmPluginBaseEng, 
+                                                           iDtor_ID_Key ), 
+                                                    (TAny*)&aParams );
+
+    CCmPluginBaseEng* plugin = STATIC_CAST( CCmPluginBaseEng*, ptr );
+    CleanupStack::PushL( plugin );
+
+    plugin->CreateNewL(); 
+    plugin->SetIdValidity( EFalse );
+    plugin->SetPreDefinedId( aConnMethodId );
+    CleanupStack::Pop( plugin );  // plugin
+
+    return plugin;
+    }
+
+//-----------------------------------------------------------------------------
+//  CCmManagerImpl::ConnectionMethodL( TUint aId )
+//-----------------------------------------------------------------------------
+//
+EXPORT_C CCmPluginBaseEng* 
+                      CCmManagerImpl::ConnectionMethodL( TUint32 /*aCmId*/ )
+    {
+    LOGGER_ENTERFN( "Error: Obsolete function CCmManagerImpl::ConnectionMethodL used" );
+    User::Panic( _L("CMManager"), KErrNotSupported );
+    return NULL;    
+    }
+
+//-----------------------------------------------------------------------------
+//  CCmManagerImpl::GetConnectionMethodL( TUint aId )
+//-----------------------------------------------------------------------------
+//
+EXPORT_C CCmPluginBase* 
+                      CCmManagerImpl::GetConnectionMethodL( TUint32 aCmId )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::GetConnectionMethodL" );
+    
+    CCmPluginBase* plugin = DoFindConnMethodL( aCmId, NULL );
+                                      
+    return plugin;
+    }
+
+
+//-----------------------------------------------------------------------------
+//  CCmManagerImpl::AppendUncatCmListL
+//-----------------------------------------------------------------------------
+//
+void CCmManagerImpl::AppendUncatCmListL( RPointerArray<CCmPluginBase>& aCMArray,
+                                        TBool aCheckBearerType,
+                                        TBool aLegacyOnly,
+                                        TBool aEasyWlan,
+                                        TBool aSortByBearer )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::AppendUncatCmListL" );
+
+    RArray<TUint32> cmUidArray;
+    CleanupClosePushL(cmUidArray);
+    ConnectionMethodL(cmUidArray, aCheckBearerType, aLegacyOnly, aEasyWlan, aSortByBearer);
+    AppendCmListFromUidsL( cmUidArray, aCMArray );
+
+    CleanupStack::PopAndDestroy(&cmUidArray);
+    }
+    
+//-----------------------------------------------------------------------------
+//  CCmManagerImpl::AppendUncatCmListLC
+//-----------------------------------------------------------------------------
+//
+void CCmManagerImpl::AppendUncatCmListLC( RPointerArray<CCmPluginBase>& aCMArray,
+                                        TBool aCheckBearerType,
+                                        TBool aLegacyOnly,
+                                        TBool aEasyWlan,
+                                        TBool aSortByBearer )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::AppendUncatCmListLC" );
+
+    AppendUncatCmListL( aCMArray, aCheckBearerType, aLegacyOnly, aEasyWlan, aSortByBearer);
+    
+    CleanupResetAndDestroyPushL< RPointerArray<CCmPluginBase> >( aCMArray );
+    }
+        
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::AppendCmListLC
+// -----------------------------------------------------------------------------
+//     
+void CCmManagerImpl::AppendCmListLC( TUint32 aDestintaionId, RPointerArray<CCmPluginBase>& aCMArray )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::AppendCmListLC" );
+
+    AppendCmListL( aDestintaionId, aCMArray );
+    CCmManagerImpl::CleanupResetAndDestroyPushL< RPointerArray<CCmPluginBase> >( aCMArray );
+    }
+         
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::AppendCmListL
+// -----------------------------------------------------------------------------
+//     
+void CCmManagerImpl::AppendCmListL( TUint32 aDestintaionId, RPointerArray<CCmPluginBase>& aCMArray )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::AppendCmListL" );
+
+    CCmDestinationImpl* dest = DestinationL( aDestintaionId );
+    CleanupStack::PushL(dest); 
+    RArray<TUint32> cmIdList;
+    CleanupClosePushL(cmIdList);
+    dest->ConnectMethodIdArrayL( cmIdList );
+    AppendCmListFromUidsL( cmIdList, aCMArray );
+    CleanupStack::PopAndDestroy(&cmIdList);  
+    CleanupStack::PopAndDestroy(dest);  
+    }
+// -----------------------------------------------------------------------------
+// CCmDestinationImpl::AppendCmListFromUidsL
+// -----------------------------------------------------------------------------
+//     
+void CCmManagerImpl::AppendCmListFromUidsL( RArray<TUint32>& cmIdList, RPointerArray<CCmPluginBase>& aCMArray )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::AppendCmListFromUidsL" );
+
+    TInt count = cmIdList.Count();
+    for ( TInt i = 0; i< count; i++ )
+        {
+        CCmPluginBase* cm = NULL;
+        TRAPD( err,cm = GetConnectionMethodL( cmIdList[i] ));
+        if (err == KErrNone)
+            {
+            aCMArray.AppendL( cm );
+            }
+        }
+    }
+    
+//-----------------------------------------------------------------------------
+//  CCmManagerImpl::ConnectionMethodL
+//-----------------------------------------------------------------------------
+//
+EXPORT_C void CCmManagerImpl::ConnectionMethodL( RArray<TUint32>& aCMArray,
+                                        TBool aCheckBearerType,
+                                        TBool aLegacyOnly,
+                                        TBool aEasyWlan,
+                                        TBool aSortByBearer )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::ConnectionMethodL" );
+
+    OpenTransactionLC();
+    
+    CMDBRecordSet<CCDIAPRecord>* ptrRecordSet = AllIapsL();
+    CleanupStack::PushL( ptrRecordSet );
+    
+    TInt iapRecords = ptrRecordSet->iRecords.Count();
+    CLOG_WRITE_1_PTR( NULL, "Record num [%d]", iapRecords );
+    
+    // Time optimization to load the entire destination table
+    TInt destTblId = DestinationTableId();
+    CMDBRecordSet<CCDDataMobilitySelectionPolicyRecord>*  ptrDestSet = 
+            new (ELeave) CMDBRecordSet<CCDDataMobilitySelectionPolicyRecord>( 
+                                                                    destTblId );
+    CleanupStack::PushL( ptrDestSet );
+    TRAP_IGNORE( ptrDestSet->LoadL( Session() ) );
+    
+    for ( TInt i = 0; i < iapRecords; i++ )
+        {
+        TUint32 iapId = (*ptrRecordSet)[i]->RecordId();
+        CLOG_WRITE_1_PTR( NULL, "IAP ID [%d]", iapId );
+        if ( aCheckBearerType )
+            {
+            TUint32 bearerType( 0 );
+            TRAPD( err, 
+                   bearerType = BearerTypeFromIapRecordL( (*ptrRecordSet)[i] ));
+            if ( !err && bearerType )
+                {
+                // append the IAP id - if aLegacyOnly is ETrue, only for legacy IAPs
+                if ( !aLegacyOnly || 
+                     !NumOfConnMethodReferencesL( iapId, ptrDestSet ) )
+                    {
+                    if( !aEasyWlan && IsEasyWLanL( (*ptrRecordSet)[i] ) )
+                        {
+                        continue;
+                        }
+                        
+                    aCMArray.Append( iapId );
+                    }
+                }
+            }
+        else
+            {
+            // append the IAP id - if aLegacyOnly is ETrue, only for legacy IAPs
+            if ( !aLegacyOnly ||
+                 !NumOfConnMethodReferencesL( iapId, ptrDestSet ) )
+                {
+                if( !aEasyWlan && IsEasyWLanL( (*ptrRecordSet)[i] ) )
+                    {
+                    continue;
+                    }
+                    
+                aCMArray.Append( iapId );
+                }
+            }
+        }
+    
+    // Re-order the array according to the global bearer ordering rules
+    if ( aSortByBearer )
+        {        
+        RArray<TUint32> bearers( KCmArrayMediumGranularity );
+        CleanupClosePushL( bearers );
+        SupportedBearersL( bearers );
+        
+        TInt prevInsertedPos = -1;
+        for ( TInt i = 0; i < bearers.Count(); i++ )
+            {
+            for ( TInt j = prevInsertedPos + 1; j < aCMArray.Count(); j++ )
+                {
+                // Check if CM belongs to this bearer
+                TUint cmBearerId = GetConnectionMethodInfoIntL( aCMArray[j],
+                                                             ECmBearerType );
+                if ( cmBearerId == bearers[i] )
+                    {
+                    // copy the cm id to the next 'sorted position' in the array
+                    // the item removed will always be after the insertion position
+                    TUint cmId = aCMArray[j];
+                    aCMArray.Remove(j);                    
+                    aCMArray.Insert( cmId, ++prevInsertedPos );
+                    }
+                }
+            }
+        
+        CleanupStack::PopAndDestroy( &bearers );
+        }
+    
+    CleanupStack::PopAndDestroy( 2, ptrRecordSet );
+    
+    RollbackTransaction();
+    }
+
+//-----------------------------------------------------------------------------
+//  CCmManagerImpl::DoFindConnMethodL
+//-----------------------------------------------------------------------------
+//
+CCmPluginBase* CCmManagerImpl::DoFindConnMethodL( TUint32 aCmId, 
+                                      CCmDestinationImpl* aParentDest )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::DoFindConnMethodL" );
+    return iObjectPool->GetConnectionMethodL(aCmId, aParentDest);        
+    }
+
+//-----------------------------------------------------------------------------
+//  CCmManagerImpl::FindConnMethodL
+//-----------------------------------------------------------------------------
+//
+CCmPluginBaseEng* CCmManagerImpl::DoFindConnMethL( TUint32 aCmId, 
+                                       CCmDestinationImpl* aParentDest )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::FindConnMethodL" );
+
+    // Step through each bearer to find which the CMId belongs to
+    CCmPluginBaseEng* plugin = NULL;
+    
+    TCmPluginInitParam params( *this );
+    if (aParentDest)
+        {
+        params.iParentDest = aParentDest->Id();        
+        }
+    else
+        {
+        params.iParentDest = ParentDestinationL( aCmId );        
+        }
+        
+    TUint32 bearerType = BearerTypeFromCmIdL( aCmId );
+
+    for ( TInt i=0; i<iPlugins->Count(); i++ )
+        {
+        if( (*iPlugins)[i]->GetIntAttributeL( ECmBearerType ) == bearerType )
+            {
+            plugin = (*iPlugins)[i]->CreateInstanceL( params );
+            break;
+            }
+        }    
+        
+    if ( !plugin )
+        {
+        return plugin;
+        }
+    
+    CleanupStack::PushL( plugin );
+    
+    plugin->LoadL( aCmId );
+                    
+    CleanupStack::Pop( plugin ); // 1
+    plugin->SetIdValidity(ETrue);
+        
+    return plugin;
+    }
+ 
+//-----------------------------------------------------------------------------
+//  CCmManagerImpl::BearerTypeFromIapL( TUint aId )
+//-----------------------------------------------------------------------------
+//
+TUint32 CCmManagerImpl::BearerTypeFromCmIdL( TUint32 aCmId )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::BearerTypeFromIapL" );
+    TUint32 bearerType;
+    if ( aCmId > KMaxIapID )
+        {
+        bearerType = KUidEmbeddedDestination;  
+        }
+    else
+        {//aCmId is an IapId
+         // Load this IAP record from the IAP table
+        // This is an optimization that plugins doesn't have
+        // to do it every time the CanHandleIapIdL() is called.    
+        CCDIAPRecord *iapRecord = static_cast<CCDIAPRecord *>
+                                   (CCDRecordBase::RecordFactoryL(KCDTIdIAPRecord));     
+        CleanupStack::PushL( iapRecord ); // 1
+        iapRecord->SetRecordId( aCmId );
+
+        OpenTransactionLC();
+        iapRecord->LoadL( Session() );
+        RollbackTransaction();
+        
+        bearerType = BearerTypeFromIapRecordL( iapRecord );
+
+        CleanupStack::PopAndDestroy( iapRecord ); // 0        
+        }    
+    return bearerType;
+    }
+   
+//-----------------------------------------------------------------------------
+//  CCmManagerImpl::BearerTypeFromIapRecordL( CCDIAPRecord* aIapRecord )
+//-----------------------------------------------------------------------------
+//
+TUint32 CCmManagerImpl::BearerTypeFromIapRecordL( CCDIAPRecord* aIapRecord ) const
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::BearerTypeFromIapRecordL" );
+
+    CLOG_WRITE_1( "Plugin count: [%d]", iPlugins->Count() );
+    
+    TInt err( KErrNone );
+    TUint32 extLevel( 0 );
+    TInt bearerType( 0 );
+    TBool canHandle( EFalse );
+    
+    // Check which bearer handles the given IAPid
+    for ( TInt i=0; i<iPlugins->Count(); i++ )
+        {
+        // a defective, or a wrong AP can't cause any trouble.
+        TRAP( err, canHandle = (*iPlugins)[i]->CanHandleIapIdL( aIapRecord ) );
+        CLOG_WRITE_3( "plugin [%d] returned with error %d, CanH: %d", 
+                       i, err, TUint32(canHandle) );
+        if ( !err && canHandle )
+            {
+            if ( extLevel < 
+                (*iPlugins)[i]->GetIntAttributeL( ECmExtensionLevel ) )
+                {
+                extLevel = (*iPlugins)[i]->GetIntAttributeL(ECmExtensionLevel);
+                bearerType = (*iPlugins)[i]->GetIntAttributeL( ECmBearerType );
+                }
+            }
+        else if ( err == KErrNoMemory )
+            {
+            User::Leave( err );
+            }
+        }
+        
+    if ( !bearerType )
+        // No supporting plugin found.
+        {
+        CLOG_WRITE( "Plugin not found, Leaving." );
+        User::Leave( KErrNotSupported );
+        }
+    CLOG_WRITE_1( "Returning bearertype: [%d]", bearerType );
+    return bearerType;
+    }
+
+//-----------------------------------------------------------------------------
+//  CCmManagerImpl::AllDestinationsL()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C void CCmManagerImpl::AllDestinationsL( RArray<TUint32>& aDestArray )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::AllDestinationsL" );
+
+    OpenTransactionLC();
+
+    CMDBRecordSet<CCDDataMobilitySelectionPolicyRecord>* destRecordSet = 
+           new ( ELeave ) CMDBRecordSet<CCDDataMobilitySelectionPolicyRecord>( 
+                                                             iDestinationTableId );
+    CleanupStack::PushL( destRecordSet );
+
+    TRAP_IGNORE( destRecordSet->LoadL( Session() ) );
+    
+    iDestinationCount = destRecordSet->iRecords.Count();
+
+    //=========================================================================
+    // Step through every item in the NW Table and check whether it is linked
+    // in the DN_IAP table
+    //
+    for ( TInt i = 0; i < iDestinationCount; ++i )
+        {
+        TInt nwId = QUERY_INT_FIELD( destRecordSet->iRecords[i], 
+                                     KCDTIdDataMobilitySelectionPolicyNetwork );
+        TBool found( EFalse );
+        
+        for ( TInt j = 0; j < aDestArray.Count(); ++j )
+            {
+            if ( aDestArray[j] == nwId )
+                {
+                found = ETrue;
+                break;
+                }
+            }
+            
+        if ( !found )
+            {
+            aDestArray.AppendL( nwId );
+            CLOG_WRITE_2( "Dest(%d): [%d]", aDestArray.Count(), nwId );
+            }
+        }
+    
+    CleanupStack::PopAndDestroy( destRecordSet );
+    
+    RollbackTransaction();
+   
+    CLOG_WRITE_1( "No. of dests found: [%d] ", aDestArray.Count() );
+    }
+        
+//-----------------------------------------------------------------------------
+//  CCmManagerImpl::DestinationL()
+//-----------------------------------------------------------------------------
+//  
+EXPORT_C CCmDestinationImpl* CCmManagerImpl::DestinationL( TUint32 aId )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::DestinationL" );
+        
+    // Create destination object
+    return iObjectPool->GetDestinationL( aId );
+    }
+    
+//-----------------------------------------------------------------------------
+//  CCmManagerImpl::RemoveDestFromPool
+//-----------------------------------------------------------------------------
+//  
+EXPORT_C void CCmManagerImpl::RemoveDestFromPool( CCmDestinationImpl* aDestination )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::RemoveDestFromPool" );
+    iObjectPool->RemoveDestination(aDestination);
+    }
+    
+//-----------------------------------------------------------------------------
+//  CCmManagerImpl::RemoveDestFromPool
+//-----------------------------------------------------------------------------
+//  
+void CCmManagerImpl::RemoveDestFromPool( CCmDestinationData* aDestination )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::RemoveDestFromPool" );
+    iObjectPool->RemoveDestination(aDestination);
+    }
+    
+//-----------------------------------------------------------------------------
+//  CCmManagerImpl::RemoveCMFromPool
+//-----------------------------------------------------------------------------
+//  
+void CCmManagerImpl::RemoveCMFromPoolL( CCmPluginBaseEng* aCM )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::RemoveCMFromPool" );
+    iObjectPool->RemoveConnectionMethodL( aCM );
+    }
+    
+//-----------------------------------------------------------------------------
+//  CCmManagerImpl::RemoveCMFromPool
+//-----------------------------------------------------------------------------
+//  
+void CCmManagerImpl::RemoveCMFromPoolL( CCmPluginBase* aCM )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::RemoveCMFromPool" );
+    iObjectPool->RemoveConnectionMethodL( aCM );
+    }
+
+//-----------------------------------------------------------------------------
+// CCmManagerImpl::CopyConnectionMethodL()
+//-----------------------------------------------------------------------------
+//
+TInt CCmManagerImpl::CopyConnectionMethodL( 
+                                    CCmDestinationImpl& aTargetDestination,
+                                    CCmPluginBase& aConnectionMethod )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::CopyConnectionMethodL" );    
+    
+    OpenTransactionLC();
+    TInt index = aTargetDestination.AddConnectionMethodL( aConnectionMethod );
+    aTargetDestination.UpdateL();
+    CommitTransactionL( 0 );
+    
+    return index;
+    }    
+    
+//-----------------------------------------------------------------------------
+// CCmManagerImpl::MoveConnectionMethodL()
+//-----------------------------------------------------------------------------
+//
+TInt CCmManagerImpl::MoveConnectionMethodL( 
+                                    CCmDestinationImpl& aSourceDestination,
+                                    CCmDestinationImpl& aTargetDestination,
+                                    CCmPluginBase& aConnectionMethod )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::MoveConnectionMethodL" );
+    
+    OpenTransactionLC();
+    
+    TInt index = CopyConnectionMethodL( aTargetDestination, aConnectionMethod );
+    aSourceDestination.RemoveConnectionMethodL( aConnectionMethod );
+    aSourceDestination.UpdateL();
+    
+    CommitTransactionL( KErrNone );
+    
+    return index;
+    }
+    
+//-----------------------------------------------------------------------------
+// CCmManagerImpl::RemoveConnectionMethodL()
+//-----------------------------------------------------------------------------
+//
+void CCmManagerImpl::RemoveConnectionMethodL( 
+                                         CCmDestinationImpl& aDestination,
+                                         CCmPluginBase& aConnectionMethod )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::RemoveConnectionMethodL" );    
+    
+    OpenTransactionLC();
+    aDestination.RemoveConnectionMethodL( aConnectionMethod );
+    aDestination.UpdateL();
+    CommitTransactionL( 0 );
+    }
+
+//-----------------------------------------------------------------------------
+//  RCmManagerExt::SupportedBearers()
+//-----------------------------------------------------------------------------
+//
+void CCmManagerImpl::SupportedBearersL( RArray<TUint32>& aArray ) const
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::SupportedBearersL" );
+
+    for ( TInt i = 0; i < iPlugins->Count(); i++ )
+        {
+        TUint32 bearerType( (*iPlugins)[i]->GetIntAttributeL(ECmBearerType) );
+        
+        if ( KUidEmbeddedDestination != bearerType )
+            {
+            aArray.AppendL( (*iPlugins)[i]->GetIntAttributeL(ECmBearerType) );
+            }
+        }       
+    }
+    
+// -----------------------------------------------------------------------------
+// CCmManagerImpl::NumOfConnMethodReferencesL()
+// -----------------------------------------------------------------------------
+//
+TUint32 CCmManagerImpl::NumOfConnMethodReferencesL( 
+        TUint32 aId,
+        CMDBRecordSet<CCDDataMobilitySelectionPolicyRecord>* aRecSet )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::NumOfConnMethodReferencesL" );
+
+    OpenTransactionLC();
+    
+    TUint32 retVal( 0 );
+   
+    if ( aRecSet )
+        {
+        TMDBElementId id( IAP_ELEMENT_ID(aId) );
+        
+        for ( TInt i = 0; i < aRecSet->iRecords.Count(); ++i )
+            {
+            if ( QUERY_UINT32_FIELD( (*aRecSet)[i], 
+                                    KCDTIdDataMobilitySelectionPolicyIAP ) == 
+                id )
+                {
+                ++retVal;
+                }
+            }
+        }
+    else
+        {
+        // Just to test how many record we have
+        TInt destTblId = DestinationTableId();
+        CMDBRecordSet<CCDDataMobilitySelectionPolicyRecord>*  ptrRecordSet =
+             new (ELeave) CMDBRecordSet<CCDDataMobilitySelectionPolicyRecord>( 
+                                                                    destTblId );
+        CleanupStack::PushL( ptrRecordSet );
+
+        // Prime record
+        CCDDataMobilitySelectionPolicyRecord* record = 
+                              new (ELeave) CCDDataMobilitySelectionPolicyRecord( 
+                                                            DestinationTableId() );
+        CleanupStack::PushL( record );
+
+        record->iIAP = IAP_ELEMENT_ID( aId );
+        ptrRecordSet->iRecords.AppendL( record );
+        
+        CleanupStack::Pop( record );
+        record = NULL;
+            
+        if ( ptrRecordSet->FindL(Session()) )
+            {
+            // we have a match
+            retVal = ptrRecordSet->iRecords.Count();
+            CLOG_WRITE_1( "Found: [%d]", retVal );
+            }
+        else
+            {
+            CLOG_WRITE( "Nothing" );
+            }
+            
+        CleanupStack::PopAndDestroy( ); //  ptrRecordSet
+        }
+            
+    RollbackTransaction();
+    
+    return retVal;
+    }
+
+// -----------------------------------------------------------------------------
+// CCmManagerImpl::HasUnprotectedDestinationsL
+// -----------------------------------------------------------------------------
+//
+TBool CCmManagerImpl::HasUnprotectedDestinationsL()
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::HasUnprotectedDestinationsL" );
+
+    TBool hasUnprotectedDests( EFalse );
+    
+    RArray<TUint32> destIdArray( KCmArrayBigGranularity );
+    AllDestinationsL( destIdArray );
+    CleanupClosePushL( destIdArray );
+    
+    CCmDestinationImpl* dest = NULL;
+    for ( TInt i = 0; i < destIdArray.Count(); i++ )
+        {
+        dest = DestinationL( destIdArray[i] );
+        CleanupStack::PushL( dest );
+        if ( dest->ProtectionLevel() != EProtLevel1 )
+            {
+            hasUnprotectedDests = ETrue;
+            CleanupStack::PopAndDestroy( dest );
+            break;
+            }            
+        CleanupStack::PopAndDestroy( dest );
+        }
+        
+    CleanupStack::PopAndDestroy( &destIdArray );
+    
+    return hasUnprotectedDests;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCmManagerImpl::BuildPluginArrayL()
+// -----------------------------------------------------------------------------
+//
+void CCmManagerImpl::BuildPluginArrayL()
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::BuildPluginArrayL" );
+    iPlugins = new (ELeave) CArrayPtrFlat<const CCmPluginBaseEng>( 
+                                                           KPluginGranularity );
+
+    // Get a list of all the bearer types
+    RImplInfoPtrArray implArray;
+    REComSession::ListImplementationsL( TUid::Uid( KCMPluginInterfaceUid ), 
+                                        implArray );
+
+    CleanupClosePushL( implArray ); // 1
+
+    CCmPluginBaseEng* plugin = NULL;
+    for ( TInt i=0; i<implArray.Count(); i++ )
+        {
+        TCmPluginInitParam params( *this );
+        params.iParentDest = NULL;
+
+        // This is the Util implementation        
+        // Trap it to be able to work even if there's a faulty plugin installed
+        // in the phone.
+        TRAPD( err, plugin = STATIC_CAST( CCmPluginBaseEng*, 
+                                        REComSession::CreateImplementationL( 
+                                        (implArray)[i]->ImplementationUid(),
+                                        _FOFF( CCmPluginBaseEng, 
+                                               iDtor_ID_Key ),
+                                        (TAny*)&params )) );
+
+        if ( !err )
+            {
+            CLOG_ATTACH( plugin, this );
+            
+            CleanupStack::PushL( plugin );
+            
+            TBool inserted( EFalse );
+            TInt defaultPriority( KDataMobilitySelectionPolicyPriorityWildCard );
+            
+            // No UI priority -> wildcard
+            TRAP_IGNORE( defaultPriority = plugin->GetIntAttributeL( ECmDefaultUiPriority ) );
+            
+            for( TInt j( 0 ); j < iPlugins->Count(); ++j )
+                {
+                if( defaultPriority > (*iPlugins)[j]->GetIntAttributeL( ECmDefaultUiPriority ) )
+                    {
+                    continue;
+                    }
+                else if( defaultPriority == (*iPlugins)[j]->GetIntAttributeL( ECmDefaultUiPriority ) )
+                    {
+                    if( plugin->GetIntAttributeL( ECmExtensionLevel ) > 
+                        (*iPlugins)[j]->GetIntAttributeL( ECmExtensionLevel ) )
+                        {
+                        iPlugins->InsertL( j, plugin );
+                        inserted = ETrue;
+                        break;
+                        }
+                    }
+                else
+                    {
+                    iPlugins->InsertL( j, plugin );
+                    inserted = ETrue;
+                    break;
+                    }
+                }
+            
+            if( !inserted )
+                {
+                iPlugins->AppendL( plugin );
+                }
+
+            CleanupStack::Pop( plugin );
+            }
+        }
+    
+    implArray.ResetAndDestroy();
+        
+    CleanupStack::PopAndDestroy();  // implArray;
+    }
+
+// -----------------------------------------------------------------------------
+// CCmManagerImpl::GetBearerInfoIntL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TUint32 CCmManagerImpl::GetBearerInfoIntL( TUint32 aBearerType,
+                                           TUint32 aAttribute ) const
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::GetBearerInfoIntL" );
+    for ( TInt i = 0; i < iPlugins->Count(); ++i )
+        {
+        if ( aBearerType == (*iPlugins)[i]->GetIntAttributeL( ECmBearerType ) )
+            {
+            return (*iPlugins)[i]->GetIntAttributeL( aAttribute );
+            }
+        }
+        
+    User::Leave( KErrNotSupported );
+    
+    return 0;
+    }
+    
+// -----------------------------------------------------------------------------
+// CCmManagerImpl::GetBearerInfoBoolL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool CCmManagerImpl::GetBearerInfoBoolL( TUint32 aBearerType,
+                                          TUint32 aAttribute ) const
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::GetBearerInfoBoolL" );
+    for ( TInt i = 0; i < iPlugins->Count(); ++i )
+        {
+        if ( aBearerType == (*iPlugins)[i]->GetIntAttributeL( ECmBearerType ) )
+            {
+            return (*iPlugins)[i]->GetBoolAttributeL( aAttribute );
+            }
+        }
+        
+    User::Leave( KErrNotSupported );
+    
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CCmManagerImpl::GetBearerInfoStringL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C HBufC* CCmManagerImpl::GetBearerInfoStringL( TUint32 aBearerType,
+                                             TUint32 aAttribute ) const
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::GetBearerInfoStringL" );
+    for ( TInt i = 0; i < iPlugins->Count(); ++i )
+        {
+        if ( aBearerType == (*iPlugins)[i]->GetIntAttributeL( ECmBearerType ) )
+            {
+            return (*iPlugins)[i]->GetStringAttributeL( aAttribute );
+            }
+        }
+        
+    User::Leave( KErrNotSupported );
+    
+    return NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CCmManagerImpl::GetBearerInfoString8L()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C HBufC8* CCmManagerImpl::GetBearerInfoString8L( TUint32 aBearerType,
+                                               TUint32 aAttribute ) const
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::GetBearerInfoStringL" );
+    for ( TInt i = 0; i < iPlugins->Count(); ++i )
+        {
+        if ( aBearerType == (*iPlugins)[i]->GetIntAttributeL( ECmBearerType ) )
+            {
+            return (*iPlugins)[i]->GetString8AttributeL( aAttribute );
+            }
+        }
+        
+    User::Leave( KErrNotSupported );
+    
+    return NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CCmManagerImpl::GetConnectionMethodInfoIntL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TUint32 CCmManagerImpl::GetConnectionMethodInfoIntL( TUint32 aCmId,
+                                                     TUint32 aAttribute ) const
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::GetConnectionMethodInfoIntL" );
+
+    if ( aAttribute == ECmBearerType )
+        {
+        return const_cast<CCmManagerImpl*>(this)->BearerTypeFromCmIdL( aCmId );
+        }
+    else
+        {
+        return iPluginImpl->GetConnectionInfoIntL( aCmId, aAttribute );
+        }
+    }
+    
+// -----------------------------------------------------------------------------
+// CCmManagerImpl::GetConnectionMethodInfoBoolL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool CCmManagerImpl::GetConnectionMethodInfoBoolL( TUint32 aCmId,
+                                                    TUint32 aAttribute ) const
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::GetConnectionMethodInfoBoolL" );
+
+    TBool retval = EFalse;
+    if ( aAttribute == ECmVirtual )
+        {
+        TUint32 b = GetConnectionMethodInfoIntL( aCmId, ECmBearerType );
+        retval = GetBearerInfoBoolL( b, ECmVirtual );
+        }
+    else
+        {
+        retval = iPluginImpl->GetConnectionInfoBoolL( aCmId, aAttribute );
+        }
+    return retval;
+    }
+    
+// -----------------------------------------------------------------------------
+// CCmManagerImpl::GetConnectionMethodInfoStringL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C HBufC* CCmManagerImpl::GetConnectionMethodInfoStringL( 
+                                                    TUint32 aCmId,
+                                                    TUint32 aAttribute ) const
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::GetConnectionMethodInfoStringL" );
+
+    return iPluginImpl->GetConnectionInfoStringL( aCmId, aAttribute );
+    }
+
+// -----------------------------------------------------------------------------
+// CCmManagerImpl::GetConnectionMethodInfoStringL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C HBufC8* CCmManagerImpl::GetConnectionMethodInfoString8L( 
+                                                     TUint32 aCmId,
+                                                     TUint32 aAttribute ) const
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::GetConnectionMethodInfoString8L" );
+
+    return iPluginImpl->GetConnectionInfoString8L( aCmId, aAttribute );
+    }
+
+//-----------------------------------------------------------------------------
+//  CCmManagerImpl::UncategorizedIconL()
+//-----------------------------------------------------------------------------
+//    
+CGulIcon* CCmManagerImpl::UncategorizedIconL() const
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::UncategorizedIconL" );
+    
+    MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
+           
+    TParse mbmFile;
+    User::LeaveIfError( mbmFile.Set( KManagerIconFilename, 
+                                     &KDC_BITMAP_DIR, 
+                                     NULL ) );
+           
+    CGulIcon* icon = AknsUtils::CreateGulIconL( 
+                            skinInstance, 
+                            KAknsIIDQgnPropSetConnDestUncategorized,
+                            mbmFile.FullName(), 
+                            EMbmCmmanagerQgn_prop_set_conn_dest_uncategorized, 
+                            EMbmCmmanagerQgn_prop_set_conn_dest_uncategorized_mask );
+                            
+    return icon;            
+    }    
+
+//-----------------------------------------------------------------------------
+//  CCmManagerImpl::UncategorizedIconL()
+//-----------------------------------------------------------------------------
+//    
+CMDBSession& CCmManagerImpl::Session() const
+    { 
+    return iTrans->Session(); 
+    }
+    
+// -----------------------------------------------------------------------------
+// CCmManagerImpl::HasCapabilityL()
+// -----------------------------------------------------------------------------
+//
+void CCmManagerImpl::HasCapabilityL( TCapability aCapability )
+    {
+    TSecurityInfo info;
+
+    info.SetToCurrentInfo();
+    
+    if( !info.iCaps.HasCapability( aCapability ) )
+        {
+        User::Leave( KErrPermissionDenied );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmManagerImpl::FeatureSupported
+// ---------------------------------------------------------------------------
+TBool CCmManagerImpl::FeatureSupported( TInt aFeature )
+    {
+    return FeatureManager::FeatureSupported( aFeature );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmManagerImpl::IsEasyWLan
+//
+// We can't have any dependecy to WLan plugin, but
+// in some cases we need to filter out EasyWLan access points.
+// ---------------------------------------------------------------------------
+TBool CCmManagerImpl::IsEasyWLanL( CCDIAPRecord* aIapRecord ) const
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::IsEasyWLanL" );
+    if (!iWLan)
+        {
+        return EFalse;    
+        }
+    if( (TPtrC(aIapRecord->iServiceType) != TPtrC(KCDTypeNameLANService) ) ||
+        TPtrC(aIapRecord->iBearerType) != TPtrC(KCDTypeNameLANBearer) )
+        {
+        return EFalse;
+        }
+        
+    TBool retVal( EFalse );
+    TUint32 serviceId = aIapRecord->iService;
+    
+    CCDWlanServiceRecord* wLanServ = 
+            new (ELeave) CCDWlanServiceRecord( CCDWlanServiceRecord::TableIdL( Session() ) );
+
+    CleanupStack::PushL( wLanServ );
+                
+    wLanServ->iWlanServiceId.SetL( serviceId );
+    
+    if( wLanServ->FindL( Session() ) )
+        {
+        wLanServ->LoadL( Session() );
+
+        if( wLanServ->iWLanSSID.IsNull() ||
+            !TPtrC(wLanServ->iWLanSSID).Compare( KNullDesC ) )
+            {
+            retVal = ETrue;
+            }
+        }
+        
+    CleanupStack::PopAndDestroy( wLanServ );
+    
+    return retVal;
+    }
+
+// -----------------------------------------------------------------------------
+// CCmManagerImpl::EasyWlanIdL()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TUint32 CCmManagerImpl::EasyWlanIdL()
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::EasyWlanId" );
+
+    OpenTransactionLC();
+    
+    TUint32 easyId( 0 );
+
+    CMDBRecordSet<CCDIAPRecord>*  ptrRecordSet = AllIapsL();
+    CleanupStack::PushL( ptrRecordSet );
+    TInt iapRecords = ptrRecordSet->iRecords.Count();
+    CLOG_WRITE_1_PTR( NULL, "Record num [%d]", iapRecords );
+
+    for ( TInt i = 0; i < iapRecords; i++ )
+        {
+        CCDIAPRecord* iapRecord = (*ptrRecordSet)[i];
+        
+        if( (TPtrC(iapRecord->iServiceType) == TPtrC(KCDTypeNameLANService) ) &&
+            TPtrC(iapRecord->iBearerType) == TPtrC(KCDTypeNameLANBearer) )
+            {
+            if( IsEasyWLanL( iapRecord ) )
+                {
+                easyId = (*ptrRecordSet)[i]->RecordId();
+                break;
+                }
+            }
+        }
+
+    CleanupStack::PopAndDestroy( ptrRecordSet );
+
+    RollbackTransaction();
+            
+    return easyId;
+    }
+
+// -----------------------------------------------------------------------------
+// CCmManagerImpl::AllIapsL()
+// -----------------------------------------------------------------------------
+//
+CMDBRecordSet<CCDIAPRecord>* CCmManagerImpl::AllIapsL()
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::AllIapsL" );
+
+    OpenTransactionLC();
+
+    CMDBRecordSet<CCDIAPRecord>*  ptrRecordSet = 
+                    new (ELeave) CMDBRecordSet<CCDIAPRecord>( KCDTIdIAPRecord );
+    
+    TRAP_IGNORE( ptrRecordSet->LoadL( Session() ) );
+    
+    RollbackTransaction();
+    
+    return ptrRecordSet;
+    }
+
+// -----------------------------------------------------------------------------
+// CCmManagerImpl::AllSNAPRecordsL()
+// -----------------------------------------------------------------------------
+//
+CMDBRecordSet<CCDDataMobilitySelectionPolicyRecord>* 
+                    CCmManagerImpl::AllSNAPRecordsL( TUint32 aSnapElementId )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::AllSNAPRecordsL" );
+
+    CMDBRecordSet<CCDDataMobilitySelectionPolicyRecord>*  ptrRecordSet = 
+              new (ELeave) CMDBRecordSet<CCDDataMobilitySelectionPolicyRecord>(  
+                                                        DestinationTableId() );
+    CleanupStack::PushL( ptrRecordSet );
+
+    OpenTransactionLC();    
+    if( aSnapElementId )
+        {
+        // Prime record
+        CCDSnapRecord* record = SNAPRecordL( 0 );
+        CleanupStack::PushL( record );
+        record->iEmbeddedSNAP = aSnapElementId;
+        ptrRecordSet->iRecords.AppendL( record );
+
+        CleanupStack::Pop( record );
+        record = NULL;
+            
+        ptrRecordSet->FindL( Session() );
+        }
+    else
+        {
+        ptrRecordSet->LoadL( Session() );
+        }
+        
+    RollbackTransaction();
+    
+    return ptrRecordSet;
+    }
+
+// -----------------------------------------------------------------------------
+// CCmManagerImpl::IsIapLinkedL()
+// -----------------------------------------------------------------------------
+//
+TBool CCmManagerImpl::IsIapLinkedL( const CCmPluginBaseEng& aPlugin )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::IsIapLinkedL" );
+    
+    TUint32 iapId = aPlugin.GetIntAttributeL( ECmId );
+    CMDBRecordSet<CCDIAPRecord>*  ptrRecordSet = AllIapsL();
+    CleanupStack::PushL( ptrRecordSet );
+
+    TInt iapRecords = ptrRecordSet->iRecords.Count();
+    CLOG_WRITE_1_PTR( NULL, "Record num [%d]", iapRecords );
+
+    TBool linked( EFalse );
+    for ( TInt i = 0; !linked && i < iapRecords; i++ )
+        {
+        CCDIAPRecord* iapRecord = (*ptrRecordSet)[i];
+        
+        if( iapRecord->RecordId() == iapId )
+            {
+            continue;
+            }
+            
+        TUint32 bearerType( 0 );
+        
+        TRAP_IGNORE( bearerType = BearerTypeFromIapRecordL( iapRecord ) );
+        if( bearerType )
+            {
+            if( GetBearerInfoBoolL( bearerType, ECmVirtual ) )
+                {
+                CCmPluginBase* plugin = NULL;
+                
+                TRAP_IGNORE( plugin = GetConnectionMethodL( iapRecord->RecordId() ) );
+                if( plugin )
+                    {
+                    linked = plugin->IsLinkedToIap( iapId );
+                    }
+                    
+                delete plugin;
+                }
+            }
+        }
+    CleanupStack::PopAndDestroy( ptrRecordSet );
+    
+    return linked;
+    }
+    
+// -----------------------------------------------------------------------------
+// CCmManagerImpl::RemoveAllReferencesL()
+// -----------------------------------------------------------------------------
+//
+void CCmManagerImpl::RemoveAllReferencesL( const CCmPluginBaseEng& aPlugin )
+    {
+    RArray<TUint32> dests;
+    CleanupClosePushL( dests );    
+    OpenTransactionLC();
+
+    AllDestinationsL( dests );
+    
+    for( TInt i = 0; i < dests.Count(); ++i )
+        {
+        CCmDestinationImpl* dest = DestinationL( dests[i] );
+        CleanupStack::PushL( dest );
+        TRAPD( err, dest->RemoveConnectionMethodL( aPlugin ) );
+        
+        if( err != KErrNotFound )
+            {
+            User::LeaveIfError( err );
+
+            dest->UpdateL();
+            }
+        
+        CleanupStack::PopAndDestroy( dest );
+        }
+    
+    CommitTransactionL( 0 );
+    CleanupStack::PopAndDestroy( &dests );   
+    }
+
+// -----------------------------------------------------------------------------
+// CCmManagerImpl::RemoveAllReferencesLWoTransL()
+// -----------------------------------------------------------------------------
+//
+void CCmManagerImpl::RemoveAllReferencesWoTransL( const CCmPluginBaseEng& aPlugin )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::RemoveAllReferencesWoTransL" );
+
+    RArray<TUint32> dests;
+    CleanupClosePushL( dests );    
+
+    AllDestinationsL( dests );
+
+    for( TInt i = 0; i < dests.Count(); ++i )
+        {
+        CCmDestinationImpl* dest = DestinationL( dests[i] );
+        CleanupStack::PushL( dest );
+        TRAPD( err, dest->RemoveConnectionMethodL( aPlugin ) );
+
+        if( err != KErrNotFound )
+            {
+            User::LeaveIfError( err );
+
+            dest->UpdateL();
+            }
+
+        CleanupStack::PopAndDestroy( dest );
+        }
+    CleanupStack::PopAndDestroy( &dests );   
+    }
+
+// -----------------------------------------------------------------------------
+// CCmManagerImpl::HandleDefConnDeletedL()
+// -----------------------------------------------------------------------------
+//
+void CCmManagerImpl::HandleDefConnDeletedL( TCmDefConnValue& aDCSetting )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::HandleDefConnDeletedL" );
+
+    if ( IsDefConnSupported() )
+        {
+        TCmDefConnValue defConn;
+        ReadDefConnWoTransL(defConn);
+        if ( defConn == aDCSetting )
+            {
+            // Default connection deleted, setting it to default value.
+            TUint32 destId = GetInternetDestinationIdL();
+
+            if ( destId && ( destId != aDCSetting.iId ) )
+                {
+                defConn.iType = ECmDefConnDestination;
+                defConn.iId = destId;                
+                }
+            else
+                {
+                // Internet destination not found. Initialise to zero.
+                defConn.iType = TCmDefConnType ( 0 );
+                defConn.iId = 0;
+                }    
+
+            WriteDefConnWoTransL( defConn );
+            }
+        } // do nothing if default connection is not supported
+    }
+
+// -----------------------------------------------------------------------------
+// CCmManagerImpl::ReadDefConnWoTransL()
+// -----------------------------------------------------------------------------
+//
+void CCmManagerImpl::ReadDefConnWoTransL( TCmDefConnValue& aDCSetting )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::ReadDefConnWoTransL" );
+    if ( IsDefConnSupported() )
+        {
+        CMDBRecordSet<CCDDefConnRecord>* defConnRecordSet = 
+            new ( ELeave ) CMDBRecordSet<CCDDefConnRecord>( iDefConnTableId );
+        CleanupStack::PushL( defConnRecordSet );
+
+        TRAPD( err,  defConnRecordSet->LoadL( Session() ) );
+        if (err == KErrNone)
+            {
+            TInt mode = QUERY_INT_FIELD( defConnRecordSet->iRecords[0], 
+                                         KCDTIdDefConnType );
+            aDCSetting.iType= TCmDefConnType (mode);
+
+            aDCSetting.iId = QUERY_INT_FIELD( defConnRecordSet->iRecords[0], 
+                                              KCDTIdDefConnUid );
+            CLOG_WRITE( "Default Connection read OK " );
+            }
+        else
+            {
+            //deleting old record, writing Always Ask (default value)
+            //aDCSetting.iType = ECmDefConnAlwaysAsk;
+            //aDCSetting.iId = 0;
+            TUint32 destId = GetInternetDestinationIdL();
+
+            if ( destId )
+                {
+                aDCSetting.iType = ECmDefConnDestination;
+                aDCSetting.iId = destId;                
+                }
+            else
+                {                
+                // Internet destination not found. Initialise to zero.
+                aDCSetting.iType = TCmDefConnType ( 0 );
+                aDCSetting.iId = 0;
+                }    
+
+            CLOG_WRITE( "Default Connection read FAILED, storing Always Ask! " );
+            ReplaceDefConnRecordL( aDCSetting );
+            }
+        CleanupStack::PopAndDestroy( defConnRecordSet );
+        }
+    else
+        {
+        CLOG_WRITE( "Default Connection NOT supported, leaving with KErrNotSupported" );
+        User::Leave(KErrNotSupported);
+        }
+    }
+
+//-----------------------------------------------------------------------------
+//  CCmManagerImpl::WriteDefConnWoTransL()
+//-----------------------------------------------------------------------------
+//
+void CCmManagerImpl::WriteDefConnWoTransL( const TCmDefConnValue& aDCSetting )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::WriteDefConnWoTransL" );
+
+    if ( IsDefConnSupported() )
+        {
+        ReplaceDefConnRecordL( aDCSetting );
+        }
+    else
+        {
+        CLOG_WRITE( "Default Connection NOT supported, leaving with KErrNotSupported" );
+        User::Leave(KErrNotSupported);
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCmManagerImpl::ReadDefConnL()
+// -----------------------------------------------------------------------------
+//
+void CCmManagerImpl::ReadDefConnL( TCmDefConnValue& aDCSetting )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::ReadDefConn" );
+
+    if ( IsDefConnSupported() )
+        {
+        OpenTransactionLC();
+        CMDBRecordSet<CCDDefConnRecord>* defConnRecordSet = 
+               new ( ELeave ) CMDBRecordSet<CCDDefConnRecord>( iDefConnTableId );
+        CleanupStack::PushL( defConnRecordSet );
+     
+        TRAPD( err,  defConnRecordSet->LoadL( Session() ) );
+        if (err == KErrNone)
+            {
+             TInt mode = QUERY_INT_FIELD( defConnRecordSet->iRecords[0], 
+                                             KCDTIdDefConnType );
+              aDCSetting.iType= TCmDefConnType ( mode );
+            
+            aDCSetting.iId = QUERY_INT_FIELD( defConnRecordSet->iRecords[0], 
+                                             KCDTIdDefConnUid );
+            CleanupStack::PopAndDestroy( defConnRecordSet );
+            RollbackTransaction();                                 
+            }
+        else
+            {
+            //deleting old record, writing Always Ask (default value)
+            //aDCSetting.iType = ECmDefConnAlwaysAsk;
+            //aDCSetting.iId = 0;
+            
+            TUint32 destId = GetInternetDestinationIdL();
+
+            if ( destId )
+                {
+                aDCSetting.iType = ECmDefConnDestination;
+                aDCSetting.iId = destId;                
+                }
+            else
+                {                
+                // Internet destination not found. Initialise to zero.
+                aDCSetting.iType = TCmDefConnType ( 0 );
+                aDCSetting.iId = 0;
+                }    
+
+            CLOG_WRITE( "Default Connection read FAILED, storing Always Ask! " );
+            ReplaceDefConnRecordL( aDCSetting );
+            
+            CleanupStack::PopAndDestroy( defConnRecordSet );
+            CommitTransactionL( KErrNone );
+            }
+        }
+    else
+        {
+        CLOG_WRITE( "Default Connection NOT supported" );
+        User::Leave(KErrNotSupported);
+        }
+    }
+
+//-----------------------------------------------------------------------------
+//  CCmManagerImpl::ReplaceDefConnRecordL()
+//-----------------------------------------------------------------------------
+//
+void CCmManagerImpl::ReplaceDefConnRecordL( const TCmDefConnValue aDCSetting )
+    {
+    	
+    LOGGER_ENTERFN( "CCmManagerImpl::ReplaceDefConnRecordL" );	
+    // Check the Id first (that it exists)
+    if ( aDCSetting.iType == ECmDefConnConnectionMethod )
+        {
+        CCDIAPRecord* iapRecord = static_cast<CCDIAPRecord *>
+                                  ( CCDRecordBase::RecordFactoryL( KCDTIdIAPRecord ) );
+        CleanupStack::PushL( iapRecord );
+        iapRecord->SetRecordId( aDCSetting.iId );
+        TRAPD( err, iapRecord->LoadL( Session() ) );
+        if ( err == KErrNotFound )
+            {
+            User::Leave( KErrArgument );
+            }
+        CleanupStack::PopAndDestroy( iapRecord );
+        
+        // Check that Connection Method is not hidden
+        if ( GetConnectionMethodInfoBoolL( aDCSetting.iId, ECmHidden ) )
+            {
+            User::Leave( KErrArgument );
+            }
+        }
+    else if ( aDCSetting.iType == ECmDefConnDestination )
+        {
+        TUint32 destId = GetInternetDestinationIdL();
+        
+        // Allow empty Internet destination, others must have some content
+        if ( destId != aDCSetting.iId )
+            {
+            CCDAccessPointRecord* destAPRecord = static_cast<CCDAccessPointRecord *>(
+                           CCDRecordBase::RecordFactoryL( KCDTIdAccessPointRecord ) );
+            CleanupStack::PushL( destAPRecord );
+            
+            destAPRecord->iRecordTag = aDCSetting.iId;
+            if ( !destAPRecord->FindL( Session() ) )
+                {
+                User::Leave( KErrArgument );
+                }
+            CleanupStack::PopAndDestroy( destAPRecord );
+         		}
+        }
+
+    TInt ret = KErrNone;
+    TCmGenConnSettings genConnSettings;
+    
+    SetGenConnSettingsToDefault( genConnSettings );
+
+    CMDBRecordSet<CCDDefConnRecord>* defConnRecordSet = 
+           new ( ELeave ) CMDBRecordSet<CCDDefConnRecord>( iDefConnTableId );
+    CleanupStack::PushL( defConnRecordSet );
+    
+    TRAP( ret, defConnRecordSet->LoadL( Session() ) );
+    
+    if (ret == KErrNone)
+        {
+        TInt value = QUERY_INT_FIELD( defConnRecordSet->iRecords[0], KCDTIdUsageOfWlan );
+        genConnSettings.iUsageOfWlan = TCmUsageOfWlan( value );
+
+        value = QUERY_INT_FIELD( defConnRecordSet->iRecords[0], KCDTIdSeamlessnessHome );
+        genConnSettings.iSeamlessnessHome = TCmSeamlessnessValue( value );
+
+        value = QUERY_INT_FIELD( defConnRecordSet->iRecords[0], KCDTIdSeamlessnessVisitor );
+        genConnSettings.iSeamlessnessVisitor = TCmSeamlessnessValue( value );
+        }
+
+    TInt typeVal = aDCSetting.iType;
+    TInt uidVal = aDCSetting.iId;
+
+    // Delete the old record
+    for ( TInt i = 0; i < defConnRecordSet->iRecords.Count(); ++i )
+        {
+        defConnRecordSet->iRecords[i]->DeleteL( Session() );
+        }
+    CleanupStack::PopAndDestroy( defConnRecordSet );
+
+    CCDDefConnRecord* dcRcd = 
+        new (ELeave) CCDDefConnRecord( iDefConnTableId );
+    CleanupStack::PushL( dcRcd ); // 2
+            
+    dcRcd->SetRecordId( KCDNewRecordRequest );
+
+    SET_INT_FIELD(dcRcd, KCDTIdUsageOfWlan, genConnSettings.iUsageOfWlan );
+    SET_INT_FIELD(dcRcd, KCDTIdSeamlessnessHome, genConnSettings.iSeamlessnessHome );
+    SET_INT_FIELD(dcRcd, KCDTIdSeamlessnessVisitor, genConnSettings.iSeamlessnessVisitor );
+
+    CLOG_WRITE_FORMAT( "Set default connection type: [%d]", typeVal );
+    SET_INT_FIELD(    dcRcd, 
+                        KCDTIdDefConnType, 
+                        typeVal );
+    CLOG_WRITE_1( "Set uid: [%d]", uidVal );
+    SET_INT_FIELD(  dcRcd, 
+                    KCDTIdDefConnUid, 
+                    uidVal );
+    dcRcd->StoreL( Session() );    
+    CleanupStack::PopAndDestroy( dcRcd );
+    }
+
+//-----------------------------------------------------------------------------
+//  CCmManagerImpl::WriteDefConnL()
+//-----------------------------------------------------------------------------
+//
+void CCmManagerImpl::WriteDefConnL( const TCmDefConnValue& aDCSetting )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::WriteDefConnL" );
+    
+    if ( ( aDCSetting.iType == ECmDefConnAlwaysAsk ) ||
+         ( aDCSetting.iType == ECmDefConnAskOnce ) )
+        {
+        User::Leave( KErrNotSupported );
+        }
+    if ( IsDefConnSupported() )
+        {
+        OpenTransactionLC();
+
+        ReplaceDefConnRecordL( aDCSetting );
+        CommitTransactionL( KErrNone );
+        }
+    else
+        {
+        CLOG_WRITE( "Default Connection NOT supported, leaving with KErrNotSupported" );
+        User::Leave(KErrNotSupported);
+        }
+    }
+    
+//-----------------------------------------------------------------------------
+//  CCmManagerImpl::IsDefConnSupported()
+//-----------------------------------------------------------------------------
+//
+TBool CCmManagerImpl::IsDefConnSupported(  )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::IsDefConnSupported" );
+
+    return iDefConnSupported;
+    }
+
+// -----------------------------------------------------------------------------
+// CCmManagerImpl::ReadGenConneSettingsL()
+// -----------------------------------------------------------------------------
+//
+void CCmManagerImpl::ReadGenConnSettingsL( TCmGenConnSettings& aGenConnSettings )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::ReadGenConnSettingsL" );
+
+    OpenTransactionLC();
+    CMDBRecordSet<CCDDefConnRecord>* defConnRecordSet = 
+        new ( ELeave ) CMDBRecordSet<CCDDefConnRecord>( iDefConnTableId );
+    CleanupStack::PushL( defConnRecordSet );
+     
+    defConnRecordSet->LoadL( Session() );
+
+    TInt value = QUERY_INT_FIELD( defConnRecordSet->iRecords[0], KCDTIdUsageOfWlan );
+    aGenConnSettings.iUsageOfWlan = TCmUsageOfWlan( value );
+
+    value = QUERY_INT_FIELD( defConnRecordSet->iRecords[0], KCDTIdSeamlessnessHome );
+    aGenConnSettings.iSeamlessnessHome = TCmSeamlessnessValue( value );
+
+    value = QUERY_INT_FIELD( defConnRecordSet->iRecords[0], KCDTIdSeamlessnessVisitor );
+    aGenConnSettings.iSeamlessnessVisitor = TCmSeamlessnessValue( value );
+            
+    CleanupStack::PopAndDestroy( defConnRecordSet );
+    RollbackTransaction();
+    }
+
+//-----------------------------------------------------------------------------
+//  CCmManagerImpl::ReplaceGenConnSettingsL()
+//-----------------------------------------------------------------------------
+//
+void CCmManagerImpl::ReplaceGenConnSettingsL( const TCmGenConnSettings& aGenConnSettings )
+    {
+    
+    LOGGER_ENTERFN( "CCmManagerImpl::ReplaceGenConnSettingsL" );	
+    	
+    TInt ret = KErrNone;
+    TCmDefConnValue defConn;
+
+    defConn.iType = TCmDefConnType ( 0 );
+    defConn.iId = 0;
+    
+    CMDBRecordSet<CCDDefConnRecord>* defConnRecordSet = 
+           new ( ELeave ) CMDBRecordSet<CCDDefConnRecord>( iDefConnTableId );
+    CleanupStack::PushL( defConnRecordSet );
+    
+    TRAP(ret, defConnRecordSet->LoadL(Session()));
+    
+    if (ret == KErrNone)
+        {
+        TInt type = QUERY_INT_FIELD( defConnRecordSet->iRecords[0], KCDTIdDefConnType);
+        defConn.iType = TCmDefConnType( type );
+        TInt id = QUERY_INT_FIELD( defConnRecordSet->iRecords[0], KCDTIdDefConnUid);
+        defConn.iId = id;
+        }
+    
+    TInt usageOfNewWlan = aGenConnSettings.iUsageOfWlan;
+    TInt seamlessnessHome    = aGenConnSettings.iSeamlessnessHome;
+    TInt seamlessnessVisitor = aGenConnSettings.iSeamlessnessVisitor;
+    
+    // Delete the old record
+    for ( TInt i = 0; i < defConnRecordSet->iRecords.Count(); ++i )
+        {
+        defConnRecordSet->iRecords[i]->DeleteL( Session() );
+        }
+    CleanupStack::PopAndDestroy( defConnRecordSet );
+
+    CCDDefConnRecord* dcRcd = 
+        new (ELeave) CCDDefConnRecord( iDefConnTableId );
+    CleanupStack::PushL( dcRcd ); // 2
+            
+    dcRcd->SetRecordId( KCDNewRecordRequest );
+
+    SET_INT_FIELD(dcRcd, KCDTIdDefConnType, defConn.iType);
+    SET_INT_FIELD(dcRcd, KCDTIdDefConnUid, defConn.iId);
+
+    CLOG_WRITE_1( "Set wlan usage: [%d]", usageOfNewWlan );
+    SET_INT_FIELD(dcRcd, KCDTIdUsageOfWlan, usageOfNewWlan );
+
+    CLOG_WRITE_1( "Set seamlessnessHome: [%d]", seamlessnessHome );
+    SET_INT_FIELD(dcRcd, KCDTIdSeamlessnessHome, seamlessnessHome );
+
+    CLOG_WRITE_1( "Set seamlessnessVisitor: [%d]", seamlessnessVisitor );
+    SET_INT_FIELD(dcRcd, KCDTIdSeamlessnessVisitor, seamlessnessVisitor );
+
+    dcRcd->StoreL( Session() );    
+    CleanupStack::PopAndDestroy( dcRcd );
+    }
+
+//-----------------------------------------------------------------------------
+//  CCmManagerImpl::WriteGenConnSettingsL()
+//-----------------------------------------------------------------------------
+//
+void CCmManagerImpl::WriteGenConnSettingsL( const TCmGenConnSettings& aGenConnSettings )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::WriteGenConnSettingsL" );    
+
+    OpenTransactionLC();
+
+    ReplaceGenConnSettingsL( aGenConnSettings );
+    CommitTransactionL( KErrNone );
+    }
+
+//-----------------------------------------------------------------------------
+//  CCmManagerImpl::IsMemoryLow()
+//-----------------------------------------------------------------------------
+//
+TBool CCmManagerImpl::IsMemoryLow()
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::IsMemoryLow" );
+
+    TBool ret( EFalse );
+    // Any plugin can be used here, because CheckSpaceBelowCriticalLevelL
+    // is defined in their father class CCmPluginBaseEng
+    TRAPD( err, ret = (*iPlugins)[0]->CheckSpaceBelowCriticalLevelL() );
+    if( err != KErrNone )
+        {
+        ret = ETrue;
+        return ret;
+        }
+    return ret;
+    }
+    
+// -----------------------------------------------------------------------------
+// CCmManagerImpl::SNAPRecordL
+// -----------------------------------------------------------------------------
+CCDSnapRecord* CCmManagerImpl::SNAPRecordL( TUint32 aRecordId ) const
+    {
+    CCDSnapRecord* record = new (ELeave) CCDSnapRecord( 
+                                 DestinationTableId() );
+
+    if( aRecordId )
+        {
+        record->SetRecordId( aRecordId );
+        
+        CleanupStack::PushL( record );
+        record->LoadL( Session() );
+        CleanupStack::Pop( record );
+        }
+    
+    return record;
+    }
+
+// -----------------------------------------------------------------------------
+// CCmManagerImpl::SNAPRecordL
+// -----------------------------------------------------------------------------
+CCDSnapRecord* CCmManagerImpl::CreateSNAPRecordL( TUint32 aRecordId ) const
+    {
+    CCDSnapRecord* record = new (ELeave) CCDSnapRecord( 
+        DestinationTableId() );
+
+    if( aRecordId )
+        {
+        record->SetRecordId( aRecordId );
+        }
+
+    return record;
+    }
+
+//-----------------------------------------------------------------------------
+//  CCmManagerImpl::WrapCmManager()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C void CCmManagerImpl::WrapCmManager( RCmManagerExt& aCmManagerExt )
+    {
+    aCmManagerExt.iImplementation = this;
+    }
+
+// --------------------------------------------------------------------------
+// CCmManagerImpl::FilterOutVirtualsL
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CCmManagerImpl::FilterOutVirtualsL( RPointerArray<CCmPluginBase>& aCmDataArray )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::FilterOutVirtualsL" );
+
+    TInt count = aCmDataArray.Count();
+    
+    for ( TInt i = 0; i < aCmDataArray.Count(); i++ )
+        {
+        if ( aCmDataArray[i]->GetBoolAttributeL( ECmVirtual ) )
+            {
+            delete aCmDataArray[i];
+            aCmDataArray.Remove(i);
+            i--;
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CCmManagerImpl::CreateFlatCMListLC
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CCmManagerImpl::CreateFlatCMListLC( TUint32 aDestinationId , 
+                                                RPointerArray<CCmPluginBase>& aCmArray )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::CreateFlatCMListLC" );
+
+    CreateFlatCMListL(aDestinationId, aCmArray);
+    CleanupResetAndDestroyPushL< RPointerArray<CCmPluginBase> >(aCmArray);
+    }
+    
+// --------------------------------------------------------------------------
+// CCmManagerImpl::CreateFlatCMListL
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CCmManagerImpl::CreateFlatCMListL( TUint32 aDestinationId , 
+                                                RPointerArray<CCmPluginBase>& aCmArray )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::CreateFlatCMListL" );
+    // get the uncategorised connection methods
+    if ( aDestinationId == KDestItemUncategorized ) 
+        {
+        AppendUncatCmListLC( aCmArray);
+        }
+    else
+        {
+        // Get the CM ids from the destination
+        AppendCmListLC( aDestinationId, aCmArray );
+        }
+    
+    // get the possible embedded destinations to be able to list their content, too
+    // we only have to check in cmArray
+    // put them in a sep. array and get their data into another.    
+    TInt cmCount = aCmArray.Count();
+    RArray<TUint32> cmEmbDestArray ( KCmArrayMediumGranularity );
+    CleanupClosePushL( cmEmbDestArray );
+    for ( TInt i = 0; i < cmCount; i++ )
+        {
+        if ( aCmArray[i]->GetBoolAttributeL( ECmDestination ) )
+            {
+            cmEmbDestArray.AppendL( aCmArray[i]->GetIntAttributeL( ECmId ) );
+            //remove embedded destination right now
+            delete aCmArray[i];
+            aCmArray.Remove(i);
+           // i--;
+            }
+        }
+    // now we stored the needed emb.dest, 
+    // we can filter out all virtual ones
+    //iCmManager.FilterOutVirtualsL( cmArray ); //no filtering here, we can do it later
+    
+    // now we have the list of emb.dest. inside current destination, 
+    // now get their CM's data appended to one flat list
+    RPointerArray<CCmPluginBase> cmLinkedDataArray ( KCmArrayMediumGranularity );
+    CleanupResetAndDestroyPushL< RPointerArray<CCmPluginBase> >( cmLinkedDataArray );
+    TInt embdestcount = cmEmbDestArray.Count();
+    for ( TInt i = 0; i < embdestcount; i++ )
+        {
+        // get the list of CM's
+        CCmPluginBase* emdestcm = 
+                    GetConnectionMethodL( cmEmbDestArray[i] );
+        CleanupStack::PushL( emdestcm );
+        TUint destUid = emdestcm->Destination()->Id();
+        AppendCmListL( destUid, cmLinkedDataArray );
+        CleanupStack::PopAndDestroy( emdestcm );    
+        }
+    // filter out virtuals
+    //iCmManager.FilterOutVirtualsL( cmLinkedDataArray ); //still no filtering here
+
+    // now we have the original, sorted list and an unsorted cmLinkedDataArray,
+    // add each element to original array with sorting
+
+    CombineArraysForPriorityOrderL( aCmArray, cmLinkedDataArray );
+
+    // now we do no longer need the linked array
+    CleanupStack::Pop( &cmLinkedDataArray );   // don't destroy the cm objects!
+    
+    cmLinkedDataArray.Close();                 // they are appended to aCmArray!!!
+    CleanupStack::PopAndDestroy( &cmEmbDestArray ); 
+    
+    CleanupStack::Pop(&aCmArray);     
+    }
+    
+// --------------------------------------------------------------------------
+// CCmManagerImpl::CombineCmListsL
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CCmManagerImpl::CombineArraysForPriorityOrderL( 
+                                        RPointerArray<CCmPluginBase>& aCmArray , 
+                                        RPointerArray<CCmPluginBase>& aCmLinkedArray )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::CombineArraysForPriorityOrderL" );
+
+    // now we have two arrays, the first is sorted as needed,
+    // the second is not.
+    // we have to insert the items from the second to the first into their 
+    // correct position based on the bearer type priorities
+    
+    // so loop on the second array, and for ech element, find it's place
+    TInt count = aCmLinkedArray.Count();
+    for ( TInt i = 0; i < count; i++ )
+        {
+        TUint32 linkedpriority( aCmLinkedArray[i]->GetIntAttributeL( ECmDefaultPriority ) );
+        // InsertItemL( aCmArray, aCmLinkedArray[i]);
+        // higher priority means smaller number
+        // if same priority elements exist, then 
+        // - we need to insert our element inside the elements 
+        //   of the same priority according to 
+        //   bearetypes and extension levels
+        // or before the first element having higher priority numbers.
+        TInt cc = aCmArray.Count();
+        if ( cc )
+            {
+            TInt ii = 0;
+            for ( ; ii < cc; ii++ )
+                {
+                if ( linkedpriority < aCmArray[ii]->GetIntAttributeL( ECmDefaultPriority ) )
+                    {
+                    // the next element already has larger number, 
+                    // we must insert it HERE
+                    break;
+                    }
+                else
+                    {
+                    // priorities either same, then we need to check bearer, 
+                    // ext.level, etc
+                    // or we simply still need to go to next element
+                    if ( linkedpriority == aCmArray[ii]->GetIntAttributeL( ECmDefaultPriority ))
+                        {
+                        // check if the same bearer
+                        if ( aCmArray[ii]->GetIntAttributeL( ECmBearerType ) == 
+                                    aCmLinkedArray[i]->GetIntAttributeL( ECmBearerType ) )
+                            {
+                            // we need to find the last one of these bearers, 
+                            // and insert after the last one
+                            do
+                                {
+                                ii++;
+                                }while ( ( ii < cc )
+                                        &&  (aCmArray[ii]->GetIntAttributeL( ECmBearerType ) == 
+                                            aCmLinkedArray[i]->GetIntAttributeL( ECmBearerType )) );
+                            // now we either found a correct place or 
+                            // we are at the end of the list
+                            break;
+                            }
+                        else
+                            {
+                            // diff. bearers, check Ext.level
+                            if ( aCmArray[ii]->GetIntAttributeL( ECmExtensionLevel ) < aCmLinkedArray[i]->GetIntAttributeL( ECmExtensionLevel ) )
+                                {
+                                break;
+                                }
+                            // if not, then go for the next one...
+                            }
+                        }
+                    }
+                }
+                // now we either found a correct place or 
+                // we are at the end of the list
+                // ( we break-ed for cycle when found the correct place )
+                if ( ii == cc )
+                    {
+                    // end of the list, append
+                    aCmArray.AppendL( aCmLinkedArray[i]);
+                    }
+                else
+                    {
+                    // we found the place to be inserted
+                    aCmArray.InsertL( aCmLinkedArray[i], ii );
+                    }   
+            }
+        else
+            {
+            // no elements in original array yet, 
+            // so simply append
+            aCmArray.AppendL( aCmLinkedArray[i]);
+            }
+        }
+    }
+
+
+// --------------------------------------------------------------------------
+// CCmManagerImpl::ParentDestinationL
+// --------------------------------------------------------------------------
+//
+TUint32 CCmManagerImpl::ParentDestinationL( TUint32 aCmId )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::ParentDestinationL" );
+
+    TUint32 retval(0);
+    
+    TUint32 destTblId = DestinationTableId();
+    CMDBRecordSet<CCDDataMobilitySelectionPolicyRecord>*  ptrRecordSet =
+         new (ELeave) CMDBRecordSet<CCDDataMobilitySelectionPolicyRecord>( 
+                                                                destTblId );
+    CleanupStack::PushL( ptrRecordSet );
+
+    // Prime record
+    CCDDataMobilitySelectionPolicyRecord* record = 
+                          new (ELeave) CCDDataMobilitySelectionPolicyRecord( 
+                                                        DestinationTableId() );
+    CleanupStack::PushL( record );
+    
+    record->iIAP = IAP_ELEMENT_ID( aCmId );
+    ptrRecordSet->iRecords.AppendL( record );
+    
+    CleanupStack::Pop( record );
+    record = NULL;
+            
+    if ( ptrRecordSet->FindL(Session()) )
+        {
+        // we have a match
+        retval = QUERY_INT_FIELD( (*ptrRecordSet)[0],
+                             KCDTIdDataMobilitySelectionPolicyNetwork );
+        
+        }
+    CleanupStack::PopAndDestroy( ptrRecordSet );        
+
+    return retval;
+    }
+
+// --------------------------------------------------------------------------
+// CCmManagerImpl::GetInternetDestinationIdL
+// --------------------------------------------------------------------------
+//
+TUint32 CCmManagerImpl::GetInternetDestinationIdL()
+    {
+    
+    LOGGER_ENTERFN( "CCmManagerImpl::GetInternetDestinationIdL" );
+   
+    TUint32 destId = 0;
+    
+    // Get all destinations
+    RArray<TUint32> destIdArray( KCmArrayBigGranularity );
+    AllDestinationsL( destIdArray );
+    CleanupClosePushL( destIdArray );
+    
+    CCmDestinationImpl* dest = NULL;
+    
+    for ( TInt i = 0; i < destIdArray.Count(); i++ )
+        {
+        dest = DestinationL( destIdArray[i] );
+        CleanupStack::PushL( dest );
+        
+        // Check if destination is internet
+        if ( dest->MetadataL(ESnapMetadataInternet) )
+            {
+            destId = destIdArray[i];
+            }
+
+        CleanupStack::PopAndDestroy( dest );
+
+        if ( destId )
+            {
+            break;
+            }
+        }
+        
+    CleanupStack::PopAndDestroy( &destIdArray );    
+    
+    return destId;    
+    }
+
+// -----------------------------------------------------------------------------
+// CCmManagerImpl::SetGenConnSettingsToDefault()
+// -----------------------------------------------------------------------------
+//
+void CCmManagerImpl::SetGenConnSettingsToDefault( TCmGenConnSettings& aGenConnSettings )
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::SetGenConnSettingsToDefault" );	
+    	
+    aGenConnSettings.iUsageOfWlan = ECmUsageOfWlanKnown;
+    aGenConnSettings.iSeamlessnessHome    = ECmSeamlessnessConfirmFirst;
+    aGenConnSettings.iSeamlessnessVisitor = ECmSeamlessnessConfirmFirst;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCmManagerImpl::CheckAvailableSpaceL()
+// -----------------------------------------------------------------------------
+//
+void CCmManagerImpl::CheckAvailableSpaceL()
+    {
+    LOGGER_ENTERFN( "CCmManagerImpl::CheckAvailableSpaceL" );
+    TBool belowCritical = SysUtil::FFSSpaceBelowCriticalLevelL( &(this->iFs), KBytesToWrite );
+    CLOG_WRITE_1( "belowCritical: [%d]", belowCritical );
+    if ( belowCritical )
+        {
+        User::Leave( KErrDiskFull );
+        }
+    }
+
+
+// --------------------------------------------------------------------------
+// CCmManagerImpl::WatcherRegisterL
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CCmManagerImpl::WatcherRegisterL( MCmCommsDatWatcher* aWatcher )
+    {
+    iCommsDatIapNotifier->WatcherRegisterL( aWatcher );
+    iCommsDatSnapNotifier->WatcherRegisterL( aWatcher );
+    }
+
+// --------------------------------------------------------------------------
+// CCmManagerImpl::WatcherUnRegister
+// --------------------------------------------------------------------------
+//    
+EXPORT_C void CCmManagerImpl::WatcherUnRegister()
+    {
+    iCommsDatIapNotifier->WatcherUnRegister();
+    iCommsDatSnapNotifier->WatcherUnRegister();
+    }
+
+// --------------------------------------------------------------------------
+// CCmManagerImpl::DestinationStillExistedL
+// --------------------------------------------------------------------------
+//
+EXPORT_C TBool CCmManagerImpl::DestinationStillExistedL( CCmDestinationImpl* aDest )
+    {
+    TUint32 destId = aDest->Id();
+    TBool found( EFalse );
+    TInt count;
+    
+    OpenTransactionLC();
+
+    CMDBRecordSet<CCDDataMobilitySelectionPolicyRecord>* destRecordSet = 
+           new ( ELeave ) CMDBRecordSet<CCDDataMobilitySelectionPolicyRecord>( 
+                                                             iDestinationTableId );
+    CleanupStack::PushL( destRecordSet );
+
+    TRAP_IGNORE( destRecordSet->LoadL( Session() ) );
+    
+    count = destRecordSet->iRecords.Count();
+    
+    for ( TInt i = 0; i < count; ++i )
+        {
+        TInt nwId = QUERY_INT_FIELD( destRecordSet->iRecords[i], 
+                                     KCDTIdDataMobilitySelectionPolicyNetwork );
+        //nwId = RECORD_FROM_ELEMENT_ID( nwId );
+        
+        if(  nwId == destId )
+            {
+            found = ETrue;
+            break;
+            }
+        }
+    
+    CleanupStack::PopAndDestroy( destRecordSet );
+    
+    RollbackTransaction();
+    
+    return found;
+    }
+
+// --------------------------------------------------------------------------
+// CCmManagerImpl::IapStillExistedL
+// --------------------------------------------------------------------------
+//
+EXPORT_C TBool CCmManagerImpl::IapStillExistedL( const CCmPluginBaseEng& aPlugin )
+    {
+    TUint32 iapId = aPlugin.GetIntAttributeL( ECmId );
+    CMDBRecordSet<CCDIAPRecord>*  ptrRecordSet = AllIapsL();
+    CleanupStack::PushL( ptrRecordSet );
+
+    TInt iapRecords = ptrRecordSet->iRecords.Count();
+
+    TBool found( EFalse );
+    for ( TInt i = 0; !found && i < iapRecords; i++ )
+        {
+        CCDIAPRecord* iapRecord = (*ptrRecordSet)[i];
+        
+        if( iapRecord->RecordId() == iapId )
+            {
+            found = ETrue;
+            break;
+            }
+        }
+    
+    CleanupStack::PopAndDestroy( ptrRecordSet );
+    
+    return found;
+    }
+
+// --------------------------------------------------------------------------
+// CCmManagerImpl::IsIapStillInDestL
+// --------------------------------------------------------------------------
+//
+EXPORT_C TBool CCmManagerImpl::IsIapStillInDestL( 
+        CCmDestinationImpl* aDest, 
+        const CCmPluginBaseEng& aPlugin )
+    {
+    TUint32 iapId = aPlugin.GetIntAttributeL( ECmId );
+    
+    aDest->ReLoadConnectionMethodsL();
+    RArray<TUint32> cmIds;
+    aDest->ConnectMethodIdArrayL( cmIds );
+    CleanupClosePushL( cmIds );
+
+    TBool found( EFalse );
+    for ( TInt i = 0; i < cmIds.Count(); i++ )
+        {
+        if( cmIds[i] == iapId )
+            {
+            found = ETrue;
+            break;
+            }
+        }
+    
+    CleanupStack::PopAndDestroy( &cmIds );
+    
+    return found;
+    }
+
+// --------------------------------------------------------------------------
+// CCmManagerImpl::GetSnapTableIdL
+// --------------------------------------------------------------------------
+//
+TUint32 CCmManagerImpl::GetSnapTableIdL()
+    {
+    TUint32 snapTableId;
+    
+    CMDBSession* db = CMDBSession::NewLC( CMDBSession::LatestVersion() );
+    db->SetAttributeMask( ECDHidden | ECDProtectedWrite );
+
+    snapTableId = CCDDataMobilitySelectionPolicyRecord::TableIdL( *db );
+
+    CleanupStack::PopAndDestroy( db );
+    
+    return snapTableId;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Src/cmobjectpool.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,343 @@
+/*
+* 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:  Implementation of CCMObjectPool.
+*
+*/
+
+
+#include "cmobjectpool.h"
+#include "cmmanagerimpl.h"
+#include <cmpluginbaseeng.h>
+#include <cmpluginbase.h>
+#include <cmconnectionmethoddef.h>
+
+#include <e32def.h>
+#include <e32std.h>
+
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+const TInt KDestGranularity     = 20;
+const TInt KCMethodGranularity  = 20;
+CCMObjectPool::CCMObjectPool(CCmManagerImpl& aCmManagerImpl) :
+        iCmManagerImpl(aCmManagerImpl),    
+        iDestinationArray(KDestGranularity, 
+            _FOFF(TObjectPoolDestinationItem,iDestinationId)),
+        iConnectionMethodArray(KCMethodGranularity, 
+            _FOFF(TObjectPoolCMItem,iConnectionMethodId))
+    {
+    }
+
+CCMObjectPool::~CCMObjectPool()
+    {
+    // The get and remove functions must be used in pairs
+    // If the arrays have any element here than the client 
+    // of this class made a programming error
+    for (TInt index = 0; index < iDestinationArray.Count(); index++)
+        {
+        delete iDestinationArray[index].iDestinationItem;
+        }    
+    for (TInt index = 0; index < iConnectionMethodArray.Count(); index++)
+        {
+        delete iConnectionMethodArray[index].iConnectionMethodItem;
+        }
+    iDestinationArray.Close();
+    iConnectionMethodArray.Close();
+    }
+
+CCMObjectPool::TObjectPoolDestinationItem::TObjectPoolDestinationItem(
+                        CCmDestinationData*   aDestinationItem, 
+                        TUint32               aDestinationId) : 
+                            iDestinationId(aDestinationId),
+                            iDestinationItem(aDestinationItem)
+    {
+    }
+    
+CCMObjectPool::TObjectPoolCMItem::TObjectPoolCMItem(
+                        CCmPluginBaseEng* aConnectionMethodItem, 
+                        TUint32           aConnectionMethodId) : 
+                            iConnectionMethodId(aConnectionMethodId),
+                            iConnectionMethodItem(aConnectionMethodItem)
+    {
+    }
+
+CCmDestinationImpl* CCMObjectPool::GetDestinationL( TUint32 aDestinationId )
+    {
+    TUint32 destinationId( aDestinationId );
+    if ( destinationId > 0 && destinationId < 255 )
+        {
+        destinationId += KCmDefaultDestinationAPTagId;
+        }
+    TObjectPoolDestinationItem findD( NULL, destinationId );
+    TInt index = iDestinationArray.FindInUnsignedKeyOrder(findD);
+    if (index == KErrNotFound)
+        {
+        // If the destinaton is not in the pool create it than return it.
+        CCmDestinationImpl* dest = CCmDestinationImpl::NewL( iCmManagerImpl, 
+                                                             destinationId );
+        TObjectPoolDestinationItem aDest( 
+            dest->GetData(),
+            destinationId );
+        User::LeaveIfError(
+            iDestinationArray.InsertInUnsignedKeyOrder(aDest));
+        dest->IncrementRefCounter();
+        return dest;
+        }
+    else
+        {
+        // If the destination is allready in the pool than return it.
+        CCmDestinationImpl* dest = CCmDestinationImpl::NewL( iCmManagerImpl, 
+                                iDestinationArray[index].iDestinationItem );
+        iDestinationArray[index].iDestinationItem->IncrementRefCounter();
+        return dest;    
+        }
+    }
+
+CCmPluginBase* CCMObjectPool::GetConnectionMethodL( TUint32 aCmId, 
+                                        CCmDestinationImpl* aParentDest )
+    {
+    CCmPluginBase* connMethod = NULL;
+    TObjectPoolCMItem findCM( NULL, aCmId );
+    TInt index = iConnectionMethodArray.FindInUnsignedKeyOrder(findCM);
+    if (index == KErrNotFound)
+        {
+        CCmPluginBaseEng* pluginBaseEng = iCmManagerImpl.DoFindConnMethL(
+                                                        aCmId, aParentDest);        
+        if (!pluginBaseEng) User::Leave(KErrNotFound); //There is no such plugin
+        CleanupStack::PushL( pluginBaseEng );        
+        connMethod = new (ELeave) CCmPluginBase(pluginBaseEng); 
+        CleanupStack::PushL( connMethod );        
+        TObjectPoolCMItem aCM( pluginBaseEng, aCmId );
+        User::LeaveIfError(
+            iConnectionMethodArray.InsertInUnsignedKeyOrder(aCM));
+        pluginBaseEng->IncrementRefCounter();
+        CleanupStack::Pop( connMethod );
+        CleanupStack::Pop( pluginBaseEng );
+        }
+    else
+        {
+        // If the cm is allready in the pool than return it.
+        iConnectionMethodArray[index].iConnectionMethodItem->IncrementRefCounter();
+        connMethod = new (ELeave) CCmPluginBase(
+                iConnectionMethodArray[index].iConnectionMethodItem); 
+        }
+    return connMethod;            
+    }
+
+CCmPluginBase* CCMObjectPool::CreateConnectionMethodL( CCmPluginBaseEng* pluginBaseEng )
+    {
+    CCmPluginBase* connMethod = new (ELeave) CCmPluginBase(pluginBaseEng); 
+    CleanupStack::PushL( connMethod );        
+    TObjectPoolCMItem aCM( pluginBaseEng, 0 );//The new id is zero till update
+    User::LeaveIfError(
+        iConnectionMethodArray.InsertInUnsignedKeyOrderAllowRepeats(aCM));
+    pluginBaseEng->IncrementRefCounter();
+    CleanupStack::Pop( connMethod );
+    return connMethod;            
+    }
+
+void CCMObjectPool::InsertConnectionMethodL( CCmPluginBaseEng* pluginBaseEng )
+    {       
+    TObjectPoolCMItem aCM( pluginBaseEng, 0 );//The new id is zero till update
+    User::LeaveIfError(
+        iConnectionMethodArray.InsertInUnsignedKeyOrderAllowRepeats(aCM));
+    pluginBaseEng->IncrementRefCounter();
+    }
+
+CCmPluginBase* CCMObjectPool::CreateConnectionMethodL( TUint32 aImplementationUid, 
+                                        TCmPluginInitParam& aParams )
+    {
+    CCmPluginBaseEng* pluginBaseEng = iCmManagerImpl.DoCreateConnectionMethodL(
+                                            aImplementationUid, aParams);
+    CleanupStack::PushL( pluginBaseEng );        
+    CCmPluginBase* connMethod = new (ELeave) CCmPluginBase(pluginBaseEng); 
+    CleanupStack::PushL( connMethod );        
+    TObjectPoolCMItem aCM( pluginBaseEng, 0 );//The new id is zero till update
+    User::LeaveIfError(
+        iConnectionMethodArray.InsertInUnsignedKeyOrderAllowRepeats(aCM));
+    pluginBaseEng->IncrementRefCounter();
+    CleanupStack::Pop( connMethod );
+    CleanupStack::Pop( pluginBaseEng );
+    return connMethod;            
+    }
+
+CCmPluginBase* CCMObjectPool::CreateConnectionMethodL( TUint32 aImplementationUid, 
+                                                       TCmPluginInitParam& aParams,
+                                                       TUint32 aConnMethodId )
+	{
+    CCmPluginBaseEng* pluginBaseEng = iCmManagerImpl.DoCreateConnectionMethodL(
+                                            aImplementationUid, 
+                                            aParams,
+                                            aConnMethodId);
+    CleanupStack::PushL( pluginBaseEng );
+    CCmPluginBase* connMethod = new (ELeave) CCmPluginBase(pluginBaseEng); 
+    CleanupStack::PushL( connMethod );        
+    TObjectPoolCMItem aCM( pluginBaseEng, 0 );//The new id is zero till update
+    User::LeaveIfError(
+        iConnectionMethodArray.InsertInUnsignedKeyOrderAllowRepeats(aCM));
+    pluginBaseEng->IncrementRefCounter();
+    CleanupStack::Pop( connMethod );
+    CleanupStack::Pop( pluginBaseEng );
+    return connMethod;            
+	}
+
+CCmDestinationImpl* CCMObjectPool::GetDestinationL( const TDesC& aName )
+    {
+    // CmManagerImpl.GetDestinationL will leave with KErrAlreadyExists 
+    // if the destination already exists
+    CCmDestinationImpl* destImpl = CCmDestinationImpl::NewL( iCmManagerImpl,
+         aName );
+    // Yet destImpl->Id() == 0
+    TObjectPoolDestinationItem aDest( destImpl->GetData(), destImpl->Id() );
+    // InsertInUnsignedKeyOrderAllowRepeats is used because all
+    // new destinations' Id is zero   
+    User::LeaveIfError(
+        iDestinationArray.InsertInUnsignedKeyOrderAllowRepeats(aDest) );
+    destImpl->IncrementRefCounter();
+    return destImpl;            
+    }
+
+CCmDestinationImpl* CCMObjectPool::CreateDestinationL( const TDesC& aName,
+                                                       TUint32 aDestId )
+    {
+    // CmManagerImpl.GetDestinationL will leave with KErrAlreadyExists 
+    // if the destination already exists
+    CCmDestinationImpl* destImpl = CCmDestinationImpl::NewL( iCmManagerImpl,
+                                                             aName,
+                                                             aDestId);
+    // Yet destImpl->Id() == 0
+    TObjectPoolDestinationItem aDest( destImpl->GetData(), destImpl->Id() );
+    // InsertInUnsignedKeyOrderAllowRepeats is used because all
+    // new destinations' Id is zero   
+    User::LeaveIfError(
+                   iDestinationArray.InsertInUnsignedKeyOrderAllowRepeats(aDest) );
+    destImpl->IncrementRefCounter();
+    return destImpl;            
+    }
+
+
+void CCMObjectPool::RemoveDestination( CCmDestinationData* aDestination )
+    {
+    if (aDestination->IdIsValid())
+        {
+        aDestination->DecrementRefCounter();
+        if (!aDestination->GetRefCounter())
+            {// this was the last reference -> must delete        
+            TObjectPoolDestinationItem findD( NULL, aDestination->Id() );
+            TInt index = iDestinationArray.FindInUnsignedKeyOrder(findD);
+            iDestinationArray.Remove(index);
+            delete aDestination;
+            }        
+        }
+    else
+        { // this is a new destination which hasn't been updated yet
+        // there may be more than one dest with id 0 -> must search by 
+        // iDestinationItem        
+        for (TInt index = 0; index < iDestinationArray.Count(); index++)
+            {
+            if ( iDestinationArray[index].iDestinationItem == 
+                 aDestination )
+                {
+                aDestination->DecrementRefCounter();
+                if (!aDestination->GetRefCounter())
+                    {// this was the last reference -> must delete        
+                    iDestinationArray.Remove(index);
+                    delete aDestination;
+                    }
+                break;    
+                }
+            }                
+        }
+    }
+
+void CCMObjectPool::RemoveDestination( CCmDestinationImpl* aDestination )
+    {
+    RemoveDestination(aDestination->GetData());
+    aDestination->SetData(NULL);
+    }
+
+void CCMObjectPool::DestinationUpdated( CCmDestinationImpl* aDestination )
+    {
+    // there may be more than one dest with id 0 -> must search by 
+    // iDestinationItem        
+    for (TInt index = 0; index < iDestinationArray.Count(); index++)
+        {
+        if ( iDestinationArray[index].iDestinationItem == 
+                aDestination->GetData() )
+            {
+            if (aDestination->IdIsValid()) break; //allready updated
+            iDestinationArray[index].iDestinationId = aDestination->Id();
+            iDestinationArray.SortUnsigned();
+            break;    
+            }
+        }        
+    }
+
+void CCMObjectPool::ConnMethodUpdatedL( CCmPluginBaseEng* aCM )
+    {
+    // there may be more than one dest with id 0 -> must search by 
+    // iDestinationItem        
+    for (TInt index = 0; index < iConnectionMethodArray.Count(); index++)
+        {
+        if ( iConnectionMethodArray[index].iConnectionMethodItem == 
+                aCM )
+            {
+            TInt cmId = aCM->GetIntAttributeL(CMManager::ECmId);
+            iConnectionMethodArray[index].iConnectionMethodId = cmId;
+            iConnectionMethodArray.SortUnsigned();
+            break;    
+            }
+        }        
+    }
+
+void CCMObjectPool::RemoveConnectionMethodL( CCmPluginBase* aCM)
+    {
+    RemoveConnectionMethodL(aCM->Plugin());
+    aCM->SetPlugin(NULL);
+    }
+
+void CCMObjectPool::RemoveConnectionMethodL( CCmPluginBaseEng* aCM)
+    {
+    if (aCM->IdIsValid())
+        {
+        aCM->DecrementRefCounter();
+        if (!aCM->GetRefCounter())
+            {// this was the last reference -> must delete        
+            TUint32 cmId = aCM->GetIntAttributeL(CMManager::ECmId);
+            TObjectPoolCMItem findD( NULL, cmId );
+            TInt index = iConnectionMethodArray.FindInUnsignedKeyOrder(findD);
+            iConnectionMethodArray.Remove(index);
+            delete aCM;
+            }        
+        }
+    else
+        { // this is a new cm which hasn't been updated yet
+        // there may be more than one cm with id 0 -> must search by pointer
+        for (TInt index = 0; index < iConnectionMethodArray.Count(); index++)
+            {
+            if ( iConnectionMethodArray[index].iConnectionMethodItem == aCM )
+                {
+                aCM->DecrementRefCounter();
+                if (!aCM->GetRefCounter())
+                    {// this was the last reference -> must delete        
+                    iConnectionMethodArray.Remove(index);
+                    delete aCM;
+                    }
+                break;    
+                }
+            }
+        }
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Src/cmpbasesettingsdlg.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,1493 @@
+/*
+* 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:  base class for connection method plugin dialogs
+*
+*/
+
+
+// INCLUDE FILES
+
+// System
+#include <cmmanager.rsg>
+#include <aknnavide.h>
+#include <StringLoader.h>
+#include <akntitle.h>
+#include <aknradiobuttonsettingpage.h>
+#include <data_caging_path_literals.hrh>
+#include <akntextsettingpage.h>
+#include <aknpasswordsettingpage.h>
+#include <in_sock.h>
+#include <aknmfnesettingpage.h>
+#include <AknQueryDialog.h>
+#include <featmgr.h>
+
+#include <hlplch.h>
+
+// User
+#include <mcmdexec.h>
+#include <cmpbasesettingsdlg.h>
+#include <cmmanager.h>
+#include <cmpluginbaseeng.h>
+#include "cmmanagerimpl.h"
+#include "cmmanager.hrh"
+#include <cmcommonui.h>
+#include <cmcommonconstants.h>
+#include <cmpsettingsconsts.h>
+#include "cmpluginmultilinedialog.h"
+#include "cmlogger.h"
+#include "ccmdexec.h"
+
+using namespace CMManager;
+
+// Maximum speed mapping
+struct TIPv6DNSMapping
+    {
+    TInt iResId;
+    TInt iSettingValue;
+    };
+
+// Mapping for IPv6 DNS types
+const TIPv6DNSMapping KTIPv6DNSItems[] =
+    {
+    { R_QTN_SET_DNS_SERVERS_AUTOMATIC, EIPv6Unspecified },
+    { R_QTN_SET_IP_WELL_KNOWN,         EIPv6WellKnown },
+    { R_QTN_SET_IP_USER_DEFINED,       EIPv6UserDefined },
+    { 0, 0 }
+    };
+    
+const TUint32 KMaxInt32Length = 10;
+
+// ================= MEMBER FUNCTIONS =======================================
+
+// --------------------------------------------------------------------------
+// CmPluginBaseSettingsDlg::ConstructAndRunLD
+// Constructs the dialog and runs it.
+// --------------------------------------------------------------------------
+//
+EXPORT_C TInt CmPluginBaseSettingsDlg::ConstructAndRunLD( )
+    {
+    CleanupStack::PushL( this );
+    FeatureManager::InitializeLibL();
+    iHelp = FeatureManager::FeatureSupported( KFeatureIdHelp ); 
+    FeatureManager::UnInitializeLib();
+    ConstructL( R_PLUGIN_BASE_MENUBAR );
+    PrepareLC( R_PLUGIN_BASE_DIALOG );
+    CleanupStack::Pop( this );
+    iSettingIndex = new ( ELeave ) CArrayFixFlat<TUint>( 4 );
+
+    if (!iHasSettingChanged)
+	    {
+        iHasSettingChanged = ETrue;
+        }
+
+    return RunLD();
+    }
+    
+    
+// --------------------------------------------------------------------------
+// CmPluginBaseSettingsDlg::CmPluginBaseSettingsDlg()
+// --------------------------------------------------------------------------
+//
+EXPORT_C  CmPluginBaseSettingsDlg::CmPluginBaseSettingsDlg( 
+                                          CCmPluginBaseEng& aCmPluginBase ) :
+        iCmPluginBaseEng( aCmPluginBase ),
+        iExitReason( KDialogUserBack ),
+        iResourceReader( *CCoeEnv::Static() ),
+        iIsPossibleToSaveSetting( ETrue ),
+        iHasSettingChanged( EFalse )
+    {
+    }
+   
+// --------------------------------------------------------------------------
+// CmPluginBaseSettingsDlg::~CApSelectorDialog
+// --------------------------------------------------------------------------
+//
+EXPORT_C CmPluginBaseSettingsDlg::~CmPluginBaseSettingsDlg()
+    {
+    // iModel is deleted by the ListBox because LB owns the model...
+    // of course only after we passed ownership...
+    if ( iNaviDecorator )
+        {
+        delete iNaviDecorator;
+        }
+    if ( iTitlePane )
+        {
+        // set old text back, if we have it...
+        if ( iOldTitleText )
+            {
+            TRAP_IGNORE( iTitlePane->SetTextL( *iOldTitleText ) );
+            delete iOldTitleText;
+            }
+        }       
+    if ( iSettingIndex )
+        {
+        delete iSettingIndex;
+        }
+    iResourceReader.Close();        
+
+    delete iCmdExec;
+    iCmdExec = NULL;
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginBaseSettingsDlg::PreLayoutDynInitL();
+// called by framework before dialog is shown
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CmPluginBaseSettingsDlg::PreLayoutDynInitL()
+    {
+    iListbox = STATIC_CAST( CAknSettingStyleListBox*, 
+                                           Control( KPluginBaseListboxId ) );
+    iListbox->CreateScrollBarFrameL( ETrue );
+    iListbox->ScrollBarFrame()->SetScrollBarVisibilityL
+                    ( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
+    iListbox->SetListBoxObserver( this );
+
+    HandleListboxDataChangeL();
+    iListbox->HandleItemAdditionL();
+    InitTextsL();
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginBaseSettingsDlg::UpdateListBoxContentL
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CmPluginBaseSettingsDlg::UpdateListBoxContentL()
+    {        
+    // Must save listbox indexes because content will be deleted
+    TInt lastListBoxPos = iListbox->CurrentItemIndex();
+    TInt lastListBoxTopPos = iListbox->TopItemIndex();
+
+    // deleting listbox content
+    MDesCArray* itemList = iListbox->Model()->ItemTextArray();
+    CDesCArray* itemArray = (CDesCArray*)itemList;
+    
+    while ( itemArray->Count() )
+        {
+        itemArray->Delete( 0 );
+        }
+    while ( iSettingIndex->Count() )
+        {
+        iSettingIndex->Delete( 0 );
+        }
+
+    // CONNECTION NAME
+    AppendSettingTextsL( *itemArray, ECmName );
+
+    // BEARER SPECIFIC SETTINGS
+    UpdateListBoxContentBearerSpecificL( *itemArray );
+
+    //-----------------------------------------------------------------------
+    // Handle content changes
+    iListbox->Reset();
+    iListbox->HandleItemAdditionL();
+    
+    // Listbox might not have index
+    if ( lastListBoxPos != -1 )
+        {
+        iListbox->SetCurrentItemIndex( lastListBoxPos );
+        iListbox->SetTopItemIndex( lastListBoxTopPos );
+        }
+    iListbox->DrawNow();
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginBaseSettingsDlg::AppendSettingTextsL
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CmPluginBaseSettingsDlg::AppendSettingTextsL( 
+                                                    CDesCArray& aItemArray,
+                                                    const TInt aSettingItemId,
+                                                    const TInt aValueResId )
+    {
+    HBufC* value = StringLoader::LoadLC( aValueResId );
+
+    AppendSettingTextsL( aItemArray, aSettingItemId, value );
+    
+    CleanupStack::PopAndDestroy( value );
+    }
+    
+// --------------------------------------------------------------------------
+// CmPluginBaseSettingsDlg::AppendSettingTextsL
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CmPluginBaseSettingsDlg::AppendSettingTextsL( 
+                                            CDesCArray& aItemArray,
+                                            const TInt aSettingItemId,
+                                            const HBufC* aValueString )
+    {
+    const TCmAttribConvTable* convItem = 
+                        iCmPluginBaseEng.ConvTableItem( aSettingItemId );
+    HBufC* value = NULL;
+    
+    if ( aValueString )
+        {
+        value = (HBufC*)aValueString;
+        }
+    else
+        {
+        if ( convItem->iAttribFlags & EConvNumber )
+            {
+            TUint32 num = iCmPluginBaseEng.GetIntAttributeL( aSettingItemId );
+            
+            if( !num && convItem->iDefSettingResId )
+                {
+                value = StringLoader::LoadL( convItem->iDefSettingResId );
+                }
+            else
+                {
+                value = HBufC::NewL( KMaxInt32Length );
+                value->Des().AppendNum( num );
+
+                TPtr number( value->Des() );
+                AknTextUtils::LanguageSpecificNumberConversion( number );
+                }
+            }
+        else
+            {
+            if( convItem->iAttribFlags & EConv8Bits )
+                // make 16bits copy of this 8bits buffer
+                {
+                HBufC8* value8 = iCmPluginBaseEng.GetString8AttributeL( aSettingItemId );
+                CleanupStack::PushL( value8 );
+                value = HBufC::NewL( value8->Length() );
+                value->Des().Copy( *value8 );
+                CleanupStack::PopAndDestroy( value8 );
+                }
+            else
+                {   
+                value = iCmPluginBaseEng.GetStringAttributeL( aSettingItemId );
+                }
+                
+            if ( convItem->iDefSettingResId )
+                // We have default value in resource.
+                // Check if we have use it, instead of current value.
+                {
+                if ( convItem->iAttribFlags & EConvIPv4 )
+                    // This is an IPv4 text attribute
+                    {
+                    if ( IsUnspecifiedIPv4Address( *value ) )
+                        // Use default value from resource instead of
+                        // displaying unspecified IP address
+                        {
+                        delete value; value = NULL;
+                        }
+                    }
+                else if ( convItem->iAttribFlags & EConvIPv6 )
+                    // This is an IPv4 text attribute
+                    {
+                    }
+                else if( convItem->iAttribFlags & EConvPassword )
+                    // In case of password, we can show only the resource 
+                    // string.
+                    {
+                    delete value; value = NULL;
+                    }
+                else if ( *value == KNullDesC && convItem->iDefSettingResId )
+                    // empty string, but it has a default value in resource
+                    // Use the resource value.
+                    {
+                    delete value; value = NULL;
+                    }
+                    
+                if ( !value )
+                    // use default value from resource.
+                    {
+                    value = StringLoader::LoadL( convItem->iDefSettingResId );
+                    }
+                }
+            }
+
+        CleanupStack::PushL( value );
+        }
+
+    HBufC* title = StringLoader::LoadLC( convItem->iTitleId );
+
+    _LIT( KSettingListFormat, "\t%S\t\t%S" );
+    HBufC* itemTextBuf = HBufC::NewLC( KSettingListFormat().Length() + 
+                                       title->Length() +
+                                       value->Length() + 
+                                       KTxtCompulsory().Length() );
+                                       
+    TPtr itemText = itemTextBuf->Des();
+
+    itemText.Format( KSettingListFormat, title, value ); 
+    
+    // indicator for compulsory settings
+    if ( convItem->iAttribFlags & EConvCompulsory )
+        {
+        itemText.Append( KTxtCompulsory );        
+        }
+        
+    aItemArray.AppendL( itemText );
+    CleanupStack::PopAndDestroy( 2, title ); // itemTextBuf, title
+
+    if ( !aValueString )
+        {
+        CleanupStack::PopAndDestroy( (HBufC*)value );
+        }
+        
+    iSettingIndex->AppendL( aSettingItemId );
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginBaseSettingsDlg::AppendSettingTextsL
+// --------------------------------------------------------------------------
+//
+
+EXPORT_C void CmPluginBaseSettingsDlg::AppendSettingTextsL(   
+                                              CDesCArray& aItemArray,
+                                              const TInt aSettingItemId,
+                                              const TInt aTitleResId,
+                                              const TInt aValueResId,
+                                              const TBool aCompulsory ) const
+    {
+    HBufC* value = NULL;
+    if ( aValueResId )
+        {
+        value = StringLoader::LoadLC( aValueResId );
+        }
+    else
+        {   
+        value = KNullDesC().AllocL();
+        CleanupStack::PushL( value );
+        }        
+    TPtr ptrValue = value->Des();
+    
+    AppendSettingTextsL( aItemArray, aSettingItemId, 
+                                        aTitleResId, ptrValue, aCompulsory );
+    
+    CleanupStack::PopAndDestroy( value );
+    }
+    
+// --------------------------------------------------------------------------
+// CmPluginBaseSettingsDlg::AppendSettingTextsL
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CmPluginBaseSettingsDlg::AppendSettingTextsL(   
+                                              CDesCArray& aItemArray,
+                                              const TInt aSettingItemId,
+                                              const TInt aTitleResId,
+                                              const TDesC& aValueString,
+                                              const TBool aCompulsory ) const
+    {
+    // Title
+    HBufC* title = StringLoader::LoadLC( aTitleResId );
+
+    _LIT( KSettingListFormat, "\t%S\t\t%S" );
+    HBufC* itemTextBuf = HBufC::NewLC( KSettingListFormat().Length() + 
+                                       title->Length() +
+                                       aValueString.Length() + 
+                                       KTxtCompulsory().Length() );
+                                       
+    TPtr itemText = itemTextBuf->Des();
+
+    itemText.Format( KSettingListFormat, title, &aValueString ); 
+    
+    // indicator for compulsory settings
+    if ( aCompulsory )
+        {
+        itemText.Append( KTxtCompulsory );        
+        }
+        
+    aItemArray.AppendL( itemText );
+    CleanupStack::PopAndDestroy( 2, title ); // itemTextBuf, title
+    iSettingIndex->AppendL( aSettingItemId );
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginBaseSettingsDlg::DynInitMenuPaneL
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CmPluginBaseSettingsDlg::DynInitMenuPaneL( 
+                                               TInt aResourceId,
+                                               CEikMenuPane* aMenuPane  )
+    {
+    CAknDialog::DynInitMenuPaneL( aResourceId, aMenuPane );
+        
+    if ( aResourceId == R_PLUGIN_BASE_MENU )
+        {
+    	if (!iHelp)
+            {
+            aMenuPane->DeleteMenuItem( EAknCmdHelp );		    
+            }
+        TInt currentItem = iSettingIndex->At( iListbox->CurrentItemIndex() );
+        if ( currentItem == ECmBearerSettingName )
+            {
+            
+            aMenuPane->SetItemDimmed( EPluginBaseCmdChange, ETrue );
+            }
+        }
+    }
+    
+// --------------------------------------------------------------------------
+// CmPluginBaseSettingsDlg::ProcessCommandL
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CmPluginBaseSettingsDlg::ProcessCommandL( TInt aCommandId )
+    {
+    if ( MenuShowing() )
+        {
+        HideMenu();
+        }
+
+    switch ( aCommandId )
+        {
+        case EAknSoftkeyOptions:
+            {
+            DisplayMenuL();
+            break;
+            }
+        case EPluginBaseCmdExit:
+            {
+            iExitReason = KDialogUserExit;
+            if( iIsPossibleToSaveSetting && iHasSettingChanged )
+            {
+                iCmPluginBaseEng.UpdateL();
+                iHasSettingChanged = EFalse;
+            }
+
+            TryExitL( iExitReason );
+            break;
+            }
+        case EAknSoftkeyOk:
+        case EAknSoftkeyChange:
+            {
+            // Function CheckSpaceBelowCriticalLevelL may User::Leave with KLeaveWithoutAlert
+            // if no space available to save changes. The User::Leave message will be caught
+            // by iCmdExec. So,it is not caught here.
+            iCmPluginBaseEng.CheckSpaceBelowCriticalLevelL();
+
+            ShowPopupSettingPageL( 
+                    iSettingIndex->At( iListbox->CurrentItemIndex() ), 
+                                        aCommandId );
+
+            break;            
+            }
+        case EAknCmdHelp:
+            {
+            // Help context (the default value) has been set so this value is used.
+            HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(),
+                                iEikonEnv->EikAppUi()->AppHelpContextL() );
+            }
+            break;
+        default:
+            {
+            break;
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginBaseSettingsDlg::InitTextsL
+// called before the dialog is shown
+// to initialize localized textual data
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CmPluginBaseSettingsDlg::InitTextsL()
+    {
+    // set pane text if neccessary...
+    // pane text needed if not pop-up...
+    if ( iEikonEnv )
+        {
+        iStatusPane = iEikonEnv->AppUiFactory()->StatusPane();
+        iTitlePane = ( CAknTitlePane* )iStatusPane->ControlL(
+                                TUid::Uid( EEikStatusPaneUidTitle ) );
+
+        iOldTitleText = iTitlePane->Text()->AllocL();
+        HBufC* pdConnName = iCmPluginBaseEng.GetStringAttributeL( ECmName );
+        CleanupStack::PushL( pdConnName ); // 1
+                
+        if ( pdConnName )
+            {
+            iTitlePane->SetTextL( *pdConnName );
+            }
+        else
+            {
+            iTitlePane->SetTextL( KNullDesC );
+            }        
+        CleanupStack::PopAndDestroy( pdConnName ); // 0
+
+
+        iNaviPane = ( CAknNavigationControlContainer* )iStatusPane->ControlL(
+                                        TUid::Uid( EEikStatusPaneUidNavi ) );
+        iNaviDecorator = iNaviPane->CreateNavigationLabelL( KNullDesC );
+        iNaviPane->PushL( *iNaviDecorator );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginBaseSettingsDlg::OkToExitL
+// Good to know : EAknSoftkeyCancel is never called, because
+// EEikDialogFlagNotifyEsc flag is not set in the resource.
+// --------------------------------------------------------------------------
+//
+EXPORT_C TBool CmPluginBaseSettingsDlg::OkToExitL( TInt aButtonId )
+    {
+    // Translate the button presses into commands for the appui & current
+    // view to handle
+    TBool retval( EFalse );
+    
+    switch ( aButtonId )
+        {
+        case EAknSoftkeyOk:
+        case EAknSoftkeyChange:
+            {
+            ProcessCommandL( aButtonId );
+            break;
+            }        
+        case EAknSoftkeyBack:
+        case EAknSoftkeyExit:
+        case KDialogUserExit:
+            {
+            
+            if ( iIsPossibleToSaveSetting && iHasSettingChanged )
+            {
+                iCmPluginBaseEng.UpdateL();
+                iHasSettingChanged = EFalse;
+            }
+            retval = ETrue;
+            break;
+            }
+        case EAknSoftkeyOptions:
+            {
+            DisplayMenuL();
+            break;
+            }
+        default:
+            {
+            retval = ETrue;
+            break;
+            }
+        }
+
+    return retval;
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginBaseSettingsDlg::HandleListBoxEventL
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CmPluginBaseSettingsDlg::HandleListBoxEventL( 
+                        CEikListBox* /*aListBox*/, TListBoxEvent aEventType )
+    {
+    switch ( aEventType )
+        {
+        case EEventEnterKeyPressed:
+        case EEventItemSingleClicked:
+            {
+            if ( !iProcessing )
+                {
+                delete iCmdExec;
+                iCmdExec = NULL;
+                iCmdExec = new (ELeave) CCmdExec(*this);
+                iCmdExec->Execute();
+                }
+            break;
+            }
+        case EEventEditingStarted:
+            {
+            break;
+            }
+        case EEventEditingStopped:
+            {
+            break;
+            }
+        default:
+            {
+            break;
+//            User::Leave( KErrNotSupported );
+            }
+        }
+    }
+
+//---------------------------------------------------------------------------
+// CmPluginBaseSettingsDlg::LoadResourceL
+//---------------------------------------------------------------------------
+//
+EXPORT_C TInt CmPluginBaseSettingsDlg::LoadResourceL ( 
+                                                const TDesC& aResFileName )
+    {
+    TInt err( KErrNone );
+    // Add resource file.
+    TParse* fp = new ( ELeave ) TParse();
+    err = fp->Set( aResFileName, 
+                        &KDC_RESOURCE_FILES_DIR, 
+                        NULL ); 
+    if ( err )
+        {
+        User::Leave( err );
+        }   
+
+    TFileName resourceFileNameBuf = fp->FullName();
+    delete fp;
+
+    iResourceReader.OpenL( resourceFileNameBuf );
+    return err;
+    }
+
+//---------------------------------------------------------------------------
+// CmPluginBaseSettingsDlg::HandleListboxDataChangeL
+// called before the dialog is shown to initialize listbox data
+//---------------------------------------------------------------------------
+//
+EXPORT_C void CmPluginBaseSettingsDlg::HandleListboxDataChangeL()
+    {
+    UpdateListBoxContentL();
+    iListbox->HandleItemAdditionL();
+    }
+
+//---------------------------------------------------------------------------
+// CmPluginBaseSettingsDlg::ShowPopupSettingPageL
+//---------------------------------------------------------------------------
+//
+EXPORT_C TBool CmPluginBaseSettingsDlg::ShowPopupSettingPageL( 
+                                           TUint32 aAttribute, TInt /*aCommandId*/ )
+    {
+    TBool retval( EFalse );
+    
+    switch ( aAttribute )
+        {
+        case ECmBearerSettingName:
+            {
+            TCmCommonUi::ShowNoteL ( R_PLUGIN_BASE_INFO_BEARER_NOT_EDITABLE,
+                                                  TCmCommonUi::ECmInfoNote );
+            break;
+            }
+        case ECmName:
+        default:
+            {
+            retval = ShowPopupTextSettingPageL( aAttribute );
+            break;
+            }
+        }
+    return retval;
+    }
+    
+//---------------------------------------------------------------------------
+// CmPluginBaseSettingsDlg::SelectItem
+//---------------------------------------------------------------------------
+//
+EXPORT_C void CmPluginBaseSettingsDlg::SelectItem( TInt aItemIndex )
+    {
+    iListbox->ScrollToMakeItemVisible( aItemIndex );
+    iListbox->SetCurrentItemIndexAndDraw( aItemIndex );
+    }
+    
+//---------------------------------------------------------------------------
+// CmPluginBaseSettingsDlg::StringAttributeWithDefaultL
+//---------------------------------------------------------------------------
+//
+EXPORT_C HBufC* CmPluginBaseSettingsDlg::StringAttributeWithDefaultL( 
+                                        TUint32 aAttribute, TUint32 aDefRes )
+    {
+    HBufC* value = iCmPluginBaseEng.GetStringAttributeL( aAttribute );
+    if ( *value == KNullDesC )
+        {
+        delete value;
+        value = NULL;
+        value = StringLoader::LoadL( aDefRes );
+        }
+
+    return value;
+    }
+   
+// --------------------------------------------------------------------------
+// CmPluginBaseSettingsDlg::GetHelpContext
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CmPluginBaseSettingsDlg::GetHelpContext( TCoeHelpContext& aContext ) const
+    {
+    aContext.iMajor = KHelpUidPlugin;
+    aContext.iContext = iHelpContext;
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginBaseSettingsDlg::ShowPopupIpSettingPageL
+// --------------------------------------------------------------------------
+//
+EXPORT_C TBool CmPluginBaseSettingsDlg::ShowPopupIpSettingPageL( 
+                                                            TUint32 aAttribute,
+                                                            TUint32 aTitleId )
+    
+    {
+    TBool retval = EFalse;
+    const TCmAttribConvTable* convItem = 
+                        iCmPluginBaseEng.ConvTableItem( aAttribute );
+    
+    HBufC* servName = HBufC::NewLC( convItem->iMaxLength );
+    TPtr ptrServName ( servName->Des() );
+     
+    HBufC* orig = iCmPluginBaseEng.GetStringAttributeL( aAttribute );    
+    CleanupStack::PushL( orig );
+    ptrServName.Copy( *orig );
+    
+    TInetAddr addr;
+    addr.Input( ptrServName );
+    
+    TInt resId = EditorId( convItem->iEditorResId, R_TEXT_SETTING_PAGE_IP );
+    
+    CAknIpFieldSettingPage* dlg = 
+                    new ( ELeave ) CAknIpFieldSettingPage( 
+                                       resId, 
+                                       addr );
+
+    CleanupStack::PushL( dlg );
+    SetTitleL( dlg, convItem->iTitleId, aTitleId );
+    CleanupStack::Pop( dlg );
+
+    if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenAccepted ) )
+        {
+        addr.Output( ptrServName );
+        
+        if ( orig->Des().CompareF( ptrServName ) )
+            // User modified IP address
+            {
+            iCmPluginBaseEng.SetStringAttributeL( aAttribute, ptrServName );
+            retval = ETrue;  
+            UpdateListBoxContentL();                                                                                     
+            }
+        }
+
+    CleanupStack::PopAndDestroy( 2, servName ); // orig, servName
+    return retval;
+    }
+    
+// --------------------------------------------------------------------------
+// CmPluginBaseSettingsDlg::ShowRadioButtonSettingPageL
+// --------------------------------------------------------------------------
+//
+EXPORT_C TInt CmPluginBaseSettingsDlg::ShowRadioButtonSettingPageL( 
+                                                const TUint32* aResIds, 
+                                                TInt& aCurrentItem,
+                                                TUint32 aTitleId )
+    {
+    CDesCArrayFlat* items = 
+                   new ( ELeave ) CDesCArrayFlat( KCmArraySmallGranularity );
+            
+    CleanupStack::PushL( items );
+    TInt count( 0 );       
+    for( ; aResIds[count]; ++count )
+        {
+        HBufC* item = StringLoader::LoadLC( aResIds[count] );
+        items->AppendL( *item );
+        }
+        
+    TUint32 resId = EditorId( 0, R_RADIO_BUTTON_SETTING_PAGE_OK_CANCEL );
+    CAknRadioButtonSettingPage* dlg = 
+                            new ( ELeave ) CAknRadioButtonSettingPage(
+                                    resId,
+                                    aCurrentItem, 
+                                    items );
+    CleanupStack::PushL( dlg );
+    SetTitleL( dlg, 0, aTitleId );
+    CleanupStack::Pop( dlg );
+
+    TBool retVal = dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged );    
+    
+    CleanupStack::PopAndDestroy( count );   // selection items
+    CleanupStack::PopAndDestroy( items );
+    
+    return retVal;
+    }
+    
+// --------------------------------------------------------------------------
+// CmPluginBaseSettingsDlg::ShowRadioButtonSettingPageL
+// --------------------------------------------------------------------------
+//
+EXPORT_C TInt CmPluginBaseSettingsDlg::ShowRadioButtonSettingPageL( 
+                                                CDesCArrayFlat& aItems, 
+                                                TInt& aCurrentItem,
+                                                TUint32 aTitleId )
+    {
+    TUint32 resId = EditorId( 0, R_RADIO_BUTTON_SETTING_PAGE_OK_CANCEL );
+    CAknRadioButtonSettingPage* dlg = 
+                            new ( ELeave ) CAknRadioButtonSettingPage(
+                                    resId,
+                                    aCurrentItem, 
+                                    &aItems );
+    CleanupStack::PushL( dlg );
+    SetTitleL( dlg, 0, aTitleId );
+    CleanupStack::Pop( dlg );
+
+    TBool retVal = dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged );    
+
+    return retVal;
+    }
+    
+//---------------------------------------------------------------------------
+// CmPluginBaseSettingsDlg::ShowPopupTextSettingPageL
+//---------------------------------------------------------------------------
+//
+EXPORT_C TBool CmPluginBaseSettingsDlg::ShowPopupTextSettingPageL( 
+                                                            TUint32 aAttribute,
+                                                            TUint32 aTitleId )
+    {    
+    TBool retval( EFalse );
+    const TCmAttribConvTable* convItem = 
+                        iCmPluginBaseEng.ConvTableItem( aAttribute );
+    
+    HBufC* textToChange = HBufC::NewLC( convItem->iMaxLength );
+    TPtr ptrTextToChange( textToChange->Des() );
+
+    HBufC* value = HBufC::NewLC( convItem->iMaxLength );
+    if ( convItem->iAttribFlags & EConv8Bits )
+        // convert 8bits attribute to 16bits
+        {
+        HBufC8* stringFromCm = 
+                iCmPluginBaseEng.GetString8AttributeL( aAttribute );
+        value->Des().Copy( *stringFromCm );
+
+        delete stringFromCm; stringFromCm = NULL;
+        }
+    else
+        {
+        HBufC* stringFromCm = 
+                iCmPluginBaseEng.GetStringAttributeL( aAttribute );
+        value->Des().Copy( *stringFromCm );
+
+        delete stringFromCm; stringFromCm = NULL;
+        }
+        
+    if( *value == KNullDesC && convItem->iDefValueResId )
+        // empty string is replaced with the default value from resource
+        {
+        HBufC* stringFromCm = StringLoader::LoadL( convItem->iDefValueResId );
+                
+        value->Des().Copy( *stringFromCm );
+
+        delete stringFromCm; stringFromCm = NULL;
+        }
+   
+    TPtr ptrValue( value->Des() );
+    ptrTextToChange.Copy( ptrValue );
+    
+    TInt textSettingPageFlags( EAknSettingPageNoOrdinalDisplayed );
+    
+    if ( !(convItem->iAttribFlags & EConvNoZeroLength) )
+        {
+        textSettingPageFlags = CAknTextSettingPage::EZeroLengthAllowed;
+        }
+
+    TUint32 resId = EditorId( convItem->iEditorResId, 0 );
+
+    CAknTextSettingPage* dlg = new ( ELeave ) CAknTextSettingPage( 
+                                    resId, 
+                                    ptrTextToChange, 
+                                    textSettingPageFlags );
+
+    CleanupStack::PushL( dlg );
+    SetTitleL( dlg, convItem->iTitleId, aTitleId );
+    CleanupStack::Pop( dlg );
+
+    if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenAccepted ) )
+        {
+        if ( aAttribute == ECmName )
+            {
+            iTitlePane->SetTextL( ptrTextToChange );                                                                          
+            }
+        if ( ptrTextToChange.Compare( ptrValue ) )
+            // user modified the value
+            {
+            if ( convItem->iAttribFlags & EConv8Bits )
+                // convert back from 16bits to 8bits
+                {
+                HBufC8* stringTo = HBufC8::NewLC( ptrTextToChange.Length() );
+                
+                stringTo->Des().Copy( ptrTextToChange );
+                iCmPluginBaseEng.SetString8AttributeL( aAttribute, *stringTo );
+                                                                   
+                CleanupStack::PopAndDestroy( stringTo );
+                }
+            else
+                {
+                if( aAttribute == ECmName )
+                    {
+                    SetUniqueNameL( ptrTextToChange );
+                    }
+                else
+                    {
+                    iCmPluginBaseEng.SetStringAttributeL( aAttribute, 
+                                                      ptrTextToChange );
+                    }    
+                }
+                
+            retval = ETrue;
+            UpdateListBoxContentL();
+            }
+        }
+
+    CleanupStack::PopAndDestroy( 2, textToChange );
+    return retval;
+    }
+
+
+void CmPluginBaseSettingsDlg::SetUniqueNameL( TPtr aPtrTextToChange )
+    {
+     // Saves the recent naming method and set it to "Not accept"
+    TUint32 savedNM = iCmPluginBaseEng.GetIntAttributeL( ECmNamingMethod );
+    iCmPluginBaseEng.SetIntAttributeL( ECmNamingMethod, ENamingNotAccept );
+
+    // Tries to save the nem name. If it is not unique
+    // then ret == KErrArgument
+    TRAPD( err, iCmPluginBaseEng.SetStringAttributeL( ECmName, aPtrTextToChange ) );
+
+    if( KErrArgument == err )
+        {
+        // Opens a info note
+        HBufC* noteLine = StringLoader::LoadLC(
+                    R_CMMANAGERUI_INFO_DEST_ALREADY_IN_USE, aPtrTextToChange );
+
+        TCmCommonUi::ShowNoteL( *noteLine, TCmCommonUi::ECmInfoNote );
+
+        CleanupStack::PopAndDestroy( noteLine );
+        }
+
+    // Sets back the original naming method
+    iCmPluginBaseEng.SetIntAttributeL( ECmNamingMethod, savedNM );
+    }
+
+
+
+//---------------------------------------------------------------------------
+// CmPluginBaseSettingsDlg::ShowPopupPasswordSettingPageL
+//---------------------------------------------------------------------------
+//
+EXPORT_C TBool CmPluginBaseSettingsDlg::ShowPopupPasswordSettingPageL( 
+                                                        TUint32 aAttribute,
+                                                        TUint32 aTitleId )
+    {
+    TBool retVal( EFalse );
+
+    const TCmAttribConvTable* convItem = 
+                        iCmPluginBaseEng.ConvTableItem( aAttribute );
+    HBufC* newPassword = HBufC::NewLC( KCmMaxPasswordLength );
+    TPtr16 ptrNewPassword = newPassword->Des();
+    
+    HBufC* oldPassword = NULL;
+    oldPassword = iCmPluginBaseEng.GetStringAttributeL( aAttribute );
+    CleanupStack::PushL( oldPassword );   
+    
+    TUint32 resId = EditorId( convItem->iEditorResId, 
+                              R_TEXT_SETTING_PAGE_PASSWD );
+    CAknAlphaPasswordSettingPage* dlg = 
+                    new ( ELeave ) CAknAlphaPasswordSettingPage(
+                                            resId,
+                                            ptrNewPassword,
+                                            *oldPassword );
+    CleanupStack::PushL( dlg );
+    SetTitleL( dlg, convItem->iTitleId, aTitleId );
+    CleanupStack::Pop( dlg );
+
+    if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )
+        {
+        iCmPluginBaseEng.SetStringAttributeL( aAttribute, newPassword->Des() );
+        UpdateListBoxContentL();
+
+        retVal = ETrue;
+        }
+    CleanupStack::PopAndDestroy( 2, newPassword );
+    
+    return retVal;
+    }
+
+//---------------------------------------------------------------------------
+// CmPluginBaseSettingsDlg::ShowNumSettingPageL
+//---------------------------------------------------------------------------
+//
+EXPORT_C TBool CmPluginBaseSettingsDlg::ShowPopupPortNumSettingPageL( 
+                                    TUint32 aAttribute, TUint32 aTitleId )
+    {
+    TBool retVal( EFalse );
+    const TCmAttribConvTable* convItem = 
+                        iCmPluginBaseEng.ConvTableItem( aAttribute );
+
+    TInt value( 0 );
+    value = iCmPluginBaseEng.GetIntAttributeL( aAttribute );
+
+    TInt origVal = value;
+    
+    HBufC* buf = HBufC::NewLC( convItem->iMaxLength );
+    TPtr ptr( buf->Des() );
+    
+    ptr.Num( value );
+    
+    TInt flags = EAknSettingPageNoOrdinalDisplayed;
+    
+    if ( !(convItem->iAttribFlags & EConvNoZeroLength) )
+        {
+        flags |= CAknTextSettingPage::EZeroLengthAllowed;
+        }
+    
+    TUint32 resId = EditorId( convItem->iEditorResId, 
+                              R_PORT_NUMBER_SETTING_PAGE );
+    CAknTextSettingPage* dlg = new ( ELeave ) CAknTextSettingPage( 
+                                    resId,
+                                    ptr, 
+                                    flags );
+
+    CleanupStack::PushL( dlg );
+    SetTitleL( dlg, convItem->iTitleId, aTitleId );
+    CleanupStack::Pop( dlg );
+
+    if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenAccepted ) )
+        {
+        TLex lex ( buf->Des() );
+
+        // An empty string should be treated as default        
+        if ( buf->Des() == KNullDesC )
+            {
+            value = 0;
+            }
+        else
+            {
+            lex.Val( value );
+            }
+        if ( value != origVal )
+            {
+            iCmPluginBaseEng.SetIntAttributeL( aAttribute, value );
+            retVal = ETrue;
+            UpdateListBoxContentL();
+            }
+        }
+        
+    CleanupStack::PopAndDestroy( buf );
+    return retVal;
+    }
+
+//---------------------------------------------------------------------------
+// CmPluginBaseSettingsDlg::ShowPopupIPv4DNSEditorL
+//---------------------------------------------------------------------------
+//
+EXPORT_C TBool CmPluginBaseSettingsDlg::ShowPopupIPv4DNSEditorL(
+                                            TUint32 aDNSUsageAttribute,
+                                            TUint32 aDNS1ServAttribute,
+                                            TUint32 aDNS2ServAttribute,
+                                            TUint32 aTitleId )
+    {
+    // In default the return value is 'Automatic'
+    TBool retVal( EFalse );
+    // In default DNS setting is automatic.
+    const TCmAttribConvTable* convItem = 
+                        iCmPluginBaseEng.ConvTableItem( aDNSUsageAttribute );
+
+    HBufC* primServ = iCmPluginBaseEng.GetStringAttributeL( aDNS1ServAttribute );
+    CleanupStack::PushL( primServ );
+    HBufC* secServ = iCmPluginBaseEng.GetStringAttributeL( aDNS2ServAttribute );
+    CleanupStack::PushL( secServ );
+    
+    TBuf<KIpAddressWidth> newPrim;
+    TBuf<KIpAddressWidth> newSec;
+    
+    newPrim.Copy( *primServ );
+    newSec.Copy( *secServ );
+    
+    TInetAddr dns1Addr;
+    TInetAddr dns2Addr;
+    
+    dns1Addr.Input( newPrim );
+    dns2Addr.Input( newSec );
+    
+    CAknMultiLineIpQueryDialog* dlg = 
+            CAknMultiLineIpQueryDialog::NewL( dns1Addr, 
+                                              dns2Addr );
+    
+    CleanupStack::PushL( dlg );
+
+    TUint32 editorId = EditorId( convItem->iEditorResId, R_DNSIP4_QUERY );
+    dlg->PrepareLC( editorId );
+
+    TUint32 titleId = TitleId( convItem->iTitleId, aTitleId );
+    if ( titleId )
+        {
+        dlg->SetTitleL( titleId );
+        }
+        
+    CleanupStack::Pop( dlg );
+    
+    if ( dlg->RunLD() )
+        {
+        dns1Addr.Output( newPrim );
+        dns2Addr.Output( newSec );
+        
+        if ( newPrim.CompareF( *primServ ) ||
+             newSec.CompareF( *secServ ) )
+            // User modified the DNS setting
+            {
+            iCmPluginBaseEng.SetDNSServerAddressL( 
+                                aDNS1ServAttribute,
+                                newPrim,
+                                aDNS2ServAttribute, 
+                                newSec,
+                                aDNSUsageAttribute,
+                                EFalse );
+                
+            UpdateListBoxContentL();
+            
+            retVal = ETrue;
+            }
+        }
+    
+    CleanupStack::PopAndDestroy( 2, primServ );
+    
+    return retVal;
+    }
+
+//---------------------------------------------------------------------------
+// CmPluginBaseSettingsDlg::ShowPopupIPv6DNSEditorL
+//---------------------------------------------------------------------------
+//
+EXPORT_C TInt CmPluginBaseSettingsDlg::ShowPopupIPv6DNSEditorL(
+                                            const TUint32* aSelectionItems,
+                                            TUint32 aDNSUsageAttribute,
+                                            TUint32 aDNS1ServAttribute,
+                                            TUint32 aDNS2ServAttribute )
+    {
+    TBool update( EFalse );
+    TInt selected = GetIPv6DNSTypeL( aDNS1ServAttribute, aDNS2ServAttribute );
+    
+    // convert the current setting value to the selection index
+    TInt resId = KTIPv6DNSItems[selected].iResId;    
+    TInt i = 0;
+    while ( aSelectionItems[i] )
+        {
+        if ( resId == aSelectionItems[i] )
+            {
+            selected = i;
+            break;
+            }
+        i++;
+        }
+    
+    if ( ShowRadioButtonSettingPageL( aSelectionItems, 
+                                      selected, 
+                                      R_QTN_SET_DNS_SERVERS_IP ) )
+        {
+        // convert the selection to the setting value
+        resId = aSelectionItems[selected];
+        TInt j = 0;
+        
+        while ( KTIPv6DNSItems[j].iResId )
+            {
+            if ( resId == KTIPv6DNSItems[j].iResId )
+                {
+                selected = KTIPv6DNSItems[j].iSettingValue;
+                break;
+                }
+            j++;
+            }
+        
+        switch ( selected )
+            {
+            case EIPv6WellKnown: 
+                {
+                iCmPluginBaseEng.SetStringAttributeL( 
+                        aDNS1ServAttribute, KKnownIp6NameServer1 );
+                iCmPluginBaseEng.SetStringAttributeL( 
+                        aDNS2ServAttribute, KKnownIp6NameServer2 );
+                        
+                iCmPluginBaseEng.SetBoolAttributeL( 
+                        aDNSUsageAttribute, EFalse );
+                        
+                update = ETrue;
+                }
+                break;
+
+            case EIPv6Unspecified: 
+                {
+                iCmPluginBaseEng.SetStringAttributeL( 
+                        aDNS1ServAttribute, KDynamicIpv6Address );
+                iCmPluginBaseEng.SetStringAttributeL( 
+                        aDNS2ServAttribute, KDynamicIpv6Address );               
+                iCmPluginBaseEng.SetBoolAttributeL( 
+                        aDNSUsageAttribute, ETrue );
+                        
+                update = ETrue;
+                }
+                break;
+
+            case EIPv6UserDefined:                 
+                {
+                TInt err1;
+                TInt err2;
+                TBool cancelled(EFalse);
+                do
+                    {
+                    // These has to be reset to KErrNone in case of
+                    // inputting an invalid address (DLAN-7FJD68). 
+                    err1 = KErrNone;
+                    err2 = KErrNone;
+             
+                    HBufC* dns1 = HBufC::NewLC( KMaxIPv6NameServerLength );
+                    HBufC* dns2 = HBufC::NewLC( KMaxIPv6NameServerLength );
+                    
+                    TPtr dns1ptr( dns1->Des() );
+                    TPtr dns2ptr( dns2->Des() );
+                    
+                    HBufC* temp = iCmPluginBaseEng.GetStringAttributeL(
+                                                aDNS1ServAttribute );
+                    dns1ptr.Copy( *temp );
+                    delete temp; temp = NULL;
+                    
+                    temp = iCmPluginBaseEng.GetStringAttributeL( 
+                                                aDNS2ServAttribute );
+                    dns2ptr.Copy( *temp );
+                    delete temp; temp = NULL;
+
+                    // KDynamicIpv6Address is offered instead of empty string 
+                    if ( dns1ptr.Length() == 0 )
+                        { 
+                        dns1ptr = KDynamicIpv6Address;
+                        }
+                    if ( dns2ptr.Length() == 0 )
+                        { 
+                        dns2ptr = KDynamicIpv6Address;
+                        }
+
+                        
+                    if ( ( dns1ptr.Compare( KKnownIp6NameServer1 ) == 0 ) && 
+                         ( dns2ptr.Compare( KKnownIp6NameServer2 ) == 0 ) )
+                        { // special value, well-known
+                        // in this case 'dynamic' string must be offered so 
+                        // temp data must be changed to 'dynamic'
+                        dns1ptr = KDynamicIpv6Address;
+                        dns2ptr = KDynamicIpv6Address;
+                        }
+
+                    CCmPluginMultiLineDialog* ipquery = 
+                        CCmPluginMultiLineDialog::NewL( dns1ptr, 
+                                                        dns2ptr );
+
+                    if ( ipquery->ExecuteLD( R_DNSIP6_QUERY ) )
+                        {
+                        TInetAddr dns1Addr;
+                        TInetAddr dns2Addr;
+
+                        if ( dns1ptr.Compare( KNullDesC ) )
+                            {
+                            err1 = dns1Addr.Input( dns1ptr );
+                            }
+                        if ( dns2ptr.Compare( KNullDesC ) )
+                            {
+                            err2 = dns2Addr.Input( dns2ptr );
+                            }
+                        if ( err1 || err2 )
+                            {
+                            TCmCommonUi::ShowNoteL
+                                ( R_QTN_SET_INFO_INVALID_IP,
+                                TCmCommonUi::ECmErrorNote );
+                            }
+                        else
+                            {
+                            iCmPluginBaseEng.SetDNSServerAddressL( 
+                                                aDNS1ServAttribute,
+                                                dns1ptr,
+                                                aDNS2ServAttribute, 
+                                                dns2ptr,
+                                                aDNSUsageAttribute,
+                                                ETrue );
+
+                            update = ETrue;
+                            }
+                        }
+                    else
+                        {
+                        cancelled = ETrue;
+                        }
+                    CleanupStack::PopAndDestroy( dns2 );
+                    CleanupStack::PopAndDestroy( dns1 );                            
+                    } while ( (err1 || err2) && (!cancelled) );
+                break;
+                }
+            default:
+                {
+                User::Leave( KErrNotSupported );
+                }
+            }
+        }
+
+    if( update )
+        {
+        UpdateListBoxContentL();
+        }
+                
+    return selected;
+    }
+
+//---------------------------------------------------------------------------
+// CmPluginBaseSettingsDlg::TitleId
+//---------------------------------------------------------------------------
+//
+TUint32 CmPluginBaseSettingsDlg::TitleId( TUint32 aConvTitleId,
+                                          TUint32 aTitleId ) const
+    {
+    TUint32 titleId( 0 );
+    if ( aTitleId )
+        {
+        titleId = aTitleId;
+        }
+    else if ( !titleId )
+        {
+        titleId = aConvTitleId;
+        }
+        
+    return titleId;
+    }
+    
+//---------------------------------------------------------------------------
+// CmPluginBaseSettingsDlg::SetTitleL
+//---------------------------------------------------------------------------
+//
+void CmPluginBaseSettingsDlg::SetTitleL( CAknSettingPage* aDlg,
+                                         TUint32 aConvTitleId,
+                                         TUint32 aTitleId ) const
+    {
+    TUint32 titleId( TitleId( aConvTitleId, aTitleId ) );
+        
+    if ( titleId )
+        {
+        HBufC* title = StringLoader::LoadLC( titleId );
+        aDlg->SetSettingTextL( *title );
+        CleanupStack::PopAndDestroy( title );
+        }
+    }
+    
+//---------------------------------------------------------------------------
+// CmPluginBaseSettingsDlg::EditorId
+//---------------------------------------------------------------------------
+//
+TUint32 CmPluginBaseSettingsDlg::EditorId( TUint32 aConvEditorId,
+                                           TUint32 aEditorId ) const
+    {
+    TUint32 resId( 0 );
+    if ( aConvEditorId )
+        {
+        resId = aConvEditorId;
+        }
+    if ( !resId )
+        {
+        resId = aEditorId;
+        }
+
+    return resId;
+    }
+    
+// --------------------------------------------------------------------------
+// CmPluginBaseSettingsDlg::GetIPv6DNSTypeL
+// --------------------------------------------------------------------------
+//
+EXPORT_C TInt CmPluginBaseSettingsDlg::GetIPv6DNSTypeL( 
+                                                TUint32 aDNS1ServAttribute,
+                                                TUint32 aDNS2ServAttribute )
+    {
+    TIPv6Types retval( EIPv6UserDefined );
+
+    HBufC* priServ = NULL;
+    priServ = iCmPluginBaseEng.GetStringAttributeL( aDNS1ServAttribute );
+    CleanupStack::PushL( priServ );
+    TPtr16 ptr1( priServ->Des() );
+       
+    HBufC* secServ = NULL;
+    secServ = iCmPluginBaseEng.GetStringAttributeL( aDNS2ServAttribute );
+    CleanupStack::PushL( secServ );
+    TPtr16 ptr2( secServ->Des() );
+    
+    // net type 6: if IspIPv6NameServ <> 0.0.0.0 
+    // => User defined OR well-known
+    
+    if ( ( !ptr1.Compare( KKnownIp6NameServer1 ) )
+        && ( !ptr2.Compare( KKnownIp6NameServer2 ) ) )
+        { // special value, well-known
+        retval = EIPv6WellKnown;
+        }
+    else
+        { 
+        // dynamic, if 0:0:...
+        // OR EMPTY text...
+        if ( ( ( !ptr1.Compare( KDynamicIpv6Address ) )
+               || ( !ptr1.Compare( KNullDesC ) ) )
+           &&( ( !ptr2.Compare( KDynamicIpv6Address ) ) 
+               ||( !ptr2.Compare( KDynamicIpv6Address ) ) ) )
+            { // dynamic, 0:0:...
+            retval = EIPv6Unspecified;
+            }
+        else
+            { // other value, user defined
+            retval = EIPv6UserDefined;
+            }
+        }
+
+    CleanupStack::PopAndDestroy( 2, priServ );
+
+    return retval;
+    }
+    
+// --------------------------------------------------------------------------
+// CmPluginBaseSettingsDlg::HandleResourceChange
+// --------------------------------------------------------------------------
+//
+
+EXPORT_C void CmPluginBaseSettingsDlg::HandleResourceChange( TInt aType )
+    {
+    CCoeControl::HandleResourceChange( aType ); 
+
+    CAknDialog::HandleResourceChange(aType);
+
+    if( aType == KEikDynamicLayoutVariantSwitch )
+        {
+        DrawNow(); 
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginBaseSettingsDlg::Execute
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CmPluginBaseSettingsDlg::Execute()
+    {
+    iProcessing = ETrue;
+    
+    TRAPD( err, ProcessCommandL( EAknSoftkeyChange ) );
+    if ( err )
+        {
+        HandleLeaveError( err );
+        }
+    iProcessing = EFalse;
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginBaseSettingsDlg::HandleLeaveError
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CmPluginBaseSettingsDlg::HandleLeaveError( TInt aError )
+{
+    switch( aError )
+    {
+        case KLeaveWithoutAlert:
+        case KErrNoMemory:
+            // Indicate no memory to save setting changes
+            iIsPossibleToSaveSetting = EFalse;
+
+            if (iProcessing)
+            {
+                // Release processing protection so that the next processing can be done
+                iProcessing = EFalse;
+            }
+            break;
+        default:
+            // More leave errors may be handled if necessary
+            // Now other leave errors are ignored here
+            break;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Src/cmpbasesettingsdlgadv.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,159 @@
+/*
+* 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:  Dialog for advanced settings for plugin base.
+*
+*/
+
+#include <avkon.hrh>
+#include <eikdef.h>
+#include <eikenv.h>
+#include <eikedwin.h>
+#include <cmmanager.rsg>
+#include <data_caging_path_literals.hrh>
+#include <aknnavide.h>
+#include <akntitle.h>
+#include <eikmenup.h>
+#include <StringLoader.h>
+#include <akntextsettingpage.h>
+#include <cmconnectionmethoddef.h>
+
+#include <mcmdexec.h>
+#include <cmpbasesettingsdlgadv.h>
+#include "cmpluginmenucommands.hrh"
+#include "cmmanager.hrh"
+
+using namespace CMManager;
+
+enum TSMTPSettingIds
+    {
+    EPluginBaseCmCmdSmtp
+    };
+    
+// --------------------------------------------------------------------------
+// CmPluginBaseSettingsDlgAdv::CmPluginBaseSettingsDlgAdv()
+// --------------------------------------------------------------------------
+//
+EXPORT_C CmPluginBaseSettingsDlgAdv::CmPluginBaseSettingsDlgAdv( 
+                                           CCmPluginBaseEng& aCmPluginBase )
+    : CmPluginBaseSettingsDlg( aCmPluginBase )
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginBaseSettingsDlgAdv::~CmPluginBaseSettingsDlgAdv
+// Destructor
+// --------------------------------------------------------------------------
+//
+EXPORT_C  CmPluginBaseSettingsDlgAdv::~CmPluginBaseSettingsDlgAdv()
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginBaseSettingsDlgAdv::DynInitMenuPaneL
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CmPluginBaseSettingsDlgAdv::DynInitMenuPaneL( 
+                                                    TInt aResourceId,
+                                                    CEikMenuPane* aMenuPane )
+    {
+    CmPluginBaseSettingsDlg::DynInitMenuPaneL( aResourceId, aMenuPane );
+    if ( aResourceId == R_PLUGIN_BASE_MENU )
+        {
+        aMenuPane->SetItemDimmed( EPluginBaseCmdAdvanced, ETrue  );           
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginBaseSettingsDlgAdv::UpdateListBoxContentBearerSpecificL
+// --------------------------------------------------------------------------
+//
+void CmPluginBaseSettingsDlgAdv::UpdateListBoxContentBearerSpecificL( 
+                                                 CDesCArray& /*aItemArray*/ )
+    {
+    // Empty implementation - forced by inheritance
+    }
+    
+// --------------------------------------------------------------------------
+// CmPluginBaseSettingsDlgAdv::RunAdvancedSettingsL
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CmPluginBaseSettingsDlgAdv::RunAdvancedSettingsL()
+    {
+    // Empty implementation. This function has no meaning here
+    }
+    
+// --------------------------------------------------------------------------
+// CmPluginBaseSettingsDlgAdv::UpdateListBoxContentL
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CmPluginBaseSettingsDlgAdv::UpdateListBoxContentL()
+    {
+    // Must save listbox indexes because content will be deleted
+    TInt lastListBoxPos = iListbox->CurrentItemIndex();
+    TInt lastListBoxTopPos = iListbox->TopItemIndex();
+
+    // deleting listbox content
+    MDesCArray* itemList = iListbox->Model()->ItemTextArray();
+    CDesCArray* itemArray = (CDesCArray*)itemList;
+    while ( itemArray->Count() )
+        {
+        itemArray->Delete( 0 );
+        }
+    while ( iSettingIndex->Count() )
+        {
+        iSettingIndex->Delete( 0 );
+        }
+
+    UpdateListBoxContentBearerSpecificL( *itemArray );
+                     
+    // Handle content changes
+    iListbox->Reset();
+    
+    iListbox->HandleItemAdditionL();
+    
+    // Listbox might not have index
+    if ( lastListBoxPos != -1 )
+        {
+        iListbox->SetCurrentItemIndex( lastListBoxPos );
+        iListbox->SetTopItemIndex( lastListBoxTopPos );
+        }
+    // Draw it
+    iListbox->DrawNow();
+    }
+
+//---------------------------------------------------------------------------         
+// CmPluginBaseSettingsDlgAdv::ShowPopupSettingPageL
+//---------------------------------------------------------------------------
+//
+EXPORT_C TBool CmPluginBaseSettingsDlgAdv::ShowPopupSettingPageL( 
+                                           TInt aAttribute, TInt aCommandId )
+    {
+    TBool retval( EFalse );
+    
+    switch ( aAttribute )
+        {
+        case EPluginBaseCmCmdSmtp:
+            {
+            // Show the SMTP settings page
+            User::Leave( KErrNotSupported );
+            break;
+            }      
+        default:
+            {
+            CmPluginBaseSettingsDlg::ProcessCommandL( aCommandId );
+            break;
+            }
+        }
+    return retval;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Src/cmpbasesettingsdlgip.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,114 @@
+/*
+* 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:  Dialog for IPv4 settings for plugin base.
+*
+*/
+
+#include <cmmanager.rsg>
+
+#include <mcmdexec.h>
+#include <cmpbasesettingsdlgip.h>
+#include <cmmanagerdef.h>
+#include "cmmanager.hrh"
+
+using namespace CMManager;
+
+// --------------------------------------------------------------------------
+// CmPluginBaseSettingsDlgIp::CmPluginBaseSettingsDlgIp()
+// --------------------------------------------------------------------------
+//
+EXPORT_C CmPluginBaseSettingsDlgIp::CmPluginBaseSettingsDlgIp( 
+                                           CCmPluginBaseEng& aCmPluginBase )
+    : CmPluginBaseSettingsDlg( aCmPluginBase )
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginBaseSettingsDlgIp::~CmPluginBaseSettingsDlgIp
+// Destructor
+// --------------------------------------------------------------------------
+//
+EXPORT_C CmPluginBaseSettingsDlgIp::~CmPluginBaseSettingsDlgIp()
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginBaseSettingsDlgIp::DynInitMenuPaneL
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CmPluginBaseSettingsDlgIp::DynInitMenuPaneL( 
+                                                    TInt aResourceId,
+                                                    CEikMenuPane* aMenuPane )
+    {
+    CmPluginBaseSettingsDlg::DynInitMenuPaneL( aResourceId, aMenuPane );
+    if ( aResourceId == R_PLUGIN_BASE_MENU )
+        {
+        aMenuPane->SetItemDimmed( EPluginBaseCmdAdvanced, ETrue  );           
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginBaseSettingsDlgIp::UpdateListBoxContentBearerSpecificL
+// --------------------------------------------------------------------------
+//
+void CmPluginBaseSettingsDlgIp::UpdateListBoxContentBearerSpecificL( 
+                                                 CDesCArray& /*aItemArray*/ )
+    {
+    // Empty implementation - forced by inheritance
+    }
+    
+// --------------------------------------------------------------------------
+// CmPluginBaseSettingsDlgIp::RunAdvancedSettingsL
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CmPluginBaseSettingsDlgIp::RunAdvancedSettingsL()
+    {
+    // Empty implementation. This function has no meaning here
+    }
+    
+// --------------------------------------------------------------------------
+// CmPluginBaseSettingsDlgIp::UpdateListBoxContentL
+// --------------------------------------------------------------------------
+//
+EXPORT_C void CmPluginBaseSettingsDlgIp::UpdateListBoxContentL()
+    {
+    // Must save listbox indexes because content will be deleted
+    TInt lastListBoxPos = iListbox->CurrentItemIndex();
+    TInt lastListBoxTopPos = iListbox->TopItemIndex();
+
+    // deleting listbox content
+    MDesCArray* itemList = iListbox->Model()->ItemTextArray();
+    CDesCArray* itemArray = (CDesCArray*)itemList;
+    while ( itemArray->Count() )
+        {
+        itemArray->Delete( 0 );
+        }
+    while ( iSettingIndex->Count() )
+        {
+        iSettingIndex->Delete( 0 );
+        }
+
+    UpdateListBoxContentBearerSpecificL( *itemArray );
+                        
+    // Handle content changes
+    iListbox->Reset();
+    // Listbox might not have index
+    if ( lastListBoxPos != -1 )
+        {
+        iListbox->SetCurrentItemIndex( lastListBoxPos );
+        iListbox->SetTopItemIndex( lastListBoxTopPos );
+        }
+    // Draw it
+    iListbox->DrawNow();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Src/cmpluginbase.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,823 @@
+/*
+* 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 plugin base class
+*
+*/
+
+#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include <commsdat_partner.h>
+#endif
+#include <cmmanager.rsg>
+#include <es_sock.h>    // RSocketServ, RConnection
+#include <in_sock.h>    // KAfInet
+#include <es_enum.h>    // TConnectionInfo
+#include <StringLoader.h>
+#include <AknUtils.h>
+#include <data_caging_path_literals.hrh>
+#include <sysutil.h> 
+#include <cmpluginbase.h>
+
+#include <cmmanager.h>
+#include "cmmanagerimpl.h"
+#include "cmdestinationimpl.h"
+#include <cmpluginbase.h>
+#include <cmpsettingsconsts.h>
+#include "cmlogger.h"
+#include <cmcommonui.h>
+
+using namespace CMManager;
+using namespace CommsDat;
+
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::CCmPluginBase
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmPluginBase::CCmPluginBase( CCmPluginBaseEng* plugin )
+    : iPlugin( plugin )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::~CCmPluginBase
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmPluginBase::~CCmPluginBase()
+    {
+    if (iPlugin)
+        {
+        TRAP_IGNORE( CmMgr().RemoveCMFromPoolL(this) );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::ConstructL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmPluginBase::ConstructL()
+    {
+    iPlugin->ConstructL();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::ConstructL
+// ---------------------------------------------------------------------------
+//
+ CCmPluginBase* CCmPluginBase::CreateInstanceL( TCmPluginInitParam& aInitParam )
+    {
+    CCmPluginBaseEng* plugin = iPlugin->CreateInstanceL(aInitParam);
+	CleanupStack::PushL( plugin );
+    CCmPluginBase* connMethod = new (ELeave) CCmPluginBase(plugin);     
+    CleanupStack::Pop( plugin );  // plugin        
+    return connMethod;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::RunSettingsL
+// ---------------------------------------------------------------------------
+//
+TInt CCmPluginBase::RunSettingsL()
+    {
+    return iPlugin->RunSettingsL();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::InitializeWithUiL
+// ---------------------------------------------------------------------------
+//
+TInt CCmPluginBase::InitializeWithUiL(TBool aManuallyConfigure)
+    {
+    return iPlugin->InitializeWithUiL(aManuallyConfigure);
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::CanHandleIapIdL
+// ---------------------------------------------------------------------------
+//
+TBool CCmPluginBase::CanHandleIapIdL(TUint32 aIapId) const
+    {
+    return iPlugin->CanHandleIapIdL(aIapId);
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::CanHandleIapIdL
+// ---------------------------------------------------------------------------
+//
+TBool CCmPluginBase::CanHandleIapIdL(CommsDat::CCDIAPRecord* aIapRecord) const
+    {
+    return iPlugin->CanHandleIapIdL(aIapRecord);
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::AdditionalReset
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBase::AdditionalReset()
+    {
+    iPlugin->AdditionalReset();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::ServiceRecordIdLC
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBase::ServiceRecordIdLC(HBufC* &aServiceName, 
+                                       TUint32& aRecordId)
+    {
+    iPlugin->ServiceRecordIdLC(aServiceName, aRecordId);
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::BearerRecordIdLC
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBase::BearerRecordIdLC(HBufC* &aBearerName, 
+                                       TUint32& aRecordId)
+    {
+    iPlugin->BearerRecordIdLC(aBearerName, aRecordId);
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::PrepareToDeleteRecordsL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBase::PrepareToDeleteRecordsL()
+    {
+    iPlugin->PrepareToDeleteRecordsL();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::DeleteAdditionalRecordsL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBase::DeleteAdditionalRecordsL()
+    {
+    iPlugin->DeleteAdditionalRecordsL();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::CreateNewServiceRecordL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBase::CreateNewServiceRecordL()
+    {
+    iPlugin->CreateNewServiceRecordL();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBase::CreateAdditionalRecordsL()
+    {
+    iPlugin->CreateAdditionalRecordsL();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::PrepareToCopyDataL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBase::PrepareToCopyDataL(CCmPluginBaseEng& aDestInst) const
+    {
+    iPlugin->PrepareToCopyDataL(aDestInst);
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::CopyAdditionalDataL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBase::CopyAdditionalDataL(CCmPluginBaseEng& aDestInst) const
+    {
+    iPlugin->CopyAdditionalDataL(aDestInst);
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::LoadAdditionalRecordsL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBase::LoadAdditionalRecordsL()
+    {
+    iPlugin->LoadAdditionalRecordsL();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::UpdateAdditionalRecordsL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBase::UpdateAdditionalRecordsL()
+    {
+    iPlugin->UpdateAdditionalRecordsL();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::IsLinkedToIap
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CCmPluginBase::IsLinkedToIap( TUint32 aIapId )
+    {
+    return iPlugin->IsLinkedToIap( aIapId );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::IsLinkedToIap
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CCmPluginBase::IsLinkedToSnap( TUint32 aSnapId )
+    {
+    return iPlugin->IsLinkedToSnap( aSnapId );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::GetIntAttributeL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TUint32 
+            CCmPluginBase::GetIntAttributeL( const TUint32 aAttribute ) const
+    {
+    return iPlugin->GetIntAttributeL(aAttribute);
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::GetBoolAttributeL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool 
+        CCmPluginBase::GetBoolAttributeL( const TUint32 aAttribute ) const
+    {
+    return iPlugin->GetBoolAttributeL(aAttribute);
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::GetStringAttributeL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C HBufC* 
+    CCmPluginBase::GetStringAttributeL( const TUint32 aAttribute ) const
+    {
+    return iPlugin->GetStringAttributeL(aAttribute);
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::GetString8AttributeL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C HBufC8* 
+    CCmPluginBase::GetString8AttributeL( const TUint32 aAttribute ) const
+    {
+    return iPlugin->GetString8AttributeL(aAttribute);
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmPluginBase::SetIntAttributeL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmPluginBase::SetIntAttributeL( const TUint32 aAttribute, 
+                                                  TUint32 aValue )
+    {
+    iPlugin->SetIntAttributeL(aAttribute, aValue);
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::SetBoolAttributeL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmPluginBase::SetBoolAttributeL( const TUint32 aAttribute, 
+                                                   TBool aValue )
+    {
+    iPlugin->SetBoolAttributeL(aAttribute, aValue);
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmPluginBase::SetStringAttributeL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmPluginBase::SetStringAttributeL( const TUint32 aAttribute, 
+                                                     const TDesC16& aValue )
+    {
+    iPlugin->SetStringAttributeL(aAttribute, aValue);
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmPluginBase::SetString8AttributeL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmPluginBase::SetString8AttributeL( const TUint32 aAttribute, 
+                                                      const TDesC8& aValue )
+    {
+    iPlugin->SetString8AttributeL(aAttribute, aValue);
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmPluginBase::RestoreAttributeL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmPluginBase::RestoreAttributeL( const TUint32 aAttribute )
+    {
+    iPlugin->RestoreAttributeL(aAttribute);
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::Destination
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmDestinationImpl* CCmPluginBase::Destination() const
+    {
+    return iPlugin->Destination();
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmPluginBase::UpdateL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmPluginBase::UpdateL()
+    {
+    iPlugin->UpdateL();
+    iPlugin->SetIdValidity(ETrue);
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::NumOfConnMethodReferencesL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCmPluginBase::NumOfConnMethodReferencesL()
+    {
+    return iPlugin->NumOfConnMethodReferencesL();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::Session
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CMDBSession& CCmPluginBase::Session()const
+    {
+    return iPlugin->Session();
+    }
+
+// ---------------------------------------------------------------------------
+// Delete this connection methond.
+// Record ids are checked to be sure that we delete only records
+// that were loaded before.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CCmPluginBase::DeleteL( TBool aForced,
+                                          TBool aOneRefAllowed )
+    {
+    return iPlugin->DeleteL(aForced, aOneRefAllowed);
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::LoadL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmPluginBase::LoadL( TUint32 aIapId )
+    {
+    iPlugin->LoadL(aIapId);
+    CmMgr().ConnMethodUpdatedL( this->Plugin() );
+    iPlugin->SetIdValidity(ETrue);
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::ReLoadL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBase::ReLoadL()
+    {
+    TUint32 cmID = iPlugin->GetIntAttributeL( ECmId );    
+    TUint32 refCounter = iPlugin->iRefCounter;
+    
+    iPlugin->iRefCounter = 1;
+    CCmManagerImpl* mgr = &CmMgr();
+    mgr->RemoveCMFromPoolL(iPlugin);
+    iPlugin = NULL;
+    CCmPluginBase* cm = mgr->GetConnectionMethodL( cmID );
+    iPlugin = cm->iPlugin;
+    cm->iPlugin = NULL;
+    delete cm;
+    iPlugin->SetIdValidity(ETrue);
+    iPlugin->iRefCounter = refCounter;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmPluginBase::CreateNewL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmPluginBase::CreateNewL()
+    {
+    iPlugin->CreateNewL();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::CreateCopyL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmPluginBase* CCmPluginBase::CreateCopyL() const
+    {
+    CCmPluginBaseEng* plugin = iPlugin->CreateCopyL();
+	CleanupStack::PushL( plugin );    
+    CCmPluginBase* connMethod = CmMgr().CreateConnectionMethodL(plugin);
+    CleanupStack::Pop( plugin );      
+    return connMethod;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmPluginBase::AddResourceFileL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmPluginBase::AddResourceFileL( const TDesC& aName )
+    {
+    iPlugin->AddResourceFileL(aName);
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmPluginBase::RemoveResourceFile
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmPluginBase::RemoveResourceFile( const TDesC& aName )
+    {
+    iPlugin->RemoveResourceFile(aName);
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmPluginBase::AllocReadL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C HBufC* CCmPluginBase::AllocReadL( TInt aResourceId ) const
+    {
+    return iPlugin->AllocReadL( aResourceId );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmPluginBase::OpenTransactionLC
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBase::OpenTransactionLC()
+    {
+    iPlugin->OpenTransactionLC();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::CommitTransactionL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBase::CommitTransactionL( TInt aError )
+    {
+    iPlugin->CommitTransactionL(aError);
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::PrepareToLoadRecordsL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBase::DoLoadL( TUint32 aIapId )
+    {
+    iPlugin->CommitTransactionL(aIapId);
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::PrepareToLoadRecordsL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmPluginBase::PrepareToLoadRecordsL()
+    {
+    iPlugin->PrepareToLoadRecordsL();
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmPluginBase::LoadIAPRecordL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBase::LoadIAPRecordL( TUint32 aIapId )
+    {
+    iPlugin->LoadIAPRecordL(aIapId);
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::LoadProxySettingL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBase::LoadProxySettingL()
+    {
+    iPlugin->LoadProxySettingL();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::LoadServiceSettingL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmPluginBase::LoadServiceSettingL()
+    {
+    iPlugin->LoadServiceSettingL();
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmPluginBase::LoadChargeCardSettingL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBase::LoadChargeCardSettingL( TUint32 aRecordId )
+    {
+    iPlugin->LoadChargeCardSettingL(aRecordId);
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::LoadNetworkSettingL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBase::LoadNetworkSettingL()
+    {
+    iPlugin->LoadNetworkSettingL();
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmPluginBase::LoadLocationSettingL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBase::LoadLocationSettingL()
+    {
+    iPlugin->LoadLocationSettingL();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::PrepareToUpdateRecordsL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmPluginBase::PrepareToUpdateRecordsL()
+    {
+    iPlugin->PrepareToUpdateRecordsL();
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmPluginBase::UpdateIAPRecordL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBase::UpdateIAPRecordL()
+    {
+    iPlugin->UpdateIAPRecordL();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::UpdateProxyRecordL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmPluginBase::UpdateProxyRecordL()
+    {
+    iPlugin->UpdateProxyRecordL();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::UpdateSeamlessnessRecordL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBase::UpdateSeamlessnessRecordL()
+    {
+    iPlugin->UpdateSeamlessnessRecordL();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::UpdateChargeCardRecordL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBase::UpdateChargeCardRecordL()
+    {
+    iPlugin->UpdateChargeCardRecordL();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::UpdateServiceRecordL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmPluginBase::UpdateServiceRecordL()
+    {
+    iPlugin->UpdateServiceRecordL();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::UpdateNetworkRecordL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBase::UpdateNetworkRecordL()
+    {
+    iPlugin->UpdateNetworkRecordL();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::UpdateLocationRecordL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBase::UpdateLocationRecordL()
+    {
+    iPlugin->UpdateLocationRecordL();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::UpdateConnPrefSettingL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBase::UpdateConnPrefSettingL()
+    {
+    iPlugin->UpdateConnPrefSettingL();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::EnableProxyL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmPluginBase::EnableProxyL( TBool aEnable )
+    {
+    iPlugin->EnableProxyL(aEnable);
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmPluginBase::EnableChargeCardL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmPluginBase::EnableChargeCardL( TBool aEnable )
+    {
+    iPlugin->EnableChargeCardL(aEnable);
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmPluginBase::EnableLocationL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmPluginBase::EnableLocationL( TBool aEnable )
+    {
+    iPlugin->EnableLocationL(aEnable);
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::LoadWapRecordL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBase::LoadWapRecordL()
+    {
+    iPlugin->LoadWapRecordL();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::LoadSeamlessnessRecordL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBase::LoadSeamlessnessRecordL()
+    {
+    iPlugin->LoadSeamlessnessRecordL();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::UpdateWapRecordL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBase::UpdateWapRecordL()
+    {
+    iPlugin->UpdateWapRecordL();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::NewWapRecordL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBase::NewWapRecordL()
+    {
+    iPlugin->NewWapRecordL();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::NewSeamlessnessRecordL
+// ---------------------------------------------------------------------------
+//
+CCDIAPMetadataRecord* CCmPluginBase::NewSeamlessnessRecordL( TBool aSetDef )
+    {
+    return iPlugin->NewSeamlessnessRecordL(aSetDef);
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::SetAttribute
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBase::SetAttribute( CCDRecordBase* aRecord, 
+                                     TUint32 aAttribute, 
+                                     TBool aSet )
+    {
+    iPlugin->SetAttribute(aRecord, aAttribute, aSet);
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::CopyAttributes
+// ---------------------------------------------------------------------------
+//
+void CCmPluginBase::CopyAttributes( CCDRecordBase* aSrcRecord, 
+                                       CCDRecordBase* aDstRecord )
+    {
+    iPlugin->CopyAttributes(aSrcRecord, aDstRecord);
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::FindWAPRecordL
+// ---------------------------------------------------------------------------
+//
+CCDWAPIPBearerRecord* CCmPluginBase::FindWAPRecordL()
+    {
+    return iPlugin->FindWAPRecordL();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::FindSeamlessnessRecordL
+// ---------------------------------------------------------------------------
+//
+CCDIAPMetadataRecord* CCmPluginBase::FindSeamlessnessRecordL()
+    {
+    return iPlugin->FindSeamlessnessRecordL();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::IAPRecordElementId
+// ---------------------------------------------------------------------------
+TMDBElementId CCmPluginBase::IAPRecordElementId() const
+    {
+    return iPlugin->IAPRecordElementId();
+    }
+// ---------------------------------------------------------------------------
+// CCmPluginBase::ParentDestination
+// ---------------------------------------------------------------------------
+EXPORT_C CCmDestinationImpl* CCmPluginBase::ParentDestination() const 
+    { 
+    return iPlugin->ParentDestination();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::CmMgr
+// ---------------------------------------------------------------------------
+EXPORT_C CCmManagerImpl& CCmPluginBase::CmMgr() const 
+    { 
+    return iPlugin->CmMgr();
+    };
+
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::Plugin
+// ---------------------------------------------------------------------------
+void CCmPluginBase::SetPlugin(CCmPluginBaseEng* aPlugin) 
+    { 
+    iPlugin = aPlugin;
+    };
+
+// ---------------------------------------------------------------------------
+// CCmPluginBase::Plugin
+// ---------------------------------------------------------------------------
+EXPORT_C CCmPluginBaseEng* CCmPluginBase::Plugin() const 
+    { 
+    return iPlugin;
+    };
+    
+// -----------------------------------------------------------------------------
+// CCmPluginBase::IncrementRefCounter
+// -----------------------------------------------------------------------------
+void CCmPluginBase::IncrementRefCounter()
+    {
+    iPlugin->IncrementRefCounter();
+    }
+// -----------------------------------------------------------------------------
+// CCmPluginBase::DecrementRefCounter
+// -----------------------------------------------------------------------------
+void CCmPluginBase::DecrementRefCounter()
+    {
+    iPlugin->DecrementRefCounter();
+    }
+// -----------------------------------------------------------------------------
+// CCmPluginBase::GetRefCounter
+// -----------------------------------------------------------------------------
+TInt CCmPluginBase::GetRefCounter()
+    {
+    return iPlugin->GetRefCounter();
+    }
+                                                                    
+// -----------------------------------------------------------------------------
+// CCmPluginBase::GetAdditionalUids
+// -----------------------------------------------------------------------------
+EXPORT_C void CCmPluginBase::GetAdditionalUids( RArray<TUint32>& aIapIds )
+    {
+    iPlugin->GetAdditionalUids( aIapIds );
+    }
+
+//-----------------------------------------------------------------------------
+// CCmPluginBase::FilterPossibleParentsL
+// -----------------------------------------------------------------------------
+void CCmPluginBase::FilterPossibleParentsL( RArray<TUint32>& aDests )
+    {
+    iPlugin->FilterPossibleParentsL( aDests );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Src/cmpluginlanbase.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,328 @@
+/*
+* 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 base for Lan Plugin interface 
+*                for Lan Bearer.
+*
+*/
+#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include <commsdat_partner.h>
+#endif
+#include <cmpluginlanbase.h>
+#include "cmlogger.h"
+#include <ecom/ecom.h>        // For REComSession
+#include <mcmdexec.h>
+#include <cmpbasesettingsdlg.h>
+#include "cmmanagerimpl.h"
+#include <cmmanager.rsg>
+#include <cmpsettingsconsts.h>
+
+using namespace CMManager;
+using namespace CommsDat;
+
+// default values for fields...
+// CONSTANTS
+_LIT( KEmpty, "");
+
+_LIT( KLanBearerName, "LANBearer" );
+_LIT( KLanBearerAgent, "lanagt.agt" );
+_LIT( KLanBearerNif, "lannif" );
+
+_LIT( KLanLDDName, "not used" );
+_LIT( KLanPDDName, "not used" );
+
+const TInt KLanLastSocketActivityTimeout = -1;
+const TInt KLanLastSocketClosedTimeout = -1;
+
+const TBool KDefIpAddrFromServer = ETrue;
+const TBool KDefIpDnsAddrFromServer = ETrue;
+const TBool KDefIp6DnsAddrFromServer = ETrue;
+
+static const TCmAttribConvTable SLanConvTbl[] = 
+    {
+    { ELanBaseIfNetworks, ELanBaseRangeMax, NULL },
+    { ELanBaseIfNetworks, KCDTIdLANIfNetworks, NULL },        
+    { ELanBaseIpNetMask, KCDTIdLANIpNetMask, &CheckIPv4ValidityL,
+      R_QTN_NETW_SETT_SUBNET_MASK,
+      KIpAddressWidth, EConvCompulsory | EConvIPv4, R_QTN_SELEC_SETTING_COMPULSORY, 0, NULL, NULL },
+    { ELanBaseIpGateway, KCDTIdLANIpGateway, &CheckIPv4ValidityL,
+      R_QTN_NETW_SETT_DEFAULT_GATEWAY,
+      KIpAddressWidth, EConvCompulsory | EConvIPv4, R_QTN_SELEC_SETTING_COMPULSORY, 0, NULL, NULL },
+    { ELanBaseIpAddrFromServer, KCDTIdLANIpAddrFromServer, NULL },
+    { ELanBaseIpAddr, KCDTIdLANIpAddr, &CheckIPv4ValidityL,
+      R_QTN_SET_IP_ADDRESS,
+      KIpAddressWidth, EConvIPv4, R_QTN_SET_IP_ADDRESS_DYNAMIC, 0, NULL, NULL },
+    { ELanBaseIpDNSAddrFromServer, KCDTIdLANIpDNSAddrFromServer, NULL,
+      R_QTN_SET_DNS_SERVERS_IP,
+      0, 0, 0, 0, NULL, NULL },
+    { ELanBaseIpNameServer1, KCDTIdLANIpNameServer1, &CheckIPv4ValidityL,
+      R_QTN_SET_PRIMARY_DNS,
+      KMaxIPv4NameServerLength, EConvIPv4, R_QTN_SET_DNS_SERVERS_AUTOMATIC, 0, NULL, NULL },
+    { ELanBaseIpNameServer2, KCDTIdLANIpNameServer2, &CheckIPv4ValidityL,
+      R_QTN_SET_SECONDARY_DNS,
+      KMaxIPv4NameServerLength, EConvIPv4, R_QTN_SET_DNS_SERVERS_AUTOMATIC, 0, NULL, NULL },    
+    { ELanBaseIp6DNSAddrFromServer, KCDTIdLANIp6DNSAddrFromServer, NULL,
+      R_QTN_SET_DNS_SERVERS_IP,
+      0, 0, 0, 0, NULL, NULL },
+    { ELanBaseIp6NameServer1, KCDTIdLANIp6NameServer1, &CheckIPv6ValidityL },
+    { ELanBaseIp6NameServer2, KCDTIdLANIp6NameServer2, &CheckIPv6ValidityL },
+    { ELanBaseIpAddrLeaseValidFrom, KCDTIdLANIpAddrLeaseValidFrom, NULL },
+    { ELanBaseIpAddrLeaseValidTo, KCDTIdLANIpAddrLeaseValidTo, NULL },
+    { ELanBaseConfigDaemonManagerName, KCDTIdLANConfigDaemonManagerName, NULL },
+    { ELanBaseConfigDaemonName, KCDTIdLANConfigDaemonName, NULL },
+    { ELanBaseServiceExtensionTableName, KCDTIdLANServiceExtensionTableName, NULL },
+    { ELanBaseServiceExtensionTableRecordId, KCDTIdLANServiceExtensionTableRecordId, &CheckRecordIdValidityL },
+    { 0,0, NULL }
+    };
+
+static const TCmCommonAttrConvArrayItem SCommonConvTbl[] =
+{
+    { ELanBaseIfNetworks, ECmIFNetworks },
+    { ELanBaseIpNetMask, ECmIPNetmask },
+    { ELanBaseIpGateway, ECmIPGateway },
+    { ELanBaseIpAddrFromServer, ECmIPAddFromServer },
+    { ELanBaseIpAddr, ECmIPAddress },
+    { ELanBaseIpDNSAddrFromServer, ECmIPDNSAddrFromServer },
+    { ELanBaseIpNameServer1, ECmIPNameServer1 },
+    { ELanBaseIpNameServer2, ECmIPNameServer2 },
+    { ELanBaseIp6DNSAddrFromServer, ECmIP6DNSAddrFromServer },
+    { ELanBaseIp6NameServer1, ECmIP6NameServer1 },
+    { ELanBaseIp6NameServer2, ECmIP6NameServer2 },
+    { ELanBaseIpAddrLeaseValidFrom, ECmIPAddrLeaseValidFrom },
+    { ELanBaseIpAddrLeaseValidTo, ECmIPAddrLeaseValidTo },
+    { ELanBaseConfigDaemonManagerName, ECmConfigDaemonManagerName },
+    { ELanBaseConfigDaemonName, ECmConfigDaemonName },
+    { 0, 0 }
+    };
+
+// ---------------------------------------------------------------------------
+// CCmPluginLanBase::CCmPluginLanBase()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmPluginLanBase::CCmPluginLanBase( TCmPluginInitParam* aInitParam )
+    : CCmPluginBaseEng( aInitParam )
+    {
+    CLOG_CREATE;
+
+
+    }
+
+EXPORT_C CCmPluginLanBase::~CCmPluginLanBase()
+    {
+    CLOG_CLOSE;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginLanBase::ConstructL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmPluginLanBase::ConstructL()
+    {
+    LOGGER_ENTERFN( "CCmPluginLanBase::ConstructL" );
+    
+    CCmPluginBaseEng::ConstructL();
+    
+    AddConverstionTableL( (CCDRecordBase**)&iServiceRecord, NULL, SLanConvTbl );
+	AddCommonConversionTableL( SCommonConvTbl );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginLanBase::RunSettingsL()
+// ---------------------------------------------------------------------------
+//        
+EXPORT_C TInt CCmPluginLanBase::RunSettingsL()
+    {
+    User::Leave( KErrNotSupported );
+    return 0;
+    }
+        
+// ---------------------------------------------------------------------------
+// CCmPluginLanBase::InitializeWithUiL()
+// ---------------------------------------------------------------------------
+//        
+EXPORT_C TBool CCmPluginLanBase::InitializeWithUiL( 
+                                            TBool /*aManuallyConfigure*/ )
+    {
+    User::Leave(KErrNotSupported);
+    return ETrue;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginLanBase::LoadServiceSettingL()
+// ---------------------------------------------------------------------------
+//        
+EXPORT_C void CCmPluginLanBase::LoadServiceSettingL()
+    {
+    LOGGER_ENTERFN( "CCmPluginLanBase::LoadServiceSettingL" );
+    
+    if( TPtrC(KCDTypeNameLANService) == iIapRecord->iServiceType  )
+        {
+        iServiceRecord = static_cast<CCDLANServiceRecord *>
+                    (CCDRecordBase::RecordFactoryL(KCDTIdLANServiceRecord));
+        }
+    else
+        // this IAP service is not supported by this plugin.
+        {
+        User::Leave( KErrNotSupported );
+        }
+
+    CCmPluginBaseEng::LoadServiceSettingL();
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmPluginLanBase::ServiceRecord()
+// ---------------------------------------------------------------------------
+//        
+EXPORT_C CCDLANServiceRecord& CCmPluginLanBase::ServiceRecord()const
+    {
+    LOGGER_ENTERFN( "CCmPluginLanBase::ServiceRecord" );
+    return *static_cast<CCDLANServiceRecord*>(iServiceRecord);
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginLanBase::ServiceRecordIdLC
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCmPluginLanBase::ServiceRecordIdLC( HBufC* &aName, 
+                                                   TUint32& aRecordId )
+    {
+    LOGGER_ENTERFN( "CCmPluginLanBase::ServiceRecordIdLC" );
+
+    aName = TPtrC( KCDTypeNameLANService ).AllocLC();    
+    aRecordId = iServiceRecord->RecordId();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginLanBase::BearerRecordIdLC()
+// ---------------------------------------------------------------------------
+//        
+EXPORT_C void CCmPluginLanBase::BearerRecordIdLC( HBufC* &aBearerName, 
+                                                  TUint32& aRecordId )
+    {
+    LOGGER_ENTERFN( "CCmPluginLanBase::BearerRecordIdLC" );
+                
+    CCDLANBearerRecord* tmprec = static_cast<CCDLANBearerRecord*>
+                        (CCDRecordBase::RecordFactoryL( KCDTIdLANBearerRecord ));
+    CleanupStack::PushL( tmprec );
+
+    tmprec->iRecordName.SetL( TPtrC(iBearerRecName) );
+    if ( !tmprec->FindL( Session() ) )
+        { // bearer not found -> create dummy values
+        CLOG_WRITE( "No bearer found" );
+
+        tmprec->SetRecordId( KCDNewRecordRequest );
+        tmprec->iBearerAgent = KLanBearerAgent;
+        tmprec->iRecordName = KLanBearerName;
+        tmprec->iLanBearerNifName = KLanBearerNif;
+        tmprec->iLanBearerLddName = KLanLDDName;
+        tmprec->iLanBearerPddName = KLanPDDName;
+        tmprec->iLastSocketActivityTimeout = 
+                                        (TUint32)KLanLastSocketActivityTimeout;
+        tmprec->iLastSocketClosedTimeout = 
+                                        (TUint32)KLanLastSocketClosedTimeout;
+
+        tmprec->StoreL( Session() );
+        }
+
+    aRecordId = tmprec->RecordId();
+    
+    CLOG_WRITE_2( "Name: [%S], id: [%d]", 
+                  &tmprec->iRecordName.GetL(), 
+                  aRecordId );
+
+    CleanupStack::PopAndDestroy( tmprec );
+
+    aBearerName = TPtrC(KCDTypeNameLANBearer).AllocLC();    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginLanBase::CreateNewServiceRecordL()
+// ---------------------------------------------------------------------------
+//        
+EXPORT_C void CCmPluginLanBase::CreateNewServiceRecordL()
+    {
+    LOGGER_ENTERFN( "CCmPluginLanBase::CreateNewServiceRecordL" );
+
+    delete iServiceRecord; 
+    iServiceRecord = NULL;
+    
+    iServiceRecord = static_cast<CCDServiceRecordBase *>
+                (CCDRecordBase::RecordFactoryL(KCDTIdLANServiceRecord));
+
+    // I do not think that we have to use the default record,
+    // but for compatibility with ApEngine, we write all fields 
+
+    CCDLANServiceRecord* record = 
+                            static_cast<CCDLANServiceRecord *>(iServiceRecord);
+
+
+    if( FeatureSupported( KFeatureIdIPv6 ) )
+        {
+        record->iIfNetworks.SetL( KDefIspIfNetworksIPv4IPv6LAN );
+        }
+    else
+        {
+        record->iIfNetworks.SetL( KDefIspIfNetworksIPv4 );
+        }
+
+//    record->iIpNetmask.SetL();
+    
+    record->iIpGateway.SetL( KUnspecifiedIPv4 );        
+    record->iIpAddrFromServer.SetL( KDefIpAddrFromServer );
+    
+    record->iIpAddr.SetL( KUnspecifiedIPv4 );
+    
+    record->iIpDnsAddrFromServer.SetL( KDefIpDnsAddrFromServer );
+    
+    record->iIpNameServer1.SetL( KUnspecifiedIPv4 );
+    record->iIpNameServer2.SetL( KUnspecifiedIPv4 );
+    record->iIp6DnsAddrFromServer.SetL( KDefIp6DnsAddrFromServer );
+    record->iIp6NameServer1.SetL( KDynamicIpv6Address );
+    record->iIp6NameServer2.SetL( KDynamicIpv6Address );
+        
+//        record->iIpAddrLeaseValidFrom.SetL();
+//        record->iIpAddrLeaseValidTo.SetL();
+        
+    if ( KDefIpAddrFromServer )
+        {
+        record->iConfigDaemonManagerName.SetL( KDaemonManagerName );
+        record->iConfigDaemonName.SetL( KConfigDaemonName );
+        }
+    else
+        {
+        record->iConfigDaemonManagerName.SetL( KEmpty );
+        record->iConfigDaemonName.SetL( KEmpty );
+        }
+
+//        record->iServiceExtensionTableName.SetL();
+//        record->iServiceExtensionTableRecordId.SetL();
+    }
+
+// --------------------------------------------------------------------------
+// CCmPluginLanBase::PrepareToUpdateRecordsL()
+// --------------------------------------------------------------------------
+//        
+EXPORT_C void CCmPluginLanBase::PrepareToUpdateRecordsL()
+    {
+    LOGGER_ENTERFN( "CCmPluginLanBase::PrepareToUpdateRecordsL" );
+    
+    CheckDNSServerAddressL( ETrue, 
+                            ServiceRecord().iIp6NameServer1,
+                            ServiceRecord().iIp6NameServer2,
+                            ServiceRecord().iIp6DnsAddrFromServer );
+                            
+    CheckDNSServerAddressL( EFalse,
+                            ServiceRecord().iIpNameServer1,
+                            ServiceRecord().iIpNameServer2,
+                            ServiceRecord().iIpDnsAddrFromServer );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Src/cmpluginmultilinedialog.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,55 @@
+/*
+* 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 CCmPluginMultiLineDialog.
+*
+*/
+
+#include "cmpluginmultilinedialog.h"
+
+// ---------------------------------------------------------------------------
+// CCmPluginMultiLineDialog::NewL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCmPluginMultiLineDialog* CCmPluginMultiLineDialog::NewL(
+                           TDes&  aText1, TDes&  aText2,
+                           TTone aTone )
+    {
+    CCmPluginMultiLineDialog* self = 
+        new (ELeave) CCmPluginMultiLineDialog(aTone);
+    CleanupStack::PushL(self);
+
+    self->SetDataL( aText1, aText2 );
+
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginMultiLineDialog::CCmPluginMultiLineDialog
+// ---------------------------------------------------------------------------
+//
+CCmPluginMultiLineDialog::CCmPluginMultiLineDialog( const TTone& aTone )
+: CAknMultiLineDataQueryDialog( aTone )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginMultiLineDialog::UpdateLeftSoftKeyL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginMultiLineDialog::UpdateLeftSoftKeyL()
+    {
+    CAknMultiLineDataQueryDialog::UpdateLeftSoftKeyL();
+    MakeLeftSoftkeyVisible( ETrue );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Src/cmsettingsui.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,84 @@
+/*
+* 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 CCmSettingsUi.
+*
+*/
+
+#include <cmsettingsui.h>
+#include "cmsettingsuiimpl.h"
+#include <cmcommonconstants.h>
+
+//-----------------------------------------------------------------------------
+//  CCmSettingsUi::NewL()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C CCmSettingsUi* CCmSettingsUi::NewL()
+    {
+    CCmSettingsUi* self = new (ELeave) CCmSettingsUi();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );   // self
+    return self;
+    }
+
+//-----------------------------------------------------------------------------
+//  CCmSettingsUi::CCmSettingsUi()
+//-----------------------------------------------------------------------------
+//
+CCmSettingsUi::CCmSettingsUi()
+    {
+    }
+
+//-----------------------------------------------------------------------------
+//  CCmSettingsUi::~CCmSettingsUi()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C CCmSettingsUi::~CCmSettingsUi()
+    {
+    delete iImpl;
+    }
+
+//-----------------------------------------------------------------------------
+//  CCmSettingsUi::ConstructL()
+//-----------------------------------------------------------------------------
+//
+void CCmSettingsUi::ConstructL()
+    {
+    iImpl = CCmSettingsUiImpl::NewL();
+    }
+    
+//-----------------------------------------------------------------------------
+//  CCmSettingsUi::RunSettingsL()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C CCmSettingsUi::TResult CCmSettingsUi::RunSettingsL()
+    {
+    if ( iImpl->RunSettingsL() == KDialogUserExit )
+        {
+        return EExit;
+        }
+     else
+        {
+        return EBack;
+        }
+    }
+
+//-----------------------------------------------------------------------------
+//  CCmSettingsUi::SelectDestinationDlgL()
+//-----------------------------------------------------------------------------
+//    
+EXPORT_C TBool CCmSettingsUi::SelectDestinationDlgL( TUint32& aDestinationId )
+    {
+    return iImpl->SelectDestinationDlgL( aDestinationId );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Src/cmsettingsuiimpl.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,124 @@
+/*
+* 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 CCmSettingsUiImpl.
+*
+*/
+
+#include <cmmanager.rsg>
+
+#include "cmsettingsuiimpl.h"
+#include "cmmanagerimpl.h"
+#include "destdlg.h"
+#include <cmcommonconstants.h>
+#include "selectdestinationdlg.h"
+#include <data_caging_path_literals.hrh>
+
+//-----------------------------------------------------------------------------
+//  CCmSettingsUiImpl::NewL()
+//-----------------------------------------------------------------------------
+//
+CCmSettingsUiImpl* CCmSettingsUiImpl::NewL()
+    {
+    CCmSettingsUiImpl* self = new (ELeave) CCmSettingsUiImpl();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+//-----------------------------------------------------------------------------
+//  CCmSettingsUiImpl::CCmSettingsUiImpl
+//-----------------------------------------------------------------------------
+//
+CCmSettingsUiImpl::CCmSettingsUiImpl():
+    iResourceReader( *CCoeEnv::Static() )
+    {
+    }
+
+//-----------------------------------------------------------------------------
+// CCmSettingsUiImpl::LoadResourceL
+// Load the resource for the dll module
+// ----------------------------------------------------------------------------
+//
+TInt CCmSettingsUiImpl::LoadResourceL ()
+    {    
+    // Add resource file.
+    TParse* fp = new(ELeave) TParse(); 
+    TInt err = fp->Set( KACMManagerResDirAndFileName, 
+                        &KDC_RESOURCE_FILES_DIR, 
+                        NULL ); 
+    if ( err != KErrNone)
+        {
+        User::Leave( err );
+        }   
+
+    TFileName resourceFileNameBuf = fp->FullName();
+    delete fp;
+
+    iResourceReader.OpenL (resourceFileNameBuf);
+    return err;
+    }
+
+//-----------------------------------------------------------------------------
+//  CCmSettingsUiImpl::~CCmSettingsUiImpl
+//-----------------------------------------------------------------------------
+//
+CCmSettingsUiImpl::~CCmSettingsUiImpl()
+    {
+    delete iCmManagerImpl;
+    iResourceReader.Close();    
+    }
+
+//-----------------------------------------------------------------------------
+//  CCmSettingsUiImpl::ConstructL
+//-----------------------------------------------------------------------------
+//
+void CCmSettingsUiImpl::ConstructL()
+    {
+    iCmManagerImpl = CCmManagerImpl::NewL();
+    LoadResourceL();
+    AknsUtils::SetAvkonSkinEnabledL( ETrue );
+    }
+    
+//-----------------------------------------------------------------------------
+//  CCmSettingsUiImpl::RunSettingsL
+//-----------------------------------------------------------------------------
+//
+TInt CCmSettingsUiImpl::RunSettingsL()
+    {
+    CDestDlg* destDlg = new (ELeave) CDestDlg;
+
+    TUint32 selected = 0;
+    // No need to push it on to the cleanup stack as CEikDialog::PrepareLC
+    // does this favour for us.
+    
+    TBool exiting = EFalse;
+    
+    TInt result = destDlg->ConstructAndRunLD( 
+                                        iCmManagerImpl, 0, selected, exiting );
+        
+    return ( exiting ) ? KDialogUserExit: KDialogUserBack;
+    }    
+
+//-----------------------------------------------------------------------------
+//  CCmSettingsUiImpl::SelectDestinationDlgL
+//-----------------------------------------------------------------------------
+//
+TBool CCmSettingsUiImpl::SelectDestinationDlgL( TUint32& aDestinationId )
+    {
+    CSelectDestinationDlg* dlg = CSelectDestinationDlg::NewL( aDestinationId,
+                                                              *iCmManagerImpl );
+                                                              
+    return dlg->ExecuteLD( R_CMMANAGER_LIST_QUERY_WITH_MSGBOX );    
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Src/cmtransactionhandler.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,188 @@
+/*
+* 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:  Common transaction handler of framework and plugins.
+*
+*/
+
+#include <e32std.h>
+#include <e32base.h>
+
+#include "cmlogger.h"
+#include "cmmanagerimpl.h"
+#include "cmtransactionhandler.h"
+
+using namespace CommsDat;
+
+const TUint32 KMaxOpenTransAttempts = 10;
+const TUint32 KRetryAfter = 100000;
+
+// ---------------------------------------------------------------------------
+// CCmTransactionHandler::NewL
+// ---------------------------------------------------------------------------
+//
+CCmTransactionHandler* CCmTransactionHandler::NewL( CMDBSession& aDb )
+    {
+    CCmTransactionHandler* self = new (ELeave) CCmTransactionHandler( aDb );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );   // self
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmTransactionHandler::CCmTransactionHandler
+// ---------------------------------------------------------------------------
+//
+CCmTransactionHandler::CCmTransactionHandler( CMDBSession& aDb )
+    : iDb( aDb )
+    {
+    CLOG_CREATE;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmTransactionHandler::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CCmTransactionHandler::ConstructL()
+    {
+    TRAPD( err, CCmManagerImpl::HasCapabilityL( ECapabilityNetworkControl ) );
+    
+    if( !err )
+        {
+        iProtectionFlag = ECDProtectedWrite;
+        }
+    else
+        {
+        iProtectionFlag = 0;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmTransactionHandler::~CCmTransactionHandler
+// ---------------------------------------------------------------------------
+//
+CCmTransactionHandler::~CCmTransactionHandler()
+    {
+    CLOG_CLOSE;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmTransactionHandler::OpenTransactionLC
+// ---------------------------------------------------------------------------
+//
+void CCmTransactionHandler::OpenTransactionLC( TBool aSetAttribs )
+    {
+    LOGGER_ENTERFN( "CCmTransactionHandler::OpenTransactionL" );
+
+    ++iRefCount;
+    CLOG_WRITE_1( "Refs: [%d]", iRefCount );
+
+    // To call ::Close() on leave
+    CleanupClosePushL( *this );
+
+    // We don't have parent destination -> Session is opened only once        
+    if( !iDb.IsInTransaction() )
+        {
+        TInt err( KErrNone );
+        TUint32 attempts( KMaxOpenTransAttempts );
+        
+        do
+            {
+            CLOG_WRITE( "Opening" );
+            TRAP( err, iDb.OpenTransactionL() );
+            CLOG_WRITE_1( "Error: [%d]", err );
+            
+            if( err )
+                {
+                User::After( KRetryAfter );
+                }
+            }while( err && attempts-- );
+
+        User::LeaveIfError( err );
+        
+        if( aSetAttribs )
+            {
+            iDb.SetAttributeMask( ECDHidden | iProtectionFlag );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmTransactionHandler::CommitTransactionL
+// ---------------------------------------------------------------------------
+//
+void CCmTransactionHandler::CommitTransactionL( TInt aError )
+    {
+    LOGGER_ENTERFN( "CCmTransactionHandler::CommitTransactionL" );
+    
+    --iRefCount;
+    CLOG_WRITE_1( "ref: [%d]", iRefCount );
+    CLOG_WRITE_1( "Error: [%d]", aError );
+
+    CleanupStack::Pop( this );
+
+    if( !iRefCount )
+        {
+        if( aError )
+            {
+            iDb.RollbackTransactionL();
+            }
+        else
+            {
+            iDb.CommitTransactionL();
+            }
+
+        iDb.ClearAttributeMask( ECDHidden | ECDProtectedWrite );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmTransactionHandler::Close
+// ---------------------------------------------------------------------------
+//
+void CCmTransactionHandler::Close()
+    {
+    LOGGER_ENTERFN( "CCmTransactionHandler::Close" );
+    
+    if( 0 == iRefCount )
+        {
+        CLOG_WRITE( "No active transaction. Do nothing" );
+        return;
+        }
+
+    if( !iDb.IsInTransaction() )
+        // Sometimes CommsDat closes the transaction 
+        // on its own decision w/o any notification or reaseon.
+        // e.g. when you try to delete a non-existing record.
+        // It leaves with KErrNotFound, but rolls back the transaction.
+        {
+        CLOG_WRITE( "CommsDat already rolled back transaction. :(((" );
+        iRefCount = 0;
+        }
+    else
+        {
+        --iRefCount;
+        CLOG_WRITE_1( "ref: [%d]", iRefCount );
+
+        if( !iRefCount )
+            {
+            iDb.ClearAttributeMask( ECDHidden | ECDProtectedWrite );
+            
+            if( iDb.IsInTransaction() )
+                {
+                TRAP_IGNORE( iDb.RollbackTransactionL() );
+                }
+            }
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Src/cmwizard.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,487 @@
+/*
+* 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:  Wizard used for adding connection methods
+*
+*/
+
+#include <AknWaitDialog.h>
+#include <cmmanager.rsg>
+#include <StringLoader.h>
+#include <avkon.hrh>
+#include "cmwizard.h"
+#include <cmcommonconstants.h>
+#include <cmcommonui.h>
+#include "cmdestinationimpl.h"
+#include "cmlogger.h"
+#include "cmmanagerimpl.h"
+#include <cmpluginbaseeng.h>
+#include <cmpluginbase.h>
+#include "selectdestinationdlg.h"
+
+using namespace CMManager;
+
+// ---------------------------------------------------------------------------
+// CCmWizard::CCmWizard
+// ---------------------------------------------------------------------------
+//
+CCmWizard::CCmWizard( CCmManagerImpl& aCmManager ) 
+    : iCmManager( aCmManager )
+    {
+    CLOG_CREATE;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmWizard::~CCmWizard
+// ---------------------------------------------------------------------------
+//
+CCmWizard::~CCmWizard()
+    {
+    if( iCheckConnDlg )
+        {
+        delete iCheckConnDlg;
+        }
+    CLOG_CLOSE;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmWizard::CreateConnectionMethodL
+// ---------------------------------------------------------------------------
+//
+TInt CCmWizard::CreateConnectionMethodL
+                                    ( CCmDestinationImpl* aTargetDestination )
+    {
+    TInt index( KErrCancel );
+    
+    LOGGER_ENTERFN( "CCmWizard::CreateConnectionMethodL" );
+    TBool wizardCancelled = EFalse; // indicates if the wizard has got cancelled
+    TUint32 bearerType = 0;
+    TBool manuallyConfigure ( EFalse );
+    
+    if ( AutoCheckForCmsL() )
+        {
+        RArray<TUint32> availableBearers( KCmArrayMediumGranularity );
+        CleanupClosePushL( availableBearers );
+
+        CLOG_WRITE( "CCmWizard::Starting CheckForCms" );
+        CheckForCmsL( availableBearers );
+
+        // If user has cancelled the dialog, then (s)he wanted to terminate
+        // the whole procedure.
+        if ( iCheckConnDlgCancelled )
+            {
+            CLOG_WRITE( "CCmWizard::wizardCancelled" );
+            wizardCancelled = ETrue;
+            }
+        else
+            {
+            // If there's coverage for at least one of the bearer types
+            if ( availableBearers.Count() )
+                {
+                CLOG_WRITE_1( "CCmWizard::CreateConnectionMethodL av. bearers: [%d]",
+                               availableBearers.Count() );
+                // Show available conn methods in a list from which user has to
+                // select.
+                bearerType = TCmCommonUi::ShowAvailableMethodsL
+                                                ( availableBearers,
+                                                  iCmManager );
+                if ( !bearerType )
+                    {
+                    wizardCancelled = ETrue;
+                    CLOG_WRITE( "CCmWizard::wizardCancelled" );
+                    }
+                }
+            else    // no coverage at all
+                {
+                CLOG_WRITE( "CCmWizard::CreateConnectionMethodL no available bearers, manual selection." );
+                // "Do you want to configure conn methods manually?"
+                if ( ManualCheckForCmsL() )
+                    {
+                    // Yes, select a bearer manually
+                    bearerType = TCmCommonUi::SelectBearerL( iCmManager );
+                    if ( !bearerType )
+                        {
+                        // Cancelled dialog
+                        wizardCancelled = ETrue;
+                        }
+                    else
+                        {
+                        manuallyConfigure = ETrue;
+                        }
+                    }
+                else
+                    {
+                    // No, user has cancelled the dialog
+                    wizardCancelled = ETrue;
+                    }
+                }
+            }
+
+        CleanupStack::PopAndDestroy( &availableBearers );
+        }
+    else    // "No" for checking conn methods automatically
+        {
+        CLOG_WRITE( "CCmWizard::AutoCheckForCmsL returned FALSE" );
+        // Manual bearer selection
+        bearerType = TCmCommonUi::SelectBearerL( iCmManager );
+        if ( !bearerType )
+            {
+            // Cancelled dialog
+            wizardCancelled = ETrue;
+            }
+        else
+            {
+            manuallyConfigure = ETrue;
+            }
+        }
+
+    if ( !wizardCancelled )
+        {
+        CCmPluginBase* plugin = iCmManager.CreateConnectionMethodL(
+                                            bearerType, aTargetDestination );
+        CleanupStack::PushL( plugin );
+
+        CLOG_WRITE( "CCmWizard::CreateConnectionMethodL plugin created, starting initialization" );
+
+        // Bearer-specific UI-supported initialization is done by plug-ins
+	    TBool ret = EFalse;
+	    TRAPD(err, ret = plugin->InitializeWithUiL( manuallyConfigure ) );
+        if ( err == KErrNone && ret )
+            {
+            CCmDestinationImpl* targetDest = aTargetDestination;
+            // If target destination is not yet specified...
+            if ( !aTargetDestination )
+                {
+                // For virtual bearers: eliminated the underlying destination 
+                // from the destination selection dialog
+                TUint32 targetDestId( 0 );
+                
+                RArray<TUint32> destArray( iCmManager.DestinationCountL() );
+                CleanupClosePushL( destArray );
+                iCmManager.AllDestinationsL( destArray );
+                // now do the filtering
+                plugin->FilterPossibleParentsL( destArray );
+                
+                if ( !destArray.Count() )
+                    {
+                    // there are no destinations to put the CM into
+                    TCmCommonUi::ShowNoteL( R_CMWIZARD_NO_VPN_STACKING,
+                                            TCmCommonUi::ECmErrorNote );
+        
+                    CleanupStack::PopAndDestroy( &destArray );
+                    CleanupStack::PopAndDestroy( plugin );
+        
+                    CLOG_WRITE_1( "CCmWizard::CreateConnectionMethodL no valid parents after filtering, index: [%d]", index );
+                    return index;
+                    }
+                    
+                // ... then let the user select a destination.
+                CSelectDestinationDlg* dlg = CSelectDestinationDlg::NewL( targetDestId,
+                                                                          iCmManager,
+                                                                          &destArray );
+                dlg->ExecuteLD( R_CMMANAGER_LIST_QUERY_WITH_MSGBOX );
+        
+                CleanupStack::PopAndDestroy( &destArray );
+        
+                if ( targetDestId )
+                    {
+                    // CREATE an object based on an ID.
+                    targetDest = iCmManager.DestinationL( targetDestId );
+                    CleanupStack::PushL( targetDest );
+                    }
+                }
+
+            CLOG_WRITE_1( "CCmWizard::CreateConnectionMethodL target dest: [0x%x]",
+                           targetDest );
+    
+            // If the target destination is still unspecified at this point,
+            // then the only reason could be that the previous dialog was
+            // cancelled ==> do something only if we have the target 
+            // destination
+            if ( targetDest )
+                {
+                plugin->UpdateL();  // commit changes
+    
+                index = iCmManager.CopyConnectionMethodL( *targetDest,
+                                                                    *plugin );
+
+                RArray<TUint32> additionalCms;
+                CleanupClosePushL (additionalCms);
+                plugin->GetAdditionalUids( additionalCms );
+                if ( additionalCms.Count() )
+                    {//if there are additional cms created, move them to the target destination as well
+                    for ( TInt i = 0; i<additionalCms.Count(); i++)
+                        {
+                        CCmPluginBase* cm = iCmManager.GetConnectionMethodL( additionalCms[i] );
+                        CleanupStack::PushL(cm);
+                        iCmManager.CopyConnectionMethodL( *targetDest,
+                                                                    *cm );
+                        CleanupStack::PopAndDestroy( cm );
+                        }
+                    }
+                CleanupStack::PopAndDestroy( &additionalCms );
+
+                HBufC* destName = targetDest->NameLC();
+    
+                TCmCommonUi::ShowNoteL( R_CMWIZARD_NEW_METHOD_ADDED,
+                                        *destName,
+                                        TCmCommonUi::ECmOkNote );
+    
+                CleanupStack::PopAndDestroy( destName );
+    
+                // Here's a tricky one: if 'aTargetDestination' was NULL, then
+                // I had to create 'targetDest' myself (with
+                // iCmManager.DestinationL), consequently I have to
+                // free it up, too.
+                if ( !aTargetDestination )
+                    {
+                    CleanupStack::PopAndDestroy( targetDest );
+                    }
+                }
+            else // Wi-Fi may have set IAP in database. So, delete it.
+                {
+                CLOG_WRITE( "CCmWizard::CreateConnectionMethodL, handling cancel add destination -- start" );                                   
+                RArray<TUint32> additionalCms;
+                CleanupClosePushL (additionalCms);
+    
+                plugin->GetAdditionalUids( additionalCms );
+                CLOG_WRITE_1( "CCmWizard::CreateConnectionMethodL, addtionalCms count [%d]", additionalCms.Count() );
+                for ( TInt i = 0; i<additionalCms.Count(); i++)
+                    {
+                    CCmPluginBase* cm = iCmManager.GetConnectionMethodL( additionalCms[i] );
+                    CleanupStack::PushL(cm);
+                    cm->DeleteL( ETrue );
+                    CleanupStack::PopAndDestroy( cm );
+                    }
+                // If plugin hasn't got Iap Id, it's "normal" CM which has not been saved
+                // into CommsDat yet. Otherwise it's Wifi CM and has to be deleted by using
+                // DeleteL() method. 
+                if( plugin->GetIntAttributeL( ECmIapId ) )
+                    {
+                    plugin->DeleteL( ETrue );
+                    }
+    
+                CleanupStack::PopAndDestroy( &additionalCms );
+                CLOG_WRITE( "CCmWizard::CreateConnectionMethodL, handling cancel add destination -- end" );
+                }
+    		    }
+        CleanupStack::PopAndDestroy( plugin );
+        }
+       
+    return index;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmWizard::DialogDismissedL
+// ---------------------------------------------------------------------------
+//
+void CCmWizard::DialogDismissedL( TInt aButtonId )
+    {
+    LOGGER_ENTERFN( "CCmWizard::DialogDismissedL" );
+
+    CLOG_WRITE_1( "CCmWizard::DialogDismissedL, aButtonId: [%d]", aButtonId );
+    if ( aButtonId == EAknSoftkeyCancel )
+        {
+        if ( iCheckConnDlg != NULL )
+            {
+            CLOG_WRITE( "CCmWizard::CheckConnDlg is not NULL" );
+            iCheckConnDlgCancelled = ETrue;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmWizard::AutoCheckForCmsL
+// ---------------------------------------------------------------------------
+//
+TBool CCmWizard::AutoCheckForCmsL() const
+    {
+    LOGGER_ENTERFN( "CCmWizard::AutoCheckForCmsL" );
+    // Automatically check for available conn methods?
+    TInt retval =
+            TCmCommonUi::ShowConfirmationQueryL( R_CMWIZARD_AUTOMATIC_CHECK );
+
+    return ( retval == EAknSoftkeyYes || retval == EAknSoftkeyOk )
+            ? ETrue : EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmWizard::ManualCheckForCmsL
+// ---------------------------------------------------------------------------
+//
+TBool CCmWizard::ManualCheckForCmsL() const
+    {
+    LOGGER_ENTERFN( "CCmWizard::ManualCheckForCmsL" );
+    // Manually configure CMs?
+    TInt retval =
+            TCmCommonUi::ShowConfirmationQueryL(    
+                                             R_CMWIZARD_MANUAL_CONFIGURATION );
+
+    return ( retval == EAknSoftkeyYes || retval == EAknSoftkeyOk )
+            ? ETrue : EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmWizard::CheckForCmsL
+// ---------------------------------------------------------------------------
+//
+void CCmWizard::CheckForCmsL( RArray<TUint32>& aCoverageArray )
+    {
+    LOGGER_ENTERFN( "CCmWizard::CheckForCmsL" );
+    // Show a wait dialog
+    iCheckConnDlgCancelled = FALSE;
+    iCheckConnDlg = new (ELeave) CAknWaitDialog(
+                          ( REINTERPRET_CAST( CEikDialog**, &iCheckConnDlg )) );
+    
+    iCheckConnDlg->SetCallback( this );
+    
+    iCheckConnDlg->SetTone( CAknNoteDialog::EConfirmationTone );
+
+    HBufC* text = StringLoader::LoadLC( R_CMWIZARD_CHECKING_METHODS );
+    iCheckConnDlg->SetTextL( *text );
+    CleanupStack::PopAndDestroy( text );
+
+    iCheckConnDlg->ExecuteLD( R_CMMANAGER_WAIT_NOTE );
+
+    RArray<TUint32> bearers( KCmArrayMediumGranularity );
+    CleanupClosePushL( bearers );
+
+    iCmManager.SupportedBearersL( bearers );
+
+    for ( TInt i = 0; i < bearers.Count() && !iCheckConnDlgCancelled; i++ )
+        {
+        TBool avail( EFalse );
+        
+        TRAPD( err, avail = iCmManager.GetBearerInfoBoolL( bearers[i], ECmCoverage ) );
+
+        CLOG_WRITE_2( "CCmWizard::CheckForCms, bearer [%d] coverage error [%d]", i, err );
+        
+        if( err )
+            {
+            continue;
+            }
+            
+
+        if ( avail &&
+             iCmManager.GetBearerInfoBoolL( bearers[i], ECmAddToAvailableList ) )
+            {
+            aCoverageArray.AppendL( bearers[i] );
+            CLOG_WRITE_1( "CCmWizard::CheckForCms, bearer [%d] appended", i );
+            }
+        }
+
+    CleanupStack::PopAndDestroy( &bearers );
+
+    // Dismiss wait dialog
+    if( !iCheckConnDlgCancelled )
+        {
+        CLOG_WRITE( "CCmWizard::CheckForCms, cancelling wait dlg" );
+        iCheckConnDlg->SetCallback( NULL );
+        iCheckConnDlg->ProcessFinishedL();
+        CLOG_WRITE( "CCmWizard::CheckForCms, wait dialog deleted" );
+        }
+    else
+        {
+        CLOG_WRITE( "CCmWizard::CheckForCms, wait dlg was already cancelled" );
+        }
+    
+    
+    // Set the member to NULL every case
+    iCheckConnDlg = NULL;
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// CCmWizard::FindTargetDestinationL
+// ---------------------------------------------------------------------------
+//
+TUint32 CCmWizard::FindTargetDestinationL( CCmPluginBase* aPlugin )
+    {
+    LOGGER_ENTERFN( "CCmWizard::FindTargetDestinationL" );
+
+    // Tries to read the destination id
+    TUint32 targetDestId (0); 
+    TRAPD( err, targetDestId = 
+                aPlugin->GetIntAttributeL( ECmNextLayerSNAPId ) );
+                
+    // only supported by virtual bearers, don't leave        
+    if ( err && err != KErrNotSupported )
+       {
+       User::Leave( err );
+       }
+                
+    // targetDestId == 0 means that not destination but a connection 
+    // method have been selected
+    if ( targetDestId == 0 )
+        {
+        // Now the destination containing the connection method 
+        // should be obtained
+        TUint32 targetCmId (0); 
+        TRAPD( err, targetCmId = 
+                    aPlugin->GetIntAttributeL( ECmNextLayerIapId ) );
+        
+        // only supported by virtual bearers, don't leave        
+        if ( err && err != KErrNotSupported )
+            {
+            User::Leave( err );
+            }
+            
+        targetDestId = FindParentDestinationL( targetCmId );   
+        }
+        
+    return targetDestId;    
+    }
+ 
+// ---------------------------------------------------------------------------
+// CCmWizard::FindParentDestinationL
+// ---------------------------------------------------------------------------
+//
+TUint32 CCmWizard::FindParentDestinationL( TUint32 aCmId )
+    {
+    LOGGER_ENTERFN( "CCmWizard::FindParentDestinationL" );
+
+    TBool found = EFalse;
+    TUint32 targetDestId (0); 
+    
+    RArray<TUint32> destinations;
+   
+    iCmManager.AllDestinationsL( destinations );
+    CleanupClosePushL( destinations );
+    
+    RArray<TUint32> cms;
+    
+    for ( TInt i = 0; i < destinations.Count() && !found; i++ )
+        {            
+        CCmDestinationImpl* dest = 
+                          iCmManager.DestinationL( destinations[i] );
+        CleanupStack::PushL( dest );
+        dest->ConnectMethodIdArrayL( cms );
+        CleanupClosePushL( cms );
+
+        for ( TInt j = 0; j < cms.Count() && !found; j++ )
+            {
+            if( cms[j] == aCmId)
+                {
+                targetDestId = destinations[i];
+                found = ETrue;
+                }
+            }
+        CleanupStack::PopAndDestroy( &cms );
+        CleanupStack::PopAndDestroy( dest );
+        }
+
+    CleanupStack::PopAndDestroy( &destinations );
+
+    return targetDestId;    
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Src/destdlg.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,1696 @@
+/*
+* Copyright (c) 2006-2008 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:  Dialog for setting the gateway. It's used temporarily.
+*
+*/
+
+#include <avkon.hrh>
+#include <eikdef.h>
+#include <eikenv.h>
+#include <eikedwin.h>
+#include <gulicon.h>
+#include <cmmanager.rsg>
+#include <data_caging_path_literals.hrh>
+#include <cmmanager.mbg> 
+#include <badesca.h>        // CDesCArray
+#include <aknnavide.h>
+#include <akntitle.h>
+#include <eikmenup.h>
+#include <StringLoader.h>
+#include <AknIconArray.h>
+#include <aknnavilabel.h>
+#include <textresolver.h>
+
+#include <hlplch.h>
+#include <csxhelp/cp.hlp.hrh>
+
+#include <cmcommonconstants.h>
+#include <cmdestination.h>
+#include <cmcommonui.h>
+#include <cmpluginbaseeng.h>
+#include <cmpluginbase.h>
+
+#include "cmmanager.hrh"
+#include "destlistitem.h"
+#include "destlistitemlist.h"
+#include "destdlg.h"
+#include "cmwizard.h"
+#include "uncatdlg.h"
+#include "cmdlg.h"    
+#include "cmdesticondialog.h"
+#include "cmlistboxmodel.h"
+#include "cmlistitem.h"
+#include <mcmdexec.h>
+#include "ccmdexec.h"
+#include "cmlogger.h"
+
+using namespace CMManager;
+using namespace CommsDat;
+
+// ---------------------------------------------------------------------------
+// CDestDlg::ConstructAndRunLD
+// Constructs the dialog and runs it.
+// ---------------------------------------------------------------------------
+//
+TInt CDestDlg::ConstructAndRunLD( CCmManagerImpl* aCmManagerImpl,  
+                                  TUint32 aHighlight,
+                                  TUint32& aSelected,
+                                  TBool& aExiting )
+    {
+    iHighlight = aHighlight;
+    iSelected = &aSelected;
+    iCmManagerImpl = aCmManagerImpl;
+    iExiting = &aExiting;
+    *iExiting = EFalse;
+    
+    iCmdExec = new (ELeave) CCmdExec(*this);
+
+    ConstructL( R_DEST_MENUBAR );
+    PrepareLC( R_DEST_DIALOG );    
+    iModel = new( ELeave )CDestListboxModel();
+    iConnSettingsImpl = CCmConnSettingsUiImpl::NewL( iCmManagerImpl );
+
+    // CommsDat notifier should be started with this first UI view for
+    // it will create active object
+    iCmManagerImpl->StartCommsDatNotifierL();
+    iCmManagerImpl->WatcherRegisterL( this );
+    
+    return RunLD();
+    }
+    
+// ---------------------------------------------------------------------------
+// CDestDlg::CDestDlg()
+// ---------------------------------------------------------------------------
+//
+CDestDlg::CDestDlg() 
+    : iModelPassed( EFalse )
+    , iExitReason( KDialogUserExit )
+    , iEscapeArrived( EFalse )
+    {
+    CLOG_CREATE;
+    }
+    
+// ---------------------------------------------------------------------------
+// CDestDlg::~CApSelectorDialog
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CDestDlg::~CDestDlg()
+    {
+    // iModel is deleted by the ListBox because LB owns the model...
+    // of course only after we passed ownership...
+    if ( !iModelPassed )
+        {
+        delete iModel;
+        }
+    if ( iNaviDecorator )
+        {
+        delete iNaviDecorator;
+        }
+    if ( iTitlePane )
+        {
+        // set old text back, if we have it...
+        if ( iOldTitleText )
+            {
+            TRAP_IGNORE( iTitlePane->SetTextL( *iOldTitleText ) );
+            delete iOldTitleText;
+            }
+        }
+    if ( iConnSettingsImpl )
+        {
+        delete iConnSettingsImpl;            
+        }
+
+    if( iCmWizard )
+        {
+        delete iCmWizard;
+        }
+    
+    delete iCmdExec;
+    
+    CLOG_CLOSE;
+    }
+
+// ---------------------------------------------------------------------------
+// CDestDlg::PreLayoutDynInitL();
+// called by framework before dialog is shown
+// ---------------------------------------------------------------------------
+//
+void CDestDlg::PreLayoutDynInitL()
+    {
+    iListbox =
+        STATIC_CAST( CDestListbox*, Control( KDestListboxId ) );
+    iListbox->CreateScrollBarFrameL( ETrue );
+    iListbox->ScrollBarFrame()->SetScrollBarVisibilityL
+        ( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
+    iListbox->SetListBoxObserver( this );
+
+    iListbox->Model()->SetItemTextArray( iModel );
+    iModelPassed = ETrue;
+    InitTextsL();    
+    HandleListboxDataChangeL();
+    iListbox->HandleItemAdditionL();
+    }
+
+// ----------------------------------------------------------------------------
+// CDestDlg::DynInitMenuPaneL
+// ----------------------------------------------------------------------------
+//
+void CDestDlg::DynInitMenuPaneL( TInt aResourceId,
+                                        CEikMenuPane* aMenuPane )
+    {
+    switch ( aResourceId )
+        {
+        case R_DEST_MENU:
+            {            
+            // Check if it is the 'New connection' list item 
+            // rather than a real destination
+            TUint32 listItemUid = iListbox->CurrentItemUid();
+           if ( listItemUid == KDestItemNewConnection ) 
+                {
+                aMenuPane->SetItemDimmed( ECmManagerUiCmdDestEdit, ETrue );
+                aMenuPane->SetItemDimmed( ECmManagerUiCmdDestRename, ETrue );                
+                aMenuPane->SetItemDimmed( ECmManagerUiCmdDestDelete, ETrue );                
+                aMenuPane->SetItemDimmed( ECmManagerUiCmdDestChangeIcon, ETrue );   
+                } 
+            if ( !iCmManagerImpl->IsDefConnSupported() )
+                {
+                aMenuPane->SetItemDimmed( ECmManagerUiCmdDestDefaultConnection, ETrue );
+                }
+        	if (!iCmManagerImpl->IsHelpOn())
+                {
+                aMenuPane->DeleteMenuItem( EAknCmdHelp );		    
+                }
+            break;
+            }
+        default:
+            break;
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// CDestDlg::OfferKeyEventL
+// ---------------------------------------------------------------------------
+//
+TKeyResponse CDestDlg::OfferKeyEventL( const TKeyEvent& aKeyEvent, 
+                                       TEventCode aType )    
+    {
+    LOGGER_ENTERFN( "CDestDlg::OfferKeyEventL" );
+    CLOG_WRITE_1("Key iCode: %d", aKeyEvent.iCode );
+    
+    TKeyResponse retVal ( EKeyWasNotConsumed );
+    
+    TBool down( EFalse );
+    
+    switch ( aKeyEvent.iCode )
+        {
+        case EKeyEscape:
+            {
+            // Handling application close needs special care 
+            // because of iCmWizard 
+            if ( iCmWizard )
+                {
+                // if wizard alives then escape should do after wizard has ended.
+                CLOG_WRITE( "CDestDlg::OfferKeyEventL: Wizard in long process" );
+                iEscapeArrived = ETrue;
+                retVal = EKeyWasConsumed;
+                }
+            else    
+               {
+                CLOG_WRITE( "CDestDlg::OfferKeyEventL:Escape" );
+                retVal = CAknDialog::OfferKeyEventL( aKeyEvent, aType );
+               }
+            break;
+            }
+        case EKeyBackspace:
+            {
+            ProcessCommandL( ECmManagerUiCmdDestDelete );
+            retVal = EKeyWasConsumed;
+            break;
+            }
+        case EKeyDownArrow:
+            {
+            down = ETrue;
+            // intended flow-through
+            }
+        case EKeyUpArrow:
+            {
+            // When moving from the 'New connection' (first) item, MSK should be 'Open'
+            if ( iListbox->CurrentItemUid() == KDestItemNewConnection )
+                {
+                SetMskL( R_QTN_MSK_OPEN );
+                }                    
+            
+            // When moving to the 'New connection' (first item)
+            else if ( ( iListbox->CurrentItemIndex() == 1 && !down ) || 
+                      ( iListbox->CurrentItemIndex() + 1 == 
+                        iModel->MdcaCount() && down ) )
+                {
+                SetMskL( R_QTN_MSK_SELECT );
+                }    
+            // flow through to 'default' intended
+            }
+        default:
+            {
+            retVal = CAknDialog::OfferKeyEventL( aKeyEvent, aType );
+            break;
+            }
+        }
+    return retVal;
+    }
+
+// ----------------------------------------------------------------------------
+// CDestDlg::ShowDefaultSetNoteL
+// ----------------------------------------------------------------------------
+//
+void CDestDlg::ShowDefaultSetNoteL( TCmDefConnValue aSelection )
+    {
+    switch ( aSelection.iType )
+        {
+        case ECmDefConnDestination:
+        case ECmDefConnConnectionMethod:
+            {
+            HBufC* connName =  iConnSettingsImpl->CreateDefaultConnectionNameL( aSelection );
+            CleanupStack::PushL(connName);
+            TCmCommonUi::ShowNoteL( R_CMMANAGERUI_DEFAULT_CONNECTION_SET_TO,
+                                                *connName,
+                                                TCmCommonUi::ECmOkNote );
+            CleanupStack::PopAndDestroy( connName );
+            }
+        }
+    }
+
+
+// ----------------------------------------------------------------------------
+// CDestDlg::SetDefaultNaviL
+// ----------------------------------------------------------------------------
+//
+void CDestDlg::SetDefaultNaviL( TCmDefConnValue aSelection )    
+    {
+    HBufC* title = NULL;
+    
+    switch ( aSelection.iType )
+        {
+        case ECmDefConnDestination:
+        case ECmDefConnConnectionMethod:
+            {
+            HBufC* connName =  iConnSettingsImpl->CreateDefaultConnectionNameL( aSelection );
+            CleanupStack::PushL(connName);
+            title = StringLoader::LoadL( R_CMMANAGERUI_NAVI_DEFAULT, *connName );
+            CleanupStack::PopAndDestroy( connName );
+            CleanupStack::PushL( title );
+            break;
+            }
+        }    
+    
+    if ( iNaviDecorator )
+        {
+        if ( iNaviDecorator->ControlType() == 
+             CAknNavigationDecorator::ENaviLabel )
+            {
+            CAknNaviLabel* naviLabel = 
+                (CAknNaviLabel*)iNaviDecorator->DecoratedControl();
+            if ( title )
+                {
+                naviLabel->SetTextL(*title);
+                }
+            else
+                {
+                naviLabel->SetTextL( KNullDesC );
+                }
+            
+            iNaviPane->PushL( *iNaviDecorator );
+            }
+        }
+        
+    if ( title )
+        {
+        CleanupStack::PopAndDestroy( title );
+        }
+    }
+    
+// ----------------------------------------------------------------------------
+// CDestDlg::ProcessCommandL
+// ----------------------------------------------------------------------------
+//
+void CDestDlg::ProcessCommandL( TInt aCommandId )
+    {
+    LOGGER_ENTERFN( "CDestDlg::ProcessCommandL" );
+    CLOG_WRITE_1("Command: %d", aCommandId );
+
+    if ( MenuShowing() )
+        {
+        HideMenu();
+        }
+
+    switch ( aCommandId )
+        {
+        case EAknSoftkeyOptions:
+            {
+            DisplayMenuL();
+            break;
+            }
+        case ECmManagerUiCmdDestUserExit:
+            {
+            CLOG_WRITE( "CDestDlg::ProcessCommandL command: exit");
+            iExitReason = KDialogUserExit;
+            }
+        case EAknSoftkeyBack:
+            {
+            iCmManagerImpl->WatcherUnRegister();
+            TryExitL( iExitReason );
+            break;
+            }
+        case ECmManagerUiCmdDestEdit:
+            {
+            OnCommandDestinationEditL();
+            break;
+            }            
+        case ECmManagerUiCmdDestDefaultConnection:
+            {
+            TCmDCSettingSelection selection;
+            TCmDefConnValue defConnValue;
+            iCmManagerImpl->ReadDefConnL( defConnValue );
+            switch (defConnValue.iType)
+                {
+                case ECmDefConnConnectionMethod:
+                    {
+                    selection.iResult = EDCConnectionMethod;
+                    selection.iId = defConnValue.iId;
+                    break;
+                    }
+                case ECmDefConnDestination:
+                    {
+                    selection.iResult = EDCDestination;
+                    selection.iId = defConnValue.iId;
+                    break;
+                    }
+                default:
+                    {
+                    break;
+                    }
+                }
+            if ( iConnSettingsImpl->RunDefaultConnecitonRBPageL( selection ) )
+                {
+                defConnValue = selection.ConvertToDefConn();
+                ShowDefaultSetNoteL( defConnValue );
+                
+                iCmManagerImpl->WriteDefConnL( defConnValue );
+                HandleListboxDataChangeL();
+                }
+            break;
+            }
+            
+        case ECmManagerUiCmdDestChangeIcon:
+            {
+            // Check if this is UnCat
+            if ( iListbox->CurrentItemUid() == KDestItemUncategorized )
+                {
+                TCmCommonUi::ShowNoteL( R_CMWIZARD_CANNOT_PERFORM_FOR_PROTECTED,
+                                        TCmCommonUi::ECmErrorNote );
+                break;
+                }
+
+            // Check that destination is not protected
+            CCmDestinationImpl* dest =
+                       iCmManagerImpl->DestinationL( iListbox->CurrentItemUid() );
+            CleanupStack::PushL( dest );
+            if ( dest->ProtectionLevel() )
+                {
+                TCmCommonUi::ShowNoteL( R_CMWIZARD_CANNOT_PERFORM_FOR_PROTECTED,
+                                        TCmCommonUi::ECmErrorNote );
+
+                CleanupStack::PopAndDestroy( dest );
+                break;
+                }
+
+            TInt iconSelected = 0;
+            CCmDestinationIconDialog* popup = 
+                          new (ELeave) CCmDestinationIconDialog( iconSelected );  
+            if ( popup->ExecuteLD() )
+                {
+                dest->SetIconL( iconSelected ); // subclass implements
+                dest->UpdateL();
+                CleanupStack::PopAndDestroy( dest ); 
+                
+                HandleListboxDataChangeL();
+                break;
+                }
+
+            CleanupStack::PopAndDestroy( dest );
+
+            break;
+            
+            }
+
+            
+       case ECmManagerUiCmdDestAdd:
+            {
+            AddDestinationL();
+            break;           
+            }
+            
+        case EAknSoftkeyClear:
+        case ECmManagerUiCmdDestDelete:            
+            {
+            OnCommandDestinationDeleteL();
+            break;
+            
+            }            
+            
+        case ECmManagerUiCmdDestRename:
+            {
+            OnCommandDestinationRenameL();
+            break;
+            }
+
+        case EAknCmdHelp:
+            {
+            HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(),
+                                    iEikonEnv->EikAppUi()->AppHelpContextL() );
+            }
+            break;
+        
+        default:
+            {
+            break;
+            }
+        }
+    } 
+    
+// ---------------------------------------------------------------------------
+// CDestDlg::InitTextsL
+// called before the dialog is shown
+// to initialize localized textual data
+// ---------------------------------------------------------------------------
+//
+void CDestDlg::InitTextsL()
+    {
+    // set pane text if neccessary...
+    // pane text needed if not pop-up...
+    if ( iEikonEnv )
+        {
+        iStatusPane = iEikonEnv->AppUiFactory()->StatusPane();
+        iTitlePane =
+            ( CAknTitlePane* )iStatusPane->ControlL(
+                                TUid::Uid( EEikStatusPaneUidTitle ) );
+
+        iOldTitleText = iTitlePane->Text()->AllocL();
+        iTitlePane->SetTextL( 
+                        *(StringLoader::LoadLC( R_CMMANAGERUI_NAVI )) );
+
+        CleanupStack::PopAndDestroy(); // resource R_CMMANAGERUI_NAVI
+        iNaviPane = ( CAknNavigationControlContainer* ) 
+                        iStatusPane->ControlL( 
+                                TUid::Uid( EEikStatusPaneUidNavi ) );
+        iNaviDecorator = iNaviPane->CreateNavigationLabelL( KNullDesC );
+        iNaviPane->PushL( *iNaviDecorator );
+        if ( iCmManagerImpl->IsDefConnSupported() )
+            {
+            TCmDefConnValue selection;
+            selection.iType = ECmDefConnAlwaysAsk;
+            iCmManagerImpl->ReadDefConnL( selection );
+            SetDefaultNaviL( selection );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CDestDlg::SetNoOfDestsL
+// ---------------------------------------------------------------------------
+//
+void CDestDlg::SetNoOfDestsL( TInt aCount )
+    {
+    HBufC* title = NULL;
+    
+    if ( aCount == 1 )
+        {
+        title = StringLoader::LoadLC( R_QTN_NETW_CONSET_NAVI_ONE_DESTINATION );
+        }
+    else
+        {
+        title = StringLoader::LoadLC( R_QTN_NETW_CONSET_NAVI_NOF_DESTINATIONS,
+                                         aCount );
+        }
+    if (iNaviDecorator)
+        {
+        if ( iNaviDecorator->ControlType() == 
+             CAknNavigationDecorator::ENaviLabel )
+            {
+            CAknNaviLabel* naviLabel = 
+                            (CAknNaviLabel*)iNaviDecorator->DecoratedControl();
+            naviLabel->SetTextL(*title);
+            iNaviPane->PushL( *iNaviDecorator );
+            }
+        }
+        
+      CleanupStack::PopAndDestroy( title );
+    }
+
+// ---------------------------------------------------------------------------
+// CDestDlg::CreateCustomControlL
+// ---------------------------------------------------------------------------
+//
+SEikControlInfo CDestDlg::CreateCustomControlL
+( TInt aControlType )
+    {
+    SEikControlInfo controlInfo;
+    controlInfo.iTrailerTextId = 0;
+    controlInfo.iFlags = 0;
+    if ( aControlType == KDestListboxType )
+        {
+        controlInfo.iControl = new ( ELeave ) CDestListbox;
+        }
+    else
+        {
+        controlInfo.iControl = NULL;
+        }
+    return controlInfo;
+    }
+
+// ---------------------------------------------------------------------------
+// CDestDlg::OkToExitL
+// Good to know : EAknSoftkeyCancel is never called, because
+// EEikDialogFlagNotifyEsc flag is not set in the resource.
+// ---------------------------------------------------------------------------
+//
+TBool CDestDlg::OkToExitL( TInt aButtonId )
+    {
+    CLOG_WRITE_1( "CDestDlg::OkToExitL buttonId: %d", aButtonId );
+    
+    // Translate the button presses into commands for the appui & current
+    // view to handle
+    TBool retval( EFalse );
+    switch ( aButtonId )
+        {
+        case EAknSoftkeyOk:
+        case EAknSoftkeySelect:
+        case ECmManagerUiCmdCmAdd:
+            {
+            if ( !iProcessing )
+                {
+                iProcessing = ETrue;
+                ProcessCommandL( ECmManagerUiCmdDestEdit );
+                iProcessing = EFalse;
+                }
+            break;
+            }
+        case EAknSoftkeyBack:
+            {
+            if (!iProcessing)
+                {
+                *iExiting = EFalse;
+                retval = ETrue;                
+                }
+            break;
+            }
+        case EAknSoftkeyOptions:
+            {
+            if ( !iProcessing )
+                {
+                DisplayMenuL();
+                }
+            break;
+            }
+        default:
+            {
+
+            CLOG_WRITE_1( "CDestDlg::OkToExitL: High level stop %d", aButtonId );
+
+            *iExiting = ETrue;
+            retval = ETrue;
+            break;
+            }
+        }
+    return retval;
+    }
+
+// ---------------------------------------------------------------------------
+// CDestDlg::HandleListBoxEventL
+// ---------------------------------------------------------------------------
+void CDestDlg::HandleListBoxEventL( CEikListBox* /*aListBox*/,
+                                    TListBoxEvent aEventType )
+    {
+    LOGGER_ENTERFN( "CDestDlg::HandleListBoxEventL" );
+
+    switch ( aEventType )
+        {
+        case EEventEnterKeyPressed:
+        case EEventItemSingleClicked:
+            {
+            if ( !iProcessing )
+                {
+                iCmdExec->Execute();
+                }
+            break;
+            }
+        case EEventEditingStarted:
+            {
+            break;
+            }
+        case EEventEditingStopped:
+            {
+            break;
+            }
+        default:
+            {
+            break;
+            };
+        };
+    }
+
+// ----------------------------------------------------------------------------
+// CDestDlg::HandleListboxDataChangeL
+// called before the dialog is shown to initialize listbox data
+// ----------------------------------------------------------------------------
+//
+void CDestDlg::HandleListboxDataChangeL()
+    {
+    LOGGER_ENTERFN( "CDestDlg::HandleListboxDataChangeL" );
+
+    iCmManagerImpl->OpenTransactionLC();
+    
+    iModel->ResetAndDestroy();
+    RArray<TUint32> destIdArray = RArray<TUint32>( KCmArrayBigGranularity );
+
+    CArrayPtr< CGulIcon >* icons = new( ELeave ) CAknIconArray( KGranularity );
+    CleanupStack::PushL( icons );
+
+    MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
+    
+    iCmManagerImpl->AllDestinationsL(destIdArray);
+    
+    // Append the destinations to the list
+    CleanupClosePushL( destIdArray ); // 1
+    
+   TCmDefConnValue defConnSel;
+   defConnSel.iType = ECmDefConnAlwaysAsk;//default value
+   if ( iCmManagerImpl->IsDefConnSupported() )
+       {
+        //refresh default connection in navi pane
+        iCmManagerImpl->ReadDefConnL(defConnSel);
+        SetDefaultNaviL( defConnSel );                                        
+       }
+   else        
+        {
+        SetNoOfDestsL( destIdArray.Count() );
+        }
+    ///!!!TEMP, no icon for add connection yet
+    TParse mbmFile;
+    User::LeaveIfError( mbmFile.Set( KManagerIconFilename, 
+                                     &KDC_APP_BITMAP_DIR, 
+                                     NULL ) );
+
+    CGulIcon* icon = AknsUtils::CreateGulIconL( //second, KDestReservedIconIndexProtected 
+                        skinInstance, 
+                        KAknsIIDQgnPropSetConnDestAdd,
+                        mbmFile.FullName(), 
+                        EMbmCmmanagerQgn_prop_set_conn_dest_add, 
+                        EMbmCmmanagerQgn_prop_set_conn_dest_add_mask ); 
+    CleanupStack::PushL( icon );
+    icons->AppendL( icon );
+    CleanupStack::Pop( icon );
+    
+   icon = AknsUtils::CreateGulIconL( //second, KDestReservedIconIndexProtected 
+                        skinInstance, 
+                        KAknsIIDQgnIndiSettProtectedAdd,
+                        mbmFile.FullName(), 
+                        EMbmCmmanagerQgn_indi_sett_protected_add, 
+                        EMbmCmmanagerQgn_indi_sett_protected_add_mask );
+   
+
+// Previous must me changed to following if any problems with theme colours
+/*    AknsUtils::CreateColorIconLC( skinInstance,
+                                  KAknsIIDQgnIndiSettProtectedAdd,
+                                  KAknsIIDQsnIconColors,
+                                  EAknsCIQsnIconColorsCG13,
+                                  bitmap,
+                                  mask,
+                                  mbmFile.FullName(),
+                                  EMbmCmmanagerQgn_indi_sett_protected_add,
+                                  EMbmCmmanagerQgn_indi_sett_protected_add_mask,
+                                  AKN_LAF_COLOR( 215 ) );
+
+    icon = CGulIcon::NewL( bitmap, mask ); // Ownership transferred
+    CleanupStack::Pop( 2 ); // bitmap, mask*/
+                        
+    CleanupStack::PushL( icon );
+    icons->AppendL( icon );
+    CleanupStack::Pop( icon );
+    
+    //third, uncategorized KDestReservedIconIndexUncategorized
+    icons->AppendL( iCmManagerImpl->UncategorizedIconL() );
+    
+    //0..3 are reserved indexes!
+    CFbsBitmap* bitmap = NULL;
+    CFbsBitmap* mask = NULL;
+    
+    AknsUtils::CreateColorIconLC( skinInstance,
+                                  KAknsIIDQgnIndiDefaultConnAdd,
+                                  KAknsIIDQsnIconColors,
+                                  EAknsCIQsnIconColorsCG13,
+                                  bitmap,
+                                  mask,
+                                  mbmFile.FullName(),
+                                  EMbmCmmanagerQgn_indi_default_conn_add,
+                                  EMbmCmmanagerQgn_indi_default_conn_add_mask,
+                                  AKN_LAF_COLOR( 215 ) );
+
+    icon = CGulIcon::NewL( bitmap, mask ); // Ownership transferred
+    CleanupStack::Pop( 2 ); // bitmap, mask
+
+    CleanupStack::PushL( icon );
+    icons->AppendL( icon );
+    CleanupStack::Pop( icon );
+       
+    // Add the New Connection Item
+    HBufC* newConnection = StringLoader::LoadLC( 
+                                    R_CMMANAGERUI_NEW_CONNECTION ); // 2
+        
+    CDestListItem* newConnItem = 
+                    CDestListItem::NewLC( 
+                            KDestItemNewConnection,
+                            newConnection,
+                            0,
+                            KDestReservedIconIndexNewConn, EProtLevel0, EFalse  ); // 3
+    iModel->AppendL( newConnItem ); // ownership relinquished
+    CleanupStack::Pop( newConnItem );
+    CleanupStack::Pop( newConnection );
+    
+    TTime destTime;
+
+//refresh default connection icon in list - no effect if feature flag is off (defConnSel
+// is ECmDefConnAlwaysAsk)
+    TInt defUid = KErrNotFound;
+    if ( defConnSel.iType == ECmDefConnDestination )
+        {
+        defUid = defConnSel.iId;
+        }
+
+    
+    for (TInt i = 0; i < destIdArray.Count(); i++)
+        {
+        // Get the destinations from their IDs
+        CCmDestinationImpl* dest = NULL;
+        
+        
+        TRAPD( err, dest = iCmManagerImpl->DestinationL( destIdArray[i] ) );
+        if( err )
+            {
+            continue;
+            }
+        CleanupStack::PushL( dest ); 
+
+        // Check whether the MMS SNAP is in question. 
+        // It should not be shown on the UI in the destinations list
+        TInt snapMetadata = 0;
+        TRAPD(metaErr, snapMetadata = dest->MetadataL( CMManager::ESnapMetadataPurpose ));
+        if ( metaErr == KErrNone && snapMetadata == CMManager::ESnapPurposeMMS )
+            {
+            // This is the MMS SNAP, skip this item
+            if( dest )
+                {
+                CleanupStack::PopAndDestroy( dest );
+                dest = NULL;
+                }  
+            continue;
+            }
+
+        // Also hidden destinations are shown (TSW id ERUN-79KFAK)
+        icons->AppendL( dest->IconL() );            
+        HBufC* name =  dest->NameLC(); // 3
+        TBool def = EFalse;
+        if ( defUid == dest->Id() ) //this is the default destination, indicate it!
+            {
+            def = ETrue;
+            }
+        
+        // The connection methods bound to this destination may have to be checked with
+        // validity. Some connection methods might be invalid.
+        TInt numOfCms = dest->ConnectionMethodCount();
+        if (numOfCms > 0)
+            {
+            RArray<TUint32> cmIds;
+            dest->ConnectMethodIdArrayL( cmIds );
+            CleanupClosePushL( cmIds );
+
+            for ( TInt j = 0; j < cmIds.Count(); j++ )
+                {
+                TUint recId = cmIds[j];
+
+                TRAP( err, TUint32 bearerType = iCmManagerImpl->BearerTypeFromCmIdL( recId ) );
+                if( err == KErrNotSupported )
+                    {
+                    CLOG_WRITE_1( "CDestDlg::HandleListboxDataChangeL, IAP(%d) unsupported", recId );
+                    numOfCms = numOfCms -1;
+                    }
+                }
+
+            CleanupStack::PopAndDestroy( &cmIds );
+            }
+        
+        CDestListItem* item = CDestListItem::NewLC( 
+                                    dest->Id(),
+                                    name,
+                                    numOfCms,
+                                    icons->Count()-1, dest->ProtectionLevel(), def ); // 4
+        iModel->AppendL( item );        // ownership passed
+        CleanupStack::Pop( item );
+        CleanupStack::Pop( name );
+        if( dest )
+            {
+            CleanupStack::PopAndDestroy( dest );
+            dest = NULL;
+            }    
+        }
+        
+    // Add the Uncategorised Item
+    RArray<TUint32> uncatArray(KCmArraySmallGranularity);
+    CleanupClosePushL(uncatArray);
+    
+    iCmManagerImpl->ConnectionMethodL( uncatArray, ETrue );
+    TUint32 numberOfCMs = NumberOfCMsL( uncatArray );
+    if ( numberOfCMs )
+        {
+        icon = AknsUtils::CreateGulIconL(
+                        skinInstance, 
+                        KAknsIIDQgnPropSetConnDestUncategorized,
+                        mbmFile.FullName(), 
+                        EMbmCmmanagerQgn_prop_set_conn_dest_uncategorized, 
+                        EMbmCmmanagerQgn_prop_set_conn_dest_uncategorized_mask ); 
+        CleanupStack::PushL( icon );
+        icons->AppendL( icon );
+        CleanupStack::Pop( icon );
+
+        HBufC* uncat = StringLoader::LoadLC( 
+                                    R_CMMANAGERUI_DEST_UNCATEGORIZED ); // 2
+        
+        // Check the hidden connection methods
+        for ( TInt k = 0; k < uncatArray.Count(); k++ )
+            {
+            TUint recId = uncatArray[k];
+            if ( iCmManagerImpl->GetConnectionMethodInfoBoolL( recId, ECmHidden ) )
+                {
+                numberOfCMs = numberOfCMs -1;
+                }
+            }
+        
+        CDestListItem* uncatItem = 
+                        CDestListItem::NewLC( 
+                                KDestItemUncategorized,
+                                uncat,
+                                numberOfCMs,
+                                icons->Count()-1, EProtLevel0, EFalse ); // 3
+        iModel->AppendL( uncatItem ); // ownership relinquished
+        CleanupStack::Pop( uncatItem );
+        CleanupStack::Pop( uncat );
+        }
+
+    CleanupStack::PopAndDestroy( 2, &destIdArray ); // destIdArray
+        
+    CArrayPtr<CGulIcon>* oldIcons = 
+                            iListbox->ItemDrawer()->ColumnData()->IconArray();
+    if( oldIcons )
+        {
+        oldIcons->ResetAndDestroy();
+        delete oldIcons;
+        }
+    
+    iListbox->ItemDrawer()->ColumnData()->SetIconArray( icons );
+    iListbox->HandleItemAdditionL();
+    iListbox->UpdateScrollBarsL();
+
+    if ( !iListbox->CurrentItemUid() && !numberOfCMs )
+        {
+        // selection is out of range (e.g. Uncategorized deleted)
+        iListbox->SetCurrentItemIndexAndDraw( 0 );
+        }
+
+    CleanupStack::Pop( icons );
+    
+    iCmManagerImpl->RollbackTransaction();   
+    }
+    
+// ----------------------------------------------------------------------------
+// CDestDlg::NumberOfCMsL
+// ----------------------------------------------------------------------------
+//
+TUint32 CDestDlg::NumberOfCMsL(RArray<TUint32> cmArray)
+    {
+    LOGGER_ENTERFN( "CDestDlg::NumberOfCMsL" );
+
+    TUint32 cmCount = cmArray.Count();
+    TUint32 retValue = cmArray.Count();
+    CCDIAPRecord* iapRecord = NULL;
+    for ( TInt i = 0; i < cmCount; i++ )
+        {
+        if ( cmArray[i] <= 255 )// not embedded destination 
+            {
+            iapRecord = static_cast<CCDIAPRecord *>
+                          (CCDRecordBase::RecordFactoryL(KCDTIdIAPRecord));
+            CleanupStack::PushL( iapRecord );
+            
+            iapRecord->SetRecordId( cmArray[i] );
+            iapRecord->LoadL( iCmManagerImpl->Session() );
+            
+            TRAPD( err, iCmManagerImpl->BearerTypeFromIapRecordL( iapRecord ) );
+            
+            if( err == KErrNotSupported )
+                // This is unsupported connection method -> don't display
+                {
+                retValue--;
+                }
+            else
+                {
+                User::LeaveIfError( err );
+                }
+            CleanupStack::PopAndDestroy( iapRecord );
+            }
+        }
+    return retValue;
+    }
+
+// ----------------------------------------------------------------------------
+// CDestDlg::AddDestinationL
+// ----------------------------------------------------------------------------
+//
+void CDestDlg::AddDestinationL()
+    {
+    LOGGER_ENTERFN( "CDestDlg::AddDestinationL" );
+
+    TBuf<KDestinationNameMaxLength> destName;    
+    
+    TBool okToAdd = EFalse;
+    TBool nameAccepted = ETrue;
+    do 
+        {
+        okToAdd = TCmCommonUi::ShowConfirmationQueryWithInputL(
+                                           R_CMMANAGERUI_PRMPT_DESTINATION_NAME,
+                                           destName );
+        if ( okToAdd )
+            {
+            CCmDestinationImpl* dest = NULL;
+            
+            TRAPD(err, dest = iCmManagerImpl->CreateDestinationL( destName ) );
+            if ( err == KErrAlreadyExists )
+                {
+                nameAccepted = EFalse;
+                TCmCommonUi::ShowNoteL
+                    ( R_CMMANAGERUI_INFO_DEST_ALREADY_IN_USE,
+                    destName,
+                    TCmCommonUi::ECmErrorNote );                        
+                }
+            else if ( err == KErrDiskFull )
+                {
+                CTextResolver* iTextResolver = CTextResolver::NewLC(*iCoeEnv); 
+                okToAdd = EFalse;
+                TPtrC buf;
+                buf.Set(iTextResolver->ResolveErrorString(err)); 
+                TCmCommonUi::ShowNoteL( buf, TCmCommonUi::ECmErrorNote );
+                CleanupStack::PopAndDestroy( iTextResolver );
+                }
+            else if ( err == KErrNone )
+                {
+                CleanupStack::PushL( dest );
+                nameAccepted = ETrue;
+                TInt index = 0;
+                TInt iconSelected = 0;
+                CCmDestinationIconDialog* popup = 
+                      new (ELeave) CCmDestinationIconDialog( iconSelected );  
+                
+                // Show the icon dialogs
+                if ( popup->ExecuteLD() )
+                    {
+                    index = iconSelected;
+                    
+                    dest->SetIconL( index ); // subclass implements
+                    //dest->UpdateL();
+                    TRAPD( err, dest->UpdateL() );
+                    if( err )
+                        {
+                        TCmCommonUi::ShowNoteL( R_CMWIZARD_CANNOT_PERFORM_FOR_PROTECTED,
+                                TCmCommonUi::ECmErrorNote );
+                        }
+                    else
+                        {
+                        TRAP( err, HandleListboxDataChangeL() );
+                        if ( err )
+                            {
+                            TCmCommonUi::ShowNoteL( R_CMWIZARD_CANNOT_PERFORM_FOR_PROTECTED,
+                                    TCmCommonUi::ECmErrorNote );
+                            }
+                        }
+                    
+                    CDestListboxModel* lbmodel = 
+                              STATIC_CAST( CDestListboxModel*,
+                                           iListbox->Model()->ItemTextArray() );
+                    CDestListItem* lbitem = 
+                                        lbmodel->At( lbmodel->MdcaCount() - 1 );
+
+                    //returns null if item is not present                                        
+                    if ( lbitem->Uid() == KDestItemUncategorized  )
+                        {
+                        //last item is uncategorized
+                        iListbox->ScrollToMakeItemVisible( 
+                                                    lbmodel->MdcaCount() - 2 );
+                        //last item is uncategorized
+                        iListbox->SetCurrentItemIndexAndDraw( 
+                                                    lbmodel->MdcaCount() - 2 );
+                        }
+                     else
+                        {
+                        iListbox->ScrollToMakeItemVisible( 
+                                                    lbmodel->MdcaCount() - 1 );
+                        iListbox->SetCurrentItemIndexAndDraw( 
+                                                    lbmodel->MdcaCount() - 1 );
+                        }                    
+
+                    iListbox->HandleItemAdditionL();
+
+                    TCmCommonUi::ShowNoteL( R_CMWIZARD_NEW_DEST_ADDED,
+                                            destName,
+                                            TCmCommonUi::ECmOkNote );
+                    
+                    // Sets the mittle soft key text to "Open"                        
+                    SetMskL( R_QTN_MSK_OPEN );
+                                            
+                    }
+                if(dest)
+                    {
+                    CleanupStack::PopAndDestroy( dest );
+                    dest = NULL;
+                    }    
+                }
+            }
+        } while ( !nameAccepted && okToAdd );
+    }
+
+// ----------------------------------------------------------------------------
+// CDestDlg::OnCommandDestinationEdit
+// ----------------------------------------------------------------------------
+//
+void CDestDlg::OnCommandDestinationEditL()
+    {
+    LOGGER_ENTERFN( "CDestDlg::OnCommandDestinationEditL" );
+
+    // Check if memory full
+    TBool ret ( EFalse );
+    ret = iCmManagerImpl->IsMemoryLow();
+    if( ret )
+        {
+        CLOG_WRITE( "CDestDlg::OnCommandDestinationEditL: Memory Full, return!" );
+        return;
+        }
+
+    if ( iListbox->CurrentItemUid() == KDestItemNewConnection )
+        {
+        // If there's at least one uprotected destination available
+        if ( iCmManagerImpl->DestinationCountL() )
+            {
+            if ( iCmManagerImpl->HasUnprotectedDestinationsL() )
+                {
+                // Opens a Connection method creation wizard
+                CLOG_WRITE( "CDestDlg::OnCommandDestinationEditL iCmWizard constructing" );
+                iCmWizard = new (ELeave) CCmWizard( *iCmManagerImpl );
+                TInt ret( KErrNone );
+                TRAPD( err, ret = iCmWizard->CreateConnectionMethodL() );
+                if ( err == KErrDiskFull )
+                    {
+                    CTextResolver* iTextResolver = CTextResolver::NewLC(*iCoeEnv); 
+                    ret = KErrCancel;
+                    TPtrC buf;
+                    buf.Set(iTextResolver->ResolveErrorString(err)); 
+                    TCmCommonUi::ShowNoteL( buf, TCmCommonUi::ECmErrorNote );
+                    CleanupStack::PopAndDestroy( iTextResolver );
+                    }
+                else if ( err )
+                    {
+                    TCmCommonUi::ShowNoteL( R_CMWIZARD_CANNOT_PERFORM_FOR_PROTECTED,
+                            TCmCommonUi::ECmErrorNote );
+                    ret = KErrCancel;
+                    }
+                delete iCmWizard;
+                iCmWizard = NULL;
+                CLOG_WRITE_1( "CDestDlg::iCmWizard ret %d", ret );
+
+                // If application wanted to be closed before then RunAppShutter()
+                // should be called here                
+                if( iEscapeArrived )
+                    {
+                    CLOG_WRITE_1( "CDestDlg::iEscapeArrived %d", iEscapeArrived );
+                    ( ( CAknAppUi* )iEikonEnv->EikAppUi() )->RunAppShutter();
+                    }
+                else
+                    {
+                    if( ret != KErrCancel )
+                        {
+                        TRAP( err, HandleListboxDataChangeL() );
+                        if ( err )
+                            {
+                            TCmCommonUi::ShowNoteL( R_CMWIZARD_CANNOT_PERFORM_FOR_PROTECTED,
+                                    TCmCommonUi::ECmErrorNote );
+                            return;
+                            }
+                        }
+                    }
+
+                }
+            else
+                {
+                // Show a warning here
+                TCmCommonUi::ShowNoteL( R_CMWIZARD_NO_UNPROTECTED_DESTINATION,
+                                        TCmCommonUi::ECmWarningNote );
+                }
+            }
+        else
+            {
+            // ... otherwise show a warning.
+            TCmCommonUi::ShowNoteL( R_CMWIZARD_NO_DESTINATION,
+                                    TCmCommonUi::ECmWarningNote );
+            }
+        }
+    else
+        {
+        if ( iListbox->CurrentItemUid() == KDestItemUncategorized )                
+            {
+            CUncatDlg* uncatDlg = CUncatDlg::NewL( iCmManagerImpl );
+
+            TUint32 selected = 0;
+            if ( uncatDlg->ConstructAndRunLD( 0, selected ) == 
+                 KDialogUserExit)
+                {
+                TryExitL(ETrue);
+                }
+            else
+                {
+                HandleListboxDataChangeL();                
+                }
+            }
+        else
+            {
+            CCmDlg* cmDlg = CCmDlg::NewL( iCmManagerImpl , 
+                iListbox->CurrentItemUid(), this );
+
+            TUint32 selected = 0;
+            if ( cmDlg->ConstructAndRunLD( 0, selected ) == 
+                 KDialogUserExit )
+                {
+                TryExitL(ETrue);
+                }
+            else
+                {
+                HandleListboxDataChangeL();                
+                }
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CDestDlg::OnCommandDestinationDelete
+// ----------------------------------------------------------------------------
+//
+void CDestDlg::OnCommandDestinationDeleteL()
+    {
+    LOGGER_ENTERFN( "CDestDlg::OnCommandDestinationDeleteL" );
+
+    TCmDefConnValue oldConn;
+    if (iCmManagerImpl->IsDefConnSupported())
+        {    
+        iCmManagerImpl->ReadDefConnL( oldConn );
+        }
+    TUint32 listItemUid = iListbox->CurrentItemUid();
+    
+    if ( listItemUid == KDestItemNewConnection )
+        {
+        // ignore this command - it's not a destination
+        return;
+        }            
+    
+    if ( listItemUid == KDestItemUncategorized )
+        {
+        // Cannot delete Uncategoried Destination
+        TCmCommonUi::ShowNoteL( R_CMWIZARD_CANNOT_PERFORM_FOR_PROTECTED,
+                                TCmCommonUi::ECmErrorNote );
+                                
+        return;
+        }
+
+    TBool carryOn( ETrue );
+    // Cannot delete if the destination is embedded somewhere                                
+    CCmDestinationImpl* dest = 
+         iCmManagerImpl->DestinationL( iListbox->CurrentItemUid() );
+    CleanupStack::PushL( dest );
+    // We need this trap only because this function is called from a trap
+    TRAPD( err, dest->CheckIfEmbeddedL( dest->Id() ) );
+    if ( err == KErrNotSupported )
+        {
+        CleanupStack::PopAndDestroy( dest );
+        TCmCommonUi::ShowNoteL( R_CMWIZARD_CANNOT_PERFORM_FOR_PROTECTED,
+                                TCmCommonUi::ECmErrorNote );
+        return;
+        }
+    else if ( err )
+        {
+        CleanupStack::PopAndDestroy( dest );
+        User::Leave(err);
+        }
+    
+    // Show an error message to the user
+    if ( dest->ProtectionLevel() )
+        {
+        TCmCommonUi::ShowNoteL( R_CMWIZARD_CANNOT_PERFORM_FOR_PROTECTED,
+                                TCmCommonUi::ECmErrorNote );
+        carryOn = EFalse;
+        }
+        
+    if( carryOn )
+        {
+        if( dest->IsConnectedL() )
+            {
+            TCmCommonUi::ShowNoteL( 
+                       R_CMMANAGERUI_INFO_DEST_IN_USE_CANNOT_DELETE,
+                       TCmCommonUi::ECmErrorNote );
+            carryOn = EFalse;
+            }
+        }
+    
+    // check if it is linked by anybody
+    
+    if ( carryOn )
+        {
+        // for each IAP in CM manager
+        //   1. check if it is virtual
+        //      if not => goto 1.
+        //      if yes:
+        //      2. check if it links to the destination to be deleted
+        //         if yes => carryOn = EFalse, ERROR
+        //         if not:
+        //         3. check if it links to any of the CMs in this destination
+        //            if not => goto 1.
+        //            if yes:
+        //            4. check if it is also in this destination
+        //               if not => carryOn = EFalse, ERROR
+        //               if yes => goto 1.
+        // As we need different notes in different cases:
+        TUint32 noteresId = R_CMWIZARD_CANNOT_PERFORM_FOR_PROTECTED;
+        CommsDat::CMDBRecordSet<CommsDat::CCDIAPRecord>* iaps = 
+                                                    iCmManagerImpl->AllIapsL();
+        
+        CleanupStack::PushL( iaps );
+        
+        // for each IAP in CM manager
+        for ( TInt i = 0; carryOn && i < iaps->iRecords.Count(); ++i )
+            {
+            CommsDat::CCDIAPRecord* rec = (*iaps)[i];
+            TUint32 bearerType = 0;
+            
+            TRAP_IGNORE( bearerType = 
+                             iCmManagerImpl->BearerTypeFromIapRecordL( rec ) );
+            if ( !bearerType )
+                {
+                continue;
+                }
+                
+            // check if it is virtual
+            if ( iCmManagerImpl->GetBearerInfoBoolL( bearerType, ECmVirtual ) )
+                {
+                // check if it links to the destination to be deleted
+                CCmPluginBase* plugin = NULL;            
+                TRAP_IGNORE( plugin = iCmManagerImpl->GetConnectionMethodL( 
+                                                           rec->RecordId() ) );
+
+                if ( !plugin )
+                    {
+                    continue;
+                    }
+                
+                CleanupStack::PushL( plugin );
+
+                if ( plugin->IsLinkedToSnap( dest->Id() ) )
+                    {
+                    // the CM links to this destination, deletion not allowed
+                    carryOn = EFalse;
+                    noteresId = R_CMWIZARD_CANNOT_PERFORM_FOR_PROTECTED;
+                    }
+                else
+                    {
+                    
+                    // check if the CM links to any of the CMs in this destination
+                    for ( TInt j = 0; j < dest->ConnectionMethodCount(); ++j )
+                        {
+                        CCmPluginBase* destPlugin = NULL;
+                        
+                        TRAP_IGNORE( destPlugin = dest->GetConnectionMethodL( j ) );
+                        if ( !destPlugin )
+                            {
+                            continue;
+                            }
+                        
+                        if ( destPlugin->GetIntAttributeL( ECmId ) == 
+                                                               rec->RecordId() )
+                            {
+                            // the CM shouldn't be compared to itself
+                            continue;
+                            }
+                            
+                        if ( plugin->IsLinkedToIap( 
+                                    destPlugin->GetIntAttributeL( ECmId ) ) )
+                            {
+                            // the CM links to at least one CM in this destination
+                            carryOn = EFalse; 
+                            noteresId = R_QTN_NETW_CONSET_INFO_CANNOT_DELETE_VIRTUAL_REF;
+                            break;
+                            }
+                        }
+
+                    }
+
+                CleanupStack::PopAndDestroy( plugin );                    
+                }
+                
+                    
+            }
+            
+        CleanupStack::PopAndDestroy( iaps );
+
+        if ( !carryOn )
+            {
+            TCmCommonUi::ShowNoteL(
+                       noteresId,
+                       TCmCommonUi::ECmErrorNote );
+            }
+        }
+    
+        
+    // check if it has protected method
+    if( carryOn )
+        {
+        if( IsThereProtectedMethodL( dest ) )
+            {
+            TCmCommonUi::ShowNoteL( 
+                       R_QTN_NETW_CONSET_INFO_CANNOT_DELETE_DEST_PROT_CM,
+                       TCmCommonUi::ECmErrorNote );
+            carryOn = EFalse;
+            }
+        }
+        
+    if( carryOn )
+        {
+        HBufC* destName = dest->NameLC(); // 2
+        if ( TCmCommonUi::ShowConfirmationQueryL(
+                              R_CMMANAGERUI_QUEST_DEST_DELETE, *destName ) )
+            {
+            CleanupStack::PopAndDestroy( destName );   
+            TRAPD( err, dest->DeleteLD() );
+            switch ( err )
+                {
+                case KErrInUse:
+                    {
+                    TCmCommonUi::ShowNoteL( 
+                               R_CMMANAGERUI_INFO_DEST_IN_USE_CANNOT_DELETE,
+                               TCmCommonUi::ECmErrorNote );
+                    }
+                    break;
+
+                case KErrLocked:
+                    {
+                    TCmCommonUi::ShowNoteL
+                        ( R_QTN_NETW_CONSET_INFO_CANNOT_DELETE_VIRTUAL_REF,
+                          TCmCommonUi::ECmErrorNote );
+                    }
+                    break;
+                    
+                case KErrNone:
+                    {
+                    if (iCmManagerImpl->IsDefConnSupported())
+                        {         
+                        ShowDefaultConnectionNoteL(oldConn);
+                        } 
+                    CleanupStack::Pop( dest ); 
+                    dest = NULL;  
+                    
+                    TInt selected = iListbox->CurrentItemIndex();
+
+                    HandleListboxDataChangeL();
+
+                    if ( iListbox->Model()->NumberOfItems() )
+                        {
+                        if( selected == iListbox->Model()->NumberOfItems() )
+                            {
+                            --selected;
+                            }
+
+                        //first item cannot be deleted
+                        iListbox->ScrollToMakeItemVisible( selected);
+                        iListbox->SetCurrentItemIndexAndDraw( selected );                            
+                        }
+                    }
+                    break;
+                    
+                default:
+                    {
+                    }
+                }                          
+            }
+        else
+            {
+            CleanupStack::PopAndDestroy( destName );   
+            }                          
+        }
+
+    if( dest )
+        {
+        CleanupStack::PopAndDestroy( dest );
+        }
+
+    }
+
+   
+// ----------------------------------------------------------------------------
+// CDestDlg::OnCommandDestinationRenameL
+// ----------------------------------------------------------------------------
+//
+void CDestDlg::OnCommandDestinationRenameL()
+    {
+    LOGGER_ENTERFN( "CDestDlg::OnCommandDestinationRenameL" );
+
+    // Check if this is UnCat
+    if ( iListbox->CurrentItemUid() == KDestItemUncategorized )
+        {
+        TCmCommonUi::ShowNoteL( R_CMWIZARD_CANNOT_PERFORM_FOR_PROTECTED,
+                                TCmCommonUi::ECmErrorNote );
+        return;
+        }
+    
+    // Get currently selected destination.
+    CCmDestinationImpl* dest =
+          iCmManagerImpl->DestinationL( iListbox->CurrentItemUid() );
+    CleanupStack::PushL( dest );
+
+    // Show an error message to the user
+    if ( dest->ProtectionLevel() )
+        {
+        TCmCommonUi::ShowNoteL( R_CMWIZARD_CANNOT_PERFORM_FOR_PROTECTED,
+                                TCmCommonUi::ECmErrorNote );
+
+        CleanupStack::PopAndDestroy( dest );
+        return;
+        }
+
+    // Allocate max length for the buffer, since we don't know how long
+    // the new name will be. Copy the actual name of the destination
+    // into the buffer.
+    TBuf< KDestinationNameMaxLength > destName;
+    destName.Copy( *( dest->NameLC() ) );
+    
+    TBool okToRename = EFalse;
+    TBool nameAccepted = ETrue;
+    do 
+        {
+        okToRename = TCmCommonUi::ShowConfirmationQueryWithInputL(
+                                           R_CMMANAGERUI_PRMPT_DESTINATION_NAME,
+                                           destName );
+        if ( okToRename )
+            {
+            TRAPD(err, dest->SetNameL( destName ));
+            if ( err == KErrAlreadyExists )
+                {
+                nameAccepted = EFalse;
+                TCmCommonUi::ShowNoteL( R_CMMANAGERUI_INFO_DEST_ALREADY_IN_USE,
+                                        destName,
+                                        TCmCommonUi::ECmErrorNote );                        
+                }
+             else if ( err == KErrNone )
+                {
+                nameAccepted = ETrue;
+                dest->UpdateL();
+                HandleListboxDataChangeL();
+                }
+            }
+        } while ( !nameAccepted && okToRename );
+
+    // dest->NameLC()
+    CleanupStack::PopAndDestroy( );
+    CleanupStack::PopAndDestroy( dest );
+    }
+
+// ----------------------------------------------------------------------------
+// CDestDlg::IsThereProtectedMethodL
+// ----------------------------------------------------------------------------
+//
+TBool CDestDlg::IsThereProtectedMethodL( CCmDestinationImpl* aDest )
+    {
+    LOGGER_ENTERFN( "CDestDlg::IsThereProtectedMethodL" );
+
+    TInt count( aDest->ConnectionMethodCount() );
+
+    for( TInt i = 0; i < count; ++i )
+        {
+        CCmPluginBase* cm = aDest->GetConnectionMethodL( i );
+        
+        if( cm->GetBoolAttributeL( ECmProtected ) )
+            {
+            return ETrue;
+            }
+        }
+        
+    return EFalse;
+    }
+
+
+// ----------------------------------------------------------------------------
+// CDestDlg::SetMskL
+// ----------------------------------------------------------------------------
+//
+void CDestDlg::SetMskL( TInt aResourceId )
+    {
+    HBufC* text = StringLoader::LoadLC( aResourceId );
+    ButtonGroupContainer().SetCommandL( EAknSoftkeySelect, *text );
+    ButtonGroupContainer().DrawDeferred();
+    CleanupStack::PopAndDestroy( text );
+                
+    }
+
+// --------------------------------------------------------------------------
+// CDestDlg::GetHelpContext
+// --------------------------------------------------------------------------
+//
+void CDestDlg::GetHelpContext( TCoeHelpContext& aContext ) const
+    {
+    aContext.iMajor = KHelpUidPlugin;
+    aContext.iContext = KSET_HLP_CONN_DEST_VIEW;
+    }
+
+// --------------------------------------------------------------------------
+// CDestDlg::Execute
+// --------------------------------------------------------------------------
+//
+void CDestDlg::Execute()
+    {
+    LOGGER_ENTERFN( "CDestDlg::Execute" );
+    iProcessing = ETrue;
+    
+    TRAPD( err, ProcessCommandL(ECmManagerUiCmdDestEdit) );
+    if ( err )
+        {
+        HandleLeaveError( err );
+        }
+
+    iProcessing = EFalse;
+    }
+
+// --------------------------------------------------------------------------
+// CDestDlg::HandleResourceChange
+// --------------------------------------------------------------------------
+//
+
+void CDestDlg::HandleResourceChange( TInt aType )
+    {
+    CCoeControl::HandleResourceChange( aType ); 
+
+    if( aType == KEikDynamicLayoutVariantSwitch )
+        {
+        DrawNow(); 
+        }
+        
+    CAknDialog::HandleResourceChange(aType);        
+    }
+
+// --------------------------------------------------------------------------
+// CDestDlg::HandleLeaveError
+// --------------------------------------------------------------------------
+//
+void CDestDlg::HandleLeaveError( TInt aError )
+    {
+    LOGGER_ENTERFN( "CDestDlg::HandleLeaveError" );
+
+    switch( aError )
+        {
+            case KLeaveWithoutAlert:
+            case KErrNoMemory:
+                EnforcedResetCDestDlg();
+                break;
+            default:
+                // More leave errors may be handled if necessary
+                // Now other leave errors are ignored here
+                break;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CDestDlg::EnforcedResetCDestDlg
+// --------------------------------------------------------------------------
+//
+void CDestDlg::EnforcedResetCDestDlg()
+    {
+    LOGGER_ENTERFN( "CDestDlg::EnforcedResetCDestDlg" );
+
+    if( iCmWizard != NULL )
+        {
+        delete iCmWizard;
+        iCmWizard = NULL;
+        }
+
+    if( iProcessing )
+        {
+        iProcessing = EFalse;
+        }
+}
+
+// --------------------------------------------------------------------------
+// CDestDlg::ShowDefaultConnectionNoteL
+// --------------------------------------------------------------------------
+//
+void CDestDlg::ShowDefaultConnectionNoteL(TCmDefConnValue aOldDefConn)
+    {
+    LOGGER_ENTERFN( "CDestDlg::ShowDefaultConnectionNoteL" );
+    TCmDefConnValue newConn;
+        
+    iCmManagerImpl->ReadDefConnL( newConn );
+
+    if ( newConn != aOldDefConn )
+        {
+        ShowDefaultSetNoteL( newConn );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CDestDlg::CommsDatChanges
+// --------------------------------------------------------------------------
+//
+void CDestDlg::CommsDatChangesL()
+    {
+    // Update list box
+    HandleListboxDataChangeL();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Src/destlistbox.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,150 @@
+/*
+* 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 CDestListbox
+*
+*/
+
+#include <eikclbd.h>
+#include <avkon.mbg>
+#include <aknkeys.h>
+#include <data_caging_path_literals.hrh>
+#include <cmmanager.mbg> 
+
+#include "destlistbox.h"
+#include "destlistboxmodel.h"
+#include "destlistitem.h"
+
+// ---------------------------------------------------------------------------
+// CDestListbox::NewL
+// ---------------------------------------------------------------------------
+//
+CDestListbox* CDestListbox::NewL( const CCoeControl* aParent )
+    {
+    CDestListbox* listbox = new ( ELeave ) CDestListbox();
+    CleanupStack::PushL( listbox );
+    listbox->ConstructL( aParent, EAknListBoxSelectionList );
+    CleanupStack::Pop( listbox );
+    return listbox;
+    }
+
+// ---------------------------------------------------------------------------
+// CDestListbox::CDestListbox
+// ---------------------------------------------------------------------------
+//
+CDestListbox::CDestListbox()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CDestListbox::~CDestListbox
+// ---------------------------------------------------------------------------
+//
+CDestListbox::~CDestListbox()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CDestListbox::OfferKeyEventL
+// ---------------------------------------------------------------------------
+//
+TKeyResponse CDestListbox::OfferKeyEventL
+( const TKeyEvent& aKeyEvent, TEventCode aType )
+    {
+    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!
+        return EKeyWasConsumed;
+        }
+    else
+        {
+        return CAknDoubleLargeStyleListBox::OfferKeyEventL( aKeyEvent, aType );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CDestListbox::FocusChanged
+// ---------------------------------------------------------------------------
+//
+void CDestListbox::FocusChanged( TDrawNow aDrawNow )
+    {
+    // Do nothing until the listbox is fully constructed
+    // The dialogpage sets the focus before calling ConstructL
+    if ( iView )
+        {
+        CAknDoubleLargeStyleListBox::FocusChanged( aDrawNow );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CDestListbox::Uid4Item
+// ---------------------------------------------------------------------------
+//
+TUint32 CDestListbox::Uid4Item( TInt aItem ) const
+    {
+    CDestListboxModel* lbmodel =
+        STATIC_CAST( CDestListboxModel*, Model()->ItemTextArray() );
+    return lbmodel->At( aItem )->Uid();
+    }
+
+// ---------------------------------------------------------------------------
+// CDestListbox::CurrentItemUid
+// ---------------------------------------------------------------------------
+//
+TUint32 CDestListbox::CurrentItemUid() const
+    {
+    CDestListboxModel* lbmodel =
+        STATIC_CAST( CDestListboxModel*, Model()->ItemTextArray() );
+    TInt idx = CurrentItemIndex();
+    TUint32 retval( 0 );
+    if ( idx >= 0 )
+        {
+        retval = lbmodel->At( idx )->Uid();
+        }
+    return retval;
+    }
+
+// ---------------------------------------------------------------------------
+// CDestListbox::CurrentItemNameL
+// ---------------------------------------------------------------------------
+//
+const TDesC& CDestListbox::CurrentItemNameL()
+    {
+    CDestListboxModel* lbmodel = new( ELeave )CDestListboxModel;
+    lbmodel = STATIC_CAST( CDestListboxModel*, Model()->ItemTextArray() );
+    return lbmodel->At( CurrentItemIndex() )->Name();
+    }
+
+// ---------------------------------------------------------------------------
+// CDestListbox::HandleResourceChange
+// ---------------------------------------------------------------------------
+//
+void CDestListbox::HandleResourceChange(TInt aType)
+    {
+    if ( aType == KAknsMessageSkinChange )
+        {
+        SizeChanged();
+        }
+        
+    CAknDoubleLargeStyleListBox::HandleResourceChange( aType );     
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Src/destlistboxmodel.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,157 @@
+/*
+* 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 CDestListboxModel
+*
+*/
+
+#include <AknIconArray.h>
+#include <aknlists.h>
+#include <StringLoader.h>
+#include <cmmanager.rsg>
+
+#include "destlistboxmodel.h"
+#include "destlistitem.h"
+#include "destlistitemlist.h"
+#include <cmcommonconstants.h>
+
+using namespace CMManager;
+
+// ---------------------------------------------------------------------------
+// CDestListboxModel::CDestListboxModel
+// ---------------------------------------------------------------------------
+//
+CDestListboxModel::CDestListboxModel()
+    : iOffset( 0 )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CDestListboxModel::~CDestListboxModel
+// ---------------------------------------------------------------------------
+//
+CDestListboxModel::~CDestListboxModel()
+    {
+    ResetAndDestroy(); // deletes all elements...
+    }
+
+// ---------------------------------------------------------------------------
+// CDestListboxModel::MdcaCount
+// ---------------------------------------------------------------------------
+//
+TInt CDestListboxModel::MdcaCount() const
+    {
+    return Count();
+    }
+
+// ---------------------------------------------------------------------------
+// CDestListboxModel::SetOwnIconOffset
+// ---------------------------------------------------------------------------
+//
+void CDestListboxModel::SetOwnIconOffset( TInt aOffset )
+    {
+    iOffset = aOffset;
+    }
+
+// ---------------------------------------------------------------------------
+// CDestListboxModel::MdcaPoint
+// ---------------------------------------------------------------------------
+//
+TPtrC CDestListboxModel::MdcaPoint( TInt aIndex ) const
+    {
+    // We need to cast away the const-ness from the buffer.
+    // It was definitely made for formatting!
+    FormatListboxText( aIndex,
+        ( MUTABLE_CAST(  TBuf<KMaxDestListboxName>&, iBuf ) ) );
+
+    return iBuf;
+    }
+
+// ---------------------------------------------------------------------------
+// CDestListboxModel::FormatListboxTextL
+// ---------------------------------------------------------------------------
+//
+void CDestListboxModel::FormatListboxTextL( TInt aIndex,
+                                                TDes& aBuf ) const
+    {
+    aBuf.Zero();
+    HBufC* secondLine;
+    if ( At(aIndex)->NumOfCMs()  )
+        {
+        if ( At(aIndex)->NumOfCMs()  == 1 )
+            {
+            secondLine = 
+                  StringLoader::LoadLC( R_CMMANAGERUI_CONN_METHODS_AMOUNT_ONE );
+            }
+         else
+            {
+            secondLine = 
+                   StringLoader::LoadLC( R_CMMANAGERUI_CONN_METHODS_AMOUNT_MANY, 
+                                         At( aIndex )->NumOfCMs() );
+            }
+        }
+     else
+        {
+        if ( At( aIndex )->Uid() == KDestItemNewConnection )
+            {
+            //add cm if list is empty
+            secondLine = 
+                    StringLoader::LoadLC( R_CMMANAGERUI_ADD_CONNECTION_METHOD );
+            }
+         else
+            {
+            secondLine = 
+                 StringLoader::LoadLC( R_CMMANAGERUI_CONN_METHODS_AMOUNT_NONE );
+            }
+        }
+        
+    if ( At( aIndex )->IsDefault() )
+        {
+            aBuf.Format( KListItemFormatDestProt,
+                         At(aIndex)->IconIndex(), 
+                         &At(aIndex)->Name(), 
+                         secondLine, 
+                         KDestReservedIconIndexDefaultConn );
+        }
+    else
+        {
+        // Protected icon must be put only if the protection level is 1
+        if ( At( aIndex )->GetProtectionLevel() == EProtLevel1 )
+            {
+            aBuf.Format( KListItemFormatDestProt,
+                         At(aIndex)->IconIndex(), 
+                         &At(aIndex)->Name(), 
+                         secondLine, 
+                         KDestReservedIconIndexProtected );
+            }
+         else
+            {
+            aBuf.Format( KListItemFormatDest,
+                         At(aIndex)->IconIndex(), 
+                         &At(aIndex)->Name(), 
+                         secondLine );
+            }
+        }
+    CleanupStack::PopAndDestroy( secondLine );
+    }
+    
+// ---------------------------------------------------------------------------
+// CDestListboxModel::FormatListboxText
+// ---------------------------------------------------------------------------
+//
+
+void CDestListboxModel::FormatListboxText( TInt aIndex,
+                                           TDes& aBuf ) const
+    {
+    TRAP_IGNORE( FormatListboxTextL( aIndex, aBuf ) );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Src/destlistitem.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,146 @@
+/*
+* 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 CDestListItem.
+*
+*/
+
+#include <eikdef.h>
+#include "destlistitem.h"
+#include <cmmanagerdef.h>
+
+using namespace CMManager;
+
+// ---------------------------------------------------------------------------
+// CDestListItem::NewLC
+// ---------------------------------------------------------------------------
+//
+CDestListItem* CDestListItem::NewLC( TUint32 aUid,
+                                     HBufC* aName,
+                                     TInt aNumOfCMs, 
+                                     TUint aIconIndex, 
+                                     TProtectionLevel aProtectionLevel,
+                                     TBool aIsDefault )
+    {
+    CDestListItem* db = new( ELeave ) CDestListItem( aName );
+    CleanupStack::PushL( db );
+    db->ConstructL( aUid, aNumOfCMs, aIconIndex , 
+                    aProtectionLevel, aIsDefault );
+    return db;
+    }
+    
+// ---------------------------------------------------------------------------
+// CDestListItem::~CDestListItem
+// ---------------------------------------------------------------------------
+//
+CDestListItem::~CDestListItem()
+    {
+    delete iName;
+    }
+
+// ---------------------------------------------------------------------------
+// CDestListItem::CDestListItem
+// ---------------------------------------------------------------------------
+//
+CDestListItem::CDestListItem( HBufC* aName )
+    : iName( aName )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CDestListItem::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CDestListItem::ConstructL( TUint32 aUid,
+                                TInt aNumOfCMs, 
+                                TUint aIconIndex, 
+                                TProtectionLevel aProtectionLevel,
+                                TBool aIsDefault )
+    {
+    iProtectionLevel = aProtectionLevel;
+    if (aProtectionLevel == EProtLevel0)
+        {
+        iIsProtected = EFalse;        
+        }
+    else
+        {
+        iIsProtected = ETrue;        
+        }
+    iIconIndex = aIconIndex;
+    iNumOfCMs = aNumOfCMs;
+    iIsDefault = aIsDefault;
+    iUid = aUid;
+    }
+// ---------------------------------------------------------------------------
+// CDestListItem::Name
+// ---------------------------------------------------------------------------
+//
+const TDesC& CDestListItem::Name()
+    {
+    return *iName;
+    }
+
+// ---------------------------------------------------------------------------
+// CDestListItem::Uid
+// ---------------------------------------------------------------------------
+//
+TUint32 CDestListItem::Uid()
+    {
+    return iUid;
+    }
+
+// ---------------------------------------------------------------------------
+// CDestListItem::NumOfCMs
+// ---------------------------------------------------------------------------
+//
+TInt CDestListItem::NumOfCMs()
+    {
+    return iNumOfCMs;
+    }
+
+// ---------------------------------------------------------------------------
+// CDestListItem::IconIndex
+// ---------------------------------------------------------------------------
+//
+TUint CDestListItem::IconIndex()
+    {
+    return iIconIndex;
+    }
+
+// ---------------------------------------------------------------------------
+// CDestListItem::IsProtected
+// ---------------------------------------------------------------------------
+//
+TUint CDestListItem::IsProtected()
+    {
+    return iIsProtected;
+    }
+    
+// ---------------------------------------------------------------------------
+// CDestListItem::IsProtected
+// ---------------------------------------------------------------------------
+//
+TProtectionLevel CDestListItem::GetProtectionLevel()
+    {
+    return iProtectionLevel;
+    }
+    
+// ---------------------------------------------------------------------------
+// CDestListItem::IsDefault
+// ---------------------------------------------------------------------------
+//
+TUint CDestListItem::IsDefault()
+    {
+    return iIsDefault;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Src/destlistitemlist.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,61 @@
+/*
+* 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 CDestListItemList
+*
+*/
+
+#include "destlistitemlist.h"
+#include "destlistitem.h"
+
+LOCAL_D const TInt KGranularity = 4;    ///< Granularity of the list.
+
+// ---------------------------------------------------------
+// CDestListItemList::CDestListItemList
+// ---------------------------------------------------------
+//
+CDestListItemList::CDestListItemList()
+    : CArrayPtrFlat<CDestListItem>( KGranularity )
+    {
+    }
+
+// ---------------------------------------------------------
+// CDestListItemList::~CDestListItemList
+// ---------------------------------------------------------
+//
+CDestListItemList::~CDestListItemList()
+    {
+    ResetAndDestroy();
+    }
+
+// ---------------------------------------------------------
+// CDestListItemList::ItemByUid
+// ---------------------------------------------------------
+//
+CDestListItem* CDestListItemList::ItemForUid( TUint32 aUid ) const
+    {
+    // This method cannot return "const CDestListItem*", because all methods
+    // of CDestListItem are non-const -> if the returned item was const, it
+    // would be unusable.
+    TInt i;
+    TInt count = Count();
+    for ( i = 0; i < count; i++ )
+        {
+        if ( At( i )->Uid() == aUid )
+            {
+            return At( i );
+            }
+        }
+
+    return NULL;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Src/selectdestination.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,285 @@
+/*
+* 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:  Shows the "Select destination:" dialog, where the user can 
+*                select one of the available destinations.
+*
+*/
+
+#include <AknUtils.h>
+#include <badesca.h>
+#include <StringLoader.h>
+#include <cmmanager.rsg>
+#include "selectdestinationdlg.h"
+#include <cmcommonconstants.h>
+#include <cmcommonui.h>
+#include "cmdestinationimpl.h"
+#include "cmlogger.h"
+#include "cmmanagerimpl.h"
+
+#include <cmmanagerdef.h>
+
+// ----------------------------------------------------------------------------
+// CSelectDestinationDlg::CSelectDestinationDlg
+// ----------------------------------------------------------------------------
+//
+CSelectDestinationDlg::CSelectDestinationDlg( TInt aDummyIndex,
+                                              TUint32& aDestinationId )
+    : CAknListQueryDialog( &aDummyIndex )
+    , iDestinationId( aDestinationId )
+    , iDestinations( KCmArrayMediumGranularity )
+    {
+    CLOG_CREATE;
+    }
+
+// ----------------------------------------------------------------------------
+// CSelectDestinationDlg::ConstructL
+// ----------------------------------------------------------------------------
+//
+void CSelectDestinationDlg::ConstructL( CCmManagerImpl& aCmManager,
+                                        RArray<TUint32>* aDestArray )
+    {
+    LOGGER_ENTERFN( "CSelectDestinationDlg::ConstructL" );
+    RArray<TUint32> destinations( KCmArrayMediumGranularity );
+    CleanupClosePushL( destinations );
+
+    aCmManager.AllDestinationsL( destinations );
+
+    TBool mmsFound = EFalse;
+    for ( TInt i = 0; i < destinations.Count(); i++ )
+        {
+        CCmDestinationImpl* dest = aCmManager.DestinationL( destinations[i] );
+        CleanupStack::PushL( dest );   
+             
+        // Don't count the current destination
+        if ( dest->Id() == iDestinationId )
+            {
+            CleanupStack::PopAndDestroy( dest );
+            continue;
+            }
+               
+        // Do not give the option to copy into a Level 1 Protected Destination
+        if ( dest->ProtectionLevel() == CMManager::EProtLevel1 )
+            {
+            CleanupStack::PopAndDestroy( dest );
+            continue;
+            }
+
+        // check if the destination is valid as parent (e.g. for VPN)
+        if ( aDestArray && aDestArray->Find( dest->Id() ) == KErrNotFound )
+            {
+            CleanupStack::PopAndDestroy( dest );
+            continue;
+            }
+        
+        // Skip the MMS Snap, it it not shown in the list
+        if ( !mmsFound )
+            {
+            TInt snapMetadata = 0;
+            TRAPD(metaErr, snapMetadata = dest->MetadataL( CMManager::ESnapMetadataPurpose ));
+            if ( metaErr == KErrNone && snapMetadata == CMManager::ESnapPurposeMMS )
+                {
+                CleanupStack::PopAndDestroy( dest );
+                mmsFound = ETrue;
+                continue;
+                }
+            }
+        
+        iDestinations.AppendL( dest );
+        CleanupStack::Pop( dest );
+        }
+    CleanupStack::PopAndDestroy( &destinations );
+    }
+    
+// ----------------------------------------------------------------------------
+// CSelectDestinationDlg::~CSelectDestinationDlg
+// ----------------------------------------------------------------------------
+//
+CSelectDestinationDlg::~CSelectDestinationDlg()
+    {
+    for ( TInt i = 0; i < iDestinations.Count(); i++ )
+        {
+        delete iDestinations[i];
+        }
+    iDestinations.Close();
+    CLOG_CLOSE;
+    }
+
+// ----------------------------------------------------------------------------
+// CSelectDestinationDlg::NewL
+// ----------------------------------------------------------------------------
+//
+CSelectDestinationDlg* CSelectDestinationDlg::NewL( TUint32& aDestinationId,
+                                                    CCmManagerImpl& aCmManager,
+                                                    RArray<TUint32>* aDestArray )
+    {
+    CSelectDestinationDlg* self = NewLC( aDestinationId, aCmManager, aDestArray );
+
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+
+// ----------------------------------------------------------------------------
+// CSelectDestinationDlg::NewLC
+// ----------------------------------------------------------------------------
+//
+CSelectDestinationDlg* CSelectDestinationDlg::NewLC( TUint32& aDestinationId,
+                                                     CCmManagerImpl& aCmManager,
+                                                     RArray<TUint32>* aDestArray )
+    {
+    CSelectDestinationDlg* self =
+                    new (ELeave) CSelectDestinationDlg( 0, aDestinationId );
+
+    CleanupStack::PushL( self );
+
+    self->ConstructL( aCmManager, aDestArray );
+
+    return self;
+    }
+
+
+// ----------------------------------------------------------------------------
+// CSelectDestinationDlg::OkToExitL
+// ----------------------------------------------------------------------------
+//
+TBool CSelectDestinationDlg::OkToExitL( TInt aButtonId )
+    {
+    TBool result = EFalse;
+    
+    if ( aButtonId == EAknSoftkeySelect || aButtonId == EAknSoftkeyOk )
+        {
+        iDestinationId = iDestinations[ ListBox()->CurrentItemIndex() ]->Id();
+
+        result = ETrue;
+        }
+    else if ( aButtonId == EAknSoftkeyCancel )
+        {
+        iDestinationId = 0;
+
+        result = ETrue;
+        }
+
+    CLOG_WRITE_2( "CSelectDestinationDlg::OkToExitL dest ID: [%d], result: [%d]",
+                   iDestinationId, result );
+
+    return result;
+    }
+
+
+// ----------------------------------------------------------------------------
+// CSelectDestinationDlg::PreLayoutDynInitL
+// ----------------------------------------------------------------------------
+//
+void CSelectDestinationDlg::PreLayoutDynInitL()
+    {
+    LOGGER_ENTERFN( "CSelectDestinationDlg::PreLayoutDynInitL" );
+    // Let the base class do its job first
+    CAknListQueryDialog::PreLayoutDynInitL();
+
+    // Set the description field on the query
+    HBufC* desc =
+              StringLoader::LoadLC( R_CMWIZARD_SELECT_DESTINATION_DESCRIPTION );
+
+    MessageBox()->SetMessageTextL( desc );
+    CleanupStack::PopAndDestroy( desc );
+
+    // Specify the item text array
+    CDesCArrayFlat* itemArray =
+                      new (ELeave) CDesCArrayFlat( KCmArrayMediumGranularity );
+    SetItemTextArray( itemArray );
+    SetOwnershipType( ELbmOwnsItemArray );
+
+    // Note: we don't have to put 'itemArray' on to the cleanup stack, as the
+    // model has already taken this object over.
+    
+    for ( TInt i = 0; i < iDestinations.Count(); i++ )
+        {       
+        // Here we take advantage of the fact that our icon array is ordered.
+        // That is, the indices of the icons in the array will always be
+        // in sync with those in the item text array (i.e. each bearer will
+        // have the right icon associated with it).
+        HBufC* destName = iDestinations[i]->NameLC();
+        HBufC* lineText =
+            TCmCommonUi::FormattedTextForListBoxLC( i, *destName );
+
+        itemArray->AppendL( *lineText );
+        CleanupStack::PopAndDestroy( 2, destName ); // destName, lineText
+        }
+
+    // Icons ...
+    SetIconsL();
+    }
+
+
+// ----------------------------------------------------------------------------
+// CSelectDestinationDlg::SetIconsL()
+// ----------------------------------------------------------------------------
+//
+void CSelectDestinationDlg::SetIconsL()
+    {
+    CArrayPtr<CGulIcon>* icons =
+             new (ELeave) CArrayPtrFlat<CGulIcon>( KCmArrayMediumGranularity );
+    CleanupStack::PushL( icons );
+
+    for ( TInt i = 0; i < iDestinations.Count(); i++ )
+        {
+        CGulIcon* icon = iDestinations[i]->IconL();
+        CleanupStack::PushL( icon );
+
+        icons->AppendL( icon );
+
+        CleanupStack::Pop( icon );  // icon array took over ownership
+        }
+
+    SetIconArrayL( icons ); // ownership passed, too
+
+    CleanupStack::Pop( icons );
+    }
+
+
+// ----------------------------------------------------------------------------
+// void CSelectDestinationDlg::HandleResourceChange
+// ----------------------------------------------------------------------------
+//
+void CSelectDestinationDlg::HandleResourceChange( TInt aType )
+    {
+    if ( aType == KAknsMessageSkinChange )
+        {
+        CAknListQueryDialog::HandleResourceChange( aType );
+
+        TRAP_IGNORE( SetIconsL() );
+
+        SizeChanged();
+        }
+    else
+        {
+        if ( aType == KEikDynamicLayoutVariantSwitch )
+            {
+            TRect mainPaneRect;
+            AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane,
+                                               mainPaneRect );
+
+            TAknLayoutRect layoutRect;
+            layoutRect.LayoutRect( TRect( TPoint( 0, 0 ), 
+                                   mainPaneRect.Size() ),
+                                   AKN_LAYOUT_WINDOW_list_gen_pane( 0 ) );
+
+            ListBox()->SetRect( layoutRect.Rect() );
+            }
+
+        // Base call
+        CAknListQueryDialog::HandleResourceChange( aType );
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/Src/uncatdlg.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,418 @@
+/*
+* 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 CUncatDlg.
+*
+*/
+
+#include <avkon.hrh>
+#include <eikdef.h>
+#include <eikenv.h>
+#include <eikedwin.h>
+#include <cmmanager.rsg>
+#include <aknnavide.h>
+#include <akntitle.h>
+#include <eikmenup.h>
+#include <data_caging_path_literals.hrh>
+#include <StringLoader.h>
+#include <AknIconArray.h>
+
+#include "cmmanager.hrh"
+#include "uncatdlg.h"
+#include "cmlistitem.h"
+#include "cmlistitemlist.h"
+#include <cmpluginbaseeng.h>
+#include <cmpluginbase.h>
+#include "cmdestinationimpl.h"
+#include <cmcommonui.h>
+#include <cmcommonconstants.h>    
+#include <cmpbasesettingsdlg.h>
+#include "cmlistboxmodel.h"
+#include "selectdestinationdlg.h"
+#include "cmlogger.h"
+
+using namespace CMManager;
+
+// ---------------------------------------------------------------------------
+// CUncatDlg::ConstructAndRunLD
+// Constructs the dialog and runs it.
+// ---------------------------------------------------------------------------
+//
+TInt CUncatDlg::ConstructAndRunLD( TUint32 aHighlight,
+                                   TUint32& aSelected )
+    {
+    CleanupStack::PushL( this );
+    iHighlight = aHighlight;
+    iSelected = &aSelected;
+    ConstructL( R_CM_MENUBAR );
+    PrepareLC(R_CM_DIALOG);
+    CleanupStack::Pop( this );  // it will be PushL-d by ExecuteLD...
+    iModel = new( ELeave ) CCmListboxModel();
+    //destructed in base class destructor
+    iInfoPopupNoteController = CAknInfoPopupNoteController::NewL();
+
+    // Trace changes in CommsDat
+    iCmManager->WatcherRegisterL( this );
+    
+    return RunLD();
+    }
+    
+// ---------------------------------------------------------------------------
+// CUncatDlg::NewL()
+// Two-phase dconstructor, second phase is ConstructAndRunLD
+// ---------------------------------------------------------------------------
+//
+CUncatDlg* CUncatDlg::NewL(CCmManagerImpl* aCmManager )
+    {
+    CUncatDlg* self = new (ELeave) CUncatDlg( aCmManager );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CUncatDlg::CUncatDlg()
+// ---------------------------------------------------------------------------
+//
+CUncatDlg::CUncatDlg( CCmManagerImpl* aCmManager )
+    : CCmDlg( aCmManager, NULL, NULL )
+    , iCmUncatItems(KCmArraySmallGranularity)
+    {
+    CLOG_CREATE;
+    CLOG_ATTACH( this, iCmManager );
+    }
+    
+// ---------------------------------------------------------------------------
+// CUncatDlg::~CUncatDlg
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CUncatDlg::~CUncatDlg()
+    {
+    CLOG_WRITE( "CUncatDlg::~CUncatDlg" );
+    CleanupUncatArray();   
+    CLOG_CLOSE;
+    }
+
+// ---------------------------------------------------------------------------
+// CUncatDlg::DynInitMenuPaneL
+// ---------------------------------------------------------------------------
+//
+void CUncatDlg::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
+    {
+    TBool hideAdd ( EFalse );
+    TBool hideMove ( EFalse );
+    TBool hideCopy( EFalse );
+    TBool hidePrioritise( EFalse );
+    
+    CCmDlg::DynInitMenuPaneL( aResourceId, aMenuPane );
+    if ( aResourceId == R_CM_MENU )
+        {
+        // There are no destinatons to move to OR
+        // the highlighted connection method is in use
+        if ( !iCmManager->DestinationCountL() )
+            {
+            hideMove = ETrue;
+            }               
+        aMenuPane->SetItemDimmed( ECmManagerUiCmdCmAdd, hideAdd );
+        aMenuPane->SetItemDimmed( ECmManagerUiCmdCmPrioritise, hidePrioritise  );
+        aMenuPane->SetItemDimmed( ECmManagerUiCmdCmCopyToOtherDestination, hideCopy );
+        aMenuPane->SetItemDimmed( ECmManagerUiCmdCmCopyToOtherDestination, hideMove );
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// CUncatDlg::InitTextsL
+// called before the dialog is shown
+// to initialize localized textual data
+// ---------------------------------------------------------------------------
+//
+void CUncatDlg::InitTextsL()
+    {
+    // set pane text if neccessary...
+    // pane text needed if not pop-up...
+    HBufC* primary = 
+              iEikonEnv->AllocReadResourceLC( R_CMMANAGERUI_EMPTY_METHOD_VIEW_PRIMARY );
+    HBufC* secondary = 
+              iEikonEnv->AllocReadResourceLC( R_CMMANAGERUI_EMPTY_METHOD_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);              
+    iListbox->View()->SetListEmptyTextL( *emptyText );    
+    CleanupStack::PopAndDestroy( emptyText );
+    CleanupStack::PopAndDestroy( items );
+    CleanupStack::PopAndDestroy( secondary );
+    CleanupStack::PopAndDestroy( primary );
+
+    iStatusPane = iEikonEnv->AppUiFactory()->StatusPane();
+    iTitlePane =
+        ( CAknTitlePane* )iStatusPane->ControlL(
+                            TUid::Uid( EEikStatusPaneUidTitle ) );
+
+    iOldTitleText = iTitlePane->Text()->AllocL();
+    HBufC* name = StringLoader::LoadLC( R_CMMANAGERUI_DEST_UNCATEGORIZED );
+    iTitlePane->SetTextL( *name );
+    CleanupStack::PopAndDestroy( name );
+    iNaviPane = ( CAknNavigationControlContainer* ) 
+                    iStatusPane->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) );
+    iNaviDecorator = iNaviPane->CreateNavigationLabelL( KNullDesC );
+    iNaviPane->PushL( *iNaviDecorator );
+    }
+
+// ---------------------------------------------------------------------------
+// CUncatDlg::ProcessCommandL
+// ---------------------------------------------------------------------------
+//
+void CUncatDlg::ProcessCommandL( TInt aCommandId )
+    {
+    if ( MenuShowing() )
+        {
+        HideMenu();
+        }
+
+    switch ( aCommandId )
+        {
+        case ECmManagerUiCmdCmMoveToOtherDestination:
+            {
+            if ( CurrentCML()->GetBoolAttributeL( ECmConnected ) )
+                    {
+                TCmCommonUi::ShowNoteL( R_QTN_SET_NOTE_AP_IN_USE_EDIT,
+                                    TCmCommonUi::ECmErrorNote );
+                }
+            else
+                {
+                // The selected item will be at the same position
+                TInt selected = iListbox->CurrentItemIndex();
+                TInt noi = iListbox->Model()->NumberOfItems();
+                // If it is the last then the previous will be selected.
+                if( selected == noi-1 )
+                    {
+                    selected--;
+                    }
+                
+                TRAPD( err, CCmDlg::ProcessCommandL(
+                                ECmManagerUiCmdCmCopyToOtherDestination ) );
+                if ( err == KErrCancel )
+                    {
+                    break;
+                    }
+                else
+                    {
+                    User::LeaveIfError( err );
+                    }
+                    
+                if ( iListbox->Model()->NumberOfItems() )
+                    {
+                    //first item cannot be deleted
+                    iListbox->ScrollToMakeItemVisible( selected);
+                    iListbox->SetCurrentItemIndexAndDraw( selected );                            
+                    }
+                else
+                    {
+                    TCmCommonUi::ShowNoteL( R_QTN_NETW_CONSET_INFO_UNCAT_EMPTY,
+                                            TCmCommonUi::ECmInfoNote );
+                    TryExitL( KDialogUserBack );                                
+                    }
+                }
+            }
+            break;
+            
+        case EAknSoftkeyClear:
+        case ECmManagerUiCmdCmDelete:            
+            {
+            CCmPluginBase* cm = CurrentCML();
+            
+            if ( cm->GetBoolAttributeL( ECmProtected ) )
+                {
+                TCmCommonUi::ShowNoteL( R_CMWIZARD_CANNOT_PERFORM_FOR_PROTECTED,
+                                        TCmCommonUi::ECmErrorNote );
+                                        
+                break;
+                }
+           
+            if ( cm->GetBoolAttributeL( ECmIsLinked ) )//same check as KErrLocked below
+                {
+                TCmCommonUi::ShowNoteL( R_QTN_NETW_CONSET_INFO_CANNOT_DELETE_VIRTUAL_REF,
+                                        TCmCommonUi::ECmErrorNote );
+                
+                break;
+                }
+           
+            if ( cm->GetBoolAttributeL( ECmConnected ) )//same check as KErrInUse below
+                {
+                TCmCommonUi::ShowNoteL( R_CMMANAGERUI_INFO_CM_IN_USE_CANNOT_DELETE,
+                                        TCmCommonUi::ECmErrorNote );
+                
+                break;
+                }
+
+            HBufC* cmName = cm->GetStringAttributeL(ECmName);
+            CleanupStack::PushL(cmName);
+            
+            if ( TCmCommonUi::ShowConfirmationQueryL( 
+                                    R_CMMANAGERUI_QUEST_CM_DELETE, *cmName ) )
+                {
+                TRAPD( err, CurrentCML()->DeleteL( ETrue ) );
+
+                switch ( err )
+                    {
+                    case KErrInUse:
+                        {
+                        TCmCommonUi::ShowNoteL
+                            ( R_CMMANAGERUI_INFO_CM_IN_USE_CANNOT_DELETE,
+                              TCmCommonUi::ECmErrorNote );
+                        }
+                        break;
+                        
+                    case KErrLocked:
+                        {
+                        TCmCommonUi::ShowNoteL
+                            ( R_QTN_NETW_CONSET_INFO_CANNOT_DELETE_VIRTUAL_REF,
+                              TCmCommonUi::ECmErrorNote );
+                        }
+                        break;
+                        
+                    case KErrNone:
+                        {
+                        HandleListboxDataChangeL();
+
+                        if ( !iListbox->Model()->NumberOfItems() )
+                            {
+                            TCmCommonUi::ShowNoteL( R_QTN_NETW_CONSET_INFO_UNCAT_EMPTY,
+                                                    TCmCommonUi::ECmInfoNote );
+                            TryExitL( KDialogUserBack );                                
+                            }
+                        }
+                        break;
+
+                    default:
+                        {
+                        }
+                    }
+
+                }
+            CleanupStack::PopAndDestroy( cmName );         
+         
+            }
+            break;
+            
+        case ECmManagerUiCmdCmAdd:
+        case ECmManagerUiCmdCmCopyToOtherDestination:
+        case ECmManagerUiCmdCmPrioritise:
+            {
+            TCmCommonUi::ShowNoteL( R_CMWIZARD_CANNOT_PERFORM_FOR_PROTECTED,
+                                    TCmCommonUi::ECmErrorNote );
+            }
+            break;
+            
+        default:
+            {
+            CCmDlg::ProcessCommandL(aCommandId);
+            }        
+        }        
+    }
+    
+// ---------------------------------------------------------------------------
+// CUncatDlg::CurrentCML
+// called before the dialog is shown to initialize listbox data
+// ---------------------------------------------------------------------------
+//
+CCmPluginBase* CUncatDlg::CurrentCML()
+    {
+    return CMByIndexL( iListbox->CurrentItemIndex() );
+    }    
+    
+// ---------------------------------------------------------------------------
+// CUncatDlg::CMByIndexL
+// a connection method in the list
+// ---------------------------------------------------------------------------
+//
+CCmPluginBase* CUncatDlg::CMByIndexL( TInt aIndex )
+    {
+    TInt anIndex = iItemIndex[aIndex];    
+    if( !iCmUncatItems[anIndex].iPlugin )
+        {
+        iCmUncatItems[anIndex].iPlugin = 
+                                iCmManager->GetConnectionMethodL( 
+                                                iCmUncatItems[anIndex].iCmId );
+        }
+    return iCmUncatItems[anIndex].iPlugin;
+    }
+
+// ---------------------------------------------------------------------------
+// CUncatDlg::CMCount
+// number of cms in the list
+// ---------------------------------------------------------------------------
+//
+TInt CUncatDlg::CMCount()
+    {
+    return iCmUncatItems.Count();
+    }
+
+// --------------------------------------------------------------------------
+// CUncatDlg::ConstructCMArrayL
+// --------------------------------------------------------------------------
+//
+void CUncatDlg::ConstructCMArrayL( RArray<TUint32>& aCmIds )
+    {
+    // empty the array - reuse
+    CleanupUncatArray( ETrue );
+    iCmManager->ConnectionMethodL( aCmIds, EFalse );
+    CleanupClosePushL( aCmIds );
+    
+    for( TInt i = 0; i < aCmIds.Count(); ++i )
+        {
+        TUncatItem item;
+        
+        item.iPlugin = NULL;
+        item.iCmId = aCmIds[i];
+        
+        User::LeaveIfError( iCmUncatItems.Append( item ) );
+        }
+    
+    CleanupStack::Pop( &aCmIds );
+    }
+
+// --------------------------------------------------------------------------
+// CUncatDlg::CleanupUncatArray
+// --------------------------------------------------------------------------
+//
+void CUncatDlg::CleanupUncatArray( TBool aReuseArray )
+    {
+    CLOG_WRITE( "CUncatDlg::CleanupUncatArray" );
+    for ( TInt i = 0; i < iCmUncatItems.Count(); ++i )
+        {
+        CCmPluginBase* cm = iCmUncatItems[i].iPlugin;
+        delete cm;
+        }
+    
+    if ( aReuseArray )
+        {
+        iCmUncatItems.Reset();
+        }
+    else
+        {
+        iCmUncatItems.Close();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUncatDlg::CommsDatChangesL
+// --------------------------------------------------------------------------
+//
+void CUncatDlg::CommsDatChangesL()
+    {
+    // Update list box
+    HandleListboxDataChangeL();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/SrcData/cmmanager.rss	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,1419 @@
+/*
+* 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.
+*
+*/
+
+//  RESOURCE IDENTIFIER
+NAME    CMMG // 4 letter ID
+
+// INCLUDES
+
+// System
+#include <eikon.rh>
+#include <avkon.rsg>
+#include <avkon.rh>	
+#include <avkon.loc>
+#include <uikon.rh>
+#include <CommonDialogs.rh>
+#include <pathconfiguration.hrh>
+#include <data_caging_paths_strings.hrh>
+#include <cmmanager.mbg>
+
+// User
+#include <cmmanager.loc>
+#include <cmpsettingsconsts.h>
+#include "cmmanager.hrh"
+
+//For Ip address editor
+#define IPADDRESS_MIN_FIRST_FIELD_VALUE     0
+#define IPADDRESS_MIN_SECOND_FIELD_VALUE    0
+#define IPADDRESS_MIN_THIRD_FIELD_VALUE     0
+#define IPADDRESS_MIN_FOURTH_FIELD_VALUE    0
+#define IPADDRESS_MAX_FIRST_FIELD_VALUE     255
+#define IPADDRESS_MAX_SECOND_FIELD_VALUE    255
+#define IPADDRESS_MAX_THIRD_FIELD_VALUE     255
+#define IPADDRESS_MAX_FOURTH_FIELD_VALUE    255
+
+//  RESOURCE DEFINITIONS
+RESOURCE RSS_SIGNATURE {}
+
+RESOURCE TBUF R_CMMANAGER_CM_NAME_DEFAULT   
+        { buf = "Default Connection Method"; }
+
+// NON-LOCALIZED STRINGS
+RESOURCE TBUF r_start_page_def_value
+    { buf = "http://"; }
+
+// LOCALISED STRINGS
+RESOURCE TBUF r_qtn_netw_conset_info_cannot_delete_dest_prot_cm
+    { buf = qtn_netw_conset_info_cannot_delete_dest_prot_cm; }
+
+RESOURCE TBUF r_qtn_netw_sett_subnet_mask
+    { buf = qtn_netw_sett_subnet_mask; }
+
+RESOURCE TBUF r_qtn_netw_sett_default_gateway
+    { buf = qtn_netw_sett_default_gateway; }
+
+RESOURCE TBUF r_qtn_selec_setting_compulsory
+    { buf = qtn_selec_setting_compulsory; }
+
+RESOURCE TBUF r_qtn_set_dns_servers_automatic
+    { buf = qtn_set_dns_servers_automatic; }
+
+RESOURCE TBUF r_qtn_set_passwd_aut
+    { buf = qtn_set_passwd_aut; }
+
+RESOURCE TBUF r_qtn_set_ap_passwd
+    { buf = qtn_set_ap_passwd; }
+
+RESOURCE TBUF r_qtn_set_prompt_passwd_yes
+    { buf = qtn_set_prompt_passwd_yes; }
+
+RESOURCE TBUF r_qtn_set_prompt_passwd_no
+    { buf = qtn_set_prompt_passwd_no; }
+
+RESOURCE TBUF r_qtn_set_prompt_passwd
+    { buf = qtn_set_prompt_passwd; }
+
+RESOURCE TBUF r_qtn_set_ap_username_none
+    { buf = qtn_set_ap_username_none; }
+
+RESOURCE TBUF r_qtn_set_passwd_aut_normal
+    { buf = qtn_set_passwd_aut_normal; }
+
+RESOURCE TBUF r_qtn_set_passwd_aut_secure
+    { buf = qtn_set_passwd_aut_secure; }
+
+RESOURCE TBUF r_qtn_set_ap_username
+    { buf = qtn_set_ap_username; }
+
+RESOURCE TBUF r_qtn_set_ip_well_known
+    { buf = qtn_set_ip_well_known; }
+
+RESOURCE TBUF r_qtn_set_dns_servers_ip
+    { buf = qtn_set_dns_servers_ip; }
+
+RESOURCE TBUF r_qtn_set_secondary_dns
+    { buf = qtn_set_secondary_dns; }
+
+RESOURCE TBUF r_qtn_set_primary_dns
+    { buf = qtn_set_primary_dns; }
+
+RESOURCE TBUF r_qtn_set_ip_address_dynamic
+    { buf = qtn_set_ip_address_dynamic; }
+
+RESOURCE TBUF r_qtn_set_ip_address
+    { buf = qtn_set_ip_address; }
+
+RESOURCE TBUF r_qtn_set_ipv6_settings
+    { buf = qtn_set_ipv6_settings; }
+
+RESOURCE TBUF r_qtn_set_ipv4_settings
+    { buf = qtn_set_ipv4_settings; }
+
+RESOURCE TBUF r_qtn_set_ip_user_defined
+    { buf = qtn_set_ip_user_defined; }
+
+RESOURCE TBUF r_qtn_netw_quest_iap_incomplete_delete
+    { buf = qtn_netw_quest_iap_incomplete_delete; }
+
+RESOURCE TBUF r_qtn_set_info_invalid_ip
+    { buf = qtn_set_info_invalid_ip; }
+
+RESOURCE TBUF r_qtn_set_proxy_server_address
+    { buf = qtn_set_proxy_server_address; }
+    
+RESOURCE TBUF r_qtn_set_proxy_server_address_none
+    { buf = qtn_set_proxy_server_address_none; }
+    
+RESOURCE TBUF r_qtn_set_proxy_port_number
+    { buf = qtn_set_proxy_port_number; }
+    
+RESOURCE TBUF r_qtn_set_home_page_none
+    { buf = qtn_set_home_page_none; }
+    
+RESOURCE TBUF r_qtn_set_starting_page
+    { buf = qtn_set_starting_page; }
+    
+RESOURCE TBUF r_qtn_netw_conset_info_cannot_delete_virtual_ref
+    { buf = qtn_netw_conset_info_cannot_delete_virtual_ref; }
+    
+RESOURCE TBUF64 r_cmmanagereng_default_ap_name        
+    { buf =  qtn_set_ap_default_name; }
+
+RESOURCE TBUF r_qtn_netw_conset_info_uncat_empty 
+    { buf = qtn_netw_conset_info_uncat_empty ; }
+    
+RESOURCE TBUF r_qtn_netw_conset_embedded_dest 
+    { buf = qtn_netw_conset_embedded_dest ; }
+
+RESOURCE TBUF r_cmmanagerui_add_connection_method       
+    { buf = qtn_netw_conset_add_connection_method; }
+RESOURCE TBUF r_cmmanagerui_new_connection              
+    { buf = qtn_netw_conset_add_connection; }
+
+RESOURCE TBUF r_cmmanagerui_conn_methods_amount_many 
+    { buf = qtn_netw_conset_conn_methods_amount_many; }
+
+RESOURCE TBUF r_cmmanagerui_conn_methods_amount_one 
+    { buf = qtn_netw_conset_conn_methods_amount_one; }
+
+RESOURCE TBUF r_cmmanagerui_conn_methods_amount_none 
+    { buf = qtn_netw_conset_conn_methods_amount_none; }
+
+RESOURCE TBUF r_cmmanagerui_method_priority_other 
+    { buf = qtn_netw_conset_method_priority_other; }
+
+RESOURCE TBUF r_qtn_netw_conset_method_priority_auto
+    { buf = qtn_netw_conset_method_priority_auto; }
+
+RESOURCE TBUF r_cmmanagerui_navi 
+    { buf = qtn_netw_conset_network_connections_title; }
+
+RESOURCE TBUF r_cmmanagerui_empty_method_view_primary 
+    { buf = qtn_netw_conset_empty_method_view_primary; }
+
+RESOURCE TBUF r_cmmanagerui_empty_method_view_secondary 
+    { buf = qtn_netw_conset_empty_method_view_secondary; }
+
+RESOURCE TBUF r_cmmanagerui_connection_name           	
+    { buf = qtn_set_ap_conn_name; }
+
+RESOURCE TBUF r_cmmanagerui_prmpt_cm_mame
+    { buf = qtn_netw_conset_prmpt_method_name; }
+
+RESOURCE TBUF r_cmmanagerui_prmpt_destination_name           	
+    { buf =qtn_netw_conset_prmpt_destination_name;}
+
+RESOURCE TBUF r_cmmanagerui_quest_cm_delete           	
+    { buf = qtn_netw_conset_quest_delete_method;}
+
+RESOURCE TBUF r_cmmanagerui_info_cm_protected_cannot_delete           	
+    { buf = qtn_netw_conset_info_cannot_delete_protected_method;}
+
+RESOURCE TBUF r_cmmanagerui_info_cm_in_use_cannot_delete           	
+    { buf = qtn_netw_conset_info_cannot_delete_method_in_use;}
+
+RESOURCE TBUF r_cmmanagerui_quest_dest_delete           	
+    {  buf = qtn_netw_conset_quest_delete_destination; }
+
+RESOURCE TBUF r_cmmanagerui_info_dest_in_use_cannot_delete             	
+    {  buf = qtn_netw_conset_info_cannot_delete_dest_in_use; }
+
+RESOURCE TBUF r_qtn_set_note_ap_in_use_edit
+    { buf = qtn_set_note_ap_in_use_edit; }
+
+RESOURCE TBUF r_cmmanagerui_info_dest_protected_cannot_delete           	
+    { buf = qtn_netw_conset_info_cannot_delete_dest_protected;}
+
+RESOURCE TBUF r_cmmanagerui_dest_uncategorized           	
+    { buf = qtn_netw_conset_dest_uncategorized; }
+
+RESOURCE TBUF r_cmmanagerui_dest_internet           	
+    { buf = qtn_netw_conset_dest_internet; }
+
+RESOURCE TBUF r_cmmanagerui_dest_wap           	
+    { buf = qtn_netw_conset_dest_wap; }
+
+RESOURCE TBUF r_cmmanagerui_dest_mms           	
+    { buf = qtn_netw_conset_dest_mms; }
+
+RESOURCE TBUF r_cmmanagerui_dest_intranet           	
+   { buf = qtn_netw_conset_dest_intranet; }
+
+RESOURCE TBUF r_cmmanagerui_msk_add_method
+    { buf = qtn_msk_add_method; }
+
+RESOURCE TBUF r_plugin_base_options_change    
+	{ buf = qtn_set_options_change; }
+	
+RESOURCE TBUF r_plugin_base_options_ap_advanced                       
+	{ buf = qtn_set_options_ap_advanced; }
+
+RESOURCE TBUF r_plugin_base_cmd_exit                                  
+    { buf = qtn_set_options_exit; }
+			
+RESOURCE TBUF r_cmwizard_automatic_check
+    { buf = qtn_netw_conset_quest_check_conn_methods; }
+
+RESOURCE TBUF r_cmwizard_checking_methods
+    { buf = qtn_netw_conset_wait_checking_methods; }
+
+RESOURCE TBUF r_cmwizard_manual_configuration
+    { buf = qtn_netw_conset_quest_conf_method_manually; }
+
+RESOURCE TBUF r_cmwizard_available_methods
+    { buf = qtn_netw_conset_prmpt_available_methods; }
+
+RESOURCE TBUF r_cmwizard_bearer_available_wlan
+    { buf = qtn_netw_conset_bearer_available_wlan; }
+
+RESOURCE TBUF r_cmwizard_one_wlan_nw_available
+    { buf = qtn_netw_conset_one_wlan_nw_available; }
+
+RESOURCE TBUF r_cmwizard_many_wlan_nw_available
+    { buf = qtn_netw_conset_many_wlan_nw_available; }
+
+RESOURCE TBUF r_cmwizard_select_conn_method
+    { buf = qtn_netw_conset_prmpt_select_conn_method; }
+
+RESOURCE TBUF r_cmwizard_select_destination_description
+    { buf = qtn_netw_conset_detail_add_to_destination; }
+
+RESOURCE TBUF r_cmwizard_new_method_added
+    { buf = qtn_netw_conset_conf_new_method_added; }
+
+RESOURCE TBUF r_cmwizard_new_dest_added
+    { buf = qtn_netw_conset_conf_new_dest_added; }
+
+RESOURCE TBUF r_cmwizard_no_destination
+    { buf = qtn_netw_conset_info_no_destinations; }
+    
+RESOURCE TBUF r_cmwizard_no_unprotected_destination
+    { buf = qtn_new_conset_info_cannot_add_all_dest_protected; }
+
+RESOURCE TBUF r_cmwizard_no_unprotected_destination_dup
+    { buf = qtn_netw_conset_info_cannot_add_all_dest_protected; }
+
+RESOURCE TBUF r_cmwizard_cannot_perform_for_protected
+    { buf = qtn_netw_conset_info_cannot_perform_for_protected; }
+
+RESOURCE TBUF r_cmwizard_no_vpn_stacking
+    { buf = qtn_netw_conset_info_no_vpn_stacking; }
+
+RESOURCE TBUF r_cmmanagerui_sett_destination     
+    { buf = qtn_netw_conset_sett_destination; }
+
+RESOURCE TBUF r_cmmanagerui_sett_always_ask     
+    { buf = qtn_netw_conset_sett_always_ask; }
+
+RESOURCE TBUF r_cmmanagerui_sett_ask_once      	
+    { buf = qtn_netw_conset_sett_ask_once;  }
+
+RESOURCE TBUF r_cmmanagerui_sett_default_connection      	
+    { buf = qtn_netw_conset_sett_default_connection;  }
+
+RESOURCE TBUF r_cmmanagerui_sett_user_defined      	
+    { buf = qtn_netw_conset_sett_user_defined;  }
+
+RESOURCE TBUF r_cmmanagerui_navi_default 
+    { buf = qtn_netw_conset_navi_default; }
+
+RESOURCE TBUF r_cmmanagerui_navi_default_always_ask 
+    { buf = qtn_netw_conset_navi_default_always_ask; }
+
+RESOURCE TBUF r_cmmanagerui_navi_default_ask_once
+    { buf = qtn_netw_conset_navi_default_ask_once; }
+
+RESOURCE TBUF r_cmmanagerui_default_connection_set_to 
+    { buf = qtn_netw_conset_default_connection_set_to; }
+
+RESOURCE TBUF r_cmmanagerui_conf_default_always_ask 
+    { buf = qtn_netw_conset_conf_default_always_ask; }
+
+RESOURCE TBUF r_cmmanagerui_conf_default_ask_once 
+    { buf = qtn_netw_conset_conf_default_ask_once; }
+
+RESOURCE TBUF r_cmmanagerui_default_connection_title 
+    { buf = qtn_netw_conset_default_connection_title; }
+
+RESOURCE TBUF r_cmmanagerui_roaming_confirmation      	
+    { buf = qtn_netw_conset_sett_roaming_confirmation; }
+
+RESOURCE TBUF r_cmmanagerui_roaming_automatic           	
+    { buf = qtn_netw_conset_sett_roaming_automatic; }
+
+RESOURCE TBUF r_cmmanagerui_roaming_confirm           	
+    { buf = qtn_netw_conset_sett_roaming_confirm; }
+
+RESOURCE TBUF r_qtn_netw_conset_navi_nof_destinations 
+    { buf = qtn_netw_conset_navi_nof_destinations; }
+
+RESOURCE TBUF r_qtn_netw_conset_navi_one_destination 
+    { buf = qtn_netw_conset_navi_one_destination; }
+
+RESOURCE TBUF r_cmmanagerui_navi_one_conn_method 
+    { buf = qtn_netw_conset_navi_one_conn_method; }
+
+RESOURCE TBUF r_cmmanagerui_navi_many_conn_methods 
+    { buf = qtn_netw_conset_navi_many_conn_methods; }
+
+RESOURCE TBUF r_cmmanagerui_popup_title_data_bearer 
+    { buf = qtn_netw_conset_popup_title_data_bearer; }
+
+RESOURCE TBUF r_cmmanagerui_prmpt_select_icon 
+    { buf = qtn_netw_conset_prmpt_select_icon; }
+
+RESOURCE TBUF r_cmmanagerui_info_dest_already_in_use 
+    { buf = qtn_netw_conset_info_name_already_in_use; }
+
+RESOURCE TBUF r_plugin_base_set_ap_bearer
+    { buf = qtn_set_ap_bearer; }
+
+RESOURCE TBUF r_plugin_base_info_bearer_not_editable 
+    { buf = qtn_netw_conset_info_bearer_not_editable; }
+
+RESOURCE TBUF r_plugin_base_sett_smtp_override 
+    { buf = qtn_netw_conset_sett_smtp_override; }
+
+RESOURCE TBUF r_cmmanagerui_info_prio_not_possible 
+    { buf = qtn_netw_conset_info_prio_not_possible; }
+
+RESOURCE TBUF r_cmmanagerui_info_protected_cannot_edit      
+    { buf = qtn_netw_conset_info_cannot_edit_protected; }
+
+RESOURCE TBUF r_cmmanagerui_quest_embedded_dest_delete      
+    { buf = qtn_netw_conset_quest_delete_embedded_dest; }    
+
+// SMTP settings
+RESOURCE TBUF r_plugin_base_sett_smtp_outgoing_mail_server
+    { buf = qtn_mce_settings_mail_sending_h; }
+
+RESOURCE TBUF r_plugin_base_sett_smtp_user_name
+    { buf = qtn_mce_settings_mail_user_name; }
+
+RESOURCE TBUF r_plugin_base_sett_smtp_password
+    { buf = qtn_mce_settings_mail_password; }
+    
+RESOURCE TBUF r_plugin_base_prompt_server_addr
+    { buf = qtn_mbxs_settings_mail_srvr_prompt; }
+
+RESOURCE TBUF r_plugin_base_sett_smtp_security
+    { buf = qtn_mce_settings_mail_security; }
+    
+RESOURCE TBUF r_plugin_base_sett_security_on_starttls
+    { buf = qtn_mbxs_settings_mail_sec_starttls; }
+    
+RESOURCE TBUF r_plugin_base_sett_security_on_ssltls
+    { buf = qtn_mbxs_settings_mail_sec_ssltls; }
+
+RESOURCE TBUF r_plugin_base_sett_security_off
+    { buf = qtn_mbxs_settings_mail_sec_off; }
+
+RESOURCE TBUF r_plugin_base_sett_port_default
+    { buf = qtn_mbxs_settings_mail_port_def; }
+    
+RESOURCE TBUF r_plugin_base_sett_smtp_port 
+    { buf = qtn_mce_settings_mail_port; }
+
+RESOURCE TBUF r_plugin_base_sett_port_userdef
+    { buf = qtn_mbxs_settings_mail_port_userdef; }
+    
+RESOURCE TBUF r_text_softkey_option
+    {
+    buf = text_softkey_option;
+    }
+
+RESOURCE TBUF r_qtn_memlo_memory_full
+    {
+    buf = qtn_memlo_memory_full;
+    }
+
+RESOURCE TBUF r_qtn_fldr_name_already_used
+    {
+    buf = qtn_fldr_name_already_used;
+    }
+
+RESOURCE TBUF r_cmmanagerui_info_cm_already_in_use 
+    { buf = qtn_netw_conset_info_name_already_in_use; }
+
+
+    
+RESOURCE TBUF r_two_string_for_empty_view { buf = "%0U\n%1U"; }
+
+// --------------------------------------------------------------------------
+// Menu bars
+// --------------------------------------------------------------------------
+//   
+//    r_dest_menubar
+//    menubar for the settings view 
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_dest_menubar
+	{
+    titles=
+		{
+        MENU_TITLE { menu_pane=r_dest_menu; 
+                     txt="App"; }
+	    };
+	}
+// -----------------------------------------------------------------------------
+//   
+//    r_dest_menu
+//    menu pane for destination list 
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_dest_menu
+	{
+    items=
+        {
+        MENU_ITEM 
+            { 
+             command = ECmManagerUiCmdDestEdit; 
+             txt = qtn_options_open; 
+             flags = EEikMenuItemAction;
+             },
+        MENU_ITEM 
+            { 
+             command = ECmManagerUiCmdDestDefaultConnection; 
+             txt = qtn_netw_conset_options_default_connection; 
+             },
+        MENU_ITEM 
+            {
+            command = ECmManagerUiCmdDestAdd; 
+            txt = qtn_netw_conset_options_add_destination;
+            },
+        MENU_ITEM 
+            { 
+            command = ECmManagerUiCmdDestRename; 
+            txt = qtn_netw_conset_options_rename_destination;
+            flags = EEikMenuItemSpecific;
+            },
+        MENU_ITEM 
+            { 
+            command = ECmManagerUiCmdDestChangeIcon; 
+            txt = qtn_netw_conset_options_change_dest_icon; 
+            flags = EEikMenuItemSpecific;
+            },
+        MENU_ITEM 
+            { 
+            command = ECmManagerUiCmdDestDelete; 
+            txt = qtn_netw_conset_options_delete_destination;
+            flags = EEikMenuItemSpecific;
+            },
+        MENU_ITEM 
+            { 
+            command = EAknCmdHelp; 
+            txt = qtn_options_help;
+            },
+        MENU_ITEM 
+            { 
+            command = ECmManagerUiCmdDestUserExit; 
+            txt=qtn_options_exit; 
+            }
+         };
+  }
+  
+// -----------------------------------------------------------------------------
+//   
+//    r_select_netw_conn_menubar
+//    menubar for the settings view 
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_select_netw_conn_menubar
+	{
+    titles=
+		{
+        MENU_TITLE { menu_pane=r_select_netw_conn_menu; 
+                     txt="App"; }
+	    };
+	}		
+	
+// -----------------------------------------------------------------------------
+//   
+//    r_select_netw_conn_menu
+//    menu pane for destination list 
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_select_netw_conn_menu
+	{
+    items=
+		    {
+		     MENU_ITEM 
+		         { 
+		          command = ECmManagerUiCmdDestSelect; 
+              txt = qtn_set_cmd_select;
+              }
+         ,MENU_ITEM 
+              {
+            	command = ECmManagerUiCmdCMSelect;
+            	txt = qtn_netw_conset_options_select_method;
+            	}            
+          ,MENU_ITEM 
+            	{
+            	command = EAknCmdHelp; 
+            	txt = qtn_options_help;
+            	}
+				};
+	}
+
+// -----------------------------------------------------------------------------
+//
+//    r_dest_dialog
+//
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_dest_dialog
+    {
+    flags = EEikDialogFlagWait | 
+            EEikDialogFlagNoDrag |
+            EEikDialogFlagNoTitleBar | 
+            EEikDialogFlagFillAppClientRect |
+            EEikDialogFlagCbaButtons;
+    buttons = R_AVKON_SOFTKEYS_OPTIONS_BACK__SELECT;
+    items =
+        {
+        DLG_LINE
+            {
+            type = KDestListboxType;
+            id = KDestListboxId;
+            control= LISTBOX { flags = EAknListBoxSelectionList;};
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//   r_dest_listbox 
+//   List of individual settings
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE LISTBOX r_dest_listbox
+	{
+	flags = EAknListBoxSelectionList;
+	}
+
+
+//-----------------------------------------------------------------------------
+// Menu bars
+// -----------------------------------------------------------------------------
+//   
+//    r_cm_menubar
+//    menubar for the settings view 
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_cm_menubar
+	{
+    titles=
+		{
+        MENU_TITLE { menu_pane=r_cm_menu; txt="App"; }
+	    };
+	}
+// -----------------------------------------------------------------------------
+//   
+//    r_cm_menu
+//    menu pane for cmination list 
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_cm_menu
+  {
+    items=
+        {
+         MENU_ITEM 
+             { 
+              command = ECmManagerUiCmdCmEdit; 
+              txt = qtn_netw_conset_options_edit; 
+              flags = EEikMenuItemAction;
+              },
+         MENU_ITEM 
+             { 
+        			command = ECmManagerUiCmdCmAdd; 
+        			txt = qtn_netw_conset_options_add_method;
+            	},
+     		 MENU_ITEM 
+        		 { 
+        			command = ECmManagerUiCmdCmRename; 
+        			txt = qtn_netw_conset_options_rename_method;
+            	flags = EEikMenuItemSpecific;
+        			},
+         MENU_ITEM 
+          		{ 
+        			command = ECmManagerUiCmdCmDelete; 
+            	txt = qtn_netw_conset_options_delete_method;
+            	flags = EEikMenuItemSpecific;
+            	},
+        	MENU_ITEM 
+          	  {
+            	command = ECmManagerUiCmdCmPrioritise; 
+            	txt = qtn_netw_conset_options_prioritise; 
+            	flags = EEikMenuItemSpecific;
+            	},
+        	MENU_ITEM 
+           	 { 
+            	command = ECmManagerUiCmdCmMoveToOtherDestination; 
+            	txt = qtn_netw_conset_options_move_to_dest;
+            	flags = EEikMenuItemSpecific;
+            	},
+        	MENU_ITEM 
+            	{ 
+            	command = ECmManagerUiCmdCmCopyToOtherDestination; 
+            	txt = qtn_netw_conset_options_copy_to_dest;
+            	flags = EEikMenuItemSpecific;
+            	},
+        	MENU_ITEM 
+            	{ 
+            	command = EAknCmdHelp; 
+            	txt = qtn_options_help;
+            	},
+        	MENU_ITEM 
+          	  { 
+            	command = ECmManagerUiCmdCmUserExit; 
+            	txt = qtn_options_exit; 
+            	}
+    		};
+  }
+
+// -----------------------------------------------------------------------------
+// r_softkeys_options_cancel__connect
+// option/add method/cancel button set
+// -----------------------------------------------------------------------------
+RESOURCE CBA r_softkeys_options_back__edit
+    {
+    buttons =
+        {
+        CBA_BUTTON { id = EAknSoftkeyOptions;       txt = text_softkey_option; },
+        CBA_BUTTON { id = EAknSoftkeyBack;          txt = text_softkey_back; },
+        CBA_BUTTON { id = ECmManagerUiCmdCmEdit;    txt = qtn_msk_edit; }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+// r_softkeys_prio_ok_cancel__ok
+// ok/ok/cancel button set for prioritise
+// -----------------------------------------------------------------------------
+RESOURCE CBA r_softkeys_prio_ok_cancel__ok
+    {
+    buttons =
+        {
+        CBA_BUTTON { id = ECmManagerUiCmdCmPrioOk;       txt = text_softkey_ok; },
+        CBA_BUTTON { id = ECmManagerUiCmdCmPrioCancel;   txt = text_softkey_cancel; },
+        CBA_BUTTON { id = ECmManagerUiCmdCmPrioOk;       txt = text_softkey_ok; }
+        };
+    }
+
+    
+// -----------------------------------------------------------------------------
+//
+//    r_cm_dialog
+//
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_cm_dialog
+    {
+    flags = EEikDialogFlagWait | 
+            EEikDialogFlagNoDrag |
+            EEikDialogFlagNoTitleBar | 
+            EEikDialogFlagFillAppClientRect |
+            EEikDialogFlagCbaButtons | 
+            EEikDialogFlagNotifyEsc;
+    buttons = r_softkeys_options_back__edit;
+    items =
+        {
+        DLG_LINE
+            {
+            type = KCmListboxType;
+            id = KCmListboxId;
+            control= LISTBOX { flags = EAknListBoxSelectionList;};
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//   r_cm_listbox 
+//   List of individual settings
+// -----------------------------------------------------------------------------
+//
+RESOURCE LISTBOX r_cm_listbox
+	{
+	flags = EAknListBoxSelectionList;
+	}
+	
+// -----------------------------------------------------------------------------
+//    r_plugin_base_menubar
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_plugin_base_menubar
+    {
+    titles=
+        {
+        MENU_TITLE { menu_pane=r_plugin_base_menu; txt="A"; }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//    r_plugin_base_menu
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_plugin_base_menu
+    {
+    items=
+        {
+        MENU_ITEM 
+            { 
+            command = EPluginBaseCmdChange; 
+            txt = qtn_set_options_change; 
+            flags = EEikMenuItemAction;
+            },
+        MENU_ITEM 
+            { 
+            command = EPluginBaseCmdAdvanced;
+            txt = qtn_set_options_ap_advanced; 
+            },
+        MENU_ITEM 
+            { 
+            command = EAknCmdHelp; 
+            txt=qtn_options_help;
+            },
+        MENU_ITEM 
+            { 
+            command = EPluginBaseCmdExit; 
+            txt = qtn_options_exit; 
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+// r_softkeys_options_back__change
+// option/add connection/cancel button set
+// -----------------------------------------------------------------------------
+RESOURCE CBA r_softkeys_options_back__change
+    {
+    buttons =
+        {
+        CBA_BUTTON { id = EAknSoftkeyOptions;   txt = text_softkey_option; },
+        CBA_BUTTON { id = EAknSoftkeyBack;      txt = text_softkey_back; },
+        CBA_BUTTON { id = EAknSoftkeyChange;    txt = qtn_msk_change; }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//    r_plugin_base_dialog
+// -----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_plugin_base_dialog
+    {
+    flags= EEikDialogFlagWait | 
+           EEikDialogFlagNoDrag | 
+           EEikDialogFlagNoTitleBar |
+           EEikDialogFlagFillAppClientRect |
+           EEikDialogFlagCbaButtons;
+
+    buttons = r_softkeys_options_back__change;
+    items=
+        {
+        DLG_LINE
+            {
+            type = EAknCtSettingListBox;
+            id = KPluginBaseListboxId;
+            control= LISTBOX { flags = EEikListBoxMultipleSelection;};
+            }
+        };
+    }
+
+RESOURCE LISTBOX r_listbox_ap_settings
+    {
+    flags = EEikListBoxMultipleSelection;
+    }
+    
+// Ap data editor resources
+// Connection name
+
+RESOURCE EDWIN r_setting_app_edwin_conn_name
+    {
+    width=KConnNameWidth;
+    lines=KConnNameLines;
+    maxlength=KMaxConnNameLength;
+    allowed_input_modes = EAknEditorTextInputMode | EAknEditorNumericInputMode;
+    default_input_mode = EAknEditorTextInputMode;
+    flags= EEikEdwinAutoSelection | EEikEdwinNoLineOrParaBreaks;
+    }
+RESOURCE AVKON_SETTING_PAGE r_text_setting_page_conn_name
+    {
+    number= EAknSettingPageNoOrdinalDisplayed;
+    softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+    label= qtn_set_ap_conn_name;
+    type = EEikCtEdwin;
+    editor_resource_id = r_setting_app_edwin_conn_name;
+    }
+    
+RESOURCE DIALOG r_ok_note
+    {
+    flags = EEikDialogFlagNoDrag | EEikDialogFlagNoTitleBar |
+            EEikDialogFlagCbaButtons | EEikDialogFlagWait;
+    buttons = R_AVKON_SOFTKEYS_EMPTY;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtNote;
+            id = EGeneralNote;
+            control = AVKON_NOTE
+                {
+                layout = EGeneralLayout;
+                animation = R_QGN_NOTE_OK_ANIM;
+                };
+            }
+        };
+    }    
+
+RESOURCE DIALOG r_info_note
+    {
+    flags = EEikDialogFlagNoDrag | EEikDialogFlagNoTitleBar |
+            EEikDialogFlagCbaButtons | EEikDialogFlagWait;
+    buttons = R_AVKON_SOFTKEYS_EMPTY;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtNote;
+            id = EGeneralNote;
+            control = AVKON_NOTE
+                {
+                layout = EGeneralLayout;
+                animation = R_QGN_NOTE_INFO_ANIM;
+                };
+            }
+        };
+    }    
+
+
+RESOURCE DIALOG r_warning_note
+    {
+    flags = EEikDialogFlagNoDrag | EEikDialogFlagNoTitleBar |
+            EEikDialogFlagCbaButtons | EEikDialogFlagWait;
+    buttons = R_AVKON_SOFTKEYS_EMPTY;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtNote;
+            id = EGeneralNote;
+            control = AVKON_NOTE
+                {
+                layout = EGeneralLayout;
+                animation = R_QGN_NOTE_WARNING_ANIM;
+                };
+            }
+        };
+    }    
+
+
+RESOURCE DIALOG r_error_note
+    {
+    flags = EEikDialogFlagNoDrag | EEikDialogFlagNoTitleBar |
+            EEikDialogFlagCbaButtons | EEikDialogFlagWait;
+    buttons = R_AVKON_SOFTKEYS_EMPTY;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtNote;
+            id = EGeneralNote;
+            control = AVKON_NOTE
+                {
+                layout = EGeneralLayout;
+                animation = R_QGN_NOTE_ERROR_ANIM;
+                };
+            }
+        };
+    }    
+
+
+RESOURCE DIALOG r_confirmation_query
+    {
+    flags = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_YES_NO__YES;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control = AVKON_CONFIRMATION_QUERY
+                {
+                layout = EConfirmationLayout;
+                };  // AVKON_CONFIRMATION_QUERY
+            }   // DLG_LINE
+        };  // items
+    }   // DIALOG
+
+RESOURCE DIALOG r_memory_full_confirmation_query
+    {
+    flags = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_OK_EMPTY__OK;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control = AVKON_CONFIRMATION_QUERY
+                {
+                layout = EConfirmationLayout;
+                animation = R_QGN_NOTE_WARNING_ANIM;
+                };  // AVKON_CONFIRMATION_QUERY
+            }   // DLG_LINE
+        };  // items
+    }   // DIALOG    
+
+RESOURCE DIALOG r_text_query
+    {
+    flags = EEikDialogFlagWait | EEikDialogFlagNoDrag |
+            EEikDialogFlagNoTitleBar | EEikDialogFlagCbaButtons |
+            EEikDialogFlagNoShadow;
+    buttons = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control = AVKON_DATA_QUERY
+                {
+                layout = EDataLayout;
+                control = EDWIN
+                    {
+                    flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable;
+                    };  // EDWIN
+                };  // AVKON_DATA_QUERY
+            }   // DLG_LINE
+        };  // items
+    }   // DIALOG
+
+RESOURCE LISTBOX r_setting_app_listbox
+    {
+    flags = EEikListBoxMultipleSelection;
+    }
+
+RESOURCE AVKON_SETTING_PAGE r_radio_button_setting_page
+    {
+    number = EAknSettingPageNoOrdinalDisplayed;
+    softkey_resource = R_AVKON_SOFTKEYS_OPTIONS_CANCEL__SELECT;
+    menubar = r_select_netw_conn_menubar;
+    type =  EAknSetListBox;
+    editor_resource_id= r_setting_app_listbox;
+    }
+
+RESOURCE AVKON_SETTING_PAGE r_radio_button_setting_page_ok_cancel
+    {
+    number = EAknSettingPageNoOrdinalDisplayed;
+    softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+    type =  EAknSetListBox;
+    editor_resource_id= r_setting_app_listbox;
+    }
+
+// --------------------------------------------------------------------------
+// 
+// Generic numeric setting edwin
+// --------------------------------------------------------------------------
+//
+RESOURCE EDWIN r_edwin_port_number_setting_page
+    {
+    width=KNumericPageWidth;
+    lines=KNumericPageLines;
+    maxlength=KMaxProxyPortNumberLength;
+    allowed_input_modes = EAknEditorNumericInputMode;
+    default_input_mode = EAknEditorNumericInputMode;
+    default_case = EAknEditorLowerCase;
+    flags = EEikEdwinAutoSelection | EEikEdwinNoLineOrParaBreaks;
+    avkon_flags = EAknEditorFlagLatinInputModesOnly;
+    numeric_keymap = EAknEditorPlainNumberModeKeymap;
+    }
+
+// --------------------------------------------------------------------------
+// r_port_number_setting_page
+// Port number setting page
+// --------------------------------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_port_number_setting_page
+    {
+    number= EAknSettingPageNoOrdinalDisplayed;
+    softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+    type = EEikCtEdwin;
+    editor_resource_id = r_edwin_port_number_setting_page;
+    }
+    
+
+RESOURCE DIALOG r_cmmanager_wait_note
+    {
+    flags = EAknWaitNoteFlags;
+    buttons = R_AVKON_SOFTKEYS_CANCEL;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtNote;
+            id = ECmWaitDialog;
+            control= AVKON_NOTE
+                {
+                layout = EWaitLayout;
+                animation = R_QGN_GRAF_WAIT_BAR_ANIM;
+                };
+            }
+        };
+    }
+
+
+RESOURCE AVKON_LIST_QUERY r_cmmanager_list_query_with_msgbox
+    {
+    softkeys = R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT;
+    flags = EEikDialogFlagNotifyEsc | EEikDialogFlagWait;
+    items =
+        {
+        AVKON_LIST_QUERY_DLG_LINE
+            {
+            id = EListQueryControl;
+            control = AVKON_LIST_QUERY_CONTROL_WITH_MSGBOX
+                {
+                actuallisttype = EAknCtSingleGraphicPopupMenuListBox;
+                listbox = AVKON_LIST_QUERY_LIST
+                    {
+                    flags = EAknListBoxSelectionList;
+                    };
+
+                heading = qtn_netw_conset_prmpt_add_to_destination;
+                };
+            }
+        };
+    }
+    
+// -----------------------------------------------------------------------------
+//
+//    r_iconsel_dialog
+//
+//
+// -----------------------------------------------------------------------------
+//
+
+RESOURCE DIALOG r_iconsel_dialog
+    {
+    flags = EGeneralQueryFlags | 
+            EEikDialogFlagNoBorder |
+            EEikDialogFlagNoShadow;
+    buttons =
+            R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT;
+    items=
+        {
+        DLG_LINE
+            {
+            type = EAknCtPopupHeadingPane;
+            id = EAknSCTQueryHeadingId;
+            control = AVKON_HEADING
+                {
+                headinglayout = R_AVKON_SCT_LIST_HEADING_PANE;
+                };
+            },
+        DLG_LINE
+            {
+            type = KCmDestIconMapType;//0x2001
+            id = ECmDestIconMapContentId;
+            }
+        };
+    }    
+
+// ---------------------------------------------------------------------------
+// r_setting_app_edwin_proxy_server_addr
+// edwin for proxy server address setting page
+// ---------------------------------------------------------------------------
+//
+RESOURCE EDWIN r_setting_app_edwin_proxy_server_addr
+    {
+    width = KProxyServerWidth;
+    lines = KProxyServerLines;
+    maxlength = KMaxProxyServerLength;
+    numeric_keymap = EAknEditorCalculatorNumberModeKeymap;
+    allowed_input_modes = EAknEditorTextInputMode | EAknEditorNumericInputMode;
+    default_input_mode = EAknEditorTextInputMode;
+    special_character_table = R_AVKON_URL_SPECIAL_CHARACTER_TABLE_DIALOG;
+    default_case = EAknEditorLowerCase;
+    allowed_case_modes = EAknEditorLowerCase | EAknEditorUpperCase;
+    avkon_flags = EAknEditorFlagLatinInputModesOnly | EAknEditorFlagUseSCTNumericCharmap;
+    flags = EEikEdwinAutoSelection | EAknEditorLowerCase | EEikEdwinNoLineOrParaBreaks;
+    }
+
+// --------------------------------------------------------------------------
+// r_text_setting_page_proxy_server_addr
+// Proxy server address page
+// --------------------------------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_text_setting_page_proxy_server_addr
+    {
+    number= EAknSettingPageNoOrdinalDisplayed;
+    softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+    label= qtn_set_proxy_server_address;
+    type = EEikCtEdwin;
+    editor_resource_id = r_setting_app_edwin_proxy_server_addr;
+    }
+
+// --------------------------------------------------------------------------
+// r_setting_app_edwin_starting_page
+// Starting Page edwin
+// --------------------------------------------------------------------------
+//
+RESOURCE EDWIN r_setting_app_edwin_starting_page
+    {
+    width=KStartPageWidth;
+    lines=KStartPageLines;
+    maxlength=KMaxStartPageLength;
+    numeric_keymap=EAknEditorAlphanumericNumberModeKeymap;
+    allowed_input_modes = EAknEditorTextInputMode | EAknEditorNumericInputMode;
+    default_input_mode = EAknEditorTextInputMode;
+    special_character_table = R_AVKON_URL_SPECIAL_CHARACTER_TABLE_DIALOG;
+    default_case = EAknEditorLowerCase;
+    flags= EEikEdwinAutoSelection | EAknEditorLowerCase | EEikEdwinNoLineOrParaBreaks;
+    avkon_flags=EAknEditorFlagNoT9 | EAknEditorFlagLatinInputModesOnly;
+    }
+
+// --------------------------------------------------------------------------
+// r_text_setting_page_starting_page
+// starting page
+// --------------------------------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_text_setting_page_starting_page
+    {
+    number= EAknSettingPageNoOrdinalDisplayed;
+    softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+    label= qtn_set_starting_page;
+    type = EEikCtEdwin;
+    editor_resource_id = r_setting_app_edwin_starting_page;
+    }
+
+// ---------------------------------------------------------------------------
+// r_setting_app_edwin_login_name
+// edwin for login name page
+// ---------------------------------------------------------------------------   
+RESOURCE EDWIN r_setting_app_edwin_login_name
+    {
+    width = KLoginNameWidth;
+    lines = KLoginNameLines;
+    maxlength = KMaxLoginNameLength;
+    allowed_input_modes = EAknEditorTextInputMode | 
+                          EAknEditorNumericInputMode;
+    default_input_mode = EAknEditorTextInputMode;
+    default_case = EAknEditorLowerCase;
+    flags = EEikEdwinAutoSelection | EEikEdwinNoLineOrParaBreaks;
+    avkon_flags = EAknEditorFlagNoT9 | EAknEditorFlagLatinInputModesOnly;    
+    }
+
+// ---------------------------------------------------------------------------
+// r_text_setting_page_login_name
+// setting page for login name
+// ---------------------------------------------------------------------------   
+RESOURCE AVKON_SETTING_PAGE r_text_setting_page_login_name
+    {
+    number = EAknSettingPageNoOrdinalDisplayed;
+    softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+    label = qtn_set_ap_username;
+    type = EEikCtEdwin;
+    editor_resource_id = r_setting_app_edwin_login_name;
+    }
+
+// --------------------------------------------------------------------------
+// r_setting_app_ip_editor
+// IP Editor
+// --------------------------------------------------------------------------
+//
+RESOURCE IP_FIELD_EDITOR r_setting_app_ip_editor
+    {
+    min_field_values = IP_FIELD
+        {
+        first_field = 0;
+        second_field = 0;
+        third_field = 0;
+        fourth_field = 0;
+        };
+    max_field_values = IP_FIELD
+        {
+        first_field = 255;
+        second_field = 255;
+        third_field = 255;
+        fourth_field = 255;
+        };
+    flags = 0;
+    }
+
+// --------------------------------------------------------------------------
+// r_text_setting_page_ip_addr
+// IspIPAddr page
+// --------------------------------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_text_setting_page_ip_addr
+    {
+    number= EAknSettingPageNoOrdinalDisplayed;
+    softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+    label= qtn_set_ip_address;
+    type = EAknCtIpFieldEditor;
+    editor_resource_id = r_setting_app_ip_editor;
+    }
+    
+// --------------------------------------------------------------------------
+// r_dnsip4_query
+// IP4 dialog
+// --------------------------------------------------------------------------
+//    
+RESOURCE DIALOG r_dnsip4_query
+	{
+	flags=EGeneralQueryFlags;
+	buttons=R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+	items=
+		{
+		DLG_LINE
+			{
+			type=EAknExtCtMultilineQuery;
+			id=EMultilineFirstLine;
+			control = AVKON_DATA_QUERY
+				{ 
+				layout = EMultiDataFirstIpEd;
+                label = qtn_set_primary_dns;
+                control = IP_FIELD_EDITOR
+                    {
+ 					min_field_values = IP_FIELD
+ 						{ 
+ 						first_field = IPADDRESS_MIN_FIRST_FIELD_VALUE;
+ 						second_field = IPADDRESS_MIN_SECOND_FIELD_VALUE;
+ 						third_field = IPADDRESS_MIN_THIRD_FIELD_VALUE;
+ 						fourth_field = IPADDRESS_MIN_FOURTH_FIELD_VALUE;
+ 						};
+ 					max_field_values = IP_FIELD
+ 						{
+						first_field = IPADDRESS_MAX_FIRST_FIELD_VALUE;
+						second_field = IPADDRESS_MAX_SECOND_FIELD_VALUE;
+						third_field = IPADDRESS_MAX_THIRD_FIELD_VALUE;
+						fourth_field = IPADDRESS_MAX_FOURTH_FIELD_VALUE;
+ 						};
+ 					flags = 0;
+					};
+ 				};
+			},
+		DLG_LINE
+			{
+             type = EAknExtCtMultilineQuery;
+             id = EMultilineSecondLine;
+             control = AVKON_DATA_QUERY
+                 {
+                 layout = EMultiDataSecondIpEd;
+                 label = qtn_set_secondary_dns;
+                 control = IP_FIELD_EDITOR
+                     {
+                     min_field_values = IP_FIELD
+ 						{ 
+						first_field = IPADDRESS_MIN_FIRST_FIELD_VALUE;
+						second_field = IPADDRESS_MIN_SECOND_FIELD_VALUE;
+						third_field = IPADDRESS_MIN_THIRD_FIELD_VALUE;
+						fourth_field = IPADDRESS_MIN_FOURTH_FIELD_VALUE;
+ 						};
+ 					max_field_values = IP_FIELD
+ 						{
+						first_field = IPADDRESS_MAX_FIRST_FIELD_VALUE;
+						second_field = IPADDRESS_MAX_SECOND_FIELD_VALUE;
+						third_field = IPADDRESS_MAX_THIRD_FIELD_VALUE;
+						fourth_field = IPADDRESS_MAX_FOURTH_FIELD_VALUE;
+ 						};
+ 					flags = 0;
+					};
+ 				};
+			}
+		};
+	}
+
+// --------------------------------------------------------------------------
+// r_dnsip6_query
+// IP6 dialog
+// --------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_dnsip6_query
+	{
+	flags=EGeneralQueryFlags;
+	buttons=R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+	items=
+		{
+		DLG_LINE
+			{
+			type=EAknCtMultilineQuery;
+			id=EMultilineFirstLine;
+			control = AVKON_DATA_QUERY
+				{ 
+				layout = EMultiDataFirstEdwin;
+				label = qtn_set_primary_dns;
+				control = EDWIN
+				    {
+			    	avkon_flags = EAknEditorFlagLatinInputModesOnly;
+					flags=0;
+					width=16;
+					lines=1;
+					maxlength=KMaxIPv6NameServerLength;
+					default_input_mode = EAknEditorNumericInputMode;
+					};
+				};
+			},
+		DLG_LINE
+			{
+			type=EAknCtMultilineQuery;
+			id=EMultilineSecondLine;
+			control= AVKON_DATA_QUERY 
+				{ 
+				layout = EMultiDataSecondEdwin;
+				label = qtn_set_secondary_dns;
+				control=EDWIN 
+				    {
+                	avkon_flags = EAknEditorFlagLatinInputModesOnly;
+					flags= 0;
+					width=16;
+					lines=1;
+					maxlength=KMaxIPv6NameServerLength;
+					default_input_mode = EAknEditorNumericInputMode;
+					};
+				};
+			}
+		};
+	}
+
+// --------------------------------------------------------------------------
+// r_text_setting_page_ip
+// IPNameServer1 page
+// --------------------------------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_text_setting_page_ip
+    {
+    number= EAknSettingPageNoOrdinalDisplayed;
+    softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+    label= qtn_set_primary_dns;
+    type = EAknCtIpFieldEditor;
+    editor_resource_id = r_setting_app_ip_editor;
+    }
+
+// --------------------------------------------------------------------------
+// r_setting_app_edwin_passwd
+// login password secret input box
+// --------------------------------------------------------------------------
+//
+RESOURCE SECRETED r_setting_app_edwin_passwd
+    {
+    num_letters=KMaxLoginPasswordLength;
+    }
+    
+// --------------------------------------------------------------------------
+// r_text_setting_page_login_passwd
+// login password page
+// --------------------------------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_text_setting_page_passwd
+    {
+    number= EAknSettingPageNoOrdinalDisplayed;
+    softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+    label= qtn_set_ap_passwd;
+    type = EEikCtSecretEd;
+    editor_resource_id = r_setting_app_edwin_passwd;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Framework/loc/cmmanager.loc	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,1106 @@
+/*
+* 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 file.
+*
+*/
+
+//  LOCALISATION STRINGS
+
+//============================================================================
+// GENERAL SETTINGS VIEW
+//============================================================================
+//d: Network destinations setting item under General Settings/Connection Settings
+//l: list_single_large_graphic_pane_t1_cp2
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_network_connections "Network destinations"
+
+//=============================================================================
+//  DESTINATION VIEW
+//=============================================================================
+
+//-----------------------------------------------------------------------------
+// Options Menu Items
+//-----------------------------------------------------------------------------
+
+//d: Options menu text. Edit the highlighted item, used for destination and 
+//d: connection methods views
+//l: list_single_pane_t1_cp2
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_options_edit    "Edit"
+
+//d: Options menu text. Opens a submenu to manage the highlighted destination
+//l: list_single_pane_t1_cp2
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_options_manage_destination    "Manage"
+
+//d: Options menu text. Opens a radio button page to select default conneciton
+//l: list_single_pane_t1_cp2
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_options_default_connection "Default Connection"
+
+//d: Options menu text, subitem of Manage. Adds a new destination
+//l: list_single_popup_submenu_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_options_add_destination    "Add destination"
+
+//d:Options menu text, subitem of Manage
+//l: list_single_popup_submenu_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_options_rename_destination    "Rename destination"
+
+//d:Options menu text, subitem of Manage
+//l: list_single_popup_submenu_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_options_change_dest_icon    "Change icon"
+
+//d:Options menu text, subitem of Manage
+//l: list_single_popup_submenu_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_options_delete_destination    "Delete destination"
+
+
+//d: Destination name query prompt text 
+//l: popup_query_data_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_prmpt_destination_name "Destination name: "
+
+//d: Title text for destination icon selection dialog.
+//l: heading_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_prmpt_select_icon "Select an icon:"
+
+
+//d: Connection method name query prompt text 
+//l: popup_query_data_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_prmpt_method_name "Connection method name:"
+
+//d: Connection method delete query text 
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_quest_delete_method "Delete connection method ’%U’?"
+
+//d: Connection method delete info text 
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_info_cannot_delete_protected_method "Unable to delete protected connection method"
+
+//d: Connection method delete info text 
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_info_cannot_delete_method_in_use "Connection method currently in use. Unable to delete."
+
+//d: Destination delete query text 
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_quest_delete_destination "Delete destination ’%U’ and associated connection methods?"
+
+//d: Destination delete info text
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_info_cannot_delete_dest_in_use "Destination currently in use. Unable to delete."
+
+//d: Note to indicate the the selected connection method cannot be currently edited as it is being used
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_set_note_ap_in_use_edit "Connection method is currently in use. Unable to edit."
+
+//d: Destination delete info text
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_info_cannot_delete_dest_protected  "Unable to delete protected destination"
+
+//d: Destination name info text, shown when destination name already exists
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_info_name_already_in_use  "Name ’%U’ already in use"
+
+//d: Embedded Destination delete query text
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_quest_delete_embedded_dest  "Link cannot be restored by user. Delete anyway?"
+
+//d: Common text used to indicate that a destination or connection method
+//d: cannot be edited if it is protected
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_info_cannot_edit_protected  "Unable to edit protected settings"
+
+//-----------------------------------------------------------------------------
+// List Items
+//-----------------------------------------------------------------------------
+
+//d: The name of a new, default connection. Max.30 chars, 
+//d: longer ones will be truncated.
+//l: list_double_large_graphic_pane_t1_cp2
+//w:
+//r: 3.2
+//
+#define qtn_netw_conset_add_connection "Add connection"
+
+//d: The group of legacy access points
+//l: list_double_large_graphic_pane_t1_cp2
+//w:
+//r: 3.2
+//
+#define qtn_netw_conset_dest_uncategorized "Uncategorized"
+
+//d: Destination list text. The second line for qtn_netw_conset_add_connection 
+//d: Indicates that selecting the item will start the UI for adding a
+//d: a connection method
+//l: list_double_large_graphic_pane_t2_cp2
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_add_connection_method "New connection method"
+
+//d: Destination list text, notes the number of connections methods
+//d: belonging to the destination
+//l: list_double_large_graphic_pane_t2_cp2
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_conn_methods_amount_many    "%N connection methods"
+
+//d: Destination list text. Notes that the destination has one 
+//d: connection method
+//l: list_double_large_graphic_pane_t2_cp2
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_conn_methods_amount_one      "1 connection method"
+
+//d: Destination list text. Notes that the destination is empty
+//l: list_double_large_graphic_pane_t2_cp2
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_conn_methods_amount_none      "No connection methods"
+
+//-----------------------------------------------------------------------------
+// Status Pane
+//-----------------------------------------------------------------------------
+
+//d: Destination list title text
+//l: title_pane_t2/opt9
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_network_connections_title "Network destinations"
+
+//d: Destination list text. Shows the number of configured destinations in the 
+//d: navi pane
+//l: navi_text_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_navi_nof_destinations "%N destinations defined"
+
+//d: Destination list text. Shows the number of configured destinations in the 
+//d: navi pane
+//l: navi_text_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_navi_one_destination "1 destination defined"
+
+//d: Destination list text. Shows the default connection in the 
+//d: navi pane
+//l: navi_text_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_navi_default "Default: %U"
+
+//d: Destination list text. Shows that the default connection
+//d: is Always ask
+//l: navi_text_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_navi_default_always_ask "Default: Always ask"
+
+//d: Destination list text. Shows that the default connection
+//d: is Ask once
+//l: navi_text_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_navi_default_ask_once "Default: Ask once"
+
+//=============================================================================
+//  CONNECTION METHOD VIEW
+//=============================================================================
+
+//-----------------------------------------------------------------------------
+// Options Menu Items
+//-----------------------------------------------------------------------------
+
+//d: Connection method list text. Starts a wizard for adding a 
+//d: new connection method
+//l: list_single_pane_t1_cp2
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_options_add_method "Add connection method"
+
+//d: Connection method list text. Renames the highlighted connection methof
+//l: list_single_pane_t1_cp2
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_options_rename_method "Rename"
+
+//d: Connection method list text. Deletes the highlighted connection method
+//l: list_single_pane_t1_cp2
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_options_delete_method "Delete"
+
+//d: Connection method list text. Opens a submenu for managing the highlighted
+//d: connection method
+//l: list_single_pane_t1_cp2/opt3
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_options_organise "Organise"
+
+//d:Connection method list text. Prioritise the highlighted connecton method
+//l: list_single_popup_submenu_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_options_prioritise "Prioritise"
+
+//d: Connection method list text. Moves the highlighted connection method
+//d: to a selected target destination
+//l: list_single_popup_submenu_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_options_move_to_dest "Move to other destination"
+
+//d: Connection method list text. Copies the highlighted connection method
+//d: to a selected target destination
+//l: list_single_popup_submenu_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_options_copy_to_dest "Copy to other destination"
+
+//-----------------------------------------------------------------------------
+// List Items
+//-----------------------------------------------------------------------------
+
+//d: Connection method list text. Indicates the priority of the 
+//d: connection method
+//l: list_double_graphic_pane_t2
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_method_priority_other "Priority %N connection method "
+
+//d: Shown if the method is bound to a destination.
+//l: list_double_graphic_pane_t2
+//w:
+//r: 5.1
+//
+#define qtn_netw_conset_method_priority_auto "Priority: Automatic"
+
+//d: Connection method list text. The name of an embedded destination
+//l: list_double_graphic_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_embedded_dest "Link to '%U'"
+
+//d: Connection method list popup note. Text shown in a toolip (info popup)
+//d: which is prefixed to the Bearer type of the highlighted connection method
+//l: popup_preview_text_window_t1
+//w:
+//r:3.2
+//
+#define qtn_netw_conset_popup_title_data_bearer "Data Bearer: "
+
+//d: Connection method list popup note. WLAN Bearer type shown in info popup
+//l: popup_preview_text_window_t1
+//w:
+//r: 3.2
+//
+#define qtn_netw_conset_popup_bearer_wlan "Wireless LAN"
+
+//d: Connection method list popup note. 
+//d: Packet Data Bearer type shown in info popup
+//l: popup_preview_text_window_t1
+//w:
+//r: 3.2
+//
+#define qtn_netw_conset_popup_bearer_packet_data "Packet data"
+
+//d: Connection method list empty text. 
+//d: Shown if there are no connection methods
+//l: main_pane_empty_t1/opt2
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_empty_method_view_primary "No connection methods"
+
+//d: Connection method list empty text. Second line in the list item if
+//d: no connection methods exist. Indicates how to create one.
+//l: main_list_empty_pane/opt2
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_empty_method_view_secondary "Select Add connection method from Options menu to define a method "
+
+//d: radio button popup menu title text
+//l: list_setting_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_sett_destination "Network connection"
+
+//d: radio button popup menu title text
+//l: list_set_graphic_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_sett_always_ask "Always ask"
+
+
+//d: radio button popup menu title text
+//l: list_setting_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_default_connection_title "Default connection"
+
+//d: radio button popup menu text
+//l: list_set_graphic_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_sett_ask_once "Ask Once"
+
+//d: radio button popup menu text
+//l: list_set_graphic_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_sett_default_connection "Default Connection"
+
+//d: radio button popup menu text
+//l: list_set_graphic_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_sett_user_defined "User Defined"
+
+//d: radio button popup options menu text
+//l: list_single_pane_t1_cp2
+//w: 
+//r: 3.2
+//
+#define qtn_set_cmd_select "Select"
+
+//d: popup options menu text
+//l: list_single_pane_t1_cp2
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_options_select_method "Choose connection method"
+
+//d: First line of a double large graphic style listbox - WLAN specific
+//l: list_double_large_graphic_pane_t1_cp2
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_bearer_available_wlan "Wireless LAN"
+
+//d: Second line of a double large graphic style listbox - WLAN specific
+//l: list_double_large_graphic_pane_t2_cp2
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_one_wlan_nw_available "1 network available"
+
+//d: Second line of a double large graphic style listbox - WLAN specific
+//l: list_double_large_graphic_pane_t2_cp2
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_many_wlan_nw_available "%N networks available"
+
+//-----------------------------------------------------------------------------
+// Status Pane
+//-----------------------------------------------------------------------------
+
+//d: Connection method view. Indicates that there is one connection method 
+//d: in the current destination
+//l: navi_text_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_navi_one_conn_method "1 conn. method"
+
+//d: Connection method view. Indicates the number of connection methods 
+//d: in the current destination
+//l: navi_text_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_navi_many_conn_methods "%N conn. methods"
+
+//-----------------------------------------------------------------------------
+// Soft Keys
+//-----------------------------------------------------------------------------
+
+//d: Middle soft key whose action is to start the wizard for adding 
+//d: a connection method from the connection method view
+//d: 
+//l: control_pane_t3/opt7
+//w: 
+//r: 3.2
+//
+#define qtn_msk_add_method "Add method"
+
+//-----------------------------------------------------------------------------
+// Strings used in dialogs
+//-----------------------------------------------------------------------------
+
+//d: Confirmation query used to ask the user if he/she wants to check for
+//d: available connection methods automatically.
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_quest_check_conn_methods "Automatically check for available connection methods?"
+
+//d: String used to inform user what is going on while the dialog is displayed.
+//l: popup_note_wait_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_wait_checking_methods "Checking connection methods..."
+
+//d: Question asked from the user when automatic configuration has failed. User
+//d: must answer if he/she wants to proceed with manual configuration.
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_quest_conf_method_manually "Could not automatically detect availability. Do you want to configure manually?"
+
+//d: Title of "Available methods:" list query.
+//l: heading_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_prmpt_available_methods "Available methods:"
+
+//d: Title of "Select connection method:" list query.
+//l: heading_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_prmpt_select_conn_method "Select connection method:"
+
+//d: Title of "Select destination:" list query.
+//l: heading_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_prmpt_add_to_destination "Select destination:"
+
+//d: Heading text used in "Select destination:" list query.
+//l: loc_type_pane
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_detail_add_to_destination "What destination or service you want to access via this method?"
+
+//d: Text of an information note used to ensure the user the a new connection
+//d: method has been added successfully.
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_conf_new_method_added "New connection method for '%U' added"
+
+//d: Text of an information note used to ensure the user the a new destination
+//d: has been created successfully.
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_conf_new_dest_added "New destination '%U' created"
+
+//d: Confirmation query text shown when user enters empty Conn methods view.
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_quest_add_method "No connection methods for '%U' defined. Define one now?"
+
+//d: Warning about having no destinations in Destinations view when trying to
+//d: create a new connection method.
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_info_no_destinations "No destinations defined. Create one first."
+
+//d: Warning about having no unprotected destinations in Destinations view when trying to
+//d: create a new connection method.
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_new_conset_info_cannot_add_all_dest_protected "Unable to add to any existing destination. All destinations are protected. Create a new one."
+
+//d: Warning shown when user tries to prioritise a conn. method 'over' an embedded destination
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_info_prio_not_possible "Priority not possible"
+
+
+//d: Text of an information note used to ensure the user the a new default destination
+//d: has been set successfully.
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+
+#define qtn_netw_conset_default_connection_set_to "Default connection set to '%U'"
+
+//d: Text of an information note used to ensure the user the new default destination
+//d: has been set successfully when it is set to always ask
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_conf_default_always_ask "Default connection set to 'Always Ask'"
+
+//d: Text of an information note used to ensure the user the new default destination
+//d: has been set successfully when it is set to ask once
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_conf_default_ask_once "Default connection set to 'Ask Once'"
+
+//=============================================================================
+// FRAMEWORK BASE STRINGS
+//=============================================================================
+
+//d: The name of a Internet destination. Max.30 chars, 
+//d: longer ones will be truncated.
+//l: list_double_large_graphic_pane_t1_cp2
+//w:
+//r: 3.2
+//
+#define qtn_netw_conset_dest_internet "Internet"
+
+//d: The name of a "WAP services" destination. Max.30 chars, 
+//d: longer ones will be truncated.
+//l: list_double_large_graphic_pane_t1_cp2
+//w:
+//r: 3.2
+//
+#define qtn_netw_conset_dest_wap "WAP services"
+
+//d: The name of a "Multimedia message" destination. Max.30 chars, 
+//d: longer ones will be truncated.
+//l: list_double_large_graphic_pane_t1_cp2
+//w:
+//r: 3.2
+//
+#define qtn_netw_conset_dest_mms "Multimedia message"
+
+//d: The name of a "Intranet" destination. Max.30 chars, 
+//d: longer ones will be truncated.
+//l: list_double_large_graphic_pane_t1_cp2
+//w:
+//r: 3.2
+//
+#define qtn_netw_conset_dest_intranet "Intranet"
+
+//=============================================================================
+// PLUGIN BASE STRINGS
+//=============================================================================
+
+//d: Item text in setting list.
+//d: The name of the connection
+//l: list_setting_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_set_ap_conn_name "Connection name"
+
+//d: Name of the data bearer.
+//d: Used in Connection method view.
+//l: list_setting_pane_t1
+//w:
+//r: 3.2
+//
+#define qtn_set_ap_bearer "Data bearer"
+
+//d: Command in options menu in access points view.
+//d: Modifies the currently selected access point.
+//l: list_single_pane_t1_cp2
+//w:
+//r: 3.2
+//
+#define qtn_set_options_change "Change"
+
+
+//d: Command in options menu in access points view.
+//d: Opens advanced settings for the access point.
+//l: list_single_pane_t1_cp2
+//w:
+//r: 3.2
+//
+#define qtn_set_options_ap_advanced "Advanced settings"
+
+//d: Command in options menu.
+//d: Opens help application with context sensitive help.
+//l: list_single_pane_t1_cp2
+//w:
+//r: 3.2
+//
+#define qtn_set_options_help "Help"
+
+
+//d: Command in options menu.
+//d: Exits access point settings.
+//l: list_single_pane_t1_cp2
+//w:
+//r: 3.2
+//
+#define qtn_set_options_exit "Exit"
+
+
+//d: Setting list item text.
+//l: list_setting_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_sett_roaming_confirmation "Utilise this method"
+
+//d: Setting list item text shown if automatic roaming is selected.
+//l: list_set_graphic_pane_t1
+//w: 
+//r: 3.2
+//
+
+#define qtn_netw_conset_sett_roaming_automatic "Automatically"
+
+//d: Setting list item text shown if confirmation takes place upon roaming.
+//l: list_set_graphic_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_sett_roaming_confirm "After confirmation"
+
+//d: Bearer type cannot be modified info text 
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_info_bearer_not_editable "Unable to edit data bearer type once selected. Define a new connection method."
+
+//d:Item text in setting list for password.
+//l:list_setting_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_set_ap_passwd "Password"
+
+//
+//SMTP Settings
+ 
+//d: Setting list item text to access smtp settings.
+//l: list_double2_pane
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_sett_smtp_override "Outgoing mail server settings"
+
+//d: SMTP outgoing mail server setting text
+//l: list_setting_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_mce_settings_mail_sending_h "Outgoing mail server"
+
+//d: Error note for when invalid server/IP data is input
+//d: in relation to the Outgoing mail server setting
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_mbxs_settings_mail_srvr_prompt "Please, insert proper server name."
+
+//d: SMTP User name setting text
+//l: list_setting_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_mce_settings_mail_user_name "User name"
+
+//d: SMTP Password setting text
+//l: list_setting_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_mce_settings_mail_password "Password"
+
+//d: SMTP Security setting text
+//l: list_setting_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_mce_settings_mail_security "Security"
+
+//d: Security setting is set to 'on' with Start TLS
+//l: list_set_graphic_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_mbxs_settings_mail_sec_starttls "STARTTLS"
+
+//d: Security setting is set to 'on' with SSL TLS
+//l: list_set_graphic_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_mbxs_settings_mail_sec_ssltls "SSL/TLS"
+
+//d: Security setting set to 'off'
+//l: list_set_graphic_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_mbxs_settings_mail_sec_off "Off"
+
+//d: SMTP Port number setting text
+//l: list_setting_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_mce_settings_mail_port "Port"
+
+//d: SMTP Port number setting to 'default'
+//l: list_set_graphic_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_mbxs_settings_mail_port_def "Default"
+
+//d: SMTP Port number setting to 'User defined'
+//l: list_set_graphic_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_mbxs_settings_mail_port_userdef "User defined"
+
+//d: Note after the last legacy IAP from "Uncategorized" group
+//d: is deleted
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_info_uncat_empty "Uncategorized folder is empty and will be removed"
+
+//d: The name of a new, default connection. Max.30 chars, 
+//d: longer ones will be truncated.
+//l: list_set_graphic_pane_t1
+//w:
+//r: 3.2
+//
+#define qtn_set_ap_default_name "Connection"
+
+//d: Error message when user wants to delete a connection method that is 
+//d: linked to a virtual connection method.
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_info_cannot_delete_virtual_ref "Unable to delete referenced method"
+
+//d: Item text in setting list.
+//l: list_setting_pane_t1
+//w:
+//r: 3.2
+//
+#define qtn_set_starting_page "Homepage"
+
+//d: Connection method list text
+//l: list_set_graphic_pane_t1
+//w:
+//r: 3.2
+//
+#define qtn_set_home_page_none "None"
+
+//d: Invalid ip address note text
+//l: popup_note_window
+//w:
+//r: 3.2
+//
+#define qtn_set_info_invalid_ip "Invalid IP address"
+
+//d: Connection method settings query text 
+//d: displayed when there are empty compulsory settings 
+//d: and user presses 'back' from settings view 
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_quest_iap_incomplete_delete "Incomplete access point details. Exit without saving?"
+
+//d:Domain name servers 'User defined'
+//l:list_set_graphic_pane_t1
+//w:
+//r:3.2
+#define qtn_set_ip_user_defined "User defined"
+
+//d:Item text in setting list. Offers IPv4 settings to be changed
+//l:list_setting_pane_t1
+//w:
+//r:3.2
+//
+#define  qtn_set_ipv4_settings "IPv4 settings"
+
+//d:Item text in setting list. Offers IPv6 settings to be changed
+//l:list_setting_pane_t1
+//w:
+//r:3.2
+//
+#define  qtn_set_ipv6_settings "IPv6 settings"
+
+//d:Item text in setting list. "Phone IP address"
+//l:list_setting_pane_t1 
+//w:
+//r:3.2
+//
+#define qtn_set_ip_address "Phone IP address"
+
+//d:Default value for "Phone ip address" item. 'Automatic'
+//l:list_set_graphic_pane_t1
+//w:
+//r:3.2
+#define qtn_set_ip_address_dynamic "Automatic"
+
+//d:Item text in setting list.
+//l:list_setting_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_set_primary_dns "Primary Name Server"
+
+//d:Item text in setting list.
+//l:list_setting_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_set_secondary_dns "Secondary Name Server"
+
+//d:Item text in setting list. "Proxy server address"
+//l:list_setting_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_set_proxy_server_address "Proxy server address"
+
+//d: Proxy server address 'None'
+//l: list_set_graphic_pane_t1
+//w:
+//r: 3.2
+//
+#define qtn_set_proxy_server_address_none "None"
+
+//d: Item text in setting list  for Proxy port number
+//l:list_setting_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_set_proxy_port_number "Proxy port number"
+
+//d:Item text in setting list. Entrance for the Domain name servers settings
+//l:list_setting_pane_t1
+//w:
+//r:3.2
+//
+#define  qtn_set_dns_servers_ip "Domain name servers"
+
+//d:Domain name servers 'Automatic'
+//l:list_set_graphic_pane_t1
+//w:
+//r:3.2
+#define qtn_set_dns_servers_automatic "Automatic"
+
+//d:Domain name servers 'Well-known'
+//l:list_set_graphic_pane_t1
+//w:
+//r:3.2
+#define qtn_set_ip_well_known "Well-known"
+
+//d: Item text in setting list. "User name"
+//l: list_set_graphic_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_set_ap_username "User name"
+
+//d: Answer to: qtn_set_passwd_aut,
+//d: whether password authentication is secure or normal
+//l: list_set_graphic_pane_t1
+//w:
+//r: 3.2
+//
+#define qtn_set_passwd_aut_secure "Secure"
+
+//d: Answer to: qtn_set_passwd_aut,
+//d: whether password authentication is secure or normal
+//l: list_set_graphic_pane_t1
+//w:
+//r: 3.2
+//
+#define qtn_set_passwd_aut_normal "Normal"
+
+//d: Item text for empty user name in setting list
+//l: list_set_graphic_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_set_ap_username_none "None"
+
+//d: Item text in setting list. "Prompt password"
+//l: list_setting_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_set_prompt_passwd "Prompt password"
+
+//d: Item text in setting list for not prompting for password.
+//l: list_set_graphic_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_set_prompt_passwd_no "No"
+
+//d: Item text in setting list for prompting for password.
+//l: list_set_graphic_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_set_prompt_passwd_yes "Yes"
+
+//d: Item text in setting list.
+//d: Indicates whther password authentication is secure or normal
+//l: list_setting_pane_t1
+//w:
+//r: 3.2
+//
+#define qtn_set_passwd_aut "Authentication"
+
+//d:Defines the WLAN subnet mask to be used
+//l:list_setting_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_netw_sett_subnet_mask "Subnet mask"
+
+//d:Defines the WLAN default gateway to be used
+//l:list_setting_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_netw_sett_default_gateway "Default gateway"
+
+//d: Error note when user tries to delete a destination 
+//d: which contains one or more protected connection methods
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_info_cannot_delete_dest_prot_cm "Unable to delete destination; contains protected connection methods."
+
+//d: Denied execution of management-like functions on protected destinations info text
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_info_cannot_perform_for_protected "Unable to perform due to protection"
+
+//d: No existing unprotected destinations to add to info text
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_info_cannot_add_all_dest_protected "Unable to add to any existing destination. Destinations are protected. Create a new one."
+
+//d: VPN CM (re)placement failure (due to circular referencing) info text
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_info_no_vpn_stacking "Unable to proceed. VPN connections cannot be stacked."
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/Group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2006-2008 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 Plugins \ Connection Method manager
+*
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+// None
+
+PRJ_MMPFILES
+// None
+
+
+#include "../cmpluginpacketdata/group/bld.inf"
+#include "../cmpluginlan/group/bld.inf"
+#include "../cmpluginwlan/group/bld.inf"
+#include "../cmpluginembdestination/group/bld.inf"
+#include "../cmpluginvpn/group/bld.inf"
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginembdestination/data/1020737D.rss	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,46 @@
+/*
+* 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:  Embedded Destination Plug-in resource file
+*
+*/
+
+#include "ecom/registryinfo.rh"
+
+// Because attribute enums had to be added to namespace CMManager
+// it's not possible to included cmpluginpacketdata.hrh.
+// Thus bearer type id had to be redefine here.
+#define KEmbeddedDestination  0x10207379
+
+RESOURCE REGISTRY_INFO theInfo
+	{
+	dll_uid = 0x1020737D;
+	interfaces = 
+		{
+		INTERFACE_INFO
+			{
+			interface_uid = 0x10207377; // = KCMPluginInterfaceUid
+			implementations = 
+				{
+				IMPLEMENTATION_INFO
+					{
+					implementation_uid = KEmbeddedDestination;
+					version_no = 1;
+					display_name = "Embedded Destination";
+					default_data = "EmbeddedDestination";
+					opaque_data = "";
+					}
+				};
+			}
+		};
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginembdestination/data/cmpluginembdestinationui.rss	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,33 @@
+/*
+* 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:  Embedded Destination plug-in's UI resources
+*
+*/
+
+#include <avkon.rsg>
+#include <avkon.rh>	
+#include <avkon.loc>
+#include <uikon.rh>
+#include <eikon.rh>
+#include "eikon.rsg"
+#include <AvkonIcons.hrh>
+
+NAME    EDES
+
+RESOURCE RSS_SIGNATURE { }
+
+RESOURCE TBUF { buf = "cmpluginembdestination"; }
+
+
+// LOCALISED STRINGS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginembdestination/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006-2008 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 Embedded Destination plug-in.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+./cmpluginembdestination.mmp
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginembdestination/group/cmpluginembdestination.mmp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,66 @@
+/*
+* 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:  Project specification for Embedded Destination plug-in
+*
+*/
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+TARGET      cmpluginembdestination.dll
+UID         0x10009D8D 0x1020737D
+
+TARGETTYPE		PLUGIN
+
+CAPABILITY      CAP_ECOM_PLUGIN
+VENDORID        VID_DEFAULT
+
+SOURCEPATH  ../src
+
+SOURCE      cmpluginembdestinationproxy.cpp
+SOURCE      cmpluginembdestination.cpp
+SOURCE      ../../../Framework/Src/cmlogger.cpp
+
+SOURCEPATH  ../data
+
+START RESOURCE 1020737D.rss
+TARGET cmpluginembdestination.rsc
+END
+
+START RESOURCE cmpluginembdestinationui.rss
+HEADER
+TARGETPATH   RESOURCE_FILES_DIR
+LANGUAGE_IDS
+END
+
+USERINCLUDE     ../../../Framework/Inc
+
+// Component specific internal headers 
+USERINCLUDE			../inc
+
+// ADO specific internal headers 
+SYSTEMINCLUDE		../../../../../inc
+
+//Macro to /epoc32 headers
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY euser.lib
+LIBRARY	ECOM.LIB
+LIBRARY cmmanager.lib
+LIBRARY COMMSDAT.lib
+LIBRARY	CommonEngine.lib
+LIBRARY cone.lib
+LIBRARY efsrv.lib
+LIBRARY bafl.lib
+DEBUGLIBRARY flogger.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginembdestination/inc/cmpluginembdestination.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,122 @@
+/*
+* 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 CCmPluginEmbDestination
+*
+*/
+
+#ifndef EMBEDDEDDESTINATION_PLUGIN_H
+#define EMBEDDEDDESTINATION_PLUGIN_H
+
+#include <cmpluginbaseeng.h>
+#include <cmpluginembdestinationdef.h>
+
+/**
+ *  Embedded Destination Plugin IF implementation class
+ *
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS(CCmPluginEmbDestination) : public CCmPluginBaseEng
+    {
+    public:     // Constructors and destructor
+
+        /**
+        * Two phased constructor. Leaves on failure.
+        * @param - aInitParam initialization parameters for plug-ins.
+        * @return The created object.
+        */      
+        static CCmPluginEmbDestination* NewL( TCmPluginInitParam* aInitParam );
+
+        /**
+        * Destructor.
+        */      
+        virtual ~CCmPluginEmbDestination();
+
+        virtual CCmPluginBaseEng* CreateInstanceL( 
+                                        TCmPluginInitParam& aInitParam ) const;
+
+    public: // From CCmPluginBaseEng
+
+        virtual TUint32 GetIntAttributeL( const TUint32 aAttribute ) const;
+        virtual TBool GetBoolAttributeL( const TUint32 aAttribute ) const;
+        virtual HBufC* GetStringAttributeL( const TUint32 aAttribute ) const;
+        virtual HBufC8* GetString8AttributeL( const TUint32 aAttribute ) const;
+        virtual void SetBoolAttributeL( const TUint32 aAttribute, 
+                                        TBool aValue );
+        virtual void SetStringAttributeL( const TUint32 aAttribute, 
+                                          const TDesC16& aValue );
+        virtual void UpdateL();
+        virtual CCmDestinationImpl* Destination() const;
+
+        virtual TBool CanHandleIapIdL( TUint32 aIapId ) const;
+        virtual TBool CanHandleIapIdL( CommsDat::CCDIAPRecord *aIapRecord ) const;
+
+        virtual TBool DeleteL( TBool aForced,
+                               TBool aOneRefAllowed = ETrue );
+        virtual void LoadL( TUint32 aIapId );
+        virtual void CreateNewL();
+
+        virtual TInt RunSettingsL();
+
+        /**
+        * From CCmPluginBaseEng
+        * see base class definition
+        *
+        * @since S60 3.2
+        */
+        virtual TBool InitializeWithUiL( TBool aManuallyConfigure );
+
+        virtual TBool IsMultipleReferencedL();
+
+        virtual void LoadServiceSettingL();
+        virtual void LoadBearerSettingL();
+
+        virtual void ServiceRecordIdLC( HBufC* &aServiceName, 
+                                        TUint32& aRecordId );
+
+        virtual void BearerRecordIdLC( HBufC* &aBearerName, 
+                                       TUint32& aRecordId);
+
+        virtual void AdditionalReset(){};
+
+        virtual CCmPluginBaseEng* CreateCopyL() const;
+        
+        virtual TBool IsLinkedToSnap( TUint32 aSnapId );
+
+    private: // Constructors
+
+        /**
+        * Constructor.
+        */      
+        CCmPluginEmbDestination( TCmPluginInitParam* aInitParam );
+
+        /**
+        * Second phase constructor. Leaves on failure.
+        * @param
+        */      
+        void ConstructL();
+
+    private: // From CCmPluginBaseEng
+
+        virtual void CreateNewServiceRecordL();
+        virtual void CreateNewBearerRecordL();
+        virtual void CopyAdditionalDataL( CCmPluginBaseEng* aDestInst ) const;
+
+    private: // Data
+
+        CCmDestinationImpl* iDestination;
+        TInt                iLoadResult;
+        TUint32             iCmId;
+	};
+
+#endif // EMBEDDEDDESTINATION_PLUGIN_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginembdestination/src/cmpluginembdestination.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,624 @@
+/*
+* 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 CCmPluginEmbDestination
+*
+*/
+
+#include "cmdestinationimpl.h"
+#include "cmpluginembdestination.h"
+#include "datamobilitycommsdattypes.h"
+#include "cmmanagerimpl.h"
+#include "cmlogger.h"
+#include <ecom/ecom.h>		// For REComSession
+#include <StringLoader.h>
+#include <cmpluginembdestinationui.rsg>
+#include <data_caging_path_literals.hrh>
+#include <cmmanager.rsg>
+#include <bautils.h>
+
+using namespace CMManager;
+using namespace CommsDat;
+
+_LIT( KPluginEmbDestinationDataResDirAndFileName, 
+      "z:cmpluginembdestinationui.rsc" );
+
+// ---------------------------------------------------------------------------
+// CCmPluginEmbDestination::NewL()
+// ---------------------------------------------------------------------------
+//
+CCmPluginEmbDestination* CCmPluginEmbDestination::NewL( 
+                                                TCmPluginInitParam* aInitParam )
+	{
+	CCmPluginEmbDestination* self = 
+	                        new( ELeave ) CCmPluginEmbDestination( aInitParam );
+	CleanupStack::PushL( self );
+	self->ConstructL();
+	CleanupStack::Pop( self );
+
+	return self;
+	}
+
+// ---------------------------------------------------------------------------
+// CCmPluginEmbDestination::~CCmPluginEmbDestination()
+// ---------------------------------------------------------------------------
+//
+CCmPluginEmbDestination::~CCmPluginEmbDestination()
+	{
+	RemoveResourceFile( KPluginEmbDestinationDataResDirAndFileName );
+	
+    if(iDestination)
+        {
+        delete iDestination;
+        iDestination = NULL;
+        }	
+	
+	CLOG_CLOSE;
+	}
+
+// ----------------------------------------------------------------------------
+// CCmPluginEmbDestination::CreateInstanceL
+// ----------------------------------------------------------------------------
+//
+CCmPluginBaseEng* 
+    CCmPluginEmbDestination::CreateInstanceL( TCmPluginInitParam& aInitParam ) const
+    {
+    CCmPluginEmbDestination* self = new( ELeave ) CCmPluginEmbDestination( &aInitParam );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmPluginEmbDestination::CCmPluginEmbDestination()
+// ---------------------------------------------------------------------------
+//
+CCmPluginEmbDestination::CCmPluginEmbDestination( 
+                                                TCmPluginInitParam* aInitParam )
+    : CCmPluginBaseEng( aInitParam )
+	{
+	CLOG_CREATE;
+	
+	iBearerType = KUidEmbeddedDestination;
+	}
+
+// ---------------------------------------------------------------------------
+// CCmPluginEmbDestination::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CCmPluginEmbDestination::ConstructL()
+	{
+	// Nothing is needed from CCmPluginBaseEng.
+	AddResourceFileL( KPluginEmbDestinationDataResDirAndFileName );
+	}
+	
+// ---------------------------------------------------------------------------
+// CCmPluginEmbDestination::GetIntAttributeL()
+// ---------------------------------------------------------------------------
+//
+TUint32 
+    CCmPluginEmbDestination::GetIntAttributeL( const TUint32 aAttribute ) const
+	{
+    LOGGER_ENTERFN( "CCmPluginEmbDestination::GetIntAttributeL" );
+
+	TUint32 retVal( 0 );
+	
+    switch( aAttribute )
+        {
+        case ECmBearerType:
+            {
+            retVal = iBearerType;
+            }
+            break;
+            
+        case ECmId: 
+            {
+            retVal = iCmId;
+            }
+            break;
+        
+        case ECmIapId:
+            {
+            User::Leave(KErrNotSupported);
+            }
+            break;
+        
+        case ECmBearerIcon:
+            {
+            retVal = (TUint32)iDestination->IconL();    
+            }
+            break;
+            
+        case ECmDefaultPriority:
+        case ECmDefaultUiPriority:
+            {
+            retVal = KDataMobilitySelectionPolicyPriorityWildCard;
+            }
+            break;
+            
+        case ECmExtensionLevel:
+            {
+            retVal = KExtensionBaseLevel;
+            }
+            break;
+            
+        case ECmInvalidAttribute:
+            {
+            retVal = 0;
+            }
+            break;
+
+        case ECmLoadResult:
+            {
+            retVal = iLoadResult;
+            }
+            break;
+            
+        default:
+            {
+            User::Leave( KErrNotSupported );
+            }
+            break;
+        }
+    
+    return retVal;
+	}
+
+// ---------------------------------------------------------------------------
+// CCmPluginEmbDestination::GetBoolAttributeL()
+// ---------------------------------------------------------------------------
+//
+TBool CCmPluginEmbDestination::GetBoolAttributeL( const TUint32 aAttribute ) const
+	{
+    LOGGER_ENTERFN( "CCmPluginEmbDestination::GetBoolAttributeL" );
+
+	TBool retVal( EFalse );
+
+    switch( aAttribute )
+        {
+        case ECmDestination:
+            {
+            retVal = ETrue;
+            }
+            break;
+            
+        case ECmCoverage:
+            {
+            retVal = EFalse;
+            }
+            break;
+            
+        case ECmProtected:
+            {
+            if( iDestination->ProtectionLevel() == EProtLevel1 ||
+                iDestination->ProtectionLevel() == EProtLevel2 )
+                {
+                retVal = ETrue;
+                }
+            else
+                {
+                retVal = EFalse;
+                }
+            }
+            break;
+            
+        case ECmHidden:
+            {
+            retVal = iDestination->IsHidden();
+            }
+            break;
+            
+        case ECmBearerHasUi:
+        case ECmAddToAvailableList:
+            {
+            retVal = EFalse;
+            }
+            break;
+
+        case ECmVirtual:
+            {
+            retVal = ETrue;
+            }
+            break;
+
+        case ECmIPv6Supported:
+            {
+            retVal = CCmPluginBaseEng::GetBoolAttributeL( aAttribute );
+            }
+            break;
+
+        case ECmIsLinked:
+            {
+            retVal = EFalse;
+            }
+            break;
+                        
+        case ECmConnected:
+            {
+            retVal = iDestination->IsConnectedL();
+            }
+            break;
+            
+        default:
+            {
+            User::Leave( KErrNotSupported );
+            }
+            break;
+        }
+        
+    return retVal;
+	}
+
+// ---------------------------------------------------------------------------
+// CCmPluginEmbDestination::GetStringAttributeL()
+// ---------------------------------------------------------------------------
+//
+HBufC* 
+  CCmPluginEmbDestination::GetStringAttributeL( const TUint32 aAttribute ) const
+	{
+    LOGGER_ENTERFN( "CCmPluginEmbDestination::GetStringAttributeL" );
+
+    HBufC* retVal = NULL;
+
+    switch( aAttribute )
+        {
+        case ECmName:
+    	    {
+            RFs fs;
+            CleanupClosePushL<RFs>( fs );
+            User::LeaveIfError( fs.Connect() );
+
+            // There may not be a UI context yet....
+            TFileName resourceFile;
+            _LIT( KDriveZ, "z:" );
+            resourceFile.Append( KDriveZ );
+            resourceFile.Append( KDC_RESOURCE_FILES_DIR );
+            _LIT( KCmmResFileName, "cmmanager.rsc" );
+            resourceFile.Append( KCmmResFileName );
+            BaflUtils::NearestLanguageFile( fs, resourceFile );
+
+            RResourceFile rf;
+            CleanupClosePushL<RResourceFile>( rf );
+            rf.OpenL( fs, resourceFile );
+            rf.ConfirmSignatureL( 0 );
+            HBufC8* readBuffer = rf.AllocReadLC( R_QTN_NETW_CONSET_EMBEDDED_DEST );
+            const TPtrC16 ptrReadBuffer( (TText16*) readBuffer->Ptr(),
+                                         ( readBuffer->Length() + 1 ) >> 1 );
+            HBufC16* textBuffer=HBufC16::NewL( ptrReadBuffer.Length() );
+            CleanupStack::PushL( textBuffer );
+            *textBuffer=ptrReadBuffer;
+    
+            TPtr format = textBuffer->Des();
+            _LIT(KPercentS,"%S");
+            _LIT(KPercentU,"%U");
+            TInt puPos = format.Find(KPercentU);
+            if ( puPos >= 0 )
+                {
+                format.Replace( puPos, 
+                    static_cast<TDesC>(KPercentS).Length(), KPercentS );                
+                }
+            HBufC* desName = iDestination->NameLC();
+            TPtr16 destName = desName->Des();
+            retVal = HBufC::NewL( format.Length() + destName.Length() );
+            retVal->Des().Format(format,  &destName);
+
+            CleanupStack::PopAndDestroy( desName ); 
+            CleanupStack::PopAndDestroy( textBuffer ); 
+            CleanupStack::PopAndDestroy( readBuffer ); 
+            CleanupStack::PopAndDestroy(); //rf
+            CleanupStack::PopAndDestroy(); //fs
+            }
+    	    break;
+    	    
+    	default:
+    	    {
+    	    User::Leave( KErrNotSupported );
+    	    }
+        }
+    
+    return retVal;
+	}
+
+// ---------------------------------------------------------------------------
+// CCmPluginEmbDestination::GetString8AttributeL
+// ---------------------------------------------------------------------------
+//
+HBufC8* 
+    CCmPluginEmbDestination::GetString8AttributeL( const TUint32 aAttribute ) const
+    {
+    LOGGER_ENTERFN( "CCmPluginEmbDestination::GetString8AttributeL" );
+
+    switch( aAttribute )
+        {
+        default:
+            {
+            User::Leave( KErrNotSupported );
+            }
+            break;
+        }
+        
+    // dead code
+    return NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginEmbDestination::SetBoolAttributeL()
+// ---------------------------------------------------------------------------
+//
+void CCmPluginEmbDestination::SetBoolAttributeL( const TUint32 aAttribute, 
+                                                 TBool /*aValue*/ )
+	{
+    LOGGER_ENTERFN( "CCmPluginEmbDestination::SetBoolAttributeL" );
+
+    switch( aAttribute )
+        {
+        case ECmProtected:
+        case ECmHidden:
+            break;
+                    
+        default:
+            {
+            User::Leave( KErrNotSupported );
+            }
+        }
+	}
+
+// ---------------------------------------------------------------------------
+// CCmPluginEmbDestination::SetStringAttributeL()
+// ---------------------------------------------------------------------------
+//
+void CCmPluginEmbDestination::SetStringAttributeL( const TUint32 aAttribute, 
+                                                   const TDesC16&  )
+	{
+    LOGGER_ENTERFN( "CCmPluginEmbDestination::SetStringAttributeL" );
+
+    switch( aAttribute )
+        {
+        case ECmName:
+            {
+            User::Leave( KErrNotSupported );
+            }
+            break;
+            
+        default:
+            {
+            User::Leave( KErrNotSupported );
+            }
+        }
+	}
+
+// ---------------------------------------------------------------------------
+// CCmPluginEmbDestination::CanHandleIapIdL()
+// ---------------------------------------------------------------------------
+//
+TBool CCmPluginEmbDestination::CanHandleIapIdL( TUint32 /*aIapId*/ ) const
+    {
+    LOGGER_ENTERFN( "CCmPluginEmbDestination::CanHandleIapIdL" );
+
+    // Embedded Destination cannot handle any IAP id.
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginEmbDestination::CanHandleIapIdL()
+// ---------------------------------------------------------------------------
+//
+TBool 
+  CCmPluginEmbDestination::CanHandleIapIdL( CCDIAPRecord* /*aIapRecord*/ ) const
+    {
+    LOGGER_ENTERFN( "CCmPluginEmbDestination::CanHandleIapIdL" );
+
+    // Embedded Destination cannot handle any IAP id.
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+CCmDestinationImpl* CCmPluginEmbDestination::Destination() const
+    {
+    LOGGER_ENTERFN( "CCmPluginEmbDestination::Destination" );
+
+    return iDestination;
+    }
+    
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+void CCmPluginEmbDestination::UpdateL()
+    {
+    LOGGER_ENTERFN( "CCmPluginEmbDestination::UpdateL" );
+
+    iDestination->UpdateL();
+    }
+
+// ---------------------------------------------------------------------------
+// Delete embedded destination.
+// ---------------------------------------------------------------------------
+//
+TBool CCmPluginEmbDestination::DeleteL( TBool aForced, 
+                                        TBool aOneRefAllowed )
+    {
+    LOGGER_ENTERFN( "CCmPluginEmbDestination::DeleteL" );
+    
+    (void)aForced;
+    (void)aOneRefAllowed;
+    
+    // Embedded destination cannot be deleted.
+    return EFalse;
+    }
+    
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+void CCmPluginEmbDestination::LoadL( TUint32 aCmId)
+    {
+    LOGGER_ENTERFN( "CCmPluginEmbDestination::LoadL" );
+
+    if (!iDestination)
+        {
+        iCmId = aCmId;
+        iDestination = iCmMgr.DestinationL( aCmId );        
+        }
+   }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+void CCmPluginEmbDestination::CreateNewL()
+    {
+    LOGGER_ENTERFN( "CCmPluginEmbDestination::CreateNewL" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginEmbDestination::RunSettingsL()
+// ---------------------------------------------------------------------------
+//        
+TInt CCmPluginEmbDestination::RunSettingsL()
+	{
+    LOGGER_ENTERFN( "CCmPluginEmbDestination::RunSettingsL" );
+
+    return 0;
+	}
+        
+// ---------------------------------------------------------------------------
+// CCmPluginEmbDestination::InitializeWithUiL()
+// ---------------------------------------------------------------------------
+//        
+TBool CCmPluginEmbDestination::InitializeWithUiL( 
+                                            TBool /*aManuallyConfigure*/ )
+    {
+    LOGGER_ENTERFN( "CCmPluginEmbDestination::InitializeWithUiL" );
+
+    // Has no UI
+    return ETrue;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginEmbDestination::IsMultipleReferencedL()
+// ---------------------------------------------------------------------------
+//        
+TBool CCmPluginEmbDestination::IsMultipleReferencedL()
+	{
+    LOGGER_ENTERFN( "CCmPluginEmbDestination::IsMultipleReferencedL" );
+
+	return EFalse;
+	}
+	
+// ---------------------------------------------------------------------------
+// CCmPluginEmbDestination::LoadServiceSettingL()
+// ---------------------------------------------------------------------------
+//        
+void CCmPluginEmbDestination::LoadServiceSettingL()
+    {
+    LOGGER_ENTERFN( "CCmPluginEmbDestination::LoadServiceSettingL" );
+    
+    User::Leave( KErrNotSupported );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmPluginEmbDestination::LoadBearerRecordL()
+// ---------------------------------------------------------------------------
+//        
+void CCmPluginEmbDestination::LoadBearerSettingL()
+    {
+    LOGGER_ENTERFN( "CCmPluginEmbDestination::LoadBearerSettingL" );
+    
+    User::Leave( KErrNotSupported );
+    }
+	
+// ---------------------------------------------------------------------------
+// CCmPluginEmbDestination::CreateNewServiceRecordL()
+// ---------------------------------------------------------------------------
+//        
+void CCmPluginEmbDestination::CreateNewServiceRecordL()
+    {
+    LOGGER_ENTERFN( "CCmPluginEmbDestination::CreateNewServiceRecordL" );
+    
+    User::Leave( KErrNotSupported );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmPluginEmbDestination::CreateNewBearerRecordL()
+// ---------------------------------------------------------------------------
+//        
+void CCmPluginEmbDestination::CreateNewBearerRecordL()
+    {
+    LOGGER_ENTERFN( "CCmPluginEmbDestination::CreateNewBearerRecordL" );
+
+    User::Leave( KErrNotSupported );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmPluginEmbDestination::ServiceRecordIdLC()
+// ---------------------------------------------------------------------------
+//        
+void CCmPluginEmbDestination::ServiceRecordIdLC( HBufC* &/*aBearerName*/, 
+                                                TUint32& /*aRecordId*/)
+    {
+    LOGGER_ENTERFN( "CCmPluginEmbDestination::ServiceRecordIdLC" );
+
+    User::Leave( KErrNotSupported );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmPluginEmbDestination::BearerRecordIdLC()
+// ---------------------------------------------------------------------------
+//        
+void CCmPluginEmbDestination::BearerRecordIdLC( HBufC* &/*aBearerName*/, 
+                                                TUint32& /*aRecordId*/)
+    {
+    LOGGER_ENTERFN( "CCmPluginEmbDestination::BearerRecordIdLC" );
+
+    User::Leave( KErrNotSupported );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginEmbDestination::CopyAdditionalDataL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginEmbDestination::CopyAdditionalDataL( CCmPluginBaseEng* /*aDestInst*/ ) const
+    {
+    LOGGER_ENTERFN( "CCmPluginEmbDestination::CopyAdditionalDataL" );
+
+    User::Leave( KErrNotSupported );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginEmbDestination::CreateCopyL
+// ---------------------------------------------------------------------------
+//
+CCmPluginBaseEng* CCmPluginEmbDestination::CreateCopyL() const
+    {
+    LOGGER_ENTERFN( "CCmPluginEmbDestination::CreateCopyL" );
+
+    User::Leave(KErrNotSupported);
+    return NULL;    
+    }
+    
+// ---------------------------------------------------------------------------
+// CCmPluginEmbDestination::IsLinkedToSnap
+// ---------------------------------------------------------------------------
+//
+TBool CCmPluginEmbDestination::IsLinkedToSnap( TUint32 aSnapId )
+    {
+    LOGGER_ENTERFN( "CCmPluginEmbDestination::IsLinkedToSnap" );
+
+    return ( aSnapId == iDestination->Id() );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginembdestination/src/cmpluginembdestinationproxy.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,36 @@
+/*
+* 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 Embedded Destination plug-in proxy table
+*
+*/
+
+#include <e32std.h>
+#include <ecom/implementationproxy.h>
+
+#include "cmpluginembdestination.h"
+
+// Exported proxy for instantiation method resolution
+// Define the interface UIDs
+const TImplementationProxy ImplementationTable[] = 
+	{
+	IMPLEMENTATION_PROXY_ENTRY( KUidEmbeddedDestination, 
+	                            CCmPluginEmbDestination::NewL)
+	};
+
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
+	{
+	aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+
+	return ImplementationTable;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginlan/data/1020737B.rss	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,49 @@
+/*
+* 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: 
+*     PacketData PlugIn's resource file
+*     
+*
+*/
+
+
+#include "ecom/registryinfo.rh"
+
+// Because attribute enums had to be added to namespace CMManager
+// it's not possible to included cmpluginlanbasedef.h
+// Thus bearer type id had to be redefine here.
+#define KUidLanBearerType  0x1020737A
+
+RESOURCE REGISTRY_INFO theInfo
+	{
+	dll_uid = 0x1020737B;
+	interfaces = 
+		{
+		INTERFACE_INFO
+			{
+			interface_uid = 0x10207377; // = KCMPluginInterfaceUid
+			implementations = 
+				{
+				IMPLEMENTATION_INFO
+					{
+					implementation_uid = KUidLanBearerType;
+					version_no = 1;
+					display_name = "Lan";
+					default_data = "Lan";
+					opaque_data = "";
+					}
+				};
+			}
+		};
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginlan/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2006-2008 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 LAN plugin.   
+*      
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+./cmpluginlan.mmp
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginlan/group/cmpluginlan.mmp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,61 @@
+/*
+* 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: 
+*      Project specification for LAN Plugin.   
+*      
+*
+*/
+
+#include <platform_paths.hrh>
+
+TARGET      cmpluginlan.dll
+UID         0x10009D8D 0x1020737B
+
+TARGETTYPE		PLUGIN
+
+CAPABILITY      CAP_ECOM_PLUGIN
+VENDORID        VID_DEFAULT
+
+SOURCEPATH  ../src
+
+SOURCE      cmpluginlanproxy.cpp
+SOURCE      cmpluginlan.cpp
+SOURCE      ../../../Framework/Src/cmlogger.cpp
+
+SOURCEPATH  ../data
+
+START RESOURCE 1020737B.rss
+TARGET cmpluginlan.rsc
+END
+
+USERINCLUDE     ../../../Framework/Inc
+
+// Component specific internal headers 
+USERINCLUDE			../inc
+
+// ADO specific internal headers 
+SYSTEMINCLUDE		../../../../../inc
+
+//Macro to /epoc32 headers
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY euser.lib
+LIBRARY	ECOM.LIB
+LIBRARY cmmanager.lib
+LIBRARY COMMSDAT.lib
+DEBUGLIBRARY flogger.lib
+
+// Temporary usega for icons
+LIBRARY AknSkins.lib
+LIBRARY efsrv.lib
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginlan/inc/cmpluginlan.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,105 @@
+/*
+* 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 Lan interface implementation 
+*      for "LAN" plugin
+*      
+*
+*/
+
+
+#ifndef LAN_PLUGIN_H
+#define LAN_PLUGIN_H
+
+// INCLUDES
+
+#include <cmpluginlandef.h>
+#include <cmpluginlanbase.h>
+
+#include <e32base.h>
+#include <eikdoc.h>
+#include <apparc.h>
+
+
+// FORWARD DECLARATION
+class CommsDat::CCDLANServiceRecord;
+
+// CLASS DECLARATION
+
+/**
+*  LAN Plugin IF implementation class
+*  @since Series60_3.2
+*/
+NONSHARABLE_CLASS(CCmPluginLan) : public CCmPluginLanBase
+    {
+
+    public:     // Constructors and destructor
+
+        /**
+        * Two phased constructor. Leaves on failure.
+        * @param - aUrl
+        * @return The created object.
+        */      
+		static CCmPluginLan* NewL( TCmPluginInitParam* aInitParam );
+
+        /**
+        * Destructor.
+        */      
+        virtual ~CCmPluginLan();
+
+        virtual CCmPluginBaseEng* CreateInstanceL( TCmPluginInitParam& aInitParam ) const;
+        
+    public: // From CCmPluginBaseEng
+
+		/**
+		* Gets the value for a TInt attribute.
+		* @param aAttribute Identifies the attribute to be retrived.
+        * @return contains the requested TInt attribute.
+		*/
+        virtual TUint32 GetIntAttributeL( const TUint32 aAttribute ) const;
+        
+        /**
+        * Checks if the plug-in can handle the given AP.
+        * @param aIapId IAPId of the AP to be checked
+        * @return ETrue if plug-in can handle the IAP
+        */
+        virtual TBool CanHandleIapIdL( TUint32 aIapId ) const;
+        
+        /**
+        * Checks if the plug-in can handle the given AP.
+        * @param aIapRecord IAP record to be checked
+        * @return ETrue if plug-in can handle the IAP
+        */
+        virtual TBool CanHandleIapIdL( CommsDat::CCDIAPRecord* aIapRecord ) const;
+
+        virtual void AdditionalReset();
+        
+    private: // Constructors
+
+        /**
+        * Constructor.
+        */      
+		CCmPluginLan( TCmPluginInitParam* aInitParam );
+
+        /**
+        * Second phase constructor. Leaves on failure.
+		* @param
+        */      
+		void ConstructL();
+
+    private: // Data
+
+	};
+
+#endif // LAN_PLUGIN_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginlan/src/cmpluginlan.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,305 @@
+/*
+* 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 Lan Plugin interface implementation 
+*      for Lan Bearer
+*      
+*
+*/
+
+ 
+// INCLUDE FILES
+
+#include "cmpluginlan.h"
+#include "cmlogger.h"
+#include "datamobilitycommsdattypes.h"
+#include <cmmanagerdef.h>
+#include <ecom/ecom.h>		// For REComSession
+#include <mcmdexec.h>
+#include <cmpbasesettingsdlg.h>
+
+#include <cmpluginpacketdata.mbg>           // icons
+#include <data_caging_path_literals.hrh>
+
+using namespace CMManager;
+using namespace CommsDat;
+
+// ================= CONSTANTS =======================
+const TUint32 KDefaultPriorityLAN = 0;
+
+static const TCmAttribConvTable SLanConvTbl[] = 
+    {
+        { ELanIfNetworks, ELanRangeMax, NULL },
+        { ELanIfNetworks, KCDTIdLANIfNetworks, NULL },        
+        { ELanIpNetMask, KCDTIdLANIpNetMask, &CheckIPv4ValidityL },
+        { ELanIpGateway, KCDTIdLANIpGateway, &CheckIPv4ValidityL },
+        { ELanIpAddrFromServer, KCDTIdLANIpAddrFromServer, NULL },
+        { ELanIpAddr, KCDTIdLANIpAddr, &CheckIPv4ValidityL },
+        { ELanIpDNSAddrFromServer, KCDTIdLANIpDNSAddrFromServer, NULL },
+        { ELanIpNameServer1, KCDTIdLANIpNameServer1, &CheckIPv4ValidityL },
+        { ELanIpNameServer2, KCDTIdLANIpNameServer2, &CheckIPv4ValidityL },
+        { ELanIp6DNSAddrFromServer, KCDTIdLANIp6DNSAddrFromServer, NULL },
+        { ELanIp6NameServer1, KCDTIdLANIp6NameServer1, &CheckIPv4ValidityL },
+        { ELanIp6NameServer2, KCDTIdLANIp6NameServer2, &CheckIPv4ValidityL },
+        { ELanIpAddrLeaseValidFrom, KCDTIdLANIpAddrLeaseValidFrom, NULL },
+        { ELanIpAddrLeaseValidTo, KCDTIdLANIpAddrLeaseValidTo, NULL },
+        { ELanConfigDaemonManagerName, KCDTIdLANConfigDaemonManagerName, NULL },
+        { ELanConfigDaemonName, KCDTIdLANConfigDaemonName, NULL },
+        { ELanServiceExtensionTableName, KCDTIdLANServiceExtensionTableName, NULL },
+        { ELanServiceExtensionTableRecordId, KCDTIdLANServiceExtensionTableRecordId, NULL },
+        { 0, 0, NULL }
+    };
+
+
+static const TCmCommonAttrConvArrayItem SCommonConvTbl[] =
+{
+    { ELanIfNetworks, ECmIFNetworks },
+    { ELanIpNetMask, ECmIPNetmask },
+    { ELanIpGateway, ECmIPGateway },
+    { ELanIpAddrFromServer, ECmIPAddFromServer },
+    { ELanIpAddr, ECmIPAddress },
+    { ELanIpDNSAddrFromServer, ECmIPDNSAddrFromServer },
+    { ELanIpNameServer1, ECmIPNameServer1 },
+    { ELanIpNameServer2, ECmIPNameServer2 },
+    { ELanIp6DNSAddrFromServer, ECmIP6DNSAddrFromServer },
+    { ELanIp6NameServer1, ECmIP6NameServer1 },
+    { ELanIp6NameServer2, ECmIP6NameServer2 },
+    { ELanIpAddrLeaseValidFrom, ECmIPAddrLeaseValidFrom },
+    { ELanIpAddrLeaseValidTo, ECmIPAddrLeaseValidTo },
+    { ELanConfigDaemonManagerName, ECmConfigDaemonManagerName },
+    { ELanConfigDaemonName, ECmConfigDaemonName },
+    { 0, 0 }
+    };
+
+
+_LIT( KPacketDataFileIcons, "z:cmpluginpacketdata.mbm" );
+    
+
+// ======== LOCAL FUNCTIONS ========
+    
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------
+// CCmPluginLan::NewOutgoingL()
+// ---------------------------------------------------------
+//
+CCmPluginLan* CCmPluginLan::NewL( TCmPluginInitParam* aInitParam )
+	{
+	CCmPluginLan* self = new( ELeave ) CCmPluginLan( aInitParam );
+	CleanupStack::PushL( self );
+	self->ConstructL();
+	CleanupStack::Pop( /*self*/ );
+
+	return self;
+	}
+
+// ----------------------------------------------------------------------------
+// CCmPluginLan::CreateInstanceL
+// ----------------------------------------------------------------------------
+//
+CCmPluginBaseEng* CCmPluginLan::CreateInstanceL( TCmPluginInitParam& aInitParam ) const
+    {
+    CCmPluginLan* self = new( ELeave ) CCmPluginLan( &aInitParam );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+    
+// ---------------------------------------------------------
+// CCmPluginLan::~CCmPluginLan()
+// ---------------------------------------------------------
+//
+CCmPluginLan::~CCmPluginLan()
+	{
+	AdditionalReset();
+	
+	CLOG_CLOSE;
+	}
+
+
+// ---------------------------------------------------------
+// CCmPluginLan::CCmPluginLan()
+// ---------------------------------------------------------
+//
+CCmPluginLan::CCmPluginLan( TCmPluginInitParam* aInitParam )
+    : CCmPluginLanBase( aInitParam )
+	{
+	CLOG_CREATE;
+	
+	iBearerType = KUidLanBearerType;
+	}
+
+
+// ---------------------------------------------------------
+// CCmPluginLan::ConstructL()
+// ---------------------------------------------------------
+//
+void CCmPluginLan::ConstructL()
+	{
+	CCmPluginLanBase::ConstructL();
+	
+    iBearerRecName = KCDTypeNameLANBearer;
+	
+	AddConverstionTableL( (CCDRecordBase**)&iServiceRecord, NULL, SLanConvTbl );
+	
+	AddCommonConversionTableL( SCommonConvTbl );
+	}
+	
+
+// ---------------------------------------------------------
+// CCmPluginLan::GetIntAttributeL()
+// ---------------------------------------------------------
+//
+TUint32 CCmPluginLan::GetIntAttributeL( const TUint32 aAttribute ) const
+    {
+    LOGGER_ENTERFN( "CCmPluginLanBase::GetIntAttributeL" );
+
+    TUint32 retVal;
+    
+    switch( aAttribute )
+        {
+        // LAN bearer has no icon, but added temporary 
+        // to help work on emulator.
+        case ECmBearerIcon:
+            {
+            MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
+                   
+            TParse mbmFile;
+            User::LeaveIfError( mbmFile.Set( KPacketDataFileIcons, 
+                                                    &KDC_BITMAP_DIR, NULL ) );
+
+                   
+            retVal = (TUint32)AknsUtils::CreateGulIconL( 
+                                    skinInstance, 
+                                    KAknsIIDQgnPropWmlGprs,
+                                    mbmFile.FullName(), 
+                                    EMbmCmpluginpacketdataQgn_prop_wml_gprs, 
+                                    EMbmCmpluginpacketdataQgn_prop_wml_gprs_mask );
+            }
+            break;
+               
+        // LAN bearer has no icon, but added temporary 
+        // to help work on emulator.
+        case ECmBearerAvailableIcon:
+            {
+            MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
+                   
+            TParse mbmFile;
+            User::LeaveIfError( mbmFile.Set( KPacketDataFileIcons, &KDC_BITMAP_DIR, NULL ) );
+
+                   
+            retVal = (TUint32)AknsUtils::CreateGulIconL( 
+                                    skinInstance, 
+                                    KAknsIIDQgnPropWmlGprs,
+                                    mbmFile.FullName(), 
+                                    EMbmCmpluginpacketdataQgn_prop_wml_gprs, 
+                                    EMbmCmpluginpacketdataQgn_prop_wml_gprs_mask );
+            }
+            break;
+            
+        case ECmCommsDBBearerType:
+            {
+            retVal = KCommDbBearerLAN;
+            }
+            break;
+            
+        case ECmDefaultUiPriority:
+        case ECmDefaultPriority:
+            {
+            retVal = aAttribute == ECmDefaultPriority ?
+                        GlobalBearerPriority( TPtrC(KCDTypeNameLANService) ) :
+                        GlobalUiBearerPriority( TPtrC(KCDTypeNameLANService) );
+            
+            if( retVal == KDataMobilitySelectionPolicyPriorityWildCard )
+                {
+                retVal = KDefaultPriorityLAN;
+                }
+            }
+            break;
+            
+        default:
+            {
+            retVal = CCmPluginBaseEng::GetIntAttributeL( aAttribute );
+            }
+        }
+        
+    return retVal;
+    }
+    
+// ---------------------------------------------------------
+// CCmPluginLan::CanHandleIapIdL()
+// ---------------------------------------------------------
+//
+TBool CCmPluginLan::CanHandleIapIdL( TUint32 aIapId ) const
+    {
+    LOGGER_ENTERFN( "CCmPluginLanBase::CanHandleIapIdL1" );
+    CLOG_WRITE_1( "IapId: [%d]", aIapId );
+    
+    TBool retVal( EFalse );
+    
+    CCDIAPRecord *iapRecord = static_cast<CCDIAPRecord *>
+                            (CCDRecordBase::RecordFactoryL(KCDTIdIAPRecord));
+        
+    CleanupStack::PushL( iapRecord );
+    iapRecord->SetRecordId( aIapId );
+    
+    TRAPD( err, iapRecord->LoadL( Session() ));
+
+    if( !err )
+        {
+        CanHandleIapIdL( iapRecord );
+        }
+    
+    CleanupStack::PopAndDestroy( iapRecord );
+    return retVal;
+    }
+
+// ---------------------------------------------------------
+// CCmPluginLan::CanHandleIapIdL()
+// ---------------------------------------------------------
+//
+TBool CCmPluginLan::CanHandleIapIdL( CCDIAPRecord *aIapRecord ) const
+    {
+    LOGGER_ENTERFN( "CCmPluginLanBase::CanHandleIapIdL2" );
+
+    CLOG_WRITE_1( "IapId: [%d]", aIapRecord->RecordId() );
+    
+    TBool retVal( EFalse );
+    
+    CLOG_WRITE_2( "IAP record: [%S][%S]",
+                    &FIELD_TO_TDESC(aIapRecord->iServiceType), 
+                    &FIELD_TO_TDESC(aIapRecord->iBearerType)
+                );
+    
+    if( (TPtrC(aIapRecord->iServiceType) == TPtrC(KCDTypeNameLANService) ) &&
+        TPtrC(aIapRecord->iBearerType) == TPtrC(KCDTypeNameLANBearer) )
+        {
+        CLOG_WRITE( "I can." );
+        retVal = ETrue;
+        }
+
+    return retVal;
+    }
+
+// ---------------------------------------------------------
+// CCmPluginLan::AdditionalReset()
+// ---------------------------------------------------------
+//        
+void CCmPluginLan::AdditionalReset()
+    {
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginlan/src/cmpluginlanproxy.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,37 @@
+/*
+* 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 Lan Plugin proxy table
+*      
+*
+*/
+
+
+#include "cmpluginlan.h"
+#include <e32std.h>
+#include <ecom/implementationproxy.h>
+
+// Exported proxy for instantiation method resolution
+// Define the interface UIDs
+const TImplementationProxy ImplementationTable[] = 
+	{
+	IMPLEMENTATION_PROXY_ENTRY( KUidLanBearerType, CCmPluginLan::NewL)
+	};
+
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+	{
+	aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+
+	return ImplementationTable;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginpacketdata/data/1020737C.rss	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,46 @@
+/*
+* 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 definitions for project cmpluginpacketdata
+*
+*/
+
+#include "ecom/registryinfo.rh"
+
+// Because attribute enums had to be added to namespace CMManager
+// it's not possible to included cmpluginpacketdatadef.h.
+// Thus bearer type id had to be redefine here.
+#define KPacketDataBearerType   0x10207378
+
+RESOURCE REGISTRY_INFO theInfo
+	{
+	dll_uid = 0x1020737C;
+	interfaces = 
+		{
+		INTERFACE_INFO
+			{
+			interface_uid = 0x10207377; // = KCMPluginInterfaceUid
+			implementations = 
+				{
+				IMPLEMENTATION_INFO
+					{
+					implementation_uid = KPacketDataBearerType;
+					version_no = 1;
+					display_name = "Packet Data";
+					default_data = "PacketData";
+					opaque_data = "";
+					}
+				};
+			}
+		};
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginpacketdata/data/cmpacketdataui.rss	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,222 @@
+/*
+* 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 definitions for project cmpluginpacketdata
+*
+*/
+
+
+NAME    PDPL
+
+// INCLUDES
+#include <avkon.rsg>
+#include <avkon.rh>    
+#include <avkon.loc>
+#include <uikon.rh>
+#include <eikon.rh>
+#include <cmpsettingsconsts.h>
+#include <eikon.rsg>
+#include <AvkonIcons.hrh>
+#include <cmmanager.loc>
+#include <cmmanager.rsg>
+
+#include <cmpluginpacketdata.loc>
+
+// RESOURCE IDENTIFIERS
+
+RESOURCE RSS_SIGNATURE { }
+
+RESOURCE TBUF { buf = "cmpacketdataplugin"; }
+
+// CONSTANTS
+
+//For Ip address editor
+#define IPADDRESS_MIN_FIRST_FIELD_VALUE     0
+#define IPADDRESS_MIN_SECOND_FIELD_VALUE    0
+#define IPADDRESS_MIN_THIRD_FIELD_VALUE     0
+#define IPADDRESS_MIN_FOURTH_FIELD_VALUE    0
+#define IPADDRESS_MAX_FIRST_FIELD_VALUE     255
+#define IPADDRESS_MAX_SECOND_FIELD_VALUE    255
+#define IPADDRESS_MAX_THIRD_FIELD_VALUE     255
+#define IPADDRESS_MAX_FOURTH_FIELD_VALUE    255
+
+
+// RESOURCE DEFINITIONS
+
+// ---------------------------------------------------------------------------
+// r_gprs_plugin_view_ap_name
+// localised string
+// ---------------------------------------------------------------------------
+RESOURCE TBUF r_gprs_plugin_view_ap_name                              
+    {
+    buf = qtn_set_access_point_name;
+    }
+                
+// ---------------------------------------------------------------------------
+// r_gprs_plugin_sett_val_field_none
+// localised string
+// ---------------------------------------------------------------------------
+RESOURCE TBUF r_gprs_plugin_sett_val_field_none
+    {
+    buf = qtn_selec_sett_val_field_none;
+    }
+                
+// ---------------------------------------------------------------------------
+// r_gprs_plugin_view_pdp_type
+// localised string
+// ---------------------------------------------------------------------------
+RESOURCE TBUF r_gprs_plugin_view_pdp_type
+    {
+    buf = qtn_set_network_type;
+    }
+
+// ---------------------------------------------------------------------------
+// r_gprs_plugin_view_pdp_type_ipv4
+// localised string
+// ---------------------------------------------------------------------------
+RESOURCE TBUF r_gprs_plugin_view_pdp_type_ipv4
+    {
+    buf = qtn_set_nw_type_ipv4;
+    }
+
+// ---------------------------------------------------------------------------
+// r_gprs_plugin_view_pdp_type_ipv6
+// localised string
+// ---------------------------------------------------------------------------
+RESOURCE TBUF r_gprs_plugin_view_pdp_type_ipv6
+    {
+    buf = qtn_set_nw_type_ipv6;
+    }
+
+// ---------------------------------------------------------------------------
+// r_gprs_plugin_apn_prompt
+// localised string
+// ---------------------------------------------------------------------------
+RESOURCE TBUF r_gprs_plugin_apn_prompt             
+    {
+    buf = qtn_netw_conset_prmpt_packet_data_apn;
+    }
+
+// ---------------------------------------------------------------------------
+// r_qtn_netw_conset_bearer_supported_packet_data
+// localised string
+// ---------------------------------------------------------------------------
+RESOURCE TBUF r_qtn_netw_conset_bearer_supported_packet_data
+    {
+    buf = qtn_netw_conset_bearer_supported_packet_data;
+    }
+
+// ---------------------------------------------------------------------------
+// r_qtn_netw_conset_bearer_available_packet_data
+// localised string
+// ---------------------------------------------------------------------------
+RESOURCE TBUF r_qtn_netw_conset_bearer_available_packet_data
+    {
+    buf = qtn_netw_conset_bearer_available_packet_data;
+    }
+
+// ---------------------------------------------------------------------------
+// r_qtn_netw_conset_packet_data_available
+// localised string
+// ---------------------------------------------------------------------------
+RESOURCE TBUF r_qtn_netw_conset_packet_data_available
+    {
+    buf = qtn_netw_conset_packet_data_available;
+    }
+
+// ---------------------------------------------------------------------------
+// r_gprs_plugin_view_set_bearer_packet_data
+// localised string
+// ---------------------------------------------------------------------------
+RESOURCE TBUF r_gprs_plugin_view_set_bearer_packet_data
+    {
+    buf = qtn_set_bearer_packet_data;
+    }
+
+// ---------------------------------------------------------------------------
+// r_qtn_netw_conset_popup_bearer_packet_data
+// localised string
+// ---------------------------------------------------------------------------
+RESOURCE TBUF r_qtn_netw_conset_popup_bearer_packet_data
+    {
+    buf = qtn_netw_conset_popup_bearer_packet_data;
+    }
+                
+// ---------------------------------------------------------------------------
+// r_qtn_set_bearer_packet_data
+// localised string
+// ---------------------------------------------------------------------------
+RESOURCE TBUF r_qtn_set_bearer_packet_data
+    {
+    buf = qtn_set_bearer_packet_data;
+    }
+
+// ---------------------------------------------------------------------------
+// r_setting_app_edwin_gprsap_name
+// edwin for packet data access point name setting page
+// ---------------------------------------------------------------------------
+RESOURCE EDWIN r_setting_app_edwin_gprsap_name
+    {
+    width=KGprsApNameWidth;
+    lines=KGprsApNameLines;
+    maxlength=KMaxGprsApNameLength;
+    allowed_input_modes = EAknEditorTextInputMode | EAknEditorNumericInputMode;
+    default_input_mode = EAknEditorTextInputMode;
+    default_case = EAknEditorLowerCase;
+    avkon_flags = EAknEditorFlagLatinInputModesOnly;
+    flags = EEikEdwinAutoSelection | EEikEdwinNoLineOrParaBreaks;
+    }
+
+// ---------------------------------------------------------------------------
+// r_text_setting_page_gprsap_name
+// setting page for packet data access point name
+// ---------------------------------------------------------------------------
+RESOURCE AVKON_SETTING_PAGE r_text_setting_page_gprsap_name
+    {
+    number= EAknSettingPageNoOrdinalDisplayed;
+    softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+    label= qtn_set_access_point_name;
+    type = EEikCtEdwin;
+    editor_resource_id = r_setting_app_edwin_gprsap_name;
+    }
+
+// ---------------------------------------------------------------------------
+// r_apn_name_query
+// 
+// ---------------------------------------------------------------------------
+RESOURCE DIALOG r_apn_name_query
+    {
+    flags = EGeneralQueryFlags | EEikDialogFlagNoShadow;
+    buttons = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control = AVKON_DATA_QUERY 
+                { 
+                layout = EDataLayoutAllowEmptyInput;
+                control = EDWIN
+                    {
+                    maxlength=KMaxGprsApNameLength;
+                    allowed_input_modes = EAknEditorTextInputMode | EAknEditorNumericInputMode;
+                    default_input_mode = EAknEditorTextInputMode;
+                    avkon_flags = EAknEditorFlagLatinInputModesOnly;
+                    flags = EEikEdwinNoHorizScrolling;
+                    default_case = EAknEditorLowerCase;
+                    };
+                };
+            }
+        };
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginpacketdata/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2006-2008 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 file for project cmpluginpacketdata
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+// export localised loc file
+../loc/cmpluginpacketdata.loc	MW_LAYER_LOC_EXPORT_PATH(cmpluginpacketdata.loc)
+
+PRJ_MMPFILES
+cmpluginpacketdata.mmp
+
+PRJ_EXTENSIONS
+START EXTENSION s60/mifconv
+OPTION TARGETFILE cmpluginpacketdata.mif
+OPTION HEADERFILE cmpluginpacketdata.mbg
+OPTION SOURCES -c8,1 qgn_prop_wml_gprs\
+               -c8,8 qgn_prop_set_conn_bearer_avail_packetdata
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginpacketdata/group/cmpluginpacketdata.mmp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,80 @@
+/*
+* 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:  Project definition file for project cmpluginpacketdata
+*
+*/
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+TARGET      cmpluginpacketdata.dll
+UID         0x10009D8D 0x1020737C
+
+TARGETTYPE		PLUGIN
+
+CAPABILITY      CAP_ECOM_PLUGIN
+VENDORID        VID_DEFAULT
+
+SOURCEPATH  ../src
+
+SOURCE      cmpluginpacketdataproxy.cpp
+SOURCE      cmpluginpacketdata.cpp
+SOURCE      ../../../Framework/Src/cmlogger.cpp
+SOURCE      cmppacketdatasettingsdlg.cpp
+SOURCE      cmppacketdatasettingsdlgadv.cpp
+
+SOURCEPATH  ../data
+
+START RESOURCE 1020737C.rss
+TARGET cmpluginpacketdata.rsc
+END
+
+START RESOURCE cmpacketdataui.rss
+DEPENDS cmmanager.rsg
+HEADER
+TARGETPATH   RESOURCE_FILES_DIR
+LANGUAGE_IDS
+END
+
+USERINCLUDE     ../../../Framework/Inc
+USERINCLUDE     ../../../Framework/SrcData
+USERINCLUDE     ../data
+
+// Component specific internal headers 
+USERINCLUDE			../inc
+
+// ADO specific internal headers 
+SYSTEMINCLUDE		../../../../../inc
+
+//Macro to /epoc32 headers
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY euser.lib
+LIBRARY	ECOM.LIB
+LIBRARY cmmanager.lib
+LIBRARY COMMSDAT.lib
+DEBUGLIBRARY flogger.lib
+LIBRARY		CommonUI.LIB
+LIBRARY	CommonEngine.lib
+LIBRARY	bafl.lib
+LIBRARY eikcoctl.lib avkon.lib eikdlg.lib
+LIBRARY insock.lib
+LIBRARY etel.lib        // coverage check
+LIBRARY ETELPCKT.lib    // coverage check
+
+LIBRARY eikcore.lib egul.lib
+LIBRARY eikctl.lib  cone.lib 
+LIBRARY fbscli.lib efsrv.lib 
+
+LIBRARY AknSkins.lib
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginpacketdata/group/pluginpacketdata_icons.mk	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,66 @@
+#
+# 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:  icons makefile for project cmpluginpacketdata
+#
+ifeq (WINS,$(findstring WINS, $(PLATFORM)))
+ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\Z
+else
+ZDIR=\epoc32\data\z
+endif
+
+
+TARGETDIR=$(ZDIR)\resource\apps
+ICONTARGETFILENAME=$(TARGETDIR)\cmpluginpacketdata.mif
+
+HEADERDIR=\epoc32\include
+HEADERFILENAME=$(HEADERDIR)\cmpluginpacketdata.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) \
+                /c8,1 qgn_prop_wml_gprs.bmp \
+                /c8,8 qgn_prop_set_conn_bearer_avail_packetdata.bmp
+
+FREEZE : do_nothing
+
+SAVESPACE : do_nothing
+
+RELEASABLES :
+	@echo $(HEADERFILENAME)&& \
+	@echo $(ICONTARGETFILENAME)
+
+FINAL : do_nothing
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginpacketdata/inc/cmpacketdatacommonconstants.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,25 @@
+/*
+* 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:  constants for the packet data plugin
+*
+*/
+
+#ifndef CMPACKETDATACOMMONCONSTANTS_H
+#define CMPACKETDATACOMMONCONSTANTS_H
+
+// CONSTANTS
+_LIT( KPluginPacketDataResDirAndFileName, "z:cmpacketdataui.rsc" );
+_LIT( KEmptyAddress, "http://" );
+
+#endif  // CMPACKETDATACOMMONCONSTANTS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginpacketdata/inc/cmpluginpacketdata.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,277 @@
+/*
+* 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 CCmPluginPacketData.
+*
+*/
+
+#ifndef PACKETDATA_PLUGIN_H
+#define PACKETDATA_PLUGIN_H
+
+#include <cmpluginbaseeng.h>
+#include <cmpluginpacketdatadef.h>
+
+/**
+*  CCmPluginPacketData dialog class
+*  @since S60 v3.2
+*/
+NONSHARABLE_CLASS( CCmPluginPacketData ) : public CCmPluginBaseEng
+    {
+
+    public: // Constructors and destructor
+
+        static CCmPluginPacketData* NewL( TCmPluginInitParam* aInitParam );
+
+        virtual ~CCmPluginPacketData();
+
+        virtual CCmPluginBaseEng* CreateInstanceL( TCmPluginInitParam& aInitParam ) const;
+        
+    public: // From CCmPluginBaseEng
+        
+        /**
+        * From CCmPluginBaseEng
+        * see base class
+        *
+        * @since S60 3.2
+        * @param aAttribute
+        */
+        virtual TUint32 GetIntAttributeL( const TUint32 aAttribute ) const;
+
+        /**
+        * From CCmPluginBaseEng
+        * see base class
+        *
+        * @since S60 3.2
+        * @param aAttribute
+        */
+		virtual TBool GetBoolAttributeL( const TUint32 aAttribute ) const;
+
+		/**
+        * From CCmPluginBaseEng
+        * see base class
+        *
+        * @since S60 3.2
+        * @param aAttribute
+        */
+		virtual HBufC* GetStringAttributeL( const TUint32 aAttribute ) const;
+
+		/**
+        * From CCmPluginBaseEng
+        * see base class
+        *
+        * @since S60 3.2
+        * @param aAttribute
+        * @param aValue
+        */
+		virtual void SetIntAttributeL( const TUint32 aAttribute, 
+		                                                    TUint32 aValue );
+
+		
+		/**
+        * From CCmPluginBaseEng
+        * see base class
+        *
+        * @since S60 3.2
+        * @param aAttribute
+        * @param aValue
+        */
+		virtual void SetBoolAttributeL( const TUint32 aAttribute, 
+		                                                    TBool aValue );
+
+		/**
+        * From CCmPluginBaseEng
+        * see base class
+        *
+        * @since S60 3.2
+        * @param aAttribute
+        * @param aValue
+        */
+		virtual void SetStringAttributeL( const TUint32 aAttribute, 
+		                                            const TDesC16& aValue );
+        
+        /**
+        * From CCmPluginBaseEng
+        * see base class
+        *
+        * @since S60 3.2
+        * @param aIapId
+        */
+        virtual void PrepareToUpdateRecordsL();
+        
+        /**
+        * From CCmPluginBaseEng
+        * see base class
+        *
+        * @since S60 3.2
+        * @param aIapId
+        */
+		virtual TBool CanHandleIapIdL( TUint32 aIapId ) const;
+        
+        /**
+        * From CCmPluginBaseEng
+        * see base class
+        *
+        * @since S60 3.2
+        * @param aIapRecord
+        */
+		virtual TBool CanHandleIapIdL( CommsDat::CCDIAPRecord *aIapRecord ) const;
+        
+        /**
+        * From CCmPluginBaseEng
+        * see base class
+        *
+        * @since S60 3.2
+        */
+		virtual TInt RunSettingsL();
+        
+	    /**
+        * From CCmPluginBaseEng
+        * see base class
+        *
+        * @since S60 3.2
+        */
+		virtual void LoadServiceSettingL();
+
+	    /**
+        * From CCmPluginBaseEng
+        * see base class
+        *
+        * @since S60 3.2
+        */
+		virtual TBool InitializeWithUiL( TBool aManuallyConfigure );
+	    
+        /**
+        * From CCmPluginBaseEng
+        * see base class
+        *
+        * @since S60 3.2
+        * @param aServiceName
+        * @param aRecordId
+        */
+		virtual void ServiceRecordIdLC( HBufC* &aServiceName, 
+                                                        TUint32& aRecordId );
+
+	    /**
+        * From CCmPluginBaseEng
+        * see base class
+        *
+        * @since S60 3.2
+        * @param aBearerName
+        * @param aRecordId
+        */
+		virtual void BearerRecordIdLC( HBufC* &aBearerName, 
+                                                        TUint32& aRecordId );
+                                       
+    public: // New functions
+    
+        /**
+        * @param aPdpType PDP type to be set
+        */     
+        void SetPDPTypeL( RPacketContext::TProtocolType aPdpType );
+
+        /**
+        * @since S60 3.2
+        * @return the service record
+        */
+		CommsDat::CCDWCDMAPacketServiceRecord& ServiceRecord() const;
+        
+    protected: // From CCmPluginBaseEng
+    
+        /**
+        * From CCmPluginBaseEng
+        *
+        * @since S60 3.2
+		*/      
+		virtual void AdditionalReset();
+
+        /**
+        * From CCmPluginBaseEng
+        *
+        * @since S60 5.2
+		*/      
+        virtual void CreateAdditionalRecordsL();
+
+        /**
+        * From CCmPluginBaseEng
+        *
+        * @since S60 5.2
+		*/      
+        virtual void DeleteAdditionalRecordsL();
+
+        /**
+        * From CCmPluginBaseEng
+        *
+        * @since S60 5.2
+		*/      
+        virtual void LoadAdditionalRecordsL();
+
+        /**
+        * From CCmPluginBaseEng
+        *
+        * @since S60 5.2
+		*/      
+        virtual void UpdateAdditionalRecordsL();
+
+	private: // Constructors
+
+        /**
+        * Constructor
+        *
+        * @since S60 3.2
+        * @param aInitParam
+        * @param aOutgoing
+        */      
+		CCmPluginPacketData( TCmPluginInitParam* aInitParam, 
+		                     TBool aOutgoing );
+
+        /**
+        * Second phase constructor    
+        *
+        * @since S60 3.2
+		*/      
+		void ConstructL();
+
+    private: // from CCmPluginBaseEng
+    
+        /**
+        * Second phase constructor    
+        *
+        * @since S60 3.2
+		*/      
+		virtual void CreateNewServiceRecordL();
+		
+		virtual void PrepareToCopyDataL( CCmPluginBaseEng* aDestInst ) const;
+        
+        /**
+        * Sets the daemon name. Starts DHCP if set.
+        *
+        * @since S60 3.2
+        */
+        void SetDaemonNameL();
+
+    private:
+    
+	    /**
+        * @since S60 3.2
+        * @return if there is network coverage
+        */
+		TBool CheckNetworkCoverageL() const;
+        
+	private: // Data
+	    
+        TBool   iOutgoing;  ///< EPacketDataOutGoing
+
+        CommsDat::CCDUmtsR99QoSAndOnTableRecord* iPacketDataQoSRecord; // Owned
+	};
+
+#endif // PACKETDATA_PLUGIN_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginpacketdata/inc/cmppacketdatasettingsdlg.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,166 @@
+/*
+* 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:  Declares a settings dialog for a packet data connection 
+*                method plugin
+*
+*/
+
+#ifndef CMPLUGINPACKETDATA_SETTINGS_DLG_H
+#define CMPLUGINPACKETDATA_SETTINGS_DLG_H
+
+// INCLUDES
+#include <cmpluginbaseeng.h>
+#include <mcmdexec.h>
+#include <cmpbasesettingsdlg.h>
+#include "cmcommsdatnotifier.h"
+
+// CLASS DECLARATION
+
+/**
+ *  CmPluginPacketDataSettingsDlg dialog class
+ *
+ *  Displays the Packet data settings
+ *
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CmPluginPacketDataSettingsDlg ) : 
+                                               public CmPluginBaseSettingsDlg
+                                               , public MCmCommsDatWatcher
+                                               , public CCmParentViewNotifier
+    {
+    public: // Constructors and destructor
+    
+        /**
+        * Two-phase constructor
+        *
+        * @since S60 3.2
+        * @param aCmPluginBaseEng  The connection method to use
+        * @return instance of the class
+        */
+        static CmPluginPacketDataSettingsDlg* NewL( CCmPluginBaseEng& 
+                                                        aCmPluginBaseEng );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CmPluginPacketDataSettingsDlg();
+    
+    public: // From CmPluginBaseSettingsDlg
+    
+        /**
+        * From CmPluginBaseSettingsDlg
+        * constructor for the dialog
+        *
+        * @since S60 3.2
+        */
+        virtual TInt ConstructAndRunLD( );
+        
+        /**
+        * From CmPluginBaseSettingsDlg
+        * Collects the packet data specific setting information for 
+        * displaying
+        *
+        * @since S60 3.2
+        * @param aItemArray an array of setting information
+        */
+        virtual void UpdateListBoxContentBearerSpecificL( 
+                                                    CDesCArray& aItemArray );
+        
+        /**
+        * From CmPluginBaseSettingsDlg
+        * displays the advanced settings dialog
+        *
+        * @since S60 3.2
+        */
+        virtual void RunAdvancedSettingsL();        
+        
+    public: // from class MCmCommsDatWatcher
+        
+        /**
+         * Watch changes in CommsDat
+         */
+        void CommsDatChangesL();
+        
+    public: // from class CCmParentViewNotifier
+        
+        void NotifyParentView( TInt aValue );
+        
+    protected:
+        /** From CAknDialog */
+        TBool OkToExitL( TInt aButtonId );
+        
+    private: // Constructors
+    
+        CmPluginPacketDataSettingsDlg( CCmPluginBaseEng& aCmPluginBaseEng );    
+        
+    private: // From CmPluginBaseSettingsDlg
+        
+        /**
+        * From CmPluginBaseSettingsDlg
+        * Redraws the list box
+        *
+        * @since S60 3.2
+        */
+        virtual void UpdateListBoxContentL();
+        
+        /**
+        * From CmPluginBaseSettingsDlg
+        * according to the setting type the correct edit dialog is displayed
+        *
+        * @since S60 3.2
+        * @param aAttribute
+        * @param aCommandId
+        */
+        virtual TBool ShowPopupSettingPageL( TUint32 aAttribute, 
+                                             TInt aCommandId  );
+                                             
+        /**
+        * From CmPluginBaseSettingsDlg
+        * Get help contest of the plugin
+        *
+        * @since S60 5.0
+        */
+				virtual void GetHelpContext( TCoeHelpContext& aContext ) const;
+        
+    private: // From MEikCommandObserver
+                
+        /**
+        * From MEikCommandObserver
+        * see base class for description
+        *
+        * @since S60 3.2
+        * @param aCommandId
+        */
+        virtual void ProcessCommandL( TInt aCommandId );
+        
+    private: // New functions
+            
+        /**
+        * Shows the bool setting page for a certain setting or
+        * simply changes the setting if ok key was pressed
+        * @since S60 3.2
+        * @param aAttribute The setting to be changed by the setting page
+        * @param aCommandId Command id, to make difference between ok and change commands
+        * @return the new setting value
+        */  
+        TBool ChangeBoolSettingL( TUint32 aAttribute, TInt aCommandId );
+        
+        void HandleCommsDatChangeL();
+        
+    private:
+        
+        TInt iNotifyFromSon;
+    };
+
+#endif // CMPLUGINPACKETDATA_SETTINGS_DLG_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginpacketdata/inc/cmppacketdatasettingsdlgadv.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,169 @@
+/*
+* 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:  Declares an advanved settings dialog for a packet data 
+*                connection method plugin
+*
+*/
+
+#ifndef CMPLUGINPACKETDATA_SETTINGS_DLG_ADV_H
+#define CMPLUGINPACKETDATA_SETTINGS_DLG_ADV_H
+
+// INCLUDES
+#include <mcmdexec.h>
+#include <cmpbasesettingsdlgadv.h>
+#include <cmpluginbaseeng.h>
+#include <in_sock.h>
+#include "cmcommsdatnotifier.h"
+
+// FORWARD DECLARATIONS
+class CCmPluginBaseEng;
+
+// CLASS DECLARATION
+
+/**
+ *  CmPluginPacketDataSettingsDlgAdv dialog class
+ *
+ *  displays the packet data advanced settings dialog
+ *
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CmPluginPacketDataSettingsDlgAdv ) : 
+                                            public CmPluginBaseSettingsDlgAdv ,
+                                            public MCmCommsDatWatcher
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Two-phase construction
+        *
+        * @since S60 3.2
+        * @param aCmPluginBaseEng  The connection method to use
+        * @return instance of the class
+        */
+        static CmPluginPacketDataSettingsDlgAdv* NewL( 
+                                        CCmPluginBaseEng& aCmPluginBaseEng );
+
+        /**
+        * Destructor
+        */
+        virtual ~CmPluginPacketDataSettingsDlgAdv();
+
+    public: // From CmPluginBaseSettingsDlg
+    
+        /**
+        * From CmPluginBaseSettingsDlg
+        * Collects the packet data specific setting information for 
+        * displaying
+        *
+        * @since S60 3.2
+        * @param aItemArray an array of setting information
+        */
+        void UpdateListBoxContentBearerSpecificL( CDesCArray& itemArray );
+        
+        /**
+        * From CmPluginBaseSettingsDlg
+        * displays the advanced settings dialog
+        *
+        * @since S60 3.2
+        */
+        void RunAdvancedSettingsL() {;}
+        
+    public: // from base class
+
+        /**
+        * From CmPluginBaseSettingsDlg
+        * Create and launch dialog
+        *
+        * @since S60 v3.2
+        * @return The code returned by the dialog's ExecuteLD
+        */
+        TInt ConstructAndRunLD();
+        
+    public:
+        
+        /**
+         * Record the object of parent view
+         */
+        void RegisterParentView( CCmParentViewNotifier* aParent );
+        
+    public: // from class MCmCommsDatWatcher
+        
+        /**
+         * Watch changes in CommsDat
+         */
+        void CommsDatChangesL();
+        
+    protected:
+        /** From CAknDialog */
+        TBool OkToExitL( TInt aButtonId );
+
+    private:
+    
+        /** 
+        * C++ constructor
+        */
+        CmPluginPacketDataSettingsDlgAdv( 
+                                        CCmPluginBaseEng& aCmPluginBaseEng );
+        
+    private: // From CmPluginBaseSettingsDlg
+    
+        /**
+        * From CmPluginBaseSettingsDlg
+        * according to the setting type the correct edit dialog is displayed
+        *
+        * @since S60 3.2
+        * @param aAttribute
+        * @param aCommandId
+        */
+        TBool ShowPopupSettingPageL( TUint32 aAttribute, TInt aCommandId  );
+        
+    private: // From MEikCommandObserver
+        
+        /**
+        * From MEikCommandObserver
+        * see base class for description
+        *
+        * @since S60 3.2
+        * @param aCommandId
+        */        
+        virtual void ProcessCommandL( TInt aCommandId );
+        
+    private: // New functions
+
+        /**
+        * Shows the setting page for IP DNS address
+        * 
+        * @since S60 3.2
+        */
+        void ShowPopupPacketDataIPDNSAddrFromServerL( );
+        
+        /**
+        * Show the setting page for PDP type
+        *
+        * @since S60 3.2
+        * @param aAttribute the setting to be changed
+        */
+        void ShowPDPTypeRBPageL( TUint32 aAttribute );
+        
+    private:  // Data Members
+
+        /**
+        * indicates if IPv6 is supported
+        */
+        TBool iIpv6Supported;
+                
+        CCmParentViewNotifier* iParent;
+    };
+
+#endif // CMPLUGINPACKETDATA_SETTINGS_DLG_ADV_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginpacketdata/loc/cmpluginpacketdata.loc	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,96 @@
+/*
+* 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 project cmpluginpacketdata
+*
+*/
+
+
+//  LOCALISATION STRINGS
+
+//d: The name of a new, default connection. Max.30 chars, longer ones will be truncated.
+//d: Used in Connection method view.
+//l: list_setting_pane_t1
+//w:
+//r: 3.2
+//
+#define qtn_set_access_point_name "Access point name"
+
+//d: Item text in setting list. Gives the network type 
+//d: (whether it is IP4 or IP6)
+//l: list_setting_pane_t1
+//w:
+//r: 3.2
+//
+#define qtn_set_network_type "Network type"
+
+//d: States that the network type is IPv4
+//l: list_set_graphic_pane_t1
+//w:
+//r: 3.2
+//
+#define qtn_set_nw_type_ipv4 "IPv4"
+
+//d: States that the network type is IPv6
+//l: list_set_graphic_pane_t1
+//w:
+//r: 3.2
+//
+#define qtn_set_nw_type_ipv6 "IPv6"
+
+//d: Connection method list text
+//l: list_set_graphic_pane_t1
+//w:
+//r: 3.2
+//
+#define qtn_selec_sett_val_field_none "None"
+
+//d: Prompt for Access Point Name query window.
+//l: popup_query_data_window
+//w:
+//r: 3.2
+//
+#define qtn_netw_conset_prmpt_packet_data_apn "Packet data access point name (APN):"
+
+//d: Name of packet data bearer type shown in a list of supported bearers.
+//l: list_single_graphic_pane_t1_cp2
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_bearer_supported_packet_data "Packet data"
+
+//d: First line of a double large graphic style listbox - packet data specific
+//l: list_double_large_graphic_pane_t1_cp2
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_bearer_available_packet_data "Packet data"
+
+//d: Second line of a double large graphic style listbox - packet data specific
+//l: list_double_large_graphic_pane_t2_cp2
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_packet_data_available "Available"
+
+//d: Name of the data bearer displayed in 'data bearer' setting
+//l: list_set_graphic_pane_t1
+//w:
+//r: 3.2
+//
+#define qtn_set_bearer_packet_data "Packet data"
+
+//d: Data bearer of the highlighted connection method.
+//l: popup_preview_text_window_t1
+//r: 3.2
+#define qtn_netw_conset_popup_bearer_packet_data "Packet data"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginpacketdata/src/cmpluginpacketdata.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,1216 @@
+/*
+* 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:  Dialog for editing settings for a packet data connection 
+*
+*/
+
+
+// INCLUDE FILES
+
+// System
+#include <AknsUtils.h>
+#include <data_caging_path_literals.hrh>
+#include <cmpluginpacketdata.mbg>           // icons
+#include <cmpacketdataui.rsg>
+#include <AknQueryDialog.h>
+#include <StringLoader.h>
+#include <cmmanager.rsg>
+// User
+#include "cmpluginpacketdata.h"
+#include <cmpluginpacketdatadef.h>
+#include "cmpacketdatacommonconstants.h"
+#include "cmlogger.h"
+#include "cmppacketdatasettingsdlg.h"
+#include <cmpsettingsconsts.h>
+#include "datamobilitycommsdattypes.h"
+#include <cmcommonconstants.h>
+#include <cmmanagerdef.h>
+
+using namespace CMManager;
+using namespace CommsDat;
+
+// ================= CONSTANTS =======================
+
+const TUint32 KDefaultPriorityPacketData = 1;
+
+/// Modem bearer names for GPRS/WCDMA Access Points
+_LIT( KModemBearerPacketData, "GPRS Modem" );
+_LIT( KPacketDataFileIcons, "z:cmpluginpacketdata.mbm" );
+_LIT( KDefaultQosDataRecordName, "PRIMARY1" );
+_LIT( KDefaultQosDataRecordNamewithSpace, "PRIMARY1 " );
+
+// ================= LOCAL PROTOTYPES =======================
+
+/**
+* Function to check and set PDP type and IfNetwork.
+* @param aThis 'this' pointer of the plugin instance
+* @param aAttribute attribute client wants to set
+* @param aValue TInt* IPv4 address buffer to be checked
+*/
+static TBool SetPDPTypeL( CCmPluginBaseEng* aThis, 
+                   TUint32 aAttribute, 
+                   const TAny* aValue );
+
+static const TCmAttribConvTable SPacketDataConvTbl[] = 
+    {
+    // iAttribId, iCommsDatId, iValidFuncL, 
+    // iTitleId, 
+    // iMaxLength, iAttribFlags, iDefValueResId, iEditorResId, iNotUsed1, iNotUsed2
+    { EPacketDataAPName, EGPRSReqTrafficClass-1, NULL,
+      0,
+      0, 0, 0, NULL, NULL },
+    { EPacketDataAPName, KCDTIdAPN, NULL,
+      R_GPRS_PLUGIN_VIEW_AP_NAME,
+      KMaxGprsApNameLength, 0, R_GPRS_PLUGIN_SETT_VAL_FIELD_NONE, R_TEXT_SETTING_PAGE_GPRSAP_NAME, NULL, NULL },
+    { EPacketDataPDPType, KCDTIdWCDMPDPType, &SetPDPTypeL,
+      R_GPRS_PLUGIN_VIEW_PDP_TYPE,
+      0, 0, 0, NULL, NULL },
+    { EPacketDataPDPAddress, KCDTIdWCDMAPDPAddress, NULL },
+    { EPacketDataReqPrecedence, KCDTIdReqPrecedence, NULL },
+    { EPacketDataReqDelay, KCDTIdReqDelay, NULL },
+    { EPacketDataReliability, KCDTIdReqReliability, NULL },
+    { EPacketDataPeakThroughput, KCDTIdReqPeakThroughput, NULL },
+    { EPacketDataMeanThroughput, KCDTIdReqMeanThroughput, NULL },
+    { EPacketDataMinPrecedence, KCDTIdMinPrecedence, NULL },
+    { EPacketDataMinDelay, KCDTIdMinDelay, NULL },
+    { EPacketDataMinReliability, KCDTIdMinReliability, NULL },
+    { EPacketDataMinPeakThroughput, KCDTIdMinPeakThroughput, NULL },
+    { EPacketDataMinMeanThroughput, KCDTIdMinMeanThroughput, NULL },
+    { EPacketDataDataCompression, KCDTIdWCDMADataCompression, NULL },
+    { EPacketDataHeaderCompression, KCDTIdWCDMAHeaderCompression, NULL },
+    { EPacketDataUseEdge, KCDTIdWCDMAUseEdge, NULL },
+    { EPacketDataAnonymousAccess, KCDTIdWCDMAAnonymousAccess, NULL },
+    { EPacketDataIFParams, KCDTIdWCDMAIfParams, NULL },
+    { EPacketDataIFNetworks, KCDTIdWCDMAIfNetworks, NULL },
+    { EPacketDataIFPromptForAuth, KCDTIdWCDMAIfPromptForAuth, NULL,
+      R_QTN_SET_PROMPT_PASSWD,
+      0, 0, 0, NULL, NULL },
+    { EPacketDataIFAuthName, KCDTIdWCDMAIfAuthName, NULL,
+      R_QTN_SET_AP_USERNAME,
+      KMaxLoginNameLength, 0, R_QTN_SET_AP_USERNAME_NONE, R_TEXT_SETTING_PAGE_LOGIN_NAME, NULL, NULL },
+    { EPacketDataIFAuthPass, KCDTIdWCDMAIfAuthPass, NULL,
+      R_QTN_SET_AP_PASSWD,
+      KCmMaxPasswordLength, EConvPassword, R_AVKON_NUMERIC_PASSWORD_BLANKING_TEXT, NULL, NULL },
+    { EPacketDataIFAuthRetries, KCDTIdWCDMAIfAuthRetries, NULL },
+    { EPacketDataIPNetmask, KCDTIdWCDMAIPNetMask, &CheckIPv4ValidityL },
+    { EPacketDataIPGateway, KCDTIdWCDMAIPGateway, &CheckIPv4ValidityL },
+    { EPacketDataIPAddrFromServer, KCDTIdWCDMAIPAddrFromServer, NULL },
+    { EPacketDataIPAddr, KCDTIdWCDMAIPAddr, &CheckIPv4ValidityL,
+      R_QTN_SET_IP_ADDRESS,
+      KIpAddressWidth, EConvIPv4, R_QTN_SET_IP_ADDRESS_DYNAMIC, 0, NULL, NULL },
+    { EPacketDataIPDNSAddrFromServer, KCDTIdWCDMAIPDNSAddrFromServer, NULL,
+      R_QTN_SET_DNS_SERVERS_IP,
+      0, 0, 0, 0, NULL, NULL },
+    { EPacketDataIPNameServer1, KCDTIdWCDMAIPNameServer1, &CheckIPv4ValidityL,
+      R_QTN_SET_PRIMARY_DNS,
+      KMaxIPv4NameServerLength, EConvIPv4, R_QTN_SET_DNS_SERVERS_AUTOMATIC, 0, NULL, NULL },
+    { EPacketDataIPNameServer2, KCDTIdWCDMAIPNameServer2, &CheckIPv4ValidityL,
+      R_QTN_SET_SECONDARY_DNS,
+      KMaxIPv4NameServerLength, EConvIPv4, R_QTN_SET_DNS_SERVERS_AUTOMATIC, 0, NULL, NULL },
+    { EPacketDataIPIP6DNSAddrFromServer, KCDTIdWCDMAIP6DNSAddrFromServer, NULL,
+      R_QTN_SET_DNS_SERVERS_IP,
+      0, 0, 0, NULL, NULL },
+    { EPacketDataIPIP6NameServer1, KCDTIdWCDMAIP6NameServer1, &CheckIPv6ValidityL },
+    { EPacketDataIPIP6NameServer2, KCDTIdWCDMAIP6NameServer2, &CheckIPv6ValidityL },
+    { EPacketDataIPAddrLeaseValidFrom, KCDTIdWCDMAIPAddrLeaseValidFrom, NULL },
+    { EPacketDataIPAddrLeaseValidTo, KCDTIdWCDMAIPAddrLeaseValidTo, NULL },
+    { EPacketDataConfigDaemonManagerName, KCDTIdWCDMAConfigDaemonManagerName, NULL },
+    { EPacketDataConfigDaemonName, KCDTIdWCDMAConfigDaemonName, NULL },
+    { EPacketDataEnableLcpExtension, KCDTIdWCDMAEnableLCPExtensions, NULL },
+    { EPacketDataDisablePlainTextAuth, KCDTIdWCDMADisablePlainTextAuth, NULL,
+      R_QTN_SET_PASSWD_AUT,
+      0, 0, 0, NULL, NULL },
+    { EPacketDataApType, KCDTIdAPType, NULL },
+    { EPacketDataQoSWarningTimeOut, KCDTIdQOSWarningTimeOut, NULL },
+    { EPacketDataServiceEnableLLMNR, KCDTIdServiceEnableLlmnr, NULL },
+    { 0, 0, NULL }
+};
+
+static const TCmAttribConvTable SQoSDataConvTbl[] =
+    {
+    // iAttribId, iCommsDatId, iValidFuncL, 
+    // iTitleId, 
+    // iMaxLength, iAttribFlags, iDefValueResId, iEditorResId, iNotUsed1, iNotUsed2
+    { EGPRSReqTrafficClass, EPacketDataRangeMax, NULL },
+    { EGPRSReqTrafficClass, KCDTIdWCDMAReqTrafficClass, NULL },
+    { EGPRSMinTrafficClass, KCDTIdWCDMAMinTrafficClass, NULL },
+    { EGPRSReqDeliveryOrder, KCDTIdWCDMAReqDeliveryOrder, NULL },
+    { GPRSMinDeliveryOrder, KCDTIdWCDMAMinDeliveryOrder, NULL },
+    { EGPRSReqDeliverErroneousSDU, KCDTIdWCDMAReqDeliverErroneousSDU, NULL },
+    { EGPRSMinDeliverErroneousSDU, KCDTIdWCDMAMinDeliverErroneousSDU, NULL },
+    { EGPRSReqMaxSDUSize, KCDTIdWCDMAReqMaxSDUSize, NULL },
+    { EGPRSMinAcceptableMaxSDUSize, KCDTIdWCDMAMinAcceptableMaxSDUSize, NULL },
+    { EGPRSReqMaxUplinkRate, KCDTIdWCDMAReqMaxUplinkRate, NULL },
+    { EGPRSReqMinUplinkRate, KCDTIdWCDMAReqMinUplinkRate, NULL },
+    { EGPRSReqMaxDownlinkRate, KCDTIdWCDMAReqMaxDownlinkRate, NULL },
+    { EGPRSReqMinDownlinkRate, KCDTIdWCDMAReqMinDownlinkRate, NULL },
+    { EGPRSReqBER, KCDTIdWCDMAReqBER, NULL },
+    { EGPRSMaxBER, KCDTIdWCDMAMaxBER, NULL },
+    { EGPRSReqSDUErrorRatio, KCDTIdWCDMAReqSDUErrorRatio, NULL },
+    { EGPRSMaxSDUErrorRatio, KCDTIdWCDMAMaxSDUErrorRatio, NULL },
+    { EGPRSReqTrafficHandlingPriority, KCDTIdWCDMAReqTrafficHandlingPriority, NULL },
+    { EGPRSMinTrafficHandlingPriority, KCDTIdWCDMAMinTrafficHandlingPriority, NULL },
+    { EGPRSReqTransferDelay, KCDTIdWCDMAReqTransferDelay, NULL },
+    { EGPRSMaxTransferDelay, KCDTIdWCDMAMaxTransferDelay, NULL },
+    { EGPRSReqGuaranteedUplinkRate, KCDTIdWCDMAReqGuaranteedUplinkRate, NULL },
+    { EGPRSMinGuaranteedUplinkRate, KCDTIdWCDMAMinGuaranteedUplinkRate, NULL },
+    { EGPRSReqGuaranteedDownlinkRate, KCDTIdWCDMAReqGuaranteedDownlinkRate, NULL },
+    { EGPRSMinGuaranteedDownlinkRate, KCDTIdWCDMAMinGuaranteedDownlinkRate, NULL },
+    { EGPRSSignallingIndication, KCDTIdWCDMASignallingIndication, NULL },
+    { EGPRS_ImCnSignallingIndication, KCDTIdWCDMAImCmSignallingIndication, NULL },
+    { EGPRSSourceStatisticsDescriptor, KCDTIdWCDMASourceStatisticsDescriptor, NULL },
+    { 0, 0, NULL }
+    };
+
+static const TCmCommonAttrConvArrayItem SCommonConvTbl[] =
+{
+    { EPacketDataIFParams, ECmIFParams },
+    { EPacketDataIFNetworks, ECmIFNetworks },
+    { EPacketDataIFPromptForAuth, ECmIFPromptForAuth },
+    { EPacketDataIFAuthName, ECmIFAuthName },
+    { EPacketDataIFAuthPass, ECmIFAuthPass },
+    { EPacketDataIFAuthRetries, ECmIFAuthRetries },
+    { EPacketDataIPNetmask, ECmIPNetmask },
+    { EPacketDataIPGateway, ECmIPGateway },
+    { EPacketDataIPAddrFromServer, ECmIPAddFromServer },
+    { EPacketDataIPAddr, ECmIPAddress },
+    { EPacketDataIPDNSAddrFromServer, ECmIPDNSAddrFromServer },
+    { EPacketDataIPNameServer1, ECmIPNameServer1 },
+    { EPacketDataIPNameServer2, ECmIPNameServer2 },
+    { EPacketDataIPIP6DNSAddrFromServer, ECmIP6DNSAddrFromServer },
+    { EPacketDataIPIP6NameServer1, ECmIP6NameServer1 },
+    { EPacketDataIPIP6NameServer2, ECmIP6NameServer2 },
+    { EPacketDataIPAddrLeaseValidFrom, ECmIPAddrLeaseValidFrom },
+    { EPacketDataIPAddrLeaseValidTo, ECmIPAddrLeaseValidTo },
+    { EPacketDataConfigDaemonManagerName, ECmConfigDaemonManagerName },
+    { EPacketDataConfigDaemonName, ECmConfigDaemonName },
+    { EPacketDataEnableLcpExtension, ECmEnableLPCExtension },
+    { EPacketDataDisablePlainTextAuth, ECmDisablePlainTextAuth },
+    { 0, 0 }
+    };
+    
+// ======== LOCAL FUNCTIONS ========
+    
+static TBool SetPDPTypeL( CCmPluginBaseEng* aThis, 
+                          TUint32 aAttribute, 
+                          const TAny* aValue )
+    {
+    (void)aAttribute;
+    CCmPluginPacketData* myThis = static_cast<CCmPluginPacketData*>( aThis );
+    
+    myThis->SetPDPTypeL( (RPacketContext::TProtocolType)(TInt)aValue );
+    
+    return ETrue;
+    }
+
+// ======== MEMBER FUNCTIONS ========
+
+class CCmPDCoverageCheck : public CActive
+    {
+    enum EPacketCoverageState
+        {
+        EServiceStatus,
+        EPDPAttach,
+        EPDPDetach,                        
+        };
+        
+    public:
+    
+        CCmPDCoverageCheck();
+        ~CCmPDCoverageCheck();
+        
+        TBool IsThereCoverageL();
+        
+    protected:  // from CActive
+    
+        virtual void DoCancel();
+        virtual void RunL();
+
+    private:
+
+        TUint32                 iProgState;
+        TBool                   iCoverage;
+        CActiveSchedulerWait    iWait;    
+        RTelServer              iServer;
+        RPhone                  iPhone;
+        RPacketService          iService;        
+    };
+
+// ----------------------------------------------------------------------------
+// CCmPDCoverageCheck::CCmPDCoverageCheck()
+// ----------------------------------------------------------------------------
+//
+CCmPDCoverageCheck::CCmPDCoverageCheck() : CActive( EPriorityStandard )
+    {
+    CActiveScheduler::Add( this );
+    }
+    
+// ----------------------------------------------------------------------------
+// CCmPDCoverageCheck::~CCmPDCoverageCheck()
+// ----------------------------------------------------------------------------
+//
+CCmPDCoverageCheck::~CCmPDCoverageCheck()
+    {
+    Cancel();
+
+    iService.Close();
+    iPhone.Close();
+    iServer.Close();
+    }
+    
+// ----------------------------------------------------------------------------
+// CCmPDCoverageCheck::DoCancel
+// ----------------------------------------------------------------------------
+//
+void CCmPDCoverageCheck::DoCancel()
+    {
+    iWait.AsyncStop();
+    }
+    
+// ----------------------------------------------------------------------------
+// CCmPDCoverageCheck::RunL
+// ----------------------------------------------------------------------------
+//
+void CCmPDCoverageCheck::RunL()
+    {
+    switch( iProgState )
+        {
+        case EPDPAttach:
+            {
+            if( !iStatus.Int() )
+                // PDP context created -> there's a usable PD coverage.
+                {
+                iService.Detach( iStatus );
+                SetActive();
+
+                iCoverage = ETrue;
+                iProgState = EPDPDetach;
+                }
+            else
+                // something went wrong -> no coverage.
+                {
+                iWait.AsyncStop();
+                }
+            }
+            break;
+            
+        case EPDPDetach:
+            {
+            iWait.AsyncStop();
+            }
+            break;
+            
+        default:
+            {
+            User::Leave( KErrCorrupt );
+            }
+        }
+    }
+    
+// ----------------------------------------------------------------------------
+// CCmPDCoverageCheck::IsThereCoverageL
+// ----------------------------------------------------------------------------
+//
+TBool CCmPDCoverageCheck::IsThereCoverageL()
+    {
+    iProgState = EServiceStatus;
+    iCoverage = EFalse;
+    
+    User::LeaveIfError( iServer.Connect() );
+    CLOG_WRITE( "Server open" );
+    
+    RTelServer::TPhoneInfo info;
+    User::LeaveIfError( iServer.GetPhoneInfo( 0, info ) );
+    CLOG_WRITE( "Phone info ok" );
+    
+    User::LeaveIfError( iPhone.Open(iServer, info.iName ) );
+    CLOG_WRITE( "Phone open" );
+
+    User::LeaveIfError( iService.Open( iPhone ) );
+    CLOG_WRITE( "service ok" );
+
+    RPacketService::TStatus status;
+    User::LeaveIfError( iService.GetStatus( status ) );
+    if( status == RPacketService::EStatusAttached ||
+        status == RPacketService::EStatusActive || 
+        status == RPacketService::EStatusSuspended )
+        // Attached/active/suspened, so there's a coverage
+        {
+        iCoverage = ETrue;
+        }
+    else if( status == RPacketService::EStatusUnattached )
+        {
+        iProgState = EPDPAttach;
+        iService.Attach( iStatus );
+        SetActive();
+        iWait.Start();
+        }
+    else
+        {
+        CLOG_WRITE( "Unknown state" );
+        }
+        
+
+    User::LeaveIfError( iStatus.Int() );
+    
+    return iCoverage;
+    }
+
+// ----------------------------------------------------------------------------
+// CCmPluginPacketData::NewOutgoingL
+// ----------------------------------------------------------------------------
+//
+CCmPluginPacketData* CCmPluginPacketData::NewL(
+                                            TCmPluginInitParam* aInitParam )
+	{
+	CCmPluginPacketData* self = new ( ELeave ) CCmPluginPacketData( 
+	                                                    aInitParam, ETrue );
+	CleanupStack::PushL( self );
+	self->ConstructL();
+	CleanupStack::Pop( self );
+	return self;
+	}
+
+// ----------------------------------------------------------------------------
+// CCmPluginPacketData::~CCmPluginPacketData
+// ----------------------------------------------------------------------------
+//
+CCmPluginPacketData::~CCmPluginPacketData()
+	{
+	CCmPluginPacketData::AdditionalReset();	
+	RemoveResourceFile( KPluginPacketDataResDirAndFileName );	
+	CLOG_CLOSE;
+	}
+
+// ----------------------------------------------------------------------------
+// CCmPluginPacketData::CreateInstanceL
+// ----------------------------------------------------------------------------
+//
+CCmPluginBaseEng* CCmPluginPacketData::CreateInstanceL( TCmPluginInitParam& aInitParam ) const
+    {
+    CCmPluginPacketData* self = new( ELeave ) CCmPluginPacketData( &aInitParam, ETrue );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+    
+// ----------------------------------------------------------------------------
+// CCmPluginPacketData::CCmPluginPacketData
+// ----------------------------------------------------------------------------
+//
+CCmPluginPacketData::CCmPluginPacketData( TCmPluginInitParam* aInitParam,
+                                          TBool aOutgoing )
+    : CCmPluginBaseEng( aInitParam )
+    , iOutgoing( aOutgoing )
+	{
+	CLOG_CREATE;
+	
+	iBearerType = KUidPacketDataBearerType;
+	}
+
+// ----------------------------------------------------------------------------
+// CCmPluginPacketData::ConstructL
+// ----------------------------------------------------------------------------
+//
+void CCmPluginPacketData::ConstructL()
+	{
+	CCmPluginBaseEng::ConstructL();
+
+    AddResourceFileL( KPluginPacketDataResDirAndFileName );
+	AddConverstionTableL( (CCDRecordBase**)&iServiceRecord, NULL, SPacketDataConvTbl );
+    AddConverstionTableL( (CCDRecordBase**)&iPacketDataQoSRecord, NULL, SQoSDataConvTbl );
+	AddCommonConversionTableL( SCommonConvTbl );
+	}
+	
+// ----------------------------------------------------------------------------
+// CCmPluginPacketData::GetIntAttributeL()
+// ----------------------------------------------------------------------------
+//
+TUint32 CCmPluginPacketData::GetIntAttributeL( const TUint32 aAttribute ) const
+	{
+    LOGGER_ENTERFN( "CCmPluginPacketData::GetIntAttributeL" );
+
+    TUint32 retVal( 0 );
+    
+    switch( aAttribute )
+        {
+        case ECmBearerIcon:
+            {
+            TAknsItemID id;
+            MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
+                   
+            TParse mbmFile;
+            User::LeaveIfError( mbmFile.Set( KPacketDataFileIcons, 
+                                                    &KDC_BITMAP_DIR, NULL ) );
+
+                   
+            retVal = (TUint32)AknsUtils::CreateGulIconL( 
+                                    skinInstance, 
+                                    id,
+                                    mbmFile.FullName(), 
+                                    EMbmCmpluginpacketdataQgn_prop_wml_gprs, 
+                                    EMbmCmpluginpacketdataQgn_prop_wml_gprs_mask );
+            }
+            break;
+               
+        case ECmBearerAvailableIcon:
+            {
+            TAknsItemID id;
+            MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
+                   
+            TParse mbmFile;
+            User::LeaveIfError( mbmFile.Set( KPacketDataFileIcons, &KDC_BITMAP_DIR, NULL ) );
+                   
+            retVal = (TUint32)AknsUtils::CreateGulIconL( 
+                    skinInstance, 
+                    id,
+                    mbmFile.FullName(), 
+                    EMbmCmpluginpacketdataQgn_prop_set_conn_bearer_avail_packetdata, 
+                    EMbmCmpluginpacketdataQgn_prop_set_conn_bearer_avail_packetdata_mask );
+            }
+            break;
+            
+        case ECmCommsDBBearerType:
+            {
+            retVal = KCommDbBearerWcdma;
+            }
+            break;
+            
+        case ECmDefaultUiPriority:
+        case ECmDefaultPriority:
+            {
+            TPtrC buf;
+            
+            if( iOutgoing )
+                {
+                buf.Set( KCDTypeNameOutgoingWCDMA );
+                }
+            else
+                {
+                buf.Set( KCDTypeNameIncomingWCDMA );
+                }
+
+            retVal = aAttribute == ECmDefaultPriority ?
+                     GlobalBearerPriority( buf ) :
+                     GlobalUiBearerPriority( buf );
+            
+            if( retVal == KDataMobilitySelectionPolicyPriorityWildCard )
+                {
+                retVal = KDefaultPriorityPacketData;
+                }
+            }
+            break;
+            
+        default:
+            {
+            retVal = CCmPluginBaseEng::GetIntAttributeL( aAttribute );
+            }
+            break;
+        }
+        
+    return retVal;
+	}
+
+// ----------------------------------------------------------------------------
+// CCmPluginPacketData::GetBoolAttributeL()
+// ----------------------------------------------------------------------------
+//
+TBool CCmPluginPacketData::GetBoolAttributeL( const TUint32 aAttribute ) const
+	{
+    LOGGER_ENTERFN( "CCmPluginPacketData::GetBoolAttributeL" );
+
+    TBool retVal( EFalse );
+
+    switch( aAttribute )
+        {
+        case EPacketDataOutGoing:
+            {
+            retVal = iOutgoing;
+            }
+            break;
+            
+        case ECmCoverage:
+            // In default the plugin has no network coverage
+            {
+            retVal = CheckNetworkCoverageL();
+            }
+            break;
+            
+        case ECmAddToAvailableList:
+            {
+            retVal = ETrue;
+            }
+            break;
+            
+        case ECmBearerHasUi:
+            {
+            retVal = ETrue;
+            }
+            break;
+            
+        default:
+            {
+            retVal = CCmPluginBaseEng::GetBoolAttributeL( aAttribute );
+            }
+        }
+        
+    return retVal;
+	}
+
+// ----------------------------------------------------------------------------
+// CCmPluginPacketData::GetStringAttributeL()
+// ----------------------------------------------------------------------------
+//
+HBufC* CCmPluginPacketData::GetStringAttributeL( const TUint32 aAttribute ) const
+	{
+    LOGGER_ENTERFN( "CCmPluginPacketData::GetStringAttributeL" );
+
+	HBufC* retVal = NULL;
+	
+	switch( aAttribute )
+	    {
+	    case ECmBearerAvailableName:
+	        {
+	        retVal = AllocReadL( R_QTN_NETW_CONSET_BEARER_AVAILABLE_PACKET_DATA );
+	        }
+	        break;
+	        
+	    case ECmBearerSupportedName:
+	        {
+	        retVal = AllocReadL( R_QTN_NETW_CONSET_BEARER_SUPPORTED_PACKET_DATA );
+	        }
+	        break;
+	        
+        case ECmBearerAvailableText:
+            {
+            retVal = AllocReadL( R_QTN_NETW_CONSET_PACKET_DATA_AVAILABLE );
+            }
+            break;
+            
+	    case ECmBearerNamePopupNote:
+	        {
+	        retVal = AllocReadL( R_QTN_NETW_CONSET_POPUP_BEARER_PACKET_DATA );
+	        }
+	        break;
+
+	    case ECmBearerSettingName:
+	        {
+	        retVal = AllocReadL( R_QTN_SET_BEARER_PACKET_DATA );
+	        }
+	        break;
+	        
+	    default:
+	        {
+	        retVal = CCmPluginBaseEng::GetStringAttributeL( aAttribute );
+	        }
+	        break;
+	    }
+	    
+    return retVal;
+	}
+
+// ----------------------------------------------------------------------------
+// CCmPluginPacketData::SetIntAttributeL()
+// ----------------------------------------------------------------------------
+//
+void CCmPluginPacketData::SetIntAttributeL( const TUint32 aAttribute, 
+                                            TUint32 aValue )
+	{
+    LOGGER_ENTERFN( "CCmPluginPacketData::SetIntAttributeL" );
+
+    switch( aAttribute )
+        {
+        default:
+            {
+            CCmPluginBaseEng::SetIntAttributeL( aAttribute, aValue );
+            }
+        }
+	}
+
+// ----------------------------------------------------------------------------
+// CCmPluginPacketData::SetBoolAttributeL()
+// ----------------------------------------------------------------------------
+//
+void CCmPluginPacketData::SetBoolAttributeL( const TUint32 aAttribute, 
+                                             TBool aValue )
+	{
+    LOGGER_ENTERFN( "CCmPluginPacketData::SetBoolAttributeL" );
+
+    switch( aAttribute )
+        {
+        case EPacketDataOutGoing:
+            {
+            iOutgoing = aValue;
+            CreateNewServiceRecordL();
+            }
+            break;
+        
+        default:
+            {
+            CCmPluginBaseEng::SetBoolAttributeL( aAttribute, aValue );
+            }
+        }
+	}
+
+// ----------------------------------------------------------------------------
+// CCmPluginPacketData::SetStringAttributeL()
+// ----------------------------------------------------------------------------
+//
+void CCmPluginPacketData::SetStringAttributeL( const TUint32 aAttribute, 
+                                               const TDesC16& aValue )
+	{
+    LOGGER_ENTERFN( "CCmPluginPacketData::SetStringAttributeL" );
+
+    switch( aAttribute )
+        {
+        default:
+            {
+            CCmPluginBaseEng::SetStringAttributeL( aAttribute, aValue );
+            }
+        }
+	}
+
+// ----------------------------------------------------------------------------
+// CCmPluginPacketData::PrepareToUpdateRecordsL()
+// ----------------------------------------------------------------------------
+//
+void CCmPluginPacketData::PrepareToUpdateRecordsL()
+    {
+    LOGGER_ENTERFN( "CCmPluginPacketData::PrepareToUpdateRecordsL" );
+
+    CheckDNSServerAddressL( ETrue, 
+                            ServiceRecord().iGPRSIP6NameServer1,
+                            ServiceRecord().iGPRSIP6NameServer2,
+                            ServiceRecord().iGPRSIP6DNSAddrFromServer );
+                            
+    CheckDNSServerAddressL( EFalse,
+                            ServiceRecord().iGPRSIPNameServer1,
+                            ServiceRecord().iGPRSIPNameServer2,
+                            ServiceRecord().iGPRSIPDNSAddrFromServer );
+    SetDaemonNameL();
+    }
+    
+// ----------------------------------------------------------------------------
+// CCmPluginPacketData::CanHandleIapIdL()
+// ----------------------------------------------------------------------------
+//
+TBool CCmPluginPacketData::CanHandleIapIdL( TUint32 aIapId ) const
+    {
+    LOGGER_ENTERFN( "CCmPluginPacketData::CanHandleIapIdL1" );
+    CLOG_WRITE_1( "IapId: [%d]", aIapId );
+    
+    TBool retVal( EFalse );
+    
+    CCDIAPRecord *iapRecord = static_cast<CCDIAPRecord *>
+                            (CCDRecordBase::RecordFactoryL(KCDTIdIAPRecord));
+        
+    CleanupStack::PushL( iapRecord );
+    iapRecord->SetRecordId( aIapId );
+    
+    TRAPD( err, iapRecord->LoadL( Session() ));
+
+    if( !err )
+        {
+        CanHandleIapIdL( iapRecord );
+        }
+    
+    CleanupStack::PopAndDestroy( iapRecord );
+    return retVal;
+    }
+
+// ----------------------------------------------------------------------------
+// CCmPluginPacketData::CanHandleIapIdL()
+// ----------------------------------------------------------------------------
+//
+TBool CCmPluginPacketData::CanHandleIapIdL( CCDIAPRecord *aIapRecord ) const
+    {
+    LOGGER_ENTERFN( "CCmPluginPacketData::CanHandleIapIdL2" );
+    CLOG_WRITE_1( "IapId: [%d]", aIapRecord->RecordId() );
+    
+    TBool retVal( EFalse );
+    
+    CLOG_WRITE_2( "IAP record: [%S][%S]",
+                    &FIELD_TO_TDESC(aIapRecord->iServiceType), 
+                    &FIELD_TO_TDESC(aIapRecord->iBearerType)
+                );
+    
+    if( (TPtrC(aIapRecord->iServiceType) == TPtrC(KCDTypeNameOutgoingWCDMA) ||
+        TPtrC(aIapRecord->iServiceType) == TPtrC(KCDTypeNameIncomingWCDMA)) &&
+        TPtrC(aIapRecord->iBearerType) == TPtrC(KCDTypeNameModemBearer) )
+        {
+        CLOG_WRITE( "I can." );
+        retVal = ETrue;
+        }
+
+    return retVal;
+    }
+
+// ----------------------------------------------------------------------------
+// CCmPluginPacketData::RunSettingsL()
+// ----------------------------------------------------------------------------
+//        
+TInt CCmPluginPacketData::RunSettingsL()
+	{
+    CmPluginPacketDataSettingsDlg* settingsDlg = 
+                                CmPluginPacketDataSettingsDlg::NewL( *this );
+    return settingsDlg->ConstructAndRunLD( );       
+    }        
+
+// ----------------------------------------------------------------------------
+// CCmPluginPacketData::LoadServiceSettingL()
+// ----------------------------------------------------------------------------
+//        
+void CCmPluginPacketData::LoadServiceSettingL()
+    {
+    LOGGER_ENTERFN( "CCmPluginPacketData::LoadServiceSettingL" );
+    
+    if( TPtrC(KCDTypeNameOutgoingWCDMA) == iIapRecord->iServiceType  )
+        {
+        iServiceRecord = static_cast<CCDServiceRecordBase *>
+                    (CCDRecordBase::RecordFactoryL(KCDTIdOutgoingGprsRecord));
+        iOutgoing = ETrue;
+        }
+    else if( TPtrC(KCDTypeNameIncomingWCDMA) == iIapRecord->iServiceType )
+        {
+        iServiceRecord = static_cast<CCDServiceRecordBase *>
+                    (CCDRecordBase::RecordFactoryL(KCDTIdIncomingGprsRecord));
+        iOutgoing = EFalse;
+        }
+    else
+        // this IAP service is not supported by this plugin.
+        {
+        User::Leave( KErrNotSupported );
+        }
+
+    CCmPluginBaseEng::LoadServiceSettingL();
+
+    CLOG_WRITE_1( "APName: [%S]", &FIELD_TO_TDESC( ServiceRecord().iGPRSAPN ) );
+    }
+
+// ----------------------------------------------------------------------------
+// CCmPluginPacketData::InitializeWithUiL()
+// ----------------------------------------------------------------------------
+//        
+TBool CCmPluginPacketData::InitializeWithUiL( TBool /*aManuallyConfigure*/ )
+    {
+    LOGGER_ENTERFN( "CCmPluginPacketData::InitializeWithUiL" );    
+    TBool retval = ETrue;   // meaning that everything was fine.
+
+    // Add resource file for the duration of this method only.
+    TParse parser;
+    User::LeaveIfError( parser.Set( KPluginPacketDataResDirAndFileName, 
+                                    &KDC_RESOURCE_FILES_DIR, 
+                                    NULL ) );
+
+    TFileName resourceFileNameBuf = parser.FullName();
+
+    RConeResourceLoader resLoader( *CEikonEnv::Static() ) ;
+    resLoader.OpenL( resourceFileNameBuf );
+    CleanupClosePushL( resLoader );
+
+    // Show dialog
+    TBuf<KMaxGprsApNameLength> buf;
+    CAknTextQueryDialog* dlg = new (ELeave) CAknTextQueryDialog( buf );
+
+    // Must use PrepareLC instead of ExecuteLD in order for
+    // MakeLeftSoftkeyVisible() call to work.
+    dlg->PrepareLC( R_APN_NAME_QUERY );
+
+    dlg->SetMaxLength( KMaxGprsApNameLength );
+    dlg->MakeLeftSoftkeyVisible( ETrue );   // Empty input accepted.
+
+    HBufC* prompt = StringLoader::LoadLC( R_GPRS_PLUGIN_APN_PROMPT );
+    dlg->SetPromptL( *prompt );
+    CleanupStack::PopAndDestroy( prompt );
+
+    // Strange, but true: RunLD returns 0 (instead of the actual command id)
+    // if Cancel button was pressed, thus we have to check against zero here.
+    if ( dlg->RunLD() )
+        {
+        // Change APN attribute in connection method
+        SetStringAttributeL( EPacketDataAPName, buf );
+        
+        if( buf.Length() )
+            {
+            SetStringAttributeL( ECmName, buf );
+            }
+        }
+    else
+        {
+        retval = EFalse;    // indicating cancellation.
+        }
+
+    // Clean-up
+    CleanupStack::PopAndDestroy( &resLoader );
+
+    return retval;
+    }
+
+
+// ----------------------------------------------------------------------------
+// CCmPluginPacketData::ServiceRecord()
+// ----------------------------------------------------------------------------
+//        
+CCDWCDMAPacketServiceRecord& CCmPluginPacketData::ServiceRecord() const
+    {
+    LOGGER_ENTERFN( "CCmPluginPacketData::ServiceRecord" );
+
+    return *static_cast<CCDWCDMAPacketServiceRecord*>(iServiceRecord);
+    }
+    
+// ----------------------------------------------------------------------------
+// CCmPluginPacketData::CreateNewServiceRecordL()
+// ----------------------------------------------------------------------------
+//        
+void CCmPluginPacketData::CreateNewServiceRecordL()
+    {
+    LOGGER_ENTERFN( "CCmPluginPacketData::CreateNewServiceRecordL" );
+
+    delete iServiceRecord; iServiceRecord = NULL;
+    
+    if( iOutgoing )
+        {
+        iServiceRecord = static_cast<CCDServiceRecordBase *>
+                    (CCDRecordBase::RecordFactoryL(KCDTIdOutgoingGprsRecord));
+        }
+    else
+        {
+        iServiceRecord = static_cast<CCDServiceRecordBase *>
+                    (CCDRecordBase::RecordFactoryL(KCDTIdIncomingGprsRecord));
+        }
+
+    ServiceRecord().iGPRSAPN.SetL( KNullDesC );
+    ServiceRecord().iGPRSPDPType.SetL( RPacketContext::EPdpTypeIPv4 );
+    ServiceRecord().iGPRSReqPrecedence = 0;
+	ServiceRecord().iGPRSReqDelay = 0;
+	ServiceRecord().iGPRSReqReliability = 0;
+	ServiceRecord().iGPRSReqPeakThroughput = 0;
+	ServiceRecord().iGPRSReqMeanThroughput = 0;
+	ServiceRecord().iGPRSMinPrecedence = 0;
+	ServiceRecord().iGPRSMinDelay = 0;
+	ServiceRecord().iGPRSMinReliability = 0;
+	ServiceRecord().iGPRSMinPeakThroughput = 0;
+	ServiceRecord().iGPRSMinMeanThroughput = 0;
+	ServiceRecord().iGPRSDataCompression = 0;
+	ServiceRecord().iGPRSHeaderCompression = 0;
+	ServiceRecord().iGPRSAnonymousAccess = 0;
+    ServiceRecord().iGPRSIfNetworks.SetL( KDefIspIfNetworksIPv4 );
+    ServiceRecord().iGPRSIfPromptForAuth = EFalse;
+    ServiceRecord().iGPRSIfAuthRetries = 0;
+    ServiceRecord().iGPRSIPGateway.SetL( KUnspecifiedIPv4 );
+    ServiceRecord().iGPRSIPAddrFromServer = ETrue;
+    ServiceRecord().iGPRSIPAddr.SetL( KUnspecifiedIPv4 );
+    ServiceRecord().iGPRSIPDNSAddrFromServer = ETrue;
+    ServiceRecord().iGPRSIPNameServer1.SetL( KUnspecifiedIPv4 );
+    ServiceRecord().iGPRSIPNameServer2.SetL( KUnspecifiedIPv4 );
+    ServiceRecord().iGPRSIP6DNSAddrFromServer = ETrue;
+    ServiceRecord().iGPRSIP6NameServer1.SetL( KDynamicIpv6Address );
+    ServiceRecord().iGPRSIP6NameServer2.SetL( KDynamicIpv6Address );
+    ServiceRecord().iGPRSEnableLCPExtension = EFalse;
+    ServiceRecord().iGPRSDisablePlainTextAuth = ETrue;
+    ServiceRecord().iGPRSAPType = EPacketDataBoth;
+    ServiceRecord().iGPRSQOSWarningTimeOut = TUint32(-1);
+    }
+
+// ----------------------------------------------------------------------------
+// CCmPluginPacketData::ServiceRecordIdLC
+// ----------------------------------------------------------------------------
+//
+void CCmPluginPacketData::ServiceRecordIdLC( HBufC* &aName, 
+                                             TUint32& aRecordId )
+    {
+    LOGGER_ENTERFN( "CCmPluginPacketData::ServiceRecordIdLC" );
+
+    if( iOutgoing )
+        {
+        aName = TPtrC( KCDTypeNameOutgoingWCDMA ).AllocLC();
+        }
+    else
+        {
+        aName = TPtrC( KCDTypeNameIncomingWCDMA ).AllocLC();
+        }
+        
+    aRecordId = iServiceRecord->RecordId();
+    }
+
+// ----------------------------------------------------------------------------
+// CCmPluginPacketData::BearerRecordIdLC()
+// ----------------------------------------------------------------------------
+//        
+void CCmPluginPacketData::BearerRecordIdLC( HBufC* &aBearerName, 
+                                            TUint32& aRecordId )
+    {
+    LOGGER_ENTERFN( "CCmPluginPacketData::BearerRecordIdLC" );
+
+	CMDBRecordSet<CCDModemBearerRecord>* bearerRS = 
+	        new(ELeave) CMDBRecordSet<CCDModemBearerRecord>(KCDTIdModemBearerRecord);
+	CleanupStack::PushL( bearerRS );
+    
+    CCDModemBearerRecord* bearerRecord = static_cast<CCDModemBearerRecord *>
+                            (CCDRecordBase::RecordFactoryL(KCDTIdModemBearerRecord));
+                                    
+    CleanupStack::PushL( bearerRecord );
+    
+    bearerRecord->iRecordName.SetL( KModemBearerPacketData );
+    bearerRS->iRecords.AppendL( bearerRecord );
+    CleanupStack::Pop( bearerRecord );
+    
+    if( bearerRS->FindL( Session() ) )
+        {
+        CLOG_WRITE_1( "Bearers: [%d]", bearerRS->iRecords.Count() );
+
+        bearerRecord = static_cast<CCDModemBearerRecord*>(bearerRS->iRecords[0]);
+        aRecordId = bearerRecord->RecordId();
+        }
+    else
+        // bearer not found -> create dummy values
+        {
+        CLOG_WRITE( "No bearer record found" );
+
+        bearerRecord->SetRecordId( KCDNewRecordRequest );
+        bearerRecord->StoreL( Session() );
+        
+        aRecordId = bearerRecord->RecordId();
+        }
+
+    CleanupStack::PopAndDestroy( bearerRS );
+
+    aBearerName = TPtrC(KCDTypeNameModemBearer).AllocLC();
+    }
+
+// ----------------------------------------------------------------------------
+// CCmPluginPacketData::CheckNetworkCoverageL()
+// ----------------------------------------------------------------------------
+//        
+TBool CCmPluginPacketData::CheckNetworkCoverageL() const
+    {
+    LOGGER_ENTERFN("CCmPluginPacketData::CheckNetworkCoverageL");
+    
+    TBool retVal( EFalse );
+    
+#ifdef __WINS__
+    retVal = ETrue;
+#else
+    CCmPDCoverageCheck* coverage = new (ELeave) CCmPDCoverageCheck;
+    CleanupStack::PushL( coverage );
+    
+    retVal = coverage->IsThereCoverageL();
+    
+    CleanupStack::PopAndDestroy( coverage );
+    
+#endif  // __WINS
+    return retVal;
+    }
+
+// ----------------------------------------------------------------------------
+// CCmPluginPacketData::SetPDPTypeL()
+// ----------------------------------------------------------------------------
+//        
+void CCmPluginPacketData::SetPDPTypeL( RPacketContext::TProtocolType aPdpType )
+    {
+    LOGGER_ENTERFN( "CCmPluginPacketData::SetPDPTypeL" );
+
+    if( aPdpType != RPacketContext::EPdpTypeIPv4 &&
+        aPdpType != RPacketContext::EPdpTypeIPv6 )
+        {
+        User::Leave( KErrArgument );
+        }
+        
+    if( FeatureSupported( KFeatureIdIPv6 ) && aPdpType == 
+        RPacketContext::EPdpTypeIPv6 )
+        {
+        ServiceRecord().iGPRSPDPType = RPacketContext::EPdpTypeIPv6;
+        ServiceRecord().iGPRSIfNetworks.SetL( KDefIspIfNetworksIPv6 );
+        }
+    else
+        {
+        if( aPdpType == RPacketContext::EPdpTypeIPv6 )
+            {
+            User::Leave( KErrNotSupported );
+            }
+            
+        ServiceRecord().iGPRSIfNetworks.SetL( KDefIspIfNetworksIPv4 );
+        ServiceRecord().iGPRSPDPType = RPacketContext::EPdpTypeIPv4;
+        }
+    }
+    
+// ----------------------------------------------------------------------------
+// CCmPluginPacketData::AdditionalReset()
+// ----------------------------------------------------------------------------
+//        
+void CCmPluginPacketData::AdditionalReset()
+    {
+    LOGGER_ENTERFN( "CCmPluginPacketData::AdditionalReset" );
+
+    delete iPacketDataQoSRecord;
+    iPacketDataQoSRecord = NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginPacketData::PrepareToCopyDataL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginPacketData::PrepareToCopyDataL( CCmPluginBaseEng* aDestInst ) const
+    {
+    LOGGER_ENTERFN( "CCmPluginPacketData::PrepareToCopyDataL" );
+
+    aDestInst->SetBoolAttributeL( EPacketDataOutGoing, iOutgoing );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCmPluginPacketData::SetDaemonNameL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginPacketData::SetDaemonNameL()
+    {
+    LOGGER_ENTERFN( "CCmPluginPacketData::SetDaemonNameL" );
+
+    // use DHCP if we can
+    TBool ipfromSrv = GetBoolAttributeL( ECmIPAddFromServer );
+    if ( ipfromSrv )
+        {
+        SetStringAttributeL( ECmConfigDaemonManagerName, 
+                           KDaemonManagerName );
+        SetStringAttributeL( ECmConfigDaemonName, 
+                           KConfigDaemonName );
+        }
+    else
+        {
+        if ( FeatureSupported( KFeatureIdIPv6 ) )
+            {
+            SetStringAttributeL( ECmConfigDaemonManagerName, 
+                               KDaemonManagerName );
+            SetStringAttributeL( ECmConfigDaemonName, 
+                               KConfigDaemonName );
+            }
+        else
+            {
+            SetStringAttributeL( ECmConfigDaemonManagerName, 
+                               KNullDesC() );
+            SetStringAttributeL( ECmConfigDaemonName, 
+                               KNullDesC() );
+            }
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCmPluginPacketData::CreateAdditionalRecordsL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginPacketData::CreateAdditionalRecordsL()
+    {
+    LOGGER_ENTERFN( "CCmPluginPacketData::CreateAdditionalRecordsL" );
+
+    delete iPacketDataQoSRecord;
+    iPacketDataQoSRecord = NULL;
+
+    iPacketDataQoSRecord = static_cast<CCDUmtsR99QoSAndOnTableRecord *>
+                           (CCDRecordBase::RecordFactoryL(KCDTIdUmtsR99QoSAndOnTableRecord));
+
+    iPacketDataQoSRecord->iGPRSReqTrafficClass = RPacketQoS::ETrafficClassUnspecified;
+    iPacketDataQoSRecord->iGPRSMinTrafficClass = RPacketQoS::ETrafficClassUnspecified;
+    iPacketDataQoSRecord->iGPRSReqDeliveryOrder = RPacketQoS::EDeliveryOrderUnspecified;
+    iPacketDataQoSRecord->iGPRSMinDeliveryOrder = RPacketQoS::EDeliveryOrderUnspecified;
+    iPacketDataQoSRecord->iGPRSReqDeliverErroneousSDU = RPacketQoS::EErroneousSDUDeliveryUnspecified;
+    iPacketDataQoSRecord->iGPRSMinDeliverErroneousSDU = RPacketQoS::EErroneousSDUDeliveryUnspecified;
+    iPacketDataQoSRecord->iGPRSReqMaxSDUSize = 0;
+    iPacketDataQoSRecord->iGPRSMinAcceptableMaxSDUSize = 0;
+    iPacketDataQoSRecord->iGPRSReqMaxUplinkRate = 0;
+    iPacketDataQoSRecord->iGPRSReqMinUplinkRate = 0;
+    iPacketDataQoSRecord->iGPRSReqMaxDownlinkRate = 0;
+    iPacketDataQoSRecord->iGPRSReqMinDownlinkRate = 0;
+    iPacketDataQoSRecord->iGPRSReqBER = RPacketQoS::EBERUnspecified;
+    iPacketDataQoSRecord->iGPRSMaxBER = RPacketQoS::EBERUnspecified;
+    iPacketDataQoSRecord->iGPRSReqSDUErrorRatio = RPacketQoS::ESDUErrorRatioUnspecified;
+    iPacketDataQoSRecord->iGPRSMaxSDUErrorRatio = RPacketQoS::ESDUErrorRatioUnspecified;
+    iPacketDataQoSRecord->iGPRSReqTrafficHandlingPriority = RPacketQoS::ETrafficPriorityUnspecified;
+    iPacketDataQoSRecord->iGPRSMinTrafficHandlingPriority = RPacketQoS::ETrafficPriorityUnspecified;
+    iPacketDataQoSRecord->iGPRSReqTransferDelay = 0;
+    iPacketDataQoSRecord->iGPRSMaxTransferDelay = 0;
+    iPacketDataQoSRecord->iGPRSReqGuaranteedUplinkRate = 0;
+    iPacketDataQoSRecord->iGPRSMinGuaranteedUplinkRate = 0;
+    iPacketDataQoSRecord->iGPRSReqGuaranteedDownlinkRate = 0;
+    iPacketDataQoSRecord->iGPRSMinGuaranteedDownlinkRate = 0;
+    iPacketDataQoSRecord->iGPRSSignallingIndication = EFalse;
+    iPacketDataQoSRecord->iGPRS_ImCnSignallingIndication = EFalse;
+    iPacketDataQoSRecord->iGPRSSourceStatisticsDescriptor = RPacketQoS::ESourceStatisticsDescriptorUnknown;
+    }
+
+// --------------------------------------------------------------------------
+// CCmPluginPacketData::DeleteAdditionalRecordsL
+// --------------------------------------------------------------------------
+//
+void CCmPluginPacketData::DeleteAdditionalRecordsL()
+    {
+    LOGGER_ENTERFN( "CCmPluginPacketData::DeleteAdditionalRecordsL" );    
+
+    // If packet record is common with other packet iaps, do not delete it!
+    if ( !TPtrC(iPacketDataQoSRecord->iRecordName).CompareF( KDefaultQosDataRecordName ) 
+         || !TPtrC(iPacketDataQoSRecord->iRecordName).CompareF( KDefaultQosDataRecordNamewithSpace ) )
+        {
+        return;
+        }
+    
+    iPacketDataQoSRecord->DeleteL( Session() );
+    }
+
+// --------------------------------------------------------------------------
+// CCmPluginPacketData::LoadAdditionalRecordsL()
+// --------------------------------------------------------------------------
+//        
+void CCmPluginPacketData::LoadAdditionalRecordsL()
+    {
+    LOGGER_ENTERFN( "CCmPluginPacketData::LoadAdditionalRecordsL" );
+
+    if ( ServiceRecord().iUmtsR99QoSAndOnTable )
+        {
+        iPacketDataQoSRecord = static_cast<CCDUmtsR99QoSAndOnTableRecord *>
+                           (CCDRecordBase::RecordFactoryL(KCDTIdUmtsR99QoSAndOnTableRecord));
+        
+        iPacketDataQoSRecord->SetRecordId( ServiceRecord().iUmtsR99QoSAndOnTable );
+
+        iPacketDataQoSRecord->LoadL( Session() );
+                
+//        AddConverstionTableL( (CCDRecordBase**)&iPacketDataQoSRecord, NULL, SQoSDataConvTbl );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginPacketData::UpdateAdditionalRecordsL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginPacketData::UpdateAdditionalRecordsL()
+    {
+    LOGGER_ENTERFN( "CCmPluginPacketData::UpdateAdditionalRecordsL" );
+
+    if( !iPacketDataQoSRecord->RecordId() )
+        {
+        iPacketDataQoSRecord->SetRecordId( KCDNewRecordRequest );
+        iPacketDataQoSRecord->StoreL( Session() );
+        }
+    else
+        {
+        iPacketDataQoSRecord->ModifyL( Session() );
+        }
+    // Set service record to point to QoS record if it does not yet
+    if ( !ServiceRecord().iUmtsR99QoSAndOnTable )
+        {
+        ServiceRecord().iUmtsR99QoSAndOnTable = iPacketDataQoSRecord->RecordId();
+        ServiceRecord().ModifyL( Session() );
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginpacketdata/src/cmpluginpacketdataproxy.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,36 @@
+/*
+* 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 packet data Plugin proxy table
+*
+*/
+
+
+#include <e32std.h>
+#include <ecom/implementationproxy.h>
+
+#include "cmpluginpacketdata.h"
+
+// Exported proxy for instantiation method resolution
+// Define the interface UIDs
+const TImplementationProxy ImplementationTable[] = 
+	{
+	IMPLEMENTATION_PROXY_ENTRY( KUidPacketDataBearerType, CCmPluginPacketData::NewL)
+	};
+
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+	{
+	aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+
+	return ImplementationTable;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginpacketdata/src/cmppacketdatasettingsdlg.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,447 @@
+/*
+* 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:  Dialog for editing packet data settings for a packet data
+*                connection method
+*
+*/
+
+// INCLUDE FILES
+
+// System
+#include <StringLoader.h>
+#include <akntextsettingpage.h>
+#include <cmpacketdataui.rsg>
+#include <cmmanager.rsg>
+#include <csxhelp/cp.hlp.hrh>
+
+// User
+#include "cmlogger.h"
+#include "cmpacketdatacommonconstants.h"
+#include <cmpluginpacketdatadef.h>
+#include "cmppacketdatasettingsdlg.h"
+#include "cmppacketdatasettingsdlgadv.h"
+#include "cmpluginpacketdata.h"
+#include "cmpluginmenucommands.hrh"
+#include <cmcommonconstants.h>
+#include <cmpsettingsconsts.h>
+#include "cmmanagerimpl.h"
+
+using namespace CMManager;
+
+const TUint32 KPlainAuthSelectionItems[] =
+    {
+    R_QTN_SET_PASSWD_AUT_NORMAL,
+    R_QTN_SET_PASSWD_AUT_SECURE,
+    0
+    };
+
+const TUint32 KPromptForAuthSelectionItems[] = 
+    {
+    R_QTN_SET_PROMPT_PASSWD_NO,
+    R_QTN_SET_PROMPT_PASSWD_YES,
+    0
+    };
+
+// ================= MEMBER FUNCTIONS =======================================
+    
+// --------------------------------------------------------------------------
+// CmPluginPacketDataSettingsDlg::NewL()
+// Two-phase dconstructor, second phase is ConstructAndRunLD
+// --------------------------------------------------------------------------
+//
+CmPluginPacketDataSettingsDlg* CmPluginPacketDataSettingsDlg::NewL( 
+                                            CCmPluginBaseEng& aCmPluginBase )
+	{
+	CmPluginPacketDataSettingsDlg* self = 
+	           new ( ELeave ) CmPluginPacketDataSettingsDlg( aCmPluginBase );
+	return self;
+	}
+	
+// --------------------------------------------------------------------------
+// CmPluginPacketDataSettingsDlg::CmPluginPacketDataSettingsDlg()
+// --------------------------------------------------------------------------
+//
+CmPluginPacketDataSettingsDlg::CmPluginPacketDataSettingsDlg( 
+                                            CCmPluginBaseEng& aCmPluginBase )
+    : CmPluginBaseSettingsDlg( aCmPluginBase )
+    , iNotifyFromSon( KCmNotifiedNone )
+    {
+    
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginPacketDataSettingsDlg::UpdateListBoxContentL
+// --------------------------------------------------------------------------
+//
+void CmPluginPacketDataSettingsDlg::UpdateListBoxContentL()
+    {
+    CmPluginBaseSettingsDlg::UpdateListBoxContentL();
+    }
+    
+//---------------------------------------------------------------------------
+// CmPluginPacketDataSettingsDlg::ConstructAndRunLD
+// --------------------------------------------------------------------------
+//
+
+TInt CmPluginPacketDataSettingsDlg::ConstructAndRunLD( )
+    {
+    CleanupStack::PushL( this );
+    LoadResourceL( KPluginPacketDataResDirAndFileName );
+    CleanupStack::Pop( this );
+   
+    CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
+    cmMgr.WatcherRegisterL( this );
+
+    return CmPluginBaseSettingsDlg::ConstructAndRunLD( );
+    }
+
+    
+// --------------------------------------------------------------------------
+// CmPluginPacketDataSettingsDlg::~CmPluginPacketDataSettingsDlg
+// Destructor
+// --------------------------------------------------------------------------
+//
+CmPluginPacketDataSettingsDlg::~CmPluginPacketDataSettingsDlg()
+    {
+    iResourceReader.Close();
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginBaseSettingsDlg::RunAdvancedSettingsL
+// --------------------------------------------------------------------------
+//
+void CmPluginPacketDataSettingsDlg::RunAdvancedSettingsL()
+    {
+    CmPluginPacketDataSettingsDlgAdv* advDlg = 
+            CmPluginPacketDataSettingsDlgAdv::NewL( iCmPluginBaseEng );
+    
+    // This view may have to un-register as watcher here
+    CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
+    cmMgr.WatcherUnRegister();
+    
+    advDlg->RegisterParentView( this );
+    TInt ret = advDlg->ConstructAndRunLD();
+
+    if( iNotifyFromSon == KCmNotifiedNone )
+        {
+        if( ret == KDialogUserExit )
+            {
+            iExitReason = KDialogUserExit;
+            TryExitL( iExitReason );
+            }
+        else
+            {
+            // Re-register as watcher if advanced view comes back or exists normally
+            cmMgr.WatcherRegisterL( this );
+            }
+        }
+    else
+        {
+        HandleCommsDatChangeL();
+        }
+    }
+    
+// --------------------------------------------------------------------------
+// CmPluginBaseSettingsDlg::UpdateListBoxContentBearerSpecificL
+// --------------------------------------------------------------------------
+//
+void CmPluginPacketDataSettingsDlg::UpdateListBoxContentBearerSpecificL( 
+                                                    CDesCArray& aItemArray )
+    {
+    LOGGER_ENTERFN( "CmPluginPacketDataSettingsDlg::UpdateListBoxContentBearerSpecificL" );
+
+    TBool boolSettingVal( EFalse ); // just for helping make code readable
+        
+    // DATA BEARER - only for real bearer types
+    AppendSettingTextsL( aItemArray, ECmBearerSettingName );
+    // AP NAME
+    AppendSettingTextsL( aItemArray, EPacketDataAPName );
+    // USER NAME
+    AppendSettingTextsL( aItemArray, EPacketDataIFAuthName );
+    // PROMPT PASSWORD
+    boolSettingVal = iCmPluginBaseEng.GetBoolAttributeL( 
+                                                EPacketDataIFPromptForAuth );
+    AppendSettingTextsL( aItemArray, EPacketDataIFPromptForAuth,
+                        boolSettingVal ? 
+                                      R_QTN_SET_PROMPT_PASSWD_YES :
+                                      R_QTN_SET_PROMPT_PASSWD_NO );
+    // PASSWORD
+    AppendSettingTextsL( aItemArray, EPacketDataIFAuthPass );
+    // PASSWORD AUTHENTICATION
+    boolSettingVal = iCmPluginBaseEng.GetBoolAttributeL( 
+                                           EPacketDataDisablePlainTextAuth );
+    AppendSettingTextsL( aItemArray,
+                                EPacketDataDisablePlainTextAuth,
+                                boolSettingVal ?
+                                   R_QTN_SET_PASSWD_AUT_SECURE :
+                                   R_QTN_SET_PASSWD_AUT_NORMAL );
+    // HOMEPAGE
+    AppendSettingTextsL( aItemArray, ECmStartPage );
+    }
+    
+// --------------------------------------------------------------------------
+// CmPluginPacketDataSettingsDlg::ChangeBoolSettingL
+// --------------------------------------------------------------------------
+//
+TBool CmPluginPacketDataSettingsDlg::ChangeBoolSettingL( TUint32 aAttribute, 
+                                                         TInt aCommandId )
+    {
+    LOGGER_ENTERFN( "CmPluginPacketDataSettingsDlg::ChangeBoolSettingL" );
+
+    if ( aCommandId == EPluginBaseCmdChange )
+        {
+        const TUint32* items = NULL;
+        TInt titleResId(0);
+        
+        // Add the list items
+        switch ( aAttribute )
+            {
+            case EPacketDataDisablePlainTextAuth:
+                {
+                titleResId = R_QTN_SET_PASSWD_AUT;
+                items = KPlainAuthSelectionItems;
+                break;
+                }
+            case EPacketDataIFPromptForAuth:
+                {
+                titleResId = R_QTN_SET_PROMPT_PASSWD;
+                items = KPromptForAuthSelectionItems;
+                break;
+                }
+            default:
+                {
+                User::Leave( KErrNotSupported );
+                }
+            }
+        
+        TInt selected = iCmPluginBaseEng.GetBoolAttributeL( aAttribute );
+        TInt originalValue = selected;        
+        if ( ShowRadioButtonSettingPageL( items, 
+                                          selected,
+                                          titleResId ) && 
+                                          originalValue != selected )
+             {
+             iCmPluginBaseEng.SetBoolAttributeL( aAttribute, selected );
+             UpdateListBoxContentL();             
+             }
+
+        return selected;
+        }
+    else        
+        {
+        TBool boolFromCM = boolFromCM = 
+                            iCmPluginBaseEng.GetBoolAttributeL( aAttribute );
+        iCmPluginBaseEng.SetBoolAttributeL( aAttribute, !boolFromCM );
+        UpdateListBoxContentL();
+        return !boolFromCM;
+        }
+    }
+    
+// --------------------------------------------------------------------------
+// CmPluginPacketDataSettingsDlg::ShowPopupSettingPageL
+// --------------------------------------------------------------------------
+//
+TBool CmPluginPacketDataSettingsDlg::ShowPopupSettingPageL( 
+                                           TUint32 aAttribute, TInt aCommandId )
+    {
+    LOGGER_ENTERFN( "CmPluginPacketDataSettingsDlg::ShowPopupSettingPageL" );
+
+    TBool retval = EFalse;
+    switch ( aAttribute )
+        {
+        case EPacketDataIFAuthPass:
+            {
+            retval = ShowPopupPasswordSettingPageL( aAttribute );
+            break;
+            }
+        case EPacketDataDisablePlainTextAuth:            
+        case EPacketDataIFPromptForAuth:
+            {
+            ChangeBoolSettingL( aAttribute, aCommandId );
+            break;
+            } 
+        default:
+            {
+            CmPluginBaseSettingsDlg::ShowPopupSettingPageL( aAttribute, 
+                                                            aCommandId );
+            break;            
+            }
+        }
+    return retval;
+    }
+    
+
+// --------------------------------------------------------------------------
+// CmPluginPacketDataSettingsDlg::ProcessCommandL
+// --------------------------------------------------------------------------
+//
+void CmPluginPacketDataSettingsDlg::ProcessCommandL( TInt aCommandId )
+    {
+    LOGGER_ENTERFN( "CmPluginPacketDataSettingsDlg::ProcessCommandL" );
+
+    if ( MenuShowing() )
+        {
+        HideMenu();
+        }
+
+    switch ( aCommandId )
+        {
+        case EPluginBaseCmdAdvanced:
+            {
+            RunAdvancedSettingsL();
+            break;
+            }
+        case EPluginBaseCmdChange: // flow to EAknSoftkeyOk
+        case EAknSoftkeyOk:
+            {
+            TInt attrib = iSettingIndex->At( iListbox->CurrentItemIndex() );
+            ShowPopupSettingPageL( attrib, aCommandId );            
+            break;
+            }         
+        default:
+            {
+            CmPluginBaseSettingsDlg::ProcessCommandL( aCommandId );
+            break;            
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginPacketDataSettingsDlg::OkToExitL
+// --------------------------------------------------------------------------
+//
+TBool CmPluginPacketDataSettingsDlg::OkToExitL( TInt aButtonId )
+    {
+    TBool retval( EFalse );
+    
+    switch ( aButtonId )
+        {
+        case EPluginBaseCmdExit:
+        case EAknSoftkeyBack:
+            {
+            CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
+            cmMgr.WatcherUnRegister();
+            }
+        default:
+            {
+            retval = CmPluginBaseSettingsDlg::OkToExitL( aButtonId );
+            break;
+            }
+        }
+    
+    return retval;
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginPacketDataSettingsDlg::GetHelpContext
+// --------------------------------------------------------------------------
+//
+    
+void CmPluginPacketDataSettingsDlg::GetHelpContext( TCoeHelpContext& aContext ) const
+    {
+    LOGGER_ENTERFN( "CmPluginPacketDataSettingsDlg::GetHelpContext" );
+
+    aContext.iMajor = KHelpUidPlugin;
+    aContext.iContext = KSET_HLP_AP_SETTING_GPRS;
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginPacketDataSettingsDlg::CommsDatChangesL
+// --------------------------------------------------------------------------
+//
+void CmPluginPacketDataSettingsDlg::CommsDatChangesL()
+    {
+    CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
+    CCmDestinationImpl* parentDest = iCmPluginBaseEng.ParentDestination();
+
+    if ( parentDest )
+        {
+        if( !cmMgr.DestinationStillExistedL( parentDest ) )
+            {
+            cmMgr.WatcherUnRegister();
+            // If parent destination diappears with some reason 
+            // then the view must exit back to main view for it
+            // may be danger if going back to parent view
+            iExitReason = KDialogUserExit;
+            TryExitL( iExitReason );
+            
+            cmMgr.RemoveDestFromPool( parentDest );
+            delete parentDest;
+            return;
+            }
+        
+        if( !cmMgr.IsIapStillInDestL( parentDest, iCmPluginBaseEng ) )
+            {
+            cmMgr.WatcherUnRegister();
+            // In this case, the view can go back to the parent view
+            TryExitL( iExitReason );
+            
+            cmMgr.RemoveDestFromPool( parentDest );
+            delete parentDest;
+            return;            
+            }
+        
+        // We may have to go back to parent view even though this Iap is still in CommsDat
+        // for cmMgr ( = iCmPluginBaseEng.CmMgr() ) can not be accessed any more
+        // after this call when some Iap is deleted.
+        cmMgr.WatcherUnRegister();
+        TryExitL( iExitReason );
+        
+        cmMgr.RemoveDestFromPool( parentDest );
+        delete parentDest;
+        }
+    else
+        {
+        if( !cmMgr.IapStillExistedL( iCmPluginBaseEng ) )
+            {
+            cmMgr.WatcherUnRegister();
+            // In this case, the dialog can go back to the parent view
+            TryExitL( iExitReason );
+            return;
+            }
+        
+        // We may have to go back to parent view even though this Iap is still in CommsDat
+        // for cmMgr ( = iCmPluginBaseEng.CmMgr() ) can not be accessed any more
+        // after this call when some Iap is deleted.
+        cmMgr.WatcherUnRegister();
+        TryExitL( iExitReason );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginPacketDataSettingsDlg::NotifyParentView
+// --------------------------------------------------------------------------
+//
+void CmPluginPacketDataSettingsDlg::NotifyParentView( TInt aValue )
+    {
+    iNotifyFromSon = aValue;
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginPacketDataSettingsDlg::HandleCommsDatChangeL
+// --------------------------------------------------------------------------
+//
+void CmPluginPacketDataSettingsDlg::HandleCommsDatChangeL()
+    {    
+    if( iNotifyFromSon == KCmNotifiedIapIsNotInThisDestination || 
+            iNotifyFromSon == KCmNotifiedIapDisappear )
+        {
+        TryExitL( iExitReason );
+        }
+    else if( iNotifyFromSon == KCmNotifiedDestinationDisappear )
+        {
+        iExitReason = KDialogUserExit;
+        TryExitL( iExitReason );
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginpacketdata/src/cmppacketdatasettingsdlgadv.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,493 @@
+/*
+* 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:  Dialog for setting packet data plugin advanced settings
+*
+*/
+
+// INCLUDE FILES
+
+#include <cmpacketdataui.rsg>
+#include <cmmanager.rsg>
+#include <StringLoader.h>
+#include <akntextsettingpage.h>
+#include <aknradiobuttonsettingpage.h>
+#include <aknmfnesettingpage.h>
+#include <csxhelp/cp.hlp.hrh>
+
+#include <cmpluginpacketdatadef.h>
+#include "cmppacketdatasettingsdlgadv.h"
+#include "cmpacketdatacommonconstants.h"
+#include "cmpluginmultilinedialog.h"
+#include <cmcommonui.h>
+#include "cmpluginmenucommands.hrh"
+#include "cmpluginpacketdata.h"
+#include <cmcommonconstants.h>
+#include <cmpsettingsconsts.h>
+#include "cmmanagerimpl.h"
+
+using namespace CMManager;
+
+const TUint32 KDNSSelectionItems[] = 
+    { 
+    R_QTN_SET_IP_ADDRESS_DYNAMIC,
+    R_QTN_SET_IP_WELL_KNOWN,
+    R_QTN_SET_IP_USER_DEFINED,
+    0
+    };            
+
+const TUint32 KPDPSelectionItems[] =
+    {
+    R_GPRS_PLUGIN_VIEW_PDP_TYPE_IPV4,
+    R_GPRS_PLUGIN_VIEW_PDP_TYPE_IPV6,
+    0
+    };
+    
+// ================= MEMBER FUNCTIONS =======================================
+    
+// --------------------------------------------------------------------------
+// CmPluginPacketDataSettingsDlgAdv::NewL()
+// Two-phase dconstructor, second phase is ConstructAndRunLD
+// --------------------------------------------------------------------------
+//
+CmPluginPacketDataSettingsDlgAdv* CmPluginPacketDataSettingsDlgAdv::NewL( 
+                                            CCmPluginBaseEng& aCmPluginBase )
+	{
+	CmPluginPacketDataSettingsDlgAdv* self = 
+	        new ( ELeave ) CmPluginPacketDataSettingsDlgAdv( aCmPluginBase );
+	return self;
+	}
+	
+// --------------------------------------------------------------------------
+// CmPluginPacketDataSettingsDlgAdv::CmPluginPacketDataSettingsDlgAdv()
+// --------------------------------------------------------------------------
+//
+CmPluginPacketDataSettingsDlgAdv::CmPluginPacketDataSettingsDlgAdv( 
+                                            CCmPluginBaseEng& aCmPluginBase )
+    : CmPluginBaseSettingsDlgAdv( aCmPluginBase )
+    , iIpv6Supported( aCmPluginBase.FeatureSupported( KFeatureIdIPv6 ) )
+    , iParent( NULL )
+    {
+    iHelpContext = KSET_HLP_AP_SETTING_GPRS_AS;
+    }
+    
+// --------------------------------------------------------------------------
+// CmPluginPacketDataSettingsDlgAdv::~CmPluginPacketDataSettingsDlgAdv
+// Destructor
+// --------------------------------------------------------------------------
+//
+CmPluginPacketDataSettingsDlgAdv::~CmPluginPacketDataSettingsDlgAdv()
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginPacketDataSettingsDlgAdv::ConstructAndRunLD
+// --------------------------------------------------------------------------
+//
+TInt CmPluginPacketDataSettingsDlgAdv::ConstructAndRunLD()
+    {
+    CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
+    cmMgr.WatcherRegisterL( this );
+    
+    return CmPluginBaseSettingsDlgAdv::ConstructAndRunLD();
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginPacketDataSettingsDlgAdv::UpdateListBoxContentBearerSpecificL
+// --------------------------------------------------------------------------
+//
+void CmPluginPacketDataSettingsDlgAdv::UpdateListBoxContentBearerSpecificL( 
+                                                    CDesCArray& aItemArray )
+    {
+    TInt valueResId = 0;    
+    TInt pdpType = RPacketContext::EPdpTypeIPv4;
+    
+    // Get the PDP type - EPdpTypeIPv4 by default
+    if ( iIpv6Supported )
+        {
+        pdpType = iCmPluginBaseEng.GetIntAttributeL( EPacketDataPDPType );
+        
+        // NETWORK (PDP) TYPE
+        AppendSettingTextsL( aItemArray,
+                             EPacketDataPDPType,
+                             pdpType == RPacketContext::EPdpTypeIPv6 ? 
+                                R_GPRS_PLUGIN_VIEW_PDP_TYPE_IPV6 :
+                                R_GPRS_PLUGIN_VIEW_PDP_TYPE_IPV4 );
+        }    
+    
+    if ( pdpType != RPacketContext::EPdpTypeIPv6 )
+        {
+        // IP ADDRESS
+        AppendSettingTextsL( aItemArray, EPacketDataIPAddr );
+        }
+        
+    if ( iIpv6Supported )
+        {
+        // DNS SERVERS IP ADDRESS
+        if ( pdpType == RPacketContext::EPdpTypeIPv6 )
+            {
+            switch ( GetIPv6DNSTypeL( EPacketDataIPIP6NameServer1,
+                                      EPacketDataIPIP6NameServer2 ) )
+                {
+                case EIPv6Unspecified:
+                    {
+                    valueResId = R_QTN_SET_IP_ADDRESS_DYNAMIC;
+                    break;
+                    }
+                case EIPv6WellKnown:
+                    {
+                    valueResId = R_QTN_SET_IP_WELL_KNOWN;
+                    break;
+                    }
+                case EIPv6UserDefined:
+                    {
+                    valueResId = R_QTN_SET_IP_USER_DEFINED;
+                    break;
+                    }
+                default:
+                    {                    
+                    User::Leave( KErrNotSupported );
+                    break;
+                    }
+                }
+            }
+        else
+            {
+            if ( !iCmPluginBaseEng.GetBoolAttributeL( 
+                                           EPacketDataIPDNSAddrFromServer ) )
+                {
+                valueResId = R_QTN_SET_IP_USER_DEFINED;
+                }
+            else
+                {
+                valueResId = R_QTN_SET_DNS_SERVERS_AUTOMATIC;
+                }
+            }    
+        AppendSettingTextsL( aItemArray,
+                             EPacketDataIPIP6DNSAddrFromServer,
+                             valueResId );
+        }
+    else            
+        {
+        // PRIMARY NAME SERVER
+        AppendSettingTextsL( aItemArray, EPacketDataIPNameServer1 );
+        AppendSettingTextsL( aItemArray, EPacketDataIPNameServer2 );
+        }
+
+    // PROXY SETTINGS
+    // PROXY SERVER ADDRESS
+    AppendSettingTextsL( aItemArray, ECmProxyServerName );
+    // PROXY PORT NUMBER
+    AppendSettingTextsL( aItemArray, ECmProxyPortNumber );
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginPacketDataSettingsDlgAdv::ShowPopupPacketDataIPDNSAddrFromServerL
+// --------------------------------------------------------------------------
+//
+void CmPluginPacketDataSettingsDlgAdv::
+                                    ShowPopupPacketDataIPDNSAddrFromServerL()
+    {
+    TInt PDPType = iCmPluginBaseEng.GetIntAttributeL( EPacketDataPDPType );
+
+    if ( PDPType == RPacketContext::EPdpTypeIPv6 )
+        {
+        ShowPopupIPv6DNSEditorL( KDNSSelectionItems,
+                                 EPacketDataIPIP6DNSAddrFromServer,
+                                 EPacketDataIPIP6NameServer1,
+                                 EPacketDataIPIP6NameServer2 );
+        }
+    else //ipv4
+        {
+        ShowPopupIPv4DNSEditorL( EPacketDataIPDNSAddrFromServer,
+                                 EPacketDataIPNameServer1,
+                                 EPacketDataIPNameServer2 );
+        }        
+    }
+    
+// --------------------------------------------------------------------------
+// CmPluginPacketDataSettingsDlgAdv::ShowPopupSettingPageL
+// --------------------------------------------------------------------------
+//
+TBool CmPluginPacketDataSettingsDlgAdv::ShowPopupSettingPageL( 
+                                           TUint32 aAttribute, TInt aCommandId )
+    {    
+    TBool retval = EFalse;
+    
+    switch ( aAttribute )
+        {
+        // IPDNS Settings
+        case EPacketDataIPDNSAddrFromServer:
+        case EPacketDataIPIP6DNSAddrFromServer:        
+            {
+            ShowPopupPacketDataIPDNSAddrFromServerL();
+            break;
+            }
+        case EPacketDataPDPType:            
+            {
+            if ( aCommandId == EAknSoftkeyOk )
+                {
+                TInt intFromCM = 0;
+                TRAPD( err, intFromCM = iCmPluginBaseEng.GetIntAttributeL( 
+                                                              aAttribute ) );
+                
+                if ( !err )
+                    {
+                    intFromCM == RPacketContext::EPdpTypeIPv6 ? 
+                                intFromCM = RPacketContext::EPdpTypeIPv4 : 
+                                intFromCM = RPacketContext::EPdpTypeIPv6;
+                    }
+                else    
+                    {
+                    User::Leave( KErrNotSupported );
+                    }
+                              
+                iCmPluginBaseEng.SetIntAttributeL( aAttribute, intFromCM );
+                UpdateListBoxContentL();  
+                }
+            else
+                {
+                if ( aCommandId == EPluginBaseCmdChange )
+                
+                    {
+                    ShowPDPTypeRBPageL( aAttribute );
+                    }
+                else
+                    {
+                    TInt pdpType = iCmPluginBaseEng.GetIntAttributeL( EPacketDataPDPType );
+                    pdpType = pdpType == RPacketContext::EPdpTypeIPv4 ? 
+                                            RPacketContext::EPdpTypeIPv6 : 
+                                            RPacketContext::EPdpTypeIPv4;
+                    iCmPluginBaseEng.SetIntAttributeL( aAttribute, pdpType );
+                    UpdateListBoxContentL();
+                    }
+                }
+            break;
+            }
+        // IP Setting Page
+        case EPacketDataIPNameServer1:                
+        case EPacketDataIPNameServer2:
+        case EPacketDataIPAddr:
+            {
+            ShowPopupIpSettingPageL( aAttribute );
+            break;
+            }
+        // Text Settings        
+        case ECmProxyServerName:
+            {
+            retval = ShowPopupTextSettingPageL( aAttribute );
+            break;
+            }
+        // Numeric Settings
+        case ECmProxyPortNumber:
+            {
+            if ( ShowPopupPortNumSettingPageL( aAttribute ) )
+                {
+                retval = ETrue;
+                }
+            break;
+            }
+        default:
+            {
+            CmPluginBaseSettingsDlgAdv::ShowPopupSettingPageL( aAttribute, 
+                                                               aCommandId );
+            break;            
+            }
+        }
+    return retval;
+    }
+    
+// --------------------------------------------------------------------------
+// CmPluginPacketDataSettingsDlgAdv::ProcessCommandL
+// --------------------------------------------------------------------------
+//
+void CmPluginPacketDataSettingsDlgAdv::ProcessCommandL( TInt aCommandId )
+    {
+    if ( MenuShowing() )
+        {
+        HideMenu();
+        }
+
+    switch ( aCommandId )
+        {
+        case EPluginBaseCmdExit:
+            {
+            iExitReason = KDialogUserExit; //  flow to EAknSoftkeyBack
+            }            
+        case EAknSoftkeyBack:
+            {
+            TryExitL( iExitReason );
+            break;
+            }  
+        case EAknSoftkeyOk:                     
+        case EPluginBaseCmdChange:
+            {
+            TInt attrib = iSettingIndex->At( iListbox->CurrentItemIndex() );
+            ShowPopupSettingPageL( attrib, aCommandId );
+
+            if ( iHasSettingChanged )
+                {
+                iHasSettingChanged = EFalse; // Don't call UpdateL at this stage
+                }
+            break;
+            }         
+        default:
+            {
+            CmPluginBaseSettingsDlgAdv::ProcessCommandL( aCommandId );
+
+            if ( iHasSettingChanged )
+                {
+                iHasSettingChanged = EFalse; // Don't call UpdateL at this stage
+                }
+            break;            
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginPacketDataSettingsDlgAdv::OkToExitL
+// --------------------------------------------------------------------------
+//
+TBool CmPluginPacketDataSettingsDlgAdv::OkToExitL( TInt aButtonId )
+    {
+    TBool retval( EFalse );
+    switch ( aButtonId )
+        {
+        case EPluginBaseCmdExit:
+        case EAknSoftkeyBack:
+            {
+            CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
+            cmMgr.WatcherUnRegister();
+            }
+        default:
+            {
+            retval = CmPluginBaseSettingsDlgAdv::OkToExitL( aButtonId );
+            break;
+            }
+        }
+    
+    return retval;
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginPacketDataSettingsDlgAdv::ShowPDPTypeRBPageL
+// --------------------------------------------------------------------------
+//
+void CmPluginPacketDataSettingsDlgAdv::ShowPDPTypeRBPageL( TUint32 aAttribute )
+    {
+    TInt selected = iCmPluginBaseEng.GetIntAttributeL( aAttribute );
+    
+    TInt originalValue = selected;
+    
+    if ( ShowRadioButtonSettingPageL( KPDPSelectionItems, 
+                                      selected, 
+                                      R_GPRS_PLUGIN_VIEW_PDP_TYPE ) && 
+         originalValue != selected )
+        {
+        iCmPluginBaseEng.SetIntAttributeL( aAttribute , selected );
+        UpdateListBoxContentL();             
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginPacketDataSettingsDlgAdv::RegisterParentView
+// --------------------------------------------------------------------------
+//
+void CmPluginPacketDataSettingsDlgAdv::RegisterParentView( CCmParentViewNotifier* aParent )
+    {
+    iParent = aParent;
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginPacketDataSettingsDlgAdv::CommsDatChangesL
+// --------------------------------------------------------------------------
+//
+void CmPluginPacketDataSettingsDlgAdv::CommsDatChangesL()
+    {
+    CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
+    CCmDestinationImpl* parentDest = iCmPluginBaseEng.ParentDestination();
+
+    if ( parentDest )
+        {
+        if( !cmMgr.DestinationStillExistedL( parentDest ) )
+            {
+            if( iParent )
+                {
+                iParent->NotifyParentView( KCmNotifiedDestinationDisappear );
+                }
+            
+            cmMgr.WatcherUnRegister();
+            // If parent destination is deleted by somebody then the dialog must exit back to main view
+            iExitReason = KDialogUserExit;
+            TryExitL( iExitReason );
+            
+            cmMgr.RemoveDestFromPool( parentDest );
+            delete parentDest;
+            return;
+            }
+        
+        if( !cmMgr.IsIapStillInDestL( parentDest, iCmPluginBaseEng ) )
+            {
+            if( iParent )
+                {
+                iParent->NotifyParentView( KCmNotifiedIapIsNotInThisDestination );
+                }
+            
+            cmMgr.WatcherUnRegister();
+            // In this case, the dialog can go back to the parent view
+            TryExitL( iExitReason );
+            
+            cmMgr.RemoveDestFromPool( parentDest );
+            delete parentDest;
+            return;
+            }
+        
+        // We may have to notify parent view to go back to its parent view even though this Iap is still in CommsDat
+        // for cmMgr ( = iCmPluginBaseEng.CmMgr() ) can not be accessed any more
+        // after this call when some Iap is deleted.
+        if( iParent )
+            {
+            iParent->NotifyParentView( KCmNotifiedIapDisappear );
+            }
+        cmMgr.WatcherUnRegister();
+        TryExitL( iExitReason );
+        
+        cmMgr.RemoveDestFromPool( parentDest );
+        delete parentDest;
+        }
+    else
+        {
+        if( !cmMgr.IapStillExistedL(iCmPluginBaseEng) )
+            {
+            if( iParent )
+                {
+                iParent->NotifyParentView( KCmNotifiedIapDisappear );
+                }
+            
+            cmMgr.WatcherUnRegister();
+            // In this case, the dialog can go back to the parent view
+            TryExitL( iExitReason );
+            return;
+            }
+        
+        // We may have to notify parent view to go back to its parent view even though this Iap is still in CommsDat
+        // for cmMgr ( = iCmPluginBaseEng.CmMgr() ) can not be accessed any more
+        // after this call when some Iap is deleted.
+        if( iParent )
+            {
+            iParent->NotifyParentView( KCmNotifiedIapDisappear );
+            }
+        cmMgr.WatcherUnRegister();
+        TryExitL( iExitReason );
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginvpn/data/10281BBE.rss	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,46 @@
+/*
+* 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 resource descriptor for VPN plug-in
+*
+*/
+
+#include "ecom/registryinfo.rh"
+
+// Because attribute enums had to be added to namespace CMManager
+// it's not possible to included cmpluginvpndef.h.
+// Thus bearer type id had to be redefined here.
+#define KPluginVPNBearerTypeUid   0x10281BBD
+
+RESOURCE REGISTRY_INFO theInfo
+    {
+    dll_uid = 0x10281BBE;
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = 0x10207377; // = KCMPluginInterfaceUid. Do NOT modify it!!!
+            implementations = 
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = KPluginVPNBearerTypeUid;
+                    version_no = 1;
+                    display_name = "VPN";
+                    default_data = "VPN";
+                    opaque_data = "";
+                    }
+                };
+            }
+        };
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginvpn/data/cmpluginvpnui.rss	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,314 @@
+/*
+* 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:  Localisation file for VPN plug-in
+*
+*/
+
+#include <avkon.rsg>
+#include <avkon.rh>	
+#include <avkon.loc>
+#include <uikon.rh>
+#include <eikon.rh>
+#include <cmpsettingsconsts.h>
+#include <eikon.rsg>
+#include <AvkonIcons.hrh>
+#include <cmmanager.loc>
+
+#include <cmpluginvpn.loc>
+#include "cmmanager.hrh"
+
+NAME    CMVP
+
+RESOURCE RSS_SIGNATURE { }
+
+RESOURCE TBUF { buf = "VPN"; }
+
+// --------------------------------------------------------------------------
+// r_qtn_netw_conset_bearer_supported_vpn 
+// localised string
+// returned string the attribute: ECmBearerSupportedName 
+// --------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_netw_conset_bearer_supported_vpn
+    {
+    buf = qtn_netw_conset_bearer_supported_vpn;
+    }
+
+// --------------------------------------------------------------------------
+// r_qtn_netw_conset_method_name_vpn 
+// localised string
+// --------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_netw_conset_method_name_vpn
+    {
+    buf = qtn_netw_conset_method_name_vpn;
+    }
+
+// --------------------------------------------------------------------------
+//  r_qtn_vpn_info_vpn_iap_incomplete
+//  localised string
+// --------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_vpn_info_vpn_iap_incomplete
+    {
+    buf = qtn_vpn_info_vpn_iap_incomplete;
+    }
+    
+// --------------------------------------------------------------------------
+//  r_qtn_vpn_sett_vpn_iap_policy_reference
+//  localised string
+// --------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_vpn_sett_vpn_iap_policy_reference
+    {
+    buf = qtn_vpn_sett_vpn_iap_policy_reference;
+    }
+
+// --------------------------------------------------------------------------
+//  r_qtn_vpn_info_no_policies_installed
+//  localised string
+// --------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_vpn_info_no_policies_installed
+    {
+    buf = qtn_vpn_info_no_policies_installed;
+    }
+
+// --------------------------------------------------------------------------
+//  r_qtn_vpn_sett_vpn_iap_real_netw_reference
+//  localised string
+// --------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_vpn_sett_vpn_iap_real_netw_reference
+    {
+    buf = qtn_vpn_sett_vpn_iap_real_netw_reference;
+    }
+
+// --------------------------------------------------------------------------
+//  r_qtn_vpn_sett_vpn_iap_policy_reference_compulsory
+//  localised string
+// --------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_vpn_sett_vpn_iap_policy_reference_compulsory
+    {
+    buf = qtn_vpn_sett_vpn_iap_policy_reference_compulsory;
+    }
+
+// --------------------------------------------------------------------------
+//  r_qtn_vpn_sett_vpn_iap_policy_reference_compulsory
+//  localised string
+// --------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_vpn_sett_vpn_iap_real_netw_ref_compulsory
+    {
+    buf = qtn_vpn_sett_vpn_iap_real_netw_ref_compulsory;
+    }
+
+// --------------------------------------------------------------------------
+//  r_qtn_vpn_info_mgmt_ui_not_accessible
+//  localised string
+// --------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_vpn_info_mgmt_ui_not_accessible
+    {
+    buf = qtn_vpn_info_mgmt_ui_not_accessible;
+    }
+
+
+// --------------------------------------------------------------------------
+//  r_qtn_netw_conset_prmpt_vpn_policy
+//  localised string
+// --------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_netw_conset_prmpt_vpn_policy
+    {
+    buf = qtn_netw_conset_prmpt_vpn_policy;
+    }
+    
+// --------------------------------------------------------------------------
+//  r_qtn_netw_conset_prmpt_vpn_real_connection
+//  localised string
+// --------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_netw_conset_prmpt_vpn_real_connection
+    {
+    buf = qtn_netw_conset_prmpt_vpn_real_connection;
+    }
+
+// --------------------------------------------------------------------------
+//  r_qtn_netw_conset_conn_methods_amount_many
+//  localised string
+// --------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_netw_conset_conn_methods_amount_many
+    {
+    buf = qtn_netw_conset_conn_methods_amount_many;
+    }
+    
+// --------------------------------------------------------------------------
+//  r_qtn_netw_conset_conn_methods_amount_many
+//  localised string
+// --------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_netw_conset_conn_methods_amount_one
+    {
+    buf = qtn_netw_conset_conn_methods_amount_one;
+    }
+
+// --------------------------------------------------------------------------
+//  r_qtn_netw_conset_vpn_easy_wlan
+//  localised string
+// --------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_netw_conset_vpn_easy_wlan
+    {
+    buf = qtn_netw_conset_vpn_easy_wlan;
+    }
+
+// --------------------------------------------------------------------------
+//  r_qtn_netw_conset_vpn_easy_wlan_prompt
+//  localised string
+// --------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_netw_conset_vpn_easy_wlan_prompt
+    {
+    buf = qtn_netw_conset_vpn_easy_wlan_prompt;
+    }
+
+// --------------------------------------------------------------------------
+//  r_qtn_netw_conset_info_no_cm_to_bind_to
+//  localised string
+// --------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_netw_conset_info_no_cm_to_bind_to
+    {
+    buf = qtn_netw_conset_info_no_cm_to_bind_to;
+    }
+
+// --------------------------------------------------------------------------
+//  r_qtn_vpn_quest_vpn_iap_incomplete_delete
+//  localised string
+// --------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_vpn_quest_vpn_iap_incomplete_delete
+    {
+    buf = qtn_vpn_quest_vpn_iap_incomplete_delete;
+    }
+
+// -----------------------------------------------------------------------------
+// r_softkeys_options_back__options
+// option/options/cancel button set
+// -----------------------------------------------------------------------------
+RESOURCE CBA r_softkeys_options_cancel__select
+    {
+    buttons =
+        {
+        CBA_BUTTON { id = EAknSoftkeyOptions;       txt = text_softkey_option; },
+        CBA_BUTTON { id = EAknSoftkeyBack;          txt = text_softkey_cancel; },
+        CBA_BUTTON { id = ECmManagerUiCmdDestSelect;txt = text_softkey_select; }
+        };
+    }
+
+// --------------------------------------------------------------------------
+// r_vpn_real_cm_selection_list
+// real connection selection dialog with destination support
+// --------------------------------------------------------------------------
+RESOURCE DIALOG r_vpn_real_cm_selection_list
+    {
+    flags = EGeneralQueryFlags;
+    buttons = r_softkeys_options_cancel__select;
+    items =
+        {
+        AVKON_LIST_QUERY_DLG_LINE
+            {
+            control = AVKON_LIST_QUERY_CONTROL
+                {
+                listtype = EAknCtDoubleLargeGraphicPopupMenuListBox;
+                listbox = AVKON_LIST_QUERY_LIST
+                    {
+                    };
+                heading = qtn_netw_conset_prmpt_vpn_real_connection;
+                };
+            }
+        };    
+    }
+
+
+// --------------------------------------------------------------------------
+// r_vpn_real_cm_radio_button_setting_page
+// underlying connection _method_ setting page
+// --------------------------------------------------------------------------
+
+RESOURCE LISTBOX r_vpn_setting_app_listbox
+    {
+    flags = EEikListBoxMultipleSelection;
+    }
+    
+RESOURCE AVKON_SETTING_PAGE r_vpn_real_cm_radio_button_setting_page
+    {
+    number = EAknSettingPageNoOrdinalDisplayed;
+    softkey_resource = R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT;
+    type =  EAknSetListBox;
+    editor_resource_id= r_vpn_setting_app_listbox;
+    }
+    
+    
+// --------------------------------------------------------------------------
+// Menu bars
+// --------------------------------------------------------------------------
+//   
+//    r_vpn_real_cm_selection_menubar
+//    menubar for the VPN real connection selection dialog
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_vpn_real_cm_selection_menubar
+	{
+    titles =
+		{
+        MENU_TITLE
+            {
+            menu_pane = r_vpn_real_cm_selection_menu; 
+            txt = "App";
+            }
+	    };
+	}
+// -----------------------------------------------------------------------------
+//   
+//    r_vpn_real_cm_selection_menu
+//    menu pane for destination list 
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_vpn_real_cm_selection_menu
+	{
+    items =
+		{
+		MENU_ITEM
+		    {
+		    command = ECmManagerUiCmdDestSelect; 
+            txt = qtn_set_cmd_select;
+            }
+        ,MENU_ITEM
+            {
+            command = ECmManagerUiCmdCMSelect;
+            txt = qtn_netw_conset_options_select_method;
+            }
+        ,MENU_ITEM
+            {
+            command = EAknCmdHelp;
+            txt = qtn_options_help;
+            }
+		};
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginvpn/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2006-2008 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 file for VPN plug-in
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+// export localised loc file
+../loc/cmpluginvpn.loc	MW_LAYER_LOC_EXPORT_PATH(cmpluginvpn.loc)
+
+PRJ_MMPFILES
+cmpluginvpn.mmp
+
+PRJ_EXTENSIONS
+START EXTENSION s60/mifconv
+OPTION TARGETFILE cmpluginvpn.mif
+OPTION HEADERFILE cmpluginvpn.mbg
+OPTION SOURCES -c8,1 qgn_prop_vpn_access_point
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginvpn/group/cmpluginvpn.mmp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,82 @@
+/*
+* 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:  Project specification for VPN plug-in
+*
+*/
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+TARGET      cmpluginvpn.dll
+UID         0x10009D8D 0x10281BBE
+
+TARGETTYPE        PLUGIN
+
+CAPABILITY      CAP_ECOM_PLUGIN
+VENDORID        VID_DEFAULT
+
+SOURCEPATH  ../src
+
+SOURCE      cmpluginproxyvpn.cpp
+SOURCE      cmpluginvpn.cpp
+SOURCE      cmpvpnsettingsdlg.cpp
+SOURCE      cmpvpnpolicyselectiondlg.cpp
+SOURCE      cmpvpnnextlayerselectdlg.cpp
+SOURCE      ../../../Framework/Src/cmlogger.cpp
+
+SOURCEPATH  ../data
+
+START RESOURCE 10281BBE.rss
+TARGET cmpluginvpn.rsc
+END
+
+START RESOURCE cmpluginvpnui.rss
+HEADER
+TARGETPATH   RESOURCE_FILES_DIR
+LANGUAGE_IDS
+END
+
+USERINCLUDE     ../data
+USERINCLUDE     ../../../Framework/Inc
+USERINCLUDE     ../../../Framework/SrcData
+
+// 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
+
+LIBRARY hlplch.lib
+LIBRARY euser.lib
+LIBRARY ecom.lib
+LIBRARY cmmanager.lib
+LIBRARY commsdat.lib
+LIBRARY aknskins.lib
+LIBRARY efsrv.lib 
+LIBRARY	CommonEngine.lib
+LIBRARY cone.lib eikcore.lib avkon.lib
+LIBRARY eikcoctl.lib eikdlg.lib
+LIBRARY bafl.lib
+LIBRARY vpnapi.lib
+LIBRARY centralrepository.lib
+LIBRARY featmgr.lib
+LIBRARY cmmanagerdatabase.lib
+DEBUGLIBRARY flogger.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginvpn/group/cmpluginvpn_icons.mk	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,66 @@
+#
+# 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:  Makefile for icons of VPN plug-in
+#
+
+ifeq (WINS,$(findstring WINS, $(PLATFORM)))
+ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\Z
+else
+ZDIR=\epoc32\data\z
+endif
+
+
+TARGETDIR=$(ZDIR)\resource\apps
+ICONTARGETFILENAME=$(TARGETDIR)\cmpluginvpn.mif
+
+HEADERDIR=\epoc32\include
+HEADERFILENAME=$(HEADERDIR)\cmpluginvpn.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) \
+                /c8,1 qgn_prop_vpn_access_point.bmp
+
+FREEZE : do_nothing
+
+SAVESPACE : do_nothing
+
+RELEASABLES :
+	@echo $(HEADERFILENAME)&& \
+	@echo $(ICONTARGETFILENAME)
+
+FINAL : do_nothing
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginvpn/inc/cmpluginvpn.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,302 @@
+/*
+* 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:  VPN plugin IF implementation class.
+*
+*/
+
+#ifndef VPN_PLUGIN_INCLUDED
+#define VPN_PLUGIN_INCLUDED
+
+#include <e32base.h>
+#include <StringLoader.h>
+#include <cmpluginbaseeng.h>
+
+#include <cmpluginvpndef.h>
+
+using namespace CommsDat;
+
+class CCDVirtualIAPNextLayerRecord;
+
+/**
+ *  VPN Plugin IF implementation class
+ *  @since S60 3.2
+ */
+NONSHARABLE_CLASS(CCmPluginVpn) : public CCmPluginBaseEng
+    {
+
+    public:     // Constructors and destructor
+
+        /**
+        * Two phased constructor. Leaves on failure.
+        * @return The created object.
+        */      
+        static CCmPluginVpn* NewL( TCmPluginInitParam* aInitParam );
+
+        /**
+        * Destructor.
+        */      
+        virtual ~CCmPluginVpn();
+        
+        virtual CCmPluginBaseEng* CreateInstanceL( TCmPluginInitParam& aInitParam ) const;
+        
+    public: 
+        
+        /**
+        * Gets the value for a TInt attribute.
+        * @param aAttribute Identifies the attribute to be retrived.
+        * @param aValue On completion, contains the requested TInt attribute.
+        * @return None.
+        */
+        virtual TUint32 GetIntAttributeL( const TUint32 aAttribute ) const;
+
+        /**
+        * Gets the value for a TBool attribute.
+        * @param aAttribute Identifies the attribute to be retrived.
+        * @param aValue On completion, contains the requested TBool attribute.
+        * @return None.
+        */
+        virtual TBool GetBoolAttributeL( const TUint32 aAttribute ) const;
+
+        /**
+        * Gets the value for a String16 attribute.
+        * @param aAttribute Identifies the attribute to be retrived.
+        * @param aValue On completion, contains the requested TDes16 attribute.
+        * @return None.
+        */
+        virtual HBufC* GetStringAttributeL( const TUint32 aAttribute ) const;
+
+		/**
+		* Gets the value for a String8 attribute.
+		* @param aAttribute Identifies the attribute to be retrived.
+        * @return copy of the requested attribute. Ownership is passed.
+		*/
+		virtual HBufC8* GetString8AttributeL( const TUint32 aAttribute ) const;
+
+        /**
+        * Sets the value for a TInt attribute.
+        * @param aAttribute Identifies the attribute to be set.
+        * @param aValue The value to be set.
+        * @return None.
+        */
+        virtual void SetIntAttributeL( const TUint32 aAttribute, TUint32 aValue );
+
+        /**
+        * Sets the value for a TBool attribute.
+        * @param aAttribute Identifies the attribute to be set.
+        * @param aValue The value to be set.
+        * @return None.
+        */
+        virtual void SetBoolAttributeL( const TUint32 aAttribute, TBool aValue );
+
+        /**
+        * Sets the value for a String16 attribute.
+        * @param aAttribute Identifies the attribute to be set.
+        * @param aValue The value to be set.
+        * @return None.
+        */
+        virtual void SetStringAttributeL( const TUint32 aAttribute, 
+                                          const TDesC16& aValue );
+
+		/**
+		* Sets the value for a String8 attribute.
+		* @param aAttribute Identifies the attribute to be set.
+		* @param aValue The value to be set.
+        * @return None.
+		*/
+		virtual void SetString8AttributeL( const TUint32 aAttribute, 
+		                                   const TDesC8& aValue );
+
+
+		void UpdatePolicyNameL();
+		
+        /**
+        * Puts the currently available bindable destinations into the 
+        * passed array. The array is emptied before appending the values.
+        * It contains only real destinations, no uncategorised 
+        * or any other, created ones (Always ask, DefaultConnection, etc)
+        */
+        void BindableDestinationsL( RArray<TUint32>& aDestinationArray );
+        
+        /**
+        * Change the VPN connection method name when using 
+        * 'Search for WLAN' functionality
+        */
+        HBufC* GenerateVPNPointToWLANNetworkLC(RResourceFile& rf, HBufC*& aName);
+		
+    public: // From CCmPluginBaseEng        
+
+        /**
+        * Restore the original value of the attribute from commsdat field.
+        * Base implementation can be used only with attributes 
+        * stored directly in commsdat.
+        * @param aAttribute attribute to be restored
+        */
+        virtual void RestoreAttributeL( const TUint32 aAttribute );
+        
+        /**
+        * Override the load to be able to handle post-processing
+        *
+        */
+        virtual void LoadL( TUint32 aIapId );
+        
+        virtual TBool CanHandleIapIdL( TUint32 aIapId ) const;
+        virtual TBool CanHandleIapIdL( CCDIAPRecord *aIapRecord ) const;
+        
+        virtual TInt RunSettingsL();
+        virtual void LoadServiceSettingL();
+        virtual void LoadAdditionalRecordsL();
+        
+        virtual void UpdateAdditionalRecordsL();
+
+        virtual TBool InitializeWithUiL( TBool aManuallyConfigure  );
+        
+        virtual void ServiceRecordIdLC( HBufC* &aServiceName, 
+                                        TUint32& aRecordId );
+
+        virtual void BearerRecordIdLC( HBufC* &aBearerName, 
+                                       TUint32& aRecordId );
+                                       
+        virtual void PrepareToUpdateRecordsL();
+        
+        virtual TBool IsLinkedToIap( TUint32 aIapId );
+        virtual TBool IsLinkedToSnap( TUint32 aSnapId );
+        
+        virtual void CreateNewL();
+
+        /**
+        * From CCmPluginBaseEng
+        * Deletes additional records, in this case, the WLAN records
+        *
+        * @since S60 3.2
+        */
+        void DeleteAdditionalRecordsL();
+        
+    protected:
+    
+        virtual void AdditionalReset();
+    
+    private: // Constructors
+
+        /**
+        * Constructor.
+        */      
+        CCmPluginVpn( TCmPluginInitParam* aInitParam );
+
+        /**
+        * Second phase constructor. Leaves on failure.
+        * @param
+        */      
+        void ConstructL();
+
+    private:
+    
+        CCDVPNServiceRecord& ServiceRecord() const;
+
+        TBool ServiceRecordExists() const;
+        
+        virtual void CreateNewServiceRecordL();
+        virtual void CreateAdditionalRecordsL();
+        
+        virtual void UpdateServiceRecordL();
+        
+        /**
+        * Displays a list of installed VPN policies for user selection
+        * and updates the setting
+        *
+        * @since S60 3.2
+        * @return the soft key selection
+        */
+        TBool ShowPolicySelectionDlgL();
+        
+        /**
+        * Shows a dialog for selecting the underlying connection method
+        *
+        * @since S60 3.2
+        * @return ETrue if success
+        */
+        TBool ShowRealConnectionSelectionDlgL();
+        
+        /**
+        * Checks whether there are connection methods or destinations which
+        * the VPN connection method can bind to
+        * 
+        * @since S60 3.2
+        * @return ETrue found
+        */
+        TBool BindableRealConnectionsExistL();
+
+        void GenerateDefaultCmNameL();  
+        
+        /**
+        * Returns whether the passed destination can be used as an underlying
+        * connection method for this particular CM.
+        * It can be used if it does not points to VPN in any way, directly or
+        * indirectly, it has at least one, non-virtual CM and
+        * it does not links back to our parent destination.
+        * The returned value is a bit field defined in the src file and 
+        * it holds the following informations: 
+        * IsEmpty, ContainsVPN(in any link), LinksBackToPArentDest and
+        * HasNonVirtualCM to be able to decide if it is suitable.
+        * Used only internally.
+        */
+        TUint32 CanDestUsedAsUnderlyingConnectionL( TUint32 aDestinationId );
+
+
+        /**
+        * Checks whether the destination/CM passed to it has a VPN connection
+        * up-stream (there is a path from a VPN to this item through indirections).
+        * 
+        * @param aId The id of the destination/connmethod in question.
+        * @param aIsDestination ETrue if the passed id is to be considered 
+        *                       that of a destination, EFalse otherwise.
+        * @return ETrue if this entity is pointed to (in/directly) by a VPN.
+        */
+        TBool HasUpstreamVpnL( TUint32 aId, TBool aIsDestination );
+
+        /**
+        * Checks and converts the id of the destination if needed
+        * 
+        * @param aDestination the id of the destination
+        * @since S60 5.2
+        * @return the correct id of the destination 
+        *         or leaves with the error code KErrArgument 
+        */                    
+        TInt CheckValidityAndConvertDestinationIdL( TUint32 aDestinationId );
+
+    public:                
+        /**
+        * Scans aDests for destinations that may be valid parents 
+        * for this plugin and removes those that may not.
+        * @param aDests The array of destination IDs to be filtered.
+        */
+        virtual void FilterPossibleParentsL( RArray<TUint32>& aDests );
+
+        // finds the parent destination of the connmethod with the given ID
+        TUint32 FindParentDestinationL( TUint32 aCmId );
+        
+    private: // Data
+    
+        CCmPluginBaseEng*       iRealCM;
+        CCDVirtualIAPNextLayerRecord*   iVirtualRecord;
+        TMDBElementId           iVirtualTableId;
+        HBufC*                  iPolicyName;
+        
+        /**
+         * An array of the bindable destinations, 
+         * including (if supported) the uncategorised destation and easy wlan
+         */
+        RArray<TUint32> iBindableMethods;
+    };
+
+#endif // VPN_PLUGIN_INCLUDED
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginvpn/inc/cmpvpnnextlayerselectdlg.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,279 @@
+/*
+* 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:  Popup for selecting the underlying connection method or 
+*                destination for a VPN connection method
+*
+*/
+
+#ifndef CMPVPN_NEXT_LAYER_SELECT_DLG_H
+#define CMPVPN_NEXT_LAYER_SELECT_DLG_H
+
+#include <e32base.h>
+#include <eikmobs.h>  // MEikMenuObserver
+#include <aknPopup.h> // CAknPopupList
+
+#include <ConeResLoader.h> // resource reader
+
+class CEikFormattedCellListBox;
+class CEikMenuBar;
+class CEikonEnv;
+class CCmPluginBaseEng;
+class CCmManagerImpl;
+class CGulIcon;
+
+
+    
+/**
+ *  CmPluginVpnNextLayerSelectDlg dialog class
+ *
+ *  
+ *
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CmPluginVpnNextLayerSelectDlg ) : public CAknPopupList, 
+                                                     public MEikMenuObserver
+    {
+    public: // Constructors and destructor
+    
+        static CmPluginVpnNextLayerSelectDlg* NewL( 
+                                        CCmPluginBaseEng& aCmPluginBaseEng,
+                                        RArray<TUint32>& aBindableMethods,
+                                        TBool& aSnapSelected,
+                                        TUint32& aNextLayerId );
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CmPluginVpnNextLayerSelectDlg();
+    
+    private: // Constructor
+    
+        /**
+        * Constructor.
+        */      
+        CmPluginVpnNextLayerSelectDlg( CCmPluginBaseEng& aCmPluginBaseEng,
+                                       RArray<TUint32>& aBindableMethods,
+                                       TBool& aSnapSelected,
+                                       TUint32& aNextLayerId );
+        
+        /**
+        * Second phase constructor. Leaves on failure.
+        */      
+        void ConstructL();
+
+    public: // From MEikMenuObserver
+        
+        /**
+         * See base class
+         */
+        void ProcessCommandL( TInt aCommandId );
+        
+        /**
+         * See base class
+         */
+        void SetEmphasis( CCoeControl* aMenuControl, TBool aEmphasis );
+        
+        /**
+         * See base class
+         */
+        void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
+
+    public: // From CCoeControl
+    
+        /**
+        * Returns the help context
+        * From CCoeControl
+        * 
+        * @since S60 3.2
+        * @param aContext the returned help context
+        */
+        void GetHelpContext( TCoeHelpContext& aContext ) const;
+        
+         /**
+        * From CCoeControl, makes control visible/invisible.
+        * @param aVisible ETrue if visible, EFalse if invisible.
+        */
+        void MakeVisible( TBool aVisible );
+        
+        /**
+        * From CCoeControl
+        *
+        * @since S60 3.2
+        * @param aKeyEvent The key event.
+        * @param aType Key event type.
+        * @return key response (was the key event consumed?).
+        */
+        TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, 
+                                     TEventCode aType );
+                                     
+        // From MEikListBoxObserver
+        void HandleListBoxEventL( CEikListBox* aListBox, 
+                                  TListBoxEvent aEventType );
+                                   
+    public: // new functions
+   
+        /**
+        * Display the Options menu
+        *
+        *
+        * @since S60 3.2
+        */
+        void DisplayMenuL();
+
+        /**
+        * Hide the Options menu.
+        *
+        *
+        * @since S60 3.2
+        */
+        void HideMenu();
+
+        /**
+        * Is the Options menu opened?
+        *
+        *
+        * @since S60 3.2
+        * @return ETrue if showing
+        */
+        TBool MenuShowing() const;
+        
+    private: // new functions
+    
+        /*
+        * Load the given resource file
+        *
+        * @since S60 3.2
+        * @param aResFileName
+        */
+        void LoadResourceL( const TDesC& aResFileName );
+        
+        /*
+        * Formats the texts for the list items using given resources
+        *
+        * @param aFirstLineResId the resource Id for the first line
+        * @param aSecondLineResId the resource Id for the second line
+        * @param aIconIndex the icon's index value
+        * @return the formatted text
+        */
+        HBufC* FormatListItemTextsLC( TInt aFirstLineResId,
+                                      TInt aSecondLineResId,
+                                      TInt aIconIndex );
+        
+        
+        
+        /**
+        */
+        HBufC* FormatListItemTextsLC( TInt aFirstLineResId,
+                                      const TDesC& aSecondLineText,
+                                      TInt aIconIndex );
+                                      
+        /**
+        */
+        HBufC* FormatListItemTextsLC( const TDesC& aFirstLineResId,
+                                      const TDesC& aSecondLineText,
+                                      TInt aIconIndex );
+                                      
+        /**
+        */
+        HBufC* FormatListItemTextsL( const TDesC& aFirstLineText,
+                                     const TDesC& aSecondLineText,
+                                     TInt aIconIndex );
+                                     
+        /**
+        * Displays a radio button selection dialog to select the 
+        * underlying connection method
+        *
+        * @since S60 3.2
+        * @param aDestinationId the destination id to search
+        * @param aCmId the selection as a return value
+        * @return ETrue if selection made EFalse if cancelled
+        */
+        TBool ShowCMSelectionDlgL( TUint32 aDestinationId, 
+                                   TUint32& aCmId );
+
+        void InitialiseL();
+        
+        void SetTextsAndIconsL();
+        
+        void AppendDestinationTextsL( CCmDestinationImpl& aDestination,
+                                 TInt aNumCms,
+                                 CDesCArray& aItems,
+                                 CArrayPtr<CGulIcon>& aIcons );
+                                       
+        void AppendUncatDestinationL( CDesCArray& aItems,
+                                      CArrayPtr<CGulIcon>& aIcons );
+                                    
+        void AppendEasyWlanL( CDesCArray& aItems,
+                              CArrayPtr<CGulIcon>& aIcons );
+                           
+
+    private: // data members
+  
+        /**
+         * Eikon environment
+         */
+        CEikonEnv& iMyEikonEnv;        
+  
+        /**
+         * Owned list box
+         */
+        CEikFormattedCellListBox* iMyListBox;
+        
+        /**
+         * Owned menu bar.
+         */
+        CEikMenuBar* iMenuBar;
+        
+        /**
+         * base class not owned
+         */
+        CCmPluginBaseEng& iCmPluginBaseEng;
+        
+        /**
+         * Result of selection: ETrue if a SNAP was selected
+         */
+        TBool& iSnapSelected;
+        
+        /**
+         * Result of selection: The ID of the connection method or SNAP
+         */
+        TUint32& iNextLayerId;
+                 
+        /**
+         * Resource reader
+         */
+        RConeResourceLoader iResourceReader;
+                 
+        /**
+         * An array containing all of the destination's ids
+         */
+        RArray<TUint32>& iDestinations;
+        
+        /**
+         * The id of EasyWlan ( zero if none )
+         */
+        TUint32 iEasyWlanId;
+        
+        /**
+         * access to the cmmanager
+         */
+        CCmManagerImpl& iCmManager; // not owned
+        
+        /**
+         * Flag to determine if there are uncategorised connection methods
+         */
+        TBool iUncatItems;
+        
+    };
+#endif // CMPVPN_NEXT_LAYER_SELECT_DLG_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginvpn/inc/cmpvpnpolicyselectiondlg.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,132 @@
+/*
+* 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:  Displays a selection list of VPN policies
+*
+*/
+
+#ifndef CMPLUGINVPN_POLICYSELECTION_DLG_H
+#define CMPLUGINVPN_POLICYSELECTION_DLG_H
+
+// includes
+#include <e32base.h>
+#include <ConeResLoader.h>
+#include <vpnapi.h>
+
+// forward declarations
+class CCmPluginBaseEng;
+
+/**
+ *  CmPluginPacketDataSettingsDlg dialog class
+ *
+ *  
+ *
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CmPluginVpnPolicySelectionDlg ) : public CBase
+    {
+    public: // Constructors and destructor
+    
+        static CmPluginVpnPolicySelectionDlg* NewL( 
+                                        CCmPluginBaseEng& aCmPluginBaseEng );
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CmPluginVpnPolicySelectionDlg();
+        
+    public: // New functions
+    
+        /**
+        * Shows the VPN policies in and a popup list and if a selection is
+        * made, EVpnServicePolicyName is set
+        * 
+        * @since S60 3.2
+        * @return ETrue if a selection was made
+        */
+        TBool ShowPolicySelectionListL();
+        
+        /**
+        * Shows the VPN policies in and a radio button list and if a selection is
+        * made, EVpnServicePolicyName is set
+        * 
+        * @since S60 3.2
+        * @return ETrue if a selection was made
+        */
+        TBool ShowPolicySelectionDlgL();
+
+    private: // Constructor
+    
+        /**
+        * Constructor.
+        */      
+        CmPluginVpnPolicySelectionDlg( CCmPluginBaseEng& aCmPluginBaseEng );
+        
+        /**
+        * Second phase constructor. Leaves on failure.
+        */      
+        void ConstructL();
+    
+    private: // New functions
+            
+        /**
+        * Loads a resource file.
+        *
+        * @since S60 3.2
+        * @param aResFileName the resource file name.
+        */
+        void LoadResourceL( const TDesC& aResFileName );
+        
+        /**
+        * Pop-up note that VPN client is inaccessible
+        *
+        * @since S60 3.2
+        */
+        void VpnClientInaccessibleL();
+        
+    private: // data members
+        
+        /**
+         * base class reference, NOT OWNED
+         */
+        CCmPluginBaseEng&   iCmPluginBaseEng;
+        
+        /**
+         * resource reader
+         */
+        RConeResourceLoader iResourceReader;
+        
+        /**
+         * VPN server
+         */
+        RVpnServ iVpnServ;
+        
+        /**
+         * array of VPN policies - OWNED
+         */
+        CArrayFixFlat<TVpnPolicyInfo>* iPolicyInfoList;
+        
+        /**
+         * flag for when vpn is not accessible. used to make sure the 
+         * dialog indicating it is inaccessible is not displayed both 
+         * on connect and close
+         */
+        TBool iVpnClientUnaccessible;
+        
+        /**
+        * the number of VPN policies
+        */
+        TInt iNumPolicies;
+    };
+
+#endif // CMPLUGINVPN_POLICYSELECTION_DLG_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginvpn/inc/cmpvpnsettingsdlg.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,169 @@
+/*
+* 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:  Declares a settings dialog for a VPN connection 
+*                method plugin
+*
+*/
+
+#ifndef CMPLUGINVPN_SETTINGS_DLG_H
+#define CMPLUGINVPN_SETTINGS_DLG_H
+
+// INCLUDES
+#include <cmpluginbaseeng.h>
+#include <mcmdexec.h>
+#include <cmpbasesettingsdlg.h>
+#include "cmcommsdatnotifier.h"
+
+// CLASS DECLARATION
+
+/**
+ *  CmPluginVpnSettingsDlg dialog class
+ *
+ *  Displays the VPN data settings
+ *
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CmPluginVpnSettingsDlg ) : public CmPluginBaseSettingsDlg
+                                            , public MCmCommsDatWatcher
+    {
+    public: // Constructors and destructor
+    
+        /**
+        * Two-phase constructor
+        *
+        * @since S60 3.2
+        * @param aCmPluginBaseEng  The connection method to use
+        * @return instance of the class
+        */
+        static CmPluginVpnSettingsDlg* NewL( CCmPluginBaseEng& 
+                                                        aCmPluginBaseEng );
+                                                        
+        /**
+        * Destructor.
+        */
+        virtual ~CmPluginVpnSettingsDlg();
+    
+    public: // From CmPluginBaseSettingsDlg
+    
+        
+        /**
+        * From CmPluginBaseSettingsDlg
+        * constructor for the dialog
+        *
+        * @since S60 3.2
+        */
+        virtual TInt ConstructAndRunLD();
+        
+        /**
+        * From CmPluginBaseSettingsDlg
+        * Collects the VPN specific setting information for 
+        * displaying
+        *
+        * @since S60 3.2
+        * @param aItemArray an array of setting information
+        */
+        virtual void UpdateListBoxContentBearerSpecificL( 
+                                                    CDesCArray& aItemArray );
+        
+        /**
+        * From CmPluginBaseSettingsDlg
+        * displays the advanced settings dialog
+        *
+        * @since S60 3.2
+        */
+        virtual void RunAdvancedSettingsL();
+        
+    public: // from class MCmCommsDatWatcher
+        
+        /**
+         * Watch changes in CommsDat
+         */
+        void CommsDatChangesL();
+   
+    protected:  // From MEikMenuObserver 
+    
+        /**
+        * From MEikMenuObserver
+        * displays the options menu
+        *
+        * @param aResourceId the options menu to use
+        * @param aMenuPane a pointer to the menu pane control
+        * @since S60 3.2
+        */
+        virtual void DynInitMenuPaneL( TInt aResourceId, 
+                                             CEikMenuPane* aMenuPane ) ;
+
+        /** From CAknDialog */
+        TBool OkToExitL( TInt aButtonId );
+    
+    private: // Constructors
+    
+        CmPluginVpnSettingsDlg( CCmPluginBaseEng& aCmPluginBaseEng );    
+    
+    private: // From CmPluginBaseSettingsDlg
+        
+        /**
+        * From CmPluginBaseSettingsDlg
+        * according to the setting type the correct edit dialog is displayed
+        *
+        * @since S60 3.2
+        * @param aAttribute
+        * @param aCommandId
+        */
+        virtual TBool ShowPopupSettingPageL( TUint32 aAttribute, 
+                                             TInt aCommandId  );
+
+        /**
+        * From CmPluginBaseSettingsDlg
+        * Get help contest of the plugin
+        *
+        * @since S60 5.0
+        */
+				virtual void GetHelpContext( TCoeHelpContext& aContext ) const;
+                                             
+    private: // New functions
+    
+        /**
+        * Displays a radio button dialog for user selection of connection
+        * methods (filters out VPN connection method) takes responsibility
+        * for updating the setting value
+        *
+        * @since S60 3.2
+        * @returns ETrue if update was made
+        */
+        TBool ShowIapSelectionSettingPageL();
+        
+    private: // From MEikCommandObserver
+    
+        /**
+        * From MEikCommandObserver
+        * see base class for description
+        *
+        * @since S60 3.2
+        * @param aCommandId
+        */
+        virtual void ProcessCommandL( TInt aCommandId );
+
+
+        /**
+        * Checks whether the compulsory fields have been filled or not.
+        *
+        * @since S60 3.2
+        * @return Whether the compulsory fields have been filled or not.
+        */
+        TBool CompulsoryFilledL();
+        
+    };
+
+#endif // CMPLUGINVPN_SETTINGS_DLG_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginvpn/inc/cmvpncommonconstants.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* 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:  constants for the VPN plugin
+*
+*/
+
+#ifndef CMVPNCOMMONCONSTANTS_H
+#define CMVPNCOMMONCONSTANTS_H
+
+// CONSTANTS
+_LIT( KPluginVPNResDirAndFileName, "z:cmpluginvpnui.rsc" );
+
+const TInt KVpnProxyPortNumberDefault = 80;
+
+#endif  // CMVPNCOMMONCONSTANTS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginvpn/loc/cmpluginvpn.loc	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,149 @@
+/*
+* 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 definitions for project VPN Plugin
+*
+*/
+
+//  LOCALISATION STRINGS
+
+//d: First line of a double large graphic style listbox - VPN specific
+//l: list_single_graphic_pane_t1_cp2
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_bearer_supported_vpn "VPN"
+
+//d: The name for the newly created connection method
+//l: list_double_graphic_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_method_name_vpn "VPN over ’%U’"
+
+
+//d: Note displayed upon opening the VPN connection method settings
+//d: if the VPN connection method is invalid
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_vpn_info_vpn_iap_incomplete "VPN access point is incomplete. Try reconfiguring the access point."
+
+//d: VPN policy setting
+//l: list_setting_pane_t1
+//w:
+//r: 3.2
+//
+#define qtn_vpn_sett_vpn_iap_policy_reference "VPN policy"
+
+//d: Possible value for VPN policy setting
+//l: list_set_graphic_pane_t1
+//w:
+//r: 5.1
+//
+#define qtn_vpn_sett_vpn_iap_policy_reference_compulsory "Must be defined"
+
+//d: Information note indicatinf that no VPN policies are installed and that
+//d: one is needed if a VPN connection method is to be used
+//l: popup_note_window
+//w:
+//r: 3.2
+//
+#define qtn_vpn_info_no_policies_installed "No VPN policies installed. Please install a policy via VPN policies view."
+
+//d: Internet access point setting
+//l: list_setting_pane_t1
+//w:
+//r: 3.2
+//
+#define qtn_vpn_sett_vpn_iap_real_netw_reference "Network connection"
+
+//d: Setting value text in internet access point settings view
+//l: list_set_graphic_pane_t1
+//w:
+//r: 5.1
+//
+#define qtn_vpn_sett_vpn_iap_real_netw_ref_compulsory "Must be defined"
+
+//d: Note displayed to indicate that the VPN client is not available
+//d: and new VPN connection methods cannot be added. This may be 
+//d: due to the VPN client residing on a disconnected memory card
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_vpn_info_mgmt_ui_not_accessible "Unable to access VPN data. Memory card might not be accessible."
+
+//d: Title of Select VPN Policy list query.
+//l: heading_pane_t1 
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_prmpt_vpn_policy "Select VPN policy:"
+
+//d: Title of Select VPN real connection selection query list box
+//l: heading_pane_t1 
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_prmpt_vpn_real_connection "Select connection:"
+
+//d: Primary item in 'Select VPN real connection selection query'
+//d: for selecting a WLAN network as an underlying VPN connection method
+//l: list_double_large_graphic_pane_t1_cp2
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_vpn_easy_wlan "WLAN network"
+
+//d: Secondary item in the 'Select VPN real connection selection query'
+//d: paired with the WLAN network primary item
+//l: list_double_large_graphic_pane_t2_cp2
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_vpn_easy_wlan_prompt "Prompt for WLAN"
+
+//d: Destination list text, notes the number of connections methods
+//d: belonging to the destination
+//l: list_double_large_graphic_pane_t2_cp2
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_conn_methods_amount_many    "%N connection methods"
+
+//d: Destination list text. Notes that the destination has one 
+//d: connection method
+//l: list_double_large_graphic_pane_t2_cp2
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_conn_methods_amount_one      "1 connection method"
+
+//d: Note shown when attempting to create a VPN access point using the wizard.
+//d: Shown if there are no valid underlying connection methods to select.
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_info_no_cm_to_bind_to "Unable to add. No valid destinations or connection methods to be used exist."
+
+//d: Query displayed when an incomplete VPN connection method is tried to be saved
+//d: Operation is confirmed with this confirmation query.
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_vpn_quest_vpn_iap_incomplete_delete "Incomplete VPN access point details. Exit without saving?"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginvpn/src/cmpluginproxyvpn.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,34 @@
+/*
+* 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:  VPN plug-in's ECom proxy descriptor.
+*
+*/
+
+#include "cmpluginvpn.h"
+#include <e32std.h>
+#include <ecom/implementationproxy.h>
+
+// Exported proxy for instantiation method resolution
+// Define the interface UIDs
+const TImplementationProxy ImplementationTable[] = 
+    {
+    IMPLEMENTATION_PROXY_ENTRY( KPluginVPNBearerTypeUid, CCmPluginVpn::NewL)
+    };
+
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+    {
+    aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+
+    return ImplementationTable;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginvpn/src/cmpluginvpn.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,2050 @@
+/*
+* 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:  VPN plug-in IF implementation class.
+*
+*/
+
+#include <AknsUtils.h>
+#include <cmpluginvpn.mbg>
+#include <cmpluginvpnui.rsg>
+#include <cmmanager.rsg>
+#include <StringLoader.h>
+#include <data_caging_path_literals.hrh>
+#include <cmpluginbaseeng.h>
+#include <cmpluginbase.h>
+#include <cmcommonui.h>
+#include <aknPopup.h>
+#include <aknlistquerydialog.h>
+#include <AknIconArray.h>
+#include <vpnapidefs.h>
+#include <cmpluginwlandef.h>
+// #include <vpnapi.h>
+#include <centralrepository.h>
+#include <SettingsInternalCRKeys.h>
+#include <featmgr.h>
+#include <ConeResLoader.h>
+#include <bautils.h>
+
+#include "cmlogger.h"
+#include "cmmanagerimpl.h"
+#include "cmdestinationimpl.h"
+#include "cmvpncommonconstants.h"
+#include <cmcommonconstants.h>
+#include "cmpluginvpn.h"
+#include "cmpvpnsettingsdlg.h"
+#include "cmpvpnpolicyselectiondlg.h"
+#include "cmpvpnnextlayerselectdlg.h"
+
+using namespace CMManager;
+
+_LIT( KPluginVpnFileIcons, "z:cmpluginvpn.mbm" );
+//_LIT(KListItemFormat, "%d\t%S\t%S");
+
+static const TCmAttribConvTable SVpnConvTbl[] = 
+    {
+        { EVpnServicePolicyName, EPluginVpnAttribRangeMax, NULL },
+        { EVpnServicePolicy, KCDTIdVPNPolicyName, NULL,
+          R_QTN_VPN_SETT_VPN_IAP_POLICY_REFERENCE,
+          0, EConvCompulsory, R_QTN_VPN_SETT_VPN_IAP_POLICY_REFERENCE_COMPULSORY, 0, NULL, NULL },
+        { EVpnServicePolicyName, 0, NULL,
+          R_QTN_VPN_SETT_VPN_IAP_POLICY_REFERENCE,
+          0, EConvCompulsory, R_QTN_VPN_SETT_VPN_IAP_POLICY_REFERENCE_COMPULSORY, 0, NULL, NULL },
+        { EVpnIapId, KCDTIdVPNIAPRecord, NULL },
+        { EVpnNetworkId, KCDTIdVPNNetwork, &ReadOnlyAttributeL },
+        { 0, 0, NULL }
+    };
+
+static const TCmAttribConvTable SVpnVirtualIAPNextLayerConvTbl[] = 
+    {
+        { ECmNextLayerIapId, ECmNextLayerSNAPId+1, NULL },
+        { ECmNextLayerIapId, KCDTIdVirtualNextLayerIAP, NULL },
+        { ECmNextLayerSNAPId, KCDTIdVirtualNextLayerSNAP, NULL },
+        { 0, 0, NULL }
+    };
+    
+_LIT( KVpnVirtualBearerName, "vpnbearer" );
+_LIT( KVpnVirtualBearerAgent, "vpnconnagt.agt" );
+_LIT( KVpnVirtualBearerNif, "tunnelnif" );
+
+// constants needed for the virtualbearer table
+const TInt KNoTimeout = -1;
+const TUint32 KLastSessionTimeout = 3;
+
+
+const TUint32 KContainsVpn =        0x01;
+const TUint32 KLinksBackToParent =  0x02;
+const TUint32 KEmptyDest =          0x04;
+const TUint32 KNoNonVirtuals =      0x08;
+
+const TUint32 KBindDenied = KLinksBackToParent | KContainsVpn;
+
+// --------------------------------------------------------------------------
+// CCmPluginVpn::NewL()
+// --------------------------------------------------------------------------
+//
+CCmPluginVpn* CCmPluginVpn::NewL( TCmPluginInitParam* aInitParam )
+    {
+
+    CRepository* repository = CRepository::NewLC(KCRUidCommunicationSettings);
+
+    TInt vpnSupported;
+    repository->Get(KSettingsVPNSupported, vpnSupported);
+
+    CleanupStack::PopAndDestroy(repository);
+
+    if( !vpnSupported )
+        {
+        User::Leave( KErrNotSupported );
+        }
+
+    CCmPluginVpn* self = new( ELeave ) CCmPluginVpn( aInitParam );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CCmPluginVpn::~CCmPluginVpn()
+// --------------------------------------------------------------------------
+//
+CCmPluginVpn::~CCmPluginVpn()
+    {
+    CCmPluginVpn::AdditionalReset();
+    
+    RemoveResourceFile( KPluginVPNResDirAndFileName );
+    
+    iBindableMethods.Reset();
+    iBindableMethods.Close();
+    delete iPolicyName;
+    CLOG_CLOSE;
+    }
+
+// --------------------------------------------------------------------------
+// CCmPluginVpn::CreateInstanceL
+// --------------------------------------------------------------------------
+//
+CCmPluginBaseEng* CCmPluginVpn::CreateInstanceL( TCmPluginInitParam& aInitParam ) const
+    {
+    CCmPluginVpn* self = new( ELeave ) CCmPluginVpn( &aInitParam );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+    
+// --------------------------------------------------------------------------
+// CCmPluginVpn::CCmPluginVpn()
+// --------------------------------------------------------------------------
+//
+CCmPluginVpn::CCmPluginVpn( TCmPluginInitParam* aInitParam )
+    : CCmPluginBaseEng( aInitParam )
+    , iBindableMethods( KCmArraySmallGranularity )
+    {
+    CLOG_CREATE;
+    iBearerType = KPluginVPNBearerTypeUid;
+    }
+
+// --------------------------------------------------------------------------
+// CCmPluginVpn::ConstructL()
+// --------------------------------------------------------------------------
+//
+void CCmPluginVpn::ConstructL()
+    {
+    CCmPluginBaseEng::ConstructL();
+
+    TRAP_IGNORE( iVirtualTableId = 
+                        CCDVirtualIAPNextLayerRecord::TableIdL( Session() ) );
+    if( !iVirtualTableId )
+        {
+        iVirtualTableId = CCDVirtualIAPNextLayerRecord::CreateTableL( Session() );
+        }
+
+    AddResourceFileL( KPluginVPNResDirAndFileName );
+    
+    AddConverstionTableL( (CCDRecordBase**)&iServiceRecord, NULL, SVpnConvTbl );
+    
+    iPolicyName = KNullDesC().AllocL();
+    }
+    
+// --------------------------------------------------------------------------
+// CCmPluginVpn::GetIntAttributeL()
+// --------------------------------------------------------------------------
+//
+TUint32 CCmPluginVpn::GetIntAttributeL( const TUint32 aAttribute ) const
+    {
+    LOGGER_ENTERFN( "CCmPluginVpn::GetIntAttributeL" );
+
+    TUint32 retVal( 0 );
+    
+    switch( aAttribute )
+        {
+        case ECmBearerIcon:
+            {
+            TAknsItemID id;
+            
+            MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
+                   
+            TParse mbmFile;
+            User::LeaveIfError( mbmFile.Set( KPluginVpnFileIcons, 
+                                             &KDC_BITMAP_DIR, 
+                                             NULL ) );
+                   
+            retVal = (TUint32)AknsUtils::CreateGulIconL( 
+                                    skinInstance, 
+                                    id,
+                                    mbmFile.FullName(), 
+                                    EMbmCmpluginvpnQgn_prop_vpn_access_point, 
+                                    EMbmCmpluginvpnQgn_prop_vpn_access_point_mask );
+            }
+            break;
+               
+        case ECmCommsDBBearerType:
+            {
+            retVal = KCommDbBearerVirtual;
+            }
+            break;
+        
+        case ECmDefaultUiPriority:
+        case ECmDefaultPriority:            
+            {
+            retVal = aAttribute == ECmDefaultPriority ?
+                        GlobalBearerPriority( TPtrC(KCDTypeNameVPNService) ) :
+                        GlobalUiBearerPriority( TPtrC(KCDTypeNameVPNService) );
+            }
+            break;  
+            
+        case EVpnIapId:
+            {
+            if( !ServiceRecordExists() )
+                {
+                User::Leave( KErrNotSupported );
+                }
+
+            retVal = ServiceRecord().iServiceIAP;
+            }
+            break;
+        case EVpnNetworkId:
+            {
+            if( !ServiceRecordExists() )
+                {
+                User::Leave( KErrNotSupported );
+                }
+
+            retVal = ServiceRecord().iServiceNetwork;
+            }
+            break;
+        case ECmNextLayerIapId:    
+            {
+            retVal = iVirtualRecord->iNextLayerIAP;
+            }  
+            break;
+        case ECmNextLayerSNAPId:           
+            {
+            retVal = iVirtualRecord->iNextLayerSNAP;
+            }  
+            break;
+        case ECmIapId:
+        case ECmId:
+        case ECmWapId:
+        case ECmIapServiceId:
+        case ECmInvalidAttribute:
+        case ECmLoadResult:
+        case ECmBearerType:
+        case ECmSeamlessnessLevel:
+        case ECmElementID:
+        case ECmNetworkId:
+        case ECmProxyPortNumber:
+        case ECmExtensionLevel:
+        case ECmWapIPWSPOption:
+        case ECmWapIPProxyPort:
+        case ECmNamingMethod:
+            {
+            retVal = CCmPluginBaseEng::GetIntAttributeL( aAttribute );
+            }
+            break;
+        
+        default:
+            {
+            User::Leave( KErrNotSupported );
+            }
+        }
+        
+    return retVal;
+    }
+
+// --------------------------------------------------------------------------
+// CCmPluginVpn::GetBoolAttributeL()
+// --------------------------------------------------------------------------
+//
+TBool CCmPluginVpn::GetBoolAttributeL( const TUint32 aAttribute ) const
+    {
+    LOGGER_ENTERFN( "CCmPluginVpn::GetBoolAttributeL" );
+
+    TBool retVal( EFalse );
+
+    switch( aAttribute )
+        {
+        case ECmAddToAvailableList:
+            {
+            retVal = EFalse;
+            }
+            break;
+            
+        case ECmChargeCardUsageEnabled:
+            {
+            retVal = EFalse;
+            }
+            break;
+        case ECmBearerHasUi:
+            {
+            retVal = ETrue;
+            break;
+            }
+        case ECmCoverage:
+        case ECmDestination:
+        case ECmIPv6Supported:
+        case ECmHidden:
+        case ECmProtected:
+        case ECmMetaHighlight:
+        case ECmMetaHiddenAgent:
+        case ECmProxyUsageEnabled:
+        case ECmConnected:
+        case ECmIsLinked:
+        case ECmWapIPSecurity:
+            {
+            retVal = CCmPluginBaseEng::GetBoolAttributeL( aAttribute );
+            }
+            break;
+        case ECmVirtual:
+            {
+            return ETrue;
+            }           
+        default:
+            {
+            User::Leave( KErrNotSupported );
+            
+            }
+        }
+        
+    return retVal;
+    }
+
+// --------------------------------------------------------------------------
+// CCmPluginVpn::GetStringAttributeL()
+// --------------------------------------------------------------------------
+//
+HBufC* CCmPluginVpn::GetStringAttributeL( const TUint32 aAttribute ) const
+    {
+    LOGGER_ENTERFN( "CCmPluginVpn::GetStringAttributeL" );
+
+    HBufC* retVal = NULL;
+    
+    switch( aAttribute )
+        {           
+        case ECmBearerSupportedName:
+            {
+            retVal = AllocReadL( R_QTN_NETW_CONSET_BEARER_SUPPORTED_VPN );
+            }
+            break;
+        
+        case EVpnServicePolicyName:
+            {
+            if( !ServiceRecordExists() )
+                {
+                User::Leave( KErrNotSupported );
+                }
+            else 
+                {
+                CCmPluginVpn* tmp = const_cast< CCmPluginVpn * >( this );
+                tmp->UpdatePolicyNameL();
+                }
+            retVal = iPolicyName->AllocL();
+            break;
+            }
+        case EVpnServicePolicy:
+            {
+            if( !ServiceRecordExists() )
+                {
+                User::Leave( KErrNotSupported );
+                }
+
+            if( !ServiceRecord().iServicePolicy.IsNull() )
+                {
+                retVal = ServiceRecord().iServicePolicy.GetL().AllocL();
+                } 
+            else
+                {
+                retVal = KNullDesC().AllocL();
+                }
+            }
+            break;
+            
+        case ECmName:   
+        case ECmProxyServerName:
+        case ECmProxyProtocolName:
+        case ECmProxyExceptions:
+        case ECmWapIPGatewayAddress:
+        case ECmWapIPProxyLoginName:
+        case ECmWapIPProxyLoginPass:
+        case ECmStartPage:
+            {
+            retVal = CCmPluginBaseEng::GetStringAttributeL( aAttribute );
+            }
+            break;
+            
+        default:
+            {
+            User::Leave( KErrNotSupported );
+            }
+            break;
+        }
+        
+    return retVal;
+    }
+
+// --------------------------------------------------------------------------
+// CCmPluginVpn::GetString8AttributeL()
+// --------------------------------------------------------------------------
+//
+HBufC8* CCmPluginVpn::GetString8AttributeL( const TUint32 aAttribute ) const
+    {
+    LOGGER_ENTERFN( "CCmPluginVpn::GetString8AttributeL" );
+
+    HBufC8* retVal = NULL;
+    
+    switch( aAttribute )
+        {
+        default:
+            {
+            User::Leave( KErrNotSupported );
+            }
+            break;
+        }
+        
+    return retVal;
+    }
+
+// --------------------------------------------------------------------------
+// CCmPluginVpn::SetIntAttributeL()
+// --------------------------------------------------------------------------
+//
+void CCmPluginVpn::SetIntAttributeL( const TUint32 aAttribute, 
+                                            TUint32 aValue )
+    {
+    LOGGER_ENTERFN( "CCmPluginVpn::SetIntAttributeL" );
+
+    switch( aAttribute )
+        {
+        case ECmNextLayerIapId: 
+        case EVpnIapId:
+            {
+            CheckRecordIdValidityL( this, EVpnIapId, &aValue );
+            
+            // ServiceRecord.iServiceIAP should be 0 according to 
+            // DM CommsDat Contents v1.4, but for now it is made
+            // backward compatible
+            if( !ServiceRecordExists() )
+                {
+                User::Leave( KErrNotSupported );
+                }
+            
+            ServiceRecord().iServiceIAP = aValue;
+            ServiceRecord().iServiceNetwork = 0;
+            iVirtualRecord->iNextLayerIAP = aValue;
+            iVirtualRecord->iNextLayerSNAP = 0;            
+            }
+            break;
+
+        case EVpnNetworkId:
+        case ECmNextLayerSNAPId:
+            {
+            // To keep backwards compability, keep these 2 attributes
+            // (EVpnNetworkId & ECmNextLayerSNAPId) together even though
+            // network id and destination id are no longer exactly the same.
+            if( !ServiceRecordExists() )
+                {
+                User::Leave( KErrNotSupported );
+                }
+
+            TInt destinationId( 0 );
+            destinationId = CheckValidityAndConvertDestinationIdL( aValue );
+            
+            ServiceRecord().iServiceIAP = 0;          
+            ServiceRecord().iServiceNetwork = destinationId - KCmDefaultDestinationAPTagId;
+            iVirtualRecord->iNextLayerIAP = 0;
+            iVirtualRecord->iNextLayerSNAP = destinationId;       
+            }
+            break;
+
+        case ECmSeamlessnessLevel:
+        case ECmProxyPortNumber:
+        case ECmNamingMethod:
+        case ECmWapIPWSPOption:
+        case ECmWapIPProxyPort:
+            {
+            CCmPluginBaseEng::SetIntAttributeL( aAttribute, aValue );
+            }
+            break;
+            
+        default:
+            {
+            User::Leave( KErrNotSupported );
+            }
+            break;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CCmPluginVpn::SetBoolAttributeL()
+// --------------------------------------------------------------------------
+//
+void CCmPluginVpn::SetBoolAttributeL( const TUint32 aAttribute, 
+                                      TBool aValue )
+    {
+    LOGGER_ENTERFN( "CCmPluginVpn::SetBoolAttributeL" );
+
+    switch( aAttribute )
+        {
+        case ECmChargeCardUsageEnabled:
+            {
+            User::Leave( KErrNotSupported );
+            }
+            break;
+
+        case ECmHidden:
+        case ECmProtected:
+        case ECmMetaHighlight:
+        case ECmMetaHiddenAgent:
+        case ECmProxyUsageEnabled:
+        case ECmWapIPSecurity:
+            {
+            CCmPluginBaseEng::SetBoolAttributeL( aAttribute, aValue );
+            }
+            break;
+            
+        default:
+            {
+            User::Leave( KErrNotSupported );
+            }
+            break;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CCmPluginVpn::SetStringAttributeL()
+// --------------------------------------------------------------------------
+//
+void CCmPluginVpn::SetStringAttributeL( const TUint32 aAttribute, 
+                                        const TDesC16& aValue )
+    {
+    LOGGER_ENTERFN( "CCmPluginVpn::SetStringAttributeL" );
+
+    switch( aAttribute )
+        {
+        case EVpnServicePolicyName:
+            {
+            HBufC* tmp = aValue.AllocLC();
+            delete iPolicyName;
+            iPolicyName = tmp;
+            CleanupStack::Pop( tmp );
+            break;
+            }        
+        case EVpnServicePolicy:
+            {
+            if( !ServiceRecordExists() )
+                {
+                User::Leave( KErrNotSupported );
+                }
+            
+            CLOG_WRITE_1( "New policy set:[%S]", &aValue );
+            ServiceRecord().iServicePolicy.SetL( aValue );
+            }
+            break;
+        case ECmProxyServerName:
+            {
+            CCmPluginBaseEng::SetStringAttributeL( aAttribute, aValue );
+            if( !aValue.Length() || !iProxyRecord->iPortNumber )
+                {
+                iProxyRecord->iPortNumber = KVpnProxyPortNumberDefault;
+                }
+            }
+            break;
+
+        case ECmName:
+        case ECmProxyProtocolName:
+        case ECmProxyExceptions:
+        case ECmWapIPGatewayAddress:
+        case ECmWapIPProxyLoginName:
+        case ECmWapIPProxyLoginPass:
+        case ECmStartPage:
+            {
+            CCmPluginBaseEng::SetStringAttributeL( aAttribute, aValue );
+            }
+            break;
+
+        default:
+            {
+            User::Leave( KErrNotSupported );
+            }
+            break;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CCmPluginVpn::SetString8AttributeL()
+// --------------------------------------------------------------------------
+//
+void CCmPluginVpn::SetString8AttributeL( const TUint32 aAttribute, 
+                                         const TDesC8& /*aValue*/ )
+    {
+    LOGGER_ENTERFN( "CCmPluginVpn::SetString8AttributeL" );
+
+    switch( aAttribute )
+        {
+        default:
+            {
+            User::Leave( KErrNotSupported );
+            }
+            break;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CCmPluginVpn::CanHandleIapIdL()
+// --------------------------------------------------------------------------
+//
+TBool CCmPluginVpn::CanHandleIapIdL( TUint32 aIapId ) const
+    {
+    LOGGER_ENTERFN( "CCmPluginVpn::CanHandleIapIdL1" );
+    TBool retVal( EFalse );
+    
+    CCDIAPRecord *iapRecord = static_cast<CCDIAPRecord *>
+                            (CCDRecordBase::RecordFactoryL(KCDTIdIAPRecord));
+        
+    CleanupStack::PushL( iapRecord );
+    iapRecord->SetRecordId( aIapId );
+    
+    TRAPD( err, iapRecord->LoadL( Session() ));
+
+    if( !err )
+        {
+        CanHandleIapIdL( iapRecord );
+        }
+    
+    CleanupStack::PopAndDestroy( iapRecord );
+    return retVal;
+    }
+
+// --------------------------------------------------------------------------
+// CCmPluginVpn::CanHandleIapIdL()
+// --------------------------------------------------------------------------
+//
+TBool CCmPluginVpn::CanHandleIapIdL( CCDIAPRecord *aIapRecord ) const
+    {
+    LOGGER_ENTERFN( "CCmPluginVpn::CanHandleIapIdL" );
+    
+    TBool retVal( EFalse );
+    
+    if( TPtrC(aIapRecord->iServiceType) == TPtrC(KCDTypeNameVPNService) ||
+        TPtrC(aIapRecord->iBearerType) == TPtrC(KCDTypeNameVirtualBearer) )
+        {
+        retVal = ETrue;
+        }
+
+    return retVal;
+    }
+
+// --------------------------------------------------------------------------
+// CCmPluginVpn::RunSettingsL()
+// --------------------------------------------------------------------------
+//        
+TInt CCmPluginVpn::RunSettingsL()
+    {
+    LOGGER_ENTERFN( "CCmPluginVpn::RunSettingsL" );
+    CmPluginVpnSettingsDlg* dlg = CmPluginVpnSettingsDlg::NewL( *this );
+    
+    return dlg->ConstructAndRunLD();
+    }        
+
+// --------------------------------------------------------------------------
+// CCmPluginVpn::LoadServiceSettingL()
+// --------------------------------------------------------------------------
+//        
+void CCmPluginVpn::LoadServiceSettingL()
+    {
+    LOGGER_ENTERFN( "CCmPluginVpn::LoadServiceSettingL" );
+    
+    if( TPtrC(KCDTypeNameVPNService) == iIapRecord->iServiceType  )
+        {
+        iServiceRecord = static_cast<CCDVPNServiceRecord *>
+                    (CCDRecordBase::RecordFactoryL(KCDTIdVPNServiceRecord));
+        }
+    else
+        // this IAP service is not supported by this plugin.
+        {
+        User::Leave( KErrNotSupported );
+        }
+
+        
+    CCmPluginBaseEng::LoadServiceSettingL();
+    }
+    
+
+// --------------------------------------------------------------------------
+// CCmPluginVpn::LoadAdditionalRecordsL()
+// --------------------------------------------------------------------------
+//        
+void CCmPluginVpn::LoadAdditionalRecordsL()
+    {
+    LOGGER_ENTERFN( "CCmPluginVpn::LoadAdditionalRecordsL" );
+
+    iVirtualRecord = new (ELeave) CCDVirtualIAPNextLayerRecord( iVirtualTableId );
+    
+    CMDBRecordSet<CCDVirtualIAPNextLayerRecord>* virtualRS = 
+              new(ELeave) CMDBRecordSet<CCDVirtualIAPNextLayerRecord>( iVirtualTableId );
+    CleanupStack::PushL( virtualRS );
+    
+    CCDVirtualIAPNextLayerRecord* record = 
+                            new (ELeave) CCDVirtualIAPNextLayerRecord( iVirtualTableId );
+    
+    record->iIAP = iIapId;
+    CleanupStack::PushL( record );
+    virtualRS->iRecords.AppendL( record );
+    CleanupStack::Pop( record );
+    record = NULL;
+    
+    if( virtualRS->FindL( Session() ) )
+        {
+        iVirtualRecord->SetRecordId( (*virtualRS)[0]->RecordId() );
+        
+        iVirtualRecord->LoadL( Session() );
+        
+        CLOG_WRITE_3( "Next layer: IAP[%d], NextSNAP[%d], NextIAP[%d]",
+                      TUint( iVirtualRecord->iIAP ),
+                      TUint( iVirtualRecord->iNextLayerSNAP ),
+                      TUint( iVirtualRecord->iNextLayerIAP ) );
+        }
+    else
+        {
+        CLOG_WRITE( "Virtual records not found" );
+        }
+    
+    CleanupStack::PopAndDestroy( virtualRS );
+    AddConverstionTableL( (CCDRecordBase**)&iVirtualRecord, NULL, SVpnVirtualIAPNextLayerConvTbl );
+    
+    if (iIapRecord->iRecordName.GetL() == KNullDesC) 
+        {
+        //now we have next layer info, so generate default cm name if name is empty (new cm)
+        GenerateDefaultCmNameL();
+        }
+        
+    if ( !iProxyRecord->iPortNumber )
+        {
+        iProxyRecord->iPortNumber = KVpnProxyPortNumberDefault;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CCmPluginVpn::InitializeWithUiL()
+// --------------------------------------------------------------------------
+//        
+TBool CCmPluginVpn::InitializeWithUiL( TBool /*aManuallyConfigure*/ )
+    {
+    LOGGER_ENTERFN( "CCmPluginVpn::InitializeWithUiL" );
+    TInt retVal( EFalse );
+    
+    // Compile a list of bindable methods, issue a warning if none found
+    if ( BindableRealConnectionsExistL() )
+        {
+        // check if the intended destination is not available for VPN,
+        // or, if the destination has not been set yet, whether there is 
+        // at least one suitable destination to place it in
+        TBool validParent = EFalse;
+        
+        if ( iParentDest )
+            {
+            // parent destination is known
+            // check if it is not linked by any other VPN
+            validParent = !HasUpstreamVpnL( iParentDest, ETrue );
+            }
+        else
+            {
+            // parent destination is not known yet
+            // check if there is any destination into which this VPN could be put
+
+            // trigger the recalculation
+            RArray<TUint32> parents ( CmMgr().DestinationCountL() );
+            CleanupClosePushL( parents );
+            
+            CmMgr().AllDestinationsL( parents );
+            
+            FilterPossibleParentsL( parents );
+
+            // if there is only one such destination, we should filter out 
+            // that one from the underlying candidates
+            if ( parents.Count() == 1 )
+                {
+                TInt destIndex = iBindableMethods.Find( parents[0] );
+                if ( destIndex != KErrNotFound )
+                    {
+                    // got it, now remove
+                    iBindableMethods.Remove( destIndex );
+                    }
+
+                if ( iBindableMethods.Count() )
+                    {
+                    // if there are still some methods to bind to,
+                    // mark the destination as valid
+                    validParent = ETrue;
+                    }
+                    
+                }
+            else 
+                {
+                validParent = ( parents.Count() > 0 );
+                }
+                
+            CleanupStack::PopAndDestroy( &parents );
+            }
+
+        if ( !validParent )
+            {
+            TCmCommonUi::ShowNoteL( R_CMWIZARD_NO_VPN_STACKING,
+                                    TCmCommonUi::ECmErrorNote );
+            
+            return retVal;
+            }
+              
+        
+        // Check VPN policies installed on the device
+        if ( ShowPolicySelectionDlgL() )
+            {
+            retVal = ShowRealConnectionSelectionDlgL();
+
+            if ( retVal )
+                {
+                if ( iIapRecord->iRecordName.GetL() == KNullDesC ) 
+                    {
+                    // now we have next layer info, so generate default cm name 
+                    GenerateDefaultCmNameL();
+                    }
+                
+                }
+            }
+        }
+    else
+        {
+        HBufC* buf = AllocReadL( R_QTN_NETW_CONSET_INFO_NO_CM_TO_BIND_TO );
+        TPtr ptr ( buf->Des() );
+        CleanupStack::PushL( buf );
+        TCmCommonUi::ShowNoteL( ptr, TCmCommonUi::ECmErrorNote );
+        CleanupStack::PopAndDestroy( buf );
+        }              
+    
+    return retVal;
+    }
+
+
+// --------------------------------------------------------------------------
+// CCmPluginVpn::ServiceRecord()
+// --------------------------------------------------------------------------
+//        
+CCDVPNServiceRecord& CCmPluginVpn::ServiceRecord() const
+    {
+    LOGGER_ENTERFN( "CCmPluginVpn::ServiceRecord" );
+    return *static_cast<CCDVPNServiceRecord*>( iServiceRecord );
+    }
+
+// --------------------------------------------------------------------------
+// CCmPluginVpn::ServiceRecordExists()
+// --------------------------------------------------------------------------
+// 
+TBool CCmPluginVpn::ServiceRecordExists() const
+    {
+    if ( !iServiceRecord )
+        {
+        return EFalse;
+        }
+    return ETrue;
+    }
+    
+// --------------------------------------------------------------------------
+// CCmPluginVpn::CreateNewServiceRecordL()
+// --------------------------------------------------------------------------
+//        
+void CCmPluginVpn::CreateNewServiceRecordL()
+    {
+    LOGGER_ENTERFN( "CCmPluginVpn::CreateNewServiceRecordL" );
+
+    delete iServiceRecord; iServiceRecord = NULL;
+    
+    iServiceRecord = static_cast<CCDVPNServiceRecord *>
+                    (CCDRecordBase::RecordFactoryL( KCDTIdVPNServiceRecord ));
+
+    CLOG_WRITE("New service record, policy emptied");
+    ServiceRecord().iServicePolicy.SetL( KNullDesC );
+    ServiceRecord().iServiceIAP = 0;
+    ServiceRecord().iServiceNetwork = 0;
+
+    
+    iProxyRecord->iPortNumber = KVpnProxyPortNumberDefault;
+
+    SetIntAttributeL( ECmSeamlessnessLevel, ESeamlessnessShowprogress );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginVpn::CreateAdditionalRecordsL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginVpn::CreateAdditionalRecordsL()
+    {
+    LOGGER_ENTERFN( "CCmPluginVpn::CreateAdditionalRecordsL" );
+
+    delete iVirtualRecord;
+    iVirtualRecord = NULL;
+    
+    iVirtualRecord = new (ELeave) CCDVirtualIAPNextLayerRecord( iVirtualTableId );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginVpn::UpdateServiceRecordL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginVpn::UpdateServiceRecordL()
+    {
+    LOGGER_ENTERFN( "CCmPluginVpn::UpdateServiceRecordL" );
+
+    CCmPluginBaseEng::UpdateServiceRecordL();
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginVpn::UpdateAdditionalRecordsL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginVpn::UpdateAdditionalRecordsL()
+    {
+    LOGGER_ENTERFN( "CCmPluginVpn::UpdateAdditionalRecordsL" );
+
+    CheckIfNameModifiedL( iVirtualRecord );
+    
+    if( !iVirtualRecord->RecordId() )
+        {
+        iVirtualRecord->SetRecordId( KCDNewRecordRequest );
+        
+        iVirtualRecord->iIAP = iIapId;
+        iVirtualRecord->StoreL( Session() );
+        }
+    else
+        {
+        iVirtualRecord->ModifyL( Session() );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginVpn::ServiceRecordIdLC
+// ---------------------------------------------------------------------------
+//
+void CCmPluginVpn::ServiceRecordIdLC( HBufC* &aName, 
+                                      TUint32& aRecordId )
+    {
+    LOGGER_ENTERFN( "CCmPluginVpn::ServiceRecordIdLC" );
+
+    aName = TPtrC( KCDTypeNameVPNService ).AllocLC();
+    aRecordId = iServiceRecord->RecordId();
+    }
+
+// --------------------------------------------------------------------------
+// CCmPluginVpn::BearerRecordIdLC()
+// --------------------------------------------------------------------------
+//        
+void CCmPluginVpn::BearerRecordIdLC( HBufC* &aBearerName, 
+                                     TUint32& aRecordId )
+    {
+    LOGGER_ENTERFN( "CCmPluginVpn::BearerRecordIdLC" );
+
+    CMDBRecordSet<CCDVirtualBearerRecord>* bearersRS = 
+              new(ELeave) CMDBRecordSet<CCDVirtualBearerRecord>
+                                                   (KCDTIdVirtualBearerRecord);
+    CleanupStack::PushL( bearersRS );
+
+    // Now try to find the linked proxy record
+    // create new record
+    CCDVirtualBearerRecord* bearerRecord = 
+                static_cast<CCDVirtualBearerRecord *>
+                    (CCDRecordBase::RecordFactoryL(KCDTIdVirtualBearerRecord));
+
+    CleanupStack::PushL( bearerRecord );
+    
+    bearerRecord->iBearerAgent.SetL( KVpnVirtualBearerAgent );
+    
+    bearersRS->iRecords.AppendL( bearerRecord );
+
+    CleanupStack::Pop( bearerRecord );
+    bearerRecord = NULL;
+    
+    CLOG_WRITE_1( "Looking for bearer: [%d]", TUint32(iIapRecord->iService) );
+    
+    if ( !bearersRS->FindL( Session() ) )
+        // No bearer record found -> create a default one.
+        {
+        bearerRecord = static_cast<CCDVirtualBearerRecord *>
+                    (CCDRecordBase::RecordFactoryL(KCDTIdVirtualBearerRecord));
+        CleanupStack::PushL(bearerRecord);
+
+        bearerRecord->iRecordName.SetL( KVpnVirtualBearerName );
+        bearerRecord->iBearerAgent.SetL( KVpnVirtualBearerAgent );
+        bearerRecord->iVirtualBearerNifName.SetL(KVpnVirtualBearerNif);
+        bearerRecord->iLastSocketActivityTimeout = (TUint32)KNoTimeout;
+        bearerRecord->iLastSessionClosedTimeout = KLastSessionTimeout;
+        bearerRecord->iLastSocketClosedTimeout = (TUint32)KNoTimeout;
+        
+        bearerRecord->SetRecordId( KCDNewRecordRequest );
+        bearerRecord->StoreL( Session() );
+        
+        aRecordId = bearerRecord->RecordId();
+
+        CleanupStack::PopAndDestroy(bearerRecord);
+        }
+    else
+        {
+        aRecordId = (*bearersRS)[0]->RecordId();
+        }
+
+    CleanupStack::PopAndDestroy( bearersRS );
+
+    aBearerName = TPtrC( KCDTypeNameVirtualBearer ).AllocLC();
+    }
+
+// --------------------------------------------------------------------------
+// CCmPluginVpn::AdditionalReset()
+// --------------------------------------------------------------------------
+//        
+void CCmPluginVpn::AdditionalReset()
+    {
+    LOGGER_ENTERFN( "CCmPluginVpn::AdditionalReset" );
+
+    delete iNetworkRecord;
+    iNetworkRecord = NULL;
+
+    delete iVirtualRecord;
+    iVirtualRecord = NULL;
+    }
+
+// --------------------------------------------------------------------------
+// CCmPluginVpn::PrepareToUpdateRecordsL()
+// --------------------------------------------------------------------------
+//        
+void CCmPluginVpn::PrepareToUpdateRecordsL()
+    {
+    LOGGER_ENTERFN( "CCmPluginVpn::PrepareToUpdateRecordsL" );
+    // Check here if every data of the connection method is valid
+    // before records were saved to CommsDat.
+    // Set incorrect attribute id in iInvalidAttribute and leave
+    // with KErrArgument.
+    }
+
+// --------------------------------------------------------------------------
+// CCmPluginVpn::ShowPolicySelectionDlgL
+// --------------------------------------------------------------------------
+//  
+TBool CCmPluginVpn::ShowPolicySelectionDlgL()
+    {
+    LOGGER_ENTERFN( "CCmPluginVpn::ShowPolicySelectionDlgL" );
+
+    TBool retVal ( EFalse );
+    
+    CmPluginVpnPolicySelectionDlg* dlg = 
+                                CmPluginVpnPolicySelectionDlg::NewL( *this );
+    CleanupStack::PushL( dlg );
+    retVal = dlg->ShowPolicySelectionListL();
+    CleanupStack::PopAndDestroy();
+    
+    return retVal;
+    }
+
+
+// --------------------------------------------------------------------------
+// CCmPluginVpn::BindableRealConnectionsExistL
+// --------------------------------------------------------------------------
+//  
+TBool CCmPluginVpn::BindableRealConnectionsExistL()
+    {
+    LOGGER_ENTERFN( "CCmPluginVpn::BindableRealConnectionsExistL" );
+
+    TBool retVal ( EFalse );
+    
+    iBindableMethods.Close();
+    
+    // Compile and array of destination IDs which the VPN CM can be bound to
+    // includes Uncategorised destination and Easy WLAN if valid
+    CmMgr().AllDestinationsL( iBindableMethods );
+
+    // Filter out invalid methods
+    for ( TInt i = 0; i < iBindableMethods.Count(); i++ )
+        {
+        TUint32 bindresult = 
+                CanDestUsedAsUnderlyingConnectionL( iBindableMethods[i] );
+                
+        if ( bindresult & (KBindDenied | KNoNonVirtuals | KEmptyDest ) )
+            {
+            iBindableMethods.Remove( i );
+            i--;
+            }
+        }
+    
+    // If there are destination IDs which the VPN CM can be bound to.
+    if( iBindableMethods.Count() )
+        {
+        retVal = ETrue;
+        }
+
+    // 2. Are there uncategorised connection methods which aren't virtual?
+    RArray<TUint32> cmArray ( KCmArrayMediumGranularity );
+    CleanupClosePushL( cmArray );
+    CmMgr().ConnectionMethodL( cmArray, EFalse );
+    
+    for ( TInt k = 0; k < cmArray.Count(); k++ )
+        {
+        TInt bearerType (0);
+        TRAPD( err, bearerType = CmMgr().GetConnectionMethodInfoIntL( 
+            cmArray[k], ECmBearerType ););
+
+        //if no plugin is found to handle the bearertype, GetConnectionMethodInfoIntL leaves with KErrNotSupported
+        if ( err == KErrNotSupported )				
+            {
+            //continue with the next element in the array
+            continue;
+            }
+                                                
+        // uncategorised contains a non-virtual connection method
+        if ( !CmMgr().GetBearerInfoBoolL( bearerType, ECmVirtual ) )
+            {
+            retVal = ETrue;
+            iBindableMethods.Append( KDestItemUncategorized );
+            break;
+            }
+        }
+    CleanupStack::PopAndDestroy( &cmArray );
+    
+    // 3. Is Easy WLAN available?
+    if ( FeatureManager::FeatureSupported( KFeatureIdProtocolWlan ) )
+        {        
+        // easy wlan is available
+        if ( CmMgr().EasyWlanIdL() )
+            {
+            iBindableMethods.Append( KDestItemEasyWlan );
+            retVal = ETrue;
+            }
+        }
+    
+    return retVal;
+    }
+
+// --------------------------------------------------------------------------
+// CCmPluginVpn::ShowRealConnectionSelectionDlgL
+// --------------------------------------------------------------------------
+//  
+TBool CCmPluginVpn::ShowRealConnectionSelectionDlgL()
+    {
+    LOGGER_ENTERFN( "CCmPluginVpn::ShowRealConnectionSelectionDlgL" );
+    TBool retVal ( EFalse );
+
+    TBool snapSelected ( EFalse );
+    TUint32 nextLayerId ( 0 );
+    
+    CmPluginVpnNextLayerSelectDlg* dlg = 
+                    CmPluginVpnNextLayerSelectDlg::NewL( *this,
+                                                         iBindableMethods,
+                                                         snapSelected,
+                                                         nextLayerId );
+    if ( dlg->ExecuteLD() )
+        {
+        // Handle results
+        retVal = ETrue;
+        }
+
+    return retVal;
+    }
+
+// --------------------------------------------------------------------------
+// CCmPluginVpn::IsLinkedToIap
+// --------------------------------------------------------------------------
+//  
+TBool CCmPluginVpn::IsLinkedToIap( TUint32 aIapId )
+    {
+    LOGGER_ENTERFN( "CCmPluginVpn::IsLinkedToIap" );
+
+    return ( ServiceRecord().iServiceIAP == aIapId );
+    }
+
+
+// --------------------------------------------------------------------------
+// CCmPluginVpn::IsLinkedToSnap
+// --------------------------------------------------------------------------
+//  
+TBool CCmPluginVpn::IsLinkedToSnap( TUint32 aSnapId )
+    {
+    LOGGER_ENTERFN( "CCmPluginVpn::IsLinkedToSnap" );
+
+    return ( iVirtualRecord->iNextLayerSNAP == aSnapId );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCmPluginVpn::RestoreAttributeL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginVpn::RestoreAttributeL( const TUint32 aAttribute )
+    {
+    LOGGER_ENTERFN( "CCmPluginVpn::RestoreAttributeL" );
+        
+    if ( aAttribute == EVpnServicePolicyName )
+        {
+        // also restore policy name
+        RVpnServ ps;
+        CleanupClosePushL<RVpnServ>( ps );
+        
+        TInt err = ps.Connect();
+        
+        if ( !err )
+            {
+            if( !ServiceRecordExists() )
+                {
+                User::Leave( KErrNotSupported );
+                }
+
+            CCDVPNServiceRecord *r = &(ServiceRecord());
+            TVpnPolicyName pId( r->iServicePolicy );
+            
+            TInt policyCount(0);
+            err = ps.EnumeratePolicies(policyCount);
+            if ( !err && policyCount)
+                {                
+                CArrayFixFlat<TVpnPolicyInfo>* policyList;
+                policyList = new (ELeave) CArrayFixFlat<TVpnPolicyInfo>(policyCount);
+                CleanupStack::PushL(policyList);
+
+                err = ps.GetPolicyInfoList(policyList);
+                
+                TBool found(EFalse);
+                
+                if ( err == KErrNone )
+                    {
+                    for (TInt i(0); i<policyList->Count(); ++i)
+                        {
+                        if (pId.Compare((*policyList)[i].iId) == 0 )
+                            {
+                            SetStringAttributeL( EVpnServicePolicyName,
+                                (*policyList)[i].iName );
+                            found = ETrue;
+                            break;    
+                            }
+                        }                    
+                    }
+                    
+                if ( err || (!found) )
+                    {
+                    CLOG_WRITE_1("Error when restoring policy attribute, [%d]", err );
+                    // the set policies are not installed,
+                    // or we can not access vpn client:
+                    // Must be defined qtn_selec_setting_compulsory is displayed 
+                    // for the invalid settings.                           
+                    // reset policy to compulsory
+                    SetStringAttributeL( EVpnServicePolicyName,
+                                                          KNullDesC() );
+                    SetStringAttributeL( EVpnServicePolicy, 
+                                                          KNullDesC() );                        
+                    }
+                CleanupStack::PopAndDestroy(policyList);              
+                }
+            }
+        CleanupStack::PopAndDestroy(); // ps.Close
+        }
+    // Type of EVpnIapId is ELink. This is plugin specified type.
+    // So, it should be handled here.
+    else if( aAttribute == EVpnIapId )
+        {
+        if( !ServiceRecordExists() )
+            {
+            User::Leave( KErrNotSupported );
+            }
+
+        ServiceRecord().iServiceIAP = 0;
+        iVirtualRecord->iNextLayerIAP = 0;
+        iVirtualRecord->iNextLayerSNAP = 0;
+        }
+    else
+        {
+        CCmPluginBaseEng::RestoreAttributeL( aAttribute );
+        }
+    }
+
+
+
+// --------------------------------------------------------------------------
+// CCmPluginVpn::GenerateDefaultCmNameL
+// --------------------------------------------------------------------------
+//
+void CCmPluginVpn::GenerateDefaultCmNameL()
+    {
+    LOGGER_ENTERFN( "CCmPluginVpn::GenerateDefaultCmNameL" );
+
+    //create default string
+    RFs fs;
+    CleanupClosePushL<RFs>( fs );
+    User::LeaveIfError( fs.Connect() );
+
+    // There may not be a UI context yet....
+    TFileName resourceFile;
+    _LIT( KDriveZ, "z:" );
+    resourceFile.Append( KDriveZ );
+    resourceFile.Append( KDC_RESOURCE_FILES_DIR );
+    _LIT( KCmmResFileName, "cmpluginvpnui.rsc" );
+    resourceFile.Append( KCmmResFileName );
+    BaflUtils::NearestLanguageFile( fs, resourceFile );
+
+    RResourceFile rf;
+    CleanupClosePushL<RResourceFile>( rf );
+    rf.OpenL( fs, resourceFile );
+    rf.ConfirmSignatureL( 0 );
+    HBufC8* readBuffer = rf.AllocReadLC( R_QTN_NETW_CONSET_METHOD_NAME_VPN );
+    const TPtrC16 ptrReadBuffer( (TText16*) readBuffer->Ptr(),
+                                 ( readBuffer->Length() + 1 ) >> 1 );
+    HBufC16* textBuffer=HBufC16::NewL( ptrReadBuffer.Length() );
+    CleanupStack::PushL( textBuffer );
+    *textBuffer=ptrReadBuffer;
+
+    // Find %U and replace it with %S
+    TPtr sourceString = textBuffer->Des();
+    _LIT(KPercentS,"%S");
+    _LIT(KPercentU,"%U");
+    TInt puPos = sourceString.Find(KPercentU);
+    if ( puPos >= 0 )
+        {
+        sourceString.Replace( puPos, 
+            static_cast<TDesC>(KPercentS).Length(), KPercentS );                
+        }
+
+    // Check if there is a length defined in copy of the recourse string e.g. "VPN(%U[08])"
+    // If it's found convert it to integer and remove it from the string.
+    TInt maxDataLength( 0 );
+    TInt perceLength = static_cast<TDesC>(KPercentS).Length();
+    if ( sourceString[puPos+perceLength] == '[' )
+        {
+        // Key includes max datalength 
+        maxDataLength = 10*( sourceString[puPos+perceLength+1]-'0' ) 
+                           + ( sourceString[puPos+perceLength+2]-'0' );
+        sourceString.Delete(puPos+perceLength,4);
+        }
+
+    // Get the IAP name which the VPM Connection Method points to
+    HBufC* refName = NULL;
+
+    if( !ServiceRecordExists() )
+        {
+        User::Leave( KErrNotSupported );
+        }
+    
+    if ( ServiceRecord().iServiceIAP )
+        {
+        // ask for the bearer type
+        TUint32 bearerType = CmMgr().GetConnectionMethodInfoIntL( 
+                ServiceRecord().iServiceIAP, ECmBearerType );
+        
+        if ( iCmMgr.EasyWlanIdL() && bearerType == KUidWlanBearerType )
+            {           
+            refName = GenerateVPNPointToWLANNetworkLC(rf, refName);
+            }
+        else
+            {
+            refName = iCmMgr.GetConnectionMethodInfoStringL(
+                                                ServiceRecord().iServiceIAP,
+                                                ECmName );
+            CleanupStack::PushL( refName );
+            }
+        }
+    else
+        {
+        CCmDestinationImpl* dest = iCmMgr.DestinationL( 
+                                            iVirtualRecord->iNextLayerSNAP );
+        CleanupStack::PushL( dest );
+        refName = dest->NameLC();
+        CleanupStack::Pop( refName ); 
+        CleanupStack::PopAndDestroy( dest );
+        CleanupStack::PushL( refName );
+        }
+    
+    TPtr16 refNamePtr = refName->Des();
+    // If there was a length definition e.g. [08]--> length is 8 the CM or
+    // Destination name must be cut to length - 1 and copy the ellipsis(shown as
+    // "...") to the end.
+    if( maxDataLength > 0 && refName->Length() > maxDataLength )
+        {
+        refNamePtr.Delete( maxDataLength-1, refName->Length()-maxDataLength+1);
+        TText ellipsis(KEllipsis);
+        refNamePtr.Insert( maxDataLength-1, TPtrC(&ellipsis,1) );
+        }
+        
+    if ( maxDataLength == 0 )
+        {
+        // Length not defined in resource string so set it to refName length
+        maxDataLength = refNamePtr.Length();
+        }
+    
+    HBufC* cmName = HBufC::NewL( sourceString.Length() + maxDataLength );
+    CleanupStack::PushL( cmName );
+    cmName->Des().Format(sourceString,  &refNamePtr);
+    SetStringAttributeL( ECmName,  *cmName );
+    CleanupStack::PopAndDestroy( cmName );
+    CleanupStack::PopAndDestroy( refName ); 
+    CleanupStack::PopAndDestroy( textBuffer ); 
+    CleanupStack::PopAndDestroy( readBuffer ); 
+    CleanupStack::PopAndDestroy( &rf );
+    CleanupStack::PopAndDestroy( &fs );
+    }
+    
+// --------------------------------------------------------------------------
+// CCmPluginVpn::GenerateDefaultCmNameL
+// --------------------------------------------------------------------------
+//
+void CCmPluginVpn::CreateNewL()
+    {
+    CCmPluginBaseEng::CreateNewL();
+
+    iIapRecord->iRecordName.SetL( KNullDesC );
+    }
+
+
+
+// --------------------------------------------------------------------------
+// CCmPluginVpn::LoadL
+// --------------------------------------------------------------------------
+//
+void CCmPluginVpn::LoadL( TUint32 aIapId )
+    {
+    CCmPluginBaseEng::LoadL( aIapId );
+    if ( iServiceRecord )
+        {
+//      UpdatePolicyNameL();
+        }
+    }
+        
+    
+// --------------------------------------------------------------------------
+// CCmPluginVpn::UpdatePolicyNameL
+// --------------------------------------------------------------------------
+//
+void CCmPluginVpn::UpdatePolicyNameL()
+    {
+    LOGGER_ENTERFN( "CCmPluginVpn::UpdatePolicyNameL" );
+    // now get policy name from ID
+    
+    RVpnServ ps;
+    CleanupClosePushL<RVpnServ>( ps );
+    TInt err = ps.Connect();
+
+    CLOG_WRITE_1( "Connected to VPN server, err [%d]", err ); 
+    
+    if (! err )        
+        {
+        if( !ServiceRecordExists() )
+            {
+            User::Leave( KErrNotSupported );
+            }
+
+        CCDVPNServiceRecord *r = &(ServiceRecord());
+        TVpnPolicyName pId( r->iServicePolicy );
+        TInt policyCount(0);
+        err = ps.EnumeratePolicies(policyCount);
+        if ( !err && policyCount)
+            {                
+            CArrayFixFlat<TVpnPolicyInfo>* policyList;
+            policyList = new (ELeave) CArrayFixFlat<TVpnPolicyInfo>(policyCount);
+            CleanupStack::PushL(policyList);
+
+            err = ps.GetPolicyInfoList(policyList);
+            if ( err )
+                {
+                // the set policies are not installed, 
+                // Must be defined qtn_selec_setting_compulsory is displayed 
+                // for the invalid settings.                           
+                // reset policy to compulsory
+                SetStringAttributeL( EVpnServicePolicyName,
+                                                      KNullDesC() );
+                SetStringAttributeL( EVpnServicePolicy, 
+                                                      KNullDesC() );                        
+                }
+            else
+                {
+                for (TInt i(0); i<policyList->Count(); ++i)
+                    {
+                    if (pId.Compare((*policyList)[i].iId) == 0 )
+                        {
+                        SetStringAttributeL( EVpnServicePolicyName,
+                            (*policyList)[i].iName );
+                        break;    
+                        }
+                    }
+                }
+            CleanupStack::PopAndDestroy(policyList);              
+            }
+        }
+    CleanupStack::PopAndDestroy(); // ps.close 
+    }
+
+
+// --------------------------------------------------------------------------
+// CCmPluginVpn::CanDestUsedAsUnderlyingConnectionL
+// --------------------------------------------------------------------------
+//
+TUint32 CCmPluginVpn::CanDestUsedAsUnderlyingConnectionL( TUint32 aDestinationId )
+    {
+    LOGGER_ENTERFN( "CCmPluginVpn::CanDestUsedAsUnderlyingConnectionL" );
+
+    TUint32 retval(KEmptyDest);
+    
+    TBool hasNonVirtualCm(EFalse);
+    
+    CCmDestinationImpl* dest = CmMgr().DestinationL( aDestinationId );
+    CleanupStack::PushL( dest );
+    
+    // is this our parent destination (if there is one)
+    CCmDestinationImpl* parentDest = ParentDestination();
+    if ( parentDest )
+        {
+        if ( dest->Id() == parentDest->Id() )
+            {
+            retval |= KLinksBackToParent;
+            }
+        }
+    delete parentDest;    
+    if ( !( retval & KBindDenied ) )
+        {
+        // filter out:
+        //      empty destinations
+        //      destinations containing VPN in or linked in
+        //      destinations containing emb. dest. if the linked dest is empty
+        
+        // so if we found a VPN inside, or a VPN linked through an amb. dest, 
+        // than it should be filtered out. 
+        // it also should be filtered out if it links back 
+        // to our parent dest. in any way...
+        
+        TInt count = dest->ConnectionMethodCount();
+        
+        if ( count )
+            {
+            // has at least one CM
+            retval &= ~KEmptyDest;
+            for ( TInt j = 0; j < dest->ConnectionMethodCount(); j++ )
+                {
+                CCmPluginBase* cm = dest->GetConnectionMethodL( j );
+                CleanupStack::PushL( cm );
+                TUint32 cmId = cm->GetIntAttributeL( ECmId );
+                
+                TInt bearerType = CmMgr().GetConnectionMethodInfoIntL( 
+                                        cmId, ECmBearerType );
+                if ( !CmMgr().GetBearerInfoBoolL( bearerType, ECmVirtual ) )
+                    {
+                    // found a non-virtual connection method
+                    hasNonVirtualCm = ETrue;
+                    }
+                else
+                    {
+                    // now we have to check if it is an emb.dest., if it is, 
+                    // check if the referenced destination is not empty,
+                    // it has at least one, non-virtual CM, 
+                    // OR it has another emb.dest., then recurse it...
+                    if ( CmMgr().GetBearerInfoBoolL( bearerType, ECmDestination ) )
+                        { // it is an emb. destination
+                        // get the emb. destination
+                        CCmDestinationImpl* embdest = cm->Destination();
+                        TUint32 emdestId = embdest->Id();
+                        // check if the embeded destination can be used
+                        TUint32 res = CanDestUsedAsUnderlyingConnectionL( emdestId );
+                        if ( res & KBindDenied )
+                            {
+                            // emb. dest. can not be used
+                            retval |= (res & KBindDenied );
+                            }
+                        else
+                            {
+                            // if binding is not denied, still what to do with 
+                            // KEmptyDest & KNoNonVirtuals?
+                            // if it does not return KNoNonVirtuals, then it 
+                            // has at least one, non-virt. CM
+                            if ( res & KNoNonVirtuals )
+                                {
+                                // if we already have a non-virt, then it is no
+                                // problem, no need to change hasNonVirtualCm
+                                // as it starts from EFalse.
+                                }
+                            else
+                                {
+                                // if it is not empty, than 
+                                // it has at least one, non-virt. CM, so:
+                                if ( !( res & KEmptyDest ) )
+                                    {
+                                    hasNonVirtualCm = ETrue;
+                                    }
+                                }                                
+                            // if it is an empty dest., then:
+                            // if we still have the base as empty, then 
+                            // there is nothing to do.
+                            // if the base is non-empty, again, nothing to do 
+                            if ( !(res & KEmptyDest ) )
+                                { 
+                                // not empty dest, so set base 
+                                // value to reflect it
+                                hasNonVirtualCm = ETrue;
+                                }
+                            }
+                        }
+                    else
+                        {
+                        // virtual, but not emb. dest
+                        // check if it is VPN
+                        // if it is VPN, 
+                        if ( bearerType == KPluginVPNBearerTypeUid )
+                            {
+                            retval |= KContainsVpn;
+                            }
+                        }
+                    }
+                CleanupStack::Pop( cm );
+                cm = NULL; // not owned                    
+                if ( retval & KBindDenied )
+                    { // binding is already denied, we can break...
+                    break;
+                    }
+                }
+            if ( !hasNonVirtualCm )
+                {
+                retval |= KNoNonVirtuals;
+                }
+            }
+        else
+            {
+            retval |= KEmptyDest;
+            }
+        }
+    CleanupStack::PopAndDestroy( dest );
+    
+    return retval;
+    }
+
+
+
+// --------------------------------------------------------------------------
+// CCmPluginVpn::BindableDestinationsL
+// --------------------------------------------------------------------------
+//  
+void CCmPluginVpn::BindableDestinationsL( RArray<TUint32>& aDestinationArray )
+    {
+    LOGGER_ENTERFN( "CCmPluginVpn::BindableDestinationsL" );
+    TUint32 upLimit = KCmDefaultDestinationAPTagId + 0xff;
+    
+    aDestinationArray.Close();
+    if ( BindableRealConnectionsExistL() )
+        {
+        for (TInt i=0; i<iBindableMethods.Count(); i++)
+            {
+            if ( iBindableMethods[i] <= KDestMaxId ||
+                    (iBindableMethods[i] > KCmDefaultDestinationAPTagId && iBindableMethods[i] <= upLimit) )
+                {
+                aDestinationArray.AppendL( iBindableMethods[i] );
+                }
+            }
+        }
+    }
+
+
+// --------------------------------------------------------------------------
+// CCmPluginVpn::HasUpstreamVpnL
+// --------------------------------------------------------------------------
+//
+TBool CCmPluginVpn::HasUpstreamVpnL( TUint32 aId, TBool aIsDestination )
+    {
+    LOGGER_ENTERFN( "CCmPluginVpn::HasUpstreamVpnL" );
+        
+    // the function returns true if:
+    //  - the destination given is referenced by a CM which is either VPN or 
+    //    has an upstream VPN
+    //  - the CM given is linked by a VPN or the CM or its destination have 
+    //    an upstream VPN
+    TBool hasUpstreamVpn( EFalse );
+
+    // array of destinations
+    RArray<TUint32> destArray( CmMgr().DestinationCountL() );
+    CleanupClosePushL( destArray );
+    
+    // get all destinations
+    CmMgr().AllDestinationsL( destArray );
+    
+    CLOG_WRITE( "CCmPluginVpn::HasUpstreamVpnL checking destinations..." );
+    
+    for ( TInt i = 0; !hasUpstreamVpn && i < destArray.Count(); ++i )
+        {
+        if ( aIsDestination && destArray[i] == aId )
+            {
+            // connection methods cannot link to their parent destination
+            // so we can skip this round
+            continue;
+            }
+
+        CCmDestinationImpl* dest = CmMgr().DestinationL( destArray[i] );
+        CleanupStack::PushL( dest );
+
+        // check out all CM's from destinations
+        TInt cmCount = dest->ConnectionMethodCount();
+        
+        for ( TInt j = 0; j < cmCount; ++j )
+            {
+            // instantiate a connmethod
+            CCmPluginBase* cm = dest->GetConnectionMethodL( j );
+            CleanupStack::PushL( cm );
+
+            TUint32 cmId = cm->GetIntAttributeL( ECmId );
+
+            // ask for the bearer type
+            TUint32 bearerType = CmMgr().GetConnectionMethodInfoIntL( 
+                                                        cmId, ECmBearerType );
+            
+            // is it virtual? if not, there's nothing to do
+            if ( CmMgr().GetBearerInfoBoolL( bearerType, ECmVirtual ) )
+                {
+                // it is virtual
+
+                if ( CmMgr().GetBearerInfoBoolL( bearerType, ECmDestination ) )
+                    {
+                    // what's more, it is an embedded destination
+                    if ( aIsDestination && cm->IsLinkedToSnap( aId ) )
+                        {
+                        hasUpstreamVpn = 
+                            HasUpstreamVpnL( cmId, EFalse ) ||
+                            HasUpstreamVpnL( dest->Id(), ETrue );
+                        }
+                    }
+                else
+                    {
+                    // it is not an emb.dest.
+                    if ( aIsDestination )
+                        {
+                        // does it link to this destination?
+                        if ( cm->IsLinkedToSnap( aId ) )
+                            {
+                            hasUpstreamVpn = 
+                                ( bearerType == KPluginVPNBearerTypeUid ) ||
+                                HasUpstreamVpnL( cmId, EFalse ) ||
+                                HasUpstreamVpnL( dest->Id(), ETrue );
+                            }
+                        }
+                    else
+                        {
+                        CCmPluginBase* targetCm = 
+                                            CmMgr().GetConnectionMethodL( aId );
+                        CleanupStack::PushL( targetCm );
+                        
+                        // does it link to this CM or to its destination?
+                        if ( cm->IsLinkedToIap( aId ) )
+                            {
+                            hasUpstreamVpn = 
+                                ( bearerType == KPluginVPNBearerTypeUid ) ||
+                                HasUpstreamVpnL( cmId, EFalse );
+                            }
+/************** after cmmanager fix **************
+    CCmDestinationImpl* parentDest = targetCm->ParentDestination();
+                        else if ( parentDest &&
+                                  cm->IsLinkedToSnap( 
+                                        parentDest->Id() ) )
+                            {
+                            hasUpstreamVpn = 
+                                ( bearerType == KPluginVPNBearerTypeUid ) ||
+                                HasUpstreamVpnL( cmId, EFalse ) ||
+                                HasUpstreamVpnL( dest->Id(), ETrue );
+                            }
+     delete parentDest;
+***************************************************/
+                        else
+                            {
+                            TUint32 parent( 0 );
+                            parent = FindParentDestinationL( aId );
+                            
+                            if ( parent && cm->IsLinkedToSnap( parent ) )
+                                {
+                                hasUpstreamVpn = 
+                                    ( bearerType == KPluginVPNBearerTypeUid ) ||
+                                    HasUpstreamVpnL( cmId, EFalse ) ||
+                                    HasUpstreamVpnL( dest->Id(), ETrue );
+                                }
+                            
+                            }
+
+                        CleanupStack::PopAndDestroy( targetCm );
+                        }
+                    
+                    } // if !emb.dest.
+
+                } // if virtual
+
+            CleanupStack::Pop( cm );
+            } // for j
+
+        CleanupStack::PopAndDestroy( dest );
+        } // for i
+    
+    CleanupStack::PopAndDestroy( &destArray );
+    
+    
+    // if we already know the answer, jump out here
+    if (hasUpstreamVpn) 
+        {
+        return hasUpstreamVpn;
+        } 
+        
+
+    CLOG_WRITE( "CCmPluginVpn::HasUpstreamVpnL checking uncategorized group..." );    
+    
+    // we have to check the uncategorized, too
+    
+    RArray<TUint32> cmArray ( KCmArrayMediumGranularity );
+    CleanupClosePushL( cmArray );
+    
+    CmMgr().ConnectionMethodL( cmArray );
+
+    // search for virtual CM's
+    for ( TInt k = 0; !hasUpstreamVpn && k < cmArray.Count(); ++k )
+        {
+        TInt bearerType = CmMgr().GetConnectionMethodInfoIntL( cmArray[k], 
+                                                               ECmBearerType );
+                                                
+        if ( CmMgr().GetBearerInfoBoolL( bearerType, ECmVirtual ) )
+            {
+            // if virtual, does it link to this destination?
+
+            CCmPluginBase* cm = CmMgr().GetConnectionMethodL( cmArray[k] );
+            CleanupStack::PushL( cm );
+            
+            TUint32 cmId = cm->GetIntAttributeL( ECmId );
+
+            if ( aIsDestination )
+                {
+                // does it link to this destination?
+                if ( cm->IsLinkedToSnap( aId ) )
+                    {
+                    hasUpstreamVpn = 
+                        ( bearerType == KPluginVPNBearerTypeUid ) ||
+                        HasUpstreamVpnL( cmId, EFalse );
+                    }
+                }
+            else
+                {
+                // does it link to this CM?           
+                if ( cm->IsLinkedToIap( aId ) )
+                    {
+                    hasUpstreamVpn = 
+                        ( bearerType == KPluginVPNBearerTypeUid ) ||
+                        HasUpstreamVpnL( cmId, EFalse );
+                    }
+                     
+                }
+
+            CleanupStack::PopAndDestroy( cm );
+            } // if virtual
+            
+        } // for k
+    
+
+    CleanupStack::PopAndDestroy( &cmArray );
+
+    return hasUpstreamVpn;
+    }
+    
+
+
+// --------------------------------------------------------------------------
+// CCmPluginVpn::FilterPossibleParentsL
+// --------------------------------------------------------------------------
+//
+void CCmPluginVpn::FilterPossibleParentsL( RArray<TUint32>& aDests )
+    {
+    LOGGER_ENTERFN( "CCmPluginVpn::FilterPossibleParentsL" );
+
+    // check if there is any destination into which this VPN could be put
+    
+    // Filter out invalid destinations
+    for ( TInt i = 0; i < aDests.Count(); ++i )
+        {
+        if ( HasUpstreamVpnL( aDests[i], ETrue ) )
+            {
+            aDests.Remove( i );
+            --i;
+            }
+        }
+
+    // also filter out the underlying connection's destination
+    if ( aDests.Count() )
+        {
+        // still have work to do
+        TUint32 destId = 0;
+        
+        if ( iVirtualRecord->iNextLayerSNAP )
+            {
+            // the VPN links to a destination
+            destId = iVirtualRecord->iNextLayerSNAP;
+            }
+        else if ( iVirtualRecord->iNextLayerIAP )
+            {
+            // the VPN links to a connmethod, find out parent destination id
+
+/********** after CmManager fix ***********************
+            CCmPluginBase* cm = CmMgr().GetConnectionMethodL( 
+                                               iVirtualRecord->iNextLayerIAP );
+            
+            CCmDestinationImpl* parentDest = cm->ParentDestination();
+            if ( parentDest )
+                {
+                // take the id only if cm has a parent
+                destId = parentDest->Id();
+                }
+            
+            delete cm;
+            delete parentDest;
+*******************************************************/
+            destId = FindParentDestinationL( iVirtualRecord->iNextLayerIAP );
+            }
+
+            
+        // now search for the id
+        if ( destId )
+            {
+            TInt index = aDests.Find( destId );
+            if ( index != KErrNotFound )
+                {
+                // got it, remove
+                aDests.Remove( index );
+                }
+            }
+        
+        } // if aDests.Count
+        
+        
+    }
+
+
+TUint32 CCmPluginVpn::FindParentDestinationL( TUint32 aCmId )
+    {
+    LOGGER_ENTERFN( "CCmPluginVpn::FindParentDestinationL" );
+
+    TBool found = EFalse;
+    TUint32 targetDestId( 0 ); 
+    
+    RArray<TUint32> destinations( CmMgr().DestinationCountL() );
+   
+    CmMgr().AllDestinationsL( destinations );
+    CleanupClosePushL( destinations );
+    
+    for ( TInt i = 0; i < destinations.Count() && !found; i++ )
+        {            
+        CCmDestinationImpl* dest = 
+                          CmMgr().DestinationL( destinations[i] );
+        CleanupStack::PushL( dest );
+
+        TInt cmCount = dest->ConnectionMethodCount();
+
+        for ( TInt j = 0; j < cmCount && !found; j++ )
+            {
+            // instantiate a connmethod
+            CCmPluginBase* cm = dest->GetConnectionMethodL( j );
+            CleanupStack::PushL( cm );
+            TUint32 cmId = cm->GetIntAttributeL( ECmId );
+
+            if ( cmId == aCmId)
+                {
+                targetDestId = destinations[i];
+                found = ETrue;
+                }
+                
+            CleanupStack::Pop( cm );
+            }
+
+        CleanupStack::PopAndDestroy( dest );
+        }
+
+    CleanupStack::PopAndDestroy( &destinations );
+    
+    return targetDestId;    
+    }
+
+// --------------------------------------------------------------------------
+// CCmPluginVpn::DeleteAdditionalRecordsL
+// --------------------------------------------------------------------------
+//
+void CCmPluginVpn::DeleteAdditionalRecordsL()
+    {
+    LOGGER_ENTERFN( "CCmPluginVpn::DeleteAdditionalRecordsL" );    
+
+    // Virtual record must be deleted
+    iVirtualRecord->DeleteL( Session() );
+    }
+
+// --------------------------------------------------------------------------
+// CCmPluginVpn::GenerateVPNPointToEasyWLANLC
+// --------------------------------------------------------------------------
+//
+HBufC* CCmPluginVpn::GenerateVPNPointToWLANNetworkLC(RResourceFile& rf, HBufC*& aName)
+    {
+    LOGGER_ENTERFN( "CCmPluginVpn::GenerateVPNPointToWLANNetworkLC" );
+    aName = NULL;
+
+    HBufC8* readBuffer2 = rf.AllocReadLC( R_QTN_NETW_CONSET_VPN_EASY_WLAN );
+    const TPtrC16 ptrReadBuffer2( (TText16*) readBuffer2->Ptr(),
+                                 ( readBuffer2->Length() + 1 ) >> 1 );
+    aName = HBufC16::NewL( ptrReadBuffer2.Length() );
+    *aName = ptrReadBuffer2;
+    
+    CleanupStack::PopAndDestroy( readBuffer2 );
+    CleanupStack::PushL( aName );
+    
+    return aName;
+    }
+    
+// --------------------------------------------------------------------------
+// CCmPluginVpn::CheckValidityAndConvertDestinationIdL
+// --------------------------------------------------------------------------
+//
+TInt CCmPluginVpn::CheckValidityAndConvertDestinationIdL( TUint32 aDestId )
+    {
+    TInt id( 0 );
+
+    if ( aDestId > 0 && aDestId < 255 )
+         {
+         id = aDestId + KCmDefaultDestinationAPTagId;
+         }
+     else if ( aDestId > KCmDefaultDestinationAPTagId 
+               && ( aDestId < ( KCmDefaultDestinationAPTagId+255 ) ) )
+         {
+         id = aDestId;
+         }
+     else
+         {
+         User::Leave( KErrArgument );
+         }
+    
+    return id;
+    }
+
+// eof
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginvpn/src/cmpvpnnextlayerselectdlg.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,829 @@
+/*
+* 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:  Popup for selecting the underlying connection method or 
+*                destination for a VPN connection method
+*
+*/
+
+
+// includes
+#include <badesca.h> // arrays
+#include <gulicon.h> // icons
+#include <StringLoader.h>
+#include <data_caging_path_literals.hrh>
+#include <featmgr.h>
+#include <cmpluginvpn.mbg>
+#include <cmpluginvpnui.rsg>
+#include <cmmanager.rsg>
+#include <cmmanager.mbg> 
+#include <eikenv.h>
+#include <aknlists.h>
+#include <eikfrlb.h> // CEikFormattedCellListBox
+#include <aknradiobuttonsettingpage.h>
+#include <cmpluginbaseeng.h>
+#include <cmpluginbase.h>
+
+#include <hlplch.h>
+#include <csxhelp/cp.hlp.hrh>
+
+#include "cmlogger.h"
+#include "cmdestinationimpl.h"
+#include "cmmanagerimpl.h"
+#include "cmpvpnnextlayerselectdlg.h"
+#include "cmvpncommonconstants.h"
+#include <cmcommonconstants.h>
+#include <cmpluginvpndef.h>
+
+using namespace CMManager;
+// --------------------------------------------------------------------------
+// CmPluginVpnNextLayerSelectDlg::NewL
+// --------------------------------------------------------------------------
+//
+CmPluginVpnNextLayerSelectDlg* CmPluginVpnNextLayerSelectDlg::NewL( 
+                                        CCmPluginBaseEng& aCmPluginBaseEng,
+                                        RArray<TUint32>& aBindableMethods,
+                                        TBool& aSnapSelected,
+                                        TUint32& aNextLayerId )
+    {
+    CmPluginVpnNextLayerSelectDlg* self = 
+            new ( ELeave ) CmPluginVpnNextLayerSelectDlg( aCmPluginBaseEng,
+                                                          aBindableMethods,
+                                                          aSnapSelected,
+                                                          aNextLayerId );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+      
+// --------------------------------------------------------------------------
+// CmPluginVpnNextLayerSelectDlg::CmPluginVpnNextLayerSelectDlg
+// --------------------------------------------------------------------------
+//
+CmPluginVpnNextLayerSelectDlg::CmPluginVpnNextLayerSelectDlg(
+                                        CCmPluginBaseEng& aCmPluginBaseEng,
+                                        RArray<TUint32>& aBindableMethods,
+                                        TBool& aSnapSelected,
+                                        TUint32& aNextLayerId )
+    : iMyEikonEnv( *CEikonEnv::Static() )
+    , iCmPluginBaseEng( aCmPluginBaseEng )
+    , iSnapSelected( aSnapSelected )
+    , iNextLayerId( aNextLayerId )
+    , iResourceReader( *CCoeEnv::Static() )
+    , iDestinations( aBindableMethods )
+    , iEasyWlanId(0)  
+    , iCmManager( iCmPluginBaseEng.CmMgr() ) 
+    , iUncatItems( EFalse )
+    {
+    ;
+    }
+    
+    
+// --------------------------------------------------------------------------
+// CmPluginVpnNextLayerSelectDlg::~CmPluginVpnPolicySelectionDlg
+// --------------------------------------------------------------------------
+//
+CmPluginVpnNextLayerSelectDlg::~CmPluginVpnNextLayerSelectDlg()
+    {
+    iResourceReader.Close();
+    
+    if ( iMenuBar )
+        {
+        HideMenu();
+        CEikonEnv::Static()->EikAppUi()->RemoveFromStack( iMenuBar );
+        delete iMenuBar;
+        iMenuBar = NULL;
+        }
+        
+    delete iMyListBox; iMyListBox = NULL;
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginVpnNextLayerSelectDlg::ConstructL
+// --------------------------------------------------------------------------
+//
+void CmPluginVpnNextLayerSelectDlg::ConstructL()
+    {
+    LoadResourceL( KPluginVPNResDirAndFileName );
+    InitialiseL();
+    SetTextsAndIconsL();
+    }
+    
+// --------------------------------------------------------------------------
+// CmPluginVpnNextLayerSelectDlg::InitialiseL
+// --------------------------------------------------------------------------
+// 
+void CmPluginVpnNextLayerSelectDlg::InitialiseL()
+    {
+    LOGGER_ENTERFN( "CmPluginVpnNextLayerSelectDlg::InitialiseL" );
+    
+    // get the EasyWlan id if it's supported
+    if ( FeatureManager::FeatureSupported( KFeatureIdProtocolWlan ) )
+        {
+        iEasyWlanId = iCmManager.EasyWlanIdL();
+        }
+    
+    // Listbox
+    iMyListBox = new ( ELeave ) CAknDoubleLargeGraphicPopupMenuStyleListBox;
+    
+    CAknPopupList::ConstructL( 
+                            iMyListBox, 
+                            R_SOFTKEYS_OPTIONS_CANCEL__SELECT, 
+                            AknPopupLayouts::EMenuDoubleLargeGraphicWindow );
+                               
+    TInt flags = 0;
+    iMyListBox->ConstructL( this, flags );
+    iMyListBox->CreateScrollBarFrameL( ETrue );
+    iMyListBox->ScrollBarFrame()->SetScrollBarVisibilityL( 
+                    CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
+        
+    // Menu
+    CEikMenuBar* newMenuBar = new ( ELeave ) CEikMenuBar();
+    CleanupStack::PushL( newMenuBar );
+    newMenuBar->ConstructL( this, NULL, R_VPN_REAL_CM_SELECTION_MENUBAR );
+    iMyEikonEnv.EikAppUi()->AddToStackL( newMenuBar, 
+                                         ECoeStackPriorityMenu, 
+                                         ECoeStackFlagRefusesFocus );
+    iMenuBar = newMenuBar;
+    CleanupStack::Pop( newMenuBar ); // ownership taken by 'this'
+    }
+    
+// --------------------------------------------------------------------------
+// CmPluginVpnNextLayerSelectDlg::SetTextsAndIconsL
+// --------------------------------------------------------------------------
+//
+void CmPluginVpnNextLayerSelectDlg::SetTextsAndIconsL()
+    {
+    LOGGER_ENTERFN( "CmPluginVpnNextLayerSelectDlg::SetTextsAndIconsL" );
+    // Title
+    SetTitleL( *StringLoader::LoadLC( 
+                            R_QTN_NETW_CONSET_PRMPT_VPN_REAL_CONNECTION ) );
+    CleanupStack::PopAndDestroy(); // header
+    
+    // Item text array
+    CDesCArray* itemArray =
+                new ( ELeave ) CDesCArrayFlat( KCmArrayMediumGranularity );
+    CleanupStack::PushL( itemArray );
+    iMyListBox->Model()->SetItemTextArray( itemArray ); // ownership taken
+    iMyListBox->Model()->SetOwnershipType( ELbmOwnsItemArray );
+    CleanupStack::Pop( itemArray ); // as ownership is taken
+                    
+    // Icon array
+    CArrayPtr<CGulIcon>* icons =
+         new ( ELeave ) CArrayPtrFlat<CGulIcon>( KCmArrayMediumGranularity );
+    CleanupStack::PushL( icons );
+    iMyListBox->ItemDrawer()->FormattedCellData()->SetIconArrayL( icons );
+    // ownership taken by SetIconArrayL!
+    CleanupStack::Pop( icons ); // as ownership is taken
+    
+    // Step through the Destinations - do not show:
+    // Parent Destinations or Destinations with no non-virtual CMs
+    // Show Uncategorised if valid and EasyWlan if supported
+    TInt destCount = iDestinations.Count();
+    for ( TInt i = 0; i < destCount; i++ )
+        {        
+        switch ( iDestinations[i] )
+            {
+            case KDestItemUncategorized:
+                {
+                // Append 'Uncategorised' if necessary
+                AppendUncatDestinationL( *itemArray, *icons );
+                break;
+                }
+            case KDestItemEasyWlan:
+                {
+                // Append 'EasyWlan' if supported
+                TRAPD( err, AppendEasyWlanL( *itemArray, *icons ) );
+                if ( err != KErrNotSupported )
+                    {
+                    User::LeaveIfError( err );
+                    }
+                break;
+                }
+            // normal destination
+            default:
+                {
+                CCmDestinationImpl* dest = 
+                iCmManager.DestinationL( iDestinations[i] );
+                CleanupStack::PushL( dest );
+                TInt numCms = dest->ConnectionMethodCount();        
+                AppendDestinationTextsL( *dest,numCms, *itemArray, *icons );                
+                CleanupStack::PopAndDestroy( dest );
+                break;
+                }                    
+            }
+        }
+    }
+
+
+// --------------------------------------------------------------------------
+// CmPluginVpnNextLayerSelectDlg::AppendDestinationsTextsL
+// --------------------------------------------------------------------------
+//
+void CmPluginVpnNextLayerSelectDlg::AppendDestinationTextsL(
+                                            CCmDestinationImpl& aDestination,
+                                            TInt aNumCms,
+                                            CDesCArray& aItems,
+                                            CArrayPtr<CGulIcon>& aIcons )
+    {
+    LOGGER_ENTERFN( "CmPluginVpnNextLayerSelectDlg::AppendDestinationL" );
+    // icon
+    CGulIcon* icon = ( CGulIcon* ) aDestination.IconL();
+    CleanupStack::PushL( icon );
+    aIcons.AppendL( icon );
+    TInt iconIndex = aIcons.Count() - 1;
+    CleanupStack::Pop( icon ); // icon array took over ownership
+    
+    // compile the list item
+    HBufC* firstLine = aDestination.NameLC();
+    HBufC* secondLine;
+    
+    if ( aNumCms == 1 )
+        {
+        secondLine = StringLoader::LoadLC(
+                        R_CMMANAGERUI_CONN_METHODS_AMOUNT_ONE );
+        }
+    else
+        {
+        secondLine = StringLoader::LoadLC( 
+                        R_CMMANAGERUI_CONN_METHODS_AMOUNT_MANY,
+                        aNumCms );
+        }
+        
+    HBufC* item = FormatListItemTextsLC( *firstLine, 
+                                         *secondLine,
+                                         iconIndex );
+    aItems.AppendL( *item );
+
+    CleanupStack::PopAndDestroy( item );
+    CleanupStack::PopAndDestroy( secondLine );
+    CleanupStack::PopAndDestroy( firstLine );
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginVpnNextLayerSelectDlg::AppendUncatDestinationL
+// --------------------------------------------------------------------------
+//
+void CmPluginVpnNextLayerSelectDlg::AppendUncatDestinationL( 
+                                                CDesCArray& aItems,
+                                                CArrayPtr<CGulIcon>& aIcons )
+    {
+    LOGGER_ENTERFN( "CmPluginVpnNextLayerSelectDlg::AppendUncatDestinationL" );
+
+    TParse mbmFile;
+    User::LeaveIfError( mbmFile.Set( KManagerIconFilename, 
+                        &KDC_APP_BITMAP_DIR, 
+                        NULL ) );
+    
+    // icon
+    CGulIcon* icon = AknsUtils::CreateGulIconL(
+                AknsUtils::SkinInstance(), 
+                KAknsIIDQgnPropSetConnDestUncategorized,
+                mbmFile.FullName(), 
+                EMbmCmmanagerQgn_prop_set_conn_dest_uncategorized, 
+                EMbmCmmanagerQgn_prop_set_conn_dest_uncategorized_mask );
+    CleanupStack::PushL( icon );
+    aIcons.AppendL( icon );
+    CleanupStack::Pop( icon );  // icon array took over ownership
+    TInt iconIndex = aIcons.Count() - 1;
+    
+    // remove virtual CMs
+    RArray<TUint32> uncatCms ( KCmArraySmallGranularity );    
+    iCmManager.ConnectionMethodL( uncatCms );
+    CleanupClosePushL( uncatCms );
+    
+    for ( TInt i = 0; i < uncatCms.Count(); i++ )
+        {
+        TInt bearerType = iCmManager.GetConnectionMethodInfoIntL( 
+                                        uncatCms[i], ECmBearerType );
+        
+        if ( iCmManager.GetBearerInfoBoolL( bearerType, ECmVirtual ) )
+            {
+            uncatCms.Remove(i);
+            i--;
+            }        
+        }
+    
+    // second line text
+    HBufC* secondLine;            
+    if ( uncatCms.Count() == 1 )
+        {
+        secondLine = StringLoader::LoadLC(
+                            R_CMMANAGERUI_CONN_METHODS_AMOUNT_ONE );
+        }
+    else
+        {
+        secondLine = StringLoader::LoadLC( 
+                            R_CMMANAGERUI_CONN_METHODS_AMOUNT_MANY,
+                            uncatCms.Count() );
+        }    
+
+    // compile the texts
+    HBufC* item = FormatListItemTextsLC( R_CMMANAGERUI_DEST_UNCATEGORIZED,
+                                         *secondLine,
+                                         iconIndex );            
+    aItems.AppendL( *item );
+
+    CleanupStack::PopAndDestroy( item );
+    CleanupStack::PopAndDestroy( secondLine );
+    CleanupStack::PopAndDestroy( &uncatCms );
+    }
+                                                 
+// --------------------------------------------------------------------------
+// CmPluginVpnNextLayerSelectDlg::AppendEasyWlanL
+// --------------------------------------------------------------------------
+//
+void CmPluginVpnNextLayerSelectDlg::AppendEasyWlanL( 
+                                                CDesCArray& aItems,
+                                                CArrayPtr<CGulIcon>& aIcons )
+    {
+    LOGGER_ENTERFN( "CmPluginVpnNextLayerSelectDlg::AppendEasyWlanL" );
+
+    // icon
+    CCmPluginBase* cm = iCmManager.GetConnectionMethodL( iEasyWlanId );
+    CleanupStack::PushL( cm );
+    CGulIcon* icon = ( CGulIcon* ) cm->GetIntAttributeL( ECmBearerIcon );
+    CleanupStack::PushL( icon );
+    aIcons.AppendL( icon );  // ownership passed to array
+    TInt iconIndex = aIcons.Count() - 1;
+    CleanupStack::Pop( icon );
+    CleanupStack::PopAndDestroy( cm );
+    
+    // compile the texts
+    HBufC* easyWlan = FormatListItemTextsLC( 
+                                R_QTN_NETW_CONSET_VPN_EASY_WLAN,
+                                R_QTN_NETW_CONSET_VPN_EASY_WLAN_PROMPT,
+                                iconIndex );
+    aItems.AppendL( *easyWlan );
+    
+    CleanupStack::PopAndDestroy( easyWlan );
+    }
+    
+// --------------------------------------------------------------------------
+// CmPluginVpnNextLayerSelectDlg::DynInitMenuPaneL
+// --------------------------------------------------------------------------
+//
+void CmPluginVpnNextLayerSelectDlg::DynInitMenuPaneL( 
+                                TInt aResourceId, CEikMenuPane* aMenuPane )
+    {
+    if ( aResourceId == R_VPN_REAL_CM_SELECTION_MENU )
+        {
+    	if (!iCmManager.IsHelpOn())
+            {
+            aMenuPane->DeleteMenuItem( EAknCmdHelp );		    
+            }
+        TUint32 highlighted = iDestinations[ iListBox->CurrentItemIndex() ];
+        
+        switch ( highlighted )
+            {
+            case KDestItemUncategorized:
+                {
+                aMenuPane->SetItemDimmed( ECmManagerUiCmdDestSelect, ETrue );
+                break;                
+                }
+            case KDestItemEasyWlan:
+                {
+                aMenuPane->SetItemDimmed( ECmManagerUiCmdCMSelect, ETrue );
+                break;
+                }
+            default:
+                {
+                break;
+                }
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginVpnNextLayerSelectDlg::ProcessCommandL
+// --------------------------------------------------------------------------
+//
+void CmPluginVpnNextLayerSelectDlg::ProcessCommandL( TInt aCommandId )
+    {
+    if ( MenuShowing() )
+        {
+        HideMenu();
+        }
+    switch ( aCommandId )
+        {
+        case EAknSoftkeyOptions:
+            {
+            DisplayMenuL();
+            break;
+            }
+        case ECmManagerUiCmdDestSelect:
+            {
+            TUint32 destId = iDestinations[ iListBox->CurrentItemIndex() ];
+            
+            if ( destId != KDestItemUncategorized )
+                {
+                TUint32 attribute = ECmNextLayerSNAPId;
+                
+                // EasyWlan was selected
+                if ( destId == KDestItemEasyWlan )
+                    {
+                    attribute = ECmNextLayerIapId;
+                    destId = iEasyWlanId;
+                    }
+                iCmPluginBaseEng.SetIntAttributeL( attribute, destId );
+                AttemptExitL( ETrue );
+                break;
+                }
+            // For uncategorised destinations, flow through to ECmManagerUiCmdCMSelect
+            }
+        case ECmManagerUiCmdCMSelect:
+            {
+            // select a connection method from the highlighted destination
+            TUint32 destId = iDestinations[ iListBox->CurrentItemIndex() ];
+            TUint32 cmId (0);
+            if ( ShowCMSelectionDlgL( destId, cmId ) )
+                {
+                iCmPluginBaseEng.SetIntAttributeL( ECmNextLayerIapId, cmId );
+                AttemptExitL( ETrue );
+                }
+            else
+                {
+                CancelPopup();
+                }
+            break;
+            }
+        case EAknCmdHelp:
+            {
+            HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(),
+                                    iEikonEnv->EikAppUi()->AppHelpContextL() );
+            }
+            break;
+        case EAknSoftkeyBack:
+            {
+            CancelPopup();
+            break;
+            } 
+        default:
+            {
+            CAknPopupList::ProcessCommandL( aCommandId );
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CmPluginVpnNextLayerSelectDlg::OfferKeyEventL
+// ---------------------------------------------------------------------------
+//
+TKeyResponse CmPluginVpnNextLayerSelectDlg::OfferKeyEventL( 
+                                                const TKeyEvent& aKeyEvent, 
+                                                TEventCode aType )    
+    {
+    TKeyResponse retVal ( EKeyWasNotConsumed );
+    TUint highlighted = iDestinations[ iListBox->CurrentItemIndex() ];
+    
+    switch ( aKeyEvent.iScanCode )
+        {
+        case EStdKeyDownArrow:
+        case EStdKeyUpArrow:
+            {
+            // If focus is on the 'uncategorised' destination, 
+            // change the soft key to 'Open'
+            if ( highlighted == KDestItemUncategorized )
+                {
+                ButtonGroupContainer()->SetCommandL( 
+                                ECmManagerUiCmdDestSelect, 
+                                *( StringLoader::LoadLC( R_QTN_MSK_OPEN ) ) 
+                                                    );
+                ButtonGroupContainer()->DrawDeferred();
+                CleanupStack::PopAndDestroy();
+                }
+            else
+                {
+                ButtonGroupContainer()->SetCommandL( 
+                               ECmManagerUiCmdDestSelect, 
+                               *( StringLoader::LoadLC( R_QTN_MSK_SELECT ) ) 
+                                                    );
+                ButtonGroupContainer()->DrawDeferred();
+                CleanupStack::PopAndDestroy();
+                }
+            break;
+            }
+        case EStdKeyNo:
+            {
+            CancelPopup();
+            return EKeyWasConsumed;
+            }
+        default:
+            {
+            // If focus is on the 'uncategorised' destination, 
+            // change the soft key to 'Open'
+            if ( highlighted == KDestItemUncategorized )
+                {
+                ButtonGroupContainer()->SetCommandL( 
+                                ECmManagerUiCmdDestSelect, 
+                                *( StringLoader::LoadLC( R_QTN_MSK_OPEN ) ) 
+                                                    );
+                ButtonGroupContainer()->DrawDeferred();
+                CleanupStack::PopAndDestroy();
+                }
+                
+            if ( aKeyEvent.iCode == EKeyEscape )
+                {
+                CancelPopup();
+                return EKeyWasConsumed;
+                }
+            }
+        }
+    retVal = iListBox->OfferKeyEventL( aKeyEvent, aType );
+    
+    return retVal;
+    }
+    
+// ---------------------------------------------------------------------------
+// CDestDlg::HandleListBoxEventL
+// ---------------------------------------------------------------------------
+void CmPluginVpnNextLayerSelectDlg::HandleListBoxEventL( CEikListBox* /*aListBox*/,
+                                    TListBoxEvent aEventType )
+    {
+    switch ( aEventType )
+        {
+        case EEventEnterKeyPressed:
+        case EEventItemDoubleClicked:
+            {
+            ProcessCommandL(ECmManagerUiCmdDestSelect);
+            break;
+            }
+        default:
+            {
+            break;
+            };
+        };
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginVpnNextLayerSelectDlg::SetEmphasis
+// --------------------------------------------------------------------------
+//
+void CmPluginVpnNextLayerSelectDlg::SetEmphasis( CCoeControl* aMenuControl, 
+                                                 TBool aEmphasis )
+    {
+	CEikAppUi* appUi = iMyEikonEnv.EikAppUi();
+	appUi->RemoveFromStack( aMenuControl );
+	
+	TRAP_IGNORE( appUi->AddToStackL ( 
+	                            aMenuControl, 
+                                aEmphasis ? ECoeStackPriorityDialog : 
+                                ECoeStackPriorityMenu ) );
+                                
+	appUi->UpdateStackedControlFlags( 
+	                            aMenuControl, 
+                                aEmphasis ? 0 : ECoeStackFlagRefusesFocus,
+                                ECoeStackFlagRefusesFocus );
+	appUi->HandleStackChanged();
+    }
+    
+// --------------------------------------------------------------------------
+// CmPluginVpnNextLayerSelectDlg::LoadResourceL
+// --------------------------------------------------------------------------
+//
+void CmPluginVpnNextLayerSelectDlg::LoadResourceL( 
+                                                const TDesC& aResFileName )
+    {
+    LOGGER_ENTERFN( "CmPluginVpnNextLayerSelectDlg::LoadResourceL" );
+    TInt err ( KErrNone );
+    
+    // Add resource file.
+    TParse* fp = new ( ELeave ) TParse();
+    err = fp->Set( aResFileName, 
+                        &KDC_RESOURCE_FILES_DIR, 
+                        NULL ); 
+    if ( err )
+        {
+        User::Leave( err );
+        }   
+
+    TFileName resourceFileNameBuf = fp->FullName();
+    delete fp;
+
+    iResourceReader.OpenL( resourceFileNameBuf );
+    }
+
+
+// --------------------------------------------------------------------------
+// CmPluginVpnNextLayerSelectDlg::FormatListItemTextsLC
+// --------------------------------------------------------------------------
+//
+HBufC* CmPluginVpnNextLayerSelectDlg::FormatListItemTextsLC( 
+                                                TInt aFirstLineResId,
+                                                TInt aSecondLineResId,
+                                                TInt aIconIndex )
+    {
+    HBufC* firstLine = StringLoader::LoadLC( aFirstLineResId );
+    HBufC* secondLine = StringLoader::LoadLC( aSecondLineResId );
+    
+    HBufC* retVal = FormatListItemTextsL( *firstLine,
+                                          *secondLine,
+                                          aIconIndex );
+    CleanupStack::PopAndDestroy( secondLine );
+    CleanupStack::PopAndDestroy( firstLine );
+    CleanupStack::PushL( retVal );
+    return retVal;
+    }
+    
+// --------------------------------------------------------------------------
+// CmPluginVpnNextLayerSelectDlg::FormatListItemTextsLC
+// --------------------------------------------------------------------------
+//
+HBufC* CmPluginVpnNextLayerSelectDlg::FormatListItemTextsLC( 
+                                                const TDesC& aFirstLine,
+                                                const TDesC& aSecondLine,
+                                                TInt aIconIndex )
+    {
+    HBufC* retVal = FormatListItemTextsL( aFirstLine,
+                                          aSecondLine,
+                                          aIconIndex );
+    CleanupStack::PushL( retVal );
+    return retVal;
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginVpnNextLayerSelectDlg::FormatListItemTextsLC
+// --------------------------------------------------------------------------
+//
+HBufC* CmPluginVpnNextLayerSelectDlg::FormatListItemTextsLC( 
+                                                TInt aFirstLineResId,
+                                                const TDesC& aSecondLine,
+                                                TInt aIconIndex )
+    {
+    // Load the first string
+    HBufC* firstLine = StringLoader::LoadLC( aFirstLineResId );
+    
+    HBufC* retVal = FormatListItemTextsL( *firstLine,
+                                          aSecondLine,
+                                          aIconIndex );
+    CleanupStack::PopAndDestroy( firstLine );
+    CleanupStack::PushL( retVal );
+    return retVal;
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginVpnNextLayerSelectDlg::FormatListItemTextsL
+// --------------------------------------------------------------------------
+//
+HBufC* CmPluginVpnNextLayerSelectDlg::FormatListItemTextsL( 
+                                                const TDesC& aFirstLine,
+                                                const TDesC& aSecondLine,
+                                                TInt aIconIndex )
+    {
+    HBufC* retVal = HBufC::NewL( aFirstLine.Length() + 
+                           aSecondLine.Length() + 
+                           KNumberOfStaticCharsIn2LineFormattedString );
+    
+    TPtr ptr ( retVal->Des() );
+    ptr.AppendNum( aIconIndex );
+    ptr.Append( TChar( KSettingsListBoxItemPrefix ) );
+    ptr.Append( aFirstLine );
+    ptr.Append( TChar( KSettingsListBoxItemPrefix ) );
+    ptr.Append( aSecondLine );
+    
+    return retVal;
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginVpnNextLayerSelectDlg::ShowCMSelectionDlgL
+// --------------------------------------------------------------------------
+//
+TBool CmPluginVpnNextLayerSelectDlg::ShowCMSelectionDlgL( 
+                                                    TUint32 aDestinationId,
+                                                    TUint32& aCmId )
+    {
+    LOGGER_ENTERFN( "CmPluginVpnNextLayerSelectDlg::ShowCMSelectionDlgL" );
+    TBool retVal ( EFalse );
+        
+    // Collect item texts
+    CDesCArrayFlat* items = 
+            new ( ELeave ) CDesCArrayFlat( KCmArraySmallGranularity );
+    CleanupStack::PushL( items );
+    
+    RPointerArray<CCmPluginBase> cmDataArray ( KCmArrayMediumGranularity );
+    iCmManager.CreateFlatCMListLC( aDestinationId , cmDataArray );
+    CleanupStack::Pop( &cmDataArray );
+    CCmManagerImpl::CleanupResetAndDestroyPushL(cmDataArray);
+    iCmManager.FilterOutVirtualsL( cmDataArray );
+
+
+    // after it, get the names for each element
+    // and finally make up the real items array.
+    
+    // Get the names of the connection methods
+    // virtuals are already filtered out, 
+    TInt count = cmDataArray.Count();
+    for ( TInt i = 0; i < count; i++ )
+        {
+        HBufC* cmName = 
+            iCmManager.GetConnectionMethodInfoStringL( cmDataArray[i]->GetIntAttributeL( ECmId ),
+                                                       ECmName );
+        CleanupStack::PushL( cmName );
+            
+        // append the name to the string
+        items->AppendL( *cmName );
+            
+        CleanupStack::PopAndDestroy( cmName );
+        }
+        
+    // Display the radio button page
+    TInt selected ( 0 );
+    TInt resId( R_VPN_REAL_CM_RADIO_BUTTON_SETTING_PAGE );
+        
+    CAknRadioButtonSettingPage* dlg = 
+                            new ( ELeave ) CAknRadioButtonSettingPage(
+                                    resId,
+                                    selected, 
+                                    items );
+    CleanupStack::PushL( dlg );
+    dlg->SetSettingTextL(
+                *StringLoader::LoadLC( R_CMWIZARD_SELECT_CONN_METHOD ) );
+    CleanupStack::PopAndDestroy();            
+    CleanupStack::Pop( dlg );
+
+    MakeVisible( EFalse );
+
+    TInt result = 0;
+    TRAPD( err, result = dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) );
+
+    MakeVisible( ETrue );
+    User::LeaveIfError( err );
+
+    if ( result )
+
+        {
+        // store result
+        aCmId = cmDataArray[ selected ]->GetIntAttributeL( ECmId );
+        retVal = ETrue;
+        }
+    
+    CleanupStack::PopAndDestroy( &cmDataArray );
+    CleanupStack::PopAndDestroy( items );
+    return retVal;
+    }
+    
+// --------------------------------------------------------------------------
+// CmPluginVpnNextLayerSelectDlg::DisplayMenuL
+// --------------------------------------------------------------------------
+//
+void CmPluginVpnNextLayerSelectDlg::DisplayMenuL()
+    {
+    iMenuBar->TryDisplayMenuBarL();
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginVpnNextLayerSelectDlg::HideMenu
+// --------------------------------------------------------------------------
+//
+void CmPluginVpnNextLayerSelectDlg::HideMenu()
+    {
+    iMenuBar->StopDisplayingMenuBar();
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginVpnNextLayerSelectDlg::MenuShowing
+// --------------------------------------------------------------------------
+//
+TBool CmPluginVpnNextLayerSelectDlg::MenuShowing() const
+    {
+    return iMenuBar->IsDisplayed();
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginVpnNextLayerSelectDlg::GetHelpContext
+// --------------------------------------------------------------------------
+//
+void CmPluginVpnNextLayerSelectDlg::GetHelpContext( 
+                                            TCoeHelpContext& aContext ) const
+    {
+    aContext.iMajor = KHelpUidPlugin;
+    aContext.iContext = KSET_HLP_VPN_DEST_ASSOC_VIEW;
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginVpnNextLayerSelectDlg::MakeVisible
+// --------------------------------------------------------------------------
+//
+void CmPluginVpnNextLayerSelectDlg::MakeVisible( TBool aVisible )
+    {
+    CAknPopupList::MakeVisible( aVisible );
+
+    // Necessary implementation.
+    CAknPopupList::FadeBehindPopup( IsVisible() );
+    }
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginvpn/src/cmpvpnpolicyselectiondlg.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,339 @@
+/*
+* 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:  Displays a radio button selection list of VPN policies
+*
+*/
+
+
+// includes
+#include <aknPopup.h>
+// #include <vpnapidefs.h>
+#include <aknlists.h>
+#include <cmmanager.rsg>
+#include <cmpluginvpnui.rsg>
+#include <cmcommonui.h>
+#include <cmpluginbaseeng.h>
+#include <StringLoader.h>
+#include <data_caging_path_literals.hrh>
+#include <aknradiobuttonsettingpage.h>
+
+#include "cmlogger.h"
+#include "cmpvpnpolicyselectiondlg.h"
+#include "cmvpncommonconstants.h"
+#include <cmpluginvpndef.h>
+#include <cmcommonconstants.h>
+
+using namespace CMManager;
+
+// ----------------------------------------------------------------------------
+// CmPluginVpnPolicySelectionDlg::NewL
+// ----------------------------------------------------------------------------
+//
+CmPluginVpnPolicySelectionDlg* CmPluginVpnPolicySelectionDlg::NewL( 
+                                        CCmPluginBaseEng& aCmPluginBaseEng )
+    {
+    CmPluginVpnPolicySelectionDlg* self = 
+            new ( ELeave ) CmPluginVpnPolicySelectionDlg( aCmPluginBaseEng );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// CmPluginVpnPolicySelectionDlg::~CmPluginVpnPolicySelectionDlg
+// ----------------------------------------------------------------------------
+//
+CmPluginVpnPolicySelectionDlg::~CmPluginVpnPolicySelectionDlg()
+    {
+
+    iVpnServ.Close();
+
+    delete iPolicyInfoList;
+
+    iResourceReader.Close();
+    }
+    
+// ----------------------------------------------------------------------------
+// CmPluginVpnPolicySelectionDlg::CmPluginVpnPolicySelectionDlg
+// ----------------------------------------------------------------------------
+//
+CmPluginVpnPolicySelectionDlg::CmPluginVpnPolicySelectionDlg(
+                        CCmPluginBaseEng& aCmPluginBaseEng )
+    : iCmPluginBaseEng( aCmPluginBaseEng )
+    , iResourceReader( *CCoeEnv::Static() )
+    , iVpnClientUnaccessible ( EFalse )
+    {
+    }
+    
+// ----------------------------------------------------------------------------
+// CmPluginVpnPolicySelectionDlg::ConstructL
+// ----------------------------------------------------------------------------
+//
+void CmPluginVpnPolicySelectionDlg::ConstructL()
+    {
+    LoadResourceL( KPluginVPNResDirAndFileName );
+    
+    // Get the policies
+    iPolicyInfoList = 
+        new (ELeave) CArrayFixFlat<TVpnPolicyInfo>( KCmArrayMediumGranularity );
+    
+    TInt err( iVpnServ.Connect() );
+    
+    // Vpn client is inaccessible
+    if ( err )
+        {
+        VpnClientInaccessibleL();
+        }
+    else
+        {
+        iVpnServ.GetPolicyInfoList( iPolicyInfoList );        
+        iVpnServ.EnumeratePolicies( iNumPolicies );
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CmPluginVpnPolicySelectionDlg::LoadResourceL
+// ----------------------------------------------------------------------------
+//
+void CmPluginVpnPolicySelectionDlg::LoadResourceL( const TDesC& aResFileName )
+    {
+    TInt err( KErrNone );
+    
+    // Add resource file.
+    TParse* fp = new ( ELeave ) TParse();
+    err = fp->Set( aResFileName, 
+                        &KDC_RESOURCE_FILES_DIR, 
+                        NULL ); 
+    if ( err )
+        {
+        User::Leave( err );
+        }   
+
+    TFileName resourceFileNameBuf = fp->FullName();
+    delete fp;
+
+    iResourceReader.OpenL( resourceFileNameBuf );
+    }
+
+// ----------------------------------------------------------------------------
+// CmPluginVpnPolicySelectionDlg::ShowPolicySelectionListL
+// ----------------------------------------------------------------------------
+//
+TBool CmPluginVpnPolicySelectionDlg::ShowPolicySelectionListL()
+    {
+    LOGGER_ENTERFN( "CmPluginVpnPolicySelectionDlg::ShowPolicySelectionListL" );
+    TBool retVal ( EFalse );
+    
+    CEikTextListBox* list = new ( ELeave ) CAknSinglePopupMenuStyleListBox;
+    CleanupStack::PushL( list );
+             
+    // Create popup list
+    CAknPopupList* popupList = CAknPopupList::NewL(
+                                       list, 
+                                       R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT,
+                                       AknPopupLayouts::EMenuWindow);
+    CleanupStack::PushL( popupList );
+
+    // initialise listbox.
+    list->ConstructL(popupList, CEikListBox::ELeftDownInViewRect);
+    list->CreateScrollBarFrameL( ETrue );
+    list->ScrollBarFrame()->SetScrollBarVisibilityL(
+                               CEikScrollBarFrame::EOff,
+                               CEikScrollBarFrame::EAuto);
+
+
+    MDesCArray* itemList = list->Model()->ItemTextArray();
+	CDesCArray* items = ( CDesCArray* ) itemList;	
+	
+    // collect the item texts    
+    if ( iNumPolicies )
+        {
+        for ( TInt i = 0; i < iNumPolicies; i++ )
+            {
+            HBufC* polName = ( iPolicyInfoList->At(i) ).iName.AllocLC();
+            items->AppendL( *polName );
+            CleanupStack::PopAndDestroy( polName );
+            }
+        
+        // title
+        HBufC* title = StringLoader::LoadLC( R_QTN_NETW_CONSET_PRMPT_VPN_POLICY );
+        popupList->SetTitleL( *title );
+        CleanupStack::PopAndDestroy( title );
+        
+        // dislay dialog
+        CleanupStack::Pop( popupList );
+        if ( popupList->ExecuteLD() )
+            {
+            TInt ix = list->CurrentItemIndex();
+            
+            // Set VPN Policy to be used
+            HBufC* polName = ( iPolicyInfoList->At(ix) ).iName.AllocLC();
+            HBufC* polId = ( iPolicyInfoList->At(ix) ).iId.AllocLC();
+            
+            CLOG_WRITE_2( "New policy settings:[%S], [%S]", polName, polId );
+
+            iCmPluginBaseEng.SetStringAttributeL( EVpnServicePolicyName, *polName );
+            iCmPluginBaseEng.SetStringAttributeL( EVpnServicePolicy, *polId );
+            CleanupStack::PopAndDestroy( polId );
+            CleanupStack::PopAndDestroy( polName );
+            
+            retVal = ETrue;
+            }
+        }
+    else
+        {
+        if (!iVpnClientUnaccessible)
+        	{
+        	// display error note
+        	HBufC* text = StringLoader::LoadLC( R_QTN_VPN_INFO_NO_POLICIES_INSTALLED );
+        	TCmCommonUi::ShowNoteL( *text, TCmCommonUi::ECmInfoNote );
+        	CleanupStack::PopAndDestroy( text );
+        	}
+        CleanupStack::PopAndDestroy( popupList );
+        }
+
+
+	CleanupStack::PopAndDestroy( list );
+    return retVal;
+    }
+
+
+// ----------------------------------------------------------------------------
+// CmPluginVpnPolicySelectionDlg::ShowPolicySelectionDlgL
+// ----------------------------------------------------------------------------
+//
+TBool CmPluginVpnPolicySelectionDlg::ShowPolicySelectionDlgL()
+    {
+    LOGGER_ENTERFN( "CmPluginVpnPolicySelectionDlg::ShowPolicySelectionDlgL" );
+    TBool retVal ( EFalse );
+    
+    TInt selection(0);
+    
+    // Compile the list items
+    CDesCArrayFlat* items = 
+            new ( ELeave ) CDesCArrayFlat( KCmArraySmallGranularity );
+    CleanupStack::PushL( items );
+    
+    TInt vpnerr;
+    vpnerr = iVpnServ.EnumeratePolicies( iNumPolicies );
+    
+    if ( vpnerr )
+        {
+        VpnClientInaccessibleL();
+        }
+    else
+        {        
+        if ( iNumPolicies )
+            {
+            vpnerr = iVpnServ.GetPolicyInfoList( iPolicyInfoList );
+            if ( vpnerr == 0 )
+                {
+                for ( TInt i = 0; i < iNumPolicies; i++ )
+                    {
+                    HBufC* policyName = 
+                            ( iPolicyInfoList->At(i) ).iName.AllocLC();
+                    
+                            
+                    // indicate if this policy is the one in the settings
+                    HBufC* val = iCmPluginBaseEng.GetStringAttributeL( 
+                                                        EVpnServicePolicyName );
+                    
+                    if ( !( val->Compare( policyName->Des() ) ) )
+                        {
+                        selection = i;
+                        }
+                    delete val;
+                    
+                    items->AppendL( *policyName );
+                    CleanupStack::PopAndDestroy( policyName );
+                    }
+                // Create the dialog
+                CAknRadioButtonSettingPage* dlg = 
+                                    new ( ELeave ) CAknRadioButtonSettingPage(
+                                            R_RADIO_BUTTON_SETTING_PAGE_OK_CANCEL,
+                                            selection, 
+                                            items );
+                CleanupStack::PushL( dlg );
+                
+                // set title
+                HBufC* title = StringLoader::LoadLC( 
+                                        R_QTN_VPN_SETT_VPN_IAP_POLICY_REFERENCE );
+                dlg->SetSettingTextL( *title );
+                CleanupStack::PopAndDestroy( title );
+
+                // display dialog
+                CleanupStack::Pop();
+                if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )
+                    {
+                    HBufC* polId = 
+                            ( iPolicyInfoList->At( selection ) ).iId.AllocLC();
+                    HBufC* polName = 
+                            ( iPolicyInfoList->At( selection ) ).iName.AllocLC();
+                    iCmPluginBaseEng.SetStringAttributeL( EVpnServicePolicyName,
+                                                          *polName );
+                    
+                    CLOG_WRITE_2( "New policy settings:[%S], [%S]", polName, polId );
+                    
+                    iCmPluginBaseEng.SetStringAttributeL( EVpnServicePolicy, 
+                                                          *polId );
+                    CleanupStack::PopAndDestroy( polName );
+                    CleanupStack::PopAndDestroy( polId );
+                    retVal = ETrue;
+                    }
+                }
+            }
+        else
+            {
+            // note: no VPN policies installed, reset policy to compulsory
+            CLOG_WRITE("No policy installed, reset policies");
+            
+            HBufC* text = StringLoader::LoadLC( 
+                                        R_QTN_VPN_INFO_NO_POLICIES_INSTALLED );
+            TCmCommonUi::ShowNoteL( *text, TCmCommonUi::ECmInfoNote );
+            CleanupStack::PopAndDestroy( text );
+            vpnerr = -1;
+            }
+        }
+
+    if ( vpnerr )
+        {
+        // note: no VPN policies installed or any other vpn error,
+        //  reset policy to compulsory
+        CLOG_WRITE("Reset policies");
+        
+        iCmPluginBaseEng.SetStringAttributeL( EVpnServicePolicyName,
+                                              KNullDesC() );
+        iCmPluginBaseEng.SetStringAttributeL( EVpnServicePolicy, 
+                                              KNullDesC() );
+        
+        }
+
+    CleanupStack::PopAndDestroy( items );
+    return retVal;
+    }
+    
+    
+// ----------------------------------------------------------------------------
+// CmPluginVpnPolicySelectionDlg::VpnClientInaccessibleL
+// ----------------------------------------------------------------------------
+//
+void CmPluginVpnPolicySelectionDlg::VpnClientInaccessibleL()
+    {
+    LOGGER_ENTERFN( "CmPluginVpnPolicySelectionDlg::VpnClientInaccessibleL" );
+    HBufC* text = StringLoader::LoadLC( R_QTN_VPN_INFO_MGMT_UI_NOT_ACCESSIBLE );
+    TCmCommonUi::ShowNoteL( *text, TCmCommonUi::ECmInfoNote );
+    CleanupStack::PopAndDestroy( text );
+    iVpnClientUnaccessible = ETrue;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginvpn/src/cmpvpnsettingsdlg.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,604 @@
+/*
+* 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:  Dialog for editing VPN settings for a VPN
+*                connection method
+*
+*/
+
+// INCLUDE FILES
+#include <cmpluginbaseeng.h>
+#include <cmpluginvpn.mbg>
+#include <cmpluginvpnui.rsg>
+#include <AknDialog.h>
+#include <StringLoader.h>
+#include <cmmanager.rsg>
+#include <akntextsettingpage.h>
+#include <akntitle.h>
+#include <cmcommonui.h>
+#include <csxhelp/cp.hlp.hrh>
+
+#include "cmlogger.h"
+#include "cmmanagerimpl.h"
+#include "cmpluginvpn.h"
+#include "cmpvpnsettingsdlg.h"
+#include "cmvpncommonconstants.h"
+#include <cmpluginvpndef.h>
+#include "cmpvpnpolicyselectiondlg.h"
+#include <cmcommonconstants.h>
+#include <cmpsettingsconsts.h>
+#include "cmconnsettingsuiimpl.h"
+#include "cmdestinationimpl.h"
+#include "cmmanagerimpl.h"
+
+using namespace CMManager;
+
+
+// ================= MEMBER FUNCTIONS =======================================
+
+// --------------------------------------------------------------------------
+// CmPluginVpnSettingsDlg::NewL()
+// Two-phase dconstructor, second phase is ConstructAndRunLD
+// --------------------------------------------------------------------------
+//
+CmPluginVpnSettingsDlg* CmPluginVpnSettingsDlg::NewL( 
+                                            CCmPluginBaseEng& aCmPluginBase )
+	{
+	CmPluginVpnSettingsDlg* self = 
+	                new ( ELeave ) CmPluginVpnSettingsDlg( aCmPluginBase );
+	return self;
+	}
+	
+// --------------------------------------------------------------------------
+// CmPluginVpnSettingsDlg::CmPluginVpnSettingsDlg()
+// --------------------------------------------------------------------------
+//
+CmPluginVpnSettingsDlg::CmPluginVpnSettingsDlg( 
+                                            CCmPluginBaseEng& aCmPluginBase )
+    : CmPluginBaseSettingsDlg( aCmPluginBase )
+    {
+    
+    }
+    
+//---------------------------------------------------------------------------
+// CmPluginVpnSettingsDlg::ConstructAndRunLD
+// --------------------------------------------------------------------------
+//
+TInt CmPluginVpnSettingsDlg::ConstructAndRunLD( )
+    {
+    LOGGER_ENTERFN( "CmPluginVpnSettingsDlg::ConstructAndRunLD" );
+    CleanupStack::PushL( this );
+    LoadResourceL( KPluginVPNResDirAndFileName );
+    
+    // check if VPN is available, as if not, we can not show the details...
+    RVpnServ ps;
+    CleanupClosePushL<RVpnServ>( ps );
+    TInt err = ps.Connect();
+    if ( err )
+        {
+        // show note
+        HBufC* text = StringLoader::LoadLC( 
+                                    R_QTN_VPN_INFO_MGMT_UI_NOT_ACCESSIBLE );
+        TCmCommonUi::ShowNoteL( *text, TCmCommonUi::ECmInfoNote );
+        CleanupStack::PopAndDestroy( text );        
+        User::Leave( KLeaveWithoutAlert );
+        }
+    CleanupStack::PopAndDestroy(); // ps.close
+    
+    // check for compulsory fields missing & display note about it
+    // information note VPN access point is incomplete. Try reconfiguring 
+    // the access point. §qtn.vpn.info.vpn.iap.incomplete§ is displayed and 
+    // Must be defined qtn_selec_setting_compulsory is displayed 
+    // for the invalid settings.               
+    if ( !CompulsoryFilledL() )
+        {
+        // show note
+        HBufC* text = StringLoader::LoadLC( 
+                                    R_QTN_VPN_INFO_VPN_IAP_INCOMPLETE );
+        TCmCommonUi::ShowNoteL( *text, TCmCommonUi::ECmInfoNote );
+        CleanupStack::PopAndDestroy( text );
+        }
+    
+    CleanupStack::Pop( this );
+    
+    CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
+    cmMgr.WatcherRegisterL( this );
+    
+    return CmPluginBaseSettingsDlg::ConstructAndRunLD( );
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginVpnSettingsDlg::~CmPluginVpnSettingsDlg
+// Destructor
+// --------------------------------------------------------------------------
+//
+CmPluginVpnSettingsDlg::~CmPluginVpnSettingsDlg()
+    {
+    iResourceReader.Close();
+    }
+    
+// --------------------------------------------------------------------------
+// CmPluginVpnSettingsDlg::UpdateListBoxContentBearerSpecificL
+// --------------------------------------------------------------------------
+//
+void CmPluginVpnSettingsDlg::UpdateListBoxContentBearerSpecificL( 
+                                                    CDesCArray& aItemArray )
+    {
+    LOGGER_ENTERFN( "CmPluginVpnSettingsDlg::UpdateListBoxContentBearerSpecificL" );
+    HBufC* value = NULL;
+        
+    // VPN policy - Compulsory field
+    AppendSettingTextsL( aItemArray, EVpnServicePolicyName );
+    
+    TUint32 iapId = iCmPluginBaseEng.GetIntAttributeL( EVpnIapId );
+    TUint32 destId = iCmPluginBaseEng.GetIntAttributeL( ECmNextLayerSNAPId );
+    
+    CCmDestinationImpl* dest = NULL;
+    
+    // The underlying CM is a Destination
+    if ( destId )
+        {
+        dest = iCmPluginBaseEng.CmMgr().DestinationL( destId );
+        CleanupStack::PushL( dest );
+//        CleanupReleasePushL( dest );
+        value = dest->NameLC();
+        }
+    // The underlying CM is a CM
+    else if ( iapId )
+        {
+        value = iCmPluginBaseEng.CmMgr().GetConnectionMethodInfoStringL( 
+                                                           iapId, ECmName );
+        CleanupStack::PushL( value );
+        }
+    else
+        {
+        // Must be defined
+        value = StringLoader::LoadLC( R_QTN_VPN_SETT_VPN_IAP_REAL_NETW_REF_COMPULSORY );
+        }
+    
+    AppendSettingTextsL( aItemArray,
+                         ECmNextLayerIapId,
+                         R_QTN_VPN_SETT_VPN_IAP_REAL_NETW_REFERENCE,
+                         *value,
+                         ETrue );
+    CleanupStack::PopAndDestroy( value );
+
+    if ( destId )
+        {
+        CleanupStack::PopAndDestroy( dest );
+        }
+                         
+    // Proxy server address
+    AppendSettingTextsL( aItemArray, ECmProxyServerName );
+    // Proxy port number
+    AppendSettingTextsL( aItemArray, ECmProxyPortNumber );
+    
+    }
+
+
+// --------------------------------------------------------------------------
+// CmPluginVpnSettingsDlg::RunAdvancedSettingsL
+// --------------------------------------------------------------------------
+//
+void CmPluginVpnSettingsDlg::RunAdvancedSettingsL()
+    {
+    /* empty functionality */
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginVpnSettingsDlg::DynInitMenuPaneL
+// --------------------------------------------------------------------------
+//
+void CmPluginVpnSettingsDlg::DynInitMenuPaneL( TInt aResourceId,
+                                               CEikMenuPane* aMenuPane )
+   {
+   if ( aResourceId == R_PLUGIN_BASE_MENU )
+        {
+        aMenuPane->SetItemDimmed( EPluginBaseCmdAdvanced, ETrue  );           
+        }
+    }
+        
+// --------------------------------------------------------------------------
+// CmPluginVpnSettingsDlg::ShowPopupSettingPageL
+// --------------------------------------------------------------------------
+//
+TBool CmPluginVpnSettingsDlg::ShowPopupSettingPageL( TUint32 aAttribute, 
+                                                     TInt aCommandId )
+    {
+    LOGGER_ENTERFN( "CmPluginVpnSettingsDlg::ShowPopupSettingPageL" );
+    TBool retVal = EFalse;
+    switch ( aAttribute )
+        {
+        case EVpnServicePolicyName:        
+            {
+            CmPluginVpnPolicySelectionDlg* dlg = 
+                    CmPluginVpnPolicySelectionDlg::NewL( iCmPluginBaseEng );
+            CleanupStack::PushL( dlg );
+            retVal = dlg->ShowPolicySelectionDlgL();
+            UpdateListBoxContentL();
+            CleanupStack::PopAndDestroy();
+            break;
+            }
+        case ECmProxyServerName:
+            {
+            retVal = ShowPopupTextSettingPageL( aAttribute );
+            break;
+            }
+        case EVpnIapId:
+        case ECmNextLayerIapId:
+            {
+            ShowIapSelectionSettingPageL();
+            break;
+            }
+        case ECmProxyPortNumber:
+            {
+            retVal = ShowPopupPortNumSettingPageL( aAttribute );
+            break;
+            }
+        default:
+            {
+            CmPluginBaseSettingsDlg::ShowPopupSettingPageL( aAttribute, 
+                                                            aCommandId );
+            break;
+            }
+        }
+    return retVal;
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginVpnSettingsDlg::ShowIapSelectionSettingPageL
+// --------------------------------------------------------------------------
+//
+TBool CmPluginVpnSettingsDlg::ShowIapSelectionSettingPageL()
+    {  
+    LOGGER_ENTERFN( "CmPluginVpnSettingsDlg::ShowIapSelectionSettingPageL" ); 
+    TBool retVal( EFalse );
+    
+    CCmConnSettingsUiImpl* settings = 
+                                CCmConnSettingsUiImpl::NewL();
+    CleanupStack::PushL( settings );
+    settings->EnableEasyWlan( ETrue );
+    settings->EnableEmptyDestinations( EFalse );
+    settings->EnableVirtualCMs( EFalse );
+    
+    CCmDestinationImpl* d = iCmPluginBaseEng.ParentDestination();
+    if ( d )
+        {
+        settings->SetDestinationToOmit( d->Id() );
+//        settings->EnableUncat( ETrue );
+        }
+    else
+        {
+//        settings->EnableUncat( EFalse );
+        }
+    delete d;
+    settings->EnableUncat( ETrue );
+    
+    CCmPluginVpn* plugin = static_cast<CCmPluginVpn *>
+                    ( &iCmPluginBaseEng );
+    
+    RArray<TUint32> cmArray ( KCmArrayMediumGranularity );
+    CleanupClosePushL( cmArray );
+    
+    plugin->BindableDestinationsL( cmArray );
+    
+    settings->SetDestinationArrayToUseL( cmArray );
+    
+    TCmSettingSelection selection;
+    
+    // Get the underlying CM
+    selection.iId = iCmPluginBaseEng.GetIntAttributeL( ECmNextLayerIapId );
+    
+    if ( selection.iId )
+        {
+        selection.iResult = EConnectionMethod;
+        }
+    // The underlying CM is a destination
+    else
+        {        
+        selection.iResult = EDestination;
+        selection.iId = iCmPluginBaseEng.GetIntAttributeL( ECmNextLayerSNAPId );
+        }
+    
+    TBearerFilterArray aFilterArray;
+    if ( settings->RunApplicationSettingsL( selection,
+                                            EShowDestinations |
+                                            EShowConnectionMethods , 
+                                            aFilterArray ) )
+        {
+        switch ( selection.iResult )
+            {
+            case EDestination:
+                {
+                iCmPluginBaseEng.SetIntAttributeL( ECmNextLayerSNAPId, selection.iId );
+                break;
+                }
+            case EConnectionMethod:
+                {
+                
+                iCmPluginBaseEng.SetIntAttributeL( ECmNextLayerIapId, selection.iId );
+                break;
+                }
+            default:
+                {
+                User::Leave( KErrNotSupported );
+                }
+            }
+        UpdateListBoxContentL();
+        
+        // update the title pane with the new name
+        HBufC* newCmName = iCmPluginBaseEng.GetStringAttributeL( ECmName );
+        CleanupStack::PushL( newCmName );
+        iTitlePane->SetTextL( *newCmName );
+        CleanupStack::PopAndDestroy( newCmName );
+        
+        retVal = ETrue;
+        }
+    CleanupStack::PopAndDestroy( &cmArray );
+    CleanupStack::PopAndDestroy( settings );
+    return retVal;
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginVpnSettingsDlg::ProcessCommandL
+// --------------------------------------------------------------------------
+//
+void CmPluginVpnSettingsDlg::ProcessCommandL( TInt aCommandId )
+    {
+    if ( MenuShowing() )
+        {
+        HideMenu();
+        }
+
+    switch ( aCommandId )
+        {
+        case EAknSoftkeyOk:
+        case EPluginBaseCmdChange:
+            {
+            ShowPopupSettingPageL( 
+                    iSettingIndex->At( iListbox->CurrentItemIndex() ), 
+                                        aCommandId );
+            break;            
+            }
+        case EVpnIapId:
+        case ECmNextLayerIapId:
+        case ECmProxyServerName:
+        case ECmProxyPortNumber:
+            {
+            TInt attrib = iSettingIndex->At( iListbox->CurrentItemIndex() );
+            ShowPopupSettingPageL( attrib, aCommandId );  
+            break;
+            }
+        case EVpnServicePolicyName:
+            {
+            CmPluginVpnPolicySelectionDlg* dlg = 
+                    CmPluginVpnPolicySelectionDlg::NewL( iCmPluginBaseEng );
+            CleanupStack::PushL( dlg );
+            if ( dlg->ShowPolicySelectionDlgL() )
+                {
+                // update the setting
+                UpdateListBoxContentL();
+                }
+            // we might need to update even if not accepted
+            
+            CleanupStack::PopAndDestroy();
+            break;
+            }
+        default:
+            {
+            CmPluginBaseSettingsDlg::ProcessCommandL( aCommandId );
+            break;            
+            }
+        }
+    }
+
+
+// --------------------------------------------------------------------------
+// CmPluginVpnSettingsDlg::CompulsoryFilledL
+// --------------------------------------------------------------------------
+//
+TBool CmPluginVpnSettingsDlg::CompulsoryFilledL()
+    {
+    LOGGER_ENTERFN( "CmPluginVpnSettingsDlg::CompulsoryFilledL" );
+    
+    TBool retval = ETrue;
+    // compulsory settings are ECmName, EVpnIapId, EVpnServicePolicy
+    
+    // check name first
+    HBufC* name = iCmPluginBaseEng.GetStringAttributeL( ECmName );
+    if ( ( name->Compare( KNullDesC() ) ) == 0 )
+        {
+        retval = EFalse;
+        }        
+    delete name;
+    
+    // check VPN IAP ID
+    TUint32 iapid = iCmPluginBaseEng.GetIntAttributeL( EVpnIapId );
+    if ( !iapid )
+        {
+        TUint32 nextiapid = iCmPluginBaseEng.GetIntAttributeL( ECmNextLayerIapId  );
+        TUint32 snapid = iCmPluginBaseEng.GetIntAttributeL( ECmNextLayerSNAPId );
+        if ( !(nextiapid ^ snapid) )
+            {
+            retval = EFalse;
+            }
+        }
+        
+    // check policy
+    HBufC* polId = iCmPluginBaseEng.GetStringAttributeL( EVpnServicePolicy );
+    if ( ( polId->Compare( KNullDesC() ) ) == 0 )
+        {
+        retval = EFalse;
+        }
+    delete polId;
+
+    // check policy name
+    HBufC* polname = iCmPluginBaseEng.GetStringAttributeL( EVpnServicePolicyName );
+    if ( ( polname->Compare( KNullDesC() ) ) == 0 )
+        {
+        retval = EFalse;
+        }
+    delete polname;
+    
+    return retval;
+    }
+
+
+// --------------------------------------------------------------------------
+// CmPluginVpnSettingsDlg::OkToExitL
+// Good to know : EAknSoftkeyCancel is never called, because
+// EEikDialogFlagNotifyEsc flag is not set in the resource.
+// --------------------------------------------------------------------------
+//
+TBool CmPluginVpnSettingsDlg::OkToExitL( TInt aButtonId )
+    {
+    // Translate the button presses into commands for the appui & current
+    // view to handle
+    TBool retval( EFalse );
+    
+    switch ( aButtonId )
+        {
+        case EAknSoftkeyBack:
+            {
+            if ( CompulsoryFilledL() )
+                {
+                if( iIsPossibleToSaveSetting && iHasSettingChanged )
+                {
+                    iCmPluginBaseEng.UpdateL();
+                    iHasSettingChanged = EFalse;
+                }
+                retval = ETrue;
+
+                iCmPluginBaseEng.CmMgr().WatcherUnRegister();
+                }
+            else
+                {
+                // If there are compulsory fields empty, a confirmation query
+                // Incomplete VPN access point details. Exit without saving?
+                // §qtn.vpn.quest.vpn.iap.incomplete.delete§ is displayed.
+                // show note that compulsory settings are not filled
+                TInt res = TCmCommonUi::ShowConfirmationQueryL( 
+                                R_QTN_VPN_QUEST_VPN_IAP_INCOMPLETE_DELETE );
+                if ( res )
+                    { // quit without save
+                    retval = ETrue;
+                    TUint32 id = iCmPluginBaseEng.GetIntAttributeL( ECmId );
+                    iCmPluginBaseEng.RestoreAttributeL( ECmName );
+                    iCmPluginBaseEng.RestoreAttributeL( EVpnServicePolicyName );
+                    // EVpnServicePolicy has been restored when EVpnServicePolicyName
+                    // is restored.
+                    //iCmPluginBaseEng.RestoreAttributeL( EVpnServicePolicy );
+                    iCmPluginBaseEng.RestoreAttributeL( EVpnIapId );
+                    iCmPluginBaseEng.RestoreAttributeL( ECmNextLayerIapId );
+                    iCmPluginBaseEng.RestoreAttributeL( ECmNextLayerSNAPId );
+                    iCmPluginBaseEng.RestoreAttributeL( ECmProxyServerName );
+                    iCmPluginBaseEng.RestoreAttributeL( ECmProxyPortNumber );
+                    
+                    iCmPluginBaseEng.CmMgr().WatcherUnRegister();
+                    }
+                else
+                    { // do not save, reconfigure
+                    retval = EFalse;                    
+                    }
+                }
+            break;
+            }
+        default:
+            {
+            if( aButtonId == EPluginBaseCmdExit )
+                {
+                iCmPluginBaseEng.CmMgr().WatcherUnRegister();
+                }
+            
+            retval = CmPluginBaseSettingsDlg::OkToExitL( aButtonId );
+            break;
+            }
+        }
+
+    return retval;
+    }
+    
+// --------------------------------------------------------------------------
+// CmPluginVpnSettingsDlg::GetHelpContext
+// --------------------------------------------------------------------------
+//
+    
+void CmPluginVpnSettingsDlg::GetHelpContext( TCoeHelpContext& aContext ) const
+    {
+    LOGGER_ENTERFN( "CmPluginVpnSettingsDlg::GetHelpContext" );
+    aContext.iMajor = KHelpUidPlugin;
+    aContext.iContext = KSET_HLP_VPN_AP_SETTINGS_VIEW;
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginVpnSettingsDlg::CommsDatChangesL
+// --------------------------------------------------------------------------
+//
+void CmPluginVpnSettingsDlg::CommsDatChangesL()
+    {
+    CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
+    CCmDestinationImpl* parentDest = iCmPluginBaseEng.ParentDestination();
+
+    if ( parentDest )
+        {
+        if( !cmMgr.DestinationStillExistedL( parentDest ) )
+            {
+            cmMgr.WatcherUnRegister();
+            // If parent destination diappears with some reason 
+            // then the view must exit back to main view for it
+            // may be danger if going back to parent view
+            iExitReason = KDialogUserExit;
+            TryExitL( iExitReason );
+            
+            cmMgr.RemoveDestFromPool( parentDest );
+            delete parentDest;
+            return;
+            }
+        
+        if( !cmMgr.IsIapStillInDestL( parentDest, iCmPluginBaseEng ) )
+            {
+            cmMgr.WatcherUnRegister();
+            // In this case, the view can go back to the parent view
+            TryExitL( iExitReason );
+            
+            cmMgr.RemoveDestFromPool( parentDest );
+            delete parentDest;
+            return;            
+            }
+        
+        // We may have to go back to parent view even though this Iap is still in CommsDat
+        // for cmMgr ( = iCmPluginBaseEng.CmMgr() ) can not be accessed any more
+        // after this call when some Iap is deleted.
+        cmMgr.WatcherUnRegister();
+        TryExitL( iExitReason );
+        
+        cmMgr.RemoveDestFromPool( parentDest );
+        delete parentDest;
+        }
+    else
+        {
+        if( !cmMgr.IapStillExistedL( iCmPluginBaseEng ) )
+            {
+            cmMgr.WatcherUnRegister();
+            // In this case, the dialog can go back to the parent view
+            TryExitL( iExitReason );
+            return;
+            }
+        
+        // We may have to go back to parent view even though this Iap is still in CommsDat
+        // for cmMgr ( = iCmPluginBaseEng.CmMgr() ) can not be accessed any more
+        // after this call when some Iap is deleted.
+        cmMgr.WatcherUnRegister();
+        TryExitL( iExitReason );
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginwlan/data/10281BB2.rss	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,46 @@
+/*
+* 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 definitions for project cmpluginwlan
+*
+*/
+
+#include "ecom/registryinfo.rh"
+
+// Because attribute enums had to be added to namespace CMManager
+// it's not possible to included cmpluginwlandef.h
+// Thus bearer type id had to be redefine here.
+#define KUidWlanBearerType  0x10281BB1
+
+RESOURCE REGISTRY_INFO theInfo
+    {
+    dll_uid = 0x10281BB2;
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = 0x10207377; // = KCMPluginInterfaceUid
+            implementations = 
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = KUidWlanBearerType;
+                    version_no = 1;
+                    display_name = "Wlan";
+                    default_data = "Wlan";
+                    opaque_data = "";
+                    }
+                };
+            }
+        };
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginwlan/data/cmwlanui.rss	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,641 @@
+/*
+* 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 definitions for project cmpluginwlan
+*
+*/
+#include <avkon.rsg>
+#include <avkon.rh>    
+#include <avkon.loc>
+#include <avkon.mbg>
+#include <uikon.rh>
+#include <eikon.rsg>
+#include <eikon.rh>
+#include <AvkonIcons.hrh>
+#include <cmpsettingsconsts.h>
+#include <cmmanager.rsg>
+
+#include <cmpluginwlan.loc>
+
+NAME    WLPL
+
+RESOURCE RSS_SIGNATURE { }
+
+RESOURCE TBUF { buf = "cmwlanplugin"; }
+
+
+// LOCALISED STRINGS
+
+// ---------------------------------------------------------------------------
+// r_qtn_netw_conset_bearer_supported_wlan
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_netw_conset_bearer_supported_wlan
+    {
+    buf = qtn_netw_conset_bearer_supported_wlan;
+    }
+
+// ---------------------------------------------------------------------------
+// r_qtn_netw_conset_bearer_available_wlan
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_netw_conset_bearer_available_wlan
+    {
+    buf = qtn_netw_conset_bearer_available_wlan;
+    }
+
+// ---------------------------------------------------------------------------
+// r_qtn_netw_conset_one_wlan_nw_available
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_netw_conset_one_wlan_nw_available
+    {
+    buf = qtn_netw_conset_one_wlan_nw_available;
+    }
+
+// ---------------------------------------------------------------------------
+// r_qtn_netw_conset_many_wlan_nw_available
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_netw_conset_many_wlan_nw_available
+    {
+    buf = qtn_netw_conset_many_wlan_nw_available;
+    }
+
+// ---------------------------------------------------------------------------
+// r_qtn_wlan_sett_network_name
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_wlan_sett_network_name
+    {
+    buf = qtn_wlan_sett_network_name;
+    }
+
+// ---------------------------------------------------------------------------
+// r_qtn_wlan_prmpt_network_name
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_wlan_prmpt_network_name
+    {
+    buf = qtn_wlan_prmpt_network_name;
+    }
+
+// ---------------------------------------------------------------------------
+// r_qtn_wlan_sett_hidden_network
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_wlan_sett_hidden_network
+    {
+    buf = qtn_wlan_sett_hidden_network;
+    }
+    
+// ---------------------------------------------------------------------------
+// r_qtn_wlan_sett_network_mode
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_wlan_sett_network_mode
+    {
+    buf = qtn_wlan_sett_network_mode;
+    }
+    
+// ---------------------------------------------------------------------------
+// r_qtn_wlan_sett_security_mode
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_wlan_sett_security_mode
+    {
+    buf = qtn_wlan_sett_security_mode;
+    }
+    
+// ---------------------------------------------------------------------------
+// r_qtn_wlan_sett_security_settings
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_wlan_sett_security_settings
+    {
+    buf = qtn_wlan_sett_security_settings;
+    }
+    
+// ---------------------------------------------------------------------------
+// r_qtn_wlan_sett_hidden_network_no
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_wlan_sett_hidden_network_no
+    {
+    buf = qtn_wlan_sett_hidden_network_no;
+    }
+    
+// ---------------------------------------------------------------------------
+// r_qtn_wlan_sett_hidden_network_yes
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_wlan_sett_hidden_network_yes
+    {
+    buf = qtn_wlan_sett_hidden_network_yes;
+    }
+    
+// ---------------------------------------------------------------------------
+// r_qtn_wlan_sett_network_mode_infra
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_wlan_sett_network_mode_infra
+    {
+    buf = qtn_wlan_sett_network_mode_infra;
+    }
+
+// ---------------------------------------------------------------------------
+// r_qtn_netw_conset_prmpt_wlan_nw_mode_and_status
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_netw_conset_prmpt_wlan_nw_mode_and_status
+    {
+    buf = qtn_netw_conset_prmpt_wlan_nw_mode_and_status;
+    }
+
+// ---------------------------------------------------------------------------
+// r_qtn_wlan_network_mode_infra_public
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_wlan_network_mode_infra_public
+    {
+    buf = qtn_wlan_network_mode_infra_public;
+    }
+
+// ---------------------------------------------------------------------------
+// r_qtn_wlan_network_mode_infra_hidden
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_wlan_network_mode_infra_hidden
+    {
+    buf = qtn_wlan_network_mode_infra_hidden;
+    }
+    
+ // ---------------------------------------------------------------------------
+// r_qtn_wlan_network_mode_adhoc_public
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_wlan_network_mode_adhoc_public
+    {
+    buf = qtn_wlan_network_mode_adhoc_public;
+    }
+    
+// ---------------------------------------------------------------------------
+// r_qtn_wlan_network_mode_adhoc_hidden
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_wlan_network_mode_adhoc_hidden
+    {
+    buf = qtn_wlan_network_mode_adhoc_hidden;
+    }
+
+// ---------------------------------------------------------------------------
+// r_qtn_netw_conset_prmpt_wlan_nw_security_mode
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_netw_conset_prmpt_wlan_nw_security_mode
+    {
+    buf = qtn_netw_conset_prmpt_wlan_nw_security_mode;
+    }
+
+// ---------------------------------------------------------------------------
+// r_qtn_netw_conset_wlan_security_mode_open
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_netw_conset_wlan_security_mode_open
+    {
+    buf = qtn_netw_conset_wlan_security_mode_open;
+    }
+
+// ---------------------------------------------------------------------------
+// r_qtn_netw_conset_wlan_security_mode_wep
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_netw_conset_wlan_security_mode_wep
+    {
+    buf = qtn_netw_conset_wlan_security_mode_wep;
+    }
+
+// ---------------------------------------------------------------------------
+// r_qtn_netw_conset_wlan_security_mode_802_1x
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_netw_conset_wlan_security_mode_802_1x
+    {
+    buf = qtn_netw_conset_wlan_security_mode_802_1x;
+    }
+
+// ---------------------------------------------------------------------------
+// r_qtn_netw_conset_wlan_security_mode_wpa
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_netw_conset_wlan_security_mode_wpa
+    {
+    buf = qtn_netw_conset_wlan_security_mode_wpa;
+    }
+    
+// ---------------------------------------------------------------------------
+// r_qtn_wlan_sett_security_mode_open
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_wlan_sett_security_mode_open
+    {
+    buf = qtn_wlan_sett_security_mode_open;
+    }
+    
+// ---------------------------------------------------------------------------
+// r_qtn_wlan_sett_security_mode_wep
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_wlan_sett_security_mode_wep
+    {
+    buf = qtn_wlan_sett_security_mode_wep;
+    }
+    
+// ---------------------------------------------------------------------------
+// r_qtn_wlan_sett_security_mode_802_1x
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_wlan_sett_security_mode_802_1x
+    {
+    buf = qtn_wlan_sett_security_mode_802_1x;
+    }
+    
+// ---------------------------------------------------------------------------
+// r_qtn_netw_conset_wlan_sett_security_mode_wpa
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_netw_conset_wlan_sett_security_mode_wpa
+    {
+    buf = qtn_netw_conset_wlan_sett_security_mode_wpa;
+    }
+
+// ---------------------------------------------------------------------------
+// r_qtn_wlan_sett_security_mode_wapi
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_wlan_sett_security_mode_wapi
+    {
+    buf = qtn_wlan_sett_security_mode_wapi;
+    }
+
+// ---------------------------------------------------------------------------
+// r_qtn_netw_conset_prmpt_wlan_wpa_mode
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_netw_conset_prmpt_wlan_wpa_mode
+    {
+    buf = qtn_netw_conset_prmpt_wlan_wpa_mode;
+    }
+
+// ---------------------------------------------------------------------------
+// r_qtn_netw_conset_prmpt_wpa_mode_eap
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_netw_conset_prmpt_wpa_mode_eap
+    {
+    buf = qtn_netw_conset_prmpt_wpa_mode_eap;
+    }
+
+// ---------------------------------------------------------------------------
+// r_qtn_netw_conset_prmpt_wpa_mode_psk
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_netw_conset_prmpt_wpa_mode_psk
+    {
+    buf = qtn_netw_conset_prmpt_wpa_mode_psk;
+    }
+    
+// ---------------------------------------------------------------------------
+// r_qtn_netw_conset_info_eap_settings_default
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_netw_conset_info_eap_settings_default
+    {
+    buf = qtn_netw_conset_info_eap_settings_default;
+    }
+    
+// ---------------------------------------------------------------------------
+// r_qtn_wlan_sett_security_mode_wpa
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_wlan_sett_security_mode_wpa
+    {
+    buf = qtn_wlan_sett_security_mode_wpa;
+    }
+    
+// ---------------------------------------------------------------------------
+// r_qtn_wlan_sett_network_name_user_defined
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_wlan_sett_network_name_user_defined
+    {
+    buf = qtn_wlan_sett_network_name_user_defined;
+    }
+    
+// ---------------------------------------------------------------------------
+// r_qtn_wlan_sett_network_name_scan
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_wlan_sett_network_name_scan
+    {
+    buf = qtn_wlan_sett_network_name_scan;
+    }
+    
+// ---------------------------------------------------------------------------
+// r_qtn_wlan_sett_network_mode_adhoc
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_wlan_sett_network_mode_adhoc
+    {
+    buf = qtn_wlan_sett_network_mode_adhoc;
+    }
+    
+// ---------------------------------------------------------------------------
+// r_qtn_wlan_sett_adhoc_channel
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_wlan_sett_adhoc_channel
+    {
+    buf = qtn_wlan_sett_adhoc_channel;
+    }
+
+// ---------------------------------------------------------------------------
+// r_qtn_wlan_prmpt_adhoc_channel
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_wlan_prmpt_adhoc_channel
+    {
+    buf = qtn_wlan_prmpt_adhoc_channel;
+    }
+    
+// ---------------------------------------------------------------------------
+// r_qtn_wlan_sett_adhoc_channel_automatic
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_wlan_sett_adhoc_channel_automatic
+    {
+    buf = qtn_wlan_sett_adhoc_channel_automatic;
+    }
+
+// ---------------------------------------------------------------------------
+// r_qtn_wlan_sett_adhoc_channel_user_defined
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_wlan_sett_adhoc_channel_user_defined
+    {
+    buf = qtn_wlan_sett_adhoc_channel_user_defined; 
+    }
+
+// ---------------------------------------------------------------------------
+// r_qtn_wlan_info_no_security_settings
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_wlan_info_no_security_settings
+    {
+    buf = qtn_wlan_info_no_security_settings;
+    }
+
+// ---------------------------------------------------------------------------
+// r_qtn_netw_conset_popup_bearer_wlan
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_netw_conset_popup_bearer_wlan
+    {
+    buf = qtn_netw_conset_popup_bearer_wlan;
+    }
+
+// ---------------------------------------------------------------------------
+// r_qtn_wlan_quest_nw_name_not_defined
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_wlan_quest_nw_name_not_defined
+    {
+    buf = qtn_wlan_quest_nw_name_not_defined;
+    }
+    
+// ---------------------------------------------------------------------------
+// r_qtn_wlan_quest_security_settings_empty
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_wlan_quest_security_settings_empty
+    {
+    buf = qtn_wlan_quest_security_settings_empty;
+    }
+  
+// ---------------------------------------------------------------------------
+// r_qtn_wlan_sett_bearer_wlan
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_wlan_sett_bearer_wlan
+    {
+    buf = qtn_wlan_sett_bearer_wlan;
+    }
+
+
+// ---------------------------------------------------------------------------
+// r_qtn_wlan_sett_ssid_roaming
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_wlan_sett_ssid_roaming
+    {
+    buf = qtn_wlan_sett_ssid_roaming;
+    }
+
+
+// ---------------------------------------------------------------------------
+// r_qtn_wlan_sett_ssid_roaming_enabled
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_wlan_sett_ssid_roaming_enabled
+    {
+    buf = qtn_wlan_sett_ssid_roaming_enabled;
+    }
+
+
+// ---------------------------------------------------------------------------
+// r_qtn_wlan_sett_ssid_roaming_disabled
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_wlan_sett_ssid_roaming_disabled
+    {
+    buf = qtn_wlan_sett_ssid_roaming_disabled;
+    }
+
+// ---------------------------------------------------------------------------
+// qtn_wlan_info_no_networks_found;
+// localised string
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_info_no_networks_found
+    { 
+    buf = qtn_wlan_info_no_networks_found;
+    }
+
+// ---------------------------------------------------------------------------
+// r_setting_app_edwin_netw_name
+// edwin for network name setting page
+// ---------------------------------------------------------------------------
+//
+RESOURCE EDWIN r_setting_app_edwin_netw_name
+    {
+    width = KNetworkNameWidth;
+    lines = KNetworkNameLines;
+    maxlength = KMaxNetworkNameLength;
+    allowed_input_modes = EAknEditorTextInputMode | EAknEditorNumericInputMode;
+    default_input_mode = EAknEditorTextInputMode;
+    flags = EEikEdwinAutoSelection | EEikEdwinNoLineOrParaBreaks;
+    }
+
+    
+// ---------------------------------------------------------------------------
+// r_text_setting_page_netw_name
+// setting page for network name
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_text_setting_page_netw_name
+    {
+    number = EAknSettingPageNoOrdinalDisplayed;
+    softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+    label = qtn_wlan_sett_network_name;
+    type = EEikCtEdwin;
+    editor_resource_id = r_setting_app_edwin_netw_name;
+    }
+
+// ---------------------------------------------------------------------------
+// r_text_setting_page_gw_addr
+// setting page for WAP gateway address
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_text_setting_page_gw_addr
+    {
+    number = EAknSettingPageNoOrdinalDisplayed;
+    softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+    label= qtn_netw_sett_default_gateway;
+    type = EAknCtIpFieldEditor;
+    editor_resource_id = R_SETTING_APP_IP_EDITOR;
+    }
+    
+// ---------------------------------------------------------------------------
+// r_text_setting_page_subnet_addr
+// setting page for subnet mask setting
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_text_setting_page_subnet_addr
+    {
+    number = EAknSettingPageNoOrdinalDisplayed;
+    softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+    label = qtn_netw_sett_subnet_mask;
+    type = EAknCtIpFieldEditor;
+    editor_resource_id = R_SETTING_APP_IP_EDITOR;
+    }
+
+// --------------------------------------------------------------------------
+// r_numeric_query
+// number query
+// --------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_numeric_query
+	{
+	flags = EGeneralQueryFlags | EEikDialogFlagNoShadow;
+	buttons = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+	items=
+		{
+		DLG_LINE
+			{
+			type = EAknCtQuery;
+			id = EGeneralQuery;
+			control = AVKON_DATA_QUERY 
+				{ 
+				layout = EStaticSizeDataLayout;
+				control = EDWIN
+					{
+					flags = EEikEdwinNoHorizScrolling;
+                    default_input_mode = EAknEditorNumericInputMode;
+					};
+				};
+			}
+		};
+	}
+
+
+RESOURCE DIALOG r_searching_wlan_wait_note
+	{
+	flags = EAknWaitNoteFlags;
+	buttons=R_AVKON_SOFTKEYS_EMPTY;
+    items=
+		{
+		DLG_LINE
+			{
+			type = EAknCtNote;
+			id = EGeneralNote; 
+			control= AVKON_NOTE 
+                { 
+				layout = EWaitLayout;
+				singular_label = qtn_wlan_wait_searching_networks;				
+                imagefile = AVKON_ICON_FILE;
+				imageid = EMbmAvkonQgn_note_progress;
+				imagemask = EMbmAvkonQgn_note_progress_mask;
+				animation = R_QGN_GRAF_WAIT_BAR_ANIM;				
+				};
+			}
+		};
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginwlan/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2006-2008 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 WLAN plugin.   
+*      
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+// export localised loc file
+../loc/cmpluginwlan.loc	MW_LAYER_LOC_EXPORT_PATH(cmpluginwlan.loc)
+
+PRJ_MMPFILES
+cmpluginwlan.mmp
+
+PRJ_EXTENSIONS
+START EXTENSION s60/mifconv
+OPTION TARGETFILE cmpluginwlan.mif
+OPTION HEADERFILE cmpluginwlan.mbg
+OPTION SOURCES -c8,1 qgn_prop_wlan_bearer\
+               -c8,8 qgn_prop_set_conn_bearer_avail_wlan\
+               -c8,1 qgn_prop_set_conn_wlan_easy
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginwlan/group/cmpluginwlan.mmp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,97 @@
+/*
+* 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: 
+*      Project specification for LAN Plugin.   
+*      
+*
+*/
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+TARGET      cmpluginwlan.dll
+UID         0x10009D8D 0x10281BB2
+
+TARGETTYPE		PLUGIN
+
+CAPABILITY      CAP_ECOM_PLUGIN
+VENDORID        VID_DEFAULT
+
+SOURCEPATH  ../src
+
+SOURCE      cmpluginwlanproxy.cpp
+SOURCE      cmpluginwlan.cpp
+SOURCE      cmpluginwlandata.cpp
+SOURCE      cmpluginwlandataarray.cpp
+SOURCE      ../../../Framework/Src/cmlogger.cpp
+SOURCE      cmpwlansettingsdlg.cpp
+SOURCE      cmpwlansettingsdlgadv.cpp
+SOURCE      cmpwlansettingsdlgipv4.cpp
+SOURCE      cmpwlansettingsdlgipv6.cpp
+SOURCE      cmwlancoveragecheck.cpp
+SOURCE      cmpwlanactivewaiter.cpp
+
+SOURCEPATH  ../data
+
+START RESOURCE 10281BB2.rss
+TARGET cmpluginwlan.rsc
+END
+
+START RESOURCE cmwlanui.rss
+DEPENDS cmmanager.rsg
+HEADER
+TARGETPATH   RESOURCE_FILES_DIR
+LANGUAGE_IDS
+END
+
+USERINCLUDE     ../../../Framework/Inc
+
+// Component specific internal headers 
+USERINCLUDE			../inc
+
+// ADO specific internal headers 
+SYSTEMINCLUDE		../../../../../inc
+   
+//Macro to /epoc32 headers
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY     euser.lib
+LIBRARY 	efsrv.lib
+LIBRARY	    ECOM.LIB
+LIBRARY     cmmanager.lib
+LIBRARY     COMMSDAT.lib
+LIBRARY     WEPSecuritySettingsUi.lib
+LIBRARY     WPASecuritySettingsUi.lib
+LIBRARY     wapisecuritysettingsui.lib
+LIBRARY     AknSkins.lib
+LIBRARY     ConnectionUiUtilities.lib
+LIBRARY     cmmanagerdatabase.lib
+
+DEBUGLIBRARY flogger.lib
+
+LIBRARY	CommonUI.LIB
+LIBRARY	CommonEngine.lib
+LIBRARY	bafl.lib
+LIBRARY eikcoctl.lib avkon.lib eikdlg.lib
+LIBRARY insock.lib
+LIBRARY FeatMgr.lib
+   
+LIBRARY eikcore.lib egul.lib
+LIBRARY eikctl.lib  cone.lib 
+LIBRARY fbscli.lib
+LIBRARY AknCapServerClient.lib
+LIBRARY aknnotify.lib
+
+LIBRARY	wifiprotplugin.lib
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginwlan/group/pluginwlan_icons.mk	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,68 @@
+#
+# 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 ApSettingsHandlerUi
+#
+
+ifeq (WINS,$(findstring WINS, $(PLATFORM)))
+ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\Z
+else
+ZDIR=\epoc32\data\z
+endif
+
+
+TARGETDIR=$(ZDIR)\resource\apps
+ICONTARGETFILENAME=$(TARGETDIR)\cmpluginwlan.mif
+
+HEADERDIR=\epoc32\include
+HEADERFILENAME=$(HEADERDIR)\cmpluginwlan.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) \
+                /c8,1 qgn_prop_wlan_bearer.bmp \
+                /c8,8 qgn_prop_set_conn_bearer_avail_wlan.bmp \
+                /c8,1 qgn_prop_set_conn_wlan_easy.bmp
+
+FREEZE : do_nothing
+
+SAVESPACE : do_nothing
+
+RELEASABLES :
+	@echo $(HEADERFILENAME)&& \
+	@echo $(ICONTARGETFILENAME)
+
+FINAL : do_nothing
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginwlan/inc/cmpluginwlan.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,617 @@
+/*
+* 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 WLAN interface implementation for WLAN plugin
+*
+*/
+
+#ifndef WLAN_PLUGIN_H
+#define WLAN_PLUGIN_H
+
+// INCLUDES
+#include <cmpluginlanbase.h>
+#include <cmpluginwlandef.h>
+#include <e32base.h>
+#include <eikdoc.h>
+#include <apparc.h>
+#include <eikenv.h>
+#include <wlanmgmtcommon.h>
+#include <wifiprotreturn.h>
+
+// FORWARD DECLARATION
+class CCDWlanServiceRecord;
+class CWEPSecuritySettings;
+class CWEPSecuritySettingsUi;
+class CWPASecuritySettings;
+class CWPASecuritySettingsUi;
+class RConeResourceLoader;
+class CConnectionUiUtilities;
+class CCmPluginWlanDataArray;
+class CAknWaitDialog;
+ 
+class CWAPISecuritySettings;
+class CWAPISecuritySettingsUi;
+
+/** 
+ * WPA Mode
+ */
+enum TWpaMode
+    {
+    EWpaModeUndefined = -1,
+    EWpaModeEap,
+    EWpaModePreSharedKey
+    };
+
+/**
+ *  WLAN Plugin IF implementation class
+ *
+ *  ?more_complete_description
+ *
+ *  @since S60 3.2
+ */
+NONSHARABLE_CLASS( CCmPluginWlan ) : public CCmPluginLanBase
+    {
+
+    public: // Constructors and destructor
+
+        /**
+        * Two phased constructor
+        *
+        * @since S60 3.2
+        * @param aInitParam
+        * @return The created object.
+        */      
+		static CCmPluginWlan* NewL( TCmPluginInitParam* aInitParam );
+
+        /**
+        * Destructor.
+        */      
+        virtual ~CCmPluginWlan();
+        
+        virtual CCmPluginBaseEng* CreateInstanceL( TCmPluginInitParam& aInitParam ) const;
+        
+    public: // from base class
+        
+		/**
+		* From CCmPluginBaseEng
+		* Gets the value for a TUint32 attribute
+		*
+		* @since S60 3.2
+		* @param aAttribute Identifies the attribute to be retrived
+		* @return the requested TUint32 value
+		*/
+		TUint32 GetIntAttributeL( const TUint32 aAttribute ) const;
+
+		/**
+		* From CCmPluginBaseEng
+		* Gets the value for a TBool attribute
+		*
+		* @since S60 3.2
+		* @param aAttribute Identifies the attribute to be retrived
+        * @return the requested TBool value
+		*/
+		TBool GetBoolAttributeL( const TUint32 aAttribute ) const;
+
+		/**
+		* From CCmPluginBaseEng
+		* Gets the value for a TDes16 attribute
+		*
+		* @since S60 3.2
+		* @param aAttribute Identifies the attribute to be retrived
+        * @return the requested string value
+		*/
+		HBufC* GetStringAttributeL( const TUint32 aAttribute ) const;
+
+		/**
+		* From CCmPluginBaseEng
+		* Sets the value for a TInt attribute
+		*
+		* @since S60 3.2
+		* @param aAttribute Identifies the attribute to be set.
+		* @param aValue The value to be set
+        */
+		void SetIntAttributeL( const TUint32 aAttribute, TUint32 aValue );
+
+		/**
+		* * From CCmPluginBaseEng
+		* Sets the value for a TBool attribute
+		*
+		* @since S60 3.2
+		* @param aAttribute Identifies the attribute to be set.
+		* @param aValue The value to be set
+        */
+		void SetBoolAttributeL( const TUint32 aAttribute, TBool aValue );
+
+		/**
+		* From CCmPluginBaseEng
+		* Sets the value for a TDesC attribute
+		*
+		* @since S60 3.2
+		* @param aAttribute Identifies the attribute to be set.
+		* @param aValue The value to be set
+        */
+		void SetStringAttributeL( const TUint32 aAttribute, const TDesC16& aValue );
+      
+        /**
+		* From CCmPluginBaseEng
+		* Checks if the plug-in can handle the given AP.
+		*
+		* @since S60 3.2
+		* @param aIapId
+		* @return ETrue if plug-in can handle the IAP
+        */        
+        TBool CanHandleIapIdL( TUint32 aIapId ) const;
+        
+        /**
+		* From CCmPluginBaseEng
+        * Checks if the plug-in can handle the given AP
+        *
+        * @since S60 3.2
+        * @param aIapRecord IAP record to be checked
+        * @return ETrue if plug-in can handle the IAP
+        */
+        TBool CanHandleIapIdL( CommsDat::CCDIAPRecord *aIapRecord ) const;
+
+        /**
+        * From CCmPluginBaseEng
+        * Launches the WLAN settings dialog
+        *
+        * @since S60 3.2
+        * @return soft key selection
+        */
+        TInt RunSettingsL();
+        
+        /**
+        * From CCmPluginBaseEng
+        * see base class definition
+        *
+        * @since S60 3.2
+        */
+	    TBool InitializeWithUiL( TBool aManuallyConfigure );
+
+        /**
+        * From CCmPluginBaseEng
+        * see base class definition
+        *
+        * @since S60 3.2
+        */      
+	    void LoadServiceSettingL();
+	    
+	    /**
+        * From CCmPluginBaseEng
+        * see base class definition
+        *
+        * @since S60 3.2
+        */
+	    void AdditionalReset();
+	    
+    public: // New functions
+	    /**
+	    * Edits the security settings for the current connection method
+	    *
+        * @since S60 3.2
+        * @param aEikonEnv Eikon environment to use
+        * @return exit reason
+	    */	  
+	    TInt EditSecuritySettingsL( CEikonEnv& aEikonEnv );
+	    
+	    /**
+	    * Returns the security settings validity for the current connection method
+	    *
+	    * @since S60 3.2
+	    * @return Validity of the current security settings
+	    */	    
+        TBool AreSecuritySettingsValidL();
+
+	    /**
+	    * Loads the security settings for the current connection method
+	    *
+	    * @since S60 3.2
+	    */
+	    void LoadSecuritySettingsL();
+
+    protected:
+    
+        /**
+        * From CCmPluginBaseEng
+        * see base class definition
+        *
+        * @since S60 3.2
+        */
+	    virtual void BearerRecordIdLC( HBufC* &aBearerName, 
+                                   TUint32& aRecordId );
+
+
+        /**
+        * Copy data of the connection method that is not 
+        * added to the conversion table. (e.g. bearer specific
+        * flags)
+        *
+        * @param aDestInst copy attributes into this plugin instance
+        */    
+        void CopyAdditionalDataL( CCmPluginBaseEng& aDestInst ) const;
+        
+        
+	private: // construction
+
+        /**
+        * Constructor
+        *
+        * @since S60 3.2
+        */      
+		CCmPluginWlan( TCmPluginInitParam* aInitParam );
+
+        /**
+        * Second phase constructor
+        *
+        * @since S60 3.2
+        */      
+		void ConstructL();
+
+    private: // from base class
+    
+        /**
+        * From CCmPluginBaseEng
+        * Updates additional records, in this case, the WLAN records.
+        *
+        * @since S60 3.2
+        */
+        void UpdateAdditionalRecordsL();
+
+        /**
+        * From CCmPluginBaseEng
+        * Deletes additional records, in this case, the WLAN records
+        *
+        * @since S60 3.2
+        */
+        void DeleteAdditionalRecordsL();
+
+        /**
+        * From CCmPluginBaseEng
+        * Loads additional records, in this case, the WLAN records
+        *
+        * @since S60 3.2
+        */
+        void LoadAdditionalRecordsL();
+    
+	    /**
+        * From CCmPluginBaseEng
+        * Creates a new service record for this bearer
+        *
+        * @since S60 3.2
+        */
+	    void CreateNewServiceRecordL();
+	    
+	    /**
+        * From CCmPluginBaseEng
+        * Creates the WLAN service record used by this WLAN
+        *
+        * @since S60 3.2
+        */
+
+	    void CreateWlanServiceRecordL();
+	    
+        /**
+        * From CCmPluginBaseEng
+        */
+        virtual void PrepareToUpdateRecordsL();
+
+        /**
+        * Appends uids of connection methods - which were also created during connection method
+        * creation - to the array given as parameter 
+        * @param aIapIds the array the additonal cm uids are appended to
+        */        
+        virtual void GetAdditionalUids( RArray<TUint32>& aIapIds );
+	    
+    private: // new functions
+    	    
+        /**
+        * Updates the security settings for the current WLAN connection method
+        *
+        * @since S60 3.2
+        */
+        void UpdateSecuritySettingsL();
+
+        /**
+        * Allocates a string specified by aResId and replaces %N in the
+        * resource with aInt
+        *
+        * @since S60 3.2
+        * @param aResId Resource ID to be read from resource file.
+        * @param aInt Integer that will replace %N in the string.
+        * @return String read from resource file, specified by aResId,
+        * containing aInt.
+        */
+        HBufC* ReadResourceL( TInt aResId, TInt aInt ) const;
+
+        /**
+        * The UI for manually configuring a WLAN connection method
+        * 
+        * @since S60 3.2
+        * @return ETrue if the configuration was successful
+        */
+        TBool ManuallyConfigureL();
+        
+        /**
+        * Continuing with Manual configuration from step 4
+        * called from ManuallyConfigureL or AutomaticallyConfigureL in case the
+        * specicfied network was not found (reverting to fully manual setup)
+        * 
+        * @since S60 3.2
+        * @param TBool aAskNWModeAndSec if set to ETrue, NW mode and Security 
+        * mode dialogs are shown. If EFalse, these values are taken from
+        * the corresponding parameters of this function
+        * @param TWlanNetMode& aNwMode NW mode used if aAskNWModeAndSec is EFalse
+        * @param TWlanConnectionExtentedSecurityMode& aSecurityMode 
+        * Security mode used if aAskNWModeAndSec is EFalse
+        * @param TWpaMode& aWpaMode WPA mode
+        * @return ETrue if the configuration was successful
+        */
+        TBool ProceedWithManualL( TBool aAskNWModeAndSec,
+                                  CMManager::TWlanNetMode aNwMode = CMManager::EInfra, 
+                                  TWlanConnectionExtentedSecurityMode aSecurityMode = EWlanConnectionExtentedSecurityModeOpen,
+                                  TWpaMode aWpaMode = EWpaModeUndefined );
+        /**
+        * The UI for automatically configuring a WLAN connection method
+        * 
+        * @since S60 3.2
+        * @return ETrue if the configuration was successful
+        */
+        TBool AutomaticallyConfigureL();
+
+        /*
+        * Loads a specific resource, leaves the resource loader on the 
+        * cleanup stack
+        * 
+        * @since S60 3.2
+        * @param aResourceLoader
+        */
+        void LoadResourceLC( RConeResourceLoader& aResourceLoader ) const;
+        
+        /*
+        * Prompt for the Network Name of the new WLAN connection method
+        * sets the network name and SSID settings 
+        *
+        * @since S60 3.2
+        * @param 
+        * @return ETrue if a selection was made, EFalse if cancelled
+        */
+        TBool ShowNWNameQueryL( TDes& aName );
+        
+        /*
+        * Scans for a WLAN network by a given SSID
+        * initially makes a broadcast scan and if not found a direct scan.
+        * Sets the scan ssid setting
+        *
+        * @since S60 3.2
+        * @param aSsid the SSID to scan for
+        * @return ETrue if a network has been found with the SSID
+        */
+        TBool ScanForWlanNwL( TWlanSsid& aSsid, 
+                              CMManager::TWlanNetMode& aNetworkMode,
+                              TWlanConnectionExtentedSecurityMode& aSecurityMode,
+                              TBool& aProtectedSetupSupported  );
+
+        /*
+        * Selection list for Network Mode
+        *
+        * @since S60 3.2
+        * @param aNWMode (return value) network mode selected
+        * @return ETrue if a selection was made, EFalse if cancelled
+        */
+        TBool SelectNWModeL( CMManager::TWlanNetMode& aNWMode );
+        
+        /*
+        * Displays a user selection dialog of Security Modes
+        * 
+        * @since S60 3.2
+        * @param aNwMode which network mode was selected
+        * @param aSecurityMode returns the selection
+        * @return ETrue if a selection was made, EFalse if cancelled
+        */
+        TBool ShowNWSecurityDlgL( CMManager::TWlanNetMode aNwMode, 
+                                  TWlanConnectionExtentedSecurityMode& aSecurityMode );
+        
+        /*
+        * Triggers the WEP key input query  
+        *
+        * @since S60 3.2
+        * @return ETrue if a selection was made, EFalse if cancelled
+        */
+        TBool EnterWEPKeyL();
+        
+        /*
+        * Triggers the pre-shared key for WPA WLAN query
+        *
+        * @since S60 3.2
+        * @return ETrue if a selection was made, EFalse if cancelled
+        */
+        TBool EnterWpaPreSharedKeyL();
+        
+        /*
+        * Shows the WPA/WPA2 mode dialog
+        * 
+        * @since S60 3.2
+        * @param aWpaMode return value
+        * @return ETrue if selection made
+        */
+        TBool SelectWpaModeDialogL( TWpaMode& aWpaMode );
+        
+        /**
+        * Reloads internal security settings modules according to the changes
+        * @since S60 3.2
+        */
+        void UpdateSecurityModeL();
+        
+    
+        /**
+        * Called from another CM-s CopyAdditionalDataL, on the passed 
+        * copied CM, and marks this as a copy of the original CM which 
+        * has an IAP ID of aBaseIapID
+        *
+        * @since S60 3.2
+        */
+        void SetAsCopyOf( TUint32 aBaseIapID );
+
+        /**
+        * Deletes the security settings related to this connection method.
+        *
+        * @since S60 3.2
+        */
+        void DeleteSecuritySettingsL();
+
+        
+        /**
+        * Set the EWlanIpDNSAddrFromServer according to the 
+        * current name server values.
+        *
+        * @since S60 3.2
+        */
+        void SetDnsIpFromServerL();
+
+
+        /**
+        * Set the EWlanIp6DNSAddrFromServer according to the 
+        * current name server values.
+        *
+        * @since S60 3.2
+        */
+        void SetDns6IpFromServerL();
+
+
+	    /**
+	    * Checks for coveradge and number of WLAN connections available
+        * @since S60 3.2
+        * @return The number of available WLAN network connections
+        */
+        TInt CheckNetworkCoverageL() const;
+
+
+	    /**
+	    * Converts security mode from TWlanConnectionSecurityMode to 
+        * TWlanSecMode
+        * @since S60 3.2
+        * @return The security mode as TWlanSecMode
+        */
+        CMManager::TWlanSecMode ConvertConnectionSecurityModeToSecModeL(
+                                    TWlanConnectionExtentedSecurityMode aSecurityMode );
+
+
+	    /**
+	    * Converts security mode from TWlanSecMode to 
+        * TWlanConnectionSecurityMode
+        * @since S60 3.2
+        * @return The security mode as TWlanConnectionSecurityMode
+        */
+        TWlanConnectionExtentedSecurityMode ConvertSecModeToConnectionSecurityModeL(
+                                    CMManager::TWlanSecMode aSecMode );
+
+        /**
+        * Destroy wait dialog 
+        */
+        void DestroyWaitDialog();
+
+
+        /**
+        * Sets the daemon name. Starts DHCP if set.
+        *
+        * @since S60 3.2
+        */
+        void SetDaemonNameL();
+
+
+        /**
+        * Converts the possible WLAN connection states from TWlanConnectionMode
+        * to TWlanNetMode.
+        * @since S60 3.2
+        * @return The WLAN connection mode as TWlanNetMode
+        */
+        CMManager::TWlanNetMode ConvertWLANConnectionStatesL( 
+                                    TWlanConnectionMode aConnectionMode );
+
+        WiFiProt::TWiFiReturn ProtectedSetupL(TWlanSsid& aSsid );
+
+        /*
+        * Triggers the pre-shared key for WAPI WLAN query
+        *
+        * @since S60 5.1
+        * @return ETrue if a selection was made, EFalse if cancelled
+        */
+        TBool EnterWAPIPreSharedKeyL();
+        
+	private: // Data
+
+        /**
+         * WLan service record
+         * Own
+         */         
+        CCDWlanServiceRecord* iWlanServiceRecord; // owned
+        
+        /**
+         * WLAN table id
+         */
+        CommsDat::TMDBElementId iWlanTableId;
+
+        /**
+         * WEP settings data
+         * Own
+         */
+        CWEPSecuritySettings* iWepSecSettings;
+        
+        /**
+         * WPA settings data
+         * Own
+         */
+        CWPASecuritySettings* iWpaSecSettings;
+        
+        /**
+         * Number of networks
+         */
+        TInt iWlanNetworks;
+        
+        /**
+         * Connection UI utilities pointer
+         * Own
+         */
+        CConnectionUiUtilities* iConnUiUtils; // owned
+
+        /**
+        * Signals that this connection method is a copy of another WLAN CM.
+        */
+        TBool iIsCopy;
+        
+        /**
+        * The IAP ID of the CM from which this copy had been made. 
+        */
+        TUint32 iCopiedFromIapId;
+
+        /**
+        * "Searching WLAN networks" wait dialog.
+        */
+        CAknWaitDialog* iWaitDialog;
+        
+        RArray<TUint32> iAdditionalCmsCreated;
+
+        /**
+         * Asked from the Feature manager at the constructor phase
+         */
+        TBool iIsWAPISupported;
+        
+        /**
+        * WAPI settings data
+        * Own
+        */
+        CWAPISecuritySettings* iWAPISecSettings;
+	};
+
+#endif // WLAN_PLUGIN_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginwlan/inc/cmpluginwlandata.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,127 @@
+/*
+* 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 WLAN data holder for WLAN plugin
+*
+*/
+
+#ifndef WLAN_DATA_H
+#define WLAN_DATA_H
+
+// INCLUDES
+#include    <e32base.h>
+
+
+/**
+* Possible values of SignalStrength of a network
+*/
+enum TSignalStrength
+    {
+    ESignalStrengthMax = 60,
+    ESignalStrengthGood = 74,
+    ESignalStrengthLow = 87,
+    ESignalStrengthMin = 100
+    };
+
+// FORWARD DECLARATION
+/*
+class CCDWlanServiceRecord;
+class CWEPSecuritySettings;
+class CWEPSecuritySettingsUi;
+class CWPASecuritySettings;
+class CWPASecuritySettingsUi;
+class RConeResourceLoader;
+class CConnectionUiUtilities;
+*/
+
+
+/**
+ *  WLAN Plugin data holder class
+ *
+ *  ?more_complete_description
+ *
+ *  @since S60 3.2
+ */
+NONSHARABLE_CLASS( CCmPluginWlanData ) : public CBase
+    {
+
+    public: // Constructors and destructor
+    
+        /**
+        * Two-phased constructor. Leaves on failure, places instance
+        * on cleanup stack.
+        *
+        * @since S60 3.2
+        * @return The constructed CCmPluginWlanData.
+        */
+        static CCmPluginWlanData* NewLC();
+    
+        /**
+        * Destructor
+        *
+        * @since S60 3.2
+        */
+        virtual ~CCmPluginWlanData();
+
+    protected:
+        /**
+        * Constructor
+        *
+        * @since S60 3.2
+        */
+        CCmPluginWlanData();
+
+
+        /**
+        * Second-phase constructor.
+        *
+        * @since S60 3.2
+        */
+        void ConstructL();
+        
+
+
+    public: // New functions
+    
+        /**
+        * Gives back the name of network (SSID)
+        *
+        * @since S60 3.2
+        * @return the name of network 
+        */
+//        HBufC* GetNameLC() const;
+
+        /**
+        * Gives back current SignalStrength
+        *
+        * @since S60 3.2
+        * @return iSignalStrength
+        */        
+//        TSignalStrength GetSignalStrength() const;
+        
+        
+	public: // Data
+
+        /**
+        * The name of network (from SSID)
+        */
+        HBufC*                              iNetworkName;
+        
+        /**
+        * Signale strength of network
+        */
+        TSignalStrength                     iSignalStrength;
+
+	};
+
+#endif // WLAN_DATA_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginwlan/inc/cmpluginwlandataarray.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,51 @@
+/*
+* 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 WLAN data holder array for WLAN plugin
+*
+*/
+
+#ifndef WLAN_DATA_ARRAY_H
+#define WLAN_DATA_ARRAY_H
+
+// INCLUDES
+#include    <e32base.h>
+
+class CCmPluginWlanData;
+
+/**
+ *  WLAN Plugin data holder class
+ *  A list of CCmPluginWlanData-s pointers; items are owned.
+ *
+ *  ?more_complete_description
+ *
+ *  @since S60 3.2
+ */
+NONSHARABLE_CLASS( CCmPluginWlanDataArray ) : public CArrayPtrFlat<CCmPluginWlanData>
+    {
+
+    public:  // Constructors and destructor
+
+        /**
+        * C++ default constructor.
+        */
+        CCmPluginWlanDataArray();
+
+        /**
+        * Destructor. Items in the list are destroyed.
+        */
+        virtual ~CCmPluginWlanDataArray();
+
+	};
+
+#endif // WLAN_DATA_ARRAY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginwlan/inc/cmpwlanactivewaiter.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,94 @@
+/*
+* 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:  Declaration of CCmPluginWlanActiveWaiter
+*
+*/
+
+
+
+#ifndef __WLAN_PLUGIN_ACTIVE_WAITER_H__
+#define __WLAN_PLUGIN_ACTIVE_WAITER_H__
+
+// INCLUDES
+#include <e32base.h>
+
+/**
+ * CCmPluginWlanActiveWaiter class,
+ * an active object to replace User::WaitForRequest
+ * 
+ * Usage:
+ * CCmPluginWlanActiveWaiter* waiter = CCmPluginWlanActiveWaiter::NewL();
+ * CleanupStack::PushL( waiter );
+ * server.AsyncFunction( waiter->iStatus );
+ * if ( waiter->WaitForRequest() == KErrNone )
+ *      {
+ *      // handle success
+ *      }
+ *      else 
+ *      {
+ *      // handle failure
+ *      }
+ * CleanupStack::PopAndDestroy( waiter );
+ * 
+ */     
+NONSHARABLE_CLASS( CCmPluginWlanActiveWaiter ) : public CActive
+    {
+    public:
+        /**
+        * NewL function
+        * @param  aPlugin a pointer to notifier plugin
+        */
+        static CCmPluginWlanActiveWaiter* NewL( );
+
+        /**
+        * Destructor
+        */    
+        virtual ~CCmPluginWlanActiveWaiter();          
+
+        /**
+        * Waits for it's TRequestStatus to be completed
+        * @return Error code returned from server after request is
+        * completed
+        */
+        TInt WaitForRequest( );
+        
+    protected:
+        /**
+        * ConstructL 
+        */
+        void ConstructL();
+    
+        /**
+        * Constructor
+        * @param  aPlugin a pointer to notifier plugin    
+        */    
+        CCmPluginWlanActiveWaiter();
+            
+        /**
+        * DoCancel from CActive
+        */    
+        virtual void DoCancel();
+      
+        /**
+        * RunL from CActive
+        */      
+        virtual void RunL();
+    
+    protected:
+        CActiveSchedulerWait iWait;
+    };     
+
+#endif // __WLAN_PLUGIN_ACTIVE_WAITER_H__
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginwlan/inc/cmpwlansettingsdlg.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,196 @@
+/*
+* 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:  Declares dialog for a wlan cm plugin view/edit
+*
+*/
+
+#ifndef CMPLUGINWLAN_SETTINGS_DLG_H
+#define CMPLUGINWLAN_SETTINGS_DLG_H
+
+// INCLUDES
+#include <mcmdexec.h>
+#include <cmpbasesettingsdlg.h>
+#include "cmcommsdatnotifier.h"
+
+// FORWARD DECLARATIONS
+class CCmPluginBaseEng;
+
+// CLASS DECLARATION
+/**
+* CmPluginWlanSettingsDlg dialog class
+*
+*/
+NONSHARABLE_CLASS( CmPluginWlanSettingsDlg ) : public CmPluginBaseSettingsDlg
+                                             , public MCmCommsDatWatcher
+                                             , public CCmParentViewNotifier
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Two-phase construction
+        *
+        * @since S60 3.2
+        * @param aCmPluginBaseEng  The connection method object to use
+        */
+        static CmPluginWlanSettingsDlg* NewL( 
+                                        CCmPluginBaseEng& aCmPluginBaseEng );
+
+        /**
+        * Destructor.
+        */
+        ~CmPluginWlanSettingsDlg();
+    
+    public: // from base class
+    
+        /**
+        * From CmPluginBaseSettingsDlg
+        * Create and launch dialog
+        *
+        * @since S60 3.2
+        * @return The code returned by the dialog's ExecuteLD
+        */
+        TInt ConstructAndRunLD( );
+    
+        /**
+        * From CmPluginBaseSettingsDlg
+        * Updates bearer specific listbox contents
+        *
+        * @since S60 3.2
+        * @param aItemArray item array containing the setting texts
+        */
+        void UpdateListBoxContentBearerSpecificL( CDesCArray& itemArray );
+                
+    public: // from class MCmCommsDatWatcher
+        
+        /**
+         * Watch changes in CommsDat
+         */
+        void CommsDatChangesL();
+        
+    public: // from class CCmParentViewNotifier
+        
+        void NotifyParentView( TInt aValue );
+        
+    private:
+    
+        /**
+        * C++ constructor
+        *
+        * @since S60 3.2
+        */        
+        CmPluginWlanSettingsDlg( CCmPluginBaseEng& aCmPluginBaseEng );
+
+
+    protected:
+        /** From CAknDialog */
+        TBool OkToExitL( TInt aButtonId );
+        
+    private: // from base class
+    
+        /**
+        * From MEikCommandObserver
+        * see base class for description
+        *
+        * @since S60 3.2
+        * @param aCommandId
+        */
+        void ProcessCommandL( TInt aCommandId ) ;    
+
+        // From CmPluginBaseSettingsDlg 
+        
+        /**
+        * From CmPluginBaseSettingsDlg 
+        * Determines which type of setting page should be shown
+        *
+        * @param aAttribute The setting to be changed by the setting page
+        * @param aCommandId The command the attribute is changed with (ok/change key pressed)
+        * @return the soft key selection
+        */  
+        TBool ShowPopupSettingPageL ( TUint32 aAttribute, TInt aCommandId  );
+
+        /**
+        * From CmPluginBaseSettingsDlg 
+        * launches the advances settings dialog
+        *
+        * @since S60 3.2
+        */
+        virtual void RunAdvancedSettingsL();
+
+        /**
+        * From CmPluginBaseSettingsDlg
+        * Get help contest of the plugin
+        *
+        * @since S60 5.0
+        */
+				virtual void GetHelpContext( TCoeHelpContext& aContext ) const;
+        
+    private:  // New functions
+        
+        /**
+        * Shows the bool setting page for a certain setting or
+        * simply changes the setting if ok key was pressed
+        *
+        * @since S60 3.2
+        * @param aAttribute The setting to be changed by the setting page
+        * @param aCommandId Command id, to make difference between ok and change commands
+        */  
+        void ChangeBoolSettingL( TUint32 aAttribute, TInt aCommandId );
+                
+        /**
+        * displays security setting page
+        *
+        * @since S60 3.2        
+        */  
+        void ShowSecurityModeRBPageL();    
+        
+        /**
+        * Shows network mode setting page
+        *
+        * @since S60 3.2
+        */  
+        void ShowNetworkModeRBPageL();
+        
+        /**
+        * Show the setting page for the WLAN Network Name settings
+        *
+        * @since S60 3.2
+        */
+        void ShowWlanNWNamePageL();
+        
+        /**
+        * Exits plugin settings if compulsory values are filled
+        *
+        * @since S60 3.2
+        * @param aConfirm ask user confirmation or not
+        */  
+        void ExitSettingsL( TBool aConfirm );
+        
+        void HandleCommsDatChangeL();
+    private:
+        TBool iSecDialExit;
+        
+        TInt iNotifyFromAdv;
+        
+    };
+
+
+/** WLAN Network name setting items - zero indexed for the ui */    
+enum TWlanNwName
+    {
+    EWlanNwNameUserDefined = 0, // radio button page commands
+    EWlanNwNameScan
+    };
+
+#endif // CMPLUGINWLAN_SETTINGS_DLG_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginwlan/inc/cmpwlansettingsdlgadv.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,180 @@
+/*
+* 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:  declares dialog for wlan cm plugin advanced view/edit.
+*
+*/
+
+#ifndef CMPLUGINWLANADV_SETTINGS_DLG_ADV_H
+#define CMPLUGINWLANADV_SETTINGS_DLG_ADV_H
+
+// INCLUDES
+#include <in_sock.h>
+#include <mcmdexec.h>
+#include <cmpbasesettingsdlgadv.h>
+#include "cmcommsdatnotifier.h"
+
+// FORWARD DECLARATIONS
+class CCmPluginBaseEng;
+
+/**
+ *  CmPluginWlanSettingsDlgAdv dialog class
+ *
+ *  shows the advanced WLAN settings
+ *
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CmPluginWlanSettingsDlgAdv ) : 
+                                            public CmPluginBaseSettingsDlgAdv ,
+                                            public MCmCommsDatWatcher ,
+                                            public CCmParentViewNotifier
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Two-phase construction
+        *
+        * @since S60 v3.2
+        * @param aCmPluginBaseEng
+        */
+        static CmPluginWlanSettingsDlgAdv* NewL( 
+                                        CCmPluginBaseEng& aCmPluginBaseEng );
+        /**
+        * Destructor.
+        */
+        ~CmPluginWlanSettingsDlgAdv();
+
+    public: // from base class
+
+        /**
+        * From CmPluginBaseSettingsDlg
+        * Create and launch dialog
+        *
+        * @since S60 v3.2
+        * @return The code returned by the dialog's ExecuteLD
+        */
+        TInt ConstructAndRunLD();
+        
+        /**
+        * From CmPluginBaseSettingsDlg
+        * Updates bearer specific listbox contents
+        *
+        * @since S60 v3.2
+        * @param aItemArray item array containing the setting texts
+        */
+        void UpdateListBoxContentBearerSpecificL( CDesCArray& itemArray );
+        
+    public:
+        
+        /**
+         * Record the object of parent view
+         */
+        void RegisterParentView( CCmParentViewNotifier* aParent );
+        
+    public: // from class MCmCommsDatWatcher
+        
+        /**
+         * Watch changes in CommsDat
+         */
+        void CommsDatChangesL();
+        
+    public: // from class CCmParentViewNotifier
+        
+        void NotifyParentView( TInt aValue );
+
+    private: // construction
+    
+        /**
+        * C++ constructor
+        */
+        CmPluginWlanSettingsDlgAdv( CCmPluginBaseEng& aCmPluginBaseEng );
+        
+    protected:
+        /** From CAknDialog */
+        TBool OkToExitL( TInt aButtonId );
+
+    private: // From MEikCommandObserver
+
+        /**
+        * From MEikCommandObserver
+        * see base class for description
+        *
+        * @since S60 3.2
+        * @param aCommandId
+        */
+        void ProcessCommandL( TInt aCommandId );
+
+    private: // From CmPluginBaseSettingsDlg 
+    
+        /**
+        * From CmPluginBaseSettingsDlg 
+        * Determines which type of setting page should be shown
+        *
+        * @param aAttribute The setting to be changed by the setting page
+        * @param aCommandId The command the attribute is changed with (ok/change key pressed)
+        * @return the soft key selection
+        */   
+        TBool ShowPopupSettingPageL( TUint32 aAttribute, TInt aCommandId );
+
+        TBool ShowIpv4SettingPageL();
+        
+        TBool ShowIpv6SettingPageL();
+        
+        /**
+        * Shows a radio button page for selecting the ad-hoc channel setting value
+        * If 'User defined' is selected a numeric query dialog is displayed for entering the 
+        * channel number
+        * 
+        * @since S60 3.2
+        * @return ETrue if the setting value has been changed
+        */
+        TBool ShowAdhocChannelSettingPageL();
+        
+        /**
+        * From CmPluginBaseSettingsDlg
+        * Collects the packet data specific setting information for 
+        * displaying
+        *
+        * @since S60 3.2
+        * @param aItemArray an array of setting information
+        */
+        TBool UpdateListBoxContentBearerSpecificL( TUint32 aAttribute );
+        
+        void HandleCommsDatChangeL();
+                
+    private:  // data
+
+        /**
+        * IPv6 supported indicator
+        */
+        TBool iIpv6Supported;
+        
+        CCmParentViewNotifier* iParent;
+        TInt iNotifyFromIp;
+    };
+
+/** menu commands for IPv setting pages */
+enum TWlanIpvMenuCommands
+    {
+    ESettingPageCmdIpv4,
+    ESettingPageCmdIpv6
+    };
+
+/** Adhoc channel setting values */
+enum TAdhocChannel
+    {
+    EAdhocAutomatic = 0, //radio button page commands
+    EAdhocUserDefined
+    };
+
+#endif // CMPLUGINWLANADV_SETTINGS_DLG_ADV_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginwlan/inc/cmpwlansettingsdlgipv4.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,157 @@
+/*
+* 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:  Declares dialog for wlan cm plugin ipv4 settings view/edit
+*
+*/
+
+#ifndef CMPLUGINWLANIPV4_SETTINGS_DLG_H
+#define CMPLUGINWLANIPV4_SETTINGS_DLG_H
+
+// INCLUDES
+#include <mcmdexec.h>
+#include <cmpbasesettingsdlgip.h>
+#include "cmcommsdatnotifier.h"
+
+// FORWARD DECLARATIONS
+class CCmPluginBaseEng;
+
+/**
+ *  CmPluginWlanSettingsDlgIpv4 dialog class
+ *
+ *  shows settings for WLAN IPv4
+ *
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CmPluginWlanSettingsDlgIpv4 ) : 
+                                            public CmPluginBaseSettingsDlgIp ,
+                                            public MCmCommsDatWatcher
+    {
+    public: // Constructors and destructor
+    
+        /**
+        * Two-phase construction
+        * @since S60 v3.2
+        * @param aCmPluginBaseEng
+        */
+        static CmPluginWlanSettingsDlgIpv4* NewL(
+                                        CCmPluginBaseEng& aCmPluginBaseEng );
+
+        /**
+        * Destructor.
+        */
+        ~CmPluginWlanSettingsDlgIpv4();
+
+    public: // from base class
+
+        /**
+        * From CmPluginBaseSettingsDlg
+        * Create and launch dialog
+        *
+        * @since S60 v3.2
+        * @return The code returned by the dialog's ExecuteLD
+        */
+        TInt ConstructAndRunLD();
+        
+        /**
+        * From CmPluginBaseSettingsDlg
+        * Updates bearer specific listbox contents
+        *
+        * @since S60 v3.2
+        * @param aItemArray item array containing the setting texts
+        */
+        void UpdateListBoxContentBearerSpecificL( CDesCArray& itemArray );
+        
+    public:
+        
+        /**
+         * Record the object of parent view
+         */
+        void RegisterParentView( CCmParentViewNotifier* aParent );
+        
+    public: // from class MCmCommsDatWatcher
+        
+        /**
+         * Watch changes in CommsDat
+         */
+        void CommsDatChangesL();
+
+    protected:
+    
+        /** From CAknDialog */
+        TBool OkToExitL( TInt aButtonId );
+
+    private: // construction
+        
+        /**
+        * C++ constructor
+        */
+        CmPluginWlanSettingsDlgIpv4( CCmPluginBaseEng& aCmPluginBaseEng );
+        
+    private: // From MEikCommandObserver
+
+        /**
+        * From MEikCommandObserver
+        * see base class for description
+        *
+        * @since S60 3.2
+        * @param aCommandId
+        */
+        void ProcessCommandL( TInt aCommandId );
+        
+    private: // From CmPluginBaseSettingsDlg         
+
+        /**
+        * From CmPluginBaseSettingsDlg 
+        * Determines which type of setting page should be shown
+        *
+        * @param aAttribute The setting to be changed by the setting page
+        * @param aCommandId The command the attribute is changed with (ok/change key pressed)
+        * @return the soft key selection
+        */ 
+        TBool ShowPopupSettingPageL ( TUint32 aAttribute, TInt aCommandId  );
+
+        /**
+        * From CmPluginBaseSettingsDlg
+        * Collects the packet data specific setting information for 
+        * displaying
+        *
+        * @since S60 3.2
+        * @param aItemArray an array of setting information
+        */
+        TBool UpdateListBoxContentBearerSpecificL( TUint32 aAttribute );
+        
+    private:  // New functions
+
+        /**
+        * Checks the temp attributes, saves them if necessary,
+        * prompts user if there are incomplete values 
+        *
+        * @since S60 v3.2
+        * @return ETrue if success
+        */
+        TBool ValidateAttribsL();
+        
+        /**
+        * Text intialisation
+        *
+        * @since S60 v3.2
+        */
+        void InitTextsL();
+        
+    private:
+        
+        CCmParentViewNotifier* iParent;
+    };
+
+#endif // CMPLUGINWLANIPV4_SETTINGS_DLG_ADV_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginwlan/inc/cmpwlansettingsdlgipv6.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,158 @@
+/*
+* 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:  Declares dialog for wlan cm plugin ipv6 settings view/edit
+*
+*/
+
+#ifndef CMPLUGINWLANIPV6_SETTINGS_DLG_H
+#define CMPLUGINWLANIPV6_SETTINGS_DLG_H
+
+// INCLUDES
+#include <mcmdexec.h>
+#include <cmpbasesettingsdlgip.h>
+#include "cmcommsdatnotifier.h"
+
+// FORWARD DECLARATIONS
+class CCmPluginBaseEng;
+
+/**
+ *  CmPluginWlanSettingsDlgIpv6 dialog class
+ *
+ *  shows settings for WLAN IPv6
+ *
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CmPluginWlanSettingsDlgIpv6 ) : 
+                                            public CmPluginBaseSettingsDlgIp ,
+                                            public MCmCommsDatWatcher
+    {
+    public: // Constructors and destructor
+        
+        /**
+        * Two-phase construction.
+        * @param aCmPluginBaseEng  wlan plugin to edit
+        */
+        static CmPluginWlanSettingsDlgIpv6* NewL( 
+                                        CCmPluginBaseEng& aCmPluginBaseEng );
+
+        /**
+        * Destructor.
+        */
+        ~CmPluginWlanSettingsDlgIpv6();
+        
+    public: // from base class
+
+        /**
+        * From CmPluginBaseSettingsDlg
+        * Create and launch dialog
+        *
+        * @since S60 v3.2
+        * @return The code returned by the dialog's ExecuteLD
+        */
+        TInt ConstructAndRunLD();
+
+    public: // From CmPluginBaseSettingsDlg
+
+        /**
+        * From CmPluginBaseSettingsDlg
+        * Updates bearer specific listbox contents
+        *
+        * @since S60 v3.2
+        * @param aItemArray item array containing the setting texts
+        */
+        void UpdateListBoxContentBearerSpecificL( CDesCArray& itemArray );
+        
+    public:
+        
+        /**
+         * Record the object of parent view
+         */
+        void RegisterParentView( CCmParentViewNotifier* aParent );
+        
+    public: // from class MCmCommsDatWatcher
+        
+        /**
+         * Watch changes in CommsDat
+         */
+        void CommsDatChangesL();
+
+    protected:
+    
+        /** From CAknDialog */
+        TBool OkToExitL( TInt aButtonId );
+                
+    private: // construction
+    
+        CmPluginWlanSettingsDlgIpv6( CCmPluginBaseEng& aCmPluginBaseEng );
+
+    private: // From MEikCommandObserver
+
+        /**
+        * From MEikCommandObserver
+        * see base class for description
+        *
+        * @since S60 3.2
+        * @param aCommandId
+        */
+        void ProcessCommandL( TInt aCommandId );
+
+    private: // From CmPluginBaseSettingsDlg
+
+        /**
+        * From CmPluginBaseSettingsDlg 
+        * Determines which type of setting page should be shown
+        *
+        * @param aAttribute The setting to be changed by the setting page
+        * @param aCommandId The command the attribute is changed with (ok/change key pressed)
+        * @return the soft key selection
+        */ 
+        TBool ShowPopupSettingPageL ( TUint32 aAttribute, TInt aCommandId );
+
+        /**
+        * From CmPluginBaseSettingsDlg
+        * Collects the packet data specific setting information for 
+        * displaying
+        *
+        * @since S60 3.2
+        * @param aItemArray an array of setting information
+        */
+        TBool UpdateListBoxContentBearerSpecificL( TUint32 aAttribute );
+        
+    private: // new functions
+    
+        /**
+        * Text intialisation
+        *
+        * @since S60 v3.2
+        */
+        void InitTextsL();
+        
+    private:
+        
+        CCmParentViewNotifier* iParent;
+        
+        TBool iIspossibleExit;
+        TBool iExitImediate;
+    };
+
+/** IPv6 types */
+enum TIpv6DNSTypes
+    {
+    EIpv6DNSDynamic = 0, //radio button page commands
+    EIpv6DNSWellKnown,
+    EIpv6DNSUserDefined
+    };
+
+
+#endif // CMPLUGINWLANIPV6_SETTINGS_DLG_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginwlan/inc/cmwlancommonconstants.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,37 @@
+/*
+* 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:  commonly used constants for the WLAN plugin
+*
+*/
+
+#ifndef CMWLANCOMMONCONSTANTS_H
+#define CMWLANCOMMONCONSTANTS_H
+
+// CONSTANTS
+_LIT( KPluginWlanResDirAndFileName, "z:cmwlanui.rsc" );
+_LIT( KEmptyAddress, "http://" );
+
+/// 'Dynamic' IP address to use in comparisons
+_LIT( KDynIpAddress, "0.0.0.0" );
+
+_LIT( KDynIpv6Address, "0:0:0:0:0:0:0:0" );
+
+const TInt KCmArrayGranularity = 10;
+const TInt KCmAdhocChannelMaxLength = 2;
+const TInt KCmAdhocChannelMinValue = 1;
+const TInt KCmAdhocChannelDefaultValue = 7;
+const TInt KCmAdhocChannelMaxValue = 11;
+const TInt KCmWlanNWNameMaxLength = 32;
+
+#endif  // CMWLANCOMMONCONSTANTS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginwlan/inc/cmwlancoveragecheck.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,99 @@
+/*
+* 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 WLAN Coverage Check class
+*
+*/
+
+#ifndef CMWLANCOVERAGECHECK_H
+#define CMWLANCOVERAGECHECK_H
+
+// INCLUDES
+#include <e32base.h>
+#include <cmpluginwlandef.h>
+
+
+// FORWARD DECLARATION
+class CCmPluginWlanDataArray;
+ 
+using namespace CMManager;
+
+/**
+ *  WLAN Coverage Check
+ *
+ *  ?more_complete_description
+ *
+ *  @since S60 3.2
+ */
+class CCmWlanCoverageCheck : public CActive
+    {
+    enum EWlanCoverageState
+        {
+        EServiceStatus,
+        EScanning,
+        EDone,                        
+        };
+        
+    public:
+    
+        CCmWlanCoverageCheck();
+        ~CCmWlanCoverageCheck();
+        
+        TInt GetCoverageL();
+
+        TBool ScanForPromptedSsidL( TWlanSsid aEnteredSsid, TBool aBroadcast,
+                                TWlanNetMode& aNetworkMode,
+                                TWlanConnectionExtentedSecurityMode& aSecurityMode,
+                                TBool& aProtectedSetupSupported );
+
+        /**
+        * Returns whether the passed ssid and length results in a hidden or 
+        * a non-hidden ssid.
+        *
+        * @since S60 3.2
+        * @param aSsidLength The length of the ssid
+        * @param aSsid The ssid
+        * @return ETrue if the ssid is hidden.
+        */
+        TBool IsHiddenSsid( TUint aSsidLength, const TUint8* aSsid ) const;
+        
+        /**
+        * Adds the passed WLAN network data to the container array
+        * if it is not already there, and sets the highest signal 
+        * strength if it is already in the array.
+        *
+        * @since S60 3.2
+        * @param aArray The array to be checked
+        * @param aRXLevel The signal level of this WLAN
+        * @param aNetworkName The network name (SSID) of this WLAN.
+        */
+        void AddToArrayIfNeededL( 
+                            CCmPluginWlanDataArray& aArray, 
+                            TInt aRXLevel, 
+                            TDesC& aNetworkName ) const;
+                
+                
+    protected:  // from CActive
+    
+        virtual void DoCancel();
+        virtual void RunL();
+
+    private:
+
+        TUint32                 iProgState;
+        TInt                    iCoverage;
+        CActiveSchedulerWait    iWait;    
+    };
+
+
+#endif // CMWLANCOVERAGECHECK_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginwlan/loc/cmpluginwlan.loc	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,389 @@
+/*
+* 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 project cmpluginwlan
+*
+*/
+
+
+//  LOCALISATION STRINGS
+
+//d: Name of wlan bearer type shown in a list of supported bearers.
+//l: list_single_graphic_pane_t1_cp2
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_bearer_supported_wlan "Wireless LAN"
+
+//d: First line of a double large graphic style listbox - wlan specific
+//l: list_double_large_graphic_pane_t1_cp2
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_bearer_available_wlan "Wireless LAN"
+
+//d: Second line of a double large graphic style listbox - wlan specific
+//l: list_double_large_graphic_pane_t2_cp2
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_one_wlan_nw_available "1 network available"
+
+//d: Second line of a double large graphic style listbox - wlan specific
+//l: list_double_large_graphic_pane_t2_cp2
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_many_wlan_nw_available "%N networks available"
+
+// Setting list items
+
+//d:Item text in setting list. "The WLAN network name"
+//l:list_setting_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_wlan_sett_network_name "WLAN network name"
+
+
+//d: Text shown in a text query dialog for the WLAN network name setting
+//d: user defined value
+//l: heading_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_wlan_prmpt_network_name "WLAN network name:"
+
+//d:Item text in setting list "Network status"
+//l:list_setting_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_wlan_sett_hidden_network "Network status"
+
+//d:Item text in setting list "WLAN network mode"
+//l:list_setting_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_wlan_sett_network_mode "WLAN network mode"
+
+//d:Item text in setting list "WLAN security mode"
+//l:list_setting_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_wlan_sett_security_mode "WLAN security mode"
+
+//d:Item text in setting list "WLAN security settings"
+//l:list_setting_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_wlan_sett_security_settings "WLAN security settings"
+
+// Setting list options and/or default values
+
+//d:Defines if the WLAN network name (SSID) is not hidden
+//l:list_set_graphic_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_wlan_sett_hidden_network_no "Public"
+
+//d:Defines if the WLAN network name (SSID) is  hidden (Default)
+//l:list_set_graphic_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_wlan_sett_hidden_network_yes "Hidden"
+
+//d:Default value for WLAN network mode
+//l:list_set_graphic_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_wlan_sett_network_mode_infra "Infrastructure"
+
+//d: Title of the Network mode dialog
+//d: in the manual configuration of a new WLAN connection method
+//l: heading_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_netw_conset_prmpt_wlan_nw_mode_and_status "Network mode and status:"
+
+//d:Network mode selection list, sets the network mode setting 
+//d:to 'infrastructure' and network status to 'Public'
+//l:list_single_pane_t1_cp2
+//w:
+//r:3.2
+//
+#define qtn_wlan_network_mode_infra_public "Infrastructure (public)"
+
+//d:Network mode selection list, sets the network mode setting 
+//d:to 'infrastructure' and network status to 'hidden'
+//l:list_single_pane_t1_cp2
+//w:
+//r:3.2
+//
+#define qtn_wlan_network_mode_infra_hidden "Infrastructure (hidden)"
+
+//d:Network mode selection list, sets the network mode setting 
+//d:to 'Ad-hoc' and network status to 'Public'
+//l:list_single_pane_t1_cp2
+//w:
+//r:3.2
+//
+#define qtn_wlan_network_mode_adhoc_public "Ad-hoc (public)"
+
+//d:Network mode selection list, sets the network mode setting 
+//d:to 'Ad-hoc' and network status to 'Hidden'
+//l:list_single_pane_t1_cp2
+//w:
+//r:3.2
+//
+#define qtn_wlan_network_mode_adhoc_hidden "Ad-hoc (hidden)"
+
+//d:Default value for WLAN security mode
+//l:list_set_graphic_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_wlan_sett_security_mode_open "Open network"
+
+//d:Security settings mode "WEP"
+//l:list_set_graphic_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_wlan_sett_security_mode_wep "WEP"
+
+//d:Security settings mode "802.1x"
+//l:list_set_graphic_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_wlan_sett_security_mode_802_1x "802.1x"
+
+//d:Security settings mode "WPA/WPA2"
+//l:list_set_graphic_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_wlan_sett_security_mode_wpa "WPA/WPA2"
+
+//d:Security settings mode "WAPI"
+//l:list_set_graphic_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_wlan_sett_security_mode_wapi "WAPI"
+
+//d: Title of the Security Mode selection dialog
+//d: in the manual configuration of a new WLAN connection method
+//l: heading_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_netw_conset_prmpt_wlan_nw_security_mode "Security Mode:"
+
+//d:Default value for WLAN security mode
+//l:list_single_pane_t1_cp2
+//w:
+//r:3.2
+//
+#define qtn_netw_conset_wlan_security_mode_open "Open network"
+
+//d:Security settings mode "WEP"
+//l:list_single_pane_t1_cp2
+//w:
+//r:3.2
+//
+#define qtn_netw_conset_wlan_security_mode_wep "WEP"
+
+//d:Security settings mode "802.1x"
+//l:list_single_pane_t1_cp2
+//w:
+//r:3.2
+//
+#define qtn_netw_conset_wlan_security_mode_802_1x "802.1x"
+
+//d:Security settings mode "WPA/WPA2"
+//l:list_single_pane_t1_cp2
+//w:
+//r:3.2
+//
+#define qtn_netw_conset_wlan_security_mode_wpa "WPA/WPA2"
+
+//d: Title of the WPA/WPA2 mode selection dialog in the manual
+//d: configuration of a new WLAN connection method
+//l: heading_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_netw_conset_prmpt_wlan_wpa_mode "WPA/WPA2 mode:"
+
+//d:EAP item in the WPA/WPA2 mode selection dialog
+//l:list_single_pane_t1_cp2
+//w:
+//r:3.2
+//
+#define qtn_netw_conset_prmpt_wpa_mode_eap "EAP"
+
+//d:Pre-shared item item in the WPA/WPA2 mode selection dialog
+//l:list_single_pane_t1_cp2
+//w:
+//r:3.2
+//
+#define qtn_netw_conset_prmpt_wpa_mode_psk "Pre-shared key"
+
+//d: Note to indicate to user that the default EAP values have
+//d: been set and advanced values can be edited in the 
+//d: security settings of the connection method
+//l: popup_note_window
+//w:
+//r:3.2
+//
+#define qtn_netw_conset_info_eap_settings_default "Default EAP values set. Configure advanced settings by editing the method."
+
+//d:Specifies that the WLAN network name is user defined
+//l:list_set_graphic_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_wlan_sett_network_name_user_defined "User defined"
+
+
+//d:Specifies that the WLAN network name is selected from a scanned list
+//l:list_set_graphic_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_wlan_sett_network_name_scan "Scan for networks"
+
+
+//d:Specifies that the network mode is Ad-hoc
+//l:list_set_graphic_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_wlan_sett_network_mode_adhoc "Ad-hoc"
+
+//d:Setting item text for Ad-hoc channel.
+//l:list_setting_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_wlan_sett_adhoc_channel "Ad-hoc channel"
+
+//d:Title in a numeric query dialog for the ad-hoc channel setting value
+//l: popup_query_data_window
+//w:
+//r:3.2
+//
+#define qtn_wlan_prmpt_adhoc_channel "Ad-hoc channel:"
+
+//d:Defines the ad-hoc channel to be automatic
+//l:list_set_graphic_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_wlan_sett_adhoc_channel_automatic "Automatic"
+
+
+//d:Defines the ad-hoc channel to be user defined
+//l:list_set_graphic_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_wlan_sett_adhoc_channel_user_defined "User defined"
+
+//d: wlan plugin info note text shown when user tries to edit
+//d: security settings for open network
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_wlan_info_no_security_settings "No security settings for ’Open network’"
+
+//d: Data bearer of the highlighted connection method.
+//l: popup_preview_text_window_t1
+//w:
+//r: 3.2
+#define qtn_netw_conset_popup_bearer_wlan "Wireless LAN"
+
+//d: Connection method settings query text 
+//d: displayed when network name is not defined 
+//d: and user presses 'back' from settings view 
+//l: popup_note_window
+//w:
+//r: 3.2
+//
+#define qtn_wlan_quest_nw_name_not_defined "Incomplete details. WLAN network name must be defined. Delete access point?"
+
+//d: Connection method settings query text 
+//d: displayed when security settings are empty 
+//d: and user presses 'back' from settings view 
+//l: popup_note_window
+//w:
+//r: 3.2
+//
+#define qtn_wlan_quest_security_settings_empty "Security settings for the selected security mode are incomplete. Delete access point?"
+
+//d: Name of the data bearer used when accessing external network.
+//l: list_set_graphic_pane_t1
+//w:
+//r: 3.2
+#define qtn_wlan_sett_bearer_wlan "Wireless LAN"
+
+
+//d:Item text in setting list "WLAN base station selection"
+//l:list_setting_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_wlan_sett_ssid_roaming "WLAN base station selection"
+
+
+//d:Value for WLAN base station selection, allows roaming
+//l:list_set_graphic_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_wlan_sett_ssid_roaming_enabled "Roam to best"
+
+
+//d:Value for WLAN base station selection, disallows roaming
+//l:list_set_graphic_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_wlan_sett_ssid_roaming_disabled "Stay in first"
+
+
+//d:Wait note during scanning of wlan networks
+//l:popup_note_wait_window
+//w:
+//r:3.2
+//
+#define qtn_wlan_wait_searching_networks         "Searching WLAN networks"
+
+
+//d:"Search for WLAN" - information note
+//l:popup_note_window
+//w:
+//r:3.0
+//
+#define qtn_wlan_info_no_networks_found         "No WLAN networks found"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginwlan/src/cmpluginwlan.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,2851 @@
+/*
+* 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 WLAN Plugin interface implementation 
+*                for WLAN Bearer
+*
+*/
+
+
+#include <commdb.h>
+#include <ecom/ecom.h>		// For REComSession
+#include <f32file.h>    // for TParse
+#include <StringLoader.h>
+#include <data_caging_path_literals.hrh>
+#include <ConnectionUiUtilities.h>
+
+#include <cmpluginbaseeng.h>
+#include <cmpluginlanbase.h>
+#include <mcmdexec.h>
+#include <cmpbasesettingsdlg.h>
+#include <cmpluginwlan.mbg>
+#include <cmwlanui.rsg>
+#include <cmmanager.rsg>
+#include <cmcommonui.h>
+#include <wlancontainer.h>
+
+#include <WEPSecuritySettingsUI.h>
+#include <WPASecuritySettingsUI.h>
+#include <featmgr.h>
+#include <ConeResLoader.h>
+#include <AknWaitDialog.h>
+#include <uikon/eiksrvui.h>
+#include <AknGlobalNote.h>
+
+#include "cmwlancommonconstants.h"
+#include "cmpluginwlan.h"
+#include "cmwlancoveragecheck.h"
+#include "cmlogger.h"
+#include "cmpwlansettingsdlg.h"
+#include <cmpluginwlandef.h>
+#include <cmcommonconstants.h>
+#include "cmmanagerimpl.h"
+#include "cmpwlanactivewaiter.h"
+
+#include <wifiprotuiinprocess.h>
+
+using namespace CMManager;
+
+#include "wapisecuritysettingsui.h"
+
+// CONSTANTS
+const TUint32 KDefaultPriorityWLan = 0;
+
+const TInt KWlanSingleNetwork = 1; // Number of WLAN networks is 1
+const TInt KWlanMaxKeyLength = 64;
+const TInt KWlanLastSocketActivityTimeout = -1;
+const TInt KWlanLastSessionClosedTimeout = 1;
+const TInt KWlanLastSocketClosedTimeout = -1;
+const TUint32 KEndOfArray = KMaxTUint;
+
+/// Modem bearer names for WLAN connection methods
+_LIT( KModemBearerWLAN, "WLANBearer" );
+
+_LIT( KWlanFileIcons, "z:cmpluginwlan.mbm" );
+_LIT( KWlanBearerName, "WLANBearer" );
+_LIT( KWlanBearerAgent, "wlanagt.agt" );
+_LIT( KWlanBearerNif, "wlannif" );
+
+_LIT( KWlanLDDName, "not used" );
+_LIT( KWlanPDDName, "not used" );
+
+static const TCmAttribConvTable SWlanConvTbl[] = 
+    {
+    // iAttribId, iCommsDatId, iValidFuncL, 
+    // iTitleId, 
+    // iMaxLength, iAttribFlags, iDefValueResId, iEditorResId, iNotUsed1, iNotUsed2
+    { EWlanServiceId,           EWlanRangeMax,          NULL },        
+    { EWlanServiceId,           KCDTIdWlanServiceId,    NULL },
+    { EWlanConnectionMode,      KCDTIdWlanConnMode,     NULL,
+      R_QTN_WLAN_SETT_NETWORK_MODE,
+       },
+    { EWlanSSID,                KCDTIdWlanSSID,         NULL,
+      R_QTN_WLAN_SETT_NETWORK_NAME,
+      KCmWlanNWNameMaxLength, EConvCompulsory | EConvNoZeroLength, R_QTN_SELEC_SETTING_COMPULSORY, R_TEXT_SETTING_PAGE_NETW_NAME, NULL, NULL },
+    { EWlanUsedSSID,            KCDTIdWlanUsedSSID,     NULL },
+    { EWlanSecurityMode,        KCDTIdWlanSecMode,      NULL,
+      R_QTN_WLAN_SETT_SECURITY_MODE,
+      0, 0, 0, 0, NULL, NULL },
+    { EWlanAuthenticationMode,  KCDTIdWlanAuthMode,     NULL },
+    { EWlanScanSSID,            KCDTIdWlanScanSSID,     NULL,
+      R_QTN_WLAN_SETT_HIDDEN_NETWORK,
+      0, 0, 0, 0, NULL, NULL },
+    { EWlanChannelID,           KCDTIdWlanChannelID,    NULL,
+      R_QTN_WLAN_SETT_ADHOC_CHANNEL,
+      KCmAdhocChannelMaxLength, EConvNumber, R_QTN_WLAN_SETT_ADHOC_CHANNEL_AUTOMATIC, 0, NULL, NULL },   
+    { EWlanAllowSSIDRoaming,  KCDTIdWlanAllowSSIDRoaming,     NULL, 
+      R_QTN_WLAN_SETT_SSID_ROAMING,
+      0, 0, 0, 0, NULL, NULL },
+    { 0,0 }
+    };
+
+
+static const TCmCommonAttrConvArrayItem SCommonConvTbl[] =
+{
+    { EWlanIfNetworks, ECmIFNetworks },
+    { EWlanIpNetMask, ECmIPNetmask },
+    { EWlanIpGateway, ECmIPGateway },
+    { EWlanIpAddrFromServer, ECmIPAddFromServer },
+    { EWlanIpAddr, ECmIPAddress },
+    { EWlanIpDNSAddrFromServer, ECmIPDNSAddrFromServer },
+    { EWlanIpNameServer1, ECmIPNameServer1 },
+    { EWlanIpNameServer2, ECmIPNameServer2 },
+    { EWlanIp6DNSAddrFromServer, ECmIP6DNSAddrFromServer },
+    { EWlanIp6NameServer1, ECmIP6NameServer1 },
+    { EWlanIp6NameServer2, ECmIP6NameServer2 },
+    { EWlanIpAddrLeaseValidFrom, ECmIPAddrLeaseValidFrom },
+    { EWlanIpAddrLeaseValidTo, ECmIPAddrLeaseValidTo },
+    { EWlanConfigDaemonManagerName, ECmConfigDaemonManagerName },
+    { EWlanConfigDaemonName, ECmConfigDaemonName },
+    { 0, 0 }
+    };
+
+
+/**
+ * struct for security mode conversion table
+ */
+typedef struct
+    {
+    TUint32 iSecurityMode;
+    TUint32 iNWModeSelectionDlgIndex;
+    TUint32 iRBSettingPageIndex;
+    TUint32 iResId;
+    } TCmSecurityModeConvTable;
+
+/**
+ * Conversion table for the correct positioning of WLAN security types 
+ * in WLAN UI components
+ */  
+const TCmSecurityModeConvTable KWlanSecurityModeConvTable[] =
+    {                              
+        { EWlanSecModeOpen,   0, 0, R_QTN_NETW_CONSET_WLAN_SECURITY_MODE_OPEN   },
+        { EWlanSecModeWep,    1, 1, R_QTN_NETW_CONSET_WLAN_SECURITY_MODE_WEP    },
+        { EWlanSecMode802_1x, 2, 2, R_QTN_NETW_CONSET_WLAN_SECURITY_MODE_802_1X },
+        { EWlanSecModeWpa,    3, 3, R_QTN_NETW_CONSET_WLAN_SECURITY_MODE_WPA    },
+     // { EWlanSecModeWpa2,   3, 3, R_QTN_NETW_CONSET_WLAN_SECURITY_MODE_WPA2   },
+        { EWlanSecModeWAPI,   4, 4, R_QTN_WLAN_SETT_SECURITY_MODE_WAPI   },
+        { KEndOfArray, KEndOfArray, KEndOfArray, KEndOfArray }
+    };
+
+/**
+ * struct for the network mode conversion table
+ */
+typedef struct
+    {
+    TUint32 iNwMode;
+    TBool   iHidden;
+    TUint32 iResId;
+    } TCmNetworkModeConvTable;
+
+/**
+ * Conversion table for the correct positioning of WLAN network modes
+ */
+const TCmNetworkModeConvTable KWlanNetworkModeConvTable[] =
+    {
+        { EInfra, EFalse, R_QTN_WLAN_NETWORK_MODE_INFRA_PUBLIC }, // Infrastructure (public)
+        { EInfra, ETrue,  R_QTN_WLAN_NETWORK_MODE_INFRA_HIDDEN }, // Infrastructure (hidden)
+        { EAdhoc, EFalse, R_QTN_WLAN_NETWORK_MODE_ADHOC_PUBLIC }, // Ad-hoc (public)
+//        { EAdhoc, ETrue,  R_QTN_WLAN_NETWORK_MODE_ADHOC_HIDDEN }, // Ad-hoc (hidden)
+        { KEndOfArray, EFalse, KEndOfArray }
+    };
+
+// ======================= MEMBER FUNCTIONS =================================
+
+// --------------------------------------------------------------------------
+// CCmPluginWlan::NewL
+// --------------------------------------------------------------------------
+//
+CCmPluginWlan* CCmPluginWlan::NewL( TCmPluginInitParam* aInitParam )
+    {
+    if ( !FeatureSupported( KFeatureIdProtocolWlan ) )
+        {
+        User::Leave( KErrNotSupported );
+        }
+        
+    CCmPluginWlan* self = new( ELeave ) CCmPluginWlan( aInitParam );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CCmPluginWlan::~CCmPluginWlan
+// --------------------------------------------------------------------------
+//
+CCmPluginWlan::~CCmPluginWlan()
+    {
+    AdditionalReset();
+    DestroyWaitDialog();
+    RemoveResourceFile( KPluginWlanResDirAndFileName );    
+    delete iConnUiUtils; iConnUiUtils = NULL;
+    
+    iAdditionalCmsCreated.Close();
+
+    CLOG_CLOSE;
+    }
+
+// --------------------------------------------------------------------------
+// CCmPluginWlan::CreateInstanceL
+// --------------------------------------------------------------------------
+//
+CCmPluginBaseEng* CCmPluginWlan::CreateInstanceL( TCmPluginInitParam& aInitParam ) const
+    {
+    CCmPluginWlan* self = new( ELeave ) CCmPluginWlan( &aInitParam );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+    
+// --------------------------------------------------------------------------
+// CCmPluginWlan::CCmPluginWlan
+// --------------------------------------------------------------------------
+//
+CCmPluginWlan::CCmPluginWlan( TCmPluginInitParam* aInitParam )
+    : CCmPluginLanBase( aInitParam )
+    {
+    CLOG_CREATE;
+    iWlanTableId = 0;
+    iBearerType = KUidWlanBearerType;
+    }
+
+// --------------------------------------------------------------------------
+// CCmPluginWlan::ConstructL
+// --------------------------------------------------------------------------
+//
+void CCmPluginWlan::ConstructL()
+    {
+    LOGGER_ENTERFN( "CCmPluginWlan::ConstructL" );
+    
+    CCmPluginLanBase::ConstructL();
+
+    iBearerRecName = KModemBearerWLAN;
+    
+    // get WLAN table id
+    TRAP_IGNORE( iWlanTableId = CCDWlanServiceRecord::TableIdL( Session() ) );
+
+    if( !iWlanTableId )
+        {
+        iWlanTableId = CCDWlanServiceRecord::CreateTableL( Session() );
+
+        TMDBElementId tableId = 0;
+
+        TRAP_IGNORE( tableId = CCDWlanDeviceSettingsRecord::TableIdL( Session() ) );
+        if( !tableId )
+            {
+            CCDWlanDeviceSettingsRecord::CreateTableL( Session() );
+            }
+        
+        TRAP_IGNORE( tableId = CCDWLANSecSSIDTable::TableIdL( Session() ) );
+        if( !tableId )
+            {
+            CCDWLANSecSSIDTable::CreateTableL( Session() );
+            }
+
+        TRAP_IGNORE( tableId = CCDDestNWTable::TableIdL( Session() ) );
+        if( !tableId )
+            {
+            CCDDestNWTable::CreateTableL( Session() );
+            }
+        }
+
+    AddResourceFileL( KPluginWlanResDirAndFileName );
+    
+    AddConverstionTableL( ( CCDRecordBase** )&iWlanServiceRecord, 
+                            NULL, 
+                            SWlanConvTbl );
+    AddCommonConversionTableL( SCommonConvTbl );
+    
+    iIsWAPISupported = FeatureManager::FeatureSupported( KFeatureIdFfWlanWapi );
+    }
+    
+	
+// --------------------------------------------------------------------------
+// CCmPluginWlan::GetIntAttributeL
+// --------------------------------------------------------------------------
+//
+TUint32 CCmPluginWlan::GetIntAttributeL( const TUint32 aAttribute ) const
+    {
+    LOGGER_ENTERFN( "CCmPluginWlan::GetIntAttributeL" );
+    
+    TInt retval;
+    switch ( aAttribute )
+        {
+        case ECmExtensionLevel:
+            {
+    	    retval = CCmPluginLanBase::GetIntAttributeL( aAttribute );
+    	    retval++;
+            break;
+            }        
+        case ECmBearerIcon:
+            {
+            TAknsItemID id;
+            MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
+                   
+            TParse mbmFile;
+            User::LeaveIfError( mbmFile.Set( KWlanFileIcons, 
+                                &KDC_BITMAP_DIR,
+                                NULL ) );
+
+            // default - WLAN icon
+            TInt icon = EMbmCmpluginwlanQgn_prop_wlan_bearer;
+            TInt mask = EMbmCmpluginwlanQgn_prop_wlan_bearer_mask;
+            
+            // Easy WLAN icon
+            TUint32 easyWlanId = iCmMgr.EasyWlanIdL();
+            if ( easyWlanId && GetIntAttributeL( ECmId ) == easyWlanId )
+                {
+                icon = EMbmCmpluginwlanQgn_prop_set_conn_wlan_easy;
+                mask = EMbmCmpluginwlanQgn_prop_set_conn_wlan_easy_mask;
+                }
+            
+            retval = (TUint32)AknsUtils::CreateGulIconL( 
+                                skinInstance, 
+                                id,
+                                mbmFile.FullName(), 
+                                icon, 
+                                mask );
+            break;
+            }  
+        case ECmBearerAvailableIcon:
+            {
+            TAknsItemID id;
+            MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
+                   
+            TParse mbmFile;
+            User::LeaveIfError( mbmFile.Set( KWlanFileIcons, 
+                                &KDC_BITMAP_DIR,
+                                NULL ) );
+
+            retval = (TUint32)AknsUtils::CreateGulIconL( 
+                                skinInstance, 
+                                id,
+                                mbmFile.FullName(), 
+                                EMbmCmpluginwlanQgn_prop_set_conn_bearer_avail_wlan, 
+                                EMbmCmpluginwlanQgn_prop_set_conn_bearer_avail_wlan_mask );
+            break;
+            }
+        case ECmCommsDBBearerType:
+            {
+            retval = KCommDbBearerWLAN;
+            break;
+            }
+            
+        case ECmDefaultUiPriority:
+            {
+            retval = GlobalUiBearerPriority( TPtrC(KCDTypeNameWLANServiceExt) );
+            
+            if( retval == KDataMobilitySelectionPolicyPriorityWildCard )
+                {
+                retval = KDefaultPriorityWLan;
+                }
+            }
+            break;
+        case ECmDefaultPriority:
+            {
+            retval = GlobalBearerPriority( TPtrC(KCDTypeNameWLANServiceExt) );
+            
+            if( retval == KDataMobilitySelectionPolicyPriorityWildCard )
+                {
+                retval = KDefaultPriorityWLan;
+                }
+            }
+            break;
+        case EWlanServiceId:
+            {
+            if ( iWlanServiceRecord )
+                {
+                retval = iWlanServiceRecord->RecordId();
+                break;
+                }
+            }
+        default:
+            {
+    	    retval = CCmPluginBaseEng::GetIntAttributeL( aAttribute );
+            break;
+            }
+        }
+    return retval;
+    }
+
+
+// --------------------------------------------------------------------------
+// CCmPluginWlan::GetBoolAttributeL
+// --------------------------------------------------------------------------
+//
+TBool CCmPluginWlan::GetBoolAttributeL( const TUint32 aAttribute ) const
+    {
+    LOGGER_ENTERFN( "CCmPluginWlan::GetBoolAttributeL" );
+    
+    TBool retval( EFalse );
+
+    switch ( aAttribute )
+        {
+        case ECmCoverage:
+            {
+#ifndef __WINS__
+            TInt& networks = CONST_CAST( TInt&, iWlanNetworks );
+            networks = 0;
+
+            networks = CheckNetworkCoverageL();
+            
+            // If there's at least one WLAN network around, then there IS
+            // coverage.
+            retval = ( networks ? ETrue : EFalse );
+#else
+
+            TInt& networks = CONST_CAST( TInt&, iWlanNetworks );
+            ////networks = 0;
+            ////retval = EFalse;
+
+            networks = 1;
+            retval = ETrue;
+
+
+
+#endif
+            }
+            break;
+
+        case ECmAddToAvailableList:
+            {
+            retval = ETrue;
+            }
+            break;
+            
+        case ECmBearerHasUi:
+            {
+            retval = ETrue;
+            }
+            break;
+            
+        default:
+            {
+            retval = CCmPluginBaseEng::GetBoolAttributeL( aAttribute );
+            break;
+            }
+        }
+    return retval;
+    }
+
+
+// --------------------------------------------------------------------------
+// CCmPluginWlan::GetStringAttributeL
+// --------------------------------------------------------------------------
+//
+HBufC* CCmPluginWlan::GetStringAttributeL( const TUint32 aAttribute ) const
+    {
+    LOGGER_ENTERFN( "CCmPluginWlan::GetStringAttributeL" );
+
+	HBufC* retVal = NULL;
+	
+	switch( aAttribute )
+	    {
+	    case ECmBearerAvailableName:
+	        {
+	        retVal = AllocReadL( R_QTN_NETW_CONSET_BEARER_AVAILABLE_WLAN );
+	        }
+	        break;
+	        
+        case ECmBearerAvailableText:
+            {
+            if ( CEikonEnv::Static() )
+                {
+                if ( iWlanNetworks == KWlanSingleNetwork )
+                    {
+                    retVal = AllocReadL( 
+                                    R_QTN_NETW_CONSET_ONE_WLAN_NW_AVAILABLE );
+                    }
+                else
+                    {
+                    retVal = ReadResourceL( 
+                                    R_QTN_NETW_CONSET_MANY_WLAN_NW_AVAILABLE,
+                                    iWlanNetworks );
+                    }
+                }
+            else
+                {   // ReadResourceL does not work without a valid EikonEnv, so
+                    // to have a consistent behaviour when there is one or more
+                    // wlan networks for ECmBearerAvailableText, we always 
+                    // leave when called without valid EikonEnv
+                User::Leave( KErrNotSupported );
+                }
+            }
+            break;
+
+	    case ECmBearerSupportedName:
+	        {
+	        retVal = AllocReadL( R_QTN_NETW_CONSET_BEARER_SUPPORTED_WLAN );
+	        }
+	        break;
+	        
+	    case ECmBearerNamePopupNote:
+	        {
+	        retVal = AllocReadL( R_QTN_NETW_CONSET_POPUP_BEARER_WLAN );
+	        }
+	        break;
+	        
+	    case ECmBearerSettingName:
+	        {
+	        retVal = AllocReadL( R_QTN_WLAN_SETT_BEARER_WLAN );
+	        }
+	        break;
+
+	    default:
+	        {
+	        retVal = CCmPluginBaseEng::GetStringAttributeL( aAttribute );
+	        }
+	        break;
+	    }	    
+    return retVal;
+    }
+
+
+// --------------------------------------------------------------------------
+// CCmPluginWlan::SetIntAttributeL
+// --------------------------------------------------------------------------
+//
+void CCmPluginWlan::SetIntAttributeL( const TUint32 aAttribute, 
+                                            TUint32 aValue )
+    {
+    LOGGER_ENTERFN( "CCmPluginWlan::SetIntAttributeL" );
+
+    CCmPluginBaseEng::SetIntAttributeL( aAttribute, aValue );
+    if ( aAttribute == EWlanSecurityMode )
+        {
+        UpdateSecurityModeL();
+        }
+    }
+
+
+
+// --------------------------------------------------------------------------
+// CCmPluginWlan::SetBoolAttributeL
+// --------------------------------------------------------------------------
+//
+void CCmPluginWlan::SetBoolAttributeL( const TUint32 aAttribute, 
+                                             TBool aValue )
+    {
+    LOGGER_ENTERFN( "CCmPluginWlan::SetBoolAttributeL" );
+    
+    CCmPluginBaseEng::SetBoolAttributeL( aAttribute, aValue );
+    }
+
+
+
+// --------------------------------------------------------------------------
+// CCmPluginWlan::SetStringAttributeL
+// --------------------------------------------------------------------------
+//
+void CCmPluginWlan::SetStringAttributeL( const TUint32 aAttribute, 
+                                               const TDesC16& aValue )
+    {
+    LOGGER_ENTERFN( "CCmPluginWlan::SetStringAttributeL" );
+        
+    switch( aAttribute )
+        {
+        case ECmName:
+            {
+            CCmPluginLanBase::SetStringAttributeL( aAttribute, aValue );
+            break;
+            }
+        case EWlanIpNameServer1:
+        case EWlanIpNameServer2:
+            {
+            // when setting nameservers, must set EWlanIpDNSAddrFromServer
+            // according to current nameserver settings
+            CCmPluginBaseEng::SetStringAttributeL( aAttribute, aValue );
+            break;
+            }
+        case EWlanIp6NameServer1:
+        case EWlanIp6NameServer2:
+            {
+            // when setting nameservers, must set EWlanIpDNSAddrFromServer
+            // according to current nameserver settings
+            CCmPluginBaseEng::SetStringAttributeL( aAttribute, aValue );
+            break;
+            }
+        default:
+            {
+            CCmPluginBaseEng::SetStringAttributeL( aAttribute, aValue );
+            break;
+            }
+        }
+    }
+
+
+// --------------------------------------------------------------------------
+// CCmPluginWlan::UpdateAdditionalRecordsL
+// --------------------------------------------------------------------------
+//     
+void CCmPluginWlan::UpdateAdditionalRecordsL()
+    {
+    LOGGER_ENTERFN( "CCmPluginWlan::UpdateAdditionalRecordsL" );
+    
+    CheckIfNameModifiedL( iWlanServiceRecord );
+
+    iWlanServiceRecord->iWlanServiceId.SetL( iIapRecord->iService );
+    
+    if ( !iWlanServiceRecord->RecordId() )
+        {
+        iWlanServiceRecord->SetRecordId( KCDNewRecordRequest );
+        iWlanServiceRecord->StoreL( Session() );
+        }
+    else
+        {
+        iWlanServiceRecord->ModifyL( Session() );
+        }
+    UpdateSecuritySettingsL();        
+    }
+
+
+// --------------------------------------------------------------------------
+// CCmPluginWlan::CanHandleIapIdL
+// --------------------------------------------------------------------------
+//
+TBool CCmPluginWlan::CanHandleIapIdL( TUint32 aIapId ) const
+    {
+    LOGGER_ENTERFN( "CCmPluginWlan::CanHandleIapIdL1" );
+    CLOG_WRITE_1( "IapId: [%d]", aIapId );
+    
+    TBool retVal( EFalse );
+    
+    CCDIAPRecord *iapRecord = static_cast<CCDIAPRecord *>
+                        ( CCDRecordBase::RecordFactoryL(KCDTIdIAPRecord) );
+        
+    CleanupStack::PushL( iapRecord );
+    iapRecord->SetRecordId( aIapId );
+    
+    TRAPD( err, iapRecord->LoadL( Session() ) );
+
+    if( !err )
+        {
+        CanHandleIapIdL( iapRecord );
+        }
+    
+    CleanupStack::PopAndDestroy( iapRecord );
+    return retVal;
+    }
+
+
+// --------------------------------------------------------------------------
+// CCmPluginWlan::CanHandleIapIdL
+// --------------------------------------------------------------------------
+//
+TBool CCmPluginWlan::CanHandleIapIdL( CCDIAPRecord *aIapRecord ) const
+    {
+    LOGGER_ENTERFN( "CCmPluginWlan::CanHandleIapIdL2" );
+
+    CLOG_WRITE_1( "IapId: [%d]", aIapRecord->RecordId() );
+   
+    
+    TBool retVal( EFalse );
+    
+    CLOG_WRITE_2( "IAP record: [%S][%S]",
+                    &FIELD_TO_TDESC( aIapRecord->iServiceType ),
+                    &FIELD_TO_TDESC( aIapRecord->iBearerType ) 
+                );
+    
+    if( (TPtrC(aIapRecord->iServiceType) == TPtrC(KCDTypeNameLANService) ) &&
+        TPtrC(aIapRecord->iBearerType) == TPtrC(KCDTypeNameLANBearer) )
+        {
+        // check if there is a WLAN record with 
+        // an iServiceId == iIapRecord->iService;
+        CCDWlanServiceRecord* tmprec = new ( ELeave ) 
+                                       CCDWlanServiceRecord ( iWlanTableId );
+        CleanupStack::PushL( tmprec );
+
+        TInt service = aIapRecord->iService;
+        
+        tmprec->iWlanServiceId.SetL( (TUint32)service );
+        if ( tmprec->FindL( Session() ) )
+            {
+            // we found at least one WLAN using this IAP, 
+            retVal = ETrue;
+            tmprec->LoadL( Session() );
+            CLOG_WRITE( "I can." );
+            }
+        else
+            {
+            // not found -> not our
+            CLOG_WRITE_1( "Wlan with Service ID: [%d] NOT found ", 
+                          service );
+            }
+        CleanupStack::PopAndDestroy(tmprec);        
+        }
+    return retVal;
+    }
+
+
+// --------------------------------------------------------------------------
+// CCmPluginWlan::DeleteAdditionalRecordsL
+// --------------------------------------------------------------------------
+//
+void CCmPluginWlan::DeleteAdditionalRecordsL()
+    {
+    LOGGER_ENTERFN( "CCmPluginWlan::DeleteAdditionalRecordsL" );    
+    
+    // as base class deletes service record, in this case LAN, 
+    // only WLAN related stuff needs to be deleted
+    // also security settings, too!
+    DeleteSecuritySettingsL();
+    iWlanServiceRecord->DeleteL( Session() );
+    }      
+    
+        
+// --------------------------------------------------------------------------
+// CCmPluginWlan::RunSettingsL
+// --------------------------------------------------------------------------
+//        
+TInt CCmPluginWlan::RunSettingsL()
+    {
+    LOGGER_ENTERFN( "CCmPluginWlan::RunSettingsL" );
+    
+    CmPluginWlanSettingsDlg* cmDlg = CmPluginWlanSettingsDlg::NewL( *this );
+    return cmDlg->ConstructAndRunLD( );       
+    }
+
+	
+// --------------------------------------------------------------------------
+// CCmPluginWlan::LoadServiceSettingL
+// --------------------------------------------------------------------------
+//        
+void CCmPluginWlan::LoadServiceSettingL()
+    {
+    LOGGER_ENTERFN( "CCmPluginWlan::LoadServiceSettingL" );
+        
+    if( TPtrC(KCDTypeNameLANService) == iIapRecord->iServiceType  )
+        {
+        iServiceRecord = static_cast<CCDServiceRecordBase *>
+                    (CCDRecordBase::RecordFactoryL(KCDTIdLANServiceRecord));
+        iServiceRecord->SetRecordId( iIapRecord->iService );
+        CLOG_WRITE_1( "ID: [%d]", iServiceRecord->RecordId() );
+        iServiceRecord->LoadL(Session());        
+        }
+    else
+        // this IAP service is not supported by this plugin.
+        {
+        User::Leave( KErrNotSupported );
+        }
+    }
+
+
+// --------------------------------------------------------------------------
+// CCmPluginWlan::LoadAdditionalRecordsL
+// --------------------------------------------------------------------------
+//        
+void CCmPluginWlan::LoadAdditionalRecordsL()
+    {
+    LOGGER_ENTERFN( "CCmPluginWlan::LoadAdditionalRecordsL" );
+    
+    if (!iWlanServiceRecord) 
+        {
+        iWlanServiceRecord = 
+                        new ( ELeave ) CCDWlanServiceRecord ( iWlanTableId );
+        }
+    iWlanServiceRecord->SetRecordId( 0 );
+
+    iWlanServiceRecord->iWlanServiceId.SetL( ( TUint32 )
+                                                ( iIapRecord->iService ) );
+    
+    if ( iWlanServiceRecord->FindL( Session() ) )
+        {
+        iWlanServiceRecord->LoadL( Session() );
+        LoadSecuritySettingsL();
+        }
+    else
+        {
+        // not found -> error
+        CLOG_WRITE_1( "Wlan with Service ID: [%d] NOT found ", 
+                      iServiceRecord->RecordId() );
+        User::Leave(KErrNotFound);
+        }
+    }
+
+
+// --------------------------------------------------------------------------
+// CCmPluginWlan::CreateNewServiceRecordL
+// --------------------------------------------------------------------------
+//        
+void CCmPluginWlan::CreateNewServiceRecordL()
+    {
+    LOGGER_ENTERFN( "CCmPluginWlan::CreateNewServiceRecordL" );
+        
+    // create base (LAN) service record:
+    CCmPluginLanBase::CreateNewServiceRecordL();
+    CCDLANServiceRecord* tmp = 
+                static_cast<CCDLANServiceRecord *>(iServiceRecord);
+    if( FeatureSupported( KFeatureIdIPv6 ) )
+        {
+        tmp->iIfNetworks.SetL( KDefIspIfNetworksIPv4IPv6 );
+        }
+    else
+        {
+        tmp->iIfNetworks.SetL( KDefIspIfNetworksIPv4 );
+        }
+
+    // create WLAN service record:
+    CreateWlanServiceRecordL();
+    
+    // In case of WLan 'show progress' is the default value
+    SetIntAttributeL( ECmSeamlessnessLevel, ESeamlessnessShowprogress );
+    }
+
+
+// --------------------------------------------------------------------------
+// CCmPluginWlan::CreateWlanServiceRecordL
+// --------------------------------------------------------------------------
+//        
+void CCmPluginWlan::CreateWlanServiceRecordL()
+    {
+    LOGGER_ENTERFN( "CCmPluginWlan::CreateWlanServiceRecordL" );
+
+    delete iWlanServiceRecord; 
+    iWlanServiceRecord = NULL;
+    
+    iWlanServiceRecord = new ( ELeave ) CCDWlanServiceRecord ( iWlanTableId );
+    iWlanServiceRecord->SetRecordId( KCDNewRecordRequest );
+
+	iWlanServiceRecord->iRecordTag.SetL( 1 );
+	iWlanServiceRecord->iRecordName.SetL( iIapRecord->iRecordName );
+    iWlanServiceRecord->iWlanConnMode.SetL( EInfra );
+    iWlanServiceRecord->iWlanSecMode.SetL( EWlanSecModeOpen );
+    iWlanServiceRecord->iWlanScanSSID.SetL( EFalse );
+    }
+
+
+// ----------------------------------------------------------------------------
+// CCmPluginWlan::PrepareToUpdateRecordsL()
+// ----------------------------------------------------------------------------
+//
+void CCmPluginWlan::PrepareToUpdateRecordsL()
+    {
+    CCDLANServiceRecord* tmprec = static_cast<CCDLANServiceRecord*>(iServiceRecord);
+
+    CheckDNSServerAddressL( ETrue, 
+                            tmprec->iIp6NameServer1,
+                            tmprec->iIp6NameServer2,
+                            tmprec->iIp6DnsAddrFromServer );
+                            
+    CheckDNSServerAddressL( EFalse,
+                            tmprec->iIpNameServer1,
+                            tmprec->iIpNameServer2,
+                            tmprec->iIpDnsAddrFromServer );
+    SetDaemonNameL();
+    }
+
+
+// --------------------------------------------------------------------------
+// CCmPluginWlan::LoadSecuritySettingsL
+// --------------------------------------------------------------------------
+//        
+void CCmPluginWlan::LoadSecuritySettingsL()
+    {
+    LOGGER_ENTERFN( "CCmPluginWlan::LoadSecuritySettingsL" );
+
+    TUint32 secmode = iWlanServiceRecord->iWlanSecMode;
+    TUint32 iapid = iIapRecord->iService;
+                   
+    switch ( secmode )
+        {
+        case EWlanSecModeOpen:
+            {
+            break;
+            }
+        case EWlanSecModeWep:
+            {
+            if ( !iWepSecSettings )
+                {
+                iWepSecSettings = CWEPSecuritySettings::NewL();
+                }
+                iWepSecSettings->LoadL( iapid, Session() );
+            break;
+            }
+        case EWlanSecMode802_1x:
+            {
+            if ( !iWpaSecSettings )
+                {
+                iWpaSecSettings = 
+                    CWPASecuritySettings::NewL( ESecurityMode8021x );
+                }
+            iWpaSecSettings->LoadL( iapid, Session() );
+            break;
+            }
+        case EWlanSecModeWpa:
+        case EWlanSecModeWpa2:
+            {
+            if ( !iWpaSecSettings )
+                {
+                iWpaSecSettings = 
+                    CWPASecuritySettings::NewL( ESecurityModeWpa );
+                }
+			iWpaSecSettings->LoadL( iapid, Session() );
+            break;
+            }
+        case EWlanSecModeWAPI:
+            {
+            if ( iIsWAPISupported )
+                {
+                if ( !iWAPISecSettings )
+                    {
+                    iWAPISecSettings = CWAPISecuritySettings::NewL();
+                    }
+                iWAPISecSettings->LoadL( iIapRecord->RecordId(), Session() );
+                }
+            else
+                {
+                User::Leave( KErrCorrupt );
+                }
+            break;
+            }
+        default:
+            {
+            User::Leave( KErrNotSupported );
+            // do nothing in urel
+            break;
+            }
+        }
+    }
+    
+
+// ----------------------------------------------------------------------------
+// CCmPluginWlan::EditSecuritySettingsL
+// ----------------------------------------------------------------------------
+//        
+TInt CCmPluginWlan::EditSecuritySettingsL( CEikonEnv& aEikonEnv )
+    {
+    LOGGER_ENTERFN( "CCmPluginWlan::EditSecuritySettingsL" );
+
+    TInt ret = KErrNotFound;
+
+    TUint32 secmode = iWlanServiceRecord->iWlanSecMode;
+
+    HBufC* title = GetStringAttributeL(ECmName);
+    CleanupStack::PushL( title );   
+    switch ( secmode )
+        {
+        case EWlanSecModeOpen:
+            {
+            break;
+            }
+        case EWlanSecModeWep:
+            {
+            CWEPSecuritySettingsUi* ui = 
+                            CWEPSecuritySettingsUi::NewL(aEikonEnv);
+            CleanupStack::PushL( ui );
+            if ( !iWepSecSettings )
+                {
+                iWepSecSettings = CWEPSecuritySettings::NewL();
+                }            
+            ret = iWepSecSettings->EditL( *ui, *title );
+            CleanupStack::PopAndDestroy( ui );
+            break;
+            }
+        case EWlanSecMode802_1x:
+            {
+            CWPASecuritySettingsUi* ui = 
+                            CWPASecuritySettingsUi::NewL(aEikonEnv);
+            CleanupStack::PushL(ui);
+            if ( !iWpaSecSettings )
+                {
+                iWpaSecSettings = 
+                            CWPASecuritySettings::NewL( ESecurityMode8021x );
+                }                        
+            ret = iWpaSecSettings->EditL( *ui, *title );
+            CleanupStack::PopAndDestroy( ui );
+            break;
+            }
+        case EWlanSecModeWpa:
+        case EWlanSecModeWpa2:
+            {
+            CWPASecuritySettingsUi* ui = 
+                            CWPASecuritySettingsUi::NewL(aEikonEnv);
+            CleanupStack::PushL( ui );
+            if ( !iWpaSecSettings )
+                {
+                iWpaSecSettings = 
+                    CWPASecuritySettings::NewL( ESecurityModeWpa );
+                }                        
+            ret = iWpaSecSettings->EditL( *ui, *title );
+            CleanupStack::PopAndDestroy( ui );
+            break;
+            }            
+        case EWlanSecModeWAPI:
+            {
+            if ( iIsWAPISupported )
+                {
+                CWAPISecuritySettingsUi* ui =
+                            CWAPISecuritySettingsUi::NewL( aEikonEnv );
+                CleanupStack::PushL( ui );
+                if ( !iWAPISecSettings )
+                    {
+                    iWAPISecSettings = CWAPISecuritySettings::NewL();
+                    }
+                ret = iWAPISecSettings->EditL( *ui, *title );
+                CleanupStack::PopAndDestroy( ui );
+                }
+            else
+                {
+                User::Leave( KErrCorrupt );
+                }
+            break;
+            }
+        default:
+            {
+            // do nothing in urel
+            break;
+            }
+        }
+    CleanupStack::PopAndDestroy( title );
+    return ret;
+    }
+
+// --------------------------------------------------------------------------
+// CCmPluginWlan::AreSecuritySettingsValidL
+// --------------------------------------------------------------------------
+//        
+TBool CCmPluginWlan::AreSecuritySettingsValidL()
+    {
+    LOGGER_ENTERFN( "CCmPluginWlan::AreSecuritySettingsValidL" );
+  
+    TBool ret = EFalse;
+
+    TUint32 secmode = iWlanServiceRecord->iWlanSecMode;
+                
+    switch ( secmode )
+        {
+        case EWlanSecModeOpen:
+            {
+            break;
+            }
+        case EWlanSecModeWep:
+            {
+            if ( !iWepSecSettings )
+                {
+                iWepSecSettings = CWEPSecuritySettings::NewL();
+                }            
+            ret = iWepSecSettings->IsValid();
+            break;
+            }
+        case EWlanSecMode802_1x:
+            {
+            if ( !iWpaSecSettings )
+                {
+                iWpaSecSettings = 
+                    CWPASecuritySettings::NewL( ESecurityMode8021x );
+                }
+            ret = iWpaSecSettings->IsValid();
+            break;
+            }
+        case EWlanSecModeWpa:
+        case EWlanSecModeWpa2:
+            {
+            if ( !iWpaSecSettings )
+                {
+                iWpaSecSettings = 
+                    CWPASecuritySettings::NewL( ESecurityModeWpa );
+                }
+            ret = iWpaSecSettings->IsValid();
+            break;
+            }
+        case EWlanSecModeWAPI:
+            {
+            if ( iIsWAPISupported )
+                {
+                if ( !iWAPISecSettings )
+                    {
+                    iWAPISecSettings = CWAPISecuritySettings::NewL();
+                    }
+                ret = iWAPISecSettings->IsValid();
+                }
+            else
+                {
+                User::Leave( KErrCorrupt );
+                }
+            break;
+            }
+        default:
+            {
+            // do nothing in urel
+            break;
+            }
+        }        
+    return ret;
+    }
+
+    
+// --------------------------------------------------------------------------
+// CCmPluginWlan::UpdateSecuritySettingsL()
+// --------------------------------------------------------------------------
+//        
+void CCmPluginWlan::UpdateSecuritySettingsL()
+    {
+    LOGGER_ENTERFN( "CCmPluginWlan::UpdateSecuritySettingsL" );
+
+    TUint32 oldwlaniapid(0);
+    TUint32 wlaniapid = iIapRecord->iService;
+    
+    TUint32 secmode = iWlanServiceRecord->iWlanSecMode;    
+    CLOG_WRITE_1( "Sec mode: [%d]", secmode );
+
+    TTypeOfSaving savetype( ESavingBrandNewAP );
+    
+    if (iWlanServiceRecord->RecordId())
+        {
+        savetype = ESavingEditedAP;
+        oldwlaniapid = wlaniapid;
+        }
+
+    if ( iIsCopy )
+        {
+        oldwlaniapid = iCopiedFromIapId;
+        savetype = ESavingNewAPAsACopy;
+        
+        switch ( secmode )
+            {
+            case EWlanSecModeOpen:
+                {
+                break;
+                }
+            case EWlanSecModeWep:
+                {
+                // this is a brand new copy of another CM
+                // we have to load the settings for the old wlan
+                // and save with the new one.
+                // first delete possibly existing other settings
+                if ( iWepSecSettings )
+                    {
+                    delete iWepSecSettings;
+                    iWepSecSettings = NULL;
+                    }
+                break;
+                }
+            case EWlanSecMode802_1x:
+                {
+                // this is a brand new copy of another CM
+                // we have to load the settings for the old wlan
+                // and save with the new one.
+                // first delete possibly existing other settings
+                if ( iWpaSecSettings )
+                    {
+                    delete iWpaSecSettings;
+                    iWpaSecSettings = NULL;
+                    }
+                break;
+                }
+            case EWlanSecModeWpa:
+            case EWlanSecModeWpa2:
+                {
+                // this is a brand new copy of another CM
+                // we have to load the settings for the old wlan
+                // and save with the new one.
+                // first delete possibly existing other settings
+                if ( iWpaSecSettings )
+                    {
+                    delete iWpaSecSettings;
+                    iWpaSecSettings = NULL;
+                    }
+                break;
+                }
+            case EWlanSecModeWAPI:
+                {
+                if ( iIsWAPISupported )
+                    {
+                    if ( iWAPISecSettings )
+                        {
+                        delete iWAPISecSettings;
+                        iWAPISecSettings = NULL;
+                        }
+                    }
+                else
+                    {
+                    User::Leave( KErrCorrupt );
+                    }
+                break;
+                }
+            default:
+                {
+                CLOG_WRITE( "Unknown secmode" );
+                // do nothing in urel
+                break;
+                }
+            }
+        }
+    // now save, & load if still needed
+    switch ( secmode )
+        {
+        case EWlanSecModeOpen:
+            {
+            // Extra fileds are deleted from WLANServiceTable
+            // when security mode is changed from WPA to Open
+            if ( iWpaSecSettings )
+                {
+                iWpaSecSettings->DeleteL( wlaniapid );
+                }
+            break;
+            }
+        case EWlanSecModeWep:
+            {
+            // Extra fileds are deleted from WLANServiceTable
+            // when security mode is changed from WPA to WEP
+            if ( iWpaSecSettings )
+                {
+                iWpaSecSettings->DeleteL( wlaniapid );
+                }
+
+            // we have to try to save if:
+            // 1. it is a changed AP, it is possible that only 
+            // sec. settings have been changed. 
+            // In this case, iWepSecSettings might be NULL!!
+            // 2. it's sec. settings had been edited
+            
+            if ( !iWepSecSettings )
+                {
+                iWepSecSettings = CWEPSecuritySettings::NewL();
+                iWepSecSettings->LoadL( oldwlaniapid, Session() );
+                }
+            // save WEP settings, too, into same transaction...
+            iWepSecSettings->SaveL( wlaniapid, Session() );
+            break;
+            }
+        case EWlanSecMode802_1x:
+            {
+            if ( !iWpaSecSettings )
+                {
+                iWpaSecSettings = 
+                    CWPASecuritySettings::NewL( ESecurityMode8021x );
+                iWpaSecSettings->LoadL( oldwlaniapid, Session() );
+                }                            
+            // save WPA settings, too, into same transaction...
+            iWpaSecSettings->SaveL( wlaniapid, Session(), savetype, oldwlaniapid );
+            break;
+            }
+        case EWlanSecModeWpa:
+        case EWlanSecModeWpa2:
+            {
+            if ( !iWpaSecSettings )
+                {
+                iWpaSecSettings = 
+                      CWPASecuritySettings::NewL( ESecurityModeWpa );
+                iWpaSecSettings->LoadL( oldwlaniapid, Session() );
+                }
+            
+            // save WPA settings, too, into same transaction...
+            iWpaSecSettings->SaveL( wlaniapid, Session(), savetype, oldwlaniapid );
+            break;
+            }
+        case EWlanSecModeWAPI:
+            {
+            if ( iIsWAPISupported )
+                {
+                if ( !iWAPISecSettings )
+                    {
+                    iWAPISecSettings = CWAPISecuritySettings::NewL();
+                    iWAPISecSettings->LoadL( iIapRecord->RecordId(), Session() );
+                    }
+                // save WAPI settings
+                TRAPD( err, iWAPISecSettings->SaveL( iIapRecord->RecordId(), Session() ) );
+                if ( err )
+                    {
+                    if ( err != KErrArgument )
+                        {
+                        User::Leave( err );
+                        }
+                    }
+                }
+            else
+                {
+                User::Leave( KErrCorrupt );
+                }
+            break;
+            }
+        default:
+            {
+            CLOG_WRITE( "Unknown secmode" );
+            // do nothing in urel
+            break;
+            }
+        }
+    // clean up copy flags
+    if ( iIsCopy )
+        {
+        iIsCopy = EFalse;
+        iCopiedFromIapId = 0;
+        }
+    }
+    
+    
+// --------------------------------------------------------------------------
+// CCmPluginWlan::AdditionalReset()
+// --------------------------------------------------------------------------
+//        
+void CCmPluginWlan::AdditionalReset()
+    {
+    LOGGER_ENTERFN( "CCmPluginWlan::AdditionalReset" );
+    
+    delete iWlanServiceRecord;
+    iWlanServiceRecord = NULL;
+    
+    delete iWepSecSettings;
+    iWepSecSettings = NULL;
+    
+    delete iWpaSecSettings;
+    iWpaSecSettings = NULL;
+
+    if ( iIsWAPISupported )
+        {
+        delete iWAPISecSettings;
+        iWAPISecSettings = NULL;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CCmPluginWlan::BearerRecordIdLC()
+// --------------------------------------------------------------------------
+//        
+void CCmPluginWlan::BearerRecordIdLC( HBufC* &aBearerName, 
+                                                  TUint32& aRecordId )
+    {
+    LOGGER_ENTERFN( "CCmPluginWlan::BearerRecordIdLC" );
+
+	CCDLANBearerRecord* tmprec = static_cast<CCDLANBearerRecord*>
+                ( CCDRecordBase::RecordFactoryL( KCDTIdLANBearerRecord ) );
+    CleanupStack::PushL( tmprec );
+
+    tmprec->iRecordName.SetL( TPtrC( iBearerRecName ) );
+    if ( !tmprec->FindL( Session() ) )
+        { // bearer not found -> create dummy values
+        CLOG_WRITE( "No bearer found" );
+        
+        tmprec->SetRecordId( KCDNewRecordRequest );
+        
+        tmprec->iBearerAgent.SetL( KWlanBearerAgent );
+        tmprec->iRecordName.SetL( KWlanBearerName );
+        tmprec->iLanBearerNifName.SetL( KWlanBearerNif );
+        tmprec->iLanBearerLddName.SetL( KWlanLDDName );
+        tmprec->iLanBearerPddName.SetL( KWlanPDDName );
+        tmprec->iLastSocketActivityTimeout.SetL(
+                                ( TUint32 )KWlanLastSocketActivityTimeout );
+        tmprec->iLastSessionClosedTimeout.SetL(
+                                (TUint32 )KWlanLastSessionClosedTimeout );
+        tmprec->iLastSocketClosedTimeout.SetL(
+                                ( TUint32 )KWlanLastSocketClosedTimeout );
+        tmprec->StoreL( Session() );
+        }
+
+    aRecordId = tmprec->RecordId();
+    
+    CLOG_WRITE_2( "Name: [%S], id: [%d]", 
+                  &tmprec->iRecordName.GetL(),
+                  aRecordId );
+
+    CleanupStack::PopAndDestroy( tmprec );
+
+    aBearerName = TPtrC(KCDTypeNameLANBearer).AllocLC();
+    }
+
+
+// --------------------------------------------------------------------------
+// CCmPluginWlan::ReadResourceL()
+// --------------------------------------------------------------------------
+//        
+HBufC* CCmPluginWlan::ReadResourceL( TInt aResId, TInt aInt ) const
+    {
+    LOGGER_ENTERFN( "CCmPluginWlan::ReadResourceL" );
+    
+    HBufC* retval = NULL;
+
+    RConeResourceLoader resourceLoader( *CEikonEnv::Static() );
+    LoadResourceLC( resourceLoader );
+    retval = StringLoader::LoadL( aResId, aInt );
+
+    // Clean-up
+    CleanupStack::PopAndDestroy();
+
+    return retval;
+    }
+
+
+// --------------------------------------------------------------------------
+// CCmPluginWlan::LoadResourceL()
+// --------------------------------------------------------------------------
+//  
+void CCmPluginWlan::LoadResourceLC( 
+                                RConeResourceLoader& aResourceLoader ) const
+    {
+    LOGGER_ENTERFN( "CCmPluginWlan::LoadResourceLC" );
+    
+    // Add resource file.
+    TParse fp;
+    User::LeaveIfError( fp.Set( KPluginWlanResDirAndFileName, 
+                        &KDC_RESOURCE_FILES_DIR, 
+                        NULL ) );
+    TFileName resourceFileNameBuf = fp.FullName();
+
+    CleanupClosePushL( aResourceLoader );
+    aResourceLoader.OpenL( resourceFileNameBuf );
+    }
+
+
+// --------------------------------------------------------------------------
+// CCmPluginWlan::InitializeWithUiL
+// --------------------------------------------------------------------------
+//        
+TBool CCmPluginWlan::InitializeWithUiL( TBool aManuallyConfigure )
+    {
+    LOGGER_ENTERFN( "CCmPluginWlan::InitializeWithUiL" );
+    
+    TBool retVal ( EFalse );
+    RConeResourceLoader resourceLoader( *CEikonEnv::Static() );
+    LoadResourceLC( resourceLoader );
+    if ( aManuallyConfigure )
+        {
+        retVal = ManuallyConfigureL();
+        }
+    else
+        {
+        retVal = AutomaticallyConfigureL();
+        }
+    // Clean-up
+    CleanupStack::PopAndDestroy();
+    return retVal;
+    }
+
+// --------------------------------------------------------------------------
+// CCmPluginWlan::ProtectedSetupL
+// --------------------------------------------------------------------------
+//
+WiFiProt::TWiFiReturn CCmPluginWlan::ProtectedSetupL( TWlanSsid& aSsid )
+    {
+    RCmManagerExt packedCmManager;
+    iCmMgr.WrapCmManager( packedCmManager );
+    CWifiProtUiInProcess* wifi = CWifiProtUiInProcess::NewL(
+                             &packedCmManager );
+    CleanupStack::PushL( wifi );
+    WiFiProt::TWiFiReturn wifiret = wifi->StartFromUiL( aSsid, EFalse, iAdditionalCmsCreated);                         
+    CleanupStack::PopAndDestroy( wifi );                                         
+    switch ( wifiret )
+        {
+        case WiFiProt::EWiFiCancel:
+            {
+            break;
+            }
+        case WiFiProt::EWiFiOK:
+            {
+            if (iAdditionalCmsCreated.Count())
+                {
+                // Loading the first item in the array
+                // to the actual plugin
+                Reset();
+                AdditionalReset();
+                LoadL( iAdditionalCmsCreated[0] );
+                iAdditionalCmsCreated.Remove(0);
+                }
+             else 
+                {//no settings configured, do the same as cancel case
+                return WiFiProt::EWiFiCancel;
+                }
+                
+            break;
+            }
+        case WiFiProt::EWifiNoAuto:
+            {
+            break;
+            }  
+        default:
+            {
+            User::Leave( KErrNotSupported );
+            break;
+            }                                              
+        }    
+    return wifiret;
+    }
+
+// --------------------------------------------------------------------------
+// CCmPluginWlan::AutomaticallyConfigureL
+// --------------------------------------------------------------------------
+//
+TBool CCmPluginWlan::AutomaticallyConfigureL()
+    {
+    LOGGER_ENTERFN( "CCmPluginWlan::AutomaticallyConfigureL" );
+    
+    TBool retval ( ETrue );
+    
+    if ( !iConnUiUtils )
+        {
+        iConnUiUtils = CConnectionUiUtilities::NewL();
+        }
+
+    // Let's search for a WLAN network
+    TWlanSsid ssid;
+    TWlanConnectionMode connectionMode;
+    TWlanConnectionExtentedSecurityMode securityMode;
+
+    TUint32 secmode( EWlanSecModeOpen );
+    
+    // Fortunately user will not see WLAN networks with empty ssid in the list
+    // shown by next call.
+    CCmPluginWlanActiveWaiter* waiter = CCmPluginWlanActiveWaiter::NewL();
+    CleanupStack::PushL( waiter );
+
+    TBool isProtectedSetupSupported;
+    iConnUiUtils->SearchWLANNetworkAsync( waiter->iStatus, ssid, connectionMode, securityMode, isProtectedSetupSupported );
+
+    TInt searchWlanReturn = waiter->WaitForRequest();
+    CleanupStack::PopAndDestroy( waiter );
+
+    if ( searchWlanReturn == KErrNone)
+        {
+        if ( isProtectedSetupSupported )
+            {
+            TBool wifiret = ProtectedSetupL( ssid );
+            switch ( wifiret )
+                {
+                case WiFiProt::EWiFiCancel: //cancel pressed, cancel process
+                    {
+                    return EFalse;
+                    //break;
+                    }
+                case WiFiProt::EWiFiOK: //settings configured already, we can return
+                    {
+                    return ETrue;
+                    //break;
+                    }
+                case WiFiProt::EWifiNoAuto://proceed with normal setup
+                    {
+                    break;
+                    }  
+                default:
+                    {
+                    User::Leave( KErrNotSupported );
+                    break;
+                    }                                              
+                }    
+            }
+        switch( securityMode )
+            {
+            case EWlanConnectionExtentedSecurityModeOpen:
+                {
+                secmode = EWlanSecModeOpen;
+                }
+                break;
+                
+            case EWlanConnectionExtentedSecurityModeWepOpen:
+            case EWlanConnectionExtentedSecurityModeWepShared:
+                {
+                secmode = EWlanSecModeWep;
+                }
+                break;
+                
+            case EWlanConnectionExtentedSecurityMode802d1x:
+                {
+                secmode = EWlanSecMode802_1x;
+                }
+                break;
+                
+            case EWlanConnectionExtentedSecurityModeWpa:
+            case EWlanConnectionExtentedSecurityModeWpaPsk:
+                {
+                secmode = EWlanSecModeWpa;
+                }
+                break;
+                
+            case EWlanConnectionExtentedSecurityModeWpa2:
+            case EWlanConnectionExtentedSecurityModeWpa2Psk:
+                {
+                secmode = EWlanSecModeWpa2;
+                }
+                break;
+            case EWlanConnectionExtentedSecurityModeWapi:
+            case EWlanConnectionExtentedSecurityModeWapiPsk:
+                {
+                if ( iIsWAPISupported )
+                    {
+                    secmode = EWlanSecModeWAPI;
+                    }
+                else
+                    {
+                    User::Leave( KErrCorrupt );
+                    }
+                }
+                break;
+            default:
+                {
+                User::Leave( KErrNotSupported );
+                }
+            }
+
+        // Let's check the security mode and if it's other than "none", then
+        // ask for the key.
+        HBufC* key = HBufC::NewLC( KWlanMaxKeyLength );    // security key
+        TPtr keyPtr( key->Des() );
+        TBool wepKeyInAsciiFormat;
+        switch( securityMode )
+            {
+            case EWlanConnectionExtentedSecurityModeWepOpen:
+            case EWlanConnectionExtentedSecurityModeWepShared:
+                {
+    	          retval = iConnUiUtils->EasyWepDlg( &keyPtr, wepKeyInAsciiFormat );
+                break;
+                }
+            case EWlanConnectionExtentedSecurityModeWpaPsk:
+            case EWlanConnectionExtentedSecurityModeWpa2Psk:
+                {
+            	  retval = iConnUiUtils->EasyWpaDlg( &keyPtr );
+                break;
+                }
+            case EWlanConnectionExtentedSecurityModeWapiPsk:
+                {
+                retval = iConnUiUtils->EasyWapiDlg( &keyPtr );
+                break;
+                }
+            case EWlanConnectionExtentedSecurityModeOpen:
+            case EWlanConnectionExtentedSecurityMode802d1x:
+            case EWlanConnectionExtentedSecurityModeWpa:
+            case EWlanConnectionExtentedSecurityModeWpa2:
+            case EWlanConnectionExtentedSecurityModeWapi:
+            default:
+                {
+                break;
+                }
+            }
+
+        // If retval is not ETrue here, then most probably the user has
+        // cancelled the password dialog ==> she has cancelled the whole
+        // process.
+        if ( retval )
+            {
+            // We have to convert the 8-bit SSID to 16-bit for CommsDat.
+            HBufC* ssid16 = HBufC::NewLC( ssid.Length() );
+            TPtr ssid16Ptr( ssid16->Des() );
+            ssid16Ptr.Copy( ssid );
+
+            SetStringAttributeL( ECmName, *ssid16 );
+            SetStringAttributeL( EWlanSSID, *ssid16 );
+            // ConvertWLANConnectionStatesL( )converts WLAN connection state 
+            // (TWlanConnectionMode) into EInfra or EAdhoc (TWlanNetMode)
+            SetIntAttributeL( EWlanConnectionMode, 
+                    (TUint32) ConvertWLANConnectionStatesL( connectionMode ) );
+            SetIntAttributeL( EWlanSecurityMode, secmode );
+
+            // Check if the network is hidden
+            TBool hidden( EFalse );
+
+            // These values we already have so we are not interested of
+            // them
+            TWlanNetMode tempNetworkMode;
+            TWlanConnectionExtentedSecurityMode tempSecurityMode;
+
+            TBool tempProtectedSetupSupported;
+
+            TInt retVal( KErrNone );
+
+            CCmWlanCoverageCheck* coverage = new( ELeave )CCmWlanCoverageCheck;
+            CleanupStack::PushL( coverage );
+
+	          // We need to catch leave value of Wlan scanning
+	          TRAPD( err, retVal = coverage->ScanForPromptedSsidL( ssid, ETrue, 
+                   tempNetworkMode, 
+                   tempSecurityMode,
+                   tempProtectedSetupSupported ) );
+            if ( !retVal || err != KErrNone)
+                {
+                TRAPD( err, retVal = coverage->ScanForPromptedSsidL( ssid,
+								     EFalse,
+								     tempNetworkMode, 
+								     tempSecurityMode,
+								     tempProtectedSetupSupported ) );
+                if ( err == KErrNone && retVal )
+                    {
+                    hidden = ETrue;
+                    }
+                else // direct scan is ok, but network could not found with given ssid
+		            {
+                CleanupStack::PopAndDestroy( coverage ); // coverage
+                CleanupStack::PopAndDestroy( ssid16 );
+                CleanupStack::PopAndDestroy( key );
+			
+                TCmCommonUi::ShowNoteL( R_QTN_NETW_QUEST_IAP_INCOMPLETE_DELETE, TCmCommonUi::ECmOkNote );
+                return EFalse;
+		            }
+            }
+
+            CleanupStack::PopAndDestroy( coverage ); // coverage
+            
+            SetBoolAttributeL( EWlanScanSSID, hidden );
+            CLOG_WRITE_1( "Is hidden[%d]", (TInt) hidden );
+
+            // We have to store the security key as well.
+            if ( securityMode == EWlanConnectionExtentedSecurityModeWepOpen )
+                {
+                if ( !iWepSecSettings )
+                    {
+                    iWepSecSettings = CWEPSecuritySettings::NewL();
+                    }
+                iWepSecSettings->SetKeyDataL( 0, *key,
+                                             wepKeyInAsciiFormat );
+                // Note that the key will NOT be persisted at this very
+                // point, but only after SaveL, which will be called
+                // later on.
+                }
+            else if ( securityMode == EWlanConnectionExtentedSecurityModeWpaPsk
+                      || securityMode == EWlanConnectionExtentedSecurityModeWpa2Psk )
+                {
+                if ( !iWpaSecSettings )
+                    {
+                    iWpaSecSettings = CWPASecuritySettings::NewL( ESecurityModeWpa );
+                    }
+                iWpaSecSettings->SetWPAPreSharedKey( *key );
+
+                // Note that the key will NOT be persisted at this very
+                // point, but only after SaveL, which will be called
+                // later on.
+                }
+            else if ( securityMode == EWlanConnectionExtentedSecurityModeWapiPsk )
+                {
+                if ( !iWAPISecSettings )
+                    {
+                    iWAPISecSettings = CWAPISecuritySettings::NewL();
+                    }
+                
+                iWAPISecSettings->SetPreSharedKeyL( CWAPISecuritySettings::EWapiKeyAscii, *key );
+                // Note that the key will NOT be persisted at this very
+                // point, but only after SaveL, which will be called
+                // later on.
+                }
+
+            CLOG_WRITE( "InitializeWithUiL stored everything successfully" );
+
+            CleanupStack::PopAndDestroy( ssid16 );
+            }
+        CleanupStack::PopAndDestroy( key );
+        }
+    else
+        {
+        if ( searchWlanReturn == KErrNotFound )
+            {
+            // no Wlan network found, continuing process...
+            HBufC* ssid16 = HBufC::NewLC( ssid.Length() );
+            TPtr ssid16Ptr( ssid16->Des() );
+            ssid16Ptr.Copy( ssid );
+            // write ssid and go on...
+            SetStringAttributeL( ECmName, *ssid16 );
+            SetStringAttributeL( EWlanSSID, *ssid16 );
+            CleanupStack::PopAndDestroy( ssid16 );
+            retval = ProceedWithManualL( ETrue ); // revert to fully manual...
+            }
+        else
+            {
+            retval = EFalse;
+            }
+        }
+    return retval;
+    }
+
+
+// --------------------------------------------------------------------------
+// CCmPluginWlan::ManuallyConfigureL
+// --------------------------------------------------------------------------
+//
+TBool CCmPluginWlan::ManuallyConfigureL()
+    {
+    LOGGER_ENTERFN( "CCmPluginWlan::ManuallyConfigureL" );
+    
+    TBool proceed ( EFalse );
+    TBool askNWModeAndSec ( EFalse );
+    
+    // Step 1 - WLAN Network Name query (SSID)
+    // sets: ECmName, EWlanSSID
+    RBuf nwName;
+    nwName.CreateL( KCmWlanNWNameMaxLength );
+    CleanupClosePushL( nwName );
+
+    proceed = ShowNWNameQueryL( nwName );
+    
+    TWlanConnectionExtentedSecurityMode securityMode =
+                                        EWlanConnectionExtentedSecurityModeOpen;
+            
+    TWpaMode wpaMode = EWpaModeUndefined;
+
+    if ( proceed )
+        {
+        TWlanNetMode nwMode( EInfra );
+
+        // Step 2 - SSID scan ( first broadcast, then direct )
+        // sets: EWlanConnectionMode
+        //       EWlanScanSSID
+        //       EWlanSecurityMode
+
+        TWlanSsid ssid;
+        ssid.Copy( nwName );       
+        
+        TBool protectedSetupSupported = EFalse;
+        if ( ScanForWlanNwL( ssid, nwMode, securityMode, protectedSetupSupported ) )
+            {
+            if ( protectedSetupSupported )
+                {
+                TBool wifiret = ProtectedSetupL( ssid );
+                switch ( wifiret )
+                    {
+                    case WiFiProt::EWiFiCancel: //cancel pressed, cancel process
+                        {
+                        CleanupStack::PopAndDestroy( &nwName ); //cleanup and return 
+                        return EFalse;
+                        //break;
+                        }
+                    case WiFiProt::EWiFiOK:
+                        {
+                        CleanupStack::PopAndDestroy( &nwName );//cleanup and return 
+                        //UpdateSecuritySettingsL();
+                        return ETrue;
+                        //break;
+                        }
+                    case WiFiProt::EWifiNoAuto://proceed with normal setup
+                        {
+                        break;
+                        }  
+                    default:
+                        {
+                        User::Leave( KErrNotSupported );
+                        break;
+                        }                                              
+                    }    
+                }
+
+            if ( securityMode == EWlanConnectionExtentedSecurityModeWpaPsk
+                 || securityMode == EWlanConnectionExtentedSecurityModeWpa2Psk )
+                {
+                wpaMode = EWpaModePreSharedKey;
+                }
+            else if ( securityMode == EWlanConnectionExtentedSecurityModeWpa
+                      || securityMode == EWlanConnectionExtentedSecurityMode802d1x
+                      || securityMode == EWlanConnectionExtentedSecurityModeWpa2 )
+                {
+                wpaMode = EWpaModeEap;
+                }
+            }
+        else
+            {
+            askNWModeAndSec = ETrue;
+            }
+        proceed = ProceedWithManualL ( askNWModeAndSec, nwMode, securityMode, wpaMode  );
+        }
+    CleanupStack::PopAndDestroy( &nwName );
+
+    return proceed;
+    }
+
+
+// --------------------------------------------------------------------------
+// CCmPluginWlan::ProceedWithManualL
+// --------------------------------------------------------------------------
+//
+TBool CCmPluginWlan::ProceedWithManualL( TBool aAskNWModeAndSec,
+                                         TWlanNetMode aNwMode, 
+                                         TWlanConnectionExtentedSecurityMode aSecurityMode,
+                                         TWpaMode aWpaMode )
+    {
+    LOGGER_ENTERFN( "CCmPluginWlan::ProceedWithManualL" );
+
+    TInt proceed = ETrue;
+    if ( aAskNWModeAndSec )
+        {
+        // Step 3 - Network Mode
+        // sets: EWlanConnectionMode
+        //       EWlanScanSSID
+        proceed = SelectNWModeL( aNwMode );
+
+        // Step 4 - Network security
+        // sets: EWlanSecurityMode
+        // Open       - finished
+        // WEP        - go to step 5
+        // WPA/802.1x - go to step 6
+        // WAPI       - go to step 9
+        if ( proceed )
+            {
+            proceed = ShowNWSecurityDlgL( aNwMode, aSecurityMode );
+            }
+        }
+        
+    // Security settings - Steps 5-8
+    if ( proceed && aSecurityMode != EWlanConnectionExtentedSecurityModeOpen )
+        {
+        switch ( aSecurityMode )
+            {
+            // Step 5 - Enter WEP key
+            // sets: wep key
+            // finished
+            case EWlanConnectionExtentedSecurityModeWepOpen:
+            case EWlanConnectionExtentedSecurityModeWepShared:
+                {
+                proceed = EnterWEPKeyL();
+                break;
+                }
+            // Step 6 - WPA/WPA2 mode
+            // sets: wpa/802.1x keys
+            // Pre-shared - go to step 7
+            // EAP        - go to step 8
+            case EWlanConnectionExtentedSecurityMode802d1x:
+            case EWlanConnectionExtentedSecurityModeWpa:
+            case EWlanConnectionExtentedSecurityModeWpaPsk:
+            case EWlanConnectionExtentedSecurityModeWpa2:
+            case EWlanConnectionExtentedSecurityModeWpa2Psk:
+                {
+                if ( aWpaMode == EWpaModeUndefined )
+                    {
+                    proceed = SelectWpaModeDialogL( aWpaMode );
+                    }
+
+                if ( proceed )
+                    {
+                    // Step 7 - Pre-shared key
+                    // sets: pre-shared key
+                    // finished
+                    if ( aWpaMode == EWpaModePreSharedKey )
+                        {
+                        proceed = EnterWpaPreSharedKeyL();
+                        }
+                    // Step 8 - EAP selection note
+                    else
+                        {
+                        TCmCommonUi::ShowNoteL( *( StringLoader::LoadLC( 
+                            R_QTN_NETW_CONSET_INFO_EAP_SETTINGS_DEFAULT ) ),
+                            TCmCommonUi::ECmInfoNote );
+                        CleanupStack::PopAndDestroy();
+                        }
+                    }
+                break;
+                }
+            // Step 9
+            case EWlanConnectionExtentedSecurityModeWapi:
+            case EWlanConnectionExtentedSecurityModeWapiPsk:
+                {
+                if ( iIsWAPISupported )
+                    {
+                    if ( aSecurityMode == EWlanConnectionExtentedSecurityModeWapiPsk )
+                        {
+                        proceed = EnterWAPIPreSharedKeyL();
+                        }
+                    }
+                else
+                    {
+                    User::Leave( KErrCorrupt );
+                    }
+                break;
+                }
+            default:
+                {
+                User::Leave( KErrNotSupported );
+                break;
+                }
+            }
+        }
+        
+    // Store all the unsaved settings
+  /* if ( proceed )
+        {
+        UpdateSecuritySettingsL();
+        }*/
+    return proceed;
+    }
+    
+// --------------------------------------------------------------------------
+// CCmPluginWlan::ShowNWNameQueryL
+// --------------------------------------------------------------------------
+//
+TBool CCmPluginWlan::ShowNWNameQueryL( TDes& aNwName )
+    {
+    LOGGER_ENTERFN( "CCmPluginWlan::ShowNWNameQueryL" );
+    
+    TBool retVal ( EFalse );
+    
+    retVal = TCmCommonUi::ShowConfirmationQueryWithInputL( 
+                                            R_QTN_WLAN_PRMPT_NETWORK_NAME,
+                                            aNwName );
+    if ( retVal )
+        {
+        SetStringAttributeL( ECmName, aNwName );
+        SetStringAttributeL( EWlanSSID, aNwName );
+        
+        retVal = ETrue;
+        }
+    return retVal;
+    }
+
+
+// --------------------------------------------------------------------------
+// CCmPluginWlan::ScanForWlanNwL
+// --------------------------------------------------------------------------
+//
+TBool CCmPluginWlan::ScanForWlanNwL( 
+#ifdef __WINS__
+                         TWlanSsid& /*aSsid*/, TWlanNetMode& /*aNetworkMode*/,
+                         TWlanConnectionExtentedSecurityMode& /*aSecurityMode*/,
+                         TBool& /*aProtectedSetupSupported*/ )
+#else
+                         TWlanSsid& aSsid, TWlanNetMode& aNetworkMode,
+                         TWlanConnectionExtentedSecurityMode& aSecurityMode,
+                         TBool& aProtectedSetupSupported )
+#endif  // __WINS__
+    {
+    LOGGER_ENTERFN( "CCmPluginWlan::ScanForWlanNwL" );
+    
+    TBool retVal ( EFalse );
+
+    DestroyWaitDialog();
+
+    iWaitDialog = new( ELeave )CAknWaitDialog
+                    ( REINTERPRET_CAST( CEikDialog**, &iWaitDialog ), ETrue );
+    iWaitDialog->ExecuteLD( R_SEARCHING_WLAN_WAIT_NOTE ); 
+
+#ifndef __WINS__
+    TBool hidden ( EFalse );
+    
+    CCmWlanCoverageCheck* coverage = new( ELeave )CCmWlanCoverageCheck;
+    CleanupStack::PushL( coverage );
+
+    CLOG_WRITE( "Coverage created, calling ScanForPromptedSsidL, broadcast" );
+    retVal = coverage->ScanForPromptedSsidL( aSsid, ETrue, aNetworkMode, 
+                                             aSecurityMode,
+                                             aProtectedSetupSupported );
+    CLOG_WRITE( "ScanForPromptedSsidL returned" );
+    
+    if ( !retVal )
+        {
+        CLOG_WRITE( "Calling ScanForPromptedSsidL, direct" );
+        retVal = coverage->ScanForPromptedSsidL( aSsid, EFalse, aNetworkMode, 
+                                                 aSecurityMode,
+                                                 aProtectedSetupSupported );
+        CLOG_WRITE( "ScanForPromptedSsidL returned" );
+
+        if ( retVal )
+            {
+            hidden = ETrue;
+            }
+        }
+
+    CleanupStack::PopAndDestroy( coverage );
+
+    if ( retVal )
+        {
+        CLOG_WRITE( "Ssid has been found" );
+
+        // Network mode
+        SetIntAttributeL( EWlanConnectionMode, aNetworkMode );
+        // Security mode
+        SetIntAttributeL( EWlanSecurityMode, 
+                          ConvertConnectionSecurityModeToSecModeL( 
+                          aSecurityMode ) );
+        // Hidden
+        SetBoolAttributeL( EWlanScanSSID, hidden );    
+        }
+    else    
+#else   // __WINS
+  if ( !retVal )  
+#endif  // __WINS
+        {
+        HBufC* stringLabel = StringLoader::LoadLC( 
+                                        R_INFO_NO_NETWORKS_FOUND );
+
+        CAknGlobalNote * note = CAknGlobalNote::NewL();
+        CleanupStack::PushL(note);
+        note->ShowNoteL(EAknGlobalInformationNote, *stringLabel);
+        CleanupStack::PopAndDestroy(note);
+        CleanupStack::PopAndDestroy( stringLabel );        
+        }
+
+
+    DestroyWaitDialog();
+
+    return retVal;
+    }
+
+
+// --------------------------------------------------------------------------
+// CCmPluginWlan::SelectNWModeL
+// --------------------------------------------------------------------------
+//
+TBool CCmPluginWlan::SelectNWModeL( TWlanNetMode& aNwMode )
+    {
+    LOGGER_ENTERFN( "CCmPluginWlan::SelectNWModeL" );
+    
+    TBool retVal ( EFalse );
+    
+    // Title
+    HBufC* title = StringLoader::LoadLC( 
+                        R_QTN_NETW_CONSET_PRMPT_WLAN_NW_MODE_AND_STATUS );
+    TPtr ptrTitle ( title->Des() );
+    
+    // Items
+    CDesCArrayFlat* items = 
+	            new ( ELeave ) CDesCArrayFlat( KCmArrayMediumGranularity );
+    CleanupStack::PushL( items );
+    
+    TInt i = 0;
+    while ( KWlanNetworkModeConvTable[i].iResId != KEndOfArray )
+        {
+        items->AppendL( 
+            *StringLoader::LoadLC( KWlanNetworkModeConvTable[i].iResId ) );
+        CleanupStack::PopAndDestroy(); 
+        i++;
+        }
+        
+    // Show the dialog
+    TInt selection(0);
+    if ( TCmCommonUi::ShowPopupListL( ptrTitle , 
+                                      items,
+                                      NULL,
+                                      R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT,
+                                      selection ) )
+        {
+        // result:        
+        i = 0;
+        
+        aNwMode = 
+            ( TWlanNetMode ) KWlanNetworkModeConvTable[selection].iNwMode;
+        
+        // Network mode
+        SetIntAttributeL( EWlanConnectionMode, aNwMode );
+        
+        // Network status
+        SetBoolAttributeL( EWlanScanSSID, 
+                           KWlanNetworkModeConvTable[selection].iHidden );
+                           
+        retVal = ETrue;
+        }
+                                      
+    CleanupStack::Pop( items );
+    CleanupStack::PopAndDestroy( title );
+    return retVal;
+    }
+
+
+// --------------------------------------------------------------------------
+// CCmPluginWlan::ShowNWSecurityDlgL
+// --------------------------------------------------------------------------
+//
+TBool CCmPluginWlan::ShowNWSecurityDlgL( TWlanNetMode aNwMode, 
+                                TWlanConnectionExtentedSecurityMode& aSecurityMode )
+    {
+    LOGGER_ENTERFN( "CCmPluginWlan::ShowNWSecurityDlgL" );
+
+    TBool retVal ( EFalse );    
+
+    // Collect NW Security Mode items
+	CDesCArrayFlat* items = 
+	            new ( ELeave ) CDesCArrayFlat( KCmArrayMediumGranularity );
+    
+    TInt i = 0;
+    while ( KWlanSecurityModeConvTable[i].iResId != KEndOfArray )
+        {
+        TWlanSecMode secMode = 
+                ( TWlanSecMode ) KWlanSecurityModeConvTable[i].iSecurityMode;
+        
+        if ( ( secMode == EWlanSecModeOpen || secMode == EWlanSecModeWep )
+                || aNwMode == EInfra )
+             {
+            items->AppendL( *StringLoader::LoadLC( 
+                                KWlanSecurityModeConvTable[i].iResId ) );
+            CleanupStack::PopAndDestroy(); 
+            }
+        i++;
+        // don't show WAPI if it's not supported
+        if ( !iIsWAPISupported )
+            {
+            if ( KWlanSecurityModeConvTable[i].iSecurityMode == EWlanSecModeWAPI )
+                {
+                break;
+                }
+            }
+        }
+   
+    // Title
+    HBufC* title = StringLoader::LoadLC( 
+                            R_QTN_NETW_CONSET_PRMPT_WLAN_NW_SECURITY_MODE );
+    TPtr ptrTitle ( title->Des() );
+    
+    TInt selection = 0;
+    
+    // Show the dialog
+    if ( TCmCommonUi::ShowPopupListL( ptrTitle , 
+                                      items,
+                                      NULL,
+                                      R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT,
+                                      selection ) )
+        {
+        // result:
+        aSecurityMode = 
+                ConvertSecModeToConnectionSecurityModeL( ( TWlanSecMode )
+                        KWlanSecurityModeConvTable[selection].iSecurityMode );
+        SetIntAttributeL( EWlanSecurityMode, 
+                        KWlanSecurityModeConvTable[selection].iSecurityMode );
+        retVal = ETrue;
+        }
+    CleanupStack::PopAndDestroy( title );
+    return retVal;
+    }
+
+
+// --------------------------------------------------------------------------
+// CCmPluginWlan::EnterWEPKeyL
+// --------------------------------------------------------------------------
+//
+TBool CCmPluginWlan::EnterWEPKeyL()
+    {
+    LOGGER_ENTERFN( "CCmPluginWlan::EnterWEPKeyL" );
+    
+    TBool retVal ( EFalse );
+    
+    // Security key
+    HBufC* key = HBufC::NewLC( KWlanMaxKeyLength );
+    TPtr keyPtr( key->Des() );
+    TBool wepKeyInAsciiFormat ( EFalse );
+    
+    if ( !iConnUiUtils )
+        {
+        iConnUiUtils = CConnectionUiUtilities::NewL();
+        }
+    
+    if ( iConnUiUtils->EasyWepDlg( &keyPtr, wepKeyInAsciiFormat ) )
+        {
+        if ( !iWepSecSettings )
+            {
+            iWepSecSettings = CWEPSecuritySettings::NewL();
+            }       
+        iWepSecSettings->SetKeyDataL( 0, 
+                                      *key,
+                                      wepKeyInAsciiFormat );
+        retVal = ETrue;
+        }
+    CleanupStack::PopAndDestroy( key );    
+    return retVal;
+    }
+
+
+// --------------------------------------------------------------------------
+// CCmPluginWlan::EnterWpaPreSharedKeyL
+// --------------------------------------------------------------------------
+//
+TBool CCmPluginWlan::EnterWpaPreSharedKeyL()
+    {
+    LOGGER_ENTERFN( "CCmPluginWlan::EnterWpaPreSharedKeyL" );
+    
+    TBool retVal ( EFalse );
+    
+    HBufC* key = HBufC::NewLC( KWlanMaxKeyLength );
+    TPtr keyPtr( key->Des() );
+
+    if ( !iConnUiUtils )
+        {
+        iConnUiUtils = CConnectionUiUtilities::NewL();
+        }
+    
+    if ( iConnUiUtils->EasyWpaDlg( &keyPtr ) )
+        {
+        if ( !iWpaSecSettings )
+            {
+            iWpaSecSettings = CWPASecuritySettings::NewL( ESecurityModeWpa );
+            }
+        iWpaSecSettings->SetWPAPreSharedKey( *key );
+        retVal = ETrue;
+        }
+    CleanupStack::PopAndDestroy( key );  
+    return retVal;
+    }
+
+
+// --------------------------------------------------------------------------
+// CCmPluginWlan::SelectWpaModeDialogL
+// --------------------------------------------------------------------------
+//
+TBool CCmPluginWlan::SelectWpaModeDialogL( TWpaMode& aWpaMode )
+    {
+    LOGGER_ENTERFN( "CCmPluginWlan::SelectWpaModeDialogL" );
+    
+    TBool retVal ( EFalse );
+    
+    // Collect NW Security Mode items
+    CDesCArrayFlat* items = 
+	            new ( ELeave ) CDesCArrayFlat( KCmArrayMediumGranularity );
+   
+    // Title
+    HBufC* title = 
+            StringLoader::LoadLC( R_QTN_NETW_CONSET_PRMPT_WLAN_WPA_MODE );
+    TPtr ptrTitle ( title->Des() );
+    
+    TInt selection = 0;
+    
+    // EWpaModeEap
+    items->AppendL( *StringLoader::LoadLC(
+                                    R_QTN_NETW_CONSET_PRMPT_WPA_MODE_EAP ) );
+    CleanupStack::PopAndDestroy(); 
+    
+    // EWpaModePreSharedKey
+    items->AppendL( *StringLoader::LoadLC( 
+                                    R_QTN_NETW_CONSET_PRMPT_WPA_MODE_PSK ) );
+    CleanupStack::PopAndDestroy(); 
+        
+    // Show the dialog    
+    if( TCmCommonUi::ShowPopupListL( ptrTitle, 
+                                     items,
+                                     NULL,
+                                     R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT,
+                                     selection ) )
+        {
+        aWpaMode = ( TWpaMode ) selection;
+        retVal = ETrue;
+        }
+    
+    CleanupStack::PopAndDestroy( title );
+    
+    return retVal;
+    }
+
+
+// --------------------------------------------------------------------------
+// CCmPluginWlan::UpdateSecurityModeL
+// --------------------------------------------------------------------------
+//
+void CCmPluginWlan::UpdateSecurityModeL( )
+    {
+    LOGGER_ENTERFN( "CCmPluginWlan::UpdateSecurityModeL" );
+    
+    TUint32 secmode = GetIntAttributeL( EWlanSecurityMode );
+
+    TUint32 wlaniapid = iIapRecord->iService;
+
+    switch ( secmode )
+        {
+        case EWlanSecModeOpen:
+            {
+            break;
+            }
+        case EWlanSecModeWep:
+            {
+            if ( iWepSecSettings )
+                {
+                delete iWepSecSettings;
+                iWepSecSettings = NULL;
+                }
+            iWepSecSettings = CWEPSecuritySettings::NewL();
+            iWepSecSettings->LoadL( wlaniapid, Session() );
+            break;
+            }
+        case EWlanSecMode802_1x:
+            {
+            if ( iWpaSecSettings )
+                {
+                delete iWpaSecSettings;
+                iWpaSecSettings = NULL;
+                }
+            iWpaSecSettings = 
+                CWPASecuritySettings::NewL( ESecurityMode8021x );
+            iWpaSecSettings->LoadL( wlaniapid, Session() );
+            break;
+            }
+        case EWlanSecModeWpa:
+        case EWlanSecModeWpa2:
+            {
+            if ( iWpaSecSettings )
+                {
+                delete iWpaSecSettings;
+                iWpaSecSettings = NULL;
+                }
+            iWpaSecSettings = 
+                  CWPASecuritySettings::NewL( ESecurityModeWpa );
+            iWpaSecSettings->LoadL( wlaniapid, Session() );
+            break;
+            }
+        case EWlanSecModeWAPI:
+            {
+            if ( iIsWAPISupported )
+                {
+                if ( iWAPISecSettings )
+                    {
+                    delete iWAPISecSettings;
+                    iWAPISecSettings = NULL;
+                    }
+                iWAPISecSettings = CWAPISecuritySettings::NewL();
+                if ( iIapRecord->RecordId() )
+                    {
+                    iWAPISecSettings->LoadL( iIapRecord->RecordId(), Session() );
+                    }
+                }
+            else
+                {
+                User::Leave( KErrCorrupt );
+                }
+            break;
+            }
+        default:
+            {
+            User::Leave( KErrNotSupported );
+            break;
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CCmPluginWlan::CopyAdditionalDataL
+// --------------------------------------------------------------------------
+//
+void CCmPluginWlan::CopyAdditionalDataL( CCmPluginBaseEng& aDestInst ) const
+    {
+    LOGGER_ENTERFN( "CCmPluginWlan::CopyAdditionalDataL" );
+    
+    STATIC_CAST( CCmPluginWlan*, &aDestInst )->
+                    SetAsCopyOf( iIapRecord->iService );
+    }
+    
+
+// --------------------------------------------------------------------------
+// CCmPluginWlan::SetAsCopyOf
+// --------------------------------------------------------------------------
+//
+void CCmPluginWlan::SetAsCopyOf( TUint32 aBaseIapID )
+    {
+    LOGGER_ENTERFN( "CCmPluginWlan::SetAsCopyOf" );
+    
+    iIsCopy = ETrue;
+    
+    iCopiedFromIapId = aBaseIapID;    
+    }
+
+// ---------------------------------------------------------
+// CCmPluginWlan::DeleteSecuritySettingsL
+// ---------------------------------------------------------
+//    
+void CCmPluginWlan::DeleteSecuritySettingsL()
+    {
+    LOGGER_ENTERFN( "CCmPluginWlan::DeleteSecuritySettingsL" );
+
+    TUint32 wlaniapid = iIapRecord->iService;
+    
+    // check security mode and existence of sec.settings
+    if (iWlanServiceRecord->RecordId() )
+        {// ha sat least WLAN service record, may start to wonder...
+        // wlan service record will be deleted separatelly!
+        // get current security mode
+        TUint32 secmode = iWlanServiceRecord->iWlanSecMode;
+     
+        switch ( secmode )
+            {     
+            case EWlanSecModeOpen:
+            case EWlanSecModeWep:
+                {
+                // nothing to do here
+                break;
+                }
+            case EWlanSecMode802_1x:
+                {                
+                if ( !iWpaSecSettings )
+                    {
+                    iWpaSecSettings = 
+                        CWPASecuritySettings::NewL( ESecurityMode8021x );
+                    }
+                iWpaSecSettings->DeleteL( wlaniapid );
+                break;
+                }
+            case EWlanSecModeWpa:
+            case EWlanSecModeWpa2:
+                {
+                if ( !iWpaSecSettings )
+                    {
+                    iWpaSecSettings = 
+                        CWPASecuritySettings::NewL( ESecurityModeWpa );
+                    }
+                iWpaSecSettings->DeleteL( wlaniapid );
+                break;
+                }
+            case EWlanSecModeWAPI:
+                if ( iIsWAPISupported )
+                    {
+                    if ( !iWAPISecSettings )
+                        {
+                        iWAPISecSettings = CWAPISecuritySettings::NewL();
+                        }
+                    TUint32 serviceId = iWlanServiceRecord->RecordId();
+                    iWAPISecSettings->DeleteAPSpecificDataL( serviceId );
+                    }
+                else
+                    {
+                    User::Leave( KErrCorrupt );
+                    }
+                break;
+            default:
+                {
+                User::Leave( KErrNotSupported );
+                // do nothing in urel
+                break;
+                }
+            }
+        }
+    // if there is no wlan service record, 
+    // then there can be no security settings, skipping...
+    }
+
+
+// ---------------------------------------------------------
+// CCmPluginWlan::SetDnsIpFromServer
+// ---------------------------------------------------------
+//    
+void CCmPluginWlan::SetDnsIpFromServerL()
+    {
+    LOGGER_ENTERFN( "CCmPluginWlan::SetDnsIpFromServer" );
+    
+    HBufC* ip1 = GetStringAttributeL( EWlanIpNameServer1 );
+    CleanupStack::PushL( ip1 );
+
+    HBufC* ip2 = GetStringAttributeL( EWlanIpNameServer2 );
+    CleanupStack::PushL( ip2 );
+    
+
+    if ( ( ip1->Compare( KDynIpAddress ) == 0 ) &&
+         ( ip2->Compare( KDynIpAddress ) == 0 ) )
+        {
+        SetBoolAttributeL( EWlanIpDNSAddrFromServer, ETrue );
+        }
+    else
+        {
+        SetBoolAttributeL( EWlanIpDNSAddrFromServer, EFalse );
+        }
+    CleanupStack::PopAndDestroy( 2,ip1 );
+    }
+
+
+// ---------------------------------------------------------
+// CCmPluginWlan::SetDns6IpFromServer
+// ---------------------------------------------------------
+//
+void CCmPluginWlan::SetDns6IpFromServerL()
+    {
+    LOGGER_ENTERFN( "CCmPluginWlan::SetDns6IpFromServer" );
+
+    HBufC* ip1 = GetStringAttributeL( EWlanIp6NameServer1 );
+    CleanupStack::PushL( ip1 );
+
+    HBufC* ip2 = GetStringAttributeL( EWlanIp6NameServer2 );
+    CleanupStack::PushL( ip2 );
+
+    if ( ( ip1->Compare( KDynIpv6Address ) == 0 ) &&
+         ( ip2->Compare( KDynIpv6Address ) == 0 ) )
+        {
+        SetBoolAttributeL( EWlanIp6DNSAddrFromServer, ETrue );
+        }
+    else
+        {
+        SetBoolAttributeL( EWlanIp6DNSAddrFromServer, EFalse );
+        }
+    CleanupStack::PopAndDestroy( 2,ip1 );
+    }
+
+
+// ----------------------------------------------------------------------------
+// CCmPluginWlan::CheckNetworkCoverageL()
+// ----------------------------------------------------------------------------
+//        
+TInt CCmPluginWlan::CheckNetworkCoverageL() const
+    {
+    LOGGER_ENTERFN("CCmPluginWlan::CheckNetworkCoverageL");
+    
+    TInt retVal( 0 ); 
+    
+#ifdef __WINS__
+    retVal = 1;
+#else
+    CCmWlanCoverageCheck* coverage = new (ELeave) CCmWlanCoverageCheck;
+    CleanupStack::PushL( coverage );
+
+    CLOG_WRITE( "Coverage created, calling GetCoverageL" );
+    retVal = coverage->GetCoverageL();
+    CLOG_WRITE( "GetCoverageL returned" );
+    
+    CleanupStack::PopAndDestroy( coverage );
+#endif  // __WINS
+    return retVal;
+    }
+
+
+// ----------------------------------------------------------------------------
+// CCmPluginWlan::ConvertConnectionSecurityModeToSecModeL()
+// ----------------------------------------------------------------------------
+//        
+TWlanSecMode CCmPluginWlan::ConvertConnectionSecurityModeToSecModeL(
+                                    TWlanConnectionExtentedSecurityMode aSecurityMode )
+    {
+    LOGGER_ENTERFN( "CCmPluginWlan::ConvertConnectionSecurityModeToSecModeL " );
+
+    switch( aSecurityMode )
+        {
+        case EWlanConnectionExtentedSecurityModeOpen:
+            {
+            return EWlanSecModeOpen;
+            }
+        
+        case EWlanConnectionExtentedSecurityModeWepOpen:
+        case EWlanConnectionExtentedSecurityModeWepShared:
+            {
+            return EWlanSecModeWep;
+            }
+        
+        case EWlanConnectionExtentedSecurityMode802d1x:
+            {
+            return EWlanSecMode802_1x;
+            }
+        
+        case EWlanConnectionExtentedSecurityModeWpa:
+        case EWlanConnectionExtentedSecurityModeWpaPsk:
+        case EWlanConnectionExtentedSecurityModeWpa2:
+        case EWlanConnectionExtentedSecurityModeWpa2Psk:
+            {
+            return EWlanSecModeWpa;
+            }
+        case EWlanConnectionExtentedSecurityModeWapi:
+        case EWlanConnectionExtentedSecurityModeWapiPsk:
+            {
+            if ( iIsWAPISupported )
+                {
+                return EWlanSecModeWAPI;
+                }
+            else
+                {
+                User::Leave( KErrCorrupt );
+                }
+            }
+        default:
+            {
+            User::Leave( KErrNotSupported );
+            }
+        }
+
+    return EWlanSecModeOpen;
+    }
+
+
+// ----------------------------------------------------------------------------
+// CCmPluginWlan::ConvertSecModeToConnectionSecurityModeL()
+// ----------------------------------------------------------------------------
+//        
+TWlanConnectionExtentedSecurityMode 
+        CCmPluginWlan::ConvertSecModeToConnectionSecurityModeL(
+                                                        TWlanSecMode aSecMode )
+    {
+    LOGGER_ENTERFN( "CCmPluginWlan::ConvertSecModeToConnectionSecurityModeL " );
+
+    switch( aSecMode )
+        {
+        case EWlanSecModeOpen:
+            {
+            return EWlanConnectionExtentedSecurityModeOpen;
+            }
+        
+        case EWlanSecModeWep:
+            {
+            return EWlanConnectionExtentedSecurityModeWepOpen;
+            }
+        
+        case EWlanSecMode802_1x:
+            {
+            return EWlanConnectionExtentedSecurityMode802d1x;
+            }
+        
+        case EWlanSecModeWpa:
+        case EWlanSecModeWpa2:
+            {
+            return EWlanConnectionExtentedSecurityModeWpa;
+            }
+        case EWlanSecModeWAPI:
+            {
+            if ( iIsWAPISupported )
+                {
+                return EWlanConnectionExtentedSecurityModeWapi;
+                }
+            else
+                {
+                User::Leave( KErrCorrupt );
+                }
+            }
+        
+        default:
+            {
+            User::Leave( KErrNotSupported );
+            }
+        }
+
+    return EWlanConnectionExtentedSecurityModeOpen;
+    }
+
+
+// ---------------------------------------------------------
+// CCmPluginWlan::DestroyWaitDialog()
+// ---------------------------------------------------------
+//
+void CCmPluginWlan::DestroyWaitDialog()
+    {
+    LOGGER_ENTERFN( "CCmPluginWlan::DestroyWaitDialog " );
+
+    delete iWaitDialog;
+    iWaitDialog = NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginWlan::SetDaemonNameL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginWlan::SetDaemonNameL()
+    {
+    LOGGER_ENTERFN( "CCmPluginWlan::SetDaemonNameL" );
+
+    // we have to check first that these values has not been 
+    // set(or changed) by any 3rd party sw to ensure that
+    // we don't break their settings
+    HBufC* daemonName = GetStringAttributeL( ECmConfigDaemonManagerName );
+    if ( daemonName )
+        {
+        if ( daemonName->Compare( KDaemonManagerName ) != 0 )
+    	    {
+    	    delete daemonName;
+            return;
+    	    }
+        delete daemonName;
+        }
+        
+    // use DHCP if we can
+    TBool ipfromSrv = GetBoolAttributeL( ECmIPAddFromServer );
+    if ( ipfromSrv )
+        {
+        SetStringAttributeL( ECmConfigDaemonManagerName, 
+                           KDaemonManagerName );
+        SetStringAttributeL( ECmConfigDaemonName, 
+                           KConfigDaemonName );
+        }
+    else
+        {
+        if ( FeatureSupported( KFeatureIdIPv6 ) )
+            {
+            SetStringAttributeL( ECmConfigDaemonManagerName, 
+                               KDaemonManagerName );
+            SetStringAttributeL( ECmConfigDaemonName, 
+                               KConfigDaemonName );
+            }
+        else
+            {
+            SetStringAttributeL( ECmConfigDaemonManagerName, 
+                               KNullDesC() );
+            SetStringAttributeL( ECmConfigDaemonName, 
+                               KNullDesC() );
+            }
+        }
+    }
+    
+    
+// --------------------------------------------------------------------------
+// CCmPluginWlan::ConvertWLANConnectionStatesL
+// --------------------------------------------------------------------------
+//
+TWlanNetMode CCmPluginWlan::ConvertWLANConnectionStatesL(
+                                    TWlanConnectionMode aConnectionMode )
+    {
+    LOGGER_ENTERFN( "CCmPluginWlan::ConvertWLANConnectionStatesL " );
+    
+    switch ( aConnectionMode )
+        {
+        /** Values for possible WLAN connection states. */
+        /** Connection to an infrastructure network is active. */
+        case EWlanConnectionModeInfrastructure:    
+            {
+            return EInfra;
+            }
+        /** Connection to an ad-hoc network is active. */
+        case EWlanConnectionModeAdhoc:
+            {
+            return EAdhoc;
+            }
+        default:
+        	/**
+        	 * The connection mode. This can be either Ad-hoc or infrastructure.
+        	 * TWlanNetMode enum is to be used.
+        	 * ( TUint32 - default: EInfra )
+        	 */
+            {
+            return EInfra;
+            }
+        }
+    }
+  
+// ---------------------------------------------------------------------------
+// CCmPluginWlan::GetAdditionalUids
+// ---------------------------------------------------------------------------
+//
+void CCmPluginWlan::GetAdditionalUids( RArray<TUint32>& aIapIds )
+    {
+    for (TInt i = 0; i<iAdditionalCmsCreated.Count(); i++ )
+        {
+        aIapIds.Append(iAdditionalCmsCreated[i]);
+        }
+    }
+    
+// --------------------------------------------------------------------------
+// CCmPluginWlan::EnterWAPIPreSharedKeyL
+// --------------------------------------------------------------------------
+//
+TBool CCmPluginWlan::EnterWAPIPreSharedKeyL()
+    {
+    LOGGER_ENTERFN( "CCmPluginWlan::EnterWAPIPreSharedKeyL" );
+    
+    TBool retVal ( EFalse );
+    
+    HBufC* key = HBufC::NewLC( KWlanMaxKeyLength );
+    TPtr keyPtr( key->Des() );
+
+    if ( !iConnUiUtils )
+        {
+        iConnUiUtils = CConnectionUiUtilities::NewL();
+        }
+    
+    if ( iConnUiUtils->EasyWapiDlg( &keyPtr ) )
+        {
+        if ( !iWAPISecSettings )
+            {
+            iWAPISecSettings = CWAPISecuritySettings::NewL();
+            }
+        iWAPISecSettings->SetPreSharedKeyL( CWAPISecuritySettings::EWapiKeyAscii, *key );
+        retVal = ETrue;
+        }
+    CleanupStack::PopAndDestroy( key );
+    
+    return retVal;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginwlan/src/cmpluginwlandata.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,78 @@
+/*
+* 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 WLan network data holder class
+*
+*/
+
+#include <e32std.h>
+#include "cmpluginwlandata.h"
+#include "cmlogger.h"
+
+
+
+
+// --------------------------------------------------------------------------
+// CCmPluginWlanData::NewLC
+// --------------------------------------------------------------------------
+//
+CCmPluginWlanData* CCmPluginWlanData::NewLC()
+    {
+    CCmPluginWlanData* self = new( ELeave ) CCmPluginWlanData();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;    
+    }
+    
+    
+
+// --------------------------------------------------------------------------
+// CCmPluginWlanData::~CCmPluginWlanData
+// --------------------------------------------------------------------------
+//
+CCmPluginWlanData::~CCmPluginWlanData()
+    {
+    LOGGER_ENTERFN( "CCmPluginWlanData::~CCmPluginWlanData" );
+    
+    delete iNetworkName;
+    iNetworkName = NULL;
+    CLOG_CLOSE;
+    }
+    
+    
+
+
+// --------------------------------------------------------------------------
+// CCmPluginWlanData::CCmPluginWlanData
+// --------------------------------------------------------------------------
+//
+CCmPluginWlanData::CCmPluginWlanData()
+    {
+    CLOG_CREATE;
+    }
+
+
+
+
+// --------------------------------------------------------------------------
+// CCmPluginWlanData::ConstructL
+// --------------------------------------------------------------------------
+//
+void CCmPluginWlanData::ConstructL()
+    {
+    LOGGER_ENTERFN( "CCmPluginWlanData::ConstructL" );
+    
+    iNetworkName = NULL;
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginwlan/src/cmpluginwlandataarray.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,56 @@
+/*
+* 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 WLan network data holder class
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "cmpluginwlandata.h"
+#include "cmpluginwlandataarray.h"
+
+
+// CONSTANTS
+
+LOCAL_D const TInt KGranularity = 4;    ///< Granularity of the list.
+
+// ================= MEMBER FUNCTIONS =======================
+
+// C++ default constructor can NOT contain any code that
+// might leave.
+//
+// ---------------------------------------------------------
+// CCmPluginWlanDataArray::CCmPluginWlanDataArray
+// ---------------------------------------------------------
+//
+CCmPluginWlanDataArray::CCmPluginWlanDataArray()
+: CArrayPtrFlat<CCmPluginWlanData>( KGranularity )
+    {
+    }
+
+// Destructor
+// ---------------------------------------------------------
+// CCmPluginWlanDataArray::~CCmPluginWlanDataArray
+// ---------------------------------------------------------
+//
+CCmPluginWlanDataArray::~CCmPluginWlanDataArray()
+    {
+
+    ResetAndDestroy();
+
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginwlan/src/cmpluginwlanproxy.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,36 @@
+/*
+* 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 WLan Plugin proxy table
+*
+*/
+
+#include "cmpluginwlan.h"
+#include <e32std.h>
+#include <ecom/implementationproxy.h>
+
+// Exported proxy for instantiation method resolution
+// Define the interface UIDs
+const TImplementationProxy ImplementationTable[] = 
+	{
+	IMPLEMENTATION_PROXY_ENTRY( KUidWlanBearerType, CCmPluginWlan::NewL )
+	};
+
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( 
+                                                        TInt& aTableCount )
+	{
+	aTableCount = sizeof( ImplementationTable ) / 
+	                                        sizeof( TImplementationProxy );
+
+	return ImplementationTable;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginwlan/src/cmpwlanactivewaiter.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,103 @@
+/*
+* 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:  Implementation of CCmPluginWlanActiveWaiter.
+*
+*/
+
+
+// INCLUDE FILES
+#include "cmpwlanactivewaiter.h"
+
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CCmPluginWlanActiveWaiter* CCmPluginWlanActiveWaiter::NewL()
+// ---------------------------------------------------------
+//
+CCmPluginWlanActiveWaiter* CCmPluginWlanActiveWaiter::NewL( )
+    {
+    CCmPluginWlanActiveWaiter* self = 
+                         new ( ELeave ) CCmPluginWlanActiveWaiter( );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    
+    return self;        
+    }
+
+// ---------------------------------------------------------
+// CCmPluginWlanActiveWaiter::ConstructL()
+// ---------------------------------------------------------
+//
+void CCmPluginWlanActiveWaiter::ConstructL()
+    {     
+    CActiveScheduler::Add( this );            
+    }
+
+
+// ---------------------------------------------------------
+// CCmPluginWlanActiveWaiter::CCmPluginWlanActiveWaiter()
+// ---------------------------------------------------------
+//
+CCmPluginWlanActiveWaiter::CCmPluginWlanActiveWaiter( )
+: CActive( KErrNone )
+    {
+    }
+    
+
+// ---------------------------------------------------------
+// CCmPluginWlanActiveWaiter::~CCmPluginWlanActiveWaiter()
+// ---------------------------------------------------------
+//    
+CCmPluginWlanActiveWaiter::~CCmPluginWlanActiveWaiter()
+    {
+    Cancel();
+    }
+
+
+// ---------------------------------------------------------
+// CCmPluginWlanActiveWaiter::DoCancel()
+// ---------------------------------------------------------
+// 
+void CCmPluginWlanActiveWaiter::DoCancel()
+    {
+    }
+     
+ 
+// ---------------------------------------------------------
+// CCmPluginWlanActiveWaiter::RunL()
+// ---------------------------------------------------------
+//     
+void CCmPluginWlanActiveWaiter::RunL()
+    {
+    if ( iWait.IsStarted() )
+        {
+        iWait.AsyncStop();
+        }
+    }
+
+// ---------------------------------------------------------
+// CCmPluginWlanActiveWaiter::WaitForRequest()
+// ---------------------------------------------------------
+// 
+TInt CCmPluginWlanActiveWaiter::WaitForRequest()
+    {
+    SetActive(); 
+    iWait.Start();
+    return iStatus.Int();
+    }    
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginwlan/src/cmpwlansettingsdlg.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,958 @@
+/*
+* 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:  Dialog for editing wlan settings for a wlan connection method
+*
+*/
+
+#include <badesca.h>
+#include <cmcommonui.h>
+#include <WEPSecuritySettingsUI.h>
+#include <WPASecuritySettingsUI.h>
+#include <wapisecuritysettingsui.h>
+#include <StringLoader.h>
+#include <akntextsettingpage.h>
+#include <cmwlanui.rsg>
+#include <ConnectionUiUtilities.h>
+#include <csxhelp/cp.hlp.hrh>
+#include <featmgr.h>
+#include "cmlogger.h"
+#include "cmwlancommonconstants.h"
+#include "cmpwlansettingsdlg.h"
+#include "cmpwlansettingsdlgadv.h"
+#include <cmpluginwlandef.h>
+#include "cmpluginwlan.h"
+#include "cmpluginmenucommands.hrh"
+#include <cmcommonconstants.h>
+#include <cmpsettingsconsts.h>
+#include "cmmanagerimpl.h"
+
+using namespace CMManager;
+
+const TUint32 KScanSSIDSelectionItems[] = 
+    {
+    R_QTN_WLAN_SETT_HIDDEN_NETWORK_NO,
+    R_QTN_WLAN_SETT_HIDDEN_NETWORK_YES,
+    0
+    };
+
+const TUint32 KSecModeRBSelectionItems[] = 
+    {
+    R_QTN_WLAN_SETT_SECURITY_MODE_OPEN,
+    R_QTN_WLAN_SETT_SECURITY_MODE_WEP,
+    0
+    };
+
+const TUint32 KSecModeRBIRSelectionItems[] = 
+    {
+    R_QTN_WLAN_SETT_SECURITY_MODE_OPEN,
+    R_QTN_WLAN_SETT_SECURITY_MODE_WEP,
+    R_QTN_WLAN_SETT_SECURITY_MODE_802_1X,
+    R_QTN_WLAN_SETT_SECURITY_MODE_WPA,
+    0
+    };
+
+const TUint32 KSecModeRBIRSelectionItemsWAPI[] = 
+    {
+    R_QTN_WLAN_SETT_SECURITY_MODE_OPEN,
+    R_QTN_WLAN_SETT_SECURITY_MODE_WEP,
+    R_QTN_WLAN_SETT_SECURITY_MODE_802_1X,
+    R_QTN_WLAN_SETT_SECURITY_MODE_WPA,
+    R_QTN_WLAN_SETT_SECURITY_MODE_WAPI,
+    0
+    };
+
+const TUint32 KNetworkRBSelectionItems[] = 
+    {
+    R_QTN_WLAN_SETT_NETWORK_MODE_INFRA,
+    R_QTN_WLAN_SETT_NETWORK_MODE_ADHOC,
+    0
+    };
+
+const TUint32 KNWNameSelectionItems[] = 
+    {
+    R_QTN_WLAN_SETT_NETWORK_NAME_USER_DEFINED,
+    R_QTN_WLAN_SETT_NETWORK_NAME_SCAN,
+    0
+    };
+    
+// ================= MEMBER FUNCTIONS =======================================
+
+// --------------------------------------------------------------------------
+// CmPluginWlanSettingsDlg::NewL()
+// --------------------------------------------------------------------------
+//
+CmPluginWlanSettingsDlg* CmPluginWlanSettingsDlg::NewL( 
+                                            CCmPluginBaseEng& aCmPluginBase )
+	{
+	CmPluginWlanSettingsDlg* self = 
+	                new (ELeave) CmPluginWlanSettingsDlg( aCmPluginBase );
+	return self;
+	}
+	
+// --------------------------------------------------------------------------
+// CmPluginWlanSettingsDlg::CmPluginWlanSettingsDlg()
+// --------------------------------------------------------------------------
+//
+CmPluginWlanSettingsDlg::CmPluginWlanSettingsDlg(
+                                            CCmPluginBaseEng& aCmPluginBase )
+    : CmPluginBaseSettingsDlg( aCmPluginBase )
+    , iNotifyFromAdv( KCmNotifiedNone )
+    {
+    
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginWlanSettingsDlg::ConstructAndRunLD
+// --------------------------------------------------------------------------
+//
+TInt CmPluginWlanSettingsDlg::ConstructAndRunLD( )
+    {
+    LoadResourceL( KPluginWlanResDirAndFileName );
+    
+    CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
+    cmMgr.WatcherRegisterL( this );
+    
+    return CmPluginBaseSettingsDlg::ConstructAndRunLD( );
+    }
+
+// ---------------------------------------------------------
+// CmPluginWlanSettingsDlg::~CmPluginWlanSettingsDlg
+// Destructor
+// ---------------------------------------------------------
+//
+CmPluginWlanSettingsDlg::~CmPluginWlanSettingsDlg()
+    {
+    iResourceReader.Close();
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginWlanSettingsDlg::RunAdvancedSettingsL
+// --------------------------------------------------------------------------
+//
+void CmPluginWlanSettingsDlg::RunAdvancedSettingsL()
+    {
+    CmPluginWlanSettingsDlgAdv* AdvDlg = 
+                        CmPluginWlanSettingsDlgAdv::NewL( iCmPluginBaseEng );
+
+    if (!iHasSettingChanged)
+        {
+        iHasSettingChanged = ETrue;
+        }                      
+    
+    // This view may have to un-register as watcher here
+    CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
+    cmMgr.WatcherUnRegister();
+    
+    AdvDlg->RegisterParentView( this );
+    TInt ret = AdvDlg->ConstructAndRunLD();
+
+    if( iNotifyFromAdv == KCmNotifiedNone )
+        {
+        if( ret == KDialogUserExit )
+            {
+            iExitReason = KDialogUserExit;
+            ExitSettingsL(EFalse);
+            }
+        else
+            {
+            // Re-register as watcher if advanced view comes back or exists normally
+            cmMgr.WatcherRegisterL( this );
+            }
+        }
+    else
+        {
+        HandleCommsDatChangeL();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginBaseSettingsDlg::UpdateListBoxContentBearerSpecificL
+// --------------------------------------------------------------------------
+//
+void CmPluginWlanSettingsDlg::UpdateListBoxContentBearerSpecificL( 
+                                                    CDesCArray& aItemArray )
+    {
+    TBool boolSettingVal( EFalse ); // just for helping make code readable
+    TInt valResId(0);
+    
+    // DATA BEARER - only for real bearer types
+    AppendSettingTextsL( aItemArray, ECmBearerSettingName );
+    // NETWORK NAME
+    AppendSettingTextsL( aItemArray, EWlanSSID );
+    // NETWORK STATUS
+    boolSettingVal = iCmPluginBaseEng.GetBoolAttributeL( EWlanScanSSID );
+    AppendSettingTextsL( aItemArray,
+                         EWlanScanSSID,
+                         boolSettingVal ? 
+                            R_QTN_WLAN_SETT_HIDDEN_NETWORK_YES :
+                            R_QTN_WLAN_SETT_HIDDEN_NETWORK_NO );
+    // WLAN NETWORK MODE    
+    switch( iCmPluginBaseEng.GetIntAttributeL( EWlanConnectionMode ) )
+        {
+        case EAdhoc:
+            {
+            valResId = R_QTN_WLAN_SETT_NETWORK_MODE_ADHOC;
+            break;
+            }
+        case EInfra:
+            // fall-through intended here
+        default:
+            {
+            valResId = R_QTN_WLAN_SETT_NETWORK_MODE_INFRA;
+            break;
+            }
+        }
+    
+    AppendSettingTextsL( aItemArray, EWlanConnectionMode, valResId );
+    // WLAN SECURITY MODE
+    switch( iCmPluginBaseEng.GetIntAttributeL( EWlanSecurityMode ) )
+        {
+        case EWlanSecModeWep :
+            {
+            valResId = R_QTN_WLAN_SETT_SECURITY_MODE_WEP;
+            break;
+            }
+        case EWlanSecMode802_1x:
+            {
+            valResId = R_QTN_WLAN_SETT_SECURITY_MODE_802_1X;
+            break;
+            }
+        case EWlanSecModeWpa:
+        case EWlanSecModeWpa2:
+            {
+            valResId = R_QTN_WLAN_SETT_SECURITY_MODE_WPA;
+            break;
+            }
+        case EWlanSecModeWAPI:
+            {
+            valResId = R_QTN_WLAN_SETT_SECURITY_MODE_WAPI;
+            break;
+            }
+        case EWlanSecModeOpen:
+            // fall-through intended here
+        default:
+            {
+            valResId = R_QTN_WLAN_SETT_SECURITY_MODE_OPEN;
+            break;
+            }
+        }
+    AppendSettingTextsL( aItemArray, EWlanSecurityMode, valResId );
+    // WLAN SECURITY SETTINGS
+    AppendSettingTextsL( aItemArray,
+                         EWlanSecuritySettings,
+                         R_QTN_WLAN_SETT_SECURITY_SETTINGS,
+                         0 );
+    // HOMEPAGE
+    AppendSettingTextsL( aItemArray, ECmStartPage );
+    }
+
+    
+//---------------------------------------------------------------------------
+// CmPluginWlanSettingsDlg::ChangeBoolSettingL
+//---------------------------------------------------------------------------
+//
+void CmPluginWlanSettingsDlg::ChangeBoolSettingL( TUint32 aAttribute, 
+                                                  TInt aCommandId )
+    {
+    // Change was selected from menu
+    if ( aCommandId == EPluginBaseCmdChange )
+        {
+        TInt selected = 
+                    iCmPluginBaseEng.GetBoolAttributeL( aAttribute );
+        TInt origVal = selected;
+                    
+        if ( ShowRadioButtonSettingPageL( KScanSSIDSelectionItems, 
+                                          selected,
+                                          R_QTN_WLAN_SETT_HIDDEN_NETWORK ) &&
+             origVal != selected )
+             {
+             iCmPluginBaseEng.SetBoolAttributeL( aAttribute, 
+                                                 selected );
+             UpdateListBoxContentL();
+             }
+        }
+    // Selection key was selected
+    else        
+        {
+        switch ( aAttribute )
+            {
+            case EWlanScanSSID:
+                {        
+                TBool boolFromCM = EFalse;
+                boolFromCM = iCmPluginBaseEng.GetBoolAttributeL( aAttribute );
+                iCmPluginBaseEng.SetBoolAttributeL( aAttribute , !boolFromCM );
+                UpdateListBoxContentL();              
+                break;
+                }
+            case EWlanConnectionMode:
+                {        
+                TInt intFromCM = 0;
+                intFromCM = iCmPluginBaseEng.GetIntAttributeL( aAttribute );
+                iCmPluginBaseEng.SetIntAttributeL( aAttribute , !intFromCM );
+                UpdateListBoxContentL();              
+                break;
+                }
+            }
+        }
+    }
+
+//---------------------------------------------------------------------------
+// CmPluginWlanSettingsDlg::ShowSecurityModeRBPageL
+//---------------------------------------------------------------------------
+//
+void CmPluginWlanSettingsDlg::ShowSecurityModeRBPageL()
+    {   
+    TInt selected = 0;
+    TInt secMode = iCmPluginBaseEng.GetIntAttributeL( EWlanSecurityMode );
+    const TUint32* items = NULL;
+    
+    //converting secMode to idex
+    switch ( secMode ) 
+        {
+        case EWlanSecModeOpen:
+            {
+            selected = 0;
+            break;
+            }
+        case EWlanSecModeWep:
+            {
+            selected = 1;
+            break;
+            }
+        case EWlanSecMode802_1x:
+            {
+            selected = 2;
+            break;
+            }
+        case EWlanSecModeWpa:
+            {
+            selected = 3;
+            break;
+            }
+        // is this a real case?
+        case EWlanSecModeWpa2:
+            {
+            selected = 3;
+            break;
+            }
+        case EWlanSecModeWAPI:
+            {
+            selected = 4;
+            break;
+            }
+        default:
+            {
+            User::Leave( KErrNotSupported );
+            break;
+            }
+        }
+        
+    if ( iCmPluginBaseEng.GetIntAttributeL( EWlanConnectionMode ) == EInfra )
+        {
+        if ( !FeatureManager::FeatureSupported( KFeatureIdFfWlanWapi ) )
+            {
+            items = KSecModeRBIRSelectionItems;
+            }
+        else
+            {
+            items = KSecModeRBIRSelectionItemsWAPI;
+            }
+        }
+    else
+        {
+        items = KSecModeRBSelectionItems;
+        }
+
+    TInt origVal = selected;
+    if ( ShowRadioButtonSettingPageL( items, 
+                                      selected, 
+                                      R_QTN_WLAN_SETT_SECURITY_MODE ) && 
+                                      origVal != selected )
+        {
+        if ( !iHasSettingChanged )
+            {
+            iHasSettingChanged = ETrue;
+            }
+		
+        switch ( selected )
+            {
+            case 0:
+                {
+                secMode = EWlanSecModeOpen;
+                break;
+                }
+            case 1:
+                {
+                secMode = EWlanSecModeWep;
+                break;
+                }
+            case 2:
+                {
+                secMode = EWlanSecMode802_1x;
+                break;
+                }
+            case 3:
+                {
+                secMode = EWlanSecModeWpa;
+                break;
+                }
+            case 4:
+                {
+                secMode = EWlanSecModeWAPI;
+                break;
+                }
+            default:
+                {
+                User::Leave( KErrNotSupported );
+                break;
+                }
+            }
+        iCmPluginBaseEng.SetIntAttributeL( EWlanSecurityMode , secMode );
+        UpdateListBoxContentL();
+        }
+    }
+
+//---------------------------------------------------------------------------
+// CmPluginWlanSettingsDlg::ShowNetworkModeRBPageL
+//---------------------------------------------------------------------------
+//
+void CmPluginWlanSettingsDlg:: ShowNetworkModeRBPageL()
+    {   
+    const TUint32* items = KNetworkRBSelectionItems;
+    
+    TInt selected;
+    
+    // convert values to indices for UI
+    TInt netMode = iCmPluginBaseEng.GetIntAttributeL( EWlanConnectionMode );
+    switch ( netMode )
+        {
+        case EAdhoc:
+            {
+            selected = 1;
+            break;
+            }
+        case EInfra:
+            {
+            selected = 0;
+            break;
+            }
+        }
+    
+    TInt origVal = selected;
+    if ( ShowRadioButtonSettingPageL( items, 
+                                      selected,
+                                      R_QTN_WLAN_SETT_NETWORK_MODE ) && 
+         origVal != selected )
+        {
+        // convert indices back to proper values
+        switch ( selected )
+            {
+            case 0:
+                {
+                netMode = EInfra;
+                break;
+                }
+            case 1:
+                {
+                netMode = EAdhoc;
+                TInt secMode = iCmPluginBaseEng.GetIntAttributeL( 
+                                                        EWlanSecurityMode );
+                if( secMode != EWlanSecModeOpen &&
+                    secMode != EWlanSecModeWep )
+                    {
+                    iCmPluginBaseEng.SetIntAttributeL( EWlanSecurityMode,
+                                                       EWlanSecModeOpen );
+                    }
+                break;
+                }
+            default:
+                {
+                User::Leave( KErrNotSupported );
+                break;
+                }
+            }
+        iCmPluginBaseEng.SetIntAttributeL( EWlanConnectionMode , netMode );
+        UpdateListBoxContentL();
+        }    
+    }  
+
+//---------------------------------------------------------------------------
+// CmPluginWlanSettingsDlg::ShowWlanNWNamePageL
+//---------------------------------------------------------------------------
+//
+void CmPluginWlanSettingsDlg::ShowWlanNWNamePageL()
+    {
+    const TCmAttribConvTable* convItem = 
+                        iCmPluginBaseEng.ConvTableItem( EWlanSSID );
+    
+    const TUint32* items = KNWNameSelectionItems;
+    TInt selected ( EWlanNwNameUserDefined );
+    
+    // Display a radio button page with options: User defined and Scan for Networks
+    if ( ShowRadioButtonSettingPageL( items, 
+                                      selected,
+                                      R_QTN_WLAN_SETT_NETWORK_NAME ) )
+        {
+        if ( selected == EWlanNwNameUserDefined )
+            {
+            HBufC* oldssId = iCmPluginBaseEng.GetStringAttributeL( EWlanSSID );
+            CleanupStack::PushL( oldssId );
+            
+            TBuf<KCmWlanNWNameMaxLength> buf;
+            buf.Copy( *oldssId );
+
+            if ( TCmCommonUi::ShowConfirmationQueryWithInputL(
+                                           R_QTN_WLAN_PRMPT_NETWORK_NAME,
+                                           buf ) )
+                {
+                if( buf.Compare( *oldssId ) )
+                    // SSID is changed
+                    {
+                    iCmPluginBaseEng.SetStringAttributeL( EWlanSSID, buf );
+                    UpdateListBoxContentL();
+                    }
+                }
+            CleanupStack::PopAndDestroy( oldssId );
+            }
+        else
+            {
+            // Let's search for a WLAN network
+            TWlanSsid ssid;
+            TWlanConnectionMode connectionMode;
+            TWlanConnectionSecurityMode securityMode;
+
+            CConnectionUiUtilities* uiUtils = CConnectionUiUtilities::NewL();
+            CleanupStack::PushL( uiUtils );
+
+            if ( uiUtils->SearchWLANNetwork( ssid, connectionMode, securityMode ) )
+                {
+                HBufC* temp = HBufC::NewLC( convItem->iMaxLength );
+                temp->Des().Copy( ssid );
+                iCmPluginBaseEng.SetStringAttributeL( EWlanSSID, *temp );
+                CleanupStack::PopAndDestroy( temp );
+                
+                UpdateListBoxContentL();
+                }                
+            CleanupStack::PopAndDestroy( uiUtils );
+            }
+        }
+    }
+
+//---------------------------------------------------------------------------
+// CmPluginWlanSettingsDlg::ShowPopupSettingPageL
+//---------------------------------------------------------------------------
+//
+TBool CmPluginWlanSettingsDlg::ShowPopupSettingPageL( TUint32 aAttribute, 
+                                                      TInt aCommandId )
+    {    
+    TBool retval = EFalse;
+    switch( aAttribute )
+        {
+        // Boolean settings
+        case EWlanScanSSID:            
+            {
+            ChangeBoolSettingL( aAttribute, aCommandId );
+            break;
+            }
+        // Textual Settings
+        case ECmStartPage:                
+            {
+            ShowPopupTextSettingPageL( aAttribute );
+            break;
+            }
+        case EWlanSecurityMode:            
+            {
+            ShowSecurityModeRBPageL();
+            break;
+            }
+        case EWlanSecuritySettings:
+            {
+            TInt secmode = iCmPluginBaseEng.GetIntAttributeL( EWlanSecurityMode );
+            if(  secmode == EWlanSecModeOpen )
+                {
+                TCmCommonUi::ShowNoteL( R_QTN_WLAN_INFO_NO_SECURITY_SETTINGS, 
+                                        TCmCommonUi::ECmInfoNote);
+                }
+            else
+                {
+                TInt exitValue = 
+                    STATIC_CAST( CCmPluginWlan*, &iCmPluginBaseEng )->
+                           EditSecuritySettingsL( *( CEikonEnv::Static() ) );
+                if ( secmode == EWlanSecModeWep )
+                    { // WEP
+                    if ( exitValue & CWEPSecuritySettings::EExitReq )
+                        {
+                        iSecDialExit = ETrue;
+                        iExitReason = KDialogUserExit;
+                        ExitSettingsL(EFalse);
+                        }                    
+                    }
+                else if ( secmode == EWlanSecModeWAPI )
+                    {
+                    if ( exitValue & CWAPISecuritySettings::EExitReq )
+                        {
+                        iSecDialExit = ETrue;
+                        iExitReason = KDialogUserExit;
+                        ExitSettingsL(EFalse);
+                        }
+                    }
+                else
+                    {// 802.1x, WPA/WPA2
+                    if ( exitValue & CWPASecuritySettings::EExitReq )
+                        {
+                        iSecDialExit = ETrue;
+                        iExitReason = KDialogUserExit;
+                        ExitSettingsL(EFalse);
+                        }
+                    }
+                }
+            break;
+            }
+        case EWlanConnectionMode:
+            {
+            if ( aCommandId == EPluginBaseCmdChange )
+                {
+                ShowNetworkModeRBPageL();
+                }
+            else
+                {
+                TInt netMode = 
+                    iCmPluginBaseEng.GetIntAttributeL( EWlanConnectionMode );
+                // OK has been used: switch the value without opening the setting page
+                if ( netMode == EInfra )
+                    {
+                    netMode = EAdhoc;
+                    TInt secMode = iCmPluginBaseEng.GetIntAttributeL( 
+                                                            EWlanSecurityMode );
+                    if( secMode != EWlanSecModeOpen &&
+                        secMode != EWlanSecModeWep )
+                        {
+                        iCmPluginBaseEng.SetIntAttributeL( EWlanSecurityMode,
+                                                           EWlanSecModeOpen );
+                        }
+                    }
+                else
+                    {
+                    netMode = EInfra;
+                    }
+                iCmPluginBaseEng.SetIntAttributeL( EWlanConnectionMode, netMode );
+                UpdateListBoxContentL();
+                }
+            break;
+            }
+        case EWlanSSID:
+            {
+            ShowWlanNWNamePageL();
+            break;
+            }
+        default:
+            {
+            CmPluginBaseSettingsDlg::ShowPopupSettingPageL( aAttribute, 
+                                                            aCommandId );
+            break;            
+            }
+        }
+    return retval;
+    }
+    
+        
+// --------------------------------------------------------------------------
+// CmPluginWlanSettingsDlg::ExitSettingsL
+// --------------------------------------------------------------------------
+//
+void CmPluginWlanSettingsDlg::ExitSettingsL( TBool aConfirm )
+    {
+     if ( STATIC_CAST( CCmPluginWlan*, &iCmPluginBaseEng )->
+                                            AreSecuritySettingsValidL()  )
+        {
+        if ( iIsPossibleToSaveSetting && iHasSettingChanged )
+            {
+            iCmPluginBaseEng.UpdateL();
+            iHasSettingChanged = EFalse;
+            }
+        TryExitL( iExitReason );
+        }
+     else
+        {
+        HBufC* netwName = iCmPluginBaseEng.GetStringAttributeL( EWlanSSID );
+        TBool noNetwName = ETrue;
+        CleanupStack::PushL( netwName );
+        if ( *netwName != KNullDesC )
+            {
+            noNetwName = EFalse;
+            }
+        CleanupStack::PopAndDestroy( netwName );
+        
+        if ( noNetwName )
+            {
+            if ( aConfirm )
+                {                    
+                if ( TCmCommonUi::ShowConfirmationQueryL( 
+                                    R_QTN_WLAN_QUEST_NW_NAME_NOT_DEFINED ) )
+                    {
+                    iExitReason = KDialogUserDelete;
+                    TryExitL( iExitReason );
+                    }
+                else
+                    {
+                    // Find the index of the EWlanSSID item
+                    for ( TInt i = 0; i < iSettingIndex->Count(); i++ )
+                        {
+                        if ( iSettingIndex->At(i) == EWlanSSID )
+                            {
+                            SelectItem(i);
+                            break;
+                            }
+                        }
+                    }
+                }
+            else
+                {
+                TryExitL( iExitReason );
+                }
+            }
+        else
+            {
+            if ( iCmPluginBaseEng.GetIntAttributeL( EWlanSecurityMode ) == 
+                                                           EWlanSecModeOpen )
+                {
+                if ( iIsPossibleToSaveSetting && iHasSettingChanged)
+                {
+                    iCmPluginBaseEng.UpdateL();
+                    iHasSettingChanged = EFalse;
+                }
+                TryExitL( iExitReason );
+                }
+            else
+                {
+                if ( aConfirm )
+                    {                    
+                    if ( TCmCommonUi::ShowConfirmationQueryL( 
+                            R_QTN_WLAN_QUEST_SECURITY_SETTINGS_EMPTY ) )
+                        {
+                        iExitReason = KDialogUserDeleteConfirmed;
+                        TryExitL( iExitReason );
+                        }
+                     else                    
+                        {
+                        // Show the securitysettings page for WEP, other security mode
+                        // is not supported here(WPA has a default value)...
+                        ShowPopupSettingPageL( EWlanSecuritySettings, EWlanSecModeWep );
+                        }
+                    }
+                else
+                    {
+                    TryExitL( iExitReason );
+                    }
+                }
+            }
+        }
+    }
+
+
+// --------------------------------------------------------------------------
+// CmPluginWlanSettingsDlg::OkToExitL
+// Good to know : EAknSoftkeyCancel is never called, because
+// EEikDialogFlagNotifyEsc flag is not set in the resource.
+// --------------------------------------------------------------------------
+//
+TBool CmPluginWlanSettingsDlg::OkToExitL( TInt aButtonId )
+    {
+    // Translate the button presses into commands for the appui & current
+    // view to handle
+    TBool retval( EFalse );
+    
+    switch ( aButtonId )
+        {
+        case EAknSoftkeyOk:
+        case EAknSoftkeyChange:
+            {
+            ProcessCommandL( aButtonId );
+            break;
+            }        
+        case EAknSoftkeyBack:
+            {
+            ProcessCommandL( aButtonId );
+            break;
+            }
+        case EAknSoftkeyOptions:
+            {
+            DisplayMenuL();
+            break;
+            }
+        case KDialogUserExit:
+            {
+            if ( iSecDialExit )
+                {
+                iSecDialExit = EFalse;
+                }
+            retval=ETrue;
+            break;
+            }
+        default:
+            {
+            retval = ETrue;
+            break;
+            }
+        }
+
+    return retval;
+    }
+
+
+// --------------------------------------------------------------------------
+// CmPluginWlanSettingsDlg::ProcessCommandL
+// --------------------------------------------------------------------------
+//
+void CmPluginWlanSettingsDlg::ProcessCommandL( TInt aCommandId )
+    {
+    if ( MenuShowing() )
+        {
+        HideMenu();
+        }
+
+    switch ( aCommandId )
+        {
+        case EPluginBaseCmdExit:
+            {
+            iExitReason = KDialogUserExit;
+            }            
+        case EAknSoftkeyBack:
+            {
+            CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
+            cmMgr.WatcherUnRegister();
+            
+            ExitSettingsL(ETrue);
+            break;
+            }           
+        case EPluginBaseCmdAdvanced:
+            {
+            RunAdvancedSettingsL();
+            break;
+            }
+        case EPluginBaseCmdChange:
+        case EAknSoftkeyOk:
+            {
+            TUint32 attrib = iSettingIndex->At( iListbox->CurrentItemIndex() );
+            ShowPopupSettingPageL( attrib, aCommandId );
+            break;
+            }
+        default:
+            {
+            CmPluginBaseSettingsDlg::ProcessCommandL( aCommandId );
+            break;            
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginWlanSettingsDlg::GetHelpContext
+// --------------------------------------------------------------------------
+//
+void CmPluginWlanSettingsDlg::GetHelpContext( TCoeHelpContext& aContext ) const
+    {
+    LOGGER_ENTERFN( "CmPluginWlanSettingsDlg::GetHelpContext" );	
+    aContext.iMajor = KHelpUidPlugin;
+    aContext.iContext = KSET_HLP_AP_SETTING_WLAN;
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginWlanSettingsDlg::CommsDatChangesL
+// --------------------------------------------------------------------------
+//
+void CmPluginWlanSettingsDlg::CommsDatChangesL()
+    {
+    CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
+    CCmDestinationImpl* parentDest = iCmPluginBaseEng.ParentDestination();
+
+    if ( parentDest )
+        {
+        if( !cmMgr.DestinationStillExistedL( parentDest ) )
+            {
+            cmMgr.WatcherUnRegister();
+            // If parent destination is deleted by somebody then the dialog must exit back to main view
+            iExitReason = KDialogUserExit;
+            TryExitL( iExitReason );
+            
+            cmMgr.RemoveDestFromPool( parentDest );
+            delete parentDest;
+            return;
+            }
+        
+        if( !cmMgr.IsIapStillInDestL( parentDest, iCmPluginBaseEng ) )
+            {
+            cmMgr.WatcherUnRegister();
+            // In this case, the dialog can go back to the parent view
+            TryExitL( iExitReason );
+            
+            cmMgr.RemoveDestFromPool( parentDest );
+            delete parentDest;
+            return;            
+            }
+
+        // We may have to go back to parent view even though this Iap is still in CommsDat
+        // for cmMgr ( = iCmPluginBaseEng.CmMgr() ) can not be accessed any more
+        // after this call when some Iap is deleted.
+        cmMgr.WatcherUnRegister();
+        TryExitL( iExitReason );
+                
+        cmMgr.RemoveDestFromPool( parentDest );
+        delete parentDest;
+        }
+    else
+        {
+        if( !cmMgr.IapStillExistedL( iCmPluginBaseEng ) )
+            {
+            cmMgr.WatcherUnRegister();
+            // In this case, the dialog can go back to the parent view
+            TryExitL( iExitReason );
+            return;
+            }
+            
+        // We may have to go back to parent view even though this Iap is still in CommsDat
+        // for cmMgr ( = iCmPluginBaseEng.CmMgr() ) can not be accessed any more
+        // after this call when some Iap is deleted.
+        cmMgr.WatcherUnRegister();
+        TryExitL( iExitReason );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginWlanSettingsDlg::NotifyParentView
+// --------------------------------------------------------------------------
+//
+void CmPluginWlanSettingsDlg::NotifyParentView( TInt aValue )
+    {
+    iNotifyFromAdv = aValue;
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginWlanSettingsDlg::HandleCommsDatChangeL
+// --------------------------------------------------------------------------
+//
+void CmPluginWlanSettingsDlg::HandleCommsDatChangeL()
+    {
+    //CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
+    
+    if( iNotifyFromAdv == KCmNotifiedIapIsNotInThisDestination || 
+            iNotifyFromAdv == KCmNotifiedIapDisappear )
+        {
+        TryExitL( iExitReason );
+        }
+    else if( iNotifyFromAdv == KCmNotifiedDestinationDisappear )
+        {
+        iExitReason = KDialogUserExit;
+        TryExitL( iExitReason );
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginwlan/src/cmpwlansettingsdlgadv.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,632 @@
+/*
+* 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:  Dialog for setting WLAN plugin advanced settings
+*
+*/
+
+#include <StringLoader.h>
+#include <akntextsettingpage.h>
+#include <aknmfnesettingpage.h> // for IP dialog
+#include <cmcommonui.h>
+#include <cmwlanui.rsg>
+#include <AknQueryDialog.h>
+#include <cmpluginbaseeng.h>
+#include <cmmanager.rsg>
+#include <csxhelp/cp.hlp.hrh>
+
+#include "cmpluginwlan.h"
+#include <cmpluginwlandef.h>
+#include "cmpwlansettingsdlgadv.h"
+#include "cmpwlansettingsdlgipv4.h"
+#include "cmpwlansettingsdlgipv6.h"
+#include "cmwlancommonconstants.h"
+#include <cmpbasesettingsdlg.h>
+#include "cmpluginmenucommands.hrh"
+#include <cmcommonconstants.h>
+#include <cmpsettingsconsts.h>
+#include "cmmanagerimpl.h"
+
+using namespace CMManager;
+
+const TUint32 KAdhocChannelSelectionItems[] = 
+    {
+    R_QTN_WLAN_SETT_ADHOC_CHANNEL_AUTOMATIC,
+    R_QTN_WLAN_SETT_ADHOC_CHANNEL_USER_DEFINED,
+    0
+    };
+
+// ================= MEMBER FUNCTIONS =========================================
+
+// --------------------------------------------------------------------------
+// CmPluginWlanSettingsDlgAdv::NewL()
+// Two-phase dconstructor, second phase is ConstructAndRunLD
+// --------------------------------------------------------------------------
+//
+CmPluginWlanSettingsDlgAdv* CmPluginWlanSettingsDlgAdv::NewL( 
+                                            CCmPluginBaseEng& aCmPluginBase )
+	{
+	CmPluginWlanSettingsDlgAdv* self = 
+	                new (ELeave) CmPluginWlanSettingsDlgAdv( aCmPluginBase );
+	return self;
+	}
+	
+	
+// --------------------------------------------------------------------------
+// CmPluginWlanSettingsDlgAdv::ConstructAndRunLD
+// Constructs the dialog and runs it.
+// --------------------------------------------------------------------------
+//
+TInt CmPluginWlanSettingsDlgAdv::ConstructAndRunLD( )
+    {
+    CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
+    cmMgr.WatcherRegisterL( this );
+    
+    return CmPluginBaseSettingsDlgAdv::ConstructAndRunLD();
+    }
+    	
+// --------------------------------------------------------------------------
+// CmPluginWlanSettingsDlgAdv::CmPluginWlanSettingsDlgAdv()
+// --------------------------------------------------------------------------
+//
+CmPluginWlanSettingsDlgAdv::CmPluginWlanSettingsDlgAdv( 
+                                        CCmPluginBaseEng& aCmPluginBase ) :
+    CmPluginBaseSettingsDlgAdv( aCmPluginBase ),
+    iIpv6Supported( aCmPluginBase.FeatureSupported( KFeatureIdIPv6 ) ),
+    iParent( NULL )
+    {
+    iHelpContext = KSET_HLP_AP_SETTING_WLAN_AS;
+    }
+    
+// --------------------------------------------------------------------------
+// CmPluginWlanSettingsDlgAdv::~CmPluginWlanSettingsDlgAdv
+// Destructor
+// --------------------------------------------------------------------------
+//
+CmPluginWlanSettingsDlgAdv::~CmPluginWlanSettingsDlgAdv()
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginWlanSettingsDlgAdv::UpdateListBoxContentBearerSpecificL
+// --------------------------------------------------------------------------
+//
+void CmPluginWlanSettingsDlgAdv::UpdateListBoxContentBearerSpecificL( 
+                                                    CDesCArray& aItemArray )
+    {
+    if ( iIpv6Supported )
+        {
+        // IPV4 SETTINGS
+        AppendSettingTextsL( aItemArray,
+                             ESettingPageCmdIpv4,
+                             R_QTN_SET_IPV4_SETTINGS,
+                             0 );
+        // IPV6 SETTINGS
+        AppendSettingTextsL( aItemArray,
+                             ESettingPageCmdIpv6,
+                             R_QTN_SET_IPV6_SETTINGS,
+                             0 );
+        }
+    else
+        {
+        // PHONE IP ADDRESS
+        AppendSettingTextsL( aItemArray, EWlanIpAddr );
+        HBufC* ipAddr = iCmPluginBaseEng.GetStringAttributeL( EWlanIpAddr );
+        TBool isUnspec = IsUnspecifiedIPv4Address( *ipAddr );
+        delete ipAddr; ipAddr = NULL;
+
+        if ( !isUnspec )
+            {
+            // SUBNET MASK
+            AppendSettingTextsL( aItemArray, EWlanIpNetMask );
+            // DEFAULT GATEWAY
+            AppendSettingTextsL( aItemArray, EWlanIpGateway );
+            }
+                
+        // PRIMARY NAME SERVER
+        AppendSettingTextsL( aItemArray, EWlanIpNameServer1 );
+        // SECONDARY NAME SERVER
+        AppendSettingTextsL( aItemArray, EWlanIpNameServer2 );
+        }
+    
+    // AD-HOC CHANNEL
+    if ( iCmPluginBaseEng.GetIntAttributeL( EWlanConnectionMode ) == EAdhoc )
+        {
+        AppendSettingTextsL( aItemArray, EWlanChannelID );
+        }
+    
+    // PROXY SERVER ADDRESS
+    AppendSettingTextsL( aItemArray, ECmProxyServerName );            
+    // PROXY PORT NUMBER
+    AppendSettingTextsL( aItemArray, ECmProxyPortNumber );
+/*    
+    TInt valResId(0);
+    // Allow SSID Roaming?
+
+    TBool res = iCmPluginBaseEng.GetBoolAttributeL( EWlanAllowSSIDRoaming );
+    if ( res )
+        {
+        valResId = R_QTN_WLAN_SETT_SSID_ROAMING_ENABLED;
+        }
+    else
+        {
+        valResId = R_QTN_WLAN_SETT_SSID_ROAMING_DISABLED;
+        }    
+        
+    AppendSettingTextsL( aItemArray, EWlanAllowSSIDRoaming, valResId  );
+*/    
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginWlanSettingsDlgAdv::ShowPopupSettingPageL
+// --------------------------------------------------------------------------
+//
+TBool CmPluginWlanSettingsDlgAdv::ShowPopupSettingPageL( TUint32 aAttribute,
+                                                         TInt aCommandId )
+    {    
+    TBool retval = EFalse;
+    switch ( aAttribute )
+        {
+        case EWlanIpAddr:
+        case EWlanIpNetMask:
+        case EWlanIpGateway:
+        case EWlanIpNameServer1:
+        case EWlanIpNameServer2:        
+            {
+            ShowPopupIpSettingPageL( aAttribute );
+            break;
+            }        
+        case ESettingPageCmdIpv4:                
+            {
+            ShowIpv4SettingPageL();
+            break;
+            }
+        case ESettingPageCmdIpv6:                
+            {
+            ShowIpv6SettingPageL();
+            break;
+            }
+        case ECmProxyServerName:                
+            {
+            retval = ShowPopupTextSettingPageL( aAttribute );
+            break;
+            }
+        case ECmProxyPortNumber:                
+            {
+            retval = ShowPopupPortNumSettingPageL( aAttribute );
+            break;
+            }
+        case EWlanChannelID: // may not be correct
+            {
+            retval = ShowAdhocChannelSettingPageL();
+            break;
+            }
+        case EWlanAllowSSIDRoaming:
+            {
+//            retval = ShowAdhocChannelSettingPageL();
+            break;            
+            }
+        default:
+            {
+            CmPluginBaseSettingsDlgAdv::ShowPopupSettingPageL( aAttribute, aCommandId );
+            break;            
+            }
+        }
+    return retval;
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginWlanSettingsDlgAdv::ShowIpv4SettingPageL
+// --------------------------------------------------------------------------
+//
+TBool CmPluginWlanSettingsDlgAdv::ShowIpv4SettingPageL()
+    {
+    TInt retVal( EFalse );
+    CmPluginWlanSettingsDlgIpv4* ipv4Dlg = 
+                    CmPluginWlanSettingsDlgIpv4::NewL( iCmPluginBaseEng );
+
+    // This view may have to un-register as watcher here
+    CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
+    cmMgr.WatcherUnRegister();
+    
+    ipv4Dlg->RegisterParentView( this );
+    TInt ret = ipv4Dlg->ConstructAndRunLD();
+    
+    if( iNotifyFromIp == KCmNotifiedNone )
+        {
+        if ( ret == KDialogUserExit )
+            {
+            retVal = ETrue;
+            TryExitL( KDialogUserExit );
+            }
+        else
+            {
+            // Re-register as watcher if advanced view comes back or exists normally
+            cmMgr.WatcherRegisterL( this );
+            }
+        }
+    else
+        {
+        HandleCommsDatChangeL();
+        }
+    
+    return retVal;
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginWlanSettingsDlgAdv::ShowIpv6SettingPageL
+// --------------------------------------------------------------------------
+//    
+TBool CmPluginWlanSettingsDlgAdv::ShowIpv6SettingPageL()
+    {
+    TInt retVal( EFalse );
+    CmPluginWlanSettingsDlgIpv6* ipv6Dlg = 
+                    CmPluginWlanSettingsDlgIpv6::NewL( iCmPluginBaseEng );
+
+    // This view may have to un-register as watcher here
+    CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
+    cmMgr.WatcherUnRegister();
+ 
+    ipv6Dlg->RegisterParentView( this );
+    TInt ret = ipv6Dlg->ConstructAndRunLD();
+ 
+    if( iNotifyFromIp == KCmNotifiedNone )
+        {
+        if ( ret == KDialogUserExit )
+            {
+            retVal = ETrue;
+            TryExitL( KDialogUserExit );
+            }
+        else
+            {
+            // Re-register as watcher if advanced view comes back or exists normally
+            cmMgr.WatcherRegisterL( this );
+            }
+        }
+    else
+        {
+        HandleCommsDatChangeL();
+        }
+    
+    return retVal;
+    }
+
+
+// --------------------------------------------------------------------------
+// CmPluginWlanSettingsDlgAdv::ShowAdhocChannelSettingPageL
+// --------------------------------------------------------------------------
+//    
+TBool CmPluginWlanSettingsDlgAdv::ShowAdhocChannelSettingPageL()
+    {
+    TInt retVal( EFalse );
+    const TCmAttribConvTable* convItem = 
+                        iCmPluginBaseEng.ConvTableItem( EWlanChannelID );
+    const TUint32* items = KAdhocChannelSelectionItems;
+    TInt value = iCmPluginBaseEng.GetIntAttributeL( EWlanChannelID );
+    
+    TInt selected = value ? EAdhocUserDefined : EAdhocAutomatic;
+        
+    // Show the dialog  
+    if ( ShowRadioButtonSettingPageL( items, 
+                                      selected,
+                                      R_QTN_WLAN_SETT_ADHOC_CHANNEL ) )
+        {
+        // 'User defined' selected
+        if ( selected == EAdhocUserDefined )
+            {
+            // if EWlanChannelID doesn't have a valid number, use the defaul
+            if ( value < KCmAdhocChannelMinValue || value > KCmAdhocChannelMaxValue )
+                {
+                value = KCmAdhocChannelDefaultValue;
+                }
+            
+            TBool loop ( ETrue );
+            
+            do
+                {
+                HBufC* buf = HBufC::NewLC( convItem->iMaxLength );
+                TPtr ptr ( buf->Des() );
+                ptr.AppendNum( value );
+                
+                // Display a numeric query dialog
+                CAknTextQueryDialog* dlg = CAknTextQueryDialog::NewL( ptr );
+                
+                dlg->PrepareLC( R_NUMERIC_QUERY );
+                dlg->SetMaxLength( convItem->iMaxLength );
+                dlg->SetDefaultInputMode( EAknEditorNumericInputMode );
+                dlg->MakeLeftSoftkeyVisible( EFalse );
+                
+                HBufC* prompt = StringLoader::LoadLC( 
+                                                R_QTN_WLAN_PRMPT_ADHOC_CHANNEL );
+                dlg->SetPromptL( *prompt );
+                CleanupStack::PopAndDestroy( prompt );
+                
+                // Show the popup
+                if ( dlg->RunLD() )
+                    {
+                    TLex lex ( ptr );
+                    lex.Val( value );
+                    
+                    // Check valid limits
+                    if ( value >= KCmAdhocChannelMinValue && 
+                         value <= KCmAdhocChannelMaxValue )
+                        {
+                        // set result                
+                        iCmPluginBaseEng.SetIntAttributeL( EWlanChannelID, value );
+                        loop = EFalse;
+                        UpdateListBoxContentL();
+                        retVal = ETrue;
+                        }
+                    else
+                        {
+                        value = value <  KCmAdhocChannelMinValue ? 
+                                         KCmAdhocChannelMinValue : 
+                                         KCmAdhocChannelMaxValue;
+                        }
+                    }
+                else
+                    {
+                    loop = EFalse;
+                    }
+                CleanupStack::PopAndDestroy( buf );
+                } while ( loop );
+            }
+        else
+            {
+            iCmPluginBaseEng.SetIntAttributeL( EWlanChannelID, EAdhocAutomatic );
+            UpdateListBoxContentL();
+            retVal = ETrue;
+            }        
+        }
+        
+    return retVal;
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginWlanSettingsDlgAdv::ProcessCommandL
+// --------------------------------------------------------------------------
+//
+void CmPluginWlanSettingsDlgAdv:: ProcessCommandL( TInt aCommandId )
+    {
+    if ( MenuShowing() )
+        {
+        HideMenu();
+        }
+
+    switch ( aCommandId )
+        {
+        case EPluginBaseCmdExit:
+            {
+            iExitReason = KDialogUserExit;
+            }            
+        case EAknSoftkeyBack:
+            {
+            CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
+            cmMgr.WatcherUnRegister();
+            
+            HBufC* ipAddr = iCmPluginBaseEng.GetStringAttributeL( EWlanIpAddr );
+            TBool isUnspec = IsUnspecifiedIPv4Address( *ipAddr );
+            delete ipAddr; ipAddr = NULL;
+            
+            if ( !isUnspec )
+                {
+                ipAddr = iCmPluginBaseEng.GetStringAttributeL( EWlanIpNetMask );
+                TBool isUnspec1 = IsUnspecifiedIPv4Address( *ipAddr );
+                delete ipAddr;
+                ipAddr = iCmPluginBaseEng.GetStringAttributeL( EWlanIpGateway );
+                TBool isUnspec2 = IsUnspecifiedIPv4Address( *ipAddr );
+                delete ipAddr;
+                
+                if ( isUnspec1 || isUnspec2 )
+                    {
+                    if ( TCmCommonUi::ShowConfirmationQueryL(
+                            R_QTN_NETW_QUEST_IAP_INCOMPLETE_DELETE ) )
+                        {
+                        iCmPluginBaseEng.RestoreAttributeL( EWlanIpAddr );
+                        iCmPluginBaseEng.RestoreAttributeL( EWlanIpNetMask );
+                        iCmPluginBaseEng.RestoreAttributeL( EWlanIpGateway );
+                        iCmPluginBaseEng.RestoreAttributeL( EWlanIpDNSAddrFromServer );
+                        TryExitL( iExitReason );
+                        }
+                    }
+                 else
+                    {
+                    TryExitL( iExitReason );
+                    }
+                }
+            else
+                {
+                TryExitL( iExitReason );
+                }
+            break;
+            }  
+        case EAknSoftkeyOk:                    
+        case EPluginBaseCmdChange:
+            {
+            ShowPopupSettingPageL( 
+                        iSettingIndex->At( iListbox->CurrentItemIndex() ),
+                        aCommandId );
+            break;
+            }
+        default:
+            {
+            CmPluginBaseSettingsDlgAdv::ProcessCommandL( aCommandId );
+            break;            
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginWlanSettingsDlgAdv::OkToExitL
+// Good to know : EAknSoftkeyCancel is never called, because
+// EEikDialogFlagNotifyEsc flag is not set in the resource.
+// --------------------------------------------------------------------------
+//
+TBool CmPluginWlanSettingsDlgAdv::OkToExitL( TInt aButtonId )
+    {
+    // Translate the button presses into commands for the appui & current
+    // view to handle
+    TBool retval( EFalse );
+    
+    switch ( aButtonId )
+        {
+        case EAknSoftkeyOk:
+        case EAknSoftkeyChange:
+            {
+            ProcessCommandL( aButtonId );
+            break;
+            }        
+        case EAknSoftkeyBack:
+            {
+            ProcessCommandL( aButtonId );
+            break;
+            }
+        case EAknSoftkeyOptions:
+            {
+            DisplayMenuL();
+            break;
+            }
+        default:
+            {
+            retval = ETrue;
+            break;
+            }
+        }
+
+    return retval;
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginWlanSettingsDlgAdv::RegisterParentView
+// --------------------------------------------------------------------------
+//
+void CmPluginWlanSettingsDlgAdv::RegisterParentView( CCmParentViewNotifier* aParent )
+    {
+    iParent = aParent;
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginWlanSettingsDlgAdv::CommsDatChangesL
+// --------------------------------------------------------------------------
+//
+void CmPluginWlanSettingsDlgAdv::CommsDatChangesL()
+    {
+    CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
+    CCmDestinationImpl* parentDest = iCmPluginBaseEng.ParentDestination();
+
+    if ( parentDest )
+        {
+        if( !cmMgr.DestinationStillExistedL( parentDest ) )
+            {
+            if( iParent )
+                {
+                iParent->NotifyParentView( KCmNotifiedDestinationDisappear );
+                }
+            
+            cmMgr.WatcherUnRegister();
+            // If parent destination is deleted by somebody then the dialog must exit back to main view
+            iExitReason = KDialogUserExit;
+            TryExitL( iExitReason );
+            
+            cmMgr.RemoveDestFromPool( parentDest );
+            delete parentDest;
+            return;
+            }
+        
+        if( !cmMgr.IsIapStillInDestL( parentDest, iCmPluginBaseEng ) )
+            {
+            if( iParent )
+                {
+                iParent->NotifyParentView( KCmNotifiedIapIsNotInThisDestination );
+                }
+            
+            cmMgr.WatcherUnRegister();
+            // In this case, the dialog can go back to the parent view
+            TryExitL( iExitReason );
+            
+            cmMgr.RemoveDestFromPool( parentDest );
+            delete parentDest;
+            return;            
+            }
+        
+        // We may have to notify parent view to go back to its parent view even though this is still in CommsDat
+        // for cmMgr ( = iCmPluginBaseEng.CmMgr() ) can not be accessed any more
+        // after this call when some Iap is deleted.
+        if( iParent )
+            {
+            iParent->NotifyParentView( KCmNotifiedIapDisappear );
+            }
+        cmMgr.WatcherUnRegister();
+        TryExitL( iExitReason );
+        
+        cmMgr.RemoveDestFromPool( parentDest );
+        delete parentDest;
+        }
+    else
+        {
+        if( !cmMgr.IapStillExistedL( iCmPluginBaseEng ) )
+            {
+            if( iParent )
+                {
+                iParent->NotifyParentView( KCmNotifiedIapDisappear );
+                }
+            
+            cmMgr.WatcherUnRegister();
+            // In this case, the dialog can go back to the parent view
+            TryExitL( iExitReason );
+            return;
+            }
+        
+        // We may have to notify parent view to go back to its parent view even though this is still in CommsDat
+        // for cmMgr ( = iCmPluginBaseEng.CmMgr() ) can not be accessed any more
+        // after this call when some Iap is deleted.
+        if( iParent )
+            {
+            iParent->NotifyParentView( KCmNotifiedIapDisappear );
+            }
+        cmMgr.WatcherUnRegister();
+        TryExitL( iExitReason );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginWlanSettingsDlgAdv::NotifyParentView
+// --------------------------------------------------------------------------
+//
+void CmPluginWlanSettingsDlgAdv::NotifyParentView( TInt aValue )
+    {
+    iNotifyFromIp = aValue;
+    
+    if( iParent )
+        {
+        iParent->NotifyParentView( aValue );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginWlanSettingsDlgAdv::HandleCommsDatChangeL
+// --------------------------------------------------------------------------
+//
+void CmPluginWlanSettingsDlgAdv::HandleCommsDatChangeL()
+    {    
+    if( iNotifyFromIp == KCmNotifiedIapIsNotInThisDestination || 
+            iNotifyFromIp == KCmNotifiedIapDisappear )
+        {
+        TryExitL( iExitReason );
+        }
+    else if( iNotifyFromIp == KCmNotifiedDestinationDisappear )
+        {
+        iExitReason = KDialogUserExit;
+        TryExitL( iExitReason );
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginwlan/src/cmpwlansettingsdlgipv4.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,394 @@
+/*
+* 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:  WLAN Ipv4 settings dialog
+*
+*/
+
+#include <StringLoader.h>
+#include <akntitle.h>
+#include <akntextsettingpage.h>
+#include <aknmfnesettingpage.h>  // for IP dialog
+#include <cmcommonui.h>
+#include <cmwlanui.rsg>
+#include <cmmanager.rsg>
+#include <csxhelp/cp.hlp.hrh>
+
+#include <cmpluginbaseeng.h>
+#include <cmpluginwlandef.h>
+#include "cmpwlansettingsdlgipv4.h"
+#include "cmwlancommonconstants.h"
+#include "cmpluginmenucommands.hrh"
+#include "cmpluginmultilinedialog.h"
+#include <cmcommonconstants.h>
+#include <cmpsettingsconsts.h>
+#include "cmmanagerimpl.h"
+
+using namespace CMManager;
+
+// ================= MEMBER FUNCTIONS =========================================
+
+// --------------------------------------------------------------------------
+// CmPluginWlanSettingsDlgIpv4::NewL
+// Two-phase dconstructor, second phase is ConstructAndRunLD
+// --------------------------------------------------------------------------
+//
+CmPluginWlanSettingsDlgIpv4* CmPluginWlanSettingsDlgIpv4::NewL(
+                                            CCmPluginBaseEng& aCmPluginBase )
+	{
+	CmPluginWlanSettingsDlgIpv4* self = 
+	            new ( ELeave ) CmPluginWlanSettingsDlgIpv4( aCmPluginBase );
+	return self;
+	}
+	
+// --------------------------------------------------------------------------
+// CmPluginWlanSettingsDlgIpv4::CmPluginWlanSettingsDlgIpv4
+// --------------------------------------------------------------------------
+//
+CmPluginWlanSettingsDlgIpv4::CmPluginWlanSettingsDlgIpv4( 
+                                        CCmPluginBaseEng& aCmPluginBase ) :
+    CmPluginBaseSettingsDlgIp( aCmPluginBase ) ,
+    iParent( NULL )
+    {
+    iHelpContext = KSET_HLP_AP_WLAN_AS_IPV4;
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginWlanSettingsDlgIpv4::ConstructAndRunLD
+// --------------------------------------------------------------------------
+//
+TInt CmPluginWlanSettingsDlgIpv4::ConstructAndRunLD()
+    {
+    CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
+    cmMgr.WatcherRegisterL( this );
+    
+    return CmPluginBaseSettingsDlgIp::ConstructAndRunLD();
+    }
+    
+// ---------------------------------------------------------
+// CmPluginWlanSettingsDlgIpv4::~CmPluginWlanSettingsDlgIpv4
+// Destructor
+// ---------------------------------------------------------
+//
+CmPluginWlanSettingsDlgIpv4::~CmPluginWlanSettingsDlgIpv4()
+    {
+    }
+
+
+// --------------------------------------------------------------------------
+// CmPluginWlanSettingsDlgIpv4::UpdateListBoxContentBearerSpecificL
+// --------------------------------------------------------------------------
+//
+void CmPluginWlanSettingsDlgIpv4::UpdateListBoxContentBearerSpecificL( 
+                                                    CDesCArray& aItemArray )
+    {
+    // PHONE IP ADDRESS
+    AppendSettingTextsL( aItemArray, EWlanIpAddr );
+    HBufC* ipAddr = iCmPluginBaseEng.GetStringAttributeL( EWlanIpAddr );
+    TBool isUnspec = IsUnspecifiedIPv4Address( *ipAddr );
+    delete ipAddr; ipAddr = NULL;
+    
+    if ( !isUnspec )
+        {
+        // SUBNET MASK
+        AppendSettingTextsL( aItemArray, EWlanIpNetMask );
+        // DEFAULT GATEWAY
+        AppendSettingTextsL( aItemArray, EWlanIpGateway );
+        }
+
+    // DNS SERVERS IP ADDRESS
+    TBool boolValue = iCmPluginBaseEng.GetBoolAttributeL( 
+                                                EWlanIpDNSAddrFromServer );
+    AppendSettingTextsL( aItemArray,
+                         EWlanIpDNSAddrFromServer,
+                         boolValue ? 
+                                R_QTN_SET_DNS_SERVERS_AUTOMATIC : 
+                                R_QTN_SET_IP_USER_DEFINED );
+    }
+    
+//---------------------------------------------------------------------------
+// CmPluginWlanSettingsDlgIpv4::ShowPopupSettingPageL
+//---------------------------------------------------------------------------
+//
+TBool CmPluginWlanSettingsDlgIpv4::ShowPopupSettingPageL( TUint32 aAttribute, 
+                                                          TInt aCommandId )
+    {
+    TBool retval = EFalse;
+    switch ( aAttribute )
+        {
+        case EWlanIpDNSAddrFromServer:
+            {
+            ShowPopupIPv4DNSEditorL( EWlanIpDNSAddrFromServer, 
+                                     EWlanIpNameServer1,
+                                     EWlanIpNameServer2 );
+            break;
+            }
+        case EWlanIpAddr:
+        case EWlanIpNetMask:
+        case EWlanIpGateway:
+            {
+            ShowPopupIpSettingPageL( aAttribute );
+            break;
+            }
+        default:
+            {
+            CmPluginBaseSettingsDlgIp::ShowPopupSettingPageL( aAttribute, 
+                                                               aCommandId );
+            break;            
+            }
+        }
+    return retval;
+    }
+
+
+//---------------------------------------------------------------------------
+// CmPluginWlanSettingsDlgIpv4::ProcessCommandL
+//---------------------------------------------------------------------------
+//
+void CmPluginWlanSettingsDlgIpv4::ProcessCommandL( TInt aCommandId )
+    {
+    if ( MenuShowing() )
+        {
+        HideMenu();
+        }
+    switch ( aCommandId )
+        {
+        case EPluginBaseCmdExit:
+            {
+            if ( ValidateAttribsL() )
+                {
+                CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
+                cmMgr.WatcherUnRegister();
+                
+                iExitReason = KDialogUserExit;
+                TryExitL( iExitReason );
+                }
+            break;
+            }       
+        case EPluginBaseCmdChange:
+            {
+            ShowPopupSettingPageL( 
+                        iSettingIndex->At( iListbox->CurrentItemIndex() ),
+                        aCommandId );
+            break;
+            }
+        default:
+            {
+            CmPluginBaseSettingsDlgIp::ProcessCommandL( aCommandId );
+            break;            
+            }
+       }
+   }
+
+// --------------------------------------------------------------------------
+// CmPluginWlanSettingsDlgIpv4::OkToExitL
+// --------------------------------------------------------------------------
+//
+TBool CmPluginWlanSettingsDlgIpv4::OkToExitL( TInt aButtonId )
+    {
+    TBool retval( EFalse );
+    
+    switch ( aButtonId )
+        {
+        case EAknSoftkeyOk:
+        case EAknSoftkeyChange:
+            {
+            ProcessCommandL( EPluginBaseCmdChange );
+            break;
+            }
+        case EAknSoftkeyBack:
+            {
+            if ( ValidateAttribsL() )
+                {
+                CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
+                cmMgr.WatcherUnRegister();
+                
+                iExitReason = KDialogUserBack;
+                retval = ETrue;
+                }
+            break;
+            }
+        default:
+            {
+            retval = CmPluginBaseSettingsDlgIp::OkToExitL( aButtonId );
+            break;
+            }
+        }
+    return retval;
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginWlanSettingsDlgIpv4::ValidateAttribsL
+// --------------------------------------------------------------------------
+//
+TBool CmPluginWlanSettingsDlgIpv4::ValidateAttribsL()
+    {
+    TBool retVal ( EFalse );
+    HBufC* ipAddr = iCmPluginBaseEng.GetStringAttributeL( EWlanIpAddr );
+    TBool isUnspec = IsUnspecifiedIPv4Address( *ipAddr );
+    delete ipAddr; ipAddr = NULL;
+    
+    if ( !isUnspec )
+        {
+        ipAddr = iCmPluginBaseEng.GetStringAttributeL( EWlanIpNetMask );
+        TBool isUnspec1 = IsUnspecifiedIPv4Address( *ipAddr );
+        delete ipAddr;
+        ipAddr = iCmPluginBaseEng.GetStringAttributeL( EWlanIpGateway );
+        TBool isUnspec2 = IsUnspecifiedIPv4Address( *ipAddr );
+        delete ipAddr;
+        
+        if ( isUnspec1 || isUnspec2 )
+            {
+            if ( TCmCommonUi::ShowConfirmationQueryL(
+                    R_QTN_NETW_QUEST_IAP_INCOMPLETE_DELETE ) )
+                {
+                // quit without saving, so restore attributes
+                iCmPluginBaseEng.RestoreAttributeL( EWlanIpAddr );
+                iCmPluginBaseEng.RestoreAttributeL( EWlanIpNetMask );
+                iCmPluginBaseEng.RestoreAttributeL( EWlanIpGateway );
+                iCmPluginBaseEng.RestoreAttributeL( EWlanIpDNSAddrFromServer );
+                retVal = ETrue;
+                }
+            }
+         else
+            {
+            retVal = ETrue;
+            }
+        }
+    else
+        {
+        retVal = ETrue;
+        }
+
+    return retVal;
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginWlanSettingsDlgIpv4::InitTextsL
+// --------------------------------------------------------------------------
+//
+void CmPluginWlanSettingsDlgIpv4::InitTextsL()
+    {
+    // set pane text if neccessary...
+    // pane text needed if not pop-up...
+    if ( iEikonEnv )
+        {
+        iStatusPane = iEikonEnv->AppUiFactory()->StatusPane();
+        iTitlePane =
+            ( CAknTitlePane* )iStatusPane->ControlL(
+                                TUid::Uid( EEikStatusPaneUidTitle ) );
+
+        iOldTitleText = iTitlePane->Text()->AllocL();
+        HBufC* title = StringLoader::LoadLC ( R_QTN_SET_IPV4_SETTINGS );
+        iTitlePane->SetTextL( *title ) ;
+        CleanupStack::PopAndDestroy(title);                         
+        iNaviPane = ( CAknNavigationControlContainer* ) 
+                        iStatusPane->ControlL( 
+                                TUid::Uid( EEikStatusPaneUidNavi ) );
+        iNaviDecorator = iNaviPane->CreateNavigationLabelL( KNullDesC );
+        iNaviPane->PushL( *iNaviDecorator );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginWlanSettingsDlgIpv4::RegisterParentView
+// --------------------------------------------------------------------------
+//
+void CmPluginWlanSettingsDlgIpv4::RegisterParentView( CCmParentViewNotifier* aParent )
+    {
+    iParent = aParent;
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginWlanSettingsDlgIpv4::CommsDatChangesL
+// --------------------------------------------------------------------------
+//
+void CmPluginWlanSettingsDlgIpv4::CommsDatChangesL()
+    {
+    CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
+    CCmDestinationImpl* parentDest = iCmPluginBaseEng.ParentDestination();
+    
+    if ( parentDest )
+        {
+        if( !cmMgr.DestinationStillExistedL( parentDest ) )
+            {
+            if( iParent )
+                {
+                iParent->NotifyParentView( KCmNotifiedDestinationDisappear );
+                }
+            
+            cmMgr.WatcherUnRegister();
+            // If parent destination is deleted by somebody then the dialog must exit back to main view
+            iExitReason = KDialogUserExit;
+            TryExitL( iExitReason );
+                
+            cmMgr.RemoveDestFromPool( parentDest );
+            delete parentDest;
+            return;
+            }
+            
+        if( !cmMgr.IsIapStillInDestL( parentDest, iCmPluginBaseEng ) )
+            {
+            if( iParent )
+                {
+                iParent->NotifyParentView( KCmNotifiedIapIsNotInThisDestination );
+                }
+            
+            cmMgr.WatcherUnRegister();
+            // In this case, the dialog can go back to the parent view
+            TryExitL( iExitReason );
+            
+            cmMgr.RemoveDestFromPool( parentDest );
+            delete parentDest;
+            return;
+            }
+        
+        // We may have to notify parent view to go back to its parent view even though this Iap is still in CommsDat
+        // for cmMgr ( = iCmPluginBaseEng.CmMgr() ) can not be accessed any more
+        // after this call when some Iap is deleted.
+        if( iParent )
+            {
+            iParent->NotifyParentView( KCmNotifiedIapDisappear );
+            }
+        cmMgr.WatcherUnRegister();
+        TryExitL( iExitReason );
+            
+        cmMgr.RemoveDestFromPool( parentDest );
+        delete parentDest;
+        }
+    else
+        {
+        if( !cmMgr.IapStillExistedL( iCmPluginBaseEng ) )
+            {
+            if( iParent )
+            {
+            iParent->NotifyParentView( KCmNotifiedIapDisappear );
+            }
+            
+            cmMgr.WatcherUnRegister();
+            // In this case, the dialog can go back to the parent view
+            TryExitL( iExitReason );
+            return;
+            }
+        
+        // We may have to notify parent view to go back to its parent view even though this Iap is still in CommsDat
+        // for cmMgr ( = iCmPluginBaseEng.CmMgr() ) can not be accessed any more
+        // after this call when some Iap is deleted.
+        if( iParent )
+            {
+            iParent->NotifyParentView( KCmNotifiedIapDisappear );
+            }
+        cmMgr.WatcherUnRegister();
+        TryExitL( iExitReason );
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginwlan/src/cmpwlansettingsdlgipv6.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,345 @@
+/*
+* 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:  WLAN Ipv6 settings dialog
+*
+*/
+
+#include <StringLoader.h>
+#include <akntitle.h>
+#include <aknnavide.h>
+#include <cmcommonui.h>
+#include <cmwlanui.rsg>
+#include <cmmanager.rsg>
+#include <csxhelp/cp.hlp.hrh>
+
+#include <cmpluginwlandef.h>
+#include "cmpluginwlan.h"
+#include "cmpwlansettingsdlgipv6.h"
+#include "cmwlancommonconstants.h"
+#include "cmpluginmenucommands.hrh"
+#include "cmpluginmultilinedialog.h"
+#include <cmcommonconstants.h>
+#include <cmpsettingsconsts.h>
+#include "cmmanagerimpl.h"
+
+using namespace CMManager;
+
+const TUint32 KIPv6SelectionItems[] = 
+    {
+    R_QTN_SET_DNS_SERVERS_AUTOMATIC,
+    R_QTN_SET_IP_WELL_KNOWN,
+    R_QTN_SET_IP_USER_DEFINED,
+    0
+    };
+    
+// ================= MEMBER FUNCTIONS =======================================
+
+// --------------------------------------------------------------------------
+// CmPluginWlanSettingsDlgIpv6::NewL
+// Two-phase dconstructor, second phase is ConstructAndRunLD
+// --------------------------------------------------------------------------
+//
+CmPluginWlanSettingsDlgIpv6* CmPluginWlanSettingsDlgIpv6::NewL( 
+                                            CCmPluginBaseEng& aCmPluginBase )
+	{
+	CmPluginWlanSettingsDlgIpv6* self = 
+	            new (ELeave) CmPluginWlanSettingsDlgIpv6( aCmPluginBase );
+	return self;
+	}
+	
+// --------------------------------------------------------------------------
+// CmPluginWlanSettingsDlgIpv6::CmPluginWlanSettingsDlgIpv6
+// --------------------------------------------------------------------------
+//
+CmPluginWlanSettingsDlgIpv6::CmPluginWlanSettingsDlgIpv6( 
+                                         CCmPluginBaseEng& aCmPluginBase ):
+    CmPluginBaseSettingsDlgIp( aCmPluginBase ) ,
+    iParent( NULL )
+    {
+    iHelpContext = KSET_HLP_AP_WLAN_AS_IPV6;
+    }
+    
+// --------------------------------------------------------------------------
+// CmPluginWlanSettingsDlgIpv6::~CmPluginWlanSettingsDlgIpv6
+// --------------------------------------------------------------------------
+//
+CmPluginWlanSettingsDlgIpv6::~CmPluginWlanSettingsDlgIpv6()
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginWlanSettingsDlgIpv6::ConstructAndRunLD
+// --------------------------------------------------------------------------
+//
+TInt CmPluginWlanSettingsDlgIpv6::ConstructAndRunLD()
+    {
+    CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
+    cmMgr.WatcherRegisterL( this );
+    
+    return CmPluginBaseSettingsDlgIp::ConstructAndRunLD();
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginWlanSettingsDlgIpv6::UpdateListBoxContentBearerSpecificL
+// --------------------------------------------------------------------------
+//
+void CmPluginWlanSettingsDlgIpv6::UpdateListBoxContentBearerSpecificL( 
+                                                    CDesCArray& aItemArray )
+    {
+    TInt value( 0 );
+    
+    // DNS SERVERS IP ADDRESS
+    switch ( GetIPv6DNSTypeL( EWlanIp6NameServer1,
+                              EWlanIp6NameServer2 ) )
+        {
+        case EIpv6DNSDynamic:
+            {
+            value = R_QTN_SET_DNS_SERVERS_AUTOMATIC;
+            break;
+            }
+        case EIpv6DNSWellKnown:
+            {
+            value = R_QTN_SET_IP_WELL_KNOWN;
+            break;
+            }
+        case EIpv6DNSUserDefined:
+            {
+            value = R_QTN_SET_IP_USER_DEFINED;
+            break;
+            }
+        default:
+            {
+            User::Leave( KErrNotSupported );
+            break;
+            }
+        }
+    AppendSettingTextsL( aItemArray,
+                         EWlanIp6DNSAddrFromServer,
+                         value );
+    }    
+
+//---------------------------------------------------------------------------
+// CmPluginWlanSettingsDlgIpv6::ShowPopupSettingPageL
+//---------------------------------------------------------------------------
+//
+TBool CmPluginWlanSettingsDlgIpv6::ShowPopupSettingPageL( TUint32 aAttribute, 
+                                                          TInt aCommandId )
+    {    
+    TBool retval = EFalse;
+    switch ( aAttribute )
+        {
+        case EWlanIp6DNSAddrFromServer:        
+            {
+            ShowPopupIPv6DNSEditorL( KIPv6SelectionItems, 
+                                     EWlanIp6DNSAddrFromServer,
+                                     EWlanIp6NameServer1,
+                                     EWlanIp6NameServer2 );
+            break;
+            }
+        default:
+            {
+            CmPluginBaseSettingsDlgIp::ShowPopupSettingPageL( aAttribute, 
+                                                               aCommandId );
+            break;            
+            }
+        }
+    return retval;
+    }
+    
+//---------------------------------------------------------------------------
+// CmPluginWlanSettingsDlgIpv6::InitTextsL
+// called before the dialog is shown to initialize localized textual data
+//---------------------------------------------------------------------------
+//
+void CmPluginWlanSettingsDlgIpv6::InitTextsL()
+    {
+    // set pane text if neccessary...
+    // pane text needed if not pop-up...
+    if ( iEikonEnv )
+        {
+        iStatusPane = iEikonEnv->AppUiFactory()->StatusPane();
+        iTitlePane = ( CAknTitlePane* )iStatusPane->ControlL(
+                                TUid::Uid( EEikStatusPaneUidTitle ) );
+
+        iOldTitleText = iTitlePane->Text()->AllocL();
+        HBufC* title = StringLoader::LoadLC ( R_QTN_SET_IPV6_SETTINGS );
+        iTitlePane->SetTextL( *title ) ;
+        CleanupStack::PopAndDestroy(title);                         
+        iNaviPane = ( CAknNavigationControlContainer* ) 
+                        iStatusPane->ControlL( 
+                                TUid::Uid( EEikStatusPaneUidNavi ) );
+        iNaviDecorator = iNaviPane->CreateNavigationLabelL( KNullDesC );
+        iNaviPane->PushL( *iNaviDecorator );
+        }
+    }    
+    
+// --------------------------------------------------------------------------
+// CmPluginWlanSettingsDlgIpv6::ProcessCommandL
+// --------------------------------------------------------------------------
+//
+void CmPluginWlanSettingsDlgIpv6:: ProcessCommandL( TInt aCommandId )
+    {
+    if ( MenuShowing() )
+        {
+        HideMenu();
+        }
+
+    switch ( aCommandId )
+        {
+        case EPluginBaseCmdExit:
+            {
+            iExitReason = KDialogUserExit;
+            }
+        // fall-through intended here
+        case EAknSoftkeyBack:
+            {
+            CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
+            cmMgr.WatcherUnRegister();
+            
+            TryExitL( iExitReason );
+            break;
+            }           
+        case EAknSoftkeyOk:
+        case EPluginBaseCmdChange:
+            {
+            TInt attrib = iSettingIndex->At( iListbox->CurrentItemIndex() );
+            ShowPopupSettingPageL( attrib, aCommandId);
+            break;
+            }
+        default:
+            {
+            CmPluginBaseSettingsDlgIp::ProcessCommandL( aCommandId );
+            break;            
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginWlanSettingsDlgIpv6::OkToExitL
+// --------------------------------------------------------------------------
+//
+TBool CmPluginWlanSettingsDlgIpv6::OkToExitL( TInt aButtonId )
+    {
+    TBool retval( EFalse );
+    
+    switch ( aButtonId )
+        {
+        case EAknSoftkeyBack:
+        case EAknSoftkeyExit:
+        case KDialogUserExit:
+            {
+            CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
+            cmMgr.WatcherUnRegister();
+            } // Continue to call base setting dialog view
+        default:
+            {
+            retval = CmPluginBaseSettingsDlgIp::OkToExitL( aButtonId );
+            break;
+            }
+        }
+    return retval;
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginWlanSettingsDlgIpv6::RegisterParentView
+// --------------------------------------------------------------------------
+//
+void CmPluginWlanSettingsDlgIpv6::RegisterParentView( CCmParentViewNotifier* aParent )
+    {
+    iParent = aParent;
+    }
+
+// --------------------------------------------------------------------------
+// CmPluginWlanSettingsDlgIpv6::CommsDatChangesL
+// --------------------------------------------------------------------------
+//
+void CmPluginWlanSettingsDlgIpv6::CommsDatChangesL()
+    {
+    CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
+    CCmDestinationImpl* parentDest = iCmPluginBaseEng.ParentDestination();
+    
+    if ( parentDest )
+        {
+        if( !cmMgr.DestinationStillExistedL( parentDest ) )
+            {
+            if( iParent )
+                {
+                iParent->NotifyParentView( KCmNotifiedDestinationDisappear );
+                }
+            
+            // cmMgr.WatcherUnRegister();
+            // If parent destination is deleted by somebody then the dialog must exit back to main view
+            iExitReason = KDialogUserExit; // cmMgr.WatcherUnRegister will be done in function OkToExitL in this case
+            TryExitL( iExitReason );
+                
+            cmMgr.RemoveDestFromPool( parentDest );
+            delete parentDest;
+            return;
+            }
+            
+        if( !cmMgr.IsIapStillInDestL( parentDest, iCmPluginBaseEng ) )
+            {
+            if( iParent )
+                {
+                iParent->NotifyParentView( KCmNotifiedIapIsNotInThisDestination );
+                }
+            
+            cmMgr.WatcherUnRegister();
+            // In this case, the dialog can go back to the parent view
+            TryExitL( iExitReason );
+            
+            cmMgr.RemoveDestFromPool( parentDest );
+            delete parentDest;
+            return;
+            }
+        
+        // We may have to notify parent view to go back to its parent view even though this Iap is still in CommsDat
+        // for cmMgr ( = iCmPluginBaseEng.CmMgr() ) can not be accessed any more
+        // after this call when some Iap is deleted.
+        if( iParent )
+            {
+            iParent->NotifyParentView( KCmNotifiedIapDisappear );
+            }
+        cmMgr.WatcherUnRegister();
+        TryExitL( iExitReason );
+        
+        cmMgr.RemoveDestFromPool( parentDest );
+        delete parentDest;
+        }
+    else
+        {
+        if( !cmMgr.IapStillExistedL( iCmPluginBaseEng ) )
+            {
+            if( iParent )
+                {
+                iParent->NotifyParentView( KCmNotifiedIapDisappear );
+                }
+            
+            cmMgr.WatcherUnRegister();
+            // In this case, the dialog can go back to the parent view
+            TryExitL( iExitReason );
+            return;
+            }
+        
+        // We may have to notify parent view to go back to its parent view even though this Iap is still in CommsDat
+        // for cmMgr ( = iCmPluginBaseEng.CmMgr() ) can not be accessed any more
+        // after this call when some Iap is deleted.
+        if( iParent )
+            {
+            iParent->NotifyParentView( KCmNotifiedIapDisappear );
+            }
+        cmMgr.WatcherUnRegister();
+        TryExitL( iExitReason );
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Plugins/cmpluginwlan/src/cmwlancoveragecheck.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,413 @@
+/*
+* 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 WLAN Coverage Check class
+*
+*/
+
+
+#include <wlanmgmtclient.h>
+
+#include "cmwlancoveragecheck.h"
+#include "cmpluginwlan.h"
+#include "cmpluginwlandata.h"
+#include "cmpluginwlandataarray.h"
+#include "cmlogger.h"
+
+
+/**
+* Management frame information element IDs.
+* needed to determine coverage
+*/
+enum T802Dot11InformationElementID
+    {
+    E802Dot11SsidIE                 = 0,
+    E802Dot11SupportedRatesIE       = 1,
+    E802Dot11FhParameterSetIE       = 2,
+    E802Dot11DsParameterSetIE       = 3,
+    E802Dot11CfParameterSetIE       = 4,
+    E802Dot11TimIE                  = 5,
+    E802Dot11IbssParameterSetIE     = 6,
+    E802Dot11CountryIE              = 7,
+    E802Dot11HoppingPatternParamIE  = 8,
+    E802Dot11HoppingPatternTableIE  = 9,
+    E802Dot11RequestIE              = 10,
+
+    E802Dot11ChallengeTextIE        = 16,
+    // Reserved for challenge text extension 17 - 31
+    E802Dot11ErpInformationIE       = 42,
+    E802Dot11ExtendedRatesIE        = 50,
+    E802Dot11AironetIE              = 133,
+    E802Dot11ApIpAddressIE          = 149,
+    E802Dot11RsnIE                  = 221
+    };
+
+
+/**
+* Bit masks for Capability Information field.
+*/
+enum T802Dot11CapabilityBitMask
+    {
+    E802Dot11CapabilityEssMask          = 0x0001,
+    E802Dot11CapabilityIbssMask         = 0x0002,
+    E802Dot11CapabilityCfPollableMask   = 0x0004,
+    E802Dot11CapabilityCfPollRequestMask= 0x0008,
+    E802Dot11CapabilityPrivacyMask      = 0x0010,
+    E802Dot11ShortPreambleMask          = 0x0020,
+    E802Dot11PbccMask                   = 0x0040,      
+    E802Dot11ChannelAgilityMask         = 0x0080
+    };
+
+
+// ======================= MEMBER FUNCTIONS =================================
+
+// ----------------------------------------------------------------------------
+// CCmWlanCoverageCheck::CCmWlanCoverageCheck()
+// ----------------------------------------------------------------------------
+//
+CCmWlanCoverageCheck::CCmWlanCoverageCheck() : CActive( EPriorityStandard )
+    {
+    CActiveScheduler::Add( this );
+    }
+    
+// ----------------------------------------------------------------------------
+// CCmWlanCoverageCheck::~CCmWlanCoverageCheck()
+// ----------------------------------------------------------------------------
+//
+CCmWlanCoverageCheck::~CCmWlanCoverageCheck()
+    {
+    Cancel();
+    }
+    
+// ----------------------------------------------------------------------------
+// CCmWlanCoverageCheck::DoCancel
+// ----------------------------------------------------------------------------
+//
+void CCmWlanCoverageCheck::DoCancel()
+    {
+    iWait.AsyncStop();
+    }
+    
+// ----------------------------------------------------------------------------
+// CCmWlanCoverageCheck::RunL
+// ----------------------------------------------------------------------------
+//
+void CCmWlanCoverageCheck::RunL()
+    {
+    CLOG_WRITE( "RunL entered" );
+    switch( iProgState )
+        {
+        case EScanning:
+            {
+             if( !iStatus.Int() )
+                // The list is ready 
+                {
+                iProgState = EDone;
+                iWait.AsyncStop();
+                }
+            else
+                // something went wrong -> no coverage.
+                {
+                iWait.AsyncStop();
+                }
+            }
+            break;            
+        case EDone:
+            {
+            iWait.AsyncStop();
+            }
+            break;
+            
+        default:
+            {
+            User::Leave( KErrCorrupt );
+            }
+        }
+    }
+
+
+
+// ----------------------------------------------------------------------------
+// CCmWlanCoverageCheck::GetCoverageL
+// ----------------------------------------------------------------------------
+//
+TInt CCmWlanCoverageCheck::GetCoverageL()
+    {
+    LOGGER_ENTERFN( "CCmWlanCoverageCheck::GetCoverageL" );
+
+    iProgState = EServiceStatus;
+    iCoverage = 0;
+    
+    CWlanMgmtClient* wlanMgmt = CWlanMgmtClient::NewL();
+    CleanupStack::PushL( wlanMgmt );
+
+    CWlanScanInfo* scanInfo = CWlanScanInfo::NewL();
+    CleanupStack::PushL( scanInfo );
+
+    iProgState = EScanning;
+    
+    wlanMgmt->GetScanResults( iStatus, *scanInfo );
+    
+    SetActive();
+    iWait.Start();
+    
+    // now we have the results and might start to work on them...
+    if ( iProgState == EDone )
+        { //finished without error, work on the result...
+        CCmPluginWlanDataArray* wlandataarray = new ( ELeave ) 
+            CCmPluginWlanDataArray();
+        CleanupStack::PushL( wlandataarray );
+
+        for ( scanInfo->First(); !scanInfo->IsDone(); scanInfo->Next() )
+            {
+            // iWlanNetworks cannot be modified 'directly' in
+            // a const method (like GetBoolAttributeL), so we have to
+            // cast away the constness.
+            
+            // not simply count as before, but check if it is hidden,
+            // and do not allow duplicates...
+            TBool isHidden( EFalse );
+            
+            TUint8 ieLen( 0 );
+            const TUint8* ieData;
+            TBuf8<KWlanMaxSsidLength> ssid8;
+            
+            TInt ret = scanInfo->InformationElement( E802Dot11SsidIE, ieLen, 
+                                                      &ieData );
+            if ( ret == KErrNone ) 
+                {               
+                isHidden = IsHiddenSsid( ieLen, ieData );
+                if ( !isHidden )
+                    {
+                    // get the ssid
+                    ssid8.Copy( ieData, ieLen );
+                    HBufC* tmp = HBufC::NewLC(KWlanMaxSsidLength);
+                    TPtr tmpptr( tmp->Des() );
+                    
+                    tmpptr.Copy(ssid8);
+                    // get the signal strength                        
+                    TUint8 rxLevel8 = scanInfo->RXLevel();
+                    TInt rxLevel = static_cast< TInt >( rxLevel8 );
+                    
+                    // now add it to an array of CCmPluginWlanData,
+                    // as it is not hidden
+                    // the adding function should handle uniqeness and 
+                    // signal strength checking, it should contain only
+                    // the strongest signal!                        
+                    AddToArrayIfNeededL( *wlandataarray, rxLevel, tmpptr );
+                    
+                    CleanupStack::PopAndDestroy( tmp );
+                    }                
+                }
+            else
+                {
+                User::Leave( ret );
+                }
+            }
+        iCoverage = wlandataarray->Count();
+        
+        CleanupStack::PopAndDestroy( wlandataarray );
+
+        CleanupStack::PopAndDestroy( 2, wlanMgmt );
+        }
+    else
+        {
+        User::LeaveIfError( iStatus.Int() );        
+        }        
+        
+    return iCoverage;
+    }
+
+// ---------------------------------------------------------
+// CCmWlanCoverageCheck::IsHiddenSsid
+// ---------------------------------------------------------
+//    
+TBool CCmWlanCoverageCheck::IsHiddenSsid( TUint aSsidLength, 
+                                   const TUint8* aSsid ) const
+    {
+    LOGGER_ENTERFN( "CCmWlanCoverageCheck::IsHiddenSsid" );
+    
+    const TUint8 CSPACE = 0x20; 
+    TBool result( EFalse );
+    TBool result2( ETrue );
+
+    if ( !aSsidLength )
+        {
+        result = ETrue;
+        }
+
+    TInt count( 0 );
+    TUint8 temp( 0x00 );
+    
+    for ( TUint i( 0 ); i < aSsidLength; ++i )
+        {
+        temp = aSsid[i];
+        count += temp; // in hidden networks characters are: 0x00
+        result2 &= temp == CSPACE ;
+        }
+
+    if( !count || result2 )
+        {
+        result = ETrue;
+        }
+        
+    return result;    
+    }
+
+
+// ---------------------------------------------------------
+// CCmWlanCoverageCheck::AddToArrayIfNeededL
+// ---------------------------------------------------------
+//    
+void CCmWlanCoverageCheck::AddToArrayIfNeededL( 
+                            CCmPluginWlanDataArray& aArray, 
+                            TInt aRXLevel, 
+                            TDesC& aNetworkName ) const
+    {
+    LOGGER_ENTERFN( "CCmWlanCoverageCheck::AddToArrayIfNeededL" );
+
+    // first check if it is already in the array
+    
+    TBool found( EFalse );
+    TInt index( 0 );
+    TInt count = aArray.Count();
+    
+    while( ( index <  count ) && !found  )
+        {
+        if( ( aArray )[index]->iNetworkName->Compare( aNetworkName ) )
+            {
+            ++index;   
+            }
+        else
+            {
+            found = ETrue;
+            }
+        }
+
+    TSignalStrength strength = ( TSignalStrength )aRXLevel;
+    if ( found )
+        {
+        // if already exists, check signal strengths
+        TSignalStrength signal = ( aArray )[index]->iSignalStrength;
+        
+        // set to higher value
+        ( aArray )[index]->iSignalStrength = 
+                              signal < strength ? signal : strength ;
+        }
+    else
+        {
+        // new element, add it to array with signal strength!!
+        CCmPluginWlanData* data = CCmPluginWlanData::NewLC();
+        data->iNetworkName = aNetworkName.AllocL();
+        data->iSignalStrength = strength;
+        aArray.AppendL( data );
+        CleanupStack::Pop( data ); // item owned by list!
+        }    
+    }
+
+
+// ----------------------------------------------------------------------------
+// CCmWlanCoverageCheck::ScanForPromptedSsidL
+// ----------------------------------------------------------------------------
+//
+TBool CCmWlanCoverageCheck::ScanForPromptedSsidL( TWlanSsid aEnteredSsid,
+                                TBool aBroadcast,
+                                TWlanNetMode& aNetworkMode, 
+                                TWlanConnectionExtentedSecurityMode& aSecurityMode,
+                                TBool& aProtectedSetupSupported )
+    {
+    LOGGER_ENTERFN( "CCmWlanCoverageCheck::ScanForPromptedSsidL" );
+    
+    TBool found = EFalse;
+
+    iProgState = EServiceStatus;
+       
+    CWlanMgmtClient* wlanMgmt = CWlanMgmtClient::NewL();
+    CleanupStack::PushL( wlanMgmt );
+
+    CWlanScanInfo* scanInfo = CWlanScanInfo::NewL();
+    CleanupStack::PushL( scanInfo );
+
+    iProgState = EScanning;
+    
+    if ( aBroadcast )
+        {
+        wlanMgmt->GetScanResults( iStatus, *scanInfo );
+        }
+    else
+        {
+        wlanMgmt->GetScanResults( aEnteredSsid, iStatus, *scanInfo );
+        }
+
+    SetActive();
+    iWait.Start();
+    
+    // now we have the results and might start to work on them...
+    if ( iProgState == EDone )
+        {       //finished without error, work on the result...
+        TSignalStrength signalStrength = ESignalStrengthMin;
+
+        for ( scanInfo->First(); !scanInfo->IsDone(); scanInfo->Next() )
+            {
+            TUint8 ieLen( 0 );
+            const TUint8* ieData;
+            TBuf8<KWlanMaxSsidLength> ssid8;
+            
+            TInt ret = scanInfo->InformationElement( E802Dot11SsidIE, ieLen, 
+                                                     &ieData );
+            if ( ret == KErrNone ) 
+                {               
+                // get the ssid
+                ssid8.Copy( ieData, ieLen );
+                
+                if ( !aEnteredSsid.Compare( ssid8 ) )
+                    {
+                    // get the signal strength                        
+                    TUint8 rxLevel8 = scanInfo->RXLevel();
+                    TInt rxLevel = static_cast< TInt >( rxLevel8 );
+            
+                    TSignalStrength strength = ( TSignalStrength )rxLevel;
+                    if ( !found || ( found && strength < signalStrength ) )
+                        {
+                        found = ETrue;
+                        signalStrength = strength;
+
+                        aNetworkMode = ( scanInfo->Capability() & 
+                                         E802Dot11CapabilityEssMask ) ?
+                                       EInfra : EAdhoc;
+                        aSecurityMode = scanInfo->ExtendedSecurityMode();
+
+                        aProtectedSetupSupported = 
+                                        scanInfo->IsProtectedSetupSupported();
+                        }
+                    }
+                }
+            else
+                {
+                User::Leave( ret );
+                }
+        
+            }
+        
+        CleanupStack::PopAndDestroy( scanInfo );
+        CleanupStack::PopAndDestroy( wlanMgmt );
+        }
+    else
+        {
+        User::LeaveIfError( iStatus.Int() );        
+        }
+    
+    return found;
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Rom/CmManager.iby	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef __CMMANAGER_IBY__
+#define __CMMANAGER_IBY__
+
+
+file=ABI_DIR\BUILD_DIR\cmmanager.dll     SHARED_LIB_DIR\cmmanager.dll
+SCALABLE_IMAGE(APP_RESOURCE_DIR,APP_RESOURCE_DIR,cmmanager)
+
+
+
+#endif // __CMMANAGER_IBY__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Rom/CmManagerResources.iby	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef __CMMANAGER_RESOURCES_IBY__
+#define __CMMANAGER_RESOURCES_IBY__
+
+
+
+data=ZRESOURCE\cmmanager.rsc                                  RESOURCE_FILES_DIR\cmmanager.rsc
+
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Rom/cmplugincsd.iby	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef __CMPLUGINCSD_IBY__
+#define __CMPLUGINCSD_IBY__
+
+
+ECOM_PLUGIN(cmplugincsd.dll,10281BB6.rsc)
+SCALABLE_IMAGE(APP_BITMAP_DIR,APP_BITMAP_DIR,cmplugincsd)
+
+
+#endif // __CMPLUGINCSD_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Rom/cmplugincsdresources.iby	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef __CMPLUGINCSD_RESOURCES_IBY__
+#define __CMPLUGINCSD_RESOURCES_IBY__
+
+
+data = DATAZ_\RESOURCE_FILES_DIR\cmplugincsdui.rsc RESOURCE_FILES_DIR\cmplugincsdui.rsc
+
+
+#endif // __CMPLUGINCSD_RESOURCES_IBY__
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Rom/cmpluginembdestination.iby	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,24 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef __CMPLUGIN_EMBDESTINATION_IBY__
+#define __CMPLUGIN_EMBDESTINATION_IBY__
+
+
+ECOM_PLUGIN(cmpluginembdestination.dll,1020737D.rsc)
+
+
+#endif // __CMPLUGIN_EMBDESTINATION_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Rom/cmpluginembdestinationresources.iby	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef __CMPLUGIN_EMBDESTINATION_RESOURCES_IBY__
+#define __CMPLUGIN_EMBDESTINATION_RESOURCES_IBY__
+
+
+data = DATAZ_\RESOURCE_FILES_DIR\cmpluginembdestinationui.rsc RESOURCE_FILES_DIR\cmpluginembdestinationui.rsc
+
+
+#endif // __CMPLUGIN_EMBDESTINATION_RESOURCES_IBY__
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Rom/cmpluginpacketdata.iby	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef __CMPLUGINPACKETDATA_IBY__
+#define __CMPLUGINPACKETDATA_IBY__
+
+
+ECOM_PLUGIN(cmpluginpacketdata.dll,1020737C.rsc)
+SCALABLE_IMAGE(APP_BITMAP_DIR,APP_BITMAP_DIR,cmpluginpacketdata)
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Rom/cmpluginpacketdataresources.iby	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef __CMPLUGINPACKETDATA_RESOURCES_IBY__
+#define __CMPLUGINPACKETDATA_RESOURCES_IBY__
+
+
+data = DATAZ_\RESOURCE_FILES_DIR\cmpacketdataui.RSC     RESOURCE_FILES_DIR\cmpacketdataui.RSC
+
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Rom/cmpluginvpn.iby	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef __CMPLUGINVPN_IBY__
+#define __CMPLUGINVPN_IBY__
+
+
+ECOM_PLUGIN(cmpluginvpn.dll,10281BBD.rsc)
+SCALABLE_IMAGE(APP_BITMAP_DIR,APP_BITMAP_DIR,cmpluginvpn)
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Rom/cmpluginvpnresources.iby	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef __CMPLUGINVPN_RESOURCES_IBY__
+#define __CMPLUGINVPN_RESOURCES_IBY__
+
+
+data = DATAZ_\RESOURCE_FILES_DIR\cmpluginvpnui.rsc     RESOURCE_FILES_DIR\cmpluginvpnui.rsc
+
+#
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Rom/cmpluginwlan.iby	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef __CMPLUGINWLAN_IBY__
+#define __CMPLUGINWLAN_IBY__
+
+#if defined( __PROTOCOL_WLAN ) 
+
+ECOM_PLUGIN(cmpluginwlan.dll,10281BB2.rsc)
+SCALABLE_IMAGE(APP_BITMAP_DIR,APP_BITMAP_DIR,cmpluginwlan)
+
+#endif //   __PROTOCOL_WLAN
+
+#endif // __CMPLUGINWLAN_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/Rom/cmpluginwlanresources.iby	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef __CMPLUGINWLAN_RESOURCES_IBY__
+#define __CMPLUGINWLAN_RESOURCES_IBY__
+
+#if (  defined( __PROTOCOL_WLAN ) )
+
+data = DATAZ_\RESOURCE_FILES_DIR\cmwlanui.rsc RESOURCE_FILES_DIR\cmwlanui.rsc
+
+#endif //  __PROTOCOL_WLAN
+
+#endif // __CMPLUGINWLAN_RESOURCES_IBY__
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/database/bwinscw/cmmanagerdatabaseU.def	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,54 @@
+EXPORTS
+	??0CCDDataMobilitySelectionPolicyRecord@@QAE@K@Z @ 1 NONAME ; CCDDataMobilitySelectionPolicyRecord::CCDDataMobilitySelectionPolicyRecord(unsigned long)
+	??0CCDDestNWTable@@QAE@K@Z @ 2 NONAME ; CCDDestNWTable::CCDDestNWTable(unsigned long)
+	??0CCDGlobalBearerTypePriorizationRecord@@QAE@K@Z @ 3 NONAME ; CCDGlobalBearerTypePriorizationRecord::CCDGlobalBearerTypePriorizationRecord(unsigned long)
+	??0CCDIAPMetadataRecord@@QAE@K@Z @ 4 NONAME ; CCDIAPMetadataRecord::CCDIAPMetadataRecord(unsigned long)
+	??0CCDMIP4Record@@QAE@K@Z @ 5 NONAME ; CCDMIP4Record::CCDMIP4Record(unsigned long)
+	??0CCDMIP6Record@@QAE@K@Z @ 6 NONAME ; CCDMIP6Record::CCDMIP6Record(unsigned long)
+	??0CCDMIPServiceExtRecord@@QAE@K@Z @ 7 NONAME ; CCDMIPServiceExtRecord::CCDMIPServiceExtRecord(unsigned long)
+	??0CCDSNAPMetadataRecord@@QAE@K@Z @ 8 NONAME ; CCDSNAPMetadataRecord::CCDSNAPMetadataRecord(unsigned long)
+	??0CCDVirtualIAPNextLayerRecord@@QAE@K@Z @ 9 NONAME ; CCDVirtualIAPNextLayerRecord::CCDVirtualIAPNextLayerRecord(unsigned long)
+	??0CCDWLANSecSSIDTable@@QAE@K@Z @ 10 NONAME ; CCDWLANSecSSIDTable::CCDWLANSecSSIDTable(unsigned long)
+	??0CCDWlanDeviceSettingsRecord@@QAE@K@Z @ 11 NONAME ; CCDWlanDeviceSettingsRecord::CCDWlanDeviceSettingsRecord(unsigned long)
+	??0CCDWlanServiceRecord@@QAE@K@Z @ 12 NONAME ; CCDWlanServiceRecord::CCDWlanServiceRecord(unsigned long)
+	?CreateTableL@CCDDataMobilitySelectionPolicyRecord@@SAKAAVCMDBSession@CommsDat@@@Z @ 13 NONAME ; unsigned long CCDDataMobilitySelectionPolicyRecord::CreateTableL(class CommsDat::CMDBSession &)
+	?CreateTableL@CCDDestNWTable@@SAKAAVCMDBSession@CommsDat@@@Z @ 14 NONAME ; unsigned long CCDDestNWTable::CreateTableL(class CommsDat::CMDBSession &)
+	?CreateTableL@CCDGlobalBearerTypePriorizationRecord@@SAKAAVCMDBSession@CommsDat@@@Z @ 15 NONAME ; unsigned long CCDGlobalBearerTypePriorizationRecord::CreateTableL(class CommsDat::CMDBSession &)
+	?CreateTableL@CCDIAPMetadataRecord@@SAKAAVCMDBSession@CommsDat@@@Z @ 16 NONAME ; unsigned long CCDIAPMetadataRecord::CreateTableL(class CommsDat::CMDBSession &)
+	?CreateTableL@CCDMIP4Record@@SAKAAVCMDBSession@CommsDat@@@Z @ 17 NONAME ; unsigned long CCDMIP4Record::CreateTableL(class CommsDat::CMDBSession &)
+	?CreateTableL@CCDMIP6Record@@SAKAAVCMDBSession@CommsDat@@@Z @ 18 NONAME ; unsigned long CCDMIP6Record::CreateTableL(class CommsDat::CMDBSession &)
+	?CreateTableL@CCDMIPServiceExtRecord@@SAKAAVCMDBSession@CommsDat@@@Z @ 19 NONAME ; unsigned long CCDMIPServiceExtRecord::CreateTableL(class CommsDat::CMDBSession &)
+	?CreateTableL@CCDSNAPMetadataRecord@@SAKAAVCMDBSession@CommsDat@@@Z @ 20 NONAME ; unsigned long CCDSNAPMetadataRecord::CreateTableL(class CommsDat::CMDBSession &)
+	?CreateTableL@CCDVirtualIAPNextLayerRecord@@SAKAAVCMDBSession@CommsDat@@@Z @ 21 NONAME ; unsigned long CCDVirtualIAPNextLayerRecord::CreateTableL(class CommsDat::CMDBSession &)
+	?CreateTableL@CCDWLANSecSSIDTable@@SAKAAVCMDBSession@CommsDat@@@Z @ 22 NONAME ; unsigned long CCDWLANSecSSIDTable::CreateTableL(class CommsDat::CMDBSession &)
+	?CreateTableL@CCDWlanDeviceSettingsRecord@@SAKAAVCMDBSession@CommsDat@@@Z @ 23 NONAME ; unsigned long CCDWlanDeviceSettingsRecord::CreateTableL(class CommsDat::CMDBSession &)
+	?CreateTableL@CCDWlanServiceRecord@@SAKAAVCMDBSession@CommsDat@@@Z @ 24 NONAME ; unsigned long CCDWlanServiceRecord::CreateTableL(class CommsDat::CMDBSession &)
+	?GetRecordInfo@CCDDataMobilitySelectionPolicyRecord@@UAEPBUSRecordTypeInfo@CommsDat@@XZ @ 25 NONAME ; struct CommsDat::SRecordTypeInfo const * CCDDataMobilitySelectionPolicyRecord::GetRecordInfo(void)
+	?GetRecordInfo@CCDDestNWTable@@UAEPBUSRecordTypeInfo@CommsDat@@XZ @ 26 NONAME ; struct CommsDat::SRecordTypeInfo const * CCDDestNWTable::GetRecordInfo(void)
+	?GetRecordInfo@CCDGlobalBearerTypePriorizationRecord@@UAEPBUSRecordTypeInfo@CommsDat@@XZ @ 27 NONAME ; struct CommsDat::SRecordTypeInfo const * CCDGlobalBearerTypePriorizationRecord::GetRecordInfo(void)
+	?GetRecordInfo@CCDIAPMetadataRecord@@UAEPBUSRecordTypeInfo@CommsDat@@XZ @ 28 NONAME ; struct CommsDat::SRecordTypeInfo const * CCDIAPMetadataRecord::GetRecordInfo(void)
+	?GetRecordInfo@CCDMIP4Record@@UAEPBUSRecordTypeInfo@CommsDat@@XZ @ 29 NONAME ; struct CommsDat::SRecordTypeInfo const * CCDMIP4Record::GetRecordInfo(void)
+	?GetRecordInfo@CCDMIP6Record@@UAEPBUSRecordTypeInfo@CommsDat@@XZ @ 30 NONAME ; struct CommsDat::SRecordTypeInfo const * CCDMIP6Record::GetRecordInfo(void)
+	?GetRecordInfo@CCDMIPServiceExtRecord@@UAEPBUSRecordTypeInfo@CommsDat@@XZ @ 31 NONAME ; struct CommsDat::SRecordTypeInfo const * CCDMIPServiceExtRecord::GetRecordInfo(void)
+	?GetRecordInfo@CCDSNAPMetadataRecord@@UAEPBUSRecordTypeInfo@CommsDat@@XZ @ 32 NONAME ; struct CommsDat::SRecordTypeInfo const * CCDSNAPMetadataRecord::GetRecordInfo(void)
+	?GetRecordInfo@CCDVirtualIAPNextLayerRecord@@UAEPBUSRecordTypeInfo@CommsDat@@XZ @ 33 NONAME ; struct CommsDat::SRecordTypeInfo const * CCDVirtualIAPNextLayerRecord::GetRecordInfo(void)
+	?GetRecordInfo@CCDWLANSecSSIDTable@@UAEPBUSRecordTypeInfo@CommsDat@@XZ @ 34 NONAME ; struct CommsDat::SRecordTypeInfo const * CCDWLANSecSSIDTable::GetRecordInfo(void)
+	?GetRecordInfo@CCDWlanDeviceSettingsRecord@@UAEPBUSRecordTypeInfo@CommsDat@@XZ @ 35 NONAME ; struct CommsDat::SRecordTypeInfo const * CCDWlanDeviceSettingsRecord::GetRecordInfo(void)
+	?GetRecordInfo@CCDWlanServiceRecord@@UAEPBUSRecordTypeInfo@CommsDat@@XZ @ 36 NONAME ; struct CommsDat::SRecordTypeInfo const * CCDWlanServiceRecord::GetRecordInfo(void)
+	?TableIdL@CCDDataMobilitySelectionPolicyRecord@@SAKAAVCMDBSession@CommsDat@@@Z @ 37 NONAME ; unsigned long CCDDataMobilitySelectionPolicyRecord::TableIdL(class CommsDat::CMDBSession &)
+	?TableIdL@CCDDestNWTable@@SAKAAVCMDBSession@CommsDat@@@Z @ 38 NONAME ; unsigned long CCDDestNWTable::TableIdL(class CommsDat::CMDBSession &)
+	?TableIdL@CCDGlobalBearerTypePriorizationRecord@@SAKAAVCMDBSession@CommsDat@@@Z @ 39 NONAME ; unsigned long CCDGlobalBearerTypePriorizationRecord::TableIdL(class CommsDat::CMDBSession &)
+	?TableIdL@CCDIAPMetadataRecord@@SAKAAVCMDBSession@CommsDat@@@Z @ 40 NONAME ; unsigned long CCDIAPMetadataRecord::TableIdL(class CommsDat::CMDBSession &)
+	?TableIdL@CCDMIP4Record@@SAKAAVCMDBSession@CommsDat@@@Z @ 41 NONAME ; unsigned long CCDMIP4Record::TableIdL(class CommsDat::CMDBSession &)
+	?TableIdL@CCDMIP6Record@@SAKAAVCMDBSession@CommsDat@@@Z @ 42 NONAME ; unsigned long CCDMIP6Record::TableIdL(class CommsDat::CMDBSession &)
+	?TableIdL@CCDMIPServiceExtRecord@@SAKAAVCMDBSession@CommsDat@@@Z @ 43 NONAME ; unsigned long CCDMIPServiceExtRecord::TableIdL(class CommsDat::CMDBSession &)
+	?TableIdL@CCDSNAPMetadataRecord@@SAKAAVCMDBSession@CommsDat@@@Z @ 44 NONAME ; unsigned long CCDSNAPMetadataRecord::TableIdL(class CommsDat::CMDBSession &)
+	?TableIdL@CCDVirtualIAPNextLayerRecord@@SAKAAVCMDBSession@CommsDat@@@Z @ 45 NONAME ; unsigned long CCDVirtualIAPNextLayerRecord::TableIdL(class CommsDat::CMDBSession &)
+	?TableIdL@CCDWLANSecSSIDTable@@SAKAAVCMDBSession@CommsDat@@@Z @ 46 NONAME ; unsigned long CCDWLANSecSSIDTable::TableIdL(class CommsDat::CMDBSession &)
+	?TableIdL@CCDWlanDeviceSettingsRecord@@SAKAAVCMDBSession@CommsDat@@@Z @ 47 NONAME ; unsigned long CCDWlanDeviceSettingsRecord::TableIdL(class CommsDat::CMDBSession &)
+	?TableIdL@CCDWlanServiceRecord@@SAKAAVCMDBSession@CommsDat@@@Z @ 48 NONAME ; unsigned long CCDWlanServiceRecord::TableIdL(class CommsDat::CMDBSession &)
+	??0CCDDefConnRecord@@QAE@K@Z @ 49 NONAME ; CCDDefConnRecord::CCDDefConnRecord(unsigned long)
+	?CreateTableL@CCDDefConnRecord@@SAKAAVCMDBSession@CommsDat@@@Z @ 50 NONAME ; unsigned long CCDDefConnRecord::CreateTableL(class CommsDat::CMDBSession &)
+	?GetRecordInfo@CCDDefConnRecord@@UAEPBUSRecordTypeInfo@CommsDat@@XZ @ 51 NONAME ; struct CommsDat::SRecordTypeInfo const * CCDDefConnRecord::GetRecordInfo(void)
+	?TableIdL@CCDDefConnRecord@@SAKAAVCMDBSession@CommsDat@@@Z @ 52 NONAME ; unsigned long CCDDefConnRecord::TableIdL(class CommsDat::CMDBSession &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/database/eabi/cmmanagerdatabaseU.def	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,67 @@
+EXPORTS
+	_ZN13CCDMIP4Record12CreateTableLERN8CommsDat11CMDBSessionE @ 1 NONAME
+	_ZN13CCDMIP4Record13GetRecordInfoEv @ 2 NONAME
+	_ZN13CCDMIP4Record8TableIdLERN8CommsDat11CMDBSessionE @ 3 NONAME
+	_ZN13CCDMIP4RecordC1Em @ 4 NONAME
+	_ZN13CCDMIP4RecordC2Em @ 5 NONAME
+	_ZN13CCDMIP6Record12CreateTableLERN8CommsDat11CMDBSessionE @ 6 NONAME
+	_ZN13CCDMIP6Record13GetRecordInfoEv @ 7 NONAME
+	_ZN13CCDMIP6Record8TableIdLERN8CommsDat11CMDBSessionE @ 8 NONAME
+	_ZN13CCDMIP6RecordC1Em @ 9 NONAME
+	_ZN13CCDMIP6RecordC2Em @ 10 NONAME
+	_ZN14CCDDestNWTable12CreateTableLERN8CommsDat11CMDBSessionE @ 11 NONAME
+	_ZN14CCDDestNWTable13GetRecordInfoEv @ 12 NONAME
+	_ZN14CCDDestNWTable8TableIdLERN8CommsDat11CMDBSessionE @ 13 NONAME
+	_ZN14CCDDestNWTableC1Em @ 14 NONAME
+	_ZN14CCDDestNWTableC2Em @ 15 NONAME
+	_ZN19CCDWLANSecSSIDTable12CreateTableLERN8CommsDat11CMDBSessionE @ 16 NONAME
+	_ZN19CCDWLANSecSSIDTable13GetRecordInfoEv @ 17 NONAME
+	_ZN19CCDWLANSecSSIDTable8TableIdLERN8CommsDat11CMDBSessionE @ 18 NONAME
+	_ZN19CCDWLANSecSSIDTableC1Em @ 19 NONAME
+	_ZN19CCDWLANSecSSIDTableC2Em @ 20 NONAME
+	_ZN20CCDIAPMetadataRecord12CreateTableLERN8CommsDat11CMDBSessionE @ 21 NONAME
+	_ZN20CCDIAPMetadataRecord13GetRecordInfoEv @ 22 NONAME
+	_ZN20CCDIAPMetadataRecord8TableIdLERN8CommsDat11CMDBSessionE @ 23 NONAME
+	_ZN20CCDIAPMetadataRecordC1Em @ 24 NONAME
+	_ZN20CCDIAPMetadataRecordC2Em @ 25 NONAME
+	_ZN20CCDWlanServiceRecord12CreateTableLERN8CommsDat11CMDBSessionE @ 26 NONAME
+	_ZN20CCDWlanServiceRecord13GetRecordInfoEv @ 27 NONAME
+	_ZN20CCDWlanServiceRecord8TableIdLERN8CommsDat11CMDBSessionE @ 28 NONAME
+	_ZN20CCDWlanServiceRecordC1Em @ 29 NONAME
+	_ZN20CCDWlanServiceRecordC2Em @ 30 NONAME
+	_ZN21CCDSNAPMetadataRecord12CreateTableLERN8CommsDat11CMDBSessionE @ 31 NONAME
+	_ZN21CCDSNAPMetadataRecord13GetRecordInfoEv @ 32 NONAME
+	_ZN21CCDSNAPMetadataRecord8TableIdLERN8CommsDat11CMDBSessionE @ 33 NONAME
+	_ZN21CCDSNAPMetadataRecordC1Em @ 34 NONAME
+	_ZN21CCDSNAPMetadataRecordC2Em @ 35 NONAME
+	_ZN22CCDMIPServiceExtRecord12CreateTableLERN8CommsDat11CMDBSessionE @ 36 NONAME
+	_ZN22CCDMIPServiceExtRecord13GetRecordInfoEv @ 37 NONAME
+	_ZN22CCDMIPServiceExtRecord8TableIdLERN8CommsDat11CMDBSessionE @ 38 NONAME
+	_ZN22CCDMIPServiceExtRecordC1Em @ 39 NONAME
+	_ZN22CCDMIPServiceExtRecordC2Em @ 40 NONAME
+	_ZN27CCDWlanDeviceSettingsRecord12CreateTableLERN8CommsDat11CMDBSessionE @ 41 NONAME
+	_ZN27CCDWlanDeviceSettingsRecord13GetRecordInfoEv @ 42 NONAME
+	_ZN27CCDWlanDeviceSettingsRecord8TableIdLERN8CommsDat11CMDBSessionE @ 43 NONAME
+	_ZN27CCDWlanDeviceSettingsRecordC1Em @ 44 NONAME
+	_ZN27CCDWlanDeviceSettingsRecordC2Em @ 45 NONAME
+	_ZN28CCDVirtualIAPNextLayerRecord12CreateTableLERN8CommsDat11CMDBSessionE @ 46 NONAME
+	_ZN28CCDVirtualIAPNextLayerRecord13GetRecordInfoEv @ 47 NONAME
+	_ZN28CCDVirtualIAPNextLayerRecord8TableIdLERN8CommsDat11CMDBSessionE @ 48 NONAME
+	_ZN28CCDVirtualIAPNextLayerRecordC1Em @ 49 NONAME
+	_ZN28CCDVirtualIAPNextLayerRecordC2Em @ 50 NONAME
+	_ZN36CCDDataMobilitySelectionPolicyRecord12CreateTableLERN8CommsDat11CMDBSessionE @ 51 NONAME
+	_ZN36CCDDataMobilitySelectionPolicyRecord13GetRecordInfoEv @ 52 NONAME
+	_ZN36CCDDataMobilitySelectionPolicyRecord8TableIdLERN8CommsDat11CMDBSessionE @ 53 NONAME
+	_ZN36CCDDataMobilitySelectionPolicyRecordC1Em @ 54 NONAME
+	_ZN36CCDDataMobilitySelectionPolicyRecordC2Em @ 55 NONAME
+	_ZN37CCDGlobalBearerTypePriorizationRecord12CreateTableLERN8CommsDat11CMDBSessionE @ 56 NONAME
+	_ZN37CCDGlobalBearerTypePriorizationRecord13GetRecordInfoEv @ 57 NONAME
+	_ZN37CCDGlobalBearerTypePriorizationRecord8TableIdLERN8CommsDat11CMDBSessionE @ 58 NONAME
+	_ZN37CCDGlobalBearerTypePriorizationRecordC1Em @ 59 NONAME
+	_ZN37CCDGlobalBearerTypePriorizationRecordC2Em @ 60 NONAME
+	_ZN16CCDDefConnRecord12CreateTableLERN8CommsDat11CMDBSessionE @ 61 NONAME
+	_ZN16CCDDefConnRecord13GetRecordInfoEv @ 62 NONAME
+	_ZN16CCDDefConnRecord8TableIdLERN8CommsDat11CMDBSessionE @ 63 NONAME
+	_ZN16CCDDefConnRecordC1Em @ 64 NONAME
+	_ZN16CCDDefConnRecordC2Em @ 65 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/database/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2006-2008 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 CMM database
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+// export iby file
+../rom/cmmanagerdatabase.iby           CORE_MW_LAYER_IBY_EXPORT_PATH(cmmanagerdatabase.iby)
+../inc/datamobilitycommsdattypes.h     |../../../../inc/datamobilitycommsdattypes.h
+
+PRJ_MMPFILES
+
+cmmanagerdatabase.mmp
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/database/group/cmmanagerdatabase.mmp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,59 @@
+/*
+* 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: 
+*     Build mmp file
+*     
+*
+*/
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+TARGET        	cmmanagerdatabase.dll
+TARGETTYPE    	dll
+UID           	0x1000008d 0x10281BB9
+CAPABILITY		CAP_GENERAL_DLL
+VENDORID VID_DEFAULT
+
+
+SOURCEPATH      ../src
+
+SOURCE 			cmmanagertableformats.cpp
+SOURCE          datamobilitycommsdattypes.cpp
+
+// Component specific internal headers 
+USERINCLUDE			../inc
+
+// ADO specific internal headers 
+SYSTEMINCLUDE		../../../../inc
+
+//Macro to /epoc32 headers
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY       	euser.lib
+//LIBRARY         ECom.lib
+LIBRARY         COMMSDAT.lib
+//LIBRARY         flogger.lib
+
+
+#if defined(ARMCC)
+    DEFFILE ../eabi/cmmanagerdatabase.def
+#elif defined( WINSCW )
+    DEFFILE ../bwinscw/cmmanagerdatabase.def
+#elif defined( WINS )
+    DEFFILE ../BWins/cmmanagerdatabase.def
+#else
+    DEFFILE ../BMarm/cmmanagerdatabase.def
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/database/inc/datamobilitycommsdattypes.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,487 @@
+/*
+* 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:  Contains classes for accessing data mobility related tables 
+*                in the CommsDat as well as data structures for creating the 
+*                tables.
+*
+*/
+
+#ifndef DATAMOBILITYCOMMSDATTYPES_H
+#define DATAMOBILITYCOMMSDATTYPES_H
+
+#include <commsdattypesv1_1.h>
+
+//Definitions of table and field names. These follow
+//the format of the existing CommsDat tables in CommsDatTypeInfoV1_1.h
+
+//Virtual IAP Next Layer Table
+#define KCDTypeNameVirtualIAPNextLayer  _S( "VirtualIAPNextLayer" )
+#define KCDTypeNameVirtualIAP _S( "IAP" )
+#define KCDTypeNameVirtualIAPNextLayerSNAP _S( "NextLayerSNAP" )
+#define KCDTypeNameVirtualIAPNextLayerIAP _S( "NextLayerIAP" )
+
+//Data Mobility Selection Policy table and fields
+#define KCDTypeNameDataMobilitySelectionPolicy _S( "DataMobilitySelectionPolicy" )
+#define KCDTypeNameDataMobilitySelectionPolicySNAP _S( "SNAP" )
+#define KCDTypeNameDataMobilitySelectionPolicyIAP _S( "IAP" )
+#define KCDTypeNameDataMobilitySelectionPolicyEmbeddedSNAP _S( "EmbeddedSNAP" )
+#define KCDTypeNameDataMobilitySelectionPolicyPriority _S( "Priority" )
+
+//SNAP Metadata table and fields
+#define KCDTypeNameSNAPMetadata _S( "SNAPMetadata" )
+#define KCDTypeNameSNAPMetadataSNAP _S( "SNAP" )
+#define KCDTypeNameSNAPMetadataMetadata _S( "Metadata" )
+#define KCDTypeNameSNAPMetadataIcon _S( "Icon" )
+
+//Global bearer priorization table and fields
+#define KCDTypeNameGlobalService _S( "GlobalBearerTypePriorization" )
+#define KCDTypeNameGlobalServiceType _S( "ServiceType" )
+#define KCDTypeNameGlobalServicePriority _S( "Priority" )
+#define KCDTypeNameGlobalServiceUIPriority _S( "UIPriority" )
+
+//MIP Service table and fields
+#define KCDTypeNameMIPServiceExt _S( "MIPServiceExtension" )
+#define KCDTypeNameMIPMIP4 _S( "MIP4" )
+#define KCDTypeNameMIPMIP6 _S( "MIP6" )
+
+//IAP Metadata table and fields
+#define KCDTypeNameIAPMetadata _S( "IAPMetadata" )
+#define KCDTypeNameIAPMetadataIAP _S( "IAP" )
+#define KCDTypeNameIAPMetadataMetadata _S( "Metadata" )
+#define KCDTypeNameIAPMetadataSeamlessness _S( "Seamlessness" )
+
+//MIP4 table and fields
+#define KCDTypeNameMIP4 _S( "MIP4" )
+#define KCDTypeNameMIP4HomeAddress _S( "HomeAddress" )
+#define KCDTypeNameMIP4MaxRegRetries _S( "MaxRegRetries" ) 
+#define KCDTypeNameMIP4FirstRetryTimeout _S( "FirstRetryTimeout" )
+#define KCDTypeNameMIP4InitialLifetime _S( "InitialLifetime" )
+#define KCDTypeNameMIP4NAI _S( "NAI" )
+#define KCDTypeNameMIP4HomeAgentAddress _S( "HomeAgentAddress" )
+#define KCDTypeNameMIP4SecondaryHomeAgentAddress _S( "SecondaryHomeAgentAddress" )
+#define KCDTypeNameMIP4EnableReverseTunnel _S( "EnableReverseTunnel" )
+#define KCDTypeNameMIP4EnableNATTraversal _S( "EnableNATTraversal" )
+#define KCDTypeNameMIP4EnableMinimalEncapsulation _S( "EnableMinimalEncapsulation" )
+#define KCDTypeNameMIP4MNHAAuthAlgorithm _S( "MNHAAuthAlgorithm" )
+#define KCDTypeNameMIP4MNHASPIIndicator _S( "MNHASPIIndicator" )
+#define KCDTypeNameMIP4MNHASPI _S( "MNHASPI" )
+#define KCDTypeNameMIP4MNHASSData _S( "MNHASSData" )
+#define KCDTypeNameMIP4MNAAAAuthAlgorithm _S( "MNAAAAuthAlgorithm" )
+#define KCDTypeNameMIP4MNAAASPIIndicator _S( "MNAAASPIIndicator" )
+#define KCDTypeNameMIP4MNAAASPI _S( "MNAAASPI" )
+#define KCDTypeNameMIP4MNAAASSData _S( "MNAAASSData" )
+#define KCDTypeNameMIP4UseForeignAgent _S( "USEForeignAgent" )
+#define KCDTypeNameMIP4MNFAAuthAlgorithm _S( "MNFAAuthAlgorithm" )
+#define KCDTypeNameMIP4MNFASPIIndicator _S( "MNFASPIIndicator" )
+#define KCDTypeNameMIP4MNFASPI _S( "MNFASPI" )
+#define KCDTypeNameMIP4MNFASSData _S( "MNFASSData" )
+
+//MIP6 table and fields
+#define KCDTypeNameMIP6 _S( "MIP6" )
+#define KCDTypeNameMIP6HomeAddress _S( "HomeAddress" )
+#define KCDTypeNameMIP6HomeAgentAddress  _S( "HomeAgentAddress" )
+#define KCDTypeNameMIP6PrefixLength  _S( "PrefixLength" )
+#define KCDTypeNameMIP6EnableRouteOptimization  _S( "EnableRouteOptimization" )
+#define KCDTypeNameMIP6EnableIPSec  _S( "EnableIPSec" )
+#define KCDTypeNameMIP6MNHAAuthAlgorithm   _S( "MNHAAuthAlgorithm" )
+#define KCDTypeNameMIP6MNHAEncryptAlgorithm _S( "MNHAEncryptAlgorithm" )
+#define KCDTypeNameMIP6MNHASPIIndicator  _S( "MNHASPIIndicator" )
+#define KCDTypeNameMIP6MNHASPI _S( "MNHASPI" )
+#define KCDTypeNameMIP6MNHASSData _S( "MNHASSData" )
+#define KCDTypeNameMIP6HookState _S( "HookState" )
+#define KCDTypeNameMIP6IFName _S( "IFName" )
+#define KCDTypeNameMIP6TunnelIFName  _S( "TunnelIFName" )
+
+
+// IDs for columns  These follow the format of 
+// the existing CommsDat tables in CommsDatTypeInfoV1_1.h
+    
+  
+    // virtual IAP next layer table
+const CommsDat::TMDBElementId KCDTIdVirtualIAP = 0x00120000;
+const CommsDat::TMDBElementId KCDTIdVirtualNextLayerSNAP = 0x00130000;
+const CommsDat::TMDBElementId KCDTIdVirtualNextLayerIAP = 0x00140000;
+
+   //DataMobilitySelectionPolicy table
+const CommsDat::TMDBElementId KCDTIdDataMobilitySelectionPolicyNetwork  = 0x00120000;
+const CommsDat::TMDBElementId KCDTIdDataMobilitySelectionPolicyIAP = 0x00130000;
+const CommsDat::TMDBElementId KCDTIdDataMobilitySelectionPolicyEmbeddedSNAP = 0x00140000;
+//valid priorities are 1, 2, ... 255
+const CommsDat::TMDBElementId KCDTIdDataMobilitySelectionPolicyPriority  = 0x00150000;
+
+    //SNAP Metadata 
+const CommsDat::TMDBElementId KCDTIdSNAPMetadataSNAP  = 0x00120000;
+const CommsDat::TMDBElementId KCDTIdSNAPMetadataMetadata  = 0x00130000;
+const CommsDat::TMDBElementId KCDTIdSNAPMetadataIcon  = 0x00140000;
+
+    //mip service extension table
+const CommsDat::TMDBElementId KCDTIdMIPMIP4  = 0x00120000;
+const CommsDat::TMDBElementId KCDTIdMIPMIP6  = 0x00130000;
+
+    //Global bearer type priorization
+const CommsDat::TMDBElementId KCDTIdGlobalServiceType  = 0x00120000;
+const CommsDat::TMDBElementId KCDTIdGlobalServicePriority  = 0x00130000;
+const CommsDat::TMDBElementId KCDTIdGlobalServiceUIPriority  = 0x00140000;
+
+    //IAP Metadata
+const CommsDat::TMDBElementId KCDTIdIAPMetadataIAP  = 0x00120000;
+const CommsDat::TMDBElementId KCDTIdIAPMetadataMetadata  = 0x00130000;
+const CommsDat::TMDBElementId KCDTIdIAPMetadataSeamlessness  = 0x00140000;
+
+//MIP4 Metadata
+const CommsDat::TMDBElementId KCDTIdMIP4HomeAddress = 0x00120000;
+const CommsDat::TMDBElementId KCDTIdMIP4MaxRegRetries = 0x00130000;
+const CommsDat::TMDBElementId KCDTIdMIP4FirstRetryTimeout = 0x00140000;
+const CommsDat::TMDBElementId KCDTIdMIP4InitialLifetime = 0x00150000;
+const CommsDat::TMDBElementId KCDTIdMIP4NAI = 0x00160000;
+const CommsDat::TMDBElementId KCDTIdMIP4HomeAgentAddress = 0x00170000;
+const CommsDat::TMDBElementId KCDTIdMIP4SecondaryHomeAgentAddress = 0x00180000;
+const CommsDat::TMDBElementId KCDTIdMIP4EnableReverseTunnel = 0x00190000;
+const CommsDat::TMDBElementId KCDTIdMIP4EnableNATTraversal = 0x001A0000;
+const CommsDat::TMDBElementId KCDTIdMIP4EnableMinimalEncapsulation = 0x001B0000;
+const CommsDat::TMDBElementId KCDTIdMIP4MNHAAuthAlgorithm = 0x001C0000;
+const CommsDat::TMDBElementId KCDTIdMIP4MNHASPIIndicator = 0x001D0000;
+const CommsDat::TMDBElementId KCDTIdMIP4MNHASPI = 0x001E0000;
+const CommsDat::TMDBElementId KCDTIdMIP4MNHASSData = 0x001F0000;
+const CommsDat::TMDBElementId KCDTIdMIP4MNAAAAuthAlgorithm = 0x00200000;
+const CommsDat::TMDBElementId KCDTIdMIP4MNAAASPIIndicator = 0x00210000;
+const CommsDat::TMDBElementId KCDTIdMIP4MNAAASPI = 0x00220000;
+const CommsDat::TMDBElementId KCDTIdMIP4MNAAASSData = 0x00230000;
+const CommsDat::TMDBElementId KCDTIdMIP4UseForeignAgent = 0x00240000;
+const CommsDat::TMDBElementId KCDTIdMIP4MNFAAuthAlgorithm = 0x00250000;
+const CommsDat::TMDBElementId KCDTIdMIP4MNFASPIIndicator = 0x00260000;
+const CommsDat::TMDBElementId KCDTIdMIP4MNFASPI = 0x00270000;
+const CommsDat::TMDBElementId KCDTIdMIP4MNFASSData = 0x00280000;
+
+//MIP6 Metadata
+const CommsDat::TMDBElementId KCDTIdMIP6HomeAddress = 0x00120000;
+const CommsDat::TMDBElementId KCDTIdMIP6HomeAgentAddress = 0x00130000;
+const CommsDat::TMDBElementId KCDTIdMIP6PrefixLength = 0x00140000;
+const CommsDat::TMDBElementId KCDTIdMIP6EnableRouteOptimization = 0x00150000;
+const CommsDat::TMDBElementId KCDTIdMIP6EnableIPSec = 0x00160000;
+const CommsDat::TMDBElementId KCDTIdMIP6MNHAAuthAlgorithm = 0x00170000;
+const CommsDat::TMDBElementId KCDTIdMIP6MNHAEncryptAlgorithm = 0x00180000;
+const CommsDat::TMDBElementId KCDTIdMIP6MNHASPIIndicator = 0x00190000;
+const CommsDat::TMDBElementId KCDTIdMIP6MNHASPI = 0x001A0000;
+const CommsDat::TMDBElementId KCDTIdMIP6MNHASSData = 0x001B0000;
+const CommsDat::TMDBElementId KCDTIdMIP6HookState = 0x001C0000;
+const CommsDat::TMDBElementId KCDTIdMIP6IFName = 0x001D0000;
+const CommsDat::TMDBElementId KCDTIdMIP6TunnelIFName = 0x001E0000;
+
+NONSHARABLE_CLASS( CCDVirtualIAPNextLayerRecord ) : public CommsDat::CCDRecordBase
+    {
+    public:
+    
+    IMPORT_C CCDVirtualIAPNextLayerRecord( CommsDat::TMDBElementId aElementId );
+    
+    IMPORT_C const CommsDat::SRecordTypeInfo* GetRecordInfo();
+
+    IMPORT_C static CommsDat::TMDBElementId CreateTableL( CommsDat::CMDBSession& aSession );
+    IMPORT_C static CommsDat::TMDBElementId TableIdL( CommsDat::CMDBSession& aSession );
+    
+    DATA_VTABLE
+        
+    public:
+    CommsDat::CMDBField<TUint> iIAP;
+    CommsDat::CMDBField<TUint> iNextLayerSNAP;
+    CommsDat::CMDBField<TUint> iNextLayerIAP;    
+    
+    private:
+    
+        static const CommsDat::SRecordTypeInfo iRecordInfo[];
+    };
+                                                
+/**
+ *  Class representing records in the Data Mobility Selection Policy table
+ *
+ *  @lib cmmanager.lib
+ *  @since S60 v3.2
+ */
+// Should be inherited from CCDSelectionPolicyRecordBase 
+// when SNAPs are taken to use. Constructor implementation 
+// only available for CommsDat::CCDRecordBase
+NONSHARABLE_CLASS( CCDDataMobilitySelectionPolicyRecord ) : public CommsDat::CCDRecordBase
+    {
+    public:
+        
+        IMPORT_C CCDDataMobilitySelectionPolicyRecord( CommsDat::TMDBElementId aElementId );
+            
+        IMPORT_C const CommsDat::SRecordTypeInfo* GetRecordInfo();
+
+        IMPORT_C static CommsDat::TMDBElementId CreateTableL( CommsDat::CMDBSession& aSession );
+        IMPORT_C static CommsDat::TMDBElementId TableIdL( CommsDat::CMDBSession& aSession );
+        
+        DATA_VTABLE
+    
+    public:
+    
+        //if snap taken to use dn (and iap) could be changed to ap link
+        CommsDat::CMDBField<TInt> iSNAP;
+        CommsDat::CMDBRecordLink<CommsDat::CCDIAPRecord> iIAP;
+        CommsDat::CMDBField<TInt> iEmbeddedSNAP;
+        CommsDat::CMDBField<TUint> iPriority;
+    
+     private:
+    
+        static const CommsDat::SRecordTypeInfo iRecordInfo[];
+    };
+
+/**
+ *  Class representing records in the SNAP Metadata table
+ *
+ *  @lib ?library
+ *  @since S60 ?S60_version *** for example, S60 v3.0
+ */
+NONSHARABLE_CLASS( CCDSNAPMetadataRecord ): public CommsDat::CCDRecordBase
+{
+    public:
+        
+    IMPORT_C CCDSNAPMetadataRecord( CommsDat::TMDBElementId aElementId );
+        
+    IMPORT_C const CommsDat::SRecordTypeInfo* GetRecordInfo();
+
+    IMPORT_C static CommsDat::TMDBElementId CreateTableL( CommsDat::CMDBSession& aSession );
+    IMPORT_C static CommsDat::TMDBElementId TableIdL( CommsDat::CMDBSession& aSession );
+    
+    DATA_VTABLE
+    
+    public:
+    CommsDat::CMDBField<TInt> iSNAP;
+    CommsDat::CMDBField<TUint32> iMetadata;
+    CommsDat::CMDBField<TUint32> iIcon;       
+    
+     private:
+    
+        static const CommsDat::SRecordTypeInfo iRecordInfo[];
+};
+
+/**
+ *  Class representing records in the Global bearer type priorization table
+ *
+ *  @lib cmmanager.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CCDGlobalBearerTypePriorizationRecord ) : 
+                                                            public CommsDat::CCDRecordBase
+    {
+    public:
+    
+    IMPORT_C CCDGlobalBearerTypePriorizationRecord( CommsDat::TMDBElementId aElementId );
+        
+    IMPORT_C const CommsDat::SRecordTypeInfo* GetRecordInfo();
+
+    IMPORT_C static CommsDat::TMDBElementId CreateTableL( CommsDat::CMDBSession& aSession );
+    IMPORT_C static CommsDat::TMDBElementId TableIdL( CommsDat::CMDBSession& aSession );
+    
+    DATA_VTABLE
+        
+    public:
+    CommsDat::CMDBField<TDesC> iServiceType;
+    CommsDat::CMDBField<TUint> iPriority;
+    CommsDat::CMDBField<TUint> iUIPriority;    
+    
+    private:
+    
+        static const CommsDat::SRecordTypeInfo iRecordInfo[];
+    };
+
+class CCDMIP4Record;
+class CCDMIP6Record;
+
+/**
+ *  Class representing records in the MIP service extension table
+ *
+ *  @lib cmmanager.lib
+ *  @since S60 v3.2
+ */
+//should be inherited from CCDServiceRecordBase
+//constructor implementation only available for CommsDat::CCDRecordBase
+NONSHARABLE_CLASS( CCDMIPServiceExtRecord ): public CommsDat::CCDRecordBase
+{
+    public:
+        
+    IMPORT_C CCDMIPServiceExtRecord( CommsDat::TMDBElementId aElementId );
+
+    IMPORT_C const CommsDat::SRecordTypeInfo* GetRecordInfo();
+
+    IMPORT_C static CommsDat::TMDBElementId CreateTableL( CommsDat::CMDBSession& aSession );
+    IMPORT_C static CommsDat::TMDBElementId TableIdL( CommsDat::CMDBSession& aSession );
+    
+    DATA_VTABLE
+    
+    public:
+    //if snap taken to use DN link changed to AP link
+    CommsDat::CMDBRecordLink<CommsDat::CCDNetworkRecord> iSNAP;
+    CommsDat::CMDBRecordLink<CommsDat::CCDIAPRecord> iIAP;
+    CommsDat::CMDBRecordLink<CCDMIP4Record> iMIP4;
+    CommsDat::CMDBRecordLink<CCDMIP6Record> iMIP6;
+
+     private:
+    
+        static const CommsDat::SRecordTypeInfo iRecordInfo[];
+};
+
+/**
+ *  Class representing records in the IAP Metadata table
+ *
+ *  @lib ?library
+ *  @since S60 ?S60_version *** for example, S60 v3.0
+ */
+NONSHARABLE_CLASS( CCDIAPMetadataRecord ): public CommsDat::CCDRecordBase
+{
+    public:
+        
+    IMPORT_C CCDIAPMetadataRecord( CommsDat::TMDBElementId aElementId );
+        
+    IMPORT_C const CommsDat::SRecordTypeInfo* GetRecordInfo();
+
+    IMPORT_C static CommsDat::TMDBElementId CreateTableL( CommsDat::CMDBSession& aSession );
+    IMPORT_C static CommsDat::TMDBElementId TableIdL( CommsDat::CMDBSession& aSession );
+    
+    DATA_VTABLE
+    
+    public:
+    CommsDat::CMDBRecordLink<CommsDat::CCDIAPRecord> iIAP;
+    CommsDat::CMDBField<TUint32> iMetadata;
+    CommsDat::CMDBField<TInt> iSeamlessness;
+
+     private:
+    
+        static const CommsDat::SRecordTypeInfo iRecordInfo[];
+};
+
+/**
+ *  Class representing records in the MIP4 table
+ *
+ *  @lib ?library
+ *  @since S60 ?S60_version *** for example, S60 v3.0
+ */
+NONSHARABLE_CLASS( CCDMIP4Record ): public CommsDat::CCDRecordBase
+{
+    public:
+        
+    IMPORT_C CCDMIP4Record( CommsDat::TMDBElementId aElementId );
+        
+    IMPORT_C const CommsDat::SRecordTypeInfo* GetRecordInfo();
+
+    IMPORT_C static CommsDat::TMDBElementId CreateTableL( CommsDat::CMDBSession& aSession );
+    IMPORT_C static CommsDat::TMDBElementId TableIdL( CommsDat::CMDBSession& aSession );
+    
+    DATA_VTABLE
+    
+    public:
+    
+        CommsDat::CMDBField<TDesC> iHomeAddress;
+        CommsDat::CMDBField<TUint32> iMaxRegRetries;
+        CommsDat::CMDBField<TUint32> iFirstRetryTimeout;
+        CommsDat::CMDBField<TUint32> iInitialLifetime;
+        CommsDat::CMDBField<TDesC> iNAI;
+        CommsDat::CMDBField<TDesC> iHomeAgentAddress;
+        CommsDat::CMDBField<TDesC> iSecondaryHomeAgentAddress;
+        CommsDat::CMDBField<TUint32> iEnableReverseTunnel;
+        CommsDat::CMDBField<TUint32> iEnableNATTraversal;
+        CommsDat::CMDBField<TUint32> iEnableMinimalEncapsulation;
+        CommsDat::CMDBField<TUint32> iMNHAAuthAlgorithm;
+        CommsDat::CMDBField<TBool> iMNHASPIIndicator;
+        CommsDat::CMDBField<TUint32> iMNHASPI;
+        CommsDat::CMDBField<TDesC> iMNHASSData;
+        CommsDat::CMDBField<TUint32> iMNAAAAuthAlgorithm;
+        CommsDat::CMDBField<TBool> iMNAAASPIIndicator;
+        CommsDat::CMDBField<TUint32> iMNAAASPI;
+        CommsDat::CMDBField<TDesC> iMNAAASSData;
+        CommsDat::CMDBField<TUint32> iUseForeignAgent;
+        CommsDat::CMDBField<TUint32> iMNFAAuthAlgorithm;
+        CommsDat::CMDBField<TBool> iMNFASPIIndicator;
+        CommsDat::CMDBField<TUint32> iMNFASPI;
+        CommsDat::CMDBField<TDesC> iMNFASSData;
+
+    private:
+    
+        static const CommsDat::SRecordTypeInfo iRecordInfo[];
+};
+/**
+ *  Class representing records in the MIP4 table
+ *
+ *  @lib ?library
+ *  @since S60 ?S60_version *** for example, S60 v3.0
+ */
+NONSHARABLE_CLASS( CCDMIP6Record ) : public CommsDat::CCDRecordBase
+{
+    public:
+        
+    IMPORT_C CCDMIP6Record( CommsDat::TMDBElementId aElementId );
+
+    IMPORT_C const CommsDat::SRecordTypeInfo* GetRecordInfo();
+
+    IMPORT_C static CommsDat::TMDBElementId CreateTableL( CommsDat::CMDBSession& aSession );
+    IMPORT_C static CommsDat::TMDBElementId TableIdL( CommsDat::CMDBSession& aSession );
+    
+    DATA_VTABLE
+    
+    public:
+    
+        CommsDat::CMDBField<TDesC> iHomeAddress;   
+        CommsDat::CMDBField<TDesC> iHomeAgentAddress;
+        CommsDat::CMDBField<TUint32> iPrefixLength;
+        CommsDat::CMDBField<TBool> iEnableRouteOptimization;
+        CommsDat::CMDBField<TBool> iEnableIPSec;
+        CommsDat::CMDBField<TUint32> iMNHAAuthAlgorithm;
+        CommsDat::CMDBField<TUint32> iMNHAEncryptAlgorithm;
+        CommsDat::CMDBField<TBool> iMNHASPIIndicator;
+        CommsDat::CMDBField<TUint32> iMNHASPI;
+        CommsDat::CMDBField<TDesC> iMNHASSData;
+        CommsDat::CMDBField<TUint32> iHookState;
+        CommsDat::CMDBField<TDesC> iIFName;
+        CommsDat::CMDBField<TDesC> iTunnelIFName;
+
+    private:
+    
+        static const CommsDat::SRecordTypeInfo iRecordInfo[];
+};
+
+//table name
+#define DEFCONN_TABLE _S("DefConn")
+//table fields
+#define DEFCONN_TYPE _S("DefConnType")
+#define DEFCONN_UID _S("DefConnUId")
+#define USAGEOFWLAN _S("UsageOfWlan")
+#define SEAMLESSNESS_HOME _S("SeamlessnessHome")
+#define SEAMLESSNESS_VISITOR _S("SeamlessnessVisitor")
+
+NONSHARABLE_CLASS( CCDDefConnRecord ) : public CommsDat::CCDRecordBase
+    {
+    public:
+    
+    IMPORT_C CCDDefConnRecord( CommsDat::TMDBElementId aElementId );
+    
+    IMPORT_C const CommsDat::SRecordTypeInfo* GetRecordInfo();
+
+    IMPORT_C static CommsDat::TMDBElementId CreateTableL( CommsDat::CMDBSession& aSession );
+    IMPORT_C static CommsDat::TMDBElementId TableIdL( CommsDat::CMDBSession& aSession );
+    
+    DATA_VTABLE
+        
+    public:
+    CommsDat::CMDBField<TUint> iDefConnType;
+    CommsDat::CMDBField<TUint> iDefConnUid;    
+    CommsDat::CMDBField<TUint> iUsageOfWlan;
+    CommsDat::CMDBField<TUint> iSeamlessnessHome;
+    CommsDat::CMDBField<TUint> iSeamlessnessVisitor;
+    
+    private:
+    
+        static const CommsDat::SRecordTypeInfo iRecordInfo[];
+    };
+    
+#endif // DATAMOBILITYCOMMSDATTYPES_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/database/rom/cmmanagerdatabase.iby	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef __CMMANAGERDATABASE_IBY__
+#define __CMMANAGERDATABASE_IBY__
+
+
+file=ABI_DIR\BUILD_DIR\cmmanagerdatabase.dll     SHARED_LIB_DIR\cmmanagerdatabase.dll
+
+
+
+#endif // __CMMANAGERDATABASE_IBY__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/database/src/cmmanagertableformats.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,553 @@
+/*
+* 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:  Contains the WLAN Service table format
+*
+*/
+
+#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include <commsdat_partner.h>
+#endif
+#include <metadatabase.h>
+#include <wlancontainer.h>
+#include <cmmanagertablefields.h>
+#include <datamobilitycommsdattypes.h>
+
+
+TMDBElementId CreateTableL( CMDBSession& aSession,
+                            const TDesC& aTableName, 
+                            const SGenericRecordTypeInfo* aNewTableInfo );
+                            
+TMDBElementId TableIdL( CMDBSession& aSession, 
+                        const TDesC& aTableName );
+                                                    
+START_ATTRIBUTE_TABLE( CCDWlanServiceRecord, 0, 0 )
+	X_REGISTER_ATTRIBUTE( CCDWlanServiceRecord,   iWlanServiceId,  TMDBNum )
+	X_REGISTER_ATTRIBUTE( CCDWlanServiceRecord,   iWlanConnMode,  TMDBNum )
+	X_REGISTER_ATTRIBUTE( CCDWlanServiceRecord,   iWLanSSID,  TMDBText )
+	X_REGISTER_ATTRIBUTE( CCDWlanServiceRecord,   iWLanUsedSSID,  TMDBText )
+	X_REGISTER_ATTRIBUTE( CCDWlanServiceRecord,   iWLanWepKey1,  TMDBText )
+	X_REGISTER_ATTRIBUTE( CCDWlanServiceRecord,   iWLanWepKey2,  TMDBText )
+	X_REGISTER_ATTRIBUTE( CCDWlanServiceRecord,   iWLanWepKey3,  TMDBText )
+	X_REGISTER_ATTRIBUTE( CCDWlanServiceRecord,   iWLanWepKey4,  TMDBText )
+	X_REGISTER_ATTRIBUTE( CCDWlanServiceRecord,   iWlanWepIndex,  TMDBNum )
+	X_REGISTER_ATTRIBUTE( CCDWlanServiceRecord,   iWlanSecMode,  TMDBNum )
+	X_REGISTER_ATTRIBUTE( CCDWlanServiceRecord,   iWlanAuthMode,  TMDBNum )
+	X_REGISTER_ATTRIBUTE( CCDWlanServiceRecord,   iWlanEnableWpaPsk,  TMDBNum )
+	X_REGISTER_ATTRIBUTE( CCDWlanServiceRecord,   iWLanWpaPreSharedKey,  TMDBText )
+	X_REGISTER_ATTRIBUTE( CCDWlanServiceRecord,   iWlanWpaKeyLength,  TMDBNum )
+	X_REGISTER_ATTRIBUTE( CCDWlanServiceRecord,   iWLanEaps,  TMDBText )
+	X_REGISTER_ATTRIBUTE( CCDWlanServiceRecord,   iWlanScanSSID,  TMDBNum )
+	X_REGISTER_ATTRIBUTE( CCDWlanServiceRecord,   iWlanChannelID,  TMDBNum )
+	X_REGISTER_ATTRIBUTE( CCDWlanServiceRecord,   iWlanFormatKey1,  TMDBNum )
+	X_REGISTER_ATTRIBUTE( CCDWlanServiceRecord,   iWlanFormatKey2,  TMDBNum )
+	X_REGISTER_ATTRIBUTE( CCDWlanServiceRecord,   iWlanFormatKey3,  TMDBNum )
+	X_REGISTER_ATTRIBUTE( CCDWlanServiceRecord,   iWlanFormatKey4,  TMDBNum )
+	X_REGISTER_ATTRIBUTE( CCDWlanServiceRecord,   iWlanAllowSSIDRoaming,  TMDBNum )	
+	X_REGISTER_ATTRIBUTE( CCDWlanServiceRecord,   iWLanEnabledEaps,  TMDBText )
+	X_REGISTER_ATTRIBUTE( CCDWlanServiceRecord,   iWLanDisabledEaps,  TMDBText )
+    X_REGISTER_ATTRIBUTE( CCDRecordBase,          iRecordTag,  TMDBNum )
+	X_REGISTER_ATTRIBUTE( CCDRecordBase,          iRecordName, TMDBText )
+END_ATTRIBUTE_TABLE()
+
+START_ATTRIBUTE_TABLE( CCDWlanDeviceSettingsRecord, 0, 0 )
+	X_REGISTER_ATTRIBUTE( CCDWlanDeviceSettingsRecord,   iTableVersion,  TMDBNum )
+	X_REGISTER_ATTRIBUTE( CCDWlanDeviceSettingsRecord,   iWlanDeviceSettingsType,  TMDBNum )
+	X_REGISTER_ATTRIBUTE( CCDWlanDeviceSettingsRecord,   iBgScanInterval,  TMDBNum )
+	X_REGISTER_ATTRIBUTE( CCDWlanDeviceSettingsRecord,   iUseDefaultSettings,  TMDBNum )
+	X_REGISTER_ATTRIBUTE( CCDWlanDeviceSettingsRecord,   iWlanLongRetry,  TMDBNum )
+	X_REGISTER_ATTRIBUTE( CCDWlanDeviceSettingsRecord,   iWlanShortRetry,  TMDBNum )
+	X_REGISTER_ATTRIBUTE( CCDWlanDeviceSettingsRecord,   iWlanRTSThreshold,  TMDBNum )
+	X_REGISTER_ATTRIBUTE( CCDWlanDeviceSettingsRecord,   iTxPowerLevel,  TMDBNum )
+	X_REGISTER_ATTRIBUTE( CCDWlanDeviceSettingsRecord,   iAllowRadioMeasurements,  TMDBNum )
+	X_REGISTER_ATTRIBUTE( CCDWlanDeviceSettingsRecord,   iWlanPowerMode,  TMDBNum )
+	X_REGISTER_ATTRIBUTE( CCDWlanDeviceSettingsRecord,   iSavedBgScanInterval,  TMDBNum )	
+    X_REGISTER_ATTRIBUTE( CCDRecordBase,          iRecordTag,  TMDBNum )
+	X_REGISTER_ATTRIBUTE( CCDRecordBase,          iRecordName, TMDBText )
+END_ATTRIBUTE_TABLE()
+
+START_ATTRIBUTE_TABLE( CCDWLANSecSSIDTable, 0, 0 )
+	X_REGISTER_ATTRIBUTE( CCDWLANSecSSIDTable,   iWlanSecSSIDServiceId,  TMDBNum )
+	X_REGISTER_ATTRIBUTE( CCDWLANSecSSIDTable,   iWlanSecSSIDName,  TMDBText )
+	X_REGISTER_ATTRIBUTE( CCDWLANSecSSIDTable,   iWlanSecSSIDScannedSSID,  TMDBText )
+	X_REGISTER_ATTRIBUTE( CCDWLANSecSSIDTable,   iWlanSecSSIDUsedSSID,  TMDBText )
+	X_REGISTER_ATTRIBUTE( CCDWLANSecSSIDTable,   iWlanSecSSIDId,  TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDRecordBase,          iRecordTag,  TMDBNum )
+	X_REGISTER_ATTRIBUTE( CCDRecordBase,          iRecordName, TMDBText )
+END_ATTRIBUTE_TABLE()
+
+START_ATTRIBUTE_TABLE( CCDDestNWTable, 0, 0 )
+	X_REGISTER_ATTRIBUTE( CCDDestNWTable,   iDestNwShowRoaming,  TMDBNum )
+	X_REGISTER_ATTRIBUTE( CCDDestNWTable,   iDestNwAccessNwId,  TMDBText )
+    X_REGISTER_ATTRIBUTE( CCDRecordBase,          iRecordTag,  TMDBNum )
+	X_REGISTER_ATTRIBUTE( CCDRecordBase,          iRecordName, TMDBText )
+END_ATTRIBUTE_TABLE()
+
+START_ATTRIBUTE_TABLE( CCDDefConnRecord, 0, 0 )
+	X_REGISTER_ATTRIBUTE( CCDDefConnRecord,   iDefConnType,         TMDBNum )
+	X_REGISTER_ATTRIBUTE( CCDDefConnRecord,   iDefConnUid,          TMDBNum )
+	X_REGISTER_ATTRIBUTE( CCDDefConnRecord,   iUsageOfWlan,      TMDBNum )
+        X_REGISTER_ATTRIBUTE( CCDDefConnRecord,   iSeamlessnessHome,  TMDBNum )
+        X_REGISTER_ATTRIBUTE( CCDDefConnRecord,   iSeamlessnessVisitor,  TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDRecordBase,      iRecordTag,           TMDBNum )
+	X_REGISTER_ATTRIBUTE( CCDRecordBase,      iRecordName,          TMDBText )
+END_ATTRIBUTE_TABLE()
+
+const SRecordTypeInfo CCDDefConnRecord::iRecordInfo[]=
+  	{
+	    { KCDTIdRecordTag,	         EUint32,    ENoAttrs, KCDTypeNameRecordTag }, 
+    	{ KCDTIdRecordName,	         EText,      ENotNull, KCDTypeNameRecordName},
+    	{ KCDTIdDefConnType,         EUint32,    ENoAttrs, DEFCONN_TYPE },
+    	{ KCDTIdDefConnUid,          EUint32,    ENoAttrs, DEFCONN_UID },
+    	{ KCDTIdUsageOfWlan,         EUint32,    ENoAttrs, USAGEOFWLAN },
+    	{ KCDTIdSeamlessnessHome,     EUint32,    ENoAttrs,   SEAMLESSNESS_HOME },
+        { KCDTIdSeamlessnessVisitor,  EUint32,    ENoAttrs,   SEAMLESSNESS_VISITOR },    	
+	    { 0, 0, ENoAttrs, KCDNull }
+  	};
+  	
+    
+EXPORT_C const SRecordTypeInfo* CCDDefConnRecord::GetRecordInfo()
+    { 
+    return iRecordInfo; 
+    }  
+  	
+EXPORT_C CCDDefConnRecord::CCDDefConnRecord( TMDBElementId aElementId )
+	: CCDRecordBase( aElementId ),  
+      iDefConnType( ( aElementId & KCDMaskShowRecordType ) 
+                        | KCDTIdDefConnType ),
+      iDefConnUid( ( aElementId & KCDMaskShowRecordType ) 
+                        | KCDTIdDefConnUid ),
+      iUsageOfWlan( ( aElementId & KCDMaskShowRecordType ) 
+                        | KCDTIdUsageOfWlan ),
+      iSeamlessnessHome( ( aElementId & KCDMaskShowRecordType ) 
+                        | KCDTIdSeamlessnessHome ),
+      iSeamlessnessVisitor( ( aElementId & KCDMaskShowRecordType ) 
+                        | KCDTIdSeamlessnessVisitor )
+    {};  	
+
+EXPORT_C TMDBElementId 
+    CCDDefConnRecord::TableIdL( CMDBSession& aSession )
+    {
+    return ::TableIdL( aSession, TPtrC( DEFCONN_TABLE ) );
+    }
+
+EXPORT_C TMDBElementId 
+    CCDDefConnRecord::CreateTableL( CMDBSession& aSession )
+    {
+    // table descriptor array for WLAN DEVICE SETTINGS TABLE
+    const SGenericRecordTypeInfo KDefConnTable[] = 
+        {
+        SGenericRecordTypeInfo( KCDTIdRecordTag,        EUint32, 
+                                ENoAttrs,   KCDTypeNameRecordTag ),
+        SGenericRecordTypeInfo( KCDTIdRecordName,        EText,    
+                                ENotNull,   KCDTypeNameRecordName),
+        SGenericRecordTypeInfo( KCDTIdDefConnType,  EUint32,    
+                                ENoAttrs,   DEFCONN_TYPE ),
+        SGenericRecordTypeInfo( KCDTIdDefConnUid,  EUint32,    
+                                ENoAttrs,   DEFCONN_UID ),
+        SGenericRecordTypeInfo( KCDTIdUsageOfWlan,  EUint32,    
+                                ENoAttrs,   USAGEOFWLAN ),
+        SGenericRecordTypeInfo( KCDTIdSeamlessnessHome,  EUint32,    
+                                ENoAttrs,   SEAMLESSNESS_HOME ),
+        SGenericRecordTypeInfo( KCDTIdSeamlessnessVisitor,  EUint32,    
+                                ENoAttrs,   SEAMLESSNESS_VISITOR ),
+        SGenericRecordTypeInfo( 0, 0, ENoAttrs, KCDNull )
+        };
+
+    return ::CreateTableL( aSession, 
+                           TPtrC( DEFCONN_TABLE ), 
+                           KDefConnTable );
+    }
+  	
+
+const SRecordTypeInfo CCDWlanServiceRecord::iRecordInfo[]=
+  	{
+	    { KCDTIdRecordTag,	            EUint32,    ENoAttrs,   KCDTypeNameRecordTag }, 
+    	{ KCDTIdRecordName,	            EText,      ENotNull,   KCDTypeNameRecordName},
+    	{ KCDTIdWlanServiceId,          EUint32,    ENoAttrs,   WLAN_SERVICE_ID },
+        // Default Settings
+    	{ KCDTIdWlanConnMode,           EUint32,    ENoAttrs,   WLAN_CONNECTION_MODE },
+    	{ KCDTIdWlanSSID,	            EText,      ENoAttrs,   NU_WLAN_SSID },	
+	    { KCDTIdWlanUsedSSID,	        EText,      ENoAttrs,   WLAN_USED_SSID },	
+    	{ KCDTIdWlanWepKey1,	        EDesC8,     ENoAttrs,   NU_WLAN_WEP_KEY1 },
+	    { KCDTIdWlanWepKey2,	        EDesC8,     ENoAttrs,   NU_WLAN_WEP_KEY2 },
+    	{ KCDTIdWlanWepKey3,	        EDesC8,     ENoAttrs,   NU_WLAN_WEP_KEY3 },
+	    { KCDTIdWlanWepKey4,	        EDesC8,     ENoAttrs,   NU_WLAN_WEP_KEY4 },
+        { KCDTIdWlanWepIndex,	        EUint32,    ENoAttrs,   WLAN_WEP_INDEX },
+        // WLAN Security
+        { KCDTIdWlanSecMode,	        EUint32,    ENoAttrs,   WLAN_SECURITY_MODE },
+        { KCDTIdWlanAuthMode,           EUint32,    ENoAttrs,   NU_WLAN_AUTHENTICATION_MODE },
+        { KCDTIdWlanEnableWpaPsk,       EUint32,    ENoAttrs,   WLAN_ENABLE_WPA_PSK },
+        { KCDTIdWlanWpaPreSharedKey,    EDesC8,     ENoAttrs,   WLAN_WPA_PRE_SHARED_KEY },
+        { KCDTIdWlanWpaKeyLength,	    EUint32,    ENoAttrs,   WLAN_WPA_KEY_LENGTH },
+        { KCDTIdWlanEaps,	            ELongText,  ENoAttrs,   WLAN_EAPS },   	
+        { KCDTIdWlanScanSSID,           EBool,      ENoAttrs,   WLAN_SCAN_SSID },
+        { KCDTIdWlanChannelID,          EUint32,    ENoAttrs,   NU_WLAN_CHANNEL_ID },
+        { KCDTIdWlanFormatKey1,	        EUint32,    ENoAttrs,   WLAN_WEP_KEY1_FORMAT },
+	    { KCDTIdWlanFormatKey2,	        EUint32,    ENoAttrs,   WLAN_WEP_KEY2_FORMAT },
+	    { KCDTIdWlanFormatKey3,	        EUint32,    ENoAttrs,   WLAN_WEP_KEY3_FORMAT },
+	    { KCDTIdWlanFormatKey4,	        EUint32,    ENoAttrs,   WLAN_WEP_KEY4_FORMAT },
+	    { KCDTIdWlanAllowSSIDRoaming,   EBool,      ENoAttrs,   WLAN_ALLOW_SSID_ROAMING },
+        { KCDTIdWlanEnabledEaps,	    EDesC8,     ENoAttrs,   WLAN_ENABLED_EAPS },   	
+        { KCDTIdWlanDisabledEaps,	    EDesC8,     ENoAttrs,   WLAN_DISABLED_EAPS },   	
+	    { 0, 0, ENoAttrs, KCDNull }
+  	};
+
+const SRecordTypeInfo CCDWlanDeviceSettingsRecord::iRecordInfo[]=
+  	{
+    { KCDTIdRecordTag,      EUint32,    ENoAttrs,   KCDTypeNameRecordTag },
+    { KCDTIdRecordName,     EText,      ENotNull,   KCDTypeNameRecordName },
+    { KCDTIdTableVersion,   EUint32,    ENotNull,   WLAN_TABLE_VERSION },
+    { KCDTIdWlanDeviceSettingsType,     EUint32,  ENotNull,   WLAN_DEVICE_SETTINGS_TYPE },
+    { KCDTIdBgScanInterval, EUint32,    ENotNull,   WLAN_BG_SCAN_INTERVAL },
+    { KCDTIdUseDefaultSettings,    EBool, ENotNull,   WLAN_USE_DEFAULT_SETTINGS },
+    { KCDTIdWlanLongRetry,    EUint32,  ENotNull,   WLAN_LONG_RETRY },
+    { KCDTIdWlanShortRetry,   EUint32,    ENotNull,   WLAN_SHORT_RETRY },
+    { KCDTIdWlanRTSThreshold,        EUint32,   ENotNull,   WLAN_RTS_THRESHOLD },
+    { KCDTIdTxPowerLevel,    EUint32, ENotNull,   NU_WLAN_TX_POWER_LEVEL },
+    { KCDTIdAllowRadioMeasurements,    EBool, ENotNull,   WLAN_ALLOW_RADIO_MEASUREMENTS },
+    { KCDTIdWlanPowerMode,    EBool,      ENotNull,   WLAN_POWER_MODE },
+    { KCDTIdSavedBgScanInterval, EUint32,    ENotNull,   WLAN_SAVED_BG_SCAN_INTERVAL },
+    { 0, 0, ENoAttrs, KCDNull }
+  	};
+
+const SRecordTypeInfo CCDWLANSecSSIDTable::iRecordInfo[]=
+  	{
+    { KCDTIdRecordTag,        EUint32, 
+                            ENoAttrs,   KCDTypeNameRecordTag },
+    { KCDTIdRecordName,        EText,    
+                            ENotNull,   KCDTypeNameRecordName },
+    { KCDTIdWlanSecSSIDServiceId,  EUint32,
+                            ENotNull,   WLAN_SEC_SSID_SERVICE_ID },
+    { KCDTIdWlanSecSSIDName,   EText,
+                            ENotNull,   WLAN_SEC_SSID_NAME },
+    { KCDTIdWlanSecSSIDScannedSSID,        EText,      
+                            ENotNull,   WLAN_SEC_SSID_SCANNED_SSID },
+    { KCDTIdWlanSecSSIDUsedSSID,    EText,      
+                            ENoAttrs,   WLAN_SEC_SSID_USED_SSID },
+    { KCDTIdWlanSecSSIDId,  EUint32,
+                            ENotNull,   WLAN_SEC_SSID_ID },
+    { 0, 0, ENoAttrs, KCDNull }
+  	};
+
+const SRecordTypeInfo CCDDestNWTable::iRecordInfo[]=
+  	{
+    { KCDTIdDestNwShowRoaming,  EUint32,
+                            ENoAttrs,   DEST_NW_SHOW_ROAMING },                            
+    { KCDTIdDestNwAccessNwId,   EText,
+                            ENotNull,   DEST_NW_ACCESS_NWID },
+    { 0, 0, ENoAttrs, KCDNull }                                                        
+  	};
+
+EXPORT_C CCDWlanServiceRecord::CCDWlanServiceRecord( TMDBElementId aElementId )
+	: CCDRecordBase( aElementId ),  
+      iWlanServiceId( ( aElementId & KCDMaskShowRecordType ) 
+                        | KCDTIdWlanServiceId ),
+      iWlanConnMode( ( aElementId & KCDMaskShowRecordType ) 
+                        | KCDTIdWlanConnMode ),
+      iWLanSSID( ( aElementId & KCDMaskShowRecordType ) 
+                        | KCDTIdWlanSSID ),
+      iWLanUsedSSID( ( aElementId & KCDMaskShowRecordType ) 
+                        | KCDTIdWlanUsedSSID ),
+      iWLanWepKey1( ( aElementId & KCDMaskShowRecordType ) 
+                        | KCDTIdWlanWepKey1 ),
+      iWLanWepKey2( ( aElementId & KCDMaskShowRecordType ) 
+                        | KCDTIdWlanWepKey2 ),
+      iWLanWepKey3( ( aElementId & KCDMaskShowRecordType ) 
+                        | KCDTIdWlanWepKey3 ),          
+      iWLanWepKey4( ( aElementId & KCDMaskShowRecordType ) 
+                        | KCDTIdWlanWepKey4 ),
+      iWlanWepIndex( ( aElementId & KCDMaskShowRecordType ) 
+                        | KCDTIdWlanWepIndex ),
+      iWlanSecMode( ( aElementId & KCDMaskShowRecordType ) 
+                        | KCDTIdWlanSecMode ),
+      iWlanAuthMode( ( aElementId & KCDMaskShowRecordType ) 
+                        | KCDTIdWlanAuthMode ),
+      iWlanEnableWpaPsk( ( aElementId & KCDMaskShowRecordType ) 
+                        | KCDTIdWlanEnableWpaPsk ),
+      iWLanWpaPreSharedKey( ( aElementId & KCDMaskShowRecordType ) 
+                        | KCDTIdWlanWpaPreSharedKey ),
+      iWlanWpaKeyLength( ( aElementId & KCDMaskShowRecordType ) 
+                        | KCDTIdWlanWpaKeyLength ),
+      iWLanEaps( ( aElementId & KCDMaskShowRecordType ) 
+                        | KCDTIdWlanEaps ),
+      iWlanScanSSID( ( aElementId & KCDMaskShowRecordType ) 
+                        | KCDTIdWlanScanSSID ),
+      iWlanChannelID( ( aElementId & KCDMaskShowRecordType ) 
+                        | KCDTIdWlanChannelID ),
+      iWlanFormatKey1( ( aElementId & KCDMaskShowRecordType ) 
+                        | KCDTIdWlanFormatKey1 ),
+      iWlanFormatKey2( ( aElementId & KCDMaskShowRecordType ) 
+                        | KCDTIdWlanFormatKey2 ),
+      iWlanFormatKey3( ( aElementId & KCDMaskShowRecordType ) 
+                        | KCDTIdWlanFormatKey3 ),
+      iWlanFormatKey4( ( aElementId & KCDMaskShowRecordType ) 
+                        | KCDTIdWlanFormatKey4 ),
+      iWlanAllowSSIDRoaming( ( aElementId & KCDMaskShowRecordType ) 
+                        | KCDTIdWlanAllowSSIDRoaming ),
+      iWLanEnabledEaps( ( aElementId & KCDMaskShowRecordType ) 
+                        | KCDTIdWlanEnabledEaps ),
+      iWLanDisabledEaps( ( aElementId & KCDMaskShowRecordType ) 
+                        | KCDTIdWlanDisabledEaps )
+    {};
+
+EXPORT_C CCDWlanDeviceSettingsRecord::CCDWlanDeviceSettingsRecord( TMDBElementId aElementId )
+	: CCDRecordBase( aElementId ),  
+      iTableVersion( ( aElementId & KCDMaskShowRecordType ) 
+                        | KCDTIdTableVersion ),
+      iWlanDeviceSettingsType( ( aElementId & KCDMaskShowRecordType ) 
+                        | KCDTIdWlanDeviceSettingsType ),
+      iBgScanInterval( ( aElementId & KCDMaskShowRecordType ) 
+                        | KCDTIdBgScanInterval ),
+      iSavedBgScanInterval( ( aElementId & KCDMaskShowRecordType ) 
+                        | KCDTIdSavedBgScanInterval ),
+      iUseDefaultSettings( ( aElementId & KCDMaskShowRecordType ) 
+                        | KCDTIdUseDefaultSettings ),
+      iWlanLongRetry( ( aElementId & KCDMaskShowRecordType ) 
+                        | KCDTIdWlanLongRetry ),
+      iWlanShortRetry( ( aElementId & KCDMaskShowRecordType ) 
+                        | KCDTIdWlanShortRetry ),
+      iWlanRTSThreshold( ( aElementId & KCDMaskShowRecordType ) 
+                        | KCDTIdWlanRTSThreshold ),          
+      iTxPowerLevel( ( aElementId & KCDMaskShowRecordType ) 
+                        | KCDTIdTxPowerLevel ),          
+      iAllowRadioMeasurements( ( aElementId & KCDMaskShowRecordType )
+                        | KCDTIdAllowRadioMeasurements ),
+      iWlanPowerMode( ( aElementId & KCDMaskShowRecordType ) 
+                        | KCDTIdWlanPowerMode )
+    {};
+
+EXPORT_C CCDWLANSecSSIDTable::CCDWLANSecSSIDTable( TMDBElementId aElementId )
+	: CCDRecordBase( aElementId ),  
+      iWlanSecSSIDServiceId( ( aElementId & KCDMaskShowRecordType ) 
+                        | KCDTIdWlanSecSSIDServiceId ),
+      iWlanSecSSIDName( ( aElementId & KCDMaskShowRecordType ) 
+                        | KCDTIdWlanSecSSIDName ),
+      iWlanSecSSIDScannedSSID( ( aElementId & KCDMaskShowRecordType ) 
+                        | KCDTIdWlanSecSSIDScannedSSID ),
+      iWlanSecSSIDUsedSSID( ( aElementId & KCDMaskShowRecordType ) 
+                        | KCDTIdWlanSecSSIDUsedSSID ),
+      iWlanSecSSIDId( ( aElementId & KCDMaskShowRecordType ) 
+                        | KCDTIdWlanSecSSIDId )
+    {};
+
+EXPORT_C CCDDestNWTable::CCDDestNWTable( TMDBElementId aElementId )
+	: CCDRecordBase( aElementId ),  
+      iDestNwShowRoaming( ( aElementId & KCDMaskShowRecordType ) 
+                        | KCDTIdDestNwShowRoaming ),
+      iDestNwAccessNwId( ( aElementId & KCDMaskShowRecordType ) 
+                        | KCDTIdDestNwAccessNwId )
+    {};
+
+
+EXPORT_C TMDBElementId 
+    CCDWlanServiceRecord::CreateTableL( CMDBSession& aSession )
+    {
+    // table descriptor array for WLAN SERVICE TABLE
+    const SGenericRecordTypeInfo KWLANServiceTable[] = 
+        {
+        SGenericRecordTypeInfo( KCDTIdRecordTag,        EUint32, 
+                                ENoAttrs,   KCDTypeNameRecordTag ),
+        SGenericRecordTypeInfo( KCDTIdRecordName,        EText,    
+                                ENotNull,   KCDTypeNameRecordName),
+        SGenericRecordTypeInfo( KCDTIdWlanServiceId,  EUint32,    
+                                ENoAttrs,   WLAN_SERVICE_ID ),
+        SGenericRecordTypeInfo( KCDTIdWlanConnMode,   EUint32,    
+                                ENoAttrs,   WLAN_CONNECTION_MODE ),
+        SGenericRecordTypeInfo( KCDTIdWlanSSID,        EText,      
+                                ENoAttrs,   NU_WLAN_SSID ),
+        SGenericRecordTypeInfo( KCDTIdWlanUsedSSID,        EText,      
+                                ENoAttrs,   WLAN_USED_SSID ),
+        SGenericRecordTypeInfo( KCDTIdWlanWepKey1,    EDesC8,      
+                                ENoAttrs,   NU_WLAN_WEP_KEY1 ),
+        SGenericRecordTypeInfo( KCDTIdWlanWepKey2,    EDesC8,      
+                                ENoAttrs,   NU_WLAN_WEP_KEY2 ),
+        SGenericRecordTypeInfo( KCDTIdWlanWepKey3,    EDesC8,      
+                                ENoAttrs,   NU_WLAN_WEP_KEY3 ),
+        SGenericRecordTypeInfo( KCDTIdWlanWepKey4,    EDesC8,      
+                                ENoAttrs,   NU_WLAN_WEP_KEY4 ),
+        SGenericRecordTypeInfo( KCDTIdWlanWepIndex,    EUint32,    
+                                ENoAttrs,   WLAN_WEP_INDEX ),
+        SGenericRecordTypeInfo( KCDTIdWlanSecMode,    EUint32,    
+                                ENoAttrs,   WLAN_SECURITY_MODE ),
+        SGenericRecordTypeInfo( KCDTIdWlanAuthMode,        EUint32,    
+                                ENoAttrs,   NU_WLAN_AUTHENTICATION_MODE ),
+        SGenericRecordTypeInfo( KCDTIdWlanEnableWpaPsk,    EUint32,    
+                                ENoAttrs,   WLAN_ENABLE_WPA_PSK ),
+        SGenericRecordTypeInfo( KCDTIdWlanWpaPreSharedKey,EDesC8,
+                                ENoAttrs,   WLAN_WPA_PRE_SHARED_KEY ),
+        SGenericRecordTypeInfo( KCDTIdWlanWpaKeyLength,    EUint32,    
+                                ENoAttrs,   WLAN_WPA_KEY_LENGTH ),
+        SGenericRecordTypeInfo( KCDTIdWlanEaps,        ELongText,
+                                ENoAttrs,   WLAN_EAPS ),
+        SGenericRecordTypeInfo( KCDTIdWlanScanSSID, EBool,
+                                ENoAttrs,   WLAN_SCAN_SSID ),
+        SGenericRecordTypeInfo( KCDTIdWlanChannelID, EUint32,
+                                ENoAttrs,   NU_WLAN_CHANNEL_ID ),
+        SGenericRecordTypeInfo( KCDTIdWlanFormatKey1,    EUint32,      
+                                ENoAttrs,   WLAN_WEP_KEY1_FORMAT ),
+        SGenericRecordTypeInfo( KCDTIdWlanFormatKey2,    EUint32,      
+                                ENoAttrs,   WLAN_WEP_KEY2_FORMAT ),
+        SGenericRecordTypeInfo( KCDTIdWlanFormatKey3,    EUint32,      
+                                ENoAttrs,   WLAN_WEP_KEY3_FORMAT ),
+        SGenericRecordTypeInfo( KCDTIdWlanFormatKey4,    EUint32,      
+                                ENoAttrs,   WLAN_WEP_KEY4_FORMAT ),
+        SGenericRecordTypeInfo( KCDTIdWlanAllowSSIDRoaming,    EBool,      
+                                ENoAttrs,   WLAN_ALLOW_SSID_ROAMING ),
+        SGenericRecordTypeInfo( KCDTIdWlanEnabledEaps,      EDesC8,
+                                ENoAttrs,   WLAN_ENABLED_EAPS ),
+        SGenericRecordTypeInfo( KCDTIdWlanDisabledEaps,      EDesC8,
+                                ENoAttrs,   WLAN_DISABLED_EAPS ),
+        SGenericRecordTypeInfo( 0, 0, ENoAttrs, KCDNull )
+        };
+    return ::CreateTableL( aSession, 
+                           TPtrC( WLAN_SERVICE ), 
+                           KWLANServiceTable );
+    }
+    
+EXPORT_C TMDBElementId 
+    CCDWlanServiceRecord::TableIdL( CMDBSession& aSession )
+    {
+    return ::TableIdL( aSession, TPtrC( WLAN_SERVICE ) );
+    }
+
+EXPORT_C TMDBElementId 
+    CCDWlanDeviceSettingsRecord::CreateTableL( CMDBSession& aSession )
+    {
+    // table descriptor array for WLAN DEVICE SETTINGS TABLE
+    const SGenericRecordTypeInfo KWlanDeviceSettingsTable[] = 
+        {
+        SGenericRecordTypeInfo( KCDTIdRecordTag,        EUint32, 
+                                ENoAttrs,   KCDTypeNameRecordTag ),
+        SGenericRecordTypeInfo( KCDTIdRecordName,        EText,    
+                                ENotNull,   KCDTypeNameRecordName),
+        SGenericRecordTypeInfo( KCDTIdTableVersion,  EUint32,    
+                                ENotNull,   WLAN_TABLE_VERSION ),
+        SGenericRecordTypeInfo( KCDTIdWlanDeviceSettingsType,   EUint32,
+                                ENotNull,   WLAN_DEVICE_SETTINGS_TYPE ),
+        SGenericRecordTypeInfo( KCDTIdBgScanInterval,        EUint32,
+                                ENotNull,   WLAN_BG_SCAN_INTERVAL ),
+        SGenericRecordTypeInfo( KCDTIdUseDefaultSettings,    EBool,
+                                ENotNull,   WLAN_USE_DEFAULT_SETTINGS ),
+        SGenericRecordTypeInfo( KCDTIdWlanLongRetry,    EUint32,
+                                ENotNull,   WLAN_LONG_RETRY ),
+        SGenericRecordTypeInfo( KCDTIdWlanShortRetry,   EUint32,    
+                                ENotNull,   WLAN_SHORT_RETRY ),
+        SGenericRecordTypeInfo( KCDTIdWlanRTSThreshold,        EUint32,
+                                ENotNull,   WLAN_RTS_THRESHOLD ),
+        SGenericRecordTypeInfo( KCDTIdTxPowerLevel,    EUint32,
+                                ENotNull,   NU_WLAN_TX_POWER_LEVEL ),
+        SGenericRecordTypeInfo( KCDTIdAllowRadioMeasurements,    EBool,      
+                                ENotNull,   WLAN_ALLOW_RADIO_MEASUREMENTS ),
+        SGenericRecordTypeInfo( KCDTIdWlanPowerMode,    EBool,      
+                                ENotNull,   WLAN_POWER_MODE ),    
+        SGenericRecordTypeInfo( KCDTIdSavedBgScanInterval,     EUint32,
+                                ENotNull,   WLAN_SAVED_BG_SCAN_INTERVAL ),
+                                
+        SGenericRecordTypeInfo( 0, 0, ENoAttrs, KCDNull )
+        };
+
+    return ::CreateTableL( aSession, 
+                           TPtrC( WLAN_DEVICE_SETTINGS ), 
+                           KWlanDeviceSettingsTable );
+    }
+    
+EXPORT_C TMDBElementId 
+    CCDWlanDeviceSettingsRecord::TableIdL( CMDBSession& aSession )
+    {
+    return ::TableIdL( aSession, TPtrC( WLAN_DEVICE_SETTINGS ) );
+    }
+
+EXPORT_C TMDBElementId 
+    CCDWLANSecSSIDTable::CreateTableL( CMDBSession& aSession )
+    {
+    // table descriptor array for WLAN SECONDARY SSID TABLE
+    const SGenericRecordTypeInfo KWLANSecSSIDTable[] = 
+        {
+        SGenericRecordTypeInfo( KCDTIdRecordTag,        EUint32, 
+                                ENoAttrs,   KCDTypeNameRecordTag ),
+        SGenericRecordTypeInfo( KCDTIdRecordName,        EText,    
+                                ENotNull,   KCDTypeNameRecordName),
+        SGenericRecordTypeInfo( KCDTIdWlanSecSSIDServiceId,  EUint32,
+                                ENotNull,   WLAN_SEC_SSID_SERVICE_ID ),
+        SGenericRecordTypeInfo( KCDTIdWlanSecSSIDName,   EText,
+                                ENotNull,   WLAN_SEC_SSID_NAME ),
+        SGenericRecordTypeInfo( KCDTIdWlanSecSSIDScannedSSID,        EText,      
+                                ENotNull,   WLAN_SEC_SSID_SCANNED_SSID ),
+        SGenericRecordTypeInfo( KCDTIdWlanSecSSIDUsedSSID,    EText,      
+                                ENoAttrs,   WLAN_SEC_SSID_USED_SSID ),
+        SGenericRecordTypeInfo( KCDTIdWlanSecSSIDId,  EUint32,
+                                ENotNull,   WLAN_SEC_SSID_ID ),
+
+        SGenericRecordTypeInfo( 0, 0, ENoAttrs, KCDNull )
+        };
+
+    return ::CreateTableL( aSession, 
+                           TPtrC( WLAN_SECONDARY_SSID ), 
+                           KWLANSecSSIDTable );
+    }
+    
+EXPORT_C TMDBElementId 
+    CCDWLANSecSSIDTable::TableIdL( CMDBSession& aSession )
+    {
+    return ::TableIdL( aSession, TPtrC( WLAN_SECONDARY_SSID ) );
+    }
+
+EXPORT_C TMDBElementId 
+    CCDDestNWTable::CreateTableL( CMDBSession& aSession )
+    {
+    // table descriptor array for Destination Network Table
+    const SGenericRecordTypeInfo KDestNWTable[] = 
+        {
+        SGenericRecordTypeInfo( KCDTIdRecordTag,        EUint32, 
+                                ENoAttrs,   KCDTypeNameRecordTag ),
+        SGenericRecordTypeInfo( KCDTIdRecordName,        EText,    
+                                ENotNull,   KCDTypeNameRecordName),
+        SGenericRecordTypeInfo( KCDTIdDestNwShowRoaming,  EUint32,
+                                ENoAttrs,   DEST_NW_SHOW_ROAMING ),                            
+        SGenericRecordTypeInfo( KCDTIdDestNwAccessNwId,   EText,
+                                ENotNull,   DEST_NW_ACCESS_NWID ),                            
+        SGenericRecordTypeInfo( 0, 0, ENoAttrs, KCDNull )
+        };
+
+    return ::CreateTableL( aSession, 
+                           TPtrC( DEST_NETWORK ), 
+                           KDestNWTable );
+    }
+    
+EXPORT_C TMDBElementId 
+    CCDDestNWTable::TableIdL( CMDBSession& aSession )
+    {
+    return ::TableIdL( aSession, TPtrC( DEST_NETWORK ) );
+    }
+
+EXPORT_C const SRecordTypeInfo* CCDWlanServiceRecord::GetRecordInfo()
+    { 
+    return iRecordInfo; 
+    }    
+    
+EXPORT_C const SRecordTypeInfo* CCDWlanDeviceSettingsRecord::GetRecordInfo()
+    { 
+    return iRecordInfo; 
+    }    
+    
+EXPORT_C const SRecordTypeInfo* CCDWLANSecSSIDTable::GetRecordInfo()
+    { 
+    return iRecordInfo; 
+    }    
+    
+EXPORT_C const SRecordTypeInfo* CCDDestNWTable::GetRecordInfo()
+    { 
+    return iRecordInfo; 
+    }    
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/database/src/datamobilitycommsdattypes.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,818 @@
+/*
+* 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:
+*
+*/
+
+
+#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include <commsdat_partner.h>
+#endif
+#include "datamobilitycommsdattypes.h"
+
+using namespace CommsDat;
+
+// Following defines implementations for member functions 
+// created by DATA_VTABLE macro in the container classes.
+// This also creates virtual data table (iVDataTable member) 
+// for the classes.
+START_ATTRIBUTE_TABLE( CCDVirtualIAPNextLayerRecord, 0, 0 )
+    X_REGISTER_ATTRIBUTE( CCDVirtualIAPNextLayerRecord, iIAP, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDVirtualIAPNextLayerRecord, iNextLayerSNAP, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDVirtualIAPNextLayerRecord, iNextLayerIAP, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDRecordBase, iRecordTag, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDRecordBase, iRecordName, TMDBText )
+END_ATTRIBUTE_TABLE()
+
+START_ATTRIBUTE_TABLE( CCDGlobalBearerTypePriorizationRecord, 0, 0 )
+    X_REGISTER_ATTRIBUTE( CCDGlobalBearerTypePriorizationRecord, iServiceType, TMDBText )
+    X_REGISTER_ATTRIBUTE( CCDGlobalBearerTypePriorizationRecord, iPriority, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDGlobalBearerTypePriorizationRecord, iUIPriority, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDRecordBase, iRecordTag, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDRecordBase, iRecordName, TMDBText )
+END_ATTRIBUTE_TABLE()
+
+
+START_ATTRIBUTE_TABLE( CCDDataMobilitySelectionPolicyRecord,    0,      0 )
+    X_REGISTER_ATTRIBUTE( CCDDataMobilitySelectionPolicyRecord, iSNAP, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDDataMobilitySelectionPolicyRecord, iIAP, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDDataMobilitySelectionPolicyRecord, iEmbeddedSNAP, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDDataMobilitySelectionPolicyRecord, iPriority, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDRecordBase, iRecordTag, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDRecordBase, iRecordName, TMDBText )
+END_ATTRIBUTE_TABLE()
+
+START_ATTRIBUTE_TABLE( CCDMIPServiceExtRecord, 0, 0)
+    X_REGISTER_ATTRIBUTE( CCDMIPServiceExtRecord, iSNAP, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDMIPServiceExtRecord, iIAP, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDMIPServiceExtRecord, iMIP4, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDMIPServiceExtRecord, iMIP6, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDRecordBase, iRecordTag, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDRecordBase, iRecordName,TMDBText )
+END_ATTRIBUTE_TABLE()
+
+START_ATTRIBUTE_TABLE( CCDSNAPMetadataRecord, 0, 0 )
+    X_REGISTER_ATTRIBUTE( CCDSNAPMetadataRecord, iSNAP, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDSNAPMetadataRecord, iMetadata, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDSNAPMetadataRecord, iIcon, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDRecordBase, iRecordTag, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDRecordBase, iRecordName,TMDBText )
+END_ATTRIBUTE_TABLE()
+
+START_ATTRIBUTE_TABLE( CCDIAPMetadataRecord, 0, 0 )
+    X_REGISTER_ATTRIBUTE( CCDIAPMetadataRecord, iIAP, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDIAPMetadataRecord, iMetadata, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDIAPMetadataRecord, iSeamlessness, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDRecordBase, iRecordTag, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDRecordBase, iRecordName, TMDBText )
+END_ATTRIBUTE_TABLE()
+
+START_ATTRIBUTE_TABLE( CCDMIP4Record, 0, 0 )
+    X_REGISTER_ATTRIBUTE( CCDMIP4Record, iHomeAddress, TMDBText )
+    X_REGISTER_ATTRIBUTE( CCDMIP4Record, iMaxRegRetries, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDMIP4Record, iFirstRetryTimeout, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDMIP4Record, iInitialLifetime, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDMIP4Record, iNAI, TMDBText )
+    X_REGISTER_ATTRIBUTE( CCDMIP4Record, iHomeAgentAddress, TMDBText )
+    X_REGISTER_ATTRIBUTE( CCDMIP4Record, iSecondaryHomeAgentAddress, TMDBText )
+    X_REGISTER_ATTRIBUTE( CCDMIP4Record, iEnableReverseTunnel, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDMIP4Record, iEnableNATTraversal, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDMIP4Record, iEnableMinimalEncapsulation, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDMIP4Record, iMNHAAuthAlgorithm, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDMIP4Record, iMNHASPIIndicator, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDMIP4Record, iMNHASPI, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDMIP4Record, iMNHASSData, TMDBLongText )
+    X_REGISTER_ATTRIBUTE( CCDMIP4Record, iMNAAAAuthAlgorithm, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDMIP4Record, iMNAAASPIIndicator, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDMIP4Record, iMNAAASPI, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDMIP4Record, iMNAAASSData, TMDBLongText )
+    X_REGISTER_ATTRIBUTE( CCDMIP4Record, iUseForeignAgent, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDMIP4Record, iMNFAAuthAlgorithm, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDMIP4Record, iMNFASPIIndicator, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDMIP4Record, iMNFASPI, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDMIP4Record, iMNFASSData, TMDBLongText )
+    X_REGISTER_ATTRIBUTE( CCDRecordBase, iRecordTag, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDRecordBase, iRecordName, TMDBText )
+END_ATTRIBUTE_TABLE()
+
+START_ATTRIBUTE_TABLE( CCDMIP6Record, 0, 0 )
+    X_REGISTER_ATTRIBUTE( CCDMIP6Record, iHomeAddress, TMDBText )
+    X_REGISTER_ATTRIBUTE( CCDMIP6Record, iHomeAgentAddress, TMDBText )
+    X_REGISTER_ATTRIBUTE( CCDMIP6Record, iPrefixLength, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDMIP6Record, iEnableRouteOptimization, TMDBNum ) 
+    X_REGISTER_ATTRIBUTE( CCDMIP6Record, iEnableIPSec, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDMIP6Record, iMNHAAuthAlgorithm, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDMIP6Record, iMNHAEncryptAlgorithm, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDMIP6Record, iMNHASPIIndicator, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDMIP6Record, iMNHASPI, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDMIP6Record, iMNHASSData, TMDBLongText )
+    X_REGISTER_ATTRIBUTE( CCDMIP6Record, iHookState, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDMIP6Record, iIFName, TMDBText )
+    X_REGISTER_ATTRIBUTE( CCDMIP6Record, iTunnelIFName, TMDBText )
+    X_REGISTER_ATTRIBUTE( CCDRecordBase, iRecordTag, TMDBNum )
+    X_REGISTER_ATTRIBUTE( CCDRecordBase, iRecordName, TMDBText )
+END_ATTRIBUTE_TABLE()
+
+// Following initializes the static member iRecordInfo of the container classes
+const SRecordTypeInfo CCDVirtualIAPNextLayerRecord::iRecordInfo[]=
+  	{
+		{ KCDTIdRecordTag,	                EInt,		
+	      ENoAttrs,                         KCDTypeNameRecordTag },
+  		{ KCDTIdRecordName,     	        EText,		
+  		  ENotNull,                         KCDTypeNameRecordName },
+		{ KCDTIdVirtualIAP,    	            EInt,  	
+		  ENotNull,                         KCDTypeNameVirtualIAP }, 
+		{ KCDTIdVirtualNextLayerSNAP,       EInt,		
+		  ENoAttrs,                         KCDTypeNameVirtualIAPNextLayerSNAP },
+		{ KCDTIdVirtualNextLayerIAP,        EInt,		
+		  ENoAttrs,                         KCDTypeNameVirtualIAPNextLayerIAP },
+  		{ 0,                                0,          
+  		  ENoAttrs,                         KCDNull }
+  	};
+
+const SRecordTypeInfo CCDGlobalBearerTypePriorizationRecord::iRecordInfo[]=
+  	{
+		{ KCDTIdRecordTag,	                EInt,		
+	      ENoAttrs,                         KCDTypeNameRecordTag },
+  		{ KCDTIdRecordName,     	        EText,		
+  		  ENotNull,                         KCDTypeNameRecordName },
+		{ KCDTIdGlobalServiceType,    	    EText,  	
+		  ENotNull,                         KCDTypeNameGlobalServiceType }, 
+		{ KCDTIdGlobalServicePriority,      EInt,		
+		  ENoAttrs,                         KCDTypeNameGlobalServicePriority },
+		{ KCDTIdGlobalServiceUIPriority,    EInt,		
+		  ENoAttrs,                         KCDTypeNameGlobalServiceUIPriority },
+  		{ 0,                                0,          
+  		  ENoAttrs,                         KCDNull }
+  	};
+
+const SRecordTypeInfo CCDDataMobilitySelectionPolicyRecord::iRecordInfo[]=
+  	{
+		{ KCDTIdRecordTag,	                                EInt,		
+		  ENoAttrs,     KCDTypeNameRecordTag },
+  		{ KCDTIdRecordName,     	                        EText,		
+  		  ENotNull,     KCDTypeNameRecordName },
+		{ KCDTIdDataMobilitySelectionPolicyNetwork,         EInt,  		
+		  ENotNull,     KCDTypeNameDataMobilitySelectionPolicySNAP },
+		{ KCDTIdDataMobilitySelectionPolicyIAP,    	        EInt,  		
+		  ENoAttrs,     KCDTypeNameDataMobilitySelectionPolicyIAP },
+		{ KCDTIdDataMobilitySelectionPolicyEmbeddedSNAP,    EInt,  		
+		  ENoAttrs,     KCDTypeNameDataMobilitySelectionPolicyEmbeddedSNAP },
+		{ KCDTIdDataMobilitySelectionPolicyPriority,    	EInt,  		
+		  ENotNull,     KCDTypeNameDataMobilitySelectionPolicyPriority },
+  		{ 0,                                                0,          
+  		  ENoAttrs,     KCDNull }
+  	};
+
+const SRecordTypeInfo CCDMIPServiceExtRecord::iRecordInfo[]=
+  	{
+		{ KCDTIdRecordTag,	                EInt,		
+		  ENoAttrs,                         KCDTypeNameRecordTag },
+  		{ KCDTIdRecordName,     	        EText,		
+  		  ENotNull,                         KCDTypeNameRecordName },
+		{ KCDTIdMIPMIP4,    		        EInt,  		
+		  ENoAttrs,                         KCDTypeNameMIPMIP4 },
+		{ KCDTIdMIPMIP6,    		        EInt,  		
+		  ENoAttrs,                         KCDTypeNameMIPMIP6 },
+  		{ 0,                                0,          
+  		  ENoAttrs,                         KCDNull }
+  	};
+
+const SRecordTypeInfo CCDSNAPMetadataRecord::iRecordInfo[]=
+  	{
+		{ KCDTIdRecordTag,	                EInt,		
+		  ENoAttrs,                         KCDTypeNameRecordTag },
+  		{ KCDTIdRecordName,     	        EText,		
+  		  ENotNull,                         KCDTypeNameRecordName },
+		{ KCDTIdSNAPMetadataSNAP,           EInt,  		
+		  ENoAttrs,                         KCDTypeNameSNAPMetadataSNAP },
+		{ KCDTIdSNAPMetadataMetadata,       EInt,  		
+		  ENoAttrs,                         KCDTypeNameSNAPMetadataMetadata },
+		{ KCDTIdSNAPMetadataIcon,           EInt,  	
+		  ENoAttrs,                         KCDTypeNameSNAPMetadataIcon },
+  		{ 0,                                0,          
+  		  ENoAttrs,                         KCDNull }
+  	};
+  	
+const SRecordTypeInfo CCDIAPMetadataRecord::iRecordInfo[]=
+  	{
+		{ KCDTIdRecordTag,	                EInt,		
+		  ENoAttrs,                         KCDTypeNameRecordTag },
+  		{ KCDTIdRecordName,     	        EText,		
+  		  ENotNull,                         KCDTypeNameRecordName },
+		{ KCDTIdIAPMetadataIAP,             EInt,  		
+		  ENotNull,                         KCDTypeNameIAPMetadataIAP },
+		{ KCDTIdIAPMetadataMetadata,        EInt,  		
+		  ENoAttrs,                         KCDTypeNameIAPMetadataMetadata },
+		{ KCDTIdIAPMetadataSeamlessness,    EInt,  	    
+		  ENoAttrs,                         KCDTypeNameIAPMetadataSeamlessness },
+  		{ 0,                                0,          
+  		  ENoAttrs,                         KCDNull }
+  	};
+
+const SRecordTypeInfo CCDMIP4Record::iRecordInfo[]=
+  	{
+		{ KCDTIdRecordTag,	                EInt,		
+	      ENoAttrs,                         KCDTypeNameRecordTag },
+  		{ KCDTIdRecordName,     	        EText,		
+  		  ENotNull,                         KCDTypeNameRecordName },
+        { KCDTIdMIP4HomeAddress,    	    EText,  	
+		  ENoAttrs,                         KCDTypeNameMIP4HomeAddress },
+  		{ KCDTIdMIP4MaxRegRetries,	        EInt,		
+	      ENoAttrs,                         KCDTypeNameMIP4MaxRegRetries },
+  		{ KCDTIdMIP4FirstRetryTimeout,	    EInt,		
+	      ENoAttrs,                         KCDTypeNameMIP4FirstRetryTimeout },
+  		{ KCDTIdMIP4InitialLifetime, 	    EInt,		
+	      ENoAttrs,                         KCDTypeNameMIP4InitialLifetime },
+  		{ KCDTIdMIP4NAI,    	            EText,  	
+		  ENoAttrs,                         KCDTypeNameMIP4NAI },
+  		{ KCDTIdMIP4HomeAgentAddress,    	EText,  	
+		  ENoAttrs,                         KCDTypeNameMIP4HomeAgentAddress },
+  		{ KCDTIdMIP4SecondaryHomeAgentAddress, EText,  	
+		  ENoAttrs,                         KCDTypeNameMIP4SecondaryHomeAgentAddress },
+  		{ KCDTIdMIP4EnableReverseTunnel,	EInt,		
+	      ENoAttrs,                         KCDTypeNameMIP4EnableReverseTunnel },
+  		{ KCDTIdMIP4EnableNATTraversal,	    EInt,		
+	      ENoAttrs,                         KCDTypeNameMIP4EnableNATTraversal },
+  		{ KCDTIdMIP4EnableMinimalEncapsulation,	EInt,		
+	      ENoAttrs,                         KCDTypeNameMIP4EnableMinimalEncapsulation },
+  		{ KCDTIdMIP4MNHAAuthAlgorithm,	    EInt,		
+	      ENotNull,                         KCDTypeNameMIP4MNHAAuthAlgorithm },
+  		{ KCDTIdMIP4MNHASPIIndicator,	    EBool,      
+  		  ENotNull,                         KCDTypeNameMIP4MNHASPIIndicator },
+  		{ KCDTIdMIP4MNHASPI,	            EUint32,		
+	      ENoAttrs,                         KCDTypeNameMIP4MNHASPI },
+  		{ KCDTIdMIP4MNHASSData,    	        EText,  	
+		  ENotNull,                         KCDTypeNameMIP4MNHASSData },
+  		{ KCDTIdMIP4MNAAAAuthAlgorithm,	    EInt,		
+	      ENoAttrs,                         KCDTypeNameMIP4MNAAAAuthAlgorithm },
+  		{ KCDTIdMIP4MNAAASPIIndicator,	    EBool,      
+  		  ENoAttrs,                         KCDTypeNameMIP4MNAAASPIIndicator },
+  		{ KCDTIdMIP4MNAAASPI,	            EUint32,		
+	      ENoAttrs,                         KCDTypeNameMIP4MNAAASPI },
+  		{ KCDTIdMIP4MNAAASSData,    	    EText,  	
+		  ENoAttrs,                         KCDTypeNameMIP4MNAAASSData },
+  		{ KCDTIdMIP4UseForeignAgent,	    EInt,		
+	      ENoAttrs,                         KCDTypeNameMIP4UseForeignAgent },
+  		{ KCDTIdMIP4MNFAAuthAlgorithm,	    EInt,		
+	      ENoAttrs,                         KCDTypeNameMIP4MNFAAuthAlgorithm },
+  		{ KCDTIdMIP4MNFASPIIndicator,	    EBool,      
+  		  ENoAttrs,                         KCDTypeNameMIP4MNFASPIIndicator }, 
+  		{ KCDTIdMIP4MNFASPI,	            EUint32,		
+	      ENoAttrs,                         KCDTypeNameMIP4MNFASPI },
+  		{ KCDTIdMIP4MNFASSData,    	        EText,  	
+		  ENoAttrs,                         KCDTypeNameMIP4MNFASSData },
+  		{ 0,                                0,          
+  		  ENoAttrs,                         KCDNull }
+  	};
+ 
+const SRecordTypeInfo CCDMIP6Record::iRecordInfo[]=
+  	{
+		{ KCDTIdRecordTag,	                EInt,		
+	      ENoAttrs,                         KCDTypeNameRecordTag },
+  		{ KCDTIdRecordName,     	        EText,		
+  		  ENotNull,                         KCDTypeNameRecordName },
+        { KCDTIdMIP6HomeAddress,    	    EText,  	
+		  ENotNull,                         KCDTypeNameMIP6HomeAddress },
+  		{ KCDTIdMIP6HomeAgentAddress,    	EText,  	
+		  ENoAttrs,                         KCDTypeNameMIP6HomeAgentAddress },
+  		{ KCDTIdMIP6PrefixLength,	        EInt,		
+	      ENotNull,                         KCDTypeNameMIP6PrefixLength },
+  		{ KCDTIdMIP6EnableRouteOptimization, EBool,      
+  		  ENotNull,                         KCDTypeNameMIP6EnableRouteOptimization },
+  		{ KCDTIdMIP6EnableIPSec,            EBool,      
+  		  ENotNull,                         KCDTypeNameMIP6EnableIPSec },
+  		{ KCDTIdMIP6MNHAAuthAlgorithm,	    EInt,		
+	      ENotNull,                         KCDTypeNameMIP6MNHAAuthAlgorithm },
+  		{ KCDTIdMIP6MNHAEncryptAlgorithm,	EInt,		
+	      ENotNull,                         KCDTypeNameMIP6MNHAEncryptAlgorithm },
+  		{ KCDTIdMIP6MNHASPIIndicator,	    EBool,      
+  		  ENotNull,                         KCDTypeNameMIP6MNHASPIIndicator },
+  		{ KCDTIdMIP6MNHASPI,	            EUint32,		
+	      ENoAttrs,                         KCDTypeNameMIP6MNHASPI },
+  		{ KCDTIdMIP6MNHASSData,    	        EText,  	
+		  ENotNull,                         KCDTypeNameMIP6MNHASSData },
+  		{ KCDTIdMIP6HookState,	            EUint32,		
+	      ENoAttrs,                         KCDTypeNameMIP6HookState },
+   		{ KCDTIdMIP6IFName,    	            EText,  	
+		  ENotNull,                         KCDTypeNameMIP6IFName },
+  		{ KCDTIdMIP6TunnelIFName,    	    EText,  	
+		  ENotNull,                         KCDTypeNameMIP6TunnelIFName },		  
+  		{ 0,                                0,          
+  		  ENoAttrs,                         KCDNull }
+  	};
+
+// ======== LOCAL FUNCTIONS ========
+TMDBElementId CreateTableL( CMDBSession& aSession,
+                            const TDesC& aTableName, 
+                            const SGenericRecordTypeInfo* aNewTableInfo )
+    {
+    CMDBGenericRecord* table = static_cast<CMDBGenericRecord*>
+            ( CCDRecordBase::RecordFactoryL( KCDNewTableRequest ) );
+    CleanupStack::PushL( table );    
+    table->InitializeL( aTableName, aNewTableInfo );
+   
+    table->StoreL( aSession );
+    
+    TMDBElementId tableId = table->TableId();
+    
+    CleanupStack::PopAndDestroy( table ); 
+    
+    return tableId;
+    }
+
+TMDBElementId TableIdL( CMDBSession& aSession, 
+                        const TDesC& aTableName )
+    {
+    CMDBGenericRecord* ptrTable = 
+            static_cast<CMDBGenericRecord*>(CCDRecordBase::RecordFactoryL( 0 ));
+    CleanupStack::PushL( ptrTable );
+    
+    TPtrC ptr( aTableName );
+    ptrTable->InitializeL( ptr, NULL );
+    
+    ptrTable->LoadL( aSession );
+    
+    TMDBElementId tableId = ptrTable->TableId();
+    
+    CleanupStack::PopAndDestroy( ptrTable );
+    
+    return tableId;
+    }
+ 
+// ======== MEMBER FUNCTIONS ========
+//Constructors for the container classes
+
+EXPORT_C CCDVirtualIAPNextLayerRecord::
+    CCDVirtualIAPNextLayerRecord( TMDBElementId aElementId )
+    : CCDRecordBase( aElementId ),
+      iIAP( (aElementId & KCDMaskShowRecordType ) | KCDTIdVirtualIAP),
+      iNextLayerSNAP( ( aElementId & KCDMaskShowRecordType ) | KCDTIdVirtualNextLayerSNAP),
+      iNextLayerIAP( (aElementId & KCDMaskShowRecordType ) | KCDTIdVirtualNextLayerIAP)
+      {}
+  
+EXPORT_C TMDBElementId 
+    CCDVirtualIAPNextLayerRecord::CreateTableL( CMDBSession& aSession )
+    {
+    const SGenericRecordTypeInfo KVirtualIAPNextLayerTableFormat[] = {
+        SGenericRecordTypeInfo( KCDTIdRecordTag,                EUint32,    
+                                ENoAttrs,                       KCDTypeNameRecordTag ),
+        SGenericRecordTypeInfo( KCDTIdRecordName,               EText,      
+                                ENotNull,                       KCDTypeNameRecordName ),    
+        SGenericRecordTypeInfo( KCDTIdVirtualIAP,               EInt,    
+                                ENotNull,                       KCDTypeNameVirtualIAP ),
+        SGenericRecordTypeInfo( KCDTIdVirtualNextLayerSNAP,     EInt,    
+                                ENoAttrs,                       KCDTypeNameVirtualIAPNextLayerSNAP ),   
+        SGenericRecordTypeInfo( KCDTIdVirtualNextLayerIAP,      EInt,    
+                                ENoAttrs,                       KCDTypeNameVirtualIAPNextLayerIAP ),       
+        SGenericRecordTypeInfo( 0, 0, ENoAttrs, KCDNull )
+        };
+
+    return ::CreateTableL( aSession, 
+                           TPtrC( KCDTypeNameVirtualIAPNextLayer ), 
+                           KVirtualIAPNextLayerTableFormat );
+    }
+
+EXPORT_C TMDBElementId 
+    CCDVirtualIAPNextLayerRecord::TableIdL( CMDBSession& aSession )
+    {
+    return ::TableIdL( aSession, TPtrC( KCDTypeNameVirtualIAPNextLayer ) );
+    }
+
+EXPORT_C CCDGlobalBearerTypePriorizationRecord::
+    CCDGlobalBearerTypePriorizationRecord( TMDBElementId aElementId )
+        : CCDRecordBase( aElementId ),  
+          iServiceType( ( aElementId & KCDMaskShowRecordType ) | 
+          KCDTIdGlobalServiceType ),
+          iPriority( ( aElementId & KCDMaskShowRecordType ) | 
+          KCDTIdGlobalServicePriority ),
+          iUIPriority( ( aElementId & KCDMaskShowRecordType ) | 
+          KCDTIdGlobalServiceUIPriority )
+        {}
+
+EXPORT_C TMDBElementId 
+    CCDGlobalBearerTypePriorizationRecord::CreateTableL( CMDBSession& aSession )
+    {
+   const SGenericRecordTypeInfo KGlobalBearerTypeTableFormat[] = {
+        SGenericRecordTypeInfo( KCDTIdRecordTag,                EUint32,    
+                                ENoAttrs,                       KCDTypeNameRecordTag ),
+        SGenericRecordTypeInfo( KCDTIdRecordName,                EText,      
+                                ENotNull,                       KCDTypeNameRecordName ),    
+        SGenericRecordTypeInfo( KCDTIdGlobalServiceType,        EText,    
+                                ENotNull,                       KCDTypeNameGlobalServiceType ),
+        SGenericRecordTypeInfo( KCDTIdGlobalServicePriority,    EInt,    
+                                ENoAttrs,                       KCDTypeNameGlobalServicePriority ),   
+        SGenericRecordTypeInfo( KCDTIdGlobalServiceUIPriority,    EInt,    
+                                ENoAttrs,                       KCDTypeNameGlobalServiceUIPriority ),       
+        SGenericRecordTypeInfo( 0, 0, ENoAttrs, KCDNull )       
+    };
+    return ::CreateTableL( aSession, 
+                           TPtrC( KCDTypeNameGlobalService ), 
+                           KGlobalBearerTypeTableFormat );
+    }
+    
+EXPORT_C TMDBElementId 
+    CCDGlobalBearerTypePriorizationRecord::TableIdL( CMDBSession& aSession )
+    {
+    return ::TableIdL( aSession, TPtrC( KCDTypeNameGlobalService ) );
+    }
+
+EXPORT_C CCDDataMobilitySelectionPolicyRecord::
+CCDDataMobilitySelectionPolicyRecord( TMDBElementId aElementId )
+        : CCDRecordBase( aElementId ), 
+          iSNAP( ( aElementId & KCDMaskShowRecordType ) | 
+          KCDTIdDataMobilitySelectionPolicyNetwork ),
+          iIAP( ( aElementId & KCDMaskShowRecordType ) | 
+          KCDTIdDataMobilitySelectionPolicyIAP ),
+          iEmbeddedSNAP( ( aElementId & KCDMaskShowRecordType ) | 
+          KCDTIdDataMobilitySelectionPolicyEmbeddedSNAP ),
+          iPriority( ( aElementId & KCDMaskShowRecordType ) | 
+          KCDTIdDataMobilitySelectionPolicyPriority )
+        {}
+ 
+EXPORT_C TMDBElementId 
+    CCDDataMobilitySelectionPolicyRecord::CreateTableL( CMDBSession& aSession )
+    {
+    const SGenericRecordTypeInfo KDataMobilitySelectionPolicyTableFormat[] = {
+        SGenericRecordTypeInfo( KCDTIdRecordTag,        EUint32,    
+                                ENoAttrs,               KCDTypeNameRecordTag ),
+        SGenericRecordTypeInfo( KCDTIdRecordName,        EText,      
+                                ENotNull,               KCDTypeNameRecordName ),    
+        SGenericRecordTypeInfo( KCDTIdDataMobilitySelectionPolicyNetwork,        EInt,    
+                                ENotNull,               KCDTypeNameDataMobilitySelectionPolicySNAP ),       
+        SGenericRecordTypeInfo( KCDTIdDataMobilitySelectionPolicyIAP,            ELink,    
+                                ENoAttrs,               KCDTypeNameDataMobilitySelectionPolicyIAP ),       
+        SGenericRecordTypeInfo( KCDTIdDataMobilitySelectionPolicyEmbeddedSNAP,    EInt,    
+                                ENoAttrs,               KCDTypeNameDataMobilitySelectionPolicyEmbeddedSNAP ),       
+        SGenericRecordTypeInfo( KCDTIdDataMobilitySelectionPolicyPriority,    EInt,    
+                                ENotNull,               KCDTypeNameDataMobilitySelectionPolicyPriority ),
+        SGenericRecordTypeInfo( 0, 0, ENoAttrs, KCDNull )       
+    };
+
+    return ::CreateTableL( aSession, 
+                           TPtrC( KCDTypeNameDataMobilitySelectionPolicy ), 
+                           KDataMobilitySelectionPolicyTableFormat );
+    }
+    
+EXPORT_C TMDBElementId 
+    CCDDataMobilitySelectionPolicyRecord::TableIdL( CMDBSession& aSession )
+    {
+    return ::TableIdL( aSession, TPtrC( KCDTypeNameDataMobilitySelectionPolicy ) );
+    }
+
+EXPORT_C CCDMIPServiceExtRecord::CCDMIPServiceExtRecord( TMDBElementId aElementId )
+        : CCDRecordBase( aElementId ), 
+          iMIP4( ( aElementId & KCDMaskShowRecordType ) | KCDTIdMIPMIP4 ),
+          iMIP6( ( aElementId & KCDMaskShowRecordType ) | KCDTIdMIPMIP6 )
+        {}
+        
+EXPORT_C TMDBElementId 
+    CCDMIPServiceExtRecord::CreateTableL( CMDBSession& aSession )
+    {
+    const SGenericRecordTypeInfo KMIPServiceExtTableFormat[] = {
+        SGenericRecordTypeInfo( KCDTIdRecordTag,        EUint32,    
+                                ENoAttrs,               KCDTypeNameRecordTag ),
+        SGenericRecordTypeInfo( KCDTIdRecordName,        EText,      
+                                ENotNull,               KCDTypeNameRecordName ),    
+        SGenericRecordTypeInfo( KCDTIdMIPMIP4,            ELink,    
+                                ENoAttrs,               KCDTypeNameMIPMIP4 ),
+        SGenericRecordTypeInfo( KCDTIdMIPMIP6,            ELink,    
+                                ENoAttrs,               KCDTypeNameMIPMIP6 ),
+        SGenericRecordTypeInfo( 0, 0, ENoAttrs, KCDNull )       
+    };
+
+    return ::CreateTableL( aSession, 
+                           TPtrC( KCDTypeNameMIPServiceExt ), 
+                           KMIPServiceExtTableFormat );
+    }
+    
+EXPORT_C TMDBElementId 
+    CCDMIPServiceExtRecord::TableIdL( CMDBSession& aSession )
+    {
+    return ::TableIdL( aSession, TPtrC( KCDTypeNameMIPServiceExt ) );
+    }
+
+EXPORT_C CCDSNAPMetadataRecord::CCDSNAPMetadataRecord( TMDBElementId aElementId )
+        : CCDRecordBase( aElementId ), 
+          iSNAP( ( aElementId & KCDMaskShowRecordType ) | 
+          KCDTIdSNAPMetadataSNAP ),
+          iMetadata( ( aElementId & KCDMaskShowRecordType ) | 
+          KCDTIdSNAPMetadataMetadata ),
+          iIcon( ( aElementId & KCDMaskShowRecordType ) | 
+          KCDTIdSNAPMetadataIcon )
+        {}
+
+EXPORT_C TMDBElementId 
+    CCDSNAPMetadataRecord::CreateTableL( CMDBSession& aSession )
+    {
+    const SGenericRecordTypeInfo KSNAPMetadataTableFormat[] = {
+        SGenericRecordTypeInfo( KCDTIdRecordTag,        EUint32,    
+                                ENoAttrs,               KCDTypeNameRecordTag ),
+        SGenericRecordTypeInfo( KCDTIdRecordName,        EText,      
+                                ENotNull,               KCDTypeNameRecordName ),    
+        SGenericRecordTypeInfo( KCDTIdSNAPMetadataSNAP,            EInt,    
+                                ENoAttrs,               KCDTypeNameSNAPMetadataSNAP ),       
+        SGenericRecordTypeInfo( KCDTIdSNAPMetadataMetadata,        EUint32,    
+                                ENoAttrs,               KCDTypeNameSNAPMetadataMetadata ),
+        SGenericRecordTypeInfo( KCDTIdSNAPMetadataIcon,        EUint32,    
+                                ENoAttrs,               KCDTypeNameSNAPMetadataIcon ),
+        SGenericRecordTypeInfo( 0, 0, ENoAttrs, KCDNull )       
+    };
+
+    return ::CreateTableL( aSession, 
+                           TPtrC( KCDTypeNameSNAPMetadata ), 
+                           KSNAPMetadataTableFormat );
+    }
+    
+EXPORT_C TMDBElementId 
+    CCDSNAPMetadataRecord::TableIdL( CMDBSession& aSession )
+    {
+    return ::TableIdL( aSession, TPtrC( KCDTypeNameSNAPMetadata ) );
+    }
+
+EXPORT_C CCDIAPMetadataRecord::CCDIAPMetadataRecord( TMDBElementId aElementId )
+        : CCDRecordBase( aElementId ), 
+          iIAP( ( aElementId & KCDMaskShowRecordType ) | 
+          KCDTIdIAPMetadataIAP ),
+          iMetadata( ( aElementId & KCDMaskShowRecordType ) | 
+          KCDTIdIAPMetadataMetadata ),
+          iSeamlessness( ( aElementId & KCDMaskShowRecordType ) | 
+          KCDTIdIAPMetadataSeamlessness )
+        {}
+
+EXPORT_C TMDBElementId 
+    CCDIAPMetadataRecord::CreateTableL( CMDBSession& aSession )
+    {
+    const SGenericRecordTypeInfo KIAPMetadataTableFormat[] = {
+        SGenericRecordTypeInfo( KCDTIdRecordTag,                EUint32,    
+                                ENoAttrs,                       KCDTypeNameRecordTag ),
+        SGenericRecordTypeInfo( KCDTIdRecordName,                EText,      
+                                ENotNull,                       KCDTypeNameRecordName ),    
+        SGenericRecordTypeInfo( KCDTIdIAPMetadataIAP,            ELink,    
+                                ENotNull,                       KCDTypeNameIAPMetadataIAP ),       
+        SGenericRecordTypeInfo( KCDTIdIAPMetadataMetadata,        EUint32,    
+                                ENoAttrs,               KCDTypeNameIAPMetadataMetadata ),
+        SGenericRecordTypeInfo( KCDTIdIAPMetadataSeamlessness, EInt,    
+                                ENoAttrs,                       KCDTypeNameIAPMetadataSeamlessness ),
+        SGenericRecordTypeInfo( 0, 0, ENoAttrs, KCDNull )
+    };
+
+    return ::CreateTableL( aSession, 
+                           TPtrC( KCDTypeNameIAPMetadata ), 
+                           KIAPMetadataTableFormat );
+    }
+    
+EXPORT_C TMDBElementId 
+    CCDIAPMetadataRecord::TableIdL( CMDBSession& aSession )
+    {
+    return ::TableIdL( aSession, TPtrC( KCDTypeNameIAPMetadata ) );
+    }
+
+EXPORT_C CCDMIP4Record::CCDMIP4Record( TMDBElementId aElementId )
+        : CCDRecordBase( aElementId ),
+          iHomeAddress( ( aElementId & KCDMaskShowRecordType ) | 
+          KCDTIdMIP4HomeAddress ),
+        iMaxRegRetries( ( aElementId & KCDMaskShowRecordType ) | 
+          KCDTIdMIP4MaxRegRetries ),
+        iFirstRetryTimeout( ( aElementId & KCDMaskShowRecordType ) | 
+          KCDTIdMIP4FirstRetryTimeout ),
+        iInitialLifetime( ( aElementId & KCDMaskShowRecordType ) | 
+          KCDTIdMIP4InitialLifetime ),
+        iNAI( ( aElementId & KCDMaskShowRecordType ) | 
+          KCDTIdMIP4NAI ),
+        iHomeAgentAddress( ( aElementId & KCDMaskShowRecordType ) | 
+          KCDTIdMIP4HomeAgentAddress ),
+        iSecondaryHomeAgentAddress( ( aElementId & KCDMaskShowRecordType ) | 
+          KCDTIdMIP4SecondaryHomeAgentAddress ),
+        iEnableReverseTunnel( ( aElementId & KCDMaskShowRecordType ) | 
+          KCDTIdMIP4EnableReverseTunnel ),
+        iEnableNATTraversal( ( aElementId & KCDMaskShowRecordType ) | 
+          KCDTIdMIP4EnableNATTraversal),
+        iEnableMinimalEncapsulation( ( aElementId & KCDMaskShowRecordType ) | 
+          KCDTIdMIP4EnableMinimalEncapsulation ),
+        iMNHAAuthAlgorithm( ( aElementId & KCDMaskShowRecordType ) | 
+          KCDTIdMIP4MNHAAuthAlgorithm ),
+        iMNHASPIIndicator( ( aElementId & KCDMaskShowRecordType ) | 
+          KCDTIdMIP4MNHASPIIndicator ),
+        iMNHASPI( ( aElementId & KCDMaskShowRecordType ) | 
+          KCDTIdMIP4MNHASPI ),
+        iMNHASSData( ( aElementId & KCDMaskShowRecordType ) | 
+          KCDTIdMIP4MNHASSData ),
+        iMNAAAAuthAlgorithm( ( aElementId & KCDMaskShowRecordType ) | 
+          KCDTIdMIP4MNAAAAuthAlgorithm ),
+        iMNAAASPIIndicator( ( aElementId & KCDMaskShowRecordType ) | 
+          KCDTIdMIP4MNAAASPIIndicator ),
+        iMNAAASPI( ( aElementId & KCDMaskShowRecordType ) | 
+          KCDTIdMIP4MNAAASPI ),
+        iMNAAASSData( ( aElementId & KCDMaskShowRecordType ) | 
+          KCDTIdMIP4MNAAASSData ),
+        iUseForeignAgent( ( aElementId & KCDMaskShowRecordType ) | 
+          KCDTIdMIP4UseForeignAgent ),
+        iMNFAAuthAlgorithm( ( aElementId & KCDMaskShowRecordType ) | 
+          KCDTIdMIP4MNFAAuthAlgorithm ),
+        iMNFASPIIndicator( ( aElementId & KCDMaskShowRecordType ) | 
+          KCDTIdMIP4MNFASPIIndicator ),
+        iMNFASPI( ( aElementId & KCDMaskShowRecordType ) | 
+          KCDTIdMIP4MNFASPI ),
+        iMNFASSData( ( aElementId & KCDMaskShowRecordType ) | 
+          KCDTIdMIP4MNFASSData )
+        {}
+
+EXPORT_C TMDBElementId 
+    CCDMIP4Record::CreateTableL( CMDBSession& aSession )
+    {
+   const SGenericRecordTypeInfo KMIP4TableFormat[] = {
+        SGenericRecordTypeInfo( KCDTIdRecordTag,                    EInt,        
+          ENoAttrs,                         KCDTypeNameRecordTag ),
+          SGenericRecordTypeInfo( KCDTIdRecordName,                 EText,        
+            ENotNull,                         KCDTypeNameRecordName ),
+        SGenericRecordTypeInfo( KCDTIdMIP4HomeAddress,            EText,      
+          ENoAttrs,                         KCDTypeNameMIP4HomeAddress ),
+          SGenericRecordTypeInfo( KCDTIdMIP4MaxRegRetries,            EInt,        
+          ENoAttrs,                         KCDTypeNameMIP4MaxRegRetries ),
+          SGenericRecordTypeInfo( KCDTIdMIP4FirstRetryTimeout,        EInt,        
+          ENoAttrs,                         KCDTypeNameMIP4FirstRetryTimeout ),
+          SGenericRecordTypeInfo( KCDTIdMIP4InitialLifetime,         EInt,        
+          ENoAttrs,                         KCDTypeNameMIP4InitialLifetime ),
+          SGenericRecordTypeInfo( KCDTIdMIP4NAI,                    EText,      
+          ENoAttrs,                         KCDTypeNameMIP4NAI ),
+          SGenericRecordTypeInfo( KCDTIdMIP4HomeAgentAddress,        EText,      
+          ENoAttrs,                         KCDTypeNameMIP4HomeAgentAddress ),
+          SGenericRecordTypeInfo( KCDTIdMIP4SecondaryHomeAgentAddress, EText,      
+          ENoAttrs,                         KCDTypeNameMIP4SecondaryHomeAgentAddress ),
+          SGenericRecordTypeInfo( KCDTIdMIP4EnableReverseTunnel,    EInt,        
+          ENoAttrs,                         KCDTypeNameMIP4EnableReverseTunnel ),
+          SGenericRecordTypeInfo( KCDTIdMIP4EnableNATTraversal,        EInt,        
+          ENoAttrs,                         KCDTypeNameMIP4EnableNATTraversal ),
+          SGenericRecordTypeInfo( KCDTIdMIP4EnableMinimalEncapsulation,    EInt,        
+          ENoAttrs,                         KCDTypeNameMIP4EnableMinimalEncapsulation ),
+          SGenericRecordTypeInfo( KCDTIdMIP4MNHAAuthAlgorithm,        EInt,        
+          ENotNull,                         KCDTypeNameMIP4MNHAAuthAlgorithm ),
+          SGenericRecordTypeInfo( KCDTIdMIP4MNHASPIIndicator,        EBool,      
+            ENotNull,                         KCDTypeNameMIP4MNHASPIIndicator ),
+          SGenericRecordTypeInfo( KCDTIdMIP4MNHASPI,                EUint32,        
+          ENoAttrs,                         KCDTypeNameMIP4MNHASPI ),
+          SGenericRecordTypeInfo( KCDTIdMIP4MNHASSData,                EText,      
+          ENotNull,                         KCDTypeNameMIP4MNHASSData ),
+          SGenericRecordTypeInfo( KCDTIdMIP4MNAAAAuthAlgorithm,        EInt,        
+          ENoAttrs,                         KCDTypeNameMIP4MNAAAAuthAlgorithm ),
+          SGenericRecordTypeInfo( KCDTIdMIP4MNAAASPIIndicator,        EBool,      
+            ENoAttrs,                         KCDTypeNameMIP4MNAAASPIIndicator ),
+          SGenericRecordTypeInfo( KCDTIdMIP4MNAAASPI,                EUint32,        
+          ENoAttrs,                         KCDTypeNameMIP4MNAAASPI ),
+          SGenericRecordTypeInfo( KCDTIdMIP4MNAAASSData,            EText,      
+          ENoAttrs,                         KCDTypeNameMIP4MNAAASSData ),
+          SGenericRecordTypeInfo( KCDTIdMIP4UseForeignAgent,        EInt,        
+          ENoAttrs,                         KCDTypeNameMIP4UseForeignAgent ),
+          SGenericRecordTypeInfo( KCDTIdMIP4MNFAAuthAlgorithm,        EInt,        
+          ENoAttrs,                         KCDTypeNameMIP4MNFAAuthAlgorithm ),
+          SGenericRecordTypeInfo( KCDTIdMIP4MNFASPIIndicator,        EBool,      
+            ENoAttrs,                         KCDTypeNameMIP4MNFASPIIndicator ),
+          SGenericRecordTypeInfo( KCDTIdMIP4MNFASPI,                EUint32,        
+          ENoAttrs,                         KCDTypeNameMIP4MNFASPI ),
+          SGenericRecordTypeInfo( KCDTIdMIP4MNFASSData,                EText,      
+          ENoAttrs,                         KCDTypeNameMIP4MNFASSData ),
+          SGenericRecordTypeInfo( 0,                                0,          
+            ENoAttrs,                         KCDNull )
+      };
+ 
+    return ::CreateTableL( aSession, 
+                           TPtrC( KCDTypeNameMIP4 ), 
+                           KMIP4TableFormat );
+    }
+    
+EXPORT_C TMDBElementId 
+    CCDMIP4Record::TableIdL( CMDBSession& aSession )
+    {
+    return ::TableIdL( aSession, TPtrC( KCDTypeNameMIP4 ) );
+    }
+
+EXPORT_C CCDMIP6Record::CCDMIP6Record( TMDBElementId aElementId )
+        : CCDRecordBase( aElementId ),
+        iHomeAddress( ( aElementId & KCDMaskShowRecordType ) |
+           KCDTIdMIP6HomeAddress ),
+        iHomeAgentAddress( ( aElementId & KCDMaskShowRecordType ) |
+        KCDTIdMIP6HomeAgentAddress ),
+        iPrefixLength( ( aElementId & KCDMaskShowRecordType ) |
+        KCDTIdMIP6PrefixLength ),
+        iEnableRouteOptimization( ( aElementId & KCDMaskShowRecordType ) |
+        KCDTIdMIP6EnableRouteOptimization ),
+        iEnableIPSec( ( aElementId & KCDMaskShowRecordType ) |
+        KCDTIdMIP6EnableIPSec ),
+        iMNHAAuthAlgorithm( ( aElementId & KCDMaskShowRecordType ) |
+        KCDTIdMIP6MNHAAuthAlgorithm ),
+        iMNHAEncryptAlgorithm( ( aElementId & KCDMaskShowRecordType ) |
+        KCDTIdMIP6MNHAEncryptAlgorithm ),
+        iMNHASPIIndicator( ( aElementId & KCDMaskShowRecordType ) |
+        KCDTIdMIP6MNHASPIIndicator ),
+        iMNHASPI( ( aElementId & KCDMaskShowRecordType ) |
+        KCDTIdMIP6MNHASPI ),
+        iMNHASSData( ( aElementId & KCDMaskShowRecordType ) |
+        KCDTIdMIP6MNHASSData ),
+        iHookState( ( aElementId & KCDMaskShowRecordType ) |
+        KCDTIdMIP6HookState ),
+        iIFName( ( aElementId & KCDMaskShowRecordType ) |
+        KCDTIdMIP6IFName ),
+        iTunnelIFName( ( aElementId & KCDMaskShowRecordType ) |
+        KCDTIdMIP6TunnelIFName )
+        {}
+
+EXPORT_C TMDBElementId 
+    CCDMIP6Record::CreateTableL( CMDBSession& aSession )
+    {
+   const SGenericRecordTypeInfo KMIP6TableFormat[] = {
+        SGenericRecordTypeInfo( KCDTIdRecordTag,                    EInt,        
+        ENoAttrs,                         KCDTypeNameRecordTag ),
+        SGenericRecordTypeInfo( KCDTIdRecordName,                 EText,        
+        ENotNull,                         KCDTypeNameRecordName ),
+        SGenericRecordTypeInfo( KCDTIdMIP6HomeAddress,            EText,      
+        ENotNull,                         KCDTypeNameMIP6HomeAddress ),
+        SGenericRecordTypeInfo( KCDTIdMIP6HomeAgentAddress,        EText,      
+        ENoAttrs,                         KCDTypeNameMIP6HomeAgentAddress ),
+        SGenericRecordTypeInfo( KCDTIdMIP6PrefixLength,            EInt,        
+        ENotNull,                         KCDTypeNameMIP6PrefixLength ),
+        SGenericRecordTypeInfo( KCDTIdMIP6EnableRouteOptimization, EBool,      
+        ENotNull,                         KCDTypeNameMIP6EnableRouteOptimization ),
+        SGenericRecordTypeInfo( KCDTIdMIP6EnableIPSec,            EBool,      
+        ENotNull,                         KCDTypeNameMIP6EnableIPSec ),
+        SGenericRecordTypeInfo( KCDTIdMIP6MNHAAuthAlgorithm,        EInt,        
+        ENotNull,                         KCDTypeNameMIP6MNHAAuthAlgorithm ),
+        SGenericRecordTypeInfo( KCDTIdMIP6MNHAEncryptAlgorithm,    EInt,        
+        ENotNull,                         KCDTypeNameMIP6MNHAEncryptAlgorithm ),
+        SGenericRecordTypeInfo( KCDTIdMIP6MNHASPIIndicator,        EBool,      
+        ENotNull,                         KCDTypeNameMIP6MNHASPIIndicator ),
+        SGenericRecordTypeInfo( KCDTIdMIP6MNHASPI,                EUint32,        
+        ENoAttrs,                         KCDTypeNameMIP6MNHASPI ),
+        SGenericRecordTypeInfo( KCDTIdMIP6MNHASSData,                EText,      
+        ENotNull,                         KCDTypeNameMIP6MNHASSData ),
+        SGenericRecordTypeInfo( KCDTIdMIP6HookState,                EUint32,        
+        ENoAttrs,                         KCDTypeNameMIP6HookState ),
+        SGenericRecordTypeInfo( KCDTIdMIP6IFName,                    EText,      
+        ENotNull,                         KCDTypeNameMIP6IFName ),
+        SGenericRecordTypeInfo( KCDTIdMIP6TunnelIFName,            EText,      
+        ENotNull,                         KCDTypeNameMIP6TunnelIFName ),          
+        SGenericRecordTypeInfo( 0,                                0,          
+        ENoAttrs,                         KCDNull )
+        };
+
+    return ::CreateTableL( aSession, 
+                           TPtrC( KCDTypeNameMIP6 ), 
+                           KMIP6TableFormat );
+    }
+    
+EXPORT_C TMDBElementId 
+    CCDMIP6Record::TableIdL( CMDBSession& aSession )
+    {
+    return ::TableIdL( aSession, TPtrC( KCDTypeNameMIP6 ) );
+    }
+
+EXPORT_C const SRecordTypeInfo* CCDVirtualIAPNextLayerRecord::GetRecordInfo()
+    { 
+    return iRecordInfo; 
+    }    
+    
+EXPORT_C const SRecordTypeInfo* CCDGlobalBearerTypePriorizationRecord::GetRecordInfo()
+    { 
+    return iRecordInfo; 
+    }    
+    
+EXPORT_C const SRecordTypeInfo* CCDDataMobilitySelectionPolicyRecord::GetRecordInfo()
+    { 
+    return iRecordInfo; 
+    }    
+       
+EXPORT_C const SRecordTypeInfo* CCDMIPServiceExtRecord::GetRecordInfo()
+    { 
+    return iRecordInfo; 
+    }    
+
+EXPORT_C const SRecordTypeInfo* CCDSNAPMetadataRecord::GetRecordInfo()
+    { 
+    return iRecordInfo; 
+    }    
+    
+EXPORT_C const SRecordTypeInfo* CCDIAPMetadataRecord::GetRecordInfo()
+    { 
+    return iRecordInfo; 
+    }    
+
+EXPORT_C const SRecordTypeInfo* CCDMIP4Record::GetRecordInfo()
+    { 
+    return iRecordInfo; 
+    }    
+EXPORT_C const SRecordTypeInfo* CCDMIP6Record::GetRecordInfo()
+    { 
+    return iRecordInfo; 
+    }    
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2006-2008 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 Connection Method Manager
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+// export iby files
+../Rom/CmManager.iby				CORE_MW_LAYER_IBY_EXPORT_PATH(CmManager.iby)
+../Rom/CmManagerResources.iby			LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(CmManagerResources.iby)
+
+../Rom/cmpluginembdestination.iby		CORE_MW_LAYER_IBY_EXPORT_PATH(cmpluginembdestination.iby)
+../Rom/cmpluginembdestinationresources.iby	LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(cmpluginembdestinationresources.iby)
+
+../Rom/cmpluginpacketdata.iby			CORE_MW_LAYER_IBY_EXPORT_PATH(cmpluginpacketdata.iby)
+../Rom/cmpluginpacketdataresources.iby		LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(cmpluginpacketdataresources.iby)
+
+../Rom/cmpluginvpn.iby				CORE_MW_LAYER_IBY_EXPORT_PATH(cmpluginvpn.iby)
+../Rom/cmpluginvpnresources.iby			LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(cmpluginvpnresources.iby)
+
+../Rom/cmpluginwlan.iby				CORE_MW_LAYER_IBY_EXPORT_PATH(cmpluginwlan.iby)
+../Rom/cmpluginwlanresources.iby		LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(cmpluginwlanresources.iby)
+
+
+PRJ_MMPFILES
+// None
+
+#include "../database/group/bld.inf"
+#include "../Framework/Group/bld.inf"
+#include "../Plugins/Group/bld.inf"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information for the Connection Method Manager
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+// None
+
+#include "../cmmgr/group/bld.inf"
+#include "../gsconnsettingsplugin/group/bld.inf"
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/gsconnsettingsplugin/data/200255B8.rss	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,43 @@
+/*
+* 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:    ECOM resource file for Connectivity Settings plugin.
+*
+*/
+
+#include <registryinfo.rh>
+
+
+RESOURCE REGISTRY_INFO theInfo
+	{
+	dll_uid     = 0x200255B8;
+	interfaces  = 
+		{
+		INTERFACE_INFO
+			{
+			interface_uid   = 0x10207236;
+			implementations = 
+				{
+				IMPLEMENTATION_INFO
+					{
+					implementation_uid  = 0x200255B9;
+					version_no          = 1;
+					display_name        = "Connectivity Settings Plugin"; // Debug name
+					default_data        = "0x10207250";// Parent UID
+					opaque_data         = "69";// Order number
+					}
+				};
+			}
+		};
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/gsconnsettingsplugin/data/gsconnsettingspluginrsc.rss	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,539 @@
+/*
+* 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:    Resource file for Connectivity Settings plugin.
+*
+*/
+
+
+//  RESOURCE IDENTIFIER
+NAME    CNST // 4 letter ID
+
+//  INCLUDES
+#include    "gsconnsettingsplugin.hrh"
+#include    <gsconnsettingsplugin.loc>
+#include    <data_caging_paths_strings.hrh>
+#include    <avkon.loc> // Avkon localized strings
+#include    <avkon.rh>
+#include    <avkon.mbg>
+#include    <avkon.rsg>
+#include    <eikon.rh>
+#include    <EIKCORE.rsg>
+#include    <eikon.rsg>
+#include    <gscommon.rh>
+#include    <GSApp.rsg>
+#include    <gs.loc> // Common localized GS strings
+#include    <uikon.rh>
+
+
+// CONSTANTS
+
+//  RESOURCE DEFINITIONS
+
+//----------------------------------------------------
+//
+//    Needed or loading the resource fails!
+//
+//----------------------------------------------------
+//
+RESOURCE RSS_SIGNATURE
+    {
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_setting_listbox
+// Common listbox editor resource for setting pages.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE LISTBOX r_setting_listbox
+    {
+    flags = EEikListBoxMultipleSelection;
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_gs_conn_settings_menubar_open_exit
+// GS menu with 'Open', 'Help' and 'Exit'items.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_gs_conn_settings_menubar_open_exit
+    {
+    titles =
+        {
+        MENU_TITLE
+            {
+            menu_pane = r_gs_conn_settings_menu_item_exit;
+            },
+        MENU_TITLE
+            {
+            menu_pane = r_gs_conn_settings_menu_item_help;
+            },
+        MENU_TITLE
+            {
+            menu_pane = r_gs_conn_settings_menu_item_open;
+            }
+        };
+    }
+
+//----------------------------------------------------
+//
+// r_gs_conn_settings_menu_item_open
+// Resource for 'Open' or 'Change' text in menu 
+//
+//----------------------------------------------------
+
+RESOURCE MENU_PANE r_gs_conn_settings_menu_item_open
+     {
+     items =
+         {
+         MENU_ITEM
+             {
+             command = EGSConnSettMenuOpen;
+             txt = qtn_set_options_open;
+             flags = EEikMenuItemAction;
+             },
+         MENU_ITEM
+             {
+             command = EGSConnSettMenuChange;
+             txt = qtn_set_options_change;
+             flags = EEikMenuItemAction;
+             }
+         };
+     }
+ 
+// -----------------------------------------------------------------------------
+//
+// r_gs_conn_settings_menu_item_exit
+// Resource for 'Exit' text in menu
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_gs_conn_settings_menu_item_exit
+     {
+     items =
+         {
+         MENU_ITEM
+             {
+             command = EAknCmdExit;
+             txt = qtn_options_exit;
+             }
+         };
+     }
+
+// -----------------------------------------------------------------------------
+//
+// r_gs_conn_settings_menu_item_help
+// Resource for 'Help' text in menu
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_gs_conn_settings_menu_item_help
+     {
+     items =
+         {
+         MENU_ITEM
+             {
+             command = EAknCmdHelp;
+             txt = qtn_options_help;
+             }
+         };
+     }
+
+//----------------------------------------------------
+//
+// r_gs_conn_settings_plugin_view
+// Resource for the main view of Connectivity Settings plugin
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_gs_conn_settings_plugin_view
+    {
+    menubar = r_gs_conn_settings_menubar_open_exit;
+    cba = r_gs_conn_settings_softkeys_options_back_open;
+    }
+
+//----------------------------------------------------
+//
+// r_gs_conn_settings_softkeys_options_back_open
+// Resource for the main view buttons
+//
+//----------------------------------------------------
+//
+RESOURCE CBA r_gs_conn_settings_softkeys_options_back_open
+     {
+     buttons =
+         {
+         CBA_BUTTON 
+             {
+             id=EAknSoftkeyOptions; 
+             txt = text_softkey_option;
+             },
+         CBA_BUTTON 
+             {
+             id=EAknSoftkeyBack; 
+             txt = text_softkey_back; 
+             },
+         CBA_BUTTON 
+             {
+             id=EGSConnSettMskGeneral;
+             txt = qtn_msk_open;
+             }
+         };
+     }
+
+//----------------------------------------------------
+//
+// r_gs_conn_settings_plugin_view_title
+// Connectivity Settings plugin view title.
+//
+//----------------------------------------------------
+//
+RESOURCE TITLE_PANE r_gs_conn_settings_plugin_view_title
+    {
+    txt = qtn_occ_title_connectivity_settings;
+    }
+
+//----------------------------------------------------
+//
+// r_gs_conn_settings_view_caption
+// Plugin name in Connectivity folder
+//
+//----------------------------------------------------
+//
+RESOURCE TBUF r_gs_conn_settings_view_caption
+    {
+    buf = qtn_set_folder_occ_connectivity_settings;
+    }
+
+//----------------------------------------------------
+//    
+// r_conn_settings_lbx    
+// Resource for main view listbox.
+//
+//----------------------------------------------------
+//
+RESOURCE GS_FEATURE_ARRAY r_conn_settings_lbx
+    {
+    items =
+        {
+        GS_FEATURE
+            {
+            txt = " \t"qtn_occ_sett_usage_of_wlan"\t\t"; 
+            item = EGSSettIdUsageOfWlan;
+            type = EGSListBoxItemTypeIsAlwaysVisible;            
+            },
+        GS_FEATURE
+            {
+            txt = " \t"qtn_occ_sett_data_usage_home_nw"\t\t"; 
+            item = EGSSettIdDataUsageHomeNw;
+            type = EGSListBoxItemTypeIsAlwaysVisible;            
+            },
+        GS_FEATURE
+            {
+            txt = " \t"qtn_occ_sett_data_usage_abroad"\t\t"; 
+            item = EGSSettIdDataUsageAbroad;
+            type = EGSListBoxItemTypeIsAlwaysVisible;            
+            }
+        };    
+    }
+
+//----------------------------------------------------
+//    
+// r_conn_settings_lbx_nowlan
+// Resource for main view listbox.
+//
+//----------------------------------------------------
+//
+RESOURCE GS_FEATURE_ARRAY r_conn_settings_lbx_nowlan
+    {
+    items =
+        {
+        GS_FEATURE
+            {
+            txt = " \t"qtn_occ_sett_data_usage_home_nw"\t\t"; 
+            item = EGSSettIdDataUsageHomeNw;
+            type = EGSListBoxItemTypeIsAlwaysVisible;            
+            },
+        GS_FEATURE
+            {
+            txt = " \t"qtn_occ_sett_data_usage_abroad"\t\t"; 
+            item = EGSSettIdDataUsageAbroad;
+            type = EGSListBoxItemTypeIsAlwaysVisible;            
+            }
+        };    
+    }
+
+//----------------------------------------------------
+//    
+//    r_conn_settings_lbx_txt
+//
+//----------------------------------------------------
+//
+RESOURCE ARRAY r_conn_settings_lbx_txt
+    {
+    items =
+        {
+        LBUF
+            {
+            txt = qtn_occ_sett_usage_of_wlan;
+            },
+        LBUF
+            {
+            txt = qtn_occ_sett_data_usage_home_nw;
+            },
+        LBUF
+            {
+            txt = qtn_occ_sett_data_usage_abroad;
+            }
+        };
+    }
+
+//----------------------------------------------------
+//    
+//    r_conn_settings_lbx_txt_nowlan
+//
+//----------------------------------------------------
+//
+RESOURCE ARRAY r_conn_settings_lbx_txt_nowlan
+    {
+    items =
+        {
+        LBUF
+            {
+            txt = qtn_occ_sett_data_usage_home_nw;
+            },
+        LBUF
+            {
+            txt = qtn_occ_sett_data_usage_abroad;
+            }
+        };
+    }
+
+//----------------------------------------------------
+//    
+// r_usage_of_new_wlan_setting_page
+// Resource for "Join new WLAN networks" setting page.
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_usage_of_wlan_setting_page
+    {
+    number = EAknSettingPageNoOrdinalDisplayed; 
+    label = qtn_occ_sett_usage_of_wlan;
+    softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+    type = EAknSetListBox;
+    editor_resource_id = r_setting_listbox;
+    }
+
+//----------------------------------------------------
+//    
+// r_usage_of_new_wlan_setting_page_lbx
+// Resource for "Join new WLAN networks" listbox items
+//
+//----------------------------------------------------
+//
+RESOURCE ARRAY r_usage_of_wlan_setting_page_lbx
+    {
+    items =
+        {
+        LBUF
+            {
+            txt = qtn_occ_sett_usage_of_wlan_known;
+            },                                       
+        LBUF
+            {
+            txt = qtn_occ_sett_usage_of_wlan_manual;
+            }
+        };
+    }
+
+//----------------------------------------------------
+//    
+// r_data_usage_abroad_setting_page
+// Resource for "" setting page
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_data_usage_abroad_setting_page
+    {
+    number = EAknSettingPageNoOrdinalDisplayed; 
+    label = qtn_occ_sett_data_usage_abroad;
+    softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+    type = EAknSetListBox;
+    editor_resource_id = r_setting_listbox;
+    }
+
+//----------------------------------------------------
+//    
+// r_data_usage_abroad_setting_page_lbx
+// Resource for "" listbox items
+//
+//----------------------------------------------------
+//
+RESOURCE ARRAY r_data_usage_abroad_setting_page_lbx
+    {
+    items =
+        {
+        LBUF
+            {
+            txt = qtn_occ_sett_data_usage_abroad_automatic;
+            },
+        LBUF
+            {
+            txt = qtn_occ_sett_data_usage_abroad_confirm;
+            },
+        LBUF
+            {
+            txt = qtn_occ_sett_data_usage_abroad_wlan_only;
+            }
+        };
+    }
+
+//----------------------------------------------------
+//    
+// r_data_usage_abroad_setting_page_lbx_nowlan
+// Resource for "" listbox items
+//
+//----------------------------------------------------
+//
+RESOURCE ARRAY r_data_usage_abroad_setting_page_lbx_nowlan
+    {
+    items =
+        {
+        LBUF
+            {
+            txt = qtn_occ_sett_data_usage_abroad_automatic;
+            },
+        LBUF
+            {
+            txt = qtn_occ_sett_data_usage_abroad_confirm;
+            }
+        };
+    }
+
+//----------------------------------------------------
+//    
+// r_data_usage_home_nw_setting_page
+// Resource for "" setting page
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_data_usage_home_nw_setting_page
+    {
+    number = EAknSettingPageNoOrdinalDisplayed; 
+    label = qtn_occ_sett_data_usage_home_nw;
+    softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+    type = EAknSetListBox;
+    editor_resource_id = r_setting_listbox;
+    }
+
+//----------------------------------------------------
+//    
+// r_data_usage_home_nw_setting_page_lbx
+// Resource for "" listbox items
+//
+//----------------------------------------------------
+//
+RESOURCE ARRAY r_data_usage_home_nw_setting_page_lbx
+    {
+    items =
+        {
+        LBUF
+            {
+            txt = qtn_occ_sett_data_usage_home_nw_automatic;
+            },
+        LBUF
+            {
+            txt = qtn_occ_sett_data_usage_home_nw_confirm;
+            },
+        LBUF
+            {
+            txt = qtn_occ_sett_data_usage_home_nw_wlan_only;
+            }
+        };
+    }
+
+//----------------------------------------------------
+//    
+// r_data_usage_home_nw_setting_page_lbx_nowlan
+// Resource for "" listbox items
+//
+//----------------------------------------------------
+//
+RESOURCE ARRAY r_data_usage_home_nw_setting_page_lbx_nowlan
+    {
+    items =
+        {
+        LBUF
+            {
+            txt = qtn_occ_sett_data_usage_home_nw_automatic;
+            },
+        LBUF
+            {
+            txt = qtn_occ_sett_data_usage_home_nw_confirm;
+            }
+        };
+    }
+
+//----------------------------------------------------
+//    
+// r_gs_conn_settings_msk_label_open
+// "Open" text resource for MSK label 
+//
+//----------------------------------------------------
+//
+RESOURCE TBUF r_gs_conn_settings_msk_label_open
+    {
+    buf = qtn_set_options_open;
+    }
+
+//----------------------------------------------------
+//    
+// r_gs_conn_settings_msk_label_change
+// "Change" text resource for MSK label
+//
+//----------------------------------------------------
+//
+RESOURCE TBUF r_gs_conn_settings_msk_label_change
+    {
+    buf = qtn_set_options_change;
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_gs_conn_settings_rsk_label_exit
+// Exit text for RSK
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_gs_conn_settings_rsk_label_exit { buf = text_softkey_exit; }
+
+
+RESOURCE ARRAY r_usage_of_wlan_info_popup_texts
+    {
+    items =
+        {
+        LBUF
+            {
+            txt = qtn_occ_info_popup_wlan_usage_known;
+            },
+        LBUF
+            {
+            txt = qtn_occ_info_popup_wlan_usage_manual;
+            }
+        };
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/gsconnsettingsplugin/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,43 @@
+/*
+* 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:  This file provides the information required for building
+*               Connectivity Settings plugin
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../rom/gsconnsettingsplugin.iby CORE_MW_LAYER_IBY_EXPORT_PATH( gsconnsettingsplugin.iby )
+../rom/gsconnsettingspluginresources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH( gsconnsettingspluginresources.iby )
+
+../loc/gsconnsettingsplugin.loc MW_LAYER_LOC_EXPORT_PATH( gsconnsettingsplugin.loc )
+
+PRJ_EXTENSIONS
+START EXTENSION s60/mifconv
+  OPTION TARGETFILE gsconnsettingsplugin.mif
+  OPTION HEADERFILE gsconnsettingsplugin.mbg
+  /* Using Connectivity plugin icon. Should be changed when correct (qgn_prop_cp_conn_settings) icon available */
+  OPTION SOURCES -c8,8 qgn_prop_cp_conn
+END
+
+PRJ_MMPFILES
+gsconnsettingsplugin.mmp
+
+PRJ_TESTMMPFILES
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/gsconnsettingsplugin/group/gsconnsettingsplugin.mmp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,85 @@
+/*
+* 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:    Resource file for plugin.
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+CAPABILITY          CAP_ECOM_PLUGIN
+TARGET              gsconnsettingsplugin.dll
+TARGETTYPE          PLUGIN
+UID                 0x10009D8D 0x200255B8
+VENDORID            VID_DEFAULT
+
+
+USERINCLUDE         ../inc
+USERINCLUDE         ../data
+USERINCLUDE         ../loc
+USERINCLUDE         ../traces
+
+SYSTEMINCLUDE       /epoc32/include/ecom
+// Default system include paths for middleware layer modules.
+MW_LAYER_SYSTEMINCLUDE
+
+#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
+APP_LAYER_SYSTEMINCLUDE
+#endif
+
+SOURCEPATH          ../src
+
+SOURCE              gsconnsettingspluginimpltable.cpp 
+SOURCE              gsconnsettingsplugin.cpp
+SOURCE              gsconnsettingsplugincontainer.cpp
+SOURCE              gsconnsettingspluginmodel.cpp gsconnsettingsselectiondlg.cpp
+
+START RESOURCE ../data/200255B8.rss
+	TARGET gsconnsettingsplugin.rsc
+END
+
+// View resources
+START RESOURCE ../data/gsconnsettingspluginrsc.rss
+DEPENDS gsapp.rsg
+	HEADER
+	TARGETPATH RESOURCE_FILES_DIR
+LANGUAGE_IDS
+END
+
+LIBRARY             egul.lib
+LIBRARY             aknskins.lib 
+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             commonengine.lib// For RConeResourceLoader
+LIBRARY             GSEcomPlugin.lib
+LIBRARY             GSFramework.lib
+LIBRARY             GSListBox.lib         // For CGSListBoxItemTextArray
+LIBRARY             FeatMgr.lib           // Feature manager
+LIBRARY             hlplch.lib            // for "Help" options menu
+LIBRARY             cmmanager.lib
+
+//Documents. Defining these is optional. Used only by IDE's file browser.
+//DOCUMENT            ./gsconnsettingspluginicons.mk
+
+DOCUMENT ../data/200255B8.rss
+DOCUMENT ../data/gsconnsettingspluginrsc.rss
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/gsconnsettingsplugin/inc/gsconnsettingsmskobserver.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,43 @@
+/*
+* 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:  MSK key event observer interface
+*
+*/
+
+
+#ifndef GSCONNSETTINGSMSKOBSERVER_H
+#define GSCONNSETTINGSMSKOBSERVER_H
+
+// INCLUDES
+#include <e32base.h>
+
+// Middle Softkey control ID.
+const TInt KGSConnSettingsMSKControlID = 3;
+
+/**
+ *  Interface for MSK label change observers. 
+ *
+ *  @lib gsconnsettingsplugin.lib
+ *  @since S60 5.0
+ */
+NONSHARABLE_CLASS( MGSConnSettingsMskObserver )
+    {
+    public:
+        /**
+         * Notification to this observer to change MSK label if needed
+         */
+         virtual void CheckMiddleSoftkeyLabelL() = 0;
+    };
+
+#endif //GSCONNSETTINGSMSKOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/gsconnsettingsplugin/inc/gsconnsettingsplugin.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,243 @@
+/*
+* 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:    Header file for Connectivity Settings plugin.
+*
+*/
+
+
+#ifndef GSCONNSETTINGSPLUGIN_H
+#define GSCONNSETTINGSPLUGIN_H
+
+// Includes
+#include <GSPluginLoader.h>
+#include <GSBaseView.h>
+#include "gsconnsettingsmskobserver.h"
+
+#include <aknview.h>
+#include <eikclb.h>
+
+// Classes referenced
+class CAknViewAppUi;
+class RConeResourceLoader;
+class CGSConnSettingsPluginModel;
+class CGSConnSettingsPluginContainer;
+
+// Constants
+
+//Should we put these to .hrh 
+// This UID is used for both the view UID 
+// and the ECOM plugin implementation ID.
+const TUid KGSConnSettingsPluginUid = { 0x200255B9 };
+const int KGConnSettingsPluginCount = 10;
+
+_LIT( KGSConnSettingsPluginResourceFileName, "z:gsconnsettingspluginrsc.rsc" );
+_LIT( KGSConnSettingsPluginIconDirAndName, "z:gsconnsettingsplugin.mbm"); // Use KDC_BITMAP_DIR
+
+// CLASS DECLARATION
+
+/**
+* CConnSettingsPlugin view class.
+*
+* @since Series60_3.1
+*/
+class CGSConnSettingsPlugin : public CGSBaseView, public MGSPluginLoadObserver, public MGSConnSettingsMskObserver
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Symbian OS two-phased constructor
+        * @return
+        */
+        static CGSConnSettingsPlugin* NewL( TAny* aInitParams );
+
+        /**
+        * Destructor.
+        */
+        ~CGSConnSettingsPlugin();
+
+// From CAknView
+
+        /**
+        * See base class.
+        */
+        TUid Id() const;
+        
+        /**
+        * Handles commands.
+        * @param aCommand Command to be handled.
+        * 
+        */
+        void HandleCommandL( TInt aCommand );
+        
+
+        /**
+        * See base class.
+        */
+        void DoActivateL( const TVwsViewId& aPrevViewId,
+                          TUid aCustomMessageId,
+                          const TDesC8& aCustomMessage );
+        /**
+        * See base class.
+        */
+        void DoDeactivate();
+        
+        
+        /**
+        * From MEikMenuObserver.
+        * Changes MenuPane dynamically.
+        */
+        void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
+        
+// From CGSParentPlugin
+
+        /**
+        * See base class.
+        */
+        TUid UpperLevelViewUid();
+
+        
+        /**
+        * See base class.
+        */
+        void GetHelpContext( TCoeHelpContext& aContext );
+
+// From CGSPluginInterface
+
+        /**
+        * See base class.
+        */
+        void GetCaptionL( TDes& aCaption ) const;
+
+        /**
+        * See base class.
+        */
+        CGulIcon* CreateIconL( const TUid aIconType );
+
+        /**
+        * See base class.
+        */
+        TInt PluginProviderCategory() const;
+
+        /**
+        * @see MGSPluginLoadObserver header file.
+        */
+        void HandlePluginLoaded( KGSPluginLoaderStatus aStatus );
+
+        
+        /**
+        * Updates listbox's item's value.
+        * @param aItemId An item which is updated.
+        * 
+        */
+        void UpdateListBoxL( TInt aItemId );
+
+        /**
+        * Get CGSConnSettingsPlugin's ccontainer.
+        */
+        CGSConnSettingsPluginContainer* Container();
+                
+        /**
+         * From MGSSensorMskObserver.
+         * Checks currently activated item in list and updates MSK label if needed
+         */
+        void CheckMiddleSoftkeyLabelL();
+        
+        /**
+         * From MEikListBoxObserver (through CGSBaseView)
+         */
+        void HandleListBoxEventL( CEikListBox* aListBox,
+                    TListBoxEvent aEventType );
+        
+        
+    protected: // New
+        /**
+        * C++ default constructor.
+        */
+        CGSConnSettingsPlugin();
+
+        /**
+        * Symbian OS default constructor.
+        */
+        void ConstructL();
+        
+    private:
+
+        void NewContainerL();
+        
+        /**
+         * From CGSBaseView. Handles list box selection
+         */
+        void HandleListBoxSelectionL();
+
+        /**
+        * Show "Join new WLAN networks" setting page
+        */
+        void ShowUsageOfWlanSettingPageL();
+        
+        /**
+        * Show "Cellular data usage abroad" setting page
+        */
+        void ShowDataUsageAbroadSettingPageL();
+        
+        /**
+        * Show "Cellular data usage in home network" setting page
+        */
+        void ShowDataUsageInHomeNwSettingPageL();
+        
+        /**
+         * Removes current label from MSK
+         */
+        void RemoveCommandFromMSK();
+
+        /**
+         * Adds new label for MSK
+         *
+         * @param aResourceId Text of the new label
+         * @param aCommandId Command id of the MSK
+         */
+        void SetMiddleSoftKeyLabelL( const TInt aResourceId, const TInt aCommandId );       
+        
+        
+    private: //Private data
+
+        /**
+         * Resource loader
+         */
+        RConeResourceLoader iResourceLoader;
+
+        /**
+         * Pointer to model.
+         * Owned by CGSConnSettingsPluginContainer
+         */
+        CGSConnSettingsPluginModel *iModel;
+
+        /**
+         * Asynchronous loader for the GS plug-ins.
+         */
+        CGSPluginLoader* iPluginLoader;
+        
+        /**
+         * Array of the child plugins
+         */
+        CArrayPtrFlat<CGSPluginInterface>* iPluginArray;
+
+        /**
+         * Flag is set when wlan is supported
+         */
+        TBool iIsWlanSupported;
+    };
+
+
+#endif // GSCONNSETTINGSPLUGIN_H
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/gsconnsettingsplugin/inc/gsconnsettingsplugin.hrh	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,67 @@
+/*
+* 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:  Contains common definitions for Connectivity Settings plugin
+*
+*/
+
+
+#ifndef GSCONNECTIVITYSETTINGSPLUGIN_HRH
+#define GSCONNECTIVITYSETTINGSPLUGIN_HRH
+
+// commands
+enum TMenuCommands
+    {     // GS plugin commands starts from 500
+    EGSConnSettMenuOpen = 550, // Menu command Open
+    EGSConnSettMenuChange,     // Menu command change
+    EGSConnSettMskGeneral,     // MSK general in main view. Can be either 'Change' or 'Open'
+    EGSConnSettMenuExit        // 'Exit' menu command. Overridden to take control of exit
+    };
+
+// Main view item identifiers
+enum {
+    EGSSettIdUsageOfWlan,
+    EGSSettIdDataUsageHomeNw,
+    EGSSettIdDataUsageAbroad,
+    EGSExtPluginsListItemId
+    };
+
+//Indexes for usage of new WLAN values
+//These have to match to the order of r_usage_of_wlan_setting_page_lbx
+//resource in gsconnsettingsplugin.rss
+enum {
+    EUsageOfWlanKnown = 0,
+    EUsageOfNewWlanManual = 1
+    };
+
+//Indexes for data usage abroad values
+//These have to match to the order of r_data_usage_abroad_setting_page_lbx
+//resource in gsconnsettingsplugin.rss
+enum {
+    EDataUsageAbroadAutomatic = 0,
+    EDataUsageAbroadConfirm = 1,
+    EDataUsageAbroadWlanOnly = 2
+    };
+
+//Indexes for data usage in home NW values
+//These have to match to the order of r_data_usage_home_nw_setting_page_lbx
+//resource in gsconnsettingsplugin.rss
+enum {
+    EDataUsageHomeNwAutomatic = 0,
+    EDataUsageHomeNwConfirm = 1,
+    EDataUsageHomeNwWlanOnly = 2
+    };
+
+#endif //  GSCONNECTIVITYSETTINGSPLUGIN_HRH
+
+//End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/gsconnsettingsplugin/inc/gsconnsettingsplugincontainer.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,221 @@
+/*
+* 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:  Container for the Connectivity Settings Plugin
+*
+*/
+
+
+#ifndef GSCONNSETTINGSPLUGINCONTAINER_H
+#define GSCONNSETTINGSPLUGINCONTAINER_H
+
+// INCLUDES
+#include "gsconnsettingspluginmodel.h"
+#include <GSBaseContainer.h>
+
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class CGSListBoxItemTextArray;
+class CGSPluginInterface;
+class MGSConnSettingsMskObserver;
+
+// CLASS DECLARATION
+
+/**
+*  GSConnSettingsPluginContainer container class
+*
+*  Container class for Connectivity Settings plugin view
+*  @lib gsconnsettingsplugin.lib
+*  @since Series 60_3.1
+*/
+class CGSConnSettingsPluginContainer : public CGSBaseContainer
+    {
+    public: // Constructors and destructor
+        
+        /**
+        * Symbian OS constructor.
+        * @param aRect Listbox's rect.
+        * 
+        */
+        void ConstructL( const TRect& aRect );
+        
+        /**
+        * Destructor.
+        */
+        ~CGSConnSettingsPluginContainer();
+        
+        /**
+        * Constructor
+        */
+        CGSConnSettingsPluginContainer( MGSConnSettingsMskObserver& aMskObserver );
+
+    public: //new
+
+        /**
+        * Updates listbox's item's value.
+        * @since Series 60_3.1
+        * @param aItemId An item which is updated.
+        */
+        void UpdateListBoxL( TInt aFeatureId );
+        
+        /**
+        * Retrieves the currently selected listbox feature id
+        * @since Series 60_3.1
+        * @return feature id.
+        */
+        TInt CurrentFeatureId() const;
+        
+        /**
+         * Return its member variable iMode
+         * @param
+         */
+        CGSConnSettingsPluginModel* Model();
+        
+        /**
+         * Finds user selected plugin from plugin array
+         *
+         * @return Plugin which is selected in the lbx or leaves 
+         * with KErrnotFound if no plugins exist.
+         */
+        CGSPluginInterface* SelectedPluginL();
+
+        /**
+         * Makes ECOM plugin item
+         */
+        void MakeECOMPluginItemL();
+
+        /**
+        * Sets iPluginArray member.
+        * @param aPluginArray Pointer to loaded ECOM plugin array
+        */
+        void SetPluginArray ( CArrayPtrFlat<CGSPluginInterface>* aPluginArray );
+        
+        
+    protected: // from CGSBaseContainer
+        void ConstructListBoxL( TInt aResLbxId );
+        
+    private: // new
+        // create listbox from resource
+        void CreateListBoxItemsL();
+
+        /**
+         * Adds items from iUsageOfWlanItems to main views list
+         */
+        void MakeUsageOfWlanNetworksItemL();
+                
+        /**
+         * Adds items from iDataUsageAbroadItems to main views list
+         */
+        void MakeDataUsageAbroadItemL();
+        
+        /**
+         * Adds items from iDataUsageHomeNwItems to main views list
+         */
+        void MakeDataUsageHomeNwItemL();
+        
+        /**
+         * From CGSBaseContainer. Constructs correct textformat for one list box item 
+         * and adds it in listbox
+         *
+         * @param aPos Position of text in listbox
+         * @param aFirstLabel Text in first row of listbox item
+         * @param aSecondLabel Text in second row of listbox item
+         */
+        void AppendListItemL( const TInt aPos, 
+                              const TDesC16& aFirstLabel, 
+                              const TDesC16& aSecondLabel );
+               
+        /**
+         * Handles changes in MSK label between item changes in listbox
+         */
+        TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
+                        
+        /**
+         * Return list index according to wlan variation.
+         */
+        TInt Index( TInt aIndex );
+        
+        // from CGSBaseContainer
+        /**
+        * Required for help.
+        */
+        void GetHelpContext( TCoeHelpContext& aContext ) const;
+        
+    private: // Data
+        
+        /**
+        * This holds items from resource R_USAGE_OF_WLAN_SETTING_PAGE_LBX
+        */
+        CDesCArrayFlat* iUsageOfWlanItems;
+                
+        /**
+        * This holds items from resource R_DATA_USAGE_ABROAD_SETTING_PAGE_LBX
+        */
+        CDesCArrayFlat* iDataUsageAbroadItems;
+        
+        /**
+        * This holds items from resource R_DATA_USAGE_HOME_NW_SETTING_PAGE_LBX
+        */
+        CDesCArrayFlat* iDataUsageHomeNwItems;
+        
+        /**
+         * Listbox item array.
+         */
+        CGSListBoxItemTextArray* iListboxItemArray;
+        
+        /**
+         * Listbox item text array. Contains listbox item texts
+         */
+        CDesCArray* iListBoxTextArray;
+               
+        /** 
+         * General list box items. Contains localized listbox texts
+         * from R_CONN_SETTINGS_LBX_TXT resource .
+         */
+        CDesCArrayFlat* iListItems;
+        
+        // plugin model
+        CGSConnSettingsPluginModel* iModel;        
+
+        /**
+         * Array of the child plugins. Owned by CGSConnSettingsPlugin.
+         */
+        CArrayPtrFlat<CGSPluginInterface>* iPluginArray;
+        
+        /**
+         * General item count. Used when calculating item indexes to ECOM plugins
+         */
+        TInt iGeneralItemCount;
+        
+        /**
+         * Reference to main view. Does not own
+         */
+        MGSConnSettingsMskObserver& iMskObserver;
+
+        /**
+         * Flag is set when wlan is supported
+         */
+        TBool iIsWlanSupported;              
+    };
+
+#endif //GSCONNSETTINGSPLUGINCONTAINER_H
+
+//End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/gsconnsettingsplugin/inc/gsconnsettingspluginmodel.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,136 @@
+/*
+* 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:  Display Settings model.
+*
+*/
+
+#ifndef GSCONNSETTINGSPLUGINMODEL_H
+#define GSCONNSETTINGSPLUGINMODEL_H
+
+#include <e32base.h>
+#include <cmgenconnsettings.h>
+
+class CGSConnSettingsPluginContainer;
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DEFINITION
+/**
+*   CGSConnSettingsPluginModel is the model class of Connectivity Settings plugin.
+*  It provides functions to get and set setting values.
+*  @lib gsconnsettingsplugin.lib
+*  @since Series 60_3.1
+
+*/
+NONSHARABLE_CLASS( CGSConnSettingsPluginModel ): public CBase
+    {
+    public:  // Constructor and destructor
+        /**
+        * Two-phased constructor
+        */
+        static CGSConnSettingsPluginModel* NewL();
+
+        /**
+        * Destructor
+        */
+        ~CGSConnSettingsPluginModel();
+
+    public:
+        /**
+        * Loads settings by using CMManager's general connection settings API
+        */
+        void LoadSettingsL();
+
+        /**
+        * Saves settings by using CMManager's general connection settings API
+        */
+        void SaveSettingsL();
+
+        /**
+        * Gets and maps value from general connection settings API to match index in UI
+        * @return TInt
+        */ 
+        TInt UsageOfWlan();
+        
+        /**
+        * Gets and maps value from general connection settings API to match index in UI
+        * @return TInt
+        */ 
+        TInt DataUsageAbroad();
+
+        /**
+        * Gets and maps value from general connection settings API to match index in UI
+        * @return TInt
+        */ 
+        TInt DataUsageInHomeNw();
+
+        /**
+        * Maps UI index to according general connection setting API value
+        * @param aValue index to be mapped to API value
+        */
+        void SetUsageOfWlan( TInt aValue );
+        
+        /**
+        * Maps UI index to according general connection setting API value
+        * @param aValue index to be mapped to API value
+        */
+        void SetDataUsageAbroad( TInt aValue );
+
+        /**
+        * Maps UI index to according general connection setting API value
+        * @param aValue index to be mapped to API value
+        */
+        void SetDataUsageInHomeNw( TInt aValue );
+        
+        /**
+         * @param
+         */
+        void SetOwner( CGSConnSettingsPluginContainer* aPlugin);
+
+    private: // Private constructors
+
+        /**
+        * Default C++ contructor
+        */
+        CGSConnSettingsPluginModel();
+
+        /**
+        * Symbian OS default constructor
+        * @return void
+        */
+        void ConstructL();
+
+    private:
+        /**
+        * Pointer to container class
+        */
+        CGSConnSettingsPluginContainer* iContainer;
+
+        /**
+        * Struct to hold current settings
+        */
+        TCmGenConnSettings iSettings;
+        
+    };
+
+#endif //GSCONNSETTINGSPLUGINMODEL_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/gsconnsettingsplugin/inc/gsconnsettingsselectiondlg.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,98 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:    Header file for CGSConnSettingsSelectionDlg class
+*
+*/
+
+#ifndef GSCONNSETTINGSSELECTIONDLG_H
+#define GSCONNSETTINGSSELECTIONDLG_H
+
+#include <aknradiobuttonsettingpage.h>
+#include <AknInfoPopupNoteController.h>
+
+class CGSConnSettingsSelectionDlg : public CAknRadioButtonSettingPage
+    {
+    
+public:
+    
+    /**
+     * Symbian OS two-phased constructor
+     * 
+     * @param aResourceID               Text at top of setting pane
+     * @param aCurrentSelectionIndex    Current slected item
+     * @param aItemArray                Pointer to array of loaded resource texts for radio buttons
+     * @param aPopupResource            ID of popup note resource array
+     * @return 
+     * 
+    */
+    static CGSConnSettingsSelectionDlg* NewL(TInt aResourceID, 
+            TInt& aCurrentSelectionIndex, 
+            const MDesCArray* aItemArray,
+            TInt aPopupResource);
+    
+    /**
+     * Symbian OS two-phased constructor
+     * 
+     * @param aPopupResource    ID of popup note resource array
+    */
+    void ConstructL(TInt aPopupResource);
+    
+    /**
+     * C++ default constructor.
+     *
+     * @param aResourceID               Text at top of setting pane
+     * @param aCurrentSelectionIndex    Current slected item
+     * @param aItemArray                Pointer to array of loaded resource texts for radio buttons
+     * @param aPopupResource            ID of popup note resource array
+    */
+    CGSConnSettingsSelectionDlg( 
+            TInt aResourceID, 
+            TInt& aCurrentSelectionIndex, 
+            const MDesCArray* aItemArray,
+            TInt aPopupResource);
+    /**
+     * Destructor.
+     */
+    virtual ~CGSConnSettingsSelectionDlg();
+    
+private:
+    //From CAknListBoxSettingPage
+    void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType);
+    
+    //From CAknSettingPage
+    TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType);
+
+private:
+    //New Functions
+
+    /**
+    * Displays info popup on the screen
+    * 
+    */
+    void ShowInfoPopupL();
+
+private: //Private data
+
+    /**
+     * Pointer to popup note controller. Owned.
+     */
+    CAknInfoPopupNoteController* iPopupController;
+    
+    /**
+     * Pointer to loaded popup note resources. Owned.
+     */
+    CDesCArrayFlat* iPopupItems;
+
+    };
+#endif // GSCONNSETTINGSSELECTIONDLG_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/gsconnsettingsplugin/loc/gsconnsettingsplugin.loc	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,128 @@
+/*
+* 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:    Localization strings for Connectivity Settings plugin.
+*
+*/
+
+
+//  LOCALISATION STRINGS
+
+// **CAPTIONS
+
+//d:Plugin title.
+//d:Long string.
+//l:title_pane_t2/opt9
+//w:
+//r:5.2
+//
+#define qtn_occ_title_connectivity_settings "Connectivity Settings"
+
+//d:Plugin caption.
+//d:Used by GS FW.
+//l:list_single_large_graphic_pane_t1
+//w:
+//r:5.2
+//
+#define qtn_set_folder_occ_connectivity_settings "Connectivity settings"
+
+// **OPTIONS MENU
+
+//d:Text of a list item in Connectivity Settings plugin main view's list
+//d:Item opens "Join new WLAN networks" radio button setting page
+//l:list_setting_pane_t1
+//w:
+//r: 5.2
+#define qtn_occ_sett_usage_of_wlan "Join WLAN networks"
+
+//d:Text in radio button list
+//l:list_set_graphic_pane_t1
+//w:
+//r: 5.2
+#define qtn_occ_sett_usage_of_wlan_known "Known"
+
+//d:Text in radio button list
+//l:list_set_graphic_pane_t1
+//w:
+//r: 5.2
+#define qtn_occ_sett_usage_of_wlan_manual "Manual"
+
+//d:Text of a list item in Connectivity Settings plugin main view's list
+//d:Item opens "Cellular data usage abroad" radio button setting page
+//l:list_setting_pane_t1
+//w:
+//r: 5.2
+#define qtn_occ_sett_data_usage_abroad "Cellular data usage abroad"
+
+//d:Text in radio button list
+//l:list_set_graphic_pane_t1
+//w:
+//r: 5.2
+#define qtn_occ_sett_data_usage_abroad_automatic "Automatic"
+
+//d:Text in radio button list
+//l:list_set_graphic_pane_t1
+//w:
+//r: 5.2
+#define qtn_occ_sett_data_usage_abroad_confirm "Confirm"
+
+//d:Text in radio button list
+//l:list_set_graphic_pane_t1
+//w:
+//r: 5.2
+#define qtn_occ_sett_data_usage_abroad_wlan_only "WLAN only"
+
+
+//d:Text of a list item in Connectivity Settings plugin main view's list
+//d:Item opens "Cellular data usage in home network" radio button setting page
+//l:list_setting_pane_t1
+//w:
+//r: 5.2
+#define qtn_occ_sett_data_usage_home_nw "Cellular data usage in home network"
+
+//d:Text in radio button list
+//l:list_set_graphic_pane_t1
+//w:
+//r: 5.2
+#define qtn_occ_sett_data_usage_home_nw_automatic "Automatic"
+
+//d:Text in radio button list
+//l:list_set_graphic_pane_t1
+//w:
+//r: 5.2
+#define qtn_occ_sett_data_usage_home_nw_confirm "Confirm" 
+
+//d:Text in radio button list
+//l:list_set_graphic_pane_t1
+//w:
+//r: 5.2
+#define qtn_occ_sett_data_usage_home_nw_wlan_only "WLAN only"
+
+
+//d: Info popup note for "Known" selection of "Join WLAN networks"
+//l: popup_preview_text_window_t1/opt5
+//w:
+//r: 5.2
+//
+#define qtn_occ_info_popup_wlan_usage_known "Known WLAN networks will be joined automatically."
+
+
+//d: Info popup note for "Manual" selection of "Join WLAN networks"
+//l: popup_preview_text_window_t1/opt5
+//w:
+//r: 5.2
+//
+#define qtn_occ_info_popup_wlan_usage_manual "Phone will not join WLAN networks automatically. WLAN network can be taken into use via WLAN wizard."
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/gsconnsettingsplugin/rom/gsconnsettingsplugin.iby	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,29 @@
+/*
+* 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:  Connectivity Settings Plugin ROM files.
+*
+*/
+
+#ifndef GSCONNSETTINGSPLUGIN_IBY
+#define GSCONNSETTINGSPLUGIN_IBY
+
+#ifdef RD_CONTROL_PANEL
+
+    ECOM_PLUGIN( gsconnsettingsplugin.dll, 200255B8.rsc )
+    data=DATAZ_\BITMAP_DIR\gsconnsettingsplugin.mif BITMAP_DIR\gsconnsettingsplugin.mif
+
+#endif // RD_CONTROL_PANEL
+
+#endif // GSCONNSETTINGSPLUGIN_IBY
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/gsconnsettingsplugin/rom/gsconnsettingspluginresources.iby	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* 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:  Connectivity Settings Plugin ROM resources.
+*
+*/
+
+#ifndef GSCONNSETTINGSPLUGINRESOURCES_IBY
+#define GSCONNSETTINGSPLUGINRESOURCES_IBY
+
+    #ifdef RD_CONTROL_PANEL
+
+        data=DATAZ_\RESOURCE_FILES_DIR\gsconnsettingspluginrsc.rsc RESOURCE_FILES_DIR\gsconnsettingspluginrsc.rsc
+
+    #endif // RD_CONTROL_PANEL
+
+#endif // GSCONNSETTINGSPLUGINRESOURCES_IBY
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/gsconnsettingsplugin/src/gsconnsettingsplugin.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,662 @@
+/*
+* 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: Cpp file for Connectivity Settings plugin.
+*
+*/
+
+
+// Includes
+#include <featmgr.h>
+#include "gsconnsettingsplugin.h"
+#include "gsconnsettingsplugin.hrh"
+#include "gsconnsettingspluginmodel.h"
+#include "gsconnsettingsplugincontainer.h"
+#include "gsconnsettingsselectiondlg.h"
+
+#include <gsconnsettingspluginrsc.rsg>
+#include <gsconnsettingsplugin.mbg>
+
+// Includes from GS framework:
+#include <GSCommon.hrh>
+#include <GSFWViewUIDs.h>
+#include <GSPrivatePluginProviderIds.h>
+#include <GSTabHelper.h>
+#include <GSMainView.h>
+
+#include <hlplch.h> // For HlpLauncher
+#include <featmgr.h>
+#include <csxhelp/cp.hlp.hrh>
+
+#include <gulicon.h>
+#include <AknsUtils.h>
+#include <aknViewAppUi.h>
+#include <aknradiobuttonsettingpage.h>
+#include <AknQueryDialog.h>
+#include <ConeResLoader.h>
+#include <barsread.h> // For TResourceReader
+#include <StringLoader.h>
+
+// Constants
+
+
+// ========================= MEMBER FUNCTIONS ================================
+
+
+// ---------------------------------------------------------------------------
+// CGSConnSettingsPlugin::CConnectivitySettingsPlugin()
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CGSConnSettingsPlugin::CGSConnSettingsPlugin()
+    : iResourceLoader( *iCoeEnv )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CGSConnSettingsPlugin::~CConnectivitySettingsPlugin()
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CGSConnSettingsPlugin::~CGSConnSettingsPlugin()
+    {
+    iResourceLoader.Close();
+    
+    
+    // Delete plugin loader
+    if ( iPluginLoader )
+        {
+        delete iPluginLoader;
+        }
+
+    // Delete possible plugins
+    if ( iPluginArray )
+        {
+        // Since the plugins are actually avkon views, avkon is responsible
+        // for owning the plugins. This means we do not reset and destroy
+        // the contents of the array in which the plugins reside. We have to
+        // leave it up to avkon to tidy up.
+        delete iPluginArray;
+        }      
+    }
+
+// ---------------------------------------------------------------------------
+// CGSConnSettingsPlugin::NewL()
+// First phase constructor
+// ---------------------------------------------------------------------------
+//
+CGSConnSettingsPlugin* CGSConnSettingsPlugin::NewL( TAny* /*aInitParams*/ )
+    {
+    CGSConnSettingsPlugin* self = new(ELeave) CGSConnSettingsPlugin();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CGSConnSettingsPlugin::ConstructL()
+// Second phase constructor
+// ---------------------------------------------------------------------------
+//
+void CGSConnSettingsPlugin::ConstructL()
+    {
+    // Initialize FeatureManager
+    FeatureManager::InitializeLibL();
+    iIsWlanSupported = FeatureManager::FeatureSupported( KFeatureIdProtocolWlan );
+    // Unload FeatureManager
+    FeatureManager::UnInitializeLib();  
+    
+    OpenLocalizedResourceFileL( KGSConnSettingsPluginResourceFileName,
+                                iResourceLoader ); 
+    BaseConstructL( R_GS_CONN_SETTINGS_PLUGIN_VIEW );
+    }
+
+// ---------------------------------------------------------------------------
+// CGSConnSettingsPlugin::Id()
+// ---------------------------------------------------------------------------
+//
+TUid CGSConnSettingsPlugin::Id() const
+    {
+    return KGSConnSettingsPluginUid;
+    }
+
+
+
+// ----------------------------------------------------------------------------
+// CGSConnSettingsPlugin::NewContainerL()
+// Creates new iContainer.
+//
+// ----------------------------------------------------------------------------
+//
+void CGSConnSettingsPlugin::NewContainerL()
+    {
+    iContainer = new( ELeave ) CGSConnSettingsPluginContainer( *this );
+    
+    //Check if ECOM plugins are already loaded
+    if ( iPluginArray == NULL )
+        {
+        //Load plugins here after container is constructed. This saves memory when Connectivity Settings view
+        //is not visible(object from CGSConnSettingsPlugin is constructed already in Connectivity view by GS and
+        //container class only when the plugin is actually accessed) 
+
+        iPluginArray = new  ( ELeave ) CArrayPtrFlat<CGSPluginInterface>( KGConnSettingsPluginCount );
+        iPluginLoader = CGSPluginLoader::NewL( iAppUi );
+        iPluginLoader->SetObserver( this );
+        iPluginLoader->LoadAsyncL( KGSPluginInterfaceUid, Id(), iPluginArray ); 
+        }
+    
+    Container()->SetPluginArray( iPluginArray );
+    }
+
+// ---------------------------------------------------------------------------
+// CGSConnSettingsPlugin::DoActivateL()
+//
+//
+// ---------------------------------------------------------------------------
+//
+void CGSConnSettingsPlugin::DoActivateL( const TVwsViewId& aPrevViewId,
+                                    TUid aCustomMessageId,
+                                    const TDesC8& aCustomMessage )
+    {
+    CGSBaseView::DoActivateL( aPrevViewId, aCustomMessageId, aCustomMessage );
+
+    // Add support for external view activation    
+    if ( iPrevViewId.iAppUid != KUidGS || iPrevViewId.iViewUid == TUid::Uid(0x0DEADBED) )
+      {
+      CEikButtonGroupContainer* cbaGroup = Cba();
+      if(cbaGroup)
+        {
+        HBufC* rightSKText = StringLoader::LoadLC (R_GS_CONN_SETTINGS_RSK_LABEL_EXIT);
+        TPtr rskPtr = rightSKText->Des();
+        cbaGroup->SetCommandL(2,EAknSoftkeyExit,*rightSKText);
+        CleanupStack::PopAndDestroy(rightSKText);
+        }
+      }    
+    iModel = Container()->Model();
+    }
+
+// ---------------------------------------------------------------------------
+// CGSConnSettingsPlugin::DoDeactivate()
+//
+//
+// ---------------------------------------------------------------------------
+//
+void CGSConnSettingsPlugin::DoDeactivate()
+    {
+    //Save current settings when we leave the view
+    //If function leaves it is trapped and ignored as there is nothing that we can do about it
+    if ( iModel )
+        {
+        TRAP_IGNORE(iModel->SaveSettingsL());
+        }    
+    CGSBaseView::DoDeactivate();
+    }
+
+// ----------------------------------------------------------------------------
+// CGSConnSettingsPlugin::HandleCommandL
+//
+// Handles menu commands directed to this class.
+// ----------------------------------------------------------------------------
+void CGSConnSettingsPlugin::HandleCommandL( TInt aCommand )
+    {
+    switch ( aCommand )
+        {
+        case EGSConnSettMenuOpen:
+        case EGSConnSettMenuChange:
+        case EGSConnSettMskGeneral:
+            HandleListBoxSelectionL();
+            break;
+            
+        case EAknSoftkeyBack:
+            iAppUi->ActivateLocalViewL( KGSConPluginUid );
+            break;
+            
+        case EAknCmdHelp:
+            {
+            if( FeatureManager::FeatureSupported( KFeatureIdHelp ) )
+                {
+                HlpLauncher::LaunchHelpApplicationL(
+                    iEikonEnv->WsSession(), iAppUi->AppHelpContextL() );
+                }
+            break;
+            }
+        default:
+            iAppUi->HandleCommandL( aCommand );
+            break;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CGSSensorPlugin::DynInitMenuPaneL
+// -----------------------------------------------------------------------------
+//
+void CGSConnSettingsPlugin::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
+    {
+    // Check resource
+    if ( R_GS_CONN_SETTINGS_MENU_ITEM_OPEN == aResourceId )
+        {
+        // First, resolve current item in listbox
+        const TInt currentItem = Container()->CurrentFeatureId();
+
+        switch (currentItem)
+            {
+            case EGSSettIdUsageOfWlan:
+            case EGSSettIdDataUsageAbroad:
+            case EGSSettIdDataUsageHomeNw:
+                // Hide menu item 'Open'
+                aMenuPane->SetItemDimmed( EGSConnSettMenuOpen, ETrue );
+                aMenuPane->SetItemDimmed( EGSConnSettMenuChange, EFalse );
+            break;
+            
+            default:
+                {
+                // Hide menu item 'Change' if current item is ECOM plugin
+                aMenuPane->SetItemDimmed( EGSConnSettMenuOpen, EFalse );
+                aMenuPane->SetItemDimmed( EGSConnSettMenuChange, ETrue );
+                break;
+                }
+            }
+        }
+    // Forward to base class
+    CGSBaseView::DynInitMenuPaneL( aResourceId, aMenuPane );
+    }
+
+
+// ----------------------------------------------------------------------------
+// CGSConnSettingsPlugin::HandleListBoxSelectionL()
+//
+// Handles events raised through a rocker key
+// ----------------------------------------------------------------------------
+void CGSConnSettingsPlugin::HandleListBoxSelectionL()
+    {
+    const TInt currentFeatureId = Container()->CurrentFeatureId();
+        
+    switch ( currentFeatureId )
+        {
+        case EGSSettIdUsageOfWlan:
+            ShowUsageOfWlanSettingPageL();
+            break;
+            
+        case EGSSettIdDataUsageAbroad:
+            ShowDataUsageAbroadSettingPageL();
+            break;
+            
+        case EGSSettIdDataUsageHomeNw:
+            ShowDataUsageInHomeNwSettingPageL();
+            break;
+            
+        default:
+            {
+            //Feature ID didn't match, try plugins
+            CGSPluginInterface* selectedPlugin( Container()->SelectedPluginL() );
+
+            switch( selectedPlugin->ItemType() )
+                {
+                // In these cases the plugin is a view:
+                case EGSItemTypeSingleLarge:
+                case EGSItemTypeSetting:
+                case EGSItemTypeSettingIcon:
+                    {
+                    CleanupStack::PushL( selectedPlugin );
+                    iAppUi->ActivateLocalViewL( selectedPlugin->Id() );
+                    CleanupStack::Pop( selectedPlugin );
+                    break;
+                    }
+                    
+                // In these cases the plugin is a dialog:
+                case EGSItemTypeSettingDialog:
+                case EGSItemTypeSingleLargeDialog:
+                     selectedPlugin->HandleSelection( EGSSelectionByMenu );
+                     break;
+                default:
+                    break;
+                }
+            break;
+            }        
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CGSConnSettingsPlugin::UpdateListBoxL
+//
+//
+// ----------------------------------------------------------------------------
+//
+void CGSConnSettingsPlugin::UpdateListBoxL( TInt aItemId )
+    {
+    if( Container() )
+        {
+        Container()->UpdateListBoxL( aItemId );
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CGSConnSettingsPlugin::Container
+//
+// Return handle to container class.
+// ----------------------------------------------------------------------------
+//
+CGSConnSettingsPluginContainer* CGSConnSettingsPlugin::Container()
+    {
+    return static_cast<CGSConnSettingsPluginContainer*>( iContainer );
+    }
+
+// ---------------------------------------------------------------------------
+// CGSConnSettingsPlugin::UpperLevelViewUid()
+//
+//
+// ---------------------------------------------------------------------------
+//
+TUid CGSConnSettingsPlugin::UpperLevelViewUid()
+    {
+    return KGSConPluginUid;
+    }
+
+// -----------------------------------------------------------------------------
+// CGSConnSettingsPlugin::GetHelpContext()
+//
+//
+// -----------------------------------------------------------------------------
+//
+void CGSConnSettingsPlugin::GetHelpContext( TCoeHelpContext& aContext )
+    {
+    aContext.iMajor = KUidGS;
+    aContext.iContext = KCP_HLP_ADMINISTRATIVE_SETTINGS;
+    }
+
+// ---------------------------------------------------------------------------
+// CGSConnSettingsPlugin::GetCaptionL()
+//
+//
+// ---------------------------------------------------------------------------
+//
+void CGSConnSettingsPlugin::GetCaptionL( TDes& aCaption ) const
+    {
+    // The resource file is already opened by iResourceLoader.
+    HBufC* result = StringLoader::LoadL( R_GS_CONN_SETTINGS_VIEW_CAPTION );
+    aCaption.Copy( *result );
+    delete result;
+    }
+
+// ---------------------------------------------------------------------------
+// CGSConnSettingsPlugin::CreateIconL
+//
+// Return the icon, if has one.
+// ---------------------------------------------------------------------------
+//
+CGulIcon* CGSConnSettingsPlugin::CreateIconL( const TUid aIconType )
+    {
+
+    //EMbm<Mbm_file_name><Bitmap_name>
+    CGulIcon* icon;
+    TParse* fp = new( ELeave ) TParse();
+    CleanupStack::PushL( fp );
+    fp->Set( KGSConnSettingsPluginIconDirAndName, &KDC_BITMAP_DIR, NULL );
+
+    if( aIconType == KGSIconTypeLbxItem )
+        {
+        icon = AknsUtils::CreateGulIconL(
+        AknsUtils::SkinInstance(),
+        KAknsIIDQgnPropCpConnAdmin,
+        fp->FullName(),
+// Let's use Connectivity plugin icon until we get graphics
+// for Connectivity Settings plugin icon
+//      EMbmGsconnsettingspluginQgn_prop_cp_conn_settings,
+//      EMbmGsconnsettingspluginQgn_prop_cp_conn_settings_mask );
+        EMbmGsconnsettingspluginQgn_prop_cp_conn, //from generated \epoc32\include\gsconnsettingsplugin.mbg
+        EMbmGsconnsettingspluginQgn_prop_cp_conn_mask ); //from generated \epoc32\include\gsconnsettingsplugin.mbg
+        }
+       else
+           {
+           icon = CGSPluginInterface::CreateIconL( aIconType );
+           }
+    CleanupStack::PopAndDestroy( fp );
+    return icon;
+    }
+
+// ---------------------------------------------------------------------------
+// CGSConnSettingsPlugin::PluginProviderCategory()
+//
+//
+// ---------------------------------------------------------------------------
+//
+TInt CGSConnSettingsPlugin::PluginProviderCategory() const
+    {
+    return KGSPluginProviderInternal;
+    }
+
+// ---------------------------------------------------------------------------
+// CGSConnSettingsPlugin::ShowUsageOfNewWlanSettingPageL()
+//
+// 
+// ---------------------------------------------------------------------------
+//
+void CGSConnSettingsPlugin::ShowUsageOfWlanSettingPageL()
+    {
+
+    CDesCArrayFlat* items = iCoeEnv->ReadDesC16ArrayResourceL(
+            R_USAGE_OF_WLAN_SETTING_PAGE_LBX );
+    CleanupStack::PushL( items );
+
+    TInt currentItem = iModel->UsageOfWlan();
+    TInt oldItem = currentItem;
+    
+    CGSConnSettingsSelectionDlg* dlg = CGSConnSettingsSelectionDlg::NewL(
+                                                R_USAGE_OF_WLAN_SETTING_PAGE,
+                                                currentItem,
+                                                items,
+                                                R_USAGE_OF_WLAN_INFO_POPUP_TEXTS );
+
+    if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )
+        {
+
+        if( currentItem != oldItem )
+            {
+            iModel->SetUsageOfWlan( currentItem );
+            UpdateListBoxL( EGSSettIdUsageOfWlan );
+            }
+        }
+
+    CleanupStack::PopAndDestroy( items );
+
+    }
+
+// ---------------------------------------------------------------------------
+// CGSConnSettingsPlugin::ShowDataUsageAbroadSettingPageL()
+//
+// 
+// ---------------------------------------------------------------------------
+//
+void CGSConnSettingsPlugin::ShowDataUsageAbroadSettingPageL()
+    {
+    CDesCArrayFlat* items;
+    
+    if ( iIsWlanSupported )
+        {
+        items = iCoeEnv->ReadDesC16ArrayResourceL(
+                R_DATA_USAGE_ABROAD_SETTING_PAGE_LBX );
+        }
+    else
+        {
+        items = iCoeEnv->ReadDesC16ArrayResourceL(
+                R_DATA_USAGE_ABROAD_SETTING_PAGE_LBX_NOWLAN );        
+        }
+    
+    CleanupStack::PushL( items );
+
+    TInt currentItem = iModel->DataUsageAbroad();
+    TInt oldItem = currentItem;
+
+    CAknSettingPage* dlg = new( ELeave ) CAknRadioButtonSettingPage(
+            R_DATA_USAGE_ABROAD_SETTING_PAGE, currentItem, items );
+
+    if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )
+        {
+
+        if( currentItem != oldItem )
+            {
+            iModel->SetDataUsageAbroad( currentItem );
+            UpdateListBoxL( EGSSettIdDataUsageAbroad );
+            }
+        }
+    CleanupStack::PopAndDestroy( items );
+    }
+
+// ---------------------------------------------------------------------------
+// CGSConnSettingsPlugin::ShowDataUsageInHomeNwSettingPageL()
+//
+// 
+// ---------------------------------------------------------------------------
+//
+void CGSConnSettingsPlugin::ShowDataUsageInHomeNwSettingPageL()
+    {
+    CDesCArrayFlat* items;
+    
+    if ( iIsWlanSupported )
+        {
+        items = iCoeEnv->ReadDesC16ArrayResourceL(
+            R_DATA_USAGE_HOME_NW_SETTING_PAGE_LBX );
+        }
+    else
+        {
+        items = iCoeEnv->ReadDesC16ArrayResourceL(
+            R_DATA_USAGE_HOME_NW_SETTING_PAGE_LBX_NOWLAN );        
+        }
+    
+    CleanupStack::PushL( items );
+
+    TInt currentItem = iModel->DataUsageInHomeNw();
+    TInt oldItem = currentItem;
+
+    CAknSettingPage* dlg = new( ELeave ) CAknRadioButtonSettingPage(
+            R_DATA_USAGE_HOME_NW_SETTING_PAGE, currentItem, items );
+
+    if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )
+        {
+
+        if( currentItem != oldItem )
+            {
+            iModel->SetDataUsageInHomeNw( currentItem );
+            UpdateListBoxL(  EGSSettIdDataUsageHomeNw );
+            }
+        }
+    CleanupStack::PopAndDestroy( items );
+    }
+
+// ---------------------------------------------------------------------------
+// CGSConnSettingsPlugin::CheckMiddleSoftkeyLabelL
+// ---------------------------------------------------------------------------
+//
+void CGSConnSettingsPlugin::CheckMiddleSoftkeyLabelL() 
+    {
+    //Resolve current item
+    const TInt currentItem = Container()->CurrentFeatureId();
+
+    //remove current middle soft key label
+    RemoveCommandFromMSK();
+
+    switch (currentItem)
+        {
+        case EGSSettIdUsageOfWlan:
+        case EGSSettIdDataUsageAbroad:
+        case EGSSettIdDataUsageHomeNw:
+            //Set middle soft key label to "Change"
+            SetMiddleSoftKeyLabelL( R_GS_CONN_SETTINGS_MSK_LABEL_CHANGE, EGSConnSettMskGeneral );
+        break;
+        
+        default:
+            {
+            //If current item is ECOM plugin set middle soft key label to "Open"
+            SetMiddleSoftKeyLabelL( R_GS_CONN_SETTINGS_MSK_LABEL_OPEN, EGSConnSettMskGeneral );
+            break;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CGSConnSettingsPlugin::HandleListBoxEventL
+//
+// -----------------------------------------------------------------------------
+//
+void CGSConnSettingsPlugin::HandleListBoxEventL( CEikListBox* /*aListBox*/,
+                                                TListBoxEvent aEventType )
+    {
+    switch ( aEventType )
+        {
+        case EEventEnterKeyPressed:
+        case EEventItemSingleClicked:
+            HandleListBoxSelectionL();
+            break;
+        default:
+           break;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CGSConnSettingsPlugin::RemoveCommandFromMSK
+//
+// -----------------------------------------------------------------------------
+//
+void CGSConnSettingsPlugin::RemoveCommandFromMSK()
+    {
+    CEikButtonGroupContainer* cbaGroup = Cba();
+    if ( cbaGroup )
+        {
+        // Remove command from stack
+        cbaGroup->RemoveCommandFromStack( KGSConnSettingsMSKControlID, EGSConnSettMskGeneral );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CGSConnSettingsPlugin::SetMiddleSoftKeyLabelL 
+// Sets middle softkey label.
+// ---------------------------------------------------------------------------
+//
+void CGSConnSettingsPlugin::SetMiddleSoftKeyLabelL( 
+    const TInt aResourceId, const TInt aCommandId )
+    {
+    CEikButtonGroupContainer* cbaGroup = Cba();
+    if ( cbaGroup )
+        {
+        HBufC* middleSKText = StringLoader::LoadLC( aResourceId );
+        TPtr mskPtr = middleSKText->Des();
+        cbaGroup->AddCommandToStackL( 
+                KGSConnSettingsMSKControlID, 
+            aCommandId, 
+            mskPtr );
+        CleanupStack::Pop( middleSKText );
+        delete middleSKText;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CGSConnSettingsPlugin::HandlePluginLoaded
+// Called by GSPluginLoader when plugins are loaded or error occured during that
+// ---------------------------------------------------------------------------
+//
+void CGSConnSettingsPlugin::HandlePluginLoaded( KGSPluginLoaderStatus aStatus )
+    {
+    if ( iContainer && MGSPluginLoadObserver::EGSFinished == aStatus )
+        {
+        #ifdef __DEBUG
+        TRAPD( ignore, Container()->UpdateListBoxL( EGSExtPluginsListItemId ); );
+        TRACE_1( "[GSSensorPlugin] CGSSensorPlugin::HandlePluginLoaded() - Error: %i", ignore );
+        #else
+        TRAP_IGNORE( Container()->UpdateListBoxL( EGSExtPluginsListItemId ); );
+        #endif // __DEBUG
+        }
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/gsconnsettingsplugin/src/gsconnsettingsplugincontainer.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,479 @@
+/*
+* 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:  Container for the Connectivity Settings plugin
+*
+*/
+
+// INCLUDE FILES
+#include <featmgr.h>
+#include "gsconnsettingsplugincontainer.h"
+#include "gsconnsettingspluginmodel.h"
+#include "gsconnsettingsplugin.h"
+#include "gsconnsettingsplugin.hrh"
+#include "gsconnsettingsmskobserver.h"
+#include <gsconnsettingspluginrsc.rsg>
+
+#include <aknlists.h>
+#include <csxhelp/cp.hlp.hrh>
+#include <GSFWViewUIDs.h>     // for KUidGS
+#include <GSListbox.h>
+
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+const   TInt    KGSBufSize128 = 128;
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================= LOCAL FUNCTIONS ==============================
+
+// ========================== MEMBER FUNCTIONS ================================
+
+// ---------------------------------------------------------------------------
+// CGSDisplayPluginContainer::ConstructL(const TRect& aRect)
+// Symbian OS two phased constructor
+//
+// ---------------------------------------------------------------------------
+//
+void CGSConnSettingsPluginContainer::ConstructL( const TRect& aRect )
+    {
+    iListBox = new ( ELeave ) CAknSettingStyleListBox;
+    iModel = CGSConnSettingsPluginModel::NewL();
+    iModel->SetOwner( this );
+    
+    //Load saved settings from Connection Settings API
+    //If function leaves it is trapped and ignored as there is nothing that we can do about it
+    TRAP_IGNORE(iModel->LoadSettingsL());
+
+    if ( iIsWlanSupported )
+        {
+        BaseConstructL( aRect, R_GS_CONN_SETTINGS_PLUGIN_VIEW_TITLE, R_CONN_SETTINGS_LBX );
+        }
+    else
+        {
+        BaseConstructL( aRect, R_GS_CONN_SETTINGS_PLUGIN_VIEW_TITLE, R_CONN_SETTINGS_LBX_NOWLAN );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// GSConnSettingsPluginContainer::~GSConnSettingsPluginContainer()
+//
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CGSConnSettingsPluginContainer::~CGSConnSettingsPluginContainer()
+    {    
+    //Note: iListbox is not deleted here as base class destructor handels it
+    
+    if ( iModel )
+        {        
+        delete iModel;
+        iModel = NULL;
+        }
+
+    if ( iListboxItemArray )
+        {
+        delete iListboxItemArray;
+        }
+    
+    if ( iListBoxTextArray )
+       {
+       iListBoxTextArray->Reset();
+       delete iListBoxTextArray;
+       }
+    
+    if ( iIsWlanSupported )
+        {
+        if ( iUsageOfWlanItems )
+            {
+            iUsageOfWlanItems->Reset();
+            delete iUsageOfWlanItems;
+            }
+        }
+
+    if ( iDataUsageAbroadItems )
+        {
+        iDataUsageAbroadItems->Reset();
+        delete iDataUsageAbroadItems;
+        }
+
+    if ( iDataUsageHomeNwItems )
+        {
+        iDataUsageHomeNwItems->Reset();
+        delete iDataUsageHomeNwItems;
+        }    
+
+    if ( iListItems )
+        {
+        iListItems->Reset();
+        delete iListItems;
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// GSConnSettingsPluginContainer::GSConnSettingsPluginContainer()
+//
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CGSConnSettingsPluginContainer::CGSConnSettingsPluginContainer( 
+        MGSConnSettingsMskObserver& aMskObserver )
+        : iMskObserver( aMskObserver )
+    {
+    iIsWlanSupported = FeatureManager::FeatureSupported( KFeatureIdProtocolWlan );
+    }
+
+void CGSConnSettingsPluginContainer::SetPluginArray ( 
+                                CArrayPtrFlat<CGSPluginInterface>* aPluginArray )
+{
+    iPluginArray = aPluginArray;
+}
+
+
+// ---------------------------------------------------------------------------
+// GSConnSettingsPluginContainer::ConstructListBoxL()
+// 
+//
+// ---------------------------------------------------------------------------
+//
+void CGSConnSettingsPluginContainer::ConstructListBoxL( TInt aResLbxId )
+    {
+    iListBox->ConstructL( this, EAknListBoxSelectionList );
+    iListboxItemArray = CGSListBoxItemTextArray::NewL( aResLbxId, *iListBox, *iCoeEnv );
+    iListBoxTextArray = static_cast<CDesCArray*>( iListBox->Model()->ItemTextArray() );
+    iListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
+    
+    if ( iIsWlanSupported )
+        {
+        iUsageOfWlanItems = iCoeEnv->ReadDesC16ArrayResourceL(
+                R_USAGE_OF_WLAN_SETTING_PAGE_LBX );
+
+        iDataUsageHomeNwItems = iCoeEnv->ReadDesC16ArrayResourceL( 
+                R_DATA_USAGE_HOME_NW_SETTING_PAGE_LBX );
+    
+        iDataUsageAbroadItems = iCoeEnv->ReadDesC16ArrayResourceL( 
+                R_DATA_USAGE_ABROAD_SETTING_PAGE_LBX );
+        
+        iListItems = iCoeEnv->ReadDesC16ArrayResourceL( R_CONN_SETTINGS_LBX_TXT );
+        }
+    else
+        {
+        iDataUsageHomeNwItems = iCoeEnv->ReadDesC16ArrayResourceL( 
+                R_DATA_USAGE_HOME_NW_SETTING_PAGE_LBX_NOWLAN );
+    
+        iDataUsageAbroadItems = iCoeEnv->ReadDesC16ArrayResourceL( 
+                R_DATA_USAGE_ABROAD_SETTING_PAGE_LBX_NOWLAN );
+        
+        iListItems = iCoeEnv->ReadDesC16ArrayResourceL( R_CONN_SETTINGS_LBX_TXT_NOWLAN );
+        }
+        
+    CreateListBoxItemsL();
+    }
+
+// ---------------------------------------------------------------------------
+// GSConnSettingsPluginContainer::CreateListBoxItemsL()
+//
+//
+// ---------------------------------------------------------------------------
+//
+void CGSConnSettingsPluginContainer::CreateListBoxItemsL()
+    {   
+    if ( iIsWlanSupported )
+        {
+        MakeUsageOfWlanNetworksItemL();
+        iGeneralItemCount++;
+        }
+
+    MakeDataUsageHomeNwItemL();
+    iGeneralItemCount++;
+
+    MakeDataUsageAbroadItemL();
+    iGeneralItemCount++;
+
+    if ( iPluginArray )
+        {
+        MakeECOMPluginItemL();
+        }
+    iListBox->HandleItemAdditionL();
+    }
+
+// ---------------------------------------------------------------------------
+// GSConnSettingsPluginContainer::UpdateListBoxL(TInt aFeatureId)
+// ---------------------------------------------------------------------------
+//
+void CGSConnSettingsPluginContainer::UpdateListBoxL( TInt aFeatureId )
+    {
+    switch ( aFeatureId )
+        {
+        case  EGSSettIdUsageOfWlan:
+            iListBoxTextArray->Delete( EGSSettIdUsageOfWlan );
+            MakeUsageOfWlanNetworksItemL();
+            break;
+
+        case EGSSettIdDataUsageHomeNw:
+            iListBoxTextArray->Delete( Index( EGSSettIdDataUsageHomeNw ) );
+            MakeDataUsageHomeNwItemL();
+            break;
+            
+        case EGSSettIdDataUsageAbroad:
+            iListBoxTextArray->Delete( Index ( EGSSettIdDataUsageAbroad ) );
+            MakeDataUsageAbroadItemL();
+            break;
+
+        case EGSExtPluginsListItemId:
+            MakeECOMPluginItemL();
+            break;     
+                        
+        default:
+            break;
+        }
+    iListBox->HandleItemAdditionL();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CGSConnSettingsPluginContainer::AppendListItem
+// ---------------------------------------------------------------------------
+//
+void CGSConnSettingsPluginContainer::AppendListItemL( 
+    const TInt aPos,
+    const TDesC16& aFirstLabel, 
+    const TDesC16& aSecondLabel )
+    {
+    TBuf<KGSBufSize128> itemText;
+    _LIT( KSpaceAndTab, " \t" );
+    _LIT( KTab, "\t" );
+
+    // The format is: " \tFirstLabel\tSecondLabel\t0\t0"
+    // First, append space and tab
+    itemText.Append( KSpaceAndTab );
+    itemText.Append( aFirstLabel );
+    itemText.Append( KTab );
+    itemText.Append( KTab );
+    // Currently this is used only to show sensors active status (on/off)
+    itemText.Append( aSecondLabel ); 
+
+    // No need to add last tabs
+    if ( ( KErrNotFound != aPos ) && ( aPos <= iListBoxTextArray->Count() ) )
+        {
+        iListBoxTextArray->InsertL( aPos, itemText );
+        }
+    else
+        {
+        iListBoxTextArray->AppendL( itemText );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// GSConnSettingsPluginContainer::MakeUsageOfNewWlanNetworksItemL()
+//
+// 
+// ---------------------------------------------------------------------------
+//
+void CGSConnSettingsPluginContainer::MakeUsageOfWlanNetworksItemL()
+    {
+    TInt currValue = iModel->UsageOfWlan();
+    AppendListItemL( EGSSettIdUsageOfWlan, 
+        iListItems->operator[]( EGSSettIdUsageOfWlan ), 
+        ( *iUsageOfWlanItems )[currValue] );
+    }
+
+// ---------------------------------------------------------------------------
+// GSConnSettingsPluginContainer::MakeDataUsageAbroadItemL()
+//
+// 
+// ---------------------------------------------------------------------------
+//
+void CGSConnSettingsPluginContainer::MakeDataUsageAbroadItemL()
+{
+    TInt currValue = iModel->DataUsageAbroad();
+    
+    AppendListItemL( Index( EGSSettIdDataUsageAbroad ),
+        iListItems->operator[]( Index( EGSSettIdDataUsageAbroad ) ),
+        ( *iDataUsageAbroadItems )[currValue] );
+}
+            
+// ---------------------------------------------------------------------------
+// GSConnSettingsPluginContainer::MakeDataUsageAbroadItemL()
+//
+// 
+// ---------------------------------------------------------------------------
+//
+void CGSConnSettingsPluginContainer::MakeDataUsageHomeNwItemL()
+{
+    TInt currValue = iModel->DataUsageInHomeNw();
+    
+    AppendListItemL( Index( EGSSettIdDataUsageHomeNw ),
+        iListItems->operator[]( Index( EGSSettIdDataUsageHomeNw ) ),
+        ( *iDataUsageHomeNwItems )[currValue] );
+}
+
+
+// ---------------------------------------------------------------------------
+// CGSConnSettingsPluginContainer::MakeExtendedPluginsItemL
+// ---------------------------------------------------------------------------
+//
+void CGSConnSettingsPluginContainer::MakeECOMPluginItemL()
+    {
+
+    // Create list item for all child plug-ins
+    const TInt pluginCount( iPluginArray->Count() );
+    CGSPluginInterface* plugin = NULL;
+
+    // 1) Read item descriptor from plugin:
+    TBuf<KGSBufSize128> caption;
+
+    for ( TInt i = 0; i < pluginCount; i++ )
+        {
+        plugin = iPluginArray->operator[]( i );
+        //Append to list only if plugin is meant to be visible
+        if( ( plugin ) && ( plugin->Visible() ) )
+            {
+            plugin->GetCaptionL( caption );
+
+            // Append text to list
+            AppendListItemL( KErrNotFound, caption, KNullDesC16 );
+            }
+        }        
+    }
+    
+ 
+// -----------------------------------------------------------------------------
+// CGSConnSettingsPluginContainer::SelectedPlugin
+// Returns pointer to selected plugin
+// -----------------------------------------------------------------------------
+//
+CGSPluginInterface* CGSConnSettingsPluginContainer::SelectedPluginL()
+    {
+    CGSPluginInterface* plugin = NULL;
+
+    // 1) Decrease index with the count
+    TInt index = iListBox->CurrentItemIndex() - iGeneralItemCount;
+    
+    // 2) Check that new index is in range of plugins
+    if ( index >= 0 && index < iPluginArray->Count() )
+        {
+        // 3) Get correct plugin
+        plugin = iPluginArray->operator[]( index );
+        }
+
+    // Leave if not found
+    if ( !plugin )
+        {
+        User::Leave( KErrNotFound );
+        }
+
+    return plugin;
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// CGSConnSettingsPluginContainer::OfferKeyEventL
+// ---------------------------------------------------------------------------
+//
+TKeyResponse CGSConnSettingsPluginContainer::OfferKeyEventL( 
+    const TKeyEvent& aKeyEvent, TEventCode aType )
+    {
+
+    TKeyResponse returnValue( EKeyWasNotConsumed );
+
+    switch ( aKeyEvent.iCode )
+        {
+        case EKeyUpArrow:
+        case EKeyDownArrow:
+            {
+            // Send key event to Listbox
+            returnValue = iListBox->OfferKeyEventL( aKeyEvent, aType );
+            // Change MSK label if needs to changed
+            iMskObserver.CheckMiddleSoftkeyLabelL();
+            break;
+            }
+        case EKeyLeftArrow:
+        case EKeyRightArrow:
+            {
+            // Listbox takes all events even if it doesn't use them.
+            // Stick with the default return value
+            break;
+            }
+        default:
+            {
+            // Forward key event to listbox
+            returnValue = iListBox->OfferKeyEventL( aKeyEvent, aType );
+            break;
+            }
+        }
+
+    return returnValue;
+    }
+
+// ---------------------------------------------------------------------------
+// GSConnSettingsPluginContainer::CurrentFeatureId()
+//
+// ---------------------------------------------------------------------------
+//
+TInt CGSConnSettingsPluginContainer::CurrentFeatureId( ) const
+    {
+    return iListboxItemArray->CurrentFeature( );
+    }
+
+// ---------------------------------------------------------------------------
+// GSConnSettingsPluginContainer::GetHelpContext() const
+// Gets Help
+//
+// ---------------------------------------------------------------------------
+//
+void CGSConnSettingsPluginContainer::GetHelpContext( TCoeHelpContext& aContext ) const
+    {
+    aContext.iMajor = KUidGS;
+//    aContext.iContext = KCP_HLP_DISPLAY;
+    }
+
+// ---------------------------------------------------------------------------
+// GSConnSettingsPluginContainer::Model()
+//
+// Return its member variable iModel.
+// ---------------------------------------------------------------------------
+//
+CGSConnSettingsPluginModel* CGSConnSettingsPluginContainer::Model()
+    {
+    return iModel;
+    }
+
+// ---------------------------------------------------------------------------
+// GSConnSettingsPluginContainer::Index()
+//
+// Return index for the list.
+// ---------------------------------------------------------------------------
+//
+TInt CGSConnSettingsPluginContainer::Index( TInt aIndex )
+    {
+    return ( iIsWlanSupported ? ( aIndex ) : ( aIndex - 1) );
+    }
+    
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/gsconnsettingsplugin/src/gsconnsettingspluginimpltable.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,47 @@
+/*
+* 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:    ECOM proxy table for plugin.
+*
+*/
+
+// System includes
+#include <e32std.h>
+#include <implementationproxy.h>
+
+// User includes
+#include "gsconnsettingsplugin.h"
+
+// Constants
+const TImplementationProxy KGSConnSettingsPluginImplTable[] = 
+	{
+	IMPLEMENTATION_PROXY_ENTRY( 0x200255B9, CGSConnSettingsPlugin::NewL )
+	};
+
+
+// ---------------------------------------------------------------------------
+// ImplementationGroupProxy
+// Gate/factory function
+//
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( 
+    TInt& aTableCount )
+	{
+	aTableCount = sizeof( KGSConnSettingsPluginImplTable ) 
+        / sizeof( TImplementationProxy );
+	return KGSConnSettingsPluginImplTable;
+	}
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/gsconnsettingsplugin/src/gsconnsettingspluginmodel.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,324 @@
+/*
+* Copyright (c) 2005-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:  Connectivity Settings Plugin model implementation.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "gsconnsettingsplugincontainer.h"
+#include "gsconnsettingspluginmodel.h"
+#include "cmmanager.h"
+#include "gsconnsettingsplugin.hrh"
+
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "gsconnsettingspluginmodelTraces.h"
+#endif
+
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================= LOCAL FUNCTIONS ==============================
+
+// ========================= MEMBER FUNCTIONS =================================
+
+
+// ----------------------------------------------------------------------------
+// CGSDisplayPluginModel::NewL
+//
+// Symbian OS two-phased constructor
+// ----------------------------------------------------------------------------
+//
+CGSConnSettingsPluginModel* CGSConnSettingsPluginModel::NewL()
+    {
+    CGSConnSettingsPluginModel* self = new( ELeave ) CGSConnSettingsPluginModel;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ----------------------------------------------------------------------------
+// CGSConnSettingsPluginModel::CGSConnSettingsPluginModel
+//
+//
+// C++ default constructor can NOT contain any code, that might leave.
+// ----------------------------------------------------------------------------
+//
+CGSConnSettingsPluginModel::CGSConnSettingsPluginModel()
+    {
+    }
+
+
+// ----------------------------------------------------------------------------
+// CGSConnSettingsPluginModel::ConstructL
+//
+// EPOC default constructor can leave.
+// ----------------------------------------------------------------------------
+//
+void CGSConnSettingsPluginModel::ConstructL()
+    {
+    }
+
+
+// ----------------------------------------------------------------------------
+// CGSConnSettingsPluginModel::~CGSConnSettingsPluginModel
+//
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CGSConnSettingsPluginModel::~CGSConnSettingsPluginModel()
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// CGSConnSettingsPluginModel::LoadSettings
+//
+// Loads settings by using CMManager's general connection settings API
+// ----------------------------------------------------------------------------
+//
+void CGSConnSettingsPluginModel::LoadSettingsL()
+    {
+    RCmManager CmManager;
+    CmManager.CreateTablesAndOpenL();
+    CleanupClosePushL(CmManager); 
+    CmManager.ReadGenConnSettingsL( iSettings );
+    CleanupStack::PopAndDestroy( 1 );     //CmManager
+
+    //Print out loaded settings
+    OstTrace1( TRACE_NORMAL, CSP_LOADSETTINGSL_USAGE_OF_NEW_WLAN_PARAM_TRACE, "iSettings.iUsageOfWlan=%d", iSettings.iUsageOfWlan );
+    OstTrace1( TRACE_NORMAL, CSP_LOADSETTINGSL_SEAMLESSNESS_VISITOR_PARAM_TRACE, "iSeamlessnessVisitor=%d", iSettings.iSeamlessnessVisitor );
+    OstTrace1( TRACE_NORMAL, CSP_LOADSETTINGSL_SEAMLESSNESS_HOME_PARAM_TRACE, "iSettings.iSeamlessnessHome=%d", iSettings.iSeamlessnessHome );
+    }
+
+// ----------------------------------------------------------------------------
+// CGSConnSettingsPluginModel::SaveSettingsL
+//
+// Saves settings by using CMManager's general connection settings API
+// ----------------------------------------------------------------------------
+//
+void CGSConnSettingsPluginModel::SaveSettingsL()
+    {
+    RCmManager CmManager;
+    CmManager.CreateTablesAndOpenL();
+    CleanupClosePushL(CmManager); 
+    CmManager.WriteGenConnSettingsL( iSettings );
+    CleanupStack::PopAndDestroy( 1 );     //CmManager
+
+    //Print out saved settings
+    OstTrace1( TRACE_NORMAL, CSP_SAVESETTINGSL_USAGE_OF_NEW_WLAN_PARAM_TRACE, "iSettings.iUsageOfWlan=%d", iSettings.iUsageOfWlan );
+    OstTrace1( TRACE_NORMAL, CSP_SAVESETTINGSL_SEAMLESSNESS_VISITOR_PARAM_TRACE, "iSeamlessnessVisitor=%d", iSettings.iSeamlessnessVisitor );
+    OstTrace1( TRACE_NORMAL, CSP_SAVESETTINGSL_SEAMLESSNESS_HOME_PARAM_TRACE, "iSettings.iSeamlessnessHome=%d", iSettings.iSeamlessnessHome );
+    }
+
+// ----------------------------------------------------------------------------
+// CGSConnSettingsPluginModel::UsageOfWlan
+//
+// Maps value from general connection settings API to match index in UI
+// ----------------------------------------------------------------------------
+//
+TInt CGSConnSettingsPluginModel::UsageOfWlan()
+    {
+    TInt mappedValue = 0;
+    
+    //Map to correct index    
+    switch ( iSettings.iUsageOfWlan )
+        {
+        case ECmUsageOfWlanKnown: 
+            mappedValue = EUsageOfWlanKnown; //Known
+            break;
+            
+        case ECmUsageOfWlanManual:
+            mappedValue = EUsageOfNewWlanManual; //Manual
+            break;
+                        
+        default:
+            break;
+        }
+    return mappedValue;
+    }
+
+// ----------------------------------------------------------------------------
+// CGSConnSettingsPluginModel::DataUsageAbroad
+//
+// Maps value from general connection settings API to match index in UI
+// ----------------------------------------------------------------------------
+//
+TInt CGSConnSettingsPluginModel::DataUsageAbroad()
+    {   
+    TInt mappedValue = 0;
+
+    //Map to correct index    
+    switch ( iSettings.iSeamlessnessVisitor )
+        {
+        case ECmSeamlessnessShowprogress:
+        case ECmSeamlessnessFullySeamless:
+            mappedValue = EDataUsageAbroadAutomatic; //Automatic
+            break;
+
+        case ECmSeamlessnessConfirmFirst:
+            mappedValue = EDataUsageAbroadConfirm; //Confirm
+            break;
+
+        case ECmSeamlessnessDisabled:
+            mappedValue = EDataUsageAbroadWlanOnly; //Wlan only
+            break;
+
+        default:
+            break;
+        }
+    return mappedValue;
+    }
+
+// ----------------------------------------------------------------------------
+// CGSConnSettingsPluginModel::DataUsageInHomeNw
+//
+// Maps value from general connection settings API to match index in UI
+// ----------------------------------------------------------------------------
+//
+TInt CGSConnSettingsPluginModel::DataUsageInHomeNw()
+    {     
+    TInt mappedValue = 0;
+
+    //Map to correct index    
+    switch ( iSettings.iSeamlessnessHome )
+        {
+        case ECmSeamlessnessShowprogress:
+        case ECmSeamlessnessFullySeamless:
+            mappedValue = EDataUsageHomeNwAutomatic; //Automatic
+            break;
+
+        case ECmSeamlessnessConfirmFirst:
+            mappedValue = EDataUsageHomeNwConfirm; //Confirm
+            break;
+
+        case ECmSeamlessnessDisabled:
+            mappedValue = EDataUsageHomeNwWlanOnly; //Wlan only
+            break;
+
+        default:
+            break;
+        }
+    return mappedValue;
+    }
+
+// ----------------------------------------------------------------------------
+// CGSConnSettingsPluginModel::SetUsageOfNewWlanL
+//
+// Maps UI index to according general connection setting API value
+// ----------------------------------------------------------------------------
+//
+void CGSConnSettingsPluginModel::SetUsageOfWlan( TInt aValue )
+    {    
+    //Map to correct index
+    switch ( aValue )
+        {        
+        case EUsageOfWlanKnown: //Join and inform
+            iSettings.iUsageOfWlan = ECmUsageOfWlanKnown;
+            break;
+            
+        case EUsageOfNewWlanManual: //inform
+            iSettings.iUsageOfWlan = ECmUsageOfWlanManual;
+            break;
+                        
+        default:
+            break;
+        }   
+    }
+
+// ----------------------------------------------------------------------------
+// CGSConnSettingsPluginModel::SetDataUsageAbroadL
+//
+// Maps UI index to according general connection setting API value
+// ----------------------------------------------------------------------------
+//
+void CGSConnSettingsPluginModel::SetDataUsageAbroad( TInt aValue )
+    {
+    switch ( aValue )
+        {
+        case EDataUsageAbroadAutomatic:  //Automatic
+            iSettings.iSeamlessnessVisitor = ECmSeamlessnessShowprogress; 
+            break;
+        case EDataUsageAbroadConfirm: //Confirm
+            iSettings.iSeamlessnessVisitor = ECmSeamlessnessConfirmFirst;
+            break;
+
+        case EDataUsageAbroadWlanOnly: //Wlan only
+            iSettings.iSeamlessnessVisitor = ECmSeamlessnessDisabled;
+            break;
+                        
+        default:
+            break;
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CGSConnSettingsPluginModel::SetDataUsageInHomeNwL
+//
+// Maps UI index to according general connection setting API value
+// ----------------------------------------------------------------------------
+//
+void CGSConnSettingsPluginModel::SetDataUsageInHomeNw( TInt aValue )
+    {
+    switch ( aValue )
+        {
+        case EDataUsageHomeNwAutomatic: //Automatic
+            iSettings.iSeamlessnessHome = ECmSeamlessnessShowprogress; 
+            break;
+
+        case EDataUsageHomeNwConfirm: //Confirm
+            iSettings.iSeamlessnessHome = ECmSeamlessnessConfirmFirst;
+            break;
+
+        case EDataUsageHomeNwWlanOnly: //Wlan only
+            iSettings.iSeamlessnessHome = ECmSeamlessnessDisabled;
+            break;
+                        
+        default:
+            break;
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CGSConnSettingsPluginModel::SetOwner
+//
+// Sets its owner.
+// ----------------------------------------------------------------------------
+//
+void CGSConnSettingsPluginModel::SetOwner( CGSConnSettingsPluginContainer* aContainer)
+    {
+    iContainer = aContainer;
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/gsconnsettingsplugin/src/gsconnsettingsselectiondlg.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,152 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Cpp file for CGSConnSettingsSelectionDlg class.
+*
+*/
+
+// Includes
+#include "gsconnsettingsselectiondlg.h"
+#include <AknInfoPopupNoteController.h>
+#include <StringLoader.h>
+#include <eiklbo.h>
+#include <gulalign.h>
+
+#include <gsconnsettingspluginrsc.rsg>
+
+// Constants
+
+
+// ========================= MEMBER FUNCTIONS ================================
+
+
+// ---------------------------------------------------------------------------
+// CGSConnSettingsSelectionDlg::NewL
+// ---------------------------------------------------------------------------
+//
+CGSConnSettingsSelectionDlg* CGSConnSettingsSelectionDlg::NewL(TInt aResourceID, 
+                TInt& aCurrentSelectionIndex, 
+                const MDesCArray* aItemArray,
+                TInt aPopupResource)
+    {
+    CGSConnSettingsSelectionDlg* self = new( ELeave ) CGSConnSettingsSelectionDlg(
+                                                        aResourceID,
+                                                        aCurrentSelectionIndex,
+                                                        aItemArray,
+                                                        aPopupResource );
+    CleanupStack::PushL( self );
+    self->ConstructL( aPopupResource );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CGSConnSettingsSelectionDlg::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CGSConnSettingsSelectionDlg::ConstructL( TInt aPopupResource)
+    {
+    iPopupController = CAknInfoPopupNoteController::NewL();
+    iPopupItems = iCoeEnv->ReadDesC16ArrayResourceL( aPopupResource );
+//    ShowInfoPopupL();
+    }
+
+// ---------------------------------------------------------------------------
+// CGSConnSettingsSelectionDlg::CGSConnSettingsSelectionDlg
+// ---------------------------------------------------------------------------
+//
+CGSConnSettingsSelectionDlg::CGSConnSettingsSelectionDlg(
+                TInt aResourceID, 
+                TInt& aCurrentSelectionIndex, 
+                const MDesCArray* aItemArray,
+                TInt /* aPopupResource */)
+        :    CAknRadioButtonSettingPage( 
+                aResourceID,
+                aCurrentSelectionIndex,
+                aItemArray )
+    {
+
+    }
+
+// ---------------------------------------------------------------------------
+// CGSConnSettingsSelectionDlg::~CGSConnSettingsSelectionDlg
+// ---------------------------------------------------------------------------
+//
+CGSConnSettingsSelectionDlg::~CGSConnSettingsSelectionDlg()
+    {
+    if ( iPopupController )
+        {
+        delete iPopupController;
+        }
+    
+    if ( iPopupItems )
+        {
+        iPopupItems->Reset();
+        delete iPopupItems;        
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CGSConnSettingsSelectionDlg::OfferKeyEventL
+// ---------------------------------------------------------------------------
+//
+TKeyResponse CGSConnSettingsSelectionDlg::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType)
+    {    
+    TKeyResponse response ( EKeyWasNotConsumed );
+    
+    response =  CAknRadioButtonSettingPage::OfferKeyEventL( aKeyEvent, aType );
+    
+    //EKeyNull enables here launching of popup note immediately when we enter the setting page
+    if ( aKeyEvent.iCode == EKeyNull ||
+         aKeyEvent.iCode == EKeyUpArrow || 
+         aKeyEvent.iCode == EKeyDownArrow )
+        {
+        ShowInfoPopupL();
+        }   
+    return response;
+    }
+
+// ---------------------------------------------------------------------------
+// CGSConnSettingsSelectionDlg::HandleListBoxEventL
+// ---------------------------------------------------------------------------
+//
+void CGSConnSettingsSelectionDlg::HandleListBoxEventL( 
+        CEikListBox* aListBox, 
+        TListBoxEvent aEventType )
+    {
+    if ( aEventType == EEventItemClicked || 
+         aEventType == EEventItemSingleClicked )
+        {
+        ShowInfoPopupL();
+        }
+    CAknRadioButtonSettingPage::HandleListBoxEventL(aListBox, aEventType);
+    }
+
+// ---------------------------------------------------------------------------
+// CGSConnSettingsSelectionDlg::ShowInfoPopupL
+// ---------------------------------------------------------------------------
+//
+void CGSConnSettingsSelectionDlg::ShowInfoPopupL()
+    {
+    TInt currentIndex = this->ListBoxControl()->CurrentItemIndex();
+
+    iPopupController->HideInfoPopupNote();
+
+    iPopupController->SetTextL( (*iPopupItems)[currentIndex] );
+    iPopupController->SetTimeDelayBeforeShow( 500 );
+    iPopupController->SetTimePopupInView( 0 ); //Zero means that popup stays in screen until it is destroyed
+    iPopupController->ShowInfoPopupNote();
+    }
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/gsconnsettingsplugin/traces/OstTraceDefinitions.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,21 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#ifndef __OSTTRACEDEFINITIONS_H__
+#define __OSTTRACEDEFINITIONS_H__
+#include <opensystemtrace.h>
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/gsconnsettingsplugin/traces/gsconnsettingspluginmodelTraces.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,22 @@
+// Created by TraceCompiler1.1.6
+// DO NOT EDIT, CHANGES WILL BE LOST
+
+#ifndef __GSCONNSETTINGSPLUGINMODELTRACES_H__
+#define __GSCONNSETTINGSPLUGINMODELTRACES_H__
+
+#define KOstTraceComponentID 0x200255b8
+
+#define CSP_LOADSETTINGSL_USAGE_OF_NEW_WLAN_PARAM_TRACE 0x30002
+#define CSP_LOADSETTINGSL_FORCED_ROAMING_PARAM_TRACE 0x30003
+#define CSP_LOADSETTINGSL_SEAMLESSNESS_VISITOR_PARAM_TRACE 0x30004
+#define CSP_LOADSETTINGSL_SEAMLESSNESS_HOME_PARAM_TRACE 0x30005
+#define CSP_SAVESETTINGSL_USAGE_OF_NEW_WLAN_PARAM_TRACE 0x30007
+#define CSP_SAVESETTINGSL_FORCED_ROAMING_PARAM_TRACE 0x30008
+#define CSP_SAVESETTINGSL_SEAMLESSNESS_VISITOR_PARAM_TRACE 0x30009
+#define CSP_SAVESETTINGSL_SEAMLESSNESS_HOME_PARAM_TRACE 0x3000a
+
+
+#endif
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorplugin/data/10281BC1.rss	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ECOM plugin resource file for ConnectionMonitorPlugin.
+*
+*/
+
+#include <registryinfo.rh>
+
+RESOURCE REGISTRY_INFO theInfo
+    {
+    dll_uid     = 0x10281BC1;
+    interfaces  =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid   = 0x10207236;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid  = 0x10281BC2;
+                    version_no          = 1;
+                    display_name        = "Connection Monitor Plugin";
+                                                        // Plugin debug name
+                    default_data        = "0x10207250"; // Parent UID
+                    opaque_data         = "70"; // Order number
+                    }
+                };
+            }
+        };
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorplugin/data/connectionmonitorpluginrsc.rss	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,59 @@
+/*
+* 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:  Localization strings for Plugin.
+*
+*/
+
+
+//  RESOURCE IDENTIFIER
+NAME        CMPI // 4 letter ID
+
+// INCLUDES
+#include    <connectionmonitorplugin.loc> // config localized strings
+
+#include    <avkon.loc> // Avkon localized strings
+#include    <avkon.mbg>
+#include    <avkon.rsg>
+#include    <EIKCORE.rsg>
+#include    <uikon.rh>
+
+// CONSTANTS
+
+//  RESOURCE DEFINITIONS
+
+//----------------------------------------------------
+//
+//    Needed or loading the resource fails!
+//
+//----------------------------------------------------
+//
+RESOURCE RSS_SIGNATURE
+    {
+    }
+
+//----------------------------------------------------
+//
+//    r_qtn_cp_folder_connection_management
+//    Connection Monitor Plugin caption.
+//
+//----------------------------------------------------
+//
+RESOURCE TBUF r_qtn_cp_folder_connection_management
+    {
+    buf = qtn_cp_folder_connection_management;
+    }
+    
+RESOURCE TBUF r_qtn_err_os_general { buf = qtn_err_os_general; }
+
+//End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorplugin/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,49 @@
+/*
+* 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:  Information required for building ConnectionMonitorPlugin.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+// export iby files
+../rom/connectionmonitorplugin.iby		CORE_MW_LAYER_IBY_EXPORT_PATH(connectionmonitorplugin.iby)
+../rom/connectionmonitorpluginresources.iby	LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(connectionmonitorpluginresources.iby)
+
+// export localised loc file
+../loc/connectionmonitorplugin.loc	MW_LAYER_LOC_EXPORT_PATH(connectionmonitorplugin.loc)
+
+PRJ_MMPFILES
+
+#ifdef RD_CONTROL_PANEL
+
+    connectionmonitorplugin.mmp
+
+#endif //RD_CONTROL_PANEL
+
+PRJ_EXTENSIONS
+START EXTENSION s60/mifconv
+OPTION TARGETFILE connectionmonitorplugin.mif
+OPTION HEADERFILE connectionmonitorplugin.mbg
+OPTION SOURCES -c8,8 qgn_prop_cp_conn_man.bmp
+END
+
+PRJ_TESTMMPFILES
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorplugin/group/connectionmonitorplugin.mmp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,78 @@
+/*
+* 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:  Localization strings for Plugin.
+*
+*/
+
+#include <data_caging_paths.hrh>    //this is needed for RESOURCE_FILES_DIR
+#include <platform_paths.hrh>
+
+CAPABILITY          CAP_ECOM_PLUGIN
+TARGET              connectionmonitorplugin.dll
+TARGETTYPE          PLUGIN
+UID                 0x10009D8D 0x10281BC1
+VENDORID            VID_DEFAULT
+
+SOURCEPATH          ../src
+SOURCE              connectionmonitorplugin.cpp
+SOURCE              connectionmonitorpluginimplementationtable.cpp
+
+USERINCLUDE         ../data
+USERINCLUDE         ../inc
+
+SYSTEMINCLUDE       .
+SYSTEMINCLUDE       /epoc32/include/cshelp
+SYSTEMINCLUDE       /epoc32/include/ecom
+// Default system include paths for middleware layer modules.
+APP_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH          ../data
+
+//ECOM resource definition
+START RESOURCE      10281BC1.rss
+TARGET              connectionmonitorplugin.rsc
+TARGETPATH          ECOM_RESOURCE_DIR
+END                 //  ECOM resource definition
+
+// Plugin's own resources.
+START RESOURCE      connectionmonitorpluginrsc.rss
+HEADER
+TARGETPATH          RESOURCE_FILES_DIR
+LANGUAGE_IDS
+END // own resource file
+
+
+LIBRARY             apgrfx.lib // RApaLsSession
+LIBRARY             apparc.lib
+LIBRARY             avkon.lib
+LIBRARY             bafl.lib
+LIBRARY             commonengine.lib // RConeResourceLoader
+LIBRARY             cone.lib
+LIBRARY             ecom.lib
+LIBRARY             efsrv.lib
+LIBRARY             eikcoctl.lib
+LIBRARY             eikcore.lib
+LIBRARY             euser.lib
+LIBRARY             GSEcomPlugin.lib
+LIBRARY             GSFramework.lib // Base classes
+LIBRARY             ws32.lib
+LIBRARY             egul.lib // CGulIcon
+LIBRARY             aknskins.lib // AknsUtils.h
+
+LIBRARY             commonui.lib
+LIBRARY             aknnotify.lib 
+LIBRARY             eiksrv.lib
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorplugin/inc/connectionmonitorplugin.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,195 @@
+/*
+* 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:  ConnectionMonitorPlugin implementation.
+*
+*/
+
+#ifndef CONNECTIONMONITORPLUGIN_H
+#define CONNECTIONMONITORPLUGIN_H
+
+// User includes
+
+// System includes
+#include <GSPluginInterface.h>
+#include <aknview.h>
+#include <ConeResLoader.h>
+#include <eikclb.h>
+#include <AknServerApp.h>
+
+// Classes referenced
+class CAknNavigationDecorator;
+class CAknViewAppUi;
+class CAknNullService;
+
+// Constants
+const TUid KConnectionMonitorPluginUID = { 0x10281BC2 };
+
+const TUid KConnectionMonitorAppUid    = { 0x101F84D0 };
+
+_LIT( KConnectionMonitorPluginResourceFileName,
+                                    "z:connectionmonitorpluginrsc.rsc" );
+_LIT( KConnectionMonitorPluginIconDirAndName,
+                                    "z:connectionmonitorplugin.mif ");
+                                                    // Use KDC_BITMAP_DIR
+
+// CLASS DECLARATION
+
+/**
+* CConnectionMonitorPlugin.
+*
+*/
+class CConnectionMonitorPlugin : 
+                            public CGSPluginInterface,
+                            public MAknServerAppExitObserver // Embedding
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Symbian OS two-phased constructor
+        * @param aInitParams initialization parameters.
+        * @return new instance of CConnectionMonitorPlugin.
+        */
+        static CConnectionMonitorPlugin* NewL( TAny* aInitParams );
+
+        /**
+        * Destructor.
+        */
+        ~CConnectionMonitorPlugin();
+
+    public: // From CAknView
+
+        /**
+        * From CAknView.
+        * This view's Id.
+        * @return This plugin's UID.
+        */
+        TUid Id() const;
+
+    public: // From CGSPluginInterface
+
+        /**
+        * From CGSPluginInterface.
+        * @param aCaption this plugin's caption.
+        */
+        void GetCaptionL( TDes& aCaption ) const;
+
+        /**
+        * From CGSPluginInterface.
+        * @return this plugin's provider category.
+        */
+        TInt PluginProviderCategory() const;
+
+        /**
+        * From CGSPluginInterface.
+        * @return this plugin's item type.
+        */
+        TGSListboxItemTypes ItemType();
+
+        /**
+        * From CGSPluginInterface.
+        * @param aKey key name.
+        * @param aValue key value.
+        */
+        void GetValue( const TGSPluginValueKeys aKey,
+                       TDes& aValue );
+
+        /**
+        * From CGSPluginInterface.
+        * @param aSelectionType selection type.
+        */
+        void HandleSelection( const TGSSelectionTypes aSelectionType );
+        
+        /**
+        * From CEikonEnv.
+        * @return this plugin's pointer to the created icon.
+        */
+        CGulIcon* CreateIconL( const TUid aIconType );
+
+    protected: // New
+
+        /**
+        * C++ default constructor.
+        */
+        CConnectionMonitorPlugin();
+
+        /**
+        * Symbian OS default constructor.
+        */
+        void ConstructL();
+
+    protected: // From CAknView
+
+        /**
+        * From CAknView.
+        * This implementation is empty because this class, being just
+        * a dialog, does not implement the CAknView finctionality.
+        */
+        void DoActivateL( const TVwsViewId& aPrevViewId,
+                          TUid aCustomMessageId,
+                          const TDesC8& aCustomMessage );
+
+        /**
+        * From CAknView.
+        * This implementation is empty because this class, being just 
+        * a dialog, does not implement the CAknView finctionality.
+        */
+        void DoDeactivate();
+
+    private: // New
+
+        /**
+        * Opens localized resource file.
+        */
+        void OpenLocalizedResourceFileL(
+                            const TDesC& aResourceFileName,
+                            RConeResourceLoader& aResourceLoader );
+
+        /**
+        * Launches ConnectionMonitor application as embedded.
+        */
+        void LaunchConnectionMonitorAppL();
+        
+        /**
+        * Shows an error note in case of error. 
+        * @param aErrorCode The error code.
+        */
+        void ShowErrorNote(TInt aErrorCode);
+
+        /**
+        * Shows the error note and resolves the error.
+        * @param aErrorCode The error code.
+        */
+        TBool ShowErrorNoteL(TInt aErrorCode);
+    
+        /**
+        * Shows a general error note
+        */
+        void ShowGeneralErrorNoteL();
+        
+    protected: // Data
+
+        /**
+        * Resource loader for this plugin's resources.
+        */
+        RConeResourceLoader iResources;
+
+        /**
+        * AVKON NULL Service.
+        * Own.
+        */
+        CAknNullService* iNullService;
+    };
+
+#endif // CONNECTIONMONITORPLUGIN_H
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorplugin/loc/connectionmonitorplugin.loc	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,40 @@
+/*
+* 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:  Localization strings for Plugin.
+*
+*/
+
+
+//  LOCALISATION STRINGS
+
+
+//d:Connection Monitor Plugin caption
+//d:ConnectionMonitorPlugin
+//l:list_double_large_graphic_pane_t1
+//w:
+//r:5.0 
+//
+#define qtn_cp_folder_connection_management "Connection management"
+
+//d: In case of error, the error code is passed to error resolver
+//d: and the error note is displayed accordingly. If error resolver
+//d: cannot resolve the error, an error note "System error" is displayed.
+//l: popup_note_window/opt2
+//w:
+//r:5.0
+//
+#define qtn_err_os_general "System error"
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorplugin/rom/connectionmonitorplugin.iby	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,29 @@
+/*
+* 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:  ConnectionMonitorPlugin ROM resources.
+*
+*/
+
+#ifndef CONNECTIONMONITORPUGIN_IBY
+#define CONNECTIONMONITORPUGIN_IBY
+
+    #ifdef RD_CONTROL_PANEL
+
+        ECOM_PLUGIN( connectionmonitorplugin.dll, 10281BC1.rsc )
+        data=DATAZ_\BITMAP_DIR\connectionmonitorplugin.mif BITMAP_DIR\connectionmonitorplugin.mif
+
+    #endif // RD_CONTROL_PANEL
+
+#endif // CONNECTIONMONITORPUGIN_IBY
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorplugin/rom/connectionmonitorpluginresources.iby	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* 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:  ConnectionMonitorPlugin ROM resources.
+*
+*/
+
+#ifndef CONNECTIONMONITORPUGINRESOURCES_IBY
+#define CONNECTIONMONITORPUGINRESOURCES_IBY
+
+    #ifdef RD_CONTROL_PANEL
+
+        data=DATAZ_\RESOURCE_FILES_DIR\connectionmonitorpluginrsc.rsc RESOURCE_FILES_DIR\connectionmonitorpluginrsc.rsc
+
+    #endif // RD_CONTROL_PANEL
+
+#endif // CONNECTIONMONITORPUGINRESOURCES_IBY
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorplugin/src/connectionmonitorplugin.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,314 @@
+/*
+* 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:  ConnectionMonitorPlugin implementation.
+*
+*/
+
+
+// User includes
+#include    "connectionmonitorplugin.h"
+#include    <GSParentPlugin.h>
+#include    <GSCommon.hrh>
+#include    <connectionmonitorpluginrsc.rsg> // GUI Resource
+#include    <connectionmonitorplugin.mbg>
+#include    <GSPrivatePluginProviderIds.h>
+#include    <GSFWViewUIDs.h>
+
+// System includes
+#include    <AknNullService.h>
+#include    <bautils.h>
+#include    <StringLoader.h>
+#include    <AknGlobalNote.h>
+#include    <ErrorUI.h>
+
+// Constants
+
+// ========================= MEMBER FUNCTIONS ================================
+
+// ---------------------------------------------------------------------------
+// CConnectionMonitorPlugin::CConnectionMonitorPlugin()
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CConnectionMonitorPlugin::CConnectionMonitorPlugin()
+    : iResources( *iCoeEnv ),
+      iNullService(NULL)
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CConnectionMonitorPlugin::~CConnectionMonitorPlugin()
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CConnectionMonitorPlugin::~CConnectionMonitorPlugin()
+    {
+    iResources.Close();
+
+    if ( iNullService )
+        {
+        delete iNullService;
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CConnectionMonitorPlugin::ConstructL()
+// Symbian OS two-phased constructor
+// ---------------------------------------------------------------------------
+//
+void CConnectionMonitorPlugin::ConstructL()
+    {
+    BaseConstructL();
+    
+    OpenLocalizedResourceFileL( KConnectionMonitorPluginResourceFileName,
+                                iResources );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CConnectionMonitorPlugin::NewL()
+// Static constructor
+// ---------------------------------------------------------------------------
+//
+CConnectionMonitorPlugin* CConnectionMonitorPlugin::NewL( 
+                                                    TAny* /*aInitParams*/ )
+    {
+    CConnectionMonitorPlugin* self = 
+                                new( ELeave ) CConnectionMonitorPlugin();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CConnectionMonitorPlugin::Id
+// -----------------------------------------------------------------------------
+//
+TUid CConnectionMonitorPlugin::Id() const
+    {
+    return KConnectionMonitorPluginUID;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CConnectionMonitorPlugin::DoActivateL
+// -----------------------------------------------------------------------------
+//
+void CConnectionMonitorPlugin::DoActivateL( 
+                                  const TVwsViewId& /*aPrevViewId*/,
+                                  TUid /*aCustomMessageId*/,
+                                  const TDesC8& /*aCustomMessage*/ )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CConnectionMonitorPlugin::DoDeactivate
+// -----------------------------------------------------------------------------
+//
+void CConnectionMonitorPlugin::DoDeactivate()
+    {
+    }
+
+
+// ========================= From CGSPluginInterface ==================
+
+
+// -----------------------------------------------------------------------------
+// CConnectionMonitorPlugin::GetCaptionL
+// -----------------------------------------------------------------------------
+//
+void CConnectionMonitorPlugin::GetCaptionL( TDes& aCaption ) const
+    {
+    HBufC* result = StringLoader::LoadL( 
+                                    R_QTN_CP_FOLDER_CONNECTION_MANAGEMENT );
+    aCaption.Copy( *result );
+    delete result;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CConnectionMonitorPlugin::PluginProviderCategory
+// -----------------------------------------------------------------------------
+//
+TInt CConnectionMonitorPlugin::PluginProviderCategory() const
+    {
+    return KGSPluginProviderInternal;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CConnectionMonitorPlugin::ItemType()
+// -----------------------------------------------------------------------------
+//
+TGSListboxItemTypes CConnectionMonitorPlugin::ItemType()
+    {
+    return EGSItemTypeSettingDialog;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CConnectionMonitorPlugin::GetValue()
+// -----------------------------------------------------------------------------
+//
+void CConnectionMonitorPlugin::GetValue( const TGSPluginValueKeys /*aKey*/,
+                                      TDes& /*aValue*/ )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CConnectionMonitorPlugin::HandleSelection()
+// -----------------------------------------------------------------------------
+//
+void CConnectionMonitorPlugin::HandleSelection(
+    const TGSSelectionTypes /*aSelectionType*/ )
+    {
+    TRAPD( error, LaunchConnectionMonitorAppL() );
+    if( error != KErrNone )
+        {
+        ShowErrorNote( error );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CConnectionMonitorPlugin::CreateIconL
+// ---------------------------------------------------------------------------
+//
+CGulIcon* CConnectionMonitorPlugin::CreateIconL( const TUid aIconType )
+    {
+    //EMbm<Mbm_file_name><Bitmap_name>
+    CGulIcon* icon;
+    TParse* fp = new( ELeave ) TParse();
+    CleanupStack::PushL( fp );
+    fp->Set( KConnectionMonitorPluginIconDirAndName, &KDC_BITMAP_DIR, NULL );
+
+    if ( aIconType == KGSIconTypeLbxItem )
+        {
+        icon = AknsUtils::CreateGulIconL(
+        AknsUtils::SkinInstance(),
+        KAknsIIDQgnPropCpConnMan,
+        fp->FullName(),
+        EMbmConnectionmonitorpluginQgn_prop_cp_conn_man,
+        EMbmConnectionmonitorpluginQgn_prop_cp_conn_man_mask );
+        }    
+    else
+        {
+        icon = CGSPluginInterface::CreateIconL( aIconType );
+        }
+
+    CleanupStack::PopAndDestroy( fp );
+
+    return icon;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CConnectionMonitorPlugin::OpenLocalizedResourceFileL()
+// -----------------------------------------------------------------------------
+//
+void CConnectionMonitorPlugin::OpenLocalizedResourceFileL(
+    const TDesC& aResourceFileName,
+    RConeResourceLoader& aResourceLoader )
+    {
+    RFs fsSession;
+    User::LeaveIfError( fsSession.Connect() );
+
+    // Find the resource file:
+    TParse parse;
+    parse.Set( aResourceFileName, &KDC_RESOURCE_FILES_DIR, NULL );
+    TFileName fileName( parse.FullName() );
+
+    // Get language of resource file:
+    BaflUtils::NearestLanguageFile( fsSession, fileName );
+
+    // Open resource file:
+    aResourceLoader.OpenL( fileName );
+
+    // If leave occurs before this, close is called automatically when the
+    // thread exits.
+    fsSession.Close();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CConnectionMonitorPlugin::LaunchConnectionMonitorAppL()
+// -----------------------------------------------------------------------------
+//
+void CConnectionMonitorPlugin::LaunchConnectionMonitorAppL()
+    {
+    // Launch app
+    if ( iNullService )
+        {
+        delete iNullService;
+        iNullService = NULL;
+        }
+    iNullService = CAknNullService::NewL( KConnectionMonitorAppUid, this );
+    }
+
+// ---------------------------------------------------------
+// CWlanPlugin::ShowErrorNote
+// ---------------------------------------------------------
+//
+void CConnectionMonitorPlugin::ShowErrorNote(TInt aErrorCode)
+    {
+    TBool errorNoteShowed = EFalse;
+        
+    TRAPD(error, errorNoteShowed = ShowErrorNoteL(aErrorCode));
+            
+    if(error || !errorNoteShowed) 
+        {
+        TRAP_IGNORE( ShowGeneralErrorNoteL() );
+        }    
+    }
+
+// ---------------------------------------------------------
+// CWlanPlugin::ShowErrorNoteL
+// ---------------------------------------------------------
+//
+TBool CConnectionMonitorPlugin::ShowErrorNoteL(TInt aErrorCode)
+    {
+    CErrorUI* errorUi = CErrorUI::NewLC();
+    
+    TBool errorNoteShowed = errorUi->ShowGlobalErrorNoteL( aErrorCode );
+    
+    CleanupStack::PopAndDestroy( errorUi );
+        
+    return errorNoteShowed;
+    }    
+
+// ---------------------------------------------------------
+// CWlanPlugin::ShowGeneralErrorNoteL
+// ---------------------------------------------------------
+//
+void CConnectionMonitorPlugin::ShowGeneralErrorNoteL()
+    {
+    HBufC *msg = HBufC::NewL( R_QTN_ERR_OS_GENERAL );
+    
+	msg->Des().Copy( _L( "" ) );
+    CAknGlobalNote *note = CAknGlobalNote::NewLC();
+    
+    
+    note->ShowNoteL( EAknGlobalErrorNote, *msg );
+
+
+    CleanupStack::PopAndDestroy( note );
+    CleanupStack::PopAndDestroy( msg );
+    }
+   
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorplugin/src/connectionmonitorpluginimplementationtable.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,48 @@
+/*
+* 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:  ECOM proxy table for ConnectionMonitorPlugin.
+*
+*/
+
+
+// User includes
+#include "connectionmonitorplugin.h"
+
+// System includes
+#include <e32std.h>
+#include <implementationproxy.h>
+
+
+// Constants
+const TImplementationProxy KConnectionMonitorPluginImplementationTable[] =
+    {
+    IMPLEMENTATION_PROXY_ENTRY( 0x10281BC2, CConnectionMonitorPlugin::NewL )
+    };
+
+
+// ---------------------------------------------------------------------------
+// ImplementationGroupProxy
+// Gate/factory function
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount )
+    {
+    aTableCount = sizeof( KConnectionMonitorPluginImplementationTable )
+        / sizeof( TImplementationProxy );
+    return KConnectionMonitorPluginImplementationTable;
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorui/ROM/ConnectionMonitorUi.iby	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2002 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:  IBY file for ConnectionMonitorUi application
+ *
+*/
+
+ 
+#ifndef __CONNECTIONMONITORUI_IBY__
+#define __CONNECTIONMONITORUI_IBY__
+
+S60_APP_EXE(ConnectionMonitorUi)
+S60_APP_BITMAP(ConnectionMonitorUi)
+S60_APP_AIF_ICONS(ConnectionMonitorUi)
+S60_APP_AIF_RSC(ConnectionMonitorUi)
+
+#endif	// __CONNECTIONMONITORUI_IBY__
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorui/ROM/ConnectionMonitorUiResources.iby	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2004 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:  IBY file for those parts of ConnectionMonitorUi that needs localization
+ *
+*/
+
+
+#ifndef __CONNECTIONMONITORUIRESOURCES_IBY__
+#define __CONNECTIONMONITORUIRESOURCES_IBY__
+
+S60_APP_RESOURCE(ConnectionMonitorUi)
+S60_APP_CAPTION(ConnectionMonitorUi)
+
+#endif	// __CONNECTIONMONITORUIRESOURCES_IBY__
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorui/aif/ConnectionMonitorUiaif.rss	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2002 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 <aiftool.rh>
+
+RESOURCE AIF_DATA
+    {
+    app_uid=0x101F84D0;
+    num_icons=2;
+    embeddability=KAppNotEmbeddable;
+    newfile=KAppDoesNotSupportNewFile;
+    }
+
+// End of File
Binary file connectionmonitoring/connectionmonitorui/aif/context_pane_icon.bmp has changed
Binary file connectionmonitoring/connectionmonitorui/aif/context_pane_icon_mask.bmp has changed
Binary file connectionmonitoring/connectionmonitorui/aif/list_icon.bmp has changed
Binary file connectionmonitoring/connectionmonitorui/aif/list_icon_mask.bmp has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorui/data/ConnectionMonitorUi.rss	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,422 @@
+/*
+* Copyright (c) 2002 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 all the resources for the ConnectionMonitorUi.
+*
+*
+*/
+
+
+//  RESOURCE IDENTIFIER
+NAME    CMUI // 4 letter ID
+//
+//  INCLUDES
+
+#include <connectionmonitorui.loc>
+#include <eikon.rh>
+#include "ConnectionMonitorUi.hrh"
+#include <ConnectionMonitorUi.mbg>
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.mbg>
+#include <avkon.hrh>
+#include <avkon.loc>
+
+#include <appinfo.rh>
+#include <data_caging_paths_strings.hrh>
+
+//  CONSTANTS
+//#define ?constant   ?value
+
+//  MACROS
+//#define ?macro
+
+//  RESOURCE DEFINITIONS
+
+RESOURCE RSS_SIGNATURE { }
+
+RESOURCE TBUF { buf="ConnectionMonitorUi"; }
+
+RESOURCE EIK_APP_INFO
+    {
+    status_pane = r_connmonui_status_pane;
+    }
+
+RESOURCE STATUS_PANE_APP_MODEL r_connmonui_status_pane
+    {
+    panes =
+        {
+        SPANE_PANE
+            {
+            id = EEikStatusPaneUidTitle;
+            type = EAknCtTitlePane;
+            resource = r_connmonui_title_pane;
+            }
+        };
+    }
+
+RESOURCE TITLE_PANE r_connmonui_title_pane
+    {
+    txt = qtn_cmon_title;
+    }
+
+RESOURCE TBUF r_qtn_cmon_no_active_connections { buf=qtn_cmon_no_active_connections; }
+RESOURCE TBUF r_qtn_cmon_navi_one_active_conn   { buf=qtn_cmon_navi_one_active_conn; }
+RESOURCE TBUF r_qtn_cmon_navi_many_active_conns { buf=qtn_cmon_navi_many_active_conns; }
+
+RESOURCE TBUF r_qtn_set_bearer_data_call    { buf=qtn_set_bearer_data_call; }
+RESOURCE TBUF r_qtn_set_bearer_packet_data  { buf=qtn_set_bearer_packet_data; }
+RESOURCE TBUF r_qtn_cmon_bearer_hscsd       { buf=qtn_cmon_bearer_hscsd; }
+RESOURCE TBUF r_qtn_wlan_sett_bearer_wlan   { buf=qtn_wlan_sett_bearer_wlan; }
+
+
+RESOURCE TBUF r_qtn_cmon_heading_conn_name { buf=qtn_cmon_heading_conn_name; }
+RESOURCE TBUF r_qtn_cmon_heading_bearer { buf=qtn_cmon_heading_bearer; }
+RESOURCE TBUF r_qtn_cmon_heading_status { buf=qtn_cmon_heading_status; }
+RESOURCE TBUF r_qtn_cmon_heading_data_total { buf=qtn_cmon_heading_data_total; }
+RESOURCE TBUF r_qtn_cmon_heading_data_received { buf=qtn_cmon_heading_data_received; }
+RESOURCE TBUF r_qtn_cmon_heading_data_sent { buf=qtn_cmon_heading_data_sent; }
+RESOURCE TBUF r_qtn_cmon_heading_duration { buf=qtn_cmon_heading_duration; }
+RESOURCE TBUF r_qtn_cmon_heading_speed { buf=qtn_cmon_heading_speed; }
+RESOURCE TBUF r_qtn_cmon_heading_csd_number { buf=qtn_cmon_heading_csd_number; }
+RESOURCE TBUF r_qtn_cmon_heading_gprs_apn { buf=qtn_cmon_heading_gprs_apn; }
+RESOURCE TBUF r_qtn_cmon_heading_sharing_info { buf=qtn_cmon_heading_sharing_info; }
+
+RESOURCE TBUF r_qtn_cmon_status_creating { buf=qtn_cmon_status_creating; }
+RESOURCE TBUF r_qtn_cmon_status_idle { buf=qtn_cmon_status_idle; }
+RESOURCE TBUF r_qtn_cmon_status_active { buf=qtn_cmon_status_active; }
+RESOURCE TBUF r_qtn_cmon_status_suspended { buf=qtn_cmon_status_suspended; }
+RESOURCE TBUF r_qtn_cmon_status_closing { buf=qtn_cmon_status_closing; }
+RESOURCE TBUF r_qtn_cmon_status_closed { buf=qtn_cmon_status_closed; }
+
+RESOURCE TBUF r_qtn_cmon_status_details_creating { buf=qtn_cmon_status_details_creating; }
+RESOURCE TBUF r_qtn_cmon_status_details_idle { buf=qtn_cmon_status_details_idle; }
+RESOURCE TBUF r_qtn_cmon_status_details_active { buf=qtn_cmon_status_details_active; }
+RESOURCE TBUF r_qtn_cmon_status_details_suspended { buf=qtn_cmon_status_details_suspended; }
+RESOURCE TBUF r_qtn_cmon_status_details_closing { buf=qtn_cmon_status_details_closing; }
+RESOURCE TBUF r_qtn_cmon_status_details_closed { buf=qtn_cmon_status_details_closed; }
+
+RESOURCE TBUF r_qtn_log_gprs_amount_b { buf=qtn_log_gprs_amount_b; }
+RESOURCE TBUF r_qtn_log_gprs_amount_kb { buf=qtn_log_gprs_amount_kb; }
+RESOURCE TBUF r_qtn_log_gprs_amount_mb { buf=qtn_log_gprs_amount_mb; }
+RESOURCE TBUF r_qtn_log_gprs_amount_gb { buf=qtn_log_gprs_amount_gb; }
+
+RESOURCE TBUF r_qtn_cmon_data_transf_rate_dl { buf=qtn_cmon_data_transf_rate_dl; }
+RESOURCE TBUF r_qtn_cmon_data_transf_rate_ul { buf=qtn_cmon_data_transf_rate_ul; }
+
+RESOURCE TBUF r_qtn_cmon_ul_dl_data_amounts { buf=qtn_cmon_ul_dl_data_amounts; }
+RESOURCE TBUF r_qtn_cmon_navi_nof_connection { buf=qtn_cmon_navi_nof_connection; }
+
+RESOURCE TBUF r_text_calc_decimal_separator { buf=text_calc_decimal_separator; }
+
+RESOURCE TBUF r_qtn_cmon_item_conn_name_modem { buf=qtn_cmon_item_conn_name_modem; }
+
+RESOURCE TBUF r_qtn_cmon_conf_end_single_conn { buf=qtn_cmon_conf_end_single_conn; }
+RESOURCE TBUF r_qtn_cmon_conf_end_all_conns { buf=qtn_cmon_conf_end_all_conns; }
+RESOURCE TBUF r_qtn_cmon_conf_end_modem_conn { buf=qtn_cmon_conf_end_modem_conn; }
+RESOURCE TBUF r_qtn_cmon_duration_over_24h { buf=qtn_cmon_duration_over_24h; }
+RESOURCE TBUF r_qtn_cmon_info_conn_already_end { buf=qtn_cmon_info_conn_already_end; }
+
+RESOURCE TBUF r_qtn_cmon_wlan_singal_strength_low { buf=qtn_cmon_wlan_singal_strength_low; }
+RESOURCE TBUF r_qtn_cmon_wlan_singal_strength_medium { buf=qtn_cmon_wlan_singal_strength_medium; }
+RESOURCE TBUF r_qtn_cmon_wlan_singal_strength_good { buf=qtn_cmon_wlan_singal_strength_good; }
+RESOURCE TBUF r_qtn_cmon_wlan_signal_strength_no_signal
+                            { buf=qtn_cmon_wlan_signal_strength_no_signal; }
+
+RESOURCE TBUF r_qtn_cmon_wlan_newtwork_mode_adhoc { buf=qtn_cmon_wlan_newtwork_mode_adhoc; }
+RESOURCE TBUF r_qtn_cmon_wlan_newtwork_mode_infra { buf=qtn_cmon_wlan_newtwork_mode_infra; }
+
+RESOURCE TBUF r_qtn_cmon_wlan_security_mode_open { buf=qtn_cmon_wlan_security_mode_open; }
+RESOURCE TBUF r_qtn_cmon_wlan_security_mode_wep { buf=qtn_cmon_wlan_security_mode_wep; }
+RESOURCE TBUF r_qtn_cmon_wlan_security_mode_802_1x { buf=qtn_cmon_wlan_security_mode_802_1x; }
+RESOURCE TBUF r_qtn_cmon_wlan_security_mode_wpa { buf=qtn_cmon_wlan_security_mode_wpa; }
+
+RESOURCE TBUF r_qtn_cmon_wlan_tx_power_level { buf=qtn_cmon_wlan_tx_power_level; }
+
+RESOURCE TBUF r_qtn_cmon_heading_wlan_network_name { buf=qtn_cmon_heading_wlan_network_name; }
+RESOURCE TBUF r_qtn_cmon_heading_wlan_signal_strength
+                            { buf=qtn_cmon_heading_wlan_signal_strength; }
+RESOURCE TBUF r_qtn_cmon_heading_wlan_network_mode { buf=qtn_cmon_heading_wlan_network_mode; }
+RESOURCE TBUF r_qtn_cmon_heading_wlan_security_mode { buf=qtn_cmon_heading_wlan_security_mode; }
+RESOURCE TBUF r_qtn_cmon_heading_wlan_tx_power { buf=qtn_cmon_heading_wlan_tx_power; }
+
+RESOURCE TBUF r_qtn_cmon_parameter_unavailable { buf=qtn_cmon_parameter_unavailable; }
+
+RESOURCE TBUF r_qtn_cmon_sharing_app_msg_server { buf=qtn_cmon_sharing_app_msg_server; }
+RESOURCE TBUF r_qtn_cmon_sharing_app_dl_mg { buf=qtn_cmon_sharing_app_dl_mg; }
+RESOURCE TBUF r_qtn_cmon_sharing_app_rss_server { buf=qtn_cmon_sharing_app_rss_server; }
+RESOURCE TBUF r_qtn_cmon_sharing_app_java_midlet { buf=qtn_cmon_sharing_app_java_midlet; }
+RESOURCE TBUF r_qtn_cmon_sharing_app_unknown { buf=qtn_cmon_sharing_app_unknown; }
+RESOURCE TBUF r_qtn_cmon_sharing_app_supl { buf=qtn_cmon_sharing_app_supl; }
+
+
+//----------------------------------------------------
+//
+//    r_connectionmonitorui_title
+//
+//----------------------------------------------------
+//
+RESOURCE TBUF r_connectionmonitorui_title
+    {
+    buf = qtn_cmon_title_active_conns;
+    }
+
+//----------------------------------------------------
+//
+//    r_connectionmonitorui_hotkeys
+//
+//----------------------------------------------------
+//
+RESOURCE HOTKEYS r_connectionmonitorui_hotkeys
+    {
+    control=
+        {
+        HOTKEY { command=EAknCmdExit; key='e'; }
+        };
+    }
+
+#ifdef RD_CONTROL_PANEL
+
+//----------------------------------------------------
+//
+//    r_connectionmonitorui_view_buttons
+//
+//----------------------------------------------------
+//
+RESOURCE CBA r_cp_connectionmonitorui_view_buttons
+    {
+    buttons =
+        {
+        CBA_BUTTON {id=EAknSoftkeyOptions; txt=text_softkey_option;},
+        CBA_BUTTON {id=EAknSoftkeyExit; txt=text_softkey_back;},
+        CBA_BUTTON {id=EAknSoftkeyDetails; txt=qtn_msk_cmon_details;}
+        };
+    }
+
+//----------------------------------------------------
+//
+//    r_connectionmonitorui_view
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_cp_connectionmonitorui_view
+    {
+      hotkeys=r_connectionmonitorui_hotkeys;
+      menubar=r_connectionmonitorui_menubar_view;
+      cba=r_cp_connectionmonitorui_view_buttons;
+    }
+
+#endif // RD_CONTROL_PANEL
+
+//----------------------------------------------------
+//
+//    r_connectionmonitorui_view_buttons
+//
+//----------------------------------------------------
+//
+RESOURCE CBA r_connectionmonitorui_view_buttons
+    {
+    buttons =
+        {
+        CBA_BUTTON {id=EAknSoftkeyOptions; txt=text_softkey_option;},
+        CBA_BUTTON {id=EAknSoftkeyExit; txt=text_softkey_exit;},
+        CBA_BUTTON {id=EAknSoftkeyDetails; txt=qtn_msk_cmon_details;}
+        };
+    }
+
+//----------------------------------------------------
+//
+//    r_connectionmonitorui_view
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_connectionmonitorui_view
+    {
+      hotkeys=r_connectionmonitorui_hotkeys;
+      menubar=r_connectionmonitorui_menubar_view;
+      cba=r_connectionmonitorui_view_buttons;
+    }
+
+//----------------------------------------------------
+//
+//    r_connectionmonitorui_menubar_view
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_BAR r_connectionmonitorui_menubar_view
+    {
+    titles=
+        {
+        MENU_TITLE { menu_pane=r_connectionmonitorui_app_menu; txt="App"; },
+        MENU_TITLE { menu_pane=r_connectionmonitorui_view_menu; txt="View"; }
+        };
+    }
+
+//----------------------------------------------------
+//
+//    r_connectionmonitorui_view_menu
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_PANE r_connectionmonitorui_view_menu
+    {
+    items=
+        {
+        MENU_ITEM { command=EConnectionMonitorUiCmdAppDetails;
+                                txt = qtn_cmon_list_options_details;  flags = EEikMenuItemSpecific;},
+        MENU_ITEM { command=EConnectionMonitorUiCmdAppEndConn;
+                                txt = qtn_cmon_list_options_end_conn; flags = EEikMenuItemSpecific;},
+        MENU_ITEM { command=EConnectionMonitorUiCmdAppEndAll;
+                                txt = qtn_cmon_list_options_end_all; }
+        };
+    }
+
+//----------------------------------------------------
+//
+//    r_connectionmonitorui_detailsview
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_connectionmonitorui_detailsview
+    {
+    hotkeys=r_connectionmonitorui_hotkeys;
+    cba=R_AVKON_SOFTKEYS_OK_EMPTY__OK;
+    }
+
+//----------------------------------------------------
+//
+//    r_connectionmonitorui_app_menu
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_PANE r_connectionmonitorui_app_menu
+    {
+    items=
+        {
+        MENU_ITEM { command=EAknCmdHelp; txt = qtn_options_help; },
+        MENU_ITEM { command=EAknCmdExit; txt=qtn_options_exit; }
+        };
+    }
+
+// ICONARRAYS
+
+RESOURCE AKN_ICON_ARRAY r_listbox_icons
+    {
+    bmpfile = APP_BITMAP_DIR"\\ConnectionMonitorUi.mbm";
+    icons =
+        {
+        AKN_ICON
+            {
+            iconId = EMbmConnectionmonitoruiQgn_prop_wml_gprs;
+            maskId = EMbmConnectionmonitoruiQgn_prop_wml_gprs_mask;
+            },
+        AKN_ICON
+            {
+            iconId = EMbmConnectionmonitoruiQgn_prop_wml_csd;
+            maskId = EMbmConnectionmonitoruiQgn_prop_wml_csd_mask;
+            },
+        AKN_ICON
+            {
+            iconId = EMbmConnectionmonitoruiQgn_prop_wml_hscsd;
+            maskId = EMbmConnectionmonitoruiQgn_prop_wml_hscsd_mask;
+            },
+        AKN_ICON
+            {
+            iconId = EMbmConnectionmonitoruiQgn_prop_cmon_gprs_suspended;
+            maskId = EMbmConnectionmonitoruiQgn_prop_cmon_gprs_suspended_mask;
+            }
+        };
+    }
+
+RESOURCE TBUF r_qtn_appl_option_item { buf=qtn_appl_option_item; }
+
+RESOURCE DIALOG r_end_conn_confirmation_query
+    {
+    flags=EGeneralQueryFlags;
+    buttons=R_AVKON_SOFTKEYS_YES_NO__YES;
+    items=
+        {
+        DLG_LINE
+            {
+            type=EAknCtQuery;
+            id = EGeneralQuery;
+            control= AVKON_CONFIRMATION_QUERY
+                {
+                layout = EConfirmationQueryLayout;
+                };
+            }
+        };
+    }
+
+//----------------------------------------------------
+//
+//    r_qtn_cmon_connection_summary_note_text
+//
+//----------------------------------------------------
+//
+RESOURCE TBUF r_qtn_cmon_connection_summary_note_text { buf =
+    qtn_cmon_summary_heading"\n"qtn_cmon_summary_transferred"\n%0U\n"qtn_cmon_summary_duration"\n%1U"; }
+
+//----------------------------------------------------
+//
+//    r_qtn_cmon_connection_summary_note
+//
+//----------------------------------------------------
+//
+RESOURCE DIALOG r_qtn_cmon_connection_summary_note
+    {
+    flags = EAknInformationNoteFlags;
+    buttons = R_AVKON_SOFTKEYS_EMPTY;
+    items=
+        {
+        DLG_LINE
+            {
+            type = EAknCtNote;
+            id = EGeneralNote;
+            control= AVKON_NOTE
+                {
+                layout = ETextualNotificationLayout;
+                singular_label = "";
+                plural_label = "";
+                };
+            }
+        };
+    }
+
+//----------------------------------------------------
+//
+//    r_connectionmonitorui_localisable_app_info
+//
+//----------------------------------------------------
+//
+RESOURCE LOCALISABLE_APP_INFO r_connectionmonitorui_localisable_app_info
+    {
+    short_caption = qtn_apps_cmon_grid;
+    caption_and_icon =
+    CAPTION_AND_ICON_INFO
+        {
+        caption = qtn_apps_cmon_list;
+#ifdef __SCALABLE_ICONS
+        number_of_icons = 1;
+        icon_file = "Z:"APP_BITMAP_DIR"\\connectionmonitorui_aif.mif";
+#else
+        number_of_icons = 2;
+        icon_file =  "Z:"APP_BITMAP_DIR"\\connectionmonitorui_aif.mbm";
+#endif
+        };
+    }
+
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorui/data/ConnectionMonitorUi_caption.rss	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2002 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:
+*     Caption file for ConnectionMonitorUi.
+*
+*
+*/
+
+
+#include <ConnectionMonitorUi.loc>
+#include <apcaptionfile.rh>
+
+RESOURCE CAPTION_DATA
+    {
+    caption=qtn_apps_cmon_list;
+    shortcaption=qtn_apps_cmon_grid;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorui/data/ConnectionMonitorUi_reg.rss	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2004 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 <appinfo.rh>
+#include <ConnectionMonitorUi.rsg>
+#include <data_caging_paths_strings.hrh>
+
+UID2 KUidAppRegistrationResourceFile
+UID3 0x101F84D0 // Define your application UID here
+
+RESOURCE APP_REGISTRATION_INFO
+    {
+    app_file = "ConnectionMonitorUi";
+
+    localisable_resource_file = APP_RESOURCE_DIR"\\ConnectionMonitorUi";
+    localisable_resource_id = R_CONNECTIONMONITORUI_LOCALISABLE_APP_INFO;
+    embeddability = KAppNotEmbeddable;
+    newfile = KAppDoesNotSupportNewFile;
+
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorui/group/ConnectionMonitorUI.mmp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,113 @@
+/*
+* Copyright (c) 2002 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 the project specification file for ConnectionMonitorUi.
+*     
+*
+*/
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+
+TARGET        ConnectionMonitorUi.exe
+TARGETTYPE    exe
+
+
+UID  0x100039CE 0x101F84D0
+
+CAPABILITY   CAP_APPLICATION NetworkControl ProtServ
+
+VENDORID VID_DEFAULT
+
+SOURCEPATH ../src
+SOURCE  ConnectionMonitorUiApp.cpp 
+SOURCE  ConnectionMonitorUiAppUi.cpp
+SOURCE  ConnectionMonitorUiDocument.cpp
+SOURCE  ConnectionMonitorUiContainer.cpp
+SOURCE  ConnectionMonitorUiView.cpp
+SOURCE  ConnectionMonitorUiDetailsView.cpp
+SOURCE  ConnectionMonitorUiDetailsContainer.cpp
+SOURCE  ConnectionInfoBase.cpp
+SOURCE  CsdConnectionInfo.cpp
+SOURCE  GprsConnectionInfo.cpp
+SOURCE  ConnectionArray.cpp
+SOURCE  FeatureManagerWrapper.cpp
+SOURCE  WlanConnectionInfo.cpp
+SOURCE  EasyWLANConnectionInfo.cpp
+SOURCE  ActiveWrapper.cpp
+
+
+START RESOURCE ../data/ConnectionMonitorUi.rss
+HEADER
+TARGETPATH APP_RESOURCE_DIR
+LANGUAGE_IDS
+END  // RESOURCE
+
+// Component specific internal headers 
+USERINCLUDE			../inc
+
+// ADO-SUBSYSTEM specific internal headers 
+SYSTEMINCLUDE		../../inc
+
+// ADO specific internal headers 
+SYSTEMINCLUDE		../../../inc
+
+//Macro to /epoc32 headers
+MW_LAYER_SYSTEMINCLUDE
+
+#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
+APP_LAYER_SYSTEMINCLUDE
+#endif
+
+
+SYSTEMINCLUDE   /epoc32/include/libc
+
+
+LIBRARY euser.lib
+LIBRARY apparc.lib
+LIBRARY cone.lib
+LIBRARY eikcore.lib 
+LIBRARY eikcoctl.lib
+LIBRARY avkon.lib
+LIBRARY eikctl.lib
+LIBRARY	bafl.lib
+LIBRARY commonengine.lib
+LIBRARY	connmon.lib
+LIBRARY	estlib.lib
+LIBRARY egul.lib 
+LIBRARY apgrfx.lib
+LIBRARY hlplch.lib
+LIBRARY AknSkins.lib 
+LIBRARY AKNNOTIFY.LIB
+LIBRARY FeatMgr.lib
+LIBRARY commsdat.lib
+LIBRARY cmmanager.lib
+
+DEBUGLIBRARY flogger.lib
+DEBUGLIBRARY efsrv.lib
+
+
+epocstacksize 0x5000
+
+// DEFFILE ?filename
+
+
+START RESOURCE ../data/ConnectionMonitorUi_reg.rss
+DEPENDS connectionmonitorui.rsg
+// Do not change the UID below.
+TARGETPATH /private/10003a3f/apps
+END
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorui/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2002 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 <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+// Help exports
+#include "../help/group/bld.inf"
+
+PRJ_EXPORTS
+// export iby files
+../ROM/ConnectionMonitorUi.iby		CORE_MW_LAYER_IBY_EXPORT_PATH(ConnectionMonitorUi.iby)
+../ROM/ConnectionMonitorUiResources.iby	LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(ConnectionMonitorUiResources.iby)
+
+// export localised loc file
+../loc/ConnectionMonitorUi.loc	MW_LAYER_LOC_EXPORT_PATH(connectionmonitorui.loc)
+
+PRJ_MMPFILES
+./ConnectionMonitorUI.mmp
+
+PRJ_EXTENSIONS
+START EXTENSION s60/mifconv
+OPTION TARGETFILE ConnectionMonitorUi.mif
+OPTION HEADERFILE ConnectionMonitorUi.mbg
+OPTION SOURCES -c8,1 qgn_prop_wml_gprs.bmp \
+               -c8,1 qgn_prop_wml_csd.bmp \
+               -c8,1 qgn_prop_wml_hscsd.bmp \
+               -c8,1 qgn_prop_empty.bmp \
+               -c8,1 qgn_prop_cmon_gprs_suspended.bmp \
+               -c8,8 qgn_prop_cmon_conn_active.bmp \
+               -c8,8 qgn_prop_cmon_wlan_avail.bmp \
+               -c8,1 qgn_prop_wlan_bearer.bmp \
+               -c8,1 qgn_prop_cmon_wlan_conn.bmp \
+               -c8,1 qgn_indi_wlan_signal_low_add.bmp \
+               -c8,1 qgn_indi_wlan_signal_med_add.bmp \
+               -c8,1 qgn_indi_wlan_signal_good_add.bmp \
+               -c8,1 qgn_indi_wlan_secure_network_add.bmp
+END
+
+PRJ_EXTENSIONS
+START EXTENSION s60/mifconv
+  OPTION TARGETFILE ConnectionMonitorUi_aif.mif
+  OPTION SOURCES -c8,8 qgn_prop_cp_conn_man.bmp
+END
+
+//PRJ_TESTMMPFILES
\ No newline at end of file
Binary file connectionmonitoring/connectionmonitorui/help/data/xhtml.zip has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorui/help/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+* 
+* Contributors:
+* 
+* 
+* Description:
+* Export help related files.
+*
+*/
+
+#include <platform_paths.hrh>				
+PRJ_EXPORTS
+:zip ../data/xhtml.zip   /epoc32/data/z/resource/ overwrite
+:zip ../data/xhtml.zip   /epoc32/winscw/c/resource/ overwrite
+
+../inc/cmon.hlp.hrh	MW_LAYER_PLATFORM_EXPORT_PATH(csxhelp/cmon.hlp.hrh)
+../rom/connectionmonitoruihelps_variant.iby		CUSTOMER_APP_LAYER_IBY_EXPORT_PATH(connectionmonitoruihelps_variant.iby)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorui/help/inc/cmon.hlp.hrh	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* 
+* Description:
+*
+*/
+	
+//
+// cmon.hlp.hrh generated by CSXHelp Utilities.
+//           
+
+#ifndef __CMON_HLP_HRH__
+#define __CMON_HLP_HRH__
+
+_LIT(KCMON_HLP_CMON_MAIN_VIEW, "CMON_HLP_CMON_MAIN_VIEW"); // 
+_LIT(KCMON_HLP_CMON_WLAN_VIEW, "CMON_HLP_CMON_WLAN_VIEW"); // 
+
+#endif 
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorui/help/rom/connectionmonitoruihelps_variant.iby	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2002 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:  IBY file for ConnectionMonitorUi helps
+ *
+*/
+
+
+#ifndef __CONNECTIONMONITORUIHELPS_VARIANT_IBY__
+#define __CONNECTIONMONITORUIHELPS_VARIANT_IBY__
+
+#if defined(FF_S60_HELPS_IN_USE)
+    data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x101F84D0\contents.zip, RESOURCE_FILES_DIR\xhtml\%02d\0x101F84D0\contents.zip)
+    data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x101F84D0\index.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x101F84D0\index.xml)
+    data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x101F84D0\keywords.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x101F84D0\keywords.xml)
+    data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x101F84D0\meta.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x101F84D0\meta.xml)
+#endif
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorui/inc/ActiveWrapper.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,159 @@
+/*
+* 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:  CActiveWrapper header file
+*
+*/
+
+
+#ifndef __ACTIVE_WRAPPER_H__
+#define __ACTIVE_WRAPPER_H__
+
+//  INCLUDES
+#include <e32base.h>
+#include <rconnmon.h>
+
+// CONSTANTS
+
+// CLASS DECLARATION
+
+/**
+*  Definition of CActiveWrapper
+*
+*  @since S60 v3.2
+*/
+NONSHARABLE_CLASS( CActiveWrapper ) : public CActive
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CActiveWrapper* NewL();
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CActiveWrapper();
+
+    public: // New functions
+
+        /**
+        * Starts the active object and gets the value for a string attribute.
+        * @param aConnectionId Connection id.
+        * @param aConnectionMonitor RConnectionMonitor
+        * @param aAttribute Identifies the attribute to be retrived.
+        * @param aValue On completion, contains the requested string.
+        */
+        void StartGetStringAttribute( TInt const aConnectionId, 
+                            RConnectionMonitor* const aConnectionMonitor,
+                            TUint const aAttribute,
+                            TDes& aValue );
+
+        /**
+        * Starts the active object and gets the value for a TInt attribute.
+        * @param aConnectionId Connection id.
+        * @param aConnectionMonitor RConnectionMonitor
+        * @param aAttribute Identifies the attribute to be retrived.
+        * @param aValue On completion, contains the requested TInt attribute.
+        */
+        void StartGetIntAttribute( TInt const aConnectionId,
+                            RConnectionMonitor* const aConnectionMonitor,
+                            TUint const aAttribute,
+                            TInt& aValue );
+
+        /**
+        * Starts the active object and gets the value for a TUint attribute.
+        * @param aConnectionId Connection id.
+        * @param aConnectionMonitor RConnectionMonitor
+        * @param aAttribute Identifies the attribute to be retrived.
+        * @param aValue On completion, contains the requested TUint attribute.
+        */
+        void StartGetUintAttribute( TInt const aConnectionId,
+                            RConnectionMonitor* const aConnectionMonitor,
+                            TUint const aAttribute,
+                            TUint& aValue );
+
+        /**
+        * Starts the active object and gets the value for a packaged 
+        * attribute (TConnMonClientEnumBuf).
+        * @param aConnectionId Connection id.
+        * @param aConnectionMonitor RConnectionMonitor
+        * @param aValue On completion, contains the requested packaged attribute.
+        */
+        void StartGetConnSharings( TInt const aConnectionId,
+                            RConnectionMonitor* const aConnectionMonitor,
+                            TConnMonClientEnumBuf& aValue );
+
+        /**
+        * Starts the active object and gets the value for a packaged 
+        * attribute (TConnMonTimeBuf).
+        * @param aConnectionId Connection id.
+        * @param aConnectionMonitor RConnectionMonitor
+        * @param aValue On completion, contains the requested packaged attribute.
+        */
+        void StartGetConnTime( TInt const aConnectionId,
+                            RConnectionMonitor* const aConnectionMonitor,
+                            TConnMonTimeBuf& aValue );
+
+        /**
+        * Starts the active object and gets the value for a TInt attribute
+        * for the used Bearer type.
+        * @param aConnectionId Connection id.
+        * @param aConnectionMonitor RConnectionMonitor
+        * @param aAttribute Identifies the attribute to be retrived.
+        * @param aValue On completion, contains the requested TInt attribute.
+        */
+        void StartGetBearerType( TInt const aConnectionId,
+                            RConnectionMonitor& aConnectionMonitor,
+                            TUint const aAttribute,
+                            TInt& aValue );
+
+        /**
+        * Starts the active object and gathers information on 
+        * currently active connections.
+        * @param aConnectionCount On completion, contains the number of active connections.
+        * @param aConnectionMonitor RConnectionMonitor
+        */
+        void StartGetConnectionCount( TUint& aConnectionCount,
+                            RConnectionMonitor& aConnectionMonitor );
+                            
+    public: // Functions from base classes (CActive)
+
+        void DoCancel();
+        void RunL();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CActiveWrapper();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+    private: // data
+        
+        /**
+        * Own: sync. helper in async. requests
+        */
+        CActiveSchedulerWait    iWait;
+    };
+
+#endif // __ACTIVE_WRAPPER_H__
+
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorui/inc/ConnectionArray.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,153 @@
+/*
+* Copyright (c) 2004 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:  Contains and handles CConnectionInfo instances
+*     
+*
+*/
+
+
+#ifndef CONNECTIONARRAY_H_INCLUDED
+#define CONNECTIONARRAY_H_INCLUDED
+
+// INCLUDES
+#include    "ConnectionInfoBase.h"
+
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+/**
+* Contains and handles CConnectionInfo instances.
+*/
+class CConnectionArray : public CBase, public MDesCArray
+    {
+    public:
+        /**
+        * Constructor.
+        */
+        CConnectionArray();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CConnectionArray();
+
+        /**
+        * Contructs dynamic data members
+        */
+        virtual void ConstructL();
+   
+    public: // from MDesCArray
+        /** 
+        * Returns the number of descriptor elements in a descriptor array.
+        * @return The number of descriptor elements in a descriptor array. 
+        */
+        virtual TInt MdcaCount() const;
+
+        /** 
+        * Indexes into a descriptor array.    
+        * @param aIndex The position of the descriptor element within a 
+        * descriptor array. 
+        * The position is relative to zero; i.e. zero implies the first 
+        * descriptor element in a descriptor array. 
+        * @return A  non-modifiable pointer descriptor representing 
+        * the descriptor element located at position aIndex within a 
+        * descriptor array. 
+        */
+        virtual TPtrC MdcaPoint( TInt aIndex ) const;
+
+    public:
+    
+        /**
+        * Give back a copy of connectionarray. 
+        */
+        virtual CConnectionArray* DeepCopyL();
+    
+        /**
+        * Returns the index of the given connection
+        * @param aConnectionId connection id
+        * @return index value of connection in the array, or -1 if there
+        * is no connection the given Id
+        */
+        TInt GetArrayIndex( TUint aConnectionId ) const;
+
+        /**
+        * Returns the index of the given connection
+        * @param aConnection connection 
+        * @return index value of connection in the array, or -1 if there
+        * is no the given connection 
+        */
+        TInt GetArrayIndex( CConnectionInfoBase* aConnection ) const;
+
+        /**
+        * Add only new connection to the array
+        * @param aConnection the connection to be added to the array
+        */
+        void AppendL( CConnectionInfoBase* aConnection );
+
+        /**
+        * Delete connection from the array
+        * @param aConnectionId id of connection to be removed from the array
+        */
+        void Delete( TUint aConnectionId );
+
+        /**
+        * Delete connection from the array
+        * @param aConnection the connection to be removed from the array
+        */
+        void Delete( CConnectionInfoBase* aConnection );
+
+        /**
+        * Destroys the connection array
+        */
+        void Reset();
+
+        /**
+        * Returns info object of connection given by index value in the array
+        * @param aIndex index value of connection in the array
+        * @return CConnectionInfo* pointer to the connection info object
+        */
+        CConnectionInfoBase* operator[]( TUint aIndex ) const;
+        
+        /**
+        * Returns info object of connection given by index value in the array
+        * Checks the boundaries of array.
+        * @param aIndex index value of connection in the array
+        * @return CConnectionInfoBase* pointer to the connection info object if
+        * the given index is valid, NULL otherwise
+        */
+        CConnectionInfoBase* At( TInt aIndex ) const;
+        
+        /**
+        * Gives back the number of active connections (created or suspended)
+        * @return the number of active connections
+        */
+        TInt NumberOfActiveConnections() const;
+
+        /**
+        * Gives back the number of suspended connections
+        * @return the number of suspended connections
+        */
+        TInt NumberOfSuspendedConnections() const;
+
+    protected:
+        /**
+        * Contains the connections.
+        */
+        CArrayPtrFlat<CConnectionInfoBase>* iConnectionArray;   ///< Owned.
+    };
+
+#endif // CONNECTIONARRAY_H_INCLUDED
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorui/inc/ConnectionInfoBase.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,486 @@
+/*
+* Copyright (c) 2004 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:  Represents a connection
+*     
+*
+*/
+
+
+#ifndef CONNECTIONINFOBASE_H_INCLUDED
+#define CONNECTIONINFOBASE_H_INCLUDED
+
+// INCLUDES
+#include    <rconnmon.h>
+#include    <stdlib.h>
+#include    <badesca.h>
+#include    <e32std.h>
+#include    <stdlib.h>
+
+// CONSTANTS
+LOCAL_D const TUint KConnectionListItemText = 64;
+LOCAL_D const TUint KDetailsListItemText = 64;
+
+_LIT( KConnectonListItemTextFormat, "%o\t%S\t%S" );
+_LIT( KDetailsListItemTextFormat, "%S\t%S" );  
+
+// FORWARD DECLARATIONS
+
+class CActiveWrapper;
+
+// CLASS DECLARATION
+
+enum TConnectionStatus
+    {
+    EConnectionUninitialized,
+    EConnectionCreating,
+    EConnectionCreated,
+    EConnectionSuspended,
+    EConnectionClosing,
+    EConnectionClosed
+    };
+
+/**
+* Order of icons in icon array of containers
+*/
+enum TIconsOrder
+    {
+    EGprs = 0,
+    ECsd,
+    EHscsd,
+    EEmpty,
+    ESuspended,
+    EWlan
+    };
+
+
+/**
+* Represents a connection.
+*/
+class CConnectionInfoBase : public CBase
+    {
+    public: // Constructors, Desturctor
+                
+        /**
+        * Destructor
+        */
+        virtual ~CConnectionInfoBase();
+
+    protected:
+        /**
+        * Constructor
+        * @param aConnectionId The id of the given connection.
+        * @param aConnectionMonitor for refreshing details
+        * @param aConnectionBearerType the bearer type of connection
+        * @param aActiveWrapper the for refreshing
+        */
+        CConnectionInfoBase( TInt aConnectionId,
+                             RConnectionMonitor* const aConnectionMonitor,
+                             TConnMonBearerType aConnectionBearerType,
+                             CActiveWrapper* aActiveWrapper );
+
+        /**
+        * Second phase construction
+        */
+        void ConstructL();
+
+    public: // New functions
+    
+        /**
+        * Give back a copy of connection. 
+        */
+        virtual CConnectionInfoBase* DeepCopyL() = 0;
+    
+
+        /**
+        * Refresh required details of connection. 
+        */
+        virtual void RefreshDetailsL() = 0;
+
+        /**
+        * Refresh iListBoxItemText text, connection ListBox has a reference to
+        * this text.
+        */
+        virtual void RefreshConnectionListBoxItemTextL() = 0;
+
+        /**
+        * Refresh details array of connection. DetailsListBox has a reference
+        * to this array.
+        */
+        virtual void RefreshDetailsArrayL() = 0;
+
+        /**
+        * Called, if the status of connection is changed.
+        */ 
+        void StatusChangedL();
+
+        /**
+        * Gives back the connection is alive or not.
+        * @return ETrue if connection is created or suspended, 
+        * EFalse otherwise
+        */
+        TBool IsAlive() const;
+
+        /**
+        * Gives back the connection is suspended or not.
+        * @return ETrue if connection is suspended, 
+        * EFalse otherwise
+        */
+        TBool IsSuspended() const;
+                
+        /**
+        * @return ETrue if deletion of connection started form CMUI,
+        * EFalse otherwise
+        */
+        TBool GetDeletedFromCMUI() const;
+        
+        /**
+        * Sets status of connection to EConnectionClosing
+        */
+        void SetAllDeletedFromCMUI();        
+        
+        /**
+        * Sets iDeletedFromCMUI to ETrue, means dletion of connection
+        * was established from CMUI
+        */
+        void SetDeletedFromCMUI();        
+        
+        /**
+        * Gives back a pointer to the DetailsArray of connection.
+        * @return CDesCArraySeg* iDetailsArray of connection
+        */
+        CDesCArrayFlat* GetDetailsArray() const;
+
+        /**
+        * Gives back the id of connection
+        * @return the id of connection.
+        */
+        TUint GetConnectionId() const;
+
+        /**
+        * Gives back the icon id of connection 
+        * @return the icon id of connection 
+        */
+        virtual TUint GetIconId() const = 0;
+
+        /**
+        * Gives back the connection is EasyWLAN or not.
+        * @return ETrue if the selected conenction EasyWLAN,
+        * EFalse otherwise
+        */
+        virtual TBool IsEasyWLAN() const { return EFalse; };
+        
+        /**
+        * Gives back current Name of Network ( SSID )
+        * @return iNetworkName
+        */
+        virtual HBufC* GetWlanNetworkNameLC() const { return NULL; };
+
+        /**
+        * Gives back the status of connection 
+        * @return the status of connection 
+        */
+        TConnectionStatus GetStatus() const;
+
+        /**
+        * Gives back the name of connection 
+        * @return the name of connection 
+        */
+        HBufC* GetNameLC() const;        
+        
+        /**
+        * Gives back the bearertype of connection 
+        * @return the bearertype of connection 
+        */
+        TConnMonBearerType GetBearerType() const;
+        
+        /**
+        * Gives back a pointer the iListBoxItemText of connection 
+        * @return the iListBoxItemText of connection 
+        */
+        TPtrC GetConnectionListBoxItemText() const;
+
+        /**
+        * Check if connection name is starts with "mRouter" string or not.
+        * ( if this connection is not IR/BT )
+        * @retrun ETrue if starts wiht "mRouter", EFalse otherwise.
+        */
+        TBool CheckMrouterIap();
+    
+    protected:
+        /**
+        * Creates a string for DetailsListBoxItem, title came from resource 
+        * and value from aValueText
+        * @param aResourceId a resource id
+        * @param aValueText the value of text
+        * @retrun  a string consist of resource and value text
+        */
+        HBufC*  ToDetailsListBoxItemTextL( const TUint aResourceId, 
+                                           const HBufC* aValueText ) const;
+
+        /**
+        * Creates a string for DetailsListBoxItem, title came from resource 
+        * and value from aValueText, and Appends to iDetailsArray
+        * @param aResourceId a resource id
+        * @param aValueText the value of text
+        */
+        void  ToDetailsListBoxItemTextWithAppendL( const TUint aResourceId, 
+                                                   const HBufC* aValueText );
+
+        /**
+        * Creates a string for DetailsListBoxItem, title came from resource 
+        * and value from aValueText, and Replaces the given element with it
+        * @param aResourceId a resource id
+        * @param aValueText the value of text
+        */
+        void  ToDetailsListBoxItemTextWithReplaceL( const TUint aResourceId, 
+                                                    const HBufC* aValueText,
+                                                    TInt aIndex );
+
+
+        /**
+        * Creates an array with requrired details of connection to
+        * the listbox which visulaize details of connection. This member
+        * is called at initialization.
+        */
+        virtual void ToArrayDetailsL() = 0;
+
+        /**
+        * Refresh status of connection
+        */
+        void RefreshConnectionStatus();
+
+        /**
+        * Refresh status of connection
+        * @param aConnectionStatus new status of connection
+        */
+        void RefreshConnectionStatus( 
+                                   const TConnectionStatus aConnectionStatus );
+
+        /**
+        * Refresh amount of sent and received data of connection
+        */
+        void RefreshSentReceivedDataL();
+
+        /**
+        * Refresh the value of transfer speeds (Up/Down) of connection
+        */
+        void RefreshTransferSpeedsL();
+                        
+        /**
+        * Refresh the duration of connection.
+        */
+        void RefreshDuration();
+        
+        /**
+        * Refresh the applications names which uses the connection
+        * @return the count of applications use connection 
+        *         (from the user point of view)
+        */
+        TInt RefreshAppNamesL();
+        
+ 
+     public: // New functions        
+
+        /**
+        * Creates a string from bearer of connection
+        * @return string representation of bearer of connection.
+        */
+        HBufC* ToStringBearerLC() const;
+
+        /**
+        * Creates a string from status of connection
+        * @param aIsDetailsView is ETrue then get localised resources 
+        * to details view otherwise to connections view
+        * @return string representation of status of connection.
+        */
+        HBufC* ToStringStatusLC( TBool aIsDetailsView = ETrue ) const;
+
+        /**
+        * Creates a string from amount of received data 
+        * and sent data combined/summarized.
+        * @return string representation  of summarized of 
+        * Received and Sent data.
+        */
+        HBufC* ToStringTotalTransmittedDataLC() const;
+
+        /**
+        * Creates a string from amount of Sent data
+        * @param aToBeThreeDigit the shown digits numbers limited to three
+        * @return string representation of Sent data.
+        */
+        HBufC* ToStringSentDataLC( TBool aToBeThreeDigit = EFalse ) const;
+
+        /**
+        * Creates a string from amount of Received data
+        * @param aToBeThreeDigit the shown digits numbers limited to three
+        * @return string representation of Received data.
+        */
+        HBufC* ToStringReceivedDataLC( TBool aToBeThreeDigit = EFalse ) const;
+
+        /**
+        * Creates a string from transfer speed Up of connection
+        * @return string representation of transfer speed Up of 
+        * connection.
+        */
+        HBufC* ToStringTransferSpeedUpLC() const;
+
+        /**
+        * Creates a string from transfer speed Down of connection
+        * @return string representation of transfer speed Down of 
+        * connection.
+        */
+        HBufC* ToStringTransferSpeedDownLC() const;
+
+        /**
+        * Creates a string from duraion of the connection.
+        * @return string representation duraion of the connection.
+        */
+        HBufC* ToStringDurationLC() const;
+
+        /**
+        * Remove directional markers from a string.
+        * @param aStringHolder the string which markers has to remove.
+        */
+        void StringMarkerRemoval( HBufC* aStringHolder );
+
+        /**
+        * Remove directional markers from a string.
+        * @param aAppIndex the index of Applicaions names array.
+        * @return string representation of used app. name 
+        */
+        HBufC* ToStringAppNameLC( TInt aAppIndex );
+
+
+    private:
+        /**
+        * Creates a string from aLoadedData, extended with measure
+        * @param aLoadedData the data is converted to string
+        * @param aToBeThreeDigit the shown digits numbers limited to three
+        * @param aArrowChar the character representation of arrow (Up/Down)
+        * @return string representation of loaded data 
+        */
+        HBufC* ToStringLoadedDataLC( TUint aLoadedData, 
+                                     TBool aToBeThreeDigit = EFalse,
+                                     const TUint aArrowChar = 0 ) const;
+
+
+        /**
+        * Creates a string from transfer speed of connection
+        * @param aSpeed the speed is converted to string
+        * @param aArrowChar the character representation of arrow (Up/Down)
+        * @return string representation of transfer speed of 
+        * connection, extended with measure 
+        */
+        HBufC* ToStringTransferSpeedLC( div_t aSpeed, 
+                                        const TUint aArrowChar ) const;
+
+        /**
+        * Called if iConnectionStatus is changed to created. Initializes
+        * changable details of connection.
+        */
+        void InitializeConnectionInfoL();
+
+
+    protected:
+        
+        /**
+        * Used for refreshing details of connection.
+        */
+        RConnectionMonitor* const           iConnectionMonitor;   
+
+        /**
+        * The id of connection, given by RConnectionMonitor.
+        */
+        TUint                               iConnectionId;
+
+        /**
+        * The name of connection
+        */
+        TName                               iConnectionName;    // IAPName
+        
+        /**
+        * BearerType of connection
+        */
+        TConnMonBearerType                  iConnectionBearerType;
+        
+        /**
+        * The status of connection
+        */
+        TConnectionStatus                   iConnectionStatus;
+
+        /**
+        * The amount of Uploaded data
+        */
+        TUint                               iUploaded;
+
+        /**
+        * The amount of Downloaded data
+        */
+        TUint                               iDownloaded;
+
+        /**
+        * The start time of connection
+        */
+        TTime                               iStartTime;
+
+        /**
+        * The duration of connection
+        */
+        TTime                               iDuration;
+
+        /**
+        * Used for calculating speed data
+        */
+        TTime                               iLastSpeedUpdate;
+ 
+        /**
+        * The speed of transferring Uploaded data
+        */
+        div_t                               iUpSpeed;
+
+        /**
+        * The speed of transferring Downloaded data
+        */
+        div_t                               iDownSpeed;
+
+        /**
+        * The text of list item.
+        */
+        TBuf<KConnectionListItemText>       iListBoxItemText; 
+
+        /**
+        * Descriptor array, contains details of connection. Owned.
+        */
+        CDesCArrayFlat*                     iDetailsArray;
+        
+        /**
+        * ETrue if deletion of connection started form CMUI, EFalse otherwise
+        */
+        TBool								iDeletedFromCMUI;
+        
+        /**
+        * The names of applications use connection.Owned.
+        */
+        CDesCArrayFlat*                     iAppNames;
+        
+        /**
+        * The active object for info. refreshing. NOT Owned.
+        */
+        CActiveWrapper*                     iActiveWrapper;
+    };
+
+
+#endif //CONNECTIONINFOBASE_H_INCLUDED
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorui/inc/ConnectionMonitorUi.hrh	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2002 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 header file
+*     
+*
+*/
+
+
+#ifndef CONNECTIONMONITORUI_HRH
+#define CONNECTIONMONITORUI_HRH
+
+// Command ID-s for Option menu items
+enum TConnectionMonitorUiCommandIds
+    {
+    EConnectionMonitorUiCmdAppDetails = 1,
+    EConnectionMonitorUiCmdAppEndConn,
+    EConnectionMonitorUiCmdAppEndAll
+    };
+
+// Tab view Id-s
+enum TConnectionMonitorUiTabViewId
+    {
+    EConnectionMonitorUiMainViewTab = 2,
+    EConnectionMonitorUiDetailsViewTab
+    };
+
+
+#endif      // CONNECTIONMONITORUI_HRH
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorui/inc/ConnectionMonitorUiApp.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,70 @@
+/*
+* Copyright (c) 2002 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:  CConnectionMonitorUiApp application class
+*     
+*
+*/
+
+
+#ifndef CONNECTIONMONITORUIAPP_H
+#define CONNECTIONMONITORUIAPP_H
+
+// INCLUDES
+#include <aknapp.h>
+
+// CONSTANTS
+// UID of the application
+const TUid KUidConnectionMonitorUi = { 0x101F84D0 };
+
+const TInt KErrUnknownConnectionState   = -50000;
+const TInt KErrCorruptedBearerType      = -50001;
+
+/**
+* Global panic function
+*/
+extern void Panic( TInt aReason );
+
+// CLASS DECLARATION
+
+/**
+* CConnectionMonitorUiApp application class.
+* Provides factory to create concrete document object.
+* 
+*/
+class CConnectionMonitorUiApp : public CAknApplication
+    {
+    public:
+
+    public: // Functions from base classes
+
+    private:
+
+        /**
+        * From CApaApplication, creates CConnectionMonitorUiDocument
+        * @return A pointer to the created document object.
+        */
+        CApaDocument* CreateDocumentL();
+        
+        /**
+        * From CApaApplication, returns application's UID
+        * @return The value of KUidConnectionMonitorUi.
+        */
+        TUid AppDllUid() const;
+
+    };
+
+#endif  // CONNECTIONMONITORUIAPP_H
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorui/inc/ConnectionMonitorUiAppUi.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,312 @@
+/*
+* Copyright (c) 2002 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:  Application UI class
+*     
+*
+*/
+
+
+#ifndef CONNECTIONMONITORUIAPPUI_H
+#define CONNECTIONMONITORUIAPPUI_H
+
+// INCLUDES
+#include <aknViewAppUi.h>
+#include <aknnavide.h>
+#include <rconnmon.h>
+
+#include "ConnectionMonitorUiLogger.h"
+
+// FORWARD DECLARATIONS
+class CConnectionMonitorUiContainer;
+class CConnectionArray;
+class CConnectionInfoBase;
+
+class CFeatureManagerWrapper;
+class CActiveWrapper;
+
+// CONSTANTS
+
+/**
+* For iPeriodic Timer. The interval between events generated
+* after the initial delay, in microseconds.
+*/
+LOCAL_D const TInt KTickInterval = 1000000;
+
+
+// CLASS DECLARATION
+
+/**
+*
+*/
+class MActiveEventObserverInterface
+    {
+    public:
+        /**
+        * Called if MConnectionMonitorObserver is raised EventL event. 
+        * @param aConnMonEvent The event information.
+        * @param aIndex The index of connection in the iConnectionArray. 
+        */
+        virtual void OnEventL( const CConnMonEventBase& aConnMonEvent,
+                               const TInt aIndex ) = 0;
+
+        /**
+        * Called by iPeriodic. It refreshes details of connections.
+        */
+        virtual void OnTimerEventL() = 0;
+    };
+  
+/**
+*
+*/    
+class MTimerExpiredObserverInterface     
+    {
+    public:
+        /**
+        * Called by iPeriodic.
+        */
+        virtual void OnTimerExpiredL() = 0;   
+        
+        /**
+        * Gives back Timer interval.
+        */
+        virtual TInt GetTickInerval() const = 0; 
+    };
+
+/**
+* Application UI class.
+* Provides support for the following features:
+* - EIKON control architecture
+* - view architecture
+* - status pane
+* 
+*/
+class CConnectionMonitorUiAppUi : public CAknViewAppUi,
+                                  public MConnectionMonitorObserver,
+                                  public MTimerExpiredObserverInterface
+    {
+    public: // Constructors and destructor
+        /**
+        * EPOC default constructor.
+        */      
+        void ConstructL();
+
+        /**
+        * Destructor.
+        */      
+        ~CConnectionMonitorUiAppUi();
+
+    public:
+        /**
+        * Returns pointer to AppUi object.
+        */      
+        static CConnectionMonitorUiAppUi* Static();
+
+        /**
+        * from MConnectionMonitorObserver
+        */
+        void EventL( const CConnMonEventBase &aConnMonEvent );
+
+    public:
+        /**
+        * Register and start connection monitor engine callback notification,
+        * and starts periodic timer.
+        * @param aObserver Observer object
+        */
+        void StartConnEventNotification( 
+                                    MActiveEventObserverInterface* aObserver );
+
+        /**
+        * Stops connection monitor notification and periodic timer
+        * @param aObserver Observer object
+        */
+        void StopConnEventNotification( 
+                                    MActiveEventObserverInterface* aObserver );
+
+        /**
+        * Starts iPeriodic.
+        * @param aInterval Refresh interval
+        */
+        void StartTimerL( const TInt aInterval = KTickInterval );
+
+        /**
+        * Stops iPeriodic.
+        */
+        void StopTimer();
+
+        /**
+        * Timer callback of iPeridoc.
+        */
+        static TInt Tick( TAny* aObject );
+        
+        /**
+        * called by Tick( TAny* aObject ).
+        */
+        TInt Tick();        
+
+        /**
+        * Delete and remove a connection from the View
+        * @param aConnId the id of the currect selected connection
+        * @param aConnInfo pointer to the current selected connection
+        */
+        void DeleteDetailsView( 
+                            TInt aConnId, CConnectionInfoBase* aConnInfo );
+
+#ifdef RD_CONTROL_PANEL
+    
+        /**
+        * This function is used for querying whether the application
+        * is launched in embedded mode or not.
+        * @return ETrue:  The application is launched in embedded mode.
+        *         EFalse: The application is launched in standalone mode.
+        */
+        TBool IsEmbedded() const;
+
+#endif // RD_CONTROL_PANEL        
+
+    protected:
+        /**
+        * from CCoeAppUi, for icon skinning
+        */
+        void HandleForegroundEventL( TBool aForeground );
+
+    private:
+        /**
+        * From MEikMenuObserver
+        */
+        void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
+
+        /**
+        * From CEikAppUi, takes care of command handling.
+        * @param aCommand command to be handled
+        */
+        void HandleCommandL( TInt aCommand );
+
+        /**
+        * From CEikAppUi, handles key events.
+        * @param aKeyEvent Event to handled.
+        * @param aType Type of the key event. 
+        * @return Response code ( EKeyWasConsumed, EKeyWasNotConsumed ). 
+        */
+        virtual TKeyResponse HandleKeyEventL(
+                                const TKeyEvent& aKeyEvent, TEventCode aType );
+
+        /**
+        * Called by Tick.
+        */
+        void OnTimerExpiredL( );
+        
+        /**
+        * Gives back Timer interval.
+        */        
+        TInt GetTickInerval() const;         
+        
+        /**
+        * Call one after the other RefreshDetails() function of connections
+        * which are contained by iConnectionArray.
+        */
+        void RefreshAllConnectionsL();
+
+        /**
+        * Creates a CConnectionInfBase class, the given connection id. 
+        * The Dynamic type of the returned class depends on the bearer type 
+        * of the connection.
+        * @params aConnectionId the id of the connection
+		* @params aBearerType the bearer type of the connection
+        * @return CConnectionInfBase instance, The Dynamic type of the returned
+        * class depends on the bearer type of the connection.
+        */
+        CConnectionInfoBase* CreateConnectionInfoL( TUint aConnectionId, TConnMonBearerType aBearerType );
+            
+        /**
+        * Initialize connection array
+        */
+        void InitializeConnectionArrayL();
+        
+        /**
+        * Gets the IAP of Easy Wlan access point
+        */
+        void GetEasyWlanIAPNameL();
+
+        /**
+        * Shows connection summary note.
+        * @param aConnection
+        */        
+        void ShowConnectionSummaryInformationNoteL( 
+        							const CConnectionInfoBase* aConnection );
+    private: // Data
+
+        /**
+        * For refresh details of connections.
+        */
+        RConnectionMonitor              iMonitor;       
+       
+        /**
+        * Contains CConnectionInfoBase instances, which are represents 
+        * the connections in the system.
+        */
+        CConnectionArray*               iConnectionArray; // Owned
+        
+        /**
+        * Timer, to refresh details of connections
+        */
+        CPeriodic*                      iPeriodic;  // Owned
+        
+        /**
+        * Actual observer instance. This observer handles refreshing details
+        * of connection on the screen.
+        */
+        MActiveEventObserverInterface*  iObserver;  // Not owned
+                
+        /**
+        * CFeatureManagerWrapper wraps FeatureManager to eliminate maintenance 
+        * of existance of FeatureManager.
+        * Owned.
+        */
+        CFeatureManagerWrapper*         iFeatureManagerWrapper;
+        
+        /**
+        * The active object for info. refreshing. Owned.
+        */
+        CActiveWrapper*                 iActiveWrapper;
+
+        /**
+        * the name of Easy Wlan access point it there is, otherwise NULL
+        */
+        HBufC*                          iEasyWlanIAPName;        
+                
+        /**
+        * A pointer to actual timer observer instance
+        */
+        MTimerExpiredObserverInterface* iTimerObserver;
+
+        /**
+        * Should the Main View be activeted during HandleForegroundEventL() method
+        */
+        TBool activateMainView;
+        
+        /**
+         * An array to hold the connectionIds in situations when creating
+         * connectionInfo object fails
+         */
+        RArray<TUint> iNewConnectionIdArray;
+        
+        /**
+         * Connections waiting for first event
+         */
+        RArray<TInt> iConnectionsWaitingFirstEvent;
+    };
+
+#endif  // CONNECTIONMONITORUIAPPUI_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorui/inc/ConnectionMonitorUiContainer.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,207 @@
+/*
+* Copyright (c) 2002 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 control class
+*     
+*
+*/
+
+
+#ifndef CONNECTIONMONITORUICONTAINER_H
+#define CONNECTIONMONITORUICONTAINER_H
+
+// INCLUDES
+#include <AknUtils.h>
+#include "ConnectionMonitorUiAppUi.h"
+   
+// FORWARD DECLARATIONS
+class CConnectionArray;
+class RConnectionMonitor;
+class CAknNavigationDecorator;
+class CAknNavigationControlContainer;
+class CActiveWrapper;
+
+// CLASS DECLARATION
+/**
+*  CConnectionMonitorUiContainer  container control class.
+*/
+class CConnectionMonitorUiContainer : public CCoeControl,
+                                      public MActiveEventObserverInterface
+    {
+    public: // Constructors and destructor
+        /**
+        * Constructor
+        * @param aConnectionArray array contains connection infos
+        * @param aMonitor to handlin connection details
+        * @param aActiveWrapper the for refreshing
+        */
+        CConnectionMonitorUiContainer( 
+                                     CConnectionArray* const aConnectionArray,
+                                     RConnectionMonitor* aMonitor,
+                                     CActiveWrapper* aActiveWrapper );
+        
+        /**
+        * Second phase constructor.
+        * @param aSelectedItem index of selected item in the list
+        * @param aRect Frame rectangle for container.        
+        */
+        void ConstructL( TInt aSelectedItem, const TRect& aRect  );
+
+        /**
+        * Destructor.
+        */
+        ~CConnectionMonitorUiContainer();
+
+    public: // Functions from base classes
+    
+        /** 
+        * From CCoeControl, gets the control's help context.
+     	* @param aContext help context.
+        */
+        virtual void GetHelpContext( TCoeHelpContext& aContext ) const;
+
+        /**
+        * From CoeControl OfferKeyEventL.
+        */
+        TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,
+                                     TEventCode aType );
+
+        /**
+        * From CoeControl,CountComponentControls.
+        */
+        TInt CountComponentControls() const;
+
+        /**
+        * From CCoeControl, ComponentControl.
+        */
+        CCoeControl* ComponentControl( TInt aIndex ) const;
+
+        /**
+        * From CCoeControl        
+        */
+        void HandleResourceChange( TInt aType ) ;
+        
+    public:  
+        /**
+        * from MActiveEventObserverInterface
+        */
+        void OnEventL( const CConnMonEventBase& aConnMonEvent, 
+                       const TInt aIndex );
+        /**
+        * from MActiveEventObserverInterface
+        */
+        void OnTimerEventL();
+
+        /**
+        * Returns the item index of selected connection
+        * @return index of selected connection
+        */
+        TInt SelectedConnection();
+
+        /**
+        * Close the selected connection.
+        */
+        void EndConnectionL();
+
+        /**
+        * Close all connection
+        */
+        void EndAllConnectionL();
+
+        /**
+        * Returns pointer to the listbox.
+        * @return pointer to the listbox.
+        */
+        CAknDoubleGraphicStyleListBox*  ListBox() const;
+
+        /**
+        * Refresh the content of Navi pane and 
+        * Push it to stack. Called by View DoActivateL()
+        */
+        void PushAndRefreshNaviPaneL();
+
+        /**
+        * Pop and destroy the NaviPane from stack. 
+        * Called by View DoDeactivateL()
+        */
+        void PopNaviPane();
+
+        /**
+        * Called by HandleForegroundEventL, draw all item of list box.
+        */
+        void DrawFirstAllListBoxItem();
+    
+    protected:
+        /**
+        * From CoeControl,SizeChanged.
+        */
+        void SizeChanged();
+        
+        /**
+        * From CoeControl,SizeChanged.
+        */        
+        virtual void FocusChanged(TDrawNow aDrawNow);
+
+    protected: // New functions
+        /**
+        * Sets the icons of listbox
+        */
+        void SetIconsL();
+
+        /**
+        * Gets the title panes.
+        */
+        void GetPanesL();        
+
+    protected: // data
+        /**
+        * List box contains connection items
+        */
+        CAknDoubleGraphicStyleListBox* iListBox;
+        
+        /**
+        * To handling details of connections
+        */
+        RConnectionMonitor* iMonitor;   
+
+        /**
+        * Contins connections info
+        */
+        CConnectionArray* const iConnectionArray;
+
+        /**
+        * Owned. For NaviPane.
+        */
+        CAknNavigationDecorator* iNaviDecorator;
+
+        /**
+        * Not Owned. For NaviPane.
+        */
+        CAknNavigationControlContainer* iNaviPane;
+    
+    private: // data
+
+        /**
+        * ETrue if Wlan connection is supported, EFalse otherwise.
+        */
+        TBool isWlanSupported;
+        
+        /**
+        * The active object for info. refreshing. NOT Owned.
+        */
+        CActiveWrapper* iActiveWrapper;
+    };
+
+#endif // CONNECTIONMONITORUICONTAINER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorui/inc/ConnectionMonitorUiDetailsContainer.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,201 @@
+/*
+* Copyright (c) 2002 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 control class
+*     
+*
+*/
+
+#ifndef CONNECTIONMONITORUIDETAILSCONTAINER_H
+#define CONNECTIONMONITORUIDETAILSCONTAINER_H
+
+// INCLUDES
+#include <aknlists.h>
+#include "ConnectionMonitorUiAppUi.h"
+
+// FORWARD DECLARATIONS
+class CConnectionArray;
+class CAknNavigationDecorator;
+class CAknNavigationControlContainer;
+class CConnectionMonitorUiDetailsView;
+
+// CLASS DECLARATION
+/**
+*  CConnectionMonitorUiDetailsContainer  container control class.
+*/
+class CConnectionMonitorUiDetailsContainer : 
+                                          public CCoeControl,
+                                          public MActiveEventObserverInterface,
+                                          public MAknNaviDecoratorObserver
+    {
+    public: // Constructors and destructor
+        /**
+        * Constructor
+        * @param aConnectionArray array containing connection list
+        */
+        CConnectionMonitorUiDetailsContainer( 
+                            const CConnectionArray* const aConnectionArray );
+
+        /**
+        * EPOC second-phase constructor.
+        * @param aRect Frame rectangle for container.
+        * @param aParentView ParentView of the container
+        */
+        void ConstructL( const TRect& aRect, 
+                              CConnectionMonitorUiDetailsView* aParentView );
+
+        /**
+        * Destructor.
+        */
+        ~CConnectionMonitorUiDetailsContainer();
+
+    public: // New functions
+        /**
+        * Sets iConnectionInfo and iConnectionId to the selected
+        * connection
+        * @param aConnectionIndex the index of selected connection
+        */
+        void SetSelectedConnectionL( TUint aConnectionIndex );
+
+        /**
+        * Returns pointer to the listbox.
+        * @return pointer to the listbox.
+        */
+        CAknSingleHeadingStyleListBox* ListBox() const;
+
+        /**
+        * Refresh the content of Navi pane and 
+        * Push it to stack. Called by View DoActivateL()
+        */
+        void PushAndRefreshNaviPaneL();
+
+        /**
+        * Pop the NaviPane from stack. Called by View DoDeactivateL()
+        */
+        void PopNaviPane();
+
+
+    public: 
+        /**
+         * Handler for pointer events, when the Navi Pane arrows have been tapped (from MAknNaviDecoratorObserver)
+         *
+         * @param aEventID  The enum indicating wether right or left arrow was tapped
+         */
+        void HandleNaviDecoratorEventL( TInt aEventID ); 
+
+        /**
+        * from MActiveEventObserverInterface
+        */
+        virtual void OnEventL( const CConnMonEventBase& aConnMonEvent,
+                               const TInt aIndex );
+
+        /**
+        * from MActiveEventObserverInterface
+        */
+        void OnTimerEventL();
+
+        /**
+        * From CCoeControl
+        */
+        TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,
+                                     TEventCode aType );
+
+        /**
+        * Called by HandleForegroundEventL, draw all item of list box.
+        */
+        void DrawFirstAllListBoxItem();
+
+        /**
+        * From CCoeControl,ComponentControl.
+        */
+        CCoeControl* ComponentControl( TInt aIndex ) const;
+        
+	    /**
+        * From CCoeControl, used for sclable ui and landscape support.
+        */        
+        void HandleResourceChange( TInt aType );    
+        
+        /**
+        * Gets index of the selected item
+        * @return the index of selected item
+        */
+        TInt GetIndexOfSelectedItem(); 
+        
+        /**
+        * Gets iConnectionInfo of the selected connection
+        * @return CConnectionInfoBase* pointer to the connection info object
+        */
+        CConnectionInfoBase* GetSelectedConnectionInfo() const;
+
+    protected:
+        /**
+        * Gets the title panes.
+        */
+        void GetPanesL();
+
+    private: // Functions from base classes
+        /**
+        * From CoeControl,SizeChanged.
+        */
+        void SizeChanged();
+
+        /**
+        * From CoeControl,CountComponentControls.
+        */
+        TInt CountComponentControls() const;
+        
+        /**
+        * From CoeControl,SizeChanged.
+        */        
+        virtual void FocusChanged(TDrawNow aDrawNow);        
+
+    protected: // data       
+        /**
+        * Listbox contains details a connection
+        */
+        CAknSingleHeadingStyleListBox* iListBox;
+
+        /**
+        * Refers to the current selected connection
+        */
+        CConnectionInfoBase*            iConnectionInfo;    // Not Owned.
+
+        /**
+        * The index of selected connection
+        */
+        TUint                           iConnectionIndex;
+        
+        /**
+        * A pointer to connections array
+        */
+        const CConnectionArray* const   iConnectionArray; // Not Owned.
+
+        /**
+        * Owned. For NaviPane.
+        */
+        CAknNavigationDecorator*        iNaviDecorator;
+
+        /**
+        * Not Owned. For NaviPane.
+        */
+        CAknNavigationControlContainer* iNaviPane;
+
+        /**
+        * Not Owned. A pointer to DetailsView
+        */
+        CConnectionMonitorUiDetailsView* iParentView; // Not Owned.
+    };
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorui/inc/ConnectionMonitorUiDetailsView.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,154 @@
+/*
+* Copyright (c) 2002 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:  view class
+*     
+*
+*/
+
+
+#ifndef CONNECTIONMONITORUIDETAILSVIEW_H
+#define CONNECTIONMONITORUIDETAILSVIEW_H
+
+// INCLUDES
+#include <aknview.h>
+#include <aknlists.h>
+
+// CONSTANTS
+
+/**
+* UID of view
+*/
+const TUid KDetailsViewId = {3};
+
+// FORWARD DECLARATIONS
+class CConnectionMonitorUiDetailsContainer;
+class CConnectionInfo;
+class CConnectionInfoBase;
+class CConnectionArray;
+
+// CLASS DECLARATION
+/**
+*  CConnectionMonitorUiDetailsView view class.
+*/
+class CConnectionMonitorUiDetailsView : public CAknView, 
+                                        public MEikListBoxObserver
+    {
+    public: // Constructors and destructor
+        /**
+        * Constructor 
+        * @param aConnectionArray array containing connection list
+        */
+        CConnectionMonitorUiDetailsView( 
+                              const CConnectionArray* const aConnectionArray );
+
+        /**
+        * EPOC second phase constructor.
+        */
+        void ConstructL();
+
+        /**
+        * Destructor.
+        */
+        ~CConnectionMonitorUiDetailsView();
+
+    public: // Functions from base classes        
+        /**
+        * From CAknView
+        */
+        TUid Id() const;
+
+        /**
+        * From CAknView
+        */
+        void HandleCommandL( TInt aCommand );
+        
+    public: // New functions
+        /**
+        * Call SetSelectedConnection function of iContrainer  
+        * @param aIndex index of connection in the connection array
+        */
+        void SetSelectedConnection( TUint aIndex );
+        
+        /**
+        * Returns index of selected connection 
+        * @return index of selected connection in the connection array
+        */
+        TUint GetSelectedConnection();
+
+        /**
+        * Returns ETrue if the refreshing stopped for the View
+        * @return the staus of View refreshing
+        */
+        TBool GetViewRefreshState();
+
+        /**
+        * Set the View the refreshing status. Stopped or not
+        * @param aViewRefreshState staus of View refreshing
+        */
+        void SetViewRefreshState( TBool aViewRefreshState );
+
+        /**
+        * Closes the Details View.
+        */
+        void CloseViewL();
+
+        /**
+        * Activate the Main View
+        */
+        void ActivateMainViewL();
+
+    protected:
+        /**
+        * From AknView
+        */
+        void DoActivateL( const TVwsViewId& aPrevViewId, 
+                          TUid aCustomMessageId,
+                          const TDesC8& aCustomMessage );
+
+        /**
+        * From AknView
+        */
+        void DoDeactivate();
+
+        /** 
+        * From MEikListBoxObserver    
+        */
+        void HandleListBoxEventL( CEikListBox* aListBox, 
+                                  TListBoxEvent aEventType );
+
+    private: // Data
+        /**
+        * Container of View
+        */
+        CConnectionMonitorUiDetailsContainer*   iContainer;
+
+        /**
+        * Array contains connections
+        */
+        const CConnectionArray* const           iConnectionArray; // Not Owned.
+
+        /**
+        * The index of selected connection
+        */
+        TUint                                   iConnectionId;
+
+        /**
+        * Staus of View refreshing. If the refreshing stopped its ETrue
+        */
+        TBool                                   iViewRefreshState;
+    };
+
+#endif // CONNECTIONMONITORUIDETAILSVIEW_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorui/inc/ConnectionMonitorUiDocument.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,72 @@
+/*
+* Copyright (c) 2002 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:  application class
+*     
+*
+*/
+
+
+#ifndef CONNECTIONMONITORUIDOCUMENT_H
+#define CONNECTIONMONITORUIDOCUMENT_H
+
+// INCLUDES
+#include <AknDoc.h>
+   
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class  CEikAppUi;
+
+// CLASS DECLARATION
+
+/**
+*  CConnectionMonitorUiDocument application class.
+*/
+class CConnectionMonitorUiDocument : public CAknDocument
+    {
+    public: // Constructors and destructor
+        /**
+        * Two-phased constructor.
+        * @param aApp Eikon Application
+        */
+        static CConnectionMonitorUiDocument* NewL(CEikApplication& aApp);
+
+        /**
+        * Destructor.
+        */
+        virtual ~CConnectionMonitorUiDocument();
+
+    public: // New functions
+
+    private:
+
+        /**
+        * EPOC default constructor.
+        * @param aApp Eikon Application
+        */
+        CConnectionMonitorUiDocument(CEikApplication& aApp);
+        void ConstructL();
+
+    private:
+
+        /**
+        * From CEikDocument, create CConnectionMonitorUiAppUi "App UI" object.
+        */
+        CEikAppUi* CreateAppUiL();
+    };
+
+#endif // CONNECTIONMONITORUIDOCUMENT_H
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorui/inc/ConnectionMonitorUiLogger.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,107 @@
+/*
+* Copyright (c) 2002 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 support for R&D purposes
+*
+*
+*/
+
+
+#ifndef CONNECTIONMONITORUILOGGER_H_INCLUDED
+#define CONNECTIONMONITORUILOGGER_H_INCLUDED
+
+// ========== INCLUDE FILES ================================
+
+#include <eikenv.h>
+#include <flogger.h>
+
+// ========== CONSTANTS ====================================
+
+#ifdef _DEBUG
+
+_LIT( KCMUILogDir,              "CMUI");
+_LIT( KCMUILogFile,             "CMUI.txt");
+_LIT(KCMUILogBanner,            "CMUI 0.1.0");
+_LIT(KCMUILogEnterFn,           "CMUI: -> %S");
+_LIT(KCMUILogLeaveFn,           "CMUI: <- %S");
+_LIT(KCMUILogExit,              "CMUI: Application exit");
+_LIT( KCMUILogTimeFormatString, "%H:%T:%S:%*C2");
+
+// ========== MACROS =======================================
+
+#define CMUILOGGER_CREATE             {FCreate();}
+#define CMUILOGGER_DELETE             {RFileLogger::Write(KCMUILogDir, KCMUILogFile, EFileLoggingModeAppend, KCMUILogExit);}
+#define CMUILOGGER_ENTERFN(a)         {_LIT(temp, a); RFileLogger::WriteFormat(KCMUILogDir, KCMUILogFile, EFileLoggingModeAppend, KCMUILogEnterFn, &temp);}
+#define CMUILOGGER_LEAVEFN(a)         {_LIT(temp, a); RFileLogger::WriteFormat(KCMUILogDir, KCMUILogFile, EFileLoggingModeAppend, KCMUILogLeaveFn, &temp);}
+#define CMUILOGGER_WRITE(a)           {_LIT(temp, a); RFileLogger::Write(KCMUILogDir, KCMUILogFile, EFileLoggingModeAppend, temp);}
+#define CMUILOGGER_WRITE_F(a, b)      {_LIT(temp, a); RFileLogger::WriteFormat(KCMUILogDir, KCMUILogFile, EFileLoggingModeAppend, temp, b);}
+#define CMUILOGGER_WRITE_TIMESTAMP(a) {_LIT(temp, a); TTime time; time.HomeTime(); TBuf<256> buffer; time.FormatL( buffer, KCMUILogTimeFormatString ); buffer.Insert(0, temp); RFileLogger::Write(KCMUILogDir, KCMUILogFile, EFileLoggingModeAppend, buffer); }
+#define CMUILOGGER_WRITEF             FPrint
+
+
+inline void FPrint(const TRefByValue<const TDesC> aFmt, ...)
+    {
+    VA_LIST list;
+    VA_START(list,aFmt);
+    RFileLogger::WriteFormat(KCMUILogDir, KCMUILogFile, EFileLoggingModeAppend, aFmt, list);
+    }
+
+inline void FPrint(const TDesC& aDes)
+    {
+    RFileLogger::WriteFormat(KCMUILogDir, KCMUILogFile, EFileLoggingModeAppend, aDes);
+    }
+
+inline void FHex(const TUint8* aPtr, TInt aLen)
+    {
+    RFileLogger::HexDump(KCMUILogDir, KCMUILogFile, EFileLoggingModeAppend, 0, 0, aPtr, aLen);
+    }
+
+inline void FHex(const TDesC8& aDes)
+    {
+    FHex(aDes.Ptr(), aDes.Length());
+    }
+
+inline void FCreate()
+    {
+    TFileName path(_L("c:\\logs\\"));
+    path.Append(KCMUILogDir);
+    path.Append(_L("\\"));
+    RFs& fs = CEikonEnv::Static()->FsSession();
+    fs.MkDirAll(path);
+    RFileLogger::WriteFormat(KCMUILogDir, KCMUILogFile, EFileLoggingModeOverwrite, KCMUILogBanner);
+    }
+
+#else // ! _DEBUG
+
+inline void FPrint(const TRefByValue<const TDesC> /*aFmt*/, ...) { };
+
+#define CMUILOGGER_CREATE
+#define CMUILOGGER_DELETE
+#define CMUILOGGER_ENTERFN(a)
+#define CMUILOGGER_LEAVEFN(a)
+#define CMUILOGGER_WRITE(a)
+#define CMUILOGGER_WRITE_F(a, b)
+#define CMUILOGGER_WRITEF   1 ? ((void)0) : FPrint
+#define CMUILOGGER_WRITE_TIMESTAMP(a)
+
+#endif // _DEBUG
+
+// ========== DATA TYPES ===================================
+
+// ========== FUNCTION PROTOTYPES ==========================
+
+// ========== FORWARD DECLARATIONS =========================
+
+// ========== CLASS DECLARATION ============================
+
+#endif // CONNECTIONMONITORUILOGGER_H_INCLUDED
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorui/inc/ConnectionMonitorUiView.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,177 @@
+/*
+* Copyright (c) 2002 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:  view class
+*     
+*
+*/
+
+
+#ifndef CONNECTIONMONITORUI_VIEW_H
+#define CONNECTIONMONITORUI_VIEW_H
+
+// INCLUDES
+#include <aknview.h>
+#include <aknlists.h>
+
+// CONSTANTS
+
+// UID of view
+const TUid KConnectionsViewId = {2};
+
+// FORWARD DECLARATIONS
+class CConnectionMonitorUiContainer;
+class CConnectionArray;
+class CActiveWrapper;
+
+// CLASS DECLARATION
+/**
+*  CConnectionMonitorUiView view class.
+*/
+class CConnectionMonitorUiView : public CAknView, public MEikListBoxObserver
+    {
+    public: // Constructors and destructor
+        /**
+        * Constructor
+        * @param aConnectionArray array contains connection infos
+        * @param aMonitor Connection Monitor engine session
+        * @param aActiveWrapper the for refreshing
+        */
+#ifdef RD_CONTROL_PANEL        
+        CConnectionMonitorUiView( CConnectionArray* const aConnectionArray,
+                                  RConnectionMonitor* aMonitor,
+                                  TBool aIsEmbedded,
+                                  CActiveWrapper* aActiveWrapper );
+#else
+        CConnectionMonitorUiView( CConnectionArray* const aConnectionArray,
+                                  RConnectionMonitor* aMonitor,
+                                  CActiveWrapper* aActiveWrapper );
+#endif // RD_CONTROL_PANEL                                  
+
+        /**
+        * EPOC default constructor.
+        */
+        void ConstructL();
+
+        /**
+        * Destructor.
+        */
+        ~CConnectionMonitorUiView();
+
+    public: // Functions from base classes
+        /**
+        * From AknView
+        */
+        TUid Id() const;
+
+        /**
+        * From AknView
+        */
+        void HandleCommandL( TInt aCommand );
+
+        /**
+        * From MEikMenuObserver 
+        * Dynamic handling of menus.
+        */
+        virtual void DynInitMenuPaneL( TInt aResourceId,
+                                       CEikMenuPane* aMenuPane );
+
+        /**
+        * Observe the connection stat and set the right Soft Keys.
+        */
+        void ConnectionKeyObserver() const;
+        
+    protected: 
+        /**
+        * from MEikListBoxObserver    
+        */
+        void HandleListBoxEventL( CEikListBox* aListBox, 
+                                  TListBoxEvent aEventType );
+
+    protected:
+        /**
+        * From AknView
+        */
+        void DoActivateL( const TVwsViewId& aPrevViewId,
+                          TUid aCustomMessageId,
+                          const TDesC8& aCustomMessage );
+
+        /**
+        * From AknView
+        */
+        void DoDeactivate();
+
+        /**
+        * Sets the tile pane to the given resource.
+        * @param aResourceId the id of resource string
+        */
+        void SetTitlePaneTextL( TInt aResourceId );
+
+    private:
+        /**
+        * Brings up details view.
+        */
+        void BringupDetailsViewL();
+        
+        /**
+        * Check if selecred connection is Alilve or not
+        * @return if the selected connection is alive ETrue, oterwise EFalse
+        */
+        TBool IsSelectedConnectionAlive() const;
+        
+        /**
+        * Check if selecred connection is Suspended or not
+        * @return if the selected connection is alive ETrue, oterwise EFalse
+        */
+        TBool IsSelectedConnectionSuspended() const;
+
+    private: // Data   
+        /**
+        * Continer instance of view.
+        */
+        CConnectionMonitorUiContainer*        iContainer; // Owned
+
+        /**
+        * Constant pointe to array of connections.
+        */
+        CConnectionArray* const             iConnectionArray; // Not Owned
+        
+        /**
+        * Pointer to RConnectionMonitor for deleting connection(s).
+        */
+        RConnectionMonitor*                 iMonitor;  // Not Owned
+                
+        /**
+        * ETrue if Help is supported, EFalse otherwise.
+        */
+        TBool isHelpSupported;
+
+#ifdef RD_CONTROL_PANEL
+
+        /**
+        * ETrue:  The application is launched in embedded mode.
+        * EFalse: The application is launched in standalone mode.
+        */
+        TBool iIsEmbedded;
+
+#endif // RD_CONTROL_PANEL
+
+        /**
+        * The active object for info. refreshing. NOT Owned.
+        */
+        CActiveWrapper* iActiveWrapper;
+    };
+
+#endif // CONNECTIONMONITORUI_VIEW_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorui/inc/CsdConnectionInfo.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,129 @@
+/*
+* Copyright (c) 2004 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:  Represents a connection
+*     
+*
+*/
+
+
+#ifndef CSDCONNECTIONINFO_H_INCLUDED
+#define CSDCONNECTIONINFO_H_INCLUDED
+
+// INCLUDES
+#include    <rconnmon.h>
+#include    <stdlib.h>
+#include    "ConnectionInfoBase.h"
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+* Represents a connection.
+*/
+class CCsdConnectionInfo : public CConnectionInfoBase     
+    {
+    public: 
+        /**
+        * Static constructor
+        * @param aConnectionId The id of the given connection.
+        * @param aMonitor for refreshing details
+        * @param aConnectionBearerType the bearer type of connection
+        * @param aActiveWrapper the for refreshing
+        */
+        static CCsdConnectionInfo* NewL( TInt aConnectionId, 
+                                  RConnectionMonitor* const aConnectionMonitor,
+                                  TConnMonBearerType aConnectionBearerType,
+                                  CActiveWrapper* aActiveWrapper );
+                
+        /**
+        * Destructor
+        */
+        virtual ~CCsdConnectionInfo();
+    public:
+    
+        /**
+        * Give back a copy of connection. 
+        */
+        virtual CConnectionInfoBase* DeepCopyL();
+    
+        /**
+        * Refresh required details of connection. 
+        */
+        virtual void RefreshDetailsL();
+
+        /**
+        * Refresh iListBoxItemText text, connection ListBox has a reference to
+        * this text.
+        */
+        virtual void RefreshConnectionListBoxItemTextL();
+
+        /**
+        * Refresh details array of connection. DetailsListBox has a reference
+        * to this array.
+        */
+        virtual void RefreshDetailsArrayL();
+
+        /**
+        * Gives back the icon id of connection type
+        * @return the icon id of connection type
+        */
+        virtual TUint GetIconId() const;
+
+    protected:
+        /**
+        * Constructor
+        * @param aConnectionId The id of the given connection.
+        * @param aMonitor for refreshing details
+        * @param aConnectionBearerType the bearer type of connection
+        * @param aActiveWrapper the for refreshing
+        */
+        CCsdConnectionInfo(  TInt aConnectionId, 
+                             RConnectionMonitor* const aConnectionMonitor,
+                             TConnMonBearerType aConnectionBearerType,
+                             CActiveWrapper* aActiveWrapper );
+
+        /**
+        * Second phase construction
+        */
+        void ConstructL();
+
+    protected:
+        /**
+        * Creates an array with requrired details of connection to
+        * the listbox which visulaize details of connection. This member
+        * is called at initialization.
+        */
+        virtual void ToArrayDetailsL();
+
+        /**
+        * Creates a string from dialup number of the connection.
+        * @return string representation count of sharigs of the connection.
+        */
+        HBufC* ToStringDialupNumberLC() const;
+
+    private:
+
+    protected: // Data members
+    
+        TBuf<KTelNumber>    iDialupNumber;  ///< DialupNumber of connection
+        
+    };
+
+
+#endif // CSDCONNECTIONINFO_H_INCLUDED
+
+// Enf of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorui/inc/EasyWLANConnectionInfo.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,102 @@
+/*
+* Copyright (c) 2004 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:  Represents a WLAN connection
+*     
+*
+*/
+
+
+#ifndef EASYWLANCONNECTIONINFO_H_INCLUDED
+#define EASYWLANCONNECTIONINFO_H_INCLUDED
+
+// INCLUDES
+#include "WlanConnectionInfo.h"
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class RConnectionMonitor;
+
+// CLASS DECLARATION
+/**
+* Represents a WLAN connection.
+*/
+class CEasyWlanConnectionInfo : public CWlanConnectionInfo
+    {
+    public:
+        /**
+        * Static constructor
+        * @param aConnectionId The id of the given connection.
+        * @param aMonitor for refreshing details
+        * @param aConnectionBearerType the bearer type of connection
+        * @param aActiveWrapper the for refreshing
+        */
+        static CEasyWlanConnectionInfo* NewL( TInt aConnectionId, 
+                              RConnectionMonitor* const aConnectionMonitor,
+                              TConnMonBearerType aConnectionBearerType,
+                              CActiveWrapper* aActiveWrapper );
+
+        /**
+        * Destructor
+        */
+        virtual ~CEasyWlanConnectionInfo();
+        
+    public:
+        /**
+        * Give back a copy of connection. 
+        */
+        virtual CConnectionInfoBase* DeepCopyL();
+    
+        /**
+        * Refresh iListBoxItemText text, connection ListBox has a 
+        * reference to this text.
+        */
+        virtual void RefreshConnectionListBoxItemTextL();
+
+        /**
+        * Refresh details array of connection. 
+        * DetailsListBox has a reference to this array.
+        */
+        virtual void RefreshDetailsArrayL();
+
+    protected:  // Constructors
+        /**
+        * Constructor
+        * @param aConnectionId The id of the given connection.
+        * @param aMonitor for refreshing details
+        * @param aConnectionBearerType the bearer type of connection
+        * @param aActiveWrapper the for refreshing
+        */
+        CEasyWlanConnectionInfo( TInt aConnectionId, 
+                             RConnectionMonitor* const aConnectionMonitor,
+                             TConnMonBearerType aConnectionBearerType,
+                             CActiveWrapper* aActiveWrapper );
+
+        /**
+        * Second phase construction
+        */
+        void ConstructL();
+
+    protected:
+        /**
+        * Creates an array with requrired details of connection to
+        * the listbox which visulaize details of connection. This member
+        * is called at initialization.
+        */
+        virtual void ToArrayDetailsL();
+
+    };
+
+#endif // EASYWLANCONNECTIONINFO_H_INCLUDED
+//End of File.
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorui/inc/FeatureManagerWrapper.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,69 @@
+/*
+* Copyright (c) 2004 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 CFeatureManagerWrapper.
+*
+*/
+
+
+#ifndef FEATURE_MANAGER_WRAPPER_H
+#define FEATURE_MANAGER_WRAPPER_H
+
+// INCLUDE FILES
+#include    <e32base.h>        //CBase
+#include    <featmgr.h>
+
+// CLASS DECLARATION
+
+/**
+* CFeatureManagerWrapper wraps FeatureManager to ease its usage
+*/
+class CFeatureManagerWrapper :  public CBase
+    {  
+   
+   public:
+
+       /**
+       * Destructor. Uninitalize FeatureManager.
+       */
+       virtual ~CFeatureManagerWrapper();
+    
+       /**
+       * Static constructor.
+       */
+       static CFeatureManagerWrapper* NewL();        
+        
+   protected:
+
+       /**
+       * Default constructor.
+       */
+       CFeatureManagerWrapper();
+
+       /**
+       * Second-phase constructor. Initialize FeatureManager
+       */
+       void ConstructL();
+   
+   private:
+
+       /**
+       * Indicates Featuremanger is initialized or not.
+       */
+       TBool iIsFeatureMgrInitialized; 
+    
+    };
+
+#endif
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorui/inc/GprsConnectionInfo.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,135 @@
+/*
+* Copyright (c) 2004 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:  Represents a connection
+*     
+*
+*/
+
+
+#ifndef GPRSCONNECTIONINFO_H_INCLUDED
+#define GPRSCONNECTIONINFO_H_INCLUDED
+
+// INCLUDES
+#include    <rconnmon.h>
+#include    <stdlib.h>
+#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include    <commsdat.h>
+#else
+#include    <commsdat.h>
+#include    <commsdat_partner.h>
+#endif
+#include    "ConnectionInfoBase.h"
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+* Represents a connection.
+*/
+class CGprsConnectionInfo : public CConnectionInfoBase      
+    {
+    public: 
+        /**
+        * Static constructor
+        * @param aConnectionId The id of the given connection.
+        * @param aMonitor for refreshing details
+        * @param aConnectionBearerType the bearer type of connection
+        * @param aActiveWrapper the for refreshing
+        */
+        static CGprsConnectionInfo* NewL( TInt aConnectionId, 
+                                  RConnectionMonitor* const aConnectionMonitor,
+                                  TConnMonBearerType aConnectionBearerType,
+                                  CActiveWrapper* aActiveWrapper );
+                
+        /**
+        * Destructor
+        */
+        virtual ~CGprsConnectionInfo();
+    public:    
+        /**
+        * Give back a copy of connection. 
+        */
+        virtual CConnectionInfoBase* DeepCopyL();
+    
+        /**
+        * Refresh required details of connection. 
+        */
+        virtual void RefreshDetailsL();
+
+        /**
+        * Refresh iListBoxItemText text, connection ListBox has a reference to
+        * this text.
+        */
+        virtual void RefreshConnectionListBoxItemTextL();
+
+        /**
+        * Refresh details array of connection. DetailsListBox has a reference
+        * to this array.
+        */
+        virtual void RefreshDetailsArrayL();
+
+        /**
+        * Gives back the icon id of connection type
+        * @return the icon id of connection type
+        */
+        virtual TUint GetIconId() const;
+
+    protected:
+        /**
+        * Constructor
+        * @param aConnectionId The id of the given connection.
+        * @param aMonitor for refreshing details
+        * @param aConnectionBearerType the bearer type of connection
+        * @param aActiveWrapper the for refreshing
+        */
+        CGprsConnectionInfo( TInt aConnectionId, 
+                             RConnectionMonitor* const aConnectionMonitor,
+                             TConnMonBearerType aConnectionBearerType,
+                             CActiveWrapper* aActiveWrapper );
+
+        /**
+        * Second phase construction
+        */
+        void ConstructL();
+
+    protected:
+        /**
+        * Creates an array with requrired details of connection to
+        * the listbox which visulaize details of connection. This member
+        * is called at initialization.
+        */
+        virtual void ToArrayDetailsL();
+
+        /**
+        * Creates a string from Access Point name of the connection.
+        * @return string representation count of Access Point name of 
+        * the connection.
+        */
+        HBufC* ToStringApNameLC() const;
+
+    private:
+
+    protected: // Data members
+    
+        TBuf<CommsDat::KMaxTextLength> iApName;    ///< Used AccessPoint name
+        
+    };
+
+
+#endif // GPRSCONNECTIONINFO_H_INCLUDED
+
+// Enf of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorui/inc/WlanConnectionInfo.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,272 @@
+/*
+* Copyright (c) 2004 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:  Represents a WLAN connection
+*     
+*
+*/
+
+
+#ifndef WLANCONNECTIONINFO_H_INCLUDED
+#define WLANCONNECTIONINFO_H_INCLUDED
+
+// INCLUDES
+#include "ConnectionInfoBase.h"
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class RConnectionMonitor;
+
+// Calibration of WLAN signal strength
+enum TWlanSignalStrength
+    {
+    EWlanSignalStrengthMax = 60,
+    EWlanSignalStrengthGood = 74,
+    EWlanSignalStrengthLow = 87,
+    EWlanSignalStrengthMin = 100,
+    EWlanSignalUnavailable = 9999
+    };
+
+// WLAN Network modes
+enum TWlanNetworkMode
+    {
+    EWlanNetworkModeInfrastructure = 0,
+    EWlanNetworkModeAdHoc,
+    EWlanNetworkModeSecInfrastructure,
+    EWlanNetworkModeUnavailable
+    };
+
+// WLAN security modes
+enum TWlanSecurityMode
+    {
+    EWlanSecurityModeOpenNetwork = 0,
+    EWlanSecurityModeWEP,
+    EWlanSecurityMode8021x,
+    EWlanSecurityModeWPA,
+    EWlanSecurityWpaPsk,
+    EWlanSecurityModeUnavailable
+    };
+
+// CONSTANTS
+
+const TReal32 KDiffOfWlanSignalStrength = 
+                            EWlanSignalStrengthMin - EWlanSignalStrengthMax;
+
+
+// CLASS DECLARATION
+/**
+* Represents a WLAN connection.
+*/
+class CWlanConnectionInfo : public CConnectionInfoBase
+    {
+    public:
+        /**
+        * Static constructor
+        * @param aConnectionId The id of the given connection.
+        * @param aMonitor for refreshing details
+        * @param aConnectionBearerType the bearer type of connection
+        * @param aEasyWlanIAPName Name of the Easy WLAN access point
+        * @param aActiveWrapper the for refreshing
+        */
+        static CWlanConnectionInfo* NewL( TInt aConnectionId, 
+                              RConnectionMonitor* const aConnectionMonitor,
+                              TConnMonBearerType aConnectionBearerType,
+                              const HBufC* aEasyWlanIAPName,
+                              CActiveWrapper* aActiveWrapper );
+
+        /**
+        * Destructor
+        */
+        virtual ~CWlanConnectionInfo();
+        
+    public:    
+        /**
+        * Give back a copy of connection. 
+        */
+        virtual CConnectionInfoBase* DeepCopyL();
+    
+        /**
+        * Refreshing all details of connection. Leaves if refreshing 
+        * any of detais is failed.
+        */
+        virtual void RefreshDetailsL();
+
+        /**
+        * Refresh iListBoxItemText text, connection ListBox has a 
+        * reference to this text.
+        */
+        virtual void RefreshConnectionListBoxItemTextL();
+
+        /**
+        * Refresh details array of connection. DetailsListBox has a 
+        * reference to this array.
+        */
+        virtual void RefreshDetailsArrayL();
+
+        /**
+        * Gives back the icon id of connection 
+        * @return the icon id of connection 
+        */
+        virtual TUint GetIconId() const;
+
+        /**
+        * Gives back the connection is EasyWLAN or not.
+        * @return ETrue if the selected conenction EasyWLAN,
+        * EFalse otherwise
+        */
+        virtual TBool IsEasyWLAN() const;
+        
+        /**
+        * Gives back current Name of Network ( SSID )
+        * @return iNetworkName
+        */
+        virtual HBufC* GetWlanNetworkNameLC() const;
+
+        /**
+        * Gives back current SignalStrength
+        * @return iSignalStrength
+        */        
+        TWlanSignalStrength GetWlanSignalStrength() const;
+
+        /**
+        * Gives back current NetworkMode
+        * @return iNetworkMode
+        */
+        TWlanNetworkMode GetWlanNetworkMode() const;
+
+        /**
+        * Gives back current SecurityMode
+        * @return iSecurityMode
+        */        
+        TWlanSecurityMode GetWlanSecurityMode() const;
+
+        /**
+        * Gives back current TxPower
+        * @return iTxPower
+        */        
+        TUint GetWlanTxPower() const;
+
+    protected:  // Constructors
+        /**
+        * Constructor
+        * @param aConnectionId The id of the given connection.
+        * @param aMonitor for refreshing details
+        * @param aConnectionBearerType the bearer type of connection
+        * @param aActiveWrapper the for refreshing
+        */
+        CWlanConnectionInfo( TInt aConnectionId, 
+                             RConnectionMonitor* const aConnectionMonitor,
+                             TConnMonBearerType aConnectionBearerType,
+                             CActiveWrapper* aActiveWrapper );
+
+        /**
+        * Second phase construction
+        */
+        void ConstructL();
+
+    protected:
+        /**
+        * Creates an array with requrired details of connection to
+        * the listbox which visulaize details of connection. This member
+        * is called at initialization.
+        */
+        virtual void ToArrayDetailsL();
+
+        /**
+        * Refreshing NetworkName. Leaves if did not get valid data from
+        * ConnectionMonitor.
+        */
+        void RefreshNetworkNameL();
+        
+        /**
+        * Refreshing SignalStrength. Leaves if did not get valid data from
+        * ConnectionMonitor.
+        */
+        void RefreshSignalStrength();
+
+        /**
+        * Refreshing NetworkMode. Leaves if did not get valid data from
+        * ConnectionMonitor.
+        */
+        void RefreshNetworkMode();
+
+        /**
+        * Refreshing SecurityMode. Leaves if did not get valid data from
+        * ConnectionMonitor.
+        */
+        void RefreshSecurityMode();
+
+        /**
+        * Refreshing TxPower. Leaves if did not get valid data from
+        * ConnectionMonitor.
+        */
+        void RefreshTxPowerL();
+
+        /**
+        * Gives back the string representation of SignalStrength.
+        */
+        HBufC* ToStringSignalStrengthLC() const;
+
+        /**
+        * Gives back the string representation of Mode.
+        */
+        HBufC* ToStringNetworkModeLC() const;
+
+        /**
+        * Gives back the string representation of Security.
+        */
+        HBufC* ToStringSecurityModeLC() const;
+
+        /**
+        * Gives back the string representation of TxPower.
+        */
+        HBufC* ToStringTxPowerLC() const;
+
+    private:
+
+    protected:
+
+        /**
+        * The name of network (SSID)
+        */
+        TName                       iWlanNetworkName;
+        
+        /**
+        * Signale strength of WLAN connection
+        */
+        TWlanSignalStrength         iSignalStrength;
+        
+        /**
+        * Network mode of WLAN conenction
+        */ 
+        TWlanNetworkMode            iNetworkMode;
+    
+        /**
+        * Security mode of WLAN conenction
+        */ 
+        TWlanSecurityMode           iSecurityMode;
+
+        /**
+        * TxPower of WLAN conenction
+        */
+        TUint                        iTxPower;
+        
+        /**
+        * ETrue if the selected conenction EasyWLAN
+        */ 
+        TBool                        iEasyWlan;
+    };
+
+#endif // WLANCONNECTIONINFO_H_INCLUDED
+//End of File.
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorui/loc/connectionmonitorui.loc	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,762 @@
+/*
+* Copyright (c) 2002 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 texts for ConnectionMonitorUi
+*     
+*
+*/
+
+
+
+// LOCALISATION STRINGS
+//d:Title pane text in main view
+//l:title_pane_t2/opt9
+//w:
+//r:1.0
+//
+
+#define qtn_cmon_title	"Conn. Manager"
+
+//d:No active connection in main view
+//l:main_list_empty_pane
+//w:
+//r:1.0
+//
+
+#define qtn_cmon_no_active_connections	"(no active connections)"
+
+//d:Title pane text in main view.
+//l:navi_navi_text_pane_t1
+//w:
+//r:1.0
+//
+
+#define qtn_cmon_navi_one_active_conn "1 active connection"
+
+//d:Title pane text in main view.
+//l:navi_navi_text_pane_t1
+//w:
+//r:1.0
+//
+
+#define qtn_cmon_navi_many_active_conns "%N active connections"
+
+//d:downloaded / uploaded data amounts with two decimal 
+//d:digits (for GPRS connections)
+//l:list_double_graphic_pane_t2
+//w:
+//r:1.0
+//
+
+#define qtn_cmon_ul_dl_data_amounts "%0U / %1U"
+
+//d:duration of the connection over 24h (for CSD and HSCSD connections)
+//l:list_single_heading_pane_t1
+//w:
+//r:1.0
+//
+
+#define qtn_cmon_duration_over_24h  "%0Ud %1U"
+
+//d:Connection status (main view)
+//l:list_double_graphic_pane_t2
+//w:
+//r:1.0
+//
+
+#define qtn_cmon_status_creating    "Creating connection"
+
+//d:Connection status (main view)
+//l:list_double_graphic_pane_t2
+//w:
+//r:1.0
+//
+
+#define qtn_cmon_status_idle    "Idle"
+
+//d:Connection status (main view)
+//l:list_double_graphic_pane_t2
+//w:
+//r:1.0
+//
+
+#define qtn_cmon_status_active  "Active"
+
+//d:Connection status (main view)
+//l:list_double_graphic_pane_t2
+//w:
+//r:1.0
+//
+
+#define qtn_cmon_status_suspended   "On hold"
+
+//d:Connection status (main view)
+//l:list_double_graphic_pane_t2
+//w:
+//r:1.0
+//
+
+#define qtn_cmon_status_closing "Closing connection"
+
+//d:Connection status (main view)
+//l:list_double_graphic_pane_t2
+//w:
+//r:1.0
+//
+
+#define qtn_cmon_status_closed  "Closed"
+
+//d:Connection status (details view)
+//l:list_single_heading_pane_t1
+//w:
+//r:1.0
+//
+
+#define qtn_cmon_status_details_creating    "Creating connection"
+
+//d:Connection status (details view)
+//l:list_single_heading_pane_t1
+//w:
+//r:1.0
+//
+
+#define qtn_cmon_status_details_idle    "Idle"
+
+//d:Connection status (details view)
+//l:list_single_heading_pane_t1
+//w:
+//r:1.0
+//
+
+#define qtn_cmon_status_details_active  "Active"
+
+//d:Connection status (details view)
+//l:list_single_heading_pane_t1
+//w:
+//r:1.0
+//
+
+#define qtn_cmon_status_details_suspended   "On hold"
+
+//d:Connection status (details view)
+//l:list_single_heading_pane_t1
+//w:
+//r:1.0
+//
+
+#define qtn_cmon_status_details_closing "Closing connection"
+
+//d:Connection status (details view)
+//l:list_single_heading_pane_t1
+//w:
+//r:1.0
+//
+
+#define qtn_cmon_status_details_closed  "Closed"
+
+//d:The navi pane displays the “serial number” (%1N) of the
+//d:connection in question and the total amount of the 
+//d:connections.
+//l:navi_navi_text_pane_t1
+//w:
+//r:1.0
+//
+
+#define qtn_cmon_navi_nof_connection    "%0N/%1N"
+
+//d:
+//l:list_single_heading_pane_t2 
+//w:
+//r:1.0
+//
+
+#define qtn_cmon_heading_conn_name  "Name"
+
+//d:
+//l:list_single_heading_pane_t2 
+//w:
+//r:1.0
+//
+
+#define qtn_cmon_heading_bearer   "Bearer"
+
+//d:
+//l:list_single_heading_pane_t2 
+//w:
+//r:1.0
+//
+
+#define qtn_cmon_heading_status "Status"
+
+//d:
+//l:list_single_heading_pane_t2 
+//w:
+//r:1.0
+//
+
+#define qtn_cmon_heading_data_received  "Received"
+
+//d:
+//l:list_single_heading_pane_t2 
+//w:
+//r:1.0
+//
+
+#define qtn_cmon_heading_data_sent  "Sent"
+
+//d:
+//l:list_single_heading_pane_t2 
+//w:
+//r:1.0
+//
+
+#define qtn_cmon_heading_duration   "Duration"
+
+//d:
+//l:list_single_heading_pane_t2 
+//w:
+//r:1.0
+//
+
+#define qtn_cmon_heading_speed      "Speed"
+
+//d:
+//l:list_single_heading_pane_t2 
+//w:
+//r:1.0
+//
+
+#define qtn_cmon_heading_csd_number "Dial-up no."
+
+//d:
+//l:list_single_heading_pane_t2 
+//w:
+//r:1.0
+//
+
+#define qtn_cmon_heading_gprs_apn   "APN"
+
+//d:
+//l:list_single_heading_pane_t2 
+//w:
+//r:1.0
+//
+
+#define qtn_cmon_heading_sharing_info   "Sharing"
+
+//d:
+//l:list_single_heading_pane_t1
+//w:
+//r:1.0
+//
+
+#define qtn_set_bearer_data_call    "Data call"
+
+//d:
+//l:list_single_heading_pane_t1
+//w:
+//r:1.0
+//
+
+#define qtn_set_bearer_packet_data  "Packet data"
+
+//d:
+//l:list_single_heading_pane_t1
+//w:
+//r:1.0
+//
+
+#define qtn_cmon_bearer_hscsd    "High speed GSM"
+
+//d:
+//l:list_single_heading_pane_t1
+//w:
+//r:1.0
+//
+
+#define qtn_log_gprs_amount_b   "%U B"
+
+//d:
+//l:list_single_heading_pane_t1
+//w:
+//r:1.0
+//
+
+#define qtn_log_gprs_amount_kb   "%U kB"
+
+//d:
+//l:list_single_heading_pane_t1
+//w:
+//r:1.0
+//
+
+#define qtn_log_gprs_amount_mb   "%U MB"
+
+//d:
+//l:list_single_heading_pane_t1
+//w:
+//r:1.0
+//
+
+#define qtn_log_gprs_amount_gb   "%U GB"
+
+//d:
+//l:list_double_number_pane_t3
+//w:
+//r:1.0
+//
+
+#define qtn_cmon_data_transf_rate_dl    "%U kB/s"
+
+//d:
+//l:list_single_heading_pane_t1
+//w:
+//r:1.0
+//
+
+#define qtn_cmon_sharing_information    "Between %N instances" 
+
+//d:Confirmation query to close selected connection
+//l:popup_note_window
+//w:
+//r:1.0
+//
+
+#define qtn_cmon_conf_end_single_conn "End connection ’%U’?"
+
+//d:Confirmation query to close all connections
+//l:popup_note_window
+//w:
+//r:1.0
+//
+
+#define qtn_cmon_conf_end_all_conns "%N connections active. End all connections?"
+
+//d:Main view menu item
+//l:list_single_pane_t1_cp2
+//w:
+//r:1.0
+//
+
+#define qtn_cmon_list_options_details "Details"
+
+//d:Main view menu item
+//l:list_single_pane_t1_cp2
+//w:
+//r:1.0
+//
+
+#define qtn_cmon_list_options_end_conn "End connection"
+
+//d:Main view menu item
+//l:list_single_pane_t1_cp2
+//w:
+//r:1.0
+//
+
+#define qtn_cmon_list_options_end_all "End all connections"
+
+//d:Application name
+//l:list_single_large_graphic_pane_t1
+//w:
+//r:1.0
+//
+
+#define qtn_apps_cmon_list "Conn. manager"
+
+//d:Application name
+//l:cell_app_pane_t1
+//w:
+//r:1.0
+//
+
+#define qtn_apps_cmon_grid "Conn. manager"
+
+//d:Transferred KBytes
+//l:list_single_heading_pane_t1
+//w:
+//r:1.0
+//
+
+#define qtn_cmon_data_transf_rate_ul    "%U kB/s"
+
+//d:
+//l:list_single_heading_pane_t1
+//w:
+//r:1.0
+//
+
+#define qtn_cmon_item_conn_name_modem   "Modem connection"
+
+//d:Confirmation query to close modem connection
+//l:popup_note_window
+//w:
+//r:1.0
+//
+
+#define qtn_cmon_conf_end_modem_conn    "End modem connection?"
+
+//d:when user rejects the query, an information note
+//l:popup_note_window
+//w:
+//r:1.0
+//
+
+#define qtn_cmon_info_conn_already_end    "Connection was already closed."
+
+//d:Connection Manager’s Active connections main view
+//l:list_double2_large_graphic_pane
+//w:
+//r:3.0
+//
+#define qtn_cmon_active_data_connections 		"Active data connections"
+
+//d:Connection Manager’s Available WLAN networks main view
+//l:list_double2_large_graphic_pane
+//w:
+//r:3.0
+//
+#define qtn_cmon_available_wlan_networks 		"Available WLAN networks"
+
+//d: WLAN network mode value text,mode, terminal is connected to another terminal or multiple
+//d:terminals (point-to-multipoint) without utilising any physical access points.  
+//l:list_single_heading_pane_t1  
+//w:
+//r:3.1
+//
+#define qtn_cmon_wlan_newtwork_mode_adhoc 		"Ad-hoc"
+
+//d: WLAN network mode value text, the terminal is connected over WLAN to a physical WLAN access point.
+//l:list_single_heading_pane_t1 
+//w:
+//r:3.1
+//
+#define qtn_cmon_wlan_newtwork_mode_infra		"Infrastructure"
+
+
+//d: WLAN network security mode value text, this is the abbrevation of a kind of security mode 
+//l:list_single_heading_pane_t1  
+//w:
+//r:3.1
+//
+#define qtn_cmon_wlan_security_mode_wep             	"WEP"
+
+//d: WLAN network security mode value text, this is the abbrevation of a kind of security mode  
+//l:list_single_heading_pane_t1 
+//w:
+//r:3.1
+//
+#define qtn_cmon_wlan_security_mode_802_1x           	"802.1x"
+
+//d: WLAN network security mode value text, this is the abbrevation of a kind of security mode  
+//l:list_single_heading_pane_t1  
+//w:
+//r:3.1
+//
+#define qtn_cmon_wlan_security_mode_wpa             	"WPA/WPA2"
+
+//d:Title of Active connections main view 
+//l:title_pane_t2/opt9
+//w:
+//r:3.0
+//
+#define qtn_cmon_title_active_conns                	 	"Active data connections"
+
+//d: Title of Available WLAN networks main view
+//l:title_pane_t2/opt9
+//w:
+//r:3.0
+//
+#define qtn_cmon_title_available_wlan               		"Available WLAN networks"
+
+//d: WLAN network bearer type value text 
+//l:list_single_heading_pane_t1
+//w:
+//r:3.0
+//
+#define qtn_wlan_sett_bearer_wlan            		"Wireless LAN"
+
+//d: WLAN network security mode value text 
+//l:list_single_heading_pane_t1 
+//w:
+//r:3.1
+//
+#define qtn_cmon_wlan_security_mode_open            	"Open network"
+
+//d: WLAN network name (SSID) detail of the network
+//l:list_single_heading_pane_t2 
+//w:
+//r:3.0
+//
+#define qtn_cmon_heading_wlan_network_name               	"Network"
+
+//d: WLAN network signal strength detail of the network
+//l:list_single_heading_pane_t2 
+//w:
+//r:3.0
+//
+#define qtn_cmon_heading_wlan_signal_strength            	"Signal"
+
+//d: WLAN network mode detail of the network
+//l:list_single_heading_pane_t2 
+//w:
+//r:3.0
+//
+#define qtn_cmon_heading_wlan_network_mode               	"Mode"
+
+//d:WLAN network  Security mode used by the WLAN network detail of the network
+//l:list_single_heading_pane_t2 
+//w:
+//r:3.0
+//
+#define qtn_cmon_heading_wlan_security_mode              	"Security"
+
+//d:WLAN network  Current transmit (TX) power level detail of the network
+//l:list_single_heading_pane_t2 
+//w:
+//r:3.0
+//
+#define qtn_cmon_heading_wlan_tx_power              	"TX power"
+
+//d:WLAN network  Amount of physical WLAN access points detail of the network
+//l:list_single_heading_pane_t2 
+//w:
+//r:3.0
+//
+#define qtn_cmon_heading_wlan_nw_ap_amount          	"Coverage"
+
+//d:WLAN network  Maximum data rate detail of the network
+//l:list_single_heading_pane_t2 
+//w:
+//r:3.0
+//
+#define qtn_cmon_heading_wlan_nw_max_rate           	"Max. rate"
+
+//d:WLAN network Amount of physical WLAN access points (AP) in range, if a single AP is in range
+//l:list_single_heading_pane_t1 
+//w:
+//r:3.0
+//
+#define qtn_cmon_wlan_ap_amount_in_range            	"1 access point"
+
+//d:WLAN network Amount of physical WLAN access points (AP) in range, if multiple APs in range (%N is the amount)
+//l:list_single_heading_pane_t1 
+//w:
+//r:3.0
+//
+#define qtn_cmon_wlan_ap_amount_in_range_many       	"%N access points"
+
+//d:WLAN network Current transmit (TX) power level in milliwatts (mW
+//l:list_single_heading_pane_t1 
+//w:
+//r:3.0
+//
+#define qtn_cmon_wlan_tx_power_level                		"%N mW"
+
+//d:WLAN network Maximum data rate in network (of best AP in range)
+//d:in megabits per secondin
+//l:list_single_heading_pane_t1 
+//w:
+//r:3.0
+//
+#define qtn_cmon_wlan_max_data_rate                 	"%U Mbit/s"
+
+//d: WLAN network signal strength value text 
+//l:list_single_heading_pane_t1 
+//w:
+//r:3.0
+//
+#define qtn_cmon_wlan_singal_strength_low           	"Low (%N%)"
+
+//d: WLAN network signal strength value text 
+//l:list_single_heading_pane_t1 
+//w:
+//r:3.0
+//
+#define qtn_cmon_wlan_singal_strength_medium        	"Medium (%N%)"
+
+//d: WLAN network signal strength value text 
+//l:list_single_heading_pane_t1 
+//w:
+//r:3.0
+//
+#define qtn_cmon_wlan_singal_strength_good          	"Good (%N%)"
+
+//d: WLAN network signal strength text  if the network in question becomes unavailable while
+//d:in details view,
+//l:list_single_heading_pane_t1 
+//w:
+//r:3.0
+//
+#define qtn_cmon_wlan_signal_strength_no_signal            	"No signal"
+
+//d:Navi pane text in Available WLAN networks main view, if only one network is available. 
+//l:navi_navi_text_pane_t1 
+//w:
+//r:3.0
+//
+#define qtn_cmon_navi_one_wlan_nw_available         	"1 network available"
+
+//d:Navi pane text in Available WLAN networks main view, if more than one network is available 
+//d:(%N is the amount of networks).
+//l:navi_navi_text_pane_t1 
+//w:
+//r:3.0
+//
+#define qtn_cmon_navi_many_wlan_nws_available       	"%N networks available"
+
+//d:Navi pane text in Available WLAN networks details view. 
+//d:The navi pane displays the “serial number” (%0N) of the
+//d:network in question and the total amount of the connections
+//d:(%1N) using the navigation text component: %0N/%1N
+//l:navi_navi_text_pane_t1 
+//w:
+//r:3.0
+//
+#define qtn_cmon_navi_nof_wlan_network       		"%0N/%1N"
+
+//d:Available WLAN networks main view — No networks available
+//l:main_list_empty_pane
+//w:
+//r:3.0
+//
+#define qtn_cmon_no_wlan_networks_available         	"(no available WLAN networks)"
+
+//d:Available WLAN networks main view options menu item. 
+//l:list_single_pane_t1_cp2
+//w:
+//r:3.0
+//
+#define qtn_cmon_options_create_wlan_iap       	"Create internet access point"
+
+//d:Available WLAN networks main view options menu - create internet access point item 
+//d:was selected this confirmation query note is displayed.
+//l:popup_note_window
+//w:
+//r:3.0
+//
+#define qtn_cmon_quest_create_wlan_iap  "Create internet access point for WLAN network '%U'?"
+
+//d:Available WLAN networks main view options menu - create internet access point item 
+//d:and secure network was selected this information note is poped up.
+//l:popup_note_window
+//w:
+//r:3.0
+//
+#define qtn_cmon_info_wlan_secure_nw_iap_create     	"You can create an internet access point for a secure WLAN network via Connection settings, Access points."
+
+//d:Available WLAN networks main view — One or more networks available, options menu item
+//l:list_single_pane_t1_cp2
+//w:
+//r:3.0
+//
+#define qtn_cmon_options_refresh               		"Refresh"
+
+
+//d: Unavailable attribute (details view)
+//l:list_single_heading_pane_t1
+//w:
+//r:3.0
+//
+#define qtn_cmon_parameter_unavailable  "(unavailable)"
+
+//d:
+//l:list_single_heading_pane_t2 
+//w:
+//r:3.0
+//
+#define qtn_cmon_heading_data_total  "Total"
+
+
+//d:"Connection summary note" note- info text
+//l:heading_pane_t1
+//w:
+//r:3.1
+//
+#define qtn_cmon_summary_heading  "Connection summary"
+
+//d:First line topic of "Connection summary note" note
+//d:displays the total transferred data amount (received and sent summarized)
+//l:heading_pane_t1
+//w:
+//r:3.1
+//
+#define qtn_cmon_summary_transferred "Transferred data:"
+
+//d:Third line topic of "Connection summary note" note,
+//d:displays the duration of the connection
+//l:heading_pane_t1
+//w:
+//r:3.1
+//
+#define qtn_cmon_summary_duration "Duration:"
+
+//d:Available WLAN networks main view options menu - create internet access point item 
+//d:final confirmation note is poped up when access point item has been created successfully
+//l:popup_note_window
+//w:
+//r:3.1
+//
+#define qtn_cmon_conf_wlan_iap_created	"Internet access point defined for WLAN network '%U'."
+
+//d:Text in middle soft key (opens a view for detailed information)
+//l:control_pane_t3/opt7
+//w:
+//r:3.2
+//
+#define qtn_msk_cmon_details "Details"
+
+//d:The name of the application which uses the connection (MessagingServer)
+//l:list_single_heading_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_cmon_sharing_app_msg_server  "Messaging" 
+
+//d:The name of the application which uses the connection (DownaloadMgrServer)
+//l:list_single_heading_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_cmon_sharing_app_dl_mg  "Downloads" 
+
+//d:The name of the application which uses the connection (Feeds Server)
+//l:list_single_heading_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_cmon_sharing_app_rss_server  "Web Feeds" 
+
+//d:The name of the application which uses the connection (Java MIDlets)
+//l:list_single_heading_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_cmon_sharing_app_java_midlet  "Application" 
+
+//d:The name of the application which uses the connection (Unknown instance)
+//l:list_single_heading_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_cmon_sharing_app_unknown  "(unknown)" 
+
+//d:The name of the application which uses the connection 
+//d:(SUPL (Secure User Plane Location) server)
+//l:list_single_heading_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_cmon_sharing_app_supl "Positioning server" 
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorui/sis/ConnectionMonitorUI.pkg	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,37 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description: ; Installation file for ConnectionMonitorUi application
+;
+; Installation file for ConnectionMonitorUi application
+; Installation file for ConnectionMonitorUi application
+
+;Languages
+&EN
+
+; Package header
+#{"ConnectionMonitorUi"},(0x101F84D0),0,2,0,TYPE=SA
+
+%{"some vendor"}
+; Unique Vendor name
+:"Unique Vendor NameXXXX"
+
+;Key and certificate
+*"rd-key.pem","rd.cer"
+
+
+; Entries - files to install
+
+"\Epoc32\release\armv5\udeb\CONNECTIONMONITORUI.exe"         -"!:\sys\bin\CONNECTIONMONITORUI.exe"
+"\epoc32\data\Z\Resource\apps\CONNECTIONMONITORUI.rsc"         -"!:\resource\apps\CONNECTIONMONITORUI.rsc"
+"\epoc32\data\Z\private\10003a3f\apps\CONNECTIONMONITORUI_reg.rsc" -"!:\private\10003a3f\import\apps\CONNECTIONMONITORUI_reg.rsc"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorui/src/ActiveWrapper.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,355 @@
+/*
+* 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:  CActiveWrapper implementation file
+*
+*/
+
+
+#include <e32base.h>
+
+#include "ActiveWrapper.h"
+#include "ConnectionMonitorUiLogger.h"
+
+// LOCAL CONSTANTS AND MACROS
+
+// ---------------------------------------------------------
+// CActiveWrapper::NewL
+//
+// Two-phased constructor.
+// ---------------------------------------------------------
+//
+CActiveWrapper* CActiveWrapper::NewL()
+    {
+    CMUILOGGER_ENTERFN( "CActiveWrapper::NewL()" );
+    
+    CActiveWrapper* self = new ( ELeave ) CActiveWrapper();
+    CleanupStack::PushL( self );
+
+    self->ConstructL();
+    
+    CleanupStack::Pop( self );
+
+    CMUILOGGER_LEAVEFN( "CActiveWrapper::NewL()" );
+    return self;
+    }
+
+// ---------------------------------------------------------
+// CActiveWrapper::ConstructL
+//
+// Symbian OS default constructor can leave.
+// ---------------------------------------------------------
+//
+void CActiveWrapper::ConstructL()
+    {
+    CMUILOGGER_ENTERFN( "CActiveWrapper::ConstructL()" );
+
+    CActiveScheduler::Add( this );
+
+    CMUILOGGER_LEAVEFN( "CActiveWrapper::ConstructL()" );
+    }
+
+
+// ---------------------------------------------------------
+// CActiveWrapper::CActiveWrapper
+//
+// C++ constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------
+//
+CActiveWrapper::CActiveWrapper() : CActive( CActive::EPriorityStandard )
+    {
+    }
+
+
+// ---------------------------------------------------------
+// CActiveWrapper::~CActiveWrapper
+//
+// Destructor
+// ---------------------------------------------------------
+//
+CActiveWrapper::~CActiveWrapper()
+    {
+    CMUILOGGER_ENTERFN( "CActiveWrapper::~CActiveWrapper()" );
+    
+    Cancel();
+    
+    CMUILOGGER_WRITE( "CActiveWrapper::~CActiveWrapper Canceled" );
+    
+    CMUILOGGER_LEAVEFN( "CActiveWrapper::~CActiveWrapper()" );
+    }
+
+
+// ---------------------------------------------------------
+// CActiveWrapper::RunL
+//
+// From active object framework
+// ---------------------------------------------------------
+//
+void CActiveWrapper::RunL() 
+    {
+    CMUILOGGER_ENTERFN( "CActiveWrapper::RunL()" );
+
+    if ( iWait.IsStarted() )
+        {
+        CMUILOGGER_WRITE( "AsyncStop" );
+
+        iWait.AsyncStop();
+        }
+
+    CMUILOGGER_LEAVEFN( "CActiveWrapper::RunL()" );
+    }
+
+
+// ---------------------------------------------------------
+// CActiveWrapper::DoCancel
+//
+// From active object framework
+// ---------------------------------------------------------
+//
+void CActiveWrapper::DoCancel()
+    {
+    CMUILOGGER_ENTERFN( "CActiveWrapper::DoCancel()" );
+
+    if ( iWait.IsStarted() )
+        {
+        CMUILOGGER_WRITE( "AsyncStop" );
+
+        iWait.AsyncStop();
+        }
+
+    CMUILOGGER_LEAVEFN( "CActiveWrapper::DoCancel()" );
+    }
+    
+
+// ---------------------------------------------------------
+// CActiveWrapper::StartGetStringAttribute
+//
+// Starts the active object
+// ---------------------------------------------------------
+//
+void CActiveWrapper::StartGetStringAttribute( TInt const aConnectionId, 
+                            RConnectionMonitor* const aConnectionMonitor,
+                            TUint const aAttribute,
+                            TDes& aValue )
+    {
+    CMUILOGGER_ENTERFN( "CActiveWrapper::StartGetStringAttribute()" );
+
+    if ( IsActive() == EFalse )
+        {
+        CMUILOGGER_WRITE( "NOT active" );
+        aConnectionMonitor->GetStringAttribute( aConnectionId, 0, aAttribute,
+                                                aValue, iStatus );
+        SetActive();
+        iWait.Start();
+        }
+    else
+        {
+        CMUILOGGER_WRITE( "Already active" );
+        }
+        
+    CMUILOGGER_LEAVEFN( "CActiveWrapper::StartGetStringAttribute()" );
+    }
+
+
+// ---------------------------------------------------------
+// CActiveWrapper::StartGetIntAttribute
+//
+// Starts the active object
+// ---------------------------------------------------------
+//
+void CActiveWrapper::StartGetIntAttribute( TInt const aConnectionId,
+                            RConnectionMonitor* const aConnectionMonitor,
+                            TUint const aAttribute,
+                            TInt& aValue )
+    {
+    CMUILOGGER_ENTERFN( "CActiveWrapper::StartGetIntAttribute()" );
+
+    if ( IsActive() == EFalse )
+        {
+        CMUILOGGER_WRITE( "NOT active" );
+        aConnectionMonitor->GetIntAttribute( aConnectionId, 
+                                             0,
+                                             aAttribute,
+                                             aValue,
+                                             iStatus );
+        SetActive();
+        iWait.Start();
+        }
+    else
+        {
+        CMUILOGGER_WRITE( "Already active" );
+        }
+        
+    CMUILOGGER_LEAVEFN( "CActiveWrapper::StartGetIntAttribute()" );
+    }
+
+
+// ---------------------------------------------------------
+// CActiveWrapper::StartGetUintAttribute
+//
+// Starts the active object
+// ---------------------------------------------------------
+//
+void CActiveWrapper::StartGetUintAttribute( TInt const aConnectionId,
+                            RConnectionMonitor* const aConnectionMonitor,
+                            TUint const aAttribute,
+                            TUint& aValue )
+    {
+    CMUILOGGER_ENTERFN( "CActiveWrapper::StartGetUintAttribute()" );
+
+    if ( IsActive() == EFalse )
+        {
+        CMUILOGGER_WRITE( "NOT active" );
+        aConnectionMonitor->GetUintAttribute( aConnectionId,
+                                              0,
+                                              aAttribute,
+                                              aValue,
+                                              iStatus );
+        SetActive();
+        iWait.Start();
+        }
+    else
+        {
+        CMUILOGGER_WRITE( "Already active" );
+        }
+        
+    CMUILOGGER_LEAVEFN( "CActiveWrapper::StartGetUintAttribute()" );
+    }
+
+
+// ---------------------------------------------------------
+// CActiveWrapper::StartGetConnSharings
+//
+// Starts the active object
+// ---------------------------------------------------------
+//
+void CActiveWrapper::StartGetConnSharings( TInt const aConnectionId,
+                            RConnectionMonitor* const aConnectionMonitor,
+                            TConnMonClientEnumBuf& aValue )
+    {
+    CMUILOGGER_ENTERFN( "CActiveWrapper::StartGetConnSharings()" );
+
+    if ( IsActive() == EFalse )
+        {
+        CMUILOGGER_WRITE( "NOT active" );   
+        aConnectionMonitor->GetPckgAttribute( aConnectionId,
+                                              0,
+                                              KClientInfo,
+                                              aValue,
+                                              iStatus );
+        SetActive();
+        iWait.Start();
+        }
+    else
+        {
+        CMUILOGGER_WRITE( "Already active" );
+        }
+        
+    CMUILOGGER_LEAVEFN( "CActiveWrapper::StartGetConnSharings()" );
+    }
+
+
+// ---------------------------------------------------------
+// CActiveWrapper::StartGetConnTime
+//
+// Starts the active object
+// ---------------------------------------------------------
+//
+void CActiveWrapper::StartGetConnTime( TInt const aConnectionId,
+                            RConnectionMonitor* const aConnectionMonitor,
+                            TConnMonTimeBuf& aValue )
+    {
+    CMUILOGGER_ENTERFN( "CActiveWrapper::StartGetConnTime()" );
+
+    if ( IsActive() == EFalse )
+        {
+        CMUILOGGER_WRITE( "NOT active" );   
+        aConnectionMonitor->GetPckgAttribute( aConnectionId,
+                                              0,
+                                              KStartTime,
+                                              aValue,
+                                              iStatus );
+        SetActive();
+        iWait.Start();
+        }
+    else
+        {
+        CMUILOGGER_WRITE( "Already active" );
+        }
+        
+    CMUILOGGER_LEAVEFN( "CActiveWrapper::StartGetConnTime()" );
+    }
+
+
+// ---------------------------------------------------------
+// CActiveWrapper::StartGetBearerType
+//
+// Starts the active object
+// ---------------------------------------------------------
+//
+void CActiveWrapper::StartGetBearerType( TInt const aConnectionId,
+                            RConnectionMonitor& aConnectionMonitor,
+                            TUint const aAttribute,
+                            TInt& aValue )
+    {
+    CMUILOGGER_ENTERFN( "CActiveWrapper::StartGetBearerType()" );
+
+    if ( IsActive() == EFalse )
+        {
+        CMUILOGGER_WRITE( "NOT active" );
+        aConnectionMonitor.GetIntAttribute( aConnectionId, 
+                                            0,
+                                            aAttribute,
+                                            aValue,
+                                            iStatus );
+        SetActive();
+        iWait.Start();
+        }
+    else
+        {
+        CMUILOGGER_WRITE( "Already active" );
+        }
+        
+    CMUILOGGER_LEAVEFN( "CActiveWrapper::StartGetBearerType()" );
+    }
+
+
+// ---------------------------------------------------------
+// CActiveWrapper::StartGetConnectionCount
+//
+// Starts the active object
+// ---------------------------------------------------------
+//
+void CActiveWrapper::StartGetConnectionCount( TUint& aConnectionCount,
+                            RConnectionMonitor& aConnectionMonitor )
+    {
+    CMUILOGGER_ENTERFN( "CActiveWrapper::StartGetConnectionCount()" );
+
+    if ( IsActive() == EFalse )
+        {
+        CMUILOGGER_WRITE( "NOT active" );
+        aConnectionMonitor.GetConnectionCount( aConnectionCount, iStatus );
+        SetActive();
+        iWait.Start();
+        }
+    else
+        {
+        CMUILOGGER_WRITE( "Already active" );
+        }
+        
+    CMUILOGGER_LEAVEFN( "CActiveWrapper::StartGetConnectionCount()" );
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorui/src/ConnectionArray.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,333 @@
+/*
+* Copyright (c) 2002 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:  Contains and handles CConnectionInfo instances
+*     
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "ConnectionArray.h"
+#include "ConnectionMonitorUiLogger.h"
+
+// CONSTANTS
+/**
+* Count of allowed connections.
+*/
+const TUint KConnArrayGranuality = KConnMonMaxClientUids;   
+
+
+// ================= MEMBER FUNCTIONS =======================
+// ---------------------------------------------------------
+// CConnectionArray::~CConnectionArray
+// ---------------------------------------------------------
+//
+CConnectionArray::~CConnectionArray()
+    {
+    if ( iConnectionArray )
+        {
+        iConnectionArray->ResetAndDestroy();
+        }
+    delete iConnectionArray;
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionArray::CConnectionArray
+// ---------------------------------------------------------
+//
+CConnectionArray::CConnectionArray()
+    {
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionArray::ConstructL
+// ---------------------------------------------------------
+//
+void CConnectionArray::ConstructL()
+    {
+    iConnectionArray = new ( ELeave ) 
+                    CArrayPtrFlat<CConnectionInfoBase>( KConnArrayGranuality );
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionArray::MdcaCount
+// ---------------------------------------------------------
+//
+TInt  CConnectionArray::MdcaCount() const
+    {
+    return iConnectionArray->Count();
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionArray::MdcaPoint
+// ---------------------------------------------------------
+//
+TPtrC CConnectionArray::MdcaPoint( TInt aIndex ) const
+    {
+    return ( *iConnectionArray )[aIndex]->GetConnectionListBoxItemText();
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionArray::DeepCopyL
+// ---------------------------------------------------------
+//
+CConnectionArray* CConnectionArray::DeepCopyL()
+	{
+	CConnectionArray* temp = new ( ELeave ) CConnectionArray();
+	CleanupStack::PushL( temp );
+    temp->ConstructL();
+    TInt count = iConnectionArray->Count();
+    CConnectionInfoBase* tempConnInfo = NULL;
+    for ( TInt i = 0; i < count; ++i )
+	    {
+	    tempConnInfo = ( *iConnectionArray )[i]->DeepCopyL();
+		CleanupStack::PushL( tempConnInfo );	    
+	    temp->AppendL( tempConnInfo );
+		CleanupStack::Pop( tempConnInfo );	    
+	    }
+	CleanupStack::Pop( temp );
+	return temp;
+	}
+
+// ---------------------------------------------------------
+// CConnectionArray::GetArrayIndex
+// ---------------------------------------------------------
+//
+TInt CConnectionArray::GetArrayIndex( TUint aConnectionId ) const
+    {
+    CMUILOGGER_WRITE_F( "GetArrayIndex: %d", aConnectionId );
+    TBool found( EFalse );
+    TInt index( 0 );
+    TInt count = iConnectionArray->Count();
+    TUint connectionId( 0 );
+
+    while ( ( index <  count ) && !found  )
+        {
+        connectionId = ( *iConnectionArray )[index]->GetConnectionId();
+        if ( connectionId == aConnectionId )
+            {
+            found = ETrue;
+            }
+        else
+            {
+            ++index;            
+            }
+        }
+
+    CMUILOGGER_WRITE_F( "Found: %d", found );
+
+    return ( found ? index : KErrNotFound );
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionArray::GetArrayIndex
+// ---------------------------------------------------------
+//
+TInt CConnectionArray::GetArrayIndex( CConnectionInfoBase* aConnection ) const
+    {
+    CMUILOGGER_WRITE_F( "GetArrayIndex: %d", 
+                       aConnection->GetConnectionId() );
+    TBool found( EFalse );
+    TInt index( 0 );
+    TInt count = iConnectionArray->Count();
+
+    while ( ( index <  count ) && !found  )
+        {
+        if ( ( *iConnectionArray )[index] == aConnection )
+            {
+            found = ETrue;
+            }
+        else
+            {
+            ++index;            
+            }        
+        }
+
+    CMUILOGGER_WRITE_F( "Found: %d", found );
+
+    return ( found ? index : KErrNotFound );        
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionArray::AppendL
+// ---------------------------------------------------------
+//
+void CConnectionArray::AppendL( CConnectionInfoBase* aConnection )
+    {
+    CMUILOGGER_ENTERFN( "CConnectionArray::AppendL" );
+    if ( aConnection )
+        {
+        TUint connectionId = aConnection->GetConnectionId();
+        TInt index = GetArrayIndex( connectionId );
+
+        if ( index == KErrNotFound )
+            {
+            if ( aConnection->GetStatus() != EConnectionClosed &&
+                aConnection->GetStatus() != EConnectionUninitialized )
+                {
+                iConnectionArray->AppendL( aConnection );
+                }
+            }
+        }
+
+    CMUILOGGER_LEAVEFN( "CConnectionArray::AppendL" );
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionArray::Delete
+// ---------------------------------------------------------
+//
+void CConnectionArray::Delete( TUint aConnectionId )
+    {
+    CMUILOGGER_WRITE_F( "Deleting connection: %d", aConnectionId );
+    TInt count = iConnectionArray->Count();
+    TUint connectionId( 0 );
+    TBool deleted( EFalse );
+    for ( TInt i = 0; (i < count) && !deleted; ++i )
+        {
+        connectionId = ( *iConnectionArray )[i]->GetConnectionId();
+        if ( connectionId == aConnectionId )
+            {
+            delete ( *iConnectionArray )[i];
+            iConnectionArray->Delete( i );
+            iConnectionArray->Compress();
+            deleted = ETrue;
+            }
+        }
+    CMUILOGGER_WRITE_F( "Found and deleted: %b", deleted );
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionArray::Delete
+// ---------------------------------------------------------
+//
+void CConnectionArray::Delete( CConnectionInfoBase* aConnection )
+    {
+    CMUILOGGER_WRITE_F( "Deleting connection: %d", 
+                        aConnection->GetConnectionId() );
+    TInt count = iConnectionArray->Count();
+    TBool deleted( EFalse );
+    for ( TInt i = 0; (i < count) && !deleted; ++i )
+        {
+        if ( ( *iConnectionArray )[i] == aConnection )
+            {
+            delete ( *iConnectionArray )[i];
+            iConnectionArray->Delete( i );
+            iConnectionArray->Compress();
+            deleted = ETrue;
+            }
+        }
+    CMUILOGGER_WRITE_F( "Found and deleted: %b", deleted );
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionArray::Reset
+// ---------------------------------------------------------
+//
+void CConnectionArray::Reset()
+    {
+    iConnectionArray->ResetAndDestroy();
+    }
+
+// ---------------------------------------------------------
+// CConnectionArray::operator[]
+// ---------------------------------------------------------
+//
+CConnectionInfoBase* CConnectionArray::operator[]( TUint aIndex ) const
+    {
+    return ( *iConnectionArray )[aIndex];
+    }
+    
+// ---------------------------------------------------------
+// CConnectionArray::At
+// ---------------------------------------------------------
+//
+CConnectionInfoBase* CConnectionArray::At( TInt aIndex ) const
+    {
+    CMUILOGGER_ENTERFN( "CConnectionArray::At()" );
+    CConnectionInfoBase* temp( NULL );
+    TInt count = iConnectionArray->Count();
+    CMUILOGGER_WRITE_F( "count %d", count );
+    
+    if ( count  && ( aIndex < count ) )
+        {
+        temp = ( *iConnectionArray )[aIndex];
+        }
+    
+    CMUILOGGER_LEAVEFN( "CConnectionArray::At()" );
+    return temp;
+    }    
+
+// ---------------------------------------------------------
+// CConnectionArray::NumberOfActiveConnections
+// ---------------------------------------------------------
+//
+TInt CConnectionArray::NumberOfActiveConnections() const 
+    {
+    TInt count( 0 );
+
+    CMUILOGGER_WRITE_F(
+         "NumberOfActiveConnections: all in array: [%d]\n",
+         MdcaCount() );
+
+    // we need to count all and only the open connection
+    for ( TInt i = 0; i < MdcaCount(); ++i )
+        {
+         if ( ( *iConnectionArray )[i]->IsAlive() )
+             {
+             ++count;
+             }
+        }
+
+    CMUILOGGER_WRITE_F( "Active connections: [%d]\n", count );
+    return count;
+    }    
+
+// ---------------------------------------------------------
+// CConnectionArray::NumberOfSuspendedConnections
+// ---------------------------------------------------------
+//
+TInt CConnectionArray::NumberOfSuspendedConnections() const 
+    {
+    TInt count( 0 );
+    
+    CMUILOGGER_WRITE_F(
+         "Number of all connection in array: [%d]\n", MdcaCount() );
+
+    // we need to count all and only the open connection
+    for ( TInt i = 0; i < MdcaCount(); ++i )
+        {
+         if ( ( *iConnectionArray )[i]->IsSuspended() )
+             {
+             ++count;
+             }
+        }
+    
+    CMUILOGGER_WRITE_F( "Suspended connections: [%d]\n", count );
+    return count;
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorui/src/ConnectionInfoBase.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,1208 @@
+/*
+* Copyright (c) 2004 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:  Represents a connection
+*
+*
+*/
+
+
+// INCLUDE FILES
+#include <stdlib.h>
+#include <NIFVAR.H>
+#include <StringLoader.h>
+#include <ConnectionMonitorUi.rsg>
+#include <avkon.rsg>
+#include <AknUtils.h>
+#include <apgcli.h>
+
+#include "ConnectionMonitorUiLogger.h"
+#include "ConnectionInfoBase.h"
+#include "ActiveWrapper.h"
+
+// CONSTANTS
+
+const TUint KUpArrowChar = 0x2191; ///< ASCII code of UpArrow
+const TUint KDownArrowChar = 0x2193; ///< ASCII code of DownArrow
+const TUint KBannedServerUID = 0x101fd9c5; // Banned DHCP server UID
+
+const TInt KFeedsServerUid         = 0x1020728E;
+const TInt KDownloadMgrServerUid   = 0x10008D60;
+const TInt KMessagingServerUid     = 0x1000484b;
+const TInt KJavaVMUid              = 0x102033E6;
+const TInt KSUPLServerUid          = 0x102073CA;
+
+LOCAL_D const TInt KStringsGranularity = 5;
+
+_LIT( KMrouterName, "mRouter"); ///< see CheckMrouteIap
+_LIT( KEmpty, "");      ///< Empty string
+
+
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CConnectionInfoBase::~CConnectionInfoBase
+// ---------------------------------------------------------
+//
+CConnectionInfoBase::~CConnectionInfoBase()
+    {
+    delete iDetailsArray;
+    delete iAppNames;
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionInfoBase::CConnectionInfoBase
+// ---------------------------------------------------------
+//
+CConnectionInfoBase::CConnectionInfoBase(
+                           TInt aConnectionId,
+                           RConnectionMonitor* const aConnectionMonitor,
+                           TConnMonBearerType aConnectionBearerType,
+                           CActiveWrapper* aActiveWrapper ) :
+    iConnectionMonitor( aConnectionMonitor ), 
+    iStartTime( NULL ),
+    iDeletedFromCMUI( EFalse ),
+    iActiveWrapper( aActiveWrapper )
+    {
+    CMUILOGGER_WRITE( "CConnectionInfoBase constuctor - start " );
+    iConnectionStatus = EConnectionUninitialized;
+    iConnectionId = aConnectionId;
+    iConnectionBearerType = aConnectionBearerType;
+    iLastSpeedUpdate.UniversalTime();
+    CMUILOGGER_WRITE( "CConnectionInfoBase constuctor - end " );
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionInfoBase::ConstructL
+// ---------------------------------------------------------
+//
+void CConnectionInfoBase::ConstructL()
+    {
+    CMUILOGGER_ENTERFN( "CConnectionInfoBase::ConstructL() start" );
+
+    if ( iConnectionBearerType >= EBearerExternalCSD )
+        {
+        StringLoader::Load( iConnectionName,
+                            R_QTN_CMON_ITEM_CONN_NAME_MODEM );
+        }
+    else
+        {
+        iActiveWrapper->StartGetStringAttribute( iConnectionId,
+                                                 iConnectionMonitor,
+                                                 KIAPName,
+                                                 iConnectionName );
+        TInt err( iActiveWrapper->iStatus.Int() );
+        CMUILOGGER_WRITE_F( "CConnectionInfoBase::ConstructL() status: %d",
+                            err );
+        CMUILOGGER_WRITE_F( "iConnectionName : %S", &iConnectionName );
+        CMUILOGGER_WRITE_F( "iConnectionId : %d", iConnectionId );
+        CMUILOGGER_WRITE_F( "iConnectionBearerType : %d", 
+                            ( TInt )iConnectionBearerType );
+        if ( err != KErrNone )
+            {
+            User::Leave( err );
+            }
+        }
+    
+    if ( !iAppNames )
+        {
+        iAppNames = new( ELeave ) CDesCArrayFlat( KStringsGranularity );
+        }
+
+    StatusChangedL();
+    if ( GetStatus() == EConnectionSuspended )
+        {
+        InitializeConnectionInfoL();
+        }
+    CMUILOGGER_LEAVEFN( "CConnectionInfoBase::ConstructL() end" );
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionInfoBase::StatusChangedL
+// ---------------------------------------------------------
+//
+void CConnectionInfoBase::StatusChangedL()
+    {
+    CMUILOGGER_WRITE( "CConnectionInfoBase::StatusChangedL() start" );
+
+    RefreshConnectionStatus();
+
+    switch ( iConnectionStatus )
+        {
+        case EConnectionCreated:
+            {
+            InitializeConnectionInfoL();
+            break;
+            }
+        case EConnectionSuspended:
+            {
+            RefreshDetailsL();
+            if ( !iDetailsArray )
+                {
+                ToArrayDetailsL();
+                }
+            RefreshDetailsArrayL();
+            break;
+            }
+        case EConnectionClosing:
+        case EConnectionClosed:
+        case EConnectionUninitialized:
+        	{
+        	if ( iDetailsArray ) // if there is details array
+        	    {
+        	    RefreshDetailsArrayL();
+        	    }
+            break;
+        	}
+        case EConnectionCreating:
+        default :
+            {
+            break;
+            }
+        }
+
+    RefreshConnectionListBoxItemTextL();
+
+    CMUILOGGER_WRITE( "CConnectionInfoBase::StatusChangedL() end" );
+    }
+
+// ---------------------------------------------------------
+// CConnectionInfoBase::IsAlive
+// ---------------------------------------------------------
+//
+TBool CConnectionInfoBase::IsAlive() const
+    {
+    TBool alive( EFalse );
+    if ( ( iConnectionStatus == EConnectionSuspended ) ||
+         ( iConnectionStatus == EConnectionCreated ) )
+        {
+        alive = ETrue;
+        }
+    return alive;
+    }
+    
+// ---------------------------------------------------------
+// CConnectionInfoBase::IsSuspended
+// ---------------------------------------------------------
+//
+TBool CConnectionInfoBase::IsSuspended() const
+    {
+    TBool suspended( EFalse );
+    if ( iConnectionStatus == EConnectionSuspended )
+        {
+        suspended = ETrue;
+        }
+    return suspended;
+    }    
+
+// ---------------------------------------------------------
+// CConnectionInfoBase::GetConnectionId
+// ---------------------------------------------------------
+//
+CDesCArrayFlat* CConnectionInfoBase::GetDetailsArray() const
+    {
+    CDesCArrayFlat* array = NULL;
+    if ( ( iConnectionStatus == EConnectionSuspended ) ||
+         ( iConnectionStatus == EConnectionCreated ) )
+        {
+        array = iDetailsArray;
+        }
+    return array;
+    }
+
+// ---------------------------------------------------------
+// CConnectionInfoBase::GetConnectionId
+// ---------------------------------------------------------
+//
+TUint CConnectionInfoBase::GetConnectionId() const
+    {
+    return iConnectionId;
+    }
+
+// ---------------------------------------------------------
+// CConnectionInfoBase::GetStatus
+// ---------------------------------------------------------
+//
+TConnectionStatus CConnectionInfoBase::GetStatus() const
+    {
+    return iConnectionStatus;
+    }
+
+// ---------------------------------------------------------
+// CConnectionInfoBase::GetName
+// ---------------------------------------------------------
+//
+HBufC* CConnectionInfoBase::GetNameLC() const
+    {
+    HBufC* name = iConnectionName.AllocLC();
+    return name;
+    }
+
+// ---------------------------------------------------------
+// CConnectionInfoBase::GetBearerType
+// ---------------------------------------------------------
+//
+TConnMonBearerType CConnectionInfoBase::GetBearerType() const
+    {
+    return iConnectionBearerType;
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionInfoBase::GetConnectionListBoxItemText
+// ---------------------------------------------------------
+//
+TPtrC CConnectionInfoBase::GetConnectionListBoxItemText() const
+    {
+    return iListBoxItemText;
+    }
+
+// ---------------------------------------------------------
+// CConnectionInfoBase::RefreshConnectionStatus
+// ---------------------------------------------------------
+//
+void CConnectionInfoBase::RefreshConnectionStatus()
+    {
+    TConnectionStatus connStatus( EConnectionUninitialized );
+    iActiveWrapper->StartGetIntAttribute( iConnectionId,
+                                          iConnectionMonitor,
+                                          KConnectionStatus,
+                                          ( ( TInt& )( connStatus ) ) );
+    TInt err( iActiveWrapper->iStatus.Int() );
+    CMUILOGGER_WRITE_F( "RefreshConnectionStatus status : %d",
+                        err );
+    if ( err == KErrNone )
+        {
+        RefreshConnectionStatus( connStatus );
+        }
+    else
+        {
+        iActiveWrapper->Cancel();
+        }
+    }
+
+// ---------------------------------------------------------
+// CConnectionInfoBase::RefreshConnectionStatus
+// ---------------------------------------------------------
+//
+void CConnectionInfoBase::RefreshConnectionStatus(
+                                   const TConnectionStatus aConnectionStatus )
+    {
+    CMUILOGGER_ENTERFN( "RefreshConnectionStatus" );
+    CMUILOGGER_WRITE_F( "RefreshConnectionStatus aConnectionStatus %d",
+                        ( TInt )aConnectionStatus );
+    CMUILOGGER_WRITE_F( "iConnectionStatus before %d",
+                        ( TInt )iConnectionStatus );
+                        
+
+    if ( ( aConnectionStatus == KLinkLayerOpen ) ||
+          ( ( aConnectionStatus == KConnectionOpen ) &&
+            ( iConnectionBearerType >= EBearerExternalCSD ) ) )
+        {
+        CMUILOGGER_WRITE("1");
+        iConnectionStatus = EConnectionCreated;
+        }
+    else if ( ( iConnectionStatus == EConnectionClosing ) &&
+              ( ( aConnectionStatus == KConnectionClosed ) ||
+                ( aConnectionStatus == KLinkLayerClosed ) ) ) 
+        {
+        CMUILOGGER_WRITE("2");        
+        iConnectionStatus = EConnectionClosed;
+        }
+    else if ( ( ( aConnectionStatus >= KMinAgtProgress ) &&
+               ( aConnectionStatus <= KConnectionOpen ) ) ||
+               ( aConnectionStatus == KStartingSelection ) ||
+               ( aConnectionStatus == KFinishedSelection ) ||
+               ( aConnectionStatus == KConfigDaemonStartingRegistration ) ||
+               ( aConnectionStatus == KConfigDaemonFinishedRegistration ) )
+        // creating
+        {
+        CMUILOGGER_WRITE("5");
+        iConnectionStatus = EConnectionCreating;
+        }
+    else if ( aConnectionStatus == KDataTransferTemporarilyBlocked )
+        {
+        CMUILOGGER_WRITE("6");
+        iConnectionStatus = EConnectionSuspended;
+        }
+    else if ( ( iConnectionStatus == EConnectionCreated ) &&
+              ( ( aConnectionStatus >= KConnectionStartingClose ) &&
+                ( aConnectionStatus < KConnectionClosed ) ||  
+                ( aConnectionStatus == KConfigDaemonFinishedDeregistrationStop ) || 
+                ( aConnectionStatus == KConfigDaemonStartingDeregistration ) ||
+                ( aConnectionStatus == KLinkLayerClosed ) ||
+                ( aConnectionStatus == KConnectionUninitialised )
+              ) )
+        // closing
+        {
+        CMUILOGGER_WRITE("7");        
+        iConnectionStatus = EConnectionClosing;
+        }
+    else if ( ( aConnectionStatus == KConnectionUninitialised ) &&
+             ( iConnectionStatus == EConnectionSuspended ) )
+        { // Back to created from suspended
+        CMUILOGGER_WRITE("4");
+        iConnectionStatus = EConnectionCreated;
+        }
+    else if ( aConnectionStatus == KConnectionUninitialised )
+        {
+        CMUILOGGER_WRITE("3");
+        iConnectionStatus = EConnectionUninitialized;
+        }
+        
+    else
+        {
+        CMUILOGGER_WRITE_F( " else iConnectionStatus  %d",
+                            ( TInt )iConnectionStatus );
+        CMUILOGGER_WRITE_F( "else aConnectionStatus  %d",
+                            ( TInt )aConnectionStatus );
+        
+        CMUILOGGER_WRITE("else");
+        }
+
+
+    CMUILOGGER_WRITE_F( "iConnectionStatus after %d",
+                        ( TInt )iConnectionStatus );
+    CMUILOGGER_LEAVEFN( "RefreshConnectionStatus" );                                                
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionInfoBase::RefreshSentReceivedDataL
+// ---------------------------------------------------------
+//
+void CConnectionInfoBase::RefreshSentReceivedDataL()
+    {
+    CMUILOGGER_ENTERFN( "CConnectionInfoBase::RefreshSentReceivedDataL" );
+    // Downloaded
+	CMUILOGGER_WRITE("Downloaded before");
+    iActiveWrapper->StartGetUintAttribute( iConnectionId,
+                                           iConnectionMonitor,
+                                           KDownlinkData,
+                                           iDownloaded );
+    TInt errDownload( iActiveWrapper->iStatus.Int() );
+    CMUILOGGER_WRITE_F( "Download status: %d", errDownload );
+    if ( errDownload != KErrNone )
+        {
+        iActiveWrapper->Cancel();
+        User::Leave( errDownload );
+        }
+   	CMUILOGGER_WRITE("Downloaded after");
+    // Uploaded
+	CMUILOGGER_WRITE("Uploaded before");
+    iActiveWrapper->StartGetUintAttribute( iConnectionId,
+                                           iConnectionMonitor,
+                                           KUplinkData,
+                                           iUploaded );
+    TInt errUpload( iActiveWrapper->iStatus.Int() );
+    CMUILOGGER_WRITE_F( "Upload status: %d", errUpload );
+    if ( errUpload != KErrNone )
+        {
+        iActiveWrapper->Cancel();
+        User::Leave( errUpload );
+        }
+	CMUILOGGER_WRITE("Uploaded after");
+
+    CMUILOGGER_LEAVEFN( "CConnectionInfoBase::RefreshSentReceivedDataL" );
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionInfoBase::RefreshTransferSpeedsL
+// ---------------------------------------------------------
+//
+void CConnectionInfoBase::RefreshTransferSpeedsL()
+    {
+    CMUILOGGER_ENTERFN( "CConnectionInfoBase::RefreshTransferSpeedsL" );
+    TUint up = iUploaded;
+    TUint down = iDownloaded;
+
+    RefreshSentReceivedDataL();
+
+    TTime now;
+    now.UniversalTime();
+
+    // 100 * 1/1000sec
+    const TUint KOnesec = 1000;
+    TUint diffTime = I64LOW( now.MicroSecondsFrom( iLastSpeedUpdate ).Int64() /
+                                                        TInt64( 1000 ) );
+
+    if ( iLastSpeedUpdate.Int64() == 0 )
+        {
+        iLastSpeedUpdate = now;
+
+        // speed cannot be calculated at the first time
+        iUpSpeed.quot = 0;
+        iUpSpeed.rem = 0;
+        iDownSpeed.quot = 0;
+        iDownSpeed.rem = 0;
+        }
+    else if ( diffTime > 500 )
+        // at least 1/2sec passed
+        {
+        // bytes/sec
+        div_t upSpeed = div( ( iUploaded - up ) * KOnesec, diffTime );
+        div_t downSpeed = div( ( iDownloaded - down ) * KOnesec, diffTime );
+        // kbytes/sec
+        iUpSpeed = div( upSpeed.quot, 1024 );
+        iDownSpeed = div( downSpeed.quot, 1024 );
+
+        iLastSpeedUpdate = now;
+        }
+    CMUILOGGER_LEAVEFN( "CConnectionInfoBase::RefreshTransferSpeedsL" );
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionInfoBase::RefreshDuration
+// ---------------------------------------------------------
+//
+void CConnectionInfoBase::RefreshDuration()
+    {
+    CMUILOGGER_ENTERFN( "CConnectionInfoBase::RefreshDuration" );
+    TTime now;
+    now.UniversalTime();
+
+    // passed time since connection established.
+    iDuration = now.MicroSecondsFrom( iStartTime ).Int64();
+    CMUILOGGER_LEAVEFN( "CConnectionInfoBase::RefreshDuration" );
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionInfoBase::RefreshAppNamesL
+// ---------------------------------------------------------
+//
+TInt CConnectionInfoBase::RefreshAppNamesL()
+    {
+    CMUILOGGER_ENTERFN( "CConnectionInfoBase::RefreshAppNamesL" );
+    
+    TInt sharings( 0 );
+    
+if ( IsAlive() )
+    {
+    if ( iAppNames )
+        {
+        iAppNames->Reset();
+        HBufC* actAppName = NULL;
+        // Check whether it is an internal or external (modem) connection
+        // External (modem) connections does not need application name
+        if ( iConnectionBearerType < EBearerExternalCSD )
+            {
+            TInt count( 0 );
+            TConnMonClientEnumBuf clientBuf;
+            iActiveWrapper->StartGetConnSharings( iConnectionId,
+                                                  iConnectionMonitor,
+                                                  clientBuf );
+            
+            TInt err( iActiveWrapper->iStatus.Int() );
+            CMUILOGGER_WRITE_F( "RefreshSharings status: %d", err );
+            
+            if ( !err )
+                {
+                count = clientBuf().iCount;
+                }
+                
+            CMUILOGGER_WRITE_F( "clientBuf().iCount: %d", count );
+                
+#ifndef __WINS__ // Appl. uid is always zero in emulator
+
+            RApaLsSession appSess;
+            TApaAppInfo appInfo;
+
+            // The connection could be shared by several applications
+            User::LeaveIfError( appSess.Connect() );
+                    
+            TUint i;
+            for ( i = 0; i < count; i++ )
+                {
+                actAppName = NULL;
+                appInfo.iCaption.Zero();
+
+                TInt result = appSess.GetAppInfo( appInfo, 
+                                                  clientBuf().iUid[i] );
+
+                //================================
+                CMUILOGGER_WRITE_F( "result: %d", result ); 
+                CMUILOGGER_WRITE_F( "iClientInfo.iUid[i].iUid: %x", 
+                                    clientBuf().iUid[i].iUid );
+                
+                if ( result != KErrNone )
+                    {
+                    TInt resId = 0;
+                    switch ( clientBuf().iUid[i].iUid )
+                        {
+                        case KMessagingServerUid: // Messaging
+                            {
+                            resId = R_QTN_CMON_SHARING_APP_MSG_SERVER;
+                            break;
+                            }
+                        case KDownloadMgrServerUid: // Downloads
+                            {
+                            resId = R_QTN_CMON_SHARING_APP_DL_MG;
+                            break;
+                            }
+                        case KFeedsServerUid: // Web Feeds
+                            {
+                            resId = R_QTN_CMON_SHARING_APP_RSS_SERVER;
+                            break;
+                            }
+                        case KJavaVMUid: // Application
+                            {
+                            resId = R_QTN_CMON_SHARING_APP_JAVA_MIDLET;
+                            break;
+                            }
+                        case KBannedServerUID:
+                            {   // Forget about DHCP server!
+                            break;
+                            }
+                        case KSUPLServerUid:
+                            {
+                            resId = R_QTN_CMON_SHARING_APP_SUPL;
+                            break;
+                            }
+                        default: // (unknown)
+                            {
+                            resId = R_QTN_CMON_SHARING_APP_UNKNOWN;
+                            break;
+                            }
+                        }
+
+                    if ( resId )
+                        {
+                        actAppName = StringLoader::LoadL( resId );
+                        }
+                    }
+                else
+                    {
+                    actAppName =  HBufC::NewL( appInfo.iCaption.Length() );
+                    TPtr actAppNameBuf = actAppName->Des();
+                    actAppNameBuf.Append( appInfo.iCaption );
+                    }
+
+                if ( actAppName )
+                    {
+                    iAppNames->AppendL( actAppName->Des() );        
+                    delete actAppName;
+                    }
+                }
+
+                iAppNames->Sort();
+                appSess.Close();
+#else
+            TInt countBan( 0 );
+
+            if ( !err )
+                {
+                // remove the DHCP server is not actually 
+                // an owner of the connection
+                for ( TUint tmp = 0; tmp < count; ++tmp )
+                    {
+                    TUid uid = clientBuf().iUid[tmp];
+            
+                    if ( uid.iUid == KBannedServerUID )
+                        {
+                        ++countBan;
+                        }
+                    } // end
+                }
+
+            _LIT( KStrApplication, "Application" );
+            // Give a dummy name of the application
+            for ( TInt i = 0; i < ( count - countBan ); i++ )
+                {
+                iAppNames->AppendL( KStrApplication );
+                }
+
+#endif // __WINS__
+
+            }
+        /* modem connections does not need application name
+        else 
+            {
+            }
+        */
+        sharings = iAppNames->Count();
+        }
+    }
+        
+    CMUILOGGER_LEAVEFN( "CConnectionInfoBase::RefreshAppNamesL" );
+    return sharings;
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionInfoBase::ToDetailsListBoxItemTextL
+// ---------------------------------------------------------
+//
+HBufC*  CConnectionInfoBase::ToDetailsListBoxItemTextL(
+                                                const TUint aResourceId,
+                                                const HBufC* aValueText ) const
+    {
+    CMUILOGGER_ENTERFN( "CConnectionInfoBase::ToDetailsListBoxItemTextL" );
+
+    HBufC* columnName = NULL;
+    if ( aResourceId )
+        {
+        columnName = StringLoader::LoadLC( aResourceId );
+        }
+    else
+        {
+        columnName = KEmpty().AllocLC();
+        }
+
+    HBufC* listBoxItemText = HBufC::NewL( KDetailsListItemText );
+
+    TPtr ptrToListBoxItemText = listBoxItemText->Des();
+
+    ptrToListBoxItemText.Format( KDetailsListItemTextFormat,
+                                 columnName, aValueText );
+    CleanupStack::PopAndDestroy( columnName );
+
+
+    CMUILOGGER_LEAVEFN( "CConnectionInfoBase::ToDetailsListBoxItemTextL" );
+
+    return listBoxItemText;
+    }
+
+// ---------------------------------------------------------
+// CConnectionInfoBase::ToDetailsListBoxItemTextWithAppendL
+// ---------------------------------------------------------
+//
+void  CConnectionInfoBase::ToDetailsListBoxItemTextWithAppendL(
+                                                const TUint aResourceId,
+                                                const HBufC* aValueText )
+    {
+    HBufC* listBoxItemText = ToDetailsListBoxItemTextL( aResourceId,
+                                                        aValueText );
+    CleanupStack::PushL( listBoxItemText );
+    CMUILOGGER_WRITE_F( "LISTBOXITEM: %S", listBoxItemText );
+    iDetailsArray->AppendL( *listBoxItemText );
+    CleanupStack::PopAndDestroy( listBoxItemText );
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionInfoBase::ToDetailsListBoxItemTextWithReplaceL
+// ---------------------------------------------------------
+//
+void  CConnectionInfoBase::ToDetailsListBoxItemTextWithReplaceL(
+                                                    const TUint aResourceId,
+                                                    const HBufC* aValueText,
+                                                    TInt aIndex )
+    {
+    CMUILOGGER_ENTERFN
+        ( "CConnectionInfoBase::ToDetailsListBoxItemTextWithReplaceL" );
+    CMUILOGGER_WRITE_F( "aValueText: %S", aValueText );
+
+    if ( /*( iDetailsArray ) && */
+            ( aIndex < iDetailsArray->Count() ) &&
+                ( aIndex > KErrNotFound ) )
+        {
+        HBufC* listBoxItemText = ToDetailsListBoxItemTextL( aResourceId,
+                                                            aValueText );
+        iDetailsArray->Delete( aIndex );
+        CleanupStack::PushL( listBoxItemText );
+        iDetailsArray->InsertL( aIndex, *listBoxItemText );
+        CleanupStack::PopAndDestroy( listBoxItemText );
+        iDetailsArray->Compress();
+        }
+    CMUILOGGER_LEAVEFN
+        ( "CConnectionInfoBase::ToDetailsListBoxItemTextWithReplaceL" );
+
+    }
+
+// ---------------------------------------------------------
+// CConnectionInfoBase::ToStringBearerLC
+// ---------------------------------------------------------
+//
+HBufC* CConnectionInfoBase::ToStringBearerLC() const
+    {
+    HBufC* bearer = NULL;
+    TUint resourceId( 0 );
+
+    // Bearer type
+    if ( iConnectionBearerType == EBearerHSCSD ||
+        iConnectionBearerType == EBearerExternalHSCSD )
+        {
+        resourceId = R_QTN_CMON_BEARER_HSCSD;
+
+        }
+    else if ( iConnectionBearerType == EBearerCSD ||
+             iConnectionBearerType == EBearerExternalCSD ||
+             iConnectionBearerType == EBearerWcdmaCSD ||
+             iConnectionBearerType == EBearerExternalWcdmaCSD )
+        {
+        resourceId = R_QTN_SET_BEARER_DATA_CALL;
+        }
+    else if ( iConnectionBearerType == EBearerWLAN )
+        {
+        resourceId = R_QTN_WLAN_SETT_BEARER_WLAN;
+        }
+    else
+        {
+        resourceId = R_QTN_SET_BEARER_PACKET_DATA;
+        }
+
+    bearer = StringLoader::LoadLC( resourceId );
+
+    return bearer;
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionInfoBase::ToStringStatusLC
+// ---------------------------------------------------------
+//
+HBufC* CConnectionInfoBase::ToStringStatusLC( TBool aIsDetailsView ) const
+    {
+    HBufC* status = NULL;
+    TUint resourceId( 0 );
+    switch ( iConnectionStatus )
+        {
+        case EConnectionCreated:
+            {
+            if ( iUpSpeed.quot || iUpSpeed.rem ||
+                iDownSpeed.quot || iDownSpeed.rem )
+                {
+                resourceId = aIsDetailsView ? R_QTN_CMON_STATUS_DETAILS_ACTIVE 
+                                            : R_QTN_CMON_STATUS_ACTIVE;
+                }
+            else
+                {
+                resourceId = aIsDetailsView ? R_QTN_CMON_STATUS_DETAILS_IDLE 
+                                            : R_QTN_CMON_STATUS_IDLE;
+                }
+            break;
+            }
+        case EConnectionUninitialized:
+        case EConnectionClosed:
+            {
+            resourceId = aIsDetailsView ? R_QTN_CMON_STATUS_DETAILS_CLOSED 
+                                        : R_QTN_CMON_STATUS_CLOSED;
+            break;
+            }
+        case EConnectionClosing:
+            {
+            resourceId = aIsDetailsView ? R_QTN_CMON_STATUS_DETAILS_CLOSING 
+                                        : R_QTN_CMON_STATUS_CLOSING;
+            break;
+            }
+        case EConnectionSuspended:
+            {
+            resourceId = aIsDetailsView ? R_QTN_CMON_STATUS_DETAILS_SUSPENDED 
+                                        : R_QTN_CMON_STATUS_SUSPENDED;
+            break;
+            }
+        case EConnectionCreating:
+        default :
+            {
+            resourceId = aIsDetailsView ? R_QTN_CMON_STATUS_DETAILS_CREATING 
+                                        : R_QTN_CMON_STATUS_CREATING;
+            break;
+            }
+        }
+
+    status = StringLoader::LoadLC( resourceId );
+
+    return status;
+    }
+    
+    
+// ---------------------------------------------------------
+// CConnectionInfoBase::ToStringTotalTransmittedDataLC
+// ---------------------------------------------------------
+//
+HBufC* CConnectionInfoBase::ToStringTotalTransmittedDataLC() const
+    {
+    TUint total = iUploaded + iDownloaded;
+    CMUILOGGER_WRITE_F( "iUploaded : %d", iUploaded );
+    CMUILOGGER_WRITE_F( "iDownloaded : %d", iDownloaded );
+    CMUILOGGER_WRITE_F( "total : %d", total );
+    
+    return ToStringLoadedDataLC( total );
+    }
+
+// ---------------------------------------------------------
+// CConnectionInfoBase::ToStringSentDataLC
+// ---------------------------------------------------------
+//
+HBufC* CConnectionInfoBase::ToStringSentDataLC( TBool aToBeThreeDigit ) const
+    {
+    return ToStringLoadedDataLC( iUploaded, aToBeThreeDigit, KUpArrowChar );
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionInfoBase::ToStringReceivedDataLC
+// ---------------------------------------------------------
+//
+HBufC* CConnectionInfoBase::ToStringReceivedDataLC( TBool aToBeThreeDigit ) const
+    {
+    return ToStringLoadedDataLC( iDownloaded, aToBeThreeDigit, KDownArrowChar );
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionInfoBase::ToStringTransferSpeedUpLC
+// ---------------------------------------------------------
+//
+HBufC* CConnectionInfoBase::ToStringTransferSpeedUpLC() const
+    {
+    return ToStringTransferSpeedLC( iUpSpeed, KUpArrowChar );
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionInfoBase::ToStringTransferSpeedDownLC
+// ---------------------------------------------------------
+//
+HBufC* CConnectionInfoBase::ToStringTransferSpeedDownLC() const
+    {
+    return ToStringTransferSpeedLC( iDownSpeed, KDownArrowChar );
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionInfoBase::ToStringDurationLC
+// ---------------------------------------------------------
+//
+HBufC* CConnectionInfoBase::ToStringDurationLC() const
+    {
+    const TUint KTimeStringLength = 64;
+    const TUint KTimeFormatBuf = 16;
+    const TUint KDateFormatBuf = 16;
+    _LIT( KDayFormat, "%d" );
+
+
+    TTime now;
+    now.UniversalTime();
+    HBufC* timeString = NULL;
+    
+    TTimeIntervalDays days = NULL;
+    
+    if  ( iStartTime != NULL )
+        {
+        // calculate days passed since connection started
+        days = now.DaysFrom( iStartTime );
+        CMUILOGGER_WRITEF( _L( "ToStringDurationLC days before: %d" ),
+                               days.Int() );
+        }
+    
+    // passed time since connection established.
+    if ( days.Int() <= 0 )
+        // it's still within 1 day
+        {
+        timeString = HBufC::NewLC( KTimeStringLength );
+        TPtr16 tempBuf( timeString->Des() );
+
+        HBufC* temp = StringLoader::LoadLC( R_QTN_TIME_DURAT_LONG_WITH_ZERO );
+
+        iDuration.FormatL( tempBuf, *temp );
+        CleanupStack::PopAndDestroy( temp );
+        }
+    else
+        // more than 1 day
+        {
+        CMUILOGGER_WRITEF( _L( "ToStringDurationLC days after: %d" ),
+                               days.Int() );
+            
+        TBuf<KDateFormatBuf>  dayFormat;
+        dayFormat.Format( KDayFormat, days.Int() );
+
+        // format time format string
+        HBufC* tempFormat = StringLoader::LoadLC(
+                                            R_QTN_TIME_DURAT_SHORT_WITH_ZERO );
+        TBuf<KTimeFormatBuf> tempBuf;
+
+        // format hours:mins
+        iDuration.FormatL( tempBuf, *tempFormat );
+
+        CDesCArrayFlat* strings = new( ELeave ) CDesCArrayFlat( 2 );
+        CleanupStack::PushL( strings );
+
+        strings->AppendL( dayFormat );
+        strings->AppendL( tempBuf );
+
+        timeString = StringLoader::LoadL( R_QTN_CMON_DURATION_OVER_24H,
+                                          *strings );
+
+        CleanupStack::PopAndDestroy( strings );
+        CleanupStack::PopAndDestroy( tempFormat );
+        CleanupStack::PushL( timeString );
+        }
+
+    CMUILOGGER_WRITE_F( "duration time1: %S", timeString );
+    
+    TPtr temp( timeString->Des() );
+    AknTextUtils::DisplayTextLanguageSpecificNumberConversion( temp );
+    CMUILOGGER_WRITE_F( "duration temp: %S", &temp );
+    
+    CMUILOGGER_WRITE_F( "duration time2: %S", timeString );
+    
+
+    return timeString;
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionInfoBase::CheckMrouterIap
+// ---------------------------------------------------------
+//
+TBool CConnectionInfoBase::CheckMrouterIap()
+    {
+    CMUILOGGER_ENTERFN( "CheckMrouterIap" );
+    TBool result( ETrue );
+
+    CMUILOGGER_WRITE_F( "IAP name: %S", &iConnectionName );
+    iConnectionName.Trim();
+    if ( iConnectionName.Left(
+                      KMrouterName().Length() ).CompareF( KMrouterName ) )
+        {
+        result = EFalse;
+        }
+    CMUILOGGER_LEAVEFN( "CheckMrouterIap" );
+    return result;
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionInfoBase::ToStringLoadedDataLC
+// ---------------------------------------------------------
+//
+HBufC* CConnectionInfoBase::ToStringLoadedDataLC( TUint aLoadedData, 
+                                                  TBool aToBeThreeDigit, 
+                                                  const TUint aArrowChar ) const
+    {
+    const TUint KTransferedBytesFormatBuf = 16;
+    const TUint KTransferedBytesWidth = 10;
+    TUint transferedBytesDecimalPlaces(2);
+    TUint resId;
+    HBufC* loadedTxt = NULL;
+
+    TBuf<KTransferedBytesFormatBuf> buf;
+
+    if ( aLoadedData < 1000 )          // bytes
+        {
+        if ( aToBeThreeDigit ) // added arrow to listbox
+            {
+            _LIT( KUdLinkFormatBytes, "%c%d" );
+
+            buf.Format( KUdLinkFormatBytes, aArrowChar, aLoadedData );
+            }
+        else
+            {
+            _LIT( KUdLinkFormatBytes, "%d" );
+
+            buf.Format( KUdLinkFormatBytes, aLoadedData );
+            }
+        resId = R_QTN_LOG_GPRS_AMOUNT_B;
+        }
+    else
+        {                           // KB, MB, GB
+        TUint denom;
+
+        if ( aLoadedData < 1000 * 1024 )
+            {
+            denom = 1024;
+            resId = R_QTN_LOG_GPRS_AMOUNT_KB;
+            }
+        else if ( aLoadedData < 1000 * 1024 * 1024 )
+            {
+            denom = 1024 * 1024;
+            resId = R_QTN_LOG_GPRS_AMOUNT_MB;
+            }
+        else
+            {
+            denom = 1024 * 1024 * 1024;
+            resId = R_QTN_LOG_GPRS_AMOUNT_GB;
+            }
+
+        TReal value = STATIC_CAST( TReal, aLoadedData ) /
+                      STATIC_CAST( TReal, denom );
+                      
+		if ( aToBeThreeDigit )
+			{
+			if ( value < 10 )	// number of decimal places
+				{
+				transferedBytesDecimalPlaces = 2;
+				}
+			else if ( value < 100 )
+				{
+				transferedBytesDecimalPlaces = 1;
+				}
+			else
+				{
+				transferedBytesDecimalPlaces = 0;
+				}
+			}
+
+		TRealFormat Format( KTransferedBytesWidth, 
+							transferedBytesDecimalPlaces );
+
+        HBufC* number = HBufC::NewLC( KTransferedBytesWidth );
+        number->Des().Num( value, Format );
+
+        if ( aToBeThreeDigit ) // added arrow to listbox
+            {
+            _LIT( KUdFormatLarge, "%c%S" );
+            buf.Format( KUdFormatLarge, aArrowChar, number );
+            }
+        else
+            {
+            _LIT( KUdFormatLarge, "%S" );
+            buf.Format( KUdFormatLarge, number );
+            }
+        CleanupStack::PopAndDestroy( number );
+        }
+
+    loadedTxt = StringLoader::LoadLC( resId, buf );
+
+    TPtr temp( loadedTxt->Des() );
+    AknTextUtils::DisplayTextLanguageSpecificNumberConversion( temp );
+
+    return  loadedTxt;
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionInfoBase::ToStringTransferSpeedLC
+// ---------------------------------------------------------
+//
+HBufC* CConnectionInfoBase::ToStringTransferSpeedLC( div_t aSpeed,
+                                               const TUint aArrowChar ) const
+    {
+    const TUint KUpDownSpeedBufSize = 16;
+    _LIT( KUdSpeedFmt, "%c%d%S%02d" );
+
+    TBuf<KUpDownSpeedBufSize> buf;
+    TInt resId;
+
+    HBufC* decSep = StringLoader::LoadLC( R_TEXT_CALC_DECIMAL_SEPARATOR );
+
+    resId = R_QTN_CMON_DATA_TRANSF_RATE_UL;
+    buf.Format( KUdSpeedFmt, aArrowChar, aSpeed.quot, decSep, aSpeed.rem );
+
+    CleanupStack::PopAndDestroy( decSep );
+
+    HBufC* speedTxt = StringLoader::LoadLC( resId, buf );
+
+    TPtr temp( speedTxt->Des() );
+    AknTextUtils::DisplayTextLanguageSpecificNumberConversion( temp );
+
+    return speedTxt;
+    }
+
+// ---------------------------------------------------------
+// CConnectionInfoBase::InitializeConnectionInfoL
+// ---------------------------------------------------------
+//
+void CConnectionInfoBase::InitializeConnectionInfoL()
+    {
+    CMUILOGGER_WRITE( "InitializeConnectionInfoL - start " );
+    TConnMonTimeBuf timeBuf;
+    iActiveWrapper->StartGetConnTime( iConnectionId,
+                                      iConnectionMonitor,
+                                      timeBuf );
+    TInt err( iActiveWrapper->iStatus.Int() );
+    CMUILOGGER_WRITE_F( "IntiConnectionInfo() status: %d", err );
+    if ( err != KErrNone )
+        {
+        User::Leave( err );
+        }
+
+    iStartTime = timeBuf();
+    TDateTime dt = iStartTime.DateTime();
+    CMUILOGGER_WRITE_F( "Day : %d", dt.Day() );
+    CMUILOGGER_WRITE_F( "Hour : %d", dt.Hour() );
+    CMUILOGGER_WRITE_F( "Minute : %d", dt.Minute() );
+    CMUILOGGER_WRITE_F( "Second : %d", dt.Second() );
+    
+    
+    RefreshDetailsL();
+    if ( !iDetailsArray )
+        {
+        ToArrayDetailsL();
+        }
+    CMUILOGGER_WRITE( "InitializeConnectionInfoL - end " );
+    }
+
+// ---------------------------------------------------------
+// CConnectionInfoBase::StringMarkerRemoval
+// ---------------------------------------------------------
+//
+void CConnectionInfoBase::StringMarkerRemoval( HBufC* aStringHolder )
+    {
+    TPtr bufPtr = aStringHolder->Des();
+    
+    const TText KLRMarker = 0x200E;
+    const TText KRLMarker = 0x200F;
+
+    TBuf<2> markers;
+    markers.Append( KLRMarker );
+    markers.Append( KRLMarker );
+
+    // This function is requested to remove directional markers, because they
+    // cause a display error in languages such Hebrew. Directional markers will
+    // be correctly added later, when the one or two parts of the time string 
+    // are merged, again with StringLoader functions.
+    AknTextUtils::StripCharacters( bufPtr, markers ); 
+    }
+    
+// ---------------------------------------------------------
+// CConnectionInfoBase::ToStringAppNameLC
+// ---------------------------------------------------------
+//
+HBufC* CConnectionInfoBase::ToStringAppNameLC( TInt aAppIndex )
+    {
+    HBufC* appName = ( iAppNames->MdcaPoint( aAppIndex ) ).AllocLC();
+    
+    return appName;
+    }
+
+// ---------------------------------------------------------
+// CConnectionInfoBase::GetDeletedFromCMUI
+// ---------------------------------------------------------
+//
+TBool CConnectionInfoBase::GetDeletedFromCMUI() const
+	{
+	return iDeletedFromCMUI;	
+	}
+
+// ---------------------------------------------------------
+// CConnectionInfoBase::SetAllDeletedFromCMUI
+// ---------------------------------------------------------
+//
+void CConnectionInfoBase::SetAllDeletedFromCMUI()
+	{
+	iConnectionStatus = EConnectionClosing;
+	}
+
+// ---------------------------------------------------------
+// CConnectionInfoBase::SetDeletedFromCMUI
+// ---------------------------------------------------------
+//
+void CConnectionInfoBase::SetDeletedFromCMUI()
+	{
+	iConnectionStatus = EConnectionClosing;
+	
+	iDeletedFromCMUI = ETrue;	
+	}
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorui/src/ConnectionMonitorUiApp.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,72 @@
+/*
+* Copyright (c) 2002 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:  CConnectionMonitorUiApp application class
+*     
+*
+*/
+
+
+// INCLUDE FILES
+#include    <eikstart.h>
+#include    "ConnectionMonitorUiApp.h"
+#include    "ConnectionMonitorUiDocument.h"
+
+// ---------------------------------------------------------
+// Panic
+// ---------------------------------------------------------
+//
+void Panic( TInt aReason )
+    {
+    _LIT( KAppName, "Conn. Monitor" );
+    User::Panic( KAppName, aReason );
+    }
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiApp::AppDllUid()
+// Returns application UID
+// ---------------------------------------------------------
+//
+TUid CConnectionMonitorUiApp::AppDllUid() const
+    {
+    return KUidConnectionMonitorUi;
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiApp::CreateDocumentL()
+// Creates CConnectionMonitorUiDocument object
+// ---------------------------------------------------------
+//
+CApaDocument* CConnectionMonitorUiApp::CreateDocumentL()
+    {
+    return CConnectionMonitorUiDocument::NewL( *this );
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS ==============
+
+
+LOCAL_C CApaApplication* NewApplication()
+    {
+    return new CConnectionMonitorUiApp;
+    }
+
+GLDEF_C TInt E32Main()
+    {
+    return EikStart::RunApplication( NewApplication );
+    }
+
+
+// End of File  
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorui/src/ConnectionMonitorUiAppUi.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,947 @@
+/*
+* Copyright (c) 2002 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:  Application UI class
+*
+*
+*/
+
+
+// INCLUDE FILES
+#include <StringLoader.h>
+#include <aknnotedialog.h>
+#include <AknUtils.h>
+#include <cmmanagerext.h>
+#include <ConnectionMonitorUi.rsg>
+#include "ConnectionMonitorUi.hrh"
+#include "ConnectionMonitorUiAppUi.h"
+#include "ConnectionMonitorUiView.h"
+#include "ConnectionMonitorUiDetailsView.h"
+#include "ConnectionArray.h"
+#include "CsdConnectionInfo.h"
+#include "GprsConnectionInfo.h"
+#include "WlanConnectionInfo.h"
+#include "EasyWLANConnectionInfo.h"
+#include "FeatureManagerWrapper.h"
+#include "ActiveWrapper.h"
+
+
+// CONSTANTS
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ----------------------------------------------------------
+// CConnectionMonitorUiAppUi::ConstructL()
+// ----------------------------------------------------------
+//
+void CConnectionMonitorUiAppUi::ConstructL()
+    {
+    CMUILOGGER_CREATE;
+
+    CMUILOGGER_WRITE( "Constructing CConnectionMonitorUiAppUi" );
+
+    BaseConstructL( EAknEnableSkin | EAknEnableMSK | EAknSingleClickCompatible);
+
+#ifdef RD_CONTROL_PANEL
+    
+    TBool isEmbeddedApp = IsEmbedded();
+    CMUILOGGER_WRITE_F( "IsEmbedded(): %d", isEmbeddedApp );
+
+#endif // RD_CONTROL_PANEL                                  
+
+    iFeatureManagerWrapper = CFeatureManagerWrapper::NewL();
+    TBool isWlanSupported = FeatureManager::FeatureSupported( 
+                                                    KFeatureIdProtocolWlan );
+          
+   CMUILOGGER_WRITE_F( "isWlanSupported: %b", isWlanSupported );
+
+    // connect to connection monitor engine
+    CMUILOGGER_WRITE( "Connection monitor engine" );
+    iMonitor.ConnectL();
+    CMUILOGGER_WRITE( "Connected" );
+
+    CMUILOGGER_WRITE( "Creating connection array" );
+    iConnectionArray = new ( ELeave ) CConnectionArray();
+    iConnectionArray->ConstructL();
+    
+    iActiveWrapper = CActiveWrapper::NewL(); // start ActiveWrapper
+
+    if ( isWlanSupported )
+        {
+        GetEasyWlanIAPNameL();
+        }
+
+    InitializeConnectionArrayL();
+
+    CMUILOGGER_WRITE( "Created" );
+
+    CMUILOGGER_WRITE( "Creating main view" );
+
+#ifdef RD_CONTROL_PANEL
+    CConnectionMonitorUiView* mainView =
+        new ( ELeave ) CConnectionMonitorUiView( iConnectionArray,
+                                                 &iMonitor,
+                                                 isEmbeddedApp,
+                                                 iActiveWrapper );
+#else
+    CConnectionMonitorUiView* mainView =
+        new ( ELeave ) CConnectionMonitorUiView( iConnectionArray,
+                                                 &iMonitor,
+                                                 iActiveWrapper );
+#endif // RD_CONTROL_PANEL
+
+    CleanupStack::PushL( mainView );
+    CMUILOGGER_WRITE( "Constructing main view" );
+    mainView->ConstructL();
+    CMUILOGGER_WRITE( "Adding main view" );
+    AddViewL( mainView );      // transfer ownership to CAknViewAppUi
+
+    SetDefaultViewL( *mainView );
+    iTimerObserver = this;
+
+    CleanupStack::Pop( mainView );
+    CMUILOGGER_WRITE( "Done" );
+
+    CMUILOGGER_WRITE( "Creating details view" );
+    CConnectionMonitorUiDetailsView* detailsView =
+        new ( ELeave ) CConnectionMonitorUiDetailsView( iConnectionArray );
+    CleanupStack::PushL( detailsView );
+    CMUILOGGER_WRITE( "Constructing details view" );
+    detailsView->ConstructL();
+    CMUILOGGER_WRITE( "Adding details view" );
+    AddViewL( detailsView );      // transfer ownership to CAknViewAppUi
+    CleanupStack::Pop( detailsView );
+    CMUILOGGER_WRITE( "Done" );
+    
+    // from this point we can listen to events of RConnectionMonitor server
+    iMonitor.NotifyEventL( *this );
+    
+    activateMainView = EFalse;
+    }
+
+// ----------------------------------------------------
+// CConnectionMonitorUiAppUi::~CConnectionMonitorUiAppUi()
+// Destructor
+// Frees reserved resources
+// ----------------------------------------------------
+//
+CConnectionMonitorUiAppUi::~CConnectionMonitorUiAppUi()
+    {
+    CMUILOGGER_ENTERFN( "~CConnectionMonitorUiAppUi" );
+
+    StopTimer();
+    delete iConnectionArray;
+    delete iEasyWlanIAPName;
+    delete iActiveWrapper;
+    delete iFeatureManagerWrapper;
+
+    // it's needed because views are still active here
+    // and a call from handleforegroundevent from them
+    // can cause exception in StopConnEventNotificationL
+    iMonitor.CancelNotifications();
+    iMonitor.Close();
+    iNewConnectionIdArray.Close();
+    iConnectionsWaitingFirstEvent.Close();
+    CMUILOGGER_LEAVEFN( "~CConnectionMonitorUiAppUi" );
+
+    CMUILOGGER_DELETE;
+    }
+
+// ---------------------------------------------------------------------------
+// CConnectionMonitorUiAppUi::InitializeConnectionArrayL
+// ---------------------------------------------------------------------------
+//
+void CConnectionMonitorUiAppUi::InitializeConnectionArrayL()
+    {
+    CMUILOGGER_ENTERFN( "InitializeConnectionArrayL" );
+
+    CConnectionInfoBase* connectionInfo = NULL;
+    TUint connectionNumber( 0 );
+    TUint connectionId( 0 );
+    TUint subConnectionCount;
+
+    TUint wlanConnectionCounter( 0 );
+    TUint wlanConnectionId( 0 );
+    TConnMonBearerType bearerType( EBearerUnknown );
+    RArray<TUint> connIds;
+    RArray<TInt> bearers;
+    CleanupClosePushL( connIds );
+    CleanupClosePushL( bearers );
+
+    iActiveWrapper->StartGetConnectionCount( connectionNumber, iMonitor );
+
+    if ( !iActiveWrapper->iStatus.Int() )
+        {
+        CMUILOGGER_WRITE_F( "Number of connections: %d",
+                            connectionNumber );
+
+        for ( TUint i = 1; i <= connectionNumber; ++i )
+            {
+            iMonitor.GetConnectionInfo( i, connectionId, subConnectionCount );
+            connIds.AppendL( connectionId );
+            
+            iActiveWrapper->StartGetBearerType( connectionId,
+                                                iMonitor,
+                                                KBearer,
+                                                ( TInt& )bearerType );                                           
+            CMUILOGGER_WRITE_F( "status.Int(): %d", 
+                                iActiveWrapper->iStatus.Int() );
+            CMUILOGGER_WRITE_F( "bearerType: %d", ( TInt )bearerType );
+            bearers.AppendL( (TInt)bearerType );
+            
+            if ( bearerType == EBearerWLAN )
+                {
+                wlanConnectionCounter++;
+                wlanConnectionId = connectionId;
+                }
+            }
+        
+        for ( TInt i = 0; i < connectionNumber; i++ )
+            {           
+            if ( bearers[i] != EBearerWLAN || wlanConnectionCounter < 2 || connIds[i] == wlanConnectionId )
+                {
+                TInt err;
+                TRAP(err, connectionInfo = CreateConnectionInfoL( connIds[i], (TConnMonBearerType)bearers[i] ));
+                
+                if ( !err && connectionInfo )
+                    {
+                    CleanupStack::PushL( connectionInfo );
+                    iConnectionArray->AppendL( connectionInfo );
+                    CleanupStack::Pop( connectionInfo );
+                    }
+                else
+                    {
+                    iNewConnectionIdArray.Append( connIds[i] );
+                    }
+                }
+            else
+                {
+                CMUILOGGER_WRITE( "Fake WLAN connection, skipping" );
+                }
+            }
+        }
+    else
+        {
+        CMUILOGGER_WRITE_F( "GetConnectionCount status: %d", 
+                            iActiveWrapper->iStatus.Int() );
+        }
+
+    CleanupStack::Pop( &bearers );
+    bearers.Close();
+    CleanupStack::Pop( &connIds );
+    connIds.Close();
+
+    CMUILOGGER_LEAVEFN( "InitializeConnectionArrayL Done" );
+    }
+
+// ---------------------------------------------------------------------------
+// CConnectionMonitorUiAppUi::EventL
+// ---------------------------------------------------------------------------
+//
+void CConnectionMonitorUiAppUi::EventL(
+                                       const CConnMonEventBase &aConnMonEvent )
+    {
+    CMUILOGGER_ENTERFN( "CConnectionMonitorUiAppUi::EventL" );
+
+    CMUILOGGER_WRITE_F( "EventL type: %d", aConnMonEvent.EventType() );
+
+    CConnectionInfoBase* connectionInfo = NULL;
+    TInt index( 0 );
+    TConnMonEvent event = ( TConnMonEvent ) aConnMonEvent.EventType();
+    TInt connectionId = aConnMonEvent.ConnectionId();
+
+    CMUILOGGER_WRITE_F( "Connection Id:  %d", connectionId );
+
+    switch ( event )
+        {
+        case EConnMonCreateConnection:
+            {
+            CMUILOGGER_WRITE( "EConnMonCreateConnection" );
+
+            if ( connectionId > 0 )
+                {
+                iConnectionsWaitingFirstEvent.AppendL( connectionId );
+                }
+            break;
+            }
+        case EConnMonDeleteConnection:
+            {
+            CMUILOGGER_WRITE( "EConnMonDeleteConnection" );
+            TInt count = iNewConnectionIdArray.Count();
+            TInt i = 0;
+            TBool newConn = EFalse;
+            
+            for ( TInt cindex = 0; cindex < iConnectionsWaitingFirstEvent.Count(); cindex++ )
+                {
+                if ( iConnectionsWaitingFirstEvent[cindex] == connectionId )
+                    {
+                    newConn = ETrue;
+                    iConnectionsWaitingFirstEvent.Remove(cindex);
+                    break;
+                    }
+                }
+
+            if ( newConn )
+                {
+                // Job done
+                break;
+                }
+                
+            while ( i < count )
+                {
+                if ( iNewConnectionIdArray[i] == connectionId )
+                    {
+                    iNewConnectionIdArray.Remove( i );
+                    CMUILOGGER_WRITE_F( "Removed id %d from array", ( TUint )connectionId );
+                    count--;
+                    }
+                else 
+                    {
+                    i++;
+                    }
+                }
+            
+            index = iConnectionArray->GetArrayIndex( connectionId );
+            if ( index >= 0 )
+                {
+                connectionInfo = ( *iConnectionArray )[index]; 
+            
+                if ( iView->Id() == KDetailsViewId )
+                    {
+                    CConnectionMonitorUiDetailsView* view = (CConnectionMonitorUiDetailsView*) iView;
+                    if ( view->GetSelectedConnection() == ((TUint) index) )
+                        {
+                        view->CloseViewL();
+                        activateMainView = ETrue;
+                        }
+                    }
+                else // MainView
+                    {
+                    TBool deleting = connectionInfo->GetDeletedFromCMUI();
+                    if ( deleting )
+                        {
+                        ShowConnectionSummaryInformationNoteL( connectionInfo );
+                        }
+                    }
+                iConnectionArray->Delete( connectionId );
+                CMUILOGGER_WRITE_F( "Deleted: %d", connectionId );
+                }
+            break;
+            }
+        case EConnMonConnectionStatusChange:
+            {
+            CMUILOGGER_WRITE( "EConnMonConnectionStatusChange" );
+            
+            TBool newConn = EFalse;
+                
+            for ( TInt cindex = 0; cindex < iConnectionsWaitingFirstEvent.Count(); cindex++ )
+                {
+                if ( iConnectionsWaitingFirstEvent[cindex] == connectionId )
+                    {
+                    newConn = ETrue;
+                    iConnectionsWaitingFirstEvent.Remove(cindex);
+                    break;
+                    }
+                }
+            
+            if ( newConn )
+                {
+                if ( connectionId > 0)
+                    {
+                    TConnMonBearerType bearerType( EBearerUnknown );
+                    iActiveWrapper->StartGetBearerType( connectionId,
+                                                        iMonitor,
+                                                        KBearer,
+                                                        ( TInt& )bearerType );  
+                    CMUILOGGER_WRITE_F( "status.Int(): %d", 
+                                        iActiveWrapper->iStatus.Int() );
+                    CMUILOGGER_WRITE_F( "bearerType: %d", ( TInt )bearerType );
+                    if ( bearerType == 0 )
+                        {
+                        if ( connectionId )
+                            {
+                            iNewConnectionIdArray.AppendL( connectionId );
+                            CMUILOGGER_WRITE_F( "id %d added to array", ( TUint )connectionId );
+                            break;
+                            }
+                        }          
+                    
+                    connectionInfo = CreateConnectionInfoL( connectionId, bearerType );
+                    }
+                
+                if ( connectionInfo )
+                    {
+                    CleanupStack::PushL( connectionInfo );
+                    iConnectionArray->AppendL( connectionInfo );
+                    CleanupStack::Pop( connectionInfo );
+                    }
+                }
+            
+            index = iConnectionArray->GetArrayIndex( connectionId );
+            CMUILOGGER_WRITE_F( "Found index :  %d", index );
+
+            if ( index >= 0 )
+                {
+                ( *iConnectionArray )[index]->StatusChangedL();
+                }
+            break;
+            }
+        case EConnMonCreateSubConnection:
+        case EConnMonDeleteSubConnection:
+            {
+            CMUILOGGER_WRITE( "SubConnection" );
+            index = iConnectionArray->GetArrayIndex( connectionId );
+            if ( index >= 0)
+                {
+                ( *iConnectionArray )[index]->RefreshDetailsL();
+                }
+            break;
+            }
+        default:
+            {
+            CMUILOGGER_WRITE( "On event default" );
+            break;
+            }
+        }
+
+    if ( iObserver && ( index >= 0 ) )
+        {
+        CMUILOGGER_WRITE( "EventL calls observer" );
+        iObserver->OnEventL( aConnMonEvent, index );
+        }
+
+    CMUILOGGER_LEAVEFN( "CConnectionMonitorUiAppUi::EventL" );
+    }
+
+// ---------------------------------------------------------------------------
+// CConnectionMonitorUiAppUi::Static
+// ---------------------------------------------------------------------------
+//
+CConnectionMonitorUiAppUi* CConnectionMonitorUiAppUi::Static()
+    {
+    return REINTERPRET_CAST( CConnectionMonitorUiAppUi*,
+                             CEikonEnv::Static()->EikAppUi() );
+    }
+
+// ---------------------------------------------------------------------------
+//  CConnectionMonitorUiAppUi::::DynInitMenuPaneL( TInt aResourceId,
+//  CEikMenuPane* aMenuPane )
+//  This function is called by the EIKON framework just before it displays
+//  a menu pane. Its default implementation is empty, and by overriding it,
+//  the application can set the state of menu items dynamically according
+//  to the state of application data.
+// ---------------------------------------------------------------------------
+//
+void CConnectionMonitorUiAppUi::DynInitMenuPaneL(
+    TInt /*aResourceId*/, CEikMenuPane* /*aMenuPane*/ )
+    {
+    }
+
+// ----------------------------------------------------
+// CConnectionMonitorUiAppUi::HandleKeyEventL(
+//     const TKeyEvent& aKeyEvent, TEventCode /*aType*/ )
+// ----------------------------------------------------
+//
+TKeyResponse CConnectionMonitorUiAppUi::HandleKeyEventL(
+    const TKeyEvent& /*aKeyEvent*/, TEventCode /*aType*/ )
+    {
+    return EKeyWasNotConsumed;
+    }
+
+// ----------------------------------------------------
+// CConnectionMonitorUiAppUi::HandleCommandL( TInt aCommand )
+// ----------------------------------------------------
+//
+void CConnectionMonitorUiAppUi::HandleCommandL( TInt aCommand )
+    {
+    switch ( aCommand )
+        {
+        case EEikCmdExit:
+        case EAknCmdExit:
+        case EAknSoftkeyExit:
+            {
+            Exit();
+            break;
+            }
+        default:
+            break;
+        }
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiAppUi::StartConnEventNotification
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiAppUi::StartConnEventNotification(
+                                    MActiveEventObserverInterface* aObserver )
+    {
+    CMUILOGGER_ENTERFN
+        ( "CConnectionMonitorUiAppUi::StartConnEventNotification" );
+
+    iObserver = aObserver;
+
+    CMUILOGGER_LEAVEFN
+        ( "CConnectionMonitorUiAppUi::StartConnEventNotification" );
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiAppUi::StopConnEventNotification
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiAppUi::StopConnEventNotification(
+                                MActiveEventObserverInterface* aObserver )
+    {
+    CMUILOGGER_ENTERFN
+        ( "CConnectionMonitorUiAppUi::StopConnEventNotification" );
+
+    if ( iObserver == aObserver )
+        {
+        iObserver = NULL;
+        }
+
+    CMUILOGGER_LEAVEFN
+        ( "CConnectionMonitorUiAppUi::StopConnEventNotification" );
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiAppUi::StartTimerL
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiAppUi::StartTimerL( const TInt aInterval )
+    {
+    CMUILOGGER_WRITE( "Starting timer" );
+
+    if ( !iPeriodic )
+        {
+        iPeriodic = CPeriodic::NewL( CActive::EPriorityStandard );
+	    CMUILOGGER_WRITE_F( "aInterval  :  %d", aInterval );
+        
+        iPeriodic->Start( aInterval, aInterval,
+                          TCallBack( Tick, this ) );
+        }
+
+    CMUILOGGER_WRITE( "Timer started" );
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiAppUi::StopTimer
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiAppUi::StopTimer()
+    {
+    CMUILOGGER_WRITE( "Stopping timer" );
+    if ( iPeriodic )
+        {
+        CMUILOGGER_WRITE( "Timer existing" );
+        iPeriodic->Cancel();
+        delete iPeriodic;
+        iPeriodic = NULL;
+        }
+
+    CMUILOGGER_WRITE( "Timer stopped" );
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiAppUi::Tick
+// ---------------------------------------------------------
+//
+TInt CConnectionMonitorUiAppUi::Tick( TAny* aObject )
+    {
+    CMUILOGGER_ENTERFN( "CConnectionMonitorUiAppUi::Tick(TAny* aObject)" );
+
+    CConnectionMonitorUiAppUi* myself =
+                        static_cast<CConnectionMonitorUiAppUi*>( aObject );
+    myself->Tick();
+
+    CMUILOGGER_LEAVEFN( "CConnectionMonitorUiAppUi::Tick(TAny* aObject)" );
+    return 1;
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiAppUi::Tick
+// ---------------------------------------------------------
+//
+TInt CConnectionMonitorUiAppUi::Tick()
+    {
+    CMUILOGGER_ENTERFN( "CConnectionMonitorUiAppUi::Tick()" );
+
+    if ( iTimerObserver )
+        {
+        TInt error( KErrNone );
+
+        TRAP( error, iTimerObserver->OnTimerExpiredL() );
+        CMUILOGGER_WRITE_F( "OnTimerExpiredL error id  :  %d", error );
+
+        // refresh listboxes
+        if ( !error && ( iObserver ) )
+            {
+            CMUILOGGER_WRITE( "Tick !error && ( iObserver )" );
+            TRAP( error, iObserver->OnTimerEventL() );
+            }
+        CMUILOGGER_WRITE( "after Tick !error && ( iObserver )" );
+        }
+
+    CMUILOGGER_LEAVEFN( "CConnectionMonitorUiAppUi::Tick()" );
+    return 1;
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiAppUi::OnTimerExpiredL
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiAppUi::OnTimerExpiredL()
+    {
+    TInt count = iNewConnectionIdArray.Count();
+    if ( count > 0 )
+        {
+        for ( TInt i = 0; i < count; i++ )
+            {
+            TConnMonBearerType bearerType( EBearerUnknown );
+            iActiveWrapper->StartGetBearerType( iNewConnectionIdArray[i],
+                                                iMonitor,
+                                                KBearer,
+                                                ( TInt& )bearerType );  
+            CMUILOGGER_WRITE_F( "status.Int(): %d", 
+                                iActiveWrapper->iStatus.Int() );
+            CMUILOGGER_WRITE_F( "bearerType: %d", ( TInt )bearerType );
+            if ( bearerType == 0 )
+                {
+                continue;
+                }
+            CConnectionInfoBase* connectionInfo = NULL;
+            TInt err;
+            TRAP(err, connectionInfo = CreateConnectionInfoL( iNewConnectionIdArray[i], bearerType ));
+            if ( err )
+                {
+                continue;
+                }
+            
+            
+            if ( connectionInfo )
+                {
+                CleanupStack::PushL( connectionInfo );
+                iConnectionArray->AppendL( connectionInfo );
+                CleanupStack::Pop( connectionInfo );
+                
+                iNewConnectionIdArray.Remove( i );
+                count--;
+                i--;
+                CMUILOGGER_WRITE_F( "Removed index %d from array", ( TInt )i );
+                }
+            
+            }
+        }
+    RefreshAllConnectionsL();
+    if ( iView )
+        {
+        CMUILOGGER_WRITE_F( "iView->Id() %d", iView->Id() );
+        if ( iView->Id() == KConnectionsViewId )
+            {
+            CConnectionMonitorUiView* view =
+                    ( CConnectionMonitorUiView* )iView;
+            view->ConnectionKeyObserver();
+            }
+        }
+    }
+    
+// ---------------------------------------------------------
+// CConnectionMonitorUiAppUi::GetTickInerval
+// ---------------------------------------------------------
+//
+TInt CConnectionMonitorUiAppUi::GetTickInerval() const
+	{
+	return KTickInterval;
+	}    
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiAppUi::RefreshAllConnectionsL
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiAppUi::RefreshAllConnectionsL()
+    {
+    CMUILOGGER_ENTERFN( "CConnectionMonitorUiAppUi::RefreshAllConnectionsL" );
+    TUint index( 0 );
+    CConnectionInfoBase* connection = NULL;
+    if ( iConnectionArray )
+        {
+        TUint count = iConnectionArray->MdcaCount();
+        while ( index < count )
+            {
+            connection = ( *iConnectionArray )[index];
+            // MainView Refresh
+            if ( ( connection->IsAlive() ) && 
+                 ( !connection->IsSuspended() ) )
+                 {
+                 CMUILOGGER_WRITE( "MainView Refresh" );
+                 CMUILOGGER_WRITE_F( "RefreshAllConnectionsL index: %d", 
+                                     index );
+                 CMUILOGGER_WRITE_F( "RefreshAllConnectionsL connId: %d", 
+                                     connection->GetConnectionId() );
+                 connection->RefreshDetailsL();
+                 }
+            // DetailsView Refresh
+            if ( ( connection->IsAlive() && 
+                 ( iView->Id() == KDetailsViewId ) ) )
+                {
+                CMUILOGGER_WRITE( "DetailsView Refresh" );
+                connection->RefreshDetailsArrayL();
+                }
+            connection->RefreshConnectionListBoxItemTextL();
+            count = iConnectionArray->MdcaCount();
+            ++index;
+            }
+        }
+    CMUILOGGER_LEAVEFN( "CConnectionMonitorUiAppUi::RefreshAllConnectionsL" );
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiAppUi::HandleForegroundEventL
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiAppUi::HandleForegroundEventL( TBool aForeground )
+    {
+    CMUILOGGER_ENTERFN( "CConnectionMonitorUiAppUi::HandleForegroundEventL" );
+
+    CAknViewAppUi::HandleForegroundEventL( aForeground );
+    if ( aForeground )
+        {
+        CMUILOGGER_WRITE( "Foreground" );
+        if ( activateMainView && iView != NULL && iView->Id() == KDetailsViewId )
+            {
+            ((CConnectionMonitorUiDetailsView*) iView)->ActivateMainViewL();
+            activateMainView = EFalse;
+            }
+            
+        TInt interval( KTickInterval );
+        if ( iTimerObserver )
+  	        {
+	          interval = iTimerObserver->GetTickInerval();	
+	          }
+        StartTimerL( interval );
+        }
+    else
+        {
+        CMUILOGGER_WRITE( "Background" );
+        StopTimer();
+        activateMainView = EFalse;
+        }
+
+    CMUILOGGER_LEAVEFN( "CConnectionMonitorUiAppUi::HandleForegroundEventL" );
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiAppUi::CreateConnectionInfoL
+// ---------------------------------------------------------
+//
+CConnectionInfoBase* CConnectionMonitorUiAppUi::CreateConnectionInfoL(
+                                                TUint aConnectionId,
+                                                TConnMonBearerType aBearerType )
+    {
+    CMUILOGGER_ENTERFN( "CreateConnectionInfoL - start " );
+
+    CConnectionInfoBase* connection = NULL;
+
+    if ( aConnectionId > 0 )
+        {
+
+#ifdef  __WINS__
+        if ( aBearerType == EBearerLAN )
+            {
+            aBearerType = EBearerGPRS;
+            }
+#endif
+        switch ( aBearerType )
+            {
+            case EBearerGPRS:
+            case EBearerWCDMA:
+            case EBearerEdgeGPRS:
+            case EBearerExternalGPRS:
+            case EBearerExternalWCDMA:
+            case EBearerExternalEdgeGPRS:
+                {
+                CMUILOGGER_WRITE( "CGprsConnectionInfo" );
+                
+                connection = CGprsConnectionInfo::NewL(
+                        aConnectionId,
+                        &iMonitor,
+                        aBearerType,
+                        iActiveWrapper );
+                break;
+                }
+            case EBearerCSD:
+            case EBearerHSCSD:
+            case EBearerWcdmaCSD:
+            case EBearerExternalCSD:
+            case EBearerExternalHSCSD:
+            case EBearerExternalWcdmaCSD:
+                {
+                CMUILOGGER_WRITE( "CCsdConnectionInfo" );
+
+                connection = CCsdConnectionInfo::NewL(
+                        aConnectionId,
+                        &iMonitor,
+                        aBearerType,
+                        iActiveWrapper );
+                break;
+                }
+            case EBearerWLAN:
+                //case EBearerExternalWLAN:
+                {
+                CMUILOGGER_WRITE( "CWlanConnectionInfo" );
+                
+                connection = CWlanConnectionInfo::NewL(
+                        aConnectionId,
+                        &iMonitor,
+                        aBearerType,
+                        iEasyWlanIAPName,
+                        iActiveWrapper );
+                break;
+                }
+            default :
+                {
+                CMUILOGGER_WRITE( "CreateConnectionInfoL, default" );
+                break;
+                }
+            }
+            CMUILOGGER_WRITE_F( "Connection created: %d", aConnectionId );
+
+        if (  connection && connection->CheckMrouterIap() )
+            {
+            CMUILOGGER_WRITE_F( "Connection deleted: %d", aConnectionId );
+            delete connection;
+            connection = NULL;
+            }
+        }
+    else
+        {
+        CMUILOGGER_WRITE( "Connection id is invalid" );
+        }
+
+    CMUILOGGER_LEAVEFN( "CreateConnectionInfoL - end " );
+
+    return connection;
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiAppUi::GetEasyWlanIAPNameL
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiAppUi::GetEasyWlanIAPNameL()
+    {
+    CMUILOGGER_ENTERFN( "CConnectionMonitorUiAppUi::GetEasyWlanIAPNameL" );
+
+    delete iEasyWlanIAPName;
+    iEasyWlanIAPName = NULL;
+
+    RCmManagerExt cmManagerExt;
+    cmManagerExt.OpenL();
+    CleanupClosePushL( cmManagerExt );
+    
+    TUint32 easyWlanId = cmManagerExt.EasyWlanIdL();
+    if ( easyWlanId )
+            {
+            CMUILOGGER_WRITE_F( "easyWlanId %d", easyWlanId );
+            iEasyWlanIAPName = cmManagerExt
+                                .GetConnectionMethodInfoStringL( 
+                                                        easyWlanId, 
+                                                        CMManager::ECmName );
+            CMUILOGGER_WRITE_F( "iEasyWlanIAPName: %S", iEasyWlanIAPName );
+            }
+
+    CleanupStack::PopAndDestroy( &cmManagerExt );
+
+    CMUILOGGER_LEAVEFN( "CConnectionMonitorUiAppUi::GetEasyWlanIAPNameL" );
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiAppUi::ShowConnectionSummaryInformationNoteL
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiAppUi::ShowConnectionSummaryInformationNoteL( 
+										const CConnectionInfoBase* aConnection )
+    {
+    CMUILOGGER_ENTERFN( 
+    	"CConnectionMonitorUiContainer::ShowConnectionSummaryInformationNoteL" );
+    	
+ 	HBufC* total = aConnection->ToStringTotalTransmittedDataLC();
+    HBufC* duration = aConnection->ToStringDurationLC();
+    
+    CMUILOGGER_WRITE_F( "total: %S", total );
+    CMUILOGGER_WRITE_F( "duration: %S", duration );
+      	
+    CDesCArrayFlat* strings = new( ELeave ) CDesCArrayFlat( 2 );
+    CleanupStack::PushL( strings );
+
+    strings->AppendL( *total );
+    strings->AppendL( *duration );    	
+    	
+    HBufC* informationText;
+    informationText = StringLoader::LoadLC( R_QTN_CMON_CONNECTION_SUMMARY_NOTE_TEXT, 
+    										*strings );
+    										        
+    CAknNoteDialog* dlg = new ( ELeave ) CAknNoteDialog( 
+    										CAknNoteDialog::ENoTone, 
+    										CAknNoteDialog::TTimeout( 5000000 ) );
+    dlg->PrepareLC( R_QTN_CMON_CONNECTION_SUMMARY_NOTE );
+    dlg->SetTextWrapping( EFalse );
+    
+    TPtr temp( informationText->Des() );
+    AknTextUtils::DisplayTextLanguageSpecificNumberConversion( temp );
+    
+    dlg->SetCurrentLabelL( EGeneralNote, temp ); //SetTextL
+    
+    dlg->RunDlgLD();    
+        
+    CleanupStack::PopAndDestroy( informationText );
+    CleanupStack::PopAndDestroy( strings );
+	CleanupStack::PopAndDestroy( duration );
+	CleanupStack::PopAndDestroy( total );
+    
+    CMUILOGGER_LEAVEFN( 
+    	"CConnectionMonitorUiContainer::ShowConnectionSummaryInformationNoteL" );        
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiAppUi::DeleteDetailsView
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiAppUi::DeleteDetailsView(
+                                            TInt aConnId,
+                                            CConnectionInfoBase* aConnInfo )
+    {
+    CMUILOGGER_WRITE( "CConnectionMonitorUiAppUi::DeleteDetailsView Start" );
+    CMUILOGGER_WRITE_F( "aConnInfo:  %d", aConnInfo );
+    CMUILOGGER_WRITE_F( "aConnId:  %d", aConnId );
+
+	TBool deleting = aConnInfo->GetDeletedFromCMUI();
+    iConnectionArray->Delete( aConnId );
+    
+    CMUILOGGER_WRITE_F( "Deleted: %d", aConnId );
+    CMUILOGGER_WRITE( "CConnectionMonitorUiAppUi::DeleteDetailsView End" );
+    }
+
+#ifdef RD_CONTROL_PANEL
+
+// -----------------------------------------------------------------------------
+// CConnectionMonitorUiAppUi::IsEmbedded
+// -----------------------------------------------------------------------------
+//
+TBool CConnectionMonitorUiAppUi::IsEmbedded() const
+    {
+    return iEikonEnv->StartedAsServerApp();
+    }
+    
+#endif // RD_CONTROL_PANEL 
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorui/src/ConnectionMonitorUiContainer.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,758 @@
+/*
+* Copyright (c) 2002 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 control class
+*
+*
+*/
+
+
+// INCLUDE FILES
+#include <aknnavi.h>    //for CNaviPane
+#include <aknnavide.h>  //for CAknNavigationDecorator
+
+#include <AknIconArray.h>
+#include <aknlists.h>
+#include <StringLoader.h>
+#include <AknQueryDialog.h>
+#include <AknsUtils.h>
+#include <AknGlobalNote.h>
+
+#include "ConnectionArray.h"
+#include "ConnectionMonitorUiContainer.h"
+#include "FeatureManagerWrapper.h"
+#include "ActiveWrapper.h"
+
+#include <ConnectionMonitorUi.rsg>
+#include <ConnectionMonitorUi.mbg>
+#include <data_caging_path_literals.hrh>
+
+#include  <hlplch.h>
+#include <csxhelp/cmon.hlp.hrh>
+
+// CONSTANTS 
+/**
+* UID of ConnectionMonitorUi App.
+*/
+LOCAL_D const TUid KUidConnMonUI = { 0x101F84D0 };
+
+
+// CONSTANTS
+// Granularity of the model array.
+/**
+* Granularity of icon array
+*/
+LOCAL_D const TInt KGranularity = 5;
+
+
+_LIT( KEmpty, "");  ///< Empty string
+
+// ROM folder
+_LIT( KDriveZ, "z:" );
+
+// Name of the MBM file containing bitmaps
+_LIT( KConnectionMonitorUiMBMFile, "ConnectionMonitorUi.mbm" );
+
+// ================= MEMBER FUNCTIONS =======================
+// ---------------------------------------------------------
+// CConnectionMonitorUiContainer::CConnectionMonitorUiContainer
+// ---------------------------------------------------------
+//
+CConnectionMonitorUiContainer::CConnectionMonitorUiContainer(
+                                  CConnectionArray* const aConnectionArray,
+                                  RConnectionMonitor* aMonitor,
+                                  CActiveWrapper* aActiveWrapper )
+    : CCoeControl(), 
+    iMonitor( aMonitor ),
+    iConnectionArray( aConnectionArray ), 
+    isWlanSupported( EFalse ),
+    iActiveWrapper( aActiveWrapper )
+    {
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiContainer::ConstructL
+// EPOC two phased constructor
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiContainer::ConstructL( TInt aSelectedItem, const TRect& aRect )
+    {
+    CMUILOGGER_ENTERFN( "CConnectionMonitorUiContainer::ConstructL" );
+
+    CreateWindowL(); 
+    
+    iListBox = new( ELeave ) CAknDoubleGraphicStyleListBox;
+    TInt flags( EAknGenericListBoxFlags );
+    iListBox->ConstructL( this, flags );
+    iListBox->CreateScrollBarFrameL( ETrue );
+    iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(
+                                               CEikScrollBarFrame::EOff,
+                                               CEikScrollBarFrame::EAuto );
+    iListBox->Model()->SetOwnershipType( ELbmOwnsItemArray
+                                         /*ELbmDoesNotOwnItemArray*/ );
+    iListBox->Model()->SetItemTextArray( iConnectionArray );
+    iListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
+    
+    TInt actCount = iConnectionArray->MdcaCount() - 1;
+	
+	if ( actCount > KErrNotFound )
+		{
+		iListBox->SetCurrentItemIndex( aSelectedItem > actCount ? actCount : aSelectedItem );	    
+		}
+
+    SetIconsL();
+
+    HBufC* noConn = StringLoader::LoadLC( R_QTN_CMON_NO_ACTIVE_CONNECTIONS,
+                                          iEikonEnv );
+
+    CListBoxView *lbview = iListBox->View();
+    lbview->SetListEmptyTextL( *noConn );
+    CleanupStack::PopAndDestroy( noConn );
+
+    GetPanesL();
+    SetRect( aRect );    
+    ActivateL();
+
+    isWlanSupported = FeatureManager::FeatureSupported( KFeatureIdProtocolWlan ); 
+
+    CMUILOGGER_LEAVEFN( "CConnectionMonitorUiContainer::ConstructL" );
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiContainer::OfferKeyEventL
+// ---------------------------------------------------------
+//
+TKeyResponse CConnectionMonitorUiContainer::OfferKeyEventL(
+                                                   const TKeyEvent& aKeyEvent,
+                                                   TEventCode aType )
+    {
+    TKeyResponse result( EKeyWasNotConsumed );
+    if ( aType == EEventKey )
+        {
+        TInt index = iListBox->CurrentItemIndex();
+        if ( ( aKeyEvent.iCode == EKeyBackspace ) && ( index != -1 ) )
+            {
+            if ( !( *iConnectionArray )[index]->IsSuspended() )
+                {
+                EndConnectionL();
+                result = EKeyWasConsumed;
+                }
+            }
+        else
+            {
+            result = iListBox->OfferKeyEventL( aKeyEvent, aType );
+            }
+        }
+    return result;
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiContainer::~CConnectionMonitorUiContainer
+// ---------------------------------------------------------
+//
+CConnectionMonitorUiContainer::~CConnectionMonitorUiContainer()
+    {
+    delete iListBox;
+    delete iNaviDecorator;
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiContainer::SizeChanged()
+// Called by framework when the view size is changed
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiContainer::SizeChanged()
+    {
+    iListBox->SetRect( Rect() );
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiContainer::CountComponentControls
+// ---------------------------------------------------------
+//
+TInt CConnectionMonitorUiContainer::CountComponentControls() const
+    {
+    return 1; // only iListBox
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiContainer::ComponentControl( TInt aIndex ) const
+// ---------------------------------------------------------
+//
+CCoeControl* CConnectionMonitorUiContainer::ComponentControl(
+                                                          TInt aIndex ) const
+    {
+    switch ( aIndex )
+        {
+        case 0:
+            return iListBox;
+        default:
+            return NULL;
+        }
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiContainer::OnEventL
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiContainer::OnEventL(
+                                       const CConnMonEventBase& aConnMonEvent,
+                                       const TInt aIndex )
+    {
+    CMUILOGGER_ENTERFN( "CConnectionMonitorUiContainer::OnEventL" );
+    CMUILOGGER_WRITE_F( "OnEventL type: %d", aConnMonEvent.EventType() );
+    CMUILOGGER_WRITE_F( "OnEventL index: %d", aIndex );
+
+    TBool validIndex =( iListBox->Model()->NumberOfItems() > KErrNotFound ) &&
+                      ( aIndex > KErrNotFound ) &&
+                      ( iListBox->Model()->NumberOfItems() >= aIndex );
+
+    if ( aConnMonEvent.ConnectionId() )
+        {
+        switch ( aConnMonEvent.EventType() )
+            {
+            case EConnMonCreateConnection:
+                {
+                CMUILOGGER_WRITE( "OnEventL EConnMonCreateConnection" );
+                iListBox->HandleItemAdditionL();
+                break;
+                }
+            case EConnMonDeleteConnection:
+                {
+                CMUILOGGER_WRITE( "OnEventL EConnMonDeleteConnection" );
+    			CMUILOGGER_WRITE_F( "validIndex: %b", validIndex );
+                
+                if ( validIndex )
+                    {
+                    TBool current
+                        ( aIndex == ( TUint )iListBox->CurrentItemIndex() );
+                    AknListBoxUtils::HandleItemRemovalAndPositionHighlightL(
+                                iListBox, aIndex, ETrue );
+                    }
+                iListBox->UpdateScrollBarsL();
+                break;
+                }
+            case EConnMonConnectionStatusChange:
+            case EConnMonCreateSubConnection:
+            case EConnMonDeleteSubConnection:
+                {
+                CMUILOGGER_WRITE( "OnEventL StatusChange SubConnection" );
+                if ( validIndex )
+                    {
+                    iListBox->DrawItem( aIndex );
+                    }
+                break;
+                }
+            default:
+                {
+                CMUILOGGER_WRITE( "OnEventL default" );
+                break;
+                }
+            }
+        }
+    PushAndRefreshNaviPaneL();
+
+    CMUILOGGER_LEAVEFN( "CConnectionMonitorUiContainer::OnEventL" );
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiContainer::OnTimerEventL
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiContainer::OnTimerEventL()
+    {
+    iListBox->DrawNow();
+    iListBox->UpdateScrollBarsL();
+    PushAndRefreshNaviPaneL();
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiContainer::DrawFirstAllListBoxItem
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiContainer::DrawFirstAllListBoxItem()
+    {
+    TInt count = iListBox->Model()->NumberOfItems() - 1;
+    for ( TInt i = count; i > -1; --i )
+        {
+        iListBox->DrawItem( i );
+        }
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiContainer::SelectedConnection
+// ---------------------------------------------------------
+//
+TInt CConnectionMonitorUiContainer::SelectedConnection()
+    {
+    return iListBox->CurrentItemIndex();
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiContainer::EndConnectionL
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiContainer::EndConnectionL()
+    {
+    CMUILOGGER_ENTERFN( "CConnectionMonitorUiContainer::EndConnectionL " );
+    TInt index = iListBox->CurrentItemIndex();
+    if ( ( index >= 0 ) && ( index < iConnectionArray->MdcaCount() ) )
+        {
+        CConnectionInfoBase* connection = ( *iConnectionArray )[index];
+        TUint connectionId = connection->GetConnectionId();
+        HBufC* connectionName = NULL;
+        HBufC* promptConnectionName = NULL;
+
+        // Get the bearertype of a single connection
+        TConnMonBearerType bearer;
+        bearer = connection->GetBearerType();
+
+        if ( isWlanSupported ) // WLAN ON
+            {
+            if ( ( bearer == EBearerWLAN ) && connection->IsEasyWLAN() )
+                {
+                /* check and load the SSID for EasyWLAN */
+                connectionName = connection->GetWlanNetworkNameLC();
+                CMUILOGGER_WRITE_F( "GetWlanNetworkNameLC: %S",
+                                    connectionName );
+                }
+            else
+                {
+                connectionName = connection->GetNameLC();
+                CMUILOGGER_WRITE_F( "GetNameLC: %S", connectionName );
+                }
+            }
+        else // WLAN OFF
+            {
+            connectionName = connection->GetNameLC();
+            CMUILOGGER_WRITE_F( "GetNameLC: %S", connectionName );
+            }
+
+        if ( bearer >= EBearerExternalCSD )
+            {
+            CMUILOGGER_WRITE( "R_QTN_CMON_CONF_END_MODEM_CONN" );
+            promptConnectionName = StringLoader::LoadLC( 
+                                            R_QTN_CMON_CONF_END_MODEM_CONN );
+            }
+        else
+            {
+            CMUILOGGER_WRITE( "R_QTN_CMON_CONF_END_SINGLE_CONN" );
+            promptConnectionName = StringLoader::LoadLC( 
+                                            R_QTN_CMON_CONF_END_SINGLE_CONN,
+                                            *connectionName );
+            }
+
+        CAknQueryDialog* dlg = CAknQueryDialog::NewL();
+        TInt ret = dlg->ExecuteLD( R_END_CONN_CONFIRMATION_QUERY,
+                                   *promptConnectionName );
+
+        CleanupStack::PopAndDestroy( promptConnectionName );
+        CleanupStack::PopAndDestroy( connectionName );
+        
+        TInt connStatus;
+        iActiveWrapper->StartGetIntAttribute( connectionId,
+                                             iMonitor,
+                                             KConnectionStatus,
+                                             ( ( TInt& )( connStatus ) ) );
+        CMUILOGGER_WRITE_F( "KConnectionStatus status.Int(): %d",
+                            iActiveWrapper->iStatus.Int() );
+        CMUILOGGER_WRITE_F( "KConnectionStatus connStatus: %d",
+                            connStatus );
+        CMUILOGGER_WRITE_F( "ret ret: %d", ret );
+                           
+        if ( ( ret == EAknSoftkeyOk ) || ( ret == EAknSoftkeyYes ) )
+            {
+            if ( KErrNone == iActiveWrapper->iStatus.Int() )
+                {                
+                connection->SetDeletedFromCMUI();
+                
+                connection->RefreshConnectionListBoxItemTextL();
+                DrawFirstAllListBoxItem();
+                
+                iMonitor->SetBoolAttribute( connectionId, 0,
+                                            KConnectionStop, ETrue );
+                CMUILOGGER_WRITE( "after SetBoolAttribute" );                                            
+                }
+            }            
+        else
+            {
+            if ( KErrNotFound == iActiveWrapper->iStatus.Int() )
+                {
+                /* It is already closed */
+                /* An information note must be displayed */
+                CAknGlobalNote * note = CAknGlobalNote::NewL();
+                CleanupStack::PushL( note );
+                HBufC* informationText =
+                    StringLoader::LoadLC( R_QTN_CMON_INFO_CONN_ALREADY_END );
+
+                note->ShowNoteL(EAknGlobalInformationNote, *informationText );
+                CleanupStack::PopAndDestroy( informationText );
+                CleanupStack::PopAndDestroy( note );
+                CMUILOGGER_WRITE( "It is already closed" );
+                }
+            }
+        }
+    CMUILOGGER_LEAVEFN( "CConnectionMonitorUiContainer::EndConnectionL " );
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiContainer::EndAllConnectionL
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiContainer::EndAllConnectionL()
+    {
+    CMUILOGGER_ENTERFN( "EndAllConnectionL - start" );
+
+    const TInt KOnlyOneConnection = 1;
+    const TInt KFirstConnection = 0;
+	CConnectionArray* tempConnArray =  iConnectionArray->DeepCopyL();	
+	CleanupStack::PushL( tempConnArray );
+	
+    TInt connectionCount = tempConnArray->MdcaCount();
+    HBufC* promptTxt = NULL;
+    if ( connectionCount == KOnlyOneConnection )
+        {
+        HBufC* temp = ( *tempConnArray )[KFirstConnection]->GetNameLC();
+        TName iapName = *temp;
+        CleanupStack::PopAndDestroy( temp );
+        promptTxt = StringLoader::LoadLC( R_QTN_CMON_CONF_END_SINGLE_CONN,
+                                       iapName );
+        }
+    else
+        {
+        promptTxt = StringLoader::LoadLC( R_QTN_CMON_CONF_END_ALL_CONNS,
+                                       connectionCount );
+        TPtr temp( promptTxt->Des() );
+        AknTextUtils::DisplayTextLanguageSpecificNumberConversion( temp );
+                                       
+        }
+    CAknQueryDialog* dlg = CAknQueryDialog::NewL();
+    TInt ret = dlg->ExecuteLD( R_END_CONN_CONFIRMATION_QUERY, *promptTxt );
+    CleanupStack::PopAndDestroy( promptTxt );
+
+    CConnectionInfoBase* connection = NULL;
+    TUint connectionId( 0 );
+
+    CMUILOGGER_WRITE_F( "ret: %d", ret );
+
+    /* End connections one by one, First CSD, after GPRS and WLAN. */
+    if ( ( ret == EAknSoftkeyOk ) || ( ret == EAknSoftkeyYes ) )
+        {
+        for ( TUint i = 0; i < iConnectionArray->MdcaCount(); ++i )
+            {
+            connection = ( *iConnectionArray )[i];
+            connection->SetAllDeletedFromCMUI();
+            connection->RefreshConnectionListBoxItemTextL();
+            }
+              
+        DrawFirstAllListBoxItem();
+        
+        TConnMonBearerType bearer;
+        for ( TUint i = 0; i < connectionCount; ++i )
+            {
+            CMUILOGGER_WRITE_F( "i: %d", i );
+
+            connection = ( *tempConnArray )[i];
+
+			bearer = connection->GetBearerType();
+		    switch ( bearer )
+		        {
+		        case EBearerCSD:
+		        case EBearerExternalCSD:
+		        case EBearerWcdmaCSD:
+		        case EBearerExternalWcdmaCSD:
+		        case EBearerHSCSD:
+		        case EBearerExternalHSCSD:
+		            {
+		            connectionId = connection->GetConnectionId();
+	            	iMonitor->SetBoolAttribute( connectionId, 0,
+	                                        	KConnectionStop, ETrue );	
+		            CMUILOGGER_WRITE_F( "CSD i: %d", i );
+		            CMUILOGGER_WRITE_F( "connectionId: %d", connectionId );
+		            break;
+		            }		        
+		        default :
+		            {
+		            break;
+		            }
+		        }
+            }
+            
+        for ( TUint i = 0; i < connectionCount; ++i )
+            {
+            CMUILOGGER_WRITE_F( "i: %d", i );
+
+            connection = ( *tempConnArray )[i];
+
+			bearer = connection->GetBearerType();
+		    switch ( bearer )
+		        {
+                case EBearerGPRS:
+                case EBearerWCDMA:
+                case EBearerEdgeGPRS:
+                case EBearerExternalGPRS:
+                case EBearerExternalWCDMA:
+                case EBearerExternalEdgeGPRS:
+                case EBearerWLAN:
+		            {
+		            connectionId = connection->GetConnectionId();
+	            	iMonitor->SetBoolAttribute( connectionId, 0,
+	                                        	KConnectionStop, ETrue );	
+		            CMUILOGGER_WRITE_F( "GPRS i: %d", i );
+		            CMUILOGGER_WRITE_F( "connectionId: %d", connectionId );
+		            break;
+		            }		        
+		        default :
+		            {
+		            break;
+		            }
+		        }
+            }
+        }
+     else
+        {
+        for ( TUint i = 0; 
+             ( ( i < connectionCount ) && 
+               ( KErrNotFound != iActiveWrapper->iStatus.Int() ) ); ++i )
+            {
+            connection = ( *tempConnArray )[i];
+            connectionId = connection->GetConnectionId();
+        	TInt connStatus;
+        	iActiveWrapper->StartGetIntAttribute( connectionId,
+                                                  iMonitor,
+                                                  KConnectionStatus,
+                                                  ( ( TInt& )( connStatus ) ) );
+            }
+            
+        if ( KErrNotFound == iActiveWrapper->iStatus.Int() )
+            {
+            /* It is already closed */
+            /* An information note must be displayed */
+            CAknGlobalNote * note = CAknGlobalNote::NewL();
+            CleanupStack::PushL( note );
+            HBufC* informationText =
+                StringLoader::LoadLC( R_QTN_CMON_INFO_CONN_ALREADY_END );
+
+            note->ShowNoteL(EAknGlobalInformationNote, *informationText );
+            CleanupStack::PopAndDestroy( informationText );
+            CleanupStack::PopAndDestroy( note );
+            CMUILOGGER_WRITE( "It is already closed in All" );
+            }
+        }
+        
+    CleanupStack::PopAndDestroy( tempConnArray );
+        
+    CMUILOGGER_LEAVEFN( "EndAllConnectionL - end" );
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiContainer::ListBox
+// ---------------------------------------------------------
+//
+CAknDoubleGraphicStyleListBox* CConnectionMonitorUiContainer::ListBox() const
+    {
+    return iListBox;
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiContainer::SetIconsL()
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiContainer::SetIconsL()
+    {
+    CMUILOGGER_ENTERFN( "SetIconsL" );
+    
+    TFileName iconsFileName;
+
+    iconsFileName.Append( KDriveZ );
+
+    iconsFileName.Append( KDC_APP_BITMAP_DIR );
+
+    iconsFileName.Append( KConnectionMonitorUiMBMFile );
+
+    CArrayPtr< CGulIcon >* icons = new( ELeave ) CAknIconArray( KGranularity );
+    CleanupStack::PushL( icons );
+
+    MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
+
+    icons->AppendL( AknsUtils::CreateGulIconL( skinInstance,
+                            KAknsIIDQgnPropWmlGprs,
+                            iconsFileName,
+                            EMbmConnectionmonitoruiQgn_prop_wml_gprs,
+                            EMbmConnectionmonitoruiQgn_prop_wml_gprs_mask ) );
+
+    icons->AppendL( AknsUtils::CreateGulIconL( skinInstance,
+                            KAknsIIDQgnPropWmlCsd,
+                            iconsFileName,
+                            EMbmConnectionmonitoruiQgn_prop_wml_csd,
+                            EMbmConnectionmonitoruiQgn_prop_wml_csd_mask ) );
+
+    icons->AppendL( AknsUtils::CreateGulIconL( skinInstance,
+                        KAknsIIDQgnPropWmlHscsd,
+                        iconsFileName,
+                        EMbmConnectionmonitoruiQgn_prop_wml_hscsd,
+                        EMbmConnectionmonitoruiQgn_prop_wml_hscsd_mask ) );
+
+    icons->AppendL( AknsUtils::CreateGulIconL( skinInstance,
+                  KAknsIIDQgnPropEmpty,
+                  iconsFileName,
+                  EMbmConnectionmonitoruiQgn_prop_empty,
+                  EMbmConnectionmonitoruiQgn_prop_empty_mask ) );
+
+    icons->AppendL( AknsUtils::CreateGulIconL( skinInstance,
+              KAknsIIDQgnPropWmlSms,
+              iconsFileName,
+              EMbmConnectionmonitoruiQgn_prop_cmon_gprs_suspended,
+              EMbmConnectionmonitoruiQgn_prop_cmon_gprs_suspended_mask ) );
+
+    icons->AppendL( AknsUtils::CreateGulIconL( skinInstance,
+                  KAknsIIDQgnPropWlanBearer,
+                  iconsFileName,
+                  EMbmConnectionmonitoruiQgn_prop_wlan_bearer,
+                  EMbmConnectionmonitoruiQgn_prop_wlan_bearer_mask ) );
+
+    iListBox->ItemDrawer()->FormattedCellData()->SetIconArrayL( icons );
+    CleanupStack::Pop( icons ); // icons
+    CMUILOGGER_LEAVEFN( "SetIconsL" );        
+    
+    }
+
+// ---------------------------------------------------------------------------
+// void CConnectionMonitorUiContainer::HandleResourceChange( TInt aType )
+// Handle resource change events.
+// ---------------------------------------------------------------------------
+//
+void CConnectionMonitorUiContainer::HandleResourceChange( TInt aType )
+    {
+    CMUILOGGER_ENTERFN( "HandleResourceChange" );
+    CMUILOGGER_WRITE_F( "aType: %d", aType );            
+    
+    CCoeControl::HandleResourceChange( aType );
+    
+    if ( aType == KAknsMessageSkinChange )
+        {
+        TInt error( KErrNone );
+        TRAP( error,  SetIconsL() );
+        CMUILOGGER_WRITE_F( "KAknsMessageSkinChange error: %d", error );
+        SizeChanged();
+        }
+        
+    if ( aType == KEikDynamicLayoutVariantSwitch )
+        {
+        TRect mainPaneRect;
+        AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, 
+                                           mainPaneRect );        
+        SetRect( mainPaneRect );                
+        DrawNow();                
+        }        
+    CMUILOGGER_LEAVEFN( "HandleResourceChange" );        
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiContainer::GetPanesL
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiContainer::GetPanesL()
+    {
+    CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane();
+
+    iNaviPane =  STATIC_CAST( CAknNavigationControlContainer*,
+               statusPane->ControlL( TUid::Uid(EEikStatusPaneUidNavi ) ) );
+
+    PushAndRefreshNaviPaneL();
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiContainer::PushAndRefreshNaviPaneL
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiContainer::PushAndRefreshNaviPaneL()
+    {
+    CMUILOGGER_ENTERFN( "PushAndRefreshNaviPaneL - start" );
+
+    HBufC* textOfNaviPane = NULL;
+    TUint countOfConnection = iConnectionArray->NumberOfActiveConnections();
+    CMUILOGGER_WRITE_F( "countOfConnection: %d", countOfConnection );
+
+    if ( iNaviDecorator )
+        {
+        PopNaviPane();
+        }
+
+    if ( countOfConnection )
+        {
+        if ( countOfConnection == 1 )
+            {
+            textOfNaviPane = StringLoader::LoadLC(
+                                         R_QTN_CMON_NAVI_ONE_ACTIVE_CONN );
+            }
+        else
+            {
+            textOfNaviPane = StringLoader::LoadLC(
+                                            R_QTN_CMON_NAVI_MANY_ACTIVE_CONNS,
+                                            countOfConnection );
+            }
+        }
+    else
+        {
+        textOfNaviPane =  KEmpty().AllocLC();
+        }
+
+    TPtr temp( textOfNaviPane->Des() );
+    AknTextUtils::DisplayTextLanguageSpecificNumberConversion( temp );
+        
+    iNaviDecorator = iNaviPane->CreateNavigationLabelL( *textOfNaviPane );
+    CleanupStack::PopAndDestroy( textOfNaviPane );
+
+    iNaviPane->PushL( *iNaviDecorator );
+    CMUILOGGER_LEAVEFN( "PushAndRefreshNaviPaneL - end" );
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiContainer::PopNaviPane
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiContainer::PopNaviPane()
+    {
+    iNaviPane->Pop( iNaviDecorator );
+    delete iNaviDecorator;
+    iNaviDecorator = NULL;
+    }   
+    
+// ---------------------------------------------------------
+// CConnectionMonitorUiContainer::FocusChanged
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiContainer::FocusChanged( TDrawNow aDrawNow )
+    {
+    CMUILOGGER_ENTERFN( "CConnectionMonitorUiContainer::FocusChanged" );
+    CCoeControl::FocusChanged( aDrawNow );    
+    if ( iListBox )
+        {
+        iListBox->SetFocus( IsFocused() );
+        }        
+    CMUILOGGER_LEAVEFN( "CConnectionMonitorUiContainer::FocusChanged" );    
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiContainer::GetHelpContext()
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiContainer::GetHelpContext( TCoeHelpContext& aContext) const
+    {
+    aContext.iMajor = KUidConnMonUI;
+    aContext.iContext = KCMON_HLP_CMON_MAIN_VIEW;
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorui/src/ConnectionMonitorUiDetailsContainer.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,615 @@
+/*
+* Copyright (c) 2002 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 control class
+*
+*
+*/
+
+// INCLUDE FILES
+#include "ConnectionMonitorUiDetailsContainer.h"
+
+#include <aknnavi.h>    //for CNaviPane
+#include <aknnavide.h>  //for CAknNavigationDecorator
+#include <StringLoader.h>
+#include <ConnectionMonitorUi.rsg>
+
+#include "ConnectionArray.h"
+#include "ConnectionMonitorUiLogger.h"
+#include "ConnectionMonitorUiDetailsView.h"
+#include "ConnectionMonitorUi.hrh"
+
+// CONSTANTS
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiDetailsContainer::ConstructL( const TRect& aRect )
+// EPOC two phased constructor
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiDetailsContainer::ConstructL( const TRect& aRect,
+                               CConnectionMonitorUiDetailsView* aParentView )
+    {
+    CMUILOGGER_WRITE( "CConnectionMonitorUiDetailsContainer::ConstructL" );
+    CreateWindowL();
+    
+    iParentView = aParentView;
+    iListBox = new( ELeave ) CAknSingleHeadingStyleListBox;
+    iListBox->SetContainerWindowL( *this );
+    TInt flags = 0;
+    flags |= EAknListBoxViewerFlags;
+    iListBox->ConstructL( this, flags );
+    iListBox->CreateScrollBarFrameL( ETrue );
+    iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(
+                                                 CEikScrollBarFrame::EOff,
+                                                 CEikScrollBarFrame::EAuto );
+
+    CMUILOGGER_WRITE( "Creating connection details array" );
+
+    iListBox->Model()->SetOwnershipType( ELbmOwnsItemArray );
+
+    SetRect( aRect );
+
+    HBufC* noConn = StringLoader::LoadLC( R_QTN_CMON_NO_ACTIVE_CONNECTIONS,
+                                          iEikonEnv );
+    CListBoxView *lbview = iListBox->View();
+    lbview->SetListEmptyTextL( *noConn );
+    CleanupStack::PopAndDestroy( noConn );
+
+
+    GetPanesL();
+
+    ActivateL();
+    CMUILOGGER_WRITE( "CConnectionMonitorUiDetailsContainer::ConstructL" );
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiDetailsContainer::SetSelectedConnectionL
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiDetailsContainer::SetSelectedConnectionL(
+                                                    TUint aConnectionIndex )
+    {
+    CMUILOGGER_ENTERFN( "CConnectionMonitorUiDetailsContainer::SetSelectedConnectionL" );
+    CMUILOGGER_WRITE_F( "aConnectionIndex : %d", &aConnectionIndex );
+    CMUILOGGER_WRITE_F( "iConnectionArray->MdcaCount() : %d",
+                        iConnectionArray->MdcaCount() );
+    
+    CConnectionInfoBase* temp = ( *iConnectionArray ).At( aConnectionIndex );
+    CDesCArrayFlat* tempArray = temp ? temp->GetDetailsArray() : NULL ;
+    if ( tempArray )
+        {
+        iConnectionIndex = aConnectionIndex;
+        iConnectionInfo = temp;
+        iListBox->Model()->SetItemTextArray( tempArray );
+        iListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
+        iListBox->Reset();
+        iListBox->UpdateScrollBarsL();        
+        }
+    
+    CMUILOGGER_LEAVEFN( "CConnectionMonitorUiDetailsContainer::SetSelectedConnectionL" );    
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiDetailsContainer::~CConnectionMonitorUiDetailsContainer
+// ---------------------------------------------------------
+//
+CConnectionMonitorUiDetailsContainer::~CConnectionMonitorUiDetailsContainer()
+    {
+    delete iListBox;
+    delete iNaviDecorator;
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiContainer::CConnectionMonitorUiContainer
+// ---------------------------------------------------------
+//
+CConnectionMonitorUiDetailsContainer::CConnectionMonitorUiDetailsContainer(
+                             const CConnectionArray* const aConnectionArray )
+    : iConnectionArray( aConnectionArray )
+    {
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiDetailsContainer::SizeChanged()
+// Called by framework when the view size is changed
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiDetailsContainer::SizeChanged()
+    {
+    iListBox->SetRect( Rect() );
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiDetailsContainer::CountComponentControls() const
+// ---------------------------------------------------------
+//
+TInt CConnectionMonitorUiDetailsContainer::CountComponentControls() const
+    {
+    return 1; // return nbr of controls inside this container
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiDetailsContainer::ComponentControl( TInt aIndex ) const
+// ---------------------------------------------------------
+//
+CCoeControl* CConnectionMonitorUiDetailsContainer::ComponentControl(
+                                                       TInt aIndex ) const
+    {
+    switch ( aIndex )
+        {
+        case 0:
+            return iListBox;
+        default:
+            return NULL;
+        }
+    }
+	
+// ----------------------------------------------------------------------------
+// CLogsDetailView::HandleNaviDecoratorEventL
+// Handler for pointer events, when the Navi Pane arrows have been tapped
+// ----------------------------------------------------------------------------
+//
+void CConnectionMonitorUiDetailsContainer::HandleNaviDecoratorEventL( TInt aEventID )
+    {
+    switch (aEventID)
+        {
+        case MAknNaviDecoratorObserver::EAknNaviDecoratorEventRightTabArrow:
+            if ( iConnectionIndex < (iConnectionArray->MdcaCount() - 1) ) {
+                SetSelectedConnectionL(iConnectionIndex + 1);
+            }
+            break;
+        
+        case MAknNaviDecoratorObserver::EAknNaviDecoratorEventLeftTabArrow:
+            if ( iConnectionIndex > 0 ) {
+                SetSelectedConnectionL(iConnectionIndex - 1);
+            }
+            break;
+            
+        default:
+            return;
+        }
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiDetailsContainer::OfferKeyEventL
+// ---------------------------------------------------------
+//
+TKeyResponse CConnectionMonitorUiDetailsContainer::OfferKeyEventL(
+                                                   const TKeyEvent& aKeyEvent,
+                                                   TEventCode aType )
+    {
+    CMUILOGGER_ENTERFN( "CConnectionMonitorUiDetailsContainer::OfferKeyEventL" );    
+    
+    TKeyResponse result( EKeyWasNotConsumed );
+    TInt index = iConnectionIndex;
+    TInt index_closed = iConnectionIndex;
+    CConnectionInfoBase* connection = NULL;
+    if ( aType == EEventKey )
+        {
+        if ( ( aKeyEvent.iCode == EKeyLeftArrow ) ||
+            ( aKeyEvent.iCode == EKeyRightArrow ) )
+            {
+            
+            TInt dir = 0;
+            switch (aKeyEvent.iCode)
+                {
+                case EKeyLeftArrow:
+                    {
+                    dir = -1;
+                    break;
+                    }
+                case EKeyRightArrow:
+                    {
+                    dir = 1;
+                    break;
+                    }
+                }
+            // Handle mirrored layout by negating the directionality
+            if (AknLayoutUtils::LayoutMirrored())
+                {
+                dir = -1 * dir;
+                }
+                
+            index += dir; 
+            
+            TBool step( EFalse );
+            
+            CMUILOGGER_WRITE_F( "OfferKeyEventL index: %d", index );
+            
+            while ( ( index > -1 ) && ( index < iConnectionArray->MdcaCount()
+                    && !step ) )
+                {
+                connection = ( *iConnectionArray )[index];
+                TBool alive = connection->IsAlive();
+                CMUILOGGER_WRITE_F( "OfferKeyEventL alive: %b", alive );
+
+                if ( alive )
+                    {
+                    if ( ( index_closed > -1 ) && 
+                       ( index_closed < iConnectionArray->MdcaCount() ) )
+                        {
+                        CConnectionInfoBase* connection_closed 
+                                       = ( *iConnectionArray )[index_closed];
+
+                        if ( iParentView->GetViewRefreshState() )
+                             {
+                             step = ETrue;
+                             CConnectionMonitorUiAppUi* appUi =
+                                            (CConnectionMonitorUiAppUi*)
+                                            iEikonEnv->EikAppUi();
+                            appUi->DeleteDetailsView( 
+                                        GetSelectedConnectionInfo()
+                                                        ->GetConnectionId(),
+                                        GetSelectedConnectionInfo() );
+                            appUi->StartTimerL();
+                            iParentView->SetViewRefreshState( EFalse );
+                            if ( index_closed > index )
+                                {
+                                iConnectionInfo = connection;
+                                iConnectionIndex = index;
+                                }
+                            iListBox->Model()->SetItemTextArray(
+                                            connection->GetDetailsArray() );
+                            iListBox->DrawNow();
+                            iListBox->UpdateScrollBarsL();
+                            PushAndRefreshNaviPaneL();
+                            }
+                        else
+                            {
+                            step = ETrue;
+                            iConnectionInfo = connection;
+                            iConnectionIndex = index;
+                            iListBox->Model()->SetItemTextArray(
+                                            connection->GetDetailsArray() );
+                            iListBox->DrawNow();
+                            iListBox->UpdateScrollBarsL();
+                            PushAndRefreshNaviPaneL();
+                            }
+                        }
+                    }
+                else
+                    {                        
+                    index += dir; 
+                    }    
+                }
+            result = iListBox->OfferKeyEventL( aKeyEvent, aType );                
+            }
+        else if ( aKeyEvent.iCode == EKeyDevice3 )
+            // selection key press -> go back to main view
+            {
+            CConnectionMonitorUiAppUi::Static()->ActivateLocalViewL(
+                            TUid::Uid( EConnectionMonitorUiMainViewTab ) );
+            result = EKeyWasConsumed;
+            }
+        else
+            {
+            result = iListBox->OfferKeyEventL( aKeyEvent, aType );
+            }
+        }
+
+    CMUILOGGER_LEAVEFN( "CConnectionMonitorUiDetailsContainer::OfferKeyEventL" );    
+
+    return result;
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiDetailsContainer::OnEventL
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiDetailsContainer::OnEventL(
+                                    const CConnMonEventBase& aConnMonEvent,
+                                    const TInt aIndex )
+    {
+    CMUILOGGER_ENTERFN( "CConnectionMonitorUiDetailsContainer::OnEventL()" );
+    CMUILOGGER_WRITE_F( "aIndex : %d", aIndex );
+    
+    switch ( aConnMonEvent.EventType() )
+        {
+        case EConnMonDeleteConnection:
+            {
+            if ( aIndex == iConnectionIndex )
+                {
+                TUint count = iConnectionArray->MdcaCount();
+                switch ( count )
+                    {
+                    case 0:
+                        {
+                        iListBox->Model()->SetItemTextArray(
+                                           new (ELeave) CDesCArrayFlat( 1 ) );
+                        iListBox->Model()->SetOwnershipType(
+                                                          ELbmOwnsItemArray );
+                        iConnectionIndex = 0;
+                        iConnectionInfo = NULL;
+                        break;
+                        }
+                    case 1:
+                        {
+                        SetSelectedConnectionL( 0 );
+                        break;
+                        }
+                    default :
+                        {
+                        TInt index = iConnectionIndex < count ?
+                                                        iConnectionIndex :
+                                                        iConnectionIndex - 1;
+                        SetSelectedConnectionL( index );
+                        break;
+                        }
+                    }
+                iListBox->DrawNow();
+                iListBox->UpdateScrollBarsL();
+                }
+            break;
+            }
+        case EConnMonCreateConnection:
+            {
+        CMUILOGGER_WRITE_F( "iConnectionInfo : %d", iConnectionInfo );
+            
+            if ( !iConnectionInfo )
+                {
+                SetSelectedConnectionL( 0 );
+                }
+            break;
+            }
+        default:
+            {
+            if ( !iConnectionInfo )
+                {
+                SetSelectedConnectionL( 0 );
+                }            
+            else if ( ( aIndex == iConnectionIndex ) && ( iConnectionArray->MdcaCount() ) )
+                {
+                iListBox->DrawNow();
+                iListBox->UpdateScrollBarsL();
+                }
+            break;
+            }
+        }
+    PushAndRefreshNaviPaneL();
+    CMUILOGGER_LEAVEFN( "CConnectionMonitorUiDetailsContainer::OnEventL()" );    
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiDetailsContainer::OnTimerEventL
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiDetailsContainer::OnTimerEventL()
+    {
+    if ( iConnectionArray->MdcaCount() )
+       {
+        iListBox->DrawNow();
+        iListBox->UpdateScrollBarsL();
+        CMUILOGGER_WRITE_F( "CMUIDW GetStatus() before: %d", 
+                            iConnectionInfo->GetStatus() );
+        if ( iConnectionInfo->GetStatus() == EConnectionClosing )
+            {
+            CConnectionMonitorUiAppUi* tempApUi = 
+                        CConnectionMonitorUiAppUi::Static();
+            tempApUi->StopTimer();
+            iConnectionInfo->StatusChangedL();
+            }
+        CMUILOGGER_WRITE_F( "CMUIDW GetStatus() after: %d",
+                            iConnectionInfo->GetStatus() );
+        }
+    PushAndRefreshNaviPaneL();
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiDetailsContainer::DrawFirstAllListBoxItem
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiDetailsContainer::DrawFirstAllListBoxItem()
+    {
+    TInt count = iListBox->Model()->NumberOfItems() - 1;
+    for ( TInt i = count; i > -1; --i )
+        {
+        iListBox->DrawItem( i );
+        }
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiDetailsContainer::ListBox
+// ---------------------------------------------------------
+//
+CAknSingleHeadingStyleListBox*
+                        CConnectionMonitorUiDetailsContainer::ListBox() const
+    {
+    return iListBox;
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiDetailsContainer::GetPanesL
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiDetailsContainer::GetPanesL()
+    {
+    CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane();
+
+    iNaviPane =  STATIC_CAST( CAknNavigationControlContainer*,
+                  statusPane->ControlL( TUid::Uid(EEikStatusPaneUidNavi ) ) );
+
+    PushAndRefreshNaviPaneL();
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiDetailsContainer::PushAndRefreshNaviPaneL
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiDetailsContainer::PushAndRefreshNaviPaneL()
+    {
+    TUint countOfConnection = iConnectionArray->NumberOfActiveConnections();
+    CMUILOGGER_WRITE_F( "countOfConnection : %d", countOfConnection );
+    
+    if ( ( iConnectionIndex > countOfConnection ) && // spec. index update
+         ( countOfConnection == 0 ) )
+        {
+        iConnectionIndex = iConnectionArray->
+                                GetArrayIndex( 
+                                        GetSelectedConnectionInfo()
+                                                    ->GetConnectionId() );
+        }
+    
+    CMUILOGGER_WRITE_F( "iConnectionIndex : %d", iConnectionIndex );
+
+    if ( iNaviDecorator )
+        {
+        PopNaviPane();
+        }
+    
+    if ( iParentView->GetViewRefreshState() ) // connection closed
+        {
+        iNaviDecorator = iNaviPane->CreateNavigationLabelL( KNullDesC );
+        }
+    else // connection alive
+        {
+        HBufC* textOfNaviPane = NULL;
+
+        CArrayFixFlat<TInt>* array = new( ELeave ) CArrayFixFlat<TInt>( 2 );
+        CleanupStack::PushL( array );
+        
+        if ( ( countOfConnection == 1 ) &&
+             ( iConnectionIndex + 1 >= countOfConnection ) )
+            {
+            array->AppendL( countOfConnection );
+            }
+        else            
+            {            
+            array->AppendL( countOfConnection ? iConnectionIndex + 1 : 0 );
+            }
+            
+        array->AppendL( countOfConnection );
+        textOfNaviPane = StringLoader::LoadLC( 
+                                            R_QTN_CMON_NAVI_NOF_CONNECTION,
+                                            *array );
+
+        iNaviDecorator = iNaviPane->CreateNavigationLabelL( 
+                                                        *textOfNaviPane );
+        
+        CleanupStack::PopAndDestroy( textOfNaviPane );
+        CleanupStack::PopAndDestroy( array );
+        }
+
+    iNaviDecorator->MakeScrollButtonVisible( ETrue );
+    
+    CAknNavigationDecorator::TScrollButton left = CAknNavigationDecorator::ELeftButton;
+    CAknNavigationDecorator::TScrollButton right = CAknNavigationDecorator::ERightButton;
+    if ( AknLayoutUtils::LayoutMirrored() )
+    	{
+    	left = CAknNavigationDecorator::ERightButton;
+    	right = CAknNavigationDecorator::ELeftButton;
+    	}
+
+    if ( iParentView->GetViewRefreshState() )
+        {
+        iNaviDecorator->SetScrollButtonDimmed( left, 
+                                           ( ( iConnectionIndex == 0 ) ||
+                                             ( countOfConnection == 0 ) ) );
+        }
+    else
+        {
+        iNaviDecorator->SetScrollButtonDimmed( 
+                          left, 
+                          ( ( iConnectionIndex == 0 ) ||
+                            ( countOfConnection == 0 ) ||
+                            ( ( countOfConnection == 1 ) &&
+                              ( iConnectionIndex + 1 >= 
+                                    countOfConnection ) ) ) );
+        }
+
+    if ( iParentView->GetViewRefreshState() )
+        {
+        iNaviDecorator->SetScrollButtonDimmed( right, 
+    			                iConnectionIndex >= countOfConnection );
+        }
+    else
+        {
+        iNaviDecorator->SetScrollButtonDimmed( right, 
+    			                iConnectionIndex + 1 >= countOfConnection );
+        }
+        
+    iNaviDecorator->SetNaviDecoratorObserver( this );
+        
+    iNaviPane->PushL( *iNaviDecorator );
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiDetailsContainer::PopNaviPane
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiDetailsContainer::PopNaviPane()
+    {
+    iNaviPane->Pop( iNaviDecorator );
+    delete iNaviDecorator;
+    iNaviDecorator = NULL;
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiDetailsContainer::HandleResourceChange
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiDetailsContainer::HandleResourceChange( TInt aType )
+    {
+    CCoeControl::HandleResourceChange( aType );
+    if ( aType == KEikDynamicLayoutVariantSwitch )
+        {
+        TRect mainPaneRect;
+        AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, 
+                                           mainPaneRect );
+        SetRect( mainPaneRect );
+        DrawNow();
+        }
+    }
+    
+// ---------------------------------------------------------
+// CConnectionMonitorUiDetailsContainer::FocusChanged
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiDetailsContainer::FocusChanged( TDrawNow aDrawNow )
+    {
+    CMUILOGGER_ENTERFN( "CConnectionMonitorUiDetailsContainer::FocusChanged" );
+    CCoeControl::FocusChanged( aDrawNow );    
+    if ( iListBox )
+        {
+        iListBox->SetFocus( IsFocused() );
+        }        
+    CMUILOGGER_LEAVEFN( "CConnectionMonitorUiDetailsContainer::FocusChanged" );    
+    }    
+    
+    
+// ---------------------------------------------------------
+// CConnectionMonitorUiDetailsContainer::GetIndexOfSelectedItem
+// ---------------------------------------------------------
+//
+TInt CConnectionMonitorUiDetailsContainer::GetIndexOfSelectedItem()
+	{
+    CMUILOGGER_WRITE_F(
+        "CMUIDetailsContainer::GetIndexOfSelectedItem  iConnectionIndex: %d",
+        iConnectionIndex );
+
+    return iConnectionIndex;	
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiDetailsContainer::GetSelectedConnectionInfo()
+// ---------------------------------------------------------
+//
+    CConnectionInfoBase* CConnectionMonitorUiDetailsContainer::
+                                        GetSelectedConnectionInfo() const
+	{
+	return iConnectionInfo;	
+	}
+    
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorui/src/ConnectionMonitorUiDetailsView.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,235 @@
+/*
+* Copyright (c) 2002 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:  view class
+*     
+*
+*/
+
+
+// INCLUDE FILES
+#include  <ConnectionMonitorUi.rsg>
+#include  "ConnectionMonitorUiDetailsView.h"
+#include  "ConnectionMonitorUiDetailsContainer.h" 
+#include  "ConnectionMonitorUi.hrh"
+#include  "ConnectionArray.h"
+
+// ================= MEMBER FUNCTIONS =======================
+// ---------------------------------------------------------
+// ConnectionMonitorUiDetailsView::ConnectionMonitorUiDetailsView( 
+//                                 const CConnectionArray* aConnectionArray )
+// ---------------------------------------------------------
+//
+CConnectionMonitorUiDetailsView::CConnectionMonitorUiDetailsView( 
+                             const CConnectionArray* const aConnectionArray )
+    : CAknView(), 
+      iConnectionArray( aConnectionArray ), 
+      iViewRefreshState( EFalse )
+    {}
+
+// ---------------------------------------------------------
+// ConnectionMonitorUiDetailsView::ConstructL()
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiDetailsView::ConstructL()
+    {
+    BaseConstructL( R_CONNECTIONMONITORUI_DETAILSVIEW );
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiDetailsView::~CConnectionMonitorUiDetailsView()
+// ---------------------------------------------------------
+//
+CConnectionMonitorUiDetailsView::~CConnectionMonitorUiDetailsView()
+    {
+    delete iContainer;
+    }
+
+// ---------------------------------------------------------
+// TUid CConnectionMonitorUiDetailsView::Id()
+// ?implementation_description
+// ---------------------------------------------------------
+//
+TUid CConnectionMonitorUiDetailsView::Id() const
+    {
+    return KDetailsViewId;
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiDetailsView::HandleCommandL( TInt aCommand )
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiDetailsView::HandleCommandL( TInt aCommand )
+    {   
+    switch ( aCommand )
+        {
+        case EAknSoftkeyOk:
+            {
+            CloseViewL();
+            ActivateMainViewL();
+            break;
+            }
+        default:
+            {
+            AppUi()->HandleCommandL( aCommand );
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiDetailsView::CloseViewL()
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiDetailsView::CloseViewL()
+    {   
+    if ( GetViewRefreshState() )
+        {
+        // Now delete this view
+        CConnectionMonitorUiAppUi* appUi =
+            (CConnectionMonitorUiAppUi*)AppUi();
+        appUi->StartTimerL();
+        SetViewRefreshState( EFalse );
+        }
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiDetailsView::SetSelectedConnectionId
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiDetailsView::SetSelectedConnection( TUint aIndex )
+    {
+    iConnectionId = aIndex;
+    }
+    
+// ---------------------------------------------------------
+// CConnectionMonitorUiDetailsView::GetSelectedConnection
+// ---------------------------------------------------------
+//
+TUint CConnectionMonitorUiDetailsView::GetSelectedConnection()
+	{
+	TUint result( KErrNone );
+	if ( iContainer )
+		{
+		result = iContainer->GetIndexOfSelectedItem();	
+		}
+	return result;		
+	}
+
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiDetailsView::DoActivateL(...)
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiDetailsView::DoActivateL(
+   const TVwsViewId& /*aPrevViewId*/, TUid /*aCustomMessageId*/,
+   const TDesC8& /*aCustomMessage*/ )
+    {
+    CMUILOGGER_ENTERFN( "CConnectionMonitorUiDetailsView::DoActivateL" );
+    
+    if ( !iContainer )
+        {
+        iContainer = new ( ELeave ) CConnectionMonitorUiDetailsContainer( 
+                                                            iConnectionArray );
+        iContainer->SetMopParent( this );
+        iContainer->ConstructL( ClientRect(), this );
+        iContainer->SetSelectedConnectionL( iConnectionId );
+        CConnectionMonitorUiAppUi::Static()->StartConnEventNotification( 
+                                                                  iContainer );
+        iContainer->DrawFirstAllListBoxItem();
+
+        iContainer->PushAndRefreshNaviPaneL();
+        iContainer->MakeVisible( ETrue );
+        AppUi()->AddToViewStackL( *this, iContainer );
+        }
+    
+    CMUILOGGER_LEAVEFN( "CConnectionMonitorUiDetailsView::DoActivateL" );
+    
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiDetailsView::DoDeactivate
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiDetailsView::DoDeactivate()
+    {
+    CMUILOGGER_ENTERFN( "CConnectionMonitorUiDetailsView::DoDeactivate" );
+    
+    if ( iContainer )
+        {
+        AppUi()->RemoveFromViewStack( *this, iContainer );
+        CConnectionMonitorUiAppUi::Static()->StopConnEventNotification( 
+                                                             iContainer );
+        iContainer->PopNaviPane();
+        iContainer->MakeVisible( EFalse );
+
+        delete iContainer;
+        iContainer = NULL;
+        }                
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiDetailsView::HandleListBoxEventL
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiDetailsView::HandleListBoxEventL( 
+                                                    CEikListBox* /*aListBox*/,
+                                                    TListBoxEvent aEventType )
+    {
+    switch ( aEventType )
+        {
+        case EEventEnterKeyPressed:
+        //case EEventItemDoubleClicked:
+        case EEventItemSingleClicked:
+            {
+            AppUi()->ActivateLocalViewL( 
+                            TUid::Uid( EConnectionMonitorUiMainViewTab ) );
+            }
+            break;
+
+        default:
+            break;
+        }
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiDetailsView::GetViewRefreshState
+// ---------------------------------------------------------
+//
+TBool CConnectionMonitorUiDetailsView::GetViewRefreshState()
+    {
+    return iViewRefreshState;	
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiDetailsView::SetViewRefreshState
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiDetailsView::SetViewRefreshState( 
+                                                    TBool aViewRefreshState )
+    {
+    iViewRefreshState = aViewRefreshState;
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiDetailsView::ActivateMainViewL()
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiDetailsView::ActivateMainViewL()
+    {   
+    AppUi()->ActivateLocalViewL( TUid::Uid( EConnectionMonitorUiMainViewTab ) );
+    }
+
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorui/src/ConnectionMonitorUiDocument.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2002 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:  application class
+*     
+*
+*/
+
+
+// INCLUDE FILES
+#include "ConnectionMonitorUiDocument.h"
+#include "ConnectionMonitorUiAppUi.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// constructor
+CConnectionMonitorUiDocument::CConnectionMonitorUiDocument
+    (
+    CEikApplication& aApp
+    )
+: CAknDocument(aApp)    
+    {
+    }
+
+// destructor
+CConnectionMonitorUiDocument::~CConnectionMonitorUiDocument()
+    {
+    }
+
+// EPOC default constructor can leave.
+void CConnectionMonitorUiDocument::ConstructL()
+    {
+    }
+
+// Two-phased constructor.
+CConnectionMonitorUiDocument* CConnectionMonitorUiDocument::NewL(
+        CEikApplication& aApp)     // CConnectionMonitorUiApp reference
+    {
+    CConnectionMonitorUiDocument* myself =
+        new (ELeave) CConnectionMonitorUiDocument( aApp );
+    CleanupStack::PushL( myself );
+    myself->ConstructL();
+    CleanupStack::Pop( myself );
+
+    return myself;
+    }
+    
+// ----------------------------------------------------
+// CConnectionMonitorUiDocument::CreateAppUiL()
+// constructs CConnectionMonitorUiAppUi
+// ----------------------------------------------------
+//
+CEikAppUi* CConnectionMonitorUiDocument::CreateAppUiL()
+    {
+    return new (ELeave) CConnectionMonitorUiAppUi;
+    }
+
+// End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorui/src/ConnectionMonitorUiView.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,414 @@
+/*
+* Copyright (c) 2002 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:  view class
+*     
+*
+*/
+
+
+// INCLUDE FILES
+#include  <eikmenup.h>
+#include  <akntitle.h>   //for CAknTitlePane
+#include  <ConnectionMonitorUi.rsg>
+#include  <StringLoader.h>
+
+#include  <hlplch.h>
+#include <csxhelp/cmon.hlp.hrh>
+
+    
+#include  "ConnectionMonitorUiDetailsView.h"
+#include  "ConnectionMonitorUi.hrh"
+#include  "ConnectionMonitorUiAppUi.h"
+#include  "ConnectionMonitorUiView.h"
+#include  "ConnectionMonitorUiContainer.h" 
+#include  "ConnectionArray.h"
+#include  "FeatureManagerWrapper.h"
+
+
+// CONSTANTS 
+
+// ================= MEMBER FUNCTIONS =======================
+// ---------------------------------------------------------
+// CConnectionMonitorUiView::CConnectionMonitorUiView
+// ---------------------------------------------------------
+//
+#ifdef RD_CONTROL_PANEL
+CConnectionMonitorUiView::CConnectionMonitorUiView( 
+                                    CConnectionArray* const aConnectionArray,
+                                    RConnectionMonitor* aMonitor,
+                                    TBool aIsEmbedded,
+                                    CActiveWrapper* aActiveWrapper )
+    : CAknView(),
+      iConnectionArray( aConnectionArray ),
+      iMonitor( aMonitor ),
+      isHelpSupported( EFalse ),
+      iIsEmbedded( EFalse ),
+      iActiveWrapper( aActiveWrapper )
+    {
+   	iIsEmbedded = aIsEmbedded;
+    }
+#else
+CConnectionMonitorUiView::CConnectionMonitorUiView( 
+                                    CConnectionArray* const aConnectionArray,
+                                    RConnectionMonitor* aMonitor,
+                                    CActiveWrapper* aActiveWrapper )
+    : CAknView(),
+      iConnectionArray( aConnectionArray ),
+      iMonitor( aMonitor ),
+      isHelpSupported( EFalse ),
+      iActiveWrapper( aActiveWrapper )
+    {
+    }
+#endif // RD_CONTROL_PANEL
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiView::ConstructL
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiView::ConstructL()
+    {
+    isHelpSupported = FeatureManager::FeatureSupported( KFeatureIdHelp );
+
+    TInt actView( NULL );
+
+#ifdef RD_CONTROL_PANEL
+    if ( iIsEmbedded )
+        {
+        actView = R_CP_CONNECTIONMONITORUI_VIEW;
+        }
+    else
+        {
+        actView = R_CONNECTIONMONITORUI_VIEW;
+        }
+#else
+        actView = R_CONNECTIONMONITORUI_VIEW;
+#endif // RD_CONTROL_PANEL
+
+    BaseConstructL( actView );        
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiView::~CConnectionMonitorUiView()
+// ---------------------------------------------------------
+//
+CConnectionMonitorUiView::~CConnectionMonitorUiView()
+    {
+    delete iContainer;
+    }
+
+// ---------------------------------------------------------
+// TUid CConnectionMonitorUiView::Id()
+// ---------------------------------------------------------
+//
+TUid CConnectionMonitorUiView::Id() const
+    {
+    return KConnectionsViewId;
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiView::HandleCommandL( TInt aCommand )
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiView::HandleCommandL( TInt aCommand )
+    {   
+    switch ( aCommand )
+        {
+        case EAknSoftkeyDetails:
+            {
+            if ( IsSelectedConnectionAlive() )
+                {
+                BringupDetailsViewL();
+                }
+            break;
+            }
+        case EConnectionMonitorUiCmdAppDetails:
+            {
+            BringupDetailsViewL();
+            break;
+            }
+        case EConnectionMonitorUiCmdAppEndConn:
+            {
+            iContainer->EndConnectionL();
+            break;
+            }
+        case EConnectionMonitorUiCmdAppEndAll:
+            {
+            iContainer->EndAllConnectionL();
+            break;
+            }
+       case EAknCmdHelp:
+            {
+            if ( isHelpSupported )
+                {
+                HlpLauncher::LaunchHelpApplicationL(
+                    CEikonEnv::Static()->WsSession(),
+                    CEikonEnv::Static()->EikAppUi()->AppHelpContextL() );
+                }
+            break;
+            }
+       default:
+            {
+            AppUi()->HandleCommandL( aCommand );
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiView::DynInitMenuPaneL()
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiView::DynInitMenuPaneL( TInt aResourceId,
+                                                 CEikMenuPane* aMenuPane )
+    {
+    MEikMenuObserver::DynInitMenuPaneL( aResourceId, aMenuPane );
+    switch ( aResourceId )
+        {
+        case R_CONNECTIONMONITORUI_VIEW_MENU:
+            {
+            if ( !iConnectionArray->MdcaCount() )
+                {
+                aMenuPane->DeleteMenuItem( 
+                                EConnectionMonitorUiCmdAppDetails );
+                aMenuPane->DeleteMenuItem( 
+                                EConnectionMonitorUiCmdAppEndConn );
+                aMenuPane->DeleteMenuItem( 
+                                EConnectionMonitorUiCmdAppEndAll );
+                }
+            else if ( iConnectionArray->MdcaCount() == 1 )
+                {
+                aMenuPane->DeleteMenuItem( 
+                                EConnectionMonitorUiCmdAppEndAll );
+                if ( !IsSelectedConnectionAlive() )
+                    {
+                    aMenuPane->DeleteMenuItem( 
+                                    EConnectionMonitorUiCmdAppDetails );
+                    }
+                else if ( IsSelectedConnectionSuspended() )
+                    {
+                    aMenuPane->DeleteMenuItem( 
+                                EConnectionMonitorUiCmdAppEndConn );
+                    }
+                }
+            else if ( iConnectionArray->NumberOfSuspendedConnections() >= 1 )
+                {
+                aMenuPane->DeleteMenuItem( 
+                                EConnectionMonitorUiCmdAppEndAll );
+                if ( IsSelectedConnectionSuspended() )
+                    {
+                    aMenuPane->DeleteMenuItem( 
+                                EConnectionMonitorUiCmdAppEndConn );
+                    }
+                }
+            else
+                {
+                if ( !IsSelectedConnectionAlive() )
+                    {
+                    aMenuPane->DeleteMenuItem( 
+                                    EConnectionMonitorUiCmdAppDetails );
+                    aMenuPane->DeleteMenuItem( 
+                                    EConnectionMonitorUiCmdAppEndConn );
+                    }
+                }
+            break;
+            }
+        case R_CONNECTIONMONITORUI_APP_MENU:
+            {
+            if ( !isHelpSupported )
+                {
+                aMenuPane->DeleteMenuItem( EAknCmdHelp );
+                }
+            break;
+            }
+        default:
+            {
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiView::HandleListBoxEventL
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiView::HandleListBoxEventL( CEikListBox* /*aListBox*/, 
+                                                    TListBoxEvent aEventType )
+    {
+    switch ( aEventType )
+        {
+        case EEventEnterKeyPressed:
+        //case EEventItemDoubleClicked:
+        case EEventItemSingleClicked:
+            {
+            if ( IsSelectedConnectionAlive() )
+                {
+                BringupDetailsViewL();
+                }
+            }
+            break;
+        default:
+            break;
+        }
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiView::DoActivateL
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiView::DoActivateL(
+                                            const TVwsViewId& /*aPrevViewId*/, 
+                                            TUid /*aCustomMessageId*/,
+                                            const TDesC8& /*aCustomMessage*/ )
+    {
+    CMUILOGGER_ENTERFN( "CConnectionMonitorUiView::DoActivateL" );
+    
+    if ( !iContainer )
+        {
+        iContainer = new( ELeave ) CConnectionMonitorUiContainer( 
+                                                            iConnectionArray,
+                                                            iMonitor,
+                                                            iActiveWrapper );
+        iContainer->SetMopParent( this );
+        
+        
+	    CConnectionMonitorUiDetailsView* view = 
+	        STATIC_CAST( CConnectionMonitorUiDetailsView*,
+	        AppUi()->View( TUid::Uid( EConnectionMonitorUiDetailsViewTab ) ) );
+
+	    TInt index  = view->GetSelectedConnection();
+    	CMUILOGGER_WRITE_F( "index: %d", index );
+                
+        iContainer->ConstructL( index, ClientRect() );
+        iContainer->ListBox()->SetListBoxObserver( this );
+
+        CConnectionMonitorUiAppUi::Static()->StartConnEventNotification( 
+                                                                  iContainer );
+        iContainer->PushAndRefreshNaviPaneL();
+        AppUi()->AddToViewStackL( *this, iContainer );
+        ConnectionKeyObserver();
+        }
+    CMUILOGGER_LEAVEFN( "CConnectionMonitorUiView::DoActivateL" );
+    
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiView::DoDeactivate
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiView::DoDeactivate()
+    {
+    CMUILOGGER_ENTERFN( "CConnectionMonitorUiView::DoDeactivate" );
+    
+    if ( iContainer )
+        {
+        AppUi()->RemoveFromViewStack( *this, iContainer );
+        CConnectionMonitorUiAppUi::Static()->StopConnEventNotification( 
+                                                                  iContainer );
+        iContainer->PopNaviPane();
+        delete iContainer;
+        iContainer = NULL;
+        }
+    CMUILOGGER_LEAVEFN( "CConnectionMonitorUiView::DoDeactivate" );
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiView::SetTitlePaneTextL
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiView::SetTitlePaneTextL( TInt aResourceId )
+    {
+    CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane();
+    CAknTitlePane* titlePane =
+        ( CAknTitlePane* )statusPane->ControlL(
+                            TUid::Uid( EEikStatusPaneUidTitle ) );
+    HBufC* text = iEikonEnv->AllocReadResourceLC( aResourceId );
+    titlePane->SetTextL( text->Des() );
+    CleanupStack::PopAndDestroy( text );
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiView::BringupDetailsViewL
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiView::BringupDetailsViewL()
+    {
+    CConnectionMonitorUiDetailsView* view = 
+        STATIC_CAST( CConnectionMonitorUiDetailsView*,
+                     AppUi()->View( TUid::Uid( 
+                     EConnectionMonitorUiDetailsViewTab ) ) );
+
+    TInt selIndex = iContainer->SelectedConnection();
+    view->SetSelectedConnection( selIndex );
+    AppUi()->ActivateLocalViewL( 
+                             TUid::Uid( EConnectionMonitorUiDetailsViewTab ) );
+    }
+
+// ---------------------------------------------------------
+// CConnectionMonitorUiView::IsSelectedConnectionAlive
+// ---------------------------------------------------------
+//
+TBool CConnectionMonitorUiView::IsSelectedConnectionAlive() const
+    {
+    TInt selIndex = iContainer->SelectedConnection();
+    TBool result( EFalse );
+    if ( selIndex > -1 )
+        {
+        result = ( *iConnectionArray )[selIndex]->IsAlive();
+        }
+
+    return result;
+    }
+    
+// ---------------------------------------------------------
+// CConnectionMonitorUiView::IsSelectedConnectionSuspended
+// ---------------------------------------------------------
+//
+TBool CConnectionMonitorUiView::IsSelectedConnectionSuspended() const
+    {
+    TInt selIndex = iContainer->SelectedConnection();
+    TBool result( EFalse );
+    if ( selIndex > -1 )
+        {
+        result = ( *iConnectionArray )[selIndex]->IsSuspended();
+        }
+
+    return result;
+    }    
+    
+// ---------------------------------------------------------
+// CConnectionMonitorUiView::ConnectionKeyObserver
+// ---------------------------------------------------------
+//
+void CConnectionMonitorUiView::ConnectionKeyObserver() const
+    {
+    if ( !( iConnectionArray->MdcaCount() ) )
+        {
+        Cba()->MakeCommandVisible( EAknSoftkeyDetails,EFalse );
+        }
+    else
+        {
+        if ( iConnectionArray->NumberOfActiveConnections() )
+            {
+            Cba()->MakeCommandVisible( EAknSoftkeyDetails,ETrue );
+            }
+        else
+            {
+            Cba()->MakeCommandVisible( EAknSoftkeyDetails,EFalse );
+            }
+        }
+	}
+
+    
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorui/src/CsdConnectionInfo.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,444 @@
+/*
+* Copyright (c) 2004 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:  Represents a connection
+*
+*
+*/
+
+
+// INCLUDE FILES
+//#include <nifvar.h>
+#include <StringLoader.h>
+#include <ConnectionMonitorUi.rsg>
+#include <ConnectionMonitorUi.mbg>
+#include <AknUtils.h>
+
+#include "ConnectionMonitorUiLogger.h"
+#include "CsdConnectionInfo.h"
+#include "ActiveWrapper.h"
+
+// CONSTANTS
+
+LOCAL_D const TUint KDetailsArrayGranularityInternal = 9;
+LOCAL_D const TUint KDetailsArrayGranularityExternal = 4;
+
+// ================= MEMBER FUNCTIONS =======================
+// ---------------------------------------------------------
+// CCsdConnectionInfo::NewL
+// ---------------------------------------------------------
+//
+CCsdConnectionInfo* CCsdConnectionInfo::NewL( TInt aConnectionId,
+                              RConnectionMonitor* const aConnectionMonitor,
+                              TConnMonBearerType aConnectionBearerType,
+                              CActiveWrapper* aActiveWrapper )
+    {
+    CMUILOGGER_WRITE( "NewL, CCsdsConnectionInfo - start " );
+
+    CCsdConnectionInfo* self = new ( ELeave ) CCsdConnectionInfo(
+                                                    aConnectionId,
+                                                    aConnectionMonitor,
+                                                    aConnectionBearerType,
+                                                    aActiveWrapper );
+    CMUILOGGER_WRITE( "NewL, CCsdsConnectionInfo - created " );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    CMUILOGGER_WRITE( "NewL, CCsdsConnectionInfo - end " );
+    return self;
+    }
+
+
+// ---------------------------------------------------------
+// CCsdConnectionInfo::~CCsdConnectionInfo
+// ---------------------------------------------------------
+//
+CCsdConnectionInfo::~CCsdConnectionInfo()
+    {
+    }
+
+
+// ---------------------------------------------------------
+// CCsdConnectionInfo::CCsdConnectionInfo
+// ---------------------------------------------------------
+//
+CCsdConnectionInfo::CCsdConnectionInfo(  TInt aConnectionId,
+                             RConnectionMonitor* const aConnectionMonitor,
+                             TConnMonBearerType aConnectionBearerType,
+                             CActiveWrapper* aActiveWrapper ) :
+    CConnectionInfoBase( aConnectionId,
+                         aConnectionMonitor,
+                         aConnectionBearerType,
+                         aActiveWrapper )
+        {
+        CMUILOGGER_WRITE( "CCsdConnectionInfo constuctor" );
+        }
+
+
+// ---------------------------------------------------------
+// CCsdConnectionInfo::ConstructL
+// ---------------------------------------------------------
+//
+void CCsdConnectionInfo::ConstructL()
+    {
+    CMUILOGGER_WRITE( "CCsdConnectionInfo::ConstructL() start" );
+    
+    iActiveWrapper->StartGetStringAttribute( iConnectionId,
+                                             iConnectionMonitor,
+                                             KTelNumber,
+                                             iDialupNumber );
+    TInt err( iActiveWrapper->iStatus.Int() );
+    CMUILOGGER_WRITE_F( "CCsdConnectionInfo::ConstructL() status: %d",
+                        err );
+    if ( err != KErrNone )
+        {
+        User::Leave( err );
+        }
+        
+    CConnectionInfoBase::ConstructL();
+    CMUILOGGER_WRITE( "CCsdConnectionInfo::ConstructL() end" );
+    }
+
+
+// ---------------------------------------------------------
+// CCsdConnectionInfo::DeepCopyL
+// ---------------------------------------------------------
+//        
+CConnectionInfoBase* CCsdConnectionInfo::DeepCopyL()
+	{
+	CCsdConnectionInfo* temp = new ( ELeave ) CCsdConnectionInfo(
+                                                    iConnectionId,
+                                                    iConnectionMonitor,
+                                                    iConnectionBearerType,
+                                                    iActiveWrapper );
+                              							
+	temp->iConnectionName = iConnectionName;
+	temp->iConnectionStatus = iConnectionStatus;
+	temp->iUploaded = iUploaded;
+	temp->iDownloaded = iDownloaded;
+	temp->iStartTime = iStartTime;
+	temp->iDuration = iDuration;
+	temp->iLastSpeedUpdate = iLastSpeedUpdate;
+	temp->iUpSpeed = iUpSpeed;
+	temp->iDownSpeed = iDownSpeed;
+	temp->iListBoxItemText = iListBoxItemText;
+	
+	temp->iDialupNumber = iDialupNumber;
+		
+	if ( iDetailsArray )
+		{
+		CleanupStack::PushL( temp );		
+		temp->ToArrayDetailsL();
+		CleanupStack::Pop( temp );			
+		}
+		
+	return temp;	
+	}
+
+
+// ---------------------------------------------------------
+// CCsdConnectionInfo::GetIconId
+// ---------------------------------------------------------
+//
+TUint CCsdConnectionInfo::GetIconId() const
+    {
+    TUint iconId = ECsd;
+    if ( ( iConnectionBearerType == EBearerHSCSD ) || 
+         ( iConnectionBearerType == EBearerExternalHSCSD ) )
+        {
+        iconId = EHscsd;
+        }
+    return iconId;
+    }
+
+// ---------------------------------------------------------
+// CCsdConnectionInfo::RefreshDetailsL
+// ---------------------------------------------------------
+//
+void CCsdConnectionInfo::RefreshDetailsL()
+    {
+    CMUILOGGER_WRITE( "CCsdConnectionInfo::RefreshDetailsL start" );
+    
+    CMUILOGGER_WRITE_F( "before iConnectionBearerType: %d", 
+                        ( TInt )iConnectionBearerType );
+    
+    TConnMonBearerType bearerType;
+    
+    iActiveWrapper->StartGetIntAttribute( iConnectionId,
+                                          iConnectionMonitor,
+                                          KBearer,
+                                          ( TInt& )bearerType );
+        
+    if ( !iActiveWrapper->iStatus.Int() )
+        {
+        iConnectionBearerType = bearerType;
+        }
+    
+    CMUILOGGER_WRITE_F( "status.Int(): %d", iActiveWrapper->iStatus.Int() );
+    CMUILOGGER_WRITE_F( "bearerType: %d", ( TInt )bearerType );    
+    CMUILOGGER_WRITE_F( "after iConnectionBearerType: %d", ( TInt )iConnectionBearerType );
+    
+    if ( iConnectionBearerType < EBearerExternalCSD )
+        {
+        RefreshTransferSpeedsL();
+        }
+    RefreshDuration();
+    CMUILOGGER_WRITE( "CCsdConnectionInfo::RefreshDetailsL end" );
+    }
+
+// ---------------------------------------------------------
+// CCsdConnectionInfo::ToStringDialupNumberLC
+// ---------------------------------------------------------
+//
+HBufC* CCsdConnectionInfo::ToStringDialupNumberLC() const
+    {
+    HBufC* dialupNumber = iDialupNumber.AllocLC();
+    TPtr temp( dialupNumber->Des() );
+    AknTextUtils::DisplayTextLanguageSpecificNumberConversion( temp );
+    
+    return dialupNumber;
+    }
+
+
+// ---------------------------------------------------------
+// CCsdConnectionInfo::RefreshConnectionListBoxItemTextL
+// ---------------------------------------------------------
+//
+void CCsdConnectionInfo::RefreshConnectionListBoxItemTextL()
+    {
+    CMUILOGGER_WRITE(
+        "CCsdConnectionInfo::RefreshConnectionListBoxItemTextL start" );
+
+    TUint  iconId;
+    HBufC* secondRow = NULL;
+
+    iconId = GetIconId();
+
+    if ( iConnectionStatus == EConnectionCreated )
+        {
+        secondRow =  ToStringDurationLC();
+        }
+    else    // if connection has not created yet gives back the status of its.
+        {
+        secondRow = ToStringStatusLC( EFalse );
+        }
+
+    iListBoxItemText.Format( KConnectonListItemTextFormat, iconId,
+                             &iConnectionName, secondRow );
+    CleanupStack::PopAndDestroy( secondRow );
+    CMUILOGGER_WRITE(
+        "CCsdConnectionInfo::RefreshConnectionListBoxItemTextL end" );
+    }
+
+
+// ---------------------------------------------------------
+// CCsdConnectionInfo::RefreshDetailsArrayL
+// ---------------------------------------------------------
+//
+void CCsdConnectionInfo::RefreshDetailsArrayL()
+    {
+    CMUILOGGER_WRITE( "CCsdConnectionInfo::RefreshDetailsArrayL start" );
+    if ( iDetailsArray )
+        {
+        TBool internal = iConnectionBearerType < EBearerExternalCSD ;
+        HBufC* temp = NULL;
+
+        if ( internal )
+            {
+            temp = ToStringStatusLC();
+            ToDetailsListBoxItemTextWithReplaceL( R_QTN_CMON_HEADING_STATUS,
+                                                  temp, 2 );
+                                                  
+            ToDetailsListBoxItemTextWithReplaceL
+                ( 
+                R_QTN_CMON_HEADING_DATA_TOTAL,
+                ToStringTotalTransmittedDataLC(), 
+                3   
+                );                                                  
+
+            ToDetailsListBoxItemTextWithReplaceL
+                (
+                R_QTN_CMON_HEADING_DATA_RECEIVED,
+                ToStringReceivedDataLC(),
+                4
+                );
+
+            ToDetailsListBoxItemTextWithReplaceL
+                (
+                R_QTN_CMON_HEADING_DATA_SENT,
+                ToStringSentDataLC(),
+                5
+                );
+
+            ToDetailsListBoxItemTextWithReplaceL( R_QTN_CMON_HEADING_DURATION,
+                                                  ToStringDurationLC(), 6 );
+
+            ToDetailsListBoxItemTextWithReplaceL
+                (
+                R_QTN_CMON_HEADING_SPEED,
+                ToStringTransferSpeedDownLC(),
+                7
+                );
+
+            ToDetailsListBoxItemTextWithReplaceL
+                (
+                0, 
+                ToStringTransferSpeedUpLC(),
+                8
+                );
+
+            CleanupStack::PopAndDestroy( 7, temp );   // ToString...LC()
+
+            TInt sharing = RefreshAppNamesL();
+
+            if ( sharing > 1 )
+                {
+                if ( iDetailsArray->Count() > 10 )
+                    {
+                    iDetailsArray->Delete( 10, 
+                                           iDetailsArray->Count() - 10 );
+                    iDetailsArray->Compress();
+                    }
+                
+                for ( TInt i = 0; i < sharing; i++ )
+                    {
+                    if ( i == 0 )
+                        {
+                        ToDetailsListBoxItemTextWithAppendL( 
+                                        R_QTN_CMON_HEADING_SHARING_INFO,
+                                        ToStringAppNameLC( i ) );
+                        }
+                    else
+                        {
+                        ToDetailsListBoxItemTextWithAppendL( 0, 
+                                                    ToStringAppNameLC( i ) );
+                        }
+                    }
+                CleanupStack::PopAndDestroy( sharing ); 
+                                                    // ToStringAppNameLC()
+                }
+            else
+                {
+                if ( iDetailsArray->Count() > 10 )
+                    {
+                    iDetailsArray->Delete( 10, iDetailsArray->Count() - 10 );
+                    iDetailsArray->Compress();
+                    }
+                }
+            }
+        else
+            {
+            ToDetailsListBoxItemTextWithReplaceL( R_QTN_CMON_HEADING_DURATION,
+                                                  ToStringDurationLC(), 2 );
+            CleanupStack::PopAndDestroy( 1 );   // ToStringDurationLC()
+            }
+        }
+    CMUILOGGER_WRITE( "CCsdConnectionInfo::RefreshDetailsArrayL end" );
+    }
+
+
+// ---------------------------------------------------------
+// CCsdConnectionInfo::ToArrayDetailsL
+// ---------------------------------------------------------
+//
+void CCsdConnectionInfo::ToArrayDetailsL()
+    {
+    CMUILOGGER_ENTERFN("CCsdConnectionInfo::ToArrayDetailsL");
+    TBool internal = iConnectionBearerType < EBearerExternalCSD ;
+    TUint granularity = KDetailsArrayGranularityExternal;
+    HBufC* temp = NULL;
+
+    if ( internal )
+        {
+        granularity = KDetailsArrayGranularityInternal;
+        }
+    delete iDetailsArray;
+    iDetailsArray = NULL;
+    iDetailsArray = new ( ELeave ) CDesCArrayFlat( granularity );
+
+    temp = iConnectionName.AllocLC();
+    ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_CONN_NAME,
+                                         temp );
+
+    ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_BEARER,
+                                         ToStringBearerLC() );
+    CleanupStack::PopAndDestroy( 2, temp );   // ToString...LC()
+
+
+    if ( internal )
+        {
+        temp = ToStringStatusLC();
+        ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_STATUS,
+                                             temp );
+
+        ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_DATA_TOTAL,
+                                             ToStringTotalTransmittedDataLC() );
+                                             
+        ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_DATA_RECEIVED,
+                                             ToStringReceivedDataLC() );
+
+        ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_DATA_SENT,
+                                             ToStringSentDataLC() );
+        CleanupStack::PopAndDestroy( 4, temp );   // ToString...LC()
+        }
+
+    ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_DURATION,
+                                         ToStringDurationLC() );
+    CleanupStack::PopAndDestroy( 1 );   // ToStringDurationLC()
+
+    if ( internal )
+        {
+        temp = ToStringTransferSpeedDownLC();
+
+        ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_SPEED,
+                                             temp );
+
+        ToDetailsListBoxItemTextWithAppendL( 0, 
+                                             ToStringTransferSpeedUpLC() );
+        CleanupStack::PopAndDestroy( 2, temp );   // ToString...LC()
+        }
+
+    ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_CSD_NUMBER,
+                                         ToStringDialupNumberLC() );
+    CleanupStack::PopAndDestroy( 1 );   // ToStringDialupNumberLC()
+
+    if ( internal )
+        {
+        TInt sharing = RefreshAppNamesL();
+        
+        if ( sharing > 1 )
+            {
+            for ( TInt i = 0; i < sharing; i++ )
+                {
+                if ( i == 0 )
+                    {
+                    ToDetailsListBoxItemTextWithAppendL( 
+                                    R_QTN_CMON_HEADING_SHARING_INFO,
+                                    ToStringAppNameLC( i ) );
+                    }
+                else
+                    {
+                    ToDetailsListBoxItemTextWithAppendL( 0, 
+                                                ToStringAppNameLC( i ) );
+                    }
+                }
+            CleanupStack::PopAndDestroy( sharing ); 
+                                                    // ToStringAppNameLC()
+            }
+        }
+    CMUILOGGER_LEAVEFN("CCsdConnectionInfo::ToArrayDetailsL");
+    }
+
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorui/src/EasyWLANConnectionInfo.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,371 @@
+/*
+* Copyright (c) 2004 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:  Represents a WLAN connection
+*
+*
+*/
+
+
+// INCLUDE FILES
+#include <ConnectionMonitorUi.rsg>
+#include <ConnectionMonitorUi.mbg>
+
+#include "EasyWLANConnectionInfo.h"
+#include "ConnectionArray.h"
+#include <StringLoader.h>
+
+#include "ConnectionMonitorUiLogger.h"
+
+
+// CONSTANTS
+/**
+* Count of details of WLAN connection
+*/
+LOCAL_D const TUint KMaxNumOfListBoxItems = 14;
+
+
+// ================= MEMBER FUNCTIONS =======================
+// ---------------------------------------------------------
+// CEasyWlanConnectionInfo::NewL
+// ---------------------------------------------------------
+//
+CEasyWlanConnectionInfo* CEasyWlanConnectionInfo::NewL( TInt aConnectionId,
+                              RConnectionMonitor* const aConnectionMonitor,
+                              TConnMonBearerType aConnectionBearerType,
+                              CActiveWrapper* aActiveWrapper )
+    {
+    CMUILOGGER_ENTERFN(
+        "CEasyWlanConnectionInfo* CEasyWlanConnectionInfo::NewL" );
+    CEasyWlanConnectionInfo* self = new ( ELeave ) CEasyWlanConnectionInfo(
+                                                    aConnectionId,
+                                                    aConnectionMonitor,
+                                                    aConnectionBearerType,
+                                                    aActiveWrapper );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    CMUILOGGER_LEAVEFN(
+        "CEasyWlanConnectionInfo* CEasyWlanConnectionInfo::NewL" );
+    return self;
+    }
+
+// ---------------------------------------------------------
+// CEasyWlanConnectionInfo::CEasyWlanConnectionInfo
+// ---------------------------------------------------------
+//
+CEasyWlanConnectionInfo::CEasyWlanConnectionInfo( TInt aConnectionId,
+                              RConnectionMonitor* const aConnectionMonitor,
+                              TConnMonBearerType aConnectionBearerType,
+                              CActiveWrapper* aActiveWrapper )
+    : CWlanConnectionInfo( aConnectionId,
+                           aConnectionMonitor,
+                           aConnectionBearerType,
+                           aActiveWrapper )
+    {
+    iEasyWlan= ETrue;
+    }
+
+// ---------------------------------------------------------
+// CEasyWlanConnectionInfo::ConstructL
+// ---------------------------------------------------------
+//
+void CEasyWlanConnectionInfo::ConstructL()
+    {
+    CMUILOGGER_ENTERFN( "void CEasyWlanConnectionInfo::ConstructL()" );
+
+    CWlanConnectionInfo::ConstructL();
+
+    CMUILOGGER_LEAVEFN( "void CEasyWlanConnectionInfo::ConstructL()" );
+    }
+
+
+// ---------------------------------------------------------
+// CEasyWlanConnectionInfo::~CEasyWlanConnectionInfo
+// ---------------------------------------------------------
+//
+CEasyWlanConnectionInfo::~CEasyWlanConnectionInfo()
+    {
+    }
+
+// ---------------------------------------------------------
+// CEasyWlanConnectionInfo::DeepCopyL
+// ---------------------------------------------------------
+//        
+CConnectionInfoBase* CEasyWlanConnectionInfo::DeepCopyL()
+	{
+	CEasyWlanConnectionInfo* temp = new ( ELeave ) CEasyWlanConnectionInfo(
+                                                    iConnectionId,
+                                                    iConnectionMonitor,
+                                                    iConnectionBearerType,
+                                                    iActiveWrapper );
+                              							
+	temp->iConnectionName = iConnectionName;
+	temp->iConnectionStatus = iConnectionStatus;
+	temp->iUploaded = iUploaded;
+	temp->iDownloaded = iDownloaded;
+	temp->iStartTime = iStartTime;
+	temp->iDuration = iDuration;
+	temp->iLastSpeedUpdate = iLastSpeedUpdate;
+	temp->iUpSpeed = iUpSpeed;
+	temp->iDownSpeed = iDownSpeed;
+	temp->iListBoxItemText = iListBoxItemText;
+	
+	temp->iWlanNetworkName = iWlanNetworkName;
+	temp->iSignalStrength = iSignalStrength;
+	temp->iNetworkMode = iNetworkMode;
+	temp->iSecurityMode = iSecurityMode;
+	temp->iTxPower = iTxPower;
+
+	if ( iDetailsArray )
+		{
+		CleanupStack::PushL( temp );		
+		temp->ToArrayDetailsL();
+		CleanupStack::Pop( temp );			
+		}
+		
+	return temp;	
+	}    
+
+// ---------------------------------------------------------
+// CEasyWlanConnectionInfo::ToArrayDetailsL
+// ---------------------------------------------------------
+//
+void CEasyWlanConnectionInfo::ToArrayDetailsL()
+    {
+    CMUILOGGER_ENTERFN( "void CEasyWlanConnectionInfo::ToArrayDetailsL()" );
+
+    HBufC* temp = NULL;
+    delete iDetailsArray;
+    iDetailsArray = NULL;
+
+    iDetailsArray = new ( ELeave ) CDesCArrayFlat
+        ( KMaxNumOfListBoxItems );
+
+    temp = ToStringBearerLC();
+
+    ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_BEARER,
+                                         temp );
+
+    ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_STATUS,
+                                         ToStringStatusLC() );
+
+    ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_WLAN_NETWORK_NAME,
+                                         GetWlanNetworkNameLC() );
+
+    ToDetailsListBoxItemTextWithAppendL
+        (
+        R_QTN_CMON_HEADING_WLAN_SIGNAL_STRENGTH,
+        ToStringSignalStrengthLC()
+        );
+
+    ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_WLAN_NETWORK_MODE,
+                                         ToStringNetworkModeLC() );
+
+    ToDetailsListBoxItemTextWithAppendL
+        (
+        R_QTN_CMON_HEADING_WLAN_SECURITY_MODE,
+        ToStringSecurityModeLC()
+        );
+
+    ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_WLAN_TX_POWER,
+                                         ToStringTxPowerLC() );
+        
+    ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_DATA_TOTAL,
+                                         ToStringTotalTransmittedDataLC() );
+
+    ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_DATA_RECEIVED,
+                                         ToStringReceivedDataLC() );
+
+    ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_DATA_SENT,
+                                         ToStringSentDataLC() );
+
+    ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_DURATION,
+                                         ToStringDurationLC() );
+
+    ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_SPEED,
+                                         ToStringTransferSpeedDownLC() );
+
+    ToDetailsListBoxItemTextWithAppendL( 0, 
+                                         ToStringTransferSpeedUpLC() );
+
+    CleanupStack::PopAndDestroy
+        (
+        KMaxNumOfListBoxItems - 1,
+        temp
+        );
+
+    CMUILOGGER_WRITE_F( "KMaxNumOfListBoxItems + cCXSupported : %d",
+                        KMaxNumOfListBoxItems );
+
+    TInt sharing = RefreshAppNamesL();
+        
+    if ( sharing > 1 )
+        {
+        for ( TInt i = 0; i < ( sharing ); i++ )
+            {
+            if ( i == 0 )
+                {
+                ToDetailsListBoxItemTextWithAppendL( 
+                                    R_QTN_CMON_HEADING_SHARING_INFO,
+                                    ToStringAppNameLC( i ) );
+                }
+            else
+                {
+                ToDetailsListBoxItemTextWithAppendL( 0, 
+                                                ToStringAppNameLC( i ) );
+                }
+            }
+        CleanupStack::PopAndDestroy( sharing ); // ToStringAppNameLC()
+        }
+        
+    CMUILOGGER_LEAVEFN( "void CEasyWlanConnectionInfo::ToArrayDetailsL()" );
+    }
+
+// ---------------------------------------------------------
+// CEasyWlanConnectionInfo::RefreshDetailsArrayL
+// ---------------------------------------------------------
+//
+void CEasyWlanConnectionInfo::RefreshDetailsArrayL()
+    {
+    CMUILOGGER_ENTERFN( "CEasyWlanConnectionInfo::RefreshDetailsArrayL()" );
+
+    HBufC* temp = NULL;
+
+    temp = ToStringStatusLC();
+
+    ToDetailsListBoxItemTextWithReplaceL( R_QTN_CMON_HEADING_STATUS,
+                                          temp, 1 );
+
+    ToDetailsListBoxItemTextWithReplaceL
+        (
+        R_QTN_CMON_HEADING_WLAN_SIGNAL_STRENGTH,
+        ToStringSignalStrengthLC(),
+        3
+        );
+
+    ToDetailsListBoxItemTextWithReplaceL
+        (
+        R_QTN_CMON_HEADING_WLAN_TX_POWER,
+        ToStringTxPowerLC(),
+        6
+        );
+        
+    ToDetailsListBoxItemTextWithReplaceL( R_QTN_CMON_HEADING_DATA_TOTAL,
+                                          ToStringTotalTransmittedDataLC(),
+                                          7 );
+
+    ToDetailsListBoxItemTextWithReplaceL( R_QTN_CMON_HEADING_DATA_RECEIVED,
+                                          ToStringReceivedDataLC(),
+                                          8 );
+
+    ToDetailsListBoxItemTextWithReplaceL( R_QTN_CMON_HEADING_DATA_SENT,
+                                          ToStringSentDataLC(),
+                                          9 );
+
+    ToDetailsListBoxItemTextWithReplaceL( R_QTN_CMON_HEADING_DURATION,
+                                          ToStringDurationLC(),
+                                          10 );
+
+    ToDetailsListBoxItemTextWithReplaceL( R_QTN_CMON_HEADING_SPEED,
+                                          ToStringTransferSpeedDownLC(),
+                                          11 );
+
+    ToDetailsListBoxItemTextWithReplaceL( 0, 
+                                          ToStringTransferSpeedUpLC(),
+                                          12 );
+
+    CleanupStack::PopAndDestroy( 9, temp );
+
+    TInt count = iDetailsArray->Count();
+    TInt realElementsMaxCount = KMaxNumOfListBoxItems;
+
+    CMUILOGGER_WRITE_F( "count : %d", count );
+    CMUILOGGER_WRITE_F( "realElementsMaxCount : %d", 
+                        realElementsMaxCount );
+
+    TInt sharing = RefreshAppNamesL();
+
+    if ( sharing > 1 )
+        {
+        if ( count >= realElementsMaxCount )
+            {  
+            iDetailsArray->Delete( realElementsMaxCount - 1,
+                                       iDetailsArray->Count() - 13 );
+            iDetailsArray->Compress(); 
+            }
+
+        for ( TInt i = 0; i < sharing; i++ )
+            {
+            if ( i == 0 )
+                {
+                ToDetailsListBoxItemTextWithAppendL( 
+                                        R_QTN_CMON_HEADING_SHARING_INFO,
+                                        ToStringAppNameLC( i ) );
+                }
+            else
+                {
+                ToDetailsListBoxItemTextWithAppendL( 0, 
+                                            ToStringAppNameLC( i ) );
+                }
+            }
+        CleanupStack::PopAndDestroy( sharing ); // ToStringAppNameLC()
+        }
+    else
+        {
+        if ( count >= realElementsMaxCount )
+            {
+            iDetailsArray->Delete( realElementsMaxCount - 1,
+                                   iDetailsArray->Count() - 13 );
+            iDetailsArray->Compress();              
+            }
+        } 
+
+    CMUILOGGER_LEAVEFN(
+        "void CEasyWlanConnectionInfo::RefreshDetailsArrayL()" );
+    }
+
+// ---------------------------------------------------------
+// CEasyWlanConnectionInfo::RefreshConnectionListBoxItemTextL
+// ---------------------------------------------------------
+//
+void CEasyWlanConnectionInfo::RefreshConnectionListBoxItemTextL()
+    {
+    CMUILOGGER_ENTERFN(
+    "void CEasyWlanConnectionInfo::RefreshConnectionListBoxItemTextL()" );
+
+    TUint  iconId;
+    HBufC* secondRow = NULL;
+
+    iconId = GetIconId();
+
+    if ( iConnectionStatus == EConnectionCreated )
+        {
+        secondRow =  ToStringDurationLC();
+        }
+    else    // if connection has not created yet gives back the status of its.
+        {
+        secondRow = ToStringStatusLC( EFalse );
+        }
+
+    iListBoxItemText.Format( KConnectonListItemTextFormat, iconId,
+                             &iWlanNetworkName, secondRow );
+    CleanupStack::PopAndDestroy( secondRow );
+
+    CMUILOGGER_LEAVEFN(
+    "void CEasyWlanConnectionInfo::RefreshConnectionListBoxItemTextL()" );
+    }
+
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorui/src/FeatureManagerWrapper.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,70 @@
+/*
+* Copyright (c) 2004 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 CFeatureManagerWrapper.
+*
+*/
+
+
+// INCLUDE FILES
+#include    "FeatureManagerWrapper.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CFeatureManagerWrapper::CFeatureManagerWrapper
+// ---------------------------------------------------------
+//
+CFeatureManagerWrapper::CFeatureManagerWrapper() : CBase()
+    {
+    }
+
+// ---------------------------------------------------------
+// CFeatureManagerWrapper::~CFeatureManagerWrapper
+// ---------------------------------------------------------
+//
+CFeatureManagerWrapper::~CFeatureManagerWrapper() 
+    {
+    if ( iIsFeatureMgrInitialized )
+        {
+        FeatureManager::UnInitializeLib();    
+        }
+    }
+
+// ---------------------------------------------------------
+// CFeatureManagerWrapper::ConstructL
+// ---------------------------------------------------------
+//
+void CFeatureManagerWrapper::ConstructL()
+    {
+    FeatureManager::InitializeLibL();
+    iIsFeatureMgrInitialized = ETrue ;
+    }
+
+// ---------------------------------------------------------
+// CFeatureManagerWrapper::NewL
+// ---------------------------------------------------------
+//
+CFeatureManagerWrapper*  CFeatureManagerWrapper::NewL()
+    {
+    CFeatureManagerWrapper* self = new ( ELeave ) CFeatureManagerWrapper;
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+//End of file.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorui/src/GprsConnectionInfo.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,426 @@
+/*
+* Copyright (c) 2004 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:  Represents a GPRS connection
+*     
+*
+*/
+
+
+// INCLUDE FILES
+//#include <nifvar.h>
+#include <StringLoader.h>
+#include <ConnectionMonitorUi.rsg>
+#include <ConnectionMonitorUi.mbg>
+//#include <Avkon.rsg>
+
+#include "ConnectionMonitorUiLogger.h"
+#include "GprsConnectionInfo.h"
+#include "ActiveWrapper.h"
+
+// CONSTANTS
+LOCAL_D const TUint KDetailsArrayGranularityInternal = 11;
+LOCAL_D const TUint KDetailsArrayGranularityExternal = 10;
+
+
+// ================= MEMBER FUNCTIONS =======================
+// ---------------------------------------------------------
+// CGprsConnectionInfo::NewL
+// ---------------------------------------------------------
+//
+CGprsConnectionInfo* CGprsConnectionInfo::NewL( TInt aConnectionId, 
+                              RConnectionMonitor* const aConnectionMonitor,
+                              TConnMonBearerType aConnectionBearerType,
+                              CActiveWrapper* aActiveWrapper )
+    {
+    CGprsConnectionInfo* self = new ( ELeave ) CGprsConnectionInfo( 
+                                                    aConnectionId, 
+                                                    aConnectionMonitor, 
+                                                    aConnectionBearerType,
+                                                    aActiveWrapper );
+    CleanupStack::PushL( self );
+    self->ConstructL(); // Have to call this ConstructL at first,
+    CleanupStack::Pop( self );
+    CMUILOGGER_WRITE( "NewL, CGprsConnectionInfo" );
+    return self;
+    }
+
+
+// ---------------------------------------------------------
+// CGprsConnectionInfo::~CGprsConnectionInfo
+// ---------------------------------------------------------
+//
+CGprsConnectionInfo::~CGprsConnectionInfo()
+    {
+    }
+
+
+// ---------------------------------------------------------
+// CGprsConnectionInfo::CGprsConnectionInfo
+// ---------------------------------------------------------
+//
+CGprsConnectionInfo::CGprsConnectionInfo(  TInt aConnectionId, 
+                             RConnectionMonitor* const aConnectionMonitor,
+                             TConnMonBearerType aConnectionBearerType,
+                             CActiveWrapper* aActiveWrapper ) :
+    CConnectionInfoBase( aConnectionId, 
+                         aConnectionMonitor, 
+                         aConnectionBearerType,
+                         aActiveWrapper )
+        {
+        CMUILOGGER_WRITE( "CGprsConnectionInfo constuctor" );
+        }
+
+
+// ---------------------------------------------------------
+// CGprsConnectionInfo::ConstructL
+// ---------------------------------------------------------
+//
+void CGprsConnectionInfo::ConstructL()
+    {
+    CMUILOGGER_ENTERFN( "CGprsConnectionInfo::ConstructL() start" );
+    
+    iActiveWrapper->StartGetStringAttribute( iConnectionId,
+                                             iConnectionMonitor,
+                                             KAccessPointName,
+                                             iApName );
+#ifdef  __WINS__
+    iApName = _L( "LAN" );
+#else
+    TInt err( iActiveWrapper->iStatus.Int() );
+    CMUILOGGER_WRITE_F( "CGprsConnectionInfo::ConstructL status: %d", err );
+    if ( err != KErrNone )
+        {
+        User::Leave( err );
+        }
+#endif
+    CMUILOGGER_WRITE_F( "iApName Connection name: %S", &iApName );
+    
+    CConnectionInfoBase::ConstructL(); // and base class ConstructL next.
+    CMUILOGGER_WRITE( "CGprsConnectionInfo::ConstructL() end" );
+    }
+    
+// ---------------------------------------------------------
+// CGprsConnectionInfo::DeepCopyL
+// ---------------------------------------------------------
+//        
+CConnectionInfoBase* CGprsConnectionInfo::DeepCopyL()
+	{
+	CGprsConnectionInfo* temp = new ( ELeave ) CGprsConnectionInfo(
+                                                    iConnectionId,
+                                                    iConnectionMonitor,
+                                                    iConnectionBearerType,
+                                                    iActiveWrapper );
+                              							
+	temp->iConnectionName = iConnectionName;
+	temp->iConnectionStatus = iConnectionStatus;
+	temp->iUploaded = iUploaded;
+	temp->iDownloaded = iDownloaded;
+	temp->iStartTime = iStartTime;
+	temp->iDuration = iDuration;
+	temp->iLastSpeedUpdate = iLastSpeedUpdate;
+	temp->iUpSpeed = iUpSpeed;
+	temp->iDownSpeed = iDownSpeed;
+	temp->iListBoxItemText = iListBoxItemText;
+	
+	temp->iApName = iApName;
+	
+	if ( iDetailsArray )
+		{
+		CleanupStack::PushL( temp );		
+		temp->ToArrayDetailsL();
+		CleanupStack::Pop( temp );			
+		}
+
+	return temp;	
+	}
+    
+
+// ---------------------------------------------------------
+// CGprsConnectionInfo::GetIconId
+// ---------------------------------------------------------
+//
+TUint CGprsConnectionInfo::GetIconId() const
+    {
+    TUint iconId = EGprs;
+    if ( iConnectionStatus == EConnectionSuspended )
+	    {
+	    iconId = ESuspended;
+	    }
+    return iconId;
+    }
+
+// ---------------------------------------------------------
+// CGprsConnectionInfo::RefreshDetailsL
+// ---------------------------------------------------------
+//
+void CGprsConnectionInfo::RefreshDetailsL()
+    {
+    CMUILOGGER_WRITE( "CGprsConnectionInfo::RefreshDetailsL start" );
+
+    iActiveWrapper->StartGetStringAttribute( iConnectionId,
+                                             iConnectionMonitor,
+                                             KAccessPointName,
+                                             iApName );
+#ifdef  __WINS__
+    iActiveWrapper->Cancel();
+    iApName = _L( "LAN" );
+#else
+    TInt err( iActiveWrapper->iStatus.Int() );
+    CMUILOGGER_WRITE_F( "CGprsConnectionInfo::RefreshDetailsL status: %d",
+                        err );
+    if ( err != KErrNone )
+        {
+        User::Leave( err );
+        }
+#endif
+    CMUILOGGER_WRITE_F( "iApName Connection name: %S", &iApName );
+          
+    RefreshTransferSpeedsL();
+    RefreshDuration();
+    CMUILOGGER_WRITE( "CGprsConnectionInfo::RefreshDetailsL end" );
+    }
+
+// ---------------------------------------------------------
+// CGprsConnectionInfo::ToStringApNameLC
+// ---------------------------------------------------------
+//
+HBufC* CGprsConnectionInfo::ToStringApNameLC() const
+    {
+    HBufC* apName = iApName.AllocLC();
+    return apName;    
+    }
+
+
+// ---------------------------------------------------------
+// CGprsConnectionInfo::RefreshConnectionListBoxItemTextL
+// ---------------------------------------------------------
+//
+void CGprsConnectionInfo::RefreshConnectionListBoxItemTextL()
+    {
+    CMUILOGGER_WRITE( 
+        "CGprsConnectionInfo::RefreshConnectionListBoxItemTextL start" );
+
+    TUint  iconId;
+    HBufC* secondRow = NULL;
+    
+    iconId = GetIconId();
+
+    if ( iConnectionStatus == EConnectionCreated )
+        {
+        CDesCArrayFlat* array = new (ELeave) CDesCArrayFlat(2);
+        CleanupStack::PushL( array );
+      
+        HBufC* stringReceivedData = ToStringReceivedDataLC( ETrue );
+        HBufC* stringSentData = ToStringSentDataLC( ETrue );
+
+        StringMarkerRemoval( stringReceivedData );
+        StringMarkerRemoval( stringSentData );
+        
+        array->AppendL( *stringReceivedData );
+        array->AppendL( *stringSentData );
+
+        secondRow = StringLoader::LoadL( R_QTN_CMON_UL_DL_DATA_AMOUNTS, 
+                                         *array );
+
+        CleanupStack::PopAndDestroy( stringSentData );
+        CleanupStack::PopAndDestroy( stringReceivedData );
+        CleanupStack::PopAndDestroy( array );
+        }
+    else // if connection has not created yet gives back the status of its.
+        {
+        secondRow = ToStringStatusLC( EFalse );
+        CleanupStack::Pop( secondRow ); 
+        }
+
+    iListBoxItemText.Format( KConnectonListItemTextFormat, iconId, 
+                             &iConnectionName, secondRow );
+    delete secondRow;
+    CMUILOGGER_WRITE( 
+        "CGprsConnectionInfo::RefreshConnectionListBoxItemTextL end" );
+    }
+
+// ---------------------------------------------------------
+// CGprsConnectionInfo::RefreshDetailsArrayL
+// ---------------------------------------------------------
+//
+void CGprsConnectionInfo::RefreshDetailsArrayL()
+    {
+    CMUILOGGER_WRITE( "CGprsConnectionInfo::RefreshDetailsArrayL start" );
+    if ( iDetailsArray )
+        {
+        TBool internal = iConnectionBearerType < EBearerExternalCSD ;   
+        HBufC* temp = NULL;
+
+        temp = ToStringStatusLC();
+        ToDetailsListBoxItemTextWithReplaceL( R_QTN_CMON_HEADING_STATUS,
+                                              temp, 2 );
+
+        ToDetailsListBoxItemTextWithReplaceL( R_QTN_CMON_HEADING_DATA_TOTAL,
+                                              ToStringTotalTransmittedDataLC(),
+                                              3 );
+        ToDetailsListBoxItemTextWithReplaceL
+            (
+            R_QTN_CMON_HEADING_DATA_RECEIVED,
+            ToStringReceivedDataLC(),
+            4
+            );                                              
+
+        ToDetailsListBoxItemTextWithReplaceL( R_QTN_CMON_HEADING_DATA_SENT,
+                                              ToStringSentDataLC(), 5 );
+    
+        ToDetailsListBoxItemTextWithReplaceL( R_QTN_CMON_HEADING_DURATION,
+                                              ToStringDurationLC(), 6 );
+        
+        ToDetailsListBoxItemTextWithReplaceL
+            (
+            R_QTN_CMON_HEADING_SPEED,
+            ToStringTransferSpeedDownLC(),
+            7
+            );
+
+        ToDetailsListBoxItemTextWithReplaceL
+            (
+            0, 
+            ToStringTransferSpeedUpLC(),
+            8
+            );
+    
+        CleanupStack::PopAndDestroy( 7, temp );   // ToString...LC()
+    
+        if ( internal )
+            {
+            TInt sharing = RefreshAppNamesL();
+                
+            if ( sharing > 1 )
+                {
+                if ( iDetailsArray->Count() > 10 )
+                    {                
+                    iDetailsArray->Delete( 10, 
+                                           iDetailsArray->Count() - 10 );
+                    iDetailsArray->Compress();
+                    }
+
+                for ( TInt i = 0; i < sharing; i++ )
+                    {
+                    if ( i == 0 )
+                        {
+                        ToDetailsListBoxItemTextWithAppendL( 
+                                        R_QTN_CMON_HEADING_SHARING_INFO,
+                                        ToStringAppNameLC( i ) );
+                        }
+                    else
+                        {
+                        ToDetailsListBoxItemTextWithAppendL( 0, 
+                                                    ToStringAppNameLC( i ) );
+                        }
+                    }
+                CleanupStack::PopAndDestroy( sharing ); 
+                                                    // ToStringAppNameLC()
+                }
+            else
+                {
+                if ( iDetailsArray->Count() > 10 )
+                    {
+                    iDetailsArray->Delete( 10, iDetailsArray->Count() - 10 );
+                    iDetailsArray->Compress();
+                    }
+                }
+            }
+        }
+    CMUILOGGER_WRITE( "CGprsConnectionInfo::RefreshDetailsArrayL end" );    
+    }
+
+
+// ---------------------------------------------------------
+// CGprsConnectionInfo::ToArrayDetailsL
+// ---------------------------------------------------------
+//
+void CGprsConnectionInfo::ToArrayDetailsL()
+    {
+    CMUILOGGER_ENTERFN("CGprsConnectionInfo::ToArrayDetailsL");
+    TBool internal = iConnectionBearerType < EBearerExternalCSD ;
+    TUint granularity = KDetailsArrayGranularityExternal;
+    HBufC* temp = NULL;
+
+
+    if ( internal )
+        {
+        granularity = KDetailsArrayGranularityInternal;
+        }
+    delete iDetailsArray;
+    iDetailsArray = NULL;
+    iDetailsArray = new ( ELeave ) CDesCArrayFlat( granularity );
+  
+    temp = iConnectionName.AllocLC();
+
+    ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_CONN_NAME,
+                                         temp );
+
+    ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_BEARER,
+                                         ToStringBearerLC() );
+
+    ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_STATUS,
+                                         ToStringStatusLC() );
+    
+    ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_DATA_TOTAL,
+                                         ToStringTotalTransmittedDataLC() );
+
+    ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_DATA_RECEIVED,
+                                         ToStringReceivedDataLC() );
+
+    ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_DATA_SENT,
+                                         ToStringSentDataLC() );
+    
+    ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_DURATION,
+                                         ToStringDurationLC() );
+        
+    ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_SPEED,
+                                         ToStringTransferSpeedDownLC() );
+
+    ToDetailsListBoxItemTextWithAppendL( 0, 
+                                         ToStringTransferSpeedUpLC() );
+    
+    ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_GPRS_APN,
+                                         ToStringApNameLC() );
+    CleanupStack::PopAndDestroy( 10, temp );   // ToString...LC()
+    
+    if ( internal )
+        {
+        TInt sharing = RefreshAppNamesL();
+
+        if ( sharing > 1 )
+            {
+            for ( TInt i = 0; i < sharing; i++ )
+                {
+                if ( i == 0 )
+                    {
+                    ToDetailsListBoxItemTextWithAppendL( 
+                                    R_QTN_CMON_HEADING_SHARING_INFO,
+                                    ToStringAppNameLC( i ) );
+                    }
+                else
+                    {
+                    ToDetailsListBoxItemTextWithAppendL( 0, 
+                                                ToStringAppNameLC( i ) );
+                    }
+                }
+            CleanupStack::PopAndDestroy( sharing ); 
+                                                    // ToStringAppNameLC()
+            }
+        }
+    CMUILOGGER_LEAVEFN("CGprsConnectionInfo::ToArrayDetailsL");
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connectionmonitorui/src/WlanConnectionInfo.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,851 @@
+/*
+* Copyright (c) 2004 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:  Represents a WLAN connection
+*     
+*
+*/
+
+
+// INCLUDE FILES
+#include <ConnectionMonitorUi.rsg>
+#include <ConnectionMonitorUi.mbg>
+
+#include "ConnectionArray.h"
+#include "WlanConnectionInfo.h"
+#include "EasyWLANConnectionInfo.h"
+#include "ActiveWrapper.h"
+
+#include <StringLoader.h>
+
+#include "ConnectionMonitorUiLogger.h"
+
+// CONSTANTS
+
+/**
+* Count of details of WLAN connection
+*/
+LOCAL_D const TUint KDetailsArrayMaxGranularityCCX = 15;
+
+// ================= MEMBER FUNCTIONS =======================
+// ---------------------------------------------------------
+// CWlanConnectionInfo::NewL
+// ---------------------------------------------------------
+//
+CWlanConnectionInfo* CWlanConnectionInfo::NewL( TInt aConnectionId, 
+                                RConnectionMonitor* const aConnectionMonitor,
+                                TConnMonBearerType aConnectionBearerType,
+                                const HBufC* aEasyWlanIAPName,
+                                CActiveWrapper* aActiveWrapper )
+    {
+    CMUILOGGER_ENTERFN( "CWlanConnectionInfo* CWlanConnectionInfo::NewL" ); 
+       
+    CWlanConnectionInfo* self = new ( ELeave ) CWlanConnectionInfo( 
+                                                      aConnectionId, 
+                                                      aConnectionMonitor, 
+                                                      aConnectionBearerType,
+                                                      aActiveWrapper );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    
+    if ( aEasyWlanIAPName )
+        {
+        if ( self->iConnectionName.Compare( *aEasyWlanIAPName ) )
+            {
+            CleanupStack::Pop( self );        
+            }
+        else
+            {
+            CEasyWlanConnectionInfo* temp = CEasyWlanConnectionInfo::NewL( 
+                                                      aConnectionId, 
+                                                      aConnectionMonitor, 
+                                                      aConnectionBearerType,
+                                                      aActiveWrapper );
+            CleanupStack::PopAndDestroy( self );
+            self = temp;
+            }        
+        }
+    else
+        {
+        CleanupStack::Pop( self );                            
+        }
+ 
+    
+    
+    CMUILOGGER_LEAVEFN( "CWlanConnectionInfo* CWlanConnectionInfo::NewL" );
+        
+    return self;
+    }
+
+// ---------------------------------------------------------
+// CWlanConnectionInfo::CWlanConnectionInfo
+// ---------------------------------------------------------
+//
+CWlanConnectionInfo::CWlanConnectionInfo( TInt aConnectionId, 
+                                RConnectionMonitor* const aConnectionMonitor,
+                                TConnMonBearerType aConnectionBearerType,
+                                CActiveWrapper* aActiveWrapper ) 
+    : CConnectionInfoBase( aConnectionId, 
+                           aConnectionMonitor, 
+                           aConnectionBearerType,
+                           aActiveWrapper ), iEasyWlan( EFalse )
+    {
+    }
+
+// ---------------------------------------------------------
+// CWlanConnectionInfo::ConstructL
+// ---------------------------------------------------------
+//
+void CWlanConnectionInfo::ConstructL()
+    {  
+    CMUILOGGER_ENTERFN( "void CWlanConnectionInfo::ConstructL()" ); 
+     
+    RefreshNetworkNameL();
+    RefreshSignalStrength();
+    RefreshSecurityMode();
+    RefreshNetworkMode();        
+    RefreshTxPowerL();        
+    
+    CConnectionInfoBase::ConstructL(); // and base class ConstructL next.
+    
+    CMUILOGGER_LEAVEFN( "void CWlanConnectionInfo::ConstructL()" );    
+    }
+
+
+// ---------------------------------------------------------
+// CWlanConnectionInfo::~CWlanConnectionInfo
+// ---------------------------------------------------------
+//
+CWlanConnectionInfo::~CWlanConnectionInfo()
+    {
+    }
+    
+// ---------------------------------------------------------
+// CWlanConnectionInfo::DeepCopyL
+// ---------------------------------------------------------
+//        
+CConnectionInfoBase* CWlanConnectionInfo::DeepCopyL()
+	{
+	CWlanConnectionInfo* temp = new ( ELeave ) CWlanConnectionInfo(
+                                                    iConnectionId,
+                                                    iConnectionMonitor,
+                                                    iConnectionBearerType,
+                                                    iActiveWrapper );
+                              							
+	temp->iConnectionName = iConnectionName;
+	temp->iConnectionStatus = iConnectionStatus;
+	temp->iUploaded = iUploaded;
+	temp->iDownloaded = iDownloaded;
+	temp->iStartTime = iStartTime;
+	temp->iDuration = iDuration;
+	temp->iLastSpeedUpdate = iLastSpeedUpdate;
+	temp->iUpSpeed = iUpSpeed;
+	temp->iDownSpeed = iDownSpeed;
+	temp->iListBoxItemText = iListBoxItemText;
+	
+	temp->iWlanNetworkName = iWlanNetworkName;
+	temp->iSignalStrength = iSignalStrength;
+	temp->iNetworkMode = iNetworkMode;
+	temp->iSecurityMode = iSecurityMode;
+	temp->iTxPower = iTxPower;
+	
+	if ( iDetailsArray )
+		{
+		CleanupStack::PushL( temp );		
+		temp->ToArrayDetailsL();
+		CleanupStack::Pop( temp );			
+		}
+		
+	return temp;	
+	}    
+
+// ---------------------------------------------------------
+// CWlanConnectionInfo::GetIconId
+// ---------------------------------------------------------
+//
+TUint CWlanConnectionInfo::GetIconId() const
+    {
+    CMUILOGGER_ENTERFN( "TUint CWlanConnectionInfo::GetIconId() const" ); 
+    
+    TUint iconId = EWlan;    
+    
+    CMUILOGGER_LEAVEFN( "TUint CWlanConnectionInfo::GetIconId() const" );
+    
+    return iconId;
+    }
+
+// ---------------------------------------------------------
+// CWlanConnectionInfo::IsEasyWLAN
+// ---------------------------------------------------------
+//
+TBool CWlanConnectionInfo::IsEasyWLAN() const
+    {
+    return iEasyWlan;    
+    }
+
+// ---------------------------------------------------------
+// CWlanConnectionInfo::GetWlanNetworkNameLC
+// ---------------------------------------------------------
+//
+HBufC* CWlanConnectionInfo::GetWlanNetworkNameLC() const
+    {
+    CMUILOGGER_ENTERFN( "CWlanConnectionInfo::GetWlanNetworkNameLC()" ); 
+    
+    HBufC* name = iWlanNetworkName.AllocLC();
+    
+    CMUILOGGER_LEAVEFN( "CWlanConnectionInfo::GetWlanNetworkNameLC()" );
+    
+    return name;    
+    }
+
+// ---------------------------------------------------------
+// CWlanConnectionInfo::GetWlanSignalStrength
+// ---------------------------------------------------------
+//
+TWlanSignalStrength CWlanConnectionInfo::GetWlanSignalStrength()  const
+    {
+    return iSignalStrength;
+    }
+
+// ---------------------------------------------------------
+// CWlanConnectionInfo::GetWlanNetworkMode
+// ---------------------------------------------------------
+//
+TWlanNetworkMode CWlanConnectionInfo::GetWlanNetworkMode()  const
+    {
+    return iNetworkMode;
+    }
+
+// ---------------------------------------------------------
+// CWlanConnectionInfo::GetWlanSecurityMode
+// ---------------------------------------------------------
+//
+TWlanSecurityMode CWlanConnectionInfo::GetWlanSecurityMode()  const
+    {
+    return iSecurityMode;
+    }
+
+// ---------------------------------------------------------
+// CWlanConnectionInfo::GetWlanTxPower
+// ---------------------------------------------------------
+//
+TUint CWlanConnectionInfo::GetWlanTxPower() const
+    {
+    return iTxPower;
+    }
+
+// ---------------------------------------------------------
+// CWlanConnectionInfo::RefreshDetailsL
+// ---------------------------------------------------------
+//
+void CWlanConnectionInfo::RefreshDetailsL()
+    {
+    CMUILOGGER_ENTERFN( "void CWlanConnectionInfo::RefreshDetailsL()" ); 
+
+    if ( IsAlive() )
+        {
+        RefreshNetworkNameL();
+        }
+    
+    if ( IsAlive() )
+        {
+        RefreshNetworkMode();
+        }
+    
+    if ( IsAlive() )
+        {
+        RefreshSecurityMode();
+        }
+    
+    if ( IsAlive() )
+        {
+        RefreshTransferSpeedsL();
+        }
+    
+    if ( IsAlive() )
+        {
+        RefreshDuration(); 
+        }
+    
+    if ( IsAlive() )
+        {
+        RefreshSignalStrength();
+        }
+    
+    if ( IsAlive() )
+        {
+        RefreshTxPowerL();
+        }
+    
+    CMUILOGGER_LEAVEFN( "void CWlanConnectionInfo::RefreshDetailsL()" );    
+    }
+
+// ---------------------------------------------------------
+// CWlanConnectionInfo::RefreshNetworkNameL
+// ---------------------------------------------------------
+//
+void CWlanConnectionInfo::RefreshNetworkNameL()
+    {
+    CMUILOGGER_ENTERFN( "void CWlanConnectionInfo::RefreshNetworkNameL()" ); 
+    
+    iActiveWrapper->StartGetStringAttribute( iConnectionId,
+                                             iConnectionMonitor,
+                                             KNetworkName,
+                                             iWlanNetworkName );
+    
+    CMUILOGGER_WRITE_F( "RefreshNetworkName status : %d", 
+                        iActiveWrapper->iStatus.Int() );
+
+    if ( iActiveWrapper->iStatus.Int() )
+        {
+        if ( KErrNotFound == iActiveWrapper->iStatus.Int() )
+            {
+            iConnectionStatus = EConnectionClosed;
+            }
+        HBufC* temp = StringLoader::LoadL( R_QTN_CMON_PARAMETER_UNAVAILABLE );
+        iWlanNetworkName = *temp;  
+        delete temp;
+        }
+    
+    CMUILOGGER_LEAVEFN( "void CWlanConnectionInfo::RefreshNetworkNameL()" );
+    }
+
+// ---------------------------------------------------------
+// CWlanConnectionInfo::RefreshSignalStrength
+// ---------------------------------------------------------
+//
+void CWlanConnectionInfo::RefreshSignalStrength()
+    {
+    CMUILOGGER_ENTERFN( "void CWlanConnectionInfo::RefreshSignalStrength()" );
+    
+    iActiveWrapper->StartGetIntAttribute( iConnectionId,
+                                          iConnectionMonitor,
+                                          KSignalStrength,
+                                          ( TInt& )iSignalStrength );
+
+    CMUILOGGER_WRITE_F( "RefreshSignalStrengthL status : %d",
+                        iActiveWrapper->iStatus.Int() );
+    CMUILOGGER_WRITE_F( "iSignalStrength : %d", ( TInt )iSignalStrength );
+
+    if ( iActiveWrapper->iStatus.Int() )
+        {
+        if ( KErrNotFound == iActiveWrapper->iStatus.Int() )
+            {
+            iConnectionStatus = EConnectionClosed;
+            }
+        iSignalStrength = EWlanSignalUnavailable;   
+        }
+            
+    CMUILOGGER_LEAVEFN( "void CWlanConnectionInfo::RefreshSignalStrength()" );
+    }
+
+// ---------------------------------------------------------
+// CWlanConnectionInfo::RefreshSecurityMode
+// ---------------------------------------------------------
+//
+void CWlanConnectionInfo::RefreshSecurityMode()
+    {
+    CMUILOGGER_ENTERFN( "void CWlanConnectionInfo::RefreshSecurityMode()" ); 
+    
+    iActiveWrapper->StartGetIntAttribute( iConnectionId,
+                                          iConnectionMonitor,
+                                          KSecurityMode,
+                                          ( TInt& )iSecurityMode );
+
+    CMUILOGGER_WRITE_F( "RefreshSecurityMode status: %d",
+                        iActiveWrapper->iStatus.Int() );
+    
+    if ( iActiveWrapper->iStatus.Int() )
+        {
+        if ( KErrNotFound == iActiveWrapper->iStatus.Int() )
+            {
+            iConnectionStatus = EConnectionClosed;
+            }
+        iSecurityMode = EWlanSecurityModeUnavailable;    
+        }
+    
+    CMUILOGGER_LEAVEFN( "void CWlanConnectionInfo::RefreshSecurityMode()" );
+    }
+
+// ---------------------------------------------------------
+// CWlanConnectionInfo::RefreshNetworkMode
+// ---------------------------------------------------------
+//
+void CWlanConnectionInfo::RefreshNetworkMode()
+    {
+    CMUILOGGER_ENTERFN( "void CWlanConnectionInfo::RefreshNetworkMode()" ); 
+    
+    iActiveWrapper->StartGetIntAttribute( iConnectionId,
+                                          iConnectionMonitor,
+                                          KNetworkMode,
+                                          ( TInt& )iNetworkMode );
+
+    CMUILOGGER_WRITE_F( "RefreshNetworkMode status : %d",
+                        iActiveWrapper->iStatus.Int() );
+    
+    if ( iActiveWrapper->iStatus.Int() )
+        {
+        if ( KErrNotFound == iActiveWrapper->iStatus.Int() )
+            {
+            iConnectionStatus = EConnectionClosed;
+            }
+        iNetworkMode = EWlanNetworkModeUnavailable;   
+        }
+        
+    CMUILOGGER_LEAVEFN( "void CWlanConnectionInfo::RefreshNetworkMode()" );
+    }
+
+// ---------------------------------------------------------
+// CWlanConnectionInfo::RefreshTxPowerL
+// ---------------------------------------------------------
+//
+void CWlanConnectionInfo::RefreshTxPowerL()
+    {
+    CMUILOGGER_ENTERFN( "void CWlanConnectionInfo::RefreshTxPowerL()" ); 
+    
+    iActiveWrapper->StartGetUintAttribute( iConnectionId,
+                                           iConnectionMonitor,
+                                           KTransmitPower,
+                                           iTxPower );
+
+    if ( iActiveWrapper->iStatus.Int() )
+        {
+        if ( KErrNotFound == iActiveWrapper->iStatus.Int() )
+            {
+            iConnectionStatus = EConnectionClosed;
+            }
+        iSignalStrength = EWlanSignalUnavailable;   
+        }
+            
+    CMUILOGGER_WRITE_F( "iTxPower : %d", iTxPower );
+    TInt err( iActiveWrapper->iStatus.Int() );
+    CMUILOGGER_WRITE_F( "RefreshTxPowerL status: %d", err );
+            
+    CMUILOGGER_LEAVEFN( "void CWlanConnectionInfo::RefreshTxPowerL()" );
+    }
+
+// ---------------------------------------------------------
+// CWlanConnectionInfo::ToStringSignalStrengthLC
+// ---------------------------------------------------------
+//
+HBufC* CWlanConnectionInfo::ToStringSignalStrengthLC() const
+    {
+    CMUILOGGER_ENTERFN( "CWlanConnectionInfo::ToStringSignalStrengthLC()" );
+    
+    HBufC* signalStrength = NULL;
+    TInt resourceId( 0 );
+        
+    if ( iSignalStrength == EWlanSignalUnavailable )
+        {
+        resourceId =  R_QTN_CMON_WLAN_SIGNAL_STRENGTH_NO_SIGNAL;   
+        signalStrength = StringLoader::LoadLC( resourceId );
+        }                    
+    else if ( iSignalStrength < EWlanSignalStrengthGood )
+        {
+        resourceId =  R_QTN_CMON_WLAN_SINGAL_STRENGTH_GOOD;
+        }
+    else if ( iSignalStrength > EWlanSignalStrengthLow )
+        {
+        resourceId =  R_QTN_CMON_WLAN_SINGAL_STRENGTH_LOW;
+        }
+    else 
+        {
+        resourceId = R_QTN_CMON_WLAN_SINGAL_STRENGTH_MEDIUM;
+        }
+        
+    TInt signalInPercent( 0 );
+    if ( iSignalStrength <= EWlanSignalStrengthMax )
+        {
+        signalInPercent = 100;
+        }
+    else if ( iSignalStrength >= EWlanSignalStrengthMin )
+        {
+        signalInPercent = 0;        
+        }
+    else
+        {
+        TInt diff = EWlanSignalStrengthMin - iSignalStrength;
+        signalInPercent = diff * 100 / KDiffOfWlanSignalStrength;        
+        }        
+    
+    if ( !signalStrength ) // there is connection to network
+        {
+        CMUILOGGER_WRITE_F( "signalInPercent : %d", signalInPercent );
+        
+        signalStrength = StringLoader::LoadLC( resourceId, 
+                                               signalInPercent );
+        }        
+            
+    CMUILOGGER_LEAVEFN( "CWlanConnectionInfo::ToStringSignalStrengthLC()" );
+            
+    return signalStrength;    
+    }
+
+// ---------------------------------------------------------
+// CWlanConnectionInfo::ToStringNetworkModeLC
+// ---------------------------------------------------------
+//
+HBufC* CWlanConnectionInfo::ToStringNetworkModeLC() const
+    {
+    CMUILOGGER_ENTERFN( "CWlanConnectionInfo::ToStringNetworkModeLC()" ); 
+    
+    HBufC* networkMode = NULL;
+    TInt resourceId( 0 );
+
+    switch ( iNetworkMode )
+        {
+        case EWlanNetworkModeInfrastructure:
+        case EWlanNetworkModeSecInfrastructure:        
+            {
+            resourceId = R_QTN_CMON_WLAN_NEWTWORK_MODE_INFRA;    
+            break;
+            }
+        case EWlanNetworkModeAdHoc:
+            {
+            resourceId = R_QTN_CMON_WLAN_NEWTWORK_MODE_ADHOC;
+            break;
+            }            
+        case EWlanNetworkModeUnavailable:
+        default:
+            {
+            resourceId = R_QTN_CMON_PARAMETER_UNAVAILABLE;    
+            break;                
+            }
+        }
+    
+    networkMode = StringLoader::LoadLC( resourceId );        
+    
+    CMUILOGGER_LEAVEFN( "CWlanConnectionInfo::ToStringNetworkModeLC()" );
+        
+    return networkMode;
+    }
+
+// ---------------------------------------------------------
+// CWlanConnectionInfo::ToStringSecurityModeLC
+// ---------------------------------------------------------
+//
+HBufC* CWlanConnectionInfo::ToStringSecurityModeLC() const
+    {
+    CMUILOGGER_ENTERFN( "CWlanConnectionInfo::ToStringSecurityModeLC()" );
+    
+    HBufC* securityMode = NULL;
+    TInt resourceId( 0 );
+
+    switch ( iSecurityMode )
+        {
+        case EWlanSecurityModeOpenNetwork:
+            {
+            resourceId = R_QTN_CMON_WLAN_SECURITY_MODE_OPEN;
+            break;
+            }
+        case EWlanSecurityModeWEP:
+            {
+            resourceId = R_QTN_CMON_WLAN_SECURITY_MODE_WEP;
+            break;
+            }
+        case EWlanSecurityMode8021x:
+            {
+            resourceId = R_QTN_CMON_WLAN_SECURITY_MODE_802_1X;
+            break;
+            }
+        case EWlanSecurityModeWPA:
+            {
+            resourceId = R_QTN_CMON_WLAN_SECURITY_MODE_WPA;
+            break;
+            }
+        case EWlanSecurityWpaPsk:
+            {
+            resourceId = R_QTN_CMON_WLAN_SECURITY_MODE_WPA;
+            break;
+            }
+        case EWlanSecurityModeUnavailable:            
+        default:
+            {
+            resourceId = R_QTN_CMON_PARAMETER_UNAVAILABLE;    
+            break;
+            }
+        }
+    
+    securityMode = StringLoader::LoadLC( resourceId );    
+    
+    CMUILOGGER_LEAVEFN( "CWlanConnectionInfo::ToStringSecurityModeLC()" );
+            
+    return securityMode;    
+    }
+
+// ---------------------------------------------------------
+// CWlanConnectionInfo::ToStringTxPowerLC
+// ---------------------------------------------------------
+//
+HBufC* CWlanConnectionInfo::ToStringTxPowerLC() const
+    {
+    CMUILOGGER_ENTERFN( "CWlanConnectionInfo::ToStringTxPowerLC()" ); 
+    
+    HBufC* txPower = StringLoader::LoadLC( R_QTN_CMON_WLAN_TX_POWER_LEVEL,
+                                           iTxPower );
+    
+    CMUILOGGER_LEAVEFN( "CWlanConnectionInfo::ToStringTxPowerLC()" );
+                                               
+    return txPower;    
+    }
+
+// ---------------------------------------------------------
+// CWlanConnectionInfo::ToArrayDetailsL
+// ---------------------------------------------------------
+//
+void CWlanConnectionInfo::ToArrayDetailsL()
+    {
+    CMUILOGGER_ENTERFN( "void CWlanConnectionInfo::ToArrayDetailsL()" ); 
+    
+    HBufC* temp = NULL;
+    delete iDetailsArray;
+    iDetailsArray = NULL;
+    iDetailsArray = new ( ELeave ) CDesCArrayFlat
+                                    ( KDetailsArrayMaxGranularityCCX );
+    
+    temp = iConnectionName.AllocLC();
+ 
+    ToDetailsListBoxItemTextWithAppendL
+        (
+        R_QTN_CMON_HEADING_CONN_NAME,
+        temp );    
+  
+    ToDetailsListBoxItemTextWithAppendL
+        (
+        R_QTN_CMON_HEADING_BEARER,
+        ToStringBearerLC()
+        );
+
+    ToDetailsListBoxItemTextWithAppendL
+        (
+        R_QTN_CMON_HEADING_STATUS,
+        ToStringStatusLC()
+        );
+    
+    ToDetailsListBoxItemTextWithAppendL
+    (
+    R_QTN_CMON_HEADING_WLAN_NETWORK_NAME,
+    GetWlanNetworkNameLC()
+    );
+
+    ToDetailsListBoxItemTextWithAppendL
+        (
+        R_QTN_CMON_HEADING_WLAN_SIGNAL_STRENGTH,
+        ToStringSignalStrengthLC()
+        );
+
+    ToDetailsListBoxItemTextWithAppendL
+        (
+        R_QTN_CMON_HEADING_WLAN_NETWORK_MODE,
+        ToStringNetworkModeLC()
+        );
+
+    ToDetailsListBoxItemTextWithAppendL
+        (
+        R_QTN_CMON_HEADING_WLAN_SECURITY_MODE,
+        ToStringSecurityModeLC()
+        );
+        
+    ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_WLAN_TX_POWER,
+                                         ToStringTxPowerLC() );
+        
+    ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_DATA_TOTAL,
+                                         ToStringTotalTransmittedDataLC() );
+                                         
+    ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_DATA_RECEIVED,
+                                         ToStringReceivedDataLC() );
+
+    ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_DATA_SENT,
+                                         ToStringSentDataLC() );
+    
+    ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_DURATION,
+                                         ToStringDurationLC() );
+        
+    ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_SPEED,
+                                         ToStringTransferSpeedDownLC() );
+
+    ToDetailsListBoxItemTextWithAppendL( 0, 
+                                         ToStringTransferSpeedUpLC() );
+                
+                                         
+    CleanupStack::PopAndDestroy
+        (
+        KDetailsArrayMaxGranularityCCX - 1, 
+        temp );
+                                 
+    TInt sharing = RefreshAppNamesL();
+
+    if ( sharing > 1 )
+        {
+        for ( TInt i = 0; i < sharing; i++ )
+            {
+            if ( i == 0 )
+                {
+                ToDetailsListBoxItemTextWithAppendL( 
+                                    R_QTN_CMON_HEADING_SHARING_INFO,
+                                    ToStringAppNameLC( i ) );
+                }
+            else
+                {
+                ToDetailsListBoxItemTextWithAppendL( 0, 
+                                                ToStringAppNameLC( i ) );
+                }
+            }
+        CleanupStack::PopAndDestroy( sharing ); // ToStringAppNameLC()
+        }
+    
+    CMUILOGGER_LEAVEFN( "void CWlanConnectionInfo::ToArrayDetailsL()" );
+    }
+
+// ---------------------------------------------------------
+// CWlanConnectionInfo::RefreshDetailsArrayL
+// ---------------------------------------------------------
+//
+void CWlanConnectionInfo::RefreshDetailsArrayL()
+    {
+    CMUILOGGER_ENTERFN( "void CWlanConnectionInfo::RefreshDetailsArrayL()" );
+
+    HBufC* temp = NULL;
+
+    temp = ToStringStatusLC();
+
+    ToDetailsListBoxItemTextWithReplaceL
+        (
+        R_QTN_CMON_HEADING_STATUS,
+        temp,
+        2
+        );
+
+    ToDetailsListBoxItemTextWithReplaceL
+        (
+        R_QTN_CMON_HEADING_WLAN_SIGNAL_STRENGTH,
+        ToStringSignalStrengthLC(),
+        4
+        );
+                                          
+    ToDetailsListBoxItemTextWithReplaceL
+        (
+        R_QTN_CMON_HEADING_WLAN_TX_POWER,
+        ToStringTxPowerLC(),
+        7
+        );
+        
+    ToDetailsListBoxItemTextWithReplaceL( R_QTN_CMON_HEADING_DATA_TOTAL,
+                                          ToStringTotalTransmittedDataLC(),
+                                          8 );
+        
+
+    ToDetailsListBoxItemTextWithReplaceL( R_QTN_CMON_HEADING_DATA_RECEIVED,
+                                          ToStringReceivedDataLC(), 
+                                          9 );
+
+    ToDetailsListBoxItemTextWithReplaceL( R_QTN_CMON_HEADING_DATA_SENT,
+                                          ToStringSentDataLC(), 
+                                          10 );
+    
+    ToDetailsListBoxItemTextWithReplaceL( R_QTN_CMON_HEADING_DURATION,
+                                          ToStringDurationLC(), 
+                                          11 );
+        
+    ToDetailsListBoxItemTextWithReplaceL( R_QTN_CMON_HEADING_SPEED,
+                                          ToStringTransferSpeedDownLC(), 
+                                          12 );
+
+    ToDetailsListBoxItemTextWithReplaceL( 0, 
+                                          ToStringTransferSpeedUpLC(), 
+                                          13 );
+                                          
+    CleanupStack::PopAndDestroy( 9, temp );
+    
+
+    TInt count = iDetailsArray->Count();
+    TInt realElementsMaxCount = KDetailsArrayMaxGranularityCCX;
+    
+    CMUILOGGER_WRITE_F( "count : %d", count );
+    CMUILOGGER_WRITE_F( "realElementsMaxCount : %d", realElementsMaxCount );
+    
+    TInt sharing = RefreshAppNamesL();
+
+    if ( sharing > 1 )
+        {
+        if ( count >= realElementsMaxCount ) // 15
+            {  
+            iDetailsArray->Delete( realElementsMaxCount - 1,
+                                   iDetailsArray->Count() - 14 );
+            iDetailsArray->Compress(); 
+            }
+        
+        for ( TInt i = 0; i < sharing; i++ )
+            {
+            if ( i == 0 )
+                {
+                ToDetailsListBoxItemTextWithAppendL( 
+                                        R_QTN_CMON_HEADING_SHARING_INFO,
+                                        ToStringAppNameLC( i ) );
+                }
+            else
+                {
+                ToDetailsListBoxItemTextWithAppendL( 0, 
+                                        ToStringAppNameLC( i ) );
+                }
+            }
+        CleanupStack::PopAndDestroy( sharing ); // ToStringAppNameLC()
+        }
+    else
+        {
+        if ( count >= realElementsMaxCount )
+            {
+            iDetailsArray->Delete( realElementsMaxCount - 1,
+                                   iDetailsArray->Count() - 14 );
+            iDetailsArray->Compress();              
+            }
+        }               
+    
+    CMUILOGGER_LEAVEFN( "void CWlanConnectionInfo::RefreshDetailsArrayL()" );
+    }
+
+
+// ---------------------------------------------------------
+// CWlanConnectionInfo::RefreshConnectionListBoxItemTextL
+// ---------------------------------------------------------
+//
+void CWlanConnectionInfo::RefreshConnectionListBoxItemTextL()
+    {
+    CMUILOGGER_ENTERFN( 
+    "void CWlanConnectionInfo::RefreshConnectionListBoxItemTextL()" ); 
+    
+    TUint  iconId;
+    HBufC* secondRow = NULL;
+    
+    iconId = GetIconId();
+
+    if ( iConnectionStatus == EConnectionCreated )
+        {
+        secondRow =  ToStringDurationLC();          
+        }
+    else // if connection has not created yet gives back the status of itself.
+        {
+        secondRow = ToStringStatusLC( EFalse );
+        }
+
+    iListBoxItemText.Format( KConnectonListItemTextFormat, iconId, 
+                             &iConnectionName, secondRow );
+    CleanupStack::PopAndDestroy( secondRow );
+    
+    CMUILOGGER_LEAVEFN( 
+    "void CWlanConnectionInfo::RefreshConnectionListBoxItemTextL()" );    
+    }
+
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/BMARM/CONNMONU.DEF	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,48 @@
+EXPORTS
+	UplinkData__C27CConnMonUplinkDataThreshold @ 1 NONAME R3UNUSED ; CConnMonUplinkDataThreshold::UplinkData(void) const
+	AuthoritativeDelete__C27CConnMonDeleteSubConnection @ 2 NONAME R3UNUSED ; CConnMonDeleteSubConnection::AuthoritativeDelete(void) const
+	CancelAsyncRequest__18RConnectionMonitori @ 3 NONAME R3UNUSED ; RConnectionMonitor::CancelAsyncRequest(int)
+	CancelNotifications__18RConnectionMonitor @ 4 NONAME R3UNUSED ; RConnectionMonitor::CancelNotifications(void)
+	Close__18RConnectionMonitor @ 5 NONAME R3UNUSED ; RConnectionMonitor::Close(void)
+	ConnectL__18RConnectionMonitor @ 6 NONAME R3UNUSED ; RConnectionMonitor::ConnectL(void)
+	ConnectionActivity__C32CConnMonConnectionActivityChange @ 7 NONAME R3UNUSED ; CConnMonConnectionActivityChange::ConnectionActivity(void) const
+	ConnectionId__C17CConnMonEventBase @ 8 NONAME R3UNUSED ; CConnMonEventBase::ConnectionId(void) const
+	ConnectionStatus__C30CConnMonConnectionStatusChange @ 9 NONAME R3UNUSED ; CConnMonConnectionStatusChange::ConnectionStatus(void) const
+	DownlinkData__C24CConnMonDeleteConnection @ 10 NONAME R3UNUSED ; CConnMonDeleteConnection::DownlinkData(void) const
+	DownlinkData__C27CConnMonDeleteSubConnection @ 11 NONAME R3UNUSED ; CConnMonDeleteSubConnection::DownlinkData(void) const
+	DownlinkData__C29CConnMonDownlinkDataThreshold @ 12 NONAME R3UNUSED ; CConnMonDownlinkDataThreshold::DownlinkData(void) const
+	E32Dll__F10TDllReason @ 13 NONAME R3UNUSED ; E32Dll(TDllReason)
+	EventType__C17CConnMonEventBase @ 14 NONAME R3UNUSED ; CConnMonEventBase::EventType(void) const
+	GetBoolAttribute__18RConnectionMonitorUiUiUiRiR14TRequestStatus @ 15 NONAME ; RConnectionMonitor::GetBoolAttribute(unsigned int, unsigned int, unsigned int, int &, TRequestStatus &)
+	GetConnectionCount__18RConnectionMonitorRUiR14TRequestStatus @ 16 NONAME R3UNUSED ; RConnectionMonitor::GetConnectionCount(unsigned int &, TRequestStatus &)
+	GetConnectionInfo__C18RConnectionMonitorUiRUiT2 @ 17 NONAME ; RConnectionMonitor::GetConnectionInfo(unsigned int, unsigned int &, unsigned int &) const
+	GetIntAttribute__18RConnectionMonitorUiUiUiRiR14TRequestStatus @ 18 NONAME ; RConnectionMonitor::GetIntAttribute(unsigned int, unsigned int, unsigned int, int &, TRequestStatus &)
+	GetPckgAttribute__C18RConnectionMonitorUiUiUiR5TDes8R14TRequestStatus @ 19 NONAME ; RConnectionMonitor::GetPckgAttribute(unsigned int, unsigned int, unsigned int, TDes8 &, TRequestStatus &) const
+	GetStringAttribute__C18RConnectionMonitorUiUiUiR6TDes16R14TRequestStatus @ 20 NONAME ; RConnectionMonitor::GetStringAttribute(unsigned int, unsigned int, unsigned int, TDes16 &, TRequestStatus &) const
+	GetSubConnectionInfo__C18RConnectionMonitorUiUiRUi @ 21 NONAME ; RConnectionMonitor::GetSubConnectionInfo(unsigned int, unsigned int, unsigned int &) const
+	GetUintAttribute__18RConnectionMonitorUiUiUiRUiR14TRequestStatus @ 22 NONAME ; RConnectionMonitor::GetUintAttribute(unsigned int, unsigned int, unsigned int, unsigned int &, TRequestStatus &)
+	NetworkStatus__C27CConnMonNetworkStatusChange @ 23 NONAME R3UNUSED ; CConnMonNetworkStatusChange::NetworkStatus(void) const
+	NotifyEventL__18RConnectionMonitorR26MConnectionMonitorObserver @ 24 NONAME R3UNUSED ; RConnectionMonitor::NotifyEventL(MConnectionMonitorObserver &)
+	SetBoolAttribute__C18RConnectionMonitorUiUiUii @ 25 NONAME ; RConnectionMonitor::SetBoolAttribute(unsigned int, unsigned int, unsigned int, int) const
+	SetIntAttribute__C18RConnectionMonitorUiUiUii @ 26 NONAME ; RConnectionMonitor::SetIntAttribute(unsigned int, unsigned int, unsigned int, int) const
+	SetPckgAttribute__C18RConnectionMonitorUiUiUiRC5TDes8 @ 27 NONAME ; RConnectionMonitor::SetPckgAttribute(unsigned int, unsigned int, unsigned int, TDes8 const &) const
+	SetStringAttribute__C18RConnectionMonitorUiUiUiRC6TDes16 @ 28 NONAME ; RConnectionMonitor::SetStringAttribute(unsigned int, unsigned int, unsigned int, TDes16 const &) const
+	SetUintAttribute__C18RConnectionMonitorUiUiUiUi @ 29 NONAME ; RConnectionMonitor::SetUintAttribute(unsigned int, unsigned int, unsigned int, unsigned int) const
+	SubConnectionId__C27CConnMonCreateSubConnection @ 30 NONAME R3UNUSED ; CConnMonCreateSubConnection::SubConnectionId(void) const
+	SubConnectionId__C27CConnMonDeleteSubConnection @ 31 NONAME R3UNUSED ; CConnMonDeleteSubConnection::SubConnectionId(void) const
+	SubConnectionId__C27CConnMonUplinkDataThreshold @ 32 NONAME R3UNUSED ; CConnMonUplinkDataThreshold::SubConnectionId(void) const
+	SubConnectionId__C29CConnMonDownlinkDataThreshold @ 33 NONAME R3UNUSED ; CConnMonDownlinkDataThreshold::SubConnectionId(void) const
+	SubConnectionId__C30CConnMonConnectionStatusChange @ 34 NONAME R3UNUSED ; CConnMonConnectionStatusChange::SubConnectionId(void) const
+	SubConnectionId__C32CConnMonConnectionActivityChange @ 35 NONAME R3UNUSED ; CConnMonConnectionActivityChange::SubConnectionId(void) const
+	ThreadStart__17CConnMonSchedulerRQ217CConnMonScheduler7TSignal @ 36 NONAME R3UNUSED ; CConnMonScheduler::ThreadStart(CConnMonScheduler::TSignal &)
+	UplinkData__C24CConnMonDeleteConnection @ 37 NONAME R3UNUSED ; CConnMonDeleteConnection::UplinkData(void) const
+	UplinkData__C27CConnMonDeleteSubConnection @ 38 NONAME R3UNUSED ; CConnMonDeleteSubConnection::UplinkData(void) const
+	AuthoritativeDelete__C24CConnMonDeleteConnection @ 39 NONAME R3UNUSED ; CConnMonDeleteConnection::AuthoritativeDelete(void) const
+	RegistrationStatus__C33CConnMonNetworkRegistrationChange @ 40 NONAME R3UNUSED ; CConnMonNetworkRegistrationChange::RegistrationStatus(void) const
+	Bearer__C20CConnMonBearerChange @ 41 NONAME R3UNUSED ; CConnMonBearerChange::Bearer(void) const
+	SignalStrength__C28CConnMonSignalStrengthChange @ 42 NONAME R3UNUSED ; CConnMonSignalStrengthChange::SignalStrength(void) const
+	Availability__C32CConnMonBearerAvailabilityChange @ 43 NONAME R3UNUSED ; CConnMonBearerAvailabilityChange::Availability(void) const
+	Data__C20CConnMonGenericEvent @ 44 NONAME R3UNUSED ; CConnMonGenericEvent::Data(void) const
+	IapAvailability__C29CConnMonIapAvailabilityChange @ 45 NONAME R3UNUSED ; CConnMonIapAvailabilityChange::IapAvailability(void) const
+	TransmitPower__C27CConnMonTransmitPowerChange @ 46 NONAME R3UNUSED ; CConnMonTransmitPowerChange::TransmitPower(void) const
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/BMARM/CONNMON_EKA2U.def	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,129 @@
+EXPORTS
+	_ZN17CConnMonScheduler11ThreadStartERNS_7TSignalE @ 1 NONAME
+	_ZN18RConnectionMonitor12NotifyEventLER26MConnectionMonitorObserver @ 2 NONAME
+	_ZN18RConnectionMonitor15GetIntAttributeEjjjRiR14TRequestStatus @ 3 NONAME
+	_ZN18RConnectionMonitor16GetBoolAttributeEjjjRiR14TRequestStatus @ 4 NONAME
+	_ZN18RConnectionMonitor16GetUintAttributeEjjjRjR14TRequestStatus @ 5 NONAME
+	_ZN18RConnectionMonitor18CancelAsyncRequestEi @ 6 NONAME
+	_ZN18RConnectionMonitor18GetConnectionCountERjR14TRequestStatus @ 7 NONAME
+	_ZN18RConnectionMonitor19CancelNotificationsEv @ 8 NONAME
+	_ZN18RConnectionMonitor5CloseEv @ 9 NONAME
+	_ZN18RConnectionMonitor8ConnectLEv @ 10 NONAME
+	_ZNK17CConnMonEventBase12ConnectionIdEv @ 11 NONAME
+	_ZNK17CConnMonEventBase9EventTypeEv @ 12 NONAME
+	_ZNK18RConnectionMonitor15SetIntAttributeEjjji @ 13 NONAME
+	_ZNK18RConnectionMonitor16GetPckgAttributeEjjjR5TDes8R14TRequestStatus @ 14 NONAME
+	_ZNK18RConnectionMonitor16SetBoolAttributeEjjji @ 15 NONAME
+	_ZNK18RConnectionMonitor16SetPckgAttributeEjjjRK5TDes8 @ 16 NONAME
+	_ZNK18RConnectionMonitor16SetUintAttributeEjjjj @ 17 NONAME
+	_ZNK18RConnectionMonitor17GetConnectionInfoEjRjS0_ @ 18 NONAME
+	_ZNK18RConnectionMonitor18GetStringAttributeEjjjR6TDes16R14TRequestStatus @ 19 NONAME
+	_ZNK18RConnectionMonitor18SetStringAttributeEjjjRK6TDes16 @ 20 NONAME
+	_ZNK18RConnectionMonitor20GetSubConnectionInfoEjjRj @ 21 NONAME
+	_ZNK20CConnMonBearerChange6BearerEv @ 22 NONAME
+	_ZNK20CConnMonGenericEvent4DataEv @ 23 NONAME
+	_ZNK24CConnMonDeleteConnection10UplinkDataEv @ 24 NONAME
+	_ZNK24CConnMonDeleteConnection12DownlinkDataEv @ 25 NONAME
+	_ZNK24CConnMonDeleteConnection19AuthoritativeDeleteEv @ 26 NONAME
+	_ZNK27CConnMonCreateSubConnection15SubConnectionIdEv @ 27 NONAME
+	_ZNK27CConnMonDeleteSubConnection10UplinkDataEv @ 28 NONAME
+	_ZNK27CConnMonDeleteSubConnection12DownlinkDataEv @ 29 NONAME
+	_ZNK27CConnMonDeleteSubConnection15SubConnectionIdEv @ 30 NONAME
+	_ZNK27CConnMonDeleteSubConnection19AuthoritativeDeleteEv @ 31 NONAME
+	_ZNK27CConnMonNetworkStatusChange13NetworkStatusEv @ 32 NONAME
+	_ZNK27CConnMonUplinkDataThreshold10UplinkDataEv @ 33 NONAME
+	_ZNK27CConnMonUplinkDataThreshold15SubConnectionIdEv @ 34 NONAME
+	_ZNK28CConnMonSignalStrengthChange14SignalStrengthEv @ 35 NONAME
+	_ZNK29CConnMonDownlinkDataThreshold12DownlinkDataEv @ 36 NONAME
+	_ZNK29CConnMonDownlinkDataThreshold15SubConnectionIdEv @ 37 NONAME
+	_ZNK30CConnMonConnectionStatusChange15SubConnectionIdEv @ 38 NONAME
+	_ZNK30CConnMonConnectionStatusChange16ConnectionStatusEv @ 39 NONAME
+	_ZNK32CConnMonBearerAvailabilityChange12AvailabilityEv @ 40 NONAME
+	_ZNK32CConnMonConnectionActivityChange15SubConnectionIdEv @ 41 NONAME
+	_ZNK32CConnMonConnectionActivityChange18ConnectionActivityEv @ 42 NONAME
+	_ZNK33CConnMonNetworkRegistrationChange18RegistrationStatusEv @ 43 NONAME
+	_ZTI11CConnMonIAP @ 44 NONAME ; #<TI>#
+	_ZTI11CDataVolume @ 45 NONAME ; #<TI>#
+	_ZTI11CEventQueue @ 46 NONAME ; #<TI>#
+	_ZTI13CDataNotifier @ 47 NONAME ; #<TI>#
+	_ZTI13CModeNotifier @ 48 NONAME ; #<TI>#
+	_ZTI14CConnMonServer @ 49 NONAME ; #<TI>#
+	_ZTI15CBearerNotifier @ 50 NONAME ; #<TI>#
+	_ZTI15CConnMonSession @ 51 NONAME ; #<TI>#
+	_ZTI17CActivityNotifier @ 52 NONAME ; #<TI>#
+	_ZTI17CConnMonEventBase @ 53 NONAME ; #<TI>#
+	_ZTI17CConnMonScheduler @ 54 NONAME ; #<TI>#
+	_ZTI17CCsdFaxUpNotifier @ 55 NONAME ; #<TI>#
+	_ZTI17CProgressNotifier @ 56 NONAME ; #<TI>#
+	_ZTI17CPsdFaxUpNotifier @ 57 NONAME ; #<TI>#
+	_ZTI18CCsdStatusNotifier @ 58 NONAME ; #<TI>#
+	_ZTI18CGsmSignalNotifier @ 59 NONAME ; #<TI>#
+	_ZTI18CPsdStatusNotifier @ 60 NONAME ; #<TI>#
+	_ZTI19CConnUpDownNotifier @ 61 NONAME ; #<TI>#
+	_ZTI19CNetwStatusNotifier @ 62 NONAME ; #<TI>#
+	_ZTI20CConnMonBearerChange @ 63 NONAME ; #<TI>#
+	_ZTI20CConnMonEventHandler @ 64 NONAME ; #<TI>#
+	_ZTI20CConnMonGenericEvent @ 65 NONAME ; #<TI>#
+	_ZTI22CSubConnUpDownNotifier @ 66 NONAME ; #<TI>#
+	_ZTI23CConnMonDelayedShutdown @ 67 NONAME ; #<TI>#
+	_ZTI24CConnMonCreateConnection @ 68 NONAME ; #<TI>#
+	_ZTI24CConnMonDeleteConnection @ 69 NONAME ; #<TI>#
+	_ZTI25CNetwRegistrationNotifier @ 70 NONAME ; #<TI>#
+	_ZTI27CBearerAvailabilityNotifier @ 71 NONAME ; #<TI>#
+	_ZTI27CConnMonCreateSubConnection @ 72 NONAME ; #<TI>#
+	_ZTI27CConnMonDeleteSubConnection @ 73 NONAME ; #<TI>#
+	_ZTI27CConnMonNetworkStatusChange @ 74 NONAME ; #<TI>#
+	_ZTI27CConnMonUplinkDataThreshold @ 75 NONAME ; #<TI>#
+	_ZTI28CConnMonSignalStrengthChange @ 76 NONAME ; #<TI>#
+	_ZTI29CConnMonDownlinkDataThreshold @ 77 NONAME ; #<TI>#
+	_ZTI30CConnMonConnectionStatusChange @ 78 NONAME ; #<TI>#
+	_ZTI32CConnMonBearerAvailabilityChange @ 79 NONAME ; #<TI>#
+	_ZTI32CConnMonConnectionActivityChange @ 80 NONAME ; #<TI>#
+	_ZTI33CConnMonNetworkRegistrationChange @ 81 NONAME ; #<TI>#
+	_ZTI7CCsdFax @ 82 NONAME ; #<TI>#
+	_ZTI7CPlugin @ 83 NONAME ; #<TI>#
+	_ZTI7CPsdFax @ 84 NONAME ; #<TI>#
+	_ZTI8CTimerAO @ 85 NONAME ; #<TI>#
+	_ZTV11CConnMonIAP @ 86 NONAME ; #<VT>#
+	_ZTV11CDataVolume @ 87 NONAME ; #<VT>#
+	_ZTV11CEventQueue @ 88 NONAME ; #<VT>#
+	_ZTV13CDataNotifier @ 89 NONAME ; #<VT>#
+	_ZTV13CModeNotifier @ 90 NONAME ; #<VT>#
+	_ZTV14CConnMonServer @ 91 NONAME ; #<VT>#
+	_ZTV15CBearerNotifier @ 92 NONAME ; #<VT>#
+	_ZTV15CConnMonSession @ 93 NONAME ; #<VT>#
+	_ZTV17CActivityNotifier @ 94 NONAME ; #<VT>#
+	_ZTV17CConnMonEventBase @ 95 NONAME ; #<VT>#
+	_ZTV17CConnMonScheduler @ 96 NONAME ; #<VT>#
+	_ZTV17CCsdFaxUpNotifier @ 97 NONAME ; #<VT>#
+	_ZTV17CProgressNotifier @ 98 NONAME ; #<VT>#
+	_ZTV17CPsdFaxUpNotifier @ 99 NONAME ; #<VT>#
+	_ZTV18CCsdStatusNotifier @ 100 NONAME ; #<VT>#
+	_ZTV18CGsmSignalNotifier @ 101 NONAME ; #<VT>#
+	_ZTV18CPsdStatusNotifier @ 102 NONAME ; #<VT>#
+	_ZTV19CConnUpDownNotifier @ 103 NONAME ; #<VT>#
+	_ZTV19CNetwStatusNotifier @ 104 NONAME ; #<VT>#
+	_ZTV20CConnMonBearerChange @ 105 NONAME ; #<VT>#
+	_ZTV20CConnMonEventHandler @ 106 NONAME ; #<VT>#
+	_ZTV20CConnMonGenericEvent @ 107 NONAME ; #<VT>#
+	_ZTV22CSubConnUpDownNotifier @ 108 NONAME ; #<VT>#
+	_ZTV23CConnMonDelayedShutdown @ 109 NONAME ; #<VT>#
+	_ZTV24CConnMonCreateConnection @ 110 NONAME ; #<VT>#
+	_ZTV24CConnMonDeleteConnection @ 111 NONAME ; #<VT>#
+	_ZTV25CNetwRegistrationNotifier @ 112 NONAME ; #<VT>#
+	_ZTV27CBearerAvailabilityNotifier @ 113 NONAME ; #<VT>#
+	_ZTV27CConnMonCreateSubConnection @ 114 NONAME ; #<VT>#
+	_ZTV27CConnMonDeleteSubConnection @ 115 NONAME ; #<VT>#
+	_ZTV27CConnMonNetworkStatusChange @ 116 NONAME ; #<VT>#
+	_ZTV27CConnMonUplinkDataThreshold @ 117 NONAME ; #<VT>#
+	_ZTV28CConnMonSignalStrengthChange @ 118 NONAME ; #<VT>#
+	_ZTV29CConnMonDownlinkDataThreshold @ 119 NONAME ; #<VT>#
+	_ZTV30CConnMonConnectionStatusChange @ 120 NONAME ; #<VT>#
+	_ZTV32CConnMonBearerAvailabilityChange @ 121 NONAME ; #<VT>#
+	_ZTV32CConnMonConnectionActivityChange @ 122 NONAME ; #<VT>#
+	_ZTV33CConnMonNetworkRegistrationChange @ 123 NONAME ; #<VT>#
+	_ZTV7CCsdFax @ 124 NONAME ; #<VT>#
+	_ZTV7CPlugin @ 125 NONAME ; #<VT>#
+	_ZTV7CPsdFax @ 126 NONAME ; #<VT>#
+	_ZTV8CTimerAO @ 127 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/BWINS/CONNMONU.DEF	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,48 @@
+EXPORTS
+	?AuthoritativeDelete@CConnMonDeleteConnection@@QBEHXZ @ 1 NONAME ; public: int __thiscall CConnMonDeleteConnection::AuthoritativeDelete(void)const 
+	?AuthoritativeDelete@CConnMonDeleteSubConnection@@QBEHXZ @ 2 NONAME ; public: int __thiscall CConnMonDeleteSubConnection::AuthoritativeDelete(void)const 
+	?CancelAsyncRequest@RConnectionMonitor@@QAEXH@Z @ 3 NONAME ; public: void __thiscall RConnectionMonitor::CancelAsyncRequest(int)
+	?CancelNotifications@RConnectionMonitor@@QAEXXZ @ 4 NONAME ; public: void __thiscall RConnectionMonitor::CancelNotifications(void)
+	?Close@RConnectionMonitor@@QAEXXZ @ 5 NONAME ; public: void __thiscall RConnectionMonitor::Close(void)
+	?ConnectL@RConnectionMonitor@@QAEHXZ @ 6 NONAME ; public: int __thiscall RConnectionMonitor::ConnectL(void)
+	?ConnectionActivity@CConnMonConnectionActivityChange@@QBEHXZ @ 7 NONAME ; public: int __thiscall CConnMonConnectionActivityChange::ConnectionActivity(void)const 
+	?ConnectionId@CConnMonEventBase@@QBEIXZ @ 8 NONAME ; public: unsigned int __thiscall CConnMonEventBase::ConnectionId(void)const 
+	?ConnectionStatus@CConnMonConnectionStatusChange@@QBEHXZ @ 9 NONAME ; public: int __thiscall CConnMonConnectionStatusChange::ConnectionStatus(void)const 
+	?DownlinkData@CConnMonDeleteConnection@@QBEIXZ @ 10 NONAME ; public: unsigned int __thiscall CConnMonDeleteConnection::DownlinkData(void)const 
+	?DownlinkData@CConnMonDeleteSubConnection@@QBEIXZ @ 11 NONAME ; public: unsigned int __thiscall CConnMonDeleteSubConnection::DownlinkData(void)const 
+	?DownlinkData@CConnMonDownlinkDataThreshold@@QBEIXZ @ 12 NONAME ; public: unsigned int __thiscall CConnMonDownlinkDataThreshold::DownlinkData(void)const 
+	?E32Dll@@YAHW4TDllReason@@@Z @ 13 NONAME ; int __cdecl E32Dll(enum TDllReason)
+	?EventType@CConnMonEventBase@@QBEHXZ @ 14 NONAME ; public: int __thiscall CConnMonEventBase::EventType(void)const 
+	?GetBoolAttribute@RConnectionMonitor@@QAEXIIIAAHAAVTRequestStatus@@@Z @ 15 NONAME ; public: void __thiscall RConnectionMonitor::GetBoolAttribute(unsigned int,unsigned int,unsigned int,int &,class TRequestStatus &)
+	?GetConnectionCount@RConnectionMonitor@@QAEXAAIAAVTRequestStatus@@@Z @ 16 NONAME ; public: void __thiscall RConnectionMonitor::GetConnectionCount(unsigned int &,class TRequestStatus &)
+	?GetConnectionInfo@RConnectionMonitor@@QBEHIAAI0@Z @ 17 NONAME ; public: int __thiscall RConnectionMonitor::GetConnectionInfo(unsigned int,unsigned int &,unsigned int &)const 
+	?GetIntAttribute@RConnectionMonitor@@QAEXIIIAAHAAVTRequestStatus@@@Z @ 18 NONAME ; public: void __thiscall RConnectionMonitor::GetIntAttribute(unsigned int,unsigned int,unsigned int,int &,class TRequestStatus &)
+	?GetPckgAttribute@RConnectionMonitor@@QBEXIIIAAVTDes8@@AAVTRequestStatus@@@Z @ 19 NONAME ; public: void __thiscall RConnectionMonitor::GetPckgAttribute(unsigned int,unsigned int,unsigned int,class TDes8 &,class TRequestStatus &)const 
+	?GetStringAttribute@RConnectionMonitor@@QBEXIIIAAVTDes16@@AAVTRequestStatus@@@Z @ 20 NONAME ; public: void __thiscall RConnectionMonitor::GetStringAttribute(unsigned int,unsigned int,unsigned int,class TDes16 &,class TRequestStatus &)const 
+	?GetSubConnectionInfo@RConnectionMonitor@@QBEHIIAAI@Z @ 21 NONAME ; public: int __thiscall RConnectionMonitor::GetSubConnectionInfo(unsigned int,unsigned int,unsigned int &)const 
+	?GetUintAttribute@RConnectionMonitor@@QAEXIIIAAIAAVTRequestStatus@@@Z @ 22 NONAME ; public: void __thiscall RConnectionMonitor::GetUintAttribute(unsigned int,unsigned int,unsigned int,unsigned int &,class TRequestStatus &)
+	?NetworkStatus@CConnMonNetworkStatusChange@@QBEHXZ @ 23 NONAME ; public: int __thiscall CConnMonNetworkStatusChange::NetworkStatus(void)const 
+	?NotifyEventL@RConnectionMonitor@@QAEHAAVMConnectionMonitorObserver@@@Z @ 24 NONAME ; public: int __thiscall RConnectionMonitor::NotifyEventL(class MConnectionMonitorObserver &)
+	?SetBoolAttribute@RConnectionMonitor@@QBEHIIIH@Z @ 25 NONAME ; public: int __thiscall RConnectionMonitor::SetBoolAttribute(unsigned int,unsigned int,unsigned int,int)const 
+	?SetIntAttribute@RConnectionMonitor@@QBEHIIIH@Z @ 26 NONAME ; public: int __thiscall RConnectionMonitor::SetIntAttribute(unsigned int,unsigned int,unsigned int,int)const 
+	?SetPckgAttribute@RConnectionMonitor@@QBEHIIIABVTDes8@@@Z @ 27 NONAME ; public: int __thiscall RConnectionMonitor::SetPckgAttribute(unsigned int,unsigned int,unsigned int,class TDes8 const &)const 
+	?SetStringAttribute@RConnectionMonitor@@QBEHIIIABVTDes16@@@Z @ 28 NONAME ; public: int __thiscall RConnectionMonitor::SetStringAttribute(unsigned int,unsigned int,unsigned int,class TDes16 const &)const 
+	?SetUintAttribute@RConnectionMonitor@@QBEHIIII@Z @ 29 NONAME ; public: int __thiscall RConnectionMonitor::SetUintAttribute(unsigned int,unsigned int,unsigned int,unsigned int)const 
+	?SubConnectionId@CConnMonConnectionActivityChange@@QBEIXZ @ 30 NONAME ; public: unsigned int __thiscall CConnMonConnectionActivityChange::SubConnectionId(void)const 
+	?SubConnectionId@CConnMonConnectionStatusChange@@QBEIXZ @ 31 NONAME ; public: unsigned int __thiscall CConnMonConnectionStatusChange::SubConnectionId(void)const 
+	?SubConnectionId@CConnMonCreateSubConnection@@QBEIXZ @ 32 NONAME ; public: unsigned int __thiscall CConnMonCreateSubConnection::SubConnectionId(void)const 
+	?SubConnectionId@CConnMonDeleteSubConnection@@QBEIXZ @ 33 NONAME ; public: unsigned int __thiscall CConnMonDeleteSubConnection::SubConnectionId(void)const 
+	?SubConnectionId@CConnMonDownlinkDataThreshold@@QBEIXZ @ 34 NONAME ; public: unsigned int __thiscall CConnMonDownlinkDataThreshold::SubConnectionId(void)const 
+	?SubConnectionId@CConnMonUplinkDataThreshold@@QBEIXZ @ 35 NONAME ; public: unsigned int __thiscall CConnMonUplinkDataThreshold::SubConnectionId(void)const 
+	?ThreadStart@CConnMonScheduler@@SAHAAVTSignal@1@@Z @ 36 NONAME ; public: static int __cdecl CConnMonScheduler::ThreadStart(class CConnMonScheduler::TSignal &)
+	?UplinkData@CConnMonDeleteConnection@@QBEIXZ @ 37 NONAME ; public: unsigned int __thiscall CConnMonDeleteConnection::UplinkData(void)const 
+	?UplinkData@CConnMonDeleteSubConnection@@QBEIXZ @ 38 NONAME ; public: unsigned int __thiscall CConnMonDeleteSubConnection::UplinkData(void)const 
+	?UplinkData@CConnMonUplinkDataThreshold@@QBEIXZ @ 39 NONAME ; public: unsigned int __thiscall CConnMonUplinkDataThreshold::UplinkData(void)const 
+	?RegistrationStatus@CConnMonNetworkRegistrationChange@@QBEHXZ @ 40 NONAME ; public: int __thiscall CConnMonNetworkRegistrationChange::RegistrationStatus(void)const 
+	?Bearer@CConnMonBearerChange@@QBEHXZ @ 41 NONAME ; public: int __thiscall CConnMonBearerChange::Bearer(void)const 
+	?SignalStrength@CConnMonSignalStrengthChange@@QBEHXZ @ 42 NONAME ; public: int __thiscall CConnMonSignalStrengthChange::SignalStrength(void)const 
+	?Availability@CConnMonBearerAvailabilityChange@@QBEHXZ @ 43 NONAME ; public: int __thiscall CConnMonBearerAvailabilityChange::Availability(void)const 
+	?Data@CConnMonGenericEvent@@QBEPAXXZ @ 44 NONAME ; public: void * __thiscall CConnMonGenericEvent::Data(void)const 
+	?IapAvailability@CConnMonIapAvailabilityChange@@QBE?AVTConnMonIapInfo@@XZ @ 45 NONAME ; public: class TConnMonIapInfo  __thiscall CConnMonIapAvailabilityChange::IapAvailability(void)const 
+	?TransmitPower@CConnMonTransmitPowerChange@@QBEIXZ @ 46 NONAME ; public: unsigned int __thiscall CConnMonTransmitPowerChange::TransmitPower(void)const 
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/BWINSCW/CONNMONU.DEF	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,48 @@
+EXPORTS
+	?AuthoritativeDelete@CConnMonDeleteConnection@@QBEHXZ @ 1 NONAME ; public: int __thiscall CConnMonDeleteConnection::AuthoritativeDelete(void)const 
+	?AuthoritativeDelete@CConnMonDeleteSubConnection@@QBEHXZ @ 2 NONAME ; public: int __thiscall CConnMonDeleteSubConnection::AuthoritativeDelete(void)const 
+	?CancelAsyncRequest@RConnectionMonitor@@QAEXH@Z @ 3 NONAME ; public: void __thiscall RConnectionMonitor::CancelAsyncRequest(int)
+	?CancelNotifications@RConnectionMonitor@@QAEXXZ @ 4 NONAME ; public: void __thiscall RConnectionMonitor::CancelNotifications(void)
+	?Close@RConnectionMonitor@@QAEXXZ @ 5 NONAME ; public: void __thiscall RConnectionMonitor::Close(void)
+	?ConnectL@RConnectionMonitor@@QAEHXZ @ 6 NONAME ; public: int __thiscall RConnectionMonitor::ConnectL(void)
+	?ConnectionActivity@CConnMonConnectionActivityChange@@QBEHXZ @ 7 NONAME ; public: int __thiscall CConnMonConnectionActivityChange::ConnectionActivity(void)const 
+	?ConnectionId@CConnMonEventBase@@QBEIXZ @ 8 NONAME ; public: unsigned int __thiscall CConnMonEventBase::ConnectionId(void)const 
+	?ConnectionStatus@CConnMonConnectionStatusChange@@QBEHXZ @ 9 NONAME ; public: int __thiscall CConnMonConnectionStatusChange::ConnectionStatus(void)const 
+	?DownlinkData@CConnMonDeleteConnection@@QBEIXZ @ 10 NONAME ; public: unsigned int __thiscall CConnMonDeleteConnection::DownlinkData(void)const 
+	?DownlinkData@CConnMonDeleteSubConnection@@QBEIXZ @ 11 NONAME ; public: unsigned int __thiscall CConnMonDeleteSubConnection::DownlinkData(void)const 
+	?DownlinkData@CConnMonDownlinkDataThreshold@@QBEIXZ @ 12 NONAME ; public: unsigned int __thiscall CConnMonDownlinkDataThreshold::DownlinkData(void)const 
+	?E32Dll@@YAHW4TDllReason@@@Z @ 13 NONAME ; int __cdecl E32Dll(enum TDllReason)
+	?EventType@CConnMonEventBase@@QBEHXZ @ 14 NONAME ; public: int __thiscall CConnMonEventBase::EventType(void)const 
+	?GetBoolAttribute@RConnectionMonitor@@QAEXIIIAAHAAVTRequestStatus@@@Z @ 15 NONAME ; public: void __thiscall RConnectionMonitor::GetBoolAttribute(unsigned int,unsigned int,unsigned int,int &,class TRequestStatus &)
+	?GetConnectionCount@RConnectionMonitor@@QAEXAAIAAVTRequestStatus@@@Z @ 16 NONAME ; public: void __thiscall RConnectionMonitor::GetConnectionCount(unsigned int &,class TRequestStatus &)
+	?GetConnectionInfo@RConnectionMonitor@@QBEHIAAI0@Z @ 17 NONAME ; public: int __thiscall RConnectionMonitor::GetConnectionInfo(unsigned int,unsigned int &,unsigned int &)const 
+	?GetIntAttribute@RConnectionMonitor@@QAEXIIIAAHAAVTRequestStatus@@@Z @ 18 NONAME ; public: void __thiscall RConnectionMonitor::GetIntAttribute(unsigned int,unsigned int,unsigned int,int &,class TRequestStatus &)
+	?GetPckgAttribute@RConnectionMonitor@@QBEXIIIAAVTDes8@@AAVTRequestStatus@@@Z @ 19 NONAME ; public: void __thiscall RConnectionMonitor::GetPckgAttribute(unsigned int,unsigned int,unsigned int,class TDes8 &,class TRequestStatus &)const 
+	?GetStringAttribute@RConnectionMonitor@@QBEXIIIAAVTDes16@@AAVTRequestStatus@@@Z @ 20 NONAME ; public: void __thiscall RConnectionMonitor::GetStringAttribute(unsigned int,unsigned int,unsigned int,class TDes16 &,class TRequestStatus &)const 
+	?GetSubConnectionInfo@RConnectionMonitor@@QBEHIIAAI@Z @ 21 NONAME ; public: int __thiscall RConnectionMonitor::GetSubConnectionInfo(unsigned int,unsigned int,unsigned int &)const 
+	?GetUintAttribute@RConnectionMonitor@@QAEXIIIAAIAAVTRequestStatus@@@Z @ 22 NONAME ; public: void __thiscall RConnectionMonitor::GetUintAttribute(unsigned int,unsigned int,unsigned int,unsigned int &,class TRequestStatus &)
+	?NetworkStatus@CConnMonNetworkStatusChange@@QBEHXZ @ 23 NONAME ; public: int __thiscall CConnMonNetworkStatusChange::NetworkStatus(void)const 
+	?NotifyEventL@RConnectionMonitor@@QAEHAAVMConnectionMonitorObserver@@@Z @ 24 NONAME ; public: int __thiscall RConnectionMonitor::NotifyEventL(class MConnectionMonitorObserver &)
+	?SetBoolAttribute@RConnectionMonitor@@QBEHIIIH@Z @ 25 NONAME ; public: int __thiscall RConnectionMonitor::SetBoolAttribute(unsigned int,unsigned int,unsigned int,int)const 
+	?SetIntAttribute@RConnectionMonitor@@QBEHIIIH@Z @ 26 NONAME ; public: int __thiscall RConnectionMonitor::SetIntAttribute(unsigned int,unsigned int,unsigned int,int)const 
+	?SetPckgAttribute@RConnectionMonitor@@QBEHIIIABVTDes8@@@Z @ 27 NONAME ; public: int __thiscall RConnectionMonitor::SetPckgAttribute(unsigned int,unsigned int,unsigned int,class TDes8 const &)const 
+	?SetStringAttribute@RConnectionMonitor@@QBEHIIIABVTDes16@@@Z @ 28 NONAME ; public: int __thiscall RConnectionMonitor::SetStringAttribute(unsigned int,unsigned int,unsigned int,class TDes16 const &)const 
+	?SetUintAttribute@RConnectionMonitor@@QBEHIIII@Z @ 29 NONAME ; public: int __thiscall RConnectionMonitor::SetUintAttribute(unsigned int,unsigned int,unsigned int,unsigned int)const 
+	?SubConnectionId@CConnMonConnectionActivityChange@@QBEIXZ @ 30 NONAME ; public: unsigned int __thiscall CConnMonConnectionActivityChange::SubConnectionId(void)const 
+	?SubConnectionId@CConnMonConnectionStatusChange@@QBEIXZ @ 31 NONAME ; public: unsigned int __thiscall CConnMonConnectionStatusChange::SubConnectionId(void)const 
+	?SubConnectionId@CConnMonCreateSubConnection@@QBEIXZ @ 32 NONAME ; public: unsigned int __thiscall CConnMonCreateSubConnection::SubConnectionId(void)const 
+	?SubConnectionId@CConnMonDeleteSubConnection@@QBEIXZ @ 33 NONAME ; public: unsigned int __thiscall CConnMonDeleteSubConnection::SubConnectionId(void)const 
+	?SubConnectionId@CConnMonDownlinkDataThreshold@@QBEIXZ @ 34 NONAME ; public: unsigned int __thiscall CConnMonDownlinkDataThreshold::SubConnectionId(void)const 
+	?SubConnectionId@CConnMonUplinkDataThreshold@@QBEIXZ @ 35 NONAME ; public: unsigned int __thiscall CConnMonUplinkDataThreshold::SubConnectionId(void)const 
+	?ThreadStart@CConnMonScheduler@@SAHAAVTSignal@1@@Z @ 36 NONAME ; public: static int __cdecl CConnMonScheduler::ThreadStart(class CConnMonScheduler::TSignal &)
+	?UplinkData@CConnMonDeleteConnection@@QBEIXZ @ 37 NONAME ; public: unsigned int __thiscall CConnMonDeleteConnection::UplinkData(void)const 
+	?UplinkData@CConnMonDeleteSubConnection@@QBEIXZ @ 38 NONAME ; public: unsigned int __thiscall CConnMonDeleteSubConnection::UplinkData(void)const 
+	?UplinkData@CConnMonUplinkDataThreshold@@QBEIXZ @ 39 NONAME ; public: unsigned int __thiscall CConnMonUplinkDataThreshold::UplinkData(void)const 
+	?RegistrationStatus@CConnMonNetworkRegistrationChange@@QBEHXZ @ 40 NONAME ; public: int __thiscall CConnMonNetworkRegistrationChange::RegistrationStatus(void)const 
+	?Bearer@CConnMonBearerChange@@QBEHXZ @ 41 NONAME ; public: int __thiscall CConnMonBearerChange::Bearer(void)const 
+	?SignalStrength@CConnMonSignalStrengthChange@@QBEHXZ @ 42 NONAME ; public: int __thiscall CConnMonSignalStrengthChange::SignalStrength(void)const 
+	?Availability@CConnMonBearerAvailabilityChange@@QBEHXZ @ 43 NONAME ; public: int __thiscall CConnMonBearerAvailabilityChange::Availability(void)const 
+	?Data@CConnMonGenericEvent@@QBEPAXXZ @ 44 NONAME ; public: void * __thiscall CConnMonGenericEvent::Data(void)const 
+	?IapAvailability@CConnMonIapAvailabilityChange@@QBE?AVTConnMonIapInfo@@XZ @ 45 NONAME ; class TConnMonIapInfo CConnMonIapAvailabilityChange::IapAvailability(void) const
+	?TransmitPower@CConnMonTransmitPowerChange@@QBEIXZ @ 46 NONAME ; unsigned int CConnMonTransmitPowerChange::TransmitPower(void) const
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/BWINSCW/CONNMON_EKA2U.def	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,97 @@
+EXPORTS
+	?AuthoritativeDelete@CConnMonDeleteConnection@@QBEHXZ @ 1 NONAME ; int CConnMonDeleteConnection::AuthoritativeDelete(void) const
+	?AuthoritativeDelete@CConnMonDeleteSubConnection@@QBEHXZ @ 2 NONAME ; int CConnMonDeleteSubConnection::AuthoritativeDelete(void) const
+	?Availability@CConnMonBearerAvailabilityChange@@QBEHXZ @ 3 NONAME ; int CConnMonBearerAvailabilityChange::Availability(void) const
+	?Bearer@CConnMonBearerChange@@QBEHXZ @ 4 NONAME ; int CConnMonBearerChange::Bearer(void) const
+	?CancelAsyncRequest@RConnectionMonitor@@QAEXH@Z @ 5 NONAME ; void RConnectionMonitor::CancelAsyncRequest(int)
+	?CancelNotifications@RConnectionMonitor@@QAEXXZ @ 6 NONAME ; void RConnectionMonitor::CancelNotifications(void)
+	?Close@RConnectionMonitor@@QAEXXZ @ 7 NONAME ; void RConnectionMonitor::Close(void)
+	?ConnectL@RConnectionMonitor@@QAEHXZ @ 8 NONAME ; int RConnectionMonitor::ConnectL(void)
+	?ConnectionActivity@CConnMonConnectionActivityChange@@QBEHXZ @ 9 NONAME ; int CConnMonConnectionActivityChange::ConnectionActivity(void) const
+	?ConnectionId@CConnMonEventBase@@QBEIXZ @ 10 NONAME ; unsigned int CConnMonEventBase::ConnectionId(void) const
+	?ConnectionStatus@CConnMonConnectionStatusChange@@QBEHXZ @ 11 NONAME ; int CConnMonConnectionStatusChange::ConnectionStatus(void) const
+	?Data@CConnMonGenericEvent@@QBEPAXXZ @ 12 NONAME ; void * CConnMonGenericEvent::Data(void) const
+	?DownlinkData@CConnMonDeleteConnection@@QBEIXZ @ 13 NONAME ; unsigned int CConnMonDeleteConnection::DownlinkData(void) const
+	?DownlinkData@CConnMonDeleteSubConnection@@QBEIXZ @ 14 NONAME ; unsigned int CConnMonDeleteSubConnection::DownlinkData(void) const
+	?DownlinkData@CConnMonDownlinkDataThreshold@@QBEIXZ @ 15 NONAME ; unsigned int CConnMonDownlinkDataThreshold::DownlinkData(void) const
+	?EventType@CConnMonEventBase@@QBEHXZ @ 16 NONAME ; int CConnMonEventBase::EventType(void) const
+	?GetBoolAttribute@RConnectionMonitor@@QAEXIIIAAHAAVTRequestStatus@@@Z @ 17 NONAME ; void RConnectionMonitor::GetBoolAttribute(unsigned int, unsigned int, unsigned int, int &, class TRequestStatus &)
+	?GetConnectionCount@RConnectionMonitor@@QAEXAAIAAVTRequestStatus@@@Z @ 18 NONAME ; void RConnectionMonitor::GetConnectionCount(unsigned int &, class TRequestStatus &)
+	?GetConnectionInfo@RConnectionMonitor@@QBEHIAAI0@Z @ 19 NONAME ; int RConnectionMonitor::GetConnectionInfo(unsigned int, unsigned int &, unsigned int &) const
+	?GetIntAttribute@RConnectionMonitor@@QAEXIIIAAHAAVTRequestStatus@@@Z @ 20 NONAME ; void RConnectionMonitor::GetIntAttribute(unsigned int, unsigned int, unsigned int, int &, class TRequestStatus &)
+	?GetPckgAttribute@RConnectionMonitor@@QBEXIIIAAVTDes8@@AAVTRequestStatus@@@Z @ 21 NONAME ; void RConnectionMonitor::GetPckgAttribute(unsigned int, unsigned int, unsigned int, class TDes8 &, class TRequestStatus &) const
+	?GetStringAttribute@RConnectionMonitor@@QBEXIIIAAVTDes16@@AAVTRequestStatus@@@Z @ 22 NONAME ; void RConnectionMonitor::GetStringAttribute(unsigned int, unsigned int, unsigned int, class TDes16 &, class TRequestStatus &) const
+	?GetSubConnectionInfo@RConnectionMonitor@@QBEHIIAAI@Z @ 23 NONAME ; int RConnectionMonitor::GetSubConnectionInfo(unsigned int, unsigned int, unsigned int &) const
+	?GetUintAttribute@RConnectionMonitor@@QAEXIIIAAIAAVTRequestStatus@@@Z @ 24 NONAME ; void RConnectionMonitor::GetUintAttribute(unsigned int, unsigned int, unsigned int, unsigned int &, class TRequestStatus &)
+	?NetworkStatus@CConnMonNetworkStatusChange@@QBEHXZ @ 25 NONAME ; int CConnMonNetworkStatusChange::NetworkStatus(void) const
+	?NotifyEventL@RConnectionMonitor@@QAEHAAVMConnectionMonitorObserver@@@Z @ 26 NONAME ; int RConnectionMonitor::NotifyEventL(class MConnectionMonitorObserver &)
+	?RegistrationStatus@CConnMonNetworkRegistrationChange@@QBEHXZ @ 27 NONAME ; int CConnMonNetworkRegistrationChange::RegistrationStatus(void) const
+	?SetBoolAttribute@RConnectionMonitor@@QBEHIIIH@Z @ 28 NONAME ; int RConnectionMonitor::SetBoolAttribute(unsigned int, unsigned int, unsigned int, int) const
+	?SetIntAttribute@RConnectionMonitor@@QBEHIIIH@Z @ 29 NONAME ; int RConnectionMonitor::SetIntAttribute(unsigned int, unsigned int, unsigned int, int) const
+	?SetPckgAttribute@RConnectionMonitor@@QBEHIIIABVTDes8@@@Z @ 30 NONAME ; int RConnectionMonitor::SetPckgAttribute(unsigned int, unsigned int, unsigned int, class TDes8 const &) const
+	?SetStringAttribute@RConnectionMonitor@@QBEHIIIABVTDes16@@@Z @ 31 NONAME ; int RConnectionMonitor::SetStringAttribute(unsigned int, unsigned int, unsigned int, class TDes16 const &) const
+	?SetUintAttribute@RConnectionMonitor@@QBEHIIII@Z @ 32 NONAME ; int RConnectionMonitor::SetUintAttribute(unsigned int, unsigned int, unsigned int, unsigned int) const
+	?SignalStrength@CConnMonSignalStrengthChange@@QBEHXZ @ 33 NONAME ; int CConnMonSignalStrengthChange::SignalStrength(void) const
+	?SubConnectionId@CConnMonConnectionActivityChange@@QBEIXZ @ 34 NONAME ; unsigned int CConnMonConnectionActivityChange::SubConnectionId(void) const
+	?SubConnectionId@CConnMonConnectionStatusChange@@QBEIXZ @ 35 NONAME ; unsigned int CConnMonConnectionStatusChange::SubConnectionId(void) const
+	?SubConnectionId@CConnMonCreateSubConnection@@QBEIXZ @ 36 NONAME ; unsigned int CConnMonCreateSubConnection::SubConnectionId(void) const
+	?SubConnectionId@CConnMonDeleteSubConnection@@QBEIXZ @ 37 NONAME ; unsigned int CConnMonDeleteSubConnection::SubConnectionId(void) const
+	?SubConnectionId@CConnMonDownlinkDataThreshold@@QBEIXZ @ 38 NONAME ; unsigned int CConnMonDownlinkDataThreshold::SubConnectionId(void) const
+	?SubConnectionId@CConnMonUplinkDataThreshold@@QBEIXZ @ 39 NONAME ; unsigned int CConnMonUplinkDataThreshold::SubConnectionId(void) const
+	?ThreadStart@CConnMonScheduler@@SAHAAVTSignal@1@@Z @ 40 NONAME ; int CConnMonScheduler::ThreadStart(class CConnMonScheduler::TSignal &)
+	?UplinkData@CConnMonDeleteConnection@@QBEIXZ @ 41 NONAME ; unsigned int CConnMonDeleteConnection::UplinkData(void) const
+	?UplinkData@CConnMonDeleteSubConnection@@QBEIXZ @ 42 NONAME ; unsigned int CConnMonDeleteSubConnection::UplinkData(void) const
+	?UplinkData@CConnMonUplinkDataThreshold@@QBEIXZ @ 43 NONAME ; unsigned int CConnMonUplinkDataThreshold::UplinkData(void) const
+	?IapAvailability@CConnMonIapAvailabilityChange@@QBE?AVTConnMonIapInfo@@XZ @ 44 NONAME ; class TConnMonIapInfo CConnMonIapAvailabilityChange::IapAvailability(void) const
+	??0ConnMonIdsArrayPckg@@QAE@I@Z @ 45 NONAME ; ConnMonIdsArrayPckg::ConnMonIdsArrayPckg(unsigned int)
+	??0ConnMonWLANNetworksArrayPckg@@QAE@I@Z @ 46 NONAME ; ConnMonWLANNetworksArrayPckg::ConnMonWLANNetworksArrayPckg(unsigned int)
+	??0TConnMonId@@QAE@I@Z @ 47 NONAME ; TConnMonId::TConnMonId(unsigned int)
+	??0TConnMonWLANNetwork@@QAE@ABV?$TBuf@$0CA@@@IIIABV?$RArray@H@@@Z @ 48 NONAME ; TConnMonWLANNetwork::TConnMonWLANNetwork(class TBuf<32> const &, unsigned int, unsigned int, unsigned int, class RArray<int> const &)
+	??1ConnMonIdsArrayPckg@@UAE@XZ @ 49 NONAME ; ConnMonIdsArrayPckg::~ConnMonIdsArrayPckg(void)
+	??1ConnMonWLANNetworksArrayPckg@@UAE@XZ @ 50 NONAME ; ConnMonWLANNetworksArrayPckg::~ConnMonWLANNetworksArrayPckg(void)
+	??1TConnMonWLANNetwork@@UAE@XZ @ 51 NONAME ; TConnMonWLANNetwork::~TConnMonWLANNetwork(void)
+	?Buf@ConnMonIdsArrayPckg@@QBEPAVHBufC16@@XZ @ 52 NONAME ; class HBufC16 * ConnMonIdsArrayPckg::Buf(void) const
+	?Buf@ConnMonWLANNetworksArrayPckg@@QBEPAVHBufC16@@XZ @ 53 NONAME ; class HBufC16 * ConnMonWLANNetworksArrayPckg::Buf(void) const
+	?FromPtrC@TConnMonId@@SA?AV1@ABVTPtrC16@@@Z @ 54 NONAME ; class TConnMonId TConnMonId::FromPtrC(class TPtrC16 const &)
+	?FromPtrC@TConnMonWLANNetwork@@SA?AV1@ABVTPtrC16@@@Z @ 55 NONAME ; class TConnMonWLANNetwork TConnMonWLANNetwork::FromPtrC(class TPtrC16 const &)
+	?GetPckgAttribute@RConnectionMonitor@@QBEXIIIAAVTDes16@@AAVTRequestStatus@@@Z @ 56 NONAME ; void RConnectionMonitor::GetPckgAttribute(unsigned int, unsigned int, unsigned int, class TDes16 &, class TRequestStatus &) const
+	?Id@TConnMonId@@QBEIXZ @ 57 NONAME ; unsigned int TConnMonId::Id(void) const
+	?LessBySignal@TConnMonWLANNetwork@@SAHABV1@0@Z @ 58 NONAME ; int TConnMonWLANNetwork::LessBySignal(class TConnMonWLANNetwork const &, class TConnMonWLANNetwork const &)
+	?SNAPAvailability@CConnMonSNAPsAvailabilityChange@@QBE?AVTConnMonSNAPInfo@@XZ @ 59 NONAME ; class TConnMonSNAPInfo CConnMonSNAPsAvailabilityChange::SNAPAvailability(void) const
+	?SNAPsAvailabile@CConnMonSNAPsAvailabilityChange@@QBEIXZ @ 60 NONAME ; unsigned int CConnMonSNAPsAvailabilityChange::SNAPsAvailabile(void) const
+	?ToBuf@TConnMonId@@UBEPBVHBufC16@@XZ @ 61 NONAME ; class HBufC16 const * TConnMonId::ToBuf(void) const
+	?ToBuf@TConnMonWLANNetwork@@UBEPBVHBufC16@@XZ @ 62 NONAME ; class HBufC16 const * TConnMonWLANNetwork::ToBuf(void) const
+	?TransmitPower@CConnMonTransmitPowerChange@@QBEIXZ @ 63 NONAME ; unsigned int CConnMonTransmitPowerChange::TransmitPower(void) const
+	?UnpackToL@ConnMonIdsArrayPckg@@QBEXAAV?$RArray@VTConnMonId@@@@@Z @ 64 NONAME ; void ConnMonIdsArrayPckg::UnpackToL(class RArray<class TConnMonId> &) const
+	?UnpackToL@ConnMonWLANNetworksArrayPckg@@QBEXAAV?$RArray@VTConnMonWLANNetwork@@@@@Z @ 65 NONAME ; void ConnMonWLANNetworksArrayPckg::UnpackToL(class RArray<class TConnMonWLANNetwork> &) const
+	?Valid@TConnMonSNAP@@QBEHXZ @ 66 NONAME ; int TConnMonSNAP::Valid(void) const
+	??0CConnMonWlanNetworksPtrArrayPckg@@QAE@I@Z @ 67 NONAME ; CConnMonWlanNetworksPtrArrayPckg::CConnMonWlanNetworksPtrArrayPckg(unsigned int)
+	??1CConnMonWlanNetwork@@UAE@XZ @ 68 NONAME ; CConnMonWlanNetwork::~CConnMonWlanNetwork(void)
+	??1CConnMonWlanNetworksPtrArrayPckg@@UAE@XZ @ 69 NONAME ; CConnMonWlanNetworksPtrArrayPckg::~CConnMonWlanNetworksPtrArrayPckg(void)
+	??4CConnMonWlanNetwork@@QAEAAV0@AAV0@@Z @ 70 NONAME ; class CConnMonWlanNetwork & CConnMonWlanNetwork::operator=(class CConnMonWlanNetwork &)
+	?Buf@CConnMonWlanNetworksPtrArrayPckg@@QBEPAVHBufC16@@XZ @ 71 NONAME ; class HBufC16 * CConnMonWlanNetworksPtrArrayPckg::Buf(void) const
+	?CompareBySignal@CConnMonWlanNetwork@@SAHABV1@0@Z @ 72 NONAME ; int CConnMonWlanNetwork::CompareBySignal(class CConnMonWlanNetwork const &, class CConnMonWlanNetwork const &)
+	?FromPtrC@CConnMonWlanNetwork@@SAHABVTPtrC16@@PAV1@@Z @ 73 NONAME ; int CConnMonWlanNetwork::FromPtrC(class TPtrC16 const &, class CConnMonWlanNetwork *)
+	?NewL@CConnMonWlanNetwork@@SAPAV1@AAV1@@Z @ 74 NONAME ; class CConnMonWlanNetwork * CConnMonWlanNetwork::NewL(class CConnMonWlanNetwork &)
+	?NewL@CConnMonWlanNetwork@@SAPAV1@ABV?$TBuf@$0CA@@@IIIABV?$TBuf8@$05@@ABVTDesC16@@@Z @ 75 NONAME ; class CConnMonWlanNetwork * CConnMonWlanNetwork::NewL(class TBuf<32> const &, unsigned int, unsigned int, unsigned int, class TBuf8<6> const &, class TDesC16 const &)
+	?NewL@CConnMonWlanNetwork@@SAPAV1@XZ @ 76 NONAME ; class CConnMonWlanNetwork * CConnMonWlanNetwork::NewL(void)
+	?ToBuf@CConnMonWlanNetwork@@QBEPBVHBufC16@@XZ @ 77 NONAME ; class HBufC16 const * CConnMonWlanNetwork::ToBuf(void) const
+	?UnpackToL@CConnMonWlanNetworksPtrArrayPckg@@QBEXAAV?$RPointerArray@VCConnMonWlanNetwork@@@@@Z @ 78 NONAME ; void CConnMonWlanNetworksPtrArrayPckg::UnpackToL(class RPointerArray<class CConnMonWlanNetwork> &) const
+	?BearerGroups@CConnMonBearerGroupChange@@QBEXAAI0@Z @ 79 NONAME ; void CConnMonBearerGroupChange::BearerGroups(unsigned int &, unsigned int &) const
+	?BearerInfo@CConnMonBearerInfoChange@@QBEHXZ @ 80 NONAME ; int CConnMonBearerInfoChange::BearerInfo(void) const
+	?Internal@CConnMonBearerGroupChange@@QBEHXZ @ 81 NONAME ; int CConnMonBearerGroupChange::Internal(void) const
+	??0CConnMonWlanProbeRawBuffersPckg@@QAE@I@Z @ 82 NONAME ; CConnMonWlanProbeRawBuffersPckg::CConnMonWlanProbeRawBuffersPckg(unsigned int)
+	??1CConnMonWlanProbeRawBuffer@@UAE@XZ @ 83 NONAME ; CConnMonWlanProbeRawBuffer::~CConnMonWlanProbeRawBuffer(void)
+	??1CConnMonWlanProbeRawBuffersPckg@@UAE@XZ @ 84 NONAME ; CConnMonWlanProbeRawBuffersPckg::~CConnMonWlanProbeRawBuffersPckg(void)
+	??4CConnMonWlanProbeRawBuffer@@QAEAAV0@AAV0@@Z @ 85 NONAME ; class CConnMonWlanProbeRawBuffer & CConnMonWlanProbeRawBuffer::operator=(class CConnMonWlanProbeRawBuffer &)
+	?Buf@CConnMonWlanProbeRawBuffersPckg@@QBEPAVHBufC8@@XZ @ 86 NONAME ; class HBufC8 * CConnMonWlanProbeRawBuffersPckg::Buf(void) const
+	?Count@CConnMonWlanProbeRawBuffersPckg@@QBEIXZ @ 87 NONAME ; unsigned int CConnMonWlanProbeRawBuffersPckg::Count(void) const
+	?FromPtrC@CConnMonWlanProbeRawBuffer@@SAHABVTPtrC8@@PAV1@@Z @ 88 NONAME ; int CConnMonWlanProbeRawBuffer::FromPtrC(class TPtrC8 const &, class CConnMonWlanProbeRawBuffer *)
+	?NewL@CConnMonWlanProbeRawBuffer@@SAPAV1@AAV1@@Z @ 89 NONAME ; class CConnMonWlanProbeRawBuffer * CConnMonWlanProbeRawBuffer::NewL(class CConnMonWlanProbeRawBuffer &)
+	?NewL@CConnMonWlanProbeRawBuffer@@SAPAV1@PBVHBufC8@@@Z @ 90 NONAME ; class CConnMonWlanProbeRawBuffer * CConnMonWlanProbeRawBuffer::NewL(class HBufC8 const *)
+	?NewL@CConnMonWlanProbeRawBuffer@@SAPAV1@XZ @ 91 NONAME ; class CConnMonWlanProbeRawBuffer * CConnMonWlanProbeRawBuffer::NewL(void)
+	?RawBuffer@CConnMonWlanProbeRawBuffer@@QBEPAVHBufC8@@XZ @ 92 NONAME ; class HBufC8 * CConnMonWlanProbeRawBuffer::RawBuffer(void) const
+	?ToBuf@CConnMonWlanProbeRawBuffer@@QBEPBVHBufC8@@XZ @ 93 NONAME ; class HBufC8 const * CConnMonWlanProbeRawBuffer::ToBuf(void) const
+	?Total@CConnMonWlanProbeRawBuffersPckg@@QBEIXZ @ 94 NONAME ; unsigned int CConnMonWlanProbeRawBuffersPckg::Total(void) const
+	?UnpackToL@CConnMonWlanProbeRawBuffersPckg@@QBEXAAV?$RPointerArray@VCConnMonWlanProbeRawBuffer@@@@@Z @ 95 NONAME ; void CConnMonWlanProbeRawBuffersPckg::UnpackToL(class RPointerArray<class CConnMonWlanProbeRawBuffer> &) const
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/EABI/ConnMonU.DEF	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,130 @@
+EXPORTS
+	_Z6E32Dll10TDllReason @ 1 NONAME
+	_ZN17CConnMonScheduler11ThreadStartERNS_7TSignalE @ 2 NONAME
+	_ZN18RConnectionMonitor12NotifyEventLER26MConnectionMonitorObserver @ 3 NONAME
+	_ZN18RConnectionMonitor15GetIntAttributeEjjjRiR14TRequestStatus @ 4 NONAME
+	_ZN18RConnectionMonitor16GetBoolAttributeEjjjRiR14TRequestStatus @ 5 NONAME
+	_ZN18RConnectionMonitor16GetUintAttributeEjjjRjR14TRequestStatus @ 6 NONAME
+	_ZN18RConnectionMonitor18CancelAsyncRequestEi @ 7 NONAME
+	_ZN18RConnectionMonitor18GetConnectionCountERjR14TRequestStatus @ 8 NONAME
+	_ZN18RConnectionMonitor19CancelNotificationsEv @ 9 NONAME
+	_ZN18RConnectionMonitor5CloseEv @ 10 NONAME
+	_ZN18RConnectionMonitor8ConnectLEv @ 11 NONAME
+	_ZNK17CConnMonEventBase12ConnectionIdEv @ 12 NONAME
+	_ZNK17CConnMonEventBase9EventTypeEv @ 13 NONAME
+	_ZNK18RConnectionMonitor15SetIntAttributeEjjji @ 14 NONAME
+	_ZNK18RConnectionMonitor16GetPckgAttributeEjjjR5TDes8R14TRequestStatus @ 15 NONAME
+	_ZNK18RConnectionMonitor16SetBoolAttributeEjjji @ 16 NONAME
+	_ZNK18RConnectionMonitor16SetPckgAttributeEjjjRK5TDes8 @ 17 NONAME
+	_ZNK18RConnectionMonitor16SetUintAttributeEjjjj @ 18 NONAME
+	_ZNK18RConnectionMonitor17GetConnectionInfoEjRjS0_ @ 19 NONAME
+	_ZNK18RConnectionMonitor18GetStringAttributeEjjjR6TDes16R14TRequestStatus @ 20 NONAME
+	_ZNK18RConnectionMonitor18SetStringAttributeEjjjRK6TDes16 @ 21 NONAME
+	_ZNK18RConnectionMonitor20GetSubConnectionInfoEjjRj @ 22 NONAME
+	_ZNK20CConnMonBearerChange6BearerEv @ 23 NONAME
+	_ZNK20CConnMonGenericEvent4DataEv @ 24 NONAME
+	_ZNK24CConnMonDeleteConnection10UplinkDataEv @ 25 NONAME
+	_ZNK24CConnMonDeleteConnection12DownlinkDataEv @ 26 NONAME
+	_ZNK24CConnMonDeleteConnection19AuthoritativeDeleteEv @ 27 NONAME
+	_ZNK27CConnMonCreateSubConnection15SubConnectionIdEv @ 28 NONAME
+	_ZNK27CConnMonDeleteSubConnection10UplinkDataEv @ 29 NONAME
+	_ZNK27CConnMonDeleteSubConnection12DownlinkDataEv @ 30 NONAME
+	_ZNK27CConnMonDeleteSubConnection15SubConnectionIdEv @ 31 NONAME
+	_ZNK27CConnMonDeleteSubConnection19AuthoritativeDeleteEv @ 32 NONAME
+	_ZNK27CConnMonNetworkStatusChange13NetworkStatusEv @ 33 NONAME
+	_ZNK27CConnMonUplinkDataThreshold10UplinkDataEv @ 34 NONAME
+	_ZNK27CConnMonUplinkDataThreshold15SubConnectionIdEv @ 35 NONAME
+	_ZNK28CConnMonSignalStrengthChange14SignalStrengthEv @ 36 NONAME
+	_ZNK29CConnMonDownlinkDataThreshold12DownlinkDataEv @ 37 NONAME
+	_ZNK29CConnMonDownlinkDataThreshold15SubConnectionIdEv @ 38 NONAME
+	_ZNK30CConnMonConnectionStatusChange15SubConnectionIdEv @ 39 NONAME
+	_ZNK30CConnMonConnectionStatusChange16ConnectionStatusEv @ 40 NONAME
+	_ZNK32CConnMonBearerAvailabilityChange12AvailabilityEv @ 41 NONAME
+	_ZNK32CConnMonConnectionActivityChange15SubConnectionIdEv @ 42 NONAME
+	_ZNK32CConnMonConnectionActivityChange18ConnectionActivityEv @ 43 NONAME
+	_ZNK33CConnMonNetworkRegistrationChange18RegistrationStatusEv @ 44 NONAME
+	_ZTI11CConnMonIAP @ 45 NONAME ; #<TI>#
+	_ZTI11CDataVolume @ 46 NONAME ; #<TI>#
+	_ZTI11CEventQueue @ 47 NONAME ; #<TI>#
+	_ZTI13CDataNotifier @ 48 NONAME ; #<TI>#
+	_ZTI13CModeNotifier @ 49 NONAME ; #<TI>#
+	_ZTI14CConnMonServer @ 50 NONAME ; #<TI>#
+	_ZTI15CBearerNotifier @ 51 NONAME ; #<TI>#
+	_ZTI15CConnMonSession @ 52 NONAME ; #<TI>#
+	_ZTI17CActivityNotifier @ 53 NONAME ; #<TI>#
+	_ZTI17CConnMonEventBase @ 54 NONAME ; #<TI>#
+	_ZTI17CConnMonScheduler @ 55 NONAME ; #<TI>#
+	_ZTI17CCsdFaxUpNotifier @ 56 NONAME ; #<TI>#
+	_ZTI17CProgressNotifier @ 57 NONAME ; #<TI>#
+	_ZTI17CPsdFaxUpNotifier @ 58 NONAME ; #<TI>#
+	_ZTI18CCsdStatusNotifier @ 59 NONAME ; #<TI>#
+	_ZTI18CGsmSignalNotifier @ 60 NONAME ; #<TI>#
+	_ZTI18CPsdStatusNotifier @ 61 NONAME ; #<TI>#
+	_ZTI19CConnUpDownNotifier @ 62 NONAME ; #<TI>#
+	_ZTI19CNetwStatusNotifier @ 63 NONAME ; #<TI>#
+	_ZTI20CConnMonBearerChange @ 64 NONAME ; #<TI>#
+	_ZTI20CConnMonEventHandler @ 65 NONAME ; #<TI>#
+	_ZTI20CConnMonGenericEvent @ 66 NONAME ; #<TI>#
+	_ZTI22CSubConnUpDownNotifier @ 67 NONAME ; #<TI>#
+	_ZTI23CConnMonDelayedShutdown @ 68 NONAME ; #<TI>#
+	_ZTI24CConnMonCreateConnection @ 69 NONAME ; #<TI>#
+	_ZTI24CConnMonDeleteConnection @ 70 NONAME ; #<TI>#
+	_ZTI25CNetwRegistrationNotifier @ 71 NONAME ; #<TI>#
+	_ZTI27CBearerAvailabilityNotifier @ 72 NONAME ; #<TI>#
+	_ZTI27CConnMonCreateSubConnection @ 73 NONAME ; #<TI>#
+	_ZTI27CConnMonDeleteSubConnection @ 74 NONAME ; #<TI>#
+	_ZTI27CConnMonNetworkStatusChange @ 75 NONAME ; #<TI>#
+	_ZTI27CConnMonUplinkDataThreshold @ 76 NONAME ; #<TI>#
+	_ZTI28CConnMonSignalStrengthChange @ 77 NONAME ; #<TI>#
+	_ZTI29CConnMonDownlinkDataThreshold @ 78 NONAME ; #<TI>#
+	_ZTI30CConnMonConnectionStatusChange @ 79 NONAME ; #<TI>#
+	_ZTI32CConnMonBearerAvailabilityChange @ 80 NONAME ; #<TI>#
+	_ZTI32CConnMonConnectionActivityChange @ 81 NONAME ; #<TI>#
+	_ZTI33CConnMonNetworkRegistrationChange @ 82 NONAME ; #<TI>#
+	_ZTI7CCsdFax @ 83 NONAME ; #<TI>#
+	_ZTI7CPlugin @ 84 NONAME ; #<TI>#
+	_ZTI7CPsdFax @ 85 NONAME ; #<TI>#
+	_ZTI8CTimerAO @ 86 NONAME ; #<TI>#
+	_ZTV11CConnMonIAP @ 87 NONAME ; #<VT>#
+	_ZTV11CDataVolume @ 88 NONAME ; #<VT>#
+	_ZTV11CEventQueue @ 89 NONAME ; #<VT>#
+	_ZTV13CDataNotifier @ 90 NONAME ; #<VT>#
+	_ZTV13CModeNotifier @ 91 NONAME ; #<VT>#
+	_ZTV14CConnMonServer @ 92 NONAME ; #<VT>#
+	_ZTV15CBearerNotifier @ 93 NONAME ; #<VT>#
+	_ZTV15CConnMonSession @ 94 NONAME ; #<VT>#
+	_ZTV17CActivityNotifier @ 95 NONAME ; #<VT>#
+	_ZTV17CConnMonEventBase @ 96 NONAME ; #<VT>#
+	_ZTV17CConnMonScheduler @ 97 NONAME ; #<VT>#
+	_ZTV17CCsdFaxUpNotifier @ 98 NONAME ; #<VT>#
+	_ZTV17CProgressNotifier @ 99 NONAME ; #<VT>#
+	_ZTV17CPsdFaxUpNotifier @ 100 NONAME ; #<VT>#
+	_ZTV18CCsdStatusNotifier @ 101 NONAME ; #<VT>#
+	_ZTV18CGsmSignalNotifier @ 102 NONAME ; #<VT>#
+	_ZTV18CPsdStatusNotifier @ 103 NONAME ; #<VT>#
+	_ZTV19CConnUpDownNotifier @ 104 NONAME ; #<VT>#
+	_ZTV19CNetwStatusNotifier @ 105 NONAME ; #<VT>#
+	_ZTV20CConnMonBearerChange @ 106 NONAME ; #<VT>#
+	_ZTV20CConnMonEventHandler @ 107 NONAME ; #<VT>#
+	_ZTV20CConnMonGenericEvent @ 108 NONAME ; #<VT>#
+	_ZTV22CSubConnUpDownNotifier @ 109 NONAME ; #<VT>#
+	_ZTV23CConnMonDelayedShutdown @ 110 NONAME ; #<VT>#
+	_ZTV24CConnMonCreateConnection @ 111 NONAME ; #<VT>#
+	_ZTV24CConnMonDeleteConnection @ 112 NONAME ; #<VT>#
+	_ZTV25CNetwRegistrationNotifier @ 113 NONAME ; #<VT>#
+	_ZTV27CBearerAvailabilityNotifier @ 114 NONAME ; #<VT>#
+	_ZTV27CConnMonCreateSubConnection @ 115 NONAME ; #<VT>#
+	_ZTV27CConnMonDeleteSubConnection @ 116 NONAME ; #<VT>#
+	_ZTV27CConnMonNetworkStatusChange @ 117 NONAME ; #<VT>#
+	_ZTV27CConnMonUplinkDataThreshold @ 118 NONAME ; #<VT>#
+	_ZTV28CConnMonSignalStrengthChange @ 119 NONAME ; #<VT>#
+	_ZTV29CConnMonDownlinkDataThreshold @ 120 NONAME ; #<VT>#
+	_ZTV30CConnMonConnectionStatusChange @ 121 NONAME ; #<VT>#
+	_ZTV32CConnMonBearerAvailabilityChange @ 122 NONAME ; #<VT>#
+	_ZTV32CConnMonConnectionActivityChange @ 123 NONAME ; #<VT>#
+	_ZTV33CConnMonNetworkRegistrationChange @ 124 NONAME ; #<VT>#
+	_ZTV7CCsdFax @ 125 NONAME ; #<VT>#
+	_ZTV7CPlugin @ 126 NONAME ; #<VT>#
+	_ZTV7CPsdFax @ 127 NONAME ; #<VT>#
+	_ZTV8CTimerAO @ 128 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/EABI/ConnMon_EKA2U.def	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,161 @@
+EXPORTS
+	_ZN17CConnMonScheduler11ThreadStartERNS_7TSignalE @ 1 NONAME
+	_ZN18RConnectionMonitor12NotifyEventLER26MConnectionMonitorObserver @ 2 NONAME
+	_ZN18RConnectionMonitor15GetIntAttributeEjjjRiR14TRequestStatus @ 3 NONAME
+	_ZN18RConnectionMonitor16GetBoolAttributeEjjjRiR14TRequestStatus @ 4 NONAME
+	_ZN18RConnectionMonitor16GetUintAttributeEjjjRjR14TRequestStatus @ 5 NONAME
+	_ZN18RConnectionMonitor18CancelAsyncRequestEi @ 6 NONAME
+	_ZN18RConnectionMonitor18GetConnectionCountERjR14TRequestStatus @ 7 NONAME
+	_ZN18RConnectionMonitor19CancelNotificationsEv @ 8 NONAME
+	_ZN18RConnectionMonitor5CloseEv @ 9 NONAME
+	_ZN18RConnectionMonitor8ConnectLEv @ 10 NONAME
+	_ZNK17CConnMonEventBase12ConnectionIdEv @ 11 NONAME
+	_ZNK17CConnMonEventBase9EventTypeEv @ 12 NONAME
+	_ZNK18RConnectionMonitor15SetIntAttributeEjjji @ 13 NONAME
+	_ZNK18RConnectionMonitor16GetPckgAttributeEjjjR5TDes8R14TRequestStatus @ 14 NONAME
+	_ZNK18RConnectionMonitor16SetBoolAttributeEjjji @ 15 NONAME
+	_ZNK18RConnectionMonitor16SetPckgAttributeEjjjRK5TDes8 @ 16 NONAME
+	_ZNK18RConnectionMonitor16SetUintAttributeEjjjj @ 17 NONAME
+	_ZNK18RConnectionMonitor17GetConnectionInfoEjRjS0_ @ 18 NONAME
+	_ZNK18RConnectionMonitor18GetStringAttributeEjjjR6TDes16R14TRequestStatus @ 19 NONAME
+	_ZNK18RConnectionMonitor18SetStringAttributeEjjjRK6TDes16 @ 20 NONAME
+	_ZNK18RConnectionMonitor20GetSubConnectionInfoEjjRj @ 21 NONAME
+	_ZNK20CConnMonBearerChange6BearerEv @ 22 NONAME
+	_ZNK20CConnMonGenericEvent4DataEv @ 23 NONAME
+	_ZNK24CConnMonDeleteConnection10UplinkDataEv @ 24 NONAME
+	_ZNK24CConnMonDeleteConnection12DownlinkDataEv @ 25 NONAME
+	_ZNK24CConnMonDeleteConnection19AuthoritativeDeleteEv @ 26 NONAME
+	_ZNK27CConnMonCreateSubConnection15SubConnectionIdEv @ 27 NONAME
+	_ZNK27CConnMonDeleteSubConnection10UplinkDataEv @ 28 NONAME
+	_ZNK27CConnMonDeleteSubConnection12DownlinkDataEv @ 29 NONAME
+	_ZNK27CConnMonDeleteSubConnection15SubConnectionIdEv @ 30 NONAME
+	_ZNK27CConnMonDeleteSubConnection19AuthoritativeDeleteEv @ 31 NONAME
+	_ZNK27CConnMonNetworkStatusChange13NetworkStatusEv @ 32 NONAME
+	_ZNK27CConnMonUplinkDataThreshold10UplinkDataEv @ 33 NONAME
+	_ZNK27CConnMonUplinkDataThreshold15SubConnectionIdEv @ 34 NONAME
+	_ZNK28CConnMonSignalStrengthChange14SignalStrengthEv @ 35 NONAME
+	_ZNK29CConnMonDownlinkDataThreshold12DownlinkDataEv @ 36 NONAME
+	_ZNK29CConnMonDownlinkDataThreshold15SubConnectionIdEv @ 37 NONAME
+	_ZNK30CConnMonConnectionStatusChange15SubConnectionIdEv @ 38 NONAME
+	_ZNK30CConnMonConnectionStatusChange16ConnectionStatusEv @ 39 NONAME
+	_ZNK32CConnMonBearerAvailabilityChange12AvailabilityEv @ 40 NONAME
+	_ZNK32CConnMonConnectionActivityChange15SubConnectionIdEv @ 41 NONAME
+	_ZNK32CConnMonConnectionActivityChange18ConnectionActivityEv @ 42 NONAME
+	_ZNK33CConnMonNetworkRegistrationChange18RegistrationStatusEv @ 43 NONAME
+	_ZNK29CConnMonIapAvailabilityChange15IapAvailabilityEv @ 44 NONAME
+	_ZNK27CConnMonTransmitPowerChange13TransmitPowerEv @ 45 NONAME
+	_ZN10TConnMonId8FromPtrCERK7TPtrC16 @ 46 NONAME
+	_ZN10TConnMonIdC1Ej @ 47 NONAME
+	_ZN10TConnMonIdC2Ej @ 48 NONAME
+	_ZN19ConnMonIdsArrayPckgC1Ej @ 49 NONAME
+	_ZN19ConnMonIdsArrayPckgC2Ej @ 50 NONAME
+	_ZN19ConnMonIdsArrayPckgD0Ev @ 51 NONAME
+	_ZN19ConnMonIdsArrayPckgD1Ev @ 52 NONAME
+	_ZN19ConnMonIdsArrayPckgD2Ev @ 53 NONAME
+	_ZN19TConnMonWLANNetwork12LessBySignalERKS_S1_ @ 54 NONAME
+	_ZN19TConnMonWLANNetwork8FromPtrCERK7TPtrC16 @ 55 NONAME
+	_ZN19TConnMonWLANNetworkC1ERK4TBufILi32EEjjjRK6RArrayIiE @ 56 NONAME
+	_ZN19TConnMonWLANNetworkC2ERK4TBufILi32EEjjjRK6RArrayIiE @ 57 NONAME
+	_ZN19TConnMonWLANNetworkD0Ev @ 58 NONAME
+	_ZN19TConnMonWLANNetworkD1Ev @ 59 NONAME
+	_ZN19TConnMonWLANNetworkD2Ev @ 60 NONAME
+	_ZN28ConnMonWLANNetworksArrayPckgC1Ej @ 61 NONAME
+	_ZN28ConnMonWLANNetworksArrayPckgC2Ej @ 62 NONAME
+	_ZN28ConnMonWLANNetworksArrayPckgD0Ev @ 63 NONAME
+	_ZN28ConnMonWLANNetworksArrayPckgD1Ev @ 64 NONAME
+	_ZN28ConnMonWLANNetworksArrayPckgD2Ev @ 65 NONAME
+	_ZNK10TConnMonId2IdEv @ 66 NONAME
+	_ZNK10TConnMonId5ToBufEv @ 67 NONAME
+	_ZNK12TConnMonSNAP5ValidEv @ 68 NONAME
+	_ZNK18RConnectionMonitor16GetPckgAttributeEjjjR6TDes16R14TRequestStatus @ 69 NONAME
+	_ZNK19ConnMonIdsArrayPckg3BufEv @ 70 NONAME
+	_ZNK19ConnMonIdsArrayPckg9UnpackToLER6RArrayI10TConnMonIdE @ 71 NONAME
+	_ZNK19TConnMonWLANNetwork5ToBufEv @ 72 NONAME
+	_ZNK28ConnMonWLANNetworksArrayPckg3BufEv @ 73 NONAME
+	_ZNK28ConnMonWLANNetworksArrayPckg9UnpackToLER6RArrayI19TConnMonWLANNetworkE @ 74 NONAME
+	_ZNK31CConnMonSNAPsAvailabilityChange15SNAPsAvailabileEv @ 75 NONAME
+	_ZNK31CConnMonSNAPsAvailabilityChange16SNAPAvailabilityEv @ 76 NONAME
+	_ZTI10TConnMonId @ 77 NONAME ; #<TI>#
+	_ZTI12TConnMonSNAP @ 78 NONAME ; #<TI>#
+	_ZTI15TConnMonRealIap @ 79 NONAME ; #<TI>#
+	_ZTI17TConnMonBearerCSD @ 80 NONAME ; #<TI>#
+	_ZTI17TConnMonBearerLAN @ 81 NONAME ; #<TI>#
+	_ZTI18TConnMonBearerGPRS @ 82 NONAME ; #<TI>#
+	_ZTI18TConnMonBearerWLAN @ 83 NONAME ; #<TI>#
+	_ZTI18TConnMonVirtualIap @ 84 NONAME ; #<TI>#
+	_ZTI19ConnMonIdsArrayPckg @ 85 NONAME ; #<TI>#
+	_ZTI19TConnMonWLANNetwork @ 86 NONAME ; #<TI>#
+	_ZTI20CCDIAPMetadataRecord @ 87 NONAME ABSENT ; #<TI>#
+	_ZTI21CCDSNAPMetadataRecord @ 88 NONAME ABSENT ; #<TI>#
+	_ZTI22CCDMIPServiceExtRecord @ 89 NONAME ABSENT ; #<TI>#
+	_ZTI25CConnMonCommsDataNotifier @ 90 NONAME ; #<TI>#
+	_ZTI27CConnMonAvailabilityManager @ 91 NONAME ; #<TI>#
+	_ZTI28ConnMonWLANNetworksArrayPckg @ 92 NONAME ; #<TI>#
+	_ZTI31CConnMonIapsAvailabilityManager @ 93 NONAME ; #<TI>#
+	_ZTI32CConnMonSNAPsAvailabilityManager @ 94 NONAME ; #<TI>#
+	_ZTI36CCDDataMobilitySelectionPolicyRecord @ 95 NONAME ABSENT ; #<TI>#
+	_ZTI37CCDGlobalBearerTypePriorizationRecord @ 96 NONAME ABSENT ; #<TI>#
+	_ZTV10TConnMonId @ 97 NONAME ; #<VT>#
+	_ZTV12TConnMonSNAP @ 98 NONAME ; #<VT>#
+	_ZTV15TConnMonRealIap @ 99 NONAME ; #<VT>#
+	_ZTV17TConnMonBearerCSD @ 100 NONAME ; #<VT>#
+	_ZTV17TConnMonBearerLAN @ 101 NONAME ; #<VT>#
+	_ZTV18TConnMonBearerGPRS @ 102 NONAME ; #<VT>#
+	_ZTV18TConnMonBearerWLAN @ 103 NONAME ; #<VT>#
+	_ZTV18TConnMonVirtualIap @ 104 NONAME ; #<VT>#
+	_ZTV19ConnMonIdsArrayPckg @ 105 NONAME ; #<VT>#
+	_ZTV19TConnMonWLANNetwork @ 106 NONAME ; #<VT>#
+	_ZTV20CCDIAPMetadataRecord @ 107 NONAME ABSENT; #<VT>#
+	_ZTV21CCDSNAPMetadataRecord @ 108 NONAME  ABSENT ; #<VT>#
+	_ZTV22CCDMIPServiceExtRecord @ 109 NONAME ABSENT ; #<VT>#
+	_ZTV25CConnMonCommsDataNotifier @ 110 NONAME ; #<VT>#
+	_ZTV27CConnMonAvailabilityManager @ 111 NONAME ; #<VT>#
+	_ZTV28ConnMonWLANNetworksArrayPckg @ 112 NONAME ; #<VT>#
+	_ZTV31CConnMonIapsAvailabilityManager @ 113 NONAME ; #<VT>#
+	_ZTV32CConnMonSNAPsAvailabilityManager @ 114 NONAME ; #<VT>#
+	_ZTV36CCDDataMobilitySelectionPolicyRecord @ 115 NONAME ABSENT ; #<VT>#
+	_ZTV37CCDGlobalBearerTypePriorizationRecord @ 116 NONAME ABSENT ; #<VT>#
+	_ZN19CConnMonWlanNetwork15CompareBySignalERKS_S1_ @ 117 NONAME
+	_ZN19CConnMonWlanNetwork4NewLERK4TBufILi32EEjjjRK5TBuf8ILi6EERK7TDesC16 @ 118 NONAME
+	_ZN19CConnMonWlanNetwork4NewLERS_ @ 119 NONAME
+	_ZN19CConnMonWlanNetwork4NewLEv @ 120 NONAME
+	_ZN19CConnMonWlanNetwork8FromPtrCERK7TPtrC16PS_ @ 121 NONAME
+	_ZN19CConnMonWlanNetworkD0Ev @ 122 NONAME
+	_ZN19CConnMonWlanNetworkD1Ev @ 123 NONAME
+	_ZN19CConnMonWlanNetworkD2Ev @ 124 NONAME
+	_ZN19CConnMonWlanNetworkaSERS_ @ 125 NONAME
+	_ZN32CConnMonWlanNetworksPtrArrayPckgC1Ej @ 126 NONAME
+	_ZN32CConnMonWlanNetworksPtrArrayPckgC2Ej @ 127 NONAME
+	_ZN32CConnMonWlanNetworksPtrArrayPckgD0Ev @ 128 NONAME
+	_ZN32CConnMonWlanNetworksPtrArrayPckgD1Ev @ 129 NONAME
+	_ZN32CConnMonWlanNetworksPtrArrayPckgD2Ev @ 130 NONAME
+	_ZNK19CConnMonWlanNetwork5ToBufEv @ 131 NONAME
+	_ZNK32CConnMonWlanNetworksPtrArrayPckg3BufEv @ 132 NONAME
+	_ZNK32CConnMonWlanNetworksPtrArrayPckg9UnpackToLER13RPointerArrayI19CConnMonWlanNetworkE @ 133 NONAME
+	_ZTI32CConnMonWlanNetworksPtrArrayPckg @ 134 NONAME ; #<TI>#
+	_ZTV32CConnMonWlanNetworksPtrArrayPckg @ 135 NONAME ; #<VT>#
+	_ZNK24CConnMonBearerInfoChange10BearerInfoEv @ 136 NONAME
+	_ZNK25CConnMonBearerGroupChange12BearerGroupsERjS0_ @ 137 NONAME
+	_ZNK25CConnMonBearerGroupChange8InternalEv @ 138 NONAME
+	_ZN26CConnMonWlanProbeRawBuffer4NewLEPK6HBufC8 @139
+	_ZN26CConnMonWlanProbeRawBuffer4NewLERS_ @140
+	_ZN26CConnMonWlanProbeRawBuffer4NewLEv @141
+	_ZN26CConnMonWlanProbeRawBuffer8FromPtrCERK6TPtrC8PS_ @142
+	_ZN26CConnMonWlanProbeRawBufferD0Ev @143
+	_ZN26CConnMonWlanProbeRawBufferD1Ev @144
+	_ZN26CConnMonWlanProbeRawBufferD2Ev @145
+	_ZN26CConnMonWlanProbeRawBufferaSERS_ @146
+	_ZN31CConnMonWlanProbeRawBuffersPckgC1Ej @147
+	_ZN31CConnMonWlanProbeRawBuffersPckgC2Ej @148
+	_ZN31CConnMonWlanProbeRawBuffersPckgD0Ev @149
+	_ZN31CConnMonWlanProbeRawBuffersPckgD1Ev @150
+	_ZN31CConnMonWlanProbeRawBuffersPckgD2Ev @151
+	_ZNK26CConnMonWlanProbeRawBuffer5ToBufEv @152
+	_ZNK31CConnMonWlanProbeRawBuffersPckg3BufEv @153
+	_ZNK31CConnMonWlanProbeRawBuffersPckg9UnpackToLER13RPointerArrayI26CConnMonWlanProbeRawBufferE @154
+	_ZTI31CConnMonWlanProbeRawBuffersPckg @155
+	_ZTV31CConnMonWlanProbeRawBuffersPckg @156
+	_ZNK26CConnMonWlanProbeRawBuffer9RawBufferEv @157
+	_ZNK31CConnMonWlanProbeRawBuffersPckg5CountEv @158
+	_ZNK31CConnMonWlanProbeRawBuffersPckg5TotalEv @159
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/group/ConnMon.mmp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,88 @@
+/*
+* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Builds ConnMon.dll.
+*
+*/
+
+#include <platform_paths.hrh>
+
+MACRO           EPOC_SDK=0x07010000
+
+TARGET          ConnMon.dll
+TARGETTYPE      dll
+UID             0x1000008d 0x101F6CEE
+
+VENDORID        VID_DEFAULT
+CAPABILITY      CAP_CLIENT_DLL
+
+SOURCEPATH      ../src
+SOURCE          RConnMon.cpp ConnMonCli.cpp
+SOURCE          ConnMonServ.cpp ConnMonSess.cpp ConnMonIAP.cpp CEventQueue.cpp
+SOURCE          ConnMonNoti.cpp CDataVolume.cpp CCsdFax.cpp CPsdFax.cpp CPlugin.cpp
+SOURCE          CIapSupport.cpp CUiDialogAO.cpp CWlanSupport.cpp
+
+SOURCE          ConnMonBearer.cpp
+SOURCE          ConnMonBearerCSD.cpp ConnMonBearerGPRS.cpp
+SOURCE          ConnMonBearerLAN.cpp ConnMonBearerWLAN.cpp
+
+SOURCE          ConnMonAvailabilityManager.cpp
+SOURCE          ConnMonBearerGroupManager.cpp
+SOURCE          connmoncommsdatcache.cpp
+SOURCE          connmoncommsdatnotifier.cpp
+
+SOURCE          ConnMonUtils.cpp
+
+SOURCE          ConnMonWLANNetwork.cpp
+SOURCE          ConnMonWLANNetworksArrayPckg.cpp
+
+SOURCE          connmonwlannetwork_v2.cpp
+SOURCE          ConnMonWLANNetworksArrayPckg_v2.cpp
+
+SOURCE          ConnMonId.cpp
+SOURCE          ConnMonIdsArrayPckg.cpp
+
+SOURCE          connmontelnoti.cpp
+SOURCE          connmondtmnoti.cpp
+
+SOURCE          ConnMonBearerNotifier.cpp ConnMonEGprsNotifier.cpp ConnMonHsdpaNotifier.cpp
+
+
+USERINCLUDE     ../inc
+MW_LAYER_SYSTEMINCLUDE
+
+// Path for internal headers of the networking ADO.
+SYSTEMINCLUDE   ../../../../inc
+
+
+LIBRARY         euser.lib esock.lib etel.lib etelmm.lib etelpckt.lib
+LIBRARY         CustomAPI.lib
+LIBRARY         featmgr.lib
+LIBRARY         charconv.lib
+LIBRARY         commdb.lib
+LIBRARY         commsdat.lib
+LIBRARY         ecom.lib
+LIBRARY         cmmanagerdatabase.lib
+LIBRARY         centralrepository.lib
+
+DEBUGLIBRARY    flogger.lib
+
+#if defined(ARMCC)
+DEFFILE ../EABI/ConnMon_EKA2.def
+#elif defined( WINSCW )
+DEFFILE ../BWINSCW/CONNMON_EKA2.def
+#else
+DEFFILE ../BMARM/CONNMON_EKA2.def
+#endif
+
+//exportunfrozen
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/group/ConnMonExe.mmp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2002 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:  Builds ConnMonExe.exe.
+*
+*/
+
+#include <platform_paths.hrh>
+
+target          ConnMonExe.exe
+targettype      exe
+
+uid             0x1000008c 0x101F6CF0
+
+VENDORID        VID_DEFAULT
+CAPABILITY      ProtServ NetworkServices NetworkControl ReadUserData ReadDeviceData WriteDeviceData
+epocstacksize   16384
+
+sourcepath      ../src
+source          ConnMonExe.cpp
+
+MW_LAYER_SYSTEMINCLUDE
+userinclude     ../inc
+
+library         euser.lib connmon.lib
+
+//exportunfrozen
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for Connection Monitor Server.
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+
+DEFAULT
+
+PRJ_EXPORTS
+
+../rom/connmon.iby CORE_MW_LAYER_IBY_EXPORT_PATH(connmon.iby)
+
+PRJ_MMPFILES
+
+// Builds connmon.dll
+ConnMon.mmp
+// Builds connmonexe.exe
+ConnMonExe.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/inc/CCsdFax.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,283 @@
+/*
+* Copyright (c) 2002-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:  Provides information on CSD fax calls.
+*
+*/
+
+#ifndef __CCSDFAX_H
+#define __CCSDFAX_H
+
+#include <etel.h>
+#include <etelmm.h>
+#include <rconnmon.h>
+
+#include "ConnMonDef.h"
+
+class CConnMonServer;
+class CCsdFaxUpNotifier;
+class CCsdStatusNotifier;
+
+/**
+*  CCsdFax
+*  @lib CONMONN.LIB
+*  @since
+*/
+NONSHARABLE_CLASS( CCsdFax ) : public CBase
+    {
+    public:
+        // Constructors and destructor
+        CCsdFax(
+                CConnMonServer* aServer,
+                RTelServer* aTelServer,
+                RMobilePhone* aMobilePhone );
+
+        void ConstructL();
+
+        ~CCsdFax();
+
+        enum TCsdFaxState
+        {
+        EModuleClosed = 0,
+        ELineOpen,
+        ECallOpen
+        };
+
+        /**
+        * Checks if an external call exists.
+        * @since
+        * @return KErrNone if successfull, otherwise a system wide error code.
+        */
+        TInt FindCall();
+
+        /**
+        * Opens an external data call.
+        * @since
+        * @param aName The name of the call.
+        * @return KErrNone if successfull, otherwise a system wide error code.
+        */
+        TInt OpenCall( const TDes& aName );
+
+        /**
+        * Closes the external call.
+        * @since
+        * @return void
+        */
+        void CloseCall();
+
+        /**
+        * Checks if external CSD call is still valid.
+        * @since
+        * @return ETrue if context is valid, EFalse otherwise.
+        */
+        TBool IsValid();
+
+        /**
+        * Gets the fax bearer.
+        * @since
+        * @param aBearer On return, contains the bearer.
+        * @return KErrNone if successfull, otherwise a system wide error code.
+        */
+        TInt GetBearer( TInt& aBearer, TBearerInfo& aBearerInfo ) const;
+
+        /**
+        * Gets the status of the external connection.
+        * @since
+        * @param aStatus On return, contains the connection status.
+        * @return KErrNone if successfull, otherwise a system wide error code.
+        */
+        TInt GetStatus( TInt& aStatus ) const;
+
+        /**
+        * Maps the data call status to nifvar.h values
+        * @since
+        * @param aStatus On return, contains the mapped connection status (in/out).
+        * @return KErrNone if successfull, otherwise a system wide error code.
+        */
+
+        TInt MapStatus( TInt& aStatus ) const;
+
+        /**
+        * Gets the dial up number of the external data call.
+        * @since
+        * @param aNumber On return, contains the dial up number.
+        * @return KErrNone if successfull, otherwise a system wide error code.
+        */
+        TInt GetTelNumber( TDes& aNumber ) const;
+
+        /**
+        * Gets the start time of the connection.
+        * @since
+        * @param aTime On return, contains the start time.
+        * @return KErrNone if successfull, otherwise a system wide error code.
+        */
+        TInt GetStartTime( TTime& aTime ) const;
+
+        /**
+        * Closes the external data call.
+        * @since
+        * @return KErrNone if successfull, otherwise a system wide error code.
+        */
+        TInt Stop();
+
+        /**
+        * Removes connection from server tables.
+        * @since
+        * @return void.
+        */
+        void RemoveFromServer();
+
+        void SetConnectionId( const TUint& aConnectionId ) { iConnectionId = aConnectionId; }
+        TUint ConnectionId() const { return iConnectionId; }
+
+    private: // Data
+        CConnMonServer* iServer;
+
+        // Pointer to ETel server
+        RTelServer* iTelServer;
+
+        // Pointer to mobile phone
+        RMobilePhone* iMobilePhone;
+
+        // "Data" line
+        RLine iLine;
+
+        // Open external data call
+        RMobileCall iCall;
+
+        // Name of the open external call
+        TName iCsdFaxCallName ;
+
+        // Connection ID
+        TUint iConnectionId;
+
+        // Tells fax module state
+        TCsdFaxState iState;
+
+        // Connection up event watcher
+        CCsdFaxUpNotifier* iConnUpNotifier;
+
+        // Connection status event watcher
+        CCsdStatusNotifier* iStatusNotifier;
+    };
+
+/**
+*  CCsdFaxUpNotifier
+*  @lib CONNMON.LIB
+*  @since
+*/
+NONSHARABLE_CLASS( CCsdFaxUpNotifier ) : public CActive
+    {
+    public: // Constructors and destructor
+        CCsdFaxUpNotifier(
+                CCsdFax* aFaxModule,
+                CConnMonServer* aServer,
+                RMobilePhone* aMobilePhone,
+                RLine& aLine );
+        void Construct();
+        ~CCsdFaxUpNotifier();
+
+    public:  // New methods
+        /**
+        * Requests a new event (connection up) from ETEL.
+        * @since
+        * @param
+        * @return void
+        */
+        void Receive();
+
+    private: // Methods from base classes
+        /**
+        * From CActive Cancels the asyncronous request
+        * @since
+        * @param
+        * @return void
+        */
+        void DoCancel();
+
+        /**
+        * From CActive Handles the the event that has arrived from ETEL.
+        * @since
+        * @param
+        * @return void
+        */
+        void RunL();
+
+    private: // Data
+        CCsdFax*        iFaxModule;
+        CConnMonServer* iServer;
+        RMobilePhone*   iMobilePhone;
+        RLine&          iLine;
+        TBuf<KMaxName>  iName;
+        TEventInfo      iEventInfo;
+    };
+
+/**
+*  CCsdStatusNotifier
+*  @lib CONNMON.LIB
+*  @since
+*/
+NONSHARABLE_CLASS( CCsdStatusNotifier ) : public CActive
+    {
+    public: // Constructors and destructor
+        CCsdStatusNotifier(
+                CCsdFax* aFaxModule,
+                CConnMonServer* aServer );
+        void Construct();
+        ~CCsdStatusNotifier();
+
+    public:  // New methods
+        /**
+        * Starts listening to status change events from ETEL.
+        * @since
+        * @param aCall The call whose status messages will be watched to.
+        * @return void
+        */
+        void Start( RMobileCall* aCall );
+
+        /**
+        * Requests a new event (status changed) from ETEL.
+        * @since
+        * @param
+        * @return void
+        */
+        void Receive();
+
+    private: // Methods from base classes
+        /**
+        * From CActive Cancels the asyncronous request
+        * @since
+        * @param
+        * @return void
+        */
+        void DoCancel();
+
+        /**
+        * From CActive Handles the the event that has arrived from ETEL.
+        * @since
+        * @param
+        * @return void
+        */
+        void RunL();
+
+    private: // Data
+        CCsdFax*                       iFaxModule;
+        CConnMonServer*                iServer;
+        RMobileCall*                   iCall;
+        RMobileCall::TMobileCallStatus iMobileCallStatus;
+        TEventInfo                     iEventInfo;
+    };
+
+#endif // __CCSDFAX_H
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/inc/CDataVolume.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,78 @@
+/*
+* Copyright (c) 2002-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:  Issues RConnection::DataTransferredRequest() and sends the
+*                data volumes to sessions.
+*
+*/
+
+#ifndef CONNMON_CDATAVOLUME_H
+#define CONNMON_CDATAVOLUME_H
+
+class CConnMonServer;
+
+/**
+*  CDataVolume
+*  @lib CONNMON.LIB
+*  @since
+*/
+NONSHARABLE_CLASS( CDataVolume ) : public CActive
+    {
+    public: // Constructors and destructor
+        CDataVolume(
+                CConnMonServer* aServer,
+                RConnection* aConnection,
+                const TUint& aConnectionId );
+        void Construct();
+        ~CDataVolume();
+
+
+    public: // New methods
+        /**
+        * Requests an asyncronous service (data volumes) from RConnection.
+        * @since
+        * @param
+        * @return void
+        */
+        void Receive();
+
+    private: // Methods from base classes
+        /**
+        * From CActive Cancels the asyncronous request
+        * @since
+        * @param
+        * @return void
+        */
+        void DoCancel();
+
+        /**
+        * From CActive Handles the data that has arrived from RConnection.
+        * @since
+        * @param
+        * @return void
+        */
+        void RunL();
+
+    private: // Data
+        CConnMonServer* iServer;       // Not owned
+        RConnection*    iConnection;   // Not owned
+        const TUint     iConnectionId;
+        TUint           iDlData;
+        TPckg<TUint>    iPckgDlData;
+        TUint           iUlData;
+        TPckg<TUint>    iPckgUlData;
+    };
+
+#endif // CONNMON_CDATAVOLUME_H
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/inc/CEventQueue.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,100 @@
+/*
+* Copyright (c) 2002-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:  Event queue stores an event until all the clients can
+*                receive it.
+*
+*/
+
+#ifndef CONNMONCEVENTQUEUE_H
+#define CONNMONCEVENTQUEUE_H
+
+#include <rconnmon.h>
+
+#include "ConnMonDef.h"
+
+class CConnMonSession;
+
+/**
+* TEventNode
+*/
+class TEventNode
+    {
+private:
+    TSglQueLink iLink;
+public:
+    TEvent iEvent;
+    };
+
+/**
+* CEventQueue
+* Singly linked list.
+*/
+NONSHARABLE_CLASS( CEventQueue ) : public CBase
+    {
+public:
+    /**
+     * Constructor.
+     */
+    void ConstructL( CConnMonServer* aServer );
+
+    /**
+     * Destructor.
+     */
+    ~CEventQueue();
+
+public:
+    /**
+     * Adds a new event to the queue.
+     * @param aEventInfo Event to be added.
+     */
+    void Add( const TEventInfo& aEventInfo, const TUint8* aPtr = NULL, TInt aSize = 0 );
+
+    /**
+     * Scans the event queue to find a new event for the session.
+     * @param aSession The session requesting a new event.
+     */
+    void CheckEvents( CConnMonSession* aSession );
+
+    /**
+     * Removes an event from the event queue.
+     * @param aEventNode Pointer to event node to be removed.
+     */
+    void FreeEvent( TEventNode* aEventNode );
+
+    /**
+     * Returns the time of the latest event.
+     * @return TTime.
+     */
+    TTime LastEventTime() const
+        {
+        return iLastEventTime;
+        }
+
+private: // Data
+    // Pointer to the server
+    CConnMonServer* iServer;
+
+    // Time of the latest event
+    TTime iLastEventTime;
+
+    // List of events
+    TSglQue<TEventNode> iEvents;
+
+    // List of free slots
+    TSglQue<TEventNode> iSlots;
+    };
+
+#endif // CONNMONCEVENTQUEUE_H
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/inc/CIapSupport.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,66 @@
+/*
+* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Provides IAP availability information.
+*
+*/
+
+#ifndef __CIAPSUPPORT_H
+#define __CIAPSUPPORT_H
+
+// To initialize with an invalid value
+const TUint KIapSupportUnknown = static_cast<TUint>( -1 );
+
+class TFullIapInfo;
+
+/**
+ * CIapSupport
+ * @lib CONNMON.LIB
+ */
+NONSHARABLE_CLASS( CIapSupport ) : public CBase
+    {
+public: // Constructors and destructor
+    static CIapSupport* NewL();
+    virtual ~CIapSupport();
+
+public: // New methods
+    /**
+     * Gets (reads) IAPs (iapID) from commDB.
+     * @since
+     * @param aBearerId The beared ID. Identifies the bearer.
+     * @param aIapBuf On return, contains IAPs matching the bearer ID.
+     * @return void.
+     */
+    void GetIapsFromCommDbL(
+            const TUint& aBearerId,
+            TFullIapInfo& aIapBuf ) const;
+
+private: // New methods
+    /**
+     * Appends IAPs (iapID and netID) from commDB to aIapBuf.
+     * @since
+     * @param aBearerId The beared ID. Identifies the bearer.
+     * @param aIapBuf On return, contains IAPs matching the bearer ID.
+     * @return void.
+     */
+    void AppendIapsFromCommDbL(
+            const TUint& aBearerId,
+            TFullIapInfo& aIapBuf ) const;
+
+private:
+    CIapSupport();
+    };
+
+#endif // __CIAPSUPPORT_H
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/inc/CPlugin.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,214 @@
+/*
+* Copyright (c) 2003-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:  Plug-in object subsession.
+*
+*/
+
+#ifndef __CPLUGIN_H
+#define __CPLUGIN_H
+
+#include <rconnmon.h>
+#include "ConnMonSess.h"
+
+_LIT( KPluginName,"Plugin[%08x]");
+
+/**
+*  TAttributeRequest
+*  Record for the plug-in's request to serve the next attribute query.
+*  @lib CONNMONEXT.LIB
+*  @since
+*/
+class TAttributeRequest
+    {
+    public:
+        // Constructor
+        TAttributeRequest( TUint aType,
+                           TUint aAttribute,
+                           TUint aData );
+    public:
+        inline void Reset(){ iType = 0; iAttribute = 0; iData = 0; }
+
+    public: // Data
+        TUint iType;
+        TUint iAttribute;
+        TUint iData;
+    };
+
+/**
+*  TClientRequest
+*  Record for a pending client requst.
+*  This request has not yet been completed in the server side.
+*  @lib CONNMON.LIB
+*  @since
+*/
+class TClientRequest
+    {
+    public: // Constructor
+        TClientRequest( TUint aType, TBool aPending, const RMessage2& aMessage )
+            : iType( aType ),
+              iPending( aPending  ),
+              iMessage( aMessage ) {};
+
+    public: // Data
+        // Type of the request
+        TUint iType;
+
+        // Has the request been sent to the plug-in
+        TBool iPending;
+
+        // Client message
+        const RMessage2 iMessage;
+    };
+
+
+/**
+*  CPlugin
+*  @lib CONNMONEXT.LIB
+*  @since
+*/
+NONSHARABLE_CLASS( CPlugin ) : public CObject
+    {
+    public: // Constructors and destructor
+        ~CPlugin();
+        static CPlugin* NewL( CConnMonSession* aSession, const TUint aPluginId );
+
+    public: // New methods (called by the PLUGIN)
+        /**
+        * Registers a new attribute.
+        * @since
+        * @param aAttribute, The attribute identifier.
+        * @return KErrNone if successfull, otherwise a system wide error code..
+        */
+        TInt RegisterAttribute( const TUint aAttribute );
+
+        /**
+        * Cancels the attribute registration.
+        * @since
+        * @param aAttribute, The attribute identifier.
+        * @return KErrNone if successfull, otherwise a system wide error code.
+        */
+        TInt CancelRegisterAttribute( const TUint aAttribute );
+
+        /**
+        * Handles a new event sent by the plugin.
+        * @since
+        * @param aMessage The message object.
+        * @param aPtr Pointer to extra buffer.
+        * @param aSize Size of the extra buffer.
+        * @return KErrNone if successfull, otherwise a system wide error code.
+        */
+        TInt Event( const RMessage2& aMessage,
+                    TEventInfo&      aEventInfo,
+                    TUint8*&         aPtr,
+                    TInt&            aSize  ) const;
+
+        /**
+        * Handles the attribute sent by the plugin.
+        * @since
+        * @param aMessage The message object.
+        * @return KErrNone if successfull, otherwise a system wide error code.
+        */
+        TInt Attribute( const RMessage2& aMessage );
+
+        /**
+        * Sends the next attribute request to the plugin.
+        * @since
+        * @return KErrNone or KRequestPending if successfull, otherwise a system wide error code.
+        */
+        TInt GetQuery();
+
+        /**
+        * Sends the next attribute request to the plugin (plugin is explicitly requesting the
+        * the next attribute request).
+        * @since
+        * @param aMessage The message object.
+        * @return KErrNone or KRequestPending if successfull, otherwise a system wide error code.
+        */
+        TInt GetQuery( const RMessage2& aMessage );
+
+        /**
+        * Cancels the query issued by the plugin.
+        * @since
+        * @return KErrNone if successfull, otherwise a system wide error code.
+        */
+        TInt CancelGetQuery();
+
+    public: // New methods (called by a CLIENT)
+        /**
+        * Handles an attribute request issued by a client.
+        * @since
+        * @param aType The type of the attribute (TInt, TUint, TBool, TDes, TDes8).
+        * @param aMessage Message sent by the client
+        * @return KRequestPending if successfull, otherwise a system wide error code.
+        */
+        TInt GetAttributeForClient( const TInt aType, const RMessage2& aMessage );
+
+         /**
+        * Cancels the attribute request issued by a client.
+        * @since
+        * @param aClient Reference to the client thread.
+        * @param aType The type of the attribute (TInt, TUint, TBool, TDes, TDes8).
+        * @return void.
+        */
+        void CancelGetAttributeForClient( const RThread& aClient, const TInt aType );
+
+        /**
+        * Handles a request to set a value for an attribute issued by a client.
+        * @since
+        * @param aType The type of the attribute (TInt, TUint, TBool, TDes, TDes8).
+        * @param aMessage Message sent by the client
+        * @return KErrNone if successfull, otherwise a system wide error code.
+        */
+        TInt SetAttributeForClient( const TInt aType, const RMessage2& aMessage );
+
+    private:
+        CPlugin();
+
+        /**
+        * Second phase construction.
+        * @since
+        * @param aSession Session owning this plug-in object.
+        * @param aPluginId Generic bearer specific connection id that identifies the plug-in.
+        * @return void
+        */
+        void ConstructL( CConnMonSession* aSession, const TUint aPluginId );
+
+        /**
+        * Panics the client thread that has a request pending (because of a bad descriptor).
+        * @since
+        * @param aPanic The panic code.
+        * @param aMessage The pending message object.
+        * @return void
+        */
+        void PanicWaitingClient( TInt aPanic, const RMessage2& aMessage ) const;
+
+    private: // Data
+        CConnMonSession*           iSession;
+        TUint                      iPluginId;
+        RArray< TUint >            iAttributesSupported;
+        RArray< TClientRequest >   iClientRequests;
+
+        // True if plugin has a request active
+        TBool iPluginReqActive;
+
+        // The request message plugin has sent
+        RMessage2  iPluginReqMessage;
+
+        // Pointer to the plugin memory area for the attribute request
+        const TAny* iPluginReqBuffer;
+    };
+
+#endif //__CPLUGIN_H
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/inc/CPsdFax.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,486 @@
+/*
+* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  PSD fax connection information.
+*
+*/
+
+#ifndef __CPSDFAX_H
+#define __CPSDFAX_H
+
+#include <etel.h>
+#include <etelmm.h>
+#include <etelpckt.h>
+#include <pcktcs.h>
+#include <rconnmon.h>
+
+#include "ConnMonDef.h"
+
+class CConnMonServer;
+class CPsdFaxUpNotifier;
+class CPsdFaxStatusNotifier;
+class CPsdFaxConnectionData;
+
+_LIT( KExternalName, "external" );
+
+// max PSD connection number
+const TInt KMaxPsdConnectionCount = 2;
+
+
+/**
+ * CPsdFax
+ * @lib CONMONN.LIB
+ */
+NONSHARABLE_CLASS( CPsdFax ) : public CBase
+    {
+    public:
+        // constructors and destructor
+        CPsdFax(
+                CConnMonServer* aServer,
+                RTelServer* aTelServer,
+                RMobilePhone* aMobilePhone,
+                RPacketService* aPacketService );
+
+        void ConstructL();
+        ~CPsdFax();
+
+        /**
+        * Opens the PDP context.
+        * @since
+        * @param aIndex The index of the PSD connection data table.
+        * @param aName The name of the context.
+        * @return KErrNone if successfull, otherwise a system wide error code.
+        */
+        TInt OpenContext( const TUint aIndex, const TDes& aName );
+
+        /**
+        * Checks if external PDP context is still valid.
+        * @since
+        * @param aConnectionId The connection ID of the PSD connection.
+        * @return ETrue if context is valid, EFalse otherwise.
+        */
+        TBool IsValid( const TUint aConnectionId );
+
+        /**
+        * Checks PSD connection data table index
+        * @since
+        * @param aConnectionId The connection ID of the PSD connection.
+        * @return index if found, ohterwise otherwise a system wide error code.
+        */
+        TInt ConnectionIndex( const TUint aConnectionId );
+
+        /**
+        * Sets connection ID
+        * @since
+        * @param aIndex The connection index of the PSD connection.
+        * @param aConnectionId The connection ID of the PSD connection.
+        * @return KErrNone if successfull, otherwise a system wide error code.
+        */
+        TInt SetConnectionId( const TUint aIndex, const TUint aConnectionId );
+
+        /**
+        * Gets the fax bearer.
+        * @since
+        * @param aBearer On return, contains the bearer.
+        * @param aBearerInfo On return, contains the detailed(new concept) bearer.
+        * @return KErrNone if successfull, otherwise a system wide error code.
+        */
+        TInt GetBearer( TInt& aBearer, TBearerInfo& aBearerInfo );
+
+        /**
+        * Gets the access point name of the fax connection.
+        * @since
+        * @param aConnectionId The connection ID of the PSD connection.
+        * @param aName On return, contains the access point name.
+        * @return KErrNone if successfull, otherwise a system wide error code.
+        */
+        TInt GetApn( const TUint aConnectionId, TDes& aName );
+
+        /**
+        * Gets the protocol type of the fax connection.
+        * @since
+        * @param aConnectionId The connection ID of the PSD connection.
+        * @param aProtocolType On return, contains the protocol type.
+        * @return KErrNone if successfull, otherwise a system wide error code.
+        */
+        TInt GetProtocolType( const TUint aConnectionId, TInt& aProtocolType );
+
+        /**
+        * Gets the status of the fax connection.
+        * @since
+        * @param aConnectionId The connection ID of the PSD connection.
+        * @param aStatus On return, contains the connection status.
+        * @return KErrNone if successfull, otherwise a system wide error code.
+        */
+        TInt GetStatus( const TUint aConnectionId, TInt& aStatus );
+
+        /**
+        * Gets the amount of data sent and received (in bytes).
+        * @since
+        * @param aConnectionId The connection ID of the PSD connection.
+        * @param aDLVolume On return, contains the amount received data.
+        * @param aULVolume On return, contains the amount sent data.
+        * @return KErrNone if successfull, otherwise a system wide error code.
+        */
+        TInt GetDataVolumes( const TUint aConnectionId, TUint& aDLVolume, TUint& aULVolume );
+
+        /**
+        * Gets the amount of data sent and received (in bytes).
+        * @since
+        * @param aConnectionId The connection ID of the PSD connection.
+        * @param aTime On return, contains start time of the connection.
+        * @return KErrNone if successfull, otherwise a system wide error code.
+        */
+        TInt GetStartTime( const TUint aConnectionId, TTime& aTime );
+
+        /**
+        * Stops the external connection.
+        * @since
+        * @param aConnectionId The connection ID of the PSD connection.
+        * @return KErrNone if successfull, otherwise a system wide error code.
+        */
+        TInt Stop( const TUint aConnectionId );
+
+         /**
+        * Delete connections allocated recources.
+        * @since
+        * @return void
+        */
+        void DeleteConnections();
+
+    private:
+
+    private: // Data
+        // Pointer to ConnMon server
+        CConnMonServer* iServer;
+
+        // Pointer to ETel server
+        RTelServer* iTelServer;
+
+        // Pointer to mobile phone
+        RMobilePhone* iMobilePhone;
+
+        // Pointer to the packet service
+        RPacketService* iPacketService;
+
+        // Connection up event watcher
+        CPsdFaxUpNotifier* iConnUpNotifier;
+
+        // Data table for each connection
+        CPsdFaxConnectionData* iConnectionData[KMaxPsdConnectionCount];
+    };
+
+
+/**
+ * CPsdFaxUpNotifier
+ * @lib CONNMON.LIB
+ */
+NONSHARABLE_CLASS( CPsdFaxUpNotifier ) : public CActive
+    {
+    public: // Constructors and destructor
+        CPsdFaxUpNotifier(
+                CPsdFax* aFaxModule,
+                CConnMonServer* aServer,
+                RPacketService* aPacketService );
+
+        void Construct();
+        ~CPsdFaxUpNotifier();
+
+    public:  // New methods
+        /**
+        * Requests a new event (connection up) from ETEL.
+        * @since
+        * @param
+        * @return void
+        */
+        void Receive();
+
+    private: // Methods from base classes
+         /**
+        * From CActive Cancels the asyncronous request
+        * @since
+        * @param
+        * @return void
+        */
+        void DoCancel();
+
+         /**
+        * From CActive Handles the the event that has arrived from ETEL.
+        * @since
+        * @param
+        * @return void
+        */
+        void RunL();
+
+    private: // Data
+        CPsdFax*        iFaxModule;
+        CConnMonServer* iServer;
+        RPacketService* iPacketService;
+        TBuf<KMaxName>  iName;
+        TEventInfo      iEventInfo;
+    };
+
+
+/**
+ * CPsdFaxConnectionData
+ * @lib CONNMON.LIB
+ */
+NONSHARABLE_CLASS( CPsdFaxConnectionData ) : public CBase
+    {
+    public: // Constructors and destructor
+        CPsdFaxConnectionData(
+                CPsdFax* aFaxModule,
+                CConnMonServer* aServer,
+                RPacketService* aPacketService );
+
+        void ConstructL();
+        TInt Construct();
+        ~CPsdFaxConnectionData();
+
+        /**
+        * Opens the PDP context.
+        * @since
+        * @param aName The name of the context.
+        * @return KErrNone if successfull, otherwise a system wide error code.
+        */
+        TInt OpenContext( const TDes& aName );
+
+        /**
+        * Closes the PDP context.
+        * @since
+        * @return void
+        */
+        void CloseContext();
+
+        /**
+        * Checks if the PDP context is open.
+        * @since
+        * @return ETrue if context is open, EFalse otherwise.
+        */
+        TBool IsOpen();
+
+        /**
+        * Gets the amount of data sent and received (in bytes).
+        * @since
+        * @param aDLVolume On return, contains the amount received data.
+        * @param aULVolume On return, contains the amount sent data.
+        * @return KErrNone if successfull, otherwise a system wide error code.
+        */
+        TInt GetDataVolumes( TUint& aDLVolume, TUint& aULVolume ) const;
+
+        /**
+        * Stops the external connection.
+        * @since
+        * @return KErrNone if successfull, otherwise a system wide error code.
+        */
+        TInt Stop();
+
+        /**
+        * Removes connection from server tables.
+        * @since
+        * @return void.
+        */
+        void RemoveFromServer();
+
+        /**
+        * Sets connection ID.
+        * @since
+        * @param aConnectionId The connection ID of the PSD connection.
+        * @return void.
+        */
+        void SetConnectionId( const TUint& aConnectionId );
+
+        /**
+        * Gets connection ID.
+        * @since
+        * @return connection ID.
+        */
+        TUint ConnectionId() const;
+
+        /**
+        * Resets connection start time.
+        * @since
+        * @return void.
+        */
+        void ResetStartTime();
+
+        /**
+        * Gets connection start time.
+        * @since
+        * @return KErrNone if successfull, otherwise a system wide error code.
+        */
+        TInt GetStartTime( TTime& aTime ) const;
+
+        /**
+        * Gets the access point name of the fax connection.
+        * @since
+        * @param aName On return, contains the access point name.
+        * @return KErrNone if successfull, otherwise a system wide error code.
+        */
+        TInt GetApn( TDes& aName );
+
+        /**
+        * Converts the access point name to correct format (UNICODE).
+        * @since
+        * @param aResult On return, contains the access point name in correct format.
+        * @param aName Access point name in the original format (UNICODE).
+        * @return void.
+        */
+        void ConvertAPN( TDes& aResult, const TDesC& aName ) const ;
+
+        /**
+        * Converts the access point name to correct format (UNICODE).
+        * @since
+        * @param aResult On return, contains the access point name in correct format.
+        * @param aName Access point name in the original format (UTF8).
+        * @return void.
+        */
+        void ConvertAPN( TDes& aResult, const TDesC8& aName ) const;
+
+        /**
+        * Gets the protocl type of the fax connection.
+        * @since
+        * @param aProtocolType On return, contains the protocol type.
+        * @return KErrNone if successfull, otherwise a system wide error code.
+        */
+        TInt GetProtocolType( TInt& aProtocolType );
+
+        /**
+        * Gets the status of the fax connection.
+        * @since
+        * @param aStatus On return, contains the connection status.
+        * @return KErrNone if successfull, otherwise a system wide error code.
+        */
+        TInt GetStatus( TInt& aStatus ) const;
+
+        /**
+        * Maps the PDP context status to nifvar values
+        * @since
+        * @param aStatus On return, contains the mapped connection status.
+        * @return KErrNone if successfull, otherwise a system wide error code.
+        */
+        TInt MapStatus( TInt& aStatus ) const;
+
+        /**
+        * Checks if the context is closed.
+        * @since
+        * @return ETrue if context is closed, EFalse otherwise.
+        */
+        TBool IsEnded();
+
+
+    private:
+        // Connection ID
+        TUint iConnectionId;
+
+        // ETrue if context is open
+        TBool iOpen;
+
+        // ETrue if start time is valid
+        TBool iTimeValid;
+
+        // ETrue if connection has been up and then ended (killed)
+        TBool iEnded;
+
+        // Start time
+        TTime iStartTime;
+
+        // Open fax context
+        RPacketContext iContext;
+
+        // pointer to PsdFax module
+        CPsdFax* iFaxModule;
+
+        // pointer to ConnMon server
+        CConnMonServer* iServer;
+
+        // pointer to packet service
+        RPacketService* iPacketService;
+
+        // Connection status event watcher
+        CPsdFaxStatusNotifier* iStatusNotifier;
+    };
+
+
+/**
+ * CPsdFaxStatusNotifier
+ * @lib CONNMON.LIB
+ */
+NONSHARABLE_CLASS( CPsdFaxStatusNotifier ) : public CActive
+    {
+    public: // Constructors and destructor
+        CPsdFaxStatusNotifier(
+                CPsdFax* aFaxModule,
+                CConnMonServer* aServer,
+                RPacketService* aPacketService,
+                CPsdFaxConnectionData* aConnDataModule );
+
+        void Construct();
+        ~CPsdFaxStatusNotifier();
+
+    public:  // New methods
+        /**
+        * Starts listening to status change events from ETEL.
+        * @since
+        * @param aContext The open context to listen to.
+        * @return void
+        */
+        void Start( const RPacketContext& aContext );
+
+        /**
+        * Requests a new event (status changed) from ETEL.
+        * @since
+        * @param
+        * @return void
+        */
+        void Receive();
+
+    private: // Methods from base classes
+         /**
+        * From CActive Cancels the asyncronous request
+        * @since
+        * @param
+        * @return void
+        */
+        void DoCancel();
+
+         /**
+        * From CActive Handles the the event that has arrived from ETEL.
+        * @since
+        * @param
+        * @return void
+        */
+        void RunL();
+
+    private:  // New methods
+        /**
+        * Sends connection create event to client.
+        * @since
+        * @return KErrNone if successfull, otherwise a system wide error code.
+        */
+        TInt SendConnectionCreateEvent();
+
+    private: // Data
+        CPsdFax*                       iFaxModule;
+        CConnMonServer*                iServer;
+        RPacketService*                iPacketService;
+        CPsdFaxConnectionData*         iConnDataModule;
+        TEventInfo                     iEventInfo;
+        RPacketContext                 iContext;
+        RPacketContext::TContextStatus iContextStatus;
+
+    };
+
+#endif // __CPSDFAX_H
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/inc/CUiDialogAO.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,72 @@
+/*
+* 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:  Displays a dialog on the UI with the help of Symbian OS
+*                notification services.
+*
+*/
+
+#ifndef __CUIDIALOGAO_H
+#define __CUIDIALOGAO_H
+
+#include <cdblen.h>
+
+const TUid KUidSelectNetwork = { 0x101F6D16 };
+
+class CConnMonServer;
+
+/**
+ * CUiDialogAO
+ * Timer that cancel activity notifier after one second.
+ * @lib CONNMON.LIB
+ */
+NONSHARABLE_CLASS( CUiDialogAO ) : public CActive
+    {
+public:
+    static CUiDialogAO* NewL( CConnMonServer* aServer );
+    virtual ~CUiDialogAO();
+
+public:
+    /**
+     * Starts canceller timer.
+     * @return KErrNone if OK, otherwise a system wide error code.
+     */
+    void Start();
+
+private:
+    /**
+     * From CActive Cancels the timer.
+     * @return void
+     */
+    void DoCancel();
+
+    /**
+     * From CActive Cancels the activity notifier and destroys itself.
+     * @return void
+     */
+    void RunL();
+
+private:
+    CUiDialogAO( CConnMonServer* aServer );
+    void ConstructL();
+
+private:
+    CConnMonServer* iServer;
+    TPtrC8 iDummy;
+    TBuf8< KCommsDbSvrMaxFieldLength > iNetIds;
+    RNotifier iNotifier;
+    };
+
+#endif //__CUIDIALOGAO_H
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/inc/CWlanSupport.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,794 @@
+/*
+* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Provides an interface to WLAN Engine.
+*
+*/
+
+#ifndef CONNMONCWLANSUPPORT_H
+#define CONNMONCWLANSUPPORT_H
+
+#include <wlanmgmtclient.h>
+#include <wlanscaninfo.h>
+#include <commsdat.h>
+#include <wlancontainer.h>
+#include <rconnmon.h>
+
+#include "ConnMonServ.h"
+#include "connmonwlannetwork.h"
+
+
+// Information Element ID for SSID as in 802.11.
+const TUint8 KWlan802Dot11SsidIE = 0;
+
+// Information Element ID for Rsn as in 802.11
+const TUint8 KWlan802Dot11RsnIE = 48;
+
+// Information Element ID for Wpa as in 802.11
+const TUint8 KWlan802Dot11WpaIE = 221;
+
+// Information Element ID for Vendor data as in 802.11
+const TUint8 KWlan802Dot11VendorSpecificIE = 221;
+
+// Bit mask for Capability info field to get type (Infra/AdHoc).
+const TUint8 KWlan802Dot11CapabilityEssMask = 0x0001;
+
+// Bit mask for Capability info field to get type (Infra/AdHoc).
+const TUint8 KWlan802Dot11CapabilityPrivacyMask = 0x0010;
+
+// Control header length for a beacon raw buffer in CWlanScanInfo.
+const TInt KWlanProbeControlHeaderLength = 12;
+
+enum TConnMonWlanRssClass
+     {
+     EConnMonWlanRssClassUnknown = 0,
+     EConnMonWlanRssClassWeak,
+     EConnMonWlanRssClassNormal
+     };
+
+class CConnMonServer;
+class CConnMonSession;
+class CWlanEvent;
+class CWlanSession;
+class CWlanGetScanResults;
+class CWlanGetSsidScanResults;
+
+
+/**
+* CWlanSupport
+*/
+NONSHARABLE_CLASS( CWlanSupport ) : public CBase
+    {
+public:
+    static CWlanSupport* NewL( CConnMonServer* aServer );
+    virtual ~CWlanSupport();
+
+public:
+    /**
+     * Gets the WLAN bearer availability information.
+     * @param aAvailability On return, contains WLAN availability (yes/no) information.
+     * @param aDoScan If this is set to ETrue scan results will be used instead of event info.
+     * @return KErrNone when successfull, otherwise a system wide error code.
+     */
+    void GetBearerAvailabilityL( TBool& aAvailability );
+
+    TInt GetBearerAvailabilityL( const RMessage2& aMessage, TBool& aAvailability );
+
+    /**
+     * Gets the the signal strength of the active WLAN connection.
+     * When there are no connections, gets the signal strength of
+     * the best available WLAN.
+     * @param aSignalStrength On return, contains the signal strength.
+     * @return KErrNone when successfull, otherwise a system wide error code.
+     */
+    TInt GetSignalStrengthL( const RMessage2& aMessage, TInt& aSignalStrength );
+
+    /**
+     * Gets information on available WLAN networks (SSID, signal strength, type).
+     * @return KErrNone when successfull, otherwise a system wide error code.
+     */
+    TInt GetNetworkNamesL( const RMessage2& aMessage );
+
+    /**
+     * Parse WLAN network names from scan results.
+     * @since 5.0
+     * @param aScanInfo Contains WLAN scan results
+     * @param aNetInfo On return, contains information on available WLAN networks.
+     */
+    void ParseNetworkNamesL( CWlanScanInfo* aScanInfo, TConnMonNetworkNames& aNetInfo );
+
+    /**
+     * Appends available WLAN IAPs.
+     * @param aIapBuf On return, contains the available WLAN IAPs.
+     * @return KErrNone when successfull, otherwise a system wide error code.
+     */
+    TInt AppendAvailableIaps( RArray<TUint>& aIdArray );
+
+    /**
+     * When a WLAN connection is up, appends all WLAN IAP IDs that have the same
+     * SSID as the current connection (SSID sharing), to the array given as
+     * argument. IAP info is read from CommsDat.
+     * @since 3.2
+     * @param aIapBuf On return, contains the available WLAN IAP IDs.
+     * @return KErrNone when successfull, KErrDisconnected if there is no active
+     * WLAN connection and otherwise a system wide error code.
+     */
+    TInt AppendAvailableIapsBySsidL( RArray<TUint>& aIdArray );
+
+    /**
+     * Gets network name as UNICODE.
+     * @param aSsid On return, contains the SSID as UNICODE.
+     * @return KErrNone when successfull, otherwise a system wide error code.
+     */
+    TInt GetConnectionSsid( TDes& aSsid );
+
+    /**
+     * Gets connection mode (e.g. infra/ad hoc).
+     * @param aConnectionMode On return, contains the connection mode.
+     * @return KErrNone when successfull, otherwise a system wide error code.
+     */
+    TInt GetConnectionMode( TInt& aConnectionMode );
+
+    /**
+     * Gets connection security mode.
+     * @param aConnectionSecurity On return, contains the connection security mode.
+     * @return KErrNone when successfull, otherwise a system wide error code.
+     */
+    TInt GetConnectionSecurity( TInt& aConnectionSecurity );
+
+    /**
+     * Gets connection signal quality.
+     * @param aSignalQuality On return, contains the connection signal quality.
+     * @return KErrNone when successfull, otherwise a system wide error code.
+     */
+    TInt GetConnectionSignalQuality( TInt& aSignalQuality );
+
+    /**
+     * Gets connection BSSID.
+     * @param aBssid On return, contains the connection BSSID.
+     * @return KErrNone when successfull, otherwise a system wide error code.
+     */
+    TInt GetConnectionBssid( TBuf8<CConnMonWlanNetwork::KWlanBssId>& aBssid );
+
+    /**
+     * Gets the used transmit power.
+     * @param aPower On return, contains the used transmit power in mW.
+     * @return KErrNone when successfull, otherwise a system wide error code.
+     */
+    TInt GetTransmitPower( TUint& aPower );
+
+    /**
+     * Activates WLAN Management API events.
+     * @return void.
+     */
+    void ActivateNotificationsL();
+
+    /**
+     * Cancels WLAN Management API events.
+     */
+    void CancelNotifications();
+
+    /**
+     * Gets information on available WLAN networks (SSID, signal strength, type).
+     * @param aWlanNetworks On return, contains information on available WLAN networks.
+     */
+    void GetWLANNetworksL( RConnMonWLANNetworksArray& aWlanNetworks );
+
+    /**
+     * Gets information on available WLAN networks (SSID, signal strength, type, BssId).
+     * @since 3.2
+     * @return KErrNone when successfull, otherwise a system wide error code.
+     */
+    TInt GetWlanNetworksL( const RMessage2& aMessage );
+
+    /**
+     * Parse WLAN networks information (SSID, signal strength, type, BssId).
+     * @since 5.0
+     * @param aScanInfo Contains WLAN scan results
+     * @param aWlanNetworks On return, contains information on available WLAN networks.
+     */
+    void ParseWlanNetworksL(
+            CWlanScanInfo* aScanInfo,
+            RConnMonWlanNetworksPtrArray& aWlanNetworks );
+
+    /**
+     * Ordering method of TConnMonNetwork class objects.
+     * @param aFirst First object for comparison
+     * @param aSecond Second object for comparison
+     * @return -1 if aFirst.iSignalStrength >  aSecond.iSignalStrength
+     *          1 if aFirst.iSignalStrength <  aSecond.iSignalStrength
+     *          0 if aFirst.iSignalStrength == aSecond.iSignalStrength
+     */
+    static TInt CompareNetworkStrengths(
+            const TConnMonNetwork& aFirst,
+            const TConnMonNetwork& aSecond );
+
+    /**
+     * Gets current WLAN networks information (SSID, signal strength, type, BssId).
+     * @since 5.0
+     * @param aWlanNetwork On return, contains information on current WLAN network.
+     * @return KErrNone when successfull, otherwise a system wide error code.
+     */
+    TInt GetCurrentWlanNetworkL( RConnMonWlanNetworksPtrArray& aWlanNetwork );
+
+    /**
+     * Gets WLAN probe raw buffers.
+     * @since 5.0
+     * @return KErrNone when successfull, otherwise a system wide error code.
+     */
+    TInt GetWlanProbeRawBuffersL( const RMessage2& aMessage );
+
+    /**
+     * Parse WLAN networks probe raw buffers.
+     * @since 5.0
+     * @param aScanInfo Contains WLAN scan results
+     * @param aWlanProbeRawBuffers On return, contains WLAN probe raw buffers.
+     */
+    void ParseWlanProbeRawBuffersL(
+            CWlanScanInfo* aScanInfo,
+            RConnMonWlanProbeRawBuffersPtrArray& aWlanProbeRawBuffers );
+
+    /**
+     * Gets SSID specific WLAN network information (SSID, signal strength, type, BssId).
+     * @since 5.0
+     * @return KErrNone when successfull, otherwise a system wide error code.
+     */
+    TInt GetWlanSsidNetworksL( const RMessage2& aMessage );
+
+    /**
+     * Enables WLAN scan for the next iap availability query.
+     */
+    void EnableWlanScan() { iEnableScan = ETrue; };
+
+    /**
+     * Check WLAN session index.
+     * @since 5.0
+     * @param aSessionId Session specific ID to compare array IDs
+     * @return index number or system wide error code.
+     */
+    TInt WlanSessionIndex( CConnMonSession* aSessionId );
+
+    /**
+     * Add WLAN session.
+     * @since 5.0
+     * @param aMessage Client message
+     * @return index number for the session in the WLAN sessions array
+     */
+    TInt AddWlanSessionL( const RMessage2& aMessage );
+
+    /**
+     * Delete WLAN session.
+     * @since 5.0
+     * @param aMessage Client message
+     */
+    void DeleteWlanSession( CConnMonSession* aSessionId );
+
+    /**
+     * Sets WLAN TInt attribute (KWlanScanCacheLifeTime).
+     * @since 5.0
+     * @param aAttribute Attribute to be set
+     * @param aValue Value to be set
+     * @return KErrNone when successfull, otherwise a system wide error code.
+     */
+    TInt SetIntAttributeL( const RMessage2& aMessage, const TInt aValue );
+
+    /**
+     * Sets WLAN TUint attribute (KWlanScanMaxDelay).
+     * @since 5.0
+     * @param aAttribute Attribute to be set
+     * @param aValue Value to be set
+     * @return KErrNone when successfull, otherwise a system wide error code.
+     */
+    TInt SetUintAttributeL( const RMessage2& aMessage, const TUint aValue );
+
+    /**
+     * Gets WLAN TInt attribute (KWlanScanCacheLifeTime).
+     * @since 5.0
+     * @param aAttribute Attribute to be get
+     * @param aValue On return contains the value of attribute
+     * @return KErrNone when successfull, otherwise a system wide error code.
+     */
+    TInt GetIntAttributeL( const RMessage2& aMessage, TInt& aValue );
+
+    /**
+     * Gets WLAN TUInt attribute (KWlanScanMaxDelay).
+     * @since 5.0
+     * @param aAttribute Attribute to be get
+     * @param aValue On return contains the value of attribute
+     * @return KErrNone when successfull, otherwise a system wide error code.
+     */
+    TInt GetUintAttributeL( const RMessage2& aMessage, TUint& aValue );
+
+    /**
+     * Sets WLAN String attribute (KWlanSsid etc).
+     * @since 5.0
+     * @param aAttribute Attribute to be set
+     * @param aValue Value to be set
+     * @return KErrNone when successfull, otherwise a system wide error code.
+     */
+    TInt SetStringAttributeL( const RMessage2& aMessage, const TDes& aValue );
+
+    /**
+     * Gets WLAN String attribute (KWlanSsid etc).
+     * @since 5.0
+     * @param aAttribute Attribute to be get
+     * @param aValue Value to be get
+     * @return KErrNone when successfull, otherwise a system wide error code.
+     */
+    TInt GetStringAttributeL( const RMessage2& aMessage, TDes& aValue );
+
+    /**
+     * Cancel all client asynch requests for WLAN engine.
+     * @since 5.0
+     * @param aMessage Client message
+     * @return KErrNone when successfull, otherwise a system wide error code.
+     */
+    TInt CancelAsyncRequest( const RMessage2& aMessage );
+
+    /**
+     * Enables sending of WLAN events to clients. Set when there is a client
+     * listening to events.
+     *
+     * @since S60 v5.2
+     */
+    void EnableEventsToClients();
+
+    /**
+     * Disables sending of WLAN events to clients. Set when there is no longer
+     * any clients listening to events.
+     *
+     * @since S60 v5.2
+     */
+    void DisableEventsToClients();
+
+    /**
+     * Checks if sending of events to clients is enabled.
+     *
+     * @since S60 v5.2
+     * @return ETrue if events are enabled, EFalse otherwise.
+     */
+    TBool EventsToClientsEnabled();
+
+    /**
+     * Checks the class of the WLAN received signal strength, based on WLAN
+     * engine events. Returns EFalse only if a weak signal event has been
+     * received from WLAN engine.
+     *
+     * @since S60 v5.2
+     * @return EFalse if signal level is weak (for certain), ETrue otherwise.
+     */
+    TBool WlanRssGoodEnough();
+
+private:
+    CWlanSupport( CConnMonServer* aServer );
+
+    /**
+     * Second phase construction.
+     */
+    void ConstructL();
+
+private: // Data
+    // Pointer to server module
+    CConnMonServer* iServer;
+
+    // WLAN Management API handle
+    CWlanMgmtClient* iWlanMgmt;
+
+    // WLAN event watcher object
+    CWlanEvent* iEventWatcher;
+
+    // Stores available WLAN iaps until next scan
+    RArray<TUint> iAvailableWlanIapsCache;
+
+    // Scan is allowed when ETrue. Initialized to ETrue in constructor.
+    TBool iEnableScan;
+
+    // Pointer table to session specific WLAN data objects
+    RPointerArray<CWlanSession> iWlanSessionsPtrArray;
+
+    // Event sending status
+    TBool iEnableEventsToClients;
+    };
+
+/**
+* CWlanEvent
+*/
+NONSHARABLE_CLASS( CWlanEvent ) : public CBase, public MWlanMgmtNotifications
+    {
+public:
+    static CWlanEvent* NewL( CWlanSupport* aWlanSupport, CConnMonServer* aServer );
+    virtual ~CWlanEvent();
+
+public:
+    TBool WlanAvailability() { return iWlanAvailable; }
+    TBool HasAvailabilityKnowledge() { return iHasAvailabilityKnowledge; }
+    TUint TxPower() { return iTxPower; }
+    TUint RssClass() { return iRssClass; }
+    TUint Rss() { return iRss; }
+
+public: // From MWlanMgmtNotifications
+    /**
+     * New networks have been detected during scan.
+     */
+    void NewNetworksDetected();
+
+    /**
+     * One or more networks have been lost since the last scan.
+     */
+    void OldNetworksLost();
+
+    /**
+     * The used transmit power has been changed.
+     * @param aPower The transmit power in mW.
+     */
+    void TransmitPowerChanged( TUint aPower );
+
+    /**
+     * Connection status has changed.
+     *
+     * @since S60 v5.2
+     * @param aNewState specifies the new connection state.
+     */
+    void ConnectionStateChanged( TWlanConnectionMode aNewState );
+
+    /**
+     * Received signal strength level has been changed.
+     *
+     * @since S60 v5.2
+     * @param aRssClass specifies the current class of the received signal.
+     * @param aRss RSS level in absolute dBm values.
+     */
+    void RssChanged( TWlanRssClass aRssClass, TUint aRss );
+
+private:
+    // Constructor
+    CWlanEvent( CWlanSupport* aWlanSupport, CConnMonServer* aServer );
+
+private: // Data
+    // Pointer to WLAN support object
+    CWlanSupport* iWlanSupport;
+
+    // Pointer to server object
+    CConnMonServer* iServer;
+
+    // WLAN bearer availability information. Valid only after
+    // 'iHasAvailabilityKnowledge' has been set to true.
+    TBool iWlanAvailable;
+
+    // When this flag is true, it means the 'iWlanAvailable' flag has a correct
+    // value. The flag is set to true after the first NewNetworksDetected or
+    // OldNetworksLost event is received.
+    TBool iHasAvailabilityKnowledge;
+
+    // The used transmit power in mW.
+    TUint iTxPower;
+
+    // The RSS class (unknown/weak/normal) for the current WLAN connection.
+    TInt iRssClass;
+
+    // The RSS (in absolute dBm) for the current WLAN connection. Updated by
+    // events, so not always accurate (depends on event thresholds).
+    TUint iRss;
+    };
+
+
+/**
+* CWlanSession
+* @since 5.0
+*/
+NONSHARABLE_CLASS( CWlanSession ) : public CBase
+    {
+public:
+    static CWlanSession* NewL( CConnMonSession* aSessionId, CWlanSupport* aWlanSupport );
+    virtual ~CWlanSession();
+
+public:
+    /**
+     * Get client WLAN session ID.
+     * @return CConnMonSession*.
+     */
+    inline CConnMonSession* GetSessionId() { return iSessionId; }
+
+    /**
+     * Set client WLAN session ID.
+     * @param aSessionId The session ID of the client.
+     */
+    inline void SetSessionId( CConnMonSession* aSessionId ) { iSessionId = aSessionId; }
+
+    /**
+     * Get client WLAN scan max delay.
+     * @return iWlanScanMaxDelay.
+     */
+    inline TUint GetWlanScanMaxDelay() { return iWlanScanMaxDelay; }
+
+    /**
+     * Set client WLAN scan max delay.
+     * @param aWlanScanMaxDelay Client WLAN scan max delay.
+     */
+    inline void SetWlanScanMaxDelay( const TUint& aWlanScanMaxDelay )
+        {
+        iWlanScanMaxDelay = aWlanScanMaxDelay;
+        }
+
+    /**
+     * Get client WLAN scan cache lifetime.
+     * @return iWlanScanCacheLifetime.
+     */
+    inline TInt GetWlanScanCacheLifetime() { return iWlanScanCacheLifetime; }
+
+    /**
+     * Set client WLAN scan cache lifetime. This is used if KWlanScanMaxDelay is set to 0.
+     * Any negative value will be changed to -1. This means WLAN engine will use the default
+     * device setting for cache lifetime value.
+     * @param aWlanScanCacheLifetime Client WLAN scan cache lifetime.
+     */
+    void SetWlanScanCacheLifetime( const TInt& aWlanScanCacheLifetime );
+
+    /**
+     * Get client WLAN SSID.
+     * @param aWlanSsid On return contais client SSID.
+     */
+    inline void GetWlanSsid( TBuf8<CConnMonWlanNetwork::KMaxNameLength>& aWlanSsid )
+        {
+        aWlanSsid = iWlanSsid;
+        }
+
+    /**
+     * Set client WLAN SSID.
+     * @param aWlanSsid Client WLAN SSID to be set.
+     */
+    inline void SetWlanSsid( const TBuf8<CConnMonWlanNetwork::KMaxNameLength>& aWlanSsid )
+        {
+        iWlanSsid = aWlanSsid;
+        }
+
+    /**
+     * Get WLAN scan result from WLAN engine.
+     * @param aMessage Client request message.
+     */
+    void GetScanResultsL( const RMessage2& aMessage );
+
+    /**
+     * Get WLAN SSID scan result from WLAN engine.
+     * @param aMessage Client request message.
+     */
+    TInt GetSsidScanResultsL( const RMessage2& aMessage );
+
+    /**
+     * Complete all pending asynch requests to client.
+     * @param aStatus Status of the scan.
+     * @param aScanInfo Object containing scan results.
+     * @param aSsidScan Flag telling if it was SSID scan.
+     */
+    void CompleteActiveRequestsL(
+            const TInt aStatus,
+            CWlanScanInfo* aScanInfo,
+            const TBool aSsidScan = EFalse );
+
+    /**
+     * Complete GetBearerAvailabilityRequest to client.
+     * @param aScanInfo Object containing scan results.
+     * @param aIndex Index of the pending message table.
+     */
+    void CompleteGetBearerAvailabilityRequest(
+            CWlanScanInfo* aScanInfo,
+            const TUint aIndex );
+
+    /**
+     * Complete GetSignalStrengthRequest to client.
+     * @param aScanInfo Object containing scan results.
+     * @param aIndex Index of the pending message table.
+     */
+    void CompleteGetSignalStrengthRequest(
+            CWlanScanInfo* aScanInfo,
+            const TUint aIndex );
+
+    /**
+     * Complete GetNetworkNamesRequest to client.
+     * @param aScanInfo Object containing scan results.
+     * @param aIndex Index of the pending message table.
+     */
+    void CompleteGetNetworkNamesRequestL(
+            CWlanScanInfo* aScanInfo,
+            const TUint aIndex );
+
+    /**
+     * Complete GetWlanNetworksRequest to client.
+     * @param aScanInfo Object containing scan results.
+     * @param aIndex Index of the pending message table.
+     */
+    void CompleteGetWlanNetworksRequestL(
+            CWlanScanInfo* aScanInfo,
+            const TUint aIndex );
+
+    /**
+     * Complete GetWlanSsidNetworksRequest to client.
+     * @param aScanInfo Object containing scan results.
+     * @param aIndex Index of the pending message table.
+     */
+    void CompleteGetWlanSsidNetworksRequestL(
+            CWlanScanInfo* aScanInfo,
+            const TUint aIndex );
+
+    /**
+     * Complete GetWlanProbeRawBuffersRequest to client.
+     * @param aScanInfo Object containing scan results.
+     * @param aIndex Index of the pending message table.
+     */
+    void CompleteGetWlanProbeRawBuffersRequestL(
+            CWlanScanInfo* aScanInfo,
+            const TUint aIndex );
+
+    /**
+     * Cancel active asynch requests.
+     * @param aReqType Request type to be cancelled
+     */
+    void CancelActiveRequests( const TInt aReqType );
+
+    /**
+     * Completes all wlan requests of certain type with the given error code.
+     * @since S60 5.2
+     * @param aErrorCode The error code.
+     * @param aSsidScan Flag to distinguish between SSID scan based requests
+     * and normal scan based requests.
+     */
+    void CompleteActiveRequestsWithError(
+            const TInt aErrorCode,
+            const TBool aSsidScan = EFalse );
+
+private:
+    // Constructor
+    CWlanSession( CConnMonSession* aSessionId, CWlanSupport* aWlanSupport );
+
+private: // Data
+    // Session ID
+    CConnMonSession* iSessionId;
+
+    // Pointer to WLAN support object
+    CWlanSupport* iWlanSupport;
+
+    // GetScanResults AO
+    CWlanGetScanResults* iGetScanResultsAO;
+
+    // GetSsidScanResults AO
+    CWlanGetSsidScanResults* iGetSsidScanResultsAO;
+
+    // WLAN scan max delay
+    TUint iWlanScanMaxDelay;
+
+    // WLAN scan cache lifetime
+    TInt iWlanScanCacheLifetime;
+
+    // WLAN SSID descriptor
+    TBuf8<CConnMonWlanNetwork::KMaxNameLength> iWlanSsid;
+
+    // Table for pending async. requests
+    RArray<RMessage2> iWlanRequestsArray;
+    };
+
+
+/**
+* CWlanGetScanResults
+* @since 5.0
+*/
+NONSHARABLE_CLASS( CWlanGetScanResults ) : public CActive
+    {
+public:
+    static CWlanGetScanResults* NewL( CWlanSession* aWlanSession );
+    ~CWlanGetScanResults();
+
+public:
+    /**
+     * Requests a new event (scan done) from WLAN.
+     * @since 5.0
+     */
+    void StartL();
+
+private:
+    // Constructor
+    CWlanGetScanResults( CWlanSession* aWlanSession );
+
+    // Second phase constructor
+    void ConstructL();
+
+private:
+    /**
+     * From CActive Cancels the asyncronous request from WLAN engine
+     * @since 5.0
+     */
+    void DoCancel();
+
+    /**
+     * From CActive Handles the the event that has arrived from WLAN.
+     * @since 5.0
+     */
+    void RunL();
+
+    /**
+     * From CActive, handles leaves from RunL.
+     * @since S60 5.2
+     * @param aLeaveCode The leave code.
+     */
+    TInt RunError( TInt aLeaveCode );
+
+private: // Data
+    // WlanSession pointer
+    CWlanSession* iWlanSession;
+
+    // WLAN Management API handle
+    CWlanMgmtClient* iWlanMgmt;
+
+    // Scan info
+    CWlanScanInfo* iScanInfo;
+    };
+
+
+/**
+* CWlanGetSsidScanResults
+* @since 5.0
+*/
+NONSHARABLE_CLASS( CWlanGetSsidScanResults ) : public CActive
+    {
+public:
+    static CWlanGetSsidScanResults* NewL( CWlanSession* aWlanSession );
+    ~CWlanGetSsidScanResults();
+
+public:
+    /**
+     * Requests a new event (scan done) from WLAN.
+     * @since 5.0
+     * @param
+     */
+    void StartL( TBuf8<CConnMonWlanNetwork::KMaxNameLength>& aWlanSsid );
+
+private:
+    // Constructor
+    CWlanGetSsidScanResults( CWlanSession* aWlanSession );
+
+    // Second phase constructor
+    void ConstructL();
+
+private:
+    /**
+     * From CActive Cancels the asyncronous request from WLAN engine
+     * @since 5.0
+     */
+    void DoCancel();
+
+    /**
+     * From CActive Handles the the event that has arrived from WLAN.
+     * @since 5.0
+     */
+    void RunL();
+
+    /**
+     * From CActive, handles leaves from RunL.
+     * @since S60 5.2
+     * @param aLeaveCode The leave code.
+     */
+    TInt RunError( TInt aLeaveCode );
+
+private: // Data
+    // WlanSession pointer
+    CWlanSession* iWlanSession;
+
+    // WLAN Management API handle
+    CWlanMgmtClient* iWlanMgmt;
+
+    // Scan info
+    CWlanScanInfo* iScanInfo;
+    };
+
+#endif // CONNMONCWLANSUPPORT_H
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/inc/ConnMonAvailabilityManager.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,83 @@
+/*
+* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Provides declarations for the availability manager.
+*
+*/
+
+#ifndef CONNMONAVAILABILITYMANAGER_H
+#define CONNMONAVAILABILITYMANAGER_H
+
+#include <e32base.h>
+
+class CConnMonCommsDatCache;
+class CConnMonServer;
+
+/**
+ * Availability manager
+ * Availability manager class declaration
+ */
+class CConnMonAvailabilityManager : public CBase
+    {
+public:
+    /**
+     * Two phase constructor.
+     * @param aIapsAvailabilityManager IapsAvailabilityManager
+     * @param aCommsDataNotifier CommsDataNotifier
+     */
+    static CConnMonAvailabilityManager* NewL(
+            CConnMonCommsDatCache* aCommsDatCache,
+            CConnMonServer* aConnMonServer );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CConnMonAvailabilityManager();
+
+    /**
+     * Handles availability change.
+     */
+    void HandleAvailabilityChange();
+
+    /**
+     * Called when any CenRep CommsDat table listener receives a notification
+     */
+    void CommsDatEventReceivedL( const TUint32 aTableId );
+
+private:
+    /**
+     * Constructor.
+     * @param aIapsAvailabilityManager IapsAvailabilityManager
+     * @param aCommsDataNotifier CommsDataNotifier
+     */
+    CConnMonAvailabilityManager(
+            CConnMonCommsDatCache* aCommsDatCache,
+            CConnMonServer* aConnMonServer );
+
+private: // Data
+    /**
+     * CommsDat cache
+     * Not own
+     */
+    CConnMonCommsDatCache* iCommsDatCache;
+
+    /**
+     * Link to Server and IAP services and data
+     * Not own
+     */
+    CConnMonServer* iConnMonServer;
+    };
+
+#endif // CONNMONAVAILABILITYMANAGER_H
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/inc/ConnMonBearer.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,80 @@
+/*
+* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Declares bearer abstraction class.
+*
+*/
+
+#ifndef CONNMONBEARER_H
+#define CONNMONBEARER_H
+
+#include <e32def.h>
+
+class CConnMonIAP;
+class CConnMonCommsDatCache;
+
+/**
+ * Abstraction for Bearer
+ * Class declaration for bearer abstraction
+ */
+class TConnMonBearer
+    {
+public:
+    /**
+     * Constructor.
+     * @param aConnMonIAP Link to IAP services
+     */
+    TConnMonBearer( CConnMonIAP* aConnMonIAP, CConnMonCommsDatCache* aCommsDatCache );
+
+    /**
+     * Is the bearer available
+     * @param aAvailable ETrue if bearer is available
+     * @return errorcode
+     */
+    virtual TInt GetAvailability( TBool& aAvailable ) const = 0;
+
+    /**
+     * Bearer ID getter
+     *
+     * @return bearer ID
+     */
+    virtual TUint BearerId() const = 0;
+
+    /**
+     * Invariant - validates object
+     *
+     * @return ETrue if bearer is valid (internal state is correct)
+     */
+    virtual TBool Valid() const = 0;
+
+    /**
+     * Checks IAPs belonging to this bearer and sets the availability flag of
+     * those IAPs in CommsDat cache.
+     */
+    virtual void FlagAvailableIaps() const = 0;
+
+protected: // Data
+    /**
+     * Link to IAP services
+     */
+    CConnMonIAP* iConnMonIAP;
+
+    /**
+     * Link to CommsDat cache
+     */
+    CConnMonCommsDatCache* iCommsDatCache;
+    };
+
+#endif // CONNMONBEARER_H
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/inc/ConnMonBearerCSD.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Declaration for bearer CSD.
+*
+*/
+
+#ifndef CONNMONBEARERCSD_H
+#define CONNMONBEARERCSD_H
+
+#include "ConnMonBearer.h"
+
+/**
+ * TConnMonBearerCSD
+ * Class declaration for CSD bearer
+ */
+class TConnMonBearerCSD : public TConnMonBearer
+    {
+public:
+    /**
+     * Constructor.
+     * @param aConnMonIAP Link to IAP services
+     */
+    TConnMonBearerCSD( CConnMonIAP* aConnMonIAP, CConnMonCommsDatCache* aCommsDatCache );
+
+    // From TConnMonBearer
+
+    /**
+     * Is the bearer available
+     * @param aAvailable ETrue if bearer is available
+     * @return errorcode
+     */
+    TInt GetAvailability( TBool& aAvailable ) const;
+
+    /**
+     * Bearer ID getter
+     *
+     * @return bearer ID
+     */
+    TUint BearerId() const;
+
+    /**
+     * Invariant - validates bearer
+     *
+     * @return ETrue if bearer is valid (internal state is correct)
+     */
+    TBool Valid() const;
+
+    /**
+     * Sets available IAPs of this type as available in CommsDat cache
+     */
+    void FlagAvailableIaps() const;
+    };
+
+#endif // CONNMONBEARERCSD_H
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/inc/ConnMonBearerGPRS.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Declaration for bearer GPRS.
+*
+*/
+
+#ifndef CONNMONBEARERGPRS_H
+#define CONNMONBEARERGPRS_H
+
+#include "ConnMonBearer.h"
+
+/**
+ * TConnMonBearerGPRS
+ * Class declaration for GPRS bearer
+ */
+class TConnMonBearerGPRS : public TConnMonBearer
+    {
+public:
+    /**
+     * Constructor.
+     * @param aConnMonIAP Link to IAP services
+     */
+    TConnMonBearerGPRS( CConnMonIAP* aConnMonIAP, CConnMonCommsDatCache* aCommsDatCache );
+
+    // From TConnMonBearer
+
+    /**
+     * Is the bearer available
+     * @param aAvailable ETrue if bearer is available
+     * @return errorcode
+     */
+    TInt GetAvailability( TBool& aAvailable ) const;
+
+    /**
+     * Bearer ID getter
+     *
+     * @return bearer ID
+     */
+    TUint BearerId() const;
+
+    /**
+     * Invariant - validates bearer
+     *
+     * @return ETrue if bearer is valid (internal state is correct)
+     */
+    TBool Valid() const;
+
+    /**
+     * Sets available IAPs of this type as available in CommsDat cache
+     */
+    void FlagAvailableIaps() const;
+    };
+
+#endif // CONNMONBEARERGPRS_H
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/inc/ConnMonBearerGroupManager.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,72 @@
+/*
+* Copyright (c) 2006-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:  Defines the mappings and services between bearers and
+*                bearer groups.
+*
+*/
+
+#ifndef CONNMONBEARERGROUPMANAGER_H
+#define CONNMONBEARERGROUPMANAGER_H
+
+#include <e32std.h>
+#include <rconnmon.h>
+
+/**
+ * Bearer group mappings and services.
+ */
+NONSHARABLE_CLASS( CConnMonBearerGroupManager )
+    {
+public:
+    /**
+     * Constructor.
+     */
+    static CConnMonBearerGroupManager* NewL();
+
+    /**
+     * Destructor.
+     */
+    ~CConnMonBearerGroupManager();
+
+    /**
+    * Returns the bearer group masks related to given bearer.
+    *
+    * @param aBearer Detailed bearer to identify the groups wanted.
+    * @param aBearerGroups1 On return, the bearer groups masked to integer.
+    * @param aBearerGroups2 On return, the bearer groups masked to integer.
+    * @return System-wide error code is returned if no success. Otherwise KErrNone.
+    */
+    TInt GetBearerGroups(
+            const TConnMonBearerInfo aBearer,
+            TUint& aBearerGroups1,
+            TUint& aBearerGroups2 );
+
+private:
+    /**
+     * Constructor.
+     */
+    CConnMonBearerGroupManager();
+
+    /**
+     * Second-phase constructor.
+     */
+    void ConstructL();
+
+private: // Data
+    RArray<TUint> iBearerGroupMasks1;
+    RArray<TUint> iBearerGroupMasks2;
+    };
+
+#endif // CONNMONBEARERGROUPMANAGER_H
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/inc/ConnMonBearerLAN.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Declaration for bearer LAN.
+*
+*/
+
+#ifndef CONNMONBEARERLAN_H
+#define CONNMONBEARERLAN_H
+
+#include "ConnMonBearer.h"
+
+/**
+ * TConnMonBearerLAN
+ * Class declaration for LAN bearer
+ */
+class TConnMonBearerLAN : public TConnMonBearer
+    {
+public:
+    /**
+     * Constructor.
+     * @param aConnMonIAP Link to IAP services
+     */
+    TConnMonBearerLAN( CConnMonIAP* aConnMonIAP, CConnMonCommsDatCache* aCommsDatCache );
+
+    // From TConnMonBearer
+
+    /**
+     * Is the bearer available
+     * @param aAvailable ETrue if bearer is available
+     * @return errorcode
+     */
+    TInt GetAvailability( TBool& aAvailable ) const;
+
+    /**
+     * Bearer ID getter
+     *
+     * @return bearer ID
+     */
+    TUint BearerId() const;
+
+    /**
+     * Invariant - validates bearer
+     *
+     * @return ETrue if bearer is valid (internal state is correct)
+     */
+    TBool Valid() const;
+
+    /**
+     * Sets available IAPs of this type as available in CommsDat cache
+     */
+    void FlagAvailableIaps() const;
+    };
+
+#endif // CONNMONBEARERLAN_H
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/inc/ConnMonBearerNotifier.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,74 @@
+/*
+* Copyright (c) 2006-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:  Active object to listen for EGPRS and HSxPA notifications.
+*
+*/
+
+#ifndef CONNMONBEARERNOTIFIER_H
+#define CONNMONBEARERNOTIFIER_H
+
+#include <rconnmon.h>
+
+#include "ConnMonDef.h"
+
+class CConnMonServer;
+class RMobilePhone;
+class CConnMonEGprsNotifier;
+class CConnMonHsdpaNotifier;
+
+/**
+* CBearerNotifier
+*/
+NONSHARABLE_CLASS( CConnMonBearerNotifier )
+    {
+public:
+    static CConnMonBearerNotifier* NewL(
+            CConnMonServer* aServer,
+            RMobilePhone& aMobilePhone,
+            TUint& aConnectionId );
+    virtual ~CConnMonBearerNotifier();
+
+public:
+    void Listen();
+    void CancelListen();
+    TBool Listening();
+    void SendBearerGroupEvent();
+    void SendBearerGroupEvent( TConnMonBearerInfo& aBearerInfo );
+
+    void SendBearerInfoEvent();
+
+    /**
+     * Handles the events from the edge and hsdpa notifiers.
+     */
+    void HandleEvent();
+
+private:
+    CConnMonBearerNotifier(
+            CConnMonServer* aServer,
+            RMobilePhone& aMobilePhone,
+            TUint& aConnectionId );
+    void ConstructL();
+
+private:
+    CConnMonServer* iServer;
+    RMobilePhone& iMobilePhone;
+    CConnMonEGprsNotifier* iEGprsNotifier;
+    CConnMonHsdpaNotifier* iHsdpaNotifier;
+    TEventInfo iEventInfo;
+    TUint iConnectionId;
+    };
+
+#endif // CONNMONBEARERNOTIFIER_H
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/inc/ConnMonBearerWLAN.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,66 @@
+/*
+* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Declaration for bearer WLAN.
+*
+*/
+
+#ifndef CONNMONBEARERWLAN_H
+#define CONNMONBEARERWLAN_H
+
+#include "ConnMonBearer.h"
+
+ /**
+ * TConnMonBearerWLAN
+ * Class declaration for WLAN bearer
+ */
+class TConnMonBearerWLAN : public TConnMonBearer
+    {
+public:
+    /**
+     * Constructor.
+     * @param aConnMonIAP Link to IAP services
+     */
+    TConnMonBearerWLAN( CConnMonIAP* aConnMonIAP, CConnMonCommsDatCache* aCommsDatCache );
+
+public:
+    /**
+     * Is the bearer available
+     * @param aAvailable ETrue if bearer is available
+     * @return errorcode
+     */
+    TInt GetAvailability( TBool& aAvailable ) const;
+
+    /**
+     * Bearer ID getter
+     *
+     * @return bearer ID
+     */
+    TUint BearerId() const;
+
+    /**
+     * Invariant - validates bearer
+     *
+     * @return ETrue if bearer is valid (internal state is correct)
+     */
+    TBool Valid() const;
+
+    /**
+     * Sets available IAPs of this type as available in CommsDat cache
+     */
+    void FlagAvailableIaps() const;
+    };
+
+#endif // CONNMONBEARERWLAN_H
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/inc/ConnMonCli.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,88 @@
+/*
+* Copyright (c) 2002-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:  CConnMonEventHandler is a hidden active object to receive
+*                notifications on behalf of a client application.
+*
+*/
+
+#ifndef CONNMONCLI_H
+#define CONNMONCLI_H
+
+void Panic( TInt aPanic );
+
+/**
+* CConnMonEventHandler
+*/
+NONSHARABLE_CLASS( CConnMonEventHandler ) : public CActive
+    {
+public:
+    CConnMonEventHandler(
+            MConnectionMonitorObserver* aObserver,
+            RConnectionMonitor& aSession );
+    void Construct();
+    ~CConnMonEventHandler();
+
+public:
+    /**
+     * Requests a new event from the server.
+     */
+    void ReceiveNotification();
+
+    /**
+     * Pauses receiving events.
+     */
+    void Pause();
+
+    /**
+     * Continues receiving events.
+     * @param aObserver The event observer implemented by the client.
+     */
+    void Continue( MConnectionMonitorObserver* aObserver );
+
+private:
+    /**
+     * From CActive Handles the event that has arrived from the server.
+     */
+    void RunL();
+    /**
+     * From CActive Cancels the request from the server.
+     */
+    void DoCancel();
+
+private: // Data
+    // Handle to the client session
+    RConnectionMonitor& iSession;
+
+    // Pointer to the observer interface
+    MConnectionMonitorObserver* iObserver;
+
+    // The event. It will be sent to the client
+    CConnMonEventBase* iConnMonEvent;
+
+    // Event information
+    TEventInfo iEventInfo;
+
+    // Needed in inter-thread reads/writes
+    TPtr8 iBuf;
+
+    // Events are not requested from the server when iPause=ETrue
+    TBool iPause;
+
+    // For big events
+    TConnMonExtraBuf iExtraBuf;
+    };
+
+#endif // CONNMONCLI_H
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/inc/ConnMonDef.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,253 @@
+/*
+* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Definitions common to server and client API.
+*
+*/
+
+#ifndef CONNMONDEF_H
+#define CONNMONDEF_H
+
+#include <e32base.h>
+#include <rconnmon.h>
+
+// Constants
+
+// Maximum connection identifier
+const TUint KMaxConnectionId = 1000000;
+
+// Number of message slots in the client-server interface
+// 1 common slot for all synchronous methods + 1 for each asyncronous method
+// = 1 common + 6 async client api methods + 1 for events
+const TInt KNumMessageSlots = 8;
+
+// Number of slots in CEventQueue
+const TInt KEventQueueSize = 25;
+
+// Number of pointers allocated for client-server inter-thread reads/writes
+const TInt KNumPtrs = 12;
+
+// Server will shutdown after a 2 second period after the last client
+// has disconnected. Note. Don't make this smaller. CTimerAO relies on this.
+const TUint KConnMonShutdownInterval = 2000000;
+
+// Update ConnMon documentation (attributes KDownlinkDataThreshold and
+// KUplinkDataThreshold) if changing these values (4096, 20480, 51200, 102400).
+const TUint KMinimumDataThreshold      = 4096;
+const TUint KMinimumGPRSDataThreshold  = 20480;
+const TUint KMinimumWCDMADataThreshold = 51200;
+const TUint KMinimumWLANDataThreshold  = 102400;
+
+// Update ConnMon documentation (attribute KActivityTimeThreshold) if changing
+// this value (KMinimumActivityThreshold = 5)
+const TUint KMinimumActivityThreshold = 5;
+
+// CSD/HSCSD in is not valid untill call is open
+const TInt KBearerQueryCount   = 5;
+const TInt KBearerQueryTimeout = 100000;
+
+const TUid KConnMonServerUid = { 0x101F6CF0 };
+const TUid KConnMonDllUid    = { 0x101F6CEE };
+const TUid KGenericDllUid    = { 0x1000008c };
+
+_LIT( KConnectionMonitorServerName, "!ConnectionMonitorServer" );
+
+_LIT( KConnectionMonitorServerExe, "ConnMonExe" );
+_LIT( KDoubleColon, "::" );
+
+_LIT( KPanicCaughtAnError, "ConnMon: cought an error." );
+_LIT( KPanicBadParameter, "ConnMon: bad parameter." );
+
+// Data types
+enum TConnMonPanic
+    {
+    // Server
+    ECannotStartServer              = 100,
+    EBadRequest                     = 101,
+    EBadDescriptor                  = 102,
+    EErrorFromNonClientObject       = 103,
+    EReceiveAlreadyActive           = 104,
+    EIapArrayError                  = 105,
+    EConnMonBadHandle               = 106,
+
+    // Used by Client API
+    EConnMonPanicClientNotConnected = 150
+    };
+
+enum TConnMonThreshold
+     {
+     EDownlinkThreshold = 0,
+     EUplinkThreshold,
+     EActivityTimeThreshold,
+     EBearerAvailabilityThreshold,
+     ESignalStrengthThreshold
+     };
+
+enum TConnMonConnFlags
+    {
+    EConnTypeGPRS   = 0x01,
+    EConnTypeWCDMA  = 0x02,
+    EConnTypeCSD    = 0x04
+    };
+
+enum TConnMonNotifierPriority
+    {
+    EConnMonPriorityNormal = 0,
+    EConnMonPriorityMedium = 5,
+    EConnMonPriorityHigh   = 10
+    };
+
+/**
+ * TEventInfo
+ */
+class TEventInfo
+    {
+public:
+    inline void Reset()
+        {
+        iEventType = 0;
+        iConnectionId = 0;
+        iSubConnectionId = 0;
+        iData = 0;
+        iData2 = 0;
+        iData3 = 0;
+        }
+
+public: // Data
+    TInt iEventType;
+    TUint iConnectionId;
+    TUint iSubConnectionId;
+    TUint iData;
+    TUint iData2;
+    TUint iData3;
+    };
+
+// An additional buffer for events that contain a lot of data.
+// E.g. EConnMonIapAvailabilityChange -event uses this buffer.
+typedef TBuf8<256> TConnMonExtraBuf;
+
+/**
+ * TExtra
+ */
+class TExtra
+    {
+public:
+    inline void Reset()
+        {
+        iPtr = NULL;
+        iSize = 0;
+        }
+public: // Data
+    const TUint8* iPtr;
+    TUint iSize;
+    };
+
+/**
+ * TEvent
+ */
+class TEvent
+    {
+public:
+    TEventInfo iInfo;
+    TTime iTime;
+    TExtra iExtra;
+    };
+
+/**
+ * TFullIap
+ */
+class TFullIap
+    {
+public:
+    TUint iIapId;
+    TUint iNetId;
+    TUint iBearerId;
+    };
+
+class TFullIapInfo
+    {
+public:
+    inline void Reset()
+        {
+        iCount = 0;
+        for ( TUint i = 0; i < KConnMonMaxIAPCount; i++ )
+            {
+            iIap[i].iIapId = 0;
+            iIap[i].iNetId = 0;
+            iIap[i].iBearerId = 0;
+            }
+        }
+
+public:
+    TUint iCount;
+    TFullIap iIap[KConnMonMaxIAPCount];
+    };
+
+class TBearerInfo
+    {
+public:
+    TBearerInfo()
+        {
+        iBearer = 0;
+        iInternal = ETrue;
+        };
+    TBearerInfo( TInt aBearer, TBool aInternal )
+        {
+        iBearer = aBearer,
+        iInternal = aInternal;
+        }
+    inline void Reset()
+        {
+        iBearer = 0;
+        iInternal = ETrue;
+        }
+    TInt iBearer;
+    TBool iInternal;
+    };
+
+// Prefix 'ConnMon' used to avoid any future problems or name overlapping with
+// other similar implementations.
+template <class T>
+class ConnMonCleanupResetAndDestroy
+    {
+public:
+    inline static void PushL( T& aRef );
+
+private:
+    static void ResetAndDestroy( TAny *aPtr );
+    };
+
+template <class T>
+inline void ConnMonCleanupResetAndDestroyPushL( T& aRef );
+
+template <class T>
+inline void ConnMonCleanupResetAndDestroy<T>::PushL( T& aRef )
+    {
+    CleanupStack::PushL( TCleanupItem( &ResetAndDestroy, &aRef ) );
+    }
+
+template <class T>
+void ConnMonCleanupResetAndDestroy<T>::ResetAndDestroy( TAny *aPtr )
+    {
+    (STATIC_CAST(T*,aPtr))->ResetAndDestroy();
+    }
+
+template <class T>
+inline void ConnMonCleanupResetAndDestroyPushL( T& aRef )
+    {
+    ConnMonCleanupResetAndDestroy<T>::PushL( aRef );
+    }
+
+#endif // CONNMONDEF_H
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/inc/ConnMonEGprsNotifier.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,77 @@
+/*
+* 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:  Active object to listen for EGPRS notifications.
+*
+*/
+
+#ifndef CONNMONEGPRSNOTIFIER_H
+#define CONNMONEGPRSNOTIFIER_H
+
+#include <es_sock.h>
+#include <in_sock.h>
+#include <es_enum.h>
+#include <rmmcustomapi.h>
+
+// Forward declarations
+class CConnMonBearerNotifier;
+
+/**
+* CConnMonEGprsNotifier
+*/
+NONSHARABLE_CLASS( CConnMonEGprsNotifier ) : public CActive
+    {
+public:
+    static CConnMonEGprsNotifier* NewL(
+            CConnMonBearerNotifier* aObserver,
+            RMobilePhone& aMobilePhone );
+    virtual ~CConnMonEGprsNotifier();
+
+public:
+    /**
+     * Requests a new event (bearer (PSD) availability changed) from ETel.
+     * @param aKickOff If aKickOff is ETrue initial bearer status will be obtained from ETel.
+     */
+    void Receive();
+
+    TBool EGprsActive();
+
+private:
+    /**
+     * From CActive Cancels the asyncronous request.
+     */
+    void DoCancel();
+
+    /**
+     * From CActive Handles the the event that has arrived from ETel.
+     */
+    void RunL();
+
+private:
+    CConnMonEGprsNotifier(
+            CConnMonBearerNotifier* aObserver,
+            RMobilePhone& aMobilePhone );
+    void ConstructL();
+
+private: // Data
+    CConnMonBearerNotifier* iObserver;
+    RMobilePhone& iMobilePhone;
+    RMmCustomAPI::TGprsInformation iGprsInfo;
+    RMmCustomAPI::TGprsInformationPckg iGprsInfoPckg;
+    RMmCustomAPI iCustomApi;
+    TBool iEGprsActive;
+    };
+
+#endif // CONNMONEGPRSNOTIFIER_H
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/inc/ConnMonHsdpaNotifier.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,102 @@
+/*
+* Copyright (c) 2008 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:  Active object to listen for HSxPA notifications.
+*
+*/
+
+#ifndef CONNMONHSDPANOTIFIER_H
+#define CONNMONHSDPANOTIFIER_H
+
+#include <es_sock.h>
+#include <in_sock.h>
+#include <es_enum.h>
+
+// Forward declarations
+class CConnMonServer;
+
+/**
+ * CHsxpaAvailabilityNotifier
+ */
+NONSHARABLE_CLASS( CConnMonHsdpaNotifier ) : public CActive
+    {
+public:
+    static CConnMonHsdpaNotifier* NewL(
+            CConnMonBearerNotifier* aObserver,
+            CConnMonServer* aServer,
+            RMobilePhone& aMobilePhone );
+    virtual ~CConnMonHsdpaNotifier();
+
+public:
+    /**
+     * Requests a new event (bearer (PSD) availability changed) from ETel.
+     * @param aKickOff If aKickOff is ETrue initial bearer status will be obtained from ETel.
+     */
+    void Receive();
+
+    /**
+     * Get the current activity status of HSDPA
+     * @return Returns ETrue if HSDPA is active and EFalse if not.
+     */
+    TBool HsdpaActive();
+
+    /**
+     * Get the current activity status of HSUPA
+     * @since MCL 9.1
+     * @return Returns ETrue if HSUPA is active and EFalse if not.
+     */
+    TBool HsupaActive();
+
+    /**
+     * Returns the current HSxPA status.
+     * @since MCL 9.1
+     * @return EBearerInfoWCDMA if no high speed features in use, or
+     * EBearerInfoHSDPA / EBearerInfoHSUPA / EBearerInfoHSxPA.
+     */
+    TInt HsxpaStatus();
+
+private:
+    /**
+     * From CActive Cancels the asyncronous request
+     */
+    void DoCancel();
+
+    /**
+     * From CActive Handles the the event that has arrived from ETel.
+     */
+    void RunL();
+
+private:
+    CConnMonHsdpaNotifier(
+            CConnMonBearerNotifier* aObserver,
+            CConnMonServer* aServer,
+            RMobilePhone& aMobilePhone );
+    void Construct();
+
+
+private: // Data
+    CConnMonBearerNotifier* iObserver;
+    CConnMonServer* iServer;
+    RMobilePhone& iMobilePhone;
+    RPacketService iPacketService;
+    RPacketService::TDynamicCapsFlags iDynCaps;
+    TUint8 iPacketServLoaded; // 1 = packet services are loaded, 0 = not loaded
+    TBool iHsdpaActive;
+    TBool iHsupaActive;
+    TInt iHsxpaStatus;
+    TInt iPreviousHsxpaStatus;
+    };
+
+#endif // CONNMONHSDPANOTIFIER_H
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/inc/ConnMonIAP.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,910 @@
+/*
+* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Core functionality for ConnMon.
+*
+*/
+
+#ifndef CONNMONIAP_H
+#define CONNMONIAP_H
+
+#include <es_sock.h>
+#include <in_sock.h>
+#include <commdb.h>
+#include <es_enum.h>
+#include <etel.h>
+#include <etelmm.h>
+#include <etelpckt.h>
+#include <pcktcs.h>
+#include <rconnmon.h>
+
+#include "ConnMonDef.h"
+#include "CWlanSupport.h"
+#include "connmondtmnoti.h"
+#include "connmontelnoti.h"
+
+class CConnMonIAP;
+class CConnUpDownNotifier;
+class CProgressNotifier;
+class CDataNotifier;
+class CNetwStatusNotifier;
+class CNetwRegistrationNotifier;
+class CBearerNotifier;
+class CWcdmaBearerNotifier;
+class CModeNotifier;
+class CGsmSignalNotifier;
+class CBearerAvailabilityNotifier;
+class CSubConnUpDownNotifier;
+class CActivityNotifier;
+class CConnMonServer;
+class CDataVolume;
+class CCsdFax;
+class CPsdFax;
+class CWlanSupport;
+class CConnMonBearerNotifier;
+
+// Record name for WLAN bearer table
+_LIT( KWlanBearerRecordName, "WLANBearer" );
+
+const TInt KPhoneRetryCount = 7;
+const TInt KPhoneRetryTimeout = 100000;
+const TInt KConnMonSmallBufferLen = 30;
+const TInt KBitsInByte = 8;
+const TInt KAttributeParameterIndex = 3;
+
+/**
+* TConnInfo
+* Connection information record.
+*/
+class TConnInfo
+    {
+    public: // Constructors and destructor
+        TConnInfo(
+                TInt aIapId,
+                TInt aNetId,
+                TUint aConnectionId,
+                TInt aBearer,
+                TBearerInfo aBearerInfo );
+
+    public:
+        void Reset();
+        static TInt Compare( const TConnInfo& aFirst, const TConnInfo& aSecond );
+        static TBool MatchId( const TConnInfo& aFirst, const TConnInfo& aSecond );
+        static TBool MatchIap( const TConnInfo& aFirst, const TConnInfo& aSecond );
+        static TBool MatchBearer( const TConnInfo& aFirst,const TConnInfo& aSecond );
+
+    public: // Data
+        // IAP Id
+        TUint32 iIapId;
+
+        // Net Id
+        TUint32 iNetId;
+
+        // Unique connection id
+        TUint iConnectionId;
+
+        // Bearer type
+        TInt iBearer;
+
+        // RConnection object that is open and attached
+        RConnection* iConnAttach;
+
+        // Connection status notifier
+        CProgressNotifier* iProgressNotifier;
+
+        // Downlink data volume notifier
+        CDataNotifier* iDLDataNotifier;
+
+        // Uplink data volume notifier
+        CDataNotifier* iULDataNotifier;
+
+        // Active object for getting KDownlinkData and KUplinkData
+        CDataVolume* iDataVolumeAO;
+
+        // Connection down notifier
+        CSubConnUpDownNotifier* iConnDownNotifier;
+
+        // Connection activity notifier
+        CActivityNotifier* iActivityNotifier;
+
+        // 0 means that connection is idle
+        // 1 means that there is data moving through the connection
+        TUint8 iActivity;
+
+        // Bearer info
+        TBearerInfo iBearerInfo;
+
+        // BearerInfo/BearerGroup notifier
+        CConnMonBearerNotifier* iBearerNotifier;
+    };
+
+/**
+* CConnMonIAP
+*/
+NONSHARABLE_CLASS( CConnMonIAP )
+        :
+        public CBase,
+        public MConnMonTelephonyObserver,
+        public MConnMonDtmNotifierObserver
+    {
+    public: // Constructors and destructor
+        CConnMonIAP( CConnMonServer* aServer );
+        void ConstructL();
+        ~CConnMonIAP();
+
+    public: // New methods
+        /**
+         * Enumerates active connections.
+         * @since
+         * @param aCount On return, contains the number of the active connection
+         * @return KErrNone if successfull, otherwise a system wide error code.
+         */
+        TInt EnumerateConnections( TUint& aCount );
+
+        /**
+         * Enumerates active connections.
+         * @since
+         * @param aCount On return, contains the number of the active connection
+         * @param aEnumInfo On return, contains the enumarated connection ids.
+         * @return KErrNone if successfull, otherwise a system wide error code.
+         */
+        TInt EnumerateConnectionsL( TUint& aCount, CArrayFixFlat<TUint>& aEnumInfo );
+
+        /**
+         * Checks if given connection id is valid.
+         * @since
+         * @param aConnectionId Connection id.
+         * @return KErrNone if successfull, otherwise a system wide error code.
+         */
+        TBool ConnectionExists( const TUint& aConnectionId );
+
+        /**
+         * Gets the count of the subconnections.
+         * @since
+         * @param aConnectionId  Connection id.
+         * @param aSubConnectionCount On return, contains the count of the subconnections.
+         * @return KErrNone if successfull, otherwise a system wide error code.
+         */
+        TInt GetConnectionInfo( const TUint& aConnectionId, TUint& aSubConnectionCount );
+
+        /**
+         * Gets a TInt attribute.
+         * @since
+         * @param aMessage Reference to client message.
+         * @param aValue On return, contains the value.
+         * @return KErrNone if successfull, otherwise a system wide error code.
+         */
+        TInt GetIntAttributeL( const RMessage2& aMessage, TInt& aValue );
+
+        /**
+         * Gets a TUint attribute.
+         * @since
+         * @param aMessage Reference to client message.
+         * @param aValue On return, contains the value.
+         * @return KErrNone if successfull, otherwise a system wide error code.
+         */
+        TInt GetUintAttributeL( const RMessage2& aMessage, TUint& aValue );
+
+        /**
+         * Gets a TBool attribute.
+         * @since
+         * @param aMessage Reference to client message.
+         * @param aValue On return, contains the value.
+         * @return KErrNone if successfull, otherwise a system wide error code.
+         */
+        TInt GetBoolAttributeL( const RMessage2& aMessage, TBool& aValue );
+
+
+        /**
+         * Gets a TDes attribute.
+         * @since
+         * @param aMessage Reference to client message.
+         * @param aValue On return, contains the value.
+         * @return KErrNone if successfull, otherwise a system wide error code.
+         */
+        TInt GetStringAttribute( const RMessage2& aMessage, TDes& aValue );
+
+        /**
+         * Gets the UIDs of the clients using a connection. UIDs are 0 in WINS.
+         * @since
+         * @param aConnectionId  Connection id.
+         * @param aClientEnum On return, contains the count of the clients and their uids.
+         * @return KErrNone if successfull, otherwise a system wide error code.
+         */
+        TInt GetUids( const TUint aConnectionId, TConnMonClientEnum& aClientEnum );
+
+        /**
+         * Sets a TUint attribute.
+         * @since
+         * @param aMessage Reference to client message.
+         * @param aValue Value to be set.
+         * @return KErrNone if successfull, otherwise a system wide error code.
+         */
+        TInt SetUintAttribute( const RMessage2& aMessage, const TUint aValue );
+
+        /**
+         * Sets a TBool attribute.
+         * @since
+         * @param aMessage Reference to client message, containing the attribute information.
+         * @return KErrNone if successfull, otherwise a system wide error code.
+         */
+        TInt SetBoolAttribute( const RMessage2& aMessage );
+
+        /**
+         * Sets a String attribute.
+         * @since
+         * @param aMessage Reference to client message.
+         * @param aValue Value to be set.
+         * @return KErrNone if successfull, otherwise a system wide error code.
+         */
+        TInt SetStringAttributeL( const RMessage2& aMessage, const TDes& aValue );
+
+        /**
+         * Turns notifications ON.
+         */
+        void ListenL();
+
+        /**
+         * Turns notifications OFF.
+         * @since
+         * @return void
+         */
+        void CancelListen();
+
+        /**
+         * Adds a connection to the global array and starts notifications for it.
+         * @since
+         * @param aConnection New connection information.
+         * @return KErrNone if successfull, otherwise a system wide error code.
+         */
+        TInt AddConnectionL( TConnInfo& aConnection );
+
+        /**
+         * Removes connection from global array and stops notifications.
+         * @since
+         * @param aConnection Connection information.
+         * @return KErrNone if successfull, otherwise a system wide error code.
+         */
+        TInt RemoveConnection( TConnInfo& aConnection );
+
+        /**
+         * Gets a pointer to the RConnection handle.
+         * @since
+         * @return A pointer to the RConnection handle.
+         */
+        inline RConnection* Rconnection()
+            {
+            return &iConnection;
+            }
+
+        /**
+         * Gets a pointer to the packet service handle.
+         * @since
+         * @return A pointer to the packet service handle.
+         */
+        inline const RPacketService* PacketService() const
+            {
+            return &iPacketService;
+            }
+
+        /**
+         * Gets a pointer to the WLAN management services.
+         * @since
+         * @return A pointer to the WLAN management services.
+         */
+        inline CWlanSupport* WlanSupport()
+            {
+            return iWlanSupport;
+            }
+
+        /**
+         * Gets a pointer to the RMobilePhone handle.
+         * @since
+         * @return A pointer to the iMobilePhone member.
+         */
+        inline const RMobilePhone* MobilePhone() const
+            {
+            return &iMobilePhone;
+            }
+
+        /**
+         * Gets TConnMonNetworkStatus matching ETel network status.
+         * @since
+         * @param aPacketStatus Packet network status returned by ETel server.
+         * @return TConnMonNetworkStatus.
+         */
+        TInt CalculateNetworkStatus(
+                const RPacketService::TStatus& aPacketStatus ) const;
+
+        /**
+         * Gets TConnMonNetworkRegistration matching ETel network registration status.
+         * @since
+         * @param aRegistration Network registration status returned by ETel server.
+         * @return TConnMonNetworkRegistration.
+         */
+        TInt CalculateNetworkRegistration(
+                const RMobilePhone::TMobilePhoneRegistrationStatus& aRegistration ) const;
+
+        /**
+         * Gets TConnMonNetworkRegistration_v2 matching ETel network registration status.
+         * @since
+         * @param aRegistration Network registration status returned by ETel server.
+         * @return TConnMonNetworkRegistration_v2.
+         */
+        TInt CalculateNetworkRegistration_v2(
+                const RMobilePhone::TMobilePhoneRegistrationStatus& aRegistration ) const;
+
+        /**
+         * Tells whether this cell supports EdgeGPRS or GPRS.
+         * @since
+         * @return ETrue if cell supports Edge, EFalse otherwise.
+         */
+        TBool IsEdgeCell();
+
+        /**
+         * Tells whether this cell supports Hsdpa or WCDMA.
+         * @since
+         * @return ETrue if cell supports Hsdpa, EFalse otherwise.
+         */
+        TBool IsHsdpaCell();
+
+        /**
+         * Tells whether this cell supports Hsdpa and/or Hsupa.
+         * @since MCL 9.1
+         * @return EBearerInfoWCDMA if no high speed features detected, or
+         * EBearerInfoHSDPA / EBearerInfoHSUPA / EBearerInfoHSxPA.
+         */
+        TInt HsxpaStatus();
+
+        /**
+         * Gets the time when the connection has started.
+         * @since
+         * @param aConnectionId The connection id.
+         * @param aTime On return, contains the starting time of the connection.
+         * @return KErrNone if successfull, otherwise a system wide error code.
+         */
+        TInt GetStartTime( const TUint& aConnectionId, TTime& aTime );
+
+        /**
+         * Gets the bearer info for an internal connection.
+         * @since
+         * @param aConnectionId  Connection id.
+         * @param aBearer On return, contains the bearer.
+         * @return KErrNone if successfull, otherwise a system wide error code.
+         */
+        TInt GetBearer(
+                const TUint& aConnectionId,
+                TInt& aBearer,
+                TBearerInfo& aBearerInfo );
+
+        /**
+         * Updates activity information to connection array.
+         * @since
+         * @param aConnectionId The connection id.
+         * @param aActivity 0 means idle, 1 means active.
+         * @return KErrNone if successfull, otherwise a system wide error code.
+         */
+        TInt UpdateActivity( const TUint& aConnectionId, const TUint& aActivity );
+
+        /**
+         * Checks if subconnection level notifier has already sent connection
+         * closed event.
+         * @since
+         * @param aConnection The connection info. On return, will contain connection id.
+         * @param aSent On return, value is ETrue if event has been sent, EFalse otherwise.
+         * @return KErrNone if successfull, otherwise a system wide error code.
+         */
+        TBool GetDeleteNotifyStatus( TConnInfo& aConnection, TBool& aSent );
+
+        /**
+         * Gets a pointer to the activity notifier object for the given connection id.
+         * @since
+         * @param aConnectionId The connection id.
+         * @param aActivityNotifier On return, pointer to the activity notifier.
+         * @return KErrNone if successfull, otherwise a system wide error code.
+         */
+        TInt GetActivityNotifier(
+                const TUint& aConnectionId,
+                CActivityNotifier** aActivityNotifier );
+
+        /**
+         * Gets a pointer to the progress notifier object for the given connection id.
+         * @since
+         * @param aConnectionId The connection id.
+         * @param aProgressNotifier On return, pointer to the progress notifier.
+         * @return KErrNone if successfull, otherwise a system wide error code.
+         */
+        TInt GetProgressNotifier(
+                const TUint& aConnectionId,
+                CProgressNotifier** aProgressNotifier );
+
+        /**
+         * Gets a pointer to the subconnection up/down notifier object for the
+         * given connection id.
+         * @since
+         * @param aConnectionId The connection id.
+         * @param aSubConnUpDownNotifier On return, pointer to the subconnection
+         * up/down notifier.
+         * @return KErrNone if successfull, otherwise a system wide error code.
+         */
+        TInt GetSubConnUpDownNotifier(
+                const TUint& aConnectionId,
+                CSubConnUpDownNotifier** aSubConnUpDownNotifier );
+
+        /**
+         * Wakes up CONNECTION SPECIFIC notifications that depend on threshold values.
+         * @since
+         * @param aConnectionId Connection Id.
+         * @return KErrNone if successfull, otherwise a system wide error code.
+         */
+        TInt WakeUpNotifications( const TUint& aConnectionId );
+
+        /**
+         * Wakes up GENERAL notifications that depend on threshold values.
+         * @since
+         * @return KErrNone if successfull, otherwise a system wide error code.
+         */
+        TInt WakeUpNotifications();
+
+        /**
+         * Starts activity notifier for the given connection id.
+         * @since
+         * @param aConnectionId Connection Id.
+         * @return KErrNone if successfull, otherwise a system wide error code.
+         */
+        TInt LaunchActivityNotifierL( const TUint& aConnectionId );
+
+        /**
+         * Starts data notifiers (uplink & downlink) for the given connection id.
+         * @since
+         * @param aConnectionId Connection Id.
+         * @return KErrNone if successfull, otherwise a system wide error code.
+         */
+        TInt LaunchDataNotifiers( const TUint& aConnectionId );
+
+        /**
+         * Starts bearer notifiers for the given connection id.
+         * @since
+         * @param aConnectionId Connection Id.
+         * @return KErrNone if successfull, otherwise KErrNotFound.
+         */
+        TInt LaunchBearerNotifier( const TUint& aConnectionId );
+
+        /**
+         * Appends active connections (iapID & netID) with matching aBearerId
+         * to aIdArray.
+         *
+         * @param aBearerId Identifies the bearer.
+         * @param aIdArray On return contains the use IAP IDs for the active
+         * connections matching the given aBearerId parameter.
+         * @return KErrNone if successfull, otherwise a system wide error code.
+         */
+        void GetActiveConnectionsIds( const TUint& aBearerId, RArray<TUint>& aIdArray );
+
+        /**
+         * Tells whether bearer is supported or not.
+         * @since
+         * @param aConnectionId Generic bearer id (EBearerIdGPRS, EBEarerIdCSD).
+         * @param aByCell On return, ETrue if the bearer is supported by the cell, EFalse otherwise.
+         * @param aByPhone On return, ETrue if the bearer is supported by the phone, EFalse otherwise.
+         * @return KErrNone if successfull, otherwise a system wide error code.
+         */
+        TInt GetBearerSupportInfo(
+                const TUint aConnectionId,
+                TBool& aByCell,
+                TBool& aByPhone ) const;
+
+        /**
+         * Gets the bearer is matching the phone's mode.
+         * @since
+         * @param aBeareId On return, the bearer id matching the phone's mode.
+         * @param aCsd ETrue is CS bearer wanted, EFalse is PS bearer wanted.
+         * @return KErrNone if successfull, otherwise a system wide error code.
+         */
+        TInt GetBearerId( TUint& aBearerId, TBool aCsd=EFalse ) const;
+
+       /**
+         * Destroys the old record and creates a new one because connection has reconnected.
+         * @since
+         * @param aConnectionId The old connectionId. On return it will be replaced by the new Id.
+         * @return KErrNone if successfull, otherwise a system wide error code.
+         */
+        TInt Reconnect( TUint& aConnectionId );
+
+        /**
+         * Saves network ids selected by the end user.
+         * @since
+         * @param aLanPreference A string of comma separated network id e.g. 1,2,5.
+         * @return void
+         */
+        void SetEndUserLanPreference( const TDes8& aLanPreference )
+            {
+            iEndUserNetIds = aLanPreference;
+            }
+
+        /**
+         * Gets network ids selected by the end user.
+         * @since
+         * @param aLanPreference On return contains a string of comma separated network id e.g. 1,2,5.
+         * @return void
+         */
+        void GetEndUserLanPreference( TDes8& aLanPreference )
+            {
+            aLanPreference = iEndUserNetIds;
+            }
+
+        /**
+         * Resets network ids.
+         * @since
+         * @return void
+         */
+        void ResetEndUserLanPreference()
+            {
+            iEndUserNetIds.Zero();
+            iEndUserNetIds.FillZ();
+            }
+
+        /**
+         * Check if WLAN is supported and connection ID is correct.
+         *
+         * @param aConnectionId Connection ID of the connection.
+         * @return KErrNone when successfull, otherwise a system wide error code.
+         */
+        TInt WlanSupportCheck( const TUint& aConnectionId );
+
+        /**
+         * Appends available WLAN IAPs. IAPs are queried from WLAN engine, if
+         * WLAN scanning flag is set, otherwise cache is used.
+         *
+         * @param aIapBuf On return, contains the available WLAN IAPs.
+         * @return KErrNone when successfull, otherwise a system wide error code.
+         */
+        TInt AppendAvailableWLANIaps( RArray<TUint>& aIdArray );
+
+        /**
+         * Appends available WLAN IAPs. IAP info is read from CommsDat. Those
+         * IAPs with a matching SSID with the current WLAN connection are
+         * marked available.
+         * @since 3.2
+         * @param aIapBuf On return, contains the available WLAN IAPs.
+         * @return KErrNone when successfull, otherwise a system wide error code.
+         */
+        TInt AppendAvailableWLANIapsBySsid( RArray<TUint>& aIdArray );
+
+        /**
+         * Enables WLAN scan for the next iap availability query.
+         * @since
+         * @return void
+         */
+        void EnableWlanScan();
+
+        /**
+         * Callback function from iDualTransferModeNotifier
+         */
+        virtual void DtmStateChanged();
+
+        /**
+         * Callback function from iTelephonyNotifier
+         */
+        virtual void PhoneLineStatusChange();
+
+        /**
+         * Gets the network registration status.
+         * @since
+         * @param aNetworkStatus On return, contains the current network registration status.
+         * @return KErrNone if successfull, otherwise a system wide error code.
+         */
+        TInt GetNetworkRegistrationMode( TInt& aRegistration ) const;
+
+        /**
+         * Gets the bearer for the connection.
+         * @since 3.2
+         * @param aConnectionId Id of the connection.
+         * @return KErrNone if successfull, otherwise KErrNotFound.
+         */
+        TInt GetBearerInfo( const TUint aConnectionId, TBearerInfo& aBearerInfo );
+
+        /**
+         * Sends a bearer group changed event.
+         * @since
+         * @param aBearerinfo New bearer to find out the new bearer
+         * groups.
+         * @return KErrNone if successfull, otherwise a system wide error code.
+         */
+        void SendConnectionEvents( TConnMonBearerInfo& aBearerinfo );
+
+        /**
+         * Gets the last error value returned with connection status.
+         * Error code indicates the reason of connection closure.
+         * @since
+         * @param aConnectionId  Connection id.
+         * @param aProgress On return, contains the last progress status and error code.
+         * @return KErrNone if successfull, otherwise a system wide error code.
+         */
+        TInt LastProgressError( const TUint&  aConnectionId, TNifProgress& aProgress );
+
+        /**
+         * Check if the WLAN connection received signal strength is strong
+         * enough to maintain a decent quality connection.
+         *
+         * @since S60 v5.2
+         * @return ETrue if RSS is strong enough, EFalse in any other situation
+         * (weak signal, no WLAN connection, WLAN not supported... ).
+         */
+        TBool WlanRssGoodEnough();
+
+    private: // New methods
+        /**
+         * Opens and attaches to a connection.
+         * @since
+         * @param aConnInfo  Connection info record.
+         * @return KErrNone if successfull, otherwise a system wide error code.
+         */
+        TInt OpenAndAttachTo( TConnInfo& aConnInfo );
+
+        /**
+         * Stops a connection.
+         * @since
+         * @param aIndex  iConnInfos index for the connection.
+         * @return KErrNone if successfull, otherwise a system wide error code.
+         */
+        TInt StopConnection( const TInt aIndex );
+
+        /**
+         * Creates a new unique connection id.
+         * @since
+         * @return New connection id.
+         */
+        TUint NewConnectionId();
+
+        /**
+         * Gets the iConnInfos array index for a connection id.
+         * @since
+         * @param aConnectionId  Connection id.
+         * @return iConnInfos index for connection id.
+         */
+        TInt Index( const TUint& aConnectionId );
+
+        /**
+         * Starts connection specific notifications (status, data volume, activity).
+         * @since
+         * @param aIndex  iConnInfos index for the connection.
+         * @return void
+         */
+        void AddConnNotificationsL( const TInt& aIndex );
+
+        /**
+         * Stops connection specific notifications (status, data volume, activity).
+         * @since
+         * @param aIndex  iConnInfos index for the connection.
+         * @return void
+         */
+        void DeleteConnNotifications( const TInt& aIndex );
+
+        /**
+         * Stops all the notifications.
+         * @since
+         * @return void
+         */
+        void DeleteNotifications();
+
+        /**
+         * Gets the access point name from commDB.
+         * @since
+         * @param aConnectionId  Connection id.
+         * @param aName On return, contains the access point name.
+         * @return KErrNone if successfull, otherwise a system wide error code.
+         */
+        TInt GetAccessPointName( const TUint& aConnectionId, TDes& aName );
+
+        /**
+         * Gets the telephone number from commDB.
+         * @since
+         * @param aConnectionId  Connection id.
+         * @param aTelNum On return, contains the tel number.
+         * @return KErrNone if successfull, otherwise a system wide error code.
+         */
+        TInt GetTelNumber( const TUint& aConnectionId, TDes& aTelNum );
+
+        /**
+         * Gets the connection status.
+         * @since
+         * @param aIndex Index of the connection info in iConnInfos array.
+         * @param aConnectionStatus On return, contains the status of the connection.
+         * @return KErrNone if successfull, otherwise a system wide error code.
+         */
+        TInt GetConnectionStatus( const TInt& aIndex, TInt& aConnectionStatus );
+
+        /**
+         * Gets the packet network status.
+         * @since
+         * @param aNetworkStatus On return, contains the current psd network status.
+         * @return KErrNone if successfull, otherwise a system wide error code.
+         */
+        TInt GetPsdNetworkStatus( TInt& aNetworkStatus ) const;
+
+        /**
+         * Gets the network registration status.
+         * @since
+         * @param aNetworkStatus On return, contains the current network registration status.
+         * @return KErrNone if successfull, otherwise a system wide error code.
+         */
+        TInt GetNetworkRegistration( TInt& aRegistration ) const;
+
+        /**
+         * Gets the network roaming status.
+         * @since
+         * @param aNetworkStatus On return, contains the current network registration status.
+         * @return KErrNone if successfull, otherwise a system wide error code.
+         */
+        TInt GetNetworkRegistration_v2( TInt& aRegistration ) const;
+
+        /**
+         * Gets the GSM signal strength.
+         * @since
+         * @param aSignalStrength On return, contains the GSM signal strength in dBs.
+         * @return KErrNone if successfull, otherwise a system wide error code.
+         */
+        TInt GetGSMSignalStrength( TInt& aSignalStrength ) const;
+
+        /**
+         * Gets the protocol type.
+         * @since
+         * @param aProtocolType On return, contains type the protocol (ip4,ip6).
+         * @return KErrNone if successfull, otherwise a system wide error code.
+         */
+        TInt GetProtocolTypeL( const TUint& aConnectionId, TInt& aProtocolType );
+
+        /**
+         * Gets the connection activity information asynchronously.
+         * @since
+         * @param aIndex Index of the connection info in iConnInfos array.
+         * @return void
+         */
+        void GetActivityOneShotL( const TInt& aIndex );
+
+        /**
+         * Gets the bearer info CSD/HSCSD from ETel.
+         * @since
+         * @param aNumber The dial up number of the call that will be used
+         * to match RConnection object to ETel object.
+         * @param aBearer On return, contains the bearer.
+         * @return KErrNone if successfull, otherwise a system wide error code.
+         */
+        TInt GetBearerFromETel(
+                const TDes& aNumber,
+                TInt& aBearer,
+                TBearerInfo& aBearerInfo );
+
+        /**
+         * Compares two access point names.
+         * @since
+         * @param aNameFromCommDB The access point name (UNICODE) from commDB.
+         * @param aNameFromETel   The access point name (UNICODE) that ETel object is using.
+         * @return 0 if access point names are equal.
+         */
+        TInt CompareAccessPointNames(
+                const TDesC& aNameFromCommDB,
+                const TDesC& aNameFromETel ) const;
+
+        /**
+         * Compares two access point names.
+         * @since
+         * @param aNameFromCommDB The access point name (UNICODE) from commDB.
+         * @param aNameFromETel   The access point name (UTF8) that ETel object is using.
+         * @return 0 if access point names are equal.
+         */
+        TInt CompareAccessPointNames(
+                const TDesC& aNameFromCommDB,
+                const TDesC8& aNameFromETel ) const;
+
+        /**
+         * In case that a new connection has arrived with the same IAP
+         * id as one in the connection info array (that is closing but
+         * some event has not yet occured) the previous connection is
+         * removed and the needed event are sent.
+         * @since
+         * @param aIndex Index number in connection info array.
+         */
+        void CompleteConnectionClosing( TInt& aIndex );
+
+        /**
+         * Takes a connection specific or a bearer specific connection id and
+         * calculates the respective bearer specific connection id.
+         * @since MCL 9.1
+         * @param aConnId The connection id.
+         * @param aBearerId On return, contains the propper bearer specific connection id.
+         * @return KErrNone if successfull, otherwise a system wide error code.
+         */
+        TInt BearerIdForBearerAvailability( const TUint& aConnId, TUint& aBearerId );
+
+    private: // Data
+        // Array that stores connection information records
+        RArray<TConnInfo> iConnInfos;
+
+        // Pointer to server module
+        CConnMonServer* iServer;
+
+        // Handle to socket server
+        RSocketServ iSocketServer;
+
+        // Handle to RConnection
+        RConnection iConnection;
+
+        // Used when allocating new connection ids
+        TUint iIdCounter;
+
+        // Handle to the telephony server
+        RTelServer iTelServer;
+
+        // Handle to the packet service
+        RPacketService iPacketService;
+
+        // RMobilePhone handle
+        RMobilePhone iMobilePhone;
+
+        // Pointer to CSD fax handler module
+        CCsdFax* iCsdFax;
+
+        // Pointer to PSD fax handler module
+        CPsdFax* iPsdFax;
+
+        // Connection up/down event watcher
+        CConnUpDownNotifier* iConnUpDownNotifier;
+
+        // PSD network status event watcher
+        CNetwStatusNotifier* iPsdNetwStatusNotifier;
+
+        // Network registration status event watcher
+        CNetwRegistrationNotifier* iNetwRegistrationNotifier;
+
+        // Bearer change (GPRS/Edge GPRS) event watcher
+        CBearerNotifier* iEdgeNotifier;
+
+        // Bearer change (Wcdma/Hsdpa) event watcher
+        CWcdmaBearerNotifier* iWcdmaNotifier;
+
+        // Mode change (2G <-> 3G)
+        CModeNotifier* iModeNotifier;
+
+        // GSM signal strength event watcher
+        CGsmSignalNotifier* iGSMSignalNotifier;
+
+        // GPRS / CSD bearer availability changed event watcher
+        CBearerAvailabilityNotifier* iGSMBearerAvailabilityNotifier;
+
+        // Number of clients that are listening to events
+        TUint8 iCountListeners;
+
+        // 1 = phone tsy is loaded, 0 = tsy is not loaded
+        TUint8 iTSYLoaded;
+
+        // 1 = packet services are loaded, 0 = not loaded
+        TUint8 iPacketServLoaded;
+
+        // End user LAN network selection
+        TBuf8<KCommsDbSvrMaxFieldLength> iEndUserNetIds;
+
+        // Pointer to WLan management service
+        CWlanSupport* iWlanSupport;
+
+        // Phone call status watcher.
+        CConnMonTelNotifier* iTelephonyNotifier;
+
+        // DTM status watcher.
+        CConnMonDtmNotifier* iDualTransferModeNotifier;
+    };
+
+#endif // CONNMONIAP_H
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/inc/ConnMonNoti.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,753 @@
+/*
+* Copyright (c) 2002-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:  Event notifiers (active objects).
+*
+*/
+
+#ifndef __CONNMONNOTI_H
+#define __CONNMONNOTI_H
+
+#include <es_sock.h>
+#include <in_sock.h>
+#include <es_enum.h>
+#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include <es_enum_internal.h>
+#endif
+
+class CConnMonIAP;
+class CConnMonServer;
+
+const TInt KNoFiltering = -1;
+const TInt KActivityTimeout = 1800000; // 1,8 sec
+// Update ConnMon documentation (attribute KConnectionActive) if changing this
+// value (KOneTimeQueryThreshold = 1)
+const TUint KOneTimeQueryThreshold = 1;
+const TUint KInvalidIapCount = 99999;
+
+// Stop requesting new notifications after this many consecutive errors (CBearerNotifier)
+const TInt KConnMonEventErrorThreshold = 20;
+
+/**
+*  CConnUpDownNotifier
+*  @lib CONNMON.LIB
+*  @since
+*/
+NONSHARABLE_CLASS( CConnUpDownNotifier ) : public CActive
+    {
+    public: // Constructors and destructor
+        CConnUpDownNotifier( CConnMonServer* aServer );
+        void Construct();
+        virtual ~CConnUpDownNotifier();
+
+    public:  // New methods
+        /**
+        * Requests a new event (connection up/down) from RConnection.
+        * @since
+        * @return void
+        */
+        void Receive();
+
+    private: // Methods from base classes
+         /**
+        * From CActive Cancels the asyncronous request
+        * @since
+        * @return void
+        */
+        void DoCancel();
+
+         /**
+        * From CActive Handles the the event that has arrived from RConnection.
+        * @since
+        * @return void
+        */
+        void RunL();
+
+    private: // Data
+        CConnMonServer*           iServer;
+        TEventInfo                iEventInfo;
+        TInterfaceNotificationBuf iInfoBuf;
+        TInt                      iErrorCounter;
+    };
+
+/**
+*  CDataNotifier
+*  @lib CONNMON.LIB
+*  @since
+*/
+NONSHARABLE_CLASS( CDataNotifier ) : public CActive
+    {
+    public: // Constructors and destructor
+        enum TDataDirection
+             {
+             EDownlink = 0,
+             EUplink
+             };
+
+        CDataNotifier(
+                CConnMonServer* aServer,
+                RConnection* aConnection,
+                const TUint& aConnectionId,
+                const TUint& aSubConnectionId,
+                const TInt& aDirection );
+        void Construct();
+        virtual ~CDataNotifier();
+
+
+    public: // New methods
+        /**
+        * Requests a new event (data transferred) from RConnection.
+        * @since
+        * @return void
+        */
+        void Receive();
+
+    private: // Methods from base classes
+         /**
+        * From CActive Cancels the asyncronous request
+        * @since
+        * @return void
+        */
+        void DoCancel();
+
+        /**
+        * From CActive Handles the the event that has arrived from RConnection.
+        * @since
+        * @return void
+        */
+        void RunL();
+
+    private: // Data
+        CConnMonServer* iServer;
+        RConnection*    iConnection;
+        const TUint     iConnectionId;
+        const TUint     iSubConnectionId;
+        const TInt      iDirection;
+        TUint           iVolume;
+        TPckg<TUint>    iPckgVolume;
+        TUint           iThreshold;
+        TEventInfo      iEventInfo;
+        TInt            iErrorCounter;
+    };
+
+/**
+*  CProgressNotifier
+*  @lib CONNMON.LIB
+*  @since
+*/
+NONSHARABLE_CLASS( CProgressNotifier ) : public CActive
+    {
+    public: // Constructors and destructor
+        CProgressNotifier(
+                CConnMonServer* aServer,
+                RConnection* aConnection,
+                const TUint& aConnectionId,
+                const TUint& aSubConnectionId );
+        void Construct();
+        virtual ~CProgressNotifier();
+
+    public: // New methods
+        /**
+        * Requests a new event (connection status has changed) from RConnection.
+        * @since
+        * @return void
+        */
+        void Receive();
+
+        /**
+        * Requests a new event (connection status has changed) from RConnection.
+        * @since
+        * @param aFilter Notifications will be dropped until status reaches aFilter.
+        * @return void
+        */
+        void Receive( const TInt aFilter );
+
+        /**
+        * Return ETrue if the progress value returned from RConnection indicates that
+        * the user has deactivated the connection by using Connection Monitor or
+        * some application has issued RConnection::Stop( RConnection::EStopAuthoritative ).
+        * @since
+        * @return ETrue if connection has been deactivated in an
+        *         authoritative way, otherwise returns EFalse.
+        */
+        TBool IsAuthDelete();
+
+        /**
+        * Return ETrue if the connection might reconnect (e.g. CSD after network is down for a while)
+        * @since
+        * @return ETrue if the connection might reconnect, otherwise returns EFalse.
+        */
+        TBool CanReconnect() const;
+
+        /**
+        * Send KLinkLayerClosed event to clients
+        * @since
+        */
+        void SendClosedEvent();
+
+    private: // Methods from base classes
+         /**
+        * From CActive Cancels the asyncronous request
+        * @since
+        * @return void
+        */
+        void DoCancel();
+
+        /**
+        * From CActive Handles the the event that has arrived from RConnection.
+        * @since
+        * @return void
+        */
+        void RunL();
+
+    private: // Data
+        CConnMonServer* iServer;
+        RConnection*    iConnection;
+        const TUint     iConnectionId;
+        const TUint     iSubConnectionId;
+        TEventInfo      iEventInfo;
+        TNifProgressBuf iInfoBuf;
+        TInt            iFilter;
+    };
+
+/**
+*  CNetwStatusNotifier
+*  @lib CONNMON.LIB
+*  @since
+*/
+NONSHARABLE_CLASS( CNetwStatusNotifier ) : public CActive
+    {
+    public: // Constructor and destructor
+        static CNetwStatusNotifier* NewL( CConnMonServer* aServer );
+        virtual ~CNetwStatusNotifier();
+
+    public: // New methods
+        /**
+        * Requests a new event (network status changed) from ETel.
+        * @since
+        * @return void
+        */
+        void Receive();
+
+    private: // Methods from base classes
+         /**
+        * From CActive Cancels the asyncronous request
+        * @since
+        * @return void
+        */
+        void DoCancel();
+
+        /**
+        * From CActive Handles the the event that has arrived from ETel.
+        * @since
+        * @return void
+        */
+        void RunL();
+
+    private: // Private constructors
+        CNetwStatusNotifier( CConnMonServer* aServer );
+        void Construct();
+
+    private: // Data
+        CConnMonServer*         iServer;
+        RPacketService::TStatus iPacketStatus;
+        TEventInfo              iEventInfo;
+    };
+
+/**
+*  CNetwRegistrationNotifier
+*  @lib CONNMON.LIB
+*  @since
+*/
+NONSHARABLE_CLASS( CNetwRegistrationNotifier ) : public CActive
+    {
+    public: // Constructor and destructor
+        static CNetwRegistrationNotifier* NewL(
+                CConnMonServer* aServer,
+                RMobilePhone& aMobilePhone );
+        virtual ~CNetwRegistrationNotifier();
+
+    public: // New methods
+        /**
+        * Requests a new event (network registration changed) from ETel.
+        * @since
+        * @return void
+        */
+        void Receive();
+
+    private: // Methods from base classes
+         /**
+        * From CActive Cancels the asyncronous request
+        * @since
+        * @return void
+        */
+        void DoCancel();
+
+        /**
+        * From CActive Handles the the event that has arrived from ETel.
+        * @since
+        * @return void
+        */
+        void RunL();
+
+    private: // Private constructors
+        CNetwRegistrationNotifier(
+                CConnMonServer* aServer,
+                RMobilePhone& aMobilePhone );
+        void Construct();
+
+
+    private: // Data
+        CConnMonServer*                              iServer;
+        RMobilePhone&                                iMobilePhone;
+        RMobilePhone::TMobilePhoneRegistrationStatus iRegistration;
+        TBool                                        iCSDSupported;
+        TBool                                        iPhoneSupportsCSD;
+        TEventInfo                                   iEventInfo;
+    };
+
+/**
+* CBearerNotifier
+* @lib CONNMON.LIB
+*/
+NONSHARABLE_CLASS( CBearerNotifier ) : public CActive
+    {
+    public: // Constructors and destructor
+        CBearerNotifier(
+                CConnMonServer* aServer,
+                RMobilePhone& aMobilePhone );
+        void ConstructL();
+
+        static CBearerNotifier* NewL(
+                CConnMonServer* aServer,
+                RMobilePhone& aMobilePhone );
+        virtual ~CBearerNotifier();
+
+    public: // New methods
+        /**
+        * Requests a new event (bearer changed) from ETel Custom API.
+        * @return void
+        */
+        void Receive();
+
+    private: // Methods from base classes
+        /**
+        * From CActive, cancels the asyncronous request.
+        * @return void
+        */
+        void DoCancel();
+
+        /**
+        * From CActive Handles the the event that has arrived from ETel Custom API.
+        * @return void
+        */
+        void RunL();
+
+    private: // Data
+        CConnMonServer* iServer;
+        RMobilePhone& iMobilePhone;
+        RMmCustomAPI::TGprsInformation iGprsInfo;
+        RMmCustomAPI::TGprsInformationPckg iGprsInfoPckg;
+        RMmCustomAPI iCustomApi;
+        TEventInfo iEventInfo;
+        TInt iErrorCounter;
+    };
+
+/**
+*  CWcdmaBearerNotifier
+*  @lib CONNMON.LIB
+*  @since
+*/
+NONSHARABLE_CLASS( CWcdmaBearerNotifier ) : public CActive
+    {
+    public: // Constructors and destructor
+        CWcdmaBearerNotifier(
+                CConnMonServer* aServer,
+                RTelServer& aTelServer );
+        void ConstructL();
+
+        static CWcdmaBearerNotifier* NewL(
+                CConnMonServer* aServer,
+                RTelServer& aTelServer );
+        virtual ~CWcdmaBearerNotifier();
+
+    public: // New methods
+        /**
+        * Requests a new event (bearer changed) from ETel Custom API.
+        * @since
+        * @return void
+        */
+        void Receive();
+
+    private: // Methods from base classes
+        /**
+        * From CActive Cancels the asyncronous request
+        * @since
+        * @return void
+        */
+        void DoCancel();
+
+        /**
+        * From CActive Handles the the event that has arrived from ETel Custom API.
+        * @since
+        * @return void
+        */
+        void RunL();
+
+    private: // Data
+        CConnMonServer*                             iServer;
+        RTelServer&                                 iTelServer;
+        RMobilePhone                                iMobilePhone;
+        RMobilePhone::TMobilePhoneNetworkInfoV5     iNetInfo;
+        RMobilePhone::TMobilePhoneNetworkInfoV5Pckg iNetInfoPckg;
+        TConnMonBearerInfo                          iPreviousBearerInfo;
+        TEventInfo                                  iEventInfo;
+    };
+
+
+/**
+*  CModeNotifier
+*  @lib CONNMON.LIB
+*  @since
+*/
+NONSHARABLE_CLASS( CModeNotifier ) : public CActive
+    {
+    public: // Constructor and destructor
+        static CModeNotifier* NewL(
+                CConnMonServer* aServer,
+                RMobilePhone& aMobilePhone );
+        virtual ~CModeNotifier();
+
+    public: // New methods
+        /**
+        * Requests a new event (mode changed) from ETel.
+        * @since
+        * @return void
+        */
+        void Receive();
+
+    private: // Methods from base classes
+         /**
+        * From CActive Cancels the asyncronous request
+        * @since
+        * @return void
+        */
+        void DoCancel();
+
+        /**
+        * From CActive Handles the the event that has arrived from ETel.
+        * @since
+        * @return void
+        */
+        void RunL();
+
+    private: // Private constructors
+        CModeNotifier(
+                CConnMonServer* aServer,
+                RMobilePhone& aMobilePhone );
+        void Construct();
+
+    private: // Data
+        CConnMonServer*                       iServer;
+        RMobilePhone&                         iMobilePhone;
+        RMobilePhone::TMobilePhoneNetworkMode iMode;
+        TEventInfo                            iEventInfo;
+    };
+
+/**
+*  CBearerAvailabilityNotifier
+*  @lib CONNMON.LIB
+*  @since
+*/
+NONSHARABLE_CLASS( CBearerAvailabilityNotifier ) : public CActive
+    {
+    public: // Constructors and destructor
+        static CBearerAvailabilityNotifier* NewL( CConnMonServer* aServer );
+        virtual ~CBearerAvailabilityNotifier();
+
+    public: // New methods
+        /**
+        * Requests a new event (bearer (PSD) availability changed) from ETel.
+        * @since
+        * @param aKickOff If aKickOff is ETrue initial bearer status will be obtained from ETel.
+        * @return void
+        */
+        void Receive( TBool aKickOff=ETrue );
+
+    private: // Methods from base classes
+         /**
+        * From CActive Cancels the asyncronous request
+        * @since
+        * @return void
+        */
+        void DoCancel();
+
+        /**
+        * From CActive Handles the the event that has arrived from ETel.
+        * @since
+        * @return void
+        */
+        void RunL();
+
+    private: // Private constructors
+        CBearerAvailabilityNotifier( CConnMonServer* aServer );
+        void Construct();
+
+
+    private: // Data
+        CConnMonServer*                     iServer;
+        TBool                               iPSD;
+        TBool                               iGPRSSupportedByPhone;
+        TBool                               iWCDMASupportedByPhone;
+        RPacketService::TRegistrationStatus iRegStatus;
+        TEventInfo                          iEventInfo;
+    };
+
+/**
+*  CGsmSignalNotifier
+*  @lib CONNMON.LIB
+*  @since
+*/
+NONSHARABLE_CLASS( CGsmSignalNotifier ) : public CActive
+    {
+    public: // Constructor and destructor
+        static CGsmSignalNotifier* NewL(
+                CConnMonServer* aServer,
+                RMobilePhone& aMobilePhone );
+        virtual ~CGsmSignalNotifier();
+
+    public: // New methods
+        /**
+        * Requests a new event (GSM signal strength changed) from ETel.
+        * @since
+        * @return void
+        */
+        void Receive();
+
+    private: // Methods from base classes
+         /**
+        * From CActive Cancels the asyncronous request
+        * @since
+        * @return void
+        */
+        void DoCancel();
+
+        /**
+        * From CActive Handles the the event that has arrived from ETel.
+        * @since
+        * @return void
+        */
+        void RunL();
+
+    private: // Private constructors
+        CGsmSignalNotifier(
+                CConnMonServer* aServer,
+                RMobilePhone& aMobilePhone );
+        void Construct();
+
+    private: // Data
+        CConnMonServer* iServer;
+        RMobilePhone&   iMobilePhone;
+        TInt32          iSignalStrength;
+        TInt8           iBar;
+        TEventInfo      iEventInfo;
+    };
+
+/**
+*  CActivityNotifier
+*  @lib CONNMON.LIB
+*  @since
+*/
+NONSHARABLE_CLASS( CActivityNotifier ) : public CActive
+    {
+    public: // Constructors and destructor
+        CActivityNotifier(
+                CConnMonServer* aServer,
+                RConnection* aConnection,
+                const TUint& aConnectionId,
+                const TUint& aSubConnectionId );
+        void Construct();
+        virtual ~CActivityNotifier();
+
+
+    public: // New methods
+        /**
+        * Requests a new event (activity change) from RConnection.
+        * Will use the smallest threshold set by the clients as the
+        * threshold.
+        * @since
+        * @param aActivity The current assumption of activity.
+        * @return void
+        */
+        void Receive( TBool aActivity );
+
+        /**
+        * Requests a new event (activity change) from RConnection.
+        * Threshold is one second.
+        * @since
+        * @param aActivity The current assumption of activity.
+        * @return void
+        */
+        void ReceiveOne( TBool aActivity );
+
+        inline TUint Threshold() const { return iThreshold; }
+
+    private: // Methods from base classes
+         /**
+        * From CActive Cancels the asyncronous request
+        * @since
+        * @return void
+        */
+        void DoCancel();
+
+        /**
+        * From CActive Handles the the event that has arrived from RConnection.
+        * @since
+        * @return void
+        */
+        void RunL();
+
+    private: // Data
+        CConnMonServer* iServer;
+        RConnection*    iConnection;
+        const TUint     iConnectionId;
+        const TUint     iSubConnectionId;
+        TBool           iActivity;
+        TPckg<TBool>    iPckgActivity;
+        TUint           iThreshold;
+        TEventInfo      iEventInfo;
+    };
+
+/**
+*  CSubConnUpDownNotifier
+*  @lib CONNMON.LIB
+*  @since
+*/
+NONSHARABLE_CLASS( CSubConnUpDownNotifier ) : public CActive
+    {
+    public: // Constructors and destructor
+        CSubConnUpDownNotifier(
+                CConnMonServer* aServer,
+                RConnection* aConnection,
+                const TUint& aConnectionId,
+                const TUint& aSubConnectionId );
+        void Construct();
+        virtual ~CSubConnUpDownNotifier();
+
+    public: // New methods
+        /**
+        * Requests a new event (connection status has changed) from RConnection.
+        * @since
+        * @return void
+        */
+        void Receive();
+
+        /**
+        * Sends connection deleted event to clients and removes the connection
+        * from internal tables.
+        * @since
+        * @return void
+        */
+        void SendDeletedEvent();
+
+        /**
+        * Tells whether the deleted event has been sent.
+        * @since
+        * @return ETrue if delete has been sent, EFalse otherwise.
+        */
+        TBool DeleteSent() const;
+
+        /**
+        * Sets interface status to closed.
+        * @since
+        * @return void.
+        */
+        void SetInterfaceClosed();
+
+    private: // Methods from base classes
+         /**
+        * From CActive Cancels the asyncronous request
+        * @since
+        * @return void
+        */
+        void DoCancel();
+
+        /**
+        * From CActive Handles the the event that has arrived from RConnection.
+        * @since
+        * @return void
+        */
+        void RunL();
+
+    private: // Data
+        CConnMonServer*               iServer;
+        RConnection*                  iConnection;
+        const TUint                   iConnectionId;
+        const TUint                   iSubConnectionId;
+        TEventInfo                    iEventInfo;
+        TSubConnectionNotificationBuf iSubConnEventBuf;
+        TUint                         iTotalDownlinkDataVolume;
+        TUint                         iTotalUplinkDataVolume;
+        TBool                         iDeleteSent;
+        TBool                         iInterfaceClosed;
+    };
+
+/**
+*  CTimerAO
+*  Timer that cancel activity notifier after one second.
+*  @lib CONNMON.LIB
+*  @since
+*/
+NONSHARABLE_CLASS( CTimerAO ) : public CActive
+    {
+    public: // Constructors and destructor
+        CTimerAO(
+                CConnMonServer* aServer,
+                const TUint& aConnectionId,
+                const TUint8& aActivity );
+        void ConstructL();
+        virtual ~CTimerAO();
+
+    public: // New methods
+        /**
+        * Starts canceller timer.
+        * @since
+        * @return KErrNone if OK, otherwise a system wide error code.
+        */
+        void Start();
+
+    private: // Methods from base classes
+        /**
+        * From CActive Cancels the timer.
+        * @since
+        * @return void
+        */
+        void DoCancel();
+
+        /**
+        * From CActive Cancels the activity notifier and destroys itself.
+        * @since
+        * @return void
+        */
+        void RunL();
+
+    private: // Data
+        RTimer          iTimer;
+        CConnMonServer* iServer;
+        const TUint     iConnectionId;
+        TUint8          iActivity;
+    };
+
+#endif // __CONNMONNOTI_H
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/inc/ConnMonServ.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,493 @@
+/*
+* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Connection Monitor server.
+*
+*/
+
+#ifndef CONNMONSERV_H
+#define CONNMONSERV_H
+
+#include <e32base.h>
+
+_LIT( KConnMonDLL, "ConnMon.dll" );
+_LIT( KConnMonStartupSemaphore, "ConnMonStartupSemaphore" );
+
+// Security policy
+const TUint KConnMonPolicyRangeCount = 11;
+
+const TInt KConnMonPolicyRanges[KConnMonPolicyRangeCount] =
+    {
+    0,   //range is 0-2 inclusive
+    3,   //range is 3-7 inclusive
+    8,   //range is 8-12 inclusive
+    13,  //range is 13
+    14,  //range is 14
+    15,  //range is 15
+    16,  //range is 16-499 inclusive
+    500, //range is 500-507 inclusive
+    508, //range is 508-599 inclusive
+    600, //range is 600-601 inclusive
+    602  //range is 602-KMaxTInt inclusive
+    };
+
+const TUint8 KConnMonPolicyElementsIndex[KConnMonPolicyRangeCount] =
+    {
+    CPolicyServer::EAlwaysPass,     // Applies to  0th range (request number: 0-2)
+                                            //EReqGetConnectionCount
+                                            //EReqGetConnectionInfo
+                                            //EReqGetSubConnectionInfo
+
+    CPolicyServer::ECustomCheck,    // Applies to  1st range (request number: 3-7)
+                                            //EReqGetIntAttribute
+                                            //EReqGetUintAttribute
+                                            //EReqGetBoolAttribute
+                                            //EReqGetStringAttribute
+                                            //EReqGetPckgAttribute
+
+    CPolicyServer::ECustomCheck,    // Applies to  2nd range (request number: 8-12)
+                                            //EReqSetIntAttribute
+                                            //EReqSetUintAttribute
+                                            //EReqSetBoolAttribute
+                                            //EReqSetStringAttribute
+                                            //EReqSetPckgAttribute
+
+    CPolicyServer::EAlwaysPass,     // Applies to  3rd range (request number: 13)
+                                            //EReqCancelAsyncRequest
+
+    CPolicyServer::EAlwaysPass,     // Applies to  4th range (request number: 14)
+                                            //EReqReceiveEvent
+
+    CPolicyServer::EAlwaysPass,     // Applies to  5th range (request number: 15)
+                                            //EReqCancelReceiveEvent
+
+    CPolicyServer::ENotSupported,   // Applies to  6th range (request number: 16-499)
+
+    4,                              // Applies to  7th range (request number: 500-507)
+                                            //EReqPluginCreateSubSession
+                                            //EReqPluginCloseSubSession
+                                            //EReqPluginRegisterAttribute
+                                            //EReqPluginCancelRegisterAttribute
+                                            //EReqPluginEvent
+                                            //EReqPluginGetQuery
+                                            //EReqPluginCancelGetQuery
+                                            //EReqPluginAttribute
+
+    CPolicyServer::ENotSupported,    // Applies to  8th range (request number: 508-599)
+
+    CPolicyServer::ENotSupported,    // Applies to  9th range (request number: 600-601)
+                                     // Used internally in communicating with plugin
+                                            //EReqInternalSetThreshold
+                                            //EReqInternalResetThreshold
+
+    CPolicyServer::ENotSupported     // Applies to 10th range (request number: 602-KMaxTInt)
+    };
+
+const CPolicyServer::TPolicyElement KConnMonPolicyElements[] =
+    {
+    { _INIT_SECURITY_POLICY_C1( ECapabilityNetworkServices ), CPolicyServer::EFailClient },
+
+    { _INIT_SECURITY_POLICY_C1( ECapabilityNetworkControl ), CPolicyServer::EFailClient },
+
+    { _INIT_SECURITY_POLICY_C1( ECapabilityReadDeviceData ), CPolicyServer::EFailClient },
+
+    { _INIT_SECURITY_POLICY_C1( ECapabilityReadUserData ), CPolicyServer::EFailClient },
+
+    { _INIT_SECURITY_POLICY_C2( ECapabilityNetworkServices,
+                                ECapabilityNetworkControl ), CPolicyServer::EFailClient }
+    };
+
+const CPolicyServer::TPolicy KConnMonPolicy =
+    {
+    CPolicyServer::EAlwaysPass, // Specifies all connect attempts should pass
+    KConnMonPolicyRangeCount,
+    KConnMonPolicyRanges,
+    KConnMonPolicyElementsIndex,
+    KConnMonPolicyElements,
+    };
+
+// Function prototypes
+void PanicServer( TInt aPanic );
+
+// Forward declarations
+class CConnMonScheduler;
+class CConnMonDelayedShutdown;
+class CConnMonIAP;
+class CEventQueue;
+class TConnMonBearer;
+class CConnMonCommsDatCache;
+class CConnMonAvailabilityManager;
+class CConnMonBearerGroupManager;
+class CConnMonCommsDatNotifier;
+class TEvent;
+class TConnMonIapInfo;
+class TConnMonSNAPInfo;
+class TConnMonId;
+
+/**
+* CConnMonServer
+*/
+NONSHARABLE_CLASS( CConnMonServer ) : public CPolicyServer
+    {
+public:
+    CConnMonServer();
+    void ConstructL();
+    ~CConnMonServer();
+
+public:
+    /**
+     * Increments the session counter.
+     */
+    void IncrementSessions();
+
+    /**
+     * Decrements the session counter.
+     * @param aEventInfo Event to be added.
+     */
+    void DecrementSessions();
+
+    /**
+     * Offers the event to all clients that are listening.
+     * @param aEvent Event to be sent to the clients.
+     * @param aNumOffered On return, the number of clients that actually
+     *        have issued a receive reques.
+     */
+    void SendEventToSessions( const TEvent& aEvent, TInt& aNumOffered );
+
+    /**
+     * Offers the latest data volume information to all clients.
+     * @param aConnectionId Connection Id.
+     * @param aDlData Downlink data in bytes.
+     * @param aUIData Uplink data in bytes.
+     * @param aStatus Status received with data volumes from RConnection.
+     */
+    void SendDataVolumesToSessions(
+            const TUint aConnectionId,
+            const TUint aDlData,
+            const TUint aUlData,
+            const TInt aStatus );
+
+    /**
+     * Offers the latest activity information to all clients.
+     * @param aConnectionId Connection Id.
+     * @param aActivity Connection activity information.
+     * @param aStatus Status received with activity from RConnection.
+     */
+    void SendActivityToSessions(
+            const TUint aConnectionId,
+            const TBool aActivity,
+            const TInt aStatus );
+
+    /**
+     * Removes connection settings (thresholds) from sessions.
+     * @param aConnectionId Connection Id.
+     */
+    void RemoveConnSettingsFromSessions( const TUint aConnectionId );
+
+    /**
+     * Gets the number of clients that are listening to the events.
+     * @return Number of clients listening.
+     */
+    TInt NumberOfListeners();
+
+    /**
+     * Calculates the new (smallest) threshold
+     * @param aConnectionId Connection Id.
+     * @param aThresholdType Type of the threshold. See TConnMonThreshold.
+     * @param aThreshold On return, the new threshold value.
+     */
+    void CalculateThreshold(
+            const TUint aConnectionId,
+            const TInt& aThresholdType,
+            TUint& aThreshold );
+
+    /**
+     * Panics the client thread (because client gave a bad descriptor).
+     * @param aPanic The panic code.
+     */
+    void PanicClient( TInt aPanic ) const;
+
+    /**
+     * Panics the client thread (because client gave a bad descriptor).
+     * @param aMsg Reference to the client request message.
+     * @param aPanic The panic code.
+     */
+    void PanicClient( const RMessage2& aMsg, const TInt aPanic ) const;
+
+    /**
+     * Scheduler calls Error() method when server's RunL() has a leave.
+     * @param aError The error code.
+     */
+    void Error( TInt aError );
+
+    /**
+     * Custom security checking for IPCs marked with TSpecialCase::ECustomCheck.
+     * @param aMsg The IPC message from the client.
+     * @return The result of the security check (TCustomResult::EPass/TCustomResult::EFail).
+     */
+    TCustomResult CustomSecurityCheckL(
+            const RMessage2& aMsg,
+            TInt& aAction,
+            TSecurityInfo& aMissing );
+
+    /**
+     * Gets a pointer to the iap module.
+     * @return A pointer to the iap module.
+     */
+    inline CConnMonIAP* Iap() { return iIap; }
+
+    /**
+     * Get available IAP IDs for the IAPs with bearer aBearerId
+     */
+    TInt GetAvailableIaps( const TUint aBearerId, TConnMonIapInfo& aIapInfo );
+
+    /**
+     * Get available SANP IDs
+     */
+    void GetAvailableSnaps( TConnMonSNAPInfo& aSnapInfo );
+
+    /**
+     * Get available SANP IDs
+     */
+    TInt GetAvailableSnaps( RArray<TConnMonId>& aSnapIds );
+
+    /**
+     * Gets a pointer to event queue.
+     * @return A pointer to the event queue.
+     */
+    inline CEventQueue* EventQueue() { return iEventQueue; }
+
+    /**
+     * Produces object containers (needed by subsessions) with unique ids within the server.
+     * @return A object container.
+     */
+    CObjectCon* NewContainerL();
+
+    /**
+     * Removes from index and deletes the object container.
+     * @param aContainer The container to be deleted.
+     * @return A object container.
+     */
+    void RemoveContainer( CObjectCon* aContainer );
+
+    /**
+     * Tries to find plug-in supporting the attribute.
+     * @param aType The type of the request.
+     * @param aMessage The client message.
+     * @return KErrRequestPending if plug-in was found, KErrNotSupported if not.
+     */
+    TInt SendRequestToPlugin(
+            const TInt aType,
+            const RMessage2& aMessage,
+            const TBool aToAllPlugins = EFalse );
+
+    /**
+     * Cancels attribute requests issued by a client from plug-ins..
+     * @param aType The type of the attribute (TInt, TUint, TBool...).
+     * @return Void.
+     */
+    void CancelAttributeRequestsFromPlugins(
+            const RThread& aClient,
+            const TInt aType );
+
+    /**
+     * Gets Availability Manager.
+     * @return Availability Manager.
+     */
+    inline CConnMonAvailabilityManager* AvailabilityManager()
+        {
+        return iAvailabilityManager;
+        }
+
+    /**
+     * Gets bearers.
+     * @return Bearers.
+     */
+    inline const RPointerArray<TConnMonBearer> Bearers()
+        {
+        return iBearers;
+        }
+
+    /**
+     * Gets the bearer group manager.
+     * @return Iaps availability manager.
+     */
+    inline CConnMonBearerGroupManager* BearerGroupManager()
+        {
+        return iBearerGroupManager;
+        }
+
+public:
+    /**
+     * From CServer Creates a new session for a client.
+     * @param aVersion Version information.
+     * @return A pointer to the new session.
+     */
+    CSession2* NewSessionL(
+            const TVersion& aVersion,
+            const RMessage2& aMessage ) const;
+
+private: // Data
+    // Pointer to the Iap module
+    CConnMonIAP* iIap;
+
+    // Pointer to the event queue
+    CEventQueue* iEventQueue;
+
+    // The number of the sessions (=clients)
+    TUint8 iSessionCount;
+
+    // Pointer to the shutdown timer object
+    CConnMonDelayedShutdown* iShutdown;
+
+    // Object container index
+    CObjectConIx* iContainerIndex;
+
+    // Array of bearers
+    RPointerArray<TConnMonBearer> iBearers;
+
+    // CommsDat cache
+    CConnMonCommsDatCache* iCommsDatCache;
+
+    // Availability manager
+    CConnMonAvailabilityManager* iAvailabilityManager;
+
+    // Notifiers to listen for specific CommsDat tables
+    CConnMonCommsDatNotifier* iIapTableNotifier;
+    CConnMonCommsDatNotifier* iSnapTableNotifier;
+    CConnMonCommsDatNotifier* iVirtualTableNotifier;
+
+    CConnMonBearerGroupManager* iBearerGroupManager;
+    };
+
+/**
+* CConnMonScheduler
+* Active scheduler for the server thread.
+*/
+NONSHARABLE_CLASS( CConnMonScheduler ) : public CActiveScheduler
+    {
+public:
+    static void ConstructL();
+    ~CConnMonScheduler();
+
+public:
+
+    // TSignal is needed to allow a client thread to pass TRequestStatus
+    // in a way that it survives the thread launch or process launch
+    class TSignal
+        {
+    public:
+        inline TSignal();
+        inline TInt Set( const TDesC& aData );
+        inline TSignal( TRequestStatus& aStatus );
+        inline TPtrC Get() const;
+    public:
+        TRequestStatus* iStatus;
+        TThreadId iId;
+        };
+
+    /**
+     * Launches the server.
+     * @return KErrNone if OK, otherwise a system wide error code.
+     */
+    static TInt LaunchFromClient();
+
+    /**
+     * Starts the active scheduler.
+     * @return KErrNone if OK, otherwise a system wide error code.
+     */
+    IMPORT_C static TInt ThreadStart( TSignal& aSignal );
+
+public:
+    /**
+     * From CActiveScheduler Handles leave situations.
+     * @param aError System wide error code.
+     */
+    void Error( TInt aError ) const;
+
+private: // Data
+    CConnMonServer* iServer;
+    };
+
+/**
+* CConnMonDelayedShutdown
+* Shutdown timer that closes Connection Monitor server after a period.
+*/
+NONSHARABLE_CLASS( CConnMonDelayedShutdown ) : public CActive
+    {
+public:
+    CConnMonDelayedShutdown( CConnMonServer* aServer );
+    void ConstructL();
+    ~CConnMonDelayedShutdown();
+
+public:
+    /**
+     * Starts shutdown timer.
+     * @return KErrNone if OK, otherwise a system wide error code.
+     */
+    void Start();
+
+private:
+    /**
+     * From CActive Cancels the shutdown timer.
+     */
+    void DoCancel();
+
+    /**
+     * From CActive Shuts the server down.
+     */
+    void RunL();
+
+private: // Data
+    RTimer iTimer;
+    CConnMonServer* iServer;
+    };
+
+// INLINES
+inline CConnMonScheduler::TSignal::TSignal()
+        :
+        iStatus( KErrNone ),
+        iId()
+    {
+    }
+
+inline CConnMonScheduler::TSignal::TSignal(
+        TRequestStatus& aStatus )
+        :
+        iStatus( &aStatus ),
+        iId( RThread().Id() )
+    {
+    aStatus = KRequestPending;
+    }
+
+inline TPtrC CConnMonScheduler::TSignal::Get() const
+    {
+    return TPtrC( reinterpret_cast<const TText*>( this ), sizeof( *this ) / sizeof( TText ) );
+    }
+
+inline TInt CConnMonScheduler::TSignal::Set( const TDesC& aData )
+    {
+    if ( aData.Size() != sizeof( *this ) )
+        {
+        return KErrGeneral;
+        }
+    else
+        {
+        Mem::Copy( this, aData.Ptr(), sizeof( *this ) );
+        return KErrNone;
+        }
+    }
+
+#endif // CONNMONSERV_H
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/inc/ConnMonSess.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,469 @@
+/*
+* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Connection Monitor session.
+*
+*/
+
+#ifndef CONNMONSESS_H
+#define CONNMONSESS_H
+
+class CConnMonServer;
+class CPlugin;
+class TEvent;
+class TEventInfo;
+
+/**
+* TConnSettings
+* Record for connection level threshold settings.
+*/
+class TConnSettings
+    {
+public:
+    TConnSettings(
+            TUint aActivityTimeThreshold,
+            TUint aDLDataThreshold,
+            TUint aULDataThreshold );
+
+public: // Data
+    // Activity time threshold (>= 5)
+    TUint iActivityTimeThreshold;
+
+    // Downlink data volume threshold (>= 4096)
+    TUint iDLDataThreshold;
+
+    // Uplink data volume threshold (>= 4096)
+    TUint iULDataThreshold;
+    };
+
+/**
+* TConnRequest
+* Record for a pending asyncronous requst
+* (KUplinkData, KDownlinkData, KConnectionActive).
+* This request has not yet been completed in the server side.
+*/
+class TConnRequest
+    {
+public:
+    TConnRequest(
+            TUint8 aType,
+            const RMessage2 aMessage );
+
+public: // Data
+    // Request type
+    TUint8 iType;
+
+    // Request
+    RMessage2 iMessage;
+    };
+
+/**
+* TConnParams
+* A collection record for dynamic connection parameters
+* (thresholds, pending async. requests)
+*/
+class TConnParams
+    {
+public:
+    // Constructors and destructor
+    TConnParams( TUint aConnectionId );
+
+public:
+    /**
+     * Compares two TConnParams by the connection id.
+     * @param aFirst The first TConnParams record.
+     * @param aSecond The second TConnParams record.
+     * @return ETrue if equal, EFalse if not.
+     */
+    static TBool MatchId(
+            const TConnParams& aFirst,
+            const TConnParams& aSecond );
+
+public: // Data
+    // Connection id
+    TUint iConnectionId;
+
+    // Threshold settings
+    TConnSettings iSettings;
+
+    // Pending async. requests (KUplinkData, KDownlinkData, KConnectionActive)
+    RArray<TConnRequest> iRequests;
+    };
+
+/**
+* CConnMonSession
+* Server side session.
+*/
+NONSHARABLE_CLASS( CConnMonSession ) : public CSession2
+    {
+public:
+    CConnMonSession( CConnMonServer* aServer );
+    void ConstructL();
+    ~CConnMonSession();
+
+public:
+    /**
+     * Gets a pointer to the server module.
+     * @return A pointer to the server module.
+     */
+    inline CConnMonServer* CmServer() { return iCmServer; }
+
+    /**
+     * Tells if the client is listening to the events.
+     * @return ETrue if session is listening, EFalse if not.
+     */
+    TBool IsListening() const;
+
+    /**
+     * Tells if the client can receive the event.
+     * @return ETrue if client has receive active, EFalse if not.
+     */
+    TBool CanReceiveEvent() const;
+
+    /**
+     * Sends an event to the client.
+     * @param aEvent The event.
+     * @return ETrue if client accepted the event, EFalse if not.
+     */
+    TBool SendEventToClient( const TEvent& aEvent );
+
+    /**
+     * Sends data volumes to the client if client has any pending requests.
+     * @param aConnectionId Connection id.
+     * @param aDlVolume Downlink data volume.
+     * @param aUlVolume Uplink data volume.
+     * @param aRequestStatus Status to be sent to the client.
+     * @return KErrNone if successfull, otherwise a system wide error code.
+     */
+    TInt CompleteDataVolumeRequests(
+            const TUint& aConnectionId,
+            const TUint& aDlVolume,
+            const TUint& aUlVolume,
+            const TInt& aRequestStatus );
+
+    /**
+     * Sends activity information to the client if client has any pending requests.
+     * @param aConnectionId Connection id.
+     * @param aActivity Activity information.
+     * @param aRequestStatus Status to be sent to the client.
+     * @return KErrNone if successfull, otherwise a system wide error code.
+     */
+    TInt CompleteActivityRequests(
+            const TUint& aConnectionId,
+            const TBool& aActivity,
+            const TInt& aRequestStatus );
+
+    /**
+     * Sets connection level thresholds.
+     * @param aConnId, The connection id.
+     * @param aSettings The thresholds record.
+     * @return KErrNone if successfull, otherwise a system wide error code.
+     */
+    TInt SetConnectionSettings(
+            const TUint aConnId,
+            const TConnSettings& aSettings );
+
+    /**
+     * Gets connection level thresholds.
+     * @param aConnId, The connection id.
+     * @param aSettings On return, contains the thresholds.
+     * @return KErrNone if successfull, otherwise a system wide error code.
+     */
+    TInt GetConnectionSettings( const TUint aConnId, TConnSettings& aSettings );
+
+    /**
+     * Saves parameters of a pending request.
+     * @param aConnId, The connection id.
+     * @param aConnRequest The request.
+     * @return KErrNone if successfull, otherwise a system wide error code.
+     */
+    TInt SetConnectionRequest(
+            const TUint aConnId,
+            const TConnRequest& aRequest );
+
+    /**
+     * Removes the connection parameters.
+     * @param aConnId, The connection id.
+     * @return KErrNone if successfull, otherwise a system wide error code.
+     */
+    TInt RemoveConnectionParams( const TUint aConnId );
+
+    /**
+     * Gets a bearer specific threshold.
+     * These are ON/OFF type e.g signal strength and bearer availability.
+     * @param aThresholdType, The type of the threshold.
+     * @param aThreshold, On return, contains the value of the threshold.
+     * @return KErrNone if successfull, otherwise a system wide error code.
+     */
+    TInt GetBearerThreshold(
+            const TInt& aThresholdType,
+            TUint& aThreshold ) const;
+
+    /**
+     * Plugin specific service dispatcher.
+     * @param aMessage Message sent by the plugin
+     */
+    void ServicePluginL( const RMessage2& aMessage );
+
+    /**
+     * Finds plug-in subsession object matching the handle.
+     * @param aHandle, Plugin subsession handle.
+     * @return KErrNone if successfull, otherwise a system wide error code.
+     */
+    CPlugin* PluginFromHandle( const TUint aHandle );
+
+    /**
+     * Creates a new plug-in subsession object.
+     * @param aConnection Generic bearer specific connection id that identifies the plug-in,
+     */
+    void NewPluginL( const TUint aConnectionId );
+
+    /**
+     * Deletes the plug-in subsession object.
+     * @param aHandle, Plugin subsession handle.
+     */
+    void DeletePlugin( const TUint aHandle );
+
+    /**
+     * Sets/gets an attribute to/from a plugin.
+     * @param aType The type of the request.
+     * @param aMessage Message sent by the client
+     * @return KErrNone if successfull, otherwise a system wide error code.
+     */
+    TInt SendRequestToPlugin( const TInt aType, const RMessage2& aMessage );
+
+    /**
+     * Cancels client's attribute request.
+     * @param aType The type of the attribute.
+     */
+    void CancelAttributeRequestFromPlugin(
+            const RThread& aClient,
+            const TInt aType );
+
+    /**
+     * Sets a new threshold to the plugin.
+     * @param aType The type of the threshold.
+     * @param aValue The new value for the threshold.
+     * @return KErrNone if successfull, otherwise a system wide error code.
+     */
+    TInt SetPluginThreshold( const TInt aType, const TUint aValue );
+
+public:
+    /**
+     * From CSharableSession Service dispatcher.
+     * @param aMessage Message sent by the client
+     */
+    void ServiceL( const RMessage2& aMessage );
+
+private:
+    /**
+     * Completes the client message if status != pending or bad descriptor
+     * @param aStatus Status from actual request
+     */
+    void CompleteMessage( const TInt aStatus );
+
+    /**
+     * Gets the number of active connections and
+     * writes it to the client's address space.
+     * @return KErrNone if successfull, otherwise a system wide error code.
+     */
+    TInt GetConnectionCountL();
+
+    /**
+     * Gets the connection id and subconnection count and
+     * writes them to the client's address space.
+     * @return KErrNone if successfull, otherwise a system wide error code.
+     */
+    TInt GetConnectionInfo();
+
+    /**
+     * Gets the subconnection id and
+     * writes it to the client's address space.
+     * @return KErrNone if successfull, otherwise a system wide error code.
+     */
+    TInt GetSubConnectionInfo() const;
+
+    /**
+     * Gets the TInt attribute and
+     * writes it to the client's address space.
+     * @return KErrNone if successfull, otherwise a system wide error code.
+     */
+    TInt GetIntAttributeL();
+
+    /**
+     * Gets the TUint attribute and
+     * writes it to the client's address space.
+     * @return KErrNone if successfull, otherwise a system wide error code.
+     */
+    TInt GetUintAttributeL();
+
+    /**
+     * Gets the TBool attribute and
+     * writes it to the client's address space.
+     * @return KErrNone if successfull, otherwise a system wide error code.
+     */
+    TInt GetBoolAttributeL();
+
+    /**
+     * Gets the TDes attribute and
+     * writes it to the client's address space.
+     * @return KErrNone if successfull, otherwise a system wide error code.
+     */
+    TInt GetStringAttributeL();
+
+    /**
+     * Gets the packaged attribute and
+     * writes it to the client's address space.
+     * @return KErrNone if successfull, otherwise a system wide error code.
+     */
+    TInt GetPckgAttributeL();
+
+    /**
+     * Sets the TInt attribute to the server.
+     * @return KErrNone if successfull, otherwise a system wide error code.
+     */
+    TInt SetIntAttributeL();
+
+    /**
+     * Sets the TUint attribute to the server.
+     * @return KErrNone if successfull, otherwise a system wide error code.
+     */
+    TInt SetUintAttributeL();
+
+    /**
+     * Sets the TBool attribute to the server (KConnectionStop & KConnectionStopAll).
+     * @return KErrNone if successfull, otherwise a system wide error code.
+     */
+    TInt SetBoolAttribute();
+
+    /**
+     * Sets the String attribute to the server.
+     * @return KErrNone if successfull, otherwise a system wide error code.
+     */
+    TInt SetStringAttributeL();
+
+    // Not implemented
+    TInt SetPckgAttribute() const;
+
+    /**
+     * Cancels the asyncronous request(s) sent by the client.
+     * @return KErrNone if successfull, otherwise a system wide error code.
+     */
+    TInt CancelAsyncRequest();
+
+    /**
+     * Sets 'receive request' active and checks the event queue for a new event.
+     * @param aBuffer Client memory area where to an event can be written.
+     */
+    void ReceiveEventL( const TAny* aBuffer );
+
+    /**
+     * Cancels the event request.
+     * @param aBuffer, Client memory area.
+     */
+    void CancelReceiveEvent();
+
+    /**
+     * Checks if connection id is still valid.
+     * @param aConnId, The connection id.
+     * @return ETrue if connection id is valid, EFalse if not valid.
+     */
+    TBool IsConnectionValid( const TUint aConnId );
+
+    /**
+     * Removes the obsolete connection parameters from iConnParams array.
+     */
+    void RemoveObsoleteConnectionParams();
+
+    /**
+     * Calculates the adjusted threshold for data volume events.
+     * @param aEvent, Event information.
+     * @param aAdjustedTh, On return, contains the adjusted threshold.
+     * @param aSmallestTh, On return, contains the smallest threshold among the clients.
+     * @return KErrNone if successfull, otherwise a system wide error code.
+     */
+    TInt CalculateAdjustedThreshold(
+            const TEventInfo& aEvent,
+            TUint& aAdjustedTh,
+            TUint& aSmallestTh );
+
+    /**
+     * Adjusts a given threshold value to allowed range according to type.
+     * @since MCL 9.1
+     * @param aConnId The connection ID in case bearer needs to be discovered.
+     * @param aThresholdType The type of the threshold.
+     * @param aThreshold The threshold value. Will contain adjusted value on return.
+     * @return KErrNone if successfull, otherwise a system wide error code.
+     */
+    TInt AdjustThresholdToAllowedRange(
+            const TInt& aConnId,
+            const TInt& aThresholdType,
+            TUint& aThreshold ) const;
+
+    /**
+     * Returns a reference to the current client message.
+     * @return A reference to the current client message.
+     */
+    RMessage2 Message() const { return iMessage2; }
+
+private: // Data
+    // Pointer to the server module
+    CConnMonServer* iCmServer;
+
+    // Enumerated connection ids
+    CArrayFixFlat<TUint>* iEnumConnInfo;
+
+    // Connection parameters (data volume and activity time thresholds)
+    // and pending requests
+    RArray<TConnParams> iConnParams;
+
+    // True if client is listening to the events
+    TBool iListening;
+
+    // True if client has the event request active
+    TBool iReceiveActive;
+
+    // The event request message client has sent
+    RMessage2 iReceiveMessage;
+
+    // Pointer to the client memory area for the event
+    const TAny* iReceiveBuffer;
+
+    // Time of the latest event delivered to the client
+    TTime iLastEventTime;
+
+    // Object container for this session (our handles)
+    CObjectCon* iContainer;
+
+    // Object index which stores objects for this session
+    CObjectIx* iPlugins;
+
+    // Bearer availability event threshold (0=OFF or 1=ON)
+    TUint iBearerAvailabilityThreshold;
+
+    // Signal strength event threshold (0=OFF or 1=ON)
+    TUint iSignalStrengthThreshold;
+
+    // New bearer system event threshold (0=OFF or 1=ON)
+    TUint iBearerGroupThreshold;
+
+    // Reference to the current client message
+    RMessage2 iMessage2;
+
+private: // Friend classes
+        friend class CPlugin;
+    };
+
+#endif // CONNMONSESS_H
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/inc/ConnMonUtils.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,129 @@
+/*
+* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ConnMon utilities.
+*
+*/
+
+#ifndef CONNMONUTILS_H
+#define CONNMONUTILS_H
+
+#include <etelmm.h>
+#include <rconnmon.h>
+
+/**
+ * Utility class
+ */
+class ConnMonUtils
+    {
+public:
+    /**
+     * Converts from TMobilePhoneNetworkMode to TConnMonMobilePhoneNetworkMode
+     * @param aValue RMobilePhone::TMobilePhoneNetworkMode
+     * @param aMode TConnMonMobilePhoneNetworkMode
+     * @return errorcode
+     */
+    static TInt MobilePhoneNetworkModeToConnMonMobilePhoneNetworkMode(
+            RMobilePhone::TMobilePhoneNetworkMode aMode,
+            TConnMonMobilePhoneNetworkMode& aValue );
+
+    /**
+     * Converts from TDesC8 to build independent TDesC
+     * @param aBuf8 to be converted
+     * @param aInd result of the conversion
+     */
+    static void TDes8ToTDes( const TDes8& aBuf8, TDes& aInd );
+
+    /**
+     * Converts from TDesC to TDesC8
+     * @param aSrc to be converted
+     * @param aDest result of the conversion
+     */
+    static void TDesToTDes8( const TDes& aSrc, TDes8& aDest );
+    };
+
+
+/*
+* The following declarations need to be kept to prevent modifications in
+* def-files and thus prevent binary brakes. These classes are otherwise
+* no longer used.
+*/
+
+class TConnMonInap
+    {
+public:
+    TConnMonInap();
+    virtual TBool Real() const = 0;
+    virtual TBool Valid() const = 0;
+    };
+
+class TConnMonVirtualIap : public TConnMonInap
+    {
+public:
+    TConnMonVirtualIap();
+    // From base class TConnMonInap
+    TBool Real() const;
+    TBool Valid() const;
+    };
+
+class TConnMonRealIap : public TConnMonInap
+    {
+public:
+    TConnMonRealIap();
+    // From base class TConnMonInap
+    TBool Real() const;
+    TBool Valid() const;
+    };
+
+class TConnMonSNAP
+    {
+public:
+    TConnMonSNAP();
+    virtual ~TConnMonSNAP();
+    TBool Valid() const;
+    TConnMonSNAP( const TConnMonSNAP& aSNAP );
+    TConnMonSNAP( TUint aId );
+protected:
+    TUint iId;
+    };
+
+class CConnMonSNAPsAvailabilityManager : public CBase
+    {
+public:
+    static CConnMonSNAPsAvailabilityManager* NewL();
+    virtual ~CConnMonSNAPsAvailabilityManager();
+private:
+    CConnMonSNAPsAvailabilityManager();
+    };
+
+class CConnMonCommsDataNotifier : public CBase
+    {
+public:
+    static CConnMonCommsDataNotifier* NewL();
+    virtual ~CConnMonCommsDataNotifier();
+private:
+    CConnMonCommsDataNotifier();
+    };
+
+class CConnMonIapsAvailabilityManager : public CBase
+    {
+public:
+    static CConnMonIapsAvailabilityManager* NewL();
+    virtual ~CConnMonIapsAvailabilityManager();
+private:
+    CConnMonIapsAvailabilityManager();
+    };
+
+#endif // CONNMONUTILS_H
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/inc/connmoncommsdatcache.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,508 @@
+/*
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Provides cached information on IAPs and SNAPs in CommsDat.
+*
+*/
+
+#ifndef CONNMONCOMMSDATCACHE_H
+#define CONNMONCOMMSDATCACHE_H
+
+#include <e32base.h>
+#include <commsdattypesv1_1.h>
+#include <rconnmon.h>
+
+class CConnMonServer;
+class CConnMonIAP;
+class TConnMonBearer;
+
+NONSHARABLE_CLASS( TLanBearerEntry )
+    {
+public:
+    TInt iId;
+    TBool iWlanBearer;
+    };
+
+NONSHARABLE_CLASS( TConnMonSnapEntry )
+    {
+public:
+    TConnMonSnapEntry();
+
+    TConnMonSnapEntry(
+            TUint aId,
+            TUint aIapId,
+            TUint aSnapId );
+
+    static TInt Compare(
+            const TConnMonSnapEntry& aFirst,
+            const TConnMonSnapEntry& aSecond );
+
+    static TInt FindCompare(
+            const TInt* aKey,
+            const TConnMonSnapEntry& aEntry );
+
+    static TBool Match(
+            const TConnMonSnapEntry& aFirst,
+            const TConnMonSnapEntry& aSecond );
+
+public:
+    TUint iId;              // SNAP ID
+    TUint iNextLayerIapId;  // Real or virtual IAP ID
+    TUint iNextLayerSnapId; // Embeded SNAP ID
+    TInt iAvailability;     // TConnMonAvailability
+
+    // Index of linked object. SNAP or IAP depending if iNextLayerIapId or
+    // iNextLayerSnapId is set.
+    TInt iNextLayerIndex;
+    };
+
+NONSHARABLE_CLASS( TConnMonIapEntry )
+    {
+public:
+    TConnMonIapEntry();
+
+    TConnMonIapEntry(
+            TUint aId,
+            TUint aBearerType,
+            TUint aServiceType );
+
+    static TInt Compare(
+            const TConnMonIapEntry& aFirst,
+            const TConnMonIapEntry& aSecond );
+
+    static TInt FindCompare(
+            const TInt* aKey,
+            const TConnMonIapEntry& aEntry );
+
+    static TBool Match(
+            const TConnMonIapEntry& aFirst,
+            const TConnMonIapEntry& aSecond );
+
+public:
+    TUint iId;              // IAP ID (unique among IAPs)
+    TUint iBearerType;      // Bearer type from IAP table
+    TUint iServiceType;     // Service type from IAP table
+    TInt iAvailability;     // TConnMonAvailability
+    TUint iNextLayerIapId;  // Real or virtual IAP ID
+    TUint iNextLayerSnapId; // SNAP ID
+    TInt iNextLayerIndex;   // Index of linked object
+    };
+
+NONSHARABLE_CLASS( TConnMonVirtualIapEntry )
+    {
+public:
+    TConnMonVirtualIapEntry();
+
+    TConnMonVirtualIapEntry(
+            TUint aId,
+            TUint aNextLayerIapId,
+            TUint aNextLayerSnapId );
+
+    static TInt Compare(
+            const TConnMonVirtualIapEntry& aFirst,
+            const TConnMonVirtualIapEntry& aSecond );
+
+    static TInt FindCompare(
+            const TInt* aKey,
+            const TConnMonVirtualIapEntry& aEntry );
+
+    static TBool Match(
+            const TConnMonVirtualIapEntry& aFirst,
+            const TConnMonVirtualIapEntry& aSecond );
+
+public:
+    TUint iId;              // IAP ID (unique among IAPs) ID
+    TUint iNextLayerIapId;  // Real or virtual IAP ID
+    TUint iNextLayerSnapId; // SNAP ID
+    };
+
+
+/**
+ * ConnMon CommsDat cache
+ */
+NONSHARABLE_CLASS( CConnMonCommsDatCache ) : public CBase
+    {
+private:
+    // Availability status for cache tables
+    enum TConnMonAvailability
+        {
+        EConnMonAvailabilityUnknown = 0,    // Not solved yet
+        EConnMonAvailabilityProcessing,     // Availability is beeing solved (loop detection)
+        EConnMonAvailabilityUnavailable,    // Not available
+        EConnMonAvailabilityAvailable       // Available
+        };
+    enum TConnMonCacheInitState
+        {
+        EConnMonCacheInitNotStarted = 0,
+        EConnMonCacheInitInProgress,
+        EConnMonCacheInitCompleted
+        };
+    enum TConnMonCacheBearerType
+        {
+        EConnMonCacheBearerTypeUnknown = 0,
+        EConnMonCacheBearerTypeAny,
+        EConnMonCacheBearerTypeVirtual
+        };
+    enum TConnMonCacheServiceType
+        {
+        EConnMonCacheServiceTypeUnknown = 0,
+        EConnMonCacheServiceTypeAny,
+        EConnMonCacheServiceTypeCsd,
+        EConnMonCacheServiceTypeGprs,
+        EConnMonCacheServiceTypeLan,
+        EConnMonCacheServiceTypeWlan
+        };
+
+public:
+    /**
+     * Two-phased constructor.
+     */
+    static CConnMonCommsDatCache* NewL();
+
+    /**
+     * Two-phased constructor.
+     */
+    static CConnMonCommsDatCache* NewLC();
+
+    /**
+    * Destructor.
+    */
+    virtual ~CConnMonCommsDatCache();
+
+    /**
+     * Initializes the SNAP and IAP cache. Reads all relevant IAP and SNAP
+     * information from CommsDat and writes it to cache. This should be called
+     * before the first client has connected to ConnMon.
+     *
+     * @return error code.
+     */
+    void Init(
+            CConnMonServer* aServer,
+            CConnMonIAP* aConnMonIap,
+            RPointerArray<TConnMonBearer>* aBearers );
+
+    inline TUint32 GetIapRecordTableId() { return iIapRecordTableId; }
+    inline TUint32 GetSnapRecordTableId() { return iSnapRecordTableId; }
+    inline TUint32 GetVirtualRecordTableId() { return iVirtualRecordTableId; }
+
+    /**
+     * Reads a changed CommsDat table and if changes are detected, updates the
+     * internal cache.
+     *
+     * @param aTableId Table ID of the changed CommsDat table
+     */
+    void RefreshCommsDatCacheL( const TUint32 aTableId );
+
+    /**
+     * Updates the internal structures of the cache and recalculates all SNAP
+     * and IAP availability information.
+     * If aCanSendEvents is true, will send IAP and/or SNAP availability
+     * changed events if changes detected.
+     */
+    void RefreshAvailabilityInfo( const TBool aCanSendEvents );
+
+    /**
+     * Sets the availability status to available for all IAPs with matching
+     * bearer ID / service type.
+     */
+    void SetAvailableIapsWithBearerId( const TUint aServiceType );
+
+    /**
+     * Sets the availability status to available for the IAP with given ID.
+     */
+    void SetAvailableIapWithId( const TUint aId );
+
+    /**
+     * Get available IAP IDs related to given bearer ID.
+     *
+     * @param aBearerId Bearer ID to identify between all bearers and a
+     * specific one.
+     * @param aIapInfo A TConnMonIapInfo object to contain the IDs.
+     * @return error code.
+     */
+    TInt GetAvailableIaps( const TUint aBearerId, TConnMonIapInfo& aIapInfo );
+
+    /**
+     * Get available SNAP IDs.
+     *
+     * @param aSnapInfo A TConnMonSNAPInfo object to contain the IDs.
+     */
+    void GetAvailableSnaps( TConnMonSNAPInfo& aSnapInfo );
+
+    /**
+     * Get available SNAP IDs.
+     *
+     * @param aSnapIds Array to contain the IDs.
+     * @return KErrNoMemory if the RArray fails to allocate memory for itself,
+     * KErrNone otherwise.
+     */
+    TInt GetAvailableSnaps( RArray<TConnMonId>& aSnapIds );
+
+private:
+
+    /**
+     * Constructor.
+     */
+    CConnMonCommsDatCache();
+
+    /**
+     * 2nd level constructor.
+     */
+    void ConstructL();
+
+    /**
+     * Reads all relevant CommsDat information to cache and initializes the
+     * SNAP and virtual IAP table IDs.
+     */
+    void InitCommsDatCacheL();
+
+    /**
+     * Reads all IAPinformation from CommsDat and updates the cache if
+     * necessary.
+     *
+     * @return ETrue if cache information was changed, EFalse otherwise.
+     */
+    TBool RefreshCommsDatIapCacheL( CommsDat::CMDBSession& aDb );
+
+    /**
+     * Reads all IAP table information from CommsDat into an array.
+     */
+    void ReadCommsDatIapTableL(
+            CommsDat::CMDBSession& aDb,
+            RArray<TConnMonIapEntry>& aCurrentIapData,
+            RArray<TUint>& aCurrentWlanIapIds );
+
+    /**
+     * Reads one record from IAP table and finds out the service and bearer
+     * types.
+     */
+    void ReadCommsDatIapEntryL(
+            CommsDat::CCDIAPRecord* aIapEntry,
+            RArray<TLanBearerEntry>& aLanBearerTableCache,
+            TUint& aBearerType,
+            TUint& aServiceType );
+
+    /**
+     * Reads all records from the LAN bearer table and checks if they are WLAN
+     * bearer type. Results are stored in an array.
+     */
+    void ReadCommsDatLanBearerTableL(
+            CommsDat::CMDBSession& aDb,
+            RArray<TLanBearerEntry>& aLanBearerTableCache );
+
+    /**
+     * Reads all SNAP information from CommsDat and updates the cache if
+     * necessary.
+     *
+     * @return ETrue if cache information was changed, EFalse otherwise.
+     */
+    TBool RefreshCommsDatSnapCacheL( CommsDat::CMDBSession& aDb );
+
+    /**
+     * Reads all SNAP information from CommsDat to an array.
+     */
+    void ReadCommsDatSnapTableL(
+            CommsDat::CMDBSession& aDb,
+            RArray<TConnMonSnapEntry>& aCurrentSnapData );
+
+    /**
+     * Reads all virtual IAP link information from CommsDat and updates the
+     * cache if necessary. CommsDat is not read if IAP table did not contain
+     * any virtual IAPs.
+     *
+     * @return ETrue if cache information was changed, EFalse otherwise.
+     */
+    TBool RefreshCommsDatVirtualIapCacheL( CommsDat::CMDBSession& aDb );
+
+    /**
+     * Reads all virtual IAP link information from CommsDat to an array.
+     */
+    void ReadCommsDatVirtualIapTableL(
+            CommsDat::CMDBSession& aDb,
+            RArray<TConnMonVirtualIapEntry>& aCurrentVirtualIapData );
+
+    /**
+     * Compares to sorted RArray<TUint> arrays. Returns ETrue if the arrays are not identical.
+     */
+    TBool CompareSortedArrays(
+            const RArray<TUint>& aFirstArray,
+            const RArray<TUint>& aSecondArray );
+
+    /**
+     * Compares to sorted RArray<TConnMonIapEntry> arrays. Returns ETrue if the arrays are not identical.
+     */
+    TBool CompareSortedArrays(
+            const RArray<TConnMonIapEntry>& aFirstArray,
+            const RArray<TConnMonIapEntry>& aSecondArray );
+
+    /**
+     * Compares to sorted RArray<TConnMonSnapEntry> arrays. Returns ETrue if
+     * the arrays are not identical.
+     */
+    TBool CompareSortedArrays(
+            const RArray<TConnMonSnapEntry>& aFirstArray,
+            const RArray<TConnMonSnapEntry>& aSecondArray );
+
+    /**
+     * Compares to sorted RArray<TConnMonVirtualIapEntry> arrays. Returns ETrue
+     * if the arrays are not identical.
+     */
+    TBool CompareSortedArrays(
+            const RArray<TConnMonVirtualIapEntry>& aFirstArray,
+            const RArray<TConnMonVirtualIapEntry>& aSecondArray );
+
+    /**
+     * Copy new data into a RArray<TUint> array.
+     */
+    void DeepCopy(
+            const RArray<TUint>& aSourceArray,
+            RArray<TUint>& aTargetArray );
+
+    /**
+     * Updates the index links for SNAPs and virtual IAPs.
+     */
+    void UpdateSnapAndVirtualIapLinks();
+
+    /**
+     * Sets the availability flag to false for all IAPs and SNAPs contained in
+     * cache.
+     */
+    void ResetAllAvailabilityInfo();
+
+    /**
+     * Solve SNAP and virtual IAP availability. The results depend on real IAP
+     * availability, so those need to be set when this method is called.
+     */
+    void SolveSnapAndVirtualIapAvailability();
+
+    /**
+     * Create a EConnMonIapAvailabilityChange event and add it to the event
+     * queue to be sent to clients.
+     */
+    TInt SendIapAvailabilityEvent();
+
+    /**
+     * Create a EConnMonSNAPsAvailabilityChange event and add it to the event
+     * queue to be sent to clients.
+     */
+    TInt SendSnapAvailabilityEvent();
+
+    /**
+     * Finds the index in cache for IAP with id aId. Returns KErrNotFound (-1)
+     * if no match is found.
+     */
+    TInt FindIapIndex( const TUint aId );
+
+    /**
+     * Finds the first index in cache for SNAP with ID aId. Returns
+     * KErrNotFound (-1) if no match is found.
+     */
+    TInt FindSnapIndex( const TUint aId );
+
+    /**
+     * Takes a SNAP cache index and reads the ID from that entry. Then adjusts
+     * the availability for each cache entry related to that ID.
+     */
+    void SetSnapAvailabilityAtIndex( TUint aIndex, TInt aAvailability );
+
+    /**
+     * Check IAP availability by index
+     */
+    TInt CheckIapAvailability( TUint aIndex );
+
+    /**
+     * Check SNAP availability by index
+     */
+    TInt CheckSnapAvailability( TUint aIndex );
+
+    /**
+     * Updates the internal list of available IAP IDs and returns ETrue if it
+     * has changed.
+     */
+    TBool UpdateAvailableIaps();
+
+    /**
+     * Updates the internal list of available SNAP IDs and returns ETrue if it
+     * has changed.
+     */
+    TBool UpdateAvailableSnaps();
+
+    /**
+     * Checks from LAN bearer table array if given ID has a WLAN bearer.
+     */
+    TBool HasWlanBearer(
+            TUint32 aId,
+            RArray<TLanBearerEntry>& aLanBearerTableCache );
+
+    /**
+     * Convert a bearer ID to (cache internal) service type
+     */
+    TInt ConvertBearerIdToServiceType(
+            const TUint aBearerId,
+            TUint& aServiceType );
+
+    /**
+     * Checks from CommsDat if WLAN background scanning is enabled.
+     *
+     * @return ETrue if WLAN background scanning is enabled, EFalse otherwise.
+     */
+    TBool IsWlanBackgroundScanningEnabledL();
+
+private: // Data
+    // To keep track of Init()-method call.
+    TInt iInitStatus;
+
+    // Flags set when changes in CommsDat (compared to cache) detected.
+    TBool iIapsChanged;
+    TBool iSnapsChanged;
+    TBool iVirtualIapsChanged;
+
+    // Set in init phase, is WLAN bearer available or not.
+    TBool iWlanSupportEnabled;
+
+    // Table IDs for CommsDat record types, will be set during init phase.
+    TUint32 iIapRecordTableId;
+    TUint32 iSnapRecordTableId;
+    TUint32 iVirtualRecordTableId;
+
+    // Counter for virtual IAPs. Whwn zero, virtual IAP link table is not read.
+    TInt iVirtualIapCount;
+
+    // Cache for WLAN IAP IDs, to efficiently detect any changes. WLAN scan
+    // enabled when changes occur.
+    RArray<TUint> iWlanIapIdCache;
+
+    // Cache for available IAP IDs, to efficiently detect availability changes.
+    RArray<TUint> iIapIdCache;
+
+    // Cache for available SNAP IDs, to efficiently detect availability changes.
+    RArray<TUint> iSnapIdCache;
+
+    // Cache tables, own
+    RArray<TConnMonIapEntry>* iIapCache;
+    RArray<TConnMonSnapEntry>* iSnapCache;
+    RArray<TConnMonVirtualIapEntry>* iVirtualIapCache;
+
+    // Pointer to server module, not own
+    CConnMonServer* iServer;
+
+    // Pointer to IAP module, not own
+    CConnMonIAP* iIap;
+
+    // Bearers, not own
+    RPointerArray<TConnMonBearer>* iBearers;
+    };
+
+#endif // CONNMONCOMMSDATCACHE_H
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/inc/connmoncommsdatnotifier.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Listens for changes in one CommsDat table through CenRep.
+*
+*/
+
+#ifndef CONNMONCOMMSDATNOTIFIER_H
+#define CONNMONCOMMSDATNOTIFIER_H
+
+class CConnMonAvailabilityManager;
+class CRepository;
+
+// Stop requesting new notifications after this many consecutive errors
+const TInt KConnMonCenRepErrorThreshold = 80;
+
+NONSHARABLE_CLASS( CConnMonCommsDatNotifier ) : public CActive
+    {
+public:
+    static CConnMonCommsDatNotifier* NewL(
+            CConnMonAvailabilityManager* aAvailabilityManager,
+            TUint32 aTableId );
+
+    static CConnMonCommsDatNotifier* NewLC(
+            CConnMonAvailabilityManager* aAvailabilityManager,
+            TUint32 aTableId );
+
+    virtual ~CConnMonCommsDatNotifier();
+
+private:
+    CConnMonCommsDatNotifier(
+            CConnMonAvailabilityManager* aAvailabilityManager,
+            TUint32 aTableId );
+
+    void ConstructL();
+    TInt RequestNotifications();
+
+private: // Methods from base class
+    void DoCancel();
+    void RunL();
+
+private:
+    CConnMonAvailabilityManager* iAvailabilityManager;
+    TUint32 iTableId;
+    CRepository* iRepository;
+    TInt iErrorCounter;
+    };
+
+#endif // CONNMONCOMMSDATNOTIFIER_H
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/inc/connmondtmnoti.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,119 @@
+/*
+* 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:  ConnMon Dual Transfer Mode watcher.
+*
+*/
+
+#ifndef CONNMONDTMNOTI_H
+#define CONNMONDTMNOTI_H
+
+#include <etelpckt.h>
+
+/**
+* Connection Monitor Server Dual Transfer Mode watcher observer.
+* @lib CONNMON.LIB
+*/
+class MConnMonDtmNotifierObserver
+    {
+public:
+    /**
+     * Informs the observer of a change in DTM
+     */
+    virtual void DtmStateChanged() = 0;
+    };
+
+/**
+* Connection Monitor Server Dual Transfer Mode watcher.
+* @lib CONNMON.LIB
+*/
+NONSHARABLE_CLASS( CConnMonDtmNotifier ) : public CActive
+    {
+public:
+    /**
+     * Two-phased constructor.
+     *
+     * @param aPacketService A pointer to a RPacketService instance, which has
+     * been initialized fully.
+     * @param aObserver A refernce to the observer which wants to listen to the
+     * notifications.
+     *
+     * @return An initialized instance of this class.
+     */
+    static CConnMonDtmNotifier* NewL(
+            RPacketService& aPacketService,
+            MConnMonDtmNotifierObserver& aObserver );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CConnMonDtmNotifier();
+
+public:
+    /**
+     * Checks if there is support for Dual Transfer Mode.
+     * @return ETrue support for DTM exists, otherwise EFalse.
+     */
+    TBool IsInDualMode() const;
+
+    /**
+     * Starts to notify client of the events
+     */
+    void Receive();
+
+    /**
+     * Cancels notifying the the events
+     * @since
+     */
+    void CancelNotifications();
+
+protected:
+    /**
+     * From CActive. Cancels request.
+     */
+    void DoCancel();
+
+    /**
+     * From CActive. Run when request completes.
+     */
+    void RunL();
+
+private:
+    /**
+     * Constructor.
+     *
+     * @param aPacketService A pointer to a RPacketService instance, which has
+     * been initialized fully.
+     * @param aObserver A refernce to the observer which wants to listen to the
+     * notifications.
+     */
+    CConnMonDtmNotifier(
+            RPacketService& aPacketService,
+            MConnMonDtmNotifierObserver& aObserver );
+
+    /**
+     * 2nd phase constructor.
+     */
+    void ConstructL();
+
+private:
+    RPacketService& iPacketService;
+    RPacketService::TMSClass iMsClass;
+    RPacketService::TMSClass iMaxMsClass;
+    MConnMonDtmNotifierObserver& iObserver;
+    TBool iSendEvents;
+    };
+
+#endif // CONNMONDTMNOTI_H
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/inc/connmontelnoti.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,123 @@
+/*
+* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ConnMon Telephony watcher.
+*
+*/
+
+#ifndef CONNMONTELNOTI_H
+#define CONNMONTELNOTI_H
+
+#include <etelpckt.h>
+#include <etelmm.h>
+
+/**
+ * Connection Monitor Server Telephony watcher observer.
+ * @lib CONNMON.LIB
+ */
+class MConnMonTelephonyObserver
+    {
+public:
+    /**
+     * Notifies the observer that the phone line status has changed.
+     */
+    virtual void PhoneLineStatusChange() = 0;
+    };
+
+/**
+ * Connection Monitor Server Telephony watcher.
+ * @lib CONNMON.LIB
+ */
+NONSHARABLE_CLASS( CConnMonTelNotifier ) : public CActive
+    {
+public:
+    /**
+     * Two-phased constructor.
+     *
+     * @param aObserver A refernce to the observer which wants to listen to the
+     * notifications.
+     * @param aMobilePhone A pointer to a RMobilePhone instance, which has been
+     * initialized fully.
+     * @return An initialized instance of this class.
+     */
+    static CConnMonTelNotifier* NewL(
+            MConnMonTelephonyObserver& aObserver,
+            RMobilePhone* aMobilePhone );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CConnMonTelNotifier();
+
+public:
+    /**
+     * Checks if phone call is active.
+     * @return ETrue phone call is active, otherwice EFalse.
+     */
+    TBool IsCallActive() const;
+
+    /**
+     * Starts to notify client of the events.
+     */
+    void Receive();
+
+    /**
+     * Cancels notifying the the events.
+     */
+    void CancelNotifications();
+
+protected:
+    /**
+     * From CActive. Cancels request.
+     */
+    void DoCancel();
+
+    /**
+     * From CActive. Run when request completes.
+     */
+    void RunL();
+
+private:
+    /**
+    * Constructor.
+    *
+    * @param aObserver A refernce to the observer which wants to listen to the
+    * notifications.
+    * @param aMobilePhone A pointer to a RMobilePhone instance, which has been
+    * initialized fully.
+    */
+    CConnMonTelNotifier(
+            MConnMonTelephonyObserver& aObserver,
+            RMobilePhone* aMobilePhone );
+
+    /**
+     * 2nd phase constructor.
+     */
+    void Construct();
+
+private:
+    RMobilePhone* iMobilePhone;
+    TBool iVoiceCallActive;
+    RCall::TStatus iCallStatus;
+    MConnMonTelephonyObserver& iObserver;
+
+    // ETrue if client has called receive and wants the notifications. Only
+    // affects the sending of the notifications not the receving.
+    TBool iSendEvents;
+
+    RLine iLine;
+    };
+
+#endif // CONNMONTELNOTI_H
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/inc/connmonwlannetwork.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,197 @@
+/*
+* Copyright (c) 2002-2008 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:  Removed from rconnmon.h because this will be deprecated.
+*
+*/
+
+#ifndef CONNMONWLANNETWORK_H
+#define CONNMONWLANNETWORK_H
+
+#include <e32base.h>
+#include <rconnmon.h>
+
+/**
+ * TConnMonWLANNetwork is a class, incapsulated WLAN network abstraction
+ * Implements MDesSerializer interface to be able to be transferred through processes (client/server)
+ * in object's size-independent manner, to meet backward/forward compatibility
+ *
+ * @deprecated
+ * @since 3.1
+ */
+class TConnMonWLANNetwork: public MDesSerializer<TConnMonWLANNetwork>
+    {
+public:
+    // Length of the WLAN network name
+    static const TUint KMaxNameLength = 32;
+
+    // Amount of additional fields in the buffer
+    static const TUint KNumberOfExtraFields = 0;
+
+    // Defines max size of the object in TChar's
+    static const TUint KMaxSize = (
+            sizeof(TUint)           // length of name
+            +sizeof(TBuf<KMaxNameLength>) // iName
+            +sizeof(TUint)          // iConnectionMode
+            +sizeof(TUint)          // iSignalStrength
+            +sizeof(TUint)          // iSecurityMode
+            +sizeof(TUint)          // length of buffer
+            +sizeof(TInt)*KNumberOfExtraFields
+            +sizeof(RArray<TInt> )  // Array of extra fields
+            ) / sizeof(TChar) + 1;    // +1 is for rounding to bigger integer
+
+    // Defines shifts of fields inside the object, packed to a descriptor
+    enum FieldsShifts
+        {
+        ENameLength =     0,
+        EName =           1,
+        // Relatively to iName's end
+        EConnectionMode = 1,
+        ESignalStrength = 2,
+        ESecurityMode =   3,
+        EBufCounter =     4,
+        EBufBase =        4/*,
+        EBufParam0 =      5 */
+        };
+
+    /**
+     * Default constructor
+     * @param aName name of the network
+     * @param aConectionMode ConnectionMode of the network
+     * @param aSignalStrength Signal strength of the network
+     * @param aSecurityMode Security mode of the network
+     * @param aBuf Buffer of the additional fields
+     */
+    IMPORT_C TConnMonWLANNetwork(
+            const TBuf<KMaxNameLength>& aName,
+            TUint aConnectionMode,
+            TUint aSignalStrength,
+            TUint aSecurityMode,
+            const RArray<TInt>& aBuf );
+
+    /**
+     * Destructor
+     */
+    IMPORT_C virtual ~TConnMonWLANNetwork();
+
+    /**
+     * Compares two networks by iSignalStrength;
+     *
+     * @param aFirst to be compared with aSecond
+     * @return 1 if aFirst less than aSecond; 0 if they are equal; -1 otherwise
+     */
+    IMPORT_C static TInt LessBySignal(
+            const TConnMonWLANNetwork& aFirst,
+            const TConnMonWLANNetwork& aSecond );
+
+    /**
+     * Getters Name(), ConnectionMode(), SignalStrength(), SecurityMode(), Buf()
+     *
+     * @return copy of the fields
+     */
+    inline TBuf<KMaxNameLength> Name()
+        {
+        return iName;
+        };
+    inline TUint ConnectionMode()
+        {
+        return iConnectionMode;
+        };
+    inline TUint SignalStrength()
+        {
+        return iSignalStrength;
+        };
+    inline TUint SecurityMode()
+        {
+        return iSecurityMode;
+        };
+    inline RArray<TInt> Buf()
+        {
+        return iBuf;
+        };
+
+    // From MDesSerializer
+
+    /**
+     * See MDesSerializer
+     */
+    IMPORT_C const HBufC* ToBuf() const;
+
+    /**
+     * See MDesSerializer
+     */
+    IMPORT_C static TConnMonWLANNetwork FromPtrC( const TPtrC& aPtrC );
+
+private: // Data
+    TBuf<KMaxNameLength> iName; // Network name
+    TUint iConnectionMode;      // See TConnMonNetworkMode
+    TUint iSignalStrength;      // Signal strength
+    TUint iSecurityMode;        // See TConnMonSecurityMode
+    RArray<TInt> iBuf;          // For additional fields
+    };
+
+/**
+ * Template for the package of array of items of class TConnMonWLANNetwork
+ */
+class ConnMonWLANNetworksArrayPckg
+    {
+public:
+    /**
+     * Constructs the package of array of objects TConnMonWLANNetwork on the heap
+     *
+     * @param aRef Array of objects of class TConnMonWLANNetwork
+     * @param aBufSize Size of the buffer, intended to contain the package
+     */
+    ConnMonWLANNetworksArrayPckg(
+            const RArray<TConnMonWLANNetwork>& aRef,
+            TUint aBufSize );
+
+    /**
+     * Constructs empty package on the heap
+     *
+     * @param aBufSize Size of the buffer, intended to contain the package
+     */
+    IMPORT_C ConnMonWLANNetworksArrayPckg( TUint aBufSize );
+
+    /**
+     * Destruction
+     */
+    IMPORT_C virtual ~ConnMonWLANNetworksArrayPckg();
+
+    /**
+     * Unpacks package to an array of objects of class TConnMonWLANNetwork
+     *
+     * @param aRef Array, intended to containing the unpacked objects
+     */
+    IMPORT_C void UnpackToL( RArray<TConnMonWLANNetwork>& aRef ) const;
+
+    /**
+     * Gets iBuf
+     *
+     * @return iBuf
+     */
+    IMPORT_C HBufC* Buf() const;
+
+private: // Data
+    /**
+     * Buffer on the heap, containing the package
+     */
+    HBufC* iBuf;
+    };
+
+// Array of the WLAN networks
+typedef RArray<TConnMonWLANNetwork> RConnMonWLANNetworksArray;
+
+#endif // CONNMONWLANNETWORK_H
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/inc/log.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,207 @@
+/*
+* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Writes log entries for Connection Monitor Server.
+*
+* To take ConnMon logs, include the debug version of connmon.dll to rom image.
+* On the phone, create folder C:\logs\connmon.
+*
+*/
+
+#ifndef CONNECTIONMONITORLOG_H
+#define CONNECTIONMONITORLOG_H
+
+// Log output
+// 1 = RDebug
+// 2 = File
+#define _CONNMON_LOG_OUTPUT 2
+
+#define _CONNMON_ENTEREXIT_LOGGING
+#define _CONNMON_FUNCTIONAL_LOGGING
+//#define _CONNMON_TIMING_LOGGING
+//#define _CONNMON_HEXDUMP_LOGGING // Only for file logging
+
+#include <e32std.h>
+#include <e32base.h>
+
+#if ( _CONNMON_LOG_OUTPUT == 1 )
+#include <e32debug.h>
+#endif
+
+#ifdef _DEBUG
+
+    #define LOG(a) a
+
+    #ifdef _CONNMON_FUNCTIONAL_LOGGING
+      #if ( _CONNMON_LOG_OUTPUT == 2 )
+        #define LOGIT(a)                    {_LIT(temp, a); Log::Printf(temp);}
+        #define LOGIT1(a,a1)                {_LIT(temp, a); Log::Printf(temp,a1);}
+        #define LOGIT2(a,a1,a2)             {_LIT(temp, a); Log::Printf(temp,a1,a2);}
+        #define LOGIT3(a,a1,a2,a3)          {_LIT(temp, a); Log::Printf(temp,a1,a2,a3);}
+        #define LOGIT4(a,a1,a2,a3,a4)       {_LIT(temp, a); Log::Printf(temp,a1,a2,a3,a4);}
+        #define LOGIT5(a,a1,a2,a3,a4,a5)    {_LIT(temp, a); Log::Printf(temp,a1,a2,a3,a4,a5);}
+        #define LOGIT6(a,a1,a2,a3,a4,a5,a6) {_LIT(temp, a); Log::Printf(temp,a1,a2,a3,a4,a5,a6);}
+        #define LOGIT11(a,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11) {_LIT(temp, a); Log::Printf(temp,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11);}
+      #else
+        #define LOGIT(a)                    {_LIT(temp, a); RDebug::Print(temp);}
+        #define LOGIT1(a,a1)                {_LIT(temp, a); RDebug::Print(temp,a1);}
+        #define LOGIT2(a,a1,a2)             {_LIT(temp, a); RDebug::Print(temp,a1,a2);}
+        #define LOGIT3(a,a1,a2,a3)          {_LIT(temp, a); RDebug::Print(temp,a1,a2,a3);}
+        #define LOGIT4(a,a1,a2,a3,a4)       {_LIT(temp, a); RDebug::Print(temp,a1,a2,a3,a4);}
+        #define LOGIT5(a,a1,a2,a3,a4,a5)    {_LIT(temp, a); RDebug::Print(temp,a1,a2,a3,a4,a5);}
+        #define LOGIT6(a,a1,a2,a3,a4,a5,a6) {_LIT(temp, a); RDebug::Print(temp,a1,a2,a3,a4,a5,a6);}
+        #define LOGIT11(a,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11) {_LIT(temp, a); RDebug::Print(temp,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11);}
+      #endif
+    #else
+      #define LOGIT(a)
+      #define LOGIT1(a,a1)
+      #define LOGIT2(a,a1,a2)
+      #define LOGIT3(a,a1,a2,a3)
+      #define LOGIT4(a,a1,a2,a3,a4)
+      #define LOGIT5(a,a1,a2,a3,a4,a5)
+      #define LOGIT6(a,a1,a2,a3,a4,a5,a6)
+      #define LOGIT11(a,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11)
+    #endif
+
+    #ifdef _CONNMON_ENTEREXIT_LOGGING
+      #if ( _CONNMON_LOG_OUTPUT == 2 )
+        _LIT(KConnMonLogEnterFn, "-> %S entered");
+        _LIT(KConnMonLogExitFn,  "<- %S returned");
+        _LIT(KConnMonLogExitFn1, "<- %S returned <%d>");
+        #define LOGENTRFN(a)     {_LIT(temp, a); Log::Printf(KConnMonLogEnterFn, &temp);}
+        #define LOGEXITFN(a)     {_LIT(temp, a); Log::Printf(KConnMonLogExitFn, &temp);}
+        #define LOGEXITFN1(a,a1) {_LIT(temp, a); Log::Printf(KConnMonLogExitFn1, &temp, a1);}
+      #else
+        _LIT(KConnMonLogEnterFn, "ConnMon: -> %S entered");
+        _LIT(KConnMonLogExitFn,  "ConnMon: <- %S returned");
+        _LIT(KConnMonLogExitFn1, "ConnMon: <- %S returned <%d>");
+        #define LOGENTRFN(a)     {_LIT(temp, a); RDebug::Print(KConnMonLogEnterFn, &temp);}
+        #define LOGEXITFN(a)     {_LIT(temp, a); RDebug::Print(KConnMonLogExitFn, &temp);}
+        #define LOGEXITFN1(a,a1) {_LIT(temp, a); RDebug::Print(KConnMonLogExitFn1, &temp, a1);}
+      #endif
+    #else
+      #define LOGENTRFN(a)
+      #define LOGEXITFN(a)
+      #define LOGEXITFN1(a,a1)
+    #endif
+
+    #ifdef _CONNMON_TIMING_LOGGING
+      #if ( _CONNMON_LOG_OUTPUT == 2 )
+        _LIT(KCMLogTimeStart, "TIMING: %S start");
+        _LIT(KCMLogTimeEnd, "TIMING: %S took %d ms");
+        #define LOGTIMINGSTART(a) \
+            {/*_LIT(s, a); Log::Printf(KCMLogTimeStart, &s);*/} \
+            TTime _connmon_start; \
+            TTime _connmon_end; \
+            TTimeIntervalMicroSeconds _connmon_dur; \
+            _connmon_start.UniversalTime();
+
+        #define LOGTIMINGEND(a) \
+            _connmon_end.UniversalTime(); \
+            _connmon_dur = _connmon_end.MicroSecondsFrom( _connmon_start ); \
+            {_LIT(s,a); Log::Printf(KCMLogTimeEnd, &s, (TInt)((_connmon_dur.Int64()+500)/1000));}
+      #else
+        _LIT(KCMLogTimeStart, "ConnMon: TIMING: %S start");
+        _LIT(KCMLogTimeEnd, "ConnMon: TIMING: %S took %d ms");
+        #define LOGTIMINGSTART(a) \
+            {/*_LIT(s, a); RDebug::Print(KCMLogTimeStart, &s);*/} \
+            TTime _connmon_start; \
+            TTime _connmon_end; \
+            TTimeIntervalMicroSeconds _connmon_dur; \
+            _connmon_start.UniversalTime();
+
+        #define LOGTIMINGEND(a) \
+            _connmon_end.UniversalTime(); \
+            _connmon_dur = _connmon_end.MicroSecondsFrom( _connmon_start ); \
+            {_LIT(s,a); RDebug::Print(KCMLogTimeEnd, &s, (TInt)((_connmon_dur.Int64()+500)/1000));}
+      #endif
+    #else
+      #define LOGTIMINGSTART(a)
+      #define LOGTIMINGEND(a)
+    #endif
+
+#else
+
+    #define LOG(a)
+
+    #define LOGIT(a)
+    #define LOGIT1(a,a1)
+    #define LOGIT2(a,a1,a2)
+    #define LOGIT3(a,a1,a2,a3)
+    #define LOGIT4(a,a1,a2,a3,a4)
+    #define LOGIT5(a,a1,a2,a3,a4,a5)
+    #define LOGIT6(a,a1,a2,a3,a4,a5,a6)
+    #define LOGIT11(a,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11)
+
+    #define LOGENTRFN(a)
+    #define LOGEXITFN(a)
+    #define LOGEXITFN1(a,a1)
+
+    #define LOGTIMINGSTART(a)
+    #define LOGTIMINGEND(a)
+
+#endif
+
+#ifdef _DEBUG
+#if ( _CONNMON_LOG_OUTPUT == 2 )
+
+#include <flogger.h>
+
+_LIT( KLogFolder,"connmon" );
+_LIT( KLogFile,"connmon.txt" );
+
+class Log
+    {
+public:
+    static inline void Write( const TDesC& aDes);
+    static inline void Printf( TRefByValue<const TDesC> aFmt, ...);
+    static inline void HexDump(
+            const TText* aHeader,
+            const TText* aMargin,
+            const TUint8* aPtr,
+            TInt aLen );
+    };
+
+inline void Log::Write( const TDesC& aDes )
+    {
+    RFileLogger::Write( KLogFolder(), KLogFile(), EFileLoggingModeAppend, aDes );
+    }
+
+inline void Log::Printf( TRefByValue<const TDesC> aFmt, ... )
+    {
+    VA_LIST list;
+    VA_START(list,aFmt);
+    RFileLogger::WriteFormat( KLogFolder(), KLogFile(), EFileLoggingModeAppend, aFmt, list );
+    }
+
+inline void Log::HexDump(
+        const TText* aHeader,
+        const TText* aMargin,
+        const TUint8* aPtr,
+        TInt aLen )
+    {
+    RFileLogger::HexDump(
+            KLogFolder(),
+            KLogFile(),
+            EFileLoggingModeAppend,
+            aHeader,
+            aMargin,
+            aPtr,
+            aLen );
+    }
+
+#endif // _CONNMON_LOG_OUTPUT
+#endif // _DEBUG
+#endif // CONNECTIONMONITORLOG_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/rom/connmon.iby	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,24 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ConnMon to ROM.
+*
+*/
+
+#ifndef __CONNMON_IBY__
+#define __CONNMON_IBY__
+
+file=ABI_DIR\BUILD_DIR\CONNMON.DLL      SHARED_LIB_DIR\CONNMON.DLL
+file=ABI_DIR\BUILD_DIR\CONNMONEXE.EXE   PROGRAMS_DIR\CONNMONEXE.EXE
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/src/CCsdFax.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,815 @@
+/*
+* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Provides information on CSD fax calls.
+*
+*/
+
+#include <mmtsy_names.h>
+#include <rmmcustomapi.h>
+#include "ConnMonServ.h"
+#include "ConnMonIAP.h"
+#include "CEventQueue.h"
+#include "CCsdFax.h"
+#include "log.h"
+
+// -----------------------------------------------------------------------------
+// CCsdFax::CCsdFax
+// -----------------------------------------------------------------------------
+//
+CCsdFax::CCsdFax(
+        CConnMonServer* aServer,
+        RTelServer* aTelServer,
+        RMobilePhone* aMobilePhone )
+        :
+        iServer( aServer ),
+        iTelServer( aTelServer ),
+        iMobilePhone( aMobilePhone )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCsdFax::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CCsdFax::ConstructL()
+    {
+    //LOGENTRFN("CCsdFax::ConstructL()")
+    // Open "Data" line
+    TInt ret = iLine.Open( *iMobilePhone, KMmTsyDataLineName );
+
+    if ( ret != KErrNone )
+        {
+        LOGIT("CCsdFax: Could not open data line.")
+        return;
+        }
+    else
+        {
+        iState = ELineOpen;
+        }
+
+    // Start external connection Up notifier
+    if ( iConnUpNotifier == 0 )
+        {
+        iConnUpNotifier = new( ELeave ) CCsdFaxUpNotifier(
+                this,
+                iServer,
+                iMobilePhone,
+                iLine);
+        iConnUpNotifier->Construct();
+        iConnUpNotifier->Receive();
+        }
+
+    // Start external connection Up notifier
+    if ( iStatusNotifier == 0 )
+        {
+        iStatusNotifier = new( ELeave ) CCsdStatusNotifier(
+                this,
+                iServer );
+        iStatusNotifier->Construct();
+        }
+    //LOGEXITFN("CCsdFax::ConstructL()")
+    }
+
+// Destructor
+CCsdFax::~CCsdFax()
+    {
+    if ( iConnUpNotifier != 0 )
+        {
+        iConnUpNotifier->Cancel();
+        delete iConnUpNotifier;
+        iConnUpNotifier = 0;
+        }
+
+    if ( iStatusNotifier != 0 )
+        {
+        iStatusNotifier->Cancel();
+        delete iStatusNotifier;
+        iStatusNotifier = 0;
+        }
+
+    if ( iState == ECallOpen )
+        {
+        CloseCall();
+        }
+
+    if ( iState > EModuleClosed )
+        {
+        iLine.Close();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCsdFax::OpenCall
+// -----------------------------------------------------------------------------
+//
+TInt CCsdFax::OpenCall( const TDes& aName )
+    {
+    if ( iState == ECallOpen )
+        {
+        CloseCall();
+        }
+
+    RTelServer::TPhoneInfo phoneInfo;
+    TInt err = iTelServer->GetPhoneInfo( 0, phoneInfo );
+
+    if ( err != KErrNone )
+        {
+        return err;
+        }
+
+    iCsdFaxCallName.Copy( phoneInfo.iName );
+    iCsdFaxCallName.Append( KDoubleColon );
+    iCsdFaxCallName.Append( KMmTsyDataLineName );
+    iCsdFaxCallName.Append( KDoubleColon );
+    iCsdFaxCallName.Append( aName );
+
+    err = iCall.OpenExistingCall( *iTelServer, iCsdFaxCallName );
+
+    if ( KErrNone == err )
+        {
+        iState = ECallOpen;
+
+        // Start status event watcher
+        if ( !iStatusNotifier->IsActive() )
+            {
+            iStatusNotifier->Start( &iCall );
+            }
+        }
+
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CCsdFax::CloseCall
+// -----------------------------------------------------------------------------
+//
+void CCsdFax::CloseCall()
+    {
+    if ( iStatusNotifier != 0 )
+        {
+        iStatusNotifier->Cancel();
+        }
+
+    iCall.Close();
+    iState = ELineOpen;
+
+    iCsdFaxCallName.FillZ();
+    iCsdFaxCallName.Zero();
+    }
+
+// -----------------------------------------------------------------------------
+// CCsdFax::IsValid
+// -----------------------------------------------------------------------------
+//
+TBool CCsdFax::IsValid()
+    {
+    if ( iState == ECallOpen )
+        {
+        return ETrue;
+        }
+    else
+        {
+        return EFalse;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCsdFax::FindCall
+// -----------------------------------------------------------------------------
+//
+TInt CCsdFax::FindCall()
+    {
+    TInt ret( KErrNone );
+    TInt countCalls( 0 );
+
+    if ( iState == ECallOpen )
+        {
+        return KErrNone;
+        }
+    else if ( iState < ELineOpen )
+        {
+        return KErrNotFound;
+        }
+
+    // Enumerate calls on data line
+    ret = iLine.EnumerateCall( countCalls );
+
+    if ( ret != KErrNone )
+        {
+        return ret;
+        }
+    else if ( countCalls == 0 )
+        {
+        return KErrNotFound;
+        }
+
+    RMmCustomAPI customApi;
+    RMmCustomAPI::TCallOrigin origin;
+
+    ret = customApi.Open( *iMobilePhone );
+
+    if ( ret != KErrNone )
+        {
+        return ret;
+        }
+
+    // Get call info
+    for ( TInt j = 0; j < countCalls; j++ )
+        {
+        RLine::TCallInfo callInfo;
+
+        ret = iLine.GetCallInfo( j, callInfo );
+        if ( ret != KErrNone )
+            {
+            customApi.Close();
+            return ret;
+            }
+
+        customApi.CallOrigin( callInfo.iCallName, origin );
+
+        // TF
+        if ( origin == RMmCustomAPI::EOutsider )
+            {
+            ret = KErrNone;
+            OpenCall( callInfo.iCallName );
+            break;
+            }
+        else
+            {
+            ret = KErrNotFound;
+            }
+        }
+
+    customApi.Close();
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CCsdFax::GetBearer
+// -----------------------------------------------------------------------------
+//
+TInt CCsdFax::GetBearer( TInt& aBearer, TBearerInfo& aBearerInfo ) const
+    {
+    TInt ret( KErrNone );
+    RMobileCall::TMobileCallStatus mobileCallStatus;
+
+    if ( iState < ECallOpen )
+        {
+        return KErrNotFound;
+        }
+
+    // Is network WCDMA
+    RMobilePhone::TMobilePhoneNetworkMode mode;
+    ret = iMobilePhone->GetCurrentMode( mode );
+
+    if ( ret != KErrNone )
+        {
+        return ret;
+        }
+    if ( mode == RMobilePhone::ENetworkModeWcdma )
+        {
+        aBearer = EBearerExternalWcdmaCSD;
+        aBearerInfo.iBearer = EBearerInfoWcdmaCSD;
+        aBearerInfo.iInternal = EFalse;
+
+        return KErrNone;
+        }
+
+    ret = iCall.GetMobileCallStatus( mobileCallStatus );
+
+    if ( ret != KErrNone )
+        {
+        return ret;
+        }
+
+    aBearer = EBearerExternalCSD;
+    aBearerInfo.iBearer = EBearerInfoCSD;
+    aBearerInfo.iInternal = EFalse;
+
+    if ( mobileCallStatus != RMobileCall::EStatusIdle )
+        {
+        RMobileCall::TMobileCallHscsdInfoV1 hscsdInfo;
+        RMobileCall::TMobileCallHscsdInfoV1Pckg hscsdInfoPckg( hscsdInfo );
+
+        for ( TInt a = 0; a < KBearerQueryCount; a++ )
+            {
+            ret = iCall.GetCurrentHscsdInfo( hscsdInfoPckg );
+
+            if ( ret != KErrEtelCallNotActive )
+                {
+                break;
+                }
+
+            User::After( KBearerQueryTimeout );
+            }
+
+        if ( KErrNone == ret )
+            {
+            if ( hscsdInfo.iAiur != RMobileCall::EAiurBpsUnspecified )
+                {
+                aBearer = EBearerExternalHSCSD;
+                aBearerInfo.iBearer = EBearerInfoHSCSD;
+                }
+            }
+        }
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CCsdFax::GetStatus
+// -----------------------------------------------------------------------------
+//
+TInt CCsdFax::GetStatus( TInt& aStatus ) const
+    {
+    TInt ret( KErrNone );
+
+    if ( iState < ECallOpen )
+        {
+        return KErrNotFound;
+        }
+
+    RMobileCall::TMobileCallStatus mobileCallStatus;
+    ret = iCall.GetMobileCallStatus( mobileCallStatus );
+
+    if ( ret != KErrNone )
+        {
+        return ret;
+        }
+
+    aStatus = mobileCallStatus;
+    ret = MapStatus( aStatus );
+
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CCsdFax::MapStatus
+// -----------------------------------------------------------------------------
+//
+TInt CCsdFax::MapStatus( TInt& aStatus ) const
+    {
+    switch( aStatus )
+        {
+        case RMobileCall::EStatusUnknown:
+            return KErrUnknown;
+
+        case RMobileCall::EStatusIdle:
+            aStatus = KConnectionUninitialised;
+            break;
+
+        case RMobileCall::EStatusDialling:
+            aStatus = KCsdStartingDialling;
+            break;
+
+        case RMobileCall::EStatusRinging:
+            return KErrUnknown;
+
+        case RMobileCall::EStatusAnswering:
+            aStatus = KCsdStartingAnswer;
+            break;
+
+        case RMobileCall::EStatusConnecting:
+            aStatus = KCsdStartingConnect;
+            break;
+
+        case RMobileCall::EStatusConnected:
+            aStatus = KCsdConnectionOpen;
+            break;
+
+         case RMobileCall::EStatusDisconnecting:
+         case RMobileCall::EStatusDisconnectingWithInband:
+            aStatus = KCsdStartingHangUp;
+            break;
+
+        default:
+            return KErrUnknown;
+        }
+
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CCsdFax::GetTelNumber
+// -----------------------------------------------------------------------------
+//
+TInt CCsdFax::GetTelNumber( TDes& aNumber ) const
+    {
+    LOGENTRFN("CCsdFax::GetTelNumber()")
+    TInt err( KErrNone );
+
+    if ( iState < ECallOpen )
+        {
+        err = KErrNotFound;
+        }
+    else
+        {
+        RMobileCall::TMobileCallInfoV1 info;
+        RMobileCall::TMobileCallInfoV1Pckg infoPckg( info );
+        err = iCall.GetMobileCallInfo( infoPckg );
+
+        if ( KErrNone == err )
+            {
+            if ( infoPckg().iRemoteParty.iRemoteNumber.iTelNumber.Length() > 0 )
+                {
+                aNumber = infoPckg().iRemoteParty.iRemoteNumber.iTelNumber;
+                }
+            else if ( infoPckg().iDialledParty.iTelNumber.Length() > 0 )
+                {
+                aNumber = infoPckg().iDialledParty.iTelNumber;
+                }
+            }
+        }
+
+    LOGEXITFN1("CCsdFax::GetTelNumber()", err)
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CCsdFax::GetStartTime
+// -----------------------------------------------------------------------------
+//
+TInt CCsdFax::GetStartTime( TTime& aTime ) const
+    {
+    TInt ret( KErrNone );
+
+    if ( iState < ECallOpen )
+        {
+        return KErrNotFound;
+        }
+
+    TTimeIntervalSeconds duration;
+    ret = iCall.GetCallDuration( duration );
+
+    if ( KErrNone == ret )
+        {
+        TTime current;
+        current.UniversalTime();
+        aTime = current - duration;
+        }
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CCsdFax::Stop
+// -----------------------------------------------------------------------------
+//
+TInt CCsdFax::Stop()
+    {
+    TInt err( KErrNone );
+
+    if ( iState != ECallOpen )
+        {
+        return KErrNotFound;
+        }
+
+    err = iCall.HangUp();
+
+    // Remove from server tables if
+    // status notifier is not active.
+    if ( !iStatusNotifier->IsActive() )
+        {
+        RemoveFromServer();
+        }
+
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CCsdFax::RemoveFromServer
+// -----------------------------------------------------------------------------
+//
+void CCsdFax::RemoveFromServer()
+    {
+    // Remove the connection from internal table
+    TInt bearer( 0 );
+    TBearerInfo bearerInfo( EBearerInfoCSD, ETrue);
+
+    TConnInfo connInfo( 0, 0, 0, EBearerExternalCSD, bearerInfo );
+
+    TInt err = GetBearer( bearer, bearerInfo );
+
+    if ( KErrNone == err )
+        {
+        connInfo.iBearer = bearer;
+        connInfo.iBearerInfo.iBearer = bearerInfo.iBearer;
+        connInfo.iBearerInfo.iInternal = bearerInfo.iInternal;
+        }
+
+    iServer->Iap()->RemoveConnection( connInfo );
+    }
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CCsdFaxUpNotifier::CCsdFaxUpNotifier
+// -----------------------------------------------------------------------------
+//
+CCsdFaxUpNotifier::CCsdFaxUpNotifier(
+        CCsdFax* aFaxModule,
+        CConnMonServer* aServer,
+        RMobilePhone* aMobilePhone,
+        RLine& aLine)
+        :
+        CActive( EConnMonPriorityNormal ),
+        iFaxModule( aFaxModule ),
+        iServer( aServer ),
+        iMobilePhone( aMobilePhone ),
+        iLine( aLine )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCsdFaxUpNotifier::Construct
+// -----------------------------------------------------------------------------
+//
+void CCsdFaxUpNotifier::Construct()
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// Destructor
+CCsdFaxUpNotifier::~CCsdFaxUpNotifier()
+    {
+    Cancel();
+    }
+
+// -----------------------------------------------------------------------------
+// CCsdFaxUpNotifier::Receive
+// Requests a new event (connection up/down) from RConnection
+// -----------------------------------------------------------------------------
+//
+void CCsdFaxUpNotifier::Receive()
+    {
+    if ( IsActive() )
+        {
+        Cancel();
+        }
+
+    iName.FillZ();
+
+    iLine.NotifyCallAdded( iStatus, iName );
+    SetActive();
+    }
+
+// -----------------------------------------------------------------------------
+// CCsdFaxUpNotifier::DoCancel
+// Cancels the request from RConnection.
+// -----------------------------------------------------------------------------
+//
+void CCsdFaxUpNotifier::DoCancel()
+    {
+    if ( IsActive() )
+        {
+        iLine.NotifyCallAddedCancel();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCsdFaxUpNotifier::RunL
+// Handles the event that has arrived from RConnection
+// -----------------------------------------------------------------------------
+//
+void CCsdFaxUpNotifier::RunL()
+    {
+    // All RunL():s outside CServer-derived main class MUST NOT LEAVE.
+    // Use TRAPD when needed.
+
+    if ( iStatus.Int() != KErrNone )
+        {
+        LOGIT1("External Csd up event FAILED <%d>", iStatus.Int() )
+        }
+    else
+        {
+        RMmCustomAPI customApi;
+        RMmCustomAPI::TCallOrigin origin( RMmCustomAPI::EUnknown );
+
+        TInt ret = customApi.Open( *iMobilePhone );
+
+        if ( KErrNone == ret )
+            {
+            customApi.CallOrigin( iName, origin );
+            customApi.Close();
+            }
+
+        if ( origin == RMmCustomAPI::EOutsider )
+            {
+            TInt bearer( 0 );
+            TBearerInfo bearerInfo;
+            TInt err( KErrNone );
+
+            LOGIT("SERVER: EVENT -> new EXTERNAL CSD connection")
+
+            if ( iFaxModule->IsValid() )
+                {
+                // Sometimes when data call is rejected by the other end, a new
+                // data call is started before the old one has been notified to
+                // be closed. In this case send the EConnMonDeleteConnection to
+                // all clients that are listening.
+                iEventInfo.Reset();
+                iEventInfo.iEventType = EConnMonDeleteConnection;
+                iEventInfo.iConnectionId = iFaxModule->ConnectionId();
+
+                iServer->EventQueue()->Add( iEventInfo );
+
+                // Remove from server tables
+                iFaxModule->RemoveFromServer();
+
+                // Close the call
+                iFaxModule->CloseCall();
+
+                LOGIT("SERVER: Closed the unfinished EXTERNAL CSD connection")
+                }
+
+            err = iFaxModule->OpenCall( iName );
+
+            if ( KErrNone == err )
+                {
+                err = iFaxModule->GetBearer( bearer, bearerInfo );
+                }
+
+            if ( KErrNone == err )
+                {
+                // Send event to clients
+                TConnInfo connInfo( 0, 0, 0, bearer, bearerInfo );
+
+                iEventInfo.Reset();
+
+                iEventInfo.iEventType = EConnMonCreateConnection;
+
+                // Add to the connection table and fill in the new connectioId to connInfo
+                TRAP( ret, ( err = iServer->Iap()->AddConnectionL( connInfo ) ) );
+
+                if ( ret )
+                    {
+                    LOGIT("AddConnectionL failed.")
+                    return; // Can't leave
+                    }
+
+                // Set connection id
+                iEventInfo.iConnectionId = connInfo.iConnectionId;
+                iFaxModule->SetConnectionId( connInfo.iConnectionId );
+
+                // Send event to all clients that are listening
+                iServer->EventQueue()->Add( iEventInfo );
+                }
+            else
+                {
+                LOGIT("Could not get the external call info!")
+                }
+            }
+
+        // New request
+        Receive();
+        }
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CCsdStatusNotifier::CCsdStatusNotifier
+// -----------------------------------------------------------------------------
+//
+CCsdStatusNotifier::CCsdStatusNotifier(
+        CCsdFax* aFaxModule,
+        CConnMonServer* aServer )
+        :
+        CActive( EConnMonPriorityNormal ),
+        iFaxModule( aFaxModule ),
+        iServer( aServer )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCsdStatusNotifier::Construct
+// -----------------------------------------------------------------------------
+//
+void CCsdStatusNotifier::Construct()
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// Destructor
+CCsdStatusNotifier::~CCsdStatusNotifier()
+    {
+    Cancel();
+    }
+
+// -----------------------------------------------------------------------------
+// CCsdStatusNotifier::Start
+// Requests a new event (connection up/down) from RConnection
+// -----------------------------------------------------------------------------
+//
+void CCsdStatusNotifier::Start( RMobileCall* aCall )
+    {
+    // Cancel must be called before assigning a new aCall handle
+    if ( IsActive() )
+        {
+        Cancel();
+        }
+
+    iCall = aCall;
+    Receive();
+    }
+
+// -----------------------------------------------------------------------------
+// CCsdStatusNotifier::Receive
+// Requests a new event (connection up/down) from RConnection
+// -----------------------------------------------------------------------------
+//
+void CCsdStatusNotifier::Receive()
+    {
+    if ( IsActive() )
+        {
+        Cancel();
+        }
+
+    iCall->NotifyMobileCallStatusChange( iStatus, iMobileCallStatus );
+    SetActive();
+    }
+
+// -----------------------------------------------------------------------------
+// CCsdStatusNotifier::DoCancel
+// Cancels the request from RConnection.
+// -----------------------------------------------------------------------------
+//
+void CCsdStatusNotifier::DoCancel()
+    {
+    if ( IsActive() )
+        {
+        iCall->CancelAsyncRequest( EMobileCallNotifyMobileCallStatusChange );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCsdStatusNotifier::RunL
+// Handles the event that has arrived from RConnection
+// -----------------------------------------------------------------------------
+//
+void CCsdStatusNotifier::RunL()
+    {
+    // All RunL():s outside CServer-derived main class MUST NOT LEAVE.
+    // Use TRAPD when needed.
+
+    if ( iStatus.Int() != KErrNone )
+        {
+        LOGIT1("External Csd status FAILED <%d>", iStatus.Int() )
+        }
+    else
+        {
+        // Send event to clients
+        LOGIT1("SERVER: EVENT -> EXTERNAL CSD status changed <%d>", iMobileCallStatus )
+
+        iEventInfo.Reset();
+        iEventInfo.iEventType = EConnMonConnectionStatusChange;
+
+        iEventInfo.iConnectionId = iFaxModule->ConnectionId();
+
+        TInt status = iMobileCallStatus;
+        TInt err = iFaxModule->MapStatus( status );
+        iEventInfo.iData = status;
+
+        if ( ( iServer->NumberOfListeners() > 0 ) && ( err == KErrNone ) )
+            {
+            // Send event to all clients that are listening
+            iServer->EventQueue()->Add( iEventInfo );
+            }
+
+        if ( ( iMobileCallStatus == ( TInt )RMobileCall::EStatusDisconnecting )
+              ||
+             ( iMobileCallStatus == ( TInt )RMobileCall::EStatusDisconnectingWithInband ) )
+            {
+            // Send connection closed event to all clients that are listening
+            iEventInfo.Reset();
+            iEventInfo.iEventType = EConnMonDeleteConnection;
+            iEventInfo.iConnectionId = iFaxModule->ConnectionId();
+
+            iServer->EventQueue()->Add( iEventInfo );
+
+            // Remove from server tables
+            iFaxModule->RemoveFromServer();
+
+            // Close the call
+            iFaxModule->CloseCall();
+
+            // Stop listening
+            return;
+            }
+
+        // New request
+        Receive();
+        }
+    }
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/src/CDataVolume.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,143 @@
+/*
+* Copyright (c) 2002-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:  Issues RConnection::DataTransferredRequest() and sends the
+*                data volumes to sessions.
+*
+*/
+
+#include <es_sock.h>
+
+#include "CDataVolume.h"
+#include "ConnMonServ.h"
+#include "ConnMonDef.h"
+#include "log.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CDataVolume::CDataVolume
+// -----------------------------------------------------------------------------
+//
+CDataVolume::CDataVolume(
+        CConnMonServer* aServer,
+        RConnection* aConnection,
+        const TUint& aConnectionId )
+        :
+        CActive( EConnMonPriorityNormal ),
+        iServer( aServer ),
+        iConnection( aConnection ),
+        iConnectionId( aConnectionId ),
+        iDlData( 0 ),
+        iPckgDlData( iDlData ),
+        iUlData( 0 ),
+        iPckgUlData( iUlData )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CDataVolume::Construct
+// -----------------------------------------------------------------------------
+//
+void CDataVolume::Construct()
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// Destructor
+CDataVolume::~CDataVolume()
+    {
+    Cancel();
+    }
+
+// -----------------------------------------------------------------------------
+// CDataVolume::Receive
+// Requests a new event (activity changed) from RConnection
+// -----------------------------------------------------------------------------
+//
+void CDataVolume::Receive()
+    {
+    if ( IsActive() )
+        {
+        Cancel();
+        }
+
+    iUlData = 0;
+    iDlData = 0;
+
+    iConnection->DataTransferredRequest( iPckgUlData, iPckgDlData, iStatus );
+    SetActive();
+    }
+
+// -----------------------------------------------------------------------------
+// CDataVolume::DoCancel
+// Cancels the request from RConnection.
+// -----------------------------------------------------------------------------
+//
+void CDataVolume::DoCancel()
+    {
+    if ( IsActive() )
+        {
+        // Complete all outstanding data volume requests on this connection
+        // Use the latest data volumes got from the ESOCK.
+        iServer->SendDataVolumesToSessions(
+                iConnectionId,
+                iPckgDlData(),
+                iPckgUlData(),
+                KErrCancel );
+
+        // Cancel the request from RConnection
+        iConnection->DataTransferredCancel();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CDataVolume::RunL
+// Handles the event that has arrived from RConnection
+// -----------------------------------------------------------------------------
+//
+void CDataVolume::RunL()
+    {
+    //LOGENTRFN("CDataVolume::RunL()")
+
+    // All RunL():s outside CServer-derived main class MUST NOT LEAVE.
+    // Use TRAPD when needed.
+
+    LOGIT(".")
+    LOGIT1("RunL: CDataVolume, status %d", iStatus.Int())
+
+    if ( iStatus.Int() != KErrNone )
+        {
+        LOGIT1("SERVER: Data volume request FAILED <%d>", iStatus.Int())
+        }
+    else
+        {
+        LOGIT2("SERVER: Data volume request completed: d:%d, u:%d", iPckgDlData(), iPckgUlData())
+        }
+
+    // Complete all outstanding data volume requests on this connection
+    iServer->SendDataVolumesToSessions(
+            iConnectionId,
+            iPckgDlData(),
+            iPckgUlData(),
+            iStatus.Int() );
+
+    // This is a one-shot active object. The object is connection specific,
+    // constructed when needed for the first time, and reused as necessary.
+    // Delete happens only when the connection specific attribute tables are
+    // cleaned up.
+
+    //LOGEXITFN("CDataVolume::RunL()")
+    }
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/src/CEventQueue.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,163 @@
+/*
+* Copyright (c) 2002-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:  Event queue stores an event until all the clients can
+*                receive it.
+*
+*/
+
+#include "ConnMonServ.h"
+#include "ConnMonSess.h"
+#include "CEventQueue.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CEventQueue::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CEventQueue::ConstructL( CConnMonServer* aServer )
+    {
+    iServer=aServer;
+
+    // Allocate nodes
+    for ( TInt i=0; i < KEventQueueSize; i++ )
+        {
+        TEventNode* node = new( ELeave ) TEventNode;
+        iSlots.AddFirst( *node );
+        }
+
+    // Initialize latest event time
+    iLastEventTime.UniversalTime();
+    }
+
+// Destructor
+CEventQueue::~CEventQueue()
+    {
+    TEventNode* node;
+
+    // Deallocate nodes
+    for ( node=iSlots.First(); node; node=iSlots.First() )
+        {
+        iSlots.Remove( *node );
+        delete node;
+        }
+
+    for ( node=iEvents.First(); node; node=iEvents.First() )
+        {
+        if ( node->iEvent.iExtra.iPtr )
+            {
+            delete node->iEvent.iExtra.iPtr;
+            node->iEvent.iExtra.iPtr = NULL;
+            }
+
+        iEvents.Remove( *node );
+        delete node;
+        }
+
+    iServer = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CEventQueue::Add
+// -----------------------------------------------------------------------------
+//
+void CEventQueue::Add( const TEventInfo& aEventInfo, const TUint8* aPtr, TInt aSize  )
+    {
+    TTimeIntervalMicroSeconds microSecond( 1 );
+    iLastEventTime = iLastEventTime + microSecond;
+
+    // Get the first free slot - remove oldest event if queue is full
+    TEventNode* node = iSlots.First();
+
+    if ( !node )
+        {
+        //return;
+        node = iEvents.First();
+        FreeEvent( node );
+        node = iSlots.First();
+        }
+
+    iSlots.Remove( *node );
+
+    // Plug in values
+    node->iEvent.iInfo        = aEventInfo;
+    node->iEvent.iTime        = iLastEventTime;
+    node->iEvent.iExtra.iPtr  = aPtr;
+    node->iEvent.iExtra.iSize = aSize;
+
+    // Add to the event queue
+    iEvents.AddLast( *node );
+
+    // Offer the event to all the clients that are listening
+    // and have requested a new event.
+    TInt numOffered( 0 );
+    iServer->SendEventToSessions( node->iEvent, numOffered );
+
+    // Remove immediately from the queue if all the listeners have got the event
+    if ( numOffered == iServer->NumberOfListeners() )
+        {
+        FreeEvent( node );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CEventQueue::CheckEvents
+// See if there is a new event in the queue for aSession.
+// -----------------------------------------------------------------------------
+//
+void CEventQueue::CheckEvents( CConnMonSession* aSession )
+    {
+    TSglQueIter< TEventNode > iter( iEvents );
+
+    if ( aSession == 0 )
+        {
+        return;
+        }
+
+    for ( TEventNode* node = iter++; node; node = iter++ )
+        {
+        if ( aSession->CanReceiveEvent() )
+            {
+            if ( aSession->SendEventToClient( node->iEvent ) )
+                {
+                break;
+                }
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CEventQueue::FreeEvent
+// -----------------------------------------------------------------------------
+//
+void CEventQueue::FreeEvent( TEventNode* aNode )
+    {
+    if ( aNode != 0 )
+        {
+        if ( aNode->iEvent.iExtra.iPtr )
+            {
+            delete aNode->iEvent.iExtra.iPtr;
+            aNode->iEvent.iExtra.iPtr = NULL;
+            }
+
+        iEvents.Remove( *aNode );
+
+        aNode->iEvent.iInfo.Reset();
+        aNode->iEvent.iExtra.Reset();
+
+        iSlots.AddFirst( *aNode );
+        }
+    }
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/src/CIapSupport.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,208 @@
+/*
+* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Provides IAP availability information.
+*
+*/
+
+#include <commdb.h>
+#include <rconnmon.h>
+
+#include "CIapSupport.h"
+#include "ConnMonIAP.h"
+#include "ConnMonDef.h"
+#include "log.h"
+
+// -----------------------------------------------------------------------------
+// CIapSupport::CIapSupport
+// -----------------------------------------------------------------------------
+//
+CIapSupport::CIapSupport()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CIapSupport::~CIapSupport()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CIapSupport::NewL
+// -----------------------------------------------------------------------------
+//
+CIapSupport* CIapSupport::NewL()
+    {
+    CIapSupport* self = new( ELeave ) CIapSupport;
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CIapSupport::GetIapsFromCommDBL using TFullIapInfo
+// -----------------------------------------------------------------------------
+//
+void CIapSupport::GetIapsFromCommDbL(
+        const TUint& aBearerId,
+        TFullIapInfo& aIapBuf ) const
+    {
+    // Reset iap buffer
+    aIapBuf.Reset();
+
+    AppendIapsFromCommDbL( aBearerId, aIapBuf );
+    }
+
+// -----------------------------------------------------------------------------
+// CIapSupport::AppendIapsFromCommDBL
+// -----------------------------------------------------------------------------
+//
+void CIapSupport::AppendIapsFromCommDbL(
+        const TUint& aBearerId,
+        TFullIapInfo& aIapBuf ) const
+    {
+    LOGENTRFN("CIapSupport::AppendIapsFromCommDbL()")
+
+    CCommsDatabase* commDB = NULL;
+    CCommsDbTableView* table = NULL;
+
+    // Is already full...
+    if ( aIapBuf.iCount >= KConnMonMaxIAPCount )
+        {
+        LOGIT("AppendIapsFromCommDbL: table is already full")
+        LOGEXITFN("CIapSupport::AppendIapsFromCommDbL()")
+        return;
+        }
+
+    // Open commDB
+    commDB = CCommsDatabase::NewL();
+    CleanupStack::PushL( commDB );
+
+    // Iterate the IAP table from CommDB and store iaps with matching bearerID
+    table = commDB->OpenTableLC( TPtrC( IAP ) );
+
+    TInt err = table->GotoFirstRecord();
+
+    while ( !err && ( aIapBuf.iCount < KConnMonMaxIAPCount ) )
+        {
+        TUint iapBearerId( 0 );
+        TUint32 iapID( 0 );
+        TUint32 netID( 0 );
+        TBuf<KCommsDbSvrMaxFieldLength> bearerType;
+        TBuf<KCommsDbSvrMaxFieldLength> serviceType;
+
+        table->ReadUintL( TPtrC( COMMDB_ID ), iapID );
+        table->ReadUintL( TPtrC( IAP_NETWORK ), netID );
+
+        table->ReadTextL( TPtrC( IAP_BEARER_TYPE ), bearerType );
+        table->ReadTextL( TPtrC( IAP_SERVICE_TYPE ), serviceType );
+
+        // Find out the bearer ID of the IAP
+        if ( ( bearerType == TPtrC( VIRTUAL_BEARER ) ) &&
+                ( serviceType == TPtrC( VPN_SERVICE ) ) )
+            {
+            // VPN
+            iapBearerId = EBearerIdVirtualVPN;
+            }
+        else if ( serviceType == TPtrC( DIAL_OUT_ISP ) ||
+                serviceType == TPtrC( DIAL_IN_ISP ) )
+            {
+            // CSD
+            if ( aBearerId == EBearerIdWcdmaCSD )
+                {
+                iapBearerId = EBearerIdWcdmaCSD;
+                }
+            else
+                {
+                iapBearerId = EBearerIdCSD;
+                }
+            }
+        else if ( serviceType == TPtrC( OUTGOING_WCDMA ) ||
+                serviceType == TPtrC( INCOMING_WCDMA ) )
+            {
+            // GPRS or WCDMA
+            if ( aBearerId == EBearerIdWCDMA )
+                {
+                iapBearerId = EBearerIdWCDMA;
+                }
+            else
+                {
+                iapBearerId = EBearerIdGPRS;
+                }
+            }
+        else if ( serviceType == TPtrC( LAN_SERVICE ) )
+            {
+            // LAN or WLAN
+
+            // More checking is needed
+            TUint32 rowId;
+
+            table->ReadUintL( TPtrC( IAP_BEARER ), rowId );
+
+            // Open service table
+            CCommsDbTableView* table2 = commDB->OpenViewMatchingUintLC(
+                    bearerType,
+                    TPtrC( COMMDB_ID ),
+                    rowId );
+
+            // Get commDB name
+            TBuf<KCommsDbSvrMaxFieldLength> commDbName;
+
+            User::LeaveIfError( table2->GotoFirstRecord() );
+            table2->ReadTextL( TPtrC( COMMDB_NAME ), commDbName );
+            CleanupStack::PopAndDestroy( table2 );
+
+            if ( commDbName == TPtrC( KWlanBearerRecordName ) )
+                {
+                // WLAN
+                iapBearerId = EBearerIdWLAN;
+                }
+            else
+                {
+                // LAN = IP Passthrough
+                iapBearerId = EBearerIdLAN;
+                }
+            }
+        else
+            {
+            // Unknown bearer
+            iapBearerId = KIapSupportUnknown;
+            }
+
+        // Drop IAPs that don't match with the aBearerId
+        if ( aBearerId == iapBearerId ||
+                ( aBearerId == EBearerIdAll && iapBearerId != KIapSupportUnknown ) )
+            {
+            aIapBuf.iIap[aIapBuf.iCount].iIapId = iapID;
+            aIapBuf.iIap[aIapBuf.iCount].iNetId = netID;
+            aIapBuf.iIap[aIapBuf.iCount].iBearerId = iapBearerId;
+            aIapBuf.iCount++;
+            }
+
+        err = table->GotoNextRecord();
+        }
+
+    // err should be now KErrNotFound because there are no more records
+    if ( err != KErrNotFound )
+        {
+        User::Leave( err );
+        }
+
+    // Cleanup
+    CleanupStack::PopAndDestroy( table );
+    CleanupStack::PopAndDestroy( commDB );
+
+    LOGEXITFN("CIapSupport::AppendIapsFromCommDbL()")
+    }
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/src/CPlugin.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,826 @@
+/*
+* Copyright (c) 2003-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:  Plug-in object subsession.
+*
+*/
+
+#include "ConnMonServ.h"
+#include "ConnMonIAP.h"
+#include "CEventQueue.h"
+#include "CPlugin.h"
+#include "log.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// Constructor
+TAttributeRequest::TAttributeRequest(
+        TUint aType,
+        TUint aAttribute,
+        TUint aData )
+        :
+        iType( aType ),
+        iAttribute( aAttribute ),
+        iData( aData )
+    {
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPlugin::CPlugin
+// -----------------------------------------------------------------------------
+//
+CPlugin::CPlugin()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CPlugin::~CPlugin()
+    {
+    // Complete any outstanding plug-in request
+    CancelGetQuery();
+
+    // Close the attributes array
+    iAttributesSupported.Close();
+
+    // Complete all outstanding client requests
+    TInt count = iClientRequests.Count();
+
+    for ( TInt i = 0; i < count; i++ )
+        {
+        const TClientRequest* req = &( iClientRequests[i] );
+
+        // Complete only asynchronous client requests
+        if ( req->iType == EReqGetIntAttribute ||
+             req->iType == EReqGetUintAttribute ||
+             req->iType == EReqGetBoolAttribute ||
+             req->iType == EReqGetStringAttribute ||
+             req->iType == EReqGetPckgAttribute )
+            {
+            req->iMessage.Complete( KErrCancel );
+            }
+        }
+
+    iClientRequests.Close();
+
+    iSession = 0;
+
+    LOGIT1("SERVER: Plugin destroyed, id <%d>", iPluginId )
+    }
+
+// -----------------------------------------------------------------------------
+// CPlugin::NewL
+// -----------------------------------------------------------------------------
+//
+CPlugin* CPlugin::NewL( CConnMonSession* aSession, const TUint aPluginId )
+    {
+    CPlugin* self = new ( ELeave ) CPlugin;
+
+    CleanupStack::PushL( self );
+    self->ConstructL( aSession, aPluginId );
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CPlugin::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CPlugin::ConstructL( CConnMonSession* aSession, const TUint aPluginId )
+    {
+    TName name;
+
+    name.Format( KPluginName, this );
+    SetNameL( &name );
+
+    iSession = aSession;
+    iPluginId = aPluginId;
+    }
+
+// -----------------------------------------------------------------------------
+// CPlugin::RegisterAttribute
+// -----------------------------------------------------------------------------
+//
+TInt CPlugin::RegisterAttribute( const TUint aAttribute )
+    {
+    LOGIT2("SERVER: EReqPluginRegisterAttribute, id <%d>, attr <%d>", iPluginId, aAttribute )
+
+    for ( TInt i = 0; i < iAttributesSupported.Count(); i++ )
+        {
+        if ( iAttributesSupported[i] == aAttribute )
+            {
+            // Attribute has already been registered
+            return ( KErrNone );
+            }
+        }
+
+    iAttributesSupported.Append( aAttribute );
+
+    // Check if the clients have set 'KBearerAvailabilityThreshold' earlier
+    if ( aAttribute == KBearerAvailabilityThreshold )
+       {
+       TUint th( 0 );
+
+       // Have clients set the threshold earlier
+       iSession->iCmServer->CalculateThreshold( 0, EBearerAvailabilityThreshold, th );
+
+       if ( th == 1 )
+           {
+           // Add the request (set threshold) to the queue (aPending is EFalse)
+           const RMessage2 dummy;
+
+           TClientRequest clientReq( EReqInternalSetThreshold, EFalse, dummy );
+           iClientRequests.Append( clientReq );
+           }
+       }
+
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CPlugin::CancelRegisterAttribute
+// -----------------------------------------------------------------------------
+//
+TInt CPlugin::CancelRegisterAttribute( const TUint aAttribute )
+    {
+    LOGIT2("SERVER: EReqPluginCancelRegisterAttribute, id <%d>, attr <%d>", iPluginId, aAttribute )
+
+    for ( TInt i = 0; i < iAttributesSupported.Count(); i++ )
+        {
+        if ( iAttributesSupported[i] == aAttribute )
+            {
+            // Complete any outstanding client requets
+            TInt count = iClientRequests.Count();
+
+            for ( TInt j = 0; j < count; j++ )
+                {
+                const TClientRequest* req = &( iClientRequests[j] );
+
+                if  ( static_cast< TInt >( aAttribute ) == req->iMessage.Int2( ) )
+                    {
+                    // Complete only asynchronous client requests
+                    if ( req->iType == EReqGetIntAttribute ||
+                         req->iType == EReqGetUintAttribute ||
+                         req->iType == EReqGetBoolAttribute ||
+                         req->iType == EReqGetStringAttribute ||
+                         req->iType == EReqGetPckgAttribute )
+                        {
+                        req->iMessage.Complete( KErrCancel );
+                        }
+                    iClientRequests.Remove( j );
+                    count--;
+                    j--;
+                    }
+                }
+
+            iAttributesSupported.Remove( i );
+            return ( KErrNone );
+            }
+        }
+
+    return KErrNotFound;
+    }
+
+// -----------------------------------------------------------------------------
+// CPlugin::Event
+// -----------------------------------------------------------------------------
+//
+TInt CPlugin::Event(
+        const RMessage2& aMessage,
+        TEventInfo& aEventInfo,
+        TUint8*& aPtr,
+        TInt& aSize ) const
+    {
+    TUint eventId = aMessage.Int0();
+
+    TUint desLen = aMessage.GetDesLength( 1 );
+
+    // Max allowed data size is 512 bytes
+    if ( desLen > KConnMonMaxPluginDataSize )
+        {
+        return KErrTooBig;
+        }
+
+    HBufC8* buf = HBufC8::New( desLen );
+
+    if ( !buf )
+        {
+        return KErrNoMemory;
+        }
+
+    TPtr8 initptr = buf->Des();
+
+    // Read the contents of the client pointer into a TPtr.
+    TInt res = aMessage.Read( 1, initptr );
+
+    if ( res != KErrNone )
+        {
+        delete buf;
+        iSession->iCmServer->PanicClient( EBadDescriptor );
+        return KErrBadHandle;
+        }
+
+    // Create the event to be forwarded to the clients
+    aEventInfo.Reset();
+
+    aEventInfo.iEventType = eventId;
+    aEventInfo.iConnectionId = iPluginId;
+
+    if ( ( eventId == EConnMonSignalStrengthChange ) && ( desLen == sizeof( TInt ) ) )
+        {
+        // Signal strength changed event
+        aEventInfo.iData = static_cast<TInt>( *initptr.Ptr() );
+        }
+    else if ( ( eventId == EConnMonBearerAvailabilityChange ) && ( desLen == sizeof( TBool ) ) )
+        {
+        // Bearer availability changed event
+        aEventInfo.iData = static_cast<TBool>( *initptr.Ptr() );
+        }
+    else if ( ( eventId == EConnMonIapAvailabilityChange ) &&
+              ( desLen == sizeof( TConnMonIapInfo ) ) )
+        {
+        // IAP availability changed event
+        TConnMonIapInfo* receivedIapInfo =
+            const_cast<TConnMonIapInfo*>(
+                reinterpret_cast<const TConnMonIapInfo*>( initptr.Ptr() ) );
+
+        // Event contains only limited info on IAPs (= count + IDs)
+        TConnMonIapInfo* eventIaps( NULL );
+        eventIaps = new TConnMonIapInfo;
+
+        if ( eventIaps )
+            {
+            aEventInfo.iData = receivedIapInfo->Count();
+
+            eventIaps->iCount = receivedIapInfo->Count();
+
+            for ( TInt i = 0; i < KConnMonMaxIAPCount && i < receivedIapInfo->Count(); i++ )
+                {
+                eventIaps->iIap[i].iIapId = receivedIapInfo->iIap[i].iIapId;
+                }
+
+            aPtr = reinterpret_cast<TUint8*>( eventIaps );
+            aSize = sizeof( TConnMonIapInfo );
+            }
+        }
+    else if ( ( eventId >= EConnMonPluginEventBase ) && ( desLen == sizeof( TUint ) ) )
+        {
+        // Plugin specific event. Only 32-bit data (desLen is 4 bytes) supported so far
+        aEventInfo.iData = static_cast<TUint>( *initptr.Ptr() );
+        aEventInfo.iData2 = desLen;
+        }
+    else
+        {
+        // Event is not supported
+        LOGIT2("SERVER: Plugin sent unsupported event or length of the data was invalid. -> id <%d>, event <%d>", iPluginId, eventId )
+
+        delete buf;
+        return KErrNotSupported;
+        }
+
+    delete buf;
+
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CPlugin::Attribute
+// -----------------------------------------------------------------------------
+//
+TInt CPlugin::Attribute( const RMessage2& aMessage )
+    {
+    TUint attribute( aMessage.Int0() );
+    TInt  returnCode( aMessage.Int1() );
+
+    TUint desLen = aMessage.GetDesLength( 2 );
+
+    // Max allowed data size is 512 bytes
+    if ( desLen > KConnMonMaxPluginDataSize )
+        {
+        return KErrTooBig;
+        }
+
+    // Allocate a buffer for reading
+    HBufC8* buf = HBufC8::New( desLen );
+    TPtr8 initptr = buf->Des();
+
+    // read the contents of the client pointer into a TPtr.
+    TInt res = aMessage.Read( 2, initptr );
+
+    if ( res != KErrNone )
+        {
+        delete buf;
+        iSession->iCmServer->PanicClient( EBadDescriptor );
+
+        return KErrBadHandle;
+        }
+
+    TInt count = iClientRequests.Count();
+
+    // Complete all outstanding client request for this attribute
+    for ( TInt i = 0; i < count; i++ )
+        {
+        const TClientRequest* req = &( iClientRequests[i] );
+
+        if ( static_cast< TInt >( attribute ) == req->iMessage.Int2( ) )
+            {
+            // Found a request matching the attribute
+            switch ( req->iType )
+                {
+                case EReqGetIntAttribute:
+                    {
+                    if ( desLen != sizeof( TInt ) )
+                        {
+                        req->iMessage.Complete( KErrArgument );
+                        break;
+                        }
+
+                    TInt value = static_cast< TInt >( *initptr.Ptr() );
+
+                    LOGIT4("SERVER: Attribute from plugin, id <%d>, attr <%d>, -> value <%d>, ret <%d>", iPluginId, attribute, value, returnCode )
+
+                    TPtr8 n( reinterpret_cast< TUint8* >( &value ),
+                             sizeof( TInt ),
+                             sizeof( TInt ) );
+
+                    res = req->iMessage.Write( KAttributeParameterIndex, n );
+
+                    if ( res != KErrNone )
+                        {
+                        PanicWaitingClient( EBadDescriptor, req->iMessage );
+                        }
+                    else
+                        {
+                        req->iMessage.Complete( returnCode );
+                        }
+
+                    break;
+                    }
+                case EReqGetUintAttribute:
+                    {
+                    if ( desLen != sizeof( TUint ) )
+                        {
+                        req->iMessage.Complete( KErrArgument );
+                        break;
+                        }
+
+                    TUint value = static_cast< TUint >( *initptr.Ptr() );
+
+                    LOGIT4("SERVER: Attribute from plugin, id <%d>, attr <%d>, -> value <%d>, ret <%d>", iPluginId, attribute, value, returnCode )
+
+                    TPtr8 n( reinterpret_cast< TUint8* >( &value ),
+                             sizeof( TUint ),
+                             sizeof( TUint ) );
+
+                    res = req->iMessage.Write( KAttributeParameterIndex, n );
+
+                    if ( res != KErrNone )
+                        {
+                        PanicWaitingClient( EBadDescriptor, req->iMessage );
+                        }
+                    else
+                        {
+                        req->iMessage.Complete( returnCode );
+                        }
+                    break;
+                    }
+                case EReqGetBoolAttribute:
+                    {
+                    if ( desLen != sizeof( TBool ) )
+                        {
+                        req->iMessage.Complete( KErrArgument );
+                        break;
+                        }
+
+                    TBool value = static_cast< TBool >( *initptr.Ptr() );
+
+                    LOGIT4("SERVER: Attribute from plugin, id <%d>, attr <%d>, -> value <%d>, ret <%d>", iPluginId, attribute, value, returnCode )
+
+                    TPtr8 n( reinterpret_cast< TUint8* >( &value ),
+                             sizeof( TBool ),
+                             sizeof( TBool ) );
+
+                    res = req->iMessage.Write( KAttributeParameterIndex, n );
+
+                    if ( res != KErrNone )
+                        {
+                        PanicWaitingClient( EBadDescriptor, req->iMessage );
+                        }
+                    else
+                        {
+                        req->iMessage.Complete( returnCode );
+                        }
+
+                    break;
+                    }
+                 case EReqGetPckgAttribute:
+                    {
+                    // Write as such to the client area since this is TDes8
+                    LOGIT3("SERVER: Attribute from plugin, id <%d>, attr <%d>, -> ret <%d>", iPluginId, attribute, returnCode )
+
+                    res = req->iMessage.Write( KAttributeParameterIndex, initptr );
+
+                    if ( res != KErrNone )
+                        {
+                        PanicWaitingClient( EBadDescriptor, req->iMessage );
+                        }
+                    else
+                        {
+                        req->iMessage.Complete( returnCode );
+                        }
+                    break;
+                    }
+                 case EReqGetStringAttribute:
+                    {
+                    // String is a 16-bit descriptor.
+                    // Allocate a 16-bit buffer for reading the string.
+                    HBufC* buf16 = HBufC::New( desLen );
+                    TPtr initptr16 = buf16->Des();
+
+                    // read the contents of the client pointer into a TPtr.
+                    res = aMessage.Read( 2, initptr16 );
+
+                    if ( res != KErrNone )
+                        {
+                        delete buf;
+                        delete buf16;
+                        iSession->iCmServer->PanicClient( EBadDescriptor );
+
+                        return KErrBadHandle;
+                        }
+
+                    LOGIT3("SERVER: Attribute from plugin, id <%d>, attr <%d>, -> ret <%d>", iPluginId, attribute, returnCode )
+
+                    res = req->iMessage.Write( KAttributeParameterIndex, initptr16 );
+
+                    if ( res != KErrNone )
+                        {
+                        PanicWaitingClient( EBadDescriptor, req->iMessage );
+                        }
+                    else
+                        {
+                        req->iMessage.Complete( returnCode );
+                        }
+
+                    delete buf16;
+
+                    break;
+                    }
+                 default:
+                    {
+                    delete buf;
+                    return KErrNotSupported;
+                    }
+                } // switch
+
+            // Remove the query because it has been served
+            iClientRequests.Remove( i );
+            count--;
+            i--;
+            }  // if
+        } // For
+
+    delete buf;
+
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CPlugin::GetQuery
+// -----------------------------------------------------------------------------
+//
+TInt CPlugin::GetQuery()
+    {
+    if ( !iPluginReqActive )
+        {
+        return KErrNotReady;
+        }
+
+    // Check if there is a client request waiting in the queue
+    TInt count = iClientRequests.Count();
+
+    for ( TInt i = 0; i < count; i++ )
+        {
+        if ( !iClientRequests[i].iPending )
+            {
+            TInt attribute( iClientRequests[i].iMessage.Int2() );
+            TInt data( iClientRequests[i].iMessage.Int3() );
+
+            // Send the attribute request to the plug-in
+            TAttributeRequest req( iClientRequests[i].iType, attribute, 0 );
+
+            if ( req.iType == EReqSetIntAttribute ||
+                 req.iType == EReqSetUintAttribute ||
+                 req.iType == EReqSetBoolAttribute )
+                {
+                req.iData = data;
+                }
+            else if ( req.iType == EReqInternalSetThreshold )
+                {
+                req.iType      = EReqSetUintAttribute;
+                req.iAttribute = KBearerAvailabilityThreshold;
+                req.iData      = 1;
+                }
+            else if ( req.iType == EReqInternalResetThreshold )
+                {
+                req.iType      = EReqSetUintAttribute;
+                req.iAttribute = KBearerAvailabilityThreshold;
+                req.iData      = 0;
+                }
+
+            TPtr8 n( reinterpret_cast< TUint8* >( &req ),
+                     sizeof( TAttributeRequest ),
+                     sizeof( TAttributeRequest ) );
+
+            TInt res = iPluginReqMessage.Write( 0, n );
+
+            if ( res != KErrNone )
+                {
+                iSession->iCmServer->PanicClient( EBadDescriptor );
+                }
+            else
+                {
+                // Complete the message
+                iPluginReqMessage.Complete( KErrNone );
+                }
+
+            iPluginReqActive=EFalse;
+
+            if ( req.iType == EReqSetIntAttribute ||
+                 req.iType == EReqSetUintAttribute ||
+                 req.iType == EReqSetBoolAttribute ||
+                 req.iType == EReqSetStringAttribute ||
+                 req.iType == EReqSetPckgAttribute )
+                {
+                // This request is synchronous and has already been completed
+                iClientRequests.Remove( i );
+                count--;
+                i--;
+                }
+
+            return KErrNone;
+            }
+        }
+
+    // Queue was empty.
+    // Just wait for a client request to arrive.
+    return KRequestPending;
+    }
+
+// -----------------------------------------------------------------------------
+// CPlugin::GetQuery
+// -----------------------------------------------------------------------------
+//
+TInt CPlugin::GetQuery( const RMessage2& aMessage )
+    {
+    __ASSERT_DEBUG( !iPluginReqActive, PanicServer( EReceiveAlreadyActive ) );
+
+    LOGIT("SERVER: EReqPluginGetQuery")
+
+    // Remember attribute request
+    iPluginReqMessage = aMessage;
+    iPluginReqBuffer = aMessage.Ptr0();
+    iPluginReqActive = ETrue;
+
+    return GetQuery();
+    }
+
+// -----------------------------------------------------------------------------
+// CPlugin::CancelGetQuery
+// -----------------------------------------------------------------------------
+//
+TInt CPlugin::CancelGetQuery()
+    {
+    LOGIT("SERVER: EReqPluginCancelGetQuery")
+
+    if ( iPluginReqActive )
+        {
+        iPluginReqMessage.Complete( KErrCancel );
+        iPluginReqActive = EFalse;
+        }
+
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CPlugin::GetAttributeForClient
+// From a CLIENT.
+// -----------------------------------------------------------------------------
+//
+TInt CPlugin::GetAttributeForClient( const TInt aType, const RMessage2& aMessage )
+    {
+    LOGENTRFN("CPlugin::GetAttributeForClient()")
+    TUint connectionId( aMessage.Int0() );
+    TUint attribute( aMessage.Int2() );
+    TInt data( aMessage.Int3() );
+
+    if ( aType == EReqInternalSetThreshold || aType == EReqInternalResetThreshold )
+        {
+        connectionId = iPluginId;
+        attribute = KBearerAvailabilityThreshold;
+        }
+
+    if ( connectionId <= KMaxConnectionId )
+        {
+        // Client is asking an attribute using a normal connectionID instead of pluginID.
+        TInt bearer( EBearerUnknown );
+        TBearerInfo bearerInfo;
+
+        TInt ret = iSession->iCmServer->Iap()->GetBearer( connectionId, bearer, bearerInfo );
+
+        if ( ret == KErrNone )
+            {
+            // Find the corresponding pluginID
+            if ( bearer == EBearerWLAN )
+                {
+                connectionId = EBearerIdWLAN;
+                }
+            else if ( bearer == EBearerLAN )
+                {
+                connectionId = EBearerIdLAN;
+                }
+            }
+        }
+
+    // Check that request is aimed to this plugin.
+    if ( connectionId != iPluginId )
+        {
+        LOGEXITFN1("CPlugin::GetAttributeForClient()", KErrNotSupported)
+        return KErrNotSupported;
+        }
+
+    if ( aType == EReqSetStringAttribute || aType == EReqSetPckgAttribute )
+        {
+        // Setting string or packaged attributes is not supported
+        LOGEXITFN1("CPlugin::GetAttributeForClient()", KErrNotSupported)
+        return KErrNotSupported;
+        }
+
+    for ( TInt i = 0; i < iAttributesSupported.Count(); i++ )
+        {
+        if ( iAttributesSupported[i] == attribute )
+            {
+            TAttributeRequest req( aType, attribute, 0 );
+
+            if ( aType == EReqSetIntAttribute ||
+                 aType == EReqSetUintAttribute ||
+                 aType == EReqSetBoolAttribute )
+                {
+                req.iData = data;
+                }
+            else if ( aType == EReqInternalSetThreshold )
+                {
+                req.iType = EReqSetUintAttribute;
+                req.iData = 1;
+                }
+            else if ( aType == EReqInternalResetThreshold )
+                {
+                req.iType = EReqSetUintAttribute;
+                req.iData = 0;
+                }
+
+            if ( iPluginReqActive )
+                {
+                TBool pending( ETrue );
+
+                // Send the attribute request to the plug-in
+                TPtr8 n( reinterpret_cast< TUint8* >( &req ),
+                         sizeof( TAttributeRequest ),
+                         sizeof( TAttributeRequest ) );
+
+                TInt res = iPluginReqMessage.Write( 0, n );
+
+                if ( res != KErrNone )
+                    {
+                    PanicWaitingClient( EBadDescriptor, iPluginReqMessage );
+                    pending = EFalse;
+                    }
+                else
+                    {
+                    // Complete the message
+                    iPluginReqMessage.Complete( KErrNone );
+                    }
+
+                iPluginReqActive=EFalse;
+
+                // Add the request to queue
+                // aPending is ETrue
+                if ( aType == EReqGetIntAttribute ||
+                     aType == EReqGetUintAttribute ||
+                     aType == EReqGetBoolAttribute ||
+                     aType == EReqGetStringAttribute ||
+                     aType == EReqGetPckgAttribute )
+                    {
+                    TClientRequest clientReq( aType, pending, aMessage );
+                    iClientRequests.Append( clientReq );
+                    }
+                }
+            else
+                {
+                // Add the request to the queue
+                // aPending is EFalse
+                TClientRequest clientReq( aType, EFalse, aMessage );
+                iClientRequests.Append( clientReq );
+                }
+
+            LOGEXITFN1("CPlugin::GetAttributeForClient()", KRequestPending)
+            return KRequestPending;
+            }
+        }
+
+    LOGEXITFN1("CPlugin::GetAttributeForClient()", KErrNotSupported)
+    return KErrNotSupported;
+    }
+
+// -----------------------------------------------------------------------------
+// CPlugin::CancelGetAttributeForClient
+// From a CLIENT.
+// -----------------------------------------------------------------------------
+//
+void CPlugin::CancelGetAttributeForClient( const RThread& aClient, const TInt aType )
+    {
+    TInt count = iClientRequests.Count();
+
+    for ( TInt i = 0; i < count; i++ )
+        {
+        const TClientRequest* req = &( iClientRequests[i] );
+
+        RThread client;
+
+        TInt err = req->iMessage.Client( client );
+
+        if ( err == KErrNone )
+            {
+            if  ( ( static_cast< TUint >( aType ) == req->iType )  &&
+                  ( client.Id() == aClient.Id() ) )
+                {
+                req->iMessage.Complete( KErrCancel );
+
+                iClientRequests.Remove( i );
+                count--;
+                i--;
+                }
+
+            client.Close();
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CPlugin::SetAttributeForClient
+// From a CLIENT.
+// -----------------------------------------------------------------------------
+//
+TInt CPlugin::SetAttributeForClient( const TInt aType, const RMessage2& aMessage )
+    {
+    TInt ret = GetAttributeForClient( aType, aMessage );
+
+    if ( ret == KRequestPending )
+        {
+        // Complete immediately
+        return KErrNone;
+        }
+    else
+        {
+        return ret;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CPlugin::PanicWaitingClient
+// -----------------------------------------------------------------------------
+//
+void CPlugin::PanicWaitingClient( TInt aPanic, const RMessage2& aMessage ) const
+    {
+    // Let's have a look before we panic the client
+    __DEBUGGER()
+
+    // Ok, go for it
+    RThread client;
+
+    TInt err =  aMessage.Client( client );
+
+    if ( err == KErrNone )
+        {
+        _LIT( KPanicMessage, "ConnMonServ" );
+        client.Panic( KPanicMessage, aPanic );
+        client.Close();
+        }
+    }
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/src/CPsdFax.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,1348 @@
+/*
+* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  PSD fax connection information.
+*
+*/
+
+#include <utf.h>
+
+#include "ConnMonServ.h"
+#include "ConnMonIAP.h"
+#include "CEventQueue.h"
+#include "CPsdFax.h"
+#include "log.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPsdFax::CPsdFax
+// -----------------------------------------------------------------------------
+//
+CPsdFax::CPsdFax(
+        CConnMonServer* aServer,
+        RTelServer* aTelServer,
+        RMobilePhone* aMobilePhone,
+        RPacketService* aPacketService )
+        :
+        iServer( aServer ),
+        iTelServer( aTelServer ),
+        iMobilePhone( aMobilePhone ),
+        iPacketService( aPacketService )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CPsdFax::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CPsdFax::ConstructL()
+    {
+    //LOGENTRFN("CPsdFax::ConstructL()")
+
+    // Create external connection Up notifier object
+    if ( !iConnUpNotifier )
+        {
+        iConnUpNotifier = new( ELeave ) CPsdFaxUpNotifier(
+                this,
+                iServer,
+                iPacketService );
+        // Set object to active scheduler
+        iConnUpNotifier->Construct();
+
+        // Start listening events from RConnection
+        iConnUpNotifier->Receive();
+        }
+
+    //LOGEXITFN("CPsdFax::ConstructL()")
+    }
+
+// -----------------------------------------------------------------------------
+// CPsdFax::~CPsdFax
+// -----------------------------------------------------------------------------
+//
+CPsdFax::~CPsdFax()
+    {
+    // Delete connection Up notifier object
+    if ( iConnUpNotifier )
+        {
+        iConnUpNotifier->Cancel();
+        delete iConnUpNotifier;
+        iConnUpNotifier = NULL;
+        }
+
+    // Delete all ConnectionData objects
+    for ( TUint index = 0; index < KMaxPsdConnectionCount; index++ )
+        {
+        if ( iConnectionData[index] )
+            {
+            if ( iConnectionData[index]->IsOpen() )
+                {
+                iConnectionData[index]->CloseContext();
+                }
+
+            delete iConnectionData[index];
+            iConnectionData[index] = NULL;
+            }
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPsdFax::OpenContext
+// -----------------------------------------------------------------------------
+//
+TInt CPsdFax::OpenContext( const TUint aIndex, const TDes& aName )
+    {
+    LOGENTRFN("CPsdFax::OpenContext()")
+    TInt err( KErrNone );
+
+    // Create ConnectionData object
+    if ( !iConnectionData[aIndex] )
+        {
+        // Leave left out intentionally, check for NULL instead
+        iConnectionData[aIndex] = new CPsdFaxConnectionData( this, iServer, iPacketService ); // No (ELeave)
+        if ( !iConnectionData[aIndex] )
+            {
+            err = KErrNoMemory;
+            }
+        else
+            {
+            // Start external connection status notifier
+            err = iConnectionData[aIndex]->Construct();
+            if ( err != KErrNone )
+                {
+                // Free allocated resources if failed
+                err = KErrNoMemory;
+                delete iConnectionData[aIndex];
+                iConnectionData[aIndex] = NULL;
+                }
+            }
+        }
+
+    if ( KErrNone == err )
+        {
+        // Open context to be used in queries
+        err = iConnectionData[aIndex]->OpenContext( aName );
+        if ( KErrNone == err )
+            {
+            // Set start time to current time
+            iConnectionData[aIndex]->ResetStartTime();
+            }
+        else
+            {
+            // Free allocated resources if failed
+            delete iConnectionData[aIndex];
+            iConnectionData[aIndex] = NULL;
+            }
+        }
+
+    LOGEXITFN1("CPsdFax::OpenContext()", err)
+    return err;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPsdFax::IsValid
+// -----------------------------------------------------------------------------
+//
+TBool CPsdFax::IsValid( const TUint aConnectionId )
+    {
+    LOGENTRFN("CPsdFax::IsValid()")
+    TBool result( EFalse );
+
+    TInt index = ConnectionIndex( aConnectionId );
+    if ( KErrNotFound != index && iConnectionData[index]->IsOpen() )
+        {
+        LOGIT("IsValid: connection is valid (open)")
+        result = ETrue;
+        }
+    else if ( !iConnUpNotifier->IsActive() )
+        {
+        LOGIT("IsValid: connection up notifier is not active -> restart listening")
+        iConnUpNotifier->Receive(); // Restart listening
+        }
+
+    LOGEXITFN1("CPsdFax::IsValid()", result)
+    return result;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPsdFax::ConnectionIndex
+// -----------------------------------------------------------------------------
+//
+TInt CPsdFax::ConnectionIndex( const TUint aConnectionId )
+    {
+    LOGENTRFN("CPsdFax::ConnectionIndex()")
+
+    // Check PSD connection IDs
+    for ( TInt index = 0; index < KMaxPsdConnectionCount; index++ )
+        {
+        if ( iConnectionData[index] )
+            {
+            // Return connection table index if IDs match
+            if ( iConnectionData[index]->ConnectionId() == aConnectionId )
+                {
+                LOGIT2("CPsdFax::ConnectionIndex() - ConnID %d match, return index %d", aConnectionId, index)
+                LOGEXITFN("CPsdFax::ConnectionIndex()")
+                return index;
+                }
+            }
+        }
+
+    LOGEXITFN("CPsdFax::ConnectionIndex()")
+    return KErrNotFound;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPsdFax::SetConnectionId
+// -----------------------------------------------------------------------------
+//
+TInt CPsdFax::SetConnectionId( const TUint aIndex, const TUint aConnectionId )
+    {
+    LOGENTRFN("CPsdFax::SetConnectionId()")
+    TInt err( KErrNone );
+
+    // Check if connection is open
+    if ( !iConnectionData[aIndex]->IsOpen() )
+        {
+        err = KErrNotFound;
+        }
+    else
+        {
+        // Set connection ID
+        iConnectionData[aIndex]->SetConnectionId( aConnectionId );
+        }
+
+    LOGEXITFN1("CPsdFax::SetConnectionId()", err)
+    return err;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPsdFax::GetBearer
+// -----------------------------------------------------------------------------
+//
+TInt CPsdFax::GetBearer( TInt& aBearer, TBearerInfo& aBearerInfo )
+    {
+    LOGENTRFN("CPsdFax::GetBearer()")
+    TInt err( KErrNone );
+    RMobilePhone::TMobilePhoneNetworkMode mode;
+
+    err = iMobilePhone->GetCurrentMode( mode );
+    if ( KErrNone == err )
+        {
+        switch( mode )
+            {
+            case RMobilePhone::ENetworkModeWcdma:
+                aBearer = EBearerExternalWCDMA;
+                aBearerInfo.iBearer = iServer->Iap()->HsxpaStatus();
+                aBearerInfo.iInternal = EFalse;
+                break;
+            case RMobilePhone::ENetworkModeCdma2000:
+                aBearer = EBearerExternalCDMA2000;
+                aBearerInfo.iBearer = EBearerInfoCDMA2000;
+                aBearerInfo.iInternal = EFalse;
+                break;
+            case RMobilePhone::ENetworkModeGsm:
+                if ( iServer->Iap()->IsEdgeCell() )
+                    {
+                    aBearer = EBearerExternalEdgeGPRS;
+                    aBearerInfo.iBearer = EBearerInfoEdgeGPRS;
+                    aBearerInfo.iInternal = EFalse;
+                    }
+                else
+                    {
+                    aBearer = EBearerExternalGPRS;
+                    aBearerInfo.iBearer = EBearerInfoGPRS;
+                    aBearerInfo.iInternal = EFalse;
+                    }
+                break;
+            default:
+                err = KErrUnknown;
+                break;
+            }
+        }
+
+    LOGEXITFN1("CPsdFax::GetBearer()", err)
+    return err;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPsdFax::GetAPN
+// -----------------------------------------------------------------------------
+//
+TInt CPsdFax::GetApn( const TUint aConnectionId, TDes& aName )
+    {
+    LOGENTRFN("CPsdFax::GetApn()")
+    TInt err( KErrNone );
+    TInt bearer( 0 );
+    TBearerInfo bearerInfo;
+
+    // Check if connection ID is valid and connection is open
+    TInt index = ConnectionIndex( aConnectionId );
+    if ( KErrNotFound == index || !iConnectionData[index]->IsOpen() )
+        {
+        err = KErrNotFound;
+        }
+    else
+        {
+        err = GetBearer( bearer, bearerInfo );
+        if ( KErrNone == err )
+            {
+            if ( !( bearer != EBearerExternalCDMA2000 &&
+                    ( bearerInfo.iBearer != EBearerInfoCDMA2000 && !bearerInfo.iInternal ) ) )
+                {
+                err = KErrNotSupported;
+                LOGIT("GetApn: bearer == EBearerExternalCDMA2000, returning KErrNotSupported")
+                }
+            else
+                {
+                // Get connection APN
+                err = iConnectionData[index]->GetApn( aName );
+                }
+            }
+        }
+
+    LOGEXITFN1("CPsdFax::GetApn()", err)
+    return err;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPsdFax::GetProtocolType
+// -----------------------------------------------------------------------------
+//
+TInt CPsdFax::GetProtocolType( const TUint aConnectionId, TInt& aProtocolType )
+    {
+    LOGENTRFN("CPsdFax::GetProtocolType()")
+    TInt err( KErrNone );
+    TInt bearer( 0 );
+    TBearerInfo bearerInfo;
+
+    // Check if connection ID is valid and connection is open
+    TInt index = ConnectionIndex( aConnectionId );
+    if ( KErrNotFound == index || !iConnectionData[index]->IsOpen() )
+        {
+        err = KErrNotFound;
+        }
+    else
+        {
+        err = GetBearer( bearer, bearerInfo );
+        if ( KErrNone == err )
+            {
+            if ( !( bearer != EBearerExternalCDMA2000 &&
+                    ( bearerInfo.iBearer != EBearerInfoCDMA2000 && !bearerInfo.iInternal ) ) )
+                {
+                aProtocolType = EProtocolTypeUnknown;
+                LOGIT("GetProtocolType: bearer == EBearerExternalCDMA2000, returning KErrNone")
+                }
+            else
+                {
+                // Get connection protocol type
+                err = iConnectionData[index]->GetProtocolType( aProtocolType );
+                }
+            }
+        }
+
+    LOGEXITFN1("CPsdFax::GetProtocolType()", err)
+    return err;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPsdFax::GetStatus
+// -----------------------------------------------------------------------------
+//
+TInt CPsdFax::GetStatus( const TUint aConnectionId, TInt& aStatus )
+    {
+    LOGENTRFN("CPsdFax::GetStatus()")
+    TInt err( KErrNone );
+
+    // Check if connection ID is valid and connection is open
+    TInt index = ConnectionIndex( aConnectionId );
+    if ( KErrNotFound == index || !iConnectionData[index]->IsOpen() )
+        {
+        err = KErrNotFound;
+        }
+    else
+        {
+        // Get connection status
+        err = iConnectionData[index]->GetStatus( aStatus );
+        }
+
+    LOGEXITFN1("CPsdFax::GetStatus()", err)
+    return err;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPsdFax::GetDataVolumes
+// -----------------------------------------------------------------------------
+//
+TInt CPsdFax::GetDataVolumes( const TUint aConnectionId, TUint& aDLVolume, TUint& aULVolume )
+    {
+    LOGENTRFN("CPsdFax::GetDataVolumes()")
+    TInt err( KErrNone );
+
+    TInt index = ConnectionIndex( aConnectionId );
+    if ( KErrNotFound == index || !iConnectionData[index]->IsOpen() )
+        {
+        err = KErrNotFound;
+        }
+    else
+        {
+        // Get data volumes
+        err = iConnectionData[index]->GetDataVolumes( aDLVolume, aULVolume );
+        }
+
+    LOGEXITFN1("CPsdFax::GetDataVolumes()", err)
+    return err;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPsdFax::GetStartTime
+// -----------------------------------------------------------------------------
+//
+TInt CPsdFax::GetStartTime( const TUint aConnectionId, TTime& aTime )
+    {
+    LOGENTRFN("CPsdFax::GetStartTime()")
+    TInt err( KErrNone );
+
+    // Check if connection ID is valid and connection is open
+    TInt index = ConnectionIndex( aConnectionId );
+    if ( KErrNotFound == index || !iConnectionData[index]->IsOpen() )
+        {
+        err = KErrNotFound;
+        }
+    else
+        {
+        // Get connection start time
+        err = iConnectionData[index]->GetStartTime( aTime );
+        }
+
+    LOGEXITFN1("CPsdFax::GetStartTime()", err)
+    return err;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPsdFax::Stop
+// -----------------------------------------------------------------------------
+//
+TInt CPsdFax::Stop( const TUint aConnectionId )
+    {
+    LOGENTRFN("CPsdFax::Stop()")
+    TInt err( KErrNone );
+
+    // Check if connection ID is valid and connection is open
+    TInt index = ConnectionIndex( aConnectionId );
+    if ( index == KErrNotFound || !iConnectionData[index]->IsOpen() )
+        {
+        LOGIT1("CPsdFax::Stop() connection not found, index %d", index)
+        err = KErrNotFound;
+        }
+    else
+        {
+        // Stop connection
+        err = iConnectionData[index]->Stop();
+        }
+
+    LOGEXITFN1("CPsdFax::Stop()", err)
+    return err;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPsdFax::DeleteConnections
+// -----------------------------------------------------------------------------
+//
+void CPsdFax::DeleteConnections()
+    {
+    LOGENTRFN("CPsdFax::DeleteConnections()")
+
+    // Delete all ended ConnectionData objects
+    for ( TUint index = 0; index < KMaxPsdConnectionCount; index++ )
+        {
+        if ( iConnectionData[index] )
+            {
+            if ( iConnectionData[index]->IsEnded() )
+                {
+                LOGIT1("DeleteConnections: deleting connection index %d", index)
+                delete iConnectionData[index];
+                iConnectionData[index] = NULL;
+                }
+            }
+        }
+    LOGEXITFN("CPsdFax::DeleteConnections()")
+    }
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPsdFaxUpNotifier::CPsdFaxUpNotifier
+// -----------------------------------------------------------------------------
+//
+CPsdFaxUpNotifier::CPsdFaxUpNotifier(
+        CPsdFax* aFaxModule,
+        CConnMonServer* aServer,
+        RPacketService* aPacketService )
+        :
+        CActive( EConnMonPriorityNormal ),
+        iFaxModule( aFaxModule ),
+        iServer( aServer ),
+        iPacketService( aPacketService )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CPsdFaxUpNotifier::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CPsdFaxUpNotifier::Construct()
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CPsdFaxUpNotifier::~CPsdFaxUpNotifier
+// -----------------------------------------------------------------------------
+//
+CPsdFaxUpNotifier::~CPsdFaxUpNotifier()
+    {
+    Cancel();
+    }
+
+// -----------------------------------------------------------------------------
+// CPsdFaxUpNotifier::Receive
+// Requests a new event (connection up/down) from RConnection
+// -----------------------------------------------------------------------------
+//
+void CPsdFaxUpNotifier::Receive()
+    {
+    if ( IsActive() )
+        {
+        Cancel();
+        }
+
+    iName.FillZ();
+    iName.Zero();
+
+    iPacketService->NotifyContextAdded( iStatus, iName );
+    SetActive();
+    }
+
+// -----------------------------------------------------------------------------
+// CPsdFaxUpNotifier::DoCancel
+// Cancels the request from RConnection.
+// -----------------------------------------------------------------------------
+//
+void CPsdFaxUpNotifier::DoCancel()
+    {
+    if ( IsActive() )
+        {
+        iPacketService->CancelAsyncRequest( EPacketNotifyContextAdded );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CPsdFaxUpNotifier::RunL
+// Handles the event that has arrived from RConnection
+// -----------------------------------------------------------------------------
+//
+void CPsdFaxUpNotifier::RunL()
+    {
+    // All RunL()'s outside CServer-derived main class MUST NOT LEAVE.
+    // Use TRAPD when needed.
+    //LOGENTRFN("CPsdFaxUpNotifier::RunL()")
+
+    LOGIT(".")
+    LOGIT1("RunL: CPsdFaxUpNotifier, status %d", iStatus.Int())
+
+    if ( KErrNone != iStatus.Int() )
+        {
+        LOGIT1("CPsdFaxUpNotifier: PSD context up event FAILED <%d>", iStatus.Int())
+        }
+    else
+        {
+        // For external connection, context name must be "External, External2, External3 etc"
+        LOGIT1("CPsdFaxUpNotifier: new PSD context name: %s", iName.PtrZ())
+
+        TName contextName = iName;
+        contextName.LowerCase();
+
+        // Check which external connection created
+        for ( TUint index = 0; index < KMaxPsdConnectionCount; index++ )
+            {
+            TBuf<KMaxName> tempName( KExternalName );
+
+            // Add connection number to string if index is > 1
+            if ( index > 0)
+                {
+                tempName.AppendNum( index+1 );
+                }
+
+            // Compare to context name
+            TInt res = contextName.Compare( tempName );
+            if ( res == 0 )
+                {
+                LOGIT1("CPsdFaxUpNotifier: new external PSD connection with index %d", index)
+
+                // Open context
+                TInt err = iFaxModule->OpenContext( index, iName );
+
+                // Break from loop
+                break;
+                }
+            }
+
+        // New request
+        Receive();
+        }
+    //LOGEXITFN("CPsdFaxUpNotifier::RunL()")
+    }
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPsdFaxConnectionData::CPsdFaxConnectionData
+// -----------------------------------------------------------------------------
+//
+CPsdFaxConnectionData::CPsdFaxConnectionData(
+        CPsdFax* aFaxModule,
+        CConnMonServer* aServer,
+        RPacketService* aPacketService )
+        :
+        iConnectionId ( 0 ),
+        iOpen ( EFalse ),
+        iTimeValid ( EFalse ),
+        iEnded ( EFalse ),
+        iFaxModule( aFaxModule ),
+        iServer( aServer ),
+        iPacketService( aPacketService )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPsdFaxConnectionData::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CPsdFaxConnectionData::ConstructL()
+    {
+    LOGENTRFN("CPsdFaxConnectionData::ConstructL()")
+
+    // Create external connection Status notifier object
+    if ( !iStatusNotifier )
+        {
+        iStatusNotifier = new( ELeave ) CPsdFaxStatusNotifier(
+                iFaxModule,
+                iServer,
+                iPacketService,
+                this );
+        // Start external connection Status notifier
+        iStatusNotifier->Construct();
+        }
+
+    LOGEXITFN("CPsdFaxConnectionData::ConstructL()")
+    }
+
+// -----------------------------------------------------------------------------
+// CPsdFaxConnectionData::Construct
+// -----------------------------------------------------------------------------
+//
+TInt CPsdFaxConnectionData::Construct()
+    {
+    LOGENTRFN("CPsdFaxConnectionData::Construct()")
+    TInt err( KErrNone );
+
+    // Create external connection Status notifier object
+    if ( !iStatusNotifier )
+        {
+        // Leave left out intentionally, check for NULL instead
+        iStatusNotifier = new CPsdFaxStatusNotifier( iFaxModule, iServer, iPacketService, this ); // No (ELeave)
+        if ( !iStatusNotifier )
+            {
+            err = KErrNoMemory;
+            }
+        else
+            {
+            // Start external connection Status notifier
+            iStatusNotifier->Construct();
+            }
+        }
+
+    LOGEXITFN1("CPsdFaxConnectionData::Construct()", err)
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CPsdFaxConnectionData::~CPsdFaxConnectionData
+// -----------------------------------------------------------------------------
+//
+CPsdFaxConnectionData::~CPsdFaxConnectionData()
+    {
+    LOGENTRFN("CPsdFaxConnectionData::~CPsdFaxConnectionData()")
+
+    if ( iOpen )
+        {
+        CloseContext();
+        }
+
+    if ( iStatusNotifier )
+        {
+        iStatusNotifier->Cancel();
+        delete iStatusNotifier;
+        iStatusNotifier = NULL;
+        }
+
+    LOGEXITFN("CPsdFaxConnectionData::~CPsdFaxConnectionData()")
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPsdFaxConnectionData::OpenContext
+// -----------------------------------------------------------------------------
+//
+TInt CPsdFaxConnectionData::OpenContext( const TDes& aName )
+    {
+    LOGENTRFN("CPsdFaxConnectionData::OpenContext()")
+    TInt err( KErrNone );
+
+    if ( iOpen )
+        {
+        CloseContext();
+        }
+
+    err = iContext.OpenExistingContext( *iPacketService, aName );
+    if ( KErrNone == err )
+        {
+        iOpen = ETrue;
+
+        // Start status notifier
+        if ( !iStatusNotifier->IsActive() )
+            {
+            LOGIT("OpenContext: start status notifier")
+            iStatusNotifier->Start( iContext );
+            }
+        }
+
+    LOGEXITFN1("CPsdFaxConnectionData::OpenContext()", err)
+    return err;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPsdFaxConnectionData::CloseContext
+// -----------------------------------------------------------------------------
+//
+void CPsdFaxConnectionData::CloseContext()
+    {
+    LOGENTRFN("CPsdFaxConnectionData::CloseContext()")
+
+    if ( iOpen )
+        {
+        if ( iStatusNotifier && iStatusNotifier->IsActive() )
+            {
+            LOGIT("CloseContext: cancel status notifier")
+            iStatusNotifier->Cancel();
+            }
+
+        LOGIT("CloseContext: close context")
+        iContext.Close();
+        }
+
+    iConnectionId = 0;
+    iOpen = EFalse;
+    iTimeValid = EFalse;
+    iEnded = ETrue;
+
+    LOGEXITFN("CPsdFaxConnectionData::CloseContext()")
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPsdFaxConnectionData::IsOpen
+// -----------------------------------------------------------------------------
+//
+TBool CPsdFaxConnectionData::IsOpen()
+    {
+    if ( iOpen )
+        {
+        return ETrue;
+        }
+    return EFalse;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPsdFaxConnectionData::GetDataVolumes
+// -----------------------------------------------------------------------------
+//
+TInt CPsdFaxConnectionData::GetDataVolumes( TUint& aDLVolume, TUint& aULVolume ) const
+    {
+    LOGENTRFN("CPsdFaxConnectionData::GetDataVolumes()")
+    TInt err( KErrNone );
+    RPacketContext::TDataVolume volume;
+    TRequestStatus status( KErrNone );
+
+    if ( !iOpen )
+        {
+        err = KErrNotFound;
+        }
+    else
+        {
+        iContext.GetDataVolumeTransferred( status, volume );
+        User::WaitForRequest( status );
+        err = status.Int();
+
+        if ( KErrNone == err )
+            {
+            #ifdef _DEBUG
+            if ( volume.iOverflowCounterReceived || volume.iOverflowCounterSent )
+                {
+                LOGIT2("ERROR: 4GB overflow (ignored), dl:%d ul:%d",
+                        volume.iOverflowCounterReceived, volume.iOverflowCounterSent)
+                }
+            #endif // _DEBUG
+
+            // volume.iOverflowCounterReceived*(2^32) + volume.iBytesReceived
+            aDLVolume = volume.iBytesReceived;
+
+            // volume.iOverflowCounterSent*(2^32) + volume.iBytesSent
+            aULVolume = volume.iBytesSent;
+            }
+        }
+
+    LOGEXITFN1("CPsdFaxConnectionData::GetDataVolumes()", err)
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CPsdFaxConnectionData::Stop
+// -----------------------------------------------------------------------------
+//
+TInt CPsdFaxConnectionData::Stop()
+    {
+    LOGENTRFN("CPsdFaxConnectionData::Stop()")
+    TInt err( KErrNone );
+    TRequestStatus status( KErrNone );
+
+    iContext.Deactivate( status );
+    User::WaitForRequest( status );
+    err = status.Int();
+
+    // Remove from server tables if status notifier is not active.
+    if ( !iStatusNotifier->IsActive() )
+        {
+        // Remove from server tables
+        RemoveFromServer();
+
+        // Close the context
+        CloseContext();
+
+        // Delete all old connection objects
+        // This method should be used carefully
+        // because it will delete ConnectionData
+        // and statusnotifier objects.
+        // Get out fast from Stop()
+        iFaxModule->DeleteConnections();
+        }
+
+    LOGEXITFN1("CPsdFaxConnectionData::Stop()", err)
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CPsdFaxConnectionData::RemoveFromServer
+// -----------------------------------------------------------------------------
+//
+void CPsdFaxConnectionData::RemoveFromServer()
+    {
+    LOGENTRFN("CPsdFaxConnectionData::RemoveFromServer()")
+
+    // Remove the connection from internal table
+    TInt bearer( 0 );
+    TBearerInfo bearerInfo;
+    TConnInfo connInfo( 0, 0, iConnectionId, EBearerExternalGPRS, bearerInfo );
+
+    TInt err = iFaxModule->GetBearer( bearer, bearerInfo );
+    if ( KErrNone == err )
+        {
+        connInfo.iBearer = bearer;
+        connInfo.iBearerInfo = bearerInfo;
+        }
+
+    // Remove connection from server
+    iServer->Iap()->RemoveConnection( connInfo );
+
+    LOGEXITFN("CPsdFaxConnectionData::RemoveFromServer()")
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPsdFaxConnectionData::SetConnectionId
+// -----------------------------------------------------------------------------
+//
+void CPsdFaxConnectionData::SetConnectionId( const TUint& aConnectionId )
+    {
+    LOGIT1("CPsdFaxConnectionData::SetConnectionId() - ConnID <%d>", aConnectionId )
+    iConnectionId = aConnectionId;
+    }
+
+// -----------------------------------------------------------------------------
+// CPsdFaxConnectionData::ConnectionId
+// -----------------------------------------------------------------------------
+//
+TUint CPsdFaxConnectionData::ConnectionId() const
+    {
+    //LOGIT1("CPsdFaxConnectionData::ConnectionId() - ConnID %d", iConnectionId)
+    return iConnectionId;
+    }
+
+// -----------------------------------------------------------------------------
+// CPsdFaxConnectionData::ResetStartTime
+// -----------------------------------------------------------------------------
+//
+void CPsdFaxConnectionData::ResetStartTime()
+    {
+    LOGENTRFN("CPsdFaxConnectionData::ResetStartTime()")
+    iStartTime.UniversalTime();
+    iTimeValid = ETrue;
+    LOGEXITFN("CPsdFaxConnectionData::ResetStartTime()")
+    }
+
+// -----------------------------------------------------------------------------
+// CPsdFaxConnectionData::GetStartTime
+// -----------------------------------------------------------------------------
+//
+TInt CPsdFaxConnectionData::GetStartTime( TTime& aTime ) const
+    {
+    LOGENTRFN("CPsdFaxConnectionData::GetStartTime()")
+    TInt err( KErrNone );
+
+    // Start time is not know for external connections that have been up before
+    // connection monitor started
+    if ( !iTimeValid )
+        {
+        err = KErrUnknown;
+        }
+    else
+        {
+        aTime = iStartTime;
+        }
+
+    LOGEXITFN1("CPsdFaxConnectionData::GetStartTime()", err)
+    return err;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPsdFaxConnectionData::GetAPN
+// -----------------------------------------------------------------------------
+//
+TInt CPsdFaxConnectionData::GetApn( TDes& aName )
+    {
+    LOGENTRFN("CPsdFaxConnectionData::GetApn()")
+    TInt err( KErrNone );
+    TRequestStatus status( KErrNone );
+    RPacketContext::TContextConfigGPRS* getParams;
+
+    // Leave left out intentionally, check for NULL instead
+    getParams = new RPacketContext::TContextConfigGPRS(); // No (ELeave)
+    if ( !getParams )
+        {
+        err = KErrNoMemory;
+        }
+    else
+        {
+        TPckg<RPacketContext::TContextConfigGPRS> getContextConfigPckg( *getParams );
+        iContext.GetConfig( status, getContextConfigPckg );
+        User::WaitForRequest( status );
+        err = status.Int();
+
+        if ( KErrNone == err )
+            {
+            // Access Point Name
+            ConvertAPN( aName, getParams->iAccessPointName );
+            }
+        delete getParams;
+        }
+
+    LOGEXITFN1("CPsdFaxConnectionData::GetApn()", err)
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CPsdFaxConnectionData::ConvertAPN
+// -----------------------------------------------------------------------------
+//
+void CPsdFaxConnectionData::ConvertAPN( TDes& aResult, const TDesC& aName ) const
+    {
+    aResult = aName;
+    }
+
+// -----------------------------------------------------------------------------
+// CPsdFaxConnectionData::ConvertAPN
+// -----------------------------------------------------------------------------
+//
+void CPsdFaxConnectionData::ConvertAPN( TDes& aResult, const TDesC8& aName ) const
+    {
+    CnvUtfConverter::ConvertToUnicodeFromUtf8( aResult, aName );
+    }
+
+// -----------------------------------------------------------------------------
+// CPsdFaxConnectionData::GetProtocolType
+// -----------------------------------------------------------------------------
+//
+TInt CPsdFaxConnectionData::GetProtocolType( TInt& aProtocolType )
+    {
+    LOGENTRFN("CPsdFaxConnectionData::GetProtocolType()")
+    TInt err( KErrNone );
+    TRequestStatus status( KErrNone );
+    RPacketContext::TContextConfigGPRS* getParams;
+
+    // Leave left out intentionally, check for NULL instead
+    getParams = new RPacketContext::TContextConfigGPRS(); // No (ELeave)
+    if ( !getParams )
+        {
+        err = KErrNoMemory;
+        }
+
+    if ( KErrNone == err )
+        {
+        TPckg<RPacketContext::TContextConfigGPRS> getContextConfigPckg( *getParams );
+        iContext.GetConfig( status, getContextConfigPckg );
+        User::WaitForRequest( status );
+        err = status.Int();
+
+        if ( KErrNone == err )
+            {
+            if ( getParams->iPdpType == RPacketContext::EPdpTypeIPv4 )
+                {
+                aProtocolType = EProtocolTypeIPv4;
+                }
+            else if ( getParams->iPdpType == RPacketContext::EPdpTypeIPv6 )
+                {
+                aProtocolType = EProtocolTypeIPv6;
+                }
+            else
+                {
+                aProtocolType = EProtocolTypeUnknown;
+                }
+            }
+        delete getParams;
+        }
+
+    LOGEXITFN1("CPsdFaxConnectionData::GetProtocolType()", err)
+    return err;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CPsdFaxConnectionData::GetStatus
+// -----------------------------------------------------------------------------
+//
+TInt CPsdFaxConnectionData::GetStatus( TInt& aStatus ) const
+    {
+    LOGENTRFN("CPsdFaxConnectionData::GetStatus()")
+
+    RPacketContext::TContextStatus status;
+
+    TInt err = iContext.GetStatus( status );
+    if ( KErrNone == err )
+        {
+        aStatus = status;
+        err = MapStatus( aStatus );
+        }
+
+    LOGEXITFN("CPsdFaxConnectionData::GetStatus()")
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CPsdFaxConnectionData::MapStatus
+// -----------------------------------------------------------------------------
+//
+TInt CPsdFaxConnectionData::MapStatus( TInt& aStatus ) const
+    {
+    LOGENTRFN("CPsdFaxConnectionData::MapStatus()")
+
+    // Map to internal PDP context status
+    switch( aStatus )
+        {
+        case RPacketContext::EStatusUnknown:
+            return KErrUnknown;
+
+        case RPacketContext::EStatusInactive:
+            return KErrUnknown;
+
+        case RPacketContext::EStatusActivating:
+            aStatus = KPsdStartingActivation;
+            break;
+
+        case RPacketContext::EStatusActive:
+            aStatus = KPsdFinishedActivation;
+            break;
+
+        case RPacketContext::EStatusDeactivating:
+            aStatus = KPsdStartingDeactivation;
+            break;
+
+        case RPacketContext::EStatusSuspended:
+            aStatus = KPsdSuspended;
+            break;
+
+        case RPacketContext::EStatusDeleted:
+            aStatus = KPsdFinishedDeactivation;
+            break;
+
+        default:
+            return KErrUnknown;
+        }
+
+    LOGEXITFN("CPsdFaxConnectionData::MapStatus()")
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CPsdFaxConnectionData::IsEnded
+// -----------------------------------------------------------------------------
+//
+TBool CPsdFaxConnectionData::IsEnded()
+    {
+    if ( iEnded )
+        {
+        return ETrue;
+        }
+    return EFalse;
+    }
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPsdFaxStatusNotifier::CPsdFaxStatusNotifier
+// -----------------------------------------------------------------------------
+//
+CPsdFaxStatusNotifier::CPsdFaxStatusNotifier(
+        CPsdFax* aFaxModule,
+        CConnMonServer* aServer,
+        RPacketService* aPacketService,
+        CPsdFaxConnectionData* aConnDataModule )
+        :
+        CActive( EConnMonPriorityNormal ),
+        iFaxModule( aFaxModule ),
+        iServer( aServer ),
+        iPacketService( aPacketService ),
+        iConnDataModule ( aConnDataModule )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CPsdFaxStatusNotifier::Construct
+// -----------------------------------------------------------------------------
+//
+void CPsdFaxStatusNotifier::Construct()
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CPsdFaxStatusNotifier::~CPsdFaxStatusNotifier
+// -----------------------------------------------------------------------------
+//
+CPsdFaxStatusNotifier::~CPsdFaxStatusNotifier()
+    {
+    Cancel();
+    }
+
+// -----------------------------------------------------------------------------
+// CPsdFaxStatusNotifier::Start
+// Requests a new event (connection up/down) from RConnection
+// -----------------------------------------------------------------------------
+//
+void CPsdFaxStatusNotifier::Start( const RPacketContext& aContext )
+    {
+    iContext = aContext;
+    Receive();
+    }
+
+// -----------------------------------------------------------------------------
+// CPsdFaxStatusNotifier::Receive
+// Requests a new event (connection up/down) from RConnection
+// -----------------------------------------------------------------------------
+//
+void CPsdFaxStatusNotifier::Receive()
+    {
+    if ( IsActive() )
+        {
+        Cancel();
+        }
+
+    iContext.NotifyStatusChange( iStatus, iContextStatus );
+    SetActive();
+    }
+
+// -----------------------------------------------------------------------------
+// CPsdFaxStatusNotifier::DoCancel
+// Cancels the request from RConnection.
+// -----------------------------------------------------------------------------
+//
+void CPsdFaxStatusNotifier::DoCancel()
+    {
+    if ( IsActive() )
+        {
+        iContext.CancelAsyncRequest( EPacketContextNotifyStatusChange );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CPsdFaxStatusNotifier::RunL
+// Handles the event that has arrived from RConnection
+// -----------------------------------------------------------------------------
+//
+void CPsdFaxStatusNotifier::RunL()
+    {
+    // All RunL():s outside CServer-derived main class MUST NOT LEAVE.
+    // Use TRAPD when needed.
+    //LOGENTRFN("CPsdFaxStatusNotifier::RunL()")
+
+    LOGIT(".")
+    LOGIT1("RunL: CPsdFaxStatusNotifier, status %d", iStatus.Int())
+
+    if ( iStatus.Int() != KErrNone )
+        {
+        LOGIT1("CPsdFaxStatusNotifier: external PSD status event FAILED <%d>", iStatus.Int())
+        }
+    else
+        {
+        LOGIT1("CPsdFaxStatusNotifier: external PSD connection status changed: %d", iContextStatus)
+
+        iEventInfo.iConnectionId = iConnDataModule->ConnectionId();
+        if ( iEventInfo.iConnectionId == 0 )
+            {
+            // Send connection create event when the first status event arrives.
+            TInt ret = SendConnectionCreateEvent();
+            if ( KErrNone != ret )
+                {
+                // Close the context
+                iConnDataModule->CloseContext();
+
+                // Delete all old connection objects
+                iFaxModule->DeleteConnections();
+
+                // Stop listening
+                return;
+                }
+            }
+
+        iEventInfo.Reset();
+        iEventInfo.iEventType = EConnMonConnectionStatusChange;
+        iEventInfo.iConnectionId = iConnDataModule->ConnectionId();
+
+        TInt status = iContextStatus;
+        TInt err = iConnDataModule->MapStatus( status );
+        iEventInfo.iData = status;
+
+        if ( ( iServer->NumberOfListeners() > 0 ) && ( err == KErrNone ) )
+            {
+            // Send event to all clients that are listening
+            iServer->EventQueue()->Add( iEventInfo );
+            }
+
+        if ( iContextStatus == RPacketContext::EStatusDeleted )
+            {
+            // Send connection closed event to all clients that are listening
+            iEventInfo.Reset();
+            iEventInfo.iEventType = EConnMonDeleteConnection;
+            iEventInfo.iConnectionId = iConnDataModule->ConnectionId();
+            iConnDataModule->GetDataVolumes( iEventInfo.iData, iEventInfo.iData2 );
+            iServer->EventQueue()->Add( iEventInfo );
+
+            // Remove from server tables
+            iConnDataModule->RemoveFromServer();
+
+            // Close the context
+            iConnDataModule->CloseContext();
+
+            // Delete all old connection objects. This method should be used
+            // carefully because it will delete ConnectionData and
+            // statusnotifier objects. Get out fast from RunL().
+            iFaxModule->DeleteConnections();
+
+            // Stop listening
+            return;
+            }
+
+        // New request
+        Receive();
+        }
+
+    //LOGEXITFN("CPsdFaxStatusNotifier::RunL()")
+    }
+
+// -----------------------------------------------------------------------------
+// CPsdFaxStatusNotifier::SendConnectionCreateEvent
+// Send created event.
+// -----------------------------------------------------------------------------
+//
+TInt CPsdFaxStatusNotifier::SendConnectionCreateEvent()
+    {
+    TInt bearer( 0 );
+    TBearerInfo bearerInfo;
+    TInt err( KErrNone );
+
+    LOGENTRFN("CPsdFaxStatusNotifier::SendConnectionCreateEvent()")
+
+    // Get bearer info
+    err = iFaxModule->GetBearer( bearer, bearerInfo );
+
+    if ( KErrNone != err )
+        {
+        bearer = EBearerExternalGPRS;
+        bearerInfo.iBearer = EBearerInfoGPRS;
+        bearerInfo.iInternal = EFalse;
+        }
+
+    TConnInfo connInfo( 0, 0, 0, bearer, bearerInfo );
+
+    // Add to the connection table and fill in the new connectionId to connInfo
+    TRAPD( ret, ( err = iServer->Iap()->AddConnectionL( connInfo ) ) );
+    if ( ret || ( err != KErrNone ) )
+        {
+        LOGIT("AddConnectionL failed.")
+        LOGEXITFN("CPsdFaxStatusNotifier::SendConnectionCreateEvent()")
+        return KErrUnknown;
+        }
+
+    // Send connection create event to all clients that are listening
+    iEventInfo.Reset();
+    iEventInfo.iEventType = EConnMonCreateConnection;
+    iEventInfo.iConnectionId = connInfo.iConnectionId;
+    iConnDataModule->SetConnectionId( connInfo.iConnectionId );
+    iServer->EventQueue()->Add( iEventInfo );
+
+    LOGEXITFN("CPsdFaxStatusNotifier::SendConnectionCreateEvent()")
+    return KErrNone;
+    }
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/src/CUiDialogAO.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,152 @@
+/*
+* Copyright (c) 2005-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:  Displays a dialog on the UI with the help of Symbian OS
+*                notification services.
+*
+*/
+
+#include <e32base.h>
+
+#include "ConnMonServ.h"
+#include "ConnMonIAP.h"
+#include "CUiDialogAO.h"
+#include "ConnMonAvailabilityManager.h"
+#include "log.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUiDialogAO::CUiDialogAO
+// -----------------------------------------------------------------------------
+//
+CUiDialogAO::CUiDialogAO( CConnMonServer* aServer )
+    :
+    CActive( EPriorityStandard ),
+    iServer( aServer ),
+    iDummy( KNullDesC8 )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CUiDialogAO::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CUiDialogAO::ConstructL()
+    {
+    CActiveScheduler::Add( this );
+
+    // Open RNotifier
+    TInt ret = iNotifier.Connect();
+
+    if ( ret != KErrNone )
+        {
+        LOGIT1("Could not connect to RNotifier, err <%d>", ret )
+        User::Leave( ret );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUiDialogAO::NewL
+// -----------------------------------------------------------------------------
+//
+CUiDialogAO* CUiDialogAO::NewL( CConnMonServer* aServer )
+    {
+    CUiDialogAO* self = new ( ELeave ) CUiDialogAO( aServer );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+// Destructor
+CUiDialogAO::~CUiDialogAO()
+    {
+    Cancel();
+
+    iNotifier.Close();
+
+    iServer = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CUiDialogAO::Start
+// -----------------------------------------------------------------------------
+//
+void CUiDialogAO::Start()
+    {
+    if ( !IsActive() )
+        {
+        iNetIds.FillZ();
+        iNetIds.Zero();
+
+        iNotifier.StartNotifierAndGetResponse(
+                iStatus,
+                KUidSelectNetwork,
+                iDummy,
+                iNetIds );
+        SetActive();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUiDialogAO::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CUiDialogAO::DoCancel()
+    {
+    if ( IsActive() )
+        {
+        iNotifier.CancelNotifier( KUidSelectNetwork );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CUiDialogAO::RunL
+// -----------------------------------------------------------------------------
+//
+void CUiDialogAO::RunL()
+    {
+    if ( iStatus == KErrNone )
+        {
+        // Set user's LAN network selection
+        iServer->Iap()->SetEndUserLanPreference( iNetIds );
+
+        // Write to log
+
+        if ( iNetIds.Length() > 0 )
+            {
+            /////////// 3.1U availability staff
+            LOGIT("CUiDialogAO::RunL() triggered HandleAvailabilityChange()")
+            iServer->AvailabilityManager()->HandleAvailabilityChange();
+            /////////////////////////////////////////////////////////////
+            }
+
+        iNotifier.CancelNotifier( KUidSelectNetwork );
+        }
+    else if ( iStatus == KErrCancel )
+        {
+        // Reset LAN network selection
+        iServer->Iap()->ResetEndUserLanPreference();
+        }
+    else
+        {
+        // Write to log
+        }
+
+    delete this;
+    }
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/src/CWlanSupport.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,3103 @@
+/*
+* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Provides an interface to WLAN Engine.
+*
+*/
+
+#include <e32base.h>
+#include <utf.h>
+
+#include "CWlanSupport.h"
+#include "CEventQueue.h"
+#include "ConnMonIAP.h"
+#include "ConnMonAvailabilityManager.h"
+#include "connmoncommsdatcache.h"
+#include "log.h"
+#include "ConnMonUtils.h"
+#include "connmonwlannetwork.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CWlanSupport::NewL
+// -----------------------------------------------------------------------------
+//
+CWlanSupport* CWlanSupport::NewL( CConnMonServer* aServer )
+    {
+    //LOGENTRFN("CWlanSupport::NewL()")
+    CWlanSupport* self = new( ELeave ) CWlanSupport( aServer );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    //LOGEXITFN("CWlanSupport::NewL()")
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanSupport::CWlanSupport
+// -----------------------------------------------------------------------------
+//
+CWlanSupport::CWlanSupport(
+        CConnMonServer* aServer )
+        :
+        iServer( aServer ),
+        iEnableScan( ETrue ),
+        iEnableEventsToClients( EFalse )
+    {
+    // iEnableScan has to be initialized to ETrue, so iAvailableWlanIapsCache will be initialized
+    // properly when WLAN IAP availability is asked for the first time.
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanSupport::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CWlanSupport::ConstructL()
+    {
+    iWlanMgmt = CWlanMgmtClient::NewL();
+    ActivateNotificationsL();
+    }
+
+// -----------------------------------------------------------------------------
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CWlanSupport::~CWlanSupport()
+    {
+    CancelNotifications(); // Deletes iEventWatcher
+
+    delete iWlanMgmt;
+    iWlanMgmt = NULL;
+
+    // Cleanup WLAN IAPs cache array
+    iAvailableWlanIapsCache.Close();
+
+    // Cleanup WLAN sessions pointer array
+    iWlanSessionsPtrArray.ResetAndDestroy();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CWlanSupport::GetBearerAvailabilityL
+// Called from CWlanEvent::OldNetworksLost
+// -----------------------------------------------------------------------------
+//
+void CWlanSupport::GetBearerAvailabilityL( TBool& aAvailability )
+    {
+    LOGENTRFN("CWlanSupport::GetBearerAvailabilityL()")
+    aAvailability = EFalse;
+
+    // Check if connection exists
+    TInt mode( 0 );
+    TInt ret = GetConnectionMode( mode );
+    if ( KErrNone == ret )
+        {
+        // An active WLAN connection exists.
+        aAvailability = ETrue;
+        }
+    else // No active WLAN connections... Scan WLAN networks
+        {
+        CWlanScanInfo* scanInfo = CWlanScanInfo::NewL();
+        CleanupStack::PushL( scanInfo );
+
+        // Get scan results without parameters
+        ret = iWlanMgmt->GetScanResults( *scanInfo );
+        if ( KErrNone == ret )
+            {
+            // Check scan results
+            if ( scanInfo->IsDone() )
+                {
+                // Empty scan info, no WLAN networks available
+                aAvailability = EFalse;
+                }
+            else
+                {
+                // WLAN networks found
+                aAvailability = ETrue;
+                }
+            }
+        else
+            {
+            LOGIT1("GetBearerAvailabilityL: GetScanResults error <%d>", ret)
+            User::Leave( ret );
+            }
+
+        CleanupStack::PopAndDestroy( scanInfo );
+        }
+
+    LOGEXITFN("CWlanSupport::GetBearerAvailabilityL()")
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanSupport::GetBearerAvailabilityL
+// -----------------------------------------------------------------------------
+//
+TInt CWlanSupport::GetBearerAvailabilityL( const RMessage2& aMessage, TBool& aAvailability )
+    {
+    LOGENTRFN("CWlanSupport::GetBearerAvailabilityL()")
+    TInt result( KErrNone );
+    aAvailability = EFalse;
+
+    // Check if event watcher has the availability information
+    TBool eventWatcherKnowsAvailability( EFalse );
+    if ( iEventWatcher )
+        {
+        eventWatcherKnowsAvailability = iEventWatcher->HasAvailabilityKnowledge();
+        }
+
+    // Use WLAN bearer availability info from event watcher if possible.
+    if ( eventWatcherKnowsAvailability )
+        {
+        aAvailability = iEventWatcher->WlanAvailability();
+        result = KErrNone;
+        }
+    else
+        {
+        // Check if a WLAN connection exists
+        TInt mode( 0 );
+        TInt ret = GetConnectionMode( mode );
+        if ( KErrNone == ret )
+            {
+            // An active WLAN connection equals bearer availability.
+            aAvailability = ETrue;
+            result = KErrNone;
+            }
+        else // No active WLAN connections... Scan WLAN networks
+            {
+            // Add session to wlan session table (if not already there)
+            TInt index = AddWlanSessionL( aMessage );
+            iWlanSessionsPtrArray[index]->GetScanResultsL( aMessage );
+            result = KRequestPending;
+            }
+        }
+
+    LOGEXITFN1("CWlanSupport::GetBearerAvailabilityL()", result)
+    return result;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CWlanSupport::GetSignalStrength
+// -----------------------------------------------------------------------------
+//
+TInt CWlanSupport::GetSignalStrengthL(
+        const RMessage2& aMessage,
+        TInt& aSignalStrength )
+    {
+    LOGENTRFN("CWlanSupport::GetSignalStrengthL()")
+    TInt result( KErrNone );
+    TInt mode( 0 );
+    aSignalStrength = 0;
+
+    // Get connection mode to see if connection exists
+    TInt ret = GetConnectionMode( mode );
+    if ( KErrNone == ret )
+        {
+        // An active WLAN connection exists -> get signal quality
+        result = GetConnectionSignalQuality( aSignalStrength );
+        }
+    else // No connection -> scan networks
+        {
+        // Add session to wlan session table (if not already there)
+        TInt index = AddWlanSessionL( aMessage );
+        iWlanSessionsPtrArray[index]->GetScanResultsL( aMessage );
+        result = KRequestPending;
+        }
+
+    LOGEXITFN1("CWlanSupport::GetSignalStrengthL()", result)
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanSupport::GetNetworkNamesL
+// -----------------------------------------------------------------------------
+//
+TInt CWlanSupport::GetNetworkNamesL( const RMessage2& aMessage )
+    {
+    LOGENTRFN("CWlanSupport::GetNetworkNamesL()")
+
+    // Add session to wlan session table (if not already there)
+    TInt index = AddWlanSessionL( aMessage );
+    iWlanSessionsPtrArray[index]->GetScanResultsL( aMessage );
+
+    LOGEXITFN1("CWlanSupport::GetNetworkNamesL()", KRequestPending)
+    return KRequestPending;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CWlanSupport::ParseNetworkNamesL
+// -----------------------------------------------------------------------------
+//
+void CWlanSupport::ParseNetworkNamesL(
+        CWlanScanInfo* aScanInfo,
+        TConnMonNetworkNames& aNetInfo )
+    {
+    LOGENTRFN("CWlanSupport::ParseNetworkNamesL()")
+
+    TInt ret( KErrNone );
+    RArray< TConnMonNetwork > sortedNetworkNames;
+    CleanupClosePushL( sortedNetworkNames );
+    aNetInfo.iCount = 0;
+
+    // For logging only
+    LOG(TInt count(0);)
+    LOGIT("Parsing networks:")
+
+    // Iterate through scan results.
+    for ( aScanInfo->First(); !aScanInfo->IsDone(); aScanInfo->Next() )
+        {
+        TConnMonNetwork nw;
+
+        // Operating mode
+        if ( aScanInfo->Capability() & KWlan802Dot11CapabilityEssMask )
+            {
+            nw.iType = EConnMonInfraStructure;
+            }
+        else
+            {
+            nw.iType = EConnMonAdHoc;
+            }
+
+        // Signal strength
+        nw.iSignalStrength = aScanInfo->RXLevel();
+
+        // SSID
+        TUint8 ieLen( 0 );
+        const TUint8* ieData( NULL );
+        ret = aScanInfo->InformationElement( KWlan802Dot11SsidIE, ieLen, &ieData );
+        if ( ( KErrNone == ret ) && ( ieLen <= CConnMonWlanNetwork::KMaxNameLength ) )
+            {
+            // ieData points to the beginning of the 802.11 SSID payload data i.e.
+            // the header is bypassed. ieLen contains the length of payload data.
+            nw.iName.Copy( ieData, ieLen );
+            }
+
+        sortedNetworkNames.InsertInOrderAllowRepeatsL( nw, CWlanSupport::CompareNetworkStrengths );
+
+#ifdef _DEBUG
+        // Print network information to log
+        count++;
+        if ( ( KErrNone == ret ) && ( ieLen <= CConnMonWlanNetwork::KMaxNameLength ) )
+            {
+            TBuf<CConnMonWlanNetwork::KMaxNameLength+1> debug_name;
+            ConnMonUtils::TDes8ToTDes( nw.iName, debug_name );
+            TWlanBssid bssid;
+            aScanInfo->Bssid( bssid );
+            LOGIT11("%02d: %02X:%02X:%02X:%02X:%02X:%02X sig.str %d, type %d, name(%02d): %s",
+                    count, bssid[0], bssid[1], bssid[2], bssid[3], bssid[4], bssid[5],
+                    nw.iSignalStrength, nw.iType, debug_name.Length(), debug_name.PtrZ())
+            }
+#endif // _DEBUG
+        } // for
+
+    // Go through the items one by one starting from the largest signal strength.
+    // Always uses the first item in array, since it is removed in the end of loop.
+    while ( sortedNetworkNames.Count() > 0 && aNetInfo.iCount < KConnMonMaxNetworkCount )
+        {
+        TConnMonNetwork &item( sortedNetworkNames[0] );
+
+        TBool duplicate( EFalse );
+        for ( TUint i = 0; i < aNetInfo.iCount; i++ )
+            {
+            if ( aNetInfo.iNetwork[i].iType == item.iType &&
+                 aNetInfo.iNetwork[i].iName == item.iName )
+                {
+                duplicate = ETrue;
+                }
+            }
+        if ( !duplicate )
+            {
+            // Adding the item
+            aNetInfo.iNetwork[aNetInfo.iCount].iType = item.iType;
+            aNetInfo.iNetwork[aNetInfo.iCount].iSignalStrength = item.iSignalStrength;
+            aNetInfo.iNetwork[aNetInfo.iCount].iName.Copy( item.iName );
+#ifdef _DEBUG
+            // One letter longer than max WLAN network name, since we are adding a '\0' when printing
+            TBuf<CConnMonWlanNetwork::KMaxNameLength+1> name;
+            ConnMonUtils::TDes8ToTDes( aNetInfo.iNetwork[aNetInfo.iCount].iName, name );
+            LOGIT3("Added network %.2d, sig.str %d, name: %s",
+                    aNetInfo.iCount,
+                    aNetInfo.iNetwork[aNetInfo.iCount].iSignalStrength,
+                    name.PtrZ())
+#endif // _DEBUG
+            aNetInfo.iCount++;
+            }
+
+        sortedNetworkNames.Remove( 0 );
+        }
+
+    CleanupStack::PopAndDestroy( &sortedNetworkNames );
+
+    LOGEXITFN("CWlanSupport::ParseNetworkNamesL()")
+    }
+
+
+// -----------------------------------------------------------------------------
+// CWlanSupport::CompareNetworkStrengths
+//
+// Compares two WLAN network signal strengths.
+// It should return:
+// 1. zero, if the two objects are equal.
+// 2. a negative value, if the first object is less than the second.
+// 3. a positive value, if the first object is greater than the second.
+// -----------------------------------------------------------------------------
+//
+TInt CWlanSupport::CompareNetworkStrengths(
+        const TConnMonNetwork& aFirst,
+        const TConnMonNetwork& aSecond )
+    {
+    //LOGENTRFN("CWlanSupport::CompareNetworkStrengths()")
+    TInt result( 0 );
+
+    if ( aFirst.iSignalStrength < aSecond.iSignalStrength )
+        {
+        result = -1;
+        }
+    else if ( aFirst.iSignalStrength > aSecond.iSignalStrength )
+        {
+        result = 1;
+        }
+
+    //LOGEXITFN1("CWlanSupport::CompareNetworkStrengths()", result)
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanSupport::AppendAvailableIaps
+// -----------------------------------------------------------------------------
+//
+TInt CWlanSupport::AppendAvailableIaps( RArray<TUint>& aIdArray )
+    {
+    //LOGENTRFN("CWlanSupport::AppendAvailableIaps()")
+    TInt err( KErrNone );
+
+    if ( iEnableScan )
+        {
+        iAvailableWlanIapsCache.Reset();
+        err = iWlanMgmt->GetAvailableIaps( iAvailableWlanIapsCache );
+        LOGIT2("WLAN IAPs available: %d, err <%d> (from WLAN engine)", iAvailableWlanIapsCache.Count(), err)
+        iEnableScan = EFalse;
+        }
+    else
+        {
+        LOGIT1("WLAN IAPs available: %d (from cache, no scan)", iAvailableWlanIapsCache.Count())
+        }
+
+    const TInt wlanIapCount( iAvailableWlanIapsCache.Count() );
+    if ( KErrNone == err && wlanIapCount > 0 )
+        {
+        for ( TInt i = 0; i < wlanIapCount; i++ )
+            {
+            err = aIdArray.Append( iAvailableWlanIapsCache[i] );
+            if ( err )
+                {
+                break;
+                }
+            }
+        }
+
+    //LOGEXITFN1("CWlanSupport::AppendAvailableIaps()", err)
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanSupport::AppendAvailableIapsBySsid
+// -----------------------------------------------------------------------------
+//
+TInt CWlanSupport::AppendAvailableIapsBySsidL( RArray<TUint>& aIdArray )
+    {
+    LOGENTRFN("CWlanSupport::AppendAvailableIapsBySsidL()")
+    TInt ret( KErrNone );
+
+    // Get ssid of current connection
+    TWlanSsid currentSsid;
+    ret = iWlanMgmt->GetConnectionSsid( currentSsid );
+    if ( KErrNone != ret )
+        {
+        LOGIT1("ERROR reading current connection ssid from wlan engine <%d>", ret)
+        ret = KErrDisconnected;
+        }
+    else
+        {
+        LOGTIMINGSTART("CWlanSupport::AppendAvailableIapsBySsidL")
+
+        // Create a session with the latest version CommsDat
+        CMDBSession* db = CMDBSession::NewLC( CMDBSession::LatestVersion() );
+        db->SetAttributeMask( ECDProtectedWrite );
+
+        TBuf<CConnMonWlanNetwork::KMaxNameLength> ssid16;
+        CnvUtfConverter::ConvertToUnicodeFromUtf8( ssid16, currentSsid );
+        LOGIT2("AppendAvailableIapsBySsidL: ssid: %S, length: %d", &ssid16, ssid16.Length())
+
+        // Create wlan service record set
+        CMDBRecordSet<CCDWlanServiceRecord>* wlanSet =
+                new( ELeave ) CMDBRecordSet<CCDWlanServiceRecord>(
+                        CCDWlanServiceRecord::TableIdL( *db ) );
+        CleanupStack::PushL( wlanSet );
+
+        // Create wlan service record
+        CCDWlanServiceRecord* wlanRecord =
+            new( ELeave ) CCDWlanServiceRecord( CCDWlanServiceRecord::TableIdL( *db ) );
+        CleanupStack::PushL( wlanRecord );
+
+        // Set ssid field in wlan service record (see wlancontainer.h)
+        wlanRecord->iWLanSSID.SetL( ssid16 );
+        // Append wlan service record to wlan service record set (currently empty)
+        wlanSet->iRecords.AppendL( wlanRecord );
+        CleanupStack::Pop( wlanRecord ); // Ownership moved
+
+        // Find matching wlan service records (all wlan service records with same SSID)
+        if ( wlanSet->FindL( *db ) )
+            {
+            TInt wlanRecordCount( wlanSet->iRecords.Count() );
+            LOGIT1("AppendAvailableIapsBySsidL: wlan record count: %d", wlanRecordCount)
+
+            // Loop for each record found
+            for ( TInt i = 0; i < wlanRecordCount; i++ )
+                {
+                // Load current record to make sure all fields are up to date
+                // LoadL() will only look at ElementId and updates the rest of the fields
+                wlanRecord->SetElementId( wlanSet->iRecords[i]->ElementId() );
+                wlanRecord->LoadL( *db );
+
+                // Create IAP record
+                CCDIAPRecord* iapRecord =
+                    static_cast<CCDIAPRecord*>( CCDRecordBase::RecordFactoryL( KCDTIdIAPRecord ) );
+                CleanupStack::PushL( iapRecord );
+
+                iapRecord->iServiceType.SetL( TPtrC( KCDTypeNameLANService ) );
+                // Set the service field to the same value as in the wlan service record we are currently looking
+                iapRecord->iService = wlanRecord->iWlanServiceId;
+                // Find matching IAP record
+                if ( iapRecord->FindL( *db ) )
+                    {
+                    // Read IAP ID and append to buffer
+                    TUint iapId = iapRecord->RecordId();
+                    LOGIT2("AppendAvailableIapsBySsidL: index: %d, id: %d", i, iapId)
+                    aIdArray.Append( iapId ); // Ignore if Append fails, ID will be absent from availability list.
+                    }
+                else
+                    {
+                    LOGIT("AppendAvailableIapsBySsidL: no matching IAP record found")
+                    }
+                CleanupStack::PopAndDestroy( iapRecord );
+                }
+            }
+        else
+            {
+            LOGIT("AppendAvailableIapsBySsidL: no matching IAP records found")
+            ret = KErrNotFound;
+            }
+        CleanupStack::PopAndDestroy( wlanSet );
+        CleanupStack::PopAndDestroy( db );
+
+        LOGTIMINGEND("CWlanSupport::AppendAvailableIapsBySsidL")
+        }
+
+    LOGEXITFN1("CWlanSupport::AppendAvailableIapsBySsidL()", ret)
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanSupport::GetConnectionSsid
+// -----------------------------------------------------------------------------
+//
+TInt CWlanSupport::GetConnectionSsid( TDes& aSsid )
+    {
+    LOGENTRFN("CWlanSupport::GetConnectionSsid()")
+    TInt err( KErrNone );
+    TWlanSsid ssid;
+
+    err = iWlanMgmt->GetConnectionSsid( ssid );
+    if ( KErrNone == err )
+        {
+        CnvUtfConverter::ConvertToUnicodeFromUtf8( aSsid, ssid );
+#ifdef _DEBUG
+        // One letter longer than max WLAN network name, since we are adding a '\0' when printing
+        TBuf<CConnMonWlanNetwork::KMaxNameLength + 1> debug_name( aSsid );
+        LOGIT1("GetConnectionSsid: SSID <%s>", debug_name.PtrZ())
+#endif // _DEBUG
+        }
+
+    LOGEXITFN1("CWlanSupport::GetConnectionSsid()", err)
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanSupport::GetConnectionMode
+// -----------------------------------------------------------------------------
+//
+TInt CWlanSupport::GetConnectionMode( TInt& aConnectionMode )
+    {
+    LOGENTRFN("CWlanSupport::GetConnectionMode()")
+    TInt err( KErrNone );
+
+    TWlanConnectionMode mode( EWlanConnectionModeNotConnected );
+    aConnectionMode = KErrNotFound;
+
+    // Get connection mode from WLAN engine
+    err = iWlanMgmt->GetConnectionMode( mode );
+    if ( KErrNone == err )
+        {
+        switch ( mode )
+            {
+            case EWlanConnectionModeNotConnected:
+                err = KErrNotFound; // Connection does not exist
+                break;
+            case EWlanConnectionModeInfrastructure:
+                aConnectionMode = EConnMonInfraStructure;
+                break;
+            case EWlanConnectionModeAdhoc:
+                aConnectionMode = EConnMonAdHoc;
+                break;
+            case EWlanConnectionModeSecureInfra:
+                aConnectionMode = EConnMonSecureInfra;
+                break;
+            case EWlanConnectionModeSearching:
+                err = KErrNotFound; // Connection does not exist
+                break;
+            default:
+                err = KErrNotFound;
+                break;
+            }
+        LOGIT1("CWlanSupport::GetConnectionMode: %d", aConnectionMode)
+        }
+
+    LOGEXITFN1("CWlanSupport::GetConnectionMode()", err)
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanSupport::GetConnectionSecurity
+// -----------------------------------------------------------------------------
+//
+TInt CWlanSupport::GetConnectionSecurity( TInt& aConnectionSecurity )
+    {
+    LOGENTRFN("CWlanSupport::GetConnectionSecurity()")
+    TInt err( KErrNone );
+
+    TWlanConnectionSecurityMode mode( EWlanConnectionSecurityOpen );
+
+    // Get security mode
+    err = iWlanMgmt->GetConnectionSecurityMode( mode );
+    if ( KErrNone == err )
+        {
+        switch ( mode )
+            {
+            case EWlanConnectionSecurityOpen:
+                aConnectionSecurity = EConnMonSecurityOpen;
+                break;
+            case EWlanConnectionSecurityWep:
+                aConnectionSecurity = EConnMonSecurityWep;
+                break;
+            case EWlanConnectionSecurity802d1x:
+                aConnectionSecurity = EConnMonSecurity802d1x;
+                break;
+            case EWlanConnectionSecurityWpa:
+                aConnectionSecurity = EConnMonSecurityWpa;
+                break;
+            case EWlanConnectionSecurityWpaPsk:
+                aConnectionSecurity = EConnMonSecurityWpaPsk;
+                break;
+            default:
+                aConnectionSecurity = EConnMonSecurityOpen;
+                break;
+            }
+        LOGIT1("GetConnectionSecurity: security mode %d", aConnectionSecurity)
+        }
+
+    LOGEXITFN1("CWlanSupport::GetConnectionSecurity()", err)
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanSupport::GetConnectionSignalQuality
+// -----------------------------------------------------------------------------
+//
+TInt CWlanSupport::GetConnectionSignalQuality( TInt& aSignalQuality )
+    {
+    LOGENTRFN("CWlanSupport::GetConnectionSignalQuality()")
+    TInt err( KErrNone );
+    TInt32 rssi( 0 );
+
+    err = iWlanMgmt->GetConnectionSignalQuality( rssi );
+    if ( KErrNone == err )
+        {
+        aSignalQuality = static_cast<TInt>( rssi );
+        LOGIT1("CWlanSupport::GetConnectionSignalQuality: %d dBm", aSignalQuality)
+        }
+
+    LOGEXITFN1("CWlanSupport::GetConnectionSignalQuality()", err)
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanSupport::GetConnectionBssid
+// -----------------------------------------------------------------------------
+//
+TInt CWlanSupport::GetConnectionBssid( TBuf8<CConnMonWlanNetwork::KWlanBssId>& aBssid )
+    {
+    LOGENTRFN("CWlanSupport::GetConnectionBssid()")
+    TInt err( KErrNone );
+
+    err = iWlanMgmt->GetConnectionBssid( aBssid );
+    #ifdef _DEBUG
+    if ( KErrNone == err )
+        {
+        LOGIT6("Bssid %02X:%02X:%02X:%02X:%02X:%02X", aBssid[0], aBssid[1], aBssid[2], aBssid[3], aBssid[4], aBssid[5])
+        }
+    #endif // _DEBUG
+
+    LOGEXITFN1("CWlanSupport::GetConnectionBssid()", err)
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanSupport::GetTransmitPower
+// -----------------------------------------------------------------------------
+//
+TInt CWlanSupport::GetTransmitPower( TUint& aPower )
+    {
+    LOGENTRFN("CWlanSupport::GetTransmitPower()")
+    TInt err( KErrNone );
+
+    if ( iEventWatcher )
+        {
+        aPower = iEventWatcher->TxPower();
+        LOGIT1("CWlanSupport:GetTransmitPower: %d mW", aPower)
+        }
+    else
+        {
+        err = KErrUnknown;
+        }
+
+    LOGEXITFN1("CWlanSupport::GetTransmitPower()", err)
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanSupport::ActivateNotificationsL
+// -----------------------------------------------------------------------------
+//
+void CWlanSupport::ActivateNotificationsL()
+    {
+    //LOGENTRFN("CWlanSupport::ActivateNotificationsL()")
+
+    if ( !iEventWatcher )
+        {
+        iEventWatcher = CWlanEvent::NewL( this, iServer );
+        iWlanMgmt->ActivateNotificationsL( *iEventWatcher );
+        }
+
+    //LOGEXITFN("CWlanSupport::ActivateNotificationsL()")
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanSupport::CancelNotifications
+// -----------------------------------------------------------------------------
+//
+void CWlanSupport::CancelNotifications()
+    {
+    LOGENTRFN("CWlanSupport::CancelNotifications()")
+
+    if ( iEventWatcher )
+        {
+        iWlanMgmt->CancelNotifications();
+
+        delete iEventWatcher;
+        iEventWatcher = NULL;
+        }
+
+    LOGEXITFN("CWlanSupport::CancelNotifications()")
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanSupport::GetWLANNetworksL
+// -----------------------------------------------------------------------------
+//
+void CWlanSupport::GetWLANNetworksL( RConnMonWLANNetworksArray& aWlanNetworks )
+    {
+    LOGENTRFN("CWlanSupport::GetWLANNetworksL()")
+
+    // ScanInfo points to a CScanInfo object that will contain results from a scan.
+    CWlanScanInfo* scanInfo = CWlanScanInfo::NewL();
+    CleanupStack::PushL( scanInfo );
+
+    TInt ret = iWlanMgmt->GetScanResults( *scanInfo );
+    if ( KErrNone == ret )
+       {
+        // For logging only
+        LOG(TInt count(0);)
+
+        // Iterate through scan results
+        for ( scanInfo->First(); !scanInfo->IsDone(); scanInfo->Next() )
+            {
+            LOG(count++;)
+            LOGIT1("CWlanSupport::GetWLANNetworksL: count %d", count)
+
+#ifdef _DEBUG
+            // BSSID
+            TWlanBssid bssid;
+            scanInfo->Bssid( bssid );
+            LOGIT6("Bssid %02X:%02X:%02X:%02X:%02X:%02X",
+                    bssid[0], bssid[1], bssid[2], bssid[3], bssid[4], bssid[5])
+#endif //_DEBUG
+
+            // Connection mode
+            TUint connectionMode( EConnMonInfraStructure );
+            if ( scanInfo->Capability() & KWlan802Dot11CapabilityEssMask )
+                {
+                connectionMode = EConnMonInfraStructure;
+                }
+            else
+                {
+                connectionMode = EConnMonAdHoc;
+                }
+
+            // Signal strength
+            TUint signalStrength(scanInfo->RXLevel());
+            LOGIT1("CWlanSupport::GetWLANNetworksL: signalStrength %d", signalStrength)
+
+            // SecurityMode
+            TUint8 ieLength( 0 );
+            const TUint8* wpaData;
+
+            TUint securityMode( EConnMonSecurityOpen );
+            if ( scanInfo->Capability() & KWlan802Dot11CapabilityPrivacyMask )
+                {
+                if ( ( scanInfo->InformationElement(
+                        KWlan802Dot11RsnIE,
+                        ieLength,
+                        &wpaData ) == KErrNone ) ||
+                     ( scanInfo->WpaIE(
+                        ieLength,
+                        &wpaData ) == KErrNone ) )
+                    {
+                    securityMode = EConnMonSecurityWpa; // WPA
+                    }
+                else
+                    {
+                    securityMode = EConnMonSecurityWep; // WEP
+                    }
+                }
+            LOGIT1("CWlanSupport::GetWLANNetworksL: securityMode %d", securityMode)
+
+            // SSID == name
+            TBuf8<TConnMonWLANNetwork::KMaxNameLength> name8;
+            TUint8 ieLen( 0 );
+            const TUint8* ieData;
+            ieData = NULL;
+
+            ret = scanInfo->InformationElement( KWlan802Dot11SsidIE, ieLen, &ieData );
+            if ( KErrNone == ret && ieLen <= CConnMonWlanNetwork::KMaxNameLength )
+                {
+                // ieData points to the beginning of the 802.11 SSID payload data i.e.
+                // the header is bypassed. ieLen contains the length of payload data.
+                name8.Copy( ieData, ieLen );
+                }
+            LOGIT1("CWlanSupport::GetWLANNetworksL: ieLen %d", ieLen)
+
+            TBuf<TConnMonWLANNetwork::KMaxNameLength> name;
+            ConnMonUtils::TDes8ToTDes( name8, name );
+
+#ifdef _DEBUG
+            // One letter longer than max WLAN network name, since we are adding a '\0' when printing
+            TBuf<CConnMonWlanNetwork::KMaxNameLength+1> debug_name;
+            ConnMonUtils::TDes8ToTDes( name8, debug_name );
+            LOGIT2("CWlanSupport::GetWLANNetworksL: name <%s>, length %d",
+                    debug_name.PtrZ(), name.Length())
+#endif // _DEBUG
+
+            RArray<TInt> extrafields;
+            CleanupClosePushL( extrafields );
+
+            aWlanNetworks.AppendL( TConnMonWLANNetwork(
+                    name,
+                    connectionMode,
+                    signalStrength,
+                    securityMode,
+                    extrafields ) );
+            CleanupStack::PopAndDestroy( &extrafields );
+            }
+        aWlanNetworks.Sort( TLinearOrder<TConnMonWLANNetwork>(
+                TConnMonWLANNetwork::LessBySignal ) );
+        }
+    else
+        {
+        // Could not get any scan results
+        User::Leave( ret );
+        }
+    CleanupStack::PopAndDestroy( scanInfo );
+
+    LOGEXITFN("CWlanSupport::GetWLANNetworksL()")
+    }
+
+
+// -----------------------------------------------------------------------------
+// CWlanSupport::GetWlanNetworksL
+// -----------------------------------------------------------------------------
+//
+TInt CWlanSupport::GetWlanNetworksL( const RMessage2& aMessage )
+    {
+    LOGENTRFN("CWlanSupport::GetWlanNetworksL()")
+
+    // Add session to wlan session table (if not already there)
+    TInt index = AddWlanSessionL( aMessage );
+
+    iWlanSessionsPtrArray[index]->GetScanResultsL( aMessage );
+
+    LOGEXITFN1("CWlanSupport::GetWlanNetworksL()", KRequestPending)
+    return KRequestPending;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CWlanSupport::ParseWlanNetworks
+// -----------------------------------------------------------------------------
+//
+void CWlanSupport::ParseWlanNetworksL(
+        CWlanScanInfo* aScanInfo,
+        RConnMonWlanNetworksPtrArray& aWlanNetworks )
+    {
+    LOGENTRFN("CWlanSupport::ParseWlanNetworksL()")
+    LOG(TInt count( 0 );) // For logging only
+
+    LOGIT("ParseWlanNetworksL: WLAN scan info:")
+    // Iterate through scan results
+    for ( aScanInfo->First(); !aScanInfo->IsDone(); aScanInfo->Next() )
+        {
+        // BSSID
+        TWlanBssid bssid;
+        aScanInfo->Bssid( bssid );
+
+        // Connection mode
+        TUint connectionMode( EConnMonInfraStructure );
+        if ( aScanInfo->Capability() & KWlan802Dot11CapabilityEssMask )
+            {
+            connectionMode = EConnMonInfraStructure;
+            }
+        else
+            {
+            connectionMode = EConnMonAdHoc;
+            }
+
+        // Signal strength
+        TUint signalStrength( aScanInfo->RXLevel() );
+
+        // SecurityMode
+        TUint8 ieLength( 0 );
+        const TUint8* wpaData;
+
+        TUint securityMode( EConnMonSecurityOpen );
+        if ( aScanInfo->Capability() & KWlan802Dot11CapabilityPrivacyMask )
+            {
+            if ( ( aScanInfo->InformationElement(
+                    KWlan802Dot11RsnIE,
+                    ieLength,
+                    &wpaData ) == KErrNone ) ||
+                 ( aScanInfo->WpaIE(
+                    ieLength,
+                    &wpaData ) == KErrNone ) )
+                {
+                securityMode = EConnMonSecurityWpa; // WPA
+                }
+            else
+                {
+                securityMode = EConnMonSecurityWep; // WEP
+                }
+            }
+
+        // SSID == name
+        TBuf8<CConnMonWlanNetwork::KMaxNameLength> name8;
+        TUint8 ieLen( 0 );
+        const TUint8* ieData;
+        ieData = NULL;
+
+        TInt ret = aScanInfo->InformationElement( KWlan802Dot11SsidIE, ieLen, &ieData );
+        if ( ret == KErrNone && ieLen <= CConnMonWlanNetwork::KMaxNameLength )
+            {
+            // ieData points to the beginning of the 802.11 SSID payload data i.e.
+            // the header is bypassed. ieLen contains the length of payload data.
+            name8.Copy( ieData, ieLen );
+            }
+
+        TBuf<CConnMonWlanNetwork::KMaxNameLength> name;
+        ConnMonUtils::TDes8ToTDes( name8, name );
+
+#ifdef _DEBUG
+        LOG(count++;)
+        // One letter longer than max WLAN network name, since we are adding a '\0' when printing
+        TBuf<CConnMonWlanNetwork::KMaxNameLength + 1> debug_name;
+        ConnMonUtils::TDes8ToTDes( name8, debug_name );
+        LOGIT11("%02d: %02X:%02X:%02X:%02X:%02X:%02X sig.str %d, sec.mode %d, name(%02d): %s",
+                count, bssid[0], bssid[1], bssid[2], bssid[3], bssid[4], bssid[5],
+                signalStrength, securityMode, name.Length(), debug_name.PtrZ())
+#endif // _DEBUG
+
+        // Create CConnMonWlanNetwork object with scan results
+        CConnMonWlanNetwork* net = CConnMonWlanNetwork::NewL(
+                name,
+                connectionMode,
+                signalStrength,
+                securityMode,
+                bssid,
+                KNullDesC() );
+        CleanupStack::PushL( net );
+        aWlanNetworks.AppendL( net );
+        CleanupStack::Pop( net );
+        }
+    LOGIT("ParseWlanNetworksL: sorting wlan networks")
+    aWlanNetworks.Sort( TLinearOrder<CConnMonWlanNetwork>(
+            CConnMonWlanNetwork::CompareBySignal ) );
+
+    LOGEXITFN("CWlanSupport::ParseWlanNetworksL()")
+    }
+
+
+// -----------------------------------------------------------------------------
+// CWlanSupport::GetCurrentWlanNetwork
+// -----------------------------------------------------------------------------
+//
+TInt CWlanSupport::GetCurrentWlanNetworkL(
+        RConnMonWlanNetworksPtrArray& aWlanNetwork )
+    {
+    LOGENTRFN("CWlanSupport::GetCurrentWlanNetworkL()")
+    TInt err( KErrNone );
+
+    TInt connectionMode;
+    TInt connectionSecurity;
+    TInt connectionSignalQuality;
+    TBuf<CConnMonWlanNetwork::KMaxNameLength> connectionSsid;
+    TBuf8<CConnMonWlanNetwork::KWlanBssId> connectionBssid;
+
+    // Get connection mode to see if connection exists
+    err = GetConnectionMode( connectionMode );
+    if ( KErrNone == err )
+        {
+        // Get connection security mode
+        err = GetConnectionSecurity( connectionSecurity );
+        }
+    if ( KErrNone == err )
+        {
+        // Get connection signal quality
+        err = GetConnectionSignalQuality( connectionSignalQuality );
+        }
+    if ( KErrNone == err )
+        {
+        // Get connection SSID
+        err = GetConnectionSsid( connectionSsid );
+        }
+    if ( KErrNone == err )
+        {
+        // Get connection BSSID
+        err = GetConnectionBssid( connectionBssid );
+        }
+    if ( KErrNone == err )
+        {
+        // Create CConnMonWlanNetwork object with results
+        CConnMonWlanNetwork* net = CConnMonWlanNetwork::NewL(
+                connectionSsid,
+                connectionMode,
+                connectionSignalQuality,
+                connectionSecurity,
+                connectionBssid,
+                KNullDesC() );
+        CleanupStack::PushL( net );
+        aWlanNetwork.AppendL( net );
+        CleanupStack::Pop( net );
+        }
+
+    LOGEXITFN1("CWlanSupport::GetCurrentWlanNetworkL()", err)
+    return err;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CWlanSupport::GetWlanProbeRawBuffersL
+// -----------------------------------------------------------------------------
+//
+TInt CWlanSupport::GetWlanProbeRawBuffersL( const RMessage2& aMessage )
+    {
+    LOGENTRFN("CWlanSupport::GetWlanProbeRawBuffersL()")
+
+    // Add session to wlan session table (if not already there)
+    TInt index = AddWlanSessionL( aMessage );
+    iWlanSessionsPtrArray[index]->GetScanResultsL( aMessage );
+
+    LOGEXITFN1("CWlanSupport::GetWlanProbeRawBuffersL()", KRequestPending)
+    return KRequestPending;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CWlanSupport::ParseWlanNetworks
+// -----------------------------------------------------------------------------
+//
+void CWlanSupport::ParseWlanProbeRawBuffersL(
+        CWlanScanInfo* aScanInfo,
+        RConnMonWlanProbeRawBuffersPtrArray& aWlanProbeRawBuffers )
+    {
+    LOGENTRFN("CWlanSupport::ParseWlanProbeRawBuffersL()")
+
+    // For logging only
+    LOG(TInt count( 0 );)
+
+    // Iterate through scan results.
+    for( aScanInfo->First(); !aScanInfo->IsDone(); aScanInfo->Next() )
+        {
+        LOG(count++;)
+        LOGIT1("CWlanSupport::ParseWlanProbeRawBuffersL: network number %d", count)
+
+        // Length of the raw data == Size - CNTRL_HEADER_LEN (==12)
+        TUint16 length( 0 );
+        length = aScanInfo->Size() - KWlanProbeControlHeaderLength;
+        LOGIT1("CWlanSupport::ParseWlanProbeRawBuffersL: length %d", length)
+
+        // Get pointer start of the raw data
+        const TWlanScanInfoFrame* probeRawDataStartPtr =
+                aScanInfo->Current() + KWlanProbeControlHeaderLength;
+
+        // Create temporary heap descriptor for raw data
+        HBufC8* rawBuffer = HBufC8::NewL( length );
+        CleanupStack::PushL( rawBuffer );
+        rawBuffer->Des().Copy( probeRawDataStartPtr, length );
+
+#ifdef _CONNMON_HEXDUMP_LOGGING
+#if ( _CONNMON_LOG_OUTPUT == 2 ) // Works only when logging to file
+        const TText* header = _S( "header" );
+        const TText* margin = _S( "margin" );
+        Log::HexDump( header, margin, probeRawDataStartPtr, length );
+#endif // _CONNMON_LOG_OUTPUT
+#endif // _CONNMON_HEXDUMP_LOGGING
+
+        // Create CConnMonWlanProbeRawBuffer object
+        CConnMonWlanProbeRawBuffer* net = CConnMonWlanProbeRawBuffer::NewL( rawBuffer );
+        CleanupStack::PushL( net );
+
+        // Add object pointer to array
+        aWlanProbeRawBuffers.AppendL( net );
+
+        CleanupStack::Pop( net );
+        // Clear temporary heap descriptor
+        CleanupStack::PopAndDestroy( rawBuffer );
+        LOGIT(".")
+        }
+
+    LOGEXITFN("CWlanSupport::ParseWlanProbeRawBuffersL()")
+    }
+
+
+// -----------------------------------------------------------------------------
+// CWlanSupport::GetWlanSsidNetworksL
+// -----------------------------------------------------------------------------
+//
+TInt CWlanSupport::GetWlanSsidNetworksL( const RMessage2& aMessage )
+    {
+    LOGENTRFN("CWlanSupport::GetWlanSsidNetworksL()")
+    TInt result( KErrNone );
+
+    // Add session to wlan session table (if not already there)
+    TInt index = AddWlanSessionL( aMessage );
+    result = iWlanSessionsPtrArray[index]->GetSsidScanResultsL( aMessage );
+
+    LOGEXITFN1("CWlanSupport::GetWlanSsidNetworksL()", result)
+    return result;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CWlanSupport::AddWlanSessionL
+// -----------------------------------------------------------------------------
+//
+TInt CWlanSupport::AddWlanSessionL( const RMessage2& aMessage )
+    {
+    LOGENTRFN("CWlanSupport::AddWlanSessionL()")
+
+    // Set active session Id to session object
+    CConnMonSession* sessionId = (CConnMonSession*)aMessage.Session();
+
+    // Check if session exist in WLAN sessions array
+    TInt index = WlanSessionIndex( sessionId ); // Returns either KErrNotFound or a valid index
+    if ( index != KErrNotFound )
+        {
+        LOGIT2("AddWlanSessionL: session id %d already in array at index %d", sessionId, index)
+        }
+    else
+        {
+        CWlanSession* session = CWlanSession::NewL( sessionId, this );
+        CleanupStack::PushL( session );
+        iWlanSessionsPtrArray.AppendL( session );
+        CleanupStack::Pop( session );
+        index = iWlanSessionsPtrArray.Count() - 1;
+        LOGIT2("AddWlanSessionL: new session id %d added to array at index %d", sessionId, index)
+        }
+
+    LOGEXITFN1("CWlanSupport::AddWlanSessionL()", index)
+    return index;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CWlanSupport::DeleteWlanSession
+// -----------------------------------------------------------------------------
+//
+void CWlanSupport::DeleteWlanSession( CConnMonSession* aSessionId )
+    {
+    LOGENTRFN("CWlanSupport::DeleteWlanSession()")
+
+    // Check if session found from WLAN sessions array
+    TInt index = WlanSessionIndex( aSessionId );
+
+    if ( index != KErrNotFound )
+        {
+        delete iWlanSessionsPtrArray[index];
+        iWlanSessionsPtrArray[index] = NULL;
+        iWlanSessionsPtrArray.Remove( index );
+        LOGIT2("DeleteWlanSession: deleted session id %d from array index %d", aSessionId, index)
+        }
+
+    LOGEXITFN("CWlanSupport::DeleteWlanSession()")
+    }
+
+
+// -----------------------------------------------------------------------------
+// CWlanSupport::WlanSessionIndex
+// -----------------------------------------------------------------------------
+//
+TInt CWlanSupport::WlanSessionIndex( CConnMonSession* aSessionId )
+    {
+    LOGENTRFN("CWlanSupport::WlanSessionIndex()")
+    TInt result( KErrNotFound );
+
+    // Check session index of the WLAN sessions array
+    for ( TInt index = 0; index < iWlanSessionsPtrArray.Count(); index++ )
+        {
+        if ( aSessionId == iWlanSessionsPtrArray[index]->GetSessionId() )
+            {
+            LOGIT2("WlanSessionIndex: session id %d found from index %d", aSessionId, index)
+            result = index;
+            break;
+            }
+        }
+
+    LOGEXITFN1("CWlanSupport::WlanSessionIndex()", result)
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanSupport::SetIntAttribute
+// -----------------------------------------------------------------------------
+//
+TInt CWlanSupport::SetIntAttributeL(
+        const RMessage2& aMessage,
+        const TInt aValue )
+    {
+    LOGENTRFN("CWlanSupport::SetIntAttributeL()")
+    TInt result( KErrNone );
+    TUint attribute = aMessage.Int2();
+
+    // Add session to wlan session table (if not already there)
+    TInt index = AddWlanSessionL( aMessage );
+
+    switch ( attribute )
+        {
+        case KWlanScanCacheLifetime:
+            iWlanSessionsPtrArray[index]->SetWlanScanCacheLifetime( aValue );
+            LOGIT1("SetIntAttributeL: KWlanScanCacheLifetime set to value <%d>", aValue)
+            result = KErrNone;
+            break;
+        default:
+            LOGIT1("SetIntAttributeL: Error, unknown attribute <%d>", attribute)
+            result = KErrArgument;
+            break;
+        }
+
+    LOGEXITFN1("CWlanSupport::SetIntAttributeL()", result)
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanSupport::SetUintAttribute
+// -----------------------------------------------------------------------------
+//
+TInt CWlanSupport::SetUintAttributeL(
+        const RMessage2& aMessage,
+        const TUint aValue )
+    {
+    LOGENTRFN("CWlanSupport::SetUintAttributeL()")
+    TInt result( KErrNone );
+    TUint attribute = aMessage.Int2();
+
+    // Add session to wlan session table (if not already there)
+    TInt index = AddWlanSessionL( aMessage );
+
+    switch ( attribute )
+        {
+        case KWlanScanMaxDelay:
+            iWlanSessionsPtrArray[index]->SetWlanScanMaxDelay( aValue );
+            LOGIT1("SetUintAttributeL: KWlanScanMaxDelay set to value %d", aValue)
+            result = KErrNone;
+            break;
+        default:
+            LOGIT1("SetUintAttributeL: Error, unknown attribute %d", attribute)
+            result = KErrArgument;
+            break;
+        }
+
+    LOGEXITFN1("CWlanSupport::SetUintAttributeL()", result)
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanSupport::GetIntAttribute
+// -----------------------------------------------------------------------------
+//
+TInt CWlanSupport::GetIntAttributeL( const RMessage2& aMessage, TInt& aValue )
+    {
+    LOGENTRFN("CWlanSupport::GetIntAttributeL()")
+    TInt err( KErrNone );
+    TUint attribute = aMessage.Int2();
+
+    // Add session to wlan session table (if not already there)
+    TInt index = AddWlanSessionL( aMessage );
+    switch ( attribute )
+        {
+        case KWlanScanCacheLifetime:
+            aValue = iWlanSessionsPtrArray[index]->GetWlanScanCacheLifetime();
+            LOGIT1("GetIntAttributeL: KWlanScanCacheLifetime got value %d", aValue)
+            err = KErrNone;
+            break;
+        default:
+            LOGIT1("GetIntAttributeL: Error, unknown attribute %d", attribute)
+            err = KErrArgument;
+            break;
+        }
+
+    LOGEXITFN1("CWlanSupport::GetIntAttributeL()", err)
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanSupport::GetUintAttribute
+// -----------------------------------------------------------------------------
+//
+TInt CWlanSupport::GetUintAttributeL( const RMessage2& aMessage, TUint& aValue )
+    {
+    LOGENTRFN("CWlanSupport::GetUintAttributeL()")
+    TInt err( KErrNone );
+    TUint attribute( aMessage.Int2() );
+
+    // Add session to wlan session table (if not already there)
+    TInt index = AddWlanSessionL( aMessage );
+    switch ( attribute )
+        {
+        case KWlanScanMaxDelay:
+            aValue = iWlanSessionsPtrArray[index]->GetWlanScanMaxDelay();
+            LOGIT1("GetUintAttributeL: KWlanScanMaxDelay got value %d", aValue)
+            err = KErrNone;
+            break;
+        default:
+            LOGIT1("GetUintAttributeL: Error, unknown attribute %d", attribute)
+            err = KErrArgument;
+            break;
+        }
+
+    LOGEXITFN1("CWlanSupport::GetUintAttributeL()", err)
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanSupport::SetStringAttribute
+//
+// Currently assumes the descriptor attribute 'aValue' length has been checked
+// earlier and is short enough.
+// -----------------------------------------------------------------------------
+//
+TInt CWlanSupport::SetStringAttributeL(
+        const RMessage2& aMessage,
+        const TDes& aValue )
+    {
+    LOGENTRFN("CWlanSupport::SetStringAttributeL()")
+    TInt err( KErrNone );
+    TUint attribute( aMessage.Int2() );
+
+    // Add session to wlan session table (if not already there)
+    TInt index = AddWlanSessionL( aMessage );
+    switch ( attribute )
+        {
+        case KWlanSsid:
+            {
+            TBuf8<CConnMonWlanNetwork::KMaxNameLength> ssid;
+            ConnMonUtils::TDesToTDes8( aValue, ssid );
+            iWlanSessionsPtrArray[index]->SetWlanSsid( ssid );
+            }
+            break;
+        default:
+            LOGIT1("SetStringAttributeL: invalid attribute %d", attribute)
+            err = KErrArgument;
+            break;
+        }
+
+    LOGEXITFN1("CWlanSupport::SetStringAttributeL()", err)
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanSupport::GetStringAttribute
+// -----------------------------------------------------------------------------
+//
+TInt CWlanSupport::GetStringAttributeL(
+        const RMessage2& aMessage,
+        TDes& aValue )
+    {
+    LOGENTRFN("CWlanSupport::GetStringAttributeL()")
+    TInt err( KErrNone );
+    TUint attribute( aMessage.Int2() );
+
+    // Add session to wlan session table (if not already there)
+    TInt index = AddWlanSessionL( aMessage );
+
+    switch ( attribute )
+        {
+        case KWlanSsid:
+            {
+            TBuf8<CConnMonWlanNetwork::KMaxNameLength> ssid;
+            iWlanSessionsPtrArray[index]->GetWlanSsid( ssid );
+            ConnMonUtils::TDes8ToTDes( ssid, aValue );
+            }
+            break;
+        default:
+            LOGIT1("GetStringAttributeL: invalid attribute %d", attribute)
+            err = KErrArgument;
+            break;
+        }
+
+    LOGEXITFN1("CWlanSupport::GetStringAttributeL()", err)
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanSupport::CancelAsyncRequest
+// -----------------------------------------------------------------------------
+//
+TInt CWlanSupport::CancelAsyncRequest( const RMessage2& aMessage )
+    {
+    LOGENTRFN("CWlanSupport::CancelAsyncRequest()")
+    TInt err( KErrNone );
+
+    // Check array index
+    TInt index = WlanSessionIndex( (CConnMonSession*)aMessage.Session() );
+
+    // Check if session exist in WLAN sessions array
+    if ( KErrNotFound == index )
+        {
+        // Nothing to cancel on WLAN side
+        err = KErrNotFound;
+        }
+    else
+        {
+        // Cancel client active requests
+        iWlanSessionsPtrArray[index]->CancelActiveRequests( aMessage.Int0() );
+        }
+
+    LOGEXITFN1("CWlanSupport::CancelAsyncRequest()", err)
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanSupport::EnableEventsToClients
+// -----------------------------------------------------------------------------
+//
+void CWlanSupport::EnableEventsToClients()
+    {
+    iEnableEventsToClients = ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanSupport::DisableEventsToClients
+// -----------------------------------------------------------------------------
+//
+void CWlanSupport::DisableEventsToClients()
+    {
+    iEnableEventsToClients = EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanSupport::EventsToClientsEnabled
+// -----------------------------------------------------------------------------
+//
+TBool CWlanSupport::EventsToClientsEnabled()
+    {
+    return iEnableEventsToClients;
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanSupport::WlanRssGoodEnough
+// -----------------------------------------------------------------------------
+//
+TBool CWlanSupport::WlanRssGoodEnough()
+    {
+    LOGENTRFN("CWlanSupport::WlanRssGoodEnough()")
+
+    // Return ETrue by default. Return EFalse only if there is no error
+    // situation and WLAN engine has reported received signal strength
+    // class as weak.
+    TBool value( ETrue );
+
+    if ( iEventWatcher )
+        {
+        if ( iEventWatcher->RssClass() == EConnMonWlanRssClassWeak )
+            {
+            value = EFalse;
+            }
+        }
+
+    LOGEXITFN1("CWlanSupport::WlanRssGoodEnough()", value)
+    return value;
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CWlanEvent::NewL
+// -----------------------------------------------------------------------------
+//
+CWlanEvent* CWlanEvent::NewL( CWlanSupport* aWlanSupport, CConnMonServer* aServer )
+    {
+    CWlanEvent* self = new( ELeave ) CWlanEvent( aWlanSupport, aServer );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanEvent::CWlanEvent
+// -----------------------------------------------------------------------------
+//
+CWlanEvent::CWlanEvent(
+        CWlanSupport* aWlanSupport,
+        CConnMonServer* aServer )
+        :
+        iWlanSupport( aWlanSupport ),
+        iServer( aServer ),
+        iWlanAvailable( EFalse ),
+        iHasAvailabilityKnowledge( EFalse ),
+        iRssClass( EConnMonWlanRssClassUnknown ),
+        iRss( 0 )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CWlanEvent::~CWlanEvent()
+    {
+    iWlanSupport = NULL;
+    iServer = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanEvent::NewNetworksDetected
+// New networks have been detected during scan.
+// -----------------------------------------------------------------------------
+//
+void CWlanEvent::NewNetworksDetected()
+    {
+    LOGIT(".")
+    LOGENTRFN("CWlanEvent::NewNetworksDetected()")
+    iHasAvailabilityKnowledge = ETrue;
+    iWlanAvailable = ETrue;
+
+    if ( iWlanSupport->EventsToClientsEnabled() )
+        {
+        TEventInfo eventInfo;
+        // Check bearer availability threshold
+        TUint threshold( 0 );
+        iServer->CalculateThreshold( EBearerIdAll, EBearerAvailabilityThreshold, threshold );
+
+        // Send bearer availability change event only if threshold is set by some of the clients
+        if ( threshold > 0 )
+            {
+            // Create event info
+            eventInfo.Reset();
+            eventInfo.iConnectionId = EBearerIdWLAN;
+            eventInfo.iEventType = EConnMonBearerAvailabilityChange;
+            eventInfo.iData = iWlanAvailable;
+
+            // Send EConnMonBearerAvailabilityChange event to clients
+            iServer->EventQueue()->Add( eventInfo );
+            LOGIT1("SERVER: EVENT -> WLAN bearer availability changed: %d (bool)", iWlanAvailable)
+            }
+
+        LOGIT("CWlanEvent::NewNetworksDetected triggered HandleAvailabilityChange()")
+        iWlanSupport->EnableWlanScan();
+        iServer->AvailabilityManager()->HandleAvailabilityChange();
+
+        // Create and send EConnMonNewWLANNetworkDetected event to clients
+        eventInfo.Reset();
+        eventInfo.iConnectionId = EBearerIdWLAN;
+        eventInfo.iEventType = EConnMonNewWLANNetworkDetected;
+
+        iServer->EventQueue()->Add( eventInfo );
+        LOGIT("SERVER: EVENT -> EConnMonNewWLANNetworkDetected")
+        }
+
+    LOGEXITFN("CWlanEvent::NewNetworksDetected()")
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanEvent::OldNetworksLost
+// One or more networks have been lost since the last scan.
+// -----------------------------------------------------------------------------
+//
+void CWlanEvent::OldNetworksLost()
+    {
+    LOGIT(".")
+    LOGENTRFN("CWlanEvent::OldNetworksLost()")
+
+    if ( iWlanSupport->EventsToClientsEnabled() )
+        {
+        TEventInfo eventInfo;
+        if ( iWlanAvailable || !iHasAvailabilityKnowledge )
+            {
+            iHasAvailabilityKnowledge = ETrue;
+
+            // Get availability from scan results
+            TBool availability( EFalse );
+            TRAPD( leaveCode, iWlanSupport->GetBearerAvailabilityL( availability ) );
+
+            if ( !availability && leaveCode == KErrNone )
+                {
+                TUint threshold( 0 );
+                iWlanAvailable = EFalse;
+
+                // Check bearer availability threshold
+                iServer->CalculateThreshold(
+                        EBearerIdAll,
+                        EBearerAvailabilityThreshold,
+                        threshold );
+
+                // Send the event only if threshold is set by some of the clients
+                if ( threshold > 0 )
+                    {
+                    // Create event info
+                    eventInfo.Reset();
+                    eventInfo.iConnectionId = EBearerIdWLAN;
+                    eventInfo.iEventType = EConnMonBearerAvailabilityChange;
+                    eventInfo.iData = iWlanAvailable;
+
+                    // Send EConnMonBearerAvailabilityChange event to clients
+                    iServer->EventQueue()->Add( eventInfo );
+                    LOGIT1("SERVER: EVENT -> WLAN bearer availability changed: %d (bool)", iWlanAvailable)
+                    }
+                }
+            }
+
+        LOGIT("CWlanEvent::OldNetworksLost triggered HandleAvailabilityChange()")
+        iWlanSupport->EnableWlanScan();
+        iServer->AvailabilityManager()->HandleAvailabilityChange();
+
+        // Create and send EConnMonOldWLANNetworkLost event to clients
+        eventInfo.Reset();
+        eventInfo.iConnectionId = EBearerIdWLAN;
+        eventInfo.iEventType = EConnMonOldWLANNetworkLost;
+
+        iServer->EventQueue()->Add( eventInfo );
+        LOGIT("SERVER: EVENT -> EConnMonOldWLANNetworkLost")
+        }
+
+    LOGEXITFN("CWlanEvent::OldNetworksLost()")
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanEvent::TransmitPowerChanged
+// TransmitPower related to the active connection has changed.
+// -----------------------------------------------------------------------------
+//
+void CWlanEvent::TransmitPowerChanged( TUint aPower )
+    {
+    LOGIT(".")
+    LOGENTRFN("CWlanEvent::TransmitPowerChanged()")
+
+    iTxPower = aPower;
+    if ( iWlanSupport->EventsToClientsEnabled() )
+        {
+        LOGIT1("SERVER: EVENT -> WLAN transmit power changed: %d mW", aPower)
+        TEventInfo eventInfo;
+
+        // Send EConnMonTransmitPowerChange event to clients
+        eventInfo.Reset();
+        eventInfo.iConnectionId = EBearerIdWLAN;
+        eventInfo.iEventType = EConnMonTransmitPowerChange;
+        eventInfo.iData = iTxPower;
+
+        iServer->EventQueue()->Add( eventInfo );
+        }
+
+    LOGEXITFN("CWlanEvent::TransmitPowerChanged()")
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanEvent::ConnectionStateChanged
+// Connection status has changed.
+// -----------------------------------------------------------------------------
+//
+void CWlanEvent::ConnectionStateChanged( TWlanConnectionMode aNewState )
+    {
+    LOGIT(".")
+    LOGENTRFN("CWlanEvent::ConnectionStateChanged()")
+    LOGIT1("SERVER: EVENT -> WLAN state changed: %d", aNewState)
+
+    if ( aNewState == EWlanConnectionModeNotConnected )
+        {
+        LOGIT2("RSS class changed from %d to %d (unknown)", iRssClass, EConnMonWlanRssClassUnknown)
+        iRssClass = EConnMonWlanRssClassUnknown;
+        }
+
+    LOGEXITFN("CWlanEvent::ConnectionStateChanged()")
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanEvent::RssChanged
+// Received signal strength level has been changed.
+// -----------------------------------------------------------------------------
+//
+void CWlanEvent::RssChanged( TWlanRssClass aRssClass, TUint aRss )
+    {
+    LOGIT(".")
+    LOGENTRFN("CWlanEvent::RssChanged()")
+
+    TInt previousRssClass = iRssClass;
+
+    if ( aRssClass == EWlanRssClassWeak )
+        {
+        LOGIT3("Rss changed from %d to %d dBm class %d (weak)", iRss, aRss, aRssClass)
+        iRssClass = EConnMonWlanRssClassWeak;
+        }
+    else
+        {
+        LOGIT3("Rss changed from %d to %d dBm class %d (normal)", iRss, aRss, aRssClass)
+        iRssClass = EConnMonWlanRssClassNormal;
+        }
+    iRss = aRss;
+
+    if ( ( aRssClass == EWlanRssClassWeak && previousRssClass != EConnMonWlanRssClassWeak ) ||
+            ( aRssClass == EWlanRssClassNormal && previousRssClass == EConnMonWlanRssClassWeak ) )
+        {
+        LOGIT("Rss class change caused call to HandleAvailabilityChange()")
+        iServer->AvailabilityManager()->HandleAvailabilityChange();
+        }
+
+    LOGEXITFN("CWlanEvent::RssChanged()")
+    }
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CWlanSession::NewL
+// -----------------------------------------------------------------------------
+//
+CWlanSession* CWlanSession::NewL(
+        CConnMonSession* aSessionId,
+        CWlanSupport* aWlanSupport )
+    {
+    LOGENTRFN("CWlanSession::NewL()")
+    CWlanSession* self = new( ELeave ) CWlanSession( aSessionId, aWlanSupport );
+    LOGEXITFN("CWlanSession::NewL()")
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanSession::CWlanSession
+// -----------------------------------------------------------------------------
+//
+CWlanSession::CWlanSession(
+        CConnMonSession* aSessionId,
+        CWlanSupport* aWlanSupport )
+        :
+        iSessionId( aSessionId ),
+        iWlanSupport( aWlanSupport ),
+        iWlanScanMaxDelay( 0 ),
+        iWlanScanCacheLifetime( -1 )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CWlanSession::~CWlanSession()
+    {
+    LOGENTRFN("CWlanSession::~CWlanSession()")
+
+    iSessionId = NULL;
+    iWlanSupport = NULL;
+
+    if ( iGetScanResultsAO )
+        {
+        delete iGetScanResultsAO;
+        iGetScanResultsAO = NULL;
+        }
+
+    if ( iGetSsidScanResultsAO )
+        {
+        delete iGetSsidScanResultsAO;
+        iGetSsidScanResultsAO = NULL;
+        }
+
+    // Cleanup message requests array
+    iWlanRequestsArray.Close();
+
+    LOGEXITFN("CWlanSession::~CWlanSession()")
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanSession::SetWlanScanCacheLifeTime
+// -----------------------------------------------------------------------------
+//
+void CWlanSession::SetWlanScanCacheLifetime(
+        const TInt& aWlanScanCacheLifetime )
+    {
+    LOGENTRFN("CWlanSession::SetWlanScanCacheLifetime()")
+    if ( aWlanScanCacheLifetime < 0 )
+        {
+        iWlanScanCacheLifetime = -1;
+        }
+    else
+        {
+        iWlanScanCacheLifetime = aWlanScanCacheLifetime;
+        }
+    LOGEXITFN("CWlanSession::SetWlanScanCacheLifetime()")
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanSession::GetScanResults
+// -----------------------------------------------------------------------------
+//
+void CWlanSession::GetScanResultsL( const RMessage2& aMessage )
+    {
+    LOGENTRFN("CWlanSession::GetScanResultsL()")
+
+    // Create iGetScanResultsAO
+    if ( !iGetScanResultsAO )
+        {
+        iGetScanResultsAO = CWlanGetScanResults::NewL( this );
+        }
+
+    // Set message to request message table to pend message completion
+    iWlanRequestsArray.AppendL( aMessage );
+
+    // Check if AO already active
+    if ( !( iGetScanResultsAO->IsActive() ) )
+        {
+        // Start listening when scan results are ready
+        iGetScanResultsAO->StartL();
+        }
+
+    LOGEXITFN("CWlanSession::GetScanResultsL()")
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanSession::GetSsidScanResultsL
+// -----------------------------------------------------------------------------
+//
+TInt CWlanSession::GetSsidScanResultsL( const RMessage2& aMessage )
+    {
+    LOGENTRFN("CWlanSession::GetSsidScanResultsL()")
+    TInt result( KRequestPending );
+
+    // Create iGetSsidScanResultsAO
+    if ( !iGetSsidScanResultsAO )
+        {
+        iGetSsidScanResultsAO = CWlanGetSsidScanResults::NewL( this );
+        }
+
+    // Check if AO already active
+    if ( !( iGetSsidScanResultsAO->IsActive() ) )
+        {
+        // Set message to request message table to pend message completion
+        // NOTE: ConnMon will allow only 1 concurrent ssid scan from a client.
+        iWlanRequestsArray.AppendL( aMessage );
+
+        // Start listening when scan results are ready
+        iGetSsidScanResultsAO->StartL( iWlanSsid );
+        }
+    else
+        {
+        // Only one SSID scan can be done at a time.
+        // Allowing more would cause conflicts with string attribute KWlanSsid
+        result = KErrInUse;
+        }
+
+    LOGEXITFN1("CWlanSession::GetSsidScanResultsL()", result)
+    return result;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CWlanSession::CancelActiveRequests
+// -----------------------------------------------------------------------------
+//
+void CWlanSession::CancelActiveRequests( const TInt aReqType )
+    {
+    LOGENTRFN("CWlanSession::CancelActiveRequests()")
+    TBool otherReqTypesInQueue = EFalse;
+    TBool ssidScanInQueue = EFalse;
+    TBool normalScanInQueue = EFalse;
+
+    LOGIT2("Request type %d, requests waiting %d", aReqType, iWlanRequestsArray.Count())
+
+    for ( TInt index = 0; index < iWlanRequestsArray.Count(); index++ )
+        {
+        TUint attribType = iWlanRequestsArray[index].Int2();
+        LOGIT1("Attribute type %d", attribType)
+        switch ( aReqType )
+            {
+            case EConnMonGetPckgAttribute:
+                if ( ( attribType == KNetworkNames ) ||
+                     ( attribType == KWlanNetworks ) ||
+                     ( attribType == KWlanProbeRawBuffers ) )
+                    {
+                    normalScanInQueue = ETrue;
+                    iWlanRequestsArray[index].Complete( KErrCancel );
+                    iWlanRequestsArray.Remove( index );
+                    index--;
+                    }
+                else if ( attribType == KWlanSsidNetworks )
+                    {
+                    ssidScanInQueue = ETrue; // Ssid scan
+                    iWlanRequestsArray[index].Complete( KErrCancel );
+                    iWlanRequestsArray.Remove( index );
+                    index--;
+                    }
+                else
+                    {
+                    // Non-cancelled requests still remain.
+                    otherReqTypesInQueue = ETrue;
+                    }
+                break;
+
+            case EConnMonGetIntAttribute:
+                if ( KSignalStrength == attribType )
+                    {
+                    normalScanInQueue = ETrue;
+                    iWlanRequestsArray[index].Complete( KErrCancel );
+                    iWlanRequestsArray.Remove( index );
+                    index--;
+                    }
+                else
+                    {
+                    // Non-cancelled requests still remain.
+                    otherReqTypesInQueue = ETrue;
+                    }
+                break;
+
+            case EConnMonGetBoolAttribute:
+                if ( KBearerAvailability == attribType )
+                    {
+                    normalScanInQueue = ETrue;
+                    iWlanRequestsArray[index].Complete( KErrCancel );
+                    iWlanRequestsArray.Remove( index );
+                    index--;
+                    }
+                else
+                    {
+                    // Non-cancelled requests still remain.
+                    otherReqTypesInQueue = ETrue;
+                    }
+                break;
+
+            default:
+                // Nothing about async WLAN calls in other request types
+                break;
+            }
+        }
+    LOGIT3("Flags: other req. types %d, normal scan %d, ssid scan %d",
+            otherReqTypesInQueue, normalScanInQueue, ssidScanInQueue)
+
+    if ( ssidScanInQueue )
+        {
+        // iGetSsidScanResultsAO only listens to a single type of request,
+        // it can be safely cancelled and deleted.
+        if ( iGetSsidScanResultsAO )
+            {
+            LOGIT("Cancel and delete iGetSsidScanResultsAO")
+            iGetSsidScanResultsAO->Cancel();
+            }
+        }
+
+    if ( normalScanInQueue && ( !otherReqTypesInQueue ) )
+        {
+        if ( iGetScanResultsAO )
+            {
+            LOGIT("Cancel and delete iGetScanResultsAO")
+            iGetScanResultsAO->Cancel();
+            }
+        }
+
+    LOGEXITFN("CWlanSession::CancelActiveRequests()")
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanSession::CompleteActiveRequestsWithError
+// -----------------------------------------------------------------------------
+//
+void CWlanSession::CompleteActiveRequestsWithError(
+        const TInt aErrorCode,
+        const TBool aSsidScan )
+    {
+    //LOGENTRFN("CWlanSession::CompleteActiveRequestsWithError()")
+
+    LOGIT3("Cancelling wlan requests (%d), ssid flag %d, error code <%d>",
+            iWlanRequestsArray.Count(), aSsidScan, aErrorCode)
+    for ( TInt index = 0; index < iWlanRequestsArray.Count(); index++ )
+        {
+        TInt type = iWlanRequestsArray[index].Int2();
+
+        // Check if request came from SSID scan
+        if ( aSsidScan )
+            {
+            // Complete only KWlanSsidNetworks request(s)
+            if ( type == KWlanSsidNetworks )
+                {
+                LOGIT("Cancelled a wlan request, type: ssid")
+                iWlanRequestsArray[index].Complete( aErrorCode );
+                iWlanRequestsArray.Remove( index );
+                index--;
+                }
+            }
+        else // Otherwise, complete all other messages
+            {
+            if ( type == KBearerAvailability ||
+                    type == KSignalStrength ||
+                    type == KNetworkNames ||
+                    type == KWlanNetworks ||
+                    type == KWlanProbeRawBuffers )
+                {
+                LOGIT("Cancelled a wlan request, type: normal")
+                iWlanRequestsArray[index].Complete( aErrorCode );
+                iWlanRequestsArray.Remove( index );
+                index--;
+                }
+            }
+        }
+    //LOGEXITFN("CWlanSession::CompleteActiveRequestsWithError()")
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanSession::CompleteActiveRequests
+// -----------------------------------------------------------------------------
+//
+void CWlanSession::CompleteActiveRequestsL(
+        const TInt aStatus,
+        CWlanScanInfo* aScanInfo,
+        const TBool aSsidScan )
+    {
+    LOGENTRFN("CWlanSession::CompleteActiveRequestsL()")
+
+    // Check status
+    if ( KErrNone != aStatus )
+        {
+        LOGIT1("CWlanSession::CompleteActiveRequestsL(): WLAN scanning failed, err <%d>", aStatus)
+        CompleteActiveRequestsWithError( aStatus, aSsidScan );
+        }
+    else
+        {
+        LOGIT("CWlanSession::CompleteActiveRequestsL(): WLAN scanning successful")
+
+        // Complete messages according to message type
+        for ( TUint index = 0; index < iWlanRequestsArray.Count(); index++ )
+            {
+            TUint type = iWlanRequestsArray[index].Int2();
+
+            // Check if request came from SSID scan
+            if ( aSsidScan )
+                {
+                // Complete only KWlanSsidNetworks message
+                if ( type == KWlanSsidNetworks )
+                    {
+                    LOGIT("CWlanSession::CompleteActiveRequestsL(): complete KWlanSsidNetworks")
+                    CompleteGetWlanSsidNetworksRequestL( aScanInfo, index );
+                    iWlanRequestsArray.Remove( index );
+                    index--;
+                    }
+                }
+            else // Complete all other messages
+                {
+                if ( type == KBearerAvailability )
+                    {
+                    LOGIT("CWlanSession::CompleteActiveRequestsL(): complete KBearerAvailability")
+                    CompleteGetBearerAvailabilityRequest( aScanInfo, index );
+                    iWlanRequestsArray.Remove( index );
+                    index--;
+                    }
+
+                else if ( type == KSignalStrength )
+                    {
+                    LOGIT("CWlanSession::CompleteActiveRequestsL(): complete KSignalStrength")
+                    CompleteGetSignalStrengthRequest( aScanInfo, index );
+                    iWlanRequestsArray.Remove( index );
+                    index--;
+                    }
+
+                else if ( type == KNetworkNames )
+                    {
+                    LOGIT("CWlanSession::CompleteActiveRequestsL(): complete KNetworkNames")
+                    CompleteGetNetworkNamesRequestL( aScanInfo, index );
+                    iWlanRequestsArray.Remove( index );
+                    index--;
+                    }
+
+                else if ( type == KWlanNetworks )
+                    {
+                    LOGIT("CWlanSession::CompleteActiveRequestsL(): complete KWlanNetworks")
+                    CompleteGetWlanNetworksRequestL( aScanInfo, index );
+                    iWlanRequestsArray.Remove( index );
+                    index--;
+                    }
+
+                else if ( type == KWlanProbeRawBuffers )
+                    {
+                    LOGIT("CWlanSession::CompleteActiveRequestsL(): complete KWlanProbeRawBuffers")
+                    CompleteGetWlanProbeRawBuffersRequestL( aScanInfo, index );
+                    iWlanRequestsArray.Remove( index );
+                    index--;
+                    }
+                }
+            }
+        }
+
+    LOGEXITFN("CWlanSession::CompleteActiveRequestsL()")
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CWlanSession::CompleteGetBearerAvailabilityRequest
+// Completes the asynchronous client request: GetBoolAttribute( KBearerAvailability )
+// -----------------------------------------------------------------------------
+//
+void CWlanSession::CompleteGetBearerAvailabilityRequest(
+        CWlanScanInfo* aScanInfo,
+        const TUint aIndex )
+    {
+    LOGENTRFN("CWlanSession::CompleteGetBearerAvailabilityRequest()")
+    TBool availability = EFalse;
+
+    // Set pointer to first IAP, just in case
+    aScanInfo->First();
+
+    // Check scan results
+    if ( aScanInfo->IsDone() )
+        {
+        // No WLAN networks available
+        availability = EFalse;
+        }
+    else
+        {
+        // Found WLAN networks
+        availability = ETrue;
+        }
+
+    LOGIT1("CompleteGetBearerAvailabilityRequest: availability %d", availability)
+
+    // Write result back to client's address space, and complete message
+    TPtrC8 d( reinterpret_cast<TUint8*>( &availability ), sizeof( availability ) );
+    TInt res = iWlanRequestsArray[aIndex].Write( KAttributeParameterIndex, d );
+    if ( KErrNone != res )
+        {
+        LOGIT1("ERROR writing data to client <%d>", res)
+        iWlanRequestsArray[aIndex].Complete( KErrBadDescriptor );
+        }
+    else
+        {
+        iWlanRequestsArray[aIndex].Complete( KErrNone );
+        }
+
+    LOGEXITFN("CWlanSession::CompleteGetBearerAvailabilityRequest()")
+    }
+
+
+// -----------------------------------------------------------------------------
+// CWlanSession::CompleteGetSignalStrengthRequest
+// Completes the asynchronous client request: GetIntAttribute ( KSignalStrength )
+// -----------------------------------------------------------------------------
+//
+void CWlanSession::CompleteGetSignalStrengthRequest(
+        CWlanScanInfo* aScanInfo,
+        const TUint aIndex )
+    {
+    LOGENTRFN("CWlanSession::CompleteGetSignalStrengthRequest()")
+    TInt signalStrength( KMaxTInt ); // Means infinitely weak
+
+    // Iterate through scan results.
+    for ( aScanInfo->First(); !aScanInfo->IsDone(); aScanInfo->Next() )
+        {
+        // RXLevel() returns signal strength in unsigned dBm (-60dBm == 60dBm)
+        if ( static_cast<TInt>( aScanInfo->RXLevel() ) < signalStrength )
+            {
+            signalStrength = static_cast<TInt>( aScanInfo->RXLevel() );
+            }
+        }
+
+    LOGIT1("CWlanSession::CompleteGetSignalStrengthRequest(): signalStrength %d", signalStrength)
+
+    // Write result back to client's address space, and complete message
+    TPtrC8 d( reinterpret_cast<TUint8*>( &signalStrength ), sizeof( signalStrength ) );
+    TInt res = iWlanRequestsArray[aIndex].Write( KAttributeParameterIndex, d );
+    if ( res != KErrNone )
+        {
+        LOGIT1("ERROR writing data to client <%d>", res)
+        iWlanRequestsArray[aIndex].Complete( KErrBadDescriptor );
+        }
+    else
+        {
+        iWlanRequestsArray[aIndex].Complete( KErrNone );
+        }
+
+    LOGEXITFN("CWlanSession::CompleteGetSignalStrengthRequest()")
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanSession::CompleteGetNetworkNamesRequest
+// Completes the asynchronous client request: GetPckgAttribute( KNetworkNames )
+// -----------------------------------------------------------------------------
+//
+void CWlanSession::CompleteGetNetworkNamesRequestL(
+        CWlanScanInfo* aScanInfo,
+        const TUint aIndex )
+    {
+    LOGENTRFN("CWlanSession::CompleteGetNetworkNamesRequestL()")
+    TConnMonNetworkNames netInfo;
+
+    // Parse network names
+    iWlanSupport->ParseNetworkNamesL( aScanInfo, netInfo );
+
+    // Write result back to client's address space, and complete message
+    TConnMonNetworkNamesBuf namesBuf( netInfo );
+    TInt res = iWlanRequestsArray[aIndex].Write( KAttributeParameterIndex, namesBuf );
+    if ( KErrNone != res )
+        {
+        LOGIT1("ERROR writing data to client <%d>", res)
+        iWlanRequestsArray[aIndex].Complete( KErrBadDescriptor );
+        }
+    else
+        {
+        iWlanRequestsArray[aIndex].Complete( KErrNone );
+        }
+
+    LOGEXITFN("CWlanSession::CompleteGetNetworkNamesRequestL()")
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanSession::CompleteGetWlanNetworksRequest
+// Completes the asynchronous client request: GetPckgAttribute( KWlanNetworks )
+// -----------------------------------------------------------------------------
+//
+void CWlanSession::CompleteGetWlanNetworksRequestL(
+        CWlanScanInfo* aScanInfo,
+        const TUint aIndex )
+    {
+    LOGENTRFN("CWlanSession::CompleteGetWlanNetworksRequestL()")
+
+    TInt maxSize( iWlanRequestsArray[aIndex].GetDesMaxLength( KAttributeParameterIndex ) );
+    if ( maxSize < 2 )
+        {
+        LOGIT1("ERROR with message descriptor <%d>", maxSize)
+        iWlanRequestsArray[aIndex].Complete( KErrBadDescriptor );
+        }
+    else
+        {
+        RConnMonWlanNetworksPtrArray wlanNetworks;
+        ConnMonCleanupResetAndDestroyPushL( wlanNetworks );
+
+        // Parse WLAN networks
+        iWlanSupport->ParseWlanNetworksL( aScanInfo, wlanNetworks );
+
+        CConnMonWlanNetworksPtrArrayPckg arr( wlanNetworks, maxSize ); // maxSize >= 2
+        CleanupStack::PopAndDestroy( &wlanNetworks );
+
+        if ( !arr.Buf() )
+            {
+            LOGIT("ERROR no memory for CConnMonWlanNetworksPtrArrayPckg")
+            iWlanRequestsArray[aIndex].Complete( KErrNoMemory );
+            }
+        else
+            {
+            // Write result back to client's address space, and complete message
+            TInt res = iWlanRequestsArray[aIndex].Write( KAttributeParameterIndex, *arr.Buf() );
+            if ( res != KErrNone )
+                {
+                LOGIT1("ERROR writing data to client <%d>", res)
+                iWlanRequestsArray[aIndex].Complete( KErrBadDescriptor );
+                }
+            else
+                {
+                iWlanRequestsArray[aIndex].Complete( KErrNone );
+                }
+            }
+        }
+
+    LOGEXITFN("CWlanSession::CompleteGetWlanNetworksRequestL()")
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanSession::CompleteGetWlanSsidNetworksRequest
+// Completes the asynchronous client request: GetPckgAttribute( KWlanSsidNetworks )
+// -----------------------------------------------------------------------------
+//
+void CWlanSession::CompleteGetWlanSsidNetworksRequestL(
+        CWlanScanInfo* aScanInfo,
+        const TUint aIndex )
+    {
+    LOGENTRFN("CWlanSession::CompleteGetWlanSsidNetworksRequestL()")
+
+    TInt maxSize( iWlanRequestsArray[aIndex].GetDesMaxLength( KAttributeParameterIndex ) );
+    if ( maxSize < 2 )
+        {
+        LOGIT1("ERROR with message descriptor <%d>", maxSize)
+        iWlanRequestsArray[aIndex].Complete( KErrBadDescriptor );
+        }
+    else
+        {
+        RConnMonWlanNetworksPtrArray wlanNetworks;
+        ConnMonCleanupResetAndDestroyPushL( wlanNetworks );
+
+        // Parse WLAN networks
+        iWlanSupport->ParseWlanNetworksL( aScanInfo, wlanNetworks );
+
+        CConnMonWlanNetworksPtrArrayPckg arr( wlanNetworks, maxSize ); // maxSize >= 2
+        CleanupStack::PopAndDestroy( &wlanNetworks );
+
+        if ( !arr.Buf() )
+            {
+            LOGIT("ERROR no memory for CConnMonWlanNetworksPtrArrayPckg")
+            iWlanRequestsArray[aIndex].Complete( KErrNoMemory );
+            }
+        else
+            {
+            // Write result back to client's address space, and complete message
+            TInt res = iWlanRequestsArray[aIndex].Write( KAttributeParameterIndex, *arr.Buf() );
+            if ( res != KErrNone )
+                {
+                LOGIT1("ERROR writing data to client <%d>", res)
+                iWlanRequestsArray[aIndex].Complete( KErrBadDescriptor );
+                }
+            else
+                {
+                iWlanRequestsArray[aIndex].Complete( KErrNone );
+                }
+            }
+        }
+
+    LOGEXITFN("CWlanSession::CompleteGetWlanSsidNetworksRequestL()")
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanSession::CompleteGetWlanProbeRawBuffersRequest
+// Completes the asynchronous client request: GetPckgAttribute( KWlanProbeRawBuffers )
+// -----------------------------------------------------------------------------
+//
+void CWlanSession::CompleteGetWlanProbeRawBuffersRequestL(
+        CWlanScanInfo* aScanInfo,
+        const TUint aIndex )
+    {
+    LOGENTRFN("CWlanSession::CompleteGetWlanProbeRawBuffersRequestL()")
+
+    TInt maxSize( iWlanRequestsArray[aIndex].GetDesMaxLength( KAttributeParameterIndex ) );
+    if ( maxSize < 2 )
+        {
+        LOGIT1("ERROR with message descriptor <%d>", maxSize)
+        iWlanRequestsArray[aIndex].Complete( KErrBadDescriptor );
+        }
+    else
+        {
+        RConnMonWlanProbeRawBuffersPtrArray wlanProbeRawBuffers;
+        ConnMonCleanupResetAndDestroyPushL( wlanProbeRawBuffers );
+
+        // Parse raw buffers networks
+        iWlanSupport->ParseWlanProbeRawBuffersL( aScanInfo, wlanProbeRawBuffers );
+
+        CConnMonWlanProbeRawBuffersPckg arr( wlanProbeRawBuffers, maxSize ); // maxSize >= 2
+        CleanupStack::PopAndDestroy( &wlanProbeRawBuffers );
+
+        if ( !arr.Buf() )
+            {
+            LOGIT("ERROR no memory for CConnMonWlanProbeRawBuffersPckg")
+            iWlanRequestsArray[aIndex].Complete( KErrNoMemory );
+            }
+        else
+            {
+            // Write result back to client's address space, and complete message
+            TInt res = iWlanRequestsArray[aIndex].Write( KAttributeParameterIndex, *arr.Buf() );
+            if ( KErrNone != res )
+                {
+                LOGIT1("ERROR writing data to client <%d>", res)
+                iWlanRequestsArray[aIndex].Complete( KErrBadDescriptor );
+                }
+            else
+                {
+                iWlanRequestsArray[aIndex].Complete( KErrNone );
+                }
+            }
+        }
+
+    LOGEXITFN("CWlanSession::CompleteGetWlanProbeRawBuffersRequestL()")
+    }
+
+
+// =========================== MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CWlanGetScanResults::NewL
+// -----------------------------------------------------------------------------
+//
+CWlanGetScanResults* CWlanGetScanResults::NewL( CWlanSession* aWlanSession )
+    {
+    LOGENTRFN("CWlanGetScanResults::NewL()")
+    CWlanGetScanResults* self = new( ELeave ) CWlanGetScanResults( aWlanSession );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOGEXITFN("CWlanGetScanResults::NewL()")
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanGetScanResults::CWlanGetScanResults
+// -----------------------------------------------------------------------------
+//
+CWlanGetScanResults::CWlanGetScanResults(
+        CWlanSession* aWlanSession )
+        :
+        CActive( EConnMonPriorityNormal ),
+        iWlanSession( aWlanSession )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanGetScanResults::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CWlanGetScanResults::ConstructL()
+    {
+    iWlanMgmt = CWlanMgmtClient::NewL();
+    CActiveScheduler::Add( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanGetScanResults::~CWlanGetScanResults
+// -----------------------------------------------------------------------------
+//
+CWlanGetScanResults::~CWlanGetScanResults()
+    {
+    LOGENTRFN("CWlanGetScanResults::~CWlanGetScanResults()")
+
+    Cancel();
+
+    if ( iWlanMgmt )
+        {
+        delete iWlanMgmt;
+        iWlanMgmt = NULL;
+        }
+
+    if ( iScanInfo )
+        {
+        delete iScanInfo;
+        iScanInfo = NULL;
+        }
+
+    LOGEXITFN("CWlanGetScanResults::~CWlanGetScanResults()")
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanGetScanResults::StartL
+// -----------------------------------------------------------------------------
+//
+void CWlanGetScanResults::StartL()
+    {
+    LOGENTRFN("CWlanGetScanResults::StartL()")
+
+    if ( IsActive() )
+        {
+        LOGIT("CWlanGetScanResults::StartL(): Already active, calling Cancel()")
+        Cancel();
+        }
+
+    // Create scaninfo object for scan results
+    if ( !iScanInfo )
+        {
+        iScanInfo = CWlanScanInfo::NewL();
+        }
+
+    // Get scan results from WLAN engine
+    TInt oldWlanScanCacheLifetime( iWlanSession->GetWlanScanCacheLifetime() );
+    TInt newWlanScanCacheLifetime( oldWlanScanCacheLifetime );
+
+    TUint oldWlanScanMaxDelay( iWlanSession->GetWlanScanMaxDelay() );
+    TUint newWlanScanMaxDelay( oldWlanScanMaxDelay );
+
+    TBuf8<CConnMonWlanNetwork::KMaxNameLength> emptySsid( 0 );
+    LOGIT2("wlanScanCacheLifetime %d, wlanScanMaxDelay %d",
+            newWlanScanCacheLifetime, newWlanScanMaxDelay)
+    iWlanMgmt->GetScanResults(
+            newWlanScanCacheLifetime,
+            newWlanScanMaxDelay,
+            emptySsid,
+            iStatus,
+            *iScanInfo );
+
+    // Check if wlan engine has changed the timing parameters
+    if ( oldWlanScanCacheLifetime != newWlanScanCacheLifetime )
+        {
+        LOGIT2("CWlanGetScanResults::StartL(): wlanScanCacheLifetime changed from %d to %d",
+                oldWlanScanCacheLifetime, newWlanScanCacheLifetime)
+        iWlanSession->SetWlanScanCacheLifetime( newWlanScanCacheLifetime );
+        }
+    if ( oldWlanScanMaxDelay != newWlanScanMaxDelay )
+        {
+        LOGIT2("CWlanGetScanResults::StartL(): wlanScanMaxDelay changed from %d to %d",
+                oldWlanScanMaxDelay, newWlanScanMaxDelay)
+        iWlanSession->SetWlanScanMaxDelay( newWlanScanMaxDelay );
+        }
+
+    // Start listening when scan results are ready
+    SetActive();
+
+    LOGIT3("wlanScanCacheLifetime %d, wlanScanMaxDelay %d, status <%d>",
+            newWlanScanCacheLifetime, newWlanScanMaxDelay, iStatus.Int())
+    LOGEXITFN("CWlanGetScanResults::StartL()")
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanGetScanResults::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CWlanGetScanResults::DoCancel()
+    {
+    LOGIT("CWlanGetScanResults::DoCancel()")
+
+    if ( IsActive() )
+        {
+        // Cancel async request from WLAN engine
+        iWlanMgmt->CancelGetScanResults();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanGetScanResults::RunL
+// -----------------------------------------------------------------------------
+//
+void CWlanGetScanResults::RunL()
+    {
+    LOGIT(".")
+    LOGIT1("CWlanGetScanResults::RunL(): sessionId %d", iWlanSession->GetSessionId())
+
+    // Complete all session requests
+    iWlanSession->CompleteActiveRequestsL( iStatus.Int(), iScanInfo, EFalse );
+
+    // Delete scaninfo object to save memory
+    if ( iScanInfo )
+        {
+        delete iScanInfo;
+        iScanInfo = NULL;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanGetScanResults::RunError
+// -----------------------------------------------------------------------------
+//
+TInt CWlanGetScanResults::RunError( TInt aLeaveCode )
+    {
+    //LOGENTRFN("CWlanGetScanResults::RunError()")
+
+    LOGIT1("CWlanGetScanResults::RunError() <%d>", aLeaveCode)
+    iWlanSession->CompleteActiveRequestsWithError( aLeaveCode, EFalse );
+
+    //LOGEXITFN("CWlanGetScanResults::RunError()")
+    return KErrNone;
+    }
+
+
+// =========================== MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CWlanGetSsidScanResults::NewL
+// -----------------------------------------------------------------------------
+//
+CWlanGetSsidScanResults* CWlanGetSsidScanResults::NewL(
+        CWlanSession* aWlanSession )
+    {
+    LOGENTRFN("CWlanGetSsidScanResults::NewL()")
+    CWlanGetSsidScanResults* self = new( ELeave ) CWlanGetSsidScanResults( aWlanSession );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOGEXITFN("CWlanGetSsidScanResults::NewL()")
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanGetSsidScanResults::CWlanGetSsidScanResults
+// -----------------------------------------------------------------------------
+//
+CWlanGetSsidScanResults::CWlanGetSsidScanResults(
+        CWlanSession* aWlanSession )
+        :
+        CActive( EConnMonPriorityNormal ),
+        iWlanSession( aWlanSession )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanGetSsidScanResults::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CWlanGetSsidScanResults::ConstructL()
+    {
+    iWlanMgmt = CWlanMgmtClient::NewL();
+    CActiveScheduler::Add( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanGetSsidScanResults::~CWlanGetSsidScanResults
+// -----------------------------------------------------------------------------
+//
+CWlanGetSsidScanResults::~CWlanGetSsidScanResults()
+    {
+    LOGENTRFN("CWlanGetSsidScanResults::~CWlanGetSsidScanResults()")
+
+    Cancel();
+
+    if ( iWlanMgmt )
+        {
+        delete iWlanMgmt;
+        iWlanMgmt = NULL;
+        }
+
+    if ( iScanInfo )
+        {
+        delete iScanInfo;
+        iScanInfo = NULL;
+        }
+
+    LOGEXITFN("CWlanGetSsidScanResults::~CWlanGetSsidScanResults()")
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanGetSsidScanResults::StartL
+// -----------------------------------------------------------------------------
+//
+void CWlanGetSsidScanResults::StartL(
+        TBuf8<CConnMonWlanNetwork::KMaxNameLength>& aWlanSsid )
+    {
+    LOGENTRFN("CWlanGetSsidScanResults::StartL()")
+
+    if ( IsActive() )
+        {
+        LOGIT("StartL(): Already active, calling Cancel()")
+        Cancel();
+        }
+
+    // Create scaninfo object for scan results
+    if ( !iScanInfo )
+        {
+        iScanInfo = CWlanScanInfo::NewL();
+        }
+
+    // Get scan results from WLAN engine
+    TInt oldWlanScanCacheLifetime( iWlanSession->GetWlanScanCacheLifetime() );
+    TInt newWlanScanCacheLifetime( oldWlanScanCacheLifetime );
+
+    TUint oldWlanScanMaxDelay( iWlanSession->GetWlanScanMaxDelay() );
+    TUint newWlanScanMaxDelay( oldWlanScanMaxDelay );
+
+    LOGIT2("wlanScanCacheLifetime %d, wlanScanMaxDelay %d", newWlanScanCacheLifetime, newWlanScanMaxDelay)
+    iWlanMgmt->GetScanResults(
+            newWlanScanCacheLifetime,
+            newWlanScanMaxDelay,
+            aWlanSsid,
+            iStatus,
+            *iScanInfo );
+
+    // Check if wlan engine has changed the timing parameters
+    if ( oldWlanScanCacheLifetime != newWlanScanCacheLifetime )
+        {
+        LOGIT2("wlanScanCacheLifetime changed from %d to %d", oldWlanScanCacheLifetime, newWlanScanCacheLifetime)
+        iWlanSession->SetWlanScanCacheLifetime( newWlanScanCacheLifetime );
+        }
+    if ( oldWlanScanMaxDelay != newWlanScanMaxDelay )
+        {
+        LOGIT2("wlanScanMaxDelay changed from %d to %d", oldWlanScanMaxDelay, newWlanScanMaxDelay)
+        iWlanSession->SetWlanScanMaxDelay( newWlanScanMaxDelay );
+        }
+
+    // Start listening when scan results are ready
+    SetActive();
+
+    LOGEXITFN("CWlanGetSsidScanResults::StartL()")
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanGetSsidScanResults::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CWlanGetSsidScanResults::DoCancel()
+    {
+    LOGIT("CWlanGetSsidScanResults::DoCancel()")
+
+    if ( IsActive() )
+        {
+        // Cancel async request from WLAN engine
+        iWlanMgmt->CancelGetScanResults();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanGetSsidScanResults::RunL
+// -----------------------------------------------------------------------------
+//
+void CWlanGetSsidScanResults::RunL()
+    {
+    LOGIT(".")
+    LOGIT1("CWlanGetSsidScanResults::RunL(): sessionId %d", iWlanSession->GetSessionId())
+
+    // Complete all session requests
+    iWlanSession->CompleteActiveRequestsL( iStatus.Int(), iScanInfo, ETrue );
+
+    // Delete scaninfo object to save memory
+    if ( iScanInfo )
+        {
+        delete iScanInfo;
+        iScanInfo = NULL;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanGetSsidScanResults::RunError
+// -----------------------------------------------------------------------------
+//
+TInt CWlanGetSsidScanResults::RunError( TInt aLeaveCode )
+    {
+    //LOGENTRFN("CWlanGetSsidScanResults::RunError()")
+
+    LOGIT1("CWlanGetSsidScanResults::RunError() <%d>", aLeaveCode)
+    iWlanSession->CompleteActiveRequestsWithError( aLeaveCode, ETrue );
+
+    //LOGEXITFN("CWlanGetSsidScanResults::RunError()")
+    return KErrNone;
+    }
+
+
+// =========================== MEMBER FUNCTIONS ===============================
+
+// ---------------------------------------------------------------------------
+//  Constructor
+// ---------------------------------------------------------------------------
+//
+CConnMonWlanProbeRawBuffer::CConnMonWlanProbeRawBuffer()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+//  Constructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CConnMonWlanProbeRawBuffer* CConnMonWlanProbeRawBuffer::NewL()
+    {
+    CConnMonWlanProbeRawBuffer* self = new( ELeave ) CConnMonWlanProbeRawBuffer();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+//  Constructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CConnMonWlanProbeRawBuffer* CConnMonWlanProbeRawBuffer::NewL(
+        const HBufC8* aRawBuffer )
+    {
+    CConnMonWlanProbeRawBuffer* self = new( ELeave ) CConnMonWlanProbeRawBuffer();
+
+    CleanupStack::PushL( self );
+    self->ConstructL( aRawBuffer );
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+//  Second-phase constructor
+// ---------------------------------------------------------------------------
+//
+void CConnMonWlanProbeRawBuffer::ConstructL()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+//  Second-phase constructor
+// ---------------------------------------------------------------------------
+//
+void CConnMonWlanProbeRawBuffer::ConstructL( const HBufC8* aRawBuffer )
+    {
+    if ( aRawBuffer && aRawBuffer->Length() > 0 )
+        {
+        iRawBuffer = HBufC8::NewL( aRawBuffer->Length() );
+        iRawBuffer->Des().Copy( *aRawBuffer );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+//  Copy Constructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CConnMonWlanProbeRawBuffer* CConnMonWlanProbeRawBuffer::NewL(
+        CConnMonWlanProbeRawBuffer& aConnMonWlanProbeRawBuffer )
+    {
+    CConnMonWlanProbeRawBuffer* self = new( ELeave ) CConnMonWlanProbeRawBuffer();
+
+    CleanupStack::PushL( self );
+    self->ConstructL( aConnMonWlanProbeRawBuffer.iRawBuffer );
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+//  Destructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CConnMonWlanProbeRawBuffer::~CConnMonWlanProbeRawBuffer()
+    {
+    delete iRawBuffer;
+    }
+
+// ---------------------------------------------------------------------------
+//  = operator
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CConnMonWlanProbeRawBuffer& CConnMonWlanProbeRawBuffer::operator=(
+        CConnMonWlanProbeRawBuffer& aConnMonWlanProbeRawBuffer )
+    {
+    TInt err( KErrNone );
+
+    if ( aConnMonWlanProbeRawBuffer.iRawBuffer )
+        {
+        delete iRawBuffer;
+        iRawBuffer = NULL;
+        TRAP( err, iRawBuffer = HBufC8::NewL( aConnMonWlanProbeRawBuffer.iRawBuffer->Size() ) );
+        if ( err )
+            {
+            LOGIT1("Raw buffer handling error <%d>", err)
+            }
+        else
+            {
+            iRawBuffer->Des().Copy( *aConnMonWlanProbeRawBuffer.iRawBuffer );
+            }
+        }
+
+    return *this;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Packages object to HBufC8 descriptor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const HBufC8* CConnMonWlanProbeRawBuffer::ToBuf() const
+    {
+    //LOGENTRFN("CConnMonWlanProbeRawBuffer::ToBuf()")
+
+    // Allocate buffer to all data
+    HBufC8* buf = HBufC8::New( sizeof( CConnMonWlanProbeRawBuffer ) + iRawBuffer->Length() );
+    if ( !buf )
+        {
+        LOGEXITFN("ToBuf: out of memory error")
+        return NULL;
+        }
+
+    TPtr8 ptr( buf->Des() );
+
+    // Add CConnMonWlanProbeRawBuffer object
+    ptr.Copy( (TUint8*)this, (TInt)sizeof( CConnMonWlanProbeRawBuffer ) );
+
+    // If rawdata exists add it too
+    if ( iRawBuffer->Length() > 0 )
+        {
+        ptr.Append( iRawBuffer->Des() );
+        }
+
+    //LOGEXITFN("CConnMonWlanProbeRawBuffer::ToBuf()")
+    return buf;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Unpackages CConnMonWlanProbeRawBuffer from TPtrC descriptor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CConnMonWlanProbeRawBuffer::FromPtrC(
+        const TPtrC8& aPtrC,
+        CConnMonWlanProbeRawBuffer* aConnMonWlanProbeRawBuffer )
+    {
+    //LOGENTRFN("CConnMonWlanProbeRawBuffer::FromPtrC()")
+    TInt err( KErrNone );
+
+    // Copy CConnMonWlanProbeRawBuffer object data from the beginning of aPtrC
+    memcpy( aConnMonWlanProbeRawBuffer, aPtrC.Ptr(), sizeof( CConnMonWlanProbeRawBuffer ) );
+
+    // Reset rawdata pointer
+    aConnMonWlanProbeRawBuffer->iRawBuffer = NULL;
+
+    // If rawdata data exists, allocate memory and read it (it exists just after
+    // CConnMonWlanProbeRawBuffer object data) from aPtrC
+    if ( aPtrC.Length() > sizeof( CConnMonWlanProbeRawBuffer ) )
+        {
+        TInt rawDataLen = aPtrC.Length() - sizeof( CConnMonWlanProbeRawBuffer );
+
+        aConnMonWlanProbeRawBuffer->iRawBuffer = HBufC8::New( rawDataLen );
+        if ( !aConnMonWlanProbeRawBuffer->iRawBuffer )
+            {
+            err = KErrNoMemory;
+            LOGIT("FromPtrC: out of memory error")
+            }
+        else
+            {
+            aConnMonWlanProbeRawBuffer->iRawBuffer->Des().Copy(
+                    aPtrC.Mid( sizeof( CConnMonWlanProbeRawBuffer ), rawDataLen ) );
+            }
+        }
+
+    //LOGEXITFN1("CConnMonWlanProbeRawBuffer::FromPtrC()", err)
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// Getter
+// ---------------------------------------------------------------------------
+//
+EXPORT_C HBufC8* CConnMonWlanProbeRawBuffer::RawBuffer() const
+    {
+    return iRawBuffer;
+    }
+
+
+
+
+
+// =========================== MEMBER FUNCTIONS ===============================
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CConnMonWlanProbeRawBuffersPckg::CConnMonWlanProbeRawBuffersPckg(
+        const RConnMonWlanProbeRawBuffersPtrArray& aRef,
+        TUint aBufLen )
+    {
+    LOGENTRFN("CConnMonWlanProbeRawBuffersPckg::CConnMonWlanProbeRawBuffersPckg()")
+
+    const TUint KItemLengthFieldSize = 2; // 2 bytes (item lenth can be larger than 255)
+
+    // First 2 bytes in buffer will contain the total number of objects and the number of transfered objects.
+    TUint currentPosition( 2 );
+    TInt totalItemCount = aRef.Count();
+
+    LOGIT2("CConnMonWlanProbeRawBuffersPckg: buffer size %d, item count %d", aBufLen, totalItemCount)
+
+    // Create a temporary pointer array table for buffer objects
+    RPointerArray<HBufC8> items;
+
+    for ( TUint i = 0; i < totalItemCount; ++i )
+        {
+        const HBufC8* item( aRef[i]->ToBuf() );
+        if ( item )
+            {
+            // Check if there is room in buffer for the next item
+            if ( ( currentPosition + KItemLengthFieldSize + item->Length() ) > aBufLen )
+                {
+                LOGIT4("Buffer full, current position %d, item length %d, buffer size %d, i %d",
+                        currentPosition, item->Length(), aBufLen, i)
+                delete item;
+                item = NULL;
+                break;
+                }
+            TInt err = items.Append( item );
+            if ( !err )
+                {
+                currentPosition += KItemLengthFieldSize + item->Length();
+                }
+            else
+                {
+                LOGIT1("ERROR: append failed <%d>", err)
+                delete item;
+                item = NULL;
+                }
+            }
+        }
+
+    // Check that given buffer length (aBufLen) is not smaller than one
+    // item (CConnMonWlanProbeRawBuffer) + aRef count + items count + item length
+    if ( items.Count() == 0 && totalItemCount > 0 )
+        {
+        aBufLen = 2; // aRef.Count(), items.Count()
+        }
+
+    // Allocate memory for buffer
+    iBuf = HBufC8::New( aBufLen );
+    if ( !iBuf )
+        {
+        LOGIT("CConnMonWlanProbeRawBuffersPckg: out of memory error")
+        }
+    else
+        {
+        // Add total and transferred counts to buffer
+        iBuf->Des().Append( totalItemCount ); // Total amount of objects
+        iBuf->Des().Append( items.Count() ); // Amount of objects in buffer
+
+        // Add item length and item data to buffer
+        for ( TUint i = 0; i < items.Count(); ++i )
+            {
+            // Add item length by splitting 16bit number
+            TUint8 tempLength1 = (TUint8)( items[i]->Length() & 0x00FF );
+            TUint8 tempLength2 = (TUint8)( ( items[i]->Length() & 0xFF00 ) >> KBitsInByte );
+            iBuf->Des().Append( tempLength1 );
+            iBuf->Des().Append( tempLength2 );
+
+            iBuf->Des().Append( *items[i] );
+            }
+        LOGIT1("Used buffer %d", iBuf->Length())
+        }
+    items.ResetAndDestroy(); // Clear array
+
+    LOGEXITFN("CConnMonWlanProbeRawBuffersPckg::CConnMonWlanProbeRawBuffersPckg()")
+    }
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CConnMonWlanProbeRawBuffersPckg::CConnMonWlanProbeRawBuffersPckg(
+        TUint aBufSize )
+    {
+    iBuf = HBufC8::New( aBufSize );
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CConnMonWlanProbeRawBuffersPckg::~CConnMonWlanProbeRawBuffersPckg()
+    {
+    delete iBuf;
+    }
+
+// ---------------------------------------------------------------------------
+// Unpacking
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CConnMonWlanProbeRawBuffersPckg::UnpackToL(
+        RConnMonWlanProbeRawBuffersPtrArray& aRef ) const
+    {
+    LOGENTRFN("CConnMonWlanProbeRawBuffersPckg::UnpackToL()")
+
+    if ( !iBuf || iBuf->Length() < 2 )
+        {
+        User::Leave( KErrBadDescriptor );
+        }
+
+    // Parse total and transferred data counts
+    TUint index( 0 );
+    TUint total( (*iBuf)[index++] ); // Total amount of objects
+    TUint count( (*iBuf)[index++] ); // Amount of objects in buffer
+    LOGIT2("UnpackToL: total %d, in buffer %d", total, count)
+
+    // Parse CConnMonWlanProbeRawBuffer objects from buffer
+    for ( TUint i = 0; i < count; ++i )
+        {
+        // Parse object length (stored in 2 bytes)
+        TUint len( 0 );
+        TUint8 len1( (*iBuf)[index++] ); // 1st byte of length
+        TUint8 len2( (*iBuf)[index++] ); // 2nd byte of length
+        len = (TUint)len2;
+        len = len<<8 & 0xFF00;
+        len = len | (TUint)len1;
+
+        // Parse object data
+        TPtrC8 ptr( iBuf->Mid( index, len ) );
+        index += len;
+
+        CConnMonWlanProbeRawBuffer* net = CConnMonWlanProbeRawBuffer::NewL();
+        TInt err = CConnMonWlanProbeRawBuffer::FromPtrC( ptr, net );
+        if ( err != KErrNone )
+            {
+            LOGIT2("UnpackToL: error <%d> reading data, stopping. i %d", err, i)
+            break;
+            }
+
+        CleanupStack::PushL( net );
+        aRef.AppendL( net );
+        CleanupStack::Pop( net );
+        }
+
+    LOGEXITFN("CConnMonWlanProbeRawBuffersPckg::UnpackToL()")
+    }
+
+// ---------------------------------------------------------------------------
+// Getter
+// ---------------------------------------------------------------------------
+//
+EXPORT_C HBufC8* CConnMonWlanProbeRawBuffersPckg::Buf() const
+    {
+    return iBuf;
+    }
+
+// ---------------------------------------------------------------------------
+// Returns all available networks
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TUint CConnMonWlanProbeRawBuffersPckg::Total() const
+    {
+    TUint ret( 0 );
+    if ( iBuf && iBuf->Length() > 0 )
+        {
+        ret = (*iBuf)[0]; // Total amount of objects
+        }
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// Returns transfered networks
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TUint CConnMonWlanProbeRawBuffersPckg::Count() const
+    {
+    TUint ret( 0 );
+    if ( iBuf && iBuf->Length() > 1 )
+        {
+        ret = (*iBuf)[1]; // Amount of objects in buffer
+        }
+    return ret;
+    }
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/src/ConnMonAvailabilityManager.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,100 @@
+/*
+* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of the availablity manager.
+*
+*/
+
+#include "ConnMonAvailabilityManager.h"
+#include "connmoncommsdatcache.h"
+#include "ConnMonServ.h"
+#include "log.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Two-phase construction
+// ---------------------------------------------------------------------------
+//
+CConnMonAvailabilityManager* CConnMonAvailabilityManager::NewL(
+        CConnMonCommsDatCache* aCommsDatCache,
+        CConnMonServer* aConnMonServer )
+    {
+    //LOGENTRFN("CConnMonAvailabilityManager::NewL()")
+
+    CConnMonAvailabilityManager* self = new( ELeave ) CConnMonAvailabilityManager(
+            aCommsDatCache,
+            aConnMonServer );
+
+    //LOGEXITFN("CConnMonAvailabilityManager::NewL()")
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Construction
+// ---------------------------------------------------------------------------
+//
+CConnMonAvailabilityManager::CConnMonAvailabilityManager(
+        CConnMonCommsDatCache* aCommsDatCache,
+        CConnMonServer* aConnMonServer )
+        :
+        iCommsDatCache( aCommsDatCache ),
+        iConnMonServer( aConnMonServer )
+    {
+    //LOGENTRFN("CConnMonAvailabilityManager::CConnMonAvailabilityManager()")
+    //LOGEXITFN("CConnMonAvailabilityManager::CConnMonAvailabilityManager()")
+    }
+
+// ---------------------------------------------------------------------------
+// Destruction
+// ---------------------------------------------------------------------------
+//
+CConnMonAvailabilityManager::~CConnMonAvailabilityManager()
+    {
+    //LOGENTRFN("CConnMonAvailabilityManager::~CConnMonAvailabilityManager()")
+    //LOGEXITFN("CConnMonAvailabilityManager::~CConnMonAvailabilityManager()")
+    }
+
+// ---------------------------------------------------------------------------
+// Handles availability change
+// ---------------------------------------------------------------------------
+//
+void CConnMonAvailabilityManager::HandleAvailabilityChange()
+    {
+    LOGENTRFN("CConnMonAvailabilityManager::HandleAvailabilityChange()")
+    LOGTIMINGSTART("## CConnMonAvailabilityManager::HandleAvailabilityChange()")
+
+    iCommsDatCache->RefreshAvailabilityInfo( ETrue );
+
+    LOGTIMINGEND("## CConnMonAvailabilityManager::HandleAvailabilityChange()")
+    LOGEXITFN("CConnMonAvailabilityManager::HandleAvailabilityChange()")
+    }
+
+
+// ---------------------------------------------------------------------------
+// Called when any CenRep CommsDat table listener receives a notification
+// ---------------------------------------------------------------------------
+//
+void CConnMonAvailabilityManager::CommsDatEventReceivedL( const TUint32 aTableId )
+    {
+    LOGENTRFN("CConnMonAvailabilityManager::CommsDatEventReceivedL()")
+
+    // Caller (CConnMonCommsDatNotifier::RunL) is trapping this
+    iCommsDatCache->RefreshCommsDatCacheL( aTableId );
+    HandleAvailabilityChange();
+
+    LOGEXITFN("CConnMonAvailabilityManager::CommsDatEventReceivedL()")
+    }
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/src/ConnMonBearer.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation for bearer abstraction class.
+*
+*/
+
+#include "ConnMonBearer.h"
+#include "ConnMonIAP.h"
+#include "connmoncommsdatcache.h"
+#include "log.h"
+
+// ---------------------------------------------------------------------------
+// Construction
+// ---------------------------------------------------------------------------
+//
+TConnMonBearer::TConnMonBearer(
+        CConnMonIAP* aConnMonIAP,
+        CConnMonCommsDatCache* aCommsDatCache )
+        :
+        iConnMonIAP( aConnMonIAP ),
+        iCommsDatCache( aCommsDatCache )
+    {
+    __ASSERT_DEBUG( NULL != aConnMonIAP, User::Panic( KPanicBadParameter, KErrBadHandle ) );
+    }
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/src/ConnMonBearerCSD.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,141 @@
+/*
+* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation for bearer CSD.
+*
+*/
+
+#include "ConnMonBearerCSD.h"
+#include "connmoncommsdatcache.h"
+#include "ConnMonIAP.h"
+#include "log.h"
+
+// ---------------------------------------------------------------------------
+// Construction
+// ---------------------------------------------------------------------------
+//
+TConnMonBearerCSD::TConnMonBearerCSD(
+        CConnMonIAP* aConnMonIAP,
+        CConnMonCommsDatCache* aCommsDatCache )
+        :
+        TConnMonBearer( aConnMonIAP, aCommsDatCache )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Is bearer available
+// ---------------------------------------------------------------------------
+//
+TInt TConnMonBearerCSD::GetAvailability( TBool& aAvailable ) const
+    {
+    //LOGENTRFN("TConnMonBearerCSD::GetAvailability()")
+    TInt err( KErrNone );
+    aAvailable = EFalse;
+
+    // Is bearer available
+    TBool byCell( EFalse );
+    TBool byPhone( EFalse );
+
+    // Find out if we are in 2G or in 3G - it is needed for calculating bearer availability
+    RMobilePhone::TMobilePhoneNetworkMode mode;
+    err = iConnMonIAP->MobilePhone()->GetCurrentMode( mode );
+
+    if ( KErrNone == err )
+        {
+        switch ( mode )
+            {
+            case RMobilePhone::ENetworkModeGsm:
+            case RMobilePhone::ENetworkModeUnknown: // Emulator default
+                err = iConnMonIAP->GetBearerSupportInfo( EBearerIdCSD, byCell, byPhone );
+                break;
+            case RMobilePhone::ENetworkModeWcdma:
+                err = iConnMonIAP->GetBearerSupportInfo( EBearerIdWcdmaCSD, byCell, byPhone );
+                break;
+            default:
+                LOGEXITFN1("TConnMonBearerCSD::GetAvailability()", err)
+                return err; // Return silently (KErrNone), report as not available
+            }
+
+        if ( KErrNone == err )
+            {
+            if ( byCell && byPhone )
+                {
+                aAvailable = ETrue;
+                }
+            }
+        }
+
+    // Make CSD available in wins
+#if defined(__WINSCW__)
+    LOGIT2("GetAvailability: Emulator override, true values were %d <%d>", aAvailable, err)
+    aAvailable = ETrue;
+    err = KErrNone;
+#endif
+
+    //LOGEXITFN1("TConnMonBearerCSD::GetAvailability()", err)
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// Bearer ID getter
+// ---------------------------------------------------------------------------
+//
+TUint TConnMonBearerCSD::BearerId() const
+    {
+    return EBearerIdCSD;
+    }
+
+// ---------------------------------------------------------------------------
+// ETrue if bearer is valid (internal state is correct)
+// ---------------------------------------------------------------------------
+//
+TBool TConnMonBearerCSD::Valid() const
+    {
+    return ETrue;
+    }
+
+// ---------------------------------------------------------------------------
+// Sets available IAPs of this type as available in CommsDat cache
+// ---------------------------------------------------------------------------
+//
+void TConnMonBearerCSD::FlagAvailableIaps() const
+    {
+    LOGENTRFN("TConnMonBearerCSD::FlagAvailableIaps()")
+
+    RArray<TUint> idArray;
+    iConnMonIAP->GetActiveConnectionsIds( EBearerIdCSD, idArray );
+
+    if ( idArray.Count() > 0 )
+        {
+        LOGIT1("Found %d active CSD IAPs", idArray.Count())
+        for ( TInt i = 0; i < idArray.Count(); i++ )
+            {
+            iCommsDatCache->SetAvailableIapWithId( idArray[i] );
+            }
+        }
+    else
+        {
+        TBool available( EFalse );
+        TInt err = GetAvailability( available );
+        LOGIT2("FlagAvailableIaps: CSD availability: %d (bool) <%d>", available, err)
+        if ( KErrNone == err && available )
+            {
+            iCommsDatCache->SetAvailableIapsWithBearerId( EBearerIdCSD );
+            }
+        }
+    idArray.Close();
+
+    LOGEXITFN("TConnMonBearerCSD::FlagAvailableIaps()")
+    }
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/src/ConnMonBearerGPRS.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,126 @@
+/*
+* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation for bearer GPRS.
+*
+*/
+
+#include "ConnMonBearerGPRS.h"
+#include "connmoncommsdatcache.h"
+#include "ConnMonIAP.h"
+#include "log.h"
+
+// ---------------------------------------------------------------------------
+// Construction
+// ---------------------------------------------------------------------------
+//
+TConnMonBearerGPRS::TConnMonBearerGPRS(
+        CConnMonIAP* aConnMonIAP,
+        CConnMonCommsDatCache* aCommsDatCache )
+        :
+        TConnMonBearer( aConnMonIAP, aCommsDatCache )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Is bearer available
+// ---------------------------------------------------------------------------
+//
+TInt TConnMonBearerGPRS::GetAvailability( TBool& aAvailable ) const
+    {
+    //LOGENTRFN("TConnMonBearerGPRS::GetAvailability()")
+    TInt err( KErrNone );
+    aAvailable = EFalse;
+
+    // Is bearer available
+    TBool byCell( EFalse );
+    TBool byPhone( EFalse );
+
+    // Find out if we are in 2G or in 3G - it is needed for calculating bearer availability
+    RMobilePhone::TMobilePhoneNetworkMode mode;
+    err = iConnMonIAP->MobilePhone()->GetCurrentMode( mode );
+
+    if ( KErrNone == err )
+        {
+        switch ( mode )
+            {
+            case RMobilePhone::ENetworkModeGsm:
+            case RMobilePhone::ENetworkModeUnknown: // Emulator default
+                err = iConnMonIAP->GetBearerSupportInfo( EBearerIdGPRS, byCell, byPhone );
+                break;
+            case RMobilePhone::ENetworkModeWcdma:
+                err = iConnMonIAP->GetBearerSupportInfo( EBearerIdWCDMA, byCell, byPhone );
+                break;
+            default:
+                LOGEXITFN1("TConnMonBearerGPRS::GetAvailability()", err)
+                return err; // Return silently, report not available
+            }
+
+        if ( KErrNone == err )
+            {
+            if ( byCell && byPhone )
+                {
+                aAvailable = ETrue;
+                }
+            }
+        }
+
+    // Make GPRS available in wins
+#if defined(__WINSCW__)
+    LOGIT2("GetAvailability: Emulator override, true values were %d <%d>", aAvailable, err)
+    err = KErrNone;
+    aAvailable = ETrue;
+#endif
+
+    //LOGEXITFN1("TConnMonBearerGPRS::GetAvailability()", err)
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// Bearer ID getter
+// ---------------------------------------------------------------------------
+//
+TUint TConnMonBearerGPRS::BearerId() const
+    {
+    return EBearerIdGPRS;
+    }
+
+// ---------------------------------------------------------------------------
+// ETrue if bearer is valid (internal state is correct)
+// ---------------------------------------------------------------------------
+//
+TBool TConnMonBearerGPRS::Valid() const
+    {
+    return ETrue;
+    }
+
+// ---------------------------------------------------------------------------
+// Sets available IAPs of this type as available in CommsDat cache
+// ---------------------------------------------------------------------------
+//
+void TConnMonBearerGPRS::FlagAvailableIaps() const
+    {
+    LOGENTRFN("TConnMonBearerGPRS::FlagAvailableIaps()")
+
+    TBool bearerAvailable( EFalse );
+    TInt err = GetAvailability( bearerAvailable );
+    LOGIT2("FlagAvailableIaps: GPRS availability: %d (bool) <%d>", bearerAvailable, err)
+    if ( !err && bearerAvailable )
+        {
+        iCommsDatCache->SetAvailableIapsWithBearerId( EBearerIdGPRS );
+        }
+
+    LOGEXITFN("TConnMonBearerGPRS::FlagAvailableIaps()")
+    }
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/src/ConnMonBearerGroupManager.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,175 @@
+/*
+* Copyright (c) 2006-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:  Implementation for bearer and bearer group mapping.
+*
+*/
+
+#include "ConnMonBearerGroupManager.h"
+#include "log.h"
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CConnMonBearerGroupManager::CConnMonBearerGroupManager()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CConnMonBearerGroupManager* CConnMonBearerGroupManager::NewL()
+    {
+    CConnMonBearerGroupManager* bgm = new( ELeave ) CConnMonBearerGroupManager();
+
+    CleanupStack::PushL( bgm );
+    bgm->ConstructL();
+    CleanupStack::Pop( bgm );
+
+    return bgm;
+    }
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+void CConnMonBearerGroupManager::ConstructL()
+    {
+    // Create group masks for each bearer
+    // NOTE: Masks must be appended in correct order to be able to use
+    // TConnMonDetailedBearer enumeration as indexes
+
+    iBearerGroupMasks1.Reset();
+    // EBearerUnknown
+    TUint unknown( 0 );
+    User::LeaveIfError( iBearerGroupMasks1.Append( unknown ) );
+
+    //EBearerCSD
+    TUint csd = EBearerGroupCellular | EBearerGroupCircuitSwitched | EBearerGroup2G;
+    User::LeaveIfError( iBearerGroupMasks1.Append( csd ) );
+
+    // EBearerWCDMA
+    TUint wcdma = EBearerGroupCellular | EBearerGroupCellularPacket | EBearerGroup3G;
+    User::LeaveIfError( iBearerGroupMasks1.Append( wcdma ) );
+
+    // EBearerLAN
+    TUint lan = EBearerGroupNonCellular | EBearerGroupLANBased | EBearerGroupWired;
+    User::LeaveIfError( iBearerGroupMasks1.Append( lan ) );
+
+    // EBearerCDMA2000
+    TUint cdma2000 = 0;
+    User::LeaveIfError( iBearerGroupMasks1.Append( cdma2000 ) );
+
+    // EBearerGPRS
+    TUint gprs = EBearerGroupCellular | EBearerGroupCellularPacket |
+                 EBearerGroup2G | EBearerGroup2GPacket;
+    User::LeaveIfError( iBearerGroupMasks1.Append( gprs ) );
+
+    // EBearerHSCSD
+    TUint hscsd = EBearerGroupCellular | EBearerGroupCircuitSwitched | EBearerGroup2G;
+    User::LeaveIfError( iBearerGroupMasks1.Append( hscsd ) );
+
+    // EBearerEdgeGPRS
+    TUint egprs = EBearerGroupCellular | EBearerGroupCellularPacket |
+                  EBearerGroup2G | EBearerGroup2GPacket;
+    User::LeaveIfError( iBearerGroupMasks1.Append( egprs ) );
+
+    // EBearerWLAN
+    TUint wlan = EBearerGroupNonCellular | EBearerGroupLANBased | EBearerGroupWLAN;
+    User::LeaveIfError( iBearerGroupMasks1.Append( wlan ) );
+
+    // EBearerBluetooth
+    TUint bt = EBearerGroupNonCellular | EBearerGroupIPOverConnectivityProtocol;
+    User::LeaveIfError( iBearerGroupMasks1.Append( bt ) );
+
+    // EBearerVirtual
+    TUint virt = EBearerGroupVirtual;
+    User::LeaveIfError( iBearerGroupMasks1.Append( virt ) );
+
+    // EBearerVirtualVPN
+    TUint virtVPN = EBearerGroupVirtual;
+    User::LeaveIfError( iBearerGroupMasks1.Append( virtVPN ) );
+
+    // EBearerWcdmaCSD
+    TUint wcdmaCSD = EBearerGroupCellular | EBearerGroupCircuitSwitched | EBearerGroup3G;
+    User::LeaveIfError( iBearerGroupMasks1.Append( wcdmaCSD ) );
+
+    // EBearerHSDPA
+    TUint hsdpa = EBearerGroupCellular | EBearerGroupCellularPacket |
+                  EBearerGroup3G | EBearerGroup3GPacket | EBearerGroupHSPA;
+    User::LeaveIfError( iBearerGroupMasks1.Append( hsdpa ) );
+
+    // EBearerHSUPA (== EBearerHSDPA in this sense)
+    TUint hsupa = hsdpa;
+    User::LeaveIfError( iBearerGroupMasks1.Append( hsupa ) );
+
+    // EBearerHSxPA (== EBearerHSDPA and EBearerHSUPA in this sense)
+    TUint hsxpa = hsdpa;
+    User::LeaveIfError( iBearerGroupMasks1.Append( hsxpa ) );
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CConnMonBearerGroupManager::~CConnMonBearerGroupManager()
+    {
+    iBearerGroupMasks1.Close();
+    iBearerGroupMasks2.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// GetBearerGroups
+// ---------------------------------------------------------------------------
+//
+TInt CConnMonBearerGroupManager::GetBearerGroups(
+        const TConnMonBearerInfo aBearer,
+        TUint& aBearerGroups1,
+        TUint& aBearerGroups2 )
+    {
+    // Check first group mask
+    if ( iBearerGroupMasks1.Count() > 0 )
+        {
+        if ( iBearerGroupMasks1.Count() >= aBearer )
+            {
+            aBearerGroups1 = iBearerGroupMasks1[aBearer];
+            }
+        else
+            {
+            return KErrNotFound;
+            }
+        }
+    else
+        {
+        return KErrNotFound;
+        }
+
+    // And second
+    if ( iBearerGroupMasks2.Count() > 0 )
+        {
+        if ( iBearerGroupMasks2.Count() >= aBearer )
+            {
+            aBearerGroups2 = iBearerGroupMasks2[aBearer];
+            }
+        else
+            {
+            return KErrNotFound;
+            }
+        }
+
+    return KErrNone;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/src/ConnMonBearerLAN.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,94 @@
+/*
+* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation for bearer LAN.
+*
+*/
+
+#include "ConnMonBearerLAN.h"
+#include "connmoncommsdatcache.h"
+#include "ConnMonIAP.h"
+#include "log.h"
+
+// ---------------------------------------------------------------------------
+// Construction
+// ---------------------------------------------------------------------------
+//
+TConnMonBearerLAN::TConnMonBearerLAN(
+        CConnMonIAP* aConnMonIAP,
+        CConnMonCommsDatCache* aCommsDatCache )
+        :
+        TConnMonBearer( aConnMonIAP, aCommsDatCache )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Is bearer available
+// ---------------------------------------------------------------------------
+//
+TInt TConnMonBearerLAN::GetAvailability( TBool& /*aAvailable*/ ) const
+    {
+    return KErrNotSupported;
+    }
+
+// ---------------------------------------------------------------------------
+// Bearer ID getter
+// ---------------------------------------------------------------------------
+//
+TUint TConnMonBearerLAN::BearerId() const
+    {
+    return EBearerIdLAN;
+    }
+
+// ---------------------------------------------------------------------------
+// ETrue if bearer is valid (internal state is correct)
+// ---------------------------------------------------------------------------
+//
+TBool TConnMonBearerLAN::Valid() const
+    {
+    return ETrue;
+    }
+
+// ---------------------------------------------------------------------------
+// Sets available IAPs of this type as available in CommsDat cache
+// ---------------------------------------------------------------------------
+//
+void TConnMonBearerLAN::FlagAvailableIaps() const
+    {
+    LOGENTRFN("TConnMonBearerLAN::FlagAvailableIaps()")
+
+    RArray<TUint> idArray;
+    iConnMonIAP->GetActiveConnectionsIds( EBearerIdLAN, idArray );
+
+    if ( idArray.Count() > 0 )
+        {
+        LOGIT1("Found %d active LAN IAPs", idArray.Count())
+        for ( TInt i = 0; i < idArray.Count(); i++ )
+            {
+            iCommsDatCache->SetAvailableIapWithId( idArray[i] );
+            }
+        }
+    else
+        {
+        // Currently LAN bearer only supported in emulator, unless LAN IAP already active.
+        #ifdef __WINS__
+        LOGIT("Emulator environment, enabling all LAN IAPs")
+        iCommsDatCache->SetAvailableIapsWithBearerId( EBearerIdLAN );
+        #endif
+        }
+    idArray.Close();
+
+    LOGEXITFN("TConnMonBearerLAN::FlagAvailableIaps()")
+    }
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/src/ConnMonBearerNotifier.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,330 @@
+/*
+* Copyright (c) 2006-2008 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:  Active object to listen for EGPRS and HSxPA notifications.
+*
+*/
+
+#include <e32base.h>
+#include <etelmm.h>
+
+#include "ConnMonBearerNotifier.h"
+#include "ConnMonServ.h"
+#include "CEventQueue.h"
+#include "ConnMonBearerGroupManager.h"
+#include "ConnMonIAP.h"
+#include "ConnMonEGprsNotifier.h"
+#include "ConnMonHsdpaNotifier.h"
+#include "log.h"
+
+
+// -----------------------------------------------------------------------------
+// CConnMonBearerNotifier::CConnMonBearerNotifier
+// Notifies when the bearer changes from EGPRS to GPRS on vice versa.
+// This information is cell specific.
+// -----------------------------------------------------------------------------
+//
+CConnMonBearerNotifier::CConnMonBearerNotifier(
+        CConnMonServer* aServer,
+        RMobilePhone& aMobilePhone,
+        TUint& aConnectionId )
+        :
+        iServer( aServer ),
+        iMobilePhone( aMobilePhone ),
+        iConnectionId( aConnectionId )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonBearerNotifier::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CConnMonBearerNotifier::ConstructL()
+    {
+    //LOGENTRFN("CConnMonBearerNotifier::ConstructL()")
+
+    iEGprsNotifier = CConnMonEGprsNotifier::NewL( this, iMobilePhone );
+    iHsdpaNotifier = CConnMonHsdpaNotifier::NewL( this, iServer, iMobilePhone );
+    iEventInfo.iData = EBearerUnknown;
+    LOGIT("Created CConnMonBearerNotifier")
+
+    //LOGEXITFN("CConnMonBearerNotifier::ConstructL()")
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonBearerNotifier::NewL
+// -----------------------------------------------------------------------------
+//
+CConnMonBearerNotifier* CConnMonBearerNotifier::NewL(
+        CConnMonServer* aServer,
+        RMobilePhone& aMobilePhone,
+        TUint& aConnectionId )
+    {
+    CConnMonBearerNotifier* self = new( ELeave ) CConnMonBearerNotifier(
+            aServer,
+            aMobilePhone,
+            aConnectionId );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+// Destructor
+CConnMonBearerNotifier::~CConnMonBearerNotifier()
+    {
+    if ( iEGprsNotifier )
+        {
+        iEGprsNotifier->Cancel();
+        delete iEGprsNotifier;
+        iEGprsNotifier = NULL;
+        }
+
+    if ( iHsdpaNotifier )
+        {
+        iHsdpaNotifier->Cancel();
+        delete iHsdpaNotifier;
+        iHsdpaNotifier = NULL;
+        }
+
+    iServer = NULL;
+    }
+
+void CConnMonBearerNotifier::Listen()
+    {
+    iEGprsNotifier->Receive();
+    iHsdpaNotifier->Receive();
+    }
+
+void CConnMonBearerNotifier::CancelListen()
+    {
+    iEGprsNotifier->Cancel();
+    iHsdpaNotifier->Cancel();
+    }
+
+TBool CConnMonBearerNotifier::Listening()
+    {
+    // It is enough to know that atleast 1 active object is active.
+    if ( iEGprsNotifier->IsActive() )
+        {
+        return ETrue;
+        }
+    if ( iHsdpaNotifier->IsActive() )
+        {
+        return ETrue;
+        }
+    return EFalse;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CConnMonBearerNotifier::RunL
+// Handles the event that has arrived from ETel
+// -----------------------------------------------------------------------------
+//
+void CConnMonBearerNotifier::HandleEvent()
+    {
+    LOGIT("SERVER: CConnMonBearerNotifier::HandleEvent()")
+
+    TBool eventSent( EFalse );
+    iEventInfo.Reset();
+    TConnMonBearerInfo bearerInfo( EBearerInfoUnknown );
+
+    // Check the mode (GPRS or WCDMA).
+    RMobilePhone::TMobilePhoneNetworkMode mode( RMobilePhone::ENetworkModeUnknown );
+    TInt ret = iMobilePhone.GetCurrentMode( mode );
+    iEventInfo.iEventType = EConnMonBearerInfoChange;
+    iEventInfo.iConnectionId = iConnectionId;
+
+    if ( KErrNone == ret
+         && mode == RMobilePhone::ENetworkModeGsm
+         && iEGprsNotifier->IsActive() == EFalse )
+        {
+        LOGIT("SERVER: CConnMonBearerNotifier::HandleEvent(): NetworkMode is GSM")
+        if ( iEGprsNotifier->EGprsActive() )
+            {
+            iEventInfo.iData = EBearerInfoEdgeGPRS;
+            }
+        else
+            {
+            iEventInfo.iData = EBearerInfoGPRS;
+            }
+
+        iServer->EventQueue()->Add( iEventInfo );
+
+        LOGIT2("SERVER: EVENT -> Bearer changed: BearerId %d, data %d", iEventInfo.iConnectionId, iEventInfo.iData)
+        }
+
+    else if ( KErrNone == ret
+              && mode == RMobilePhone::ENetworkModeWcdma
+              && iHsdpaNotifier->IsActive() == EFalse )
+        {
+        LOGIT("SERVER: NetworkMode is Wcdma")
+
+        bearerInfo = (TConnMonBearerInfo)iHsdpaNotifier->HsxpaStatus();
+        iEventInfo.iData = bearerInfo;
+
+        iServer->EventQueue()->Add( iEventInfo );
+
+        LOGIT2("SERVER: EVENT -> Bearer changed: BearerId %d, data %d", iEventInfo.iConnectionId, iEventInfo.iData)
+        eventSent = ETrue;
+        }
+
+    if ( eventSent )
+        {
+        SendBearerGroupEvent( bearerInfo );
+        }
+
+    // New request
+    Listen();
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonBearerNotifier::SendBearerGroupEvent
+// This function was made for sending the dynamic caps information
+// about the bearer in sync with the bearer group event.
+// -----------------------------------------------------------------------------
+//
+void CConnMonBearerNotifier::SendBearerGroupEvent( TConnMonBearerInfo& aBearerInfo )
+    {
+    LOGENTRFN("CConnMonBearerNotifier::SendBearerGroupEvent()")
+
+    if ( aBearerInfo == EBearerInfoWLAN )
+        {
+        LOGIT("SERVER: WLAN connection-->bearer group changed event NOT sent")
+        LOGIT("SERVER: CConnMonBearerNotifier::SendBearerGroupEvent() OUT")
+        return;
+        }
+
+    TUint bearerMask( 0 );
+    TUint bearerMask2( 0 );
+
+    TInt err = iServer->BearerGroupManager()->GetBearerGroups(
+            aBearerInfo,
+            bearerMask,
+            bearerMask2 );
+
+    if ( KErrNone != err )
+        {
+        LOGIT1("SERVER: CConnMonBearerNotifier::SendBearerGroupEvent(): GetBearerGroups() error <%d>", err)
+        return;
+        }
+
+    iEventInfo.iConnectionId = iConnectionId;
+    iEventInfo.iEventType = EConnMonBearerGroupChange;
+
+    iEventInfo.iData = 1;
+    iEventInfo.iData2 = bearerMask;
+    iEventInfo.iData3 = bearerMask2;
+
+    iServer->EventQueue()->Add( iEventInfo );
+
+    LOGIT3("SERVER: EVENT -> Bearer group info changed: connId %d, internal %d, groups %d",
+            iEventInfo.iConnectionId, iEventInfo.iData, iEventInfo.iData2)
+    LOGEXITFN("CConnMonBearerNotifier::SendBearerGroupEvent()")
+    }
+
+
+// -----------------------------------------------------------------------------
+// CConnMonBearerNotifier::SendBearerGroupEvent
+//
+// -----------------------------------------------------------------------------
+//
+void CConnMonBearerNotifier::SendBearerGroupEvent()
+    {
+    LOGENTRFN("CConnMonBearerNotifier::SendBearerGroupEvent()")
+
+    TInt bearer( EBearerUnknown );
+    TBearerInfo bearerInfo;
+
+    TInt err = iServer->Iap()->GetBearer(
+            iConnectionId,
+            bearer,
+            bearerInfo );
+
+    if ( KErrNone != err )
+        {
+        LOGIT1("SERVER: CConnMonBearerNotifier::SendBearerGroupEvent(): GetBearer() error <%d>", err)
+        return;
+        }
+
+    if ( bearerInfo.iBearer == EBearerInfoWLAN )
+        {
+        LOGIT("SERVER: WLAN connection-->bearer group changed event NOT sent")
+        LOGIT("SERVER: CConnMonBearerNotifier::SendBearerGroupEvent() OUT")
+        return;
+        }
+
+    TUint bearerMask( 0 );
+    TUint bearerMask2( 0 );
+
+    err = iServer->BearerGroupManager()->GetBearerGroups(
+            (TConnMonBearerInfo)bearerInfo.iBearer,
+            bearerMask,
+            bearerMask2 );
+
+    if ( KErrNone != err )
+        {
+        LOGIT1("SERVER: CConnMonBearerNotifier::SendBearerGroupEvent(): GetBearerGroups() error <%d>", err)
+        return;
+        }
+
+    iEventInfo.iConnectionId = iConnectionId;
+    iEventInfo.iEventType = EConnMonBearerGroupChange;
+
+    iEventInfo.iData = bearerInfo.iInternal;
+    iEventInfo.iData2 = bearerMask;
+    iEventInfo.iData3 = bearerMask2;
+
+    iServer->EventQueue()->Add( iEventInfo );
+
+    LOGIT3("SERVER: EVENT -> Bearer group info changed: connId %d, internal %d, groups %d",
+            iEventInfo.iConnectionId, iEventInfo.iData, iEventInfo.iData2)
+    LOGEXITFN("CConnMonBearerNotifier::SendBearerGroupEvent()")
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonBearerNotifier::SendBearerInfoEvent
+//
+// -----------------------------------------------------------------------------
+//
+void CConnMonBearerNotifier::SendBearerInfoEvent()
+    {
+    TInt bearer( EBearerUnknown );
+    TBearerInfo bearerInfo;
+
+    TInt err = iServer->Iap()->GetBearer(
+            iConnectionId,
+            bearer,
+            bearerInfo );
+
+    if ( KErrNone != err )
+        {
+        LOGIT1("SERVER: CConnMonBearerNotifier::SendBearerInfoEvent(): GetBearer() error <%d>", err)
+        return;
+        }
+
+    iEventInfo.Reset();
+
+    iEventInfo.iEventType = EConnMonBearerInfoChange;
+    iEventInfo.iConnectionId = iConnectionId;
+    iEventInfo.iData = bearerInfo.iBearer;
+
+    iServer->EventQueue()->Add( iEventInfo );
+
+    LOGIT2("SERVER: EVENT -> Bearer info changed: connId %d, bearerInfo %d", iEventInfo.iConnectionId, iEventInfo.iData)
+    }
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/src/ConnMonBearerWLAN.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,128 @@
+/*
+* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation for bearer WLAN.
+*
+*/
+
+#include "ConnMonBearerWLAN.h"
+#include "connmoncommsdatcache.h"
+#include "ConnMonIAP.h"
+#include "log.h"
+
+// ---------------------------------------------------------------------------
+// Construction
+// ---------------------------------------------------------------------------
+//
+TConnMonBearerWLAN::TConnMonBearerWLAN(
+        CConnMonIAP* aConnMonIAP,
+        CConnMonCommsDatCache* aCommsDatCache )
+        :
+        TConnMonBearer( aConnMonIAP, aCommsDatCache )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Is bearer available
+// ---------------------------------------------------------------------------
+//
+TInt TConnMonBearerWLAN::GetAvailability( TBool& /*aAvailable*/ ) const
+    {
+    // Not defined or not needed
+    return KErrNotSupported;
+    }
+
+// ---------------------------------------------------------------------------
+// Bearer ID getter
+// ---------------------------------------------------------------------------
+//
+TUint TConnMonBearerWLAN::BearerId() const
+    {
+    return EBearerIdWLAN;
+    }
+
+// ---------------------------------------------------------------------------
+// ETrue if bearer is valid (internal state is correct)
+// ---------------------------------------------------------------------------
+//
+TBool TConnMonBearerWLAN::Valid() const
+    {
+    return ETrue;
+    }
+
+// ---------------------------------------------------------------------------
+// Sets available IAPs of this type as available in CommsDat cache
+// ---------------------------------------------------------------------------
+//
+void TConnMonBearerWLAN::FlagAvailableIaps() const
+    {
+    LOGENTRFN("TConnMonBearerWLAN::FlagAvailableIaps()")
+
+    RArray<TUint> availableIdArray;
+    RArray<TUint> activeIdArray;
+
+    iConnMonIAP->GetActiveConnectionsIds( EBearerIdWLAN, activeIdArray );
+
+    if ( activeIdArray.Count() == 0 )
+        {
+        iConnMonIAP->AppendAvailableWLANIaps( availableIdArray );
+        }
+    else
+        {
+        LOGIT1("Found %d active WLAN IAPs", activeIdArray.Count())
+
+        // Policy based roaming. If current WLAN connection RSS (received
+        // signal strength) is not strong enough, don't give any WLAN IAPs in
+        // available state.
+        if ( iConnMonIAP->WlanRssGoodEnough() )
+            {
+            // KErrDisconnected will be returned if request for used SSID from WLAN engine fails.
+            TInt err = iConnMonIAP->AppendAvailableWLANIapsBySsid( availableIdArray );
+            if ( err != KErrNone )
+                {
+                availableIdArray.Reset();
+                if ( err == KErrDisconnected )
+                    {
+                    activeIdArray.Reset(); // No longer connected.
+                    iConnMonIAP->AppendAvailableWLANIaps( availableIdArray );
+                    }
+                }
+            }
+        else
+            {
+            // Current WLAN RSS is too weak, don't report any WLAN IAPs available.
+            availableIdArray.Reset();
+            activeIdArray.Reset();
+            }
+        }
+
+    for ( TInt i = 0; i < availableIdArray.Count(); i++ )
+        {
+        iCommsDatCache->SetAvailableIapWithId( availableIdArray[i] );
+        }
+    for ( TInt i = 0; i < activeIdArray.Count(); i++ )
+        {
+        // This will only add EasyWLAN IAP ID as available in those cases when
+        // the connection was started with it. This is done so there can't be a
+        // situation when a connection is up but ConnMon reports that
+        // connections IAP as unavailable. (EasyWLAN IAP has empty SSID field in
+        // CommsDat, so AppendAvailableWLANIapsBySsid-method will not find it).
+        iCommsDatCache->SetAvailableIapWithId( activeIdArray[i] );
+        }
+
+    availableIdArray.Close();
+    activeIdArray.Close();
+    LOGEXITFN("TConnMonBearerWLAN::FlagAvailableIaps()")
+    }
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/src/ConnMonCli.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,331 @@
+/*
+* Copyright (c) 2002-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:  CConnMonEventHandler is a hidden active object to receive
+*                notifications on behalf of a client application.
+*
+*/
+
+#include <rconnmon.h>
+
+#include "ConnMonDef.h"
+#include "ConnMonCli.h"
+#include "log.h"
+
+// ============================ LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// Panic
+// Panics the client in case of programming error.
+// -----------------------------------------------------------------------------
+//
+void Panic( TInt aPanic )
+    {
+    _LIT( KPanicCategory, "ConnectionMonitor Client" );
+    User::Panic( KPanicCategory, aPanic );
+    }
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CConnMonEventHandler::CConnMonEventHandler
+// -----------------------------------------------------------------------------
+//
+CConnMonEventHandler::CConnMonEventHandler(
+        MConnectionMonitorObserver* aObserver,
+        RConnectionMonitor& aSession )
+        :
+        CActive( EConnMonPriorityNormal ),
+        iSession( aSession ),
+        iObserver( aObserver ),
+        iBuf( NULL, 0, 0 )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonEventHandler::Construct
+// -----------------------------------------------------------------------------
+//
+void CConnMonEventHandler::Construct()
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// -----------------------------------------------------------------------------
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CConnMonEventHandler::~CConnMonEventHandler()
+    {
+    Cancel();
+    delete iConnMonEvent;
+
+    iObserver = NULL;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CConnMonEventHandler::ReceiveNotification
+// Request a new event from Connection Monitor server.
+// -----------------------------------------------------------------------------
+//
+void CConnMonEventHandler::ReceiveNotification()
+    {
+    if ( iPause )
+        {
+        return;
+        }
+
+    if ( IsActive() )
+        {
+        Cancel();
+        }
+
+    // Must be passed as a descriptor
+    iEventInfo.Reset();
+    iBuf.Set( reinterpret_cast<TUint8*>( &iEventInfo ),
+              sizeof( TEventInfo ),
+              sizeof( TEventInfo ) );
+
+    iSession.ReceiveEvent( iBuf, iExtraBuf, iStatus );
+    SetActive();
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonEventHandler::Pause
+// Pauses receiving events.
+// -----------------------------------------------------------------------------
+//
+void CConnMonEventHandler::Pause()
+    {
+    iPause = ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonEventHandler::Continue
+// Continues receiving events.
+// -----------------------------------------------------------------------------
+//
+void CConnMonEventHandler::Continue( MConnectionMonitorObserver* aObserver )
+    {
+    iPause = EFalse;
+    iObserver = aObserver;
+    ReceiveNotification();
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonEventHandler::ReceiveNotification
+// Receives the new event from Connection Monitor server and passes it to the
+// client interface.
+// -----------------------------------------------------------------------------
+//
+void CConnMonEventHandler::RunL()
+    {
+    if ( KErrServerBusy == iStatus.Int() )
+        {
+        // Message slot was reserved
+        // Try again
+        LOGIT("Client [%d]: CConnMonEventHandler::RunL() KErrServerBusy, trying again")
+        ReceiveNotification();
+        }
+    else if ( KErrNone == iStatus.Int() )
+        {
+        // A new event has arrived
+        switch ( iEventInfo.iEventType )
+            {
+            case EConnMonCreateConnection :
+                iConnMonEvent = new (ELeave) CConnMonCreateConnection(
+                        iEventInfo.iConnectionId );
+                break;
+
+            case EConnMonDeleteConnection :
+                iConnMonEvent = new (ELeave) CConnMonDeleteConnection(
+                        iEventInfo.iConnectionId,
+                        iEventInfo.iData,
+                        iEventInfo.iData2,
+                        iEventInfo.iData3 );
+                break;
+
+            case EConnMonDownlinkDataThreshold :
+                iConnMonEvent = new (ELeave) CConnMonDownlinkDataThreshold(
+                        iEventInfo.iConnectionId,
+                        iEventInfo.iSubConnectionId,
+                        iEventInfo.iData );
+                break;
+
+            case EConnMonUplinkDataThreshold :
+                iConnMonEvent = new (ELeave) CConnMonUplinkDataThreshold(
+                        iEventInfo.iConnectionId,
+                        iEventInfo.iSubConnectionId,
+                        iEventInfo.iData );
+                break;
+
+            case EConnMonNetworkStatusChange :
+                iConnMonEvent = new (ELeave) CConnMonNetworkStatusChange(
+                        iEventInfo.iConnectionId,
+                        iEventInfo.iData );
+                break;
+
+            case EConnMonConnectionStatusChange :
+                iConnMonEvent = new (ELeave) CConnMonConnectionStatusChange(
+                        iEventInfo.iConnectionId,
+                        iEventInfo.iSubConnectionId,
+                        iEventInfo.iData );
+                break;
+
+            case EConnMonConnectionActivityChange :
+                iConnMonEvent = new (ELeave) CConnMonConnectionActivityChange(
+                        iEventInfo.iConnectionId,
+                        iEventInfo.iSubConnectionId,
+                        iEventInfo.iData );
+                break;
+
+            case EConnMonNetworkRegistrationChange :
+                iConnMonEvent = new (ELeave) CConnMonNetworkRegistrationChange(
+                        iEventInfo.iConnectionId,
+                        iEventInfo.iData );
+                break;
+
+            case EConnMonBearerChange :
+                iConnMonEvent = new (ELeave) CConnMonBearerChange(
+                        iEventInfo.iConnectionId,
+                        iEventInfo.iData );
+                break;
+
+            case EConnMonSignalStrengthChange :
+                iConnMonEvent = new (ELeave) CConnMonSignalStrengthChange(
+                        iEventInfo.iConnectionId,
+                        iEventInfo.iData );
+                break;
+
+            case EConnMonBearerAvailabilityChange :
+                iConnMonEvent = new (ELeave) CConnMonBearerAvailabilityChange(
+                        iEventInfo.iConnectionId,
+                        iEventInfo.iData );
+                break;
+
+            case EConnMonIapAvailabilityChange :
+                iConnMonEvent = new (ELeave) CConnMonIapAvailabilityChange(
+                        iEventInfo.iConnectionId,
+                        reinterpret_cast<const TConnMonIapInfo*>( iExtraBuf.Ptr() ) );
+                break;
+
+            case EConnMonTransmitPowerChange :
+                iConnMonEvent = new (ELeave) CConnMonTransmitPowerChange(
+                        iEventInfo.iConnectionId,
+                        iEventInfo.iData );
+                break;
+
+            case EConnMonSNAPsAvailabilityChange :
+                iConnMonEvent = new (ELeave) CConnMonSNAPsAvailabilityChange(
+                        iEventInfo.iConnectionId, iEventInfo.iData,
+                        reinterpret_cast< const TConnMonSNAPInfo* >( iExtraBuf.Ptr() ) );
+                break;
+
+            case EConnMonNewWLANNetworkDetected :
+                iConnMonEvent = new (ELeave) CConnMonNewWLANNetworkDetected(
+                        iEventInfo.iConnectionId );
+                break;
+
+            case EConnMonOldWLANNetworkLost :
+                iConnMonEvent = new (ELeave) CConnMonOldWLANNetworkLost(
+                        iEventInfo.iConnectionId );
+                break;
+
+            case EConnMonPacketDataUnavailable :
+                iConnMonEvent = new (ELeave) CConnMonPacketDataUnavailable(
+                        iEventInfo.iConnectionId );
+                break;
+
+            case EConnMonPacketDataAvailable :
+                iConnMonEvent = new (ELeave) CConnMonPacketDataAvailable(
+                        iEventInfo.iConnectionId );
+                break;
+
+            case EConnMonBearerInfoChange :
+                iConnMonEvent = new (ELeave) CConnMonBearerInfoChange(
+                        iEventInfo.iConnectionId,
+                        iEventInfo.iData );
+                break;
+
+            case EConnMonBearerGroupChange :
+                iConnMonEvent = new (ELeave) CConnMonBearerGroupChange(
+                        iEventInfo.iConnectionId,
+                        iEventInfo.iData2,
+                        iEventInfo.iData3,
+                        iEventInfo.iData );
+                break;
+
+            default:
+                if ( iEventInfo.iEventType >= EConnMonPluginEventBase )
+                    {
+                    // Size of the data is in 'iEventInfo.iData2'
+                    iConnMonEvent = new (ELeave) CConnMonGenericEvent(
+                            iEventInfo.iEventType,
+                            iEventInfo.iConnectionId,
+                            reinterpret_cast<TAny*>( &( iEventInfo.iData ) ) );
+                    }
+                else
+                    {
+                    iConnMonEvent = new (ELeave) CConnMonEventBase(
+                            iEventInfo.iEventType,
+                            iEventInfo.iConnectionId );
+                    }
+            }
+
+        // Deliver the event to client handler
+        TRAPD( leaveCode,
+                iObserver->EventL( reinterpret_cast<CConnMonEventBase&>( *iConnMonEvent ) ) );
+
+        delete iConnMonEvent;
+        iConnMonEvent = NULL;
+
+        LOGIT6("Client [%d]: GOT EVENT: type %d, id %d, data1 %d, data2 %d, data3 %d",
+                &iSession,
+                iEventInfo.iEventType,
+                iEventInfo.iConnectionId,
+                iEventInfo.iData,
+                iEventInfo.iData2,
+                iEventInfo.iData3 )
+
+        // Initiate the next receive
+        ReceiveNotification();
+
+        // If leave occurs in EventL, log and ignore
+        if ( leaveCode )
+            {
+            LOGIT2("Client [%d]: CConnMonEventHandler::RunL() iObserver->EventL() call left <%d>",
+                    &iSession, leaveCode)
+            }
+        }
+    else
+        {
+        LOGIT2("Client [%d]: CConnMonEventHandler::RunL() failed <%d>", &iSession, iStatus.Int())
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonEventHandler::DoCancel
+// Cancels the request from Connection Monitor server.
+// -----------------------------------------------------------------------------
+//
+void CConnMonEventHandler::DoCancel()
+    {
+    if ( IsActive() )
+        {
+        iSession.CancelReceiveEvent();
+        }
+    }
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/src/ConnMonEGprsNotifier.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,170 @@
+/*
+* Copyright (c) 2006-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:  Active object to listen for EGPRS notifications.
+*
+*/
+
+#include <e32base.h>
+#include <rmmcustomapi.h>
+
+#include "ConnMonEGprsNotifier.h"
+#include "ConnMonBearerNotifier.h"
+#include "log.h"
+
+// -----------------------------------------------------------------------------
+// CConnMonEGprsNotifier::CConnMonEGprsNotifier
+// Notifies when GPRS<-->EGPRS bearer changes.
+// -----------------------------------------------------------------------------
+//
+CConnMonEGprsNotifier::CConnMonEGprsNotifier(
+        CConnMonBearerNotifier* aObserver,
+        RMobilePhone& aMobilePhone )
+        :
+        CActive( EConnMonPriorityNormal ),
+        iObserver( aObserver ),
+        iMobilePhone( aMobilePhone ),
+        iGprsInfo(),
+        iGprsInfoPckg( iGprsInfo )
+    {
+    iEGprsActive = EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonEGprsNotifier::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CConnMonEGprsNotifier::ConstructL()
+    {
+    //LOGENTRFN("CConnMonEGprsNotifier::ConstructL()")
+
+    CActiveScheduler::Add( this );
+    // Open ETel custom API
+    TInt ret = iCustomApi.Open( iMobilePhone );
+
+    if ( ret != KErrNone )
+        {
+        LOGIT1("GPRS Bearer notifier NOT started. CustomAPI.Open() - err <%d>", ret )
+        User::Leave( ret );
+        }
+    LOGIT("Created CConnMonEGprsNotifier")
+
+    //LOGEXITFN("CConnMonEGprsNotifier::ConstructL()")
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonEGprsNotifier::NewL
+// -----------------------------------------------------------------------------
+//
+CConnMonEGprsNotifier* CConnMonEGprsNotifier::NewL(
+        CConnMonBearerNotifier* aObserver,
+        RMobilePhone& aMobilePhone )
+    {
+    CConnMonEGprsNotifier* self = new( ELeave ) CConnMonEGprsNotifier( aObserver, aMobilePhone );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+// Destructor
+CConnMonEGprsNotifier::~CConnMonEGprsNotifier()
+    {
+    Cancel();
+
+    // Close ETel custom API
+    iCustomApi.Close();
+    iObserver = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonEGprsNotifier::Receive
+// Requests a new event (bearer GPRS) from ETel
+// -----------------------------------------------------------------------------
+//
+void CConnMonEGprsNotifier::Receive()
+    {
+    if ( IsActive() )
+        {
+        return;
+        }
+
+    iCustomApi.NotifyEGprsInfoChange( iStatus, iGprsInfoPckg );
+    SetActive();
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonEGprsNotifier::EGprsActive
+// Returns the latest state of the EGPRS activity
+// -----------------------------------------------------------------------------
+//
+TBool CConnMonEGprsNotifier::EGprsActive()
+    {
+    return iEGprsActive;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonEGprsNotifier::DoCancel
+// Cancels the request from ETel.
+// -----------------------------------------------------------------------------
+//
+void CConnMonEGprsNotifier::DoCancel()
+    {
+    if ( IsActive() )
+        {
+        LOGIT("SERVER: Cancel NotifyEGprsInfoChange()")
+        iCustomApi.CancelAsyncRequest( ECustomNotifyEGprsInfoChange );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonEGprsNotifier::RunL
+// Handles the event that has arrived from ETel
+// -----------------------------------------------------------------------------
+//
+void CConnMonEGprsNotifier::RunL()
+    {
+    //LOGENTRFN("CConnMonEGprsNotifier::RunL()")
+
+    // All RunL():s outside CServer-derived main class MUST NOT LEAVE.
+    // Use TRAPD when needed.
+
+    LOGIT(".")
+    LOGIT1("RunL: CConnMonEGprsNotifier, status %d", iStatus.Int())
+
+    if ( KErrNone != iStatus.Int() )
+        {
+        LOGIT1("ERROR, NotifyEGprsInfoChange FAILED <%d>", iStatus.Int())
+        }
+    else
+        {
+        if ( iGprsInfoPckg().iGprsInfo == RMmCustomAPI::EEdgeGprs )
+            {
+            LOGIT("SERVER: NotifyEGprsInfoChange()--> EGPRS is active")
+            iEGprsActive = ETrue;
+            }
+        else
+            {
+            LOGIT("SERVER: NotifyEGprsInfoChange()--> GPRS is active")
+            iEGprsActive = EFalse;
+            }
+        iObserver->HandleEvent();
+        // New request
+        Receive();
+        }
+    //LOGEXITFN("CConnMonEGprsNotifier::RunL()")
+    }
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/src/ConnMonExe.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2002-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 for ConnMon.exe (launches ConnMon server).
+*
+*/
+
+#include "ConnMonServ.h"
+
+TInt SetSignal( CConnMonScheduler::TSignal& aSignal );
+
+// -----------------------------------------------------------------------------
+// E32Main()
+// Starting point (MARM).
+// -----------------------------------------------------------------------------
+//
+GLDEF_C TInt E32Main()
+    {
+    CConnMonScheduler::TSignal signal;
+    TInt err = SetSignal( signal );
+    if ( !err )
+        {
+        err = CConnMonScheduler::ThreadStart( signal );
+        }
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// SetSignal()
+// This simple function uses a lot of stack space,
+// that isn't needed throughout the lifetime of the server.
+// That's why it's separate from E32Main()
+// Don't be tempted to amalgamate it back again.
+// -----------------------------------------------------------------------------
+//
+TInt SetSignal( CConnMonScheduler::TSignal& aSignal )
+    {
+    TBuf< 0x100 > cmd;
+    User::CommandLine( cmd );
+    return aSignal.Set( cmd );
+    }
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/src/ConnMonHsdpaNotifier.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,251 @@
+/*
+* Copyright (c) 2008 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:  Active object to listen for HSxPA notifications.
+*
+*/
+
+#include <e32base.h>
+#include <rmmcustomapi.h>
+
+#include "ConnMonServ.h"
+#include "ConnMonSess.h"
+#include "ConnMonIAP.h"
+#include "ConnMonNoti.h"
+
+#include "ConnMonHsdpaNotifier.h"
+#include "ConnMonBearerNotifier.h"
+
+#include "log.h"
+
+// -----------------------------------------------------------------------------
+// CConnMonHsdpaNotifier::CConnMonHsdpaNotifier
+// Notifies when WCDMA bearer activity changes.
+// -----------------------------------------------------------------------------
+//
+CConnMonHsdpaNotifier::CConnMonHsdpaNotifier(
+        CConnMonBearerNotifier* aObserver,
+        CConnMonServer* aServer,
+        RMobilePhone& aMobilePhone )
+        :
+        CActive( EConnMonPriorityNormal ),
+        iObserver( aObserver ),
+        iServer( aServer ),
+        iMobilePhone( aMobilePhone )
+    {
+    iPreviousHsxpaStatus = EBearerInfoWCDMA;
+    iHsxpaStatus = EBearerInfoWCDMA;
+    iHsupaActive = EFalse;
+    iHsdpaActive = EFalse;
+    iPacketServLoaded = 0;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonHsdpaNotifier::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CConnMonHsdpaNotifier::Construct()
+    {
+    //LOGENTRFN("CConnMonHsdpaNotifier::ConstructL()")
+
+    CActiveScheduler::Add( this );
+    TInt err = iPacketService.Open( iMobilePhone );
+    if ( KErrNone == err )
+        {
+        iPacketServLoaded = 1;
+        }
+    LOGIT("Created CConnMonHsdpaNotifier")
+
+    //LOGEXITFN("CConnMonHsdpaNotifier::ConstructL()")
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonHsdpaNotifier::NewL
+// -----------------------------------------------------------------------------
+//
+CConnMonHsdpaNotifier* CConnMonHsdpaNotifier::NewL(
+    CConnMonBearerNotifier* aObserver,
+    CConnMonServer* aServer,
+    RMobilePhone& aMobilePhone )
+    {
+    CConnMonHsdpaNotifier* self = new( ELeave ) CConnMonHsdpaNotifier(
+            aObserver,
+            aServer,
+            aMobilePhone );
+
+    self->Construct();
+    return self;
+    }
+
+// Destructor
+CConnMonHsdpaNotifier::~CConnMonHsdpaNotifier()
+    {
+    Cancel();
+    if ( iPacketServLoaded == 1 )
+        {
+        iPacketService.Close();
+        iPacketServLoaded = 0;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonHsdpaNotifier::Receive
+// Requests a new event (bearer WCDMA activity changed) from ETel
+// -----------------------------------------------------------------------------
+//
+void CConnMonHsdpaNotifier::Receive()
+    {
+    if ( IsActive() )
+        {
+        return;
+        }
+
+    iPacketService.NotifyDynamicCapsChange( iStatus, iDynCaps );
+    SetActive();
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonHsdpaNotifier::HsdpaActive
+// Returns the latest state of HSDPA activity
+// -----------------------------------------------------------------------------
+//
+TBool CConnMonHsdpaNotifier::HsdpaActive()
+    {
+    return iHsdpaActive;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonHsdpaNotifier::HsupaActive
+// Returns the latest state of HSUPA activity
+// -----------------------------------------------------------------------------
+//
+TBool CConnMonHsdpaNotifier::HsupaActive()
+    {
+    return iHsupaActive;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonHsdpaNotifier::HsxpaStatus
+// Returns the latest state of HSxPA activity
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonHsdpaNotifier::HsxpaStatus()
+    {
+    return iHsxpaStatus;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonHsdpaNotifier::DoCancel
+// Cancels the request from ETel.
+// -----------------------------------------------------------------------------
+//
+void CConnMonHsdpaNotifier::DoCancel()
+    {
+    if ( IsActive() )
+        {
+        LOGIT("SERVER: Cancel NotifyDynamicCapsChange()")
+        iPacketService.CancelAsyncRequest( EPacketNotifyDynamicCapsChange );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonHsdpaNotifier::RunL
+// Handles the event that has arrived from ETel
+// -----------------------------------------------------------------------------
+//
+void CConnMonHsdpaNotifier::RunL()
+    {
+    //LOGENTRFN("CConnMonHsdpaNotifier::RunL()")
+
+    // All RunL():s outside CServer-derived main class MUST NOT LEAVE.
+    // Use TRAPD when needed.
+
+    LOGIT(".")
+    LOGIT1("RunL: CConnMonHsdpaNotifier, status %d", iStatus.Int())
+
+    if ( KErrNone != iStatus.Int() )
+        {
+        LOGIT1("ERROR, NotifyDynamicCapsChange FAILED <%d>", iStatus.Int())
+        }
+    else
+        {
+        // Let's check the bearer availability first...
+        TBool byPhone( EFalse );
+        TBool byCell( EFalse );
+
+        TInt err = iServer->Iap()->GetBearerSupportInfo( EBearerIdWCDMA, byCell, byPhone );
+        if ( KErrNone != err )
+            {
+            LOGIT1("CConnMonHsdpaNotifier: GetBearerSupportInfo returned error <%d>", err)
+            Receive();
+            return;
+            }
+
+        LOGIT3("CConnMonHsdpaNotifier: Bearer availability: cell %d, phone %d, dyn.caps 0x%04X",
+                byCell, byPhone, iDynCaps)
+        if ( byCell && byPhone ) // Wcdma bearer is available
+            {
+            if ( iDynCaps & RPacketService::KCapsHSDPA )
+                {
+                iHsdpaActive = ETrue;
+                if ( iDynCaps & RPacketService::KCapsHSUPA )
+                    {
+                    // HSxPA
+                    LOGIT("NotifyDynamicCapsChange() --> HSxPA active")
+                    iHsxpaStatus = EBearerInfoHSxPA;
+                    iHsupaActive = ETrue;
+                    }
+                else
+                    {
+                    // HSDPA
+                    LOGIT("NotifyDynamicCapsChange() --> HSDPA active")
+                    iHsxpaStatus = EBearerInfoHSDPA;
+                    iHsupaActive = EFalse;
+                    }
+                }
+            else
+                {
+                iHsdpaActive = EFalse;
+                if ( iDynCaps & RPacketService::KCapsHSUPA )
+                    {
+                    // HSUPA
+                    LOGIT("NotifyDynamicCapsChange() --> HSUPA active")
+                    iHsxpaStatus = EBearerInfoHSUPA;
+                    iHsupaActive = ETrue;
+                    }
+                else
+                    {
+                    // WCDMA
+                    LOGIT("NotifyDynamicCapsChange() --> WCDMA active")
+                    iHsxpaStatus = EBearerInfoWCDMA;
+                    iHsupaActive = EFalse;
+                    }
+                }
+
+            if ( iPreviousHsxpaStatus != iHsxpaStatus )
+                {
+                LOGIT2("CConnMonHsdpaNotifier: prev %d, curr %d (changed)", iPreviousHsxpaStatus, iHsxpaStatus)
+                iPreviousHsxpaStatus = iHsxpaStatus;
+                iObserver->HandleEvent();
+                }
+            else
+                {
+                LOGIT2("CConnMonHsdpaNotifier: prev %d, curr %d", iPreviousHsxpaStatus, iHsxpaStatus)
+                }
+            }
+        }
+    Receive();
+    //LOGEXITFN("CConnMonHsdpaNotifier::RunL()")
+    }
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/src/ConnMonIAP.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,5031 @@
+/*
+* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Core functionality for ConnMon.
+*
+*/
+
+#include <mmtsy_names.h>
+#include <featmgr.h>
+#include <rmmcustomapi.h>
+#include <utf.h>
+#include <es_sock_partner.h>
+
+#include "ConnMonServ.h"
+#include "ConnMonSess.h"
+#include "CEventQueue.h"
+#include "CCsdFax.h"
+#include "CPsdFax.h"
+#include "ConnMonIAP.h"
+#include "ConnMonNoti.h"
+#include "CDataVolume.h"
+#include "connmondtmnoti.h"
+#include "connmontelnoti.h"
+#include "ConnMonBearerNotifier.h"
+#include "log.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// TConnInfo::TConnInfo
+// -----------------------------------------------------------------------------
+//
+TConnInfo::TConnInfo(
+        TInt aIapId,
+        TInt aNetId,
+        TUint aConnectionId,
+        TInt aBearer,
+        TBearerInfo aBearerInfo )
+        :
+        iIapId( aIapId ),
+        iNetId( aNetId ),
+        iConnectionId( aConnectionId ),
+        iBearer( aBearer ),
+        iConnAttach( 0 ),
+        iProgressNotifier( 0 ),
+        iDLDataNotifier( 0 ),
+        iULDataNotifier( 0 ),
+        iDataVolumeAO( 0 ),
+        iConnDownNotifier( 0 ),
+        iActivityNotifier( 0 ),
+        iActivity( 0 ),
+        iBearerInfo( aBearerInfo ),
+        iBearerNotifier( 0 )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// TConnInfo::Reset
+// -----------------------------------------------------------------------------
+//
+void TConnInfo::Reset()
+    {
+    // Only call this function to initialize a newly created TConnInfo-object.
+    // (There is no cleanup)
+    iIapId            = 0;
+    iNetId            = 0;
+    iConnectionId     = 0;
+    iBearer           = EBearerUnknown;
+    iBearerInfo.iBearer = EBearerInfoUnknown;
+    iBearerInfo.iInternal = ETrue;
+    iProgressNotifier = 0;
+    iDLDataNotifier   = 0;
+    iULDataNotifier   = 0;
+    iDataVolumeAO     = 0;
+    iConnAttach       = 0;
+    iConnDownNotifier = 0;
+    iActivityNotifier = 0;
+    iActivity         = 0;
+    iBearerNotifier   = 0;
+    }
+
+// -----------------------------------------------------------------------------
+// TConnInfo::Compare
+// Compares two TConnInfo items (by connection id).
+// -----------------------------------------------------------------------------
+//
+TInt TConnInfo::Compare( const TConnInfo& aFirst, const TConnInfo& aSecond )
+    {
+    if ( aFirst.iConnectionId < aSecond.iConnectionId )
+        {
+        return -1;
+        }
+
+    if ( aFirst.iConnectionId > aSecond.iConnectionId )
+        {
+        return 1;
+        }
+    return 0;
+    }
+
+// -----------------------------------------------------------------------------
+// TConnInfo::MatchId
+// Finds TConnInfo item matching by connection Id.
+// -----------------------------------------------------------------------------
+//
+TBool TConnInfo::MatchId( const TConnInfo& aFirst, const TConnInfo& aSecond )
+    {
+    if ( aFirst.iConnectionId == aSecond.iConnectionId )
+        {
+        return ETrue;
+        }
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// TConnInfo::MatchIap
+// Finds TConnInfo item matching by iap id and net id.
+// -----------------------------------------------------------------------------
+//
+TBool TConnInfo::MatchIap( const TConnInfo& aFirst, const TConnInfo& aSecond )
+    {
+    // Only internal bearers can be matched by IapId and NetId
+    if ( ( aFirst.iIapId == aSecond.iIapId ) && ( aFirst.iNetId == aSecond.iNetId ) &&
+         ( aFirst.iBearer < EBearerExternalCSD ) && ( aSecond.iBearer < EBearerExternalCSD ) &&
+         ( aFirst.iBearerInfo.iInternal ) && ( aSecond.iBearerInfo.iInternal ) )
+        {
+        return ETrue;
+        }
+
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// TConnInfo::MatchBearer
+// Finds TConnInfo item matching by bearer.
+// -----------------------------------------------------------------------------
+//
+TBool TConnInfo::MatchBearer( const TConnInfo& aFirst, const TConnInfo& aSecond )
+    {
+    // External CSD bearers (there is no event availabe for bearer change)
+    if ( ( aFirst.iBearer == EBearerExternalCSD || aFirst.iBearer == EBearerExternalHSCSD ||
+           aFirst.iBearer == EBearerExternalWcdmaCSD )
+         &&
+         ( aSecond.iBearer == EBearerExternalCSD || aSecond.iBearer == EBearerExternalHSCSD ||
+           aSecond.iBearer == EBearerExternalWcdmaCSD ) )
+        {
+        return ETrue;
+        }
+
+    // External PSD bearers (there is not always an event availabe for bearer change)
+    else if ( ( aFirst.iBearer == EBearerExternalGPRS     ||
+                aFirst.iBearer == EBearerExternalEdgeGPRS ||
+                aFirst.iBearer == EBearerExternalWCDMA    ||
+                aFirst.iBearer == EBearerExternalCDMA2000 ||
+                ( !aFirst.iBearerInfo.iInternal &&
+                  ( aFirst.iBearerInfo.iBearer == EBearerInfoHSDPA ||
+                    aFirst.iBearerInfo.iBearer == EBearerInfoHSUPA ||
+                    aFirst.iBearerInfo.iBearer == EBearerInfoHSxPA ) ) )
+              &&
+              ( aSecond.iBearer == EBearerExternalGPRS     ||
+                aSecond.iBearer == EBearerExternalEdgeGPRS ||
+                aSecond.iBearer == EBearerExternalWCDMA    ||
+                aSecond.iBearer == EBearerExternalCDMA2000 ||
+                ( !aSecond.iBearerInfo.iInternal &&
+                  ( aSecond.iBearerInfo.iBearer == EBearerInfoHSDPA ||
+                    aSecond.iBearerInfo.iBearer == EBearerInfoHSUPA ||
+                    aSecond.iBearerInfo.iBearer == EBearerInfoHSxPA ) ) ) )
+
+        {
+        return ETrue;
+        }
+
+    // Other bearers
+    else if ( aFirst.iBearer == aSecond.iBearer &&
+            aFirst.iBearerInfo.iBearer == aSecond.iBearerInfo.iBearer )
+        {
+        return ETrue;
+        }
+    else
+        {
+        return EFalse;
+        }
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CConnMonIAP::CConnMonIAP
+// -----------------------------------------------------------------------------
+//
+CConnMonIAP::CConnMonIAP( CConnMonServer* aServer )
+        :
+        iServer( aServer ),
+        iEndUserNetIds( KNullDesC8 )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonIAP::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CConnMonIAP::ConstructL()
+    {
+    LOGENTRFN("CConnMonIAP::ConstructL()")
+    TInt err( KErrNone );
+
+    // Connect to socket server and use system global pool (-1) for message slots.
+    User::LeaveIfError( iSocketServer.Connect( static_cast<TUint>( -1 ) ) );
+    LOGIT("(01/11) Loaded OK: ESock")
+
+    // Open RConnection. This object is not attached to any connection
+    User::LeaveIfError( iConnection.Open( iSocketServer ) );
+    LOGIT("(02/11) Opened OK: RConnection")
+
+    // Connect to ETel server
+    TBuf<KCommsDbSvrMaxColumnNameLength> tsyName;
+    tsyName.Copy( KMmTsyModuleName );
+
+    // The RTelServer::Connect() might not always work with the first trial,
+    // because of a coding error related to using semaphores in the method.
+    for ( TInt a = 0; a < KPhoneRetryCount; a++ )
+        {
+        err = iTelServer.Connect();
+        if ( KErrNone == err )
+            {
+            break;
+            }
+        User::After( KPhoneRetryTimeout );
+        LOGIT("RTelServer::Connect() failed, trying again.")
+        }
+    User::LeaveIfError( err );
+    LOGIT("(03/11) Loaded OK: ETel")
+
+    // Initialize FeatureManager
+    FeatureManager::InitializeLibL();
+    LOGIT("(04/11) Loaded OK: FeatureManager")
+
+    // Try to load tsy
+    err = iTelServer.LoadPhoneModule( tsyName );
+    if ( KErrNone == err )
+        {
+        LOGIT("(05/11) Loaded OK: TSY")
+        iTSYLoaded = 1;
+
+        // Phone info can be retrieved with value 0 if there is only one phone
+        RTelServer::TPhoneInfo info;
+        User::LeaveIfError( iTelServer.GetPhoneInfo( 0, info ) );
+        LOGIT("(06/11) Loaded OK: Phone info")
+
+        User::LeaveIfError( iMobilePhone.Open( iTelServer, info.iName ) );
+        LOGIT("(07/11) Opened OK: RMobilePhone")
+
+        // Open packet service
+        err = iPacketService.Open( iMobilePhone );
+        if ( KErrNone == err )
+            {
+            LOGIT("(08/11) Loaded OK: Packet service")
+            iPacketServLoaded = 1;
+
+            // CDMA network does not support external connections. PSD Fax handler module
+            // should not be created when in CDMA network. The code below works OK as long
+            // as there is no phone that supports both CDMA and GSM at the same time.
+            if ( !FeatureManager::FeatureSupported( KFeatureIdProtocolCdma ) )
+                {
+                // Create PSD Fax handler module
+                iPsdFax = new( ELeave ) CPsdFax(
+                        iServer,
+                        &iTelServer,
+                        &iMobilePhone,
+                        &iPacketService );
+                iPsdFax->ConstructL();
+                LOGIT("(09/11) Loaded OK: PSD module")
+                }
+            else
+                {
+                LOGIT("(09/11) Nosupport: PSD module not loaded, no PSD support in CDMA networks.")
+                }
+            }
+        else
+            {
+            LOGIT1("(08/11) Loaderror: Packet service failed with code <%d>", err)
+            }
+
+        // CDMA network does not support external connections. CSD Fax handler module
+        // should not be created when in CDMA network. The code below works OK as long
+        // as there is no phone that supports both CDMA and GSM at the same time.
+        if ( !FeatureManager::FeatureSupported( KFeatureIdProtocolCdma ) )
+            {
+            // Create CSD Fax handler module
+            iCsdFax = new( ELeave ) CCsdFax( iServer, &iTelServer, &iMobilePhone );
+            iCsdFax->ConstructL();
+            LOGIT("(10/11) Loaded OK: CSD module")
+            }
+        else
+            {
+            LOGIT("(10/11) Nosupport: CSD module not loaded, no CSD support in CDMA networks")
+            }
+        }
+    else
+        {
+        LOGIT1("(05/11) Loaderror: TSY failed with code <%d>", err)
+        }
+
+    // Open WLAN Management service
+    if ( FeatureManager::FeatureSupported( KFeatureIdProtocolWlan ) )
+        {
+        TRAPD( leaveCode, iWlanSupport = CWlanSupport::NewL( iServer ) );
+        if ( KErrNone != leaveCode )
+            {
+            LOGIT1("(11/11) Loaderror: WLAN module failed with code <%d>", leaveCode)
+            }
+        else
+            {
+            LOGIT("(11/11) Loaded OK: WLAN module")
+            }
+        }
+    else
+        {
+        LOGIT("(11/11) Nosupport: WLAN module not loaded, no WLAN support detected")
+        }
+
+    LOGEXITFN("CConnMonIAP::ConstructL()")
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonIAP::~CConnMonIAP
+// -----------------------------------------------------------------------------
+//
+// Destructor
+CConnMonIAP::~CConnMonIAP()
+    {
+    LOGENTRFN("CConnMonIAP::~CConnMonIAP()")
+    // Delele dial up modules.
+    delete iCsdFax;
+    iCsdFax = NULL;
+
+    delete iPsdFax;
+    iPsdFax = NULL;
+
+    // Delete global notifications. This must be called before
+    // services are closed or destroyed below.
+    DeleteNotifications();
+
+    // Delete connection up/down notification.
+    if ( iConnUpDownNotifier != 0 )
+        {
+        iConnUpDownNotifier->Cancel();
+        delete iConnUpDownNotifier;
+        }
+
+    // Close all attached connections
+    TInt count = iConnInfos.Count();
+
+    for ( TInt i = 0; i < count; i++ )
+        {
+        if ( iConnInfos[i].iConnAttach != 0 )
+            {
+            iConnInfos[i].iConnAttach->Close();
+            delete iConnInfos[i].iConnAttach;
+            }
+        }
+
+    // Note. all sessions have closed by now.
+    // There is no need to delete connection parameters
+    // because session destructors have already done that.
+    iConnInfos.Close();
+
+    // Close "global" ESOCK objects
+    iConnection.Close();
+    iSocketServer.Close();
+
+    // Close "global" ETEL objects
+    if ( iPacketServLoaded == 1 )
+        {
+        iPacketService.Close();
+        }
+
+    iMobilePhone.Close();
+    iTelServer.Close();
+
+    // Unload FeatureManager
+    FeatureManager::UnInitializeLib();
+
+    // Destroy WLAN service
+    delete iWlanSupport;
+    iWlanSupport = NULL;
+
+    // Reset global pointers
+    iServer                        = NULL;
+    iPsdNetwStatusNotifier         = NULL;
+    iNetwRegistrationNotifier      = NULL;
+    iEdgeNotifier                  = NULL;
+    iWcdmaNotifier                 = NULL;
+    iModeNotifier                  = NULL;
+    iGSMSignalNotifier             = NULL;
+    iGSMBearerAvailabilityNotifier = NULL;
+
+    // Clean up all ECom sessions
+    // More info about it: TSW EGUO-64LD36
+    REComSession::FinalClose();
+    LOGEXITFN("CConnMonIAP::~CConnMonIAP()")
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonIAP::EnumerateConnections
+// Enumerates active connections using RConnection API.
+// Refreshes iConnInfos array (server view) with the latest information.
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonIAP::EnumerateConnections( TUint& aCount )
+    {
+    // Server must be 'blocked' while updating the connection table.
+    TConnectionInfoBuf connInfoBuf;
+    TBearerInfo bearerInfo;
+    TConnInfo connInfo( 0, 0, 0, 0, bearerInfo );
+    TInt err( KErrNone );
+
+    aCount = 0;
+    RArray<TConnInfo> tempArray;
+
+    // Get existing external (fax) CSD connections
+    // These can't be enumerated from ETEL at the moment
+    if ( iCsdFax )
+        {
+        // In practise there can be only ONE fax connection of this type
+        connInfo.Reset();
+        connInfo.iBearer = EBearerExternalCSD; // This will match any ext-CSD
+        connInfo.iBearerInfo.iBearer = EBearerInfoCSD;
+        connInfo.iBearerInfo.iInternal = EFalse;
+
+        TInt index = iConnInfos.Find( connInfo, TConnInfo::MatchBearer );
+        if ( ( KErrNotFound != index ) && iCsdFax->IsValid() )
+            {
+            // Add to temp array
+            tempArray.Append( iConnInfos[index] );
+            aCount++;
+            }
+        else if ( !iConnUpDownNotifier )
+            {
+            // Try to find out about external CSD connections
+            // that were alive before CM server started.
+            // The code below will be executed only when
+            // this method is called for the first time.
+            err = iCsdFax->FindCall();
+            if ( KErrNone == err )
+                {
+                iCsdFax->GetBearer( connInfo.iBearer, connInfo.iBearerInfo );
+                connInfo.iConnectionId = NewConnectionId(); // New unique Id
+                iCsdFax->SetConnectionId( connInfo.iConnectionId );
+                tempArray.Append( connInfo );
+                aCount++;
+                }
+            }
+        }
+
+    // Get existing external (fax) PSD connections
+    // These connections can't be enumerated from ETEL at the moment
+    // Only notification of a new connection is available from ETEL.
+    if ( iPsdFax )
+        {
+        connInfo.Reset();
+        connInfo.iBearer = EBearerExternalGPRS; // This will match any ext-PSD
+        connInfo.iBearerInfo.iBearer = EBearerInfoGPRS;
+        connInfo.iBearerInfo.iInternal = EFalse;
+
+        // Check all external PSD connections
+        for ( TUint index = 0; index < iConnInfos.Count(); index++ )
+            {
+            // Check that connection bearer is external PSD
+            if ( iConnInfos[index].iBearer == EBearerExternalGPRS       ||
+                 iConnInfos[index].iBearer == EBearerExternalEdgeGPRS   ||
+                 iConnInfos[index].iBearer == EBearerExternalWCDMA      ||
+                 iConnInfos[index].iBearer == EBearerExternalCDMA2000   ||
+                 ( !iConnInfos[index].iBearerInfo.iInternal &&
+                   ( iConnInfos[index].iBearerInfo.iBearer == EBearerInfoHSDPA ||
+                     iConnInfos[index].iBearerInfo.iBearer == EBearerInfoHSUPA ||
+                     iConnInfos[index].iBearerInfo.iBearer == EBearerInfoHSxPA ) ) )
+                {
+                // Check if connection is still valid
+                if ( iPsdFax->IsValid( iConnInfos[index].iConnectionId ) )
+                    {
+                    // Add to temp array
+                    tempArray.Append( iConnInfos[index] );
+                    aCount++;
+                    }
+                }
+            }
+
+        if ( !iConnUpDownNotifier )
+            {
+            for( TUint index = 0; index < KMaxPsdConnectionCount; index++ )
+                {
+                // Try to find out about external PSD connections
+                // that were alive before CM server started.
+                // The code below will be executed only when
+                // this method is called for the first time.
+                TBuf<KMaxName> tempName( KExternalName );
+
+                // Add connection number to string if index is > 1
+                if ( index > 0 )
+                    {
+                    tempName.AppendNum( index+1 );
+                    }
+
+                // Try to open connection context
+                err = iPsdFax->OpenContext( index, tempName );
+                if ( KErrNone == err )
+                    {
+                    iPsdFax->GetBearer( connInfo.iBearer, connInfo.iBearerInfo );
+                    connInfo.iConnectionId = NewConnectionId(); // New unique Id
+                    err = iPsdFax->SetConnectionId( index, connInfo.iConnectionId );
+                    if ( KErrNone == err )
+                        {
+                        tempArray.Append( connInfo );
+                        aCount++;
+                        }
+                    }
+                }
+            }
+        }
+
+    const TUint initialCount = iConnInfos.Count();
+    __ASSERT_DEBUG( ( aCount == static_cast<TUint>( tempArray.Count() ) ),
+            PanicServer( EIapArrayError ) );
+
+    TUint k( 0 );
+    // Remove resources owned by obsolete connections
+    for ( k = 0; k < initialCount; k++ )
+        {
+        TInt index( KErrNotFound );
+
+        if ( iConnInfos[k].iBearer < EBearerExternalCSD )
+            {
+            index = tempArray.Find( iConnInfos[k], TConnInfo::MatchIap ); // Internal
+            }
+        else
+            {
+            index = tempArray.Find( iConnInfos[k], TConnInfo::MatchBearer ); // External
+            }
+
+        if ( KErrNotFound == index )
+            {
+            TBool deleteSent( ETrue );
+
+            if ( iConnInfos[k].iConnDownNotifier != 0 )
+                {
+                deleteSent = iConnInfos[k].iConnDownNotifier->DeleteSent();
+                }
+
+            TInt connStatus( 0 );
+            TInt ret = GetConnectionStatus( k, connStatus );
+
+            if ( ( ( KErrNone != ret ) || ( connStatus == 0 ) ) && deleteSent )
+                {
+                LOGIT3("Removing old connection, index %d, id %d, bearer %d",
+                        k, iConnInfos[k].iConnectionId, iConnInfos[k].iBearer)
+                iServer->RemoveConnSettingsFromSessions( iConnInfos[k].iConnectionId );
+                DeleteConnNotifications( k );
+
+                // Close attached connection
+                if ( iConnInfos[k].iConnAttach != 0 )
+                    {
+                    iConnInfos[k].iConnAttach->Close();
+                    delete iConnInfos[k].iConnAttach;
+                    }
+                }
+            else
+                {
+                // Add connection to temp array because connection status is valid.
+                tempArray.Append( iConnInfos[k] );
+                aCount++;
+                }
+            }
+        }
+
+    // Replace old iConnInfos array with tempArray
+    // Reserve enough room
+    for ( TUint i = initialCount; i < aCount; i++ )
+        {
+        TInt error = iConnInfos.Append( tempArray[0] );
+        if ( error )
+            {
+            // Rollback reserved entries
+            for ( TUint j = i; j > initialCount; j-- )
+                {
+                iConnInfos.Remove( j-1 );
+                }
+            tempArray.Reset();
+            tempArray.Close();
+            return error;
+            }
+        }
+
+    // Safe from leaves from here. Copy over new contents
+    iConnInfos.Reset();
+    for ( k = 0; k < aCount; k++ )
+        {
+        iConnInfos.Append( tempArray[k] );
+        }
+
+    // Print connection info array to log
+    #ifdef _DEBUG
+    LOGIT("EnumerateConnections: Connection info array:")
+    for ( TInt m = 0; m < iConnInfos.Count(); m++ )
+        {
+        LOGIT4("    id %d, bearer %d, iapId %d, netId %d", iConnInfos[m].iConnectionId,
+                iConnInfos[m].iBearer, iConnInfos[m].iIapId, iConnInfos[m].iNetId)
+        }
+    #endif // _DEBUG
+
+    tempArray.Reset();
+    tempArray.Close();
+
+    err = KErrNone;
+    // Start connection up/down notifier if not already running
+    if ( !iConnUpDownNotifier )
+        {
+        // Leave left out intentionally, check for NULL instead
+        iConnUpDownNotifier = new CConnUpDownNotifier( iServer ); // No (ELeave)
+        if ( !iConnUpDownNotifier )
+            {
+            err = KErrNoMemory;
+            }
+        else
+            {
+            iConnUpDownNotifier->Construct();
+            }
+        }
+    if ( KErrNone == err )
+        {
+        if ( !iConnUpDownNotifier->IsActive() )
+            {
+            iConnUpDownNotifier->Receive(); // (re)start listening
+            }
+        // Add event watchers for the new connections. Old connections already have
+        // notifications on and AddConnNotificationsL() will only restart the event
+        // watchers if they have stopped (because of an error situation).
+        if ( iCountListeners > 0 )
+            {
+            TRAP( err,
+                    {
+                    for ( k = 0; k < aCount; k++ )
+                        {
+                        AddConnNotificationsL( k );
+                        }
+                    } );
+            }
+        }
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonIAP::EnumerateConnectionsL
+// Enumerates active connections using RConnection API.
+// Refreshes iConnInfos array (server view) with the latest information.
+// Fills aEnumInfo array (client view) with the newly enumerated connection ids.
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonIAP::EnumerateConnectionsL( TUint& aCount, CArrayFixFlat<TUint>& aEnumInfo )
+    {
+    LOGENTRFN("CConnMonIAP::EnumerateConnectionsL()")
+    TInt err( KErrNone );
+
+    err = EnumerateConnections( aCount );
+    if ( KErrNone == err )
+        {
+        // Fill in table (connection ids) owned by the session
+        // Client needs this table when querying connection info index by index.
+        aEnumInfo.Reset();
+
+        if ( aCount > 0 )
+            {
+            for ( TUint k = 0; k < aCount; k++ )
+                {
+                // Sometimes there is a delay after the DELETE event has arrived and
+                // before the closed connection is removed from Esock. Hide these closing
+                // connections from clients.
+                TBool deleteSent( EFalse );
+
+                if ( iConnInfos[k].iConnDownNotifier != 0 )
+                    {
+                    deleteSent = iConnInfos[k].iConnDownNotifier->DeleteSent();
+                    }
+
+                if ( !deleteSent )
+                    {
+                    aEnumInfo.AppendL( iConnInfos[k].iConnectionId );
+                    }
+                }
+            aCount = aEnumInfo.Count();
+            }
+        }
+
+    LOGEXITFN1("CConnMonIAP::EnumerateConnectionsL()", err)
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonIAP::ConnectionExists
+// Checks if given connection id is valid
+// -----------------------------------------------------------------------------
+//
+TBool CConnMonIAP::ConnectionExists( const TUint& aConnectionId )
+    {
+    LOGENTRFN("CConnMonIAP::ConnectionExists()")
+    TBool res( EFalse );
+
+    if ( aConnectionId == 0 || aConnectionId >= KMaxConnectionId )
+        {
+        res = EFalse;
+        }
+    else
+        {
+        TInt index = Index( aConnectionId );
+        if ( index < 0 )
+            {
+            res = EFalse;
+            }
+        else
+            {
+            res = ETrue;
+            }
+        }
+
+    LOGEXITFN1("CConnMonIAP::ConnectionExists()", res)
+    return res;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonIAP::GetConnectionInfo
+// Returns the number of subconnections in aSubConnectionCount
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonIAP::GetConnectionInfo(
+        const TUint& aConnectionId,
+        TUint& aSubConnectionCount )
+    {
+    LOGENTRFN("CConnMonIAP::GetConnectionInfo()")
+    TInt err( KErrNone );
+
+    // Find connection matching the given Id
+    TInt index = Index( aConnectionId );
+    if ( index < 0  )
+        {
+        err = KErrNotFound;
+        }
+    else
+        {
+        // Get the number of subconnections
+        if ( iConnInfos[index].iBearer < EBearerExternalCSD )
+            {
+            // Internal connections
+            aSubConnectionCount = 1;
+            err = iConnInfos[index].iConnAttach->EnumerateSubConnections(
+                    aSubConnectionCount );
+            if ( KErrNotReady == err )
+                {
+                err = KErrNone;
+                }
+            }
+        else
+            {
+            // External connections
+            aSubConnectionCount = 1;
+            }
+        }
+
+    LOGEXITFN1("CConnMonIAP::GetConnectionInfo()", err)
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonIAP::GetIntAttributeL
+// Returns the integer attribute in aValue
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonIAP::GetIntAttributeL( const RMessage2& aMessage, TInt& aValue )
+    {
+    LOGENTRFN("CConnMonIAP::GetIntAttributeL()")
+    TInt ret( KErrNone );
+    TUint connectionId( aMessage.Int0() );
+    TUint attribute( aMessage.Int2() );
+
+    LOGIT2("SERVER: CConnMonIAP::GetIntAttributeL(): connId %d, attribute %d", connectionId, attribute)
+
+    if ( KBearerInfo == attribute )
+        {
+        LOGIT("SERVER: CConnMonIAP::GetIntAttributeL(): KBearerInfo")
+        TBearerInfo bearerInfo;
+        ret = GetBearerInfo( connectionId, bearerInfo );
+        if ( KErrNone == ret )
+            {
+            aValue = bearerInfo.iBearer;
+            }
+        return ret;
+        }
+
+    if ( KWlanScanCacheLifetime == attribute )
+        {
+        // Check WLAN support for the given id
+        ret = WlanSupportCheck( connectionId );
+        if ( KErrNone == ret )
+            {
+            ret = iWlanSupport->GetIntAttributeL( aMessage, aValue );
+            }
+        return ret;
+        }
+
+    // Handle requests that use a bearer specific connection IDs
+    if ( ( connectionId == EBearerIdGPRS || connectionId == EBearerIdWCDMA ) &&
+         ( attribute == KNetworkStatus ) )
+        {
+        return ( GetPsdNetworkStatus( aValue ) );
+        }
+    else if ( ( connectionId == EBearerIdGPRS || connectionId == EBearerIdWCDMA ||
+                connectionId == EBearerIdCSD || connectionId == EBearerIdGSM ||
+                connectionId == EBearerIdWcdmaCSD )
+                && ( attribute == KNetworkRegistration ) )
+        {
+        return ( GetNetworkRegistration( aValue ) );
+        }
+    else if ( ( connectionId == EBearerIdGPRS || connectionId == EBearerIdWCDMA ||
+                connectionId == EBearerIdCSD || connectionId == EBearerIdGSM ||
+                connectionId == EBearerIdWcdmaCSD )
+                && ( attribute == KNetworkRegistration_v2 ) )
+        {
+        return ( GetNetworkRegistration_v2( aValue ) );
+        }
+    else if ( ( connectionId == EBearerIdGPRS || connectionId == EBearerIdWCDMA ||
+                connectionId == EBearerIdCSD || connectionId == EBearerIdGSM ||
+                connectionId == EBearerIdWcdmaCSD )
+                && ( attribute == KSignalStrength ) )
+        {
+        return ( GetGSMSignalStrength( aValue ) );
+        }
+    else if ( connectionId == EBearerIdWLAN && attribute == KSignalStrength )
+        {
+        if ( iWlanSupport )
+            {
+            ret = iWlanSupport->GetSignalStrengthL( aMessage, aValue );
+            }
+        else
+            {
+            ret = KErrNotSupported;
+            }
+        return ret;
+        }
+    else if ( ( connectionId == EBearerIdGPRS ) && ( attribute == KBearer ) )
+        {
+        // Check which is the bearer of the GPRS cell.
+        if ( IsEdgeCell() )
+            {
+            aValue = EBearerEdgeGPRS;
+            }
+        else
+            {
+            aValue = EBearerGPRS;
+            }
+        return KErrNone;
+        }
+
+    // Find connection matching the given Id
+    TInt index = Index( connectionId );
+    if ( index < 0  )
+        {
+        return KErrNotFound;
+        }
+
+    LOGIT1("SERVER: CConnMonIAP::GetIntAttributeL(): index %d", index)
+
+    // Find out bearer if not already set.
+    if ( iConnInfos[index].iBearer == EBearerUnknown )
+        {
+        ret = GetBearer(
+                connectionId,
+                iConnInfos[index].iBearer,
+                iConnInfos[index].iBearerInfo );
+
+        if ( ret != KErrNone )
+            {
+            LOGIT1("SERVER: CConnMonIAP::GetIntAttributeL(): Error getting bearer info for connection <%d>", ret)
+            return ret;
+            }
+        LOGIT1("SERVER: CConnMonIAP::GetIntAttributeL(): bearer was unknown, now %d", iConnInfos[index].iBearer)
+        }
+
+    switch ( attribute )
+        {
+        case KBearer:
+            {
+            // BEARER
+            LOGIT1("SERVER: CConnMonIAP::GetIntAttributeL(): case KBearer, bearer %d", iConnInfos[index].iBearer)
+            // Bearer is never unknown for the external connections
+            // but sometimes it is not valid (e.g. CSD/HSCSD) until
+            // connection reaches certain status.
+            if ( ( iConnInfos[index].iBearer == EBearerExternalCSD ) ||
+                 ( iConnInfos[index].iBearer == EBearerExternalHSCSD ) ||
+                 ( iConnInfos[index].iBearer == EBearerExternalWcdmaCSD ) )
+                {
+                if ( iCsdFax )
+                    {
+                    iCsdFax->GetBearer( iConnInfos[index].iBearer, iConnInfos[index].iBearerInfo );
+                    }
+                }
+            else if ( ( iConnInfos[index].iBearer == EBearerExternalGPRS ) ||
+                      ( iConnInfos[index].iBearer == EBearerExternalEdgeGPRS ) ||
+                      ( iConnInfos[index].iBearer == EBearerExternalWCDMA ) )
+                {
+                if ( iPsdFax )
+                    {
+                    iPsdFax->GetBearer( iConnInfos[index].iBearer, iConnInfos[index].iBearerInfo );
+                    }
+                }
+            else if ( iConnInfos[index].iBearer < EBearerExternalCSD )
+                {
+                // CSD/HSCSD info could change after the first query
+                // also GPRS/EdgeGPRS/WCDMA info can change
+                TInt bearer( EBearerUnknown );
+                TBearerInfo bearerInfo;
+
+                ret = GetBearer( connectionId, bearer, bearerInfo );
+                if ( iConnInfos[index].iBearer != bearer )
+                    {
+                    LOGIT4("Bearer changed: id %d, iapId %d, old bearer %d, new bearer %d",
+                            iConnInfos[index].iConnectionId, iConnInfos[index].iIapId,
+                            iConnInfos[index].iBearer, bearer)
+                    }
+
+                if ( ( bearer != EBearerUnknown && bearerInfo.iBearer != EBearerInfoUnknown )
+                     && ( ret == KErrNone ) )
+                    {
+                    iConnInfos[index].iBearer = bearer;
+                    iConnInfos[index].iBearerInfo = bearerInfo;
+                    }
+                }
+            aValue = iConnInfos[index].iBearer;
+            }
+            break;
+
+        case KNetworkStatus:
+            {
+            // NETWORK STATUS
+            if ( iConnInfos[index].iBearer == EBearerGPRS ||
+                 iConnInfos[index].iBearer == EBearerEdgeGPRS ||
+                 iConnInfos[index].iBearer == EBearerWCDMA ||
+                 iConnInfos[index].iBearer == EBearerCDMA2000 ||
+                 iConnInfos[index].iBearer == EBearerExternalGPRS ||
+                 iConnInfos[index].iBearer == EBearerExternalEdgeGPRS ||
+                 iConnInfos[index].iBearer == EBearerExternalWCDMA ||
+                 iConnInfos[index].iBearer == EBearerExternalCDMA2000 )
+                {
+                // psd
+                ret = GetPsdNetworkStatus( aValue );
+                }
+            else if ( iConnInfos[index].iBearer == EBearerUnknown )
+                {
+                 // GetBearer() : iMobilePhone.GetCurrentMode()
+                 // is not always working for PSD when starting the first
+                 // connection. So this must be some PSD...
+                ret = GetPsdNetworkStatus( aValue );
+                }
+            else
+                {
+                // Others not supported at the moment
+                aValue = EConnMonStatusNotAvailable;
+                ret = KErrNone;
+                }
+            }
+            break;
+
+        case KConnectionStatus:
+            {
+            // CONNECTION STATUS
+            if ( iConnInfos[index].iBearer < EBearerExternalCSD )
+                {
+                // Internal connections
+                ret = GetConnectionStatus( index, aValue );
+                }
+            else if ( iConnInfos[index].iBearer == EBearerExternalCSD ||
+                      iConnInfos[index].iBearer == EBearerExternalHSCSD ||
+                      iConnInfos[index].iBearer == EBearerExternalWcdmaCSD )
+                {
+                // External csd
+                if ( iCsdFax )
+                    {
+                    ret = iCsdFax->GetStatus( aValue );
+                    }
+                else
+                    {
+                    ret = KErrNotFound;
+                    }
+                }
+            else
+                {
+                // External psd
+                if ( iPsdFax )
+                    {
+                    ret = iPsdFax->GetStatus( connectionId, aValue );
+                    }
+                else
+                    {
+                    ret = KErrNotFound;
+                    }
+                }
+            }
+            break;
+
+        case KProtocolType:
+            {
+            // PROTOCOL TYPE
+            if ( iConnInfos[index].iBearer == EBearerGPRS ||
+                 iConnInfos[index].iBearer == EBearerEdgeGPRS ||
+                 iConnInfos[index].iBearer == EBearerWCDMA )
+                {
+                ret = GetProtocolTypeL( connectionId, aValue );
+                }
+            else if ( iConnInfos[index].iBearer == EBearerExternalGPRS ||
+                      iConnInfos[index].iBearer == EBearerExternalEdgeGPRS ||
+                      iConnInfos[index].iBearer == EBearerExternalWCDMA )
+                {
+                if ( iPsdFax )
+                    {
+                    ret = iPsdFax->GetProtocolType( connectionId, aValue );
+                    }
+                else
+                    {
+                    ret = KErrNotFound;
+                    }
+                }
+            else
+                {
+                aValue = EProtocolTypeUnknown;
+                }
+            }
+            break;
+
+        case KNetworkRegistration:
+            {
+            // NETWORK REGISTRATION STATUS
+            if ( iConnInfos[index].iBearer == EBearerGPRS ||
+                 iConnInfos[index].iBearer == EBearerEdgeGPRS ||
+                 iConnInfos[index].iBearer == EBearerWCDMA ||
+                 iConnInfos[index].iBearer == EBearerCSD ||
+                 iConnInfos[index].iBearer == EBearerHSCSD ||
+                 iConnInfos[index].iBearer == EBearerWcdmaCSD ||
+                 iConnInfos[index].iBearer == EBearerExternalGPRS ||
+                 iConnInfos[index].iBearer == EBearerExternalEdgeGPRS ||
+                 iConnInfos[index].iBearer == EBearerExternalWCDMA ||
+                 iConnInfos[index].iBearer == EBearerExternalCSD ||
+                 iConnInfos[index].iBearer == EBearerExternalHSCSD ||
+                 iConnInfos[index].iBearer == EBearerExternalWcdmaCSD )
+                {
+                ret = GetNetworkRegistration( aValue );
+                }
+            else
+                {
+                aValue = ENetworkRegistrationNotAvailable;
+                ret = KErrNone;
+                }
+            }
+            break;
+        case KNetworkRegistration_v2:
+            {
+            // NETWORK REGISTRATION STATUS
+            if ( iConnInfos[index].iBearer == EBearerGPRS ||
+                 iConnInfos[index].iBearer == EBearerEdgeGPRS ||
+                 iConnInfos[index].iBearer == EBearerWCDMA ||
+                 iConnInfos[index].iBearer == EBearerCSD ||
+                 iConnInfos[index].iBearer == EBearerHSCSD ||
+                 iConnInfos[index].iBearer == EBearerWcdmaCSD ||
+                 iConnInfos[index].iBearer == EBearerExternalGPRS ||
+                 iConnInfos[index].iBearer == EBearerExternalEdgeGPRS ||
+                 iConnInfos[index].iBearer == EBearerExternalWCDMA ||
+                 iConnInfos[index].iBearer == EBearerExternalCSD ||
+                 iConnInfos[index].iBearer == EBearerExternalHSCSD ||
+                 iConnInfos[index].iBearer == EBearerExternalWcdmaCSD )
+                {
+                ret = GetNetworkRegistration_v2( aValue );
+                }
+            else
+                {
+                aValue = ENetworkRegistrationNotAvailable;
+                ret = KErrNone;
+                }
+            }
+            break;
+        case KSignalStrength:
+            {
+            // SIGNAL STRENGTH
+            ret = KErrNotSupported;
+            if ( iConnInfos[index].iBearer == EBearerGPRS ||
+                 iConnInfos[index].iBearer == EBearerEdgeGPRS ||
+                 iConnInfos[index].iBearer == EBearerWCDMA ||
+                 iConnInfos[index].iBearer == EBearerCSD ||
+                 iConnInfos[index].iBearer == EBearerHSCSD ||
+                 iConnInfos[index].iBearer == EBearerWcdmaCSD ||
+                 iConnInfos[index].iBearer == EBearerExternalGPRS ||
+                 iConnInfos[index].iBearer == EBearerExternalEdgeGPRS ||
+                 iConnInfos[index].iBearer == EBearerExternalWCDMA ||
+                 iConnInfos[index].iBearer == EBearerExternalCSD ||
+                 iConnInfos[index].iBearer == EBearerExternalHSCSD ||
+                 iConnInfos[index].iBearer == EBearerExternalWcdmaCSD )
+                {
+                ret = GetGSMSignalStrength( aValue );
+                }
+            else if ( iConnInfos[index].iBearer == EBearerWLAN )
+                {
+                if ( iWlanSupport )
+                    {
+                    ret = iWlanSupport->GetSignalStrengthL( aMessage, aValue );
+                    }
+                }
+            }
+            break;
+
+        case KNetworkMode:
+            // NETWORK MODE
+            ret = KErrNotSupported;
+            if ( iConnInfos[index].iBearer == EBearerWLAN )
+                {
+                if ( iWlanSupport )
+                    {
+                    ret = iWlanSupport->GetConnectionMode( aValue );
+                    }
+                }
+            break;
+
+        case KSecurityMode:
+            // SECURITY MODE
+            ret = KErrNotSupported;
+            if ( iConnInfos[index].iBearer == EBearerWLAN )
+                {
+                if ( iWlanSupport )
+                    {
+                    ret = iWlanSupport->GetConnectionSecurity( aValue );
+                    }
+                }
+            break;
+
+        case KTrafficClass:
+            ret = KErrNotSupported;
+            break;
+        case KDeliveryOrder:
+            ret = KErrNotSupported;
+            break;
+        case KErroneousSDUDelivery:
+            ret = KErrNotSupported;
+            break;
+        case KResidualBitErrorRatio:
+            ret = KErrNotSupported;
+            break;
+        case KSDUErrorRatio:
+            ret = KErrNotSupported;
+            break;
+        default:
+            ret = KErrArgument;
+            break;
+        }
+
+    LOGEXITFN1("CConnMonIAP::GetIntAttributeL()", ret)
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonIAP::GetBearerInfo
+// Returns the integer attribute in aValue
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonIAP::GetBearerInfo( const TUint aConnectionId, TBearerInfo& aBearerInfo )
+    {
+    LOGENTRFN("CConnMonIAP::GetBearerInfo()")
+    TInt err( KErrNone );
+
+    // Find connection matching the given Id
+    TInt index = Index( aConnectionId );
+    if ( index < 0  )
+        {
+        err = KErrNotFound;
+        }
+    else
+        {
+        // Find out bearer if not already set. This can be only with internal
+        // connections.
+        if ( iConnInfos[index].iBearerInfo.iBearer == EBearerInfoUnknown )
+            {
+            LOGIT("GetBearerInfo: EBearerInfoUnknown")
+            err = GetBearer(
+                    aConnectionId,
+                    iConnInfos[index].iBearer,
+                    iConnInfos[index].iBearerInfo );
+            }
+        if ( KErrNone == err )
+            {
+            // Bearer is never unknown for the external connections but
+            // sometimes it is not valid (e.g. CSD/HSCSD) until connection
+            // reaches certain status.
+            if ( !iConnInfos[index].iBearerInfo.iInternal &&
+                    ( iConnInfos[index].iBearerInfo.iBearer == EBearerInfoCSD ||
+                    iConnInfos[index].iBearerInfo.iBearer == EBearerInfoHSCSD ||
+                    iConnInfos[index].iBearerInfo.iBearer == EBearerInfoWcdmaCSD ) )
+                {
+                if ( iCsdFax )
+                    {
+                    LOGIT("GetBearerInfo: case iCsdFax")
+                    err = iCsdFax->GetBearer(
+                            iConnInfos[index].iBearer,
+                            iConnInfos[index].iBearerInfo );
+                    }
+                }
+            else if ( !iConnInfos[index].iBearerInfo.iInternal &&
+                    ( iConnInfos[index].iBearerInfo.iBearer == EBearerInfoGPRS ||
+                    iConnInfos[index].iBearerInfo.iBearer == EBearerInfoEdgeGPRS ||
+                    iConnInfos[index].iBearerInfo.iBearer == EBearerInfoWCDMA ||
+                    iConnInfos[index].iBearerInfo.iBearer == EBearerInfoHSDPA ||
+                    iConnInfos[index].iBearerInfo.iBearer == EBearerInfoHSUPA ||
+                    iConnInfos[index].iBearerInfo.iBearer == EBearerInfoHSxPA ) )
+                {
+                if ( iPsdFax )
+                    {
+                    LOGIT("GetBearerInfo: case iPsdFax")
+                    err = iPsdFax->GetBearer(
+                            iConnInfos[index].iBearer,
+                            iConnInfos[index].iBearerInfo );
+                    }
+                }
+            else if ( iConnInfos[index].iBearerInfo.iInternal &&
+                    ( iConnInfos[index].iBearerInfo.iBearer == EBearerInfoCSD ||
+                    iConnInfos[index].iBearerInfo.iBearer == EBearerInfoHSCSD ||
+                    iConnInfos[index].iBearerInfo.iBearer == EBearerInfoGPRS ||
+                    iConnInfos[index].iBearerInfo.iBearer == EBearerInfoEdgeGPRS ||
+                    iConnInfos[index].iBearerInfo.iBearer == EBearerInfoWCDMA ||
+                    iConnInfos[index].iBearerInfo.iBearer == EBearerInfoHSDPA ||
+                    iConnInfos[index].iBearerInfo.iBearer == EBearerInfoHSUPA ||
+                    iConnInfos[index].iBearerInfo.iBearer == EBearerInfoHSxPA ) )
+                {
+                // CSD/HSCSD info could change after the first query also
+                // GPRS/EdgeGPRS/WCDMA info can change.
+                TInt bearer( EBearerUnknown );
+                TBearerInfo bearerInfo;
+
+                LOGIT("GetBearerInfo: GetBearer() 2nd query")
+                err = GetBearer( aConnectionId, bearer, bearerInfo );
+                if ( ( KErrNone == err ) && ( bearerInfo.iBearer != EBearerInfoUnknown ) )
+                    {
+                    iConnInfos[index].iBearer = bearer;
+                    iConnInfos[index].iBearerInfo = bearerInfo;
+                    }
+                }
+            }
+        if ( KErrNone == err )
+            {
+            aBearerInfo.iBearer = iConnInfos[index].iBearerInfo.iBearer;
+            aBearerInfo.iInternal = iConnInfos[index].iBearerInfo.iInternal;
+            LOGIT2("GetBearerInfo: result: bearer %d, internal %d", aBearerInfo.iBearer, aBearerInfo.iInternal)
+            }
+        }
+
+    LOGEXITFN1("CConnMonIAP::GetBearerInfo()", err)
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonIAP::GetUintAttributeL
+// Returns the unsigned integer attribute in aValue
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonIAP::GetUintAttributeL( const RMessage2& aMessage, TUint& aValue )
+    {
+    LOGENTRFN("CConnMonIAP::GetUintAttributeL()")
+    TInt err( KErrNone );
+    TUint connectionId( aMessage.Int0() );
+    TUint attribute( aMessage.Int2() );
+
+    LOGIT2("SERVER: CConnMonIAP::GetUintAttributeL: connId %d, attribute %d", connectionId, attribute)
+
+    // Find connection matching the given ID
+    TInt index = Index( connectionId );
+    if ( index < 0 )
+        {
+        LOGEXITFN1("CConnMonIAP::GetUintAttributeL()", KErrNotFound)
+        return KErrNotFound;
+        }
+
+    switch ( attribute )
+        {
+        case KIAPId:
+            {
+            err = KErrNotSupported;
+            if ( iConnInfos[index].iBearer < EBearerExternalCSD &&
+                    iConnInfos[index].iBearerInfo.iInternal )
+                {
+                err = KErrNone;
+                aValue = iConnInfos[index].iIapId;
+                LOGIT1("GetUintAttributeL: iap id %d", aValue)
+                }
+            }
+            break;
+
+        case KNetworkIdentifier:
+            {
+            err = KErrNotSupported;
+            if ( iConnInfos[index].iBearer < EBearerExternalCSD &&
+                    iConnInfos[index].iBearerInfo.iInternal )
+                {
+                err = KErrNone;
+                aValue = iConnInfos[index].iNetId;
+                LOGIT1("GetUintAttributeL: net id %d", aValue)
+                }
+            }
+            break;
+
+        case KDownlinkData:
+        case KUplinkData:
+            {
+            if ( iConnInfos[index].iBearer < EBearerExternalCSD &&
+                    iConnInfos[index].iBearerInfo.iInternal )
+                {
+                // INTERNAL
+                // Query data volumes asyncronously
+                if ( !iConnInfos[index].iDataVolumeAO )
+                    {
+                    // Create an active object and add it to scheduler
+                    iConnInfos[index].iDataVolumeAO = new( ELeave ) CDataVolume(
+                            iServer,
+                            iConnInfos[index].iConnAttach,
+                            iConnInfos[index].iConnectionId );
+
+                    iConnInfos[index].iDataVolumeAO->Construct();
+                    }
+                if ( !iConnInfos[index].iDataVolumeAO->IsActive() )
+                    {
+                    iConnInfos[index].iDataVolumeAO->Receive(); // start a new request
+                    }
+                // Don't complete this request yet
+                err = KRequestPending;
+                }
+
+            else if ( iConnInfos[index].iBearer == EBearerExternalGPRS     ||
+                      iConnInfos[index].iBearer == EBearerExternalEdgeGPRS ||
+                      iConnInfos[index].iBearer == EBearerExternalWCDMA    ||
+                      iConnInfos[index].iBearer == EBearerExternalCDMA2000 ||
+                      ( !iConnInfos[index].iBearerInfo.iInternal &&
+                        ( iConnInfos[index].iBearerInfo.iBearer == EBearerInfoHSDPA ||
+                          iConnInfos[index].iBearerInfo.iBearer == EBearerInfoHSUPA ||
+                          iConnInfos[index].iBearerInfo.iBearer == EBearerInfoHSxPA ) ) )
+                {
+                // EXTERNAL PSD
+                if ( iPsdFax )
+                    {
+                    TUint down( 0 );
+                    TUint up( 0 );
+                    err = iPsdFax->GetDataVolumes( connectionId, down, up );
+                    if ( KErrNone == err )
+                        {
+                        if ( attribute == KDownlinkData )
+                            {
+                            aValue = down;
+                            }
+                        else
+                            {
+                            aValue = up;
+                            }
+                        }
+                    }
+                else
+                    {
+                    err = KErrNotFound;
+                    }
+                }
+
+            else
+                {
+                // EXTERNAL CSD
+                err = KErrNotSupported;
+                }
+            }
+            break;
+
+        case KTransmitPower:
+            {
+            err = KErrNotSupported;
+            if ( iConnInfos[index].iBearer == EBearerWLAN && iWlanSupport )
+                {
+                err = iWlanSupport->GetTransmitPower( aValue );
+                LOGIT1("GetUintAttributeL: transmit power %d", aValue)
+                }
+            }
+            break;
+
+        case KMaximumBitrateDownlink:
+        case KMaximumBitrateUplink:
+        case KMaximumSDUSize:
+        case KTransferDelay:
+        case KGuaranteedBitrateDownlink:
+        case KGuaranteedBitrateUplink:
+        case KTrafficHandlingPriority:
+            err = KErrNotSupported;
+            break;
+
+        default:
+            err = KErrArgument;
+            break;
+        }
+
+    LOGEXITFN1("CConnMonIAP::GetUintAttributeL()", err)
+    return err;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CConnMonIAP::GetBoolAttributeL
+// Returns the TBool attribute in aValue
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonIAP::GetBoolAttributeL( const RMessage2& aMessage, TBool& aValue )
+    {
+    LOGENTRFN("CConnMonIAP::GetBoolAttributeL()")
+    TInt err( KErrNone );
+    TUint connectionId( aMessage.Int0() );
+    TUint attribute( aMessage.Int2() );
+
+    switch ( attribute )
+        {
+        case KConnectionActive:
+            {
+            // Find connection matching the given ID
+            TInt index = Index( connectionId );
+            if ( index < 0  )
+                {
+                LOGIT("GetBoolAttributeL: connection id not found")
+                err = KErrNotFound;
+                break;
+                }
+            if ( iConnInfos[index].iBearer < EBearerExternalCSD &&
+                    iConnInfos[index].iBearerInfo.iInternal )
+                {
+                TInt connectionStatus( 0 );
+                GetConnectionStatus( index, connectionStatus );
+                LOGIT1("GetBoolAttributeL: connection status %d", connectionStatus)
+
+                if ( connectionStatus != KLinkLayerOpen )
+                    {
+                    aValue = EFalse;
+                    break;
+                    }
+                if ( ( iCountListeners > 0 ) && ( iConnInfos[index].iActivityNotifier != 0 ) )
+                    {
+                    if ( iConnInfos[index].iActivityNotifier->IsActive() )
+                        {
+                        // Notifications are ON and are updating the activity info.
+                        // Return the info immediately from internal table
+                        if ( iConnInfos[index].iActivity == 0 )
+                            {
+                            aValue = EFalse;
+                            }
+                        else
+                            {
+                            aValue = ETrue;
+                            }
+                        }
+                    else
+                        {
+                        GetActivityOneShotL( index );
+                        err = KRequestPending;
+                        }
+                    }
+                else
+                    {
+                    // Notifications are OFF
+                    GetActivityOneShotL( index );
+                    err = KRequestPending;
+                    }
+                }
+            else
+                {
+                err = KErrNotSupported;
+                }
+            }
+            break;
+
+        case KBearerAvailability:
+            {
+            TUint bearer( EBearerIdAll );
+            err = BearerIdForBearerAvailability( connectionId, bearer );
+            if ( KErrNone == err )
+                {
+                if ( bearer == EBearerIdWLAN )
+                    {
+                    if ( iWlanSupport )
+                        {
+                        err = iWlanSupport->GetBearerAvailabilityL( aMessage, aValue );
+                        }
+                    else
+                        {
+                        err = KErrNotSupported;
+                        }
+                    }
+                else
+                    {
+                    TBool byCell( EFalse );
+                    TBool byPhone( EFalse );
+                    err = GetBearerSupportInfo( bearer, byCell, byPhone );
+                    if ( byCell && byPhone )
+                        {
+                        aValue = ETrue;
+                        }
+                    else
+                        {
+                        aValue = EFalse;
+                        }
+                    }
+                }
+            }
+            break;
+
+        case KPacketDataAvailability:
+            {
+            if ( connectionId != EBearerIdGPRS && connectionId != EBearerIdWCDMA )
+                {
+                err = KErrNotSupported;
+                }
+            else
+                {
+                // When not in dual mode and call is active, gprs and wcdma bearers are unavailable
+                // Note that even the WCDMA can be unavailable, if the phone doesn't support DTM
+                if ( iTelephonyNotifier && iDualTransferModeNotifier &&
+                        iTelephonyNotifier->IsCallActive() &&
+                        !iDualTransferModeNotifier->IsInDualMode() )
+                    {
+                    LOGIT("SERVER: Packet data UNAVAILABLE (2G&3G), no DTM and call is active")
+                    aValue = EFalse;
+                    }
+                // If DTM status says available, lets check the availability of the bearer.
+                // This is done because the DTM status remains as it was if the psd link is broken.
+                // So there might be a situation where the notifier says we are in dual mode even
+                // though the whole bearer is unavailable
+                else
+                    {
+                    TBool byPhone( EFalse );
+                    TBool byCell( EFalse );
+                    err = GetBearerSupportInfo( connectionId, byCell, byPhone );
+                    LOGIT4("Bearer support: bearer %d, byCell %d, byPhone %d, err <%d>", connectionId, byCell, byPhone, err)
+                    aValue = ETrue;
+                    if ( KErrNone == err )
+                        {
+                        if ( byCell && byPhone )
+                            {
+                            LOGIT("SERVER: Packet data AVAILABLE, DTM or no call is active")
+                            }
+                        else
+                            {
+                            LOGIT("SERVER: Packet data UNAVAILABLE, no bearer")
+                            aValue = EFalse;
+                            }
+                        }
+                    }
+                }
+            }
+            break;
+
+        default:
+            // Unknown attribute
+            err = KErrArgument;
+            break;
+        }
+
+    LOGEXITFN1("CConnMonIAP::GetBoolAttributeL()", err)
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonIAP::GetStringAttribute
+// Returns the TDes attribute in aValue
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonIAP::GetStringAttribute( const RMessage2& aMessage, TDes& aValue )
+    {
+    LOGENTRFN("CConnMonIAP::GetStringAttribute()")
+    TInt err( KErrNone );
+    TUint connectionId( aMessage.Int0() );
+    TUint attribute( aMessage.Int2() );
+
+    // Find connection matching the given ID
+    TInt index = Index( connectionId );
+    if ( index < 0  )
+        {
+        LOGEXITFN1("CConnMonIAP::GetStringAttribute()", KErrNotFound)
+        return KErrNotFound;
+        }
+
+    // Find out bearer if not already set
+    if ( iConnInfos[index].iBearer == EBearerUnknown )
+        {
+        err = GetBearer( connectionId, iConnInfos[index].iBearer, iConnInfos[index].iBearerInfo );
+        if ( KErrNone != err )
+            {
+            LOGEXITFN1("CConnMonIAP::GetStringAttribute()", err)
+            return err;
+            }
+        }
+
+    switch ( attribute )
+        {
+        case KIAPName:
+            {
+            // From RConnection
+            if ( iConnInfos[index].iBearer >= EBearerExternalCSD &&
+                    !iConnInfos[index].iBearerInfo.iInternal )
+                {
+                err = KErrNotSupported;
+                }
+            else
+                {
+                TBuf<KCommsDbSvrMaxFieldLength> settingName;
+                settingName.Copy( TPtrC( IAP ) );
+                settingName.Append( TChar( '\\' ) );
+                settingName.Append( TPtrC( COMMDB_NAME ) );
+                // IAP name max. length in commsdat should be 50
+                err = iConnInfos[index].iConnAttach->GetDesSetting( TPtrC( settingName ), aValue );
+                }
+            }
+            break;
+
+        case KAccessPointName:
+            {
+            if ( iConnInfos[index].iBearer < EBearerExternalCSD )
+                {
+                err = GetAccessPointName( iConnInfos[index].iConnectionId, aValue );
+                }
+            else if ( iConnInfos[index].iBearer == EBearerExternalGPRS ||
+                    iConnInfos[index].iBearer == EBearerExternalEdgeGPRS ||
+                    iConnInfos[index].iBearer == EBearerExternalWCDMA ||
+                    ( !iConnInfos[index].iBearerInfo.iInternal &&
+                            ( iConnInfos[index].iBearerInfo.iBearer == EBearerInfoHSDPA ||
+                                    iConnInfos[index].iBearerInfo.iBearer == EBearerInfoHSUPA ||
+                                    iConnInfos[index].iBearerInfo.iBearer == EBearerInfoHSxPA ) ) )
+                {
+                if ( iPsdFax )
+                    {
+                    err = iPsdFax->GetApn( connectionId, aValue );
+                    }
+                else
+                    {
+                    err = KErrNotFound;
+                    }
+                }
+            else
+                {
+                err = KErrNotSupported;
+                }
+            }
+            break;
+
+        case KTelNumber:
+            {
+            if ( iConnInfos[index].iBearer < EBearerExternalCSD )
+                {
+                err = GetTelNumber( iConnInfos[index].iConnectionId, aValue );
+                }
+            else if ( iConnInfos[index].iBearer == EBearerExternalCSD ||
+                    iConnInfos[index].iBearer == EBearerExternalHSCSD ||
+                    iConnInfos[index].iBearer == EBearerExternalWcdmaCSD )
+                {
+                if ( iCsdFax )
+                    {
+                    err = iCsdFax->GetTelNumber( aValue );
+                    }
+                else
+                    {
+                    err = KErrNotFound;
+                    }
+                }
+            else
+                {
+                err = KErrNotSupported;
+                }
+            }
+            break;
+
+        case KNetworkName:
+            {
+            err = KErrNotSupported;
+            if ( iConnInfos[index].iBearer == EBearerWLAN )
+                {
+                if ( iWlanSupport )
+                    {
+                    // Max SSID length is 32
+                    err = iWlanSupport->GetConnectionSsid( aValue );
+                    }
+                }
+            }
+            break;
+
+        default:
+            err = KErrArgument;
+            break;
+        }
+
+    LOGEXITFN1("CConnMonIAP::GetStringAttribute()", err)
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonIAP::GetUids
+// RConnection::EnumerateConnections() must be called to get the right
+// RConnection index for the connection (iConnInfos can't be trusted because
+// connections are added by events, too).
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonIAP::GetUids(
+        const TUint aConnectionId,
+        TConnMonClientEnum& aClientEnum )
+    {
+    TInt                     err( KErrNone );
+    TConnEnumArgBuf          enumArgBuf;
+    TConnGetClientInfoArgBuf clientInfoBuf;
+    TUint                    count( 0 );
+    TConnectionInfoBuf       connInfoBuf;
+    TUint                    j;
+
+    // Find connection matching the given Id
+    TInt index = Index( aConnectionId );
+
+    if ( index < 0  )
+        {
+        return KErrNotFound;
+        }
+
+    // Uids are not available for external connections
+    if ( iConnInfos[index].iBearer >= EBearerExternalCSD &&
+         !iConnInfos[index].iBearerInfo.iInternal )
+        {
+        return KErrNotSupported;
+        }
+
+    // Get RConnection index for the connection
+    err = iConnection.EnumerateConnections( count );
+
+    if ( err != KErrNone )
+        {
+        return( err );
+        }
+
+    for ( j = 1; j <= count; j++ )
+        {
+        err = iConnection.GetConnectionInfo( j, connInfoBuf );
+
+        if ( err != KErrNone )
+            {
+            return( err );
+            }
+
+        if ( ( iConnInfos[index].iIapId == connInfoBuf().iIapId ) &&
+                ( iConnInfos[index].iNetId == connInfoBuf().iNetId ) )
+            {
+            break;
+            }
+        }
+
+    // If connection does not exist anymore
+    if ( j > count )
+        {
+        return KErrNotFound;
+        }
+
+    enumArgBuf().iIndex = j;
+
+    // Get the number of clients
+    err = iConnection.Control( KCOLConnection, KCoEnumerateConnectionClients, enumArgBuf );
+
+    if ( err != KErrNone )
+        {
+        return err;
+        }
+
+    aClientEnum.iCount = enumArgBuf().iCount;
+
+    // Count connection monitor OUT of the number of clients
+    if ( aClientEnum.iCount > 0 )
+        {
+        --aClientEnum.iCount;
+        }
+
+    // Get client uids one by one
+    // Note. in WINS uids are zero.
+    TInt k( 0 );
+
+    for ( TUint i = 1; i <= enumArgBuf().iCount; i++ )
+        {
+        clientInfoBuf().iIndex = i;
+
+        err = iConnection.Control( KCOLConnection, KCoGetConnectionClientInfo, clientInfoBuf );
+
+        if ( err != KErrNone )
+            {
+            return err;
+            }
+
+        // Exclude Connection Monitor UID
+        if ( ( clientInfoBuf().iClientInfo.iUid.iUid != KConnMonDllUid.iUid ) &&
+             ( clientInfoBuf().iClientInfo.iUid.iUid != KGenericDllUid.iUid ) &&
+             ( clientInfoBuf().iClientInfo.iUid.iUid != KConnMonServerUid.iUid ) &&
+             ( clientInfoBuf().iClientInfo.iUid.iUid != 0 ) )
+            {
+            TInt m( 0 );
+
+            // Look for duplicates
+            for ( m = 0; m < k; m++ )
+                {
+                if ( aClientEnum.iUid[m].iUid == clientInfoBuf().iClientInfo.iUid.iUid )
+                    {
+                    break;
+                    }
+                }
+
+            if ( m == k )
+                {
+                // This is a new unique ID
+                aClientEnum.iUid[k].iUid = clientInfoBuf().iClientInfo.iUid.iUid;
+                k++;
+                }
+            else
+                {
+                // Duplicate
+                --aClientEnum.iCount;
+                }
+            }
+        }
+
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonIAP::SetUintAttribute
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonIAP::SetUintAttribute(
+        const RMessage2& /*aMessage*/,
+        const TUint /*aValue*/ )
+    {
+    return KErrNotSupported;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonIAP::SetBoolAttributeL
+// Used for stopping the connections.
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonIAP::SetBoolAttribute( const RMessage2& aMessage )
+    {
+    LOGENTRFN("CConnMonIAP::SetBoolAttribute()")
+    TInt err( KErrNone );
+    TUint attribute( aMessage.Int2() );
+    TBool value( aMessage.Int3() );
+
+    switch ( attribute )
+        {
+        case KConnectionStop:
+            if ( value )
+                {
+                // Find connection matching the given Id
+                TInt index = Index( aMessage.Int0() );
+                if ( index < 0  )
+                    {
+                    err = KErrNotFound;
+                    }
+                else
+                    {
+                    err = StopConnection( index );
+                    if ( KErrCouldNotConnect == err )
+                        {
+                        err = KErrNotFound;
+                        }
+                    }
+                }
+            break;
+
+        case KConnectionStopAll:
+            if ( value )
+                {
+                TUint i( 0 );
+                TUint count( 0 );
+                TUint newCount( 0 );
+
+                // Refresh array
+                err = EnumerateConnections( count );
+                LOGIT2("SetBoolAttribute: KConnectionStopAll: Enumerated all connections, count %d <%d>", count, err)
+                if ( KErrNone == err )
+                    {
+                    while ( count > 0 && i < count )
+                        {
+                        // Stop (and remove if up/down event watcher is dead) the connection
+                        err = StopConnection( i );
+                        if ( KErrNone != err )
+                            {
+                            LOGIT2("SetBoolAttribute: KConnectionStopAll: Error stopping connection %d <%d>", i, err)
+                            return err;
+                            }
+                        newCount = iConnInfos.Count();
+                        if ( count > newCount )
+                            {
+                            count = newCount; // Connection has been removed
+                            }
+                        else
+                            {
+                            i++; // Cconnection has not been removed, increment index to next connection
+                            }
+                        }
+                    }
+                }
+            break;
+
+        default:
+            err = KErrArgument;
+            break;
+        }
+
+    LOGEXITFN1("CConnMonIAP::SetBoolAttribute()", err)
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonIAP::SetStringAttributeL
+//
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonIAP::SetStringAttributeL(
+        const RMessage2& /*aMessage*/,
+        const TDes& /*aValue*/ )
+    {
+    return KErrNotSupported;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CConnMonIAP::ListenL
+// Starts event watchers.
+// -----------------------------------------------------------------------------
+//
+void CConnMonIAP::ListenL()
+    {
+    LOGIT(".")
+    LOGENTRFN("CConnMonIAP::ListenL()")
+    iCountListeners++;
+
+    // GLOBAL notifiers
+
+    // Connection Up/Down events
+    if ( iConnUpDownNotifier == 0 )
+        {
+        iConnUpDownNotifier = new( ELeave ) CConnUpDownNotifier( iServer );
+        iConnUpDownNotifier->Construct();
+        }
+    if ( !iConnUpDownNotifier->IsActive() )
+        {
+        iConnUpDownNotifier->Receive(); // (re)start listening
+        }
+
+    if ( iTSYLoaded && iPacketServLoaded )
+        {
+        // PSD network status events
+        if ( iPsdNetwStatusNotifier == 0 )
+            {
+            iPsdNetwStatusNotifier = CNetwStatusNotifier::NewL( iServer );
+            }
+        if ( !iPsdNetwStatusNotifier->IsActive() )
+            {
+            iPsdNetwStatusNotifier->Receive(); // (re)start listening
+            }
+
+        // GPRS bearer availability changed events
+        if ( iGSMBearerAvailabilityNotifier == 0 )
+            {
+            iGSMBearerAvailabilityNotifier = CBearerAvailabilityNotifier::NewL( iServer );
+            }
+        if ( !iGSMBearerAvailabilityNotifier->IsActive() )
+            {
+            iGSMBearerAvailabilityNotifier->Receive(); // (re)start listening
+            }
+        }
+
+    if ( iTSYLoaded )
+        {
+        // Mode change events
+        if ( iModeNotifier == 0 )
+            {
+            iModeNotifier = CModeNotifier::NewL( iServer, iMobilePhone );
+            }
+        if ( !iModeNotifier->IsActive() )
+            {
+            iModeNotifier->Receive(); // (re)start listening
+            }
+
+        // Network registration status events
+        if ( iNetwRegistrationNotifier == 0 )
+            {
+            iNetwRegistrationNotifier = CNetwRegistrationNotifier::NewL( iServer, iMobilePhone );
+            }
+        if ( !iNetwRegistrationNotifier->IsActive() )
+            {
+            iNetwRegistrationNotifier->Receive(); // (re)start listening
+            }
+
+        // Bearer change (GPRS/Edge GPRS) status events
+        if ( FeatureManager::FeatureSupported( KFeatureIdEdgeKnowledge ) )
+            {
+            if ( iEdgeNotifier == 0 )
+                {
+                iEdgeNotifier = new( ELeave ) CBearerNotifier( iServer, iMobilePhone );
+                TRAPD( ret, iEdgeNotifier->ConstructL() );
+                if ( ret != KErrNone )
+                    {
+                    // Construction (=opening ETel CustomAPI) failed
+                    delete iEdgeNotifier;
+                    iEdgeNotifier = 0;
+                    }
+                }
+            if ( iEdgeNotifier != 0 )
+                {
+                if ( !iEdgeNotifier->IsActive() )
+                    {
+                    iEdgeNotifier->Receive(); // (re)start listening
+                    }
+                }
+            }
+
+        if ( !iWcdmaNotifier )
+            {
+            iWcdmaNotifier = CWcdmaBearerNotifier::NewL( iServer, iTelServer );
+            if ( iWcdmaNotifier )
+                {
+                iWcdmaNotifier->Receive();
+                }
+            }
+
+        if (  FeatureManager::FeatureSupported( KFeatureIdConnMonExtension ) )
+            {
+            // GSM signal strength change events
+            if ( iGSMSignalNotifier == 0 )
+                {
+                iGSMSignalNotifier = CGsmSignalNotifier::NewL( iServer, iMobilePhone );
+                }
+            if ( !iGSMSignalNotifier->IsActive() )
+                {
+                iGSMSignalNotifier->Receive(); // (re)start listening
+                }
+            }
+        }
+
+    if ( !iTelephonyNotifier )
+        {
+        iTelephonyNotifier = CConnMonTelNotifier::NewL( *this, &iMobilePhone );
+        iTelephonyNotifier->Receive();
+        }
+
+    if ( !iDualTransferModeNotifier && iPacketServLoaded )
+        {
+        iDualTransferModeNotifier = CConnMonDtmNotifier::NewL( iPacketService, *this );
+        iDualTransferModeNotifier->Receive();
+        }
+
+    if ( iWlanSupport )
+        {
+        iWlanSupport->EnableEventsToClients();
+        }
+
+    // Notifiers owned by the connections
+    // (connection status, data volumes, connection activity, subconnection up/down)
+    TInt count = iConnInfos.Count();
+
+    for ( TInt i = 0; i < count; i++ )
+        {
+        AddConnNotificationsL( i );
+        }
+    LOGEXITFN("CConnMonIAP::ListenL()")
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonIAP::CancelListen
+// Stops and deletes event watchers.
+// -----------------------------------------------------------------------------
+//
+void CConnMonIAP::CancelListen()
+    {
+    iCountListeners--;
+    LOGIT1("CancelListen() remaining listeners: %d", iCountListeners)
+
+    if ( iCountListeners == 0 )
+        {
+        DeleteNotifications();
+        }
+    }
+
+// -----------------------------------------------------------------------------------
+// CConnMonIAP::AddConnectionL
+// Adds a new connection to the iConnInfos array. Starts event watchers for the
+// connection if there are clients that want events.
+// -----------------------------------------------------------------------------------
+//
+TInt CConnMonIAP::AddConnectionL( TConnInfo& aConnection )
+    {
+    TInt err( KErrNone );
+    TInt index( KErrNotFound );
+    TUint8 internal( 0 );
+
+    if ( aConnection.iBearer < EBearerExternalCSD )
+        {
+        internal = 1;
+        }
+
+    if ( internal )
+        {
+        index = iConnInfos.Find( aConnection, TConnInfo::MatchIap );
+        }
+    /*
+    else
+        {
+        index = iConnInfos.Find( aConnection, TConnInfo::MatchBearer );
+        }
+    */
+
+    if ( KErrNotFound != index )
+        {
+        LOGIT("AddConnectionL: New connection occured with same IAP id, remove old")
+        // To remove the connection we have to complete the
+        // connection by sending the notifications needed by clients.
+        CompleteConnectionClosing( index );
+        }
+
+    // Add to connection table
+    aConnection.iConnectionId = NewConnectionId();
+
+    if ( internal )
+        {
+        err = OpenAndAttachTo( aConnection );
+        if ( err != KErrNone )
+            {
+            LOGIT1("AddConnectionL: ERROR attach failed <%d>", err)
+            return err;
+            }
+        }
+
+    err = iConnInfos.Append( aConnection );
+
+    if ( ( KErrNone == err ) && internal )
+        {
+        index = iConnInfos.Find( aConnection, TConnInfo::MatchIap );
+        if ( ( index != KErrNotFound ) && ( iCountListeners > 0 ) )
+            {
+            TRAPD( ret, AddConnNotificationsL( index ) );
+            if ( ret != KErrNone )
+                {
+                // Close attached connection
+                if ( iConnInfos[ index ].iConnAttach != 0 )
+                    {
+                    iConnInfos[ index ].iConnAttach->Close();
+                    delete iConnInfos[ index ].iConnAttach;
+                    }
+
+                // Remove
+                iConnInfos.Remove( index );
+
+                // Leave
+                User::Leave( ret );
+                }
+            }
+        }
+
+    // Print connection info array to log
+    #ifdef _DEBUG
+    LOGIT("AddConnectionL: Connection info array:")
+    for ( TInt m = 0; m < iConnInfos.Count(); m++ )
+        {
+        LOGIT4("  id %d, bearer %d, iapId %d, netId %d", iConnInfos[m].iConnectionId,
+                iConnInfos[m].iBearer, iConnInfos[m].iIapId, iConnInfos[m].iNetId)
+        }
+    #endif // _DEBUG
+
+    return err;
+    }
+
+// -----------------------------------------------------------------------------------
+// CConnMonIAP::CompleteConnectionClosing
+// -----------------------------------------------------------------------------------
+//
+void CConnMonIAP::CompleteConnectionClosing( TInt& aIndex )
+    {
+    LOGENTRFN("CConnMonIAP::CompleteConnectionClosing()")
+
+    if ( iConnInfos[aIndex].iBearerNotifier->Listening() )
+        {
+        iConnInfos[aIndex].iBearerNotifier->CancelListen();
+        }
+
+    if ( iConnInfos[aIndex].iProgressNotifier->IsActive() )
+        {
+        // Progress notification request is still active --> Cancel it
+        iConnInfos[aIndex].iProgressNotifier->Cancel();
+        }
+    // Send KLinkLayerClosed event
+    LOGIT("CompleteConnectionClosing: ProgressNotifier->SendClosedEvent()")
+    iConnInfos[aIndex].iProgressNotifier->SendClosedEvent();
+
+    if ( iConnInfos[aIndex].iConnDownNotifier->IsActive() )
+        {
+        // Allinterface notification request is still active --> Cancel it
+        iConnInfos[aIndex].iConnDownNotifier->Cancel();
+        }
+
+    if ( !iConnInfos[aIndex].iConnDownNotifier->DeleteSent() )
+        {
+        // After SetInterfaceClosed() call SendDeletedEvent() removes
+        // the connection
+        iConnInfos[aIndex].iConnDownNotifier->SetInterfaceClosed();
+        iConnInfos[aIndex].iConnDownNotifier->SendDeletedEvent();
+        }
+    else
+        {
+        // Delete has already been sent (shouldn't be possible) so
+        // connection has to be removed
+        LOGIT("CompleteConnectionClosing: Delete already sent, removing connection")
+        RemoveConnection( iConnInfos[aIndex] );
+        }
+
+    LOGEXITFN("CConnMonIAP::CompleteConnectionClosing()")
+    }
+
+// -----------------------------------------------------------------------------------
+// CConnMonIAP::RemoveConnection
+// Removes connection settings from sessions, stops and deletes event watchers and
+// removes the connection info from the iConnInfos array.
+// Connection is deleted by an event (or by calling RConnection::Stop()).
+// -----------------------------------------------------------------------------------
+//
+TInt CConnMonIAP::RemoveConnection( TConnInfo& aConnection )
+    {
+    LOGENTRFN("CConnMonIAP::RemoveConnection()")
+
+    TInt index( KErrNotFound );
+    // Check if bearer is external CSD
+    if ( aConnection.iBearer == EBearerExternalCSD ||
+            aConnection.iBearer == EBearerExternalHSCSD ||
+            aConnection.iBearer == EBearerExternalWcdmaCSD )
+        {
+        index = iConnInfos.Find( aConnection, TConnInfo::MatchBearer );
+        }
+    else if ( aConnection.iConnectionId > 0 )
+        {
+        index = iConnInfos.Find( aConnection, TConnInfo::MatchId );
+        }
+    else
+        {
+        index = iConnInfos.Find( aConnection, TConnInfo::MatchIap );
+        }
+
+    TInt err( KErrNotFound );
+    if ( index >= 0 )
+        {
+        // Set connection id for passing it back to the caller (client event)
+        aConnection.iConnectionId = iConnInfos[index].iConnectionId;
+
+        // Remove threshold settings from the client tables
+        iServer->RemoveConnSettingsFromSessions( aConnection.iConnectionId );
+
+        // Stop notifications (data volume, connection status, etc.)
+        DeleteConnNotifications( index );
+
+        // Close attached connection
+        if ( iConnInfos[index].iConnAttach != 0 )
+            {
+            iConnInfos[index].iConnAttach->Close();
+            delete iConnInfos[index].iConnAttach;
+            iConnInfos[index].iConnAttach = NULL;
+            }
+
+        iConnInfos.Remove( index );
+        err = KErrNone;
+        }
+
+    // Print connection info array to log
+    #ifdef _DEBUG
+    LOGIT("RemoveConnection: Connection info array:")
+    for ( TInt m = 0; m < iConnInfos.Count(); m++ )
+        {
+        LOGIT4("  id %d, bearer %d, iapId %d, netId %d", iConnInfos[m].iConnectionId,
+                iConnInfos[m].iBearer, iConnInfos[m].iIapId, iConnInfos[m].iNetId)
+        }
+    #endif // _DEBUG
+
+    LOGEXITFN1("CConnMonIAP::RemoveConnection()", err)
+    return err;
+    }
+
+// -----------------------------------------------------------------------------------
+// CConnMonIAP::CalculateNetworkStatus
+// -----------------------------------------------------------------------------------
+//
+TInt CConnMonIAP::CalculateNetworkStatus( const RPacketService::TStatus& aPacketStatus ) const
+    {
+    switch ( aPacketStatus )
+        {
+        case ( RPacketService::EStatusUnattached ):
+            return EConnMonStatusUnattached;
+
+        case ( RPacketService::EStatusAttached ):
+            return EConnMonStatusAttached;
+
+        case ( RPacketService::EStatusActive ):
+            return EConnMonStatusActive;
+
+        case ( RPacketService::EStatusSuspended ):
+            return EConnMonStatusSuspended;
+
+        default:
+            break;
+        }
+    return aPacketStatus;
+    }
+
+// -----------------------------------------------------------------------------------
+// CConnMonIAP::CalculateNetworkRegistration
+// -----------------------------------------------------------------------------------
+//
+TInt CConnMonIAP::CalculateNetworkRegistration(
+        const RMobilePhone::TMobilePhoneRegistrationStatus&
+        aRegistration ) const
+    {
+    switch ( aRegistration )
+        {
+        case ( RMobilePhone::ERegistrationUnknown ):
+            return ENetworkRegistrationUnknown;
+
+        case ( RMobilePhone::ENotRegisteredNoService ):
+            return ENetworkRegistrationNoService;
+
+        case ( RMobilePhone::ENotRegisteredEmergencyOnly ):
+            return ENetworkRegistrationEmergencyOnly;
+
+        case ( RMobilePhone::ENotRegisteredSearching ):
+            return ENetworkRegistrationSearching;
+
+        case ( RMobilePhone::ERegisteredBusy ):
+            return ENetworkRegistrationBusy;
+
+        case ( RMobilePhone::ERegisteredOnHomeNetwork ):
+            return ENetworkRegistrationHomeNetwork;
+
+        case ( RMobilePhone::ERegistrationDenied ):
+            return ENetworkRegistrationDenied;
+
+        case ( RMobilePhone::ERegisteredRoaming ):
+            return ENetworkRegistrationRoaming;
+
+        default:
+            break;
+        }
+    return aRegistration;
+    }
+
+// -----------------------------------------------------------------------------------
+// CConnMonIAP::CalculateNetworkRegistration_v2
+// -----------------------------------------------------------------------------------
+//
+TInt CConnMonIAP::CalculateNetworkRegistration_v2(
+        const RMobilePhone::TMobilePhoneRegistrationStatus&
+        aRegistration ) const
+    {
+    switch ( aRegistration )
+        {
+        case ( RMobilePhone::ERegistrationUnknown ):
+            return ENetworkRegistrationExtUnknown;
+
+        case ( RMobilePhone::ENotRegisteredNoService ):
+            return ENetworkRegistrationExtNoService;
+
+        case ( RMobilePhone::ENotRegisteredEmergencyOnly ):
+            return ENetworkRegistrationExtEmergencyOnly;
+
+        case ( RMobilePhone::ENotRegisteredSearching ):
+            return ENetworkRegistrationExtSearching;
+
+        case ( RMobilePhone::ERegisteredBusy ):
+            return ENetworkRegistrationExtBusy;
+
+        case ( RMobilePhone::ERegisteredOnHomeNetwork ):
+            return ENetworkRegistrationExtHomeNetwork;
+
+        case ( RMobilePhone::ERegistrationDenied ):
+            return ENetworkRegistrationExtDenied;
+
+        case ( RMobilePhone::ERegisteredRoaming ):
+            {
+            RMobilePhone::TMobilePhoneNetworkInfoV1 network;
+            RMobilePhone::TMobilePhoneNetworkInfoV1Pckg networkPckg( network );
+
+            RMobilePhone::TMobilePhoneNetworkInfoV1 homeNetwork;
+            RMobilePhone::TMobilePhoneNetworkInfoV1Pckg homeNetworkPckg( homeNetwork );
+
+            TRequestStatus status( KErrNone );
+
+            iMobilePhone.GetCurrentNetwork(status, networkPckg);
+            User::WaitForRequest( status );
+
+            if(status.Int() == KErrNone)
+                {
+                iMobilePhone.GetHomeNetwork(status, homeNetworkPckg);
+                User::WaitForRequest( status );
+
+                if(network.iCountryCode.Compare(homeNetwork.iCountryCode) == 0)
+                    {
+                    return ENetworkRegistrationExtRoamingNational;
+                    }
+                else
+                    {
+                    return ENetworkRegistrationExtRoamingInternational;
+                    }
+                }
+          }
+
+        default:
+            break;
+        }
+    return aRegistration;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonIAP::IsEdgeCell
+// -----------------------------------------------------------------------------
+//
+TBool CConnMonIAP::IsEdgeCell()
+    {
+    LOGENTRFN("CConnMonIAP::IsEdgeCell()")
+    TBool edgeStatus( EFalse );
+
+    LOGTIMINGSTART("CConnMonIAP::IsEdgeCell")
+
+    if ( FeatureManager::FeatureSupported( KFeatureIdEdgeKnowledge ) )
+        {
+        RMmCustomAPI customApi;
+        RMmCustomAPI::TGprsInformation gprsInfo;
+        RMmCustomAPI::TGprsInformationPckg gprsInfoPckg( gprsInfo );
+        TRequestStatus status( KErrNone );
+
+        TInt ret = customApi.Open( iMobilePhone );
+
+        if ( KErrNone == ret )
+            {
+            customApi.GetEGprsInfo( status, gprsInfoPckg );
+            User::WaitForRequest( status );
+
+            customApi.Close();
+
+            if ( KErrNone == status.Int() )
+                {
+                if ( gprsInfoPckg().iGprsInfo == RMmCustomAPI::EEdgeGprs )
+                    {
+                    edgeStatus = ETrue;
+                    }
+                }
+            else
+                {
+                LOGIT1("IsEdgeCell: Error, RMmCustomAPI.GetEGprsInfo() <%d>", status.Int())
+                }
+            }
+        else
+            {
+            LOGIT1("IsEdgeCell: Error, RMmCustomAPI.Open() <%d>", ret)
+            }
+        }
+    else
+        {
+        LOGIT("IsEdgeCell: KFeatureIdEdgeKnowledge not supported")
+        }
+    LOGTIMINGEND("CConnMonIAP::IsEdgeCell")
+
+    LOGEXITFN1("CConnMonIAP::IsEdgeCell()", (TInt)edgeStatus)
+    return edgeStatus;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonIAP::IsHsdpaCell
+// -----------------------------------------------------------------------------
+//
+TBool CConnMonIAP::IsHsdpaCell()
+    {
+    LOGENTRFN("CConnMonIAP::IsHsdpaCell()")
+
+    RPacketService::TDynamicCapsFlags dynamicCaps( 0 );
+    TBool hsdpaStatus( EFalse );
+
+    LOGTIMINGSTART("CConnMonIAP::IsHsdpaCell")
+
+    TInt ret = iPacketService.GetDynamicCaps( dynamicCaps );
+    if ( dynamicCaps & RPacketService::KCapsHSDPA )
+        {
+        hsdpaStatus = ETrue;
+        }
+    LOGTIMINGEND("CConnMonIAP::IsHsdpaCell")
+    LOGIT2("IsHsdpaCell: Dynamic caps 0x%06X <%d>", dynamicCaps, ret)
+
+    LOGEXITFN1("CConnMonIAP::IsHsdpaCell()", (TInt)hsdpaStatus)
+    return hsdpaStatus;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonIAP::HsxpaStatus
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonIAP::HsxpaStatus()
+    {
+    LOGENTRFN("CConnMonIAP::HsxpaStatus()")
+
+    RPacketService::TDynamicCapsFlags dynamicCaps( 0 );
+    TInt hspaState( EBearerInfoWCDMA );
+
+    LOGTIMINGSTART("CConnMonIAP::HsxpaStatus")
+
+    TInt ret = iPacketService.GetDynamicCaps( dynamicCaps );
+    if ( dynamicCaps & RPacketService::KCapsHSDPA )
+        {
+        if ( dynamicCaps & RPacketService::KCapsHSUPA )
+            {
+            hspaState = EBearerInfoHSxPA;
+            }
+        else
+            {
+            hspaState = EBearerInfoHSDPA;
+            }
+        }
+    else
+        {
+        if ( dynamicCaps & RPacketService::KCapsHSUPA )
+            {
+            hspaState = EBearerInfoHSUPA;
+            }
+        else
+            {
+            hspaState = EBearerInfoWCDMA;
+            }
+        }
+    LOGTIMINGEND("CConnMonIAP::HsxpaStatus")
+    LOGIT2("HsxpaStatus: Dynamic caps 0x%06X <%d>", dynamicCaps, ret)
+
+    LOGEXITFN1("CConnMonIAP::HsxpaStatus()", hspaState)
+    return hspaState;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonIAP::GetStartTime
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonIAP::GetStartTime( const TUint& aConnectionId, TTime& aTime )
+    {
+    TInt err( KErrNone );
+
+    // Find connection matching the given Id
+    TInt index = Index( aConnectionId );
+
+    if ( index < 0  )
+        {
+        return KErrNotFound;
+        }
+
+    if ( iConnInfos[index].iBearer < EBearerExternalCSD
+         && iConnInfos[index].iBearerInfo.iBearer <= EBearerInfoHSxPA )
+        {
+        // INTERNAL CONNECTIONS
+        TUint subConnectionCount( 0 );
+
+        // Find the start time of the earliest subconnection
+        err = iConnInfos[index].iConnAttach->EnumerateSubConnections( subConnectionCount );
+
+        if ( KErrNone != err )
+            {
+            return err;
+            }
+
+        LOGIT1("GetStartTime: Sub connection count %d", subConnectionCount)
+        for ( TUint i = 1; i <= subConnectionCount; i++ )
+            {
+            TSubConnectionInfo subInfo;
+            TPckg<TSubConnectionInfo> pckgSubInfo( subInfo );
+
+            err = iConnInfos[index].iConnAttach->GetSubConnectionInfo( i, pckgSubInfo );
+
+            if ( KErrNone != err )
+                {
+                LOGIT2("GetStartTime: Error getting conn.info for index %d, <%d>", i, err)
+                return err;
+                }
+
+            if ( i == 1 )
+                {
+                aTime = pckgSubInfo().iTimeStarted;
+                }
+            else if ( aTime > pckgSubInfo().iTimeStarted )
+                {
+                aTime = pckgSubInfo().iTimeStarted;
+                }
+            }
+        }
+    else if ( iConnInfos[index].iBearer == EBearerExternalGPRS     ||
+              iConnInfos[index].iBearer == EBearerExternalEdgeGPRS ||
+              iConnInfos[index].iBearer == EBearerExternalWCDMA    ||
+              iConnInfos[index].iBearer == EBearerExternalCDMA2000 ||
+              ( !iConnInfos[index].iBearerInfo.iInternal &&
+                ( iConnInfos[index].iBearerInfo.iBearer == EBearerInfoHSDPA ||
+                  iConnInfos[index].iBearerInfo.iBearer == EBearerInfoHSUPA ||
+                  iConnInfos[index].iBearerInfo.iBearer == EBearerInfoHSxPA ) ) )
+        {
+        // EXTERNAL PSD
+        if ( iPsdFax )
+            {
+            err = iPsdFax->GetStartTime( aConnectionId, aTime );
+
+            if ( KErrNone != err )
+                {
+                return err;
+                }
+            }
+        else
+            {
+            return KErrNotFound;
+            }
+        }
+    else if ( iConnInfos[index].iBearer == EBearerExternalCSD   ||
+              iConnInfos[index].iBearer == EBearerExternalHSCSD ||
+              iConnInfos[index].iBearer == EBearerExternalWcdmaCSD )
+        {
+        // EXTERNAL CSD
+        if ( iCsdFax )
+            {
+            err = iCsdFax->GetStartTime( aTime );
+
+            if ( KErrNone != err )
+                {
+                return err;
+                }
+            }
+        else
+            {
+            err = KErrNotFound;
+            }
+        }
+    else
+        {
+        return KErrNotSupported;
+        }
+
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonIAP::GetBearer
+// Gets the bearer setting for the internal connections.
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonIAP::GetBearer(
+        const TUint& aConnectionId,
+        TInt& aBearer,
+        TBearerInfo& aBearerInfo )
+    {
+    TInt err( KErrNone );
+    TUint32 bearerType( EBearerUnknown );
+    TBuf<KCommsDbSvrMaxFieldLength> settingName;
+    TBuf<KCommsDbSvrMaxFieldLength> settingValue;
+
+    LOGENTRFN("CConnMonIAP::GetBearer()")
+
+    // Find connection matching the given Id
+    TInt index = Index( aConnectionId );
+    if ( index < 0 )
+        {
+        LOGEXITFN1("CConnMonIAP::GetBearer()", KErrNotFound)
+        return KErrNotFound;
+        }
+
+    if ( iConnInfos[index].iConnAttach == 0 )
+        {
+        LOGIT("GetBearer: error, iConnAttach was NULL")
+        LOGEXITFN1("CConnMonIAP::GetBearer()", KErrArgument)
+        return KErrArgument;
+        }
+
+    // Find out BEARER TYPE
+    settingName.Copy( TPtrC( IAP ) );
+    settingName.Append( TChar( '\\' ) );
+    settingName.Append( TPtrC( IAP_BEARER_TYPE ) );
+
+    err = iConnInfos[index].iConnAttach->GetDesSetting( TPtrC( settingName ), settingValue );
+    if ( KErrNone != err )
+        {
+        LOGIT1("GetBearer: ERROR getting IAP bearer type <%d>", err)
+        LOGEXITFN1("CConnMonIAP::GetBearer()", err)
+        return err;
+        }
+
+    if ( settingValue == TPtrC( VIRTUAL_BEARER ) )
+        {
+        aBearer = EBearerVirtual;
+        aBearerInfo.iBearer = EBearerInfoVirtual;
+        aBearerInfo.iInternal = ETrue;
+        }
+
+    // Find out SERVICE TYPE
+    settingName.Copy( TPtrC( IAP ) );
+    settingName.Append( TChar( '\\' ) );
+    settingName.Append( TPtrC( IAP_SERVICE_TYPE ) );
+
+    err = iConnInfos[index].iConnAttach->GetDesSetting( TPtrC( settingName ), settingValue );
+    if ( KErrNone != err )
+        {
+        LOGIT1("GetBearer: ERROR getting IAP service type <%d>", err)
+        LOGEXITFN1("CConnMonIAP::GetBearer()", err)
+        return err;
+        }
+
+    // Is this virtual bearer + VPN service
+    if ( ( aBearer == EBearerVirtual ) && ( settingValue == TPtrC( VPN_SERVICE ) ) )
+        {
+        aBearer = EBearerVirtualVPN;
+        aBearerInfo.iBearer = EBearerInfoVirtualVPN;
+        aBearerInfo.iInternal = ETrue;
+        }
+
+    // Return if bearer has been solved
+    if ( aBearer != EBearerUnknown )
+        {
+        LOGEXITFN1("CConnMonIAP::GetBearer()", KErrNone)
+        return KErrNone;
+        }
+
+    // Study service type if bearer is still unknown
+    if ( settingValue == TPtrC( DIAL_OUT_ISP ) || settingValue == TPtrC( DIAL_IN_ISP ) )
+        {
+        LOGIT("GetBearer: type is dial_x_isp")
+        settingName.Copy( settingValue );
+        settingName.Append( TChar( '\\' ) );
+        settingName.Append( TPtrC( ISP_BEARER_TYPE ) );
+
+        err = iConnInfos[index].iConnAttach->GetIntSetting( TPtrC( settingName ), bearerType );
+
+        if ( KErrNone != err )
+            {
+            return err;
+            }
+
+        if ( bearerType == EBearerTypeCSD )
+            {
+            aBearer = EBearerCSD;
+            aBearerInfo.iBearer = EBearerInfoCSD;
+            aBearerInfo.iInternal = ETrue;
+            }
+        else
+            {
+            // EBearerTypeHSCSD
+            aBearer = EBearerHSCSD;
+            aBearerInfo.iBearer = EBearerInfoHSCSD;
+            aBearerInfo.iInternal = ETrue;
+            }
+
+        if ( iTSYLoaded )
+            {
+            RMobilePhone::TMobilePhoneNetworkMode mode;
+
+            err = iMobilePhone.GetCurrentMode( mode );
+
+            if ( ( KErrNone == err ) && ( mode == RMobilePhone::ENetworkModeWcdma ) )
+                {
+                aBearer = EBearerWcdmaCSD;
+                aBearerInfo.iBearer = EBearerInfoWcdmaCSD;
+                aBearerInfo.iInternal = ETrue;
+                }
+            }
+
+        if ( aBearer == EBearerHSCSD || aBearer == EBearerCSD )
+            {
+            // If TsyName == PHONETSY try to find out the real life situation (CSD/HSCSD) from ETel
+            // For point-to-point connections TSY is NOT PHONETSY.
+            settingName.Copy( TPtrC( IAP ) );
+            settingName.Append( TChar( '\\' ) );
+            settingName.Append( TPtrC( IAP_BEARER_TYPE ) );
+
+            err = iConnInfos[index].iConnAttach->GetDesSetting(
+                    TPtrC( settingName ),
+                    settingValue );
+
+            if ( ( KErrNone == err ) && ( settingValue == TPtrC( MODEM_BEARER ) ) )
+                {
+                settingName.Copy( TPtrC( MODEM_BEARER ) );
+                settingName.Append( TChar( '\\' ) );
+                settingName.Append( TPtrC( MODEM_TSY_NAME ) );
+
+                err = iConnInfos[index].iConnAttach->GetDesSetting(
+                        TPtrC( settingName ),
+                        settingValue );
+
+                TBuf<KConnMonSmallBufferLen> tmp( KMmTsyModuleName );
+                tmp.UpperCase();
+
+                if ( ( KErrNone == err ) && ( settingValue == tmp ) )
+                    {
+                    // TSY is PHONETSY
+                    TBuf<KConnMonSmallBufferLen> number;
+
+                    err = GetTelNumber( aConnectionId, number );
+
+                    if ( KErrNone == err )
+                        {
+                        GetBearerFromETel( number, aBearer, aBearerInfo );
+                        }
+                    }
+                }
+            }
+        }
+    else if ( settingValue == TPtrC( OUTGOING_WCDMA ) ||
+              settingValue == TPtrC( INCOMING_WCDMA ) )
+        {
+        LOGIT("GetBearer: type is wcdma")
+        if ( iTSYLoaded )
+            {
+            RMobilePhone::TMobilePhoneNetworkMode mode;
+            err = iMobilePhone.GetCurrentMode( mode );
+            LOGIT2("GetBearer: phone mode %d <%d>", (TInt)mode, err)
+            if ( ( KErrNone != err ) ||
+                 ( mode == RMobilePhone::ENetworkModeUnknown ) ||
+                 ( mode == RMobilePhone::ENetworkModeUnregistered ) )
+                {
+                // MODE is UNKNOWN
+                LOGIT2("GetBearer: mode is unknown %d <%d>", mode, err)
+                if ( FeatureManager::FeatureSupported( KFeatureIdProtocolGsm ) )
+                    {
+                    // KFeatureIdProtocolGsm means that phone supports only GSM
+                    if ( IsEdgeCell() )
+                        {
+                        aBearer = EBearerEdgeGPRS;
+                        aBearerInfo.iBearer = EBearerInfoEdgeGPRS;
+                        }
+                    else
+                        {
+                        aBearer = EBearerGPRS;
+                        aBearerInfo.iBearer = EBearerInfoGPRS;
+                        }
+                    aBearerInfo.iInternal = ETrue;
+                    }
+                else
+                    {
+                    LOGIT("GetBearer: KFeatureIdProtocolGsm not supported")
+                    }
+                }
+            else
+                {
+                // MODE is KNOWN
+                if ( mode == RMobilePhone::ENetworkModeWcdma )
+                    {
+                    aBearer = EBearerWCDMA;
+                    aBearerInfo.iBearer = HsxpaStatus();
+                    aBearerInfo.iInternal = ETrue;
+                    }
+                else if ( mode == RMobilePhone::ENetworkModeGsm )
+                    {
+                    if ( IsEdgeCell() )
+                        {
+                        aBearer = EBearerEdgeGPRS;
+                        aBearerInfo.iBearer = EBearerInfoEdgeGPRS;
+                        }
+                    else
+                        {
+                        aBearer = EBearerGPRS;
+                        aBearerInfo.iBearer = EBearerInfoGPRS;
+                        }
+                    aBearerInfo.iInternal = ETrue;
+                    }
+                else
+                    {
+                    LOGIT1("GetBearer: error, mode was unexpected %d", mode)
+                    }
+                }
+            }
+        }
+
+    else if ( settingValue == TPtrC( LAN_SERVICE ) )
+        {
+        LOGIT("GetBearer: type is (w)lan")
+        aBearer = EBearerLAN;
+        aBearerInfo.iBearer = EBearerInfoLAN;
+        aBearerInfo.iInternal = ETrue;
+
+        settingName.FillZ();
+        settingValue.FillZ();
+        settingName.Copy( TPtrC( LAN_BEARER ) );
+        settingName.Append( TChar( '\\' ) );
+        settingName.Append( TPtrC( COMMDB_NAME ) );
+
+        err = iConnInfos[index].iConnAttach->GetDesSetting( TPtrC( settingName ), settingValue );
+
+        if ( KErrNone != err )
+            {
+            return err;
+            }
+
+        if ( settingValue == TPtrC( KWlanBearerRecordName ) )
+            {
+            aBearer = EBearerWLAN;
+            aBearerInfo.iBearer = EBearerInfoWLAN;
+            }
+        }
+    LOGIT2("GetBearer: bearer %d, bearerInfo %d", aBearer, aBearerInfo.iBearer)
+    LOGEXITFN1("CConnMonIAP::GetBearer()", err)
+    return err;
+    }
+
+// -----------------------------------------------------------------------------------
+// CConnMonIAP::UpdateActivity
+// Updates connection activity information.
+// -----------------------------------------------------------------------------------
+//
+TInt CConnMonIAP::UpdateActivity( const TUint& aConnectionId, const TUint& aActivity )
+    {
+    // Find connection matching the given Id
+    TInt index = Index( aConnectionId );
+
+    if ( index < 0  )
+        {
+        return KErrNotFound;
+        }
+
+    if ( aActivity == 0 )
+        {
+        iConnInfos[index].iActivity = 0;
+        }
+    else
+        {
+        iConnInfos[index].iActivity = 1;
+        }
+
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------------
+// CConnMonIAP::GetDeleteNotifyStatus
+// -----------------------------------------------------------------------------------
+//
+TInt CConnMonIAP::GetDeleteNotifyStatus( TConnInfo& aConnection, TBool& aSent )
+    {
+    TInt index( KErrNotFound );
+
+    if ( aConnection.iBearer >= EBearerExternalCSD )
+        {
+        return KErrNotSupported;
+        }
+
+    index = iConnInfos.Find( aConnection, TConnInfo::MatchIap );
+
+    if ( index < 0 )
+        {
+        return KErrNotFound;
+        }
+
+    aConnection.iConnectionId = iConnInfos[index].iConnectionId;
+    aConnection.iBearer = iConnInfos[index].iBearer;
+
+    TInt connectionStatus( 0 );
+    GetConnectionStatus( index, connectionStatus );
+
+    if ( ( iConnInfos[index].iConnDownNotifier != 0 ) &&
+         ( iConnInfos[index].iProgressNotifier != 0 ) )
+        {
+        if ( !iConnInfos[index].iConnDownNotifier->DeleteSent() &&
+             !iConnInfos[index].iConnDownNotifier->IsActive() &&
+             ( !iConnInfos[index].iProgressNotifier->IsActive() ||
+               ( connectionStatus != KLinkLayerOpen ) ) )
+            {
+            aSent = EFalse;
+            }
+        else
+            {
+            aSent = ETrue;
+            }
+        }
+    else
+        {
+        aSent = EFalse;
+        }
+
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------------
+// CConnMonIAP::GetActivityNotifier
+// -----------------------------------------------------------------------------------
+//
+TInt CConnMonIAP::GetActivityNotifier(
+        const TUint& aConnectionId,
+        CActivityNotifier** aActivityNotifier )
+    {
+    // Find connection matching the given Id
+    TInt index = Index( aConnectionId );
+
+    if ( index < 0  )
+        {
+        return KErrNotFound;
+        }
+
+    if ( aActivityNotifier == 0 )
+        {
+        return KErrUnknown;
+        }
+
+    *aActivityNotifier = iConnInfos[ index ].iActivityNotifier;
+
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------------
+// CConnMonIAP::GetProgressNotifier
+// -----------------------------------------------------------------------------------
+//
+TInt CConnMonIAP::GetProgressNotifier(
+        const TUint& aConnectionId,
+        CProgressNotifier** aProgressNotifier )
+    {
+    // Find connection matching the given Id
+    TInt index = Index( aConnectionId );
+
+    if ( index < 0  )
+        {
+        return KErrNotFound;
+        }
+
+    if ( aProgressNotifier == 0 )
+        {
+        return KErrUnknown;
+        }
+
+    *aProgressNotifier = iConnInfos[index].iProgressNotifier;
+
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------------
+// CConnMonIAP::GetSubConnUpDownNotifier
+// -----------------------------------------------------------------------------------
+//
+TInt CConnMonIAP::GetSubConnUpDownNotifier(
+        const TUint& aConnectionId,
+        CSubConnUpDownNotifier** aSubConnUpDownNotifier )
+    {
+    // Find connection matching the given Id
+    TInt index = Index( aConnectionId );
+
+    if ( index < 0  )
+        {
+        return KErrNotFound;
+        }
+
+    if ( aSubConnUpDownNotifier == 0 )
+        {
+        return KErrUnknown;
+        }
+
+    *aSubConnUpDownNotifier = iConnInfos[index].iConnDownNotifier;
+
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------------
+// CConnMonIAP::WakeUpNotifications
+// Wakes up sleeping CONNECTION SPECIFIC event watchers that depend on a threshold.
+// (data volume, activity).
+// -----------------------------------------------------------------------------------
+//
+TInt CConnMonIAP::WakeUpNotifications( const TUint& aConnectionId )
+    {
+    // Find connection matching the given Id
+    TInt index = Index( aConnectionId );
+
+    if ( index < 0  )
+        {
+        return KErrNotFound;
+        }
+
+    if ( ( iConnInfos[index].iBearer < EBearerExternalCSD ) &&  ( iCountListeners > 0 ) )
+        {
+        // INTERNAL CONNECTIONS
+        TInt connectionStatus( 0 );
+        GetConnectionStatus( index, connectionStatus );
+
+        if ( ( connectionStatus == KLinkLayerOpen ) || ( connectionStatus == KPsdSuspended ) )
+            {
+            // -------------------------
+            // Amount of Downlink data
+            // -------------------------
+            if ( iConnInfos[index].iDLDataNotifier != 0 )
+                {
+                if ( !iConnInfos[index].iDLDataNotifier->IsActive() )
+                    {
+                    iConnInfos[index].iDLDataNotifier->Receive(); // (re)start listening
+                    }
+                }
+
+            // -------------------------
+            // Amount of Uplink data
+            // -------------------------
+            if ( iConnInfos[index].iULDataNotifier != 0 )
+                {
+                if ( !iConnInfos[index].iULDataNotifier->IsActive() )
+                    {
+                    iConnInfos[index].iULDataNotifier->Receive(); // (re)start listening
+                    }
+                }
+
+            // ----------------------
+            // Connection Activity
+            // ----------------------
+            if ( iConnInfos[index].iActivityNotifier != 0 )
+                {
+                if ( !iConnInfos[index].iActivityNotifier->IsActive() )
+                    {
+                    iConnInfos[index].iActivityNotifier->Receive( iConnInfos[index].iActivity );
+                    }
+                }
+
+            if ( iConnInfos[index].iBearerNotifier )
+                {
+                if ( !iConnInfos[index].iBearerNotifier->Listening() )
+                    {
+                    iConnInfos[index].iBearerNotifier->Listen();
+                    }
+                }
+            }
+        }
+
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------------
+// CConnMonIAP::WakeUpNotifications
+// Wakes up GENERAL sleeping event watchers that depend on a threshold.
+// (signal strength, bearer availability).
+// -----------------------------------------------------------------------------------
+//
+TInt CConnMonIAP::WakeUpNotifications()
+    {
+    if ( iGSMSignalNotifier != 0 )
+        {
+        if ( !iGSMSignalNotifier->IsActive() )
+            {
+            iGSMSignalNotifier->Receive(); // (re)start listening
+            }
+        }
+
+    if ( iGSMBearerAvailabilityNotifier != 0 )
+        {
+        if ( !iGSMBearerAvailabilityNotifier->IsActive() )
+            {
+            iGSMBearerAvailabilityNotifier->Receive(); // (re)start listening
+            }
+        }
+
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------------
+// CConnMonIAP::LaunchActivityNotifierL
+// Launches the activity notifier for the given connection id.
+// -----------------------------------------------------------------------------------
+//
+TInt CConnMonIAP::LaunchActivityNotifierL( const TUint& aConnectionId )
+    {
+    TInt index = Index( aConnectionId );
+
+    if ( index < 0  )
+        {
+        return KErrNotFound;
+        }
+
+    GetActivityOneShotL( index );
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------------
+// CConnMonIAP::LaunchDataNotifiers
+// Launches the data notifiers (uplink & downlink) for the given connection id.
+// -----------------------------------------------------------------------------------
+//
+TInt CConnMonIAP::LaunchDataNotifiers( const TUint& aConnectionId )
+    {
+    TInt index = Index( aConnectionId );
+
+    if ( index < 0  )
+        {
+        return KErrNotFound;
+        }
+
+    if ( iConnInfos[index].iDLDataNotifier != 0 )
+        {
+        if ( !iConnInfos[index].iDLDataNotifier->IsActive() )
+            {
+            iConnInfos[index].iDLDataNotifier->Receive();
+            }
+        }
+
+    if ( iConnInfos[index].iULDataNotifier != 0 )
+        {
+        if ( !iConnInfos[index].iULDataNotifier->IsActive() )
+            {
+            iConnInfos[index].iULDataNotifier->Receive();
+            }
+        }
+
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------------
+// CConnMonIAP::LaunchDataNotifiers
+// Launches the data notifiers (uplink & downlink) for the given connection id.
+// -----------------------------------------------------------------------------------
+//
+TInt CConnMonIAP::LaunchBearerNotifier( const TUint& aConnectionId )
+    {
+    TInt index = Index( aConnectionId );
+
+    if ( index < 0  )
+        {
+        return KErrNotFound;
+        }
+
+    if ( iConnInfos[index].iBearerNotifier )
+        {
+        if ( !iConnInfos[index].iBearerNotifier->Listening() )
+            {
+            iConnInfos[index].iBearerNotifier->Listen();
+            }
+        }
+
+    return KErrNone;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CConnMonIAP::AppendActiveConnections
+// -----------------------------------------------------------------------------
+//
+void CConnMonIAP::GetActiveConnectionsIds( const TUint& aBearerId, RArray<TUint>& aIdArray )
+    {
+    //LOGENTRFN("CConnMonIAP::GetActiveConnectionsIds()")
+
+    const TInt count = iConnInfos.Count();
+    for ( TInt i = 0; i < count; i++ )
+        {
+        // Bearer might still be uninitialized
+        if ( iConnInfos[i].iBearer == EBearerUnknown )
+            {
+            LOGIT1("GetActiveConnectionsIds: bearer unknown for conn.id %d",
+                    iConnInfos[i].iConnectionId)
+            TInt err = GetBearer(
+                    iConnInfos[i].iConnectionId,
+                    iConnInfos[i].iBearer,
+                    iConnInfos[i].iBearerInfo );
+
+            if ( KErrNone != err )
+                {
+                // Skip because bearer is unknown. This connection has not yet fully started.
+                continue;
+                }
+            }
+        switch ( iConnInfos[i].iBearer )
+            {
+            case EBearerGPRS:
+            case EBearerEdgeGPRS:
+            case EBearerWCDMA:
+                {
+                if ( aBearerId == EBearerIdGPRS )
+                    {
+                    aIdArray.Append( iConnInfos[i].iIapId );
+                    }
+                }
+                break;
+            case EBearerWLAN:
+                {
+                if ( aBearerId == EBearerIdWLAN )
+                    {
+                    TInt connectionStatus( 0 );
+                    GetConnectionStatus( i, connectionStatus );
+                    if ( connectionStatus == KLinkLayerOpen )
+                        {
+                        aIdArray.Append( iConnInfos[i].iIapId );
+                        }
+                    }
+                }
+                break;
+            case EBearerCSD:
+            case EBearerHSCSD:
+            case EBearerWcdmaCSD:
+                {
+                if ( aBearerId == EBearerIdCSD )
+                    {
+                    aIdArray.Append( iConnInfos[i].iIapId );
+                    }
+                }
+                break;
+            case EBearerLAN:
+                {
+                if ( aBearerId == EBearerIdLAN )
+                    {
+                    aIdArray.Append( iConnInfos[i].iIapId );
+                    }
+                }
+                break;
+            default:
+                break;
+            }
+        }
+    //LOGEXITFN("CConnMonIAP::GetActiveConnectionsIds()")
+    }
+
+
+// -----------------------------------------------------------------------------
+// CConnMonIAP::GetBearerSupportInfo
+// Checks whether the current cell and the phone support a bearer (GPRS or CSD).
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonIAP::GetBearerSupportInfo(
+        const TUint aConnectionId,
+        TBool& aByCell,
+        TBool& aByPhone ) const
+    {
+    LOGENTRFN("CConnMonIAP::GetBearerSupportInfo()")
+    TInt err( KErrNone );
+
+    aByCell = EFalse;
+    aByPhone = EFalse;
+
+    if ( !iTSYLoaded  )
+        {
+        LOGIT("GetBearerSupportInfo: ERROR, TSY not loaded")
+        LOGEXITFN1("CConnMonIAP::GetBearerSupportInfo()", err)
+        return err;
+        }
+
+    RPacketService::TDynamicCapsFlags capsDynamic( 0 );
+    if ( iPacketServLoaded )
+        {
+        err = iPacketService.GetDynamicCaps( capsDynamic );
+        if ( KErrNone != err )
+            {
+            LOGIT1("GetBearerSupportInfo: ERROR getting dynamic caps <%d>", err)
+            capsDynamic = 0;
+            }
+        }
+
+    if ( aConnectionId == EBearerIdGPRS || aConnectionId == EBearerIdWCDMA )
+        {
+        LOGIT2("GetBearerSupportInfo: GPRS and WCDMA, dynamic caps:   0x%04X <%d>", capsDynamic, err)
+
+        // 1. Is GPRS/WCDMA supported by this NETWORK CELL
+        if ( ( capsDynamic & RPacketService::KCapsManualAttach ) ||
+             ( capsDynamic & RPacketService::KCapsManualDetach ) )
+            {
+            // Is the phone registered on the packet network
+            RPacketService::TRegistrationStatus nwRegStatus( RPacketService::EUnknown );
+            TRequestStatus status( KErrNone );
+            iPacketService.GetNtwkRegStatus( status, nwRegStatus );
+            User::WaitForRequest( status );
+
+            LOGIT2("GetBearerSupportInfo: pckt service ntwrk reg status:  %d <%d>", nwRegStatus, status.Int())
+            if ( KErrNone == status.Int() &&
+                 nwRegStatus != RPacketService::ENotRegisteredNotSearching &&
+                 nwRegStatus != RPacketService::ENotRegisteredSearching    &&
+                 nwRegStatus != RPacketService::ERegistrationDenied        &&
+                 nwRegStatus != RPacketService::ENotRegisteredAndNotAvailable )
+                {
+                // Query the TSY for the attach mode
+                RPacketService::TAttachMode attachMode( RPacketService::EAttachWhenNeeded );
+                err = iPacketService.GetAttachMode( attachMode );
+
+                LOGIT2("GetBearerSupportInfo: pckt service attach mode:       %d <%d>", attachMode, err)
+                // Query packet network status (but only if the TSY is set to attach when possible)
+                if ( KErrNone == err && attachMode == RPacketService::EAttachWhenPossible )
+                    {
+                    RPacketService::TStatus pcktStatus( RPacketService::EStatusUnattached );
+                    err = iPacketService.GetStatus( pcktStatus );
+
+                    LOGIT2("GetBearerSupportInfo: pckt service status:            %d <%d>", pcktStatus, err)
+                    if ( KErrNone == err && pcktStatus != RPacketService::EStatusUnattached )
+                        {
+                        aByCell = ETrue;
+                        }
+                    }
+                else
+                    {
+                    // Attach mode is 'EAttachWhenNeeded'
+                    aByCell = ETrue;
+                    }
+                }
+            }
+
+        // 2. Check the PHONE'S MODE if it is known
+        TUint bearerId( 0 );
+        err = GetBearerId( bearerId );
+
+        // If phone mode query failed, mode is unknown, or bearer ID equals connection ID.
+        if ( bearerId == 0 || bearerId == aConnectionId )
+            {
+            // 3. Check the PHONE'S MODE CAPABILITIES
+            TUint32 capsPhone( 0 );
+            err = iMobilePhone.GetMultimodeCaps( capsPhone );
+
+            LOGIT2("GetBearerSupportInfo: mobile phone mode caps:         0x%04X <%d>", capsPhone, err)
+            if ( KErrNone == err )
+                {
+                if ( aConnectionId == EBearerIdGPRS &&
+                     ( capsPhone & RMobilePhone::KCapsGprsSupported ) )
+                    {
+                    aByPhone = ETrue;
+                    }
+                else if ( aConnectionId == EBearerIdWCDMA &&
+                        ( capsPhone &
+                        ( RMobilePhone::KCapsWcdmaSupported |
+                        RMobilePhone::KCapsGprsSupported ) ) )
+                    {
+                    aByPhone = ETrue;
+                    }
+                }
+            }
+        }
+    else if ( aConnectionId == EBearerIdCSD || aConnectionId == EBearerIdWcdmaCSD )
+        {
+        LOGIT2("GetBearerSupportInfo: CSD and WcdmaCSD, dynamic caps: 0x%04X <%d>", capsDynamic, err)
+
+        // 1. Is CSD/WcdmaCSD supported by this NETWORK CELL
+        if ( capsDynamic & RPacketService::KCapsRxCSCall )
+            {
+            // Has phone registered to the network
+            TRequestStatus status( KErrNone );
+            RMobilePhone::TMobilePhoneRegistrationStatus gsmReg(
+                    RMobilePhone::ERegistrationUnknown );
+
+            iMobilePhone.GetNetworkRegistrationStatus( status, gsmReg );
+            User::WaitForRequest( status );
+
+            LOGIT2("GetBearerSupportInfo: mobile phone reg status:        %d <%d>", gsmReg, status.Int())
+            if ( KErrNone == status.Int() )
+                {
+                if ( gsmReg == RMobilePhone::ERegisteredBusy ||
+                        gsmReg == RMobilePhone::ERegisteredOnHomeNetwork ||
+                        gsmReg == RMobilePhone::ERegisteredRoaming )
+                    {
+                    aByCell = ETrue;
+                    }
+                }
+            }
+
+        // 2. Check the PHONE'S MODE if it is known
+        TUint bearerId( 0 );
+        err = GetBearerId( bearerId, ETrue );
+
+        // If phone mode query failed, mode is unknown, or bearer ID equals connection ID.
+        if ( bearerId == 0 || bearerId == aConnectionId )
+            {
+            // 3. Check the PHONE'S CAPABILITIES
+            err = iTelServer.IsSupportedByModule(
+                    KMmTsyModuleName,
+                    KETelFuncMobileDataCall,
+                    aByPhone );
+            }
+        }
+    else
+        {
+        LOGIT1("GetBearerSupportInfo: invalid connection id: %d", aConnectionId)
+        err = KErrArgument;
+        }
+
+    LOGIT2("GetBearerSupportInfo: by cell: %d, by phone: %d", aByCell, aByPhone)
+    LOGEXITFN1("CConnMonIAP::GetBearerSupportInfo()", err)
+    return err;
+    }
+
+// -----------------------------------------------------------------------------------
+// CConnMonIAP::GetBearerId
+// Gets the bearer ID matching the phone's current mode.
+// -----------------------------------------------------------------------------------
+//
+TInt CConnMonIAP::GetBearerId( TUint& aBearerId, TBool aCsd ) const
+    {
+    aBearerId = 0;
+    RMobilePhone::TMobilePhoneNetworkMode mode;
+    TInt err = iMobilePhone.GetCurrentMode( mode );
+    // If GetCurrentMode() failed for any reason, aBearerId will be 0.
+
+    LOGIT2("CConnMonIAP::GetBearerId(): current phone mode %d <%d>", mode, err)
+    if ( err == KErrNone )
+        {
+        switch ( mode )
+            {
+            case RMobilePhone::ENetworkModeWcdma:
+                if ( aCsd )
+                    {
+                    aBearerId  = EBearerIdWcdmaCSD;
+                    }
+                else
+                    {
+                    aBearerId  = EBearerIdWCDMA;
+                    }
+                break;
+
+            case RMobilePhone::ENetworkModeGsm:
+            case RMobilePhone::ENetworkModeUnknown: // Emulator default
+                if ( aCsd )
+                    {
+                    aBearerId = EBearerIdCSD;
+                    }
+                else
+                    {
+                    aBearerId = EBearerIdGPRS;
+                    }
+                break;
+
+            case RMobilePhone::ENetworkModeCdma2000:
+                aBearerId = EBearerIdCDMA2000;
+                break;
+
+            // ENetworkModeUnregistered
+            // ENetworkModeAmps
+            // ENetworkModeCdma95
+            // ENetworkModeTdcdma
+            default:
+                break;
+            }
+        }
+    return err;
+    }
+
+// -----------------------------------------------------------------------------------
+// CConnMonIAP::Reconnect
+// A new connection has been established by reconnecting to an old connection.
+// -----------------------------------------------------------------------------------
+//
+TInt CConnMonIAP::Reconnect( TUint& aConnectionId )
+    {
+    LOGENTRFN("CConnMonIAP::Reconnect()")
+    TInt err( KErrNone );
+
+    TInt index = Index( aConnectionId );
+    if ( index < 0  )
+        {
+        //return KErrNotFound;
+        err = KErrNotFound;
+        }
+    else
+        {
+        // Prevent ConnDown notifier from being deleted
+        // It will destroy itself later in reconnect case.
+        iConnInfos[index].iConnDownNotifier = 0;
+        TBearerInfo bearerInfo( EBearerInfoUnknown, EFalse );
+
+        TConnInfo connInfo( iConnInfos[index].iIapId, iConnInfos[index].iNetId, 0, 0, bearerInfo );
+
+        // AddConnectionL will remove the old connection
+        TInt err2( KErrNone );
+        TRAP( err2, ( err = AddConnectionL( connInfo ) ) );
+        if ( ( err2 != KErrNone ) || ( err != KErrNone ) )
+            {
+            err = KErrUnknown;
+            }
+        else
+            {
+            aConnectionId = connInfo.iConnectionId;
+            }
+        }
+
+    LOGEXITFN1("CConnMonIAP::Reconnect()", err)
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonIAP::WlanSupportCheck
+//
+// Returns KErrNone if the given connection ID is EBearerIdWLAN, or belongs to
+// an active connection where bearer has been marked as EBearerIdWLAN.
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonIAP::WlanSupportCheck( const TUint& aConnectionId )
+    {
+    LOGENTRFN("CConnMonIAP::WlanSupportCheck()")
+    TInt ret( KErrNotSupported );
+
+    // Check if WLAN is supported at all
+    if ( !iWlanSupport )
+        {
+        LOGIT("WlanSupportCheck: no WLAN support")
+        ret = KErrNotSupported;
+        }
+    else
+        {
+        if ( EBearerIdWLAN == aConnectionId )
+            {
+            ret = KErrNone;
+            }
+        else
+            {
+            // Find connection matching the given ID
+            TInt index = Index( aConnectionId );
+            LOGIT2("WlanSupportCheck: checking connection id %d, index %d ", aConnectionId, index)
+            if ( index < 0 )
+                {
+                ret = KErrArgument;
+                }
+            else
+                {
+                // Connection found, check if bearer is EBearerWLAN
+                if ( EBearerWLAN == iConnInfos[index].iBearer )
+                    {
+                    ret = KErrNone;
+                    }
+                else
+                    {
+                    LOGIT1("WlanSupportCheck: connection bearer %d is not WLAN", iConnInfos[index].iBearer)
+                    ret = KErrArgument;
+                    }
+                }
+            }
+        }
+
+    LOGEXITFN1("CConnMonIAP::WlanSupportCheck()", ret)
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------------
+// CConnMonIAP::AppendAvailableWLANIaps
+// Gets available WLAN IAPs from WLAN engine.
+// -----------------------------------------------------------------------------------
+//
+TInt CConnMonIAP::AppendAvailableWLANIaps( RArray<TUint>& aIdArray )
+    {
+    //LOGENTRFN("CConnMonIAP::AppendAvailableWLANIaps()")
+    TInt err( KErrNone );
+
+    if ( !iWlanSupport )
+        {
+        LOGIT("AppendAvailableWLANIaps: No WLAN support")
+        err = KErrNotSupported;
+        }
+    else
+        {
+        err = iWlanSupport->AppendAvailableIaps( aIdArray );
+        }
+
+    //LOGEXITFN1("CConnMonIAP::AppendAvailableWLANIaps()", err)
+    return err;
+    }
+
+// -----------------------------------------------------------------------------------
+// CConnMonIAP::AppendAvailableWLANIapsBySsid
+// Gets available WLAN IAPs from CommsDat, matching with current WLAN connection SSID.
+// -----------------------------------------------------------------------------------
+//
+TInt CConnMonIAP::AppendAvailableWLANIapsBySsid( RArray<TUint>& aIdArray )
+    {
+    //LOGENTRFN("CConnMonIAP::AppendAvailableWLANIapsBySsid()")
+    TInt err( KErrNone );
+
+    if ( !iWlanSupport )
+        {
+        LOGIT("AppendAvailableWLANIapsBySsid: No WLAN support")
+        err = KErrNotSupported;
+        }
+    else
+        {
+        TRAPD( err2, err = iWlanSupport->AppendAvailableIapsBySsidL( aIdArray ) );
+        if ( err2 != KErrNone )
+            {
+            LOGIT1("AppendAvailableWLANIapsBySsid: error, LEAVE <%d> from AppendAvailableIapsBySsidL()", err2)
+            err = err2;
+            }
+        }
+
+    //LOGEXITFN1("CConnMonIAP::AppendAvailableWLANIapsBySsid()", err)
+    return err;
+    }
+
+// -----------------------------------------------------------------------------------
+// CConnMonIAP::EnableWlanScan
+// Enables WLAN scan for the next iap availability query.
+// -----------------------------------------------------------------------------------
+//
+void CConnMonIAP::EnableWlanScan()
+    {
+    if ( iWlanSupport )
+        {
+        iWlanSupport->EnableWlanScan();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonIAP::DtmStateChanged
+// -----------------------------------------------------------------------------
+//
+void CConnMonIAP::DtmStateChanged()
+    {
+    LOGENTRFN("CConnMonIAP::DtmStateChanged()")
+
+    TEventInfo eventInfo;
+    eventInfo.Reset();
+
+    // When not in dual mode and call is active, gprs and wcdma bearers are unavailable
+    // Note that even the WCDMA can be unavailable, if the phone doesn't support DTM
+    if ( iDualTransferModeNotifier && !iDualTransferModeNotifier->IsInDualMode() &&
+            iTelephonyNotifier && iTelephonyNotifier->IsCallActive() )
+        {
+        LOGIT("SERVER: DtmStateChanged: Packet data UNAVAILABLE (2G&3G), no DTM and call is active")
+        eventInfo.iEventType = EConnMonPacketDataUnavailable;
+
+        // Send event to all clients that are listening for bearer EBearerIdGPRS
+        LOGIT("SERVER: EVENT -> Packet data UNAVAILABLE (GPRS), no DTM and call is active")
+        eventInfo.iConnectionId = EBearerIdGPRS;
+        iServer->EventQueue()->Add( eventInfo ); // Create bearer availability event if needed
+
+        // Send event to all clients that are listening for bearer EBearerIdWCDMA
+        LOGIT("SERVER: EVENT -> Packet data UNAVAILABLE (WCDMA), no DTM and call is active")
+        eventInfo.iConnectionId = EBearerIdWCDMA;
+        iServer->EventQueue()->Add( eventInfo );
+        }
+    else
+        {
+        TBool byPhone( EFalse );
+        TBool byCell( EFalse );
+
+        // Lets check if GPRS bearer is available at all
+        TInt ret = GetBearerSupportInfo( EBearerIdGPRS, byCell, byPhone );
+        LOGIT2("Bearer support (GPRS): byCell %d, byPhone %d", byCell, byPhone)
+        if ( ret != KErrNone )
+            {
+            LOGIT1("SERVER: DtmStateChanged: GetBearerSupportInfo (GPRS) returned error <%d>", ret)
+            return; // No event on error
+            }
+
+        eventInfo.iConnectionId = EBearerIdGPRS;
+        if ( byCell && byPhone )
+            {
+            LOGIT("SERVER: EVENT -> Packet data AVAILABLE (GPRS), DTM or no call is active")
+            eventInfo.iEventType = EConnMonPacketDataAvailable;
+            }
+        else
+            {
+            LOGIT("SERVER: EVENT -> Packet data UNAVAILABLE (GPRS), no GPRS bearer")
+            eventInfo.iEventType = EConnMonPacketDataUnavailable;
+            }
+        // Send event to all clients that are listening for bearer EBearerIdGPRS
+        iServer->EventQueue()->Add( eventInfo );
+
+
+        // Same for WCDMA as for GPRS above
+        ret = GetBearerSupportInfo( EBearerIdWCDMA, byCell, byPhone );
+        LOGIT2("Bearer support (WCDMA): byCell %d, byPhone %d", byCell, byPhone)
+        if ( ret != KErrNone )
+            {
+            LOGIT1("SERVER: DtmStateChanged: GetBearerSupportInfo (WCDMA) returned error <%d>", ret)
+            return; // No event on error
+            }
+
+        eventInfo.iConnectionId = EBearerIdWCDMA;
+        if ( byCell && byPhone )
+            {
+            LOGIT("SERVER: EVENT -> Packet data AVAILABLE (WCDMA), DTM or no call is active")
+            eventInfo.iEventType = EConnMonPacketDataAvailable;
+            }
+        else
+            {
+            LOGIT("SERVER: EVENT -> Packet data UNAVAILABLE (WCDMA), no WCDMA bearer")
+            eventInfo.iEventType = EConnMonPacketDataUnavailable;
+            }
+        // Send event to all clients that are listening for bearer EBearerIdWCDMA
+        iServer->EventQueue()->Add( eventInfo );
+        }
+
+    LOGEXITFN("CConnMonIAP::DtmStateChanged()")
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonIAP::PhoneLineStatusChange
+// -----------------------------------------------------------------------------
+//
+void CConnMonIAP::PhoneLineStatusChange()
+    {
+    LOGENTRFN("CConnMonIAP::PhoneLineStatusChange()")
+
+    // At this time the implementation would be identical
+    // to DtmStateChanged so we just call it
+    DtmStateChanged();
+
+    LOGEXITFN("CConnMonIAP::PhoneLineStatusChange()")
+    }
+
+
+// PRIVATE METHODS BELOW
+
+// -----------------------------------------------------------------------------------
+// CConnMonIAP::OpenAndAttachTo
+// Opens and attaches an RConnection instance.
+// -----------------------------------------------------------------------------------
+//
+TInt CConnMonIAP::OpenAndAttachTo( TConnInfo& aConnInfo )
+    {
+    //LOGENTRFN("CConnMonIAP::OpenAndAttachTo()")
+    TInt err( KErrNone );
+    TConnectionInfo info;
+    TPckg<TConnectionInfo> pckgInfo( info );
+
+    // Leave left out intentionally, check for NULL instead
+    aConnInfo.iConnAttach = new RConnection(); // No (ELeave)
+    if ( !aConnInfo.iConnAttach )
+        {
+        err = KErrNoMemory;
+        }
+    if ( KErrNone == err )
+        {
+        err = aConnInfo.iConnAttach->Open( iSocketServer, KAfInet );
+        }
+
+    if ( KErrNone == err )
+        {
+        info.iIapId = aConnInfo.iIapId;
+        info.iNetId = aConnInfo.iNetId;
+
+        err = aConnInfo.iConnAttach->Attach( pckgInfo, RConnection::EAttachTypeMonitor );
+        if ( err != KErrNone )
+            {
+            aConnInfo.iConnAttach->Close();
+            delete aConnInfo.iConnAttach;
+            }
+        }
+
+    //LOGEXITFN1("CConnMonIAP::OpenAndAttachTo()", err)
+    return err;
+    }
+
+// -----------------------------------------------------------------------------------
+// CConnMonIAP::StopConnection
+// Closes a connection.
+// -----------------------------------------------------------------------------------
+//
+TInt CConnMonIAP::StopConnection( const TInt aIndex )
+    {
+    LOGENTRFN("CConnMonIAP::StopConnection()")
+    TInt err( KErrNone );
+
+    if ( ( aIndex < 0 ) || ( aIndex >= iConnInfos.Count() ) )
+        {
+        LOGEXITFN1("CConnMonIAP::StopConnection()", KErrArgument)
+        return KErrArgument;
+        }
+
+    if ( iConnInfos[aIndex].iBearer < EBearerExternalCSD )
+        {
+        // Stop an internal connection
+        RConnection connection;
+        TConnectionInfo info;
+
+        // Cancel data volume and activity notifiers before stopping
+        if ( iConnInfos[aIndex].iDLDataNotifier != 0 )
+            {
+            iConnInfos[aIndex].iDLDataNotifier->Cancel();
+            }
+        if ( iConnInfos[aIndex].iULDataNotifier != 0 )
+            {
+            iConnInfos[aIndex].iULDataNotifier->Cancel();
+            }
+        if ( iConnInfos[aIndex].iDataVolumeAO != 0 )
+            {
+            iConnInfos[aIndex].iDataVolumeAO->Cancel();
+            }
+        if ( iConnInfos[aIndex].iActivityNotifier != 0 )
+            {
+            iConnInfos[aIndex].iActivityNotifier->Cancel();
+            }
+
+        // RConnection object with EAttachTypeNormal is needed for stopping
+        err = connection.Open( iSocketServer, KAfInet );
+        if ( KErrNone == err )
+            {
+            info.iIapId = iConnInfos[aIndex].iIapId;
+            info.iNetId = iConnInfos[aIndex].iNetId;
+
+            err = connection.Attach( TPckg<TConnectionInfo>( info ),
+                    RConnection::EAttachTypeNormal );
+            if ( KErrNone == err )
+                {
+                err = connection.Stop( RConnection::EStopAuthoritative );
+                if ( KErrNone == err )
+                    {
+                    // Stop notifications, delete connection settings and remove from the table
+                    // If conn up/down notifier is active, let the event remove connection later.
+                    if ( !iConnUpDownNotifier || !iConnUpDownNotifier->IsActive() )
+                        {
+                        RemoveConnection( iConnInfos[aIndex] );
+                        }
+                    }
+                else
+                    {
+                    LOGIT1("StopConnection: RConnection::Stop() failed <%d>", err)
+                    }
+                }
+            else
+                {
+                LOGIT1("StopConnection: RConnection::Attach() failed <%d>", err)
+                }
+            connection.Close();
+            }
+        else
+            {
+            LOGIT1("StopConnection: RConnection::Open() failed <%d>", err)
+            }
+        }
+
+    else if ( iConnInfos[aIndex].iBearer == EBearerExternalGPRS     ||
+              iConnInfos[aIndex].iBearer == EBearerExternalEdgeGPRS ||
+              iConnInfos[aIndex].iBearer == EBearerExternalWCDMA    ||
+              iConnInfos[aIndex].iBearer == EBearerExternalCDMA2000 ||
+              ( !iConnInfos[aIndex].iBearerInfo.iInternal &&
+                ( iConnInfos[aIndex].iBearerInfo.iBearer == EBearerInfoHSDPA ||
+                  iConnInfos[aIndex].iBearerInfo.iBearer == EBearerInfoHSUPA ||
+                  iConnInfos[aIndex].iBearerInfo.iBearer == EBearerInfoHSxPA ) ) )
+        {
+        // EXTERNAL PSD
+        if ( iPsdFax )
+            {
+            err = iPsdFax->Stop( iConnInfos[aIndex].iConnectionId );
+            }
+        else
+            {
+            err = KErrNotFound;
+            }
+        }
+
+    else if ( iConnInfos[aIndex].iBearer == EBearerExternalCSD   ||
+              iConnInfos[aIndex].iBearer == EBearerExternalHSCSD ||
+              iConnInfos[aIndex].iBearer == EBearerExternalWcdmaCSD )
+        {
+        // EXTERNAL CSD
+        if ( iCsdFax )
+            {
+            err = iCsdFax->Stop();
+            }
+        else
+            {
+            err = KErrNotFound;
+            }
+        }
+    else
+        {
+        err = KErrNotSupported;
+        }
+
+    LOGEXITFN1("CConnMonIAP::StopConnection()", err)
+    return err;
+    }
+
+// -----------------------------------------------------------------------------------
+// CConnMonIAP::AddConnNotificationsL
+// Adds connection specific event watchers (connection status, data volume, activity).
+// -----------------------------------------------------------------------------------
+//
+void CConnMonIAP::AddConnNotificationsL( const TInt& aIndex )
+    {
+    LOGENTRFN("CConnMonIAP::AddConnNotificationsL()")
+
+    if ( iConnInfos[aIndex].iBearer < EBearerExternalCSD )
+        {
+        // INTERNAL CONNECTIONS
+        TInt connectionStatus( 0 );
+        GetConnectionStatus( aIndex, connectionStatus );
+
+        // ----------------------
+        // Connection Status
+        // ----------------------
+        if ( iConnInfos[aIndex].iProgressNotifier == 0 )
+            {
+            TInt subConnectionId( 0 );
+
+            // Create an active object and add it to scheduler
+            iConnInfos[aIndex].iProgressNotifier = new( ELeave ) CProgressNotifier(
+                    iServer,
+                    iConnInfos[aIndex].iConnAttach,
+                    iConnInfos[aIndex].iConnectionId,
+                    subConnectionId );
+
+            iConnInfos[aIndex].iProgressNotifier->Construct();
+
+            if ( iConnUpDownNotifier->IsActive() )
+                {
+                // Client is starting notifications. Filter old status events.
+                iConnInfos[aIndex].iProgressNotifier->Receive( connectionStatus );
+                }
+            else
+                {
+                // Event is starting notifification. No filtering is needed.
+                iConnInfos[aIndex].iProgressNotifier->Receive();
+                }
+            }
+
+        // -------------------------
+        // Amount of Downlink data
+        // -------------------------
+        if ( iConnInfos[aIndex].iDLDataNotifier == 0 )
+            {
+            TInt subConnectionId( 0 );
+
+            // Create an active object and add it to scheduler
+            iConnInfos[aIndex].iDLDataNotifier = new( ELeave ) CDataNotifier(
+                    iServer,
+                    iConnInfos[aIndex].iConnAttach,
+                    iConnInfos[aIndex].iConnectionId,
+                    subConnectionId,
+                    CDataNotifier::EDownlink);
+
+            iConnInfos[aIndex].iDLDataNotifier->Construct();
+
+            if ( ( connectionStatus == KLinkLayerOpen ) ||
+                 ( connectionStatus == KPsdSuspended ) )
+                {
+                iConnInfos[aIndex].iDLDataNotifier->Receive();
+                }
+            }
+
+        // -------------------------
+        // Amount of Uplink data
+        // -------------------------
+        if ( iConnInfos[aIndex].iULDataNotifier == 0 )
+            {
+            TInt subConnectionId( 0 );
+
+            // Create an active object and add it to scheduler
+            iConnInfos[aIndex].iULDataNotifier = new( ELeave ) CDataNotifier(
+                    iServer,
+                    iConnInfos[aIndex].iConnAttach,
+                    iConnInfos[aIndex].iConnectionId,
+                    subConnectionId,
+                    CDataNotifier::EUplink);
+
+            iConnInfos[aIndex].iULDataNotifier->Construct();
+
+            if ( ( connectionStatus == KLinkLayerOpen ) ||
+                 ( connectionStatus == KPsdSuspended ) )
+                {
+                iConnInfos[aIndex].iULDataNotifier->Receive();
+                }
+            }
+
+        // ---------------------------------------
+        // Connection down event with data volumes
+        // ---------------------------------------
+        if ( iConnInfos[aIndex].iConnDownNotifier == 0 )
+            {
+            TInt subConnectionId( 0 );
+
+            // Create an active object and add it to scheduler
+            iConnInfos[aIndex].iConnDownNotifier = new( ELeave ) CSubConnUpDownNotifier(
+                    iServer,
+                    iConnInfos[aIndex].iConnAttach,
+                    iConnInfos[aIndex].iConnectionId,
+                    subConnectionId );
+
+            iConnInfos[aIndex].iConnDownNotifier->Construct();
+
+            // Receiving will start only when connection status reaches KLinkLayerOpen
+            if ( ( connectionStatus == KLinkLayerOpen ) ||
+                 ( connectionStatus == KPsdSuspended ) )
+                {
+                iConnInfos[aIndex].iConnDownNotifier->Receive();
+                }
+            }
+
+        // ----------------------
+        // Connection Activity
+        // ----------------------
+        if ( iConnInfos[aIndex].iActivityNotifier == 0 )
+            {
+            // To update internal table fast at the first time
+            if ( ( connectionStatus == KLinkLayerOpen ) ||
+                 ( connectionStatus == KPsdSuspended ) )
+                {
+                GetActivityOneShotL( aIndex );
+                }
+            }
+        else
+            {
+            if ( !iConnInfos[aIndex].iActivityNotifier->IsActive() )
+                {
+                iConnInfos[aIndex].iActivityNotifier->Receive( iConnInfos[aIndex].iActivity );
+                }
+            }
+
+        // ----------------------
+        // Connection Bearer
+        // ----------------------
+        if ( iConnInfos[aIndex].iBearerNotifier == 0 )
+            {
+            // Create an active object and add it to scheduler
+            iConnInfos[aIndex].iBearerNotifier = CConnMonBearerNotifier::NewL(
+                    iServer,
+                    iMobilePhone,
+                    iConnInfos[aIndex].iConnectionId );
+
+            // Receiving will start only when connection status reaches KLinkLayerOpen
+            if ( ( connectionStatus == KLinkLayerOpen ) ||
+                 ( connectionStatus == KPsdSuspended ) )
+                {
+                iConnInfos[aIndex].iBearerNotifier->Listen();
+                }
+            }
+
+        // Note. iDataVolumeAO is created when client asks data volume info
+        }
+    LOGEXITFN("CConnMonIAP::AddConnNotificationsL()")
+    }
+
+// -----------------------------------------------------------------------------------
+// CConnMonIAP::DeleteConnNotifications
+// Deletes event watchers owned by a connection
+// -----------------------------------------------------------------------------------
+//
+void CConnMonIAP::DeleteConnNotifications( const TInt& aIndex )
+    {
+    LOGENTRFN("CConnMonIAP::DeleteConnNotifications()")
+    if ( iConnInfos[ aIndex ].iBearer < EBearerExternalCSD )
+        {
+        if ( iConnInfos[ aIndex ].iProgressNotifier )
+            {
+            iConnInfos[ aIndex ].iProgressNotifier->Cancel();
+            delete iConnInfos[ aIndex ].iProgressNotifier;
+            iConnInfos[ aIndex ].iProgressNotifier = NULL;
+            }
+
+        if ( iConnInfos[ aIndex ].iDLDataNotifier )
+            {
+            iConnInfos[ aIndex ].iDLDataNotifier->Cancel();
+            delete iConnInfos[ aIndex ].iDLDataNotifier;
+            iConnInfos[ aIndex ].iDLDataNotifier = NULL;
+            }
+
+        if ( iConnInfos[ aIndex ].iULDataNotifier )
+            {
+            iConnInfos[ aIndex ].iULDataNotifier->Cancel();
+            delete iConnInfos[ aIndex ].iULDataNotifier;
+            iConnInfos[ aIndex ].iULDataNotifier = NULL;
+            }
+
+        if ( iConnInfos[ aIndex ].iDataVolumeAO )
+            {
+            iConnInfos[ aIndex ].iDataVolumeAO->Cancel();
+            delete iConnInfos[ aIndex ].iDataVolumeAO;
+            iConnInfos[ aIndex ].iDataVolumeAO = NULL;
+            }
+
+        if ( iConnInfos[ aIndex ].iConnDownNotifier )
+            {
+            iConnInfos[ aIndex ].iConnDownNotifier->Cancel();
+            delete iConnInfos[ aIndex ].iConnDownNotifier;
+            iConnInfos[ aIndex ].iConnDownNotifier = NULL;
+            }
+
+        if ( iConnInfos[ aIndex ].iActivityNotifier )
+            {
+            iConnInfos[ aIndex ].iActivityNotifier->Cancel();
+            delete iConnInfos[ aIndex ].iActivityNotifier;
+            iConnInfos[ aIndex ].iActivityNotifier = NULL;
+            }
+
+        if ( iConnInfos[ aIndex ].iBearerNotifier )
+            {
+            iConnInfos[ aIndex ].iBearerNotifier->CancelListen();
+            delete iConnInfos[ aIndex ].iBearerNotifier;
+            iConnInfos[ aIndex ].iBearerNotifier = NULL;
+            }
+        }
+    LOGEXITFN("CConnMonIAP::DeleteConnNotifications()")
+    }
+
+// -----------------------------------------------------------------------------------
+// CConnMonIAP::DeleteNotifications
+// Deletes all the event watchers from the system (expect connection up/down events)
+// -----------------------------------------------------------------------------------
+//
+void CConnMonIAP::DeleteNotifications()
+    {
+    if( iTelephonyNotifier )
+        {
+        delete iTelephonyNotifier;
+        iTelephonyNotifier = NULL;
+        }
+
+    if( iDualTransferModeNotifier )
+        {
+        delete iDualTransferModeNotifier;
+        iDualTransferModeNotifier = NULL;
+        }
+
+    if ( iPsdNetwStatusNotifier )
+        {
+        // Cancel any outstanding requests
+        iPsdNetwStatusNotifier->Cancel();
+        delete iPsdNetwStatusNotifier;
+        iPsdNetwStatusNotifier = NULL;
+        }
+
+    if ( iNetwRegistrationNotifier )
+        {
+        // Cancel any outstanding requests
+        iNetwRegistrationNotifier->Cancel();
+        delete iNetwRegistrationNotifier;
+        iNetwRegistrationNotifier = NULL;
+        }
+
+    if ( iEdgeNotifier )
+        {
+        // Cancel any outstanding requests
+        iEdgeNotifier->Cancel();
+        delete iEdgeNotifier;
+        iEdgeNotifier = NULL;
+        }
+
+    if ( iWcdmaNotifier )
+        {
+        iWcdmaNotifier->Cancel();
+        delete iWcdmaNotifier;
+        iWcdmaNotifier = NULL;
+        }
+
+    if ( iModeNotifier )
+        {
+        // Cancel any outstanding requests
+        iModeNotifier->Cancel();
+        delete iModeNotifier;
+        iModeNotifier = NULL;
+        }
+
+    if ( iGSMSignalNotifier )
+        {
+        // Cancel any outstanding requests
+        iGSMSignalNotifier->Cancel();
+        delete iGSMSignalNotifier;
+        iGSMSignalNotifier = NULL;
+        }
+
+    if ( iGSMBearerAvailabilityNotifier )
+        {
+        // Cancel any outstanding requests
+        iGSMBearerAvailabilityNotifier->Cancel();
+        delete iGSMBearerAvailabilityNotifier;
+        iGSMBearerAvailabilityNotifier = NULL;
+        }
+
+    if ( iWlanSupport )
+        {
+        iWlanSupport->DisableEventsToClients();
+        }
+
+    // Delete notifications owned by the connections
+    TInt count = iConnInfos.Count();
+    for ( TInt i = 0; i < count; i++ )
+        {
+        DeleteConnNotifications( i );
+        }
+    }
+
+// -----------------------------------------------------------------------------------
+// CConnMonIAP::NewConnectionId
+// Returns a new unique connection id for the connection.
+// -----------------------------------------------------------------------------------
+//
+TUint CConnMonIAP::NewConnectionId()
+    {
+    ++iIdCounter;
+
+    if ( iIdCounter == KMaxConnectionId )
+        {
+        iIdCounter = 1;
+        }
+
+    return iIdCounter;
+    }
+
+// -----------------------------------------------------------------------------------
+// CConnMonIAP::Index
+// Finds the index of the matching object within the array.
+// KErrNotFound, if no matching object can be found.
+// -----------------------------------------------------------------------------------
+//
+TInt CConnMonIAP::Index( const TUint& aConnectionId )
+    {
+    TInt count = iConnInfos.Count();
+    for ( TInt i = 0; i < count; i++ )
+        {
+        if ( iConnInfos[i].iConnectionId == aConnectionId )
+            {
+            return i;
+            }
+        }
+
+    return KErrNotFound;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonIAP::GetAccessPointName
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonIAP::GetAccessPointName( const TUint& aConnectionId, TDes& aName )
+    {
+    LOGENTRFN("CConnMonIAP::GetAccessPointName()")
+    TInt err( KErrNone );
+
+    // Find connection matching the given Id
+    TInt index = Index( aConnectionId );
+    if ( index < 0  )
+        {
+        err = KErrNotFound;
+        }
+    else
+        {
+        // Find out access point name
+        TBuf<KCommsDbSvrMaxFieldLength> settingName;
+        TBuf<KCommsDbSvrMaxFieldLength> settingValue;
+        settingName.Copy( TPtrC( IAP ) );
+        settingName.Append( TChar( '\\' ) );
+        settingName.Append( TPtrC( IAP_SERVICE_TYPE ) );
+
+        err = iConnInfos[index].iConnAttach->GetDesSetting(
+                TPtrC( settingName ),
+                settingValue );
+        if ( KErrNone == err )
+            {
+            if ( settingValue == TPtrC( OUTGOING_WCDMA ) ||
+                    settingValue == TPtrC( INCOMING_WCDMA ) )
+                {
+                settingName.Copy( settingValue );
+                settingName.Append( TChar( '\\' ) );
+                settingName.Append( TPtrC( GPRS_APN ) );
+
+                err = iConnInfos[index].iConnAttach->GetDesSetting(
+                        TPtrC( settingName ),
+                        aName );
+                }
+            else
+                {
+                err = KErrNotFound;
+                }
+            }
+        }
+
+    LOGEXITFN1("CConnMonIAP::GetAccessPointName()", err)
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonIAP::GetTelNumber
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonIAP::GetTelNumber( const TUint& aConnectionId, TDes& aTelNum )
+    {
+    LOGENTRFN("CConnMonIAP::GetTelNumber()")
+    TInt err( KErrNone );
+
+    // Find connection matching the given Id
+    TInt index = Index( aConnectionId );
+    if ( index < 0  )
+        {
+        err = KErrNotFound;
+        }
+    else
+        {
+        // Find out tel. number
+        TBuf<KCommsDbSvrMaxFieldLength> settingName;
+        TBuf<KCommsDbSvrMaxFieldLength> settingValue;
+        settingName.Copy( TPtrC( IAP ) );
+        settingName.Append( TChar( '\\' ) );
+        settingName.Append( TPtrC( IAP_SERVICE_TYPE ) );
+
+        err = iConnInfos[index].iConnAttach->GetDesSetting(
+                TPtrC( settingName ),
+                settingValue );
+        if ( KErrNone == err )
+            {
+            if ( settingValue == TPtrC( DIAL_OUT_ISP ) ||
+                    settingValue == TPtrC( DIAL_IN_ISP ) )
+                {
+                settingName.Copy( settingValue );
+                settingName.Append( TChar( '\\' ) );
+                settingName.Append( TPtrC( ISP_DEFAULT_TEL_NUM ) );
+
+                err = iConnInfos[index].iConnAttach->GetDesSetting(
+                        TPtrC( settingName ),
+                        aTelNum );
+                }
+            else
+                {
+                err = KErrNotFound;
+                }
+            }
+        }
+
+    LOGEXITFN1("CConnMonIAP::GetTelNumber()", err)
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonIAP::GetConnectionStatus
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonIAP::GetConnectionStatus( const TInt& aIndex, TInt& aConnectionStatus )
+    {
+    //LOGENTRFN("CConnMonIAP::GetConnectionStatus()")
+    TInt err( KErrNone );
+    TNifProgress nifProgress;
+
+    if ( ( aIndex < 0 ) || ( aIndex >= iConnInfos.Count() ) )
+        {
+        LOGIT1("GetConnectionStatus: invalid index value: %d", aIndex)
+        err = KErrArgument;
+        }
+    else
+        {
+        aConnectionStatus = 0;
+        err = iConnInfos[aIndex].iConnAttach->Progress( nifProgress );
+        if ( KErrNone == err )
+            {
+            aConnectionStatus = nifProgress.iStage;
+            LOGIT1("GetConnectionStatus: iConnAttach->Progress() status: %d", aConnectionStatus)
+            }
+        else
+            {
+            LOGIT1("GetConnectionStatus: ERROR getting progress status <%d>", err)
+            }
+        }
+
+    //LOGEXITFN1("CConnMonIAP::GetConnectionStatus()", err)
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonIAP::GetPsdNetworkStatus
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonIAP::GetPsdNetworkStatus( TInt& aNetworkStatus ) const
+    {
+    LOGENTRFN("CConnMonIAP::GetPsdNetworkStatus()")
+    TInt err( KErrNone );
+
+    if ( iTSYLoaded && iPacketServLoaded )
+        {
+        RPacketService::TStatus packetStatus;
+        err = iPacketService.GetStatus( packetStatus );
+        if ( KErrNone == err )
+            {
+            aNetworkStatus = CalculateNetworkStatus( packetStatus );
+            LOGIT1("GetPsdNetworkStatus: status %d", aNetworkStatus)
+            }
+        }
+    else
+        {
+        aNetworkStatus = EConnMonStatusUnattached;
+        }
+
+    LOGEXITFN1("CConnMonIAP::GetPsdNetworkStatus()", err)
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonIAP::GetNetworkRegistrationMode
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonIAP::GetNetworkRegistrationMode( TInt& aRegistration ) const
+    {
+    return GetNetworkRegistration( aRegistration );
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonIAP::GetNetworkRegistration
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonIAP::GetNetworkRegistration( TInt& aRegistration ) const
+    {
+    LOGENTRFN("CConnMonIAP::GetNetworkRegistration()")
+    TInt err( KErrNone );
+
+    if ( !FeatureManager::FeatureSupported( KFeatureIdNetworkRegistration ) )
+        {
+        LOGIT("GetNetworkRegistration: KFeatureIdNetworkRegistration not supported")
+        err = KErrNotSupported;
+        }
+    else
+        {
+        if ( iTSYLoaded )
+            {
+            TRequestStatus status( KErrNone );
+            RMobilePhone::TMobilePhoneRegistrationStatus registration(
+                    RMobilePhone::ERegistrationUnknown );
+
+            iMobilePhone.GetNetworkRegistrationStatus( status, registration );
+            User::WaitForRequest( status );
+            err = status.Int();
+            if ( KErrNone == err )
+                {
+                aRegistration = CalculateNetworkRegistration( registration );
+                LOGIT1("GetNetworkRegistration: registration %d", aRegistration)
+                }
+            }
+        else
+            {
+            aRegistration = ENetworkRegistrationNotAvailable;
+            }
+        }
+
+    LOGEXITFN1("CConnMonIAP::GetNetworkRegistration()", err)
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonIAP::GetNetworkRegistration_v2
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonIAP::GetNetworkRegistration_v2( TInt& aRegistration ) const
+    {
+    LOGENTRFN("CConnMonIAP::GetNetworkRegistration_v2()")
+    TInt err( KErrNone );
+
+    if ( !FeatureManager::FeatureSupported( KFeatureIdNetworkRegistration ) )
+        {
+        LOGIT("GetNetworkRegistration_v2: KFeatureIdNetworkRegistration not supported")
+        err = KErrNotSupported;
+        }
+    else
+        {
+        if ( iTSYLoaded )
+            {
+            TRequestStatus status( KErrNone );
+            RMobilePhone::TMobilePhoneRegistrationStatus registration(
+                    RMobilePhone::ERegistrationUnknown );
+
+            iMobilePhone.GetNetworkRegistrationStatus( status, registration );
+            User::WaitForRequest( status );
+            err = status.Int();
+            if ( KErrNone == err )
+                {
+                aRegistration = CalculateNetworkRegistration_v2( registration );
+                LOGIT1("GetNetworkRegistration_v2: registration <%d>", aRegistration )
+                }
+            }
+        else
+            {
+            aRegistration = ENetworkRegistrationExtNotAvailable;
+            }
+        }
+
+    LOGEXITFN1("CConnMonIAP::GetNetworkRegistration_v2()", err)
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonIAP::GetGSMSignalStrength
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonIAP::GetGSMSignalStrength( TInt& aSignalStrength ) const
+    {
+    LOGENTRFN("CConnMonIAP::GetGSMSignalStrength()")
+    TInt err( KErrNone );
+
+    if ( iTSYLoaded )
+        {
+        TRequestStatus status( KErrNone );
+        TInt32 strength( 0 );
+        TInt8 bar( -1 );
+
+        iMobilePhone.GetSignalStrength( status, strength, bar );
+        User::WaitForRequest( status );
+
+        err = status.Int();
+        if ( KErrNone == err )
+            {
+            aSignalStrength = strength;
+            LOGIT1("GetGSMSignalStrength: strength %d", aSignalStrength)
+            }
+        }
+    else
+        {
+        err = KErrNotSupported;
+        }
+
+    LOGEXITFN1("CConnMonIAP::GetGSMSignalStrength()", err)
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonIAP::GetProtocolTypeL
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonIAP::GetProtocolTypeL( const TUint& aConnectionId, TInt& aProtocolType )
+    {
+    LOGENTRFN("CConnMonIAP::GetProtocolTypeL()")
+    TInt err( KErrNone );
+
+    // Find connection matching the given Id
+    TInt index = Index( aConnectionId );
+    if ( index < 0  )
+        {
+        LOGEXITFN1("CConnMonIAP::GetProtocolTypeL()", KErrNotFound)
+        return KErrNotFound;
+        }
+
+    aProtocolType = EProtocolTypeUnknown;
+
+    if ( iTSYLoaded && iPacketServLoaded )
+        {
+        // Get AP name for the connection
+        TBuf<KCommsDbSvrMaxFieldLength> apName;
+
+        err = GetAccessPointName( iConnInfos[index].iConnectionId, apName );
+
+        if ( KErrNotFound == err )
+            {
+            LOGEXITFN1("CConnMonIAP::GetProtocolTypeL()", err)
+            return err;
+            }
+
+        // Enumerate all PDP contexts
+        TRequestStatus status( KErrNone );
+        TInt contextCount( 0 );
+        TInt maxContextCount( 0 );
+
+        iPacketService.EnumerateContexts( status, contextCount, maxContextCount );
+        User::WaitForRequest( status );
+
+        err = status.Int();
+        if ( err != KErrNone )
+            {
+            LOGEXITFN1("CConnMonIAP::GetProtocolTypeL()", err)
+            return err;
+            }
+
+        RPacketService::TContextInfo contextInfo;
+        RPacketContext context;
+        CleanupClosePushL( context );
+
+        // Find PDP contexts matching the given connectionId
+        for ( TInt i = 0; ( i < contextCount ) && ( aProtocolType != EProtocolTypeIP ); i++ )
+            {
+            iPacketService.GetContextInfo( status, i, contextInfo ); //iName, iStatus
+            User::WaitForRequest( status );
+
+            err = status.Int();
+            if ( err != KErrNone )
+                {
+                LOGEXITFN1("CConnMonIAP::GetProtocolTypeL()", err)
+                return err;
+                }
+
+            err = context.OpenExistingContext( iPacketService, contextInfo.iName );
+            if ( err != KErrNone )
+                {
+                LOGEXITFN1("CConnMonIAP::GetProtocolTypeL()", err)
+                return err;
+                }
+
+            RPacketContext::TContextConfigGPRS* getParams;
+            getParams = new( ELeave ) RPacketContext::TContextConfigGPRS();
+            TPckg<RPacketContext::TContextConfigGPRS> getContextConfigPckg( *getParams );
+
+            context.GetConfig( status, getContextConfigPckg );
+            User::WaitForRequest( status );
+
+            err = status.Int();
+            if ( KErrNone == err )
+                {
+                TInt ret = CompareAccessPointNames( apName, getParams->iAccessPointName );
+
+                if ( ret == 0 )
+                    {
+                    // PDP context matching the IAP connection found
+                    if ( getParams->iPdpType == RPacketContext::EPdpTypeIPv4 )
+                        {
+                        if ( aProtocolType == EProtocolTypeIPv6 )
+                            {
+                            aProtocolType = EProtocolTypeIP;    // Both 4 & 6
+                            }
+                        else
+                            {
+                            aProtocolType = EProtocolTypeIPv4;
+                            }
+                        }
+                    else if ( getParams->iPdpType == RPacketContext::EPdpTypeIPv6 )
+                        {
+                        if ( aProtocolType == EProtocolTypeIPv4 )
+                            {
+                            aProtocolType = EProtocolTypeIP;    // Both 4 & 6
+                            }
+                        else
+                            {
+                            aProtocolType = EProtocolTypeIPv6;
+                            }
+                        }
+                    else
+                        {
+                        aProtocolType = EProtocolTypeUnknown;
+                        }
+                    }
+                }
+
+            delete getParams;
+            context.Close();
+
+            if ( err != KErrNone )
+                {
+                break;
+                }
+            } // for
+        CleanupStack::PopAndDestroy( &context );
+        } // if
+
+    LOGEXITFN1("CConnMonIAP::GetProtocolTypeL()", err)
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonIAP::GetActivityOneShotL
+// -----------------------------------------------------------------------------
+//
+void CConnMonIAP::GetActivityOneShotL( const TInt& aIndex )
+    {
+    if ( iConnInfos[aIndex].iActivityNotifier == 0 )
+        {
+        iConnInfos[aIndex].iActivityNotifier = new( ELeave ) CActivityNotifier(
+                iServer,
+                iConnInfos[aIndex].iConnAttach,
+                iConnInfos[aIndex].iConnectionId,
+                0 );
+        iConnInfos[aIndex].iActivityNotifier->Construct();
+        }
+
+    if ( !iConnInfos[aIndex].iActivityNotifier->IsActive() )
+        {
+        iConnInfos[aIndex].iActivityNotifier->ReceiveOne(
+                iConnInfos[aIndex].iActivity );
+
+        // This AO will cancel the activity notifier after one second in case it has not completed.
+        // AO will destroy itself in RunL.
+        CTimerAO* timerAO = new( ELeave ) CTimerAO(
+                iServer,
+                iConnInfos[aIndex].iConnectionId,
+                iConnInfos[aIndex].iActivity );
+
+        CleanupStack::PushL( timerAO );
+        timerAO->ConstructL();
+        CleanupStack::Pop( timerAO );
+
+        timerAO->Start();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonIAP::GetBearerFromETel
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonIAP::GetBearerFromETel(
+        const TDes& aNumber,
+        TInt& aBearer,
+        TBearerInfo& aBearerInfo )
+    {
+    TInt ret( KErrNone );
+    TInt countCalls( 0 );
+    RLine line;
+    RMobileCall call;
+
+    // Get phone info
+    RTelServer::TPhoneInfo phoneInfo;
+    ret = iTelServer.GetPhoneInfo( 0, phoneInfo );
+    if ( KErrNone != ret )
+        {
+        return ret;
+        }
+
+    ret = line.Open( iMobilePhone, KMmTsyDataLineName );
+    if ( KErrNone != ret )
+        {
+        return ret;
+        }
+
+    // Enumerate calls on data line
+    ret = line.EnumerateCall( countCalls );
+    if ( KErrNone != ret )
+        {
+        line.Close();
+        return ret;
+        }
+
+    // Get call info
+    for ( TInt j = 0; j < countCalls; j++ )
+        {
+        RLine::TCallInfo callInfo;
+
+        ret = line.GetCallInfo( j, callInfo );
+        if ( KErrNone != ret )
+            {
+            line.Close();
+            return ret;
+            }
+
+        if ( callInfo.iStatus != RCall::EStatusIdle )
+            {
+            TName callName;
+
+            callName.Copy( phoneInfo.iName );
+            callName.Append( KDoubleColon );
+            callName.Append( KMmTsyDataLineName );
+            callName.Append( KDoubleColon );
+            callName.Append( callInfo.iCallName );
+
+            ret = call.OpenExistingCall( iTelServer, callName );
+            if ( KErrNone != ret )
+                {
+                line.Close();
+                return ret;
+                }
+
+            RMobileCall::TMobileCallInfoV1 info;
+            RMobileCall::TMobileCallInfoV1Pckg infoPckg( info );
+
+            ret = call.GetMobileCallInfo( infoPckg );
+            if ( KErrNone == ret )
+                {
+                if ( infoPckg().iRemoteParty.iRemoteNumber.iTelNumber.Length() > 0 )
+                    {
+                    ret = aNumber.Compare( infoPckg().iRemoteParty.iRemoteNumber.iTelNumber );
+                    }
+                else if ( infoPckg().iDialledParty.iTelNumber.Length() > 0 )
+                    {
+                    ret = aNumber.Compare( infoPckg().iDialledParty.iTelNumber );
+                    }
+                else
+                    {
+                    ret = KErrNotFound;
+                    }
+
+                if ( ret == 0 )
+                    {
+                    aBearer = EBearerCSD;
+                    aBearerInfo.iBearer = EBearerInfoCSD;
+                    aBearerInfo.iInternal = ETrue;
+
+                    RMobileCall::TMobileCallHscsdInfoV1 hscsdInfo;
+                    RMobileCall::TMobileCallHscsdInfoV1Pckg hscsdInfoPckg( hscsdInfo );
+
+                    ret = call.GetCurrentHscsdInfo( hscsdInfoPckg );
+                    if ( KErrNone == ret )
+                        {
+                        if ( hscsdInfo.iAiur != RMobileCall::EAiurBpsUnspecified )
+                            {
+                            aBearer = EBearerHSCSD;
+                            aBearerInfo.iBearer = EBearerInfoHSCSD;
+                            }
+                        }
+                    call.Close();
+                    line.Close();
+                    return KErrNone;
+                    }
+                }
+            call.Close();
+            }
+        } // for
+    line.Close();
+    return KErrNotFound;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonIAP::CompareAccessPointNames
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonIAP::CompareAccessPointNames(
+        const TDesC& aNameFromCommDB,
+        const TDesC& aNameFromETel ) const
+    {
+    return ( aNameFromETel.Compare( aNameFromCommDB ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonIAP::CompareAccessPointNames
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonIAP::CompareAccessPointNames(
+        const TDesC& aNameFromCommDB,
+        const TDesC8& aNameFromETel ) const
+    {
+    TBuf<KCommsDbSvrMaxFieldLength> tempBuffer;
+
+    CnvUtfConverter::ConvertToUnicodeFromUtf8( tempBuffer, aNameFromETel );
+
+    return( tempBuffer.Compare( aNameFromCommDB ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonIAP::SendConnectionEvents
+// -----------------------------------------------------------------------------
+//
+void CConnMonIAP::SendConnectionEvents( TConnMonBearerInfo& /*aBearerinfo*/ )
+    {
+    if ( iConnInfos.Count() > 0 )
+        {
+        for ( TInt i = 0; i < iConnInfos.Count(); i++ )
+            {
+            if ( iConnInfos[i].iBearerNotifier )
+                {
+                iConnInfos[i].iBearerNotifier->SendBearerInfoEvent();
+                iConnInfos[i].iBearerNotifier->SendBearerGroupEvent();
+                }
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonIAP::LastProgressError
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonIAP::LastProgressError(
+        const TUint& aConnectionId,
+        TNifProgress& aProgress )
+    {
+    TInt err( KErrNone );
+
+    // Find connection matching the given Id
+    TInt index = Index( aConnectionId );
+
+    if ( index < 0  )
+        {
+        return KErrNotFound;
+        }
+
+    err = iConnInfos[index].iConnAttach->LastProgressError( aProgress );
+
+    LOGIT3("iConnection->Progress() ret <%d> stage %d error <%d>", err, aProgress.iStage, aProgress.iError)
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CConnMonIAP::WlanRssGoodEnough
+// ---------------------------------------------------------------------------
+//
+TBool CConnMonIAP::WlanRssGoodEnough()
+    {
+    //LOGENTRFN("CConnMonIAP::WlanRssGoodEnough()")
+    TBool value( EFalse );
+
+    if ( !iWlanSupport )
+        {
+        LOGIT("WlanRssGoodEnough: No WLAN support")
+        value = EFalse;
+        }
+    else
+        {
+        value = iWlanSupport->WlanRssGoodEnough();
+        }
+
+    //LOGEXITFN1("CConnMonIAP::WlanRssGoodEnough()", value)
+    return value;
+    }
+
+// ---------------------------------------------------------------------------
+// CConnMonIAP::DiscoverBearerId
+// ---------------------------------------------------------------------------
+//
+TInt CConnMonIAP::BearerIdForBearerAvailability(
+        const TUint& aConnId,
+        TUint& aBearerId )
+    {
+    LOGENTRFN("CConnMonIAP::BearerIdForBearerAvailability()")
+    TInt err( KErrNone );
+
+    TInt index = Index( aConnId );
+    if ( index < 0 )
+        {
+        // Bearer specific connection id given as attribute
+        switch ( aConnId )
+            {
+            case EBearerIdWLAN:     aBearerId = EBearerIdWLAN;      break;
+            case EBearerIdGPRS:     aBearerId = EBearerIdGPRS;      break;
+            case EBearerIdWCDMA:    aBearerId = EBearerIdWCDMA;     break;
+            case EBearerIdCSD:      aBearerId = EBearerIdCSD;       break;
+            case EBearerIdWcdmaCSD: aBearerId = EBearerIdWcdmaCSD;  break;
+            // Let session send this request to the plugin
+            case EBearerIdLAN:      err = KErrCancel;               break;
+            default:                err = KErrNotFound;             break;
+            }
+        }
+    else
+        {
+        // Valid connection id given as attribute
+        switch ( iConnInfos[index].iBearer )
+            {
+            case EBearerWLAN:               aBearerId = EBearerIdWLAN;      break;
+            case EBearerGPRS:
+            case EBearerEdgeGPRS:
+            case EBearerExternalGPRS:
+            case EBearerExternalEdgeGPRS:   aBearerId = EBearerIdGPRS;      break;
+            case EBearerWCDMA:
+            case EBearerExternalWCDMA:      aBearerId = EBearerIdWCDMA;     break;
+            case EBearerCSD:
+            case EBearerHSCSD:
+            case EBearerExternalCSD:
+            case EBearerExternalHSCSD:      aBearerId = EBearerIdCSD;       break;
+            case EBearerWcdmaCSD:
+            case EBearerExternalWcdmaCSD:   aBearerId = EBearerIdWcdmaCSD;  break;
+            // Let session send this request to the plugin
+            case EBearerLAN:                err = KErrCancel;               break;
+            default:                        err = KErrNotSupported;         break;
+            }
+        }
+
+    LOGEXITFN1("CConnMonIAP::BearerIdForBearerAvailability()", err)
+    return err;
+    }
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/src/ConnMonId.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,71 @@
+/*
+* Copyright (c) 2006-2008 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 an ID number.
+*
+*/
+
+#include <e32cmn.h>
+#include <rconnmon.h>
+
+#include "log.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+//  Construction
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TConnMonId::TConnMonId( TUint aId ): iId( aId )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+//  iId getter
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TUint TConnMonId::Id() const
+    {
+    return iId;
+    }
+
+// ---------------------------------------------------------------------------
+//  Convert to HBufC*
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const HBufC* TConnMonId::ToBuf() const
+    {
+    HBufC* buf = HBufC::New( KMaxSize );
+
+    LOG(_LIT(KPanicLocationMessage, "ConnectionMonitorServer: TConnMonId::ToBuf()");)
+    __ASSERT_DEBUG( buf, User::Panic( KPanicLocationMessage, KErrNoMemory ) );
+
+    if ( NULL != buf )
+        {
+        TPtr ptr( buf->Des() );
+        ptr.Append( iId );
+        }
+    return buf;
+    }
+
+// ---------------------------------------------------------------------------
+//  Convert from TPtrC
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TConnMonId TConnMonId::FromPtrC( const TPtrC& aPtrC )
+    {
+    TUint id( aPtrC[EId] );
+    return TConnMonId( id );
+    }
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/src/ConnMonIdsArrayPckg.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,151 @@
+/*
+* Copyright (c) 2006-2008 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:  A package class for TConnMonId objects.
+*
+*/
+
+#include <e32std.h>
+#include <rconnmon.h>
+
+#include "log.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Construction
+// data is packed to the following format
+// |all_data_amount|amount_of_transferring_data_(n)|item0|....|item(n-1)
+// each item is packed in following format
+// |size_of_item|item's_data
+// item's data can be unpacked by MDesSerializer::FromPtr(), implemented by an item's class
+// ---------------------------------------------------------------------------
+//
+ConnMonIdsArrayPckg::ConnMonIdsArrayPckg( const RArray<TConnMonId>& aRef, TUint aBufLen )
+    {
+    LOGENTRFN("ConnMonIdsArrayPckg::ConnMonIdsArrayPckg()")
+
+    const TUint KItemLengthFieldSize = 1;
+
+    // First 2 elements in buffer will contain the total number of objects and the number of transfered objects
+    TUint currentPosition( 2 );
+    TInt totalItemCount = aRef.Count();
+
+    LOGIT2("ConnMonIdsArrayPckg: buffer size %d, item count %d", aBufLen, totalItemCount)
+
+    // Create a temporary pointer array table for buffer objects
+    RPointerArray<HBufC> items;
+    // Add items until all added or buffer full
+    for ( TUint i = 0; i < totalItemCount; ++i )
+        {
+        const HBufC* item( aRef[i].ToBuf() );
+        if ( item )
+            {
+            // Check if there is room in buffer for the next item
+            if ( ( currentPosition + KItemLengthFieldSize + item->Length() ) > aBufLen )
+                {
+                LOGIT4("Buffer full, current position %d, item length %d, buffer size %d, i %d",
+                        currentPosition, item->Length(), aBufLen, i)
+                delete item;
+                item = NULL;
+                break;
+                }
+            currentPosition += KItemLengthFieldSize + item->Length();
+            items.Append( item );
+            }
+        }
+
+    // Check that given buffer length (aBufLen) is not smaller than one
+    // item (CConnMonWlanNetwork) + aRef count + items count + item length
+    if ( items.Count() == 0 && totalItemCount > 0 )
+        {
+        aBufLen = 2; // aRef.Count(), items.Count()
+        }
+
+    // Allocate memory for buffer
+    iBuf = HBufC::New( aBufLen );
+    if ( !iBuf )
+        {
+        LOGIT("ConnMonIdsArrayPckg: out of memory error")
+        }
+    else
+        {
+        // Add total and transferred counts to buffer
+        iBuf->Des().Append( totalItemCount ); // Total amount of objects
+        iBuf->Des().Append( items.Count() ); // Amount of objects in buffer
+
+        // Add item length and item data to buffer
+        for ( TUint i = 0; i < items.Count(); ++i )
+            {
+            iBuf->Des().Append( items[i]->Length() );
+            iBuf->Des().Append( *items[i] );
+            }
+        LOGIT1("Used buffer %d", iBuf->Length())
+        }
+    items.ResetAndDestroy();
+
+    LOGEXITFN("ConnMonIdsArrayPckg::ConnMonIdsArrayPckg()")
+    }
+
+// ---------------------------------------------------------------------------
+// Construction
+// ---------------------------------------------------------------------------
+//
+EXPORT_C ConnMonIdsArrayPckg::ConnMonIdsArrayPckg( TUint aBufSize )
+    {
+    iBuf = HBufC::New( aBufSize );
+    }
+
+// ---------------------------------------------------------------------------
+// Destruction
+// ---------------------------------------------------------------------------
+//
+EXPORT_C ConnMonIdsArrayPckg::~ConnMonIdsArrayPckg()
+    {
+    delete iBuf;
+    }
+
+// ---------------------------------------------------------------------------
+// Unpacking
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void ConnMonIdsArrayPckg::UnpackToL( RArray<TConnMonId>& aRef ) const
+    {
+    if ( !iBuf || iBuf->Length() < 2 )
+        {
+        User::Leave( KErrBadDescriptor );
+        }
+
+    TUint index( 0 );
+    TUint total( (*iBuf)[index++] ); // Amount of data totally to be transferred
+    TUint count( (*iBuf)[index++] ); // Amount of packed data
+
+    for ( TUint i = 0; i < count; ++i )
+        {
+        TUint len( (*iBuf)[index++] );
+        TPtrC ptr( iBuf->Mid( index, len ) );
+        User::LeaveIfError( aRef.Append( TConnMonId::FromPtrC( ptr ) ) );
+        index += len;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Getter
+// ---------------------------------------------------------------------------
+//
+EXPORT_C HBufC* ConnMonIdsArrayPckg::Buf() const
+    {
+    return iBuf;
+    }
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/src/ConnMonNoti.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,2395 @@
+/*
+* Copyright (c) 2002-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:  Event notifiers (active objects).
+*
+*/
+
+#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include <es_enum_partner.h>
+#endif
+#include <e32base.h>
+#include <rmmcustomapi.h>
+#include <featmgr.h>
+
+#include "ConnMonServ.h"
+#include "ConnMonSess.h"
+#include "CEventQueue.h"
+#include "ConnMonIAP.h"
+#include "ConnMonNoti.h"
+#include "ConnMonAvailabilityManager.h"
+#include "log.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CConnUpDownNotifier::CConnUpDownNotifier
+// -----------------------------------------------------------------------------
+//
+CConnUpDownNotifier::CConnUpDownNotifier(
+        CConnMonServer* aServer )
+        :
+        CActive( EConnMonPriorityNormal ),
+        iServer( aServer )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CConnUpDownNotifier::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CConnUpDownNotifier::Construct()
+    {
+    //LOGENTRFN("CConnUpDownNotifier::Construct()")
+    CActiveScheduler::Add( this );
+    LOGIT("Created CConnUpDownNotifier")
+    //LOGEXITFN("CConnUpDownNotifier::Construct()")
+    }
+
+// Destructor
+CConnUpDownNotifier::~CConnUpDownNotifier()
+    {
+    Cancel();
+    iServer = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnUpDownNotifier::Receive
+// Requests a new event (connection up/down) from RConnection
+// -----------------------------------------------------------------------------
+//
+void CConnUpDownNotifier::Receive()
+    {
+    if ( IsActive() )
+        {
+        Cancel();
+        }
+
+    iServer->Iap()->Rconnection()->AllInterfaceNotification( iInfoBuf, iStatus );
+    SetActive();
+    }
+
+// -----------------------------------------------------------------------------
+// CConnUpDownNotifier::DoCancel
+// Cancels the request from RConnection.
+// -----------------------------------------------------------------------------
+//
+void CConnUpDownNotifier::DoCancel()
+    {
+    if ( IsActive() )
+        {
+        iServer->Iap()->Rconnection()->CancelAllInterfaceNotification();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CConnUpDownNotifier::RunL
+// Handles the event that has arrived from RConnection
+// -----------------------------------------------------------------------------
+//
+void CConnUpDownNotifier::RunL()
+    {
+    //LOGENTRFN("CConnUpDownNotifier::RunL()")
+
+    // All RunL():s outside CServer-derived main class MUST NOT LEAVE.
+    // Use TRAPD when needed.
+
+    LOGIT(".")
+    LOGIT1("RunL: CConnUpDownNotifier, status <%d>", iStatus.Int())
+
+    if ( iStatus.Int() != KErrNone )
+        {
+        iErrorCounter++;
+        if ( iErrorCounter > KConnMonEventErrorThreshold )
+            {
+            LOGIT1("Over %d consecutive errors, stopping", KConnMonEventErrorThreshold)
+            return;
+            }
+        }
+    else
+        {
+        iErrorCounter = 0;
+        // Send event to clients
+        TInt err( KErrNone );
+        TBearerInfo bearerInfo;
+        TConnInfo connInfo(
+                iInfoBuf().iConnectionInfo.iIapId,
+                iInfoBuf().iConnectionInfo.iNetId,
+                0,
+                0,
+                bearerInfo );
+
+        TInt listeners( iServer->NumberOfListeners() );
+        LOGIT3("CConnUpDownNotifier, %d listeners, iap id %d, net id %d",
+                listeners, connInfo.iIapId, connInfo.iNetId)
+        iEventInfo.Reset();
+
+        if ( iInfoBuf().iState == EInterfaceUp )
+            {
+            // Add to the connection table and fill in the new connectioId to connInfo
+            TRAPD( ret, ( err = iServer->Iap()->AddConnectionL( connInfo ) ) );
+
+            if ( ( ret != KErrNone ) || ( err != KErrNone ) )
+                {
+                LOGIT2("SERVER: FAILED to add a new connection <%d>,<%d>", ret, err)
+                Receive();
+                return; // Can't leave
+                }
+
+            // Send event to all clients that are listening
+            if ( listeners > 0)
+                {
+                iEventInfo.iEventType    = EConnMonCreateConnection;
+                iEventInfo.iConnectionId = connInfo.iConnectionId;
+
+                iServer->EventQueue()->Add( iEventInfo );
+                }
+
+            LOGIT1("SERVER: EVENT -> connection %d created.", connInfo.iConnectionId)
+            }
+        else if ( iInfoBuf().iState == EInterfaceDown )
+            {
+            if ( listeners == 0 )
+                {
+                // Remove from the connection array. Note. when the notifications
+                // are ON event handlers will remove the connection from the array.
+                iServer->Iap()->RemoveConnection( connInfo );
+                }
+            else
+                {
+                TBool alreadyNotified( EFalse );
+
+                // This updates the correct 'iConnectionId' and 'iBearer' to connInfo
+                TInt ret = iServer->Iap()->GetDeleteNotifyStatus( connInfo, alreadyNotified );
+
+                if ( ret == KErrNone )
+                    {
+                    CSubConnUpDownNotifier* subConnUpDownNotifier = 0;
+
+                    ret = iServer->Iap()->GetSubConnUpDownNotifier(
+                            connInfo.iConnectionId,
+                            &subConnUpDownNotifier );
+
+                    if ( ret == KErrNone )
+                        {
+                        subConnUpDownNotifier->SetInterfaceClosed();
+
+                        if ( !subConnUpDownNotifier->DeleteSent() )
+                            {
+                            TNifProgress progress;
+                            err = iServer->Iap()->LastProgressError(
+                                    connInfo.iConnectionId,
+                                    progress );
+
+                            if ( progress.iError == KErrDisconnected )
+                                {
+                                // Enable WLAN scan for the next IAP availability check
+                                // because the current bearer has been lost (-36). MPM needs
+                                // a fresh list of available iaps on connection closure.
+                                iServer->Iap()->EnableWlanScan();
+                                }
+
+                            // Progress and subconn notifiers have died and no delete has been sent
+                            subConnUpDownNotifier->SendDeletedEvent();
+                            }
+                        else
+                            {
+                            // Delete has been sent. Just remove from internal table.
+                            iServer->Iap()->RemoveConnection( connInfo );
+                            }
+                        }
+                    }
+
+                }
+            LOGIT3("SERVER: EVENT (allinterface) -> connection %d (%d, %d) closed.",
+                    connInfo.iConnectionId, connInfo.iIapId, connInfo.iNetId)
+            }
+        else
+            {
+            LOGIT("SERVER: Unknown event")
+            Receive();
+            return;
+            }
+
+        LOGIT("CConnUpDownNotifier::RunL triggered HandleAvailabilityChange()")
+        iServer->AvailabilityManager()->HandleAvailabilityChange();
+        }
+    // New request
+    Receive();
+    //LOGEXITFN("CConnUpDownNotifier::RunL()")
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CDataNotifier::CDataNotifier
+// -----------------------------------------------------------------------------
+//
+CDataNotifier::CDataNotifier(
+        CConnMonServer* aServer,
+        RConnection* aConnection,
+        const TUint& aConnectionId,
+        const TUint& aSubConnectionId,
+        const TInt& aDirection )
+        :
+        CActive( EConnMonPriorityNormal ),
+        iServer( aServer ),
+        iConnection( aConnection ),
+        iConnectionId( aConnectionId),
+        iSubConnectionId( aSubConnectionId ),
+        iDirection( aDirection ),
+        iVolume( 0 ),
+        iPckgVolume( iVolume )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CDataNotifier::Construct
+// -----------------------------------------------------------------------------
+//
+void CDataNotifier::Construct()
+    {
+    //LOGENTRFN("CDataNotifier::Construct()")
+    CActiveScheduler::Add( this );
+    LOGIT("Created CDataNotifier")
+    //LOGEXITFN("CDataNotifier::Construct()")
+    }
+
+// Destructor
+CDataNotifier::~CDataNotifier()
+    {
+    Cancel();
+
+    iServer = NULL;
+    iConnection = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CDataNotifier::Receive
+// Requests a new event (data transferred) from RConnection
+// -----------------------------------------------------------------------------
+//
+void CDataNotifier::Receive()
+    {
+    // Don't make a new request if previous
+    // status indicates that connection is closing
+    if ( iStatus == KErrCancel )
+        {
+        return;
+        }
+
+    if ( IsActive() )
+        {
+        return;
+        }
+
+    iVolume = 0;
+
+    if ( iDirection == EDownlink )
+        {
+        iServer->CalculateThreshold(
+                iConnectionId,
+                EDownlinkThreshold,
+                iThreshold );
+
+        if ( iThreshold > 0 )
+            {
+            iConnection->DataReceivedNotificationRequest(
+                    iThreshold,
+                    iPckgVolume,
+                    iStatus );
+            SetActive();
+            }
+        }
+    else
+        {
+        iServer->CalculateThreshold(
+                iConnectionId,
+                EUplinkThreshold,
+                iThreshold );
+        if ( iThreshold > 0 )
+            {
+            iConnection->DataSentNotificationRequest(
+                    iThreshold,
+                    iPckgVolume,
+                    iStatus );
+            SetActive();
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CDataNotifier::DoCancel
+// Cancels the request from RConnection.
+// -----------------------------------------------------------------------------
+//
+void CDataNotifier::DoCancel()
+    {
+    if ( IsActive() )
+        {
+        if ( iDirection == EDownlink )
+            {
+            iConnection->DataReceivedNotificationCancel();
+            }
+        else
+            {
+            iConnection->DataSentNotificationCancel();
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CDataNotifier::RunL
+// Handles the event that has arrived from RConnection
+// -----------------------------------------------------------------------------
+//
+void CDataNotifier::RunL()
+    {
+    //LOGENTRFN("CDataNotifier::RunL()")
+
+    // All RunL():s outside CServer-derived main class MUST NOT LEAVE.
+    // Use TRAPD when needed.
+
+    LOGIT(".")
+    LOGIT1("RunL: CDataNotifier, status %d", iStatus.Int())
+
+    if ( iStatus.Int() != KErrNone )
+        {
+        //LOGIT2("SERVER: Data volume event FAILED <%d>, id <%d>", iStatus.Int(), iConnectionId )
+        iErrorCounter++;
+        if ( iErrorCounter > KConnMonEventErrorThreshold )
+            {
+            LOGIT1("Over %d consecutive errors, stopping", KConnMonEventErrorThreshold)
+            return;
+            }
+        }
+    else
+        {
+        iErrorCounter = 0;
+        iEventInfo.Reset();
+
+        // Send event(s) to clients
+        iEventInfo.iConnectionId = iConnectionId;
+        iEventInfo.iSubConnectionId = iSubConnectionId;
+        iEventInfo.iData = iPckgVolume();
+
+        if ( iDirection == EDownlink )
+            {
+            iEventInfo.iEventType = EConnMonDownlinkDataThreshold;
+            LOGIT2("SERVER: EVENT -> Downlink data <%d>, id <%d>", iEventInfo.iData, iEventInfo.iConnectionId )
+            }
+        else
+            {
+            iEventInfo.iEventType = EConnMonUplinkDataThreshold;
+            LOGIT2("SERVER: EVENT -> Uplink data <%d>, id <%d>", iEventInfo.iData, iEventInfo.iConnectionId )
+            }
+
+        iServer->EventQueue()->Add( iEventInfo );
+        }
+    // New request
+    Receive();
+    //LOGEXITFN("CDataNotifier::RunL()")
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CProgressNotifier::CProgressNotifier
+// Priority is set to 10. Progress notifier must have higher priority than
+// connection up/down notifier because otherwise connection delete event will
+// arrive before status reaches KLinkLayerClosed.
+// -----------------------------------------------------------------------------
+//
+CProgressNotifier::CProgressNotifier(
+        CConnMonServer* aServer,
+        RConnection* aConnection,
+        const TUint& aConnectionId,
+        const TUint& aSubConnectionId )
+        :
+        CActive( EConnMonPriorityHigh ),
+        iServer( aServer ),
+        iConnection( aConnection ),
+        iConnectionId( aConnectionId),
+        iSubConnectionId( aSubConnectionId ),
+        iFilter( KNoFiltering )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CProgressNotifier::Construct
+// -----------------------------------------------------------------------------
+//
+void CProgressNotifier::Construct()
+    {
+    //LOGENTRFN("CProgressNotifier::Construct()")
+    CActiveScheduler::Add( this );
+    LOGIT("Created CProgressNotifier")
+    //LOGEXITFN("CProgressNotifier::Construct()")
+    }
+
+// Destructor
+CProgressNotifier::~CProgressNotifier()
+    {
+    if ( IsActive() )
+        {
+        Cancel();
+        }
+
+    iServer = NULL;
+    iConnection = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CProgressNotifier::Receive
+// Requests a new event (connection status changed) from RConnection
+// -----------------------------------------------------------------------------
+//
+void CProgressNotifier::Receive()
+    {
+    if ( IsActive() )
+        {
+        Cancel();
+        }
+
+    iInfoBuf().iStage = 0;
+    iInfoBuf().iError = 0;
+
+    iConnection->ProgressNotification( iInfoBuf, iStatus );
+    SetActive();
+    }
+
+// -----------------------------------------------------------------------------
+// CProgressNotifier::Receive
+// Requests a new event (connection status changed) from RConnection
+// Uses filtering until status reaches aFilter
+// -----------------------------------------------------------------------------
+//
+void CProgressNotifier::Receive( const TInt aFilter )
+    {
+    iFilter = aFilter;
+    Receive();
+    }
+
+// -----------------------------------------------------------------------------
+// CProgressNotifier::IsAuthDelete
+// ETrue if the user has deactivated the connection
+// by using Connection Monitor or if the applications issued
+// RConnection::Stop( RConnection::EStopAuthoritative )
+// -----------------------------------------------------------------------------
+//
+TBool CProgressNotifier::IsAuthDelete()
+    {
+    if ( iInfoBuf().iError == KErrConnectionTerminated )
+        {
+        return ETrue;
+        }
+    else
+        {
+        return EFalse;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CProgressNotifier::CanReconnect
+// ETrue if might reconnect after closing.
+// -----------------------------------------------------------------------------
+//
+TBool CProgressNotifier::CanReconnect() const
+    {
+    // Reconnect is disabled for the moment
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CProgressNotifier::DoCancel
+// Cancels the request from RConnection.
+// -----------------------------------------------------------------------------
+//
+void CProgressNotifier::DoCancel()
+    {
+    if ( IsActive() )
+        {
+        iConnection->CancelProgressNotification();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CProgressNotifier::SendClosedEvent
+// -----------------------------------------------------------------------------
+//
+void CProgressNotifier::SendClosedEvent()
+    {
+    iEventInfo.Reset();
+
+    iEventInfo.iEventType       = EConnMonConnectionStatusChange;
+    iEventInfo.iConnectionId    = iConnectionId;
+    iEventInfo.iSubConnectionId = iSubConnectionId;
+    iEventInfo.iData            = KLinkLayerClosed;
+
+    // Send event to all clients that are listening
+    iServer->EventQueue()->Add( iEventInfo );
+    }
+
+// -----------------------------------------------------------------------------
+// CProgressNotifier::RunL
+// Handles the event that has arrived from RConnection
+// -----------------------------------------------------------------------------
+//
+void CProgressNotifier::RunL()
+    {
+    //LOGENTRFN("CProgressNotifier::RunL()")
+
+    // All RunL():s outside CServer-derived main class MUST NOT LEAVE.
+    // Use TRAPD when needed.
+
+    LOGIT(".")
+    LOGIT1("RunL: CProgressNotifier, status %d", iStatus.Int())
+
+    if ( iStatus.Int() != KErrNone )
+        {
+        LOGIT2("SERVER: connection status event FAILED <%d>, id %d", iStatus.Int(), iConnectionId)
+        }
+    else
+        {
+        iEventInfo.Reset();
+
+        if ( iInfoBuf().iStage != static_cast< TInt >( iEventInfo.iData ) )
+            {
+            // Send only new stage info to clients
+            iEventInfo.iEventType       = EConnMonConnectionStatusChange;
+            iEventInfo.iConnectionId    = iConnectionId;
+            iEventInfo.iSubConnectionId = iSubConnectionId;
+            iEventInfo.iData            = iInfoBuf().iStage;
+
+            LOGIT3("SERVER: EVENT -> Connection %d, status %d <%d>",
+                    iEventInfo.iConnectionId, iEventInfo.iData, iInfoBuf().iError)
+
+            if ( ( iFilter == KNoFiltering ) || ( iInfoBuf().iStage > iFilter ) )
+                {
+                // Send event to all clients that are listening
+                iServer->EventQueue()->Add( iEventInfo );
+
+                // Start other event watchers when the connection status reaches
+                // KLinkLayerOpen for the first time.
+                if ( iInfoBuf().iStage == KLinkLayerOpen )
+                    {
+                    // Start subconnection up/down notifier when stage reaches KLinkLayerOpen
+                    CSubConnUpDownNotifier* subConnUpDownNotifier = 0;
+
+                    TInt err = iServer->Iap()->GetSubConnUpDownNotifier(
+                            iConnectionId,
+                            &subConnUpDownNotifier );
+
+                    if ( KErrNone == err )
+                        {
+                        if ( !subConnUpDownNotifier->IsActive() )
+                            {
+                            subConnUpDownNotifier->Receive();
+                            }
+                        }
+
+                    // Start activity notifier when stage reaches KLinkLayerOpen
+                    TRAPD( ret, ( iServer->Iap()->LaunchActivityNotifierL( iConnectionId ) ) );
+
+                    if ( ret != KErrNone )
+                        {
+                        LOGIT1("SERVER: FAILED to start activity notifier <%d>", ret)
+                        return; // Can't leave
+                        }
+
+                    // Start data (uplink & downlink) notifiers when stage reaches KLinkLayerOpen
+                    iServer->Iap()->LaunchDataNotifiers( iConnectionId );
+
+                    ret = iServer->Iap()->LaunchBearerNotifier( iConnectionId );
+                    if ( ret != KErrNone )
+                        {
+                        LOGIT1("SERVER: FAILED to start bearer(new) notifier <%d>", ret)
+                        }
+                    }
+
+                iFilter = KNoFiltering;
+                }
+            else
+                {
+                LOGIT("SERVER: This is old info. Packet was filtered out.")
+                }
+            }
+
+        if ( iInfoBuf().iError == KErrNone )
+            {
+            // New request
+            Receive();
+            }
+        else
+            {
+            // Connection is closing.
+            CSubConnUpDownNotifier* subConnUpDownNotifier = 0;
+            TInt err = iServer->Iap()->GetSubConnUpDownNotifier(
+                    iConnectionId,
+                    &subConnUpDownNotifier );
+
+            if ( KErrNone == err )
+                {
+                // Subconn down notifier has stopped and allinterface closed event has arrived
+                if ( !subConnUpDownNotifier->IsActive() )
+                    {
+                    subConnUpDownNotifier->SendDeletedEvent();
+                    }
+                }
+
+            if ( iInfoBuf().iError == KErrDisconnected )
+                {
+                // Enable WLAN scan when IAP availability is check for the
+                // next time because current bearer has been lost (-36).
+                // MPM needs a fresh list of available iaps.
+                iServer->Iap()->EnableWlanScan();
+                }
+            }
+        }
+    //LOGEXITFN("CProgressNotifier::RunL()")
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CNetwStatusNotifier::CNetwStatusNotifier
+// -----------------------------------------------------------------------------
+//
+CNetwStatusNotifier::CNetwStatusNotifier(
+        CConnMonServer* aServer )
+        :
+        CActive( EConnMonPriorityNormal ),
+        iServer( aServer )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CNetwStatusNotifier::Construct
+// -----------------------------------------------------------------------------
+//
+void CNetwStatusNotifier::Construct()
+    {
+    //LOGENTRFN("CNetwStatusNotifier::Construct()")
+
+    CActiveScheduler::Add( this );
+    TInt ret = iServer->Iap()->PacketService()->GetStatus( iPacketStatus );
+    if ( ret != KErrNone )
+        {
+        iPacketStatus = RPacketService::EStatusUnattached;
+        }
+    LOGIT("Created CNetwStatusNotifier")
+
+    //LOGEXITFN("CNetwStatusNotifier::Construct()")
+    }
+
+// -----------------------------------------------------------------------------
+// CNetwStatusNotifier::NewL
+// -----------------------------------------------------------------------------
+//
+CNetwStatusNotifier* CNetwStatusNotifier::NewL( CConnMonServer* aServer )
+    {
+    CNetwStatusNotifier* self = new( ELeave ) CNetwStatusNotifier( aServer );
+    self->Construct();
+    return self;
+    }
+
+// Destructor
+CNetwStatusNotifier::~CNetwStatusNotifier()
+    {
+    Cancel();
+    iServer = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CNetwStatusNotifier::Receive
+// Requests a new event (network status changed) from ETel
+// -----------------------------------------------------------------------------
+//
+void CNetwStatusNotifier::Receive()
+    {
+    if ( IsActive() )
+        {
+        return;
+        }
+
+    iServer->Iap()->PacketService()->NotifyStatusChange( iStatus, iPacketStatus );
+    SetActive();
+    }
+
+// -----------------------------------------------------------------------------
+// CNetwStatusNotifier::DoCancel
+// Cancels the request from ETel.
+// -----------------------------------------------------------------------------
+//
+void CNetwStatusNotifier::DoCancel()
+    {
+    if ( IsActive() )
+        {
+        iServer->Iap()->PacketService()->CancelAsyncRequest( EPacketNotifyStatusChange );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CNetwStatusNotifier::RunL
+// Handles the event that has arrived from ETel
+// -----------------------------------------------------------------------------
+//
+void CNetwStatusNotifier::RunL()
+    {
+    //LOGENTRFN("CNetwStatusNotifier::RunL()")
+
+    // All RunL():s outside CServer-derived main class MUST NOT LEAVE.
+    // Use TRAPD when needed.
+
+    LOGIT(".")
+    LOGIT1("RunL: CNetwStatusNotifier, status %d", iStatus.Int())
+
+    if ( iStatus.Int() != KErrNone )
+        {
+        LOGIT1("SERVER: network status event FAILED <%d>", iStatus.Int())
+        }
+    else
+        {
+        iEventInfo.Reset();
+
+        iEventInfo.iEventType = EConnMonNetworkStatusChange;
+        iEventInfo.iSubConnectionId = 0;
+        iEventInfo.iData = iServer->Iap()->CalculateNetworkStatus( iPacketStatus );
+
+        // Find out bearer ID.
+        iServer->Iap()->GetBearerId( iEventInfo.iConnectionId );
+
+        LOGIT2("SERVER: EVENT -> Network status %d, id %d", iEventInfo.iData, iEventInfo.iConnectionId)
+
+        // Send event to all clients that are listening
+        iServer->EventQueue()->Add( iEventInfo );
+
+        LOGIT("CNetwStatusNotifier::RunL triggered HandleAvailabilityChange()")
+        iServer->AvailabilityManager()->HandleAvailabilityChange();
+        }
+
+    // New request
+    Receive();
+    //LOGEXITFN("CNetwStatusNotifier::RunL()")
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CNetwRegistrationNotifier::CNetwRegistrationNotifier
+// Notifies changes in network registration status.
+// Notifies also changes in CSD bearer availability and CSD IAP availability.
+// -----------------------------------------------------------------------------
+//
+CNetwRegistrationNotifier::CNetwRegistrationNotifier(
+        CConnMonServer* aServer,
+        RMobilePhone& aMobilePhone )
+        :
+        CActive( EConnMonPriorityNormal ),
+        iServer( aServer ),
+        iMobilePhone( aMobilePhone )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CNetwRegistrationNotifier::Construct
+// -----------------------------------------------------------------------------
+//
+void CNetwRegistrationNotifier::Construct()
+    {
+    //LOGENTRFN("CNetwRegistrationNotifier::Construct()")
+    CActiveScheduler::Add( this );
+
+    iRegistration = RMobilePhone::ERegistrationUnknown;
+    iEventInfo.iData = RMobilePhone::ERegistrationUnknown;
+
+    TBool cellSupportsCSD( EFalse );
+
+    // Is CSD supported both by the cell and the phone
+    iServer->Iap()->GetBearerSupportInfo(
+            EBearerIdCSD,
+            cellSupportsCSD,
+            iPhoneSupportsCSD );
+
+    if ( cellSupportsCSD && iPhoneSupportsCSD )
+         {
+         iCSDSupported = ETrue;
+         }
+    LOGIT("Created CNetwRegistrationNotifier")
+
+    //LOGEXITFN("CNetwRegistrationNotifier::Construct()")
+    }
+
+// -----------------------------------------------------------------------------
+// CNetwRegistrationNotifier::NewL
+// -----------------------------------------------------------------------------
+//
+CNetwRegistrationNotifier* CNetwRegistrationNotifier::NewL(
+        CConnMonServer* aServer,
+        RMobilePhone& aMobilePhone )
+    {
+    CNetwRegistrationNotifier* self = new( ELeave ) CNetwRegistrationNotifier(
+            aServer,
+            aMobilePhone );
+
+    self->Construct();
+    return self;
+    }
+
+// Destructor
+CNetwRegistrationNotifier::~CNetwRegistrationNotifier()
+    {
+    Cancel();
+    iServer = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CNetwRegistrationNotifier::Receive
+// Requests a new event (network registration changed) from ETel
+// -----------------------------------------------------------------------------
+//
+void CNetwRegistrationNotifier::Receive()
+    {
+    if ( IsActive() )
+        {
+        return;
+        }
+
+    iMobilePhone.NotifyNetworkRegistrationStatusChange( iStatus, iRegistration );
+    SetActive();
+    }
+
+// -----------------------------------------------------------------------------
+// CNetwRegistrationNotifier::DoCancel
+// Cancels the request from ETel.
+// -----------------------------------------------------------------------------
+//
+void CNetwRegistrationNotifier::DoCancel()
+    {
+    if ( IsActive() )
+        {
+        iMobilePhone.CancelAsyncRequest( EMobilePhoneNotifyNetworkRegistrationStatusChange );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CNetwRegistrationNotifier::RunL
+// Handles the event that has arrived from ETel
+// -----------------------------------------------------------------------------
+//
+void CNetwRegistrationNotifier::RunL()
+    {
+    //LOGENTRFN("CNetwRegistrationNotifier::RunL()")
+
+    // All RunL():s outside CServer-derived main class MUST NOT LEAVE.
+    // Use TRAPD when needed.
+
+    LOGIT(".")
+    LOGIT1("RunL: CNetwRegistrationNotifier, status <%d>", iStatus.Int())
+
+    if ( iStatus.Int() != KErrNone )
+        {
+        LOGIT1("SERVER: network registration event FAILED <%d>", iStatus.Int())
+        }
+    else
+        {
+        TUint value( RMobilePhone::ERegistrationUnknown );
+
+        value = iServer->Iap()->CalculateNetworkRegistration( iRegistration );
+
+        // Is this a new registration status value
+        if ( iEventInfo.iData != value )
+            {
+            // Send Network registration status changed event when FeatureFlag is ON
+            if ( FeatureManager::FeatureSupported( KFeatureIdNetworkRegistration ) )
+                {
+                iEventInfo.Reset();
+
+                iEventInfo.iData = value;
+                iEventInfo.iEventType = EConnMonNetworkRegistrationChange;
+
+                // Find out bearer ID.
+                iServer->Iap()->GetBearerId( iEventInfo.iConnectionId );
+
+                if ( iEventInfo.iConnectionId == EBearerIdGPRS )
+                    {
+                    iEventInfo.iConnectionId = EBearerIdGSM;
+                    }
+
+                iServer->EventQueue()->Add( iEventInfo );
+                }
+
+            LOGIT2("SERVER: EVENT -> Network registration %d, id %d", iEventInfo.iData, iEventInfo.iConnectionId)
+
+            if ( iPhoneSupportsCSD )
+                {
+                iEventInfo.Reset();
+                iEventInfo.iEventType = EConnMonBearerAvailabilityChange;
+
+                if ( iRegistration == RMobilePhone::ERegisteredBusy ||
+                     iRegistration == RMobilePhone::ERegisteredOnHomeNetwork ||
+                     iRegistration == RMobilePhone::ERegisteredRoaming )
+                    {
+                    iEventInfo.iData = ETrue;
+                    }
+
+                if ( static_cast< TUint >( iCSDSupported ) != iEventInfo.iData )
+                    {
+                    // Find out bearer ID for CSD.
+                    iServer->Iap()->GetBearerId( iEventInfo.iConnectionId, ETrue );
+
+                    // Send the event only if threshold is set by some of the clients.
+                    TUint threshold( 0 );
+
+                    iServer->CalculateThreshold(
+                            EBearerIdAll,
+                            EBearerAvailabilityThreshold,
+                            threshold );
+
+                    if ( threshold > 0 )
+                        {
+                        iServer->EventQueue()->Add( iEventInfo );
+                        }
+
+                    iCSDSupported = iEventInfo.iData;
+
+                    LOGIT2("SERVER: EVENT -> Bearer availability changed: data %d, id %d", iEventInfo.iData, iEventInfo.iConnectionId)
+
+                    // Send CSD IAP availability event only when packet services are not available.
+                    // Otherwise CSD IAP availability information goes along with packet IAP event.
+                    TUint32 capsPhone( 0 );
+                    TInt err = iMobilePhone.GetMultimodeCaps( capsPhone );
+                    }
+                }
+
+            // Store to compare next event correctly
+            iEventInfo.iData = value;
+            }
+        LOGIT("CNetwRegistrationNotifier::RunL triggered HandleAvailabilityChange()")
+        iServer->AvailabilityManager()->HandleAvailabilityChange();
+        }
+    // New request
+    Receive();
+    //LOGEXITFN("CNetwRegistrationNotifier::RunL()")
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CBearerNotifier::CBearerNotifier
+// Notifies when the bearer changes from EGPRS to GPRS on vice versa.
+// This information is cell specific.
+// -----------------------------------------------------------------------------
+//
+CBearerNotifier::CBearerNotifier(
+        CConnMonServer* aServer,
+        RMobilePhone& aMobilePhone )
+        :
+        CActive( EConnMonPriorityNormal ),
+        iServer( aServer ),
+        iMobilePhone( aMobilePhone ),
+        iGprsInfo(),
+        iGprsInfoPckg( iGprsInfo ),
+        iErrorCounter( 0 )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CBearerNotifier::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CBearerNotifier::ConstructL()
+    {
+    //LOGENTRFN("CBearerNotifier::ConstructL()")
+    CActiveScheduler::Add( this );
+
+    // Open ETel custom API
+    TInt ret = iCustomApi.Open( iMobilePhone );
+    if ( ret != KErrNone )
+        {
+        LOGIT1("ERROR starting bearer notifier. RMmCustomAPI.Open() failed <%d>", ret)
+        User::Leave( ret );
+        }
+
+    iEventInfo.iData = EBearerUnknown;
+    LOGIT("Created CBearerNotifier")
+
+    //LOGEXITFN("CBearerNotifier::ConstructL()")
+    }
+
+// -----------------------------------------------------------------------------
+// CBearerNotifier::NewL
+// -----------------------------------------------------------------------------
+//
+CBearerNotifier* CBearerNotifier::NewL(
+        CConnMonServer* aServer,
+        RMobilePhone& aMobilePhone )
+    {
+    CBearerNotifier* self = new( ELeave ) CBearerNotifier(
+            aServer,
+            aMobilePhone );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+// Destructor
+CBearerNotifier::~CBearerNotifier()
+    {
+    Cancel();
+
+    // Close ETel custom API
+    iCustomApi.Close();
+
+    iServer = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CBearerNotifier::Receive
+// Requests a new event (bearer changed) from ETel Custom API
+// -----------------------------------------------------------------------------
+//
+void CBearerNotifier::Receive()
+    {
+    if ( IsActive() )
+        {
+        return;
+        }
+
+    iCustomApi.NotifyEGprsInfoChange( iStatus, iGprsInfoPckg );
+
+    SetActive();
+    }
+
+// -----------------------------------------------------------------------------
+// CBearerNotifier::DoCancel
+// Cancels the request from ETel Custom API.
+// -----------------------------------------------------------------------------
+//
+void CBearerNotifier::DoCancel()
+    {
+    if ( IsActive() )
+        {
+        iCustomApi.CancelAsyncRequest( ECustomNotifyEGprsInfoChange );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CBearerNotifier::RunL
+// Handles the event that has arrived from ETel
+// -----------------------------------------------------------------------------
+//
+void CBearerNotifier::RunL()
+    {
+    //LOGENTRFN("CBearerNotifier::RunL()")
+
+    // All RunL():s outside CServer-derived main class MUST NOT LEAVE.
+    // Use TRAPD when needed.
+
+    LOGIT(".")
+    LOGIT1("RunL: CBearerNotifier, status <%d>", iStatus.Int())
+
+    if ( iStatus.Int() != KErrNone )
+        {
+        iErrorCounter++;
+        if ( iErrorCounter > KConnMonEventErrorThreshold )
+            {
+            LOGIT1("Over %d consecutive errors, stopping", KConnMonEventErrorThreshold)
+            //LOGEXITFN("CBearerNotifier::RunL()")
+            return;
+            }
+        }
+    else
+        {
+        iErrorCounter = 0;
+        LOGIT1("SERVER: CBearerNotifier: iGprsInfo <%d>", iGprsInfoPckg().iGprsInfo)
+        iEventInfo.Reset();
+
+        // Check that that we are in GSM mode. This event will be sent only in GSM mode.
+        RMobilePhone::TMobilePhoneNetworkMode mode( RMobilePhone::ENetworkModeUnknown );
+
+        TInt ret = iMobilePhone.GetCurrentMode( mode );
+
+        if ( ( ret == KErrNone ) && ( mode == RMobilePhone::ENetworkModeGsm ) )
+            {
+            if ( iGprsInfoPckg().iGprsInfo == RMmCustomAPI::EEdgeGprs )
+                {
+                iEventInfo.iData = EBearerEdgeGPRS;
+                }
+            else
+                {
+                iEventInfo.iData = EBearerGPRS;
+                }
+
+            iEventInfo.iEventType = EConnMonBearerChange;
+            iEventInfo.iConnectionId = EBearerIdGPRS;
+
+            iServer->EventQueue()->Add( iEventInfo );
+
+            LOGIT3("SERVER: EVENT -> Bearer changed: %d, data %d, id %d", iGprsInfoPckg().iGprsInfo, iEventInfo.iData, iEventInfo.iConnectionId)
+
+            // New Impl.
+            iEventInfo.Reset();
+            iEventInfo.iEventType = EConnMonBearerInfoChange;
+            iEventInfo.iConnectionId = EBearerIdAll; // means that this is not a connection related event
+
+            if ( iGprsInfoPckg().iGprsInfo == RMmCustomAPI::EEdgeGprs )
+                {
+                iEventInfo.iData = EBearerInfoEdgeGPRS;
+                }
+            else
+                {
+                iEventInfo.iData = EBearerInfoGPRS;
+                }
+
+            iServer->EventQueue()->Add( iEventInfo );
+
+            LOGIT2("SERVER: EVENT -> Bearer info changed: %d, data %d", iGprsInfoPckg().iGprsInfo, iEventInfo.iData)
+            }
+        }
+
+    // New request
+    Receive();
+    //LOGEXITFN("CBearerNotifier::RunL()")
+    }
+
+// -----------------------------------------------------------------------------
+// CBearerNotifier::CWcdmaBearerNotifier
+// Notifies when the bearer changes from Wcdma to Hsdpa on vice versa.
+// This information is cell specific.
+// -----------------------------------------------------------------------------
+//
+CWcdmaBearerNotifier::CWcdmaBearerNotifier(
+        CConnMonServer* aServer,
+        RTelServer& aTelServer )
+        :
+        CActive( EConnMonPriorityNormal ),
+        iServer( aServer ),
+        iTelServer( aTelServer ),
+        iNetInfo(),
+        iNetInfoPckg( iNetInfo )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CWcdmaBearerNotifier::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CWcdmaBearerNotifier::ConstructL()
+    {
+    //LOGENTRFN("CWcdmaBearerNotifier::ConstructL()")
+    CActiveScheduler::Add( this );
+
+    iPreviousBearerInfo = EBearerInfoWCDMA;
+    iEventInfo.iData = EBearerUnknown;
+
+    RTelServer::TPhoneInfo info;
+    User::LeaveIfError( iTelServer.GetPhoneInfo( 0, info ) );
+    User::LeaveIfError( iMobilePhone.Open( iTelServer, info.iName ) );
+
+    LOGIT("Created CWcdmaBearerNotifier")
+    //LOGEXITFN("CWcdmaBearerNotifier::ConstructL()")
+    }
+
+// -----------------------------------------------------------------------------
+// CWcdmaBearerNotifier::NewL
+// -----------------------------------------------------------------------------
+//
+CWcdmaBearerNotifier* CWcdmaBearerNotifier::NewL(
+        CConnMonServer* aServer,
+        RTelServer& aTelServer )
+    {
+    CWcdmaBearerNotifier* self = new( ELeave ) CWcdmaBearerNotifier(
+            aServer,
+            aTelServer );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+// Destructor
+CWcdmaBearerNotifier::~CWcdmaBearerNotifier()
+    {
+    Cancel();
+    iServer = NULL;
+
+    iMobilePhone.Close();
+    }
+
+// -----------------------------------------------------------------------------
+// CWcdmaBearerNotifier::Receive
+// Requests a new event (bearer changed) from ETel Custom API
+// -----------------------------------------------------------------------------
+//
+void CWcdmaBearerNotifier::Receive()
+    {
+    if ( IsActive() )
+        {
+        return;
+        }
+
+    iMobilePhone.NotifyCurrentNetworkChange( iStatus, iNetInfoPckg );
+    SetActive();
+    }
+
+// -----------------------------------------------------------------------------
+// CWcdmaBearerNotifier::DoCancel
+// Cancels the request from ETel Custom API.
+// -----------------------------------------------------------------------------
+//
+void CWcdmaBearerNotifier::DoCancel()
+    {
+    if ( IsActive() )
+        {
+        iMobilePhone.CancelAsyncRequest( EMobilePhoneNotifyCurrentNetworkNoLocationChange );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CWcdmaBearerNotifier::RunL
+// Handles the event that has arrived from ETel
+// -----------------------------------------------------------------------------
+//
+void CWcdmaBearerNotifier::RunL()
+    {
+    //LOGENTRFN("CWcdmaBearerNotifier::RunL()")
+
+    // All RunL():s outside CServer-derived main class MUST NOT LEAVE.
+    // Use TRAPD when needed.
+
+    LOGIT(".")
+    LOGIT1("RunL: CWcdmaBearerNotifier, status <%d>", iStatus.Int())
+
+    if ( KErrNone != iStatus.Int() )
+        {
+        LOGIT1("SERVER: CWcdmaBearerNotifier:Bearer changed event FAILED <%d>", iStatus.Int())
+        }
+    else
+        {
+        LOGIT2("SERVER: CWcdmaBearerNotifier: EGPRS %d, HSDPA %d",
+                iNetInfoPckg().iEgprsAvailableIndicator, iNetInfoPckg().iHsdpaAvailableIndicator)
+        iEventInfo.Reset();
+
+        // Check that that we are in Wcdma mode. This event will be
+        // sent only in Wcdma mode.
+        RMobilePhone::TMobilePhoneNetworkMode mode( RMobilePhone::ENetworkModeUnknown );
+
+        TInt ret = iMobilePhone.GetCurrentMode( mode );
+        LOGIT1("SERVER: CWcdmaBearerNotifier: current mode %d", mode)
+
+        if ( ( KErrNone == ret ) && ( mode == RMobilePhone::ENetworkModeWcdma ) )
+            {
+            iEventInfo.iEventType = EConnMonBearerInfoChange;
+            iEventInfo.iConnectionId = EBearerIdAll; // Means that this is not a connection related event
+
+            if ( iNetInfoPckg().iHsdpaAvailableIndicator )
+                {
+                iEventInfo.iData = EBearerInfoHSDPA;
+                }
+            else
+                {
+                iEventInfo.iData = EBearerInfoWCDMA;
+                }
+
+            if ( iPreviousBearerInfo != iEventInfo.iData )
+                {
+                iPreviousBearerInfo = (TConnMonBearerInfo)iEventInfo.iData;
+
+                LOGIT1("SERVER: EVENT -> Wcdma bearer info changed, new bearer info %d", iEventInfo.iData)
+                iServer->EventQueue()->Add( iEventInfo );
+                }
+            else
+                {
+                LOGIT1("SERVER: Wcdma bearer info NOT changed, bearer info %d", iEventInfo.iData)
+                }
+            }
+        }
+    // New request
+    Receive();
+    //LOGEXITFN("CWcdmaBearerNotifier::RunL()")
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CModeNotifier::CModeNotifier
+// Notifies when the bearer changes from 3G (WCDMA) to 2G (GPRS/EGPRS) or vice versa.
+// -----------------------------------------------------------------------------
+//
+CModeNotifier::CModeNotifier(
+        CConnMonServer* aServer,
+        RMobilePhone& aMobilePhone )
+        :
+        CActive( EConnMonPriorityNormal ),
+        iServer( aServer ),
+        iMobilePhone( aMobilePhone )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CModeNotifier::Construct
+// -----------------------------------------------------------------------------
+//
+void CModeNotifier::Construct()
+    {
+    //LOGENTRFN("CModeNotifier::Construct()")
+    CActiveScheduler::Add( this );
+    LOGIT("Created CModeNotifier")
+    //LOGEXITFN("CModeNotifier::Construct()")
+    }
+
+// -----------------------------------------------------------------------------
+// CModeNotifier::NewL
+// -----------------------------------------------------------------------------
+//
+CModeNotifier* CModeNotifier::NewL(
+        CConnMonServer* aServer,
+        RMobilePhone& aMobilePhone )
+    {
+    CModeNotifier* self = new( ELeave ) CModeNotifier( aServer, aMobilePhone );
+    self->Construct();
+    return self;
+    }
+
+// Destructor
+CModeNotifier::~CModeNotifier()
+    {
+    Cancel();
+    iServer = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CModeNotifier::Receive
+// Requests a new event (bearer changed) from ETel Custom API
+// -----------------------------------------------------------------------------
+//
+void CModeNotifier::Receive()
+    {
+    if ( IsActive() )
+        {
+        return;
+        }
+
+    iMobilePhone.NotifyModeChange( iStatus, iMode );
+
+    SetActive();
+    }
+
+// -----------------------------------------------------------------------------
+// CModeNotifier::DoCancel
+// Cancels the request from ETel Custom API.
+// -----------------------------------------------------------------------------
+//
+void CModeNotifier::DoCancel()
+    {
+    if ( IsActive() )
+        {
+        iMobilePhone.CancelAsyncRequest( EMobilePhoneNotifyModeChange );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CModeNotifier::RunL
+// Handles the event that has arrived from ETel
+// -----------------------------------------------------------------------------
+//
+void CModeNotifier::RunL()
+    {
+    //LOGENTRFN("CModeNotifier::RunL()")
+    TBool edgeCellDetected = EFalse;
+
+    // All RunL():s outside CServer-derived main class MUST NOT LEAVE.
+    // Use TRAPD when needed.
+
+    LOGIT(".")
+    LOGIT1("RunL: CModeNotifier, status %d", iStatus.Int())
+
+    if ( iStatus.Int() != KErrNone )
+        {
+        LOGIT1("SERVER: Mode changed event FAILED <%d>", iStatus.Int() )
+        }
+    else
+        {
+        LOGIT1("SERVER: CModeNotifier: mode <%d>", iMode )
+        iEventInfo.Reset();
+
+        iEventInfo.iEventType = EConnMonBearerChange;
+
+        if ( iMode == RMobilePhone::ENetworkModeWcdma )
+            {
+            iEventInfo.iConnectionId = EBearerIdWCDMA;
+            iEventInfo.iData = EBearerWCDMA;
+            }
+        else if ( iMode == RMobilePhone::ENetworkModeGsm )
+            {
+            iEventInfo.iConnectionId = EBearerIdGPRS;
+
+            edgeCellDetected = iServer->Iap()->IsEdgeCell();
+            if ( edgeCellDetected )
+                {
+                iEventInfo.iData = EBearerEdgeGPRS;
+                }
+            else
+                {
+                iEventInfo.iData = EBearerGPRS;
+                }
+            }
+        else
+            {
+            // Unknown
+            iEventInfo.iData = 0;
+            }
+
+        if ( iEventInfo.iData != 0 )
+            {
+            iServer->EventQueue()->Add( iEventInfo );
+
+            LOGIT3("SERVER: EVENT -> Mode changed: %d, data %d, id %d",
+                    iMode, iEventInfo.iData, iEventInfo.iConnectionId)
+            }
+
+        // New implemantation
+        iEventInfo.Reset();
+
+        iEventInfo.iEventType = EConnMonBearerInfoChange;
+        iEventInfo.iConnectionId = EBearerIdAll; // means that this is not a connection related event
+
+        if ( iMode == RMobilePhone::ENetworkModeWcdma )
+            {
+            iEventInfo.iData = (TUint)iServer->Iap()->HsxpaStatus();
+            }
+        else if ( iMode == RMobilePhone::ENetworkModeGsm )
+            {
+            if ( edgeCellDetected )
+                {
+                iEventInfo.iData = EBearerInfoEdgeGPRS;
+                }
+            else
+                {
+                iEventInfo.iData = EBearerInfoGPRS;
+                }
+            }
+        else
+            {
+            // Unknown
+            iEventInfo.iData = 0;
+            }
+
+        if ( iEventInfo.iData != 0 )
+            {
+            iServer->EventQueue()->Add( iEventInfo );
+            LOGIT2("SERVER: EVENT -> Mode changed(new impl.): %d, bearerinfo %d", iMode, iEventInfo.iData)
+            }
+
+        TConnMonBearerInfo bI = ( TConnMonBearerInfo ) iEventInfo.iData;
+        iServer->Iap()->SendConnectionEvents( bI ); // BearerInfoChanged, BearerGroupChanged
+        }
+
+    // New request
+    Receive();
+    //LOGEXITFN("CModeNotifier::RunL()")
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CBearerAvailabilityNotifier::CBearerAvailabilityNotifier
+// Notifies when GPRS/WCDMA bearer availability changes.
+// Notifies also changes in GPRS/WCDMA IAP availability.
+// -----------------------------------------------------------------------------
+//
+CBearerAvailabilityNotifier::CBearerAvailabilityNotifier(
+        CConnMonServer* aServer )
+        :
+        CActive( EConnMonPriorityNormal ),
+        iServer( aServer )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CBearerAvailabilityNotifier::Construct
+// -----------------------------------------------------------------------------
+//
+void CBearerAvailabilityNotifier::Construct()
+    {
+    //LOGENTRFN("CBearerAvailabilityNotifier::Construct()")
+    CActiveScheduler::Add( this );
+    iRegStatus = RPacketService::EUnknown;
+    LOGIT("Created CBearerAvailabilityNotifier")
+    //LOGEXITFN("CBearerAvailabilityNotifier::Construct()")
+    }
+
+// -----------------------------------------------------------------------------
+// CBearerAvailabilityNotifier::NewL
+// -----------------------------------------------------------------------------
+//
+CBearerAvailabilityNotifier* CBearerAvailabilityNotifier::NewL( CConnMonServer* aServer )
+    {
+    CBearerAvailabilityNotifier* self = new( ELeave ) CBearerAvailabilityNotifier( aServer );
+    self->Construct();
+    return self;
+    }
+
+// Destructor
+CBearerAvailabilityNotifier::~CBearerAvailabilityNotifier()
+    {
+    Cancel();
+    iServer = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CBearerAvailabilityNotifier::Receive
+// Requests a new event (bearer (GPRS or WCDMA availability changed) from ETel
+// -----------------------------------------------------------------------------
+//
+void CBearerAvailabilityNotifier::Receive( TBool aKickOff )
+    {
+    if ( IsActive() )
+        {
+        return;
+        }
+
+    if ( aKickOff )
+        {
+        // Get current status of iPSD
+        TBool byCell( EFalse );
+
+        // Is GPRS or WCDMA supported
+        iServer->Iap()->GetBearerSupportInfo(
+                EBearerIdGPRS,
+                byCell,
+                iGPRSSupportedByPhone );
+
+        iServer->Iap()->GetBearerSupportInfo(
+                EBearerIdWCDMA,
+                byCell,
+                iWCDMASupportedByPhone );
+
+        if ( byCell && ( iGPRSSupportedByPhone || iWCDMASupportedByPhone ) )
+            {
+            iPSD = ETrue;
+            }
+        }
+
+    // Start receiving notifications if the phone supports some bearer
+    if ( iGPRSSupportedByPhone || iWCDMASupportedByPhone )
+        {
+        iServer->Iap()->PacketService()->NotifyChangeOfNtwkRegStatus(
+                iStatus,
+                iRegStatus );
+        SetActive();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CBearerAvailabilityNotifier::DoCancel
+// Cancels the request from ETel.
+// -----------------------------------------------------------------------------
+//
+void CBearerAvailabilityNotifier::DoCancel()
+    {
+    if ( IsActive() )
+        {
+        iServer->Iap()->PacketService()->CancelAsyncRequest( EPacketNotifyChangeOfNtwkRegStatus );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CBearerAvailabilityNotifier::RunL
+// Handles the event that has arrived from ETel
+// -----------------------------------------------------------------------------
+//
+void CBearerAvailabilityNotifier::RunL()
+    {
+    //LOGENTRFN("CBearerAvailabilityNotifier::RunL()")
+
+    // All RunL():s outside CServer-derived main class MUST NOT LEAVE.
+    // Use TRAPD when needed.
+
+    LOGIT(".")
+    LOGIT1("RunL: CBearerAvailabilityNotifier, status %d", iStatus.Int())
+
+    if ( iStatus.Int() != KErrNone )
+        {
+        LOGIT1("SERVER: Bearer availability event FAILED <%d>", iStatus.Int() )
+        }
+    else
+        {
+        iEventInfo.Reset();
+
+        iEventInfo.iEventType = EConnMonBearerAvailabilityChange;
+
+        if ( iGPRSSupportedByPhone || iWCDMASupportedByPhone )
+            {
+            if ( iRegStatus != RPacketService::ENotRegisteredNotSearching &&
+                 iRegStatus != RPacketService::ENotRegisteredSearching    &&
+                 iRegStatus != RPacketService::ERegistrationDenied        &&
+                 iRegStatus != RPacketService::ENotRegisteredAndNotAvailable )
+                {
+                // Check the capabilities of the cell
+                RPacketService::TDynamicCapsFlags capsDynamic;
+                TInt err = iServer->Iap()->PacketService()->GetDynamicCaps( capsDynamic );
+
+                if ( err != KErrNone )
+                    {
+                    capsDynamic = 0;
+                    }
+
+                if ( ( capsDynamic & RPacketService::KCapsManualAttach ) ||
+                     ( capsDynamic & RPacketService::KCapsManualDetach ) )
+                    {
+                    // Query the TSY for the attach mode
+                    RPacketService::TAttachMode attachMode( RPacketService::EAttachWhenNeeded );
+                    err = iServer->Iap()->PacketService()->GetAttachMode( attachMode );
+
+                    // Query packet network status (but only if the TSY is set to attach when possible)
+                    if ( err == KErrNone && attachMode == RPacketService::EAttachWhenPossible )
+                        {
+                        RPacketService::TStatus status( RPacketService::EStatusUnattached );
+                        err = iServer->Iap()->PacketService()->GetStatus( status );
+
+                        if ( err == KErrNone && status != RPacketService::EStatusUnattached )
+                            {
+                            iEventInfo.iData = ETrue;
+                            }
+                        }
+                    else
+                        {
+                        // Attach mode is 'WhenNeeded'
+                        iEventInfo.iData = ETrue;
+                        }
+                    }
+                }
+
+            if ( static_cast< TUint >( iPSD ) != iEventInfo.iData )
+                {
+                // Send BEARER availability changed -event.
+                // Find out the bearer ID (GPRS/WCDMA).
+                iServer->Iap()->GetBearerId( iEventInfo.iConnectionId );
+
+                // Send the event only if threshold is set by some of the clients.
+                TUint threshold( 0 );
+
+                iServer->CalculateThreshold(
+                        EBearerIdAll,
+                        EBearerAvailabilityThreshold,
+                        threshold );
+
+                // Don't send the BEARER availability -event if nobody wants it (threshold = 0)
+                if ( threshold > 0 )
+                    {
+                    iServer->EventQueue()->Add( iEventInfo );
+                    }
+
+                LOGIT2("SERVER: EVENT -> Bearer availability changed: data %d, id %d",
+                        iEventInfo.iData, iEventInfo.iConnectionId)
+
+                iPSD = iEventInfo.iData;
+                }
+            }
+
+        LOGIT("CBearerAvailabilityNotifier::RunL triggered HandleAvailabilityChange()")
+        iServer->AvailabilityManager()->HandleAvailabilityChange();
+
+        // This is due to off-line mode not triggering the event and user might
+        // think that the packet data is available still..
+        iServer->Iap()->DtmStateChanged();
+        }
+    // New request (with no initializations)
+    Receive( EFalse );
+    //LOGEXITFN("CBearerAvailabilityNotifier::RunL()")
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CGsmSignalNotifier::CGsmSignalNotifier
+// Notifies when GSM signal strength changes.
+// -----------------------------------------------------------------------------
+//
+CGsmSignalNotifier::CGsmSignalNotifier(
+        CConnMonServer* aServer,
+        RMobilePhone& aMobilePhone )
+        :
+        CActive( EConnMonPriorityNormal ),
+        iServer( aServer ),
+        iMobilePhone( aMobilePhone )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CGsmSignalNotifier::Construct
+// -----------------------------------------------------------------------------
+//
+void CGsmSignalNotifier::Construct()
+    {
+    //LOGENTRFN("CGsmSignalNotifier::Construct()")
+    CActiveScheduler::Add( this );
+    LOGIT("Created CGsmSignalNotifier")
+    //LOGEXITFN("CGsmSignalNotifier::Construct()")
+    }
+
+// -----------------------------------------------------------------------------
+// CGsmSignalNotifier::NewL
+// -----------------------------------------------------------------------------
+//
+CGsmSignalNotifier* CGsmSignalNotifier::NewL(
+        CConnMonServer* aServer,
+        RMobilePhone& aMobilePhone )
+    {
+    CGsmSignalNotifier* self = new( ELeave ) CGsmSignalNotifier( aServer, aMobilePhone );
+    self->Construct();
+    return self;
+    }
+
+// Destructor
+CGsmSignalNotifier::~CGsmSignalNotifier()
+    {
+    Cancel();
+
+    iServer = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CGsmSignalNotifier::Receive
+// Requests a new event (signal strength changed) from ETel
+// -----------------------------------------------------------------------------
+//
+void CGsmSignalNotifier::Receive()
+    {
+    if ( IsActive() )
+        {
+        return;
+        }
+
+    TUint threshold( 0 );
+
+    // Threshold is owned by the session (not connection)
+    iServer->CalculateThreshold( EBearerIdAll, ESignalStrengthThreshold, threshold );
+
+    if ( threshold > 0 )
+        {
+        iMobilePhone.NotifySignalStrengthChange( iStatus, iSignalStrength, iBar );
+        SetActive();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CGsmSignalNotifier::DoCancel
+// Cancels the request from ETel.
+// -----------------------------------------------------------------------------
+//
+void CGsmSignalNotifier::DoCancel()
+    {
+    if ( IsActive() )
+        {
+        iMobilePhone.CancelAsyncRequest( EMobilePhoneNotifySignalStrengthChange );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CGsmSignalNotifier::RunL
+// Handles the event that has arrived from ETel
+// -----------------------------------------------------------------------------
+//
+void CGsmSignalNotifier::RunL()
+    {
+    LOGENTRFN("CGsmSignalNotifier::RunL()")
+
+    // All RunL():s outside CServer-derived main class MUST NOT LEAVE.
+    // Use TRAPD when needed.
+
+    if ( iStatus.Int() != KErrNone )
+        {
+        LOGIT1("SERVER: GSM signal strength event FAILED <%d>", iStatus.Int() )
+        }
+    else
+        {
+        // Is this a new registration status value
+        if ( iEventInfo.iData != static_cast< TUint >( iSignalStrength ) )
+            {
+            iEventInfo.Reset();
+
+            iEventInfo.iData = iSignalStrength;
+            iEventInfo.iEventType = EConnMonSignalStrengthChange;
+
+            // Find out bearer ID.
+            TInt err = iServer->Iap()->GetBearerId( iEventInfo.iConnectionId );
+
+            if ( err == KErrNone )
+                {
+                iServer->EventQueue()->Add( iEventInfo );
+                }
+            }
+
+        LOGIT2("SERVER: EVENT -> Signal strength <%d>, id <%d>", iEventInfo.iData, iEventInfo.iConnectionId )
+
+        // New request
+        Receive();
+        }
+    LOGEXITFN("CGsmSignalNotifier::RunL()")
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CActivityNotifier::CActivityNotifier
+// -----------------------------------------------------------------------------
+//
+CActivityNotifier::CActivityNotifier(
+        CConnMonServer* aServer,
+        RConnection* aConnection,
+        const TUint& aConnectionId,
+        const TUint& aSubConnectionId )
+        :
+        CActive( EConnMonPriorityNormal ),
+        iServer( aServer ),
+        iConnection( aConnection ),
+        iConnectionId( aConnectionId),
+        iSubConnectionId( aSubConnectionId ),
+        iActivity( 0 ),
+        iPckgActivity( iActivity )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CActivityNotifier::Construct
+// -----------------------------------------------------------------------------
+//
+void CActivityNotifier::Construct()
+    {
+    //LOGENTRFN("CActivityNotifier::Construct()")
+    CActiveScheduler::Add( this );
+    LOGIT("Created CActivityNotifier")
+    //LOGEXITFN("CActivityNotifier::Construct()")
+    }
+
+// Destructor
+CActivityNotifier::~CActivityNotifier()
+    {
+    Cancel();
+
+    iServer = NULL;
+    iConnection = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CActivityNotifier::Receive
+// Requests a new event (activity changed) from RConnection
+// -----------------------------------------------------------------------------
+//
+void CActivityNotifier::Receive( TBool aActivity )
+    {
+    if ( IsActive() )
+        {
+        return;
+        }
+
+    // Don't make a new request if previous
+    // status indicates that connection is closing
+    if ( iStatus == KErrDisconnected )
+        {
+        return;
+        }
+
+    iActivity = aActivity;
+    iServer->CalculateThreshold( iConnectionId, EActivityTimeThreshold, iThreshold );
+
+    if ( iThreshold > 0 )
+        {
+        // Will complete when the connection activity has changed from given
+        // value (iActivity) for given period (threshold).
+        iConnection->IsConnectionActiveRequest( iThreshold, iPckgActivity, iStatus );
+        SetActive();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CActivityNotifier::ReceiveOne
+// Requests a new event (activity changed) from RConnection
+// -----------------------------------------------------------------------------
+//
+void CActivityNotifier::ReceiveOne( TBool aActivity )
+    {
+    if ( IsActive() )
+        {
+        Cancel();
+        }
+
+    iActivity = aActivity;
+    iThreshold = KOneTimeQueryThreshold; // 1 second
+
+    // NOTE. Timer will expire once in a second.
+    // This should be used only with one shot querries ( -> cancel after a period
+    // if this has not completed otherwise ).
+    iConnection->IsConnectionActiveRequest( iThreshold, iPckgActivity, iStatus );
+    SetActive();
+    }
+
+// -----------------------------------------------------------------------------
+// CActivityNotifier::DoCancel
+// Cancels the request from RConnection.
+// -----------------------------------------------------------------------------
+//
+void CActivityNotifier::DoCancel()
+    {
+    if ( IsActive() )
+        {
+        // Complete any outstanding one time queries if the are any
+        iServer->SendActivityToSessions( iConnectionId, iPckgActivity(), 0 );
+
+        LOGIT2("Activity completed (DoCancel): %d, id %d", iPckgActivity(), iConnectionId)
+
+        // Cancel the request from RConnection
+        iConnection->IsConnectionActiveCancel();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CActivityNotifier::RunL
+// Handles the event that has arrived from RConnection
+// -----------------------------------------------------------------------------
+//
+void CActivityNotifier::RunL()
+    {
+    //LOGENTRFN("CActivityNotifier::RunL()")
+
+    // All RunL():s outside CServer-derived main class MUST NOT LEAVE.
+    // Use TRAPD when needed.
+
+    LOGIT(".")
+    LOGIT1("RunL: CActivityNotifier, status %d", iStatus.Int())
+
+    if ( iThreshold == KOneTimeQueryThreshold )
+        {
+        // One time query has been issued
+        iServer->SendActivityToSessions( iConnectionId, iPckgActivity(), iStatus.Int() );
+
+        LOGIT2("Activity req completed: %d, id %d", iPckgActivity(), iConnectionId)
+
+        // Update internal table
+        iActivity = iPckgActivity();
+        iServer->Iap()->UpdateActivity( iConnectionId, iActivity );
+
+        // Somebody has started notifications while we were waiting
+        // one time call to return -> go on with notifications
+        if ( ( iServer->NumberOfListeners() > 0 ) && ( iStatus.Int() == KErrNone ) )
+            {
+            // Send event to clients
+            iEventInfo.Reset();
+
+            iEventInfo.iConnectionId    = iConnectionId;
+            iEventInfo.iSubConnectionId = iSubConnectionId;
+            iEventInfo.iEventType       = EConnMonConnectionActivityChange;
+            iEventInfo.iData            = iPckgActivity();
+
+            iServer->EventQueue()->Add( iEventInfo );
+
+            Receive( iActivity );
+            }
+        }
+    else
+        {
+        // A real event has been requested
+        if ( iStatus.Int() != KErrNone )
+            {
+            if ( iStatus.Int() == KErrCancel )
+                {
+                iStatus = KErrDisconnected;
+                }
+
+            LOGIT2("Activity event FAILED <%d>, id %d", iStatus.Int(), iConnectionId)
+            }
+        else
+            {
+            iEventInfo.Reset();
+
+            // Send event(s) to clients
+            iEventInfo.iConnectionId    = iConnectionId;
+            iEventInfo.iSubConnectionId = iSubConnectionId;
+            iEventInfo.iEventType       = EConnMonConnectionActivityChange;
+            iEventInfo.iData            = iPckgActivity();
+
+            LOGIT2("SERVER: EVENT -> Activity change: %d, id %d", iEventInfo.iData, iEventInfo.iConnectionId)
+
+            iServer->EventQueue()->Add( iEventInfo );
+
+            // Update internal table
+            iActivity = iPckgActivity();
+            iServer->Iap()->UpdateActivity( iConnectionId, iActivity );
+
+            // New request
+            Receive( iActivity );
+            }
+        }
+    //LOGEXITFN("CActivityNotifier::RunL()")
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CSubConnUpDownNotifier::CSubConnUpDownNotifier
+// -----------------------------------------------------------------------------
+//
+CSubConnUpDownNotifier::CSubConnUpDownNotifier(
+        CConnMonServer* aServer,
+        RConnection* aConnection,
+        const TUint& aConnectionId,
+        const TUint& aSubConnectionId )
+        :
+        CActive( EConnMonPriorityMedium ),
+        iServer( aServer ),
+        iConnection( aConnection ),
+        iConnectionId( aConnectionId),
+        iSubConnectionId( aSubConnectionId )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CSubConnUpDownNotifier::Construct
+// -----------------------------------------------------------------------------
+//
+void CSubConnUpDownNotifier::Construct()
+    {
+    //LOGENTRFN("CSubConnUpDownNotifier::Construct()")
+    CActiveScheduler::Add( this );
+    LOGIT("Created CSubConnUpDownNotifier")
+    //LOGEXITFN("CSubConnUpDownNotifier::Construct()")
+    }
+
+// Destructor
+CSubConnUpDownNotifier::~CSubConnUpDownNotifier()
+    {
+    if ( IsActive() )
+        {
+        Cancel();
+        }
+
+    iServer = NULL;
+    iConnection = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CSubConnUpDownNotifier::Receive
+// Requests a new event (subconnection up/down) from RConnection
+// -----------------------------------------------------------------------------
+//
+void CSubConnUpDownNotifier::Receive()
+    {
+    if ( IsActive() )
+        {
+        Cancel();
+        }
+
+    if ( iStatus == KErrDisconnected )
+        {
+        return;
+        }
+
+    iConnection->AllSubConnectionNotification( iSubConnEventBuf, iStatus );
+    SetActive();
+    }
+
+// -----------------------------------------------------------------------------
+// CSubConnUpDownNotifier::SendDeletedEvent
+// Sends connection deleted event to the clients
+// -----------------------------------------------------------------------------
+//
+void CSubConnUpDownNotifier::SendDeletedEvent()
+    {
+    if ( !iDeleteSent )
+        {
+        iEventInfo.Reset();
+
+        iEventInfo.iEventType       = EConnMonDeleteConnection;
+        iEventInfo.iConnectionId    = iConnectionId;
+        iEventInfo.iSubConnectionId = iSubConnectionId;
+        iEventInfo.iData            = iTotalDownlinkDataVolume;
+        iEventInfo.iData2           = iTotalUplinkDataVolume;
+
+        // Find out type of the delete
+        CProgressNotifier* progressNotifier = 0;
+        TInt err = iServer->Iap()->GetProgressNotifier( iConnectionId, &progressNotifier );
+
+        if ( err == KErrNone )
+            {
+            iEventInfo.iData3 = progressNotifier->IsAuthDelete();
+            }
+
+        // Send event to all clients that are listening
+        iServer->EventQueue()->Add( iEventInfo );
+
+        iDeleteSent = ETrue;
+
+        if ( iInterfaceClosed )
+            {
+            // Remove connection from the connection table if interface
+            // has closed.
+            TBearerInfo bearerInfo;
+            TConnInfo connInfo( 0, 0, iConnectionId, 0, bearerInfo );
+            iServer->Iap()->RemoveConnection( connInfo );
+            }
+        else
+            {
+            if ( progressNotifier->CanReconnect() )
+                {
+                // Go on listening subinterface events
+                iConnection->AllSubConnectionNotification( iSubConnEventBuf, iStatus );
+                SetActive();
+                }
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CSubConnUpDownNotifier::DeleteSent
+// -----------------------------------------------------------------------------
+//
+TBool CSubConnUpDownNotifier::DeleteSent() const
+    {
+    return iDeleteSent;
+    }
+
+// -----------------------------------------------------------------------------
+// CSubConnUpDownNotifier::SetInterfaceClosed
+// -----------------------------------------------------------------------------
+//
+void CSubConnUpDownNotifier::SetInterfaceClosed()
+    {
+    iInterfaceClosed = ETrue;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CSubConnUpDownNotifier::DoCancel
+// Cancels the request from RConnection.
+// -----------------------------------------------------------------------------
+//
+void CSubConnUpDownNotifier::DoCancel()
+    {
+    if ( IsActive() )
+        {
+        iConnection->CancelAllSubConnectionNotification();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CSubConnUpDownNotifier::RunL
+// Handles the event that has arrived from RConnection
+// -----------------------------------------------------------------------------
+//
+void CSubConnUpDownNotifier::RunL()
+    {
+    //LOGENTRFN("CSubConnUpDownNotifier::RunL()")
+
+    // All RunL():s outside CServer-derived main class MUST NOT LEAVE.
+    // Use TRAPD when needed.
+
+    LOGIT(".")
+    LOGIT1("RunL: CSubConnUpDownNotifier, status %d", iStatus.Int())
+
+    if ( iStatus.Int() != KErrNone )
+        {
+        LOGIT2("SERVER: subconn up/down event for id %d FAILED <%d>", iConnectionId, iStatus.Int())
+
+        if ( iStatus.Int() == KErrNotReady )
+            {
+            // Subinterface has disappered
+            CProgressNotifier* progressNotifier = 0;
+            TInt err = iServer->Iap()->GetProgressNotifier( iConnectionId, &progressNotifier );
+            if ( err == KErrNone )
+                {
+                // Is progress notifier still alive
+                if ( !progressNotifier->IsActive() )
+                    {
+                    SendDeletedEvent();
+                    }
+                }
+            }
+
+        iStatus = KErrDied;
+        }
+    else
+        {
+        TSubConnectionEvent& event = ( TSubConnectionEvent& )( *iSubConnEventBuf.Ptr() );
+
+        if ( event.iSubConnectionUniqueId == 0 && event.iEventType == ESubConnectionClosed )
+            {
+            TSubConnectionClosedEvent& closedEvent =
+                    (TSubConnectionClosedEvent&)( *iSubConnEventBuf.Ptr() );
+            iTotalDownlinkDataVolume = closedEvent.iTotalDownlinkDataVolume;
+            iTotalUplinkDataVolume   = closedEvent.iTotalUplinkDataVolume;
+
+            LOGIT3("SERVER: EVENT -> Connection %d closed, u: %d, d: %d",
+                    iConnectionId, iTotalUplinkDataVolume, iTotalDownlinkDataVolume)
+
+            CProgressNotifier* progressNotifier = 0;
+            TInt err = iServer->Iap()->GetProgressNotifier( iConnectionId, &progressNotifier );
+            if ( err == KErrNone )
+                {
+                // Progess notifier has stopped and allinterface closed event has arrived
+                if ( !progressNotifier->IsActive() )
+                    {
+                    SendDeletedEvent();
+                    }
+                }
+            else
+                {
+                SendDeletedEvent();
+                }
+
+            iStatus = KErrDisconnected;
+            }
+        else if ( ( event.iSubConnectionUniqueId == 0 ) &&
+                  ( event.iEventType == ESubConnectionOpened ) )
+            {
+            // IS THIS A RECONNECT
+            if ( iDeleteSent && !iInterfaceClosed )
+                {
+                TUint newId( iConnectionId );
+                TInt err = iServer->Iap()->Reconnect( newId );
+
+                if ( err == KErrNone )
+                    {
+                    iEventInfo.Reset();
+                    iEventInfo.iEventType    = EConnMonCreateConnection;
+                    iEventInfo.iConnectionId = newId;
+
+                    // Send event to all clients that are listening
+                    iServer->EventQueue()->Add( iEventInfo );
+
+                    LOGIT1("SERVER: EVENT -> new connection %d created (RECONNECTED)", newId)
+                    delete this;
+                    }
+                }
+             else
+                {
+                // New request
+                Receive();
+                }
+            }
+        else
+            {
+            // New request
+            iConnection->AllSubConnectionNotification( iSubConnEventBuf, iStatus );
+            SetActive();
+            }
+        }
+    //LOGEXITFN("CSubConnUpDownNotifier::RunL()")
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CTimerAO::CTimerAO
+// -----------------------------------------------------------------------------
+//
+CTimerAO::CTimerAO(
+        CConnMonServer* aServer,
+        const TUint& aConnectionId,
+        const TUint8& aActivity )
+        :
+        CActive( EConnMonPriorityNormal ),
+        iServer( aServer ),
+        iConnectionId( aConnectionId ),
+        iActivity( aActivity )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CTimerAO::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CTimerAO::ConstructL()
+    {
+    //LOGENTRFN("CTimerAO::ConstructL()")
+    CActiveScheduler::Add( this );
+    User::LeaveIfError( iTimer.CreateLocal() );
+    //LOGEXITFN("CTimerAO::ConstructL()")
+    }
+
+// Destructor
+CTimerAO::~CTimerAO()
+    {
+    Cancel();
+    iTimer.Close();
+
+    iServer = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CTimerAO::Start
+// -----------------------------------------------------------------------------
+//
+void CTimerAO::Start()
+    {
+    if ( !IsActive() )
+        {
+        iTimer.After( iStatus, KActivityTimeout );
+        SetActive();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CTimerAO::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CTimerAO::DoCancel()
+    {
+    if ( IsActive() )
+        {
+        iTimer.Cancel();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CTimerAO::RunL
+// -----------------------------------------------------------------------------
+//
+void CTimerAO::RunL()
+    {
+    CActivityNotifier* activityNotifier = 0;
+
+    TInt err = iServer->Iap()->GetActivityNotifier( iConnectionId, &activityNotifier );
+
+    if ( ( err == KErrNone ) && ( activityNotifier != 0 ) )
+        {
+        if ( activityNotifier->IsActive() )
+            {
+            TUint threshold( activityNotifier->Threshold() );
+
+            if ( threshold == KOneTimeQueryThreshold )
+                {
+                // Timer has completed before one time activity query.
+                // Cancel it to complete client requests
+                activityNotifier->Cancel();
+
+                // Someboby has started notifications while we were waiting this to
+                // complete -> go on with the notifications
+                if ( iServer->NumberOfListeners() > 0 )
+                    {
+                    activityNotifier->Receive( iActivity );
+                    }
+                }
+            }
+        }
+
+    delete this;
+    }
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/src/ConnMonServ.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,878 @@
+/*
+* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Connection Monitor server.
+*
+*/
+
+#include <featmgr.h>
+#include <rconnmon.h>
+
+#include "ConnMonServ.h"
+#include "ConnMonDef.h"
+#include "ConnMonIAP.h"
+#include "ConnMonSess.h"
+#include "CEventQueue.h"
+#include "log.h"
+
+#include "ConnMonAvailabilityManager.h"
+#include "connmoncommsdatcache.h"
+#include "ConnMonBearerCSD.h"
+#include "ConnMonBearerGPRS.h"
+#include "ConnMonBearerLAN.h"
+#include "ConnMonBearerWLAN.h"
+#include "ConnMonBearerGroupManager.h"
+#include "connmoncommsdatnotifier.h"
+
+// ============================ LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// PanicServer
+// Panics the server in case of programming error.
+// -----------------------------------------------------------------------------
+//
+void PanicServer( TInt aPanic )
+    {
+    _LIT( KPanicCategory, "ConnectionMonitor Server" );
+    User::Panic( KPanicCategory, aPanic );
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CConnMonScheduler::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CConnMonScheduler::ConstructL()
+    {
+    // Construct active scheduler
+    CConnMonScheduler* self = new( ELeave ) CConnMonScheduler;
+    CActiveScheduler::Install( self );
+
+    // Construct server
+    self->iServer = new( ELeave ) CConnMonServer;
+    self->iServer->ConstructL();
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonScheduler::~CConnMonScheduler
+// -----------------------------------------------------------------------------
+//
+CConnMonScheduler::~CConnMonScheduler()
+    {
+    delete iServer;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonScheduler::LaunchFromClient
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonScheduler::LaunchFromClient()
+    {
+    LOGENTRFN("CConnMonScheduler::LaunchFromClient()")
+    TInt err( KErrNone );
+
+    // Set up waiting apparatus
+    TRequestStatus status;
+    TSignal signal( status );
+
+    // Create semaphore to allow to signal when server has started
+    RSemaphore globStartSignal;
+
+    LOGTIMINGSTART("CConnMonScheduler::LaunchFromClient()")
+
+    err = globStartSignal.CreateGlobal( KConnMonStartupSemaphore, 0 );
+    if ( err != KErrNone )
+        {
+        // If semaphore already exists, open it and wait
+        err = globStartSignal.OpenGlobal( KConnMonStartupSemaphore, EOwnerProcess );
+        if ( KErrNone == err )
+            {
+            LOGIT("LaunchFromClient: semaphore in use, waiting release...")
+            globStartSignal.Wait();
+            globStartSignal.Signal();
+            globStartSignal.Close();
+            LOGTIMINGEND("CConnMonScheduler::LaunchFromClient() (waiting)")
+            LOGIT("LaunchFromClient: semaphore released")
+            }
+        else
+            {
+            LOGIT1("LaunchFromClient: semaphore in use, but open failed <%d>", err)
+            }
+        LOGEXITFN1("CConnMonScheduler::LaunchFromClient()", err)
+        return err;
+        }
+
+    RProcess server;
+    err = server.Create(
+            KConnectionMonitorServerExe,
+            signal.Get(),
+            TUidType( KNullUid, KNullUid, KConnMonServerUid ),
+            EOwnerThread );
+    if ( err != KErrNone )
+        {
+        LOGIT1("LaunchFromClient: ERROR, server creation failed <%d>", err)
+        LOGEXITFN1("CConnMonScheduler::LaunchFromClient()", err)
+        return err;
+        }
+
+    server.Rendezvous( status );
+    if ( status != KRequestPending )
+        {
+        server.Kill( 0 ); // Abort startup
+        }
+    else
+        {
+        server.Resume(); // Logon OK - start the server
+        }
+
+    // Wait for launch to complete
+    User::WaitForRequest( status );
+
+    // We can't use the 'exit reason' if the server panicked as this is the
+    // panic 'reason' and may be '0' which cannot be distinguished from KErrNone
+    if ( server.ExitType() == EExitPanic )
+        {
+        LOGIT2("LaunchFromClient: ERROR, server start PANIC, reason: %d, status: %d", server.ExitReason(), status.Int())
+        err = KErrGeneral;
+        }
+    else
+        {
+        err = status.Int();
+        }
+
+    server.Close();
+
+    // Signal other clients that server process has started
+    globStartSignal.Signal();
+
+    // Delete semaphore
+    globStartSignal.Close();
+
+    LOGTIMINGEND("CConnMonScheduler::LaunchFromClient() (real)")
+    LOGEXITFN1("CConnMonScheduler::LaunchFromClient()", err)
+    return err;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CConnMonScheduler::ThreadStart
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CConnMonScheduler::ThreadStart( TSignal& /*aSignal*/ )
+    {
+    __UHEAP_MARK;
+    LOGENTRFN("CConnMonScheduler::ThreadStart()")
+    TInt err( KErrNone );
+
+    // Get cleanup stack
+    CTrapCleanup* cleanup = CTrapCleanup::New();
+    // Initialize all up to and excluding starting scheduler
+    if ( cleanup )
+        {
+        TRAP( err, ConstructL() );
+        }
+    else
+        {
+        err = KErrNoMemory;
+        }
+
+    // Tell starting thread we've started and start the active scheduler
+    // Scheduler will "sit" here while the server is running because
+    // Start() will return only when server calls CActiveScheduler::Stop().
+    if ( KErrNone == err )
+        {
+        RProcess::Rendezvous( KErrNone );
+        CActiveScheduler::Start();
+        }
+
+    // Close things down because server has died
+    delete CActiveScheduler::Current();
+    delete cleanup;
+
+    __UHEAP_MARKEND;
+    LOGEXITFN1("CConnMonScheduler::ThreadStart()", err)
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonScheduler::Error
+// -----------------------------------------------------------------------------
+//
+void CConnMonScheduler::Error( TInt aError ) const
+    {
+    // Panic if error didn't arise from server
+    if ( iServer->IsActive() )
+        {
+        PanicServer( EErrorFromNonClientObject );
+        }
+
+    // If it's a bad descriptor, panic the client
+    if ( aError == KErrBadDescriptor )
+        {
+        iServer->PanicClient( EBadDescriptor );
+        }
+
+    iServer->Error( aError );
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CConnMonServer::CConnMonServer
+// -----------------------------------------------------------------------------
+//
+CConnMonServer::CConnMonServer()
+        :
+        CPolicyServer( CActive::EPriorityStandard, KConnMonPolicy ),
+        iAvailabilityManager( NULL )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonServer::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CConnMonServer::ConstructL()
+    {
+    LOGENTRFN("CConnMonServer::ConstructL()")
+    LOGIT("ConstructL: Server trying to start...")
+
+    // Naming the server thread after the server helps debugging panics.
+    RThread::RenameMe( KConnectionMonitorServerName );
+
+    // Construct IAP wrapper
+    iIap = new( ELeave ) CConnMonIAP( this );
+    iIap->ConstructL();
+
+    // Construct event queue
+    iEventQueue = new( ELeave ) CEventQueue;
+    iEventQueue->ConstructL( this );
+
+    // Create the object container index
+    iContainerIndex = CObjectConIx::NewL();
+
+    // Construct shutdown timer
+    iShutdown = new( ELeave ) CConnMonDelayedShutdown( this );
+    iShutdown->ConstructL();
+
+
+    ////// Availability stuff
+
+    // CommsDat cache
+    iCommsDatCache = CConnMonCommsDatCache::NewL();
+
+    // Add bearers to array
+    User::LeaveIfError(
+            iBearers.Append( new( ELeave ) TConnMonBearerCSD( iIap, iCommsDatCache ) ) );
+    User::LeaveIfError(
+            iBearers.Append( new( ELeave ) TConnMonBearerGPRS( iIap, iCommsDatCache ) ) );
+    User::LeaveIfError(
+            iBearers.Append( new( ELeave ) TConnMonBearerLAN( iIap, iCommsDatCache ) ) );
+
+    // Initialize FeatureManager
+    FeatureManager::InitializeLibL();
+
+    #ifndef __WINSCW__  // WINS does not support WLAN
+    // Check if WLAN is enabled
+    if ( FeatureManager::FeatureSupported( KFeatureIdProtocolWlan ) )
+        {
+        User::LeaveIfError(
+                iBearers.Append( new( ELeave ) TConnMonBearerWLAN( iIap, iCommsDatCache ) ) );
+        }
+    #endif
+    LOGIT1("ConstructL: iBearers constructed, count <%d>", iBearers.Count() )
+
+    // Initialize the CommsDat cache. Will read the necessary CommsDat tables
+    // and populate the cache tables with current information. Any changes
+    // after this init phase will trigger ConnMon events when appropriate.
+    iCommsDatCache->Init( this, iIap, &iBearers );
+
+    // IAP / SNAP availability manager
+    iAvailabilityManager = CConnMonAvailabilityManager::NewL(
+            iCommsDatCache,
+            this );
+
+    // Central Repository notifiers
+    iIapTableNotifier = CConnMonCommsDatNotifier::NewL(
+            iAvailabilityManager,
+            iCommsDatCache->GetIapRecordTableId() );
+    iSnapTableNotifier = CConnMonCommsDatNotifier::NewL(
+            iAvailabilityManager,
+            iCommsDatCache->GetSnapRecordTableId() );
+    iVirtualTableNotifier = CConnMonCommsDatNotifier::NewL(
+            iAvailabilityManager,
+            iCommsDatCache->GetVirtualRecordTableId() );
+    LOGIT("ConstructL: Availability manager and CenRep notifiers constructed")
+
+    // Bearer group manager
+    iBearerGroupManager = CConnMonBearerGroupManager::NewL();
+    LOGIT("ConstructL: Bearer group manager constructed")
+
+    // Identify ourselves and open for service
+    StartL( KConnectionMonitorServerName );
+
+    LOGIT("ConstructL: Server started successfully")
+    LOGEXITFN("CConnMonServer::ConstructL()")
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonServer::~CConnMonServer
+// -----------------------------------------------------------------------------
+//
+CConnMonServer::~CConnMonServer()
+    {
+    LOGIT("Server: Running destructor")
+
+    delete iIap;
+    delete iEventQueue;
+    delete iContainerIndex;
+    delete iShutdown;
+
+    // Bearers to array
+    iBearers.ResetAndDestroy();
+    iBearers.Close();
+
+    // Availability manager
+    delete iAvailabilityManager;
+
+    // CenRep notification listeners
+    if ( iIapTableNotifier )
+        {
+        iIapTableNotifier->Cancel();
+        }
+    if ( iSnapTableNotifier )
+        {
+        iSnapTableNotifier->Cancel();
+        }
+    if ( iVirtualTableNotifier )
+        {
+        iVirtualTableNotifier->Cancel();
+        }
+    delete iIapTableNotifier;
+    delete iSnapTableNotifier;
+    delete iVirtualTableNotifier;
+
+    // CommsDat cache
+    delete iCommsDatCache;
+
+    // Bearer Group Manager
+    delete iBearerGroupManager;
+
+    FeatureManager::UnInitializeLib();
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonServer::NewSessionL
+// -----------------------------------------------------------------------------
+//
+CSession2* CConnMonServer::NewSessionL(
+        const TVersion& /*aVersion*/,
+        const RMessage2& /*aMessage*/ ) const
+    {
+    CConnMonSession* session = new( ELeave ) CConnMonSession(
+            CONST_CAST( CConnMonServer*, this ) );
+
+    CleanupStack::PushL( session );
+    session->ConstructL();
+    CleanupStack::Pop( session );
+    CONST_CAST( CConnMonServer*, this )->IncrementSessions();
+    return session;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonServer::IncrementSessions
+// -----------------------------------------------------------------------------
+//
+void CConnMonServer::IncrementSessions()
+    {
+    iSessionCount++;
+    iShutdown->Cancel();
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonServer::DecrementSessions
+// -----------------------------------------------------------------------------
+//
+void CConnMonServer::DecrementSessions()
+    {
+    iSessionCount--;
+
+    if ( iSessionCount > 0 )
+        {
+        return;
+        }
+    if ( !iShutdown->IsActive() )
+        {
+        iShutdown->Start();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonServer::SendEventToSessions
+// -----------------------------------------------------------------------------
+//
+void CConnMonServer::SendEventToSessions( const TEvent& aEvent, TInt& aNumOffered )
+    {
+    CSession2* session;
+
+    // Iterate through sessions
+    iSessionIter.SetToFirst();
+    for ( session = iSessionIter++; session; session = iSessionIter++ )
+        {
+        CConnMonSession* cmsession = static_cast<CConnMonSession*>( session );
+        if ( cmsession->CanReceiveEvent() )
+            {
+            cmsession->SendEventToClient( aEvent );
+            ++aNumOffered;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonServer::SendDataVolumesToSessions
+// -----------------------------------------------------------------------------
+//
+void CConnMonServer::SendDataVolumesToSessions(
+        const TUint aConnectionId,
+        const TUint aDlData,
+        const TUint aUlData,
+        const TInt  aStatus )
+    {
+    CSession2* session;
+
+    // Iterate through sessions
+    iSessionIter.SetToFirst();
+    for ( session = iSessionIter++; session; session = iSessionIter++ )
+        {
+        ( static_cast<CConnMonSession*>( session ) )->CompleteDataVolumeRequests(
+                aConnectionId,
+                aDlData,
+                aUlData,
+                aStatus );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonServer::SendActivityToSessions
+// -----------------------------------------------------------------------------
+//
+void CConnMonServer::SendActivityToSessions(
+        const TUint aConnectionId,
+        const TBool aActivity,
+        const TInt  aStatus )
+    {
+    CSession2* session;
+
+    // Iterate through sessions
+    iSessionIter.SetToFirst();
+    for ( session = iSessionIter++; session; session = iSessionIter++ )
+        {
+        ( static_cast<CConnMonSession*>( session ) )->CompleteActivityRequests(
+                aConnectionId,
+                aActivity,
+                aStatus );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonServer::RemoveConnSettingsFromSessions
+// -----------------------------------------------------------------------------
+//
+void CConnMonServer::RemoveConnSettingsFromSessions( const TUint aConnectionId )
+    {
+    CSession2* session;
+
+    // Iterate through sessions
+    iSessionIter.SetToFirst();
+    for ( session = iSessionIter++; session; session = iSessionIter++ )
+        {
+        ( static_cast<CConnMonSession*>( session ) )->RemoveConnectionParams(
+                aConnectionId );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonServer::NumberOfListeners
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonServer::NumberOfListeners()
+    {
+    CSession2* session;
+    CSession2* original;
+    TInt count( 0 );
+
+    original = iSessionIter;
+
+    // Iterate through sessions
+    iSessionIter.SetToFirst();
+    for ( session = iSessionIter++; session; session = iSessionIter++ )
+        {
+        if ( ( static_cast<CConnMonSession*>( session ) )->IsListening() )
+            {
+            ++count;
+            }
+        }
+
+    // Reset session iterator
+    if ( original != 0 )
+        {
+        iSessionIter.Set( *original );
+        }
+
+    return count;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonServer::CalculateThreshold
+// -----------------------------------------------------------------------------
+//
+void CConnMonServer::CalculateThreshold(
+        const TUint aConnectionId,
+        const TInt& aThresholdType,
+        TUint& aThreshold )
+    {
+    CSession2* session;
+    CSession2* original;
+    TUint th( 0 );
+
+    aThreshold = 0;
+    original = iSessionIter;
+
+    // Iterate through sessions to find the smallest threshold
+    iSessionIter.SetToFirst();
+    for ( session = iSessionIter++; session; session = iSessionIter++ )
+        {
+        if ( aThresholdType == EBearerAvailabilityThreshold ||
+                aThresholdType == ESignalStrengthThreshold )
+            {
+            // Bearer specific thresholds
+            ( static_cast<CConnMonSession*>( session ) )->GetBearerThreshold(
+                    aThresholdType,
+                    th );
+
+            if ( th != 0 )
+                {
+                aThreshold = 1;
+                }
+            }
+        else
+            {
+            // Connection Specific thresholds
+            TConnSettings connSettings( 0, 0, 0 );
+
+            ( static_cast<CConnMonSession*>( session ) )->GetConnectionSettings(
+                    aConnectionId,
+                    connSettings );
+            if ( aThresholdType == EDownlinkThreshold )
+                {
+                th = connSettings.iDLDataThreshold;
+                }
+            else if ( aThresholdType == EUplinkThreshold )
+                {
+                th = connSettings.iULDataThreshold;
+                }
+            else if ( aThresholdType == EActivityTimeThreshold )
+                {
+                th = connSettings.iActivityTimeThreshold;
+                }
+
+            if ( ( th > 0 ) && ( aThreshold == 0 || th < aThreshold ) )
+                {
+                aThreshold = th;
+                }
+            }
+        }
+
+    // Reset session iterator
+    if ( original != 0 )
+        {
+        iSessionIter.Set( *original );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonServer::NewContainerL
+// -----------------------------------------------------------------------------
+//
+CObjectCon* CConnMonServer::NewContainerL()
+    {
+    return iContainerIndex->CreateL();
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonServer::RemoveContainer
+// -----------------------------------------------------------------------------
+//
+void CConnMonServer::RemoveContainer( CObjectCon* aContainer )
+    {
+    iContainerIndex->Remove( aContainer );
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonServer::SendRequestToPlugin
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonServer::SendRequestToPlugin(
+        const TInt aType,
+        const RMessage2& aMessage,
+        const TBool aToAllPlugins )
+    {
+    TInt ret( KErrNotSupported );
+    TInt err( KErrNotSupported );
+    CSession2* session;
+
+    if ( FeatureManager::FeatureSupported( KFeatureIdConnMonExtension ) )
+        {
+        // Iterate through sessions
+        iSessionIter.SetToFirst();
+
+        for ( session = iSessionIter++; session; session = iSessionIter++ )
+            {
+            err = ( static_cast<CConnMonSession*>( session ) )->SendRequestToPlugin(
+                    aType,
+                    aMessage );
+
+            if ( ( err == KRequestPending ) || ( err == KErrNone ) )
+                {
+                // OK because a plugin has handled the request.
+                if ( aToAllPlugins )
+                    {
+                    ret = err;
+                    }
+                else
+                    {
+                    return err;
+                    }
+                }
+            }
+        }
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonServer::CancelAttributeRequestsFromPlugins
+// -----------------------------------------------------------------------------
+//
+void CConnMonServer::CancelAttributeRequestsFromPlugins(
+        const RThread& aClient,
+        const TInt aType )
+    {
+    CSession2* session;
+
+    if ( FeatureManager::FeatureSupported( KFeatureIdConnMonExtension ) )
+        {
+        // Iterate through sessions
+        iSessionIter.SetToFirst();
+
+        for ( session = iSessionIter++; session; session = iSessionIter++ )
+            {
+            ( static_cast<CConnMonSession*>( session ) )->CancelAttributeRequestFromPlugin(
+                    aClient,
+                    aType );
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonServer::PanicClient
+// -----------------------------------------------------------------------------
+//
+void CConnMonServer::PanicClient( TInt aPanic ) const
+    {
+    // Let's have a look before we panic the client
+    __DEBUGGER()
+
+    // Ok, go for it
+    LOGIT("Server: PanicClient: Sending panic")
+    /*_LIT( KConnectionMonitorServer, "ConnMonServ" );*/
+    /*Message().Panic( KConnectionMonitorServer, aPanic );*/
+    LOGIT1("Server: PanicClient: Panic removed to improve ConnMon robustness, code was <%d>", aPanic )
+    aPanic = aPanic; // To remove warning
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonServer::PanicClient
+// -----------------------------------------------------------------------------
+//
+void CConnMonServer::PanicClient( const RMessage2& aMsg, const TInt aPanic ) const
+    {
+    // Let's have a look before we panic the client
+    __DEBUGGER()
+
+    // Ok, go for it
+    LOGIT("Server: PanicClient: Sending panic")
+    /*_LIT( KConnectionMonitorServer, "ConnMonServ" );*/
+    /*aMsg.Panic( KConnectionMonitorServer, aPanic );*/
+    LOGIT1("Server: PanicClient: Panic removed to improve ConnMon robustness, code was <%d>", aPanic )
+    TInt panic = aPanic; // To remove warning
+    panic = aMsg.Int0(); // To remove warning
+    panic = panic; // To remove warning
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonServer::Error
+// -----------------------------------------------------------------------------
+//
+void CConnMonServer::Error( TInt aError )
+    {
+    if ( aError != KErrBadDescriptor )
+        {
+        // Anyway, complete the outstanding message
+        Message().Complete( aError );
+        }
+
+    // Ready to roll again
+    ReStart(); // Really means just continue reading client requests
+    }
+
+// -----------------------------------------------------------------------------
+// Get available IAP IDs for the IAPs with bearer aBearerId
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonServer::GetAvailableIaps( const TUint aBearerId, TConnMonIapInfo& aIapInfo )
+    {
+    // Currently CommsDat is read only after a change notification is received
+    // from CenRep about a relevant CommsDat table. If these events are
+    // unreliable, we can increase robustness by reading CommsDat tables again
+    // every time a client asks for IAP/SNAP availability information, but this
+    // will slow down the requests.
+    //
+    // Uncomment the following TRAP to force ConnMon to read CommsDat every
+    // time a client asks for IAP availability (KIapAvailability-attribute).
+    //
+    /*TRAPD( err, iCommsDatCache->RefreshCommsDatCacheL( 0 ) );*/
+    return iCommsDatCache->GetAvailableIaps( aBearerId, aIapInfo );
+    }
+
+// -----------------------------------------------------------------------------
+// Get available SANP IDs
+// -----------------------------------------------------------------------------
+//
+void CConnMonServer::GetAvailableSnaps( TConnMonSNAPInfo& aSnapInfo )
+    {
+    // See comment in CConnMonServer::GetAvailableIaps() (above)
+    /*TRAPD( err, iCommsDatCache->RefreshCommsDatCacheL( 0 ) );*/
+    iCommsDatCache->GetAvailableSnaps( aSnapInfo );
+    }
+
+// -----------------------------------------------------------------------------
+// Get available SANP IDs
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonServer::GetAvailableSnaps( RArray<TConnMonId>& aSnapIds )
+    {
+    // See comment in CConnMonServer::GetAvailableIaps() (above)
+    /*TRAPD( err, iCommsDatCache->RefreshCommsDatCacheL( 0 ) );*/
+    return iCommsDatCache->GetAvailableSnaps( aSnapIds );
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonServer::CustomSecurityCheckL
+// Implements custom security checking for IPCs marked with
+// TSpecialCase::ECustomCheck.
+// -----------------------------------------------------------------------------
+//
+CPolicyServer::TCustomResult CConnMonServer::CustomSecurityCheckL(
+        const RMessage2& aMsg,
+        TInt& /*aAction*/,
+        TSecurityInfo& /*aMissing*/ )
+    {
+    switch ( aMsg.Function() )
+        {
+        case EReqSetBoolAttribute:
+            {
+            switch ( aMsg.Int2() )
+                {
+                case KConnectionStop:
+                case KConnectionStopAll:
+                    {
+                    // NetworkServices + NetworkControl
+                    return ( KConnMonPolicyElements[4].iPolicy.CheckPolicy( aMsg ) ) ?
+                        EPass : EFail;
+                    }
+                default:
+                    return EPass;
+                }
+            }
+        default:
+            return EPass;
+        }
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CConnMonDelayedShutdown::CConnMonDelayedShutdown
+// -----------------------------------------------------------------------------
+//
+CConnMonDelayedShutdown::CConnMonDelayedShutdown( CConnMonServer* aServer )
+        :
+        CActive( EConnMonPriorityNormal ),
+        iServer( aServer )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonDelayedShutdown::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CConnMonDelayedShutdown::ConstructL()
+    {
+    CActiveScheduler::Add( this );
+    User::LeaveIfError( iTimer.CreateLocal() );
+    }
+
+// Destructor
+CConnMonDelayedShutdown::~CConnMonDelayedShutdown()
+    {
+    Cancel();
+    iTimer.Close();
+    iServer = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonDelayedShutdown::Start
+// -----------------------------------------------------------------------------
+//
+void CConnMonDelayedShutdown::Start()
+    {
+    if ( IsActive() )
+        {
+        return;
+        }
+
+    iTimer.After( iStatus, KConnMonShutdownInterval );
+    SetActive();
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonDelayedShutdown::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CConnMonDelayedShutdown::DoCancel()
+    {
+    iTimer.Cancel();
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonDelayedShutdown::RunL
+// -----------------------------------------------------------------------------
+//
+void CConnMonDelayedShutdown::RunL()
+    {
+    LOGIT("Server: Shutting down by timer")
+    CActiveScheduler::Stop();
+    }
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/src/ConnMonSess.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,2657 @@
+/*
+* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Connection Monitor session.
+*
+*/
+
+#include <featmgr.h>
+#include <etelmm.h>
+#include <rconnmon.h>
+
+#include "ConnMonSess.h"
+#include "ConnMonServ.h"
+#include "ConnMonIAP.h"
+#include "ConnMonDef.h"
+#include "CEventQueue.h"
+#include "CIapSupport.h"
+#include "CUiDialogAO.h"
+#include "ConnMonUtils.h"
+#include "ConnMonAvailabilityManager.h"
+#include "ConnMonBearerGroupManager.h"
+#include "connmonwlannetwork.h"
+#include "CPlugin.h"
+#include "log.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// TConnSettings::TConnSettings
+// -----------------------------------------------------------------------------
+//
+TConnSettings::TConnSettings(
+        TUint aActivityTimeThreshold,
+        TUint aDLDataThreshold,
+        TUint aULDataThreshold )
+        :
+        iActivityTimeThreshold( aActivityTimeThreshold ),
+        iDLDataThreshold( aDLDataThreshold ),
+        iULDataThreshold( aULDataThreshold )
+    {
+    }
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// TConnRequest::TConnRequest
+// -----------------------------------------------------------------------------
+//
+TConnRequest::TConnRequest( TUint8 aType, const RMessage2 aMessage )
+        :
+        iType( aType ),
+        iMessage( aMessage )
+    {
+    }
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// TConnParams::TConnParams
+// -----------------------------------------------------------------------------
+//
+TConnParams::TConnParams( TUint aConnectionId )
+        :
+        iConnectionId( aConnectionId ),
+        iSettings( 0, 0, 0 )
+    {
+    iRequests.Reset();
+    }
+
+
+// -----------------------------------------------------------------------------
+// TConnParams::MatchId
+// Finds TConnParams item matching by connection Id.
+// -----------------------------------------------------------------------------
+//
+TBool TConnParams::MatchId( const TConnParams& aFirst, const TConnParams& aSecond )
+    {
+    if ( aFirst.iConnectionId == aSecond.iConnectionId )
+        {
+        return ETrue;
+        }
+    return EFalse;
+    }
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CConnMonSession::CConnMonSession
+// -----------------------------------------------------------------------------
+//
+CConnMonSession::CConnMonSession( CConnMonServer* aServer )
+        :
+        CSession2(),
+        iCmServer( aServer )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CConnMonSession::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CConnMonSession::ConstructL()
+    {
+    //LOGENTRFN("CConnMonSession::ConstructL()")
+
+    iListening = EFalse;
+    iEnumConnInfo = new( ELeave ) CArrayFixFlat<TUint>( 1 );
+    iEnumConnInfo->Reset();
+
+    // Initialize last event time
+    iLastEventTime = iCmServer->EventQueue()->LastEventTime();
+
+    // Create a new object index (it stores the plug-in objects owned by this session)
+    iPlugins = CObjectIx::NewL();
+
+    // Initialize the object container using the object container index in the server
+    // (Object container provides unique ids for the objects owned by this session)
+    iContainer = iCmServer->NewContainerL();
+
+    //LOGEXITFN("CConnMonSession::ConstructL()")
+    }
+
+
+// -----------------------------------------------------------------------------
+// CConnMonSession::~CConnMonSession
+// -----------------------------------------------------------------------------
+//
+CConnMonSession::~CConnMonSession()
+    {
+    LOGIT(".")
+    LOGENTRFN("CConnMonSession::~CConnMonSession()")
+
+    if ( iListening && ( iBearerAvailabilityThreshold == 1 ) )
+        {
+        // Resets plugin threshold, so plugin can stop sending bearer
+        // availability events when no longer needed.
+        SetPluginThreshold( EBearerAvailabilityThreshold, 0 );
+        }
+
+    // Cancel any 'receive' request
+    CancelReceiveEvent();
+
+    for ( TInt i = 0; i < iConnParams.Count(); i++ )
+        {
+        iConnParams[i].iRequests.Close();
+        }
+
+    iConnParams.Close();
+
+    if ( iEnumConnInfo != 0 )
+        {
+        iEnumConnInfo->Reset();
+        delete iEnumConnInfo;
+        iEnumConnInfo = NULL;
+        }
+
+    // Delete the object index
+    delete iPlugins;
+    iPlugins = NULL;
+
+    // Delete the object container
+    if ( iContainer != 0 )
+        {
+        iCmServer->RemoveContainer( iContainer );
+        iContainer = NULL;
+        }
+
+    // Check WLAN support
+    if ( iCmServer->Iap()->WlanSupport() )
+        {
+        // Delete WLAN session from WlanSessions array if exists
+        iCmServer->Iap()->WlanSupport()->DeleteWlanSession( this );
+        }
+
+    // Decrement session count, so server may terminate if no longer needed
+    iCmServer->DecrementSessions();
+
+    iCmServer = NULL;
+    iReceiveBuffer = NULL;
+
+    LOGEXITFN("CConnMonSession::~CConnMonSession()")
+    }
+
+
+// -----------------------------------------------------------------------------
+// CConnMonSession::ServiceL
+// -----------------------------------------------------------------------------
+//
+void CConnMonSession::ServiceL( const RMessage2& aMessage )
+    {
+    //LOGENTRFN("CConnMonSession::ServiceL()")
+    TInt rc( KErrNone );
+
+    #ifdef _DEBUG
+    if ( aMessage.Function() != EReqReceiveEvent )
+        {
+        LOGIT(".")
+        LOGIT2("ServiceL: function %d, id %X", aMessage.Function(), aMessage.SecureId().iId)
+        }
+    #endif // _DEBUG
+
+    iMessage2 = aMessage;
+    switch ( aMessage.Function() )
+        {
+        case EReqGetConnectionCount:
+            rc = GetConnectionCountL();
+            CompleteMessage( rc );
+            break;
+
+        case EReqGetConnectionInfo:
+            rc = GetConnectionInfo();
+            CompleteMessage( rc );
+            break;
+
+        case EReqGetSubConnectionInfo:
+            rc = GetSubConnectionInfo();
+            CompleteMessage( rc );
+            break;
+
+        case EReqGetIntAttribute:
+            rc = GetIntAttributeL();
+            CompleteMessage( rc );
+            break;
+
+        case EReqGetUintAttribute:
+            rc = GetUintAttributeL();
+            CompleteMessage( rc );
+            break;
+
+        case EReqGetBoolAttribute:
+            rc = GetBoolAttributeL();
+            CompleteMessage( rc );
+            break;
+
+        case EReqGetStringAttribute:
+            rc = GetStringAttributeL();
+            CompleteMessage( rc );
+            break;
+
+        case EReqGetPckgAttribute:
+            rc = GetPckgAttributeL();
+            CompleteMessage( rc );
+            break;
+
+        case EReqSetIntAttribute:
+            rc = SetIntAttributeL();
+            CompleteMessage( rc );
+            break;
+
+        case EReqSetUintAttribute:
+            rc = SetUintAttributeL();
+            CompleteMessage( rc );
+            break;
+
+        case EReqSetBoolAttribute:
+            rc = SetBoolAttribute();
+            CompleteMessage( rc );
+            break;
+
+        case EReqSetStringAttribute:
+            rc = SetStringAttributeL();
+            CompleteMessage( rc );
+            break;
+
+        case EReqSetPckgAttribute:
+            rc = SetPckgAttribute();
+            CompleteMessage( rc );
+            break;
+
+        case EReqCancelAsyncRequest:
+            rc = CancelAsyncRequest();
+            CompleteMessage( rc );
+            break;
+
+        case EReqReceiveEvent: // TAny& aBuffer - async
+            ReceiveEventL( aMessage.Ptr0() );
+            break;
+
+        case EReqCancelReceiveEvent:
+            CancelReceiveEvent();
+            CompleteMessage( 0 );
+            break;
+
+        // Plug-in specific, fall-through intended
+        case EReqPluginCreateSubSession:
+        case EReqPluginCloseSubSession:
+        case EReqPluginRegisterAttribute:
+        case EReqPluginCancelRegisterAttribute:
+        case EReqPluginEvent:
+        case EReqPluginGetQuery:
+        case EReqPluginCancelGetQuery:
+        case EReqPluginAttribute:
+            ServicePluginL( aMessage );
+            break;
+
+        default:
+            iCmServer->PanicClient( EBadRequest );
+            break;
+        }
+    //LOGEXITFN("CConnMonSession::ServiceL()")
+    }
+
+
+// -----------------------------------------------------------------------------
+// CConnMonSession::CompleteMessage
+// -----------------------------------------------------------------------------
+//
+void CConnMonSession::CompleteMessage( const TInt aStatus )
+    {
+    // Check if async message
+    if ( aStatus != KRequestPending )
+        {
+        // Complete message
+        Message().Complete( aStatus );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CConnMonSession::GetConnectionCountL
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonSession::GetConnectionCountL()
+    {
+    LOGENTRFN("CConnMonSession::GetConnectionCountL()")
+    TInt err( KErrNone );
+    TUint count( 0 );
+
+    // Call comms APIs
+    err = iCmServer->Iap()->EnumerateConnectionsL( count, *iEnumConnInfo );
+    LOGIT2("SERVER: EReqGetConnectionCount OUT: -> count %d, ret <%d>", count, err)
+
+    if ( KErrNone == err )
+        {
+        // Write "count" back to the client's address space
+        TPtrC8 d( reinterpret_cast<TUint8*>( &count ), sizeof( count ) );
+
+        err = Message().Write( 0, d );
+        if ( err != KErrNone )
+            {
+            LOGIT1("SERVER: EReqGetConnectionCount: -> error, Message().Write(0, d) returned <%d>", err)
+            iCmServer->PanicClient( EBadDescriptor );
+            }
+
+        LOGIT("SERVER: EReqGetConnectionCount. -> RemoveObsoleteConnectionParams()")
+        // Remove obsolete connection settings
+        RemoveObsoleteConnectionParams();
+        }
+
+    LOGEXITFN1("CConnMonSession::GetConnectionCountL()", err)
+    return err;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CConnMonSession::GetConnectionInfo
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonSession::GetConnectionInfo()
+    {
+    LOGENTRFN("CConnMonSession::GetConnectionInfo()")
+    TInt err( KErrNone );
+    TUint id( 0 );
+    TUint subConnectionCount( 1 );
+
+    TInt index = Message().Int0();
+
+    if ( !iEnumConnInfo )
+        {
+        err = KErrUnknown;
+        }
+    // Indexes given to client start from 1
+    else if ( ( index <= 0 ) || ( index > iEnumConnInfo->Count() ) )
+        {
+        err = KErrArgument;
+        }
+    else
+        {
+        // Enumerated connection IDs are stored in session
+        id = (*iEnumConnInfo)[index - 1];
+
+        // Get subconnection count
+        err = iCmServer->Iap()->GetConnectionInfo( id, subConnectionCount );
+        LOGIT4("SERVER: EReqGetConnectionInfo: index %d -> id %d, subConnCount %d, ret <%d>",
+                index, id, subConnectionCount, err)
+
+        if ( KErrNone == err )
+            {
+            // Write "id" back to the client's address space
+            TPtrC8 d( reinterpret_cast<TUint8*>( &id ), sizeof( id ) );
+
+            err = Message().Write( 1, d );
+            if ( KErrNone != err )
+                {
+                iCmServer->PanicClient( EBadDescriptor );
+                }
+            else
+                {
+                // Write "subConnectionCount" back to the client's address space
+                TPtrC8 e(
+                        reinterpret_cast<TUint8*>( &subConnectionCount ),
+                        sizeof( subConnectionCount ) );
+
+                err = Message().Write( 2, e );
+                if ( KErrNone != err )
+                    {
+                    iCmServer->PanicClient( EBadDescriptor );
+                    }
+                }
+            }
+        }
+    LOGEXITFN1("CConnMonSession::GetConnectionInfo()", err)
+    return err;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CConnMonSession::GetSubConnectionInfo
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonSession::GetSubConnectionInfo() const
+    {
+    LOGENTRFN("CConnMonSession::GetSubConnectionInfo()")
+    LOGEXITFN1("CConnMonSession::GetSubConnectionInfo()", KErrNotSupported)
+    return KErrNotSupported;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CConnMonSession::GetIntAttributeL
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonSession::GetIntAttributeL()
+    {
+    LOGENTRFN("CConnMonSession::GetIntAttributeL()")
+    TInt err( KErrNone );
+    TInt value( 0 );
+
+    // Call comms APIs
+    err = iCmServer->Iap()->GetIntAttributeL( Message(), value );
+    LOGIT1("SERVER: CConnMonSession::GetIntAttributeL: Iap()->GetIntAttributeL <%d>", err)
+
+    // Check if this request should be served by a plug-in engine
+    if ( ( Message().Int0() >= EBearerIdGPRS ) &&
+            ( err != KErrNone ) &&
+            ( err != KRequestPending ) )
+        {
+        RMessage2 msg = Message();
+        err = iCmServer->SendRequestToPlugin( EReqGetIntAttribute, msg );
+        }
+
+    LOGIT5("SERVER: EReqGetIntAttribute. id %d, subConnId %d, attr %d -> value %d, ret <%d>",
+            Message().Int0(), Message().Int1(), Message().Int2(), value, err)
+    if ( KErrNone == err )
+        {
+        // Write "value" back to the client's address space
+        TPtrC8 d( reinterpret_cast<TUint8*>( &value ), sizeof( value ) );
+
+        err = Message().Write( KAttributeParameterIndex, d );
+        if ( KErrNone != err )
+            {
+            iCmServer->PanicClient( EBadDescriptor );
+            }
+        }
+
+    LOGEXITFN1("CConnMonSession::GetIntAttributeL()", err)
+    return err;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CConnMonSession::GetUintAttributeL
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonSession::GetUintAttributeL()
+    {
+    LOGENTRFN("CConnMonSession::GetUintAttributeL()")
+    TInt err( KErrNone );
+    TUint value( 0 );
+
+    TUint connectionId( Message().Int0() );
+    TInt attribute( Message().Int2() );
+
+    switch ( attribute )
+        {
+        case KDownlinkDataThreshold:
+        case KUplinkDataThreshold:
+        case KActivityTimeThreshold:
+            {
+            if ( iCmServer->Iap()->ConnectionExists( connectionId ) )
+                {
+                TConnSettings settings( 0, 0, 0 );
+                err = GetConnectionSettings( connectionId, settings );
+                if ( KErrNone == err )
+                    {
+                    if ( attribute == KDownlinkDataThreshold )
+                        {
+                        value = settings.iDLDataThreshold;
+                        }
+                    else if ( attribute == KUplinkDataThreshold )
+                        {
+                        value = settings.iULDataThreshold;
+                        }
+                    else
+                        {
+                        value = settings.iActivityTimeThreshold;
+                        }
+                    }
+                }
+            else
+                {
+                err = KErrNotFound;
+                }
+            }
+            break;
+
+        case KBearerAvailabilityThreshold:
+            value = iBearerAvailabilityThreshold;
+            break;
+        case KSignalStrengthThreshold:
+            value = iSignalStrengthThreshold;
+            break;
+        case KBearerGroupThreshold:
+            value = iBearerGroupThreshold;
+            break;
+
+        case KMobilePhoneNetworkMode:
+            {
+            LOGIT("GetUintAttributeL: case KMobilePhoneNetworkMode")
+
+            // Check network registration first
+            TInt registrationMode( ENetworkRegistrationNotAvailable );
+            err = iCmServer->Iap()->GetNetworkRegistrationMode( registrationMode );
+            if ( KErrNone == err )
+                {
+                if ( registrationMode == ENetworkRegistrationUnknown ||
+                        registrationMode == ENetworkRegistrationNoService )
+                    {
+                    value = EConnMonNetworkModeUnknown;
+                    }
+                else
+                    {
+                    RMobilePhone::TMobilePhoneNetworkMode networkMode;
+                    err = iCmServer->Iap()->MobilePhone()->GetCurrentMode( networkMode );
+                    if ( KErrNone == err )
+                        {
+                        LOGIT1("GetUintAttributeL: current phone network mode %d", networkMode)
+
+                        TConnMonMobilePhoneNetworkMode connMonNetworkMode;
+                        err = ConnMonUtils::MobilePhoneNetworkModeToConnMonMobilePhoneNetworkMode(
+                                networkMode,
+                                connMonNetworkMode );
+                        if ( KErrNone == err )
+                            {
+                            value = connMonNetworkMode;
+                            }
+                        }
+                    }
+                }
+            }
+            break;
+
+        case KWlanScanMaxDelay:
+            // Check WLAN support for the given ID
+            err = iCmServer->Iap()->WlanSupportCheck( connectionId );
+            if ( KErrNone == err )
+                {
+                err = iCmServer->Iap()->WlanSupport()->GetUintAttributeL( Message(), value );
+                }
+            break;
+
+        default:
+            {
+            LOGIT1("GetUintAttributeL: case %d", attribute)
+
+            // Call comms APIs
+            err = iCmServer->Iap()->GetUintAttributeL( Message(), value );
+
+            // Check if message will be completed later
+            if ( KRequestPending == err )
+                {
+                if ( KDownlinkData == attribute )
+                    {
+                    TConnRequest request( KDownlinkData, Message() );
+                    SetConnectionRequest( connectionId, request );
+                    }
+                else if ( KUplinkData == attribute )
+                    {
+                    TConnRequest request( KUplinkData, Message() );
+                    SetConnectionRequest( connectionId, request );
+                    }
+                }
+
+            // Check if this request should be served by a plug-in engine
+            if ( ( Message().Int0() >= EBearerIdGPRS ) &&
+                    ( err != KErrNone ) &&
+                    ( err != KRequestPending ) )
+                {
+                RMessage2 msg = Message();
+                err = iCmServer->SendRequestToPlugin( EReqGetUintAttribute, msg );
+                }
+            }
+            break;
+        }
+    LOGIT5("SERVER: EReqGetUintAttribute: id %d, subConnId %d, attr %d -> value %d, ret <%d>",
+            Message().Int0(), Message().Int1(), Message().Int2(), value, err )
+
+    if ( KErrNone == err )
+        {
+        // Write "value" back to the client's address space
+        TPtrC8 d( reinterpret_cast<TUint8*>( &value ), sizeof( value ) );
+
+        err = Message().Write( KAttributeParameterIndex, d );
+        if ( err != KErrNone )
+            {
+            iCmServer->PanicClient( EBadDescriptor );
+            }
+        }
+
+    LOGEXITFN1("CConnMonSession::GetUintAttributeL()", err)
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonSession::GetBoolAttributeL
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonSession::GetBoolAttributeL()
+    {
+    LOGENTRFN("CConnMonSession::GetBoolAttributeL()")
+    TInt err( KErrNone );
+    TBool value( EFalse );
+    TUint connectionId( Message().Int0() );
+    TUint attribute( Message().Int2() );
+
+    LOGIT2("SERVER: EReqGetBoolAttribute IN: id %d, attr %d", connectionId, attribute)
+    // Call comms APIs
+    err = iCmServer->Iap()->GetBoolAttributeL( Message(), value );
+
+    // Check if request was KConnectionActive and should be completed later
+    if ( ( err == KRequestPending ) && ( attribute == KConnectionActive ) )
+        {
+        TConnRequest request( KConnectionActive, Message() );
+        SetConnectionRequest( connectionId, request );
+        }
+
+    // Check if this request should be served by a plug-in engine
+    if ( ( ( connectionId >= EBearerIdGPRS ) &&
+           ( err != KErrNone ) &&
+           ( err != KRequestPending ) )
+         ||
+         ( ( attribute == KBearerAvailability ) &&
+           ( err == KErrCancel ) ) )
+        {
+        RMessage2 msg = Message();
+        err = iCmServer->SendRequestToPlugin( EReqGetBoolAttribute, msg );
+        }
+    LOGIT5("SERVER: EReqGetBoolAttribute OUT: id %d, subConnId %d, attr %d -> value %d, ret <%d>",
+            connectionId, Message().Int1(), attribute, value, err)
+
+    // Return if error or the request is pending and will be completed later.
+    if ( KErrNone == err )
+        {
+        // Write "value" back to the client's address space
+        TPtrC8 d( reinterpret_cast<TUint8*>( &value ), sizeof( value ) );
+
+        err = Message().Write( KAttributeParameterIndex, d );
+        if ( KErrNone != err )
+            {
+            iCmServer->PanicClient( EBadDescriptor );
+            }
+        }
+
+    LOGEXITFN1("CConnMonSession::GetBoolAttributeL()", err)
+    return err;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CConnMonSession::GetStringAttributeL
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonSession::GetStringAttributeL()
+    {
+    LOGENTRFN("CConnMonSession::GetStringAttributeL()")
+    TInt err( KErrNone );
+    TUint connectionId( Message().Int0() );
+    TUint attribute( Message().Int2() );
+    LOGIT2("SERVER: EReqGetStringAttribute IN: id %d, attribute %d", connectionId, attribute)
+
+    HBufC16* value = HBufC16::NewL( KConnMonMaxStringAttributeLength );
+    CleanupStack::PushL( value );
+
+    TPtr16 auxPtr( const_cast<TUint16*>( value->Des().Ptr() ), KConnMonMaxStringAttributeLength );
+    auxPtr.FillZ(); // Fill descriptor with zeros
+
+    // Check attribute
+    switch ( attribute )
+        {
+        case KWlanSsid:
+            // Check WLAN support
+            err = iCmServer->Iap()->WlanSupportCheck( connectionId );
+            if ( KErrNone == err )
+                {
+                // Get string attribute from WLAN session, max SSID length is 32
+                err = iCmServer->Iap()->WlanSupport()->GetStringAttributeL( Message(), auxPtr );
+                }
+            break;
+
+        default:
+            // Call comms APIs
+            err = iCmServer->Iap()->GetStringAttribute( Message(), auxPtr );
+
+            // Check if this request should be served by a plug-in engine
+            if ( ( connectionId >= EBearerIdGPRS ) &&
+                    ( KErrNone != err ) &&
+                    ( KRequestPending != err ) )
+                {
+                RMessage2 msg = Message();
+                err = iCmServer->SendRequestToPlugin( EReqGetStringAttribute, msg );
+                }
+            break;
+        }
+    // Length of 'value' should be max 63 chars.
+    LOGIT5("SERVER: EReqGetStringAttribute OUT: id %d, subConnId %d, attr %d -> value >%s<, ret <%d>",
+            connectionId, Message().Int1(), attribute, auxPtr.PtrZ(), err)
+
+    CleanupStack::Pop( value );
+
+    if ( KErrNone == err )
+        {
+        // Write "value" back to the client's address space
+        err = Message().Write( KAttributeParameterIndex, auxPtr );
+        if ( err != KErrNone )
+            {
+            iCmServer->PanicClient( EBadDescriptor );
+            }
+        }
+    delete value;
+
+    LOGEXITFN1("CConnMonSession::GetStringAttributeL()", err)
+    return err;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CConnMonSession::GetPckgAttributeL
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonSession::GetPckgAttributeL()
+    {
+    LOGENTRFN("CConnMonSession::GetPckgAttributeL()")
+    TInt err( KErrNone );
+
+    TUint connectionId( Message().Int0() );
+    TUint attribute( Message().Int2() );
+
+    switch ( attribute )
+        {
+        case KStartTime:
+            {
+            LOGIT("GetPckgAttributeL: attr == KStartTime")
+            TTime time;
+
+            // Call comms APIs
+            err = iCmServer->Iap()->GetStartTime( connectionId, time );
+            LOGIT2("GetPckgAttributeL: id %d, ret <%d>", connectionId, err)
+            if ( KErrNone != err )
+                {
+                return err;
+                }
+
+            // Write "value" back to the client's address space
+            TPckgBuf<TTime> timePckg( time );
+            err = Message().Write( KAttributeParameterIndex, timePckg );
+            if ( KErrNone != err )
+                {
+                iCmServer->PanicClient( EBadDescriptor );
+                return KErrBadDescriptor;
+                }
+
+#ifdef _DEBUG
+            TBuf<KConnMonMaxStringAttributeLength> buf;
+            _LIT( KFormatStartTime, "%/0%1%/1%2%/2%3%/3 %-B%:0%J%:1%T%:2%S%:3%+B" );
+            time.FormatL( buf, KFormatStartTime );
+            LOGIT1("GetPckgAttributeL: universal start time >%s<", buf.PtrZ())
+#endif // _DEBUG
+
+            break;
+            }
+
+        case KClientInfo:
+            {
+            LOGIT("GetPckgAttributeL: attr == KClientInfo")
+            // Client uids
+            TConnMonClientEnum clientEnum;
+
+            clientEnum.iCount = 0;
+            for ( TUint i = 0; i < KConnMonMaxClientUids; i++ )
+                {
+                clientEnum.iUid[i].iUid = 0;
+                }
+
+            // Call comms APIs
+            err = iCmServer->Iap()->GetUids( connectionId, clientEnum );
+            LOGIT2("GetPckgAttributeL: clients %d, ret <%d>", clientEnum.iCount, err)
+            if ( KErrNone != err )
+                {
+                return err;
+                }
+
+            // Write "value" back to the client's address space
+            TPckgBuf<TConnMonClientEnum> clientEnumPckg( clientEnum );
+            err = Message().Write( KAttributeParameterIndex, clientEnumPckg );
+            if ( KErrNone != err )
+                {
+                iCmServer->PanicClient( EBadDescriptor );
+                return KErrBadDescriptor;
+                }
+            break;
+            }
+
+        case KNetworkNames:
+            {
+            LOGIT("GetPckgAttributeL: attr == KNetworkNames")
+
+            // Check if WLAN attribute and WLAN is supported
+            err = iCmServer->Iap()->WlanSupportCheck( connectionId );
+            if ( KErrNone == err )
+                {
+                // This attribute generates WLAN scanning via WLAN engine.
+                // Async GetScanResults method is called and message will be completed
+                // later in session specific WlanSession class object
+                err = iCmServer->Iap()->WlanSupport()->GetNetworkNamesL( Message() );
+                }
+            return err;
+            }
+
+        case KWLANNetworks:
+            {
+            LOGIT("GetPckgAttributeL: attr == KWLANNetworks")
+
+            // Check buffer max length
+            TInt maxSize( Message().GetDesMaxLength( KAttributeParameterIndex ) );
+            if ( KErrBadDescriptor == maxSize )
+                {
+                LOGIT("GetPckgAttributeL: error, bad descriptor argument")
+                iCmServer->PanicClient( EBadDescriptor );
+                return KErrBadDescriptor;
+                }
+
+            // Buffer's max length needs to be at least 2 beacause
+            // minimum information to be returned is the count of all
+            // networks and the count of returned networks.
+            if ( maxSize < 2 )
+                {
+                LOGIT1("GetPckgAttributeL: buffer too small %d", maxSize)
+                return KErrArgument;
+                }
+
+            // Get WLAN networks
+            RConnMonWLANNetworksArray wlanNetworks;
+            CleanupClosePushL( wlanNetworks );
+            iCmServer->Iap()->WlanSupport()->GetWLANNetworksL( wlanNetworks );
+
+            ConnMonWLANNetworksArrayPckg arr( wlanNetworks, maxSize );
+            CleanupStack::PopAndDestroy( &wlanNetworks );
+
+            if ( !arr.Buf() )
+                {
+                return KErrNoMemory;
+                }
+
+            // Write result back to the client
+            TInt res = Message().Write( KAttributeParameterIndex, ( *arr.Buf() ) );
+            if ( KErrNone != res )
+                {
+                iCmServer->PanicClient( EBadDescriptor );
+                return KErrBadDescriptor;
+                }
+
+            break;
+            }
+
+        case KWlanNetworks:
+            {
+            LOGIT("GetPckgAttributeL: attr == KWlanNetworks")
+
+            // Check if WLAN attribute and WLAN is supported
+            err = iCmServer->Iap()->WlanSupportCheck( connectionId );
+            if ( KErrNone != err )
+                {
+                return err;
+                }
+
+            // Check buffer max length
+            TInt maxSize( Message().GetDesMaxLength( KAttributeParameterIndex ) );
+            if ( KErrBadDescriptor == maxSize )
+                {
+                LOGIT("GetPckgAttributeL: error, bad descriptor argument")
+                iCmServer->PanicClient( EBadDescriptor );
+                return KErrBadDescriptor;
+                }
+
+            // Buffer's max length needs to be at least 2 because
+            // minimum information to be returned is the count of all
+            // networks and the count of returned networks.
+            if ( maxSize < 2 )
+                {
+                LOGIT1("GetPckgAttributeL: buffer too small %d", maxSize)
+                return KErrArgument;
+                }
+
+            // This attribute generates WLAN scanning via WLAN engine.
+            // Async GetScanResults method is called and message will be completed
+            // later in session specific WlanSession class object
+            err = iCmServer->Iap()->WlanSupport()->GetWlanNetworksL( Message() );
+            return err;
+            }
+
+        case KWlanSsidNetworks:
+            {
+            LOGIT("GetPckgAttributeL: attr == KWlanSsidNetworks")
+
+            // Check if WLAN attribute and WLAN is supported
+            err = iCmServer->Iap()->WlanSupportCheck( connectionId );
+            if ( KErrNone != err )
+                {
+                return err;
+                }
+
+            // Check buffer max length
+            TInt maxSize( Message().GetDesMaxLength( KAttributeParameterIndex ) );
+            if ( KErrBadDescriptor == maxSize )
+                {
+                LOGIT("GetPckgAttributeL: error, bad descriptor argument")
+                iCmServer->PanicClient( EBadDescriptor );
+                return KErrBadDescriptor;
+                }
+
+            // Buffer's max length needs to be at least 2 because
+            // minimum information to be returned is the count of all
+            // networks and the count of returned networks.
+            if ( maxSize < 2 )
+                {
+                LOGIT1("GetPckgAttributeL: buffer too small %d", maxSize)
+                return KErrArgument;
+                }
+
+            // This attribute generates WLAN scanning via WLAN engine.
+            // Async GetScanResults method is called and message will be completed
+            // later in session specific WlanSession class object
+            err = iCmServer->Iap()->WlanSupport()->GetWlanSsidNetworksL( Message() );
+            return err;
+            }
+
+        case KWlanCurrentNetwork:
+            {
+            LOGIT("GetPckgAttributeL: attr == KCurrentWlanNetwork")
+
+            // Check if WLAN attribute and WLAN is supported
+            err = iCmServer->Iap()->WlanSupportCheck( connectionId );
+            if ( err != KErrNone )
+                {
+                return err;
+                }
+
+            // Check buffer max length
+            TInt maxSize( Message().GetDesMaxLength( KAttributeParameterIndex ) );
+            if ( KErrBadDescriptor == maxSize )
+                {
+                LOGIT("GetPckgAttributeL: error, bad descriptor argument")
+                iCmServer->PanicClient( EBadDescriptor );
+                return KErrBadDescriptor;
+                }
+
+            // Buffer's max length needs to be at least 2 because
+            // minimum information to be returned is the count of all
+            // networks and the count of returned networks.
+            if ( maxSize < 2 )
+                {
+                LOGIT1("GetPckgAttributeL: buffer too small %d", maxSize)
+                return KErrArgument;
+                }
+
+            RConnMonWlanNetworksPtrArray wlanNetwork;
+            ConnMonCleanupResetAndDestroyPushL( wlanNetwork );
+
+            err = iCmServer->Iap()->WlanSupport()->GetCurrentWlanNetworkL( wlanNetwork );
+            if ( err != KErrNone )
+                {
+                CleanupStack::PopAndDestroy( &wlanNetwork );
+                return err;
+                }
+
+            CConnMonWlanNetworksPtrArrayPckg arr( wlanNetwork, maxSize );
+            CleanupStack::PopAndDestroy( &wlanNetwork );
+
+            if ( !arr.Buf() )
+                {
+                return KErrNoMemory;
+                }
+
+            // Write "value" back to the client's address space
+            err = Message().Write( KAttributeParameterIndex, ( *arr.Buf() ) );
+            if ( err != KErrNone )
+                {
+                // Panic client
+                iCmServer->PanicClient( EBadDescriptor );
+                }
+            return err;
+            }
+
+        case KWlanProbeRawBuffers:
+            {
+            LOGIT("GetPckgAttributeL: attr == KWlanProbeRawBuffers")
+
+            // Check if WLAN attribute and WLAN is supported
+            err = iCmServer->Iap()->WlanSupportCheck( connectionId );
+            if ( KErrNone != err )
+                {
+                return err;
+                }
+
+            // Check buffer max length
+            TInt maxSize( Message().GetDesMaxLength( KAttributeParameterIndex ) );
+            if ( KErrBadDescriptor == maxSize )
+                {
+                LOGIT("GetPckgAttributeL: error, bad descriptor argument")
+                iCmServer->PanicClient( EBadDescriptor );
+                return KErrBadDescriptor;
+                }
+
+            // Buffer's max length needs to be at least 2 because
+            // minimum information to be returned is the count of all
+            // networks and the count of returned networks.
+            if ( maxSize < 2 )
+                {
+                LOGIT1("GetPckgAttributeL: buffer too small %d", maxSize)
+                return KErrArgument;
+                }
+
+            // This attribute generates WLAN scanning via WLAN engine.
+            // Async GetScanResults method is called and message will be completed
+            // later in session specific WlanSession class object
+            err = iCmServer->Iap()->WlanSupport()->GetWlanProbeRawBuffersL( Message() );
+            return err;
+            }
+
+        case KIapAvailability:
+            {
+            LOGIT1("GetPckgAttributeL: KIapAvailability, id %d", connectionId)
+            TConnMonIapInfo iaps;
+
+            // Connection ID attribute validity check
+            if ( ( connectionId != 0 ) &&
+                    ( ( connectionId < EBearerIdGPRS ) ||
+                    ( connectionId > EBearerIdVirtualVPN ) ) )
+                {
+                err = KErrArgument;
+                }
+            else if ( ( connectionId == EBearerIdGSM ) ||
+                    ( connectionId == EBearerIdCDMA2000 ) )
+                {
+                err = KErrArgument;
+                }
+
+            if ( !err )
+                {
+                // Enable WLAN scan only if asking for all, WLAN or virtual IAPs
+                if ( ( connectionId == EBearerIdAll ) ||
+                        ( connectionId == EBearerIdWLAN ) ||
+                        ( connectionId == EBearerIdVirtualVPN ) )
+                    {
+                    iCmServer->Iap()->EnableWlanScan();
+                    }
+
+                // If WLAN background scan is ON and request is asking for all-
+                // or virtual iaps, ConnMon will send availability changed
+                // event if availability change is detected.
+                err = iCmServer->GetAvailableIaps( connectionId, iaps );
+                }
+
+            LOGIT2("SERVER: GetPckgAttributeL: -> IAP count %d, err <%d>", iaps.iCount, err)
+            if ( err )
+                {
+                return err;
+                }
+
+            // Write result back to client
+            TConnMonIapInfoBuf iapBuf( iaps );
+            err = Message().Write( KAttributeParameterIndex, iapBuf );
+            if ( err )
+                {
+                iCmServer->PanicClient( EBadDescriptor );
+                return KErrBadDescriptor;
+                }
+            }
+            break;
+
+        case KSNAPsAvailability:
+            {
+            LOGIT("GetPckgAttributeL: KSNAPsAvailability")
+            TConnMonSNAPInfo snaps;
+
+            iCmServer->Iap()->EnableWlanScan();
+
+            // If WLAN background scan is ON, ConnMon will send availability
+            // changed event if availability change is detected.
+            iCmServer->GetAvailableSnaps( snaps );
+
+            // Write result back to the client
+            TConnMonSNAPInfoBuf snapBuf( snaps );
+
+            err = Message().Write( KAttributeParameterIndex, snapBuf );
+            if ( err )
+                {
+                iCmServer->PanicClient( EBadDescriptor );
+                return KErrBadDescriptor;
+                }
+            }
+            break;
+
+        case KAvailableSNAPsIds:
+            {
+            LOGIT("GetPckgAttributeL: KAvailableSNAPsIds")
+
+            TInt maxSize( Message().GetDesMaxLength( KAttributeParameterIndex ) ); // Max buffer length
+            if (  KErrBadDescriptor == maxSize )
+                {
+                LOGIT("SERVER: EReqGetPckgAttribute -> KAvailableSNAPsIds: bad descriptor")
+                iCmServer->PanicClient( EBadDescriptor );
+                return KErrBadDescriptor;
+                }
+            // Buffer's max length needs to be at least 2 beacause minimum
+            // information to be returned is the count of all networks and
+            // the count of returned networks.
+            if ( maxSize < 2 )
+                {
+                LOGIT("SERVER: EReqGetPckgAttribute -> KAvailableSNAPsIds: descriptor too small")
+                return KErrArgument;
+                }
+
+            iCmServer->Iap()->EnableWlanScan();
+
+            // If WLAN background scan is ON, ConnMon will send availability
+            // changed event if availability change is detected.
+            RArray<TConnMonId> availableSnapIds;
+            err = iCmServer->GetAvailableSnaps( availableSnapIds );
+            if ( err )
+                {
+                availableSnapIds.Close();
+                return err;
+                }
+
+            ConnMonIdsArrayPckg arr( availableSnapIds, maxSize );
+            availableSnapIds.Close();
+            if ( !arr.Buf() )
+                {
+                return KErrNoMemory;
+                }
+
+            err = Message().Write( KAttributeParameterIndex, (*arr.Buf()) );
+            if ( err )
+                {
+                iCmServer->PanicClient( EBadDescriptor );
+                return KErrBadDescriptor;
+                }
+            }
+            break;
+
+        case KBearerGroupInfo:
+            {
+            LOGIT("GetPckgAttributeL: KBearerGroupInfo")
+
+            TBearerInfo bearerInfo;
+            TInt err = iCmServer->Iap()->GetBearerInfo( connectionId, bearerInfo );
+            if ( KErrNone != err )
+                {
+                return err;
+                }
+            LOGIT1("CConnMonSession::GetPckgAttributeL, bearer %d", bearerInfo.iBearer)
+
+            TUint bearerMask( 0 );
+            TUint bearerMask2( 0 );
+
+            err = iCmServer->BearerGroupManager()->GetBearerGroups(
+                    (TConnMonBearerInfo)bearerInfo.iBearer,
+                    bearerMask,
+                    bearerMask2 );
+            if ( KErrNone != err )
+                {
+                return err;
+                }
+            LOGIT2("CConnMonSession::GetPckgAttributeL, bearerMask %d, bearerMask2 %d", bearerMask, bearerMask2)
+
+            TConnMonBearerGroupInfo groupInfo;
+            groupInfo.iInternal = bearerInfo.iInternal;
+            groupInfo.iBearerGroups = bearerMask;
+            groupInfo.iBearerGroups2 = bearerMask2;
+
+            TConnMonBearerGroupInfoBuf groupInfoBuf( groupInfo );
+            err = Message().Write( KAttributeParameterIndex, groupInfoBuf );
+            if ( KErrNone != err )
+                {
+                LOGIT1("GetPckgAttributeL: error writing result to client <%d>", err)
+                iCmServer->PanicClient( EBadDescriptor );
+                return KErrBadDescriptor;
+                }
+
+            break;
+            }
+
+        default:
+            {
+            LOGIT("GetPckgAttributeL: UNKNOWN attribute")
+            return KErrNotSupported;
+            }
+        }
+
+    LOGEXITFN("CConnMonSession::GetPckgAttributeL()")
+    return KErrNone;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CConnMonSession::SetIntAttribute
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonSession::SetIntAttributeL()
+    {
+    LOGENTRFN("CConnMonSession::SetIntAttributeL()")
+    TInt err( KErrNone );
+
+    TUint connectionId( Message().Int0() );
+    TUint attribute( Message().Int2() );
+    TUint value( Message().Int3() );
+
+    if ( KWlanScanCacheLifetime == attribute )
+        {
+        // Check WLAN support for the given id
+        err = iCmServer->Iap()->WlanSupportCheck( connectionId );
+        if ( KErrNone == err )
+            {
+            err = iCmServer->Iap()->WlanSupport()->SetIntAttributeL( Message(), value );
+            }
+        }
+    else if ( connectionId >= EBearerIdGPRS )
+        {
+        RMessage2 msg = Message();
+        err = iCmServer->SendRequestToPlugin( EReqSetIntAttribute, msg );
+        }
+    else
+        {
+        err = KErrNotSupported;
+        }
+
+    LOGEXITFN1("CConnMonSession::SetIntAttributeL()", err)
+    return err;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CConnMonSession::SetUintAttribute
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonSession::SetUintAttributeL()
+    {
+    LOGENTRFN("CConnMonSession::SetUintAttributeL()")
+    TInt err( KErrNone );
+
+    TUint connectionId( Message().Int0() );
+    TUint attribute( Message().Int2() );
+    TUint value( Message().Int3() );
+
+    switch ( attribute )
+        {
+        case KDownlinkDataThreshold:
+        case KUplinkDataThreshold:
+        case KActivityTimeThreshold:
+            {
+            if ( connectionId > KMaxConnectionId )
+                {
+                err = KErrArgument;
+                }
+            else if ( !iCmServer->Iap()->ConnectionExists( connectionId ) )
+                {
+                err = KErrNotFound;
+                }
+            else
+                {
+                err = AdjustThresholdToAllowedRange( connectionId, attribute, value );
+                if ( KErrNone == err )
+                    {
+                    TConnSettings settings( 0, 0, 0 );
+                    GetConnectionSettings( connectionId, settings );
+                    if ( attribute == KDownlinkDataThreshold )
+                        {
+                        settings.iDLDataThreshold = value;
+                        }
+                    else if ( attribute == KUplinkDataThreshold )
+                        {
+                        settings.iULDataThreshold = value;
+                        }
+                    else // KActivityTimeThreshold
+                        {
+                        settings.iActivityTimeThreshold = value;
+                        }
+                    err = SetConnectionSettings( connectionId, settings );
+                    }
+                }
+            }
+            break;
+
+        case KBearerAvailabilityThreshold:
+            err = SetPluginThreshold( EBearerAvailabilityThreshold, value );
+            if ( err != KErrNone )
+                {
+                // Set anyway
+                iBearerAvailabilityThreshold = value;
+                err = KErrNone;
+                }
+            if ( iListening && ( iBearerAvailabilityThreshold > 0 ) )
+                {
+                iCmServer->Iap()->WakeUpNotifications();
+                }
+            break;
+
+        case KSignalStrengthThreshold:
+            iSignalStrengthThreshold = value;
+            if ( iListening && ( iSignalStrengthThreshold > 0 ) )
+                {
+                iCmServer->Iap()->WakeUpNotifications();
+                }
+            err = KErrNone;
+            break;
+
+        case KBearerGroupThreshold:
+            iBearerGroupThreshold = value;
+            LOGIT1("SetUintAttributeL: bearer group threshold set %d", iBearerGroupThreshold)
+            break;
+
+        case KWlanScanMaxDelay:
+            // Check WLAN support for the given id
+            err = iCmServer->Iap()->WlanSupportCheck( connectionId );
+            if ( KErrNone == err )
+                {
+                err = iCmServer->Iap()->WlanSupport()->SetUintAttributeL( Message(), value );
+                }
+            break;
+
+        default:
+            LOGIT1("SERVER: CConnMonSession::SetUintAttributeL() default case %d", attribute)
+            // Call comms APIs
+            err = iCmServer->Iap()->SetUintAttribute( Message(), value );
+
+            if ( ( Message().Int0() >= EBearerIdGPRS ) && ( err != KErrNone ) )
+                {
+                RMessage2 msg = Message();
+                err = iCmServer->SendRequestToPlugin( EReqSetUintAttribute, msg );
+                }
+            break;
+        }
+
+    LOGEXITFN1("CConnMonSession::SetUintAttributeL()", err)
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonSession::SetBoolAttributeL
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonSession::SetBoolAttribute()
+    {
+    LOGENTRFN("CConnMonSession::SetBoolAttribute()")
+    TInt err( KErrNotSupported );
+    TUint attribute( Message().Int2() );
+    LOGIT3("SERVER: EReqSetBoolAttribute IN: id %d, attr %d, value %d",
+            Message().Int0(), attribute, Message().Int3())
+
+    if ( ( attribute == KConnectionStop ) || ( attribute == KConnectionStopAll ) )
+        {
+        err = iCmServer->Iap()->SetBoolAttribute( Message() );
+        }
+    else if ( Message().Int0() >= EBearerIdGPRS )
+        {
+        RMessage2 msg = Message();
+        err = iCmServer->SendRequestToPlugin( EReqSetBoolAttribute, msg );
+        }
+
+    LOGEXITFN1("CConnMonSession::SetBoolAttribute()", err)
+    return err;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CConnMonSession::SetStringAttribute
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonSession::SetStringAttributeL()
+    {
+    LOGENTRFN("CConnMonSession::SetStringAttributeL()")
+    TInt err( KErrNone );
+    TUint connectionId( Message().Int0() );
+    TUint attribute( Message().Int2() );
+    LOGIT2("SERVER: EReqSetStringAttribute: id %d, attr %d", connectionId, attribute)
+
+    // Check attribute
+    switch ( attribute )
+        {
+        case KWlanSsid:
+            {
+            // Check WLAN support
+            err = iCmServer->Iap()->WlanSupportCheck( connectionId );
+            if ( KErrNone == err )
+                {
+                // Get descriptor argument length
+                TInt size = Message().GetDesLength( KAttributeParameterIndex );
+                if ( size < 0 )
+                    {
+                    LOGIT("SetStringAttributeL: error with descriptor argument")
+                    err = size; // KErrArgument or KErrBadDescriptor
+                    }
+                else if ( size > CConnMonWlanNetwork::KMaxNameLength )
+                    {
+                    LOGIT1("SetStringAttributeL: string too long %d", size)
+                    err = KErrTooBig;
+                    }
+                else
+                    {
+                    // Read descriptor argument from message
+                    TBuf<CConnMonWlanNetwork::KMaxNameLength> value;
+                    Message().Read( KAttributeParameterIndex, value );
+
+                    #ifdef _DEBUG
+                    // One letter longer than string, since we are adding a '\0' when printing
+                    TBuf<CConnMonWlanNetwork::KMaxNameLength + 1> debugName( value );
+                    LOGIT2("SetStringAttributeL: string >%s<, length %d", debugName.PtrZ(), value.Length())
+                    #endif // _DEBUG
+
+                    // Set string
+                    err = iCmServer->Iap()->WlanSupport()->SetStringAttributeL( Message(), value );
+                    }
+                }
+            }
+            break;
+
+        default:
+            err = KErrNotSupported;
+            break;
+        }
+
+    LOGEXITFN1("CConnMonSession::SetStringAttributeL()", err)
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonSession::SetPckgAttribute
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonSession::SetPckgAttribute() const
+    {
+    return KErrNotSupported;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonSession::CancelAsyncRequest
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonSession::CancelAsyncRequest()
+    {
+    LOGENTRFN("CConnMonSession::CancelAsyncRequest()")
+
+    // Defined in TConnMonAsyncRequest
+    TInt requestToCancel = Message().Int0();
+    LOGIT1("SERVER: EReqCancelAsyncRequest, req %d", requestToCancel)
+
+    if ( ( EConnMonGetPckgAttribute == requestToCancel ) ||
+         ( EConnMonGetBoolAttribute == requestToCancel ) ||
+         ( EConnMonGetIntAttribute == requestToCancel ) )
+        {
+        // Check WLAN support
+        if ( iCmServer->Iap()->WlanSupport() )
+            {
+            // Cancel possible wlan requests
+            iCmServer->Iap()->WlanSupport()->CancelAsyncRequest( Message() );
+            }
+        }
+
+    if ( EConnMonGetUintAttribute == requestToCancel )
+        {
+        // Complete all pending data volume requests with status 'KErrCancel'
+        for ( TInt i = 0; i < iConnParams.Count(); i++ )
+            {
+            CompleteDataVolumeRequests( iConnParams[i].iConnectionId, 0, 0, KErrCancel );
+            }
+        }
+    else if ( EConnMonGetBoolAttribute == requestToCancel )
+        {
+        // Complete all pending activity requests with status 'KErrCancel'
+        for ( TInt i = 0; i < iConnParams.Count(); i++ )
+            {
+            CompleteActivityRequests( iConnParams[i].iConnectionId, EFalse, KErrCancel );
+            }
+        }
+
+    // Complete all pending plugin requests (of type Message().Int0()) with 'KErrCancel'
+    RThread clientThread;
+
+    TInt err = Message().Client( clientThread );
+    if ( KErrNone == err )
+        {
+        iCmServer->CancelAttributeRequestsFromPlugins( clientThread, Message().Int0() );
+        clientThread.Close();
+        }
+
+    LOGEXITFN1("CConnMonSession::CancelAsyncRequest()", err)
+    return err;
+
+    // It is not possible to cancel other async requests at the moment because they
+    // are completed right away in the server side. Note. the client's request for a new
+    // event (EReqReceiveEvent) is cancelled by calling CancelNotifications()
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonSession::ReceiveEventL
+// -----------------------------------------------------------------------------
+//
+void CConnMonSession::ReceiveEventL( const TAny* aBuffer )
+    {
+    __ASSERT_DEBUG( !iReceiveActive, PanicServer( EReceiveAlreadyActive ) );
+
+    //LOGIT("SERVER: EReqReceiveEvent")
+
+    if ( !iListening )
+        {
+        // Set status first
+        iListening = ETrue;
+
+        // Start event notifiers if not already there
+        iCmServer->Iap()->ListenL();
+
+        // Want events from now on...
+        iLastEventTime = iCmServer->EventQueue()->LastEventTime();
+
+        // Set the threshold to the plugin (to start the plugin events)
+        if ( iBearerAvailabilityThreshold == 1 )
+            {
+            iBearerAvailabilityThreshold = 0; // To cause a change 0 -> 1
+            SetPluginThreshold( EBearerAvailabilityThreshold, 1 );
+            }
+        }
+
+    // Remember the 'receive request'
+    iReceiveMessage = Message();
+    iReceiveBuffer  = aBuffer;
+    iReceiveActive  = ETrue;
+
+    // Check for immediate fulfilment
+    iCmServer->EventQueue()->CheckEvents( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonSession::CancelReceiveEvent
+// -----------------------------------------------------------------------------
+//
+void CConnMonSession::CancelReceiveEvent()
+    {
+    if ( iReceiveActive )
+        {
+        LOGIT("SERVER: EReqCancelReceiveEvent")
+        iReceiveMessage.Complete( KErrCancel );
+        iReceiveActive = EFalse;
+        }
+
+    // Stop event watchers (if this is the last session wanting events)
+    if ( iListening )
+        {
+        // Reset plugin's threshold relating to availability events
+        // (to stop the plugin events when not needed)
+        if ( iBearerAvailabilityThreshold == 1 )
+            {
+            SetPluginThreshold( EBearerAvailabilityThreshold, 0 );
+            iBearerAvailabilityThreshold = 1; // Restore
+            }
+
+        // Stop listening
+        iCmServer->Iap()->CancelListen();
+        iListening = EFalse;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonSession::IsListening
+// -----------------------------------------------------------------------------
+//
+TBool CConnMonSession::IsListening() const
+    {
+    return iListening;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonSession::CanReceiveEvent
+// -----------------------------------------------------------------------------
+//
+TBool CConnMonSession::CanReceiveEvent() const
+    {
+    return iReceiveActive;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonSession::SendEventToClient
+// -----------------------------------------------------------------------------
+//
+TBool CConnMonSession::SendEventToClient( const TEvent& aEvent )
+    {
+    if ( aEvent.iTime > iLastEventTime )
+        {
+        // Client wants only new events
+        iLastEventTime = aEvent.iTime;
+
+        switch ( aEvent.iInfo.iEventType )
+            {
+            case EConnMonDownlinkDataThreshold:
+            case EConnMonUplinkDataThreshold:
+                {
+                TUint threshold( 0 );
+                TUint smallestThreshold( 0 );
+                CalculateAdjustedThreshold( aEvent.iInfo, threshold, smallestThreshold );
+
+                if ( ( threshold > 0 ) && ( smallestThreshold > 0 ) )
+                    {
+                    TUint rounded = smallestThreshold * ( aEvent.iInfo.iData / smallestThreshold );
+                    if ( ( aEvent.iInfo.iData % smallestThreshold ) > ( smallestThreshold / 2 ) )
+                        {
+                        rounded += smallestThreshold;
+                        }
+                    if ( rounded % threshold != 0 )
+                        {
+                        return EFalse;
+                        }
+                    }
+                else
+                    {
+                    return EFalse;
+                    }
+                }
+                break;
+
+            case EConnMonConnectionActivityChange:
+                {
+                TConnSettings settings( 0, 0, 0 );
+                GetConnectionSettings( aEvent.iInfo.iConnectionId, settings );
+                if ( settings.iActivityTimeThreshold == 0 )
+                    {
+                    return EFalse;
+                    }
+                }
+                break;
+
+            case EConnMonBearerAvailabilityChange:
+                {
+                if ( iBearerAvailabilityThreshold == 0 )
+                    {
+                    return EFalse;
+                    }
+                }
+                break;
+
+            case EConnMonSignalStrengthChange:
+                {
+                if ( iSignalStrengthThreshold == 0 )
+                    {
+                    return EFalse;
+                    }
+                }
+                break;
+
+            case EConnMonBearerInfoChange:
+            case EConnMonBearerChange:
+                {
+                // Send only either EConnMonBearerChange or EConnMonBearerInfoChange event
+
+                if ( iBearerGroupThreshold == 0 &&
+                        aEvent.iInfo.iEventType == EConnMonBearerInfoChange )
+                    {
+                    return EFalse;
+                    }
+                else if ( iBearerGroupThreshold > 0 &&
+                        aEvent.iInfo.iEventType == EConnMonBearerChange )
+                    {
+                    return EFalse;
+                    }
+                }
+                break;
+
+            case EConnMonBearerGroupChange:
+                {
+                if ( iBearerGroupThreshold == 0 )
+                    {
+                    return EFalse;
+                    }
+                }
+                break;
+
+            case EConnMonIapAvailabilityChange:
+            case EConnMonSNAPsAvailabilityChange:
+                {
+                if ( aEvent.iExtra.iPtr )
+                    {
+                    TPtrC8 tempDes( aEvent.iExtra.iPtr, aEvent.iExtra.iSize );
+                    TConnMonExtraBuf notiBuf( tempDes );
+                    TInt err = iReceiveMessage.Write( 1, notiBuf );
+                    if ( err != KErrNone )
+                        {
+                        iCmServer->PanicClient( EBadDescriptor );
+                        iReceiveActive = EFalse;
+                        return ETrue;
+                        }
+                    }
+                }
+                break;
+
+            default:
+                break;
+            }
+
+        // Send the event info to the client
+        TPtr8 n( (TUint8*) &( aEvent.iInfo ), sizeof( TEventInfo ), sizeof( TEventInfo ) );
+
+        TInt res = iReceiveMessage.Write( 0, n );
+        if ( res != KErrNone )
+            {
+            iCmServer->PanicClient( EBadDescriptor );
+            }
+        else
+            {
+            // Complete the message
+            iReceiveMessage.Complete( KErrNone );
+            }
+
+        iReceiveActive = EFalse;
+        return ETrue;
+        }
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonSession::CompleteDataVolumeRequests
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonSession::CompleteDataVolumeRequests(
+        const TUint& aConnectionId,
+        const TUint& aDlVolume,
+        const TUint& aUlVolume,
+        const TInt&  aStatus )
+    {
+    TInt index( 0 );
+
+    // Find requests for the current connection
+    for ( index = 0; index < iConnParams.Count(); index++ )
+        {
+        if ( iConnParams[index].iConnectionId == aConnectionId )
+            {
+            break;
+            }
+        }
+
+    if ( index == iConnParams.Count() )
+        {
+        return KErrArgument;
+        }
+
+    // Send values to the the client
+    // Loop to find any pending data volume requests on this connection
+    for ( TInt i = 0; i < iConnParams[index].iRequests.Count(); i++ )
+        {
+        TConnRequest* req = &( iConnParams[index].iRequests[i] );
+        TInt err( KErrNone );
+
+        if ( req->iType == KDownlinkData || req->iType == KUplinkData )
+            {
+            if ( ( aStatus == KErrNone ) || ( aStatus == KErrCancel ) )
+                {
+                if ( req->iType == KDownlinkData )
+                    {
+                    TPtr8 n( (TUint8*) &aDlVolume, sizeof( TUint ), sizeof( TUint ) );
+
+                    err = req->iMessage.Write( KAttributeParameterIndex, n );
+                    }
+                else
+                    {
+                    TPtr8 m( (TUint8*) &aUlVolume, sizeof( TUint ), sizeof( TUint ) );
+
+                    err = req->iMessage.Write( KAttributeParameterIndex, m );
+                    }
+
+                if ( err != KErrNone )
+                    {
+                    iCmServer->PanicClient( req->iMessage, EBadDescriptor );
+                    }
+                }
+
+            // Complete the request
+            req->iMessage.Complete( aStatus );
+
+            // Remove the completed request from the array
+            iConnParams[index].iRequests.Remove( i );
+            i--;
+            }
+        }
+
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonSession::CompleteActivityRequests
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonSession::CompleteActivityRequests(
+        const TUint& aConnectionId,
+        const TBool& aActivity,
+        const TInt&  aStatus )
+    {
+    TInt index( 0 );
+
+    // Find requests for the current connection
+    for ( index = 0; index < iConnParams.Count(); index++ )
+        {
+        if ( iConnParams[index].iConnectionId == aConnectionId )
+            {
+            break;
+            }
+        }
+
+    if ( index == iConnParams.Count() )
+        {
+        return KErrArgument;
+        }
+
+    // Send values to the the client
+    // Loop to find any pending activity requests on this connection
+    for ( TInt i = 0; i < iConnParams[index].iRequests.Count(); i++ )
+        {
+        TConnRequest* req = &( iConnParams[index].iRequests[i] );
+        TInt err( KErrNone );
+
+        if ( req->iType == KConnectionActive )
+            {
+            if ( aStatus == KErrNone )
+                {
+                TPtr8 n( (TUint8*) &aActivity, sizeof( TBool ), sizeof( TBool ) );
+
+                err = req->iMessage.Write( KAttributeParameterIndex, n );
+                if ( err != KErrNone )
+                    {
+                    iCmServer->PanicClient( req->iMessage, EBadDescriptor );
+                    }
+                }
+
+            // Complete the request
+            req->iMessage.Complete( aStatus );
+
+            // Remove the completed request from the array
+            iConnParams[index].iRequests.Remove( i );
+            i--;
+            }
+        }
+
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonSession::SetConnectionSettings
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonSession::SetConnectionSettings(
+        const TUint aConnId,
+        const TConnSettings& aSettings )
+    {
+    if ( aConnId <= KMaxConnectionId )
+        {
+        if ( !IsConnectionValid( aConnId ) )
+            {
+            RemoveConnectionParams( aConnId );
+            return KErrNotFound;
+            }
+        }
+    else
+        {
+        return KErrArgument;
+        }
+
+    TConnParams connParams( aConnId );
+    TInt index = iConnParams.Find( connParams, TConnParams::MatchId );
+
+    if ( KErrNotFound == index )
+        {
+        connParams.iSettings = aSettings;
+        iConnParams.Append( connParams );
+        }
+    else
+        {
+        iConnParams[index].iSettings = aSettings;
+        }
+
+    if ( iListening )
+        {
+        iCmServer->Iap()->WakeUpNotifications( aConnId );
+        }
+
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonSession::GetConnectionSettings
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonSession::GetConnectionSettings(
+        const TUint aConnId,
+        TConnSettings& aSettings )
+    {
+    TInt index( 0 );
+
+    for ( index = 0; index < iConnParams.Count(); index++ )
+        {
+        if ( iConnParams[index].iConnectionId == aConnId )
+            {
+            break;
+            }
+        }
+
+    if ( index < iConnParams.Count() )
+        {
+        aSettings = iConnParams[index].iSettings;
+        }
+    else
+        {
+        return KErrNotFound;
+        }
+
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonSession::SetConnectionRequest
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonSession::SetConnectionRequest(
+        const TUint aConnId,
+        const TConnRequest& aRequest )
+    {
+    if ( !IsConnectionValid( aConnId ) )
+        {
+        RemoveConnectionParams( aConnId );
+        return KErrNotFound;
+        }
+
+    TConnParams connParams( aConnId );
+    TInt index = iConnParams.Find( connParams, TConnParams::MatchId );
+
+    if ( KErrNotFound == index )
+        {
+        connParams.iRequests.Append( aRequest );
+        iConnParams.Append( connParams );
+        }
+    else
+        {
+        iConnParams[index].iRequests.Append( aRequest );
+        }
+
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonSession::RemoveConnectionParams
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonSession::RemoveConnectionParams( const TUint aConnId )
+    {
+    TInt index( 0 );
+
+    for ( index=0; index < iConnParams.Count(); index++ )
+        {
+        if ( iConnParams[index].iConnectionId == aConnId )
+            {
+            break;
+            }
+        }
+
+    if ( index == iConnParams.Count() )
+        {
+        return KErrNotFound;
+        }
+    else
+        {
+        // Complete any outstanding requests on this connection
+        CompleteDataVolumeRequests( aConnId, 0, 0, KErrDisconnected );
+        CompleteActivityRequests( aConnId, EFalse, KErrDisconnected );
+
+        // Free resources
+        iConnParams[index].iRequests.Close();
+
+        // Remove the whole entry
+        iConnParams.Remove( index );
+        }
+
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonSession::GetBearerThreshold
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonSession::GetBearerThreshold(
+        const TInt& aThresholdType,
+        TUint& aThreshold ) const
+    {
+    if ( !iListening )
+        {
+        aThreshold = 0;
+        return KErrNone;
+        }
+
+    if ( aThresholdType == EBearerAvailabilityThreshold )
+        {
+        aThreshold = iBearerAvailabilityThreshold;
+        }
+    else if ( aThresholdType == ESignalStrengthThreshold )
+        {
+        aThreshold = iSignalStrengthThreshold;
+        }
+    else
+        {
+        return KErrArgument;
+        }
+
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonSession::ServicePluginL
+// -----------------------------------------------------------------------------
+//
+void CConnMonSession::ServicePluginL( const RMessage2& aMessage )
+    {
+    TInt rc( 0 );
+
+    if ( !FeatureManager::FeatureSupported( KFeatureIdConnMonExtension ) )
+        {
+        aMessage.Complete( KErrNotSupported );
+        LOGIT("SERVER: Plugins are not supported")
+        return;
+        }
+
+    switch ( aMessage.Function() )
+        {
+        // CREATE PLUGIN
+        case EReqPluginCreateSubSession:
+            {
+            if ( aMessage.Int0() < EBearerIdGPRS )
+                {
+                aMessage.Complete( KErrArgument );
+                }
+            else
+                {
+                NewPluginL( aMessage.Int0() );
+                aMessage.Complete( KErrNone );
+                LOGIT1("SERVER: Plugin has registered, id %d", aMessage.Int0())
+                }
+
+            break;
+            }
+
+        // DELETE PLUGIN
+        case EReqPluginCloseSubSession:
+            {
+            DeletePlugin( aMessage.Int3() );
+            aMessage.Complete( KErrNone );
+
+            break;
+            }
+
+        // SERVICE PLUGIN'S REQUEST
+        default:
+            {
+            CPlugin* plugin = PluginFromHandle( aMessage.Int3() );
+
+            if ( !plugin )
+                {
+                iCmServer->PanicClient( EConnMonBadHandle );
+                break;
+                }
+
+            switch ( aMessage.Function() )
+                {
+                case EReqPluginRegisterAttribute:
+                    {
+                    TUint attribute( aMessage.Int0() );
+
+                    rc = plugin->RegisterAttribute( attribute );
+                    aMessage.Complete( rc );
+
+                    // Threshold can be set to the plugin only after completing the plugin's request
+                    if ( ( rc == KErrNone ) && ( attribute == KBearerAvailabilityThreshold ) )
+                         {
+                         plugin->GetQuery();
+                         }
+                    break;
+                    }
+                case EReqPluginCancelRegisterAttribute:
+                    {
+                    rc = plugin->CancelRegisterAttribute( aMessage.Int0() );
+                    aMessage.Complete( rc );
+                    break;
+                    }
+                case EReqPluginEvent:
+                    {
+                    TEventInfo eventInfo;
+                    TUint8* ptrData( NULL );
+                    TInt dataSize( 0 );
+
+                    rc = plugin->Event( aMessage, eventInfo, ptrData, dataSize );
+                    aMessage.Complete( rc );
+
+                    if ( rc == KErrNone )
+                        {
+                        // Send the event to the clients
+                        iCmServer->EventQueue()->Add( eventInfo, ptrData, dataSize );
+
+                        LOGIT3("SERVER: EVENT from PLUGIN-> id %d, event %d, data %d",
+                                eventInfo.iConnectionId, eventInfo.iEventType, eventInfo.iData)
+
+                        if ( ( eventInfo.iConnectionId == EBearerIdLAN ) &&
+                             ( eventInfo.iEventType == EConnMonBearerAvailabilityChange ) )
+                            {
+                            if ( eventInfo.iData == 1 )
+                                {
+                                // LAN bearer has become available
+                                // Check if there are any LAN IAPs.
+                                TFullIapInfo* iaps = NULL;
+                                iaps = new( ELeave ) TFullIapInfo;
+                                CleanupStack::PushL( iaps );
+
+                                CIapSupport* iapSupport = CIapSupport::NewL();
+                                CleanupStack::PushL( iapSupport );
+
+                                iapSupport->GetIapsFromCommDbL( EBearerIdLAN, *iaps );
+
+                                CleanupStack::PopAndDestroy( iapSupport );
+                                iapSupport = NULL;
+
+                                // Show the UI dialog only if there are LAN IAPs in the commDB.
+                                if ( iaps->iCount > 0 )
+                                    {
+                                    CUiDialogAO* dialog = NULL;
+                                    // Show a dialog on the UI and ask the user to select the
+                                    // LAN network. CUiDialog is a one shot active object. It
+                                    // will save the user's LAN network preference to ConnMonIap.
+                                    // Use TRAPD because all SDKs don't have this dialog that is OK.
+                                    TRAPD( leaveCode, dialog = CUiDialogAO::NewL( iCmServer ) );
+
+                                    if ( leaveCode == KErrNone )
+                                        {
+                                        dialog->Start();
+                                        }
+                                    }
+                                CleanupStack::PopAndDestroy( iaps );
+                                }
+                            else
+                                {
+                                // LAN bearer is not anymore available
+
+                                // Reset user's LAN network selection
+                                iCmServer->Iap()->ResetEndUserLanPreference();
+
+                                LOGIT("CConnMonSession::ServicePluginL triggered HandleAvailabilityChange()")
+
+                                ( (CConnMonServer*)Server() )->AvailabilityManager()
+                                        ->HandleAvailabilityChange();
+                                }
+                            }
+                        }
+                    break;
+                    }
+                case EReqPluginGetQuery:
+                    {
+                    rc = plugin->GetQuery( aMessage );
+
+                    // This will be completed later by the CPlugin object
+                    break;
+                    }
+                case EReqPluginCancelGetQuery:
+                    {
+                    rc = plugin->CancelGetQuery();
+                    aMessage.Complete( rc );
+                    break;
+                    }
+                case EReqPluginAttribute:
+                    {
+                    rc = plugin->Attribute( aMessage );
+                    aMessage.Complete( rc );
+                    break;
+                    }
+
+                default:
+                    break;
+                }
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonSession::PluginFromHandle
+// Will return NULL if parameter aHandle is invalid
+// -----------------------------------------------------------------------------
+//
+CPlugin* CConnMonSession::PluginFromHandle( const TUint aHandle )
+    {
+    CPlugin* plugin = reinterpret_cast<CPlugin*>( iPlugins->At( aHandle ) );
+    return plugin;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonSession::NewPluginL
+// -----------------------------------------------------------------------------
+//
+void CConnMonSession::NewPluginL( const TUint aConnectionId )
+    {
+    // Create a new plugin object
+    CPlugin* plugin = CPlugin::NewL( this, aConnectionId );
+
+    // Ensure that the reference count is decremented if we leave.
+    // When ref count becomes zero, CObject::Close() deletes the object.
+    CleanupClosePushL( *plugin );
+
+    // Add object to object container to generate unique id
+    iContainer->AddL( ( CObject* ) plugin );
+
+    // Add object to object index; this returns a unique handle
+    TInt handle = iPlugins->AddL( ( CObject* ) plugin );
+
+    // Object is now owned by this session, reference count is correct.
+    CleanupStack::Pop( plugin );
+
+    // Write the handle to the client
+    TPckg<TInt> handlePckg( handle );
+
+    TInt res = Message().Write( KAttributeParameterIndex, handlePckg );
+
+    if ( res != KErrNone )
+        {
+        // Removes from object index and destroys the object
+        iPlugins->Remove( handle );
+
+        iCmServer->PanicClient( EBadDescriptor );
+        return;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonSession::DeletePlugin
+// -----------------------------------------------------------------------------
+//
+void CConnMonSession::DeletePlugin( const TUint aHandle )
+    {
+    CPlugin* plugin = reinterpret_cast<CPlugin*>( iPlugins->At( aHandle ) );
+
+    if ( !plugin )
+        {
+        iCmServer->PanicClient( EConnMonBadHandle );
+        }
+    else
+        {
+        // Removes from object index and destroys the object
+        iPlugins->Remove( aHandle );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonSession::SendRequestToPlugin
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonSession::SendRequestToPlugin( const TInt aType, const RMessage2& aMessage )
+    {
+    //LOGENTRFN("CConnMonSession::SendRequestToPlugin()")
+    TInt ret( KErrNotSupported );
+
+    TInt count = iPlugins->ActiveCount();
+
+    for ( TInt i = 0; i < count; i++ )
+        {
+        CPlugin* plugin = reinterpret_cast<CPlugin*>( ( *iPlugins )[i] );
+
+        if ( plugin )
+            {
+            if ( aType == EReqGetIntAttribute ||
+                 aType == EReqGetUintAttribute ||
+                 aType == EReqGetBoolAttribute ||
+                 aType == EReqGetStringAttribute ||
+                 aType == EReqGetPckgAttribute )
+                {
+                ret = plugin->GetAttributeForClient( aType, aMessage );
+
+                // Asynchronous
+                if ( ret == KRequestPending )
+                    {
+                    return ret;
+                    }
+                }
+            else if ( aType == EReqSetIntAttribute ||
+                      aType == EReqSetUintAttribute ||
+                      aType == EReqSetBoolAttribute ||
+                      aType == EReqSetStringAttribute ||
+                      aType == EReqSetPckgAttribute ||
+                      aType == EReqInternalSetThreshold ||
+                      aType == EReqInternalResetThreshold )
+                {
+                ret = plugin->SetAttributeForClient( aType, aMessage );
+
+                // Synchronous
+                if ( ret == KErrNone )
+                    {
+                    return ret;
+                    }
+                }
+            else
+                {
+                return KErrNotSupported;
+                }
+            }
+        }
+
+    //LOGEXITFN("CConnMonSession::SendRequestToPlugin()")
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonSession::CancelAttributeRequestFromPlugin
+// -----------------------------------------------------------------------------
+//
+void CConnMonSession::CancelAttributeRequestFromPlugin(
+        const RThread& aClient,
+        const TInt aType )
+    {
+    TInt count = iPlugins->ActiveCount();
+
+    for ( TInt i = 0; i < count; i++ )
+        {
+        CPlugin* plugin = reinterpret_cast<CPlugin*>( ( *iPlugins )[i] );
+
+        if ( plugin )
+            {
+            plugin->CancelGetAttributeForClient( aClient, aType );
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonSession::SetPluginThreshold
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonSession::SetPluginThreshold( const TInt aType, const TUint aValue )
+    {
+    TUint globalThBefore( 0 );
+    TUint globalThAfter( 0 );
+    TUint connectionId( 0 );
+    TBool internal( EFalse );
+
+    if ( !FeatureManager::FeatureSupported( KFeatureIdConnMonExtension ) )
+        {
+        return KErrNotSupported;
+        }
+
+    if ( aType != EBearerAvailabilityThreshold && aType != ESignalStrengthThreshold )
+        {
+        return KErrNotSupported;
+        }
+
+    // At the moment a common threshold is used for all the bearers.
+    // When 'internal' is true threshold will be set in every plugin.
+    internal = ETrue;
+
+    // Get the global threshold before changing session threshold
+    iCmServer->CalculateThreshold( connectionId, aType, globalThBefore );
+
+    if ( aType == EBearerAvailabilityThreshold )
+        {
+        // Set the new threshold value
+        iBearerAvailabilityThreshold = aValue;
+        }
+    else if ( aType == ESignalStrengthThreshold )
+        {
+        // Set the new threshold value
+        iSignalStrengthThreshold = aValue;
+        }
+
+    // Get the global threshold after changing our threshold
+    iCmServer->CalculateThreshold( connectionId, aType, globalThAfter );
+
+    if ( globalThBefore != globalThAfter )
+        {
+        // Global threshold has changed -> send to plug-in engines
+        if ( internal )
+            {
+            if ( aValue == 1 )
+                {
+                iCmServer->SendRequestToPlugin( EReqInternalSetThreshold, Message(), ETrue );
+                }
+            else
+                {
+                iCmServer->SendRequestToPlugin( EReqInternalResetThreshold, Message(), ETrue );
+                }
+            }
+        else
+            {
+            iCmServer->SendRequestToPlugin( EReqSetUintAttribute, Message(), ETrue );
+            }
+        }
+
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonSession::IsConnectionValid
+// -----------------------------------------------------------------------------
+//
+TBool CConnMonSession::IsConnectionValid( const TUint aConnId )
+    {
+    LOGENTRFN("CConnMonSession::IsConnectionValid()")
+    TBool result( EFalse );
+
+    // Is connection valid anymore
+    TUint subConnectionCount( 0 );
+    TInt err = iCmServer->Iap()->GetConnectionInfo( aConnId, subConnectionCount );
+    if ( err != KErrNone )
+        {
+        result = EFalse;
+        }
+    else
+        {
+        result = ETrue;
+        }
+
+    LOGEXITFN1("CConnMonSession::IsConnectionValid()", result)
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonSession::RemoveObsoleteConnectionParams
+// -----------------------------------------------------------------------------
+//
+void CConnMonSession::RemoveObsoleteConnectionParams()
+    {
+    TInt numSettings = iConnParams.Count();
+    if ( numSettings > 0 )
+        {
+        TInt i( 0 );
+        do
+            {
+            if ( !IsConnectionValid( iConnParams[i].iConnectionId ) )
+                {
+                // Complete any outstanding requests on this connection
+                CompleteDataVolumeRequests(
+                        iConnParams[i].iConnectionId,
+                        0,
+                        0,
+                        KErrDisconnected );
+
+                CompleteActivityRequests(
+                        iConnParams[i].iConnectionId,
+                        EFalse,
+                        KErrDisconnected );
+
+                // Free resources
+                iConnParams[i].iRequests.Close();
+
+                // Remove the whole entry
+                iConnParams.Remove( i );
+                numSettings = iConnParams.Count();
+                }
+            else
+                {
+                ++i;
+                }
+
+            } while ( i < numSettings );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonSession::CalculateAdjustedThreshold
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonSession::CalculateAdjustedThreshold(
+        const TEventInfo& aEvent,
+        TUint& aAdjustedTh,
+        TUint& aSmallestTh )
+    {
+    TConnSettings settings( 0, 0, 0 );
+    TUint modulo( 0 );
+
+    aAdjustedTh = 0;
+    GetConnectionSettings( aEvent.iConnectionId, settings );
+
+    if ( aEvent.iEventType == EConnMonDownlinkDataThreshold )
+        {
+        iCmServer->CalculateThreshold(
+                aEvent.iConnectionId,
+                EDownlinkThreshold,
+                aSmallestTh );
+
+        if ( aSmallestTh > 0 )
+            {
+            modulo = settings.iDLDataThreshold % aSmallestTh;
+            }
+
+        if ( modulo == 0 )
+            {
+            aAdjustedTh = settings.iDLDataThreshold;
+            }
+        else if ( modulo < aSmallestTh / 2 )
+            {
+            aAdjustedTh = settings.iDLDataThreshold - modulo;
+            }
+        else
+            {
+            aAdjustedTh = settings.iDLDataThreshold + aSmallestTh - modulo;
+            }
+        }
+    else if ( aEvent.iEventType == EConnMonUplinkDataThreshold )
+        {
+        iCmServer->CalculateThreshold(
+                aEvent.iConnectionId,
+                EUplinkThreshold,
+                aSmallestTh );
+
+        if ( aSmallestTh > 0 )
+            {
+            modulo = settings.iULDataThreshold % aSmallestTh;
+            }
+
+        if ( modulo == 0 )
+            {
+            aAdjustedTh = settings.iULDataThreshold;
+            }
+        else if ( modulo < aSmallestTh / 2 )
+            {
+            aAdjustedTh = settings.iULDataThreshold - modulo;
+            }
+        else
+            {
+            aAdjustedTh = settings.iULDataThreshold + aSmallestTh - modulo;
+            }
+        }
+    else
+        {
+        return KErrArgument;
+        }
+
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonSession::AdjustThresholdToAllowedRange
+// -----------------------------------------------------------------------------
+//
+TInt CConnMonSession::AdjustThresholdToAllowedRange(
+        const TInt& aConnId,
+        const TInt& aThresholdType,
+        TUint& aThreshold ) const
+    {
+    LOGENTRFN("CConnMonSession::AdjustThresholdToAllowedRange()")
+    TInt err( KErrNone );
+
+    // Zero value is always allowed
+    if ( aThreshold == 0 )
+        {
+        LOGEXITFN1("CConnMonSession::AdjustThresholdToAllowedRange()", err)
+        return err;
+        }
+
+    switch ( aThresholdType )
+        {
+        case KActivityTimeThreshold:
+            // Already checked for zero earlier
+            if ( aThreshold < KMinimumActivityThreshold )
+                {
+                aThreshold = KMinimumActivityThreshold;
+                }
+            break;
+
+        // Currently same minimum threshold values for both uplink and downlink
+        case KDownlinkDataThreshold:
+        case KUplinkDataThreshold:
+            {
+            TInt bearer( EBearerUnknown );
+            TBearerInfo bearerInfo;
+            TUint minimum( KMinimumDataThreshold );
+
+            // This method gets the bearer only for an internal connection. This is OK
+            // since data volume events are not supported for external connections.
+            iCmServer->Iap()->GetBearer( aConnId, bearer, bearerInfo );
+
+            // Set minimum
+            if ( bearer == EBearerWLAN || bearer == EBearerLAN )
+                {
+                minimum = KMinimumWLANDataThreshold;
+                }
+            else if ( bearer == EBearerGPRS || bearer == EBearerEdgeGPRS )
+                {
+                minimum = KMinimumGPRSDataThreshold;
+                }
+            else if ( bearer == EBearerWCDMA )
+                {
+                minimum = KMinimumWCDMADataThreshold;
+                }
+
+            // Check threshold
+            if ( aThreshold < minimum )
+                {
+                aThreshold = minimum;
+                }
+            }
+            break;
+
+        case KBearerAvailabilityThreshold:
+        case KSignalStrengthThreshold:
+        case KBearerGroupThreshold:
+            // All alowed
+            break;
+        default:
+            LOGIT1("AdjustThresholdToAllowedRange: Illegal value for threshold type %d", aThresholdType)
+            err = KErrNotFound;
+            break;
+        }
+
+    LOGEXITFN1("CConnMonSession::AdjustThresholdToAllowedRange()", err)
+    return err;
+    }
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/src/ConnMonUtils.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,197 @@
+/*
+* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ConnMon utilities.
+*
+*/
+
+#include "ConnMonUtils.h"
+#include "log.h"
+
+// -----------------------------------------------------------------------------
+//Converts from TMobilePhoneNetworkMode to TConnMonMobilePhoneNetworkMode
+// -----------------------------------------------------------------------------
+//
+TInt ConnMonUtils::MobilePhoneNetworkModeToConnMonMobilePhoneNetworkMode(
+        RMobilePhone::TMobilePhoneNetworkMode aMode,
+        TConnMonMobilePhoneNetworkMode& aValue )
+    {
+    switch ( aMode )
+        {
+        case RMobilePhone::ENetworkModeUnknown:
+            aValue = EConnMonNetworkModeUnknown;
+            break;
+        case RMobilePhone::ENetworkModeUnregistered:
+            aValue = EConnMonNetworkModeUnregistered;
+            break;
+        case RMobilePhone::ENetworkModeGsm:
+            aValue = EConnMonNetworkModeGsm;
+            break;
+        case RMobilePhone::ENetworkModeAmps:
+            aValue = EConnMonNetworkModeAmps;
+            break;
+        case RMobilePhone::ENetworkModeCdma95:
+            aValue = EConnMonNetworkModeCdma95;
+            break;
+        case RMobilePhone::ENetworkModeCdma2000:
+            aValue = EConnMonNetworkModeCdma2000;
+            break;
+        case RMobilePhone::ENetworkModeWcdma:
+            aValue = EConnMonNetworkModeWcdma;
+            break;
+        case RMobilePhone::ENetworkModeTdcdma:
+            aValue = EConnMonNetworkModeTdcdma;
+            break;
+        default:
+            return KErrNotFound;
+        }
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// Converts from TDesC8 to build independent TDesC
+// -----------------------------------------------------------------------------
+//
+void ConnMonUtils::TDes8ToTDes( const TDes8& aBuf8, TDes& aInd )
+    {
+    #if defined(_UNICODE)
+
+    for ( TUint i = 0; i < aBuf8.Length(); ++i )
+        {
+        aInd.Append( aBuf8[i] );
+        }
+    #else
+    aInd = aBuf8;
+    #endif
+    }
+
+// -----------------------------------------------------------------------------
+// Converts from TDesC to TDesC8
+// -----------------------------------------------------------------------------
+//
+void ConnMonUtils::TDesToTDes8( const TDes& aSrc, TDes8& aDest )
+    {
+    for ( TUint i = 0; i < aSrc.Length(); ++i )
+        {
+        aDest.Append( aSrc[i] & 0x00FF );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+
+TConnMonInap::TConnMonInap()
+    {
+    }
+
+
+TConnMonVirtualIap::TConnMonVirtualIap()
+    {
+    }
+
+TBool TConnMonVirtualIap::Real() const
+    {
+    return EFalse;
+    }
+
+TBool TConnMonVirtualIap::Valid() const
+    {
+    return EFalse;
+    }
+
+
+TConnMonRealIap::TConnMonRealIap()
+    {
+    }
+
+TBool TConnMonRealIap::Real() const
+    {
+    return ETrue;
+    }
+
+TBool TConnMonRealIap::Valid() const
+    {
+    return EFalse;
+    }
+
+
+TConnMonSNAP::~TConnMonSNAP()
+    {
+    }
+
+EXPORT_C TBool TConnMonSNAP::Valid() const
+    {
+    return ETrue;
+    }
+
+TConnMonSNAP::TConnMonSNAP()
+    {
+    }
+
+TConnMonSNAP::TConnMonSNAP( TUint aId ) : iId( aId )
+    {
+    }
+
+TConnMonSNAP::TConnMonSNAP( const TConnMonSNAP& aSnap )
+    {
+    iId = aSnap.iId;
+    }
+
+
+CConnMonSNAPsAvailabilityManager* CConnMonSNAPsAvailabilityManager::NewL()
+    {
+    CConnMonSNAPsAvailabilityManager* self = new( ELeave ) CConnMonSNAPsAvailabilityManager();
+    return self;
+    }
+
+CConnMonSNAPsAvailabilityManager::~CConnMonSNAPsAvailabilityManager()
+    {
+    }
+
+CConnMonSNAPsAvailabilityManager::CConnMonSNAPsAvailabilityManager()
+    {
+    }
+
+
+CConnMonCommsDataNotifier* CConnMonCommsDataNotifier::NewL()
+    {
+    CConnMonCommsDataNotifier* self = new( ELeave ) CConnMonCommsDataNotifier();
+    return self;
+    }
+
+CConnMonCommsDataNotifier::~CConnMonCommsDataNotifier()
+    {
+    }
+
+CConnMonCommsDataNotifier::CConnMonCommsDataNotifier()
+    {
+    }
+
+
+CConnMonIapsAvailabilityManager* CConnMonIapsAvailabilityManager::NewL()
+    {
+    CConnMonIapsAvailabilityManager* self = new( ELeave ) CConnMonIapsAvailabilityManager();
+    return self;
+    }
+
+CConnMonIapsAvailabilityManager::CConnMonIapsAvailabilityManager()
+    {
+    }
+
+CConnMonIapsAvailabilityManager::~CConnMonIapsAvailabilityManager()
+    {
+    }
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/src/ConnMonWLANNetwork.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,130 @@
+/*
+* Copyright (c) 2006-2008 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 for the TConnMonWLANNetwork class.
+*
+*/
+
+#include <e32cmn.h>
+#include "log.h"
+
+const TInt KMaxWlanNetBufSize = 48;
+#include "connmonwlannetwork.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+//  Construction
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TConnMonWLANNetwork::TConnMonWLANNetwork(
+        const TBuf<KMaxNameLength>& aName,
+        TUint aConnectionMode,
+        TUint aSignalStrength,
+        TUint aSecurityMode,
+        const RArray<TInt>& aBuf )
+        :
+        iName( aName ),
+        iConnectionMode( aConnectionMode ),
+        iSignalStrength( aSignalStrength ),
+        iSecurityMode( aSecurityMode )
+    {
+    _LIT( KPanicMessage, "TConnMonWLANNetwork::TConnMonWLANNetwork:" );
+    __ASSERT_ALWAYS( aBuf.Count() == KNumberOfExtraFields,
+            User::Panic( KPanicMessage, KErrArgument ) );
+    // This doesn't do anything as long as KNumberOfExtraFields equals 0
+    // since it will panic on the assert if aBuf.Count is not 0
+    // Left here for future reference
+    /*
+    for(TUint i(0); i < aBuf.Count(); ++i)
+        {
+        iBuf.Append(aBuf[i]);
+        }
+    */
+    }
+
+// ---------------------------------------------------------------------------
+//  Destruction
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TConnMonWLANNetwork::~TConnMonWLANNetwork()
+    {
+    iBuf.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// compares two networks by iSignalStrength;
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt TConnMonWLANNetwork::LessBySignal(
+        const TConnMonWLANNetwork& aFirst,
+        const TConnMonWLANNetwork& aSecond )
+    {
+    if ( aFirst.iSignalStrength > aSecond.iSignalStrength ) return 1;
+    if ( aFirst.iSignalStrength < aSecond.iSignalStrength ) return -1;
+    return 0;
+    }
+
+// ---------------------------------------------------------------------------
+// Packages object to HBufC descriptor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const HBufC* TConnMonWLANNetwork::ToBuf() const
+    {
+    HBufC* buf = HBufC::New( KMaxWlanNetBufSize );
+    if( !buf )
+        {
+        return buf;
+        }
+
+    TPtr ptr( buf->Des() );
+
+    ptr.Append( iName.Length() );
+    ptr.Append( iName );
+    ptr.Append( iConnectionMode );
+    ptr.Append( iSignalStrength );
+    ptr.Append( iSecurityMode );
+    ptr.Append( KNumberOfExtraFields );
+
+    for( TUint i = 0; i < iBuf.Count(); ++i )
+        {
+        ptr.Append( iBuf[i] );
+        }
+
+    return buf;
+    }
+
+// ---------------------------------------------------------------------------
+// Unpackages TConnMonWLANNetwork from TPtrC descriptor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TConnMonWLANNetwork TConnMonWLANNetwork::FromPtrC( const TPtrC& aPtrC )
+    {
+
+    TUint len( (TUint)aPtrC[ENameLength] );
+    TBuf<KMaxNameLength> name( aPtrC.Mid(EName, len) );
+    TUint connectionMode( aPtrC[len+EConnectionMode] );
+    TUint signalStrength( aPtrC[len+ESignalStrength] );
+    TUint securityMode( aPtrC[len+ESecurityMode] );
+
+    RArray<TInt> buf;
+    TUint count( aPtrC[len+EBufCounter] );
+    for ( TUint i = 1; i < count+1; ++i )
+        {
+        buf.Append( aPtrC[len+EBufBase+i] );
+        }
+
+    return TConnMonWLANNetwork( name, connectionMode, signalStrength, securityMode, buf );
+    }
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/src/ConnMonWLANNetworksArrayPckg.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,167 @@
+/*
+* 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:  A package class for TConnMonWLANNetwork objects.
+*
+*/
+
+
+#include <e32std.h>
+#include "log.h"
+#include "connmonwlannetwork.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Construction
+// ---------------------------------------------------------------------------
+//
+ConnMonWLANNetworksArrayPckg::ConnMonWLANNetworksArrayPckg(
+        const RArray<TConnMonWLANNetwork>& aRef,
+        TUint aBufLen )
+    {
+    LOGENTRFN("ConnMonWLANNetworksArrayPckg::ConnMonWLANNetworksArrayPckg()")
+
+    RPointerArray<HBufC> items;
+    LOGIT1("ConnMonWLANNetworksArrayPckg::ConnMonWLANNetworksArrayPckg: buflen <%d>", aBufLen )
+    TUint len( 0 );
+    LOGIT1("ConnMonWLANNetworksArrayPckg::ConnMonWLANNetworksArrayPckg: aRef.Count() <%d>", aRef.Count() )
+
+    for ( TUint i = 0; i < aRef.Count(); ++i )
+        {
+        LOGIT1("ConnMonWLANNetworksArrayPckg::ConnMonWLANNetworksArrayPckg: i <%d>", i )
+
+        const HBufC* item( aRef[i].ToBuf() );
+        if ( item )
+            {
+            LOGIT1("ConnMonWLANNetworksArrayPckg::ConnMonWLANNetworksArrayPckg: Item->Length=<%d>", item->Length() )
+            // Is there room in buffer
+            TUint countFields( 3 ); // aRef.Count(); items->Count(); item->Length()
+            if ( ( countFields + len + item->Length() ) > aBufLen )
+                {
+                LOGIT2("ConnMonWLANNetworksArrayPckg::ConnMonWLANNetworksArrayPckg: Not enough space to add item. Current len <%d>, item size <%d>", len, item->Length() )
+                delete item;
+                item = NULL;
+                break;
+                }
+            LOGIT("ConnMonWLANNetworksArrayPckg::ConnMonWLANNetworksArrayPckg: Appending")
+            items.Append( item );
+
+            LOGIT1("ConnMonWLANNetworksArrayPckg::ConnMonWLANNetworksArrayPckg: len <%d>", len )
+            ++(len+=item->Length()); // ++ is for item's size
+            }
+        else
+            {
+            LOGIT("ConnMonWLANNetworksArrayPckg::ConnMonWLANNetworksArrayPckg: Null Item!")
+            }
+        }
+
+    // Check that given buflen (aBufLen) is not smaller than one
+    // item (TConnMonWLANNetwork) + aRef count + items count
+    // + item length
+    if ( items.Count() == 0 && aRef.Count() > 0 )
+        {
+        aBufLen = 2; // aRef.Count(), items.Count()
+        }
+
+    iBuf = HBufC::New( aBufLen ); // Set size exactly to a buffer length
+    LOG(_LIT( KPanicMessage, "ConnMonWLANNetworksArrayPckg::ConnMonWLANNetworksArrayPckg:" );)
+    __ASSERT_DEBUG( iBuf, User::Panic( KPanicMessage, KErrNoMemory ) );
+
+    if ( !iBuf )
+        {
+        items.ResetAndDestroy();
+        items.Close();
+        return;
+        }
+
+    LOGIT1("ConnMonWLANNetworksArrayPckg::ConnMonWLANNetworksArrayPckg: iBuf->Length() <%d>", iBuf->Length() )
+
+    iBuf->Des().Append( aRef.Count() ); // Total amount of data
+    iBuf->Des().Append( items.Count() );  // Amount of transferring data
+
+    LOGIT1("ConnMonWLANNetworksArrayPckg::ConnMonWLANNetworksArrayPckg: iBuf->Length() <%d>", iBuf->Length() )
+
+    for ( TUint i = 0; i < items.Count(); ++i )
+        {
+        LOGIT1("ConnMonWLANNetworksArrayPckg::ConnMonWLANNetworksArrayPckg: i <%d>", i )
+        iBuf->Des().Append( items[i]->Length() );
+        LOGIT1("ConnMonWLANNetworksArrayPckg::ConnMonWLANNetworksArrayPckg: iBuf->Length() <%d>", iBuf->Length() )
+        iBuf->Des().Append( *items[i] );
+        LOGIT1("ConnMonWLANNetworksArrayPckg::ConnMonWLANNetworksArrayPckg: iBuf->Length() <%d>", iBuf->Length() )
+        }
+
+    items.ResetAndDestroy();
+    items.Close();
+
+    LOGEXITFN("ConnMonWLANNetworksArrayPckg::ConnMonWLANNetworksArrayPckg()")
+    }
+
+// ---------------------------------------------------------------------------
+// Construction
+// ---------------------------------------------------------------------------
+//
+EXPORT_C ConnMonWLANNetworksArrayPckg::ConnMonWLANNetworksArrayPckg(
+        TUint aBufSize )
+    {
+    iBuf = HBufC::New( aBufSize );
+    LOG(_LIT( KPanicMessage, "ConnMonWLANNetworksArrayPckg::ConnMonWLANNetworksArrayPckg:" );)
+    __ASSERT_DEBUG( iBuf, User::Panic( KPanicMessage, KErrNoMemory ) );
+    }
+
+// ---------------------------------------------------------------------------
+// Destruction
+// ---------------------------------------------------------------------------
+//
+EXPORT_C ConnMonWLANNetworksArrayPckg::~ConnMonWLANNetworksArrayPckg()
+    {
+    delete iBuf;
+    iBuf = NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// Unpacking
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void ConnMonWLANNetworksArrayPckg::UnpackToL(
+        RArray<TConnMonWLANNetwork>& aRef ) const
+    {
+    if ( !iBuf )
+        {
+        User::Leave( KErrBadDescriptor );
+        }
+
+    TUint pointer( 0 );
+
+    TUint total( (*iBuf)[pointer++] ); // Total amount of data
+    TUint count( (*iBuf)[pointer++] ); // Amount of transferred data
+
+    for ( TUint i = 0; i < count; ++i )
+        {
+        TUint len( (*iBuf)[pointer++] );
+        TPtrC ptrc( iBuf->Mid( pointer, len ) );
+        User::LeaveIfError( aRef.Append( TConnMonWLANNetwork::FromPtrC( ptrc ) ) );
+        pointer += len;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Getter
+// ---------------------------------------------------------------------------
+//
+EXPORT_C HBufC* ConnMonWLANNetworksArrayPckg::Buf() const
+    {
+    return iBuf;
+    }
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/src/ConnMonWLANNetworksArrayPckg_v2.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,167 @@
+/*
+* Copyright (c) 2006-2008 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:  A package class for CConnMonWlanNetwork objects.
+*
+*/
+
+#include <e32std.h>
+#include <rconnmon.h>
+
+#include "log.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CConnMonWlanNetworksPtrArrayPckg::CConnMonWlanNetworksPtrArrayPckg(
+        const RPointerArray<CConnMonWlanNetwork>& aRef,
+        TUint aBufSize )
+    {
+    LOGENTRFN("CConnMonWlanNetworksPtrArrayPckg::CConnMonWlanNetworksPtrArrayPckg()")
+
+    const TUint KItemLengthFieldSize = 1;
+
+    // First 2 elements in buffer will contain the total number of objects and the number of transfered objects
+    TUint currentPosition( 2 );
+    TInt totalItemCount = aRef.Count();
+
+    LOGIT2("CConnMonWlanNetworksPtrArrayPckg: buffer size %d, item count %d", aBufSize, totalItemCount)
+
+    // Create a temporary pointer array table for buffer objects
+    RPointerArray<HBufC> items;
+
+    for ( TUint i = 0; i < totalItemCount; ++i )
+        {
+        const HBufC* item( aRef[i]->ToBuf() );
+        if ( item )
+            {
+            // Check if there is room in buffer for the next item
+            if ( ( currentPosition + KItemLengthFieldSize + item->Length() ) > aBufSize )
+                {
+                LOGIT4("Buffer full, current position %d, item length %d, buffer size %d, i %d",
+                        currentPosition, item->Length(), aBufSize, i)
+                delete item;
+                item = NULL;
+                break;
+                }
+            currentPosition += KItemLengthFieldSize + item->Length();
+            items.Append( item );
+            }
+        }
+
+    // Check that given buffer length (aBufSize) is not smaller than one
+    // item (CConnMonWlanNetwork) + aRef count + items count + item length
+    if ( items.Count() == 0 && totalItemCount > 0 )
+        {
+        aBufSize = 2; // aRef.Count(), items.Count()
+        }
+
+    // Allocate memory for buffer
+    iBuf = HBufC::New( aBufSize );
+    if ( !iBuf )
+        {
+        LOGIT("CConnMonWlanNetworksPtrArrayPckg: out of memory error")
+        }
+    else
+        {
+        // Add total and transferred counts to buffer
+        iBuf->Des().Append( totalItemCount ); // Total amount of objects
+        iBuf->Des().Append( items.Count() ); // Amount of objects in buffer
+
+        // Add item length and item data to buffer
+        for ( TUint i = 0; i < items.Count(); ++i )
+            {
+            iBuf->Des().Append( items[i]->Length() );
+            iBuf->Des().Append( *items[i] );
+            }
+        LOGIT1("Used buffer %d", iBuf->Length())
+        }
+    items.ResetAndDestroy();
+
+    LOGEXITFN("CConnMonWlanNetworksPtrArrayPckg::CConnMonWlanNetworksPtrArrayPckg()")
+    }
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CConnMonWlanNetworksPtrArrayPckg::CConnMonWlanNetworksPtrArrayPckg(
+        TUint aBufSize )
+    {
+    iBuf = HBufC::New( aBufSize );
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CConnMonWlanNetworksPtrArrayPckg::~CConnMonWlanNetworksPtrArrayPckg()
+    {
+    delete iBuf;
+    }
+
+// ---------------------------------------------------------------------------
+// Unpacking
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CConnMonWlanNetworksPtrArrayPckg::UnpackToL(
+        RPointerArray<CConnMonWlanNetwork>& aRef ) const
+    {
+    LOGENTRFN("CConnMonWlanNetworksPtrArrayPckg::UnpackToL()")
+
+    if ( !iBuf || iBuf->Length() < 2 )
+        {
+        User::Leave( KErrBadDescriptor );
+        }
+
+    TUint index( 0 );
+    TUint total( (*iBuf)[index++] ); // Total amount of objects
+    TUint count( (*iBuf)[index++] ); // Amount of objects in  buffer
+    LOGIT2("UnpackToL: total %d, in buffer %d", total, count)
+
+    for ( TUint i = 0; i < count; ++i )
+        {
+        TUint len( (*iBuf)[index++] );
+        TPtrC ptr( iBuf->Mid( index, len ) );
+        index += len;
+
+        CConnMonWlanNetwork* wlanNet = CConnMonWlanNetwork::NewL();
+        CleanupStack::PushL( wlanNet );
+        TInt err = CConnMonWlanNetwork::FromPtrC( ptr, wlanNet );
+        if ( err != KErrNone )
+            {
+            LOGIT2("UnpackToL: error <%d> reading data, stopping. i %d", err, i)
+            CleanupStack::Pop( wlanNet );
+            break;
+            }
+
+        User::LeaveIfError( aRef.Append( wlanNet ) );
+        CleanupStack::Pop( wlanNet );
+        }
+
+    LOGEXITFN("CConnMonWlanNetworksPtrArrayPckg::UnpackToL()")
+    }
+
+// ---------------------------------------------------------------------------
+// Getter
+// ---------------------------------------------------------------------------
+//
+EXPORT_C HBufC* CConnMonWlanNetworksPtrArrayPckg::Buf() const
+    {
+    return iBuf;
+    }
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/src/RConnMon.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,1323 @@
+/*
+* Copyright (c) 2002-2008 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 for Connection Monitor Server API methods.
+*
+*/
+
+#include <rconnmon.h>
+
+#include "ConnMonDef.h"
+#include "ConnMonCli.h"
+#include "ConnMonServ.h"
+#include "log.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// RConnectionMonitor::ConnectL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RConnectionMonitor::ConnectL()
+    {
+    //LOGENTRFN("RConnectionMonitor::ConnectL()")
+    LOGIT1("Client [%d]: calling ConnectL()", this)
+
+    if ( IsConnected() )
+        {
+        LOGIT1("Client [%d]: already connected", this)
+        return KErrNone;
+        }
+
+    // Connect to server
+    TInt errConnect( KErrNone );
+    TInt errLaunch( KErrNone );
+
+    for ( TInt tries = 0; tries < 2; tries++ )
+        {
+        // This initialization is needed if some application starts
+        // ConnMon server just between CreateSession() and
+        // LaunchFromClient() here.
+        errLaunch = KErrNone;
+
+        errConnect = CreateSession(
+                KConnectionMonitorServerName,
+                TVersion( 0, 0, 0 ),
+                KNumMessageSlots );
+        if ( errConnect )
+            {
+            if ( errConnect != KErrNotFound && errConnect != KErrServerTerminated )
+                {
+                break; // Problems other than server not here - propagate error
+                }
+
+            errLaunch = CConnMonScheduler::LaunchFromClient();
+
+            // If server launched ok (KErrNone), try again to connect
+            // If someone else got there first (KErrAlreadyExists), try again to connect
+            if ( errLaunch != KErrNone && errLaunch != KErrAlreadyExists )
+                {
+                break; // Server not launched: don't cycle round again
+                }
+            }
+        else
+            {
+            break;
+            }
+        }
+    User::LeaveIfError( errConnect );
+    User::LeaveIfError( errLaunch );
+
+    // Initialize an array for holding the non-descriptor parameters that are
+    // passed along asyncronous methods to the server. (Inter-thread reads/writes
+    // are possible only on desc data.)
+    if ( iPtrArray.Count() == 0 )
+        {
+        TPtr8 ptr( reinterpret_cast<TUint8*>( NULL ), 0 );
+
+        for ( TInt i = 0; i < KNumPtrs; i++ )
+            {
+            User::LeaveIfError( iPtrArray.Append( ptr ) );
+            }
+        }
+
+#ifdef _DEBUG
+    TName processName = RProcess().Name();
+    if ( processName.Length() < KMaxName )
+        {
+        LOGIT2("Client [%d]: process name [%s]", this, processName.PtrZ())
+        }
+#endif // _DEBUG
+
+    //LOGEXITFN("RConnectionMonitor::ConnectL()")
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// RConnectionMonitor::Close
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RConnectionMonitor::Close()
+    {
+    //LOGENTRFN("RConnectionMonitor::Close()")
+    // Destroy pointer array
+    iPtrArray.Close();
+
+    // Destroy notification handler
+    delete iHandler;
+    iHandler = NULL;
+
+    // Destroy server session
+    RSessionBase::Close();
+
+    LOGIT1("Client [%d]: closed!", this)
+    //LOGEXITFN("RConnectionMonitor::Close()")
+    }
+
+// -----------------------------------------------------------------------------
+// RConnectionMonitor::GetConnectionCount
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RConnectionMonitor::GetConnectionCount(
+        TUint& aConnectionCount,
+        TRequestStatus& aStatus )
+    {
+    LOGIT1("Client [%d]: GetConnectionCount()", this)
+
+    TPtr8& pckg = NextPtr();
+    pckg.Set(
+            reinterpret_cast<TUint8*>( &aConnectionCount ),
+            sizeof( aConnectionCount ),
+            sizeof( aConnectionCount ) );
+
+    TIpcArgs args( &pckg );
+
+    SendReceive( EReqGetConnectionCount, args, aStatus );
+    }
+
+// -----------------------------------------------------------------------------
+// RConnectionMonitor::GetConnectionInfo
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RConnectionMonitor::GetConnectionInfo(
+        const TUint aIndex,
+        TUint& aConnectionId,
+        TUint& aSubConnectionCount ) const
+    {
+    LOGIT2("Client [%d]: GetConnectionInfo(), index %d", this, aIndex)
+
+    TPtr8 n( reinterpret_cast<TUint8*>( &aConnectionId ), sizeof( aConnectionId ) );
+    TPtr8 m( reinterpret_cast<TUint8*>( &aSubConnectionCount ), sizeof( aSubConnectionCount ) );
+
+    TIpcArgs args( aIndex, &n, &m );
+
+    return( SendReceive( EReqGetConnectionInfo, args ) );
+    }
+
+// -----------------------------------------------------------------------------
+// RConnectionMonitor::GetSubConnectionInfo
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RConnectionMonitor::GetSubConnectionInfo(
+        const TUint aConnectionId,
+        const TUint aIndex,
+        TUint& aSubConnectionId ) const
+    {
+    LOGIT3("Client [%d]: GetSubConnectionInfo(), conn.id %d, index %d", this, aConnectionId, aIndex)
+
+    TPtr8 n( reinterpret_cast<TUint8*>( &aSubConnectionId ), sizeof( aSubConnectionId ) );
+
+    TIpcArgs args( aConnectionId, aIndex, &n );
+
+    return( SendReceive( EReqGetSubConnectionInfo, args ) );
+    }
+
+// -----------------------------------------------------------------------------
+// RConnectionMonitor::GetIntAttribute
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RConnectionMonitor::GetIntAttribute(
+        const TUint aConnectionId,
+        const TUint aSubConnectionId,
+        const TUint aAttribute,
+        TInt& aValue,
+        TRequestStatus& aStatus )
+    {
+    LOGIT4("Client [%d]: GetIntAttribute(), conn.id %d, sub.conn.id %d, attribute %d",
+            this, aConnectionId, aSubConnectionId, aAttribute)
+
+    TPtr8& pckg = NextPtr();
+    pckg.Set( reinterpret_cast<TUint8*>( &aValue ), sizeof( aValue ), sizeof( aValue ) );
+
+    TIpcArgs args( aConnectionId, aSubConnectionId, aAttribute, &pckg );
+
+    SendReceive( EReqGetIntAttribute, args, aStatus );
+    }
+
+// -----------------------------------------------------------------------------
+// RConnectionMonitor::GetUintAttribute
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RConnectionMonitor::GetUintAttribute(
+        const TUint aConnectionId,
+        const TUint aSubConnectionId,
+        const TUint aAttribute,
+        TUint& aValue,
+        TRequestStatus& aStatus )
+    {
+    LOGIT4("Client [%d]: GetUintAttribute(), conn.id %d, sub.conn.id %d, attribute %d",
+            this, aConnectionId, aSubConnectionId, aAttribute)
+
+    TPtr8& pckg = NextPtr();
+    pckg.Set( reinterpret_cast<TUint8*>( &aValue ), sizeof( aValue ), sizeof( aValue ) );
+
+    TIpcArgs args( aConnectionId, aSubConnectionId, aAttribute, &pckg );
+
+    SendReceive( EReqGetUintAttribute, args, aStatus );
+    }
+
+// -----------------------------------------------------------------------------
+// RConnectionMonitor::GetBoolAttribute
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RConnectionMonitor::GetBoolAttribute(
+        const TUint aConnectionId,
+        const TUint aSubConnectionId,
+        const TUint aAttribute,
+        TBool& aValue,
+        TRequestStatus& aStatus )
+    {
+    LOGIT4("Client [%d]: GetBoolAttribute(), conn.id %d, sub.conn.id %d, attribute %d",
+            this, aConnectionId, aSubConnectionId, aAttribute)
+
+    TPtr8& pckg = NextPtr();
+    pckg.Set( reinterpret_cast<TUint8*>( &aValue ), sizeof( aValue ), sizeof( aValue ) );
+
+    TIpcArgs args( aConnectionId, aSubConnectionId, aAttribute, &pckg );
+
+    SendReceive( EReqGetBoolAttribute, args, aStatus );
+    }
+
+// -----------------------------------------------------------------------------
+// RConnectionMonitor::GetStringAttribute
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RConnectionMonitor::GetStringAttribute(
+        const TUint aConnectionId,
+        const TUint aSubConnectionId,
+        const TUint aAttribute,
+        TDes& aValue,
+        TRequestStatus& aStatus ) const
+    {
+    LOGIT4("Client [%d]: GetStringAttribute(), conn.id %d, sub.conn.id %d, attribute %d",
+            this, aConnectionId, aSubConnectionId, aAttribute)
+
+    TIpcArgs args( aConnectionId, aSubConnectionId, aAttribute, &aValue );
+
+    SendReceive( EReqGetStringAttribute, args, aStatus );
+    }
+
+// -----------------------------------------------------------------------------
+// RConnectionMonitor::GetPckgAttribute
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RConnectionMonitor::GetPckgAttribute(
+        const TUint aConnectionId,
+        const TUint aSubConnectionId,
+        const TUint aAttribute,
+        TDes8& aValue,
+        TRequestStatus& aStatus ) const
+    {
+    LOGIT4("Client [%d]: 8GetPckgAttribute(), conn.id %d, sub.conn.id %d, attribute %d",
+            this, aConnectionId, aSubConnectionId, aAttribute)
+
+    TIpcArgs args( aConnectionId, aSubConnectionId, aAttribute, &aValue );
+
+    SendReceive( EReqGetPckgAttribute, args, aStatus );
+    }
+
+// -----------------------------------------------------------------------------
+// RConnectionMonitor::GetPckgAttribute
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RConnectionMonitor::GetPckgAttribute(
+        const TUint aConnectionId,
+        const TUint aSubConnectionId,
+        const TUint aAttribute,
+        TDes16& aValue,
+        TRequestStatus& aStatus ) const
+    {
+    LOGIT4("Client [%d]: 16GetPckgAttribute(), conn.id %d, sub.conn.id %d, attribute %d",
+            this, aConnectionId, aSubConnectionId, aAttribute)
+
+    TIpcArgs args( aConnectionId, aSubConnectionId, aAttribute, &aValue );
+
+    SendReceive( EReqGetPckgAttribute, args, aStatus );
+    }
+
+// -----------------------------------------------------------------------------
+// RConnectionMonitor::SetIntAttribute
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RConnectionMonitor::SetIntAttribute(
+        const TUint aConnectionId,
+        const TUint aSubConnectionId,
+        const TUint aAttribute,
+        const TInt aValue ) const
+    {
+    LOGIT5("Client [%d]: SetIntAttribute(), conn.id %d, sub.conn.id %d, attribute %d, value %d",
+            this, aConnectionId, aSubConnectionId, aAttribute, aValue)
+
+    TIpcArgs args( aConnectionId, aSubConnectionId, aAttribute, aValue );
+
+    return( SendReceive( EReqSetIntAttribute, args ) );
+    }
+
+// -----------------------------------------------------------------------------
+// RConnectionMonitor::SetUintAttribute
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RConnectionMonitor::SetUintAttribute(
+        const TUint aConnectionId,
+        const TUint aSubConnectionId,
+        const TUint aAttribute,
+        const TUint aValue ) const
+    {
+    LOGIT5("Client [%d]: SetUintAttribute(), conn.id %d, sub.conn.id %d, attribute %d, value %d",
+            this, aConnectionId, aSubConnectionId, aAttribute, aValue)
+
+    TIpcArgs args( aConnectionId, aSubConnectionId, aAttribute, aValue );
+
+    return( SendReceive( EReqSetUintAttribute, args ) );
+    }
+
+// -----------------------------------------------------------------------------
+// RConnectionMonitor::SetBoolAttribute
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RConnectionMonitor::SetBoolAttribute(
+        const TUint aConnectionId,
+        const TUint aSubConnectionId,
+        const TUint aAttribute,
+        const TBool aValue ) const
+    {
+    LOGIT5("Client [%d]: SetBoolAttribute(), conn.id %d, sub.conn.id %d, attribute %d, value %d",
+            this, aConnectionId, aSubConnectionId, aAttribute, aValue)
+
+    TIpcArgs args( aConnectionId, aSubConnectionId, aAttribute, aValue );
+
+    return( SendReceive( EReqSetBoolAttribute, args ) );
+    }
+
+// -----------------------------------------------------------------------------
+// RConnectionMonitor::SetStringAttribute
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RConnectionMonitor::SetStringAttribute(
+        const TUint aConnectionId,
+        const TUint aSubConnectionId,
+        const TUint aAttribute,
+        const TDes& aValue ) const
+    {
+    LOGIT4("Client [%d]: SetStringAttribute(), conn.id %d, sub.conn.id %d, attribute %d",
+            this, aConnectionId, aSubConnectionId, aAttribute)
+
+    TIpcArgs args( aConnectionId, aSubConnectionId, aAttribute, &aValue );
+
+    return( SendReceive( EReqSetStringAttribute, args ) );
+    }
+
+// -----------------------------------------------------------------------------
+// RConnectionMonitor::SetPckgAttribute
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RConnectionMonitor::SetPckgAttribute(
+        const TUint aConnectionId,
+        const TUint aSubConnectionId,
+        const TUint aAttribute,
+        const TDes8& aValue ) const
+    {
+    LOGIT4("Client [%d]: SetPckgAttribute(), conn.id %d, sub.conn.id %d, attribute %d",
+            this, aConnectionId, aSubConnectionId, aAttribute)
+
+    TIpcArgs args( aConnectionId, aSubConnectionId, aAttribute, &aValue );
+
+    return( SendReceive( EReqSetPckgAttribute, args ) );
+    }
+
+// -----------------------------------------------------------------------------
+// RConnectionMonitor::CancelAsyncRequest
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RConnectionMonitor::CancelAsyncRequest( TInt aReqToCancel )
+    {
+    LOGIT2("Client [%d]: CancelAsyncRequest(), request to cancel: %d", this, aReqToCancel)
+
+    TIpcArgs args( aReqToCancel );
+
+    SendReceive( EReqCancelAsyncRequest, args );
+    }
+
+// -----------------------------------------------------------------------------
+// RConnectionMonitor::NotifyEventL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RConnectionMonitor::NotifyEventL( MConnectionMonitorObserver& aObserver )
+    {
+    LOGIT1("Client [%d]: NotifyEventL()", this)
+
+    if ( iHandler == 0)
+        {
+        // Create active object to receive events and add it to scheduler
+        iHandler = new( ELeave ) CConnMonEventHandler( &aObserver, *this );
+        iHandler->Construct();
+
+        // Kick off receive handler active object to start listening and start a receive
+        iHandler->ReceiveNotification();
+        }
+    else
+        {
+        // Continue paused event handler.
+        iHandler->Continue( &aObserver );
+        }
+
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// RConnectionMonitor::CancelNotifications
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RConnectionMonitor::CancelNotifications()
+    {
+    LOGIT1("Client [%d]: CancelNotifications()", this)
+
+    if ( iHandler != 0 )
+        {
+        if ( iHandler->IsActive() )
+            {
+            // Cancel event receiver
+            iHandler->Cancel();
+
+            // Delete and remove from active scheduler
+            //iHandler->Deque;
+            delete iHandler;
+            iHandler = NULL;
+            }
+        else
+            {
+            // Client has cancelled notifications from
+            // EventL() method. -> can't delete the iHandler object.
+            // CancelReceiveEvent() needs to be called to set
+            // iListening flag of this session in the server to 'false'.
+            CancelReceiveEvent();
+            iHandler->Pause();
+            }
+        }
+    }
+
+
+// Private methods in conjunction with CConnMonEventHandler
+
+// -----------------------------------------------------------------------------
+// RConnectionMonitor::ReceiveEvent
+// -----------------------------------------------------------------------------
+//
+void RConnectionMonitor::ReceiveEvent(
+        TDes8& aBuffer,
+        TDes8& aExtraBuf,
+        TRequestStatus& aStatus )
+    {
+    //LOGIT1("Client [%d]: waiting for next event", this)
+
+    TIpcArgs args( &aBuffer, &aExtraBuf );
+
+    SendReceive( EReqReceiveEvent, args, aStatus );
+    }
+
+// -----------------------------------------------------------------------------
+// RConnectionMonitor::CancelReceiveEvent
+// -----------------------------------------------------------------------------
+//
+void RConnectionMonitor::CancelReceiveEvent()
+    {
+    LOGIT1("Client [%d]: CancelReceiveEvent()", this)
+
+    SendReceive( EReqCancelReceiveEvent, TIpcArgs( TIpcArgs::ENothing ) );
+    }
+
+// Private internal methods
+
+// -----------------------------------------------------------------------------
+// RConnectionMonitor::IsConnected
+// -----------------------------------------------------------------------------
+//
+TBool RConnectionMonitor::IsConnected() const
+    {
+    if ( iPtrArray.Count() > 0 )
+        {
+        return ETrue;
+        }
+    else
+        {
+        return EFalse;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// RConnectionMonitor::NextPtr
+// -----------------------------------------------------------------------------
+//
+TPtr8& RConnectionMonitor::NextPtr()
+    {
+    __ASSERT_ALWAYS( IsConnected(), Panic( EConnMonPanicClientNotConnected ) );
+
+    if ( iIndex >= iPtrArray.Count() )
+        {
+        iIndex = 0;
+        }
+
+    return iPtrArray[iIndex++];
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CConnMonEventBase::CConnMonEventBase
+// -----------------------------------------------------------------------------
+//
+CConnMonEventBase::CConnMonEventBase(
+        const TInt aEventType,
+        const TUint aConnectionId )
+    {
+    iEventType = aEventType;
+    iConnectionId = aConnectionId;
+    }
+
+// Destructor
+CConnMonEventBase::~CConnMonEventBase()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonEventBase::EventType
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CConnMonEventBase::EventType() const
+    {
+    return iEventType;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonEventBase::ConnectionId
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TUint CConnMonEventBase::ConnectionId() const
+    {
+    return iConnectionId;
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CConnMonCreateConnection::CConnMonCreateConnection
+// -----------------------------------------------------------------------------
+//
+CConnMonCreateConnection::CConnMonCreateConnection(
+        const TUint aConnectionId )
+        :
+        CConnMonEventBase( EConnMonCreateConnection, aConnectionId )
+    {
+    }
+
+// Destructor
+CConnMonCreateConnection::~CConnMonCreateConnection()
+    {
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CConnMonDeleteConnection::CConnMonDeleteConnection
+// -----------------------------------------------------------------------------
+//
+CConnMonDeleteConnection::CConnMonDeleteConnection(
+        const TUint aConnectionId,
+        const TUint aDownlinkData,
+        const TUint aUplinkData,
+        const TBool aAuthDelete )
+        :
+        CConnMonEventBase( EConnMonDeleteConnection, aConnectionId )
+    {
+    iDownlinkData = aDownlinkData;
+    iUplinkData = aUplinkData;
+    iAuthDelete = aAuthDelete;
+    }
+
+// Destructor
+CConnMonDeleteConnection::~CConnMonDeleteConnection()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonDeleteConnection::DownlinkData
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TUint CConnMonDeleteConnection::DownlinkData() const
+    {
+    return iDownlinkData;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonDeleteConnection::UplinkData
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TUint CConnMonDeleteConnection::UplinkData() const
+    {
+    return iUplinkData;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonDeleteConnection::AuthoritativeDelete
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool CConnMonDeleteConnection::AuthoritativeDelete() const
+    {
+    return iAuthDelete;
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CConnMonCreateSubConnection::CConnMonCreateSubConnection
+// -----------------------------------------------------------------------------
+//
+CConnMonCreateSubConnection::CConnMonCreateSubConnection(
+        const TUint aConnectionId,
+        const TUint aSubConnectionId )
+        :
+        CConnMonEventBase( EConnMonCreateSubConnection, aConnectionId )
+    {
+    iSubConnectionId = aSubConnectionId;
+    }
+
+// Destructor
+CConnMonCreateSubConnection::~CConnMonCreateSubConnection()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonCreateSubConnection::SubConnectionId
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TUint CConnMonCreateSubConnection::SubConnectionId() const
+    {
+    return iSubConnectionId;
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CConnMonDeleteSubConnection::CConnMonDeleteSubConnection
+// -----------------------------------------------------------------------------
+//
+CConnMonDeleteSubConnection::CConnMonDeleteSubConnection(
+        const TUint aConnectionId,
+        const TUint aSubConnectionId,
+        const TUint aDownlinkData,
+        const TUint aUplinkData,
+        const TBool aAuthDelete )
+        :
+        CConnMonEventBase( EConnMonDeleteSubConnection, aConnectionId )
+    {
+    iSubConnectionId = aSubConnectionId;
+    iDownlinkData = aDownlinkData;
+    iUplinkData = aUplinkData;
+    iAuthDelete = aAuthDelete;
+    }
+
+// Destructor
+CConnMonDeleteSubConnection::~CConnMonDeleteSubConnection()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonDeleteSubConnection::SubConnectionId
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TUint CConnMonDeleteSubConnection::SubConnectionId() const
+    {
+    return iSubConnectionId;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonDeleteSubConnection::DownlinkData
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TUint CConnMonDeleteSubConnection::DownlinkData() const
+    {
+    return iDownlinkData;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonDeleteSubConnection::UplinkData
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TUint CConnMonDeleteSubConnection::UplinkData() const
+    {
+    return iUplinkData;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonDeleteSubConnection::AuthoritativeDelete
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool CConnMonDeleteSubConnection::AuthoritativeDelete() const
+    {
+    return iAuthDelete;
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CConnMonDownlinkDataThreshold::CConnMonDownlinkDataThreshold
+// -----------------------------------------------------------------------------
+//
+CConnMonDownlinkDataThreshold::CConnMonDownlinkDataThreshold(
+        const TUint aConnectionId,
+        const TUint aSubConnectionId,
+        const TUint aDownlinkData )
+        :
+        CConnMonEventBase( EConnMonDownlinkDataThreshold, aConnectionId )
+    {
+    iSubConnectionId = aSubConnectionId;
+    iDownlinkData = aDownlinkData;
+    }
+
+// Destructor
+CConnMonDownlinkDataThreshold::~CConnMonDownlinkDataThreshold()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonDownlinkDataThreshold::SubConnectionId
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TUint CConnMonDownlinkDataThreshold::SubConnectionId() const
+    {
+    return iSubConnectionId;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonDownlinkDataThreshold::DownlinkData
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TUint CConnMonDownlinkDataThreshold::DownlinkData() const
+    {
+    return iDownlinkData;
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CConnMonUplinkDataThreshold::CConnMonUplinkDataThreshold
+// -----------------------------------------------------------------------------
+//
+CConnMonUplinkDataThreshold::CConnMonUplinkDataThreshold(
+        const TUint aConnectionId,
+        const TUint aSubConnectionId,
+        const TUint aUplinkData )
+        :
+        CConnMonEventBase( EConnMonUplinkDataThreshold, aConnectionId )
+    {
+    iSubConnectionId = aSubConnectionId;
+    iUplinkData = aUplinkData;
+    }
+
+// Destructor
+CConnMonUplinkDataThreshold::~CConnMonUplinkDataThreshold()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonUplinkDataThreshold::SubConnectionId
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TUint CConnMonUplinkDataThreshold::SubConnectionId() const
+    {
+    return iSubConnectionId;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonUplinkDataThreshold::UplinkData
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TUint CConnMonUplinkDataThreshold::UplinkData() const
+    {
+    return iUplinkData;
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CConnMonNetworkStatusChange::CConnMonNetworkStatusChange
+// -----------------------------------------------------------------------------
+//
+CConnMonNetworkStatusChange::CConnMonNetworkStatusChange(
+        const TUint aConnectionId,
+        const TInt  aNetworkStatus )
+        :
+        CConnMonEventBase( EConnMonNetworkStatusChange, aConnectionId )
+    {
+    iNetworkStatus = aNetworkStatus;
+    }
+
+// Destructor
+CConnMonNetworkStatusChange::~CConnMonNetworkStatusChange()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonNetworkStatusChange::NetworkStatus
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CConnMonNetworkStatusChange::NetworkStatus() const
+    {
+    return iNetworkStatus;
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CConnMonConnectionStatusChange::CConnMonConnectionStatusChange
+// -----------------------------------------------------------------------------
+//
+CConnMonConnectionStatusChange::CConnMonConnectionStatusChange(
+        const TUint aConnectionId,
+        const TUint aSubConnectionId,
+        const TInt  aConnectionStatus )
+        :
+        CConnMonEventBase( EConnMonConnectionStatusChange, aConnectionId )
+    {
+    iSubConnectionId = aSubConnectionId;
+    iConnectionStatus = aConnectionStatus;
+    }
+
+// Destructor
+CConnMonConnectionStatusChange::~CConnMonConnectionStatusChange()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonConnectionStatusChange::SubConnectionId
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TUint CConnMonConnectionStatusChange::SubConnectionId() const
+    {
+    return iSubConnectionId;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonConnectionStatusChange::ConnectionStatus
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CConnMonConnectionStatusChange::ConnectionStatus() const
+    {
+    return iConnectionStatus;
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CConnMonConnectionActivityChange::CConnMonConnectionActivityChange
+// -----------------------------------------------------------------------------
+//
+CConnMonConnectionActivityChange::CConnMonConnectionActivityChange(
+        const TUint aConnectionId,
+        const TUint aSubConnectionId,
+        const TBool aActivity )
+        :
+        CConnMonEventBase( EConnMonConnectionActivityChange, aConnectionId )
+    {
+    iSubConnectionId = aSubConnectionId;
+    iActivity = aActivity;
+    }
+
+// Destructor
+CConnMonConnectionActivityChange::~CConnMonConnectionActivityChange()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonConnectionActivityChange::SubConnectionId
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TUint CConnMonConnectionActivityChange::SubConnectionId() const
+    {
+    return iSubConnectionId;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonConnectionActivityChange::ConnectionActivity
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool CConnMonConnectionActivityChange::ConnectionActivity() const
+    {
+    return iActivity;
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CConnMonNetworkRegistrationChange::CConnMonNetworkRegistrationChange
+// -----------------------------------------------------------------------------
+//
+CConnMonNetworkRegistrationChange::CConnMonNetworkRegistrationChange(
+        const TUint aConnectionId,
+        const TInt  aRegistrationStatus )
+        :
+        CConnMonEventBase( EConnMonNetworkRegistrationChange, aConnectionId )
+    {
+    iRegistrationStatus = aRegistrationStatus;
+    }
+
+// Destructor
+CConnMonNetworkRegistrationChange::~CConnMonNetworkRegistrationChange()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonNetworkRegistrationChange::RegistrationStatus
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CConnMonNetworkRegistrationChange::RegistrationStatus() const
+    {
+    return iRegistrationStatus;
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CConnMonBearerChange::CConnMonBearerChange
+// -----------------------------------------------------------------------------
+//
+CConnMonBearerChange::CConnMonBearerChange(
+        const TUint aConnectionId,
+        const TInt aBearer )
+        :
+        CConnMonEventBase( EConnMonBearerChange, aConnectionId )
+    {
+    iBearer = aBearer;
+    }
+
+// Destructor
+CConnMonBearerChange::~CConnMonBearerChange()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonBearerChange::RegistrationStatus
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CConnMonBearerChange::Bearer() const
+    {
+    return iBearer;
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CConnMonSignalStrengthChange::CConnMonSignalStrengthChange
+// -----------------------------------------------------------------------------
+//
+CConnMonSignalStrengthChange::CConnMonSignalStrengthChange(
+        const TUint aConnectionId,
+        const TInt  aSignalStrength )
+        :
+        CConnMonEventBase( EConnMonSignalStrengthChange, aConnectionId )
+    {
+    iSignalStrength = aSignalStrength;
+    }
+
+// Destructor
+CConnMonSignalStrengthChange::~CConnMonSignalStrengthChange()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonSignalStrengthChange::SignalStrength
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CConnMonSignalStrengthChange::SignalStrength() const
+    {
+    return iSignalStrength;
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CConnMonBearerAvailabilityChange::CConnMonBearerAvailabilityChange
+// -----------------------------------------------------------------------------
+//
+CConnMonBearerAvailabilityChange::CConnMonBearerAvailabilityChange(
+        const TUint aConnectionId,
+        const TBool aAvailability )
+        :
+        CConnMonEventBase( EConnMonBearerAvailabilityChange, aConnectionId )
+    {
+    iAvailability = aAvailability;
+    }
+
+// Destructor
+CConnMonBearerAvailabilityChange::~CConnMonBearerAvailabilityChange()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonBearerAvailabilityChange::Availability
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool CConnMonBearerAvailabilityChange::Availability() const
+    {
+    return iAvailability;
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CConnMonGenericEvent::CConnMonGenericEvent
+// -----------------------------------------------------------------------------
+//
+CConnMonGenericEvent::CConnMonGenericEvent(
+        const TUint aType,
+        const TUint aConnectionId,
+        TAny* aData )
+        :
+        CConnMonEventBase( aType, aConnectionId )
+    {
+    iData = aData;
+    }
+
+// Destructor
+CConnMonGenericEvent::~CConnMonGenericEvent()
+    {
+    iData = 0;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonGenericEvent::Data
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TAny* CConnMonGenericEvent::Data() const
+    {
+    return iData;
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CConnMonIapAvailabilityChange::CConnMonIapAvailabilityChange
+// -----------------------------------------------------------------------------
+//
+CConnMonIapAvailabilityChange::CConnMonIapAvailabilityChange(
+        const TUint aConnectionId,
+        const TConnMonIapInfo* aIapInfoPtr )
+        :
+        CConnMonEventBase( EConnMonIapAvailabilityChange, aConnectionId )
+    {
+    iIapInfo.iCount = 0;
+
+    if ( aIapInfoPtr )
+        {
+        iIapInfo = *aIapInfoPtr;
+        }
+    }
+
+// Destructor
+CConnMonIapAvailabilityChange::~CConnMonIapAvailabilityChange()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonIapAvailabilityChange::IapAvailability
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TConnMonIapInfo CConnMonIapAvailabilityChange::IapAvailability() const
+    {
+    return iIapInfo;
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CConnMonTransmitPowerChange::CConnMonTransmitPowerChange
+// -----------------------------------------------------------------------------
+//
+CConnMonTransmitPowerChange::CConnMonTransmitPowerChange(
+        const TUint aConnectionId,
+        const TUint aTransmitPower )
+        :
+        CConnMonEventBase( EConnMonTransmitPowerChange, aConnectionId )
+    {
+    iTransmitPower = aTransmitPower;
+    }
+
+// Destructor
+CConnMonTransmitPowerChange::~CConnMonTransmitPowerChange()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonTransmitPowerChange::TransmitPower
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TUint CConnMonTransmitPowerChange::TransmitPower() const
+    {
+    return iTransmitPower;
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CConnMonSNAPAvailabilityChange::CConnMonSNAPAvailabilityChange
+// -----------------------------------------------------------------------------
+//
+CConnMonSNAPsAvailabilityChange::CConnMonSNAPsAvailabilityChange(
+        const TUint aConnectionId,
+        const TUint aSNAPsAvailable,
+        const TConnMonSNAPInfo* aSNAPInfoPtr )
+        :
+        CConnMonEventBase( EConnMonSNAPsAvailabilityChange, aConnectionId )
+    {
+
+    iSNAPInfo.iCount = 0;
+    iSNAPsAvailable = aSNAPsAvailable;
+
+    if ( aSNAPInfoPtr )
+        {
+        iSNAPInfo = *aSNAPInfoPtr;
+        }
+    }
+
+// Destructor
+CConnMonSNAPsAvailabilityChange::~CConnMonSNAPsAvailabilityChange()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonSNAPAvailabilityChange::SNAPAvailability
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TConnMonSNAPInfo CConnMonSNAPsAvailabilityChange::SNAPAvailability() const
+    {
+    return iSNAPInfo;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonSNAPAvailabilityChange::SNAPsAvailable
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TUint CConnMonSNAPsAvailabilityChange::SNAPsAvailabile() const
+    {
+    return iSNAPsAvailable;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonNewWLANNetworkDetected::CConnMonNewWLANNetworkDetected
+// -----------------------------------------------------------------------------
+//
+
+CConnMonNewWLANNetworkDetected::CConnMonNewWLANNetworkDetected(
+        const TUint aConnectionId )
+        :
+        CConnMonEventBase( EConnMonNewWLANNetworkDetected, aConnectionId )
+    {
+    }
+
+// Destructor
+CConnMonNewWLANNetworkDetected::~CConnMonNewWLANNetworkDetected()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonNewWLANNetworkDetected::CConnMonNewWLANNetworkDetected
+// -----------------------------------------------------------------------------
+//
+CConnMonOldWLANNetworkLost::CConnMonOldWLANNetworkLost(
+        const TUint aConnectionId )
+        :
+        CConnMonEventBase( EConnMonOldWLANNetworkLost, aConnectionId )
+    {
+    }
+
+// Destructor
+CConnMonOldWLANNetworkLost::~CConnMonOldWLANNetworkLost()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CConnMonPacketDataUnavailable::CConnMonPacketDataUnavailable
+// -----------------------------------------------------------------------------
+//
+CConnMonPacketDataUnavailable::CConnMonPacketDataUnavailable(
+        const TUint aConnectionId )
+        :
+        CConnMonEventBase( EConnMonPacketDataUnavailable, aConnectionId )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonPacketDataUnavailable::~CConnMonPacketDataUnavailable
+// -----------------------------------------------------------------------------
+//
+CConnMonPacketDataUnavailable::~CConnMonPacketDataUnavailable()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonPacketDataAvailable::CConnMonPacketDataAvailable
+// -----------------------------------------------------------------------------
+//
+CConnMonPacketDataAvailable::CConnMonPacketDataAvailable(
+        const TUint aConnectionId )
+        :
+        CConnMonEventBase( EConnMonPacketDataAvailable, aConnectionId )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonPacketDataAvailable::~CConnMonPacketDataAvailable
+// -----------------------------------------------------------------------------
+//
+CConnMonPacketDataAvailable::~CConnMonPacketDataAvailable()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonBearerGroupChange::CConnMonBearerInfoChange
+// -----------------------------------------------------------------------------
+//
+CConnMonBearerInfoChange::CConnMonBearerInfoChange(
+        const TUint aConnectionId,
+        const TInt aBearerInfo )
+        :
+        CConnMonEventBase( EConnMonBearerInfoChange, aConnectionId )
+    {
+    iBearerInfo = aBearerInfo;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonBearerGroupChange::~CConnMonBearerInfoChange
+// -----------------------------------------------------------------------------
+//
+CConnMonBearerInfoChange::~CConnMonBearerInfoChange()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonBearerGroupChange::BearerGroups
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CConnMonBearerInfoChange::BearerInfo() const
+    {
+    return iBearerInfo;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonBearerGroupChange::CConnMonBearerGroupChange
+// -----------------------------------------------------------------------------
+//
+CConnMonBearerGroupChange::CConnMonBearerGroupChange(
+        const TUint aConnectionId,
+        const TUint aBearerGroups1,
+        const TUint aBearerGroups2,
+        const TBool aInternal )
+        :
+        CConnMonEventBase( EConnMonBearerGroupChange, aConnectionId )
+    {
+    iInternal = aInternal;
+    iBearerGroups1 = aBearerGroups1;
+    iBearerGroups2 = aBearerGroups2;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonBearerGroupChange::~CConnMonBearerGroupChange
+// -----------------------------------------------------------------------------
+//
+CConnMonBearerGroupChange::~CConnMonBearerGroupChange()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonBearerGroupChange::BearerGroups
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool CConnMonBearerGroupChange::Internal() const
+    {
+    return iInternal;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonBearerGroupChange::BearerGroups
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CConnMonBearerGroupChange::BearerGroups(
+        TUint& aBearerGroups1,
+        TUint& aBearerGroups2 ) const
+    {
+    aBearerGroups1 = iBearerGroups1;
+    aBearerGroups2 = iBearerGroups2;
+    }
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/src/connmoncommsdatcache.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,2046 @@
+/*
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Provides cached information on IAPs and SNAPs in CommsDat.
+*
+*/
+
+#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include <commsdat_partner.h>
+#endif
+#include <datamobilitycommsdattypes.h>
+
+#include "ConnMonServ.h"
+#include "CEventQueue.h"
+#include "ConnMonIAP.h"
+#include "ConnMonBearer.h"
+#include "connmoncommsdatcache.h"
+#include "log.h"
+
+using namespace CommsDat;
+
+TConnMonSnapEntry::TConnMonSnapEntry()
+    {
+    iId = 0;
+    iNextLayerIapId = 0;
+    iNextLayerSnapId = 0;
+    iAvailability = 0;
+    iNextLayerIndex = KErrNotFound;
+    }
+
+TConnMonSnapEntry::TConnMonSnapEntry(
+        TUint aId,
+        TUint aNextLayerIapId,
+        TUint aNextLayerSnapId )
+        :
+        iId( aId ),
+        iNextLayerIapId( aNextLayerIapId ),
+        iNextLayerSnapId( aNextLayerSnapId )
+    {
+    iAvailability = 0;
+    iNextLayerIndex = KErrNotFound;
+    }
+
+TInt TConnMonSnapEntry::Compare(
+        const TConnMonSnapEntry& aFirst,
+        const TConnMonSnapEntry& aSecond )
+    {
+    // Availability info is ignored
+    if ( aFirst.iId < aSecond.iId ) return -1;
+    if ( aFirst.iId > aSecond.iId ) return 1;
+    if ( aFirst.iNextLayerSnapId < aSecond.iNextLayerSnapId ) return -1;
+    if ( aFirst.iNextLayerSnapId > aSecond.iNextLayerSnapId ) return 1;
+    if ( aFirst.iNextLayerIapId < aSecond.iNextLayerIapId ) return -1;
+    if ( aFirst.iNextLayerIapId > aSecond.iNextLayerIapId ) return 1;
+    return 0;
+    }
+
+TInt TConnMonSnapEntry::FindCompare(
+        const TInt* aKey,
+        const TConnMonSnapEntry& aEntry )
+    {
+    // Zero if match, negative if first is smaller, positive otherwise
+    return ( *aKey ) - aEntry.iId;
+    }
+
+TBool TConnMonSnapEntry::Match(
+        const TConnMonSnapEntry& aFirst,
+        const TConnMonSnapEntry& aSecond )
+    {
+    // Availability info is ignored
+    if ( ( aFirst.iId == aSecond.iId ) &&
+            ( aFirst.iNextLayerIapId == aSecond.iNextLayerIapId ) &&
+            ( aFirst.iNextLayerSnapId == aSecond.iNextLayerSnapId ) )
+        {
+        return ETrue;
+        }
+    return EFalse;
+    }
+
+
+TConnMonIapEntry::TConnMonIapEntry()
+    {
+    iId = 0;
+    iBearerType = 0;
+    iServiceType = 0;
+    iAvailability = 0;
+    iNextLayerIapId = 0;
+    iNextLayerSnapId = 0;
+    iNextLayerIndex = KErrNotFound;
+    }
+
+TConnMonIapEntry::TConnMonIapEntry(
+        TUint aId,
+        TUint aBearerType,
+        TUint aServiceType )
+        :
+        iId( aId ),
+        iBearerType( aBearerType ),
+        iServiceType( aServiceType )
+    {
+    iAvailability = 0;
+    iNextLayerIndex = KErrNotFound;
+    iNextLayerIapId = 0;
+    iNextLayerSnapId = 0;
+    }
+
+TInt TConnMonIapEntry::Compare(
+        const TConnMonIapEntry& aFirst,
+        const TConnMonIapEntry& aSecond )
+    {
+    // Zero if match, negative if first is smaller, positive otherwise
+    // Availability info is ignored
+    return aFirst.iId - aSecond.iId;
+    }
+
+TInt TConnMonIapEntry::FindCompare(
+        const TInt* aKey,
+        const TConnMonIapEntry& aEntry )
+    {
+    // Zero if match, negative if first is smaller, positive otherwise
+    return ( *aKey ) - aEntry.iId;
+    }
+
+TBool TConnMonIapEntry::Match(
+        const TConnMonIapEntry& aFirst,
+        const TConnMonIapEntry& aSecond )
+    {
+    // Availability info is ignored
+    if ( ( aFirst.iId == aSecond.iId ) &&
+            ( aFirst.iBearerType == aSecond.iBearerType ) &&
+            ( aFirst.iServiceType == aSecond.iServiceType ) )
+        {
+        return ETrue;
+        }
+    return EFalse;
+    }
+
+
+TConnMonVirtualIapEntry::TConnMonVirtualIapEntry()
+    {
+    iId = 0;
+    iNextLayerIapId = 0;
+    iNextLayerSnapId = 0;
+    }
+
+TConnMonVirtualIapEntry::TConnMonVirtualIapEntry(
+        TUint aId,
+        TUint aNextLayerIapId,
+        TUint aNextLayerSnapId )
+        :
+        iId( aId ),
+        iNextLayerIapId( aNextLayerIapId ),
+        iNextLayerSnapId( aNextLayerSnapId )
+    {
+    }
+
+TInt TConnMonVirtualIapEntry::Compare(
+        const TConnMonVirtualIapEntry& aFirst,
+        const TConnMonVirtualIapEntry& aSecond )
+    {
+    // Zero if match, negative if first is smaller, positive otherwise
+    return aFirst.iId - aSecond.iId;
+    }
+
+TInt TConnMonVirtualIapEntry::FindCompare(
+        const TInt* aKey,
+        const TConnMonVirtualIapEntry& aEntry )
+    {
+    // Zero if match, negative if first is smaller, positive otherwise
+    return ( *aKey ) - aEntry.iId;
+    }
+
+TBool TConnMonVirtualIapEntry::Match(
+        const TConnMonVirtualIapEntry& aFirst,
+        const TConnMonVirtualIapEntry& aSecond )
+    {
+    if ( ( aFirst.iId == aSecond.iId ) &&
+            ( aFirst.iNextLayerIapId == aSecond.iNextLayerIapId ) &&
+            ( aFirst.iNextLayerSnapId == aSecond.iNextLayerSnapId ) )
+        {
+        return ETrue;
+        }
+    return EFalse;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Two phased constructor.
+// ---------------------------------------------------------------------------
+//
+CConnMonCommsDatCache* CConnMonCommsDatCache::NewL()
+    {
+    //LOGENTRFN("CConnMonCommsDatCache::NewL()")
+
+    CConnMonCommsDatCache* self = CConnMonCommsDatCache::NewLC();
+    CleanupStack::Pop( self );
+
+    //LOGEXITFN("CConnMonCommsDatCache::NewL()")
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Two phased constructor.
+// ---------------------------------------------------------------------------
+//
+CConnMonCommsDatCache* CConnMonCommsDatCache::NewLC()
+    {
+    //LOGENTRFN("CConnMonCommsDatCache::NewLC()")
+
+    CConnMonCommsDatCache* self = new( ELeave ) CConnMonCommsDatCache;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+
+    //LOGEXITFN("CConnMonCommsDatCache::NewLC()")
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor.
+// ---------------------------------------------------------------------------
+//
+CConnMonCommsDatCache::~CConnMonCommsDatCache()
+    {
+    LOGENTRFN("CConnMonCommsDatCache::~CConnMonCommsDatCache()")
+
+    if ( iSnapCache )
+        {
+        iSnapCache->Close();
+        delete iSnapCache;
+        iSnapCache = NULL;
+        }
+    if ( iIapCache )
+        {
+        iIapCache->Close();
+        delete iIapCache;
+        iIapCache = NULL;
+        }
+    if ( iVirtualIapCache )
+        {
+        iVirtualIapCache->Close();
+        delete iVirtualIapCache;
+        iVirtualIapCache = NULL;
+        }
+
+    iWlanIapIdCache.Close();
+    iIapIdCache.Close();
+    iSnapIdCache.Close();
+
+    LOGEXITFN("CConnMonCommsDatCache::~CConnMonCommsDatCache()")
+    }
+
+// ---------------------------------------------------------------------------
+// Reads all IAP and SNAP information from CommsDat and initializes the cache
+// with it.
+// ---------------------------------------------------------------------------
+//
+void CConnMonCommsDatCache::Init(
+        CConnMonServer* aServer,
+        CConnMonIAP* aConnMonIap,
+        RPointerArray<TConnMonBearer>* aBearers )
+    {
+    LOGENTRFN("CConnMonCommsDatCache::Init()")
+
+    iServer = aServer;
+    iIap = aConnMonIap;
+    iBearers = aBearers;
+
+    if ( iInitStatus != EConnMonCacheInitNotStarted )
+        {
+        LOGIT("Init: ERROR, ConnMon CommsDat cache init called too many times")
+        return;
+        }
+    iInitStatus = EConnMonCacheInitInProgress;
+
+    // Check if WLAN bearer is available
+    for ( TInt i = 0; i < iBearers->Count(); i++ )
+        {
+        if ( (*iBearers)[i]->BearerId() == EBearerIdWLAN )
+            {
+            iWlanSupportEnabled = ETrue;
+            break;
+            }
+        }
+
+    TRAPD( leaveCode, InitCommsDatCacheL() );
+    if ( leaveCode )
+        {
+        LOGIT1("Init: ERROR (Ok if empty), LEAVE in ConnMon CommsDat cache init <%d>", leaveCode)
+        }
+
+    RefreshAvailabilityInfo( EFalse ); // Never send events in Init phase
+    iInitStatus = EConnMonCacheInitCompleted;
+
+    LOGEXITFN("CConnMonCommsDatCache::Init()")
+    }
+
+// ---------------------------------------------------------------------------
+// Calls the correct method to read the CommsDat table, refered to with
+// parameter aTableId, to cache. This should be called when a change is
+// detected in CommsDat through central repository events.
+// ---------------------------------------------------------------------------
+//
+void CConnMonCommsDatCache::RefreshCommsDatCacheL( const TUint32 aTableId )
+    {
+    //LOGENTRFN("CConnMonCommsDatCache::RefreshCommsDatCacheL()")
+
+    CMDBSession* db = CMDBSession::NewLC( CMDBSession::LatestVersion() );
+    db->SetAttributeMask( ECDHidden | ECDProtectedWrite );
+
+    if ( aTableId == iIapRecordTableId )
+        {
+        LOGIT("RefreshCommsDatCacheL: IAP table change event")
+        RefreshCommsDatIapCacheL( *db );
+        }
+    else if ( aTableId == iSnapRecordTableId )
+        {
+        LOGIT("RefreshCommsDatCacheL: SNAP table change event")
+        RefreshCommsDatSnapCacheL( *db );
+        }
+    else if ( aTableId == iVirtualRecordTableId )
+        {
+        LOGIT("RefreshCommsDatCacheL: Virtual record table change event")
+        RefreshCommsDatVirtualIapCacheL( *db );
+        }
+    else if ( aTableId == 0 )
+        {
+        // This option is not currently used, but provided to support the
+        // possibility to read CommsDat information again when client is
+        // asking for IAP/SNAP availability information as a request.
+        // This would be needed in the case that CenRep change events
+        // become unreliable for some reason, and thus the CommsDat cache
+        // would not be reliably up to date.
+        LOGIT("RefreshCommsDatCacheL: Reading all commsdat tables")
+        RefreshCommsDatIapCacheL( *db );
+        RefreshCommsDatSnapCacheL( *db );
+        RefreshCommsDatVirtualIapCacheL( *db );
+        }
+
+    CleanupStack::PopAndDestroy( db );
+
+    //LOGEXITFN("CConnMonCommsDatCache::RefreshCommsDatCacheL()")
+    }
+
+// ---------------------------------------------------------------------------
+// Solves IAP and SNAP availability. The availability information in the cache
+// tables will be up to date after a call to this method.
+// If parameter aCanSendEvents is true, availability changed events will be
+// sent to clients if any changes from previous availability state is detected.
+// ---------------------------------------------------------------------------
+//
+void CConnMonCommsDatCache::RefreshAvailabilityInfo( const TBool aCanSendEvents )
+    {
+    LOGENTRFN("CConnMonCommsDatCache::RefreshAvailabilityInfo()")
+
+    // If any relevant commsdat table changed.
+    //
+    // These flags are set to true only when CommsDat change event is received,
+    // CommsDat information is read into ConnMon cache, and that information
+    // has changed.
+    if ( iIapsChanged || iSnapsChanged || iVirtualIapsChanged )
+        {
+        UpdateSnapAndVirtualIapLinks();
+        iIapsChanged = EFalse;
+        iSnapsChanged = EFalse;
+        iVirtualIapsChanged = EFalse;
+        }
+
+    ResetAllAvailabilityInfo();
+    for ( TInt i = 0; i < iBearers->Count(); i++ )
+        {
+        (*iBearers)[i]->FlagAvailableIaps();
+        }
+    SolveSnapAndVirtualIapAvailability();
+
+    LOGIT(".")
+    TBool availableIapsChanged = UpdateAvailableIaps();
+
+    #ifdef _DEBUG
+    // Print available IAP IDs to log
+    for ( TInt j = 0; j < iIapCache->Count(); j++ )
+        {
+        if ( (*iIapCache)[j].iAvailability == EConnMonAvailabilityAvailable )
+            {
+            TUint currentId = (*iIapCache)[j].iId;
+            if ( (*iIapCache)[j].iBearerType == EConnMonCacheBearerTypeVirtual )
+                {
+                switch ( (*iIapCache)[j].iServiceType )
+                    {
+                    case EConnMonCacheServiceTypeCsd:
+                        LOGIT1("  %3d: CSD, virtual", currentId) break;
+                    case EConnMonCacheServiceTypeGprs:
+                        LOGIT1("  %3d: GPRS, virtual", currentId) break;
+                    case EConnMonCacheServiceTypeLan:
+                        LOGIT1("  %3d: LAN, virtual", currentId) break;
+                    case EConnMonCacheServiceTypeWlan:
+                        LOGIT1("  %3d: WLAN, virtual", currentId) break;
+                    default:
+                        LOGIT1("  %3d: Unknown, virtual", currentId) break;
+                    }
+                }
+            else
+                {
+                switch ( (*iIapCache)[j].iServiceType )
+                    {
+                    case EConnMonCacheServiceTypeCsd:
+                        LOGIT1("  %3d: CSD", currentId) break;
+                    case EConnMonCacheServiceTypeGprs:
+                        LOGIT1("  %3d: GPRS", currentId) break;
+                    case EConnMonCacheServiceTypeLan:
+                        LOGIT1("  %3d: LAN", currentId) break;
+                    case EConnMonCacheServiceTypeWlan:
+                        LOGIT1("  %3d: WLAN", currentId) break;
+                    default:
+                        LOGIT1("  %3d: Unknown", currentId) break;
+                    }
+                }
+            }
+        }
+    #endif // _DEBUG
+
+    TBool availableSnapsChanged = UpdateAvailableSnaps();
+
+    // Print available SNAP IDs to log
+    #ifdef _DEBUG
+    TUint lastSnapId( 0 );
+    for ( TInt k = 0; k < iSnapCache->Count(); k++ )
+        {
+        TUint currentId = (*iSnapCache)[k].iId;
+        if ( currentId != lastSnapId )
+            {
+            lastSnapId = currentId;
+            if ( (*iSnapCache)[k].iAvailability == EConnMonAvailabilityAvailable )
+                {
+                LOGIT1("  %4d", currentId)
+                }
+            }
+        }
+    LOGIT(".")
+    #endif // _DEBUG
+
+    if ( aCanSendEvents )
+        {
+        if ( availableIapsChanged )
+            {
+            LOGIT("RefreshAvailabilityInfo: sending IAP availability event")
+            SendIapAvailabilityEvent();
+            }
+        if ( availableSnapsChanged )
+            {
+            LOGIT("RefreshAvailabilityInfo: sending SNAP availability event")
+            SendSnapAvailabilityEvent();
+            }
+        }
+
+    LOGEXITFN("CConnMonCommsDatCache::RefreshAvailabilityInfo()")
+    }
+
+// ---------------------------------------------------------------------------
+// Set as available all IAPs which correspond to the given bearer ID
+// (converted to service type).
+// ---------------------------------------------------------------------------
+//
+void CConnMonCommsDatCache::SetAvailableIapsWithBearerId( const TUint aBearerId )
+    {
+    //LOGENTRFN("CConnMonCommsDatCache::SetAvailableIapsWithBearerId()")
+    TInt err( KErrNone );
+
+    TUint serviceType;
+    err = ConvertBearerIdToServiceType( aBearerId, serviceType );
+
+    if ( !err )
+        {
+        const TInt iapCount = iIapCache->Count();
+        for ( TInt i = 0; i < iapCount; i++ )
+            {
+            if ( (*iIapCache)[i].iServiceType == serviceType )
+                {
+                (*iIapCache)[i].iAvailability = EConnMonAvailabilityAvailable;
+                }
+            }
+        }
+
+    //LOGEXITFN("CConnMonCommsDatCache::SetAvailableIapsWithBearerId()")
+    }
+
+// ---------------------------------------------------------------------------
+// Set as available the IAP with matching ID.
+// ---------------------------------------------------------------------------
+//
+void CConnMonCommsDatCache::SetAvailableIapWithId( const TUint aId )
+    {
+    //LOGENTRFN("CConnMonCommsDatCache::SetAvailableIapWithId()")
+
+    TInt index = iIapCache->FindInOrder<TInt>( aId, TConnMonIapEntry::FindCompare );
+    if ( index >= 0)
+        {
+        (*iIapCache)[index].iAvailability = EConnMonAvailabilityAvailable;
+        }
+
+    //LOGEXITFN("CConnMonCommsDatCache::SetAvailableIapWithId()")
+    }
+
+// ---------------------------------------------------------------------------
+// Get available IAP IDs for the requested bearer ID. IAP availability is
+// re-solved first.
+// Maximum number of IAP IDs is limited by KConnMonMaxIAPCount.
+// ---------------------------------------------------------------------------
+//
+TInt CConnMonCommsDatCache::GetAvailableIaps(
+        const TUint aBearerId,
+        TConnMonIapInfo& aIapInfo )
+    {
+    LOGENTRFN("CConnMonCommsDatCache::GetAvailableIaps()")
+    TInt err( KErrNone );
+
+    TBool availabilityEventsEnabled( EFalse );
+    if ( ( aBearerId == EBearerIdAll ) || ( aBearerId == EBearerIdVirtualVPN ) )
+        {
+        // If WLAN background scanning is on, and client is asking IAP
+        // availability for all- or virtual IAPs, send IAP availability changed
+        // events if any changes detected.
+        TRAPD( traperr, availabilityEventsEnabled = IsWlanBackgroundScanningEnabledL() );
+        if ( traperr )
+            {
+            // If error here, continue as WLAN background scanning is disabled.
+            availabilityEventsEnabled = EFalse;
+            LOGIT1("ERROR, WLAN background scan discovery failed with <%d>", traperr)
+            }
+        }
+
+    RefreshAvailabilityInfo( availabilityEventsEnabled );
+
+    TInt iapCount( 0 );
+    TUint bearerType( 0 );
+    TUint serviceType( 0 );
+    TBool done( EFalse );
+
+    switch ( aBearerId )
+        {
+        case EBearerIdAll:
+            {
+            iapCount = iIapIdCache.Count();
+            if ( iapCount > KConnMonMaxIAPCount )
+                {
+                iapCount = KConnMonMaxIAPCount;
+                }
+            aIapInfo.iCount = iapCount;
+            for ( TInt i = 0; i < iapCount; i++ )
+                {
+                aIapInfo.iIap[i].iIapId = iIapIdCache[i];
+                }
+            done = ETrue;
+            }
+            break;
+        case EBearerIdGPRS:
+        case EBearerIdWCDMA:
+            serviceType = EConnMonCacheServiceTypeGprs;
+            break;
+        case EBearerIdWLAN:
+            serviceType = EConnMonCacheServiceTypeWlan;
+            break;
+        case EBearerIdCSD:
+        case EBearerIdWcdmaCSD:
+            serviceType = EConnMonCacheServiceTypeCsd;
+            break;
+        case EBearerIdVirtualVPN:
+            bearerType = EConnMonCacheBearerTypeVirtual;
+            break;
+        case EBearerIdLAN:
+            serviceType = EConnMonCacheServiceTypeLan;
+            break;
+        default:
+            err = KErrArgument;
+            done = ETrue;
+            break;
+        }
+
+    if ( !done )
+        {
+        TInt totalCount = iIapCache->Count();
+        for ( TInt i = 0; i < totalCount && iapCount < KConnMonMaxIAPCount; i++ )
+            {
+            if ( serviceType )
+                {
+                if ( (*iIapCache)[i].iAvailability == EConnMonAvailabilityAvailable &&
+                        (*iIapCache)[i].iServiceType == serviceType )
+                    {
+                    aIapInfo.iIap[iapCount].iIapId = (*iIapCache)[i].iId;
+                    iapCount++;
+                    }
+                }
+            else if ( bearerType )
+                {
+                if ( (*iIapCache)[i].iAvailability == EConnMonAvailabilityAvailable &&
+                        (*iIapCache)[i].iBearerType == bearerType )
+                    {
+                    aIapInfo.iIap[iapCount].iIapId = (*iIapCache)[i].iId;
+                    iapCount++;
+                    }
+                }
+            }
+        aIapInfo.iCount = iapCount;
+        }
+
+    LOGEXITFN1("CConnMonCommsDatCache::GetAvailableIaps()", err)
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// Get available SNAP IDs. SNAP availability is re-solved first.
+// Maximum number of SNAP IDs is limited by KConnMonMaxSNAPsCount.
+// ---------------------------------------------------------------------------
+//
+void CConnMonCommsDatCache::GetAvailableSnaps( TConnMonSNAPInfo& aSnapInfo )
+    {
+    LOGENTRFN("CConnMonCommsDatCache::GetAvailableSnaps()")
+
+    TBool availabilityEventsEnabled( EFalse );
+    // If WLAN background scanning is on, and client is asking SNAP
+    // availability, send SNAP availability changed events if any changes
+    // detected.
+    TRAPD( traperr, availabilityEventsEnabled = IsWlanBackgroundScanningEnabledL() );
+    if ( traperr )
+        {
+        // If error here, continue as WLAN background scanning is disabled.
+        availabilityEventsEnabled = EFalse;
+        LOGIT1("ERROR, WLAN background scan discovery failed: <%d>", traperr)
+        }
+
+    RefreshAvailabilityInfo( availabilityEventsEnabled );
+
+    TInt snapCount = iSnapIdCache.Count();
+    if ( snapCount > KConnMonMaxSNAPsCount )
+        {
+        snapCount = KConnMonMaxSNAPsCount;
+        }
+    aSnapInfo.iCount = snapCount;
+    for ( TInt i = 0; i < snapCount; i++ )
+        {
+        aSnapInfo.iSNAP[i].iSNAPId = iSnapIdCache[i];
+        }
+
+    LOGEXITFN("CConnMonCommsDatCache::GetAvailableSnaps()")
+    }
+
+// ---------------------------------------------------------------------------
+// Get available SNAP IDs. SNAP availability is re-solved first.
+// ---------------------------------------------------------------------------
+//
+TInt CConnMonCommsDatCache::GetAvailableSnaps( RArray<TConnMonId>& aSnapIds )
+    {
+    LOGENTRFN("CConnMonCommsDatCache::GetAvailableSnaps()")
+
+    TBool availabilityEventsEnabled( EFalse );
+    // If WLAN background scanning is on, and client is asking SNAP
+    // availability, send SNAP availability changed events if any changes
+    // detected.
+    TRAPD( traperr, availabilityEventsEnabled = IsWlanBackgroundScanningEnabledL() );
+    if ( traperr )
+        {
+        // If error here, continue as WLAN background scanning is disabled.
+        availabilityEventsEnabled = EFalse;
+        LOGIT1("ERROR, WLAN background scan discovery failed: <%d>", traperr)
+        }
+
+    RefreshAvailabilityInfo( availabilityEventsEnabled );
+
+    // Return KErrNoMemory only if RArray fails to allocate memory, KErrNone otherwise
+    TInt err( KErrNone );
+    err = aSnapIds.Reserve( iSnapIdCache.Count() );
+    if ( !err )
+        {
+        for ( TInt i = 0; i < iSnapIdCache.Count(); i++ )
+            {
+            aSnapIds.Append( TConnMonId( iSnapIdCache[i] ) );
+            }
+        }
+
+    LOGEXITFN1("CConnMonCommsDatCache::GetAvailableSnaps()", err)
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CConnMonCommsDatCache::CConnMonCommsDatCache()
+    {
+    //LOGENTRFN("CConnMonCommsDatCache::CConnMonCommsDatCache()")
+    //LOGEXITFN("CConnMonCommsDatCache::CConnMonCommsDatCache()")
+    }
+
+// ---------------------------------------------------------------------------
+// 2nd phase constructor
+// ---------------------------------------------------------------------------
+//
+void CConnMonCommsDatCache::ConstructL()
+    {
+    //LOGENTRFN("CConnMonCommsDatCache::ConstructL()")
+
+    iIap = NULL;
+    iInitStatus = EConnMonCacheInitNotStarted;
+    iVirtualIapCount = 0;
+    iWlanSupportEnabled = EFalse; // Set in Init()-method
+
+    iIapsChanged = EFalse;
+    iSnapsChanged = EFalse;
+    iVirtualIapsChanged = EFalse;
+
+    iIapRecordTableId = KCDTIdIAPRecord;
+    iSnapRecordTableId = 0;     // Read from CommsDat when needed for first time
+    iVirtualRecordTableId = 0;  // Read from CommsDat when needed for first time
+
+    iIapCache = new( ELeave ) RArray<TConnMonIapEntry>();
+    iSnapCache = new( ELeave ) RArray<TConnMonSnapEntry>();
+    iVirtualIapCache = new( ELeave ) RArray<TConnMonVirtualIapEntry>();
+
+    //LOGEXITFN("CConnMonCommsDatCache::ConstructL()")
+    }
+
+// ---------------------------------------------------------------------------
+// Reads all relevant CommsDat information to cache and initializes the SNAP
+// and virtual IAP table IDs.
+// ---------------------------------------------------------------------------
+//
+void CConnMonCommsDatCache::InitCommsDatCacheL()
+    {
+    //LOGENTRFN("CConnMonCommsDatCache::InitCommsDatCacheL()")
+
+    CMDBSession* db = CMDBSession::NewLC( CMDBSession::LatestVersion() );
+    db->SetAttributeMask( ECDHidden | ECDProtectedWrite );
+
+    // Find out the table IDs for CCDDataMobilitySelectionPolicyRecord and
+    // CCDVirtualIAPNextLayerRecord, only need to do this once.
+    iVirtualRecordTableId = CCDVirtualIAPNextLayerRecord::TableIdL( *db );
+    iSnapRecordTableId = CCDDataMobilitySelectionPolicyRecord::TableIdL( *db );
+
+    LOGIT("InitCommsDatCacheL: reading commsdat tables")
+    RefreshCommsDatIapCacheL( *db );
+    RefreshCommsDatSnapCacheL( *db );
+    RefreshCommsDatVirtualIapCacheL( *db );
+
+    CleanupStack::PopAndDestroy( db );
+
+    //LOGEXITFN("CConnMonCommsDatCache::InitCommsDatCacheL()")
+    }
+
+// ---------------------------------------------------------------------------
+// Reads all IAP information from CommsDat and updates the cache if necessary.
+// ---------------------------------------------------------------------------
+//
+TBool CConnMonCommsDatCache::RefreshCommsDatIapCacheL( CMDBSession& aDb )
+    {
+    LOGENTRFN("CConnMonCommsDatCache::RefreshCommsDatIapCacheL()")
+
+    // Will only leave if device runs out of memory or LoadL fails on IAP
+    // record set. This will result in an empty IAP cache and thus no IAP
+    // will be reported available through ConnMon API.
+
+    RArray<TUint> currentWlanIapIds;
+    CleanupClosePushL( currentWlanIapIds );
+
+    RArray<TConnMonIapEntry>* currentIapData;
+    if ( iInitStatus == EConnMonCacheInitCompleted )
+        {
+        // Array to read current CommsDat info into.
+        currentIapData = new( ELeave ) RArray<TConnMonIapEntry>; // Heap used by design
+        CleanupClosePushL( *currentIapData );
+        }
+    else
+        {
+        // Init-phase, read current CommsDat info directly into cache array,
+        // since it is still empty. Then stop (don't send any events).
+        iWlanIapIdCache.Reset();
+        currentIapData = iIapCache;
+        }
+    currentIapData->Reset();
+
+    ReadCommsDatIapTableL( aDb, *currentIapData, currentWlanIapIds );
+
+    if ( iInitStatus != EConnMonCacheInitCompleted )
+        {
+        // This is Init pass. CommsDat has been read and stored in cache. return now.
+        // Note, currentIapData not in cleanup stack
+
+        // If no WLAN, this will just be an empty array
+        DeepCopy( currentWlanIapIds, iWlanIapIdCache );
+        CleanupStack::Pop( &currentWlanIapIds );
+        currentWlanIapIds.Close();
+
+        iIapsChanged = ETrue;
+        LOGEXITFN1("CConnMonCommsDatCache::RefreshCommsDatIapCache()", iIapsChanged)
+        return iIapsChanged;
+        }
+
+    CleanupStack::Pop( currentIapData );
+    iIapsChanged = EFalse;
+
+    // WLAN IAPs are most likely to change. Check those first for changes.
+    if ( iWlanSupportEnabled )
+        {
+        iIapsChanged = CompareSortedArrays( currentWlanIapIds, iWlanIapIdCache );
+        if ( iIapsChanged )
+            {
+            if ( iIap )
+                {
+                iIap->EnableWlanScan(); // Important
+                }
+            DeepCopy( currentWlanIapIds, iWlanIapIdCache );
+            }
+        }
+    CleanupStack::Pop( &currentWlanIapIds );
+    currentWlanIapIds.Close();
+
+    // If WLAN IAPs didn't change, check the rest of the IAPs for changes.
+    if ( !iIapsChanged )
+        {
+        iIapsChanged = CompareSortedArrays( *currentIapData, *iIapCache );
+        }
+
+    // Delete the obsolete IAP cache table. Either the new table that was just
+    // read, or the old table if the new one is different.
+    if ( iIapsChanged )
+        {
+        iIapCache->Close();
+        delete iIapCache;
+        iIapCache = currentIapData;
+        LOGIT("RefreshCommsDatIapCacheL: updated IAP cache")
+        }
+    else
+        {
+        currentIapData->Close();
+        delete currentIapData;
+        currentIapData = NULL;
+        LOGIT("RefreshCommsDatIapCacheL: IAP cache did not change")
+        }
+
+    LOGEXITFN1("CConnMonCommsDatCache::RefreshCommsDatIapCacheL()", iIapsChanged)
+    return iIapsChanged;
+    }
+
+// ---------------------------------------------------------------------------
+// Reads all IAP table information from CommsDat into an array.
+// ---------------------------------------------------------------------------
+//
+void CConnMonCommsDatCache::ReadCommsDatIapTableL(
+        CMDBSession& aDb,
+        RArray<TConnMonIapEntry>& aCurrentIapData,
+        RArray<TUint>& aCurrentWlanIapIds )
+    {
+    LOGENTRFN("CConnMonCommsDatCache::ReadCommsDatIapTableL()")
+
+    // Explicitly build a TLinearOrder<class>. Used as parameter to RArray::InsertInOrder().
+    TLinearOrder<TConnMonIapEntry> iapEntryOrderingLogic( TConnMonIapEntry::Compare );
+
+    CMDBRecordSet<CCDIAPRecord>* ptrIapRecordSet = new( ELeave )
+            CMDBRecordSet<CCDIAPRecord>( iIapRecordTableId );
+    CleanupStack::PushL( ptrIapRecordSet );
+    ptrIapRecordSet->LoadL( aDb );
+
+    // Check LAN bearer table for WLAN bearer entries and store results in array.
+    // This information is used to separate LAN and WLAN IAPs from each other.
+    RArray<TLanBearerEntry> lanBearerTableCache;
+    CleanupClosePushL( lanBearerTableCache );
+    TRAPD( leaveCode, ReadCommsDatLanBearerTableL( aDb, lanBearerTableCache ) );
+    if ( leaveCode )
+        {
+        LOGIT1("ERROR reading LAN bearer table, LEAVE with <%d>", leaveCode)
+        lanBearerTableCache.Reset();
+        }
+
+    iVirtualIapCount = 0;
+    TInt iapRecordCount( ptrIapRecordSet->iRecords.Count() );
+    LOGIT1("ReadCommsDatIapTableL: IAP record count %d (commsdat)", iapRecordCount)
+
+    TUint iapId( 0 );
+    TUint bearerType( 0 );
+    TUint serviceType( 0 );
+
+    for ( TInt i = 0; i < iapRecordCount; i++ )
+        {
+        TRAP( leaveCode, ReadCommsDatIapEntryL(
+                (CCDIAPRecord*)ptrIapRecordSet->iRecords[i],
+                lanBearerTableCache,
+                bearerType,
+                serviceType ) );
+
+        if ( leaveCode )
+            {
+            // Skip this IAP and continue with next one
+            LOGIT1("ERROR reading IAP entry, LEAVE with <%d>", leaveCode)
+            break;
+            }
+
+        iapId = ptrIapRecordSet->iRecords[i]->RecordId();
+
+        if ( serviceType == EConnMonCacheServiceTypeWlan && iWlanSupportEnabled )
+            {
+            // Add WLAN IAP ID to WLAN IAP cache
+            TInt err = aCurrentWlanIapIds.InsertInOrder( iapId );
+            if ( err )
+                {
+                LOGIT1("ERROR inserting WLAN IAP ID to WLAN cache <%d>", err)
+                serviceType = 0;
+                }
+            }
+
+        // Unknown IAP or error while reading it
+        if ( !serviceType && !bearerType )
+            {
+            LOGIT1("WARNING, unknown IAP in CommsDat IAP table with id %d", iapId)
+            iapId = 0; // ID to zero so this IAP will be ignored
+            }
+
+        if ( iapId )
+            {
+            // Adding IAP to cache
+            TConnMonIapEntry iapEntry( iapId, bearerType, serviceType );
+
+            TInt err = aCurrentIapData.InsertInOrder( iapEntry , iapEntryOrderingLogic );
+            if ( err )
+                {
+                LOGIT1("ERROR inserting IAP to current IAP data <%d>", err)
+                }
+            }
+        }
+
+    CleanupStack::Pop( &lanBearerTableCache );
+    lanBearerTableCache.Close();
+    CleanupStack::PopAndDestroy( ptrIapRecordSet );
+    LOGIT1("ReadCommsDatIapTableL: IAP record count %d (cache)", aCurrentIapData.Count())
+
+    LOGEXITFN("CConnMonCommsDatCache::ReadCommsDatIapTableL()")
+    }
+
+// ---------------------------------------------------------------------------
+// Reads one record from IAP table and finds out the service and bearer types.
+// ---------------------------------------------------------------------------
+//
+void CConnMonCommsDatCache::ReadCommsDatIapEntryL(
+        CCDIAPRecord* aIapEntry,
+        RArray<TLanBearerEntry>& aLanBearerTableCache,
+        TUint& aBearerType,
+        TUint& aServiceType )
+    {
+    //LOGENTRFN("CConnMonCommsDatCache::ReadCommsDatIapEntryL()")
+
+    aBearerType = 0;
+    aServiceType = 0;
+    TBuf<KMaxTextLength> bearerTypeName( aIapEntry->iBearerType.GetL() );
+    TBuf<KMaxTextLength> serviceTypeName( aIapEntry->iServiceType.GetL() );
+
+    if ( serviceTypeName == TPtrC( KCDTypeNameOutgoingWCDMA ) ||
+            serviceTypeName == TPtrC( KCDTypeNameIncomingWCDMA ) )
+        {
+        aServiceType = EConnMonCacheServiceTypeGprs; // GPRS IAP
+        }
+    else if ( serviceTypeName == TPtrC( KCDTypeNameLANService ) )
+        {
+        // LAN or WLAN IAP
+        TUint32 bearerId( aIapEntry->iBearer );
+        if ( bearerTypeName == TPtrC( KCDTypeNameLANBearer ) &&
+                HasWlanBearer( bearerId, aLanBearerTableCache ) )
+            {
+            aServiceType = EConnMonCacheServiceTypeWlan; // WLAN IAP
+            }
+        else
+            {
+            aServiceType = EConnMonCacheServiceTypeLan; // LAN IAP
+            }
+        }
+    else if ( ( serviceTypeName == TPtrC( KCDTypeNameDialOutISP ) ) ||
+            ( serviceTypeName == TPtrC( KCDTypeNameDialInISP ) ) )
+        {
+        aServiceType = EConnMonCacheServiceTypeCsd; // CSD IAP
+        }
+
+    if ( bearerTypeName == TPtrC( KCDTypeNameVirtualBearer ) )
+        {
+        iVirtualIapCount++;
+        aBearerType = EConnMonCacheBearerTypeVirtual; // Virtual IAP
+        }
+
+    //LOGEXITFN("CConnMonCommsDatCache::ReadCommsDatIapEntryL()")
+    }
+
+// ---------------------------------------------------------------------------
+// Reads all records from the LAN bearer table and checks if they are WLAN
+// bearer type. Results are stored in an array.
+// ---------------------------------------------------------------------------
+//
+void CConnMonCommsDatCache::ReadCommsDatLanBearerTableL(
+        CMDBSession& aDb,
+        RArray<TLanBearerEntry>& aLanBearerTableCache )
+    {
+    LOGENTRFN("CConnMonCommsDatCache::ReadCommsDatLanBearerTableL()")
+
+    CMDBRecordSet<CCDLANBearerRecord>* ptrLanBearerRecordSet = new( ELeave )
+            CMDBRecordSet<CCDLANBearerRecord>( KCDTIdLANBearerRecord );
+    CleanupStack::PushL( ptrLanBearerRecordSet );
+    ptrLanBearerRecordSet->LoadL( aDb );
+
+    TInt lanBearerRecordCount( ptrLanBearerRecordSet->iRecords.Count() );
+    for ( TInt i = 0; i < lanBearerRecordCount; i++ )
+        {
+        TLanBearerEntry lanBearerEntry;
+        lanBearerEntry.iId = ptrLanBearerRecordSet->iRecords[i]->RecordId();
+
+        TBuf<KMaxTextLength> bearerRecordName(
+                ( (CCDLANBearerRecord*)ptrLanBearerRecordSet->iRecords[i] )->iRecordName.GetL() );
+
+        if ( bearerRecordName == TPtrC( KWlanBearerRecordName ) )
+            {
+            lanBearerEntry.iWlanBearer = ETrue;
+            }
+        else
+            {
+            lanBearerEntry.iWlanBearer = EFalse;
+            }
+        aLanBearerTableCache.Append( lanBearerEntry );
+        }
+    CleanupStack::PopAndDestroy( ptrLanBearerRecordSet );
+    LOGIT2("LAN bearer record count %d/%d", aLanBearerTableCache.Count(), lanBearerRecordCount)
+
+    LOGEXITFN("CConnMonCommsDatCache::ReadCommsDatLanBearerTableL()")
+    }
+
+// ---------------------------------------------------------------------------
+// Reads all SNAP information from CommsDat and updates the cache if necessary.
+// ---------------------------------------------------------------------------
+//
+TBool CConnMonCommsDatCache::RefreshCommsDatSnapCacheL( CMDBSession& aDb )
+    {
+    LOGENTRFN("CConnMonCommsDatCache::RefreshCommsDatSnapCacheL()")
+
+    RArray<TConnMonSnapEntry>* currentSnapData;
+    if ( iInitStatus == EConnMonCacheInitCompleted )
+        {
+        // Array to read current CommsDat info into.
+        currentSnapData = new( ELeave ) RArray<TConnMonSnapEntry>; // Heap used by design
+        CleanupClosePushL( *currentSnapData );
+        }
+    else
+        {
+        // Init phase. Read CommsDat and store to cache. Then stop. (no events)
+        currentSnapData = iSnapCache; // Cache is still empty at init-phase.
+        }
+    currentSnapData->Reset();
+
+    ReadCommsDatSnapTableL( aDb, *currentSnapData );
+
+    if ( iInitStatus != EConnMonCacheInitCompleted )
+        {
+        // This is Init pass. CommsDat SNAPs have been read and stored in cache. return now.
+        // Note, currentSnapData not in cleanup stack
+        iSnapsChanged = ETrue;
+        LOGEXITFN1("CConnMonCommsDatCache::RefreshCommsDatSnapCache()", iSnapsChanged)
+        return iSnapsChanged;
+        }
+
+    CleanupStack::Pop( currentSnapData );
+    iSnapsChanged = CompareSortedArrays( *currentSnapData, *iSnapCache );
+
+    // Delete the obsolete SNAP cache table. Either the new table that was just
+    // read, or the old table if the new one is different.
+    if ( iSnapsChanged )
+        {
+        iSnapCache->Close();
+        delete iSnapCache;
+        iSnapCache = currentSnapData;
+        LOGIT("RefreshCommsDatSnapCacheL: updated SNAP cache")
+        }
+    else
+        {
+        currentSnapData->Close();
+        delete currentSnapData;
+        currentSnapData = NULL;
+        }
+
+    LOGEXITFN1("CConnMonCommsDatCache::RefreshCommsDatSnapCacheL()", iSnapsChanged)
+    return iSnapsChanged;
+    }
+
+// ---------------------------------------------------------------------------
+// Reads all SNAP information from CommsDat to an array.
+// ---------------------------------------------------------------------------
+//
+void CConnMonCommsDatCache::ReadCommsDatSnapTableL(
+        CommsDat::CMDBSession& aDb,
+        RArray<TConnMonSnapEntry>& aCurrentSnapData )
+    {
+    LOGENTRFN("CConnMonCommsDatCache::ReadCommsDatSnapTableL()")
+    // Explicitly build a TLinearOrder<class>. Used as parameter to RArray::InsertInOrder().
+    TLinearOrder<TConnMonSnapEntry> snapEntryOrderingLogic( TConnMonSnapEntry::Compare );
+
+    CMDBRecordSet<CCDDataMobilitySelectionPolicyRecord>* ptrSnapRecordSet = new( ELeave )
+            CMDBRecordSet<CCDDataMobilitySelectionPolicyRecord>( iSnapRecordTableId );
+    CleanupStack::PushL( ptrSnapRecordSet );
+
+    CCDDataMobilitySelectionPolicyRecord* ptrSnapRecord = new( ELeave )
+            CCDDataMobilitySelectionPolicyRecord( iSnapRecordTableId );
+    CleanupStack::PushL( ptrSnapRecord );
+
+    ptrSnapRecordSet->LoadL( aDb );
+    TInt snapRecordCount( ptrSnapRecordSet->iRecords.Count() );
+    LOGIT1("ReadCommsDatSnapTableL: SNAP record count %d (commsdat)", snapRecordCount)
+
+    TUint snapId( 0 );
+    TUint includedIapId( 0 );
+    TUint embeddedSnapId( 0 );
+    TInt tempSnapId( 0 );
+    TInt tempEmbeddedSnapId( 0 );
+
+    for ( TInt i = 0; i < snapRecordCount; i++ )
+        {
+        ptrSnapRecord->SetElementId( ptrSnapRecordSet->iRecords[i]->ElementId() );
+        ptrSnapRecord->LoadL( aDb );
+
+        // SNAP ID records in CCDDataMobilitySelectionPolicyRecord-table were changed
+        // from record links to TInt type, as part of new CommsInfra changes.
+        tempSnapId = ptrSnapRecord->iSNAP;
+        if ( tempSnapId < 0 )
+            {
+            tempSnapId = 0;
+            }
+        snapId = (TUint) tempSnapId;
+
+        includedIapId = ( ptrSnapRecord->iIAP & KCDMaskShowRecordId ) >> KBitsInByte;
+
+        tempEmbeddedSnapId = ptrSnapRecord->iEmbeddedSNAP;
+        if ( tempEmbeddedSnapId < 0 )
+            {
+            tempEmbeddedSnapId = 0;
+            }
+        embeddedSnapId = (TUint) tempEmbeddedSnapId;
+
+        // Empty SNAPs are not included in cache
+        if ( includedIapId || embeddedSnapId )
+            {
+            TConnMonSnapEntry snapEntry( snapId, includedIapId, embeddedSnapId );
+            TInt err = aCurrentSnapData.InsertInOrder( snapEntry , snapEntryOrderingLogic );
+            if ( err )
+                {
+                LOGIT1("ERROR inserting SNAP record to current SNAP data <%d>", err)
+                }
+            }
+        }
+    CleanupStack::PopAndDestroy( ptrSnapRecord );
+    CleanupStack::PopAndDestroy( ptrSnapRecordSet );
+    LOGIT1("ReadCommsDatSnapTableL: SNAP record count %d (cache)", aCurrentSnapData.Count())
+    LOGEXITFN("CConnMonCommsDatCache::ReadCommsDatSnapTableL()")
+    }
+
+// ---------------------------------------------------------------------------
+// Reads all virtual IAP link information from CommsDat and updates the cache
+// if necessary. CommsDat is not read if IAP table did not contain any virtual
+// IAPs. Returns ETrue if cache information was changed, EFalse otherwise.
+// ---------------------------------------------------------------------------
+//
+TBool CConnMonCommsDatCache::RefreshCommsDatVirtualIapCacheL( CMDBSession& aDb )
+    {
+    LOGENTRFN("CConnMonCommsDatCache::RefreshCommsDatVirtualIapCacheL()")
+
+    RArray<TConnMonVirtualIapEntry>* currentVirtualIapData;
+    if ( iInitStatus == EConnMonCacheInitCompleted )
+        {
+        // Array to read current CommsDat info into.
+        currentVirtualIapData = new( ELeave ) RArray<TConnMonVirtualIapEntry>; // Heap used by design
+        CleanupClosePushL( *currentVirtualIapData );
+        }
+    else
+        {
+        // Init-phase, read current CommsDat info directly into cache array,
+        // since it is still empty. Then stop (don't send any events.)
+        currentVirtualIapData = iVirtualIapCache;
+        }
+    currentVirtualIapData->Reset();
+
+    // If there is no virtual IAPs, there is no need to read virtual IAP link
+    // information, and virtual IAP cache will be left empty.
+    if ( iVirtualIapCount )
+        {
+        TRAPD( leaveCode, ReadCommsDatVirtualIapTableL( aDb, *currentVirtualIapData ) );
+        if ( leaveCode )
+            {
+            LOGIT1("ERROR reading virtual IAP table, LEAVE with <%d>", leaveCode)
+            }
+        }
+    else
+        {
+        LOGIT("RefreshCommsDatVirtualIapCacheL: no virtual IAPs, skipping")
+        }
+
+    if ( iInitStatus != EConnMonCacheInitCompleted )
+        {
+        // This is Init pass. CommsDat has been read and stored in cache. return now.
+        // Note, currentVirtualIapData not in cleanup stack
+        iVirtualIapsChanged = ETrue;
+        LOGEXITFN1("CConnMonCommsDatCache::RefreshCommsDatVirtualIapCacheL()", iVirtualIapsChanged)
+        return iVirtualIapsChanged;
+        }
+
+    CleanupStack::Pop( currentVirtualIapData );
+    iVirtualIapsChanged = CompareSortedArrays( *currentVirtualIapData, *iVirtualIapCache );
+
+    // Delete the obsolete virtual IAP cache table. Either the new table that
+    // was just read, or the old table if the new one is different.
+    if ( iVirtualIapsChanged )
+        {
+        iVirtualIapCache->Close();
+        delete iVirtualIapCache;
+        iVirtualIapCache = currentVirtualIapData;
+        LOGIT("RefreshCommsDatVirtualIapCacheL: updated virtual IAP cache")
+        }
+    else
+        {
+        currentVirtualIapData->Close();
+        delete currentVirtualIapData;
+        currentVirtualIapData = NULL;
+        }
+
+    LOGEXITFN1("CConnMonCommsDatCache::RefreshCommsDatVirtualIapCacheL()", iVirtualIapsChanged)
+    return iVirtualIapsChanged;
+    }
+
+// ---------------------------------------------------------------------------
+// Reads all virtual IAP link information from CommsDat to an array.
+// ---------------------------------------------------------------------------
+//
+void CConnMonCommsDatCache::ReadCommsDatVirtualIapTableL(
+        CommsDat::CMDBSession& aDb,
+        RArray<TConnMonVirtualIapEntry>& aCurrentVirtualIapData )
+    {
+    LOGENTRFN("CConnMonCommsDatCache::ReadCommsDatVirtualIapTableL()")
+
+    // Explicitly build a TLinearOrder<class>. Used as parameter to RArray::InsertInOrder().
+    TLinearOrder<TConnMonVirtualIapEntry> virtualEntryOrderingLogic(
+            TConnMonVirtualIapEntry::Compare );
+
+    CMDBRecordSet<CCDVirtualIAPNextLayerRecord>* ptrVirtualRecordSet = new( ELeave )
+            CMDBRecordSet<CCDVirtualIAPNextLayerRecord>( iVirtualRecordTableId );
+    CleanupStack::PushL( ptrVirtualRecordSet );
+
+    CCDVirtualIAPNextLayerRecord* ptrVirtualRecord = new( ELeave )
+            CCDVirtualIAPNextLayerRecord( iVirtualRecordTableId );
+    CleanupStack::PushL( ptrVirtualRecord );
+
+    // Load and loop through the records.
+    ptrVirtualRecordSet->LoadL( aDb );
+    TInt virtualRecordCount( ptrVirtualRecordSet->iRecords.Count() );
+    LOGIT1("ReadCommsDatVirtualIapTableL: virtual record count %d (commsdat)", virtualRecordCount)
+
+    TUint iapId( 0 );
+    TUint nextLayerSnap( 0 );
+    TUint nextLayerIap( 0 );
+
+    for ( TInt i = 0; i < virtualRecordCount; i++ )
+        {
+        ptrVirtualRecord->SetElementId( ptrVirtualRecordSet->iRecords[i]->ElementId() );
+        ptrVirtualRecord->LoadL( aDb );
+
+        iapId = ptrVirtualRecord->iIAP;
+        nextLayerSnap = ptrVirtualRecord->iNextLayerSNAP;
+        nextLayerIap = ptrVirtualRecord->iNextLayerIAP;
+
+        // Either iNextLayerSNAP or iNextLayerIAP must be NULL. Only 1 link.
+        if ( iapId && ( ( nextLayerSnap && !nextLayerIap ) ||
+                ( nextLayerIap && !nextLayerSnap ) ) )
+            {
+            TConnMonVirtualIapEntry virtualEntry( iapId, nextLayerIap, nextLayerSnap );
+            TInt err = aCurrentVirtualIapData.InsertInOrder(
+                    virtualEntry,
+                    virtualEntryOrderingLogic );
+            if ( err )
+                {
+                LOGIT1("ERROR inserting virtual IAP link record to cache <%d>", err)
+                }
+            }
+        else
+            {
+            LOGIT2("WARNING, invalid virtual record, iap: %d, snap: %d", nextLayerIap, nextLayerSnap )
+            }
+        }
+    CleanupStack::PopAndDestroy( ptrVirtualRecord );
+    CleanupStack::PopAndDestroy( ptrVirtualRecordSet );
+
+    LOGIT1("ReadCommsDatVirtualIapTableL: virtual record count %d (cache)", aCurrentVirtualIapData.Count())
+    LOGEXITFN("CConnMonCommsDatCache::ReadCommsDatVirtualIapTableL()")
+    }
+
+// ---------------------------------------------------------------------------
+// Compares two sorted RArray<TUint> arrays. Returns ETrue if the arrays are
+// not identical.
+// ---------------------------------------------------------------------------
+//
+TBool CConnMonCommsDatCache::CompareSortedArrays(
+        const RArray<TUint>& aFirstArray,
+        const RArray<TUint>& aSecondArray )
+    {
+    //LOGENTRFN("CConnMonCommsDatCache::CompareSortedArrays()")
+    TBool arraysDiffer( EFalse );
+
+    const TInt firstCount = aFirstArray.Count();
+    if ( firstCount != aSecondArray.Count() )
+        {
+        arraysDiffer = ETrue;
+        }
+    else
+        {
+        for ( TInt i = 0; i < firstCount; i++ )
+            {
+            if ( aFirstArray[i] != aSecondArray[i] )
+                {
+                arraysDiffer = ETrue;
+                break; // No need to continue
+                }
+            }
+        }
+
+    //LOGEXITFN1("CConnMonCommsDatCache::CompareSortedArrays()", arraysDiffer)
+    return arraysDiffer;
+    }
+
+// ---------------------------------------------------------------------------
+// Compares two sorted RArray<TConnMonIapEntry> arrays. Returns ETrue if the
+// arrays are not identical.
+// ---------------------------------------------------------------------------
+//
+TBool CConnMonCommsDatCache::CompareSortedArrays(
+        const RArray<TConnMonIapEntry>& aFirstArray,
+        const RArray<TConnMonIapEntry>& aSecondArray )
+    {
+    //LOGENTRFN("CConnMonCommsDatCache::CompareSortedArrays()")
+    TBool arraysDiffer( EFalse );
+
+    const TInt firstCount = aFirstArray.Count();
+    if ( firstCount != aSecondArray.Count() )
+        {
+        arraysDiffer = ETrue;
+        }
+    else
+        {
+        for ( TInt i = 0; i < firstCount; i++ )
+            {
+            if ( !TConnMonIapEntry::Match( aFirstArray[i], aSecondArray[i] ) )
+                {
+                arraysDiffer = ETrue;
+                break; // No need to continue
+                }
+            }
+        }
+
+    //LOGEXITFN1("CConnMonCommsDatCache::CompareSortedArrays()", arraysDiffer)
+    return arraysDiffer;
+    }
+
+// ---------------------------------------------------------------------------
+// Compares two sorted RArray<TConnMonSnapEntry> arrays. Returns ETrue if the
+// arrays are not identical.
+// ---------------------------------------------------------------------------
+//
+TBool CConnMonCommsDatCache::CompareSortedArrays(
+        const RArray<TConnMonSnapEntry>& aFirstArray,
+        const RArray<TConnMonSnapEntry>& aSecondArray )
+    {
+    //LOGENTRFN("CConnMonCommsDatCache::CompareSortedArrays()")
+    TBool arraysDiffer( EFalse );
+
+    const TInt firstCount = aFirstArray.Count();
+    if ( firstCount != aSecondArray.Count() )
+        {
+        arraysDiffer = ETrue;
+        }
+    else
+        {
+        for ( TInt i = 0; i < firstCount; i++ )
+            {
+            if ( !TConnMonSnapEntry::Match( aFirstArray[i], aSecondArray[i] ) )
+                {
+                arraysDiffer = ETrue;
+                break; // No need to continue
+                }
+            }
+        }
+
+    //LOGEXITFN1("CConnMonCommsDatCache::CompareSortedArrays()", arraysDiffer)
+    return arraysDiffer;
+    }
+
+// ---------------------------------------------------------------------------
+// Compares two sorted RArray<TConnMonVirtualIapEntry> arrays. Returns ETrue
+// if the arrays are not identical.
+// ---------------------------------------------------------------------------
+//
+TBool CConnMonCommsDatCache::CompareSortedArrays(
+        const RArray<TConnMonVirtualIapEntry>& aFirstArray,
+        const RArray<TConnMonVirtualIapEntry>& aSecondArray )
+    {
+    //LOGENTRFN("CConnMonCommsDatCache::CompareSortedArrays()")
+    TBool arraysDiffer( EFalse );
+
+    const TInt firstCount = aFirstArray.Count();
+    if ( firstCount != aSecondArray.Count() )
+        {
+        arraysDiffer = ETrue;
+        }
+    else
+        {
+        for ( TInt i = 0; i < firstCount; i++ )
+            {
+            if ( !TConnMonVirtualIapEntry::Match( aFirstArray[i], aSecondArray[i] ) )
+                {
+                arraysDiffer = ETrue;
+                break; // No need to continue
+                }
+            }
+        }
+
+    //LOGEXITFN1("CConnMonCommsDatCache::CompareSortedArrays()", arraysDiffer)
+    return arraysDiffer;
+    }
+
+// ---------------------------------------------------------------------------
+// Copy new data into a RArray<TUint> array.
+// ---------------------------------------------------------------------------
+//
+void CConnMonCommsDatCache::DeepCopy(
+        const RArray<TUint>& aSourceArray,
+        RArray<TUint>& aTargetArray )
+    {
+    //LOGENTRFN("CConnMonCommsDatCache::DeepCopy()")
+
+    const TInt count = aSourceArray.Count();
+    aTargetArray.Reset();
+    TInt err = aTargetArray.Reserve( count );
+    if ( KErrNone == err )
+        {
+        for ( TInt i = 0; i < count; i++ )
+            {
+            aTargetArray.Append( aSourceArray[i] );
+            }
+        }
+
+    //LOGEXITFN("CConnMonCommsDatCache::DeepCopy()")
+    }
+
+// ---------------------------------------------------------------------------
+// Updates the index links for SNAPs and virtual IAPs.
+// ---------------------------------------------------------------------------
+//
+void CConnMonCommsDatCache::UpdateSnapAndVirtualIapLinks()
+    {
+    LOGENTRFN("CConnMonCommsDatCache::UpdateSnapAndVirtualIapLinks()")
+
+    TInt count = iSnapCache->Count();
+    for ( TInt i = 0; i < count; i++ )
+        {
+        TConnMonSnapEntry* pSnap = &(*iSnapCache)[i];
+        if ( pSnap->iNextLayerIapId )
+            {
+            pSnap->iNextLayerIndex = FindIapIndex( pSnap->iNextLayerIapId );
+            }
+        else if ( pSnap->iNextLayerSnapId )
+            {
+            pSnap->iNextLayerIndex = FindSnapIndex( pSnap->iNextLayerSnapId );
+            }
+        }
+
+    count = iIapCache->Count();
+    for ( TInt i = 0; i < count; i++ )
+        {
+        TConnMonIapEntry* pIap = &(*iIapCache)[i];
+        // Only virtual IAPs can have links
+        if ( pIap->iBearerType == EConnMonCacheBearerTypeVirtual )
+            {
+            TInt index = iVirtualIapCache->FindInOrder<TInt>(
+                    pIap->iId,
+                    TConnMonVirtualIapEntry::FindCompare );
+
+            if ( index < 0)
+                {
+                pIap->iNextLayerIapId = 0;
+                pIap->iNextLayerSnapId = 0;
+                pIap->iNextLayerIndex = KErrNotFound;
+                }
+            else
+                {
+                pIap->iNextLayerIapId = (*iVirtualIapCache)[index].iNextLayerIapId;
+                pIap->iNextLayerSnapId = (*iVirtualIapCache)[index].iNextLayerSnapId;
+
+                // Either iNextLayerIapId or iNextLayerSnapId is 0. (already checked)
+                // Link to SNAP is more likely than link to IAP
+                if ( pIap->iNextLayerSnapId )
+                    {
+                    // Returns KErrNotFound if not found
+                    pIap->iNextLayerIndex = FindSnapIndex( pIap->iNextLayerSnapId );
+                    }
+                else if ( pIap->iNextLayerIapId )
+                    {
+                    // Returns KErrNotFound if not found
+                    pIap->iNextLayerIndex = FindIapIndex( pIap->iNextLayerIapId );
+                    }
+                }
+            }
+        }
+
+    LOGEXITFN("CConnMonCommsDatCache::UpdateSnapAndVirtualIapLinks()")
+    }
+
+// ---------------------------------------------------------------------------
+// Resets the availability status for all SNAPs and IAPs. SNAPs and virtual
+// IAPs are set to unknown, because their availability depends on real IAPs
+// and needs to be solved using recursive algorithms. Real IAPs are set to
+// unavailable. The next step should be to find the real IAPs that are
+// available.
+// ---------------------------------------------------------------------------
+//
+void CConnMonCommsDatCache::ResetAllAvailabilityInfo()
+    {
+    //LOGENTRFN("CConnMonCommsDatCache::ResetAllAvailabilityInfo()")
+
+    TInt count = iIapCache->Count();
+    for ( TInt i = 0; i < count; i++ )
+        {
+        if ( (*iIapCache)[i].iBearerType == EConnMonCacheBearerTypeVirtual )
+            {
+            (*iIapCache)[i].iAvailability = EConnMonAvailabilityUnknown;
+            }
+        else
+            {
+            (*iIapCache)[i].iAvailability = EConnMonAvailabilityUnavailable;
+            }
+        }
+
+    count = iSnapCache->Count();
+    for ( TInt i = 0; i < count; i++ )
+        {
+        (*iSnapCache)[i].iAvailability = EConnMonAvailabilityUnknown;
+        }
+
+    //LOGEXITFN("CConnMonCommsDatCache::ResetAllAvailabilityInfo()")
+    }
+
+// ---------------------------------------------------------------------------
+// Solve SNAP and virtual IAP availability. The results depend on real IAP
+// availability, so those need to be set when this method is called.
+// ---------------------------------------------------------------------------
+//
+void CConnMonCommsDatCache::SolveSnapAndVirtualIapAvailability()
+    {
+    LOGENTRFN("CConnMonCommsDatCache::SolveSnapAndVirtualIapAvailability()")
+
+    TInt count = iSnapCache->Count();
+    for ( TInt i = 0; i < count; i++ )
+        {
+        // Check SNAP availability recursively at index i
+        CheckSnapAvailability( i );
+        }
+
+    count = iIapCache->Count();
+    for ( TInt i = 0; i < count; i++ )
+        {
+        if ( (*iIapCache)[i].iBearerType == EConnMonCacheBearerTypeVirtual )
+            {
+            // Check IAP availability recursively at index i
+            CheckIapAvailability( i );
+            }
+        }
+
+    LOGEXITFN("CConnMonCommsDatCache::SolveSnapAndVirtualIapAvailability()")
+    }
+
+// ---------------------------------------------------------------------------
+// Create a EConnMonIapAvailabilityChange event and add it to the event
+// queue to be sent to clients.
+// ---------------------------------------------------------------------------
+//
+TInt CConnMonCommsDatCache::SendIapAvailabilityEvent()
+    {
+    LOGENTRFN("CConnMonCommsDatCache::SendIapAvailabilityEvent()")
+    TInt err( KErrNone );
+
+    TInt iapCount = iIapIdCache.Count();
+    if ( iapCount > KConnMonMaxIAPCount )
+        {
+        // If too many IAPs available, clip the extras away from event.
+        LOGIT1("WARNING, too many IAPs (%d), all did not fit into event", iapCount)
+        iapCount = KConnMonMaxIAPCount;
+        }
+
+    TEventInfo info;
+    info.Reset();
+    info.iEventType = EConnMonIapAvailabilityChange;
+    info.iConnectionId = EBearerIdAll;
+    info.iData = iapCount;
+
+    // Create event data area. Leave left out intentionally, check for NULL instead
+    TConnMonIapInfo* eventIaps = new TConnMonIapInfo; // No (ELeave)
+    if ( !eventIaps )
+        {
+        err = KErrNoMemory;
+        }
+    else
+        {
+        eventIaps->iCount = iapCount;
+        TInt i = 0;
+        for ( ; i < iapCount; i++ )
+            {
+            eventIaps->iIap[i].iIapId = iIapIdCache[i];
+            }
+        for ( ; i < KConnMonMaxIAPCount; i++ )
+            {
+            eventIaps->iIap[i].iIapId = 0;
+            }
+
+        // EventQueue will finally destroy the memory area pointed by eventIaps.
+        // However, if all the clients can't receive the event right away the
+        // event queue will keep it until the last client has received it.
+        iServer->EventQueue()->Add(
+                info,
+                reinterpret_cast<const TUint8*>( eventIaps ),
+                sizeof( TConnMonIapInfo ) );
+        }
+
+    LOGEXITFN1("CConnMonCommsDatCache::SendIapAvailabilityEvent()", err)
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// Create a EConnMonSNAPsAvailabilityChange event and add it to the event
+// queue to be sent to clients.
+// ---------------------------------------------------------------------------
+//
+TInt CConnMonCommsDatCache::SendSnapAvailabilityEvent()
+    {
+    LOGENTRFN("CConnMonCommsDatCache::SendSnapAvailabilityEvent()")
+    TInt err( KErrNone );
+
+    TInt snapCount = iSnapIdCache.Count();
+
+    TEventInfo info;
+    info.Reset();
+    info.iEventType = EConnMonSNAPsAvailabilityChange;
+    info.iConnectionId = EBearerIdAll;
+    info.iData = snapCount; // Total amount of available SNAPs
+
+    if ( snapCount > KConnMonMaxSNAPsCount )
+        {
+        // If too many SNAPs available, clip the extras away from event.
+        LOGIT1("WARNING, too many SNAPs (%d), all did not fit into event", snapCount)
+        snapCount = KConnMonMaxSNAPsCount;
+        }
+
+    // Create event data area. Leave left out intentionally, check for NULL instead
+    TConnMonSNAPInfo* eventSnaps = new TConnMonSNAPInfo; // No (ELeave)
+    if ( !eventSnaps )
+        {
+        err = KErrNoMemory;
+        }
+    else
+        {
+        eventSnaps->iCount = snapCount;
+        TInt i = 0;
+        for ( ; i < snapCount; i++ )
+            {
+            eventSnaps->iSNAP[i].iSNAPId = iSnapIdCache[i];
+            }
+        for ( ; i < KConnMonMaxSNAPsCount; i++ )
+            {
+            eventSnaps->iSNAP[i].iSNAPId = 0;
+            }
+
+        // EventQueue will finally destroy the memory area pointed by eventSnaps.
+        // However, if all the clients can't receive the event right away the
+        // event queue will keep it until the last client has received it.
+        iServer->EventQueue()->Add(
+                info,
+                reinterpret_cast<const TUint8*>( eventSnaps ),
+                sizeof( TConnMonSNAPInfo ) );
+        }
+
+    LOGEXITFN1("CConnMonCommsDatCache::SendSnapAvailabilityEvent()", err)
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// Finds the index in cache for IAP with id aId. Returns KErrNotFound (-1) if
+// no match is found.
+// ---------------------------------------------------------------------------
+//
+TInt CConnMonCommsDatCache::FindIapIndex( const TUint aId )
+    {
+    TInt index = iIapCache->FindInOrder<TInt>( aId, TConnMonIapEntry::FindCompare );
+    return index;
+    }
+
+// ---------------------------------------------------------------------------
+// Finds the first index in cache for SNAP with ID aId. Returns KErrNotFound
+// (-1) if no match is found.
+// The SNAP cache is sorted by ID, so the first index is found by traversing
+// decrementally from the initial index returned by RArray's FindInOrder.
+// ---------------------------------------------------------------------------
+//
+TInt CConnMonCommsDatCache::FindSnapIndex( const TUint aId )
+    {
+    TInt index  = iSnapCache->FindInOrder<TInt>( aId, TConnMonSnapEntry::FindCompare );
+    for ( ; index > 0; index-- )
+        {
+        if ( (*iSnapCache)[index-1].iId != aId )
+            {
+            return index;
+            }
+        }
+    return index;
+    }
+
+// ---------------------------------------------------------------------------
+// Takes a SNAP cache index and reads the ID from that entry. Then adjusts the
+// availability for each cache entry related to that ID.
+// ---------------------------------------------------------------------------
+//
+void CConnMonCommsDatCache::SetSnapAvailabilityAtIndex( TUint aIndex, TInt aAvailability )
+    {
+    //LOGENTRFN("CConnMonCommsDatCache::SetSnapAvailabilityAtIndex()")
+
+    TUint id = (*iSnapCache)[aIndex].iId;
+    (*iSnapCache)[aIndex].iAvailability = aAvailability;
+
+    TInt count = iSnapCache->Count();
+    for ( TInt i = aIndex+1; i < count; i++ )
+        {
+        if ( (*iSnapCache)[i].iId != id )
+            {
+            return;
+            }
+        (*iSnapCache)[i].iAvailability = aAvailability;
+        }
+
+    //LOGEXITFN("CConnMonCommsDatCache::SetSnapAvailabilityAtIndex()")
+    }
+
+// ---------------------------------------------------------------------------
+// Check IAP availability by index. In case of virtual IAP, keeps checking
+// recursively until something is found available or all link chains are
+// checked.
+// ---------------------------------------------------------------------------
+//
+TInt CConnMonCommsDatCache::CheckIapAvailability( TUint aIndex )
+    {
+    TConnMonIapEntry* pIap = &(*iIapCache)[aIndex];
+    TInt currentAvailability = pIap->iAvailability;
+    switch ( currentAvailability )
+        {
+        // Real IAPs should have availability status of either available or unavailable at this
+        // point. Unprocessed virtual IAPs and SNAPs should have availability status unknown.
+        //
+        case EConnMonAvailabilityProcessing: // Loop. Fallthrough intended
+        case EConnMonAvailabilityUnavailable:
+            return EConnMonAvailabilityUnavailable;
+        case EConnMonAvailabilityAvailable:
+            return EConnMonAvailabilityAvailable;
+        case EConnMonAvailabilityUnknown:
+            {
+            if ( pIap->iNextLayerIndex >= 0 )
+                {
+                // Set availability status to processing (to detect/prevent loops)
+                pIap->iAvailability = EConnMonAvailabilityProcessing;
+                if ( pIap->iNextLayerSnapId )
+                    {
+                    pIap->iAvailability = CheckSnapAvailability( pIap->iNextLayerIndex );
+                    }
+                else
+                    {
+                    pIap->iAvailability = CheckIapAvailability( pIap->iNextLayerIndex );
+                    }
+                }
+            else
+                {
+                // Virtual IAP that does not point anywhere
+                pIap->iAvailability = EConnMonAvailabilityUnavailable;
+                }
+            }
+            break;
+        default:
+            LOGIT1("ERROR, IAP entry contained invalid availability value: %d", currentAvailability)
+            return EConnMonAvailabilityUnavailable;
+        }
+    return pIap->iAvailability;
+    }
+
+// ---------------------------------------------------------------------------
+// Check SNAP availability by index. Keeps checking recursively until something
+// is found available inside or all contents of this SNAP have are checked.
+// ---------------------------------------------------------------------------
+//
+TInt CConnMonCommsDatCache::CheckSnapAvailability( TUint aIndex )
+    {
+    TInt currentAvailability = (*iSnapCache)[aIndex].iAvailability;
+    switch ( currentAvailability )
+        {
+        case EConnMonAvailabilityProcessing: // Loop. Fallthrough intended
+        case EConnMonAvailabilityUnavailable:
+            return EConnMonAvailabilityUnavailable;
+        case EConnMonAvailabilityAvailable:
+            return EConnMonAvailabilityAvailable;
+        case EConnMonAvailabilityUnknown:
+            {
+            // Set availability status to processing (to detect/prevent loops)
+            SetSnapAvailabilityAtIndex( aIndex, EConnMonAvailabilityProcessing );
+
+            const TUint id = (*iSnapCache)[aIndex].iId;
+            const TInt count = iSnapCache->Count();
+
+            currentAvailability = EConnMonAvailabilityUnavailable;
+            for ( TInt i = aIndex; i < count; i++ )
+                {
+                if ( (*iSnapCache)[i].iId != id )
+                    {
+                    // This line belongs to next SNAP, finish here
+                    break;
+                    }
+                TInt link = (*iSnapCache)[i].iNextLayerIndex;
+                if ( link >= 0 )
+                    {
+                    if ( (*iSnapCache)[i].iNextLayerIapId )
+                        {
+                        currentAvailability = CheckIapAvailability( link );
+                        }
+                    else
+                        {
+                        currentAvailability = CheckSnapAvailability( link );
+                        }
+                    }
+                if ( currentAvailability == EConnMonAvailabilityAvailable )
+                    {
+                    // Something inside this SNAP is available, no need to continue
+                    break;
+                    }
+                }
+            // Set this SNAP as available (all lines in cache that belong to this SNAP)
+            SetSnapAvailabilityAtIndex( aIndex, currentAvailability );
+            }
+            break;
+        default:
+            LOGIT("ERROR, SNAP entry contained invalid availability value")
+            return EConnMonAvailabilityUnavailable;
+        }
+    return currentAvailability;
+    }
+
+// ---------------------------------------------------------------------------
+// Updates the internal list of available IAP IDs and returns ETrue if it has
+// changed.
+// ---------------------------------------------------------------------------
+//
+TBool CConnMonCommsDatCache::UpdateAvailableIaps()
+    {
+    //LOGENTRFN("CConnMonCommsDatCache::UpdateAvailableIaps()")
+
+    RArray<TUint> currentIapIds;
+
+    // Read available IAP IDs from IAP cache
+    const TInt count = iIapCache->Count();
+    for ( TInt i = 0; i < count; i++ )
+        {
+        if ( (*iIapCache)[i].iAvailability == EConnMonAvailabilityAvailable )
+            {
+            TInt err = currentIapIds.InsertInOrder( (*iIapCache)[i].iId );
+            if ( KErrNone != err )
+                {
+                LOGIT1("ERROR inserting IAP ID to available IAPs cache <%d>", err)
+                break;
+                }
+            }
+        }
+
+    // Check for changes
+    TBool arrayChanged = CompareSortedArrays( currentIapIds, iIapIdCache );
+    if ( arrayChanged )
+        {
+        LOGIT1("Available IAP count: %d (changed)", currentIapIds.Count())
+        DeepCopy( currentIapIds, iIapIdCache );
+        }
+    else
+        {
+        LOGIT1("Available IAP count: %d", currentIapIds.Count())
+        }
+    currentIapIds.Close();
+
+    //LOGEXITFN1("CConnMonCommsDatCache::UpdateAvailableIaps()", arrayChanged)
+    return arrayChanged;
+    }
+
+// ---------------------------------------------------------------------------
+// Updates the internal list of available SNAP IDs and returns ETrue if it has
+// changed.
+// ---------------------------------------------------------------------------
+//
+TBool CConnMonCommsDatCache::UpdateAvailableSnaps()
+    {
+    //LOGENTRFN("CConnMonCommsDatCache::UpdateAvailableSnaps()")
+
+    TUint lastSnapId( 0 );
+    RArray<TUint> currentSnapIds;
+
+    // Read available SNAP IDs from SNAP cache.
+    // If there is n items inside a SNAP, then SNAP cache will contain n entries for that SNAP
+    const TInt count = iSnapCache->Count();
+    for ( TInt i = 0; i < count; i++ )
+        {
+        TUint currentId = (*iSnapCache)[i].iId;
+        if ( currentId != lastSnapId )
+            {
+            lastSnapId = currentId;
+            if ( (*iSnapCache)[i].iAvailability == EConnMonAvailabilityAvailable )
+                {
+                TInt err = currentSnapIds.InsertInOrder( currentId );
+                if ( KErrNone != err )
+                    {
+                    LOGIT1("ERROR inserting SNAP ID to available SNAPs cache <%d>", err)
+                    break;
+                    }
+                }
+            }
+        }
+
+    // Check for changes
+    TBool arrayChanged = CompareSortedArrays( currentSnapIds, iSnapIdCache );
+    if ( arrayChanged )
+        {
+        LOGIT1("Available SNAP count: %d (changed)", currentSnapIds.Count())
+        DeepCopy( currentSnapIds, iSnapIdCache );
+        }
+    else
+        {
+        LOGIT1("Available SNAP count: %d", currentSnapIds.Count())
+        }
+    currentSnapIds.Close();
+
+    //LOGEXITFN1("CConnMonCommsDatCache::UpdateAvailableSnaps()", arrayChanged)
+    return arrayChanged;
+    }
+
+// ---------------------------------------------------------------------------
+// Checks from 'LAN bearer table' array if given ID has a WLAN bearer
+// ---------------------------------------------------------------------------
+//
+TBool CConnMonCommsDatCache::HasWlanBearer(
+        TUint32 aId,
+        RArray<TLanBearerEntry>& aLanBearerTableCache )
+    {
+    //LOGENTRFN("CConnMonCommsDatCache::HasWlanBearer()")
+    TBool wlanBearer( EFalse );
+
+    for ( TInt i = 0; i < aLanBearerTableCache.Count(); i++ )
+        {
+        if ( aLanBearerTableCache[i].iId == aId )
+            {
+            wlanBearer = aLanBearerTableCache[i].iWlanBearer;
+            break;
+            }
+        }
+
+    //LOGEXITFN1("CConnMonCommsDatCache::HasWlanBearer()", wlanBearer)
+    return wlanBearer;
+    }
+
+// ---------------------------------------------------------------------------
+// Convert a bearer ID to (cache internal) service type
+// ---------------------------------------------------------------------------
+//
+TInt CConnMonCommsDatCache::ConvertBearerIdToServiceType(
+        const TUint aBearerId,
+        TUint& aServiceType )
+    {
+    //LOGENTRFN("CConnMonCommsDatCache::ConvertBearerIdToServiceType()")
+    TInt err( KErrNone );
+
+    switch ( aBearerId )
+        {
+        case EBearerIdGPRS:
+        case EBearerIdWCDMA:
+            aServiceType = EConnMonCacheServiceTypeGprs;
+            break;
+        case EBearerIdCSD:
+            aServiceType = EConnMonCacheServiceTypeCsd;
+            break;
+        case EBearerIdWLAN:
+            aServiceType = EConnMonCacheServiceTypeWlan;
+            break;
+        case EBearerIdLAN:
+            aServiceType = EConnMonCacheServiceTypeLan;
+            break;
+        default:
+            LOGIT1("WARNING, ConvertBearerIdToServiceType() called with bad bearerId: %d", aBearerId)
+            aServiceType = EConnMonCacheServiceTypeUnknown;
+            err = KErrNotFound;
+        }
+
+    //LOGEXITFN1("CConnMonCommsDatCache::ConvertBearerIdToServiceType()", err)
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// Checks from CommsDat if WLAN background scans are enabled.
+// ---------------------------------------------------------------------------
+//
+TBool CConnMonCommsDatCache::IsWlanBackgroundScanningEnabledL()
+    {
+    LOGENTRFN("CConnMonCommsDatCache::IsWlanBackgroundScanningEnabledL()")
+
+    TBool bgScanEnabled( EFalse );
+    CMDBSession* db = CMDBSession::NewLC( CMDBSession::LatestVersion() );
+
+    CCDWlanDeviceSettingsRecord* ptrWlanDevSettingsRecord = new( ELeave )
+    CCDWlanDeviceSettingsRecord( CCDWlanDeviceSettingsRecord::TableIdL( *db ) );
+    CleanupStack::PushL( ptrWlanDevSettingsRecord );
+
+    ptrWlanDevSettingsRecord->iWlanDeviceSettingsType = KWlanUserSettings;
+    if( ptrWlanDevSettingsRecord->FindL( *db ) )
+        {
+        ptrWlanDevSettingsRecord->LoadL( *db );
+        if ( ptrWlanDevSettingsRecord->iBgScanInterval > 0 )
+            {
+            bgScanEnabled = ETrue;
+            LOGIT1("WLAN background scans are enabled, interval: %d", (TUint)ptrWlanDevSettingsRecord->iBgScanInterval)
+            }
+        }
+    CleanupStack::PopAndDestroy( ptrWlanDevSettingsRecord );
+    CleanupStack::PopAndDestroy( db );
+
+    LOGEXITFN1("CConnMonCommsDatCache::IsWlanBackgroundScanningEnabledL()", bgScanEnabled)
+    return bgScanEnabled;
+    }
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/src/connmoncommsdatnotifier.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,141 @@
+/*
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Listens for changes in one CommsDat table through CenRep.
+*
+*/
+
+#include <commsdat.h>
+#include <centralrepository.h>
+
+#include "connmoncommsdatnotifier.h"
+#include "ConnMonAvailabilityManager.h"
+#include "ConnMonDef.h"
+#include "log.h"
+
+// Repository for CommsDat
+const TUid KCDCommsRepositoryId = { 0xCCCCCC00 };
+
+CConnMonCommsDatNotifier* CConnMonCommsDatNotifier::NewL(
+        CConnMonAvailabilityManager* aAvailabilityManager,
+        TUint32 aTableId )
+    {
+    CConnMonCommsDatNotifier* self = CConnMonCommsDatNotifier::NewLC(
+            aAvailabilityManager,
+            aTableId );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+CConnMonCommsDatNotifier* CConnMonCommsDatNotifier::NewLC(
+        CConnMonAvailabilityManager* aAvailabilityManager,
+        TUint32 aTableId )
+    {
+    CConnMonCommsDatNotifier* self = new( ELeave ) CConnMonCommsDatNotifier(
+            aAvailabilityManager,
+            aTableId );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+CConnMonCommsDatNotifier::~CConnMonCommsDatNotifier()
+    {
+    // Cancel outstanding request, if exists
+    Cancel();
+    delete iRepository;
+    }
+
+CConnMonCommsDatNotifier::CConnMonCommsDatNotifier(
+        CConnMonAvailabilityManager* aAvailabilityManager,
+        TUint32 aTableId )
+        :
+        CActive( EConnMonPriorityNormal ),
+        iAvailabilityManager( aAvailabilityManager ),
+        iTableId( aTableId )
+    {
+    iRepository = NULL;
+    iErrorCounter = 0;
+    }
+
+void CConnMonCommsDatNotifier::ConstructL()
+    {
+    //LOGENTRFN("CConnMonCommsDatNotifier::ConstructL()")
+
+    iRepository = CRepository::NewL( KCDCommsRepositoryId );
+    CActiveScheduler::Add( this );
+    TInt err( RequestNotifications() );
+    User::LeaveIfError( err );
+
+    //LOGEXITFN("CConnMonCommsDatNotifier::ConstructL()")
+    }
+
+TInt CConnMonCommsDatNotifier::RequestNotifications()
+    {
+    //LOGENTRFN("CConnMonCommsDatNotifier::RequestNotifications()")
+
+    LOGIT1("Calling iRepository->NotifyRequest() for table 0x%08X", iTableId)
+    TInt err = iRepository->NotifyRequest( iTableId, KCDMaskShowRecordType, iStatus );
+
+    if ( KErrNone == err )
+        {
+        SetActive();
+        }
+    else
+        {
+        LOGIT1("ERROR, iRepository->NotifyRequest() <%d>", err)
+        }
+
+    //LOGEXITFN1("CConnMonCommsDatNotifier::RequestNotifications()", err)
+    return err;
+    }
+
+void CConnMonCommsDatNotifier::DoCancel()
+    {
+    iRepository->NotifyCancel( iTableId, KCDMaskShowRecordType );
+    }
+
+void CConnMonCommsDatNotifier::RunL()
+    {
+    //LOGENTRFN("CConnMonCommsDatNotifier::RunL()")
+
+    LOGIT(".")
+    LOGIT2("RunL: CConnMonCommsDatNotifier 0x%08X, 0x%08X", iTableId, iStatus.Int())
+
+    if ( iStatus.Int() < KErrNone )
+        {
+        LOGIT1("CConnMonCommsDatNotifier::RunL: error <%d>", iStatus.Int())
+        iErrorCounter++;
+        if ( iErrorCounter > KConnMonCenRepErrorThreshold )
+            {
+            LOGIT1("Over %d consecutive errors, stopping notifications permanently", KConnMonCenRepErrorThreshold)
+            return;
+            }
+        }
+    else
+        {
+        iErrorCounter = 0;
+        }
+
+    RequestNotifications();
+
+    TRAPD( leaveCode, iAvailabilityManager->CommsDatEventReceivedL( iTableId ) )
+    if ( leaveCode )
+        {
+        LOGIT1("CConnMonCommsDatNotifier::RunL: LEAVE <%d>", leaveCode)
+        }
+
+    //LOGEXITFN("CConnMonCommsDatNotifier::RunL()")
+    }
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/src/connmondtmnoti.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,174 @@
+/*
+* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ConnMon Dual Transfer Mode watcher.
+*
+*/
+
+#include "connmondtmnoti.h"
+#include "ConnMonDef.h"
+#include "log.h"
+
+#include <pcktcs.h>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CConnMonDtmNotifier::NewL
+// -----------------------------------------------------------------------------
+//
+CConnMonDtmNotifier* CConnMonDtmNotifier::NewL(
+        RPacketService& aPacketService,
+        MConnMonDtmNotifierObserver& aObserver )
+    {
+    CConnMonDtmNotifier* self = new( ELeave ) CConnMonDtmNotifier(
+            aPacketService,
+            aObserver );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CConnMonDtmNotifier::CConnMonDtmNotifier
+// -----------------------------------------------------------------------------
+//
+CConnMonDtmNotifier::CConnMonDtmNotifier(
+        RPacketService& aPacketService,
+        MConnMonDtmNotifierObserver& aObserver )
+        :
+        CActive( EConnMonPriorityNormal ),
+        iPacketService( aPacketService ),
+        iMsClass( RPacketService::EMSClassUnknown ),
+        iObserver( aObserver ),
+        iSendEvents( EFalse )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CConnMonDtmNotifier::~CConnMonDtmNotifier
+// -----------------------------------------------------------------------------
+//
+CConnMonDtmNotifier::~CConnMonDtmNotifier()
+    {
+    //LOGENTRFN("CConnMonDtmNotifier::~CConnMonDtmNotifier()")
+    Cancel();
+    //LOGEXITFN("CConnMonDtmNotifier::~CConnMonDtmNotifier()")
+    }
+
+
+// -----------------------------------------------------------------------------
+// CConnMonDtmNotifier::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CConnMonDtmNotifier::ConstructL()
+    {
+    //LOGENTRFN("CConnMonDtmNotifier::ConstructL()")
+
+    // Request current MS class from ETel
+    TRequestStatus status;
+    iPacketService.GetMSClass( status, iMsClass, iMaxMsClass );
+    User::WaitForRequest( status );
+
+    if ( status.Int() != KErrNone )
+        {
+        LOGIT1("CConnMonDtmNotifier: ERROR getting MSClass from ETel <%d>", status.Int())
+        User::LeaveIfError( status.Int() );
+        }
+
+    // Request notification from ETel about MS class change
+    iPacketService.NotifyMSClassChange( iStatus, iMsClass );
+    SetActive();
+
+    LOGIT("Created CConnMonDtmNotifier")
+    //LOGEXITFN("CConnMonDtmNotifier::ConstructL()")
+    }
+
+
+// -----------------------------------------------------------------------------
+// CConnMonDtmNotifier::IsInDualMode
+// -----------------------------------------------------------------------------
+//
+TBool CConnMonDtmNotifier::IsInDualMode() const
+    {
+    LOGIT1("CConnMonDtmNotifier::IsInDualMode: %d", iMsClass == RPacketService::EMSClassDualMode)
+
+    return ( iMsClass == RPacketService::EMSClassDualMode );
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonDtmNotifier::Receive
+// -----------------------------------------------------------------------------
+//
+void CConnMonDtmNotifier::Receive()
+    {
+    iSendEvents = ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonDtmNotifier::CancelNotificatications
+// -----------------------------------------------------------------------------
+//
+void CConnMonDtmNotifier::CancelNotifications()
+    {
+    iSendEvents = EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonDtmNotifier::RunL
+// -----------------------------------------------------------------------------
+//
+void CConnMonDtmNotifier::RunL()
+    {
+    //LOGENTRFN("CConnMonDtmNotifier::RunL()")
+
+    LOGIT(".")
+    LOGIT1("RunL: CConnMonDtmNotifier, status <%d>", iStatus.Int())
+
+    if ( KErrNone == iStatus.Int() )
+        {
+        if ( iSendEvents )
+            {
+            LOGIT("Server: CConnMonTelNotifier::RunL - Notifying observer")
+            iObserver.DtmStateChanged();
+            }
+        // Request notification from ETel about MS class change
+        iPacketService.NotifyMSClassChange( iStatus, iMsClass );
+        SetActive();
+        }
+    else
+        {
+        // Log error and stop
+        LOGIT1("Server: CConnMonDtmNotifier::RunL - Error <%d>", iStatus.Int())
+        }
+    //LOGEXITFN("CConnMonDtmNotifier::RunL()")
+    }
+
+
+// -----------------------------------------------------------------------------
+// CConnMonDtmNotifier::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CConnMonDtmNotifier::DoCancel()
+    {
+    //LOGENTRFN("CConnMonDtmNotifier::DoCancel()")
+    iPacketService.CancelAsyncRequest( EPacketNotifyMSClassChange );
+    //LOGEXITFN("CConnMonDtmNotifier::DoCancel()")
+    }
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/src/connmontelnoti.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,212 @@
+/*
+* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ConnMon Telephony watcher.
+*
+*/
+
+#include <mmtsy_names.h>
+#include <pcktcs.h>
+
+#include "connmontelnoti.h"
+#include "ConnMonDef.h"
+#include "log.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CConnMonTelNotifier::NewL
+// -----------------------------------------------------------------------------
+//
+CConnMonTelNotifier* CConnMonTelNotifier::NewL(
+        MConnMonTelephonyObserver& aObserver,
+        RMobilePhone* aMobilePhone )
+    {
+    CConnMonTelNotifier* self = new( ELeave ) CConnMonTelNotifier( aObserver, aMobilePhone );
+
+    self->Construct();
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CConnMonTelNotifier::CConnMonTelNotifier
+// -----------------------------------------------------------------------------
+//
+CConnMonTelNotifier::CConnMonTelNotifier(
+        MConnMonTelephonyObserver& aObserver,
+        RMobilePhone* aMobilePhone )
+        :
+        CActive( EConnMonPriorityNormal ),
+        iMobilePhone( aMobilePhone ),
+        iVoiceCallActive( EFalse ),
+        iObserver( aObserver ),
+        iSendEvents( EFalse )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CConnMonTelNotifier::~CConnMonTelNotifier
+// -----------------------------------------------------------------------------
+//
+CConnMonTelNotifier::~CConnMonTelNotifier()
+    {
+    //LOGENTRFN("CConnMonTelNotifier::~CConnMonTelNotifier()")
+    Cancel();
+    iLine.Close();
+    //LOGEXITFN("CConnMonTelNotifier::~CConnMonTelNotifier()")
+    }
+
+
+// -----------------------------------------------------------------------------
+// CConnMonTelNotifier::Construct
+// -----------------------------------------------------------------------------
+//
+void CConnMonTelNotifier::Construct()
+    {
+    //LOGENTRFN("CConnMonTelNotifier::Construct()")
+
+    TInt ret = iLine.Open( *iMobilePhone, KMmTsyVoice1LineName );
+    iLine.GetStatus( iCallStatus );
+
+    if ( iCallStatus == RCall::EStatusDialling   ||
+         iCallStatus == RCall::EStatusRinging    ||
+         iCallStatus == RCall::EStatusAnswering  ||
+         iCallStatus == RCall::EStatusConnecting ||
+         iCallStatus == RCall::EStatusConnected  ||
+         iCallStatus == RCall::EStatusHangingUp )
+        {
+        LOGIT1("Voice line status: active (%d)", iCallStatus)
+        iVoiceCallActive = ETrue;
+        }
+    else if ( iCallStatus == RCall::EStatusIdle ||
+              iCallStatus == RCall::EStatusUnknown )
+        {
+        LOGIT1("Voice line status: not active (%d)", iCallStatus)
+        iVoiceCallActive = EFalse;
+        }
+    else
+        {
+        LOGIT1("Voice line status: unknown (%d)", iCallStatus )
+        iVoiceCallActive = EFalse;
+        }
+    iLine.NotifyStatusChange( iStatus, iCallStatus );
+    SetActive();
+
+    LOGIT("Created CConnMonTelNotifier")
+    //LOGEXITFN("CConnMonTelNotifier::Construct()")
+    }
+
+
+// -----------------------------------------------------------------------------
+// CConnMonTelNotifier::IsCallActive
+// -----------------------------------------------------------------------------
+//
+TBool CConnMonTelNotifier::IsCallActive() const
+    {
+    LOGIT("CConnMonTelNotifier::IsCallActive")
+
+    return iVoiceCallActive;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonTelNotifier::Receive
+// -----------------------------------------------------------------------------
+//
+void CConnMonTelNotifier::Receive()
+    {
+    iSendEvents = ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonTelNotifier::CancelNotificatications
+// -----------------------------------------------------------------------------
+//
+void CConnMonTelNotifier::CancelNotifications()
+    {
+    iSendEvents = EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonTelNotifier::RunL
+// -----------------------------------------------------------------------------
+//
+void CConnMonTelNotifier::RunL()
+    {
+    LOGENTRFN("CConnMonTelNotifier::RunL()")
+
+    TBool stateChanged( EFalse );
+    if ( KErrNone == iStatus.Int() )
+        {
+        LOGIT1("Server: CConnMonTelNotifier::RunL - Call status <%d>", iCallStatus )
+
+        if ( iCallStatus == RCall::EStatusDialling   ||
+             iCallStatus == RCall::EStatusRinging    ||
+             iCallStatus == RCall::EStatusAnswering  ||
+             iCallStatus == RCall::EStatusConnecting ||
+             iCallStatus == RCall::EStatusConnected  ||
+             iCallStatus == RCall::EStatusHangingUp )
+            {
+            // Do not notify, if state doesn't change
+            if ( EFalse == iVoiceCallActive )
+                {
+                stateChanged = ETrue;
+                iVoiceCallActive = ETrue;
+
+                LOGIT("Server: CConnMonTelNotifier::RunL - Voice Call Active")
+                }
+            }
+        else
+            {
+            // Do not notify, if state doesn't change
+            if ( EFalse != iVoiceCallActive )
+                {
+                stateChanged = ETrue;
+                iVoiceCallActive = EFalse;
+
+                LOGIT("Server: CConnMonTelNotifier::RunL - Voice Call Not Active")
+                }
+            }
+        // Does the observer want to listen to the events
+        // and has the state changed from the last known state
+        if ( iSendEvents && stateChanged )
+            {
+            LOGIT("Server: CConnMonTelNotifier::RunL - Notifying observer")
+
+            iObserver.PhoneLineStatusChange();
+            }
+        iLine.NotifyStatusChange( iStatus, iCallStatus );
+        SetActive();
+        }
+    else
+        {
+        // Log error and stop
+        LOGIT1("Server: CConnMonTelNotifier::RunL - Error <%d>", iStatus.Int() )
+        }
+    LOGEXITFN("CConnMonTelNotifier::RunL()")
+    }
+
+// -----------------------------------------------------------------------------
+// CConnMonTelNotifier::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CConnMonTelNotifier::DoCancel()
+    {
+    LOGIT("CConnMonTelNotifier::DoCancel")
+
+    iLine.NotifyStatusChangeCancel();
+    }
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/connectionmonitor/src/connmonwlannetwork_v2.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,280 @@
+/*
+* Copyright (c) 2006-2008 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 for the CConnMonWlanNetwork class.
+*
+*/
+
+#include <e32cmn.h>
+#include <rconnmon.h>
+
+#include "ConnMonUtils.h"
+#include "log.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+//  Constructor
+// ---------------------------------------------------------------------------
+//
+CConnMonWlanNetwork::CConnMonWlanNetwork()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+//  Constructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CConnMonWlanNetwork* CConnMonWlanNetwork::NewL()
+    {
+    CConnMonWlanNetwork* self = new( ELeave ) CConnMonWlanNetwork();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+//  Constructor
+// ---------------------------------------------------------------------------
+//
+CConnMonWlanNetwork::CConnMonWlanNetwork(
+        const TBuf<KMaxNameLength>& aName,
+        TUint aConnectionMode,
+        TUint aSignalStrength,
+        TUint aSecurityMode,
+        const TBuf8<KWlanBssId>& aBssId,
+        const TDesC& aVendorData )
+        :
+        iName( aName ),
+        iConnectionMode( aConnectionMode ),
+        iSignalStrength( aSignalStrength ),
+        iSecurityMode( aSecurityMode ),
+        iWlanBssId( aBssId ),
+        iVendorData( NULL )
+    {
+    if ( aVendorData != KNullDesC() && aVendorData.Length() > 0 )
+        {
+        // Can't leave here, copy contents only if enough memory
+        iVendorData = HBufC::New( aVendorData.Length() );
+        if ( iVendorData )
+            {
+            iVendorData->Des().Copy( aVendorData );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+//  Constructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CConnMonWlanNetwork* CConnMonWlanNetwork::NewL(
+        const TBuf<KMaxNameLength>& aName,
+        TUint aConnectionMode,
+        TUint aSignalStrength,
+        TUint aSecurityMode,
+        const TBuf8<KWlanBssId>& aBssId,
+        const TDesC& aVendorData )
+    {
+    CConnMonWlanNetwork* wlanNet = new( ELeave ) CConnMonWlanNetwork(
+            aName,
+            aConnectionMode,
+            aSignalStrength,
+            aSecurityMode,
+            aBssId,
+            aVendorData );
+
+    return wlanNet;
+    }
+
+// ---------------------------------------------------------------------------
+//  Second-phase constructor
+// ---------------------------------------------------------------------------
+//
+void CConnMonWlanNetwork::ConstructL()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+//  Copy Constructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CConnMonWlanNetwork* CConnMonWlanNetwork::NewL(
+        CConnMonWlanNetwork& aConnMonWlanNetwork )
+    {
+    CConnMonWlanNetwork* wlanNet;
+    if ( aConnMonWlanNetwork.iVendorData )
+        {
+        wlanNet = new( ELeave ) CConnMonWlanNetwork(
+                aConnMonWlanNetwork.iName,
+                aConnMonWlanNetwork.iConnectionMode,
+                aConnMonWlanNetwork.iSignalStrength,
+                aConnMonWlanNetwork.iSecurityMode,
+                aConnMonWlanNetwork.iWlanBssId,
+                aConnMonWlanNetwork.iVendorData->Des() );
+        }
+    else
+        {
+        wlanNet = new( ELeave ) CConnMonWlanNetwork(
+                aConnMonWlanNetwork.iName,
+                aConnMonWlanNetwork.iConnectionMode,
+                aConnMonWlanNetwork.iSignalStrength,
+                aConnMonWlanNetwork.iSecurityMode,
+                aConnMonWlanNetwork.iWlanBssId,
+                KNullDesC() );
+        }
+    return wlanNet;
+    }
+
+// ---------------------------------------------------------------------------
+//  Destructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CConnMonWlanNetwork::~CConnMonWlanNetwork()
+    {
+    delete iVendorData;
+    }
+
+// ---------------------------------------------------------------------------
+//  = operator
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CConnMonWlanNetwork& CConnMonWlanNetwork::operator=(
+        CConnMonWlanNetwork& aConnMonWlanNetwork )
+    {
+    TInt err( KErrNone );
+
+    iName.Copy( aConnMonWlanNetwork.Name() );
+    iConnectionMode = aConnMonWlanNetwork.ConnectionMode();
+    iSignalStrength = aConnMonWlanNetwork.SignalStrength();
+    iSecurityMode = aConnMonWlanNetwork.SecurityMode();
+    iWlanBssId = aConnMonWlanNetwork.WlanBssid();
+
+    if ( aConnMonWlanNetwork.iVendorData )
+        {
+        delete iVendorData;
+        iVendorData = NULL;
+        TRAP( err, iVendorData = HBufC::NewL( aConnMonWlanNetwork.iVendorData->Length() ) );
+        if ( err )
+            {
+            LOGIT1("VendorData handling error <%d>", err)
+            }
+        else
+            {
+            iVendorData = aConnMonWlanNetwork.iVendorData;
+            }
+        }
+    return *this;
+    }
+
+// ---------------------------------------------------------------------------
+// Compares two networks by iSignalStrength
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CConnMonWlanNetwork::CompareBySignal(
+        const CConnMonWlanNetwork& aFirst,
+        const CConnMonWlanNetwork& aSecond )
+    {
+    //LOGENTRFN("CConnMonWlanNetwork::CompareBySignal()")
+
+    TInt rc( 0 );
+    if ( aFirst.iSignalStrength > aSecond.iSignalStrength )
+        {
+        rc = 1;
+        }
+    else if ( aFirst.iSignalStrength < aSecond.iSignalStrength )
+        {
+        rc = -1;
+        }
+
+    //LOGEXITFN1("CConnMonWlanNetwork::CompareBySignal()", rc)
+    return rc;
+    }
+
+// ---------------------------------------------------------------------------
+// Packages object to HBufC descriptor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const HBufC* CConnMonWlanNetwork::ToBuf() const
+    {
+    //LOGENTRFN("CConnMonWlanNetwork::ToBuf()")
+
+    // Check the vendor data length
+    TInt vendorDataSize( 0 );
+    if ( iVendorData )
+        {
+        vendorDataSize = iVendorData->Length();
+        }
+
+    // Allocate buffer to "all" data
+    HBufC* buf = HBufC::New( sizeof( CConnMonWlanNetwork ) + vendorDataSize );
+    if ( !buf )
+        {
+        LOGIT("ToBuf: out of memory error")
+        }
+    else
+        {
+        TPtr ptr( buf->Des() );
+
+        // Add CConnMonWlanNetwork object
+        ptr.Copy( (TUint16*)this, (TInt)sizeof( CConnMonWlanNetwork ) / sizeof( TUint16 ) );
+
+        // If vendor data exists, add it also
+        if ( vendorDataSize > 0 )
+            {
+            ptr.Append( iVendorData->Des() );
+            }
+        }
+
+    //LOGEXITFN("CConnMonWlanNetwork::ToBuf()")
+    return buf;
+    }
+
+// ---------------------------------------------------------------------------
+// Unpackages CConnMonWlanNetwork from TPtrC descriptor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CConnMonWlanNetwork::FromPtrC(
+        const TPtrC& aPtrC,
+        CConnMonWlanNetwork* aConnMonWlanNetwork )
+    {
+    //LOGENTRFN("CConnMonWlanNetwork::FromPtrC()")
+    TInt err( KErrNone );
+
+    // Copy CConnMonWlanNetwork object data from the beginning of aPtrC
+    memcpy( aConnMonWlanNetwork, aPtrC.Ptr(), sizeof( CConnMonWlanNetwork ) );
+
+    // Reset vendor data pointer
+    aConnMonWlanNetwork->iVendorData = NULL;
+
+    // If vendor data exists, allocate memory and read it (it exists just after
+    // CConnMonWlanNetwork object data) from aPtrC
+    if ( aPtrC.Length() > sizeof( CConnMonWlanNetwork ) )
+        {
+        TInt vendorDataLen = aPtrC.Length() - sizeof( CConnMonWlanNetwork );
+
+        aConnMonWlanNetwork->iVendorData = HBufC::New( vendorDataLen );
+        if ( !aConnMonWlanNetwork->iVendorData )
+            {
+            err = KErrNoMemory;
+            LOGIT("FromPtrC: out of memory error")
+            }
+        else
+            {
+            aConnMonWlanNetwork->iVendorData->Des().Copy(
+                    aPtrC.Mid( sizeof( CConnMonWlanNetwork ), vendorDataLen ) );
+            }
+        }
+
+    //LOGEXITFN1("CConnMonWlanNetwork::FromPtrC()", err)
+    return err;
+    }
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/dataconnectionlogger/BMARM/DATACONNECTIONLOGGERU.DEF	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,2 @@
+EXPORTS
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/dataconnectionlogger/BWINS/DATACONNECTIONLOGGERU.DEF	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+	?WinsMain@@YAHPAX@Z @ 1 NONAME ; int __cdecl WinsMain(void *)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/dataconnectionlogger/EABI/DATACONNECTIONLOGGERU.DEF	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,2 @@
+EXPORTS
+
Binary file connectionmonitoring/connmon/dataconnectionlogger/cenrep/keys_dcl.xls has changed
Binary file connectionmonitoring/connmon/dataconnectionlogger/conf/dcl.confml has changed
Binary file connectionmonitoring/connmon/dataconnectionlogger/conf/dcl_101F4CD5.crml has changed
Binary file connectionmonitoring/connmon/dataconnectionlogger/conf/dcl_101F6CFE.crml has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/dataconnectionlogger/group/backup_registration.xml	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,5 @@
+<?xml version="1.0" standalone="yes"?>
+<backup_registration version="1.0">
+    <proxy_data_manager sid = "0x10202BE9" />
+    <restore requires_reboot = "no"/>
+</backup_registration>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/dataconnectionlogger/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for Data Connection Logger.
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+
+DEFAULT
+
+PRJ_EXPORTS
+
+../rom/DataConnectionLogger.iby CORE_MW_LAYER_IBY_EXPORT_PATH(DataConnectionLogger.iby)
+
+../conf/dcl.confml              APP_LAYER_CONFML(dcl.confml)
+../conf/dcl_101F4CD5.crml       APP_LAYER_CRML(dcl_101F4CD5.crml)
+../conf/dcl_101F6CFE.crml       APP_LAYER_CRML(dcl_101F6CFE.crml)
+
+// Backup registration file
+#ifndef __COMMDB_PROTECTION
+backup_registration.xml  /epoc32/data/z/private/101F6CFE/backup_registration.xml
+backup_registration.xml  /epoc32/release/winscw/udeb/z/private/101F6CFE/backup_registration.xml
+backup_registration.xml  /epoc32/release/winscw/urel/z/private/101F6CFE/backup_registration.xml
+#endif
+
+PRJ_MMPFILES
+
+// Builds DataConnectionLogger.exe
+dcl.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/dataconnectionlogger/group/dcl.mmp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,54 @@
+/*
+* 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: Builds DataConnectionLogger.exe.
+*
+*/
+
+#include <platform_paths.hrh>
+
+MACRO           EPOC_SDK=0x07010000
+
+TARGET          DataConnectionLogger.exe
+TARGETTYPE      exe
+
+UID             0x1000008D 0x101F6CFE
+
+VENDORID        VID_DEFAULT
+CAPABILITY      ReadDeviceData WriteDeviceData NetworkControl NetworkServices ReadUserData WriteUserData
+
+SOURCEPATH      ../src
+
+SOURCE          dcl.cpp
+SOURCE          dcl_dll.cpp
+SOURCE          dclevent.cpp
+SOURCE          dclTimer.cpp
+SOURCE          saeobserver.cpp
+
+USERINCLUDE     ../inc
+MW_LAYER_SYSTEMINCLUDE
+
+#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
+APP_LAYER_SYSTEMINCLUDE
+#endif
+
+LIBRARY         euser.lib commdb.lib connmon.lib
+LIBRARY         commsdat.lib
+LIBRARY         cmmanagerdatabase.lib
+LIBRARY         logwrap.lib efsrv.lib
+LIBRARY         etel.lib etelmm.lib etelpckt.lib
+LIBRARY         featmgr.lib logcli.lib
+LIBRARY         charconv.lib
+LIBRARY         centralrepository.lib
+
+DEBUGLIBRARY    flogger.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/dataconnectionlogger/inc/DclPrivateCRKeys.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2004 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:  Contains private Central Repository keys.
+*
+*/
+
+#ifndef DCLPRIVATECRKEYS_H
+#define DCLPRIVATECRKEYS_H
+
+#include <dclcrkeys.h>
+
+const TUid KCRUidDCL = {0x101F6CFE};
+
+// GPRS data volume threshold (volume mode).
+const TUint32 KDCLGprsThreshold  = 0x00000001;
+
+// WCDMA data volume threshold (volume mode).
+const TUint32 KDCLWcdmaThreshold = 0x00000002;
+
+// WLAN data volume threshold (volume mode).
+const TUint32 KDCLWlanThreshold  = 0x00000003;
+
+// LAN data volume threshold (volume mode).
+const TUint32 KDCLLanThreshold   = 0x00000004;
+
+// Timer interval (timer mode).
+const TUint32 KDCLTimerInterval  = 0x00000005;
+
+// Force timer mode.
+const TUint32 KDCLForceTimerMode = 0x00000006;
+
+#endif // DCLPRIVATECRKEYS_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/dataconnectionlogger/inc/dcl.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,273 @@
+/*
+* Copyright (c) 2003-2004 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:  Data Connection Logger.
+*
+*/
+
+#ifndef DCLENGINE_H
+#define DCLENGINE_H
+
+#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include <logwraplimits.h>
+#endif
+#include <e32std.h>
+#include <es_sock.h>
+#include <e32base.h>
+#include <commdb.h>
+#include <commsdat.h>
+#include <wlancontainer.h>
+#include <rconnmon.h>
+#include <mmtsy_names.h>
+#include <etel.h>
+#include <etelmm.h>
+#include <etelpckt.h>
+#include <pcktcs.h>
+
+#ifdef __WLAN
+#include <wlanloguid.h>
+#endif // __WLAN
+
+#include "dclevent.h"
+#include "dclTimer.h"
+#include "saeobserver.h"
+
+// CONSTANTS
+// UID of DataConnectionLogger
+const TLogId    KGenconnLogWaitingForLogId      = KLogNullId -1;
+const TInt      KBytesInfoNotAvailable          = -1;
+const TUint     KGPRSDataThreshold              = 20480;
+const TUint     KWCDMADataThreshold             = 51200;
+const TUint     KWLANDataThreshold              = 102400;
+const TUint     KSubConnectionId                = 0;
+const TInt      KMaxAPName                      = KCommsDbSvrMaxFieldLength;
+const TInt      KPhoneRetryCount                = 7; // Must be at least 1
+const TInt      KPhoneRetryTimeout              = 100000;
+const TInt      KConnectionStatusIdNotAvailable = -1;
+// The granularity with which iLogEventQueue and iConnections will
+// allocate memory chunks. If set to 20 there will be space for 20
+// instances of CEvent before new memory will be allocated.
+const TInt      KEventStateMaxCount             = 20;
+const TInt      KDatabufferSize                 = 64;
+
+// Timer mode constants
+const TInt      KTimerInterval                  = 10;
+
+_LIT( KDCLName, "DataConnectionLogger" );
+
+#ifndef __WLAN
+#define KLOGWLANDATAEVENTTYPE 0x1000595f
+const TUid KLogWlanDataEventTypeUid = {KLOGWLANDATAEVENTTYPE};
+#endif // __WLAN
+
+//  DATA TYPES
+enum TDCLPanic
+    {
+    ECannotCreateCleanup            = 600,
+    ECannotCreateActiveScheduler,
+    ECannotCreateCEngine,
+    ECannotRequestNotification
+    };
+
+// FORWARD DECLARATIONS
+class CDclTimerAO;
+
+// CLASS DECLARATION
+
+/**
+*  CEngine
+*  Gets information from connection monitor server using RCcnnectionMonitor
+*  object. Implements MConnectionMonitorObserver interface.
+*
+*/
+class CEngine : public CActive,
+                private MConnectionMonitorObserver
+    {
+    public:
+        // Constructors
+        static CEngine* NewL( );
+        static CEngine* NewLC( );
+        // Destructor
+        virtual ~CEngine();
+
+    public: // New methods
+        /**
+        * Adds log events.
+        */
+        void LogDataAddEventL(
+                TLogId        aConnectionId,
+                TInt          aRConnectionStatusId,
+                const TDesC&  aRemote,
+                TInt          aLogDir,
+                const TDesC&  aTelNum,
+                const TUid&   aDataEventType );
+
+        /**
+        * Changes the remote party string for existing log events.
+        */
+        void LogDataChangeEventL(
+                TLogId        aConnectionId,
+                const TDesC&  aRemote );
+
+        /**
+        * Updates log events.
+        */
+        TInt LogDataUpdateEventL(
+                TLogId        aConnectionId,
+                TInt          aRConnectionStatusId,
+                const TUid&   aDataEventType,
+                const TInt64& aBytesSent,
+                const TInt64& aBytesReceived );
+
+        /**
+        * Starts notifications.
+        */
+        void NotifyL() ;
+
+        /**
+        * Updates log event parameters.
+        */
+        TInt UpdateLogEventParamL(
+                TLogId        aConnectionId,
+                CLogEvent&    aLogEvent,
+                TInt          aRConnectionStatusId,
+                const TUid&   aDataEventType,
+                const TInt64& aBytesSent,
+                const TInt64& aBytesReceived );
+
+        /**
+        * Updates cumulative counters of SharedData
+        */
+        void UpdateSharedDataL(
+                TLogId        aConnectionId,
+                const TInt64& aBytesSent,
+                const TInt64& aBytesReceived );
+
+        /**
+        * Gets the Attach Mode setting from CommDb and
+        * sets ETel to use that value.
+        */
+        void SetAttachModeL() const;
+
+        /**
+        * Gets the default Access Point Name from CommDb and
+        * sets ETel to use that APN.
+        */
+        void SetAPNL() const;
+
+        // Following methods are from CActive.
+        /**
+        * Handles a cancel request to the service provider.
+        * This function is defined as pure virtual in CActive and any
+        * class derived from CActive must define and implement it.
+        */
+        void DoCancel();
+
+        /**
+        * Handles the completion of an asynchronous request.
+        * This function is defined as pure virtual in CActive and any
+        * class derived from CActive must define and implement it.
+        */
+        void RunL();
+
+        /**
+        * Writes to log databases in timer mode.
+        */
+        TInt LogDataInTimerModeL( const TUint aConnectionId );
+
+        /**
+        * Switches logging to the threshold mode.
+        */
+        void SwitchToThresholdMode( const TUint aConnectionId, const TUint aThreshold = 0 );
+
+    private : // From MConnectionMonitorObserver
+        void EventL( const CConnMonEventBase& aConnMonEvent ) ;
+
+    private: // New methods
+        CEngine();
+        void ConstructL();
+        void AddEventTypeL();
+
+        /**
+        * Copies aName to aResult as such. Both descriptors are 16-bit.
+        */
+        void ReplaceAPN( TDes& aResult, const TDesC& aName ) const ;
+
+        /**
+        * Converts aName to UTF-8 and copies it to aResult which is 8-bit descriptor.
+        */
+        void ReplaceAPN( TDes8& aResult, const TDesC& aName ) const;
+
+        /**
+        * Switches logging to the timer mode.
+        */
+        void SwitchToTimerMode( const TUint aConnectionId );
+
+        /**
+        * Gets duration of a connection.
+        */
+        TBool GetDuration( const TUint aConnectionId, TInt& aDuration );
+
+        /**
+        * Gets the default threshold for a connection.
+        */
+        TInt GetDefaultThreshold( const TUint aConnectionId, TUint& aThreshold );
+
+        /**
+        * Reads ini file settings.
+        */
+        void ReadIniFile();
+
+    private: // Data
+        RConnectionMonitor          iConnectionMonitor;
+        CLogWrapper*                iLogWrap;
+        CArrayPtrFlat<CEvent>*      iLogEventQueue;
+        CArrayPtrFlat<CEvent>*      iConnections;
+        CLogEvent*                  iCurrentLogEvent;
+        RFs                         iFsEventLog;
+        RPacketContext              iContext;
+
+        // Handle to the telephony server
+        RTelServer                  iTelServer;
+
+        // Handle to the packet service
+        RPacketService              iPacketService;
+
+        // RMobilePhone handle
+        RMobilePhone                iMobilePhone;
+
+        // 1 = mmtsy is loaded, 0 = mmtsy is not loaded
+        TUint8                      iTSYLoaded;
+
+        // 1 = packet services are loaded, 0 = not loaded
+        TUint8                      iPacketServLoaded;
+
+        // to add wlan event type
+        CLogEventType*              iLogEventType;
+        CLogClient*                 iLogClient;
+
+        // A pointer to the active object that logs connections that are in timer mode.
+        CDclTimerAO*                iDclTimerAO;
+
+        TInt                        iTimerInterval;
+        TUint                       iGPRSThreshold;
+        TUint                       iWCDMAThreshold;
+        TUint                       iWLANThreshold;
+
+        // a pointer to SaeObserver that updates P&S variables
+        CSaeObserver*               iSaeObserver;
+    };
+
+#endif // DCLENGINE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/dataconnectionlogger/inc/dclTimer.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2004 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:  Timer active object needed in logging data in timer mode.
+*
+*/
+
+#ifndef CDCLTIMERAO_H
+#define CDCLTIMERAO_H
+
+#include <e32base.h>
+#include <e32std.h>
+
+#include "dcl.h"
+
+class CEngine;
+
+/**
+*  CDclTimerAO
+*  Timer that logs data periodically in timer mode.
+*  @lib
+*  @since
+*/
+class CDclTimerAO : public CActive
+    {
+    public: // Constructors and destructor
+        CDclTimerAO( CEngine* aEngine, TInt aTimerInterval );
+        void ConstructL();
+        virtual ~CDclTimerAO();
+
+    public: // New methods
+        /**
+        * Starts the timer mode logging for a connection.
+        * @param aConnectionId Id of the connection.
+        * @since
+        * @return void.
+        */
+        void Add( const TUint& aConnectionId );
+
+        /**
+        * Stops the timer mode logging for a connection.
+        * @param aConnectionId Id of the connection.
+        * @since
+        * @return void.
+        */
+        void Remove( const TUint& aConnectionId );
+
+    private: // New methods
+        /**
+        * Starts the timer.
+        * @since
+        * @return void.
+        */
+        void NextTimerAfter();
+
+    private: // Methods from base classes
+        /**
+        * From CActive Cancels the timer.
+        * @since
+        * @return void
+        */
+        void DoCancel();
+
+        /**
+        * From CActive Writes to the log databases.
+        * @since
+        * @return void
+        */
+        void RunL();
+
+    private: // Data
+        RTimer iTimer;
+        CEngine* iEngine;
+        RArray<TUint> iConnectionIds;
+        TInt iTimerInterval;
+    };
+
+#endif // CDCLTIMERAO_H
+
+// end-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/dataconnectionlogger/inc/dcl_log.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,97 @@
+/*
+* Copyright (c) 2003-2004 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:  Writes log entries for Data Connection Logger.
+*
+*/
+
+#ifndef DATACONNECTIONLOGGERLOG_H
+#define DATACONNECTIONLOGGERLOG_H
+
+#include <e32std.h>
+#include <e32base.h>
+
+#define _DCL_ENTEREXIT_LOGGING
+#define _DCL_FUNCTIONAL_LOGGING
+
+#ifdef _DEBUG
+
+    #define LOG(a) a
+
+    #ifdef _DCL_FUNCTIONAL_LOGGING
+        #define LOGIT0(s)          {_LIT(temp, s); Log::Printf(temp);}
+        #define LOGIT1(s, a1)      {_LIT(temp, s); Log::Printf(temp, a1);}
+        #define LOGIT2(s, a1, a2)  {_LIT(temp, s); Log::Printf(temp, a1, a2);}
+    #else
+        #define LOGIT0(s)
+        #define LOGIT1(s, a1)
+        #define LOGIT2(s, a1, a2)
+    #endif
+
+    #ifdef _DCL_ENTEREXIT_LOGGING
+        _LIT(KDclLogEnterFn, "-> %S entered");
+        _LIT(KDclLogExitFn,  "<- %S returned");
+        _LIT(KDclLogExitFn1, "<- %S returned with <%d>");
+        #define LOGENTRFN(s)       {_LIT(temp, s); Log::Printf(KDclLogEnterFn, &temp);}
+        #define LOGEXITFN(s)       {_LIT(temp, s); Log::Printf(KDclLogExitFn,  &temp);}
+        #define LOGEXITFN1(s, a1)  {_LIT(temp, s); Log::Printf(KDclLogExitFn1, &temp, a1);}
+    #else
+        #define LOGENTRFN(s)
+        #define LOGEXITFN(s)
+        #define LOGEXITFN1(s, a1)
+    #endif
+
+#else
+
+    #define LOG(a)
+
+    #define LOGIT0(s)
+    #define LOGIT1(s, a1)
+    #define LOGIT2(s, a1, a2)
+
+    #define LOGENTRFN(s)
+    #define LOGEXITFN(s)
+    #define LOGEXITFN1(s, a1)
+
+#endif // _DEBUG
+
+#ifdef _DEBUG
+
+#include <flogger.h>
+
+_LIT( KLogFolder,"dcl" );
+_LIT( KLogFile,"dcl.txt" );
+
+class Log
+    {
+public:
+    static inline void Write( const TDesC& aDes );
+    static inline void Printf( TRefByValue<const TDesC> aFmt, ... );
+    };
+
+inline void Log::Write( const TDesC& aDes )
+    {
+    RFileLogger::Write( KLogFolder(), KLogFile(), EFileLoggingModeAppend, aDes );
+    }
+
+inline void Log::Printf( TRefByValue<const TDesC> aFmt, ... )
+    {
+    VA_LIST list;
+    VA_START(list,aFmt);
+    RFileLogger::WriteFormat( KLogFolder(), KLogFile(), EFileLoggingModeAppend, aFmt, list );
+    }
+
+#endif // _DEBUG
+#endif // DATACONNECTIONLOGGERLOG_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/dataconnectionlogger/inc/dclevent.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2003-2004 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:  Data Connection Logger.
+*
+*/
+
+#ifndef DCLEVENT_H
+#define DCLEVENT_H
+
+#include <cntdef.h>
+#include <logwrap.h>
+#include <logcli.h>
+
+/**
+* CEvent
+* Data structure that contains unique connection id provided by
+* connection monitor server and the log event that LogWrap-library
+* stores in log file.
+*/
+class CEvent : public CBase
+    {
+    public:
+        // Constructor
+        static CEvent* NewL();
+        static CEvent* NewLC();
+
+        // Destructor
+        virtual ~CEvent();
+
+    private: // New methods
+        CEvent();
+        void ConstructL();
+
+    private: // Data
+        TLogId      iConnectionId;
+        TInt64      iPrevDownValue;
+        TInt64      iPrevUpValue;
+        TInt        iPrevDuration;
+        CLogEvent*  iLogWrapEvent;
+
+    private: // Friend classes
+        friend class CEngine;
+    };
+
+#endif // DCLEVENT_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/dataconnectionlogger/inc/saeobserver.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,229 @@
+/*
+* 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:  Updates P&S variables: KPSUidGprsStatus and KPSUidWcdmaStatus.
+*
+*/
+
+#ifndef SAEOBSERVER_H
+#define SAEOBSERVER_H
+
+#include <e32base.h>
+#include <e32property.h>
+#include <rconnmon.h>
+
+// DEFINITIONS
+namespace
+{
+    enum TSAEConnectionType
+    {
+    ESAEUnknownConnectionType,
+    ESAEGPRSConnectionType,
+    ESAEWCDMAConnectionType
+    };
+}
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+NONSHARABLE_CLASS( CSaeObserver ) : public CBase
+{
+public:
+
+    /**
+    * Two-phased constructor.
+    */
+    static CSaeObserver* NewL( const RConnectionMonitor& aMonitor );
+
+    /**
+    * Destructor.
+    */
+    virtual ~CSaeObserver();
+
+    /**
+    * Events from Connection Monitor are handled in this function.
+    *
+    * @param aConnMonEvent The event information.
+    * @return void
+    */
+    void EventL( const CConnMonEventBase &aConnMonEvent );
+
+private:
+
+    /**
+    * C++ default constructor
+    */
+    CSaeObserver( const RConnectionMonitor& aMonitor );
+
+    /**
+    * Second phase constructor.
+    */
+    void ConstructL();
+
+    /**
+    * Handles CConnMonDeleteConnection-events.
+    *
+    * @param aEvent the event to be handled
+    * @return void
+    */
+    void HandleEConnMonDeleteConnectionL( const CConnMonDeleteConnection& aEvent );
+
+    /**
+    * Handles CConnMonNetworkStatusChange-events.
+    *
+    * @param aEvent the event to be handled
+    * @return void
+    */
+    void HandleEConnMonNetworkStatusChangeL( const CConnMonNetworkStatusChange& aEvent );
+
+    /**
+    * Handles CConnMonConnectionStatusChange-events.
+    *
+    * @param aEvent the event to be handled
+    * @return void
+    */
+    void HandleEConnMonConnectionStatusChangeL( const CConnMonConnectionStatusChange& aEvent );
+
+    /**
+    * Handles CConnMonBearerChange-events.
+    *
+    * @param aEvent the event to be handled
+    * @return void
+    */
+    void HandleEConnMonBearerChangeL( const CConnMonBearerChange& aEvent );
+
+    /**
+    * Updates P&S variables
+    *
+    * @param aVariable PS variable uid
+    * @param aState new state to be written to P&S
+    * @return void
+    */
+    void NotifyPubSub( const TUid aVariable, const TInt aState );
+
+    /**
+    * Helper function that checks if the connection is of supported
+    * connection type.
+    *
+    * @param  aConnectionId the connection ID value
+    * @return type of the connection
+    */
+    TSAEConnectionType GetConnectionType( const TUint &aConnId );
+
+    /**
+    * Helper function that checks if the connection ID is already in some
+    * connection type -specific member array. This way we can implicitly figure
+    * out the connection type of the event.
+    *
+    * @param  aConnectionId connection ID
+    * @param  aConnType type of the connection
+    * @return void
+    */
+    void IdentifyTypeFromArrays( TUint aConnectionId,
+                                 TSAEConnectionType& aConnType );
+
+    /**
+    * Return the connection array specific to connections of passed type.
+    *
+    * @param aConnType Reference to connection type. The corresponding array
+    *                  is identified primarily based on this parameter.
+    * @param aConnId   Connection ID is used in the identification of the array
+    *                  only when type is ESAEUnknownConnectionType.
+    * @return A pointer to corresponding connection array.
+    */
+    RArray<TUint>* MatchingConnArray( const TSAEConnectionType& aConnType,
+                                      TUint aConnId = 0 );
+
+    /**
+    * Update current context activity to System Agent according
+    * to connections stored in the member array:
+    *      1 connection:     KUid*Status == ESA*Active
+    *     >1 connections:    KUid*Status == ESA*MultipleActive
+    *
+    * @param  aConnType reference to connection type.
+    * @return void
+    */
+    void UpdateContextActivity( const TSAEConnectionType& aConnType );
+
+    /**
+    * If not allready defined, add connection ID to the member array.
+    *
+    * @param  aConnType Reference to connection type.
+    * @param  aConnId   Connection ID.
+    * @return void
+    */
+    void AddToConnArray( const TSAEConnectionType& aConnType,
+                         const TUint aConnId );
+
+    /**
+    * If found, remove connection ID from the member array.
+    *
+    * @param  aConnType  Reference to connection type.
+    * @param  aConnId    Connection ID.
+    * @return KErrNone if ID removed from array. Otherwise KErrNotFound.
+    */
+    TInt RemoveFromConnArray( const TSAEConnectionType& aConnType,
+                              const TUint aConnId );
+
+    /**
+    * Removes all connection ID:s from the member array.
+    *
+    * @param  aConnType connection type (ie. bearer).
+    * @return void
+    */
+    void RemoveAllFromConnArray( const TSAEConnectionType& aConnType );
+
+    /**
+    * Helper function that is used when connection count in some bearer
+    * specific array reduces to zero,
+    * Checks the state of the network and updates SA state variable accordingly.
+    *
+    * @param  aConnType connection type (ie. bearer).
+    * @return void
+    */
+    void UpdateBearerNetworkStatusL( const TSAEConnectionType& connType );
+
+private: // data
+
+    // The Connection Monitor instance to be used
+    RConnectionMonitor iMonitor;
+
+    // Count of sub connections (contexts)
+    RArray< TUint > iGPRSConnections;
+    RArray< TUint > iWCDMAConnections;
+
+    // State indicator; whether the network is UnAttached/unknown or not.
+    // This is needed to sync the gprs and network states better.
+    // Connection Monitor receives them from different sources, so
+    // they do not necessarily correlate.
+    TBool iNetworkIsUnAttached;
+
+    // State indicator; whether the network is suspended or not.
+    // This is needed to be able to return from suspend only on network
+    // events, i.e. for instance EConnMonDeleteConnection does not mean
+    // that the state of the network is not suspended anymore.
+    TBool iNetworkIsSuspended;
+
+    // State indicator of current bearer type. This is used during handling of
+    // bearer changed notifications. We have to know from what bearer we are
+    // moving to the new bearer type.
+    TInt iCurrentBearerType;
+
+    //Publish and Subscribe property for KPSUidGprsStatus and KPSUidWcdmaStatus
+    RProperty iSAProperty;
+};
+
+#endif // SAEOBSERVER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/dataconnectionlogger/rom/DataConnectionLogger.iby	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Dataconnectionlogger to ROM.
+*
+*/
+
+#ifndef __DATACONNECTIONLOGGER_IBY__
+#define __DATACONNECTIONLOGGER_IBY__
+
+#include <bldvariant.hrh>
+
+file=ABI_DIR\BUILD_DIR\Dataconnectionlogger.exe     PROGRAMS_DIR\Dataconnectionlogger.exe
+
+#ifndef __COMMDB_PROTECTION
+data=DATAZ_\private\101F6CFE\backup_registration.xml    private\101F6CFE\backup_registration.xml
+#endif
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/dataconnectionlogger/src/dcl.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,1851 @@
+/*
+* Copyright (c) 2003-2004 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:  Data Connection Logger.
+*
+*/
+
+#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include <logengdurations.h>
+#include <logwraplimits.h>
+#include <logengevents.h>
+#endif
+#include <cdbcols.h>
+#include <bldvariant.hrh> // Feature IDs
+#include <featmgr.h>
+#include <utf.h>
+
+#include <centralrepository.h>
+#include "DclPrivateCRKeys.h"
+
+#include "dcl.h"
+#include "dcl_log.h"
+
+// --------------------------------------------------------------------------
+// CEngine::CEngine
+// Constructor
+// --------------------------------------------------------------------------
+//
+CEngine::CEngine()
+        :
+        CActive( EPriorityStandard ),
+        iLogClient( NULL ),
+        iTimerInterval( KTimerInterval )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// --------------------------------------------------------------------------
+// CEngine::NewLC
+// 1st phase constructor - for stack pointers to object
+// --------------------------------------------------------------------------
+//
+CEngine* CEngine::NewLC( )
+    {
+    CEngine* self = new( ELeave ) CEngine();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CEngine::NewL
+// 1st phase constructor - for heap pointers to object
+// --------------------------------------------------------------------------
+//
+CEngine* CEngine::NewL( )
+    {
+    CEngine* self = NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CEngine::ConstructL
+// 2nd phase constructor
+// --------------------------------------------------------------------------
+//
+void CEngine::ConstructL()
+    {
+    LOGENTRFN("CEngine::ConstructL()")
+    // Renaming the thread with the real process name helps debugging panics.
+    RThread::RenameMe( KDCLName );
+
+    FeatureManager::InitializeLibL();
+
+    iConnectionMonitor.ConnectL();
+
+    User::LeaveIfError( iFsEventLog.Connect() );
+
+    iLogWrap = CLogWrapper::NewL( iFsEventLog, CActive::EPriorityStandard );
+    iLogEventQueue = new( ELeave ) CArrayPtrFlat<CEvent>( KEventStateMaxCount );
+    iLogEventQueue->Reset();
+
+    iConnections = new( ELeave ) CArrayPtrFlat<CEvent>( KEventStateMaxCount );
+    iConnections->Reset();
+
+    iCurrentLogEvent = CLogEvent::NewL();
+
+    iLogClient = CLogClient::NewL( iFsEventLog );
+
+    // Connect to ETel server
+    // The RTelServer::Connect() might not always work with the first trial,
+    // because of a coding error related to using semaphores in the method.
+
+    TInt err( KErrNotReady );
+    TInt a = 0;
+    while( a < KPhoneRetryCount && err != KErrNone )
+        {
+        if ( a )
+            {
+            User::After( KPhoneRetryTimeout ); // Don't wait on first try
+            }
+        err = iTelServer.Connect();
+        LOGIT1("Connecting to ETel server <%d>", err)
+        a++;
+        }
+    User::LeaveIfError( err );
+
+    // Try to load phone.tsy
+    TBuf<KCommsDbSvrMaxColumnNameLength> tsyName;
+    tsyName.Copy( KMmTsyModuleName );
+    err = iTelServer.LoadPhoneModule( tsyName );
+
+    if ( err == KErrNone )
+        {
+        iTSYLoaded = 1;
+        // Phone info can be retrieved with value 0 if there is only 1 phone
+        RTelServer::TPhoneInfo info;
+        User::LeaveIfError( iTelServer.GetPhoneInfo( 0, info ) );
+        User::LeaveIfError( iMobilePhone.Open( iTelServer, info.iName ) );
+
+        // Open packet service
+        err = iPacketService.Open( iMobilePhone );
+        if ( err == KErrNone )
+            {
+            iPacketServLoaded = 1;
+            }
+        }
+    if ( FeatureManager::FeatureSupported( KFeatureIdLoggerGprs ) )
+        {
+        LOGIT0("LoggerGprs supported")
+
+        // Get the Attach Mode setting from CommDb and set ETel to use that
+        // value. Must not leave if an error occurs.
+        TRAPD( leaveCode, SetAttachModeL() );
+        LOGIT1("SetAttachModeL() result: <%d>", leaveCode)
+
+        // Get the default APN from CommDb and set ETel to use that APN.
+        // Must not leave if an error occurs.
+        TRAP( leaveCode, SetAPNL() );
+        LOGIT1("SetAPNL() result: <%d>", leaveCode)
+        }
+    // Adds the event type Wlan. Otherwise the LogClient
+    // will not understand this type of event.
+    AddEventTypeL();
+
+    // Read ini file settings
+    ReadIniFile();
+
+    // Create timer mode AO
+    iDclTimerAO = new( ELeave ) CDclTimerAO ( this, iTimerInterval );
+    iDclTimerAO->ConstructL();
+
+    // Create saeObserver for updating P&S variables
+    iSaeObserver = CSaeObserver::NewL( iConnectionMonitor );
+    LOGEXITFN("CEngine::ConstructL()")
+    }
+
+// --------------------------------------------------------------------------
+// CEngine::~CEngine
+// Destructor
+// Frees reserved resources.
+// --------------------------------------------------------------------------
+//
+CEngine::~CEngine()
+    {
+    LOGENTRFN("CEngine::~CEngine()")
+    FeatureManager::UnInitializeLib();
+
+    delete iSaeObserver;
+    iSaeObserver = NULL;
+
+    // Disconnect from CM server.
+    iConnectionMonitor.Close();
+
+    Cancel();
+    // The queue could be not empty if the active object
+    // is aborted and destructed.
+    if ( iLogEventQueue != 0 )
+        {
+        iLogEventQueue->ResetAndDestroy();
+        }
+
+    if ( iConnections != 0 )
+        {
+        iConnections->ResetAndDestroy();
+        }
+
+    delete iLogWrap;
+    iLogWrap = NULL;
+
+    delete iLogEventQueue;
+    iLogEventQueue = NULL;
+
+    delete iConnections;
+    iConnections = NULL;
+
+    delete iCurrentLogEvent;
+    iCurrentLogEvent = NULL;
+
+    delete iLogEventType;
+    iLogEventType = NULL;
+
+    delete iLogClient;
+    iLogClient = NULL;
+
+    iFsEventLog.Close();
+
+    // Close "global" ETEL objects
+    if ( iPacketServLoaded == 1 )
+        {
+        iPacketService.Close();
+        }
+
+    iMobilePhone.Close();
+    iTelServer.Close();
+
+    delete iDclTimerAO;
+    iDclTimerAO = NULL;
+    LOGEXITFN("CEngine::~CEngine()")
+    }
+
+// --------------------------------------------------------------------------
+// CEngine::NotifyL
+// Request Connection Monitor server to send notifications of events.
+// --------------------------------------------------------------------------
+//
+void CEngine::NotifyL()
+    {
+    iConnectionMonitor.NotifyEventL( *this );
+    }
+
+// --------------------------------------------------------------------------
+// CEngine::EventL
+// Receives notifications of events from Connection Monitor server.
+// --------------------------------------------------------------------------
+//
+void CEngine::EventL( const CConnMonEventBase& aConnMonEvent )
+    {
+    //LOGENTRFN("CEngine::EventL()")
+    LOGIT1("-> CEngine::EventL() entered, event type (%d)", aConnMonEvent.EventType())
+    TInt err( KErrNone );
+    TUint connectionId( 0 );
+
+    // Update P&S variables first
+    if ( iSaeObserver )
+        {
+        iSaeObserver->EventL( aConnMonEvent );
+        }
+
+    switch ( aConnMonEvent.EventType() )
+        {
+        case EConnMonCreateConnection:
+            {
+            TInt bearer( 0 );
+            TRequestStatus status( KErrNotReady );
+
+            const CConnMonCreateConnection* eventCreate;
+            eventCreate  = static_cast<const CConnMonCreateConnection*>( &aConnMonEvent );
+            connectionId = eventCreate->ConnectionId();
+
+            LOGIT1("*** EConnMonCreateConnection event, id %d ***", connectionId)
+
+            // Get the bearer info from CM server.
+            err = KErrNotReady;
+            TInt a = 0;
+            while( a < KPhoneRetryCount && err != KErrNone )
+                {
+                // ConnMon might not be able to provide KBearer with the first trial.
+                if ( a )
+                    {
+                    User::After( KPhoneRetryTimeout ); // Don't wait on first try
+                    }
+                iConnectionMonitor.GetIntAttribute(
+                        connectionId,
+                        KSubConnectionId,
+                        KBearer,
+                        bearer,
+                        status );
+                User::WaitForRequest( status );
+                err = status.Int();
+                LOGIT2("Got bearer %d from ConnMon <%d>", bearer, err)
+                a++;
+                }
+            if ( err != KErrNone )
+                {
+                LOGIT1("FAILED to get KBearer from ConnMon <%d>", err)
+                break;
+                }
+
+            // Check that it is GPRS or WCDMA.
+            if ( bearer == EBearerGPRS     ||
+                 bearer == EBearerEdgeGPRS ||
+                 bearer == EBearerWCDMA )
+                {
+                LOGIT0("New internal connection")
+                // Set the uplink and downlink thresholds for this particular connection.
+                TUint threshold( iGPRSThreshold );
+                if ( bearer == EBearerWCDMA )
+                    {
+                    threshold = iWCDMAThreshold;
+                    }
+
+                err = iConnectionMonitor.SetUintAttribute(
+                        connectionId,
+                        KSubConnectionId,
+                        KDownlinkDataThreshold,
+                        threshold );
+                if ( err != KErrNone )
+                    {
+                    LOGIT1("FAILED to set KDownlinkDataThreshold to ConnMon <%d>", err)
+                    }
+
+                err = iConnectionMonitor.SetUintAttribute(
+                        connectionId,
+                        KSubConnectionId,
+                        KUplinkDataThreshold,
+                        threshold );
+                if ( err != KErrNone )
+                    {
+                    LOGIT1("FAILED to set KUplinkDataThreshold to ConnMon <%d>", err)
+                    }
+
+                TName iapName;
+                iapName.FillZ();
+                iapName.Zero();
+
+                // Get String Attribute -> KIAPName.
+                // Get IAP name from CM server.
+                err = KErrNotReady;
+                a = 0;
+                while( a < KPhoneRetryCount && err != KErrNone )
+                    {
+                    // ConnMon might not be able to provide KIAPName with the first trial.
+                    if ( a )
+                        {
+                        User::After( KPhoneRetryTimeout ); // Don't wait on first try
+                        }
+                    iConnectionMonitor.GetStringAttribute(
+                            connectionId,
+                            KSubConnectionId,
+                            KIAPName,
+                            iapName,
+                            status );
+                    User::WaitForRequest( status );
+                    err = status.Int();
+                    LOG( TBuf<KMaxName+1> iapName2( iapName ); )
+                    LOGIT2("Got KIAPName from ConnMon <%s>, <%d>", iapName2.PtrZ(), err)
+                    a++;
+                    }
+
+                if ( err == KErrNone )
+                    {
+                    LogDataAddEventL(
+                            connectionId,
+                            R_LOG_CON_CONNECTED,
+                            iapName,
+                            R_LOG_DIR_OUT,
+                            KNullDesC,
+                            KLogPacketDataEventTypeUid );
+                    }
+                else
+                    {
+                    LOGIT1("FAILED to get KIAPName from ConnMon <%d>", err)
+                    }
+                }
+            else if ( bearer == EBearerWLAN )
+                // Add EBearerExternalWLAN in order to enable DCL to log
+                // external WLAN connections, i.e. then the mobile phone
+                // functions as a WLAN modem
+                {
+                LOGIT0("New WLAN connection")
+
+                // Set the uplink and downlink thresholds for this particular connection.
+                err = iConnectionMonitor.SetUintAttribute(
+                        connectionId,
+                        KSubConnectionId,
+                        KDownlinkDataThreshold,
+                        iWLANThreshold );
+                if ( err != KErrNone )
+                    {
+                    LOGIT1("FAILED to set KDownlinkDataThreshold to ConnMon <%d>", err)
+                    }
+
+                // Even if KDownlinkDataThreshold and KUplinkDataThreshold
+                // are used here ( 4096 bytes ), the Connection Monitor
+                // server actually sets the threshold to 20480 bytes =
+                // 20 kilobytes.
+                err = iConnectionMonitor.SetUintAttribute(
+                        connectionId,
+                        KSubConnectionId,
+                        KUplinkDataThreshold,
+                        iWLANThreshold );
+                if ( err != KErrNone )
+                    {
+                    LOGIT1("FAILED to set KUplinkDataThreshold to ConnMon <%d>", err)
+                    }
+
+                TName iapName;
+                iapName.FillZ();
+                iapName.Zero();
+                // Get Uint Attribute -> KIAPId.
+                // Get IAP id from CM server.
+                err = KErrNotReady;
+                a = 0;
+                TUint iapId( 0 );
+                while( a < KPhoneRetryCount && err != KErrNone )
+                    {
+                    // ConnMon might not be able to provide KIAPId with the first trial.
+                    if ( a )
+                        {
+                        User::After( KPhoneRetryTimeout ); // Don't wait on first try
+                        }
+                    iConnectionMonitor.GetUintAttribute(
+                            connectionId,
+                            KSubConnectionId,
+                            KIAPId,
+                            iapId,
+                            status );
+                    User::WaitForRequest( status );
+                    err = status.Int();
+                    LOGIT2("Got IAP ID %d from ConnMon <%d>", iapId, err)
+                    a++;
+                    }
+                // For each new WLAN connection, we need to check the used IAP.
+                // For a normal IAP, the IAP name is used for logging, but when
+                // customer is using the 'Search for WLAN' functionality and
+                // chooses a WLAN network that is not found in any current IAP,
+                // the Easy WLAN IAP is used instead. This IAP has some internal
+                // name, e.g. 'Easy WLAN', that should not be visible anywhere
+                // in the UI. So SSID of used network is used in logging instead.
+                //
+                if ( err == KErrNone )
+                    {
+                    // Create a session with the latest version CommsDat
+                    CMDBSession* db = CMDBSession::NewLC( CMDBSession::LatestVersion() );
+                    db->SetAttributeMask( ECDProtectedWrite );
+
+                    // Load IAP record
+                    CCDIAPRecord* iapRecord = static_cast<CCDIAPRecord*>(
+                            CCDRecordBase::RecordFactoryL( KCDTIdIAPRecord ) );
+                    CleanupStack::PushL( iapRecord );
+                    iapRecord->SetRecordId( iapId );
+                    iapRecord->LoadL( *db );
+                    LOGIT0("Read IAP record from CommsDat")
+
+                    // Load wlan service record
+                    CCDWlanServiceRecord* wlanRecord = new( ELeave )CCDWlanServiceRecord(
+                            CCDWlanServiceRecord::TableIdL( *db ) );
+                    CleanupStack::PushL( wlanRecord );
+                    wlanRecord->iWlanServiceId = iapRecord->iService;
+
+                    if ( wlanRecord->FindL( *db ) )
+                        {
+                        wlanRecord->LoadL( *db );
+                        LOGIT0("Read WLAN record from CommsDat")
+
+                        if ( wlanRecord->iWLanSSID.IsNull() )
+                            {
+                            // Used IAP is the special 'Easy WLAN' IAP, so we need to
+                            // log the used WLAN network SSID instead of 'Easy WLAN'.
+                            // This can be read from the 'iWLanUsedSSID'-field.
+                            if ( !( wlanRecord->iWLanUsedSSID.IsNull() ) )
+                                {
+                                iapName = wlanRecord->iWLanUsedSSID.GetL();
+                                LOGIT1("Easy WLAN detected, got SSID <%s> from CommsDat", &iapName)
+                                }
+                            else
+                                {
+                                LOGIT0("Error, Easy WLAN detected but no SSID found from CommsDat")
+                                }
+                            }
+                        else
+                            {
+                            // A noraml WLAN IAP, read IAP name and use it for logging
+                            iapName = iapRecord->iRecordName.GetL();
+                            LOGIT1("Got IAP name <%s> from CommsDat", &iapName)
+                            }
+                        }
+                    else
+                        {
+                        LOGIT0("Error, WLAN record not found from CommsDat")
+                        }
+                    LogDataAddEventL(
+                            connectionId,
+                            R_LOG_CON_CONNECTED,
+                            iapName,
+                            R_LOG_DIR_OUT,
+                            KNullDesC,
+                            KLogWlanDataEventTypeUid );
+
+                    CleanupStack::PopAndDestroy( wlanRecord );
+                    CleanupStack::PopAndDestroy( iapRecord );
+                    CleanupStack::PopAndDestroy( db );
+                    }
+                else
+                    {
+                    LOGIT1("FAILED to get KIAPId from ConnMon", err)
+                    }
+                }
+            // Check if it is EXTERNAL GPRS or WCDMA.
+            else if ( bearer == EBearerExternalGPRS     ||
+                      bearer == EBearerExternalEdgeGPRS ||
+                      bearer == EBearerExternalWCDMA )
+                {
+                LOGIT0("New external connection")
+
+                TName apName;
+                apName.FillZ();
+                apName.Zero();
+
+                err = KErrNotReady;
+                a = 0;
+                // We loop until the retry count is reached or
+                // we get a name with length > 0
+                // This is because the connection monitor asks the PSD Fax
+                // for the name and PSD fax sometines returns an empty string
+                // without returning an error code (KErrNone is returned)
+                // However if no name for the APN has been defined this will
+                // loop for KPhoneRetryCount times for vain, but it's better than
+                // to use an empty name if one has been defined...
+                while( a < KPhoneRetryCount &&
+                        ( ( err != KErrNone ) || ( apName.Length() == 0 ) ) )
+                    {
+                    // ConnMon might not be able to provide KAccessPointName with first trial.
+                    if ( a )
+                        {
+                        User::After( KPhoneRetryTimeout ); // Don't wait on first try
+                        }
+                    // Get String Attribute -> KAccessPointName.
+                    // Get APN from CM server.
+                    iConnectionMonitor.GetStringAttribute(
+                            connectionId,
+                            KSubConnectionId,
+                            KAccessPointName,
+                            apName,
+                            status );
+                    User::WaitForRequest( status );
+                    err = status.Int();
+                    LOG( TBuf<KMaxName+1> apName2( apName ); )
+                    LOGIT2("Got KAccessPointName from ConnMon <%s>, <%d>", apName2.PtrZ(), err)
+                    a++;
+                    }
+                if ( err == KErrNone )
+                    {
+                    LogDataAddEventL(
+                            connectionId,
+                            R_LOG_CON_CONNECTED,
+                            apName,
+                            R_LOG_DIR_OUT,
+                            KNullDesC,
+                            KLogPacketDataEventTypeUid );
+                    }
+                else
+                    {
+                    LOGIT1("FAILED to get KAccessPointName from ConnMon <%d>", err)
+                    }
+                }
+            else
+                {
+                LOGIT0("Bearer neither GPRS nor WCDMA nor WLAN, ignored")
+                break;
+                }
+            break;
+            }
+
+        case EConnMonConnectionStatusChange:
+            {
+            TInt bearer( 0 );
+            TRequestStatus status( KErrNotReady );
+
+            const CConnMonConnectionStatusChange* eventStatus;
+            eventStatus  = static_cast<const CConnMonConnectionStatusChange*>( &aConnMonEvent );
+            connectionId = eventStatus->ConnectionId();
+
+            LOGIT2("*** EConnMonConnectionStatusChange event, id %d, status %d ***",
+                    connectionId, eventStatus->ConnectionStatus())
+
+            if ( eventStatus->ConnectionStatus() == KPsdFinishedActivation )
+                {
+                // Get the bearer info from CM server.
+                iConnectionMonitor.GetIntAttribute(
+                        connectionId,
+                        KSubConnectionId,
+                        KBearer,
+                        bearer,
+                        status );
+                User::WaitForRequest( status );
+                err = status.Int();
+                if ( err != KErrNone )
+                    {
+                    LOGIT1("FAILED to get bearer from ConnMon <%d>", err)
+                    break;
+                    }
+
+                // Check that it is external GPRS or WCDMA.
+                if ( bearer == EBearerExternalGPRS      ||
+                     bearer == EBearerExternalEdgeGPRS  ||
+                     bearer == EBearerExternalWCDMA )
+                    // Add EBearerLAN in order to enable debugging in wins.
+                    {
+                    LOGIT1("Status: KPsdFinishedActivation, bearer: %d (valid external), updating AP name", bearer)
+                    TName apName;
+                    apName.FillZ();
+                    apName.Zero();
+
+                    err = KErrNotReady;
+                    TInt a = 0;
+                    // We loop until the retry count is reached or
+                    // we get a name with length > 0
+                    // This is because the connection monitor asks the PSD Fax
+                    // for the name and PSD fax sometines returns an empty string
+                    // without returning an error code (KErrNone is returned)
+                    // However if no name for the APN has been defined this will
+                    // loop for KPhoneRetryCount times for vain, but it's better than
+                    // to use an empty name if one has been defined...
+                    while( a < KPhoneRetryCount &&  (
+                            ( err != KErrNone ) ||
+                            ( apName.Length() == 0 )
+                            ) )
+                        {
+                        // ConnMon might not be able to provide KAccessPointName with first trial.
+                        if ( a )
+                            {
+                            User::After( KPhoneRetryTimeout ); // Don't wait on first try
+                            }
+                        // Get String Attribute -> KAccessPointName.
+                        // Get APN from CM server.
+                        iConnectionMonitor.GetStringAttribute(
+                                connectionId,
+                                KSubConnectionId,
+                                KAccessPointName,
+                                apName,
+                                status );
+                        User::WaitForRequest( status );
+                        err = status.Int();
+                        LOG( TBuf<KMaxName+1> apName2( apName ); )
+                        LOGIT2("Got KAccessPointName from ConnMon <%s>, <%d>", apName2.PtrZ(), err)
+                        a++;
+                        }
+
+                    if ( err == KErrNone )
+                        {
+                        // We want only to change the existing entry in the log,
+                        // not add a new one, thus LogDataChangeEventL instead of
+                        // LogDataAddEventL
+                        LogDataChangeEventL( connectionId, apName );
+                        }
+                    else
+                        {
+                        LOGIT1("FAILED to get KAccessPointName from ConnMon <%d>", err)
+                        }
+                    }
+                else
+                    {
+                    LOGIT1("Status: KPsdFinishedActivation, bearer: %d (not valid external)", bearer)
+                    }
+                }
+            }
+            break;
+
+        case EConnMonDeleteConnection:
+            {
+            const CConnMonDeleteConnection* eventDelete;
+            eventDelete  = static_cast<const CConnMonDeleteConnection*>( &aConnMonEvent );
+            connectionId = eventDelete->ConnectionId();
+
+            LOGIT1("*** EConnMonDeleteConnection event, id %d ***", connectionId)
+            LOGIT1("sent: %d bytes", eventDelete->UplinkData())
+            LOGIT1("recv: %d bytes", eventDelete->DownlinkData())
+
+            // First update SharedData downlink and uplink data
+            UpdateSharedDataL(
+                    connectionId,
+                    eventDelete->UplinkData(),
+                    eventDelete->DownlinkData() );
+
+            // Then update connection specific downlink and uplink data
+            err = LogDataUpdateEventL(
+                    connectionId,
+                    R_LOG_CON_DISCONNECTED,
+                    TUid::Null(),
+                    eventDelete->UplinkData(),
+                    eventDelete->DownlinkData() );
+            if ( err != KErrNone )
+                {
+                LOGIT1("FAILED to log connection deletion <%d>", err)
+                }
+
+            // Stop timer mode for this connection.
+            // It is ok to call this even if the connection was not in timer mode.
+            iDclTimerAO->Remove( connectionId );
+
+            }
+            break;
+
+        case EConnMonDownlinkDataThreshold:
+            {
+            TInt oldDuration( 0 );
+            TInt newDuration( 0 );
+
+            const CConnMonDownlinkDataThreshold* down;
+            down = static_cast<const CConnMonDownlinkDataThreshold*>( &aConnMonEvent );
+            connectionId = down->ConnectionId();
+
+            LOGIT1("*** EConnMonDownlinkDataThreshold event, id %d ***", connectionId)
+
+            if ( !GetDuration( connectionId, oldDuration ) )
+                {
+                return;
+                }
+
+            // First update SharedData downlink data
+            UpdateSharedDataL( connectionId, 0, down->DownlinkData() );
+
+            // Then update connection specific downlink data
+            // Also uplink data has to be updated at the same time,
+            // since CEventLog function SetDataL requires both values.
+            TRequestStatus status;
+            TUint uplinkData( 0 );
+            // Get the amount uplink data from CM server
+            iConnectionMonitor.GetUintAttribute(
+                    connectionId,
+                    KSubConnectionId,
+                    KUplinkData,
+                    uplinkData,
+                    status );
+            User::WaitForRequest( status );
+            if ( status.Int() != KErrNone )
+                {
+                LOGIT1("FAILED to get KUplinkData from ConnMon <%d>", err)
+                }
+
+            // The actual status of connection is R_LOG_CON_CONNECTED, but
+            // due to the performance reasons KConnectionStatusIdNotAvailable
+            // is used here. There is no need to read LOGWRAP.RSC every time.
+            err = LogDataUpdateEventL(
+                    connectionId,
+                    KConnectionStatusIdNotAvailable,
+                    TUid::Null(),
+                    uplinkData,
+                    down->DownlinkData() );
+            if ( err != KErrNone )
+                {
+                LOGIT1("FAILED to update log event <%d>", err)
+                }
+
+            // Switch to timer if we are updating log too often
+            if ( GetDuration( connectionId, newDuration ) )
+                {
+                if ( ( newDuration - oldDuration ) < iTimerInterval )
+                    {
+                    SwitchToTimerMode( connectionId );
+                    }
+                }
+            }
+            break;
+
+        case EConnMonUplinkDataThreshold:
+            {
+            TInt oldDuration( 0 );
+            TInt newDuration( 0 );
+
+            const CConnMonUplinkDataThreshold* up;
+            up = static_cast<const CConnMonUplinkDataThreshold*>( &aConnMonEvent );
+            connectionId = up->ConnectionId();
+
+            LOGIT1("*** EConnMonUplinkDataThreshold event, id %d ***", connectionId)
+
+            if ( !GetDuration( connectionId, oldDuration ) )
+                {
+                return;
+                }
+
+            // First update SharedData uplink data
+            UpdateSharedDataL( connectionId, up->UplinkData(), 0 );
+
+            // Then update connection specific uplink data
+            // Also downlink data has to be updated at the same time,
+            // since CEventLog function SetDataL requires both values.
+            TRequestStatus status;
+            TUint downlinkData( 0 );
+
+            // Get the amount of downlink data from CM server
+            iConnectionMonitor.GetUintAttribute(
+                    connectionId,
+                    KSubConnectionId,
+                    KDownlinkData,
+                    downlinkData,
+                    status );
+            User::WaitForRequest( status );
+            if ( status.Int() != KErrNone )
+                {
+                LOGIT1("FAILED to get KDownlinkData from ConnMon <%d>", err)
+                }
+
+            // The actual status of connection is R_LOG_CON_CONNECTED, but
+            // due to the performance reasons KConnectionStatusIdNotAvailable
+            // is used here. There is no need to read LOGWRAP.RSC every time.
+            err = LogDataUpdateEventL(
+                    connectionId,
+                    KConnectionStatusIdNotAvailable,
+                    TUid::Null(),
+                    up->UplinkData(),
+                    downlinkData );
+            if ( err != KErrNone )
+                {
+                LOGIT1("FAILED to update log event <%d>", err)
+                }
+
+            // Switch to timer if we are updating log too often
+            if ( GetDuration( connectionId, newDuration ) )
+                {
+                if ( ( newDuration - oldDuration ) < iTimerInterval )
+                    {
+                    SwitchToTimerMode( connectionId );
+                    }
+                }
+            }
+            break;
+
+        default:
+            /*
+             *  By default Connection Monitor server sends all the events to
+             *  all the clients, which have subscribed to reveive events. It
+             *  is not possible to subscribe to only selected events.
+             *
+             *  Therefore these events are not written to log.
+             */
+            break;
+        }
+    LOGEXITFN("CEngine::EventL()")
+    }
+
+// --------------------------------------------------------------------------
+// CEngine::LogDataAddEventL
+// Adds log events.
+//
+// Handles also multiple data connections.
+// --------------------------------------------------------------------------
+//
+void CEngine::LogDataAddEventL(
+        TLogId       aConnectionId,
+        TInt         aRConnectionStatusId,
+        const TDesC& aRemote,
+        TInt         aLogDir,
+        const TDesC& aTelNum,
+        const TUid&  aDataEventType )
+    {
+    LOGENTRFN("CEngine::LogDataAddEventL()")
+    // It is possible to add a new logevent with a new log id for the same
+    // connection (reconnect case) assuming that all the next updates will
+    // be for the new event and not the old one.
+    TTime time;
+    time.UniversalTime();
+    TBuf<KLogMaxStatusLength> logStatusBuf;
+    TBuf<KLogMaxDirectionLength> logDirBuf;
+
+    // Set the parameters for CEvent
+    CEvent* eventUpdate = CEvent::NewL();
+    CleanupStack::PushL( eventUpdate );
+    eventUpdate->iConnectionId = aConnectionId;
+    eventUpdate->iLogWrapEvent->SetId( KGenconnLogWaitingForLogId );
+    eventUpdate->iLogWrapEvent->SetTime( time );
+    // Ignore error - string blank on error which is ok.
+    iLogWrap->Log().GetString( logStatusBuf, aRConnectionStatusId );
+    eventUpdate->iLogWrapEvent->SetStatus( logStatusBuf );
+    eventUpdate->iLogWrapEvent->SetRemoteParty( aRemote );
+    // Ignore error - string blank on error which is ok.
+    iLogWrap->Log().GetString( logDirBuf, aLogDir );
+    eventUpdate->iLogWrapEvent->SetDirection( logDirBuf );
+    eventUpdate->iLogWrapEvent->SetNumber( aTelNum );
+    eventUpdate->iLogWrapEvent->SetEventType( *CONST_CAST( TUid*, &aDataEventType ) );
+    eventUpdate->iLogWrapEvent->SetDurationType( KLogDurationValid );
+
+    // If there are no requests in the queue, then write to log immediately.
+    if ( !IsActive() && ( iLogEventQueue->Count() == 0 ) )
+        {
+        iConnections->AppendL( eventUpdate );
+        iStatus = KRequestPending;
+        iLogWrap->Log().AddEvent( *eventUpdate->iLogWrapEvent, iStatus );
+        SetActive();
+        }
+    else
+        {
+        LOGIT0("Adding event to eventqueue")
+        // Add the request to the queue, it will be processed ASAP.
+        iLogEventQueue->AppendL( eventUpdate );
+        }
+    CleanupStack::Pop( eventUpdate );
+    LOGEXITFN("CEngine::LogDataAddEventL()")
+    }
+
+// --------------------------------------------------------------------------
+// CEngine::LogDataChangeEventL
+// Changes log events. Used to update the access point name of the
+// external GPRS ie. dial-up connections.
+//
+// Handles also multiple data connections.
+// --------------------------------------------------------------------------
+//
+void CEngine::LogDataChangeEventL( TLogId aConnectionId, const TDesC& aRemote )
+    {
+    LOGENTRFN("CEngine::LogDataChangeEventL()")
+
+    // Check event queue first, if a match is found, the connection hasn't been
+    // added to iConnections array yet. Update event in queue with correct
+    // access point name.
+    for ( TInt index = 0; index < iLogEventQueue->Count(); index++ )
+        {
+        LOGIT2("Checking event queue index %d, id %d", index, iLogEventQueue->At( index )->iConnectionId)
+        if ( iLogEventQueue->At( index )->iConnectionId == aConnectionId )
+            {
+            LOGIT0("Match found, merging updated apn to queued event")
+            iLogEventQueue->At( index )->iLogWrapEvent->SetRemoteParty( aRemote );
+            LOGEXITFN("CEngine::LogDataChangeEventL()")
+            return;
+            }
+        }
+
+    // Most likely event queue was empty, so next we need to find the relevant
+    // connection from iConnections array.
+    for ( TInt index = 0; index < iConnections->Count(); index++ )
+        {
+        LOGIT2("Checking connections index %d, id %d", index, iConnections->At( index )->iConnectionId)
+
+        if ( iConnections->At( index )->iConnectionId == aConnectionId )
+            {
+            // Can update now, or need add to queue
+            if ( !IsActive() && ( iLogEventQueue->Count() == 0 ) )
+                {
+                LOGIT0("Match found, updating apn immediately")
+
+                // Update apn and initiate LogWrapper update.
+                iConnections->At( index )->iLogWrapEvent->SetRemoteParty( aRemote );
+                iStatus = KRequestPending;
+                iLogWrap->Log().ChangeEvent( *iConnections->At( index )->iLogWrapEvent, iStatus );
+                SetActive();
+                }
+            else
+                {
+                LOGIT0("Match found, adding apn update event to queue")
+
+                // Make a copy of the CLogEvent, update apn and add the updated
+                // copy to event queue.
+                CEvent* eventUpdate = CEvent::NewL();
+                CleanupStack::PushL( eventUpdate );
+
+                eventUpdate->iConnectionId = aConnectionId;
+                eventUpdate->iLogWrapEvent->CopyL( *iConnections->At( index )->iLogWrapEvent );
+                eventUpdate->iLogWrapEvent->SetRemoteParty( aRemote );
+                iLogEventQueue->AppendL( eventUpdate );
+
+                CleanupStack::Pop( eventUpdate );
+                }
+            }
+        break; // for
+        }
+    LOGEXITFN("CEngine::LogDataChangeEventL()")
+    }
+
+// --------------------------------------------------------------------------
+// CEngine::LogDataUpdateEventL
+// Updates log events.
+//
+// Handles also multiple data connections.
+// --------------------------------------------------------------------------
+//
+TInt CEngine::LogDataUpdateEventL(
+        TLogId        aConnectionId,
+        TInt          aRConnectionStatusId,
+        const TUid&   aDataEventType,
+        const TInt64& aBytesSent,
+        const TInt64& aBytesReceived )
+    {
+    LOGENTRFN("CEngine::LogDataUpdateEventL()")
+    TInt ret = KErrNone;
+    TLogId connectionId;
+
+    for ( TInt index = 0; index < iConnections->Count(); index++ )
+        {
+        connectionId = iConnections->At( index )->iConnectionId;
+
+        if ( connectionId == aConnectionId )
+            {
+            // Check if there is no request pending, then start it. Otherwise
+            // wait until the previous request is finished and keep going on.
+            if ( !IsActive() && ( iLogEventQueue->Count() == 0 ) )
+                {
+                // Request update straight on.
+                UpdateLogEventParamL(
+                        aConnectionId,
+                        *iConnections->At( index )->iLogWrapEvent,
+                        aRConnectionStatusId,
+                        aDataEventType,
+                        aBytesSent,
+                        aBytesReceived );
+
+                iConnections->At( index )->iPrevDuration =
+                        iConnections->At( index )->iLogWrapEvent->Duration();
+
+                iLogWrap->Log().ChangeEvent( *iConnections->At( index )->iLogWrapEvent, iStatus );
+                SetActive();
+                }
+            else
+                {
+                LOGIT0("Adding event update to queue")
+                // Add the request to the queue, it will be processed ASAP.
+                CEvent* eventUpdate = CEvent::NewL();
+                CleanupStack::PushL( eventUpdate );
+                eventUpdate->iConnectionId = aConnectionId;
+                eventUpdate->iLogWrapEvent->CopyL( *iConnections->At( index )->iLogWrapEvent );
+                ret = UpdateLogEventParamL(
+                        aConnectionId,
+                        *eventUpdate->iLogWrapEvent,
+                        aRConnectionStatusId,
+                        aDataEventType,
+                        aBytesSent,
+                        aBytesReceived );
+
+                iConnections->At( index )->iPrevDuration =
+                        eventUpdate->iLogWrapEvent->Duration();
+
+                // Add to the queue.
+                iLogEventQueue->AppendL( eventUpdate );
+                CleanupStack::Pop( eventUpdate );
+                }
+            }
+        }
+    LOGEXITFN1("CEngine::LogDataUpdateEventL()", ret)
+    return ret;
+    }
+
+// --------------------------------------------------------------------------
+// CEngine::UpdateLogEventParamL
+// Updates log event parameters.
+// --------------------------------------------------------------------------
+//
+TInt CEngine::UpdateLogEventParamL(
+        TLogId        /*aConnectionId*/,
+        CLogEvent&    aLogEvent,
+        TInt          aRConnectionStatusId,
+        const TUid&   aDataEventType,
+        const TInt64& aBytesSent,
+        const TInt64& aBytesReceived )
+    {
+    LOGENTRFN("CEngine::UpdateLogEventParamL()")
+    TInt ret( KErrNone );
+    TTime now;
+    TTimeIntervalSeconds seconds( 0 );
+    now.UniversalTime();
+
+    if ( now.SecondsFrom( aLogEvent.Time(), seconds ) != KErrNone )
+        {
+        seconds = 0; // No duration available -> error.
+        }
+    aLogEvent.SetDuration( seconds.Int() );
+
+    if ( KConnectionStatusIdNotAvailable != aRConnectionStatusId )
+        {
+        // Status needs to be updated.
+        TBuf<KLogMaxStatusLength> logStatusBuf;
+        // Ignore error - string blank on error which is ok.
+        iLogWrap->Log().GetString( logStatusBuf, aRConnectionStatusId );
+        aLogEvent.SetStatus( logStatusBuf );
+        }
+    if ( aDataEventType != TUid::Null() )
+        {
+        aLogEvent.SetEventType( *CONST_CAST( TUid*, &aDataEventType ) );
+        }
+    // Check if data metrics need to be updated.
+    TInt64 byteInfoNotAvailable( KBytesInfoNotAvailable );
+    if ( ( aBytesReceived != byteInfoNotAvailable ) &&
+         ( aBytesSent     != byteInfoNotAvailable ) )
+        {
+        TBuf8<KDatabufferSize> dataBuffer;
+        dataBuffer.Num( aBytesSent );
+        dataBuffer.Append( TChar(',') );
+        dataBuffer.AppendNum( aBytesReceived );
+        TRAP( ret, aLogEvent.SetDataL( dataBuffer ) );
+        }
+    LOGEXITFN1("CEngine::UpdateLogEventParamL()", ret)
+    return ret;
+    }
+
+// --------------------------------------------------------------------------
+// CEngine::UpdateSharedDataL
+// Updates cumulative counters of SharedData.
+// --------------------------------------------------------------------------
+//
+void CEngine::UpdateSharedDataL(
+        TLogId aConnectionId,
+        const TInt64& aBytesSent,
+        const TInt64& aBytesReceived )
+    {
+    LOGENTRFN("CEngine::UpdateSharedDataL()")
+    TInt64   sent( 0 );
+    TInt64   received( 0 );
+    TInt64   increment( 0 );
+    TLogId   connId;
+    TBuf<50> receivedBuf,  sentBuf;
+    TBuf<50> receivedBuf2, sentBuf2;
+    TUid     dataEventType = KLogPacketDataEventTypeUid;
+    TInt     err, index;
+
+    // First find out the data event type (GPRS or WLAN)
+    for ( index = 0; index < iConnections->Count(); index++ )
+        {
+        connId = iConnections->At( index )->iConnectionId;
+        if ( connId == aConnectionId )
+            {
+            dataEventType = iConnections->At( index )->iLogWrapEvent->EventType();
+
+            if ( aBytesSent == 0 && aBytesReceived == 0 )
+                {
+                break;
+                }
+
+            CRepository* repository = NULL;
+            repository = CRepository::NewL( KCRUidDCLLogs );
+            if ( repository )
+                {
+                err = repository->StartTransaction( CRepository::EConcurrentReadWriteTransaction );
+                if ( err )
+                    {
+                    LOGIT1("UpdateSharedDataL: StartTransaction() returned error: %d", err)
+                    delete repository;
+                    break;
+                    }
+
+                if ( aBytesReceived != 0 )
+                    {
+                    // Read current value.
+                    if ( dataEventType == KLogPacketDataEventTypeUid )
+                        {
+                        err = repository->Get( KLogsGPRSReceivedCounter, receivedBuf );
+                        }
+                    else
+                        {
+                        err = repository->Get( KLogsWLANReceivedCounter, receivedBuf );
+                        }
+                    if ( err == KErrNone )
+                        {
+                        TLex lex( receivedBuf );
+                        lex.Val( received );
+                        }
+                    else
+                        {
+                        LOGIT1("UpdateSharedDataL: aBytesReceived: Get() returned error: %d", err)
+                        repository->CancelTransaction();
+                        delete repository;
+                        break;
+                        }
+
+                    // Calculate the increment
+                    increment = aBytesReceived - iConnections->At( index )->iPrevDownValue;
+                    // And add _only_ the increment
+                    received += increment;
+                    // Update the previous downlink value
+                    iConnections->At( index )->iPrevDownValue = aBytesReceived;
+                    receivedBuf2.Num( received );
+
+                    // Store updated value.
+                    if ( dataEventType == KLogPacketDataEventTypeUid )
+                        {
+                        err = repository->Set( KLogsGPRSReceivedCounter, receivedBuf2 );
+                        }
+                    else
+                        {
+                        err = repository->Set( KLogsWLANReceivedCounter, receivedBuf2 );
+                        }
+                    if ( err != KErrNone )
+                        {
+                        LOGIT1("UpdateSharedDataL: aBytesReceived: Set() returned error: %d", err)
+                        repository->CancelTransaction();
+                        delete repository;
+                        break;
+                        }
+                    }
+                if ( aBytesSent != 0 )
+                    {
+                    // Read current value.
+                    if ( dataEventType == KLogPacketDataEventTypeUid )
+                        {
+                        err = repository->Get( KLogsGPRSSentCounter, sentBuf );
+                        }
+                    else
+                        {
+                        err = repository->Get( KLogsWLANSentCounter, sentBuf );
+                        }
+                    if ( err == KErrNone )
+                        {
+                        TLex lex( sentBuf );
+                        lex.Val( sent );
+                        }
+                    else
+                        {
+                        LOGIT1("UpdateSharedDataL: aBytesSent: Get() returned error: %d", err)
+                        repository->CancelTransaction();
+                        delete repository;
+                        break;
+                        }
+
+                    // Calculate the increment
+                    increment = aBytesSent - iConnections->At( index )->iPrevUpValue;
+                    // And add _only_ the increment
+                    sent += increment;
+                    // Update the previous uplink value
+                    iConnections->At( index )->iPrevUpValue = aBytesSent;
+                    sentBuf2.Num( sent );
+
+                    // Store updated value.
+                    if ( dataEventType == KLogPacketDataEventTypeUid )
+                        {
+                        err = repository->Set( KLogsGPRSSentCounter, sentBuf2 );
+                        }
+                    else
+                        {
+                        err = repository->Set( KLogsWLANSentCounter, sentBuf2 );
+                        }
+                    if ( err != KErrNone )
+                        {
+                        LOGIT1("UpdateSharedDataL: aBytesSent: Set() returned error: %d", err)
+                        repository->CancelTransaction();
+                        delete repository;
+                        break;
+                        }
+                    }
+                TUint32 keyInfo;
+                err = repository->CommitTransaction( keyInfo );
+                if ( err != KErrNone )
+                    {
+                    LOGIT2("UpdateSharedDataL: repository->CommitTransaction returned error: %d, %d", err, keyInfo)
+                    repository->CancelTransaction();
+                    delete repository;
+                    break;
+                    }
+                }
+            delete repository;
+            break;
+            }
+        } // for
+    LOGEXITFN("CEngine::UpdateSharedDataL()")
+    }
+
+// --------------------------------------------------------------------------
+// CEngine::RunL
+// Handles the completion of an asynchronous request.
+// This function is defined as pure virtual in CActive and any class derived
+// from CActive must define and implement it.
+// --------------------------------------------------------------------------
+//
+void CEngine::RunL()
+    {
+    LOGENTRFN("CEngine::RunL()")
+
+    // Request has completed.
+    // Delete the disconnected element of iConnections, if it has already been
+    // logged and the connection has been disconnected
+    if ( iConnections->Count() > 0 )
+        {
+        LOGIT1("RunL: iConnections->Count() = %d (>0), clearing old connections", iConnections->Count())
+
+        // Ignore error - string blank on error which is ok.
+        TBuf<KLogMaxStatusLength> logStatusBuf;
+        iLogWrap->Log().GetString( logStatusBuf, R_LOG_CON_DISCONNECTED );
+
+        for ( TInt i = iConnections->Count()-1; i >= 0; i-- )
+            {
+            CEvent* elemPtr = iConnections->At( i );
+
+            __ASSERT_DEBUG( ( elemPtr != NULL ), User::Panic( KDCLName, KErrNotReady ) );
+            LOGIT2("Checking index %d, connection id %d", i, elemPtr->iConnectionId)
+            if ( logStatusBuf == elemPtr->iLogWrapEvent->Status() )
+                {
+                LOGIT0("Status: disconnected, removing")
+
+                // Remove the pointer from the queue.
+                iConnections->Delete( i );
+                // Delete the completed CEvent
+                delete elemPtr;
+                }
+            }
+        }
+
+    // Delete completed event and check if there is a next event pending.
+    // If LogEng is not supported, a dummy logeng just returns error straight
+    // on, but we carry on doing all the requests.
+    if ( iLogEventQueue->Count() > 0 )
+        {
+        LOGIT1("RunL: iLogEventQueue->Count() = %d (>0), processing next event", iLogEventQueue->Count())
+
+        CEvent* nextEventPtr = iLogEventQueue->At( 0 );
+        __ASSERT_DEBUG( ( nextEventPtr != NULL ), User::Panic( KDCLName, KErrNotReady ) );
+        // In general, before the elements of this kind of array are deleted,
+        // the CBase derived objects to which those elements point should be
+        // destroyed. If they are not destroyed, then a separate copy of
+        // those elements (i.e. the pointers), must be taken to avoid
+        // orphaning the CBase derived objects on the heap.
+        iCurrentLogEvent->CopyL( *nextEventPtr->iLogWrapEvent );
+        iLogWrap->Log().ChangeEvent( *iCurrentLogEvent, iStatus );
+        SetActive();
+        // Remove the pointer from the queue.
+        iLogEventQueue->Delete( 0 );
+        // Delete the completed CEvent
+        delete nextEventPtr;
+        }
+    LOGEXITFN("CEngine::RunL()")
+    }
+
+// --------------------------------------------------------------------------
+// CEngine::DoCancel
+// Handles a cancel request to the service provider.
+// This function is defined as pure virtual in CActive and any class derived
+// from CActive must define and implement it.
+// --------------------------------------------------------------------------
+//
+void CEngine::DoCancel()
+    {
+    if ( iLogWrap )
+        {
+        iLogWrap->Log().Cancel();
+        }
+    // Usually you do not need to cancel an update on events, just let them
+    // go and be removed from the queue when update is done.
+    // If we cancel the logger, most likely the whole Logger Object will be
+    // destroyed.
+}
+
+// --------------------------------------------------------------------------
+// CEngine::SetAttachModeL
+// Gets the Attach Mode setting from CommDb and sets ETel to use that value.
+// --------------------------------------------------------------------------
+//
+void CEngine::SetAttachModeL() const
+    {
+    LOGENTRFN("CEngine::SetAttachModeL()")
+
+    TUint32 commdbAM = RPacketService::EAttachWhenNeeded;
+    TRequestStatus status;
+    RPacketService::TAttachMode etelAM;
+    CCommsDatabase* commDb = NULL;
+
+    if ( iPacketServLoaded != 1 )
+        {
+        LOGIT0("RPacketService not loaded")
+        return;
+        }
+
+    commDb = CCommsDatabase::NewL();
+
+    // Get the Attach Mode setting from CommDb
+    TRAPD( error, commDb->GetGlobalSettingL( TPtrC( GPRS_ATTACH_MODE ), commdbAM ) );
+    switch ( error )
+        {
+        case KErrNone:
+            // Attach Mode setting found in CommDb
+            break;
+        case KErrNotFound:
+            {
+            // Attach Mode setting not found in CommDb, it is set as EAttachWhenNeeded
+            TRAPD( leaveCode, commDb->SetGlobalSettingL( TPtrC( GPRS_ATTACH_MODE ), commdbAM ) );
+            if ( leaveCode )
+                {
+                LOGIT1("FAILED SetGlobalSettingL() <%d>", leaveCode)
+                }
+            }
+            break;
+        default:
+            {
+            LOGIT1("FAILED to get attach mode from CommDb <%d>", error)
+            }
+            break;
+        }
+
+    // And set ETel to use the Attach Mode value from CommDb
+    etelAM = STATIC_CAST( RPacketService::TAttachMode, commdbAM );
+
+    TInt err( KErrNotReady );
+    TInt a = 0;
+    while ( a < KPhoneRetryCount && err != KErrNone )
+        {
+        if ( a )
+            {
+            User::After( KPhoneRetryTimeout ); // Don't wait on first try
+            }
+        iPacketService.SetAttachMode( status, etelAM );
+        User::WaitForRequest( status );
+        err = status.Int();
+        LOGIT1("Set attach Mode to ETel <%d>", err)
+        a++;
+        }
+    if ( err != KErrNone )
+        {
+        LOGIT1("FAILED to set attach mode to ETel <%d>", err)
+        }
+    delete commDb;
+    LOGEXITFN("CEngine::SetAttachModeL()")
+    }
+
+// --------------------------------------------------------------------------
+// CEngine::SetAPNL
+// Gets the default Access Point Name from CommDb and
+// sets ETel to use that APN.
+// --------------------------------------------------------------------------
+//
+void CEngine::SetAPNL() const
+    {
+    LOGENTRFN("CEngine::SetAPNL()")
+
+    TBuf<KMaxAPName> apName;
+    TRequestStatus status( KErrNotReady );
+    CCommsDatabase* commDb = NULL;
+
+    if ( iPacketServLoaded != 1 )
+        {
+        LOGIT0("RPacketService not loaded")
+        return;
+        }
+
+    commDb = CCommsDatabase::NewL();
+    CleanupStack::PushL( commDb );
+
+    // Get the default Access Point Name from CommDb
+    CCommsDbTableView* table = commDb->OpenTableLC( TPtrC( DEFAULT_GPRS ) );
+
+    table->GotoFirstRecord();
+
+    //If APN is not initialized, ReadTextL will leave
+    apName.SetLength( 0 );
+
+    table->ReadTextL( TPtrC( DEFAULT_GPRS_APN ), apName );
+
+    CleanupStack::PopAndDestroy( table );
+
+    // Get DefaultContextParams from ETel
+    RPacketContext::TContextConfigGPRS* getParams = NULL;
+    getParams = new( ELeave ) RPacketContext::TContextConfigGPRS();
+
+    TPckg<RPacketContext::TContextConfigGPRS> getParamsPckg( *getParams );
+
+    TInt err( KErrNotReady );
+    TInt a = 0;
+    while ( a < KPhoneRetryCount && err != KErrNone )
+        {
+        // The RPacketService::GetDefaultContextParams() does not always work
+        // with the first trial, it might return KErrNotReady.
+        if ( a )
+            {
+            User::After( KPhoneRetryTimeout ); // Don't wait on first try
+            }
+        iPacketService.GetDefaultContextParams( status, getParamsPckg );
+        User::WaitForRequest( status );
+        err = status.Int();
+        LOGIT1("Got DefaultContextParams from ETel <%d>", err)
+        a++;
+        }
+
+    if ( err != KErrNone )
+        {
+        LOGIT1("FAILED to get DefaultContextParams from ETel <%d>", err)
+        }
+
+    // Replace ETel APN with CommDb APN
+    ReplaceAPN( getParams->iAccessPointName, apName );
+
+    // Set DefaultContextParams to ETel
+    iPacketService.SetDefaultContextParams( status, getParamsPckg );
+    User::WaitForRequest( status );
+
+    err = status.Int();
+    if ( err != KErrNone )
+        {
+        LOGIT1("FAILED to set DefaultContextParams to ETel <%d>", err)
+        }
+
+    delete getParams;
+    CleanupStack::PopAndDestroy( commDb );
+    LOGEXITFN("CEngine::SetAPNL()")
+    }
+
+// --------------------------------------------------------------------------
+// CEngine::AddEventTypeL
+// Adds the event type Wlan. Otherwise the LogClient
+// will not understand this type of event.
+// --------------------------------------------------------------------------
+//
+void CEngine::AddEventTypeL()
+    {
+    iLogEventType = CLogEventType::NewL();
+    iLogEventType->SetUid( KLogWlanDataEventTypeUid );
+    iLogEventType->SetDescription( _L("Wlan") );
+    iLogEventType->SetLoggingEnabled( ETrue );
+
+    iStatus = KRequestPending;
+    iLogClient->AddEventType( *iLogEventType, iStatus );
+
+    SetActive();
+    }
+
+// -----------------------------------------------------------------------------
+// CEngine::ReplaceAPN
+// This method will be used in platforms where ETel APN (aResult) is UNICODE.
+// -----------------------------------------------------------------------------
+//
+void CEngine::ReplaceAPN( TDes& aResult, const TDesC& aName ) const
+    {
+    aResult = aName;
+    }
+
+// -----------------------------------------------------------------------------
+// CEngine::ReplaceAPN
+// This method will be used in platforms where ETel APN (aResult) is UTF8.
+// -----------------------------------------------------------------------------
+//
+void CEngine::ReplaceAPN( TDes8& aResult, const TDesC& aName ) const
+    {
+    CnvUtfConverter::ConvertFromUnicodeToUtf8( aResult, aName );
+    }
+
+// -----------------------------------------------------------------------------
+// CEngine::LogDataInTimerModeL
+// -----------------------------------------------------------------------------
+//
+TInt CEngine::LogDataInTimerModeL( const TUint aConnectionId )
+    {
+    LOGENTRFN("CEngine::LogDataInTimerModeL()")
+    TInt index( 0 );
+    TInt64 prevDown( 0 );
+    TInt64 prevUp( 0 );
+
+    TInt count( iConnections->Count() );
+
+    LOGIT1("LogDataInTimerMode, id %d", aConnectionId)
+
+    // Does the connection still exist
+    for ( index = 0; index < count; index++ )
+        {
+        TUint connId( iConnections->At( index )->iConnectionId );
+
+        if ( connId == aConnectionId )
+            {
+            prevDown = iConnections->At(index)->iPrevDownValue;
+            prevUp = iConnections->At(index)->iPrevUpValue;
+            break;
+            }
+        }
+
+    if ( index == count )
+        {
+        return KErrNotFound;
+        }
+
+    // Read data volumes
+    TRequestStatus status;
+    TUint uplinkData( 0 );
+    TUint downlinkData( 0 );
+
+    // Get the amount uplink data from CM server
+    iConnectionMonitor.GetUintAttribute(
+            aConnectionId,
+            KSubConnectionId,
+            KUplinkData,
+            uplinkData,
+            status );
+    User::WaitForRequest( status );
+
+    if ( status.Int() != KErrNone )
+        {
+        LOGIT1("FAILED to get KUplinkData from ConnMon <%d>", status.Int())
+        }
+
+    // Get the amount of downlink data from CM server
+    iConnectionMonitor.GetUintAttribute(
+            aConnectionId,
+            KSubConnectionId,
+            KDownlinkData,
+            downlinkData,
+            status );
+    User::WaitForRequest( status );
+
+    if ( status.Int() != KErrNone )
+        {
+        LOGIT1("FAILED to get KDownlinkData from ConnMon <%d>", status.Int())
+        }
+
+    // Update SharedData downlink and uplink data
+    UpdateSharedDataL( aConnectionId, uplinkData, downlinkData );
+
+    TInt ret = KErrNone;
+    // The actual status of connection is R_LOG_CON_CONNECTED, but
+    // due to the performance reasons KConnectionStatusIdNotAvailable
+    // is used here. There is no need to read LOGWRAP.RSC every time.
+    ret = LogDataUpdateEventL(
+            aConnectionId,
+            KConnectionStatusIdNotAvailable,
+            TUid::Null(),
+            uplinkData,
+            downlinkData );
+    if ( ret != KErrNone )
+        {
+        LOGIT1("FAILED to update log data (timer mode) <%d>", ret)
+        }
+
+    // Check data volumes
+    TUint threshold( iGPRSThreshold );
+
+    ret = GetDefaultThreshold( aConnectionId, threshold );
+
+    if ( ret != KErrNotFound )
+        {
+        // If the increase both in uplink and downlink data volume is less than threshold/2
+        // switch the connection back to the threshold mode.
+        if ( ( ( iConnections->At(index)->iPrevDownValue - prevDown ) < threshold/2 )
+               &&
+               ( ( iConnections->At(index)->iPrevUpValue - prevUp ) < threshold/2 ))
+            {
+            SwitchToThresholdMode( aConnectionId, threshold );
+
+            // Return an error to stop the timer mode for this connection
+            ret = KErrCancel;
+            }
+        else
+            {
+            ret = KErrNone;
+            }
+        }
+    LOGEXITFN1("CEngine::LogDataInTimerModeL()", ret)
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CEngine::SwitchToThresholdMode
+// -----------------------------------------------------------------------------
+//
+void CEngine::SwitchToThresholdMode( const TUint aConnectionId, const TUint aThreshold  )
+    {
+    LOGENTRFN("CEngine::SwitchToThresholdMode()")
+    // Set thresholds to start the threshold mode
+    TUint threshold( aThreshold );
+
+    if ( threshold == 0 )
+        {
+        TInt ret = GetDefaultThreshold( aConnectionId, threshold );
+
+        if ( ret == KErrNotFound )
+            {
+            // Connection has closed
+            return;
+            }
+        }
+
+    iConnectionMonitor.SetUintAttribute(
+            aConnectionId,
+            KSubConnectionId,
+            KDownlinkDataThreshold,
+            threshold );
+
+    iConnectionMonitor.SetUintAttribute(
+            aConnectionId,
+            KSubConnectionId,
+            KUplinkDataThreshold,
+            threshold );
+
+    LOGIT1("Switched to threshold mode, id %d", aConnectionId)
+
+    LOGEXITFN("CEngine::SwitchToThresholdMode()")
+    }
+
+// -----------------------------------------------------------------------------
+// CEngine::SwitchToTimerMode
+// -----------------------------------------------------------------------------
+//
+void CEngine::SwitchToTimerMode( const TUint aConnectionId )
+    {
+    LOGENTRFN("CEngine::SwitchToTimerMode()")
+    if ( iDclTimerAO != 0 )
+        {
+        // Set thresholds to zero.
+        iConnectionMonitor.SetUintAttribute(
+                aConnectionId,
+                KSubConnectionId,
+                KDownlinkDataThreshold,
+                0 );
+
+        iConnectionMonitor.SetUintAttribute(
+                aConnectionId,
+                KSubConnectionId,
+                KUplinkDataThreshold,
+                0 );
+
+        iDclTimerAO->Add( aConnectionId );
+
+        LOGIT1("Switched to timer mode, id %d", aConnectionId)
+        }
+    LOGEXITFN("CEngine::SwitchToTimerMode()")
+    }
+
+// -----------------------------------------------------------------------------
+// CEngine::GetDuration
+// Retrieves iPrevDuration from connection in connection table with matching id.
+// -----------------------------------------------------------------------------
+//
+TBool CEngine::GetDuration( const TUint aConnectionId, TInt& aDuration )
+    {
+    TInt index( 0 );
+
+    for ( index = 0; index < iConnections->Count(); index++ )
+        {
+        TUint connId( iConnections->At( index )->iConnectionId );
+
+        if ( aConnectionId == connId )
+            {
+            aDuration = iConnections->At( index )->iPrevDuration;
+            return ETrue;
+            }
+        }
+
+    LOGIT1("FAILED to get duration for connection id %d", aConnectionId)
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CEngine::GetDefaultThreshold
+// -----------------------------------------------------------------------------
+//
+TInt CEngine::GetDefaultThreshold( const TUint aConnectionId, TUint& aThreshold )
+    {
+    LOGENTRFN("CEngine::GetDefaultThreshold()")
+    TInt bearer( 0 );
+    TRequestStatus status( 0 );
+
+    // Initialize to the smallest value
+    aThreshold = iGPRSThreshold;
+
+    iConnectionMonitor.GetIntAttribute(
+            aConnectionId,
+            KSubConnectionId,
+            KBearer,
+            bearer,
+            status );
+    User::WaitForRequest( status );
+
+    if ( status.Int() != KErrNotFound )
+        {
+        if ( bearer == EBearerWCDMA || bearer == EBearerExternalWCDMA )
+            {
+            aThreshold = iWCDMAThreshold;
+            }
+        else if ( bearer == EBearerWLAN || bearer == EBearerExternalWLAN )
+            {
+            aThreshold = iWLANThreshold;
+            }
+        else
+            {
+            aThreshold = iGPRSThreshold;
+            }
+        }
+
+    LOGEXITFN1("CEngine::GetDefaultThreshold()", status.Int())
+    return status.Int();
+    }
+
+// -----------------------------------------------------------------------------
+// CEngine::ReadIniFile
+// -----------------------------------------------------------------------------
+//
+void CEngine::ReadIniFile()
+    {
+    LOGENTRFN("CEngine::ReadIniFile()")
+    TInt err( KErrNone );
+    TInt value( 0 );
+
+    // Initialize parameters to defaults because they might not be in SharedData.
+    iTimerInterval  = KTimerInterval;
+    iGPRSThreshold  = KGPRSDataThreshold;
+    iWCDMAThreshold = KWCDMADataThreshold;
+    iWLANThreshold  = KWLANDataThreshold;
+
+    // Connecting and initialization:
+    CRepository* repository = NULL;
+
+    TRAPD( leaveCode, repository = CRepository::NewL( KCRUidDCL ) );
+
+    if ( leaveCode )
+        {
+        LOGIT1("CRepository::NewL() FAILED: %d", leaveCode)
+        // Go on using defaults
+        return;
+        }
+
+    err = repository->Get( KDCLGprsThreshold, value );
+
+    if ( err == KErrNone )
+        {
+        iGPRSThreshold = value;
+        }
+    else
+        {
+        LOGIT1("Reading KDCLGprsThreshold from CRepository  FAILED: %d", err)
+        }
+
+    err = repository->Get( KDCLWcdmaThreshold, value );
+
+    if ( err == KErrNone )
+        {
+        iWCDMAThreshold = value;
+        }
+     else
+        {
+        LOGIT1("Reading KDCLWcdmaThreshold from CRepository  FAILED: %d", err)
+        }
+
+    err = repository->Get( KDCLWlanThreshold, value );
+
+    if ( err == KErrNone )
+        {
+        iWLANThreshold = value;
+        }
+    else
+        {
+        LOGIT1("Reading KDCLWlanThreshold from CRepository  FAILED: %d", err)
+        }
+
+    err = repository->Get( KDCLTimerInterval, value );
+
+    if ( err == KErrNone )
+        {
+        iTimerInterval = value;
+        }
+    else
+        {
+        LOGIT1("Reading KDCLTimerInterval from CRepository  FAILED: %d", err)
+        }
+
+    // Closing connection:
+    delete repository;
+    LOGEXITFN("CEngine::ReadIniFile()")
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/dataconnectionlogger/src/dclTimer.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,159 @@
+/*
+* Copyright (c) 2004 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:  Timer active object needed in logging data in timer mode.
+*
+*/
+
+#include <e32base.h>
+
+#include "dclTimer.h"
+#include "dcl_log.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CDclTimerAO::CDclTimerAO
+// -----------------------------------------------------------------------------
+//
+CDclTimerAO::CDclTimerAO( CEngine* aEngine, TInt aTimerInterval )
+    :
+    CActive( CActive::EPriorityStandard ),
+    iEngine( aEngine ),
+    iTimerInterval( aTimerInterval )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CDclTimerAO::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CDclTimerAO::ConstructL()
+    {
+    CActiveScheduler::Add( this );
+
+    User::LeaveIfError( iTimer.CreateLocal() );
+
+    iConnectionIds.Reset();
+    }
+
+// Destructor
+CDclTimerAO::~CDclTimerAO()
+    {
+    Cancel();
+    iTimer.Close();
+    iConnectionIds.Close();
+    }
+
+// -----------------------------------------------------------------------------
+// CDclTimerAO::Add
+// -----------------------------------------------------------------------------
+//
+void CDclTimerAO::Add( const TUint& aConnectionId )
+    {
+    iConnectionIds.Append( aConnectionId );
+
+    NextTimerAfter();
+    }
+
+// -----------------------------------------------------------------------------
+// CDclTimerAO::Remove
+// -----------------------------------------------------------------------------
+//
+void CDclTimerAO::Remove( const TUint& aConnectionId )
+    {
+    for ( TInt i=0; i < iConnectionIds.Count(); i++ )
+        {
+        if ( aConnectionId == iConnectionIds[ i ] )
+            {
+            // A connection has switched to threshold mode
+            iConnectionIds.Remove( i );
+            return;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CDclTimerAO::NextTimerAfter
+// -----------------------------------------------------------------------------
+//
+void CDclTimerAO::NextTimerAfter()
+    {
+    if ( !IsActive() )
+        {
+        iTimer.After( iStatus, iTimerInterval * 1000000 );
+        SetActive();
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CDclTimerAO::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CDclTimerAO::DoCancel()
+    {
+    if ( IsActive() )
+        {
+        iTimer.Cancel();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CDclTimerAO::RunL
+// -----------------------------------------------------------------------------
+//
+void CDclTimerAO::RunL()
+    {
+    TInt count( 0 );
+
+    if ( iStatus.Int() == KErrNone )
+        {
+        LOG( Log::Printf( _L("Timer EVENT\n")));
+
+        // Log all connections that are in timer mode
+        count = iConnectionIds.Count();
+
+        for ( TInt i = ( count - 1 ); i >= 0; i-- )
+            {
+            TInt ret = iEngine->LogDataInTimerModeL( iConnectionIds[ i ] );
+
+            if ( ret != KErrNone )
+                {
+                // A connection has switched to threshold mode
+                iConnectionIds.Remove( i );
+                }
+            }
+
+        // Go on with the timer if there are still connections in timer mode
+        if ( iConnectionIds.Count() > 0 )
+            {
+            NextTimerAfter();
+            }
+        }
+    else
+        {
+        // Switch all connections back to threshold mode beacause timer failed
+        LOG( Log::Printf( _L("Timer FAILED: %d.\n"), iStatus.Int()));
+
+        count = iConnectionIds.Count();
+
+        for ( TInt i = ( count - 1 ); i >= 0; i-- )
+            {
+            iEngine->SwitchToThresholdMode( iConnectionIds[ i ] );
+            iConnectionIds.Remove( i );
+            }
+        }
+    }
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/dataconnectionlogger/src/dcl_dll.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2003-2004 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:  Data Connection Logger.
+*
+*/
+
+#include <e32std.h>
+#include <e32base.h>
+#include "dcl.h"
+#include "dcl_log.h"
+
+// --------------------------------------------------------------------------
+// GLDEF_C TInt E32Main
+//
+// Returns: Always 0
+// --------------------------------------------------------------------------
+//
+GLDEF_C TInt E32Main()
+    {
+    __UHEAP_MARK;
+    CTrapCleanup* cleanup = CTrapCleanup::New();
+    CEngine* iapConnections = NULL;
+
+    if ( !cleanup )
+        {
+        LOGIT0("FAILED to create CTrapCleanup")
+        User::Panic( KDCLName, ECannotCreateCleanup );
+        }
+
+    CActiveScheduler* dclScheduler = NULL;
+
+    dclScheduler = new CActiveScheduler();
+
+    if ( !dclScheduler )
+        {
+        LOGIT0("FAILED to create CActiveScheduler")
+        User::Panic( KDCLName, ECannotCreateActiveScheduler );
+        }
+
+    CActiveScheduler::Install( dclScheduler );
+
+    TRAPD( leaveCode, iapConnections = CEngine::NewL() );
+    if ( leaveCode )
+        {
+        LOGIT1("FAILED to create CEngine <%d>", leaveCode)
+        User::Panic( KDCLName, ECannotCreateCEngine );
+        }
+
+    TRAP( leaveCode, iapConnections->NotifyL() );
+    if ( leaveCode )
+        {
+        LOGIT1("FAILED to request notifications <%d>", leaveCode)
+        User::Panic( KDCLName, ECannotRequestNotification );
+        }
+
+    RProcess::Rendezvous( KErrNone );
+
+    CActiveScheduler::Start();
+
+    delete cleanup;
+    delete iapConnections;
+    delete dclScheduler;
+
+    __UHEAP_MARKEND;
+    return 0;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/dataconnectionlogger/src/dclevent.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,81 @@
+/*
+* Copyright (c) 2003-2004 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:  Data Connection Logger.
+*
+*/
+
+#include "dclevent.h"
+
+// --------------------------------------------------------------------------
+// CEvent::CEvent
+// Constructor
+// --------------------------------------------------------------------------
+//
+CEvent::CEvent()
+        :
+        iConnectionId( 0 ),
+        iPrevDownValue( 0 ),
+        iPrevUpValue( 0 ),
+        iPrevDuration( 0 )
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CEvent::NewLC
+// 1st phase constructor - for stack pointers to object
+// --------------------------------------------------------------------------
+//
+CEvent* CEvent::NewLC()
+    {
+    CEvent* self = new( ELeave ) CEvent;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CEvent::NewL
+// 1st phase constructor - for heap pointers to object
+// --------------------------------------------------------------------------
+//
+CEvent* CEvent::NewL()
+    {
+    CEvent* self = NewLC();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CEvent::ConstructL
+// 2nd phase constructor
+// --------------------------------------------------------------------------
+//
+void CEvent::ConstructL()
+    {
+    iLogWrapEvent = CLogEvent::NewL();
+    }
+
+// --------------------------------------------------------------------------
+// CEvent::~CEvent
+// Destructor
+// Frees reserved resources.
+// --------------------------------------------------------------------------
+//
+CEvent::~CEvent()
+    {
+    delete iLogWrapEvent;
+    iLogWrapEvent = NULL;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmon/dataconnectionlogger/src/saeobserver.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,815 @@
+/*
+* 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:  Updates P&S variables: KPSUidGprsStatus and KPSUidWcdmaStatus.
+*
+*/
+
+#include <NIFVAR.H>
+#include <e32svr.h>
+#include <PSVariables.h>
+
+#include "saeobserver.h"
+#include "dcl_log.h"
+
+// Used to internally initialize network status to unknwon -state.
+const TInt ENtwkStatusNotKnown( -1 );
+
+// ============================ MEMBER FUNCTIONS ===========================
+
+// -------------------------------------------------------------------------
+// CSaeObserver::CSaeObserver
+// -------------------------------------------------------------------------
+CSaeObserver::CSaeObserver( const RConnectionMonitor& aMonitor ) :
+    iMonitor( aMonitor ),
+    iNetworkIsUnAttached( ETrue ),
+    iNetworkIsSuspended ( EFalse ),
+    iCurrentBearerType ( ESAEUnknownConnectionType )
+    {
+    }
+
+// -------------------------------------------------------------------------
+// CSaeObserver::NewL
+// -------------------------------------------------------------------------
+CSaeObserver* CSaeObserver::NewL( const RConnectionMonitor& aMonitor )
+    {
+    CSaeObserver* self = new (ELeave) CSaeObserver( aMonitor );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// -------------------------------------------------------------------------
+// CSaeObserver::~CSaeObserver
+// -------------------------------------------------------------------------
+CSaeObserver::~CSaeObserver()
+    {
+    LOG( Log::Printf( _L("DCL: CSaeObserver::~CSaeObserver() start->" )));
+    iGPRSConnections.Close();
+    iWCDMAConnections.Close();
+    iSAProperty.Close();
+    LOG( Log::Printf( _L("DCL: CSaeObserver::~CSaeObserver() end." )));
+    }
+
+// -------------------------------------------------------------------------
+// CSaeObserver::ConstructL
+// -------------------------------------------------------------------------
+void CSaeObserver::ConstructL()
+    {
+    LOG( Log::Printf( _L("DCL: CSaeObserver::ConstructL() start  " )));
+
+    // Define PubSub values
+    _LIT_SECURITY_POLICY_PASS( KGeneralReadPolicy  );
+    _LIT_SECURITY_POLICY_PASS( KGeneralWritePolicy );
+
+    iSAProperty.Define( KUidSystemCategory,
+                        KPSUidGprsStatusValue,
+                        RProperty::EInt,
+                        KGeneralReadPolicy,
+                        KGeneralWritePolicy );
+
+    iSAProperty.Define( KUidSystemCategory,
+                        KPSUidWcdmaStatusValue,
+                        RProperty::EInt,
+                        KGeneralReadPolicy,
+                        KGeneralWritePolicy );
+
+    iGPRSConnections.Reset();
+    iWCDMAConnections.Reset();
+
+    // Initialize PubSub values
+    UpdateBearerNetworkStatusL( ESAEGPRSConnectionType );  // GPRS status
+    UpdateBearerNetworkStatusL( ESAEWCDMAConnectionType ); // WCDMA status
+
+    LOG( Log::Printf( _L("DCL: CSaeObserver::ConstructL() end." )));
+    }
+
+// -------------------------------------------------------------------------
+// CSaeObserver::EventL
+// Handles events sent by Connection Monitor
+// -------------------------------------------------------------------------
+void CSaeObserver::EventL( const CConnMonEventBase &aConnMonEvent )
+    {
+    LOG( Log::Printf( _L("DCL: CSaeObserver::EventL() start->" )));
+
+    switch( aConnMonEvent.EventType() )
+        {
+        case EConnMonDeleteConnection:
+            {
+            LOG( Log::Printf( _L("DCL: EConnMonDeleteConnection." )));
+            const CConnMonDeleteConnection* event =
+                          ( CConnMonDeleteConnection* ) &aConnMonEvent;
+            HandleEConnMonDeleteConnectionL( *event );
+            }
+            break;
+
+        case EConnMonNetworkStatusChange:
+            {
+            LOG( Log::Printf( _L("DCL: EConnMonNetworkStatusChange." )));
+            const CConnMonNetworkStatusChange* event =
+                        ( CConnMonNetworkStatusChange* ) &aConnMonEvent;
+            HandleEConnMonNetworkStatusChangeL( *event );
+            }
+            break;
+
+        case EConnMonConnectionStatusChange:
+            {
+            LOG( Log::Printf( _L("DCL: EConnMonConnectionStatusChange." )));
+            const CConnMonConnectionStatusChange* event =
+                      ( CConnMonConnectionStatusChange* ) &aConnMonEvent;
+            HandleEConnMonConnectionStatusChangeL( *event );
+            }
+            break;
+
+        case EConnMonBearerChange:
+            {
+            LOG( Log::Printf( _L("DCL: EConnMonBearerChange." )));
+            const CConnMonBearerChange* event =
+                                 ( CConnMonBearerChange* ) &aConnMonEvent;
+            HandleEConnMonBearerChangeL( *event );
+            }
+            break;
+
+        default:
+            // Unhandled event
+            LOG( Log::Printf( _L("DCL: Unhandled event type (%d)."),
+                 aConnMonEvent.EventType() ));
+            break;
+        }
+    LOG( Log::Printf( _L("DCL: CSaeObserver::EventL() end." )));
+    }
+
+// -------------------------------------------------------------------------
+// CSaeObserver::HandleEConnMonBearerChangeL
+// -------------------------------------------------------------------------
+void CSaeObserver::HandleEConnMonBearerChangeL( const CConnMonBearerChange& aEvent )
+    {
+    LOG( Log::Printf( _L("DCL: CSaeObserver::HandleEConnMonBearerChangeL()" )));
+    TInt newConnType( aEvent.ConnectionId() ); // Connection ID tells the new bearer type
+#ifdef _DEBUG
+    TInt oldConnType( ESAEUnknownConnectionType );
+#endif
+    TInt newSAEConnType(ESAEUnknownConnectionType);
+    TInt oldSAEConnType(ESAEUnknownConnectionType);
+
+
+    // Check what handover we are executing.
+    RArray<TUint>* fromArray;
+
+    if ( newConnType == EBearerIdGPRS )
+        {
+        // No way to check whether we actually allready are at EdgeGPRS...
+#ifdef _DEBUG
+        oldConnType = EBearerIdWCDMA;
+#endif
+        newSAEConnType = ESAEGPRSConnectionType;
+        oldSAEConnType = iCurrentBearerType;
+        fromArray = &iWCDMAConnections;
+        }
+    else if ( newConnType == EBearerIdWCDMA )
+        {
+#ifdef _DEBUG
+        oldConnType = EBearerIdGPRS;
+#endif
+        newSAEConnType = ESAEWCDMAConnectionType;
+        oldSAEConnType = iCurrentBearerType;
+        fromArray = &iGPRSConnections;
+        }
+    else
+        {
+        LOG( Log::Printf( _L("DCL: Connection type %d not supported."),
+             newConnType ));
+        }
+
+    LOG( Log::Printf( _L("DCL: NewConnType %d, OldConnType %d"),
+         newSAEConnType, oldSAEConnType ));
+
+    if ( newSAEConnType != ESAEUnknownConnectionType &&
+         newSAEConnType != iCurrentBearerType )
+        {
+
+        TInt fromArrayCount( fromArray->Count() );
+        LOG( Log::Printf( _L("DCL: Handover from %d to %d bearer, %d connections."),
+             oldConnType, newConnType, fromArrayCount ));
+
+        --fromArrayCount; // Indexing of array starts at 0...
+
+        // Move all connections from old bearer specific array to the new one...
+        while (fromArrayCount >= 0)
+            {
+            TUint connectionID(0);
+
+            connectionID = (*fromArray)[fromArrayCount];
+
+            LOG( Log::Printf( _L("DCL: Moving Connection ID %d from old array index %d to new array."),
+                 connectionID, fromArrayCount ));
+
+            RemoveFromConnArray( STATIC_CAST(TSAEConnectionType, oldSAEConnType), connectionID );
+            AddToConnArray( STATIC_CAST(TSAEConnectionType, newSAEConnType), connectionID );
+            --fromArrayCount;
+            }
+
+        iCurrentBearerType = newSAEConnType;
+
+        if (!iNetworkIsSuspended) // we are suspended, don't update the new network state.
+            {
+            UpdateBearerNetworkStatusL( STATIC_CAST(TSAEConnectionType, newSAEConnType) );
+            }
+
+        // Update all context activity
+        UpdateContextActivity( STATIC_CAST(TSAEConnectionType, oldSAEConnType) );
+        UpdateContextActivity( STATIC_CAST(TSAEConnectionType, newSAEConnType) );
+
+        }
+    else
+        {
+        LOG( Log::Printf( _L("DCL: Unknown connection type %d, or this connection type is allready active."),
+             newConnType ));
+        // No such connection ID...
+        }
+    }
+
+// -------------------------------------------------------------------------
+// CSaeObserver::UpdateBearerNetworkStatusL
+// -------------------------------------------------------------------------
+void CSaeObserver::UpdateBearerNetworkStatusL( const TSAEConnectionType& connType )
+    {
+    LOG( Log::Printf( _L("DCL: CSaeObserver::UpdateBearerNetworkStatusL(connType %d, bearer %d, suspended %d)"),
+         connType, iCurrentBearerType, iNetworkIsSuspended ));
+
+    // No connections active, so check network status and update if
+    // UnAttached. This prevents the state to hang to active in case
+    // of no network events...
+    TInt ntwStatus( ENtwkStatusNotKnown );
+    TRequestStatus status;
+    TInt subConId( 0 );
+
+    if ( connType == ESAEGPRSConnectionType )
+        {
+        iMonitor.GetIntAttribute( EBearerIdGPRS, subConId, KNetworkStatus, ntwStatus, status );
+        User::WaitForRequest( status );
+        LOG( Log::Printf( _L("+ DCL: Async call status==(%d)."), status.Int() ));
+
+        if ( (ntwStatus == EConnMonStatusNotAvailable) || (ntwStatus == EConnMonStatusUnattached) )
+            {
+            LOG( Log::Printf( _L("DCL: GPRS ntwk is UnAttached." )));
+            iNetworkIsUnAttached = ETrue;
+            NotifyPubSub( KPSUidGprsStatus, EPSGprsUnattached );
+            }
+        else if ( ntwStatus == ENtwkStatusNotKnown )
+            {
+            LOG( Log::Printf( _L("DCL: Async request for GPRS ntwk status failed %d!"),
+                 status.Int() ));
+            }
+        else
+            {
+            LOG( Log::Printf( _L("DCL: GPRS ntwk is Attached." )));
+            iNetworkIsUnAttached = EFalse;
+            NotifyPubSub( KPSUidGprsStatus, EPSGprsAttach );
+            }
+        }
+    else if ( connType == ESAEWCDMAConnectionType )
+        {
+        iMonitor.GetIntAttribute( EBearerIdWCDMA, subConId, KNetworkStatus, ntwStatus, status );
+        User::WaitForRequest( status );
+        LOG( Log::Printf( _L("+ DCL: Async call status==(%d)."), status.Int() ));
+
+        if ( (ntwStatus == EConnMonStatusNotAvailable) || (ntwStatus == EConnMonStatusUnattached) )
+            {
+            LOG( Log::Printf( _L("DCL: WCDMA ntwk is UnAttached." )));
+            iNetworkIsUnAttached = ETrue;
+            NotifyPubSub( KPSUidWcdmaStatus, EPSWcdmaUnattached );
+            }
+        else if ( ntwStatus == ENtwkStatusNotKnown )
+            {
+            LOG( Log::Printf( _L("DCL: Async request for WCDMA ntwk status failed %d!"),
+                 status.Int() ));
+            }
+        else
+            {
+            LOG( Log::Printf( _L("DCL: WCDMA ntwk is Attached." )));
+            iNetworkIsUnAttached = EFalse;
+            NotifyPubSub( KPSUidWcdmaStatus, EPSWcdmaAttach );
+            }
+        }
+    else
+        {
+        LOG( Log::Printf( _L("DCL: !ERROR! Unknown connection type %d !ERROR!"),
+             connType ));
+        User::Leave(KErrGeneral);
+        }
+    }
+
+// -------------------------------------------------------------------------
+// CSaeObserver::HandleEConnMonDeleteConnectionL
+// -------------------------------------------------------------------------
+void CSaeObserver::HandleEConnMonDeleteConnectionL( const CConnMonDeleteConnection& aEvent )
+    {
+    TUint connId( aEvent.ConnectionId() );
+    // Connection type cannot be read from the Delete -event, but is needed
+    // later...
+    TSAEConnectionType connType( ESAEUnknownConnectionType );
+    IdentifyTypeFromArrays( connId, connType );
+    RArray<TUint>* conns = MatchingConnArray( connType, connId );
+
+    if ( conns )
+        {
+        TInt connCount( conns->Count() );
+        if ( connCount > 0 )
+            {
+            // If the connection ID is found from the connection array,
+            // simply remove it.
+            if (RemoveFromConnArray( connType, connId ) == KErrNone)
+                {
+                LOG( Log::Printf( _L("DCL: Connection %d deleted (%d connections remaining)."),
+                     connId, conns->Count() ));
+
+                if( --connCount == 0 )
+                    {
+                    UpdateBearerNetworkStatusL( connType );
+                    }
+                else
+                    {
+                    // Some connection(s) still active, so update status.
+                    UpdateContextActivity( connType );
+                    }
+                }
+            }
+        else if ( iNetworkIsUnAttached && (connType == ESAEGPRSConnectionType) )
+            {
+            // No active connections and network is UnAttached, but this still is
+            // a GPRS event... this case can occur for instance when trying to
+            // establish a GPRS connection with a SIM that does not have the GPRS
+            // enabled by operator. If this would not be handled the state would
+            // hang to activating (no UnAttach event received since network's state
+            // does not change).
+            LOG( Log::Printf( _L("DCL: No connections have been active and ntwk is UnAttached." )));
+            NotifyPubSub( KPSUidGprsStatus, EPSGprsUnattached );
+            }
+        else if ( iNetworkIsUnAttached && (connType == ESAEWCDMAConnectionType) )
+            {
+            // Same case here as above but with WCDMA event...
+            LOG( Log::Printf( _L("DCL: No connections have been active and ntwk is UnAttached." )));
+            NotifyPubSub( KPSUidWcdmaStatus, EPSWcdmaUnattached );
+            }
+        else
+            {
+            LOG( Log::Printf( _L("DCL: No connections of type %d active."), connType ));
+            }
+        }
+    }
+
+// -------------------------------------------------------------------------
+// CSaeObserver::HandleEConnMonNetworkStatusChangeL
+// -------------------------------------------------------------------------
+void CSaeObserver::HandleEConnMonNetworkStatusChangeL( const CConnMonNetworkStatusChange& aEvent )
+    {
+    TSAEConnectionType connType( GetConnectionType( aEvent.ConnectionId() ) );
+    LOG( Log::Printf( _L("DCL: connection type: %d."), connType ));
+
+    if ( (connType == ESAEGPRSConnectionType) || (connType == ESAEWCDMAConnectionType) )
+        {
+        switch ( aEvent.NetworkStatus() )
+            {
+            case EConnMonStatusUnattached:
+                {
+                if ( connType == ESAEGPRSConnectionType )
+                    {
+                    LOG( Log::Printf( _L("DCL: EConnMonStatusUnattached, KUidGprsStatus, ESAGprsUnattached." )));
+                    iNetworkIsUnAttached = ETrue;
+                    iNetworkIsSuspended = EFalse;
+                    NotifyPubSub( KPSUidGprsStatus, EPSGprsUnattached );
+                    }
+                else // ESAEWCDMAConnectionType
+                    {
+                    LOG( Log::Printf( _L("DCL: EConnMonStatusUnattached, KUidWcdmaStatus, ESAWcdmaUnattached." )));
+                    iNetworkIsUnAttached = ETrue;
+                    iNetworkIsSuspended = EFalse;
+                    NotifyPubSub( KPSUidWcdmaStatus, EPSGprsUnattached );
+                    }
+                // Just in case; there shouldn't be any active connections by now anyway:
+                RemoveAllFromConnArray( connType );
+                }
+                break;
+
+            case EConnMonStatusAttached:
+                {
+                if ( connType == ESAEGPRSConnectionType )
+                    {
+                    LOG( Log::Printf( _L("DCL: EConnMonStatusAttached, KUidGprsStatus, ESAGprsAttach." )));
+                    iNetworkIsUnAttached = EFalse;
+                    iNetworkIsSuspended = EFalse;
+                    NotifyPubSub( KPSUidGprsStatus, EPSGprsAttach );
+                    }
+                else // ESAEWCDMAConnectionType
+                    {
+                    LOG( Log::Printf( _L("DCL: EConnMonStatusAttached, KUidWcdmaStatus, ESAWcdmaAttach." )));
+                    iNetworkIsUnAttached = EFalse;
+                    iNetworkIsSuspended = EFalse;
+                    NotifyPubSub( KPSUidWcdmaStatus, EPSWcdmaAttach );
+                    }
+                }
+                break;
+
+            case EConnMonStatusSuspended:
+                {
+                LOG( Log::Printf( _L("DCL: EConnMonStatusSuspended, -> ntwk to suspend." )));
+                iNetworkIsSuspended = ETrue;
+                NotifyPubSub( KPSUidGprsStatus, EPSGprsSuspend );
+                NotifyPubSub( KPSUidWcdmaStatus, EPSWcdmaSuspend );
+                }
+                break;
+
+            case EConnMonStatusActive:
+                {
+                if ( connType == ESAEGPRSConnectionType )
+                    {
+                    LOG( Log::Printf( _L("DCL: EConnMonStatusActive, KUidGprsStatus, current activity..." )));
+                    iNetworkIsUnAttached = EFalse;
+                    iNetworkIsSuspended = EFalse;
+                    }
+                else // ESAEWCDMAConnectionType
+                    {
+                    LOG( Log::Printf( _L("DCL: EConnMonStatusActive, KUidWcdmaStatus, current activity..." )));
+                    iNetworkIsUnAttached = EFalse;
+                    iNetworkIsSuspended = EFalse;
+                    }
+                UpdateContextActivity( connType );
+                }
+                break;
+
+            default:
+                LOG( Log::Printf( _L("DCL: Unhandled NtwStatusChange(%d)."), aEvent.NetworkStatus() ));
+                break;
+            }
+        }
+    }
+
+// -------------------------------------------------------------------------
+// CSaeObserver::HandleEConnMonConnectionStatusChangeL
+// -------------------------------------------------------------------------
+void CSaeObserver::HandleEConnMonConnectionStatusChangeL(const CConnMonConnectionStatusChange& aEvent )
+    {
+    TInt connStatus = aEvent.ConnectionStatus();
+    if ( connStatus == KPsdStartingActivation ||
+            connStatus == KPsdFinishedActivation ||
+            connStatus == KPsdFinishedDeactivation )
+        {
+        TUint connId( aEvent.ConnectionId() );
+        LOG( Log::Printf( _L("DCL: connection ID got: %d."), connId ));
+        TSAEConnectionType connType( GetConnectionType( connId ) );
+        LOG( Log::Printf( _L("DCL: connection type: %d."), connType ));
+
+        if ( (connType == ESAEGPRSConnectionType) || (connType == ESAEWCDMAConnectionType) )
+            {
+            LOG( Log::Printf( _L("DCL: trying to get connection status..."), connId));
+            switch ( connStatus )
+                {
+                case KPsdStartingActivation :
+                    {
+                    if ( connType == ESAEGPRSConnectionType )
+                        {
+                        LOG( Log::Printf( _L("DCL: KPsdStartingActivation : KUidGprsStatus, ESAGprsContextActivating." )));
+                        NotifyPubSub( KPSUidGprsStatus, EPSGprsContextActivating );
+                        iCurrentBearerType = ESAEGPRSConnectionType;
+                        }
+                    else // ESAEWCDMAConnectionType
+                        {
+                        LOG( Log::Printf( _L("DCL: KPsdStartingActivation : KUidWcdmaStatus, ESAWcdmaContextActivating." )));
+                        NotifyPubSub( KPSUidWcdmaStatus, EPSWcdmaContextActivating );
+                        iCurrentBearerType = ESAEWCDMAConnectionType;
+                        }
+                    AddToConnArray( connType, connId );
+                    }
+                    break;
+
+                case KPsdFinishedActivation :
+                    {
+                    LOG( Log::Printf( _L("DCL: KPsdFinishedActivation." )));
+                    // Connection opened, so add it to the array of open connections:
+                    AddToConnArray( connType, connId );
+                    UpdateContextActivity( connType );
+                    LOG( Log::Printf( _L("DCL: Connection %d of type %d finished activation."),
+                         connId, connType ));
+                    }
+                    break;
+
+                case KPsdFinishedDeactivation :
+                    {
+                    LOG( Log::Printf( _L("DCL: KPsdFinishedDeactivation." )));
+                    RemoveFromConnArray( connType, connId );
+                    LOG( Log::Printf( _L("DCL: Connection %d of type %d finished de-activation."),
+                         connId, connType ));
+
+                    if (iGPRSConnections.Count() == 0 && iWCDMAConnections.Count() == 0)
+                        {
+                        // No active contexts...
+                        UpdateBearerNetworkStatusL(connType);
+                        }
+                    else
+                        {
+                        // There is at least one active context
+                        UpdateContextActivity(connType);
+                        }
+                    }
+                    break;
+
+                default :
+                    LOG( Log::Printf( _L("DCL: Unhandled context connection status (%d)."),
+                         aEvent.ConnectionStatus() ));
+                    break;
+                }
+            }
+        }
+    }
+
+// -------------------------------------------------------------------------
+// CSaeObserver::NotifyPubSub
+// -------------------------------------------------------------------------
+void CSaeObserver::NotifyPubSub( const TUid aVariable, const TInt aState )
+    {
+    LOG( Log::Printf( _L("DCL: CSaeObserver::NotifyPubSub : aVariable == %d aState == %d"),
+         aVariable.iUid, aState ));
+
+    TInt returnValue = iSAProperty.Set(KUidSystemCategory, aVariable.iUid, aState);
+
+    LOG( Log::Printf( _L("DCL: CSaeObserver::NotifyPubSub : returnValue == %d"),
+         returnValue ));
+    }
+
+// -------------------------------------------------------------------------
+// CSaeObserver::GetConnectionType
+// -------------------------------------------------------------------------
+TSAEConnectionType CSaeObserver::GetConnectionType( const TUint &aConnectionId )
+    {
+    TRequestStatus status;
+    TInt connType( EBearerUnknown );
+    TInt subConId( 0 );
+    TSAEConnectionType ret( ESAEUnknownConnectionType );
+
+    // EBearerIdGPRS and -WCDMA means bearer specific Connection Id.
+    // This is a fix to get for instance network unattached state,
+    // since the actual connection Id is not necessarily available anymore.
+    switch ( aConnectionId )
+        {
+        case EBearerIdGPRS :
+            {
+            ret = ESAEGPRSConnectionType;
+            }
+            break;
+
+        case EBearerIdWCDMA :
+            {
+            ret = ESAEWCDMAConnectionType;
+            }
+            break;
+
+        default :
+            {
+            iMonitor.GetIntAttribute( aConnectionId, subConId, KBearer, connType, status );
+            User::WaitForRequest( status );
+            LOG( Log::Printf( _L("+ DCL: Async call status==(%d)."), status.Int() ));
+            if ( status == KErrNone )
+                {
+                // If bearer status can not be read the event is not handled, since
+                // connType == EBearerUnknown and ret == ESAEUnknownConnectionType.
+
+                if ( connType == EBearerGPRS ||
+                     connType == EBearerExternalGPRS ||
+                     connType == EBearerEdgeGPRS ||
+                     connType == EBearerExternalEdgeGPRS )
+                    {
+                    ret = ESAEGPRSConnectionType;
+                    }
+                else if ( connType == EBearerWCDMA ||
+                          connType == EBearerExternalWCDMA )
+                      {
+                    ret = ESAEWCDMAConnectionType;
+                    }
+                }
+            else
+                {
+                // Finally try to check if allready saved to some connection
+                // type specific connection array...
+                IdentifyTypeFromArrays( aConnectionId, ret );
+                }
+            }
+            break;
+        }
+
+#ifdef _DEBUG
+        switch ( ret )
+        {
+        case ESAEGPRSConnectionType :
+            {
+            LOG( Log::Printf( _L("DCL: This is a GPRS connection event." )));
+            }
+            break;
+        case ESAEWCDMAConnectionType :
+            {
+            LOG( Log::Printf( _L("DCL: This is a WCDMA connection event." )));
+            }
+            break;
+        default :
+            {
+            LOG( Log::Printf( _L("DCL: The event is not of any known type." )));
+            }
+            break;
+        }
+#endif //_DEBUG
+
+    return ret;
+    }
+
+// -------------------------------------------------------------------------
+// CSaeObserver::IdentifyTypeFromArrays
+// -------------------------------------------------------------------------
+void CSaeObserver::IdentifyTypeFromArrays( TUint aConnectionId,
+                                           TSAEConnectionType& aConnType )
+    {
+    // When, for instance, handling Delete Connection -event we can't get the
+    // connection type from the event, so we can search for the unique
+    // connection ID from the ones we allready have in the connection type
+    // specific member lists. We can then figure the connection type
+    // based on that.
+    if ( iGPRSConnections.Find(aConnectionId) != KErrNotFound )
+        {
+        LOG( Log::Printf( _L("DCL: IdentifyTypeFromArrays: Found from GPRS array" )));
+        aConnType = ESAEGPRSConnectionType;
+        }
+    else if ( iWCDMAConnections.Find(aConnectionId) != KErrNotFound )
+        {
+        LOG( Log::Printf( _L("DCL: IdentifyTypeFromArrays: Found from WCDMA array" )));
+        aConnType = ESAEWCDMAConnectionType;
+        }
+    }
+
+// -------------------------------------------------------------------------
+// CSaeObserver::MatchingConnArray
+// -------------------------------------------------------------------------
+RArray<TUint>* CSaeObserver::MatchingConnArray( const TSAEConnectionType& aConnType,
+                                                TUint aConnectionId )
+    {
+    LOG( Log::Printf( _L("DCL: MatchingConnArray: type:%d, id:%d"),
+         aConnType, aConnectionId ));
+    RArray<TUint>* ret = NULL;
+    switch ( aConnType )
+        {
+        case ESAEGPRSConnectionType :
+            {
+            LOG( Log::Printf( _L("DCL: MatchingConnArray: Returning GPRS array" )));
+            ret =  &iGPRSConnections;
+            }
+            break;
+        case ESAEWCDMAConnectionType :
+            {
+            LOG( Log::Printf( _L("DCL: MatchingConnArray: Returning WCDMA array" )));
+            ret = &iWCDMAConnections;
+            }
+            break;
+        case ESAEUnknownConnectionType :
+            {
+            // Check if connection ID allready in some type specific array
+            TSAEConnectionType type( ESAEUnknownConnectionType );
+            IdentifyTypeFromArrays( aConnectionId, type);
+            if ( type != ESAEUnknownConnectionType )
+                {
+                // Try to match again with the implicitly found out type...
+                ret = MatchingConnArray( type, aConnectionId );
+                }
+            }
+            break;
+        default :
+            LOG( Log::Printf( _L("DCL: MatchingConnArray: No array found, returning NULL" )));
+            break;
+        }
+    return ret;
+    }
+
+// -------------------------------------------------------------------------
+// CSaeObserver::UpdateContextActivity
+// -------------------------------------------------------------------------
+void CSaeObserver::UpdateContextActivity( const TSAEConnectionType& aConnType )
+{
+    // Check if network is UnAttached or unknown, do not update to active in
+    // this case since connection can not be active if ntwk is not attached.
+    // Also check if we are currently in suspend state. Only network events can
+    // trigger returning from suspend (the i*NetworkIsSuspended is unset only
+    // during handling of these events).
+    if ( aConnType == ESAEGPRSConnectionType )
+        {
+        TInt count( iGPRSConnections.Count() );
+        LOG( Log::Printf( _L("DCL: UpdateContextActivity (GPRS conns %d)"), count ));
+        if ( !iNetworkIsUnAttached && !iNetworkIsSuspended)
+            {
+            if ( count == 1 )
+                {
+                // One connection active
+                LOG( Log::Printf( _L("DCL: ESAGprsContextActive" )));
+                NotifyPubSub( KPSUidGprsStatus, EPSGprsContextActive );
+                iCurrentBearerType = ESAEGPRSConnectionType;
+                }
+            else if( count > 1 )
+                {
+                // Multiple connections active
+                LOG( Log::Printf( _L("DCL: ESAGprsMultibleContextActive" )));
+                NotifyPubSub( KPSUidGprsStatus, EPSGprsMultibleContextActive );
+                iCurrentBearerType = ESAEGPRSConnectionType;
+                }
+            }
+        }
+    else if ( aConnType == ESAEWCDMAConnectionType )
+        {
+        TInt count( iWCDMAConnections.Count() );
+        LOG( Log::Printf( _L("DCL: UpdateContextActivity (WCDMA conns %d)"), count ));
+        if ( !iNetworkIsUnAttached && !iNetworkIsSuspended)
+            {
+            if ( count == 1 )
+                {
+                // One connection active
+                LOG( Log::Printf( _L("DCL: ESAWcdmaContextActive" )));
+                NotifyPubSub( KPSUidWcdmaStatus, EPSWcdmaContextActive );
+                iCurrentBearerType = ESAEWCDMAConnectionType;
+                }
+            else if( count > 1 )
+                {
+                // Multiple connections active
+                LOG( Log::Printf( _L("DCL: ESAWcdmaMultipleContextActive" )));
+                NotifyPubSub( KPSUidWcdmaStatus, EPSWcdmaMultipleContextActive );
+                iCurrentBearerType = ESAEWCDMAConnectionType;
+                }
+            }
+        }
+    }
+
+// -------------------------------------------------------------------------
+// CSaeObserver::AddToConnArray
+// -------------------------------------------------------------------------
+void CSaeObserver::AddToConnArray( const TSAEConnectionType& aConnType,
+                                   const TUint aConnId )
+    {
+    RArray<TUint>* conns = MatchingConnArray( aConnType );
+
+    LOG( Log::Printf( _L("DCL: AddToConnArray(type %d)"), aConnType ));
+
+    // No duplicate connections. Also do not add bearer specific connection Id.
+    if ( conns && (conns->Find(aConnId) == KErrNotFound) &&
+        ((aConnId != EBearerIdGPRS) && (aConnId != EBearerIdWCDMA)) )
+        {
+        conns->Append( aConnId );
+        LOG( Log::Printf( _L("DCL: Contexts: GPRS %d, WCDMA %d"),
+             iGPRSConnections.Count(), iWCDMAConnections.Count() ));
+        }
+    }
+
+// -------------------------------------------------------------------------
+// CSaeObserver::RemoveFromConnArray
+// -------------------------------------------------------------------------
+TInt CSaeObserver::RemoveFromConnArray( const TSAEConnectionType& aConnType,
+                                        const TUint aConnId )
+    {
+    LOG( Log::Printf( _L("DCL: RemoveFromConnArray, type: %d, id: %d."),
+         aConnType, aConnId ));
+    TInt ret(KErrNotFound);
+    TInt index(0);
+    RArray<TUint>* conns = MatchingConnArray( aConnType );
+
+    if ( conns )
+        {
+        index = conns->Find( aConnId );
+        if ( index != KErrNotFound )
+            {
+            conns->Remove( index );
+            LOG( Log::Printf( _L("DCL: Context %d of type %d removed."),
+                 aConnId, aConnType ));
+            ret = KErrNone;
+            }
+        }
+    return ret;
+    }
+
+// -------------------------------------------------------------------------
+// CSaeObserver::RemoveAllFromConnArray
+// -------------------------------------------------------------------------
+void CSaeObserver::RemoveAllFromConnArray( const TSAEConnectionType& aConnType )
+    {
+    RArray<TUint>* conns = MatchingConnArray( aConnType );
+
+    if ( conns )
+        {
+        LOG( Log::Printf( _L("DCL: RemoveAllFromConnArray(), reseting ConnType %d array."),
+             aConnType ));
+        conns->Reset();
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmonext/BMARM/CONNMONEXTU.DEF	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,11 @@
+EXPORTS
+	__24CConnectionMonitorPlugin @ 1 NONAME R3UNUSED ; CConnectionMonitorPlugin::CConnectionMonitorPlugin(void)
+	CancelRegisterPlugin__24CConnectionMonitorPlugin @ 2 NONAME R3UNUSED ; CConnectionMonitorPlugin::CancelRegisterPlugin(void)
+	E32Dll__F10TDllReason @ 3 NONAME R3UNUSED ; E32Dll(TDllReason)
+	Event__C24CConnectionMonitorPluginUiPCvUi @ 4 NONAME ; CConnectionMonitorPlugin::Event(unsigned int, void const *, unsigned int) const
+	RegisterAttribute__C24CConnectionMonitorPluginUi @ 5 NONAME R3UNUSED ; CConnectionMonitorPlugin::RegisterAttribute(unsigned int) const
+	RegisterPluginL__24CConnectionMonitorPluginUi @ 6 NONAME R3UNUSED ; CConnectionMonitorPlugin::RegisterPluginL(unsigned int)
+	Version__C24CConnectionMonitorPlugin @ 7 NONAME R3UNUSED ; CConnectionMonitorPlugin::Version(void) const
+	"_._24CConnectionMonitorPlugin" @ 8 NONAME R3UNUSED ; CConnectionMonitorPlugin::~CConnectionMonitorPlugin(void)
+	CancelRegisterAttribute__C24CConnectionMonitorPluginUi @ 9 NONAME R3UNUSED ; CConnectionMonitorPlugin::CancelRegisterAttribute(unsigned int) const
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmonext/BWINS/CONNMONEXTU.DEF	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,11 @@
+EXPORTS
+	??0CConnectionMonitorPlugin@@QAE@XZ @ 1 NONAME ; public: __thiscall CConnectionMonitorPlugin::CConnectionMonitorPlugin(void)
+	??1CConnectionMonitorPlugin@@UAE@XZ @ 2 NONAME ; public: virtual __thiscall CConnectionMonitorPlugin::~CConnectionMonitorPlugin(void)
+	?CancelRegisterAttribute@CConnectionMonitorPlugin@@QBEXI@Z @ 3 NONAME ; public: void __thiscall CConnectionMonitorPlugin::CancelRegisterAttribute(unsigned int)const 
+	?CancelRegisterPlugin@CConnectionMonitorPlugin@@QAEXXZ @ 4 NONAME ; public: void __thiscall CConnectionMonitorPlugin::CancelRegisterPlugin(void)
+	?E32Dll@@YAHW4TDllReason@@@Z @ 5 NONAME ; int __cdecl E32Dll(enum TDllReason)
+	?Event@CConnectionMonitorPlugin@@QBEHIPBXI@Z @ 6 NONAME ; public: int __thiscall CConnectionMonitorPlugin::Event(unsigned int,void const *,unsigned int)const 
+	?RegisterAttribute@CConnectionMonitorPlugin@@QBEHI@Z @ 7 NONAME ; public: int __thiscall CConnectionMonitorPlugin::RegisterAttribute(unsigned int)const 
+	?RegisterPluginL@CConnectionMonitorPlugin@@QAEXI@Z @ 8 NONAME ; public: void __thiscall CConnectionMonitorPlugin::RegisterPluginL(unsigned int)
+	?Version@CConnectionMonitorPlugin@@QBE?AVTVersion@@XZ @ 9 NONAME ; public: class TVersion  __thiscall CConnectionMonitorPlugin::Version(void)const 
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmonext/BWinsCw/CONNMONEXTU.DEF	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,11 @@
+EXPORTS
+	??0CConnectionMonitorPlugin@@QAE@XZ @ 1 NONAME ; CConnectionMonitorPlugin::CConnectionMonitorPlugin(void)
+	??1CConnectionMonitorPlugin@@UAE@XZ @ 2 NONAME ; CConnectionMonitorPlugin::~CConnectionMonitorPlugin(void)
+	?CancelRegisterAttribute@CConnectionMonitorPlugin@@QBEXI@Z @ 3 NONAME ; void CConnectionMonitorPlugin::CancelRegisterAttribute(unsigned int) const
+	?CancelRegisterPlugin@CConnectionMonitorPlugin@@QAEXXZ @ 4 NONAME ; void CConnectionMonitorPlugin::CancelRegisterPlugin(void)
+	?E32Dll@@YAHW4TDllReason@@@Z @ 5 NONAME ; int E32Dll(enum TDllReason)
+	?Event@CConnectionMonitorPlugin@@QBEHIPBXI@Z @ 6 NONAME ; int CConnectionMonitorPlugin::Event(unsigned int, void const *, unsigned int) const
+	?RegisterAttribute@CConnectionMonitorPlugin@@QBEHI@Z @ 7 NONAME ; int CConnectionMonitorPlugin::RegisterAttribute(unsigned int) const
+	?RegisterPluginL@CConnectionMonitorPlugin@@QAEXI@Z @ 8 NONAME ; void CConnectionMonitorPlugin::RegisterPluginL(unsigned int)
+	?Version@CConnectionMonitorPlugin@@QBE?AVTVersion@@XZ @ 9 NONAME ; class TVersion CConnectionMonitorPlugin::Version(void) const
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmonext/BWinsCw/CONNMONEXT_EKA2U.def	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,10 @@
+EXPORTS
+	??0CConnectionMonitorPlugin@@QAE@XZ @ 1 NONAME ; CConnectionMonitorPlugin::CConnectionMonitorPlugin(void)
+	??1CConnectionMonitorPlugin@@UAE@XZ @ 2 NONAME ; CConnectionMonitorPlugin::~CConnectionMonitorPlugin(void)
+	?CancelRegisterAttribute@CConnectionMonitorPlugin@@QBEXI@Z @ 3 NONAME ; void CConnectionMonitorPlugin::CancelRegisterAttribute(unsigned int) const
+	?CancelRegisterPlugin@CConnectionMonitorPlugin@@QAEXXZ @ 4 NONAME ; void CConnectionMonitorPlugin::CancelRegisterPlugin(void)
+	?Event@CConnectionMonitorPlugin@@QBEHIPBXI@Z @ 5 NONAME ; int CConnectionMonitorPlugin::Event(unsigned int, void const *, unsigned int) const
+	?RegisterAttribute@CConnectionMonitorPlugin@@QBEHI@Z @ 6 NONAME ; int CConnectionMonitorPlugin::RegisterAttribute(unsigned int) const
+	?RegisterPluginL@CConnectionMonitorPlugin@@QAEXI@Z @ 7 NONAME ; void CConnectionMonitorPlugin::RegisterPluginL(unsigned int)
+	?Version@CConnectionMonitorPlugin@@QBE?AVTVersion@@XZ @ 8 NONAME ; class TVersion CConnectionMonitorPlugin::Version(void) const
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmonext/EABI/ConnMonExtU.DEF	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,19 @@
+EXPORTS
+	_Z6E32Dll10TDllReason @ 1 NONAME
+	_ZN24CConnectionMonitorPlugin15RegisterPluginLEj @ 2 NONAME
+	_ZN24CConnectionMonitorPlugin20CancelRegisterPluginEv @ 3 NONAME
+	_ZN24CConnectionMonitorPluginC2Ev @ 4 NONAME
+	_ZN24CConnectionMonitorPluginD0Ev @ 5 NONAME
+	_ZN24CConnectionMonitorPluginD1Ev @ 6 NONAME
+	_ZN24CConnectionMonitorPluginD2Ev @ 7 NONAME
+	_ZNK24CConnectionMonitorPlugin17RegisterAttributeEj @ 8 NONAME
+	_ZNK24CConnectionMonitorPlugin23CancelRegisterAttributeEj @ 9 NONAME
+	_ZNK24CConnectionMonitorPlugin5EventEjPKvj @ 10 NONAME
+	_ZNK24CConnectionMonitorPlugin7VersionEv @ 11 NONAME
+	_ZTI24CConnectionMonitorPlugin @ 12 NONAME ; #<TI>#
+	_ZTV24CConnectionMonitorPlugin @ 13 NONAME ; #<VT>#
+	_ZThn4_N24CConnectionMonitorPluginD0Ev @ 14 NONAME ; #<thunk>#
+	_ZThn4_N24CConnectionMonitorPluginD1Ev @ 15 NONAME ; #<thunk>#
+	_ZTI9CPluginAO @ 16 NONAME ; #<TI>#
+	_ZTV9CPluginAO @ 17 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmonext/EABI/ConnMonExt_EKA2U.def	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,14 @@
+EXPORTS
+	_ZN24CConnectionMonitorPlugin15RegisterPluginLEj @ 1 NONAME
+	_ZN24CConnectionMonitorPlugin20CancelRegisterPluginEv @ 2 NONAME
+	_ZN24CConnectionMonitorPluginC2Ev @ 3 NONAME
+	_ZN24CConnectionMonitorPluginD0Ev @ 4 NONAME
+	_ZN24CConnectionMonitorPluginD1Ev @ 5 NONAME
+	_ZN24CConnectionMonitorPluginD2Ev @ 6 NONAME
+	_ZNK24CConnectionMonitorPlugin17RegisterAttributeEj @ 7 NONAME
+	_ZNK24CConnectionMonitorPlugin23CancelRegisterAttributeEj @ 8 NONAME
+	_ZNK24CConnectionMonitorPlugin5EventEjPKvj @ 9 NONAME
+	_ZNK24CConnectionMonitorPlugin7VersionEv @ 10 NONAME
+	_ZTI24CConnectionMonitorPlugin @ 11 NONAME ; #<TI>#
+	_ZTV24CConnectionMonitorPlugin @ 12 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmonext/group/ConnMonExt.mmp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,45 @@
+/*
+* 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:  Builds ConnMonExt.dll.
+*
+*/
+
+#include <platform_paths.hrh>
+
+MACRO           EPOC_SDK=0x07010000
+
+TARGET          ConnMonExt.dll
+TARGETTYPE      dll
+UID             0x1000008d 0x101F6D0A
+
+VENDORID        VID_DEFAULT
+CAPABILITY      CAP_CLIENT_DLL
+
+SOURCEPATH      ../src
+SOURCE          ConnMonExt.cpp
+
+USERINCLUDE     ../inc
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         connmon.lib
+DEBUGLIBRARY    flogger.lib
+
+#if defined(ARMCC)
+    DEFFILE ../EABI/ConnMonExt_EKA2.def
+#elif defined( WINSCW )
+    DEFFILE ../BWinsCw/CONNMONEXT_EKA2.def
+#else
+    DEFFILE ../BMarm/CONNMONEXT_EKA2.def
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmonext/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for Connection Monitor Extension.
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_EXPORTS
+
+../rom/ConnMonExt.iby CORE_MW_LAYER_IBY_EXPORT_PATH(ConnMonExt.iby)
+
+PRJ_MMPFILES
+
+// Builds ConnMonExt.dll
+ConnMonExt.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmonext/inc/log.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,88 @@
+/*
+* Copyright (c) 2004 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:  Writes log entries for Connection Monitor Extension.
+*
+*/
+
+#ifndef CONNECTIONMONITOREXTLOG_H
+#define CONNECTIONMONITOREXTLOG_H
+
+#include <e32std.h>
+#include <e32base.h>
+
+#ifdef _DEBUG
+    #define LOG(a) a
+#else
+    #define LOG(a)
+#endif
+
+#ifdef _DEBUG
+
+#include <flogger.h>
+
+_LIT( KLogFolder,"ConnMonExt" );
+_LIT( KLogFile,"ConnMonExt.txt" );
+
+class Log
+    {
+public:
+    static inline void Write( const TDesC& aDes);
+    static inline void Printf( TRefByValue<const TDesC> aFmt, ...);
+    static inline void Printf( TRefByValue<const TDesC8> aFmt, ...);
+    static inline void HexDump(
+            const TText* aHeader,
+            const TText* aMargin,
+            const TUint8* aPtr,
+            TInt aLen );
+    };
+
+inline void Log::Write( const TDesC& aDes )
+    {
+    RFileLogger::Write( KLogFolder(), KLogFile(), EFileLoggingModeAppend, aDes );
+    }
+
+inline void Log::Printf( TRefByValue<const TDesC> aFmt, ... )
+    {
+    VA_LIST list;
+    VA_START(list,aFmt);
+    RFileLogger::WriteFormat( KLogFolder(), KLogFile(), EFileLoggingModeAppend, aFmt, list );
+    }
+
+inline void Log::Printf( TRefByValue<const TDesC8> aFmt, ... )
+    {
+    VA_LIST list;
+    VA_START( list,aFmt );
+    RFileLogger::WriteFormat( KLogFolder(), KLogFile(), EFileLoggingModeAppend, aFmt, list );
+    }
+
+inline void Log::HexDump(
+        const TText* aHeader,
+        const TText* aMargin,
+        const TUint8* aPtr,
+        TInt aLen )
+    {
+    RFileLogger::HexDump(
+            KLogFolder(),
+            KLogFile(),
+            EFileLoggingModeAppend,
+            aHeader,
+            aMargin,
+            aPtr,
+            aLen );
+    }
+
+#endif // _DEBUG
+#endif // CONNECTIONMONITOREXTLOG_H
+
+// End-of-file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmonext/rom/ConnMonExt.iby	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Connection Monitor extensions to ROM.
+*
+*/
+
+#ifndef __CONNMONEXT_IBY__
+#define __CONNMONEXT_IBY__
+
+file=ABI_DIR\BUILD_DIR\CONNMONEXT.DLL    SHARED_LIB_DIR\CONNMONEXT.DLL
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/connmonext/src/ConnMonExt.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,532 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Connection Monitor Extension.
+*
+*/
+
+#include "ConnMonExt.h"
+#include "log.h"
+
+// ============================ LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// Panic
+// Panics the client in case of programming error.
+// -----------------------------------------------------------------------------
+//
+void Panic( TInt aPanic )
+    {
+    _LIT( KPanicCategory, "ConnectionMonitor Extension API" );
+    User::Panic( KPanicCategory, aPanic );
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CConnectionMonitorPlugin::CConnectionMonitorPlugin
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CConnectionMonitorPlugin::CConnectionMonitorPlugin()
+    {
+    iPluginAO = 0;
+    }
+
+// -----------------------------------------------------------------------------
+// Destructor
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CConnectionMonitorPlugin::~CConnectionMonitorPlugin()
+    {
+    delete iPluginAO;
+    }
+
+// -----------------------------------------------------------------------------
+// CConnectionMonitorPlugin::RegisterPlugin
+// Starts plugin session and registers the plug-in.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CConnectionMonitorPlugin::RegisterPluginL( const TUint aConnectionId )
+    {
+    if ( iPluginAO == 0 )
+        {
+        // Create the receiver (active object)
+        iPluginAO = new ( ELeave ) CPluginAO( iSession, *this );
+        iPluginAO->ConstructL();
+
+        // Connect to the Connection Monitor server
+        iConnMonServer.ConnectL();
+
+        // Open plug-in subsession to the Connection Monitor server
+        TInt ret = iSession.Open( iConnMonServer, aConnectionId );
+
+        if ( ret != KErrNone )
+            {
+            User::Leave( ret );
+            }
+        }
+
+    iPluginAO->ReceiveQuery();
+
+    LOG( Log::Printf( _L("Plugin [%d]: registered: Id:<%d>\n"), &iSession, aConnectionId ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CConnectionMonitorPlugin::CancelRegisterPlugin
+// Cancels the plug-in's registration.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CConnectionMonitorPlugin::CancelRegisterPlugin()
+    {
+    if ( iPluginAO != 0 )
+        {
+        // Delete receiver
+        delete iPluginAO;
+        iPluginAO = 0;
+
+        // Close plug-in subsession
+        iSession.Close();
+
+        // Disconnect from Connection Monitor server
+        iConnMonServer.Close();
+
+        LOG( Log::Printf( _L("Plugin [%d]: Cancelled registration.\n"), &iSession ) );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CConnectionMonitorPlugin::RegisterAttribute
+// Registers a new attribute to the Connection Monitor server.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CConnectionMonitorPlugin::RegisterAttribute( const TUint aAttribute ) const
+    {
+    LOG( Log::Printf( _L("Plugin [%d]: register attribute: Id:<%d>\n"), &iSession, aAttribute ) );
+
+    return ( iSession.RegisterAttribute( aAttribute ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CConnectionMonitorPlugin::CancelRegisterAttribute
+// Cancels the attribute registration from the Connection Monitor server.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CConnectionMonitorPlugin::CancelRegisterAttribute( const TUint aAttribute ) const
+    {
+    LOG( Log::Printf( _L("Plugin [%d]: Cancel attribute registration: Id:<%d>\n"), &iSession, aAttribute ) );
+
+    iSession.CancelRegisterAttribute( aAttribute );
+    }
+
+// -----------------------------------------------------------------------------
+// CConnectionMonitorPlugin::Event
+// Sends an event to Connnection Monitor server.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CConnectionMonitorPlugin::Event( const TUint aEventId,
+                                               const TAny* aData,
+                                               const TUint aSize ) const
+    {
+    LOG( Log::Printf( _L("Plugin [%d]: Send event: EventId:<%d>\n"), &iSession, aEventId ) );
+
+    return ( iSession.SendEvent( aEventId, aData, aSize ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CConnectionMonitorPlugin::Version
+// Returns the client side version number.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TVersion CConnectionMonitorPlugin::Version() const
+    {
+    LOG( Log::Printf( _L("Plugin [%d]: Get version.\n"), &iSession ) );
+
+    return ( iSession.Version() );
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// RConnMonPlugin::Open
+// Creates a new subsession with the Connection Monitor server.
+// -----------------------------------------------------------------------------
+//
+TInt RConnMonPlugin::Open( RConnectionMonitor &aSession, const TUint aConnectionId  )
+    {
+    //p[0]= ( TAny* )aConnectionId ;
+
+    TIpcArgs args( aConnectionId );
+
+    return CreateSubSession( aSession, EReqPluginCreateSubSession, args );
+    }
+
+// -----------------------------------------------------------------------------
+// RConnMonPlugin::Close
+// Closes the subsession.
+// -----------------------------------------------------------------------------
+//
+void RConnMonPlugin::Close()
+    {
+    RSubSessionBase::CloseSubSession( EReqPluginCloseSubSession );
+    }
+
+// -----------------------------------------------------------------------------
+// RConnMonPlugin::Version
+// Returns the client side version number.
+// -----------------------------------------------------------------------------
+//
+TVersion RConnMonPlugin::Version() const
+    {
+    return( TVersion( KPluginMajorVersionNumber,
+                      KPluginMinorVersionNumber,
+                      KPluginBuildVersionNumber ) );
+    }
+
+// -----------------------------------------------------------------------------
+// RConnMonPlugin::SendEvent
+// Sends an event to the Connection Monitor server.
+// -----------------------------------------------------------------------------
+//
+TInt RConnMonPlugin::SendEvent( const TUint aEventId,
+                                const TAny* aData,
+                                const TUint aSize ) const
+    {
+    if ( aSize > KConnMonMaxPluginDataSize )
+        {
+        return KErrTooBig;
+        }
+
+    TPtrC8 n( reinterpret_cast< const TUint8* >( aData ), aSize );
+
+    //p[0]= ( TAny* )aEventId;
+    //p[1]= ( TAny* )&n;
+
+    TIpcArgs args( aEventId, &n );
+
+    return SendReceive( EReqPluginEvent, args );
+    }
+
+// -----------------------------------------------------------------------------
+// RConnMonPlugin::RegisterAttribute
+// Registers an attribute to the Connection Monitor server.
+// -----------------------------------------------------------------------------
+//
+TInt RConnMonPlugin::RegisterAttribute( const TUint aAttribute ) const
+    {
+    //p[0]= ( TAny* )aAttribute;
+
+    TIpcArgs args( aAttribute );
+
+    return SendReceive( EReqPluginRegisterAttribute, args );
+    }
+
+// -----------------------------------------------------------------------------
+// RConnMonPlugin::CancelRegisterAttribute
+// Cancels the attribute registration from the Connection Monitor server.
+// -----------------------------------------------------------------------------
+//
+TInt RConnMonPlugin::CancelRegisterAttribute( const TUint aAttribute ) const
+    {
+    //p[0]= ( TAny* )aAttribute;
+
+    TIpcArgs args( aAttribute );
+
+    return SendReceive( EReqPluginCancelRegisterAttribute, args );
+    }
+
+// -----------------------------------------------------------------------------
+// RConnMonPlugin::GetQuery
+// Gets the next attribute request from the Connection Monitor server.
+// -----------------------------------------------------------------------------
+//
+void RConnMonPlugin::GetQuery( TDes8& aBuffer, TRequestStatus& aStatus ) const
+    {
+    //p[ 0 ]= ( TAny* )&aBuffer;
+
+    TIpcArgs args( &aBuffer );
+
+    SendReceive( EReqPluginGetQuery, args, aStatus );
+    }
+
+// -----------------------------------------------------------------------------
+// RConnMonPlugin::CancelGetQueyry
+// -----------------------------------------------------------------------------
+//
+void RConnMonPlugin::CancelGetQuery() const
+    {
+    //SendReceive( EReqPluginCancelGetQuery, 0 );
+    SendReceive( EReqPluginCancelGetQuery, TIpcArgs( TIpcArgs::ENothing ) );
+    }
+
+// -----------------------------------------------------------------------------
+// RConnMonPlugin::SendAttribute
+// Sends an attribute to the Connection Monitor server.
+// -----------------------------------------------------------------------------
+//
+TInt RConnMonPlugin::SendAttribute( const TInt  aType,
+                                    const TUint aAttribute,
+                                    const TInt  aRet,
+                                    const TAny* aValue,
+                                    const TUint aSize ) const
+    {
+    if ( aSize > KConnMonMaxPluginDataSize )
+        {
+        return KErrTooBig;
+        }
+
+    //p[0]= ( TAny* )aAttribute;
+    //p[1]= ( TAny* )aRet;
+
+    if ( ( aType == EReqGetIntAttribute ) || ( aType == EReqGetUintAttribute ) ||
+         ( aType == EReqGetBoolAttribute ) )
+        {
+        TPtrC8 n( reinterpret_cast< const TUint8* >( aValue ), aSize );
+
+        //p[2]= ( TAny* )&n;
+
+        TIpcArgs args( aAttribute, aRet, &n );
+
+        return SendReceive( EReqPluginAttribute, args );
+        }
+    else
+        {
+        //p[2]= const_cast< TAny* >( aValue );
+
+        TIpcArgs args( aAttribute, aRet, aValue );
+
+        return SendReceive( EReqPluginAttribute, args );
+        }
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CPluginAO::CPluginAO
+// -----------------------------------------------------------------------------
+//
+CPluginAO::CPluginAO( RConnMonPlugin& aSession, CConnectionMonitorPlugin& aPlugin )
+    :
+    CActive( EPriorityStandard ),
+    iSession( aSession ),
+    iPlugin( aPlugin ),
+    iBuf( NULL, 0, 0 )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CPluginAO::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CPluginAO::ConstructL()
+    {
+    // Plug-in engine must have an active scheduler
+    CActiveScheduler::Add( this );
+    }
+
+// -----------------------------------------------------------------------------
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CPluginAO::~CPluginAO()
+    {
+    Cancel();
+    }
+
+// -----------------------------------------------------------------------------
+// CPluginAO::ReceiveQuery
+// Requests a new query from Connection Monitor server.
+// -----------------------------------------------------------------------------
+//
+void CPluginAO::ReceiveQuery()
+    {
+    if ( IsActive() )
+        {
+        return;
+        }
+    else
+        {
+        // Must be passed as a descriptor
+        iReqInfo.Reset();
+
+        iBuf.Set( reinterpret_cast< TUint8* >( &iReqInfo ), sizeof( TReqInfo ), sizeof( TReqInfo ) );
+
+        iSession.GetQuery( iBuf, iStatus );
+
+        SetActive();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CPluginAO::RunL
+// Receives the a request from the Connection Monitor server and passes it to the
+// plug-in module. Sends the result back to the server.
+// -----------------------------------------------------------------------------
+//
+void CPluginAO::RunL()
+    {
+    if ( iStatus.Int() == KErrServerBusy )
+        {
+        // Message slot was reserved
+        // Try again
+        ReceiveQuery();
+        }
+    else if ( iStatus.Int() == KErrNone )
+        {
+        // A new request has arrived
+
+        switch ( iReqInfo.iType )
+            {
+            case EReqGetIntAttribute:
+                {
+                TInt value( 0 );
+                TInt ret = iPlugin.GetIntAttribute( iReqInfo.iAttribute, value );
+
+                iSession.SendAttribute( EReqGetIntAttribute,
+                                        iReqInfo.iAttribute,
+                                        ret,
+                                        &value,
+                                        sizeof( TInt ) );
+
+                break;
+                }
+
+            case EReqGetUintAttribute:
+                {
+                TUint value( 0 );
+                TInt ret = iPlugin.GetUintAttribute( iReqInfo.iAttribute, value );
+
+                iSession.SendAttribute( EReqGetUintAttribute,
+                                        iReqInfo.iAttribute,
+                                        ret,
+                                        &value,
+                                        sizeof( TUint ) );
+
+                break;
+                }
+
+            case EReqGetBoolAttribute:
+                {
+                TBool value( EFalse );
+                TInt ret = iPlugin.GetBoolAttribute( iReqInfo.iAttribute, value );
+
+                iSession.SendAttribute( EReqGetBoolAttribute,
+                                        iReqInfo.iAttribute,
+                                        ret,
+                                        &value,
+                                        sizeof( TBool ) );
+
+                break;
+                }
+
+            case EReqGetStringAttribute:
+                {
+                HBufC16* value = HBufC16::NewL( KConnMonMaxStringAttributeLength );
+
+                TPtr16 auxPtr( const_cast< TUint16* >( value->Des().Ptr() ), KConnMonMaxStringAttributeLength );
+                auxPtr.FillZ();
+
+                TInt ret = iPlugin.GetStringAttribute( iReqInfo.iAttribute, auxPtr );
+
+                iSession.SendAttribute( EReqGetStringAttribute,
+                                        iReqInfo.iAttribute,
+                                        ret,
+                                        &auxPtr,
+                                        auxPtr.MaxSize() );
+                delete value;
+
+                break;
+                }
+
+            case EReqGetPckgAttribute:
+                {
+                HBufC8* buf = HBufC8::New( KConnMonMaxPluginDataSize );
+                TPtr8 initptr = buf->Des();
+
+                TInt ret = iPlugin.GetPckgAttribute( iReqInfo.iAttribute, initptr );
+
+                iSession.SendAttribute( EReqGetPckgAttribute,
+                                        iReqInfo.iAttribute,
+                                        ret,
+                                        &initptr,
+                                        KConnMonMaxPluginDataSize );
+
+                delete buf;
+
+                break;
+                }
+
+            case EReqSetIntAttribute:
+                {
+                iPlugin.SetIntAttribute( iReqInfo.iAttribute, iReqInfo.iData );
+
+                break;
+                }
+
+            case EReqSetUintAttribute:
+                {
+                iPlugin.SetUintAttribute( iReqInfo.iAttribute, static_cast< TUint >( iReqInfo.iData ) );
+
+                break;
+                }
+
+            case EReqSetBoolAttribute:
+                {
+                iPlugin.SetBoolAttribute( iReqInfo.iAttribute, static_cast< TBool >( iReqInfo.iData ) );
+
+                break;
+                }
+
+            case EReqSetStringAttribute:
+                {
+                // Not supported
+                break;
+                }
+
+            case EReqSetPckgAttribute:
+                {
+                // Not supported
+                break;
+                }
+
+            default:
+                break;
+            }
+
+        LOG( Log::Printf( _L("Plugin [%d]: served attribute query: Type:<%d>, Attribute:<%d> \n"),
+                          &iSession,
+                          iReqInfo.iType,
+                          iReqInfo.iAttribute ) );
+
+        // initiate the next receive
+        ReceiveQuery();
+        }
+    else
+        {
+        // Log error
+        LOG( Log::Printf( _L("Error in CPluginAO::RunL(): [%d].\n"), iStatus.Int() ) );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CPluginAO::DoCancel
+// Cancels the request from Connection Monitor server.
+// -----------------------------------------------------------------------------
+//
+void CPluginAO::DoCancel()
+    {
+    if ( IsActive() )
+        {
+        iSession.CancelGetQuery();
+        }
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionmonitoring/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2001-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:  Build information file for all projects in connectionmonitoring
+*                subsystem.
+*
+*/
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+#include "../connectionmonitorplugin/group/bld.inf"
+#include "../connectionmonitorui/group/bld.inf"
+#include "../connmon/connectionmonitor/group/bld.inf"
+#include "../connmon/dataconnectionlogger/group/bld.inf"
+#include "../connmonext/group/bld.inf"
+
+PRJ_TESTMMPFILES
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/BWinsCw/ConnUiUtilsNotifU.DEF	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+	?NotifierArray@@YAPAV?$CArrayPtr@VMEikSrvNotifierBase2@@@@XZ @ 1 NONAME ; class CArrayPtr<class MEikSrvNotifierBase2> * NotifierArray(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/BWinsCw/ConnectionUiUtilities_ALRU.def	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,47 @@
+EXPORTS
+	??1CConnectionUiUtilities@@UAE@XZ @ 1 NONAME ; CConnectionUiUtilities::~CConnectionUiUtilities(void)
+	?AlwaysAskPageL@CConnectionUiUtilities@@QAEHAAW4TCuuAlwaysAskResults@@@Z @ 2 NONAME ; int CConnectionUiUtilities::AlwaysAskPageL(enum TCuuAlwaysAskResults &)
+	?CancelChangingConnectionToNote@CConnectionUiUtilities@@QAEXXZ @ 3 NONAME ; void CConnectionUiUtilities::CancelChangingConnectionToNote(void)
+	?CancelConfirmMethodUsageQuery@CConnectionUiUtilities@@QAEXXZ @ 4 NONAME ; void CConnectionUiUtilities::CancelConfirmMethodUsageQuery(void)
+	?CancelConnectedViaConnMethodNote@CConnectionUiUtilities@@QAEXXZ @ 5 NONAME ; void CConnectionUiUtilities::CancelConnectedViaConnMethodNote(void)
+	?CancelConnectedViaDestAndConnMethodNote@CConnectionUiUtilities@@QAEXXZ @ 6 NONAME ; void CConnectionUiUtilities::CancelConnectedViaDestAndConnMethodNote(void)
+	?CancelEasyWepDlg@CConnectionUiUtilities@@QAEXXZ @ 7 NONAME ; void CConnectionUiUtilities::CancelEasyWepDlg(void)
+	?CancelEasyWpaDlg@CConnectionUiUtilities@@QAEXXZ @ 8 NONAME ; void CConnectionUiUtilities::CancelEasyWpaDlg(void)
+	?CancelOffLineWlanNote@CConnectionUiUtilities@@QAEXXZ @ 9 NONAME ; void CConnectionUiUtilities::CancelOffLineWlanNote(void)
+	?CancelReconnectToMethodQuery@CConnectionUiUtilities@@QAEXXZ @ 10 NONAME ; void CConnectionUiUtilities::CancelReconnectToMethodQuery(void)
+	?CancelRoamingToMorePrefMethodQuery@CConnectionUiUtilities@@QAEXXZ @ 11 NONAME ; void CConnectionUiUtilities::CancelRoamingToMorePrefMethodQuery(void)
+	?CancelSearchWLANNetwork@CConnectionUiUtilities@@QAEXXZ @ 12 NONAME ; void CConnectionUiUtilities::CancelSearchWLANNetwork(void)
+	?ChangeConnectionL@CConnectionUiUtilities@@QAEHAAKVTConnectionPrefs@@@Z @ 13 NONAME ; int CConnectionUiUtilities::ChangeConnectionL(unsigned long &, class TConnectionPrefs)
+	?ChangingConnectionToNote@CConnectionUiUtilities@@QAEXK@Z @ 14 NONAME ; void CConnectionUiUtilities::ChangingConnectionToNote(unsigned long)
+	?ChangingConnectionToNote@CConnectionUiUtilities@@QAEXKAAVTRequestStatus@@@Z @ 15 NONAME ; void CConnectionUiUtilities::ChangingConnectionToNote(unsigned long, class TRequestStatus &)
+	?ConfirmMethodUsageQuery@CConnectionUiUtilities@@QAEXKKAAHAAVTRequestStatus@@@Z @ 16 NONAME ; void CConnectionUiUtilities::ConfirmMethodUsageQuery(unsigned long, unsigned long, int &, class TRequestStatus &)
+	?ConfirmMethodUsageQuery@CConnectionUiUtilities@@QAEXKKHAAW4TMsgQueryLinkedResults@@AAVTRequestStatus@@@Z @ 17 NONAME ; void CConnectionUiUtilities::ConfirmMethodUsageQuery(unsigned long, unsigned long, int, enum TMsgQueryLinkedResults &, class TRequestStatus &)
+	?ConnectedViaConnMethodNote@CConnectionUiUtilities@@QAEXK@Z @ 18 NONAME ; void CConnectionUiUtilities::ConnectedViaConnMethodNote(unsigned long)
+	?ConnectedViaConnMethodNote@CConnectionUiUtilities@@QAEXKAAVTRequestStatus@@@Z @ 19 NONAME ; void CConnectionUiUtilities::ConnectedViaConnMethodNote(unsigned long, class TRequestStatus &)
+	?ConnectedViaDestAndConnMethodNote@CConnectionUiUtilities@@QAEXKK@Z @ 20 NONAME ; void CConnectionUiUtilities::ConnectedViaDestAndConnMethodNote(unsigned long, unsigned long)
+	?ConnectedViaDestAndConnMethodNote@CConnectionUiUtilities@@QAEXKKAAVTRequestStatus@@@Z @ 21 NONAME ; void CConnectionUiUtilities::ConnectedViaDestAndConnMethodNote(unsigned long, unsigned long, class TRequestStatus &)
+	?EasyWepDlg@CConnectionUiUtilities@@QAEHPAVTDes16@@@Z @ 22 NONAME ; int CConnectionUiUtilities::EasyWepDlg(class TDes16 *)
+	?EasyWepDlg@CConnectionUiUtilities@@QAEHPAVTDes16@@AAH@Z @ 23 NONAME ; int CConnectionUiUtilities::EasyWepDlg(class TDes16 *, int &)
+	?EasyWpaDlg@CConnectionUiUtilities@@QAEHPAVTDes16@@@Z @ 24 NONAME ; int CConnectionUiUtilities::EasyWpaDlg(class TDes16 *)
+	?NewL@CConnectionUiUtilities@@SAPAV1@XZ @ 25 NONAME ; class CConnectionUiUtilities * CConnectionUiUtilities::NewL(void)
+	?OffLineWlanDisabledNote@CConnectionUiUtilities@@QAEXXZ @ 26 NONAME ; void CConnectionUiUtilities::OffLineWlanDisabledNote(void)
+	?OffLineWlanNote@CConnectionUiUtilities@@QAEHXZ @ 27 NONAME ; int CConnectionUiUtilities::OffLineWlanNote(void)
+	?OffLineWlanNote@CConnectionUiUtilities@@QAEXAAVTRequestStatus@@@Z @ 28 NONAME ; void CConnectionUiUtilities::OffLineWlanNote(class TRequestStatus &)
+	?ReconnectToMethodQuery@CConnectionUiUtilities@@QAEXKAAHAAVTRequestStatus@@@Z @ 29 NONAME ; void CConnectionUiUtilities::ReconnectToMethodQuery(unsigned long, int &, class TRequestStatus &)
+	?ReconnectToMethodQuery@CConnectionUiUtilities@@QAEXKKHAAW4TMsgQueryLinkedResults@@AAVTRequestStatus@@@Z @ 30 NONAME ; void CConnectionUiUtilities::ReconnectToMethodQuery(unsigned long, unsigned long, int, enum TMsgQueryLinkedResults &, class TRequestStatus &)
+	?RoamingToMorePrefMethodQuery@CConnectionUiUtilities@@QAEXKAAHAAVTRequestStatus@@@Z @ 31 NONAME ; void CConnectionUiUtilities::RoamingToMorePrefMethodQuery(unsigned long, int &, class TRequestStatus &)
+	?RoamingToMorePrefMethodQuery@CConnectionUiUtilities@@QAEXKKHAAW4TMsgQueryLinkedResults@@AAVTRequestStatus@@@Z @ 32 NONAME ; void CConnectionUiUtilities::RoamingToMorePrefMethodQuery(unsigned long, unsigned long, int, enum TMsgQueryLinkedResults &, class TRequestStatus &)
+	?SearchWLANNetwork@CConnectionUiUtilities@@QAEHAAV?$TBuf8@$0CA@@@@Z @ 33 NONAME ; int CConnectionUiUtilities::SearchWLANNetwork(class TBuf8<32> &)
+	?SearchWLANNetwork@CConnectionUiUtilities@@QAEHAAV?$TBuf8@$0CA@@@AAW4TWlanConnectionMode@@AAW4TWlanConnectionSecurityMode@@@Z @ 34 NONAME ; int CConnectionUiUtilities::SearchWLANNetwork(class TBuf8<32> &, enum TWlanConnectionMode &, enum TWlanConnectionSecurityMode &)
+	?SearchWLANNetworkAsync@CConnectionUiUtilities@@QAEXAAVTRequestStatus@@AAV?$TBuf8@$0CA@@@AAW4TWlanConnectionMode@@AAW4TWlanConnectionSecurityMode@@@Z @ 35 NONAME ; void CConnectionUiUtilities::SearchWLANNetworkAsync(class TRequestStatus &, class TBuf8<32> &, enum TWlanConnectionMode &, enum TWlanConnectionSecurityMode &)
+	?SearchWLANNetworkSync@CConnectionUiUtilities@@QAEHAAV?$TBuf8@$0CA@@@AAW4TWlanConnectionMode@@AAW4TWlanConnectionSecurityMode@@@Z @ 36 NONAME ; int CConnectionUiUtilities::SearchWLANNetworkSync(class TBuf8<32> &, enum TWlanConnectionMode &, enum TWlanConnectionSecurityMode &)
+	?ShowConnectionChangedNoteL@CConnectionUiUtilities@@QAEXABK@Z @ 37 NONAME ; void CConnectionUiUtilities::ShowConnectionChangedNoteL(unsigned long const &)
+	?WLANNetworkUnavailableNote@CConnectionUiUtilities@@QAEXXZ @ 38 NONAME ; void CConnectionUiUtilities::WLANNetworkUnavailableNote(void)
+	?EasyWepDlg@CConnectionUiUtilities@@QAEXAAVTRequestStatus@@PAVTDes16@@AAH@Z @ 39 NONAME ; void CConnectionUiUtilities::EasyWepDlg(class TRequestStatus &, class TDes16 *, int &)
+	?EasyWpaDlg@CConnectionUiUtilities@@QAEXAAVTRequestStatus@@PAVTDes16@@@Z @ 40 NONAME ; void CConnectionUiUtilities::EasyWpaDlg(class TRequestStatus &, class TDes16 *)
+	?SearchWLANNetwork@CConnectionUiUtilities@@QAEHAAV?$TBuf8@$0CA@@@AAW4TWlanConnectionMode@@AAW4TWlanConnectionExtentedSecurityMode@@@Z @ 41 NONAME ; int CConnectionUiUtilities::SearchWLANNetwork(class TBuf8<32> &, enum TWlanConnectionMode &, enum TWlanConnectionExtentedSecurityMode &)
+	?SearchWLANNetworkAsync@CConnectionUiUtilities@@QAEXAAVTRequestStatus@@AAV?$TBuf8@$0CA@@@AAW4TWlanConnectionMode@@AAW4TWlanConnectionExtentedSecurityMode@@@Z @ 42 NONAME ; void CConnectionUiUtilities::SearchWLANNetworkAsync(class TRequestStatus &, class TBuf8<32> &, enum TWlanConnectionMode &, enum TWlanConnectionExtentedSecurityMode &)
+	?CancelWlanPowerSaveTestNote@CConnectionUiUtilities@@QAEXXZ @ 43 NONAME ; void CConnectionUiUtilities::CancelWlanPowerSaveTestNote(void)
+	?WlanPowerSaveTestNote@CConnectionUiUtilities@@QAEXAAHAAVTRequestStatus@@@Z @ 44 NONAME ; void CConnectionUiUtilities::WlanPowerSaveTestNote(int &, class TRequestStatus &)
+	?EasyWapiDlg@CConnectionUiUtilities@@QAEHPAVTDes16@@@Z @ 45 NONAME ; int CConnectionUiUtilities::EasyWapiDlg(class TDes16 *)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/BWinsCw/ConnectionUiUtilities_PROTU.def	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,56 @@
+EXPORTS
+	??1CConnectionUiUtilities@@UAE@XZ @ 1 NONAME ; CConnectionUiUtilities::~CConnectionUiUtilities(void)
+	?AlwaysAskPageL@CConnectionUiUtilities@@QAEHAAW4TCuuAlwaysAskResults@@@Z @ 2 NONAME ; int CConnectionUiUtilities::AlwaysAskPageL(enum TCuuAlwaysAskResults &)
+	?CancelChangingConnectionToNote@CConnectionUiUtilities@@QAEXXZ @ 3 NONAME ; void CConnectionUiUtilities::CancelChangingConnectionToNote(void)
+	?CancelConfirmMethodUsageQuery@CConnectionUiUtilities@@QAEXXZ @ 4 NONAME ; void CConnectionUiUtilities::CancelConfirmMethodUsageQuery(void)
+	?CancelConnectedViaConnMethodNote@CConnectionUiUtilities@@QAEXXZ @ 5 NONAME ; void CConnectionUiUtilities::CancelConnectedViaConnMethodNote(void)
+	?CancelConnectedViaDestAndConnMethodNote@CConnectionUiUtilities@@QAEXXZ @ 6 NONAME ; void CConnectionUiUtilities::CancelConnectedViaDestAndConnMethodNote(void)
+	?CancelEasyWepDlg@CConnectionUiUtilities@@QAEXXZ @ 7 NONAME ; void CConnectionUiUtilities::CancelEasyWepDlg(void)
+	?CancelEasyWpaDlg@CConnectionUiUtilities@@QAEXXZ @ 8 NONAME ; void CConnectionUiUtilities::CancelEasyWpaDlg(void)
+	?CancelOffLineWlanNote@CConnectionUiUtilities@@QAEXXZ @ 9 NONAME ; void CConnectionUiUtilities::CancelOffLineWlanNote(void)
+	?CancelReconnectToMethodQuery@CConnectionUiUtilities@@QAEXXZ @ 10 NONAME ; void CConnectionUiUtilities::CancelReconnectToMethodQuery(void)
+	?CancelRoamingToMorePrefMethodQuery@CConnectionUiUtilities@@QAEXXZ @ 11 NONAME ; void CConnectionUiUtilities::CancelRoamingToMorePrefMethodQuery(void)
+	?CancelSearchWLANNetwork@CConnectionUiUtilities@@QAEXXZ @ 12 NONAME ; void CConnectionUiUtilities::CancelSearchWLANNetwork(void)
+	?ChangeConnectionL@CConnectionUiUtilities@@QAEHAAKVTConnectionPrefs@@@Z @ 13 NONAME ; int CConnectionUiUtilities::ChangeConnectionL(unsigned long &, class TConnectionPrefs)
+	?ChangingConnectionToNote@CConnectionUiUtilities@@QAEXK@Z @ 14 NONAME ; void CConnectionUiUtilities::ChangingConnectionToNote(unsigned long)
+	?ChangingConnectionToNote@CConnectionUiUtilities@@QAEXKAAVTRequestStatus@@@Z @ 15 NONAME ; void CConnectionUiUtilities::ChangingConnectionToNote(unsigned long, class TRequestStatus &)
+	?ConfirmMethodUsageQuery@CConnectionUiUtilities@@QAEXKKAAHAAVTRequestStatus@@@Z @ 16 NONAME ; void CConnectionUiUtilities::ConfirmMethodUsageQuery(unsigned long, unsigned long, int &, class TRequestStatus &)
+	?ConfirmMethodUsageQuery@CConnectionUiUtilities@@QAEXKKHAAW4TMsgQueryLinkedResults@@AAVTRequestStatus@@@Z @ 17 NONAME ABSENT ; void CConnectionUiUtilities::ConfirmMethodUsageQuery(unsigned long, unsigned long, int, enum TMsgQueryLinkedResults &, class TRequestStatus &)
+	?ConnectedViaConnMethodNote@CConnectionUiUtilities@@QAEXK@Z @ 18 NONAME ; void CConnectionUiUtilities::ConnectedViaConnMethodNote(unsigned long)
+	?ConnectedViaConnMethodNote@CConnectionUiUtilities@@QAEXKAAVTRequestStatus@@@Z @ 19 NONAME ; void CConnectionUiUtilities::ConnectedViaConnMethodNote(unsigned long, class TRequestStatus &)
+	?ConnectedViaDestAndConnMethodNote@CConnectionUiUtilities@@QAEXKK@Z @ 20 NONAME ; void CConnectionUiUtilities::ConnectedViaDestAndConnMethodNote(unsigned long, unsigned long)
+	?ConnectedViaDestAndConnMethodNote@CConnectionUiUtilities@@QAEXKKAAVTRequestStatus@@@Z @ 21 NONAME ; void CConnectionUiUtilities::ConnectedViaDestAndConnMethodNote(unsigned long, unsigned long, class TRequestStatus &)
+	?EasyWepDlg@CConnectionUiUtilities@@QAEHPAVTDes16@@@Z @ 22 NONAME ; int CConnectionUiUtilities::EasyWepDlg(class TDes16 *)
+	?EasyWepDlg@CConnectionUiUtilities@@QAEHPAVTDes16@@AAH@Z @ 23 NONAME ; int CConnectionUiUtilities::EasyWepDlg(class TDes16 *, int &)
+	?EasyWpaDlg@CConnectionUiUtilities@@QAEHPAVTDes16@@@Z @ 24 NONAME ; int CConnectionUiUtilities::EasyWpaDlg(class TDes16 *)
+	?NewL@CConnectionUiUtilities@@SAPAV1@XZ @ 25 NONAME ; class CConnectionUiUtilities * CConnectionUiUtilities::NewL(void)
+	?OffLineWlanDisabledNote@CConnectionUiUtilities@@QAEXXZ @ 26 NONAME ; void CConnectionUiUtilities::OffLineWlanDisabledNote(void)
+	?OffLineWlanNote@CConnectionUiUtilities@@QAEHXZ @ 27 NONAME ; int CConnectionUiUtilities::OffLineWlanNote(void)
+	?OffLineWlanNote@CConnectionUiUtilities@@QAEXAAVTRequestStatus@@@Z @ 28 NONAME ; void CConnectionUiUtilities::OffLineWlanNote(class TRequestStatus &)
+	?ReconnectToMethodQuery@CConnectionUiUtilities@@QAEXKAAHAAVTRequestStatus@@@Z @ 29 NONAME ; void CConnectionUiUtilities::ReconnectToMethodQuery(unsigned long, int &, class TRequestStatus &)
+	?ReconnectToMethodQuery@CConnectionUiUtilities@@QAEXKKHAAW4TMsgQueryLinkedResults@@AAVTRequestStatus@@@Z @ 30 NONAME ; void CConnectionUiUtilities::ReconnectToMethodQuery(unsigned long, unsigned long, int, enum TMsgQueryLinkedResults &, class TRequestStatus &)
+	?RoamingToMorePrefMethodQuery@CConnectionUiUtilities@@QAEXKAAHAAVTRequestStatus@@@Z @ 31 NONAME ; void CConnectionUiUtilities::RoamingToMorePrefMethodQuery(unsigned long, int &, class TRequestStatus &)
+	?RoamingToMorePrefMethodQuery@CConnectionUiUtilities@@QAEXKKHAAW4TMsgQueryLinkedResults@@AAVTRequestStatus@@@Z @ 32 NONAME ; void CConnectionUiUtilities::RoamingToMorePrefMethodQuery(unsigned long, unsigned long, int, enum TMsgQueryLinkedResults &, class TRequestStatus &)
+	?SearchWLANNetwork@CConnectionUiUtilities@@QAEHAAV?$TBuf8@$0CA@@@@Z @ 33 NONAME ; int CConnectionUiUtilities::SearchWLANNetwork(class TBuf8<32> &)
+	?SearchWLANNetwork@CConnectionUiUtilities@@QAEHAAV?$TBuf8@$0CA@@@AAW4TWlanConnectionMode@@AAW4TWlanConnectionSecurityMode@@@Z @ 34 NONAME ; int CConnectionUiUtilities::SearchWLANNetwork(class TBuf8<32> &, enum TWlanConnectionMode &, enum TWlanConnectionSecurityMode &)
+	?SearchWLANNetwork@CConnectionUiUtilities@@QAEHAAV?$TBuf8@$0CA@@@AAW4TWlanConnectionMode@@AAW4TWlanConnectionSecurityMode@@AAH@Z @ 35 NONAME ; int CConnectionUiUtilities::SearchWLANNetwork(class TBuf8<32> &, enum TWlanConnectionMode &, enum TWlanConnectionSecurityMode &, int &)
+	?SearchWLANNetworkAsync@CConnectionUiUtilities@@QAEXAAVTRequestStatus@@AAV?$TBuf8@$0CA@@@AAW4TWlanConnectionMode@@AAW4TWlanConnectionSecurityMode@@@Z @ 36 NONAME ; void CConnectionUiUtilities::SearchWLANNetworkAsync(class TRequestStatus &, class TBuf8<32> &, enum TWlanConnectionMode &, enum TWlanConnectionSecurityMode &)
+	?SearchWLANNetworkAsync@CConnectionUiUtilities@@QAEXAAVTRequestStatus@@AAV?$TBuf8@$0CA@@@AAW4TWlanConnectionMode@@AAW4TWlanConnectionSecurityMode@@AAH@Z @ 37 NONAME ; void CConnectionUiUtilities::SearchWLANNetworkAsync(class TRequestStatus &, class TBuf8<32> &, enum TWlanConnectionMode &, enum TWlanConnectionSecurityMode &, int &)
+	?SearchWLANNetworkSync@CConnectionUiUtilities@@QAEHAAV?$TBuf8@$0CA@@@AAW4TWlanConnectionMode@@AAW4TWlanConnectionSecurityMode@@@Z @ 38 NONAME ; int CConnectionUiUtilities::SearchWLANNetworkSync(class TBuf8<32> &, enum TWlanConnectionMode &, enum TWlanConnectionSecurityMode &)
+	?SearchWLANNetworkSync@CConnectionUiUtilities@@QAEHAAV?$TBuf8@$0CA@@@AAW4TWlanConnectionMode@@AAW4TWlanConnectionSecurityMode@@AAH@Z @ 39 NONAME ; int CConnectionUiUtilities::SearchWLANNetworkSync(class TBuf8<32> &, enum TWlanConnectionMode &, enum TWlanConnectionSecurityMode &, int &)
+	?ShowConnectionChangedNoteL@CConnectionUiUtilities@@QAEXABK@Z @ 40 NONAME ; void CConnectionUiUtilities::ShowConnectionChangedNoteL(unsigned long const &)
+	?WLANNetworkUnavailableNote@CConnectionUiUtilities@@QAEXXZ @ 41 NONAME ; void CConnectionUiUtilities::WLANNetworkUnavailableNote(void)
+	?EasyWepDlg@CConnectionUiUtilities@@QAEXAAVTRequestStatus@@PAVTDes16@@AAH@Z @ 42 NONAME ; void CConnectionUiUtilities::EasyWepDlg(class TRequestStatus &, class TDes16 *, int &)
+	?EasyWpaDlg@CConnectionUiUtilities@@QAEXAAVTRequestStatus@@PAVTDes16@@@Z @ 43 NONAME ; void CConnectionUiUtilities::EasyWpaDlg(class TRequestStatus &, class TDes16 *)
+	?SearchWLANNetwork@CConnectionUiUtilities@@QAEHAAV?$TBuf8@$0CA@@@AAW4TWlanConnectionMode@@AAW4TWlanConnectionExtentedSecurityMode@@@Z @ 44 NONAME ; int CConnectionUiUtilities::SearchWLANNetwork(class TBuf8<32> &, enum TWlanConnectionMode &, enum TWlanConnectionExtentedSecurityMode &)
+	?SearchWLANNetworkAsync@CConnectionUiUtilities@@QAEXAAVTRequestStatus@@AAV?$TBuf8@$0CA@@@AAW4TWlanConnectionMode@@AAW4TWlanConnectionExtentedSecurityMode@@@Z @ 45 NONAME ; void CConnectionUiUtilities::SearchWLANNetworkAsync(class TRequestStatus &, class TBuf8<32> &, enum TWlanConnectionMode &, enum TWlanConnectionExtentedSecurityMode &)
+	?SearchWLANNetworkAsync@CConnectionUiUtilities@@QAEXAAVTRequestStatus@@AAV?$TBuf8@$0CA@@@AAW4TWlanConnectionMode@@AAW4TWlanConnectionExtentedSecurityMode@@AAH@Z @ 46 NONAME ; void CConnectionUiUtilities::SearchWLANNetworkAsync(class TRequestStatus &, class TBuf8<32> &, enum TWlanConnectionMode &, enum TWlanConnectionExtentedSecurityMode &, int &)
+	?SearchWLANNetwork@CConnectionUiUtilities@@QAEHAAV?$TBuf8@$0CA@@@AAW4TWlanConnectionMode@@AAW4TWlanConnectionExtentedSecurityMode@@AAH@Z @ 47 NONAME ; int CConnectionUiUtilities::SearchWLANNetwork(class TBuf8<32> &, enum TWlanConnectionMode &, enum TWlanConnectionExtentedSecurityMode &, int &)
+	?CancelWlanPowerSaveTestNote@CConnectionUiUtilities@@QAEXXZ @ 48 NONAME ; void CConnectionUiUtilities::CancelWlanPowerSaveTestNote(void)
+	?WlanPowerSaveTestNote@CConnectionUiUtilities@@QAEXAAHAAVTRequestStatus@@@Z @ 49 NONAME ; void CConnectionUiUtilities::WlanPowerSaveTestNote(int &, class TRequestStatus &)
+	?EasyWapiDlg@CConnectionUiUtilities@@QAEHPAVTDes16@@@Z @ 50 NONAME ; int CConnectionUiUtilities::EasyWapiDlg(class TDes16 *)
+	?NoWLANNetworksAvailableNote@CConnectionUiUtilities@@QAEXXZ @ 51 NONAME ; void CConnectionUiUtilities::NoWLANNetworksAvailableNote(void)
+	?ConfirmMethodUsageQuery@CConnectionUiUtilities@@QAEXAAW4TMsgQueryLinkedResults@@HAAVTRequestStatus@@@Z @ 52 NONAME ; void CConnectionUiUtilities::ConfirmMethodUsageQuery(enum TMsgQueryLinkedResults &, int, class TRequestStatus &)
+	?ConnectingViaDiscreetPopup@CConnectionUiUtilities@@QAEXABKH@Z @ 53 NONAME ; void CConnectionUiUtilities::ConnectingViaDiscreetPopup(unsigned long const &, int)
+	?ConnectionErrorDiscreetPopup@CConnectionUiUtilities@@QAEXABH@Z @ 54 NONAME ; void CConnectionUiUtilities::ConnectionErrorDiscreetPopup(int const &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/EABI/ConnUiUtilsNotifU.DEF	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z13NotifierArrayv @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/EABI/ConnectionUiUtilities_ALRU.def	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,49 @@
+EXPORTS
+	_ZN22CConnectionUiUtilities10EasyWepDlgEP6TDes16 @ 1 NONAME
+	_ZN22CConnectionUiUtilities10EasyWepDlgEP6TDes16Ri @ 2 NONAME
+	_ZN22CConnectionUiUtilities10EasyWpaDlgEP6TDes16 @ 3 NONAME
+	_ZN22CConnectionUiUtilities14AlwaysAskPageLER20TCuuAlwaysAskResults @ 4 NONAME
+	_ZN22CConnectionUiUtilities15OffLineWlanNoteER14TRequestStatus @ 5 NONAME
+	_ZN22CConnectionUiUtilities15OffLineWlanNoteEv @ 6 NONAME
+	_ZN22CConnectionUiUtilities16CancelEasyWepDlgEv @ 7 NONAME
+	_ZN22CConnectionUiUtilities16CancelEasyWpaDlgEv @ 8 NONAME
+	_ZN22CConnectionUiUtilities17ChangeConnectionLERm16TConnectionPrefs @ 9 NONAME
+	_ZN22CConnectionUiUtilities17SearchWLANNetworkER5TBuf8ILi32EE @ 10 NONAME
+	_ZN22CConnectionUiUtilities17SearchWLANNetworkER5TBuf8ILi32EER19TWlanConnectionModeR27TWlanConnectionSecurityMode @ 11 NONAME
+	_ZN22CConnectionUiUtilities21CancelOffLineWlanNoteEv @ 12 NONAME
+	_ZN22CConnectionUiUtilities21SearchWLANNetworkSyncER5TBuf8ILi32EER19TWlanConnectionModeR27TWlanConnectionSecurityMode @ 13 NONAME
+	_ZN22CConnectionUiUtilities22ReconnectToMethodQueryEmRiR14TRequestStatus @ 14 NONAME
+	_ZN22CConnectionUiUtilities22ReconnectToMethodQueryEmmiR22TMsgQueryLinkedResultsR14TRequestStatus @ 15 NONAME
+	_ZN22CConnectionUiUtilities22SearchWLANNetworkAsyncER14TRequestStatusR5TBuf8ILi32EER19TWlanConnectionModeR27TWlanConnectionSecurityMode @ 16 NONAME
+	_ZN22CConnectionUiUtilities23CancelSearchWLANNetworkEv @ 17 NONAME
+	_ZN22CConnectionUiUtilities23ConfirmMethodUsageQueryEmmRiR14TRequestStatus @ 18 NONAME
+	_ZN22CConnectionUiUtilities23ConfirmMethodUsageQueryEmmiR22TMsgQueryLinkedResultsR14TRequestStatus @ 19 NONAME
+	_ZN22CConnectionUiUtilities23OffLineWlanDisabledNoteEv @ 20 NONAME
+	_ZN22CConnectionUiUtilities24ChangingConnectionToNoteEm @ 21 NONAME
+	_ZN22CConnectionUiUtilities24ChangingConnectionToNoteEmR14TRequestStatus @ 22 NONAME
+	_ZN22CConnectionUiUtilities26ConnectedViaConnMethodNoteEm @ 23 NONAME
+	_ZN22CConnectionUiUtilities26ConnectedViaConnMethodNoteEmR14TRequestStatus @ 24 NONAME
+	_ZN22CConnectionUiUtilities26ShowConnectionChangedNoteLERKm @ 25 NONAME
+	_ZN22CConnectionUiUtilities26WLANNetworkUnavailableNoteEv @ 26 NONAME
+	_ZN22CConnectionUiUtilities28CancelReconnectToMethodQueryEv @ 27 NONAME
+	_ZN22CConnectionUiUtilities28RoamingToMorePrefMethodQueryEmRiR14TRequestStatus @ 28 NONAME
+	_ZN22CConnectionUiUtilities28RoamingToMorePrefMethodQueryEmmiR22TMsgQueryLinkedResultsR14TRequestStatus @ 29 NONAME
+	_ZN22CConnectionUiUtilities29CancelConfirmMethodUsageQueryEv @ 30 NONAME
+	_ZN22CConnectionUiUtilities30CancelChangingConnectionToNoteEv @ 31 NONAME
+	_ZN22CConnectionUiUtilities32CancelConnectedViaConnMethodNoteEv @ 32 NONAME
+	_ZN22CConnectionUiUtilities33ConnectedViaDestAndConnMethodNoteEmm @ 33 NONAME
+	_ZN22CConnectionUiUtilities33ConnectedViaDestAndConnMethodNoteEmmR14TRequestStatus @ 34 NONAME
+	_ZN22CConnectionUiUtilities34CancelRoamingToMorePrefMethodQueryEv @ 35 NONAME
+	_ZN22CConnectionUiUtilities39CancelConnectedViaDestAndConnMethodNoteEv @ 36 NONAME
+	_ZN22CConnectionUiUtilities4NewLEv @ 37 NONAME
+	_ZN22CConnectionUiUtilitiesD0Ev @ 38 NONAME
+	_ZN22CConnectionUiUtilitiesD1Ev @ 39 NONAME
+	_ZN22CConnectionUiUtilitiesD2Ev @ 40 NONAME
+	_ZN22CConnectionUiUtilities10EasyWepDlgER14TRequestStatusP6TDes16Ri @ 41 NONAME
+	_ZN22CConnectionUiUtilities10EasyWpaDlgER14TRequestStatusP6TDes16 @ 42 NONAME
+	_ZN22CConnectionUiUtilities17SearchWLANNetworkER5TBuf8ILi32EER19TWlanConnectionModeR35TWlanConnectionExtentedSecurityMode @ 43 NONAME
+	_ZN22CConnectionUiUtilities22SearchWLANNetworkAsyncER14TRequestStatusR5TBuf8ILi32EER19TWlanConnectionModeR35TWlanConnectionExtentedSecurityMode @ 44 NONAME
+	_ZN22CConnectionUiUtilities21WlanPowerSaveTestNoteERiR14TRequestStatus @ 45 NONAME
+	_ZN22CConnectionUiUtilities27CancelWlanPowerSaveTestNoteEv @ 46 NONAME
+	_ZN22CConnectionUiUtilities11EasyWapiDlgEP6TDes16 @ 47 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/EABI/ConnectionUiUtilities_PROTU.def	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,58 @@
+EXPORTS
+	_ZN22CConnectionUiUtilities10EasyWepDlgEP6TDes16 @ 1 NONAME
+	_ZN22CConnectionUiUtilities10EasyWepDlgEP6TDes16Ri @ 2 NONAME
+	_ZN22CConnectionUiUtilities10EasyWpaDlgEP6TDes16 @ 3 NONAME
+	_ZN22CConnectionUiUtilities14AlwaysAskPageLER20TCuuAlwaysAskResults @ 4 NONAME
+	_ZN22CConnectionUiUtilities15OffLineWlanNoteER14TRequestStatus @ 5 NONAME
+	_ZN22CConnectionUiUtilities15OffLineWlanNoteEv @ 6 NONAME
+	_ZN22CConnectionUiUtilities16CancelEasyWepDlgEv @ 7 NONAME
+	_ZN22CConnectionUiUtilities16CancelEasyWpaDlgEv @ 8 NONAME
+	_ZN22CConnectionUiUtilities17ChangeConnectionLERm16TConnectionPrefs @ 9 NONAME
+	_ZN22CConnectionUiUtilities17SearchWLANNetworkER5TBuf8ILi32EE @ 10 NONAME
+	_ZN22CConnectionUiUtilities17SearchWLANNetworkER5TBuf8ILi32EER19TWlanConnectionModeR27TWlanConnectionSecurityMode @ 11 NONAME
+	_ZN22CConnectionUiUtilities17SearchWLANNetworkER5TBuf8ILi32EER19TWlanConnectionModeR27TWlanConnectionSecurityModeRi @ 12 NONAME
+	_ZN22CConnectionUiUtilities21CancelOffLineWlanNoteEv @ 13 NONAME
+	_ZN22CConnectionUiUtilities21SearchWLANNetworkSyncER5TBuf8ILi32EER19TWlanConnectionModeR27TWlanConnectionSecurityMode @ 14 NONAME
+	_ZN22CConnectionUiUtilities21SearchWLANNetworkSyncER5TBuf8ILi32EER19TWlanConnectionModeR27TWlanConnectionSecurityModeRi @ 15 NONAME
+	_ZN22CConnectionUiUtilities22ReconnectToMethodQueryEmRiR14TRequestStatus @ 16 NONAME
+	_ZN22CConnectionUiUtilities22ReconnectToMethodQueryEmmiR22TMsgQueryLinkedResultsR14TRequestStatus @ 17 NONAME
+	_ZN22CConnectionUiUtilities22SearchWLANNetworkAsyncER14TRequestStatusR5TBuf8ILi32EER19TWlanConnectionModeR27TWlanConnectionSecurityMode @ 18 NONAME
+	_ZN22CConnectionUiUtilities22SearchWLANNetworkAsyncER14TRequestStatusR5TBuf8ILi32EER19TWlanConnectionModeR27TWlanConnectionSecurityModeRi @ 19 NONAME
+	_ZN22CConnectionUiUtilities23CancelSearchWLANNetworkEv @ 20 NONAME
+	_ZN22CConnectionUiUtilities23ConfirmMethodUsageQueryEmmRiR14TRequestStatus @ 21 NONAME
+	_ZN22CConnectionUiUtilities23ConfirmMethodUsageQueryEmmiR22TMsgQueryLinkedResultsR14TRequestStatus @ 22 NONAME ABSENT
+	_ZN22CConnectionUiUtilities23OffLineWlanDisabledNoteEv @ 23 NONAME
+	_ZN22CConnectionUiUtilities24ChangingConnectionToNoteEm @ 24 NONAME
+	_ZN22CConnectionUiUtilities24ChangingConnectionToNoteEmR14TRequestStatus @ 25 NONAME
+	_ZN22CConnectionUiUtilities26ConnectedViaConnMethodNoteEm @ 26 NONAME
+	_ZN22CConnectionUiUtilities26ConnectedViaConnMethodNoteEmR14TRequestStatus @ 27 NONAME
+	_ZN22CConnectionUiUtilities26ShowConnectionChangedNoteLERKm @ 28 NONAME
+	_ZN22CConnectionUiUtilities26WLANNetworkUnavailableNoteEv @ 29 NONAME
+	_ZN22CConnectionUiUtilities28CancelReconnectToMethodQueryEv @ 30 NONAME
+	_ZN22CConnectionUiUtilities28RoamingToMorePrefMethodQueryEmRiR14TRequestStatus @ 31 NONAME
+	_ZN22CConnectionUiUtilities28RoamingToMorePrefMethodQueryEmmiR22TMsgQueryLinkedResultsR14TRequestStatus @ 32 NONAME
+	_ZN22CConnectionUiUtilities29CancelConfirmMethodUsageQueryEv @ 33 NONAME
+	_ZN22CConnectionUiUtilities30CancelChangingConnectionToNoteEv @ 34 NONAME
+	_ZN22CConnectionUiUtilities32CancelConnectedViaConnMethodNoteEv @ 35 NONAME
+	_ZN22CConnectionUiUtilities33ConnectedViaDestAndConnMethodNoteEmm @ 36 NONAME
+	_ZN22CConnectionUiUtilities33ConnectedViaDestAndConnMethodNoteEmmR14TRequestStatus @ 37 NONAME
+	_ZN22CConnectionUiUtilities34CancelRoamingToMorePrefMethodQueryEv @ 38 NONAME
+	_ZN22CConnectionUiUtilities39CancelConnectedViaDestAndConnMethodNoteEv @ 39 NONAME
+	_ZN22CConnectionUiUtilities4NewLEv @ 40 NONAME
+	_ZN22CConnectionUiUtilitiesD0Ev @ 41 NONAME
+	_ZN22CConnectionUiUtilitiesD1Ev @ 42 NONAME
+	_ZN22CConnectionUiUtilitiesD2Ev @ 43 NONAME
+	_ZN22CConnectionUiUtilities10EasyWepDlgER14TRequestStatusP6TDes16Ri @ 44 NONAME
+	_ZN22CConnectionUiUtilities10EasyWpaDlgER14TRequestStatusP6TDes16 @ 45 NONAME
+	_ZN22CConnectionUiUtilities17SearchWLANNetworkER5TBuf8ILi32EER19TWlanConnectionModeR35TWlanConnectionExtentedSecurityMode @ 46 NONAME
+	_ZN22CConnectionUiUtilities17SearchWLANNetworkER5TBuf8ILi32EER19TWlanConnectionModeR35TWlanConnectionExtentedSecurityModeRi @ 47 NONAME
+	_ZN22CConnectionUiUtilities22SearchWLANNetworkAsyncER14TRequestStatusR5TBuf8ILi32EER19TWlanConnectionModeR35TWlanConnectionExtentedSecurityMode @ 48 NONAME
+	_ZN22CConnectionUiUtilities22SearchWLANNetworkAsyncER14TRequestStatusR5TBuf8ILi32EER19TWlanConnectionModeR35TWlanConnectionExtentedSecurityModeRi @ 49 NONAME
+	_ZN22CConnectionUiUtilities21WlanPowerSaveTestNoteERiR14TRequestStatus @ 50 NONAME
+	_ZN22CConnectionUiUtilities27CancelWlanPowerSaveTestNoteEv @ 51 NONAME
+	_ZN22CConnectionUiUtilities11EasyWapiDlgEP6TDes16 @ 52 NONAME
+	_ZN22CConnectionUiUtilities23ConfirmMethodUsageQueryER22TMsgQueryLinkedResultsiR14TRequestStatus @ 53 NONAME
+	_ZN22CConnectionUiUtilities26ConnectingViaDiscreetPopupERKmi @ 54 NONAME
+	_ZN22CConnectionUiUtilities27NoWLANNetworksAvailableNoteEv @ 55 NONAME
+	_ZN22CConnectionUiUtilities28ConnectionErrorDiscreetPopupERKi @ 56 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/ActiveConnectViaNote.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,104 @@
+/*
+* 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 CActiveConnectViaNote
+*
+*/
+
+
+#ifndef __ACTIVE_CONNECT_VIA_NOTE_H__
+#define __ACTIVE_CONNECT_VIA_NOTE_H__
+
+// INCLUDES
+#include "ConnectionUiUtilitiesCommon.h"
+#include <e32base.h>
+#include <cmmanager.h>
+
+// FORWARD DECLARATIONS
+class CConnectViaNoteNotif;
+class CGulIcon;
+class CEikImage;
+
+
+/**
+ * CActiveConnectViaNote class,
+ * an active object for COfflineWlanDisabledNoteNotif
+ */     
+NONSHARABLE_CLASS( CActiveConnectViaNote ) : public CActive
+{
+public:
+    /**
+    * Constructor
+    */    
+    CActiveConnectViaNote( CConnectViaNoteNotif* aNotif, 
+                           const TConnUiUiDestConnMethodNoteId aData );
+
+    /**
+    * Launch ConnectViaNote setactive and starts active object
+    */    
+    void LaunchActiveConnectViaNote();
+    
+    /**
+    * Destructor
+    */
+    virtual ~CActiveConnectViaNote();
+
+protected:
+    /**
+    * DoCancel from CActive
+    */    
+    virtual void DoCancel();
+      
+    /**
+    * RunL from CActive
+    */      
+    virtual void RunL();
+    
+    /**
+    * GetDialogTextL() 
+    * @return 
+    */
+    HBufC* GetDialogTextL();
+
+    /**
+    * GetDestinationNameLC() 
+    * @param  aDestId
+    * @return 
+    */
+    HBufC* GetDestinationNameLC( const TUint32 aDestId );
+    
+    /**
+    * GetConnectionMethodNameLC
+    * @param aConnMId
+    * @return
+    */
+    HBufC* GetConnectionMethodNameLC( const TUint32 aConnMId );
+    
+    /**
+    * CreateEikImageFromCGulIconLC
+    * @return CEikImage*
+    */
+    CEikImage* CreateEikImageFromCGulIconLC();    
+    
+protected:
+    TRequestStatus* iClientStatus;   ///< used for complete runl, not owned 
+    CConnectViaNoteNotif* iNotif; ///< poiter to notifer, not owned
+    CGulIcon* iIcon;    
+    
+    TConnUiUiDestConnMethodNoteId iData;
+    RCmManager iCmManager;    
+};         
+
+#endif // __ACTIVE_CONNECT_VIA_NOTE_H__
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/ActiveOfflineWlanDisabledNote.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,66 @@
+/*
+* 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:  Declaration of CActiveOfflineWlanDisabledNote
+*
+*/
+
+
+#ifndef __ACTIVE_OFFLINE_WLAN_DISABLED_NOTE_H__
+#define __ACTIVE_OFFLINE_WLAN_DISABLED_NOTE_H__
+
+// INCLUDES
+#include "OfflineWlanDisabledNoteNotif.h"
+
+/**
+ * CActiveOfflineWlanDisabledNote class,
+ * an active object for COfflineWlanDisabledNoteNotif
+ */     
+NONSHARABLE_CLASS( CActiveOfflineWlanDisabledNote ) : public CActive
+{
+public:
+    /**
+    * Constructor
+    */    
+    CActiveOfflineWlanDisabledNote( COfflineWlanDisabledNoteNotif* aNotif );
+
+    /**
+    * Launch OfflineWlanDisabledNote setactive and starts active object
+    */    
+    void LaunchOfflineWlanDisabledNote();
+    
+    /**
+    * Destructor
+    */
+    virtual ~CActiveOfflineWlanDisabledNote();
+
+protected:
+    /**
+    * DoCancel from CActive
+    */    
+      virtual void DoCancel();
+      
+    /**
+    * RunL from CActive
+    */      
+    virtual void RunL();
+    
+protected:
+    TRequestStatus* iClientStatus;   ///< used for complete runl, not owned 
+    COfflineWlanDisabledNoteNotif* iNotif; ///< poiter to notifer, not owned
+              
+};         
+
+#endif // __ACTIVE_OFFLINE_WLAN_DISABLED_NOTE_H__
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/ActiveSelectWLanDlgPlugin.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,132 @@
+/*
+* 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:  Declaration of CActiveSelectWLanDlgPlugin
+*
+*/
+
+
+
+#ifndef __ACTIVE_SELECT_WLAN_DLG_PLUGIN_H__
+#define __ACTIVE_SELECT_WLAN_DLG_PLUGIN_H__
+
+// INCLUDES
+#include "SelectWLanDlgPlugin.h"
+#include "SelectWLANDlg.h"
+#include "WlanNetworkDataProvider.h"
+#include "ConnectionUiUtilitiesCommon.h"
+
+/**
+ * CActiveSelectWLanDlgPlugin class,
+ * an active object for CSelectWLanDlgPlugin
+ */     
+NONSHARABLE_CLASS( CActiveSelectWLanDlgPlugin ) : public CActive
+{
+public:
+    /**
+    * NewL function
+    * @param  aPlugin a pointer to notifier plugin
+    */
+    static CActiveSelectWLanDlgPlugin* NewL( CSelectWLanDlgPlugin* aPlugin );
+    
+    /**
+    * StartSearchWlanNetworkL setactive and starts active object
+    */    
+    void StartSearchWlanNetworkL();
+
+    /**
+    * Destructor
+    */    
+    virtual ~CActiveSelectWLanDlgPlugin();
+    
+    /**
+    * Timer callback of iPeridoc.
+    */
+    static TInt Tick( TAny* aObject );    
+    
+    /**
+    * Timer callback of iPeridoc.
+    */
+    void DoTick();    
+      
+        
+protected:
+    /**
+    * ConstructL 
+    */
+    void ConstructL();
+    
+    /**
+    * Constructor
+    * @param  aPlugin a pointer to notifier plugin    
+    */    
+    CActiveSelectWLanDlgPlugin( CSelectWLanDlgPlugin* aPlugin );
+    
+    /**
+    * Starts Timer
+    * @param aTickInterval refersh interval
+    */
+    void StartTimerL(  TInt aTickInterval );
+    
+    /**
+    * Stops Timer
+    */
+    void StopTimer();                                            
+        
+    /**
+    * DoCancel from CActive
+    */    
+      virtual void DoCancel();
+      
+    /**
+    * RunL from CActive
+    */      
+    virtual void RunL();
+        
+    /**
+    * Gives back, refresh interval of scan for network
+    */
+    TInt GetRefreshInterval();
+
+    /**
+    * Destroy wait dialog 
+    */
+    void DestroyWaitDialog();
+    
+    /**
+    * Destroy results dialog
+    */
+    void DestroyResultsListDialog();
+    
+
+protected:
+    
+    // a pointer to notifer, not owned 
+    CSelectWLanDlgPlugin* iPlugin;
+
+    //owned
+    CWlanNetworkDataProvider* iWlanDataProv;
+
+    // Timer, to refresh details of networks. Owned.
+    CPeriodic* iPeriodic;
+
+    // Pointer to the dialog
+    CSelectWLANDlg* iResultsListDialog;
+    
+    CAknWaitDialog* iWaitDialog;
+    
+};     
+
+#endif // __ACTIVE_SELECT_WLAN_DLG_PLUGIN_H__
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/ActiveWLANNetworkUnavailableNote.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,78 @@
+/*
+* 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:  Declaration of CActiveWLANNetworkUnavailableNote
+*
+*/
+
+
+
+#ifndef __ACTVE_WLAN_UNAVAILABLE_NOTE_H__
+#define __ACTVE_WLAN_UNAVAILABLE_NOTE_H__
+
+
+// INCLUDES
+#include "ConnectionUiUtilitiesCommon.h"
+#include "ConnectionDialogsNotifBase.h"
+//#include "WLANNetworkUnavailableNoteNotif.h"
+
+/**
+ * CActiveOfflineWlanDisabledNote class,
+ * an active object for COfflineWlanDisabledNoteNotif
+ */     
+NONSHARABLE_CLASS( CActiveWLANNetworkUnavailableNote ) : public CActive
+{
+public:
+    
+    enum
+        {
+        EWlanNote1     = 0, // R_WLAN_NETWORK_UNAVAILABLE
+        EWlanNote2     = 1  // R_OCC_INFO_NO_WLAN_AVAILABLE
+        };
+
+    /**
+    * Constructor
+    */    
+    CActiveWLANNetworkUnavailableNote( CConnectionDialogsNotifBase* aNotif );
+
+    /**
+    * Launch OfflineWlanDisabledNote setactive and starts active object
+    */    
+    void LaunchWLANNetworkUnavailable( const TInt aNoteType );
+    
+    /**
+    * Destructor
+    */
+    virtual ~CActiveWLANNetworkUnavailableNote();
+
+protected:
+    /**
+    * DoCancel from CActive
+    */    
+      virtual void DoCancel();
+      
+    /**
+    * RunL from CActive
+    */      
+    virtual void RunL();
+    
+protected:
+    TRequestStatus* iClientStatus;   ///< used for complete runl, not owned 
+    CConnectionDialogsNotifBase* iNotif; ///< poiter to notifer, not owned
+    TInt                         iNoteType; // Type of the text to be shown
+              
+};         
+
+#endif // __ACTVE_WLAN_UNAVAILABLE_NOTE_H__
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/ConfirmationQuery.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,109 @@
+/*
+* 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:  Implementation of class CConfirmationQuery.
+*
+*/
+
+
+#ifndef __CONFIRMATION_QUERY_H__
+#define __CONFIRMATION_QUERY_H__
+
+// INCLUDES
+#include <aknmessagequerydialog.h>
+#include <ConnectionUiUtilities.h>
+#include "ExpiryTimerCallback.h"
+// FORWARD DECLARATIONS
+class CConfirmationQueryNotif;
+class CExpiryTimer;
+
+// CLASS DECLARATIONS
+
+/**
+ * Class implements a query dialog.
+ */
+NONSHARABLE_CLASS( CConfirmationQuery ) : public CAknListQueryDialog, public MExpiryTimerCallback
+    {
+    public:
+        /**
+        * Constructor the CConfirmationQuery class
+        * @param aNotif notifier pointer
+        * @param aNameOfConnMethod 
+        * @param aUIId    
+        * @return -
+        */
+        CConfirmationQuery( CConfirmationQueryNotif* aNotif );
+
+        /**
+        * Exit function the CConfirmationQuery
+        * @param aButtonId 
+        * @return TBool exit or no
+        */
+        virtual TBool OkToExitL( TInt aButtonId );
+    
+        /**
+        * Dialog expiration timeout callback
+        */
+        void HandleTimedOut();
+        
+        /**
+        * Destructor
+        */
+        virtual ~CConfirmationQuery();     
+
+        /**
+        * Tries to exit the dialog when the specified button is pressed, if this 
+        * button should exit the dialog.
+        *
+        * See @c OkToExitL() to determine which buttons can exit the dialog.
+        * 
+        * This will fail if user exit is prevented by the 
+        * @c EEikDialogFlagNoUserExit flag. If the @c EEikDialogFlagNotifyEsc flag
+        * is not set and the dialog has been cancelled it immediately deletes 
+        * itself.
+        * 
+        * @param aButtonId The id of the pressed button.
+        */
+        void TryExitL( TInt aButtonId );
+        
+        TBool NeedToDismissQueryL(const TKeyEvent& aKeyEvent);
+        
+        /**
+        * Sets the available choices for the query into the class variable
+        * @param    aChoices RArray<TInt>
+        */
+        void SetChoices( RArray<TMsgQueryLinkedResults> aChoices );
+
+    private:
+        /**
+        * PreLayoutDynInitL
+        * @param    -
+        */
+        virtual void PreLayoutDynInitL();    
+
+    private:
+        CConfirmationQueryNotif* iNotif;  // Pointer to the Notifier, not owned
+        TBool iButtonGroupPreviouslyChanged;    // Was ButtonGroup modified?
+        
+        RArray<TMsgQueryLinkedResults> iChoiceIds;
+        // For base class, unused.
+        TInt iDummy;
+		
+        // Pointer for dialog expiration timer
+        CExpiryTimer* iExpiryTimer;
+    };
+
+
+#endif  // __CONFIRMATION_QUERY_H__
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/ConfirmationQueryNotif.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,130 @@
+/*
+* 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 CConfirmationQueryNotif
+*
+*/
+
+
+
+#ifndef __CONFIRMATIONQUERYNOTIF_H__
+#define __CONFIRMATIONQUERYNOTIF_H__
+
+
+// INCLUDES
+#include "ConnectionDialogsNotifBase.h"
+#include "ConnectionUiUtilitiesCommon.h"
+#include <etel3rdparty.h>
+#include <ConnectionUiUtilities.h>
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class CConfirmationQuery;
+class CRoamingInfo;
+
+/**
+ * OfflineWlanNoteNotif class
+ */
+NONSHARABLE_CLASS( CConfirmationQueryNotif ) 
+                                        : public CConnectionDialogsNotifBase
+    {
+    public:
+    
+        /**
+        * Constructor.
+        */
+        CConfirmationQueryNotif();
+
+        /**
+        * NewL function
+        * @param  -
+        * return CConfirmationQueryNotif*
+        */
+        static CConfirmationQueryNotif* NewL( 
+                                        const TBool aResourceFileResponsible );
+
+        /**
+         * ~CConfirmationQueryNotif() destructor
+         * @param  -
+         * return  -
+         */
+         virtual ~CConfirmationQueryNotif();
+                
+        /**
+        * RegisterL register the client notifier function
+        * @param  -
+        * return TNotifierInfo
+        */
+        TNotifierInfo RegisterL();
+
+        /**
+        * Start the Notifier
+        * @param  aBuffer    Buffer
+        * @param  aReplySlot Identifies which message argument to use for the 
+        *                    reply. This message argument will refer to a 
+        *                    modifiable descriptor, a TDes8 type, into which
+        *                    data can be returned. 
+        * @param  aMessage   Message
+        * return -
+        */
+        void StartL( const TDesC8& aBuffer, TInt aReplySlot, 
+                     const RMessagePtr2& aMessage );
+
+        /**
+        * Cancel() the notifier
+        * @param  -
+        * return -
+        */
+        void Cancel();
+
+
+    public:
+
+        /**
+        * CompleteL the notifier is complete
+        * @param  aStatus status
+        * return  -
+        */
+        void CompleteL( TInt aStatus );
+
+        /**
+        * Sets the selected choise
+        * @param  aChoice TInt 
+        * return  -
+        */
+        void SetSelectedChoiceL ( TInt aChoice );
+
+        void SetVisitorNetwork();
+      
+    private:
+        
+        /**
+         * Callback is called to launch dialog asynchronously
+         * @param  aObject Pointer to notifier object.
+         * return  Error code
+         */  
+        static TInt LaunchDialogL( TAny* aObject );
+        
+    private:
+        TBool iTryNextBest;
+        TUint32 iConnMethod;
+        CConfirmationQuery* iDialog;   // Pointer to the dialog
+        TBool iIsVisitorNetwork;
+        TMsgQueryLinkedResults iChoice;
+        TConnUiUiDestConnMethodNoteId iNoteInfo;
+        CAsyncCallBack *iLaunchDialogAsync; // One shot active object
+    };
+
+#endif // __CONFIRMATIONQUERYNOTIF_H__
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/ConnUiUtilsNotif.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2004 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 Generic Connection Ui Utilities Notifier
+*
+*/
+
+
+#ifndef __CONNUIUTILSNOTIF_H__
+#define __CONNUIUTILSNOTIF_H__
+
+
+// INCLUDES
+#include <eiknotapi.h>
+
+// GLOBAL FUNCTIONS
+//
+/**
+* Array of connection dialog plugins.
+* @return A CArrayPtr of MEikSrvNotifierBase2 based classes.
+*/
+IMPORT_C CArrayPtr<MEikSrvNotifierBase2>* NotifierArray();
+
+
+// RSC file name.
+_LIT( KResourceFileName, "ConnUiUtilsNotif.rsc" );
+
+    
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/ConnUiUtilsNotif.hrh	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2002 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 Connection Ui Utilities
+*     Notifier.
+*     The file can be included in C++ or resource file.
+*
+*/
+
+
+#ifndef __CONNUIUTILSNOTIF_HRH
+#define __CONNUIUTILSNOTIF_HRH
+
+
+
+// Type of icon
+enum TIconType
+    {
+    ECUUNotifIconLowSignal = 0,     // Low signal icon
+    ECUUNotifIconMediumSignal,      // Medium signal icon
+    ECUUNotifIconGoodSignal,        // Good signal icon
+    ECUUNotifIconSecureNetwork,     // Secure network icon
+    ECUUNotifIconAdHocNetwork,      // AdHoc network icon
+    ECUUNotifIconInfrastructureNetwork,  // Infrastructure network icon
+    ECUUNotifIconProtectedSetupSupported
+    };
+
+
+// IDs of controls
+enum TConnUiUtilsNotifIds
+    {
+    ESearchingWlanWaitNote = 0x111,    // Searching Wlan Wait note
+    EConnectingViaNote,
+    EConnectingViaConfirmNote
+    };
+
+#define KWlanMaxSsidLength_ 32
+
+#endif      //  __CONNUIUTILSNOTIF_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/ConnectViaNoteNotif.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,86 @@
+/*
+* 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 CConnectViaNoteNotif
+*
+*/
+
+
+
+#ifndef __CONNECT_VIA_NOTE_H__
+#define __CONNECT_VIA_NOTE_H__
+
+
+// INCLUDES
+#include "ConnectionDialogsNotifBase.h"
+
+// FORWARD DECLARAIONS
+class CActiveConnectViaNote;
+/**
+ * ConnectViaNoteNotif class
+ */
+NONSHARABLE_CLASS( CConnectViaNoteNotif ) : public CConnectionDialogsNotifBase
+    {
+public:
+    
+    /**
+    * NewL function
+    * @param  -
+    * return CConnectViaNoteNotif*
+    */
+    static CConnectViaNoteNotif* NewL( const TBool aResourceFileResponsible );
+
+    /**
+    * RegisterL register the client notifier function
+    * @param  -
+    * return TNotifierInfo
+    */
+    TNotifierInfo RegisterL();
+
+    /**
+    * Start the Notifier
+    * @param  aBuffer    Buffer
+    * @param  aReplySlot Identifies which message argument to use for the 
+    *                    reply. This message argument will refer to a 
+    *                    modifiable descriptor, a TDes8 type, into which data
+    *                    can be returned. 
+    * @param  aMessage   Message
+    * return -
+    */
+    void StartL( const TDesC8& aBuffer, TInt aReplySlot, 
+                 const RMessagePtr2& aMessage );
+
+    /**
+    * Cancel() the notifier
+    * @param  -
+    * return -
+    */
+    void Cancel();
+
+public:
+    /**
+    * CompleteL the notifier is complete
+    * @param  aStatus status
+    * return  -
+    */
+    void CompleteL( TInt aStatus );
+
+private:    
+    CActiveConnectViaNote* iActiveNote; // owned
+    
+    };
+
+
+#endif // __CONNECT_VIA_NOTE_H__
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/EasyWepDlgNotif.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,88 @@
+/*
+* 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:  Declaration of CEasyWepDlgNotif
+*
+*/
+
+
+
+#ifndef __EASY_WEP_DLG_NOTIF_H__
+#define __EASY_WEP_DLG_NOTIF_H__
+
+// INCLUDES
+#include "ConnectionDialogsNotifBase.h"
+#include "WepWpaQueryDlg.h"
+#include "ConnectionUiUtilitiesCommon.h"
+
+
+/**
+ * CEasyWepDlgNotif class
+ */
+NONSHARABLE_CLASS( CEasyWepDlgNotif ) : public CConnectionDialogsNotifBase
+    {
+public:    
+    /**
+    * NewL function
+    * @param  -
+    * return CEasyWepDlgNotif*
+    */
+    static CEasyWepDlgNotif* NewL( const TBool aResourceFileResponsible );
+
+    /**
+    * RegisterL register the client notifier function
+    * @param  -
+    * return TNotifierInfo
+    */
+    TNotifierInfo RegisterL();
+
+    /**
+    * Start the Notifier
+    * @param  aBuffer    Buffer
+    * @param  aReplySlot Identifies which message argument to use for the 
+    *                    reply. This message argument will refer to a 
+    *                    modifiable descriptor, a TDes8 type, into which data
+    *                    can be returned. 
+    * @param  aMessage   Message
+    * return -
+    */
+    void StartL( const TDesC8& aBuffer, TInt aReplySlot, 
+                 const RMessagePtr2& aMessage );
+
+    /**
+    * Cancel() the notifier
+    * @param  -
+    * return -
+    */
+    void Cancel();
+
+public:
+
+    /**
+    * CompleteL the notifier is complete
+    * @param  aStatus status
+    * return  -
+    */
+    void CompleteL( TInt aStatus );
+
+private:
+
+    CWepWpaQueryDlg* iDialog;   // Pointer to the dialog
+       TPckgBuf< TWepKeyData > iKey;
+    TBool iHex;
+    };
+
+
+#endif // __EASY_WEP_DLG_NOTIF_H__
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/EasyWpaDlgNotif.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,89 @@
+/*
+* Copyright (c) 2004 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 CEasyWpaDlgNotif
+*
+*/
+
+
+
+#ifndef __EASY_WPA_DLG_NOTIF_H__
+#define __EASY_WPA_DLG_NOTIF_H__
+
+
+// INCLUDES
+#include "ConnectionDialogsNotifBase.h"
+#include "WepWpaQueryDlg.h"
+#include "ConnectionUiUtilitiesCommon.h"
+
+/**
+ * CEasyWpaDlgNotif class
+ */
+NONSHARABLE_CLASS( CEasyWpaDlgNotif ) : public CConnectionDialogsNotifBase
+    {
+public:
+    
+
+   /**
+    * NewL function
+    * @param  -
+    * return CEasyWepDlgNotif*
+    */
+    static CEasyWpaDlgNotif* NewL( const TBool aResourceFileResponsible );
+
+    /**
+    * RegisterL register the client notifier function
+    * @param  -
+    * return TNotifierInfo
+    */
+    TNotifierInfo RegisterL();
+
+    /**
+    * Start the Notifier
+    * @param  aBuffer    Buffer
+    * @param  aReplySlot Identifies which message argument to use for the 
+    *                    reply. This message argument will refer to a 
+    *                    modifiable descriptor, a TDes8 type, into which data
+    *                    can be returned. 
+    * @param  aMessage   Message
+    * return -
+    */
+    void StartL( const TDesC8& aBuffer, TInt aReplySlot, 
+                 const RMessagePtr2& aMessage );
+
+    /**
+    * Cancel() the notifier
+    * @param  -
+    * return -
+    */
+    void Cancel();
+
+public:
+
+    /**
+    * CompleteL the notifier is complete
+    * @param  aStatus status
+    * return  -
+    */
+    void CompleteL( TInt aStatus );
+
+private:
+
+    CWepWpaQueryDlg* iDialog;   // Pointer to the dialog
+       TPckgBuf< TBuf< KEasyWpaQueryMaxLength > > iKey;
+    TBool iHex; // not used
+    };
+
+#endif // __EASY_WPA_DLG_NOTIF_H__
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/NetworkInfoArray.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,128 @@
+/*
+* 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: 
+*     
+*
+*/
+
+
+#ifndef NETWORKINFOARRAY_NOTIF_H_INCLUDED
+#define NETWORKINFOARRAY_NOTIF_H_INCLUDED
+
+// INCLUDES
+#include    "NetworkInfoBase.h"
+
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+/**
+* Contains and handles CConnectionInfo instances.
+*/
+NONSHARABLE_CLASS( CNetworkInfoArray ) : public CBase, public MDesCArray
+    {
+    public:
+        /**
+        * Static constructor
+        * @return A pointer to a CNetworkInfoArray instance.
+        */
+        static CNetworkInfoArray* NewL();
+
+        /**
+        * Constructor.
+        */
+        CNetworkInfoArray();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CNetworkInfoArray();
+
+        /**
+        * Contructs dynamic data members
+        */
+        virtual void ConstructL();
+   
+    public: // from MDesCArray
+        /** 
+        * Returns the number of descriptor elements in a descriptor array.
+        * @return The number of descriptor elements in a descriptor array. 
+        */
+        virtual TInt MdcaCount() const;
+
+        /** 
+        * Indexes into a descriptor array.    
+        * @param aIndex The position of the descriptor element within a 
+        * descriptor array. 
+        * The position is relative to zero; i.e. zero implies the first 
+        * descriptor element in a descriptor array. 
+        * @return A  non-modifiable pointer descriptor representing 
+        * the descriptor element located at position aIndex within a 
+        * descriptor array. 
+        */
+        virtual TPtrC MdcaPoint( TInt aIndex ) const;
+
+    public:
+        /**
+        * Returns the index of the given network
+        * @param aNetworkName name of network 
+        * @param aTo the index while searching    
+        * @return index value of network in the array, or -1 if there
+        * is no network the given Id
+        */
+        TInt GetArrayIndex( TName aNetworkName ) const;
+
+        /**
+        * Add only new network to the array
+        * @param aNetwork the network to be added to the array
+        */
+        void AppendL( CNetworkInfoBase* aNetwork );
+
+        /**
+        * Destroys the network array
+        */
+        void Reset();
+
+        /**
+        * Returns info object of network given by index value in the array
+        * @param aIndex index value of network in the array
+        * @return CNetworkInfoBase* pointer to the network info object
+        */
+        CNetworkInfoBase* operator[]( TUint aIndex ) const;
+        
+        /**
+        * Returns info object of network given by index value in the array
+        * Checks the boundaries of array.
+        * @param aIndex index value of network in the array
+        * @return CNetworkInfoBase* pointer to the network info object if
+        * the given index is valid, NULL otherwise
+        */
+        CNetworkInfoBase* At( TInt aIndex ) const;
+        
+        
+        /**
+        * calls sort funcion of CArrayPtrFlat.
+        */
+        TInt Sort( TKeyArrayFix& aKey );
+        
+    protected:
+        /**
+        * Contains the connections.
+        */
+        CArrayPtrFlat<CNetworkInfoBase>* iNetworkInfoArray;   ///< Owned.
+    };
+
+#endif // NETWORKINFOARRAY_NOTIF_H_INCLUDED
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/NetworkInfoBase.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,192 @@
+/*
+* 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: 
+*     
+*
+*/
+
+
+#ifndef NETWORK_BASE_NOTIF_H_INCLUDED
+#define NETWORK_BASE_NOTIF_H_INCLUDED
+
+// INCLUDES
+
+#include    <stdlib.h>
+#include    <cdblen.h>
+#include    <badesca.h>
+#include    <e32std.h>
+#include    <stdlib.h>
+#include    <wlanmgmtcommon.h>
+
+// CONSTANTS
+/**
+* Max length of ListBox item text
+*/
+LOCAL_D const TUint KNetworkListItemText = 64;
+
+/**
+* This masks are used for set ListBox item text at network details
+*/
+_LIT( KNetworkListItemTextFormat, "%d\t%S\t%S\t%d\t%d" );
+
+
+// FORWARD DECLARATIONS
+class CWlanNetworkDataProvider;
+class CNetworkInfoArray;
+class CNetworkInfoKey;
+
+// TYPES
+
+
+/**
+* Possible values of SignalStrength of a network
+*/
+enum TSignalStrength
+    {
+    ESignalStrengthMax = 60,
+    ESignalStrengthGood = 74,
+    ESignalStrengthLow = 87,
+    ESignalStrengthMin = 100
+    };
+
+
+/**
+* Possible modes of a network
+*/
+enum TNetworkMode
+    {
+    ENetworkModeInfrastructure = 1,
+    ENetworkModeAdHoc    
+    };
+        
+
+// CLASS DECLARATION
+/**
+* Represents a network.
+*/
+NONSHARABLE_CLASS( CNetworkInfoBase ): public CBase
+    {
+    public:
+        /**
+        * Constructor
+        */
+        CNetworkInfoBase();
+
+        /**
+        * Destructor
+        */
+        virtual ~CNetworkInfoBase();
+
+    public: // New functions
+
+        /**
+        * Refresh iListBoxItemText text, network ListBox has a reference to
+        * this text.
+        */
+        /*virtual*/ void RefreshNetworksListBoxItemTextL() /*= 0*/;
+
+        /**
+        * Gives back the name of network (SSID)
+        * @return the name of network 
+        */
+        inline TPtrC NetworkName() const;
+
+        /**
+        * Gives back current SignalStrength
+        * @return iSignalStrength
+        */        
+        inline TSignalStrength SignalStrength() const;
+
+        /**
+        * Gives back current NetworkMode
+        * @return iNetworkMode
+        */
+        inline TNetworkMode NetworkMode() const;
+
+        /**
+        * Gives back current SecurityMode
+        * @return iSecurityMode
+        */        
+        inline TWlanConnectionSecurityMode SecurityMode() const;
+
+        /**
+        * Gives back current Protected Setup Support
+        * @return iProtectedSetupSupported
+        */        
+        inline TBool ProtectedSetupSupported() const;
+
+/**
+        * Gives back current ExtendedSecurityMode
+        * @return iExtendedSecurityMode
+        */        
+        inline TWlanConnectionExtentedSecurityMode ExtendedSecurityMode() const;
+        
+        /**
+        * Gives back a pointer the iListBoxItemText of network 
+        * @return the iListBoxItemText of network 
+        */
+        inline TPtrC GetNetworkListBoxItemText() const;
+
+        inline TBool OthersEntry() const;
+            
+        inline void SetNetworkName( TDes8& aNetworkName );
+        inline void SetSignalStrength( TSignalStrength aStrength );
+        inline void SetNetworkMode( TNetworkMode aNetworkMode );
+        inline void SetSecurityMode( 
+                                TWlanConnectionSecurityMode aSecurityMode );
+        inline void SetOthersEntry( TBool aOthersEntry );
+        inline void SetProtectedSetupSupported( 
+                                            TBool aProtectedSetupSupported );
+        inline void SetExtendedSecurityMode( 
+                 TWlanConnectionExtentedSecurityMode aExtendedSecurityMode );
+
+    private:
+        /**
+        * The name of network (from SSID)
+        */
+        TName iNetworkName;
+        
+        /**
+        * Signale strength of network
+        */
+        TSignalStrength iSignalStrength;
+        
+        /**
+        * Network mode of network
+        */ 
+        TNetworkMode iNetworkMode;        
+               
+        /**
+        * Security mode of network
+        */ 
+        TWlanConnectionSecurityMode iSecurityMode;
+
+        /**
+        * The text of network list item.
+        */
+        TBuf<KNetworkListItemText> iListBoxItemText; 
+
+        TBool iOthersEntry;
+
+        TBool iProtectedSetupSupported;
+
+        TWlanConnectionExtentedSecurityMode iExtendedSecurityMode;
+ 
+    };
+
+#include "NetworkInfoBase.inl"  
+
+#endif //NETWORK_BASE_NOTIF_H_INCLUDED
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/NetworkInfoBase.inl	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,173 @@
+/*
+* 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:  Inline method definitions of the class CNetworkInfoBase
+*     
+*
+*/
+
+
+#ifndef NETWORKINFOBASE_INL
+#define NETWORKINFOBASE_INL
+#include <utf.h>
+
+// ================= MEMBER FUNCTIONS =======================
+//
+// ---------------------------------------------------------
+// CNetworkInfoBase::NetworkName
+// ---------------------------------------------------------
+//
+TPtrC CNetworkInfoBase::NetworkName() const
+    {
+    return iNetworkName;
+    }
+
+// ---------------------------------------------------------
+// CNetworkInfoBase::SignalStrength
+// ---------------------------------------------------------
+//
+TSignalStrength CNetworkInfoBase::SignalStrength()  const
+    {
+    return iSignalStrength;
+    }
+
+// ---------------------------------------------------------
+// CNetworkInfoBase::NetworkMode
+// ---------------------------------------------------------
+//
+TNetworkMode CNetworkInfoBase::NetworkMode()  const
+    {
+    return iNetworkMode;
+    }
+
+// ---------------------------------------------------------
+// CNetworkInfoBase::SecurityMode
+// ---------------------------------------------------------
+//
+TWlanConnectionSecurityMode CNetworkInfoBase::SecurityMode() const
+    {
+    return iSecurityMode;
+    }
+
+// ---------------------------------------------------------
+// CNetworkInfoBase::ProtectedSetupSupported
+// ---------------------------------------------------------
+//
+TBool CNetworkInfoBase::ProtectedSetupSupported() const
+    {
+    return iProtectedSetupSupported;
+    }
+
+// ---------------------------------------------------------
+// CNetworkInfoBase::ExtendedSecurityMode
+// ---------------------------------------------------------
+//
+TWlanConnectionExtentedSecurityMode CNetworkInfoBase::ExtendedSecurityMode() const
+    {
+    return iExtendedSecurityMode;
+    }
+
+// ---------------------------------------------------------
+// CNetworkInfoBase::GetNetworkListBoxItemText
+// ---------------------------------------------------------
+//
+TPtrC CNetworkInfoBase::GetNetworkListBoxItemText() const
+    {
+    return iListBoxItemText;
+    }
+
+
+// ---------------------------------------------------------
+// CNetworkInfoBase::OthersEntry
+// ---------------------------------------------------------
+//
+TBool CNetworkInfoBase::OthersEntry() const
+    {
+    return iOthersEntry;
+    }
+
+
+// ---------------------------------------------------------
+// CNetworkInfoBase::SetNetworkName
+// ---------------------------------------------------------
+//
+void CNetworkInfoBase::SetNetworkName( TDes8& aNetworkName ) 
+    { 
+    CnvUtfConverter::ConvertToUnicodeFromUtf8( iNetworkName, aNetworkName);
+    }
+
+
+// ---------------------------------------------------------
+// CNetworkInfoBase::SetSignalStrength
+// ---------------------------------------------------------
+//
+void CNetworkInfoBase::SetSignalStrength( TSignalStrength aStrength )
+    { 
+    iSignalStrength = aStrength; 
+    }
+
+
+// ---------------------------------------------------------
+// CNetworkInfoBase::SetNetworkMode
+// ---------------------------------------------------------
+//
+void CNetworkInfoBase::SetNetworkMode( TNetworkMode aNetworkMode ) 
+    { 
+    iNetworkMode = aNetworkMode; 
+    }
+
+
+// ---------------------------------------------------------
+// CNetworkInfoBase::SetSecurityMode
+// ---------------------------------------------------------
+//
+void CNetworkInfoBase::SetSecurityMode( 
+                                    TWlanConnectionSecurityMode aSecurityMode )
+    { 
+    iSecurityMode = aSecurityMode; 
+    }
+
+
+// ---------------------------------------------------------
+// CNetworkInfoBase::SetOthersEntry
+// ---------------------------------------------------------
+//
+void CNetworkInfoBase::SetOthersEntry( TBool aOthersEntry ) 
+    { 
+    iOthersEntry = aOthersEntry; 
+    }
+
+
+// ---------------------------------------------------------
+// CNetworkInfoBase::SetProtectedSetupSupported
+// ---------------------------------------------------------
+//
+void CNetworkInfoBase::SetProtectedSetupSupported( 
+                                            TBool aProtectedSetupSupported )
+    { 
+    iProtectedSetupSupported = aProtectedSetupSupported; 
+    }
+
+// ---------------------------------------------------------
+// CNetworkInfoBase::SetExtendedSecurityMode
+// ---------------------------------------------------------
+//
+void CNetworkInfoBase::SetExtendedSecurityMode( 
+                  TWlanConnectionExtentedSecurityMode aExtendedSecurityMode )
+    { 
+    iExtendedSecurityMode = aExtendedSecurityMode; 
+    }                 
+
+#endif // NETWORKINFOBASE_INL
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/NetworkInfoKey.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,69 @@
+/*
+* 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:  Declaration of class CNetworkInfoKey
+*
+*/
+
+
+#ifndef __CNETWORKINFOKEY_H__
+#define __CNETWORKINFOKEY_H__
+
+
+// INCLUDES
+#include <e32base.h>
+
+
+// FORWARD DECLARATION
+class CNetworkInfoArray;
+
+
+// CLASS DECLARATION
+/**
+ * Network information key class
+ */
+NONSHARABLE_CLASS( CNetworkInfoKey ) : public TKeyArrayFix
+    {
+    public:
+
+        /**
+        * SetPtr function
+        * @param aPtr   Pointer used to initialize the class pointer
+        */
+        void SetPtr( CNetworkInfoArray* aPtr );
+
+        /**
+        * Compare function
+        * @param aLeft  Left element to be compared
+        * @param aRight Right element to be compared
+        * @return TInt  Result of comparison of the elements
+        */
+        virtual TInt Compare( TInt aLeft, TInt aRight ) const;
+
+        /**
+        * TNetworkInfoKey constructor
+        * @return -
+        */
+        CNetworkInfoKey();
+
+        /**
+        * ~CNetworkInfoKey() destructor
+        * @param  -
+        */
+        ~CNetworkInfoKey();        
+    };
+
+
+#endif      //__CNETWORKINFOKEY_H__
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/NoteDlgSuppressingSwitch.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,60 @@
+/*
+* Copyright (c) 2002 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 CNoteDlgSuppressingSwitch.
+*
+*/
+
+
+#ifndef __NOTEDLGSUPPRESSINGSWITCH_H__
+#define __NOTEDLGSUPPRESSINGSWITCH_H__
+
+// INCLUDES
+#include <e32base.h>
+#include <aknnotewrappers.h> 
+
+
+
+// CLASS DECLARATIONS
+
+/**
+ * Class implementing a note dialog suppressing application switch
+ */
+NONSHARABLE_CLASS( CNoteDlgSuppressingSwitch ) : public CAknNoteDialog
+    {
+    public:
+        /**
+        * Constructor of the CNoteDlgSuppressingSwitch class
+        * @return -
+        */
+        CNoteDlgSuppressingSwitch( CEikDialog** aSelfPtr );
+
+
+        /**
+        * Destructor
+        */
+        virtual ~CNoteDlgSuppressingSwitch();
+
+
+    private:
+        /**
+        * PreLayoutDynInitL
+        * @param    -
+        */
+        virtual void PreLayoutDynInitL();
+    };
+
+
+#endif  // __NOTEDLGSUPPRESSINGSWITCH_H__
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/OfflineWlanDisabledNoteNotif.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,94 @@
+/*
+* 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:  Declaration of COfflineWlanDisabledNoteNotif
+*
+*/
+
+
+#ifndef __OFFLINE_WLAN_DISABLED_NOTE_H__
+#define __OFFLINE_WLAN_DISABLED_NOTE_H__
+
+// INCLUDES
+#include "ConnectionDialogsNotifBase.h"
+
+
+// FORWARD DECLARATION
+class CActiveOfflineWlanDisabledNote;
+/**
+ * COfflineWlanDisabledNoteNotif class
+ */
+NONSHARABLE_CLASS( COfflineWlanDisabledNoteNotif ) : 
+                                            public CConnectionDialogsNotifBase
+    {
+    public:
+        /**
+        * NewL function
+        * @param  -
+        * return COfflineWlanDisabledNoteNotif*
+        */
+        static COfflineWlanDisabledNoteNotif* NewL( 
+                                        const TBool aResourceFileResponsible );
+
+
+        /**
+        * RegisterL register the client notifier function
+        * @param  -
+        * return TNotifierInfo
+        */
+        TNotifierInfo RegisterL();
+
+        /**
+        * Start the Notifier
+        * @param  aBuffer    Buffer
+        * @param  aReplySlot Identifies which message argument to use for the 
+        *                    reply. This message argument will refer to a 
+        *                    modifiable descriptor, a TDes8 type, into which
+        *                    data can be returned. 
+        * @param  aMessage   Message
+        * return -
+        */
+        void StartL( const TDesC8& aBuffer, TInt aReplySlot, 
+                     const RMessagePtr2& aMessage );
+                 
+        /**
+        * Cancel() the notifier
+        * @param  -
+        * return -
+        */
+        void Cancel();         
+    
+        /**
+        * CompleteL the notifier is complete
+        * @param  aStatus status
+        * return  -
+        */
+        void CompleteL( TInt aStatus );            
+                     
+    protected:    
+        /**
+        * Constructor
+        */
+        COfflineWlanDisabledNoteNotif();    
+    
+    protected:
+        ///< pointer to active object, owned
+        CActiveOfflineWlanDisabledNote* iActiveNote; 
+
+    };    
+    
+    
+#endif // __OFFLINE_WLAN_DISABLED_NOTE_H__
+
+// End of File
+    
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/OfflineWlanNoteDlg.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,81 @@
+/*
+* 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:  Implementation of class COfflineWlanNoteDlg.
+*
+*/
+
+
+#ifndef __COFFLINEWLANNOTEDLG_H__
+#define __COFFLINEWLANNOTEDLG_H__
+
+// INCLUDES
+#include <AknQueryDialog.h>
+#include "ExpiryTimerCallback.h"
+
+// FORWARD DECLARATIONS
+class COfflineWlanNoteNotif;
+class CExpiryTimer;
+
+// CLASS DECLARATIONS
+
+/**
+ * Class implements a query dialog.
+ */
+NONSHARABLE_CLASS( COfflineWlanNoteDlg ) : public CAknQueryDialog, public MExpiryTimerCallback
+    {
+public:
+    /**
+    * Constructor the COfflineWlanNoteDlg class
+    * @param aNotif notifier pointer
+    * @return -
+    */
+    COfflineWlanNoteDlg( COfflineWlanNoteNotif* aNotif );
+
+    /**
+    * Exit function the COfflineWlanNoteDlg
+    * @param aButtonId 
+    * @return TBool exit or no
+    */
+    virtual TBool OkToExitL( TInt aButtonId );
+    
+    /**
+    * Dialog expiration timeout callback
+    */
+    void HandleTimedOut();
+    
+    /**
+    * Destructor
+    */
+    virtual ~COfflineWlanNoteDlg();
+    
+    TBool NeedToDismissQueryL(const TKeyEvent& aKeyEvent);     
+
+private:
+    /**
+    * PreLayoutDynInitL
+    * @param    -
+    */
+    virtual void PreLayoutDynInitL();    
+
+private:
+    COfflineWlanNoteNotif* iNotif;  // Pointer to the Notifier
+    
+    // Pointer for dialog expiration timer
+    CExpiryTimer* iExpiryTimer;
+    };
+
+
+#endif  // __COFFLINEWLANNOTEDLG_H__
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/OfflineWlanNoteNotif.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,93 @@
+/*
+* 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:  Declaration of COfflineWlanNoteNotif
+*
+*/
+
+
+
+#ifndef __OFFLINE_WLAN_NOTE_H__
+#define __OFFLINE_WLAN_NOTE_H__
+
+
+// INCLUDES
+#include <AknQueryDialog.h>
+
+#include "ConnectionDialogsNotifBase.h"
+
+/**
+ * OfflineWlanNoteNotif class
+ */
+NONSHARABLE_CLASS( COfflineWlanNoteNotif ) : public CConnectionDialogsNotifBase
+    {
+public:
+    
+    /**
+    * NewL function
+    * @param  -
+    * return COfflineWlanNoteNotif*
+    */
+    static COfflineWlanNoteNotif* NewL( const TBool aResourceFileResponsible );
+
+    /**
+    * RegisterL register the client notifier function
+    * @param  -
+    * return TNotifierInfo
+    */
+    TNotifierInfo RegisterL();
+
+    /**
+    * Start the Notifier
+    * @param  aBuffer    Buffer
+    * @param  aReplySlot Identifies which message argument to use for the 
+    *                    reply. This message argument will refer to a 
+    *                    modifiable descriptor, a TDes8 type, into which data
+    *                    can be returned. 
+    * @param  aMessage   Message
+    * return -
+    */
+    void StartL( const TDesC8& aBuffer, TInt aReplySlot, 
+                 const RMessagePtr2& aMessage );
+
+    /**
+    * Cancel() the notifier
+    * @param  -
+    * return -
+    */
+    void Cancel();
+
+public:
+
+    /**
+    * GetDialogL() call the OffLineWlan dialog
+    * @param  -
+    * return -
+    */
+    void GetDialogL();
+
+    /**
+    * CompleteL the notifier is complete
+    * @param  aStatus status
+    * return  -
+    */
+    void CompleteL( TInt aStatus );
+
+private:
+    CAknQueryDialog* iDialog;   // Pointer to the dialog
+    };
+
+
+#endif // __OFFLINE_WLAN_NOTE_H__
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/SelectWLANDlg.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,143 @@
+/*
+* Copyright (c) 2002 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: 
+*     Declares CSelectWLAN dialog.
+*
+*/
+
+
+#ifndef SELECTWLANDLG_H
+#define SELECTWLANDLG_H
+
+// INCLUDES
+#include <aknlistquerydialog.h>
+#include <wlanmgmtcommon.h>
+#include "ExpiryTimerCallback.h"
+
+// FORWARD DECLARATION
+class CSelectWLanDlgPlugin;
+class CNetworkInfoArray;
+class CAknWaitDialog;
+class CExpiryTimer;
+
+// CLASS DECLARATION
+/**
+* CSelectWLANDlg dialog class
+*
+*/
+NONSHARABLE_CLASS( CSelectWLANDlg ) : public CAknListQueryDialog, public MExpiryTimerCallback
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Two-phase construction.
+        */
+        static CSelectWLANDlg* NewL( CSelectWLanDlgPlugin* aPlugin,
+                                     CNetworkInfoArray* *const aNetworkArray );
+
+        /**
+        * Destructor.
+        */
+        ~CSelectWLANDlg();
+        
+        
+        /**
+        *
+        */
+        void RefreshDialogL();
+        
+        /**
+        *
+        * @return The value of iFromOkToExit.
+        */
+        inline TBool GetOkToExit();
+        
+        TBool NeedToDismissQueryL(const TKeyEvent& aKeyEvent);
+
+
+    protected:
+        /**
+        * Constructor.
+        */
+        CSelectWLANDlg( CSelectWLanDlgPlugin* aPlugin, TInt aIndex, 
+                        CNetworkInfoArray* *const aNetworkArray );
+
+
+        /**
+        * Symbian default constructor.
+        */      
+        void ConstructL();
+
+    private:
+        // From CAknListQueryDialog
+        TBool OkToExitL( TInt aButtonId );
+        
+        /**
+        * Dialog expiration timeout callback
+        */
+        void HandleTimedOut();
+
+        // From CAknListQueryDialog
+        virtual void PreLayoutDynInitL();
+
+        /**
+        * Handle resource change events. 
+        * @param aType: The type of resources that have changed
+        */
+        void HandleResourceChange( TInt aType );
+        
+        TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, 
+                                     TEventCode aType);
+                                     
+        void ShowInfoNoteL( TInt aResId );
+
+
+    private:  // New functions
+
+        /**
+        * Sets graphic icons
+        * @param    -
+        */
+        void SetIconsL();
+
+        TBool ScanForWlanNwL( TWlanSsid& aSsid, 
+                              TWlanConnectionMode& aConnectionMode,
+                              TWlanConnectionSecurityMode& aSecurityMode,
+                              TWlanConnectionExtentedSecurityMode& aExtSecurityMode,
+                              TBool& aProtectedSetupSupported );
+
+        void DestroyWaitDialog();
+
+    private: //data
+
+        // Pointer to the plugin
+        CSelectWLanDlgPlugin*       iPlugin;
+
+        // not owned
+        CNetworkInfoArray* *const   iNetworkArray;
+
+         // closed the dialof from OkToExitL or not
+        TBool iFromOkToExit;
+
+        CAknWaitDialog* iWaitDialog;
+        
+        // Pointer for dialog expiration timer
+        CExpiryTimer* iExpiryTimer;
+    };
+
+#include "SelectWLANDlg.inl"  
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/SelectWLANDlg.inl	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,40 @@
+/*
+* 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: 
+*      Inline method definitions of the class CSelectWLANDlg.
+*
+*
+*/
+
+
+
+#ifndef SELECTWLANDLG_INL
+#define SELECTWLANDLG_INL
+
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// void CSelectWLANDlg::GetOkToExit
+// ----------------------------------------------------------------------------
+//
+TBool CSelectWLANDlg::GetOkToExit()
+	{
+	return iFromOkToExit;
+	}
+        
+
+
+#endif // SELECTWLANDLG_INL
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/SelectWLanDlgPlugin.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,121 @@
+/*
+* 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:  Declaration of CSelectWLanDlgPlugin
+*
+*/
+
+
+
+#ifndef __SELECT_WLAN_DLG_PLUGIN_H__
+#define __SELECT_WLAN_DLG_PLUGIN_H__
+
+
+// INCLUDES
+#include "ConnectionDialogsNotifBase.h"
+#include "ConnectionUiUtilitiesCommon.h"
+
+//FORWARD DECLARATION
+class CActiveSelectWLanDlgPlugin;
+/**
+ * SelectWLanDlg Plugin class
+ */
+NONSHARABLE_CLASS( CSelectWLanDlgPlugin ) : public CConnectionDialogsNotifBase
+    {   
+    public:
+
+        /**
+        * NewL function
+        * @param  -
+        * return CSelectWLanDlgPlugin*
+        */
+        static CSelectWLanDlgPlugin* NewL( 
+                                        const TBool aResourceFileResponsible );
+        
+        /**
+        * RegisterL register the client notifier function
+        * @param  -
+        * return TNotifierInfo
+        */
+        TNotifierInfo RegisterL();
+
+        /**
+        * Start the Notifier
+        * @param  aBuffer    Buffer
+        * @param  aReplySlot Identifies which message argument to use for the 
+        *                    reply. This message argument will refer to a 
+        *                    modifiable descriptor, a TDes8 type, into which
+        *                    data can be returned. 
+        * @param  aMessage   Message
+        * return -
+        */
+        void StartL( const TDesC8& aBuffer, TInt aReplySlot, 
+                     const RMessagePtr2& aMessage );
+
+        /**
+        * Cancel() the notifier
+        * @param  -
+        * return -
+        */
+        void Cancel();
+        
+        /**
+        * Stops Timer of iActivePlugin
+        */
+        void StopTimer();    
+        
+        /**
+        * Sets value of the iNetworkPrefs member
+        * @param aSSID the id of selected wlan network
+        * @param aConnectionMode connection mode of selected wlan network
+        * @param aSecurityMode security mode of selected wlan network
+        * @param aExtSecurityMode extended security mode of selected wlan network
+        */
+        void SetNetworkPrefsL( TWlanSsid& aSSID,
+                               TWlanConnectionMode& aConnectionMode,
+                               TWlanConnectionSecurityMode& iSecurityMode,
+                               TWlanConnectionExtentedSecurityMode& aExtSecurityMode,
+                               TBool& aProtectedSetupSupported );
+                
+    protected:
+        /**
+        * Constructor
+        */        
+        CSelectWLanDlgPlugin();
+
+    public:
+        /**
+        * CompleteL the notifier is complete
+        * @param  aStatus status
+        * return  -
+        */
+        void CompleteL( TInt aStatus );
+
+        /**
+        * To inform that Other (hidden netw.) was selected.
+        * @param  aValue value (ETrue/EFalse) for EWlanScanSSID. 
+        */
+        void SetEasyWlanToHiddenL( const TBool aValue );   
+
+    private:
+
+        // return value of NetworkPrefs
+        TPckgBuf<TConnUiUiWlanNetworkPrefs> iNetworkPrefs;
+
+        // owned  
+        CActiveSelectWLanDlgPlugin* iActivePlugin;
+    };
+    
+#endif // __SELECT_WLAN_DLG_PLUGIN_H__    
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/WLANNetworkUnavailableNoteNotif.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,93 @@
+/*
+* 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:  Declaration of Generic Connection Ui Utilities Notifier
+*
+*/
+
+
+
+#ifndef __WLAN_UNAVAILABLE_NOTE_H__
+#define __WLAN_UNAVAILABLE_NOTE_H__
+
+// INCLUDES
+#include "ConnectionDialogsNotifBase.h"
+
+//FORWARD DECLARATION
+class CActiveWLANNetworkUnavailableNote;
+
+/**
+ * CWLANNetworkUnavailableNoteNotif class
+ */
+NONSHARABLE_CLASS( CWLANNetworkUnavailableNoteNotif ) 
+                                        : public CConnectionDialogsNotifBase
+    {
+    public:
+        /**
+        * NewL function
+        * @param  -
+        * return COfflineWlanDisabledNoteNotif*
+        */
+        static CWLANNetworkUnavailableNoteNotif* NewL( 
+                                        const TBool aResourceFileResponsible );
+        
+        /**
+        * RegisterL register the client notifier function
+        * @param  -
+        * return TNotifierInfo
+        */
+        TNotifierInfo RegisterL();
+
+        /**
+        * Start the Notifier
+        * @param  aBuffer    Buffer
+        * @param  aReplySlot Identifies which message argument to use for the 
+        *                    reply. This message argument will refer to a 
+        *                    modifiable descriptor, a TDes8 type, into which
+        *                    data can be returned. 
+        * @param  aMessage   Message
+        * return -
+        */
+        void StartL( const TDesC8& aBuffer, TInt aReplySlot, 
+                     const RMessagePtr2& aMessage );
+                 
+        /**
+        * Cancel() the notifier
+        * @param  -
+        * return -
+        */
+        void Cancel();         
+    
+        /**
+        * CompleteL the notifier is complete
+        * @param  aStatus status
+        * return  -
+        */
+        void CompleteL( TInt aStatus );
+                     
+    protected:    
+        /**
+        * Constructor
+        */
+        CWLANNetworkUnavailableNoteNotif();    
+    
+    protected:
+        // pointer to active object, owned
+        CActiveWLANNetworkUnavailableNote* iActiveNote;
+
+    };    
+
+#endif //__WLAN_UNAVAILABLE_NOTE_H__
+
+// End of File
+    
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/WepWpaQueryDlg.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,94 @@
+/*
+* 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:  Implementation of class WepWpaQueryDlg.
+*
+*/
+
+
+#ifndef __CWEPWPAQUERYDLG_H__
+#define __CWEPWPAQUERYDLG_H__
+
+
+// INCLUDES
+#include <AknQueryDialog.h>
+
+// FORWARD DECLARATIONS
+class CConnectionDialogsNotifBase;
+
+enum TDialogType
+    {
+    EDialogWep     =0,
+    EDialogWpa     =1,
+    EDialogWapi    =2
+    };
+
+// CLASS DECLARATIONS
+
+/**
+ * Class implements a query dialog.
+ */
+NONSHARABLE_CLASS( CWepWpaQueryDlg ) : public CAknTextQueryDialog
+    {
+public:
+    /**
+    * Constructor the COfflineWlanNoteDlg class
+    * @param aDataText returned password
+    * @param aNotif notifier pointer
+    * @param aWpa determines Wpa or Wep query dialog will be created
+    * @param aHex Returns ETrue is password is given in hexadecimal, 
+    * EFalse if ASCII
+    * @return -
+    */
+    CWepWpaQueryDlg( TDes& aDataText, CConnectionDialogsNotifBase* aNotif, 
+                     TDialogType aDialogType, TBool& aHex );
+
+    /**
+    * Exit function the COfflineWlanNoteDlg
+    * @param aButtonId 
+    * @return TBool exit or no
+    */
+    virtual TBool OkToExitL( TInt aButtonId );
+    
+    /**
+    * Destructor
+    */
+    virtual ~CWepWpaQueryDlg();
+    
+    TBool NeedToDismissQueryL(const TKeyEvent& aKeyEvent);    
+
+private:
+
+    /**
+    * Draws an info note
+    * @param aResId resource id
+    * @return -
+    */
+    void CWepWpaQueryDlg::ShowInfoNoteL( TInt aResId );
+    
+    /**
+    * PreLayoutDynInitL
+    * @param    -
+    */
+    virtual void PreLayoutDynInitL();      
+
+private:
+    CConnectionDialogsNotifBase* iNotif;  // Pointer to the Notifier
+    TInt   iDialogType;
+    TBool& iHex;
+    };
+
+
+#endif  // __CWEPWPAQUERYDLG_H__
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/WlanNetworkDataProvider.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,154 @@
+/*
+* 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: 
+*     
+*
+*/
+
+
+#ifndef WLAN_NETWORK_DATA_PROVIDER_NOTIF_H_INCLUDED
+#define WLAN_NETWORK_DATA_PROVIDER_NOTIF_H_INCLUDED
+
+// INCLUDES
+#include "NetworkInfoArray.h"
+
+#ifndef __WINS__
+#include <wlanmgmtclient.h>
+#endif
+
+
+// CONSTANTS
+
+/**
+* Bit masks for Capability Information field.
+*/
+enum T802Dot11CapabilityBitMask
+    {
+    E802Dot11CapabilityEssMask          = 0x0001,
+    E802Dot11CapabilityIbssMask         = 0x0002,
+    E802Dot11CapabilityCfPollableMask   = 0x0004,
+    E802Dot11CapabilityCfPollRequestMask= 0x0008,
+    E802Dot11CapabilityPrivacyMask      = 0x0010,
+    E802Dot11ShortPreambleMask          = 0x0020,
+    E802Dot11PbccMask                   = 0x0040,      
+    E802Dot11ChannelAgilityMask         = 0x0080
+    };
+
+
+// FORWARD DECLARATIONS
+class CNetworkInfoArray;
+
+
+// TYPES
+
+// CLASS DECLARATION
+    
+/**
+* 
+*/
+NONSHARABLE_CLASS( CWlanNetworkDataProvider ) : public CBase
+    {
+    public:    
+        /**
+        * Static constructor
+        * @return A pointer to a CWlanNetworkDataProvider instance.
+        */
+        static CWlanNetworkDataProvider* NewL();        
+                
+        /**
+        * Called by Tick. Refresh all networks info.
+        */
+        void OnTimerExpiredL();    
+        
+        /**
+        * Destructor
+        */
+        virtual ~CWlanNetworkDataProvider();
+                        
+        /**
+        * Gives back a non modifiable pointer to CNetworkInfoArray*
+        */
+        inline CNetworkInfoArray** GetNetworkInfoArray(); 
+        
+#ifndef __WINS__
+        /**
+        * Starts asynchron MWlanMgmtInterface.GetScanResults
+        * @param aStatus request status of active object
+        */        
+        inline void RefreshScanInfo( TRequestStatus& aStatus );
+#endif // ! __WINS__           
+                        
+    protected:        
+        /**
+        * Constructor
+        */
+        CWlanNetworkDataProvider();
+    
+        /**
+        * Second phase construction
+        */
+        void ConstructL();
+        
+#ifndef __WINS__
+        /**
+        * Decides if SSID of wlan network hidden or not.
+        * @param aSsidLength length of ssid
+        * @param aSsid ssid itself 
+        * @return ETrue if hidden, EFalse otherwise
+        */
+        TBool IsHiddenSsid( TUint aSsidLength, const TUint8* aSsid );
+#endif // !__WINS__
+        
+    private:
+    
+        /**
+        * Sorts actual network info array
+        */
+        void SortNetworkInfoArrayL();
+
+        void AddNetworkL( TDes8& aNetworkName, TSignalStrength aStrength,
+                          TNetworkMode aNetworkMode,
+                          TWlanConnectionSecurityMode aSecurityMode,
+                          TWlanConnectionExtentedSecurityMode aExtSecurityMode,
+                          TBool aProtectedSetupSupported );
+
+        void AddOthersEntryL();
+        
+        TBool IsPhoneOfflineL() const;
+
+    private:
+        
+#ifndef __WINS__
+        /**
+        * used for wlan networks info, owned
+        */
+        CWlanMgmtClient*            iWlanMgmt;  
+
+        /**
+        * used for scanning networks,  owned
+        */    
+        CWlanScanInfo*              iScanInfo; 
+#endif // !__WINS__
+                
+        /**
+        * Owned. This poiter points to refreshing array.
+        */
+        CNetworkInfoArray*          iNetworkInfoArray;
+    };
+    
+#include "WlanNetworkDataProvider.inl"  
+
+#endif // WLAN_NETWORK_DATA_PROVIDER_NOTIF_H_INCLUDED
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/WlanNetworkDataProvider.inl	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,50 @@
+/*
+* 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: 
+*      Inline method definitions of the class CWlanNetworkDataProvider.
+*
+*
+*/
+
+
+
+#ifndef WLAN_NETWORK_DATA_PROVIDER_NOTIF_INL
+#define WLAN_NETWORK_DATA_PROVIDER_NOTIF_INL
+
+
+// ================= MEMBER FUNCTIONS =======================
+// ---------------------------------------------------------
+// CWlanNetworkDataProvider::GetNetworkInfoArray
+// ---------------------------------------------------------
+//    
+CNetworkInfoArray** CWlanNetworkDataProvider::GetNetworkInfoArray()
+    {
+    return &iNetworkInfoArray;
+    }    
+    
+    
+#ifndef __WINS__
+// ---------------------------------------------------------
+// CWlanNetworkDataProvider::RefreshScanInfo
+// ---------------------------------------------------------
+//    
+void CWlanNetworkDataProvider::RefreshScanInfo( TRequestStatus& aStatus )
+    {
+    iWlanMgmt->GetScanResults( aStatus, *iScanInfo ); 
+    }
+#endif // ! __WINS__           
+    
+#endif // WLAN_NETWORK_DATA_PROVIDER_NOTIF_INL
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/connectingviadiscreetpopup.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,110 @@
+/*
+ * 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:  Declaration of CConnectingViaDiscreetPopup
+ *
+ */
+
+#ifndef CCONNECTINGVIADISCREETPOPUP_H
+#define CCONNECTINGVIADISCREETPOPUP_H
+
+// INCLUDES
+#include <e32base.h>	// For CActive, link against: euser.lib
+#include <cmmanager.h>
+
+#include "connectingviadiscreetpopupnotif.h"
+
+/**
+ * CConnectingViaDiscreetPopup class
+ */
+NONSHARABLE_CLASS( CConnectingViaDiscreetPopup ) : public CActive
+    {
+public:
+    /**
+     * Destructor
+     * Cancel and destroy
+     */
+    ~CConnectingViaDiscreetPopup();
+
+    /**
+     * NewL function 
+     * Two-phased constructor.
+     * @param  aNotif a pointer to notifier plugin
+     */
+    static CConnectingViaDiscreetPopup* NewL(
+            CConnectingViaDiscreetPopupNotif* aNotif);
+
+    /**
+     * NewL function 
+     * Two-phased constructor.
+     * @param  aNotif a pointer to notifier plugin
+     */
+    static CConnectingViaDiscreetPopup* NewLC(
+            CConnectingViaDiscreetPopupNotif* aNotif);
+
+public:
+    /**
+     * StartL Function for making the initial request
+     */
+    void StartL(TUint32 aIapId, TBool aConnectionAlreadyActive);
+
+private:
+    /**
+     * C++ constructor
+     */
+    CConnectingViaDiscreetPopup(CConnectingViaDiscreetPopupNotif* aNotif);
+
+    /**
+     * Second-phase constructor
+     */
+    void ConstructL();
+
+private:
+    /**
+     * From CActive
+     */
+    void RunL();
+
+    /**
+     * From CActive 
+     */
+    void DoCancel();
+
+    /**
+     * From CActive 
+     */
+    TInt RunError(TInt aError);
+
+private:
+
+    // Used for complete runl, not owned 
+    TRequestStatus* iClientStatus;
+
+    // Pointer to notifer, not owned
+    CConnectingViaDiscreetPopupNotif* iNotif;
+
+    // Handle to cmmanager interface
+    RCmManager icmManager;
+
+    // Bearer type from cmmanager
+    TUint iBearerType;
+
+    // Connection name - owned
+    HBufC* iConnectionName;
+
+    // Popup flags
+    TInt iPopupFlags;
+
+    };
+
+#endif // CCONNECTINGVIADISCREETPOPUP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/connectingviadiscreetpopupnotif.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,90 @@
+/*
+ * 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:  Declaration of Generic Connection Ui Utilities Notifier
+ *
+ */
+
+#ifndef __CONNECTINGVIADISCREETPOPUPNOTIF_H__
+#define __CONNECTINGVIADISCREETPOPUPNOTIF_H__
+
+// INCLUDES
+#include "ConnectionDialogsNotifBase.h"
+
+//FORWARD DECLARATION
+class CConnectingViaDiscreetPopup;
+
+/**
+ * CConnectingViaDiscreetPopupNotif class
+ */
+NONSHARABLE_CLASS( CConnectingViaDiscreetPopupNotif ) : public CConnectionDialogsNotifBase
+    {
+public:
+    /**
+     * NewL function
+     * @param  -
+     * return CConnectingViaDiscreetPopupNotif*
+     */
+    static CConnectingViaDiscreetPopupNotif* NewL(
+            const TBool aResourceFileResponsible);
+
+    /**
+     * RegisterL register the client notifier function
+     * @param  -
+     * return TNotifierInfo
+     */
+    TNotifierInfo RegisterL();
+
+    /**
+     * Start the Notifier
+     * @param  aBuffer    Buffer
+     * @param  aReplySlot Identifies which message argument to use for the 
+     *                    reply. This message argument will refer to a 
+     *                    modifiable descriptor, a TDes8 type, into which
+     *                    data can be returned. 
+     * @param  aMessage   Message
+     * return -
+     */
+    void StartL(const TDesC8& aBuffer, TInt aReplySlot,
+            const RMessagePtr2& aMessage);
+
+    /**
+     * Cancel() the notifier
+     * @param  -
+     * return -
+     */
+    void Cancel();
+
+    /**
+     * CompleteL the notifier is complete
+     * @param  aStatus status
+     * return  -
+     */
+    void CompleteL(TInt aStatus);
+
+protected:
+    /**
+     * Constructor
+     */
+    CConnectingViaDiscreetPopupNotif();
+
+protected:
+
+    // pointer to active object, owned
+    CConnectingViaDiscreetPopup* iActiveNote;
+
+    };
+
+#endif //__CONNECTINGVIADISCREETPOPUPNOTIF_H__
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/connectionerrordiscreetpopup.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  Declaration of CConnectingViaDiscreetPopup
+ *
+ */
+
+#ifndef CCONNECTIONERRORDISCREETPOPUP_H
+#define CCONNECTIONERRORDISCREETPOPUP_H
+
+// INCLUDES
+#include <e32base.h>	// For CActive, link against: euser.lib
+#include <cmmanager.h>
+
+#include "connectionerrordiscreetpopupnotif.h"
+ 
+/**
+ * CConnectingViaDiscreetPopup class
+ */
+NONSHARABLE_CLASS( CConnectionErrorDiscreetPopup ) : public CActive
+    {
+public:
+    /**
+     * Destructor
+     * Cancel and destroy
+     */
+    ~CConnectionErrorDiscreetPopup();
+
+    /**
+     * NewL function 
+     * Two-phased constructor.
+     * @param  aNotif a pointer to notifier plugin
+     */
+    static CConnectionErrorDiscreetPopup* NewL(
+            CConnectionErrorDiscreetPopupNotif* aNotif );
+
+    /**
+     * NewL function 
+     * Two-phased constructor.
+     * @param  aNotif a pointer to notifier plugin
+     */
+    static CConnectionErrorDiscreetPopup* NewLC(
+            CConnectionErrorDiscreetPopupNotif* aNotif );
+
+public:
+    /**
+     * StartL Function for making the initial request
+     */
+    void StartL( TUint32 aErrCode );
+
+private:
+    /**
+     * C++ constructor
+     */
+    CConnectionErrorDiscreetPopup( CConnectionErrorDiscreetPopupNotif* aNotif );
+
+    /**
+     * Second-phase constructor
+     */
+    void ConstructL();
+
+private:
+    /**
+     * From CActive
+     */
+    void RunL();
+
+    /**
+     * From CActive 
+     */
+    void DoCancel();
+
+    /**
+     * From CActive 
+     */
+    TInt RunError( TInt aError );
+    
+    /**
+     * Resolves error code saved in iErrorCode.
+     * @return EFalse when resolve failed.
+     */
+    TBool ResolveErrorCode( TInt& aText1, TInt& aText2,
+            TInt& aBitmap, TInt& aMask );
+
+private:
+
+    // Used for complete runl, not owned 
+    TRequestStatus* iClientStatus;
+
+    // Pointer to notifer, not owned
+    CConnectionErrorDiscreetPopupNotif* iNotif;
+    
+    // Error code to be shown
+    TInt iErrorCode;
+    
+    // Handle to cmmanager interface
+    RCmManager icmManager;
+
+    };
+
+#endif // CCONNECTIONERRORDISCREETPOPUP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/connectionerrordiscreetpopupnotif.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  Declaration of Generic Connection Ui Utilities Notifier
+ *
+ */
+
+#ifndef __CONNECTIONERRORDISCREETPOPUPNOTIF_H__
+#define __CONNECTIONERRORDISCREETPOPUPNOTIF_H__
+
+// INCLUDES
+#include "ConnectionDialogsNotifBase.h"
+
+//FORWARD DECLARATION
+class CConnectionErrorDiscreetPopup;
+
+/**
+ * CConnectionErrorDiscreetPopupNotif class
+ */
+NONSHARABLE_CLASS( CConnectionErrorDiscreetPopupNotif ) : 
+public CConnectionDialogsNotifBase
+    {
+public:
+    /**
+     * NewL function
+     * @param  -
+     * return CConnectionErrorDiscreetPopupNotif*
+     */
+    static CConnectionErrorDiscreetPopupNotif* NewL(
+            const TBool aResourceFileResponsible );
+
+    /**
+     * RegisterL register the client notifier function
+     * @param  -
+     * return TNotifierInfo
+     */
+    TNotifierInfo RegisterL();
+
+    /**
+     * Start the Notifier
+     * @param  aBuffer    Buffer
+     * @param  aReplySlot Identifies which message argument to use for the 
+     *                    reply. This message argument will refer to a 
+     *                    modifiable descriptor, a TDes8 type, into which
+     *                    data can be returned. 
+     * @param  aMessage   Message
+     * return -
+     */
+    void StartL( const TDesC8& aBuffer, TInt aReplySlot,
+            const RMessagePtr2& aMessage );
+
+    /**
+     * Cancel() the notifier
+     * @param  -
+     * return -
+     */
+    void Cancel();
+
+    /**
+     * CompleteL the notifier is complete
+     * @param  aStatus status
+     * return  -
+     */
+    void CompleteL( TInt aStatus );
+
+protected:
+    /**
+     * Constructor
+     */
+    CConnectionErrorDiscreetPopupNotif();
+
+protected:
+
+    // pointer to active object, owned
+    CConnectionErrorDiscreetPopup* iActiveNote;
+
+    };
+
+#endif //__CONNECTINGVIADISCREETPOPUPNOTIF_H__
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/easywapidlgnotif.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,93 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Notifier part for WAPI pre-shared key query dialog
+*
+*/
+
+
+
+#ifndef __EASY_WAPI_DLG_NOTIF_H__
+#define __EASY_WAPI_DLG_NOTIF_H__
+
+
+// INCLUDES
+#include "ConnectionDialogsNotifBase.h"
+#include "WepWpaQueryDlg.h"
+#include "ConnectionUiUtilitiesCommon.h"
+
+/**
+ * CEasyWapiDlgNotif class
+ */
+NONSHARABLE_CLASS( CEasyWapiDlgNotif ) : public CConnectionDialogsNotifBase
+    {
+public:
+    
+
+   /**
+    * NewL function
+    * @param  -
+    * return CEasyWapiDlgNotif*
+    */
+    static CEasyWapiDlgNotif* NewL( const TBool aResourceFileResponsible );
+
+    /**
+    * RegisterL register the client notifier function
+    * @param  -
+    * return TNotifierInfo
+    */
+    TNotifierInfo RegisterL();
+
+    /**
+    * Start the Notifier
+    * @param  aBuffer    Buffer
+    * @param  aReplySlot Identifies which message argument to use for the 
+    *                    reply. This message argument will refer to a 
+    *                    modifiable descriptor, a TDes8 type, into which data
+    *                    can be returned. 
+    * @param  aMessage   Message
+    * return -
+    */
+    void StartL( const TDesC8& aBuffer, TInt aReplySlot, 
+                 const RMessagePtr2& aMessage );
+
+    /**
+    * Cancel() the notifier
+    * @param  -
+    * return -
+    */
+    void Cancel();
+
+public:
+
+    /**
+    * CompleteL the notifier is complete
+    * @param  aStatus status
+    * return  -
+    */
+    void CompleteL( TInt aStatus );
+
+private:
+ 
+    // Pointer to the dialog
+    CWepWpaQueryDlg*                            iDialog;
+    
+    // To read/write WAPI PSK from/to client
+    TPckgBuf< TBuf< KEasyWapiQueryMaxLength > > iKey;
+    
+    TBool iHex; // not used
+    };
+
+#endif // __EASY_WAPI_DLG_NOTIF_H__
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/nowlannetworksavailablenotif.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,93 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Declaration of CNoWLANNetworksAvailableNotif
+*
+*/
+
+
+
+#ifndef __NO_WLAN_NETWORKS_AVAILABLE_NOTE_H__
+#define __NO_WLAN_NETWORKS_AVAILABLE_NOTE_H__
+
+// INCLUDES
+#include "ConnectionDialogsNotifBase.h"
+
+//FORWARD DECLARATION
+class CActiveWLANNetworkUnavailableNote;
+
+/**
+ * CNoWLANNetworksAvailableNotif class
+ */
+NONSHARABLE_CLASS( CNoWLANNetworksAvailableNotif ) 
+                                        : public CConnectionDialogsNotifBase
+    {
+    public:
+        /**
+        * NewL function
+        * @param  -
+        * return CNoWLANNetworksAvailableNotif*
+        */
+        static CNoWLANNetworksAvailableNotif* NewL( 
+                                        const TBool aResourceFileResponsible );
+        
+        /**
+        * RegisterL register the client notifier function
+        * @param  -
+        * return TNotifierInfo
+        */
+        TNotifierInfo RegisterL();
+
+        /**
+        * Start the Notifier
+        * @param  aBuffer    Buffer
+        * @param  aReplySlot Identifies which message argument to use for the 
+        *                    reply. This message argument will refer to a 
+        *                    modifiable descriptor, a TDes8 type, into which
+        *                    data can be returned. 
+        * @param  aMessage   Message
+        * return -
+        */
+        void StartL( const TDesC8& aBuffer, TInt aReplySlot, 
+                     const RMessagePtr2& aMessage );
+                 
+        /**
+        * Cancel() the notifier
+        * @param  -
+        * return -
+        */
+        void Cancel();         
+    
+        /**
+        * CompleteL the notifier is complete
+        * @param  aStatus status
+        * return  -
+        */
+        void CompleteL( TInt aStatus );
+                     
+    protected:    
+        /**
+        * Constructor
+        */
+        CNoWLANNetworksAvailableNotif();    
+    
+    protected:
+        // pointer to active object, owned
+        CActiveWLANNetworkUnavailableNote* iActiveNote;
+
+    };    
+
+#endif //__NO_WLAN_NETWORKS_AVAILABLE_NOTE_H__
+
+// End of File
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/wlancoveragecheck.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,65 @@
+/*
+* 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 WLAN Coverage Check class
+*
+*/
+
+#ifndef WLANCOVERAGECHECK_H
+#define WLANCOVERAGECHECK_H
+
+// INCLUDES
+#include <e32base.h>
+//#include <cmpluginwlandef.h>
+
+
+
+/**
+ *  WLAN Coverage Check
+ *
+ *  ?more_complete_description
+ *
+ *  @since S60 3.2
+ */
+NONSHARABLE_CLASS( CWlanCoverageCheck ) : public CActive
+    {
+    enum EWlanCoverageState
+        {
+        EServiceStatus,
+        EScanning,
+        EDone,                        
+        };
+        
+    public:
+    
+        CWlanCoverageCheck();
+        ~CWlanCoverageCheck();
+
+        TBool ScanForPromptedSsidL( TWlanSsid aEnteredSsid, TBool aBroadcast,
+                                TWlanConnectionMode& aNetworkMode,
+                                TWlanConnectionSecurityMode& aSecurityMode,
+                                TWlanConnectionExtentedSecurityMode& aExtSecurityMode,
+                                TBool& aProtectedSetupSupported );
+        
+    protected:  // from CActive
+    
+        virtual void DoCancel();
+        virtual void RunL();
+
+    private:
+        TUint32                 iProgState;
+        CActiveSchedulerWait    iWait;    
+    };
+
+
+#endif // WLANCOVERAGECHECK_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/wlanpowersavetest.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,114 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Dialog that implements WLAN Power Save Testing notification
+*
+*/
+
+
+#ifndef __POWERSAVETEST_QUERY_H__
+#define __POWERSAVETEST_QUERY_H__
+
+// INCLUDES
+#include <aknmessagequerydialog.h>
+
+// FORWARD DECLARATIONS
+class CWlanPowerSaveQueryNotif;
+
+
+// CLASS DECLARATIONS
+
+/**
+ * Class implements a query dialog.
+ */
+NONSHARABLE_CLASS( CWlanPowerSaveQuery ) : public CAknMessageQueryDialog 
+    {
+    public:
+        /**
+        * Constructor the CWlanPowerSaveQuery class
+        * @param aNotif notifier pointer  
+        * @return -
+        */
+        CWlanPowerSaveQuery( CWlanPowerSaveQueryNotif* aNotif );
+
+        /**
+        * Exit function the CWlanPowerSaveQuery
+        * @param aButtonId 
+        * @return TBool exit or no
+        */
+        virtual TBool OkToExitL( TInt aButtonId );
+    
+        /**
+        * Destructor
+        */
+        virtual ~CWlanPowerSaveQuery();     
+
+        /** 
+        * From @c CCoeControl.
+        *
+        * Handles key events.
+        * 
+        * If a control wishes to process key events, it should implement this
+        * function. The implementation must ensure that the function returns 
+        * @c EKeyWasNotConsumed if it does not do anything in response to a 
+        * key event, otherwise, other controls or dialogs may be prevented 
+        * from receiving the key event. If it is able to process the event it 
+        * should return @c EKeyWasConsumed.
+        * 
+        * @param aKeyEvent The key event. 
+        * @param aType The type of key event: @c EEventKey, @c EEventKeyUp or 
+        *        @c EEventKeyDown. 
+        * @return Indicates whether or not the key event was used
+        *         by this control. 
+        */
+        TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode );
+
+        /**
+        * Tries to exit the dialog when the specified button is pressed, if this 
+        * button should exit the dialog.
+        *
+        * See @c OkToExitL() to determine which buttons can exit the dialog.
+        * 
+        * This will fail if user exit is prevented by the 
+        * @c EEikDialogFlagNoUserExit flag. If the @c EEikDialogFlagNotifyEsc flag
+        * is not set and the dialog has been cancelled it immediately deletes 
+        * itself.
+        * 
+        * @param aButtonId The id of the pressed button.
+        */
+        void TryExitL( TInt aButtonId );
+        
+         /**
+        * Called by OfferkeyEventL(), gives a change to dismiss the query even with
+        * keys different than Enter of Ok.
+        * @param aKeyEvent has the key event details
+        * @return whether to dismiss the dialog or not.
+        */
+        TBool NeedToDismissQueryL( const TKeyEvent& aKeyEvent );
+
+    private:
+        /**
+        * PreLayoutDynInitL
+        * @param    -
+        */
+        virtual void PreLayoutDynInitL();    
+
+    private:
+        CWlanPowerSaveQueryNotif* iNotif;      // Pointer to the Notifier, not owned
+        TBool iButtonGroupPreviouslyChanged;   // Was ButtonGroup modified?
+    };
+
+
+#endif  // __POWERSAVETEST_QUERY_H__
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifInc/wlanpowersavetestnotif.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,119 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Notifier part for WLAN Power Save Testing notification dialog
+*
+*/
+
+#ifndef __POWERSAVETESTQUERYNOTIF_H__
+#define __POWERSAVETESTQUERYNOTIF_H__
+
+
+// INCLUDES
+#include <e32base.h>
+
+#include "ConnectionDialogsNotifBase.h"
+
+// FORWARD DECLARATIONS
+class CWlanPowerSaveQuery;
+
+/**
+ * OfflineWlanNoteNotif class
+ */
+NONSHARABLE_CLASS( CWlanPowerSaveQueryNotif ) 
+                                        : public CConnectionDialogsNotifBase
+    {
+    public:
+    
+        /**
+        * NewL function
+        * @param  -
+        * return CWlanPowerSaveQueryNotif*
+        */
+        static CWlanPowerSaveQueryNotif* NewL( 
+                                        const TBool aResourceFileResponsible );
+                                        
+        /**
+        * ~CWlanPowerSaveQueryNotif() destructor
+        * @param  -
+        * return  -
+        */
+        virtual ~CWlanPowerSaveQueryNotif();
+                                
+
+        /**
+        * RegisterL register the client notifier function
+        * @param  -
+        * return TNotifierInfo
+        */
+        TNotifierInfo RegisterL();
+
+        /**
+        * Start the Notifier
+        * @param  aBuffer    Buffer
+        * @param  aReplySlot Identifies which message argument to use for the 
+        *                    reply. This message argument will refer to a 
+        *                    modifiable descriptor, a TDes8 type, into which
+        *                    data can be returned. 
+        * @param  aMessage   Message
+        * return -
+        */
+        void StartL( const TDesC8&       aBuffer, 
+                     TInt                aReplySlot, 
+                     const RMessagePtr2& aMessage );
+
+        /**
+        * Cancel() the notifier
+        * @param  -
+        * return -
+        */
+        void Cancel();
+
+    public:
+
+        /**
+        * CompleteL the notifier is complete
+        * @param  aStatus status
+        * return  -
+        */
+        void CompleteL( TInt aStatus );
+
+         /**
+        * Callback is called when user selects dialog's link
+        * @param  aObject Pointer to notifier object.
+        * return  Error code
+        */  
+        static TInt DisableTestLinkL( TAny* aObject );
+        
+    private:        
+
+        /**
+        * Constructor.
+        */
+        CWlanPowerSaveQueryNotif();
+        
+        /**
+        * Exits the dialog.
+        */
+        void DoDisableTestLinkL();
+        
+    private:
+        CWlanPowerSaveQuery* iDialog;    // Pointer to the dialog
+        TBool                iDisable;   // Disable notification in the future
+        CAsyncCallBack*      iExitAsync; // One shot active object
+    };
+
+
+#endif // __POWERSAVETESTQUERYNOTIF_H__
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/ActiveConnectViaNote.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,305 @@
+/*
+* 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 CActiveConnectViaNote.
+*
+*/
+
+
+// INCLUDE FILES
+#include "ActiveConnectViaNote.h"
+#include "ConnectViaNoteNotif.h"
+#include "NoteDlgSuppressingSwitch.h"
+#include "ConnectionDialogsLogger.h"
+
+#include <ConnUiUtilsNotif.rsg>
+#include <StringLoader.h>
+
+#include <eikimage.h>
+#include <gulicon.h>
+
+#include <cmconnectionmethod.h>
+#include <cmdestination.h>
+
+#ifndef __WINS__
+#include <featmgr.h>
+#include <wlanmgmtclient.h>
+#include <cmmanagerext.h>
+#endif  // !__WINS__
+
+// CONSTANTS
+
+LOCAL_D const TInt KStringsGranularity = 2;
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CActiveConnectViaNote::CActiveConnectViaNote()
+// ---------------------------------------------------------
+//
+CActiveConnectViaNote::CActiveConnectViaNote( 
+                           CConnectViaNoteNotif* aNotif, 
+                           const TConnUiUiDestConnMethodNoteId aData ) 
+: CActive( KErrNone ), 
+  iNotif( aNotif ), 
+  iIcon( NULL ), 
+  iData( aData )
+    {
+    CActiveScheduler::Add( this );            
+    }
+    
+// ---------------------------------------------------------
+// CActiveConnectViaNote::DoCancel()
+// ---------------------------------------------------------
+// 
+void CActiveConnectViaNote::DoCancel()
+    {
+    }
+ 
+// ---------------------------------------------------------
+// CActiveConnectViaNote::RunL()
+// ---------------------------------------------------------
+//     
+void CActiveConnectViaNote::RunL()
+    {
+    CLOG_ENTERFN( "CActiveConnectViaNote::RunL" );  
+    
+    if( iStatus == KErrNone )
+        {
+        iCmManager.OpenL();
+        
+        HBufC* noteText = GetDialogTextL();
+        CleanupStack::PushL( noteText );
+                
+        CNoteDlgSuppressingSwitch* dialog = new (ELeave) 
+                            CNoteDlgSuppressingSwitch( 
+                            REINTERPRET_CAST( CEikDialog**, &dialog ) );
+        CleanupStack::PushL( dialog );
+        
+        CEikImage* image = CreateEikImageFromCGulIconLC();
+        dialog->SetIconL( image ); //The dialog takes ownership of the pointer
+        CleanupStack::Pop( image );
+        
+        CleanupStack::Pop( dialog );
+
+        TInt resId = R_CONNECTING_VIA_INFO_NOTE;    
+        switch( iData.iNoteId )
+            {
+            case EConnectedViaDestConnMethodConfirmationNote:
+            case EConnectedViaConnMethodConfirmationNote:
+                {
+                resId = R_CONNECTED_VIA_CONFIRM_NOTE;
+                break;
+                }
+            case EConnectingToConnMethodInfoNote:
+            default :
+                {                
+                break;
+                }
+            }
+            
+        dialog->PrepareLC( resId );
+        dialog->ActivateL();
+        dialog->SetCurrentLabelL( EGeneralNote, noteText->Des() );
+        
+        dialog->RunDlgLD( CAknNoteDialog::ELongTimeout, 
+                          CAknNoteDialog::ENoTone );
+                                         
+        CleanupStack::PopAndDestroy( noteText );
+        
+        CLOG_WRITE( "CActiveConnectViaNote::RunL: Completing with KErrNone" );
+
+        iNotif->CompleteL( KErrNone );                     
+        }     
+    
+    CLOG_LEAVEFN( "CActiveConnectViaNote::RunL" );  
+    }
+    
+// ---------------------------------------------------------
+// CActiveConnectViaNote::LaunchActiveConnectViaNote()
+// ---------------------------------------------------------
+//    
+void CActiveConnectViaNote::LaunchActiveConnectViaNote()
+    {
+    CLOG_ENTERFN( "CActiveConnectViaNote::LaunchActiveConnectViaNote" );  
+    
+    SetActive();    
+    iClientStatus = &iStatus;
+    User::RequestComplete( iClientStatus, KErrNone );    
+    }
+    
+    
+// ---------------------------------------------------------
+// CActiveConnectViaNote::~CActiveConnectViaNote()
+// ---------------------------------------------------------
+//    
+CActiveConnectViaNote::~CActiveConnectViaNote()
+    {
+    Cancel();  
+    iCmManager.Close();  
+       
+    delete iIcon;
+    iIcon = NULL;      
+    }
+    
+// ---------------------------------------------------------
+// CActiveConnectViaNote::GetDialogTextL()
+// ---------------------------------------------------------
+//    
+HBufC* CActiveConnectViaNote::GetDialogTextL()
+    {
+    HBufC* tempText = NULL;
+    switch( iData.iNoteId )
+        {
+        case EConnectedViaDestConnMethodConfirmationNote:
+            {
+            HBufC* destName = GetDestinationNameLC( iData.iDestination );
+            HBufC* cmName = GetConnectionMethodNameLC( 
+                                                    iData.iConnectionMethod );
+            CDesCArrayFlat* strings = new( ELeave ) CDesCArrayFlat( 
+                                                        KStringsGranularity );
+            CleanupStack::PushL( strings );
+            
+            strings->AppendL( *destName );   
+            strings->AppendL( *cmName );
+            tempText = StringLoader::LoadL( 
+                                        R_QTN_NETW_CONSET_CONF_CONNECTED_TO,
+                                        *strings );
+
+            CleanupStack::PopAndDestroy( strings );  
+            CleanupStack::PopAndDestroy( cmName );
+            CleanupStack::PopAndDestroy( destName );
+            break;
+            }
+
+        case EConnectedViaConnMethodConfirmationNote:
+        case EConnectingToConnMethodInfoNote:
+        default:
+            {
+            HBufC* cmNname = GetConnectionMethodNameLC( 
+                                                    iData.iConnectionMethod );
+            tempText = StringLoader::LoadL( 
+                ( iData.iNoteId == EConnectedViaConnMethodConfirmationNote ) ?
+                R_QTN_NETW_CONSET_CONF_CONNECTED_VIA_METHOD : 
+                R_QTN_NETW_CONSET_INFO_ROAMING_TO,
+                *cmNname );
+            CleanupStack::PopAndDestroy( cmNname ); 
+            break;
+            }
+        }
+
+    return tempText;
+    }
+
+// ---------------------------------------------------------
+// CActiveConnectViaNote::GetDestinationNameLC()
+// ---------------------------------------------------------
+//    
+HBufC* CActiveConnectViaNote::GetDestinationNameLC( const TUint32 aDestId )
+    {
+    HBufC* tempDestName( NULL );
+        
+    RCmDestination destination = iCmManager.DestinationL( aDestId );    
+    CleanupClosePushL( destination );
+
+    tempDestName = destination.NameLC();
+    CleanupStack::Pop( tempDestName );  // tempDestName
+
+    CleanupStack::PopAndDestroy();  // destination
+    CleanupStack::PushL( tempDestName );
+            
+    return tempDestName;
+    }
+    
+// ---------------------------------------------------------
+// CActiveConnectViaNote::GetConnectionMethodNameLC()
+// ---------------------------------------------------------
+//    
+HBufC* CActiveConnectViaNote::GetConnectionMethodNameLC( 
+                                                    const TUint32 aConnMId )
+    {
+    HBufC* tempCMName( NULL );
+    TBool isEasyWlan = EFalse;
+
+#ifndef __WINS__
+    
+    FeatureManager::InitializeLibL();
+    TBool isWlanSupported = 
+                    FeatureManager::FeatureSupported( KFeatureIdProtocolWlan );
+    FeatureManager::UnInitializeLib();
+
+    if ( isWlanSupported )
+        {
+        if ( iCmManager.EasyWlanIdL() == iData.iConnectionMethod )
+            {
+            TWlanSsid ssidConn;
+            CWlanMgmtClient *wlanMgmtClient = CWlanMgmtClient::NewL();
+            CleanupStack::PushL( wlanMgmtClient );
+
+            if ( !wlanMgmtClient->GetConnectionSsid( ssidConn ) )
+                {
+                tempCMName = HBufC::NewL( ssidConn.Length() );
+                tempCMName->Des().Copy( ssidConn ); 
+                isEasyWlan = ETrue;
+                }
+
+            wlanMgmtClient->CancelNotifications();
+            CleanupStack::PopAndDestroy( wlanMgmtClient );
+            }
+        }
+#endif  // !__WINS__
+    
+    CLOG_WRITEF( _L( "Connection Method id in CActiveConnectViaNote: %d" ), aConnMId );
+
+    RCmConnectionMethod connMethod = iCmManager.ConnectionMethodL( aConnMId );
+    CleanupClosePushL( connMethod );
+
+    TInt tempIcon = connMethod.GetIntAttributeL( CMManager::ECmBearerIcon );
+    CLOG_WRITEF( _L( "tempIcon in CActiveConnectViaNote: %d" ), tempIcon );
+    iIcon = REINTERPRET_CAST( CGulIcon*, tempIcon );
+    
+    if ( !isEasyWlan )
+        {
+        tempCMName = connMethod.GetStringAttributeL( CMManager::ECmName );
+        }
+    
+    CleanupStack::PopAndDestroy();  // connMethod
+    CleanupStack::PushL( tempCMName );
+    
+    return tempCMName;
+    }
+    
+// ---------------------------------------------------------
+// CActiveConnectViaNote::CreateEikImageFromCGulIconLC()
+// ---------------------------------------------------------
+//   
+CEikImage* CActiveConnectViaNote::CreateEikImageFromCGulIconLC()
+    {
+    CEikImage* tempImage = new ( ELeave ) CEikImage();
+    
+    if( iIcon )
+        {                
+        CFbsBitmap* bm = iIcon->Bitmap();
+        CFbsBitmap* m = iIcon->Mask();
+        tempImage->SetPicture( bm, m );
+        iIcon->SetBitmapsOwnedExternally( ETrue );                
+        }
+    
+    CleanupStack::PushL( tempImage );
+    return tempImage;    
+    }
+
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/ActiveOfflineWlanDisabledNote.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,96 @@
+/*
+* 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:  Implementation of CActiveOfflineWlanDisabledNote.
+*
+*/
+
+
+// INCLUDE FILES
+#include "ActiveOfflineWlanDisabledNote.h"
+
+#include <ConnUiUtilsNotif.rsg>
+#include <AknGlobalNote.h>
+#include <StringLoader.h>
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CActiveOfflineWlanDisabledNote::CActiveOfflineWlanDisabledNote()
+// ---------------------------------------------------------
+//
+CActiveOfflineWlanDisabledNote::CActiveOfflineWlanDisabledNote( 
+                                COfflineWlanDisabledNoteNotif* aNotif )
+: CActive( KErrNone ), 
+  iNotif( aNotif )
+    {
+    CActiveScheduler::Add( this );            
+    }
+    
+    
+// ---------------------------------------------------------
+// CActiveOfflineWlanDisabledNote::~CActiveOfflineWlanDisabledNote()
+// ---------------------------------------------------------
+//    
+CActiveOfflineWlanDisabledNote::~CActiveOfflineWlanDisabledNote()
+    {
+    Cancel();    
+    }
+
+
+// ---------------------------------------------------------
+// CActiveOfflineWlanDisabledNote::RunL()
+// ---------------------------------------------------------
+//     
+void CActiveOfflineWlanDisabledNote::RunL()
+    {
+    if( iStatus == KErrNone )
+        {
+        HBufC* stringLabel =  StringLoader::LoadLC( R_OFFLINE_NOT_POSSIBLE );
+        CleanupStack::PushL( stringLabel );
+                                          
+        CAknGlobalNote* globalNote = CAknGlobalNote::NewLC();
+        globalNote->ShowNoteL( EAknGlobalInformationNote, *stringLabel );
+
+        CleanupStack::PopAndDestroy( globalNote );
+        CleanupStack::PopAndDestroy( stringLabel );
+        
+        iNotif->SetCancelledFlag( ETrue );
+        iNotif->CompleteL( KErrNone );                     
+        }                
+    }
+
+    
+// ---------------------------------------------------------
+// CActiveOfflineWlanDisabledNote::DoCancel()
+// ---------------------------------------------------------
+// 
+void CActiveOfflineWlanDisabledNote::DoCancel()
+    {
+    }
+
+ 
+// ---------------------------------------------------------
+// CActiveOfflineWlanDisabledNote::LaunchOfflineWlanDisabledNote()
+// ---------------------------------------------------------
+//    
+void CActiveOfflineWlanDisabledNote::LaunchOfflineWlanDisabledNote()
+    {
+    SetActive();    
+    iClientStatus = &iStatus;
+    User::RequestComplete( iClientStatus, KErrNone );    
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/ActiveSelectWLanDlgPlugin.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,420 @@
+/*
+* 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:  Implementation of CActiveSelectWLanDlgPlugin.
+*
+*/
+
+
+// INCLUDE FILES
+#include <AknWaitDialog.h>
+#include <ConnUiUtilsNotif.rsg>
+#include <AknGlobalNote.h>
+#include <StringLoader.h>
+#include <centralrepository.h>
+#include <AknSgcc.h>
+#include <AknCapServerClient.h>
+//#include <aknnotewrappers.h>
+
+#include "ActiveSelectWLanDlgPlugin.h"
+#include "SelectWLANDlg.h"
+#include "ConnectionDialogsLogger.h"
+#include "ConnectionUiUtilitiesPrivateCRKeys.h"
+
+
+// CONSTANTS
+
+/**
+* For iPeriodic Timer, 10 seconds
+* The interval between refreshing available wlan networks.
+*/
+LOCAL_D const TInt KTickDefaultInterval = 10000000;
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CActiveSelectWLanDlgPlugin* CActiveSelectWLanDlgPlugin::NewL()
+// ---------------------------------------------------------
+//
+CActiveSelectWLanDlgPlugin* CActiveSelectWLanDlgPlugin::NewL( 
+                                              CSelectWLanDlgPlugin* aPlugin )
+    {
+    CLOG_ENTERFN( "CActiveSelectWLanDlgPlugin::NewL " );  
+    
+    CActiveSelectWLanDlgPlugin* self = 
+                         new ( ELeave ) CActiveSelectWLanDlgPlugin( aPlugin );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    
+    CLOG_LEAVEFN( "CActiveSelectWLanDlgPlugin::NewL " );      
+
+    return self;        
+    }
+
+// ---------------------------------------------------------
+// CActiveSelectWLanDlgPlugin::ConstructL()
+// ---------------------------------------------------------
+//
+void CActiveSelectWLanDlgPlugin::ConstructL()
+    {     
+    CLOG_ENTERFN( "CActiveSelectWLanDlgPlugin::ConstructL " );
+       
+    CActiveScheduler::Add( this );            
+    iWlanDataProv = CWlanNetworkDataProvider::NewL();
+    iPeriodic = CPeriodic::NewL( CActive::EPriorityStandard );
+    
+    CLOG_LEAVEFN( "CActiveSelectWLanDlgPlugin::ConstructL " );
+    }
+
+// ---------------------------------------------------------
+// CActiveSelectWLanDlgPlugin::CActiveSelectWLanDlgPlugin()
+// ---------------------------------------------------------
+//
+CActiveSelectWLanDlgPlugin::CActiveSelectWLanDlgPlugin( 
+                                                CSelectWLanDlgPlugin* aPlugin )
+: CActive( EPriorityStandard ), 
+  iPlugin( aPlugin )
+    {
+    }
+    
+// ---------------------------------------------------------
+// CActiveSelectWLanDlgPlugin::~CActiveSelectWLanDlgPlugin()
+// ---------------------------------------------------------
+//    
+CActiveSelectWLanDlgPlugin::~CActiveSelectWLanDlgPlugin()
+    {
+    CLOG_ENTERFN( "CActiveSelectWLanDlgPlugin::~CActiveSelectWLanDlgPlugin " );
+    Cancel();
+
+    StopTimer();
+    DestroyWaitDialog();
+
+    if ( iResultsListDialog  && !( iResultsListDialog->GetOkToExit() ) )
+        {
+        CLOG_WRITEF( _L( "OkToExit %b" ), iResultsListDialog->GetOkToExit() );
+        delete iResultsListDialog;
+        iResultsListDialog = NULL;
+        }
+    
+    delete iWlanDataProv;
+
+    CLOG_LEAVEFN( "CActiveSelectWLanDlgPlugin::~CActiveSelectWLanDlgPlugin " );
+    }
+
+
+// ---------------------------------------------------------
+// CActiveSelectWLanDlgPlugin::DoCancel()
+// ---------------------------------------------------------
+// 
+void CActiveSelectWLanDlgPlugin::DoCancel()
+    {
+    CLOG_ENTERFN( "CActiveSelectWLanDlgPlugin::DoCancel " );
+
+    CLOG_WRITE( "stopping timer" );
+    StopTimer();
+
+    CLOG_WRITE( "deleting results list dialog" );
+    DestroyResultsListDialog();
+
+    CLOG_WRITE( "deleting wait dialog" );
+    DestroyWaitDialog();
+
+    CLOG_WRITE( "deleting wlan data provider" );
+    delete iWlanDataProv;
+    iWlanDataProv = NULL;
+
+    CLOG_LEAVEFN( "CActiveSelectWLanDlgPlugin::DoCancel " );
+    }
+    
+// ---------------------------------------------------------
+// CActiveSelectWLanDlgPlugin::StartTimerL
+// ---------------------------------------------------------
+//    
+void CActiveSelectWLanDlgPlugin::StartTimerL( TInt aTickInterval )
+    {    
+    CLOG_ENTERFN( "CActiveSelectWLanDlgPlugin::StartTimerL " );  
+    
+    if( !iPeriodic )
+        {
+        iPeriodic = CPeriodic::NewL( CActive::EPriorityStandard ); 
+        }
+        
+    iPeriodic->Start( aTickInterval, aTickInterval, TCallBack( Tick, this ) );
+    
+    CLOG_LEAVEFN( "CActiveSelectWLanDlgPlugin::StartTimerL " );
+    }
+
+
+// ---------------------------------------------------------
+// CActiveSelectWLanDlgPlugin::StopTimer
+// ---------------------------------------------------------
+//
+void CActiveSelectWLanDlgPlugin::StopTimer()
+    {
+    CLOG_ENTERFN( "CActiveSelectWLanDlgPlugin::StopTimer " );  
+    
+    if( iPeriodic )
+        {
+        CLOG_WRITE( "iPeriodic" );
+        iPeriodic->Cancel();
+        CLOG_WRITE( "Cancel" );
+        
+        delete iPeriodic;
+        CLOG_WRITE( "delete" );
+        
+        iPeriodic = NULL;
+        }        
+    
+    CLOG_LEAVEFN( "CActiveSelectWLanDlgPlugin::StopTimer " );
+    }
+    
+// ---------------------------------------------------------
+// CActiveSelectWLanDlgPlugin::DoTick
+// ---------------------------------------------------------
+//
+void CActiveSelectWLanDlgPlugin::DoTick()
+    {
+    CLOG_ENTERFN( "CActiveSelectWLanDlgPlugin::DoTick " );
+
+    if ( IsActive() == EFalse )
+        {
+        CLOG_WRITE( "not active anymore - making another scan request..." );
+
+        SetActive();
+
+#ifdef __WINS__
+        TRequestStatus* clientStatus = &iStatus;
+        User::RequestComplete( clientStatus, KErrNone );
+#else
+        iWlanDataProv->RefreshScanInfo( iStatus );
+#endif
+        }
+    }
+
+// ---------------------------------------------------------
+// CActiveSelectWLanDlgPlugin::Tick
+// ---------------------------------------------------------
+//
+TInt CActiveSelectWLanDlgPlugin::Tick( TAny* aObject )
+    {
+    CLOG_ENTERFN( "CActiveSelectWLanDlgPlugin::Tick " );
+
+    CActiveSelectWLanDlgPlugin* myself =
+                        static_cast<CActiveSelectWLanDlgPlugin*>( aObject );
+    myself->DoTick();
+
+    CLOG_LEAVEFN( "CActiveSelectWLanDlgPlugin::Tick " );
+
+    return 1;
+    }
+
+
+// ---------------------------------------------------------
+// CActiveSelectWLanDlgPlugin::RunL()
+// ---------------------------------------------------------
+//     
+void CActiveSelectWLanDlgPlugin::RunL()
+    {
+    CLOG_ENTERFN( "CActiveSelectWLanDlgPlugin::RunL " );  
+    
+    if ( iWaitDialog )
+        {
+        iWaitDialog->ProcessFinishedL();     
+        delete iWaitDialog;
+        iWaitDialog = NULL;    
+        }
+    
+    CLOG_WRITEF( _L( "iStatus.Int() : %d" ), iStatus.Int() );
+    
+    if( iStatus == KErrNone )
+        {             
+        iWlanDataProv->OnTimerExpiredL();
+        
+        CNetworkInfoArray* *const networkArray = 
+                                   iWlanDataProv->GetNetworkInfoArray();
+         
+        const TInt resultsCount = ( *networkArray )->MdcaCount();
+
+        CLOG_WRITEF( _L( "resultsCount : %d" ),resultsCount );
+
+        if ( resultsCount > 0 )
+            {
+            if( iResultsListDialog )
+                {
+                iResultsListDialog->RefreshDialogL();
+                }
+            else
+                {
+                iResultsListDialog = CSelectWLANDlg::NewL( iPlugin, 
+                                                           networkArray );
+
+                iResultsListDialog->ExecuteLD( R_SELECT_WLAN_LIST_QUERY );
+
+                TInt interval = GetRefreshInterval();
+                CLOG_WRITEF( _L( "interval : %d" ),  interval );
+
+                if( interval )
+                    {
+                    StartTimerL( interval );
+                    }
+                }
+            }
+        else
+            {
+            StopTimer();
+            
+            DestroyWaitDialog();
+            DestroyResultsListDialog();
+
+            HBufC* stringLabel = StringLoader::LoadLC( 
+                                                    R_INFO_NO_NETWORKS_FOUND );
+/*** Deadlock                                              
+            CAknGlobalNote* globalNote = CAknGlobalNote::NewLC();
+            globalNote->ShowNoteL( EAknGlobalInformationNote, *stringLabel );
+
+            CleanupStack::PopAndDestroy( globalNote );
+            CleanupStack::PopAndDestroy( stringLabel );
+***/
+
+//// 3.1 solution: prevent deadlock, does not work in 3.0 because of avkon 
+            RAknUiServer* globalNote = CAknSgcClient::AknSrv();
+            if ( globalNote->Handle() )
+                {
+                globalNote->ShowGlobalNoteL( *stringLabel, 
+                                            EAknGlobalInformationNote );
+                }
+            CleanupStack::PopAndDestroy( stringLabel );
+
+//// End of 3.1 solution
+
+/*** 3.0 solution
+            CAknInformationNote* myLocalGlobalNote = new ( ELeave ) 
+                                                CAknInformationNote( EFalse );
+            myLocalGlobalNote->ExecuteLD( *stringLabel );
+            CleanupStack::PopAndDestroy( stringLabel );
+
+*** End of 3.0 solution    ***/
+            
+            iPlugin->SetCancelledFlag( ETrue );
+            iPlugin->CompleteL( KErrNotFound );            
+            }
+        }
+    CLOG_LEAVEFN( "CActiveSelectWLanDlgPlugin::RunL " );      
+        
+    }
+    
+// ---------------------------------------------------------
+// CActiveSelectWLanDlgPlugin::StartSearchWlanNetworkL()
+// ---------------------------------------------------------
+//    
+void CActiveSelectWLanDlgPlugin::StartSearchWlanNetworkL()
+    {    
+    CLOG_ENTERFN( "CActiveSelectWLanDlgPlugin::StartSearchWlanNetworkL " );  
+    
+    DestroyWaitDialog();
+
+    iWaitDialog = new( ELeave )CAknWaitDialog
+                    ( REINTERPRET_CAST( CEikDialog**, &iWaitDialog ), ETrue );
+    iWaitDialog->ExecuteLD( R_SEARCHING_WLAN_WAIT_NOTE ); 
+    
+    SetActive();    
+
+#ifdef __WINS__
+    TRequestStatus* clientStatus = &iStatus;
+    User::RequestComplete( clientStatus, KErrNone );
+#else
+    iWlanDataProv->RefreshScanInfo( iStatus );
+#endif
+
+    CLOG_LEAVEFN( "CActiveSelectWLanDlgPlugin::StartSearchWlanNetworkL " );
+    }
+    
+// ---------------------------------------------------------
+// CActiveSelectWLanDlgPlugin::GetRefreshInterval()
+// ---------------------------------------------------------
+//    
+TInt CActiveSelectWLanDlgPlugin::GetRefreshInterval()
+    {
+    CLOG_ENTERFN( "CActiveSelectWLanDlgPlugin::GetRefreshInterval " );
+
+    CRepository* repository = NULL;
+    TInt err( KErrNone );
+
+    TRAP( err, 
+          repository = CRepository::NewL( KCRUidConnectionUiUtilities ) );
+          
+    TInt variant( 0 );  
+    CLOG_WRITEF( _L( "err : %d" ), err );
+      
+    if ( err == KErrNone )
+        {
+        TInt retval = repository->Get( KConnectionUiUtilitiesScanInterval, 
+                                       variant ); 
+                                       
+        CLOG_WRITEF( _L( "retval : %d" ), retval );
+                                                                             
+        if ( retval == KErrNotFound )
+            {
+            variant = KTickDefaultInterval;
+            }
+        }
+     else
+        {
+        variant = KTickDefaultInterval;
+        }
+
+    delete repository;
+
+    CLOG_WRITEF( _L( "variant : %d" ), variant );
+    
+    CLOG_LEAVEFN( "CActiveSelectWLanDlgPlugin::GetRefreshInterval " );
+    
+    return variant;            
+    }
+
+
+// ---------------------------------------------------------
+// CActiveSelectWLanDlgPlugin::DestroyWaitDialog()
+// ---------------------------------------------------------
+//
+void CActiveSelectWLanDlgPlugin::DestroyWaitDialog()
+    {
+    CLOG_ENTERFN( "CActiveSelectWLanDlgPlugin::DestroyWaitDialog " );
+
+    delete iWaitDialog;
+    iWaitDialog = NULL;
+
+    CLOG_LEAVEFN( "CActiveSelectWLanDlgPlugin::DestroyWaitDialog " );
+    }
+
+
+// ---------------------------------------------------------
+// CActiveSelectWLanDlgPlugin::DestroyResultsListDialog()
+// ---------------------------------------------------------
+//
+void CActiveSelectWLanDlgPlugin::DestroyResultsListDialog()
+    {
+    CLOG_ENTERFN( "CActiveSelectWLanDlgPlugin::DestroyResultsListDialog " );
+
+    if ( iResultsListDialog  && !( iResultsListDialog->GetOkToExit() ) )
+        {
+        delete iResultsListDialog;
+        iResultsListDialog = NULL;
+        }
+
+    CLOG_LEAVEFN( "CActiveSelectWLanDlgPlugin::DestroyResultsListDialog " );
+    }
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/ActiveWLANNetworkUnavailableNote.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,108 @@
+/*
+* Copyright (c) 2004 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 CActiveWLANNetworkUnavailableNote
+*
+*/
+
+
+// INCLUDE FILES
+#include "ActiveWLANNetworkUnavailableNote.h"
+
+#include <ConnUiUtilsNotif.rsg>
+#include <AknGlobalNote.h>
+#include <StringLoader.h>
+
+
+// CONSTANTS
+
+// ================= MEMBER FUNCTIONS =======================
+
+
+// ---------------------------------------------------------
+// CActiveWLANNetworkUnavailableNote::CActiveWLANNetworkUnavailableNote()
+// ---------------------------------------------------------
+//
+CActiveWLANNetworkUnavailableNote::CActiveWLANNetworkUnavailableNote( 
+                                  CConnectionDialogsNotifBase* aNotif ) :
+CActive( KErrNone ), iNotif( aNotif )
+    {
+    CActiveScheduler::Add( this );            
+    }
+    
+// ---------------------------------------------------------
+// CActiveOfflineWlanDisabledNote::DoCancel()
+// ---------------------------------------------------------
+// 
+void CActiveWLANNetworkUnavailableNote::DoCancel()
+    {
+    }
+ 
+// ---------------------------------------------------------
+// CActiveOfflineWlanDisabledNote::RunL()
+// ---------------------------------------------------------
+//     
+void CActiveWLANNetworkUnavailableNote::RunL()
+    {
+    if( iStatus == KErrNone )
+        {
+        HBufC* stringLabel;
+        
+        if ( iNoteType == EWlanNote2 )
+            {
+            stringLabel =  StringLoader::LoadLC( 
+                                 R_OCC_INFO_NO_WLAN_AVAILABLE );
+                    
+            }
+        else
+            {
+            stringLabel =  StringLoader::LoadLC( 
+                                   R_WLAN_NETWORK_UNAVAILABLE );
+            }
+                                          
+        CAknGlobalNote* globalNote = CAknGlobalNote::NewLC();
+        globalNote->ShowNoteL( EAknGlobalErrorNote, *stringLabel );
+
+        CleanupStack::PopAndDestroy( globalNote );
+        CleanupStack::PopAndDestroy( stringLabel );                    
+        }
+    
+    iNotif->SetCancelledFlag( ETrue );
+    iNotif->CompleteL( KErrNone );
+    }
+    
+// ---------------------------------------------------------
+// CActiveWLANNetworkUnavailableNote::LaunchWLANNetworkUnavailable()
+// ---------------------------------------------------------
+//    
+void CActiveWLANNetworkUnavailableNote::LaunchWLANNetworkUnavailable(
+                                                 const TInt aNoteType )
+    {
+    iNoteType = aNoteType;
+    SetActive();    
+    iClientStatus = &iStatus;
+    User::RequestComplete( iClientStatus, KErrNone );    
+    }
+    
+    
+// ---------------------------------------------------------
+// CActiveWLANNetworkUnavailableNote::CActiveWLANNetworkUnavailableNote()
+// ---------------------------------------------------------
+//    
+CActiveWLANNetworkUnavailableNote::~CActiveWLANNetworkUnavailableNote()
+    {
+    Cancel();    
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/ConfirmationQuery.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,158 @@
+/*
+* 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 CConfirmationQuery.
+*
+*/
+
+
+// INCLUDE FILES
+#include "ConfirmationQuery.h"
+#include "ConfirmationQueryNotif.h"
+#include "ConnectionUiUtilitiesCommon.h"
+#include "ConnectionDialogsLogger.h"
+#include "ExpiryTimer.h"
+
+#include <uikon/eiksrvui.h>
+#include <StringLoader.h>
+#include <ConnUiUtilsNotif.rsg>
+
+
+
+// CONSTANTS
+#if defined(_DEBUG)
+_LIT( KErrNullPointer, "NULL pointer" );
+#endif
+
+
+// ================= MEMBER FUNCTIONS =======================
+//
+// ---------------------------------------------------------
+// CConfirmationQuery::CConfirmationQuery
+// ---------------------------------------------------------
+//
+CConfirmationQuery::CConfirmationQuery( CConfirmationQueryNotif* aNotif )
+: CAknListQueryDialog( &iDummy ),
+  iNotif( aNotif ),
+  iButtonGroupPreviouslyChanged( EFalse )
+   {
+   }
+    
+    
+// ---------------------------------------------------------
+// CConfirmationQuery::~CConfirmationQuery
+// ---------------------------------------------------------
+//
+CConfirmationQuery::~CConfirmationQuery()
+    {
+    STATIC_CAST( CEikServAppUi*, 
+                 CCoeEnv::Static()->AppUi() )->SuppressAppSwitching( EFalse );
+    delete iExpiryTimer;
+    }
+
+
+
+// ---------------------------------------------------------
+// CConfirmationQuery::OkToExitL
+// ---------------------------------------------------------
+//
+TBool CConfirmationQuery::OkToExitL( TInt aButtonId )
+    {
+    CLOG_ENTERFN( "CConfirmationQuery::OkToExitL" );
+    TBool result( EFalse );
+    TInt status = KErrCancel;
+    if ( aButtonId == EAknSoftkeySelect || 
+         aButtonId == EAknSoftkeyDone || aButtonId == EAknSoftkeyOk )
+        {
+        iNotif->SetSelectedChoiceL( iChoiceIds[ListBox()->CurrentItemIndex()] );
+        result = ETrue;
+        status = KErrNone;
+        }
+    else if ( aButtonId == EAknSoftkeyCancel )
+        {
+        status = KErrCancel;
+        result = ETrue;
+        }
+
+    if ( result )
+        {
+        CLOG_WRITEF( _L( "aButtonId = %d" ), aButtonId );
+        __ASSERT_DEBUG( iNotif, User::Panic( KErrNullPointer, KErrNone ) );
+        iNotif->CompleteL( status );
+        }
+
+    CLOG_LEAVEFN( "CConfirmationQuery::OkToExitL" );
+
+    return result;  
+    }
+    
+    
+// ---------------------------------------------------------
+// CConfirmationQuery::PreLayoutDynInitL()
+// ---------------------------------------------------------
+//
+void CConfirmationQuery::PreLayoutDynInitL()
+    {      
+    CAknListQueryDialog::PreLayoutDynInitL();
+
+    STATIC_CAST( CEikServAppUi*, 
+                CCoeEnv::Static()->AppUi() )->SuppressAppSwitching( ETrue );
+
+    iExpiryTimer = CExpiryTimer::NewL( *this );
+    iExpiryTimer->Start();
+    }
+
+
+// ---------------------------------------------------------
+// CConfirmationQuery::TryExitL()
+// ---------------------------------------------------------
+//
+void CConfirmationQuery::TryExitL( TInt aButtonId )
+    {
+    CLOG_ENTERFN( "CConfirmationQuery::TryExitL" );
+    CAknListQueryDialog::TryExitL( aButtonId );
+    CLOG_LEAVEFN( "CConfirmationQuery::TryExitL" );
+    }
+
+// ---------------------------------------------------------
+// CConfirmationQuery::NeedToDismissQueryL
+// ---------------------------------------------------------
+//
+TBool CConfirmationQuery::NeedToDismissQueryL(const TKeyEvent& aKeyEvent)
+    {
+    if (aKeyEvent.iCode == EKeyPhoneSend)
+        {
+        TryExitL(EEikBidCancel);
+        return ETrue;
+        }
+        
+    return EFalse;
+    }
+
+
+// ---------------------------------------------------------
+// CConfirmationQuery::SetChoices
+// ---------------------------------------------------------
+//
+void CConfirmationQuery::SetChoices( RArray<TMsgQueryLinkedResults> aChoices )
+    {
+    iChoiceIds = aChoices;
+    }
+
+void CConfirmationQuery::HandleTimedOut()
+    {
+    TRAP_IGNORE( TryExitL(EAknSoftkeyCancel) );
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/ConfirmationQueryNotif.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,256 @@
+/*
+* 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:  Implementation of CConfirmationQueryNotif.
+*
+*/
+
+
+// INCLUDE FILES
+#include "ConfirmationQueryNotif.h"
+#include "ConfirmationQuery.h"
+#include "ConnectionUiUtilitiesCommon.h"
+#include "ConnUiUtilsNotif.h"
+#include "ConnectionDialogsLogger.h"
+
+#include <ConnUiUtilsNotif.rsg>
+#include <StringLoader.h>
+
+#include <cmmanager.h>
+#include <cmmanagerext.h>
+#include <cmconnectionmethod.h>
+#include <cmdestination.h>
+#include <ConnectionUiUtilities.h>
+#include <datamobilitycommsdattypes.h>
+
+
+using namespace CMManager;
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CConfirmationQueryNotif::CConfirmationQueryNotif()
+// ---------------------------------------------------------
+//
+CConfirmationQueryNotif::CConfirmationQueryNotif()
+: iConnMethod( 0 ), 
+  iChoice( EMsgQueryCancelled )
+    {
+    }
+
+
+// ---------------------------------------------------------
+// CConfirmationQueryNotif* CConfirmationQueryNotif::NewL()
+// ---------------------------------------------------------
+//
+CConfirmationQueryNotif* CConfirmationQueryNotif::NewL( 
+                                        const TBool aResourceFileResponsible )
+    {
+    CConfirmationQueryNotif* self = new ( ELeave ) CConfirmationQueryNotif();
+    CleanupStack::PushL( self );
+    self->ConstructL( KResourceFileName, aResourceFileResponsible );
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+
+// ---------------------------------------------------------
+// CConfirmationQueryNotif::~CConfirmationQueryNotif()
+// ---------------------------------------------------------
+//
+CConfirmationQueryNotif::~CConfirmationQueryNotif()
+    {   
+    if ( iLaunchDialogAsync )
+        {
+        delete iLaunchDialogAsync;
+        iLaunchDialogAsync = NULL;
+        }
+    }
+
+// ---------------------------------------------------------
+// CConfirmationQueryNotif::RegisterL()
+// ---------------------------------------------------------
+//
+CConfirmationQueryNotif::TNotifierInfo CConfirmationQueryNotif::RegisterL()
+    {
+    iInfo.iUid = KUidConfirmationQuery;
+    iInfo.iPriority = ENotifierPriorityHigh;
+    iInfo.iChannel = KUidConfirmationQuery;
+
+    return iInfo;
+    }
+
+// ---------------------------------------------------------
+// void CConfirmationQueryNotif::StartL
+// ---------------------------------------------------------
+//
+void CConfirmationQueryNotif::StartL( const TDesC8& aBuffer, 
+                                    TInt aReplySlot,
+                                    const RMessagePtr2& aMessage )
+    {
+    if ( iLaunchDialogAsync )
+        {
+        if ( iLaunchDialogAsync->IsActive() )
+           {
+           // Dialog is already active
+           aMessage.Complete( KErrServerBusy );
+           return;
+           }    
+        }
+    
+    iChoice = EMsgQueryCancelled; 
+    TPckgBuf<TConnUiUiDestConnMethodNoteId> input;
+    input.Copy( aBuffer );
+    iNoteInfo = input();
+    
+    iReplySlot = aReplySlot;
+    iMessage = aMessage;
+    iCancelled = EFalse;
+    
+    TCallBack cb( LaunchDialogL, this );
+    
+    if ( !iLaunchDialogAsync )
+        {
+        iLaunchDialogAsync = new( ELeave ) CAsyncCallBack( cb, CActive::EPriorityHigh );    
+        }
+    
+    iLaunchDialogAsync->CallBack();
+    }
+
+
+// ---------------------------------------------------------
+// void CConfirmationQueryNotif::Cancel()
+// ---------------------------------------------------------
+//
+void CConfirmationQueryNotif::Cancel()
+    {
+    CLOG_ENTERFN( "CConfirmationQueryNotif::Cancel" );
+    if ( !iCancelled )
+        {
+        iCancelled = ETrue;
+        if ( !iMessage.IsNull() )
+            {
+            iMessage.Complete( KErrCancel );
+            }
+        
+        delete iDialog;
+        iDialog = NULL;
+        }
+    
+    CLOG_LEAVEFN( "CConfirmationQueryNotif::Cancel" );
+    }
+
+
+// ---------------------------------------------------------
+// void CConfirmationQueryNotif::CompleteL( TInt aStatus )
+// ---------------------------------------------------------
+//
+void CConfirmationQueryNotif::CompleteL( TInt aStatus )
+    {  
+    CLOG_ENTERFN( "CConfirmationQueryNotif::CompleteL" );
+    iCancelled = ETrue;   
+    if ( !iMessage.IsNull() )
+        {  
+        if ( aStatus == KErrNone )
+            {
+            iMessage.WriteL( iReplySlot, TPckg<TMsgQueryLinkedResults>( iChoice ) );
+            }
+        iMessage.Complete( aStatus );
+        }
+      
+    Cancel();
+    
+    CLOG_LEAVEFN( "CConfirmationQueryNotif::CompleteL" );
+    }
+
+// ---------------------------------------------------------------
+// void CConfirmationQueryNotif::SetSelectedChoiceL( TInt aChoice )
+// ----------------------------------------------------------------
+//
+void CConfirmationQueryNotif::SetSelectedChoiceL ( TInt aChoice )
+    {
+    CLOG_ENTERFN( "CConfirmationQueryNotif::SetSelectedChoiceL" );
+    iChoice = (TMsgQueryLinkedResults)aChoice;
+    CLOG_LEAVEFN( "CConfirmationQueryNotif::SetSelectedChoiceL" );
+    }
+
+// ---------------------------------------------------------
+// TInt CConfirmationQueryNotif::LaunchDialogL()
+// ---------------------------------------------------------
+//
+TInt CConfirmationQueryNotif::LaunchDialogL( TAny* aObject )
+    {
+    CLOG_ENTERFN( "CCConfirmationQueryNotif::LaunchDialogL" );
+    CConfirmationQueryNotif* myself =
+                            static_cast<CConfirmationQueryNotif*>( aObject );
+    
+    myself->iDialog = new ( ELeave ) CConfirmationQuery( myself );
+    myself->iDialog->PrepareLC( R_MESSAGE_QUERY );
+                            
+    // Create the list box items
+    RArray<TMsgQueryLinkedResults> choices;
+    CDesCArrayFlat* array = new (ELeave) CDesCArrayFlat(2);
+    CleanupStack::PushL( array );
+    HBufC* heading = NULL;
+    HBufC* messageBase = NULL;
+    HBufC* automatic = NULL;
+    HBufC* thisTime = NULL;
+
+    automatic = StringLoader::LoadLC( R_QTN_OCC_LIST_CS_DATA_HOME_NW_AUTOMATIC );
+    thisTime = StringLoader::LoadLC( R_QTN_OCC_LIST_CS_DATA_HOME_NW_THIS_TIME );
+                                
+    if ( myself->iNoteInfo.iNoteId == EConfirmMethodUsageQueryInHomeNetwork ) 
+        {
+        heading = StringLoader::LoadLC( R_QTN_OCC_PRMPT_CS_DATA_HOME_NW );
+        messageBase = StringLoader::LoadLC( R_QTN_OCC_DETAIL_CS_DATA_HOME_NW );
+        // the order of the query options depends on the location
+        choices.Append(EMsgQueryAutomatically);
+        choices.Append(EMsgQueryThisTime);
+        array->AppendL( *automatic );
+        array->AppendL( *thisTime );
+        } 
+    else 
+        {
+        heading = StringLoader::LoadLC( R_QTN_OCC_PRMPT_CS_DATA_FOREIGN_NW );
+        messageBase = StringLoader::LoadLC( R_QTN_OCC_DETAIL_CS_DATA_FOREIGN_NW );
+        // the order of the query options depends on the location
+        choices.Append(EMsgQueryThisTime);
+        choices.Append(EMsgQueryAutomatically);
+        array->AppendL( *thisTime );
+        array->AppendL( *automatic );
+        }              
+
+    // Set the dialog heading and message text
+    myself->iDialog->Heading()->SetTextL(*heading);
+    myself->iDialog->MessageBox()->SetMessageTextL(messageBase);
+    CleanupStack::PopAndDestroy( messageBase );
+    CleanupStack::PopAndDestroy( heading );
+                            
+    // Set the options to the listbox
+    myself->iDialog->SetChoices(choices);
+
+    myself->iDialog->SetItemTextArray( array );
+    myself->iDialog->SetOwnershipType(ELbmOwnsItemArray); // ownership transferred to listbox
+    myself->iDialog->ListBox()->HandleItemAdditionL();
+                            
+    CleanupStack::Pop( thisTime );
+    CleanupStack::Pop( automatic );
+    CleanupStack::Pop( array );
+    myself->iDialog->RunLD();
+                                 
+    CLOG_LEAVEFN( "CConfirmationQueryNotif::LaunchDialogL" );
+    return 0;   
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/ConnUiUtilsNotif.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,153 @@
+/*
+* Copyright (c) 2004 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 base plugin.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "ConnUiUtilsNotif.h"
+
+#include "SelectWLanDlgPlugin.h"
+#include "OfflineWlanNoteNotif.h"
+#include "OfflineWlanDisabledNoteNotif.h"
+#include "EasyWepDlgNotif.h"
+#include "EasyWpaDlgNotif.h"
+#include "WLANNetworkUnavailableNoteNotif.h"
+#include "ConfirmationQueryNotif.h"
+#include "ConnectViaNoteNotif.h"
+#include "wlanpowersavetestnotif.h"
+#include "easywapidlgnotif.h"
+#include "nowlannetworksavailablenotif.h"
+#include "connectingviadiscreetpopupnotif.h"
+#include "connectionerrordiscreetpopupnotif.h"
+
+// CONSTANTS
+
+LOCAL_D const TInt KPluginGranularity = 4;
+
+// FORWARD DECLARATIONS
+
+LOCAL_C void CreateNotifiersL( 
+                            CArrayPtrFlat<MEikSrvNotifierBase2>* aNotifiers );
+
+// ---------------------------------------------------------
+// NotifierArray()
+// Lib main entry point
+// ---------------------------------------------------------
+//
+EXPORT_C CArrayPtr<MEikSrvNotifierBase2>* NotifierArray()
+    {
+    CArrayPtrFlat<MEikSrvNotifierBase2>* array = new (ELeave) 
+                    CArrayPtrFlat<MEikSrvNotifierBase2>( KPluginGranularity );
+
+    if ( array )
+        {
+        TRAPD( err, CreateNotifiersL( array ) );
+        if( err )
+            {
+            TInt count = array->Count();
+            while( count-- )
+                {
+                (*array)[count]->Release();
+                }
+            delete array;
+            array = NULL;
+            }
+        }
+
+    return( array );
+    }
+
+// ---------------------------------------------------------
+// CreateNotifiersL()
+// ---------------------------------------------------------
+//
+LOCAL_C void CreateNotifiersL( 
+                              CArrayPtrFlat<MEikSrvNotifierBase2>* aNotifiers )
+    {
+    MEikSrvNotifierBase2 *serNotify;
+    TBool resourceFileResponsible = ETrue;
+
+    serNotify = CSelectWLanDlgPlugin::NewL( resourceFileResponsible );
+    CleanupStack::PushL( serNotify );
+    aNotifiers->AppendL( serNotify );
+    CleanupStack::Pop( serNotify );
+    
+    resourceFileResponsible = EFalse; // Only the first has to load resources
+
+    serNotify = COfflineWlanNoteNotif::NewL( resourceFileResponsible );
+    CleanupStack::PushL( serNotify );
+    aNotifiers->AppendL( serNotify );
+    CleanupStack::Pop( serNotify );
+    
+    serNotify = COfflineWlanDisabledNoteNotif::NewL( resourceFileResponsible );
+    CleanupStack::PushL( serNotify );
+    aNotifiers->AppendL( serNotify );
+    CleanupStack::Pop( serNotify );      
+    
+    serNotify = CEasyWepDlgNotif::NewL( resourceFileResponsible );
+    CleanupStack::PushL( serNotify );
+    aNotifiers->AppendL( serNotify );
+    CleanupStack::Pop( serNotify );      
+
+    serNotify = CEasyWpaDlgNotif::NewL( resourceFileResponsible );
+    CleanupStack::PushL( serNotify );
+    aNotifiers->AppendL( serNotify );
+    CleanupStack::Pop( serNotify );      
+
+    serNotify = CWLANNetworkUnavailableNoteNotif::NewL( 
+                                                    resourceFileResponsible );
+    CleanupStack::PushL( serNotify );
+    aNotifiers->AppendL( serNotify );
+    CleanupStack::Pop( serNotify );      
+
+    serNotify = CConfirmationQueryNotif::NewL( resourceFileResponsible );
+    CleanupStack::PushL( serNotify );
+    aNotifiers->AppendL( serNotify );
+    CleanupStack::Pop( serNotify );     
+    
+    serNotify = CConnectViaNoteNotif::NewL( resourceFileResponsible );
+    CleanupStack::PushL( serNotify );
+    aNotifiers->AppendL( serNotify );
+    CleanupStack::Pop( serNotify );     
+  
+    serNotify = CWlanPowerSaveQueryNotif::NewL( resourceFileResponsible );
+    CleanupStack::PushL( serNotify );
+    aNotifiers->AppendL( serNotify );
+    CleanupStack::Pop( serNotify );
+    
+    serNotify = CEasyWapiDlgNotif::NewL( resourceFileResponsible );
+    CleanupStack::PushL( serNotify );
+    aNotifiers->AppendL( serNotify );
+    CleanupStack::Pop( serNotify );    
+
+    serNotify = CConnectingViaDiscreetPopupNotif::NewL( resourceFileResponsible );
+    CleanupStack::PushL( serNotify );
+    aNotifiers->AppendL( serNotify );
+    CleanupStack::Pop( serNotify );
+    
+    serNotify = CNoWLANNetworksAvailableNotif::NewL( resourceFileResponsible );
+    CleanupStack::PushL( serNotify );
+    aNotifiers->AppendL( serNotify );
+    CleanupStack::Pop( serNotify );
+
+    serNotify = CConnectionErrorDiscreetPopupNotif::NewL( resourceFileResponsible );
+    CleanupStack::PushL( serNotify );
+    aNotifiers->AppendL( serNotify );
+    CleanupStack::Pop( serNotify );
+    }
+    
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/ConnectViaNoteNotif.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,125 @@
+/*
+* 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 CConnectViaNoteNotif.
+*
+*/
+
+
+// INCLUDE FILES
+#include "ConnectViaNoteNotif.h"
+#include "ConnectionUiUtilitiesCommon.h"
+#include "ActiveConnectViaNote.h"
+#include "ConnUiUtilsNotif.h"
+#include "ConnectionDialogsLogger.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CConnectViaNoteNotif::TNotifierInfo CConnectViaNoteNotif::RegisterL()
+// ---------------------------------------------------------
+//
+CConnectViaNoteNotif::TNotifierInfo CConnectViaNoteNotif::RegisterL()
+    {
+    iInfo.iUid = KUidConnectViaNote;
+    iInfo.iPriority = ENotifierPriorityHigh;
+    iInfo.iChannel = KUidConnectViaNote;
+
+    return iInfo;
+    }
+
+// ---------------------------------------------------------
+// void CConnectViaNoteNotif::StartL
+// ---------------------------------------------------------
+//
+void CConnectViaNoteNotif::StartL( const TDesC8& aBuffer, 
+                                    TInt aReplySlot,
+                                    const RMessagePtr2& aMessage )
+    {
+    CLOG_ENTERFN( "CConnectViaNoteNotif::StartL" );  
+
+    TPckgBuf<TConnUiUiDestConnMethodNoteId> input;
+    input.Copy( aBuffer );
+    TConnUiUiDestConnMethodNoteId info = input();
+    
+    iReplySlot = aReplySlot;
+    iMessage = aMessage;
+    iCancelled = EFalse;
+
+    iActiveNote = new( ELeave ) CActiveConnectViaNote( this, info );
+        
+    iActiveNote->LaunchActiveConnectViaNote();       
+    }
+
+// ---------------------------------------------------------
+// void CConnectViaNoteNotif::Cancel()
+// ---------------------------------------------------------
+//
+void CConnectViaNoteNotif::Cancel()
+    {
+    CLOG_ENTERFN( "CConnectViaNoteNotif::Cancel" );  
+
+    if ( !iCancelled )
+        {
+        iCancelled = ETrue;
+        if ( !iMessage.IsNull() )
+            {   // No need to return an error code, we are just completing!
+            CLOG_WRITEF( _L( "Completing CConnectViaNoteNotif with KErrNone" ) );
+            iMessage.Complete( KErrNone );
+            }
+        
+        delete iActiveNote;
+        iActiveNote = NULL;
+        }
+
+    CLOG_LEAVEFN( "CConnectViaNoteNotif::Cancel" );  
+    }
+
+// ---------------------------------------------------------
+// void CConnectViaNoteNotif::CompleteL( TInt aStatus )
+// ---------------------------------------------------------
+//
+void CConnectViaNoteNotif::CompleteL( TInt aStatus )
+    {    
+    CLOG_ENTERFN( "CConnectViaNoteNotif::CompleteL" );  
+    CLOG_WRITEF( _L( "aStatus: %d" ),  aStatus );
+
+    delete iActiveNote;
+    iActiveNote = NULL;
+    iCancelled = ETrue;    
+    if ( !iMessage.IsNull() )
+        {
+        CLOG_WRITEF( _L( "Completing CConnectViaNoteNotif with %d" ),  aStatus );
+        iMessage.Complete( aStatus );
+        }
+    CLOG_LEAVEFN( "CConnectViaNoteNotif::CompleteL" );  
+    }
+
+
+// ---------------------------------------------------------
+// CConnectViaNoteNotif* CConnectViaNoteNotif::NewL()
+// ---------------------------------------------------------
+//
+CConnectViaNoteNotif* CConnectViaNoteNotif::NewL( 
+                                        const TBool aResourceFileResponsible )
+    {
+    CConnectViaNoteNotif* self = new ( ELeave ) CConnectViaNoteNotif();
+    CleanupStack::PushL( self );
+    self->ConstructL( KResourceFileName, aResourceFileResponsible );
+    CleanupStack::Pop();
+    return self;
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/EasyWepDlgNotif.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,140 @@
+/*
+* 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:  Implementation of CEasyWepDlgNotif
+*
+*/
+
+
+// INCLUDE FILES
+#include "EasyWepDlgNotif.h"
+#include "WepWpaQueryDlg.h"
+#include "ConnUiUtilsNotif.h"
+
+#include <ConnUiUtilsNotif.rsg>
+#include <StringLoader.h>
+#include <featmgr.h>
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CEasyWepDlgNotif::TNotifierInfo CEasyWepDlgNotif::RegisterL()
+// ---------------------------------------------------------
+//
+CEasyWepDlgNotif::TNotifierInfo CEasyWepDlgNotif::RegisterL()
+    {
+    iInfo.iUid = KUidEasyWepDlg;
+    iInfo.iPriority = ENotifierPriorityHigh;
+    iInfo.iChannel = KUidEasyWepDlg;
+
+    return iInfo;
+    }
+
+// ---------------------------------------------------------
+// void CEasyWepDlgNotif::StartL
+// ---------------------------------------------------------
+//
+void CEasyWepDlgNotif::StartL( const TDesC8& /*aBuffer*/, 
+                                    TInt aReplySlot,
+                                    const RMessagePtr2& aMessage )
+    {
+    iReplySlot = aReplySlot;
+    iMessage = aMessage;
+    iCancelled = EFalse;
+
+    aMessage.ReadL( aReplySlot, iKey );
+
+    HBufC* msg = CCoeEnv::Static()->AllocReadResourceLC( 
+                                                    R_EASY_WEP_QUERY_TEXT );
+    iDialog = new ( ELeave ) CWepWpaQueryDlg( 
+                                            iKey().iKey, this, EDialogWep, iHex );
+    iDialog->SetPromptL( *msg );
+
+    TBool isWEP256Enabled = ETrue;
+    
+    FeatureManager::InitializeLibL();
+    isWEP256Enabled = FeatureManager::FeatureSupported( 
+                                                KFeatureIdWlanWep256Enabled );
+    FeatureManager::UnInitializeLib();
+
+    if ( isWEP256Enabled )
+        {
+        iDialog->SetMaxLength( KEasyWepQuery256BitMaxLength );
+        }
+    else
+        {
+        iDialog->SetMaxLength( KEasyWepQueryNon256BitMaxLength );
+        }
+
+    iDialog->ExecuteLD( R_EASY_WEP_WPA_DLG );
+    CleanupStack::PopAndDestroy( msg );
+    }
+
+// ---------------------------------------------------------
+// void CEasyWepDlgNotif::Cancel()
+// ---------------------------------------------------------
+//
+void CEasyWepDlgNotif::Cancel()
+    {
+    if ( !iCancelled )
+        {
+        iCancelled = ETrue;
+        if ( !iMessage.IsNull() )
+            {
+            iMessage.Complete( KErrCancel );
+            }
+        
+        delete iDialog;
+        iDialog = NULL;
+        }
+    }
+
+
+// ---------------------------------------------------------
+// void CEasyWepDlgNotif::CompleteL( TInt aStatus )
+// ---------------------------------------------------------
+//
+void CEasyWepDlgNotif::CompleteL( TInt aStatus )
+    {    
+    iCancelled = ETrue;
+    if ( !iMessage.IsNull() )
+        {
+        if ( aStatus == KErrNone )
+            {
+            iKey().iHex = iHex;
+            iMessage.WriteL( iReplySlot, iKey );
+            }
+
+        iMessage.Complete( aStatus );
+        }
+    Cancel(); // Temporary solution
+    }
+
+
+// ---------------------------------------------------------
+// CEasyWepDlgNotif* CEasyWepDlgNotif::NewL()
+// ---------------------------------------------------------
+//
+CEasyWepDlgNotif* CEasyWepDlgNotif::NewL( 
+                                        const TBool aResourceFileResponsible )
+    {
+    CEasyWepDlgNotif* self = new ( ELeave ) CEasyWepDlgNotif();
+    CleanupStack::PushL( self );
+    self->ConstructL( KResourceFileName, aResourceFileResponsible );
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/EasyWpaDlgNotif.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,121 @@
+/*
+* 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:  Implementation of CEasyWpaDlgNotif
+*
+*/
+
+
+// INCLUDE FILES
+#include "EasyWpaDlgNotif.h"
+#include "WepWpaQueryDlg.h"
+#include "ConnUiUtilsNotif.h"
+
+#include <ConnUiUtilsNotif.rsg>
+#include <StringLoader.h>
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CEasyWpaDlgNotif::TNotifierInfo CEasyWpaDlgNotif::RegisterL()
+// ---------------------------------------------------------
+//
+CEasyWpaDlgNotif::TNotifierInfo CEasyWpaDlgNotif::RegisterL()
+    {
+    iInfo.iUid = KUidEasyWpaDlg;
+    iInfo.iPriority = ENotifierPriorityHigh;
+    iInfo.iChannel = KUidEasyWpaDlg;
+
+    return iInfo;
+    }
+
+// ---------------------------------------------------------
+// void CEasyWpaDlgNotif::StartL
+// ---------------------------------------------------------
+//
+void CEasyWpaDlgNotif::StartL( const TDesC8& /*aBuffer*/, 
+                                    TInt aReplySlot,
+                                    const RMessagePtr2& aMessage )
+    {
+    iReplySlot = aReplySlot;
+    iMessage = aMessage;
+    iCancelled = EFalse;
+
+    aMessage.ReadL( aReplySlot, iKey );
+
+    HBufC* msg = CCoeEnv::Static()->AllocReadResourceLC( 
+                                                    R_EASY_WPA_QUERY_TEXT );
+    iDialog = new ( ELeave ) CWepWpaQueryDlg( iKey(), this, EDialogWpa, iHex );
+    iDialog->SetPromptL( *msg );
+    iDialog->SetMaxLength( KEasyWpaQueryMaxLength );
+    iDialog->ExecuteLD( R_EASY_WEP_WPA_DLG );
+    CleanupStack::PopAndDestroy( msg );
+    }
+
+// ---------------------------------------------------------
+// void CEasyWpaDlgNotif::Cancel()
+// ---------------------------------------------------------
+//
+void CEasyWpaDlgNotif::Cancel()
+    {
+    if ( !iCancelled )
+        {
+        iCancelled = ETrue;
+        if ( !iMessage.IsNull() )
+            {
+            iMessage.Complete( KErrCancel );
+            }
+        
+        delete iDialog;
+        iDialog = NULL;
+        }
+    }
+
+
+// ---------------------------------------------------------
+// void CEasyWpaDlgNotif::CompleteL( TInt aStatus )
+// ---------------------------------------------------------
+//
+void CEasyWpaDlgNotif::CompleteL( TInt aStatus )
+    {    
+    iCancelled = ETrue;
+    if ( !iMessage.IsNull() )
+        {
+        if ( aStatus == KErrNone )
+            {
+            iMessage.WriteL( iReplySlot, iKey );
+            }
+
+        iMessage.Complete( aStatus );
+        }
+    Cancel(); // Temporary solution
+    }
+
+
+// ---------------------------------------------------------
+// CEasyWpaDlgNotif* CEasyWpaDlgNotif::NewL()
+// ---------------------------------------------------------
+//
+CEasyWpaDlgNotif* CEasyWpaDlgNotif::NewL( 
+                                        const TBool aResourceFileResponsible )
+    {
+    CEasyWpaDlgNotif* self = new ( ELeave ) CEasyWpaDlgNotif();
+    CleanupStack::PushL( self );
+    self->ConstructL( KResourceFileName, aResourceFileResponsible );
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/NetworkInfoArray.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,218 @@
+/*
+* 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:  NetworkInfoArray contains and handles CNetworkInfoBase 
+*  and derived class instances
+*     
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "NetworkInfoArray.h"
+#include "ConnectionDialogsLogger.h"
+
+
+// CONSTANTS
+/**
+* Granularity of NetworkInfoArray array
+*/
+LOCAL_D const TUint KConnArrayGranularity = 3;
+
+
+// ================= MEMBER FUNCTIONS =======================
+// ---------------------------------------------------------
+// CNetworkInfoArray::CNetworkInfoArray
+// ---------------------------------------------------------
+//
+CNetworkInfoArray::CNetworkInfoArray()
+    {
+    }
+
+
+// ---------------------------------------------------------
+// CNetworkInfoArray::~CNetworkInfoArray
+// ---------------------------------------------------------
+//
+CNetworkInfoArray::~CNetworkInfoArray()
+    {
+    CLOG_ENTERFN( "CNetworkInfoArray::~CNetworkInfoArray" );  
+
+    if( iNetworkInfoArray )
+        {
+        iNetworkInfoArray->ResetAndDestroy();
+        }
+    delete iNetworkInfoArray;
+
+    CLOG_LEAVEFN( "CNetworkInfoArray::~CNetworkInfoArray" );  
+    }
+
+
+// ---------------------------------------------------------
+// CNetworkInfoArray::NewL
+// ---------------------------------------------------------
+//
+CNetworkInfoArray* CNetworkInfoArray::NewL()
+    {
+    CLOG_ENTERFN( "CNetworkInfoArray::NewL" );  
+
+    CNetworkInfoArray* self = new ( ELeave ) CNetworkInfoArray();
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    CLOG_LEAVEFN( "CNetworkInfoArray::NewL" );
+
+    return self;
+    }
+
+
+// ---------------------------------------------------------
+// CNetworkInfoArray::ConstructL
+// ---------------------------------------------------------
+//
+void CNetworkInfoArray::ConstructL()
+    {
+    CLOG_ENTERFN( "CNetworkInfoArray::ConstructL" );  
+
+    iNetworkInfoArray = new( ELeave )
+                    CArrayPtrFlat<CNetworkInfoBase>( KConnArrayGranularity );
+
+    CLOG_LEAVEFN( "CNetworkInfoArray::ConstructL" );
+    }
+
+
+// ---------------------------------------------------------
+// CNetworkInfoArray::MdcaCount
+// ---------------------------------------------------------
+//
+TInt  CNetworkInfoArray::MdcaCount() const
+    {
+    CLOG_WRITE( "CNetworkInfoArray::MdcaCount" );
+    CLOG_WRITEF( _L( "Count : %d" ),  iNetworkInfoArray->Count() );
+    return iNetworkInfoArray->Count();
+    }
+
+
+// ---------------------------------------------------------
+// CNetworkInfoArray::MdcaPoint
+// ---------------------------------------------------------
+//
+TPtrC CNetworkInfoArray::MdcaPoint( TInt aIndex ) const
+    {
+    CLOG_WRITEF( _L( "CNetworkInfoArray::MdcaPoint aIndex: %d" ),  aIndex );
+    return ( *iNetworkInfoArray )[aIndex]->GetNetworkListBoxItemText();
+    }
+
+
+// ---------------------------------------------------------
+// CNetworkInfoArray::GetArrayIndex
+// ---------------------------------------------------------
+//
+TInt CNetworkInfoArray::GetArrayIndex( TName aNetworkName ) const
+    {
+    CLOG_ENTERFN( "CNetworkInfoArray::GetArrayIndex" );
+
+    TBool found( EFalse );
+    TInt index( 0 );
+
+    while( ( index < iNetworkInfoArray->Count() ) && !found  )
+        {
+        if( ( *iNetworkInfoArray )[index]->NetworkName().Compare(
+                                                            aNetworkName ) )
+            {
+            ++index;
+            }
+        else
+            {
+            found = ETrue;
+            }
+        }
+
+    CLOG_LEAVEFN( "CNetworkInfoArray::GetArrayIndex" );  
+
+    return ( found ? index : KErrNotFound );
+    }
+
+
+// ---------------------------------------------------------
+// CNetworkInfoArray::AppendL
+// ---------------------------------------------------------
+//
+void CNetworkInfoArray::AppendL( CNetworkInfoBase* aNetwork )
+    {
+    CLOG_ENTERFN( "CNetworkInfoArray::AppendL " );
+
+    if ( aNetwork )
+        {
+        iNetworkInfoArray->AppendL( aNetwork );
+        }
+
+    CLOG_LEAVEFN( "CNetworkInfoArray::AppendL " );  
+    }
+
+
+// ---------------------------------------------------------
+// CNetworkInfoArray::Reset
+// ---------------------------------------------------------
+//
+void CNetworkInfoArray::Reset()
+    {
+    iNetworkInfoArray->ResetAndDestroy();
+    }
+
+
+// ---------------------------------------------------------
+// CNetworkInfoArray::operator[]
+// ---------------------------------------------------------
+//
+CNetworkInfoBase* CNetworkInfoArray::operator[]( TUint aIndex ) const
+    {
+    return ( *iNetworkInfoArray )[aIndex];
+    }
+
+
+// ---------------------------------------------------------
+// CNetworkInfoArray::At
+// ---------------------------------------------------------
+//
+CNetworkInfoBase* CNetworkInfoArray::At( TInt aIndex ) const
+    {
+    CLOG_ENTERFN( "CNetworkInfoArray::At " );
+
+    CNetworkInfoBase* temp = NULL;
+    if ( ( aIndex < iNetworkInfoArray->Count() ) && 
+         ( aIndex > KErrNotFound ) )
+        {
+        temp = ( *iNetworkInfoArray )[aIndex];
+        }
+
+    CLOG_LEAVEFN( "CNetworkInfoArray::At " );
+
+    return temp;
+    }
+
+
+// ---------------------------------------------------------
+// CNetworkInfoArray::Sort
+// ---------------------------------------------------------
+//    
+TInt CNetworkInfoArray::Sort( TKeyArrayFix& aKey )
+    {
+    return iNetworkInfoArray->Sort( aKey );
+    }
+    
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/NetworkInfoBase.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,130 @@
+/*
+* 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:  Base class of network info objects
+*     
+*
+*/
+
+
+// INCLUDE FILES
+#include <StringLoader.h>
+#include <ConnUiUtilsNotif.rsg>
+
+#include "NetworkInfoBase.h"
+#include "ConnUiUtilsNotif.hrh"
+#include "ConnectionDialogsLogger.h"
+
+
+// CONSTANTS
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CNetworkInfoBase::CNetworkInfoBase
+// ---------------------------------------------------------
+//
+CNetworkInfoBase::CNetworkInfoBase()
+: iOthersEntry( EFalse ),
+  iProtectedSetupSupported( EFalse )
+  
+    {
+    }
+
+
+// ---------------------------------------------------------
+// CNetworkInfoBase::~CNetworkInfoBase
+// ---------------------------------------------------------
+//
+CNetworkInfoBase::~CNetworkInfoBase()
+    {
+    }
+
+
+// ---------------------------------------------------------
+// CNetworkInfoBase::RefreshNetworksListBoxItemTextL
+// ---------------------------------------------------------
+//
+void CNetworkInfoBase::RefreshNetworksListBoxItemTextL()
+    {
+    CLOG_ENTERFN( "CNetworkInfoBase::RefreshNetworksListBoxItemTextL" );  
+
+    if ( iOthersEntry ) 
+        {
+        _LIT( KFormatNoIcons, "\t%S" );
+        HBufC *othersEntryBuf = StringLoader::LoadL( 
+                                                R_QTN_WLAN_MANUAL_SSID_INPUT );
+        iListBoxItemText.Format( KFormatNoIcons, othersEntryBuf );
+        delete othersEntryBuf;
+        }
+    else
+        {
+        _LIT( KFormatOneIcon, "%d\t%S\t%d" );
+        _LIT( KFormatTwoIcons, "%d\t%S\t%d\t%d" );
+            
+        TInt iconSignal;
+        TInt iconNetworkMode;
+    
+        if ( iSignalStrength > ESignalStrengthLow )
+            {
+            iconSignal = ECUUNotifIconLowSignal;
+            }
+        else if ( iSignalStrength < ESignalStrengthGood )
+            {
+            iconSignal = ECUUNotifIconGoodSignal;
+            }
+        else
+            {
+            iconSignal = ECUUNotifIconMediumSignal;
+            }   
+        
+        iconNetworkMode = ( iNetworkMode == ENetworkModeAdHoc ) ? 
+                            ECUUNotifIconAdHocNetwork : 
+                            ECUUNotifIconInfrastructureNetwork;
+        
+        if ( iProtectedSetupSupported )
+            {
+            CLOG_WRITE( "Protected Setup supported" );
+            iListBoxItemText.Format( KFormatTwoIcons,
+                                     iconNetworkMode, 
+                                     &iNetworkName,
+                                     iconSignal, 
+                                     ECUUNotifIconProtectedSetupSupported );
+            }
+        else
+            {
+            CLOG_WRITE( "Protected Setup not supported" );
+            
+     	    if ( iSecurityMode )
+            	{
+            	iListBoxItemText.Format( KFormatTwoIcons,
+                                     	iconNetworkMode, 
+                                     	&iNetworkName,
+                                     	iconSignal, 
+                                     	ECUUNotifIconSecureNetwork );
+	            }
+    	    else
+        	    {
+            	iListBoxItemText.Format( KFormatOneIcon,
+                	                     iconNetworkMode, 
+                    	                 &iNetworkName,
+                        	             iconSignal );                        
+            	}
+			}
+
+        }
+
+    CLOG_LEAVEFN( "CNetworkInfoBase::RefreshNetworksListBoxItemTextL" );  
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/NetworkInfoKey.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,85 @@
+/*
+* Copyright (c) 2002 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 CNetworkInfoKey.
+*
+*/
+
+
+// INCLUDE FILES
+#include "NetworkInfoKey.h"
+#include "NetworkInfoArray.h"
+#include "NetworkInfoBase.h"
+#include "ConnectionDialogsLogger.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+//
+// ---------------------------------------------------------
+// CNetworkInfoKey::CNetworkInfoKey()
+// ---------------------------------------------------------
+//
+CNetworkInfoKey::CNetworkInfoKey()
+: TKeyArrayFix( 0, ECmpNormal )
+    {
+    }
+
+
+// ---------------------------------------------------------
+// CNetworkInfoKey::~CNetworkInfoKey()
+// ---------------------------------------------------------
+//
+CNetworkInfoKey::~CNetworkInfoKey()
+    {
+    }
+
+
+// ---------------------------------------------------------
+// CNetworkInfoKey::SetPtr( CArrayPtrFlat<CNetworkInfoBase>* aPtr )
+// ---------------------------------------------------------
+//
+void CNetworkInfoKey::SetPtr( CNetworkInfoArray* aPtr )
+    {
+    CLOG_ENTERFN( "CNetworkInfoKey::SetPtr" );      
+    
+    iPtr = aPtr;
+
+    CLOG_LEAVEFN( "CNetworkInfoKey::SetPtr" );      
+    }
+
+
+// ---------------------------------------------------------
+// CNetworkInfoKey::Compare( TInt aLeft, TInt aRight ) const
+// ---------------------------------------------------------
+//
+TInt CNetworkInfoKey::Compare( TInt aLeft, TInt aRight ) const
+    {
+    CLOG_ENTERFN( "CNetworkInfoKey::Compare" );      
+    
+    TInt retval( 0 );
+
+    CNetworkInfoArray* array = ( CNetworkInfoArray* )iPtr;
+    retval = array->At( aLeft )->NetworkName().CompareC( 
+                                        array->At( aRight )->NetworkName() );
+
+    CLOG_WRITEF( _L( "aLeft %d" ), aLeft );  
+    CLOG_WRITEF( _L( "aRight %d" ), aRight );      
+    CLOG_WRITEF( _L( "retval %d" ), retval );  
+        
+    CLOG_LEAVEFN( "CNetworkInfoKey::Compare" );          
+
+    return retval;
+    }    
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/NoteDlgSuppressingSwitch.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2002 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 CNoteDlgSuppressingSwitch.
+*
+*/
+
+
+// INCLUDE FILES
+#include "NoteDlgSuppressingSwitch.h"
+
+#include <uikon/eiksrvui.h>
+
+
+// ================= MEMBER FUNCTIONS =======================
+//
+// ---------------------------------------------------------
+// CNoteDlgSuppressingSwitch::CNoteDlgSuppressingSwitch
+// ---------------------------------------------------------
+//
+CNoteDlgSuppressingSwitch::CNoteDlgSuppressingSwitch( CEikDialog** aSelfPtr )
+: CAknNoteDialog( aSelfPtr )
+    {
+    }
+
+
+// ---------------------------------------------------------
+// CNoteDlgSuppressingSwitch::~CNoteDlgSuppressingSwitch
+// ---------------------------------------------------------
+//
+CNoteDlgSuppressingSwitch::~CNoteDlgSuppressingSwitch()
+    {
+    STATIC_CAST( CEikServAppUi*, 
+                CCoeEnv::Static()->AppUi() )->SuppressAppSwitching( EFalse );
+    }
+
+
+// ---------------------------------------------------------
+// CNoteDlgSuppressingSwitch::PreLayoutDynInitL()
+// ---------------------------------------------------------
+//
+void CNoteDlgSuppressingSwitch::PreLayoutDynInitL()
+    {
+    CAknNoteDialog::PreLayoutDynInitL();
+
+    STATIC_CAST( CEikServAppUi*, 
+                CCoeEnv::Static()->AppUi() )->SuppressAppSwitching( ETrue );
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/OfflineWlanDisabledNoteNotif.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,125 @@
+/*
+* 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:  Implementation of COfflineWlanDisabledNoteNotif
+*
+*/
+
+
+// INCLUDE FILES
+#include "OfflineWlanDisabledNoteNotif.h"
+#include "ActiveOfflineWlanDisabledNote.h"
+#include "ConnectionUiUtilitiesCommon.h"
+#include "ConnUiUtilsNotif.h"
+
+    
+// ---------------------------------------------------------
+// COfflineWlanDisabledNoteNotif::COfflineWlanDisabledNoteNotif()
+// ---------------------------------------------------------
+//
+COfflineWlanDisabledNoteNotif::COfflineWlanDisabledNoteNotif()
+: CConnectionDialogsNotifBase(), 
+  iActiveNote( NULL )
+    {    
+    }    
+
+
+// ---------------------------------------------------------
+// COfflineWlanDisabledNoteNotif* COfflineWlanDisabledNoteNotif::NewL()
+// ---------------------------------------------------------
+//
+COfflineWlanDisabledNoteNotif* COfflineWlanDisabledNoteNotif::NewL( 
+                                        const TBool aResourceFileResponsible )
+    {
+    COfflineWlanDisabledNoteNotif* self = 
+                                new (ELeave) COfflineWlanDisabledNoteNotif();
+    CleanupStack::PushL( self );
+    self->ConstructL( KResourceFileName, aResourceFileResponsible );
+    CleanupStack::Pop();
+
+    return self;
+    }    
+    
+
+// ---------------------------------------------------------
+// COfflineWlanDisabledNoteNotif::TNotifierInfo 
+//                                   COfflineWlanDisabledNoteNotif::RegisterL()
+// ---------------------------------------------------------
+//
+COfflineWlanDisabledNoteNotif::TNotifierInfo 
+                                     COfflineWlanDisabledNoteNotif::RegisterL()
+    {
+    iInfo.iUid = KUidCOfflineWlanDisabledNoteDlg;
+    iInfo.iPriority = ENotifierPriorityVHigh;
+    iInfo.iChannel = KUidCOfflineWlanDisabledNoteDlg;
+
+    return iInfo;
+    }
+
+
+// ---------------------------------------------------------
+// void COfflineWlanDisabledNoteNotif::StartL()
+// ---------------------------------------------------------
+//
+void COfflineWlanDisabledNoteNotif::StartL( const TDesC8& /*aBuffer*/, 
+                                              TInt aReplySlot,
+                                              const RMessagePtr2& aMessage )
+    {
+    iReplySlot = aReplySlot;
+    iMessage = aMessage;
+    iCancelled = EFalse;
+            
+    iActiveNote = new( ELeave ) CActiveOfflineWlanDisabledNote( this );
+    iActiveNote->LaunchOfflineWlanDisabledNote();       
+    }
+
+    
+// ---------------------------------------------------------
+// void COfflineWlanDisabledNoteNotif::CompleteL( TInt aStatus )
+// ---------------------------------------------------------
+//
+void COfflineWlanDisabledNoteNotif::CompleteL( TInt aStatus )
+    {    
+    delete iActiveNote;
+    iActiveNote = NULL;
+    
+    iCancelled = ETrue;
+    if ( !iMessage.IsNull() )
+        {
+        iMessage.Complete( aStatus );
+        }
+    Cancel();
+    }    
+
+
+// ---------------------------------------------------------
+// void COfflineWlanDisabledNoteNotif::Cancel()
+// ---------------------------------------------------------
+//
+void COfflineWlanDisabledNoteNotif::Cancel()
+    {
+    if ( !iCancelled )
+        {
+        iCancelled = ETrue;
+        if ( !iMessage.IsNull() )
+            {
+            iMessage.Complete( KErrCancel );
+            }
+        
+        delete iActiveNote;
+        iActiveNote = NULL;
+        }
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/OfflineWlanNoteDlg.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,113 @@
+/*
+* 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:  Implementation of class COfflineWlanNoteDlg.
+*
+*/
+
+
+// INCLUDE FILES
+#include "OfflineWlanNoteDlg.h"
+#include "OfflineWlanNoteNotif.h"
+#include "ExpiryTimer.h"
+#include <uikon/eiksrvui.h>
+
+
+
+// CONSTANTS
+#if defined(_DEBUG)
+_LIT( KErrNullPointer, "NULL pointer" );
+#endif
+
+
+// ================= MEMBER FUNCTIONS =======================
+//
+// ---------------------------------------------------------
+// COfflineWlanNoteDlg::COfflineWlanNoteDlg
+// ---------------------------------------------------------
+//
+COfflineWlanNoteDlg::COfflineWlanNoteDlg( COfflineWlanNoteNotif* aNotif )
+: iNotif( aNotif )    
+    {
+    }
+    
+    
+// ---------------------------------------------------------
+// COfflineWlanNoteDlg::~COfflineWlanNoteDlg
+// ---------------------------------------------------------
+//
+COfflineWlanNoteDlg::~COfflineWlanNoteDlg()
+    {
+    STATIC_CAST( CEikServAppUi*, 
+                CCoeEnv::Static()->AppUi() )->SuppressAppSwitching( EFalse );
+    delete iExpiryTimer;
+    }
+
+
+
+// ---------------------------------------------------------
+// COfflineWlanNoteDlg::OkToExitL
+// ---------------------------------------------------------
+//
+TBool COfflineWlanNoteDlg::OkToExitL( TInt aButtonId )
+    {
+    TInt status = KErrCancel;
+    if (aButtonId == EAknSoftkeyYes || aButtonId == EAknSoftkeyDone || 
+        aButtonId == EAknSoftkeyOk )
+        {
+        status = KErrNone;
+        }
+
+    __ASSERT_DEBUG( iNotif, User::Panic( KErrNullPointer, KErrNone ) );
+    iNotif->CompleteL( status );
+
+    return ETrue;
+    }
+    
+    
+// ---------------------------------------------------------
+// COfflineWlanNoteDlg::PreLayoutDynInitL()
+// ---------------------------------------------------------
+//
+void COfflineWlanNoteDlg::PreLayoutDynInitL()
+    {
+    
+    CAknQueryDialog::PreLayoutDynInitL();
+
+    STATIC_CAST( CEikServAppUi*, 
+                CCoeEnv::Static()->AppUi() )->SuppressAppSwitching( ETrue );
+    iExpiryTimer = CExpiryTimer::NewL( *this );
+    iExpiryTimer->Start();
+    }
+
+// ---------------------------------------------------------
+// COfflineWlanNoteDlg::NeedToDismissQueryL
+// ---------------------------------------------------------
+//
+TBool COfflineWlanNoteDlg::NeedToDismissQueryL(const TKeyEvent& aKeyEvent)
+    {
+    if (aKeyEvent.iCode == EKeyPhoneSend)
+        {
+        TryExitL(EEikBidCancel);
+        return ETrue;
+        }
+        
+    return EFalse;
+    }
+
+
+void COfflineWlanNoteDlg::HandleTimedOut()
+    {
+    TRAP_IGNORE( TryExitL(EAknSoftkeyCancel) );
+    }
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/OfflineWlanNoteNotif.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,152 @@
+/*
+* 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:  Implementation of COfflineWlanNoteNotif.
+*
+*/
+
+
+// INCLUDE FILES
+#include "OfflineWlanNoteNotif.h"
+#include "OfflineWlanNoteDlg.h"
+#include "ConnectionUiUtilitiesCommon.h"
+#include "ConnUiUtilsNotif.h"
+#include "ConnectionDialogsLogger.h"
+
+#include <e32property.h>         // For RProperty 
+#include <UikonInternalPSKeys.h> // For KPSUidUikon and KUikGlobalNotesAllowed.
+#include <ConnUiUtilsNotif.rsg>
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// COfflineWlanNoteNotif::TNotifierInfo COfflineWlanNoteNotif::RegisterL()
+// ---------------------------------------------------------
+//
+COfflineWlanNoteNotif::TNotifierInfo COfflineWlanNoteNotif::RegisterL()
+    {
+    iInfo.iUid = KUidCOfflineWlanNoteDlg;
+    iInfo.iPriority = ENotifierPriorityHigh;
+    iInfo.iChannel = KUidCOfflineWlanNoteDlg;
+
+    return iInfo;
+    }
+
+// ---------------------------------------------------------
+// void COfflineWlanNoteNotif::StartL
+// ---------------------------------------------------------
+//
+void COfflineWlanNoteNotif::StartL( const TDesC8& aBuffer, 
+                                    TInt aReplySlot,
+                                    const RMessagePtr2& aMessage )
+    {
+    CLOG_ENTERFN( "COfflineWlanNoteNotif::StartL" );
+
+    TPckgBuf<TBool> asyncVersion;
+    asyncVersion.Copy( aBuffer );
+
+    iCancelled = EFalse;
+
+    // We are about to display the Offline note.
+    // Since this part of the code can be executed during the bootup, check if
+    // the UI has really started up to display notes/dialogs.
+    TInt notesAllowed = 0;
+    User::LeaveIfError ( RProperty::Get( KPSUidUikon, KUikGlobalNotesAllowed,
+                                        notesAllowed ) );
+
+    iReplySlot = aReplySlot;
+    iMessage = aMessage;
+
+    CLOG_WRITEF( _L( "notesAllowed : %d" ), notesAllowed );
+
+    if ( notesAllowed )
+        {
+        GetDialogL();
+        }
+    else if ( asyncVersion() )
+        {
+        CLOG_WRITE( "Completing with KErrNotReady" );
+        CompleteL( KErrNotReady );
+        }
+    else
+        {
+        CLOG_WRITE( "Leaving with KErrNotReady" );
+        iCancelled = ETrue;
+        User::Leave( KErrNotReady );
+        }
+    }
+
+// ---------------------------------------------------------
+// void COfflineWlanNoteNotif::Cancel()
+// ---------------------------------------------------------
+//
+void COfflineWlanNoteNotif::Cancel()
+    {
+    if ( !iCancelled )
+        {
+        iCancelled = ETrue;
+        if ( !iMessage.IsNull() )
+            {
+            iMessage.Complete( KErrCancel );
+            }
+        
+        delete iDialog;
+        iDialog = NULL;
+        }
+    }
+
+
+// ---------------------------------------------------------
+// void COfflineWlanNoteNotif::GetDialogL()
+// ---------------------------------------------------------
+//
+void COfflineWlanNoteNotif::GetDialogL()
+    {
+    iDialog = new ( ELeave ) COfflineWlanNoteDlg( this );
+    iDialog->ExecuteLD( R_QUERY_DIALOG );
+    }
+
+
+// ---------------------------------------------------------
+// void COfflineWlanNoteNotif::CompleteL( TInt aStatus )
+// ---------------------------------------------------------
+//
+void COfflineWlanNoteNotif::CompleteL( TInt aStatus )
+    {    
+    iCancelled = ETrue;
+    if ( !iMessage.IsNull() )
+        {
+        iMessage.Complete( aStatus );
+        }
+    Cancel();
+    }
+
+
+// ---------------------------------------------------------
+// COfflineWlanNoteNotif* COfflineWlanNoteNotif::NewL()
+// ---------------------------------------------------------
+//
+COfflineWlanNoteNotif* COfflineWlanNoteNotif::NewL( 
+                                        const TBool aResourceFileResponsible )
+    {
+    COfflineWlanNoteNotif* self = new ( ELeave ) COfflineWlanNoteNotif();
+    CleanupStack::PushL( self );
+    self->ConstructL( KResourceFileName, aResourceFileResponsible );
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/SelectWLANDlg.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,632 @@
+/*
+* Copyright (c) 2002 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 dialog CSelectWLANDlg from Connection Ui Utilities
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <AknIconArray.h>
+#include <AknsUtils.h>
+#include <AknIconUtils.h>
+#include <AknWaitDialog.h>
+#include <aknnotewrappers.h>
+#include <aknnotedialog.h>
+#include <connectionuiutilities.mbg>
+#include <ConnUiUtilsNotif.rsg>
+#include <StringLoader.h>
+#include <data_caging_path_literals.hrh>
+#include <uikon/eiksrvui.h>
+#include <utf.h>
+#include <AknGlobalNote.h>
+
+#include "ConnUiUtilsNotif.hrh"
+#include "SelectWLANDlg.h"
+#include "SelectWLanDlgPlugin.h"
+#include "ConnectionDialogsLogger.h"
+#include "NetworkInfoArray.h"
+#include "wlancoveragecheck.h"
+#include "ExpiryTimer.h"
+
+// CONSTANTS
+
+#if defined(_DEBUG)
+_LIT( KErrNullPointer, "NULL pointer" );
+#endif
+
+// ROM folder
+_LIT( KDriveZ, "z:" );
+
+// Name of the MBM file containing icons
+_LIT( KFileIcons, "ConnectionUiUtilities.mbm" );
+
+
+LOCAL_D const TInt KIconsGranularity = 4;
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// Constructor
+CSelectWLANDlg::CSelectWLANDlg( CSelectWLanDlgPlugin* aPlugin, TInt aIndex,
+                                CNetworkInfoArray* *const aNetworkArray )
+: CAknListQueryDialog( &aIndex ),
+  iPlugin( aPlugin ),
+  iNetworkArray( aNetworkArray ),
+  iFromOkToExit( EFalse )
+    {
+    }
+
+
+// Destructor
+CSelectWLANDlg::~CSelectWLANDlg()
+    {
+    CLOG_ENTERFN( "CSelectWLANDlg::~CSelectWLANDlg " ); 
+    STATIC_CAST( CEikServAppUi*, 
+                CCoeEnv::Static()->AppUi() )->SuppressAppSwitching( EFalse );
+    CLOG_LEAVEFN( "CSelectWLANDlg::~CSelectWLANDlg " );
+    delete iExpiryTimer;
+    }
+
+
+// ---------------------------------------------------------
+// CSelectWLANDlg::NewL
+// ---------------------------------------------------------
+//
+CSelectWLANDlg* CSelectWLANDlg::NewL( CSelectWLanDlgPlugin* aPlugin, 
+                                      CNetworkInfoArray* *const aNetworkArray )
+    {
+    CLOG_ENTERFN( "CSelectWLANDlg::NewL " );  
+    
+    CSelectWLANDlg* self = new ( ELeave )CSelectWLANDlg( aPlugin, 0, 
+                                                        aNetworkArray );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    CLOG_LEAVEFN( "CSelectWLANDlg::NewL " );  
+
+    return self;
+    }
+
+
+// ---------------------------------------------------------
+// CSelectWLANDlg::ConstructL
+// ---------------------------------------------------------
+//
+void CSelectWLANDlg::ConstructL()
+    {
+    }
+    
+// ---------------------------------------------------------
+// CSelectWLANDlg::PreLayoutDynInitL()
+// called by framework before dialog is shown
+// ---------------------------------------------------------
+//
+void CSelectWLANDlg::PreLayoutDynInitL()
+    {
+    CLOG_ENTERFN( "CSelectWLANDlg::PreLayoutDynInitL " );  
+    
+    CAknListQueryDialog::PreLayoutDynInitL();
+
+    SetIconsL();
+    
+    CLOG_WRITEF( _L( "iNetworkArray : %d" ),  *iNetworkArray );
+    
+    SetOwnershipType( ELbmOwnsItemArray );    
+    SetItemTextArray( *iNetworkArray );
+    SetOwnershipType( ELbmDoesNotOwnItemArray );
+
+    STATIC_CAST( CEikServAppUi*, 
+                CCoeEnv::Static()->AppUi() )->SuppressAppSwitching( ETrue );
+    
+    iExpiryTimer = CExpiryTimer::NewL( *this );
+    iExpiryTimer->Start();
+    
+    CLOG_LEAVEFN( "CSelectWLANDlg::PreLayoutDynInitL " );      
+    }    
+    
+    
+// ---------------------------------------------------------
+// CSelectWLANDlg::RefreshDialogL
+// ---------------------------------------------------------
+//    
+void CSelectWLANDlg::RefreshDialogL()
+    {  
+    CLOG_ENTERFN( "CSelectWLANDlg::RefreshDialogL " );  
+     
+    SetItemTextArray( *iNetworkArray );
+    ListBox()->HandleItemAdditionL();
+    
+    TInt current = ListBox()->CurrentItemIndex(); 
+    
+    if ( current == KErrNotFound )
+        {
+        // Highligt has been lost since the new list is
+        // shorter than the previous one. Set highligt to bottom.
+        TInt bottom = ListBox()->Model()->NumberOfItems()- 1;
+    	ListBox()->SetCurrentItemIndexAndDraw( bottom );
+        }  
+    
+    Layout();   
+    SizeChanged();
+    DrawNow();
+    
+    CLOG_LEAVEFN( "CSelectWLANDlg::RefreshDialogL " );  
+              
+    }
+
+// ---------------------------------------------------------
+// CSelectWLANDlg::OkToExitL( TInt aButtonId)
+// called by framework when the OK button is pressed
+// ---------------------------------------------------------
+//
+TBool CSelectWLANDlg::OkToExitL( TInt aButtonId )
+    {
+    CLOG_ENTERFN( "CSelectWLANDlg::OkToExitL " );  
+    
+    TBool result( EFalse );
+    if ( aButtonId == EAknSoftkeySelect || aButtonId == EAknSoftkeyOk )
+        {
+        __ASSERT_DEBUG( iPlugin, User::Panic( KErrNullPointer, KErrNone ) );
+        
+        iFromOkToExit = ETrue;
+        
+        TInt index = ListBox()->CurrentItemIndex();
+        CNetworkInfoBase* tempNetworkItem = ( **iNetworkArray )[index ];
+                
+        TWlanSsid sSID;
+        if ( tempNetworkItem->OthersEntry() )
+            {
+            CLOG_WRITE( "tempNetworkItem->OthersEntry()" );
+
+            iPlugin->StopTimer();
+            
+            HBufC* buff = HBufC::NewLC( KWlanMaxSsidLength );
+            TPtr16 ptr( buff->Des() );
+
+            CAknQueryDialog* dlg = 
+                        CAknQueryDialog::NewL( ptr, CAknQueryDialog::ENoTone );
+    
+            if ( dlg->ExecuteLD( R_WLAN_NAME_QUERY ) )
+                {
+                CLOG_WRITE( "dlg->ExecuteLD( R_WLAN_NAME_QUERY )" );
+
+                TWlanConnectionMode nMode;
+                TWlanConnectionSecurityMode sMode;
+                TWlanConnectionExtentedSecurityMode sExtMode;
+
+                sSID.Copy( buff->Des() );       
+                CleanupStack::PopAndDestroy( buff );
+
+                iPlugin->SetEasyWlanToHiddenL( ETrue ); 
+
+                TBool protSetupSupp;
+                if ( ScanForWlanNwL( sSID, nMode, sMode, sExtMode, protSetupSupp ) )
+                    {
+                    CLOG_WRITEF( _L( "Protected Setup in CSelectWLANDlg::OkToExitL: %d" ), protSetupSupp );
+                    CLOG_WRITE( "Setting prefs and completing" );
+
+                    iPlugin->SetNetworkPrefsL( sSID, nMode, sMode, 
+                                               sExtMode, protSetupSupp );
+                    iPlugin->CompleteL( KErrNone );
+                    }
+                else
+                    {
+                    HBufC* stringLabel = StringLoader::LoadLC( 
+                                                    R_INFO_NO_NETWORKS_FOUND );
+
+                    //RAknUiServer* globalNote = CAknSgcClient::AknSrv();
+                    //if ( globalNote->Handle() )
+                    //    {
+                    //    globalNote->ShowGlobalNoteL( *stringLabel, 
+                    //                            EAknGlobalInformationNote );
+                    //    }
+                        
+                    CAknGlobalNote* globalNote = CAknGlobalNote::NewLC();
+                    globalNote->ShowNoteL( EAknGlobalInformationNote, *stringLabel );
+                    CleanupStack::PopAndDestroy( globalNote );
+                        
+                    CleanupStack::PopAndDestroy( stringLabel );
+                    // set network prefs because we still need ssid
+
+                    iPlugin->SetNetworkPrefsL( sSID, nMode, sMode, 
+                                               sExtMode, protSetupSupp );
+                    iPlugin->CompleteL( KErrNotFound );
+                    }
+                }
+            else
+                {
+                CleanupStack::PopAndDestroy( buff );
+                iPlugin->CompleteL( KErrCancel );
+                }
+            }
+        else
+            {
+            iPlugin->SetEasyWlanToHiddenL( EFalse );
+  
+            //sSID.Copy( tempNetworkItem->NetworkName() );
+            CnvUtfConverter::ConvertFromUnicodeToUtf8( sSID, tempNetworkItem->NetworkName() );
+        
+            TWlanConnectionMode nMode = 
+                            ( TWlanConnectionMode )tempNetworkItem->NetworkMode();
+            TWlanConnectionSecurityMode sMode = tempNetworkItem->SecurityMode();
+            TWlanConnectionExtentedSecurityMode sExtMode = tempNetworkItem->ExtendedSecurityMode();
+            
+            // ADHOC is supported only with security modes: open and WEP.
+            if ( nMode == EWlanConnectionModeAdhoc && 
+                 ( sMode != EWlanConnectionSecurityOpen &&
+                   sMode != EWlanConnectionSecurityWep) )
+                {
+                ShowInfoNoteL( R_CONNUIUTILITIES_NOT_SUPPORTED );
+                CLOG_LEAVEFN( "CSelectWLANDlg::OkToExitL " );  
+                return EFalse;
+                }
+                
+            iPlugin->StopTimer();    
+
+            TBool protSetupSupp = tempNetworkItem->ProtectedSetupSupported();
+     
+            CLOG_WRITEF( _L( "Protected Setup in CSelectWLANDlg::OkToExitL: %d" ), protSetupSupp );
+            iPlugin->SetNetworkPrefsL( sSID, nMode, sMode, sExtMode, protSetupSupp );
+            iPlugin->CompleteL( KErrNone );
+            }
+        
+        result =  ETrue;
+        }
+    else if ( aButtonId == EAknSoftkeyCancel )
+        {
+        if ( iFromOkToExit )
+            {
+            // ssid query dialog is open
+            result =  EFalse; 
+            }
+        else
+            {
+            iFromOkToExit = ETrue;
+        
+            iPlugin->StopTimer();
+            iPlugin->CompleteL( KErrCancel );
+
+            result =  ETrue;    
+            }
+        }
+
+    CLOG_LEAVEFN( "CSelectWLANDlg::OkToExitL " );  
+
+    return result;
+    }
+
+
+// ---------------------------------------------------------
+// CSelectWLANDlg::SetIconsL()
+// ---------------------------------------------------------
+//
+void CSelectWLANDlg::SetIconsL()
+    {
+    // Don't change the order of the icons, or if anything should be 
+    // added/removed, then also enum TIconType in ConnUiUtilsNotif.hrh should 
+    // be updated!
+
+    CLOG_ENTERFN( "CSelectWLANDlg::SetIconsL " ); 
+    
+    CFbsBitmap* bitmap = NULL;
+    CFbsBitmap* mask = NULL;         
+    
+    CArrayPtr< CGulIcon >* icons = new( ELeave ) CAknIconArray( 
+                                                        KIconsGranularity );
+    CleanupStack::PushL( icons );
+
+    MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
+
+    TFileName iconsFileName;
+
+    iconsFileName.Append( KDriveZ );
+
+    iconsFileName.Append( KDC_APP_BITMAP_DIR );
+
+    iconsFileName.Append( KFileIcons );
+    
+    CLOG_WRITEF( _L( "iconsFileName : %S" ),  &iconsFileName );
+    
+    CGulIcon* icon = CGulIcon::NewLC();
+    
+    AknsUtils::CreateColorIconL( skinInstance, 
+                    KAknsIIDQgnIndiWlanSignalLowAdd, 
+                    KAknsIIDQsnIconColors, EAknsCIQsnIconColorsCG13, 
+                    bitmap, 
+                    mask, 
+                    iconsFileName,
+                    EMbmConnectionuiutilitiesQgn_indi_wlan_signal_low_add, 
+                    EMbmConnectionuiutilitiesQgn_indi_wlan_signal_low_add_mask,
+                    KRgbBlack );
+    icon->SetBitmap( bitmap );
+    icon->SetMask( mask );    
+    icons->AppendL( icon );
+                
+    CleanupStack::Pop( icon ); 
+
+    icon = CGulIcon::NewLC();
+    
+    AknsUtils::CreateColorIconL( skinInstance, 
+                    KAknsIIDQgnIndiWlanSignalMedAdd, 
+                    KAknsIIDQsnIconColors, EAknsCIQsnIconColorsCG13, 
+                    bitmap, 
+                    mask, 
+                    iconsFileName,
+                    EMbmConnectionuiutilitiesQgn_indi_wlan_signal_med_add, 
+                    EMbmConnectionuiutilitiesQgn_indi_wlan_signal_med_add_mask,
+                    KRgbBlack );
+    icon->SetBitmap( bitmap );
+    icon->SetMask( mask );    
+    icons->AppendL( icon );
+                
+    CleanupStack::Pop( icon );
+    
+    icon = CGulIcon::NewLC();
+    
+    AknsUtils::CreateColorIconL( skinInstance, 
+                KAknsIIDQgnIndiWlanSignalGoodAdd, 
+                KAknsIIDQsnIconColors, EAknsCIQsnIconColorsCG13, 
+                bitmap, 
+                mask, 
+                iconsFileName,
+                EMbmConnectionuiutilitiesQgn_indi_wlan_signal_good_add, 
+                EMbmConnectionuiutilitiesQgn_indi_wlan_signal_good_add_mask,
+                KRgbBlack );
+    icon->SetBitmap( bitmap );
+    icon->SetMask( mask );    
+    icons->AppendL( icon );
+                
+    CleanupStack::Pop( icon );     
+        
+    icon = CGulIcon::NewLC();
+    
+    AknsUtils::CreateColorIconL( skinInstance, 
+                KAknsIIDQgnIndiWlanSecureNetworkAdd, 
+                KAknsIIDQsnIconColors, EAknsCIQsnIconColorsCG13, 
+                bitmap, 
+                mask, 
+                iconsFileName,
+                EMbmConnectionuiutilitiesQgn_indi_wlan_secure_network_add, 
+                EMbmConnectionuiutilitiesQgn_indi_wlan_secure_network_add_mask,
+                KRgbBlack );
+    icon->SetBitmap( bitmap );
+    icon->SetMask( mask );    
+    icons->AppendL( icon );
+                
+    CleanupStack::Pop( icon );    
+       
+    AknIconUtils::CreateIconL( bitmap, mask, iconsFileName,
+                    EMbmConnectionuiutilitiesQgn_prop_snote_wlan_adhoc, 
+                    EMbmConnectionuiutilitiesQgn_prop_snote_wlan_adhoc_mask );
+                               
+    TInt err( KErrNone );
+    TRAP( err, icons->AppendL( CGulIcon::NewL( bitmap, mask ) ) );
+    if ( err )
+        {
+        delete bitmap;
+        delete mask;
+        User::Leave( err );
+        }
+    
+    
+    AknIconUtils::CreateIconL( bitmap, mask, iconsFileName,
+                    EMbmConnectionuiutilitiesQgn_prop_snote_wlan_infra, 
+                    EMbmConnectionuiutilitiesQgn_prop_snote_wlan_infra_mask );
+                               
+    TRAP( err, icons->AppendL( CGulIcon::NewL( bitmap, mask ) ) );
+    if ( err )
+        {
+        delete bitmap;
+        delete mask;
+        User::Leave( err );
+        }
+    
+    icon = CGulIcon::NewLC();
+    
+    AknsUtils::CreateColorIconL( skinInstance, 
+                KAknsIIDQgnIndiWifiProtectedAdd, 
+                KAknsIIDQsnIconColors, EAknsCIQsnIconColorsCG13, 
+                bitmap, 
+                mask, 
+                iconsFileName,
+                EMbmConnectionuiutilitiesQgn_indi_wifi_protected_add, 
+                EMbmConnectionuiutilitiesQgn_indi_wifi_protected_add,
+                KRgbBlack );
+    icon->SetBitmap( bitmap );
+    icon->SetMask( mask );    
+    icons->AppendL( icon );
+                
+    CleanupStack::Pop( icon );
+    
+    SetIconArrayL( icons );      
+
+    CleanupStack::Pop( icons );
+
+    CLOG_LEAVEFN( "CSelectWLANDlg::SetIconsL " );  
+    }
+
+// ----------------------------------------------------------------------------
+// void CSelectWLANDlg::HandleResourceChange( TInt aType )
+// Handle resource change events. 
+// ----------------------------------------------------------------------------
+//
+void CSelectWLANDlg::HandleResourceChange( TInt aType )
+    {
+    CLOG_ENTERFN( "CSelectWLANDlg::HandleResourceChange " );  
+    
+    if ( aType == KAknsMessageSkinChange )
+        {
+        CAknListQueryDialog::HandleResourceChange( aType );
+
+        TRAP_IGNORE( SetIconsL() );
+        SizeChanged();
+        }
+    else
+        {
+        if ( aType == KEikDynamicLayoutVariantSwitch )
+            {
+            TRect mainPaneRect;
+            AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane,
+                                               mainPaneRect );
+
+            TAknLayoutRect layoutRect;
+            layoutRect.LayoutRect( TRect( TPoint( 0, 0 ), 
+                                   mainPaneRect.Size() ),
+                                   AKN_LAYOUT_WINDOW_list_gen_pane( 0 ) );
+
+            ListBox()->SetRect( layoutRect.Rect() );
+            }
+
+        // Base call
+        CAknListQueryDialog::HandleResourceChange( aType );
+        }
+
+    CLOG_LEAVEFN( "CSelectWLANDlg::HandleResourceChange " );  
+    }
+         
+
+// --------------------------------------------------------------------------
+// CSelectWLANDlg::ScanForWlanNwL
+// --------------------------------------------------------------------------
+//
+TBool CSelectWLANDlg::ScanForWlanNwL( 
+#ifdef __WINS__
+                         TWlanSsid& /*aSsid*/, 
+                         TWlanConnectionMode& /*aConnectionMode*/,
+                         TWlanConnectionSecurityMode& /*aSecurityMode*/,
+                         TWlanConnectionExtentedSecurityMode& /*aExtSecurityMode*/,
+                         TBool& /*aProtectedSetupSupported*/ )
+#else
+                         TWlanSsid& aSsid, 
+                         TWlanConnectionMode& aConnectionMode,
+                         TWlanConnectionSecurityMode& aSecurityMode,
+                         TWlanConnectionExtentedSecurityMode& aExtSecurityMode,
+                         TBool& aProtectedSetupSupported )
+#endif  // __WINS__
+    {
+    CLOG_ENTERFN( "CSelectWLANDlg::ScanForWlanNwL" ); 
+    
+    TBool retVal ( EFalse );
+
+    DestroyWaitDialog();
+
+    CLOG_WRITE( "Creating WaitDialog..." );
+
+    iWaitDialog = new( ELeave )CAknWaitDialog
+                    ( REINTERPRET_CAST( CEikDialog**, &iWaitDialog ), ETrue );
+    iWaitDialog->ExecuteLD( R_SEARCHING_WLAN_WAIT_NOTE ); 
+
+#ifndef __WINS__
+    CWlanCoverageCheck* coverage = new( ELeave )CWlanCoverageCheck;
+    CleanupStack::PushL( coverage );
+
+    CLOG_WRITE( "Coverage created, calling ScanForPromptedSsidL, broadcast" );
+
+    retVal = coverage->ScanForPromptedSsidL( aSsid, ETrue, aConnectionMode, 
+                                             aSecurityMode,
+                                             aExtSecurityMode, 
+                                             aProtectedSetupSupported );
+    CLOG_WRITEF( _L( "Protected Setup in CSelectWLANDlg::ScanForWlanNwL_1: %d" ), aProtectedSetupSupported );
+    CLOG_WRITE( "ScanForPromptedSsidL returned" );
+    
+    if ( !retVal )
+        {
+        CLOG_WRITE( "Calling ScanForPromptedSsidL, direct" );
+        retVal = coverage->ScanForPromptedSsidL( aSsid, EFalse, 
+                                                 aConnectionMode, 
+                                                 aSecurityMode,
+                                                 aExtSecurityMode,
+                                                 aProtectedSetupSupported );
+    CLOG_WRITEF( _L( "Protected Setup in CSelectWLANDlg::ScanForWlanNwL_2: %d" ), aProtectedSetupSupported );
+    CLOG_WRITE( "ScanForPromptedSsidL returned" );
+        }
+
+    CleanupStack::PopAndDestroy( coverage );
+
+#endif  // __WINS
+
+    CLOG_WRITE( "Destroying WaitDialog..." );
+
+    DestroyWaitDialog();
+
+    return retVal;
+    }
+
+
+// ---------------------------------------------------------
+// CSelectWLANDlg::DestroyWaitDialog()
+// ---------------------------------------------------------
+//
+void CSelectWLANDlg::DestroyWaitDialog()
+    {
+    CLOG_ENTERFN( "CSelectWLANDlg::DestroyWaitDialog " );
+
+    delete iWaitDialog;
+    iWaitDialog = NULL;
+    }
+
+// ---------------------------------------------------------
+// CSelectWLANDlg::OfferKeyEventL
+// ---------------------------------------------------------
+//
+TKeyResponse CSelectWLANDlg::OfferKeyEventL( const TKeyEvent& aKeyEvent, 
+                                             TEventCode aType)
+    {
+    if( NeedToDismissQueryL(aKeyEvent) )
+        {
+        return EKeyWasConsumed;
+        }
+ 	
+    return CAknListQueryDialog::OfferKeyEventL(aKeyEvent,aType);
+    }
+    
+// ---------------------------------------------------------
+// CSelectWLANDlg::NeedToDismissQueryL
+// ---------------------------------------------------------
+//
+TBool CSelectWLANDlg::NeedToDismissQueryL(const TKeyEvent& aKeyEvent)
+    {
+    if (aKeyEvent.iCode == EKeyPhoneSend)
+        {
+        TryExitL(EEikBidCancel);
+        return ETrue;
+        }
+        
+    return EFalse;
+    }
+
+// ---------------------------------------------------------
+// CSelectWLANDlg::ShowInfoNoteL
+// ---------------------------------------------------------
+//
+void CSelectWLANDlg::ShowInfoNoteL( TInt aResId )
+    {
+    HBufC* stringLabel = StringLoader::LoadL( aResId, iEikonEnv );
+    CleanupStack::PushL( stringLabel );
+
+    CAknInformationNote* dialog = new ( ELeave )CAknInformationNote( ETrue );
+    dialog->ExecuteLD( *stringLabel );
+
+    CleanupStack::PopAndDestroy( stringLabel );   // stringLabel
+    }
+
+void CSelectWLANDlg::HandleTimedOut()
+    {
+    TRAP_IGNORE( TryExitL(EAknSoftkeyCancel) );
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/SelectWLanDlgPlugin.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,265 @@
+/*
+* 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:  Implementation of CSelectWLanDlgPlugin
+*
+*/
+
+
+// INCLUDE FILES
+#include "SelectWLanDlgPlugin.h"
+#include "SelectWLANDlg.h"
+
+#include "ActiveSelectWLanDlgPlugin.h"
+#include "ConnectionDialogsLogger.h"
+#include "ConnUiUtilsNotif.h"
+
+#include <e32property.h>         // For RProperty 
+#include <UikonInternalPSKeys.h> // For KPSUidUikon and KUikGlobalNotesAllowed.
+
+#include <cmmanager.h>
+#include <cmmanagerext.h>
+#include <cmconnectionmethod.h>
+#include <cmpluginwlandef.h>
+
+
+// ================= MEMBER FUNCTIONS =======================  
+
+// ---------------------------------------------------------
+// CSelectWLanDlgPlugin CSelectWLanDlgPlugin()
+// ---------------------------------------------------------
+//
+CSelectWLanDlgPlugin::CSelectWLanDlgPlugin() 
+: CConnectionDialogsNotifBase(), 
+  iActivePlugin( NULL )
+    {
+    }
+
+
+// ---------------------------------------------------------
+// CSelectWLanDlgPlugin* CSelectWLanDlgPlugin::NewL()
+// ---------------------------------------------------------
+//
+CSelectWLanDlgPlugin* CSelectWLanDlgPlugin::NewL( 
+                                        const TBool aResourceFileResponsible )
+    {
+    CSelectWLanDlgPlugin* self = new (ELeave) CSelectWLanDlgPlugin();
+    CleanupStack::PushL( self );
+    self->ConstructL( KResourceFileName, aResourceFileResponsible );
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+
+// ---------------------------------------------------------
+// CSelectWLanDlgPlugin::TNotifierInfo CSelectWLanDlgPlugin::RegisterL()
+// ---------------------------------------------------------
+//
+CSelectWLanDlgPlugin::TNotifierInfo CSelectWLanDlgPlugin::RegisterL()
+    {
+    iInfo.iUid = KUidSelectWLanDlg;
+    iInfo.iPriority = ENotifierPriorityHigh;
+    iInfo.iChannel = KUidSelectWLanDlg;
+
+    return iInfo;
+    }
+
+// ---------------------------------------------------------
+// void CSelectWLanDlgPlugin::StartL()
+// ---------------------------------------------------------
+//
+void CSelectWLanDlgPlugin::StartL( const TDesC8& aBuffer, TInt aReplySlot,
+                                   const RMessagePtr2& aMessage )
+    {
+    CLOG_ENTERFN( "CSelectWLanDlgPlugin::StartL " );  
+    
+    TPckgBuf<TBool> asyncVersion;
+    asyncVersion.Copy( aBuffer );
+
+    iCancelled = EFalse;
+    
+    // We are about to display the Offline note.
+    // Since this part of the code can be executed during the bootup, check if
+    // the UI has really started up to display notes/dialogs.
+    TInt notesAllowed = 0;
+    User::LeaveIfError ( RProperty::Get( KPSUidUikon, KUikGlobalNotesAllowed,
+                                        notesAllowed ) );
+
+    iReplySlot = aReplySlot;
+    iMessage = aMessage;
+
+    if ( notesAllowed )
+        {
+        aMessage.ReadL( aReplySlot, iNetworkPrefs );
+    
+        TInt err( KErrNone );
+        TRAP( err, iActivePlugin = CActiveSelectWLanDlgPlugin::NewL( this ) ); 
+        if ( err )
+            {
+            delete iActivePlugin;
+            iActivePlugin = NULL;
+            iCancelled = ETrue; 
+            User::Leave( err );           
+            }
+        
+        iActivePlugin->StartSearchWlanNetworkL(); 
+        CLOG_LEAVEFN( "CSelectWLanDlgPlugin::StartL " );  
+        }
+    else if ( asyncVersion() )
+        {
+        CLOG_WRITE( "Completing with KErrNotReady" );
+        CompleteL( KErrNotReady );
+        }
+    else
+        {
+        iCancelled = ETrue; 
+        User::Leave( KErrNotReady );
+        }
+    }
+
+// ---------------------------------------------------------
+// void CSelectWLanDlgPlugin::Cancel()
+// ---------------------------------------------------------
+//
+void CSelectWLanDlgPlugin::Cancel()
+    {
+    CLOG_ENTERFN( "CSelectWLanDlgPlugin::Cancel " );  
+    
+    if ( !iCancelled )
+        {
+        iCancelled = ETrue;
+        if ( !iMessage.IsNull() )
+            {
+            iMessage.Complete( KErrCancel );
+            }
+        
+        delete iActivePlugin;
+        iActivePlugin = NULL;
+        }   
+    CLOG_LEAVEFN( "CSelectWLanDlgPlugin::Cancel " );  
+                     
+    }
+
+// ---------------------------------------------------------
+// void CSelectWLanDlgPlugin::CompleteL( TInt aStatus )
+// ---------------------------------------------------------
+//
+void CSelectWLanDlgPlugin::CompleteL( TInt aStatus )
+    {
+    CLOG_ENTERFN( "CSelectWLanDlgPlugin::CompleteL " );  
+    
+    if ( ( ( aStatus == KErrNone ) || ( aStatus == KErrNotFound ) ) && !iMessage.IsNull() )
+        {
+        HBufC* ssid16 = HBufC::NewLC( iNetworkPrefs().iSsId.Length() );
+        ssid16->Des().Copy( iNetworkPrefs().iSsId ); 
+        CLOG_WRITEF( _L( "iSSID : %S" ), ssid16 );    
+        CleanupStack::PopAndDestroy( ssid16 );
+        CLOG_WRITEF( _L( "iCntMode : %d" ), iNetworkPrefs().iNetworkMode );
+        CLOG_WRITEF( _L( "iSecurityMode : %d" ), iNetworkPrefs().iSecMode );
+    
+        iMessage.WriteL( iReplySlot, iNetworkPrefs );
+        }
+
+    CLOG_WRITEF( _L( "aStatus in CompleteL: %d" ), aStatus );
+
+    delete iActivePlugin;
+    iActivePlugin = NULL;        
+
+    iCancelled = ETrue;
+    if ( !iMessage.IsNull() )
+        {
+        iMessage.Complete( aStatus );
+        }
+    Cancel();
+    
+    CLOG_LEAVEFN( "CSelectWLanDlgPlugin::CompleteL " );  
+    }
+    
+// ---------------------------------------------------------
+// void CSelectWLanDlgPlugin::StopTimer
+// ---------------------------------------------------------
+//    
+void CSelectWLanDlgPlugin::StopTimer()
+    {
+    CLOG_ENTERFN( "CSelectWLanDlgPlugin::StopTimer " );  
+    
+    iActivePlugin->Cancel();  
+
+    CLOG_LEAVEFN( "CSelectWLanDlgPlugin::StopTimer " );  
+      
+    }
+    
+    
+// ---------------------------------------------------------
+// void CSelectWLanDlgPlugin::SetNetworkPrefsL
+// ---------------------------------------------------------
+//
+void CSelectWLanDlgPlugin::SetNetworkPrefsL( TWlanSsid& aSSID,
+                      TWlanConnectionMode& aConnectionMode,
+                      TWlanConnectionSecurityMode& aSecurityMode,
+                      TWlanConnectionExtentedSecurityMode& aExtSecurityMode,
+                      TBool& aProtectedSetupSupported )
+    {
+    CLOG_ENTERFN( "CSelectWLanDlgPlugin::SetNetworkPrefsL " );  
+    iNetworkPrefs().iSsId = aSSID;
+    iNetworkPrefs().iNetworkMode = aConnectionMode;
+    iNetworkPrefs().iSecMode = aSecurityMode;
+    iNetworkPrefs().iExtSecMode = aExtSecurityMode;
+    iNetworkPrefs().iProtectedSetupSupported = aProtectedSetupSupported;
+          
+    HBufC* ssid16 = HBufC::NewLC( aSSID.Length() );
+    ssid16->Des().Copy( aSSID ); 
+    CLOG_WRITEF( _L( "aSSID : %S" ), ssid16 );    
+    CleanupStack::PopAndDestroy( ssid16 );
+    CLOG_WRITEF( _L( "aConnectionMode : %d" ),  aConnectionMode );    
+    CLOG_WRITEF( _L( "aSecurityMode : %d" ),  aSecurityMode );
+    CLOG_WRITEF( _L( "aExtSecurityMode : %d" ),  aExtSecurityMode );             
+     
+    CLOG_LEAVEFN( "CSelectWLanDlgPlugin::SetNetworkPrefsL " );
+    }
+
+
+// ---------------------------------------------------------
+// void CSelectWLanDlgPlugin::SetEasyWlanToHiddenL()
+// ---------------------------------------------------------
+//
+void CSelectWLanDlgPlugin::SetEasyWlanToHiddenL( const TBool aValue )
+    {
+    CLOG_ENTERFN( "CSelectWLanDlgPlugin::SetEasyWlanToHiddenL" );
+
+    RCmManagerExt cmManagerExt;
+    cmManagerExt.OpenL();
+    CleanupClosePushL( cmManagerExt );
+
+    TUint32 easyWlanId = cmManagerExt.EasyWlanIdL();
+    CLOG_WRITEF( _L( "easyWlanId %d" ), easyWlanId );
+   
+    if ( easyWlanId )
+        {
+        RCmConnectionMethodExt cmConnMethodExt;
+        cmConnMethodExt = cmManagerExt.ConnectionMethodL( easyWlanId );
+        CleanupClosePushL( cmConnMethodExt );
+
+        cmConnMethodExt.SetBoolAttributeL( CMManager::EWlanScanSSID, aValue );
+        cmConnMethodExt.UpdateL();
+
+        CleanupStack::PopAndDestroy(); // cmConnMethodExt;
+        }
+
+    CleanupStack::PopAndDestroy(); // cmManagerExt
+
+    CLOG_LEAVEFN( "CSelectWLanDlgPlugin::SetEasyWlanToHiddenL" );
+    }
+    
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/WLANNetworkUnavailableNoteNotif.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,124 @@
+/*
+* 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:  Implementation of CWLANNetworkUnavailableNoteNotif.
+*
+*/
+
+
+// INCLUDE FILES
+#include "WLANNetworkUnavailableNoteNotif.h"
+#include "ActiveWLANNetworkUnavailableNote.h"
+#include "ConnUiUtilsNotif.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CWLANNetworkUnavailableNoteNotif::TNotifierInfo 
+//                               CWLANNetworkUnavailableNoteNotif::RegisterL()
+// ---------------------------------------------------------
+//
+CWLANNetworkUnavailableNoteNotif::TNotifierInfo 
+                                 CWLANNetworkUnavailableNoteNotif::RegisterL()
+    {
+    iInfo.iUid = KUidWLANNetworkUnavailableNoteDlg;
+    iInfo.iPriority = ENotifierPriorityVHigh;
+    iInfo.iChannel = KUidWLANNetworkUnavailableNoteDlg;
+
+    return iInfo;
+    }
+
+
+// ---------------------------------------------------------
+// void CWLANNetworkUnavailableNoteNotif::StartL()
+// ---------------------------------------------------------
+//
+void CWLANNetworkUnavailableNoteNotif::StartL( const TDesC8& /*aBuffer*/, 
+                                              TInt aReplySlot,
+                                              const RMessagePtr2& aMessage )
+    {
+    iReplySlot = aReplySlot;
+    iMessage = aMessage;
+    iCancelled = EFalse;
+            
+    iActiveNote = new( ELeave ) CActiveWLANNetworkUnavailableNote( this );
+        
+    iActiveNote->LaunchWLANNetworkUnavailable( 
+                    CActiveWLANNetworkUnavailableNote::EWlanNote1 );       
+    }
+    
+// ---------------------------------------------------------
+// void CWLANNetworkUnavailableNoteNotif::CompleteL( TInt aStatus )
+// ---------------------------------------------------------
+//
+void CWLANNetworkUnavailableNoteNotif::CompleteL( TInt aStatus )
+    {    
+    delete iActiveNote;
+    iActiveNote = NULL;
+    
+    iCancelled = ETrue;
+    if ( !iMessage.IsNull() )
+        {
+        iMessage.Complete( aStatus );
+        }
+    Cancel();
+    }    
+
+// ---------------------------------------------------------
+// CWLANNetworkUnavailableNoteNotif* CWLANNetworkUnavailableNoteNotif::NewL()
+// ---------------------------------------------------------
+//
+CWLANNetworkUnavailableNoteNotif* CWLANNetworkUnavailableNoteNotif::NewL( 
+                                        const TBool aResourceFileResponsible )
+    {
+    CWLANNetworkUnavailableNoteNotif* self = 
+                            new( ELeave ) CWLANNetworkUnavailableNoteNotif();
+    CleanupStack::PushL( self );
+    self->ConstructL( KResourceFileName, aResourceFileResponsible );
+    CleanupStack::Pop();
+
+    return self;
+    }
+    
+
+// ---------------------------------------------------------
+// CWLANNetworkUnavailableNoteNotif::CWLANNetworkUnavailableNoteNotif()
+// ---------------------------------------------------------
+//
+CWLANNetworkUnavailableNoteNotif::CWLANNetworkUnavailableNoteNotif() 
+: CConnectionDialogsNotifBase(), 
+  iActiveNote( NULL )
+{    
+}    
+
+// ---------------------------------------------------------
+// void CWLANNetworkUnavailableNoteNotif::Cancel()
+// ---------------------------------------------------------
+//
+void CWLANNetworkUnavailableNoteNotif::Cancel()
+    {
+    if ( !iCancelled )
+        {
+        iCancelled = ETrue;
+        if ( !iMessage.IsNull() )
+            {
+            iMessage.Complete( KErrCancel );
+            }
+        
+        delete iActiveNote;
+        iActiveNote = NULL;
+        }
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/WepWpaQueryDlg.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,289 @@
+/*
+* 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:  Implementation of class WepWpaQueryDlg.
+*
+*/
+
+
+// INCLUDE FILES
+#include <aknnotewrappers.h>
+#include <StringLoader.h>
+#include <aknnotedialog.h>
+#include <ConnUiUtilsNotif.rsg>
+#include <uikon/eiksrvui.h>
+
+#include "WepWpaQueryDlg.h"
+#include "EasyWepDlgNotif.h"
+#include "EasyWpaDlgNotif.h"
+#include "ConnectionDialogsLogger.h"
+
+
+// CONSTANTS
+#if defined(_DEBUG)
+_LIT( KErrNullPointer, "NULL pointer" );
+#endif
+
+const TInt KEasyWpaQueryMinLength = 8;
+const TInt KEasyWpaQueryLengthHEX64 = 64;
+
+const TInt KEasyWapiQueryMinLength = 1; 
+
+// valid Wep key lengths
+const TInt KConnUiUtilsWepLengthASCII5 = 5;
+const TInt KConnUiUtilsWepLengthASCII13 = 13;
+const TInt KConnUiUtilsWepLengthASCII29 = 29;
+const TInt KConnUiUtilsWepLengthHEX10 = 10;
+const TInt KConnUiUtilsWepLengthHEX26 = 26;
+const TInt KConnUiUtilsWepLengthHEX58 = 58;
+
+// ================= MEMBER FUNCTIONS =======================
+//
+// ---------------------------------------------------------
+// CWepWpaQueryDlg::CWepWpaQueryDlg
+// ---------------------------------------------------------
+//
+CWepWpaQueryDlg::CWepWpaQueryDlg( TDes& aDataText, 
+                                  CConnectionDialogsNotifBase* aNotif, 
+                                  TDialogType aDialogType, 
+                                  TBool& aHex )
+: CAknTextQueryDialog( aDataText ),
+  iNotif( aNotif ), 
+  iDialogType( aDialogType ), 
+  iHex( aHex )
+    {
+    }
+
+
+void CWepWpaQueryDlg::ShowInfoNoteL( TInt aResId )
+    {
+    HBufC* stringLabel = StringLoader::LoadL( aResId, iEikonEnv );
+    CleanupStack::PushL( stringLabel );
+
+    CAknInformationNote* dialog = new ( ELeave )CAknInformationNote( ETrue );
+    dialog->ExecuteLD( *stringLabel );
+
+    CleanupStack::PopAndDestroy( stringLabel );   // stringLabel
+    }
+    
+    
+// ---------------------------------------------------------
+// CWepWpaQueryDlg::CWepWpaQueryDlg
+// ---------------------------------------------------------
+//
+CWepWpaQueryDlg::~CWepWpaQueryDlg()
+    {
+    STATIC_CAST( CEikServAppUi*, 
+                CCoeEnv::Static()->AppUi() )->SuppressAppSwitching( EFalse );
+    }
+
+
+// ---------------------------------------------------------
+// CWepWpaQueryDlg::PreLayoutDynInitL()
+// ---------------------------------------------------------
+//
+void CWepWpaQueryDlg::PreLayoutDynInitL()
+    {
+    
+    CAknTextQueryDialog::PreLayoutDynInitL();
+
+    STATIC_CAST( CEikServAppUi*, 
+                CCoeEnv::Static()->AppUi() )->SuppressAppSwitching( ETrue );
+
+    }
+
+// ---------------------------------------------------------
+// CWepWpaQueryDlg::OkToExitL
+// ---------------------------------------------------------
+//
+TBool CWepWpaQueryDlg::OkToExitL( TInt aButtonId )
+    {
+    TBool result = CAknTextQueryDialog::OkToExitL( aButtonId );
+    if ( result )
+        {
+        __ASSERT_DEBUG( iNotif, User::Panic( KErrNullPointer, KErrNone ) );
+        if ( aButtonId == EAknSoftkeyOk )
+            {
+            TInt length = Text().Length();
+            
+            if ( iDialogType == EDialogWpa )
+                {
+                if ( length < KEasyWpaQueryMinLength )
+                    {
+                    ShowInfoNoteL( R_INFO_PRESHARED_KEY_TOO_SHORT );
+                    result = EFalse;
+                    
+                    // Wpa only should be cleared
+                    CLOG_WRITE( "Wpa to be cleared!" );
+
+                    CAknQueryControl* control = QueryControl();
+                    if ( control )
+                        {
+                        control->SetTextL( KNullDesC );
+                        
+                        CCoeControl* coecontrol = 
+                             control->ControlByLayoutOrNull(  EMultiDataFirstEdwin );     
+        
+                        if( coecontrol )
+                            {
+                            CEikEdwin* edwin = static_cast<CEikEdwin*>( coecontrol );
+                            edwin->SetCursorPosL(0, EFalse);	
+                            }
+                        
+                        //control->DrawNow();
+                        }
+                    UpdateLeftSoftKeyL();
+                    }
+                else if ( length == KEasyWpaQueryLengthHEX64 )
+                    {
+                    TBool foundInvalid = EFalse;
+                    
+                    for ( TInt i = 0; i < length; i++ )
+                        {
+                        if ( ( ( Text()[ i ] < '0' ) || 
+                               ( Text()[ i ] > '9' ) ) &&
+                             ( ( Text()[ i ] < 'A' ) || 
+                               ( Text()[ i ] > 'F' ) ) && 
+                             ( ( Text()[ i ] < 'a' ) || 
+                               ( Text()[ i ] > 'f' ) ) )
+                            {
+                            foundInvalid = ETrue;
+                            break;
+                            }
+                        }
+                    
+                    if ( foundInvalid )
+                        {
+                        ShowInfoNoteL( R_INFO_PRESHARED_KEY_NOT_HEXS );   
+                        result = EFalse;
+                        }
+                    else
+                        {
+                        iNotif->CompleteL( KErrNone );
+                        }
+                    }
+                else
+                    {
+                    iNotif->CompleteL( KErrNone );
+                    }
+                }
+            else if ( iDialogType == EDialogWep )// Wep
+                {
+                if ( ( length == KConnUiUtilsWepLengthASCII5 ) ||
+                    ( length == KConnUiUtilsWepLengthASCII13 ) ||
+                    ( length == KConnUiUtilsWepLengthASCII29 ) )
+                    {
+                    iHex = EFalse;
+                    iNotif->CompleteL( KErrNone );
+                    }
+                else if ( ( length == KConnUiUtilsWepLengthHEX10 ) ||
+                    ( length == KConnUiUtilsWepLengthHEX26 ) ||
+                    ( length == KConnUiUtilsWepLengthHEX58 ) )
+                    {
+
+                    TBool foundInvalid = EFalse;
+                    for ( TInt i = 0; i < length; i++ )
+                        {
+                        if ( ( ( Text()[ i ] < '0' ) || 
+                               ( Text()[ i ] > '9' ) ) &&
+                             ( ( Text()[ i ] < 'A' ) || 
+                               ( Text()[ i ] > 'F' ) ) && 
+                             ( ( Text()[ i ] < 'a' ) || 
+                               ( Text()[ i ] > 'f' ) ) )
+                            {
+                            foundInvalid = ETrue;
+                            break;
+                            }
+                        }
+                    if ( foundInvalid )
+                        {
+                        ShowInfoNoteL( R_INFO_WEP_KEY_ILLEGAL_CHARS );   
+                        result = EFalse;
+                        }
+                    else
+                        {
+                        iHex = ETrue;
+                        iNotif->CompleteL( KErrNone );
+                        }
+                    }
+                else
+                    {
+                    ShowInfoNoteL( R_INFO_WEP_KEY_INVALID );        
+                    result = EFalse;
+                    }  
+                }
+            else // Wapi
+                {
+                if ( length < KEasyWapiQueryMinLength )
+                    {
+                    ShowInfoNoteL( R_INFO_PRESHARED_KEY_TOO_SHORT );
+                    result = EFalse;
+                    
+                    // Wpa only should be cleared
+                    CLOG_WRITE( "Wapi to be cleared!" );
+
+                    CAknQueryControl* control = QueryControl();
+                    
+                    if ( control )
+                        {
+                        control->SetTextL( KNullDesC );
+                        
+                        CCoeControl* coecontrol = 
+                             control->ControlByLayoutOrNull(  EMultiDataFirstEdwin );     
+        
+                        if( coecontrol )
+                            {
+                            CEikEdwin* edwin = static_cast<CEikEdwin*>( coecontrol );
+                            edwin->SetCursorPosL(0, EFalse);	
+                            }
+                        
+                        //control->DrawNow();
+                        }
+                    UpdateLeftSoftKeyL();
+                    }
+                else
+                    {
+                    iNotif->CompleteL( KErrNone );
+                    }    
+                }    
+            }
+        else
+            {
+            iNotif->CompleteL( KErrCancel );
+            return result;
+            }
+        }
+        
+    CLOG_WRITEF( _L( "result: %d" ), result );
+    CLOG_WRITEF( _L( "iDialogType: %d" ), iDialogType );
+
+    DrawNow();
+    return result;
+    }
+
+// ---------------------------------------------------------
+// CWepWpaQueryDlg::NeedToDismissQueryL
+// ---------------------------------------------------------
+//
+TBool CWepWpaQueryDlg::NeedToDismissQueryL(const TKeyEvent& aKeyEvent)
+    {
+    if (aKeyEvent.iCode == EKeyPhoneSend)
+        {
+        TryExitL(EEikBidCancel);
+        return ETrue;
+        }
+        
+    return EFalse;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/WlanNetworkDataProvider.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,364 @@
+/*
+* 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 class provides available wlan network array.
+*     
+*
+*/
+
+
+// INCLUDE FILES
+#include "WlanNetworkDataProvider.h"
+#include "NetworkInfoArray.h"
+#include "NetworkInfoBase.h"
+#include "NetworkInfoKey.h"
+#include "ConnectionDialogsLogger.h"
+
+#include <featmgr.h>
+#include <centralrepository.h>
+#include <CoreApplicationUIsSDKCRKeys.h> // KCRUidCoreApplicationUIs
+
+
+// CONSTANTS 
+
+/**
+* Management frame information element IDs.
+*/
+enum T802Dot11InformationElementID
+    {
+    E802Dot11SsidIE                 = 0,
+    E802Dot11SupportedRatesIE       = 1,
+    E802Doi11FhParameterSetIE       = 2,
+    E802Dot11DsParameterSetIE       = 3,
+    E802Dot11CfParameterSetIE       = 4,
+    E802Dot11TimIE                  = 5,
+    E802Dot11IbssParameterSetIE     = 6,
+    E802Dot11CountryIE              = 7,
+    E802Dot11HoppingPatternParamIE  = 8,
+    E802Dot11HoppingPatternTableIE  = 9,
+    E802Dot11RequestIE              = 10,
+
+    E802Dot11ChallengeTextIE        = 16,
+    // Reserved for challenge text extension 17 - 31
+    E802Dot11ErpInformationIE       = 42,
+    E802Dot11ExtendedRatesIE        = 50,
+    E802Dot11AironetIE              = 133,
+    E802Dot11ApIpAddressIE          = 149,
+    E802Dot11RsnIE                  = 221
+    };
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CWlanNetworkDataProvider::CWlanNetworkDataProvider
+// ---------------------------------------------------------
+//
+CWlanNetworkDataProvider::CWlanNetworkDataProvider() 
+: CBase()
+    {
+    }
+
+
+// ---------------------------------------------------------
+// CWlanNetworkDataProvider::~CWlanNetworkDataProvider
+// ---------------------------------------------------------
+//
+CWlanNetworkDataProvider::~CWlanNetworkDataProvider()
+    {
+    CLOG_ENTERFN( "CWlanNetworkDataProvider::~CWlanNetworkDataProvider" );
+    delete iNetworkInfoArray;
+
+#ifndef __WINS__
+    if  ( iWlanMgmt )
+        {
+        iWlanMgmt->CancelGetScanResults();
+        }
+    delete iWlanMgmt;
+    delete iScanInfo;
+#endif
+
+    CLOG_LEAVEFN( "CWlanNetworkDataProvider::~CWlanNetworkDataProvider" );
+    }
+
+
+// ---------------------------------------------------------
+// CWlanNetworkDataProvider::NewL
+// ---------------------------------------------------------
+//
+CWlanNetworkDataProvider* CWlanNetworkDataProvider::NewL()
+    {
+    CLOG_ENTERFN( "CWlanNetworkDataProvider::NewL" );  
+
+    CWlanNetworkDataProvider* self = new ( ELeave ) CWlanNetworkDataProvider();
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    CLOG_LEAVEFN( "CWlanNetworkDataProvider::NewL" );
+
+    return self;
+    }
+
+
+// ---------------------------------------------------------
+// CWlanNetworkDataProvider::CWlanNetworkDataProvider
+// ---------------------------------------------------------
+//
+void CWlanNetworkDataProvider::ConstructL()
+    {
+    CLOG_ENTERFN( "CWlanNetworkDataProvider::ConstructL" );
+
+#ifndef __WINS__
+    iWlanMgmt = CWlanMgmtClient::NewL();
+    iScanInfo = CWlanScanInfo::NewL();
+#endif // !__WINS__
+
+    iNetworkInfoArray = CNetworkInfoArray::NewL();
+
+    CLOG_LEAVEFN( "CWlanNetworkDataProvider::ConstructL" );
+    }
+
+
+// ---------------------------------------------------------
+// CWlanNetworkDataProvider::OnTimerExpiredL
+// ---------------------------------------------------------
+//
+void CWlanNetworkDataProvider::OnTimerExpiredL()
+    {
+    CLOG_ENTERFN( "CWlanNetworkDataProvider::OnTimerExpiredL" );
+
+    TBool hideOtherEntry( EFalse );
+
+    iNetworkInfoArray->Reset();
+
+#ifdef __WINS__
+
+    TBuf8<KWlanMaxSsidLength> ssid8_a( _L8( "Test SSID" ) );
+    TBuf8<KWlanMaxSsidLength> ssid8_c( _L8( "Another SSID" ) );
+    TInt rxLevel_a = ESignalStrengthMax;
+    TInt rxLevel_b = ESignalStrengthMin;
+    TInt rxLevel_c = ESignalStrengthMax;
+
+    AddNetworkL( ssid8_a, ( TSignalStrength )rxLevel_a, 
+                 ENetworkModeInfrastructure, EWlanConnectionSecurityWep,
+                 EWlanConnectionExtentedSecurityModeWepOpen,
+                 ETrue );
+    AddNetworkL( ssid8_a, ( TSignalStrength )rxLevel_b, 
+                 ENetworkModeInfrastructure, EWlanConnectionSecurityWep,
+                 EWlanConnectionExtentedSecurityModeWepOpen,
+                 ETrue );
+    AddNetworkL( ssid8_c, ( TSignalStrength )rxLevel_c, 
+                 ENetworkModeInfrastructure, EWlanConnectionSecurityWpa,
+                 EWlanConnectionExtentedSecurityModeWpa,
+                 ETrue );
+
+#else
+
+    TUint8 ieLen( 0 );
+    const TUint8* ieData;
+    TBuf8<KWlanMaxSsidLength> ssid8;
+    TUint8 rxLevel8( 0 );
+    TInt rxLevel( 0 );
+
+    for( iScanInfo->First(); !iScanInfo->IsDone(); iScanInfo->Next() )
+        {
+        User::LeaveIfError( iScanInfo->InformationElement( E802Dot11SsidIE, 
+                                                           ieLen, &ieData ) );
+        if( !IsHiddenSsid( ieLen, ieData ) )
+            {
+            rxLevel8 = iScanInfo->RXLevel();
+            rxLevel = static_cast< TInt >( rxLevel8 );
+
+            ssid8.Copy( ieData, ieLen );
+            AddNetworkL( ssid8, 
+                         ( TSignalStrength )rxLevel, 
+                         ( iScanInfo->Capability() & 
+                           E802Dot11CapabilityEssMask ) ?
+                            ENetworkModeInfrastructure : ENetworkModeAdHoc,
+                         iScanInfo->SecurityMode(),
+                         iScanInfo->ExtendedSecurityMode(),
+                         iScanInfo->IsProtectedSetupSupported()
+                          );
+            }
+        }
+
+    hideOtherEntry = IsPhoneOfflineL();
+
+#endif
+
+    SortNetworkInfoArrayL();
+
+    if ( !hideOtherEntry )
+        {
+        AddOthersEntryL();
+        }
+
+    CLOG_LEAVEFN( "CWlanNetworkDataProvider::OnTimerExpiredL" );      
+    }
+
+
+// ---------------------------------------------------------
+// CWlanNetworkDataProvider::SortNetworkInfoArray
+// ---------------------------------------------------------
+//    
+void CWlanNetworkDataProvider::SortNetworkInfoArrayL()
+    {
+    CLOG_ENTERFN( "CWlanNetworkDataProvider::SortNetworkInfoArrayL" );      
+
+    CNetworkInfoKey* networkInfoKey = new( ELeave ) CNetworkInfoKey();
+    networkInfoKey->SetPtr( iNetworkInfoArray );
+    CleanupStack::PushL( networkInfoKey );
+
+    // Sort returns KErrGeneral if stack overflow, otherwise, returns
+    // KErrNone. So we will Leave only if stack overflow,
+    // but than that really does not matter...
+    User::LeaveIfError( iNetworkInfoArray->Sort( *networkInfoKey ) );
+
+    CleanupStack::PopAndDestroy( networkInfoKey );
+
+    CLOG_LEAVEFN( "CWlanNetworkDataProvider::SortNetworkInfoArrayL" );
+    }
+
+
+#ifndef __WINS__
+// ---------------------------------------------------------
+// CWlanNetworkDataProvider::IsHiddenSsid
+// ---------------------------------------------------------
+//    
+TBool CWlanNetworkDataProvider::IsHiddenSsid( TUint aSsidLength, 
+                                              const TUint8* aSsid )
+    {
+    CLOG_ENTERFN( "CWlanNetworkDataProvider::IsHiddenSsid" );
+    
+    if ( !aSsidLength )
+        {
+        return ETrue;
+        }
+
+    const TUint8 CSPACE = 0x20; 
+    TBool result( ETrue );
+
+    TInt count( 0 );
+    TUint8 temp( 0x00 );
+    for ( TUint i( 0 ); i < aSsidLength; ++i )
+        {
+        temp = aSsid[i];
+        count += temp; // in hidden networks characters are: 0x00
+        result &= temp == CSPACE;
+
+        CLOG_WRITEF( _L( "temp %x" ), temp );
+        }
+
+    return ( !count || result );
+    }
+
+#endif // !__WINS__
+
+
+// ---------------------------------------------------------
+// CWlanNetworkDataProvider::AddNetworkL
+// ---------------------------------------------------------
+//
+void CWlanNetworkDataProvider::AddNetworkL( TDes8& aNetworkName, 
+                                   TSignalStrength aStrength, 
+                                   TNetworkMode aNetworkMode,
+                                   TWlanConnectionSecurityMode aSecurityMode,
+                                   TWlanConnectionExtentedSecurityMode aExtSecurityMode,
+                                   TBool aProtectedSetupSupported )
+    {
+    TBuf<KWlanMaxSsidLength> networkName16;
+    networkName16.Copy( aNetworkName );
+    TInt index = iNetworkInfoArray->GetArrayIndex( networkName16 );
+
+    // if not found
+    if ( index == KErrNotFound )
+        {
+        CNetworkInfoBase* networkInfoBase = new( ELeave )CNetworkInfoBase();
+
+        networkInfoBase->SetNetworkName( aNetworkName );
+        networkInfoBase->SetSignalStrength( aStrength );
+
+        networkInfoBase->SetNetworkMode( aNetworkMode );
+        networkInfoBase->SetSecurityMode( aSecurityMode );
+        networkInfoBase->SetExtendedSecurityMode( aExtSecurityMode );
+
+        networkInfoBase->SetOthersEntry( EFalse );
+        CLOG_WRITEF( _L( "Protected Setup in CWlanNetworkDataProvider::AddNetworkL: %d" ), aProtectedSetupSupported );
+        networkInfoBase->SetProtectedSetupSupported( 
+                                                    aProtectedSetupSupported );
+
+        CleanupStack::PushL( networkInfoBase );
+        networkInfoBase->RefreshNetworksListBoxItemTextL();
+
+        iNetworkInfoArray->AppendL( networkInfoBase );
+        CleanupStack::Pop( networkInfoBase );
+        }
+    else    // if found show highest strength
+        {
+        TSignalStrength signal = ( *iNetworkInfoArray )[index]->
+                                                            SignalStrength();
+        if ( signal )
+            {
+            ( *iNetworkInfoArray )[index]->SetSignalStrength( 
+                                                        signal < aStrength ?
+                                                        signal : aStrength );
+            }
+        }
+    }
+
+
+// ---------------------------------------------------------
+// CWlanNetworkDataProvider::AddOthersEntryL
+// ---------------------------------------------------------
+//    
+void CWlanNetworkDataProvider::AddOthersEntryL()
+    {
+    CNetworkInfoBase* networkInfoBase = new( ELeave )CNetworkInfoBase();
+    networkInfoBase->SetOthersEntry( ETrue );
+
+    CleanupStack::PushL( networkInfoBase );
+    networkInfoBase->RefreshNetworksListBoxItemTextL();
+
+    iNetworkInfoArray->AppendL( networkInfoBase );
+    CleanupStack::Pop( networkInfoBase );
+    }
+
+
+// ---------------------------------------------------------
+// CWlanNetworkDataProvider::IsPhoneOfflineL
+// 
+// Checks if phone is in offline mode or not.
+// Return ETrue if phone is in offline mode.
+// Return EFalse if phone is not in offline mode.
+// ---------------------------------------------------------
+//
+TBool CWlanNetworkDataProvider::IsPhoneOfflineL() const
+    {
+    if ( FeatureManager::FeatureSupported( KFeatureIdOfflineMode ) )
+        {
+        CRepository* repository = CRepository::NewLC( 
+                                                    KCRUidCoreApplicationUIs );
+        TInt connAllowed = 1;
+        repository->Get( KCoreAppUIsNetworkConnectionAllowed, connAllowed );
+        CleanupStack::PopAndDestroy();  // repository
+        if ( !connAllowed )
+            {
+            return ETrue;
+            }
+        }
+    return EFalse;
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/connectingviadiscreetpopup.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,227 @@
+/*
+ * 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 CConnectingViaDiscreetPopup.
+ *
+ */
+
+// INCLUDE FILES
+#include <avkon.hrh>
+#include <akndiscreetpopup.h>
+#include <aknsconstants.hrh>
+#include <StringLoader.h>
+#include <utf.h>
+
+#include <cmmanagerext.h>
+#include <cmconnectionmethod.h>
+#include <cmconnectionmethodext.h>
+#include <cmpluginwlandef.h>
+
+#include <connectionuiutilities.mbg>
+#include <ConnUiUtilsNotif.rsg>
+
+#include "connectingviadiscreetpopup.h"
+
+// Connection Manager UIDs
+const TUid KDiscreetPopupUid =
+    {
+    0x101F84D0
+    };
+const TUid KDiscreetPopupViewUid =
+    {
+    0x2
+    };
+// Path of the app's iconfile
+_LIT( KIconFileName, "\\resource\\apps\\connectionuiutilities.mif" );
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CConnectingViaDiscreetPopup::CConnectingViaDiscreetPopup
+// ---------------------------------------------------------
+//
+CConnectingViaDiscreetPopup::CConnectingViaDiscreetPopup(
+        CConnectingViaDiscreetPopupNotif* aNotif) :
+            CActive(EPriorityUserInput), // Standard priority
+            iNotif(aNotif), iBearerType(0),
+            iConnectionName(NULL), iPopupFlags(0)
+    {
+    }
+
+// ---------------------------------------------------------
+// CConnectingViaDiscreetPopup::NewLC
+// ---------------------------------------------------------
+//
+CConnectingViaDiscreetPopup* CConnectingViaDiscreetPopup::NewLC(
+        CConnectingViaDiscreetPopupNotif* aNotif)
+    {
+    CConnectingViaDiscreetPopup* self =
+            new (ELeave) CConnectingViaDiscreetPopup(aNotif);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------
+// CConnectingViaDiscreetPopup::NewL
+// ---------------------------------------------------------
+//
+CConnectingViaDiscreetPopup* CConnectingViaDiscreetPopup::NewL(
+        CConnectingViaDiscreetPopupNotif* aNotif)
+    {
+    CConnectingViaDiscreetPopup* self = CConnectingViaDiscreetPopup::NewLC(
+            aNotif);
+    CleanupStack::Pop(); // self;
+    return self;
+    }
+
+// ---------------------------------------------------------
+// CConnectingViaDiscreetPopup::ConstructL
+// ---------------------------------------------------------
+//
+void CConnectingViaDiscreetPopup::ConstructL()
+    {
+    CActiveScheduler::Add(this); // Add to scheduler
+    icmManager.OpenL();
+    }
+
+// ---------------------------------------------------------
+// CConnectingViaDiscreetPopup::~CConnectingViaDiscreetPopup
+// ---------------------------------------------------------
+//
+CConnectingViaDiscreetPopup::~CConnectingViaDiscreetPopup()
+    {
+    Cancel(); // Cancel any request, if outstanding
+    icmManager.Close();
+    // Delete instance variables if any
+    if (iConnectionName)
+        {
+        delete iConnectionName;
+        }
+    }
+
+// ---------------------------------------------------------
+// CConnectingViaDiscreetPopup::DoCancel
+// ---------------------------------------------------------
+//
+void CConnectingViaDiscreetPopup::DoCancel()
+    {
+    }
+
+// ---------------------------------------------------------
+// CConnectingViaDiscreetPopup::StartL
+// ---------------------------------------------------------
+//
+void CConnectingViaDiscreetPopup::StartL(TUint32 aIapId,
+        TBool aConnectionAlreadyActive)
+    {
+    Cancel(); // Cancel any request, just to be sure
+    iBearerType = 0;
+    delete iConnectionName;
+    iConnectionName = NULL;
+
+    if (!aConnectionAlreadyActive)
+        {
+        iPopupFlags = KAknDiscreetPopupDurationLong;
+        }
+
+    RCmConnectionMethod plugin;
+    CleanupClosePushL(plugin);
+    if (aIapId)
+        {
+        plugin = icmManager.ConnectionMethodL(aIapId);
+        iBearerType = plugin.GetIntAttributeL(CMManager::ECmBearerType);
+        TUint32 easyWLANIapId = icmManager.EasyWlanIdL();
+        if (easyWLANIapId != aIapId)
+            {
+            iConnectionName = plugin.GetStringAttributeL(CMManager::ECmName);
+            }
+        else
+            {
+            iConnectionName = plugin.GetStringAttributeL(CMManager::EWlanUsedSSID);
+            }
+        }
+    CleanupStack::PopAndDestroy(&plugin);
+
+    SetActive(); // Tell scheduler a request is active
+    iClientStatus = &iStatus;
+    User::RequestComplete(iClientStatus, KErrNone);
+    
+    // Complete client request before launching dialog
+    iNotif->SetCancelledFlag(ETrue);
+    iNotif->CompleteL(KErrNone);
+    }
+
+// ---------------------------------------------------------
+// CConnectingViaDiscreetPopup::RunL
+// ---------------------------------------------------------
+//
+void CConnectingViaDiscreetPopup::RunL()
+    {
+    if (iStatus == KErrNone)
+        {
+        TUint bitmapId = 0;
+        TUint maskId = 0;
+        if (iBearerType == KUidWlanBearerType)
+            {
+            bitmapId = EMbmConnectionuiutilitiesQgn_prop_wlan_bearer;
+            maskId = EMbmConnectionuiutilitiesQgn_prop_wlan_bearer_mask;
+            }
+        else
+            {
+            bitmapId = EMbmConnectionuiutilitiesQgn_prop_wml_gprs;
+            maskId = EMbmConnectionuiutilitiesQgn_prop_wml_gprs_mask;
+            }
+
+        // Load strings from resources
+        HBufC* stringText1 = StringLoader::LoadLC(
+                R_QTN_OCC_CONNECTING_DISCREET_POPUP_TEXT1);
+
+        HBufC* stringText2 = NULL;
+        if (iConnectionName)
+            {
+            stringText2 = StringLoader::LoadLC(
+                    R_QTN_OCC_CONNECTING_DISCREET_POPUP_TEXT2,
+                    *iConnectionName);
+            }
+        else
+            {
+            stringText2 = _L("''").AllocLC();
+            }
+
+        CAknDiscreetPopup::ShowGlobalPopupL(*stringText1, // first text row
+                *stringText2, // second text row
+                KAknsIIDDefault, // icon skin id
+                KIconFileName, // bitmap file path
+                bitmapId, // bitmap id
+                maskId, // mask id
+                iPopupFlags, // flags
+                0, // command id
+                NULL, // command observer
+                KDiscreetPopupUid, // application to be launched
+                KDiscreetPopupViewUid); // view to be activated
+        CleanupStack::PopAndDestroy(2);
+        }
+
+    // Cleanup
+    iNotif->Cancel();
+    }
+
+// ---------------------------------------------------------
+// CConnectingViaDiscreetPopup::RunError
+// ---------------------------------------------------------
+//
+TInt CConnectingViaDiscreetPopup::RunError(TInt aError)
+    {
+    return aError;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/connectingviadiscreetpopupnotif.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,126 @@
+/*
+ * 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:  Implementation of CConnectingViaDiscreetPopupNotif.
+ *
+ */
+
+// INCLUDE FILES
+#include "connectingviadiscreetpopupnotif.h"
+#include "connectingviadiscreetpopup.h"
+#include "ConnUiUtilsNotif.h"
+#include "ConnectionDialogsUidDefs.h"
+#include "ConnectionUiUtilitiesCommon.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CConnectingViaDiscreetPopupNotif::TNotifierInfo 
+//                               CConnectingViaDiscreetPopupNotif::RegisterL()
+// ---------------------------------------------------------
+//
+CConnectingViaDiscreetPopupNotif::TNotifierInfo CConnectingViaDiscreetPopupNotif::RegisterL()
+    {
+    iInfo.iUid = KUidConnectingViaDiscreetPopup;
+    iInfo.iPriority = ENotifierPriorityVHigh;
+    iInfo.iChannel = KUidConnectingViaDiscreetPopup;
+
+    return iInfo;
+    }
+
+// ---------------------------------------------------------
+// void CConnectingViaDiscreetPopupNotif::StartL()
+// ---------------------------------------------------------
+//
+void CConnectingViaDiscreetPopupNotif::StartL(const TDesC8& aBuffer,
+        TInt aReplySlot, const RMessagePtr2& aMessage)
+    {
+    if ( iActiveNote )
+        {
+        // Note is already active
+        aMessage.Complete( KErrNone );
+        return;
+        }
+    
+    iReplySlot = aReplySlot;
+    iMessage = aMessage;
+    iCancelled = ETrue;
+    iActiveNote = CConnectingViaDiscreetPopup::NewL(this);
+
+    TPckgBuf<TConnUiConnectingViaDiscreetPopup> data;
+    data.Copy(aBuffer);
+
+    iActiveNote->StartL( data().iIapId, data().iConnectionAlreadyActive );
+    iCancelled = EFalse;
+    }
+
+// ---------------------------------------------------------
+// void CConnectingViaDiscreetPopupNotif::CompleteL( TInt aStatus )
+// ---------------------------------------------------------
+//
+void CConnectingViaDiscreetPopupNotif::CompleteL(TInt aStatus)
+    {
+    iCancelled = ETrue;
+    if (!iMessage.IsNull())
+        {
+        iMessage.Complete(aStatus);
+        }
+    }
+
+// ---------------------------------------------------------
+// CConnectingViaDiscreetPopupNotif* CConnectingViaDiscreetPopupNotif::NewL()
+// ---------------------------------------------------------
+//
+CConnectingViaDiscreetPopupNotif* CConnectingViaDiscreetPopupNotif::NewL(
+        const TBool aResourceFileResponsible)
+    {
+    CConnectingViaDiscreetPopupNotif* self =
+            new (ELeave) CConnectingViaDiscreetPopupNotif();
+    CleanupStack::PushL(self);
+    self->ConstructL(KResourceFileName, aResourceFileResponsible);
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+// ---------------------------------------------------------
+// CConnectingViaDiscreetPopupNotif::CConnectingViaDiscreetPopupNotif()
+// ---------------------------------------------------------
+//
+CConnectingViaDiscreetPopupNotif::CConnectingViaDiscreetPopupNotif() :
+    CConnectionDialogsNotifBase(), iActiveNote(NULL)
+    {
+    }
+
+// ---------------------------------------------------------
+// void CConnectingViaDiscreetPopupNotif::Cancel()
+// ---------------------------------------------------------
+//
+void CConnectingViaDiscreetPopupNotif::Cancel()
+    {
+    if (!iCancelled)
+        {
+        iCancelled = ETrue;
+        if (!iMessage.IsNull())
+            {
+            iMessage.Complete(KErrCancel);
+            }
+        }
+    if ( iActiveNote )
+        {
+        delete iActiveNote;
+        iActiveNote = NULL;
+        }
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/connectionerrordiscreetpopup.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,430 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  Implementation of CConnectionErrorDiscreetPopup.
+ *
+ */
+
+// INCLUDE FILES
+#include "connectionerrordiscreetpopup.h"
+#include <akndiscreetpopup.h>
+#include <aknsconstants.hrh>
+#include <StringLoader.h>
+#include <cmmanagerext.h>
+#include <cmconnectionmethod.h>
+#include <cmconnectionmethodext.h>
+#include <cmpluginwlandef.h>
+#include <avkon.hrh>
+#include <connectionuiutilities.mbg>
+#include <ConnUiUtilsNotif.rsg>
+
+#ifdef _DEBUG
+#include <e32debug.h>
+#endif
+
+// Error code definitions are from these headers
+#include <wlanerrorcodes.h> // WLAN-specific error code definitions
+#include <in_iface.h>
+#include <etelpckt.h>       // GPRS-specific causes for Session Management
+#include <nd_err.h>         // NetDial errors
+#include <inet6err.h>       // IPv6 error constants
+#include <rmmcustomapi.h>
+
+// Errors in UI spec not found elsewhere
+const TInt KErrPDPMaxContextsReached = -6000;
+const TInt KErrDndNameNotFound = -5120;
+const TInt KErrGeneralConnection = -50000;
+const TInt KErrGenConnNoGPRSNetwork = -3609;
+
+// No discreet popup => Uid 0
+const TUid KDiscreetPopupUidNone =
+    {
+    0x0
+    };
+// Path of the app's iconfile
+_LIT( KIconFileName, "\\resource\\apps\\connectionuiutilities.mif" );
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CConnectionErrorDiscreetPopup::CConnectionErrorDiscreetPopup
+// ---------------------------------------------------------
+//
+CConnectionErrorDiscreetPopup::CConnectionErrorDiscreetPopup(
+        CConnectionErrorDiscreetPopupNotif* aNotif) :
+    CActive(EPriorityUserInput), // Standard priority
+            iNotif(aNotif), iErrorCode(KErrNone)
+    {
+    }
+
+// ---------------------------------------------------------
+// CConnectionErrorDiscreetPopup::NewLC
+// ---------------------------------------------------------
+//
+CConnectionErrorDiscreetPopup* CConnectionErrorDiscreetPopup::NewLC(
+        CConnectionErrorDiscreetPopupNotif* aNotif)
+    {
+    CConnectionErrorDiscreetPopup* self =
+            new (ELeave) CConnectionErrorDiscreetPopup(aNotif);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------
+// CConnectionErrorDiscreetPopup::NewL
+// ---------------------------------------------------------
+//
+CConnectionErrorDiscreetPopup* CConnectionErrorDiscreetPopup::NewL(
+        CConnectionErrorDiscreetPopupNotif* aNotif)
+    {
+    CConnectionErrorDiscreetPopup* self =
+            CConnectionErrorDiscreetPopup::NewLC(aNotif);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ---------------------------------------------------------
+// CConnectionErrorDiscreetPopup::ConstructL
+// ---------------------------------------------------------
+//
+void CConnectionErrorDiscreetPopup::ConstructL()
+    {
+    CActiveScheduler::Add(this); // Add to scheduler
+    icmManager.OpenL();
+    }
+
+// ---------------------------------------------------------
+// CConnectionErrorDiscreetPopup::~CConnectionErrorDiscreetPopup
+// ---------------------------------------------------------
+//
+CConnectionErrorDiscreetPopup::~CConnectionErrorDiscreetPopup()
+    {
+    Cancel(); // Cancel any request, if outstanding
+    icmManager.Close();
+    // Delete instance variables if any
+    }
+
+// ---------------------------------------------------------
+// CConnectionErrorDiscreetPopup::DoCancel
+// ---------------------------------------------------------
+//
+void CConnectionErrorDiscreetPopup::DoCancel()
+    {
+    }
+
+// ---------------------------------------------------------
+// CConnectionErrorDiscreetPopup::StartL
+// ---------------------------------------------------------
+//
+void CConnectionErrorDiscreetPopup::StartL(TUint32 aErrCode)
+    {
+    Cancel(); // Cancel any request, just to be sure
+
+    iErrorCode = aErrCode;
+
+    SetActive(); // Tell scheduler a request is active
+    iClientStatus = &iStatus;
+    User::RequestComplete(iClientStatus, KErrNone);
+
+    // Complete the note so client can continue its tasks
+    // immediately
+    iNotif->SetCancelledFlag(ETrue);
+    iNotif->CompleteL(KErrNone);
+    }
+
+// ---------------------------------------------------------
+// CConnectionErrorDiscreetPopup::RunL
+// ---------------------------------------------------------
+//
+void CConnectionErrorDiscreetPopup::RunL()
+    {
+    if (iStatus == KErrNone)
+        {
+        TInt text1 = 0;
+        TInt text2 = 0;
+        TInt bitmapId = 0;
+        TInt maskId = 0;
+        // Show only if error code can be resolved
+        if (ResolveErrorCode(text1, text2, bitmapId, maskId))
+            {
+            // Load strings from resources
+            HBufC* stringText1 = StringLoader::LoadLC(text1);
+            HBufC* stringText2 = StringLoader::LoadLC(text2);
+            CAknDiscreetPopup::ShowGlobalPopupL(*stringText1, // 1st text row
+                    *stringText2, // second text row
+                    KAknsIIDDefault, // icon skin id
+                    KIconFileName, // bitmap file path
+                    bitmapId, // bitmap id
+                    maskId, // mask id
+                    KAknDiscreetPopupDurationLong, // flags
+                    0, // command id
+                    NULL, // command observer
+                    KDiscreetPopupUidNone, // application to be launched
+                    KDiscreetPopupUidNone); // view to be activated
+
+            CleanupStack::PopAndDestroy(2, stringText1);
+            }
+        }
+
+    // Cleanup
+    iNotif->Cancel();
+    }
+
+// ---------------------------------------------------------
+// CConnectionErrorDiscreetPopup::RunError
+// ---------------------------------------------------------
+//
+TInt CConnectionErrorDiscreetPopup::RunError(TInt aError)
+    {
+    return aError;
+    }
+
+// ---------------------------------------------------------
+// CConnectionErrorDiscreetPopup::ResolveErrorCode
+// ---------------------------------------------------------
+//
+TInt CConnectionErrorDiscreetPopup::ResolveErrorCode(TInt& aText1,
+        TInt& aText2, TInt& aBitmap, TInt& aMask)
+    {
+    
+#ifdef _DEBUG
+    RDebug::Print( _L("CConnectionErrorDiscreetPopup::ResolveErrorCode - code %d"),
+            iErrorCode );
+#endif
+    
+    // Icons, which are resolved at the end
+    enum TIconType
+        {
+        EIconWlan, EIconCellular, EIconNone
+        };
+
+    // For most cases, icon is WLAN
+    TIconType icon = EIconWlan;
+
+    // For most cases, aText1 = "Connection failed"
+    aText1 = R_QTN_OCC_CONNECTION_FAILED_DISCREET_POPUP_TEXT1;
+
+    // Resolve aText1, aText2 and icon of error code.
+    // Groups are from OCC GUI spec 1.0
+    switch (iErrorCode)
+        {
+        
+        // Group 1
+        case KErrIfChangingPassword:
+            icon = EIconCellular;
+            // These were GPRS; fall through
+        case KErrWlanInternalError:
+            aText2 = R_QTN_OCC_INTERNAL_ERROR_DISCREET_POPUP_TEXT2;
+            break;
+
+        // Group 2
+        case KErrWlanNetworkNotFound:
+            aText2 = R_QTN_OCC_WLAN_NOT_FOUND_DISCREET_POPUP_TEXT2;
+            break;
+
+        // Group 3
+        case KErrGprsUserAuthenticationFailure:
+            icon = EIconCellular;
+        // These were GPRS; fall through
+        case KErrWlanOpenAuthFailed:
+        case KErrWlanSharedKeyAuthRequired:
+        case KErrWlanWpaAuthRequired:
+        case KErrWlanWpaAuthFailed:
+        case KErrWlan802dot1xAuthFailed:
+        case KErrWlanWpaCounterMeasuresActive:
+        case KErrWlanPskModeRequired:
+        case KErrWlanEapModeRequired:
+        case KErrWlanEapSimFailed:
+        case KErrWlanEapTlsFailed:
+        case KErrWlanEapPeapFailed:
+        case KErrWlanEapMsChapv2: // Is the same as KErrWlanEapMsChaPFailed
+        case KErrWlanEapAkaFailed:
+        case KErrWlanEapTtlsFailed:
+        case KErrWlanLeapFailed:
+        case KErrWlanEapGtcFailed:
+        case KErrWlanWpa2OnlyModeNotSupported:
+        case KErrWlanEapFastTunnelCompromiseError:
+        case KErrWlanEapFastUnexpextedTlvExhanged:
+        case KErrWlanEapFastNoPacNorCertsToAuthenticateWithProvDisabled:
+        case KErrWlanEapFastNoMatchingPacForAid:
+        case KErrWlanEapFastAuthFailed:
+        case KErrWlanEapFastPacStoreCorrupted:
+            aText2 = R_QTN_OCC_AUTH_ERROR_DISCREET_POPUP_TEXT2;
+            break;
+
+        // Group 4
+        case KErrWlanSharedKeyAuthFailed:
+        case KErrWlanIllegalWpaPskKey:
+        case KErrWlanIllegalEncryptionKeys:
+            aText2 = R_QTN_OCC_CHECK_KEY_DISCREET_POPUP_TEXT2;
+            break;
+
+        // Group 5
+        case KErrExitModemError:
+        case KErrExitLoginFail:
+        case KErrExitScriptTimeOut:
+        case KErrExitScriptError:
+        case KErrIfAuthenticationFailure:
+        case KErrIfAuthNotSecure:
+        case KErrIfAccountDisabled:
+        case KErrIfRestrictedLogonHours:
+        case KErrIfPasswdExpired:
+        case KErrIfNoDialInPermission:
+        case KErrGprsMissingorUnknownAPN:
+            icon = EIconCellular;
+            aText2 = R_QTN_OCC_CHECK_SETTINGS_DISCREET_POPUP_TEXT2;
+            break;
+
+        // Group 6
+        case KErrWlanSimNotInstalled:
+            aText2 = R_QTN_OCC_SIM_ERROR_DISCREET_POPUP_TEXT2;
+            break;
+
+        // Group 7
+        case KErrWlanNotSubscribed:
+        case KErrWlanAccessBarred:
+            aText2 = R_QTN_OCC_SERVICE_ERROR_DISCREET_POPUP_TEXT2;
+            break;
+
+        // Group 8
+        case KErrPermissionDenied:
+        case KErrWlanPasswordExpired:
+        case KErrWlanNoDialinPermissions:
+        case KErrWlanAccountDisabled:
+        case KErrWlanRestrictedLogonHours:
+        case KErrWlanServerCertificateExpired:
+        case KErrWlanCerficateVerifyFailed:
+        case KErrWlanNoUserCertificate:
+        case KErrWlanNoCipherSuite:
+        case KErrWlanUserRejected:
+        case KErrWlanUserCertificateExpired:
+            aText2 = R_QTN_OCC_ACCESS_ERROR_DISCREET_POPUP_TEXT2;
+            break;
+
+        // Group 9
+        case KErrPDPMaxContextsReached:
+            icon = EIconCellular;
+            // These were GPRS; fall through
+        case KErrWlanConnAlreadyActive:
+            aText2 = R_QTN_OCC_ALREADY_ACT_DISCREET_POPUP_TEXT2;
+            break;
+
+        // Group 10
+        case KErrWlanSignalTooWeak:
+            aText2 = R_QTN_OCC_WLAN_WEAK_DISCREET_POPUP_TEXT2;
+            break;
+
+        // Group 11
+        case KErrIfCallbackNotAcceptable:
+        case KErrIfDNSNotFound:
+        case KErrIfLRDBadLine:
+        case KErrNetUnreach:
+        case KErrHostUnreach:
+        case KErrNoProtocolOpt:
+        case KErrUrgentData:
+        case KErrInet6NoRoute:
+        case KErrDndNameNotFound:
+        case KErrGeneralConnection:
+        case KErrGprsMSCTemporarilyNotReachable:
+        case KErrGprsLlcOrSndcpFailure:
+        case KErrGprsInsufficientResources:
+        case KErrGprsActivationRejectedByGGSN:
+        case KErrPacketDataTsyInvalidAPN:
+            icon = EIconCellular;
+            // These were GPRS; fall through
+        case KErrWlanRoamingFailed:
+            aText2 = R_QTN_OCC_TRY_AGAIN_DISCREET_POPUP_TEXT2;
+            break;
+
+        // Group 12
+        case KErrGenConnNoGPRSNetwork:
+        case KErrGprsServicesNotAllowed:
+        case KErrGprsAndNonGprsServicesNotAllowed:
+        case KErrGprsMSIdentityCannotBeDerivedByTheNetwork:
+        case KErrGprsMSImplicitlyDetached:
+        case KErrGsmMMNetworkFailure:
+        case KErrGprsUnknownPDPAddress:
+        case KErrGprsActivationRejected:
+        case KErrGsmMMServiceOptionNotSubscribed:
+        case KErrGsmMMServiceOptionTemporaryOutOfOrder:
+        case KErrGprsNSAPIAlreadyUsed:
+        case KErrGprsQoSNotAccepted:
+        case KErrGprsReactivationRequested:
+            icon = EIconCellular;
+            aText2 = R_QTN_OCC_CONN_UNAVAILABLE_DISCREET_POPUP_TEXT2;
+            break;
+
+        // Group 13
+        case KErrWlanProtectedSetupDevicePasswordAuthFailure:
+        case KErrWlanProtectedSetupPINMethodNotSupported:
+        case KErrWlanProtectedSetupPBMethodNotSupported:
+            aText1 = R_QTN_OCC_CONFIG_FAILED_DISCREET_POPUP_TEXT1;
+            aText2 = R_QTN_OCC_AUTH_ERROR_DISCREET_POPUP_TEXT2;
+            break;
+
+        // Group 14
+        case KErrWlanProtectedSetupOOBInterfaceReadError:
+        case KErrWlanProtectedSetupDecryptionCRCFailure:
+        case KErrWlanProtectedSetup2_4ChannelNotSupported:
+        case KErrWlanProtectedSetup5_0ChannelNotSupported:
+        case KErrWlanProtectedSetupNetworkAuthFailure:
+        case KErrWlanProtectedSetupNoDHCPResponse:
+        case KErrWlanProtectedSetupFailedDHCPConfig:
+        case KErrWlanProtectedSetupIPAddressConflict:
+        case KErrWlanProtectedSetupCouldNotConnectToRegistrar:
+        case KErrWlanProtectedSetupMultiplePBCSessionsDetected:
+        case KErrWlanProtectedSetupRogueActivitySuspected:
+        case KErrWlanProtectedSetupDeviceBusy:
+        case KErrWlanProtectedSetupSetupLocked:
+        case KErrWlanProtectedSetupMessageTimeout:
+        case KErrWlanProtectedSetupRegistrationSessionTimeout:
+            aText1 = R_QTN_OCC_CONFIG_FAILED_DISCREET_POPUP_TEXT1;
+            aText2 = R_QTN_OCC_TRY_AGAIN_DISCREET_POPUP_TEXT2;
+            break;
+
+        // Skipped errors, for which popup is not shown.
+        case KErrNone:
+        case KErrConnectionTerminated:
+        case KErrDisconnected:
+        case KErrCancel:
+            return EFalse;
+
+        // For error values not specifically mapped to any error message
+        // the discreet pop-up #12 is used.
+        default:
+            aText2 = R_QTN_OCC_CONN_UNAVAILABLE_DISCREET_POPUP_TEXT2;
+            icon = EIconNone;
+            break;
+        }
+
+    // Resolve icon to aBitmap & aMask
+    switch (icon)
+        {
+        case EIconWlan:
+            aBitmap = EMbmConnectionuiutilitiesQgn_prop_wlan_bearer;
+            aMask = EMbmConnectionuiutilitiesQgn_prop_wlan_bearer_mask;
+            break;
+        case EIconCellular:
+            aBitmap = EMbmConnectionuiutilitiesQgn_prop_wml_gprs;
+            aMask = EMbmConnectionuiutilitiesQgn_prop_wml_gprs_mask;
+            break;
+        default:
+            ASSERT(icon == EIconNone);
+            aBitmap = -1;
+            aMask = -1;
+            break;
+        }
+
+    return ETrue;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/connectionerrordiscreetpopupnotif.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  Implementation of CConnectionErrorDiscreetPopupNotif.
+ *
+ */
+
+// INCLUDE FILES
+#include "connectionerrordiscreetpopupnotif.h"
+#include "connectionerrordiscreetpopup.h"
+#include "ConnUiUtilsNotif.h"
+#include "ConnectionDialogsUidDefs.h"
+#include "ConnectionUiUtilitiesCommon.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CConnectionErrorDiscreetPopupNotif::TNotifierInfo 
+//                               CConnectionErrorDiscreetPopupNotif::RegisterL()
+// ---------------------------------------------------------
+//
+CConnectionErrorDiscreetPopupNotif::TNotifierInfo 
+        CConnectionErrorDiscreetPopupNotif::RegisterL()
+    {
+    iInfo.iUid = KUidConnectionErrorDiscreetPopup;
+    iInfo.iPriority = ENotifierPriorityVHigh;
+    iInfo.iChannel = KUidConnectionErrorDiscreetPopup;
+
+    return iInfo;
+    }
+
+// ---------------------------------------------------------
+// void CConnectionErrorDiscreetPopupNotif::StartL()
+// ---------------------------------------------------------
+//
+void CConnectionErrorDiscreetPopupNotif::StartL( const TDesC8& aBuffer,
+        TInt aReplySlot, const RMessagePtr2& aMessage )
+    {
+    if ( iActiveNote )
+        {
+        // Note is already active
+        aMessage.Complete( KErrNone );
+        return;
+        }
+    iReplySlot = aReplySlot;
+    iMessage = aMessage;
+    iCancelled = EFalse;
+
+    iActiveNote = CConnectionErrorDiscreetPopup::NewL( this );
+
+    TPckgBuf<TUint32> data;
+    data.Copy( aBuffer );
+
+    iActiveNote->StartL( data() );
+    iCancelled = EFalse;
+    }
+
+// ---------------------------------------------------------
+// void CConnectionErrorDiscreetPopupNotif::CompleteL( TInt aStatus )
+// ---------------------------------------------------------
+//
+void CConnectionErrorDiscreetPopupNotif::CompleteL( TInt aStatus )
+    {
+    iCancelled = ETrue;
+    if ( !iMessage.IsNull() )
+        {
+        iMessage.Complete( aStatus );
+        }
+    }
+
+// ---------------------------------------------------------
+// CConnectionErrorDiscreetPopupNotif* 
+//        CConnectionErrorDiscreetPopupNotif::NewL()
+// ---------------------------------------------------------
+//
+CConnectionErrorDiscreetPopupNotif* CConnectionErrorDiscreetPopupNotif::NewL(
+        const TBool aResourceFileResponsible )
+    {
+    CConnectionErrorDiscreetPopupNotif* self =
+            new (ELeave) CConnectionErrorDiscreetPopupNotif();
+    CleanupStack::PushL( self );
+    self->ConstructL( KResourceFileName, aResourceFileResponsible );
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+// ---------------------------------------------------------
+// CConnectionErrorDiscreetPopupNotif::CConnectionErrorDiscreetPopupNotif()
+// ---------------------------------------------------------
+//
+CConnectionErrorDiscreetPopupNotif::CConnectionErrorDiscreetPopupNotif() :
+    CConnectionDialogsNotifBase(), iActiveNote( NULL )
+    {
+    }
+
+// ---------------------------------------------------------
+// void CConnectionErrorDiscreetPopupNotif::Cancel()
+// ---------------------------------------------------------
+//
+void CConnectionErrorDiscreetPopupNotif::Cancel()
+    {
+    if ( !iCancelled )
+        {
+        iCancelled = ETrue;
+        if ( !iMessage.IsNull() )
+            {
+            iMessage.Complete( KErrCancel );
+            }
+        }
+    if ( iActiveNote )
+        {
+        delete iActiveNote;
+        iActiveNote = NULL;
+        }
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/easywapidlgnotif.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,129 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Notier part for WAPI PSK query dialog
+*
+*/
+
+// INCLUDE FILES
+#include "easywapidlgnotif.h"
+#include "WepWpaQueryDlg.h"
+#include "ConnUiUtilsNotif.h"
+
+#include <ConnUiUtilsNotif.rsg>
+#include <StringLoader.h>
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CEasyWapiDlgNotif::TNotifierInfo CEasyWapiDlgNotif::RegisterL()
+// ---------------------------------------------------------
+//
+CEasyWapiDlgNotif::TNotifierInfo CEasyWapiDlgNotif::RegisterL()
+    {
+    iInfo.iUid      = KUidEasyWapiDlg;
+    iInfo.iPriority = ENotifierPriorityHigh;
+    iInfo.iChannel  = KUidEasyWapiDlg;
+
+    return iInfo;
+    }
+
+// ---------------------------------------------------------
+// void CEasyWapiDlgNotif::StartL
+// ---------------------------------------------------------
+//
+void CEasyWapiDlgNotif::StartL( const TDesC8&      /*aBuffer*/, 
+                                TInt                aReplySlot,
+                                const RMessagePtr2& aMessage )
+    {
+    iReplySlot = aReplySlot;
+    iMessage   = aMessage;
+    iCancelled = EFalse;
+
+    aMessage.ReadL( aReplySlot, iKey );
+
+    // Using the same dialog resource as WPA-PSK
+    HBufC* msg = CCoeEnv::Static()->AllocReadResourceLC( 
+                                       R_EASY_WPA_QUERY_TEXT );
+      
+    // Using the same dialog implementation as WEP/WPA                                   
+    iDialog = new ( ELeave ) CWepWpaQueryDlg( iKey(), 
+                                              this, 
+                                              EDialogWapi, 
+                                              iHex );
+    iDialog->SetPromptL( *msg );
+    iDialog->SetMaxLength( KEasyWapiQueryMaxLength );
+    
+    iDialog->ExecuteLD( R_EASY_WEP_WPA_DLG );
+    CleanupStack::PopAndDestroy( msg );
+    }
+
+// ---------------------------------------------------------
+// void CEasyWapiDlgNotif::Cancel()
+// ---------------------------------------------------------
+//
+void CEasyWapiDlgNotif::Cancel()
+    {
+    if ( !iCancelled )
+        {
+        iCancelled = ETrue;
+        
+        if ( !iMessage.IsNull() )
+            {
+            iMessage.Complete( KErrCancel );
+            }
+        
+        delete iDialog;
+        iDialog = NULL;
+        }
+    }
+
+
+// ---------------------------------------------------------
+// void CEasyWapiDlgNotif::CompleteL( TInt aStatus )
+// ---------------------------------------------------------
+//
+void CEasyWapiDlgNotif::CompleteL( TInt aStatus )
+    {    
+    iCancelled = ETrue;
+    
+    if ( !iMessage.IsNull() )
+        {
+        if ( aStatus == KErrNone )
+            {
+            iMessage.WriteL( iReplySlot, iKey );
+            }
+
+        iMessage.Complete( aStatus );
+        }
+    Cancel(); // Temporary solution
+    }
+
+
+// ---------------------------------------------------------
+// CEasyWapiDlgNotif* CEasyWapiDlgNotif::NewL()
+// ---------------------------------------------------------
+//
+CEasyWapiDlgNotif* CEasyWapiDlgNotif::NewL( 
+                                        const TBool aResourceFileResponsible )
+    {
+    CEasyWapiDlgNotif* self = new ( ELeave ) CEasyWapiDlgNotif();
+    CleanupStack::PushL( self );
+    self->ConstructL( KResourceFileName, aResourceFileResponsible );
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/nowlannetworksavailablenotif.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,133 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of CNoWLANNetworksAvailableNotif.
+*
+*/
+
+
+// INCLUDE FILES
+#include "nowlannetworksavailablenotif.h"
+#include "ActiveWLANNetworkUnavailableNote.h"
+#include "ConnUiUtilsNotif.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CNoWLANNetworksAvailableNotif::TNotifierInfo 
+//                 CNoWLANNetworksAvailableNotif::RegisterL()
+// ---------------------------------------------------------
+//
+CNoWLANNetworksAvailableNotif::TNotifierInfo 
+                   CNoWLANNetworksAvailableNotif::RegisterL()
+    {
+    iInfo.iUid      = KUidNoWLANNetworksAvailableNote;
+    iInfo.iPriority = ENotifierPriorityVHigh;
+    iInfo.iChannel  = KUidNoWLANNetworksAvailableNote;
+
+    return iInfo;
+    }
+
+
+// ---------------------------------------------------------
+// void CNoWLANNetworksAvailableNotif::StartL()
+// ---------------------------------------------------------
+//
+void CNoWLANNetworksAvailableNotif::StartL( const TDesC8& /*aBuffer*/, 
+                                            TInt aReplySlot,
+                                            const RMessagePtr2& aMessage )
+    {
+    if ( iActiveNote )
+        {
+        // Note is already active
+        aMessage.Complete( KErrNone );
+        return;
+        }
+    
+    iReplySlot = aReplySlot;
+    iMessage   = aMessage;
+    iCancelled = EFalse;
+            
+    iActiveNote = new( ELeave ) CActiveWLANNetworkUnavailableNote( this );
+        
+    iActiveNote->LaunchWLANNetworkUnavailable( 
+                   CActiveWLANNetworkUnavailableNote::EWlanNote2 );       
+    }
+    
+// ---------------------------------------------------------
+// void CNoWLANNetworksAvailableNotif::CompleteL( TInt aStatus )
+// ---------------------------------------------------------
+//
+void CNoWLANNetworksAvailableNotif::CompleteL( TInt aStatus )
+    {    
+    delete iActiveNote;
+    iActiveNote = NULL;
+    
+    iCancelled = ETrue;
+    
+    if ( !iMessage.IsNull() )
+        {
+        iMessage.Complete( aStatus );
+        }
+    Cancel();
+    }    
+
+// ---------------------------------------------------------
+// CNoWLANNetworksAvailableNotif* CNoWLANNetworksAvailableNotif::NewL()
+// ---------------------------------------------------------
+//
+CNoWLANNetworksAvailableNotif* CNoWLANNetworksAvailableNotif::NewL( 
+                                        const TBool aResourceFileResponsible )
+    {
+    CNoWLANNetworksAvailableNotif* self = 
+                            new( ELeave ) CNoWLANNetworksAvailableNotif();
+    CleanupStack::PushL( self );
+    self->ConstructL( KResourceFileName, aResourceFileResponsible );
+    CleanupStack::Pop();
+
+    return self;
+    }
+    
+
+// ---------------------------------------------------------
+// CNoWLANNetworksAvailableNotif::CNoWLANNetworksAvailableNotif()
+// ---------------------------------------------------------
+//
+CNoWLANNetworksAvailableNotif::CNoWLANNetworksAvailableNotif() 
+: CConnectionDialogsNotifBase(), 
+  iActiveNote( NULL )
+{    
+}    
+
+// ---------------------------------------------------------
+// void CNoWLANNetworksAvailableNotif::Cancel()
+// ---------------------------------------------------------
+//
+void CNoWLANNetworksAvailableNotif::Cancel()
+    {
+    if ( !iCancelled )
+        {
+        iCancelled = ETrue;
+        
+        if ( !iMessage.IsNull() )
+            {
+            iMessage.Complete( KErrCancel );
+            }
+        
+        delete iActiveNote;
+        iActiveNote = NULL;
+        }
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/wlancoveragecheck.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,257 @@
+/*
+* 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 WLAN Coverage Check class
+*
+*/
+
+
+#include <wlanmgmtclient.h>
+
+#include "wlancoveragecheck.h"
+#include "NetworkInfoBase.h"
+#include "ConnectionDialogsLogger.h"
+
+
+/**
+* Management frame information element IDs.
+* needed to determine coverage
+*/
+enum T802Dot11InformationElementID
+    {
+    E802Dot11SsidIE                 = 0,
+    E802Dot11SupportedRatesIE       = 1,
+    E802Doi11FhParameterSetIE       = 2,
+    E802Dot11DsParameterSetIE       = 3,
+    E802Dot11CfParameterSetIE       = 4,
+    E802Dot11TimIE                  = 5,
+    E802Dot11IbssParameterSetIE     = 6,
+    E802Dot11CountryIE              = 7,
+    E802Dot11HoppingPatternParamIE  = 8,
+    E802Dot11HoppingPatternTableIE  = 9,
+    E802Dot11RequestIE              = 10,
+
+    E802Dot11ChallengeTextIE        = 16,
+    // Reserved for challenge text extension 17 - 31
+    E802Dot11ErpInformationIE       = 42,
+    E802Dot11ExtendedRatesIE        = 50,
+    E802Dot11AironetIE              = 133,
+    E802Dot11ApIpAddressIE          = 149,
+    E802Dot11RsnIE                  = 221
+    };
+
+
+/**
+* Bit masks for Capability Information field.
+*/
+enum T802Dot11CapabilityBitMask
+    {
+    E802Dot11CapabilityEssMask          = 0x0001,
+    E802Dot11CapabilityIbssMask         = 0x0002,
+    E802Dot11CapabilityCfPollableMask   = 0x0004,
+    E802Dot11CapabilityCfPollRequestMask= 0x0008,
+    E802Dot11CapabilityPrivacyMask      = 0x0010,
+    E802Dot11ShortPreambleMask          = 0x0020,
+    E802Dot11PbccMask                   = 0x0040,      
+    E802Dot11ChannelAgilityMask         = 0x0080
+    };
+
+
+// ======================= MEMBER FUNCTIONS =================================
+
+// ----------------------------------------------------------------------------
+// CWlanCoverageCheck::CWlanCoverageCheck()
+// ----------------------------------------------------------------------------
+//
+CWlanCoverageCheck::CWlanCoverageCheck() 
+: CActive( EPriorityStandard )
+    {
+    CActiveScheduler::Add( this );
+    }
+    
+// ----------------------------------------------------------------------------
+// CWlanCoverageCheck::~CWlanCoverageCheck()
+// ----------------------------------------------------------------------------
+//
+CWlanCoverageCheck::~CWlanCoverageCheck()
+    {
+    Cancel();
+    }
+    
+// ----------------------------------------------------------------------------
+// CWlanCoverageCheck::DoCancel
+// ----------------------------------------------------------------------------
+//
+void CWlanCoverageCheck::DoCancel()
+    {
+    iWait.AsyncStop();
+    }
+    
+// ----------------------------------------------------------------------------
+// CWlanCoverageCheck::RunL
+// ----------------------------------------------------------------------------
+//
+void CWlanCoverageCheck::RunL()
+    {
+    CLOG_WRITE( "RunL entered" );
+    switch( iProgState )
+        {
+        case EScanning:
+            {
+            CLOG_WRITE( "Scanning state" );
+            if( !iStatus.Int() )
+                // The list is ready 
+                {
+                CLOG_WRITE( "No error" );
+                iProgState = EDone;
+                iWait.AsyncStop();
+                CLOG_WRITE( "wait stopped" );
+                }
+            else
+                // something went wrong -> no coverage.
+                {
+                CLOG_WRITE( "error" );
+                iWait.AsyncStop();
+                }
+            }
+            break;            
+        case EDone:
+            {
+            CLOG_WRITE( "State Done entered" );
+            iWait.AsyncStop();
+            }
+            break;
+            
+        default:
+            {
+            }
+        }
+    }
+
+
+
+// ----------------------------------------------------------------------------
+// CWlanCoverageCheck::ScanForPromptedSsidL
+// ----------------------------------------------------------------------------
+//
+TBool CWlanCoverageCheck::ScanForPromptedSsidL( TWlanSsid aEnteredSsid,
+                                TBool aBroadcast,
+                                TWlanConnectionMode& aConnectionMode, 
+                                TWlanConnectionSecurityMode& aSecurityMode,
+                                TWlanConnectionExtentedSecurityMode& aExtSecurityMode,
+                                TBool& aProtectedSetupSupported )
+    {
+    TBool found = EFalse;
+
+    CLOG_WRITE( "ScanForPromptedSsidL started" );
+        
+    CWlanMgmtClient* wlanMgmt = CWlanMgmtClient::NewL();
+    CleanupStack::PushL( wlanMgmt );
+    CLOG_WRITE( "Client created" );
+
+    CWlanScanInfo* scanInfo = CWlanScanInfo::NewL();
+    CleanupStack::PushL( scanInfo );
+    CLOG_WRITE( "Scaninfo created" );
+
+    iProgState = EScanning;
+    CLOG_WRITE( "State set to scanning" );
+    
+    if ( aBroadcast )
+        {
+        wlanMgmt->GetScanResults( iStatus, *scanInfo );
+        }
+    else
+        {
+        wlanMgmt->GetScanResults( aEnteredSsid, iStatus, *scanInfo );
+        }
+
+    CLOG_WRITE( "GetScanResult called" );
+    
+    SetActive();
+    CLOG_WRITE( "SetActive called" );
+    CLOG_WRITE( "wait started" );
+    iWait.Start();
+    
+    CLOG_WRITE( "Wait returned" );
+    
+    // now we have the results and might start to work on them...
+    if ( iProgState == EDone )
+        {       //finished without error, work on the result...
+        TSignalStrength signalStrength = ESignalStrengthMin;
+
+        for ( scanInfo->First(); !scanInfo->IsDone(); scanInfo->Next() )
+            {
+            TUint8 ieLen( 0 );
+            const TUint8* ieData;
+            TBuf8<KWlanMaxSsidLength> ssid8;
+            
+            TInt ret = scanInfo->InformationElement( E802Dot11SsidIE, ieLen, 
+                                                     &ieData );
+            if ( ret == KErrNone ) 
+                {               
+                CLOG_WRITE( "Starting copying ssid" );  
+                // get the ssid
+                ssid8.Copy( ieData, ieLen );
+                CLOG_WRITE( "SSID copied" );  
+                
+                if ( !aEnteredSsid.Compare( ssid8 ) )
+                    {
+                    // get the signal strength                        
+                    TUint8 rxLevel8 = scanInfo->RXLevel();
+                    TInt rxLevel = static_cast< TInt >( rxLevel8 );
+            
+                    TSignalStrength strength = ( TSignalStrength )rxLevel;
+                    if ( !found || ( found && strength < signalStrength ) )
+                        {
+                        found = ETrue;
+                        signalStrength = strength;
+
+                        if ( scanInfo->Capability() & 
+                             E802Dot11CapabilityEssMask )
+                            {
+                            aConnectionMode = 
+                             ( TWlanConnectionMode )ENetworkModeInfrastructure;
+                            }
+                        else
+                            {
+                            aConnectionMode = 
+                                    ( TWlanConnectionMode )ENetworkModeAdHoc;
+                            }
+
+                        aSecurityMode = scanInfo->SecurityMode();
+                        aExtSecurityMode = scanInfo->ExtendedSecurityMode();
+                        aProtectedSetupSupported = 
+                                        scanInfo->IsProtectedSetupSupported();
+                        CLOG_WRITEF( _L( "****Protected Setup in CWlanCoverageCheck::ScanForPromptedSsidL: %d***" ), aProtectedSetupSupported );
+                        }
+                    }
+                }
+            else
+                {
+                User::Leave( ret );
+                }
+        
+            }
+        
+        CleanupStack::PopAndDestroy( scanInfo );
+        CleanupStack::PopAndDestroy( wlanMgmt );
+        }
+    else
+        {
+        User::LeaveIfError( iStatus.Int() );        
+        }
+    
+    return found;
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/wlanpowersavetest.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,210 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Dialog that implements WLAN Power Save Testing notification
+*
+*/
+
+
+// INCLUDE FILES
+#include "wlanpowersavetest.h"
+#include "wlanpowersavetestnotif.h"
+#include "ConnectionUiUtilitiesCommon.h"
+#include "ConnectionDialogsLogger.h"
+
+#include <uikon/eiksrvui.h>
+#include <StringLoader.h>
+#include <ConnUiUtilsNotif.rsg>
+
+// ================= MEMBER FUNCTIONS =======================
+//
+// ---------------------------------------------------------
+// CWlanPowerSaveQuery::CWlanPowerSaveQuery
+// ---------------------------------------------------------
+//
+CWlanPowerSaveQuery::CWlanPowerSaveQuery( CWlanPowerSaveQueryNotif* aNotif )
+: iNotif( aNotif ),
+  iButtonGroupPreviouslyChanged( EFalse )
+   {
+   }
+    
+    
+// ---------------------------------------------------------
+// CWlanPowerSaveQuery::~CWlanPowerSaveQuery
+// ---------------------------------------------------------
+//
+CWlanPowerSaveQuery::~CWlanPowerSaveQuery()
+    {
+    STATIC_CAST( CEikServAppUi*, 
+                 CCoeEnv::Static()->AppUi() )->SuppressAppSwitching( EFalse );
+    }
+
+
+
+// ---------------------------------------------------------
+// CWlanPowerSaveQuery::OkToExitL
+// ---------------------------------------------------------
+//
+TBool CWlanPowerSaveQuery::OkToExitL( TInt aButtonId )
+    {
+    CLOG_ENTERFN( "CWlanPowerSaveQuery::OkToExitL" );
+    TInt status = KErrCancel;
+    if ( aButtonId == EAknSoftkeyYes || aButtonId == EAknSoftkeySelect || 
+         aButtonId == EAknSoftkeyDone || aButtonId == EAknSoftkeyOk )
+        {
+        status = KErrNone;
+        }
+
+    CLOG_WRITEF( _L( "aButtonId = %d" ), aButtonId );
+    
+    if ( iNotif )
+        {
+        iNotif->CompleteL( status );	
+        }
+    
+    CLOG_LEAVEFN( "CWlanPowerSaveQuery::OkToExitL" );
+
+    return ETrue;
+    }
+    
+    
+// ---------------------------------------------------------
+// CWlanPowerSaveQuery::PreLayoutDynInitL()
+// ---------------------------------------------------------
+//
+void CWlanPowerSaveQuery::PreLayoutDynInitL()
+    {    
+    CAknMessageQueryDialog::PreLayoutDynInitL();
+
+    STATIC_CAST( CEikServAppUi*, 
+                 CCoeEnv::Static()->AppUi() )->SuppressAppSwitching( ETrue );
+    }
+
+
+// ---------------------------------------------------------
+// CWlanPowerSaveQuery::OfferKeyEventL()
+// ---------------------------------------------------------
+//
+TKeyResponse CWlanPowerSaveQuery::OfferKeyEventL( const TKeyEvent& aKeyEvent, 
+                                                 TEventCode aModifiers )
+    {
+    CLOG_ENTERFN( "CWlanPowerSaveQuery::OfferKeyEventL" );
+    TInt code = aKeyEvent.iCode;
+
+    switch ( code )
+        {
+        case EKeyUpArrow:
+        case EKeyDownArrow:
+            {
+            CAknMessageQueryControl* messageQueryControl = STATIC_CAST( 
+                                        CAknMessageQueryControl*, 
+                                        Control( EAknMessageQueryContentId ) );
+            if ( messageQueryControl )
+                {
+                TKeyResponse answer = messageQueryControl->OfferKeyEventL( 
+                                                    aKeyEvent, aModifiers );
+                if ( answer == EKeyWasConsumed )
+                    {
+                    if ( messageQueryControl->LinkHighLighted() ) 
+                        {
+                        if ( !iButtonGroupPreviouslyChanged )
+                            {
+                            CEikButtonGroupContainer& cba = 
+                                                        ButtonGroupContainer();
+
+                            ButtonGroupContainer().AddCommandSetToStackL( 
+                                                    R_SOFTKEYS_VIEW_EMPTY__VIEW );
+
+                            cba.UpdateCommandObserverL( 
+                              CEikButtonGroupContainer::ELeftSoftkeyPosition,
+                              *this );
+
+                            cba.UpdateCommandObserverL( 
+                              CEikButtonGroupContainer::EMiddleSoftkeyPosition,
+                              *this );
+
+                            cba.DrawDeferred();
+ 
+                            iButtonGroupPreviouslyChanged = ETrue;
+                           }
+                        }
+                    else if ( iButtonGroupPreviouslyChanged )
+                        {                            
+                        CEikButtonGroupContainer& cba = ButtonGroupContainer();
+
+                        cba.RemoveCommandObserver( 
+                            CEikButtonGroupContainer::ELeftSoftkeyPosition );
+
+                        cba.RemoveCommandObserver( 
+                            CEikButtonGroupContainer::EMiddleSoftkeyPosition );
+
+                        cba.RemoveCommandFromStack( 
+                            CEikButtonGroupContainer::ELeftSoftkeyPosition,
+                            EAknSoftkeyView );
+
+                        cba.RemoveCommandFromStack( 
+                            CEikButtonGroupContainer::ERightSoftkeyPosition, 
+                            EAknSoftkeyNo );
+
+                        cba.RemoveCommandFromStack( 
+                            CEikButtonGroupContainer::EMiddleSoftkeyPosition, 
+                            EAknSoftkeyView );
+
+                        cba.DrawDeferred();
+
+                        iButtonGroupPreviouslyChanged = EFalse;
+                        }
+                    }
+                CLOG_WRITEF( _L( "answer = %d" ), answer );
+                CLOG_LEAVEFN( "CWlanPowerSaveQuery::OfferKeyEventL 1" );
+                return answer;  
+                }
+            }
+            break;
+            
+        default:
+            break;
+        }
+
+    CLOG_LEAVEFN( "CWlanPowerSaveQuery::OfferKeyEventL 2" );
+    return CAknMessageQueryDialog::OfferKeyEventL( aKeyEvent, aModifiers );
+    }
+
+
+// ---------------------------------------------------------
+// CWlanPowerSaveQuery::TryExitL()
+// ---------------------------------------------------------
+//
+void CWlanPowerSaveQuery::TryExitL( TInt aButtonId )
+    {
+    CLOG_ENTERFN( "CWlanPowerSaveQuery::TryExitL" );
+    CAknMessageQueryDialog::TryExitL( aButtonId );
+    CLOG_LEAVEFN( "CWlanPowerSaveQuery::TryExitL" );
+    }
+
+// ---------------------------------------------------------
+// CWlanPowerSaveQuery::NeedToDismissQueryL
+// ---------------------------------------------------------
+//
+TBool CWlanPowerSaveQuery::NeedToDismissQueryL(const TKeyEvent& aKeyEvent)
+    {
+    if (aKeyEvent.iCode == EKeyPhoneSend)
+        {
+        TryExitL(EEikBidCancel);
+        return ETrue;
+        }
+        
+    return EFalse;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/wlanpowersavetestnotif.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,257 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Notier part for WLAN Power Save Testing notification dialog
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "wlanpowersavetestnotif.h"
+#include "wlanpowersavetest.h"
+#include "ConnectionUiUtilitiesCommon.h"
+#include "ConnUiUtilsNotif.h"
+#include "ConnectionDialogsLogger.h"
+
+#include <ConnUiUtilsNotif.rsg>
+#include <StringLoader.h>
+
+#include <ConnectionUiUtilities.h>
+
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CWlanPowerSaveQueryNotif::CWlanPowerSaveQueryNotif()
+// ---------------------------------------------------------
+//
+CWlanPowerSaveQueryNotif::CWlanPowerSaveQueryNotif()
+    :
+    iDisable( EFalse )
+    {
+    }
+
+
+// ---------------------------------------------------------
+// CWlanPowerSaveQueryNotif* CWlanPowerSaveQueryNotif::NewL()
+// ---------------------------------------------------------
+//
+CWlanPowerSaveQueryNotif* CWlanPowerSaveQueryNotif::NewL( 
+                                        const TBool aResourceFileResponsible )
+    {
+    CWlanPowerSaveQueryNotif* self = new ( ELeave ) CWlanPowerSaveQueryNotif();
+    CleanupStack::PushL( self );
+    self->ConstructL( KResourceFileName, aResourceFileResponsible );
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+// ---------------------------------------------------------
+// CWlanPowerSaveQueryNotif::~CWlanPowerSaveQueryNotif()
+// ---------------------------------------------------------
+//
+CWlanPowerSaveQueryNotif::~CWlanPowerSaveQueryNotif()
+    {   
+    if ( iExitAsync )
+        {
+    	delete iExitAsync;
+    	iExitAsync = NULL;
+        }
+    }
+
+// ---------------------------------------------------------
+// CWlanPowerSaveQueryNotif::RegisterL()
+// ---------------------------------------------------------
+//
+CWlanPowerSaveQueryNotif::TNotifierInfo CWlanPowerSaveQueryNotif::RegisterL()
+    {
+    iInfo.iUid      = KUidWlanPowerSaveTestNote;
+    iInfo.iPriority = ENotifierPriorityHigh;
+    iInfo.iChannel  = KUidWlanPowerSaveTestNote;
+
+    return iInfo;
+    }
+
+// ---------------------------------------------------------
+// void CWlanPowerSaveQueryNotif::StartL
+// ---------------------------------------------------------
+//
+void CWlanPowerSaveQueryNotif::StartL( const TDesC8& /*aBuffer*/, 
+                                       TInt aReplySlot,
+                                       const RMessagePtr2& aMessage )
+    {
+    if ( iDialog )
+        {
+        // Dialog is already on the display
+        aMessage.Complete( KErrServerBusy );
+        return;
+        }
+            
+    iReplySlot = aReplySlot;
+    iMessage   = aMessage;
+    iCancelled = EFalse;    
+
+    iDialog = new ( ELeave ) CWlanPowerSaveQuery( this );
+    iDialog->PrepareLC( R_POWERSAVE_QUERY );
+    
+    HBufC* heading  = NULL;
+    HBufC* message  = NULL;
+    TInt resourceId = 0;
+    
+    resourceId = R_QTN_WLAN_POWER_SAVE_TEST_DLG_TEXT;
+    heading    = StringLoader::LoadLC( 
+                     R_QTN_WLAN_POWER_SAVE_TEST_DLG_TITLE );
+    
+    CDesCArrayFlat* strings = new( ELeave ) CDesCArrayFlat( 2 );
+    CleanupStack::PushL( strings );
+    
+    HBufC* messageBase = StringLoader::LoadL( resourceId, *strings );
+
+    CleanupStack::PopAndDestroy( strings );
+
+    CleanupStack::PushL( messageBase );
+
+    _LIT( KLinkStartTag, "\n<AknMessageQuery Link>" );
+    _LIT( KLinkEndTag, "</AknMessageQuery Link>" );
+
+    HBufC* linkString1 = StringLoader::LoadLC( 
+                            R_QTN_WLAN_POWER_SAVE_TEST_DLG_LINK );
+
+    TInt lenMsg = messageBase->Des().Length()+
+                  linkString1->Des().Length()+
+                  KLinkStartTag().Length()+
+                  KLinkEndTag().Length();
+
+
+    message = HBufC::NewL( lenMsg );
+    TPtr messagePtr = message->Des();
+
+    messagePtr.Append( messageBase->Des() ); 
+
+    messagePtr.Append( KLinkStartTag ); 
+    messagePtr.Append( linkString1->Des() );
+    messagePtr.Append( KLinkEndTag );
+
+    CleanupStack::PopAndDestroy( linkString1 );
+    CleanupStack::PopAndDestroy( messageBase );
+
+    CleanupStack::PushL( message );
+
+    iDialog->SetMessageTextL( *message );
+    CleanupStack::PopAndDestroy( message );
+
+    iDialog->QueryHeading()->SetTextL( *heading );
+    CleanupStack::PopAndDestroy( heading );
+
+    // Set callback for the link
+    TCallBack callBackFirstLink( DisableTestLinkL, this );
+    iDialog->SetLink( callBackFirstLink );
+
+    iDialog->RunLD();
+    }
+
+// ---------------------------------------------------------
+// void CWlanPowerSaveQueryNotif::Cancel()
+// ---------------------------------------------------------
+//
+void CWlanPowerSaveQueryNotif::Cancel()
+    {
+    CLOG_ENTERFN( "CWlanPowerSaveQueryNotif::Cancel" );
+    if ( !iCancelled )
+        {
+        iCancelled = ETrue;
+        if ( !iMessage.IsNull() )
+            {
+            iMessage.Complete( KErrCancel );
+            }
+        
+        delete iDialog;
+        iDialog = NULL;
+        }
+            
+    CLOG_LEAVEFN( "CWlanPowerSaveQueryNotif::Cancel" );
+    }
+
+
+// ---------------------------------------------------------
+// void CWlanPowerSaveQueryNotif::CompleteL( TInt aStatus )
+// ---------------------------------------------------------
+//
+void CWlanPowerSaveQueryNotif::CompleteL( TInt aStatus )
+    {  
+    CLOG_ENTERFN( "CWlanPowerSaveQueryNotif::CompleteL" );
+    if ( !iMessage.IsNull() )
+        {        
+        iMessage.WriteL( iReplySlot, TPckg< TBool >( iDisable ) );
+        iMessage.Complete( aStatus );
+        }
+    
+    iCancelled = ETrue;
+    iDialog    = NULL; //deleted by AVKON when OkToExitL completes
+    
+    CLOG_LEAVEFN( "CWlanPowerSaveQueryNotif::CompleteL" );
+    }
+
+
+// ---------------------------------------------------------
+// TInt CWlanPowerSaveQueryNotif::DisableTestLinkL()
+// ---------------------------------------------------------
+//
+TInt CWlanPowerSaveQueryNotif::DisableTestLinkL( TAny* aObject )
+    {
+    CLOG_ENTERFN( "CWlanPowerSaveQueryNotif::DisableTestLinkL" );
+    CWlanPowerSaveQueryNotif* myself =
+                            static_cast<CWlanPowerSaveQueryNotif*>( aObject );
+    
+    if ( !myself->iExitAsync )
+        {
+        // Can't exit now. This call could be triggered by a pointer
+        // event. AVKON would crash if exit is done now.
+        // Trigger a one shot active object to delay exit. 
+        TCallBack cb( myself->DisableTestLinkL, myself );
+	    myself->iExitAsync = new( ELeave ) CAsyncCallBack( cb, CActive::EPriorityHigh );
+	    myself->iExitAsync->CallBack();
+	    
+	    CLOG_LEAVEFN( "CWlanPowerSaveQueryNotif::DisableTestLinkL" );
+	    return 1;
+        }
+    else
+        {
+        // We can exit now. Called by one shot active object.
+        myself->DoDisableTestLinkL();
+        
+        CLOG_LEAVEFN( "CWlanPowerSaveQueryNotif::DisableTestLinkL" );
+        return 0;	
+        }
+    }
+
+
+// ---------------------------------------------------------
+// void CWlanPowerSaveQueryNotif::DoDisableTestLinkL()
+// ---------------------------------------------------------
+//
+void CWlanPowerSaveQueryNotif::DoDisableTestLinkL()
+    {
+    CLOG_ENTERFN( "CWlanPowerSaveQueryNotif::DoDisableTestLinkL" );
+
+    iDisable = ETrue;
+    
+    iDialog->TryExitL( EAknSoftkeySelect );
+    
+    CLOG_LEAVEFN( "CWlanPowerSaveQueryNotif::DoDisableTestLinkL" );
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/data/ConnUiUtilsNotif.rss	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,538 @@
+/*
+* Copyright (c) 2004 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 all the resources for the 
+*               Connection Ui Utilities Notifier
+*
+*/
+
+
+//  RESOURCE IDENTIFIER
+NAME ACUN // 4 letter ID
+
+//  INCLUDES
+#include <eikon.rh>
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.mbg>
+#include <avkon.loc>
+
+#include <AvkonIcons.hrh>
+#include "ConnUiUtilsNotif.hrh"
+#include <connectionuiutilities.loc>
+
+//  RESOURCE DEFINITIONS
+
+RESOURCE RSS_SIGNATURE { }
+
+RESOURCE TBUF { buf="ConnUiUtilsNotif"; }
+
+
+RESOURCE AVKON_LIST_QUERY r_select_wlan_list_query
+    {
+    softkeys = R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT;
+    flags = EEikDialogFlagNotifyEsc | EEikDialogFlagCbaButtons |
+            EEikDialogFlagNoDrag | EEikDialogFlagNoTitleBar;
+
+
+    items = AVKON_LIST_QUERY_DLG_LINE
+        {
+        id = EListQueryControl;
+        control = AVKON_LIST_QUERY_CONTROL
+            {
+            listtype = EAknCtSingleGraphicPopupMenuListBox;
+            listbox = AVKON_LIST_QUERY_LIST
+                {
+                flags = EAknListBoxSelectionList;
+                };
+
+            heading = qtn_wlan_prmpt_select_network;
+            };
+        };
+    }
+    
+RESOURCE DIALOG r_query_dialog
+    {
+    flags = EEikDialogFlagNotifyEsc | EEikDialogFlagCbaButtons | 
+            EEikDialogFlagNoDrag | EEikDialogFlagNoTitleBar | 
+            EEikDialogFlagCbaButtons;
+    buttons = R_AVKON_SOFTKEYS_YES_NO__YES;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control = AVKON_CONFIRMATION_QUERY
+                {
+                layout = EConfirmationLayout;
+                label = qtn_offline_activate_wlan;
+                };
+            }
+        };
+    }    
+
+RESOURCE DIALOG r_easy_wep_wpa_dlg
+	{
+    flags = EEikDialogFlagNotifyEsc | EEikDialogFlagCbaButtons | 
+            EEikDialogFlagNoDrag | EEikDialogFlagNoTitleBar |
+            EEikDialogFlagVirtualInput;
+	buttons=R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+    items=
+		{
+		DLG_LINE
+			{
+			type=EAknCtQuery;
+			id=EGeneralQuery;
+			control= AVKON_DATA_QUERY
+				{ 
+				layout=EDataLayout;
+                control = EDWIN
+                    {
+                    avkon_flags = EAknEditorFlagLatinInputModesOnly;
+                    default_case = EAknEditorLowerCase;
+					default_input_mode = EAknEditorTextInputMode;
+                    allowed_input_modes = EAknEditorAllInputModes;
+                    };
+				};
+			}
+		};
+
+	}
+
+RESOURCE TBUF r_info_no_networks_found
+    { 
+    buf = qtn_wlan_info_no_networks_found;
+    }
+
+
+RESOURCE TBUF r_offline_not_possible
+    {
+    buf = qtn_offline_not_possible;
+    }
+
+RESOURCE TBUF r_easy_wep_query_text             { buf = qtn_wlan_prmpt_wep_key; }
+RESOURCE TBUF r_easy_wpa_query_text             { buf = qtn_wlan_prmpt_wpa_key; }
+RESOURCE TBUF r_info_preshared_key_too_short    { buf = qtn_wlan_info_preshared_key_too_short; } 
+RESOURCE TBUF r_info_wep_key_invalid            { buf = qtn_wlan_info_invalid_wep_key; } 
+RESOURCE TBUF r_info_wep_key_illegal_chars      { buf = qtn_wlan_info_wep_key_illegal_chars; } 
+RESOURCE TBUF r_wlan_network_unavailable        { buf = qtn_err_wlan_network_lost; }
+RESOURCE TBUF r_info_preshared_key_not_hexs     { buf = qtn_wlan_info_preshared_key_not_hex; }
+RESOURCE TBUF r_connuiutilities_not_supported   { buf = qtn_err_not_supp; }
+RESOURCE TBUF r_occ_info_no_wlan_available      { buf = qtn_occ_info_no_wlan_available; }
+
+RESOURCE DIALOG r_searching_wlan_wait_note
+	{
+	flags = EAknWaitNoteFlags;
+	buttons=R_AVKON_SOFTKEYS_EMPTY;
+    items=
+		{
+		DLG_LINE
+			{
+			type = EAknCtNote;
+			id = ESearchingWlanWaitNote; 
+			control= AVKON_NOTE 
+                { 
+				layout = EWaitLayout;
+				singular_label = qtn_wlan_wait_searching_networks;				
+                imagefile = AVKON_ICON_FILE;
+				imageid = EMbmAvkonQgn_note_progress;
+				imagemask = EMbmAvkonQgn_note_progress_mask;
+				animation = R_QGN_GRAF_WAIT_BAR_ANIM;				
+				};
+			}
+		};
+	}
+
+	
+RESOURCE DIALOG r_query_dialog_with_heading
+    {
+    flags = EEikDialogFlagNoDrag | EEikDialogFlagNoTitleBar | 
+            EEikDialogFlagCbaButtons | EEikDialogFlagNoBorder | 
+            EEikDialogFlagNoShadow;
+    buttons = R_AVKON_SOFTKEYS_YES_NO__YES;
+    items=
+        {
+        DLG_LINE
+            {
+            type = EAknCtPopupHeadingPane;
+            id = EAknMessageQueryHeaderId;
+            control = AVKON_HEADING
+                {
+                label = "";
+                headinglayout = R_AVKON_WML_SIGN_QUERY_HEADING_PANE;
+                };
+            },
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control= AVKON_CONFIRMATION_QUERY
+                {
+                layout = EConfirmationLayout;
+                label = "";
+                };
+            }            
+        };
+    }
+    
+    
+RESOURCE CBA r_softkeys_yes_cancel__yes
+    {
+    buttons =
+        {
+        // Differences between ids and texts are intentional!
+        CBA_BUTTON { id = EAknSoftkeySelect; txt = text_softkey_yes; },     
+        CBA_BUTTON { id = EAknSoftkeyNo;     txt = text_softkey_cancel; },
+        CBA_BUTTON { id = EAknSoftkeySelect; txt = text_softkey_yes;}
+        };
+    }
+
+
+RESOURCE CBA r_softkeys_view_no__view
+    {
+    buttons =
+        {
+        CBA_BUTTON { id = EAknSoftkeyView; txt = text_softkey_select; },
+        CBA_BUTTON { id = EAknSoftkeyNo;   txt = text_softkey_cancel;},
+        CBA_BUTTON { id = EAknSoftkeyView; txt = text_softkey_select; }
+        };
+    }
+
+
+
+
+RESOURCE AVKON_LIST_QUERY r_message_query
+{
+   flags = EEikDialogFlagNotifyEsc | EGeneralQueryFlags;
+   softkeys = R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT;
+   items =
+   {
+      AVKON_LIST_QUERY_DLG_LINE
+      {
+         control = AVKON_LIST_QUERY_CONTROL_WITH_MSGBOX
+         {
+            actuallisttype = EAknCtSinglePopupMenuListBox;
+            listbox = AVKON_LIST_QUERY_LIST
+            {
+            };
+            heading = "...";
+         };
+      }
+   };
+}
+
+
+    
+RESOURCE DIALOG r_connecting_via_info_note
+    {
+    flags = EAknInformationNoteFlags | EEikDialogFlagWait;
+    buttons = R_AVKON_SOFTKEYS_EMPTY;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtNote;
+            id = EConnectingViaNote;
+            control = AVKON_NOTE 
+                { 
+                layout = ENoteWithImageLayout;
+                singular_label = "";
+                plural_label = "";
+                imagefile = AVKON_ICON_FILE;                
+				imageid = EMbmAvkonQgn_note_info; 
+				imagemask = EMbmAvkonQgn_note_info_mask;   
+                animation = R_QGN_NOTE_INFO_ANIM;
+                };
+            }
+        };
+    }    
+    
+RESOURCE DIALOG r_connected_via_confirm_note
+    {
+    flags = EAknConfirmationNoteFlags | EEikDialogFlagWait;
+    buttons = R_AVKON_SOFTKEYS_EMPTY;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtNote;
+            id = EConnectingViaConfirmNote;
+            control = AVKON_NOTE
+                { 
+                layout = ENoteWithImageLayout;
+                singular_label = "";
+                plural_label = "";
+                imagefile = AVKON_ICON_FILE;
+				imageid = EMbmAvkonQgn_note_ok; 
+				imagemask = EMbmAvkonQgn_note_ok_mask;
+                animation = R_QGN_NOTE_OK_ANIM;				                
+                };
+            }
+        };
+    }      
+    
+
+RESOURCE DIALOG r_wlan_name_query
+   {
+   flags = EGeneralQueryFlags | EEikDialogFlagNotifyEsc;
+   buttons = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+   items =
+       {
+       DLG_LINE
+             {
+             type = EAknCtQuery;
+             id = EGeneralQuery;
+             control = AVKON_DATA_QUERY
+                    {
+                    layout = EDataLayout;
+                    label = qtn_wlan_prmpt_network_name;
+                    control = EDWIN
+                        {
+                        maxlength = KWlanMaxSsidLength_;
+                        flags = EEikEdwinNoWrap;
+                        };
+                    };
+             }
+        };
+    }
+
+
+RESOURCE TBUF r_qtn_netw_conset_conf_connected_to           
+    { 
+    buf = qtn_netw_conset_conf_connected_to; 
+    }
+
+RESOURCE TBUF r_qtn_netw_conset_info_roaming_to             
+    { 
+    buf = qtn_netw_conset_info_roaming_to; 
+    }
+
+RESOURCE TBUF r_qtn_netw_conset_prmpt_roam_less_preferred   
+    { 
+    buf = qtn_netw_conset_prmpt_roam_less_preferred; 
+    }
+
+RESOURCE TBUF r_qtn_netw_conset_quest_roam_less_preferred   
+    { 
+    buf = qtn_netw_conset_quest_roam_less_preferred; 
+    }
+
+RESOURCE TBUF r_qtn_netw_conset_prmpt_roam_more_preferred   
+    { 
+    buf = qtn_netw_conset_prmpt_roam_more_preferred; 
+    }
+
+RESOURCE TBUF r_qtn_netw_conset_quest_roam_more_preferred   
+    { 
+    buf = qtn_netw_conset_quest_roam_more_preferred; 
+    }
+
+RESOURCE TBUF r_qtn_netw_conset_quest_connect_via_method    
+    { 
+    buf = qtn_netw_conset_quest_connect_via_method; 
+    }
+
+RESOURCE TBUF r_qtn_netw_conset_conf_connected_via_method
+    { 
+    buf = qtn_netw_conset_conf_connected_via_method;
+    }
+
+RESOURCE TBUF r_qtn_netw_conset_prmpt_connection_needed
+    {
+    buf = qtn_netw_conset_prmpt_connection_needed;
+    }
+
+RESOURCE TBUF r_qtn_netw_conset_msg_query_link_always_accept
+    {
+    buf = qtn_netw_conset_msg_query_link_always_accept;
+    }
+
+RESOURCE TBUF r_qtn_netw_conset_msg_query_link_try_next
+    {
+    buf = qtn_netw_conset_msg_query_link_try_next;
+    }
+
+RESOURCE TBUF r_qtn_wlan_manual_ssid_input
+    {
+    buf = qtn_wlan_manual_ssid_input;
+    }
+
+RESOURCE TBUF r_qtn_wlan_power_save_test_dlg_title
+    {
+    buf = qtn_wlan_power_save_test_dlg_title;
+    }
+
+RESOURCE TBUF r_qtn_wlan_power_save_test_dlg_text
+    {
+    buf = qtn_wlan_power_save_test_dlg_text;
+    }
+
+RESOURCE TBUF r_qtn_wlan_power_save_test_dlg_link
+    {
+    buf = qtn_wlan_power_save_test_dlg_link;
+    }
+
+RESOURCE TBUF r_qtn_occ_connecting_discreet_popup_text1
+    {
+    buf = qtn_occ_connecting_discreet_popup_text1;
+    }
+
+RESOURCE TBUF r_qtn_occ_connecting_discreet_popup_text2
+    {
+    buf = qtn_occ_connecting_discreet_popup_text2;
+    }
+
+RESOURCE TBUF r_qtn_occ_connection_failed_discreet_popup_text1
+    {
+    buf = qtn_occ_connection_failed_discreet_popup_text1;
+    }
+
+RESOURCE TBUF r_qtn_occ_config_failed_discreet_popup_text1
+    {
+    buf = qtn_occ_config_failed_discreet_popup_text1;
+    }
+
+RESOURCE TBUF r_qtn_occ_internal_error_discreet_popup_text2
+    {
+    buf = qtn_occ_internal_error_discreet_popup_text2;
+    }
+
+RESOURCE TBUF r_qtn_occ_wlan_not_found_discreet_popup_text2
+    {
+    buf = qtn_occ_wlan_not_found_discreet_popup_text2;
+    }
+
+RESOURCE TBUF r_qtn_occ_auth_error_discreet_popup_text2
+    {
+    buf = qtn_occ_auth_error_discreet_popup_text2;
+    }
+
+RESOURCE TBUF r_qtn_occ_check_key_discreet_popup_text2
+    {
+    buf = qtn_occ_check_key_discreet_popup_text2;
+    }
+
+RESOURCE TBUF r_qtn_occ_check_settings_discreet_popup_text2
+    {
+    buf = qtn_occ_check_settings_discreet_popup_text2;
+    }
+
+RESOURCE TBUF r_qtn_occ_sim_error_discreet_popup_text2
+    {
+    buf = qtn_occ_sim_error_discreet_popup_text2;
+    }
+
+RESOURCE TBUF r_qtn_occ_service_error_discreet_popup_text2
+    {
+    buf = qtn_occ_service_error_discreet_popup_text2;
+    }
+
+RESOURCE TBUF r_qtn_occ_access_error_discreet_popup_text2
+    {
+    buf = qtn_occ_access_error_discreet_popup_text2;
+    }
+
+RESOURCE TBUF r_qtn_occ_already_act_discreet_popup_text2
+    {
+    buf = qtn_occ_already_act_discreet_popup_text2;
+    }
+
+RESOURCE TBUF r_qtn_occ_wlan_weak_discreet_popup_text2
+    {
+    buf = qtn_occ_wlan_weak_discreet_popup_text2;
+    }
+
+RESOURCE TBUF r_qtn_occ_try_again_discreet_popup_text2
+    {
+    buf = qtn_occ_try_again_discreet_popup_text2;
+    }
+
+RESOURCE TBUF r_qtn_occ_conn_unavailable_discreet_popup_text2
+    {
+    buf = qtn_occ_conn_unavailable_discreet_popup_text2;
+    }
+
+
+RESOURCE CBA r_softkeys_view_empty__view
+    {
+    buttons =
+        {
+        CBA_BUTTON {id=EAknSoftkeyView; txt=text_softkey_select; },
+        CBA_BUTTON {txt=text_softkey_empty;},
+        CBA_BUTTON {id=EAknSoftkeyView; txt=text_softkey_select; }
+        };
+    }
+
+RESOURCE DIALOG r_powersave_query
+    {
+    flags = EEikDialogFlagNoDrag | EEikDialogFlagNoTitleBar | 
+            EEikDialogFlagCbaButtons | EEikDialogFlagNoBorder | 
+            EEikDialogFlagNoShadow | EEikDialogFlagNotifyEsc;
+    buttons = R_AVKON_SOFTKEYS_OK_EMPTY__OK;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtPopupHeadingPane;
+            id = EAknMessageQueryHeaderId;
+            control = AVKON_HEADING
+                {
+                label = "";
+                headinglayout = R_AVKON_WML_SIGN_QUERY_HEADING_PANE;
+                };
+            },
+
+        DLG_LINE
+            {
+            type = EAknCtMessageQuery;
+            id = EAknMessageQueryContentId;
+            control = AVKON_MESSAGE_QUERY
+                {
+                };
+            }
+        };
+    }
+
+
+RESOURCE TBUF r_qtn_occ_prmpt_cs_data_home_nw
+    {    
+    buf = qtn_occ_prmpt_cs_data_home_nw;
+    }
+    
+RESOURCE TBUF r_qtn_occ_prmpt_cs_data_foreign_nw
+    {    
+    buf = qtn_occ_prmpt_cs_data_foreign_nw;
+    } 
+    
+RESOURCE TBUF r_qtn_occ_detail_cs_data_home_nw
+    {    
+    buf = qtn_occ_detail_cs_data_home_nw;
+    }
+    
+RESOURCE TBUF r_qtn_occ_detail_cs_data_foreign_nw
+    {    
+    buf = qtn_occ_detail_cs_data_foreign_nw;
+    }
+
+RESOURCE TBUF r_qtn_occ_list_cs_data_home_nw_automatic 
+    {    
+    buf = qtn_occ_list_cs_data_home_nw_automatic;
+    }
+
+RESOURCE TBUF r_qtn_occ_list_cs_data_home_nw_this_time 
+    {    
+    buf = qtn_occ_list_cs_data_home_nw_this_time;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/data/ConnectionUiUtilities.rss	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,129 @@
+/*
+* Copyright (c) 2004 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 resources for the Connection Ui Utilities.
+*
+*/
+
+
+//  RESOURCE IDENTIFIER
+NAME ACUU // 4 letter ID
+
+//  INCLUDES
+#include <eikon.rh>
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.mbg>
+#include <AvkonIcons.hrh>
+#include <connectionuiutilities.loc>
+
+
+//  RESOURCE DEFINITIONS
+
+RESOURCE RSS_SIGNATURE { }
+
+
+RESOURCE TBUF { buf="ConnectionUiUtilities"; }
+
+RESOURCE TBUF r_always_ask_always_ask
+    { 
+    buf = qtn_netw_sett_iap_pref_prompt; 
+    }
+
+RESOURCE TBUF r_always_ask_user_defined
+    { 
+    buf = qtn_netw_sett_iap_pref_user_def; 
+    }
+
+RESOURCE AVKON_SETTING_PAGE r_always_ask_page
+	{ 
+	label = qtn_netw_sett_default_iap;
+	softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+ 	type = EAknSetListBox;
+	editor_resource_id= r_always_ask_page_listbox;
+	}
+
+RESOURCE LISTBOX r_always_ask_page_listbox
+	{
+	flags = EEikListBoxMultipleSelection;
+	}
+
+
+
+RESOURCE AVKON_LIST_QUERY r_change_conn_list_query
+    {
+    softkeys = R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT;
+    flags = EEikDialogFlagNotifyEsc;
+
+    items =
+        {
+        AVKON_LIST_QUERY_DLG_LINE
+            {
+            id = EListQueryControl;
+            control = AVKON_LIST_QUERY_CONTROL_WITH_MSGBOX
+                {
+                actuallisttype = EAknCtSingleGraphicPopupMenuListBox;
+                listbox = AVKON_LIST_QUERY_LIST
+                    {
+                    flags = EAknListBoxSelectionList;
+                    };
+
+                heading = qtn_netw_prmpt_change_connection;
+                };
+            }
+        };
+    }
+
+
+RESOURCE TBUF r_wlan_search_for_networks            
+    { 
+    buf = qtn_wlan_search_for_networks; 
+    }
+
+
+RESOURCE TBUF r_conn_changed                        
+    { 
+    buf = qtn_netw_conf_connection_changed; 
+    }
+
+
+RESOURCE TBUF r_change_connection_desc
+    { 
+    buf = qtn_netw_detail_change_connection_desc; 
+    }
+
+RESOURCE DIALOG r_searching_wait_note
+	{
+	flags = EAknWaitNoteFlags;
+	buttons=R_AVKON_SOFTKEYS_EMPTY;
+    items=
+		{
+		DLG_LINE
+			{
+			type = EAknCtNote;
+			id = 0x113; 
+			control= AVKON_NOTE 
+                { 
+				layout = EWaitLayout;
+				singular_label = qtn_netw_wait_checking_avail_conn;			
+                imagefile = AVKON_ICON_FILE;
+				imageid = EMbmAvkonQgn_note_progress;
+				imagemask = EMbmAvkonQgn_note_progress_mask;
+				animation = R_QGN_GRAF_WAIT_BAR_ANIM;				
+				};
+			}
+		};
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/inc/ActiveCChangeConnectionDlg.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,125 @@
+/*
+* 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: 
+*     Declares CActiveCChangeConnectionDlg.
+*
+*/
+
+
+#ifndef ACTIVE_CHANGECONNECTIONDLG_H
+#define ACTIVE_CHANGECONNECTIONDLG_H
+
+
+// INCLUDES
+#include "ActiveIAPListing.h"
+#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include <commsdat.h>
+#else
+#include <commsdat.h>
+#include <commsdat_partner.h>
+#endif
+
+
+// FORWARD DECLARATION
+class CChangeConnectionDlg;
+
+/**
+ * CActiveCChangeConnectionDlg class,
+ * an active object for CChangeConnectionDlg
+ */     
+NONSHARABLE_CLASS( CActiveCChangeConnectionDlg ) : public CActiveIAPListing
+{
+public:
+    /**
+    * NewL function
+    * @param aIAPId iap id
+    * @param aPrefs preferences pointer    
+    */
+    static CActiveCChangeConnectionDlg* NewL( TUint32* aIAPId, 
+                                              const TConnectionPrefs& aPrefs,
+                                              TDes& aConnectionName );
+    
+    /**
+    * StartSearchIAPs setactive and starts active object
+    * @return ETrue if Select Soft key was pressed, 
+    * EFalse if Cancel Soft key was selected on the dialog.
+    */    
+    TBool StartSearchIAPsL();
+
+    /**
+    * Destructor
+    */    
+    virtual ~CActiveCChangeConnectionDlg();
+    
+    /**
+    * Cancels the active object
+    */
+    void Cancel();
+
+    inline void SetSelected( TBool aSelected );
+
+    inline CConnectionInfoArray* ActIAPs();
+
+                          
+protected:
+    /**
+    * ConstructL 
+    */
+    void ConstructL();
+    
+    /**
+    * Constructor
+    * @param aIAPId iap id
+    * @param aPrefs preferences pointer        
+    */    
+    CActiveCChangeConnectionDlg( TUint32* aIAPId, 
+                                 const TConnectionPrefs& aPrefs,
+                                 TDes& aConnectionName );
+    
+    /**
+    * DoCancel from CActive
+    */    
+    virtual void DoCancel();
+
+    /**
+    * RunL from CActive
+    */
+    virtual void RunL();
+
+    /**
+    * Gives back, refresh interval of scan for network
+    */
+    TInt GetRefreshInterval();
+
+protected:
+    
+    CChangeConnectionDlg* iDialog;    ///< a pointer to dialog, not owned     
+    
+    TBool isDialogDeleting; 
+
+    TUint32*                       iIAPId;      // ID of IAP        
+    
+    TBuf<CommsDat::KMaxTextLength> iConnectionName;  
+    
+    CActiveSchedulerWait            iWait;
+    
+    TBool                           iSelected;
+      
+};     
+
+#include "ActiveCChangeConnectionDlg.inl"
+
+#endif // ACTIVE_CHANGECONNECTIONDLG_H
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/inc/ActiveCChangeConnectionDlg.inl	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,49 @@
+/*
+* 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: 
+*      Inline method definitions of the class CActiveCChangeConnectionDlg.
+*
+*
+*/
+
+
+
+#ifndef __ACTIVECCHANGECONNECTIONDLG__INL
+#define __ACTIVECCHANGECONNECTIONDLG__INL
+
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// void CActiveCChangeConnectionDlg::SetSelected
+// ----------------------------------------------------------------------------
+//
+void CActiveCChangeConnectionDlg::SetSelected( TBool aSelected ) 
+    { 
+    iSelected = aSelected; 
+    }
+
+
+// ----------------------------------------------------------------------------
+// void CActiveCChangeConnectionDlg::ActIAPs
+// ----------------------------------------------------------------------------
+//
+CConnectionInfoArray* CActiveCChangeConnectionDlg::ActIAPs() 
+    { 
+    return iActIAPs;   
+    }
+        
+
+#endif // __ACTIVECCHANGECONNECTIONDLG__INL
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/inc/ActiveWrapper.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,154 @@
+/*
+* 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:
+*
+*/
+
+
+
+#ifndef __ACTIVE_WRAPPER_H__
+#define __ACTIVE_WRAPPER_H__
+
+//  INCLUDES
+#include <e32base.h>
+#include "ConnectionUiUtilitiesClient.h"
+
+
+// CONSTANTS
+const TUint KNumberOfWrappedDialogs = 13;
+
+enum TWrappedDialogs
+    {
+    ESearchWlan = 0, 
+    EOffLineWlan,
+    EWlanDisabled,
+    EWlanNetwUnavail,
+    EConnViaDestCM,
+    EChangingConnTo,
+    EConnViaCM,
+    EWlanEasyWep,
+    EWlanEasyWpa,
+    EWlanEasyWapi,
+    ENoWlanNetwsAvail,
+    EConnectingViaDiscreetPopup,
+    EConnectionErrorDiscreetPopup
+    };
+
+
+
+// CLASS DECLARATION
+
+/**
+*  ?one_line_short_description.
+*  ?other_description_lines
+*
+*  @lib ?library
+*  @since Series ?XX ?SeriesXX_version
+*/
+NONSHARABLE_CLASS( CActiveWrapper ) : public CActive
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CActiveWrapper* NewL( const TUint aIndexOfNote );
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CActiveWrapper();
+
+    public: // New functions
+        
+        void StartSearchWLANNetwork( 
+                        TPckgBuf<TConnUiUiWlanNetworkPrefs>& aNetworkPrefs );
+
+        void StartSearchWLANNetworkAsync( TRequestStatus& aStatus, 
+                                TWlanSsid& aSSID,
+                                TWlanConnectionMode& aConnectionMode,
+                                TWlanConnectionSecurityMode& aSecurityMode,
+                                TWlanConnectionExtentedSecurityMode& aExtSecurityMode, 
+                                TBool& aProtectedSetupSupported );
+
+        void StartGenericNote( const TUint aIndexOfNote, 
+                               const TUint32 aConnMId  = 0,
+                               const TUint32 aDestId = 0 );
+
+        TInt StartEasyWepDlg( TPckgBuf< TWepKeyData >& aKey  );
+
+        void StartEasyWepDlgAsync( TRequestStatus& aStatus, TDes* aKey, TBool& aHex );
+    
+        TInt StartEasyWpaDlg( TPckgBuf< TBuf< KEasyWpaQueryMaxLength > >& aKey );
+    
+        void StartEasyWpaDlgAsync( TRequestStatus& aStatus, TDes* aKey );
+    
+        TInt StartEasyWapiDlg( TPckgBuf< TBuf< KEasyWapiQueryMaxLength > >& aKey );
+
+        void StartConnectingViaDiscreetPopup(TPckgBuf< TConnUiConnectingViaDiscreetPopup>& aInfo);
+
+        void StartConnectionErrorDiscreetPopup( TPckgBuf<TInt>& aErrCode);
+        
+    public: // Functions from base classes
+
+        void DoCancel();
+        void RunL();
+        
+    protected:  // New functions
+        
+
+    protected:  // Functions from base classes
+        
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CActiveWrapper( const TUint aIndexOfNote );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+    protected:  // Data
+
+        RConnectionUiUtilitiesSession iNotif; ///< notifier client
+        
+        CActiveSchedulerWait    iWait;
+
+        TPckgBuf<TConnUiUiWlanNetworkPrefs> iNetworkPrefs;
+        TWlanSsid* iSSID;
+        TWlanConnectionMode* iConnectionMode;
+        TWlanConnectionSecurityMode* iSecurityMode;
+        TWlanConnectionExtentedSecurityMode* iExtSecurityMode;
+        TBool* iProtectedSetupSupported; 
+
+        TRequestStatus* iRS;
+        TUint iIndexOfNote;
+                
+        
+        TPckgBuf< TWepKeyData > iWepKey;//used only for async version
+        
+        TPckgBuf< TBuf< KEasyWpaQueryMaxLength > > iWpaKey;//used only for async version
+        
+        TDes* iKey;
+        TBool* iHex;
+        
+    };
+
+#endif      // __ACTIVE_WRAPPER_H__
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/inc/ChangeConnectionDlg.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,130 @@
+/*
+* Copyright (c) 2002 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: 
+*     Declares dialog.
+*
+*/
+
+
+#ifndef CHANGECONNECTIONDLG_H
+#define CHANGECONNECTIONDLG_H
+
+
+// INCLUDES
+#include <commdb.h>
+#include <aknlistquerydialog.h>
+#include <agentdialog.h>
+#include <AknWaitDialog.h>
+#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include <commsdat.h>
+#else
+#include <commsdat.h>
+#include <commsdat_partner.h>
+#endif
+
+#include "ConnectionInfo.h"
+#include "ConnectionInfoArray.h"
+#include "ActiveCChangeConnectionDlg.h"
+#include "ExpiryTimerCallback.h"
+
+class CExpiryTimer;
+// CLASS DECLARATION
+
+/**
+* CChangeConnectionDlg dialog class
+*
+*/
+NONSHARABLE_CLASS( CChangeConnectionDlg ) : public CAknListQueryDialog, public MExpiryTimerCallback
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Two-phase construction.
+        * @param 
+        * @param 
+        */
+        static CChangeConnectionDlg* NewL( TUint32* aIAPId, 
+                                       CActiveCChangeConnectionDlg* aActiveDlg,
+                                       TDes& aConnectionName );
+
+        /**
+        * Destructor.
+        */
+        ~CChangeConnectionDlg();
+
+        /**
+        * Refersh items of dialog
+        */
+        void RefreshDialogL();
+        
+    protected:
+        /**
+        * Constructor.
+        */
+        CChangeConnectionDlg( TInt aIndex, 
+                              TUint32* aIAPId,
+                              CActiveCChangeConnectionDlg* aActiveDlg, 
+                              TDes& aConnectionName );
+
+
+    private:
+
+        // From CAknListQueryDialog
+        virtual void PreLayoutDynInitL();
+
+        // From CAknListQueryDialog
+        TBool OkToExitL( TInt aButtonId );
+
+        /**
+        * Handle resource change events. 
+        * @param aType: The type of resources that have changed
+        */
+        void HandleResourceChange( TInt aType );
+
+        /**
+        * Create dialog.
+        */
+        void ConstructL();
+
+        /**
+        * Dialog expiration timeout callback
+        */
+        void HandleTimedOut();
+
+    private:  // New functions
+
+        /**
+        * Sets graphic icons
+        * @param    -
+        */
+        void SetIconsL();
+
+
+    private: //data
+        TUint32*            iIAPId;
+        TBuf<CommsDat::KMaxTextLength> iConnectionName;
+        TBool               iIsWLANFeatureSupported;
+        
+        CActiveCChangeConnectionDlg* iActiveDlg; // not owned
+        
+        // Pointer for dialog expiration timer
+        CExpiryTimer* iExpiryTimer;
+    };
+
+
+
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/inc/ConnectionUiUtilitiesClient.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,284 @@
+/*
+* Copyright (c) 2004 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:  Declares Connection Ui Utilities Client classes.
+*
+*/
+
+
+#ifndef __CONNECTIONUIUTILITIESCLIENT_H__
+#define __CONNECTIONUIUTILITIESCLIENT_H__
+
+// INCLUDES
+#include <e32std.h>
+#include <ConnectionUiUtilities.h>
+#include "ConnectionUiUtilitiesCommon.h"
+
+
+// FORWARD DECLARATIONS
+
+
+// CLASS DECLARATION
+
+/**
+ * RConnectionUiUtilitiesSession
+ */
+class RConnectionUiUtilitiesSession : public RSessionBase
+    {
+    public:
+    
+        /**
+        * Constructor.
+        */
+        RConnectionUiUtilitiesSession();
+
+        /**
+        * Destructor.
+        */
+        ~RConnectionUiUtilitiesSession();
+
+        /**
+        * Connect to the notifier server. Must be called before any other 
+        * function (c'tor excepted).
+        * @return KErrNone if connection succeeded and a standard error code
+        * otherwise.
+        */
+        TInt Connect();
+
+        /**
+        * Disconnect from the notifier server.
+        */
+        void Close();
+
+    public:
+        /**
+        * Notifier. Search available WLAN networks, and user can select one of 
+        * them
+        * @param aNetworkPrefs      Return parameter, contains id, connection 
+        *                           mode and security mode of selected wlan 
+        *                           network
+        * @param aStatus            status object of notifier or user does not
+        *                           select a network.
+        * @param aIsAsyncVersion    ETrue if called by a really asynchronous
+        *                           function
+        */        
+        void SearchWLANNetwork( 
+                            TPckgBuf<TConnUiUiWlanNetworkPrefs>& aNetworkPrefs,
+                            TRequestStatus& aStatus,
+                            TBool aIsAsyncVersion );
+
+        /**
+        * Cancel SearchWLANNetwork
+        */     
+        void CancelSearchWLANNetwork();
+        
+        /**
+        * Notifier. Shows a query, "Do you want to create a WLAN connection in 
+        * Off-line mode?"
+        * @param aStatus            status object of notifier
+        * @param aIsAsyncVersion    ETrue if called by a really asynchronous
+        *                           function
+        */         
+        void OffLineWlanNote( TRequestStatus& aStatus, TBool aIsAsyncVersion );
+        
+        /**
+        * Cancel OffLineWlan Note
+        */
+        void CancelOffLineWlanNote();
+        
+        /**
+        * Notifier. Pops up an information note: 
+        * "Operation not possible in Off-line mode"
+        */                        
+        void OffLineWlanDisabledNote( TRequestStatus& aStatus );       
+
+        /**
+        * Notifier. Shows a data query, "Enter WEP key for WLAN" 
+        * @param aKey Key entered by user
+        * @return ETrue if user select OK, EFalse otherwise
+        */
+        void EasyWepDlg( TPckgBuf< TWepKeyData >& aKey, 
+                         TRequestStatus& aStatus );
+        
+        /**
+        * Cancel Easy Wep dialog
+        */
+        void CancelEasyWepDlg();
+
+        /**
+        * Notifier. Shows a data query, "Enter pre-shared key for WLAN" 
+        * @param aKey Key entered by user
+        * @return ETrue if user select OK, EFalse otherwise
+        */
+        void EasyWpaDlg( TPckgBuf< TBuf< KEasyWpaQueryMaxLength > >& aKey, 
+                         TRequestStatus& aStatus );
+        
+        /**
+        * Cancel Easy Wpa dialog
+        */
+        void CancelEasyWpaDlg();
+
+        /**
+        * Pops up an information note: 
+        * "Selected WLAN network has no coverage"
+        */        
+        void WLANNetworkUnavailableNote( TRequestStatus& aStatus );       
+
+        /**
+        * Confirmation note is used after the connection has been successfully 
+        * established via destination and connection method.
+        * @param aDestId Id of used destination.
+        * @param aConnMId Id of used connection method.
+        * @param aStatus Status object of notifier.
+        */
+        void ConnectedViaDestAndConnMethodNote( const TUint32 aDestId, 
+                                                const TUint32 aConnMId,
+                                                TRequestStatus& aStatus );
+        /**
+        * Cancel ConnectedViaDestAndConnMethodNote notifier.
+        */
+        void CancelConnectedViaDestAndConnMethodNote();
+
+        /**
+        * Information note is used when "Automatically" roaming is enabled
+        * The actual connection establishment take places in the background
+        * (no wait note).
+        * @param aConnMId Id of used connection method.
+        * @param aStatus Status object of notifier.
+        */
+        void ChangingConnectionToNote( const TUint32 aConnMId,
+                                       TRequestStatus& aStatus );
+
+        /**
+        * Cancel ChangingConnectionToNote notifier.
+        */
+        void CancelChangingConnectionToNote();
+
+        /**
+        * Notifier. Shows a query, "Connect to\n '%0U' via\n '%1U'?"
+        * @param aResult Result of user selection, ETrue if user accepted
+        * roaming, to more preferred method, EFlase otherwise
+        * @param aHomeNetwork   home or foreign network
+        * @param aStatus Status object of notifier.
+        */
+        void ConfirmMethodUsageQuery( TMsgQueryLinkedResults& aResult,                                     
+                                      const TBool aHomeNetwork,
+                                      TRequestStatus& aStatus);
+        
+        /**
+        * Cancel ConfirmMethodUsageQuery
+        */
+        void CancelConfirmMethodUsageQuery();
+
+
+        /**
+        * Confirmation note is used after the connection has been successfully 
+        * established via a connection method.
+        * @param aConnMId Id of used connection method.
+        * @param aStatus Status object of notifier.
+        */
+        void ConnectedViaConnMethodNote( const TUint32 aConnMId,
+                                        TRequestStatus& aStatus );
+        /**
+        * Cancel ConnectedViaConnMethodNote notifier.
+        */
+        void CancelConnectedViaConnMethodNote();
+        
+        /**
+        * This note is displayed when power-save feature of the WLAN station 
+        * is incompatible and thus battery consumption of the mobile will increase.
+        * @param aDisable ETrue if user wants to disable this note in the future.
+        * @param aStatus Status object of notifier.
+        */
+        void WlanPowerSaveTestNote( TBool& aDisable, TRequestStatus& aStatus );
+        
+        /**
+        * Cancel WlanPowerSaveTestNote notifier.
+        */
+        void CancelWlanPowerSaveTestNote();
+        
+        /**
+        * Notifier. Prompts WAPI-PSK.
+        * Shows a data query, "Enter pre-shared key for WLAN" 
+        * @param aKey Key entered by user
+        * @return ETrue if user select OK, EFalse otherwise
+        */
+        void EasyWapiDlg( TPckgBuf< TBuf< KEasyWapiQueryMaxLength > >& aKey, 
+                          TRequestStatus& aStatus );
+        
+        /**
+        * Cancel EasyWapiDlg notifier.
+        */                  
+        void CancelEasyWapiDlg();
+
+        /**
+        * Pops up an information note: 
+        * "No WLAN networks are available at the moment. Connection not available."
+        */ 
+        void NoWLANNetworksAvailableNote( TRequestStatus& aStatus );                  
+        
+        /**
+        * Discreet popup. Shows "connecting via %U" discreet popup.
+        * @param aInfo Information about bearer.
+        */
+        void ConnectingViaDiscreetPopup( TPckgBuf< TConnUiConnectingViaDiscreetPopup>& aInfo, 
+                          TRequestStatus& aStatus );
+        
+        /**
+        * Cancel ConnectingViaDiscreetPopup notifier.
+        */                  
+        void CancelConnectingViaDiscreetPopup();                  
+
+        /**
+        * Discreet popup. Shows discreet popup about connection error.
+        * @param aErrCode Error code.
+        */
+        void ConnectionErrorDiscreetPopup( TPckgBuf< TInt >& aErrCode, 
+                          TRequestStatus& aStatus );
+        
+        /**
+        * Cancel ConnectionErrorDiscreetPopup notifier.
+        */                  
+        void CancelConnectionErrorDiscreetPopup();                  
+
+    private:
+
+        // Pointer to the client interface
+        RNotifier* iNotifier;
+
+        // used for get response from notifier
+        TBuf8<8> iResponseStrOffLineWlanNote;
+
+        // used for get response from notifier
+        TBuf8<8> iResponseStrOffLineWlanDisabledNote;
+
+        // used for get response from notifier
+        TBuf8<8> iResponseStrWLANNetworkUnavailableNote;
+
+        // used for get response from notifier
+        TBuf8<8> iResponseStrConnectingNote;
+        
+        TPckg<TBool> iBool;         // get response from Query
+        TPckg<TMsgQueryLinkedResults> iResponseMsgQuery;
+
+        TPckgBuf<TConnUiUiDestConnMethodNoteId> iPassedInfo;
+
+        // used for get response from notifier
+        TBuf8<8> iResponseStrNoWLANNetworksAvailableNote;
+    };
+
+
+#endif /* __CONNECTIONUIUTILITIESCLIENT_H__ */
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/inc/ConnectionUiUtilitiesCommon.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,96 @@
+/*
+* 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: 
+*     Declares the common used constants and types for
+*     Connection Ui Utilities.
+*
+*/
+
+
+#ifndef CONNECTIONUIUTILITIES_COMMON_H
+#define CONNECTIONUIUTILITIES_COMMON_H
+
+// INCLUDES
+#include <wlanmgmtcommon.h>
+#include "ConnectionDialogsUidDefs.h"
+
+
+// CONSTANTS
+const TInt KEasyWepQuery256BitMaxLength = 58;
+const TInt KEasyWepQueryNon256BitMaxLength = 26;
+const TInt KEasyWpaQueryMaxLength = 64;
+const TInt KEasyWapiQueryMaxLength = 64;
+
+// Note and Query Ids
+enum TConnUINoteAndQueryIds
+    {
+    EReconnectToConnMethodConfirmationQuery = 1,
+    ERoamingToConnMethodConfirmationQuery,
+    EConnectedViaDestConnMethodConfirmationNote,
+    EConnectingToConnMethodInfoNote,
+    EConfirmMethodUsageQuery,
+    EConnectedViaConnMethodConfirmationNote,
+    EConfirmMethodUsageQueryInHomeNetwork,
+    EConfirmMethodUsageQueryInForeignNetwork
+    };
+
+/**
+ * Defines preferences of the WlanNetwork
+ */
+class TConnUiUiWlanNetworkPrefs
+    {
+public:
+    TWlanSsid                           iSsId;        ///< Ssid of Wlan network
+    TWlanConnectionMode                 iNetworkMode; ///< mode of Wlan network
+    TWlanConnectionSecurityMode         iSecMode;     ///< Security mode of Wlan network
+    TWlanConnectionExtentedSecurityMode iExtSecMode;  ///< Extended security mode of Wlan network
+    TBool                               iProtectedSetupSupported; 
+                                        ///< Wlan network supports Protected Setup
+    };
+    
+/**
+*
+*/
+class TWepKeyData
+    {
+public:
+    TBuf< KEasyWepQuery256BitMaxLength > iKey;
+    TBool iHex;
+    };
+
+/**
+*
+*/
+class TConnUiUiDestConnMethodNoteId
+    {
+public:
+    TUint32   iDestination;       ///< Destination of connection
+    TUint32   iConnectionMethod;  ///< Connection method of connection
+    TInt      iNoteId;            ///< Which note will be used
+    TBool     iNextBestExists;    ///< If it exists another method to try
+   	TWlanSsid iSsid;              ///< SSID of the connected EasyWlan
+
+    };
+
+class TConnUiConnectingViaDiscreetPopup
+    {
+public:
+    TUint32   iIapId;
+    TBool iConnectionAlreadyActive;
+    };
+
+#endif  // CONNECTIONUIUTILITIES_COMMON_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/inc/ConnectionUiUtilitiesImpl.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,554 @@
+/*
+* Copyright (c) 2004 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 CConnectionUiUtilitiesImpl.
+*      
+*
+*/
+
+
+#ifndef CONNECTIONUIUTILITIESIMPL_H
+#define CONNECTIONUIUTILITIESIMPL_H
+
+// INCLUDES
+#include <e32base.h>
+#include "ConnectionUiUtilitiesClient.h"
+#include "ConnectionUiUtilitiesCommon.h"
+#include "ActiveWrapper.h"
+
+// CONST DECLARATIONS
+
+_LIT( KMrouterName, "mRouter" );
+
+#if defined(_DEBUG)
+_LIT( KErrNullPointer, "NULL pointer" );
+#endif
+
+
+// FORWARD DECLARATIONS
+class CCommsDatabase;
+class TConnectionPrefs;
+class CAknGlobalNote;
+
+
+// CLASS DECLARATION
+
+/**
+* Connection Ui Utilities.
+* Implementation behind proxy class CConnectionUiUtilities.
+*/
+NONSHARABLE_CLASS( CConnectionUiUtilitiesImpl ) : public CBase
+    {
+
+    public:     // Constructors and destructor
+
+        /**
+        * Two-phased constructor. Leaves on failure.
+        * @return The constructed CConnectionUiUtilities object.
+        */
+        static CConnectionUiUtilitiesImpl* NewL();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CConnectionUiUtilitiesImpl();
+
+    protected:  // Constructors
+
+        /**
+        * Constructor.
+        */
+        CConnectionUiUtilitiesImpl();
+
+        /**
+        * Second-phase constructor.
+        */
+        void ConstructL();
+
+    public:     // New methods
+        /**
+        * @param aResult contains ECuuAlwaysAsk if always ask radio button 
+        * was selected, and ECuuUserDefined if user defined 
+        * radio button was selected by user
+        * It acts also as input parameter to default this setting.
+        * @return ETrue if OK Soft key was pressed, 
+        * EFalse if Cancel Soft key was selected on the dialog.
+        */
+        TBool AlwaysAskPageL( TCuuAlwaysAskResults& aResult );
+        
+        /**
+        * @param aIAPId gives back the iapid of selected connection
+        * @param aPrefs Specifies the rank and desired direction and bearer
+        * of the connections will appear in the dialog
+        * @return ETrue if Select Soft key was pressed, 
+        * EFalse if Cancel Soft key was selected on the dialog.
+        */                
+        TBool ChangeConnectionL( TUint32& aUid, TConnectionPrefs aPrefs );
+        
+        /**
+        * Pops up an information note, about connection is changed to 
+        * the given accespont
+        * @param aIAPId The id of access point which has been selected.
+        */        
+        void  ShowConnectionChangedNoteL( const TUint32& aIAPId );
+        
+        /**
+        * Notifier. Search available WLAN networks, and user can select one of 
+        * them
+        * @param aSSID the id of selected wlan network
+        * @param aConnectionMode connection mode of selected wlan network
+        * @param aSecurityMode security mode of selected wlan network        
+        * @return ETrue if user selected one of networks, EFalse if an error
+        * is occured or user does not select a network.
+        */        
+        TBool SearchWLANNetwork( TWlanSsid& aSSID, 
+                                 TWlanConnectionMode& aConnectionMode,
+                                 TWlanConnectionSecurityMode& aSecurityMode );
+                                 
+        /**
+        * Notifier. Search available WLAN networks, and user can select one of 
+        * them
+        * @param aSSID the id of selected wlan network
+        * @param aConnectionMode connection mode of selected wlan network
+        * @param aExtSecurityMode extended security mode of selected wlan network        
+        * @return ETrue if user selected one of networks, EFalse if an error
+        * is occured or user does not select a network.
+        */        
+        TBool SearchWLANNetwork( TWlanSsid& aSSID, 
+                                 TWlanConnectionMode& aConnectionMode,
+                                 TWlanConnectionExtentedSecurityMode& aExtSecurityMode );                         
+        
+        /**
+        * Notifier. Search available WLAN networks, and user can select one of 
+        * them
+        * @param aSSID the id of selected wlan network
+        * @param aConnectionMode connection mode of selected wlan network
+        * @param aSecurityMode security mode of selected wlan network        
+        * @param aProtectedSetupSupported if the wlan supports Protected Setup
+        * @return ETrue if user selected one of networks, EFalse if an error
+        * is occured or user does not select a network.
+        */        
+        TBool SearchWLANNetwork( TWlanSsid& aSSID, 
+                                 TWlanConnectionMode& aConnectionMode,
+                                 TWlanConnectionSecurityMode& aSecurityMode,
+                                 TBool& aProtectedSetupSupported );
+                                 
+         /**
+        * Notifier. Search available WLAN networks, and user can select one of 
+        * them
+        * @param aSSID the id of selected wlan network
+        * @param aConnectionMode connection mode of selected wlan network
+        * @param aExtSecurityMode security mode of selected wlan network        
+        * @param aProtectedSetupSupported if the wlan supports Protected Setup
+        * @return ETrue if user selected one of networks, EFalse if an error
+        * is occured or user does not select a network.
+        */        
+        TBool SearchWLANNetwork( TWlanSsid& aSSID, 
+                                 TWlanConnectionMode& aConnectionMode,
+                                 TWlanConnectionExtentedSecurityMode& aExtSecurityMode,
+                                 TBool& aProtectedSetupSupported );                         
+        
+        
+        /**
+        * Notifier. Search available WLAN networks, and user can select one of 
+        * them
+        * @param aSSID the id of selected wlan network
+        * @param aConnectionMode connection mode of selected wlan network
+        * @param aSecurityMode security mode of selected wlan network
+        * @param aExtSecurityMode security mode of selected wlan network         
+        * @param aProtectedSetupSupported if the wlan supports Protected Setup
+        * @return ETrue if user selected one of networks, EFalse if an error
+        * is occured or user does not select a network.
+        */        
+        TBool SearchWLANNetwork( TWlanSsid& aSSID, 
+                                 TWlanConnectionMode& aConnectionMode,
+                                 TWlanConnectionSecurityMode& aSecurityMode,
+                                 TWlanConnectionExtentedSecurityMode& aExtSecurityMode, 
+                                 TBool& aProtectedSetupSupported );
+        
+        /**
+        * Notifier. Search available WLAN networks, and user can select one of
+        * them.
+        * Totally synchronous version, to be used from Engines, not from UIs
+        * @param aSSID the id of selected wlan network
+        * @param aConnectionMode connection mode of selected wlan network
+        * @param aSecurityMode security mode of selected wlan network        
+        * @return ETrue if user selected one of networks, EFalse if an error
+        * is occured or user does not select a network.
+        */        
+        TBool SearchWLANNetworkSync( TWlanSsid& aSSID, 
+                                 TWlanConnectionMode& aConnectionMode,
+                                 TWlanConnectionSecurityMode& aSecurityMode );
+
+        
+        /**
+        * Notifier. Search available WLAN networks, and user can select one of
+        * them.
+        * Totally synchronous version, to be used from Engines, not from UIs
+        * @param aSSID the id of selected wlan network
+        * @param aConnectionMode connection mode of selected wlan network
+        * @param aSecurityMode security mode of selected wlan network        
+        * @param aProtectedSetupSupported if the wlan supports Protected Setup
+        * @return ETrue if user selected one of networks, EFalse if an error
+        * is occured or user does not select a network.
+        */        
+        TBool SearchWLANNetworkSync( TWlanSsid& aSSID, 
+                                 TWlanConnectionMode& aConnectionMode,
+                                 TWlanConnectionSecurityMode& aSecurityMode, 
+                                 TBool& aProtectedSetupSupported );
+
+        
+        /**
+        * Notifier. Search available WLAN networks, and user can select one of 
+        * them. Totally asynchronous version, to be used from Engines, not 
+        * from UIs
+        * @param aStatus status object of notifier
+        * @param aSSID the id of selected wlan network
+        * @param aConnectionMode connection mode of selected wlan network
+        * @param aSecurityMode security mode of selected wlan network
+        * @return 
+        */
+        void SearchWLANNetworkAsync( TRequestStatus& aStatus, 
+                                TWlanSsid& aSSID, 
+                                TWlanConnectionMode& aConnectionMode, 
+                                TWlanConnectionSecurityMode& aSecurityMode );
+                                
+        /**
+        * Notifier. Search available WLAN networks, and user can select one of 
+        * them. Totally asynchronous version, to be used from Engines, not 
+        * from UIs
+        * @param aStatus status object of notifier
+        * @param aSSID the id of selected wlan network
+        * @param aConnectionMode connection mode of selected wlan network
+        * @param aExtSecurityMode extented security mode of selected wlan network
+        * @return 
+        */
+        void SearchWLANNetworkAsync( TRequestStatus& aStatus, 
+                                TWlanSsid& aSSID, 
+                                TWlanConnectionMode& aConnectionMode, 
+                                TWlanConnectionExtentedSecurityMode& aExtSecurityMode );                        
+
+        /**
+        * Notifier. Search available WLAN networks, and user can select one of 
+        * them. Totally asynchronous version, to be used from Engines, not 
+        * from UIs
+        * @param aStatus status object of notifier
+        * @param aSSID the id of selected wlan network
+        * @param aConnectionMode connection mode of selected wlan network
+        * @param aSecurityMode security mode of selected wlan network
+        * @param aProtectedSetupSupported if the wlan supports Protected Setup
+        * @return 
+        */
+        void SearchWLANNetworkAsync( TRequestStatus& aStatus, 
+                                TWlanSsid& aSSID, 
+                                TWlanConnectionMode& aConnectionMode, 
+                                TWlanConnectionSecurityMode& aSecurityMode,
+                                TBool& aProtectedSetupSupported );
+                                
+        /**
+        * Notifier. Search available WLAN networks, and user can select one of 
+        * them. Totally asynchronous version, to be used from Engines, not 
+        * from UIs
+        * @param aStatus status object of notifier
+        * @param aSSID the id of selected wlan network
+        * @param aConnectionMode connection mode of selected wlan network
+        * @param aExtSecurityMode extended security mode of selected wlan network
+        * @param aProtectedSetupSupported if the wlan supports Protected Setup
+        * @return 
+        */
+        void SearchWLANNetworkAsync( TRequestStatus& aStatus, 
+                                TWlanSsid& aSSID, 
+                                TWlanConnectionMode& aConnectionMode, 
+                                TWlanConnectionExtentedSecurityMode& aExtSecurityMode, 
+                                TBool& aProtectedSetupSupported );                        
+
+        /**
+        * Notifier. Search available WLAN networks, and user can select one of 
+        * them. Totally asynchronous version, to be used from Engines, not 
+        * from UIs
+        * @param aStatus status object of notifier
+        * @param aSSID the id of selected wlan network
+        * @param aConnectionMode connection mode of selected wlan network
+        * @param aSecurityMode security mode of selected wlan network
+        * @param aExtSecurityMode extended security mode of selected wlan network
+        * @param aProtectedSetupSupported if the wlan supports Protected Setup
+        * @return 
+        */
+        void SearchWLANNetworkAsync( TRequestStatus& aStatus, 
+                                TWlanSsid& aSSID, 
+                                TWlanConnectionMode& aConnectionMode, 
+                                TWlanConnectionSecurityMode& aSecurityMode,
+                                TWlanConnectionExtentedSecurityMode& aExtSecurityMode, 
+                                TBool& aProtectedSetupSupported );
+
+
+        /**
+        * Cancel SearchWLANNetwork
+        */        
+        void  CancelSearchWLANNetwork();
+        
+        /**
+        * Notifier. Shows a query, "Do you want to create a WLAN connection in 
+        * Off-line mode?"
+        * @return ETrue if user select Yes, EFalse otherwise
+        */        
+        TBool OffLineWlanNote();
+        
+        /**
+        * Notifier. Shows a query, "Do you want to create a WLAN connection in 
+        * Off-line mode?"
+        * Asynchronous.
+        * @param aStatus Status object of notifier.
+        */        
+        void OffLineWlanNote( TRequestStatus& aStatus );
+
+        /**
+        * Cancel OffLineWlan Note
+        */        
+        void CancelOffLineWlanNote();
+        
+        /**
+        * Notifier. Pops up an information note: 
+        * "Operation not possible in Off-line mode"
+        */                        
+        void OffLineWlanDisabledNote();
+
+        /**
+        * Notifier. Shows a data query, "Enter WEP key for WLAN" 
+        * @param aKey Key entered by user
+        * @return ETrue if user select OK, EFalse otherwise
+        */
+        TBool EasyWepDlg( TDes* aKey, TBool& aHex );
+
+        /**
+        * Notifier. Shows a data query, "Enter WEP key for WLAN" 
+        * Async version
+        * @param aKey Key entered by user
+        * @param aStatus caller's TRequestStatus to handle asynchronous call.
+        */
+        void EasyWepDlgAsync( TRequestStatus& aStatus, TDes* aKey, TBool& aHex  );
+        
+        /**
+        * Cancel Easy Wep dialog
+        */
+        void CancelEasyWepDlg();
+
+        /**
+        * Notifier. Shows a data query, "Enter pre-shared key for WLAN" 
+        * @param aKey Key entered by user
+        * @return ETrue if user select OK, EFalse otherwise
+        */
+        TBool EasyWpaDlg( TDes* aKey );
+
+        /**
+        * Notifier. Shows a data query, "Enter pre-shared key for WLAN" 
+        * @param aKey Key entered by user
+        * @param aStatus caller's TRequestStatus to handle asynchronous call.
+        */
+        void EasyWpaDlgAsync(  TRequestStatus& aStatus, TDes* aKey );
+        
+        /**
+        * Cancel Easy Wpa dialog
+        */
+        void CancelEasyWpaDlg();
+        
+        /**
+        * Pops up an information note: 
+        * "Selected WLAN network has no coverage"
+        */        
+        void WLANNetworkUnavailableNote();           
+
+        /**
+        * DEPRECATED, PLEASE USE ASYNC VERSION!
+        * Confirmation note is used after the connection has been successfully 
+        * established via destination and connection method.
+        * @param aDestId Id of used destination.
+        * @param aConnMId Id of used connection method.
+        */
+        void ConnectedViaDestAndConnMethodNote( const TUint32 aDestId, 
+                                                const TUint32 aConnMId );
+
+        /**
+        * Confirmation note is used after the connection has been successfully 
+        * established via destination and connection method.
+        * @param aDestId Id of used destination.
+        * @param aConnMId Id of used connection method.
+        * @param aStatus caller's TRequestStatus to handle asynchronous call.
+        */
+        void ConnectedViaDestAndConnMethodNote( const TUint32 aDestId, 
+                                                const TUint32 aConnMId, 
+                                                TRequestStatus& aStatus );
+
+        /**
+        * Cancel ConnectedViaDestAndConnMethodNote notifier.
+        */
+        void CancelConnectedViaDestAndConnMethodNote();
+
+
+        /**
+        * Information note is used when "Automatically" roaming is enabled. The
+        * actual connection establishment take places in the background 
+        * (no wait note).
+        * @param aConnMId Id of used connection method.
+        */
+        void ChangingConnectionToNote( const TUint32 aConnMId );
+        
+        /**
+        * Information note is used when "Automatically" roaming is enabled. The
+        * actual connection establishment take places in the background 
+        * (no wait note).
+        * @param aConnMId Id of used connection method.
+        * @param aStatus Status object of notifier.
+        */       
+        void ChangingConnectionToNote( const TUint32 aConnMId, 
+        								TRequestStatus& aStatus );
+
+        /**
+        * Cancel ChangingConnectionToNote notifier.
+        */
+        void CancelChangingConnectionToNote();
+        
+        /**
+        * Notifier. Shows a query, "Connect to\n '%0U' via\n '%1U'?"
+        * @param aResult Result of user selection, ETrue if user accepted 
+        * roaming, to more preferred method, EFlase otherwise
+        * @param aHomeNetwork   home or foreign network
+        * @param aStatus Status object of notifier.
+        */
+        void ConfirmMethodUsageQuery( TMsgQueryLinkedResults& aResult,  
+                                      const TBool aHomeNetwork,
+                                      TRequestStatus& aStatus );
+        
+        /**
+        * Cancel ConfirmMethodUsageQuery
+        */
+        void CancelConfirmMethodUsageQuery();
+
+        /**
+        * DEPRECATED, PLEASE USE ASYNC VERSION!
+        * Confirmation note is used after the connection has been successfully 
+        * established via a connection method.
+        * @param aConnMId Id of used connection method.
+        */
+        void ConnectedViaConnMethodNote( const TUint32 aConnMId );
+
+        /**
+        * Confirmation note is used after the connection has been successfully 
+        * established via a connection method.
+        * @param aConnMId Id of used connection method.
+        * @param aStatus caller's TRequestStatus to handle asynchronous call.
+        */
+        void ConnectedViaConnMethodNote( const TUint32 aConnMId, 
+                                         TRequestStatus& aStatus );
+                /**
+        * Cancel ConnectedViaConnMethodNote notifier.
+        */
+        void CancelConnectedViaConnMethodNote();
+        
+        /**
+        * This note is displayed when power-save feature of the WLAN station 
+        * is incompatible and thus battery consumption of the mobile will increase.
+        * @param aDisable ETrue if user wants to disable this note in the future.
+        * @param aStatus Status object of notifier.
+        */
+        void WlanPowerSaveTestNote( TBool& aDisable, TRequestStatus& aStatus );
+        
+        /**
+        * Cancel WlanPowerSaveTestNote notifier.
+        */
+        void CancelWlanPowerSaveTestNote();
+        
+        /**
+        * Notifier. Query for prompting WAPI-PSK. 
+        * Displays a query: "Enter pre-shared key for WLAN" 
+        * @param aKey Key entered by user
+        * @return ETrue if user select OK, EFalse otherwise
+        */
+        TBool EasyWapiDlg( TDes* aKey );
+
+        /**
+        * Pops up an information note: 
+        * "No WLAN networks are available at the moment. Connection not available."
+        */        
+        void NoWLANNetworksAvailableNote();
+
+        /**           
+        * Discreet popup. Shows "Connecting via %U" discreet popup 
+        * @param aIapId IAP id of the access point.
+        */
+        void ConnectingViaDiscreetPopup( const TUint32& aIapId, 
+                                         TBool aConnectionAlreadyActive );
+
+        
+        /**           
+        * Discreet popup. Shows discreet popup about connection errors 
+        * @param aErrorCode Error code
+        */
+        void ConnectionErrorDiscreetPopup( const TInt& aErrorCode );
+        
+    private:     // New methods
+
+        /**
+        * Gives back the name of connection uses aIAPId
+        * @param aIAPId access point used for connection
+        * @param aDb CCommsDatabase ofr seaching name of connection
+        * @param aConnectionName asked connection name
+        */        
+        void GetConnectionNameL( const TUint32& aIAPId, 
+                                 CCommsDatabase& aDb,
+                                 TDes& aConnectionName );
+
+        /**
+        * Loads resource file of dll. It can be used if there is CCoeEnv.
+        */                                         
+        void LoadResourceFileL();                             
+
+    private:    // Data 
+
+        TInt iResOffset;        ///< offset of loaded resource file
+        
+        RConnectionUiUtilitiesSession iNotif; ///< notifier client
+        
+        TPckgBuf< TWepKeyData > iWepKey;
+        
+        TPckgBuf< TBuf< KEasyWpaQueryMaxLength > > iWpaKey;
+
+        //return information from Notifier
+        TPckgBuf<TConnUiUiWlanNetworkPrefs> iNetworkPrefs; 
+         
+        TBool iIsWlanSupported;      
+
+        TBool iDummy;
+        
+        TWlanConnectionSecurityMode iDummySecMode;
+        
+        TWlanConnectionExtentedSecurityMode iDummyExtSecMode;
+
+        // Use one wrapper for each note, to avoid to be overwritten, when
+        // some instance is used to show more dialogs at the same time!
+        CActiveWrapper* iActiveWrapper[KNumberOfWrappedDialogs];
+        
+        // buffer for passing WAPI key between client and server
+        TPckgBuf< TBuf< KEasyWapiQueryMaxLength > > iWapiKey;
+        
+        // buffer for passing connecting discreet popup info
+        TPckgBuf< TConnUiConnectingViaDiscreetPopup > iConnInfo;
+        
+    };
+
+
+#endif  // CONNECTIONUIUTILITIESIMPL_H
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/inc/ConnectionUiUtilitiesPanic.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2004 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: 
+*      Panic function and codes.   
+*      
+*
+*/
+
+
+#ifndef CONNECTIONUIUTILITIESPANIC_H
+#define CONNECTIONUIUTILITIESPANIC_H
+
+// TYPES
+
+/**
+* Panic reasons for Connection Ui Utilities.
+*/
+enum TConnectionUiUtilitiesPanicCodes
+    {
+    EUnknownCase,
+    };
+
+
+// FUNCTION DECLARATIONS
+
+/**
+* Panic the thread.
+* @param aReason Reason for the panic.
+*/
+void Panic( TConnectionUiUtilitiesPanicCodes aPanic );
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/inc/ConnectionUiUtilitiesPrivateCRKeys.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,34 @@
+/*
+* 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:  Defining local variation for the module
+*
+*
+*/
+
+
+#ifndef CONNECTIONUIUTILITIESPRIVATECRKEYS_H
+#define CONNECTIONUIUTILITIESPRIVATECRKEYS_H
+
+const TUid KCRUidConnectionUiUtilities = {0x101FD67E};
+
+// The value of the key is the pre-defined scanning interval for WLAN networks 
+// in microseconds
+const TUint32 KConnectionUiUtilitiesScanInterval = 0x00000002;
+
+// The value of the key is the pre-defined scanning interval for 
+// ChangeConnection in microseconds
+const TUint32 KConnectionUiUtilitiesChangeConnInterval = 0x00000003;
+
+
+#endif      // CONNECTIONUIUTILITIESPRIVATECRKEYS_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/loc/connectionuiutilities.loc	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,508 @@
+/*
+* 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 a localisation file for Connection Ui Utilities
+*     A .loc file is the one and only place where the logical strings
+*     to be localised are defined.
+*
+*/
+
+
+
+// LOCALISATION STRINGS
+
+//d:"Always ask" dialog - Setting list item title
+//l:list_setting_pane_t1
+//w:
+//r:3.1
+//
+#define qtn_netw_sett_default_iap		"Default access point"
+
+//d:"Always ask" dialog - Setting choice item
+//l:list_set_graphic_pane_t1
+//w:
+//r:3.0
+//
+#define qtn_netw_sett_iap_pref_prompt		"Ask when needed"
+
+//d:"Always ask" dialog - Setting choice item
+//l:list_set_graphic_pane_t1
+//w:
+//r:3.0
+//
+#define qtn_netw_sett_iap_pref_user_def		"User defined"
+
+
+
+//d:"Change connection" dialog - info text
+//l:loc_type_pane
+//w:
+//r:3.0
+//
+#define qtn_netw_detail_change_connection_desc  "Current connection is \'%U\'. Select new:"
+
+//d:"Change connection" dialog - title
+//l:heading_pane_t1
+//w:
+//r:3.0
+//
+#define qtn_netw_prmpt_change_connection        "Change connection:"
+
+//d:"Change connection" dialog - information note to confirm change of used access point
+//l:popup_note_window
+//w:
+//r:3.0
+//
+#define qtn_netw_conf_connection_changed        "Connection changed. Now connected via \'%U\'"
+
+
+
+//d:"Search for WLAN" - wait note
+//l:popup_note_wait_window
+//w:
+//r:3.0
+//
+#define qtn_wlan_wait_searching_networks         "Searching WLAN networks"
+
+//d:"Search for WLAN" - information note
+//l:popup_note_window
+//w:
+//r:3.0
+//
+#define qtn_wlan_info_no_networks_found         "No WLAN networks found"
+
+//d:"Search for WLAN" - title for list query
+//l:heading_pane_t1
+//w:
+//r:3.0
+//
+#define qtn_wlan_prmpt_select_network            "Select WLAN network:"
+
+//d:"Off-line mode" - confirmation query
+//l:popup_note_window
+//w:
+//r:3.0
+//
+#define qtn_offline_activate_wlan               "Do you want to create a WLAN connection in Off-line mode?"
+
+//d: Wait note text during collection of access points
+//l: popup_note_wait_window
+//w:
+//r:3.0
+//
+#define qtn_netw_wait_checking_avail_conn       "Checking available connections"
+
+//d:Special IAP to enable the search for surrounding WLAN networks
+//l:list_single_graphic_pane_t1_cp2
+//w:
+//r:3.0
+//
+#define qtn_wlan_search_for_networks    "Search for WLAN"
+
+
+//d:"Search for WLAN" WEP key - data query
+//l:popup_query_data_window/opt5
+//w:
+//r:3.0
+//
+#define qtn_wlan_prmpt_wep_key         "Enter WEP key for WLAN:"
+
+//d:"Search for WLAN" WPA key - data query
+//l:popup_query_data_window/opt5
+//w:
+//r:3.0
+//
+#define qtn_wlan_prmpt_wpa_key         "Enter pre-shared key for WLAN:"
+
+//d:"Search for WLAN" WPA key too short - information note
+//l:popup_note_window
+//w:
+//r:3.0
+//
+#define qtn_wlan_info_preshared_key_too_short         "Key must be at least 8 characters long"
+
+//d:"Search for WLAN" Entered WEP key's length is not valid - information note
+//l:popup_note_window
+//w:
+//r:3.0
+//
+#define qtn_wlan_info_invalid_wep_key         "Invalid WEP key"
+
+//d:"Search for WLAN" Illegal characters in entered WEP key - information note
+//l:popup_note_window
+//w:
+//r:3.0
+//
+#define qtn_wlan_info_wep_key_illegal_chars        "Illegal characters in WEP key"
+
+//d:Coverage is lost to selected WLAN network - error note
+//l:popup_note_window
+//w:
+//r:3.0
+//
+#define qtn_err_wlan_network_lost                "WLAN network lost"
+
+//d:Confirmation note, after the connection has been successfully establilshed
+//l:popup_note_window/opt2
+//w:
+//r:3.2
+//
+#define qtn_netw_conset_conf_connected_to         "Connected to '%0U' via\n '%1U'"
+
+//d:Information note, is displayed when the roaming to another connection method is started
+//l:popup_note_window/opt2
+//w:
+//r:3.2
+//
+#define qtn_netw_conset_info_roaming_to         "Changing connection to: '%U'"
+
+
+//d:Confirmation query, is aksed when a change in connection method is take place, heading
+//l:heading_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_netw_conset_prmpt_roam_less_preferred    "Connection was lost. "
+
+//d:Confirmation query, is aksed when a change in connection method is take place
+//l:popup_info_list_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_netw_conset_quest_roam_less_preferred    "Re-establish connection to '%0U' via method '%1U'?"
+
+//d:Confirmation query, is aksed when a change in connection method is take place, heading
+//l:heading_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_netw_conset_prmpt_roam_more_preferred    "Preferred connection: "
+
+//d:Confirmation query, is aksed when a change in connection method is take place
+//l:popup_info_list_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_netw_conset_quest_roam_more_preferred    "Connection to '%0U' now available via method '%1U'. Connect?"
+
+//d:Confirmation query, to ask the user a confirmation before establishing a 
+//d:connection to the destination %0U via the Connection Method %1U
+//l:popup_info_list_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_netw_conset_quest_connect_via_method    "Connect to destination '%0U' via connection method '%1U'?"
+
+//d:Confirmation note, after the connection has been successfully establilshed
+//l:popup_note_window/opt2
+//w:
+//r:3.2
+//
+#define qtn_netw_conset_conf_connected_via_method   "Connected via:\n '%U'"
+
+//d:Title of the MessageQuery with links when a new connection needs to be
+//d:established.
+//l:heading_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_netw_conset_prmpt_connection_needed     "Connection needed:"
+
+//d:Link inside a MessageQuery to change the seamlessness value of the selected
+//d:Connection Method
+//l:popup_info_list_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_netw_conset_msg_query_link_always_accept "-Remember this and connect"
+
+//d:Link inside a MessageQuery to refuse connection with the selected method,
+//d: but to keep the possibility to try with the next best method.
+//l:popup_info_list_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_netw_conset_msg_query_link_try_next     "-Try next best method"
+
+
+//d:Entry to enable the manual input of WLAN network’s SSID, e.g. in case
+//d:of a hidden network which is not directly visible in the scan results
+//l:list_single_graphic_pane_t1_cp2
+//w:
+//r:3.2
+//
+#define qtn_wlan_manual_ssid_input                  "Other (hidden network)"
+
+
+//d:Prompt text for WLAN network name query.
+//l:popup_query_data_window
+//w:
+//r:3.2
+//
+#define qtn_wlan_prmpt_network_name                 "WLAN network name:"
+
+//d:Information note for the user when the entered key is not hexadecimal
+//l:popup_snote_single_text_window
+//w:
+//r:5.0
+//
+#define qtn_wlan_info_preshared_key_not_hex         "Invalid characters in pre-shared key. 64-digit key must be in hexadecimal format."
+
+// d: Generic error note to be displayed when user tries to  
+// d: use some feature which is not supported 
+// l: popup_note_window/opt1
+// w: Errorres
+//r:5.0
+// 
+#define qtn_err_not_supp "Feature is not supported"
+
+//d:Title of Power save test notification dialog.
+//l:heading_pane_t1
+//w:
+//r:9.1
+//
+#define qtn_wlan_power_save_test_dlg_title     "Power save test"
+
+//d:Power save test notification, Informs that power consumption 
+//d:will increase while using the selected WLAN.
+//l:popup_info_list_pane_t1
+//w:
+//r:9.1
+//
+#define qtn_wlan_power_save_test_dlg_text    "The power-save feature of the WLAN station you are connecting to may be incompatible or performing incorrectly. WLAN power-saving of your mobile has been disabled, and battery consumption may be affected."
+
+//d:Link inside the Power save test notification dialog 
+//d:to disable the notification in the future.
+//l:popup_info_list_pane_t1
+//w:
+//r:9.1
+//
+#define qtn_wlan_power_save_test_dlg_link "Disable notification"
+
+//d:Text of discreet popup row 1 informing the connecting status
+//l:popup_discreet_window_t1
+//w:
+//r:5.2
+//
+#define qtn_occ_connecting_discreet_popup_text1 "Connecting"
+
+//d:Text of discreet popup row 2 informing about the used IAP for the connection
+//l:popup_discreet_window_t2
+//w:
+//r:5.2
+//
+#define qtn_occ_connecting_discreet_popup_text2 "Via '%U'"
+
+
+//d:Title of information query when new WLAN networks are found 
+//l:heading_pane_t1
+//w:
+//r:5.2
+//
+#define qtn_occ_prmpt_new_wlans_found	"New WLAN networks found"
+
+//d:Text asking to select a WLAN network to be used from the list instead of
+//d:cellular data
+//l:loc_type_pane
+//w:
+//r:5.2
+//
+#define qtn_occ_detail_new_wlans_select	"Select a WLAN network to be used instead of cellular data."
+
+//d:Selection item in New WLAN networks found query note to choose only the 
+//d:known networks for connection
+//l:list_single_graphic_pane_t1_cp2
+//w:
+//r:5.2
+//
+#define qtn_occ_list_new_wlans_use_only_known	"Use only known networks"
+
+
+//d:No WLAN networks are available at the moment - note
+//l:popup_note_window
+//w:
+//r:5.2
+//
+#define qtn_occ_info_no_wlan_available "No WLAN networks are available at the moment. Connection not available."
+
+
+//d:Confirmation query, to ask the user a confirmation before establishing a 
+//d:connection to the cellular network in home country
+//l:loc_type_pane
+//w:
+//r:5.2
+//
+#define qtn_occ_detail_cs_data_home_nw    "Connect to Internet using cellular data? Data costs may apply."
+
+//d:Title of the MessageQuery when a new connection needs to be established.
+//l:heading_pane_t1
+//w:
+//r:5.2
+//
+#define qtn_occ_prmpt_cs_data_home_nw  "Connecting to Internet"
+
+//d:Option for connection query.
+//l:list_single_pane_t1_cp2
+//w:
+//r:5.2
+//
+#define qtn_occ_list_cs_data_home_nw_automatic "Connect automatically"
+
+//d:Option for connection query.
+//l:list_single_pane_t1_cp2
+//w:
+//r:5.2
+//
+#define qtn_occ_list_cs_data_home_nw_this_time "Connect this time"
+
+
+//d:Title of the MessageQuery when a new connection needs to be established.
+//l:heading_pane_t1
+//w:
+//r:5.2
+//
+#define qtn_occ_prmpt_cs_data_foreign_nw  "Connecting to Internet"
+
+//d:Confirmation query, to ask the user a confirmation before establishing a 
+//d:connection to the cellular network abroad
+//l:loc_type_pane
+//w:
+//r:5.2
+//
+#define qtn_occ_detail_cs_data_foreign_nw    "Connect to Internet in this country using cellular data? Data costs may increase considerably."
+
+//d:Option for connection query in foreign network.
+//l:list_single_pane_t1_cp2
+//w:
+//r:5.2
+//
+#define qtn_occ_list_cs_data_foreign_nw_this_time "Connect this time"
+
+//d:Option for connection query in foreign network.
+//l:list_single_pane_t1_cp2
+//w:
+//r:5.2
+//
+#define qtn_occ_list_cs_data_foreign_nw_automatic "Connect automatically"
+
+
+//d:Text of discreet popup row 1 informing the connection failure
+//l:popup_discreet_window_t1
+//w:
+//r:5.2
+//
+#define qtn_occ_connection_failed_discreet_popup_text1 "Connection failed"
+
+//d:Text of discreet popup row 2 informing reason for connection failure as Internal error.
+//l:popup_discreet_window_t2
+//w:
+//r:5.2
+//
+#define qtn_occ_internal_error_discreet_popup_text2 "Internal error"
+
+//d:Text of discreet popup row 2 informing connection failure because of no WLAN networks
+//l:popup_discreet_window_t2
+//w:
+//r:5.2
+//
+#define qtn_occ_wlan_not_found_discreet_popup_text2	"WLAN network not found"
+
+//d:Text of discreet popup row 2 informing connection/configuration failure 
+//d:because of unsuccessful authentication
+//l:popup_discreet_window_t2
+//w:
+//r:5.2
+//
+#define qtn_occ_auth_error_discreet_popup_text2	"Authentication unsuccessful"
+
+//d:Text of discreet popup row 2 informing connection failure because of 
+//d:incorrect security key
+//l:popup_discreet_window_t2
+//w:
+//r:5.2
+//
+#define qtn_occ_check_key_discreet_popup_text2	"Check security key"
+
+//d:Text of discreet popup row 2 informing connection failure because of 
+//d:incorrect connection settings
+//l:popup_discreet_window_t2
+//w:
+//r:5.2
+//
+#define qtn_occ_check_settings_discreet_popup_text2	"Check connection settings"
+
+//d:Text of discreet popup row 2 informing connection failure because of 
+//d:missing SIM card
+//l:popup_discreet_window_t2
+//w:
+//r:5.2
+//
+#define qtn_occ_sim_error_discreet_popup_text2	"SIM card missing"
+
+//d:Text of discreet popup row 2 informing connection failure because
+//d:of unreachable service
+//l:popup_discreet_window_t2
+//w:
+//r:5.2
+//
+#define qtn_occ_service_error_discreet_popup_text2	"Service unreachable"
+
+//d:Text of discreet popup row 2 informing connection failure because of 
+//d:permission denial
+//l:popup_discreet_window_t2
+//w:
+//r:5.2
+//
+#define qtn_occ_access_error_discreet_popup_text2	"Permission denied"
+
+//d:Text of discreet popup row 2 informing connection failure because 
+//d:another connection is already active
+//l:popup_discreet_window_t2
+//w:
+//r:5.2
+//
+#define qtn_occ_already_act_discreet_popup_text2	"Connection already active"
+
+//d:Text of discreet popup row 2 informing connection failure because 
+//d: signal is too weak
+//l:popup_discreet_window_t2
+//w:
+//r:5.2
+//
+#define qtn_occ_wlan_weak_discreet_popup_text2	"Signal too weak"
+
+//d:Text of discreet popup row 2 informing connection/configration failure and
+//d:suggesting to try again
+//l:popup_discreet_window_t2
+//w:
+//r:5.2
+//
+#define qtn_occ_try_again_discreet_popup_text2	"Please try again"
+
+//d:Text of discreet popup row 2 informing connection failure
+//l:popup_discreet_window_t2
+//w:
+//r:5.2
+//
+#define qtn_occ_conn_unavailable_discreet_popup_text2	"Connection unavailable"
+
+
+//d:Text of discreet popup row 1 informing configuration failure
+//l:popup_discreet_window_t1
+//w:
+//r:5.2
+//
+#define qtn_occ_config_failed_discreet_popup_text1 "Configuration failed"
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/src/ActiveCChangeConnectionDlg.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,234 @@
+/*
+* 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: 
+*     Defines dialog CActiveCChangeConnectionDlg from Connection Ui Utilities
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <StringLoader.h>
+#include <commdb.h>
+
+#ifndef __WINS__
+#include <wlanmgmtclient.h>
+#endif
+
+#include <ConnectionUiUtilities.rsg>
+
+#include "ActiveCChangeConnectionDlg.h"
+#include "ChangeConnectionDlg.h"
+#include "ConnectionUiUtilitiesPrivateCRKeys.h"
+#include "ConnectionDialogsLogger.h"
+#include "ConnectionInfoKey.h"
+#include "ConnectionInfo.h"
+#include "ConnectionInfoArray.h"
+
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CActiveCChangeConnectionDlg* CActiveCChangeConnectionDlg::NewL()
+// ---------------------------------------------------------
+//
+CActiveCChangeConnectionDlg* CActiveCChangeConnectionDlg::NewL( 
+                                              TUint32* aIAPId, 
+                                              const TConnectionPrefs& aPrefs,
+                                              TDes& aConnectionName  )
+    {
+    CLOG_ENTERFN( "CActiveCChangeConnectionDlg::NewL " );  
+    
+    CActiveCChangeConnectionDlg* self = 
+                         new ( ELeave ) CActiveCChangeConnectionDlg( aIAPId,
+                                                             aPrefs, 
+                                                             aConnectionName );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    
+    CLOG_LEAVEFN( "CActiveCChangeConnectionDlg::NewL " );      
+
+    return self;        
+    }
+
+// ---------------------------------------------------------
+// CActiveCChangeConnectionDlg::ConstructL()
+// ---------------------------------------------------------
+//
+void CActiveCChangeConnectionDlg::ConstructL()
+    {     
+    BaseConstructL();
+    }
+
+// ---------------------------------------------------------
+// CActiveCChangeConnectionDlg::CActiveCChangeConnectionDlg()
+// ---------------------------------------------------------
+//
+CActiveCChangeConnectionDlg::CActiveCChangeConnectionDlg(
+                                            TUint32* aIAPId, 
+                                            const TConnectionPrefs& aPrefs,
+                                            TDes& aConnectionName  ) 
+: CActiveIAPListing( aPrefs ), 
+  isDialogDeleting( EFalse ),
+  iIAPId( aIAPId ),
+  iConnectionName( aConnectionName ),
+  iSelected( EFalse )
+    {
+    }
+    
+// ---------------------------------------------------------
+// CActiveCChangeConnectionDlg::~CActiveCChangeConnectionDlg()
+// ---------------------------------------------------------
+//    
+CActiveCChangeConnectionDlg::~CActiveCChangeConnectionDlg()
+    {
+    }
+
+
+// ---------------------------------------------------------
+// CActiveCChangeConnectionDlg::Cancel()
+// ---------------------------------------------------------
+// 
+void CActiveCChangeConnectionDlg::Cancel()
+    {
+    CActiveIAPListing::Cancel();
+
+    if ( iWait.IsStarted() )
+        {
+        iWait.AsyncStop();            
+        }                 
+    }
+
+
+// ---------------------------------------------------------
+// CActiveCChangeConnectionDlg::DoCancel()
+// ---------------------------------------------------------
+// 
+void CActiveCChangeConnectionDlg::DoCancel()
+    {
+    CLOG_ENTERFN( "CActiveCChangeConnectionDlg::DoCancel " );  
+    
+    if( isDialogDeleting )
+        {
+        CLOG_WRITE( "isDialogDeleting" );
+        
+        delete iDialog;
+        iDialog = NULL;   
+        
+        isDialogDeleting = EFalse;         
+        }
+        
+    CLOG_LEAVEFN( "CActiveCChangeConnectionDlg::DoCancel " );          
+    }
+
+    
+// ---------------------------------------------------------
+// CActiveCChangeConnectionDlg::RunL()
+// ---------------------------------------------------------
+//     
+void CActiveCChangeConnectionDlg::RunL()
+    {
+    CLOG_ENTERFN( "CActiveCChangeConnectionDlg::RunL " );  
+    
+    CLOG_WRITEF( _L( "iStatus.Int() : %d" ), iStatus.Int() );
+    CLOG_WRITEF( _L( "&iStatus : %d" ), &iStatus );
+    
+    if( iStatus == KErrNone )
+        {
+        
+        if( iIAPs ) // if iIAPs has been created
+            {            
+            // merge arrays and sort
+            MergeArraysL( R_WLAN_SEARCH_FOR_NETWORKS );
+            
+            if ( iDialog )  // if dialog has been created
+                {
+                iDialog->RefreshDialogL();                    
+                }
+            else
+                {
+                
+                TInt interval = 0;
+                if ( iIsWLANFeatureSupported )
+                    {                                    
+                    interval = GetRefreshInterval(); 
+                    CLOG_WRITEF( _L( "interval : %d" ),  interval );
+
+                    if ( iWaitDialog )
+                        {
+                        iWaitDialog->ProcessFinishedL();     
+                        delete iWaitDialog;
+                        iWaitDialog = NULL;    
+                        }
+                     }
+
+                iDialog = CChangeConnectionDlg::NewL( iIAPId, this,
+                                                      iConnectionName );
+                iDialog->ExecuteLD( R_CHANGE_CONN_LIST_QUERY );
+
+                if ( iIsWLANFeatureSupported )
+                    {                                           
+                    if( interval )
+                        {
+                        StartTimerL( interval );
+                        }     
+                    }
+                }   // else
+            } // if iIAPs
+        else
+            {            
+            CreateArraysL( R_WLAN_SEARCH_FOR_NETWORKS, ETrue, *iIAPId );
+            }            
+        }     
+    else
+        {
+        Cancel();
+        CLOG_WRITEF( _L( "RUNL Cancelled iStatus : %d" ), iStatus.Int() );
+        }
+    
+    CLOG_LEAVEFN( "CActiveCChangeConnectionDlg::RunL " );      
+        
+    }
+    
+// ---------------------------------------------------------
+// CActiveCChangeConnectionDlg::StartSearchIAPsL()
+// ---------------------------------------------------------
+//    
+TBool CActiveCChangeConnectionDlg::StartSearchIAPsL()
+    {    
+    //if ( IsActive() == EFalse )
+        {
+        CActiveIAPListing::BaseStartSearchIAPsL( R_SEARCHING_WAIT_NOTE );
+
+        CLOG_WRITEF( _L( "iWait.IsStarted() : %b" ),  iWait.IsStarted() );
+        iWait.Start();
+        }
+        
+    return iSelected;           
+    }
+    
+// ---------------------------------------------------------
+// CActiveCChangeConnectionDlg::GetRefreshInterval()
+// ---------------------------------------------------------
+//    
+TInt CActiveCChangeConnectionDlg::GetRefreshInterval()
+    {
+    return CActiveIAPListing::GetRefreshInterval( KCRUidConnectionUiUtilities,
+                                    KConnectionUiUtilitiesChangeConnInterval );
+    }
+            
+    
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/src/ActiveWrapper.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,536 @@
+/*
+* 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: 
+*    CActiveWrapper implementation file
+*
+*
+*/
+
+
+#include <e32base.h>
+
+#include "ActiveWrapper.h"
+#include "ConnectionDialogsLogger.h"
+
+// LOCAL CONSTANTS AND MACROS
+
+// ---------------------------------------------------------
+// CActiveWrapper::NewL
+//
+// Two-phased constructor.
+// ---------------------------------------------------------
+//
+CActiveWrapper* CActiveWrapper::NewL( const TUint aIndexOfNote )
+    {
+    CLOG_ENTERFN( "CActiveWrapper::NewL()" );
+    CActiveWrapper* self = new ( ELeave ) CActiveWrapper( aIndexOfNote );
+    CleanupStack::PushL( self );
+
+    self->ConstructL();
+    
+    CleanupStack::Pop( self );
+    CLOG_LEAVEFN( "CActiveWrapper::NewL()" );
+    
+    return self;
+    }
+
+// ---------------------------------------------------------
+// CActiveWrapper::ConstructL
+//
+// Symbian OS default constructor can leave.
+// ---------------------------------------------------------
+//
+void CActiveWrapper::ConstructL()
+    {
+    CLOG_ENTERFN( "CActiveWrapper::ConstructL()" );
+
+    User::LeaveIfError( iNotif.Connect() );
+    CActiveScheduler::Add( this );
+
+    CLOG_LEAVEFN( "CActiveWrapper::ConstructL()" );
+    }
+
+
+// ---------------------------------------------------------
+// CActiveWrapper::CActiveWrapper
+//
+// C++ constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------
+//
+CActiveWrapper::CActiveWrapper( const TUint aIndexOfNote ) 
+: CActive( CActive::EPriorityStandard ),
+  iIndexOfNote( aIndexOfNote )
+    {
+    }
+
+
+// ---------------------------------------------------------
+// CActiveWrapper::~CActiveWrapper
+//
+// Destructor
+// ---------------------------------------------------------
+//
+CActiveWrapper::~CActiveWrapper()
+    {
+    CLOG_ENTERFN( "CActiveWrapper::~CActiveWrapper()" );
+
+    Cancel();
+
+    CLOG_WRITE( "CActiveWrapper::~CActiveWrapper Canceled" );
+
+    iNotif.Close();
+
+    CLOG_LEAVEFN( "CActiveWrapper::~CActiveWrapper()" );
+    }
+
+
+// ---------------------------------------------------------
+// CActiveWrapper::RunL
+//
+// From active object framework
+// ---------------------------------------------------------
+//
+void CActiveWrapper::RunL() 
+    {
+    CLOG_ENTERFN( "CActiveWrapper::RunL()" );            
+
+    CLOG_WRITEF( _L( "Completing request with %d" ), iStatus.Int() );
+
+    if ( iWait.IsStarted() )
+        {
+        CLOG_WRITEF( _L( "AsyncStop" ) );
+
+        iWait.AsyncStop();
+        }
+    else 
+        {
+        if( ( (iStatus == KErrNone) || ( iStatus == KErrNotFound ) ) )
+            {
+            switch ( iIndexOfNote )    
+                {
+                case ESearchWlan :
+                    {
+                    *iSSID = iNetworkPrefs().iSsId;
+                    *iConnectionMode = iNetworkPrefs().iNetworkMode;
+                    *iSecurityMode = iNetworkPrefs().iSecMode;
+                    *iExtSecurityMode = iNetworkPrefs().iExtSecMode;
+                    *iProtectedSetupSupported = 
+                                            iNetworkPrefs().iProtectedSetupSupported;
+
+                    HBufC* ssid16 = HBufC::NewLC( iNetworkPrefs().iSsId.Length() );
+                    ssid16->Des().Copy( *iSSID ); 
+                    CLOG_WRITEF( _L( "iSSID : %S" ), ssid16 );    
+                    CleanupStack::PopAndDestroy( ssid16 );
+
+                    CLOG_WRITEF( _L( "iConnectionMode : %d" ),  *iConnectionMode );    
+                    CLOG_WRITEF( _L( "iSecurityMode : %d" ),  *iSecurityMode );
+                    CLOG_WRITEF( _L( "iExtSecurityMode : %d" ),  *iExtSecurityMode );
+                    break;
+                    }
+                case EWlanEasyWep :
+                    {
+                    iKey->Copy( iWepKey().iKey );
+                    *iHex = iWepKey().iHex;        
+                    break;
+                    }
+                case EWlanEasyWpa :
+                    {
+                    iKey->Copy( iWpaKey() );
+                    break;
+                    }
+                default:
+                    {
+                    }
+                }
+            }
+
+        if ( iRS )
+            {
+            TRequestStatus* pS = iRS;
+            User::RequestComplete( pS, iStatus.Int() );
+            iRS = NULL;
+            }
+        }
+    
+    CLOG_LEAVEFN( "CActiveWrapper::RunL()" );                
+    }
+
+
+// ---------------------------------------------------------
+// CActiveWrapper::DoCancel
+//
+// From active object framework
+// ---------------------------------------------------------
+//
+void CActiveWrapper::DoCancel()
+    {
+    CLOG_ENTERFN( "CActiveWrapper::DoCancel()" );
+
+    switch( iIndexOfNote )
+        {
+        case ESearchWlan:
+            {
+            iNotif.CancelSearchWLANNetwork();
+            
+            if ( iRS )
+                {
+                TRequestStatus* pS = iRS;
+                User::RequestComplete( pS, KErrCancel );	
+                }
+            
+            break;
+            }
+
+        case EOffLineWlan:
+            {
+            iNotif.CancelOffLineWlanNote();
+            break;
+            }
+
+        case EConnViaDestCM:
+            {
+            iNotif.CancelConnectedViaDestAndConnMethodNote();
+            break;
+            }
+
+        case EChangingConnTo:
+            {
+            iNotif.CancelChangingConnectionToNote();
+            break;
+            }
+
+        case EConnViaCM:
+            {
+            iNotif.CancelConnectedViaConnMethodNote();            
+            break;
+            }
+        case EWlanEasyWep:
+            {
+            iNotif.CancelEasyWepDlg();
+            
+            if ( iRS )
+                {
+                TRequestStatus* pS = iRS;
+                User::RequestComplete( pS, KErrCancel );	
+                }
+                        
+            break;
+            }
+        case EWlanEasyWpa:
+            {
+            iNotif.CancelEasyWpaDlg();
+            
+            if ( iRS )
+                {
+                TRequestStatus* pS = iRS;
+                User::RequestComplete( pS, KErrCancel );	
+                }
+                        
+            break;
+            }
+        default:
+            {
+		    break;
+            }
+        }
+
+    if ( iWait.IsStarted() )
+        {
+        iWait.AsyncStop();
+        }
+
+    CLOG_LEAVEFN( "CActiveWrapper::DoCancel()" );
+    }
+
+
+// ---------------------------------------------------------
+// CActiveWrapper::StartSearchWLANNetwork
+//
+// Starts the active object
+// ---------------------------------------------------------
+//
+void CActiveWrapper::StartSearchWLANNetwork( 
+                        TPckgBuf<TConnUiUiWlanNetworkPrefs>& aNetworkPrefs )
+    {
+    CLOG_ENTERFN( "CActiveWrapper::StartSearchWLANNetwork()" );
+    
+    if ( IsActive() == EFalse )
+        {
+        CLOG_WRITE( "NOT active" );
+                        
+        iNotif.SearchWLANNetwork( aNetworkPrefs, iStatus, EFalse );
+        SetActive();
+        iWait.Start();
+        }
+    else
+        {
+        CLOG_WRITE( "Already active" );
+        }
+                        
+    CLOG_LEAVEFN( "CActiveWrapper::StartSearchWLANNetwork()" );
+    }
+
+
+// ---------------------------------------------------------
+// CActiveWrapper::StartSearchWLANNetworkAsync
+//
+// Starts the active object
+// ---------------------------------------------------------
+//
+void CActiveWrapper::StartSearchWLANNetworkAsync( TRequestStatus& aStatus, 
+                                TWlanSsid& aSSID,
+                                TWlanConnectionMode& aConnectionMode,
+                                TWlanConnectionSecurityMode& aSecurityMode,
+                                TWlanConnectionExtentedSecurityMode& aExtSecurityMode, 
+                                TBool& aProtectedSetupSupported )
+    {
+    CLOG_ENTERFN( "CActiveWrapper::StartSearchWLANNetworkAsync()" );
+    
+    if ( IsActive() == EFalse )
+        {
+        CLOG_WRITE( "NOT active" );
+
+        iSSID = &aSSID;
+        iConnectionMode = &aConnectionMode;
+        iSecurityMode = &aSecurityMode;
+        iExtSecurityMode = &aExtSecurityMode;
+        iProtectedSetupSupported = &aProtectedSetupSupported;
+        iNetworkPrefs();
+
+        iRS = &aStatus;
+        *iRS = KRequestPending;
+
+        SetActive();
+
+        iNotif.SearchWLANNetwork( iNetworkPrefs, iStatus, ETrue );
+        }
+    else
+        {
+        CLOG_WRITE( "Already active" );
+        }
+                        
+    CLOG_LEAVEFN( "CActiveWrapper::StartSearchWLANNetworkAsync()" );
+    }
+// ---------------------------------------------------------
+// CActiveWrapper::StartEasyWepDlg
+//
+// Starts the active object
+// ---------------------------------------------------------
+//
+TInt CActiveWrapper::StartEasyWepDlg( TPckgBuf< TWepKeyData >& aKey )
+    {
+    if ( IsActive() == EFalse )
+        {
+        iIndexOfNote = EWlanEasyWep;
+        iNotif.EasyWepDlg( aKey, iStatus );
+        SetActive();
+        iWait.Start();
+        }
+    return iStatus.Int();  
+    }
+
+// ---------------------------------------------------------
+// CActiveWrapper::StartEasyWepDlgAsync
+//
+// Starts the active object
+// ---------------------------------------------------------
+//
+void CActiveWrapper::StartEasyWepDlgAsync( TRequestStatus& aStatus, TDes* aKey, TBool& aHex )
+    {
+    if ( IsActive() == EFalse )
+        {
+        iKey = aKey;
+        iHex = &aHex;
+        iWepKey();
+        iWepKey().iKey.Copy( *aKey );
+        iIndexOfNote = EWlanEasyWep;
+        iNotif.EasyWepDlg( iWepKey, iStatus );
+        iRS = &aStatus;
+        *iRS = KRequestPending;        
+        SetActive();
+        }
+    }
+
+
+// ---------------------------------------------------------
+// CActiveWrapper::StartEasyWpaDlg
+//
+// Starts the active object
+// ---------------------------------------------------------
+//
+TInt CActiveWrapper::StartEasyWpaDlg( TPckgBuf< TBuf< KEasyWpaQueryMaxLength > >& aKey )
+    {
+    if ( IsActive() == EFalse )
+        {
+        iIndexOfNote = EWlanEasyWpa;
+        iNotif.EasyWpaDlg( aKey, iStatus );
+        SetActive();
+        iWait.Start();
+        }
+    return iStatus.Int();  
+    }
+
+// ---------------------------------------------------------
+// CActiveWrapper::StartEasyWpaDlgAsync
+//
+// Starts the active object
+// ---------------------------------------------------------
+//
+void CActiveWrapper::StartEasyWpaDlgAsync( TRequestStatus& aStatus, TDes* aKey )
+    {
+    if ( IsActive() == EFalse )
+        {
+        iKey = aKey;
+        iWpaKey();
+        iWpaKey().Copy( *aKey );
+        iIndexOfNote = EWlanEasyWpa;
+        iNotif.EasyWpaDlg( iWpaKey, iStatus );
+        iRS = &aStatus;
+        *iRS = KRequestPending;        
+        SetActive();
+        }
+    }
+
+// ---------------------------------------------------------
+// CActiveWrapper::StartGenericNote
+//
+// Starts the active object
+// ---------------------------------------------------------
+//
+void CActiveWrapper::StartGenericNote( const TUint aIndexOfNote, 
+                                       const TUint32 aConnMId /* = 0 */,
+                                       const TUint32 aDestId /* = 0 */ )
+    {
+    // Do not use logs here it cause crash in MPM server
+
+    if ( IsActive() == EFalse )
+        {
+        switch ( aIndexOfNote )
+            {
+            case EOffLineWlan:
+                {
+                iNotif.OffLineWlanNote( iStatus, EFalse );
+                break;
+                }
+
+            case EWlanDisabled:
+                {
+                iNotif.OffLineWlanDisabledNote( iStatus );
+                break;
+                }
+
+            case EWlanNetwUnavail:
+                {
+                iNotif.WLANNetworkUnavailableNote( iStatus );
+                break;
+                }
+
+            case EConnViaDestCM:
+                {
+                iNotif.ConnectedViaDestAndConnMethodNote( aDestId, aConnMId,
+                                                          iStatus );
+                break;
+                }
+
+            case EChangingConnTo:
+                {
+                iNotif.ChangingConnectionToNote( aConnMId, iStatus );
+                break;
+                }
+
+            case EConnViaCM:
+                {
+                iNotif.ConnectedViaConnMethodNote( aConnMId, iStatus );
+                break;
+                }
+
+            case ENoWlanNetwsAvail:
+                {
+                iNotif.NoWLANNetworksAvailableNote( iStatus );
+                break;
+                }
+
+            default:
+                {
+                return;
+                }
+            }
+
+        iIndexOfNote = aIndexOfNote;
+        SetActive();
+        iWait.Start();
+        }
+    else
+        {
+        }
+    }
+
+// ---------------------------------------------------------
+// CActiveWrapper::StartEasyWapiDlg
+//
+// Starts the active object
+// ---------------------------------------------------------
+//
+TInt CActiveWrapper::StartEasyWapiDlg( TPckgBuf< TBuf< KEasyWapiQueryMaxLength > >& aKey )
+    {
+    if ( IsActive() == EFalse )
+        {
+        iIndexOfNote = EWlanEasyWapi;
+        iNotif.EasyWapiDlg( aKey, iStatus );
+        SetActive();
+        iWait.Start();
+        }
+
+    return iStatus.Int();  
+    }
+
+// ---------------------------------------------------------
+// CActiveWrapper::StartConnectingViaDiscreetPopup
+//
+// Starts the active object
+// ---------------------------------------------------------
+//
+void CActiveWrapper::StartConnectingViaDiscreetPopup( TPckgBuf< TConnUiConnectingViaDiscreetPopup>& aInfo )
+    {
+    if ( IsActive() == EFalse )
+        {
+        iIndexOfNote = EConnectingViaDiscreetPopup;
+        iNotif.ConnectingViaDiscreetPopup( aInfo, iStatus );
+        SetActive();
+        iWait.Start();
+        }
+
+    }
+
+
+// ---------------------------------------------------------
+// CActiveWrapper::StartConnectionErrorDiscreetPopup
+//
+// Starts the active object
+// ---------------------------------------------------------
+//
+void CActiveWrapper::StartConnectionErrorDiscreetPopup( TPckgBuf<TInt>& aErrCode )
+    {
+    if ( IsActive() == EFalse )
+        {
+        iIndexOfNote = EConnectionErrorDiscreetPopup;
+        iNotif.ConnectionErrorDiscreetPopup( aErrCode, iStatus );
+        SetActive();
+        iWait.Start();
+        }
+
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/src/ChangeConnectionDlg.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,300 @@
+/*
+* Copyright (c) 2002 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 dialog CChangeConnectionDlg from Connection Ui Utilities
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <AknIconArray.h>
+#include <AknsUtils.h>
+#include <aknmessagequerycontrol.h>
+#include <StringLoader.h>
+#include <featmgr.h>
+#include <WlanCdbCols.h>
+
+#include <data_caging_path_literals.hrh>
+#include <ConnectionUiUtilities.rsg>
+#include <apsettings.mbg>
+
+#include "ChangeConnectionDlg.h"
+#include "ActiveCChangeConnectionDlg.h"
+#include "ConnectionDialogsLogger.h"
+#include "ExpiryTimer.h"
+
+// CONSTANTS
+
+// ROM folder
+_LIT( KDriveZ, "z:" );
+
+// Name of the MBM file containing icons
+_LIT( KFileIcons, "ApSettings.mbm" );
+
+#if defined(_DEBUG)
+_LIT( KErrNullPointer, "NULL pointer" );
+#endif
+
+LOCAL_D const TInt KIconsGranularity = 4;
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// Constructor
+CChangeConnectionDlg::CChangeConnectionDlg( TInt aIndex,
+                                    TUint32* aIAPId, 
+                                    CActiveCChangeConnectionDlg* aActiveDlg,
+                                    TDes& aConnectionName )
+: CAknListQueryDialog( &aIndex ),
+  iIAPId( aIAPId ),
+  iConnectionName( aConnectionName ),
+  iIsWLANFeatureSupported( EFalse ),
+  iActiveDlg( aActiveDlg )
+    {
+    }
+
+
+// Destructor
+CChangeConnectionDlg::~CChangeConnectionDlg()
+    {
+    delete iExpiryTimer;
+    }
+
+
+// ---------------------------------------------------------
+// CChangeConnectionDlg::NewL
+// ---------------------------------------------------------
+//
+CChangeConnectionDlg* CChangeConnectionDlg::NewL( TUint32* aIAPId, 
+                                      CActiveCChangeConnectionDlg* aActiveDlg,
+                                      TDes& aConnectionName)
+    {
+    CChangeConnectionDlg* temp = new ( ELeave )CChangeConnectionDlg(
+                                    0, aIAPId, aActiveDlg, aConnectionName );
+    CleanupStack::PushL( temp ); 
+    temp->ConstructL();                                    
+    CleanupStack::Pop( temp );
+    return temp;
+    }
+
+
+// ---------------------------------------------------------
+// CChangeConnectionDlg::ConstructAndRunLD
+// Constructs the dialog and runs it.
+// ---------------------------------------------------------
+//
+void CChangeConnectionDlg::ConstructL()
+    {
+    FeatureManager::InitializeLibL();
+    iIsWLANFeatureSupported = 
+                    FeatureManager::FeatureSupported( KFeatureIdProtocolWlan );
+    FeatureManager::UnInitializeLib();
+    }
+
+
+
+// ---------------------------------------------------------
+// CChangeConnectionDlg::OkToExitL( TInt aButtonId)
+// called by framework when the OK button is pressed
+// ---------------------------------------------------------
+//
+TBool CChangeConnectionDlg::OkToExitL( TInt aButtonId )
+    {
+    CLOG_ENTERFN( "CChangeConnectionDlg::OkToExitL " );  
+    
+    TBool result( EFalse );
+    __ASSERT_DEBUG( iActiveDlg, User::Panic( KErrNullPointer, KErrNone ) );
+    
+    
+    if ( aButtonId == EAknSoftkeySelect || aButtonId == EAknSoftkeyOk )
+        {
+        TInt index = ListBox()->CurrentItemIndex();
+        CConnectionInfo* tempInfo = iActiveDlg->ActIAPs()->At( index );
+        *iIAPId = tempInfo->Id();
+
+        CLOG_WRITEF( _L( "*iIAPId : %d" ), *iIAPId );
+        
+        iActiveDlg->Cancel();
+        iActiveDlg->SetSelected( ETrue );
+                
+        result = ETrue;
+        }
+    else if ( aButtonId == EAknSoftkeyCancel )
+        {
+        iActiveDlg->Cancel();  
+                  
+        result = ETrue;
+        }
+    
+    CLOG_LEAVEFN( "CChangeConnectionDlg::OkToExitL " );  
+    
+    return result;
+    }
+
+
+
+// ---------------------------------------------------------
+// CChangeConnectionDlg::PreLayoutDynInitL()
+// called by framework before dialog is shown
+// ---------------------------------------------------------
+//
+void CChangeConnectionDlg::PreLayoutDynInitL()
+    {
+    CLOG_ENTERFN( "CChangeConnectionDlg::PreLayoutDynInitL " );  
+    
+    CAknListQueryDialog::PreLayoutDynInitL();
+
+    HBufC *desc = StringLoader::LoadL( R_CHANGE_CONNECTION_DESC, 
+                                       iConnectionName );
+    CleanupStack::PushL( desc );
+    MessageBox()->SetMessageTextL( desc );
+    CleanupStack::PopAndDestroy( desc );
+
+    SetOwnershipType( ELbmOwnsItemArray );
+    SetItemTextArray( iActiveDlg->ActIAPs() );       
+    SetOwnershipType( ELbmDoesNotOwnItemArray );
+
+    SetIconsL();
+    
+    iExpiryTimer = CExpiryTimer::NewL( *this );
+    iExpiryTimer->Start();
+    CLOG_LEAVEFN( "CChangeConnectionDlg::PreLayoutDynInitL " );  
+    
+    }
+
+
+// ---------------------------------------------------------
+// CChangeConnectionDlg::RefreshDialogL
+// ---------------------------------------------------------
+//    
+void CChangeConnectionDlg::RefreshDialogL()
+    {  
+    CLOG_ENTERFN( "CChangeConnectionDlg::RefreshDialogL " );  
+     
+    SetItemTextArray( iActiveDlg->ActIAPs() );
+    ListBox()->HandleItemAdditionL();  
+    
+    Layout();   
+    SizeChanged();
+    DrawNow();
+    
+    CLOG_LEAVEFN( "CChangeConnectionDlg::RefreshDialogL " );  
+              
+    }
+
+
+// ---------------------------------------------------------
+// CChangeConnectionDlg::SetIconsL()
+// ---------------------------------------------------------
+//
+void CChangeConnectionDlg::SetIconsL()
+    {
+    CArrayPtr< CGulIcon >* icons = new( ELeave ) CAknIconArray( 
+                                                        KIconsGranularity );
+    CleanupStack::PushL( icons );
+
+    MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
+
+    TFileName iconsFileName;
+
+    iconsFileName.Append( KDriveZ );
+
+    iconsFileName.Append( KDC_APP_BITMAP_DIR );
+
+    iconsFileName.Append( KFileIcons );
+
+    icons->AppendL( AknsUtils::CreateGulIconL( skinInstance, 
+                            KAknsIIDQgnPropWmlGprs,
+                            iconsFileName, 
+                            EMbmApsettingsQgn_prop_wml_gprs, 
+                            EMbmApsettingsQgn_prop_wml_gprs_mask ) );
+
+    icons->AppendL( AknsUtils::CreateGulIconL( skinInstance, 
+                            KAknsIIDQgnPropWmlCsd,
+                            iconsFileName, 
+                            EMbmApsettingsQgn_prop_wml_csd, 
+                            EMbmApsettingsQgn_prop_wml_csd_mask ) );
+
+    icons->AppendL( AknsUtils::CreateGulIconL( skinInstance, 
+                            KAknsIIDQgnPropWmlHscsd,
+                            iconsFileName, 
+                            EMbmApsettingsQgn_prop_wml_hscsd, 
+                            EMbmApsettingsQgn_prop_wml_hscsd_mask ) );
+
+    if ( iIsWLANFeatureSupported )
+        {
+        icons->AppendL( AknsUtils::CreateGulIconL( skinInstance, 
+                            KAknsIIDQgnPropWlanEasy,
+                            iconsFileName, 
+                            EMbmApsettingsQgn_prop_wlan_easy, 
+                            EMbmApsettingsQgn_prop_wlan_easy_mask ) );
+    
+        icons->AppendL( AknsUtils::CreateGulIconL( skinInstance, 
+                            KAknsIIDQgnPropWlanBearer,
+                            iconsFileName, 
+                            EMbmApsettingsQgn_prop_wlan_bearer, 
+                            EMbmApsettingsQgn_prop_wlan_bearer_mask ) );
+        }
+    
+    SetIconArrayL( icons );
+
+    CleanupStack::Pop( icons );
+    }
+
+
+
+
+// ----------------------------------------------------------------------------
+// void CChangeConnectionDlg::HandleResourceChange( TInt aType )
+// Handle resource change events. 
+// ----------------------------------------------------------------------------
+//
+void CChangeConnectionDlg::HandleResourceChange( TInt aType )
+    {
+    if ( aType == KAknsMessageSkinChange )
+        {
+        CAknListQueryDialog::HandleResourceChange( aType );
+
+        TRAP_IGNORE( SetIconsL() );
+        SizeChanged();
+        }
+    else
+        {
+        if ( aType == KEikDynamicLayoutVariantSwitch )
+            {
+            TRect mainPaneRect;
+            AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane,
+                                               mainPaneRect );
+
+            TAknLayoutRect layoutRect;
+            layoutRect.LayoutRect( TRect( TPoint( 0, 0 ), 
+                                   mainPaneRect.Size() ),
+                                   AKN_LAYOUT_WINDOW_list_gen_pane( 0 ) );
+
+            ListBox()->SetRect( layoutRect.Rect() );
+            }
+
+        // Base call
+        CAknListQueryDialog::HandleResourceChange( aType );
+        }
+    }
+
+void CChangeConnectionDlg::HandleTimedOut()
+    {
+    TRAP_IGNORE( TryExitL(EAknSoftkeyCancel) );
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/src/ConnectionUiUtilities.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,627 @@
+/*
+* Copyright (c) 2004 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 CConnectionUiUtilities.
+*      
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <agentdialog.h>
+#include <ConnectionUiUtilities.h>
+
+#include "ConnectionUiUtilitiesImpl.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CConnectionUiUtilities::NewL
+// ---------------------------------------------------------
+//
+EXPORT_C CConnectionUiUtilities* CConnectionUiUtilities::NewL()
+    {
+    CConnectionUiUtilities* utils = new ( ELeave ) CConnectionUiUtilities();
+    CleanupStack::PushL( utils );
+    utils->iImpl = CConnectionUiUtilitiesImpl::NewL();
+    CleanupStack::Pop( utils ); 
+    return utils;
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionUiUtilities::~CConnectionUiUtilities
+// ---------------------------------------------------------
+//
+EXPORT_C CConnectionUiUtilities::~CConnectionUiUtilities()
+    {
+    delete iImpl;
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilities::AlwaysAskPageL
+// ---------------------------------------------------------
+//
+EXPORT_C TBool CConnectionUiUtilities::AlwaysAskPageL( 
+                                              TCuuAlwaysAskResults& aResult )
+    {
+    return iImpl->AlwaysAskPageL( aResult );
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionUiUtilities::ChangeConnectionL
+// ---------------------------------------------------------
+//
+EXPORT_C TBool CConnectionUiUtilities::ChangeConnectionL( 
+                                    TUint32& aIAPId, TConnectionPrefs aPrefs )
+    {
+    return iImpl->ChangeConnectionL( aIAPId, aPrefs );
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionUiUtilities::ShowConnectionChangedNoteL
+// ---------------------------------------------------------
+//
+EXPORT_C void CConnectionUiUtilities::ShowConnectionChangedNoteL( 
+                                                        const TUint32& aIAPId )
+    {
+    iImpl->ShowConnectionChangedNoteL( aIAPId );
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilities::SearchWLANNetwork
+// ---------------------------------------------------------
+//
+EXPORT_C TBool CConnectionUiUtilities::SearchWLANNetwork( TWlanSsid& aSSID )
+    {
+    TWlanConnectionMode connectionMode;
+    TWlanConnectionSecurityMode securityMode;
+    return iImpl->SearchWLANNetwork( aSSID, connectionMode, securityMode );
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionUiUtilities::CancelSearchWLANNetwork
+// ---------------------------------------------------------
+//
+EXPORT_C void CConnectionUiUtilities::CancelSearchWLANNetwork()
+    {
+    iImpl->CancelSearchWLANNetwork();
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilities::OffLineWlanNote
+// ---------------------------------------------------------
+//
+EXPORT_C TBool CConnectionUiUtilities::OffLineWlanNote()
+    {
+    return iImpl->OffLineWlanNote();
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilities::CancelOffLineWlanNote
+// ---------------------------------------------------------
+//
+EXPORT_C void CConnectionUiUtilities::CancelOffLineWlanNote()
+    {
+    iImpl->CancelOffLineWlanNote();
+    }
+    
+// ---------------------------------------------------------
+// CConnectionUiUtilities::OffLineWlanDisabledNote
+// ---------------------------------------------------------
+//
+EXPORT_C void CConnectionUiUtilities::OffLineWlanDisabledNote()
+    {
+    iImpl->OffLineWlanDisabledNote();
+    }
+ 
+// ---------------------------------------------------------
+// CConnectionUiUtilities::EasyWepDlg
+// ---------------------------------------------------------
+//
+EXPORT_C TBool CConnectionUiUtilities::EasyWepDlg( TDes* aKey )
+    {
+    TBool hex;
+    return iImpl->EasyWepDlg( aKey, hex );
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilities::CancelEasyWepDlg
+// ---------------------------------------------------------
+//
+EXPORT_C void CConnectionUiUtilities::CancelEasyWepDlg()
+    {
+    iImpl->CancelEasyWepDlg();
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilities::EasyWpaDlg
+// ---------------------------------------------------------
+//
+EXPORT_C TBool CConnectionUiUtilities::EasyWpaDlg( TDes* aKey )
+    {
+    return iImpl->EasyWpaDlg( aKey );
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilities::EasyWpaDlg
+// ---------------------------------------------------------
+//
+EXPORT_C void CConnectionUiUtilities::EasyWpaDlg( TRequestStatus& aStatus, TDes* aKey )
+    {
+    iImpl->EasyWpaDlgAsync( aStatus, aKey );
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilities::CancelEasyWpaDlg
+// ---------------------------------------------------------
+//
+EXPORT_C void CConnectionUiUtilities::CancelEasyWpaDlg()
+    {
+    iImpl->CancelEasyWpaDlg();
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilities::SearchWLANNetwork
+// ---------------------------------------------------------
+//
+EXPORT_C TBool CConnectionUiUtilities::SearchWLANNetwork( TWlanSsid& aSSID,
+                                TWlanConnectionMode& aConnectionMode,
+                                TWlanConnectionSecurityMode& aSecurityMode )
+    {
+    return iImpl->SearchWLANNetwork( aSSID, aConnectionMode, aSecurityMode );
+    }
+    
+// ---------------------------------------------------------
+// CConnectionUiUtilities::SearchWLANNetwork
+// ---------------------------------------------------------
+//
+EXPORT_C TBool CConnectionUiUtilities::SearchWLANNetwork( TWlanSsid& aSSID,
+                TWlanConnectionMode& aConnectionMode,
+                TWlanConnectionExtentedSecurityMode& aExtendedSecurityMode )
+    {
+    return iImpl->SearchWLANNetwork( aSSID, 
+                                     aConnectionMode, 
+                                     aExtendedSecurityMode );
+    }    
+
+// ---------------------------------------------------------
+// CConnectionUiUtilities::EasyWepDlg
+// ---------------------------------------------------------
+//
+EXPORT_C TBool CConnectionUiUtilities::EasyWepDlg( TDes* aKey, TBool& aHex )
+    {
+    return iImpl->EasyWepDlg( aKey, aHex );
+    }
+    
+// ---------------------------------------------------------
+// CConnectionUiUtilities::EasyWepDlg
+// ---------------------------------------------------------
+//
+EXPORT_C void CConnectionUiUtilities::EasyWepDlg( TRequestStatus& aStatus, TDes* aKey, TBool& aHex )
+    {
+    iImpl->EasyWepDlgAsync( aStatus, aKey, aHex );
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilities::WLANNetworkUnavailableNote
+// ---------------------------------------------------------
+//
+EXPORT_C void CConnectionUiUtilities::WLANNetworkUnavailableNote()
+    {
+    iImpl->WLANNetworkUnavailableNote();
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilities::SearchWLANNetworkSync
+// ---------------------------------------------------------
+//
+EXPORT_C TBool CConnectionUiUtilities::SearchWLANNetworkSync
+            (
+            TWlanSsid& aSSID, 
+            TWlanConnectionMode& aConnectionMode,
+            TWlanConnectionSecurityMode& aSecurityMode
+            )
+    {
+    return iImpl->SearchWLANNetworkSync( aSSID, aConnectionMode, 
+                                         aSecurityMode );
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilities::SearchWLANNetworkAsync
+// ---------------------------------------------------------
+//
+EXPORT_C void CConnectionUiUtilities::SearchWLANNetworkAsync( 
+                                TRequestStatus& aStatus,
+                                TWlanSsid& aSSID, 
+                                TWlanConnectionMode& aConnectionMode, 
+                                TWlanConnectionSecurityMode& aSecurityMode )
+    {
+    iImpl->SearchWLANNetworkAsync( aStatus, 
+                                   aSSID, aConnectionMode, aSecurityMode );
+    }
+    
+// ---------------------------------------------------------
+// CConnectionUiUtilities::SearchWLANNetworkAsync
+// ---------------------------------------------------------
+//
+EXPORT_C void CConnectionUiUtilities::SearchWLANNetworkAsync( 
+                TRequestStatus& aStatus,
+                TWlanSsid& aSSID, 
+                TWlanConnectionMode& aConnectionMode, 
+                TWlanConnectionExtentedSecurityMode& aExtendedSecurityMode )
+    {
+    iImpl->SearchWLANNetworkAsync( aStatus, 
+                                   aSSID, 
+                                   aConnectionMode, 
+                                   aExtendedSecurityMode );
+    }        
+
+// ---------------------------------------------------------
+// CConnectionUiUtilities::ConnectedViaDestAndConnMethodNote
+// ---------------------------------------------------------
+//
+EXPORT_C void CConnectionUiUtilities::ConnectedViaDestAndConnMethodNote( 
+                                                const TUint32 aDestId, 
+                                                const TUint32 aConnMId )
+    {
+    iImpl->ConnectedViaDestAndConnMethodNote( aDestId, aConnMId );    
+    }
+ 
+// ---------------------------------------------------------
+// CConnectionUiUtilities::ConnectedViaDestAndConnMethodNote
+// ---------------------------------------------------------
+//
+EXPORT_C void CConnectionUiUtilities::ConnectedViaDestAndConnMethodNote( 
+                                                const TUint32 aDestId, 
+                                                const TUint32 aConnMId, 
+                                                TRequestStatus& aStatus  )
+    {
+    iImpl->ConnectedViaDestAndConnMethodNote( aDestId, aConnMId, aStatus ); 
+    }
+           
+// ---------------------------------------------------------
+// CConnectionUiUtilities::CancelConnectedViaDestAndConnMethodNote
+// ---------------------------------------------------------
+//
+EXPORT_C void CConnectionUiUtilities::CancelConnectedViaDestAndConnMethodNote()
+    {
+    iImpl->CancelConnectedViaDestAndConnMethodNote();            
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilities::ReconnectToMethodQuery
+// ---------------------------------------------------------
+//
+EXPORT_C void CConnectionUiUtilities::ReconnectToMethodQuery( 
+                                                const TUint32 /*aConnMId*/, 
+                                                TBool& aResult,
+                                                TRequestStatus& aStatus )
+    {
+    aResult = EFalse;
+    TRequestStatus* pS = &aStatus;
+    User::RequestComplete( pS, KErrNotSupported );        
+    }
+    
+// ---------------------------------------------------------
+// CConnectionUiUtilities::CancelReconnectToMethodQuery
+// ---------------------------------------------------------
+//
+EXPORT_C void CConnectionUiUtilities::CancelReconnectToMethodQuery()
+    {    
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilities::RoamingToMorePrefMethodQuery
+// ---------------------------------------------------------
+//
+EXPORT_C void CConnectionUiUtilities::RoamingToMorePrefMethodQuery( 
+                                            const TUint32 /*aConnMId*/, 
+                                            TBool& aResult,
+                                            TRequestStatus& aStatus )
+    {
+    aResult = EFalse;
+    TRequestStatus* pS = &aStatus;
+    User::RequestComplete( pS, KErrNotSupported );
+    }
+    
+// ---------------------------------------------------------
+// CConnectionUiUtilities::CancelRoamingToMorePrefMethodQuery
+// ---------------------------------------------------------
+//
+EXPORT_C void CConnectionUiUtilities::CancelRoamingToMorePrefMethodQuery()
+    {      
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilities::ChangingConnectionToNote
+// ---------------------------------------------------------
+//
+EXPORT_C void CConnectionUiUtilities::ChangingConnectionToNote( 
+                                                const TUint32 aConnMId )
+    {
+    iImpl->ChangingConnectionToNote( aConnMId );                
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilities::ChangingConnectionToNote
+// ---------------------------------------------------------
+//    
+EXPORT_C void CConnectionUiUtilities::ChangingConnectionToNote( const TUint32 aConnMId, 
+        											TRequestStatus& aStatus )
+	{
+	iImpl->ChangingConnectionToNote( aConnMId, aStatus ); 
+	}
+
+// ---------------------------------------------------------
+// CConnectionUiUtilities::CancelChangingConnectionToNote
+// ---------------------------------------------------------
+//
+EXPORT_C void CConnectionUiUtilities::CancelChangingConnectionToNote()
+    {
+    iImpl->CancelChangingConnectionToNote();            
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilities::ConfirmMethodUsageQuery
+// ---------------------------------------------------------
+//
+EXPORT_C void CConnectionUiUtilities::ConfirmMethodUsageQuery(
+                                                    const TUint32 /*aDestId*/,
+                                                    const TUint32 /*aConnMId*/, 
+                                                    TBool& aResult, 
+                                                    TRequestStatus& aStatus )
+    {
+    aResult = EFalse;
+    TRequestStatus* pS = &aStatus;
+    User::RequestComplete( pS, KErrNotSupported );
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilities::CancelConfirmMethodUsageQuery
+// ---------------------------------------------------------
+//
+EXPORT_C void CConnectionUiUtilities::CancelConfirmMethodUsageQuery()
+    {
+    iImpl->CancelConfirmMethodUsageQuery();
+    }
+    
+
+// ---------------------------------------------------------
+// CConnectionUiUtilities::ConnectedViaConnMethodNote
+// ---------------------------------------------------------
+//
+EXPORT_C void CConnectionUiUtilities::ConnectedViaConnMethodNote( 
+                                                    const TUint32 aConnMId )
+    {
+    iImpl->ConnectedViaConnMethodNote( aConnMId );    
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilities::ConnectedViaConnMethodNote
+// ---------------------------------------------------------
+//
+EXPORT_C void CConnectionUiUtilities::ConnectedViaConnMethodNote( 
+                                                    const TUint32 aConnMId, 
+                                                    TRequestStatus& aStatus )
+    {
+    iImpl->ConnectedViaConnMethodNote( aConnMId , aStatus );    
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilities::CancelConnectedViaConnMethodNote
+// ---------------------------------------------------------
+//
+EXPORT_C void CConnectionUiUtilities::CancelConnectedViaConnMethodNote()
+    {
+    iImpl->CancelConnectedViaConnMethodNote();
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionUiUtilities::ReconnectToMethodQuery
+// ---------------------------------------------------------
+//
+EXPORT_C void CConnectionUiUtilities::ReconnectToMethodQuery( 
+                                              const TUint32 /*aDestId*/, 
+                                              const TUint32 /*aConnMId*/, 
+                                              const TBool /*aNextBestExists*/,
+                                              TMsgQueryLinkedResults& aResult,
+                                              TRequestStatus& aStatus )
+    {
+    aResult = EMsgQueryCancelled;
+    TRequestStatus* pS = &aStatus;
+    User::RequestComplete( pS, KErrNotSupported );
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilities::RoamingToMorePrefMethodQuery
+// ---------------------------------------------------------
+//
+EXPORT_C void CConnectionUiUtilities::RoamingToMorePrefMethodQuery( 
+                                            const TUint32 /*aDestId*/, 
+                                            const TUint32 /*aConnMId*/, 
+                                            const TBool /*aNextBestExists*/,
+                                            TMsgQueryLinkedResults& aResult,
+                                            TRequestStatus& aStatus )
+    {
+    aResult = EMsgQueryCancelled;
+    TRequestStatus* pS = &aStatus;
+    User::RequestComplete( pS, KErrNotSupported );
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilities::ConfirmMethodUsageQuery
+// ---------------------------------------------------------
+//
+EXPORT_C void CConnectionUiUtilities::ConfirmMethodUsageQuery(
+                                               TMsgQueryLinkedResults& aResult,
+                                               const TBool aHomeNetwork,
+                                               TRequestStatus& aStatus )
+    {
+    iImpl->ConfirmMethodUsageQuery( aResult, aHomeNetwork, aStatus );
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionUiUtilities::OffLineWlanNote
+// ---------------------------------------------------------
+//
+EXPORT_C void CConnectionUiUtilities::OffLineWlanNote( 
+                                                      TRequestStatus& aStatus )
+    {
+    iImpl->OffLineWlanNote( aStatus );
+    }
+    
+// ---------------------------------------------------------
+// CConnectionUiUtilities::WlanPowerSaveTestNote
+// ---------------------------------------------------------
+//
+EXPORT_C void CConnectionUiUtilities::WlanPowerSaveTestNote(
+                                               TBool&          aDisable,
+                                               TRequestStatus& aStatus )
+    {
+    iImpl->WlanPowerSaveTestNote( aDisable, aStatus );
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilities::CancelWlanPowerSaveTestNote
+// ---------------------------------------------------------
+//
+EXPORT_C void CConnectionUiUtilities::CancelWlanPowerSaveTestNote()
+    {
+    iImpl->CancelWlanPowerSaveTestNote();
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilities::EasyWapiDlg
+// ---------------------------------------------------------
+//
+EXPORT_C TBool CConnectionUiUtilities::EasyWapiDlg( TDes* aKey )
+    {
+    return iImpl->EasyWapiDlg( aKey );
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilities::NoWLANNetworksAvailable
+// ---------------------------------------------------------
+//
+EXPORT_C void CConnectionUiUtilities::NoWLANNetworksAvailableNote()
+    {
+    iImpl->NoWLANNetworksAvailableNote();
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilities::SearchWLANNetworkAsync
+// ---------------------------------------------------------
+//
+EXPORT_C void CConnectionUiUtilities::SearchWLANNetworkAsync( 
+                                TRequestStatus& aStatus,
+                                TWlanSsid& aSSID, 
+                                TWlanConnectionMode& aConnectionMode, 
+                                TWlanConnectionSecurityMode& aSecurityMode, 
+                                TBool& aProtectedSetupSupported )
+    {
+    iImpl->SearchWLANNetworkAsync( aStatus, aSSID, 
+                                   aConnectionMode, aSecurityMode,
+                                   aProtectedSetupSupported );
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilities::SearchWLANNetworkAsync
+// ---------------------------------------------------------
+//
+EXPORT_C void CConnectionUiUtilities::SearchWLANNetworkAsync( 
+                 TRequestStatus& aStatus,
+                 TWlanSsid& aSSID, 
+                 TWlanConnectionMode& aConnectionMode, 
+                 TWlanConnectionExtentedSecurityMode& aExtendedSecurityMode, 
+                 TBool& aProtectedSetupSupported )
+    {
+    iImpl->SearchWLANNetworkAsync( aStatus, 
+                                   aSSID, 
+                                   aConnectionMode, 
+                                   aExtendedSecurityMode,
+                                   aProtectedSetupSupported );
+    }
+    
+// ---------------------------------------------------------
+// CConnectionUiUtilities::SearchWLANNetworkSync
+// ---------------------------------------------------------
+//
+EXPORT_C TBool CConnectionUiUtilities::SearchWLANNetworkSync( TWlanSsid& aSSID,
+                                    TWlanConnectionMode& aConnectionMode,
+                                    TWlanConnectionSecurityMode& aSecurityMode,
+                                    TBool& aProtectedSetupSupported )
+    {
+    return iImpl->SearchWLANNetworkSync( aSSID, aConnectionMode, aSecurityMode,
+                                         aProtectedSetupSupported );
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilities::SearchWLANNetwork
+// ---------------------------------------------------------
+//
+EXPORT_C TBool CConnectionUiUtilities::SearchWLANNetwork( TWlanSsid& aSSID,
+                                    TWlanConnectionMode& aConnectionMode,
+                                    TWlanConnectionSecurityMode& aSecurityMode,
+                                    TBool& aProtectedSetupSupported )
+    {
+    return iImpl->SearchWLANNetwork( aSSID, aConnectionMode, aSecurityMode, 
+                                     aProtectedSetupSupported );
+    }
+        
+// ---------------------------------------------------------
+// CConnectionUiUtilities::SearchWLANNetwork
+// ---------------------------------------------------------
+//
+EXPORT_C TBool CConnectionUiUtilities::SearchWLANNetwork( 
+                    TWlanSsid& aSSID,
+                    TWlanConnectionMode& aConnectionMode,
+                    TWlanConnectionExtentedSecurityMode& aExtendedSecurityMode,
+                    TBool& aProtectedSetupSupported )
+    {
+    return iImpl->SearchWLANNetwork( aSSID, 
+                                     aConnectionMode, 
+                                     aExtendedSecurityMode, 
+                                     aProtectedSetupSupported );
+    } 
+
+// ---------------------------------------------------------
+// CConnectionUiUtilities::ConnectingViaDiscreetPopup
+// ---------------------------------------------------------
+//
+EXPORT_C void CConnectionUiUtilities::ConnectingViaDiscreetPopup( 
+        const TUint32& aIapId,
+        TBool aConnectionAlreadyActive )
+    {
+    iImpl->ConnectingViaDiscreetPopup( aIapId, aConnectionAlreadyActive );
+    } 
+
+// ---------------------------------------------------------
+// CConnectionUiUtilities::ConnectionErrorDiscreetPopup
+// ---------------------------------------------------------
+//
+EXPORT_C void CConnectionUiUtilities::ConnectionErrorDiscreetPopup( 
+        const TInt& aErrCode )
+    {
+    iImpl->ConnectionErrorDiscreetPopup( aErrCode );
+    } 
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/src/ConnectionUiUtilitiesClient.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,620 @@
+/*
+* Copyright (c) 2004 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 RConnectionUiUtilitiesSession
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "ConnectionUiUtilitiesClient.h"
+#include "ConnectionUiUtilitiesCommon.h"
+#include "e32ver.h"
+#include "ConnectionDialogsUidDefs.h"
+#include "ConnectionDialogsLogger.h"
+
+
+// ---------------------------------------------------------
+// RConnectionUiUtilitiesSession::RConnectionUiUtilitiesSession()
+// ---------------------------------------------------------
+//
+RConnectionUiUtilitiesSession::RConnectionUiUtilitiesSession()
+: RSessionBase(),
+  iNotifier( NULL ),
+  iBool( EFalse ),
+  iResponseMsgQuery( EMsgQueryCancelled ),
+  iPassedInfo( TConnUiUiDestConnMethodNoteId() )
+    {
+    }
+
+// ---------------------------------------------------------
+// ~RConnectionUiUtilitiesSession
+// ---------------------------------------------------------
+//
+RConnectionUiUtilitiesSession::~RConnectionUiUtilitiesSession()
+    {
+    delete iNotifier;
+    }
+
+// ---------------------------------------------------------
+// Connect
+//
+// Create a session to the extended notifier framework
+// ---------------------------------------------------------
+//
+TInt RConnectionUiUtilitiesSession::Connect()
+    {
+    TInt error( KErrNone );
+    if ( !iNotifier )
+        {
+        TRAP( error, iNotifier = new RNotifier() );
+        }
+    if ( !error && iNotifier )
+        {
+        error = iNotifier->Connect();
+        } 
+    return error;
+    }
+
+// ---------------------------------------------------------
+// Close
+// ---------------------------------------------------------
+//
+void RConnectionUiUtilitiesSession::Close()
+    {
+    if ( iNotifier )
+        {
+        iNotifier->Close();
+        }
+    }
+
+// ---------------------------------------------------------
+// RConnectionUiUtilitiesSession::SearchWLANNetwork()
+// ---------------------------------------------------------
+//
+void RConnectionUiUtilitiesSession::SearchWLANNetwork(
+                            TPckgBuf<TConnUiUiWlanNetworkPrefs>& aNetworkPrefs,
+                            TRequestStatus& aStatus,
+                            TBool aIsAsyncVersion )
+    {
+    CLOG_ENTERFN( "RConnectionUiUtilitiesSession::SearchWLANNetwork" );
+
+    if ( iNotifier )
+        {
+        ::new( &iBool ) TPckg<TBool>( aIsAsyncVersion );
+        iNotifier->StartNotifierAndGetResponse( aStatus, KUidSelectWLanDlg,
+                                                iBool, aNetworkPrefs );
+        }
+
+    CLOG_LEAVEFN( "RConnectionUiUtilitiesSession::SearchWLANNetwork" );
+    }
+
+// ---------------------------------------------------------
+// RConnectionUiUtilitiesSession::CancelSearchWLANNetwork()
+// ---------------------------------------------------------
+//
+void RConnectionUiUtilitiesSession::CancelSearchWLANNetwork()
+    {
+    CLOG_ENTERFN( "RConnectionUiUtilitiesSession::CancelSearchWLANNetwork" );
+
+    if ( iNotifier )
+        {
+        iNotifier->CancelNotifier( KUidSelectWLanDlg );
+        }
+
+    CLOG_LEAVEFN( "RConnectionUiUtilitiesSession::CancelSearchWLANNetwork" );
+    }
+    
+// ---------------------------------------------------------
+// RConnectionUiUtilitiesSession::OffLineWlanNote()
+// ---------------------------------------------------------
+//
+void RConnectionUiUtilitiesSession::OffLineWlanNote( TRequestStatus& aStatus,
+                                                     TBool aIsAsyncVersion )
+    {
+    CLOG_ENTERFN( "RConnectionUiUtilitiesSession::OffLineWlanNote" );
+
+    if ( iNotifier )
+        {
+        ::new( &iBool ) TPckg<TBool>( aIsAsyncVersion );
+        iNotifier->StartNotifierAndGetResponse( aStatus, 
+                                                KUidCOfflineWlanNoteDlg, 
+                                                iBool, 
+                                                iResponseStrOffLineWlanNote );
+        }
+
+    CLOG_LEAVEFN( "RConnectionUiUtilitiesSession::OffLineWlanNote" );
+    }    
+    
+// ---------------------------------------------------------
+// RConnectionUiUtilitiesSession::CancelOffLineWlanNote()
+// ---------------------------------------------------------
+//
+void RConnectionUiUtilitiesSession::CancelOffLineWlanNote()
+    {
+    CLOG_ENTERFN( "RConnectionUiUtilitiesSession::CancelOffLineWlanNote" );
+
+    if ( iNotifier )
+        {
+        iNotifier->CancelNotifier( KUidCOfflineWlanNoteDlg );
+        }
+
+    CLOG_LEAVEFN( "RConnectionUiUtilitiesSession::CancelOffLineWlanNote" );
+    }    
+
+// ---------------------------------------------------------
+// RConnectionUiUtilitiesSession::OffLineWlanDisabledNote()
+// ---------------------------------------------------------
+//
+void RConnectionUiUtilitiesSession::OffLineWlanDisabledNote(
+                                                     TRequestStatus& aStatus )
+    {    
+    CLOG_ENTERFN( "RConnectionUiUtilitiesSession::OffLineWlanDisabledNote" );
+
+    if ( iNotifier )
+        {
+        iNotifier->StartNotifierAndGetResponse( aStatus, 
+                                        KUidCOfflineWlanDisabledNoteDlg, 
+                                        KNullDesC8(), 
+                                        iResponseStrOffLineWlanDisabledNote );
+        }
+
+    CLOG_LEAVEFN( "RConnectionUiUtilitiesSession::OffLineWlanDisabledNote" );
+    }
+
+// ---------------------------------------------------------
+// RConnectionUiUtilitiesSession::EasyWepDlg()
+// ---------------------------------------------------------
+//
+void RConnectionUiUtilitiesSession::EasyWepDlg( TPckgBuf< TWepKeyData >& aKey,
+                                                TRequestStatus& aStatus )
+    {
+    CLOG_ENTERFN( "RConnectionUiUtilitiesSession::EasyWepDlg" );
+
+    if ( iNotifier )
+        {
+        iNotifier->StartNotifierAndGetResponse( aStatus, KUidEasyWepDlg,
+                                                aKey, aKey );
+        }
+
+    CLOG_LEAVEFN( "RConnectionUiUtilitiesSession::EasyWepDlg" );
+    }    
+    
+// ---------------------------------------------------------
+// RConnectionUiUtilitiesSession::CancelEasyWepDlg()
+// ---------------------------------------------------------
+//
+void RConnectionUiUtilitiesSession::CancelEasyWepDlg()
+    {
+    CLOG_ENTERFN( "RConnectionUiUtilitiesSession::CancelEasyWepDlg" );
+
+    if ( iNotifier )
+        {
+        iNotifier->CancelNotifier( KUidEasyWepDlg );
+        }
+
+    CLOG_LEAVEFN( "RConnectionUiUtilitiesSession::CancelEasyWepDlg" );
+    }    
+
+// ---------------------------------------------------------
+// RConnectionUiUtilitiesSession::EasyWpaDlg()
+// ---------------------------------------------------------
+//
+void RConnectionUiUtilitiesSession::EasyWpaDlg( 
+                            TPckgBuf< TBuf< KEasyWpaQueryMaxLength > >& aKey,
+                            TRequestStatus& aStatus )
+    {
+    CLOG_ENTERFN( "RConnectionUiUtilitiesSession::EasyWpaDlg" );
+
+    if ( iNotifier )
+        {
+        iNotifier->StartNotifierAndGetResponse( aStatus, KUidEasyWpaDlg,
+                                                aKey, aKey );
+        }
+
+    CLOG_LEAVEFN( "RConnectionUiUtilitiesSession::EasyWpaDlg" );
+    }    
+    
+// ---------------------------------------------------------
+// RConnectionUiUtilitiesSession::CancelEasyWpaDlg()
+// ---------------------------------------------------------
+//
+void RConnectionUiUtilitiesSession::CancelEasyWpaDlg()
+    {
+    CLOG_ENTERFN( "RConnectionUiUtilitiesSession::CancelEasyWpaDlg" );
+
+    if ( iNotifier )
+        {
+        iNotifier->CancelNotifier( KUidEasyWpaDlg );
+        }
+
+    CLOG_LEAVEFN( "RConnectionUiUtilitiesSession::CancelEasyWpaDlg" );
+    }    
+
+// ---------------------------------------------------------
+// RConnectionUiUtilitiesSession::WLANNetworkUnavailableNote()
+// ---------------------------------------------------------
+//
+void RConnectionUiUtilitiesSession::WLANNetworkUnavailableNote(
+                                                     TRequestStatus& aStatus )
+    {    
+    CLOG_ENTERFN( "RConnectionUiUtilitiesSession::WLANNetworkUnavailableNote" );
+
+    if ( iNotifier )
+        {
+        iNotifier->StartNotifierAndGetResponse( aStatus, 
+                                    KUidWLANNetworkUnavailableNoteDlg, 
+                                    KNullDesC8(), 
+                                    iResponseStrWLANNetworkUnavailableNote );
+        }
+
+    CLOG_LEAVEFN( "RConnectionUiUtilitiesSession::WLANNetworkUnavailableNote" );
+    }
+    
+// ---------------------------------------------------------
+// RConnectionUiUtilitiesSession::ConnectedViaDestAndConnMethodNote
+// ---------------------------------------------------------
+//
+void RConnectionUiUtilitiesSession::ConnectedViaDestAndConnMethodNote( 
+                                                    const TUint32 aDestId, 
+                                                    const TUint32 aConnMId,
+                                                    TRequestStatus& aStatus )
+    {
+    CLOG_ENTERFN( "RConnectionUiUtilitiesSession::ConnectedViaDestAndConnMethodNote" );
+
+    ::new( &iPassedInfo ) TPckgBuf<TConnUiUiDestConnMethodNoteId>( 
+                                            TConnUiUiDestConnMethodNoteId() );
+
+    iPassedInfo().iDestination = aDestId;    
+    iPassedInfo().iConnectionMethod = aConnMId;
+    iPassedInfo().iNoteId = EConnectedViaDestConnMethodConfirmationNote;
+    iPassedInfo().iNextBestExists = EFalse;
+    
+    if ( iNotifier )
+        {
+        iNotifier->StartNotifierAndGetResponse( aStatus, 
+                                                KUidConnectViaNote,
+                                                iPassedInfo,
+                                                iBool );
+        }
+
+    CLOG_LEAVEFN( "RConnectionUiUtilitiesSession::ConnectedViaDestAndConnMethodNote" );
+    }
+    
+// ---------------------------------------------------------
+// RConnectionUiUtilitiesSession::CancelConnectedViaDestAndConnMethodNote
+// ---------------------------------------------------------
+//
+void RConnectionUiUtilitiesSession::CancelConnectedViaDestAndConnMethodNote()
+    {
+    CLOG_ENTERFN( "RConnectionUiUtilitiesSession::CancelConnectedViaDestAndConnMethodNote" );
+
+    if ( iNotifier )
+        {
+        iNotifier->CancelNotifier( KUidConnectViaNote );
+        }
+
+    CLOG_LEAVEFN( "RConnectionUiUtilitiesSession::CancelConnectedViaDestAndConnMethodNote" );
+    }
+    
+
+// ---------------------------------------------------------
+// RConnectionUiUtilitiesSession::ChangingConnectionToNote
+// ---------------------------------------------------------
+//
+void RConnectionUiUtilitiesSession::ChangingConnectionToNote( 
+                                                const TUint32 aConnMId,
+                                                TRequestStatus& aStatus )
+    {
+    CLOG_ENTERFN( "RConnectionUiUtilitiesSession::ChangingConnectionToNote" );
+
+    ::new( &iPassedInfo ) TPckgBuf<TConnUiUiDestConnMethodNoteId>( 
+                                            TConnUiUiDestConnMethodNoteId() );
+
+    iPassedInfo().iDestination = 0;    
+    iPassedInfo().iConnectionMethod = aConnMId;
+    iPassedInfo().iNoteId = EConnectingToConnMethodInfoNote;
+    iPassedInfo().iNextBestExists = EFalse;
+    
+    if ( iNotifier )
+        {
+        iNotifier->StartNotifierAndGetResponse( aStatus, 
+                                                KUidConnectViaNote,
+                                                iPassedInfo,
+                                                iBool );
+        }
+
+    CLOG_LEAVEFN( "RConnectionUiUtilitiesSession::ChangingConnectionToNote" );
+    }
+        
+// ---------------------------------------------------------
+// RConnectionUiUtilitiesSession::CancelChangingConnectionToNote
+// ---------------------------------------------------------
+//
+void RConnectionUiUtilitiesSession::CancelChangingConnectionToNote()
+    {
+    CLOG_ENTERFN( "RConnectionUiUtilitiesSession::CancelChangingConnectionToNote" );
+
+    if ( iNotifier )
+        {
+        iNotifier->CancelNotifier( KUidConnectViaNote );
+        }
+
+    CLOG_LEAVEFN( "RConnectionUiUtilitiesSession::CancelChangingConnectionToNote" );
+    }
+    
+// ---------------------------------------------------------
+// RConnectionUiUtilitiesSession::ConfirmMethodUsageQuery()
+// ---------------------------------------------------------
+//
+void RConnectionUiUtilitiesSession::ConfirmMethodUsageQuery( 
+                                               TMsgQueryLinkedResults& aResult,
+                                               TBool aHomeNetwork,
+                                               TRequestStatus& aStatus )
+    {
+    CLOG_ENTERFN( "RConnectionUiUtilitiesSession::ConfirmMethodUsageQuery" );
+
+    ::new( &iResponseMsgQuery ) TPckg<TMsgQueryLinkedResults>( aResult );    
+    ::new( &iPassedInfo ) TPckgBuf<TConnUiUiDestConnMethodNoteId>( 
+                                            TConnUiUiDestConnMethodNoteId() );
+    
+    iPassedInfo().iNoteId = EConfirmMethodUsageQuery;
+    
+    // Set the dialog type depending on the location
+    if ( aHomeNetwork )
+        {
+        iPassedInfo().iNoteId = EConfirmMethodUsageQueryInHomeNetwork; 
+        }
+    else
+        {
+        iPassedInfo().iNoteId = EConfirmMethodUsageQueryInForeignNetwork; 
+        }
+    
+    if ( iNotifier )
+        {
+        iNotifier->StartNotifierAndGetResponse( aStatus, KUidConfirmationQuery,
+                                            iPassedInfo, iResponseMsgQuery );
+        }
+
+    CLOG_LEAVEFN( "RConnectionUiUtilitiesSession::ConfirmMethodUsageQuery" );
+    }    
+    
+// ---------------------------------------------------------
+// RConnectionUiUtilitiesSession::CancelConfirmMethodUsageQuery()
+// ---------------------------------------------------------
+//
+void RConnectionUiUtilitiesSession::CancelConfirmMethodUsageQuery()
+    {
+    CLOG_ENTERFN( "RConnectionUiUtilitiesSession::CancelConfirmMethodUsageQuery" );
+
+    if ( iNotifier )
+        {
+        iNotifier->CancelNotifier( KUidConfirmationQuery );
+        }
+
+    CLOG_LEAVEFN( "RConnectionUiUtilitiesSession::CancelConfirmMethodUsageQuery" );
+    }    
+
+
+// ---------------------------------------------------------
+// RConnectionUiUtilitiesSession::ConnectedViaConnMethodNote
+// ---------------------------------------------------------
+//
+void RConnectionUiUtilitiesSession::ConnectedViaConnMethodNote( 
+                                                    const TUint32 aConnMId,
+                                                    TRequestStatus& aStatus )
+    {
+    CLOG_ENTERFN( "RConnectionUiUtilitiesSession::ConnectedViaConnMethodNote" );
+
+    ::new( &iPassedInfo ) TPckgBuf<TConnUiUiDestConnMethodNoteId>( 
+                                            TConnUiUiDestConnMethodNoteId() );
+
+    iPassedInfo().iDestination = 0;
+    iPassedInfo().iConnectionMethod = aConnMId;
+    iPassedInfo().iNoteId = EConnectedViaConnMethodConfirmationNote;
+    iPassedInfo().iNextBestExists = EFalse;
+    
+    if ( iNotifier )
+        {
+        iNotifier->StartNotifierAndGetResponse( aStatus, 
+                                                KUidConnectViaNote,
+                                                iPassedInfo,
+                                                iBool );
+        }
+
+    CLOG_LEAVEFN( "RConnectionUiUtilitiesSession::ConnectedViaConnMethodNote" );
+    }
+    
+// ---------------------------------------------------------
+// RConnectionUiUtilitiesSession::CancelConnectedViaConnMethodNote
+// ---------------------------------------------------------
+//
+void RConnectionUiUtilitiesSession::CancelConnectedViaConnMethodNote()
+    {
+    CLOG_ENTERFN( "RConnectionUiUtilitiesSession::CancelConnectedViaConnMethodNote" );
+
+    if ( iNotifier )
+        {
+        iNotifier->CancelNotifier( KUidConnectViaNote );
+        }
+
+    CLOG_LEAVEFN( "RConnectionUiUtilitiesSession::CancelConnectedViaConnMethodNote" );
+    }
+
+// ---------------------------------------------------------
+// RConnectionUiUtilitiesSession::CWlanPowerSaveTestNote
+// ---------------------------------------------------------
+//
+void RConnectionUiUtilitiesSession::WlanPowerSaveTestNote( 
+                                                    TBool&          aDisable,
+                                                    TRequestStatus& aStatus )
+    {
+    CLOG_ENTERFN( "RConnectionUiUtilitiesSession::WlanPowerSaveTestNote" );
+
+    ::new( &iBool ) TPckg< TBool >( aDisable );
+
+    if ( iNotifier )
+        {
+        iNotifier->StartNotifierAndGetResponse( aStatus, 
+                                                KUidWlanPowerSaveTestNote,
+                                                KNullDesC8(),
+                                                iBool );
+        }
+
+    CLOG_LEAVEFN( "RConnectionUiUtilitiesSession::WlanPowerSaveTestNote" );
+    }
+    
+// ---------------------------------------------------------
+// RConnectionUiUtilitiesSession::CancelWlanPowerSaveTestNote
+// ---------------------------------------------------------
+//
+void RConnectionUiUtilitiesSession::CancelWlanPowerSaveTestNote()
+    {
+    CLOG_ENTERFN( "RConnectionUiUtilitiesSession::CancelWlanPowerSaveTestNote" );
+
+    if ( iNotifier )
+        {
+        iNotifier->CancelNotifier( KUidWlanPowerSaveTestNote );
+        }
+
+    CLOG_LEAVEFN( "RConnectionUiUtilitiesSession::CancelWlanPowerSaveTestNote" );
+    }
+
+// ---------------------------------------------------------
+// RConnectionUiUtilitiesSession::EasyWapiDlg()
+// ---------------------------------------------------------
+//
+void RConnectionUiUtilitiesSession::EasyWapiDlg( 
+                            TPckgBuf< TBuf< KEasyWapiQueryMaxLength > >& aKey,
+                            TRequestStatus& aStatus )
+    {
+    CLOG_ENTERFN( "RConnectionUiUtilitiesSession::EasyWapiDlg" );
+
+    if ( iNotifier )
+        {
+        iNotifier->StartNotifierAndGetResponse( aStatus, KUidEasyWapiDlg,
+                                                aKey, aKey );
+        }
+
+    CLOG_LEAVEFN( "RConnectionUiUtilitiesSession::EasyWapiDlg" );
+    }    
+    
+// ---------------------------------------------------------
+// RConnectionUiUtilitiesSession::CancelEasyWapiDlg()
+// ---------------------------------------------------------
+//
+void RConnectionUiUtilitiesSession::CancelEasyWapiDlg()
+    {
+    CLOG_ENTERFN( "RConnectionUiUtilitiesSession::CancelEasyWapiDlg" );
+
+    if ( iNotifier )
+        {
+        iNotifier->CancelNotifier( KUidEasyWapiDlg );
+        }
+
+    CLOG_LEAVEFN( "RConnectionUiUtilitiesSession::CancelEasyWapiDlg" );
+    }
+
+// ---------------------------------------------------------
+// RConnectionUiUtilitiesSession::NoWLANNetworksAvailableNote()
+// ---------------------------------------------------------
+//
+void RConnectionUiUtilitiesSession::NoWLANNetworksAvailableNote(
+                                                     TRequestStatus& aStatus )
+    {    
+    CLOG_ENTERFN( "RConnectionUiUtilitiesSession::NoWLANNetworksAvailableNote" );
+
+    if ( iNotifier )
+        {
+        iNotifier->StartNotifierAndGetResponse( aStatus, 
+                                    KUidNoWLANNetworksAvailableNote, 
+                                    KNullDesC8(), 
+                                    iResponseStrNoWLANNetworksAvailableNote );
+        }
+
+    CLOG_LEAVEFN( "RConnectionUiUtilitiesSession::NoWLANNetworksAvailableNote" );
+    }    
+
+// ---------------------------------------------------------
+// RConnectionUiUtilitiesSession::ConnectingViaDiscreetPopup()
+// ---------------------------------------------------------
+//
+void RConnectionUiUtilitiesSession::ConnectingViaDiscreetPopup( 
+        TPckgBuf< TConnUiConnectingViaDiscreetPopup>& aInfo,
+        TRequestStatus& aStatus )
+    {
+    CLOG_ENTERFN( "RConnectionUiUtilitiesSession::ConnectingViaDiscreetPopup" );
+
+    if ( iNotifier )
+        {
+        iNotifier->StartNotifierAndGetResponse( aStatus, KUidConnectingViaDiscreetPopup,
+                                                aInfo, aInfo );
+        }
+
+    CLOG_LEAVEFN( "RConnectionUiUtilitiesSession::ConnectingViaDiscreetPopup" );
+    }    
+    
+// ---------------------------------------------------------
+// RConnectionUiUtilitiesSession::CancelConnectingViaDiscreetPopup()
+// ---------------------------------------------------------
+//
+void RConnectionUiUtilitiesSession::CancelConnectingViaDiscreetPopup()
+    {
+    CLOG_ENTERFN( "RConnectionUiUtilitiesSession::CancelConnectingViaDiscreetPopup" );
+
+    if ( iNotifier )
+        {
+        iNotifier->CancelNotifier( KUidConnectingViaDiscreetPopup );
+        }
+
+    CLOG_LEAVEFN( "RConnectionUiUtilitiesSession::CancelConnectingViaDiscreetPopup" );
+    }    
+
+
+// ---------------------------------------------------------
+// RConnectionUiUtilitiesSession::ConnectionErrorDiscreetPopup()
+// ---------------------------------------------------------
+//
+void RConnectionUiUtilitiesSession::ConnectionErrorDiscreetPopup( 
+        TPckgBuf< TInt >& aErrCode,
+        TRequestStatus& aStatus )
+    {
+    CLOG_ENTERFN( "RConnectionUiUtilitiesSession::ConnectionErrorDiscreetPopup" );
+
+    if ( iNotifier )
+        {
+        iNotifier->StartNotifierAndGetResponse( aStatus, KUidConnectionErrorDiscreetPopup,
+                                                aErrCode, aErrCode );
+        }
+
+    CLOG_LEAVEFN( "RConnectionUiUtilitiesSession::ConnectionErrorDiscreetPopup" );
+    }    
+    
+// ---------------------------------------------------------
+// RConnectionUiUtilitiesSession::CancelConnectionErrorDiscreetPopup()
+// ---------------------------------------------------------
+//
+void RConnectionUiUtilitiesSession::CancelConnectionErrorDiscreetPopup()
+    {
+    CLOG_ENTERFN( "RConnectionUiUtilitiesSession::CancelConnectionErrorDiscreetPopup" );
+
+    if ( iNotifier )
+        {
+        iNotifier->CancelNotifier( KUidConnectionErrorDiscreetPopup );
+        }
+
+    CLOG_LEAVEFN( "RConnectionUiUtilitiesSession::CancelConnectionErrorDiscreetPopup" );
+    }    
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/src/ConnectionUiUtilitiesImpl.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,1167 @@
+/*
+* Copyright (c) 2004 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 CConnectionUiUtilitiesImpl.   
+*      
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <bautils.h>
+#include <StringLoader.h>
+#include <commdb.h>
+#include <aknnotewrappers.h>
+#include <AknGlobalNote.h>
+#include <aknradiobuttonsettingpage.h>
+#include <ConnectionUiUtilities.h>
+#include <AknsUtils.h>
+#include <featmgr.h>
+#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include <commsdat.h>
+#else
+#include <commsdat.h>
+#include <commsdat_partner.h>
+#endif
+
+#ifndef __WINS__
+#include <wlanmgmtclient.h>
+#include <WlanCdbCols.h>
+#endif  // ! __WINS__
+
+#include "ConnectionUiUtilitiesImpl.h"
+#include "ChangeConnectionDlg.h"
+#include "ActiveCChangeConnectionDlg.h"
+
+#include <ConnectionUiUtilities.rsg>
+#include <data_caging_path_literals.hrh>
+
+#include "ConnectionDialogsLogger.h"
+
+
+// CONSTANTS
+
+// ROM folder
+_LIT( KDriveZ, "z:" );
+
+// RSC file name.
+_LIT( KConnUiUtilsResName, "ConnectionUiUtilities.rsc" );
+
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CConnectionUiUtilitiesImpl::NewL
+// ---------------------------------------------------------
+//
+CConnectionUiUtilitiesImpl* CConnectionUiUtilitiesImpl::NewL()
+    {
+    CConnectionUiUtilitiesImpl* utilsImpl = 
+                                new ( ELeave ) CConnectionUiUtilitiesImpl();
+    CleanupStack::PushL( utilsImpl );
+    utilsImpl->ConstructL();
+    CleanupStack::Pop( utilsImpl ); 
+    return utilsImpl;
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionUiUtilitiesImpl::CConnectionUiUtilitiesImpl
+// ---------------------------------------------------------
+//
+CConnectionUiUtilitiesImpl::CConnectionUiUtilitiesImpl() 
+: iResOffset( 0 ),
+  iIsWlanSupported( EFalse )
+    {
+    for ( TInt i = 0; i < KNumberOfWrappedDialogs; i++ )
+        {
+        iActiveWrapper[i] = NULL;
+        }
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionUiUtilitiesImpl::ConstructL
+// ---------------------------------------------------------
+//
+void CConnectionUiUtilitiesImpl::ConstructL()
+    {
+    User::LeaveIfError( iNotif.Connect() );    
+
+    FeatureManager::InitializeLibL();
+    iIsWlanSupported = 
+                FeatureManager::FeatureSupported( KFeatureIdProtocolWlan );
+    FeatureManager::UnInitializeLib();
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionUiUtilitiesImpl::~CConnectionUiUtilitiesImpl
+// ---------------------------------------------------------
+//
+CConnectionUiUtilitiesImpl::~CConnectionUiUtilitiesImpl()
+    {    
+    if ( iResOffset )
+        {
+        CCoeEnv::Static()->DeleteResourceFile( iResOffset );
+        }
+    iNotif.Close();
+
+    for ( TInt i = 0; i < KNumberOfWrappedDialogs; i++ )
+        {
+        delete iActiveWrapper[i];
+        }
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilitiesImpl::LoadResourceFileL
+// ---------------------------------------------------------
+//    
+void CConnectionUiUtilitiesImpl::LoadResourceFileL()
+    {
+    if ( !iResOffset )
+        {
+        // can't use resource here because it has not been added yet....
+        TFileName fileName;
+
+        fileName.Append( KDriveZ );
+        fileName.Append( KDC_RESOURCE_FILES_DIR );
+        fileName.Append( KConnUiUtilsResName );
+
+        BaflUtils::NearestLanguageFile( CCoeEnv::Static()->FsSession(), 
+                                        fileName );
+        iResOffset = CCoeEnv::Static()->AddResourceFileL( fileName );
+        }
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilitiesImpl::AlwaysAskPageL
+// ---------------------------------------------------------
+//
+
+TBool CConnectionUiUtilitiesImpl::AlwaysAskPageL( 
+                                                TCuuAlwaysAskResults& aResult )
+    {
+    LoadResourceFileL();
+    // options array
+    CDesCArrayFlat* values = new( ELeave )CDesCArrayFlat( 1 );
+    CleanupStack::PushL( values );
+
+    HBufC* value1 = CCoeEnv::Static()->AllocReadResourceLC( 
+                                                R_ALWAYS_ASK_ALWAYS_ASK );
+    values->AppendL( *value1 );
+    CleanupStack::PopAndDestroy( value1 );
+
+    HBufC* value2 = CCoeEnv::Static()->AllocReadResourceLC( 
+                                                R_ALWAYS_ASK_USER_DEFINED );
+    values->AppendL( *value2 );
+    CleanupStack::PopAndDestroy( value2 );
+
+    TInt index( 0 );
+      switch ( aResult )
+        {
+        case ECuuAlwaysAsk:
+            {
+            index = 0;
+            break;
+            }
+        case ECuuUserDefined:
+            {
+            index = 1;
+            break;
+            }
+        default:
+            break;
+        }
+  
+    CAknRadioButtonSettingPage* dlg = new ( ELeave )CAknRadioButtonSettingPage(
+                                            R_ALWAYS_ASK_PAGE, index, values );
+
+    TBool oKPressed( EFalse );
+    
+    CleanupStack::PushL( dlg );
+
+    AknsUtils::SetAvkonSkinEnabledL( ETrue );
+    
+    CleanupStack::Pop( dlg );
+    
+    if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )
+        {
+        oKPressed = ETrue;
+        }
+
+    switch ( index )
+        {
+        case 0:
+            {
+            aResult = ECuuAlwaysAsk;
+            break;
+            }
+        case 1:
+            {
+            aResult = ECuuUserDefined;
+            break;
+            }
+        default:
+            break;
+        }
+
+      CleanupStack::PopAndDestroy( values );
+
+    return oKPressed;
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilitiesImpl::ChangeConnectionL
+// ---------------------------------------------------------
+//
+TBool CConnectionUiUtilitiesImpl::ChangeConnectionL( TUint32& aIAPId,
+                                                     TConnectionPrefs aPrefs )
+    {
+    CLOG_ENTERFN( "CConnectionUiUtilitiesImpl::ChangeConnectionL " );  
+    
+    TUint32 origId = aIAPId;
+    LoadResourceFileL();
+    CCommsDatabase* db = CCommsDatabase::NewL( EDatabaseTypeUnspecified );
+    CleanupStack::PushL( db );
+
+    TBuf<CommsDat::KMaxTextLength> connName;
+
+    GetConnectionNameL( aIAPId, *db, connName );
+    CleanupStack::PopAndDestroy( db ); // db
+    
+    CActiveCChangeConnectionDlg* activeChangeConnDlg =
+                CActiveCChangeConnectionDlg::NewL( &aIAPId, aPrefs, connName );
+    CleanupStack::PushL( activeChangeConnDlg );
+            
+    TBool retval = activeChangeConnDlg->StartSearchIAPsL();    
+    
+    CLOG_WRITE( "activeChangeConnDlg->StartSearchIAPsL();" );
+            
+    CLOG_WRITEF( _L( "aIAPId : %d" ),  aIAPId );
+    CLOG_WRITEF( _L( "origId : %d" ),  origId );
+    CLOG_WRITEF( _L( "retval : %d" ),  retval );
+    
+    CleanupStack::PopAndDestroy( activeChangeConnDlg );     
+    
+    CLOG_LEAVEFN( "CConnectionUiUtilitiesImpl::ChangeConnectionL " );  
+
+    return retval;
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionUiUtilitiesImpl::ShowConnectionChangedNoteL
+// ---------------------------------------------------------
+//
+void CConnectionUiUtilitiesImpl::ShowConnectionChangedNoteL( 
+                                                        const TUint32& aIAPId )
+
+    {
+    LoadResourceFileL();
+    CCommsDatabase* db = CCommsDatabase::NewL( EDatabaseTypeUnspecified );
+    CleanupStack::PushL( db );
+
+    TBuf<CommsDat::KMaxTextLength> connName;
+
+    GetConnectionNameL( aIAPId, *db, connName );
+    CleanupStack::PopAndDestroy( db );
+
+    HBufC* stringLabel = StringLoader::LoadLC( R_CONN_CHANGED, connName );
+
+    CAknInformationNote* infNote = new( ELeave )CAknInformationNote();
+    infNote->ExecuteLD( *stringLabel );
+
+    CleanupStack::PopAndDestroy( stringLabel );
+    }
+
+
+
+// ---------------------------------------------------------
+// CConnectionUiUtilitiesImpl::SearchWLANNetwork
+// ---------------------------------------------------------
+//
+TBool CConnectionUiUtilitiesImpl::SearchWLANNetwork( TWlanSsid& aSSID,
+                                TWlanConnectionMode& aConnectionMode,
+                                TWlanConnectionSecurityMode& aSecurityMode )
+    {
+    return SearchWLANNetwork( aSSID, 
+                              aConnectionMode, 
+                              aSecurityMode, 
+                              iDummyExtSecMode, 
+                              iDummy );
+    }
+    
+// ---------------------------------------------------------
+// CConnectionUiUtilitiesImpl::SearchWLANNetwork
+// ---------------------------------------------------------
+//
+TBool CConnectionUiUtilitiesImpl::SearchWLANNetwork( TWlanSsid& aSSID,
+                                TWlanConnectionMode& aConnectionMode,
+                                TWlanConnectionExtentedSecurityMode& aExtSecurityMode )
+    {
+    return SearchWLANNetwork( aSSID, 
+                              aConnectionMode, 
+                              iDummySecMode, 
+                              aExtSecurityMode, 
+                              iDummy );
+    }    
+
+// ---------------------------------------------------------
+// CConnectionUiUtilitiesImpl::SearchWLANNetwork
+// ---------------------------------------------------------
+//
+TBool CConnectionUiUtilitiesImpl::SearchWLANNetwork( TWlanSsid& aSSID,
+                                TWlanConnectionMode& aConnectionMode,
+                                TWlanConnectionSecurityMode& aSecurityMode, 
+                                TBool& aProtectedSetupSupported )
+    {
+    return SearchWLANNetwork( aSSID, 
+                              aConnectionMode, 
+                              aSecurityMode, 
+                              iDummyExtSecMode, 
+                              aProtectedSetupSupported );
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilitiesImpl::SearchWLANNetwork
+// ---------------------------------------------------------
+//    
+TBool CConnectionUiUtilitiesImpl::SearchWLANNetwork( TWlanSsid& aSSID,
+                                TWlanConnectionMode& aConnectionMode,
+                                TWlanConnectionExtentedSecurityMode& aExtSecurityMode, 
+                                TBool& aProtectedSetupSupported )
+    {
+    return SearchWLANNetwork( aSSID, 
+                              aConnectionMode, 
+                              iDummySecMode, 
+                              aExtSecurityMode, 
+                              aProtectedSetupSupported );
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilitiesImpl::SearchWLANNetwork
+// ---------------------------------------------------------
+//
+TBool CConnectionUiUtilitiesImpl::SearchWLANNetwork( TWlanSsid& aSSID,
+                                TWlanConnectionMode& aConnectionMode,
+                                TWlanConnectionSecurityMode& aSecurityMode,
+                                TWlanConnectionExtentedSecurityMode& aExtSecurityMode, 
+                                TBool& aProtectedSetupSupported )
+    {
+    TBool result( EFalse );
+    
+    if ( iIsWlanSupported )
+        {
+        iNetworkPrefs();
+
+        if ( !iActiveWrapper[ESearchWlan] )
+            {
+            TRAP_IGNORE( iActiveWrapper[ESearchWlan] = 
+                                        CActiveWrapper::NewL( ESearchWlan ) );
+            }
+
+        if ( iActiveWrapper[ESearchWlan] )
+            {
+            iActiveWrapper[ESearchWlan]->StartSearchWLANNetwork( 
+                                                            iNetworkPrefs );
+
+            CLOG_WRITEF( _L( "iActiveWrapper[ESearchWlan]->iStatus.Int(): %d" ),  
+                           iActiveWrapper[ESearchWlan]->iStatus.Int() );
+
+            result = iActiveWrapper[ESearchWlan]->iStatus.Int() ? EFalse : 
+                                                                  ETrue;
+            }
+    
+        if( result )
+            {
+            aSSID = iNetworkPrefs().iSsId;
+            aConnectionMode = iNetworkPrefs().iNetworkMode;
+            aSecurityMode = iNetworkPrefs().iSecMode;
+            aExtSecurityMode = iNetworkPrefs().iExtSecMode;
+            aProtectedSetupSupported = 
+                                    iNetworkPrefs().iProtectedSetupSupported;
+            }
+        }    
+    
+    CLOG_WRITEF( _L( "SearchWLANNetwork result : %b" ),  result ); 
+                       
+    return result;        
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionUiUtilitiesImpl::CancelSearchWLANNetwork
+// ---------------------------------------------------------
+//
+void CConnectionUiUtilitiesImpl::CancelSearchWLANNetwork()
+    {
+    if ( iIsWlanSupported )
+        {
+        iActiveWrapper[ESearchWlan]->Cancel();
+        }
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionUiUtilitiesImpl::GetConnectionNameL
+// ---------------------------------------------------------
+//
+void CConnectionUiUtilitiesImpl::GetConnectionNameL( const TUint32& aIAPId,
+                                                     CCommsDatabase& aDb,
+                                                     TDes& aConnectionName )
+    {
+    __ASSERT_DEBUG( &aDb, User::Panic( KErrNullPointer, KErrNone ) );
+
+    CCommsDbTableView* table = aDb.OpenViewMatchingUintLC( TPtrC( IAP ), 
+                                                           TPtrC( COMMDB_ID ),
+                                                           aIAPId );
+    User::LeaveIfError( table->GotoFirstRecord() );
+    table->ReadTextL( TPtrC( COMMDB_NAME ), aConnectionName );
+    if ( aConnectionName.Length() == 0 || 
+         aConnectionName.Left( KMrouterName().Length() ).CompareF( 
+                                                    KMrouterName ) == 0 )
+        {
+        User::Leave( KErrGeneral );
+        }
+
+    TUint32 serviceId;
+    // Get IAP service
+    table->ReadUintL( TPtrC( IAP_SERVICE ), serviceId );
+
+    CleanupStack::PopAndDestroy( table );
+
+#ifndef __WINS__        
+    if ( iIsWlanSupported )
+        {
+        CCommsDbTableView* wLanServiceTable = NULL;
+            
+        TRAPD( err, 
+            { // this leaves if the table is empty....
+            wLanServiceTable = aDb.OpenViewMatchingUintLC( 
+                                                    TPtrC( WLAN_SERVICE ),
+                                                    TPtrC( WLAN_SERVICE_ID ),
+                                                    serviceId );
+            CleanupStack::Pop( wLanServiceTable ); // wLanServiceTable
+            } );
+
+        CLOG_WRITEF( _L( "OpenViewMatchingUintLC returned %d" ), err );
+
+        if ( err == KErrNone )
+            {
+            CleanupStack::PushL( wLanServiceTable );
+
+            TInt errorCode = wLanServiceTable->GotoFirstRecord();
+            TWlanSsid ssid;
+            
+            if ( errorCode == KErrNone )
+                {
+                wLanServiceTable->ReadTextL( TPtrC( NU_WLAN_SSID ), ssid );
+                if ( ssid.Length() == 0 )
+                    {
+                    CLOG_WRITEF( _L( "It is the EasyWlan!" ) );
+
+                    TWlanSsid ssidConn;
+                    CWlanMgmtClient *wlanMgmtClient = CWlanMgmtClient::NewL();
+                    CleanupStack::PushL( wlanMgmtClient );
+
+                    if ( !wlanMgmtClient->GetConnectionSsid( ssidConn ) )
+                        {
+                        CLOG_WRITEF( _L( "ssidConn.Length() = %d" ), ssidConn.Length() );
+
+                        aConnectionName.Copy( ssidConn );
+                        }
+
+                    wlanMgmtClient->CancelNotifications();
+                    CleanupStack::PopAndDestroy( wlanMgmtClient );
+                    }
+                }
+
+            CleanupStack::PopAndDestroy( wLanServiceTable );
+            }
+        else if ( err != KErrNotFound )
+            {
+            User::LeaveIfError( err );
+            }
+        }
+
+#endif  // !__WINS__
+
+    CLOG_WRITEF( _L( "connectionName = %S" ), &aConnectionName );
+    }
+    
+    
+// ---------------------------------------------------------    
+// CConnectionUiUtilitiesImpl::OffLineWlanNote
+// ---------------------------------------------------------
+//
+TBool CConnectionUiUtilitiesImpl::OffLineWlanNote()
+    { 
+    CLOG_ENTERFN( "CConnectionUiUtilitiesImpl::OffLineWlanNote" );    
+
+    if ( iIsWlanSupported )
+        {
+        if ( !iActiveWrapper[EOffLineWlan] )
+            {
+            TRAP_IGNORE( iActiveWrapper[EOffLineWlan] = 
+                                        CActiveWrapper::NewL( EOffLineWlan ) );
+            CLOG_WRITE( "iActiveWrapper created" );
+            }
+
+        if ( iActiveWrapper[EOffLineWlan] )
+            {
+            CLOG_WRITE( "Starting generic note" );
+            iActiveWrapper[EOffLineWlan]->StartGenericNote( EOffLineWlan );
+            CLOG_WRITE( "Generic note started" );
+            return iActiveWrapper[EOffLineWlan]->iStatus.Int() ? EFalse : 
+                                                                 ETrue;
+            }
+        }
+       
+    CLOG_LEAVEFN( "CConnectionUiUtilitiesImpl::OffLineWlanNote" );
+
+    return EFalse;
+    }
+
+
+// ---------------------------------------------------------    
+// CConnectionUiUtilitiesImpl::OffLineWlanNote
+// ---------------------------------------------------------
+//
+void CConnectionUiUtilitiesImpl::OffLineWlanNote( TRequestStatus& aStatus )
+    { 
+    CLOG_ENTERFN( "CConnectionUiUtilitiesImpl::OffLineWlanNote Async" );    
+
+    if ( iIsWlanSupported )
+        {
+        if ( iActiveWrapper[EOffLineWlan] )
+            {   // deleting, to be sure to call the right Cancel function
+            delete iActiveWrapper[EOffLineWlan];
+            iActiveWrapper[EOffLineWlan] = NULL;
+            }
+
+        iNotif.OffLineWlanNote( aStatus, ETrue );
+        }
+       
+    CLOG_LEAVEFN( "CConnectionUiUtilitiesImpl::OffLineWlanNote Async" );
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilitiesImpl::CancelOffLineWlanNote
+// ---------------------------------------------------------
+//
+void CConnectionUiUtilitiesImpl::CancelOffLineWlanNote()
+    {
+    if ( iIsWlanSupported )    
+        {
+        if ( iActiveWrapper[EOffLineWlan] )
+            {
+            iActiveWrapper[EOffLineWlan]->Cancel();
+            }
+        else
+            {   // Asynchronous version
+            iNotif.CancelOffLineWlanNote();
+            }
+        }
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilitiesImpl::OffLineWlanDisabledNote
+// ---------------------------------------------------------
+//
+void CConnectionUiUtilitiesImpl::OffLineWlanDisabledNote()
+    {
+    if ( iIsWlanSupported )    
+        {
+        if ( !iActiveWrapper[EWlanDisabled] )
+            {
+            TRAP_IGNORE( iActiveWrapper[EWlanDisabled] = 
+                                    CActiveWrapper::NewL( EWlanDisabled ) );
+            }
+
+        if ( iActiveWrapper[EWlanDisabled] )
+            {
+            iActiveWrapper[EWlanDisabled]->StartGenericNote( EWlanDisabled );
+            }
+        }
+    }
+
+// ---------------------------------------------------------    
+// CConnectionUiUtilitiesImpl::EasyWepDlg
+// ---------------------------------------------------------
+//
+TBool CConnectionUiUtilitiesImpl::EasyWepDlg( TDes* aKey, TBool& aHex )
+    {
+    TInt status = KErrNone;
+    
+    if ( iIsWlanSupported )    
+        {
+        iWepKey().iKey.Copy( *aKey );
+        if ( !iActiveWrapper[EWlanEasyWep] )
+            {
+            TRAP_IGNORE( iActiveWrapper[EWlanEasyWep] = 
+                                    CActiveWrapper::NewL( EWlanEasyWep ) );
+            }
+
+        if ( iActiveWrapper[EWlanEasyWep] )
+            {
+            status = iActiveWrapper[EWlanEasyWep]->StartEasyWepDlg( iWepKey );
+            } 
+        aKey->Copy( iWepKey().iKey );
+        aHex = iWepKey().iHex;        
+        }
+    return ( status == KErrNone ) ? ETrue : EFalse;
+    }
+
+// ---------------------------------------------------------    
+// CConnectionUiUtilitiesImpl::EasyWepDlgAsync
+// ---------------------------------------------------------
+//
+void CConnectionUiUtilitiesImpl::EasyWepDlgAsync( TRequestStatus& aStatus, TDes* aKey, TBool& aHex )
+    {
+    if ( iIsWlanSupported )    
+        {
+        if ( !iActiveWrapper[EWlanEasyWep] )
+            {
+            TRAP_IGNORE( iActiveWrapper[EWlanEasyWep] = 
+                                    CActiveWrapper::NewL( EWlanEasyWep ) );
+            }
+
+        if ( iActiveWrapper[EWlanEasyWep] )
+            {
+            iActiveWrapper[EWlanEasyWep]->StartEasyWepDlgAsync( aStatus, aKey, aHex );
+            } 
+        }
+    }
+
+
+
+// ---------------------------------------------------------
+// CConnectionUiUtilitiesImpl::CancelEasyWepDlg
+// ---------------------------------------------------------
+//
+void CConnectionUiUtilitiesImpl::CancelEasyWepDlg()
+    {
+    if ( iIsWlanSupported )    
+        {
+        iActiveWrapper[EWlanEasyWep]->Cancel();      
+        }
+    }
+
+// ---------------------------------------------------------    
+// CConnectionUiUtilitiesImpl::EasyWpaDlg
+// ---------------------------------------------------------
+//
+TBool CConnectionUiUtilitiesImpl::EasyWpaDlg( TDes* aKey )
+    { 
+    TInt status = KErrNone;
+    if ( iIsWlanSupported )    
+        {
+        iWpaKey().Copy( *aKey );
+        if ( !iActiveWrapper[EWlanEasyWpa] )
+            {
+            TRAP_IGNORE( iActiveWrapper[EWlanEasyWpa] = 
+                                    CActiveWrapper::NewL( EWlanEasyWpa ) );
+            }
+
+        if ( iActiveWrapper[EWlanEasyWpa] )
+            {
+            status = iActiveWrapper[EWlanEasyWpa]->StartEasyWpaDlg( iWpaKey );
+            }        
+        aKey->Copy( iWpaKey() );        
+        }
+    return ( status == KErrNone ) ? ETrue : EFalse;
+    }
+
+// ---------------------------------------------------------    
+// CConnectionUiUtilitiesImpl::StartEasyWpaDlgAsync
+// ---------------------------------------------------------
+//
+void CConnectionUiUtilitiesImpl::EasyWpaDlgAsync( TRequestStatus& aStatus, TDes* aKey )
+    { 
+    if ( iIsWlanSupported )    
+        {
+        if ( !iActiveWrapper[EWlanEasyWpa] )
+            {
+            TRAP_IGNORE( iActiveWrapper[EWlanEasyWpa] = 
+                                    CActiveWrapper::NewL( EWlanEasyWpa ) );
+            }
+
+        if ( iActiveWrapper[EWlanEasyWpa] )
+            {
+            iActiveWrapper[EWlanEasyWpa]->StartEasyWpaDlgAsync( aStatus, aKey );
+            }        
+        }
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilitiesImpl::CancelEasyWpaDlg
+// ---------------------------------------------------------
+//
+void CConnectionUiUtilitiesImpl::CancelEasyWpaDlg()
+    {
+    if ( iIsWlanSupported )    
+        {
+        iActiveWrapper[EWlanEasyWpa]->Cancel();         
+        }
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilitiesImpl::WLANNetworkUnavailableNote
+// ---------------------------------------------------------
+//
+void CConnectionUiUtilitiesImpl::WLANNetworkUnavailableNote()
+    {
+    if ( iIsWlanSupported )    
+        {
+        if ( !iActiveWrapper[EWlanNetwUnavail] )
+            {
+            TRAP_IGNORE( iActiveWrapper[EWlanNetwUnavail] = 
+                                    CActiveWrapper::NewL( EWlanNetwUnavail ) );
+            }
+
+        if ( iActiveWrapper[EWlanNetwUnavail] )
+            {
+            iActiveWrapper[EWlanNetwUnavail]->StartGenericNote( 
+                                                            EWlanNetwUnavail );
+            }
+        }
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilitiesImpl::SearchWLANNetworkSync
+// ---------------------------------------------------------
+//
+TBool CConnectionUiUtilitiesImpl::SearchWLANNetworkSync( TWlanSsid& aSSID,
+                                TWlanConnectionMode& aConnectionMode,
+                                TWlanConnectionSecurityMode& aSecurityMode )
+    {
+    return SearchWLANNetworkSync( aSSID, aConnectionMode, aSecurityMode, 
+                                  iDummy );
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionUiUtilitiesImpl::SearchWLANNetworkSync
+// ---------------------------------------------------------
+//
+TBool CConnectionUiUtilitiesImpl::SearchWLANNetworkSync( TWlanSsid& aSSID,
+                                TWlanConnectionMode& aConnectionMode,
+                                TWlanConnectionSecurityMode& aSecurityMode, 
+                                TBool& aProtectedSetupSupported )
+    {
+    TBool result( EFalse );
+    
+    if ( iIsWlanSupported )
+        {
+        TRequestStatus status;
+        iNetworkPrefs();
+
+        iNotif.SearchWLANNetwork( iNetworkPrefs, status, EFalse );
+        User::WaitForRequest( status ); 
+        
+        if( status == KErrNone )
+            {
+            aSSID = iNetworkPrefs().iSsId;
+            aConnectionMode = iNetworkPrefs().iNetworkMode;
+            aSecurityMode = iNetworkPrefs().iSecMode;
+            aProtectedSetupSupported = 
+                                    iNetworkPrefs().iProtectedSetupSupported;
+            result = ETrue;
+            }
+        }    
+    
+    CLOG_WRITEF( _L( "SearchWLANNetworkSync result : %b" ),  result );
+    return result;
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionUiUtilitiesImpl::SearchWLANNetworkAsync
+// ---------------------------------------------------------
+//
+void CConnectionUiUtilitiesImpl::SearchWLANNetworkAsync( 
+                                TRequestStatus& aStatus,
+                                TWlanSsid& aSSID,
+                                TWlanConnectionMode& aConnectionMode,
+                                TWlanConnectionSecurityMode& aSecurityMode )
+    {
+    SearchWLANNetworkAsync( aStatus, 
+                            aSSID, 
+                            aConnectionMode, 
+                            aSecurityMode, 
+                            iDummyExtSecMode, 
+                            iDummy );
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilitiesImpl::SearchWLANNetworkAsync
+// ---------------------------------------------------------
+//
+void CConnectionUiUtilitiesImpl::SearchWLANNetworkAsync( 
+                                TRequestStatus& aStatus,
+                                TWlanSsid& aSSID,
+                                TWlanConnectionMode& aConnectionMode,
+                                TWlanConnectionExtentedSecurityMode& aExtSecurityMode )
+    {
+    SearchWLANNetworkAsync( aStatus, 
+                            aSSID, 
+                            aConnectionMode, 
+                            iDummySecMode, 
+                            aExtSecurityMode, 
+                            iDummy );
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilitiesImpl::SearchWLANNetworkAsync
+// ---------------------------------------------------------
+//
+void CConnectionUiUtilitiesImpl::SearchWLANNetworkAsync( 
+                                TRequestStatus& aStatus,
+                                TWlanSsid& aSSID,
+                                TWlanConnectionMode& aConnectionMode,
+                                TWlanConnectionSecurityMode& aSecurityMode, 
+                                TBool& aProtectedSetupSupported )
+    {
+    SearchWLANNetworkAsync( aStatus, 
+                            aSSID, 
+                            aConnectionMode, 
+                            aSecurityMode, 
+                            iDummyExtSecMode,
+                            aProtectedSetupSupported );
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilitiesImpl::SearchWLANNetworkAsync
+// ---------------------------------------------------------
+//
+void CConnectionUiUtilitiesImpl::SearchWLANNetworkAsync( 
+                                TRequestStatus& aStatus,
+                                TWlanSsid& aSSID,
+                                TWlanConnectionMode& aConnectionMode,
+                                TWlanConnectionExtentedSecurityMode& aExtSecurityMode, 
+                                TBool& aProtectedSetupSupported )
+    {
+    SearchWLANNetworkAsync( aStatus, 
+                            aSSID, 
+                            aConnectionMode, 
+                            iDummySecMode, 
+                            aExtSecurityMode, 
+                            aProtectedSetupSupported );
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilitiesImpl::SearchWLANNetworkAsync
+// ---------------------------------------------------------
+//
+void CConnectionUiUtilitiesImpl::SearchWLANNetworkAsync( 
+                                TRequestStatus& aStatus,
+                                TWlanSsid& aSSID,
+                                TWlanConnectionMode& aConnectionMode,
+                                TWlanConnectionSecurityMode& aSecurityMode,
+                                TWlanConnectionExtentedSecurityMode& aExtSecurityMode, 
+                                TBool& aProtectedSetupSupported )
+    {
+    CLOG_ENTERFN( "CConnectionUiUtilitiesImpl::SearchWLANNetworkAsync" );    
+
+    if ( iIsWlanSupported )
+        {
+        if ( !iActiveWrapper[ESearchWlan] )
+            {
+            TRAP_IGNORE( iActiveWrapper[ESearchWlan] = 
+                                        CActiveWrapper::NewL( ESearchWlan ) );
+            }
+
+        if ( iActiveWrapper[ESearchWlan] )
+            {
+            iActiveWrapper[ESearchWlan]->StartSearchWLANNetworkAsync( aStatus,
+                                    aSSID, aConnectionMode, aSecurityMode,
+                                    aExtSecurityMode, 
+                                    aProtectedSetupSupported );
+
+            CLOG_WRITEF( _L( "iActiveWrapper[ESearchWlan]->iStatus.Int(): %d" ),  
+                           iActiveWrapper[ESearchWlan]->iStatus.Int() );
+            }
+        }    
+
+    CLOG_LEAVEFN( "CConnectionUiUtilitiesImpl::SearchWLANNetworkAsync" );    
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilitiesImpl::ConnectedViaDestAndConnMethodNote
+// ---------------------------------------------------------
+//
+void CConnectionUiUtilitiesImpl::ConnectedViaDestAndConnMethodNote( 
+                                                const TUint32 aDestId, 
+                                                const TUint32 aConnMId )
+    {
+    if ( !iActiveWrapper[EConnViaDestCM] )
+        {
+        TRAP_IGNORE( iActiveWrapper[EConnViaDestCM] = 
+                                    CActiveWrapper::NewL( EConnViaDestCM ) );
+        }
+
+    if ( iActiveWrapper[EConnViaDestCM] )
+        {
+        iActiveWrapper[EConnViaDestCM]->StartGenericNote( EConnViaDestCM, 
+                                                          aConnMId, aDestId );
+        }
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilitiesImpl::ConnectedViaDestAndConnMethodNote
+// ---------------------------------------------------------
+//
+void CConnectionUiUtilitiesImpl::ConnectedViaDestAndConnMethodNote( 
+                                                const TUint32 aDestId, 
+                                                const TUint32 aConnMId, 
+                                                TRequestStatus& aStatus )
+    {
+    iNotif.ConnectedViaDestAndConnMethodNote( aDestId, aConnMId, aStatus );
+    }
+        
+// ---------------------------------------------------------
+// CConnectionUiUtilitiesImpl::CancelConnectedViaDestAndConnMethodNote
+// ---------------------------------------------------------
+//
+void CConnectionUiUtilitiesImpl::CancelConnectedViaDestAndConnMethodNote()
+    {
+    iNotif.CancelConnectedViaDestAndConnMethodNote();
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilitiesImpl::ChangingConnectionToNote
+// ---------------------------------------------------------
+//
+void CConnectionUiUtilitiesImpl::ChangingConnectionToNote( 
+                                                const TUint32 aConnMId )
+    {
+    if ( !iActiveWrapper[EChangingConnTo] )
+        {
+        TRAP_IGNORE( iActiveWrapper[EChangingConnTo] = 
+                                    CActiveWrapper::NewL( EChangingConnTo ) );
+        }
+
+    if ( iActiveWrapper[EChangingConnTo] )
+        {
+        iActiveWrapper[EChangingConnTo]->StartGenericNote( EChangingConnTo,
+                                                           aConnMId );
+        }
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilitiesImpl::ChangingConnectionToNote
+// ---------------------------------------------------------
+//    
+void CConnectionUiUtilitiesImpl::ChangingConnectionToNote( 
+                                                const TUint32 aConnMId, 
+                                                TRequestStatus& aStatus )
+    {
+    iNotif.ChangingConnectionToNote( aConnMId, aStatus );  
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionUiUtilitiesImpl::CancelChangingConnectionToNote
+// ---------------------------------------------------------
+//
+void CConnectionUiUtilitiesImpl::CancelChangingConnectionToNote()
+    {
+    iActiveWrapper[EChangingConnTo]->Cancel();
+    }
+
+// ---------------------------------------------------------    
+// CConnectionUiUtilitiesImpl::ConfirmMethodUsageQuery
+// ---------------------------------------------------------
+//
+void CConnectionUiUtilitiesImpl::ConfirmMethodUsageQuery( 
+                                               TMsgQueryLinkedResults& aResult,
+                                               const TBool aHomeNetwork,
+                                               TRequestStatus& aStatus )
+    { 
+    iNotif.ConfirmMethodUsageQuery( aResult, aHomeNetwork, aStatus );
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilitiesImpl::CancelConfirmMethodUsageQuery
+// ---------------------------------------------------------
+//
+void CConnectionUiUtilitiesImpl::CancelConfirmMethodUsageQuery()
+    {
+    iNotif.CancelConfirmMethodUsageQuery();
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionUiUtilitiesImpl::ConnectedViaConnMethodNote
+// ---------------------------------------------------------
+//
+void CConnectionUiUtilitiesImpl::ConnectedViaConnMethodNote( 
+                                                    const TUint32 aConnMId )
+    {
+    if ( !iActiveWrapper[EConnViaCM] )
+        {
+        TRAP_IGNORE( iActiveWrapper[EConnViaCM] = 
+                                        CActiveWrapper::NewL( EConnViaCM ) );
+        }
+
+    if ( iActiveWrapper[EConnViaCM] )
+        {
+        iActiveWrapper[EConnViaCM]->StartGenericNote( EConnViaCM, aConnMId );
+        }
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilitiesImpl::ConnectedViaConnMethodNote
+// ---------------------------------------------------------
+//
+void CConnectionUiUtilitiesImpl::ConnectedViaConnMethodNote( 
+                                                    const TUint32 aConnMId,
+                                                    TRequestStatus& aStatus )
+    {
+    iNotif.ConnectedViaConnMethodNote( aConnMId, aStatus );
+    }
+
+        
+// ---------------------------------------------------------
+// CConnectionUiUtilitiesImpl::CancelConnectedViaConnMethodNote
+// ---------------------------------------------------------
+//
+void CConnectionUiUtilitiesImpl::CancelConnectedViaConnMethodNote()
+    {
+    iNotif.CancelConnectedViaConnMethodNote();
+    }
+    
+    
+// ---------------------------------------------------------
+// CConnectionUiUtilitiesImpl::WlanPowerSaveTestNote
+// ---------------------------------------------------------
+//
+void CConnectionUiUtilitiesImpl::WlanPowerSaveTestNote( 
+                                                    TBool&          aDisable,
+                                                    TRequestStatus& aStatus )
+    {
+    iNotif.WlanPowerSaveTestNote( aDisable, aStatus );
+    }
+
+        
+// ---------------------------------------------------------
+// CConnectionUiUtilitiesImpl::CancelWlanPowerSaveTestNote
+// ---------------------------------------------------------
+//
+void CConnectionUiUtilitiesImpl::CancelWlanPowerSaveTestNote()
+    {
+    iNotif.CancelWlanPowerSaveTestNote();
+    }
+    
+// ---------------------------------------------------------    
+// CConnectionUiUtilitiesImpl::EasyWapiDlg
+// ---------------------------------------------------------
+//
+TBool CConnectionUiUtilitiesImpl::EasyWapiDlg( TDes* aKey )
+    { 
+    TInt status( KErrNone );
+    
+    if ( iIsWlanSupported )    
+        {
+        iWapiKey().Copy( *aKey );
+        
+        if ( !iActiveWrapper[ EWlanEasyWapi ] )
+            {
+            TRAP_IGNORE( iActiveWrapper[ EWlanEasyWapi ] = 
+                                    CActiveWrapper::NewL( EWlanEasyWapi ) );
+            }
+
+        if ( iActiveWrapper[ EWlanEasyWapi ] )
+            {
+            status = iActiveWrapper[ EWlanEasyWapi ]->StartEasyWapiDlg( iWapiKey );
+            }
+                    
+        aKey->Copy( iWapiKey() );        
+        }
+    return ( status == KErrNone ) ? ETrue : EFalse;
+    }
+
+// ---------------------------------------------------------
+// CConnectionUiUtilitiesImpl::NoWLANNetworksAvailableNote
+// ---------------------------------------------------------
+//
+void CConnectionUiUtilitiesImpl::NoWLANNetworksAvailableNote()
+    {
+    if ( iIsWlanSupported )    
+        {
+        if ( !iActiveWrapper[ ENoWlanNetwsAvail ] )
+            {
+            TRAP_IGNORE( iActiveWrapper[ ENoWlanNetwsAvail ] = 
+                                    CActiveWrapper::NewL( ENoWlanNetwsAvail ) );
+            }
+
+        if ( iActiveWrapper[ ENoWlanNetwsAvail ] )
+            {
+            iActiveWrapper[ ENoWlanNetwsAvail ]->StartGenericNote( 
+                                                            ENoWlanNetwsAvail );
+            }
+        }
+    }
+
+
+// ---------------------------------------------------------    
+// CConnectionUiUtilitiesImpl::ConnectingViaDiscreetPopup
+// ---------------------------------------------------------
+//
+void CConnectionUiUtilitiesImpl::ConnectingViaDiscreetPopup( const TUint32& aIapId, TBool aConnectionAlreadyActive )
+    { 
+    iConnInfo().iIapId = aIapId;
+    iConnInfo().iConnectionAlreadyActive = aConnectionAlreadyActive;
+    
+    if ( !iActiveWrapper[ EConnectingViaDiscreetPopup ] )
+        {
+        TRAP_IGNORE( iActiveWrapper[ EConnectingViaDiscreetPopup ] = 
+                                CActiveWrapper::NewL( EConnectingViaDiscreetPopup ) );
+        }
+
+    if ( iActiveWrapper[ EConnectingViaDiscreetPopup ] )
+        {
+        iActiveWrapper[ EConnectingViaDiscreetPopup ]
+                        ->StartConnectingViaDiscreetPopup( iConnInfo );
+        }
+    }
+
+
+
+// ---------------------------------------------------------    
+// CConnectionUiUtilitiesImpl::ConnectionErrorDiscreetPopup
+// ---------------------------------------------------------
+//
+void CConnectionUiUtilitiesImpl::ConnectionErrorDiscreetPopup( const TInt& aErrCode )
+    {
+    TPckgBuf< TInt > buf;
+    buf() = aErrCode;
+    
+    if ( !iActiveWrapper[ EConnectionErrorDiscreetPopup ] )
+        {
+        TRAP_IGNORE( iActiveWrapper[ EConnectionErrorDiscreetPopup ] = 
+                                CActiveWrapper::NewL( EConnectionErrorDiscreetPopup ) );
+        }
+
+    if ( iActiveWrapper[ EConnectionErrorDiscreetPopup ] )
+        {
+        iActiveWrapper[ EConnectionErrorDiscreetPopup ]
+                        ->StartConnectionErrorDiscreetPopup( buf );
+        }
+    }
+        
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/src/ConnectionUiUtilitiesPanic.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2004 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 panic function.   
+*      
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <e32std.h>
+#include "ConnectionUiUtilitiesPanic.h"
+
+
+// ================= LOCAL FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// Panic()
+// ---------------------------------------------------------
+//
+void Panic( TConnectionUiUtilitiesPanicCodes aPanic )
+    {
+    _LIT( KConnUiUtilsSet, "ConnectionUiUtilities" );
+    User::Panic( KConnUiUtilsSet, aPanic );
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/DisconnectDlg/BWinsCw/DISCONNECTDLGCLIENTU.def	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,10 @@
+EXPORTS
+	??0RDisconnectDlgServer@@QAE@XZ @ 1 NONAME ; RDisconnectDlgServer::RDisconnectDlgServer(void)
+	??1RDisconnectDlgServer@@QAE@XZ @ 2 NONAME ; RDisconnectDlgServer::~RDisconnectDlgServer(void)
+	?CancelDisconnectDlg@RDisconnectDlgServer@@QAEXXZ @ 3 NONAME ; void RDisconnectDlgServer::CancelDisconnectDlg(void)
+	?Close@RDisconnectDlgServer@@QAEXXZ @ 4 NONAME ; void RDisconnectDlgServer::Close(void)
+	?Connect@RDisconnectDlgServer@@QAEHXZ @ 5 NONAME ; int RDisconnectDlgServer::Connect(void)
+	?DisconnectDlg@RDisconnectDlgServer@@QAEXAAVTRequestStatus@@H@Z @ 6 NONAME ; void RDisconnectDlgServer::DisconnectDlg(class TRequestStatus &, int)
+	?Version@RDisconnectDlgServer@@QBE?AVTVersion@@XZ @ 7 NONAME ; class TVersion RDisconnectDlgServer::Version(void) const
+	?DisconnectDlg@RDisconnectDlgServer@@QAEXAAVTRequestStatus@@AAKH@Z @ 8 NONAME ; void RDisconnectDlgServer::DisconnectDlg(class TRequestStatus &, unsigned long &, int)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/DisconnectDlg/BWinsCw/DISCONNECTDLGU.def	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+	?NotifierArray@@YAPAV?$CArrayPtr@VMEikSrvNotifierBase2@@@@XZ @ 1 NONAME ; class CArrayPtr<class MEikSrvNotifierBase2> * NotifierArray(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/DisconnectDlg/EABI/DISCONNECTDLGCLIENTU.def	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,12 @@
+EXPORTS
+	_ZN20RDisconnectDlgServer13DisconnectDlgER14TRequestStatusi @ 1 NONAME
+	_ZN20RDisconnectDlgServer19CancelDisconnectDlgEv @ 2 NONAME
+	_ZN20RDisconnectDlgServer5CloseEv @ 3 NONAME
+	_ZN20RDisconnectDlgServer7ConnectEv @ 4 NONAME
+	_ZN20RDisconnectDlgServerC1Ev @ 5 NONAME
+	_ZN20RDisconnectDlgServerC2Ev @ 6 NONAME
+	_ZN20RDisconnectDlgServerD1Ev @ 7 NONAME
+	_ZN20RDisconnectDlgServerD2Ev @ 8 NONAME
+	_ZNK20RDisconnectDlgServer7VersionEv @ 9 NONAME
+	_ZN20RDisconnectDlgServer13DisconnectDlgER14TRequestStatusRmi @ 10 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/DisconnectDlg/EABI/DisconnectDlgU.DEF	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z13NotifierArrayv @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/DisconnectDlg/clientsrc/DisconnectDlgClient.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,160 @@
+/*
+* Copyright (c) 2004 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 Disconnect Dialog Client
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <bautils.h>
+
+#include <DisconnectDlgClient.h>
+#include "DisconnectDlgUi.h"
+#include "ConnectionDialogsUidDefs.h"
+#include "e32ver.h"
+
+#include "ConnectionDialogsLogger.h"
+
+
+// CONSTANTS
+
+
+// ---------------------------------------------------------
+// RDisconnectDlgServer
+// ---------------------------------------------------------
+//
+EXPORT_C RDisconnectDlgServer::RDisconnectDlgServer()
+: RSessionBase(), 
+  iNotifier( NULL ), 
+  iPassedInfo( TDisconnectConnectionPrefs() ),
+  iIapId( 0 )
+    {
+    }
+
+
+// ---------------------------------------------------------
+// ~RDisconnectDlgServer
+// ---------------------------------------------------------
+//
+EXPORT_C RDisconnectDlgServer::~RDisconnectDlgServer()
+    {
+    }
+
+
+// ---------------------------------------------------------
+// Connect
+//
+// Create a session to the extended notifier framework
+// ---------------------------------------------------------
+//
+EXPORT_C TInt RDisconnectDlgServer::Connect()
+    {
+    TInt error( KErrNone );
+
+    if ( !iNotifier )
+        {
+        TRAP( error, iNotifier = new RNotifier() );
+        }
+
+    if ( error == KErrNone && iNotifier )
+        {
+        error = iNotifier->Connect();
+        }
+
+    return error;
+    }
+
+
+// ---------------------------------------------------------
+// Close
+// ---------------------------------------------------------
+//
+EXPORT_C void RDisconnectDlgServer::Close()
+    {
+    if ( iNotifier )
+        {
+        iNotifier->Close();
+        }
+
+    delete iNotifier;
+    iNotifier = NULL;
+    }
+
+
+// ---------------------------------------------------------
+// Version
+// ---------------------------------------------------------
+//
+EXPORT_C TVersion RDisconnectDlgServer::Version( void ) const
+    {
+    return( TVersion( KDisconnectDlgMajorVersionNumber, 
+                      KDisconnectDlgMinorVersionNumber,
+                      KDisconnectDlgBuildVersionNumber ) );
+    }
+
+
+// ---------------------------------------------------------
+// DisconnectDlg
+// ---------------------------------------------------------
+//
+EXPORT_C void RDisconnectDlgServer::DisconnectDlg( TRequestStatus& aStatus, 
+                                       const TBool aShowQuery /* = EFalse */ )
+    {
+    CLOG_ENTERFN("RDisconnectDlgServer::DisconnectDlg");
+    
+    TDisconnectConnectionPrefs connectionPrefs;
+    
+    connectionPrefs.iPrompt = aShowQuery;
+    iPassedInfo() = connectionPrefs;
+    
+    if ( iNotifier )
+        {
+        iNotifier->StartNotifierAndGetResponse( aStatus, KUidDisconnectDlg,
+                                                iPassedInfo, iIapId );
+        }
+
+    CLOG_WRITEF(_L( "aStatus: %d" ), aStatus.Int() );     
+    CLOG_LEAVEFN("RDisconnectDlgServer::DisconnectDlg");
+    }
+
+    
+// ---------------------------------------------------------
+// DisconnectDlg
+// ---------------------------------------------------------
+//
+EXPORT_C void RDisconnectDlgServer::DisconnectDlg( TRequestStatus& aStatus, 
+                                       TUint32& aIapId,
+                                       const TBool aShowQuery /* = EFalse */ )
+    {
+    CLOG_ENTERFN("RDisconnectDlgServer::DisconnectDlg 3");
+    ::new( &iIapId ) TPckg<TUint32>( aIapId );        
+    DisconnectDlg( aStatus, aShowQuery );
+    CLOG_LEAVEFN("RDisconnectDlgServer::DisconnectDlg 3");        
+    }
+    
+
+// ---------------------------------------------------------
+// CancelDisconnectDlg
+// ---------------------------------------------------------
+//
+EXPORT_C void RDisconnectDlgServer::CancelDisconnectDlg()
+    {
+    if ( iNotifier )
+        {
+        iNotifier->CancelNotifier( KUidDisconnectDlg );
+        }
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/DisconnectDlg/data/DisconnectDlg.rss	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,193 @@
+/*
+* Copyright (c) 2004 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 all the resources for the Disconnect Dialog App.
+*
+*/
+
+
+// RESOURCE IDENTIFIER
+
+NAME FAET
+
+// INCLUDES
+#include <disconnectdlg.loc>
+#include <eikon.rh>
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.mbg>
+#include <avkon.loc>
+
+// RESOURCE DEFINITIONS 
+
+RESOURCE RSS_SIGNATURE { }
+
+RESOURCE TBUF { buf = "DisconnectDlg"; }
+
+RESOURCE EIK_APP_INFO
+    {
+    }
+
+RESOURCE TBUF r_qtn_netw_conf_conn_disconnected 
+    { 
+    buf = qtn_netw_conf_conn_disconnected; 
+    }
+
+RESOURCE TBUF r_qtn_netw_conf_modem_conn_disconnected 
+    { 
+    buf = qtn_netw_conf_modem_conn_disconnected; 
+    }
+
+RESOURCE TBUF r_qtn_cmon_info_conn_already_end 
+    { 
+    buf = qtn_cmon_info_conn_already_end; 
+    }
+
+RESOURCE TBUF r_qtn_netw_info_disconnect_failed 
+    { 
+    buf = qtn_netw_info_disconnect_failed; 
+    }
+
+RESOURCE TBUF r_qtn_cmon_item_conn_name_modem 
+    { 
+    buf= qtn_cmon_item_conn_name_modem; 
+    }
+
+RESOURCE TBUF r_qtn_netw_head_conn_to_close 
+    { 
+    buf= qtn_netw_head_conn_to_close; 
+    }
+
+RESOURCE TBUF r_qtn_netw_ddlg_app_rss_server 
+    { 
+    buf= qtn_netw_ddlg_app_rss_server; 
+    }
+
+RESOURCE TBUF r_qtn_netw_ddlg_app_dl_mgr 
+    { 
+    buf= qtn_netw_ddlg_app_dl_mgr; 
+    }
+
+RESOURCE TBUF r_qtn_netw_ddlg_app_msg_server 
+    { 
+    buf= qtn_netw_ddlg_app_msg_server; 
+    }
+
+RESOURCE TBUF r_qtn_netw_ddlg_app_java_midlet 
+    { 
+    buf= qtn_netw_ddlg_app_java_midlet; 
+    }
+
+RESOURCE TBUF r_qtn_netw_ddlg_app_unknown 
+    { 
+    buf= qtn_netw_ddlg_app_unknown; 
+    }
+
+RESOURCE TBUF r_qtn_netw_ddlg_app_supl 
+    { 
+    buf= qtn_netw_ddlg_app_supl; 
+    }
+
+RESOURCE CBA r_disconnectdlg_discon_cancel__select
+    {
+    buttons =
+        {
+        CBA_BUTTON { id = EAknSoftkeyOk; txt = qtn_netw_softkey_disconnect; },
+        CBA_BUTTON { id = EAknSoftkeyCancel; txt = text_softkey_cancel; },
+        CBA_BUTTON { id = EAknSoftkeyOk; txt= qtn_msk_select;}
+        };
+    }
+
+RESOURCE AVKON_LIST_QUERY r_disconnectdlg_dialog
+    {
+	flags=  EEikDialogFlagNotifyEsc | EEikDialogFlagWait;
+    softkeys = r_disconnectdlg_discon_cancel__select;
+    items = 
+	    {
+	    AVKON_LIST_QUERY_DLG_LINE 
+	        {
+	        control = AVKON_LIST_QUERY_CONTROL
+		        {
+				listtype = EAknCtDoubleLargeGraphicPopupMenuListBox;
+				heading = qtn_netw_head_conn_to_close;
+		        listbox = AVKON_LIST_QUERY_LIST
+		            {
+		            // array of items will be defined dynamically
+		            };
+		        };
+	        }
+	    };
+    }
+
+RESOURCE DIALOG r_disconnectdlg_info_note
+    {
+    flags = EAknInformationNoteFlags | EEikDialogFlagWait;
+    buttons = R_AVKON_SOFTKEYS_EMPTY;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtNote;
+            id = EGeneralNote;
+            control = AVKON_NOTE 
+                { 
+                layout = EGeneralLayout;
+                singular_label = "";
+                plural_label = "";
+                animation = R_QGN_NOTE_INFO_ANIM;
+                };
+            }
+        };
+    }
+
+RESOURCE DIALOG r_disconnectdlg_confirm_note
+    {
+    flags = EAknConfirmationNoteFlags | EEikDialogFlagWait;
+    buttons = R_AVKON_SOFTKEYS_EMPTY;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtNote;
+            id = EGeneralNote;
+            control = AVKON_NOTE 
+                { 
+                layout = EGeneralLayout;
+                singular_label = "";
+                plural_label = "";
+                animation = R_QGN_NOTE_OK_ANIM;
+                };
+            }
+        };
+    }
+
+
+RESOURCE DIALOG r_disconnectdlg_proceed
+    {
+    flags = EEikDialogFlagNotifyEsc | EEikDialogFlagWait;
+    buttons = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control = AVKON_CONFIRMATION_QUERY 
+                {
+                layout = EConfirmationQueryLayout;
+                label = "";
+                };
+            }
+        };
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/DisconnectDlg/inc/ActiveDisconnectDlgPlugin.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,95 @@
+/*
+* 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 CActiveDisconnectDlgPlugin
+*
+*/
+
+
+
+#ifndef __ACTIVE_DISCONNECT_DLG_PLUGIN_H__
+#define __ACTIVE_DISCONNECT_DLG_PLUGIN_H__
+
+// INCLUDES
+#include "DisconnectDlgUi.h"
+#include "DisconnectDlgDialog.h"
+
+// FORWARD DECLARATIONS
+class CConnectionInfo;
+
+/**
+ * CActiveDisconnectDlgPlugin class,
+ * an active object for CDisconnectDialogUi
+ */     
+NONSHARABLE_CLASS( CActiveDisconnectDlgPlugin ) : public CActive
+    {
+    public:
+        /**
+        * NewL function
+        * @param  aPlugin a pointer to notifier plugin
+        */
+        static CActiveDisconnectDlgPlugin* NewL( 
+                                                CDisconnectDialogUi* aPlugin );
+
+        /**
+        * StartSearchConnections setactive and starts active object
+        */    
+        void StartSearchConnections();
+
+        /**
+        * Destructor
+        */    
+        virtual ~CActiveDisconnectDlgPlugin();          
+        
+    protected:
+        /**
+        * ConstructL 
+        */
+        void ConstructL();
+    
+        /**
+        * Constructor
+        * @param  aPlugin a pointer to notifier plugin    
+        */    
+        CActiveDisconnectDlgPlugin( CDisconnectDialogUi* aPlugin );
+            
+        /**
+        * DoCancel from CActive
+        */    
+        virtual void DoCancel();
+      
+        /**
+        * RunL from CActive
+        */      
+        virtual void RunL();
+    
+        /**
+        * Check if there is any connection
+        * @param CConnectionInfo of the first finded connection
+        * @return ETrue if there is any connection, EFalse otherwise
+        */
+        TBool IsConnectionL( CConnectionInfo* aConnectionInfo );
+    
+            
+    protected:
+
+        ///< a pointer to notifer, not owned     
+        CDisconnectDialogUi* iPlugin;    
+
+        ///< used for complete runl, not owned  
+        TRequestStatus* iClientStatus;
+    };     
+
+#endif // __ACTIVE_DISCONNECT_DLG_PLUGIN_H__
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/DisconnectDlg/inc/ConnectionCArray.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,114 @@
+/*
+* Copyright (c) 2004 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: 
+*      Declares the connection array.
+*
+*/
+
+
+#ifndef DDLG_CONNECTION_ARRAY_H
+#define DDLG_CONNECTION_ARRAY_H
+
+// INCLUDES
+#include <e32base.h>
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class CConnectionInfo;
+
+// CLASS DECLARATION
+
+
+/**
+* Contains CConnectionInfo instances.
+*/
+NONSHARABLE_CLASS( CConnectionCArray ) : public CBase
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Constructor.
+        */
+        static CConnectionCArray* NewL();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CConnectionCArray();
+
+    private: // Constructors
+
+        /**
+        * Constructor.
+        */
+        CConnectionCArray();
+
+        /**
+        * Constructor.
+        */
+        void ConstructL();
+
+    public: // New functions
+
+        /**
+        * Returns the number of connection added to the connection array
+        * @return number of active connections
+        */
+        TInt Count() const;
+        
+        /**
+        * Add only new connection to the array
+        * @param aConnId id of connection to be added to the array
+        * @return -
+        */
+        void AppendL( const CConnectionInfo* aInfo );
+        
+        /**
+        * Destroys the connection array
+        */
+        void ResetAndDestroy();
+
+        /**
+        * Returns info object of connection given by index value in the array
+        * @param aIndex index value of connection in the array
+        * @return CConnectionInfo* pointer to the connection info object
+        */
+        CConnectionInfo* At( TInt aIndex ) const;
+        
+        /**
+        * Returns the index of the given connection
+        * @param aConnectionId connection id
+        * @return index value of connection in the array, or -1 if there
+        * is no connection the given Id
+        */
+        TInt GetArrayIndex( TUint aConnectionId ) const;  
+        
+        /**
+        * Sorts the array according to the connection start times
+        * @param -
+        * @return -
+        */
+        void Sort() const;      
+
+    private: // data
+        /**
+        * Contains CConectionInfo instances
+        */
+        CArrayPtrFlat<CConnectionInfo>* iConnArray; 
+    };
+      
+#endif // DDLG_CONNECTION_ARRAY_H
+
+// End Of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/DisconnectDlg/inc/ConnectionInfo.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,186 @@
+/*
+* Copyright (c) 2004 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: 
+*      Declares the connection info.
+*
+*/
+
+
+#ifndef DDLG_CONNECTIONINFO_H
+#define DDLG_CONNECTIONINFO_H
+
+// INCLUDES
+#include <e32base.h>
+#include <gulicon.h>
+#include <rconnmon.h>
+#include <apgicnfl.h>
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+* Contains attributes of connection.
+*/
+NONSHARABLE_CLASS( CConnectionInfo ) : public CBase
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Constructor.
+        */
+        static CConnectionInfo* NewLC();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CConnectionInfo();
+
+    private: // Constructors
+
+        /**
+        * Constructor.
+        */
+        CConnectionInfo();
+
+        /**
+        * Constructor.
+        */
+        void ConstructL();
+
+    public: // New functions
+
+        // Getter functions
+
+        /**
+        * Returns the connection id
+        * @param -
+        * @return the connection id
+        */
+        inline TUint GetConnId() const;
+        
+        /**
+        * Returns the application name which uses the connection
+        * @param aUseSharedIcon in Output returns if the connection should use
+        *                       the shared icon
+        * @return the application name
+        */
+        TPtrC GetAppNameL( TBool &aUseSharedIcon );
+
+        /**
+        * Returns the Internet Accesspoint name through 
+        * the connection is estabilished
+        * @param -
+        * @return Internet Accespoint Name
+        */
+        TPtrC GetIapNameL();
+
+        /**
+        * Returns the bearer type of the connection
+        * @param -
+        * @return the bearer type
+        */
+        inline TInt GetBearerType() const;
+        
+        /**
+        * Returns the IAP id of the connection
+        * @param -
+        * @return the IAP id
+        */
+        inline TInt GetIAPId() const;
+        
+        /**
+        * Returns the icon of the application which uses the connection
+        * @param aUseSharedIcon Says if the connection should use the shared 
+        *                       icon
+        * @return the application icon
+        */
+        CGulIcon* GetAppIconL( TBool aUseSharedIcon );
+        
+        /**
+        * Returns the start time of the connection.
+        * @param -
+        * @return The connection start time.
+        */
+        inline TTime GetStartTime() const;
+
+        // Setter functions
+
+        /**
+        * Set the connection id
+        * @param the connection id
+        * @return -
+        */
+        inline void SetConnId( TUint aConnId );
+        
+        /**
+        * Set the Internet Accespoint name
+        * through the connection is estabilish
+        * @param The name of the Internet Accesspoint
+        * @return -
+        */
+        inline void SetIapNameL( const TDesC& aIapName );
+
+        /**
+        * Set the client info of the application which uses the connection
+        * @param the client information
+        * @return -
+        */
+        inline void SetClientInfo( TConnMonClientEnum aClientInfo );
+
+        /**
+        * Set the bearer type of the given connection
+        * @param the bearer type
+        * @return -
+        */
+        inline void SetBearerType( TInt aBearerType );
+        
+        /**
+        * Set the IAP id of the given connection
+        * @param the IAP id 
+        * @return -
+        */
+        inline void SetIAPId( TInt aIAPId );
+        
+        /**
+        * Set the start time of the connection.
+        * @param The start time of the connection.
+        * @return -
+        */
+        inline void SetStartTime(TTime aTime);
+        
+        
+        
+
+    private: // data
+
+        TUint               iConnId;     ///< id of icon represents connection
+        TInt                iBearerType; ///< bearer type of connection
+        TConnMonClientEnum  iClientInfo; ///< info from clients, use connection
+        HBufC*              iAppName;    ///< Owned. Apps which use connection.
+        HBufC*              iIapName;    ///< Owned. Access point name.
+        CGulIcon*           iAppIcon;    ///< Owned. Used for icon.
+        TUint               iIAPId;      ///< Id of AP
+        TTime               iStartTime;  ///< The start time of the connection
+        
+    };
+
+
+#include "ConnectionInfo.inl"
+
+#endif // DDLG_CONNECTIONINFO_H
+
+// End Of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/DisconnectDlg/inc/ConnectionInfo.inl	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,119 @@
+/*
+* Copyright (c) 2004 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: 
+*      Inline method definitions of the class CConnectionInfo.
+*
+*/
+
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CConnectionInfo::GetConnId
+// ---------------------------------------------------------
+//
+TUint CConnectionInfo::GetConnId() const
+    {
+    return iConnId;
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionInfo::GetBearerType
+// ---------------------------------------------------------
+//
+TInt CConnectionInfo::GetBearerType() const
+    {
+    return iBearerType;
+    }
+
+    
+// ---------------------------------------------------------
+// CConnectionInfo::GetIAPId
+// ---------------------------------------------------------
+//
+TInt CConnectionInfo::GetIAPId() const
+    {
+    return iIAPId;
+    }
+
+// ---------------------------------------------------------
+// CConnectionInfo::GetStartTime
+// ---------------------------------------------------------
+//
+TTime CConnectionInfo::GetStartTime() const
+    {
+    return iStartTime;
+    }
+
+// ---------------------------------------------------------
+// CConnectionInfo::SetConnId
+// ---------------------------------------------------------
+//
+void CConnectionInfo::SetConnId( TUint aConnId )
+    {
+    iConnId = aConnId;
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionInfo::SetIapNameL
+// ---------------------------------------------------------
+//
+void CConnectionInfo::SetIapNameL( const TDesC& aIapName )
+    {
+    iIapName = aIapName.AllocL();
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionInfo::SetClientInfo
+// ---------------------------------------------------------
+//
+void CConnectionInfo::SetClientInfo( TConnMonClientEnum aClientInfo )
+    {
+    iClientInfo = aClientInfo;
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionInfo::SetBearerType
+// ---------------------------------------------------------
+//
+void CConnectionInfo::SetBearerType( TInt aBearerType )
+    {
+    iBearerType = aBearerType;
+    }
+
+    
+// ---------------------------------------------------------
+// CConnectionInfo::SetIAPId
+// ---------------------------------------------------------
+//
+void CConnectionInfo::SetIAPId( TInt aIAPId )
+    {
+    iIAPId = aIAPId;
+    }  
+
+// ---------------------------------------------------------
+// CConnectionInfo::SetStartTime
+// ---------------------------------------------------------
+//    
+void CConnectionInfo::SetStartTime( TTime aTime )
+    {
+    iStartTime = aTime;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/DisconnectDlg/inc/ConnectionModel.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,151 @@
+/*
+* Copyright (c) 2004 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: 
+*     The model of RConnectionMobitor.
+*
+*/
+
+
+#ifndef DDLG_CONNECTIONMODEL_H
+#define DDLG_CONNECTIONMODEL_H
+
+// INCLUDES
+#include <e32base.h>
+#include <rconnmon.h>
+#include <cdblen.h>
+
+// FORWARD DECLARATIONS
+class CConnectionInfo;
+class CConnectionCArray;
+class CDisconnectDialogUi;
+
+// CLASS DECLARATION
+/**
+* Contains business logic of DisconnectDlg
+*/
+NONSHARABLE_CLASS( CConnectionModel ) : public CBase, 
+                                        public MConnectionMonitorObserver
+                                        
+    {
+    public:
+
+        /**
+        * @param CDisconnectDialogUi* notifier will be completed if 
+        * @param TDisconnectConnectionPrefs& preferences of the 1st connection
+        * connection is closed
+        */
+        static CConnectionModel* NewL(
+                                    CDisconnectDialogUi* aDisconnectDialogUi,
+                                    CConnectionInfo* aConnectionInfo );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CConnectionModel();
+
+    private:
+
+        /**
+        * Constructor.
+        * @param CDisconnectDialogUi* notifier will be completed if 
+        * connection is closed
+        */
+        CConnectionModel( CDisconnectDialogUi* aDisconnectDialogUi );
+
+        /**
+        * Constructor.
+        * @param CConnectionInfo preferences of the first connection 
+        */
+        void ConstructL( CConnectionInfo* aConnectionInfo );
+    
+    protected:
+        /**
+        * Fills up connection array
+        */
+        void InitConnectionArrayL();
+
+        /**
+        * It is called when RConnectionMonitor has sent its event after ending
+        * connection
+        * @return -
+        */
+        void SelectedConnectionClosedL();
+
+
+    public:
+
+        /**
+        * Display information note
+        * @param aPromptResourceId - resuorce id to the text
+        * @param aPrompt additional text
+        */
+        void InfoNoteL( const TInt aPromptResourceId, 
+                        const TDesC* aPrompt = NULL );
+
+
+        /**
+        * Starts syncronous request to end the given connection.
+        * @param aConnId connection index
+        * @return the result of the request
+        */
+        TInt EndConnection( TUint aConnIndex );
+
+        // Getter functions
+
+        /**
+        * Get the connection array.
+        * @param -
+        * @return pointer to the connection array
+        */
+        CConnectionCArray* GetConnArray() const;
+
+
+        /**
+        * Cancels Notification
+        */
+        void CancelNotification();
+        
+
+    public: // from MConnectionMonitorObserver
+
+        /**
+        * Event method is called every time an event occures.
+        * @since 
+        * @param aConnMonEvent The event information.
+        * @return void
+        */
+        void EventL( const CConnMonEventBase &aConnMonEvent );
+
+    private:
+        /**
+        * For get connection informations
+        */
+        RConnectionMonitor iMonitor;
+
+        /**
+        * Contains connection info instances
+        */
+        CConnectionCArray* iConnArray;   ///< Owned.
+
+        TUint iClosingConnectionIndex;  ///< index of connection to be closed
+
+        CDisconnectDialogUi* iDisconnectDialogUi;// Not Owned
+
+        TBool iDeleting;
+    };
+
+
+#endif /* DDLG_CONNECTIONMODEL_H */
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/DisconnectDlg/inc/DisconnectDlgActiveWaiter.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,94 @@
+/*
+* 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 CDisconnectDlgActiveWaiter
+*
+*/
+
+
+
+#ifndef __DISCONNECT_DLG_ACTIVE_WAITER_H__
+#define __DISCONNECT_DLG_ACTIVE_WAITER_H__
+
+// INCLUDES
+#include <e32base.h>
+
+/**
+ * CDisconnectDlgActiveWaiter class,
+ * an active object to replace User::WaitForRequest
+ * 
+ * Usage:
+ * CDisconnectDlgActiveWaiter* waiter = CDisconnectDlgActiveWaiter::NewL();
+ * CleanupStack::PushL( waiter );
+ * server.AsyncFunction( waiter->iStatus );
+ * if ( waiter->WaitForRequest == KErrNone )
+ *      {
+ *      // handle success
+ *      }
+ *      else 
+ *      {
+ *      // handle failure
+ *      }
+ * CleanupStack::PopAndDestroy( waiter );
+ * 
+ */     
+NONSHARABLE_CLASS( CDisconnectDlgActiveWaiter ) : public CActive
+    {
+    public:
+        /**
+        * NewL function
+        * @param  aPlugin a pointer to notifier plugin
+        */
+        static CDisconnectDlgActiveWaiter* NewL( );
+
+        /**
+        * Destructor
+        */    
+        virtual ~CDisconnectDlgActiveWaiter();          
+
+        /**
+        * Waits for it's TRequestStatus to be completed
+        * @return Error code returned from server after request is
+        * completed
+        */
+        TInt WaitForRequest( );
+        
+    protected:
+        /**
+        * ConstructL 
+        */
+        void ConstructL();
+    
+        /**
+        * Constructor
+        * @param  aPlugin a pointer to notifier plugin    
+        */    
+        CDisconnectDlgActiveWaiter();
+            
+        /**
+        * DoCancel from CActive
+        */    
+        virtual void DoCancel();
+      
+        /**
+        * RunL from CActive
+        */      
+        virtual void RunL();
+    
+    protected:
+        CActiveSchedulerWait iWait;
+    };     
+
+#endif // __DISCONNECT_DLG_ACTIVE_WAITER_H__
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/DisconnectDlg/inc/DisconnectDlgDialog.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,136 @@
+/*
+* Copyright (c) 2004 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: 
+*     Declares the pop-up selection list with the active connections.
+*
+*/
+
+
+#ifndef DDLG_DIALOG_H
+#define DDLG_DIALOG_H
+
+// INCLUDES
+#include <AknQueryDialog.h>
+#include <aknlists.h> 
+#include "ExpiryTimerCallback.h"
+
+// FORWARD DECLARATIONS
+class CConnectionModel;
+class CDisconnectDialogUi;
+class CExpiryTimer;
+
+// CLASS DECLARATION
+
+
+/*
+* The dialog of  DisconnectDlg
+*/
+NONSHARABLE_CLASS( CDisconnectDlgDialog ) : public CAknListQueryDialog, public MExpiryTimerCallback
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Constructor.
+        * @param CDisconnectDialogUi* notifier will be completed if 
+        * connection is closed
+        * @param CConnectionModel* handles connections
+        * @param TInt* After the query is dismissed, the index will hold
+        *               the value of selected item.
+        * @param aIAPId return the selected iap id
+        */
+        static CDisconnectDlgDialog* NewL( 
+                                     CDisconnectDialogUi* aDisconnectDialogUi,
+                                     CConnectionModel* aConnModel,
+                                     TInt* aIndex,
+                                     TUint32& aIAPId );
+
+        /**
+        * Launch and destroy dialog.
+        */
+        void RunDlgLD();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CDisconnectDlgDialog();
+
+    private: // Constructors
+
+        /**
+        * Constructor.
+        * @param CDisconnectDialogUi* notifier will be completed if 
+        * connection is closed
+        * @param CConnectionModel* handles connections
+        * @param TInt* After the query is dismissed, the index will hold
+        *               the value of selected item.
+        * @param aIAPId return the selected iap id        
+        */
+        CDisconnectDlgDialog( CDisconnectDialogUi* aDisconnectDialogUi,
+                              CConnectionModel* aConnModel,
+                              TInt* aIndex,
+                              TUint32& aIAPId );
+
+        /**
+        * Constructor.
+        */
+        void ConstructL();
+
+    protected: //  from CAknListQueryDialog
+
+        /**
+        * This function is called by the EIKON dialog framework just
+        * before the dialog is activated, but before it is sized,
+        * and before PostLayoutDynInitL() is called.
+        * @param -
+        * @return -        
+        */
+        void PreLayoutDynInitL();
+
+        /**
+        * This function is called by the EIKON framework 
+        * if the user activates a button in the button panel. 
+        * It is not called if the Cancel button is activated, 
+        * unless the EEikDialogFlagNotifyEsc flag is set.
+        * @param aButtonId  The ID of the button that was activated
+        * @return Should return ETrue if the dialog should exit, 
+        * and EFalse if it should not.
+        */
+        TBool OkToExitL( TInt aButtonId );
+
+        /**
+        * Dialog expiration timeout callback
+        */
+        void HandleTimedOut();
+        
+    private: //data
+
+        /**
+        * Contains connection related functions
+        */
+        CConnectionModel*              iConnModel;  ///< Not Owned.
+
+        CDisconnectDialogUi*           iDisconnectDialogUi;  ///< Not owned
+
+        HBufC*                         iPrompt; ///< Prompt value of dialog
+        
+        // ID of IAP
+        TUint32& iIAPId;      
+        
+        // Pointer for dialog expiration timer
+        CExpiryTimer* iExpiryTimer;
+    };
+
+#endif /* DDLG_DIALOG_H */
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/DisconnectDlg/inc/DisconnectDlgUi.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,195 @@
+/*
+* Copyright (c) 2004 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: 
+*     Declares the main handler, CDisconnectDialogUi and the public API for 
+*     the Disconnect Dialog UI.
+*
+*/
+
+
+#ifndef DDLG_UI_H
+#define DDLG_UI_H
+
+// INCLUDES
+#include <e32base.h>
+#include <rconnmon.h>
+#include <eiknotapi.h>
+#include <DisconnectDlgClient.h>
+
+
+// GLOBAL FUNCTIONS
+
+// FORWARD DECLARATIONS
+class CConnectionInfo;
+class CDisconnectDlgDialog;
+class CConnectionModel;
+class CQueryDisconnectDlgDialog;
+class CActiveDisconnectDlgPlugin;
+
+// CLASS DECLARATION
+
+/**
+* Notifier class for DisconnectDlg
+*/
+NONSHARABLE_CLASS( CDisconnectDialogUi ) : public CBase,
+                                           public MEikSrvNotifierBase2
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Constructor.
+        */
+        static CDisconnectDialogUi* NewL();
+
+        /** 
+        * Destructor.
+        */
+        virtual ~CDisconnectDialogUi();
+
+    public:
+
+        /**
+        * Component Validation Test.
+        * @return KErrNone.
+        */
+        static TInt Cvt(); 
+
+    protected: // Constructors
+
+        /**
+        * Constructor.
+        */
+        CDisconnectDialogUi();
+
+        /**
+        * Second-phase constructor.
+        */
+        void ConstructL( );
+
+    public:
+        /**
+        * Creates a query dialog.
+        * @return ETrue if  query created successfully.      
+        */
+        TInt AskDisconnectL();
+
+    public: // from MEikSrvNotifierBase
+
+        /**
+        * from MEikSrvNotifierBase
+        */
+        void Release();
+        
+        /**
+        * from MEikSrvNotifierBase
+        */        
+        TNotifierInfo RegisterL();
+
+        /**
+        * from MEikSrvNotifierBase
+        */
+        TNotifierInfo Info() const;
+
+        /**
+        * from MEikSrvNotifierBase
+        */
+        TPtrC8 StartL( const TDesC8& aBuffer );
+
+        /**
+        * Start the Notifier
+        * @param  aBuffer info from caller  
+        * @param  aReplySlot reply info
+        * @param  aMessage   
+        * return -
+        */
+        void StartL( const TDesC8& aBuffer, TInt aReplySlot, 
+                     const RMessagePtr2& aMessage );
+
+        /**
+        * from MEikSrvNotifierBase
+        */
+        void Cancel();
+
+        /**
+        * from MEikSrvNotifierBase
+        */        
+        TPtrC8 UpdateL( const TDesC8& aBuffer );
+
+    public:// from MActiveEventObserverInterface
+
+        /**
+        * Notify when the initialization process has been done
+        * @return -
+        */
+        void InitializedL( CConnectionInfo* aConnectionInfo );
+        
+        /**
+        * Sets selected IapId
+        */
+        void SetClosedIapId( TUint32 aIapId );
+
+    public: // New functions
+
+        void CompleteL( TInt aStatus );
+
+        inline void SetStartedFlag( TBool aStarted );
+
+        inline TBool Prompt();
+        
+    public:
+    
+        TBool iDialogRun;       ///< ETrue if dialog is run  
+        TBool iQueryRun;       ///< ETrue if query is run
+
+    private: //data
+
+        TInt                  iResOffset; ///< Offset of loaded resource file
+        
+        /**
+        * refers connections is intialized or not
+        */
+        TNotifierInfo         iInfo;             ///< Notifier info
+
+        RMessagePtr2          iMessage;      // Message
+
+        CDisconnectDlgDialog* iDisconnectDialog; ///< Owned.
+
+        CQueryDisconnectDlgDialog* iQueryDisconnectDlgDialog; ///< Owned.
+
+        CConnectionModel* iConnModel; ///< Owned
+
+        /**
+        * After the query is dismissed, the index will hold
+        * the value of selected item at the iDisconnectDialog.
+        */
+        TInt iIndex; 
+
+        TBool iStarted;           ///< ETrue if notifier is started
+        
+        HBufC*  iErrorMsgDetails;   ///< For query dialog
+
+        TDisconnectConnectionPrefs  iConnectionPrefs;
+        
+        TInt iReplySlot;            // Reply slot
+        
+        TUint32 iIapId;            ///< selected Internet Access Point  
+        
+        CActiveDisconnectDlgPlugin* iActivePlugin; ///< Owned
+    };
+
+#include "DisconnectDlgUi.inl"
+
+#endif /* DDLG_UI_H */
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/DisconnectDlg/inc/DisconnectDlgUi.inl	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,50 @@
+/*
+* 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: 
+*      Inline method definitions of the class CDisconnectDialogUi.
+*
+*
+*/
+
+
+
+#ifndef __DISCONNECTDLGUI__INL
+#define __DISCONNECTDLGUI__INL
+
+
+// ================= MEMBER FUNCTIONS =======================
+//
+// ----------------------------------------------------------------------------
+// CDisconnectDialogUi::SetStartedFlag
+// ----------------------------------------------------------------------------
+//
+void CDisconnectDialogUi::SetStartedFlag( TBool aStarted ) 
+    { 
+    iStarted = aStarted; 
+    }
+        
+
+// ----------------------------------------------------------------------------
+// CDisconnectDialogUi::Prompt
+// ----------------------------------------------------------------------------
+//
+TBool CDisconnectDialogUi::Prompt() 
+    { 
+    return iConnectionPrefs.iPrompt; 
+    }
+
+
+#endif // __DISCONNECTDLGUI__INL
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/DisconnectDlg/inc/QueryDisconnectDlgDialog.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2004 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: 
+*     Declares the QueryDisconnectDlgDialog.
+*
+*/
+
+
+#ifndef DDLG_QUERY_DIALOG_H
+#define DDLG_QUERY_DIALOG_H
+
+// INCLUDES
+#include <AknQueryDialog.h>
+#include <aknlists.h> 
+#include "ExpiryTimerCallback.h"
+
+// FORWARD DECLARATIONS
+class CDisconnectDialogUi;
+class CExpiryTimer;
+
+
+// CLASS DECLARATION
+NONSHARABLE_CLASS( CQueryDisconnectDlgDialog ) : public CAknQueryDialog, public MExpiryTimerCallback
+    {    
+    public:
+        /**
+        * Contructor
+        */
+        CQueryDisconnectDlgDialog( CDisconnectDialogUi* aDisconnectDialogUi );
+        
+        /**
+        * Destructor
+        */
+        ~CQueryDisconnectDlgDialog();
+        
+        /**
+        *
+        */
+        void PreLayoutDynInitL();
+
+    protected: //  from CAknQueryDialog
+        /**
+        * This function is called by the EIKON framework 
+        * if the user activates a button in the button panel. 
+        * It is not called if the Cancel button is activated, 
+        * unless the EEikDialogFlagNotifyEsc flag is set.
+        * @param aButtonId  The ID of the button that was activated
+        * @return Should return ETrue if the dialog should exit, 
+        * and EFalse if it should not.
+        */
+        TBool OkToExitL( TInt aButtonId );
+        
+        /**
+        * Dialog expiration timeout callback
+        */
+        void HandleTimedOut();
+    
+    private:        
+        CDisconnectDialogUi* iDisconnectDialogUi;  ///< Not owned
+        
+        // Pointer for dialog expiration timer
+        CExpiryTimer* iExpiryTimer;
+
+    };
+
+#endif // DDLG_QUERY_DIALOG_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/DisconnectDlg/inc/connectioninfosortkey.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 2008 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: 
+*      Declares the connection info sort key
+*
+*/
+
+
+#ifndef DDLG_CONNECTIONINFOSORTKEY_H
+#define DDLG_CONNECTIONINFOSORTKEY_H
+
+#include <e32base.h>
+
+#include "ConnectionInfo.h"
+
+NONSHARABLE_CLASS( TConnectionInfoSortKey ) : public TKeyArrayFix
+    {
+    public:
+
+        /**
+        * Constructor
+        */
+        TConnectionInfoSortKey();
+        
+        /**
+        * SetPtr function
+        * @param aPtr   Pointer used to initialize the class pointer
+        */
+        void SetPtr( CArrayPtrFlat<CConnectionInfo>* aPtr );
+
+        /**
+        * Compare function
+        * @param aLeft  Left element to be compared
+        * @param aRight Right element to be compared
+        * @return TInt  Result of comparison of the elements
+        */
+        virtual TInt Compare( TInt aLeft, TInt aRight ) const;
+
+        /**
+        * At function
+        * @param nIndex Index of the element ot be returned
+        * @return TAny* The element at the given index
+        */
+        virtual TAny* At( TInt anIndex ) const;
+                
+    protected:
+        // Pointer to class containing info over the connection 
+        CArrayPtrFlat<CConnectionInfo> *iPtr;
+    };
+    
+    
+#endif //DDLG_CONNECTIONINFOSORTKEY_H
+
+// End Of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/DisconnectDlg/loc/disconnectdlg.loc	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,114 @@
+/*
+* Copyright (c) 2004 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: 
+*     
+*
+*/
+
+
+
+// LOCALISATION STRINGS
+//d:left softkey
+//l:control_pane_t1/opt7
+//w:
+//r:2.6
+//
+#define qtn_netw_softkey_disconnect "Disconnect"
+
+//d:a connection was succesfully closed
+//l:popup_note_window
+//w:
+//r:2.6
+//
+#define qtn_netw_conf_conn_disconnected "%U disconnected"
+
+//d:an external (modem) connection was succesfully closed
+//l:popup_note_window
+//w:
+//r:2.6
+//
+#define qtn_netw_conf_modem_conn_disconnected "Modem connection disconnected"
+
+//d:an already closed connection was attempted to close
+//l:popup_note_window
+//w:
+//r:2.6
+//
+#define qtn_cmon_info_conn_already_end "Connection was already closed"
+
+//d:an already closed connection was attempted to close
+//l:popup_note_window
+//w:
+//r:2.6
+//
+#define qtn_netw_info_disconnect_failed "Closing the connection failed"
+
+//d:if the connection is external (modem), this text should be displayed as IAP
+//l:list_double_large_graphic_pane_t1
+//w:
+//r:2.6
+//
+#define qtn_cmon_item_conn_name_modem "Modem connection"
+
+//d:prompt text of the list query dialog
+//l:heading_pane_t1
+//w:
+//r:2.6
+//
+#define qtn_netw_head_conn_to_close "Connection to close:"
+
+//d: the name of the application which uses the connection (Feeds Server)
+//l:list_double_large_graphic_pane_t2_cp2
+//w:
+//r:3.1
+//
+#define qtn_netw_ddlg_app_rss_server  "Web Feeds" 
+
+//d: the name of the application which uses the connection (DownaloadMgrServer)
+//l:list_double_large_graphic_pane_t2_cp2
+//w:
+//r:3.1
+//
+#define qtn_netw_ddlg_app_dl_mgr  "Downloads" 
+
+//d: the name of the application which uses the connection (MessagingServer)
+//l:list_double_large_graphic_pane_t2_cp2
+//w:
+//r:3.1
+//
+#define qtn_netw_ddlg_app_msg_server  "Messaging" 
+
+//d: the name of the application which uses the connection (Java MIDlets)
+//l:list_double_large_graphic_pane_t2_cp2
+//w:
+//r:3.1
+//
+#define qtn_netw_ddlg_app_java_midlet  "Java app." 
+
+//d: the name of the application which uses the connection (Unknown instance)
+//l:list_double_large_graphic_pane_t2_cp2
+//w:
+//r:3.1
+//
+#define qtn_netw_ddlg_app_unknown  "(unknown)" 
+
+//d: the name of the application which uses the connection (PositioningServer)
+//l:list_double_large_graphic_pane_t2_cp2
+//w:
+//r:5.0
+//
+#define qtn_netw_ddlg_app_supl  "Positioning server."
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/DisconnectDlg/src/ActiveDisconnectDlgPlugin.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,286 @@
+/*
+* 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:  Implementation of CActiveDisconnectDlgPlugin.
+*
+*/
+
+
+// INCLUDE FILES
+#include "ActiveDisconnectDlgPlugin.h"
+#include "ConnectionInfo.h"
+#include "ConnectionDialogsLogger.h"
+#include "DisconnectDlgActiveWaiter.h"
+
+
+// CONSTANTS
+
+_LIT( KMrouterName, "mRouter" );
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CActiveDisconnectDlgPlugin* CActiveDisconnectDlgPlugin::NewL()
+// ---------------------------------------------------------
+//
+CActiveDisconnectDlgPlugin* CActiveDisconnectDlgPlugin::NewL( 
+                                              CDisconnectDialogUi* aPlugin )
+    {
+    CLOG_ENTERFN( "CActiveDisconnectDlgPlugin::NewL " );  
+    
+    CActiveDisconnectDlgPlugin* self = 
+                         new ( ELeave ) CActiveDisconnectDlgPlugin( aPlugin );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    
+    CLOG_LEAVEFN( "CActiveDisconnectDlgPlugin::NewL " );      
+
+    return self;        
+    }
+
+// ---------------------------------------------------------
+// CActiveDisconnectDlgPlugin::ConstructL()
+// ---------------------------------------------------------
+//
+void CActiveDisconnectDlgPlugin::ConstructL()
+    {     
+    CActiveScheduler::Add( this );            
+    }
+
+
+// ---------------------------------------------------------
+// CActiveDisconnectDlgPlugin::CActiveDisconnectDlgPlugin()
+// ---------------------------------------------------------
+//
+CActiveDisconnectDlgPlugin::CActiveDisconnectDlgPlugin( 
+                                                CDisconnectDialogUi* aPlugin )
+: CActive( EPriorityNormal ), 
+  iPlugin( aPlugin )
+    {
+    }
+    
+
+// ---------------------------------------------------------
+// CActiveDisconnectDlgPlugin::~CActiveDisconnectDlgPlugin()
+// ---------------------------------------------------------
+//    
+CActiveDisconnectDlgPlugin::~CActiveDisconnectDlgPlugin()
+    {
+    Cancel();
+    }
+
+
+// ---------------------------------------------------------
+// CActiveDisconnectDlgPlugin::DoCancel()
+// ---------------------------------------------------------
+// 
+void CActiveDisconnectDlgPlugin::DoCancel()
+    {
+    }
+     
+ 
+// ---------------------------------------------------------
+// CActiveDisconnectDlgPlugin::RunL()
+// ---------------------------------------------------------
+//     
+void CActiveDisconnectDlgPlugin::RunL()
+    {
+    CLOG_ENTERFN( "CActiveDisconnectDlgPlugin::RunL " );  
+        
+    CLOG_WRITEF( _L( "iStatus.Int() : %d" ), iStatus.Int() );
+    CLOG_WRITEF( _L( "&iStatus : %d" ), &iStatus );
+    
+    if( iStatus == KErrNone )
+        {     
+        TInt result( KErrNone );
+        CConnectionInfo* connectionInfo = CConnectionInfo::NewLC();
+
+        result  = IsConnectionL( connectionInfo );
+
+        CLOG_WRITEF(_L( "result: %d" ), result ); 
+        if( result )
+            {
+            TInt queryResult( KErrNotFound );
+            if( iPlugin->Prompt() )
+                {
+                queryResult = iPlugin->AskDisconnectL();
+                }
+
+            if( queryResult )
+                {
+                // Modell will own connectionInfo
+                iPlugin->InitializedL( connectionInfo );
+                CleanupStack::Pop( connectionInfo );
+                }
+            else
+                {
+                CleanupStack::PopAndDestroy( connectionInfo );
+                }
+            }
+        else
+            {
+            CleanupStack::PopAndDestroy( connectionInfo );
+            iPlugin->SetStartedFlag( EFalse );
+            iPlugin->CompleteL( KErrNotFound );
+            }
+        }
+    CLOG_LEAVEFN( "CActiveDisconnectDlgPlugin::RunL " );
+    }
+
+
+// ---------------------------------------------------------
+// CActiveDisconnectDlgPlugin::StartSearchConnections()
+// ---------------------------------------------------------
+//    
+void CActiveDisconnectDlgPlugin::StartSearchConnections()
+    {    
+    CLOG_ENTERFN( "CActiveDisconnectDlgPlugin::StartSearchConnections " );  
+        
+    SetActive();    
+    iClientStatus = &iStatus;
+
+    User::RequestComplete( iClientStatus, KErrNone );
+    
+    CLOG_LEAVEFN( "CActiveDisconnectDlgPlugin::StartSearchConnections " );
+    }
+
+    
+// ---------------------------------------------------------
+// CActiveDisconnectDlgPlugin::IsConnectionL
+// ---------------------------------------------------------
+//
+TBool CActiveDisconnectDlgPlugin::IsConnectionL( 
+                                            CConnectionInfo* aConnectionInfo )
+    {
+    CLOG_ENTERFN( "CActiveDisconnectDlgPlugin::IsConnectionL" );
+    
+    TBool result( EFalse );
+    
+    TUint i( 0 );
+    TUint connectionCount( 0 );
+    TUint connNum( 0 );
+    TUint subConnectionCount( 0 );
+    TUint connId( 0 );    
+    TInt bearer( 0 );
+    TInt connStatus( 0 );
+
+    //TRequestStatus status;
+    TName apName;
+
+    RConnectionMonitor connMon;
+    result = connMon.ConnectL();
+    CLOG_WRITEF( _L( "result: %d" ), result );     
+    
+    CDisconnectDlgActiveWaiter* waiter = CDisconnectDlgActiveWaiter::NewL();
+    CleanupStack::PushL( waiter );
+    
+    connMon.GetConnectionCount( connNum, waiter->iStatus );
+    waiter->WaitForRequest();
+    //User::WaitForRequest( status );
+    CLOG_WRITEF( _L( "status: %d" ), waiter->iStatus.Int() );  
+    CLOG_WRITEF( _L( "connNum: %d" ), connNum );     
+           
+    for( i = 1; i < ( connNum + 1 ) && !connectionCount; ++i )
+        {
+        connMon.GetConnectionInfo( i, connId, subConnectionCount );
+
+        connMon.GetStringAttribute( connId, 0, KIAPName, apName, waiter->iStatus );
+        waiter->WaitForRequest();
+        //User::WaitForRequest( status );
+        CLOG_WRITEF( _L( "KIAPName status: %d" ), waiter->iStatus.Int() );     
+         
+    
+        connMon.GetIntAttribute( connId, 0, KBearer, bearer, waiter->iStatus );
+        waiter->WaitForRequest();
+        //User::WaitForRequest( status );
+        CLOG_WRITEF( _L( "KBearer status: %d" ), waiter->iStatus.Int() );     
+        
+
+        connMon.GetIntAttribute( connId, 0, KConnectionStatus, connStatus, 
+                                 waiter->iStatus );
+        waiter->WaitForRequest();
+        //User::WaitForRequest( status );
+        CLOG_WRITEF( _L( "KConnectionStatus status: %d" ), waiter->iStatus.Int() );     
+        
+        TUint iapId( 0 );
+        connMon.GetUintAttribute( connId, 0, KIAPId, iapId, waiter->iStatus ); 
+        waiter->WaitForRequest();
+        //User::WaitForRequest( status );
+        CLOG_WRITEF(_L( "KIAPId status: %d" ), waiter->iStatus.Int() );  
+        CLOG_WRITEF(_L( "iapId: %d" ), iapId );
+        
+        TConnMonTimeBuf timeBuf;
+        connMon.GetPckgAttribute( connId, 0, KStartTime, timeBuf, waiter->iStatus );
+        waiter->WaitForRequest();
+        CLOG_WRITEF(_L( "KStartTime status: %d" ), waiter->iStatus.Int() ); 
+       
+        switch( bearer )
+            {
+            case EBearerGPRS :
+            case EBearerEdgeGPRS :
+            case EBearerExternalGPRS : 
+            case EBearerExternalEdgeGPRS :
+            case EBearerWCDMA :
+            case EBearerExternalWCDMA :
+#ifdef __WINS__
+            case EBearerLAN :
+#endif // WINS
+                {
+                if ( ( connStatus == KLinkLayerOpen ) ||
+                     ( connStatus == KConnectionOpen && 
+                       bearer >= EBearerExternalCSD ) )
+                    {      
+                    apName.Trim();
+                    if( apName.Left( KMrouterName().Length() ).
+                        CompareF( KMrouterName ) )
+                        {
+                        ++connectionCount;
+                        aConnectionInfo->SetIapNameL( apName );
+                        aConnectionInfo->SetBearerType( bearer );
+                        aConnectionInfo->SetConnId( connId );
+                        aConnectionInfo->SetIAPId( iapId );
+                        aConnectionInfo->SetStartTime( timeBuf() );
+                        
+                        TConnMonClientEnumBuf clientEnum;
+                        connMon.GetPckgAttribute( connId, 0, KClientInfo,
+                                                    clientEnum, waiter->iStatus );
+                        waiter->WaitForRequest();
+                        //User::WaitForRequest( status );
+                        aConnectionInfo->SetClientInfo( clientEnum() );
+
+                        CLOG_WRITEF( _L( "KClientInfo status: %d" ), waiter->iStatus.Int() );
+                        }                    
+                    }
+                break;
+                }
+            default :
+                {
+                break;
+                }                
+            }
+        }
+    CleanupStack::PopAndDestroy( waiter );    
+    connMon.Close();
+    result = connectionCount ? ETrue : EFalse;
+
+    CLOG_WRITEF( _L( "connectionCount: %d" ), connectionCount );     
+    CLOG_WRITEF( _L( "result: %d" ), result );     
+    CLOG_LEAVEFN( "CActiveDisconnectDlgPlugin::IsConnectionL" );
+
+    return result;      
+    }    
+    
+    
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/DisconnectDlg/src/ConnectionCArray.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,172 @@
+/*
+* Copyright (c) 2004 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: 
+*      Declares the CConnectionCArray
+*
+*/
+
+
+// INCLUDE FILES
+#include "ConnectionCArray.h"
+#include "ConnectionInfo.h"
+#include "ConnectionDialogsLogger.h"
+#include "connectioninfosortkey.h"
+
+// CONSTANTS
+LOCAL_D const TUint KConnArrayGranularity = KConnMonMaxClientUids; 
+                                                // from rconnmon.h
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CConnectionCArray::NewL
+// ---------------------------------------------------------
+//
+CConnectionCArray* CConnectionCArray::NewL()
+    {
+    CLOG_ENTERFN("CConnectionCArray::NewL");    
+    CConnectionCArray* self = new( ELeave ) CConnectionCArray();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self ); // self
+    CLOG_LEAVEFN("CConnectionCArray::NewL");    
+
+    return self;
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionCArray::CConnectionCArray
+// ---------------------------------------------------------
+//
+CConnectionCArray::CConnectionCArray()
+    {
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionCArray::ConstructL
+// ---------------------------------------------------------
+//
+void CConnectionCArray::ConstructL()
+    {
+    CLOG_ENTERFN("CConnectionCArray::ConstructL");    
+    
+    iConnArray = new( ELeave )CArrayPtrFlat<CConnectionInfo>( 
+                                                    KConnArrayGranularity );
+    CLOG_LEAVEFN("CConnectionCArray::ConstructL");    
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionCArray::~CConnectionCArray
+// ---------------------------------------------------------
+//
+CConnectionCArray::~CConnectionCArray()
+    {
+    CLOG_ENTERFN("CConnectionCArray::~CConnectionCArray");    
+    
+    if ( iConnArray )
+        {
+        iConnArray->ResetAndDestroy();
+        }
+    delete iConnArray;
+
+    CLOG_LEAVEFN("CConnectionCArray::~CConnectionCArray");    
+    }
+
+// ---------------------------------------------------------
+// CConnectionCArray::Count
+// ---------------------------------------------------------
+//
+TInt CConnectionCArray::Count() const
+    {
+    return iConnArray->Count();
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionCArray::AppendL
+// ---------------------------------------------------------
+//
+void CConnectionCArray::AppendL( const CConnectionInfo* aInfo )
+    {
+    iConnArray->AppendL( CONST_CAST( CConnectionInfo* , aInfo ) );
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionCArray::ResetAndDestroy
+// ---------------------------------------------------------
+//
+void CConnectionCArray::ResetAndDestroy()
+    {
+    iConnArray->ResetAndDestroy();
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionCArray::At
+// ---------------------------------------------------------
+//
+CConnectionInfo* CConnectionCArray::At( TInt aIndex ) const
+    {
+    return iConnArray->At( aIndex );
+    }
+    
+    
+// ---------------------------------------------------------
+// CConnectionCArray::GetArrayIndex
+// ---------------------------------------------------------
+//
+TInt CConnectionCArray::GetArrayIndex( TUint aConnectionId ) const
+    {
+    CLOG_WRITEF( _L( "GetArrayIndex: %d" ), aConnectionId );
+    TBool found( EFalse );
+    TInt index( 0 );
+    TInt count = iConnArray->Count();
+    TUint connectionId( 0 );
+
+    while( ( index <  count ) && !found  )
+        {
+        connectionId = ( *iConnArray )[index]->GetConnId();
+        if( connectionId == aConnectionId )
+            {
+            found = ETrue;
+            }
+        else
+            {
+            ++index;            
+            }
+        }
+
+    CLOG_WRITEF( _L("Found: %d"), found );
+
+    return ( found ? index : KErrNotFound );
+    }
+
+// ---------------------------------------------------------
+// CConnectionCArray::SortL
+// ---------------------------------------------------------
+//
+void CConnectionCArray::Sort() const
+    {
+    TConnectionInfoSortKey key;
+    key.SetPtr( iConnArray );
+    iConnArray->Sort( key );
+    }
+    
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/DisconnectDlg/src/ConnectionInfo.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,399 @@
+/*
+* Copyright (c) 2004 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: 
+*      Declares the connection info 
+*
+*/
+
+
+// INCLUDE FILES
+#include "ConnectionInfo.h"
+#include "ConnectionDialogsLogger.h"
+
+#include <StringLoader.h>
+#include <AknIconUtils.h>
+#include <apgcli.h>
+#include <AknsUtils.h>
+
+#include <DisconnectDlg.rsg>
+#include <disconnectdlgui.mbg>
+#include <data_caging_path_literals.hrh>
+
+
+// CONSTANTS
+
+// ROM folder
+_LIT( KDriveZ, "z:" );
+
+// Name of the MBM file containing bitmaps
+_LIT( KDisconnectDlgUiMbmFile, "DisconnectDlgUi.mbm" );
+
+const TInt KConnInfoMaxApplName = 256;
+
+const TInt KFeedsServerUid         = 0x1020728E;
+const TInt KDownloadMgrServerUid   = 0x10008D60;
+const TInt KMessagingServerUid     = 0x1000484b;
+const TInt KJavaVMUid              = 0x102033E6;
+const TInt KDHCPServerUid          = 0x101fd9c5;
+const TInt KPositioningServerUid   = 0x102073CA;
+
+LOCAL_D const TInt KStringsGranularity = 3;
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CConnectionInfo::NewLC
+// ---------------------------------------------------------
+//
+CConnectionInfo* CConnectionInfo::NewLC()
+    {
+    CLOG_ENTERFN("CConnectionInfo::NewLC");    
+    
+    CConnectionInfo* self = new( ELeave ) CConnectionInfo();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CLOG_LEAVEFN("CConnectionInfo::NewLC");    
+    
+    return self;
+    }
+
+
+void CConnectionInfo::ConstructL()
+    {
+    }
+
+// ---------------------------------------------------------
+// CConnectionInfo::CConnectionInfo
+// ---------------------------------------------------------
+//
+CConnectionInfo::CConnectionInfo()
+: iConnId( 0 ),
+  iBearerType( EBearerUnknown )
+    {
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionInfo::~CConnectionInfo
+// ---------------------------------------------------------
+//
+CConnectionInfo::~CConnectionInfo()
+    {
+    CLOG_ENTERFN("CConnectionInfo::~CConnectionInfo");    
+    
+    delete iAppName;
+    delete iIapName;
+    delete iAppIcon;
+
+    CLOG_LEAVEFN("CConnectionInfo::~CConnectionInfo");    
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionInfo::GetAppNameL
+// ---------------------------------------------------------
+//
+TPtrC CConnectionInfo::GetAppNameL( TBool &aUseSharedIcon )
+    {
+    CLOG_ENTERFN("CConnectionInfo::GetAppNameL");    
+    
+    aUseSharedIcon = EFalse;
+    TBool specialServer = EFalse;
+    if( !iAppName )
+        {
+        iAppName = HBufC::NewL( KConnInfoMaxApplName );
+        TPtr infoBuf = iAppName->Des();
+        HBufC* actAppName = NULL;
+        // Check whether it is an internal or external (modem) connection
+        // External (modem) connections does not need application name
+        if( iBearerType < EBearerExternalCSD )
+            {
+
+#ifndef __WINS__ // Appl. uid is always zero in emulator
+
+            RApaLsSession appSess;
+            TApaAppInfo appInfo;
+
+            TInt count = iClientInfo.iCount;
+            CLOG_WRITEF(_L( "iClientInfo.iCount: %d" ), count );
+
+            // The connection could be shared by several applications
+                    
+            User::LeaveIfError( appSess.Connect() );
+                    
+            _LIT( KStrCommaSpace, ", " );
+
+            CDesCArrayFlat* strings = new( ELeave ) CDesCArrayFlat( 
+                                                        KStringsGranularity );
+            CleanupStack::PushL( strings );
+            
+            TUint i;
+            TUint realNumberOfOwners = 0;
+            for( i = 0; i < count; i++ )
+                {
+                realNumberOfOwners++;
+                actAppName = NULL;
+                appInfo.iCaption.Zero();
+
+                TInt result = appSess.GetAppInfo( appInfo, 
+                                                  iClientInfo.iUid[i] );
+
+                //================================
+                CLOG_WRITEF( _L( "result: %d" ), result ); 
+                CLOG_WRITEF( _L( "iClientInfo.iUid[i].iUid: %x" ), iClientInfo.iUid[i].iUid );
+                if( result != KErrNone )
+                    {
+                    TInt resId = 0;
+                    switch( iClientInfo.iUid[i].iUid )
+                        {
+                        case KFeedsServerUid:
+                            {
+                            resId = R_QTN_NETW_DDLG_APP_RSS_SERVER;
+                            break;
+                            }
+                        case KDownloadMgrServerUid:
+                            {
+                            resId = R_QTN_NETW_DDLG_APP_DL_MGR;
+                            break;
+                            }
+                        case KMessagingServerUid:
+                            {
+                            resId = R_QTN_NETW_DDLG_APP_MSG_SERVER;
+                            break;
+                            }
+                        case KJavaVMUid:
+                            {
+                            resId = R_QTN_NETW_DDLG_APP_JAVA_MIDLET;
+                            break;
+                            }
+                        case KDHCPServerUid:
+                            {   // Forget about DHCP server!
+                            realNumberOfOwners--;
+                            break;
+                            }
+			case KPositioningServerUid:
+                        	{
+                        	resId = R_QTN_NETW_DDLG_APP_SUPL;
+                        	break;	
+                        	}
+                        default:
+                            {
+                            resId = R_QTN_NETW_DDLG_APP_UNKNOWN;
+                            break;
+                            }
+                        }
+
+                    if ( resId )
+                        {
+                        actAppName = StringLoader::LoadL( resId );
+                        specialServer = ETrue;
+                        }
+                    }
+                else
+                    {
+                    actAppName =  HBufC::NewL( appInfo.iCaption.Length() );
+                    TPtr actAppNameBuf = actAppName->Des();
+                    actAppNameBuf.Append( appInfo.iCaption );
+                    }
+
+                if ( actAppName )
+                    {
+                    strings->AppendL( actAppName->Des() );        
+                    delete actAppName;
+                    }
+                }
+
+                if ( realNumberOfOwners > 1 || specialServer )
+                    {
+                    aUseSharedIcon = ETrue;
+                    }
+
+                strings->Sort();
+                for( TUint i = 0; i < realNumberOfOwners; i++ )
+                    {
+                    if ( strings->MdcaPoint( i ).Length() )
+                        {
+                        infoBuf.Append( strings->MdcaPoint( i ) );
+                        if( i < realNumberOfOwners-1 )
+                            {
+                            // This case the application names should be comma
+                            // separated
+                            infoBuf.Append( KStrCommaSpace );
+                            }
+                        }
+                    }
+                CleanupStack::PopAndDestroy( strings );
+
+                appSess.Close();
+
+#else
+            _LIT( KStrApplication, "Application" );
+            // Give a dummy name of the application
+            infoBuf.Append( KStrApplication );
+
+#endif /* __WINS__ */
+
+            }
+        /* modem connections does not need application name
+        else 
+            {
+            }
+        */
+        }
+    CLOG_LEAVEFN("CConnectionInfo::GetAppNameL");    
+
+    return iAppName->Des();
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionInfo::GetIapNameL
+// ---------------------------------------------------------
+//
+TPtrC CConnectionInfo::GetIapNameL()
+    {
+    CLOG_ENTERFN("CConnectionInfo::GetIapNameL");    
+    
+    if( iBearerType >= EBearerExternalCSD )
+        {
+        // It is a modem connection, therefore 
+        // new IAP name must be constructed
+        delete iIapName;
+        iIapName = NULL;
+
+        iIapName = StringLoader::LoadL( R_QTN_CMON_ITEM_CONN_NAME_MODEM );
+        }
+    CLOG_LEAVEFN("CConnectionInfo::GetIapNameL");    
+
+    return iIapName->Des();
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionInfo::GetAppIconL
+// ---------------------------------------------------------
+//
+#ifdef __WINS__
+CGulIcon* CConnectionInfo::GetAppIconL( TBool /*aUseSharedIcon*/ )
+#else
+CGulIcon* CConnectionInfo::GetAppIconL( TBool aUseSharedIcon )
+#endif	// __WINS__
+    {
+    CLOG_ENTERFN("CConnectionInfo::GetAppIconL");    
+    
+    if( !iAppIcon )
+        {
+        CFbsBitmap* bitmap = NULL; 
+        CFbsBitmap* mask = NULL;
+        TInt err( KErrNone );
+        
+        TFileName iconsFileName;
+
+        iconsFileName.Append( KDriveZ );
+        iconsFileName.Append( KDC_APP_BITMAP_DIR );
+        iconsFileName.Append( KDisconnectDlgUiMbmFile );        
+
+#ifndef __WINS__ // Appl. uid is always zero in emulator
+        MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
+
+        if( iBearerType < EBearerExternalCSD )
+            {
+            // It is an interanl connection.
+            // Let's start to get the application icon
+
+            TInt i( 0 );
+            TBool iconFound = EFalse;
+
+            if( !aUseSharedIcon )
+                {
+                // The connection is not shared by many application
+                // Get the application icon
+                TUid uid = iClientInfo.iUid[i]; 
+                CLOG_WRITEF(_L( "uid: %x" ), uid );               
+                
+                TRAP( err, 
+                    {
+                    AknsUtils::CreateAppIconLC( skinInstance, uid, 
+                                                EAknsAppIconTypeList, 
+                                                bitmap, mask );
+                    CleanupStack::Pop( 2 );
+                    } );
+                
+                CLOG_WRITEF(_L( "err: %d" ), err ); 
+                
+                if ( err == KErrNone )
+                    {
+                    CLOG_WRITEF(_L( "Using the icon proper of the application. err: %d" ), err ); 
+                    TRAP( err, iAppIcon = CGulIcon::NewL( bitmap, mask ) );
+                    if ( err )
+                        {
+                        delete bitmap;
+                        delete mask;
+                        User::Leave( err );
+                        }
+                    else
+                        {
+                        iconFound = ETrue;
+                        }
+                    }
+                }
+
+            if ( !iconFound )
+                {   // shared connection: qgn_prop_netw_shared_conn
+                iAppIcon = AknsUtils::CreateGulIconL( skinInstance, 
+                           KAknsIIDQgnPropNetwSharedConn,
+                           iconsFileName, 
+                           EMbmDisconnectdlguiQgn_prop_netw_shared_conn, 
+                           EMbmDisconnectdlguiQgn_prop_netw_shared_conn_mask );
+                }
+            }
+        else // it is a modem connection: qgn_menu_fax_lst
+            {
+            AknIconUtils::CreateIconL( bitmap, mask, iconsFileName, 
+                                   EMbmDisconnectdlguiQgn_menu_fax_lst, 
+                                   EMbmDisconnectdlguiQgn_menu_fax_lst_mask );
+            
+            TRAP( err, iAppIcon = CGulIcon::NewL( bitmap, mask ) );
+            if ( err )
+                {
+                delete bitmap;
+                delete mask;
+                User::Leave( err );
+                }
+            }
+
+#else // testing on emulator: dummy icon
+
+            AknIconUtils::CreateIconL( bitmap, mask, iconsFileName, 
+                                   EMbmDisconnectdlguiQgn_menu_fax_lst, 
+                                   EMbmDisconnectdlguiQgn_menu_fax_lst_mask );
+            
+            TRAP( err, iAppIcon = CGulIcon::NewL( bitmap, mask ) );
+            if ( err )
+                {
+                delete bitmap;
+                delete mask;
+                User::Leave( err );
+                }
+#endif /* __WINS__ */
+
+        }
+    CLOG_LEAVEFN("CConnectionInfo::GetAppIconL");    
+        
+    return iAppIcon;
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/DisconnectDlg/src/ConnectionModel.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,408 @@
+/*
+* Copyright (c) 2004 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: 
+*     The model of the connections.
+*
+*/
+
+
+// INCLUDE FILES
+#include "ConnectionModel.h"
+#include "DisconnectDlgUi.h"
+#include "ConnectionInfo.h"
+#include "ConnectionCArray.h"
+#include "DisconnectDlgDialog.h"
+#include "ConnectionDialogsLogger.h"
+
+#include <aknnotedialog.h>
+#include <StringLoader.h>
+#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include <commsdat.h>
+#else
+#include <commsdat.h>
+#include <commsdat_partner.h>
+#endif
+
+#include <DisconnectDlg.rsg>
+
+
+// CONSTANTS
+
+_LIT( KMrouterName, "mRouter" );
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CConnectionModel::NewL
+// ---------------------------------------------------------
+//
+CConnectionModel* CConnectionModel::NewL(
+                                  CDisconnectDialogUi* aDisconnectDialogUi,
+                                  CConnectionInfo* aConnectionInfo )
+    {
+    CLOG_ENTERFN("CConnectionModel::NewL");    
+    
+    CConnectionModel* self = 
+                        new( ELeave ) CConnectionModel( aDisconnectDialogUi );
+    CleanupStack::PushL( self );
+    self->ConstructL( aConnectionInfo );
+    CleanupStack::Pop( self );
+    CLOG_LEAVEFN("CConnectionModel::NewL");    
+
+    return self;
+    }
+
+// ---------------------------------------------------------
+// CConnectionModel::~CConnectionModel
+// ---------------------------------------------------------
+//
+CConnectionModel::~CConnectionModel()
+    {
+    CLOG_ENTERFN("CConnectionModel::~CConnectionModel");    
+    
+    // RConnectionMonitor stop sending its notifications
+    iMonitor.CancelNotifications();
+    iMonitor.Close();
+
+    // Delete connetion array and its content
+    if( iConnArray )
+        {
+        delete iConnArray;
+        }
+
+    CLOG_LEAVEFN("CConnectionModel::~CConnectionModel");    
+    }
+
+// ---------------------------------------------------------
+// CConnectionModel::CConnectionModel
+// ---------------------------------------------------------
+//
+CConnectionModel::CConnectionModel( CDisconnectDialogUi* aDisconnectDialogUi )
+: iClosingConnectionIndex( 0 ), 
+  iDeleting( EFalse )
+    {
+    iDisconnectDialogUi = aDisconnectDialogUi;
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionModel::ConstructL
+// ---------------------------------------------------------
+//
+void CConnectionModel::ConstructL( CConnectionInfo* aConnectionInfo  )
+    {
+    CLOG_ENTERFN("CConnectionModel::ConstructL");    
+    
+    // Connect to the RConectionMonitor and listen to its event's
+    iMonitor.ConnectL();
+    iMonitor.NotifyEventL( *this );
+
+    // Construct the connection array
+    iConnArray = CConnectionCArray::NewL();
+    iConnArray->AppendL( aConnectionInfo );
+
+    // Start collecting the connection info
+    InitConnectionArrayL();
+
+    // Sort on basis of connection duration. Oldest connection top.
+    iConnArray->Sort();
+
+    CLOG_LEAVEFN("CConnectionModel::ConstructL");    
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionModel::InitConnectionArrayL
+// ---------------------------------------------------------
+//
+void CConnectionModel::InitConnectionArrayL()
+    {   
+    CLOG_ENTERFN("CConnectionModel::InitConnectionArrayL");    
+    
+    TUint i( 0 );
+    TUint connNum( 0 );
+    TUint subConnectionCount( 0 );
+    TUint connId( 0 );    
+    CConnectionInfo* info = iConnArray->At( 0 );
+    TUint firstConnId = info->GetConnId();
+
+    TInt bearer( 0 );
+    TInt connStatus( 0 );
+
+    TRequestStatus status;
+    TConnMonClientEnumBuf clientEnum;
+    TBuf<CommsDat::KMaxTextLength> apName;
+
+    iMonitor.GetConnectionCount( connNum, status );
+    User::WaitForRequest( status );
+    
+    CLOG_WRITEF(_L( "status: %d" ), status.Int() ); 
+    CLOG_WRITEF(_L( "connNum: %d" ), connNum ); 
+    
+    for( i = 1; i < connNum + 1; ++i )                    
+        {
+        iMonitor.GetConnectionInfo( i, connId, subConnectionCount );
+        if( firstConnId != connId )  
+            {               // do not add the first connection to array, again
+            iMonitor.GetStringAttribute( connId, 0, KIAPName, apName, status );
+            User::WaitForRequest( status );
+    
+            CLOG_WRITEF(_L( "KIAPName status: %d" ), status.Int() ); 
+    
+            iMonitor.GetPckgAttribute( connId, 0, KClientInfo, clientEnum, 
+                                       status );
+            User::WaitForRequest( status );
+            CLOG_WRITEF(_L( "KClientInfo status: %d" ), status.Int() );  
+            
+    
+            iMonitor.GetIntAttribute( connId, 0, KBearer, bearer, status );
+            User::WaitForRequest( status );
+            CLOG_WRITEF(_L( "KBearer status: %d" ), status.Int() ); 
+            
+    
+            iMonitor.GetIntAttribute( connId, 0, KConnectionStatus, connStatus,
+                                      status );
+            User::WaitForRequest( status );
+            CLOG_WRITEF(_L( "KConnectionStatus status: %d" ), status.Int() ); 
+            
+            CLOG_WRITEF(_L( "bearer: %d" ), (TInt)bearer ); 
+
+            TUint iapId( 0 );
+            iMonitor.GetUintAttribute( connId, 0, KIAPId, iapId, status ); 
+            User::WaitForRequest( status );
+            CLOG_WRITEF(_L( "KIAPId status: %d" ), status.Int() );  
+            CLOG_WRITEF(_L( "iapId: %d" ), iapId );
+            
+            TConnMonTimeBuf timeBuf;
+            iMonitor.GetPckgAttribute( connId, 0, KStartTime, timeBuf, status );
+            User::WaitForRequest( status );
+            CLOG_WRITEF(_L( "KStartTime status: %d" ), status.Int() ); 
+                       
+            switch( bearer )
+                {
+                case EBearerGPRS :
+                case EBearerEdgeGPRS :
+                case EBearerExternalGPRS : 
+                case EBearerExternalEdgeGPRS :
+                case EBearerWCDMA :
+                case EBearerExternalWCDMA :
+    #ifdef __WINS__
+                case EBearerLAN :
+    #endif // WINS
+                    {
+                    if ( ( connStatus == KLinkLayerOpen ) ||
+                         ( connStatus == KConnectionOpen && 
+                           bearer >= EBearerExternalCSD ) )
+                        {  
+                        apName.Trim();
+                        if( apName.Left( KMrouterName().Length() ).
+                            CompareF( KMrouterName ) )
+                            {                    
+                            // add array:
+                            CConnectionInfo* info = CConnectionInfo::NewLC();
+        
+                            info->SetConnId( connId );
+                            info->SetBearerType( bearer);
+                            info->SetIapNameL( apName );
+                            info->SetIAPId( iapId );
+                            info->SetClientInfo( clientEnum() );
+                            info->SetStartTime( timeBuf() );
+
+                            iConnArray->AppendL( info );
+
+                            CleanupStack::Pop( info ); // info        
+                            }
+                        }
+                    break;
+                    }
+                default :
+                    {
+                    break;
+                    }                
+                }
+            }
+        }
+    CLOG_LEAVEFN("CConnectionModel::InitConnectionArrayL");    
+        
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionModel::EndConnection
+// ---------------------------------------------------------
+//
+TInt CConnectionModel::EndConnection( TUint aConnIndex )
+    {
+    CLOG_ENTERFN("CConnectionModel::EndConnection");    
+    
+    // Syncron request, we will wait for ConnMonEvent
+    // and the we can say the connection is closed.
+    iClosingConnectionIndex = aConnIndex;
+    CConnectionInfo* info = iConnArray->At( iClosingConnectionIndex );
+    TUint connId = info->GetConnId();
+
+    CLOG_WRITEF(_L( "connId: %d" ), connId ); 
+    
+    TInt result = iMonitor.SetBoolAttribute( connId, 0, KConnectionStop, 
+                                             ETrue );
+    CLOG_WRITEF(_L( "result: %d" ), result ); 
+                                             
+    if ( result )   // if there is an error, notifier will finish, 
+        {           // so cancel all other notifications
+        iMonitor.CancelNotifications();
+        if( KNullUnit == result )
+            {
+            TUint iapId = info->GetIAPId();
+            iDisconnectDialogUi->SetClosedIapId( iapId );
+            }
+        }
+    else
+        {
+        iDeleting = ETrue;
+        TUint iapId = info->GetIAPId();
+        iDisconnectDialogUi->SetClosedIapId( iapId );        
+        }
+    CLOG_LEAVEFN("CConnectionModel::EndConnection");    
+        
+    return result;
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionModel::CancelNotification
+// ---------------------------------------------------------
+//
+void CConnectionModel::CancelNotification()
+    {
+    iMonitor.CancelNotifications();    
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionModel::EventL
+// ---------------------------------------------------------
+//
+void CConnectionModel::EventL( const CConnMonEventBase& aConnMonEvent )
+    {
+    CLOG_ENTERFN("CConnectionModel::EventL");    
+    
+    CConnectionInfo* info = iConnArray->At( iClosingConnectionIndex );
+    TUint connId = info->GetConnId();
+    CLOG_WRITEF(_L( "connId: %d" ), connId ); 
+    CLOG_WRITEF(_L( "iDeleting: %b" ), iDeleting ); 
+    
+    if( iDeleting && iDisconnectDialogUi  && 
+        ( EConnMonDeleteConnection == aConnMonEvent.EventType() )
+        && ( connId == aConnMonEvent.ConnectionId() ) )
+        {
+        // notifier will finish, so cancel all other notifications
+        iMonitor.CancelNotifications();     
+        SelectedConnectionClosedL();
+        
+        iDisconnectDialogUi->CompleteL( KErrNone );
+        }
+    else if( iDisconnectDialogUi  && 
+             ( EConnMonDeleteConnection == aConnMonEvent.EventType() ) )
+        {
+        connId = aConnMonEvent.ConnectionId();
+        CLOG_WRITEF(_L( "connId: %d" ), connId ); 
+
+        TInt result = iConnArray->GetArrayIndex( connId );
+        CLOG_WRITEF(_L( "result: %d" ), result ); 
+
+        if ( result != KErrNotFound )
+            {
+            iMonitor.CancelNotifications();  
+            info = iConnArray->At( result ); 
+            TUint iapId = info->GetIAPId();
+            CLOG_WRITEF(_L( "iapId: %d" ), iapId );
+
+            iDisconnectDialogUi->SetClosedIapId( iapId );
+            iDisconnectDialogUi->CompleteL( KErrNone );
+            }
+        }
+        
+    CLOG_LEAVEFN("CConnectionModel::EventL");            
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionModel::GetConnArray
+// ---------------------------------------------------------
+//
+CConnectionCArray* CConnectionModel::GetConnArray() const
+    {
+    return iConnArray;
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionModel::SelectedConnectionClosedL
+// ---------------------------------------------------------
+//
+void CConnectionModel::SelectedConnectionClosedL()
+    {
+    CLOG_ENTERFN("CConnectionModel::SelectedConnectionClosedL");    
+    
+    // the connection is succesfully closed
+    CConnectionInfo* info = iConnArray->At( iClosingConnectionIndex );
+
+    TPtrC iap = info->GetIapNameL();
+    TInt bearerType = info->GetBearerType();
+
+    if( bearerType < EBearerExternalCSD )
+        {
+        InfoNoteL( R_QTN_NETW_CONF_CONN_DISCONNECTED, &iap );
+        }
+    else
+        {
+        InfoNoteL( R_QTN_NETW_CONF_MODEM_CONN_DISCONNECTED );
+        }
+
+    CLOG_LEAVEFN("CConnectionModel::SelectedConnectionClosedL");    
+    }
+
+
+// ---------------------------------------------------------
+// CDisconnectDlgDialog::InfoNoteL
+// ---------------------------------------------------------
+//
+void CConnectionModel::InfoNoteL( const TInt aPromptResourceId,
+                                  const TDesC* aPrompt )
+    {
+    CLOG_ENTERFN("CConnectionModel::InfoNoteL");    
+    
+    HBufC* informationText;
+    if ( aPrompt )
+        {
+        informationText = StringLoader::LoadLC( aPromptResourceId, *aPrompt );
+        }
+    else
+        {
+        informationText = StringLoader::LoadLC( aPromptResourceId );        
+        }
+
+    CAknNoteDialog* dialog = new( ELeave )CAknNoteDialog( 
+                                REINTERPRET_CAST( CEikDialog**, &dialog ) );
+    dialog->PrepareLC( R_DISCONNECTDLG_CONFIRM_NOTE );
+    dialog->SetCurrentLabelL( EGeneralNote, informationText->Des() );
+    dialog->RunDlgLD( CAknNoteDialog::ELongTimeout, CAknNoteDialog::ENoTone );
+
+    CleanupStack::PopAndDestroy( informationText );  // informationText
+    
+    CLOG_LEAVEFN("CConnectionModel::InfoNoteL");    
+    }
+
+    
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/DisconnectDlg/src/DisconnectDlgActiveWaiter.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,110 @@
+/*
+* 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:  Implementation of DisconnectDlgActiveWaiter.
+*
+*/
+
+
+// INCLUDE FILES
+#include "DisconnectDlgActiveWaiter.h"
+#include "ConnectionDialogsLogger.h"
+
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CDisconnectDlgActiveWaiter* CDisconnectDlgActiveWaiter::NewL()
+// ---------------------------------------------------------
+//
+CDisconnectDlgActiveWaiter* CDisconnectDlgActiveWaiter::NewL( )
+    {
+    CLOG_ENTERFN( "CDisconnectDlgActiveWaiter::NewL " );  
+    
+    CDisconnectDlgActiveWaiter* self = 
+                         new ( ELeave ) CDisconnectDlgActiveWaiter( );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    
+    CLOG_LEAVEFN( "CDisconnectDlgActiveWaiter::NewL " );      
+
+    return self;        
+    }
+
+// ---------------------------------------------------------
+// CDisconnectDlgActiveWaiter::ConstructL()
+// ---------------------------------------------------------
+//
+void CDisconnectDlgActiveWaiter::ConstructL()
+    {     
+    CActiveScheduler::Add( this );            
+    }
+
+
+// ---------------------------------------------------------
+// CDisconnectDlgActiveWaiter::CDisconnectDlgActiveWaiter()
+// ---------------------------------------------------------
+//
+CDisconnectDlgActiveWaiter::CDisconnectDlgActiveWaiter( )
+: CActive( EPriorityNormal )
+    {
+    }
+    
+
+// ---------------------------------------------------------
+// CDisconnectDlgActiveWaiter::~CDisconnectDlgActiveWaiter()
+// ---------------------------------------------------------
+//    
+CDisconnectDlgActiveWaiter::~CDisconnectDlgActiveWaiter()
+    {
+    Cancel();
+    }
+
+
+// ---------------------------------------------------------
+// CDisconnectDlgActiveWaiter::DoCancel()
+// ---------------------------------------------------------
+// 
+void CDisconnectDlgActiveWaiter::DoCancel()
+    {
+    }
+     
+ 
+// ---------------------------------------------------------
+// CDisconnectDlgActiveWaiter::RunL()
+// ---------------------------------------------------------
+//     
+void CDisconnectDlgActiveWaiter::RunL()
+    {
+    CLOG_ENTERFN( "CDisconnectDlgActiveWaiter::RunL " );  
+    if ( iWait.IsStarted() )
+        {
+        iWait.AsyncStop();
+        }
+    CLOG_LEAVEFN( "CDisconnectDlgActiveWaiter::RunL " );
+    }
+
+// ---------------------------------------------------------
+// CDisconnectDlgActiveWaiter::WaitForRequest()
+// ---------------------------------------------------------
+// 
+TInt CDisconnectDlgActiveWaiter::WaitForRequest()
+    {
+    SetActive(); 
+    iWait.Start();
+    return iStatus.Int();
+    }    
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/DisconnectDlg/src/DisconnectDlgDialog.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,263 @@
+/*
+* Copyright (c) 2004 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 the pop-up selection list with the active connections.
+*
+*/
+
+
+// INCLUDE FILES
+#include "DisconnectDlgDialog.h"
+#include "DisconnectDlgUi.h"
+#include "ConnectionInfo.h"
+#include "ConnectionCArray.h"
+#include "ConnectionModel.h"
+#include "ConnectionDialogsLogger.h"
+#include "ExpiryTimer.h"
+
+#include <DisconnectDlg.rsg>
+#include <AknIconArray.h>
+#include <StringLoader.h>
+#include <uikon/eiksrvui.h>
+
+
+// CONSTANTS
+/**
+* Listbox item format mask
+*/
+_LIT( KFormat, "%d\t%S\t%S" );
+
+/**
+* Max size of Listbox item text
+*/
+const TInt KListItemTextBuf = 512;
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CDisconnectDlgDialog::NewL
+// ---------------------------------------------------------
+//
+CDisconnectDlgDialog* CDisconnectDlgDialog::NewL( 
+                                     CDisconnectDialogUi* aDisconnectDialogUi,
+                                     CConnectionModel* aConnModel,
+                                     TInt* aIndex,
+                                     TUint32& aIAPId )
+    {
+    CLOG_ENTERFN("CDisconnectDlgDialog::NewL");    
+    CDisconnectDlgDialog* dialog = new( ELeave ) CDisconnectDlgDialog( 
+                            aDisconnectDialogUi, aConnModel, aIndex, aIAPId );
+    CleanupStack::PushL( dialog );
+    dialog->ConstructL();
+    CleanupStack::Pop( dialog ); // dialog
+    CLOG_LEAVEFN("CDisconnectDlgDialog::NewL");    
+
+    return dialog;
+    }
+
+
+// ---------------------------------------------------------
+// CDisconnectDlgDialog::CDisconnectDlgDialog
+// ---------------------------------------------------------
+//
+CDisconnectDlgDialog::CDisconnectDlgDialog( 
+                                    CDisconnectDialogUi* aDisconnectDialogUi,
+                                    CConnectionModel* aConnModel,
+                                    TInt* aIndex,
+                                    TUint32& aIAPId )
+: CAknListQueryDialog( aIndex ), 
+  iIAPId( aIAPId )  
+    {
+    CLOG_ENTERFN("CDisconnectDlgDialog::CDisconnectDlgDialog");    
+    
+    iDisconnectDialogUi = aDisconnectDialogUi;
+    iConnModel = aConnModel;
+
+    CLOG_LEAVEFN("CDisconnectDlgDialog::CDisconnectDlgDialog");
+    }
+
+
+// ---------------------------------------------------------
+// CDisconnectDlgDialog::RunDlgLD
+// ---------------------------------------------------------
+//
+void CDisconnectDlgDialog::RunDlgLD()
+    {
+    CLOG_ENTERFN("CDisconnectDlgDialog::RunDlgLD");    
+    
+    iPrompt = StringLoader::LoadL( R_QTN_NETW_HEAD_CONN_TO_CLOSE );
+    ExecuteLD( R_DISCONNECTDLG_DIALOG, iPrompt->Des() );
+
+    CLOG_LEAVEFN("CDisconnectDlgDialog::RunDlgLD");    
+    }
+
+
+// ---------------------------------------------------------
+// CDisconnectDlgDialog::ConstructL
+// ---------------------------------------------------------
+//
+void CDisconnectDlgDialog::ConstructL()
+    {
+    }
+
+
+// ---------------------------------------------------------
+// CDisconnectDlgDialog::~CDisconnectDlgDialog
+// ---------------------------------------------------------
+//
+CDisconnectDlgDialog::~CDisconnectDlgDialog()
+    {
+    CLOG_ENTERFN("CDisconnectDlgDialog::~CDisconnectDlgDialog");    
+    
+    delete iPrompt;
+    STATIC_CAST( CEikServAppUi*, 
+                CCoeEnv::Static()->AppUi() )->SuppressAppSwitching( EFalse );
+    
+    delete iExpiryTimer;
+
+    CLOG_LEAVEFN("CDisconnectDlgDialog::~CDisconnectDlgDialog");    
+    }
+
+
+// ---------------------------------------------------------
+// CDisconnectDlgDialog::PreLayoutDynInitL
+// ---------------------------------------------------------
+//
+void CDisconnectDlgDialog::PreLayoutDynInitL()
+    {
+    CLOG_ENTERFN("CDisconnectDlgDialog::PreLayoutDynInitL");    
+    
+    CAknListQueryDialog::PreLayoutDynInitL();
+    
+    STATIC_CAST( CEikServAppUi*, 
+                CCoeEnv::Static()->AppUi() )->SuppressAppSwitching( ETrue );
+    
+    CConnectionCArray* connArray = iConnModel->GetConnArray();
+
+    // items: application and IAP names
+    CDesCArrayFlat* items = new( ELeave )CDesCArrayFlat( connArray->Count() );
+    CleanupStack::PushL( items );
+    // icons: application icons
+    CArrayPtr< CGulIcon >* icons = new( ELeave )CAknIconArray( 
+                                                        connArray->Count() );
+    CleanupStack::PushL( icons );
+
+    CGulIcon* iconTemp = NULL;
+    CGulIcon* icon = NULL;
+
+    TInt count = connArray->Count();
+    CLOG_WRITEF(_L( "count: %d" ), count );     
+
+    // Get the info of every connection and initialize the list of dialog
+    for( TInt i = 0; i < count; i++ )
+        {
+        CConnectionInfo* info = connArray->At( i );
+
+        TBool useSharedIcon = EFalse;
+        // Application and IAP name
+        HBufC* listItem = HBufC::NewLC( KListItemTextBuf );
+        TPtrC iap = info->GetIapNameL();
+        
+        TPtrC app = info->GetAppNameL( useSharedIcon ); 
+
+        // Application icon
+        iconTemp = info->GetAppIconL( useSharedIcon );
+        icon = CGulIcon::NewL();
+        icon->SetBitmapsOwnedExternally( ETrue );
+        icon->SetBitmap( iconTemp->Bitmap() );
+        icon->SetMask( iconTemp->Mask() );
+
+        icons->AppendL( icon );
+
+        listItem->Des().Format( KFormat, i, &iap, &app );
+        items->AppendL( listItem->Des() );
+
+        CleanupStack::PopAndDestroy( listItem ); // listItem
+        }
+
+    // set new item list
+    SetItemTextArray( items );
+    // set icon list
+    SetIconArrayL( icons );
+    // we don't have to take care of delete items
+    SetOwnershipType( ELbmOwnsItemArray );
+
+    CleanupStack::Pop( icons );
+    CleanupStack::Pop( items );
+    
+    iExpiryTimer = CExpiryTimer::NewL( *this );
+    iExpiryTimer->Start();
+
+    CLOG_LEAVEFN("CDisconnectDlgDialog::PreLayoutDynInitL");
+    }
+
+
+// ---------------------------------------------------------
+// CDisconnectDlgDialog::OkToExitL
+// ---------------------------------------------------------
+//
+TBool CDisconnectDlgDialog::OkToExitL( TInt aButtonId )
+    {
+    CLOG_ENTERFN("CDisconnectDlgDialog::OkToExitL");    
+    
+    TBool retVal( ETrue );
+    CLOG_WRITEF(_L( "aButtonId: %d" ), aButtonId );     
+    
+    if ( aButtonId == EAknSoftkeySelect || aButtonId == EAknSoftkeyOk ||
+         aButtonId == EAknSoftkeyDone )
+        {
+        TInt toBeClosedItem = ListBox()->CurrentItemIndex();
+        TInt result = iConnModel->EndConnection( toBeClosedItem );
+        iDisconnectDialogUi->iDialogRun = EFalse;
+        if ( result )
+            {
+            TInt resId = R_QTN_CMON_INFO_CONN_ALREADY_END;
+            if( KNullUnit == result )
+                {
+                result = KErrNone;
+                }
+            else
+                {
+                resId = R_QTN_NETW_INFO_DISCONNECT_FAILED;
+                result = KErrGeneral;
+                }
+
+            iConnModel->InfoNoteL( resId );
+            iDisconnectDialogUi->CompleteL( result );
+            }
+        }
+    else if ( aButtonId == EAknSoftkeyCancel )
+        {
+        iConnModel->CancelNotification();
+        iDisconnectDialogUi->iDialogRun = EFalse;        
+        iDisconnectDialogUi->CompleteL( KErrCancel );
+        }
+    else
+        {
+        retVal = EFalse;
+        }
+
+    CLOG_WRITEF(_L( "retVal: %d" ), retVal );    
+    CLOG_LEAVEFN("CDisconnectDlgDialog::OkToExitL");    
+
+    return retVal;
+    }
+
+void CDisconnectDlgDialog::HandleTimedOut()
+    {
+    TRAP_IGNORE( TryExitL(EAknSoftkeyCancel) );
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/DisconnectDlg/src/DisconnectDlgUi.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,420 @@
+/*
+* Copyright (c) 2004 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 the main handler, CDisconnectDialogUi and public API for 
+*     Disconnect Dialog UI.
+*
+*/
+
+
+// INCLUDE FILES
+#include "DisconnectDlgUi.h"
+#include "ActiveDisconnectDlgPlugin.h"
+#include "ConnectionModel.h"
+#include "QueryDisconnectDlgDialog.h"
+#include "ConnectionDialogsUidDefs.h"
+#include "ConnectionDialogsLogger.h"
+
+#include <bautils.h>
+#include <textresolver.h>
+
+#include <DisconnectDlg.rsg>
+#include <data_caging_path_literals.hrh>
+
+
+// CONSTANTS
+
+// ROM folder
+_LIT( KDriveZ, "z:" );
+
+// Name of the RSC file containing resources
+_LIT( KDisconnectDlgUiRSCFile, "DisconnectDlg.rsc" );
+
+/**
+* Count of used MEikSrvNotifierBase
+*/
+LOCAL_D const TInt KPluginGranularity = 1;
+
+
+LOCAL_C void CreateNotifiersL( 
+                          CArrayPtrFlat<MEikSrvNotifierBase2>* aNotifiers );
+
+
+EXPORT_C CArrayPtr<MEikSrvNotifierBase2>* NotifierArray()
+    {
+    CArrayPtrFlat<MEikSrvNotifierBase2>* array = new( ELeave )
+                    CArrayPtrFlat<MEikSrvNotifierBase2>( KPluginGranularity );
+
+    if ( array )
+        {
+        TRAPD( err, CreateNotifiersL( array ) );
+        if( err )
+            {
+            TInt count = array->Count();
+            while( count-- )
+                {
+                ( *array )[count]->Release();
+                }
+            delete array;
+            array = NULL;
+            }
+        }
+
+    return( array );
+    }
+
+
+// ---------------------------------------------------------
+// CreateNotifiersL( CArrayPtrFlat<MEikSrvNotifierBase>* aNotifiers )
+// ---------------------------------------------------------
+//
+LOCAL_C void CreateNotifiersL( 
+                              CArrayPtrFlat<MEikSrvNotifierBase2>* aNotifiers )
+    {
+    MEikSrvNotifierBase2 *serNotify;
+
+    serNotify = CDisconnectDialogUi::NewL();
+    CleanupStack::PushL( serNotify );
+    aNotifiers->AppendL( serNotify );
+    CleanupStack::Pop( serNotify ); // serNotify
+    }
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CDisconnectDialogUi::NewLC
+// ---------------------------------------------------------
+//
+CDisconnectDialogUi* CDisconnectDialogUi::NewL()
+    {
+    CDisconnectDialogUi* self = new( ELeave ) CDisconnectDialogUi();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self ); // self
+
+    return self;
+    }
+
+
+// ---------------------------------------------------------
+// CDisconnectDialogUi::~CDisconnectDialogUi
+// ---------------------------------------------------------
+//
+CDisconnectDialogUi::~CDisconnectDialogUi()
+    {
+    delete iActivePlugin; 
+    delete iConnModel;
+    delete iErrorMsgDetails;
+    if ( iResOffset )
+        {
+        CCoeEnv::Static()->DeleteResourceFile( iResOffset );
+        }
+    }
+
+
+// ---------------------------------------------------------
+// CDisconnectDialogUi::CDisconnectDialogUi
+// ---------------------------------------------------------
+//
+CDisconnectDialogUi::CDisconnectDialogUi()
+: iDialogRun( EFalse ), 
+  iQueryRun( EFalse ), 
+  iResOffset( 0 ),
+  iConnModel( NULL ), 
+  iIndex( 0 ), 
+  iStarted( EFalse ), 
+  iActivePlugin( NULL )
+    {
+    }
+
+
+// ---------------------------------------------------------
+// CDisconnectDialogUi::ConstructL
+// ---------------------------------------------------------
+//
+void CDisconnectDialogUi::ConstructL( )
+    {
+    // The resource has to be loaded manually since it is not an application.
+
+    TFileName resourceFileName;
+
+    resourceFileName.Append( KDriveZ );
+    resourceFileName.Append( KDC_RESOURCE_FILES_DIR );   
+    resourceFileName.Append( KDisconnectDlgUiRSCFile );
+
+    BaflUtils::NearestLanguageFile( CCoeEnv::Static()->FsSession(),
+                                    resourceFileName );
+    iResOffset = CCoeEnv::Static()->AddResourceFileL( resourceFileName );
+    }
+
+
+// ---------------------------------------------------------
+// CDisconnectDialogUi::Cvt
+// ---------------------------------------------------------
+//
+TInt CDisconnectDialogUi::Cvt()
+    {
+    return KErrNone;
+    }
+
+
+// ---------------------------------------------------------
+// CDisconnectDialogUi::InitializedL
+// ---------------------------------------------------------
+//
+void CDisconnectDialogUi::InitializedL( CConnectionInfo* aConnectionInfo )
+    {
+    CLOG_ENTERFN( "CDisconnectDialogUi::InitializedL" );
+    iQueryRun = EFalse;
+    delete iConnModel;
+    iConnModel = NULL;
+    iConnModel = CConnectionModel::NewL( this, aConnectionInfo );
+
+    // Now all the info are ready to show
+    // Let's show the dialog        
+    iDialogRun = ETrue;
+    iDisconnectDialog = CDisconnectDlgDialog::NewL( this, iConnModel, 
+                                                    &iIndex, iIapId );
+    iDisconnectDialog->RunDlgLD();
+    iDialogRun = EFalse;
+    
+    CLOG_LEAVEFN( "CDisconnectDialogUi::InitializedL" );    
+    }
+
+
+// ---------------------------------------------------------
+// void CDisconnectDialogUi::Release()
+// ---------------------------------------------------------
+//
+void CDisconnectDialogUi::Release()
+    {
+    delete this;
+    }
+
+
+// ---------------------------------------------------------
+// TNotifierInfo CDisconnectDialogUi::RegisterL()
+// ---------------------------------------------------------
+//
+CDisconnectDialogUi::TNotifierInfo CDisconnectDialogUi::RegisterL()
+    {
+    iInfo.iUid = KUidDisconnectDlg;
+    iInfo.iPriority = ENotifierPriorityHigh;
+    iInfo.iChannel = KUidDisconnectDlg;
+
+    return iInfo;
+    }
+
+
+// ---------------------------------------------------------
+// TNotifierInfo CDisconnectDialogUi::Info() const
+// ---------------------------------------------------------
+//
+CDisconnectDialogUi::TNotifierInfo CDisconnectDialogUi::Info() const
+    {
+    return iInfo;
+    }
+
+
+// ---------------------------------------------------------
+// TPtrC8 CDisconnectDialogUi::StartL( const TDesC8& /*aBuffer*/ )
+// ---------------------------------------------------------
+//
+TPtrC8 CDisconnectDialogUi::StartL( const TDesC8& /*aBuffer*/ )
+    {
+    return KNullDesC8().Ptr();
+    }
+
+
+// ---------------------------------------------------------
+// void CDisconnectDialogUi::StartL( const TDesC8& /*aBuffer*/, 
+//                                  const TAny* /*aReturnVal*/, 
+//                                  RMessage /*aMessage*/)
+// ---------------------------------------------------------
+//
+
+void CDisconnectDialogUi::StartL( const TDesC8& aBuffer, 
+                                  TInt aReplySlot,
+                                  const RMessagePtr2& aMessage )
+    { 
+    CLOG_ENTERFN("CDisconnectDialogUi::StartL");        
+      
+    iStarted = ETrue;
+
+    TPckgBuf<TDisconnectConnectionPrefs> passedInfo;
+    passedInfo.Copy( aBuffer );
+    iConnectionPrefs = passedInfo();
+    
+    iReplySlot = aReplySlot;    
+    iMessage = aMessage;
+    
+    CLOG_WRITEF(_L( "iCntPrefs.iPrompt: %d" ), iConnectionPrefs.iPrompt );
+    
+    TInt err( KErrNone );    
+    TRAP( err, iActivePlugin = CActiveDisconnectDlgPlugin::NewL( this ) ); 
+    
+    if ( err )
+        {
+        delete iActivePlugin;
+        iActivePlugin = NULL;
+        User::Leave( err );           
+        }
+        
+    iActivePlugin->StartSearchConnections(); 
+     
+    CLOG_LEAVEFN("CDisconnectDialogUi::StartL");        
+    }
+
+
+// ---------------------------------------------------------
+// void CDisconnectDialogUi::AskDisconnectL
+// ---------------------------------------------------------
+//
+
+TInt CDisconnectDialogUi::AskDisconnectL()
+    {
+    CLOG_ENTERFN( "CDisconnectDialogUi::AskDisconnectL" );        
+    
+    const TInt KErrorCode = -6000;
+    TInt proceed( KErrNone );
+    TInt textId;
+    TUint textFlags;
+
+    delete iErrorMsgDetails;
+    iErrorMsgDetails = NULL;
+
+    CTextResolver* resolver = CTextResolver::NewLC();
+    const TDesC& error = resolver->ResolveErrorString( KErrorCode, 
+                                        textId, textFlags, 
+                                        CTextResolver::ECtxNoCtxNoSeparator );
+
+    if ( !( textFlags & EErrorResBlankErrorFlag ||
+            textFlags & ETextResolverUnknownErrorFlag ) )
+        {
+        iErrorMsgDetails = error.AllocL();
+
+        CleanupStack::PopAndDestroy( resolver );
+            
+        iQueryDisconnectDlgDialog = new ( ELeave ) CQueryDisconnectDlgDialog( 
+                                                                        this );
+        iQueryDisconnectDlgDialog->SetPromptL( *iErrorMsgDetails );
+        iQueryRun = ETrue;
+        proceed = iQueryDisconnectDlgDialog->ExecuteLD( 
+                                                    R_DISCONNECTDLG_PROCEED );
+        iQueryRun = EFalse;
+        }
+    else
+        {
+        CleanupStack::PopAndDestroy( resolver );
+        }
+
+    CLOG_LEAVEFN( "CDisconnectDialogUi::AskDisconnectL" );        
+
+    return proceed;
+    }
+
+
+// ---------------------------------------------------------
+// void CDisconnectDialogUi::Cancel()
+// ---------------------------------------------------------
+//
+void CDisconnectDialogUi::Cancel()
+    {
+    CLOG_ENTERFN("CDisconnectDialogUi::Cancel");        
+    
+    delete iActivePlugin;
+    iActivePlugin = NULL;
+    
+    if ( iStarted )
+        {           
+        iStarted = EFalse;
+        if ( !iMessage.IsNull() )
+            {
+            iMessage.Complete( KErrCancel );
+            }
+        }
+       
+    if ( iQueryRun )
+        {
+        delete iQueryDisconnectDlgDialog;
+        }
+
+    if ( iDialogRun )
+        {
+        delete iDisconnectDialog;
+        }
+        
+    iQueryDisconnectDlgDialog = NULL;
+    iDisconnectDialog = NULL;
+
+    delete iErrorMsgDetails;
+    iErrorMsgDetails = NULL;
+                
+    CLOG_LEAVEFN("CDisconnectDialogUi::Cancel");                
+    }
+
+
+// ---------------------------------------------------------
+// void CDisconnectDialogUi::CompleteL( TInt aStatus )
+// ---------------------------------------------------------
+//
+void CDisconnectDialogUi::CompleteL( TInt aStatus )
+    {
+    CLOG_ENTERFN("CDisconnectDialogUi::CompleteL"); 
+   
+    if ( !iMessage.IsNull() )
+        {
+        if ( aStatus == KErrNone )
+            {
+            iMessage.WriteL( iReplySlot, TPckg<TUint32>( iIapId ) );
+            CLOG_WRITEF( _L( "iIapId : %d" ), iIapId );        
+            }
+      
+        iMessage.Complete( aStatus );
+        }
+    
+    iStarted = EFalse;
+    Cancel();                
+    
+    CLOG_LEAVEFN("CDisconnectDialogUi::CompleteL");        
+    }
+
+
+// ---------------------------------------------------------
+// TPtrC8 CConnDlgPluginBase::UpdateL(const TDesC8& /*aBuffer*/)
+// ---------------------------------------------------------
+//
+TPtrC8 CDisconnectDialogUi::UpdateL(const TDesC8& /*aBuffer*/)
+    {
+    return KNullDesC8().Ptr();
+    }
+    
+    
+// ---------------------------------------------------------
+// void CDisconnectDialogUi::SetClosedIapId
+// ---------------------------------------------------------
+//
+void CDisconnectDialogUi::SetClosedIapId( TUint32 aIapId )
+    {
+    CLOG_ENTERFN("CDisconnectDialogUi::SetClosedIapId");     
+    
+    iIapId = aIapId;
+
+    CLOG_WRITEF( _L( "iIapId : %d" ), iIapId );
+    CLOG_LEAVEFN("CDisconnectDialogUi::SetClosedIapId");            
+    }
+    
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/DisconnectDlg/src/QueryDisconnectDlgDialog.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,124 @@
+/*
+* Copyright (c) 2004 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 the QueryDisconnectDlgDialog.
+*
+*/
+
+
+// INCLUDE FILES
+#include "QueryDisconnectDlgDialog.h"
+#include "DisconnectDlgUi.h"
+#include "ConnectionDialogsLogger.h"
+#include "ExpiryTimer.h"
+
+#include <aknnotedialog.h>
+#include <uikon/eiksrvui.h>
+
+// CONSTANTS
+
+// ================= MEMBER FUNCTIONS =======================
+
+
+// ---------------------------------------------------------
+// CQueryDisconnectDlgDialog::CQueryDisconnectDlgDialog
+// ---------------------------------------------------------
+//
+CQueryDisconnectDlgDialog::CQueryDisconnectDlgDialog( 
+                                    CDisconnectDialogUi* aDisconnectDialogUi )
+: CAknQueryDialog( ENoTone )
+    {
+    CLOG_ENTERFN("CQueryDisconnectDlgDialog::CQueryDisconnectDlgDialog");
+    iDisconnectDialogUi = aDisconnectDialogUi;
+    CLOG_LEAVEFN("CQueryDisconnectDlgDialog::CQueryDisconnectDlgDialog");
+    }
+    
+    
+// ---------------------------------------------------------
+// CQueryDisconnectDlgDialog::~CQueryDisconnectDlgDialog
+// ---------------------------------------------------------
+//
+CQueryDisconnectDlgDialog::~CQueryDisconnectDlgDialog()
+    {
+    CLOG_ENTERFN("CQueryDisconnectDlgDialog::~CQueryDisconnectDlgDialog");
+    
+    STATIC_CAST( CEikServAppUi*, 
+                CCoeEnv::Static()->AppUi() )->SuppressAppSwitching( EFalse );
+    
+    delete iExpiryTimer;
+
+    CLOG_LEAVEFN("CQueryDisconnectDlgDialog::~CQueryDisconnectDlgDialog");
+    }
+
+
+// ---------------------------------------------------------
+// CQueryDisconnectDlgDialog::PreLayoutDynInitL()
+// called by framework before dialog is shown
+// ---------------------------------------------------------
+//
+void CQueryDisconnectDlgDialog::PreLayoutDynInitL()
+    {
+    CLOG_ENTERFN( "CQueryDisconnectDlgDialog::PreLayoutDynInitL " );  
+    
+    CAknQueryDialog::PreLayoutDynInitL();
+
+    STATIC_CAST( CEikServAppUi*, 
+                CCoeEnv::Static()->AppUi() )->SuppressAppSwitching( ETrue );  
+    
+    iExpiryTimer = CExpiryTimer::NewL( *this );
+    iExpiryTimer->Start();
+    
+    CLOG_LEAVEFN( "CQueryDisconnectDlgDialog::PreLayoutDynInitL " );      
+    }   
+
+
+// ---------------------------------------------------------
+// CQueryDisconnectDlgDialog::OkToExitL
+// ---------------------------------------------------------
+//
+TBool CQueryDisconnectDlgDialog::OkToExitL( TInt aButtonId )
+    {
+    CLOG_ENTERFN("CQueryDisconnectDlgDialog::OkToExitL");        
+    
+    TBool retVal( ETrue );
+
+    CLOG_WRITEF( _L( "aButtonId: %d" ), aButtonId );     
+
+    if ( aButtonId == EAknSoftkeySelect || aButtonId == EAknSoftkeyOk ||
+         aButtonId == EAknSoftkeyDone )
+        {
+        iDisconnectDialogUi->iQueryRun = EFalse;        
+        }
+    else if ( aButtonId == EAknSoftkeyCancel )
+        {
+        iDisconnectDialogUi->iQueryRun = EFalse;
+        iDisconnectDialogUi->CompleteL( KErrCancel );
+        }
+    else
+        {
+        retVal = EFalse;
+        }
+        
+    CLOG_WRITEF( _L( "v: %d" ), retVal );             
+    CLOG_LEAVEFN("CQueryDisconnectDlgDialog::OkToExitL");    
+
+    return retVal;    
+    }
+
+void CQueryDisconnectDlgDialog::HandleTimedOut()
+    {
+    TRAP_IGNORE( TryExitL(EAknSoftkeyCancel) );
+    }
+    
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/DisconnectDlg/src/connectioninfosortkey.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,77 @@
+/*
+* Copyright (c) 2004 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: 
+*      Declares the TConnectionInfoSortKey
+*
+*/
+
+
+#include "connectioninfosortkey.h"
+
+
+// ---------------------------------------------------------
+// TConnectionInfoSortKey::TConnectionInfoSortKey
+// ---------------------------------------------------------
+//
+TConnectionInfoSortKey::TConnectionInfoSortKey() : 
+    TKeyArrayFix( 0, ECmpCollated )
+    {
+    }
+
+    
+// ---------------------------------------------------------
+// TConnectionInfoSortKey::SetPtr( CArrayPtrFlat<CConnectionInfo>* aPtr )
+// ---------------------------------------------------------
+//
+void TConnectionInfoSortKey::SetPtr( CArrayPtrFlat<CConnectionInfo>* aPtr )
+    {
+    iPtr = aPtr;
+    }
+
+
+// ---------------------------------------------------------
+// TConnectionInfoSortKey::Compare( TInt aLeft, TInt aRight ) const
+// ---------------------------------------------------------
+//
+TInt TConnectionInfoSortKey::Compare( TInt aLeft, TInt aRight ) const
+    {
+    TInt retval;
+    TTime left = iPtr->At( aLeft )->GetStartTime();
+    TTime right = iPtr->At( aRight )->GetStartTime();
+
+    if( left < right )
+        {
+        retval = -1;
+        }
+    else if( left > right )
+        {
+        retval = 1;
+        }
+    else 
+        {
+        retval = 0;
+        } 
+    
+    return retval;
+    }
+
+
+// ---------------------------------------------------------
+// TConnectionInfoSortKey::At( TInt anIndex ) const
+// ---------------------------------------------------------
+//
+TAny* TConnectionInfoSortKey::At( TInt anIndex ) const
+    {
+    return iPtr->At( anIndex );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/cconndlg/BWinsCw/AgentDialogU.def	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,34 @@
+EXPORTS
+	??0RGenConAgentDialogServer@@QAE@XZ @ 1 NONAME ; RGenConAgentDialogServer::RGenConAgentDialogServer(void)
+	??1RGenConAgentDialogServer@@QAE@XZ @ 2 NONAME ; RGenConAgentDialogServer::~RGenConAgentDialogServer(void)
+	?Authenticate@RGenConAgentDialogServer@@QAEXAAVTDes16@@0HAAVTRequestStatus@@@Z @ 3 NONAME ; void RGenConAgentDialogServer::Authenticate(class TDes16 &, class TDes16 &, int, class TRequestStatus &)
+	?CancelAuthenticate@RGenConAgentDialogServer@@QAEXXZ @ 4 NONAME ; void RGenConAgentDialogServer::CancelAuthenticate(void)
+	?CancelDestroyPctNotification@RGenConAgentDialogServer@@QAEXXZ @ 5 NONAME ; void RGenConAgentDialogServer::CancelDestroyPctNotification(void)
+	?CancelIapConnection@RGenConAgentDialogServer@@QAEXXZ @ 6 NONAME ; void RGenConAgentDialogServer::CancelIapConnection(void)
+	?CancelLogin@RGenConAgentDialogServer@@QAEXXZ @ 7 NONAME ; void RGenConAgentDialogServer::CancelLogin(void)
+	?CancelModemAndLocationSelection@RGenConAgentDialogServer@@QAEXXZ @ 8 NONAME ; void RGenConAgentDialogServer::CancelModemAndLocationSelection(void)
+	?CancelQoSWarning@RGenConAgentDialogServer@@QAEXXZ @ 9 NONAME ; void RGenConAgentDialogServer::CancelQoSWarning(void)
+	?CancelReadPct@RGenConAgentDialogServer@@QAEXXZ @ 10 NONAME ; void RGenConAgentDialogServer::CancelReadPct(void)
+	?CancelReconnect@RGenConAgentDialogServer@@QAEXXZ @ 11 NONAME ; void RGenConAgentDialogServer::CancelReconnect(void)
+	?CancelWarnNewIapConnection@RGenConAgentDialogServer@@QAEXXZ @ 12 NONAME ; void RGenConAgentDialogServer::CancelWarnNewIapConnection(void)
+	?Close@RGenConAgentDialogServer@@QAEXXZ @ 13 NONAME ; void RGenConAgentDialogServer::Close(void)
+	?ClosePct@RGenConAgentDialogServer@@QAEXXZ @ 14 NONAME ; void RGenConAgentDialogServer::ClosePct(void)
+	?Connect@RGenConAgentDialogServer@@QAEHXZ @ 15 NONAME ; int RGenConAgentDialogServer::Connect(void)
+	?DestroyPctNotification@RGenConAgentDialogServer@@QAEXAAVTRequestStatus@@@Z @ 16 NONAME ; void RGenConAgentDialogServer::DestroyPctNotification(class TRequestStatus &)
+	?IapConnection@RGenConAgentDialogServer@@QAEXAAKABVTConnectionPrefs@@AAVTRequestStatus@@@Z @ 17 NONAME ; void RGenConAgentDialogServer::IapConnection(unsigned long &, class TConnectionPrefs const &, class TRequestStatus &)
+	?IapConnection@RGenConAgentDialogServer@@QAEXAAKABVTConnectionPrefs@@HAAVTRequestStatus@@@Z @ 18 NONAME ; void RGenConAgentDialogServer::IapConnection(unsigned long &, class TConnectionPrefs const &, int, class TRequestStatus &)
+	?Login@RGenConAgentDialogServer@@QAEXAAVTDes16@@0HAAVTRequestStatus@@@Z @ 19 NONAME ; void RGenConAgentDialogServer::Login(class TDes16 &, class TDes16 &, int, class TRequestStatus &)
+	?ModemAndLocationSelection@RGenConAgentDialogServer@@QAEXAAK0AAVTRequestStatus@@@Z @ 20 NONAME ; void RGenConAgentDialogServer::ModemAndLocationSelection(unsigned long &, unsigned long &, class TRequestStatus &)
+	?OpenPct@RGenConAgentDialogServer@@QAEHXZ @ 21 NONAME ; int RGenConAgentDialogServer::OpenPct(void)
+	?QoSWarning@RGenConAgentDialogServer@@QAEXAAHAAVTRequestStatus@@@Z @ 22 NONAME ; void RGenConAgentDialogServer::QoSWarning(int &, class TRequestStatus &)
+	?ReadPct@RGenConAgentDialogServer@@QAEXAAVTDes16@@AAVTRequestStatus@@@Z @ 23 NONAME ; void RGenConAgentDialogServer::ReadPct(class TDes16 &, class TRequestStatus &)
+	?Reconnect@RGenConAgentDialogServer@@QAEXAAHAAVTRequestStatus@@@Z @ 24 NONAME ; void RGenConAgentDialogServer::Reconnect(int &, class TRequestStatus &)
+	?StartDialogThread@@YAHXZ @ 25 NONAME ; int StartDialogThread(void)
+	?Version@RGenConAgentDialogServer@@QBE?AVTVersion@@XZ @ 26 NONAME ; class TVersion RGenConAgentDialogServer::Version(void) const
+	?WarnNewIapConnection@RGenConAgentDialogServer@@QAEXABVTConnectionPrefs@@HABVTDesC16@@AAHAAVTRequestStatus@@@Z @ 27 NONAME ; void RGenConAgentDialogServer::WarnNewIapConnection(class TConnectionPrefs const &, int, class TDesC16 const &, int &, class TRequestStatus &)
+	?WritePct@RGenConAgentDialogServer@@QAEHABVTDesC16@@@Z @ 28 NONAME ; int RGenConAgentDialogServer::WritePct(class TDesC16 const &)
+	?ThreadFunction@@YAHPAX@Z @ 29 NONAME ; int ThreadFunction(void *)
+	?AccessPointConnection@RGenConAgentDialogServer@@QAEXAAKHAAVTRequestStatus@@@Z @ 30 NONAME ; void RGenConAgentDialogServer::AccessPointConnection(unsigned long &, int, class TRequestStatus &)
+	?CancelAccessPointConnection@RGenConAgentDialogServer@@QAEXXZ @ 31 NONAME ; void RGenConAgentDialogServer::CancelAccessPointConnection(void)
+	?AccessPointConnection@RGenConAgentDialogServer@@QAEXAAKK0KAAVTRequestStatus@@@Z @ 32 NONAME ; void RGenConAgentDialogServer::AccessPointConnection(unsigned long &, unsigned long, unsigned long &, unsigned long, class TRequestStatus &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/cconndlg/BWinsCw/CConnDlgPluginU.DEF	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+	?NotifierArray@@YAPAV?$CArrayPtr@VMEikSrvNotifierBase2@@@@XZ @ 1 NONAME ; class CArrayPtr<class MEikSrvNotifierBase2> * NotifierArray(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/cconndlg/EABI/CCONNDLGPLUGINU.DEF	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z13NotifierArrayv @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/cconndlg/EABI/agentdialogu.def	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,36 @@
+EXPORTS
+	_ZN24RGenConAgentDialogServerC1Ev @ 1 NONAME ; RGenConAgentDialogServer::RGenConAgentDialogServer(void)
+	_ZN24RGenConAgentDialogServer18CancelAuthenticateEv @ 2 NONAME ; RGenConAgentDialogServer::CancelAuthenticate(void)
+	_ZN24RGenConAgentDialogServer28CancelDestroyPctNotificationEv @ 3 NONAME ; RGenConAgentDialogServer::CancelDestroyPctNotification(void)
+	_ZN24RGenConAgentDialogServer19CancelIapConnectionEv @ 4 NONAME ; RGenConAgentDialogServer::CancelIapConnection(void)
+	_ZN24RGenConAgentDialogServer11CancelLoginEv @ 5 NONAME ; RGenConAgentDialogServer::CancelLogin(void)
+	_ZN24RGenConAgentDialogServer31CancelModemAndLocationSelectionEv @ 6 NONAME ; RGenConAgentDialogServer::CancelModemAndLocationSelection(void)
+	_ZN24RGenConAgentDialogServer16CancelQoSWarningEv @ 7 NONAME ; RGenConAgentDialogServer::CancelQoSWarning(void)
+	_ZN24RGenConAgentDialogServer13CancelReadPctEv @ 8 NONAME ; RGenConAgentDialogServer::CancelReadPct(void)
+	_ZN24RGenConAgentDialogServer15CancelReconnectEv @ 9 NONAME ; RGenConAgentDialogServer::CancelReconnect(void)
+	_ZN24RGenConAgentDialogServer26CancelWarnNewIapConnectionEv @ 10 NONAME ; RGenConAgentDialogServer::CancelWarnNewIapConnection(void)
+	_ZN24RGenConAgentDialogServer8ClosePctEv @ 11 NONAME ; RGenConAgentDialogServer::ClosePct(void)
+	_ZN24RGenConAgentDialogServer5CloseEv @ 12 NONAME ; RGenConAgentDialogServer::Close(void)
+	_ZN24RGenConAgentDialogServer7ConnectEv @ 13 NONAME ; RGenConAgentDialogServer::Connect(void)
+	_ZN24RGenConAgentDialogServer22DestroyPctNotificationER14TRequestStatus @ 14 NONAME ; RGenConAgentDialogServer::DestroyPctNotification(TRequestStatus&)
+	_ZN24RGenConAgentDialogServer13IapConnectionERmRK16TConnectionPrefsR14TRequestStatus @ 15 NONAME ; RGenConAgentDialogServer::IapConnection(unsigned long&, TConnectionPrefs const&, TRequestStatus&)
+	_ZN24RGenConAgentDialogServer13IapConnectionERmRK16TConnectionPrefsiR14TRequestStatus @ 16 NONAME ; RGenConAgentDialogServer::IapConnection(unsigned long&, TConnectionPrefs const&, int, TRequestStatus&)
+	_ZN24RGenConAgentDialogServer5LoginER6TDes16S1_iR14TRequestStatus @ 17 NONAME ; RGenConAgentDialogServer::Login(TDes16&, TDes16&, int, TRequestStatus&)
+	_ZN24RGenConAgentDialogServer25ModemAndLocationSelectionERmS0_R14TRequestStatus @ 18 NONAME ; RGenConAgentDialogServer::ModemAndLocationSelection(unsigned long&, unsigned long&, TRequestStatus&)
+	_ZN24RGenConAgentDialogServer7OpenPctEv @ 19 NONAME ; RGenConAgentDialogServer::OpenPct(void)
+	_ZN24RGenConAgentDialogServer10QoSWarningERiR14TRequestStatus @ 20 NONAME ; RGenConAgentDialogServer::QoSWarning(int&, TRequestStatus&)
+	_ZN24RGenConAgentDialogServer7ReadPctER6TDes16R14TRequestStatus @ 21 NONAME ; RGenConAgentDialogServer::ReadPct(TDes16&, TRequestStatus&)
+	_ZN24RGenConAgentDialogServer9ReconnectERiR14TRequestStatus @ 22 NONAME ; RGenConAgentDialogServer::Reconnect(int&, TRequestStatus&)
+	_Z17StartDialogThreadv @ 23 NONAME ; StartDialogThread(void)
+	_ZNK24RGenConAgentDialogServer7VersionEv @ 24 NONAME ; RGenConAgentDialogServer::Version(void) const
+	_ZN24RGenConAgentDialogServer20WarnNewIapConnectionERK16TConnectionPrefsiRK7TDesC16RiR14TRequestStatus @ 25 NONAME ; RGenConAgentDialogServer::WarnNewIapConnection(TConnectionPrefs const&, int, TDesC16 const&, int&, TRequestStatus&)
+	_ZN24RGenConAgentDialogServer8WritePctERK7TDesC16 @ 26 NONAME ; RGenConAgentDialogServer::WritePct(TDesC16 const&)
+	_ZN24RGenConAgentDialogServerD1Ev @ 27 NONAME ; RGenConAgentDialogServer::~RGenConAgentDialogServer(void)
+	_ZN24RGenConAgentDialogServer12AuthenticateER6TDes16S1_iR14TRequestStatus @ 28 NONAME ; RGenConAgentDialogServer::Authenticate(TDes16&, TDes16&, int, TRequestStatus&)
+	_Z14ThreadFunctionPv @ 29 NONAME
+	_ZN24RGenConAgentDialogServerC2Ev @ 30 NONAME ; RGenConAgentDialogServer::RGenConAgentDialogServer[not-in-charge](void)	
+	_ZN24RGenConAgentDialogServerD2Ev @ 31 NONAME ; RGenConAgentDialogServer::~RGenConAgentDialogServer [not-in-charge](void)
+	_ZN24RGenConAgentDialogServer21AccessPointConnectionERmiR14TRequestStatus @ 32 NONAME
+	_ZN24RGenConAgentDialogServer27CancelAccessPointConnectionEv @ 33 NONAME
+	_ZN24RGenConAgentDialogServer21AccessPointConnectionERmmS0_mR14TRequestStatus @ 34 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/cconndlg/clientinc/ActiveLogin.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,119 @@
+/*
+* 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:  
+*
+*/
+
+
+
+#ifndef __ACTIVELOGIN_H__
+#define __ACTIVELOGIN_H__
+
+// INCLUDES
+#include "ConnDlgPlugin.h"
+#include <e32base.h>
+
+
+// CLASS DECLARATION
+
+/**
+* ActiveObject for asynchronous operations
+*/
+NONSHARABLE_CLASS( CActiveLogin ) : public CActive
+    {
+    private:
+        /**
+        * C++ default constructor.
+        * @param aUsername The address where the caller of the Authenticate
+        *                  dialog needs to save the username data inserted by 
+        *                  the user.
+        * @param aPassword The address where the caller of the Authenticate
+        *                  dialog needs to save the password data inserted by 
+        *                  the user.
+        */
+        CActiveLogin( TDes& aUsername, TDes& aPassword );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+
+    public:  // Constructors and destructor
+        /**
+        * Two-phased constructor.
+        * @param aUsername The address where the caller of the Authenticate
+        *                  dialog needs to save the username data inserted by 
+        *                  the user.
+        * @param aPassword The address where the caller of the Authenticate
+        *                  dialog needs to save the password data inserted by 
+        *                  the user.
+        */
+        static CActiveLogin* NewL( TDes& aUsername, TDes& aPassword );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CActiveLogin();
+
+
+    public: // From base class
+        /**
+        * This function is called when the scheduled function ends.
+        */
+        void RunL();
+
+        /**
+        * Cancel operations.
+        */
+        void DoCancel();
+
+
+    public: // New functions
+        /**
+        * Add this class on the ActiveScheduler and puts itself active.
+        * @param aStatus The status that is checked by the caller of the 
+        *                Authenticate dialog.
+        */
+        void Observe( TRequestStatus &aStatus );
+
+        /**
+        * Returns the TAuthenticationPairBuff 
+        * @return A pointer to iAuthenticationPairBuff.
+        */
+        TPckgBuf<TAuthenticationPairBuff>* GetBuffer();
+
+
+    private:    // Data
+        // The status that is checked by the caller of the Authentication 
+        // dialog. Not owned.
+        TRequestStatus* iRs;    
+
+        // The address of the area where the caller of the Authentication 
+        // dialog expects the value for username. Not owned.
+        TDes* iUsername;
+
+        // The address of the area where the caller of the Authentication 
+        // dialog expects the value for password. Not owned.
+        TDes* iPassword;
+
+        // Packed buffer containing user name and password used as input and 
+        // output for Authentication dialog.
+        TPckgBuf<TAuthenticationPairBuff> iAuthenticationPairBuff;
+    };
+
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/cconndlg/clientinc/GenConAgentDialogServer.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2002 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 GenConAgentDialogServer
+*
+*/
+
+
+// Generic Connection Dialog Client
+
+#ifndef __GENCONAGENTDIALOGSERVER_H__
+#define __GENCONAGENTDIALOGSERVER_H__
+
+
+// INCLUDES
+#include <e32std.h>
+
+
+// ENUMERATIONS
+
+// Reasons for panic
+enum TConnDlgClientPanic
+    {
+    EConnDlgNotifierNotInitialised,             // Notifier was not initialised
+    };
+
+
+// CONSTANTS
+
+// Version of this API
+const TUint KConnDlgMajorVersionNumber = 1;     // Major version number
+const TUint KConnDlgMinorVersionNumber = 0;     // Minor version number
+const TUint KConnDlgBuildVersionNumber = 102;   // Build version number
+
+
+IMPORT_C TInt ThreadFunction(TAny* aStarted);
+
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/cconndlg/clientsrc/ActiveLogin.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,128 @@
+/*
+* 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:  Implementation of CActiveLogin class
+*
+*/
+
+
+// INCLUDE FILES
+#include "ActiveLogin.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+//
+// ----------------------------------------------------------------------------
+// CActiveLogin::CActiveLogin
+// ----------------------------------------------------------------------------
+//
+CActiveLogin::CActiveLogin( TDes& aUsername, TDes& aPassword )
+: CActive( CActive::EPriorityUserInput ),
+  iUsername( &aUsername ),
+  iPassword( &aPassword )
+    {
+    iAuthenticationPairBuff().iUsername = aUsername;
+    iAuthenticationPairBuff().iPassword = aPassword;
+    }
+
+
+// ----------------------------------------------------------------------------
+// CActiveLogin::NewL
+// ----------------------------------------------------------------------------
+//
+CActiveLogin* CActiveLogin::NewL( TDes& aUsername, TDes& aPassword )
+    {
+    CActiveLogin* self = new( ELeave )CActiveLogin( aUsername, aPassword );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+
+// ----------------------------------------------------------------------------
+// CActiveLogin::ConstructL
+// ----------------------------------------------------------------------------
+//
+void CActiveLogin::ConstructL()
+    {
+    }
+
+
+// ----------------------------------------------------
+// CActiveLogin::~CActiveLogin()
+// ----------------------------------------------------
+//
+CActiveLogin::~CActiveLogin()
+    {
+    Cancel();
+    }
+
+
+// ----------------------------------------------------------------------------
+// CActiveLogin::RunL
+// ----------------------------------------------------------------------------
+//
+void CActiveLogin::RunL()
+    {
+    if ( iStatus.Int() == KErrNone )
+        {
+        *iUsername = iAuthenticationPairBuff().iUsername;
+        *iPassword = iAuthenticationPairBuff().iPassword;
+        }
+
+    TRequestStatus* pS = iRs;
+    User::RequestComplete( pS, iStatus.Int() );
+
+    delete this;
+    }
+
+
+// ----------------------------------------------------------------------------
+// CActiveLogin::DoCancel
+// ----------------------------------------------------------------------------
+//
+void CActiveLogin::DoCancel()
+    {
+    TRequestStatus* pS = iRs;
+    User::RequestComplete( pS, KErrCancel );
+    }
+
+
+// ----------------------------------------------------------------------------
+// CActiveLogin::Observe
+// ----------------------------------------------------------------------------
+//
+void CActiveLogin::Observe( TRequestStatus &aStatus )
+    {
+    CActiveScheduler::Add( this );
+
+    iRs = &aStatus;
+    *iRs = KRequestPending;
+
+    SetActive();
+    }
+
+
+// ----------------------------------------------------------------------------
+// CActiveLogin::GetBuffer
+// ----------------------------------------------------------------------------
+//
+TPckgBuf<TAuthenticationPairBuff>* CActiveLogin::GetBuffer() 
+    { 
+    return &iAuthenticationPairBuff; 
+    }
+
+
+// End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/cconndlg/clientsrc/GenConAgentDialogServer.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,583 @@
+/*
+* Copyright (c) 2002 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 Generic Connection Dialog Client
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "GenConAgentDialogServer.h"
+#include "ConnectionDialogsUidDefs.h"
+#include "ActiveLogin.h"
+#include "ConnectionDialogsLogger.h"
+
+#include <agentdialog.h>
+
+
+// ---------------------------------------------------------
+// ThreadFunction
+//
+// Required by Symbian's def file, stub
+// ---------------------------------------------------------
+//
+EXPORT_C TInt ThreadFunction(TAny* /*aArg*/)
+    {
+    return 0;
+    }
+
+
+// ---------------------------------------------------------
+// StartDialogThread
+//
+// Attempt to start a thread for the socket server in the C32 process.
+// ---------------------------------------------------------
+//
+EXPORT_C TInt StartDialogThread()
+    {
+    return KErrNone;
+    }
+
+
+// ---------------------------------------------------------
+// RGenConAgentDialogServer
+// ---------------------------------------------------------
+//
+EXPORT_C RGenConAgentDialogServer::RGenConAgentDialogServer()
+: RSessionBase(),
+  iNotifier( NULL ),
+  iIAP( 0 ),
+  iModemId( 0 ),
+  iLocationId( 0 ),
+  iConNames( TIspConnectionNames() ),
+  iPrefs( TConnectionPrefs() ),
+  iBool( EFalse ),
+  iPctBuffer( 0 ),
+  iPctResponse( TPctResponse() ),
+  iAuthenticationPair( TAuthenticationPair() ),
+  iNewIapPrefsBuffer( TNewIapConnectionPrefs() ),
+  iNotUsed( 0 ),
+  iAccessPoint( 0 )
+    {
+    }
+
+
+// ---------------------------------------------------------
+// ~RGenConAgentDialogServer
+// ---------------------------------------------------------
+//
+EXPORT_C RGenConAgentDialogServer::~RGenConAgentDialogServer()
+    {
+    delete iNotifier;
+    }
+
+
+// ---------------------------------------------------------
+// Connect
+//
+// Create a session to the extended notifier framework
+// ---------------------------------------------------------
+//
+EXPORT_C TInt RGenConAgentDialogServer::Connect()
+    {
+    TInt error( KErrNone );
+    if ( !iNotifier )
+        {
+        TRAP( error, iNotifier = new RDialogNotifier() );
+        }
+    if ( !error && iNotifier )
+        {
+        error = iNotifier->Connect();
+        } 
+    return error;
+    }
+
+
+// ---------------------------------------------------------
+// Close
+// ---------------------------------------------------------
+//
+EXPORT_C void RGenConAgentDialogServer::Close()
+    {
+    if ( iNotifier )
+        {
+        iNotifier->Close();
+        }
+    }
+
+
+// ---------------------------------------------------------
+// Version
+// ---------------------------------------------------------
+//
+EXPORT_C TVersion RGenConAgentDialogServer::Version( void ) const
+    {
+    return( TVersion( KConnDlgMajorVersionNumber, KConnDlgMinorVersionNumber,
+                      KConnDlgBuildVersionNumber ) );
+    }
+
+
+// ---------------------------------------------------------
+// IapConnection
+// ---------------------------------------------------------
+//
+EXPORT_C void RGenConAgentDialogServer::IapConnection( TUint32& aIAP, 
+                    const TConnectionPrefs& aPrefs, TRequestStatus& aStatus)
+    {
+    CLOG_ENTERFN( "RGenConAgentDialogServer::IapConnection 1" );
+
+    IapConnection( aIAP, aPrefs, KErrNone, aStatus );
+
+    CLOG_LEAVEFN( "RGenConAgentDialogServer::IapConnection 1" );
+    }
+
+
+// ---------------------------------------------------------
+// IapConnection
+// ---------------------------------------------------------
+//
+EXPORT_C void RGenConAgentDialogServer::IapConnection( TUint32& aIAP, 
+                    const TConnectionPrefs& aPrefs, TInt /*aLastError*/, 
+                    TRequestStatus& aStatus)
+    {
+    CLOG_ENTERFN( "RGenConAgentDialogServer::IapConnection 2" );
+
+    ::new( &iIAP ) TPckg<TUint32>( aIAP );
+    iPrefs() = aPrefs;
+
+    if ( iNotifier )
+        {
+        iNotifier->StartNotifierAndGetResponse( aStatus, KUidCConnDlgIap,
+                                                iPrefs, iIAP );
+        }
+
+    CLOG_LEAVEFN( "RGenConAgentDialogServer::IapConnection 2" );
+    }
+
+
+// ---------------------------------------------------------
+// WarnNewIapConnection
+// ---------------------------------------------------------
+//
+EXPORT_C void RGenConAgentDialogServer::WarnNewIapConnection(
+                                    const TConnectionPrefs& aPrefs,
+                                    TInt aLastError, const TDesC& aNewIapName, 
+                                    TBool& aResponse, TRequestStatus& aStatus)
+    {
+    CLOG_ENTERFN( "RGenConAgentDialogServer::WarnNewIapConnection" );
+
+    ::new( &iBool ) TPckg<TBool>( aResponse );
+    ::new( &iNewIapPrefsBuffer ) TPckgBuf<TNewIapConnectionPrefs>( 
+                                                    TNewIapConnectionPrefs() );
+
+    iNewIapPrefsBuffer().iPrefs = aPrefs;
+    iNewIapPrefsBuffer().iLastError = aLastError;
+    iNewIapPrefsBuffer().iName = aNewIapName;
+
+    if ( iNotifier )
+        {
+        iNotifier->StartNotifierAndGetResponse( aStatus, KUidCConnDlgNewIap,
+                                                iNewIapPrefsBuffer, iBool );
+        }
+
+    CLOG_LEAVEFN( "RGenConAgentDialogServer::WarnNewIapConnection" );
+    }
+
+
+// ---------------------------------------------------------
+// Login
+// ---------------------------------------------------------
+//
+EXPORT_C void RGenConAgentDialogServer::Login( TDes& aUsername, 
+                                               TDes& aPassword, 
+                                               TBool aIsReconnect, 
+                                               TRequestStatus& aStatus )
+    {
+    CLOG_ENTERFN( "RGenConAgentDialogServer::Login" );
+
+    Authenticate( aUsername, aPassword, aIsReconnect, aStatus );
+
+    CLOG_LEAVEFN( "RGenConAgentDialogServer::Login" );
+    }
+
+
+// ---------------------------------------------------------
+// Authenticate
+// ---------------------------------------------------------
+//
+EXPORT_C void RGenConAgentDialogServer::Authenticate( TDes& aUsername,
+                                                      TDes& aPassword, 
+                                                      TBool /*aIsReconnect*/, 
+                                                      TRequestStatus& aStatus )
+    {
+    CLOG_ENTERFN( "RGenConAgentDialogServer::Authenticate" );
+
+    CActiveLogin* activeLogin = NULL;
+
+    TRAPD( err, activeLogin = CActiveLogin::NewL( aUsername, aPassword ) );
+
+    iNotUsed() = ( TUint32 )activeLogin;
+    
+    if ( err != KErrNone )
+        {
+        TRequestStatus* pS = &aStatus;
+        User::RequestComplete( pS, err );
+        }
+    else
+        {
+        activeLogin->Observe( aStatus );
+
+        TPckgBuf<TAuthenticationPairBuff>* authenticationPairBuff = 
+                                                    activeLogin->GetBuffer();
+
+        if ( iNotifier )
+            {
+            iNotifier->StartNotifierAndGetResponse( activeLogin->iStatus,
+                                                    KUidCConnDlgAuthentication,
+                                                    *authenticationPairBuff,
+                                                    *authenticationPairBuff );
+            }
+        }
+
+    CLOG_LEAVEFN( "RGenConAgentDialogServer::Authenticate" );
+    }
+
+
+// ---------------------------------------------------------
+// Reconnect
+// ---------------------------------------------------------
+//
+EXPORT_C void RGenConAgentDialogServer::Reconnect( TBool& aBool, 
+                                                   TRequestStatus& aStatus )
+    {
+    // Reconnect dialog has not to be showed
+    aBool = EFalse;
+    TRequestStatus* pS = &aStatus;
+    User::RequestComplete( pS, KErrNone );
+    }
+
+
+// ---------------------------------------------------------
+// OpenPct
+// ---------------------------------------------------------
+//
+EXPORT_C TInt RGenConAgentDialogServer::OpenPct()
+    {
+    return( KErrNotSupported );
+    }
+
+
+// ---------------------------------------------------------
+// WritePct
+// ---------------------------------------------------------
+//
+EXPORT_C TInt RGenConAgentDialogServer::WritePct( const TDesC& /*aData*/ )
+    {
+    return( KErrNone );
+    }
+
+
+// ---------------------------------------------------------
+// ReadPct
+// ---------------------------------------------------------
+//
+EXPORT_C void RGenConAgentDialogServer::ReadPct( TDes& /*aData*/, 
+                                                 TRequestStatus& aStatus )
+    {
+    TRequestStatus* s = &aStatus;
+    User::RequestComplete( s, KErrNotSupported );
+    }
+
+
+// ---------------------------------------------------------
+// DestroyPctNotification
+// ---------------------------------------------------------
+//
+EXPORT_C void RGenConAgentDialogServer::DestroyPctNotification( 
+                                                TRequestStatus& /*aStatus*/ )
+    {
+    }
+
+
+// ---------------------------------------------------------
+// ClosePct
+// ---------------------------------------------------------
+//
+EXPORT_C void RGenConAgentDialogServer::ClosePct()
+    {
+    }
+
+
+// ---------------------------------------------------------
+// QoSWarning
+// ---------------------------------------------------------
+//
+EXPORT_C void RGenConAgentDialogServer::QoSWarning( TBool& aResponse, 
+                                                    TRequestStatus& aStatus )
+    {
+    CLOG_ENTERFN( "RGenConAgentDialogServer::QoSWarning" );
+
+    ::new( &iBool ) TPckg<TBool>( aResponse );
+    if ( iNotifier )
+        {
+        iNotifier->StartNotifierAndGetResponse( aStatus, KUidCConnDlgQos,
+                                                iBool, iBool );
+        }
+
+    CLOG_LEAVEFN( "RGenConAgentDialogServer::QoSWarning" );
+    }
+
+
+// ---------------------------------------------------------
+// ModemAndLocationSelection
+// ---------------------------------------------------------
+//
+EXPORT_C void RGenConAgentDialogServer::ModemAndLocationSelection( 
+                                                    TUint32& aModemId, 
+                                                    TUint32& aLocationId, 
+                                                    TRequestStatus& aStatus)
+    {
+    ::new( &iModemId ) TPckg<TUint32>( aModemId );
+    ::new( &iLocationId ) TPckg<TUint32>( aLocationId );
+
+    TIspConnectionNames modemLoc;
+    modemLoc.iModemName.Num( ( TInt )aModemId );
+    modemLoc.iLocationName.Num( ( TInt )aLocationId );
+    iConNames = modemLoc;
+
+    if ( iNotifier )
+        {
+        iNotifier->StartNotifierAndGetResponse( aStatus, 
+                                                KUidCConnDlgModemAndLocation,
+                                                iConNames, iConNames);
+        }
+    }
+
+
+// ---------------------------------------------------------
+// ClosePct
+// ---------------------------------------------------------
+//
+EXPORT_C void RGenConAgentDialogServer::CancelModemAndLocationSelection()
+    {
+    if ( iNotifier )
+        {
+        iNotifier->CancelNotifier( KUidCConnDlgModemAndLocation );
+        }
+    }
+
+
+// ---------------------------------------------------------
+// CancelIapConnection
+// ---------------------------------------------------------
+//
+EXPORT_C void RGenConAgentDialogServer::CancelIapConnection()
+    {
+    CLOG_ENTERFN( "RGenConAgentDialogServer::CancelIapConnection" );
+
+    if ( iNotifier )
+        {
+        iNotifier->CancelNotifier( KUidCConnDlgIap );
+        }
+
+    CLOG_LEAVEFN( "RGenConAgentDialogServer::CancelIapConnection" );
+    }
+
+
+// ---------------------------------------------------------
+// CancelWarnNewIapConnection
+// ---------------------------------------------------------
+//
+EXPORT_C void RGenConAgentDialogServer::CancelWarnNewIapConnection()
+    {
+    CLOG_ENTERFN( "RGenConAgentDialogServer::CancelWarnNewIapConnection" );
+
+    if ( iNotifier )
+        {
+        iNotifier->CancelNotifier( KUidCConnDlgNewIap );
+        }
+
+    CLOG_LEAVEFN( "RGenConAgentDialogServer::CancelWarnNewIapConnection" );
+    }
+
+
+// ---------------------------------------------------------
+// CancelLogin
+// ---------------------------------------------------------
+//
+EXPORT_C void RGenConAgentDialogServer::CancelLogin()
+    {
+    CLOG_ENTERFN( "RGenConAgentDialogServer::CancelLogin" );
+
+    CancelAuthenticate();
+
+    CLOG_LEAVEFN( "RGenConAgentDialogServer::CancelLogin" );
+    }
+
+
+// ---------------------------------------------------------
+// CancelAuthenticate
+// ---------------------------------------------------------
+//
+EXPORT_C void RGenConAgentDialogServer::CancelAuthenticate()
+    {
+    CLOG_ENTERFN( "RGenConAgentDialogServer::CancelAuthenticate" );
+
+    if ( iNotifier )
+        {
+        iNotifier->CancelNotifier( KUidCConnDlgAuthentication );
+        }
+
+    CActiveLogin* activeLogin = ( CActiveLogin* )iNotUsed();
+
+    activeLogin->Cancel();
+    delete activeLogin;
+
+    CLOG_LEAVEFN( "RGenConAgentDialogServer::CancelAuthenticate" );
+    }
+
+
+// ---------------------------------------------------------
+// CancelReconnect
+// ---------------------------------------------------------
+//
+EXPORT_C void RGenConAgentDialogServer::CancelReconnect()
+    {
+    if ( iNotifier )
+        {
+        iNotifier->CancelNotifier( KUidCConnDlgReconnect );
+        }
+    }
+
+
+// ---------------------------------------------------------
+// CancelReadPct
+// ---------------------------------------------------------
+//
+EXPORT_C void RGenConAgentDialogServer::CancelReadPct()
+    {
+    }
+
+
+// ---------------------------------------------------------
+// CancelDestroyPctNotification
+// ---------------------------------------------------------
+//
+EXPORT_C void RGenConAgentDialogServer::CancelDestroyPctNotification()
+    {
+    }
+
+
+// ---------------------------------------------------------
+// CancelQoSWarning
+// ---------------------------------------------------------
+//
+EXPORT_C void RGenConAgentDialogServer::CancelQoSWarning()
+    {
+    CLOG_ENTERFN( "RGenConAgentDialogServer::CancelQoSWarning" );
+
+    if ( iNotifier )
+        {
+        iNotifier->CancelNotifier( KUidCConnDlgQos );
+        }
+
+    CLOG_LEAVEFN( "RGenConAgentDialogServer::CancelQoSWarning" );
+    }
+
+
+// ---------------------------------------------------------
+// AccessPointConnection
+// ---------------------------------------------------------
+//
+EXPORT_C void RGenConAgentDialogServer::AccessPointConnection( 
+                                    TUint32& /*aAccessPoint*/, 
+                                    TInt /*aAccessPointGroup*/, 
+                                    TRequestStatus& /*aStatus*/ )
+    {
+    }
+
+
+// ---------------------------------------------------------
+// CancelAccessPointConnection
+// ---------------------------------------------------------
+//
+EXPORT_C void RGenConAgentDialogServer::CancelAccessPointConnection()
+    {
+    CLOG_ENTERFN( "RGenConAgentDialogServer::CancelAccessPointConnection" );
+
+    if ( iNotifier )
+        {
+        iNotifier->CancelNotifier( KUidCConnDlgSelectConn );
+        }
+
+    CLOG_LEAVEFN( "RGenConAgentDialogServer::CancelAccessPointConnection" );
+    }
+
+
+// ---------------------------------------------------------
+// AccessPointConnection
+// ---------------------------------------------------------
+//
+EXPORT_C void RGenConAgentDialogServer::AccessPointConnection(
+                                                  TUint32& /*aAP*/, 
+                                                  TUint32 aAPType, 
+                                                  TUint32& aBearerAPInd, 
+                                                  TUint32 aBearerAPType, 
+                                                  TRequestStatus& aStatus )
+    {
+    CLOG_ENTERFN( "RGenConAgentDialogServer::AccessPointConnection" );
+
+    ::new( &iIAP ) TPckg<TUint32>( aBearerAPInd );
+    ::new( &iPrefs ) TPckgBuf<TConnectionPrefs>( TConnectionPrefs() );
+
+    // Using the unused iRank to pass the ElementId
+    iPrefs().iRank = aBearerAPInd;
+    iPrefs().iBearerSet = aBearerAPType;
+    
+    // By setting aAPType to 1 application can define that
+    // dialog is displayed even though there was a user connection.
+    if ( aAPType == 1 )
+        {
+    	iPrefs().iDirection = ECommDbConnectionDirectionOutgoing;
+        }
+    else
+        {
+    	iPrefs().iDirection = ECommDbConnectionDirectionUnknown;
+        }
+
+    if ( iNotifier )
+        {
+        iNotifier->StartNotifierAndGetResponse( aStatus, 
+                                                KUidCConnDlgSelectConn,
+                                                iPrefs, iIAP );
+        }
+
+    CLOG_LEAVEFN( "RGenConAgentDialogServer::AccessPointConnection" );
+    }
+
+
+// ---------------------------------------------------------
+// Connect
+//
+// Connect to the  server
+// ---------------------------------------------------------
+//
+TInt RDialogNotifier::Connect()
+    {
+    TInt ret = RNotifier::Connect();
+    return ret;
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/cconndlg/data/CConnDlgPlugin.rss	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,364 @@
+/*
+* Copyright (c) 2002 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:  resorce of CConnDLGPLUGIN.
+*
+*/
+
+
+// RESOURCE IDENTIFIER
+NAME CDLG
+
+
+// INCLUDES
+#include <eikon.rh>
+#include <eikon.rsg>
+
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.mbg>
+#include <apsettings.mbg>
+
+#include <avkon.hrh>
+#include <AvkonIcons.hrh>
+#include <avkon.loc>
+
+#include <agentdialog.loc>
+#include "ConnectionDialogs.hrh"
+
+
+// RESOURCE DEFINITIONS 
+
+RESOURCE RSS_SIGNATURE { }
+
+
+RESOURCE CBA r_softkeys_done_cancel__select
+    {
+    buttons =
+        {
+        CBA_BUTTON { id = EAknSoftkeyDone;   txt = text_softkey_done; },
+        CBA_BUTTON { id = EAknSoftkeyCancel; txt = text_softkey_cancel; },
+        CBA_BUTTON { id = EAknSoftkeyDone;   txt = qtn_msk_select; }
+        };
+    }
+
+
+RESOURCE DIALOG r_conndlg_authentication
+    {
+    flags = EEikDialogFlagNotifyEsc | EEikDialogFlagNoDrag | 
+            EEikDialogFlagNoTitleBar | EEikDialogFlagCbaButtons;
+    buttons = r_softkeys_done_cancel__select;
+    items=
+        {
+        DLG_LINE
+            {
+            type = EAknCtMultilineQuery;
+            id = EMultilineFirstLine;
+            control = AVKON_DATA_QUERY
+                {
+                layout = EMultiDataFirstEdwin;
+                label = qtn_netw_iap_auth_username;
+                control = EDWIN
+                    {
+                    avkon_flags = EAknEditorFlagLatinInputModesOnly;
+                    allowed_input_modes = EAknEditorTextInputMode | 
+                                          EAknEditorNumericInputMode;
+                    width = 50;
+                    lines = 1;
+                    maxlength = 50;
+                    };
+                };
+            },
+
+        DLG_LINE
+            {
+            type = EAknCtMultilineQuery;
+            id = EMultilineSecondLine;
+            control = AVKON_DATA_QUERY
+                {
+                layout = EMultiDataSecondSecEd;
+                label = qtn_netw_iap_auth_password;
+                control = SECRETED
+                    {
+                    num_letters = 50;
+                    };
+                };
+            }
+        };
+    }
+
+
+RESOURCE DIALOG r_conndlg_reconnect
+    {
+    flags = EEikDialogFlagNotifyEsc | EEikDialogFlagCbaButtons | 
+            EEikDialogFlagNoDrag | EEikDialogFlagNoTitleBar | 
+            EEikDialogFlagCbaButtons;
+    buttons = R_AVKON_SOFTKEYS_YES_NO__YES;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control= AVKON_CONFIRMATION_QUERY
+                {
+                layout = EConfirmationLayout;
+                label = qtn_ics_q_conn_lost_reconn;
+                };
+            }
+        };
+    }
+
+
+RESOURCE DIALOG r_conndlg_qos
+    {
+    flags = EEikDialogFlagNotifyEsc | EEikDialogFlagCbaButtons | 
+            EEikDialogFlagNoDrag | EEikDialogFlagNoTitleBar | 
+            EEikDialogFlagCbaButtons;
+    buttons = R_AVKON_SOFTKEYS_YES_NO__YES;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control = AVKON_CONFIRMATION_QUERY
+                {
+                layout = EConfirmationLayout;
+                label = qtn_ics_q_conn_qos_reconn;
+                };
+            }
+        };
+    }
+
+
+RESOURCE AVKON_LIST_QUERY r_list_query
+    {
+    softkeys = R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT;
+    flags = EEikDialogFlagNotifyEsc | EEikDialogFlagCbaButtons |
+            EEikDialogFlagNoDrag | EEikDialogFlagNoTitleBar;
+
+    items =
+        {
+        AVKON_LIST_QUERY_DLG_LINE
+            {
+            id = EListQueryControl;
+            control = AVKON_LIST_QUERY_CONTROL
+                {
+                listtype = EAknCtSingleGraphicPopupMenuListBox;
+                listbox = AVKON_LIST_QUERY_LIST
+                    {
+                    flags = EAknListBoxSelectionList;
+                    };
+
+                heading = qtn_ics_ap_list_title;
+                };
+            }
+        };
+    }
+
+
+RESOURCE DIALOG r_conndlg_new_iap
+    {
+    flags = EEikDialogFlagNotifyEsc | EEikDialogFlagCbaButtons | 
+            EEikDialogFlagNoDrag | EEikDialogFlagNoTitleBar;
+    buttons = R_AVKON_SOFTKEYS_YES_NO__YES;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control= AVKON_CONFIRMATION_QUERY
+                {
+                layout = EConfirmationLayout;
+                };
+            }
+        };
+    }
+
+
+RESOURCE TBUF r_conndlg_new_connection_attempt 
+    { 
+    buf = qtn_ics_ap_connect_text; 
+    }
+
+
+RESOURCE TBUF r_wlan_search_for_networks 
+    { 
+    buf = qtn_wlan_search_for_networks; 
+    }
+
+    
+RESOURCE DIALOG r_searching_wait_note
+	{
+	flags = EAknWaitNoteFlags;
+	buttons=R_AVKON_SOFTKEYS_EMPTY;
+    items=
+		{
+		DLG_LINE
+			{
+			type = EAknCtNote;
+			id = 0x112; // 
+			control= AVKON_NOTE 
+                { 
+				layout = EWaitLayout;
+				singular_label = qtn_netw_wait_checking_avail_conn;			
+                imagefile = AVKON_ICON_FILE;
+				imageid = EMbmAvkonQgn_note_progress;
+				imagemask = EMbmAvkonQgn_note_progress_mask;
+				animation = R_QGN_GRAF_WAIT_BAR_ANIM;				
+				};
+			}
+		};
+    }
+
+
+RESOURCE TBUF r_wlan_easy_wlan
+    { 
+    buf = qtn_netw_conset_easy_wlan; 
+    }
+
+    
+RESOURCE TBUF r_list_uncategorized
+    { 
+    buf = qtn_netw_conset_dest_uncategorized; 
+    }
+
+
+RESOURCE TBUF r_conn_methods_many
+    { 
+    buf = qtn_netw_conset_conn_methods_amount_many;
+    }
+
+
+RESOURCE TBUF r_conn_methods_one
+    { 
+    buf = qtn_netw_conset_conn_methods_amount_one;
+    }
+
+
+RESOURCE CBA r_softkeys_options_cancel__connect
+    {
+    buttons =
+        {
+        CBA_BUTTON { id = EAknSoftkeyOptions; txt = text_softkey_option; },
+        CBA_BUTTON { id = EAknSoftkeyCancel;  txt = text_softkey_cancel; },
+        CBA_BUTTON { id = EAknSoftkeyDone;    txt = qtn_msk_connect; }
+        };
+    }
+
+
+    
+RESOURCE AVKON_LIST_QUERY r_select_connection_query
+    {
+    softkeys = r_softkeys_options_cancel__connect;
+    flags = EEikDialogFlagNotifyEsc | EEikDialogFlagCbaButtons |
+            EEikDialogFlagNoDrag | EEikDialogFlagNoTitleBar;
+
+    items =
+        {
+        AVKON_LIST_QUERY_DLG_LINE
+            {
+            id = EListQueryControl;
+            control = AVKON_LIST_QUERY_CONTROL
+                {
+                listtype = EAknCtDoubleLargeGraphicPopupMenuListBox;
+                listbox = AVKON_LIST_QUERY_LIST
+                    {
+                    };
+
+                heading = qtn_netw_conset_prmpt_select_connection;
+                };
+            }
+        };
+    }
+
+
+RESOURCE MENU_BAR r_select_connection_menubar
+    {
+    titles =
+        {
+        MENU_TITLE { menu_pane = r_select_connection_menu_pane; txt = ""; }
+        };
+    }
+
+
+RESOURCE MENU_PANE r_select_connection_menu_pane
+    {
+    items =
+        {
+        MENU_ITEM 
+            { 
+            command = ESelectConnectionCmdSelect;  
+            txt = qtn_set_cmd_select;
+            flags = EEikMenuItemAction; 
+            },
+
+        MENU_ITEM 
+            { 
+            command = ESelectConnectionCmdConnect;  
+            txt = qtn_set_cmd_connect;
+            flags = EEikMenuItemAction;
+            },
+
+        MENU_ITEM 
+            { 
+            command = ESelectConnectionCmdChooseMethod; 
+            txt = qtn_netw_conset_options_select_method;
+            flags = EEikMenuItemSpecific; 
+            }
+        };
+    }
+
+
+RESOURCE CBA r_softkeys_connect_cancel__select
+    {
+    buttons =
+        {
+        CBA_BUTTON { id = EAknSoftkeySelect; txt = qtn_netw_conset_softkey_connect; },
+        CBA_BUTTON { id = EAknSoftkeyCancel; txt = text_softkey_cancel; },
+        CBA_BUTTON { id = EAknSoftkeySelect; txt = qtn_msk_select; }
+        };
+    }
+
+
+RESOURCE AVKON_LIST_QUERY r_list_explicit_query
+    {
+    softkeys = r_softkeys_connect_cancel__select;
+    flags = EEikDialogFlagNotifyEsc | EEikDialogFlagCbaButtons |
+            EEikDialogFlagNoDrag | EEikDialogFlagNoTitleBar;
+
+    items =
+        {
+        AVKON_LIST_QUERY_DLG_LINE
+            {
+            id = EListQueryControl;
+            control = AVKON_LIST_QUERY_CONTROL
+                {
+                listtype = EAknCtSingleGraphicPopupMenuListBox;
+                listbox = AVKON_LIST_QUERY_LIST
+                    {
+                    flags = EAknListBoxSelectionList;
+                    };
+
+                heading = qtn_netw_conset_prmpt_select_conn_method;
+                };
+            }
+        };
+    }
+
+
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/cconndlg/inc/ActiveBase.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,102 @@
+/*
+* Copyright (c) 2002 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 a CActive base class 
+*
+*/
+
+
+
+#ifndef __ACTIVEBASE_H__
+#define __ACTIVEBASE_H__
+
+
+// INCLUDES
+#include <e32base.h>
+
+
+// CLASS DECLARATION
+
+/**
+ * CActiveBase class, an active object for selection plugin
+ */     
+NONSHARABLE_CLASS( CActiveBase ) : public CActive
+    {
+    public:
+        /**
+        * NewL function
+        */
+        static CActiveBase* NewL();
+    
+        /**
+        * Destructor
+        */    
+        virtual ~CActiveBase();
+    
+        /**
+        * Cancels the active object
+        */
+        void Cancel();
+
+        /**
+        * Timer callback of iPeridoc.
+        */
+        static TInt Tick( TAny* aObject );    
+    
+        
+    protected:
+        /**
+        * ConstructL 
+        */
+        void ConstructL();
+    
+        /**
+        * Constructor
+        */    
+        CActiveBase();
+    
+        /**
+        * DoCancel from CActive
+        */    
+        virtual void DoCancel();
+
+        /**
+        * RunL from CActive
+        */
+        virtual void RunL();
+
+        /**
+        * Starts Timer
+        * @param aTickInterval refersh interval
+        */
+        void StartTimerL( TInt aTickInterval );
+    
+        /**
+        * Stops Timer
+        */
+        void StopTimer();                                            
+        
+
+    protected:
+    
+        // Timer, to refresh iaps of networks. Owned.
+        CPeriodic* iPeriodic;
+            
+        // used for complete runl, not owned.
+        TRequestStatus* iClientStatus;  
+    };     
+
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/cconndlg/inc/ActiveIapPlugin.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,113 @@
+/*
+* Copyright (c) 2002 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 Active Iap 
+*
+*/
+
+
+
+#ifndef __ACTIVEIAPPLUGIN_H__
+#define __ACTIVEIAPPLUGIN_H__
+
+
+// INCLUDES
+#include "ConnDlgPlugin.h"
+#include "ActiveIAPListing.h"
+
+
+// FORWARD DECLARATION
+class CIapDialog;
+
+
+// CLASS DECLARATION
+
+/**
+ * CActiveCConnDlgIapPlugin class,
+ * an active object for CConnDlgIapPlugin
+ */     
+NONSHARABLE_CLASS( CActiveCConnDlgIapPlugin ) : public CActiveIAPListing
+    {
+    public:
+        /**
+        * NewL function
+        * @param  aPlugin a pointer to notifier plugin
+        * @param aIAPId iap id
+        * @param aPrefs preferences pointer    
+        */
+        static CActiveCConnDlgIapPlugin* NewL( CConnDlgIapPlugin* aPlugin,                            
+                                           const TConnectionPrefs& aPrefs );
+    
+        /**
+        * StartSearchIAPsL setactive and starts active object
+        */    
+        void StartSearchIAPsL();
+
+        /**
+        * Destructor
+        */    
+        virtual ~CActiveCConnDlgIapPlugin();
+    
+        /**
+        * Cancels the active object
+        */
+        void Cancel();
+
+              
+    protected:
+        /**
+        * ConstructL 
+        */
+        void ConstructL();
+    
+        /**
+        * Constructor
+        * @param  aPlugin a pointer to notifier plugin    
+        * @param aIAPId iap id
+        * @param aPrefs preferences pointer        
+        */    
+        CActiveCConnDlgIapPlugin( CConnDlgIapPlugin* aPlugin,
+                                  const TConnectionPrefs& aPrefs );
+    
+        /**
+        * DoCancel from CActive
+        */    
+        virtual void DoCancel();
+
+        /**
+        * RunL from CActive
+        */
+        virtual void RunL();
+
+        /**
+        * Gives back, refresh interval of scan for network
+        */
+        TInt GetRefreshInterval();
+
+
+    protected:
+    
+        // a pointer to notifer, not owned
+        CConnDlgIapPlugin* iPlugin;
+    
+        ///< Pointer to the dialog, not owned 
+        CIapDialog* iDialog;
+    
+        TBool isDialogDeleting; 
+     
+    };     
+
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/cconndlg/inc/ActiveSelectConnectionPlugin.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,174 @@
+/*
+* Copyright (c) 2002 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 Active SelectConnection 
+*
+*/
+
+
+
+#ifndef __ACTIVESELECTCONNECTIONPLUGIN_H__
+#define __ACTIVESELECTCONNECTIONPLUGIN_H__
+
+
+// INCLUDES
+#include <e32base.h>
+#include <agentdialog.h>
+#include <cmmanagerext.h>
+#include <rmpm.h>
+#include "ActiveBase.h"
+
+
+// FORWARD DECLARATION
+class CSelectConnectionDialog;
+class CConnectionInfoArray;
+class MEikSrvNotifierBase2;
+class CGulIcon;
+class TSortSnapUtils;
+
+// CLASS DECLARATION
+
+/**
+ * CActiveSelectConnectionPlugin class,
+ * an active object for selection plugin
+ */     
+NONSHARABLE_CLASS( CActiveSelectConnectionPlugin ) : public CActiveBase
+    {
+    public:
+        /**
+        * NewL function
+        * @param  aPlugin a pointer to notifier plugin
+        * @param aIAPId iap id
+        * @param aPrefs preferences pointer    
+        */
+        static CActiveSelectConnectionPlugin* NewL( 
+                                                MEikSrvNotifierBase2* aPlugin,
+                                                const TUint32 aElementId,
+                                                TUint32 aBearerSet );
+    
+        /**
+        * Setactive and starts active object
+        */    
+        void ShowSelectConnectionL();
+
+        /**
+        * Destructor
+        */    
+        virtual ~CActiveSelectConnectionPlugin();
+    
+        /**
+        * Cancels the active object
+        */
+        void Cancel();
+
+        /**
+        * Sets the preferred iap into db.
+        * calls iActivePlugin    
+        * @param aIAPId id of the preferred iap
+        * @param aDestinationId id of the preferred Destination
+        */
+        TUint32 GetElementIDL( TUint32 aIAPId, TUint32 aDestinationId );
+
+
+    protected:
+        /**
+        * ConstructL 
+        */
+        void ConstructL();
+    
+        /**
+        * Constructor
+        * @param  aPlugin a pointer to notifier plugin    
+        * @param aIAPId iap id
+        * @param aPrefs preferences pointer        
+        */    
+        CActiveSelectConnectionPlugin( MEikSrvNotifierBase2* aPlugin,
+                                       const TUint32 aElementId,
+                                       TUint32 aBearerSet );
+    
+        /**
+        * DoCancel from CActive
+        */    
+        virtual void DoCancel();
+
+        /**
+        * RunL from CActive
+        */
+        virtual void RunL();
+
+        /**
+        * BuildConnectionListL
+        * @param    -
+        */
+        void BuildConnectionListL();
+
+        void AddSearchForWLanItemL();
+
+        void AddDestinationItemsL();
+        void AddDestinationItemL( RCmDestinationExt aDestination, 
+                                  TUint32 aDestId, TBool aFirstItem, 
+                                  TBool aDefaultDest,
+                                  TSortSnapUtils& aSortSnapUtils );
+
+        void AddUncategorizedItemL( TSortSnapUtils& aSortSnapUtils );
+        
+        /**
+        * Gives back, refresh interval of scan for network
+        */
+        TInt GetRefreshIntervalL();
+        
+        /**
+        * Counts the number of ad-hoc WLAN iaps
+        */
+        TInt CountAdhocWlanIapsL();
+
+    protected:
+        // contains all iaps from db, owned
+        CConnectionInfoArray *iItems;   
+
+        // Selected preferences
+        TUint32 iBearerSet;
+
+        // Requested bearer set preference
+        TUint32 iReqBearerSet;
+        
+        // Selected preferences
+        TUint32 iElementId;
+
+        // a pointer to notifer, not owned
+        MEikSrvNotifierBase2* iPlugin;
+    
+        ///< Pointer to the dialog, not owned 
+        CSelectConnectionDialog* iDialogConn;
+    
+        TBool iIsWLANFeatureSupported;
+
+        TInt iRefreshInterval;
+
+        TInt iHighlightedItem;
+
+        CArrayPtr< CGulIcon >* iIcons;
+
+        RMPM iMPM;
+
+        RCmManagerExt iCmManagerExt;
+
+        TUint iDefaultDestId;
+
+        TUint iDefaultCMId;
+    };     
+
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/cconndlg/inc/ActiveSelectExplicit.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,159 @@
+/*
+* Copyright (c) 2002 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 Active Iap 
+*
+*/
+
+
+
+#ifndef __ACTIVESELECTEXPLICIT_H__
+#define __ACTIVESELECTEXPLICIT_H__
+
+
+// INCLUDES
+#include "ConnDlgPlugin.h"
+#include "ActiveIAPListing.h"
+#include "SelectConnectionDialog.h"
+#include "ActiveBase.h"
+#include <cmmanagerext.h>
+#include <rmpm.h>
+
+
+// FORWARD DECLARATION
+class CSelectExplicitDialog;
+
+
+// CLASS DECLARATION
+
+/**
+ * CActiveSelectExplicit class,
+ * an active object for SelectExplicit
+ */     
+NONSHARABLE_CLASS( CActiveSelectExplicit ) : public CActiveBase
+    {
+    public:
+        /**
+        * NewL function
+        * @param  aPlugin a pointer to notifier plugin
+        * @param aIAPId iap id
+        * @param aPrefs preferences pointer    
+        */
+        static CActiveSelectExplicit* NewL( 
+                                        CSelectConnectionDialog* aCallerDialog,
+                                        TUint aDestId, 
+                                        TInt aRefreshInterval,
+                                        TUint32 aBearerSet, 
+                                        TBool aIsWLANFeatureSupported, 
+                                        TUint aDefaultCMId );
+
+        /**
+        * Setactive and starts active object
+        */    
+        void ShowSelectExplicitL();
+
+        /**
+        * Destructor
+        */    
+        virtual ~CActiveSelectExplicit();
+    
+        /**
+        * Cancels the active object
+        */
+        void Cancel();
+
+        /**
+        * Gives back the id of preferred iap.
+        * @return the id of iap
+        */
+        TUint32 GetPreferredIapIdL();
+    
+    
+        /**
+        * Sets the preferred iap into db.
+        * @param aIAPId id of the preferred iap
+        */
+        void SetPreferredIapIdL( TUint32 aIAPId );
+
+        
+    protected:
+        /**
+        * ConstructL 
+        */
+        void ConstructL();
+    
+        /**
+        * Constructor
+        * @param  aPlugin a pointer to notifier plugin    
+        * @param aIAPId iap id
+        * @param aPrefs preferences pointer        
+        */    
+        CActiveSelectExplicit( CSelectConnectionDialog* aCallerDialog,
+                               TUint aDestId, 
+                               TInt aRefreshInterval,
+                               TUint32 aBearerSet, 
+                               TBool aIsWLANFeatureSupported, 
+                               TUint aDefaultCMId );
+
+
+        /**
+        * DoCancel from CActive
+        */    
+        virtual void DoCancel();
+
+        /**
+        * RunL from CActive
+        */
+        virtual void RunL();
+
+        /**
+        * BuildConnectionListL
+        * @param    -
+        */
+        void BuildConnectionListL();
+
+        void AddConnectionMethodItemL( TUint32 aId,
+                                       TBool aCheckForEasyWlan, 
+                                       TBool& aEasyWlanIsInDb, 
+                                       TBool aDefaultCM );
+                                       
+        void AddAdhocWlanIapsL();                               
+
+
+    protected:
+        // contains all iaps from db, owned
+        CConnectionInfoArray *iItems;   
+
+        CSelectConnectionDialog* iCallerDialog;
+
+        TUint iDestId;
+
+        ///< Pointer to the dialog, not owned 
+        CSelectExplicitDialog* iDialog;
+    
+        TInt iRefreshInterval;
+
+        CArrayPtr< CGulIcon >* iIcons;
+
+        RMPM iMPM;
+        RCmManagerExt iCmManagerExt;
+
+        TUint32 iBearerSet;
+        TBool iIsWLANFeatureSupported;
+        TUint iDefaultCMId;
+    };     
+
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/cconndlg/inc/AuthenticationDialog.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,124 @@
+/*
+* Copyright (c) 2002 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 CAuthenticationDialog.
+*
+*/
+
+
+#ifndef __AUTHENTICATIONDIALOG_H__
+#define __AUTHENTICATIONDIALOG_H__
+
+
+// INCLUDES
+#include <e32base.h>
+#include <AknQueryDialog.h>
+
+#include "ExpiryTimerCallback.h"
+
+// FORWARD DECLARATION
+class CConnDlgAuthenticationPlugin;
+class CExpiryTimer;
+
+// CLASS DECLARATION
+/**
+ * Class implementing Authentication (username and password) dialog
+ */
+NONSHARABLE_CLASS( CAuthenticationDialog ) : 
+                                            public CAknMultiLineDataQueryDialog, public MExpiryTimerCallback
+    {
+    public:
+        /**
+        * NewL function
+        * @param aPlugin    plugin pointer
+        * @param aDb        database pointer
+        * @param aUsername  username
+        * @param aPassword  password
+        * return CAuthenticationDialog*
+        */
+        static CAuthenticationDialog* NewL( 
+                                        CConnDlgAuthenticationPlugin* aPlugin,
+                                        TDes& aUsername, 
+                                        TDes& aPassword );
+
+    private:
+        /**
+        * CAuthenticationDialog default constructor
+        * @param aPlugin    plugin pointer
+        * @param aDb        database pointer
+        * @param aUsername  username
+        * @param aPassword  password
+        */
+        CAuthenticationDialog( CConnDlgAuthenticationPlugin* aPlugin );
+
+        /**
+        * OkToExitL destructor
+        * @param  aButtonId button exit id
+        * @return TBool exit or no
+        */
+        virtual TBool OkToExitL( TInt aButtonId );
+
+        /**
+        * ~CAuthenticationDialog destructor
+        * @param    -
+        */
+        ~CAuthenticationDialog();
+
+        /**
+        * HandleQueryEditorStateEventL function
+        * @param    aQueryControl   Control to be queried
+        * @param    aEventType      Type of event (not used)
+        * @param    aStatus         Status of the control (empty or not)
+        * return    TBool
+        */
+        TBool HandleQueryEditorStateEventL( CAknQueryControl* aQueryControl, 
+                                            TQueryControlEvent aEventType, 
+                                            TQueryValidationStatus aStatus );
+        
+        /**
+        * Dialog expiration timeout callback
+        */
+        void HandleTimedOut();
+
+    private:
+        /**
+        * PreLayoutDynInitL function
+        * @param    -
+        */
+        virtual void PreLayoutDynInitL();
+
+        /**
+        * SetInitialCurrentLine function
+        * @param    -
+        */
+        virtual void SetInitialCurrentLine();
+
+
+    private:
+        // Status of username field (empty or not)
+        TBool iFirstEmpty;
+
+        // Status of password field (empty or not)
+        TBool iSecondEmpty;
+
+        // Pointer to the plugin
+        CConnDlgAuthenticationPlugin* iPlugin;
+        
+        // Pointer for dialog expiration timer
+        CExpiryTimer* iExpiryTimer;
+    };
+
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/cconndlg/inc/CConnDlgPrivateCRKeys.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,32 @@
+/*
+* 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:  Defining local variation for the module
+*
+*
+*/
+
+
+#ifndef CCONNDLGPRIVATECRKEYS_H
+#define CCONNDLGPRIVATECRKEYS_H
+
+const TUid KCRUidCConnDlg = {0x10008D55};
+
+// Local variation for CConnDlg
+
+// KCConnDlgScanInterval defines the WLAN scanning interval for IAP dialog in
+// microseconds
+const TUint32 KCConnDlgScanInterval = 0x00000001;
+
+
+#endif      // CCONNDLGPRIVATECRKEYS_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/cconndlg/inc/ConnDlgPlugin.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,528 @@
+/*
+* Copyright (c) 2002 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 Generic Connection Dialog Plugins
+*
+*/
+
+
+
+#ifndef __CONNDLGPLUGIN_H__
+#define __CONNDLGPLUGIN_H__
+
+
+// INCLUDES
+#include "ConnectionDialogsNotifBase.h"
+
+#include <e32base.h>
+#include <agentdialog.h>
+#include <AknNotifyStd.h>
+
+
+// ENUMERATIONS
+enum TConnDlgPluginPanic                        // Reasons for panic
+    {
+    EConnDlgPctNotOpen,                         // Post Connection Terminal not
+                                                // open
+    EConnDlgPctAlreadyOpen,                     // Post Connection Terminal 
+                                                // already open
+    EConnDlgReadPctOutstandingOnClose,          // Post Connection Terminal 
+                                                // outstanding on close
+    EConnDlgDestroyPctNotfcnOutstandingOnClose, // Destroying Post Connection 
+                                                // Terminal 
+    EConnDlgRMessageWriteFailed,                // Failed RMessage Write
+    EConnDlgRMessageReadFailed,                 // Failed RMessage Read
+    EConnDlgIllegalRequest                      // Illegal request
+    };
+
+
+enum TConnDlgNotifierRequest                    // Opcodes used in message 
+    {                                           // passing in notifiers
+    EGetIAP,                                    // Get IAP
+    EGetISP,                                    // Get ISP
+    EWarnNewIAP,                                // Warning New IAP
+    EWarnNewISP,                                // Warning New ISP
+    EGetAuthentication,                         // Get Authentication
+    EGetLogin,                                  // Get Login
+    EGetReconnectReq,                           // Get Reconnect request
+    EOpenPct,                                   // Open Post Connection
+                                                // Terminal
+    EWritePct,                                  // Write Post Connection
+                                                // Terminal
+    EReadPct,                                   // Read Post Connection
+                                                // Terminal
+    EDestroyPctNotification,                    // Destroy Post Connection 
+                                                // Terminal Notification
+    EClosePct,                                  // Close Post Connection 
+                                                // Terminal
+    ECancelGetIAP,                              // Cancel Get IAP
+    ECancelGetISP,                              // Cancel Get ISP
+    ECancelWarnIAP,                             // Cancel Warning IAP
+    ECancelWarnISP,                             // Cancel Warning ISP
+    ECancelLogin,                               // Cancel Login
+    ECancelAuthenticate,                        // Cancel Authenticate
+    ECancelReconnect,                           // Cancel Reconnect
+    ECancelReadPct,                             // Cancel Read Post Connection
+                                                // Terminal
+    ECancelDestroyPctNotification               // Destroy Post Connection
+                                                // Terminal notification
+    };
+
+
+// GLOBAL FUNCTIONS
+//
+IMPORT_C CArrayPtr<MEikSrvNotifierBase2>* NotifierArray();
+
+
+// FORWARD DECLARATION
+class CAknMultiLineDataQueryDialog;
+class CAknQueryDialog;
+class CActiveCConnDlgIapPlugin;
+class CActiveSelectConnectionPlugin;
+
+// CLASS DECLARATION
+
+class TAuthenticationPairBuff
+    {
+public:
+    TBuf<KCommsDbSvrDefaultTextFieldLength> iUsername;
+    TBuf<KCommsDbSvrDefaultTextFieldLength> iPassword;
+    };
+
+
+/**
+ * IAP Plugin class
+ */
+NONSHARABLE_CLASS( CConnDlgIapPlugin ) : public CConnectionDialogsNotifBase
+    {
+public:
+    /**
+    * NewL function
+    * @param  -
+    * return CConnDlgIapPlugin*
+    */
+    static CConnDlgIapPlugin* NewL( const TBool aResourceFileResponsible );
+
+    /**
+    * RegisterL register the client notifier function
+    * @param  -
+    * return TNotifierInfo
+    */
+    TNotifierInfo RegisterL();
+
+    /**
+    * Start the Notifier
+    * @param  aBuffer    Buffer
+    * @param  aReplySlot Identifies which message argument to use for the 
+    *                    reply. This message argument will refer to a 
+    *                    modifiable descriptor, a TDes8 type, into which data
+    *                    can be returned. 
+    * @param  aMessage   Message
+    * return -
+    */
+    void StartL( const TDesC8& aBuffer, TInt aReplySlot, 
+                 const RMessagePtr2& aMessage );
+
+    /**
+    * Cancel() the notifier
+    * @param  -
+    * return -
+    */
+    void Cancel();
+
+public:
+
+    /**
+    * CompleteL the notifier is complete
+    * @param  aStatus status
+    * return  -
+    */
+    void CompleteL( TInt aStatus );
+    
+    /**
+    * Sets the preferred iap into db.
+    * calls iActivePlugin    
+    * @param aIAPId id of the preferred iap
+    */
+    void SetPreferredIapIdL( TUint32 aIAPId );
+    
+private:
+
+    /**
+    * Gets user connection info.    
+    * @param aIapId id of the iap
+    */ 
+    TInt GetUserConnection( TInt& aIapId );
+    
+    /**
+    * Gets active connection info.    
+    * @param aIapId id of the iap
+    * @param aBearer bearer type
+    */
+    TInt GetActiveConnection( TInt& aIapId, TInt& aBearer );    
+    
+private:
+    TUint32 iIAP;                       // Internet Access Point
+    TPckgBuf<TConnectionPrefs> iPrefs;  // Selected preferences
+    CActiveCConnDlgIapPlugin* iActivePlugin;    // pointer to active object
+    };
+
+
+/**
+ * Authentication Plugin class
+ */
+NONSHARABLE_CLASS( CConnDlgAuthenticationPlugin ) : 
+                                            public CConnectionDialogsNotifBase
+    {
+public:
+    CConnDlgAuthenticationPlugin::CConnDlgAuthenticationPlugin();
+
+    /**
+    * NewL function
+    * @param  -
+    * return CConnDlgAuthenticationPlugin*
+    */
+    static CConnDlgAuthenticationPlugin* NewL( 
+                                        const TBool aResourceFileResponsible );
+
+    /**
+    * RegisterL register the client notifier function
+    * @param  -
+    * return TNotifierInfo
+    */
+    TNotifierInfo RegisterL();
+
+    /**
+    * Start the Notifier
+    * @param  aBuffer    Buffer
+    * @param  aReplySlot Identifies which message argument to use for the 
+    *                    reply. This message argument will refer to a 
+    *                    modifiable descriptor, a TDes8 type, into which data
+    *                    can be returned. 
+    * @param  aMessage   Message
+    * return -
+    */
+    void StartL( const TDesC8& aBuffer, TInt aReplySlot, 
+                 const RMessagePtr2& aMessage );
+
+    /**
+    * Cancel() the notifier
+    * @param  -
+    * return -
+    */
+    void Cancel();
+
+public:
+
+    /**
+    * GetAuthenticationL() show the Authenticate  dialog
+    * @param  -
+    * return -
+    */
+    void GetAuthenticationL();
+
+    /**
+    * CompleteL the notifier is complete
+    * @param  aStatus status
+    * return  -
+    */
+    void CompleteL( TInt aStatus );
+
+private:
+    TPckgBuf<TAuthenticationPair> iAuthPair;    // Authentication pair 
+                                                // (username and password)
+    TPckgBuf<TAuthenticationPairBuff> iAuthPairBuff;    // Authentication pair 
+                                                // (username and password)
+    CAknMultiLineDataQueryDialog *iDialog;      // Pointer to the dialog
+    };
+
+
+/**
+ * Reconnect Plugin class
+ */
+NONSHARABLE_CLASS( CConnDlgReconnectPlugin ) : 
+                                            public CConnectionDialogsNotifBase
+    {
+public:
+
+    /**
+    * NewL function
+    * @param  -
+    * return CConnDlgReconnectPlugin*
+    */
+    static CConnDlgReconnectPlugin* NewL( 
+                                        const TBool aResourceFileResponsible );
+
+    /**
+    * RegisterL register the client notifier function
+    * @param  -
+    * return TNotifierInfo
+    */
+    TNotifierInfo RegisterL();
+
+    /**
+    * Start the Notifier
+    * @param  aBuffer    Buffer
+    * @param  aReplySlot Identifies which message argument to use for the 
+    *                    reply. This message argument will refer to a 
+    *                    modifiable descriptor, a TDes8 type, into which data
+    *                    can be returned. 
+    * @param  aMessage   Message
+    * return -
+    */
+    void StartL( const TDesC8& aBuffer, TInt aReplySlot, 
+                 const RMessagePtr2& aMessage );
+
+    /**
+    * Cancel() the notifier
+    * @param  -
+    * return -
+    */
+    void Cancel();
+
+public:
+
+    /**
+    * GetReconnectL() call the reconnect dialog
+    * @param  -
+    * return -
+    */
+    void GetReconnectL();
+
+    /**
+    * CompleteL the notifier is complete
+    * @param  aStatus status
+    * return  -
+    */
+    void CompleteL(TInt aStatus);
+
+private:
+    CAknQueryDialog* iDialog;   // Pointer to the dialog
+    TBool iBool;                // Tells if it has to connect to the IAP
+    };
+
+
+/**
+ * Quality of service Plugin class
+ */
+NONSHARABLE_CLASS( CConnDlgQosPlugin ) : public CConnectionDialogsNotifBase
+    {
+public:
+
+    /**
+    * NewL function
+    * @param  -
+    * return CConnDlgReconnectPlugin*
+    */
+    static CConnDlgQosPlugin* NewL( const TBool aResourceFileResponsible );
+
+    /**
+    * RegisterL register the client notifier function
+    * @param  -
+    * return TNotifierInfo
+    */
+    TNotifierInfo RegisterL();
+
+    /**
+    * Start the Notifier
+    * @param  aBuffer    Buffer
+    * @param  aReplySlot Identifies which message argument to use for the 
+    *                    reply. This message argument will refer to a 
+    *                    modifiable descriptor, a TDes8 type, into which data
+    *                    can be returned. 
+    * @param  aMessage   Message
+    * return -
+    */
+    void StartL( const TDesC8& aBuffer, TInt aReplySlot, 
+                 const RMessagePtr2& aMessage );
+
+    /**
+    * Cancel() the notifier
+    * @param  -
+    * return -
+    */
+    void Cancel();
+
+public:
+
+    /**
+    * GetReconnectL() call the reconnect dialog
+    * @param  -
+    * return -
+    */
+    void GetReconnectL();
+
+    /**
+    * CompleteL the notifier is complete
+    * @param  aStatus status
+    * return  -
+    */
+    void CompleteL( TInt aStatus );
+
+private:
+    CAknQueryDialog* iDialog;   // Pointer to the dialog
+    TBool iBool;                // Tells if it has to connect to the IAP
+    };
+
+
+/**
+ * New IAP Plugin class
+ */
+NONSHARABLE_CLASS( CConnDlgNewIapPlugin ) : public CConnectionDialogsNotifBase
+    {
+public:
+
+    /**
+    * NewL function
+    * @param  -
+    * return CConnDlgNewIapPlugin*
+    */
+    static CConnDlgNewIapPlugin* NewL( const TBool aResourceFileResponsible );
+
+    /**
+    * RegisterL register the client notifier function
+    * @param  -
+    * return TNotifierInfo
+    */
+    TNotifierInfo RegisterL();
+
+    /**
+    * Start the Notifier
+    * @param  aBuffer    Buffer
+    * @param  aReplySlot Identifies which message argument to use for the 
+    *                    reply. This message argument will refer to a 
+    *                    modifiable descriptor, a TDes8 type, into which data
+    *                    can be returned. 
+    * @param  aMessage   Message
+    * return -
+    */
+    void StartL( const TDesC8& aBuffer, TInt aReplySlot, 
+                 const RMessagePtr2& aMessage );
+
+    /**
+    * Cancel() the notifier
+    * @param  -
+    * return -
+    */
+    void Cancel();
+
+public:
+
+    /**
+    * GetNewIapL show NewIap dialog
+    * @param  -
+    * return  -
+    */
+    void GetNewIapL();
+
+    /**
+    * CompleteL the notifier is complete
+    * @param  aStatus status
+    * return  -
+    */
+    void CompleteL( TInt aStatus );
+
+private:
+    CAknQueryDialog* iDialog;                   // Pointer to the dialog
+    TBool iConnect;                             // Tells if it has to connect 
+                                                // to the IAP
+    TPckgBuf<TNewIapConnectionPrefs> iPrefs;    // Selected preferences
+    };
+
+
+
+/**
+ * Connection Selection Plugin class
+ */
+NONSHARABLE_CLASS( CConnDlgSelectConnectionPlugin ) : 
+                                            public CConnectionDialogsNotifBase
+    {
+public:
+    /**
+    * NewL function
+    * @param  -
+    * return CConnDlgSelectConnectionPlugin*
+    */
+    static CConnDlgSelectConnectionPlugin* NewL( 
+                                        const TBool aResourceFileResponsible );
+
+    /**
+    * RegisterL register the client notifier function
+    * @param  -
+    * return TNotifierInfo
+    */
+    TNotifierInfo RegisterL();
+
+    /**
+    * Start the Notifier
+    * @param  aBuffer    Buffer
+    * @param  aReplySlot Identifies which message argument to use for the 
+    *                    reply. This message argument will refer to a 
+    *                    modifiable descriptor, a TDes8 type, into which data
+    *                    can be returned. 
+    * @param  aMessage   Message
+    * return -
+    */
+    void StartL( const TDesC8& aBuffer, TInt aReplySlot, 
+                 const RMessagePtr2& aMessage );
+
+    /**
+    * Cancel() the notifier
+    * @param  -
+    * return -
+    */
+    void Cancel();
+
+public:
+
+    /**
+    * CompleteL the notifier is complete
+    * @param  aStatus status
+    * return  -
+    */
+    void CompleteL( TInt aStatus );
+    
+    /**
+    * Sets the preferred iap into db.
+    * calls iActivePlugin    
+    * @param aIAPId id of the preferred iap
+    * @param aDestinationId id of the preferred Destination
+    */
+    void SetElementIDL( TUint32 aIAPId, TUint32 aDestinationId );
+    
+private:
+
+    /**
+    * Gets user connection info.    
+    * @param aIapId id of the iap
+    * @param aSnapId id of the destination
+    */
+    TInt GetUserConnection( TInt& aIapId, TInt& aSnapId );
+    
+    /**
+    * Gets active connection info.    
+    * @param aIapId id of the iap
+    * @param aSnapId id of the destination
+    * @param aBearer bearer type
+    */    
+    TInt GetActiveConnection( TInt& aIapId, TInt& aSnapId, TInt& aBearer );
+
+private:
+    TUint32 iElementID;
+    TPckgBuf<TConnectionPrefs> iPrefs;  // Selected preferences
+    CActiveSelectConnectionPlugin* iActivePlugin;   // pointer to active object
+    };
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/cconndlg/inc/IAPDialog.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,129 @@
+/*
+* Copyright (c) 2002 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 CIapDialog.
+*
+*/
+
+
+#ifndef __IAPDIALOG_H__
+#define __IAPDIALOG_H__
+
+
+// INCLUDES
+#include <e32base.h>
+#include <aknlistquerydialog.h>
+
+#include "ExpiryTimerCallback.h"
+
+// FORWARD DECLARATION
+class CConnDlgIapPlugin;
+class CConnectionInfoArray;
+class CExpiryTimer;
+
+// CLASS DECLARATION 
+/**
+ * Class implementing IAP dialog
+ */
+NONSHARABLE_CLASS( CIapDialog ) : public CAknListQueryDialog, public MExpiryTimerCallback
+    {
+    private:
+        /**
+        * CIapDialog constructor
+        * @param aPlugin    plugin pointer
+        */
+        CIapDialog( CConnDlgIapPlugin* aPlugin );
+
+        /**
+        * Symbian default constructor.
+        */      
+        void ConstructL();
+
+
+    public:
+        /**
+        * NewL function
+        * @param aPlugin    plugin pointer
+        * return CIapDialog*
+        */
+        static CIapDialog* NewL( CConnDlgIapPlugin* aPlugin );
+
+        /**
+        * ~CIapDialog destructor
+        */
+        ~CIapDialog();
+
+        /**
+        * Exit function OF the CIapDialog
+        * @param    aButtonId button exit id
+        * @return TBool exit or no
+        */
+        virtual TBool OkToExitL( TInt aButtonId );
+        
+        /**
+        * Dialog refreshing
+        */
+        void RefreshDialogL( CConnectionInfoArray* aIAP, 
+                             TBool aIsReallyRefreshing );
+                             
+       /**
+        *
+        * @return The value of iFromOkToExit.
+        */
+        inline TBool GetOkToExit();
+        
+        /**
+        * Dialog expiration timeout callback
+        */
+        void HandleTimedOut();
+
+
+    private:
+        /**
+        * PreLayoutDynInitL
+        * @param    -
+        */
+        virtual void PreLayoutDynInitL();
+
+
+    private:
+        /**
+        * Sets graphic icons
+        * @param    -
+        */
+        void SetIconsL();
+
+        
+    private:    // Data
+
+        // Pointer to the plugin, not owned
+        CConnDlgIapPlugin* iPlugin;     
+        
+        RArray<TUint> iIAPIds;
+
+        // For base class, unused.
+        TInt iDummy;
+        
+        TBool iFromOkToExit; ///< closed the dialof from OkToExitL or not
+        
+        // Pointer for dialog expiration timer
+        CExpiryTimer* iExpiryTimer;
+    };
+
+
+#include "IapDialog.inl"
+
+#endif
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/cconndlg/inc/IapDialog.inl	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,40 @@
+/*
+* 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: 
+*      Inline method definitions of the class IAPDIALOG.
+*
+*
+*/
+
+
+
+#ifndef __IAPDIALOG_H__INL
+#define __IAPDIALOG_H__INL
+
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// void CIapDialog::GetOkToExit
+// ----------------------------------------------------------------------------
+//
+TBool CIapDialog::GetOkToExit()
+	{
+	return iFromOkToExit;
+	}
+        
+
+
+#endif // __IAPDIALOG_H__INL
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/cconndlg/inc/NewIapDialog.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,96 @@
+/*
+* Copyright (c) 2002 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 CNewIapDialog.
+*
+*/
+
+
+#ifndef __NEWIAPDIALOG_H__
+#define __NEWIAPDIALOG_H__
+
+
+// INCLUDES
+#include <e32base.h>
+#include <AknQueryDialog.h>
+#include <agentdialog.h>
+#include "ExpiryTimerCallback.h"
+
+// FORWARD DECLARATIONS
+class CConnDlgNewIapPlugin;
+class CExpiryTimer;
+
+// CLASS DECLARATIONS
+
+/**
+ * Class implementing New IAP warning dialog.
+ */
+NONSHARABLE_CLASS( CNewIapDialog ) : public CAknQueryDialog, public MExpiryTimerCallback
+    {
+    public:
+
+        /**
+        * Constructor the CNewIapDialog class
+        * @param aPlugin plugin pointer
+        * @param aConnect connect to the IAP
+        * @param aPrefs preferences infomation
+        * @return -
+        */
+        CNewIapDialog( CConnDlgNewIapPlugin* aPlugin, 
+                       TBool& aConnect,
+                       const TNewIapConnectionPrefs& aPrefs );
+
+    /**
+    * Destructor
+    */
+    virtual ~CNewIapDialog();
+
+        /**
+        * CBA handling function
+        * @param aButtonId button Uid
+        * @return TBool exit or no
+        */
+        virtual TBool OkToExitL( TInt aButtonId );
+        
+        /**
+        * Dialog expiration timeout callback
+        */
+        void HandleTimedOut();
+
+    private:
+        /**
+        * PreLayoutDynInitL function
+        * @param -
+        * @return -
+        */
+        void PreLayoutDynInitL();
+
+    private:
+        // Pointer to the plugin
+        CConnDlgNewIapPlugin* iPlugin;      
+
+        // Specifies way of closing of the dialog. ETrue when 'Yes' or 'Done'
+        // softkeys pressed.
+        TBool& iConnect;                    
+
+        // Selected preferences
+        const TNewIapConnectionPrefs& iPrefs;
+
+        // Pointer for dialog expiration timer
+        CExpiryTimer* iExpiryTimer;
+    };
+
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/cconndlg/inc/QosDialog.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2002 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 CQosDialog.
+*
+*/
+
+
+#ifndef __QOSDIALOG_H__
+#define __QOSDIALOG_H__
+
+
+// INCLUDES
+#include <e32base.h>
+#include <AknQueryDialog.h>
+#include "ExpiryTimerCallback.h"
+
+// FORWARD DECLARATIONS
+class CConnDlgQosPlugin;
+class CExpiryTimer;
+
+// CLASS DECLARATIONS
+
+/**
+ * Class implementing Quality of services dialog.
+ */
+NONSHARABLE_CLASS( CQosDialog ) : public CAknQueryDialog, public MExpiryTimerCallback
+    {
+    public:
+        /**
+        * Constructor the CQosDialog class
+        * @param aPlugin plugin pointer
+        * @param aBool reconnect to the Qos
+        * @return -
+        */
+        CQosDialog( CConnDlgQosPlugin* aPlugin, TBool& aBool );
+
+        /**
+        * Exit function the CQosDialog
+        * @param aButtonId plugin pointer
+        * @param aBool reconnect to the IAP
+        * @return TBool exit or no
+        */
+        virtual TBool OkToExitL( TInt aButtonId );
+        
+        /**
+        * Dialog expiration timeout callback
+        */
+        void HandleTimedOut();
+
+    /**
+    * Destructor
+    */
+    virtual ~CQosDialog();
+
+
+    private:
+        /**
+        * PreLayoutDynInitL
+        * @param    -
+        */
+        virtual void PreLayoutDynInitL();
+
+
+    private:
+        // Pointer to the plugin
+        CConnDlgQosPlugin* iPlugin;
+
+        // Specifies way of closing of the dialog. ETrue when 'Yes' or 'Done'
+        // softkeys pressed.
+        TBool& iBool;     
+
+        // Pointer for dialog expiration timer
+        CExpiryTimer* iExpiryTimer;
+        
+    };
+
+#endif  // __QOSDIALOG_H__
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/cconndlg/inc/ReconnectDialog.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2002 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 CReconnectDialog.
+*
+*/
+
+
+#ifndef __RECONNECTDIALOG_H__
+#define __RECONNECTDIALOG_H__
+
+// INCLUDES
+#include <e32base.h>
+#include <AknQueryDialog.h>
+#include "ExpiryTimerCallback.h"
+
+// FORWARD DECLARATIONS
+class CConnDlgReconnectPlugin;
+class CExpiryTimer;
+
+// CLASS DECLARATIONS
+
+/**
+ * Class implementing Reconnect dialog
+ */
+NONSHARABLE_CLASS( CReconnectDialog ) : public CAknQueryDialog, public MExpiryTimerCallback
+    {
+    public:
+        /**
+        * Constructor of the CReconnetDialog class
+        * @param aPlugin plugin pointer
+        * @param aBool reconnect to the IAP
+        * @return -
+        */
+        CReconnectDialog( CConnDlgReconnectPlugin* aPlugin, TBool& aBool );
+
+        /**
+        * Exit function the CReconnectDialog
+        * @param aButtonId plugin pointer
+        * @param aBool reconnect to the IAP
+        * @return TBool exit or no
+        */
+        virtual TBool OkToExitL( TInt aButtonId );
+        
+        /**
+        * Dialog expiration timeout callback
+        */
+        void HandleTimedOut();
+
+
+    /**
+    * Destructor
+    */
+    virtual ~CReconnectDialog();
+
+
+    private:
+        /**
+        * PreLayoutDynInitL
+        * @param    -
+        */
+        virtual void PreLayoutDynInitL();
+
+
+    private:
+        // Pointer to the plugin
+        CConnDlgReconnectPlugin* iPlugin;
+
+        // Specifies way of closing of the dialog. ETrue when 'Yes' or 'Done'
+        // softkeys pressed.
+        TBool& iBool;
+        
+        // Pointer for dialog expiration timer
+        CExpiryTimer* iExpiryTimer;
+    };
+
+#endif  // __RECONNECTDIALOG_H__
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/cconndlg/inc/SelectConnectionDialog.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,181 @@
+/*
+* Copyright (c) 2002 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 CSelectConnectionDialog.
+*
+*/
+
+
+#ifndef __SELECTCONNECTIONDIALOG_H__
+#define __SELECTCONNECTIONDIALOG_H__
+
+
+// INCLUDES
+#include <e32base.h>
+#include <aknlistquerydialog.h>
+#include "ExpiryTimerCallback.h"
+
+
+// FORWARD DECLARATION
+class CConnDlgSelectConnectionPlugin;
+class CConnectionInfoArray;
+class MEikSrvNotifierBase2;
+class CActiveSelectExplicit;
+class CExpiryTimer;
+
+// CLASS DECLARATION 
+/**
+ * Class implementing SelectConnection dialog
+ */
+NONSHARABLE_CLASS( CSelectConnectionDialog ) : public CAknListQueryDialog, public MExpiryTimerCallback
+    {
+    private:
+        /**
+        * CSelectConnectionDialog constructor
+        * @param aPlugin    plugin pointer
+        */
+        CSelectConnectionDialog( MEikSrvNotifierBase2* aPlugin, 
+                                 TInt aRefreshInterval,
+                                 TUint32 aBearerSet, 
+                                 TBool aIsWLANFeatureSupported, 
+                                 TUint aDefaultCMId );
+
+        /**
+        * Symbian default constructor.
+        */      
+        void ConstructL();
+
+
+    public:
+        /**
+        * NewL function
+        * @param aPlugin    plugin pointer
+        * return CSelectConnectionDialog*
+        */
+        static CSelectConnectionDialog* NewL( MEikSrvNotifierBase2* aPlugin,
+                                        TInt aRefreshInterval,
+                                        TUint32 aBearerSet, 
+                                        TBool aIsWLANFeatureSupported, 
+                                        TUint aDefaultCMId );
+
+        /**
+        * ~CSelectConnectionDialog destructor
+        */
+        ~CSelectConnectionDialog();
+
+        /**
+        * Exit function OF the CSelectConnectionDialog
+        * @param    aButtonId button exit id
+        * @return TBool exit or no
+        */
+        virtual TBool OkToExitL( TInt aButtonId );
+        
+        void PrepareAndRunLD( CConnectionInfoArray* aIAP, 
+                             CArrayPtr< CGulIcon >* aIcons,
+                             TBool aIsReallyRefreshing,
+                             const TInt aHighlightedItem );
+                             
+        /**
+        * Dialog refreshing
+        */
+        void RefreshDialogL( CConnectionInfoArray* aIAP, 
+                             CArrayPtr< CGulIcon >* aIcons,
+                             TBool aIsReallyRefreshing,
+                             const TInt aHighlightedItem );
+                             
+       /**
+        *
+        * @return The value of iFromOkToExit.
+        */
+        inline TBool GetOkToExit();          
+        
+        /**
+        * Dialog expiration timeout callback
+        */
+        void HandleTimedOut();
+
+        /**
+        * From CCoeControl  Handle key events. When a key event occurs, 
+        *                   CONE calls this function for each control on the control stack, 
+        *                   until one of them returns EKeyWasConsumed to indicate that it processed the key event.  
+        * @param aKeyEvent  The key event.
+        * @param aType      The type of the event: EEventKey, EEventKeyUp or EEventKeyDown.
+        * @return           Indicates whether or not the key event was used by this control.
+        */
+        TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, 
+                                     TEventCode aType );
+
+        TInt RunLD();
+
+        void SetElementIDL( TUint32 aIAPId );
+
+        void CompleteL( TInt aStatus );
+        
+        void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType);
+
+        void HandlePointerEventL(const TPointerEvent& aPointerEvent);
+
+    private:
+        /**
+        * PreLayoutDynInitL
+        * @param    -
+        */
+        virtual void PreLayoutDynInitL();
+
+        /**
+        * Initialize menu pane.
+        * @param aResourceId Menu pane resource id.
+        * @param CEikMenuPane Menu pane.
+        */
+        void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
+
+        void ProcessCommandL( TInt aCommand );
+
+
+    private:    // Data
+
+        // Pointer to the plugin, not owned
+        CConnDlgSelectConnectionPlugin* iPlugin;     
+        
+        RArray<TUint> iIapIDs;
+        RArray<TUint> iDestIDs;
+
+        // For base class, unused.
+        TInt iDummy;
+        
+        TBool iFromOkToExit; ///< closed the dialof from OkToExitL or not
+
+        CArrayPtr< CGulIcon >* iIcons;
+
+        // pointer to active object
+        CActiveSelectExplicit* iActiveSelectExplicit;
+        TInt iRefreshInterval;
+
+        // Selected preferences
+        TUint32 iBearerSet;
+
+        TBool iIsWLANFeatureSupported;
+
+        TUint iDefaultCMId;
+        
+        // Pointer for dialog expiration timer
+        CExpiryTimer* iExpiryTimer;
+    };
+
+
+#include "SelectConnectionDialog.inl"
+
+#endif
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/cconndlg/inc/SelectConnectionDialog.inl	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,40 @@
+/*
+* 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: 
+*      Inline method definitions of the class SelectConnectionDIALOG.
+*
+*
+*/
+
+
+
+#ifndef __SELECTCONNECTIONDIALOG_H__INL
+#define __SELECTCONNECTIONDIALOG_H__INL
+
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// void CSelectConnectionDialog::GetOkToExit
+// ----------------------------------------------------------------------------
+//
+TBool CSelectConnectionDialog::GetOkToExit()
+	{
+	return iFromOkToExit;
+	}
+        
+
+
+#endif // __SELECTCONNECTIONDIALOG_H__INL
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/cconndlg/inc/SelectExplicitDialog.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,133 @@
+/*
+* Copyright (c) 2002 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 CSelectExplicitDialog.
+*
+*/
+
+
+#ifndef __SELECTEXPLICITDIALOG_H__
+#define __SELECTEXPLICITDIALOG_H__
+
+
+// INCLUDES
+#include <e32base.h>
+#include <aknlistquerydialog.h>
+#include "ExpiryTimerCallback.h"
+
+// FORWARD DECLARATION
+class CConnectionInfoArray;
+class CSelectConnectionDialog;
+class CExpiryTimer;
+
+// CLASS DECLARATION 
+/**
+ * Class implementing SelectExplicit dialog
+ */
+NONSHARABLE_CLASS( CSelectExplicitDialog ) : public CAknListQueryDialog, public MExpiryTimerCallback
+    {
+    private:
+        /**
+        * CSelectExplicitDialog constructor
+        * @param aPlugin    plugin pointer
+        */
+        CSelectExplicitDialog( CSelectConnectionDialog* aCallerDialog );
+
+        
+        /**
+        * Symbian default constructor.
+        */      
+        void ConstructL();
+
+
+    public:
+        /**
+        * NewL function
+        * @param aPlugin    plugin pointer
+        * return CSelectExplicitDialog*
+        */
+        static CSelectExplicitDialog* NewL( 
+                                    CSelectConnectionDialog* aCallerDialog );
+
+
+        /**
+        * ~CSelectExplicitDialog destructor
+        */
+        ~CSelectExplicitDialog();
+
+        /**
+        * Exit function OF the CSelectExplicitDialog
+        * @param    aButtonId button exit id
+        * @return TBool exit or no
+        */
+        virtual TBool OkToExitL( TInt aButtonId );
+        
+        void PrepareAndRunLD( CConnectionInfoArray* aIAP, 
+                             CArrayPtr< CGulIcon >* aIcons,
+                             TBool aIsReallyRefreshing );
+                             
+        /**
+        * Dialog refreshing
+        */
+        void RefreshDialogL( CConnectionInfoArray* aIAP, 
+                             CArrayPtr< CGulIcon >* aIcons,
+                             TBool aIsReallyRefreshing );
+                             
+       /**
+        *
+        * @return The value of iFromOkToExit.
+        */
+        inline TBool GetOkToExit();
+        
+        TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, 
+                                     TEventCode aType);
+        
+        TBool NeedToDismissQueryL(const TKeyEvent& aKeyEvent);                                
+
+        /**
+        * Dialog expiration timeout callback
+        */
+        void HandleTimedOut();
+    private:
+        /**
+        * PreLayoutDynInitL
+        * @param    -
+        */
+        virtual void PreLayoutDynInitL();
+
+
+    private:    // Data
+
+        // Pointer to the plugin, not owned
+        CSelectConnectionDialog* iCallerDialog;
+
+        RArray<TUint> iIAPIds;
+
+        TBool iFromOkToExit; ///< closed the dialof from OkToExitL or not
+        
+        TInt iDummy;
+        
+        CArrayPtr< CGulIcon >* iIcons;
+        
+        // Pointer for dialog expiration timer
+        CExpiryTimer* iExpiryTimer;
+
+    };
+
+
+#include "SelectExplicitDialog.inl"
+
+#endif
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/cconndlg/inc/SelectExplicitDialog.inl	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,39 @@
+/*
+* 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: 
+*      Inline method definitions of the class SelectExplicitDialog.
+*
+*
+*/
+
+
+
+#ifndef __SELECTEXPLICITDIALOG__INL
+#define __SELECTEXPLICITDIALOG__INL
+
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// void CSelectExplicitDialog::GetOkToExit
+// ----------------------------------------------------------------------------
+//
+TBool CSelectExplicitDialog::GetOkToExit()
+	{
+	return iFromOkToExit;
+	}
+        
+
+#endif // __SELECTEXPLICITDIALOG__INL
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/cconndlg/inc/sortsnaputils.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2002 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 TSortSnapUtils 
+*
+*/
+
+
+
+#ifndef __SORTSNAPUTILS_H__
+#define __SORTSNAPUTILS_H__
+
+
+// INCLUDES
+#include <e32base.h>
+#include <cmmanagerext.h>
+#include <rmpm.h>
+
+
+// CLASS DECLARATION
+
+/**
+ * TSortSnapUtils class,
+ * utility class to use P&S mechanism to
+ * avoid circular reference with MPM
+ */     
+class TSortSnapUtils 
+    {
+    public:
+        enum TSortSnapUtilsState
+            {
+            EUninitialised = 0,
+            EUseMPM,
+            EUsePubSub
+            } ;
+
+        /**
+        * Constructor
+        */    
+        TSortSnapUtils( RMPM& aMPM );
+        
+        /**
+        * Destructor
+        */    
+        ~TSortSnapUtils();
+
+        void GetDestIdArrayL( RCmManagerExt& aCmManagerExt, RArray<TUint32>& aDestArray );     
+
+        /**
+        * GetSortSNAPDataL
+        * Gets snap data 
+        * Reads P&S values first, then uses MPM if
+        * unsuccessful. This is needed to avoid a deadlock situation
+        * with MPM.
+        * @param aSnapData - iSnap attribute of TMpmSnapPubSubFormat is the
+        * input parameter, iSortedIaps attribute holds the iap ids if 
+        * returned with KErrNone
+        */
+        TInt GetSortSnapData( TUint32 aSnapId, TMpmSnapBuffer& aSnapBuffer );  
+
+    private:
+        void InitDestIdArray();
+       
+    private:
+        TUint32 iSnapIdArray[KMPMSortSnapMaxKey]; 
+        TInt iSnapCount;
+        TSortSnapUtilsState iSSUState;
+        RMPM& iMPM; 
+    };     
+
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/cconndlg/loc/agentdialog.loc	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,171 @@
+/*
+* Copyright (c) 2002 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 a localisation file.
+*     A .loc file is the one and only place where the logical strings
+*     to be localised are defined.
+*
+*/
+
+
+//	Included localisation string resource headers
+
+//  LOCALISATION STRINGS
+
+//d:reconect dialog
+//l:popup_note_window
+//w:
+//r:1.0
+//
+#define qtn_ics_q_conn_lost_reconn "Network connection lost. Do you want to re-connect?"
+
+//d:iap list title
+//l:heading_pane_t1
+//w:
+//r:1.0
+//
+#define qtn_ics_ap_list_title "Select Access Point:"
+
+//d:new iap yes no dialog
+//l:popup_note_window
+//w:
+//r:1.0
+//
+#define qtn_ics_ap_connect_text "Attempt to connect to %U?"
+
+//d: username query string in agent dialog
+//l:popup_query_data_window
+//w:
+//r:1.0
+//
+#define qtn_ics_username_query_title "Enter username:"
+
+//d: password query string in agent dialog
+//l: popup_query_data_window
+//w:
+//r:1.0
+//
+#define qtn_ics_password_query_title "Enter password:"
+
+//d:Qos dialog
+//l:popup_note_window
+//w:
+//r:1.0
+//
+#define qtn_ics_q_conn_qos_reconn "The connection quality is lower than required.Do you wish to disconnect?"
+
+//d:New username query string in agent dialog
+//l:popup_query_data_window
+//w:
+//r:2.1
+//
+#define qtn_netw_iap_auth_username "Access point user name:"
+
+//d:New password query string in agent dialog
+//l:popup_query_data_window
+//w:
+//r:2.1
+//
+#define qtn_netw_iap_auth_password "Access point password:"
+
+//d:Special IAP to enable the search for surrounding WLAN networks
+//l:list_single_graphic_pane_t1_cp2
+//w:
+//r:3.0
+//
+#define qtn_wlan_search_for_networks    "Search for WLAN"
+
+//d: Wait note text during collection of access points
+//l: popup_note_wait_window
+//w:
+//r:3.0
+//
+#define qtn_netw_wait_checking_avail_conn "Checking available connections"
+
+
+//d:Connection selection title
+//l:heading_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_netw_conset_prmpt_select_connection     "Select connection:"
+
+//d:First item of Connection selection to enable the search for surrounding 
+//d:WLAN networks
+//l:list_double_large_graphic_pane_t1_cp2
+//w:
+//r:3.2
+//
+#define qtn_netw_conset_easy_wlan                   "Search WLAN"
+
+//d:Last item of Connection selection to see Connection Methods that are not 
+//d:included in destinations.
+//l:list_double_large_graphic_pane_t1_cp2
+//w:
+//r:3.2
+//
+#define qtn_netw_conset_dest_uncategorized          "Uncategorized"
+
+//d:Second line of last item of Connection selection. Singular version.
+//l:list_double_large_graphic_pane_t2_cp2
+//w:
+//r:3.2
+//
+#define qtn_netw_conset_conn_methods_amount_one     "1 connection method"
+
+//d:Second line of last item of Connection selection. It shows the number of 
+//d:available uncategorized connection methods.
+//l:list_double_large_graphic_pane_t2_cp2
+//w:
+//r:3.2
+//
+#define qtn_netw_conset_conn_methods_amount_many    "%N connection methods"
+
+//d:Text of menu item to select the currently selected destination.
+//l:list_single_pane_t1_cp2
+//w:
+//r:3.2
+//
+#define qtn_set_cmd_select                          "Select"
+
+//d:Text of menu item to let the user to select an explicit connection method
+//l:list_single_pane_t1_cp2
+//w:
+//r:3.2
+//
+#define qtn_netw_conset_options_select_method       "Choose connection method"
+
+//d:Title of Selecting an explicit connection method notifier
+//l:heading_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_netw_conset_prmpt_select_conn_method    "Select connection method:"
+
+//d:Softkey used to select an explicit connection method
+//l:control_pane_t1/opt7
+//w:
+//r:3.2
+//
+#define qtn_netw_conset_softkey_connect             "Connect"
+
+//d:Text of menu item to connect to the currently selected destination.
+//l:list_single_pane_t1_cp2
+//w:
+//r:3.2
+//
+#define qtn_set_cmd_connect                          "Connect"
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/cconndlg/src/ActiveBase.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,195 @@
+/*
+* Copyright (c) 2002 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 base CActive class with a timer
+*
+*/
+
+
+// INCLUDE FILES
+#include "ActiveBase.h"
+#include "ConnectionDialogsLogger.h"
+
+/*#include <FeatMgr.h>
+#include <StringLoader.h>
+#include <AknIconArray.h>
+#include <AknsUtils.h>
+#include <data_caging_path_literals.hrh>
+
+#include <cmdestinationext.h>
+#include <CmConnectionMethodDef.h>
+#include <cmpluginWlanDef.h>
+
+#include <cmmanager.mbg>
+#include <CConnDlgPlugin.rsg>
+*/
+
+
+
+///////////////////////////////////////////////////////////////////////////////
+
+// ---------------------------------------------------------
+// CActiveBase::CActiveBase()
+// ---------------------------------------------------------
+//
+CActiveBase::CActiveBase()
+: CActive( EPriorityUserInput )
+    {
+    }
+
+    
+// ---------------------------------------------------------
+// CActiveBase* CActiveBase::NewL()
+// ---------------------------------------------------------
+//
+CActiveBase* CActiveBase::NewL()
+    {
+    CLOG_ENTERFN( "CActiveBase::NewL " );  
+    
+    CActiveBase* self = new ( ELeave ) CActiveBase();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    
+    CLOG_LEAVEFN( "CActiveBase::NewL " );      
+
+    return self;        
+    }
+
+
+// ---------------------------------------------------------
+// CActiveBase::ConstructL()
+// ---------------------------------------------------------
+//
+void CActiveBase::ConstructL()
+    {
+    CActiveScheduler::Add( this );            
+    iPeriodic = CPeriodic::NewL( CActive::EPriorityStandard );
+    }
+
+
+// ---------------------------------------------------------
+// CActiveBase::~CActiveBase()
+// ---------------------------------------------------------
+//    
+CActiveBase::~CActiveBase()
+    {
+    Cancel();
+    }
+
+
+// ---------------------------------------------------------
+// CActiveBase::Cancel()
+// ---------------------------------------------------------
+// 
+void CActiveBase::Cancel()
+    {
+    StopTimer();
+    CActive::Cancel();
+    }
+
+
+// ---------------------------------------------------------
+// CActiveBase::DoCancel()
+// ---------------------------------------------------------
+// 
+void CActiveBase::DoCancel()
+    {
+    }
+
+    
+// ---------------------------------------------------------
+// CActiveBase::RunL()
+// ---------------------------------------------------------
+//     
+void CActiveBase::RunL()
+    {
+    }
+
+    
+// ---------------------------------------------------------
+// CActiveBase::StartTimerL
+// ---------------------------------------------------------
+//    
+void CActiveBase::StartTimerL( TInt aTickInterval )
+    {    
+    CLOG_ENTERFN( "CActiveBase::StartTimerL " );
+    
+    if( !iPeriodic )
+        {
+        iPeriodic = CPeriodic::NewL( CActive::EPriorityStandard ); 
+        }
+        
+    iPeriodic->Start( aTickInterval, aTickInterval, TCallBack( Tick, this ) );
+    
+    CLOG_LEAVEFN( "CActiveBase::StartTimerL " );
+    }
+
+
+// ---------------------------------------------------------
+// CActiveBase::StopTimer
+// ---------------------------------------------------------
+//
+void CActiveBase::StopTimer()
+    {
+    CLOG_ENTERFN( "CActiveBase::StopTimer " );  
+    
+    if( iPeriodic )
+        {
+        CLOG_WRITE( "iPeriodic" );
+        iPeriodic->Cancel();
+        CLOG_WRITE( "Cancel" );
+        
+        delete iPeriodic;
+        CLOG_WRITE( "delete" );
+        
+        iPeriodic = NULL;
+        }        
+    
+    CLOG_LEAVEFN( "CActiveBase::StopTimer " );
+    }
+
+    
+// ---------------------------------------------------------
+// CActiveBase::Tick
+// ---------------------------------------------------------
+//
+TInt CActiveBase::Tick( TAny* aObject )
+    {
+    CLOG_ENTERFN( "CActiveBase::Tick " );  
+    
+    CActiveBase* myself = static_cast<CActiveBase*>( aObject );
+
+    if ( myself->iStatus == KErrCancel )
+        {
+        CLOG_WRITE( "iStatus == KErrCancel" );        
+        myself->StopTimer();            
+        }
+    else
+        {
+        CLOG_WRITE( "iStatus != KErrCancel" );    
+                                                              
+        myself->SetActive();
+        myself->iClientStatus = &( myself->iStatus );  
+        *( myself->iClientStatus ) = KRequestPending;  
+
+        User::RequestComplete( myself->iClientStatus, KErrNone );         
+        }
+    
+    CLOG_LEAVEFN( "CActiveBase::Tick " );      
+    
+    return 1;
+    }        
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/cconndlg/src/ActiveIapPlugin.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,238 @@
+/*
+* Copyright (c) 2002 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 plugins (base & all derived).
+*
+*/
+
+
+// INCLUDE FILES
+#include "ActiveIapPlugin.h"
+#include "IAPDialog.h"
+#include "ConnectionInfo.h"
+#include "ConnectionInfoArray.h"
+#include "CConnDlgPrivateCRKeys.h"
+#include "ConnectionDialogsLogger.h"
+
+#include <commdb.h>
+#include <StringLoader.h>
+#include <wlanmgmtcommon.h>
+#ifndef __WINS__
+#include <wlanmgmtclient.h>
+#endif
+#include <AknWaitDialog.h>
+
+#include <CConnDlgPlugin.rsg>
+
+
+// CONSTANTS
+
+// Panic string
+#if defined(_DEBUG)
+_LIT( KErrNullPointer, "NULL pointer" );
+#endif
+
+
+///////////////////////////////////////////////////////////////////////////////
+
+// ---------------------------------------------------------
+// CActiveCConnDlgIapPlugin::CActiveCConnDlgIapPlugin()
+// ---------------------------------------------------------
+//
+CActiveCConnDlgIapPlugin::CActiveCConnDlgIapPlugin( 
+                                            CConnDlgIapPlugin* aPlugin,
+                                            const TConnectionPrefs& aPrefs )
+: CActiveIAPListing( aPrefs ),
+  iPlugin( aPlugin ), 
+  isDialogDeleting( EFalse )
+    {
+    }
+
+    
+// ---------------------------------------------------------
+// CActiveCConnDlgIapPlugin* CActiveCConnDlgIapPlugin::NewL()
+// ---------------------------------------------------------
+//
+CActiveCConnDlgIapPlugin* CActiveCConnDlgIapPlugin::NewL( 
+                                              CConnDlgIapPlugin* aPlugin,              
+                                              const TConnectionPrefs& aPrefs )
+    {
+    CLOG_ENTERFN( "CActiveCConnDlgIapPlugin::NewL " );  
+    
+    CActiveCConnDlgIapPlugin* self = 
+                         new ( ELeave ) CActiveCConnDlgIapPlugin( aPlugin,                                                                  
+                                                                  aPrefs );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    
+    CLOG_LEAVEFN( "CActiveCConnDlgIapPlugin::NewL " );      
+
+    return self;        
+    }
+
+
+// ---------------------------------------------------------
+// CActiveCConnDlgIapPlugin::ConstructL()
+// ---------------------------------------------------------
+//
+void CActiveCConnDlgIapPlugin::ConstructL()
+    {
+    BaseConstructL();
+    }
+
+// ---------------------------------------------------------
+// CActiveCConnDlgIapPlugin::~CActiveCConnDlgIapPlugin()
+// ---------------------------------------------------------
+//    
+CActiveCConnDlgIapPlugin::~CActiveCConnDlgIapPlugin()
+    {
+    CLOG_ENTERFN( "CActiveCConnDlgIapPlugin::~CActiveCConnDlgIapPlugin" );      
+
+    Cancel();
+
+    CLOG_LEAVEFN( "CActiveCConnDlgIapPlugin::~CActiveCConnDlgIapPlugin" );      
+    }
+
+
+// ---------------------------------------------------------
+// CActiveCConnDlgIapPlugin::Cancel()
+// ---------------------------------------------------------
+// 
+void CActiveCConnDlgIapPlugin::Cancel()
+    {
+    CLOG_ENTERFN( "CActiveCConnDlgIapPlugin::Cancel" );      
+
+    CActiveIAPListing::Cancel();
+
+    CLOG_WRITE( "Returned from CActiveIAPListing::Cancel" );
+
+    if( iDialog  && !( iDialog->GetOkToExit() ) )
+        {
+        CLOG_WRITEF( _L( "iDialog->GetOkToExit() : %b" ), iDialog->GetOkToExit() );
+        delete iDialog;
+        iDialog = NULL;
+        }
+
+    CLOG_LEAVEFN( "CActiveCConnDlgIapPlugin::Cancel" );      
+    }
+
+
+// ---------------------------------------------------------
+// CActiveCConnDlgIapPlugin::DoCancel()
+// ---------------------------------------------------------
+// 
+void CActiveCConnDlgIapPlugin::DoCancel()
+    {
+    CLOG_ENTERFN( "CActiveCConnDlgIapPlugin::DoCancel " );  
+    
+    if( isDialogDeleting )
+        {
+        CLOG_WRITE( "isDialogDeleting" );
+        
+        delete iDialog;
+        iDialog = NULL;   
+        
+        isDialogDeleting = EFalse;         
+        }
+        
+    CLOG_LEAVEFN( "CActiveCConnDlgIapPlugin::DoCancel " );          
+    }
+
+    
+// ---------------------------------------------------------
+// CActiveCConnDlgIapPlugin::RunL()
+// ---------------------------------------------------------
+//     
+void CActiveCConnDlgIapPlugin::RunL()
+    {
+    CLOG_ENTERFN( "CActiveCConnDlgIapPlugin::RunL " );  
+    
+    CLOG_WRITEF( _L( "iStatus.Int() : %d" ), iStatus.Int() );
+    CLOG_WRITEF( _L( "&iStatus : %d" ), &iStatus );
+    
+    if( iStatus == KErrNone )
+        {
+        
+        if( iIAPs ) // if iIAPs has been created
+            {            
+            // merge arrays and sort
+            MergeArraysL( R_WLAN_SEARCH_FOR_NETWORKS );
+            
+            if ( iDialog )  // if dialog has been created
+                {
+                iDialog->RefreshDialogL( iActIAPs, ETrue );
+                }
+            else
+                {
+                TInt interval = 0;
+                if ( iIsWLANFeatureSupported )
+                    {                                    
+                    interval = GetRefreshInterval(); 
+                    CLOG_WRITEF( _L( "interval : %d" ),  interval );
+
+                    if ( iWaitDialog )
+                        {
+                        iWaitDialog->ProcessFinishedL();     
+                        delete iWaitDialog;
+                        iWaitDialog = NULL;    
+                        }
+                    }
+
+                iDialog = CIapDialog::NewL( iPlugin );
+                iDialog->PrepareLC( R_LIST_QUERY );
+                iDialog->RefreshDialogL( iActIAPs, EFalse );
+                iDialog->RunLD();
+
+                if ( iIsWLANFeatureSupported )
+                    {                                           
+                    if( interval )
+                        {
+                        StartTimerL( interval );
+                        }     
+                    }
+                }   // else
+            } // if iIAPs
+        else
+            {            
+            CreateArraysL( R_WLAN_SEARCH_FOR_NETWORKS, EFalse, 0 );
+            }            
+        }     
+    
+    CLOG_LEAVEFN( "CActiveCConnDlgIapPlugin::RunL " );      
+        
+    }
+
+    
+// ---------------------------------------------------------
+// CActiveCConnDlgIapPlugin::StartSearchIAPsL()
+// ---------------------------------------------------------
+//    
+void CActiveCConnDlgIapPlugin::StartSearchIAPsL()
+    {    
+    CActiveIAPListing::BaseStartSearchIAPsL( R_SEARCHING_WAIT_NOTE );
+    }
+   
+ 
+// ---------------------------------------------------------
+// CActiveCConnDlgIapPlugin::GetRefreshInterval()
+// ---------------------------------------------------------
+//    
+TInt CActiveCConnDlgIapPlugin::GetRefreshInterval()
+    {
+    return CActiveIAPListing::GetRefreshInterval( KCRUidCConnDlg,
+                                                  KCConnDlgScanInterval );
+    }
+            
+   
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/cconndlg/src/ActiveSelectConnectionPlugin.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,819 @@
+/*
+* Copyright (c) 2002 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 plugins (base & all derived).
+*
+*/
+
+
+// INCLUDE FILES
+#include "ActiveSelectConnectionPlugin.h"
+#include "SelectConnectionDialog.h"
+#include "ConnectionDialogsLogger.h"
+#include "ConnectionInfo.h"
+#include "ConnectionInfoArray.h"
+#include "sortsnaputils.h"
+#include "cdbcols.h"
+
+#include <featmgr.h>
+#include <StringLoader.h>
+#include <AknIconArray.h>
+#include <AknsUtils.h>
+#include <AknIconUtils.h>
+#include <data_caging_path_literals.hrh>
+
+#include <cmdestinationext.h>
+#include <cmconnectionmethoddef.h>
+#include <cmpluginwlandef.h>
+
+#include <cmmanager.mbg>
+#include <CConnDlgPlugin.rsg>
+#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include <commsdat.h>
+#else
+#include <commsdat.h>
+#include <commsdat_partner.h>
+#endif
+
+#include <wlancontainer.h>
+#include <metadatabase.h>
+
+// CONSTANTS
+
+// Category for all panics in this module
+_LIT( KASCPCategory, "Select Connection Plugin" );
+
+LOCAL_D const TInt KIconsGranularity = 4;
+LOCAL_D const TInt KArrayGranularity = 4;
+LOCAL_D const TInt KMaxEntryLength = CommsDat::KMaxTextLength*2 + 20;
+/**
+* For iPeriodic Timer, 60 seconds
+*/
+LOCAL_C const TInt KTickDefaultInterval = 60000000;
+LOCAL_C const TInt KMicrosecondsToSecondsMultiplier = 1000000;
+
+// background scan automatic scanning value
+static const TUint KWlanBgScanIntervalAuto = 0xffffffff;
+
+using namespace CMManager;
+
+
+///////////////////////////////////////////////////////////////////////////////
+
+// ---------------------------------------------------------
+// CActiveSelectConnectionPlugin::CActiveSelectConnectionPlugin()
+// ---------------------------------------------------------
+//
+CActiveSelectConnectionPlugin::CActiveSelectConnectionPlugin( 
+                                                MEikSrvNotifierBase2* aPlugin,
+                                                const TUint32 aElementId,
+                                                TUint32 aBearerSet )
+: iBearerSet( aBearerSet ),
+  iReqBearerSet( aBearerSet ),
+  iElementId( aElementId ),
+  iPlugin( aPlugin ), 
+  iDialogConn( NULL ),
+  iIsWLANFeatureSupported( EFalse ),
+  iRefreshInterval( KTickDefaultInterval ),
+  iHighlightedItem( -1 ),
+  iDefaultDestId( 0 ),
+  iDefaultCMId( 0 )
+    {
+    }
+
+    
+// ---------------------------------------------------------
+// CActiveSelectConnectionPlugin* CActiveSelectConnectionPlugin::NewL()
+// ---------------------------------------------------------
+//
+CActiveSelectConnectionPlugin* CActiveSelectConnectionPlugin::NewL( 
+                                                MEikSrvNotifierBase2* aPlugin,
+                                                const TUint32 aElementId,
+                                                TUint32 aBearerSet )
+    {
+    CLOG_ENTERFN( "CActiveSelectConnectionPlugin::NewL " );  
+    
+    CActiveSelectConnectionPlugin* self = new ( ELeave ) 
+                CActiveSelectConnectionPlugin( aPlugin, aElementId, 
+                                               aBearerSet );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    
+    CLOG_LEAVEFN( "CActiveSelectConnectionPlugin::NewL " );      
+
+    return self;        
+    }
+
+
+// ---------------------------------------------------------
+// CActiveSelectConnectionPlugin::ConstructL()
+// ---------------------------------------------------------
+//
+void CActiveSelectConnectionPlugin::ConstructL()
+    {
+    CLOG_ENTERFN( "CActiveSelectConnectionPlugin::ConstructL " );  
+
+    CActiveBase::ConstructL();
+    
+    FeatureManager::InitializeLibL();
+
+    iIsWLANFeatureSupported = FeatureManager::FeatureSupported( 
+                                                KFeatureIdProtocolWlan );
+
+    FeatureManager::UnInitializeLib();
+    
+    iBearerSet |= ECommDbBearerVirtual;    // To get also VPN APs
+
+#ifdef __WINS__
+    iBearerSet |= ECommDbBearerLAN;     // To add Ethernet AP
+#endif  // __WINS__
+
+    if ( iIsWLANFeatureSupported )
+        {
+        CLOG_WRITE( "WLAN Supported!" );        
+        iBearerSet |= ECommDbBearerWLAN; // To add WLan AP
+        iRefreshInterval = GetRefreshIntervalL();
+        }
+
+
+
+    iItems = new( ELeave ) CConnectionInfoArray();
+    iIcons = new( ELeave ) CAknIconArray( KIconsGranularity );
+
+    iCmManagerExt.OpenL();
+
+    TInt ret = iMPM.LaunchServer();
+    if ( ret != KErrAlreadyExists )
+        {
+        User::LeaveIfError( ret );
+        }
+    CLOG_LEAVEFN( "CActiveSelectConnectionPlugin::ConstructL " );  
+    }
+
+
+// ---------------------------------------------------------
+// CActiveSelectConnectionPlugin::~CActiveSelectConnectionPlugin()
+// ---------------------------------------------------------
+//    
+CActiveSelectConnectionPlugin::~CActiveSelectConnectionPlugin()
+    {
+    CLOG_ENTERFN( "~CActiveSelectConnectionPlugin" );
+    Cancel();
+    
+    if ( iItems )
+        {
+        iItems->ResetAndDestroy();
+        }
+    delete iItems;    
+    iItems = NULL;
+
+    iCmManagerExt.Close();
+    iMPM.Close();
+
+    CLOG_LEAVEFN( "~CActiveSelectConnectionPlugin" );
+    }
+
+
+// ---------------------------------------------------------
+// CActiveSelectConnectionPlugin::Cancel()
+// ---------------------------------------------------------
+// 
+void CActiveSelectConnectionPlugin::Cancel()
+    {
+    StopTimer();
+    CActive::Cancel();
+
+    if( iDialogConn && !( iDialogConn->GetOkToExit() ) )
+        {
+        CLOG_WRITEF( _L( "iDialogConn->GetOkToExit() : %b" ), iDialogConn->GetOkToExit() );
+        delete iDialogConn;
+        iDialogConn = NULL;
+        }
+    }
+
+
+// ---------------------------------------------------------
+// CActiveSelectConnectionPlugin::DoCancel()
+// ---------------------------------------------------------
+// 
+void CActiveSelectConnectionPlugin::DoCancel()
+    {
+    }
+
+    
+// ---------------------------------------------------------
+// CActiveSelectConnectionPlugin::RunL()
+// ---------------------------------------------------------
+//     
+void CActiveSelectConnectionPlugin::RunL()
+    {
+    CLOG_ENTERFN( "CActiveSelectConnectionPlugin::RunL " );  
+    
+    if( iStatus == KErrNone )
+        {
+        BuildConnectionListL();
+        iDialogConn->RefreshDialogL( iItems, iIcons, ETrue, iHighlightedItem );
+        }     
+    
+    CLOG_LEAVEFN( "CActiveSelectConnectionPlugin::RunL " );      
+    }
+
+    
+// ---------------------------------------------------------
+// CActiveSelectConnectionPlugin::ShowSelectConnectionL()
+// ---------------------------------------------------------
+//    
+void CActiveSelectConnectionPlugin::ShowSelectConnectionL()
+    {    
+    CLOG_ENTERFN( "CActiveSelectConnectionPlugin::ShowSelectConnectionL" );
+    
+    BuildConnectionListL();
+
+    iDialogConn = CSelectConnectionDialog::NewL( iPlugin, iRefreshInterval,
+                                                 iBearerSet, 
+                                                 iIsWLANFeatureSupported, 
+                                                 iDefaultCMId );
+
+    iDialogConn->PrepareAndRunLD( iItems, iIcons, EFalse, iHighlightedItem );
+
+    if( iRefreshInterval )
+        {
+        StartTimerL( iRefreshInterval );
+        }     
+
+    CLOG_LEAVEFN( "CActiveSelectConnectionPlugin::ShowSelectConnectionL" );
+    }
+ 
+  
+// ---------------------------------------------------------
+// CActiveSelectConnectionPlugin::BuildConnectionListL()
+// ---------------------------------------------------------
+//
+void CActiveSelectConnectionPlugin::BuildConnectionListL()
+    {
+    CLOG_ENTERFN( "CActiveSelectConnectionPlugin::BuildConnectionListL " );  
+    
+    // iItems and iIcons are allocated at construction and deallocated at 
+    // destruction. Unless memory allocation has failed, they cannot be NULL.
+    __ASSERT_ALWAYS( iItems, User::Panic( KASCPCategory, KErrGeneral ) );
+    __ASSERT_ALWAYS( iIcons, User::Panic( KASCPCategory, KErrGeneral ) );
+    
+    iItems->ResetAndDestroy();
+    iIcons->ResetAndDestroy();
+
+    _LIT( KDriveZ, "z:" );  // ROM folder
+    // Name of the MBM file containing icons
+    _LIT( KManagerIconFilename, "cmmanager.mbm" );
+
+    TFileName iconsFileName;
+
+    iconsFileName.Append( KDriveZ );
+    iconsFileName.Append( KDC_APP_BITMAP_DIR );
+    iconsFileName.Append( KManagerIconFilename );
+
+//    iIcons->AppendL( AknsUtils::CreateGulIconL( AknsUtils::SkinInstance(),
+//                                KAknsIIDQgnIndiCbHotAdd,
+//                                iconsFileName, 
+//                                EMbmCmmanagerQgn_indi_cb_hot_add, 
+//                                EMbmCmmanagerQgn_indi_cb_hot_add_mask ) );
+
+    // Create color icon for marking the default connection
+    //
+    CFbsBitmap* bitmap = NULL;
+    CFbsBitmap* mask   = NULL;               
+    CGulIcon* icon     = CGulIcon::NewLC();
+    
+    AknsUtils::CreateColorIconL( AknsUtils::SkinInstance(), 
+                    KAknsIIDQgnIndiCbHotAdd, 
+                    KAknsIIDQsnIconColors, EAknsCIQsnIconColorsCG13, 
+                    bitmap, 
+                    mask, 
+                    iconsFileName,
+                    EMbmCmmanagerQgn_indi_cb_hot_add, 
+                    EMbmCmmanagerQgn_indi_cb_hot_add_mask,
+                    KRgbBlack );
+
+    icon->SetBitmap( bitmap );
+    icon->SetMask( mask );    
+    iIcons->AppendL( icon );
+                
+    CleanupStack::Pop( icon ); 
+
+    TCmDefConnValue defaultConnSetting;
+
+    iCmManagerExt.ReadDefConnL( defaultConnSetting );
+    if ( defaultConnSetting.iType == ECmDefConnDestination )
+        {
+        iDefaultDestId = defaultConnSetting.iId;
+        }
+    else if ( defaultConnSetting.iType == ECmDefConnConnectionMethod )
+        {
+        iDefaultCMId = defaultConnSetting.iId;
+        }
+
+    if ( iIsWLANFeatureSupported && (iReqBearerSet & ECommDbBearerWLAN) )
+        {
+        AddSearchForWLanItemL();
+        }
+
+    AddDestinationItemsL();
+
+    CLOG_WRITEF( _L( "iItems count: %d" ), iItems->Count() );
+    CLOG_LEAVEFN( "CActiveSelectConnectionPlugin::BuildConnectionListL " );
+    }
+
+
+// ---------------------------------------------------------
+// CActiveSelectConnectionPlugin::AddSearchForWLanItemL
+// ---------------------------------------------------------
+//    
+void CActiveSelectConnectionPlugin::AddSearchForWLanItemL()
+    {
+    TUint32 easyWlanId = iCmManagerExt.EasyWlanIdL();
+    if ( easyWlanId )
+        {
+        CLOG_WRITEF( _L( "easyWlanId %d" ), easyWlanId );
+
+        RCmConnectionMethodExt cmConnMethodExt;
+        TRAPD( err, cmConnMethodExt = iCmManagerExt.ConnectionMethodL( 
+                                                                easyWlanId ) );
+        if ( err == KErrNone )
+            {
+            CleanupClosePushL( cmConnMethodExt );
+
+            CGulIcon* wlanIcon = ( CGulIcon* )
+                            cmConnMethodExt.GetIntAttributeL( ECmBearerIcon );
+            CleanupStack::PopAndDestroy();  // cmConnMethodExt
+
+            if ( wlanIcon )
+                {
+                CleanupStack::PushL( wlanIcon );
+                iIcons->AppendL( wlanIcon );
+
+                // icon array took over ownership
+                CleanupStack::Pop( wlanIcon );
+
+                // +1 because it "Zero terminates" the string
+                TBuf<CommsDat::KMaxTextLength+1> nameSearch;
+                _LIT( KIconIdNameEmpty, "%d\t%s\t" );
+
+                HBufC *msg = StringLoader::LoadL( R_WLAN_EASY_WLAN );
+                nameSearch = *msg;
+                nameSearch.ZeroTerminate();
+                delete msg;
+
+                TBuf<KMaxEntryLength> temp;
+                temp.FillZ( KMaxEntryLength );
+                temp.Format( KIconIdNameEmpty, iIcons->Count()-1,
+                             nameSearch.Ptr() );
+
+                CConnectionInfo* conIn = CConnectionInfo::NewL( easyWlanId, 
+                                                    0, temp );
+                CleanupStack::PushL( conIn );
+                iItems->AppendL( conIn );
+                CleanupStack::Pop( conIn );
+                iHighlightedItem = 0;
+                }
+            }
+        }
+    }
+        
+// ---------------------------------------------------------
+// CActiveSelectConnectionPlugin::AddDestinationItemsL
+// ---------------------------------------------------------
+//    
+void CActiveSelectConnectionPlugin::AddDestinationItemsL()
+    {
+ /*   TInt errConnect = iMPM.Connect();
+    CLOG_WRITEF( _L( "errConnect = %d" ), errConnect );
+    if ( errConnect == KErrNone )
+        {*/
+        TSortSnapUtils sortSnapUtils( iMPM );
+        RArray<TUint32> destIdArray( KArrayGranularity );
+        TRAPD( err, sortSnapUtils.GetDestIdArrayL( iCmManagerExt, destIdArray ) );
+        //TRAPD( err, iCmManagerExt.AllDestinationsL( destIdArray ) );
+        // Append the destinations to the list
+        CLOG_WRITEF( _L( "GetDestIdArrayL returned with  %d" ), err );
+    if ( err == KErrNone )
+            {
+            CleanupClosePushL( destIdArray );
+
+            CLOG_WRITEF( _L( "destIdArray.Count() =  %d" ), destIdArray.Count() );
+            for ( TInt i = 0; i < destIdArray.Count(); i++ )
+                {
+                RCmDestinationExt cmDestExt = iCmManagerExt.DestinationL( 
+                                                            destIdArray[i] );
+                CleanupClosePushL( cmDestExt );
+                if ( /*cmDestExt.ElementId() != iElementId &&*/ 
+                     !cmDestExt.MetadataL( ESnapMetadataHiddenAgent ) )
+                    {
+                    CLOG_WRITEF( _L( "Destination id %d, Total number of methods %d" ), 
+                                destIdArray[i], cmDestExt.ConnectionMethodCount() );
+
+#ifdef _DEBUG
+                    for ( TInt j = 0; 
+                            j < cmDestExt.ConnectionMethodCount(); j++ )
+                        {
+                        RCmConnectionMethodExt cmConnMethodExt;
+                        TRAP( err, cmConnMethodExt = 
+                                            cmDestExt.ConnectionMethodL( j ) );
+                        if ( err == KErrNone )
+                            {
+                            CleanupClosePushL( cmConnMethodExt );
+                            HBufC* bufMethod = 
+                                cmConnMethodExt.GetStringAttributeL( ECmName );
+                            CleanupStack::PushL( bufMethod );
+                            TBuf<CommsDat::KMaxTextLength+1> nameMethod;
+                            nameMethod = *bufMethod;
+                            nameMethod.ZeroTerminate();
+
+                            /*CLOG_WRITEF( _L( "ConnMethod id %d, Method name %s" ), 
+                                cmConnMethodExt.GetIntAttributeL( ECmIapId ),
+                                nameMethod.Ptr() );*/
+
+                            CleanupStack::PopAndDestroy( bufMethod );
+                            CleanupStack::PopAndDestroy();  // cmConnMethodExt
+                            }
+                        }
+#endif
+
+                        AddDestinationItemL( cmDestExt, destIdArray[i], i == 0,
+                                             destIdArray[i] == iDefaultDestId,
+                                             sortSnapUtils );
+                    }
+                CleanupStack::PopAndDestroy();  // cmDestExt
+                }
+            CleanupStack::PopAndDestroy(); // destIdArray
+            }
+        AddUncategorizedItemL( sortSnapUtils );
+/*        }*/
+    }
+
+
+// ---------------------------------------------------------
+// CActiveSelectConnectionPlugin::AddDestinationItemL
+// ---------------------------------------------------------
+//    
+void CActiveSelectConnectionPlugin::AddDestinationItemL( 
+                                                RCmDestinationExt aDestination,
+                                                TUint32 aDestId, 
+                                                TBool aFirstItem, 
+                                                TBool aDefaultDest,
+                                                TSortSnapUtils& aSortSnapUtils )
+    {
+    TMpmSnapBuffer list;
+
+    TInt errMPM = aSortSnapUtils.GetSortSnapData( aDestId, list );
+    CLOG_WRITEF( _L( "errMPM = %d. list.Count() = %d" ), errMPM, list.Count() );
+
+    if ( errMPM == KErrNone )
+        {
+        for ( TInt numCM = 0; numCM < list.Count(); numCM++ )
+            {
+            RCmConnectionMethodExt cmConnMethodExt;
+            TRAPD( err, cmConnMethodExt = iCmManagerExt.ConnectionMethodL(
+                                                        list.iIapId[numCM] ) );
+
+            CLOG_WRITEF( _L( "Trapped err = %d" ), err );
+
+            if ( err == KErrNone )
+                {
+                CleanupClosePushL( cmConnMethodExt );
+                if ( iBearerSet & cmConnMethodExt.GetIntAttributeL( 
+                                                    ECmCommsDBBearerType ) )
+                    {
+                    HBufC* bufBest = cmConnMethodExt.GetStringAttributeL(
+                                                                    ECmName );
+
+                    CleanupStack::PopAndDestroy();      // cmConnMethodExt
+                    CleanupStack::PushL( bufBest );
+
+                    _LIT( KIconIdNameBest, "%d\t%s\t\"%s\"" );
+                    _LIT( KIconIdNameBestDefaultConn, "%d\t%s\t\"%s\"\t0" );
+
+                    TBuf<CommsDat::KMaxTextLength+1> nameBest;
+                    nameBest = *bufBest;
+                    nameBest.ZeroTerminate();
+                    CleanupStack::PopAndDestroy( bufBest );
+
+                    TBuf<CommsDat::KMaxTextLength+1> nameDest;
+                    HBufC* name = aDestination.NameLC();
+                    nameDest = *name;
+                    nameDest.ZeroTerminate();
+                    CleanupStack::PopAndDestroy( name );
+
+                    CGulIcon* destIcon = aDestination.IconL();
+                    if ( destIcon )
+                        {
+                        CleanupStack::PushL( destIcon );
+                        iIcons->AppendL( destIcon );
+
+                        // icon array took over ownership
+                        CleanupStack::Pop( destIcon );
+                    
+                        TBuf<KMaxEntryLength> temp;
+                        temp.FillZ( KMaxEntryLength );
+                        if ( aDefaultDest )
+                            {
+                            temp.Format( KIconIdNameBestDefaultConn, 
+                                         iIcons->Count()-1,
+                                         nameDest.Ptr(), nameBest.Ptr() );
+                            }
+                        else
+                            {
+                            temp.Format( KIconIdNameBest, 
+                                         iIcons->Count()-1,
+                                         nameDest.Ptr(), nameBest.Ptr() );
+                            }
+
+                        CConnectionInfo* conIn = 
+                            CConnectionInfo::NewL( 0, aDestId, temp );
+                        CleanupStack::PushL( conIn );
+                        iItems->AppendL( conIn );
+                        CleanupStack::Pop( conIn );
+
+                        if ( aFirstItem || 
+                             aDestination.MetadataL( ESnapMetadataHighlight ) )
+                            {   // It sets the highlight to the
+                                // first Destination (Internet),
+                                // but if it finds another with
+                                // the bit set, then it changes
+                            iHighlightedItem = iItems->Count()-1;
+                            }
+                        }
+
+                    numCM = list.Count();   // break;
+                    }
+				else
+					{
+                    CleanupStack::PopAndDestroy();  // cmConnMethodExt
+					}
+                }
+            }
+        }
+    }
+
+
+// ---------------------------------------------------------
+// CActiveSelectConnectionPlugin::AddUncategorizedItemL
+// ---------------------------------------------------------
+//    
+void CActiveSelectConnectionPlugin::AddUncategorizedItemL(TSortSnapUtils& aSortSnapUtils )
+    {
+    TMpmSnapBuffer list;
+
+    TInt errMPM = aSortSnapUtils.GetSortSnapData( 0, list );
+    CLOG_WRITEF( _L( "Uncategorized: errMPM = %d. list.Count() = %d" ), errMPM, list.Count() );
+
+    if ( errMPM == KErrNone )
+        {
+        TUint numOfUncatToBeListed = 0;
+
+        for ( TInt numCM = 0; numCM < list.Count(); numCM++ )
+            {
+            RCmConnectionMethodExt cmConnMethodExt;
+            TRAPD( err, cmConnMethodExt = iCmManagerExt.ConnectionMethodL(
+                                                        list.iIapId[numCM] ) );
+            if ( err == KErrNone )
+                {
+                CleanupClosePushL( cmConnMethodExt );
+                if ( iBearerSet & cmConnMethodExt.GetIntAttributeL( 
+                                                    ECmCommsDBBearerType ) )
+                    {
+                    numOfUncatToBeListed++;
+                    }
+                CleanupStack::PopAndDestroy();  // cmConnMethodExt
+                }
+            }
+
+        if ( ( iBearerSet & ECommDbBearerWLAN ) && iIsWLANFeatureSupported )
+            {
+            numOfUncatToBeListed += CountAdhocWlanIapsL();	
+            }
+            
+        if ( numOfUncatToBeListed > 0 )
+            {
+            CGulIcon* uncatIcon = 
+                            ( CGulIcon* )iCmManagerExt.UncategorizedIconL();
+            if ( uncatIcon )
+                {
+                CleanupStack::PushL( uncatIcon );
+                iIcons->AppendL( uncatIcon );
+                CleanupStack::Pop( uncatIcon );  // icon array took over ownership
+
+                // +1 because it "Zero terminates" the string
+                TBuf<CommsDat::KMaxTextLength+1> nameUncat;
+                TBuf<CommsDat::KMaxTextLength+1> numUncat;
+
+                HBufC *bufUncat = StringLoader::LoadL( R_LIST_UNCATEGORIZED );
+                nameUncat = *bufUncat;
+                nameUncat.ZeroTerminate();
+                delete bufUncat;
+
+                HBufC *bufNumOfUncat;
+                if ( numOfUncatToBeListed == 1 )
+                    {
+                    bufNumOfUncat = StringLoader::LoadL( R_CONN_METHODS_ONE );
+                    }
+                else
+                    {
+                    bufNumOfUncat = StringLoader::LoadL( R_CONN_METHODS_MANY, 
+                                                        numOfUncatToBeListed );
+                    }
+
+                numUncat = *bufNumOfUncat;
+                numUncat.ZeroTerminate();
+                delete bufNumOfUncat;
+
+                TBuf<KMaxEntryLength> temp;
+                _LIT( KIconIdNameNumber, "%d\t%s\t%s" );
+
+                temp.FillZ( KMaxEntryLength );
+                temp.Format( KIconIdNameNumber, iIcons->Count()-1, nameUncat.Ptr(),
+                             numUncat.Ptr() );
+
+                CConnectionInfo* conIn = CConnectionInfo::NewL( 0, 0, temp );
+                CleanupStack::PushL( conIn );
+                iItems->AppendL( conIn );        
+                CleanupStack::Pop( conIn );
+                if ( iHighlightedItem < 0 )
+                    {
+                    iHighlightedItem = 0;
+                    }
+                }
+            }
+        }
+    }
+
+
+// ---------------------------------------------------------
+// CActiveSelectConnectionPlugin::GetElementIDL
+// ---------------------------------------------------------
+//    
+TUint32 CActiveSelectConnectionPlugin::GetElementIDL( TUint32 aIAPId,
+                                                      TUint32 aDestinationId )
+    {
+    TUint32 retval = 0;
+    TInt err;
+
+    if ( aDestinationId )
+        {
+        RCmDestinationExt cmDestExt;
+        TRAP( err, cmDestExt = iCmManagerExt.DestinationL( aDestinationId ) );
+        if ( err == KErrNone )
+            {
+            retval = cmDestExt.ElementId();
+            cmDestExt.Close();
+            }
+        }
+    else if ( aIAPId )
+        {
+        RCmConnectionMethodExt cmConnMethodExt;
+        TRAP( err, cmConnMethodExt = iCmManagerExt.ConnectionMethodL( 
+                                                                    aIAPId ) );
+        if ( err == KErrNone )
+            {
+            CleanupClosePushL( cmConnMethodExt );
+            retval = cmConnMethodExt.GetIntAttributeL( ECmElementID );
+            CleanupStack::PopAndDestroy();  // cmConnMethodExt
+            }
+        }
+
+    return retval;
+    }
+
+
+// ---------------------------------------------------------
+// CActiveSelectConnectionPlugin::GetRefreshIntervalL()
+// ---------------------------------------------------------
+//    
+TInt CActiveSelectConnectionPlugin::GetRefreshIntervalL( )
+    {
+    CLOG_ENTERFN( "CActiveSelectConnectionPlugin::GetRefreshInterval" );  
+
+    TInt variant( KTickDefaultInterval );  
+
+
+    CMDBSession* session = CMDBSession::NewL(KCDLatestVersion);
+    CleanupStack::PushL( session );
+    
+  	//session->OpenTransactionL();
+    TMDBElementId tableId = 0;
+    
+    tableId = CCDWlanDeviceSettingsRecord::TableIdL( *session);
+        
+    CCDWlanDeviceSettingsRecord* record = new(ELeave)
+    		CCDWlanDeviceSettingsRecord(tableId); 		
+    CleanupStack::PushL(record);
+    
+    record->iWlanDeviceSettingsType = KWlanUserSettings;
+    
+    if(record->FindL( *session ))
+    	{
+    	record->LoadL( *session );
+        
+    	// In case iBgScanInterval is -1 (= automatic) then just use 
+    	// KTickDefaultInterval as refresh interval
+        if ( record->iBgScanInterval != KWlanBgScanIntervalAuto
+             && record->iBgScanInterval > 0 )
+            {
+            variant = record->iBgScanInterval;
+            variant = variant * KMicrosecondsToSecondsMultiplier;    
+            }
+    	}
+    CleanupStack::PopAndDestroy( record ); 
+    
+    //session->CommitTransactionL();
+
+    CleanupStack::PopAndDestroy( session ); 
+    
+    TUint32 variantToLog = variant;
+
+    CLOG_WRITEF( _L( "Refresh interval (microseconds) : %d" ), variantToLog );
+    
+    CLOG_LEAVEFN( "CActiveSelectConnectionPlugin::GetRefreshInterval" );
+    
+    return variant;            
+    }
+    
+// ---------------------------------------------------------
+// CActiveSelectConnectionPlugin::CountAdhocWlanIapsL()
+// ---------------------------------------------------------
+//
+TInt CActiveSelectConnectionPlugin::CountAdhocWlanIapsL()
+    {
+    CLOG_ENTERFN( "CActiveSelectExplicit::CountAdhocWlanIapsL " );
+    
+    // Creating a session with the latest version
+    CMDBSession* db = CMDBSession::NewLC( CMDBSession::LatestVersion() );
+    db->SetAttributeMask( ECDProtectedWrite );
+    
+    // Create wlan service record set (RArray (or RPtrArray?))
+    CMDBRecordSet<CCDWlanServiceRecord>* wlanSet =
+        new (ELeave)CMDBRecordSet<CCDWlanServiceRecord>(   CCDWlanServiceRecord::TableIdL( *db )   );
+    CleanupStack::PushL( wlanSet ); 
+    
+    // Create wlan service record
+    CCDWlanServiceRecord* wlanRecord =
+        new (ELeave)CCDWlanServiceRecord(   CCDWlanServiceRecord::TableIdL( *db )   );
+    
+    CleanupStack::PushL( wlanRecord );
+    
+    // Set ConnectionMode field in wlan service record (see wlancontainer.h)
+    // This works with EWlanOperatingModeAdhoc, fails with EWlanConnectionModeAdhoc
+    wlanRecord->iWlanConnMode.SetL( EWlanOperatingModeAdhoc );
+    
+    // Append wlan service record to wlan service record set (currently empty)
+    wlanSet->iRecords.AppendL( wlanRecord );
+    CleanupStack::Pop( wlanRecord ); // ownership moved to RPointerArray
+    
+    TInt wlanRecordCount( 0 );
+    
+    // Find matcing wlan service records
+    if( wlanSet->FindL( *db ) )
+        {
+        wlanRecordCount = wlanSet->iRecords.Count();
+        
+        for ( TInt i = 0; i < wlanRecordCount; i++ )
+            {
+            // Load the current record again to be sure all fields are up to date
+            wlanRecord->SetElementId( wlanSet->iRecords[i]->ElementId() );
+    
+            // Load will only look at ElementId and updates the rest of the fields
+            wlanRecord->LoadL( *db );
+              
+            if ( wlanRecord->iWLanSSID.IsNull() )
+                {
+                // Count active Easy WLAN using adhoc out
+                wlanRecordCount--;
+                break; 
+                }    
+            }
+        
+        CLOG_WRITEF( _L("wlanSet record count = %d"), wlanRecordCount );
+        }
+    else
+        {
+        CLOG_WRITEF( _L("no matcing wlan records found." ));
+        }
+        
+    CleanupStack::PopAndDestroy( wlanSet );
+    CleanupStack::PopAndDestroy( db );
+    
+    CLOG_LEAVEFN( "CActiveSelectExplicit::CountAdhocWlanIapsL" );
+    
+    return ( wlanRecordCount );
+    }
+    
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/cconndlg/src/ActiveSelectExplicit.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,519 @@
+/*
+* Copyright (c) 2002 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 plugins (base & all derived).
+*
+*/
+
+
+// INCLUDE FILES
+#include "ActiveSelectExplicit.h"
+#include "SelectExplicitDialog.h"
+#include "ConnectionInfo.h"
+#include "ConnectionInfoArray.h"
+#include "CConnDlgPrivateCRKeys.h"
+#include "ConnectionDialogsLogger.h"
+#include "sortsnaputils.h"
+
+#include <commdb.h>
+#include <StringLoader.h>
+#include <wlanmgmtcommon.h>
+#include <cmdestinationext.h>
+#include <cmpluginwlandef.h>
+#ifndef __WINS__
+#include <wlanmgmtclient.h>
+#endif
+#include <AknWaitDialog.h>
+#include <AknIconArray.h>
+#include <AknsUtils.h>
+
+#include <CConnDlgPlugin.rsg>
+#include <data_caging_path_literals.hrh>
+#include <cmmanager.mbg>
+#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include <commsdat.h>
+#else
+#include <commsdat.h>
+#include <commsdat_partner.h>
+#endif
+#include <wlancontainer.h>
+
+
+// CONSTANTS
+
+LOCAL_D const TInt KMaxEntryLength = CommsDat::KMaxTextLength*2 + 20;
+LOCAL_D const TInt KIconsGranularity = 4;
+
+using namespace CMManager;
+
+
+///////////////////////////////////////////////////////////////////////////////
+
+// ---------------------------------------------------------
+// CActiveSelectExplicit::CActiveSelectExplicit()
+// ---------------------------------------------------------
+//
+CActiveSelectExplicit::CActiveSelectExplicit( 
+                                        CSelectConnectionDialog* aCallerDialog,
+                                        TUint aDestId, 
+                                        TInt aRefreshInterval,
+                                        TUint32 aBearerSet, 
+                                        TBool aIsWLANFeatureSupported, 
+                                        TUint aDefaultCMId )
+: iCallerDialog( aCallerDialog ),
+  iDestId( aDestId ),
+//  isDialogDeleting( EFalse ),
+  iRefreshInterval( aRefreshInterval ),
+  iBearerSet( aBearerSet ),
+  iIsWLANFeatureSupported( aIsWLANFeatureSupported ), 
+  iDefaultCMId( aDefaultCMId )
+    {
+    }
+
+    
+// ---------------------------------------------------------
+// CActiveSelectExplicit* CActiveSelectExplicit::NewL()
+// ---------------------------------------------------------
+//
+CActiveSelectExplicit* CActiveSelectExplicit::NewL( 
+                                        CSelectConnectionDialog* aCallerDialog,
+                                        TUint aDestId, 
+                                        TInt aRefreshInterval,
+                                        TUint32 aBearerSet, 
+                                        TBool aIsWLANFeatureSupported, 
+                                        TUint aDefaultCMId )
+    {
+    CLOG_ENTERFN( "CActiveSelectExplicit::NewL " );  
+    
+    CActiveSelectExplicit* self = new ( ELeave ) CActiveSelectExplicit(
+                                    aCallerDialog, aDestId, aRefreshInterval,
+                                    aBearerSet, aIsWLANFeatureSupported, 
+                                    aDefaultCMId );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    
+    CLOG_LEAVEFN( "CActiveSelectExplicit::NewL " );      
+
+    return self;        
+    }
+
+
+// ---------------------------------------------------------
+// CActiveSelectExplicit::ConstructL()
+// ---------------------------------------------------------
+//
+void CActiveSelectExplicit::ConstructL()
+    {
+    CActiveBase::ConstructL();
+
+    iItems = new( ELeave ) CConnectionInfoArray();
+    iIcons = new( ELeave ) CAknIconArray( KIconsGranularity );
+
+    iCmManagerExt.OpenL();
+    }
+
+// ---------------------------------------------------------
+// CActiveSelectExplicit::~CActiveSelectExplicit()
+// ---------------------------------------------------------
+//    
+CActiveSelectExplicit::~CActiveSelectExplicit()
+    {
+    Cancel();
+
+    if ( iItems )
+        {
+        iItems->ResetAndDestroy();
+        }
+    delete iItems;    
+    iItems = NULL;
+
+    iCmManagerExt.Close();
+    }
+
+
+// ---------------------------------------------------------
+// CActiveSelectExplicit::Cancel()
+// ---------------------------------------------------------
+// 
+void CActiveSelectExplicit::Cancel()
+    {
+    StopTimer();
+    CActive::Cancel();
+
+    if( iDialog  && !( iDialog->GetOkToExit() ) )
+        {
+        CLOG_WRITEF( _L( "iDialog->GetOkToExit() : %b" ), iDialog->GetOkToExit() );
+        delete iDialog;
+        iDialog = NULL;
+        }
+    }
+
+
+// ---------------------------------------------------------
+// CActiveSelectExplicit::DoCancel()
+// ---------------------------------------------------------
+// 
+void CActiveSelectExplicit::DoCancel()
+    {
+    CLOG_ENTERFN( "CActiveSelectExplicit::DoCancel " );  
+    
+/*    if( isDialogDeleting )
+        {
+        CLOG_WRITE( "isDialogDeleting" );
+        
+        delete iDialog;
+        iDialog = NULL;   
+        
+        isDialogDeleting = EFalse;         
+        }
+  */      
+    CLOG_LEAVEFN( "CActiveSelectExplicit::DoCancel " );          
+    }
+
+    
+// ---------------------------------------------------------
+// CActiveSelectExplicit::RunL()
+// ---------------------------------------------------------
+//     
+void CActiveSelectExplicit::RunL()
+    {
+    CLOG_ENTERFN( "CActiveSelectExplicit::RunL " );  
+    
+    if( iStatus == KErrNone )
+        {
+        BuildConnectionListL();
+        iDialog->RefreshDialogL( iItems, iIcons, ETrue );
+        }     
+    
+    CLOG_LEAVEFN( "CActiveSelectExplicit::RunL " );      
+        
+    }
+
+    
+// ---------------------------------------------------------
+// CActiveSelectExplicit::StartSearchIAPsL()
+// ---------------------------------------------------------
+//    
+void CActiveSelectExplicit::ShowSelectExplicitL()
+    {    
+    BuildConnectionListL();
+
+    iDialog = CSelectExplicitDialog::NewL( iCallerDialog );
+    iDialog->PrepareAndRunLD( iItems, iIcons, EFalse );
+
+    if( iRefreshInterval )
+        {
+        StartTimerL( iRefreshInterval );
+        }     
+    }
+   
+ 
+// ---------------------------------------------------------
+// CActiveSelectExplicit::BuildConnectionListL()
+// ---------------------------------------------------------
+//
+void CActiveSelectExplicit::BuildConnectionListL()
+    {
+    CLOG_ENTERFN( "CActiveSelectExplicit::BuildConnectionListL " );  
+
+    if ( iItems )
+        {
+        iItems->ResetAndDestroy();
+        }
+
+    if ( iIcons )
+        {
+        iIcons->ResetAndDestroy();
+        }
+
+    if ( iDefaultCMId != 0 )  
+        {   // It automatically means also that the feature is supported
+        _LIT( KDriveZ, "z:" );  // ROM folder
+        // Name of the MBM file containing icons
+        _LIT( KManagerIconFilename, "cmmanager.mbm" );
+    
+        TFileName iconsFileName;
+
+        iconsFileName.Append( KDriveZ );
+        iconsFileName.Append( KDC_APP_BITMAP_DIR );
+        iconsFileName.Append( KManagerIconFilename );
+
+        iIcons->AppendL( AknsUtils::CreateGulIconL( AknsUtils::SkinInstance(),
+                                    KAknsIIDQgnIndiCbHotAdd,
+                                    iconsFileName, 
+                                    EMbmCmmanagerQgn_indi_cb_hot_add, 
+                                    EMbmCmmanagerQgn_indi_cb_hot_add_mask ) );
+        }
+
+    TBool easyWlanIsInDb = EFalse;
+
+#ifdef _DEBUG
+    if ( iDestId )
+        {   // Real destination, not for uncategorized
+        RCmDestinationExt cmDestExt = iCmManagerExt.DestinationL( iDestId );
+        CleanupClosePushL( cmDestExt );
+        CLOG_WRITEF( _L( "Destination id %d, Total number of methods %d" ),
+                    iDestId, cmDestExt.ConnectionMethodCount() );
+
+        for ( TInt j = 0; j < cmDestExt.ConnectionMethodCount(); j++ )
+            {
+            RCmConnectionMethodExt cmConnMethodExt;
+            TRAPD( err, cmConnMethodExt = cmDestExt.ConnectionMethodL( j ) );
+            if ( err == KErrNone )
+                {
+                CleanupClosePushL( cmConnMethodExt );
+                HBufC* bufMethod = cmConnMethodExt.GetStringAttributeL(
+                                                                    ECmName );
+                CleanupStack::PushL( bufMethod );
+                TBuf<CommsDat::KMaxTextLength+1> nameMethod;
+                nameMethod = *bufMethod;
+                nameMethod.ZeroTerminate();
+
+                CLOG_WRITEF( _L( "ConnMethod id %d, Method name %s" ), 
+                    cmConnMethodExt.GetIntAttributeL( ECmIapId ), nameMethod.Ptr() );
+
+                CleanupStack::PopAndDestroy( 2 ); // bufMethod, cmConnMethodExt
+                }
+            }
+        CleanupStack::PopAndDestroy();  // cmDestExt
+        }
+#endif
+        TSortSnapUtils sortSnapUtils( iMPM );
+        TMpmSnapBuffer snapBuffer;
+        TInt err = sortSnapUtils.GetSortSnapData( iDestId, snapBuffer );
+        CLOG_WRITEF( _L( "GetSortSNAPDataL returned = %d. list.Count() = %d" ), err, snapBuffer.Count() );
+
+        if ( err == KErrNone )
+            {
+            RCmConnectionMethodExt cmConnMethodExt;
+            CleanupClosePushL( cmConnMethodExt );
+            for ( TInt numCM = 0; numCM < snapBuffer.Count(); numCM++ )
+                {
+                AddConnectionMethodItemL( snapBuffer.iIapId[numCM], 
+                                          iDestId == 0,
+                                          easyWlanIsInDb, 
+                                          snapBuffer.iIapId[numCM] == iDefaultCMId );
+                }
+            CleanupStack::PopAndDestroy();  // cmConnMethodExt
+            }   
+
+    // Add any ad-hoc WLAN iaps to the list
+    if ( ( iBearerSet & ECommDbBearerWLAN ) && ( iDestId == 0 ) && iIsWLANFeatureSupported )
+        {
+        AddAdhocWlanIapsL();	
+        }
+
+    CLOG_LEAVEFN( "CActiveSelectExplicit::BuildConnectionListL " );
+    }
+
+
+// ---------------------------------------------------------
+// CActiveSelectExplicit::AddConnectionMethodItemL()
+// ---------------------------------------------------------
+//
+void CActiveSelectExplicit::AddConnectionMethodItemL( TUint32 aId,
+                                                TBool aCheckForEasyWlan, 
+                                                TBool& aEasyWlanIsInDb, 
+                                                TBool aDefaultCM )
+    {
+    CLOG_ENTERFN( "CActiveSelectExplicit::AddConnectionMethodItemL" );  
+
+    CConnectionInfo* conIn;
+
+    RCmConnectionMethodExt cmConnMethodExt;
+    CLOG_WRITEF( _L( "Uncat dest id %d" ), aId );
+
+    TRAPD( err, cmConnMethodExt = iCmManagerExt.ConnectionMethodL( aId ) );
+    CLOG_WRITEF( _L( "err %d" ), err );
+
+    if ( err == KErrNone )
+        {
+        CleanupClosePushL( cmConnMethodExt );
+
+        TUint32 bearer = cmConnMethodExt.GetIntAttributeL( 
+                                                        ECmCommsDBBearerType );
+        CLOG_WRITEF( _L( "bearer %d" ), bearer );
+
+        if ( bearer & iBearerSet )
+            {
+            CLOG_WRITE( "To be listed!" );
+
+            TBool isCMEasyWlan = EFalse;
+
+            HBufC* bufName = cmConnMethodExt.GetStringAttributeL(
+                                                                ECmName );
+
+            TBuf<CommsDat::KMaxTextLength+1> nameCM;
+            nameCM = *bufName;
+            nameCM.ZeroTerminate();
+            delete bufName;
+
+            CLOG_WRITEF( _L( "Method name %s. Bearer = %d" ), nameCM.Ptr(), bearer );
+
+            if ( aCheckForEasyWlan && bearer == KCommDbBearerWLAN && 
+                 iIsWLANFeatureSupported )
+                {
+                if ( !aEasyWlanIsInDb )
+                    {
+                    HBufC* bufSSID = cmConnMethodExt.GetStringAttributeL( 
+                                                                EWlanSSID );
+                    if ( !bufSSID || bufSSID->Des().Length() == 0 )
+                        {
+                        isCMEasyWlan = ETrue;
+                        aEasyWlanIsInDb = ETrue;
+                        }
+                    delete bufSSID;
+                    }
+                }
+
+            if ( !isCMEasyWlan )
+                {
+                CGulIcon* iconCM = ( CGulIcon* )
+                                    cmConnMethodExt.GetIntAttributeL(
+                                                            ECmBearerIcon );
+                if ( iconCM )
+                    {
+                    CLOG_WRITEF( _L( "iconCM found" ) );
+                    CleanupStack::PushL( iconCM );
+                    iIcons->AppendL( iconCM );
+
+                    // icon array took over ownership
+                    CleanupStack::Pop( iconCM );
+                    }
+                else
+                    {
+                    CLOG_WRITEF( _L( "iconCM not found" ) );
+                    }
+
+                TBuf<KMaxEntryLength> temp;
+                _LIT( KIconIdName, "%d\t%s" );
+                _LIT( KIconIdNameDefaultConn, "%d\t%s\t0" );
+
+                if ( aDefaultCM )
+                    {
+                    temp.Format( KIconIdNameDefaultConn, iIcons->Count()-1,
+                                 nameCM.Ptr() );
+                    }
+                else
+                    {
+                    temp.Format( KIconIdName, iIcons->Count()-1, 
+                                 nameCM.Ptr() );
+                    }
+
+                conIn = CConnectionInfo::NewL( aId, 0, temp );
+                CleanupStack::PushL( conIn );
+                iItems->AppendL( conIn );
+                CleanupStack::Pop( conIn );
+                }
+            }
+        CleanupStack::PopAndDestroy();  // cmConnMethodExt
+        }
+
+    CLOG_LEAVEFN( "CActiveSelectExplicit::AddConnectionMethodItemL" );
+    }
+
+// ---------------------------------------------------------
+// CActiveSelectExplicit::AddAdhocWlanIapsL()
+// ---------------------------------------------------------
+//
+void CActiveSelectExplicit::AddAdhocWlanIapsL()
+    {
+    CLOG_ENTERFN( "CActiveSelectExplicit::AddAdhocWlanIapsL " );
+    
+    // Creating a session with the latest version
+    CMDBSession* db = CMDBSession::NewLC( CMDBSession::LatestVersion() );
+    db->SetAttributeMask( ECDProtectedWrite );
+    
+    // Create wlan service record set (RArray (or RPtrArray?))
+    CMDBRecordSet<CCDWlanServiceRecord>* wlanSet =
+        new (ELeave)CMDBRecordSet<CCDWlanServiceRecord>(   CCDWlanServiceRecord::TableIdL( *db )   );
+    CleanupStack::PushL( wlanSet ); 
+    
+    // Create wlan service record
+    CCDWlanServiceRecord* wlanRecord =
+        new (ELeave)CCDWlanServiceRecord(   CCDWlanServiceRecord::TableIdL( *db )   );
+    
+    CleanupStack::PushL( wlanRecord );
+    
+    // Set ConnectionMode field in wlan service record (see wlancontainer.h)
+    // This works with EWlanOperatingModeAdhoc, fails with EWlanConnectionModeAdhoc
+    wlanRecord->iWlanConnMode.SetL( EWlanOperatingModeAdhoc );
+    
+    // Append wlan service record to wlan service record set (currently empty)
+    wlanSet->iRecords.AppendL( wlanRecord );
+    CleanupStack::Pop( wlanRecord ); // ownership moved to RPointerArray
+    
+    // Find matcing wlan service records
+    if( wlanSet->FindL( *db ) )
+        {
+        TInt wlanRecordCount( wlanSet->iRecords.Count() );
+        CLOG_WRITEF( _L("wlanSet record count = %d"), wlanRecordCount );
+        
+        TBool easyWlanIsInDb = EFalse;
+        
+        // loop for each record found
+        for ( TInt i = 0; i < wlanRecordCount; i++ )
+            {
+            // Seems we need to specifically load the current record again to be sure all fields are up to date
+            wlanRecord->SetElementId( wlanSet->iRecords[i]->ElementId() );
+            // Load will only look at ElementId and updates the rest of the fields
+            wlanRecord->LoadL( *db );
+            
+            if ( !( wlanRecord->iWLanSSID.IsNull() ) )
+                {
+                // Don't include Easy WLAN
+                // lets print some stuff to log            
+                CLOG_WRITEF( _L("New ad-hoc WLAN IAP:" ));
+                CLOG_WRITEF( _L("  iWlanServiceId = %d"), static_cast<TUint>( wlanRecord->iWlanServiceId ) );
+                CLOG_WRITEF( _L("  iWlanConnMode  = %d"), static_cast<TUint>( wlanRecord->iWlanConnMode ) );
+                CLOG_WRITEF( _L("  iWLanSSID      = %S"), &(static_cast<TDesC>( wlanRecord->iWLanSSID ) ) );
+            
+                // Create an iap record
+                CCDIAPRecord* iapRecord = static_cast<CCDIAPRecord*> ( 
+                    CCDRecordBase::RecordFactoryL( KCDTIdIAPRecord ) );
+                CleanupStack::PushL( iapRecord );
+            
+                iapRecord->iServiceType.SetL( TPtrC( KCDTypeNameLANService ) );
+                // Set the service field to the same value as in the wlan service record we are currently looking
+                iapRecord->iService = wlanRecord->iWlanServiceId;
+                // Find the matching iap record
+                if( iapRecord->FindL( *db ) )
+                    {
+                    TUint iapId( 0 );
+                
+                    // read the iap id
+                    iapId = iapRecord->RecordId();
+                    CLOG_WRITEF( _L("  iapId          = %d"), iapId );
+                
+                    AddConnectionMethodItemL( iapId, 
+                                              iDestId == 0,
+                                              easyWlanIsInDb, 
+                                              iapId == iDefaultCMId );
+                    }
+                CleanupStack::PopAndDestroy( iapRecord );
+                }
+            }
+        }
+    else
+        {
+        CLOG_WRITEF( _L("no matcing wlan records found." ));
+        }
+        
+    CleanupStack::PopAndDestroy( wlanSet );
+    CleanupStack::PopAndDestroy( db );
+    
+    CLOG_LEAVEFN( "CActiveSelectExplicit::AddAdhocWlanIapsL" );
+    }
+    
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/cconndlg/src/AuthenticationDialog.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,169 @@
+/*
+* Copyright (c) 2002 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 CAuthenticationDialog.
+*
+*/
+
+
+// INCLUDE FILES
+#include "AuthenticationDialog.h"
+#include "ConnDlgPlugin.h"
+#include "ExpiryTimer.h"
+
+#include <uikon/eiksrvui.h>
+
+
+// ---------------------------------------------------------
+// CAuthenticationDialog::CAuthenticationDialog
+// ---------------------------------------------------------
+//
+CAuthenticationDialog::CAuthenticationDialog( 
+                                        CConnDlgAuthenticationPlugin* aPlugin )
+: CAknMultiLineDataQueryDialog( CAknQueryDialog::ENoTone ),
+  iPlugin( aPlugin )
+    {
+    }
+
+
+// ---------------------------------------------------------
+// CAuthenticationDialog::~CAuthenticationDialog
+// ---------------------------------------------------------
+//
+CAuthenticationDialog::~CAuthenticationDialog()
+    {
+
+    STATIC_CAST( CEikServAppUi*, 
+                CCoeEnv::Static()->AppUi() )->SuppressAppSwitching( EFalse );
+    delete iExpiryTimer;
+    
+    }
+
+
+// ---------------------------------------------------------
+// CAuthenticationDialog::NewL
+// ---------------------------------------------------------
+//
+CAuthenticationDialog* CAuthenticationDialog::NewL( 
+                                        CConnDlgAuthenticationPlugin* aPlugin, 
+                                        TDes& aUsername, TDes& aPassword )
+    {
+    CAuthenticationDialog* dialog = new( ELeave ) 
+                                            CAuthenticationDialog( aPlugin );
+    CleanupStack::PushL( dialog );
+
+    dialog->SetDataL( aUsername, aPassword );
+
+    CleanupStack::Pop( dialog );
+
+    return dialog;
+    }
+
+
+// ---------------------------------------------------------
+// CAuthenticationDialog::PreLayoutDynInitL()
+// ---------------------------------------------------------
+//
+void CAuthenticationDialog::PreLayoutDynInitL()
+    {
+    CAknMultiLineDataQueryDialog::PreLayoutDynInitL();
+
+    if( FirstData( TPtr( 0, 0 ) ).Length() > 0 )
+        {
+        MakeLeftSoftkeyVisible( ETrue );
+        }
+
+    STATIC_CAST( CEikServAppUi*, 
+                CCoeEnv::Static()->AppUi() )->SuppressAppSwitching( ETrue );
+    
+    iExpiryTimer = CExpiryTimer::NewL( *this );
+    iExpiryTimer->Start();
+    }
+
+
+// ---------------------------------------------------------
+// CAuthenticationDialog::SetInitialCurrentLine()
+// ---------------------------------------------------------
+//
+void CAuthenticationDialog::SetInitialCurrentLine()
+    {
+    CAknMultiLineDataQueryDialog::SetInitialCurrentLine();
+
+    iFirstEmpty = FirstData( TPtr( 0,0 ) ).Length() == 0;
+    iSecondEmpty = SecondData( TPtr( 0,0 ) ).Length() == 0;
+    if( !iFirstEmpty || !iSecondEmpty )
+        {
+        MakeLeftSoftkeyVisible( ETrue );
+        }
+    }
+
+
+// ---------------------------------------------------------
+// CAuthenticationDialog::OkToExitL
+// ---------------------------------------------------------
+//
+TBool CAuthenticationDialog::OkToExitL( TInt aButtonId )
+    {
+    if ( CAknMultiLineDataQueryDialog::OkToExitL( aButtonId ) )
+        {
+        if ( aButtonId == EAknSoftkeySelect || 
+             aButtonId == EAknSoftkeyOk || 
+             aButtonId == EAknSoftkeyDone )
+            {
+            iPlugin->CompleteL( KErrNone );
+            }
+        else if ( aButtonId== EAknSoftkeyCancel )
+            {
+            iPlugin->CompleteL( KErrCancel );
+            }
+
+        return( ETrue );
+        }
+
+    return( EFalse );
+    }
+
+
+// ---------------------------------------------------------
+// CAuthenticationDialog::HandleQueryEditorStateEventL
+//
+// This code is based on AknQueryDialog.cpp
+// ---------------------------------------------------------
+//
+TBool CAuthenticationDialog::HandleQueryEditorStateEventL( 
+                                            CAknQueryControl* aQueryControl,
+                                            TQueryControlEvent /*aEventType*/,
+                                            TQueryValidationStatus aStatus )
+    {
+    if( STATIC_CAST( CAknMultilineQueryControl*, aQueryControl )->IsFirst() )
+        {
+        iFirstEmpty = ( aStatus == EEditorEmpty );
+        }
+
+    if( STATIC_CAST( CAknMultilineQueryControl*, aQueryControl)->IsSecond() )
+        {
+        iSecondEmpty = ( aStatus == EEditorEmpty );
+        }
+
+    MakeLeftSoftkeyVisible( ( !iFirstEmpty ) || ( !iSecondEmpty ) );
+
+    return EFalse;
+    }
+	
+void CAuthenticationDialog::HandleTimedOut()
+    {
+    TRAP_IGNORE( TryExitL(EAknSoftkeyCancel) );
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/cconndlg/src/ConnDlgPlugin.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,991 @@
+/*
+* Copyright (c) 2002 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 plugins (base & all derived).
+*
+*/
+
+// INCLUDE FILES
+#include "ConnDlgPlugin.h"
+#include "AuthenticationDialog.h"
+#include "ReconnectDialog.h"
+#include "QosDialog.h"
+#include "NewIapDialog.h"
+#include "ActiveIapPlugin.h"
+
+#include "ActiveSelectConnectionPlugin.h"
+#include "CConnDlgPrivateCRKeys.h"
+#include <centralrepository.h>
+
+#include "ConnectionDialogsUidDefs.h"
+#include "ConnectionDialogsLogger.h"
+
+#include <eikenv.h>
+#include <bautils.h>
+#include <e32property.h> 
+#include <rmpm.h>
+
+#include <CConnDlgPlugin.rsg>
+#include <data_caging_path_literals.hrh>
+
+using namespace CommsDat;
+
+// CONSTANTS
+
+// RSC file name.
+_LIT( KResourceFileName, "CConnDlgPlugin.rsc" );
+
+// Panic string
+_LIT( KConnDlgPluginPanic, "CConnDlgPlugin" );
+
+LOCAL_D const TInt KPluginGranularity = 4;
+
+#if defined(_DEBUG)
+_LIT( KErrActiveObjectNull, "iActivePlugin not NULL" );
+#endif
+
+
+
+LOCAL_C void CreateNotifiersL( 
+                            CArrayPtrFlat<MEikSrvNotifierBase2>* aNotifiers );
+
+
+
+
+// ---------------------------------------------------------
+// NotifierArray()
+// Lib main entry point
+// ---------------------------------------------------------
+//
+
+EXPORT_C CArrayPtr<MEikSrvNotifierBase2>* NotifierArray()
+    {
+    CArrayPtrFlat<MEikSrvNotifierBase2>* array = new (ELeave) 
+                    CArrayPtrFlat<MEikSrvNotifierBase2>( KPluginGranularity );
+
+    if ( array )
+        {
+        TRAPD( err, CreateNotifiersL( array ) );
+        if( err )
+            {
+            TInt count = array->Count();
+            while( count-- )
+                {
+                (*array)[count]->Release();
+                }
+            delete array;
+            array = NULL;
+            }
+        }
+
+    return( array );
+    }
+
+
+// ---------------------------------------------------------
+// CreateNotifiersL
+// ---------------------------------------------------------
+//
+LOCAL_C void CreateNotifiersL( 
+                              CArrayPtrFlat<MEikSrvNotifierBase2>* aNotifiers )
+    {
+    MEikSrvNotifierBase2 *serNotify;
+    TBool resourceFileResponsible = ETrue;
+
+    serNotify = CConnDlgIapPlugin::NewL( resourceFileResponsible );
+    CleanupStack::PushL( serNotify );
+    aNotifiers->AppendL( serNotify );
+    CleanupStack::Pop( serNotify );
+
+    resourceFileResponsible = EFalse; // Only the first has to load resources
+
+    serNotify = CConnDlgAuthenticationPlugin::NewL( resourceFileResponsible );
+    CleanupStack::PushL( serNotify );
+    aNotifiers->AppendL( serNotify );
+    CleanupStack::Pop( serNotify );
+
+    serNotify = CConnDlgReconnectPlugin::NewL( resourceFileResponsible );
+    CleanupStack::PushL( serNotify );
+    aNotifiers->AppendL( serNotify );
+    CleanupStack::Pop( serNotify );
+
+    serNotify = CConnDlgNewIapPlugin::NewL( resourceFileResponsible );
+    CleanupStack::PushL( serNotify );
+    aNotifiers->AppendL( serNotify );
+    CleanupStack::Pop( serNotify );
+
+    serNotify = CConnDlgQosPlugin::NewL( resourceFileResponsible );
+    CleanupStack::PushL( serNotify );
+    aNotifiers->AppendL( serNotify );
+    CleanupStack::Pop( serNotify );
+
+    serNotify = CConnDlgSelectConnectionPlugin::NewL( 
+                                                    resourceFileResponsible );
+    CleanupStack::PushL( serNotify );
+    aNotifiers->AppendL( serNotify );
+    CleanupStack::Pop( serNotify );
+    }
+
+
+
+// ---------------------------------------------------------
+// CConnDlgIapPlugin::TNotifierInfo CConnDlgIapPlugin::RegisterL()
+// ---------------------------------------------------------
+//
+CConnDlgIapPlugin::TNotifierInfo CConnDlgIapPlugin::RegisterL()
+    {
+    iInfo.iUid = KUidCConnDlgIap;
+    iInfo.iPriority = ENotifierPriorityHigh;
+    iInfo.iChannel = KUidCConnDlgIap;
+
+    return iInfo;
+    }
+
+
+// ---------------------------------------------------------
+// void CConnDlgIapPlugin::StartL
+// ---------------------------------------------------------
+//
+
+void CConnDlgIapPlugin::StartL( const TDesC8& aBuffer, TInt aReplySlot,
+                                const RMessagePtr2& aMessage )
+    {
+    iPrefs.Copy( (TPtrC8) aBuffer );
+
+    iCancelled = EFalse;
+    iReplySlot = aReplySlot;
+    iMessage = aMessage;
+    
+    // Check if there is a suitable active connection
+    TInt iap( 0 );
+    TInt bearer( ECommDbBearerWLAN ); // User conn. is always WLAN in 9.1
+                                      
+    // Is there active User connection
+    TInt err = GetUserConnection( iap );
+    
+    if ( err != KErrNone || iap == 0 )
+        {
+        // Is there any active connection
+    	err = GetActiveConnection( iap, bearer );
+        }
+
+    if ( ( err == KErrNone ) && 
+         ( iap != 0 )        &&  
+         ( iPrefs().iBearerSet & bearer ) )
+        {
+    	// a suitable connection is already active
+    	iIAP = iap;
+    	CompleteL( KErrNone );
+        }
+    else
+        {
+        // display a dialog
+        __ASSERT_DEBUG( !iActivePlugin, 
+                    User::Panic( KErrActiveObjectNull, KErrNone ) );
+    
+        iActivePlugin = CActiveCConnDlgIapPlugin::NewL( this, iPrefs() );
+        iActivePlugin->StartSearchIAPsL();	
+        }
+    }
+
+
+
+// ---------------------------------------------------------
+// void CConnDlgIapPlugin::Cancel()
+// ---------------------------------------------------------
+//
+void CConnDlgIapPlugin::Cancel()
+    {
+    delete iActivePlugin;
+    iActivePlugin = NULL;
+    
+    if ( !iCancelled )
+        {
+        iCancelled = ETrue;
+        if ( !iMessage.IsNull() )
+            {
+            iMessage.Complete( KErrCancel );
+            }
+        }
+    }
+
+
+// ---------------------------------------------------------
+// void CConnDlgIapPlugin::CompleteL( TInt aStatus )
+// ---------------------------------------------------------
+//
+void CConnDlgIapPlugin::CompleteL( TInt aStatus )
+    {
+    CLOG_ENTERFN( "CConnDlgIapPlugin::CompleteL" );      
+
+    iCancelled = ETrue;
+    if ( !iMessage.IsNull() )
+        {
+        if ( aStatus == KErrNone )
+            {
+            iMessage.WriteL( iReplySlot, TPckg<TUint32>( iIAP ) );
+            }
+        
+        CLOG_WRITEF( _L( "CConnDlgIapPlugin::CompleteL iIAP : %d" ), iIAP );
+                
+        iMessage.Complete( aStatus );
+        }
+    Cancel();
+
+    CLOG_LEAVEFN( "CConnDlgIapPlugin::CompleteL" );   
+    }
+
+
+// ---------------------------------------------------------
+// CConnDlgIapPlugin* CConnDlgIapPlugin::NewL()
+// ---------------------------------------------------------
+//
+CConnDlgIapPlugin* CConnDlgIapPlugin::NewL( 
+                                        const TBool aResourceFileResponsible )
+    {
+    CConnDlgIapPlugin* self = new (ELeave) CConnDlgIapPlugin();
+    CleanupStack::PushL( self );
+    self->ConstructL( KResourceFileName, aResourceFileResponsible );
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+// ---------------------------------------------------------
+// CConnDlgIapPlugin::SetPreferredIapIdL
+// ---------------------------------------------------------
+//    
+void CConnDlgIapPlugin::SetPreferredIapIdL( TUint32 aIAPId )
+    {
+    CLOG_ENTERFN( "CConnDlgIapPlugin::SetPreferredIapIdL " );
+    
+    iIAP = aIAPId;
+        
+    CLOG_LEAVEFN( "CConnDlgIapPlugin::SetPreferredIapIdL " );
+    }
+    
+    
+// ---------------------------------------------------------
+// CConnDlgIapPlugin::GetActiveConnection
+// ---------------------------------------------------------
+//    
+TInt CConnDlgIapPlugin::GetActiveConnection( TInt& aIapId, 
+                                             TInt& aBearer )
+    {
+    aIapId  = 0;
+    aBearer = 0;
+    
+    TInt err = RProperty::Get( KMPMActiveConnectionCategory, 
+                               KMPMPSKeyActiveConnectionIap, 
+                               aIapId );
+                               
+    CLOG_WRITEF( _L( "KMPMPSKeyActiveConnectionIap : %d" ), aIapId );                           
+    CLOG_WRITEF( _L( "err : %d" ), err );                           
+                               
+    if ( err == KErrNone )
+        {
+    	err = RProperty::Get( KMPMActiveConnectionCategory, 
+                              KMPMPSKeyActiveConnectionBearer, 
+                              aBearer );
+        }
+        
+    CLOG_WRITEF( _L( "KMPMPSKeyActiveConnectionBearer : %d" ), aBearer );                           
+    CLOG_WRITEF( _L( "err : %d" ), err );
+    CLOG_WRITEF( _L( "iPrefs().iBearerSet : %d" ), iPrefs().iBearerSet );
+    
+    return err;
+    }
+    
+    
+// ---------------------------------------------------------
+// CConnDlgIapPlugin::GetUserConnection
+// ---------------------------------------------------------
+//    
+TInt CConnDlgIapPlugin::GetUserConnection( TInt& aIapId )
+    {
+    aIapId  = 0;
+    
+    TInt err = RProperty::Get( KMPMUserConnectionCategory, 
+                               KMPMPSKeyUserConnectionIap, 
+                               aIapId );
+                
+    CLOG_WRITEF( _L( "KMPMPSKeyUserConnectionIap : %d" ), aIapId );                           
+    CLOG_WRITEF( _L( "err : %d" ), err );                            
+        
+    return err;    
+    }
+            
+
+// ---------------------------------------------------------
+// CConnDlgAuthenticationPlugin::TNotifierInfo
+//                                  CConnDlgAuthenticationPlugin::RegisterL()
+// ---------------------------------------------------------
+//
+CConnDlgAuthenticationPlugin::TNotifierInfo 
+                                    CConnDlgAuthenticationPlugin::RegisterL()
+    {
+    iInfo.iUid = KUidCConnDlgAuthentication;
+    iInfo.iPriority = ENotifierPriorityHigh;
+    iInfo.iChannel = KUidCConnDlgAuthentication;
+
+    return iInfo;
+    }
+
+
+// ---------------------------------------------------------
+// void CConnDlgAuthenticationPlugin::StartL
+// ---------------------------------------------------------
+//
+
+void CConnDlgAuthenticationPlugin::StartL( const TDesC8& aBuffer, 
+                                           TInt aReplySlot,
+                                           const RMessagePtr2& aMessage )
+    {
+    CLOG_ENTERFN( "CConnDlgAuthenticationPlugin::StartL" );
+
+    if ( aBuffer.Length() > iAuthPairBuff.Length() )
+        {
+        CLOG_WRITE( "User::Panic, EConnDlgIllegalRequest" );
+        User::Panic( KConnDlgPluginPanic, EConnDlgIllegalRequest );
+        }
+
+    iAuthPairBuff.Copy( aBuffer );
+
+    iReplySlot = aReplySlot;
+    iMessage = aMessage;
+    iCancelled = EFalse;
+
+    GetAuthenticationL();
+
+    CLOG_LEAVEFN( "CConnDlgAuthenticationPlugin::StartL" );
+    }
+
+
+
+// ---------------------------------------------------------
+// void CConnDlgAuthenticationPlugin::Cancel()
+// ---------------------------------------------------------
+//
+void CConnDlgAuthenticationPlugin::Cancel()
+    {
+    CLOG_ENTERFN( "CConnDlgAuthenticationPlugin::Cancel" );
+
+    if ( !iCancelled )
+        {
+        iCancelled = ETrue;
+        if ( !iMessage.IsNull() )
+            {
+            iMessage.Complete( KErrCancel );
+            }
+        delete iDialog;
+        iDialog = NULL;
+        }
+
+    CLOG_LEAVEFN( "CConnDlgAuthenticationPlugin::Cancel" );
+    }
+
+
+// ---------------------------------------------------------
+// void CConnDlgAuthenticationPlugin::GetAuthenticationL()
+// ---------------------------------------------------------
+//
+void CConnDlgAuthenticationPlugin::GetAuthenticationL()
+    {
+    CLOG_ENTERFN( "CConnDlgAuthenticationPlugin::GetAuthenticationL" );
+
+    iDialog = CAuthenticationDialog::NewL( this, iAuthPairBuff().iUsername, 
+                                           iAuthPairBuff().iPassword );
+
+
+    iDialog->ExecuteLD( R_CONNDLG_AUTHENTICATION );
+
+    CLOG_LEAVEFN( "CConnDlgAuthenticationPlugin::GetAuthenticationL" );
+    }
+
+
+// ---------------------------------------------------------
+// void CConnDlgAuthenticationPlugin::CompleteL( TInt aStatus )
+// ---------------------------------------------------------
+//
+void CConnDlgAuthenticationPlugin::CompleteL( TInt aStatus )
+    {
+    CLOG_ENTERFN( "CConnDlgAuthenticationPlugin::CompleteL" );
+
+    iCancelled = ETrue;
+    if ( !iMessage.IsNull() )
+        {
+        if ( aStatus == KErrNone )
+            {
+            iMessage.WriteL( iReplySlot, iAuthPairBuff );
+            }
+
+        iMessage.Complete( aStatus );
+        }
+    Cancel();
+
+    CLOG_LEAVEFN( "CConnDlgAuthenticationPlugin::CompleteL" );
+    }
+
+
+// ---------------------------------------------------------
+// CConnDlgAuthenticationPlugin* CConnDlgAuthenticationPlugin::NewL()
+// ---------------------------------------------------------
+//
+CConnDlgAuthenticationPlugin* CConnDlgAuthenticationPlugin::NewL( 
+                                        const TBool aResourceFileResponsible )
+    {
+    CConnDlgAuthenticationPlugin* self = new (ELeave) 
+                                                CConnDlgAuthenticationPlugin();
+    CleanupStack::PushL( self );
+    self->ConstructL( KResourceFileName, aResourceFileResponsible );
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+
+// ---------------------------------------------------------
+// CConnDlgAuthenticationPlugin::CConnDlgAuthenticationPlugin()
+// ---------------------------------------------------------
+//
+CConnDlgAuthenticationPlugin::CConnDlgAuthenticationPlugin()
+: iAuthPair( TAuthenticationPair() )
+    {
+    }
+
+
+// ---------------------------------------------------------
+// CConnDlgQosPlugin::TNotifierInfo CConnDlgQosPlugin::RegisterL()
+// ---------------------------------------------------------
+//
+CConnDlgQosPlugin::TNotifierInfo CConnDlgQosPlugin::RegisterL()
+    {
+    iInfo.iUid = KUidCConnDlgQos;
+    iInfo.iPriority = ENotifierPriorityHigh;
+    iInfo.iChannel = KUidCConnDlgQos;
+
+    return iInfo;
+    }
+
+
+// ---------------------------------------------------------
+// void CConnDlgQosPlugin::StartL
+// ---------------------------------------------------------
+//
+void CConnDlgQosPlugin::StartL( const TDesC8& /*aBuffer*/, TInt aReplySlot,
+                                const RMessagePtr2& aMessage )
+    {
+    iReplySlot = aReplySlot;
+    iMessage = aMessage;
+    iCancelled = EFalse;
+
+    GetReconnectL();
+    }
+
+
+// ---------------------------------------------------------
+// void CConnDlgQosPlugin::Cancel()
+// ---------------------------------------------------------
+//
+void CConnDlgQosPlugin::Cancel()
+    {
+    if ( !iCancelled )
+        {
+        iCancelled = ETrue;
+        if ( !iMessage.IsNull() )
+            {
+            iMessage.Complete( KErrCancel );
+            }
+        delete iDialog;
+        iDialog = NULL;
+        }
+    }
+
+
+// ---------------------------------------------------------
+// void CConnDlgQosPlugin::GetReconnectL()
+// ---------------------------------------------------------
+//
+void CConnDlgQosPlugin::GetReconnectL()
+    {
+    iDialog = new (ELeave) CQosDialog( this, iBool );
+    iDialog->ExecuteLD( R_CONNDLG_QOS );
+    }
+
+
+// ---------------------------------------------------------
+// void CConnDlgQosPlugin::CompleteL( TInt aStatus )
+// ---------------------------------------------------------
+//
+void CConnDlgQosPlugin::CompleteL( TInt aStatus )
+    {
+    iCancelled = ETrue;
+    if ( !iMessage.IsNull() )
+        {
+        if ( aStatus == KErrNone )
+            {
+            TRAP_IGNORE( iMessage.WriteL( iReplySlot, TPckg<TBool>( iBool ) ) );
+            }
+
+        iMessage.Complete( aStatus );
+        }
+    Cancel();
+    }
+
+
+// ---------------------------------------------------------
+// CConnDlgQosPlugin* CConnDlgQosPlugin::NewL()
+// ---------------------------------------------------------
+//
+CConnDlgQosPlugin* CConnDlgQosPlugin::NewL( 
+                                        const TBool aResourceFileResponsible )
+    {
+    CConnDlgQosPlugin* self = new (ELeave) CConnDlgQosPlugin();
+    CleanupStack::PushL( self );
+    self->ConstructL( KResourceFileName, aResourceFileResponsible );
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+
+// ---------------------------------------------------------
+// CConnDlgReconnectPlugin::RegisterL()
+// ---------------------------------------------------------
+//
+CConnDlgReconnectPlugin::TNotifierInfo CConnDlgReconnectPlugin::RegisterL()
+    {
+    iInfo.iUid = KUidCConnDlgReconnect;
+    iInfo.iPriority = ENotifierPriorityHigh;
+    iInfo.iChannel = KUidCConnDlgReconnect;
+
+    return iInfo;
+    }
+
+
+// ---------------------------------------------------------
+// void CConnDlgReconnectPlugin::StartL
+// ---------------------------------------------------------
+//
+void CConnDlgReconnectPlugin::StartL( const TDesC8& /*aBuffer*/, 
+                                      TInt aReplySlot,
+                                      const RMessagePtr2& aMessage )
+    {
+    iReplySlot = aReplySlot;
+    iMessage = aMessage;
+    iCancelled = EFalse;
+
+    GetReconnectL();
+    }
+
+
+// ---------------------------------------------------------
+// void CConnDlgReconnectPlugin::Cancel()
+// ---------------------------------------------------------
+//
+void CConnDlgReconnectPlugin::Cancel()
+    {
+    if ( !iCancelled )
+        {
+        iCancelled = ETrue;
+        if ( !iMessage.IsNull() )
+            {
+            iMessage.Complete( KErrCancel );
+            }
+        delete iDialog;
+        iDialog = NULL;
+        }
+    }
+
+
+// ---------------------------------------------------------
+// void CConnDlgReconnectPlugin::GetReconnectL()
+// ---------------------------------------------------------
+//
+void CConnDlgReconnectPlugin::GetReconnectL()
+    {
+    iDialog = new (ELeave) CReconnectDialog( this, iBool );
+    iDialog->ExecuteLD( R_CONNDLG_RECONNECT );
+    }
+
+
+// ---------------------------------------------------------
+// void CConnDlgReconnectPlugin::CompleteL( TInt aStatus )
+// ---------------------------------------------------------
+//
+void CConnDlgReconnectPlugin::CompleteL( TInt aStatus )
+    {
+    iCancelled = ETrue;
+    if ( !iMessage.IsNull() )
+        {
+        if ( aStatus == KErrNone )
+            {
+            iMessage.WriteL( iReplySlot, TPckg<TBool>( iBool ) );
+            }
+
+        iMessage.Complete( aStatus );
+        }
+    Cancel();
+    
+    }
+
+
+// ---------------------------------------------------------
+// CConnDlgReconnectPlugin* CConnDlgReconnectPlugin::NewL()
+// ---------------------------------------------------------
+//
+CConnDlgReconnectPlugin* CConnDlgReconnectPlugin::NewL( 
+                                        const TBool aResourceFileResponsible )
+    {
+    CConnDlgReconnectPlugin* self = new (ELeave) CConnDlgReconnectPlugin();
+    CleanupStack::PushL( self );
+    self->ConstructL( KResourceFileName, aResourceFileResponsible );
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+
+// ---------------------------------------------------------
+// CConnDlgNewIapPlugin::TNotifierInfo CConnDlgNewIapPlugin::RegisterL()
+// ---------------------------------------------------------
+//
+CConnDlgNewIapPlugin::TNotifierInfo CConnDlgNewIapPlugin::RegisterL()
+    {
+    iInfo.iUid = KUidCConnDlgNewIap;
+    iInfo.iPriority = ENotifierPriorityHigh;
+    iInfo.iChannel = KUidCConnDlgNewIap;
+
+    return iInfo;
+    }
+
+
+// ---------------------------------------------------------
+// void CConnDlgNewIapPlugin::StartL
+// ---------------------------------------------------------
+//
+
+void CConnDlgNewIapPlugin::StartL( const TDesC8& aBuffer, TInt aReplySlot,
+                                   const RMessagePtr2& aMessage )
+    {
+    if ( aBuffer.Length() > iPrefs.Length() )
+        {
+        User::Panic( KConnDlgPluginPanic, EConnDlgIllegalRequest );
+        }
+
+    iPrefs.Copy( aBuffer );
+    iReplySlot = aReplySlot;
+    iMessage = aMessage;
+    iCancelled = EFalse;
+
+    GetNewIapL();
+    }
+
+
+// ---------------------------------------------------------
+// void CConnDlgNewIapPlugin::Cancel()
+// ---------------------------------------------------------
+//
+void CConnDlgNewIapPlugin::Cancel()
+    {
+    if ( !iCancelled )
+        {
+        iCancelled = ETrue;
+        if ( !iMessage.IsNull() )
+            {
+            iMessage.Complete( KErrCancel );
+            }
+        delete iDialog;
+        iDialog = NULL;
+        }
+    }
+
+
+// ---------------------------------------------------------
+// void CConnDlgNewIapPlugin::GetNewIapL()
+// ---------------------------------------------------------
+//
+void CConnDlgNewIapPlugin::GetNewIapL()
+    {
+    iDialog = new (ELeave) CNewIapDialog( this, iConnect, iPrefs() );
+    iDialog->ExecuteLD( R_CONNDLG_NEW_IAP );
+    }
+
+
+// ---------------------------------------------------------
+// void CConnDlgNewIapPlugin::CompleteL( TInt aStatus )
+// ---------------------------------------------------------
+//
+void CConnDlgNewIapPlugin::CompleteL( TInt aStatus )
+    {
+    iCancelled = ETrue;
+    if ( !iMessage.IsNull() )
+        {
+        if ( aStatus == KErrNone )
+            {
+            iMessage.WriteL( iReplySlot, TPckg<TBool>( iConnect ) );
+            }
+
+        iMessage.Complete( aStatus );
+        }
+    Cancel();
+    }
+
+
+// ---------------------------------------------------------
+// CConnDlgNewIapPlugin* CConnDlgNewIapPlugin::NewL()
+// ---------------------------------------------------------
+//
+CConnDlgNewIapPlugin* CConnDlgNewIapPlugin::NewL( 
+                                        const TBool aResourceFileResponsible )
+    {
+    CConnDlgNewIapPlugin* self = new (ELeave) CConnDlgNewIapPlugin();
+    CleanupStack::PushL( self );
+    self->ConstructL( KResourceFileName, aResourceFileResponsible );
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+    
+// ---------------------------------------------------------
+// CConnDlgSelectConnectionPlugin::TNotifierInfo 
+//                                  CConnDlgSelectConnectionPlugin::RegisterL()
+// ---------------------------------------------------------
+//
+CConnDlgSelectConnectionPlugin::TNotifierInfo 
+                                    CConnDlgSelectConnectionPlugin::RegisterL()
+    {
+    iInfo.iUid = KUidCConnDlgSelectConn;
+    iInfo.iPriority = ENotifierPriorityHigh;
+    iInfo.iChannel = KUidCConnDlgSelectConn;
+
+    return iInfo;
+    }
+
+
+// ---------------------------------------------------------
+// void CConnDlgSelectConnectionPlugin::StartL
+// ---------------------------------------------------------
+//
+
+void CConnDlgSelectConnectionPlugin::StartL( const TDesC8& aBuffer, 
+                                             TInt aReplySlot,
+                                             const RMessagePtr2& aMessage )
+    {
+    if ( iActivePlugin )
+        {
+        aMessage.Complete( KErrServerBusy );
+        return;
+        }
+        
+    iPrefs.Copy( ( TPtrC8 ) aBuffer );
+
+    iCancelled = ETrue; // This method could leave before displaying the dialog.
+    iReplySlot = aReplySlot;
+    iMessage = aMessage;
+    
+    __ASSERT_DEBUG( !iActivePlugin, 
+                     User::Panic( KErrActiveObjectNull, KErrNone ) );
+    
+    iElementID = iPrefs().iRank;
+    iActivePlugin = CActiveSelectConnectionPlugin::NewL( this,
+                                                         iElementID,
+                                                         iPrefs().iBearerSet );
+    // Check if there is a suitable active connection
+    TInt snap( 0 );
+    TInt iap( 0 );
+    TInt bearer( ECommDbBearerWLAN ); // User conn. is always WLAN in 9.1
+    
+    // Is there active User connection
+    TInt err = GetUserConnection( iap, snap );
+    
+    if ( ( err != KErrNone ) || ( iap == 0 && snap == 0 ) )
+        {
+        // Is there any active connection
+    	err = GetActiveConnection( iap, snap, bearer );
+        }
+                                      
+    if ( ( err == KErrNone ) && 
+         ( iap != 0 || snap != 0 ) && 
+         ( iPrefs().iBearerSet & bearer ) &&
+         ( iPrefs().iDirection == 0 ) )     // JavaVM sets iDirection to "1"
+        {
+    	// a suitable connection is already active
+    	SetElementIDL( iap, snap );
+    	CompleteL( KErrNone );
+        }
+    else
+        {
+        // display dialog
+        iActivePlugin->ShowSelectConnectionL();
+        iCancelled = EFalse; // Dialog is now up and running
+        }
+    }
+
+
+
+// ---------------------------------------------------------
+// void CConnDlgSelectConnectionPlugin::Cancel()
+// ---------------------------------------------------------
+//
+void CConnDlgSelectConnectionPlugin::Cancel()
+    {
+    CLOG_ENTERFN( "CConnDlgSelectConnectionPlugin::Cancel" );      
+
+    delete iActivePlugin;
+    CLOG_WRITE( "iActivePlugin deleted" );      
+    iActivePlugin = NULL;
+    CLOG_WRITE( "iActivePlugin NULLed" );      
+    
+    if ( !iCancelled )
+        {
+        CLOG_WRITE( "iCancelled == EFalse" );      
+        iCancelled = ETrue;
+        if ( !iMessage.IsNull() )
+            {
+            CLOG_WRITE( "Going to Complete iMessage (KErrCancel)" );      
+            iMessage.Complete( KErrCancel );
+            CLOG_WRITE( "iMessage completed" );
+            }
+        }
+
+    CLOG_LEAVEFN( "CConnDlgSelectConnectionPlugin::Cancel" );      
+    }
+
+
+// ---------------------------------------------------------
+// void CConnDlgSelectConnectionPlugin::CompleteL( TInt aStatus )
+// ---------------------------------------------------------
+//
+void CConnDlgSelectConnectionPlugin::CompleteL( TInt aStatus )
+    {
+    CLOG_ENTERFN( "CConnDlgSelectConnectionPlugin::CompleteL" );      
+
+    iCancelled = ETrue;
+    if ( !iMessage.IsNull() )
+        {
+        if ( aStatus == KErrNone )
+            {
+            iMessage.WriteL( iReplySlot, TPckg<TUint32>( iElementID ) );
+            }
+        
+        CLOG_WRITEF( _L( "CConnDlgSelectConnectionPlugin::CompleteL iElementID : %d" ), iElementID );
+                
+        iMessage.Complete( aStatus );
+        }
+    Cancel();
+
+    CLOG_LEAVEFN( "CConnDlgSelectConnectionPlugin::CompleteL" );   
+    }
+
+
+// ---------------------------------------------------------
+// CConnDlgSelectConnectionPlugin* CConnDlgSelectConnectionPlugin::NewL()
+// ---------------------------------------------------------
+//
+CConnDlgSelectConnectionPlugin* CConnDlgSelectConnectionPlugin::NewL( 
+                                        const TBool aResourceFileResponsible )
+    {
+    CConnDlgSelectConnectionPlugin* self = 
+                            new (ELeave) CConnDlgSelectConnectionPlugin();
+    CleanupStack::PushL( self );
+    self->ConstructL( KResourceFileName, aResourceFileResponsible );
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+
+// ---------------------------------------------------------
+// CConnDlgSelectConnectionPlugin::SetSelectedIDsL
+// ---------------------------------------------------------
+//    
+void CConnDlgSelectConnectionPlugin::SetElementIDL( TUint32 aIAPId, 
+                                                    TUint32 aDestinationId )
+    {
+    iElementID = iActivePlugin->GetElementIDL( aIAPId, aDestinationId );
+    }
+    
+    
+// ---------------------------------------------------------
+// CConnDlgSelectConnectionPlugin::GetUserConnection
+// ---------------------------------------------------------
+//    
+TInt CConnDlgSelectConnectionPlugin::GetUserConnection( TInt& aIapId, 
+                                                        TInt& aSnapId )
+    {
+    aIapId  = 0;
+    aSnapId = 0;
+    
+    TInt err = RProperty::Get( KMPMUserConnectionCategory, 
+                               KMPMPSKeyUserConnectionSnap, 
+                               aSnapId );
+    
+    if ( err != KErrNone || aSnapId == 0 )
+        {
+        err = RProperty::Get( KMPMUserConnectionCategory, 
+                              KMPMPSKeyUserConnectionIap, 
+                              aIapId );
+        }
+       
+    CLOG_WRITEF( _L( "KMPMPSKeyUserConnectionSnap : %d" ), aSnapId );                      
+    CLOG_WRITEF( _L( "KMPMPSKeyUserConnectionIap : %d" ), aIapId );                           
+    CLOG_WRITEF( _L( "err : %d" ), err );
+        
+    return err;    
+    }
+
+
+// ---------------------------------------------------------
+// CConnDlgSelectConnectionPlugin::GetActiveConnection
+// ---------------------------------------------------------
+//    
+TInt CConnDlgSelectConnectionPlugin::GetActiveConnection( TInt& aIapId, 
+                                                          TInt& aSnapId,
+                                                          TInt& aBearer )
+    {
+    aIapId  = 0;
+    aSnapId = 0;
+    aBearer = 0;
+    
+    TInt err = RProperty::Get( KMPMActiveConnectionCategory, 
+                               KMPMPSKeyActiveConnectionSnap, 
+                               aSnapId );
+                                  
+    if ( err != KErrNone || aSnapId == 0 )
+        {
+        err = RProperty::Get( KMPMActiveConnectionCategory, 
+                              KMPMPSKeyActiveConnectionIap, 
+                              aIapId );
+        }
+         
+    CLOG_WRITEF( _L( "KMPMPSKeyActiveConnectionSnap : %d" ), aSnapId );                      
+    CLOG_WRITEF( _L( "KMPMPSKeyActiveConnectionIap : %d" ), aIapId );                           
+    CLOG_WRITEF( _L( "err : %d" ), err );                           
+                               
+    if ( err == KErrNone )
+        {
+    	err = RProperty::Get( KMPMActiveConnectionCategory, 
+                              KMPMPSKeyActiveConnectionBearer, 
+                              aBearer );
+        }
+
+    CLOG_WRITEF( _L( "KMPMPSKeyActiveConnectionBearer : %d" ), aBearer );                           
+    CLOG_WRITEF( _L( "iPrefs().iBearerSet : %d" ), iPrefs().iBearerSet );
+    CLOG_WRITEF( _L( "err : %d" ), err );
+    
+    return err;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/cconndlg/src/IAPDialog.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,266 @@
+/*
+* Copyright (c) 2002 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 CIapDialog.
+*
+*/
+
+
+// INCLUDE FILES
+#include "IAPDialog.h"
+#include "ConnectionInfo.h"
+#include "ConnectionInfoArray.h"
+#include "ConnDlgPlugin.h"
+#include "ConnectionDialogsLogger.h"
+#include "ExpiryTimer.h"
+
+#include <AknIconArray.h>
+#include <AknsUtils.h>
+#include <uikon/eiksrvui.h>
+
+#include <data_caging_path_literals.hrh>
+#include <apsettings.mbg>
+
+
+// CONST DECLARATIONS
+
+// ROM folder
+_LIT( KDriveZ, "z:" );
+
+
+// Name of the MBM file containing icons
+_LIT( KApsettingsMBMFile, "ApSettings.mbm" );
+
+#if defined(_DEBUG)
+_LIT( KErrNullPointer, "NULL pointer" );
+#endif
+
+// CONSTANTS
+
+LOCAL_D const TInt KIconsGranularity = 4;
+
+
+// ================= MEMBER FUNCTIONS =======================
+//
+// ---------------------------------------------------------
+// CIapDialog::CIapDialog
+// ---------------------------------------------------------
+//
+CIapDialog::CIapDialog( CConnDlgIapPlugin* aPlugin )
+: CAknListQueryDialog( &iDummy ),
+  iPlugin( aPlugin ),
+  iFromOkToExit( EFalse )
+    {
+    }
+
+
+// ---------------------------------------------------------
+// CIapDialog::NewL
+// ---------------------------------------------------------
+//
+CIapDialog* CIapDialog::NewL( CConnDlgIapPlugin* aPlugin )
+    {
+    CIapDialog* self = new( ELeave ) CIapDialog( aPlugin );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+
+// ---------------------------------------------------------
+// CIapDialog::ConstructL()
+// ---------------------------------------------------------
+//
+void CIapDialog::ConstructL()
+    {
+    }
+
+
+// ---------------------------------------------------------
+// CIapDialog::~CIapDialog()
+// ---------------------------------------------------------
+//
+CIapDialog::~CIapDialog()
+    {
+    CLOG_ENTERFN( "CIapDialog::~CIapDialog " );
+    iIAPIds.Close();
+    delete iExpiryTimer;
+    STATIC_CAST( CEikServAppUi*, 
+                CCoeEnv::Static()->AppUi() )->SuppressAppSwitching( EFalse );
+    CLOG_LEAVEFN( "CIapDialog::~CIapDialog " );
+    }
+
+
+// ---------------------------------------------------------
+// CIapDialog::PreLayoutDynInitL()
+// ---------------------------------------------------------
+//
+void CIapDialog::PreLayoutDynInitL()
+    {
+    CLOG_ENTERFN( "CIapDialog::PreLayoutDynInitL " );  
+    
+    CAknListQueryDialog::PreLayoutDynInitL();
+
+    SetOwnershipType( ELbmDoesNotOwnItemArray );
+    SetIconsL();
+
+    STATIC_CAST( CEikServAppUi*, 
+                CCoeEnv::Static()->AppUi() )->SuppressAppSwitching( ETrue );
+
+    iExpiryTimer = CExpiryTimer::NewL( *this );
+    iExpiryTimer->Start();
+    
+    CLOG_LEAVEFN( "CIapDialog::PreLayoutDynInitL " );      
+    }
+
+
+// ---------------------------------------------------------
+// CIapDialog::SetIconsL()
+// ---------------------------------------------------------
+//
+void CIapDialog::SetIconsL()
+    {
+    CLOG_ENTERFN( "CIapDialog::SetIconsL " );  
+    
+    CArrayPtr< CGulIcon >* icons = new( ELeave ) CAknIconArray( 
+                                                        KIconsGranularity );
+    CleanupStack::PushL( icons );
+
+    MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
+
+    TFileName iconsFileName;
+
+    iconsFileName.Append( KDriveZ );
+    iconsFileName.Append( KDC_APP_BITMAP_DIR );
+    iconsFileName.Append( KApsettingsMBMFile );
+
+    icons->AppendL( AknsUtils::CreateGulIconL( skinInstance, 
+                            KAknsIIDQgnPropWmlGprs,
+                            iconsFileName, 
+                            EMbmApsettingsQgn_prop_wml_gprs, 
+                            EMbmApsettingsQgn_prop_wml_gprs_mask ) );
+
+    icons->AppendL( AknsUtils::CreateGulIconL( skinInstance, 
+                            KAknsIIDQgnPropWmlCsd,
+                            iconsFileName, 
+                            EMbmApsettingsQgn_prop_wml_csd, 
+                            EMbmApsettingsQgn_prop_wml_csd_mask ) );
+
+    icons->AppendL( AknsUtils::CreateGulIconL( skinInstance, 
+                            KAknsIIDQgnPropWmlHscsd,
+                            iconsFileName, 
+                            EMbmApsettingsQgn_prop_wml_hscsd, 
+                            EMbmApsettingsQgn_prop_wml_hscsd_mask ) );
+
+    icons->AppendL( AknsUtils::CreateGulIconL( skinInstance, 
+                        KAknsIIDQgnPropWlanEasy,
+                        iconsFileName, 
+                        EMbmApsettingsQgn_prop_wlan_easy, 
+                        EMbmApsettingsQgn_prop_wlan_easy_mask ) );
+
+    icons->AppendL( AknsUtils::CreateGulIconL( skinInstance, 
+                        KAknsIIDQgnPropWlanBearer,
+                        iconsFileName, 
+                        EMbmApsettingsQgn_prop_wlan_bearer, 
+                        EMbmApsettingsQgn_prop_wlan_bearer_mask ) );
+    
+    SetIconArrayL( icons );
+
+    CleanupStack::Pop( icons );
+    CLOG_LEAVEFN( "CIapDialog::SetIconsL " );      
+    }
+
+
+// ---------------------------------------------------------
+// CIapDialog::OkToExitL
+// ---------------------------------------------------------
+//
+TBool CIapDialog::OkToExitL( TInt aButtonId )
+    {
+    CLOG_ENTERFN( "CIapDialog::OkToExitL " );      
+    
+    TBool result( EFalse );
+    TInt completeCode( KErrNone );
+    
+    if ( aButtonId == EAknSoftkeySelect || aButtonId == EAknSoftkeyOk ||
+         aButtonId == EAknSoftkeyDone )
+        {
+        iPlugin->SetPreferredIapIdL( iIAPIds[ListBox()->CurrentItemIndex()] );
+        result = ETrue;
+        }
+    else if ( aButtonId == EAknSoftkeyCancel )
+        {
+        completeCode = KErrCancel;
+        result = ETrue;
+        }
+        
+    if ( result )
+        {
+        iFromOkToExit = ETrue;        
+        
+        __ASSERT_DEBUG( iPlugin, User::Panic( KErrNullPointer, KErrNone ) );
+        iPlugin->CompleteL( completeCode );
+        }
+
+    CLOG_LEAVEFN( "CIapDialog::OkToExitL " );      
+
+    return result;
+    }
+
+
+// ---------------------------------------------------------
+// CIapDialog::RefreshDialogL
+// ---------------------------------------------------------
+//    
+void CIapDialog::RefreshDialogL( CConnectionInfoArray* aIAP, 
+                                 TBool aIsReallyRefreshing )
+    {  
+    CLOG_ENTERFN( "CIapDialog::RefreshDialogL " );  
+     
+    SetItemTextArray( aIAP );
+
+    iIAPIds.Reset();
+    
+    TInt numAPs = aIAP->Count();
+    for( TInt ii = 0; ii < numAPs; ii++ )
+        {
+        TUint32 id = aIAP->At( ii )->Id();
+        iIAPIds.AppendL( id );        
+        }
+    
+    ListBox()->SetCurrentItemIndex( 0 );
+
+    ListBox()->HandleItemAdditionL();
+
+    if ( aIsReallyRefreshing )
+        {   // If we are really making a refresh, we need to recalculate the 
+            // layout, because the number of items could be different and the
+            // dialog should be resized accordingly
+        Layout();   
+        SizeChanged();
+        DrawNow();
+        }
+
+    CLOG_LEAVEFN( "CIapDialog::RefreshDialogL " );  
+    }
+
+void CIapDialog::HandleTimedOut()
+    {
+    TRAP_IGNORE( TryExitL(EAknSoftkeyCancel) );
+    }
+
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/cconndlg/src/NewIapDialog.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,111 @@
+/*
+* Copyright (c) 2002 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 CNewIapDialog.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "NewIapDialog.h"
+#include "ConnDlgPlugin.h"
+#include "ExpiryTimer.h"
+
+#include <uikon/eiksrvui.h>
+#include <StringLoader.h>
+
+#include <CConnDlgPlugin.rsg>
+
+
+// CONST DECLARATIONS
+
+#if defined(_DEBUG)
+_LIT( KErrNullPointer, "NULL pointer" );
+#endif
+
+
+// ================= MEMBER FUNCTIONS =======================
+//
+// ---------------------------------------------------------
+// CNewIapDialog::CNewIapDialog
+// ---------------------------------------------------------
+//
+CNewIapDialog::CNewIapDialog( CConnDlgNewIapPlugin* aPlugin, TBool& aConnect,
+                              const TNewIapConnectionPrefs& aPrefs )
+: iPlugin( aPlugin ),
+  iConnect( aConnect ),
+  iPrefs( aPrefs )
+    {
+    }
+
+
+// ---------------------------------------------------------
+// CNewIapDialog::~CNewIapDialog
+// ---------------------------------------------------------
+//
+CNewIapDialog::~CNewIapDialog()
+    {
+    STATIC_CAST( CEikServAppUi*, 
+                CCoeEnv::Static()->AppUi() )->SuppressAppSwitching( EFalse );
+    delete iExpiryTimer;
+    }
+
+// ---------------------------------------------------------
+// CNewIapDialog::PreLayoutDynInitL
+// ---------------------------------------------------------
+//
+void CNewIapDialog::PreLayoutDynInitL()
+    {
+    CAknQueryDialog::PreLayoutDynInitL();
+
+    STATIC_CAST( CEikServAppUi*, 
+                CCoeEnv::Static()->AppUi() )->SuppressAppSwitching( ETrue );
+
+    // New connection name
+    HBufC *msg = StringLoader::LoadL( R_CONNDLG_NEW_CONNECTION_ATTEMPT, 
+                                      iPrefs.iName );
+    CleanupStack::PushL( msg );
+    SetPromptL( msg->Des() );
+    CleanupStack::PopAndDestroy( msg );
+    
+    iExpiryTimer = CExpiryTimer::NewL( *this );
+    iExpiryTimer->Start();
+    }
+
+
+// ---------------------------------------------------------
+// CNewIapDialog::OkToExitL
+// ---------------------------------------------------------
+//
+TBool CNewIapDialog::OkToExitL( TInt aButtonId )
+    {
+    iConnect = EFalse;
+    if ( aButtonId == EAknSoftkeyYes || aButtonId == EAknSoftkeyDone || 
+         aButtonId == EAknSoftkeyOk )
+        {
+        iConnect = ETrue;
+        }
+
+    __ASSERT_DEBUG( iPlugin, User::Panic( KErrNullPointer, KErrNone ) );
+    iPlugin->CompleteL( KErrNone );
+
+    return( ETrue );
+    }
+
+void CNewIapDialog::HandleTimedOut()
+    {
+    TRAP_IGNORE( TryExitL(EAknSoftkeyCancel) );
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/cconndlg/src/QosDialog.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,99 @@
+/*
+* Copyright (c) 2002 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 CQosDialog.
+*
+*/
+
+
+// INCLUDE FILES
+#include "QosDialog.h"
+#include "ConnDlgPlugin.h"
+#include "ExpiryTimer.h"
+
+#include <uikon/eiksrvui.h>
+
+
+// CONSTANTS
+#if defined(_DEBUG)
+_LIT( KErrNullPointer, "NULL pointer" );
+#endif
+
+
+// ================= MEMBER FUNCTIONS =======================
+//
+// ---------------------------------------------------------
+// CQosDialog::CQosDialog
+// ---------------------------------------------------------
+//
+CQosDialog::CQosDialog( CConnDlgQosPlugin* aPlugin, TBool& aBool )
+: iPlugin( aPlugin ),
+  iBool( aBool )
+    {
+    }
+    
+    
+// ---------------------------------------------------------
+// CQosDialog::~CQosDialog
+// ---------------------------------------------------------
+//
+CQosDialog::~CQosDialog()
+    {
+    STATIC_CAST( CEikServAppUi*, 
+                CCoeEnv::Static()->AppUi() )->SuppressAppSwitching( EFalse );
+    delete iExpiryTimer;
+    }
+
+
+// ---------------------------------------------------------
+// CQosDialog::PreLayoutDynInitL()
+// ---------------------------------------------------------
+//
+void CQosDialog::PreLayoutDynInitL()
+    {
+    CAknQueryDialog::PreLayoutDynInitL();
+    
+    iExpiryTimer = CExpiryTimer::NewL( *this );
+    iExpiryTimer->Start();
+    
+    STATIC_CAST( CEikServAppUi*, 
+                CCoeEnv::Static()->AppUi() )->SuppressAppSwitching( ETrue );
+    }
+
+
+// ---------------------------------------------------------
+// CQosDialog::OkToExitL
+// ---------------------------------------------------------
+//
+TBool CQosDialog::OkToExitL( TInt aButtonId )
+    {
+    iBool = EFalse;
+    if ( aButtonId == EAknSoftkeyYes || aButtonId == EAknSoftkeyDone ||
+         aButtonId == EAknSoftkeyOk )
+        {
+        iBool = ETrue;
+        }
+
+
+    __ASSERT_DEBUG( iPlugin, User::Panic( KErrNullPointer, KErrNone ) );
+    iPlugin->CompleteL( KErrNone );
+
+    return ETrue;
+    }
+
+void CQosDialog::HandleTimedOut()
+    {
+    TRAP_IGNORE( TryExitL(EAknSoftkeyCancel) );
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/cconndlg/src/ReconnectDialog.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,99 @@
+/*
+* Copyright (c) 2002 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 CReconnectDialog.
+*
+*/
+
+
+// INCLUDE FILES
+#include "ReconnectDialog.h"
+#include "ConnDlgPlugin.h"
+#include "ExpiryTimer.h"
+
+#include <uikon/eiksrvui.h>
+
+
+// CONSTANTS
+#if defined(_DEBUG)
+_LIT( KErrNullPointer, "NULL pointer" );
+#endif
+
+
+// ================= MEMBER FUNCTIONS =======================
+//
+// ---------------------------------------------------------
+// CReconnectDialog::CReconnectDialog
+// ---------------------------------------------------------
+//
+CReconnectDialog::CReconnectDialog( CConnDlgReconnectPlugin* aPlugin, 
+                                    TBool& aBool )
+: iPlugin( aPlugin ),
+  iBool( aBool )
+    {
+    }
+
+
+// ---------------------------------------------------------
+// CReconnectDialog::~CReconnectDialog
+// ---------------------------------------------------------
+//
+CReconnectDialog::~CReconnectDialog()
+    {
+    STATIC_CAST( CEikServAppUi*, 
+                CCoeEnv::Static()->AppUi() )->SuppressAppSwitching( EFalse );
+    delete iExpiryTimer;
+    }
+
+// ---------------------------------------------------------
+// CReconnectDialog::PreLayoutDynInitL()
+// ---------------------------------------------------------
+//
+void CReconnectDialog::PreLayoutDynInitL()
+    {
+    CAknQueryDialog::PreLayoutDynInitL();
+    
+    iExpiryTimer = CExpiryTimer::NewL( *this );
+    iExpiryTimer->Start();
+    
+    STATIC_CAST( CEikServAppUi*, 
+                CCoeEnv::Static()->AppUi() )->SuppressAppSwitching( ETrue );
+    }
+
+
+// ---------------------------------------------------------
+// CReconnectDialog::OkToExitL
+// ---------------------------------------------------------
+//
+TBool CReconnectDialog::OkToExitL( TInt aButtonId )
+    {
+    iBool = EFalse;
+    if ( aButtonId == EAknSoftkeyYes || aButtonId == EAknSoftkeyDone || 
+         aButtonId == EAknSoftkeyOk )
+        {
+        iBool = ETrue;
+        }
+
+
+    __ASSERT_DEBUG( iPlugin, User::Panic( KErrNullPointer, KErrNone ) );
+    iPlugin->CompleteL( KErrNone );
+
+    return ETrue;
+    }
+
+void CReconnectDialog::HandleTimedOut()
+    {
+    TRAP_IGNORE( TryExitL(EAknSoftkeyCancel) );
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/cconndlg/src/SelectConnectionDialog.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,562 @@
+/*
+* Copyright (c) 2002 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 CSelectConnectionDialog.
+*
+*/
+
+
+// INCLUDE FILES
+#include "SelectConnectionDialog.h"
+#include "ConnectionInfo.h"
+#include "ConnectionInfoArray.h"
+#include "ConnectionDialogsLogger.h"
+#include "ActiveSelectExplicit.h"
+#include "ExpiryTimer.h"
+#include "ConnectionDialogs.hrh"
+
+
+#include "ConnDlgPlugin.h"
+#include <CConnDlgPlugin.rsg>
+
+#include <uikon/eiksrvui.h>
+
+#include <AknsFrameBackgroundControlContext.h>
+#include <aknsoundsystem.h>
+#include <AknsDrawUtils.h>
+#include <aknnotewrappers.h>
+#include <StringLoader.h>
+#include <eiklbi.h>
+
+// CONST DECLARATIONS
+
+#if defined(_DEBUG)
+_LIT( KErrNullPointer, "NULL pointer" );
+_LIT( KErrActiveObjectNull, "iActiveSelectExplicit not NULL" );
+#endif
+
+
+
+// ================= MEMBER FUNCTIONS =======================
+//
+// ---------------------------------------------------------
+// CSelectConnectionDialog::CSelectConnectionDialog
+// ---------------------------------------------------------
+//
+CSelectConnectionDialog::CSelectConnectionDialog( 
+                                        MEikSrvNotifierBase2* aPlugin,
+                                        TInt aRefreshInterval,
+                                        TUint32 aBearerSet, 
+                                        TBool aIsWLANFeatureSupported,
+                                        TUint aDefaultCMId )
+: CAknListQueryDialog( &iDummy ),
+  iPlugin( ( CConnDlgSelectConnectionPlugin* )aPlugin ),
+  iFromOkToExit( EFalse ),
+  iActiveSelectExplicit( NULL ),
+  iRefreshInterval( aRefreshInterval ),
+  iBearerSet( aBearerSet ),
+  iIsWLANFeatureSupported( aIsWLANFeatureSupported ),
+  iDefaultCMId( aDefaultCMId )
+    {
+    }
+
+
+// ---------------------------------------------------------
+// CSelectConnectionDialog::NewL
+// ---------------------------------------------------------
+//
+CSelectConnectionDialog* CSelectConnectionDialog::NewL( 
+                                                MEikSrvNotifierBase2* aPlugin,
+                                                TInt aRefreshInterval,
+                                                TUint32 aBearerSet, 
+                                                TBool aIsWLANFeatureSupported, 
+                                                TUint aDefaultCMId )
+    {
+    CSelectConnectionDialog* self = new( ELeave ) CSelectConnectionDialog( 
+                                                    aPlugin,
+                                                    aRefreshInterval,
+                                                    aBearerSet, 
+                                                    aIsWLANFeatureSupported, 
+                                                    aDefaultCMId );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+
+// ---------------------------------------------------------
+// CSelectConnectionDialog::ConstructL()
+// ---------------------------------------------------------
+//
+void CSelectConnectionDialog::ConstructL()
+    {
+    }
+
+
+// ---------------------------------------------------------
+// CSelectConnectionDialog::~CSelectConnectionDialog()
+// ---------------------------------------------------------
+//
+CSelectConnectionDialog::~CSelectConnectionDialog()
+    {
+    CLOG_ENTERFN( "CSelectConnectionDialog::~CSelectConnectionDialog " );
+    iIapIDs.Close();
+    iDestIDs.Close();
+    STATIC_CAST( CEikServAppUi*, 
+                CCoeEnv::Static()->AppUi() )->SuppressAppSwitching( EFalse );
+    delete iExpiryTimer;
+    CLOG_LEAVEFN( "CSelectConnectionDialog::~CSelectConnectionDialog " );
+    }
+
+
+// ---------------------------------------------------------
+// CSelectConnectionDialog::PreLayoutDynInitL()
+// ---------------------------------------------------------
+//
+void CSelectConnectionDialog::PreLayoutDynInitL()
+    {
+    CLOG_ENTERFN( "CSelectConnectionDialog::PreLayoutDynInitL " );  
+    
+    CAknListQueryDialog::PreLayoutDynInitL();
+
+    SetOwnershipType( ELbmDoesNotOwnItemArray );
+    SetIconArrayL( iIcons );
+
+    STATIC_CAST( CEikServAppUi*, 
+                CCoeEnv::Static()->AppUi() )->SuppressAppSwitching( ETrue );
+
+    iExpiryTimer = CExpiryTimer::NewL( *this );
+    iExpiryTimer->Start();
+    
+    CLOG_LEAVEFN( "CSelectConnectionDialog::PreLayoutDynInitL " );      
+    }
+
+
+// ---------------------------------------------------------
+// CSelectConnectionDialog::OkToExitL
+// ---------------------------------------------------------
+//
+TBool CSelectConnectionDialog::OkToExitL( TInt aButtonId )
+    {
+    CLOG_ENTERFN( "CSelectConnectionDialog::OkToExitL " );      
+    
+    TBool result( EFalse );
+    TInt completeCode( KErrNone );
+    
+    if ( aButtonId == EAknSoftkeySelect || aButtonId == EAknSoftkeyOk ||
+         aButtonId == EAknSoftkeyDone )
+        {
+        CLOG_WRITE( "OkToExitL Ok-ed" );  
+        TInt index = ListBox()->CurrentItemIndex();
+        if ( iIapIDs[index] == 0 && iDestIDs[index] == 0 ) 
+            {      // Uncategorized
+            ProcessCommandL( ESelectConnectionCmdChooseMethod );
+            }
+        else
+            {
+            iPlugin->SetElementIDL( iIapIDs[index], iDestIDs[index] );
+            result = ETrue;
+            }
+        }
+    else if ( aButtonId == EAknSoftkeyCancel )
+        {
+        CLOG_WRITE( "OkToExitL Cancel" );  
+        completeCode = KErrCancel;
+        result = ETrue;
+        }
+    else if ( aButtonId == EAknSoftkeyOptions )
+        {
+        if ( !( ListBox()->View()->ItemDrawer()->Flags() 
+               & CListItemDrawer::EDisableHighlight ) )
+            {
+            DisplayMenuL();
+            }
+        else
+            {
+            ListBox()->View()->ItemDrawer()->ClearFlags(
+               CListItemDrawer::EDisableHighlight );
+            DrawNow();
+            }
+        }
+        
+    if ( result )
+        {
+        iFromOkToExit = ETrue;        
+        
+        __ASSERT_DEBUG( iPlugin, User::Panic( KErrNullPointer, KErrNone ) );
+        CLOG_WRITE( "OkToExitL Going to CompleteL" );  
+        iPlugin->CompleteL( completeCode );
+        CLOG_WRITE( "OkToExitL Returned from CompleteL" );  
+        }
+
+    CLOG_LEAVEFN( "CSelectConnectionDialog::OkToExitL " );      
+
+    return result;
+    }
+
+
+// ---------------------------------------------------------
+// CSelectConnectionDialog::PrepareAndRunLD
+// ---------------------------------------------------------
+//    
+void CSelectConnectionDialog::PrepareAndRunLD( CConnectionInfoArray* aIAP,
+                                               CArrayPtr< CGulIcon >* aIcons,
+                                               TBool aIsReallyRefreshing,
+                                               const TInt aHighlightedItem )
+    {
+    PrepareLC( R_SELECT_CONNECTION_QUERY );
+    RefreshDialogL( aIAP, aIcons, aIsReallyRefreshing, aHighlightedItem );
+    RunLD();
+    }
+
+
+// ---------------------------------------------------------
+// CSelectConnectionDialog::RefreshDialogL
+// ---------------------------------------------------------
+//    
+void CSelectConnectionDialog::RefreshDialogL( CConnectionInfoArray* aIAP, 
+                                              CArrayPtr< CGulIcon >* aIcons,
+                                              TBool aIsReallyRefreshing,
+                                              const TInt aHighlightedItem )
+    {  
+    CLOG_ENTERFN( "CSelectConnectionDialog::RefreshDialogL " );  
+     
+    if ( aIAP->Count() == 0 )
+        {
+        ListBox()->Reset();	
+        }
+    else
+        {
+        SetItemTextArray( aIAP );	
+        } 
+    
+    iIcons = aIcons;
+
+    iIapIDs.Reset();
+    iDestIDs.Reset();
+
+    // Determine the preferred IAP
+    TInt numAPs = aIAP->Count();
+    for( TInt ii = 0; ii < numAPs; ii++ )
+        {
+        iIapIDs.AppendL( aIAP->At( ii )->Id() );
+        iDestIDs.AppendL( aIAP->At( ii )->DestinationId() );
+        }
+
+    if ( aHighlightedItem >= 0 && aHighlightedItem < numAPs )
+        {
+        ListBox()->SetCurrentItemIndex( aHighlightedItem );
+        if ( aHighlightedItem == 1 )
+            {
+            // To have the Search for Wlan also visible. But this is valid only
+            // if the highlighted item can be the first or the second, 
+            // otherwise we risk to hide the highlighted item!
+            ListBox()->ScrollToMakeItemVisible( 0 );    
+            }
+        }
+
+    ListBox()->HandleItemAdditionL();
+
+    if ( aHighlightedItem >= 0 && aHighlightedItem < numAPs )
+        {
+        CEikButtonGroupContainer& cba = ButtonGroupContainer();
+        HBufC* label;
+
+        if ( iIapIDs[aHighlightedItem] != 0 )
+            {       // Easy Wlan
+            label = StringLoader::LoadL( R_QTN_MSK_SELECT );
+            }
+        else if ( iDestIDs[aHighlightedItem] != 0 )
+            {       // Destination
+            label = StringLoader::LoadL( R_QTN_MSK_CONNECT );
+            }
+        else        // if ( iIapIDs[aHighlightedItem] == 0 && iDestIDs[aHighlightedItem] == 0 )
+            {      // Uncategorized
+            label = StringLoader::LoadL( R_QTN_MSK_OPEN );
+            }
+
+        CleanupStack::PushL( label );
+        cba.SetCommandL( EAknSoftkeyDone, label->Des() );
+        CleanupStack::PopAndDestroy(); // label
+        }
+
+    if ( aIsReallyRefreshing )
+        {   // If we are really making a refresh, we need to recalculate the 
+            // layout, because the number of items could be different and the
+            // dialog should be resized accordingly
+        Layout();   
+        SizeChanged();
+        DrawDeferred();
+        }
+
+    CLOG_LEAVEFN( "CSelectConnectionDialog::RefreshDialogL " );  
+    }
+    
+
+// ----------------------------------------------------------------------------
+// CSelectConnectionDialog::DynInitMenuPaneL
+// ----------------------------------------------------------------------------
+//
+void CSelectConnectionDialog::DynInitMenuPaneL( TInt aResourceId, 
+                                             CEikMenuPane* aMenuPane )
+    {
+    CAknListQueryDialog::DynInitMenuPaneL( aResourceId, aMenuPane );
+
+    if ( aResourceId == R_SELECT_CONNECTION_MENU_PANE )
+        {
+        if ( aMenuPane )
+            {
+            TInt index = ListBox()->CurrentItemIndex();
+
+            if ( iIapIDs[index] != 0 )   
+                {      // Easy Wlan
+                aMenuPane->DeleteMenuItem( ESelectConnectionCmdChooseMethod );
+                aMenuPane->DeleteMenuItem( ESelectConnectionCmdConnect );
+                }
+            else if ( iDestIDs[index] != 0 )
+                {       // Destination
+                aMenuPane->DeleteMenuItem( ESelectConnectionCmdSelect );
+                }
+            else // if ( iIapIDs[index] == 0 && iDestIDs[index] == 0 ) 
+                {      // Uncategorized
+                aMenuPane->DeleteMenuItem( ESelectConnectionCmdSelect );
+                aMenuPane->DeleteMenuItem( ESelectConnectionCmdConnect );
+                }
+            }
+        }
+    }
+
+
+// ----------------------------------------------------------------------------
+// CSelectConnectionDialog::ProcessCommandL
+// ----------------------------------------------------------------------------
+//
+void CSelectConnectionDialog::ProcessCommandL( TInt aCommand )
+    {
+    CLOG_ENTERFN( "CSelectConnectionDialog::ProcessCommandL" );  
+    if ( MenuShowing() )
+        {
+        HideMenu();
+        }
+
+    switch( aCommand )
+        {
+        case ESelectConnectionCmdSelect:
+        case ESelectConnectionCmdConnect:
+            {
+            TryExitL( EAknSoftkeySelect );
+            break;
+            }
+
+        case ESelectConnectionCmdChooseMethod:
+            {
+            __ASSERT_DEBUG( !iActiveSelectExplicit, 
+                            User::Panic( KErrActiveObjectNull, KErrNone ) );
+
+            iActiveSelectExplicit = CActiveSelectExplicit::NewL( this, 
+                                    iDestIDs[ListBox()->CurrentItemIndex()],
+                                    iRefreshInterval,
+                                    iBearerSet, 
+                                    iIsWLANFeatureSupported,
+                                    iDefaultCMId );
+            iActiveSelectExplicit->ShowSelectExplicitL();
+
+            break;
+            }
+
+        default:
+            {
+            break;
+            }
+        }
+    CLOG_LEAVEFN( "CSelectConnectionDialog::ProcessCommandL" );  
+    }
+
+
+// ---------------------------------------------------------
+// CNetworksViewContainer::OfferKeyEventL
+// ---------------------------------------------------------
+//
+TKeyResponse CSelectConnectionDialog::OfferKeyEventL( 
+                                                   const TKeyEvent& aKeyEvent,
+                                                   TEventCode aType )
+    {
+    CLOG_ENTERFN( "CSelectConnectionDialog::OfferKeyEventL" );
+
+    TKeyResponse result( EKeyWasNotConsumed );
+    TInt indexBefore = -1;
+    TInt indexAfter = -1;
+
+    if ( aKeyEvent.iScanCode == EStdKeyDownArrow || 
+         aKeyEvent.iScanCode == EStdKeyUpArrow )
+        {
+        CLOG_WRITE( "Arrow pressed" );
+        indexBefore = ListBox()->CurrentItemIndex();
+        }
+
+    result = CAknListQueryDialog::OfferKeyEventL( aKeyEvent, aType );
+
+    CLOG_WRITEF( _L ( "Returned from CAknListQueryDialog::OfferKeyEventL: %d" ), result );
+
+    if ( aKeyEvent.iScanCode == EStdKeyDownArrow || 
+         aKeyEvent.iScanCode == EStdKeyUpArrow )
+        {
+        indexAfter = ListBox()->CurrentItemIndex();
+        }
+
+    if ( indexBefore != indexAfter )
+        {
+        CLOG_WRITEF( _L ( "IndexBefore = %d, IndexAfter = %d" ), indexBefore, indexAfter );
+        CEikButtonGroupContainer& cba = ButtonGroupContainer();
+        HBufC* label;
+        if ( iIapIDs[indexAfter] != 0 )
+            {       // Easy Wlan
+            label = StringLoader::LoadL( R_QTN_MSK_SELECT );
+            }
+        else if ( iDestIDs[indexAfter] != 0 )
+            {       // Destination
+            label = StringLoader::LoadL( R_QTN_MSK_CONNECT );
+            }
+        else        // if ( iIapIDs[indexAfter] == 0 && iDestIDs[indexAfter] == 0 )
+            {      // Uncategorized
+            label = StringLoader::LoadL( R_QTN_MSK_OPEN );
+            }
+        CleanupStack::PushL( label );
+        cba.SetCommandL( EAknSoftkeyDone, label->Des() );
+        CleanupStack::PopAndDestroy(); // label
+        cba.DrawDeferred();
+        }
+
+    CLOG_LEAVEFN( "CSelectConnectionDialog::OfferKeyEventL" );  
+
+    return result;
+    }
+
+
+// ----------------------------------------------------------------------------
+// CSelectConnectionDialog::RunLD
+// ----------------------------------------------------------------------------
+//
+TInt CSelectConnectionDialog::RunLD()
+    {
+    CLOG_ENTERFN( "CSelectConnectionDialog::RunLD" );  
+    CAknDialog::ConstructL( R_SELECT_CONNECTION_MENUBAR );
+    User::ResetInactivityTime();
+
+    CAknKeySoundSystem* soundSystem = NULL;
+    if ( iSoundSystem )
+        {
+        iSoundSystem->PushContextL( R_AVKON_DEFAULT_SKEY_LIST );
+        // Need to store local copy of iSoundSystem, since it will have been
+        // destroyed when RunLD returns
+        soundSystem = iSoundSystem;
+        }
+
+    CAknsFrameBackgroundControlContext* cc = 
+        ( CAknsFrameBackgroundControlContext* )AknsDrawUtils::ControlContext(
+                                                                        this );
+    cc->SetCenter( KAknsIIDQsnFrPopupCenterQuery );
+
+    TInt ret = CAknDialog::RunLD();
+    if ( soundSystem )
+        {
+        soundSystem->PopContext();
+        }
+    CLOG_LEAVEFN( "CSelectConnectionDialog::RunLD" );  
+    return ret;
+    }
+
+
+// ---------------------------------------------------------
+// CSelectConnectionDialog::SetElementIDL
+// ---------------------------------------------------------
+//    
+void CSelectConnectionDialog::SetElementIDL( TUint32 aIAPId )
+    {
+    iPlugin->SetElementIDL( aIAPId, 0 );
+    }
+
+
+// ---------------------------------------------------------
+// void CSelectConnectionDialog::CompleteL
+// ---------------------------------------------------------
+//
+void CSelectConnectionDialog::CompleteL( TInt aStatus )
+    {
+    CLOG_ENTERFN( "CSelectConnectionDialog::CompleteL" );  
+    delete iActiveSelectExplicit;
+    iActiveSelectExplicit = NULL;
+    iPlugin->CompleteL( aStatus );
+    CLOG_LEAVEFN( "CSelectConnectionDialog::CompleteL" );  
+    }
+
+void CSelectConnectionDialog::HandleTimedOut()
+    {
+    TRAP_IGNORE( TryExitL(EAknSoftkeyCancel) );
+    }
+
+// ---------------------------------------------------------
+// void CSelectConnectionDialog::HandleListBoxEventL
+// ---------------------------------------------------------
+//    
+void CSelectConnectionDialog::HandleListBoxEventL(CEikListBox* aListBox, 
+												TListBoxEvent aEventType)
+	{	
+    if( aEventType == EEventItemClicked )
+        {
+        // Do not forward to the base class. 
+        // The first click must only select the item.        
+        return;
+        }
+    else if( aEventType == EEventItemDoubleClicked )
+        {
+        // Forward as EEventItemClicked to open the item on the second click.
+        CAknListQueryDialog::HandleListBoxEventL( aListBox, EEventItemClicked );
+        }
+	else
+        {
+        // normal forward
+        CAknListQueryDialog::HandleListBoxEventL( aListBox, aEventType );
+        }
+    }
+
+// ---------------------------------------------------------
+// void CSelectConnectionDialog::HandlePointerEventL
+// ---------------------------------------------------------
+//    
+void CSelectConnectionDialog::HandlePointerEventL(const TPointerEvent& aPointerEvent)
+    {
+    if( ListBox()->Rect().Contains( aPointerEvent.iPosition ) )
+        {
+        if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
+            {
+            TInt index;
+            TInt oldIndex = ListBox()->CurrentItemIndex();
+            if ( ListBox()->View()->XYPosToItemIndex( aPointerEvent.iPosition, index ) &&
+                   ( index == oldIndex ) )
+                {
+                // Pressed Down Effect
+                ListBox()->View()->ItemDrawer()->SetFlags( CListItemDrawer::EPressedDownState );
+                }
+            }
+        CAknControl::HandlePointerEventL(aPointerEvent);
+        }
+    else
+        {
+        CAknListQueryDialog::HandlePointerEventL( aPointerEvent );
+        }
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/cconndlg/src/SelectExplicitDialog.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,236 @@
+/*
+* Copyright (c) 2002 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 CSelectExplicitDialog.
+*
+*/
+
+
+// INCLUDE FILES
+#include "SelectExplicitDialog.h"
+#include "ConnectionInfo.h"
+#include "ConnectionInfoArray.h"
+#include "ConnDlgPlugin.h"
+#include "ConnectionDialogsLogger.h"
+#include "SelectConnectionDialog.h"
+#include "ExpiryTimer.h"
+
+#include <AknIconArray.h>
+#include <AknsUtils.h>
+#include <uikon/eiksrvui.h>
+
+#include <data_caging_path_literals.hrh>
+#include <apsettings.mbg>
+
+#include <CConnDlgPlugin.rsg>
+
+
+// ================= MEMBER FUNCTIONS =======================
+//
+// ---------------------------------------------------------
+// CSelectExplicitDialog::CSelectExplicitDialog
+// ---------------------------------------------------------
+//
+CSelectExplicitDialog::CSelectExplicitDialog( 
+                                    CSelectConnectionDialog* aCallerDialog )
+: CAknListQueryDialog( &iDummy ),
+  iCallerDialog( aCallerDialog ),
+  iFromOkToExit( EFalse )
+    {
+    }
+
+
+// ---------------------------------------------------------
+// CSelectExplicitDialog::NewL
+// ---------------------------------------------------------
+//
+CSelectExplicitDialog* CSelectExplicitDialog::NewL( 
+                                    CSelectConnectionDialog* aCallerDialog )
+    {
+    CSelectExplicitDialog* self = new( ELeave ) 
+                                        CSelectExplicitDialog( aCallerDialog );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+
+// ---------------------------------------------------------
+// CSelectExplicitDialog::ConstructL()
+// ---------------------------------------------------------
+//
+void CSelectExplicitDialog::ConstructL()
+    {
+    }
+
+
+// ---------------------------------------------------------
+// CSelectExplicitDialog::~CSelectExplicitDialog()
+// ---------------------------------------------------------
+//
+CSelectExplicitDialog::~CSelectExplicitDialog()
+    {
+    CLOG_ENTERFN( "CSelectExplicitDialog::~CSelectExplicitDialog " );
+    iIAPIds.Close();
+    delete iExpiryTimer;
+    CLOG_LEAVEFN( "CSelectExplicitDialog::~CSelectExplicitDialog " );
+    }
+
+
+// ---------------------------------------------------------
+// CSelectExplicitDialog::PreLayoutDynInitL()
+// ---------------------------------------------------------
+//
+void CSelectExplicitDialog::PreLayoutDynInitL()
+    {
+    CLOG_ENTERFN( "CSelectExplicitDialog::PreLayoutDynInitL " );  
+    
+    CAknListQueryDialog::PreLayoutDynInitL();
+
+    SetOwnershipType( ELbmDoesNotOwnItemArray );
+    SetIconArrayL( iIcons );
+
+    iExpiryTimer = CExpiryTimer::NewL( *this );
+    iExpiryTimer->Start();
+    
+    CLOG_LEAVEFN( "CSelectExplicitDialog::PreLayoutDynInitL " );      
+    }
+
+
+// ---------------------------------------------------------
+// CSelectExplicitDialog::OkToExitL
+// ---------------------------------------------------------
+//
+TBool CSelectExplicitDialog::OkToExitL( TInt aButtonId )
+    {
+    CLOG_ENTERFN( "CSelectExplicitDialog::OkToExitL " );      
+    
+    TBool result( EFalse );
+    TInt completeCode( KErrNone );
+    
+    if ( aButtonId == EAknSoftkeySelect || aButtonId == EAknSoftkeyOk ||
+         aButtonId == EAknSoftkeyDone )
+        {
+        iCallerDialog->SetElementIDL( iIAPIds[ListBox()->CurrentItemIndex()] );
+        result = ETrue;
+        }
+    else if ( aButtonId == EAknSoftkeyCancel )
+        {
+        completeCode = KErrCancel;
+        result = ETrue;
+        }
+        
+    if ( result )
+        {
+        iFromOkToExit = ETrue;        
+        
+        iCallerDialog->CompleteL( completeCode );
+        }
+
+    CLOG_LEAVEFN( "CSelectExplicitDialog::OkToExitL " );      
+
+    return result;
+    }
+
+
+// ---------------------------------------------------------
+// CSelectExplicitDialog::PrepareAndRunLD
+// ---------------------------------------------------------
+//    
+void CSelectExplicitDialog::PrepareAndRunLD( CConnectionInfoArray* aIAP,
+                                               CArrayPtr< CGulIcon >* aIcons,
+                                               TBool aIsReallyRefreshing )
+    {
+    PrepareLC( R_LIST_EXPLICIT_QUERY );
+    RefreshDialogL( aIAP, aIcons, aIsReallyRefreshing );
+    RunLD();
+    }
+
+
+// ---------------------------------------------------------
+// CSelectExplicitDialog::RefreshDialogL
+// ---------------------------------------------------------
+//    
+void CSelectExplicitDialog::RefreshDialogL( CConnectionInfoArray* aIAP, 
+                                              CArrayPtr< CGulIcon >* aIcons,
+                                              TBool aIsReallyRefreshing )
+    {  
+    CLOG_ENTERFN( "CSelectExplicitDialog::RefreshDialogL " );  
+     
+    SetItemTextArray( aIAP );
+    iIcons = aIcons;
+
+    iIAPIds.Reset();
+
+    // Determine the preferred IAP
+    TInt numAPs = aIAP->Count();
+    for( TInt ii = 0; ii < numAPs; ii++ )
+        {
+        iIAPIds.AppendL( aIAP->At( ii )->Id() );
+        }
+
+    if ( numAPs )
+        {
+        ListBox()->SetCurrentItemIndex( 0 );
+        }
+    ListBox()->HandleItemAdditionL();
+
+    if ( aIsReallyRefreshing )
+        {   // If we are really making a refresh, we need to recalculate the 
+            // layout, because the number of items could be different and the
+            // dialog should be resized accordingly
+        Layout();   
+        SizeChanged();
+        DrawNow();
+        }
+
+    CLOG_LEAVEFN( "CSelectExplicitDialog::RefreshDialogL " );  
+    }
+    
+// ---------------------------------------------------------
+// CSelectExplicitDialog::OfferKeyEventL
+// ---------------------------------------------------------
+//
+TKeyResponse CSelectExplicitDialog::OfferKeyEventL( const TKeyEvent& aKeyEvent, 
+                                                    TEventCode aType)
+    {
+    if( NeedToDismissQueryL(aKeyEvent) )
+        {
+        return EKeyWasConsumed;
+        }
+ 	
+    return CAknListQueryDialog::OfferKeyEventL(aKeyEvent,aType);
+    }    
+    
+// ---------------------------------------------------------
+// CSelectExplicitDialog::NeedToDismissQueryL
+// ---------------------------------------------------------
+//
+TBool CSelectExplicitDialog::NeedToDismissQueryL(const TKeyEvent& aKeyEvent)
+    {
+    if (aKeyEvent.iCode == EKeyPhoneSend)
+        {
+        TryExitL(EEikBidCancel);
+        return ETrue;
+        }
+        
+    return EFalse;
+    }
+	
+void CSelectExplicitDialog::HandleTimedOut()
+    {
+    TRAP_IGNORE( TryExitL(EAknSoftkeyCancel) );
+    }
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/cconndlg/src/sortsnaputils.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,229 @@
+/*
+* Copyright (c) 2002 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 TSortSnapUtils.
+*
+*/
+
+
+// INCLUDE FILES
+#include "sortsnaputils.h"
+#include "ConnectionDialogsLogger.h"
+
+// ================= MEMBER FUNCTIONS =======================
+//
+// ---------------------------------------------------------
+// TSortSnapUtils::TSortSnapUtils
+// ---------------------------------------------------------
+//
+TSortSnapUtils::TSortSnapUtils( RMPM& aMPM ):
+iSnapCount( 0 ),
+iSSUState( EUninitialised ),
+iMPM( aMPM )
+    {
+    CLOG_ENTERFN( "TSortSnapUtils::TSortSnapUtils" );
+    CLOG_LEAVEFN( "TSortSnapUtils::TSortSnapUtils" );
+    }
+
+
+// ---------------------------------------------------------
+// TSortSnapUtils::~TSortSnapUtils
+// ---------------------------------------------------------
+//
+TSortSnapUtils::~TSortSnapUtils()
+    {
+    CLOG_ENTERFN( "TSortSnapUtils::~TSortSnapUtils" );
+    CLOG_LEAVEFN( "TSortSnapUtils::~TSortSnapUtils" );
+    }
+
+// ---------------------------------------------------------
+// TSortSnapUtils::InitDestIdArray
+// ---------------------------------------------------------
+//
+void TSortSnapUtils::InitDestIdArray()
+    {
+    CLOG_ENTERFN( "TSortSnapUtils::InitDestIdArray" );
+    switch (iSSUState)
+        {
+        case EUseMPM:
+            {
+            // we already know that MPM is used
+            CLOG_WRITE( "using MPM, no need to re-read from P&S " );
+            break;
+            }
+        case EUninitialised:
+        case EUsePubSub:
+        default:
+            {
+            iSnapCount = 0;
+            TMpmSnapPubSubFormat snapData;
+            TPtr8 e( reinterpret_cast< TUint8* >( &snapData ), 
+                     sizeof( snapData ) );
+            for (TInt i = 0 ; i < KMPMSortSnapMaxKey; i++ )
+                {
+                TInt err = RProperty::Get( KMPMSortSnapCategory, 
+                                           i, 
+                                           e );
+               CLOG_WRITEF( _L( "RProperty::Get returned: %d" ), err );
+               CLOG_WRITEF( _L( "Snap Id: %d" ), snapData.iSnap );
+               CLOG_WRITEF( _L( "Snap Number: %d" ), iSnapCount );
+
+                if (err == KErrNone)                            
+                    {
+                    iSnapIdArray[iSnapCount] = snapData.iSnap;
+                    iSnapCount++;
+                    }
+                }
+            //determine what method to use:
+            // we always have at least one snap element
+            // in P&S
+            // if we are called from MPM                
+            if (iSnapCount)
+                {
+                CLOG_WRITE( "iSSUState = EUsePubSub " );
+                iSSUState = EUsePubSub;       
+                }
+             else
+                {
+                CLOG_WRITE( "iSSUState = EUseMPM " );
+                iSSUState = EUseMPM;       
+                }
+            }
+        }
+    CLOG_LEAVEFN( "TSortSnapUtils::InitDestIdArray" );
+    }
+
+// ---------------------------------------------------------
+// TSortSnapUtils::GetDestIdArrayL
+// ---------------------------------------------------------
+//
+void TSortSnapUtils::GetDestIdArrayL( RCmManagerExt& aCmManagerExt, RArray<TUint32>& aDestArray )
+    {
+    CLOG_ENTERFN( "TSortSnapUtils::GetDestIdArrayL" );
+    aDestArray.Reset();
+    InitDestIdArray(); // re-read the values, set iSSUState
+    switch (iSSUState)
+        {
+        case EUsePubSub:
+            {
+            CLOG_WRITE( "Using P&S " );
+            // append from 1, do not append uncategorised destination!
+            for ( TInt i = 1 ; i < iSnapCount; i++ )
+                {
+                aDestArray.Append( iSnapIdArray[i] );
+                CLOG_WRITEF( _L( "Appending to array: Snap Id: %d" ), iSnapIdArray[i] );                
+                }
+            break;
+            }
+        case EUseMPM:
+            {
+            CLOG_WRITE( "Using MPM " );
+            aCmManagerExt.AllDestinationsL( aDestArray );
+            break;
+            }
+        case EUninitialised:
+        default:
+            {
+            //should not ever happen, as we initialise at the beginning of the 
+            // function
+            User::Leave( KErrNotReady );
+            }
+        }
+    CLOG_LEAVEFN( "TSortSnapUtils::GetDestIdArrayL" );
+    }
+
+// ---------------------------------------------------------
+// TSortSnapUtils::GetSortSnapDataL()
+// ---------------------------------------------------------
+//
+TInt TSortSnapUtils::GetSortSnapData( TUint32 aSnapId, TMpmSnapBuffer& aSnapBuffer )
+    {
+    CLOG_ENTERFN( "TSortSnapUtils::GetSortSnapDataL" );
+    
+    if (iSSUState ==  EUninitialised)
+        {
+        InitDestIdArray();
+        }
+    
+    switch (iSSUState)
+        {
+        case EUsePubSub:
+            {
+            CLOG_WRITE( "Using P&S " );
+            TMpmSnapPubSubFormat snapData;
+            TPtr8 e( reinterpret_cast< TUint8* >( &snapData ), 
+            sizeof( snapData ) );
+            // initialize snap to invalid value
+            snapData.iSnap = (TUint32) KErrNotFound;
+            for ( TInt i = 0 ; i < iSnapCount; i++ )
+                {
+                if ( aSnapId == iSnapIdArray[i] )
+                    {
+                    
+                    TInt err = RProperty::Get( KMPMSortSnapCategory, 
+                                               i, 
+                                               e );
+                    CLOG_WRITEF( _L( "RProperty::Get returned: %d" ), err );
+
+                    if (err == KErrNone)                            
+                        {
+                        if ( aSnapId == snapData.iSnap )
+                            {
+                            aSnapBuffer = snapData.iSortedIaps;
+                            
+                            CLOG_WRITEF( _L( "Found: Snap id: %d" ), snapData.iSnap );
+                            CLOG_WRITEF( _L( "Iap count: %d" ), snapData.iSortedIaps.iCount );
+                            
+                            CLOG_LEAVEFN( "TSortSnapUtils::GetSortSnapDataL" );
+                            return KErrNone;
+                            }
+                        }
+                    else
+                        {
+                        CLOG_LEAVEFN( "TSortSnapUtils::GetSortSnapDataL" );
+                        return err;
+                        }
+                    }
+                }
+            break;    
+            }
+        case EUseMPM:
+            {
+            CLOG_WRITE( "Using MPM " );
+            TInt errConnect = iMPM.Connect();
+            CLOG_WRITEF( _L( "errConnect = %d" ), errConnect );
+            if ( errConnect == KErrNone )
+                {
+                TInt err = iMPM.SortSNAP( aSnapId, aSnapBuffer ); 
+                iMPM.Close();
+                CLOG_LEAVEFN( "TSortSnapUtils::GetSortSnapDataL" );
+                return err;       
+                }
+            else
+                {
+                CLOG_LEAVEFN( "TSortSnapUtils::GetSortSnapDataL" );
+                return errConnect;
+                }
+            }
+        case EUninitialised:
+        default:
+            {
+            //should not ever happen, as we initialise at the beginning of the 
+            // function            
+            CLOG_LEAVEFN( "TSortSnapUtils::GetSortSnapDataL" );
+            return KErrNotReady;
+            }
+        }
+    return KErrNone;
+    }
+
Binary file connectionutilities/ConnectionDialogs/cenrep/keys_connectiondialogs.xls has changed
Binary file connectionutilities/ConnectionDialogs/conf/connectiondialogs.confml has changed
Binary file connectionutilities/ConnectionDialogs/conf/connectiondialogs_10008D55.crml has changed
Binary file connectionutilities/ConnectionDialogs/conf/connectiondialogs_101FD67E.crml has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/data/10207374.rss	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include <ecom/registryinfo.rh>
+#include <uikon.hrh>
+
+RESOURCE REGISTRY_INFO theInfo
+{
+	dll_uid = 0x10207374;
+	interfaces =
+	{
+	INTERFACE_INFO
+		{
+		interface_uid = KUikonUidPluginInterfaceNotifiers;
+		implementations =
+				{
+				IMPLEMENTATION_INFO
+					{
+					implementation_uid = 0x10207375;
+					version_no = 1;
+					display_name = "TTNOTIFY2V2 Plugin 1";
+					default_data = "TTNOTIFY2V2";
+					opaque_data	 = "0";
+					}
+				};
+		}
+	};
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ecomsrc/connectiondialogswrapper.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,244 @@
+/*
+* 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:  Implementation of ecom plugin
+*
+*/
+
+
+// INCLUDE FILES
+#include "ConnectionDialogsUidDefs.h"
+#include "ConnectionDialogsLogger.h"
+
+#include <ecom/implementationproxy.h>
+#include <AknNotifierWrapper.h> // link against aknnotifierwrapper.lib
+#include <wifiprotuiddefs.h>
+
+
+// CONSTANTS
+const TInt KMyPriority =  MEikSrvNotifierBase2::ENotifierPriorityLow;
+const TInt KArrayGranularity = 5;
+ 
+
+// ---------------------------------------------------------
+// CleanupArray()
+// ---------------------------------------------------------
+//
+void CleanupArray( TAny* aArray )
+    {
+    CArrayPtrFlat<MEikSrvNotifierBase2>*     
+        subjects = static_cast<CArrayPtrFlat<MEikSrvNotifierBase2>*>( aArray );
+    TInt lastInd = subjects->Count()-1;
+    for ( TInt i = lastInd; i >= 0; i-- )
+        {
+        subjects->At( i )->Release();
+        }
+
+    delete subjects;
+    }
+    
+// ---------------------------------------------------------
+// DoCreateNotifierArrayL()
+// ---------------------------------------------------------
+//
+CArrayPtr<MEikSrvNotifierBase2>* DoCreateNotifierArrayL()
+    {
+    CLOG_CREATE;
+    CArrayPtrFlat<MEikSrvNotifierBase2>* subjects =
+        new ( ELeave )CArrayPtrFlat<MEikSrvNotifierBase2>( KArrayGranularity );
+    
+    CleanupStack::PushL( TCleanupItem( CleanupArray, subjects ) );
+
+    // Create Wrappers
+
+    _LIT( KCConnDlgPluginName, "CCONNDLGPLUGIN.DLL" );
+    _LIT( KDisconnectDlgName, "DISCONNECTDLG.DLL" );
+    _LIT( KConnUiUtilsNotifName, "ConnUiUtilsNotif.DLL" );
+
+    // Session owning notifier(if default implementation is enough)
+    CAknCommonNotifierWrapper* master = 
+        CAknCommonNotifierWrapper::NewL( KUidCConnDlgIap,
+                                         KUidCConnDlgIap,
+                                         KMyPriority,
+                                         KCConnDlgPluginName,
+                                         1 ); // we don't use synch reply
+
+    CleanupStack::PushL( master );   
+    subjects->AppendL( master );
+    CleanupStack::Pop( master );
+
+    subjects->AppendL( new( ELeave ) CAknNotifierWrapperLight( *master,
+                                            KUidCConnDlgNewIap,
+                                            KUidCConnDlgNewIap,
+                                            KMyPriority ) );
+
+    subjects->AppendL( new( ELeave ) CAknNotifierWrapperLight( *master,
+                                            KUidCConnDlgAuthentication,
+                                            KUidCConnDlgAuthentication,
+                                            KMyPriority ) );
+                                   
+    subjects->AppendL( new( ELeave ) CAknNotifierWrapperLight( *master,
+                                            KUidCConnDlgReconnect,
+                                            KUidCConnDlgReconnect,
+                                            KMyPriority ) );
+
+    subjects->AppendL( new( ELeave ) CAknNotifierWrapperLight( *master,
+                                            KUidCConnDlgQos,
+                                            KUidCConnDlgQos,
+                                            KMyPriority ) );
+
+    subjects->AppendL( new( ELeave ) CAknNotifierWrapperLight( *master,
+                                            KUidCConnDlgSelectConn,
+                                            KUidCConnDlgSelectConn,
+                                            KMyPriority ) );
+
+_LIT( KWiFiProtSetupPluginName , "wifiprotplugin.dll" );
+   master = 
+        CAknCommonNotifierWrapper::NewL( KUidWiFiProtSetup,
+                                         KUidWiFiProtSetup,
+                                         KMyPriority,
+                                         KWiFiProtSetupPluginName,
+                                         1 ); // we don't use synch reply
+
+    CleanupStack::PushL( master );   
+    subjects->AppendL( master );
+    CleanupStack::Pop( master );
+
+
+    // Disconnect dialog
+    subjects->AppendL( CAknCommonNotifierWrapper::NewL( KUidDisconnectDlg,
+                                                        KUidDisconnectDlg,
+                                                        KMyPriority,
+                                                        KDisconnectDlgName,
+                                                        1 ) );
+
+    // WLAN wrappers
+    master = CAknCommonNotifierWrapper::NewL( KUidSelectWLanDlg,
+                                              KUidSelectWLanDlg,
+                                              KMyPriority,
+                                              KConnUiUtilsNotifName,
+                                              1 );
+    
+    CleanupStack::PushL( master );   
+    subjects->AppendL( master );
+    CleanupStack::Pop( master );
+
+
+    subjects->AppendL( new( ELeave ) CAknNotifierWrapperLight( *master,
+                                            KUidCOfflineWlanNoteDlg,
+                                            KUidCOfflineWlanNoteDlg,
+                                            KMyPriority ) );
+    
+    subjects->AppendL( new( ELeave ) CAknNotifierWrapperLight( *master,
+                                            KUidCOfflineWlanDisabledNoteDlg,
+                                            KUidCOfflineWlanDisabledNoteDlg,
+                                            KMyPriority ) );
+
+    subjects->AppendL( new( ELeave ) CAknNotifierWrapperLight( *master,
+                                            KUidEasyWepDlg,
+                                            KUidEasyWepDlg,
+                                            KMyPriority ) );
+
+    subjects->AppendL( new( ELeave ) CAknNotifierWrapperLight( *master,
+                                            KUidEasyWpaDlg,
+                                            KUidEasyWpaDlg,
+                                            KMyPriority ) );
+    
+    subjects->AppendL( new( ELeave ) CAknNotifierWrapperLight( *master,
+                                            KUidWLANNetworkUnavailableNoteDlg,
+                                            KUidWLANNetworkUnavailableNoteDlg,
+                                            KMyPriority ) );
+                                            
+    // ALR WRAPPERS
+                                            
+    subjects->AppendL( new( ELeave ) CAknNotifierWrapperLight( *master,
+                                                        KUidConfirmationQuery,
+                                                        KUidConfirmationQuery,
+                                                        KMyPriority ) );
+                                            
+    subjects->AppendL( new( ELeave ) CAknNotifierWrapperLight( *master,
+                                                        KUidConnectViaNote,
+                                                        KUidConnectViaNote,
+                                                        KMyPriority ) );
+                                                        
+    // WLAN wrappers
+                                                        
+    subjects->AppendL( new( ELeave ) CAknNotifierWrapperLight( *master,
+                                            KUidWlanPowerSaveTestNote,
+                                            KUidWlanPowerSaveTestNote,
+                                            KMyPriority ) );
+                                            
+    subjects->AppendL( new( ELeave ) CAknNotifierWrapperLight( *master,
+                                            KUidEasyWapiDlg,
+                                            KUidEasyWapiDlg,
+                                            KMyPriority ) );
+
+    subjects->AppendL( new( ELeave ) CAknNotifierWrapperLight( *master,
+                                            KUidNoWLANNetworksAvailableNote,
+                                            KUidNoWLANNetworksAvailableNote,
+                                            KMyPriority ) );   
+
+    subjects->AppendL( new( ELeave ) CAknNotifierWrapperLight( *master,
+                                            KUidConnectingViaDiscreetPopup,
+                                            KUidConnectingViaDiscreetPopup,
+                                            KMyPriority ) );
+
+    subjects->AppendL( new( ELeave ) CAknNotifierWrapperLight( *master,
+                                            KUidConnectionErrorDiscreetPopup,
+                                            KUidConnectionErrorDiscreetPopup,
+                                            KMyPriority ) );                                                                                           
+                                            
+    CleanupStack::Pop();    // array cleanup
+    return( subjects );
+    }
+
+// ---------------------------------------------------------
+// NotifierArray()
+// ---------------------------------------------------------
+//
+CArrayPtr<MEikSrvNotifierBase2>* NotifierArray()
+    // old Lib main entry point
+    {
+    CArrayPtr<MEikSrvNotifierBase2>* array = 0;
+    TRAP_IGNORE( array = DoCreateNotifierArrayL() );
+    return array;
+    }
+
+// ---------------------------------------------------------
+// ImplementationTable
+// ---------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] =
+    {
+#ifdef __EABI__
+    {{0x10207375}, ( TFuncPtr )NotifierArray}
+#else
+    {{0x10207375}, NotifierArray}
+#endif
+    };
+
+// ---------------------------------------------------------
+// ImplementationGroupProxy
+// entry point
+// ---------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( 
+                                                            TInt& aTableCount )
+    {
+    aTableCount = sizeof( ImplementationTable ) / 
+                  sizeof( TImplementationProxy ) ;
+    return ImplementationTable;
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/group/CConnDlgClient.mmp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2002 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 CConnDlgClient
+*
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET      AGENTDIALOG.DLL
+TARGETTYPE  DLL
+
+UID     0x1000008d 0x10008F6D
+
+CAPABILITY CAP_GENERAL_DLL
+VENDORID VID_DEFAULT
+
+
+SOURCEPATH  ../cconndlg/clientsrc
+SOURCE GenConAgentDialogServer.cpp
+SOURCE ActiveLogin.cpp
+
+USERINCLUDE     ../cconndlg/inc ../cconndlg/clientinc
+
+// Component specific internal headers 
+USERINCLUDE			../inc
+
+// ADO specific internal headers 
+SYSTEMINCLUDE		../../../inc
+
+//Macro to /epoc32 headers
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY     euser.lib
+
+DEBUGLIBRARY flogger.lib
+
+#ifdef WINSCW
+    DEFFILE ../cconndlg/BWinsCw/AgentDialog.def
+#else   
+    DEFFILE ../cconndlg/EABI/agentdialog.def
+#endif  // WINSCW
+
+
+START WINS
+BASEADDRESS     0x46200000
+END
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/group/CConnDlgPlugin.mmp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,97 @@
+/*
+* Copyright (c) 2002 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 CConnDlgPlugin
+*
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+
+TARGET      CCONNDLGPLUGIN.DLL
+TARGETTYPE  DLL 
+TARGETPATH  /System/libs
+
+UID         0x101FDFAE 0x10008D55 
+CAPABILITY CAP_GENERAL_DLL 
+VENDORID VID_DEFAULT
+
+USERINCLUDE     ../cconndlg/inc ../data
+
+// Component specific internal headers 
+USERINCLUDE			../inc
+
+// ADO specific internal headers 
+SYSTEMINCLUDE		../../../inc
+
+//Macro to /epoc32 headers
+MW_LAYER_SYSTEMINCLUDE
+
+SYSTEMINCLUDE   /epoc32/include/uikon
+
+
+START RESOURCE ../cconndlg/data/CConnDlgPlugin.rss
+HEADER
+TARGETPATH RESOURCE_FILES_DIR
+LANGUAGE_IDS
+END  // RESOURCE
+
+
+SOURCEPATH  ../cconndlg/src
+SOURCE  ConnDlgPlugin.cpp IAPDialog.cpp  AuthenticationDialog.cpp
+SOURCE  ReconnectDialog.cpp NewIapDialog.cpp QosDialog.cpp
+SOURCE  ActiveIapPlugin.cpp
+SOURCE  ActiveBase.cpp
+SOURCE  SelectConnectionDialog.cpp
+SOURCE  ActiveSelectConnectionPlugin.cpp
+SOURCE  SelectExplicitDialog.cpp
+SOURCE  ActiveSelectExplicit.cpp
+SOURCE  sortsnaputils.cpp
+
+SOURCEPATH  ../src
+SOURCE  ConnectionInfo.cpp ConnectionInfoKey.cpp ConnectionInfoArray.cpp ExpiryTimer.cpp
+SOURCE  ActiveIAPListing.cpp
+SOURCE  ConnectionDialogsNotifBase.cpp
+
+LIBRARY euser.lib eikdlg.lib eiksrv.lib cone.lib commdb.lib eikcore.lib
+LIBRARY eikcoctl.lib bafl.lib
+LIBRARY avkon.lib
+LIBRARY CommonEngine.lib
+LIBRARY AknSkins.lib
+LIBRARY Ecom.lib
+LIBRARY centralrepository.lib 
+LIBRARY FeatMgr.lib 
+LIBRARY eiksrvui.lib
+LIBRARY cmmanager.lib
+LIBRARY mpm.lib
+LIBRARY hlplch.lib
+LIBRARY COMMSDAT.lib
+LIBRARY cmmanagerdatabase.lib
+LIBRARY	egul.lib
+
+
+DEBUGLIBRARY flogger.lib
+DEBUGLIBRARY efsrv.lib
+
+
+#ifdef WINSCW
+    DEFFILE ../cconndlg/BWinsCw/CConnDlgPlugin.DEF
+#else
+    DEFFILE ../cconndlg/EABI/CCONNDLGPLUGIN.DEF
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/group/ConnUiUtilsIcons.mk	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,62 @@
+#
+# 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 ConnectionUiUtilities
+#
+
+ifeq (WINS,$(findstring WINS, $(PLATFORM)))
+ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\Z
+else
+ZDIR=\epoc32\data\z
+endif
+
+TARGETDIR=$(ZDIR)\resource\apps
+HEADERDIR=\epoc32\include
+ICONTARGETFILENAME=$(TARGETDIR)\connectionuiutilities.mif
+HEADERFILENAME=$(HEADERDIR)\connectionuiutilities.mbg
+
+do_nothing :
+	@rem do_nothing
+
+MAKMAKE : do_nothing
+
+BLD : do_nothing
+
+CLEAN : do_nothing
+
+LIB : do_nothing
+
+CLEANLIB : do_nothing
+
+RESOURCE :
+	mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \
+		/c8,8 qgn_indi_wlan_signal_low_add.bmp \
+		/c8,8 qgn_indi_wlan_signal_med_add.bmp \
+		/c8,8 qgn_indi_wlan_signal_good_add.bmp \
+		/c8,8 qgn_indi_wlan_secure_network_add.bmp \
+		/c8,8 qgn_prop_snote_wlan_adhoc.bmp \
+		/c8,8 qgn_prop_snote_wlan_infra.bmp \
+		/c8,8 qgn_indi_wifi_protected_add.bmp
+
+# THIS SHOULD BE qgn.indi.wlan.protected.setup.add, BUT IT IS STILL MISSING!!!
+
+
+FREEZE : do_nothing
+
+SAVESPACE : do_nothing
+
+RELEASABLES :
+	@echo $(HEADERFILENAME)&& \
+	@echo $(ICONTARGETFILENAME)
+
+FINAL : do_nothing
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/group/ConnUiUtilsNotif.mmp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,130 @@
+/*
+* Copyright (c) 2004 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 
+*               Connection Ui Utilities Notifier
+*
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+TARGET      ConnUiUtilsNotif.DLL
+
+TARGETTYPE  DLL
+
+TARGETPATH  /System/libs
+
+UID         0x101FDFAE 0x101FD668       
+
+CAPABILITY CAP_GENERAL_DLL 
+
+VENDORID VID_DEFAULT
+
+START RESOURCE ../ConnectionUiUtilities/data/ConnUiUtilsNotif.rss
+HEADER
+    TARGETPATH  RESOURCE_FILES_DIR
+    LANGUAGE_IDS
+END     // RESOURCE
+
+SOURCEPATH  ../ConnectionUiUtilities/NotifSrc
+SOURCE      ConnUiUtilsNotif.cpp
+
+SOURCE      SelectWLANDlg.cpp
+SOURCE      SelectWLanDlgPlugin.cpp
+SOURCE      ActiveSelectWLanDlgPlugin.cpp
+SOURCE      wlancoveragecheck.cpp
+
+SOURCE      OfflineWlanNoteDlg.cpp
+SOURCE      OfflineWlanNoteNotif.cpp
+
+SOURCE      WlanNetworkDataProvider.cpp
+SOURCE      NetworkInfoBase.cpp
+SOURCE      NetworkInfoArray.cpp
+SOURCE      NetworkInfoKey.cpp
+
+SOURCE      WepWpaQueryDlg.cpp
+SOURCE      EasyWepDlgNotif.cpp
+SOURCE      EasyWpaDlgNotif.cpp
+
+SOURCE      OfflineWlanDisabledNoteNotif.cpp
+SOURCE      ActiveOfflineWlanDisabledNote.cpp
+
+SOURCE      WLANNetworkUnavailableNoteNotif.cpp
+SOURCE      ActiveWLANNetworkUnavailableNote.cpp
+
+SOURCE      ConfirmationQuery.cpp
+SOURCE      ConfirmationQueryNotif.cpp
+SOURCE      ActiveConnectViaNote.cpp
+SOURCE      ConnectViaNoteNotif.cpp
+SOURCE      NoteDlgSuppressingSwitch.cpp
+SOURCE      wlanpowersavetest.cpp
+SOURCE      wlanpowersavetestnotif.cpp
+SOURCE      easywapidlgnotif.cpp
+SOURCE      nowlannetworksavailablenotif.cpp
+SOURCE      connectingviadiscreetpopup.cpp
+SOURCE      connectingviadiscreetpopupnotif.cpp
+SOURCE      connectionerrordiscreetpopup.cpp
+SOURCE      connectionerrordiscreetpopupnotif.cpp
+
+SOURCEPATH  ../src
+SOURCE      ConnectionInfo.cpp
+SOURCE      ConnectionDialogsNotifBase.cpp
+SOURCE	ExpiryTimer.cpp
+
+USERINCLUDE     ../ConnectionUiUtilities/NotifInc
+USERINCLUDE     ../ConnectionUiUtilities/inc
+
+// Component specific internal headers 
+USERINCLUDE			../inc
+
+// ADO specific internal headers 
+SYSTEMINCLUDE		../../../inc
+
+//Macro to /epoc32 headers
+MW_LAYER_SYSTEMINCLUDE
+
+SYSTEMINCLUDE   /epoc32/include/libc 
+SYSTEMINCLUDE   /epoc32/include/uikon
+
+
+LIBRARY     euser.lib eikdlg.lib eiksrv.lib cone.lib eikcore.lib eikcoctl.lib
+LIBRARY     bafl.lib avkon.lib AknSkins.lib Ecom.lib 
+LIBRARY		eiksrvui.lib
+LIBRARY     commonengine.lib
+LIBRARY     AKNNOTIFY.LIB
+LIBRARY     AknIcon.lib
+LIBRARY     egul.lib
+LIBRARY	    centralrepository.lib 
+LIBRARY	    aknlayout.lib 
+LIBRARY     AknCapServerClient.lib
+LIBRARY     FeatMgr.lib
+LIBRARY     charconv.lib
+
+LIBRARY     commdb.lib
+LIBRARY		  cmmanager.lib
+LIBRARY     etel3rdparty.lib 
+
+#if defined(ARMCC)
+    DEFFILE ../ConnectionUiUtilities/EABI/ConnUiUtilsNotif.DEF
+#elif defined( WINSCW )
+    DEFFILE ../ConnectionUiUtilities/BWinsCw/ConnUiUtilsNotif.DEF
+#endif
+
+DEBUGLIBRARY flogger.lib
+DEBUGLIBRARY efsrv.lib
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/group/ConnectionUiUtilities.mmp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,88 @@
+/*
+* Copyright (c) 2002 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 ConnectionUiUtilities.
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+
+TARGET      ConnectionUiUtilities.dll
+TARGETTYPE  DLL
+
+CAPABILITY CAP_GENERAL_DLL
+VENDORID VID_DEFAULT
+
+
+START RESOURCE ../ConnectionUiUtilities/data/ConnectionUiUtilities.rss
+HEADER
+TARGETPATH  RESOURCE_FILES_DIR
+LANGUAGE_IDS
+END     // RESOURCE
+
+
+SOURCEPATH ../ConnectionUiUtilities/src
+SOURCE ConnectionUiUtilities.cpp
+SOURCE ConnectionUiUtilitiesClient.cpp
+SOURCE ConnectionUiUtilitiesImpl.cpp
+SOURCE ConnectionUiUtilitiesPanic.cpp
+SOURCE ChangeConnectionDlg.cpp
+SOURCE ActiveCChangeConnectionDlg.cpp
+SOURCE ActiveWrapper.cpp
+
+
+SOURCEPATH ../src
+SOURCE ConnectionInfo.cpp
+SOURCE ConnectionInfoKey.cpp
+SOURCE ConnectionInfoArray.cpp
+SOURCE ActiveIAPListing.cpp
+SOURCE ExpiryTimer.cpp
+
+
+USERINCLUDE	    ../ConnectionUiUtilities/inc
+
+// Component specific internal headers 
+USERINCLUDE			../inc
+
+// ADO specific internal headers 
+SYSTEMINCLUDE		../../../inc
+
+//Macro to /epoc32 headers
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY euser.lib cone.lib eikcore.lib eikcoctl.lib avkon.lib eikdlg.lib 
+LIBRARY bafl.lib commonengine.lib commdb.lib AknSkins.lib FeatMgr.lib 
+LIBRARY AknNotify.lib
+LIBRARY Ecom.lib
+LIBRARY	centralrepository.lib 
+LIBRARY	aknlayout.lib 
+
+DEBUGLIBRARY flogger.lib
+
+
+#if defined( ARMCC )
+
+    DEFFILE ../ConnectionUiUtilities/EABI/ConnectionUiUtilities_PROT.def
+
+#elif defined( WINSCW )
+
+    DEFFILE ../ConnectionUiUtilities/BWinsCw/ConnectionUiUtilities_PROT.def
+
+#endif
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/group/DisconnectDlg.mmp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,97 @@
+/*
+* Copyright (c) 2004 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 the Disconnect Dialog.
+*
+*/
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+TARGET      DisconnectDlg.dll
+
+TARGETTYPE  DLL
+
+TARGETPATH  /System/libs
+
+UID         0x101FDFAE 0x101F85F3
+
+CAPABILITY CAP_GENERAL_DLL 
+
+VENDORID VID_DEFAULT
+
+START RESOURCE    ../DisconnectDlg/data/DisconnectDlg.rss
+HEADER
+TARGETPATH RESOURCE_FILES_DIR
+LANGUAGE_IDS
+END  // RESOURCE
+
+SOURCEPATH ../DisconnectDlg/src
+SOURCE  DisconnectDlgUi.cpp
+SOURCE  DisconnectDlgDialog.cpp
+SOURCE  ConnectionInfo.cpp
+SOURCE  ConnectionCArray.cpp
+SOURCE  ConnectionModel.cpp
+SOURCE  QueryDisconnectDlgDialog.cpp
+SOURCE	ActiveDisconnectDlgPlugin.cpp
+SOURCE	DisconnectDlgActiveWaiter.cpp
+SOURCE  connectioninfosortkey.cpp
+
+SOURCEPATH ../src
+SOURCE	ExpiryTimer.cpp
+
+USERINCLUDE	    ../DisconnectDlg/inc
+
+// Component specific internal headers 
+USERINCLUDE			../inc
+
+// ADO specific internal headers 
+SYSTEMINCLUDE		../../../inc
+
+//Macro to /epoc32 headers
+MW_LAYER_SYSTEMINCLUDE
+
+SYSTEMINCLUDE   /epoc32/include/uikon
+
+
+LIBRARY euser.lib
+LIBRARY cone.lib
+LIBRARY eikcore.lib
+LIBRARY eikcoctl.lib
+LIBRARY eiksrvui.lib
+LIBRARY avkon.lib
+LIBRARY eikdlg.lib 
+LIBRARY bafl.lib
+LIBRARY	connmon.lib
+LIBRARY commonengine.lib
+LIBRARY eiksrv.lib
+LIBRARY AknIcon.lib
+LIBRARY egul.lib
+LIBRARY apparc.lib
+LIBRARY apgrfx.lib
+LIBRARY fbscli.lib
+LIBRARY AknSkins.lib
+
+DEBUGLIBRARY flogger.lib
+DEBUGLIBRARY efsrv.lib
+
+
+#if defined(ARMCC)
+    DEFFILE ../DisconnectDlg/EABI/DisconnectDlg.DEF
+#elif defined( WINSCW )
+    DEFFILE ../DisconnectDlg/BWinsCw/DISCONNECTDLG.def
+#endif
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/group/DisconnectDlgClient.mmp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2004 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 DisconnectDlgClient
+*
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET      DisconnectDlgClient.dll
+TARGETTYPE  DLL
+
+UID     0x1000008d 0x101F85F2 
+
+CAPABILITY      CAP_GENERAL_DLL
+VENDORID VID_DEFAULT
+
+SOURCEPATH  ../DisconnectDlg/clientsrc
+SOURCE      DisconnectDlgClient.cpp
+
+USERINCLUDE ../DisconnectDlg/inc
+
+// Component specific internal headers 
+USERINCLUDE			../inc
+
+// ADO specific internal headers 
+SYSTEMINCLUDE		../../../inc
+
+//Macro to /epoc32 headers
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY     euser.lib
+LIBRARY	    connmon.lib
+
+DEBUGLIBRARY flogger.lib
+DEBUGLIBRARY efsrv.lib
+
+
+
+#if defined(ARMCC)
+    DEFFILE ../DisconnectDlg/EABI/DISCONNECTDLGCLIENT.def
+#elif defined( WINSCW )
+    DEFFILE ../DisconnectDlg/BWinsCw/DISCONNECTDLGCLIENT.def
+#endif
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/group/DisconnectDlgIcons.MK	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,66 @@
+#
+# Copyright (c) 2004 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 DisconnectDlg
+#
+
+ifeq (WINS,$(findstring WINS, $(PLATFORM)))
+ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\Z
+else
+ZDIR=\epoc32\data\z
+endif
+
+TARGETDIR=$(ZDIR)\resource\apps
+HEADERDIR=\epoc32\include
+ICONTARGETFILENAME=$(TARGETDIR)\disconnectdlgui.mif
+HEADERFILENAME=$(HEADERDIR)\disconnectdlgui.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) \
+		/c8,8 qgn_menu_cmon_cxt.bmp \
+		/c8,8 qgn_menu_fax_lst.bmp \
+		/c8,8 qgn_prop_netw_shared_conn.bmp 
+
+FREEZE : do_nothing
+
+SAVESPACE : do_nothing
+
+RELEASABLES :
+	@echo $(HEADERFILENAME)&& \
+	@echo $(ICONTARGETFILENAME)
+
+FINAL : do_nothing
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,80 @@
+/*
+* Copyright (c) 2002 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 provides the information required for building the
+*    whole of a Connection Dialogs.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+// export iby files
+../rom/agentdialog.iby				CORE_MW_LAYER_IBY_EXPORT_PATH(agentdialog.iby)
+../rom/cconndlg.iby				CORE_MW_LAYER_IBY_EXPORT_PATH(cconndlg.iby)
+../rom/cconndlgResources.iby			LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(cconndlgResources.iby)
+
+../rom/ConnectionDialogs.iby			CORE_MW_LAYER_IBY_EXPORT_PATH(ConnectionDialogs.iby)
+
+../rom/ConnectionUiUtilities.iby		CORE_MW_LAYER_IBY_EXPORT_PATH(ConnectionUiUtilities.iby)
+../rom/ConnectionUiUtilitiesResources.iby	LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(ConnectionUiUtilitiesResources.iby)
+
+../rom/DisconnectDlg.iby			CORE_MW_LAYER_IBY_EXPORT_PATH(DisconnectDlg.iby)
+../rom/DisconnectDlgResources.iby		LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(DisconnectDlgResources.iby)
+
+// export localised loc file
+../cconndlg/loc/agentdialog.loc				MW_LAYER_LOC_EXPORT_PATH(agentdialog.loc)
+../ConnectionUiUtilities/loc/ConnectionUiUtilities.loc	MW_LAYER_LOC_EXPORT_PATH(connectionuiutilities.loc)
+../DisconnectDlg/loc/DisconnectDlg.loc			MW_LAYER_LOC_EXPORT_PATH(disconnectdlg.loc)
+
+../conf/connectiondialogs.confml		APP_LAYER_CONFML(connectiondialogs.confml)
+../conf/connectiondialogs_101FD67E.crml		APP_LAYER_CRML(connectiondialogs_101FD67E.crml)
+../conf/connectiondialogs_10008D55.crml		APP_LAYER_CRML(connectiondialogs_10008D55.crml)
+
+PRJ_MMPFILES
+//gnumakefile DisconnectDlgIcons.MK
+//gnumakefile ConnUiUtilsIcons.MK
+
+./connectiondialogswrapper.mmp
+
+./CConnDlgClient.mmp
+./CConnDlgPlugin.mmp
+
+./DisconnectDlg.mmp
+./DisconnectDlgClient.mmp
+
+./ConnectionUiUtilities.mmp
+./ConnUiUtilsNotif.mmp
+
+PRJ_EXTENSIONS
+START EXTENSION s60/mifconv
+OPTION TARGETFILE connectionuiutilities.mif
+OPTION HEADERFILE connectionuiutilities.mbg
+OPTION SOURCES -c8,8 qgn_indi_wlan_signal_low_add -c8,8 qgn_indi_wlan_signal_med_add -c8,8 qgn_indi_wlan_signal_good_add -c8,8 qgn_indi_wlan_secure_network_add -c8,8 qgn_prop_snote_wlan_adhoc -c8,8 qgn_prop_snote_wlan_infra -c8,8 qgn_indi_wifi_protected_add -c8,1 qgn_prop_wlan_bearer.svg -c8,1 qgn_prop_wml_gprs.svg 
+END
+
+PRJ_EXTENSIONS
+START EXTENSION s60/mifconv
+OPTION TARGETFILE disconnectdlgui.mif
+OPTION HEADERFILE disconnectdlgui.mbg
+OPTION SOURCES -c8,8 qgn_menu_cmon_cxt -c8,8 qgn_menu_fax_lst -c8,8 qgn_prop_netw_shared_conn
+END
+
+PRJ_TESTMMPFILES
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/group/connectiondialogswrapper.mmp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,57 @@
+/*
+* 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 connectiondialogswrapper
+*
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET      connectiondialogswrapper.DLL
+CAPABILITY  CAP_ECOM_PLUGIN
+TARGETTYPE  PLUGIN 
+
+UID         0x10009D8D 0x10207374
+
+LANG    SC
+
+SOURCEPATH  ../ecomsrc
+SOURCE  connectiondialogswrapper.cpp 
+
+// Component specific internal headers 
+USERINCLUDE			../inc
+
+// ADO specific internal headers 
+SYSTEMINCLUDE		../../../inc
+
+//Macro to /epoc32 headers
+MW_LAYER_SYSTEMINCLUDE
+
+START RESOURCE ../data/10207374.rss 
+TARGET connectiondialogswrapper.rsc
+END
+
+
+LIBRARY ECOM.LIB
+LIBRARY	AKNNOTIFIERWRAPPER.LIB
+LIBRARY EUSER.LIB
+
+DEBUGLIBRARY flogger.lib
+DEBUGLIBRARY efsrv.lib
+DEBUGLIBRARY cone.lib 
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/inc/ActiveIAPListing.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,192 @@
+/*
+* 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 Active Iap Listing class
+*
+*/
+
+
+
+#ifndef __ACTIVEIAPLISTING_H__
+#define __ACTIVEIAPLISTING_H__
+
+
+// INCLUDES
+#include <e32base.h>
+#include <agentdialog.h>
+
+
+// FORWARD DECLARATION
+class CCommsDatabase;
+class CConnectionInfoArray;
+class CAknWaitDialog;
+#ifndef __WINS__
+class CWlanMgmtClient;
+#endif
+
+
+enum TLanType
+    {
+    ENotDefined,
+    ELan,
+    EEasyWLan,
+    EWLan
+    };
+
+
+
+// CLASS DECLARATION
+
+
+/**
+ * CActiveIAPListing class,
+ */     
+NONSHARABLE_CLASS( CActiveIAPListing ) : public CActive
+    {
+    public:
+        /**
+        * StartSearchIAPsL setactive and starts active object
+        */    
+        void BaseStartSearchIAPsL( TInt aResourceId );
+
+        /**
+        * Destructor
+        */    
+        virtual ~CActiveIAPListing();
+    
+        /**
+        * Timer callback of iPeridoc.
+        */
+        static TInt Tick( TAny* aObject );    
+    
+        /**
+        * Cancels the active object
+        */
+        void Cancel();
+        
+        /**
+        * Gives back, refresh interval of scan for network
+        */
+        TInt GetRefreshInterval( const TUid aRepositoryUid, TUint32 aKey );
+
+              
+    protected:
+        /**
+        * ConstructL 
+        */
+        void BaseConstructL();
+    
+        /**
+        * Constructor
+        * @param  aPlugin a pointer to notifier plugin    
+        * @param aIAPId iap id
+        * @param aPrefs preferences pointer        
+        */    
+        CActiveIAPListing( const TConnectionPrefs& aPrefs );
+    
+        /**
+        * Starts Timer
+        * @param aTickInterval refersh interval
+        */
+        void StartTimerL( TInt aTickInterval );
+    
+        /**
+        * Stops Timer
+        */
+        void StopTimer();                                            
+        
+        /**
+        * DoCancel from CActive
+        */    
+        virtual void DoCancel();
+
+        /**
+        * RunL from CActive
+        */
+        virtual void RunL();
+  
+        void CreateArraysL( TInt aResourceId, TBool aChangeConnection, 
+                            TUint32 aIAPId );
+
+
+        /**
+        * BuildConnectionListL
+        * @param    -
+        */
+        void BuildConnectionListL( TInt aResourceId, TBool aChangeConnection, 
+                                   TUint32 aIAPId );
+
+
+        /**
+        * Get the type of LAN of the access point.
+        * @param aServiceId The Service ID of the access point
+        * @param aIsInfrastructure  Output, it tells if the connection mode is 
+        *                           'Infrastructure'
+        * @return one of the TLanType enumerations
+        */
+        TLanType GetTypeOfLanL( TUint32 aServiceId, TBool& aIsInfrastructure );
+
+        
+        /**
+        * Merges iWlanIAPs and iAvailableIaps
+        */
+        void MergeArraysL( TInt aResourceId );
+    
+        /**
+        * SortNameListL
+        * @param -
+        */
+        void SortNameListL( TInt aResourceId );
+
+    protected:
+    
+        // Pointer to Comms database owned
+        CCommsDatabase* iDb;
+    
+        // Timer, to refresh iaps of networks. Owned.
+        CPeriodic* iPeriodic;
+            
+        CAknWaitDialog* iWaitDialog;    
+              
+#ifndef __WINS__
+    
+        // used for wlan networks info, owned
+        CWlanMgmtClient* iWlanMgmt;
+    
+#endif // !__WINS__
+
+        // contains all iaps from db except wlan iaps, owned
+        CConnectionInfoArray *iIAPs;   
+
+        // contains all wlan iaps from db, owned
+        CConnectionInfoArray *iWlanIAPs;   
+    
+        // all available iaps, owned
+        CConnectionInfoArray *iActIAPs;   
+    
+        // Available iaps from WlanMgmnt
+        RArray<TUint> iAvailableIaps;
+    
+        // used for complete runl, not owned.
+        TRequestStatus* iClientStatus;  
+    
+        TBool iIsWLANFeatureSupported;
+    
+        // Selected preferences
+        TConnectionPrefs iPrefs;        
+    };     
+
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/inc/ConnectionDialogs.hrh	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,36 @@
+/*
+* 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 ConnectionDialogs.
+*     The file can be included in C++ or resource file.
+*
+*/
+
+
+#ifndef CONNECTIONDIALOGS_HRH
+#define CONNECTIONDIALOGS_HRH
+
+
+// Menu command IDs
+enum TSelectConnectionMenuCommands
+    {
+    ESelectConnectionCmdSelect = 6000,
+    ESelectConnectionCmdChooseMethod,
+    ESelectConnectionCmdConnect
+    };
+
+
+#endif  //CONNECTIONDIALOGS_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/inc/ConnectionDialogsLogger.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,102 @@
+/*
+* 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: 
+*
+*
+*/
+
+
+#ifndef CONNECTIONDIALOGSLOGGER_H_INCLUDED
+#define CONNECTIONDIALOGSLOGGER_H_INCLUDED
+
+// ========== INCLUDE FILES ================================
+
+#include <eikenv.h>
+#include <flogger.h>
+
+
+#ifdef _DEBUG
+
+// Format string: enter function.
+_LIT( KCCDLGLogEnterFn,           "-> %S" );
+// Format string: leave function.
+_LIT( KCCDLGLogLeaveFn,           "<- %S" );
+// Format string: time.
+_LIT( KCCDLGLogTimeFormatString,  "%H:%T:%S:%*C2" );
+
+// Logging directory.
+_LIT( KCCDLGLogDir,               "ConnectionDialogs" );
+// Log file name.
+_LIT( KCCDLGLogFile,              "ConnectionDialogs.txt" );
+_LIT( KCCDLGLogBanner,            "****************\n\nConnectionDialogs\n\n****************" );
+_LIT( KCCDLGLogExit,              "ConnectionDialogs: Exit" );
+
+#define CLOG_CREATE             {FCreate();}
+#define CLOG_DELETE             {RFileLogger::Write(KCCDLGLogDir, KCCDLGLogFile, EFileLoggingModeAppend, KCCDLGLogExit);}
+#define CLOG_ENTERFN(a)         {_LIT(temp, a); RFileLogger::WriteFormat(KCCDLGLogDir, KCCDLGLogFile, EFileLoggingModeAppend, KCCDLGLogEnterFn, &temp);}
+#define CLOG_LEAVEFN(a)         {_LIT(temp, a); RFileLogger::WriteFormat(KCCDLGLogDir, KCCDLGLogFile, EFileLoggingModeAppend, KCCDLGLogLeaveFn, &temp);}
+#define CLOG_WRITE(a)           {_LIT(temp, a); RFileLogger::Write(KCCDLGLogDir, KCCDLGLogFile, EFileLoggingModeAppend, temp);}
+#define CLOG_WRITE_TIMESTAMP(a) {_LIT(temp, a); TTime time; time.HomeTime(); TBuf<256> buffer; time.FormatL( buffer, KCCDLGLogTimeFormatString ); buffer.Insert(0, temp); RFileLogger::Write(KCCDLGLogDir, KCCDLGLogFile, EFileLoggingModeAppend, buffer); }
+#define CLOG_WRITEF             FPrint
+
+
+inline void FPrint(const TRefByValue<const TDesC> aFmt, ...)
+    {
+    VA_LIST list;
+    VA_START(list,aFmt);
+    RFileLogger::WriteFormat(KCCDLGLogDir, KCCDLGLogFile, EFileLoggingModeAppend, aFmt, list);
+    }
+
+inline void FPrint(const TDesC& aDes)
+    {
+    RFileLogger::WriteFormat(KCCDLGLogDir, KCCDLGLogFile, EFileLoggingModeAppend, aDes);
+    }
+
+inline void FHex(const TUint8* aPtr, TInt aLen)
+    {
+    RFileLogger::HexDump(KCCDLGLogDir, KCCDLGLogFile, EFileLoggingModeAppend, 0, 0, aPtr, aLen);
+    }
+
+inline void FHex(const TDesC8& aDes)
+    {
+    FHex(aDes.Ptr(), aDes.Length());
+    }
+
+inline void FCreate()
+    {
+    TFileName path( _L( "c:\\logs\\" ) );
+    path.Append( KCCDLGLogDir );
+    path.Append( _L( "\\" ) );
+    RFs& fs = CEikonEnv::Static()->FsSession();
+    fs.MkDirAll( path );
+    RFileLogger::WriteFormat( KCCDLGLogDir, KCCDLGLogFile, 
+                              EFileLoggingModeAppend, KCCDLGLogBanner );
+    }
+
+#else // ! _DEBUG
+
+inline void FPrint(const TRefByValue<const TDesC> /*aFmt*/, ...) { };
+
+#define CLOG_CREATE
+#define CLOG_DELETE
+#define CLOG_ENTERFN(a)
+#define CLOG_LEAVEFN(a)
+#define CLOG_WRITE(a)
+#define CLOG_WRITEF   1 ? ((void)0) : FPrint
+#define CLOG_WRITE_TIMESTAMP(a)
+
+#endif // _DEBUG
+
+
+#endif // CONNDLGLOGGER_H_INCLUDED
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/inc/ConnectionDialogsNotifBase.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,136 @@
+/*
+* Copyright (c) 2004 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 Generic Connection Dialogs Notifier
+*
+*/
+
+
+#ifndef __CONNECTIONDIALOGSNOTIFBASE_H__
+#define __CONNECTIONDIALOGSNOTIFBASE_H__
+
+
+// INCLUDES
+#if !defined(__EIKNOTAPI_H__)
+#include <eiknotapi.h>
+#endif
+
+
+// FORWARD DECLARATION
+
+
+// CLASS DECLARATION
+/**
+ * Plugin base class
+ */
+NONSHARABLE_CLASS( CConnectionDialogsNotifBase ) : public CBase, public MEikSrvNotifierBase2
+                                                   
+    {
+    public:
+
+        /**
+        * ~CConnectionDialogsNotifBase() destructor
+        * @param  -
+        * return  -
+        */
+        virtual ~CConnectionDialogsNotifBase();
+
+        // From MEikSrvNotifierBase
+
+        /**
+        * Get Notifier information
+        * @param  -
+        * return TNotifierInfo
+        */
+        TNotifierInfo Info() const;
+
+        /**
+        * Start the Notifier
+        * @param  aBuffer   Not used
+        * return TPtrC8     Always NULL
+        */
+        TPtrC8 StartL( const TDesC8& aBuffer );
+
+        /**
+        * Cancel() the notifier
+        * @param  -
+        * return -
+        */
+        void Cancel();
+
+        /**
+        * Release the notifier
+        * @param  -
+        * return -
+        */
+        void Release();
+
+        /**
+        * Update Notifier
+        * @param  aBuffer   Not used
+        * return TPtrC8     Always NULL
+        */
+        TPtrC8 UpdateL( const TDesC8& aBuffer );
+
+        /**
+        * CompleteL the notifier is complete
+        * @param  aStatus status
+        * return  -
+        */
+        virtual void CompleteL( TInt aStatus ) = 0;
+
+        inline void SetCancelledFlag( TBool aCancelled );
+
+    protected:
+
+        /**
+        * CConnectionDialogsNotifBase() constructor
+        * @param  -
+        * return  -
+        */
+        CConnectionDialogsNotifBase();
+
+        /**
+        * CConnectionDialogsNotifBase() second level constructor
+        * @param  -
+        * return  -
+        */
+        void ConstructL( const TDesC& aResourceFileName,
+                         const TBool aResourceFileResponsible );
+
+    private:
+
+        /**
+        * CheckBusyL() check busy function
+        * @param  -
+        * return  -
+        */
+        void CheckBusyL();
+
+    protected:
+        TNotifierInfo iInfo;        // Notifier info
+
+        RMessagePtr2 iMessage;      // Message
+        TInt iReplySlot;            // Reply slot
+
+        TBool iCancelled;           // ETrue if dialog cancelled
+
+    private:
+        TInt iResource;             // Resource
+    };
+
+#include "ConnectionDialogsNotifBase.inl"
+    
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/inc/ConnectionDialogsNotifBase.inl	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,40 @@
+/*
+* 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: 
+*      Inline method definitions of the class CConnectionDialogsNotifBase.
+*
+*
+*/
+
+
+
+#ifndef __CONNECTIONDIALOGSNOTIFBASE__INL
+#define __CONNECTIONDIALOGSNOTIFBASE__INL
+
+
+// ================= MEMBER FUNCTIONS =======================
+//
+// ----------------------------------------------------------------------------
+// CConnectionDialogsNotifBase::SetCancelledFlag
+// ----------------------------------------------------------------------------
+//
+void CConnectionDialogsNotifBase::SetCancelledFlag( TBool aCancelled )
+    { 
+    iCancelled = aCancelled; 
+    }
+
+
+#endif // __CONNECTIONDIALOGSNOTIFBASE__INL
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/inc/ConnectionDialogsUidDefs.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,104 @@
+/*
+* Copyright (c) 2002 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 the UIDs used by Connection Dialogs
+*
+*/
+
+
+
+#ifndef __CONNECTIONDIALOGSUIDDEFS_H__
+#define __CONNECTIONDIALOGSUIDDEFS_H__
+
+
+// INCLUDES
+#include <e32std.h>
+
+
+// CONSTANTS
+
+// UIDs for CConnDlg plugins
+
+// ID of IAP dialog
+const TUid KUidCConnDlgIap = { 0x101FD675 };
+
+// ID of New IAP dialog
+const TUid KUidCConnDlgNewIap = { 0x101FD676 };
+
+// ID of New ISP dialog
+const TUid KUidCConnDlgNewIsp = { 0x101FD677 };
+
+// ID of Authentication dialog
+const TUid KUidCConnDlgAuthentication = { 0x101FD678 }; 
+
+// ID of Reconnect dialog
+const TUid KUidCConnDlgReconnect = { 0x101FD679 };
+
+// ID of QOS dialog
+const TUid KUidCConnDlgQos = { 0x101FD67A };
+
+// ID of Modem and Location dialog
+const TUid KUidCConnDlgModemAndLocation = { 0x101FD67B };
+
+// ID of Select connection dialog
+const TUid KUidCConnDlgSelectConn = { 0x10281BB3 };
+
+
+// Diisconnect dialog uid
+const TUid KUidDisconnectDlg = { 0x101F85F1 };
+
+// ID of Connecting via discreet popup
+const TUid KUidConnectingViaDiscreetPopup = { 0x20026FC5 };
+
+// ID of Connection error discreet popup
+const TUid KUidConnectionErrorDiscreetPopup = { 0x20026FEF };
+
+// WLAN uids
+
+// ID of SelectWLan dialog
+const TUid KUidSelectWLanDlg = { 0x10207373 };
+
+// ID of OfflineWlanNote dialog
+const TUid KUidCOfflineWlanNoteDlg = { 0x101FD671 };
+
+// ID of OfflineWlanDisabledNote dialog
+const TUid KUidCOfflineWlanDisabledNoteDlg = { 0x101FD672 };
+
+// ID of Easy Wep dialog
+const TUid KUidEasyWepDlg = { 0x101FD673 };
+
+// ID of Easy Wpa dialog
+const TUid KUidEasyWpaDlg = { 0x101FD674 };
+
+// ID of WLANNetworkUnavailableNote dialog
+const TUid KUidWLANNetworkUnavailableNoteDlg = { 0x101FD67F };
+// ALR uids
+
+// ID of confirmation queries
+const TUid KUidConfirmationQuery = { 0x10281BAF };
+
+// ID of two info notes
+const TUid KUidConnectViaNote = { 0x10281BB0 };
+
+// ID of WLAN Power Save Test query
+const TUid KUidWlanPowerSaveTestNote = { 0x101F6D4F };
+
+// ID of Easy Wapi dialog
+const TUid KUidEasyWapiDlg = { 0x101F6D51 };
+
+// ID of No WLAN networks are available at the moment -note
+const TUid KUidNoWLANNetworksAvailableNote = { 0x20016A83 };
+
+#endif  // __CONNECTIONDIALOGSUIDDEFS_H__
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/inc/ConnectionInfo.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,170 @@
+/*
+* 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:  Declaration of class CConnectionInfo
+*
+*/
+
+
+#ifndef __CCONNECTIONINFO_H__
+#define __CCONNECTIONINFO_H__
+
+// INCLUDES
+#include <e32base.h>
+
+
+// CLASS DECLARATION
+
+/**
+ * Information over the connection
+ */
+NONSHARABLE_CLASS( CConnectionInfo ) : public CBase
+    {
+    public:
+        /**
+        * NewL function
+        * @param aName      Name of the connection
+        * @param aId        ID of the connection
+        * @param aListItem  List item
+        * return CConnectionInfo*
+        */
+        static CConnectionInfo* NewL( TDesC& aName, TUint32 aId, 
+                                      TDesC &aListItem );
+
+        /**
+        * NewL function
+        * @param aName       Name of the connection
+        * @param aId         ID of the connection
+        * @param aVPN_iap_id ID of the AP related to the VPN AP
+        * @param aListItem   List item
+        * return CConnectionInfo*
+        */
+        static CConnectionInfo* NewL( TDesC& aName, TUint32 aId, 
+                                      TUint32 aVPN_iap_id, TDesC &aListItem );
+
+        /**
+        * NewL function
+        * @param aId         ID of the connection
+        * @param aDestinationId Destination Id
+        * @param aListItem   List item
+        * return CConnectionInfo*
+        */
+        static CConnectionInfo* NewL( TUint32 aId, TUint32 aDestinationId,
+                                      TDesC &aListItem );
+
+
+    private:
+        /**
+        * Constructor of the CConnectionInfo class
+        * @param aId     ID of the connection
+        * @param aIsVPN  ETrue if the connection is VPN
+        * @param aVPN_iap_id ID of the AP related to the VPN AP
+        * @param aBearer Bearer
+        * @return -
+        */
+        CConnectionInfo( TUint32 aId, TBool aIsVPN = EFalse, 
+                         TUint32 aVPN_iap_id = 0, TUint32 aDestinationId = 0 );
+
+    public:
+        /**
+        * ~CConnectionInfo() destructor
+        * @param  -
+        */
+        ~CConnectionInfo();
+
+    private:
+        /**
+        * Symbian default constructor.
+        * @param aName      Name of the connection
+        * @param aListItem  List item
+        */      
+        void ConstructL( TDesC &aName, TDesC &aListItem );
+
+        /**
+        * Symbian default constructor.
+        * @param aListItem  List item
+        */      
+        void ConstructL( TDesC &aListItem );
+
+    public:
+        /**
+        * Id() function
+        * Returns iId member
+        * @return iId member
+        */
+        inline const TUint32 Id() const;
+
+        /**
+        * ListItem() function
+        * Returns iListItem descriptor
+        * @return iListItem descriptor
+        */
+        inline const TDesC& ListItem() const;
+
+        /**
+        * Name() function
+        * Returns iName descriptor
+        * @return iName descriptor
+        */
+        inline const TDesC& Name() const;
+
+        /**
+        * VPNIapId() function
+        * Returns iVPN_iap_id member
+        * @return iVPN_iap_id member
+        */
+        inline const TUint32 VPNIapId() const;
+
+
+        /**
+        * VPNIapId() function
+        * Returns iDestinationId member
+        * @return iDestinationId member
+        */
+        inline const TUint32 DestinationId() const;
+
+
+        /**
+        * IsVPN() function
+        * Tells if connection is VPN
+        * @return ETrue if connection is VPN
+        */
+        inline const TBool IsVPN() const;
+
+
+    private:    // Data
+
+        // Name of the connection
+        HBufC*  iName;
+
+        // ID of the connection
+        const TUint32 iId;
+
+        // List item
+        HBufC*  iListItem;
+
+        // Tells if the connection is VPN or not
+        const TBool iIsVPN;
+
+        // ID of the AP related to the VPN connection
+        const TUint32 iVPN_iap_id;
+
+        // ID of the Destination
+        const TUint32 iDestinationId;
+    };
+
+#include "ConnectionInfo.inl"
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/inc/ConnectionInfo.inl	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,89 @@
+/*
+* 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: 
+*      Inline method definitions of the class CConnectionInfo
+*
+*
+*/
+
+
+
+#ifndef __CONNECTIONINFO_INL__
+#define __CONNECTIONINFO_INL__
+
+
+// ================= MEMBER FUNCTIONS =======================
+// ---------------------------------------------------------
+// CConnectionInfo::Id
+// ---------------------------------------------------------
+//
+const TUint32 CConnectionInfo::Id() const
+    {
+    return iId;
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionInfo::Name()
+// ---------------------------------------------------------
+//
+const TDesC& CConnectionInfo::Name() const
+    { 
+    return *iName; 
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionInfo::ListItem()
+// ---------------------------------------------------------
+//
+const TDesC& CConnectionInfo::ListItem() const
+    { 
+    return *iListItem; 
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionInfo::VPNIapId()
+// ---------------------------------------------------------
+//
+const TUint32 CConnectionInfo::VPNIapId() const
+    {
+    return iVPN_iap_id;
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionInfo::DestinationId()
+// ---------------------------------------------------------
+//
+const TUint32 CConnectionInfo::DestinationId() const
+    {
+    return iDestinationId;
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionInfo::VPNIapId()
+// ---------------------------------------------------------
+//
+const TBool CConnectionInfo::IsVPN() const
+    {
+    return iIsVPN;
+    }
+
+
+#endif // __CONNECTINGNOTENOTIF_INL__
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/inc/ConnectionInfoArray.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,68 @@
+/*
+* 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:  Declaration of class CConnectionInfoArray
+*
+*/
+
+
+#ifndef __CCONNECTIONINFOARRAY_H__
+#define __CCONNECTIONINFOARRAY_H__
+
+// INCLUDES
+#include <e32base.h>
+#include <bamdesca.h>
+
+
+// FORWARD DECLARATION
+class CConnectionInfo;
+
+
+// CLASS DECLARATION
+/**
+* CConnectionInfoArray class
+*/
+NONSHARABLE_CLASS( CConnectionInfoArray ) : 
+                                        public CArrayPtrFlat<CConnectionInfo>,
+                                        public MDesC16Array
+{
+    public:    
+        /**
+        * Default constructor
+        */
+        CConnectionInfoArray();        
+
+        
+    public: // from MDesCArray
+        /** 
+        * Returns the number of descriptor elements in a descriptor array.
+        * @return The number of descriptor elements in a descriptor array. 
+        */
+        virtual TInt MdcaCount() const;
+
+        /** 
+        * Indexes into a descriptor array.
+        * @param aIndex The position of the descriptor element within a 
+        * descriptor array. 
+        * The position is relative to zero; i.e. zero implies the first 
+        * descriptor element in a descriptor array. 
+        * @return A  non-modifiable pointer descriptor representing 
+        * the descriptor element located at position aIndex within a 
+        * descriptor array. 
+        */
+        virtual TPtrC MdcaPoint( TInt aIndex ) const;
+};                             
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/inc/ConnectionInfoKey.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,114 @@
+/*
+* 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:  Declaration of class CConnectionInfoKey
+*
+*/
+
+
+#ifndef __CCONNECTIONINFOKEY_H__
+#define __CCONNECTIONINFOKEY_H__
+
+
+// INCLUDES
+#include <e32base.h>
+
+
+// FORWARD DECLARATION
+class CConnectionInfo;
+
+
+// CLASS DECLARATION
+/**
+ * Connection information key class
+ */
+NONSHARABLE_CLASS( CConnectionInfoKey ) : public TKeyArrayFix
+    {
+    public:
+
+        /**
+        * SetPtr function
+        * @param aPtr   Pointer used to initialize the class pointer
+        */
+        void SetPtr( CArrayPtrFlat<CConnectionInfo>* aPtr );
+
+        /**
+        * Compare function
+        * @param aLeft  Left element to be compared
+        * @param aRight Right element to be compared
+        * @return TInt  Result of comparison of the elements
+        */
+        virtual TInt Compare( TInt aLeft, TInt aRight ) const;
+
+        /**
+        * At function
+        * @param nIndex Index of the element ot be returned
+        * @return TAny* The element at the given index
+        */
+        virtual TAny* At( TInt anIndex ) const;
+
+        /**
+        * TConnectionInfoKey constructor
+        * @return -
+        */
+        CConnectionInfoKey( TBool aIsWLANFeatureSupported );
+
+        /**
+        * ~CConnectionInfoKey() destructor
+        * @param  -
+        */
+        ~CConnectionInfoKey();
+        
+        /**
+        * NewL function
+        * @param aNameEasyWLAN  Name of Easy WLAN connection
+        * return CConnectionInfoKey*
+        */
+        static CConnectionInfoKey* NewL( TDesC &aNameEasyWLAN );
+
+        /**
+        * NewL function
+        * return CConnectionInfoKey*
+        */
+        static CConnectionInfoKey* NewL();
+
+
+    private:
+
+        /**
+        * Symbian default constructor.
+        * @param aNameEasyWLAN  Name of Easy WLAN connection
+        */      
+        void ConstructL( TDesC &aNameEasyWLAN );
+
+        /**
+        * Symbian default constructor.
+        */      
+        void ConstructL();
+
+
+    protected:
+        // Pointer to class containing info over the connection 
+        CArrayPtrFlat<CConnectionInfo> *iPtr;
+
+        // Tells if WLan feature is supported at runtime
+        TBool iIsWLANFeatureSupported;          
+
+        // Name of Easy WLAN connection
+        HBufC*  iNameEasyWLAN;
+    };
+
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/inc/ExpiryTimer.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,71 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Declaration of class CExpiryTimer 
+*
+*/
+
+
+#ifndef CEXPIRYTIMER_H
+#define CEXPIRYTIMER_H
+
+// INCLUDES
+#include <e32base.h>  
+#include <e32std.h>		
+
+#include "ExpiryTimerCallback.h"
+
+// CLASS DECLARATION
+/**
+ * Class that implements simple n second timer and callback
+ */
+NONSHARABLE_CLASS( CExpiryTimer ): public CTimer
+    {
+public:
+
+    /**
+    * Two-phased constructor.
+    * @param aCallback Pointer to the class where callback goes    
+    */
+    static CExpiryTimer* NewL( MExpiryTimerCallback& aCallback );  
+    
+    /**
+    * Starts up the timer       
+    */
+    void Start();
+
+private:
+    /**
+    * C++ constructor.
+    * @param aCallback Pointer to the class where callback goes    
+    */
+    CExpiryTimer( MExpiryTimerCallback& aCallback );
+
+    /**
+    * ConstructL.       
+    */
+    void ConstructL();
+
+    /**
+    * RunL. From CTimer.       
+    */
+    void RunL();
+
+private:
+    /**
+   * Callback reference
+   */
+    MExpiryTimerCallback& iCallback;
+    };
+
+#endif // CEXPIRYTIMER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/inc/ExpiryTimerCallback.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Declaration of class CExpiryTimerCallback 
+*
+*/
+
+
+#ifndef CEXPIRYTIMERCALLBACK_H
+#define CEXPIRYTIMERCALLBACK_H
+
+// INCLUDES
+#include <e32std.h>
+
+// CLASS DECLARATION
+/**
+ * Callback class for timer expiration
+ */
+
+class MExpiryTimerCallback
+    {
+public:
+    virtual void HandleTimedOut() = 0;
+    };
+
+#endif // CEXPIRYTIMERCALLBACK_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/rom/ConnectionDialogs.iby	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef __CONNECTIONDIALOGS_IBY__
+#define __CONNECTIONDIALOGS_IBY__
+
+
+ECOM_PLUGIN(connectiondialogswrapper.DLL,10207374.rsc)
+
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/rom/ConnectionUiUtilities.iby	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef __CONNECTIONUIUTILITIES_IBY__
+#define __CONNECTIONUIUTILITIES_IBY__
+
+file=ABI_DIR\BUILD_DIR\ConnectionUiUtilities.dll	SHARED_LIB_DIR\ConnectionUiUtilities.dll
+file=ABI_DIR\BUILD_DIR\ConnUiUtilsNotif.DLL		SHARED_LIB_DIR\ConnUiUtilsNotif.DLL
+
+SCALABLE_IMAGE(BITMAP_DIR,BITMAP_DIR,ConnectionUiUtilities)
+
+#endif // __CONNECTIONUIUTILITIES_IBY__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/rom/ConnectionUiUtilitiesResources.iby	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef __CONNECTIONUIUTILITIESRESOURCES_IBY__
+#define __CONNECTIONUIUTILITIESRESOURCES_IBY__
+
+data=DATAZ_\RESOURCE_FILES_DIR\ConnectionUiUtilities.RSC	RESOURCE_FILES_DIR\ConnectionUiUtilities.RSC
+data=DATAZ_\RESOURCE_FILES_DIR\ConnUiUtilsNotif.RSC		RESOURCE_FILES_DIR\ConnUiUtilsNotif.RSC
+
+
+#endif // __CONNECTIONUIUTILITIESRESOURCES_IBY__
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/rom/DisconnectDlg.iby	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef __DISCONNECTDLG_IBY__
+#define __DISCONNECTDLG_IBY__
+
+file=ABI_DIR\BUILD_DIR\DisconnectDlgClient.DLL 		SHARED_LIB_DIR\DisconnectDlgClient.dll
+
+file=ABI_DIR\BUILD_DIR\DisconnectDlg.dll		SHARED_LIB_DIR\DisconnectDlg.dll
+
+SCALABLE_IMAGE(BITMAP_DIR,BITMAP_DIR,DisconnectDlgUi)
+
+#endif //__DISCONNECTDLG_IBY__
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/rom/DisconnectDlgResources.iby	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef __DISCONNECTDLGRESOURCES_IBY__
+#define __DISCONNECTDLGRESOURCES_IBY__
+
+data=DATAZ_\RESOURCE_FILES_DIR\DisconnectDlg.RSC	RESOURCE_FILES_DIR\DisconnectDlg.RSC
+
+#endif //__DISCONNECTDLGRESOURCES_IBY__
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/rom/agentdialog.iby	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef __AGENTDIALOG_IBY__
+#define __AGENTDIALOG_IBY__
+
+REM Test agent dialog server
+
+file=ABI_DIR\DEBUG_DIR\agentdialog.dll    SHARED_LIB_DIR\agentdialog.dll
+
+
+#if defined(TEXT_ONLY_ROM)
+#include <agentshellnotifier.iby>
+#endif
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/rom/cconndlg.iby	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef __CCONNDLG_IBY__
+#define __CCONNDLG_IBY__
+
+REM Generic connection dialogs
+
+file=ABI_DIR\BUILD_DIR\CCONNDLGPLUGIN.DLL		SHARED_LIB_DIR\CCONNDLGPLUGIN.DLL
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/rom/cconndlgResources.iby	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef __CCONNDLGRESOURCES_IBY__
+#define __CCONNDLGRESOURCES_IBY__
+
+data=DATAZ_\RESOURCE_FILES_DIR\CConndlgplugin.rsc	RESOURCE_FILES_DIR\CConndlgplugin.rsc
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/src/ActiveIAPListing.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,945 @@
+/*
+* Copyright (c) 2002 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 CActiveIAPListing
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "ActiveIAPListing.h"
+#include "ConnectionInfo.h"
+#include "ConnectionInfoKey.h"
+#include "ConnectionInfoArray.h"
+#include "ConnectionDialogsLogger.h"
+
+#include <commdb.h>
+#include <featmgr.h>
+#include <StringLoader.h>
+#include <centralrepository.h>
+#include <WlanCdbCols.h>
+#include <wlanmgmtcommon.h>
+#ifndef __WINS__
+#include <wlanmgmtclient.h>
+#endif
+#include <AknWaitDialog.h>
+#include <AknUtils.h>
+#include <centralrepository.h>
+#include <ProfileEngineSDKCRKeys.h>
+#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include <commsdat.h>
+#else
+#include <commsdat.h>
+#include <commsdat_partner.h>
+#endif
+
+
+
+// CONSTANTS
+
+/**
+* For iPeriodic Timer, 60 seconds
+*/
+LOCAL_D const TInt KTickDefaultInterval = 60000000;
+
+/**
+* Length of a string made of the MAX_INT and a tab character.
+*/
+LOCAL_D const TInt KLenMaxIntAndTab = 12;
+
+_LIT( KMrouterName, "mRouter" );
+
+// Panic string
+#if defined(_DEBUG)
+_LIT( KErrNullPointer, "NULL pointer" );
+#endif
+
+
+// TYPES
+
+/**
+* Indexes of the icons
+*/
+enum 
+    {
+    EIconIndexGPRS,         // Icon for GPRS access point
+    EIconIndexCSD,          // Icon for CSD access point
+    EIconIndexHSCSD,        // Icon for HSCSD access point
+    EIconIndexEasyWLAN,     // Icon for Easy WLan access point
+    EIconIndexWLAN          // Icon for WLan access point
+    };
+
+
+
+
+///////////////////////////////////////////////////////////////////////////////
+
+// ---------------------------------------------------------
+// CActiveIAPListing::CActiveIAPListing()
+// ---------------------------------------------------------
+//
+CActiveIAPListing::CActiveIAPListing( const TConnectionPrefs& aPrefs )
+: CActive( EPriorityUserInput ), 
+  iDb( NULL ), 
+  iWaitDialog( NULL ), 
+#ifndef __WINS__
+  iWlanMgmt( NULL ),
+#endif // !__WINS__
+  iPrefs( aPrefs )
+    {
+    }
+
+    
+// ---------------------------------------------------------
+// CActiveIAPListing::~CActiveIAPListing()
+// ---------------------------------------------------------
+//    
+CActiveIAPListing::~CActiveIAPListing()
+    {
+    CLOG_ENTERFN( "~CActiveIAPListing " );
+    Cancel();
+    
+    delete iDb;
+    iDb = NULL;
+    
+    iAvailableIaps.Close();  
+    
+    if ( iIAPs )
+        {
+        iIAPs->ResetAndDestroy();
+        }
+    delete iIAPs;    
+    iIAPs = NULL;
+       
+    if ( iWlanIAPs )
+        {
+        iWlanIAPs->ResetAndDestroy();
+        }    
+    delete iWlanIAPs;
+    iWlanIAPs = NULL;
+
+    delete iActIAPs;    // do not destroy, gets items from iIAPs and iWlanIAPs
+    iActIAPs = NULL;
+    
+    CLOG_LEAVEFN( "~CActiveIAPListing " );
+    }
+
+
+// ---------------------------------------------------------
+// CActiveIAPListing::ConstructL()
+// ---------------------------------------------------------
+//
+void CActiveIAPListing::BaseConstructL()
+    {     
+    CLOG_ENTERFN( "CActiveIAPListing::ConstructL " );  
+       
+    CActiveScheduler::Add( this );            
+    
+    FeatureManager::InitializeLibL();
+    
+    if ( iPrefs.iBearerSet & ECommDbBearerWLAN )
+        {
+        iIsWLANFeatureSupported = 
+            FeatureManager::FeatureSupported( KFeatureIdProtocolWlan );    
+        }
+    else
+        {
+        iIsWLANFeatureSupported = EFalse;
+        }    
+    
+    FeatureManager::UnInitializeLib();      
+
+    if ( iIsWLANFeatureSupported )
+        {
+#ifndef __WINS__
+        iWlanMgmt = CWlanMgmtClient::NewL();
+#endif // !__WINS__
+        }
+                  
+    iPeriodic = CPeriodic::NewL( CActive::EPriorityStandard ); 
+    iDb = CCommsDatabase::NewL();
+    
+    iActIAPs = new( ELeave ) CConnectionInfoArray();
+    
+    CLOG_LEAVEFN( "CActiveIAPListing::ConstructL " );
+    }
+
+
+// ---------------------------------------------------------
+// CActiveIAPListing::Cancel()
+// ---------------------------------------------------------
+// 
+void CActiveIAPListing::Cancel()
+    {
+    CLOG_ENTERFN( "CActiveIAPListing::Cancel " );
+    
+    StopTimer();
+
+    delete iWaitDialog;
+    iWaitDialog = NULL;
+                                    
+#ifndef __WINS__
+    delete iWlanMgmt;
+    iWlanMgmt = NULL;     
+#endif // !__WINS__
+    
+    CLOG_WRITEF( _L( "Cancel iStatus.Int: %d" ), iStatus.Int() );
+    CActive::Cancel();
+    
+    CLOG_LEAVEFN( "CActiveIAPListing::Cancel " );
+    }
+
+
+// ---------------------------------------------------------
+// CActiveIAPListing::DoCancel()
+// ---------------------------------------------------------
+// 
+void CActiveIAPListing::DoCancel()
+    {
+    }
+
+    
+// ---------------------------------------------------------
+// CActiveIAPListing::RunL()
+// ---------------------------------------------------------
+//     
+void CActiveIAPListing::RunL()
+    {
+    }
+
+
+// ---------------------------------------------------------
+// CActiveIAPListing::StartTimerL
+// ---------------------------------------------------------
+//    
+void CActiveIAPListing::StartTimerL( TInt aTickInterval )
+    {    
+    CLOG_ENTERFN( "CActiveIAPListing::StartTimerL " );
+    
+    if( !iPeriodic )
+        {
+        iPeriodic = CPeriodic::NewL( CActive::EPriorityStandard ); 
+        }
+        
+    iPeriodic->Start( aTickInterval, aTickInterval, TCallBack( Tick, this ) );
+    
+    CLOG_LEAVEFN( "CActiveIAPListing::StartTimerL " );
+    }
+
+
+// ---------------------------------------------------------
+// CActiveIAPListing::StopTimer
+// ---------------------------------------------------------
+//
+void CActiveIAPListing::StopTimer()
+    {
+    CLOG_ENTERFN( "CActiveIAPListing::StopTimer " );  
+    
+    if( iPeriodic )
+        {
+        CLOG_WRITE( "iPeriodic" );
+        iPeriodic->Cancel();
+        CLOG_WRITE( "Cancel" );
+        
+        delete iPeriodic;
+        CLOG_WRITE( "delete" );
+        
+        iPeriodic = NULL;
+        }        
+    
+    CLOG_LEAVEFN( "CActiveIAPListing::StopTimer " );
+    }
+
+    
+// ---------------------------------------------------------
+// CActiveIAPListing::Tick
+// ---------------------------------------------------------
+//
+TInt CActiveIAPListing::Tick( TAny* aObject )
+    {
+    CLOG_ENTERFN( "CActiveIAPListing::Tick " );  
+    
+    CActiveIAPListing* myself = 
+                            static_cast<CActiveIAPListing*>( aObject );
+
+    if ( myself->iStatus == KErrCancel )
+        {
+        CLOG_WRITE( "iStatus == KErrCancel" );        
+        myself->StopTimer();            
+        }
+    else
+        {
+        CLOG_WRITE( "iStatus != KErrCancel" );    
+                                                              
+        myself->SetActive();
+        myself->iClientStatus = &( myself->iStatus );  
+        *( myself->iClientStatus ) = KRequestPending;  
+
+#ifndef __WINS__
+        if ( myself->iIsWLANFeatureSupported )
+            {
+            myself->iWlanMgmt->GetAvailableIaps( *( myself->iClientStatus ), 
+                                                 myself->iAvailableIaps );
+            }
+        else
+            {
+            User::RequestComplete( myself->iClientStatus, KErrNone );         
+            }
+#else                                                     
+        User::RequestComplete( myself->iClientStatus, KErrNone );         
+#endif  // !__WINS__
+                                               
+        }
+    
+    CLOG_LEAVEFN( "CActiveIAPListing::Tick " );      
+    
+    return 1;
+    }        
+
+ 
+
+// ---------------------------------------------------------
+// CActiveIAPListing::CreateArraysL()
+// ---------------------------------------------------------
+//     
+void CActiveIAPListing::CreateArraysL( TInt aResourceId, 
+                                       TBool aChangeConnection,
+                                       TUint32 aIAPId )
+    {
+    iIAPs = new( ELeave ) CConnectionInfoArray();
+    iWlanIAPs = new( ELeave ) CConnectionInfoArray();
+    BuildConnectionListL( aResourceId, aChangeConnection, aIAPId);
+    SetActive();
+    iClientStatus = &iStatus;
+    *iClientStatus = KRequestPending;  
+        
+#ifndef __WINS__
+    if ( iIsWLANFeatureSupported )
+        {
+        iWlanMgmt->GetAvailableIaps( *iClientStatus, iAvailableIaps );
+        }  
+    else
+#endif // !__WINS__
+        {
+        // send to runl
+        User::RequestComplete( iClientStatus, KErrNone );  // send back to runl
+        }                 
+    }
+
+
+// ---------------------------------------------------------
+// CActiveIAPListing::StartSearchIAPsL()
+// ---------------------------------------------------------
+//
+void CActiveIAPListing::BaseStartSearchIAPsL( TInt aResourceId )
+    {    
+    CLOG_ENTERFN( "CActiveIAPListing::StartSearchIAPsL " );
+    
+    if ( iIsWLANFeatureSupported )
+        {    
+        delete iWaitDialog;
+        iWaitDialog = NULL;                
+
+        iWaitDialog = new( ELeave )CAknWaitDialog( REINTERPRET_CAST( 
+                                        CEikDialog**, &iWaitDialog ), ETrue );
+        iWaitDialog->ExecuteLD( aResourceId ); 
+        }
+    
+    SetActive();    
+    iClientStatus = &iStatus;
+    
+    User::RequestComplete( iClientStatus, KErrNone );   // send to runl
+
+    CLOG_LEAVEFN( "CActiveIAPListing::StartSearchIAPsL " );
+    }    
+
+    
+// ---------------------------------------------------------
+// CActiveIAPListing::GetRefreshInterval()
+// ---------------------------------------------------------
+//    
+TInt CActiveIAPListing::GetRefreshInterval( const TUid aRepositoryUid,
+                                            TUint32 aKey )
+    {
+    CLOG_ENTERFN( "CActiveIAPListing::GetRefreshInterval" );
+
+    CRepository* repository = NULL;
+    TInt err( KErrNone );
+
+    TRAP( err, 
+          repository = CRepository::NewL( aRepositoryUid ) );
+          
+    TInt variant( 0 );  
+    CLOG_WRITEF( _L( "err : %d" ), err );
+      
+    if ( err == KErrNone )
+        {
+        TInt retval = repository->Get( aKey, variant );
+                                       
+        CLOG_WRITEF( _L( "retval : %d" ), retval );
+                                                                             
+        if ( retval == KErrNotFound )
+            {
+            variant = KTickDefaultInterval;
+            }
+        }
+     else
+        {
+        variant = KTickDefaultInterval;
+        }
+
+    delete repository;
+
+    CLOG_WRITEF( _L( "variant : %d" ), variant );
+    
+    CLOG_LEAVEFN( "CActiveIAPListing::GetRefreshInterval" );
+    
+    return variant;            
+    }
+            
+    
+// ----------------------------------------------------------------------------
+// void CActiveIAPListing::MergeArraysL()
+// ----------------------------------------------------------------------------
+//
+void CActiveIAPListing::MergeArraysL( TInt aResourceId )
+    {
+    CLOG_ENTERFN( "CActiveIAPListing::MergeArraysL " );
+
+    iActIAPs->Reset();
+
+    TInt countIAPs = iIAPs->Count();
+    TInt i;
+
+    for( i = 0; i < countIAPs; ++i )
+        {
+        iActIAPs->AppendL( iIAPs->At( i ) );
+        }
+    
+    if ( iIsWLANFeatureSupported )
+        {
+        TInt countWlanIAPs = iWlanIAPs->Count();
+        CLOG_WRITEF( _L( "iWlanIAPs count: %d" ), countWlanIAPs );
+
+#ifdef __WINS__
+
+        for( i = 0; i < countWlanIAPs; ++i )
+            {
+            iActIAPs->AppendL( iWlanIAPs->At( i ) );
+            }
+
+#else
+
+        TInt countAvailIAPs = iAvailableIaps.Count();
+        CLOG_WRITEF( _L( "iAvailableIaps count: %d" ), countAvailIAPs );
+
+        CConnectionInfo* conInf = NULL;
+        for( int j = 0; j < countAvailIAPs; ++j )
+            {
+            TUint32 actIap = TUint32( iAvailableIaps[j] );
+            for( i = 0; i < countWlanIAPs; ++i )
+                {     // Scan all the WlanIAPs, because there could be VPNs 
+                      // that use the same network
+                conInf = iWlanIAPs->At( i );
+                if ( ( conInf->IsVPN() && conInf->VPNIapId() == actIap ) ||
+                     ( !conInf->IsVPN() && conInf->Id() == actIap ) )
+                    {
+                    iActIAPs->AppendL( conInf );
+                    }
+                }
+            }    
+#endif // __WINS__
+        }    
+
+    SortNameListL( aResourceId );
+        
+    CLOG_LEAVEFN( "CActiveIAPListing::MergeArraysL " );
+    }
+
+
+// ---------------------------------------------------------
+// CActiveIAPListing::SortNameListL
+// ---------------------------------------------------------
+//
+void CActiveIAPListing::SortNameListL( TInt aResourceId )
+    {
+    CLOG_ENTERFN( "CActiveIAPListing::SortNameListL " );      
+    
+    CConnectionInfoKey* infoKey;
+
+    HBufC *nameEasyWLAN = NULL;
+
+    if ( iIsWLANFeatureSupported )
+        {
+        nameEasyWLAN = StringLoader::LoadL( aResourceId );
+        CleanupStack::PushL( nameEasyWLAN );
+
+        infoKey = CConnectionInfoKey::NewL( *nameEasyWLAN );
+        }
+    else
+        {
+        infoKey = CConnectionInfoKey::NewL();
+        }
+
+    infoKey->SetPtr( iActIAPs );
+
+    CleanupStack::PushL( infoKey );
+    
+    // Sort returns KErrGeneral if stack overflow, otherwise, returns
+    // KErrNone. So we will Leave only if stack overflow,
+    // but than that really does not matter...
+    User::LeaveIfError( iActIAPs->Sort( *infoKey ) );
+
+    CleanupStack::Pop( infoKey );
+    delete infoKey;
+
+    if ( iIsWLANFeatureSupported )
+        {
+        CleanupStack::PopAndDestroy( nameEasyWLAN );
+        }
+
+    CLOG_LEAVEFN( "CActiveIAPListing::SortNameListL " );      
+    }
+
+
+
+// ---------------------------------------------------------
+// CActiveIAPListing::BuildConnectionListL()
+// ---------------------------------------------------------
+//
+void CActiveIAPListing::BuildConnectionListL( TInt aResourceId,
+                                              TBool aChangeConnection, 
+                                              TUint32 aIAPId )
+    {
+    CLOG_ENTERFN( "CActiveIAPListing::BuildConnectionListL " );  
+    
+    __ASSERT_DEBUG( iDb, User::Panic( KErrNullPointer, KErrNone ) );
+
+    CCommsDbTableView* table;
+
+    TUint32 id;
+    TUint32 serviceId;
+    TLanType lanType = ELan;   
+    TBool isInfrastructure = ETrue;     
+    
+    TBuf<CommsDat::KMaxTextLength+1> name;     // +1 because it "Zero 
+                                                // terminates" the string
+    TBuf<CommsDat::KMaxTextLength+1> nameIAP;  // +1, as before
+    TBuf<CommsDat::KMaxTextLength> serviceType;
+
+    CCommsDbTableView* serviceTable;
+    
+    CLOG_WRITEF( _L( "iPrefs.iBearerSet: %x" ), iPrefs.iBearerSet );    
+    CLOG_WRITEF( _L( "iPrefs.iDirection: %d" ), iPrefs.iDirection );     
+    
+    CRepository* cr = CRepository::NewLC( KCRUidProfileEngine );
+
+	TInt selectedProfile;
+
+	TRAP_IGNORE( cr->Get( KProEngActiveProfile, selectedProfile ) );
+
+	// To get also VPN APs
+    TUint bearerSet = iPrefs.iBearerSet | ECommDbBearerVirtual;
+	
+	TBool isOffLine = selectedProfile == 5;
+	
+	if ( isOffLine ) // testing if current profile is the offline profile
+		{
+    	TUint mask=0;
+    	mask = ~mask ^ ECommDbBearerCSD ^ ECommDbBearerGPRS;
+    	bearerSet &= mask;
+    	}
+    	
+    CleanupStack::PopAndDestroy(cr); 	//cr	
+    
+#ifdef __WINS__
+    bearerSet |= ECommDbBearerLAN;     // To add Ethernet AP and WLan (in case)
+#else
+    if ( iIsWLANFeatureSupported )
+        {
+        bearerSet |= ECommDbBearerLAN; // To add WLan AP
+        }
+#endif
+    if ( ( bearerSet & ECommDbBearerLAN ) && 
+         ( bearerSet & ECommDbBearerWLAN ) )
+        {   // Otherwise OpenIAPTableViewMatchingBearerSetLC returns two
+            // records for each WLan AP
+        bearerSet ^= ECommDbBearerWLAN;     
+        }
+
+    CLOG_WRITEF( _L( "bearerSet1: %x" ), bearerSet  );        
+        
+    if ( ( bearerSet & ECommDbBearerLAN ) && 
+         ( bearerSet & ECommDbBearerPAN ) )
+        {   // Otherwise OpenIAPTableViewMatchingBearerSetLC returns two
+            // records for each WLan AP
+        bearerSet ^= ECommDbBearerPAN;     
+        }
+    CLOG_WRITEF( _L( "bearerSet2: %x" ), bearerSet  );                
+        
+    if ( ( bearerSet & ECommDbBearerPAN ) && 
+         ( bearerSet & ECommDbBearerWLAN ) )
+        {   // Otherwise OpenIAPTableViewMatchingBearerSetLC returns two
+            // records for each WLan AP
+        bearerSet ^= ECommDbBearerPAN;     
+        }
+    CLOG_WRITEF( _L( "bearerSet3: %x" ), bearerSet  );      
+
+    table = iDb->OpenIAPTableViewMatchingBearerSetLC( bearerSet, 
+                                                      iPrefs.iDirection );
+
+    TInt errorCode = table->GotoFirstRecord();
+    TBool easyWLanRecordFound = EFalse;
+    TInt iconNum = EIconIndexGPRS;
+    TBool showAP;
+    TUint32 vpn_iap_id;
+    
+    TBuf<CommsDat::KMaxTextLength+KLenMaxIntAndTab> temp;
+    _LIT( KIconIdText, "%d\t%s" );
+    
+    while ( errorCode == KErrNone )
+        {
+        lanType = ENotDefined;
+        isInfrastructure = ETrue;
+		
+		// Get type of IAP service
+        table->ReadTextL( TPtrC( IAP_SERVICE_TYPE ), serviceType );
+        TBool isVPN = serviceType == TPtrC( VPN_SERVICE );
+
+        // Get name for IAP
+        table->ReadTextL( TPtrC( COMMDB_NAME ), name );
+        name.ZeroTerminate();
+
+        // Get id for IAP
+        table->ReadUintL( TPtrC( COMMDB_ID ), id );
+
+        // Get IAP service
+        table->ReadUintL( TPtrC( IAP_SERVICE ), serviceId );
+
+        CLOG_WRITEF( _L( "IAP name: %S" ), &name );
+        CLOG_WRITEF( _L( "COMMDB_ID: %d" ), id );
+        CLOG_WRITEF( _L( "ServiceId: %d" ), serviceId );
+
+        if ( isVPN )
+            {
+            // Get Ip/phone number from IAP service table
+            serviceTable = iDb->OpenViewMatchingUintLC( serviceType, 
+                                                        TPtrC( COMMDB_ID ),
+                                                        serviceId );
+            errorCode = serviceTable->GotoFirstRecord();
+            if ( errorCode == KErrNone )
+                {
+                TRAPD (err, serviceTable->ReadUintL( TPtrC( VPN_SERVICE_IAP ), 
+                                                     vpn_iap_id ));
+                                         
+                if ( err != KErrNone )
+                 { 
+            	    CLOG_WRITEF( _L( "Put showAP as false: %d" ), err );
+                  showAP = EFalse;
+                  }
+
+                CCommsDbTableView* serviceTableIAP = 
+                            iDb->OpenViewMatchingUintLC( TPtrC( IAP ),
+                                                         TPtrC( COMMDB_ID ),
+                                                         vpn_iap_id );
+
+                errorCode = serviceTableIAP->GotoFirstRecord();
+                if ( errorCode == KErrNone )
+                    {
+                    // Get name for IAP
+                    serviceTableIAP->ReadTextL( TPtrC( COMMDB_NAME ), 
+                                                nameIAP );
+                    nameIAP.ZeroTerminate();
+
+                    serviceTableIAP->ReadTextL( TPtrC( IAP_SERVICE_TYPE ), 
+                                                serviceType );
+                    serviceTableIAP->ReadUintL( TPtrC( IAP_SERVICE ), 
+                                                serviceId );
+                    
+                    TUint32 bearermask;                            
+                    serviceTableIAP->ReadUintL(TPtrC( IAP_BEARER ), bearermask );
+                    
+                    //this is for dealing with vpns using gprs and csd iaps while being offline
+                    if( ( ( bearermask & ECommDbBearerCSD ) || 
+                    	  ( bearermask & ECommDbBearerGPRS ) )
+                    	&& isOffLine )
+                    	{
+                    	//do not add it and jump to the next record
+                    	CleanupStack::PopAndDestroy( serviceTableIAP );
+                		CleanupStack::PopAndDestroy( serviceTable );
+                    	errorCode = table->GotoNextRecord();
+                    	continue;
+                    	}
+                    
+                    }
+                CleanupStack::PopAndDestroy( serviceTableIAP );
+                }
+            CleanupStack::PopAndDestroy( serviceTable );
+            }
+        else
+            {
+            nameIAP = name;
+            }
+
+        lanType = ( serviceType == TPtrC( LAN_SERVICE ) /*|| isVPN*/ ) ? 
+                    GetTypeOfLanL( serviceId, isInfrastructure ) : ENotDefined;
+
+        if( !aChangeConnection || ( id != aIAPId ) || 
+            ( lanType == EEasyWLan && isVPN ) || 
+            ( lanType == EEasyWLan && !easyWLanRecordFound ) )
+            {
+            // Filter out mRouter access points
+            if ( errorCode == KErrNone && 
+                 nameIAP.Left( KMrouterName().Length() ).CompareF( 
+                               KMrouterName ) != 0 )
+                {
+                showAP = ETrue;
+
+                if ( serviceType == TPtrC( OUTGOING_GPRS ) ||
+                     serviceType == TPtrC( INCOMING_GPRS ) )
+                    {
+                    iconNum = EIconIndexGPRS;
+                    if ( isVPN && 
+                         !( iPrefs.iBearerSet & ECommDbBearerVirtual ) && 
+                         !( iPrefs.iBearerSet & ECommDbBearerWcdma ) )
+                        {
+                        showAP = EFalse;
+                        }
+                    }
+                else if ( serviceType == TPtrC( LAN_SERVICE )  )
+                    {
+                    if ( ( isVPN && 
+                           !( iPrefs.iBearerSet & ECommDbBearerVirtual ) ) ||
+                         !isVPN )
+                        {
+                        if ( lanType != ELan && !iIsWLANFeatureSupported )
+                            {
+                            showAP = EFalse;
+                            }
+                        
+
+#ifndef __WINS__
+                        else if ( lanType == ELan && 
+                                  !( iPrefs.iBearerSet & ECommDbBearerLAN ) )
+                            {
+                            showAP = EFalse;
+                            }
+#endif  // __WINS__
+                        }
+
+                    // There is not an icon specific for LAN AP:
+                    // GPRS icon is used
+                    iconNum = EIconIndexGPRS;
+                    if ( showAP && iIsWLANFeatureSupported && lanType != ELan )
+                        {
+                        if ( lanType == EEasyWLan && 
+                             !easyWLanRecordFound && 
+                             !isVPN )
+                            {
+                            HBufC *msg = StringLoader::LoadL( aResourceId );
+                            CleanupStack::PushL( msg );
+
+                            name = *msg;
+                            name.ZeroTerminate();
+
+                            CleanupStack::PopAndDestroy( msg );
+
+                            iconNum = EIconIndexEasyWLAN;
+
+                            easyWLanRecordFound = ETrue;
+                            }
+                        else if ( lanType == EEasyWLan && isVPN )
+                            {
+                            iconNum = EIconIndexEasyWLAN;
+                            }
+                        else
+                            {    
+                            iconNum = EIconIndexWLAN;
+                            lanType = EWLan;
+                            }
+                        }
+                    }
+                else
+                    {
+                    if ( isVPN && 
+                         !( iPrefs.iBearerSet & ECommDbBearerVirtual ) && 
+                         !( iPrefs.iBearerSet & ECommDbBearerCSD ) )
+                        {
+                        showAP = EFalse;
+                        }
+                    else
+                        {
+                        // Get Ip/phone number from IAP service table
+                        serviceTable = iDb->OpenViewMatchingUintLC( 
+                                                            serviceType, 
+                                                            TPtrC( COMMDB_ID ),
+                                                            serviceId );
+
+                        errorCode = serviceTable->GotoFirstRecord();
+                        if ( errorCode == KErrNone )
+                            {
+                            TUint32 bearer = EBearerTypeHSCSD;
+            
+                            TRAPD( err, serviceTable->ReadUintL( 
+                                                    TPtrC( ISP_BEARER_TYPE ),
+                                                    bearer ) );
+                                                       
+                            if ( err != KErrNone )
+                                { // don't leave if read value is not in table.
+                                if ( err == KErrUnknown )
+                                    {
+                                    bearer = EBearerTypeCSD;
+                                    }
+                                else
+                                    {
+                                    showAP = EFalse;
+                                    //User::Leave( err );
+                                    }
+                                }
+
+                            iconNum = ( bearer == EBearerTypeHSCSD ) ? 
+                                      EIconIndexHSCSD : EIconIndexCSD;
+                            }
+                        else
+                            {
+                            showAP = EFalse;
+                            }
+
+                        CleanupStack::PopAndDestroy( serviceTable );
+                        }
+                    }
+
+                if ( showAP )
+                    {
+                    AknTextUtils::LanguageSpecificNumberConversion( name );
+
+                    temp.FillZ( CommsDat::KMaxTextLength+KLenMaxIntAndTab );
+                    temp.Format( KIconIdText, iconNum, name.Ptr() );
+                
+                    CConnectionInfo* conIn;
+
+                    if ( isVPN )
+                        {
+                        conIn = CConnectionInfo::NewL( name, id, vpn_iap_id,
+                                                       temp );
+                        }
+                    else
+                        {
+                        conIn = CConnectionInfo::NewL( name, id, temp );
+                        }
+
+                    CLOG_WRITEF( _L( "id: %d" ), id );
+                    CLOG_WRITEF( _L( "lanType: %d" ), ( TInt )lanType );
+                    CLOG_WRITEF( _L( "isInfrastructure: %d" ), ( TInt )isInfrastructure );
+                
+                
+                    CleanupStack::PushL( conIn );
+                                                                
+                    if ( lanType == EWLan && isInfrastructure )
+                        {
+                        iWlanIAPs->AppendL( conIn );                    
+                        }
+                    else
+                        {
+                        iIAPs->AppendL( conIn );
+                        }
+                    
+                    CleanupStack::Pop( conIn );
+                    }
+                }
+            }
+
+        // Next IAP
+        errorCode = table->GotoNextRecord();
+        }
+
+    CleanupStack::PopAndDestroy( table );
+    
+    CLOG_WRITEF( _L( "iIAPs count: %d" ), iIAPs->Count() );
+    CLOG_WRITEF( _L( "iWlanIAPs count: %d" ), iWlanIAPs->Count() );
+    
+    CLOG_LEAVEFN( "CActiveIAPListing::BuildConnectionListL " );
+    }
+
+    
+// ----------------------------------------------------------------------------
+// TLanType CActiveIAPListing::GetTypeOfLanL()
+// ----------------------------------------------------------------------------
+//
+TLanType CActiveIAPListing::GetTypeOfLanL( TUint32 aServiceId, 
+                                           TBool& aIsInfrastructure )
+    {
+    CLOG_ENTERFN( "CActiveIAPListing::GetTypeOfLanL " );      
+    
+    TLanType lanType = ELan;
+    
+    aIsInfrastructure = ETrue;
+    if ( iIsWLANFeatureSupported )
+        {
+        __ASSERT_DEBUG( iDb, User::Panic( KErrNullPointer, KErrNone ) );
+
+        CCommsDbTableView* wLanServiceTable = NULL;
+            
+        TRAPD( err, 
+            { // this leaves if the table is empty....
+            wLanServiceTable = iDb->OpenViewMatchingUintLC( 
+                                                    TPtrC( WLAN_SERVICE ),
+                                                    TPtrC( WLAN_SERVICE_ID ),
+                                                    aServiceId );
+            CleanupStack::Pop( wLanServiceTable ); // wLanServiceTable
+            } );
+
+        CLOG_WRITEF( _L( "OpenViewMatchingUintLC returned %d" ), err );
+        CLOG_WRITEF( _L( "for ServiceId: %d" ), aServiceId );
+
+        if ( err == KErrNone )
+            {
+            CleanupStack::PushL( wLanServiceTable );
+
+            TInt errorCode = wLanServiceTable->GotoFirstRecord();
+
+            CLOG_WRITEF( _L( "GotoFirstRecord returned %d" ), 
+                                errorCode );
+            TWlanSsid sSID;                                
+
+            if ( errorCode == KErrNone )
+                {
+                wLanServiceTable->ReadTextL( TPtrC( NU_WLAN_SSID ), sSID );
+                lanType = sSID.Length() ? EWLan : EEasyWLan;
+                
+                TUint32 connMode;
+                TRAP( err, wLanServiceTable->ReadUintL( 
+                                                TPtrC( WLAN_CONNECTION_MODE ),
+                                                connMode ) );
+                if ( err == KErrNone && !connMode )
+                    {
+                    aIsInfrastructure = EFalse;
+                    }
+                }
+
+            CleanupStack::PopAndDestroy( wLanServiceTable );
+            }
+        else if ( err != KErrNotFound )
+            {
+            User::LeaveIfError( err );
+            }
+        }
+    
+    CLOG_LEAVEFN( "CActiveIAPListing::GetTypeOfLanL " );      
+    
+    return lanType;
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/src/ConnectionDialogsNotifBase.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,135 @@
+/*
+* Copyright (c) 2004 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 base plugin.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "ConnectionDialogsNotifBase.h"
+
+#include <bautils.h>
+#include <eikenv.h>
+#include <data_caging_path_literals.hrh>
+
+
+// CONSTANTS
+
+// ROM folder
+_LIT( KDriveZ, "z:" );
+
+
+// ================= MEMBER FUNCTIONS =======================
+    
+
+// ---------------------------------------------------------
+// CConnectionDialogsNotifBase::TNotifierInfo 
+//                                  CConnectionDialogsNotifBase::Info() const
+// ---------------------------------------------------------
+//
+CConnectionDialogsNotifBase::TNotifierInfo 
+                                    CConnectionDialogsNotifBase::Info() const
+    {
+    return iInfo;
+    }
+
+
+// ---------------------------------------------------------
+// TPtrC8 CConnectionDialogsNotifBase::StartL()
+// ---------------------------------------------------------
+//
+TPtrC8 CConnectionDialogsNotifBase::StartL( const TDesC8& /*aBuffer*/ )
+    {
+    return KNullDesC8().Ptr();
+    }
+
+// ---------------------------------------------------------
+// void CConnectionDialogsNotifBase::Cancel()
+// ---------------------------------------------------------
+//
+void CConnectionDialogsNotifBase::Cancel()
+    {
+    }
+
+// ---------------------------------------------------------
+// TPtrC8 CConnectionDialogsNotifBase::UpdateL()
+// ---------------------------------------------------------
+//
+TPtrC8 CConnectionDialogsNotifBase::UpdateL(const TDesC8& /*aBuffer*/)
+    {
+    return KNullDesC8().Ptr();
+    }
+
+
+// ---------------------------------------------------------
+// void CConnectionDialogsNotifBase::Release()
+// ---------------------------------------------------------
+//
+void CConnectionDialogsNotifBase::Release()
+    {
+    delete this;
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionDialogsNotifBase::CConnectionDialogsNotifBase()
+// ---------------------------------------------------------
+//
+CConnectionDialogsNotifBase::CConnectionDialogsNotifBase()
+: iCancelled( EFalse ), 
+  iResource( 0 )
+    {
+    }
+
+
+// ---------------------------------------------------------
+// void CConnectionDialogsNotifBase::ConstructL()
+// ---------------------------------------------------------
+//
+void CConnectionDialogsNotifBase::ConstructL( const TDesC& aResourceFileName,
+                                         const TBool aResourceFileResponsible )
+    {
+    if ( aResourceFileResponsible )
+        {
+        // Since this is a .DLL, resource files that are to be used by the
+        // notifier aren't added automatically so we do that here.
+        TFileName fileName;
+
+        fileName.Append( KDriveZ );
+        fileName.Append( KDC_RESOURCE_FILES_DIR );   
+        fileName.Append( aResourceFileName );
+
+        BaflUtils::NearestLanguageFile( CCoeEnv::Static()->FsSession(),
+                                        fileName );
+        iResource = CCoeEnv::Static()->AddResourceFileL( fileName );
+        }
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionDialogsNotifBase::~CConnectionDialogsNotifBase()
+// ---------------------------------------------------------
+//
+CConnectionDialogsNotifBase::~CConnectionDialogsNotifBase()
+    {   
+    if ( iResource )
+        {
+        CCoeEnv::Static()->DeleteResourceFile( iResource );        
+        }
+    }
+
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/src/ConnectionInfo.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,124 @@
+/*
+* Copyright (c) 2002 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 CConnectionInfo.
+*
+*/
+
+
+// INCLUDE FILES
+#include "ConnectionInfo.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+//
+// ---------------------------------------------------------
+// CConnectionInfo::CConnectionInfo
+// ---------------------------------------------------------
+//
+CConnectionInfo::CConnectionInfo( TUint32 aId, TBool aIsVPN, 
+                                  TUint32 aVPN_iap_id, TUint32 aDestinationId )
+: iName( NULL ),
+  iId( aId ),
+  iListItem( NULL ),
+  iIsVPN( aIsVPN ),
+  iVPN_iap_id( aVPN_iap_id ),
+  iDestinationId( aDestinationId )
+    {
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionInfo::~CConnectionInfo
+// ---------------------------------------------------------
+//
+CConnectionInfo::~CConnectionInfo()
+    {
+    delete iName;
+    delete iListItem;
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionInfo::NewL( TDesC &aName, TUint32 aId, 
+//                        TDesC &aListItem )
+// ---------------------------------------------------------
+//
+CConnectionInfo* CConnectionInfo::NewL( TDesC &aName, TUint32 aId, 
+                                        TDesC &aListItem )
+    {
+    CConnectionInfo* self = new (ELeave) CConnectionInfo( aId );
+    CleanupStack::PushL( self );
+    self->ConstructL( aName, aListItem );
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionInfo::NewL()
+// ---------------------------------------------------------
+//
+CConnectionInfo* CConnectionInfo::NewL( TDesC &aName, TUint32 aId, 
+                                        TUint32 vpn_iap_id, TDesC &aListItem )
+    {
+    CConnectionInfo* self = new( ELeave )CConnectionInfo( aId, ETrue, 
+                                                          vpn_iap_id );
+    CleanupStack::PushL( self );
+    self->ConstructL( aName, aListItem );
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionInfo::NewL()
+// ---------------------------------------------------------
+//
+CConnectionInfo* CConnectionInfo::NewL( TUint32 aId, TUint32 aDestId, 
+                                        TDesC &aListItem )
+    {
+    CConnectionInfo* self = new( ELeave )CConnectionInfo( aId, EFalse, 0,
+                                                          aDestId );
+    CleanupStack::PushL( self );
+    self->ConstructL( aListItem );
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionInfo::ConstructL()
+// ---------------------------------------------------------
+//
+void CConnectionInfo::ConstructL( TDesC &aName, TDesC &aListItem )
+    {
+    iName = aName.AllocL();
+    iListItem = aListItem.AllocL();
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionInfo::ConstructL()
+// ---------------------------------------------------------
+//
+void CConnectionInfo::ConstructL( TDesC &aListItem )
+    {
+    iListItem = aListItem.AllocL();
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/src/ConnectionInfoArray.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,58 @@
+/*
+* 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:  Implementation of class CConnectionInfoArray.
+*
+*/
+
+
+// INCLUDE FILES
+#include "ConnectionInfoArray.h"
+#include "ConnectionInfo.h"
+
+// CONSTANTS
+
+LOCAL_D const TInt KArrayGranularity = 3;
+
+
+// ================= MEMBER FUNCTIONS =======================
+// ---------------------------------------------------------
+// CConnectionInfoArray::CConnectionInfoArray
+// ---------------------------------------------------------
+//
+CConnectionInfoArray::CConnectionInfoArray() 
+: CArrayPtrFlat<CConnectionInfo>( KArrayGranularity )
+    {
+    }
+
+// ---------------------------------------------------------
+// CConnectionInfoArray::MdcaCount
+// ---------------------------------------------------------
+//
+TInt  CConnectionInfoArray::MdcaCount() const
+    {
+    return Count();
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionInfoArray::MdcaPoint
+// ---------------------------------------------------------
+//
+TPtrC CConnectionInfoArray::MdcaPoint( TInt aIndex ) const
+    {
+    return this->At( aIndex )->ListItem();    
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/src/ConnectionInfoKey.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,151 @@
+/*
+* 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:  Implementation of class CConnectionInfoKey.
+*
+*/
+
+
+// INCLUDE FILES
+#include "ConnectionInfoKey.h"
+#include "ConnectionInfo.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+//
+// ---------------------------------------------------------
+// CConnectionInfoKey::CConnectionInfoKey()
+// ---------------------------------------------------------
+//
+CConnectionInfoKey::CConnectionInfoKey( TBool aIsWLANFeatureSupported )
+: TKeyArrayFix( 0, ECmpCollated ),
+  iIsWLANFeatureSupported( aIsWLANFeatureSupported )
+    {
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionInfoKey::~CConnectionInfoKey()
+// ---------------------------------------------------------
+//
+CConnectionInfoKey::~CConnectionInfoKey()
+    {
+    if ( iIsWLANFeatureSupported )
+        {
+        delete iNameEasyWLAN;
+        }
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionInfoKey::NewL()
+// ---------------------------------------------------------
+//
+CConnectionInfoKey* CConnectionInfoKey::NewL( TDesC &aNameEasyWLAN )
+    {
+    CConnectionInfoKey* self = new (ELeave) CConnectionInfoKey( ETrue );
+    CleanupStack::PushL( self );
+    self->ConstructL( aNameEasyWLAN );
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionInfoKey::ConstructL()
+// ---------------------------------------------------------
+//
+void CConnectionInfoKey::ConstructL( TDesC &aNameEasyWLAN )
+    {
+    iNameEasyWLAN = aNameEasyWLAN.AllocL();
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionInfoKey::NewL()
+// ---------------------------------------------------------
+//
+CConnectionInfoKey* CConnectionInfoKey::NewL()
+    {
+    CConnectionInfoKey* self = new (ELeave) CConnectionInfoKey( EFalse );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionInfoKey::ConstructL()
+// ---------------------------------------------------------
+//
+void CConnectionInfoKey::ConstructL()
+    {
+    }
+
+
+
+// ---------------------------------------------------------
+// CConnectionInfoKey::SetPtr( CArrayPtrFlat<CConnectionInfo>* aPtr )
+// ---------------------------------------------------------
+//
+void CConnectionInfoKey::SetPtr( CArrayPtrFlat<CConnectionInfo>* aPtr )
+    {
+    iPtr = aPtr;
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionInfoKey::Compare( TInt aLeft, TInt aRight ) const
+// ---------------------------------------------------------
+//
+TInt CConnectionInfoKey::Compare( TInt aLeft, TInt aRight ) const
+    {
+    TInt retval;
+
+    if ( iIsWLANFeatureSupported &&
+         ! iPtr->At( aLeft )->Name().CompareC( *iNameEasyWLAN ) )
+        {
+        retval = -1;
+        }
+    else if ( iIsWLANFeatureSupported &&
+              ! iPtr->At( aRight )->Name().CompareC( *iNameEasyWLAN ) )
+        {
+        retval = 1;
+        }
+    else
+        {
+        retval = iPtr->At( aLeft )->Name().CompareC( 
+                                                iPtr->At( aRight )->Name() );
+        }
+
+    return retval;
+    }
+
+
+// ---------------------------------------------------------
+// CConnectionInfoKey::At( TInt anIndex ) const
+// ---------------------------------------------------------
+//
+TAny* CConnectionInfoKey::At( TInt anIndex ) const
+    {
+    TDesC16 tem( iPtr->At( anIndex )->Name() );
+    TAny* ptr = ( TAny* )&tem;
+
+    return ptr;
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/src/ExpiryTimer.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of class CExpiryTimer 
+*
+*/
+
+
+#include "ExpiryTimer.h"
+
+static const TInt KTimeout = 60000000;
+// ---------------------------------------------------------------------------
+// NewL. Constructs and returns the class object.
+// ---------------------------------------------------------------------------
+//
+CExpiryTimer* CExpiryTimer::NewL( MExpiryTimerCallback& aCallback )
+    {
+    CExpiryTimer* self = new (ELeave) CExpiryTimer( aCallback );
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(); // self;
+    return self;
+    }
+
+CExpiryTimer::CExpiryTimer( MExpiryTimerCallback& aCallback ) 
+ : CTimer(CActive::EPriorityStandard),
+   iCallback( aCallback )
+    {
+    CActiveScheduler::Add(this);
+    }
+
+void CExpiryTimer::ConstructL()
+    {
+    CTimer::ConstructL();        
+    }
+
+// ---------------------------------------------------------------------------
+// Start. Starts up the timer
+// ---------------------------------------------------------------------------
+//
+
+void CExpiryTimer::Start()
+    {
+    TTimeIntervalMicroSeconds32 timeout = KTimeout;
+    After( timeout );
+    }
+
+void CExpiryTimer::RunL()
+    {
+    iCallback.HandleTimedOut();
+    }
Binary file data/cccccc00_emulator.cre has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatcreator/Inc/cdcdatamobilitytables.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,140 @@
+/*
+* 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 the class CDataMobilityTables.
+*
+*/
+
+
+
+
+#ifndef DATAMOBILITYTABLESHANDLER_H
+#define DATAMOBILITYTABLESHANDLER_H
+
+
+// INCLUDES
+#include <e32base.h>
+#include <metadatabase.h>
+
+using namespace CommsDat;
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+* CDataMobilityTables
+* Capable of checking the existence of certain Data Mobility specific 
+* tables and - if necessary create them.
+*/
+class CDataMobilityTables : public CBase
+    {   
+    public:
+
+        /**
+        * Static constructor
+        */
+        static CDataMobilityTables* NewL();
+
+        /**
+        * Destructor
+        */
+        virtual ~CDataMobilityTables();
+
+        /**
+        * Checks if Data Mobility ALR tables exist. Creates them if not.
+        */
+        void CheckAndCreateAlrTablesL();
+        
+        /**
+        * Checks if Data Mobility MIP tables exist. Creates them if not.
+        */
+        void CheckAndCreateMipTablesL();
+
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CDataMobilityTables();
+
+        /**
+        * By default Symbian second phase constructor is private.
+        */
+        void ConstructL();
+        
+        /**
+        * Check if Global Bearer Type Priorization Table exists in CommsDat;
+        * create if not.
+        */
+        void CreateGlobalBearerTypeTableL();
+        
+        /**
+        * Check if Data Mobility Selection Policy Table exists in CommsDat;
+        * create if not.
+        */
+        void CreateDataMobilitySelectionPolicyTableL();
+        
+        /**
+        * Check if Virtual IAP Next Layer Table exists in CommsDat;
+        * create if not.
+        */
+        void CreateVirtualIAPNextLayerTableL();
+
+        /**
+        * Check if MIP Service Table exists in CommsDat; create if not.
+        */
+        void CreateMIPServiceTableL();
+        
+        /**
+        * Check if MIP Service Table exists in CommsDat; create if not.
+        */
+        void CreateMIP4TableL();
+        
+        /**
+        * Check if MIP Service Table exists in CommsDat; create if not.
+        */
+        void CreateMIP6TableL();
+        
+        /**
+        * Check if SNAP Metadata Table exists in CommsDat; create if not.
+        */
+        void CreateSNAPMetadataTableL();
+        
+        /**
+        * Check if IAP Metadata Table exists in CommsDat; create if not.
+        */
+        void CreateIAPMetadataTableL();
+        
+        /**
+        * Check if WLAN Destination network Table exists in CommsDat; 
+        * create if not.
+        */
+        void CreateDestNetworkTableL();
+        
+        /**
+        * Populates the Global Bearer Priorization table.
+        */
+        void PopulateGlobalBearerTypeTableL();
+        
+    private:    // Data
+    
+        //@var session - Owned
+        CMDBSession* iSession;
+        
+    };
+
+#endif      // DATAMOBILITYTABLESHANDLER_H
+
+// End of File.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatcreator/Inc/cdcdumptables.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,140 @@
+/*
+* Copyright (c) 2002 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 the class CDbCreator
+*
+*/
+
+
+
+
+#ifndef DUMP_TABLES_H
+#define DUMP_TABLES_H
+
+// INCLUDE FILES
+
+#include <e32base.h>
+#include <s32file.h>
+
+// CLASS DECLARATION
+
+class CMDBSession;
+
+/**
+* CDumpTables writes data from CommsDat to CSV format file.
+* CDumpTables dumps the CommsDat tables which are not dumped 
+* by any other application.
+*/
+class CDumpTables : public CBase
+    {
+
+    public:
+    
+        /**
+         * Two-phase constructor.
+         * @return CDumpTables instance.
+         */
+        static CDumpTables* NewL();
+
+        /**
+         * Two-phase constructor.
+         * @return CDumpTables instance. Let the instance on the CleanupStack. 
+         */
+        static CDumpTables* NewLC();
+     
+        /**
+         * Destructor.
+         */
+        virtual ~CDumpTables();
+        
+        /**
+         * Dumps the unsupported tables to CSV format file.
+         * @param outFileName name of the output file with full path. 
+         */
+        void DoDumpTablesL( const TFileName& aOutFileName );
+        
+    protected:
+
+        /**
+         * Second phase constructor. Leaves on failure.
+         */
+        void ConstructL();
+        
+     private:
+    
+        /**
+         * Constructor
+         */
+        CDumpTables();
+        
+        /**
+         * Template method for dumping one CommsDat table
+         * @param class T representing the table which is dumped. 
+         */
+        template<class T> void DumpTableL( const TDesC* aTableName );
+
+        /**
+         * Opens a output file for dumping. It tries to open the file
+         * and if it does not exist then a new one created.
+         * @param aFileName name of the file. It cannot be NULL.  
+         */
+        TInt OpenFileL( const TFileName& aFileName );
+        
+        /**
+         * Writes 8 bit descriptor to 16 bit unicode file in CSV format.
+         * @param aDes the written text. It gets the ownership.  
+         */
+        void WriteL( HBufC8* aDes );
+
+        /**
+         * Writes 16 bit descriptor to 16 bit unicode file in CSV format.
+         * @param aDes the written text. It gets the ownership.  
+         */
+        void WriteL( HBufC16* aDes );
+
+        /**
+         * Transform the parameter field to CSV accepted format.
+         * @param aField the field that should be checked and transform
+         * to CSV format if it is necessary
+         * @return the CSV acceptable format.
+         */
+        HBufC16* TransformToCSVFormatLC( const HBufC16* aField );
+        
+        /**
+         * Checks the parameter field if transformation to CSV format is
+         * necessary.
+         * @param aField the field which should be checked.
+         * @return ETrue if transformation is necessary else EFalse.
+         */
+        TBool CheckCSVTransformNeedL( HBufC16* aFiled );
+
+
+    private:
+    
+        // Session for CommsDat
+        CommsDat::CMDBSession* iSession;
+        
+        // Fs for file handling
+        RFs   iRfs;
+
+        // Output file
+        RFileWriteStream iFile;
+        
+        // Counter for how many double qoutes are in the given text. 
+        TInt iNumOfDQuotes;        
+
+    };
+
+#endif DUMP_TABLES_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatcreator/Inc/cdclogfilename.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2004 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:   contains logger macros
+*
+*/
+
+
+
+
+#ifndef CDC_LOGFILE_NAME_H
+#define CDC_LOGFILE_NAME_H
+
+
+/// Directory where the log file can be found.
+_LIT16( KLogDir, "cdc" );
+
+/// Log file name.
+_LIT16( KLogFile, "cdc.txt" );
+
+
+#endif // CDC_LOGFILE_NAME_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatcreator/Inc/cdcprocessorbase.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,231 @@
+/*
+* Copyright (c) 2004 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 the class CProcessorBase.
+*
+*/
+
+
+
+
+#ifndef APFILE_PARSER_BASE_H
+#define APFILE_PARSER_BASE_H
+
+
+// INCLUDE FILES
+
+#include <e32base.h>
+#include <e32std.h>
+#include <f32file.h>
+#include <flogger.h>
+#include <cmmanagerext.h>
+#include <cmconnectionmethodext.h>
+
+#include "cdcerrors.h"
+#include "cdccommon.h"
+
+// FORWARD DECLARATION
+class CTagContainer;
+class CReaderBase;
+
+// CONSTANTS
+
+/**
+* Max length of a line in the log file.
+*/
+LOCAL_D const TInt KMaxLogLineLength = 256;
+
+
+// CLASS DECLARATION
+/**
+* CProcessorBase
+* Abstract base class for processor classes
+*/
+class CProcessorBase : public CBase
+    {
+    
+    public: 
+        /**
+        * Destructor.
+        */
+        virtual ~CProcessorBase();
+
+        /**
+        * Processes the input files line by line.
+        */
+        void ParseFileL();
+
+
+    protected:
+        /**
+        * Constructor
+        * @param aFileReader pointer to the file reader
+        * @param aCmManager Connection Method Manager
+        * @param aPluginArray array that holds the plugins - and so the CMs
+        * @param aPluginNames array that holds the CM names
+        */
+        CProcessorBase( CReaderBase* aFileReader,
+                        RCmManagerExt& aCmManager,
+                        RPointerArray< RCmConnectionMethodExt >& aPluginArray,
+                        RPointerArray< HBufC >& aPluginNames );
+               
+               
+        /**
+        * Constructor
+        * @param aFileReader pointer to the file reader
+        * @param aCmManager Connection Method Manager
+        * @param aPluginArray array that holds the plugins - and so the CMs
+        * @param aPluginNames array that holds the CM names
+        * @param aDestArray array that holds the Destination
+        * @param aDestNames array that holds the Destination names
+        */
+        CProcessorBase( CReaderBase* aFileReader,
+                        RCmManagerExt& aCmManager,
+                        RPointerArray< RCmConnectionMethodExt >& aPluginArray,
+                        RPointerArray< HBufC >& aPluginNames,
+                        RPointerArray< RCmDestinationExt >& aDestArray,
+                        RPointerArray< HBufC >& aDestNames );       
+        /**
+        * Processes the actual tag.
+        * @param aFieldIDPresent shows if field id is read from input file
+        */
+        virtual void ProcessTagL( TBool aFieldIDPresent );
+
+        /**
+        * Processes the special fields of the tag. Every descendand can implement
+        * processes of their special fields
+        * @param aField ID of the field
+        * @param aTagPtr data conatining by the field
+        * @param aDx serial number of the field
+        */
+        virtual void ProcessSpecialFieldsL( TInt /*aField*/, 
+                                            HBufC* /*aTagPtr*/, 
+                                            TInt /*aDx*/ ) {};
+        
+        /**
+        * Does the necessary settings before processing tag. Every descendand 
+        * can implement their special needs.
+        */
+        virtual void Reset() {};
+
+        /**
+        * Calculates and sets the AddressFromServer field
+        */
+        virtual void SetAddressFromServerL( TInt aIPField1, 
+                                           TInt aIPField2, 
+                                           TInt aAddrFromSField,
+                                           TInt aIPField1IP6,
+                                           TInt aIPField2IP6,
+                                           TInt aAddrFromSFieldIP6 );
+        /**
+        * Virtual function. Processes the actual access point.
+        */
+        virtual void ProcessAPL();
+
+        /**
+        * Writes the actual created access point to the log file.
+        */
+        virtual void DoLogL();
+
+        /**
+        * Returns the TagContainer
+        * @return iTagContainer
+        */
+        CTagContainer& TagContainer();
+
+        /**
+        * Adds one item to the plugin array. 
+        */
+        void AddToPluginArrayL();
+        
+        /**
+        * Retrieves the last plugin from the plugin array. 
+        * @return the last plugin in the plugin array
+        */
+        RCmConnectionMethodExt& GetLastPluginL();
+        
+        /**
+        * Retrieves the plugin in position from the plugin array. 
+        * @param aPos position of the desired plugin. 
+        * @return the plugin in position from the plugin array
+        */
+        RCmConnectionMethodExt& GetPluginL( TInt aPos );
+
+        /**
+        * Retrieves count of plugins in the plugin array. 
+        * @return count of plugins in the plugin array
+        */
+        TInt PluginCount();
+        
+        RCmDestinationExt* FindDestinationL( HBufC* aName );
+        
+        TInt GetDestinationIdL( HBufC16* aName );
+ 
+        RCmConnectionMethodExt* FindPluginL( HBufC* aName );
+
+        RCmConnectionMethodExt* FindPluginL( HBufC* aName, TInt& aPos );
+
+        TInt GetPluginIdL( HBufC16* aName );
+        
+        TBool ProcessTag( HBufC* aTag, RCmConnectionMethodExt* aPlugin );
+        TBool SetGeneralFieldL( TInt aField, HBufC* aPtrTag ); 
+
+    private:
+        
+        
+        TInt CheckPluginName(  HBufC* aName );
+
+
+    protected:
+       
+        // @var Gives back AP data from the file.
+        CReaderBase*                   iFileReader;
+        
+        // @var Pointer to Connection Method Manager that is required to access
+        // Access Point data
+        RCmManagerExt*                 iCmManager;
+        
+        // @var Shows whether proxies have already been enabled or not.
+        TBool iProxyEnabled;   
+
+        // @var Indicates whether the connection method is protected or not
+        TBool iIsProtected;
+        
+        // @var Name of the actual IAP or Destination
+        HBufC* iName;    
+
+        // @var Actual IAP
+        RCmConnectionMethodExt iPlugin;
+        
+        // @var Actual Bearer Type
+        TUint iBearerType;
+
+    protected:
+    
+        // @var Plugin array that is used to store pointers to access point data
+        RPointerArray< RCmConnectionMethodExt >* iPluginArray;
+        // @var Plugin array that is used to store names of access point data
+        RPointerArray< HBufC >* iPluginName;
+        
+        // @var Destination array that is used to store pointers to Destination data
+        RPointerArray< RCmDestinationExt >* iDestArray;
+        // @var Destination array that is used to store names of Destination
+        RPointerArray< HBufC >* iDestName;
+
+    };
+
+
+#endif // APFILE_PARSER_BASE_H
+
+
+// End of File.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatcreator/Inc/cdcprocessordn.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,150 @@
+/*
+* 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:   Declaration of the class CProcessorDN.
+*
+*/
+
+
+
+
+#ifndef PROCESSOR_DN_H
+#define PROCESSOR_DN_H
+
+
+// INCLUDE FILES
+
+#include <e32base.h>
+#include <cmdestinationext.h>
+#include <cmmanagerext.h>
+#include <cmconnectionmethodext.h>
+#include <cmmanagerdef.h>
+
+#include "cdcprocessorbase.h"
+
+
+// FORWARD DECLARATION
+
+// CLASS DECLARATION
+
+/**
+* CProcessorDN
+* Inherits from the class CProcessorBase.
+* Creates Destination Network Item from CTagContainer and
+* adds it to the database
+*/
+class CProcessorDN : public CProcessorBase
+    {
+    public:
+        /**
+        * Two-phase constructor.
+        * @param aFileReader pointer to the file reader
+        * @param aCmManager Connection Method Manager
+        * @param aCmArray Array of the processed connection methods
+        * @param aIsFirstRound ETrue if this is the first round of DN
+        *                          processing. In this case DNs are created.
+        *                    EFalse otherwise. This time connection methods
+        *                          are added.
+        * @return CProcessorDN instance.
+        */
+        static CProcessorDN* NewL( CReaderBase* aFileReader,
+                                   RCmManagerExt& aCmManager,
+                                   RPointerArray< RCmConnectionMethodExt >&
+                                                            aPluginArray,
+                                   RPointerArray< HBufC >& aPluginNames, 
+                                   RPointerArray< RCmDestinationExt >& aDestArray,
+                                   RPointerArray< HBufC >& aDestNames,
+                                   RArray< TBool >& aCmInDest,
+                                   TBool aIsFirstRound );
+        /**
+        * Destructor.
+        */
+        virtual ~CProcessorDN();
+
+    protected:
+        /**
+        * Second phase constructor. Leaves on failure.
+        */
+        void ConstructL();
+
+        /**
+        * Constructor.
+        * @param aFileReader pointer to the file reader
+        * @param aCmManager Connection Method Manager
+        * @param aCmArray Array of the processed connection methods
+        * @param aIsFirstRound ETrue if this is the first round of DN
+        *                          processing. In this case DNs are created.
+        *                    EFalse otherwise. This time connection methods
+        *                          are added.
+        */
+        CProcessorDN( CReaderBase* aFileReader,
+                      RCmManagerExt& aCmManager,
+                      RPointerArray< RCmConnectionMethodExt >& aPluginArray,
+                      RPointerArray< HBufC >& aPluginNames, 
+                      RPointerArray< RCmDestinationExt >& aDestArray,
+                      RPointerArray< HBufC >& aDestNames,
+                      RArray< TBool >& aCmInDest,
+                      TBool aIsFirstRound );
+        
+        /**
+        * 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.
+        */
+        virtual void ProcessTagL( TBool aFieldIDPresent );
+
+        /**
+        * From CProcessorBase. Processes the actual access point.
+        * @return the result of the process.
+        */
+        virtual void ProcessAPL();
+
+        /**
+        * 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
+        RCmDestinationExt iDestination;
+
+        // @var Pointer to the destiantion that has been created and stored
+        // in iDestArray
+        RCmDestinationExt* iDest;
+        
+        // @var Stores the protection level of the destination
+        CMManager::TProtectionLevel iProtectionLevel;
+        
+        // @var Stores whether this is the first round of DN processing or not
+        TBool iIsFirstRound;
+        
+        // @var ETrue if the destination cannot processed so it is dropped away
+        TBool iDestinationDropped;
+        
+        RArray< TBool >* iCmInDest;
+    };
+
+
+#endif PROCESSOR_DN_H
+
+
+// End of File.
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatcreator/Inc/cdcprocessorglobal.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,196 @@
+/*
+* Copyright (c) 2004 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 the class CProcessorGlobal.
+*
+*/
+
+
+
+
+#ifndef CDCPROCESSORGLOBAL_H
+#define CDCPROCESSORGLOBAL_H
+
+
+// INCLUDE FILES
+
+#include <e32base.h>
+
+#include <metadatabase.h>
+
+#include "cdcprocessorbase.h"
+
+using namespace CommsDat;
+
+// FORWARD DECLARATIONS
+class RCmConnectionMethodExt;
+class RCmDestinationExt;
+class CReaderBase;
+class CommsDat::CMDBSession;
+struct TCmGenConnSettings;
+class RCmManagerExt;
+
+// CLASS DECLARATION
+
+/**
+* CProcessorGlobal
+* Inhertits from the class CProcessorBase.
+* Reads Access Points related settings from CTagContainer.
+*/
+class CProcessorGlobal : public CProcessorBase
+    {
+    public:
+        /**
+        * Two-phase constructor.
+        * @param aFileReader pointer to the file reader
+        * @param aCmManager 
+        * @return CProcessorGlobal instance.
+        */
+        static CProcessorGlobal* NewL( 
+                                CReaderBase* aFileReader,
+                                RCmManagerExt& aCmManager,
+                                RPointerArray< RCmConnectionMethodExt >& aPluginArray,
+                                RPointerArray< HBufC >& aPluginNames, 
+                                RPointerArray< RCmDestinationExt >& aDestArray,
+                                RPointerArray< HBufC >& aDestNames,
+                                RPointerArray< HBufC >& aDefCon );
+
+        // Stores the default connection values
+        void SetDefaultConnectionL();
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CProcessorGlobal();
+        
+    protected:
+       
+        /**
+        * Constructor.
+        * @param aFileReader pointer to the file reader
+        */
+        CProcessorGlobal( CReaderBase* aFileReader,
+                          RCmManagerExt& aCmManager,
+                          RPointerArray< RCmConnectionMethodExt >& aPluginArray,
+                          RPointerArray< HBufC >& aPluginNames, 
+                          RPointerArray< RCmDestinationExt >& aDestArray,
+                          RPointerArray< HBufC >& aDestNames,
+                          RPointerArray< HBufC >& aDefCon);
+                          
+        /**
+        * Second phase constructor. Leaves on failure.
+        */
+        void ConstructL();
+        
+        /**
+        * From CProcessorBase. Processes the actual tag.
+        * @param aFieldIDPresent shows if field id is read from input file
+        * @return TInt The result of the process, KErrNone if the actual tag is
+        * valid.
+        */
+        virtual void ProcessTagL( TBool aFieldIDPresent );
+        
+        /**
+        * From CProcessorBase. Processes the actual access point.
+        * @return The result of the processing
+        */
+        virtual void ProcessAPL();
+        
+
+    private:
+    
+        /**
+        * Updates bearer priority array with the specified bearers priority or
+        * UI priority.
+        * @param aField Identifier of the the bearer whose priority/UI-priority
+        *               is to be updated.
+        * @param aPrio The new priority.
+        */
+        void UpdateGlobalBearerArrayL
+                            ( TDbCreatorGlobalSettings aField, TUint32 aPrio );
+                
+        /**
+        * Sets the value of default connection type parsing and converting
+        *                           the param string to the right enum. 
+        * @param aPtrTag string of the type.
+        */
+        void SetDefaultConnectionTypeL( HBufC16* aPtrTag );
+                            
+        /**
+        * Sets the id of default connection method. It founds the connection
+        *     method or destination corresponding to the given name.
+        *     Type depends on the default connection type.
+        *     If the method/destination cannot be found then no id is set.
+        * @param aPtrTag string of the connection method/destination name.
+        */
+        void SetDefaultConnectionNameL( HBufC16* aPtrTag );
+
+        /**
+        * Sets the WLAN Usage parameter in general connection settings.
+        * @param aPtrTag string containing the parameter's value.
+        */
+        void SetGenConnSettingWlanUsage( HBufC16* aPtrTag );
+
+        /**
+        * Sets the "Seamlessness (cellular data usage) in home networks"
+        * parameter in general connection settings.
+        * @param aPtrTag string containing the parameter's value.
+        */
+        void SetGenConnSettingSeamlessnessHome( HBufC16* aPtrTag );
+
+        /**
+        * Sets the "Seamlessness (cellular data usage) in visitor networks"
+        * parameter in general connection settings.
+        * @param aPtrTag string containing the parameter's value.
+        */
+        void SetGenConnSettingSeamlessnessVisitor( HBufC16* aPtrTag );
+
+        // Stores the general connection settings, using CMM
+        void SetGenConnSettingsL();
+        
+        // Stores the default connection's values, using CMM
+        void SetDefConnRecordL( const TInt aId );
+        
+        // Stores the WLAN parameters
+        void SaveGlobalWlanParameterL( const TUint32 aTableType, 
+        							   const TDbCreatorGlobalSettings aField, 
+        							   const HBufC16* const aValue );
+
+    private:
+        
+        // @var Default connection's data
+        TCmDefConnType iDefaultConnectionType;
+        TBool iDefaultConnectionSet;
+
+        // @var GPRS attach mode : whenneeded/whenavailable
+        TBool  iAttachWhenNeeded;
+        
+        RArray< TBearerPriority > iBearerArray;
+        TBool iBearerArrayChanged;
+        
+        // @var Stores the default connection type / name pair
+        RPointerArray< HBufC >* iDefCon; 
+        
+        // @var Stores the general connection settings
+        TCmGenConnSettings* iGenConnSettings;
+        
+		//@var session - Owned
+        CMDBSession* iSession;
+		
+	    //@var WLAN supported flag
+	    TBool iIsWlanS;
+    };
+
+#endif CDCPROCESSORGLOBAL_H
+
+// End of File.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatcreator/Inc/cdcprocessorlan.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,93 @@
+/*
+* 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:   Declaration of the class CProcessorLan.
+*
+*/
+
+
+
+
+#ifndef PROCESSOR_LAN_H
+#define PROCESSOR_LAN_H
+
+
+// INCLUDE FILES
+
+#include <e32base.h>
+#include <cmmanagerext.h>
+#include <cmconnectionmethodext.h>
+
+#include "cdcprocessorbase.h"
+
+
+// FORWARD DECLARATION
+
+// CLASS DECLARATION
+
+/**
+* CProcessorLan
+* Inhertits from the class CProcessorBase.
+* Creates internet Access Point Item from CTagContainer and 
+* adds AP item to database.
+*/
+class CProcessorLan : public CProcessorBase
+    {
+    public:
+        /**
+        * Two-phase constructor.
+        * @param aFileReader pointer to the file reader
+        * @param aCmManager Connection Method Manager
+        * @param aPluginArray Array that stores the processed plugins
+        * @return CProcessorLan instance.
+        */
+        static CProcessorLan* NewL( CReaderBase* aFileReader,
+                                    RCmManagerExt& aCmManager,
+                                    RPointerArray< RCmConnectionMethodExt >& aPluginArray,
+                                    RPointerArray< HBufC >& aPluginNames );
+        /**
+        * Destructor.
+        */
+        virtual ~CProcessorLan();
+
+    protected:
+        /**
+        * Second phase constructor. Leaves on failure.
+        */
+        void ConstructL();
+
+        /**
+        * Constructor.
+        * @param aFileReader pointer to the file reader
+        * @param aCmManager Connection Method Manager
+        * @param aPluginArray Array that stores the processed plugins
+        */
+        CProcessorLan( CReaderBase* aFileReader,
+                       RCmManagerExt& aCmManager,
+                       RPointerArray< RCmConnectionMethodExt >& aPluginArray,
+                       RPointerArray< HBufC >& aPluginNames );
+        
+        /**
+        * 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.
+        */
+        virtual void ProcessSpecialFieldsL( TInt aField, HBufC* aTagPtr, TInt aDx );
+    };
+
+
+#endif PROCESSOR_LAN_H
+
+
+// End of File.
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatcreator/Inc/cdcprocessorpacketdata.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,127 @@
+/*
+* 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:   Declaration of the class CProcessorPacketData.
+*
+*/
+
+
+
+
+#ifndef PROCESSOR_PACKET_DATA_H
+#define PROCESSOR_PACKET_DATA_H
+
+
+// INCLUDE FILES
+
+#include <e32base.h>
+#include <cmmanagerext.h>
+#include <cmconnectionmethodext.h>
+
+#include "cdcprocessorbase.h"
+
+
+// FORWARD DECLARATION
+
+// CLASS DECLARATION
+
+/**
+ * CLingerElement is array element for linger value end corresponding CM name.
+ */ 
+NONSHARABLE_CLASS( CLingerElement ) : public CBase 
+        {
+        public: 
+        ~CLingerElement();
+        HBufC* iName;
+        HBufC* iLinger; 
+        };
+
+/**
+* CProcessorPacketData
+* Inhertits from the class CProcessorBase.
+* Creates internet Access Point Item from CTagContainer and 
+* adds AP item to database.
+*/
+class CProcessorPacketData : public CProcessorBase
+    {
+    public:
+        /**
+        * Two-phase constructor.
+        * @param aFileReader pointer to the file reader
+        * @param aCmManager Connection Method Manager
+        * @param aPluginArray Array that stores the processed plugins
+        * @param aLingerSettings stores processed GPRS linger values
+        * @return CProcessorPacketData instance.
+        */
+        static CProcessorPacketData* NewL( 
+                        CReaderBase* aFileReader,
+                        RCmManagerExt& aCmMnaager,
+                        RPointerArray< RCmConnectionMethodExt >& aPluginArray,
+                        RPointerArray< HBufC >& aPluginNames,
+                        RPointerArray< CLingerElement >& aLingerSettings);
+        /**
+        * Destructor.
+        */
+        virtual ~CProcessorPacketData();
+        
+        /**
+        * Maps previously stored linger values with connection ID's 
+        * and writes them to repository.
+        */
+        void SaveLingerSettingsL();
+
+    protected:
+        /**
+        * Second phase constructor. Leaves on failure.
+        */
+        void ConstructL();
+
+        /**
+        * Constructor.
+        * @param aFileReader pointer to the file reader
+        * @param aCmManager Connection Method Manager
+        * @param aPluginArray Array that stores the processed plugins
+        * @param aLingerSettings stores processed GPRS linger values
+        */
+        CProcessorPacketData( CReaderBase* aFileReader,
+                              RCmManagerExt& aCmManager,
+                              RPointerArray< RCmConnectionMethodExt >& aPluginArray,
+                              RPointerArray< HBufC >& aPluginNames,
+                              RPointerArray< CLingerElement >& aLingerSettings);
+        
+        /**
+        * 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.
+        */
+        virtual void ProcessSpecialFieldsL( TInt aField, HBufC* aTagPtr, TInt aDx );
+        
+        /**
+         * Writes connections linger value to repository.
+         * @param aIapId is the id of connection to which linger value is set.
+         * @param aLingerInterval linger value to set to connection.
+         */
+        void AddLingerL( const TInt aIapId, const TInt aLingerInterval);
+        
+    private:
+        
+        // @var Stores linger values
+        RPointerArray< CLingerElement >* iLingerSettings;
+    };
+
+
+#endif PROCESSOR_PACKET_DATA_H
+
+
+// End of File.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatcreator/Inc/cdcprocessorvpn.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,108 @@
+/*
+* 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:   Declaration of the class CProcessorVpn.
+*
+*/
+
+
+
+
+#ifndef PROCESSOR_VPN_H
+#define PROCESSOR_VPN_H
+
+
+// INCLUDE FILES
+
+#include <e32base.h>
+#include <cmmanagerext.h>
+#include <cmconnectionmethodext.h>
+
+#include "cdcprocessorbase.h"
+
+// FORWARD DECLARATION
+
+// CLASS DECLARATION
+
+/**
+* CProcessorVpn
+* Inhertits from the class CProcessorBase.
+* Creates internet Access Point Item from CTagContainer and 
+* adds AP item to database.
+*/
+class CProcessorVpn : public CProcessorBase
+    {
+    public:
+        /**
+        * Two-phase constructor.
+        * @param aFileReader pointer to the file reader
+        * @param aCmManager Connection Method Manager
+        * @param aPluginArray Array that stores the processed plugins
+        * @return CProcessorVpn instance.
+        */
+        static CProcessorVpn* NewL( CReaderBase* aFileReader,
+                         RCmManagerExt& aCmMnaager,
+                         RPointerArray< RCmConnectionMethodExt >& aPluginArray,
+                         RPointerArray< HBufC >& aPluginNames,
+                         RPointerArray< HBufC >& aUnderLying);
+                         
+        void ProcessUnderLyingL( RPointerArray< RCmDestinationExt >& aDestArray,
+                                 RPointerArray< HBufC >& aDestNames );
+                         
+                         
+        /**
+        * Destructor.
+        */
+        virtual ~CProcessorVpn();
+
+    protected:
+        /**
+        * Second phase constructor. Leaves on failure.
+        */
+        void ConstructL();
+
+        /**
+        * Constructor.
+        * @param aFileReader pointer to the file reader
+        * @param aCmManager Connection Method Manager
+        * @param aPluginArray Array that stores the processed plugins
+        */
+        CProcessorVpn( CReaderBase* aFileReader,
+                       RCmManagerExt& aCmManager,
+                       RPointerArray< RCmConnectionMethodExt >& aPluginArray,
+                       RPointerArray< HBufC >& aPluginNames,
+                       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.
+        */
+        ////virtual void ProcessTagL( TBool aFieldIDPresent );
+        virtual void ProcessSpecialFieldsL( TInt aField, HBufC* aTagPtr, TInt aDx );
+
+    private:
+    
+        // @var Stores whether this is the first round of VPN processing or not
+        TBool iIsFirstRound;
+
+        // @var Stores the IAP name underLying IAP/SNAP name pairs
+        RPointerArray< HBufC >* iUnderLying; 
+    };
+
+
+#endif PROCESSOR_VPN_H
+
+
+// End of File.
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatcreator/Inc/cdcprocessorwlan.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,346 @@
+/*
+* 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:   Declaration of the class CProcessorWlan.
+*
+*/
+
+
+
+
+#ifndef PROCESSOR_WLAN_H
+#define PROCESSOR_WLAN_H
+
+
+// INCLUDE FILES
+
+#include <e32base.h>
+#include <cmmanagerext.h>
+#include <cmconnectionmethodext.h>
+#include <metadatabase.h>
+#include <EapSettings.h>
+
+#include "cdcprocessorbase.h"
+
+using namespace CommsDat;
+
+// FORWARD DECLARATIONS
+
+
+// CLASS DECLARATION
+
+
+/**
+ * CEapTypeElement is array element for several EapTypes  
+ */ 
+class CEapTypeElement: public CBase
+        {
+        public:
+        ~CEapTypeElement();
+		HBufC* iName;
+        EAPSettings* iEapSettings; 
+        EAPSettings::TEapType iEncapsulatingEapId;
+        };
+
+
+/**
+* CProcessorWlan
+* Inhertits from the class CProcessorBase.
+* Creates WLAN Access Point Item from CTagContainer and 
+* adds AP item to database.
+*/
+class CProcessorWlan : public CProcessorBase
+    {
+    public:
+    
+        /**
+        * Two-phase constructor.
+        * @param aCmManager Connection Method Manager
+        * @param aPluginArray Array that stores the processed plugins
+        * @return CProcessorWlan instance.
+        */
+        static CProcessorWlan* NewL( CReaderBase* aFileReader,
+                                     RCmManagerExt& aCmManager,
+                                     RPointerArray< RCmConnectionMethodExt >& aPluginArray,
+                                     RPointerArray< HBufC >& aPluginNames,
+                                     RPointerArray< HBufC >& aSecurityInfo,
+                                     RPointerArray< CEapTypeElement >& eapSettings );
+        
+        void SaveSecurityInfoL();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CProcessorWlan();
+
+    protected:
+    
+        /**
+        * Second phase constructor. Leaves on failure.
+        */
+        void ConstructL();
+
+        /**
+        * Constructor.
+        * @param aCmManager Connection Method Manager
+        * @param aPluginArray Array that stores the processed plugins
+        */
+        CProcessorWlan( CReaderBase* aFileReader,
+                        RCmManagerExt& aCmManager,
+                        RPointerArray< RCmConnectionMethodExt >& aPluginArray,
+                        RPointerArray< HBufC >& aPluginNames,
+                        RPointerArray< HBufC >& aSecurityInfo,
+                        RPointerArray< CEapTypeElement >& aEapSettings );
+        
+        /**
+        * From CProcessorBase. Processes the actual tag.
+        * @param aFieldIDPresent shows if field id is read from input file
+        * @return TInt The result of the process, KErrNone if the actual tag is
+        * valid.
+        */
+        virtual void ProcessSpecialFieldsL( TInt aField, HBufC* aTagPtr, TInt aDx );
+
+
+        /**
+        * From CProcessorBase. Processes the actual access point.
+        * @return TInt The result of the process.
+        */
+        virtual void ProcessAPL();
+        
+        void FillSecurityInfoL();
+        
+        void FillSecurityInfoL( TBool aIsWep );
+        
+        void SaveSecurityInfoL( TInt& aCounter, TInt aId );
+
+        /**
+        * Saves WEP security settings
+        * @param aIapId Access point id WEP security settings belongs to.
+        */
+        void SaveWEPL( TUint32 aIapId );
+        
+        /**
+        * Writes key data to CommsDat.
+        * @param aKeyField The field to be written to
+        * @param aKey The key data to be written
+        * @param aKeyformat The format of the key (ascii/hex)
+        */
+        void WriteKeyL( CMDBField<TDesC8>* aKeyField,
+                        HBufC16* aKey,
+                        const TInt aKeyFormat );
+        
+        /**
+        * Gets WEP field value in text format from TagContainer
+        * @param aFieldId is the id of the field 
+        * @return pointer to the data of the field
+        */
+        HBufC16* WEPFieldData( TDbCreatorWEPFields aFieldId );        
+        
+        /**
+        * Gets Authentication type
+        * @return   TWEPAuthentication - authentication type
+        *           KErrNotFound - if authentication type is not present 
+        */
+        TInt WEPAuthentication();
+        
+        /**
+        * Gets the WEP key in use
+        * @return TWEPKeyInUse - the WEP key in use
+        *         KErrNotFound - if WEP key in use is not present 
+        */
+        TInt WEPKeyInUse();
+        
+        /**
+        * Gets WEP key format
+        * @param aFieldId is the id of the field 
+        * should be EWEPKeyXFormat
+        * @return   TWEPKeyFormat - key format
+        *           KErrNotFound - if WEP key format is not present 
+        */
+        TInt WEPKeyFormat( TDbCreatorWEPFields aFieldId );
+        
+        /**
+        * Gets WEP key length
+        * @param aFieldId is the id of the length field 
+        * should be EWEPKeyXLength
+        * @return TWEPKeyLength - WEP key length
+        */
+        TWEPKeyLength WEPKeyLength( TDbCreatorWEPFields aFieldId );
+        
+        /**
+        * Gets valid WEP key length in characters
+        * @param aFormat is the id of the field - should be EWEPKeyXFormat
+        * @param aLen is the WEP key length - should be TWEPKeyLength
+        * @return TInt - valid key length in characters
+        */
+        TInt WEPKeyValidLen( TInt aFormat, TWEPKeyLength aLen );
+        
+        /**
+        * Gets the TagContainer index that belongst to the given WEP field
+        * @param aFieldId is the id of the field 
+        * @return index in TagContainer
+        */
+        TInt WEPIndex( TDbCreatorWEPFields aFieldId );
+        
+        /**
+        * Check the existence and validity of WEP fields
+        * @return  - TRUE if all WEP fields are present and valid
+        *          - FALSE if any of the fields is missing or invalid.
+        */
+        TBool WEPFieldValidate();
+        
+        /**
+        * Converts keyData enetered in Ascii format to hex format
+        * @param aSource    Source string
+        * @param aDest      destination string
+        */
+        void ConvertAsciiToHex( const TDesC8& aSource, HBufC8*& aDest );
+        
+        /**
+        * Veryfies hexadecimal format
+        * @param aHex   hexadecimal key
+        * @return Etrue if hexadecimal key is valid, Efalse otherwise
+        */
+        TBool VerifyHex( const TDesC8& aHex );
+        
+        /**
+        * Saves WPA security settings
+        * @param aIapId Access point id WEP security settings belongs to.
+        */
+        void SaveWPAL( TUint32 aIapId );
+        
+        /**
+        * Gets the TagContainer index that belongst to the given WPA field
+        * @param aFieldId is the id of the field 
+        * @return index in TagContainer
+        */
+        TInt WPAIndex( TDbCreatorWPAFields aFieldId );
+        
+        /**
+        * Gets WPA field value in text format from TagContainer
+        * @param aFieldId is the id of the field 
+        * @return pointer to the data of the field
+        */
+        HBufC16* WPAFieldData( TDbCreatorWPAFields aFieldId );
+        
+        /**
+        * Gets the use of preshared key
+        * @return ETrue  - PSK is in use
+        *         EFalse - PSK is not in use
+        */
+        TBool WPAPresharedKeyInUse();
+        
+        /**
+        * Gets WPA key length
+        * @return length of the key
+        */
+        TInt WPAKeyLength();
+        
+        /**
+        * Writes the actual created access point to the log file.
+        */
+        void DoLogL();
+        
+    private:
+    
+        /**
+         * Sets the necessary initial values
+         */
+        virtual void Reset(); 
+        
+        /*
+         * Sets the values of the expanded Eap lists to the database 
+         * @param aGeneric for accessing the database records 
+         */
+        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 );
+
+		void AddEAPSettingL( const TInt aField, const HBufC16* const aValue );
+		
+		TBool EAPSetting( const TInt aField );
+	
+		void FillCipherSuitesL( const HBufC16* const aPtrTag, const TInt aEapIndex );
+		
+		EAPSettings::TEapType GetEapTypeIdFromSettingId( const TInt aField );
+		
+		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;
+        // @var Indicates the WLAN security mode name
+        HBufC* iSecurityModeString;
+        
+        // @var Stores WLAN security mode info
+        RPointerArray< HBufC >* iSecurityInfo;
+        
+        // @var Stores WLAN EAP settings
+        RPointerArray< CEapTypeElement >& iEapSettings;
+        
+		// @var access point is Easy WLAN if true
+        TBool iIsEasyWlan;
+       
+        // @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;
+
+        RArray< RPointerArray< HBufC > >* iTest;
+
+    };
+
+
+#endif PROCESSOR_WLAN_H
+
+
+// End of File.
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatcreator/Inc/cdcreaderbase.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,153 @@
+/*
+* Copyright (c) 2004 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 the class CReaderBase.
+*
+*/
+
+
+
+
+#ifndef READER_BASE_H
+#define READER_BASE_H
+
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <f32file.h>
+#include <flogger.h>
+
+#include "cdccommon.h"
+#include "cdcerrors.h"
+#include "cdctagcontainer.h"
+
+// CLASS DECLARATION
+
+/**
+* CReaderBase.
+* Base class for XML and CSV reader.
+*/
+class CReaderBase : public CBase
+    {
+    
+    public:
+        /**
+        * Destructor.
+        */
+        virtual ~CReaderBase();
+        
+    protected:
+
+        /**
+        * Default constructor.
+        * @param TDbCreatorInputFile input file type (csv or xml)
+        * @param TDbCreatorFeatures feature type - relevant in case 
+        * of csv input as feature is not detected by the reader.
+        */
+        CReaderBase( TDbCreatorInputFile aFileType, 
+                     TDbCreatorFeatures aFeature );
+        
+        /**
+        * Second phase constructor. Leaves on failure.
+        * @param aInFileName Name of the input file.
+        */
+        void ConstructL( const TDesC& aInFileName );
+        
+    public:
+    
+        /**
+        * Locates the next feature in input file.
+        */
+        virtual void LocateFeatureL() = 0;
+           
+        /**
+        * Gives back the next line from the given buffer.
+        * @return EFalse if the end of buffer is accessed, ETrue otherwise.
+        */
+        virtual TBool LocateAPL() = 0;
+        
+        /**
+        * Parses a line of the input file.
+        */
+        virtual void ParseAPL() = 0;
+        
+        /**
+        * Resets the actual file position to the beginning of the file.
+        * @return One of the system-wide error codes if reset failed.
+        */
+        virtual TInt Reset() = 0;
+           
+        /**
+        * Writes log to the log file.
+        */
+        virtual void ToDoLog() = 0;
+        
+        /**
+        * Returns reference to the TagContainer
+        * @return CTagContainer
+        */
+        CTagContainer& TagContainer();
+        
+        /**
+        * Returns reference to the input file
+        * @return RFile
+        */   
+        RFile& InputFile();
+        
+        /**
+        * Returns reference to the logger
+        * @return RFileLogger
+        */   
+        RFileLogger& FileLogger();
+        
+        /**
+        * Checks if filed ID is read from the input file (otherwise it is 
+        * calculated by reader according to the index of the tag)
+        * @return TRUE if reader reads the field id
+        */
+        TBool FieldIDPresent();
+        
+        /**
+        * Returns the feature currently being parsed
+        * @return TDbCreatorFeatures
+        *    - EFeatureNone    - No feature found
+        *    - EFeatureAP      - Internet access point
+        *    - EFeatureWLAN    - WLAN access point
+        *    - EFeatureVPN     - VPN access point
+        */
+        TDbCreatorFeatures CurrentFeature();
+
+    protected:
+        // @var marks the found feature that is being processed
+        TDbCreatorFeatures    iCurrentFeature;
+                                            
+    private:
+    
+        // @var contains the values read from input file
+        CTagContainer*        iTagContainer;      
+        // @var for file handling.                                
+        RFs                   iFs;
+        // @var Input file.
+        RFile                 iInputFile; 
+        // @var Log file.
+        RFileLogger           iLogFile; 
+        // @var Input file type
+        TDbCreatorInputFile   iFileType;  
+    
+    };
+
+
+
+#endif // READER_BASE_H
+
+// End of File.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatcreator/Inc/cdcreaderxml.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,231 @@
+/*
+* Copyright (c) 2004 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 the class CReaderXML.
+*
+*/
+
+
+
+
+#ifndef XML_READER_H
+#define XML_READER_H
+
+
+// INCLUDE FILES
+#include <e32base.h>
+
+#include "cdcreaderbase.h"
+
+// COSTANTS
+enum TParamSegment
+    {
+    EParamName,
+    EParamValue
+    };
+    
+class EInputParams
+{    
+    public:
+    
+    inline EInputParams( const TInt aId, const TDesC16& aParam ) : 
+    iId( aId ),
+    iParam( aParam )
+    {
+    //no implementation required
+    };
+    
+    const TInt         iId;
+    const TDesC16&     iParam;    
+};
+
+
+// CLASS DECLARATION
+
+/**
+* CReaderXML.
+* Reads and parses XML input. Capable of locating and reading Internet, WLAN
+* and VPN access points. 
+*/
+class CReaderXML : public CReaderBase
+    {
+
+    public:
+        /**
+        * Two-phase constructor.
+        * @param aInFileName the input file name
+        * @param aCharSet the input characterset
+        * @return CReaderXML instance
+        */
+        static CReaderXML* NewLC( const TDesC& aInFileName,
+                                  const TDbCreatorInputCharSet aCharSet );
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CReaderXML();
+
+    protected:
+        /**
+        * Second phase constructor. Leaves on failure.
+        */
+        void ConstructL();
+
+        /**
+        * Default constructor.
+        */
+        CReaderXML( const TDbCreatorInputCharSet aCharSet );
+
+    public:
+    
+        /**
+        * Locates the next feature in XML file.
+        */
+        virtual void LocateFeatureL();
+           
+        /**
+        * Gives back the next line from the given buffer.
+        * @return - EFalse if the end of buffer is accessed, 
+        *         - ETrue otherwise.
+        */
+        virtual TBool LocateAPL();
+           
+        /**
+        * Parses a line of the input file.
+        */
+        virtual void ParseAPL();
+        
+        /**
+        * Resets the actual file position to the beginning of the file.
+        * @return One of the system-wide error codes if reset failed.
+        */
+        virtual TInt Reset();
+        
+        /**
+        * Writes log to the log file.
+        */
+        virtual void ToDoLog();
+    
+    private:
+        /**
+        * Reads one line of the input file.
+        * @return - KErrNone if the whole line is read successfully.
+        *         - KErrEof if end of file is reached
+        *         - KErrNotFound if line delimiter is not found
+        *         - KErrGenereal in case of any other error
+        */
+        TInt ReadLineL();
+        
+        /**
+        * Extracts one line from the buffer read by ReadLineL
+        * @param const TPtrC16& aBuffer reference to the buffer descriptor
+        * @param TPtrC16& aLine reference to the line descriptor 
+        * @return - KErrNone if the whole line is read successfully.
+        *         - KErrEof if end of file is reached
+        *         - KErrNotFound if line delimiter is not found
+        *         - KErrGenereal in case of any other error
+        */
+        TInt ExtractLine(const TPtrC16& aBuffer, TPtrC16& aLine);
+        
+        /**
+        * Detects the head of feature segment
+        * @return the detected feature :
+        *          - EFeatureNone  : No feature found
+        *          - EFeatureAP    : Internet access point
+        *          - EFeatureWLAN  : WLAN access point
+        *          - EFeatureVPN   : VPN access point
+        */
+        TDbCreatorFeatures DetectFeatureHead();
+        
+        /**
+        * Detects the tail of feature segment
+        * @return TRUE if the current line contains the tail of feature
+        */
+        TBool DetectFeatureTail();
+        
+        /**
+        * Detects the tail of access point data segment
+        * @return TRUE if the current line contains the tail
+        */
+        TBool DetectTailAP();
+        
+        /**
+        * Detects the parameter of access point data segment
+        * @return TInt the ID the matching field id of the parameter
+        */
+        TInt DetectParam();
+        
+        /**
+        * Reads the parameter value
+        * @param aSegment - the required segment of the param
+        *           EParamName - name 
+        *           EParamValue - value
+        * <ParamName>ParamValue</ParamName>
+        * @return pointer to the tag read from the input file. Memory is
+        * allocated by the function. NULL can be returned.
+        */
+        HBufC16* ReadParam( TParamSegment aSegment );
+        
+        /**
+        * Detects the encoding of the xml input.  If detection fails leaves
+        * ECharSetAscii as default character set.
+        */
+        void DetectEncodingL();
+        
+        
+        /**
+        * Fills the parameter arrays with the id-name pairs 
+        */
+        void FillPacketDataParams();
+        void FillLanParams();
+        void FillWLanParams();
+        void FillVpnParams();
+        void FillGlobalParams();
+        void FillDNParams();
+        
+        /**
+            * Replace special XML chars in connecton method names 
+            */
+            void ConvertSpecialXMLChars( HBufC* aPtrTag );
+            void ReplaceInString( HBufC* aPtrTag, const TDesC& aSpXML, 
+                                            const TDesC& aSp );
+
+    private:
+
+        // @var Holds the actual file position
+        TInt                    iFilePos;
+        
+        // @var Input character set
+        TDbCreatorInputCharSet  iCharSet;
+        
+        // @var holds the line
+        HBufC16*                iLine;
+        
+        // @var true if global settings are found
+        TBool                   iFoundGlobal;
+        
+        RArray<EInputParams>    iPDParams;
+        RArray<EInputParams>    iLanParams;
+        RArray<EInputParams>    iWLanParams;
+        RArray<EInputParams>    iVpnParams;
+        RArray<EInputParams>    iGlobalParams;
+        RArray<EInputParams>    iDNParams;
+        
+    
+    };
+
+
+#endif // XML_READER_H
+
+
+// End of File.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatcreator/Inc/cdctagcontainer.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,120 @@
+/*
+* Copyright (c) 2004 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 the class CTagContainer.
+*
+*/
+
+
+
+#ifndef TAG_CONTAINER_H
+#define TAG_CONTAINER_H
+
+// INCLUDE FILES
+
+#include <e32base.h>
+
+// CLASS DECLARATION
+/**
+* CTagContainer
+* contains and manages the fields read form XML or CSV input file
+*/
+class CTagContainer : public CBase
+    {
+    //TYPE DECLARATION
+    private:
+        
+        /**
+        * ETag
+        * contains one tag and the belonging field id
+        */
+        class ETag
+            {
+            public:
+            //constructor & destructor
+            ETag( HBufC16* aTag, TInt aFieldId );
+            ~ETag();
+            
+            //attributes
+            TInt        iFieldId;  ///< field id tag belongs to
+            HBufC16*    iTag;      ///< tag is the data segment read from file
+                                   ///< created elsewhere but owned by ETag
+                                   ///< and deallocated by ETag's destructor
+            };
+        
+    public:
+        
+        /**
+        * Two-phase constructor.
+        */
+        static CTagContainer* NewL();
+         
+        /**
+        * Destructor.
+        */
+         ~CTagContainer();
+        
+    private:
+        
+        /**
+        * Second phase constructor. Leaves on failure.
+        */
+        void ConstructL();
+        
+        /**
+        * Constructor
+        */
+         CTagContainer();
+         
+    public:
+        
+        /**
+        * Clears the array and deallocates all reserved memory
+        */
+         void Clear();
+        
+        /**
+        * Adds a new tag to the array
+        * @param aTag is a pointer to the tag
+        */
+         void AddL(HBufC16* aTag, TInt aFieldId);
+        
+        /**
+        * Retrieves a tag identified by its index
+        * @param aIdx is the index of the tag
+        * @return HBufC16* pointer to the tag
+        */
+         HBufC16* Tag(TUint aIdx);
+        
+        /**
+        * Retrieves the field ID
+        * @param aIdx is the index of the tag
+        * @return HBufC16* pointer to the tag
+        */
+         TInt FieldId(TUint aIdx);
+        
+        /**
+        * Counts the number of tags
+        * @return TInt is the number of tags
+        */
+         TInt Count();
+        
+    private:
+
+        // @var Dynamic array for holding tags
+        CArrayPtrSeg<ETag>* iTags; 
+    
+    };
+
+
+#endif //TAG_CONTAINER_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatcreator/Inc/cdcwlandevicesettings.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,121 @@
+/*
+* Copyright (c) 2004 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 the class CWlanDeviceSettings.
+*
+*/
+
+
+
+#ifndef WLANDEVICESETTINGS_H
+#define WLANDEVICESETTINGS_H
+
+// INCLUDES
+#include <e32base.h>
+#include <metadatabase.h>
+
+#define DEBUG( a )
+#define DEBUG1( a, b )
+
+using namespace CommsDat;
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+*  Interface to read and write WLAN device specific settings.
+*  The data is stored in CommsDB.
+*/
+NONSHARABLE_CLASS( CWlanDeviceSettings ): public CBase
+    {
+public:
+
+    NONSHARABLE_STRUCT( SWlanDeviceSettings )
+        {
+        //Is WLAN indication icon been showed in UI.
+        TUint32 backgroundScanInterval;
+        //Stores the previously set background scan interval.
+        TUint32 savedBgScanInterval;
+        //If - ETrue default values are being used, 
+        //   - EFalse use the user defined values.
+        TBool useDefaultSettings;
+        //How many times packets bigger than 'rts' are been resent.
+        TUint32 longRetry; 
+        //How many times packets smaller than 'rts' are been resent.
+        TUint32 shortRetry;
+        //Min. size of a packet that CTS/RTS handshake is been used.
+        TUint32 rts;
+        //Transmission power level in use. In mWs.
+        TUint32 txPowerLevel;
+        //Are the radio measurements allowed.
+        TBool radioMeasurements;
+         //Is WLAN in power mode enabled
+        TBool powerMode;
+        };
+ 
+    public:     // Methods
+
+    // Constructors and destructor
+
+        /**
+        * Static constructor.
+        */
+        static CWlanDeviceSettings* NewL();
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CWlanDeviceSettings();
+
+    // New methods
+
+        /**
+        * Returns the default WLAN device settings.
+        * @param aSettings Default WLAN device settings
+        */
+        static void GetDefaultSettings( SWlanDeviceSettings& aSettings );
+
+    private:    //Methods
+
+        /**
+        * C++ default constructor.
+        */
+        CWlanDeviceSettings();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+        /**
+        * Fills a WLAN device settings record with default data.
+        * @param aTableType 0 for default settings, 1 for user settings.
+        * @param aRecord pointer to commsdat table view
+        */
+        void FillRecordL( TUint32 aTableType, CMDBGenericRecord* aRecord );
+
+        /**
+        * Open database table.
+        */
+        void OpenTableL();
+        
+    private:    // Data
+    
+        //@var session - Owned
+        CMDBSession* iSession;
+    };
+
+#endif      // WLANDEVICESETTINGS_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatcreator/Inc/cdcwlantables.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,106 @@
+/*
+* Copyright (c) 2004 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 the class CWlanTables.
+*
+*/
+
+
+
+
+#ifndef WLANTABLESHANDLER_H
+#define WLANTABLESHANDLER_H
+
+
+// INCLUDES
+#include <e32base.h>
+#include <metadatabase.h>
+#include <WlanCdbCols.h>
+#include <commsdattypesv1_1.h>
+
+using namespace CommsDat;
+
+// FORWARD DECLARATIONS
+
+// CONSTANTS
+
+// CLASS DECLARATION
+
+/**
+* CWlanTables
+* Capable of checking the existence of certain WLAN specific 
+* tables and - if necessry create them.
+*/
+class CWlanTables : public CBase
+    {   
+    public:
+
+        /**
+        * Static constructor
+        */
+        static CWlanTables* NewL();
+
+        /**
+        * Destructor
+        */
+        virtual ~CWlanTables();
+
+        /**
+        * Checks if WLAN tables exist. Creates them if not.
+        */
+        void CheckAndCreateTablesL();
+
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CWlanTables();
+
+        /**
+        * By default Symbian second phase constructor is private.
+        */
+        void ConstructL();  
+
+        /**
+        * Check if WLAN Service Table exists in CommsDat; create if not.
+        */
+        void CreateWlanServiceTableL();
+
+        /**
+        * Check if WLAN Device Table exists in CommsDat; create if not.
+        */
+        void CreateWlanDeviceSettingsTableL();
+
+        /**
+        * Check if WLAN Secondary SSID Table exists in CommsDat; create if not.
+        */
+        void CreateWlanSecSSIDTableL();
+
+        /**
+        * Check if WLAN bearer record exists in LANBearer table in CommsDat; create if not.
+        */	
+		void CreateWlanBearerRecordL();
+
+
+
+    private:    // Data
+    
+        //@var session - Owned
+        CMDBSession* iSession;
+    };
+
+#endif      // WLANTABLESHANDLER_H
+
+// End of File.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatcreator/Src/cdccommsdatcreator.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,672 @@
+/*
+* Copyright (c) 2002 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:   Module for creating CommsDat from an input file
+*
+*/
+
+
+
+
+// INCLUDE FILES
+
+#include "cdccommsdatcreator.h"
+#include "cdclogger.h"
+#include "cdcreaderxml.h"
+#include "cdcprocessorpacketdata.h"
+#include "cdcprocessorwlan.h"
+#include "cdcprocessorlan.h"
+#include "cdcprocessorvpn.h"
+#include "cdcprocessordn.h"
+#include "cdcprocessorglobal.h"
+#include "cdcwlantables.h"
+#include "cdcwlandevicesettings.h"
+#include "cdcdatamobilitytables.h"
+#include "cdcdumptables.h"
+#include "centralrepository.h"
+
+#include <cmconnectionmethoddef.h>
+#include <cmmanagerext.h>
+
+#include <e32def.h>
+#include <e32base.h>
+#include <s32strm.h>
+#include <s32file.h>
+#include <etelpckt.h>
+#include <featmgr.h>
+#include <commsdattypesv1_1.h>
+#include <commsdattypeinfov1_1.h>
+
+
+// CONSTANTS
+//maximum length of access point name
+const TInt KLengthOfExtention = 4;
+
+//extension
+_LIT16( KExtensionXML,     ".xml" );    //XML file
+
+
+//-----------------------------------------------------------------------------
+//  CCdcCommsDatCreator::NewL()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C CCdcCommsDatCreator* CCdcCommsDatCreator::NewL()
+    {
+    CCdcCommsDatCreator* self = NewLC();
+    CleanupStack::Pop( self );   // self
+    
+    return self;
+    }
+
+
+//-----------------------------------------------------------------------------
+//  CCdcCommsDatCreator::NewLC()
+//-----------------------------------------------------------------------------
+//
+EXPORT_C CCdcCommsDatCreator* CCdcCommsDatCreator::NewLC()
+    {
+    CCdcCommsDatCreator* self = new (ELeave) CCdcCommsDatCreator();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    
+    return self;
+    }
+
+
+//------------------------------------------------
+// CDbCreator::CreateTablesL
+//------------------------------------------------
+//
+EXPORT_C void CCdcCommsDatCreator::CreateTablesL()
+    {
+    CLOG_WRITE( "=====================\n" )
+    CLOG_WRITE( "Creating tables ...\n" )
+    CLOG_WRITE( "=====================\n" )   
+
+    
+    //extends architecture of CommsDat
+    //creates WLAN tables
+    //-------------------------------
+    if ( iIsWlanS )
+        {
+        CLOG_WRITE( "Creates WLAN service tables\n" )
+        CLOG_WRITE( "---------------------------\n" )
+        
+        CWlanTables* wlanTables = CWlanTables::NewL();
+        CleanupStack::PushL( wlanTables );
+        wlanTables->CheckAndCreateTablesL();
+        
+        CleanupStack::PopAndDestroy( wlanTables ); 
+        
+        // WLAN Device Settings Table.
+        CLOG_WRITE( "Writes Default settings to WLAN Device Settings Table.\n" )
+        
+        // Creating a settings object does it all.
+        CWlanDeviceSettings* wlanDeviceSettings = CWlanDeviceSettings::NewL();
+        delete wlanDeviceSettings;
+        }
+
+    CLOG_WRITE( "CDataMobilityTables\n" )   
+        
+    //extends architecture of CommsDat
+    //creates Data Mobility tables
+    //----------------------------
+    CDataMobilityTables* dmTables = CDataMobilityTables::NewL();
+    CleanupStack::PushL( dmTables );
+    
+    CLOG_WRITE( "Creates Data Mobility ALR tables\n" )
+    CLOG_WRITE( "--------------------------------\n" )
+    dmTables->CheckAndCreateAlrTablesL();
+    
+    CLOG_WRITE( "Creates Data Mobility MIP tables\n" )
+    CLOG_WRITE( "--------------------------------\n" )
+    dmTables->CheckAndCreateMipTablesL();
+    
+    CleanupStack::PopAndDestroy( dmTables );
+        
+    //if there is only an "e" parameter then DbCreator extends CommsDat, but
+    //does not create access points. This functionality earlier was done
+    //by WlanToCDb modul.
+    }
+
+
+//------------------------------------------------
+// CDbCreator::CreateCommsDatL
+//------------------------------------------------
+//
+EXPORT_C void CCdcCommsDatCreator::CreateCommsDatL( const TFileName& aInFileName )
+    {
+    CLOG_WRITE( "=====================\n" )
+    CLOG_WRITE( "Processing started...\n" )
+    CLOG_WRITE( "=====================\n" )               
+
+	iCmManager.OpenL();
+
+    TDbCreatorInputCharSet charSet( ECharSetUnknown );//input character set
+
+    //Creates access points
+    //----------------------
+            
+    if ( InputFileType( aInFileName ) == EFileXML )
+        {
+        CLOG_WRITE( "Tries to open file");
+        // Logs file name            
+        HBufC *fileName = aInFileName.AllocLC();
+        CLOG_WRITE_FORMAT( "Input file : %S\n", fileName )
+        CleanupStack::PopAndDestroy( fileName );                          
+        
+        delete iReader;
+        iReader = NULL;
+        iReader = CReaderXML::NewLC( aInFileName, charSet );
+    	CleanupStack::Pop(iReader);
+    
+        //locates feature in xml file
+        iReader->LocateFeatureL();
+        }
+    else    
+        {
+        User::Leave( KErrInvalidExtension );
+        }  
+    	
+
+    TBool found( EFalse );
+    
+    // First, add all destinations to the database. Connection methods and
+    // embedded destinations are not added at this time.
+    while ( iReader->CurrentFeature() != EFeatureNone && !found )
+        {
+        if( iReader->CurrentFeature() == EFeatureDN )
+            {
+            ProcessDNL( iCmInDest, ETrue );
+            }
+        iReader->LocateFeatureL();
+        }
+    
+    // Reset input file
+    iReader->Reset();
+    iReader->LocateFeatureL();
+    
+    // Then add connection methods, and assign them to destinations if
+    // needed
+    while ( iReader->CurrentFeature() != EFeatureNone )
+        {
+        switch ( iReader->CurrentFeature() )
+            {
+            case EFeaturePacketData:
+                {
+                //creates GPRS access point
+                CLOG_WRITE( "Feature found : Packet Data Access point(s)\n" )
+                
+                iFileProcessor = CProcessorPacketData::NewL( iReader,
+                                                       iCmManager,
+                                                       iPluginArray,
+                                                       iPluginNames,
+                                                       iLingerSettings );
+                iFileProcessor->ParseFileL();
+                
+                delete iFileProcessor;
+                iFileProcessor = NULL;
+
+                break;
+                }
+                
+            case EFeatureWLAN:
+                {
+                if( iIsWlanS )
+                    {
+                    //creates WLAN access point   
+                    CLOG_WRITE( "Feature found : WLAN Access point(s)\n" )
+                    
+                    // Reset the EAP settings just to be safe although it should be empty always here.
+                    iEapSettings.ResetAndDestroy();
+                    
+                    iFileProcessor = CProcessorWlan::NewL( iReader,
+                                                           iCmManager,
+                                                           iPluginArray,
+                                                           iPluginNames,
+                                                           iWlanSecurity,
+                                                           iEapSettings );
+                    iFileProcessor->ParseFileL();
+                    
+                    delete iFileProcessor;
+                    iFileProcessor = NULL;
+
+                    }
+                break;
+                }
+                
+            case EFeatureLAN:
+                {
+                //creates LAN access point   
+                CLOG_WRITE( "Feature found : LAN Access point(s)\n" )
+
+                iFileProcessor = CProcessorLan::NewL( iReader,
+                                                      iCmManager,
+                                                      iPluginArray,
+                                                      iPluginNames );
+                iFileProcessor->ParseFileL();
+               
+                delete iFileProcessor;
+                iFileProcessor = NULL;
+                break;
+                }
+                
+            case EFeatureVPN:
+                {
+                //creates VPN access point   
+                CLOG_WRITE( "Feature found : VPN Access point(s)\n" )
+                CLOG_WRITE( "-----------------------------------\n" )
+                
+                iFileProcessor = CProcessorVpn::NewL( iReader,
+                                                       iCmManager,
+                                                       iPluginArray,
+                                                       iPluginNames,
+                                                       iUnderLying );
+                iFileProcessor->ParseFileL();
+                
+                delete iFileProcessor;
+                iFileProcessor = NULL;
+                
+                break;
+                }
+            
+            case EFeatureDN:
+                {
+               
+                ProcessDNL( iCmInDest, EFalse );
+                
+                break;
+                }
+                
+            case EFeatureGlobal:
+                {
+                // Valid tag but does nothing now. 
+                // Global can be processed at the last end.
+
+                
+                //sets global settings 
+                CLOG_WRITE( "Feature found : Global settings\n" )
+                CLOG_WRITE( "-------------------------------\n" )
+                    
+                iFileProcessor = CProcessorGlobal::NewL( iReader,
+                                                          iCmManager,
+                                                          iPluginArray,
+                                                          iPluginNames,
+                                                          iDestArray,
+                                                          iDestNames,
+                                                          iDefCon ); 
+                iFileProcessor->ParseFileL();
+
+                delete iFileProcessor;
+                iFileProcessor = NULL;
+
+                break;
+                }
+                
+            default:
+                User::Panic( KPanicInvalidCase, KErrInvalidCase );
+             
+            }//switch
+            
+            //gets next feature
+            iReader->LocateFeatureL();
+            
+        }//while
+                  
+
+    // Updates the IAPs that are not in destinations.
+    UpdateUncatCmsL( iCmInDest /*, iPluginNames, iPluginArray*/ );
+
+    // Sets the underlying IAP/SNAPS for vpn IAPs    
+    SetUnderlyingIapL( iUnderLying );
+
+    for( TInt i(0); i < iWlanSecurity.Count(); i++ )
+        {
+        CLOG_WRITE_FORMAT( "Sec Pos: %d", i );
+        if( iWlanSecurity[i] != NULL )
+            {
+            CLOG_WRITE_FORMAT( "Sec data: %S", iWlanSecurity[i] );
+            }
+        else    
+            {
+            CLOG_WRITE( "Sec data NULL" );
+            }
+        }
+
+	// Sets the WLAN security paramters including EAP settings
+    SetWlanSecurityL( iWlanSecurity );
+    
+    // Sets linger settings
+    SetLingerSettingsL( iLingerSettings );
+
+    // Sets the default connection    
+    SetDefaultConnectionL( iDefCon );
+
+    // Logs IAPs in UDEB mode
+    #ifdef _DEBUG
+    LogIapIdsL();
+    #endif
+}
+
+//------------------------------------------------
+// CCdcCommsDatCreator::DumpCommsDatL
+//------------------------------------------------
+//
+EXPORT_C void CCdcCommsDatCreator::DumpCommsDatL( const TFileName& aOutFileName )
+    {
+    CLOG_WRITE( "==========================\n" )
+    CLOG_WRITE( "Dump processing started...\n" )
+    CLOG_WRITE( "==========================\n" )   
+    
+
+    CDumpTables* dump = CDumpTables::NewLC();
+    dump->DoDumpTablesL( aOutFileName );
+    CleanupStack::PopAndDestroy( dump ); //dump   
+
+    CLOG_WRITE( "======== end dump =========\n" )   
+
+    }
+
+//------------------------------------------------
+// CCdcCommsDatCreator::CCdcCommsDatCreator
+//------------------------------------------------
+//
+CCdcCommsDatCreator::CCdcCommsDatCreator()
+    {
+    }
+
+//------------------------------------------------
+// CCdcCommsDatCreator::~CCdcCommsDatCreator
+//------------------------------------------------
+//
+CCdcCommsDatCreator::~CCdcCommsDatCreator()
+    {
+    delete iReader;
+    
+    iEapSettings.ResetAndDestroy();
+
+	for ( TInt i = 0; i < iPluginArray.Count(); i++ )
+	{
+		iPluginArray[i]->Close();
+	}
+    iPluginArray.ResetAndDestroy();
+    iPluginNames.ResetAndDestroy();
+
+	for ( TInt i = 0; i < iDestArray.Count(); i++ )
+	{
+		iDestArray[i]->Close();
+	}
+    iDestArray.ResetAndDestroy();
+    
+    iDestNames.ResetAndDestroy();    
+    
+    iUnderLying.ResetAndDestroy();    
+    
+    iWlanSecurity.ResetAndDestroy();
+    
+    iLingerSettings.ResetAndDestroy();
+
+    iDefCon.ResetAndDestroy();
+    
+    iCmInDest.Close(); 
+    
+    iCmManager.Close();
+    }
+
+
+//------------------------------------------------
+// CCdcCommsDatCreator::ConstructL
+//------------------------------------------------
+//
+void CCdcCommsDatCreator::ConstructL()
+    {
+    CLOG_WRITE( "Initialising FeatureManager\n" )   
+    //checks if Wlan feature is supported
+    FeatureManager::InitializeLibL();
+    iIsWlanS = FeatureManager::FeatureSupported( KFeatureIdProtocolWlan );
+    FeatureManager::UnInitializeLib();
+    CLOG_WRITE( "FeatureManager closed\n" )               
+    }
+    
+//------------------------------------------------
+// CCdcCommsDatCreator::InputFileType
+//------------------------------------------------
+//
+TUint CCdcCommsDatCreator::InputFileType( const TFileName& aFileName )
+    {
+    TBuf<KLengthOfExtention> extension;
+    
+    //get extension
+    extension.Copy( aFileName.Right( KLengthOfExtention ) );
+    
+    TDbCreatorInputFile type ( EFileUnknown );
+    
+    if ( extension.CompareF( KExtensionXML ) == 0 )
+        {
+        type = EFileXML;            
+        }
+    else
+        {
+        //type keeps default value
+        }
+            
+    return type;
+    
+    }
+    
+  
+//------------------------------------------------
+// CCdcCommsDatCreator::UpdateUncatCmsL
+//------------------------------------------------
+//
+void CCdcCommsDatCreator::UpdateUncatCmsL( RArray< TBool >& aCmInDest )
+    {
+    CLOG_WRITE( "-------------------------------\n" )
+    CLOG_WRITE( "Uncategorised Cms:\n" )
+
+    // No destination defined
+    if( aCmInDest.Count() == 0 )
+        {
+        for( TInt i(0); i < iPluginArray.Count(); i++ )
+            {
+            iPluginArray[i]->UpdateL();
+            CLOG_WRITE_FORMAT( "Uncat CM Name: %S", iPluginNames[i] );
+            }
+        }
+    else
+        {
+        
+        for( TInt i(0); i < iPluginArray.Count(); i++ )
+            {
+            if( aCmInDest[ i ] == EFalse )
+                {
+                iPluginArray[i]->UpdateL();
+                CLOG_WRITE_FORMAT( "Uncat CM Name: %S", iPluginNames[i] );
+                }
+            }
+        }
+        
+    CLOG_WRITE( "-------------------------------\n" )
+    }    
+
+
+//------------------------------------------------
+// CCdcCommsDatCreator::LogIapIdsL
+//------------------------------------------------
+//
+void CCdcCommsDatCreator::LogIapIdsL()
+    {
+    for( TInt i(0); i < iPluginArray.Count(); i++ )
+        {
+        TUint32 uid1 = iPluginArray[i]->GetIntAttributeL( CMManager::ECmId );
+        CLOG_WRITE_FORMAT( "IAP Name: %S", iPluginNames[i] );
+        CLOG_WRITE_FORMAT( "ID: %d\n", uid1 );
+        }
+
+    for( TInt i(0); i < iDestArray.Count(); i++ )
+        {
+        TUint32 uid1 = iDestArray[i]->Id();
+        CLOG_WRITE_FORMAT( "SNAP Name: %S", iDestNames[i] );
+        CLOG_WRITE_FORMAT( "ID: %d\n", uid1);
+        }
+    }
+
+// ---------------------------------------------------------
+// CCdcCommsDatCreator::ProcessDNL
+// ---------------------------------------------------------
+//
+void CCdcCommsDatCreator::ProcessDNL( RArray< TBool >& aCmInDest,
+                                     TBool aFirstRound )
+    {
+    CLOG_WRITE( "Feature found : Destination Network(s)\n" )
+    CLOG_WRITE( "--------------------------------------\n" )
+    
+    
+    if( !aFirstRound )
+        {
+        for( TInt i(0); i < iPluginArray.Count(); i++ )
+            {
+            aCmInDest.Append( EFalse );
+            }
+        }
+    
+    iFileProcessor = CProcessorDN::NewL( iReader,
+                                         iCmManager,
+                                         iPluginArray,
+                                         iPluginNames,
+                                         iDestArray,
+                                         iDestNames,
+                                         aCmInDest,
+                                         aFirstRound ); 
+    iFileProcessor->ParseFileL();
+    
+    delete iFileProcessor;
+    iFileProcessor = NULL;
+    CLOG_WRITE( "--------------------------------------\n" )
+    }    
+
+// ---------------------------------------------------------
+// CCdcCommsDatCreator::SetUnderlyingIapL
+// ---------------------------------------------------------
+//
+void CCdcCommsDatCreator::SetUnderlyingIapL( RPointerArray< HBufC >& aUnderLying )
+    {
+    // Sets the underlying IAP/SNAPS for vpn IAPs    
+    if( aUnderLying.Count() > 0 )
+        {
+        CLOG_WRITE_FORMAT( "SetUnderlyingIapL: %d\n", aUnderLying.Count() )
+        CLOG_WRITE( "--------------------------------------\n" )
+
+        CProcessorVpn* vpn = CProcessorVpn::NewL( iReader,
+                                               iCmManager,
+                                               iPluginArray,
+                                               iPluginNames,
+                                               aUnderLying );
+        
+        CleanupStack::PushL( vpn );
+        vpn->ProcessUnderLyingL(  iDestArray, iDestNames );
+        
+                
+        CleanupStack::PopAndDestroy( vpn );
+
+        CLOG_WRITE( "--------------------------------------\n" )
+        }
+    }
+
+// ---------------------------------------------------------
+// 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
+// ---------------------------------------------------------
+//
+void CCdcCommsDatCreator::SetWlanSecurityL( RPointerArray< HBufC >& aWlanSecurity )
+    {
+    if( aWlanSecurity.Count() > 0 
+		|| iEapSettings.Count() > 0 )
+        {
+        CLOG_WRITE_FORMAT( "SetWlanSecurityL: %d\n", aWlanSecurity.Count() );
+        CLOG_WRITE_FORMAT( "SetWlanSecurityL: EAPs: %d\n", iEapSettings.Count() );
+        CLOG_WRITE( "--------------------------------------\n" )
+
+        CProcessorWlan* wlan = CProcessorWlan::NewL( iReader,
+                                                     iCmManager,
+                                                     iPluginArray,
+                                                     iPluginNames,
+                                                     aWlanSecurity,
+													 iEapSettings);
+        
+        CleanupStack::PushL( wlan );
+        wlan->SaveSecurityInfoL();
+                
+        CleanupStack::PopAndDestroy( wlan );
+        
+        // EAP settings were saved. Delete them.
+        iEapSettings.ResetAndDestroy();
+
+        CLOG_WRITE( "--------------------------------------\n" )
+        }
+    }
+
+// ---------------------------------------------------------
+// CCdcCommsDatCreator:::SetLingerSettingsL
+// ---------------------------------------------------------
+//
+void CCdcCommsDatCreator::SetLingerSettingsL( 
+        RPointerArray< CLingerElement >& aLingerSettings )
+    {
+    CLOG_WRITE_FORMAT( "SetLingerSettingsL: %d\n", aLingerSettings.Count() );
+    if ( aLingerSettings.Count() > 0 )
+        {
+        CProcessorPacketData* pdp = CProcessorPacketData::NewL( iReader, 
+                                                                iCmManager,
+                                                                iPluginArray,
+                                                                iPluginNames,
+                                                                iLingerSettings );
+        
+        CleanupStack::PushL( pdp );
+        pdp->SaveLingerSettingsL();
+                
+        CleanupStack::PopAndDestroy( pdp );
+        }  
+    CLOG_WRITE( "--------------------------------------\n" )
+    }
+
+
+// End of File.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatcreator/Src/cdcdatamobilitytables.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,613 @@
+/*
+* 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 the class CDataMobilityTables
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include "cdcdatamobilitytables.h"
+#include "cdclogger.h"
+
+#include <commsdattypesv1_1.h>
+#include <datamobilitycommsdattypes.h>
+#include <cmmanagerext.h>
+#include <wlancontainer.h>
+#include <cmmanagerdef.h>
+
+// CONSTANTS
+
+// Maximum bearer type name length
+const TUint KMaxNameLength = 50;
+
+// Default bearer priorities
+const TUint KDefaultPriorityLan = 0;
+const TUint KDefaultPriorityWlan = 1;
+const TUint KDefaultPriorityPan = 2;
+const TUint KDefaultPriorityGprsOut = 3;
+const TUint KDefaultPriorityGprsIn = 4;
+const TUint KDefaultPriorityDialOut = 6;
+const TUint KDefaultPriorityDialIn = 7;
+const TUint KDefaultUIPriorityVpn = 253;
+const TUint KDefaultUIPriorityMip = 254;
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CDataMobilityTables::NewL
+// ---------------------------------------------------------
+//
+CDataMobilityTables* CDataMobilityTables::NewL()
+    {
+
+    CDataMobilityTables* self = new ( ELeave ) CDataMobilityTables;
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+
+// ---------------------------------------------------------
+// CDataMobilityTables::CDataMobilityTables
+// ---------------------------------------------------------
+//
+CDataMobilityTables::CDataMobilityTables()
+    {
+    //no implementation needed
+    }
+
+
+// ---------------------------------------------------------
+// CDataMobilityTables::ConstructL
+// ---------------------------------------------------------
+//
+void CDataMobilityTables::ConstructL()
+    {
+    //no implementation needed
+    iSession = CMDBSession::NewL( CMDBSession::LatestVersion() );
+    }
+
+
+// ---------------------------------------------------------
+// CDataMobilityTables::~CDataMobilityTables
+// ---------------------------------------------------------
+//
+CDataMobilityTables::~CDataMobilityTables()
+    {
+    if ( iSession )
+        {
+        iSession->Close();
+        delete iSession; 
+        }
+    }
+    
+    
+// ---------------------------------------------------------
+// CDataMobilityTables::CheckAndCreateAlrTablesL
+// ---------------------------------------------------------
+//
+void CDataMobilityTables::CheckAndCreateAlrTablesL()
+    {
+    CreateVirtualIAPNextLayerTableL();
+    CreateGlobalBearerTypeTableL();
+    PopulateGlobalBearerTypeTableL();
+    CreateDataMobilitySelectionPolicyTableL();
+    CreateSNAPMetadataTableL();
+    CreateIAPMetadataTableL();
+    CreateDestNetworkTableL();
+    }
+    
+    
+// ---------------------------------------------------------
+// CDataMobilityTables::CheckAndCreateMipTablesL
+// ---------------------------------------------------------
+//
+void CDataMobilityTables::CheckAndCreateMipTablesL()
+    {
+    CreateMIPServiceTableL();
+    CreateMIP4TableL();
+    CreateMIP6TableL();
+    }
+    
+    
+// ---------------------------------------------------------
+// CDataMobilityTables::CreateGlobalBearerTypeTableL
+// ---------------------------------------------------------
+//
+void CDataMobilityTables::CreateGlobalBearerTypeTableL()
+    {
+    //Check whether Global Bearer Type Priorization table exists
+    TInt error( KErrNone );
+    
+    TRAP( error, CCDGlobalBearerTypePriorizationRecord::TableIdL( *iSession ) );
+
+    //Table not found -> create it
+    if( error == KErrNotFound )
+        {
+        //Add table to CommsDat
+        CCDGlobalBearerTypePriorizationRecord::CreateTableL( *iSession );
+
+        //check result
+        TInt id( KErrNone );
+        TRAP( id, CCDGlobalBearerTypePriorizationRecord::TableIdL( *iSession ) );
+        if( id >= KErrNone )
+            {
+            CLOG_WRITE( "Added Global Bearer Type Priorization table\n" )
+            }
+        else
+            {
+            CLOG_WRITE_FORMAT( "Failed to add Global Bearer Type Priorization\
+                             table: %d\n", id )
+            }
+        }
+    //Table already exists
+    else if ( error == KErrNone)
+        {
+        CLOG_WRITE ( "Global Bearer Type Priorization table already exists" )
+        }
+    else
+        {
+        //do nothing             
+        }
+    }
+    
+    
+// ------------------------------------------------------------
+// CDataMobilityTables::CreateDataMobilitySelectionPolicyTableL
+// ------------------------------------------------------------
+//
+void CDataMobilityTables::CreateDataMobilitySelectionPolicyTableL()
+    {
+    //Check whether Data Mobility Selection Policy table exists
+    TInt error( KErrNone );
+    TRAP( error, CCDDataMobilitySelectionPolicyRecord::TableIdL( *iSession ) );
+
+    //Table not found -> create it
+    if( error == KErrNotFound )
+        {
+        //Add table to CommsDat
+        CCDDataMobilitySelectionPolicyRecord::CreateTableL( *iSession );
+        
+        //check result
+        TInt id( KErrNone );
+        TRAP( id, CCDDataMobilitySelectionPolicyRecord::TableIdL( *iSession ) );
+        if( id >= KErrNone )
+            {
+            CLOG_WRITE( "Added Data Mobility Selection Policy table\n" )
+            }
+        else
+            {
+            CLOG_WRITE_FORMAT( 
+            "Failed to add Data Mobility Selection Policy table. %d\n", id )
+            }
+        }
+    //Table already exists
+    else if ( error == KErrNone)
+        {
+        CLOG_WRITE( "Data Mobility Selection Policy table already exists" )
+        }
+    else
+        {
+        //do nothing             
+        }
+    }
+    
+    
+// ---------------------------------------------------------
+// CDataMobilityTables::CreateMIPServiceTableL
+// ---------------------------------------------------------
+//
+void CDataMobilityTables::CreateMIPServiceTableL()
+    {
+    //Check whether MIP Service table exists
+    TInt error( KErrNone );
+    TRAP( error, CCDMIPServiceExtRecord::TableIdL( *iSession ) );
+
+    //Table not found -> create it
+    if( error == KErrNotFound )
+        {
+        //Add table to CommsDat
+        CCDMIPServiceExtRecord::CreateTableL( *iSession );
+        
+        //check result
+        TInt id( KErrNone );
+        TRAP( id, CCDMIPServiceExtRecord::TableIdL( *iSession ) );
+        if( KErrNone <= id )
+            {
+            CLOG_WRITE( "Added MIP Service table\n" )
+            }
+        else
+            {
+            CLOG_WRITE_FORMAT( "Failed to add MIP Service table: %d\n", id )
+            }
+        }
+    //Table already exists
+    else if ( error == KErrNone)
+        {
+        CLOG_WRITE( "MIP Service table already exists" )
+        }
+    else
+        {
+        //do nothing             
+        }
+    }
+    
+    
+// ---------------------------------------------------------
+// CDataMobilityTables::CreateMIP4TableL
+// ---------------------------------------------------------
+//
+void CDataMobilityTables::CreateMIP4TableL()
+    {
+    //Check whether MIP4 table exists
+    TInt error( KErrNone );
+    TRAP( error, CCDMIP4Record::TableIdL( *iSession ) );
+
+    //Table not found -> create it
+    if( error == KErrNotFound )
+        {
+        //Add table to CommsDat
+        CCDMIP4Record::CreateTableL( *iSession );
+        
+        //check result
+        TInt id( KErrNone );
+        TRAP( id, CCDMIP4Record::TableIdL( *iSession ) );
+        if( KErrNone <= id )
+            {
+            CLOG_WRITE( "Added MIP4 table\n" )
+            }
+        else
+            {
+            CLOG_WRITE_FORMAT( "Failed to add MIP4 table: %d\n", id )
+            }
+        }
+    //Table already exists
+    else if ( error == KErrNone)
+        {
+        CLOG_WRITE( "MIP4 table already exists" )
+        }
+    else
+        {
+        //do nothing             
+        }
+    }
+    
+    
+// ---------------------------------------------------------
+// CDataMobilityTables::CreateMIP6TableL
+// ---------------------------------------------------------
+//
+void CDataMobilityTables::CreateMIP6TableL()
+    {
+    //Check whether MIP6 table exists
+    TInt error( KErrNone );
+    TRAP( error, CCDMIP6Record::TableIdL( *iSession ) );
+
+    //Table not found -> create it
+    if( error == KErrNotFound )
+        {
+        //Add table to CommsDat
+        CCDMIP6Record::CreateTableL( *iSession );
+        
+        //check result
+        TInt id( KErrNone );
+        TRAP( id, CCDMIP6Record::TableIdL( *iSession ) );
+        if( KErrNone <= id )
+            {
+            CLOG_WRITE( "Added MIP6 table\n" )
+            }
+        else
+            {
+            CLOG_WRITE_FORMAT( "Failed to add MIP6 table %d\n", id )
+            }
+        }
+    //Table already exists
+    else if ( error == KErrNone)
+        {
+            CLOG_WRITE( "MIP6 table already exists" )
+        }
+    else
+        {
+        //do nothing             
+        }
+    }
+    
+    
+// ---------------------------------------------------------
+// CDataMobilityTables::CreateSNAPMetadataTableL
+// ---------------------------------------------------------
+//
+void CDataMobilityTables::CreateSNAPMetadataTableL()
+    {
+    //Check whether SNAP Metadata table exists
+    TInt error( KErrNone );
+    TRAP( error, CCDSNAPMetadataRecord::TableIdL( *iSession ) );
+    
+    //Table not found -> create it
+    if( error == KErrNotFound )
+        {
+        //Add table to CommsDat
+        CCDSNAPMetadataRecord::CreateTableL( *iSession );
+        
+        //check result
+        TInt id( KErrNone );
+        TRAP( id, CCDSNAPMetadataRecord::TableIdL( *iSession ) );
+        if( KErrNone <= id )
+            {
+            CLOG_WRITE( "Added SNAP Metadata table\n" )
+            }
+        else
+            {
+            CLOG_WRITE_FORMAT( "Failed to add SNAP Metadata table? %d\n", id )
+            }
+        }
+    //Table already exists
+    else if ( error == KErrNone)
+        {
+        CLOG_WRITE( "SNAP Metadata table already exists" )
+        }
+    else
+        {
+        //do nothing             
+        }
+    }
+    
+    
+// ---------------------------------------------------------
+// CDataMobilityTables::CreateIAPMetadataTableL
+// ---------------------------------------------------------
+//
+void CDataMobilityTables::CreateIAPMetadataTableL()
+    {
+    //Check whether IAP Metadata table exists
+    TInt error( KErrNone );
+    TRAP( error, CCDIAPMetadataRecord::TableIdL( *iSession ) );
+
+    //Table not found -> create it
+    if( error == KErrNotFound )
+        {
+        //Add table to CommsDat
+        CCDIAPMetadataRecord::CreateTableL( *iSession );
+        
+        //check result
+        TInt id( KErrNone );
+        TRAP( id, CCDIAPMetadataRecord::TableIdL( *iSession ) );
+        if( KErrNone <= id )
+            {
+            CLOG_WRITE( "Added IAP Metadata table\n" )
+            }
+        else
+            {
+            CLOG_WRITE_FORMAT( "Failed to add IAP Metadata table: %d\n", id )
+            }
+        }
+    //Table already exists
+    else if ( error == KErrNone)
+        {
+        CLOG_WRITE( "IAP Metadata table already exists" )
+        }
+    else
+        {
+        //do nothing             
+        }
+    }
+
+
+// ---------------------------------------------------------
+// CDataMobilityTables::CreateVirtualIAPNextLayerTableL
+// ---------------------------------------------------------
+//
+void CDataMobilityTables::CreateVirtualIAPNextLayerTableL()
+    {
+    //Check whether IAP Metadata table exists
+    TInt error( KErrNone );
+    TRAP( error, CCDVirtualIAPNextLayerRecord::TableIdL( *iSession ) );
+
+    //Table not found -> create it
+    if( error == KErrNotFound )
+        {
+        //Add table to CommsDat
+        CCDVirtualIAPNextLayerRecord::CreateTableL( *iSession );
+        
+        //check result
+        TInt id( KErrNone );
+        TRAP( id, CCDVirtualIAPNextLayerRecord::TableIdL( *iSession ) );
+        if( KErrNone > id )
+            {
+            CLOG_WRITE_FORMAT( "Failed to add Virtual IAP Next Layer table %d\n", id )
+            }
+        else
+            {
+            CLOG_WRITE( "Added Virtual IAP Next Layer table\n" )
+            }
+        }
+    //Table already exists
+    else if ( error == KErrNone)
+        {
+        CLOG_WRITE( "Virtual IAP Next Layer table already exists" )
+        }
+    else
+        {
+        //do nothing             
+        }
+    }
+
+// ---------------------------------------------------------
+// CreateDestNetworkTableL
+// ---------------------------------------------------------
+//
+void CDataMobilityTables::CreateDestNetworkTableL()
+    {    
+    //checks whether table exists
+    TInt error( KErrNone );
+
+    TRAP( error, CCDDestNWTable::TableIdL( *iSession ) );
+    if( error == KErrNotFound )
+        {    
+        //table not found -- add new table
+        CCDDestNWTable::CreateTableL( *iSession );
+        
+        //check result
+        TRAP( error, CCDDestNWTable::TableIdL( *iSession ) );
+        
+        if ( error == KErrNone )
+            {
+            CLOG_WRITE( "Added Destination Network table" )
+            }
+        }
+    else if ( error == KErrNone)
+        {
+            CLOG_WRITE( "Destination Network table already exists" )
+        }
+    else
+        {
+        //do nothing             
+        }  
+    }
+
+// ---------------------------------------------------------
+// CDataMobilityTables::PopulateGlobalBearerTypeTableL
+// ---------------------------------------------------------
+//
+void CDataMobilityTables::PopulateGlobalBearerTypeTableL()
+    {
+    RCmManagerExt cmManager;
+    cmManager.CreateTablesAndOpenL();
+    
+    CleanupClosePushL( cmManager );
+    
+    RArray< TBearerPriority >* bearerArray = new( ELeave )
+                                            RArray< TBearerPriority >();
+    
+    CleanupStack::PushL( bearerArray );
+                           
+    // Check if the bearer table has already been filled
+    // (and skip populating in this case)
+    
+    cmManager.BearerPriorityArrayL( *bearerArray );
+    
+    if( !bearerArray->Count() )
+        {
+        // Prepare bearer priority array
+        // Strings are needed to be available until the update of the bearer array
+        // (TBearerPriority has a HBufC* member)
+        HBufC* lanServiceName = HBufC::NewLC( KMaxNameLength );
+        *lanServiceName = TPtrC( KCDTypeNameLANService );
+        HBufC* wLanServiceName = HBufC::NewLC( KMaxNameLength );
+        *wLanServiceName = TPtrC( KCDTypeNameWLANServiceExt );
+        HBufC* panServiceName = HBufC::NewLC( KMaxNameLength );
+        *panServiceName = TPtrC( KCDTypeNamePANServiceExt );
+        HBufC* gprsOutServiceName = HBufC::NewLC( KMaxNameLength );
+        *gprsOutServiceName = TPtrC( KCDTypeNameOutgoingWCDMA );
+        HBufC* gprsInServiceName = HBufC::NewLC( KMaxNameLength );
+        *gprsInServiceName = TPtrC( KCDTypeNameIncomingWCDMA );
+        HBufC* dialOutServiceName = HBufC::NewLC( KMaxNameLength );
+        *dialOutServiceName = TPtrC( KCDTypeNameDialOutISP );
+        HBufC* dialInServiceName = HBufC::NewLC( KMaxNameLength );
+        *dialInServiceName = TPtrC( KCDTypeNameDialInISP );
+        HBufC* vpnServiceName = HBufC::NewLC( KMaxNameLength );
+        *vpnServiceName = TPtrC( KCDTypeNameVPNService );
+        HBufC* mipServiceName = HBufC::NewLC( KMaxNameLength );
+        *mipServiceName = TPtrC( KCDTypeNameMIPServiceExt );
+        
+        bearerArray->Reset();
+        
+        TBearerPriority lanRecord;
+        lanRecord.iServiceType = lanServiceName;
+        lanRecord.iPriority = KDefaultPriorityLan;
+        lanRecord.iUIPriority = KDefaultPriorityLan;
+        bearerArray->Append( lanRecord );
+        
+        TBearerPriority wLanRecord;
+        wLanRecord.iServiceType = wLanServiceName;
+        wLanRecord.iPriority = KDefaultPriorityWlan;
+        wLanRecord.iUIPriority = KDefaultPriorityWlan;
+        bearerArray->Append( wLanRecord );
+        
+        TBearerPriority panRecord;
+        panRecord.iServiceType = panServiceName;
+        panRecord.iPriority = KDefaultPriorityPan;
+        panRecord.iUIPriority = KDefaultPriorityPan;
+        bearerArray->Append( panRecord );
+        
+        TBearerPriority gprsOutRecord;
+        gprsOutRecord.iServiceType = gprsOutServiceName;
+        gprsOutRecord.iPriority = KDefaultPriorityGprsOut;
+        gprsOutRecord.iUIPriority = KDefaultPriorityGprsOut;
+        bearerArray->Append( gprsOutRecord );
+        
+        TBearerPriority gprsInRecord;
+        gprsInRecord.iServiceType = gprsInServiceName;
+        gprsInRecord.iPriority = KDefaultPriorityGprsIn;
+        gprsInRecord.iUIPriority = KDefaultPriorityGprsIn;
+        bearerArray->Append( gprsInRecord );
+                        
+        TBearerPriority dialOutRecord;
+        dialOutRecord.iServiceType = dialOutServiceName;
+        dialOutRecord.iPriority = KDefaultPriorityDialOut;
+        dialOutRecord.iUIPriority = KDefaultPriorityDialOut;
+        bearerArray->Append( dialOutRecord );
+        
+        TBearerPriority dialInRecord;
+        dialInRecord.iServiceType = dialInServiceName;
+        dialInRecord.iPriority = KDefaultPriorityDialIn;
+        dialInRecord.iUIPriority = KDefaultPriorityDialIn;
+        bearerArray->Append( dialInRecord );
+        
+        TBearerPriority vpnRecord;
+        vpnRecord.iServiceType = vpnServiceName;
+        vpnRecord.iPriority = CMManager::KDataMobilitySelectionPolicyPriorityWildCard;
+        vpnRecord.iUIPriority = KDefaultUIPriorityVpn;
+        bearerArray->Append( vpnRecord );
+        
+        TBearerPriority mipRecord;
+        mipRecord.iServiceType = mipServiceName;
+        mipRecord.iPriority = CMManager::KDataMobilitySelectionPolicyPriorityWildCard;
+        mipRecord.iUIPriority = KDefaultUIPriorityMip;
+        bearerArray->Append( mipRecord );
+        
+        cmManager.UpdateBearerPriorityArrayL( *bearerArray );
+        
+        CLOG_WRITE( "Global Bearer Priorization table updated with default values\n" )
+        
+        // Only pop, because ownership is passed to the array
+        CleanupStack::Pop( mipServiceName ); 
+        CleanupStack::Pop( vpnServiceName );
+        CleanupStack::Pop( dialInServiceName ); 
+        CleanupStack::Pop( dialOutServiceName );
+        CleanupStack::Pop( gprsInServiceName );
+        CleanupStack::Pop( gprsOutServiceName ); 
+        CleanupStack::Pop( panServiceName );
+        CleanupStack::Pop( wLanServiceName ); 
+        CleanupStack::Pop( lanServiceName );
+        }
+        
+    else
+        {
+        CLOG_WRITE( "Not updating Global Bearer Priorization table\n" )
+        }
+    
+    cmManager.CleanupGlobalPriorityArray( *bearerArray );
+
+    CleanupStack::PopAndDestroy( bearerArray ); 
+    CleanupStack::PopAndDestroy( &cmManager );
+    }
+
+
+//  End of File.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatcreator/Src/cdcdumptables.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,453 @@
+/*
+* 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:   Implementation of the class CProcessorCSD
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include <wlancontainer.h>
+#include <cmmanagertablefields.h>
+#include <datamobilitycommsdattypes.h>
+#include <f32file.h>
+#include <featmgr.h>
+
+#include "cdcdumptables.h"
+#include "cdclogger.h"
+
+// DEFINES
+
+#define QUERY_HBUFC_FIELD( record, fieldId ) *STATIC_CAST(CommsDat::CMDBField<HBufC*>*, record->GetFieldByIdL( fieldId ))
+#define QUERY_HBUFC8_FIELD( record, fieldId ) *STATIC_CAST(CommsDat::CMDBField<HBufC8*>*, record->GetFieldByIdL( fieldId ))
+#define QUERY_UINT32_FIELD( record, fieldId ) *STATIC_CAST(CommsDat::CMDBField<TUint32>*, record->GetFieldByIdL( fieldId ))
+#define QUERY_INT_FIELD( record, fieldId ) *STATIC_CAST(CommsDat::CMDBField<TInt>*, record->GetFieldByIdL( fieldId ))
+
+
+// CONSTANTS
+
+// commons for CSV file creatin
+_LIT16( KComma, "," );
+_LIT16( KNewLine, "\n" );
+_LIT16( KCRT, "\r" );
+_LIT16( KDQuote, "\"" );
+
+// Table names for CSV file creation
+_LIT16( KCDWlanServiceRecord,        "CCDWlanService" );
+_LIT16( KCDWlanDeviceSettingsRecord, "CCDWlanDeviceSettings" );
+_LIT16( KCDWLANSecSSIDTable,         "CCDWLANSecSSIDTable" );
+_LIT16( KCDDestNWTable,              "CCDDestNWTable" );
+_LIT16( KCDVirtualIAPNextLayerRecord,"CCDVirtualIAPNextLayer" );
+_LIT16( KCDDataMobilitySelectionPolicyRecord, "CCDDataMobilitySelectionPolicy" );
+_LIT16( KCDSNAPMetadataRecord,       "CCDSNAPMetadata" );
+_LIT16( KCDGlobalBearerTypePriorizationRecord, "CCDGlobalBearerTypePriorization" );
+_LIT16( KCDMIPServiceExtRecord,      "CCDMIPServiceExt" );
+_LIT16( KCDIAPMetadataRecord,        "CCDIAPMetadata" );
+_LIT16( KCDMIP4Record,               "CCDMIP4" );
+_LIT16( KCDMIP6Record,               "CCDMIP6" );
+
+
+// Little-endian Unicode file header.
+const TUint16 KLittleEndianUnicodeHeader = 0xFEFF;
+// Buffer length for number conversion
+const TInt KFormatBufLen = 40;
+
+
+// ---------------------------------------------------------
+// CDumpTables::NewL
+// ---------------------------------------------------------
+//
+CDumpTables* CDumpTables::NewL()
+    {
+    CDumpTables* self = NewLC();
+    CleanupStack::Pop( self ); // self
+    return self;
+    }
+
+// ---------------------------------------------------------
+// CDumpTables::NewLC
+// ---------------------------------------------------------
+//
+CDumpTables* CDumpTables::NewLC()
+    {
+    CDumpTables* self = new ( ELeave ) CDumpTables();
+    CleanupStack::PushL( self );
+
+    // From base class
+    self->ConstructL();
+    return self;
+    }
+     
+     
+// ---------------------------------------------------------
+// CDumpTables::~CDumpTables
+// ---------------------------------------------------------
+//
+CDumpTables::~CDumpTables()
+    {
+    iRfs.Close();
+    if (iSession)
+        {
+        iSession->Close();
+        delete iSession;        
+        }      
+    }    
+
+// ---------------------------------------------------------
+// CDumpTables::ConstructL
+// ---------------------------------------------------------
+//
+void CDumpTables::ConstructL()
+    {
+    iSession = CommsDat::CMDBSession::NewL( 
+               CommsDat::CMDBSession::LatestVersion() );
+    }
+    
+    
+// ---------------------------------------------------------
+// CDumpTables::CDumpTables
+// ---------------------------------------------------------
+//
+CDumpTables::CDumpTables()
+    {
+    
+    }
+    
+// ---------------------------------------------------------
+// CDumpTables::DoDumpTablesL
+// ---------------------------------------------------------
+//
+void CDumpTables::DoDumpTablesL( const TFileName& aOutFileName )
+    {
+
+    User::LeaveIfError( OpenFileL( aOutFileName ) );
+
+
+    //checks if Wlan feature is supported
+    FeatureManager::InitializeLibL();
+    TBool isWlanS( FeatureManager::FeatureSupported( KFeatureIdProtocolWlan ) );
+    FeatureManager::UnInitializeLib();
+    
+    if( isWlanS )
+        {
+        // Dumps CCDWlanService Table 
+        DumpTableL<CCDWlanServiceRecord>( &KCDWlanServiceRecord );
+
+        // Dumps CCDWlanDeviceSettings Table  
+        DumpTableL<CCDWlanDeviceSettingsRecord>( &KCDWlanDeviceSettingsRecord );
+
+        // Dumps CCDWLANSecSSID Table  
+        DumpTableL<CCDWLANSecSSIDTable>( &KCDWLANSecSSIDTable );
+    
+        // Dumps CCDDestNWTable Table  
+        DumpTableL<CCDDestNWTable>( &KCDDestNWTable );
+        }
+        
+    // Dumps CCDVirtualIAPNextLayerRecord Table  
+    DumpTableL<CCDVirtualIAPNextLayerRecord>( 
+              &KCDVirtualIAPNextLayerRecord );
+
+    // Dumps CCDDataMobilitySelectionPolicyRecord Table  
+    DumpTableL<CCDDataMobilitySelectionPolicyRecord>(
+              &KCDDataMobilitySelectionPolicyRecord );
+
+    // Dumps CCDSNAPMetadataRecord Table  
+    DumpTableL<CCDSNAPMetadataRecord>( &KCDSNAPMetadataRecord );
+
+    // Dumps CCDGlobalBearerTypePriorizationRecord Table  
+    DumpTableL<CCDGlobalBearerTypePriorizationRecord>( 
+              &KCDGlobalBearerTypePriorizationRecord );
+
+    // Dumps CCDMIPServiceExtRecord Table  
+    DumpTableL<CCDMIPServiceExtRecord>( &KCDMIPServiceExtRecord );
+
+    // Dumps CCDIAPMetadataRecord Table  
+    DumpTableL<CCDIAPMetadataRecord>( &KCDIAPMetadataRecord );
+    
+    // Dumps CCDMIP4Record Table  
+    DumpTableL<CCDMIP4Record>( &KCDMIP4Record );
+    
+    // Dumps CCDMIP6Record Table  
+    DumpTableL<CCDMIP6Record>( &KCDMIP6Record );
+    
+    iFile.Close();   
+    }
+
+  
+// ---------------------------------------------------------
+// CDumpTables::DumpTableL
+// ---------------------------------------------------------
+//
+template<class T> void CDumpTables::DumpTableL( const TDesC* aTableName )
+    {
+    
+    CLOG_WRITE_FORMAT( "Dump table: %S \n", aTableName );
+
+    iFile.WriteL( *aTableName );    
+    iFile.WriteL( KNewLine );    
+
+    // Retreives the table the recordset and the recordinfo
+    TMDBElementId tableId = T::TableIdL( *iSession );
+   
+    T* table = new (ELeave) T( tableId );
+
+    const SRecordTypeInfo* aRecordInfo = table->GetRecordInfo();              
+
+    CommsDat::CMDBRecordSet<T>* aRecordSet = 
+              new (ELeave) CommsDat::CMDBRecordSet<T>( tableId );
+    
+    // Loads the table          
+    TRAP_IGNORE( aRecordSet->LoadL( *iSession ) );
+
+    //The table has been loaded
+    TInt count = aRecordSet->iRecords.Count();
+    CLOG_WRITE_FORMAT("Record count: %d", count );
+        
+      
+    TBuf16<KFormatBufLen> buf;
+    
+    // Goes throught the records        
+    for ( TInt i = 0; i < count; i++ )
+        {
+        // The closing (after last) field in the record has 0 iTypeId 
+        // to indicate the end of the record. 
+        for ( TInt j = 0; 0 < aRecordInfo[j].iTypeId; j++ )
+            {
+            // Switch for different data types
+            switch( aRecordInfo[j].iValType )
+                {
+                case EInt:
+                case EBool:
+                    {
+                    // Dumping TInt
+                    TInt res( QUERY_INT_FIELD( 
+                          (*aRecordSet)[i], aRecordInfo[j].iTypeId ) );
+                    buf.Format( _L( "%d" ), res );
+                    iFile.WriteL ( buf );
+                    }
+                break;
+                
+                case EUint32:
+                case ELink:
+                    {
+                    // Dumping TUint32
+                    TUint32 res32( QUERY_UINT32_FIELD( 
+                            (*aRecordSet)[i], aRecordInfo[j].iTypeId ) );
+                    buf.Format( _L( "%d" ), res32 );
+                    iFile.WriteL ( buf );
+                    }
+                break;
+
+                case EText:
+                case EMedText:
+                case ELongText:
+                    {
+                    // Dumping text16
+                    HBufC16* text16 = QUERY_HBUFC_FIELD( 
+                            (*aRecordSet)[i], aRecordInfo[j].iTypeId );
+                    WriteL ( text16 );
+                    }
+                break;
+                
+                case EDesC8:
+                    {
+                    // Dumping text8
+                    HBufC8* text8 = QUERY_HBUFC8_FIELD( 
+                            (*aRecordSet)[i], aRecordInfo[j].iTypeId );
+            
+                    WriteL ( text8 );
+                    }
+                break;
+
+                default:
+                    CLOG_WRITE_FORMAT("! warning: type not supported: %d", 
+                                                aRecordInfo[j].iValType );
+                break;                                                
+                }
+                iFile.WriteL( KComma );
+            
+            }
+            iFile.WriteL( KNewLine );
+        }
+    }
+    
+// ---------------------------------------------------------
+// CDumpTables::OpenFileL
+// ---------------------------------------------------------
+//
+TInt CDumpTables::OpenFileL( const TFileName& aFileName )
+    {
+    ////CLOG_WRITE_FORMAT( "Output file name %S", aFileName ); 
+    
+    TInt err = iRfs.Connect();
+
+    if( err == KErrNone )
+        {
+        err = iFile.Replace( iRfs, aFileName, EFileStreamText | EFileWrite );
+        }
+    
+    if( err == KErrNotFound ) 
+        // file does not exist - create it
+        {
+        err=iFile.Create( iRfs, aFileName, EFileStreamText | EFileWrite );
+        }
+    
+    if( err == KErrNone )
+        {
+        // Write little-endian Unicode file header.
+        iFile.WriteUint16L( KLittleEndianUnicodeHeader );
+        }
+        
+    if( err != KErrNone )
+        {
+        iFile.Close();
+        ////CLOG_WRITE_FORMAT( "!Error Output file cannot be opened: %S", aFileName );
+        }
+        
+    return err;
+    }
+
+
+// ---------------------------------------------------------
+// CDumpTables::WriteL
+// ---------------------------------------------------------
+//
+void CDumpTables::WriteL( HBufC8* aDes )
+    {
+
+    if( aDes )
+        {
+    
+        CleanupStack::PushL( aDes );
+
+        HBufC16* text16 = HBufC16::NewL( aDes->Length() );
+        text16->Des().Copy( aDes->Des() );
+    
+        WriteL ( text16 );
+
+        CleanupStack::PopAndDestroy( aDes );
+        }
+
+    }    
+
+    
+// ---------------------------------------------------------
+// CDumpTables::WriteL
+// ---------------------------------------------------------
+//
+void CDumpTables::WriteL( HBufC16* aDes )
+    {
+    
+    if( aDes )
+        {
+        CleanupStack::PushL( aDes );
+        
+        TBool res = CheckCSVTransformNeedL( aDes );
+
+        // Need conversion
+        if( res )
+            {
+            HBufC16* cvsFormat = TransformToCSVFormatLC( aDes );
+            iFile.WriteL ( *cvsFormat );
+            CleanupStack::PopAndDestroy( cvsFormat );
+            }
+        else
+            {
+            iFile.WriteL ( *aDes );
+            }
+        CleanupStack::PopAndDestroy( aDes );
+        }
+    }    
+
+
+// ---------------------------------------------------------
+// CDumpTables::TransformToCSVFormatLC
+// ---------------------------------------------------------
+//
+HBufC16* CDumpTables::TransformToCSVFormatLC( const HBufC16* aField )
+    {
+    CLOG_WRITE_FORMAT( "Transform needed:  %S", aField );
+
+    // Length of the csv format string is calculated.
+    // "2" are the leading and trailing d.qquotes
+    TInt csvLen = aField->Length() + iNumOfDQuotes + 2; 
+    HBufC16* csv = HBufC16::NewLC( csvLen );
+    
+    TPtr16 ptr = csv->Des();
+
+    // Heading quote    
+    ptr.Append( KDQuote );
+    ptr.Append( *aField );
+    
+    // Quotes might be duplicated
+    if( 0 < iNumOfDQuotes )
+        {
+        // Heading quote step over
+        TInt pos = 1;
+        while( pos < ptr.Length() && pos != KErrNotFound )
+            {
+            ptr = ptr.Mid( pos );
+            pos = ptr.Find( KDQuote );
+            if( pos != KErrNotFound )
+                {
+                ptr.Insert( pos, KDQuote );
+                pos+=2;                
+                }
+            }
+        }
+
+    // Tailing quote
+    ptr.Append( KDQuote );
+
+    CLOG_WRITE_FORMAT( "Transformed:      %S", csv );
+ 
+    return csv;
+    }
+
+
+// ---------------------------------------------------------
+// CDumpTables::CheckCSVTransformNeedL
+// ---------------------------------------------------------
+//
+TBool CDumpTables::CheckCSVTransformNeedL( HBufC16* aField )
+    {
+    // Looks for comma, new line or carrige return characters.
+    // Only existance is necessary. If any of them exist the
+    // quoting is necessary  
+    TInt cnrPos = aField->Find( KComma );
+    if( cnrPos == KErrNotFound )
+        {
+        cnrPos = aField->Find( KNewLine );
+        if( cnrPos == KErrNotFound )
+            {
+            cnrPos = aField->Find( KCRT );
+            }
+        }
+    
+    // Serches for all dquote. Number is usefull for csv text creation
+    iNumOfDQuotes = 0;        
+    TPtr16 ptr = aField->Des();
+    
+    TInt quotePos = ptr.Find( KDQuote );
+    while( quotePos != KErrNotFound )
+        {
+        iNumOfDQuotes++;
+        ptr = ptr.Mid( quotePos+1 );
+        quotePos = ptr.Find( KDQuote );
+        }
+      
+    // csv file conversion necessary if comma... or quote is in the text.        
+    return ( 0 < iNumOfDQuotes || cnrPos != KErrNotFound );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatcreator/Src/cdcprocessorbase.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,547 @@
+/*
+* Copyright (c) 2004 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 the class CProcessorBase
+*
+*/
+
+
+
+
+// INCLUDE FILES
+
+#include "cdcprocessorbase.h"
+#include "cdcreaderbase.h"
+#include "cdclogger.h"
+
+#include <cmmanagerext.h>
+#include <cmconnectionmethoddef.h>
+#include <cmconnectionmethodext.h>
+#include <cmdestinationext.h>
+#include <datamobilitycommsdattypes.h>
+
+
+using namespace CMManager;
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CProcessorBase::CProcessorBase
+// Constructor.
+// ---------------------------------------------------------
+//
+CProcessorBase::CProcessorBase( CReaderBase* aFileReader,
+                                RCmManagerExt& aCmManager,
+                                RPointerArray< RCmConnectionMethodExt >& aPluginArray,
+                                RPointerArray< HBufC >& aPluginNames ) :
+        iFileReader( aFileReader ), 
+        iProxyEnabled( EFalse ),
+        iIsProtected( EFalse )
+    {
+    iCmManager = &aCmManager;
+    
+    iPluginArray = &aPluginArray;
+    iPluginName = &aPluginNames;
+    }
+
+
+CProcessorBase::CProcessorBase( CReaderBase* aFileReader,
+                        RCmManagerExt& aCmManager,
+                        RPointerArray< RCmConnectionMethodExt >& aPluginArray,
+                        RPointerArray< HBufC >& aPluginNames,
+                        RPointerArray< RCmDestinationExt >& aDestArray,
+                        RPointerArray< HBufC >& aDestNames ) :
+        iFileReader( aFileReader ), 
+        iProxyEnabled( EFalse ),
+        iIsProtected( EFalse )
+    {
+    iCmManager = &aCmManager;
+    
+    iPluginArray = &aPluginArray;
+    iPluginName = &aPluginNames;
+    
+    iDestArray = &aDestArray;
+    iDestName = &aDestNames;
+    }
+
+
+// ---------------------------------------------------------
+// CProcessorBase::~CProcessorBase
+// Destructor.
+// ---------------------------------------------------------
+//
+CProcessorBase::~CProcessorBase()
+    {
+    iPlugin.Close();
+    if( iName )
+        {
+        delete iName;
+        }
+    }
+
+
+// ---------------------------------------------------------
+// CProcessorBase::ParseFileL
+// ---------------------------------------------------------
+//
+//PseudoCode:
+// 0010 locates the next access point within the text file
+// 0020 parses the location and reads the input data to TagContainer
+// 0030 from TagContainer creates Access Point Item Object
+// 0040 using the Access Point Item Object creates a new AP record in CommsDat
+// 0050 clears TagContainer
+//
+void CProcessorBase::ParseFileL()
+    {
+    //LocateAP : locates the access points within the text file
+    while ( iFileReader->LocateAPL() )
+        {
+        //ParseAPL : parses the location, reads the input data to TagContainer
+        iFileReader->ParseAPL();
+        
+        //from TagContainer creates Access Point Item Object
+        ProcessTagL( iFileReader->FieldIDPresent() );
+                
+        //adds the Access Point Item Object to CommsDB
+        ProcessAPL();
+            
+        //clear TagContainer
+        TagContainer().Clear();
+            
+        }//while    
+        
+    CLOG_WRITE( "---------------------\n" )
+    }
+
+// ---------------------------------------------------------
+// CProcessorPacketData::ProcessTagL
+// ---------------------------------------------------------
+//
+void CProcessorBase::ProcessTagL( TBool /*aFieldIDPresent*/ )
+    {
+    iProxyEnabled= EFalse;
+    iIsProtected = EFalse;
+
+    Reset();
+    TInt aCMId = -1;
+    for ( TInt idx(0); idx < TagContainer().Count(); idx++)
+        {
+        if ( TagContainer().FieldId( idx ) == ECmId)
+            {
+            HBufC16* ptrTag = TagContainer().Tag(idx);
+            TLex16 lex(ptrTag->Des());
+            TInt err = lex.Val(aCMId);
+            if (err != KErrNone)
+                {
+                User::Leave(err);    
+                }
+            break;
+            }
+        }
+    if (aCMId == -1)
+        {
+        iPlugin = iCmManager->CreateConnectionMethodL( iBearerType );        
+        CLOG_WRITE( "ConnectionMethod created without ECmId.");
+        }
+    else
+        {
+        iPlugin = iCmManager->CreateConnectionMethodL( iBearerType, aCMId);        
+        CLOG_WRITE_FORMAT( "ConnectionMethod created. ECmId:%d", aCMId);
+        }
+     
+    for ( TInt idx(0); idx < TagContainer().Count(); idx++)
+        {
+        HBufC16* ptrTag = TagContainer().Tag(idx);
+        TInt field =  TagContainer().FieldId( idx );
+
+        TBool processed = SetGeneralFieldL( field, ptrTag );
+        if( !processed )
+            {
+            ProcessSpecialFieldsL( field, ptrTag, idx );
+            }
+        }
+        
+    AddToPluginArrayL();
+    
+    }
+
+// --------------------------------------------------------
+// CProcessorBase::TagContainer()
+// --------------------------------------------------------
+CTagContainer& CProcessorBase::TagContainer()
+    {
+    return iFileReader->TagContainer();    
+    }
+
+
+// --------------------------------------------------------
+// CProcessorBase::AddToPluginArrayL()
+// --------------------------------------------------------
+void CProcessorBase::AddToPluginArrayL()
+    {
+    if( !iName )
+        {
+        CLOG_WRITE( "Error: No plugin name !!!" )
+        }    
+    else
+        {
+        const RCmConnectionMethodExt* newItem = new (ELeave) 
+                RCmConnectionMethodExt( iPlugin );
+    
+        iPluginArray->Append( newItem );
+        iPluginName->Append( iName->AllocL() );
+        
+        delete iName;
+        iName = NULL;
+        
+        iPlugin.Close();
+        }
+    }
+
+// --------------------------------------------------------
+// CProcessorBase::GetLastPluginL()
+// --------------------------------------------------------
+RCmConnectionMethodExt& CProcessorBase::GetLastPluginL()
+    {
+    return GetPluginL( PluginCount() - 1 );
+                
+    }    
+
+// --------------------------------------------------------
+// CProcessorBase::GetPluginL()
+// --------------------------------------------------------
+RCmConnectionMethodExt& CProcessorBase::GetPluginL( TInt aPos )
+    {
+
+    return *(iPluginArray->operator[]( aPos ));
+                
+    }    
+
+// --------------------------------------------------------
+// CProcessorBase::PluginCount()
+// --------------------------------------------------------
+TInt CProcessorBase::PluginCount()
+    {
+
+    return iPluginArray->Count();
+                
+    }    
+
+// ---------------------------------------------------------
+// CProcessorBase::FindDestinationL
+// ---------------------------------------------------------
+//
+RCmDestinationExt* CProcessorBase::FindDestinationL( HBufC* aName )
+    {
+    for( TInt i(0); i < iDestName->Count(); i++ )
+        {
+        HBufC *name = (*iDestName)[i];
+        if( aName->Compare( *name  ) == 0 )
+            {
+            return (*iDestArray)[ i ];
+            }
+        }
+    CLOG_WRITE_FORMAT("Warning: Destination not found: %S", aName );
+    return NULL;
+    }
+
+// ---------------------------------------------------------
+// CProcessorBase::GetDestinationIdL
+// ---------------------------------------------------------
+//
+TInt CProcessorBase::GetDestinationIdL( HBufC16* aName )
+    {
+    RCmDestinationExt* dest = FindDestinationL( aName );
+    
+    TInt ret( KErrNotFound );
+    if( dest != NULL )
+        {
+        ret = dest->Id();
+        }
+        
+    return ret;    
+    }
+
+// ---------------------------------------------------------
+// CProcessorBase::FindPluginL
+// ---------------------------------------------------------
+// 
+RCmConnectionMethodExt* CProcessorBase::FindPluginL( HBufC* aName )
+    {
+    TInt pos;
+    return FindPluginL( aName, pos );
+    } 
+ 
+// ---------------------------------------------------------
+// CProcessorBase::FindPluginL
+// ---------------------------------------------------------
+//
+RCmConnectionMethodExt* CProcessorBase::FindPluginL( HBufC* aName, TInt& aPos )
+    {
+    RCmConnectionMethodExt* ret( NULL );
+    
+    aPos = CheckPluginName( aName );
+    if ( aPos != KErrNotFound )
+        {
+        ret = (*iPluginArray)[ aPos ];
+        }
+    else
+        {
+        CLOG_WRITE_FORMAT("Warning: Connection method not found: %S", aName );
+        }
+
+    return ret;
+    }
+
+// ---------------------------------------------------------
+// CProcessorBase::CheckPluginName
+// ---------------------------------------------------------
+//
+TInt CProcessorBase::CheckPluginName( HBufC* aName )
+    {
+    TInt ret( KErrNotFound );
+    
+    for( TInt i = 0; i < iPluginName->Count() && ret == KErrNotFound; i++ )
+        {
+        HBufC *name = (*iPluginName)[i];
+        if( aName->Compare( *name  ) == 0 )
+            {
+            ret = i;
+            }
+        }
+    return ret;
+    }
+
+
+
+// ---------------------------------------------------------
+// CProcessorBase::GetPluginIdL
+// ---------------------------------------------------------
+//
+TInt CProcessorBase::GetPluginIdL( HBufC16* aName )
+    {
+    RCmConnectionMethodExt* cm = FindPluginL( aName );
+    
+    TInt ret( KErrNotFound );
+    if( cm != NULL )
+        {
+        ret = cm->GetIntAttributeL( CMManager::ECmIapId );
+        }
+        
+    return ret;    
+    }
+
+    
+// ---------------------------------------------------------
+// CProcessorBase::ProcessAPL
+// ---------------------------------------------------------
+//
+void CProcessorBase::ProcessAPL()
+    {
+    RCmConnectionMethodExt& plugin = GetLastPluginL();
+    if( iIsProtected )
+        {
+        plugin.SetBoolAttributeL( ECmProtected, ETrue );
+        }
+        
+    // Writes into the log file.
+    DoLogL();
+    }
+    
+// ---------------------------------------------------------
+// CProcessorBase::ProcessAPL
+// ---------------------------------------------------------
+//
+TBool CProcessorBase::SetGeneralFieldL( TInt aField, HBufC* aPtrTag )
+    {
+    TBool processed( ETrue );
+    switch( aField )
+        {
+        case ECmName:     
+            {
+            // If input is not empty
+            if ( aPtrTag->CompareF( KStrEmpty ) != 0 )
+                {
+                TInt pos = CheckPluginName( aPtrTag );
+                if( pos != KErrNotFound )
+                    {
+                    CLOG_WRITE_FORMAT("Warning: plugin exist. It might be renamed ! : %S", aPtrTag );
+                    }
+                iPlugin.SetStringAttributeL( aField, *aPtrTag );
+                if( !iName )
+                    {
+                    iName = aPtrTag->AllocL();
+                    }
+                }
+            break;
+            }
+        case ECmStartPage:
+            {
+            // If input is not empty
+            if ( aPtrTag->CompareF( KStrEmpty ) != 0 )
+                {
+                iPlugin.SetStringAttributeL( aField, *aPtrTag );
+                }
+            break;
+            }
+        case ECmHidden:              //fall through
+        case ECmMetaHiddenAgent:     //fall through
+        case ECmMetaHighlight:       //fall through
+            {
+            if( aPtrTag->CompareF( KStrNo ) == 0 )
+                {
+                iPlugin.SetBoolAttributeL( aField, EFalse );
+                }
+            else if( aPtrTag->CompareF( KStrYes ) == 0 )
+                {
+                iPlugin.SetBoolAttributeL( aField, ETrue );
+                }
+            else
+                {
+                iPlugin.SetBoolAttributeL( aField, EFalse );
+                switch ( aField )
+                    {
+                    case ECmHidden:
+                        CLOG_WRITE( "! Error : Invalid Hidden. Default:No");
+                        break;
+                    case ECmMetaHiddenAgent:
+                        CLOG_WRITE( "! Error : Invalid HiddenAgent. Default:No");
+                        break;
+                    case ECmMetaHighlight:
+                        CLOG_WRITE( "! Error : Invalid Highlight. Default:No");
+                        break;
+                    }
+                }
+            break;
+            }
+        case ECmSeamlessnessLevel:
+            {
+            if ( aPtrTag->CompareF( KStrNotRoamedTo ) == 0 )
+                {
+                iPlugin.SetIntAttributeL( aField,
+                                        CMManager::ESeamlessnessNotRoamedTo );
+                }
+            else if ( aPtrTag->CompareF( KStrConfirmFirst ) == 0 )
+                {
+                iPlugin.SetIntAttributeL( aField,
+                                        CMManager::ESeamlessnessConfirmFirst );
+                }
+            else if ( aPtrTag->CompareF( KStrShowProgress ) == 0 )
+                {
+                iPlugin.SetIntAttributeL( aField,
+                                        CMManager::ESeamlessnessShowprogress );
+                }
+            else if ( aPtrTag->CompareF( KStrFullySeamless ) == 0 )
+                {
+                iPlugin.SetIntAttributeL( aField,
+                                        CMManager::ESeamlessnessFullySeamless );
+                }
+            break;
+            }
+            
+        case ECmProtected:
+            {
+            // Protection
+            if ( aPtrTag->CompareF( KStrYes ) == 0 )
+                {
+                iIsProtected = ETrue;
+                }
+            else if ( aPtrTag->CompareF( KStrNo ) != 0 )
+                {
+                CLOG_WRITE( "! Error : Invalid Protected value. Default:No" )
+                }
+            break;
+            }
+            
+        default:
+            {
+            processed = EFalse;
+            }        
+        }
+        
+    return processed;
+    }
+
+// ---------------------------------------------------------
+// CProcessorBase::DoLogL
+// ---------------------------------------------------------
+//
+
+void CProcessorBase::DoLogL()
+    {
+    
+    TInt lastPos = iPluginArray->Count() - 1;
+    
+    CLOG_WRITE( "Internet Access Point created:" )
+    CLOG_WRITE_FORMAT( "\t Connection name: %S ", (*iPluginName)[ lastPos ] );
+    
+    if ( iIsProtected )
+        {
+        CLOG_WRITE( "\t Protected" )
+        }
+    else
+        {
+        CLOG_WRITE( "\t Not protected" )
+        }
+    }
+// ---------------------------------------------------------
+// CProcessorBase::SetAddressFromServerL
+// ---------------------------------------------------------
+//
+
+void CProcessorBase::SetAddressFromServerL( TInt aIPField1, 
+                                           TInt aIPField2, 
+                                           TInt aAddrFromSField,
+                                           TInt aIPField1IP6,
+                                           TInt aIPField2IP6,
+                                           TInt aAddrFromSFieldIP6 )
+    {
+        //calculate and set Ip6AddrFromServer
+        HBufC *pIp1 = NULL;        
+        HBufC *pIp2 = NULL;        
+        pIp1 = iPlugin.GetStringAttributeL( aIPField1IP6 );
+        CleanupStack::PushL( pIp1 );
+        pIp2 = iPlugin.GetStringAttributeL( aIPField2IP6 );
+        CleanupStack::PushL( pIp2 );
+        _LIT( KDynIpv6Address, "0:0:0:0:0:0:0:0" );
+        if ( ( pIp1->Compare( KDynIpv6Address ) == 0 ) &&
+             ( pIp2->Compare( KDynIpv6Address ) == 0 ) )
+            {
+            iPlugin.SetBoolAttributeL( aAddrFromSFieldIP6, ETrue );
+            }
+        else
+            {
+            iPlugin.SetBoolAttributeL( aAddrFromSFieldIP6, EFalse );
+            }
+        CleanupStack::PopAndDestroy( 2,pIp1 );
+
+        //calculate and set AddrFromServer
+        pIp1 = iPlugin.GetStringAttributeL( aIPField1 );
+        CleanupStack::PushL( pIp1 );
+        pIp2 = iPlugin.GetStringAttributeL( aIPField2 );
+        CleanupStack::PushL( pIp2 );    
+        _LIT( KDynIpAddress, "0.0.0.0" );
+        if ( ( pIp1->Compare( KDynIpAddress ) == 0 ) &&
+             ( pIp2->Compare( KDynIpAddress ) == 0 ) )
+            {
+            iPlugin.SetBoolAttributeL( aAddrFromSField, ETrue );
+            }
+        else
+            {
+            iPlugin.SetBoolAttributeL( aAddrFromSField, EFalse );
+            }
+        CleanupStack::PopAndDestroy( 2,pIp1 );        
+    }
+
+// End of File.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatcreator/Src/cdcprocessordn.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,471 @@
+/*
+* 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:   Implementation of the class CProcessorDN
+*
+*/
+
+
+
+
+// INCLUDE FILES
+
+#include "cdcprocessordn.h"
+#include "cdclogger.h"
+#include "cdctagcontainer.h"
+
+using namespace CMManager;
+
+// CONSTANTS
+
+_LIT16( KDefaultDestinationName, "Default destination" );
+//_LIT16( KMetadataUserDefined, "UserDefined" );
+//_LIT16( KMetadataInternet, "Internet" );
+
+// constants for TSnapPurpose
+_LIT16( KPurposeUnknown, "UserDefined" );
+_LIT16( KPurposeInternet, "Internet" );
+_LIT16( KPurposeOperator, "Operator" );
+_LIT16( KPurposeMMS, "MMS" );
+_LIT16( KPurposeIntranet, "Intranet" ); 
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CProcessorDN::NewL
+// ---------------------------------------------------------
+//
+CProcessorDN* CProcessorDN::NewL( CReaderBase* aFileReader,
+                                  RCmManagerExt& aCmManager,
+                                  RPointerArray< RCmConnectionMethodExt >& aPluginArray,
+                                  RPointerArray< HBufC >& aPluginNames, 
+                                  RPointerArray< RCmDestinationExt >& aDestArray,
+                                  RPointerArray< HBufC >& aDestNames,
+                                  RArray<TBool>& aCmInDest,
+                                  TBool aIsFirstRound )
+    {
+    CProcessorDN* self = new ( ELeave ) CProcessorDN( aFileReader,
+                                                      aCmManager,
+                                                      aPluginArray,
+                                                      aPluginNames,
+                                                      aDestArray,
+                                                      aDestNames,
+                                                      aCmInDest,
+                                                      aIsFirstRound );
+    CleanupStack::PushL( self );
+
+    // From base class
+    self->ConstructL();
+    CleanupStack::Pop( self ); // self
+    return self;
+    }
+    
+    
+// ---------------------------------------------------------
+// CProcessorDN::~CProcessorDN
+// ---------------------------------------------------------
+//
+CProcessorDN::~CProcessorDN()
+    {
+    iDestination.Close();
+    }
+     
+     
+// ---------------------------------------------------------
+// CProcessorDN::ConstructL
+// ---------------------------------------------------------
+//
+void CProcessorDN::ConstructL()
+    {
+    }
+
+
+// ---------------------------------------------------------
+// CProcessorDN::CProcessorDN
+// ---------------------------------------------------------
+//
+CProcessorDN::CProcessorDN( CReaderBase* aFileReader,
+                            RCmManagerExt& aCmManager,
+                            RPointerArray< RCmConnectionMethodExt >& aPluginArray,
+                            RPointerArray< HBufC >& aPluginNames, 
+                            RPointerArray< RCmDestinationExt >& aDestArray,
+                            RPointerArray< HBufC >& aDestNames,
+                            RArray< TBool >& aCmInDest, 
+                            TBool aIsFirstRound ) :
+                                      CProcessorBase( aFileReader,
+                                                      aCmManager,
+                                                      aPluginArray,
+                                                      aPluginNames,
+                                                      aDestArray,
+                                                      aDestNames ),
+                                      iProtectionLevel( EProtLevel0 ),
+                                      iIsFirstRound( aIsFirstRound )
+    {
+    iCmInDest = &aCmInDest;
+    }
+
+
+// ---------------------------------------------------------
+// CProcessorDN::ProcessTagL
+// ---------------------------------------------------------
+//
+void CProcessorDN::ProcessTagL( TBool /*aFieldIDPresent*/ )
+    {
+    
+    iDestinationDropped = EFalse;
+    
+    iProtectionLevel = EProtLevel0;
+    
+    if( iIsFirstRound )
+        {
+        TInt dnId = -1;
+        for ( TInt idx(0); idx < TagContainer().Count(); idx++)
+            {
+            if ( TagContainer().FieldId( idx ) == EDN_Id )
+                {
+                HBufC16* ptrTag = TagContainer().Tag(idx);
+                TLex16 lex(ptrTag->Des());
+                TInt err = lex.Val(dnId);
+                if (err != KErrNone)
+                    {
+                    CLOG_WRITE( "The destinaton Id field is bad.");
+                    User::Leave(err);    
+                    }
+                break;
+                }
+            }
+        if (dnId == -1)
+            {
+            iDestination = iCmManager->CreateDestinationL( KDefaultDestinationName );        
+            CLOG_WRITE( "Destinaton created without dnId.");
+            }
+        else
+            {
+            iDestination = iCmManager->CreateDestinationL( KDefaultDestinationName, dnId);        
+            CLOG_WRITE_FORMAT( "Destinaton created. dnId:%d", dnId);
+            }
+        }
+        
+    HBufC *destName( NULL );
+    TInt priority = 0;
+    RPointerArray<HBufC> names;
+    
+    for (TInt idx(0); idx < TagContainer().Count(); idx++)
+        {
+        HBufC16* ptrTag = TagContainer().Tag(idx);
+        TInt field =  TagContainer().FieldId( idx );
+        
+        if( iIsFirstRound && !iDestinationDropped )
+            {
+            switch ( field )
+                {
+                case EDN_Name:
+                    {
+                    // If more destinations exist with same name then one is kept
+                    TRAPD( err, iDestination.SetNameL( *ptrTag ) );
+                    if( KErrAlreadyExists == err )
+                        {
+                        CLOG_WRITE_FORMAT( 
+                        "Error: Destination exist: %S. It is dropped!", ptrTag )
+                        CLOG_WRITE( "\t \r\n" )
+                        iDestinationDropped = ETrue;
+                        }
+                    else
+                        {
+                        destName = ptrTag->AllocLC();    
+                        }
+                    }
+                break;
+                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 ) )
+                        {
+                        iDestination.SetMetadataL( ESnapMetadataPurpose, 
+                                                   ESnapPurposeUnknown );
+                        }
+                    else if( !ptrTag->Compare( KPurposeInternet ) )
+                        {
+                        iDestination.SetMetadataL( 
+                            ESnapMetadataPurpose, 
+                            ESnapPurposeInternet );
+                        }
+                    else if( !ptrTag->Compare( KPurposeOperator ) )
+                        {
+                        iDestination.SetMetadataL( 
+                            ESnapMetadataPurpose, 
+                            ESnapPurposeOperator );
+                        }
+                    else if( !ptrTag->Compare( KPurposeMMS ) )
+                        {
+                        iDestination.SetMetadataL( 
+                            ESnapMetadataPurpose, 
+                            ESnapPurposeMMS );
+                        }
+                    else if( !ptrTag->Compare( KPurposeIntranet ) )
+                        {
+                        iDestination.SetMetadataL( 
+                            ESnapMetadataPurpose, 
+                            ESnapPurposeIntranet );
+                        }
+                    else
+                        {
+                        //no valid data is given - use default value
+                        iDestination.SetMetadataL( ESnapMetadataPurpose, 
+                                                   ESnapPurposeUnknown );
+                        CLOG_WRITE( "! Error : Invalid Metadata. Default:User Defined");
+                        }
+                    }
+                break;
+                case EDN_Protection:
+                    {
+                    TPtrC16 protPtr = ptrTag->Right( ptrTag->Length() );
+                    TLex16 lex( protPtr );
+                    TUint32 prot( 0 );
+                    if ( lex.Val( prot, EDecimal ) == KErrNone )
+                        {
+                        if( prot <= EProtLevel3 ) // prot is unsigned so no need
+                                                  // to check lower boundary
+                            {
+                            iProtectionLevel = TProtectionLevel( prot );
+                            }
+                        else
+                            {
+                            //no valid data is given - use default value
+                            iProtectionLevel = EProtLevel0;
+                            CLOG_WRITE( "! Error : Invalid Protection level. Default:Level0");
+                            }
+                        }
+                    }
+                break;
+                case EDN_Hidden:
+                    {
+                    if( !ptrTag->Compare( KStrYes ) )
+                        {
+                        iDestination.SetHiddenL( ETrue );
+                        }
+                    else if( !ptrTag->Compare( KStrNo ) )
+                        {
+                        iDestination.SetHiddenL( EFalse );
+                        }
+                    else
+                        {
+                        //no valid data is given - use default value
+                        iDestination.SetHiddenL( EFalse );
+                        CLOG_WRITE( "! Error : Invalid Hidden. Default:No");
+                        }
+                    }
+                break;
+                case EDN_HiddenAgent:
+                    {
+                    if( !ptrTag->Compare( KStrYes ) )
+                        {
+                        iDestination.SetMetadataL( ESnapMetadataHiddenAgent, ETrue );
+                        }
+                    else if( !ptrTag->Compare( KStrNo ) )
+                        {
+                        iDestination.SetMetadataL( ESnapMetadataHiddenAgent, EFalse );
+                        }
+                    else
+                        {
+                        iDestination.SetMetadataL( ESnapMetadataHiddenAgent, EFalse );
+                        //no valid data is given - use default value
+                        CLOG_WRITE( "! Error : Invalid HiddenAgent. Default:No");
+                        }
+                    }
+                break;
+                case EDN_Highlighted:
+                    {
+                    if( !ptrTag->Compare( KStrYes ) )
+                        {
+                        iDestination.SetMetadataL( ESnapMetadataHighlight, ETrue );
+                        }
+                    else if( !ptrTag->Compare( KStrNo ) )
+                        {
+                        iDestination.SetMetadataL( ESnapMetadataHighlight, EFalse );
+                        }
+                    else
+                        {
+                        iDestination.SetMetadataL( ESnapMetadataHighlight, EFalse );
+                        //no valid data is given - use default value
+                        CLOG_WRITE( "! Error : Invalid Highlighted. Default:No");
+                        }
+                    }
+                break;
+                } // switch
+            } // if
+         else if( !iIsFirstRound && !iDestinationDropped )
+            {
+            switch ( field )
+                {
+                case EDN_Name:
+                 {
+                 iDest = FindDestinationL( ptrTag );
+                 if( iDest == NULL )
+                     {
+                     CLOG_WRITE_FORMAT( "Error: Destination not found: %S ", ptrTag )
+                     iDestinationDropped = ETrue;
+                     }
+                 else
+                     {
+                     CLOG_WRITE_FORMAT( "\t Destination name: %S ", ptrTag )
+                     }
+                 }
+                break;
+            case EDN_IAPName:
+                   {
+                   TInt pos;
+                   RCmConnectionMethodExt* plugin = FindPluginL( ptrTag, pos );
+                   if( plugin )
+                        {
+                        TRAPD( err, iDest->AddConnectionMethodL( *plugin ) );
+                        // Set the priority according to the order in which the IAPs are in the XML
+                        TRAPD( err2 ,iDest->ModifyPriorityL( *plugin, priority ));
+                        if ( err2 != KErrNone )
+                        	{
+                        	err2 = KErrNone; // to remove the compiler warnings
+                        	}
+                        
+                        iDest->UpdateL();
+                        priority++;
+                        
+                        if( err == KErrNone )
+                            {
+                            CLOG_WRITE_FORMAT( "\t Added connection method: %S ", ptrTag )
+                            (*iCmInDest)[ pos ] = ETrue;
+                            }
+                        else
+                            {
+                            CLOG_WRITE_FORMAT( 
+                            "Warning connection method could not added: %S ", ptrTag )
+                            }
+                        }
+                     else
+                        {
+                        CLOG_WRITE_FORMAT( 
+                        "Warning: plugin could not added: %S ", ptrTag )
+                        }                       
+                   }
+                break;
+            case EDN_EmbeddedDNName:
+                    {
+                    const RCmDestinationExt* embDestination = FindDestinationL( ptrTag );
+                    if( embDestination )
+                        {
+                    
+                        TRAPD( err, iDest->AddEmbeddedDestinationL( *embDestination ) );
+                    
+                        if( err == KErrNone )
+                            {
+                            CLOG_WRITE_FORMAT( "\t Added embedded destination: %S ", ptrTag )
+                            }
+                        else
+                            {
+                            CLOG_WRITE_FORMAT( 
+                            "Warning embedded destination could not added: %S ", ptrTag )
+                            }
+                        }
+                     else
+                        {
+                        CLOG_WRITE_FORMAT( 
+                        "Warning embedded destination could not added: %S ", ptrTag )
+                        }
+                        
+                    }
+                break;
+            default:
+                {
+                break;
+                }
+              } // switch
+                
+            } // if
+            
+        }//for      
+    
+        if( iIsFirstRound && !iDestinationDropped )
+            {
+            RCmDestinationExt* newItem = new (ELeave) 
+            RCmDestinationExt( iDestination );
+    
+            iDest = newItem;
+
+            iDestArray->Append( newItem );
+            iDestName->Append( destName );
+            CleanupStack::Pop( destName );
+            }        
+    }
+     
+     
+// ---------------------------------------------------------
+// CProcessorDN::ProcessAPL
+// ---------------------------------------------------------
+//
+void CProcessorDN::ProcessAPL()
+    {
+    if( !iDestinationDropped )
+        {
+        if( iDest )
+            {
+            if( iIsFirstRound )
+                {
+                iDest->SetProtectionL( iProtectionLevel );
+                }
+            iDest->UpdateL();
+            
+            if( iIsFirstRound )
+                {
+                DoLogL();
+                }
+            else
+                {
+                CLOG_WRITE( "\t \r\n" )
+                }
+            }
+        }
+    }
+    
+
+// ---------------------------------------------------------
+// CProcessorDN::DoLogL
+// ---------------------------------------------------------
+//
+void CProcessorDN::DoLogL()
+    {
+    HBufC16* tmp;
+
+    tmp = iDestination.NameLC();
+
+    // Writes some data of the destination network into the log file.
+    CLOG_WRITE( "Destination Network created:" )
+    CLOG_WRITE_FORMAT( "\t Destination name: %S ", tmp )
+    TUint32 uid = iDest->Id();
+    CLOG_WRITE_FORMAT( "\t Destination ID: %d", uid );
+
+    CLOG_WRITE( "\t \r\n" )
+
+    CleanupStack::PopAndDestroy( tmp ); // Removes tmp.
+    }
+
+// End of File.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatcreator/Src/cdcprocessorglobal.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,855 @@
+/*
+* Copyright (c) 2004 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 the class CProcessorGlobal
+*
+*/
+
+
+
+
+// INCLUDE FILES
+
+#include "cdclogger.h"
+#include "cdcerrors.h"
+#include "cdctagcontainer.h"
+#include "cdccommon.h"
+#include "cmgenconnsettings.h"
+#include "cdcprocessorglobal.h"
+
+#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include <commsdattypesv1_1.h>
+#else
+#include <commsdattypesv1_1.h>
+#include <commsdattypesv1_1_partner.h>
+#endif
+#include <datamobilitycommsdattypes.h>
+#include <metadatabase.h>
+#include <cmmanagerext.h>
+#include <cmmanager.h>
+#include <cmdestinationext.h>
+#include <cmdefconnvalues.h>
+#include <WlanCdbCols.h>
+#include <wlancontainer.h>
+#include <featmgr.h>
+
+// CONSTANTS
+
+// Global settings record name
+_LIT16( KGlobalSettingsRecordName, "DefaultRecordName-1" );
+
+// Default GPRS record name
+_LIT( KDefaultGPRSRecordName, "Dummy Default GPRS Settings" );
+
+// Modem bearer names for GPRS/WCDMA Access Points
+_LIT( KModemBearerPacketData, "GPRS Modem" );
+
+// LAN bearer names for Wlan Access Points
+_LIT( KLANBearerWlan, "WLANBearer" );
+
+
+// Structure that converts field ids to the corresponding table names
+// and parameter types
+typedef struct
+    {
+    TDbCreatorGlobalSettings iField;
+    const TText* iBearerTableName;
+    TBool iIsUIPriority;
+    } TPriorityConversion;
+
+const TPriorityConversion KPriorityConversionTable[] =
+    {
+        { EPriorityLan, KCDTypeNameLANService, EFalse },
+        { EPriorityWlan, KCDTypeNameWLANServiceExt, EFalse },
+        { EPriorityPan, KCDTypeNamePANServiceExt, EFalse },
+        { EPriorityGprsIn, KCDTypeNameOutgoingWCDMA, EFalse },
+        { EPriorityGprsOut, KCDTypeNameIncomingWCDMA, EFalse },
+        { EPriorityDialOut, KCDTypeNameDialOutISP, EFalse },
+        { EPriorityDialIn, KCDTypeNameDialInISP, EFalse },
+        { EPriorityVpn, KCDTypeNameVPNService, EFalse },
+        { EPriorityMip, KCDTypeNameMIPServiceExt, EFalse },
+        { EUIPriorityLan, KCDTypeNameLANService, ETrue },
+        { EUIPriorityWlan, KCDTypeNameWLANServiceExt, ETrue },
+        { EUIPriorityPan, KCDTypeNamePANServiceExt, ETrue },
+        { EUIPriorityGprsIn, KCDTypeNameOutgoingWCDMA, ETrue },
+        { EUIPriorityGprsOut, KCDTypeNameIncomingWCDMA, ETrue },
+        { EUIPriorityDialOut, KCDTypeNameDialOutISP, ETrue },
+        { EUIPriorityDialIn, KCDTypeNameDialInISP, ETrue },
+        { EUIPriorityVpn, KCDTypeNameVPNService, ETrue },
+        { EUIPriorityMip, KCDTypeNameMIPServiceExt, ETrue },
+        { EUnused, NULL, EFalse }
+    };
+
+
+// Maximum size to be allocated for table names
+const TUint KMaxTableNameSize = 50;
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CProcessorGlobal::NewL
+// ---------------------------------------------------------
+//
+CProcessorGlobal* CProcessorGlobal::NewL( 
+                          CReaderBase* aFileReader,
+                          RCmManagerExt& aCmManager,
+                          RPointerArray< RCmConnectionMethodExt >& aPluginArray,
+                          RPointerArray< HBufC >& aPluginNames, 
+                          RPointerArray< RCmDestinationExt >& aDestArray,
+                          RPointerArray< HBufC >& aDestNames,
+                          RPointerArray< HBufC >& aDefCon )
+    {
+    CProcessorGlobal* self = new ( ELeave ) CProcessorGlobal( aFileReader,
+                                                              aCmManager,
+                                                              aPluginArray,
+                                                              aPluginNames,
+                                                              aDestArray,
+                                                              aDestNames,
+                                                              aDefCon );
+    CleanupStack::PushL( self );
+
+    // From base class
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    
+    return self;
+    }
+
+// ---------------------------------------------------------
+// CProcessorGlobal::CProcessorGlobal
+// ---------------------------------------------------------
+//
+CProcessorGlobal::CProcessorGlobal( CReaderBase* aFileReader,
+                                    RCmManagerExt& aCmManager,
+                                    RPointerArray< RCmConnectionMethodExt >& aPluginArray,
+                                    RPointerArray< HBufC >& aPluginNames, 
+                                    RPointerArray< RCmDestinationExt >& aDestArray,
+                                    RPointerArray< HBufC >& aDestNames,
+                                    RPointerArray< HBufC >& aDefCon ) :
+    CProcessorBase( aFileReader, aCmManager, aPluginArray, aPluginNames, aDestArray, aDestNames ),
+    iAttachWhenNeeded ( EFalse )
+    {
+    iDefCon = &aDefCon;
+    }
+    
+    
+// ---------------------------------------------------------
+// CProcessorGlobal::ConstructL
+// ---------------------------------------------------------
+//
+void CProcessorGlobal::ConstructL()
+    {
+    iSession = CMDBSession::NewL( CMDBSession::LatestVersion() );
+    
+    iSession->SetAttributeMask( ECDNoWriteButDelete | ECDHidden | ECDProtectedWrite | ECDPrivate ); // Check this
+    
+    // Create General connection settings struct and set the default values
+    iGenConnSettings = new (ELeave) TCmGenConnSettings;
+    iGenConnSettings->iUsageOfWlan = ECmUsageOfWlanKnown;
+    iGenConnSettings->iSeamlessnessHome = ECmSeamlessnessConfirmFirst;
+    iGenConnSettings->iSeamlessnessVisitor = ECmSeamlessnessConfirmFirst;
+
+    CLOG_WRITE( "Initialising FeatureManager\n" )   
+    //checks if Wlan feature is supported
+    FeatureManager::InitializeLibL();
+    iIsWlanS = FeatureManager::FeatureSupported( KFeatureIdProtocolWlan );
+    FeatureManager::UnInitializeLib();
+    CLOG_WRITE( "FeatureManager closed\n" ) 
+    }
+
+
+// ---------------------------------------------------------
+// CProcessorGlobal::~CProcessorGlobal
+// ---------------------------------------------------------
+//
+CProcessorGlobal::~CProcessorGlobal()
+    {
+    if ( iSession )
+        {
+        iSession->Close();
+        delete iSession; 
+        }
+    delete iGenConnSettings;    
+    }
+     
+// ---------------------------------------------------------
+// CProcessorGlobal::ProcessTagL
+// ---------------------------------------------------------
+//
+void CProcessorGlobal::ProcessTagL( TBool /*aFieldIDPresent*/ )
+    {
+    for (TInt idx(0); idx < TagContainer().Count(); idx++)
+        {  
+        TDbCreatorGlobalSettings fieldId;
+        
+        fieldId = static_cast< TDbCreatorGlobalSettings >
+        ( TagContainer().FieldId( idx ) );
+        
+        HBufC16* ptrTag = TagContainer().Tag(idx);
+        
+        switch( fieldId )
+            {
+            case EGPRSAttachMode:
+                {
+                _LIT( KAttachWhenNeeded, "whenneeded" );
+                _LIT( KAttachWhenAvailable, "whenavailable" );
+                
+                if ( !ptrTag->CompareF( KAttachWhenNeeded ) )
+                    {
+                    iAttachWhenNeeded = ETrue;
+                    }
+                else if ( !ptrTag->CompareF( KAttachWhenAvailable ) )
+                    {
+                    iAttachWhenNeeded = EFalse;
+                    }
+                else 
+                    {
+                    iAttachWhenNeeded = EFalse;
+                    CLOG_WRITE( "! Error : invalid attach mode. Default:whenavailable" );
+                    }
+
+                break;
+                }
+                
+            case EDefaultAP:
+                {
+                CMDBSession* db = CMDBSession::NewL( CMDBSession::LatestVersion() );
+                CleanupStack::PushL( db );
+                
+                CCDDefaultWCDMARecord* defaultGPRS = static_cast< CCDDefaultWCDMARecord* >
+                        ( CCDRecordBase::RecordFactoryL( KCDTIdDefaultWCDMARecord ) );
+                
+                CleanupStack::PushL( defaultGPRS );
+                
+                defaultGPRS->iRecordName.SetL( KDefaultGPRSRecordName );
+                
+                defaultGPRS->FindL( *db );			    
+                
+                defaultGPRS->iAPN.SetL( *ptrTag );
+                
+                defaultGPRS->ModifyL( *db );				    				    				   
+                
+                CleanupStack::PopAndDestroy( defaultGPRS );
+                
+                db->Close();			    			    
+                CleanupStack::PopAndDestroy( db );
+                break;
+                }
+                
+            case EDefaultDnIcon:
+                {
+                // Convert default icon to int
+                TPtrC16 iconPtr = ptrTag->Right( ptrTag->Length() );
+                TLex16 lex( iconPtr );
+                TUint32 icon( 0 );
+                if ( lex.Val( icon, EDecimal ) == KErrNone )
+                    {
+                    // If there was no error, write default entry to SNAP
+                    // Metadata table.
+                    // First load SNAP table to get table id
+                    CMDBGenericRecord* snapTable = static_cast< CMDBGenericRecord* >
+                            ( CCDRecordBase::RecordFactoryL( 0 ) );
+                    CleanupStack::PushL( snapTable );      
+                    snapTable->InitializeL( TPtrC( KCDTypeNameSNAPMetadata ),
+                            NULL );
+                    snapTable->LoadL( *iSession );
+                    // Then add default record to table
+                    CCDSNAPMetadataRecord* defaultRecord = new( ELeave )
+                            CCDSNAPMetadataRecord( snapTable->TableId() );
+                    CleanupStack::PushL( defaultRecord );
+                    defaultRecord->SetRecordId( KCDNewRecordRequest );
+                    defaultRecord->iMetadata.SetL( 0 );
+                    defaultRecord->iIcon.SetL( icon );
+                    defaultRecord->StoreL( *iSession );
+                    
+                    CleanupStack::PopAndDestroy( defaultRecord ); // defaultRecord
+                    CleanupStack::PopAndDestroy( snapTable ); // snapTable
+                    }
+                break;
+                }
+                
+            case EPriorityLan:
+            case EPriorityWlan:
+            case EPriorityPan:
+            case EPriorityGprsIn:
+            case EPriorityGprsOut:
+            case EPriorityDialOut:
+            case EPriorityDialIn:
+            case EPriorityVpn:
+            case EPriorityMip:
+            case EUIPriorityLan:
+            case EUIPriorityWlan:
+            case EUIPriorityPan:
+            case EUIPriorityGprsIn:
+            case EUIPriorityGprsOut:
+            case EUIPriorityDialOut:
+            case EUIPriorityDialIn:
+            case EUIPriorityVpn:
+            case EUIPriorityMip:
+                {
+                // Convert priority to int
+                TPtrC16 prioPtr = ptrTag->Right( ptrTag->Length() );
+                TLex16 lex( prioPtr );
+                TUint32 prio( 0 );
+                if ( lex.Val( prio, EDecimal ) == KErrNone )
+                    {
+                    UpdateGlobalBearerArrayL( fieldId, prio );
+                    }
+                break;
+                }
+                
+            case EDefaultConnectionType:
+                {
+                iDefCon->Append( ptrTag->AllocL() );
+                //SetDefaultConnectionTypeL( ptrTag )
+                break;
+                }
+                
+            case EDefaultConnectionName:
+                {
+                iDefCon->Append( ptrTag->AllocL() );
+                //SetDefaultConnectionNameL( ptrTag )
+                break;
+                }
+                
+            case EGprsLastSocketActivityTimeout:
+            case EGprsLastSessionClosedTimeout:
+            case EGprsLastSocketClosedTimeout:		
+                {            				    
+                // Load modem bearer record
+                CCDModemBearerRecord* bearerRecord = static_cast< CCDModemBearerRecord * >
+                ( CCDRecordBase::RecordFactoryL( KCDTIdModemBearerRecord ) );
+                CleanupStack::PushL( bearerRecord );
+                
+                if( fieldId == EGprsLastSocketActivityTimeout
+                        || fieldId == EGprsLastSessionClosedTimeout
+                        || fieldId == EGprsLastSocketClosedTimeout )
+                    {
+                    // Open the record "Gprs Modem"
+                    bearerRecord->iRecordName.SetL( KModemBearerPacketData );	
+                    }				
+                
+                bearerRecord->FindL( *iSession ); // CHECK: Leaves if record not found				
+                
+                // Convert input parameter
+                TLex lex( *ptrTag );
+                
+                TInt timeout( 0 );
+                
+                // If there are parameters that cannot be handled just leave. In that case the CommsDat creation
+                // fails and default is used instead. So it is easier for the variant engineer to detect
+                // that something went wrong.
+                if ( lex.Val( timeout ) != KErrNone)
+                    {
+                    CLOG_WRITE( "! Error : invalid NIF parameter for GPRS (socket/session timeout)" );					
+                    User::Leave( KErrArgument );
+                    }
+                
+                // Set the parameter	
+                if( fieldId == EGprsLastSocketActivityTimeout )
+                    {
+                    bearerRecord->iLastSocketActivityTimeout.SetL( timeout );
+                    }
+                else if( fieldId == EGprsLastSessionClosedTimeout )
+                    {
+                    bearerRecord->iLastSessionClosedTimeout.SetL( timeout );
+                    }
+                else
+                    {
+                    bearerRecord->iLastSocketClosedTimeout.SetL( timeout );
+                    }
+                
+                bearerRecord->ModifyL( *iSession );
+                
+                CleanupStack::PopAndDestroy( bearerRecord );
+                
+                break;
+                }
+                
+            case EWlanLastSocketActivityTimeout:
+            case EWlanLastSessionClosedTimeout:
+            case EWlanLastSocketClosedTimeout:            
+                {
+                if( iIsWlanS )
+                    {
+                    // Load LAN bearer record
+                    CCDLANBearerRecord* bearerRecord = static_cast< CCDLANBearerRecord * >
+                    ( CCDRecordBase::RecordFactoryL( KCDTIdLANBearerRecord ) );
+                    CleanupStack::PushL( bearerRecord );
+                    
+                    // Open the record "WlanBearer"
+                    bearerRecord->iRecordName.SetL( KLANBearerWlan );	
+                    
+                    User::LeaveIfError( bearerRecord->FindL( *iSession ) );
+                    
+                    // Convert the input paramater to UINT
+                    TLex lex( *ptrTag );
+                    
+                    TInt timeout( 0 );
+                    
+                    // If there are parameters that cannot be handled just leave. In that case the CommsDat creation
+                    // fails and default is used instead. So it is easier for the variant engineer to detect
+                    // that something went wrong.
+                    if ( lex.Val( timeout ) != KErrNone)
+                        {
+                        CLOG_WRITE( "! Error : invalid NIF parameter for WLAN (socket/session timeout)" );					
+                        User::Leave( KErrArgument );
+                        }
+                    
+                    
+                    // Set the paramter
+                    if( fieldId == EWlanLastSocketActivityTimeout )
+                        {				
+                        bearerRecord->iLastSocketActivityTimeout.SetL( timeout );
+                        }
+                    else if( fieldId == EWlanLastSessionClosedTimeout)
+                        {					
+                        bearerRecord->iLastSessionClosedTimeout.SetL( timeout );
+                        }
+                    else
+                        {					
+                        bearerRecord->iLastSocketClosedTimeout.SetL( timeout );
+                        }
+                    
+                    bearerRecord->ModifyL( *iSession );				
+                    CleanupStack::PopAndDestroy( bearerRecord );
+                    }
+                break;
+                }
+                
+            case EWlanBGScanInterval:
+            case EWlanUseDefSettings:
+            case EWlanLongRetry:
+            case EWlanShortRetry:
+            case EWlanRTS:
+            case EWlanTxPowerLevel:
+            case EWlanRadioMeasurements:
+            case EWlanPowerMode:
+                {
+                if( iIsWlanS )
+                    {
+                    // Save the same value both to default and user settings records
+                    TInt err;
+                    TRAP( err, SaveGlobalWlanParameterL( KWlanDefaultSettings, fieldId, ptrTag ) );
+                    if( err != KErrNone )
+                        {
+                        CLOG_WRITE( "! Error : Could not save global WLAN parameter. Incorrect input?" );
+                        User::Leave( err  );
+                        }
+                    TRAP( err, SaveGlobalWlanParameterL( KWlanUserSettings, fieldId, ptrTag ) );
+                    if( err != KErrNone )
+                        {
+                        CLOG_WRITE( "! Error : Could not save global WLAN parameter. Incorrect input?" );
+                        User::Leave( err );
+                        }
+                    }
+                break;
+                }
+                
+            case EUsageOfWlan:
+                {
+                SetGenConnSettingWlanUsage( ptrTag );
+                break;
+                }
+                
+            case ESeamlessnessHome:
+                {
+                SetGenConnSettingSeamlessnessHome( ptrTag );
+                break;
+                }
+                
+            case ESeamlessnessVisitor:
+                {
+                SetGenConnSettingSeamlessnessVisitor( ptrTag );
+                break;
+                }
+                
+            default:
+                break;
+            }
+        }
+    
+    if( iBearerArrayChanged )
+        {
+        
+        CLOG_WRITE( "UpdateBearerPriorityArrayL\n" )
+        
+        iCmManager->UpdateBearerPriorityArrayL( iBearerArray );
+        iCmManager->CleanupGlobalPriorityArray( iBearerArray );
+        
+        iBearerArray.Close();
+        
+        CLOG_WRITE( "UpdateBearerPriorityArrayL end\n" )
+        }
+    
+    // General Connection settings are always set
+    SetGenConnSettingsL();
+    }
+
+// ---------------------------------------------------------
+// CProcessorGlobal::ProcessAPL
+// ---------------------------------------------------------
+//
+void CProcessorGlobal::ProcessAPL()
+    {
+    CMDBSession* db = CMDBSession::NewL( CMDBSession::LatestVersion() );
+    CleanupStack::PushL( db );
+                    
+    CLOG_WRITE( "Global settings\n" )
+    CLOG_WRITE( "---------------\n" )
+        
+    CCDGlobalSettingsRecord* globalSettings = static_cast< CCDGlobalSettingsRecord* >
+                        ( CCDRecordBase::RecordFactoryL( KCDTIdGlobalSettingsRecord ) );
+                        
+	CleanupStack::PushL( globalSettings );
+                        
+    globalSettings->iRecordName.SetL( KGlobalSettingsRecordName );
+
+    if( globalSettings->FindL( *db ) )
+        {
+        //Gprs attach mode
+        if ( iAttachWhenNeeded )
+            {
+            CLOG_WRITE( "GPRS attach mode : attach when needed\n" )
+            globalSettings->iGPRSAttachMode = RPacketService::EAttachWhenNeeded;
+            }
+        else
+            {
+            CLOG_WRITE( "GPRS attach mode : attach when available\n" )
+            globalSettings->iGPRSAttachMode = RPacketService::EAttachWhenPossible;
+            }
+        }
+        
+    globalSettings->ModifyL( *db );
+    
+    CleanupStack::PopAndDestroy( globalSettings );    
+    db->Close();
+    CleanupStack::PopAndDestroy( db ); // db
+    }
+    
+
+// ---------------------------------------------------------
+// CProcessorGlobal::UpdateGlobalBearerArrayL
+// ---------------------------------------------------------
+//
+void CProcessorGlobal::UpdateGlobalBearerArrayL
+                            ( TDbCreatorGlobalSettings aField, TUint32 aPrio )
+    {
+    TUint itemIndex( 0 );
+    
+    // Look up field from conversion table
+    while( EUnused != KPriorityConversionTable[ itemIndex ].iField )
+        {
+        if( KPriorityConversionTable[ itemIndex ].iField == aField)
+            {
+            break;
+            }
+        ++itemIndex;
+        }
+        
+    // If found
+    if( EUnused != KPriorityConversionTable[ itemIndex ].iField )
+        {
+        if( !iBearerArrayChanged )
+            {
+            iCmManager->BearerPriorityArrayL( iBearerArray );
+            iBearerArrayChanged = ETrue;
+            }
+        
+        
+        HBufC* tableName = HBufC::NewLC( KMaxTableNameSize );
+        *tableName = TPtrC( KPriorityConversionTable[ itemIndex ]
+                                                        .iBearerTableName );
+        TBool foundBearer( EFalse );
+        
+        // Find the appropriate bearer type
+        for( TInt i( 0 ); i < iBearerArray.Count(); ++i )
+            {
+            if( !( ( iBearerArray )[ i ].iServiceType->Compare( *tableName ) ) )
+                {
+                if( KPriorityConversionTable[ itemIndex ].iIsUIPriority )
+                    {
+                    ( iBearerArray )[ i ].iUIPriority = aPrio;
+                    }
+                else
+                    {
+                    ( iBearerArray )[ i ].iPriority = aPrio;
+                    }
+                foundBearer = ETrue;
+                break;
+                }
+            }
+        
+        // If bearer was not found, add it to the table
+        if( !foundBearer )
+            {
+            TBearerPriority newBearer;
+            newBearer.iServiceType = tableName;
+            if( KPriorityConversionTable[ itemIndex ].iIsUIPriority )
+                {
+                newBearer.iUIPriority = aPrio;
+                }
+            else
+                {
+                newBearer.iPriority = aPrio;
+                }
+            iBearerArray.Append( newBearer );
+            }
+
+        CleanupStack::PopAndDestroy( tableName ); // tableName 
+        }
+    }
+
+// ---------------------------------------------------------
+// CProcessorGlobal::SetDefaultConnectionL
+// ---------------------------------------------------------
+//
+void CProcessorGlobal::SetDefaultConnectionL()
+    {
+    if( iDefCon->Count() > 0 )
+        {
+        SetDefaultConnectionTypeL( (*iDefCon)[0] );
+        }
+    if( iDefCon->Count() > 1 )
+        {
+        SetDefaultConnectionNameL( (*iDefCon)[1] );
+        }
+    }
+
+// ---------------------------------------------------------
+// CProcessorGlobal::SetDefaultConnectionTypeL
+// ---------------------------------------------------------
+//
+void CProcessorGlobal::SetDefaultConnectionTypeL( HBufC16* aPtrTag )
+    {
+    iDefaultConnectionSet = EFalse;
+    
+    if ( aPtrTag->CompareF( KStrAlwaysAsk ) == 0 ) 
+        {
+        iDefaultConnectionType = ECmDefConnAlwaysAsk;
+        SetDefConnRecordL( 0 );
+        }
+    else if ( aPtrTag->CompareF( KStrAskOnce ) == 0 ) 
+        {
+        iDefaultConnectionType = ECmDefConnAskOnce;
+        SetDefConnRecordL( 0 );
+        }
+    else if ( aPtrTag->CompareF( KStrDestination ) == 0 ) 
+        {
+        iDefaultConnectionType = ECmDefConnDestination;
+        }
+    else if ( aPtrTag->CompareF( KStrConnectionMethod ) == 0 ) 
+        {
+        iDefaultConnectionType = ECmDefConnConnectionMethod;
+        }
+    else
+        {
+        CLOG_WRITE(
+        "Warning: Default connection type is not valid. Always ask is set.")
+        iDefaultConnectionType = ECmDefConnAlwaysAsk;
+        SetDefConnRecordL( 0 );
+        }    
+    }
+
+// ---------------------------------------------------------
+// CProcessorGlobal::SetDefaultConnectionNameL
+// ---------------------------------------------------------
+//
+void CProcessorGlobal::SetDefaultConnectionNameL( HBufC16* aPtrTag )
+    {
+        
+    // Name is ignored if the defconn has been set. It can happen e.g.
+    // if iDefaultConnectionType is ECmDefConnAlwaysAsk or ECmDefConnAskOnce     
+    if ( iDefaultConnectionSet )
+        {
+        return;
+        }
+        
+    TInt uId = KErrNotFound;
+    if ( iDefaultConnectionType == ECmDefConnDestination )
+        {
+        uId = GetDestinationIdL( aPtrTag );
+        }
+    else if ( iDefaultConnectionType == ECmDefConnConnectionMethod )
+        {
+        uId = GetPluginIdL( aPtrTag );
+        }
+        
+    if( uId != KErrNotFound )
+        {
+        SetDefConnRecordL( uId );
+        }
+    }
+
+// ---------------------------------------------------------
+// CProcessorGlobal::SetGenConnSettingWlanUsage
+// ---------------------------------------------------------
+//
+void CProcessorGlobal::SetGenConnSettingWlanUsage( HBufC16* aPtrTag )
+    {
+    // This parameter should't be set at all if WLAN isn't supported.
+    // However, CMM should take care of this in WriteGenConnSettingsL().
+    if ( aPtrTag->CompareF( KStrManual ) == 0 ) 
+        {
+        iGenConnSettings->iUsageOfWlan = ECmUsageOfWlanManual;
+        }
+    // else: Default value for the string is: "Known", set in ConstructL()
+    }
+
+// ---------------------------------------------------------
+// CProcessorGlobal::SetGenConnSettingSeamlessnessHome
+// ---------------------------------------------------------
+//
+void CProcessorGlobal::SetGenConnSettingSeamlessnessHome( HBufC16* aPtrTag )
+    {
+    if ( aPtrTag->CompareF( KStrAutomatic ) == 0 ) 
+        {
+        iGenConnSettings->iSeamlessnessHome = ECmSeamlessnessShowprogress;
+        }
+    else if ( iIsWlanS && aPtrTag->CompareF( KStrWlanOnly ) == 0 ) 
+        {
+        // This value can't be set if WLAN isn't supported
+        iGenConnSettings->iSeamlessnessHome = ECmSeamlessnessDisabled;
+        }
+    // else: Default value for the string is: "Confirm", set in ConstructL()
+    }
+
+// ---------------------------------------------------------
+// CProcessorGlobal::SetGenConnSettingSeamlessnessVisitor
+// ---------------------------------------------------------
+//
+void CProcessorGlobal::SetGenConnSettingSeamlessnessVisitor( HBufC16* aPtrTag )
+    {
+    if ( aPtrTag->CompareF( KStrAutomatic ) == 0 ) 
+        {
+        iGenConnSettings->iSeamlessnessVisitor = ECmSeamlessnessShowprogress;
+        }
+    else if ( iIsWlanS && aPtrTag->CompareF( KStrWlanOnly ) == 0 ) 
+        {
+        // This value can't be set if WLAN isn't supported
+        iGenConnSettings->iSeamlessnessVisitor = ECmSeamlessnessDisabled;
+        }
+    // else: Default value for the string is: "Confirm", set in ConstructL()
+    }
+
+// ---------------------------------------------------------
+// CProcessorGlobal::SetGenConnSettingsL
+// ---------------------------------------------------------
+//
+void CProcessorGlobal::SetGenConnSettingsL()
+    {
+    RCmManager cmManager;
+    cmManager.CreateTablesAndOpenL();
+    CleanupClosePushL( cmManager );
+    cmManager.WriteGenConnSettingsL( *iGenConnSettings );
+    CleanupStack::PopAndDestroy( &cmManager );
+    }
+
+//-----------------------------------------------------------------------------
+//  CProcessorGlobal::SetDefConnRecordL()
+//-----------------------------------------------------------------------------
+//
+void CProcessorGlobal::SetDefConnRecordL( const TInt aId )
+    {
+
+    TCmDefConnValue value;
+    value.iType = iDefaultConnectionType;
+    value.iId = aId;
+    
+    iCmManager->WriteDefConnL( value );
+    
+    // It gets true if the defconn was set correctly
+    iDefaultConnectionSet = ETrue;
+
+    }
+    
+
+//-----------------------------------------------------------------------------
+//  CProcessorGlobal::SaveGlobalWlanParameterL()
+//-----------------------------------------------------------------------------
+//
+void CProcessorGlobal::SaveGlobalWlanParameterL( const TUint32 aTableType, const TDbCreatorGlobalSettings aField, const HBufC16* const aValue )
+	{	
+		// Initialize the record
+		CMDBGenericRecord* deviceSettingsTable = static_cast< CMDBGenericRecord* >
+                ( CCDRecordBase::RecordFactoryL( 0 ) );
+                
+	    CleanupStack::PushL( deviceSettingsTable );
+	    
+	    deviceSettingsTable->InitializeL( TPtrC( WLAN_DEVICE_SETTINGS ), NULL );
+	    			   			    
+	    deviceSettingsTable->LoadL( *iSession );
+	    
+	    // Open the record that matches aTableType (either default or user settings table)
+	    
+	    CMDBField<TUint32>* settingsTypeField = (CMDBField<TUint32>*)deviceSettingsTable->GetFieldByIdL(KCDTIdWlanDeviceSettingsType);
+	    
+	   	settingsTypeField->SetL( aTableType );
+	    			   			    
+	    deviceSettingsTable->FindL( *iSession );
+	    
+	    // Convert the input parameter to integer
+    	TLex lex( *aValue );
+		
+		TUint value( 0 );
+		
+		User::LeaveIfError( lex.Val( value, EDecimal) );
+		
+		// Set the paramter value
+	    
+	    if ( aField == EWlanBGScanInterval )
+	    	{
+	    	CMDBField< TUint32 >* field = ( CMDBField< TUint32 >* ) deviceSettingsTable->GetFieldByIdL( KCDTIdBgScanInterval );
+	    	field->SetL( value );
+	    	}
+	    else if ( aField == EWlanUseDefSettings )
+	    	{
+	    	CMDBField< TBool >* field = ( CMDBField< TBool >* ) deviceSettingsTable->GetFieldByIdL( KCDTIdUseDefaultSettings );	
+	    	field->SetL( value );
+	    	}
+	    else if ( aField == EWlanLongRetry )
+	    	{
+			CMDBField< TUint32 >* field = ( CMDBField< TUint32 >* ) deviceSettingsTable->GetFieldByIdL( KCDTIdWlanLongRetry );				    	
+			field->SetL( value );
+	    	}
+	    else if ( aField == EWlanShortRetry )
+	    	{
+	    	CMDBField< TUint32 >* field = ( CMDBField< TUint32 >* ) deviceSettingsTable->GetFieldByIdL( KCDTIdWlanShortRetry );	
+	    	field->SetL( value );
+	    	}
+	    else if ( aField == EWlanRTS )
+	    	{
+	    	CMDBField< TUint32 >* field = ( CMDBField< TUint32 >* ) deviceSettingsTable->GetFieldByIdL( KCDTIdWlanRTSThreshold );	
+	    	field->SetL( value );
+	    	}
+	    else if ( aField == EWlanTxPowerLevel )
+	    	{
+	    	CMDBField< TUint32 >* field = ( CMDBField< TUint32 >* ) deviceSettingsTable->GetFieldByIdL( KCDTIdTxPowerLevel );	
+	    	field->SetL( value );
+	    	}
+	    else if ( aField == EWlanRadioMeasurements )
+	    	{
+	    	CMDBField< TBool >* field = ( CMDBField< TBool >* ) deviceSettingsTable->GetFieldByIdL( KCDTIdAllowRadioMeasurements );	
+	    	field->SetL( value );
+	    	}
+	    else if ( aField == EWlanPowerMode )
+	    	{
+	    	CMDBField< TBool >* field = ( CMDBField< TBool >* ) deviceSettingsTable->GetFieldByIdL( KCDTIdWlanPowerMode );	
+	    	field->SetL( value );
+	    	}			    			    			      			
+
+		deviceSettingsTable->ModifyL( *iSession );
+				
+		CleanupStack::PopAndDestroy( deviceSettingsTable );				
+	}
+// End of File.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatcreator/Src/cdcprocessorlan.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,264 @@
+/*
+* 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:   Implementation of the class CProcessorLan
+*
+*/
+
+
+
+
+// INCLUDE FILES
+
+#include "cdcprocessorlan.h"
+#include "cdclogger.h"
+#include "cdctagcontainer.h"
+
+#include <cmpluginlandef.h>
+#include <cmpluginlanbasedef.h>
+#include <cmpluginbaseeng.h>
+#include <cmconnectionmethoddef.h>
+#include <cmmanagerext.h>
+#include <datamobilitycommsdattypes.h>
+
+using namespace CMManager;
+
+// CONSTANTS
+
+const TUint32 KDefaultPortNum = 80;
+
+// These constants are used to identify tags of iInFile.
+
+//Connection type
+_LIT16( KStrContinuous,      "Continuous" );
+_LIT16( KStrTemporary,       "Temporary" );
+
+_LIT16( KStrTrue,               "True" );
+_LIT16( KStrFalse,              "False" );
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CProcessorLan::NewL
+// ---------------------------------------------------------
+//
+CProcessorLan* CProcessorLan::NewL( CReaderBase* aFileReader,
+                      RCmManagerExt& aCmManager,
+                      RPointerArray< RCmConnectionMethodExt >& aPluginArray,
+                      RPointerArray< HBufC >& aPluginNames )
+    {
+    CProcessorLan* self = new ( ELeave ) CProcessorLan( aFileReader,
+                                                        aCmManager,
+                                                        aPluginArray,
+                                                        aPluginNames );
+    CleanupStack::PushL( self );
+
+    // From base class
+    self->ConstructL();
+    CleanupStack::Pop( self ); // self
+    return self;
+    }
+    
+    
+// ---------------------------------------------------------
+// CProcessorLan::~CProcessorLan
+// ---------------------------------------------------------
+//
+CProcessorLan::~CProcessorLan()
+    {
+    }
+     
+     
+// ---------------------------------------------------------
+// CProcessorLan::ConstructL
+// ---------------------------------------------------------
+//
+void CProcessorLan::ConstructL()
+    {
+    }
+
+
+// ---------------------------------------------------------
+// CProcessorLan::CProcessorLan
+// ---------------------------------------------------------
+//
+CProcessorLan::CProcessorLan( CReaderBase* aFileReader,
+                      RCmManagerExt& aCmManager,
+                      RPointerArray< RCmConnectionMethodExt >& aPluginArray,
+                      RPointerArray< HBufC >& aPluginNames) :
+                              CProcessorBase( aFileReader,
+                                              aCmManager,
+                                              aPluginArray,
+                                              aPluginNames )
+    {
+    iBearerType = KUidLanBearerType;
+    }
+
+
+// ---------------------------------------------------------
+// CProcessorLan::ProcessTagL
+// ---------------------------------------------------------
+//
+void CProcessorLan::ProcessSpecialFieldsL( TInt aField, HBufC* aPtrTag, TInt /*aDx*/ )
+    {
+    switch ( aField )
+        {
+        case ECmWapIPGatewayAddress:
+            {
+             // Unicode 16-bit text
+            if ( aPtrTag->Length() )
+                {
+                iPlugin.SetStringAttributeL( aField, *aPtrTag );
+                }
+
+            break;
+            }
+        case ECmWapIPSecurity:
+            {
+             // TBool                
+            if ( !aPtrTag->CompareF( KStrOn ) )
+                {
+                iPlugin.SetBoolAttributeL( aField, ETrue );
+                }
+            else if ( !aPtrTag->CompareF( KStrOff ) )
+                {
+                iPlugin.SetBoolAttributeL( aField, EFalse );
+                }
+            else
+                {
+                //no valid data is given - default data is used
+                iPlugin.SetBoolAttributeL( aField, ETrue );
+                CLOG_WRITE( "! Error : Invalid WTLS security setting. Default:On");
+                }
+
+            break;
+            }
+        case ELanIpAddrFromServer:
+        case ELanIpDNSAddrFromServer:
+            {
+             // TBool                
+            if ( !aPtrTag->CompareF( KStrTrue ) )
+                {
+                iPlugin.SetBoolAttributeL( aField, ETrue );
+                }
+            else if ( !aPtrTag->CompareF( KStrFalse ) )
+                {
+                iPlugin.SetBoolAttributeL( aField, EFalse );
+                }
+            else
+                {
+                //no valid data is given - default data is used
+                iPlugin.SetBoolAttributeL( aField, ETrue );
+                CLOG_WRITE( "! Error : Invalid LAN server setting. Default:On");
+                }
+            break;
+            }
+        case ECmWapIPWSPOption:
+            {
+            // UInt                
+            if ( !aPtrTag->CompareF( KStrContinuous ) )
+                {
+                iPlugin.SetIntAttributeL( aField, 
+                                  EWapWspOptionConnectionOriented );
+                }
+            else if ( !aPtrTag->CompareF( KStrTemporary ) )
+                {
+                iPlugin.SetIntAttributeL( aField, 
+                                  EWapWspOptionConnectionless );
+                }
+            else
+                {
+                //no valid data is given - default data is used
+                iPlugin.SetIntAttributeL( aField, 
+                                  EWapWspOptionConnectionOriented );
+                CLOG_WRITE( "! Error : Invalid connection type. Default:Continuous");
+                }
+
+            break;
+            }
+        case ECmProxyProtocolName:
+        	{
+        	// Do not enable proxy in this case yet
+        	iPlugin.SetStringAttributeL( aField, *aPtrTag );
+        	break;
+        	}
+            
+        case ECmProxyServerName:
+            {
+            // First set proxy usage to enabled
+            if( !iProxyEnabled )
+                {
+                iPlugin.SetBoolAttributeL( ECmProxyUsageEnabled, ETrue );
+                iProxyEnabled = ETrue;
+                }
+            // Long text
+            iPlugin.SetStringAttributeL( aField, *aPtrTag );
+            break;
+            }
+        case ECmProxyPortNumber:
+            {
+            // First set proxy usage to enabled
+            if( !iProxyEnabled )
+                {
+                iPlugin.SetBoolAttributeL( ECmProxyUsageEnabled, ETrue );
+                iProxyEnabled = ETrue;
+                }
+             // TUint32 and should be read as text.
+            TPtrC16 portptr = aPtrTag->Right( aPtrTag->Length() );
+            TLex16 lex( portptr );
+            TUint32 portnum( 0 );
+            if ( lex.Val( portnum, EDecimal ) == KErrNone )
+                {
+                iPlugin.SetIntAttributeL( aField, portnum );
+                }
+            else 
+                {
+                //no valid data is given - default value is used
+                iPlugin.SetIntAttributeL( aField, KDefaultPortNum );
+                CLOG_WRITE( "! Error : Invalid port number. Default:80");  
+                }
+            break;
+            }
+        case ELanIfNetworks:
+        case ELanIpNetMask:
+        case ELanIpGateway:
+        case ELanIpAddr:
+        case ELanConfigDaemonManagerName:
+        case ELanConfigDaemonName:
+            {
+            iPlugin.SetStringAttributeL( aField, *aPtrTag );
+            break;
+            }
+        case ELanIpNameServer1:
+        case ELanIpNameServer2:
+        case ELanIp6NameServer1:
+        case ELanIp6NameServer2:
+            {
+            iPlugin.SetStringAttributeL( aField, *aPtrTag );
+            SetAddressFromServerL( ELanIpNameServer1,
+                                  ELanIpNameServer2,
+                                  ELanIpDNSAddrFromServer,
+                                  ELanIp6NameServer1,
+                                  ELanIp6NameServer2,
+                                  ELanIp6DNSAddrFromServer );    
+            break;
+            }
+        default:
+            {
+            break;
+            }
+        }//switch
+    }
+     
+// End of File.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatcreator/Src/cdcprocessorpacketdata.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,473 @@
+/*
+* 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:   Implementation of the class CProcessorPacketData
+*
+*/
+
+
+
+
+// INCLUDE FILES
+
+#include "cdcprocessorpacketdata.h"
+#include "cdclogger.h"
+#include "cdctagcontainer.h"
+
+#include <etelpckt.h>
+#include <cmpluginpacketdatadef.h>
+#include <cmpluginbaseeng.h>
+#include <cmconnectionmethoddef.h>
+#include <cmmanagerext.h>
+#include <datamobilitycommsdattypes.h>
+
+#include <centralrepository.h>
+#include <pdpcontextmanagerinternalcrkeys.h>
+
+using namespace CMManager;
+
+// CONSTANTS
+
+const TUint32 KDefaultPortNum = 80;
+const TInt32 KDefaultLinger = 0;
+const TUint KIapColumn        = 0x00000100;
+const TUint KLingerColumn     = 0x00000200;
+const TUint KColumnMask       = 0xFFFFFF00;
+const TUint KRowMask          = 0x000000FF;
+
+// These constants are used to identify tags of iInFile.
+
+//ISP types
+_LIT16( KStrISPInternet,      "0" );
+_LIT16( KStrISPWAP,      "1" );
+
+//Connection type
+_LIT16( KStrContinuous,      "Continuous" );
+_LIT16( KStrTemporary,       "Temporary" );
+
+//Password authentication
+_LIT16( KStrPwdAuthNormal,   "Normal" );
+_LIT16( KStrPwdAuthSecure,   "Secure" );
+
+//Network types
+_LIT16( KStrNetworkIPv4,     "IPv4" );
+_LIT16( KStrNetworkIPv6,     "IPv6" );
+
+
+// ================= MEMBER FUNCTIONS =======================
+CLingerElement::~CLingerElement()
+    {
+    delete iName;
+    delete iLinger;
+    }
+// ---------------------------------------------------------
+// CProcessorPacketData::NewL
+// ---------------------------------------------------------
+//
+CProcessorPacketData* CProcessorPacketData::NewL( 
+                                CReaderBase* aFileReader,
+                                RCmManagerExt& aCmManager,
+                                RPointerArray< RCmConnectionMethodExt >& aPluginArray,
+                                RPointerArray< HBufC >& aPluginNames,
+                                RPointerArray< CLingerElement >& aLingerSettings)
+    {
+    CProcessorPacketData* self = new ( ELeave ) CProcessorPacketData
+                                                            ( aFileReader,
+                                                              aCmManager,
+                                                              aPluginArray,
+                                                              aPluginNames,
+                                                              aLingerSettings);
+    CleanupStack::PushL( self );
+
+    // From base class
+    self->ConstructL();
+    CleanupStack::Pop( self ); // self
+    return self;
+    }
+    
+    
+// ---------------------------------------------------------
+// CProcessorPacketData::~CProcessorPacketData
+// ---------------------------------------------------------
+//
+CProcessorPacketData::~CProcessorPacketData()
+    {
+    }
+     
+     
+// ---------------------------------------------------------
+// CProcessorPacketData::ConstructL
+// ---------------------------------------------------------
+//
+void CProcessorPacketData::ConstructL()
+    {
+    }
+
+
+// ---------------------------------------------------------
+// CProcessorPacketData::CProcessorPacketData
+// ---------------------------------------------------------
+//
+CProcessorPacketData::CProcessorPacketData( CReaderBase* aFileReader,
+                      RCmManagerExt& aCmManager,
+                      RPointerArray< RCmConnectionMethodExt >& aPluginArray,
+                      RPointerArray< HBufC >& aPluginNames,
+                      RPointerArray< CLingerElement >& aLingerSettings ) :
+                                      CProcessorBase( aFileReader,
+                                                      aCmManager,
+                                                      aPluginArray,
+                                                      aPluginNames )
+                                      
+    {
+    iLingerSettings = &aLingerSettings;
+    iBearerType = KUidPacketDataBearerType;
+    }
+
+// ---------------------------------------------------------
+// CProcessorPacketData::ProcessTagL
+// ---------------------------------------------------------
+//
+void CProcessorPacketData::ProcessSpecialFieldsL( TInt aField, HBufC* aPtrTag, TInt /*aDx*/ )
+    {
+
+    switch ( aField )
+        {
+        case EPacketDataAPName:               //fall through
+        case EPacketDataIFAuthName:           //fall through
+        case EPacketDataIFAuthPass:           //fall through
+        case EPacketDataIPAddr:               //fall through
+            {
+             // Unicode 16-bit text
+            iPlugin.SetStringAttributeL( aField, *aPtrTag );
+
+            break;
+            }
+        case EPacketDataIPNameServer1:        //fall through
+        case EPacketDataIPNameServer2:        //fall through
+        case EPacketDataIPIP6NameServer1:     //fall through
+        case EPacketDataIPIP6NameServer2:     //fall through
+            {
+            iPlugin.SetStringAttributeL( aField, *aPtrTag );
+            SetAddressFromServerL( EPacketDataIPNameServer1,
+                                  EPacketDataIPNameServer2,
+                                  EPacketDataIPDNSAddrFromServer,
+                                  EPacketDataIPIP6NameServer1,
+                                  EPacketDataIPIP6NameServer2,
+                                  EPacketDataIPIP6DNSAddrFromServer );    
+            break;
+            }
+        case ECmWapIPGatewayAddress:
+            {
+             // Unicode 16-bit text
+            if ( aPtrTag->Length() )
+                {
+                iPlugin.SetStringAttributeL( aField, *aPtrTag );
+                }
+
+            break;
+            }
+        case EPacketDataIFPromptForAuth:
+            {
+            // Boolean
+            if ( !aPtrTag->CompareF( KStrYes ) )
+                {
+                iPlugin.SetBoolAttributeL( aField, ETrue );
+                }
+            else if ( !aPtrTag->CompareF( KStrNo ) )
+                {
+                iPlugin.SetBoolAttributeL( aField, EFalse );
+                }
+            else
+                {
+                //no valid data is given - use default value
+                iPlugin.SetBoolAttributeL( aField, EFalse );
+                CLOG_WRITE( "! Error : Invalid Prompt password. Default:No");
+                }
+
+            break;
+            }
+        case EPacketDataUseEdge:
+            {
+            // Boolean
+            if ( !aPtrTag->CompareF( KStrYes ) )
+                {
+                iPlugin.SetBoolAttributeL( aField, ETrue );
+                }
+            else if ( !aPtrTag->CompareF( KStrNo ) )
+                {
+                iPlugin.SetBoolAttributeL( aField, EFalse );
+                }
+            else
+                {
+                //no valid data is given - use default value
+                iPlugin.SetBoolAttributeL( aField, ETrue );
+                CLOG_WRITE( "! Error : Invalid Use EDGE. Default:Yes");
+                }
+
+            break;
+            }
+        case EPacketDataLinger:
+            {
+            // Pair linger with name for later saving
+            CLingerElement* linger = new (ELeave) CLingerElement;
+
+            CleanupStack::PushL( linger );
+                    
+            linger->iName = iName->AllocL();
+            linger->iLinger = aPtrTag->AllocL(); 
+                                            
+            iLingerSettings->AppendL(linger);
+                    
+            CleanupStack::Pop( linger );
+            break;
+            }
+        case ECmWapIPSecurity:
+            {
+             // TBool                
+            if ( !aPtrTag->CompareF( KStrOn ) )
+                {
+                iPlugin.SetBoolAttributeL( aField, ETrue );
+                }
+            else if ( !aPtrTag->CompareF( KStrOff ) )
+                {
+                iPlugin.SetBoolAttributeL( aField, EFalse );
+                }
+            else
+                {
+                //no valid data is given - default data is used
+                iPlugin.SetBoolAttributeL( aField, ETrue );
+                CLOG_WRITE( "! Error : Invalid WTLS security setting. Default:On");
+                }
+
+            break;
+            }
+        case ECmWapIPWSPOption:
+            {
+            // UInt                
+            if ( !aPtrTag->CompareF( KStrContinuous ) )
+                {
+                iPlugin.SetIntAttributeL( aField, 
+                                  EWapWspOptionConnectionOriented );
+                }
+            else if ( !aPtrTag->CompareF( KStrTemporary ) )
+                {
+                iPlugin.SetIntAttributeL( aField, 
+                                  EWapWspOptionConnectionless );
+                }
+            else
+                {
+                //no valid data is given - default data is used
+                iPlugin.SetIntAttributeL( aField, 
+                                  EWapWspOptionConnectionOriented );
+                CLOG_WRITE( "! Error : Invalid connection type. Default:Continuous");
+                }
+
+            break;
+            }
+            
+        case ECmProxyProtocolName:
+        	{
+        	// Do not enable proxy in this case yet
+        	iPlugin.SetStringAttributeL( aField, *aPtrTag );
+        	break;
+        	}
+                         
+        case ECmProxyServerName:    
+            {
+            // First set proxy usage to enabled
+            if( !iProxyEnabled )
+                {
+                iPlugin.SetBoolAttributeL( ECmProxyUsageEnabled, ETrue );
+                iProxyEnabled = ETrue;
+                }
+            // Long text
+            iPlugin.SetStringAttributeL( aField, *aPtrTag );
+            break;
+            }
+        case ECmProxyPortNumber:
+            {
+            // First set proxy usage to enabled
+            if( !iProxyEnabled )
+                {
+                iPlugin.SetBoolAttributeL( ECmProxyUsageEnabled, ETrue );
+                iProxyEnabled = ETrue;
+                }
+             // TUint32 and should be read as text.
+            TPtrC16 portptr = aPtrTag->Right( aPtrTag->Length() );
+            TLex16 lex( portptr );
+            TUint32 portnum( 0 );
+            if ( lex.Val( portnum, EDecimal ) == KErrNone )
+                {
+                iPlugin.SetIntAttributeL( aField, portnum );
+                }
+            else 
+                {
+                //no valid data is given - default value is used
+                iPlugin.SetIntAttributeL( aField, KDefaultPortNum );
+                CLOG_WRITE( "! Error : Invalid port number. Default:80");  
+                }
+            break;
+            }
+        case EPacketDataDisablePlainTextAuth:
+            {
+             // TBool                
+            if ( !aPtrTag->CompareF( KStrPwdAuthNormal ) )
+                {
+                // Normal, => auth. not secure, plain text NOT disabled
+                iPlugin.SetBoolAttributeL( aField, EFalse );
+                }
+            else if ( !aPtrTag->CompareF( KStrPwdAuthSecure ) )
+                {
+                // Secure, => auth. secure, plain text disabled
+                iPlugin.SetBoolAttributeL( aField, ETrue );
+                }
+            else
+                {
+                //no valid data is given - default value is used
+                CLOG_WRITE( "! Error : Invalid password authentication. Default:Secure ");  
+                iPlugin.SetBoolAttributeL( aField, ETrue );
+                }
+            break;
+            }
+        case EPacketDataPDPType:
+            {
+            if ( !aPtrTag->CompareF( KStrNetworkIPv4 ) )
+                {
+                iPlugin.SetIntAttributeL( aField, RPacketContext::EPdpTypeIPv4 );
+                }
+            else if ( !aPtrTag->CompareF( KStrNetworkIPv6 ) )
+                {
+                iPlugin.SetIntAttributeL( aField, RPacketContext::EPdpTypeIPv6 );
+                }
+            else
+                {
+                iPlugin.SetIntAttributeL( aField, RPacketContext::EPdpTypeIPv4 );
+                CLOG_WRITE( "! Error : Invalid Network type. Default:IPv4" )
+                }
+            break;
+            }
+        case EPacketDataApType:
+        		{
+        		if ( !aPtrTag->CompareF( KStrISPInternet ) )
+            		{
+            		iPlugin.SetIntAttributeL( aField, 0 );              
+                }
+            else if ( !aPtrTag->CompareF( KStrISPWAP ) )
+                {
+                iPlugin.SetIntAttributeL( aField, 1 );                              
+            		}
+            else
+               	{
+               	iPlugin.SetIntAttributeL( aField, 2 );
+                }  
+        		break;
+        	}
+        default:
+            {
+            break;
+            }
+        }//switch
+    }
+
+// ---------------------------------------------------------
+// CProcessorPacketData::AddLingerL
+// ---------------------------------------------------------
+//
+void CProcessorPacketData::AddLingerL( const TInt aIapId, const TInt aLingerInterval)
+    {
+    TInt    err( KErrNone );
+    
+    // Open repository
+    CRepository* repository = CRepository::NewLC( KCRUidPDPContextManager );
+    
+    // Find if an entry for "iapId" already exists in CentRep 
+    RArray< TUint32 > foundKeys;
+    foundKeys.Reset();
+    
+    err = repository->FindEqL( KIapColumn,       // partial key
+                               KColumnMask,      // key mask
+                               aIapId,           // value
+                               foundKeys );      // found keys
+    
+    if ( err == KErrNone || err == KErrNotFound )
+        {
+        if ( foundKeys.Count() == 0 )
+            {
+            // Add a new entry
+            TInt arrayCount( 0 );
+            
+            // Get number of iapId&linger entries in Centrep
+            err = repository->Get( KPdpContextManagerLingerArrayCount, 
+                                   arrayCount );
+        
+            if ( err == KErrNone )
+                {
+                arrayCount++;
+                
+                err = repository->Create( ( KIapColumn | arrayCount ), aIapId ); 
+                
+                if ( err == KErrNone )
+                    {
+                    err = repository->Create( ( KLingerColumn | arrayCount ), 
+                                               aLingerInterval );     
+                    }
+                
+                if ( err == KErrNone )
+                    {
+                    // Update number of iapId&linger entries in Centrep
+                    err = repository->Set( KPdpContextManagerLingerArrayCount, 
+                                           arrayCount );
+                    }
+                }
+            }
+        else
+            {
+            // Update existing entry on current row
+            TInt32 row = foundKeys[ 0 ] & KRowMask;
+            
+            err = repository->Set( ( KLingerColumn | row ), aLingerInterval ); 
+            }         
+        }
+        
+    foundKeys.Close();
+    CleanupStack::PopAndDestroy( repository );
+    
+    User::LeaveIfError( err );
+    }
+
+// ---------------------------------------------------------
+// CProcessorPacketData::SaveLingerSettingsL
+// ---------------------------------------------------------
+//
+void CProcessorPacketData::SaveLingerSettingsL()
+    {
+    for ( TInt i(0); i < iLingerSettings->Count(); i++ )
+        {
+        TInt id = GetPluginIdL(((*iLingerSettings)[i])->iName);
+        
+        TLex16 lex(*((*iLingerSettings)[i])->iLinger);
+        TInt linger( 0 );
+        if ( lex.Val( linger ) == KErrNone )         
+            {
+            AddLingerL( id, linger);
+            }
+            else 
+            {
+            // no valid data is given - default value is used
+            AddLingerL( id, KDefaultLinger); 
+            }
+        }
+        iLingerSettings->ResetAndDestroy();
+    }
+     
+// End of File.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatcreator/Src/cdcprocessorvpn.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,242 @@
+/*
+* 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:   Implementation of the class CProcessorVpn
+*
+*/
+
+
+
+
+// INCLUDE FILES
+
+#include "cdcprocessorvpn.h"
+#include "cdclogger.h"
+#include "cdctagcontainer.h"
+
+#include <cmpluginvpndef.h>
+#include <cmpluginbaseeng.h>
+#include <cmconnectionmethoddef.h>
+#include <cmdestinationext.h>
+#include <cmmanagerext.h>
+#include <datamobilitycommsdattypes.h>
+
+using namespace CMManager;
+
+// CONSTANTS
+
+const TUint32 KDefaultPortNum = 80;
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CProcessorVpn::NewL
+// ---------------------------------------------------------
+//
+CProcessorVpn* CProcessorVpn::NewL( CReaderBase* aFileReader,
+                                    RCmManagerExt& aCmManager,
+                                    RPointerArray< RCmConnectionMethodExt >& aPluginArray,
+                                    RPointerArray< HBufC >& aPluginNames,
+                                    RPointerArray< HBufC >& aUnderLying )
+    {
+    CProcessorVpn* self = new ( ELeave ) CProcessorVpn( aFileReader,
+                                                        aCmManager,
+                                                        aPluginArray,
+                                                        aPluginNames,
+                                                        aUnderLying );
+    CleanupStack::PushL( self );
+
+    // From base class
+    self->ConstructL();
+    CleanupStack::Pop( self ); // self
+    return self;
+    }
+    
+    
+// ---------------------------------------------------------
+// CProcessorVpn::~CProcessorVpn
+// ---------------------------------------------------------
+//
+CProcessorVpn::~CProcessorVpn()
+    {
+    }
+     
+     
+// ---------------------------------------------------------
+// CProcessorVpn::ConstructL
+// ---------------------------------------------------------
+//
+void CProcessorVpn::ConstructL()
+    {
+    }
+
+
+// ---------------------------------------------------------
+// CProcessorVpn::CProcessorVpn
+// ---------------------------------------------------------
+//
+CProcessorVpn::CProcessorVpn( CReaderBase* aFileReader,
+                              RCmManagerExt& aCmManager,
+                              RPointerArray< RCmConnectionMethodExt >& aPluginArray,
+                              RPointerArray< HBufC >& aPluginNames,
+                              RPointerArray< HBufC >& aUnderLying  ) :
+                              
+                              CProcessorBase( aFileReader,
+                                              aCmManager,
+                                              aPluginArray,
+                                              aPluginNames )
+    {
+    iUnderLying = &aUnderLying;
+    iBearerType = KPluginVPNBearerTypeUid;
+    }
+
+// ---------------------------------------------------------
+// CProcessorVpn::ProcessTagL
+// ---------------------------------------------------------
+//
+void CProcessorVpn::ProcessUnderLyingL( RPointerArray< RCmDestinationExt >& aDestArray,
+                                        RPointerArray< HBufC >& aDestNames )
+    {
+    iDestArray = &aDestArray;
+    iDestName = &aDestNames;
+    
+    for( TInt i(0); i < iUnderLying->Count(); i++ )
+        {
+        // Finds the vpn IAP by its name
+        RCmConnectionMethodExt* iPlugin = FindPluginL( (*iUnderLying)[i] );
+        if( iPlugin != NULL )
+            {
+            CLOG_WRITE_FORMAT( "Underlying set for:%S", (*iUnderLying)[i] );  
+            
+            // Finds the underlying IAP by its name
+            i++;
+            RCmConnectionMethodExt* up = FindPluginL( (*iUnderLying)[i] );
+            if( up != NULL )
+                {
+                iPlugin->SetIntAttributeL( ECmNextLayerIapId,
+                            up->GetIntAttributeL( ECmIapId ) );
+                iPlugin->UpdateL();                            
+
+                CLOG_WRITE_FORMAT( "Underlying IAP Set:%S", (*iUnderLying)[i] );  
+                }
+            else
+                {
+                // Underlyinf can be destination. If not IAP finds destination.
+                RCmDestinationExt* ud = FindDestinationL( (*iUnderLying)[i] );
+                if( ud != NULL )
+                    {
+                    iPlugin->SetIntAttributeL( ECmNextLayerSNAPId, ud->Id() );
+                    iPlugin->UpdateL();                            
+
+                    CLOG_WRITE_FORMAT( "Underlying SNAP Set: %S", (*iUnderLying)[i] );  
+                    }
+                }    
+            }
+        }
+    }
+
+
+// ---------------------------------------------------------
+// CProcessorVpn::ProcessTagL
+// ---------------------------------------------------------
+//
+void CProcessorVpn::ProcessSpecialFieldsL( TInt aField, HBufC* aPtrTag, TInt /*aDx*/ )
+    {
+        CLOG_WRITE_FORMAT( "field: %d", aField );  
+        switch ( aField )
+            {
+	        case ECmProxyProtocolName:
+	        	{
+	        	// Do not enable proxy in this case yet
+	        	iPlugin.SetStringAttributeL( aField, *aPtrTag );
+	        	break;
+	        	}
+            
+            case ECmProxyServerName:
+                {
+                // First set proxy usage to enabled
+                if( !iProxyEnabled )
+                    {
+                    iPlugin.SetBoolAttributeL( ECmProxyUsageEnabled, ETrue );
+                    iProxyEnabled = ETrue;
+                    }
+                // Long text
+                iPlugin.SetStringAttributeL( aField, *aPtrTag );
+                break;
+                }
+            case ECmProxyPortNumber:
+                {
+                // First set proxy usage to enabled
+                if( !iProxyEnabled )
+                    {
+                    iPlugin.SetBoolAttributeL( ECmProxyUsageEnabled, ETrue );
+                    iProxyEnabled = ETrue;
+                    }
+                 // TUint32 and should be read as text.
+                TPtrC16 portptr = aPtrTag->Right( aPtrTag->Length() );
+                TLex16 lex( portptr );
+                TUint32 portnum( 0 );
+                if ( lex.Val( portnum, EDecimal ) == KErrNone )
+                    {
+                    iPlugin.SetIntAttributeL( aField, portnum );
+                    }
+                else 
+                    {
+                    //no valid data is given - default value is used
+                    iPlugin.SetIntAttributeL( aField, KDefaultPortNum );
+                    CLOG_WRITE( "! Error : Invalid port number. Default:80");  
+                    }
+                break;
+                }
+            case EVPN_IapName: // Underlying IAP/destination
+                {
+                if( !iName )
+                    {
+                    TInt len = aPtrTag->Length();
+                
+                    iName = HBufC::NewL( 8 + len );
+                    TPtr name = iName->Des();
+                    name.Append( _L( "VPN to " ) );
+                    name.Append( *aPtrTag );
+                    
+                    SetGeneralFieldL( ECmName, iName );
+                    
+                    }
+                    
+                // Adds vpnIAP name - underlying IAP/Dest name pair to a list
+                if( iName )
+                    {
+                    iUnderLying->AppendL( iName->AllocL() );
+                    iUnderLying->AppendL( aPtrTag->AllocL() );
+                    }
+                break;
+                }
+            case EVpnServicePolicy:
+            ////case ECmName:                //fall through
+                {
+                iPlugin.SetStringAttributeL( aField, *aPtrTag );
+                if( !iName )
+                    {
+                    iName = aPtrTag->AllocLC();
+                    }
+
+                break;
+                }
+            default:
+                {
+                break;
+                }
+            }//switch
+    }
+
+// End of File.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatcreator/Src/cdcprocessorwlan.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,2374 @@
+/*
+* 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:   Implementation of the class CProcessorWlan
+*
+*/
+
+
+
+
+// INCLUDE FILES
+
+#include "cdcprocessorwlan.h"
+#include "cdclogger.h"
+#include "cdcerrors.h"
+
+#include <cmpluginwlandef.h>
+#include <cmpluginbaseeng.h>
+#include <cmconnectionmethoddef.h>
+#include <cmmanagerext.h>
+#include <datamobilitycommsdattypes.h>
+#include <commsdattypesv1_1.h>
+#include <WlanCdbCols.h>
+#include <commsdattypesv1_1.h>
+#include <wlancontainer.h>
+#include <EapType.h>
+
+using namespace CMManager;
+
+// CONSTANTS
+
+// network modes.
+_LIT16( KStrAd_hoc,         "Ad-hoc" );
+_LIT16( KStrInfrastructure, "Infrastructure" ); // Default value.
+
+// security modes.
+_LIT16( KStrWEP,            "WEP" );
+_LIT16( KStr802_1x,         "802.1x" );
+_LIT16( KStrWPA,            "WPA" );          // WPA/WPA2 mixed mode
+_LIT16( KStrWPA2,           "WPA2" );         // WPA2-only mode
+_LIT16( KStrOpen,           "Open" );         // Default value.
+
+// default WLAN channel Id value
+const TInt KDefaultChannelId = 0;
+const TInt KMaximumChannelId = 11;
+
+// default port number
+const TUint32 KDefaultPortNum = 0;
+
+// ratio between sizes of ascii and unicode characters
+const TUint KAsciiUnicodeRatio = 2;
+
+// Length of expanded EAP type identifier
+const TUint KExpandedEAPIdLength = 8;
+
+// Plain MSCHAPv2 EAP identifier. Needed because of special handling
+const TUint8 KMschapv2TypeId[] = {0xfe, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x63};
+
+// ================= MEMBER FUNCTIONS =======================
+
+CEapTypeElement::~CEapTypeElement()
+    {
+    delete iEapSettings;
+    delete iName;
+    }
+
+
+// ---------------------------------------------------------
+// CProcessorWlan::NewL
+// ---------------------------------------------------------
+//
+CProcessorWlan* CProcessorWlan::NewL( CReaderBase* aFileReader,
+                                      RCmManagerExt& aCmManager,
+                                      RPointerArray< RCmConnectionMethodExt >& aPluginArray,
+                                      RPointerArray< HBufC >& aPluginNames,
+                                      RPointerArray< HBufC >& aSecurityInfo,
+									  RPointerArray< CEapTypeElement >& aEapSettings )
+    {
+    CProcessorWlan* self = new ( ELeave ) CProcessorWlan( aFileReader,
+                                                          aCmManager,
+                                                          aPluginArray,
+                                                          aPluginNames,
+                                                          aSecurityInfo,
+														  aEapSettings );
+    CleanupStack::PushL( self );
+
+    // From base class
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------
+// CProcessorWlan::ConstructL
+// ---------------------------------------------------------
+//
+void CProcessorWlan::ConstructL()
+    {
+    iEmptyTag = KStrEmpty.operator const TDesC16&().Alloc();
+
+    Reset(); // iWepData, iWpaData
+    }
+
+
+// ---------------------------------------------------------
+// CProcessorWlan::CProcessorWlan
+// ---------------------------------------------------------
+//
+CProcessorWlan::CProcessorWlan( CReaderBase* aFileReader,
+                                RCmManagerExt& aCmManager,
+                                RPointerArray< RCmConnectionMethodExt >& aPluginArray,
+                                RPointerArray< HBufC >& aPluginNames,
+                                RPointerArray< HBufC >& aSecurityInfo,
+								RPointerArray< CEapTypeElement >& aEapSettings ) :
+             CProcessorBase( aFileReader,
+                             aCmManager,
+                             aPluginArray,
+                             aPluginNames ),
+             iSecurityMode( ESecurityModeOpen ),
+             iEapSettings( aEapSettings ),
+             iIsEasyWlan( ETrue )                     
+    {
+    iBearerType = KUidWlanBearerType;
+    iSecurityInfo = &aSecurityInfo;
+    iDataStart = 0;
+    }
+
+
+// ---------------------------------------------------------
+// CProcessorWlan::~CProcessorWlan
+// ---------------------------------------------------------
+//
+CProcessorWlan::~CProcessorWlan()
+    {
+    delete iEmptyTag;
+    }
+
+// ---------------------------------------------------------
+// CProcessorWlan::ProcessSpecialFieldsL
+// ---------------------------------------------------------
+//
+void CProcessorWlan::ProcessSpecialFieldsL( TInt aField, HBufC* aPtrTag, TInt /*aDx*/ )
+    {
+        switch( aField )
+            {
+            // TDesC16
+            case EWlanSSID:
+                {
+                if ( aPtrTag->CompareF( KStrEmpty ) != 0 )
+                    {
+                    iPlugin.SetStringAttributeL( aField, *aPtrTag );
+                    iIsEasyWlan = EFalse;
+                    }
+                else
+                    {
+                    // Access point is Easy WLAN 
+                    iIsEasyWlan = ETrue;
+                    }
+                break;
+                }
+            case EWlanIpAddr:
+                {
+                if ( aPtrTag->CompareF( KStrEmpty ) != 0 )
+                    {
+                    iPlugin.SetStringAttributeL( aField, *aPtrTag );
+                    }
+                break;
+                }
+            // TDesC16
+            case EWlanIpGateway:             //fall through
+            case EWlanIpNetMask:             //fall through
+                {
+                iPlugin.SetStringAttributeL( aField, *aPtrTag );
+                break;
+                }
+            case EWlanIpNameServer1:         //fall through
+            case EWlanIpNameServer2:         //fall through
+            case EWlanIp6NameServer1:        //fall through
+            case EWlanIp6NameServer2:        //fall through
+                {
+                iPlugin.SetStringAttributeL( aField, *aPtrTag );
+                SetAddressFromServerL( EWlanIpNameServer1,
+                                      EWlanIpNameServer2,
+                                      EWlanIpDNSAddrFromServer,
+                                      EWlanIp6NameServer1,
+                                      EWlanIp6NameServer2,
+                                      EWlanIp6DNSAddrFromServer );    
+                break;
+                }
+            // TUint32
+            case EWlanSecurityMode:
+                {
+
+                if ( aPtrTag->CompareF( KStrWEP ) == 0 )
+                    {
+                    // WEP
+                    iPlugin.SetIntAttributeL( aField, EWlanSecModeWep );
+                    iSecurityMode = ESecurityModeWEP;
+                    }
+                else if ( aPtrTag->CompareF( KStr802_1x ) == 0 )
+                    {
+                    // 802.1x
+                    iPlugin.SetIntAttributeL( aField, EWlanSecMode802_1x );
+                    iSecurityMode = ESecurityMode802;
+                    }
+                else if ( aPtrTag->CompareF( KStrWPA ) == 0 )
+                    {
+                    // WPA/WPA2 mixed mode
+                    iPlugin.SetIntAttributeL( aField, EWlanSecModeWpa );
+                    iSecurityMode = ESecurityModeWPA;
+                    }
+                else if ( aPtrTag->CompareF( KStrWPA2 ) == 0 )
+                    {
+                    // WPA2
+                    iPlugin.SetIntAttributeL( aField, EWlanSecModeWpa2 );
+                    iSecurityMode = ESecurityModeWPA2;
+                    }
+                else if ( aPtrTag->CompareF( KStrOpen ) == 0 )
+                    {
+                    // Open network (default)
+                    iPlugin.SetIntAttributeL( aField, EWlanSecModeOpen );
+                    iSecurityMode = ESecurityModeOpen;
+                    }
+                else 
+                    {
+                    iPlugin.SetIntAttributeL( aField, EWlanSecModeOpen );
+                    iSecurityMode = ESecurityModeOpen;
+                    CLOG_WRITE( "! Error : Invalid Security Mode. Default:Open" )
+                    }
+                break;
+                }
+                
+            // TUint32
+            case EWlanConnectionMode:
+                {
+
+                if ( !aPtrTag->CompareF( KStrAd_hoc ) )
+                    {
+                    // Ad-hoc
+                    iPlugin.SetIntAttributeL( aField, EAdhoc );
+                    }
+                else if ( !aPtrTag->CompareF( KStrInfrastructure ) )
+                    {
+                    // Infrastructure
+                    iPlugin.SetIntAttributeL( aField, EInfra );
+                    }
+                else
+                    {
+                    iPlugin.SetIntAttributeL( aField, EInfra );
+                    CLOG_WRITE( "! Error : Invalid Network Mode. Default:Infrastructure" )
+                    }
+                break;
+                }
+                
+            // TUint32
+            case ECmProxyPortNumber:
+                {
+                // First set proxy usage to enabled
+                if( !iProxyEnabled )
+                    {
+                    iPlugin.SetBoolAttributeL( ECmProxyUsageEnabled, ETrue );
+                    iProxyEnabled = ETrue;
+                    }
+                TLex16 lex( *aPtrTag );
+                TUint32 tmp( 0 );
+                if ( lex.Val( tmp, EDecimal ) == KErrNone )
+                    {
+                    iPlugin.SetIntAttributeL( aField, tmp );
+                    }
+                else
+                    {
+                    //no valid data is given
+                    iPlugin.SetIntAttributeL( aField, KDefaultPortNum );
+                    CLOG_WRITE( "! Error : Invalid port number. Default:0" );
+                    }
+                break;
+                }
+            // Long text.
+            case ECmStartPage:
+                {
+
+                if ( aPtrTag->CompareF( KStrEmpty ) != 0 )
+                    {
+                    iPlugin.SetStringAttributeL( aField, *aPtrTag );
+                    }
+                break;
+                }
+                
+	        case ECmProxyProtocolName:
+	        	{
+	        	// Do not enable proxy in this case yet
+	        	iPlugin.SetStringAttributeL( aField, *aPtrTag );
+	        	break;
+	        	}
+	                
+            // Long text.
+            case ECmProxyServerName:            
+                {
+                // First set proxy usage to enabled
+                if( !iProxyEnabled )
+                    {
+                    iPlugin.SetBoolAttributeL( ECmProxyUsageEnabled, ETrue );
+                    iProxyEnabled = ETrue;
+                    }
+                iPlugin.SetStringAttributeL( aField, *aPtrTag );
+                break;
+                }
+            // Bool
+            case EWlanScanSSID:
+                {
+                if ( !aPtrTag->CompareF( KStrYes ) )
+                    {
+                    iPlugin.SetBoolAttributeL( aField, ETrue );
+                    }
+                else if ( !aPtrTag->CompareF( KStrNo ) )
+                    {
+                    iPlugin.SetBoolAttributeL( aField, EFalse );
+                    }
+                else 
+                    {
+                    iPlugin.SetBoolAttributeL( aField, EFalse );
+                    CLOG_WRITE( "! Error : Invalid Scan SSID. Default:No" )
+                    }
+                break;
+                }
+
+            // TUint32
+            case EWlanChannelID:
+                {
+                TLex16 lex( *aPtrTag );
+                TUint32 tmp( 0 );
+                lex.Val( tmp, EDecimal );
+
+                if( tmp <= KMaximumChannelId )
+                    {
+                    iPlugin.SetIntAttributeL( aField, tmp );
+                    }
+                else
+                    {
+                    // Default value
+                    iPlugin.SetIntAttributeL( aField, KDefaultChannelId );
+                    CLOG_WRITE( "! Error : Invalid Chanel Id. Default:0" )
+                    }
+                break;
+                }
+            //WEP
+            case EWEPKeyInUse:
+            case EWEPAuthType:
+            case EWEPKey1Length:
+            case EWEPKey1Format:
+            case EWEPKey1Data:
+            case EWEPKey2Length:
+            case EWEPKey2Format:
+            case EWEPKey2Data:
+            case EWEPKey3Length:
+            case EWEPKey3Format:
+            case EWEPKey3Data:
+            case EWEPKey4Length:
+            case EWEPKey4Format:
+            case EWEPKey4Data:
+                {
+                if( iSecurityMode == ESecurityModeWEP )
+                    {
+                    AddSecurityDataL( aField, aPtrTag, ETrue );
+                    }
+                }
+                break;
+            //WPA
+            case EWPAPresharedKey:
+            case EWPAKeyLength:
+            case EWPAListOfEAPs:
+            case EWPAUseOfPresharedKey:
+                {
+                if( iSecurityMode != ESecurityModeWEP && iSecurityMode != ESecurityModeOpen )
+                    {
+                    AddSecurityDataL( aField, aPtrTag, EFalse );
+                    }
+                }
+                break;
+                
+            default:
+            	// Check if this is EAP setting
+            	if ( EAPSetting( aField ) )
+            		{
+            		AddEAPSettingL( aField, aPtrTag );
+            		}
+            	else
+            		{            		
+            		CLOG_WRITE_FORMAT( "! Warning: Unhandled setting for WLAN: %d", aField );
+            		}
+                break;
+            }//switch
+    }
+     
+     
+// ---------------------------------------------------------
+// CProcessorWlan::ProcessAPL
+// ---------------------------------------------------------
+//
+void CProcessorWlan::ProcessAPL()
+    {
+    
+    RCmConnectionMethodExt& iPlugin = GetLastPluginL();
+    
+    if( iIsProtected )
+        {
+        iPlugin.SetBoolAttributeL( ECmProtected, ETrue );
+        }
+    
+    // Ensure that Easy WLAN is always an open network
+    if( iIsEasyWlan )
+        {
+        iSecurityMode = ESecurityModeOpen;
+        }
+        
+    FillSecurityInfoL();        
+    
+    // Writes into the log file.
+    DoLogL();
+    
+    Reset(); // iWepData, iWpaData
+    }
+    
+// ---------------------------------------------------------
+// CProcessorWlan::ProcessAPL
+// ---------------------------------------------------------
+//
+void CProcessorWlan::FillSecurityInfoL()
+    {
+    //Set Security mode settings
+    switch ( iSecurityMode )
+        {
+        case ESecurityModeWEP:
+            if ( WEPFieldValidate() )
+                {
+                FillSecurityInfoL( ETrue ); //WEP
+                }
+            else
+                {
+                CLOG_WRITE( "! Error : WEP settings are not valid." )
+                }
+            break;  
+        case ESecurityMode802:
+        case ESecurityModeWPA:
+        case ESecurityModeWPA2:
+            {
+            FillSecurityInfoL( EFalse ); //WPA
+            break;
+            }
+        default:
+            {
+            }
+            break;
+        }
+    }    
+
+// ---------------------------------------------------------
+// CProcessorWlan::ProcessAPL
+// ---------------------------------------------------------
+//
+void CProcessorWlan::FillSecurityInfoL( TBool aIsWep )
+    {
+    // iName has been deleted by Base. Name is retrieved from name array.
+    TInt lastPos = iPluginArray->Count() - 1;
+    HBufC* name = (*iPluginName)[ lastPos ];
+    
+    // Name appended to the array
+    iSecurityInfo->Append( name->AllocL() );
+    CLOG_WRITE_FORMAT( "FillSecurityInfoL %S", name );
+    CLOG_WRITE_FORMAT( "FillSecurityInfoL start %d", iSecurityInfo->Count() );
+    
+    if( aIsWep )
+        {
+        // Security type appended to the array
+        iSecurityInfo->Append( KStrWEP.operator const TDesC16&().Alloc() );
+        for( TInt i( 0 ); i < KWEPKeyNumOfFields; i++ )
+            {
+            
+            if( iWepData[i] != NULL )
+                {
+                CLOG_WRITE_FORMAT( "wep info %S", iWepData[i] );
+                }
+            else
+                {
+                CLOG_WRITE( "wep info NULL" );
+                }
+            iSecurityInfo->Append( iWepData[i] );
+            }
+        }
+    else
+        {
+        // Security type appended to the array
+        switch ( iSecurityMode )
+            {
+            case ESecurityMode802:
+                iSecurityInfo->Append( KStr802_1x.operator const TDesC16&().Alloc() );
+            break;            
+            case ESecurityModeWPA2:
+                iSecurityInfo->Append( KStrWPA2.operator const TDesC16&().Alloc() );
+            break;            
+            default:
+                iSecurityInfo->Append( KStrWPA.operator const TDesC16&().Alloc() );
+            break;            
+            }
+
+        for( TInt i( 0 ); i < KWPAKeyNumOfFields; i++ )
+            {
+            
+            if( iWpaData[i] != NULL )
+                {
+                CLOG_WRITE_FORMAT( "wpa info %S", iWpaData[i] );
+                }
+            else
+                {
+                CLOG_WRITE( "wep info NULL" );
+                }
+            iSecurityInfo->Append( iWpaData[ i ] );
+            }
+        }
+
+    CLOG_WRITE_FORMAT( "FillSecurityInfoL end %d", iSecurityInfo->Count() );
+    }    
+
+// ---------------------------------------------------------
+// CProcessorWlan::SaveSecurityInfoL
+// ---------------------------------------------------------
+//
+void CProcessorWlan::SaveSecurityInfoL()
+    {
+    TInt i(0);
+
+    while( i < iSecurityInfo->Count() )
+        {
+        if( (*iSecurityInfo)[i] != NULL )
+            {
+            CLOG_WRITE_FORMAT( "Sec Info: %S", (*iSecurityInfo)[i] );
+            }
+        else
+            {
+            CLOG_WRITE( "Sec Info: NULL" );
+            }
+        
+        i++;
+        }
+
+
+    i = 0;
+
+    while( i < iSecurityInfo->Count() )
+        {
+        CLOG_WRITE_FORMAT( "SaveSecurityInfoL %S", (*iSecurityInfo)[i] );
+
+        TInt id = GetPluginIdL( (*iSecurityInfo)[i] );
+        if( id != KErrNotFound )
+            {
+            i++;
+            SaveSecurityInfoL( i, id );
+            }
+        else
+            {
+            CLOG_WRITE_FORMAT( "WLan IAp cannot find %S", (*iSecurityInfo)[i] );
+            CLOG_WRITE( "Security save likely collapsed" );
+            // Tries to look for an existing IAP.
+            i++;
+            }    
+        }
+
+	// EAP settings
+	CLOG_WRITE( "Starting EAP settings saving" );
+	CMDBSession* session = CMDBSession::NewL( CMDBSession::LatestVersion() );
+    CleanupStack::PushL( session );
+    
+    // Load IAP record in order to get the service id
+	for ( i = 0; i < iEapSettings.Count() ; i++ )
+        {
+        CEapTypeElement* eap = iEapSettings[i];
+        // 
+        TInt id = GetPluginIdL( eap->iName );
+        
+	    CCDIAPRecord* iapRecord = static_cast< CCDIAPRecord * >
+	                        ( CCDRecordBase::RecordFactoryL( KCDTIdIAPRecord ) );
+	                        
+	    CleanupStack::PushL( iapRecord );
+	    
+	    iapRecord->SetRecordId( id );
+	    
+	    iapRecord->LoadL( *session );
+	   
+	    TInt serviceId = iapRecord->iService;
+	    
+	    CleanupStack::PopAndDestroy( iapRecord );	        
+	            
+		TInt err = KErrNone;
+	    TUint8 expandedEapId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+
+	    TBuf8<KExpandedEAPIdLength> cue;
+	    
+		// Set-up 64-bit expanded EAP id
+		if ( eap->iEapSettings->iEAPType == KMschapv2TypeId[7] )
+			{
+			// This is plain MSCHAPv2. Set vendor ID correctly
+			expandedEapId[1] = KMschapv2TypeId[1];
+			expandedEapId[2] = KMschapv2TypeId[2];
+			expandedEapId[3] = KMschapv2TypeId[3];
+			}
+		
+		expandedEapId[KExpandedEAPIdLength - 1] = static_cast<TUint8> ( eap->iEapSettings->iEAPType );	
+		cue.Copy( expandedEapId, KExpandedEAPIdLength );
+		
+		// Try loading EAP ECOM module
+		CLOG_WRITE_FORMAT( "Try to load EAP module: %d", expandedEapId[7]);
+		CEapType* eapType = 0;
+		TRAP( err, eapType = CEapType::NewL( cue, ELan, serviceId ) );
+		// The error is caused by probably missing EAP method from the device. Ignore the error
+		// because same scripts can be used for devices with and without certain methods.
+		if( err == KErrNone )
+			{
+		    CleanupStack::PushL( eapType );
+		        
+		    // Check if this type is tunneled
+		    if ( eap->iEncapsulatingEapId != EAPSettings::EEapNone )
+		    	{
+		    	// It is tunneled. Take the last byte of the expanded id.
+		    	eapType->SetTunnelingType( eap->iEncapsulatingEapId );    	
+		    	}
+		    CLOG_WRITE( "Calling eapType->SetConfiguration" );
+		    eapType->SetConfigurationL( *eap->iEapSettings );
+		    CLOG_WRITE( "eapType->SetConfiguration success!" );
+		    CleanupStack::PopAndDestroy( eapType );
+			}
+        }
+        
+    session->Close();
+    CleanupStack::PopAndDestroy( session );
+    CLOG_WRITE( "Finished EAP settings saving" );
+	//iEapSettings.ResetAndDestroy();
+
+    CLOG_WRITE_FORMAT( "SaveSecurityInfoL end %d", iSecurityInfo->Count() );
+}
+
+// ---------------------------------------------------------
+// CProcessorWlan::SaveSecurityInfoL
+// ---------------------------------------------------------
+//
+void CProcessorWlan::SaveSecurityInfoL( TInt& aCounter, TInt aId )
+    {
+    if( (*iSecurityInfo)[ aCounter ]->Compare( KStrWEP ) == 0 )
+        {
+        aCounter++;
+        TInt end( aCounter + KWEPKeyNumOfFields );
+        
+        for( TInt index(0); aCounter < end; aCounter++, index++ )
+            {
+            if( (*iSecurityInfo)[ aCounter ] != NULL )
+                {
+                CLOG_WRITE_FORMAT( "wep info %S", (*iSecurityInfo)[ aCounter ] );
+                }
+            else
+                {
+                CLOG_WRITE( "wep info NULL" );
+                }
+            iWepData[ index] = (*iSecurityInfo)[ aCounter ] ;
+            }
+        SaveWEPL( aId );
+        }
+    else
+        {
+        
+        // Set security mode.        
+        if ( (*iSecurityInfo)[ aCounter ]->CompareF( KStr802_1x ) == 0 )
+            {
+            // 802.1x
+            iSecurityMode = ESecurityMode802;
+            }
+        else if ( (*iSecurityInfo)[ aCounter ]->CompareF( KStrWPA2 ) == 0 )
+            {
+            // WPA2 mode
+            iSecurityMode = ESecurityModeWPA2;
+            }
+        else 
+            {
+            // WPA
+            iSecurityMode = ESecurityModeWPA;
+            }
+
+        aCounter++;
+        TInt end( aCounter + KWPAKeyNumOfFields );
+        
+        for( TInt index(0); aCounter < end; aCounter++, index++ )
+            {
+            if( (*iSecurityInfo)[ aCounter ] != NULL )
+                {
+                CLOG_WRITE_FORMAT( "wpa info %S", (*iSecurityInfo)[ aCounter ] );
+                }
+            else
+                {
+                CLOG_WRITE( "wpa info NULL" );
+                }
+            iWpaData[ index ] = (*iSecurityInfo)[ aCounter ] ;
+            }
+        SaveWPAL( aId );
+        }
+    }
+
+
+     
+// ---------------------------------------------------------
+// WEP Security settings
+// ---------------------------------------------------------     
+
+// ---------------------------------------------------------
+// CProcessorWlan::SaveWEPL
+// ---------------------------------------------------------
+//
+void CProcessorWlan::SaveWEPL( TUint32 aIapId ) 
+    {
+    CMDBSession* session = CMDBSession::NewL( CMDBSession::LatestVersion() );
+    CleanupStack::PushL( session );
+    // Load IAP record
+    CCDIAPRecord* iapRecord = static_cast< CCDIAPRecord * >
+                        ( CCDRecordBase::RecordFactoryL( KCDTIdIAPRecord ) );
+    CleanupStack::PushL( iapRecord );
+    iapRecord->SetRecordId( aIapId );
+    iapRecord->LoadL( *session );
+   
+    // Load WLAN service table
+    // first get WLAN table id
+    CMDBGenericRecord* generic = static_cast<CMDBGenericRecord*>
+        ( CCDRecordBase::RecordFactoryL( 0 ) );
+    CleanupStack::PushL( generic );    
+    generic->InitializeL( TPtrC( WLAN_SERVICE ), NULL );
+    generic->LoadL( *session );
+    TMDBElementId wlanTableId = generic->TableId();
+    
+    CMDBField<TUint32>* sidField = static_cast<CMDBField<TUint32>*>
+                             ( generic->GetFieldByIdL( KCDTIdWlanServiceId ) );
+    
+    TInt service = iapRecord->iService;
+    // prime with service id                
+    *sidField = (TUint32)service;
+       
+    User::LeaveIfError( generic->FindL( *session ) );
+
+    // Save index of key in use
+    TUint32 keyInUse( WEPKeyInUse() );
+    CMDBField<TUint>* keyInUseField = static_cast<CMDBField<TUint>*>
+                            ( generic->GetFieldByIdL( KCDTIdWlanWepIndex ) );
+    keyInUseField->SetL( keyInUse );
+    
+    // Save authentication mode
+    TUint32 auth( WEPAuthentication() );
+    CMDBField<TUint>* authenticationField = static_cast<CMDBField<TUint>*>
+                            ( generic->GetFieldByIdL( KCDTIdWlanAuthMode ) );
+    authenticationField->SetL( auth );
+    
+    // Save WEP keys and key formats  
+    if ( WEPFieldData( EWEPKey1Data )->Length() )
+        {
+        CMDBField<TDesC8>* wepKey1Field = static_cast<CMDBField<TDesC8>*>
+                        ( generic->GetFieldByIdL( KCDTIdWlanWepKey1 ) );
+        WriteKeyL( wepKey1Field,
+                   WEPFieldData( EWEPKey1Data ),
+                   WEPKeyFormat( EWEPKey1Format ) );
+        CMDBField<TUint>* formatKey1Field = static_cast<CMDBField<TUint>*>
+                            ( generic->GetFieldByIdL( KCDTIdWlanFormatKey1 ) );
+        formatKey1Field->SetL( WEPKeyFormat( EWEPKey1Format ) );
+        }
+    if ( WEPFieldData( EWEPKey2Data )->Length() )
+        {
+        CMDBField<TDesC8>* wepKey2Field = static_cast<CMDBField<TDesC8>*>
+                        ( generic->GetFieldByIdL( KCDTIdWlanWepKey2 ) );
+        WriteKeyL( wepKey2Field,
+                   WEPFieldData( EWEPKey2Data ),
+                   WEPKeyFormat( EWEPKey2Format ) );
+        CMDBField<TUint>* formatKey2Field = static_cast<CMDBField<TUint>*>
+                            ( generic->GetFieldByIdL( KCDTIdWlanFormatKey2 ) );
+        formatKey2Field->SetL( WEPKeyFormat( EWEPKey2Format ) );
+        }
+    if ( WEPFieldData( EWEPKey3Data )->Length() )
+        {
+        CMDBField<TDesC8>* wepKey3Field = static_cast<CMDBField<TDesC8>*>
+                        ( generic->GetFieldByIdL( KCDTIdWlanWepKey3 ) );
+        WriteKeyL( wepKey3Field,
+                   WEPFieldData( EWEPKey3Data ),
+                   WEPKeyFormat( EWEPKey3Format ) );
+        CMDBField<TUint>* formatKey3Field = static_cast<CMDBField<TUint>*>
+                            ( generic->GetFieldByIdL( KCDTIdWlanFormatKey3 ) );
+        formatKey3Field->SetL( WEPKeyFormat( EWEPKey3Format ) );
+        }
+    if ( WEPFieldData( EWEPKey4Data )->Length() )
+        {
+        CMDBField<TDesC8>* wepKey4Field = static_cast<CMDBField<TDesC8>*>
+                        ( generic->GetFieldByIdL( KCDTIdWlanWepKey4 ) );
+        WriteKeyL( wepKey4Field,
+                   WEPFieldData( EWEPKey4Data ),
+                   WEPKeyFormat( EWEPKey4Format ) );
+        CMDBField<TUint>* formatKey4Field = static_cast<CMDBField<TUint>*>
+                            ( generic->GetFieldByIdL( KCDTIdWlanFormatKey4 ) );
+        formatKey4Field->SetL( WEPKeyFormat( EWEPKey4Format ) );
+        }
+    
+    generic->ModifyL( *session );
+
+    CleanupStack::PopAndDestroy( generic ); // generic
+    CleanupStack::PopAndDestroy( iapRecord ); // iapRecord
+    CleanupStack::PopAndDestroy( session ); // session
+    }
+    
+
+// ---------------------------------------------------------
+// CProcessorWlan::WriteKeyL
+// ---------------------------------------------------------
+//
+void CProcessorWlan::WriteKeyL( CMDBField<TDesC8>* aKeyField,                                
+                                HBufC16* aKey,
+                                const TInt aKeyFormat ) 
+    {
+    TBuf8<KMaxLengthOfKeyData> key;
+    
+    //convert to 8 bit
+    key.Copy( aKey->Des() );
+    
+    if ( aKeyFormat == EAscii )
+        {
+        // Must be converted to hexa and stored as a hexa
+        // Ascii key is half the length of Hex
+        HBufC8* buf8Conv = HBufC8::NewLC( key.Length() * KAsciiUnicodeRatio );
+        ConvertAsciiToHex( key, buf8Conv );
+        aKeyField->SetL( buf8Conv->Des() );
+        CleanupStack::PopAndDestroy( buf8Conv );
+        }
+    else if ( VerifyHex( key ) )
+        {
+        //already in hexa format
+        aKeyField->SetL( key );    
+        }
+    else
+        {
+        CLOG_WRITE( "! Error : Invalid hexadecimal format" )
+        }
+    }
+    
+// ---------------------------------------------------------
+// CProcessorWlan::WEPFieldData
+// ---------------------------------------------------------
+//
+HBufC16* CProcessorWlan::WEPFieldData( TDbCreatorWEPFields aFieldId ) 
+    {
+    TInt index = WEPIndex( aFieldId );
+    if( iWepData[ index ] == NULL )
+        {
+        return iEmptyTag;
+        }
+    else
+        {
+        return iWepData[ index ];
+        }
+    }
+    
+// ---------------------------------------------------------
+// CProcessorWlan::WEPAuthentication
+// ---------------------------------------------------------
+//   
+TInt CProcessorWlan::WEPAuthentication()
+    {
+    HBufC16* authTypeStr = WEPFieldData( EWEPAuthType );
+    TInt authType ( EAuthOpen ) ;
+    
+    _LIT16( KStrOpen,   "Open" );  
+    _LIT16( KStrShared, "Shared" );
+    
+    if ( authTypeStr->CompareF( KStrOpen ) == 0 )
+        {
+        //CLOG_WRITE( "Authentication type : Open" )
+        }
+    else if ( authTypeStr->CompareF( KStrShared ) == 0 )
+        {
+        //CLOG_WRITE( "Authentication type : Shared" )
+        authType = EAuthShared;
+        }
+    else 
+        {
+        //aField is either empty or invalid
+        authType = KErrNotFound;
+        }
+        
+    return authType;
+    }
+
+// ---------------------------------------------------------
+// CProcessorWlan::WEPKeyInUse
+// ---------------------------------------------------------
+//
+TInt CProcessorWlan::WEPKeyInUse()
+    {  
+    HBufC16* keyStr = WEPFieldData( EWEPKeyInUse );
+    TInt key ( EKeyNumber1 ) ;
+    
+    _LIT16( KStrKey1,   "key1" );  
+    _LIT16( KStrKey2,   "key2" );
+    _LIT16( KStrKey3,   "key3" );
+    _LIT16( KStrKey4,   "key4" );
+    
+    if ( keyStr->CompareF( KStrKey1 ) == 0 )
+        {
+        //CLOG_WRITE( "WEP key in use : key 1" )
+        }
+    else if ( keyStr->CompareF( KStrKey2 ) == 0 )
+        {
+        //CLOG_WRITE( "WEP key in use : key 2" )
+        key = EKeyNumber2;
+        }
+    else if ( keyStr->CompareF( KStrKey3 ) == 0 )
+        {
+        //CLOG_WRITE( "WEP key in use : key 3" )
+        key = EKeyNumber3;
+        }
+    else if ( keyStr->CompareF( KStrKey4 ) == 0 )
+        {
+        //CLOG_WRITE( "WEP key in use : key 4" )
+        key = EKeyNumber4;
+        }
+    else 
+        {
+        //aField is either empty or invalid
+        key = KErrNotFound;
+        }
+        
+    return key;
+    }
+
+
+    
+// ---------------------------------------------------------
+// CProcessorWlan::WEPKeyFormat
+// ---------------------------------------------------------
+// 
+TInt CProcessorWlan::WEPKeyFormat(  TDbCreatorWEPFields aFieldId  )
+    {
+    __ASSERT_ALWAYS( ( aFieldId == EWEPKey1Format || 
+                       aFieldId == EWEPKey2Format ||
+                       aFieldId == EWEPKey3Format ||
+                       aFieldId == EWEPKey4Format ),
+                     User::Panic ( KPanicOutOfRange, KErrOutOfRange ) );
+                    
+    HBufC16* keyFormatStr = WEPFieldData( aFieldId );
+    TWEPKeyFormat keyFormat ( EAscii ) ;
+    
+    _LIT16( KStrAscii,       "Ascii" );  
+    _LIT16( KStrHexadecimal, "Hexadecimal" );
+    
+    if ( keyFormatStr->CompareF( KStrAscii ) == 0 )
+        {
+        //CLOG_WRITE( "Key format : Ascii" )
+        }
+    else if ( keyFormatStr->CompareF( KStrHexadecimal ) == 0 )
+        {
+        //CLOG_WRITE( "Key format : Hexadecimal" )
+        keyFormat = EHexadecimal;
+        }
+    else 
+        {
+        CLOG_WRITE( "! Error : Invalid key format. Default:Ascii" )
+        }
+        
+    return keyFormat;
+    }
+    
+// ---------------------------------------------------------
+// CProcessorWlan::WEPKeyLength
+// ---------------------------------------------------------
+// 
+TWEPKeyLength CProcessorWlan::WEPKeyLength(  TDbCreatorWEPFields aFieldId  )
+    {
+    __ASSERT_ALWAYS( ( aFieldId == EWEPKey1Length || 
+                       aFieldId == EWEPKey2Length ||
+                       aFieldId == EWEPKey3Length ||
+                       aFieldId == EWEPKey4Length ),
+                     User::Panic ( KPanicOutOfRange, KErrOutOfRange ) );
+                    
+    HBufC16* keyLengthStr = WEPFieldData( aFieldId );
+    TWEPKeyLength keyLen ( E40Bits ) ;
+    
+    _LIT16( KStr64,       "64" );  
+    _LIT16( KStr128,      "128" );
+    _LIT16( KStr256,      "256" );
+    
+    if ( keyLengthStr->CompareF( KStr64 ) == 0 )
+        {
+        //CLOG_WRITE( "Key length : 64" )
+        }
+    else if ( keyLengthStr->CompareF( KStr128 ) == 0 )
+        {
+        //CLOG_WRITE( "Key length : 128" )
+        keyLen = E104Bits;
+        }
+    else if ( keyLengthStr->CompareF( KStr256 ) == 0 )
+        {
+        //CLOG_WRITE( "Key length : 256" )
+        keyLen = E232Bits;
+        }
+    else 
+        {
+        CLOG_WRITE( "! Error : Invalid key length. Default:64" )
+        }
+        
+    return keyLen;
+    }
+    
+// ---------------------------------------------------------
+// CProcessorWlan::WEPKeyValidLen
+// ---------------------------------------------------------
+//     
+TInt CProcessorWlan::WEPKeyValidLen(TInt aFormat , TWEPKeyLength aLen )
+    {
+    __ASSERT_ALWAYS( aFormat == EAscii || aFormat == EHexadecimal, 
+                     User::Panic ( KPanicOutOfRange, KErrOutOfRange ) );
+                     
+    __ASSERT_ALWAYS( aLen == E40Bits || aLen == E104Bits || aLen == E232Bits,
+                     User::Panic ( KPanicOutOfRange, KErrOutOfRange ) );
+                     
+    TInt len( 0 );
+    
+    switch ( aFormat )
+        {
+        case EAscii:
+            switch ( aLen )
+                {
+                case E40Bits :  len = KKeyDataLength40Bits /
+                                                        KAsciiUnicodeRatio;
+                    break;
+                case E104Bits : len = KKeyDataLength104Bits /
+                                                        KAsciiUnicodeRatio;
+                    break;
+                case E232Bits : len = KKeyDataLength232Bits /
+                                                        KAsciiUnicodeRatio;  
+                }
+            break;
+        case EHexadecimal:
+            switch ( aLen )
+                {
+                case E40Bits :  len = KKeyDataLength40Bits;
+                    break;
+                case E104Bits : len = KKeyDataLength104Bits;
+                    break;
+                case E232Bits : len = KKeyDataLength232Bits;
+                }
+        }
+        
+    return len;
+    }
+
+// ---------------------------------------------------------
+// CProcessorWlan::WEPIndex
+// ---------------------------------------------------------
+//       
+TInt CProcessorWlan::WEPIndex( TDbCreatorWEPFields aFieldId )
+    {
+    __ASSERT_ALWAYS( aFieldId >= EWEPKeyInUse && aFieldId <= EWEPKey4Data, 
+                     User::Panic ( KPanicOutOfRange, KErrOutOfRange ) );
+                     
+    return aFieldId - 0x1000 + iDataStart;                     
+                     
+    ////return iWEPIndex[ aFieldId - 0x1000 ];
+    }
+
+// ---------------------------------------------------------
+// CProcessorWlan::WEPFieldValidate
+// ---------------------------------------------------------
+//   
+TBool CProcessorWlan::WEPFieldValidate()
+    {
+    TBool valid (ETrue);
+    
+    if ( ( WEPAuthentication() == KErrNotFound ) ||
+         ( WEPKeyInUse() == KErrNotFound ) )
+        {
+        valid = EFalse;
+        }
+    else
+        {
+        //gets the actual keylength
+        TInt keyLen[ KMaxNumberofKeys ] = { 0,0,0,0 };
+       
+        keyLen[EKeyNumber1] = WEPFieldData( EWEPKey1Data )->Length();
+        keyLen[EKeyNumber2] = WEPFieldData( EWEPKey2Data )->Length();
+        keyLen[EKeyNumber3] = WEPFieldData( EWEPKey3Data )->Length();
+        keyLen[EKeyNumber4] = WEPFieldData( EWEPKey4Data )->Length();
+
+
+        //check validity of key1 length
+        TInt validLen = WEPKeyValidLen( WEPKeyFormat( EWEPKey1Format ), 
+                                        WEPKeyLength( EWEPKey1Length ) );
+        if ( keyLen[EKeyNumber1] && keyLen[EKeyNumber1] != validLen) 
+            {
+            valid = EFalse;
+            CLOG_WRITE_FORMAT( "! Error : Key1 length is invalid %d", 
+                                        keyLen[EKeyNumber1] );
+            CLOG_WRITE_FORMAT( "ValidLen1: %d \n", validLen );
+            }
+        else if ( keyLen[EKeyNumber2] )
+            {    
+            //check validity of key2 length
+            validLen = WEPKeyValidLen( WEPKeyFormat( EWEPKey2Format ), 
+                                       WEPKeyLength( EWEPKey2Length ) );
+            if ( keyLen[EKeyNumber2] != validLen )
+                {
+                valid = EFalse;
+                CLOG_WRITE_FORMAT( "! Error : Key2 length is invalid %d", 
+                                            keyLen[EKeyNumber2] )
+                CLOG_WRITE_FORMAT( "ValidLen2: %d \n", validLen );
+                }
+            else if ( keyLen[EKeyNumber3] )
+                {
+                //check validity of key3 length
+                validLen = WEPKeyValidLen( WEPKeyFormat( EWEPKey3Format ), 
+                                           WEPKeyLength( EWEPKey3Length ) );
+                if ( keyLen[EKeyNumber3] != validLen )
+                    {
+                    valid = EFalse;
+                    CLOG_WRITE_FORMAT( "! Error : Key3 length is invalid %d", 
+                                                keyLen[EKeyNumber3] );
+                    CLOG_WRITE_FORMAT( "ValidLen3: %d \n", validLen );
+                    }
+                else if ( keyLen[EKeyNumber4] )
+                    {
+                    //check validity of key4 length
+                    validLen = WEPKeyValidLen( WEPKeyFormat( EWEPKey4Format ), 
+                                           WEPKeyLength( EWEPKey4Length ) );
+                    if ( keyLen[EKeyNumber4] != validLen )
+                        {
+                        valid = EFalse;
+                        CLOG_WRITE_FORMAT( "! Error : Key4 length is invalid %d", 
+                                                    keyLen[EKeyNumber4] );
+                        CLOG_WRITE_FORMAT( "ValidLen4: %d \n", validLen );
+                        }//if
+                    }//else                
+                }//else
+            }//else
+        }//else
+        
+    return valid;
+    }
+
+//----------------------------------------------------------
+// CProcessorWlan::ConvertAsciiToHex
+//----------------------------------------------------------
+//
+void CProcessorWlan::ConvertAsciiToHex( const TDesC8& aSource, 
+                                              HBufC8*& aDest )
+	{
+	_LIT( hex, "0123456789ABCDEF" );
+	TInt size = aSource.Size();
+	TPtr8 ptr = aDest->Des();
+	for ( TInt ii = 0; ii < size; ii++ )
+		{
+		TText8 ch = aSource[ii];
+		ptr.Append( hex()[(ch/16)&0x0f] );
+		ptr.Append( hex()[ch&0x0f] );
+		}
+	}
+		
+//----------------------------------------------------------
+// CWEPSecuritySettingsDlg::VerifyHex
+//----------------------------------------------------------
+//
+TBool CProcessorWlan::VerifyHex( const TDesC8& aHex )
+    {
+    TBool err( ETrue );
+    
+    for ( TInt i = 0; i < aHex.Length(); i++ )
+        {
+        TChar c( aHex[i] );
+
+        if ( !c.IsHexDigit() ) 
+            {
+            err = EFalse;
+            break;
+            }
+        }
+
+    return err;
+    }
+   
+    
+// ---------------------------------------------------------
+// WPA Security settings
+// ---------------------------------------------------------
+
+
+// ---------------------------------------------------------
+// CProcessorWlan::SaveWPAL
+// ---------------------------------------------------------
+//
+void CProcessorWlan::SaveWPAL( TUint32 aIapId )
+    {
+    CLOG_WRITE( "CProcessorWlan::SaveWPAL enter" );
+    CMDBSession* session = CMDBSession::NewL( CMDBSession::LatestVersion() );
+    CleanupStack::PushL( session );
+    
+    // Load IAP record
+    CCDIAPRecord* iapRecord = static_cast<CCDIAPRecord *>
+                        ( CCDRecordBase::RecordFactoryL( KCDTIdIAPRecord ) );
+    CleanupStack::PushL( iapRecord );
+    iapRecord->SetRecordId( aIapId );
+    iapRecord->LoadL( *session );
+    
+    // Load WLAN service table
+    // first get WLAN table id
+    CMDBGenericRecord* generic = static_cast<CMDBGenericRecord*>
+        ( CCDRecordBase::RecordFactoryL( 0 ) );
+    CleanupStack::PushL( generic );
+        
+    generic->InitializeL( TPtrC( WLAN_SERVICE ), NULL );
+    generic->LoadL( *session );
+    TMDBElementId wlanTableId = generic->TableId();
+    CMDBField<TUint32>* sidField = static_cast<CMDBField<TUint32>*>
+                             ( generic->GetFieldByIdL( KCDTIdWlanServiceId ) );
+    
+    TInt service = iapRecord->iService;
+    // prime with service id                
+    *sidField = (TUint32)service;
+    
+    User::LeaveIfError( generic->FindL( *session ) );
+       
+    // Set WPA mode
+    CMDBField<TUint>* enableWpaPskField = static_cast<CMDBField<TUint>*>
+                            ( generic->GetFieldByIdL( KCDTIdWlanEnableWpaPsk ) );
+                            
+    enableWpaPskField->SetL( WPAPresharedKeyInUse() );
+	
+	CLOG_WRITE( "Wrote enableWpaPskField" );
+    
+    // Set security mode
+    CMDBField<TUint>* secModeField = static_cast<CMDBField<TUint>*>
+                        ( generic->GetFieldByIdL( KCDTIdWlanSecMode ) );
+    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
+    TBuf8<KMaxLengthOfKeyData> keyWPA;
+    //convert to 8 bit
+    keyWPA.Copy( WPAFieldData( EWPAPresharedKey )->Des() );
+    CMDBField<TDesC8>* wpaPskField = static_cast<CMDBField<TDesC8>*>
+                        ( generic->GetFieldByIdL( KCDTIdWlanWpaPreSharedKey ) );
+    wpaPskField->SetL( keyWPA );
+    
+    CLOG_WRITE( "Wrote pre-shared key" );
+    if ( keyWPA.Length() < 8 )
+        {
+        CLOG_WRITE( "Error: WPA pre-shared key is less then 8 chars." );	        
+        }
+
+    // Check and save PreShared Key Length
+    TInt len( WPAKeyLength() );
+    if ( len != keyWPA.Length() )
+        {
+        CLOG_WRITE( "! Error : WPA key lengths do not match" );
+        }
+    
+    CMDBField<TUint>* keyLengthField = static_cast<CMDBField<TUint>*>
+                        ( generic->GetFieldByIdL( KCDTIdWlanWpaKeyLength ) );
+    keyLengthField->SetL( len );
+    
+    generic->ModifyL( *session );
+    
+    CleanupStack::PopAndDestroy( generic ); 
+    CleanupStack::PopAndDestroy( iapRecord );
+    CleanupStack::PopAndDestroy( session );
+    CLOG_WRITE( "CProcessorWlan::SaveWPAL exit" );
+    }
+
+// ---------------------------------------------------------
+// CProcessorWlan::SetExpandedEapListL
+// ---------------------------------------------------------
+//
+void CProcessorWlan::SetExpandedEapListL( CMDBGenericRecord* generic )
+    {
+    // Gets the text format eap list
+    HBufC16* eapList = WPAFieldData( EWPAListOfEAPs );
+    
+    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
+        CMDBField<TDesC8>* wlanEnabledEapsField = static_cast<CMDBField<TDesC8>*>
+                                ( generic->GetFieldByIdL( KCDTIdWlanEnabledEaps ) );
+        wlanEnabledEapsField->SetL( enabledEapList->Des() );
+
+        // Save disabled EAP list
+        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
+// ---------------------------------------------------------
+//       
+TInt CProcessorWlan::WPAIndex( TDbCreatorWPAFields aFieldId )
+    {
+    __ASSERT_ALWAYS( aFieldId >= EWPAPresharedKey && aFieldId <= EWPAUseOfPresharedKey, 
+                     User::Panic ( KPanicOutOfRange, KErrOutOfRange ) );
+                     
+    return aFieldId - 0x2000 + iDataStart;                     
+    }
+    
+    
+// ---------------------------------------------------------
+// CProcessorWlan::WPAFieldData
+// ---------------------------------------------------------
+//
+HBufC16* CProcessorWlan::WPAFieldData( TDbCreatorWPAFields aFieldId ) 
+    {
+    TInt index = WPAIndex( aFieldId );
+    if( iWpaData[ index ] == NULL )
+        {
+        return iEmptyTag;
+        }
+    else
+        {
+        return iWpaData[ index ];
+        }
+    }
+    
+// ---------------------------------------------------------
+// CProcessorWlan::WPAPresharedKeyInUse
+// ---------------------------------------------------------
+//
+TBool CProcessorWlan::WPAPresharedKeyInUse()
+    {
+    HBufC16* useStr = WPAFieldData( EWPAUseOfPresharedKey );   
+
+    TBool usePSK ( EFalse ) ;
+    
+    if ( useStr->CompareF( KStrYes ) == 0 )
+        {
+        CLOG_WRITE( "Preshared key in use" )
+        usePSK = ETrue;
+        }
+    else if ( useStr->CompareF( KStrNo ) == 0 )
+        {
+        CLOG_WRITE( "Preshared key not in use" );
+        }
+    else 
+        {
+        //aField is either empty or invalid
+        CLOG_WRITE( "! Error : Invalid Use WPA preshared key. Default:No" );
+        }
+        
+    return usePSK;
+    }
+    
+// ---------------------------------------------------------
+// CProcessorWlan::WPAKeyLength
+// ---------------------------------------------------------
+//
+TInt CProcessorWlan::WPAKeyLength() 
+    {
+    HBufC16* tag = WPAFieldData( EWPAKeyLength );   
+    
+    TInt num( 0 );
+    TLex parser( tag->Des() );
+
+    if ( parser.Val( num ) != KErrNone )
+        {
+        CLOG_WRITE( "! Error : Invalid input : WPA key length" );
+        }
+        
+    return num;
+    }
+
+// ---------------------------------------------------------
+// CProcessorWlan::AddSecurityDataL
+// ---------------------------------------------------------
+//   
+void CProcessorWlan::AddSecurityDataL( TInt aField, HBufC* aPtrTag, TBool aIsWep )
+    {
+    if( aIsWep )
+        {
+        iWepData[ WEPIndex( (TDbCreatorWEPFields)aField ) ] = aPtrTag->AllocL();
+        ////iWepData.Insert( aPtrTag->AllocL(), WEPIndex( (TDbCreatorWEPFields)aField ) );
+        }
+    else    
+        {
+        iWpaData[ WPAIndex( (TDbCreatorWPAFields)aField ) ] = aPtrTag->AllocL();
+        ////iWpaData.Insert( aPtrTag->AllocL(), WPAIndex( (TDbCreatorWPAFields)aField ) );
+        }
+    }        
+        
+// ---------------------------------------------------------
+// CProcessorWlan::DoLogL
+// ---------------------------------------------------------
+//
+void CProcessorWlan::DoLogL()
+    {
+    // Writes some data of the actual WLAN access point into the log file.
+    HBufC16* tmp;
+    RCmConnectionMethodExt& plugin = GetLastPluginL();
+
+    // Writes some data of the Internet acces point into the log file.
+    if ( iIsEasyWlan )
+        {
+        CLOG_WRITE( "Easy WLAN Access Point created:" )
+        }
+    else
+        {
+        CLOG_WRITE( "WLAN Access Point created:" )
+        }
+        
+    CLOG_WRITE_FORMAT( "\t Connection name in array: %S ", 
+                        (*iPluginName)[ PluginCount() - 1] );  
+        
+    tmp = plugin.GetStringAttributeL( ECmName );
+    if( tmp )
+        {
+        CleanupStack::PushL( tmp );
+        CLOG_WRITE_FORMAT( "\t Connection name: %S ", tmp )
+        CleanupStack::PopAndDestroy( tmp );
+        }
+
+    // For the WLAN network name
+    tmp = plugin.GetStringAttributeL( EWlanSSID );
+    if( tmp )
+        {
+        CleanupStack::PushL( tmp );
+        CLOG_WRITE_FORMAT( "\t Network name: %S", tmp )
+        CleanupStack::PopAndDestroy( tmp );
+        }
+    CLOG_WRITE( "\t \r\n" )
+    }
+
+
+// ---------------------------------------------------------
+// CProcessorWlan::Reset
+// ---------------------------------------------------------
+//
+void CProcessorWlan::Reset()
+    {
+    for( TInt i = 0; i < KWEPKeyNumOfFields; i++ )
+        {
+        iWepData[i] = NULL;
+        }
+    for( TInt i = 0; i < KWPAKeyNumOfFields; i++ )
+        {
+        iWpaData[i] = NULL;
+        }
+    }
+    
+// ---------------------------------------------------------
+// CProcessorWlan::EAPSetting
+// ---------------------------------------------------------
+//
+TBool CProcessorWlan::EAPSetting( const TInt aField )
+	{
+	// Checks if the supplied field is EAP settings and returns ETrue if it is
+	if ( aField > EEapParameterFirst
+		 && aField < EEapParameterLast )
+		{
+		return ETrue;
+		}
+	else
+		{
+		return EFalse;
+		}
+	}
+// ---------------------------------------------------------
+// CProcessorWlan::GetEapTypeIdFromSettingId
+// ---------------------------------------------------------
+//
+EAPSettings::TEapType CProcessorWlan::GetEapTypeIdFromSettingId( const TInt aField )
+	{
+	switch ( aField )
+		{
+		case EEapGtcUsername:
+		case EEapGtcSessionValidityTime:
+		case EEapGtcEncapsulation:
+			{
+			return EAPSettings::EEapGtc;
+			}
+		case EEapTlsUsername:
+		case EEapTlsRealm:
+		case EEapTlsVerifyServerRealm:
+		case EEapTlsRequireClientAuth:
+		case EEapTlsSessionValidityTime:
+		case EEapTlsCipherSuites:
+		case EEapTlsUserCertSubjectKeyId:
+		case EEapTlsUserCertIssuerName:
+		case EEapTlsUserCertSerialNumber:
+		case EEapTlsCaCertSubjectKeyId:
+		case EEapTlsCaCertIssuerName:
+		case EEapTlsCaCertSerialNumber:
+		case EEapTlsEncapsulation:
+			{
+			return EAPSettings::EEapTls;
+			}
+		case EEapLeapUsername:
+		case EEapLeapPassword:
+		case EEapLeapSessionValidityTime:
+			{
+			return EAPSettings::EEapLeap;
+			}
+		case EEapSimUsername:
+		case EEapSimRealm:
+		case EEapSimUsePseudonyms:
+		case EEapSimSessionValidityTime:
+		case EEapSimEncapsulation:
+			{
+			return EAPSettings::EEapSim;
+			}
+		case EEapTtlsUsername:
+		case EEapTtlsRealm:
+		case EEapTtlsVerifyServerRealm:
+		case EEapTtlsRequireClientAuth:
+		case EEapTtlsSessionValidityTime:
+		case EEapTtlsCipherSuites:
+		case EEapTtlsEncapsulatedTypes:
+		case EEapTtlsUserCertSubjectKeyId:
+		case EEapTtlsUserCertIssuerName:
+		case EEapTtlsUserCertSerialNumber:
+		case EEapTtlsCaCertSubjectKeyId:
+		case EEapTtlsCaCertIssuerName:
+		case EEapTtlsCaCertSerialNumber:
+			{
+			return EAPSettings::EEapTtls;
+			}
+		case EEapAkaUsername:
+		case EEapAkaRealm:
+		case EEapAkaUsePseudonyms:
+		case EEapAkaSessionValidityTime:
+		case EEapAkaEncapsulation:
+			{
+			return EAPSettings::EEapAka;
+			}
+		case EEapPeapUsername:
+		case EEapPeapRealm:
+		case EEapPeapVerifyServerRealm:
+		case EEapPeapRequireClientAuth:
+		case EEapPeapSessionValidityTime:
+		case EEapPeapCipherSuites:
+		case EEapPeapV0Allowed:
+		case EEapPeapV1Allowed:
+		case EEapPeapV2Allowed:
+		case EEapPeapEncapsulatedTypes:
+		case EEapPeapUserCertSubjectKeyId:
+		case EEapPeapUserCertIssuerName:
+		case EEapPeapUserCertSerialNumber:
+		case EEapPeapCaCertSubjectKeyId:
+		case EEapPeapCaCertIssuerName:
+		case EEapPeapCaCertSerialNumber:		
+			{
+			return EAPSettings::EEapPeap;
+			}
+		case EEapMschapv2Username:
+		case EEapMschapv2Password:
+		case EEapMschapv2SessionValidityTime:
+		case EEapMschapv2Encapsulation:
+			{
+			return EAPSettings::EEapMschapv2;
+			}
+		case EEapFastUsername:
+		case EEapFastRealm:
+		case EEapFastVerifyServerRealm:
+		case EEapFastRequireClientAuth:
+		case EEapFastSessionValidityTime:
+		case EEapFastCipherSuites:
+		case EEapFastEncapsulatedTypes:
+		case EEapFastAuthProvModeAllowed:
+		case EEapFastUnauthProvModeAllowed:
+		case EEapFastWarnADHPNoPAC:
+		case EEapFastWarnADHPNoMatchingPAC:
+		case EEapFastWarnNotDefaultServer:
+		case EEapFastUserCertSubjectKeyId:
+		case EEapFastUserCertIssuerName:
+		case EEapFastUserCertSerialNumber:
+		case EEapFastCaCertSubjectKeyId:
+		case EEapFastCaCertIssuerName:
+		case EEapFastCaCertSerialNumber:
+			{
+			return EAPSettings::EEapFast; 
+			}
+		
+		case EMschapv2Username:
+		case EMschapv2Password:
+		case EMschapv2SessionValidityTime:
+		case EMschapv2Encapsulation:
+			{
+			return EAPSettings::EPlainMschapv2;
+			}
+		default:
+			{
+			return EAPSettings::EEapNone;
+			}
+		
+		}
+	}
+// ---------------------------------------------------------
+// CProcessorWlan::AddEAPSetting
+// ---------------------------------------------------------
+//
+void CProcessorWlan::AddEAPSettingL( const TInt aField, const HBufC16* const aValue  )
+    {
+    EAPSettings::TEapType eapId = GetEapTypeIdFromSettingId( aField );
+    if ( eapId == EAPSettings::EEapNone )
+    	{
+    	CLOG_WRITE( "! Error : Unknown EAP method" );
+    	User::Leave( KErrArgument ); 
+    	}
+    
+	TInt eapIndex(0);
+	// Search if the EAP instance already exists in the array for this
+	for ( eapIndex = 0 ; eapIndex < iEapSettings.Count() ; eapIndex++ )
+		{       				
+		if ( ( iEapSettings[eapIndex]->iEapSettings->iEAPType == eapId )
+			 && ( iEapSettings[eapIndex]->iName != NULL ) 
+			 && ( iEapSettings[eapIndex]->iName->Compare( *iName ) == 0 ))        					 	
+		 	{       				
+		 	// Found it
+		 	break;
+		 	}
+		}
+		
+	if ( eapIndex == iEapSettings.Count() )
+		{
+		// Not found. Create new
+		CEapTypeElement* newEap = new (ELeave) CEapTypeElement;
+		CleanupStack::PushL( newEap );
+		
+		newEap->iEapSettings = new (ELeave) EAPSettings;
+		
+		newEap->iEapSettings->iEAPType = eapId;
+		
+		newEap->iName = iName->AllocL();                           
+		               	    	
+		iEapSettings.AppendL(newEap);
+		
+		CleanupStack::Pop( newEap );
+		
+		// Set the index to the newly created EAP settings instance
+		eapIndex = iEapSettings.Count() - 1;
+		
+		}
+	switch ( aField )
+		{
+		case EEapGtcUsername:
+		case EEapTlsUsername:
+		case EEapLeapUsername:
+		case EEapSimUsername:
+		case EEapTtlsUsername:
+		case EEapAkaUsername:
+		case EEapPeapUsername:
+		case EEapMschapv2Username:
+		case EEapFastUsername:
+		case EMschapv2Username:
+			{
+			iEapSettings[eapIndex]->iEapSettings->iUsernamePresent = ETrue;
+			iEapSettings[eapIndex]->iEapSettings->iUsername.Copy( *aValue );
+			break;
+			}
+			
+		case EEapLeapPassword:
+		case EEapMschapv2Password:
+		case EMschapv2Password:
+			{
+			iEapSettings[eapIndex]->iEapSettings->iPasswordPresent = ETrue;
+			iEapSettings[eapIndex]->iEapSettings->iPassword.Copy( *aValue );			
+			break;
+			}
+
+		case EEapTlsRealm:
+		case EEapSimRealm:
+		case EEapTtlsRealm:
+		case EEapAkaRealm:
+		case EEapPeapRealm:
+		case EEapFastRealm:
+			{
+			iEapSettings[eapIndex]->iEapSettings->iRealmPresent = ETrue;
+			iEapSettings[eapIndex]->iEapSettings->iRealm.Copy( *aValue );			
+			break;
+			}
+				
+		case EEapGtcSessionValidityTime:
+		case EEapTtlsSessionValidityTime:
+		case EEapTlsSessionValidityTime:
+		case EEapSimSessionValidityTime:
+		case EEapLeapSessionValidityTime:
+		case EMschapv2SessionValidityTime:
+		case EEapAkaSessionValidityTime:
+		case EEapPeapSessionValidityTime:
+		case EEapMschapv2SessionValidityTime:
+		case EEapFastSessionValidityTime:
+			{
+		    // Convert the input parameter to integer
+	    	TLex lex( *aValue );
+			TUint value( 0 );
+			if( lex.Val( value, EDecimal) != KErrNone )
+				{				
+				CLOG_WRITE_FORMAT( "! Error : Invalid session validity time value. EapId: %d", eapId );
+				User::Leave( KErrArgument );
+				}			
+
+			iEapSettings[eapIndex]->iEapSettings->iSessionValidityTimePresent = ETrue;
+			iEapSettings[eapIndex]->iEapSettings->iSessionValidityTime = value;
+			break;
+			}
+				
+		case EEapGtcEncapsulation:
+		case EEapTlsEncapsulation:
+		case EEapSimEncapsulation:
+		case EEapAkaEncapsulation:
+		case EEapMschapv2Encapsulation:
+		case EMschapv2Encapsulation:
+			{
+			TLex lex( *aValue );				
+			TUint eapTypeId( 0 );						
+			if( lex.Val( eapTypeId, EDecimal) != KErrNone )
+				{
+				CLOG_WRITE_FORMAT( "! Error : Invalid encapsulation value. EapId: %d", eapId );
+				User::Leave( KErrArgument );
+				}			
+
+			iEapSettings[eapIndex]->iEncapsulatingEapId = static_cast< EAPSettings::TEapType >( eapTypeId );
+			break;
+			}
+		
+		case EEapTlsVerifyServerRealm:
+		case EEapTtlsVerifyServerRealm:
+		case EEapPeapVerifyServerRealm:
+		case EEapFastVerifyServerRealm:
+			{
+            if ( !aValue->CompareF( KStrYes ) )
+                {
+				iEapSettings[eapIndex]->iEapSettings->iVerifyServerRealmPresent = ETrue;
+				iEapSettings[eapIndex]->iEapSettings->iVerifyServerRealm = ETrue;
+                }
+            else if ( !aValue->CompareF( KStrNo ) )
+                {
+                iEapSettings[eapIndex]->iEapSettings->iVerifyServerRealmPresent = ETrue;
+				iEapSettings[eapIndex]->iEapSettings->iVerifyServerRealm = EFalse;
+                }
+            else 
+                {                
+                CLOG_WRITE_FORMAT( "! Error : Invalid VerifyServerRealm. EapId: %d", eapId );                
+                User::Leave( KErrArgument );
+                }
+
+			break;
+			}
+						
+		case EEapTlsRequireClientAuth:
+		case EEapTtlsRequireClientAuth:		
+		case EEapPeapRequireClientAuth:
+		case EEapFastRequireClientAuth:
+			{
+            if ( !aValue->CompareF( KStrYes ) )
+                {
+				iEapSettings[eapIndex]->iEapSettings->iRequireClientAuthenticationPresent = ETrue;
+				iEapSettings[eapIndex]->iEapSettings->iRequireClientAuthentication = ETrue;
+                }
+            else if ( !aValue->CompareF( KStrNo ) )
+                {
+                iEapSettings[eapIndex]->iEapSettings->iRequireClientAuthenticationPresent = ETrue;
+				iEapSettings[eapIndex]->iEapSettings->iRequireClientAuthentication = EFalse;
+                }
+            else 
+                {                
+                CLOG_WRITE_FORMAT( "! Error : Invalid RequireClientAuth. EapId: %d", eapId );                
+                User::Leave( KErrArgument );
+                }
+			
+			break;
+			}
+		
+		case EEapTlsCipherSuites:
+		case EEapTtlsCipherSuites:
+		case EEapPeapCipherSuites:
+		case EEapFastCipherSuites:
+			{
+			TRAPD( err, FillCipherSuitesL( aValue, eapIndex ) );
+			if( err != KErrNone )
+				{
+				CLOG_WRITE_FORMAT( "! Error : Invalid CipherSuites. EapId: %d", eapId );
+				User::Leave( KErrArgument );
+				}
+			break;
+			}
+		
+		case EEapTlsUserCertSubjectKeyId:
+		case EEapTtlsUserCertSubjectKeyId:
+		case EEapPeapUserCertSubjectKeyId:
+		case EEapFastUserCertSubjectKeyId:
+			{
+			TInt certIndex = FindCertificateEntryL( CertificateEntry::EUser, eapIndex );
+
+			TBuf<KKeyIdentifierLength> key;
+			
+			TRAPD( err, ConvertSubjectKeyIdToBinaryL( aValue, key) );
+			if( err != KErrNone )
+				{
+				CLOG_WRITE_FORMAT( "! Error : Invalid UserCertSubjectKeyId. EapId: %d", eapId );
+				User::Leave( KErrArgument );
+				}
+   			
+   			iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue;
+			iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iSubjectKeyID.Copy(key);
+   			iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iSubjectKeyIDPresent = ETrue;
+			break;
+			}
+		
+		case EEapTlsUserCertIssuerName:
+		case EEapTtlsUserCertIssuerName:
+		case EEapPeapUserCertIssuerName:
+		case EEapFastUserCertIssuerName:
+			{
+			TUint certIndex = FindCertificateEntryL( CertificateEntry::EUser, eapIndex );
+			
+			iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue;
+			iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iIssuerNamePresent= ETrue;
+	 		iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iIssuerName.Copy( *aValue );			
+			break;
+			}
+		
+		case EEapTlsUserCertSerialNumber:
+		case EEapTtlsUserCertSerialNumber:
+		case EEapPeapUserCertSerialNumber:
+		case EEapFastUserCertSerialNumber:
+			{
+			TUint certIndex = FindCertificateEntryL( CertificateEntry::EUser, eapIndex );
+			
+			iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue;
+			iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iSerialNumberPresent= ETrue;
+	 		iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iSerialNumber.Copy( *aValue );			
+			break;
+			}
+		
+		case EEapTlsCaCertSubjectKeyId:
+		case EEapTtlsCaCertSubjectKeyId:
+		case EEapPeapCaCertSubjectKeyId:
+		case EEapFastCaCertSubjectKeyId:
+			{
+			TInt certIndex = FindCertificateEntryL( CertificateEntry::ECA, eapIndex );
+
+			TBuf<KKeyIdentifierLength> key;
+			
+			TRAPD( err, ConvertSubjectKeyIdToBinaryL( aValue, key) );
+			if( err != KErrNone )
+				{
+				CLOG_WRITE_FORMAT( "! Error : Invalid UserCertSubjectKeyId. EapId: %d", eapId );
+				User::Leave( KErrArgument );
+				}
+
+			iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue;
+			iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iSubjectKeyID.Copy(key);   			
+   			iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iSubjectKeyIDPresent = ETrue;
+			break;
+			}
+		
+		case EEapTlsCaCertIssuerName:
+		case EEapTtlsCaCertIssuerName:		
+		case EEapPeapCaCertIssuerName:
+		case EEapFastCaCertIssuerName:
+			{
+			TUint certIndex = FindCertificateEntryL( CertificateEntry::ECA, eapIndex );
+			iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue;
+			iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iIssuerNamePresent= ETrue;
+	 		iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iIssuerName.Copy( *aValue );			
+			
+			break;
+			}
+		
+		case EEapTlsCaCertSerialNumber:
+		case EEapTtlsCaCertSerialNumber:		
+		case EEapPeapCaCertSerialNumber:
+		case EEapFastCaCertSerialNumber:
+			{
+			TUint certIndex = FindCertificateEntryL( CertificateEntry::ECA, eapIndex );
+			iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue;
+			iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iSerialNumberPresent= ETrue;
+	 		iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iSerialNumber.Copy( *aValue );
+			break;
+			}
+		
+		case EEapSimUsePseudonyms:
+		case EEapAkaUsePseudonyms:
+			{
+            if ( !aValue->CompareF( KStrYes ) )
+	            {
+				iEapSettings[eapIndex]->iEapSettings->iUsePseudonymsPresent = ETrue;
+				iEapSettings[eapIndex]->iEapSettings->iUsePseudonyms = ETrue;
+	            }
+	        else if ( !aValue->CompareF( KStrNo ) )
+	            {
+	            iEapSettings[eapIndex]->iEapSettings->iUsePseudonymsPresent = ETrue;
+				iEapSettings[eapIndex]->iEapSettings->iUsePseudonyms = EFalse;
+	            }
+	        else 
+	            {
+	            CLOG_WRITE_FORMAT( "! Error : Invalid UsePseudonyms. EapId: %d", eapId );                
+                User::Leave( KErrArgument );
+	            }
+			break;
+			}
+				
+		case EEapTtlsEncapsulatedTypes:
+		case EEapPeapEncapsulatedTypes:
+		case EEapFastEncapsulatedTypes:
+			{
+		    // Lenght of a 3 digit long signed number 
+		     const TInt sliceLength = 4;
+    
+		    TInt pos = 0;
+    		while ( pos + sliceLength <= aValue->Length() )
+        		{
+	        	// Getting a slice
+	        	TPtrC16 slice = aValue->Mid( pos, sliceLength );
+	        
+	        	// Checks the sign
+	        	if( slice[0] == '+' )
+	            	{
+         		   	TLex lex( slice.Ptr() + 1 );		
+					TUint encapsEapId( 0 );		
+					
+					if( lex.Val( encapsEapId, EDecimal) != KErrNone )
+						{				
+						CLOG_WRITE_FORMAT( "! Error : Invalid EncapsulatedTypes. EapId: %d", eapId );
+						User::Leave( KErrArgument );
+						}								
+					
+           			iEapSettings[eapIndex]->iEapSettings->iEncapsulatedEAPTypes.Append( encapsEapId );
+					iEapSettings[eapIndex]->iEapSettings->iEncapsulatedEAPTypesPresent = ETrue;
+	            	}
+	                    	       
+		        // Step over one slice and "," e.g. "+023,"
+		        pos+=5;            
+        		}
+
+			break;
+			}
+		
+		case EEapPeapV0Allowed:
+			{
+            if ( !aValue->CompareF( KStrYes ) )
+	            {
+				iEapSettings[eapIndex]->iEapSettings->iPEAPVersionsPresent = ETrue;
+				iEapSettings[eapIndex]->iEapSettings->iPEAPv0Allowed = ETrue;
+	            }
+	        else if ( !aValue->CompareF( KStrNo ) )
+	            {
+	            iEapSettings[eapIndex]->iEapSettings->iPEAPVersionsPresent = ETrue;
+				iEapSettings[eapIndex]->iEapSettings->iPEAPv0Allowed = EFalse;
+	            }
+	        else 
+	            {
+   	            CLOG_WRITE_FORMAT( "! Error : Invalid EapPeapV0Allowed. EapId: %d", eapId );                
+                User::Leave( KErrArgument );
+	            }
+			
+			break;
+			}
+		
+		case EEapPeapV1Allowed:
+			{
+            if ( !aValue->CompareF( KStrYes ) )
+	            {
+				iEapSettings[eapIndex]->iEapSettings->iPEAPVersionsPresent = ETrue;
+				iEapSettings[eapIndex]->iEapSettings->iPEAPv1Allowed = ETrue;
+	            }
+	        else if ( !aValue->CompareF( KStrNo ) )
+	            {
+	            iEapSettings[eapIndex]->iEapSettings->iPEAPVersionsPresent = ETrue;
+				iEapSettings[eapIndex]->iEapSettings->iPEAPv1Allowed = EFalse;
+	            }
+	        else 
+	            {
+   	            CLOG_WRITE_FORMAT( "! Error : Invalid EapPeapV1Allowed. EapId: %d", eapId );                
+                User::Leave( KErrArgument );
+	            }
+			
+			break;
+			}
+		
+		case EEapPeapV2Allowed:
+			{
+            if ( !aValue->CompareF( KStrYes ) )
+	            {
+				iEapSettings[eapIndex]->iEapSettings->iPEAPVersionsPresent = ETrue;
+				iEapSettings[eapIndex]->iEapSettings->iPEAPv2Allowed = ETrue;
+	            }
+	        else if ( !aValue->CompareF( KStrNo ) )
+	            {
+	            iEapSettings[eapIndex]->iEapSettings->iPEAPVersionsPresent = ETrue;
+				iEapSettings[eapIndex]->iEapSettings->iPEAPv2Allowed = EFalse;
+	            }
+	        else 
+	            {
+   	            CLOG_WRITE_FORMAT( "! Error : Invalid EapPeapV2Allowed. EapId: %d", eapId );
+                User::Leave( KErrArgument );
+	            }
+			
+			break;
+			}
+				
+		case EEapFastAuthProvModeAllowed:
+			{
+            if ( !aValue->CompareF( KStrYes ) )
+	            {
+				iEapSettings[eapIndex]->iEapSettings->iAuthProvModeAllowedPresent = ETrue;
+				iEapSettings[eapIndex]->iEapSettings->iAuthProvModeAllowed = ETrue;
+	            }
+	        else if ( !aValue->CompareF( KStrNo ) )
+	            {
+	            iEapSettings[eapIndex]->iEapSettings->iAuthProvModeAllowedPresent = ETrue;
+				iEapSettings[eapIndex]->iEapSettings->iAuthProvModeAllowed = EFalse;
+	            }
+	        else 
+	            {
+  	            CLOG_WRITE_FORMAT( "! Error : Invalid EEapFastAuthProvModeAllowed. EapId: %d", eapId );                
+                User::Leave( KErrArgument );
+	            }
+			
+			break;
+			}
+		
+		case EEapFastUnauthProvModeAllowed:
+			{
+            if ( !aValue->CompareF( KStrYes ) )
+	            {
+				iEapSettings[eapIndex]->iEapSettings->iUnauthProvModeAllowedPresent = ETrue;
+				iEapSettings[eapIndex]->iEapSettings->iUnauthProvModeAllowed = ETrue;
+	            }
+	        else if ( !aValue->CompareF( KStrNo ) )
+	            {
+	            iEapSettings[eapIndex]->iEapSettings->iUnauthProvModeAllowedPresent = ETrue;
+				iEapSettings[eapIndex]->iEapSettings->iUnauthProvModeAllowed = EFalse;
+	            }
+	        else 
+	            {
+
+  	            CLOG_WRITE_FORMAT( "! Error : Invalid EapFastUnauthProvModeAllowed. EapId: %d", eapId );                
+                User::Leave( KErrArgument );
+	            }
+			
+			break;
+			}
+		
+		case EEapFastWarnADHPNoPAC:
+			{
+            if ( !aValue->CompareF( KStrYes ) )
+	            {
+				iEapSettings[eapIndex]->iEapSettings->iWarnADHPNoPACPresent = ETrue;
+				iEapSettings[eapIndex]->iEapSettings->iWarnADHPNoPAC = ETrue;
+	            }
+	        else if ( !aValue->CompareF( KStrNo ) )
+	            {
+	            iEapSettings[eapIndex]->iEapSettings->iWarnADHPNoPACPresent = ETrue;
+				iEapSettings[eapIndex]->iEapSettings->iWarnADHPNoPAC = EFalse;
+	            }
+	        else 
+	            {
+  	            CLOG_WRITE_FORMAT( "! Error : Invalid EapFastWarnADHPNoPAC. EapId: %d", eapId );                
+                User::Leave( KErrArgument );
+	            }
+			
+			break;
+			}
+		
+		case EEapFastWarnADHPNoMatchingPAC:
+			{
+            if ( !aValue->CompareF( KStrYes ) )
+	            {
+				iEapSettings[eapIndex]->iEapSettings->iWarnADHPNoMatchingPACPresent = ETrue;
+				iEapSettings[eapIndex]->iEapSettings->iWarnADHPNoMatchingPAC = ETrue;
+	            }
+	        else if ( !aValue->CompareF( KStrNo ) )
+	            {
+	            iEapSettings[eapIndex]->iEapSettings->iWarnADHPNoMatchingPACPresent = ETrue;
+				iEapSettings[eapIndex]->iEapSettings->iWarnADHPNoMatchingPAC = EFalse;
+	            }
+	        else 
+	            {
+  	            CLOG_WRITE_FORMAT( "! Error : Invalid EapFastWarnADHPNoMatchingPAC. EapId: %d", eapId );                
+                User::Leave( KErrArgument );
+	            }
+			
+			break;
+			}
+		
+		case EEapFastWarnNotDefaultServer:
+			{
+            if ( !aValue->CompareF( KStrYes ) )
+	            {
+				iEapSettings[eapIndex]->iEapSettings->iWarnNotDefaultServerPresent = ETrue;
+				iEapSettings[eapIndex]->iEapSettings->iWarnNotDefaultServer = ETrue;
+	            }
+	        else if ( !aValue->CompareF( KStrNo ) )
+	            {
+	            iEapSettings[eapIndex]->iEapSettings->iWarnNotDefaultServerPresent = ETrue;
+				iEapSettings[eapIndex]->iEapSettings->iWarnNotDefaultServer = EFalse;
+	            }
+	        else 
+	            {
+  	            CLOG_WRITE_FORMAT( "! Error : Invalid EapFastWarnNotDefaultServer. EapId: %d", eapId );                
+                User::Leave( KErrArgument );
+	            }
+			
+			break;
+			}
+			
+		default:		
+			{
+			
+			}
+		}
+    }
+// ---------------------------------------------------------
+// CProcessorWlan::FillCipherSuitesL
+// ---------------------------------------------------------
+//
+void CProcessorWlan::FillCipherSuitesL( const HBufC16* const aPtrTag, const TInt aEapIndex )
+    {
+    if ( iEapSettings[aEapIndex] == NULL )
+        {
+		User::Leave( KErrArgument );
+        }
+
+    iEapSettings[aEapIndex]->iEapSettings->iCipherSuites.Reset();
+    iEapSettings[aEapIndex]->iEapSettings->iCipherSuitesPresent = EFalse; // init to EFalse
+    
+    TChar plus( '+' );
+    
+    TBuf8<256> tmpBuf;
+   	tmpBuf.Copy( *aPtrTag);
+   			
+    TInt length = tmpBuf.Length();
+    
+    for ( TInt i = 0 ; i + 3 < length ; i += 5)
+        {
+        if ( tmpBuf[i] == plus )
+            {
+            TLex8 lex( tmpBuf.Mid( i + 1, 3) );
+            TUint suite;
+            User::LeaveIfError( lex.Val( suite ) );
+            iEapSettings[aEapIndex]->iEapSettings->iCipherSuites.Append(suite);
+            iEapSettings[aEapIndex]->iEapSettings->iCipherSuitesPresent = ETrue;
+            }
+        }
+	}
+    
+// ---------------------------------------------------------
+// CProcessorWlan::FindCertificateEntry
+// ---------------------------------------------------------
+//
+TUint CProcessorWlan::FindCertificateEntryL( const CertificateEntry::TCertType aCertType, const TInt aEapIndex )
+    {
+    TUint certIndex( 0 );
+	for( certIndex = 0; certIndex < iEapSettings[aEapIndex]->iEapSettings->iCertificates.Count() ; certIndex++ )
+		{
+		if( iEapSettings[aEapIndex]->iEapSettings->iCertificates[certIndex].iCertType == aCertType )
+			{
+			// Found
+			break;
+			}
+		}
+	if( certIndex == iEapSettings[aEapIndex]->iEapSettings->iCertificates.Count() )
+		{
+		// Not found. Create
+		CertificateEntry entry;
+
+		entry.iCertType = aCertType;
+
+		iEapSettings[aEapIndex]->iEapSettings->iCertificates.AppendL( entry );
+
+		certIndex = iEapSettings[aEapIndex]->iEapSettings->iCertificates.Count() - 1;
+		}
+	return certIndex;	
+	}
+
+// ---------------------------------------------------------
+// CProcessorWlan::ConvertSubjectKeyIdToBinary
+// ---------------------------------------------------------
+//
+void CProcessorWlan::ConvertSubjectKeyIdToBinaryL( const HBufC16* const aSubjectKeyIdString, TDes& aBinaryKey)
+	{
+	TInt err( KErrNone );
+	
+		// Define literals to search the subject key for possible 0X/0x beginning
+	_LIT(KHexIdLC, "0x");
+	_LIT(KHexIdUC, "0X");
+	TBuf<2> hexIdBuf;
+	
+	// The lenght of the key given as input
+	TInt keyLen = aSubjectKeyIdString->Length();
+	
+	// setting the given key to the key buffer
+	TBuf8<256> origKey;
+	
+	origKey.Copy( *aSubjectKeyIdString );
+	origKey.SetLength(keyLen);
+		
+	TLex8 tmpByte;
+	TUint16 byte;
+	
+	// Remove possible spaces from the beginning
+	origKey.TrimLeft();
+	
+	// the key should be atleast two chars long
+	if (origKey.Length() >= 2)
+		{
+		// Copy the two left most characters in to the buffer
+		hexIdBuf.Copy(origKey.Left(2));
+		
+		// If the first characters are 0x or 0X, then thet should be ignored
+		if (hexIdBuf.Compare(KHexIdLC) == 0
+				|| hexIdBuf.Compare(KHexIdUC) == 0)
+			{
+			// delete two characters
+			origKey.Delete(0, 2);
+			}
+		}
+
+
+	// looping the subject key through, removing whitespaces
+	for (TInt i = 0; i < KKeyIdentifierLength; i++)
+		{
+		// removing white spaces from the left side of the key
+		origKey.TrimLeft();
+		// check that there are characters left
+		if (origKey.Length() >= 2)
+			{
+			// pick the two left most bytes from the key
+			tmpByte = origKey.Left(2);
+			// convert byte into binary format
+			err = tmpByte.Val(byte, EHex);
+			
+			// check whether conversion to decimal went ok
+			if (err != KErrNone)
+				{
+				// if there are problems, then leave the loop
+				break;
+				}
+			
+			// store the appended byte into the key variable
+			aBinaryKey.Append(byte);
+			// delete two characters from the left side of the character array in the buffer
+			origKey.Delete(0, 2);
+			}
+		else {
+			// leave the loop, no characters are left			
+			break;
+			}
+		}
+	User::LeaveIfError( err );		
+	}
+	
+
+// End of File.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatcreator/Src/cdcreaderbase.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,141 @@
+/*
+* Copyright (c) 2004 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 the class CReaderBase
+*
+*/
+
+
+
+
+// INCLUDE FILES
+
+#include "cdcreaderbase.h"
+#include "cdclogger.h"
+
+#include "cdcerrors.h"
+#include "cdccommon.h"
+
+// CONSTANTS
+
+// ================= MEMBER FUNCTIONS =======================
+
+//---------------------------------------------------------
+// Constructor & Destructor
+//---------------------------------------------------------
+//
+CReaderBase::~CReaderBase()
+    {
+    CLOSE_LOG;
+    //no implementation required
+    delete iTagContainer;
+    
+    iInputFile.Close();
+    iFs.Close();
+    }
+    
+    
+CReaderBase::CReaderBase( TDbCreatorInputFile aFileType,
+                          TDbCreatorFeatures aFeature ):
+    iCurrentFeature( aFeature ),
+    iTagContainer( NULL ),
+    iFileType( aFileType )
+    {
+        //no implementation required
+    }
+
+// ---------------------------------------------------------
+// CProcessorBase::ConstructL
+// ---------------------------------------------------------
+//
+void CReaderBase::ConstructL( const TDesC& aInFileName )
+    {
+    User::LeaveIfError( iFs.Connect() );
+
+    TInt error( iInputFile.Open( iFs, aInFileName,
+                        EFileShareReadersOnly | EFileStream | EFileRead ) );
+                        
+    if ( error == KErrNotFound )
+        {
+        User::Leave( KErrNotFound );
+        }
+    else if ( error )
+        {
+        User::Leave( KErrFileCannotBeOpened );
+        }
+    else
+        {
+        //nothing to do    
+        }
+    
+    ////iFs.MkDirAll( KFullLogDir );
+
+    CREATE_LOG;
+
+    ////User::LeaveIfError( iLogFile.Connect() );
+    ////iLogFile.CreateLog( KLogDir, KLogFile , EFileLoggingModeAppend );
+    
+       iTagContainer = CTagContainer::NewL();
+    }
+    
+    
+// ---------------------------------------------------------
+// CProcessorBase::TagContainer
+// ---------------------------------------------------------
+//
+CTagContainer& CReaderBase::TagContainer()
+    {
+    return *iTagContainer;
+    }
+    
+    
+// ---------------------------------------------------------
+// CProcessorBase::InputFile
+// ---------------------------------------------------------
+//
+RFile& CReaderBase::InputFile()
+    {
+    return iInputFile;
+    }
+
+
+// ---------------------------------------------------------
+// CProcessorBase::FileLogger
+// ---------------------------------------------------------
+//
+RFileLogger& CReaderBase::FileLogger()
+    {
+    return iLogFile;    
+    }
+
+
+// ---------------------------------------------------------
+// CProcessorBase::FieldIDPresent
+// ---------------------------------------------------------
+//
+TBool CReaderBase::FieldIDPresent()
+    {
+    return ( iFileType == EFileXML );    
+    }
+
+    
+// ---------------------------------------------------------
+// CProcessorBase::CurrentFeature
+// ---------------------------------------------------------
+//
+TDbCreatorFeatures CReaderBase::CurrentFeature()
+    {
+    return iCurrentFeature;    
+    }
+    
+//End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatcreator/Src/cdcreaderxml.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,1828 @@
+/*
+* Copyright (c) 2004 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 the class CReaderXML
+*
+*/
+
+
+
+ 
+// INCLUDE FILES
+
+#include "cdcreaderxml.h"
+#include "cdclogger.h"
+
+#include <utf.h>
+#include <cmpluginpacketdatadef.h>
+#include <cmplugindialcommondefs.h>
+#include <cmpluginlandef.h>
+#include <cmpluginwlandef.h>
+#include <cmpluginvpndef.h>
+#include <cmconnectionmethoddef.h>
+
+using namespace CMManager;
+
+//TYPE DECLARATION
+
+//CONSTANTS
+//
+// Literals in XML header
+_LIT16( KXmlVersion,       "xml version" );
+_LIT16( KEncoding,         "encoding" );
+_LIT16( KEncodingUtf8,     "UTF-8" );
+
+// File tail marker
+_LIT16( KFileTail,         "</Variant>");
+_LIT16( KFileTail2,         "</Data>");
+
+// Feature head markers
+_LIT16( KFeatureHeadPacketData, "<APs>" );
+_LIT16( KFeatureHeadWLAN,       "<WLAN_APs>" );
+_LIT16( KFeatureHeadLAN,        "<LAN_APs>" );
+_LIT16( KFeatureHeadVPN,        "<VPN_APs>" );
+_LIT16( KFeatureHeadGlobal,     "<Global>" );
+_LIT16( KFeatureHeadDN,         "<DNs>" );
+
+// Feature tail markers
+_LIT16( KFeatureTailPacketData, "</APs>" );
+_LIT16( KFeatureTailWLAN,       "</WLAN_APs>" );
+_LIT16( KFeatureTailLAN,        "</LAN_APs>" );
+_LIT16( KFeatureTailVPN,        "</VPN_APs>" );
+_LIT16( KFeatureTailGlobal,     "</Global>" );
+_LIT16( KFeatureTailDN,         "</DNs>" );
+
+// Feature data head markers
+_LIT16( KDataHeadPacketData, "<AP>" );
+_LIT16( KDataHeadWLAN,       "<WLAN_AP>" );
+_LIT16( KDataHeadLAN,        "<LAN_AP>" );
+_LIT16( KDataHeadVPN,        "<VPN_AP>" );
+_LIT16( KDataHeadDN,         "<DN>" );
+
+// Feature data tail markers
+_LIT16( KDataTailPacketData, "</AP>" );
+_LIT16( KDataTailWLAN,       "</WLAN_AP>" );
+_LIT16( KDataTailLAN,        "</LAN_AP>" );
+_LIT16( KDataTailVPN,        "</VPN_AP>" );
+_LIT16( KDataTailDN,         "</DN>" );
+
+// Parameter Markers
+// <ParamName>ParamValue</ParamName>
+_LIT16( KParamValueHead,        ">" );
+_LIT16( KParamValueTail,        "</" );
+_LIT16( KParamNameHead,         "<" );
+_LIT16( KParamNameTail,         ">" );
+
+
+//maximum line size
+const TInt16 KMaxLineSize   = 1024;
+//maximum item (tag) size
+const TInt16 KMaxItemLength = 100;
+
+// ratio between ascii and unicode character sizes
+const TUint KAsciiUnicodeRatio = 2;
+
+//  Following table contains the input parameter names:
+//
+//    Name                Type    Description
+//----------------------------------------------------------------------------
+//General & Gprs specific:
+//========================
+//KConnectionName         string    The name of the access point.
+//KProtected              string    Protection
+//KHidden                 string    CM/DN is hidden
+//KHiddenAgent            string    CM/DN is not shown in CConnDlg
+//KHighlighted            string    CM/DN is highlighted in CConnDlg
+//KSeamlessness           string    Seamlessness value
+//KGprs_AP_Name           string    Access point name.
+//KUserName               string    Login user name
+//KPromptPassword         string    Prompts the user for username and 
+//                                  password
+//KPassword               string    Login password.
+//KPasswordAuthType       string    Disables plain text authentication.
+//KWAPGatewayIP           string    WAP gateway address (IP address).
+//KStartingPage           string    WAP start page URL.
+//KWTLS_Security          string    Attempts a secure WTLS connection 
+//                                  to the gateway.
+//KWAP_ConnectionType     string    Indicates whether a connection-
+//                                  oriented or connectionless API 
+//                                  should be used.
+//KPhoneIP                string    IP address of the interface.
+//KPrimaryNameServer      string    IP address of the primary name 
+//                                  server.
+//KSecondaryNameServer    string    IP address of the secondary name
+//                                  server.
+//KProxyServerAddress     string    Proxy server address.
+//KProxyPortNumber        string    Proxy port number.
+//KProxyProtocolName      string    Proxy protocol name.
+//KPrimaryIP6NameServer   string    IP address of the primary IPv6 
+//                                  name server.
+//KSecondaryIP6NameServer string    IP address of the secondary IPv6 
+//                                  name server.
+//KNetworkType            string    Network type: IPv4 or IPv6
+//KGprsUseEdge            string    Sets the GprsUseEdge parameter
+//=============
+//LAN specific:
+//=============
+//KLanIfNetworks          string    Network protcols
+//KLanIpNetMask           string    IP net mask of interface
+//KLanIpGateway           string    IP address of gateway
+//==============
+//WLAN specific:
+//==============
+//KNetworkName            string    The name of the WLAN network 
+//KNetworkMode            string    The WLAN network mode 
+//KSecurityMode           string    The security mode of the WLAN network
+//KWlanIpGatewayAddress   string    IP address of gateway 
+//KWlanIpNetMask          string    IP net mask of interface 
+//KWlanChannelId          integer   802.11 Channel ID (1-14) 
+
+//---------------
+//WEP security 
+//---------------
+//WEPKeyInUse             integer   Index of the default WEP key
+//WEPAuthType             string    WEP authentication mode. 
+//WEPKey1Length           string    Key length of WEP key1. 64, 128, 256 bit.
+//WEPKey1Format           string    Format of WEP key 1. ASCII or Hexadecimal
+//WEPKey1Data             string    Data  of WEP key1
+//WEPKey2Length           string    Key length of WEP key2. 64, 128, 256 bit.
+//WEPKey2Format           string    Format of WEP key 2. ASCII or Hexadecimal
+//WEPKey2Data             string    Data  of WEP key2
+//WEPKey3Length           string    Key length of WEP key3. 64, 128, 256 bit.
+//WEPKey3Format           string    Format of WEP key 3. ASCII or Hexadecimal
+//WEPKey3Data             string    Data  of WEP key3
+//WEPKey4Length           string    Key length of WEP key4. 64, 128, 256 bit.
+//WEPKey4Format           string    Format of WEP key 4. ASCII or Hexadecimal
+//WEPKey4Data             string    Data  of WEP key4
+//---------------
+//WPA security
+//---------------
+//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
+//WPAUseOfPresharedKey    string    WPA/WPA2 pre-shared key usage.
+//=============
+//VPN specific:
+//=============
+//KVpnIapName             string    IAP name used for the connection
+//KVpnServicePolicy       string    Service policy ID
+//====================
+//Destination Networks
+//====================
+//KDN_Name                string    The name of the Destination Network
+//KDN_Icon                integer   Index of icon assigned to the DN
+//KDN_Metadata            string    Destination type
+//KDN_Protection          integer   Protection level of the DN
+//KDN_Hidden              integer   Shows whether DN is hidden or not
+//KDN_IAPName             string    Name of a Connection Method that is
+//                                  bound to the DN
+//KDN_IAPName2..10        string    Same as above
+//KDN_EmbeddedDN          string    Name of an Embedded DN that is bound
+//                                  to the DN
+//===============
+//Global settings
+//===============
+//KAttachMode             string    Gprs attach mode
+//KDefaultAP              string    Default Gprs access point
+//KTableProtection        string    Table level protection
+//KDefaultDnIcon          integer   Default icon for DNs
+//KPriorityLan            integer   Default priority for Lan bearer type
+//KPriorityWlan           integer   Default priority for WLan bearer type
+//KPriorityPan            integer   Default priority for Pan bearer type
+//KPriorityGprsOut        integer   Default priority for outgoing Gprs
+//                                  bearer type
+//KPriorityGprsIn         integer   Default priority for incoming Gprs
+//                                  bearer type
+//KPriorityCdma2k         integer   Default priority for CDMA2000 bearer type
+//KPriorityDialOut        integer   Default priority for incoming dial
+//                                  bearer type
+//KPriorityDialIn         integer   Default priority for outgoing dial
+//                                  bearer type
+//KPriorityVpn            integer   Default priority for Vpn bearer type
+//KPriorityMip            integer   Default priority for Mip bearer type
+//KUIPriorityLan          integer   Default UI priority for Lan bearer type
+//KUIPriorityWlan         integer   Default UI priority for WLan bearer type
+//KUIPriorityPan          integer   Default UI priority for Pan bearer type
+//KUIPriorityGprsOut      integer   Default UI priority for outgoing Gprs
+//                                  bearer type
+//KUIPriorityGprsIn       integer   Default UI priority for incoming Gprs
+//                                  bearer type
+//KUIPriorityCdma2k       integer   Default UI priority for CDMA2000
+//                                  bearer type
+//KUIPriorityDialOut      integer   Default UI priority for incoming dial
+//                                  bearer type
+//KUIPriorityDialIn       integer   Default UI priority for outgoing dial
+//                                  bearer type
+//KUIPriorityVpn          integer   Default UI priority for Vpn bearer type
+//KUIPriorityMip          integer   Default UI priority for Mip bearer type
+
+//KDefaultConnectionType  integer   Default connection method type
+//KDefaultConnectionName  string    Default connection method name
+
+//KUsageOfWlan            integer   Usage of known WLAN networks, automatical or manual
+//KSeamlessnessHome       integer   Cellular data usage in home network
+//KSeamlessnessVisitor    integer   Cellular data usage in foreign networks
+
+
+//KGprsLastSocketActivityTimeout    integer
+//KGprsLastSessionClosedTimeout     integer The time how long Gprs PDP context stays active 
+//                                          after the last application using the connection was closed.
+//KGprsLastSocketClosedTimeout      integer
+//KCsdLastSocketActivityTimeout     integer
+//KCsdLastSessionClosedTimeout      integer
+//KCsdLastSocketClosedTimeout       integer
+//KWlanLastSocketActivityTimeout    integer
+//KWlanLastSessionClosedTimeout     integer
+//KWlanLastSocketClosedTimeout      integer
+//KWlanBGScanInterval               integer
+//KWlanUseDefSettings               integer
+//KWlanLongRetry                    integer
+//KWlanShortRetry                   integer
+//KWlanRTS                          integer
+//KWlanTxPowerLevel                 integer
+//KWlanRadioMeasurements            integer
+//KWlanPowerMode                    integer Whether WLAN power save is on or off
+
+
+//String literals defined for input parameters
+
+//General & Gprs specific
+_LIT16( KConnectionName,            "ConnectionName" );
+_LIT16( KConnectionId,              "ConnectionId" );
+_LIT16( KProtected,                 "Protected" );
+_LIT16( KHidden,                    "Hidden" );
+_LIT16( KHiddenAgent,               "HiddenAgent" );
+_LIT16( KHighlighted,               "Highlighted" );
+_LIT16( KSeamlessness,              "Seamlessness" );
+_LIT16( KGprs_AP_Name,              "Gprs_AP_Name" );
+_LIT16( KUserName,                  "UserName" );
+_LIT16( KPromptPassword,            "PromptPassword" );
+_LIT16( KPassword,                  "Password" );
+_LIT16( KPasswordAuthType,          "PasswordAuthenticationType" );
+_LIT16( KWAPGatewayIP,              "WAPGatewayIP" );
+_LIT16( KStartingPage,              "StartingPage" );
+_LIT16( KWTLS_Security,             "WTLS_Security" );
+_LIT16( KWAP_ConnectionType,        "WAP_ConnectionType" );
+_LIT16( KPhoneIP,                   "PhoneIP" );
+_LIT16( KPrimaryNameServer,         "PrimaryNameServer" );
+_LIT16( KSecondaryNameServer,       "SecondaryNameServer" );
+_LIT16( KProxyServerAddress,        "ProxyServerAddress" );
+_LIT16( KProxyPortNumber,           "ProxyPortNumber" );
+_LIT16( KProxyProtocolName,         "ProxyProtocolName");
+_LIT16( KPrimaryIP6NameServer,      "PrimaryIP6NameServer" );
+_LIT16( KSecondaryIP6NameServer,    "SecondaryIP6NameServer" );
+_LIT16( KNetworkType,               "NetworkType");
+_LIT16( KIspType,                   "IspType" );
+_LIT16( KGprsUseEdge,               "GprsUseEdge");
+_LIT16( KLinger,                    "Linger");
+
+//Lan specific
+_LIT16( KLanIfNetworks,             "LanIfNetworks" );
+_LIT16( KLanIpNetMask,              "LanIpNetMask" );
+_LIT16( KLanIpGateway,              "LanIpGateway" );
+_LIT16( KLanIpAddrFromServer,       "IpAddrFromServer" );
+_LIT16( KLanIpDNSAddrFromServer,    "IpDNSAddrFromServer" ); 
+_LIT16( KLanConfigDaemonManagerName,"ConfigDaemonManagerName" );
+_LIT16( KLanConfigDaemonName,       "ConfigDaemonName" );
+
+//Wlan specific
+_LIT16( KNetworkName,               "NetworkName" );
+_LIT16( KNetworkMode,               "NetworkMode" );
+_LIT16( KSecurityMode,              "SecurityMode" );
+_LIT16( KWlanIpGatewayAddress,      "WlanIpGatewayAddress" );
+_LIT16( KWlanIpNetMask,             "WlanIpNetMask" );
+_LIT16( KWlanScanSSId,              "WlanScanSSId" );
+_LIT16( KWlanChannelId,             "WlanChannelId" );
+
+//WEP security
+_LIT16( KWEPKeyInUse,               "WEPKeyInUse" );
+_LIT16( KWEPAuthType,               "WEPAuthType" );
+_LIT16( KWEPKey1Length,             "WEPKey1Length" );
+_LIT16( KWEPKey1Format,             "WEPKey1Format" );
+_LIT16( KWEPKey1Data,               "WEPKey1Data" );
+_LIT16( KWEPKey2Length,             "WEPKey2Length" );
+_LIT16( KWEPKey2Format,             "WEPKey2Format" );
+_LIT16( KWEPKey2Data,               "WEPKey2Data" );
+_LIT16( KWEPKey3Length,             "WEPKey3Length" );
+_LIT16( KWEPKey3Format,             "WEPKey3Format" );
+_LIT16( KWEPKey3Data,               "WEPKey3Data" );
+_LIT16( KWEPKey4Length,             "WEPKey4Length" );
+_LIT16( KWEPKey4Format,             "WEPKey4Format" );
+_LIT16( KWEPKey4Data,               "WEPKey4Data" );
+
+//WPA security
+_LIT16( KWPAPresharedKey,           "WPAPresharedKey" );
+_LIT16( KWPAKeyLength,              "WPAKeyLength" );
+_LIT16( KWPAListOfEAPs,             "WPAListOfEAPs" );
+_LIT16( KWPAUseOfPresharedKey,      "WPAUseOfPresharedKey" );
+
+//EAP security
+_LIT16( KEapGtcUsername,            "EapGtcUsername" );
+_LIT16( KEapGtcSessionValidityTime, "EapGtcSessionValidityTime" );
+_LIT16( KEapGtcEncapsulation,       "EapGtcEncapsulation" );
+
+
+_LIT16( KEapTlsUsername,            "EapTlsUsername" );
+_LIT16( KEapTlsRealm,               "EapTlsRealm" );
+_LIT16( KEapTlsVerifyServerRealm,   "EapTlsVerifyServerRealm" );
+_LIT16( KEapTlsRequireClientAuth,   "EapTlsRequireClientAuth" );
+_LIT16( KEapTlsSessionValidityTime, "EapTlsSessionValidityTime" );
+_LIT16( KEapTlsCipherSuites,        "EapTlsCipherSuites" );
+_LIT16( KEapTlsUserCertSubjectKeyId,"EapTlsUserCertSubjectKeyId" );
+_LIT16( KEapTlsUserCertIssuerName,  "EapTlsUserCertIssuerName" );
+_LIT16( KEapTlsUserCertSerialNumber,"EapTlsUserCertSerialNumber" );
+_LIT16( KEapTlsCaCertSubjectKeyId,  "EapTlsCaCertSubjectKeyId" );
+_LIT16( KEapTlsCaCertIssuerName,    "EapTlsCaCertIssuerName" );
+_LIT16( KEapTlsCaCertSerialNumber,  "EapTlsCaCertSerialNumber" );
+_LIT16( KEapTlsEncapsulation,       "EapTlsEncapsulation" );
+
+
+_LIT16( KEapLeapUsername,           "EapLeapUsername" );
+_LIT16( KEapLeapPassword,           "EapLeapPassword" );
+_LIT16( KEapLeapSessionValidityTime,"EapLeapSessionValidityTime" );
+
+
+_LIT16( KEapSimUsername,            "EapSimUsername" );
+_LIT16( KEapSimRealm,               "EapSimRealm" );
+_LIT16( KEapSimUsePseudonyms,       "EapSimUsePseudonyms" );
+_LIT16( KEapSimSessionValidityTime, "EapSimSessionValidityTime" );
+_LIT16( KEapSimEncapsulation,       "EapSimEncapsulation" );
+
+_LIT16( KEapTtlsUsername,           "EapTtlsUsername" );
+_LIT16( KEapTtlsRealm,              "EapTtlsRealm" );
+_LIT16( KEapTtlsVerifyServerRealm,  "EapTtlsVerifyServerRealm" );
+_LIT16( KEapTtlsRequireClientAuth,  "EapTtlsRequireClientAuth" );
+_LIT16( KEapTtlsSessionValidityTime,"EapTtlsSessionValidityTime" );
+_LIT16( KEapTtlsCipherSuites,       "EapTtlsCipherSuites" );
+_LIT16( KEapTtlsEncapsulatedTypes,  "EapTtlsEncapsulatedTypes" );
+_LIT16( KEapTtlsUserCertSubjectKeyId,"EapTtlsUserCertSubjectKeyId" );
+_LIT16( KEapTtlsUserCertIssuerName, "EapTtlsUserCertIssuerName" );
+_LIT16( KEapTtlsUserCertSerialNumber,"EapTtlsUserCertSerialNumber" );
+_LIT16( KEapTtlsCaCertSubjectKeyId, "EapTtlsCaCertSubjectKeyId" );
+_LIT16( KEapTtlsCaCertIssuerName,   "EapTtlsCaCertIssuerName" );
+_LIT16( KEapTtlsCaCertSerialNumber, "EapTtlsCaCertSerialNumber" );
+
+_LIT16( KEapAkaUsername,            "EapAkaUsername" );
+_LIT16( KEapAkaRealm,               "EapAkaRealm" );
+_LIT16( KEapAkaUsePseudonyms,       "EapAkaUsePseudonyms" );
+_LIT16( KEapAkaSessionValidityTime, "EapAkaSessionValidityTime" );
+_LIT16( KEapAkaEncapsulation,       "EapAkaEncapsulation" );
+
+_LIT16( KEapPeapUsername,           "EapPeapUsername" );
+_LIT16( KEapPeapRealm,              "EapPeapRealm" );
+_LIT16( KEapPeapVerifyServerRealm,  "EapPeapVerifyServerRealm" );
+_LIT16( KEapPeapRequireClientAuth,  "EapPeapRequireClientAuth" );
+_LIT16( KEapPeapSessionValidityTime,"EapPeapSessionValidityTime" );
+_LIT16( KEapPeapCipherSuites,       "EapPeapCipherSuites" );
+_LIT16( KEapPeapV0Allowed,          "EapPeapV0Allowed" );
+_LIT16( KEapPeapV1Allowed,          "EapPeapV1Allowed" );
+_LIT16( KEapPeapV2Allowed,          "EapPeapV2Allowed" );
+_LIT16( KEapPeapEncapsulatedTypes,  "EapPeapEncapsulatedTypes" );
+_LIT16( KEapPeapUserCertSubjectKeyId,"EapPeapUserCertSubjectKeyId" );
+_LIT16( KEapPeapUserCertIssuerName, "EapPeapUserCertIssuerName" );
+_LIT16( KEapPeapUserCertSerialNumber,"EapPeapUserCertSerialNumber" );
+_LIT16( KEapPeapCaCertSubjectKeyId, "EapPeapCaCertSubjectKeyId" );
+_LIT16( KEapPeapCaCertIssuerName,   "EapPeapCaCertIssuerName" );
+_LIT16( KEapPeapCaCertSerialNumber, "EapPeapCaCertSerialNumber" );
+
+_LIT16( KEapMschapv2Username,       "EapMschapv2Username" );
+_LIT16( KEapMschapv2Password,       "EapMschapv2Password" );
+_LIT16( KEapMschapv2SessionValidityTime,"EapMschapv2SessionValidityTime" );
+_LIT16( KEapMschapv2Encapsulation,  "EapMschapv2Encapsulation" );
+
+_LIT16( KEapFastUsername,           "EapFastUsername" );
+_LIT16( KEapFastRealm,              "EapFastRealm" );
+_LIT16( KEapFastVerifyServerRealm,  "EapFastVerifyServerRealm" );
+_LIT16( KEapFastRequireClientAuth,  "EapFastRequireClientAuth" );
+_LIT16( KEapFastSessionValidityTime,"EapFastSessionValidityTime" );
+_LIT16( KEapFastCipherSuites,       "EapFastCipherSuites" );
+_LIT16( KEapFastEncapsulatedTypes,  "EapFastEncapsulatedTypes" );
+_LIT16( KEapFastAuthProvModeAllowed,"EapFastAuthProvModeAllowed" );
+_LIT16( KEapFastUnauthProvModeAllowed,"EapFastUnauthProvModeAllowed" );
+_LIT16( KEapFastWarnADHPNoPAC,      "EapFastWarnADHPNoPAC" );
+_LIT16( KEapFastWarnADHPNoMatchingPAC,"EapFastWarnADHPNoMatchingPAC" );
+_LIT16( KEapFastWarnNotDefaultServer,"EapFastWarnNotDefaultServer" );
+_LIT16( KEapFastUserCertSubjectKeyId,"EapFastUserCertSubjectKeyId" );
+_LIT16( KEapFastUserCertIssuerName, "EapFastUserCertIssuerName" );
+_LIT16( KEapFastUserCertSerialNumber,"EapFastUserCertSerialNumber" );
+_LIT16( KEapFastCaCertSubjectKeyId, "EapFastCaCertSubjectKeyId" );
+_LIT16( KEapFastCaCertIssuerName,   "EapFastCaCertIssuerName" );
+_LIT16( KEapFastCaCertSerialNumber, "EapFastCaCertSerialNumber" );
+
+_LIT16( KMschapv2Username,          "Mschapv2Username" );
+_LIT16( KMschapv2Password,          "Mschapv2Password" );
+_LIT16( KMschapv2SessionValidityTime,"Mschapv2SessionValidityTime" );
+_LIT16( KMschapv2Encapsulation,     "Mschapv2Encapsulation" );
+
+
+//VPN specific
+_LIT16( KVpnIapName,                "IAP_Name" );
+_LIT16( KVpnServicePolicy,          "Policy_ID" );
+
+//DN specific
+_LIT16( KDN_Name,                   "Name" );
+_LIT16( KDN_Id,                     "DNId" );
+_LIT16( KDN_Icon,                   "Icon" );
+_LIT16( KDN_Metadata,               "Metadata" );
+_LIT16( KDN_Protection,             "Protection" );
+_LIT16( KDN_EmbeddedDNName,         "EmbeddedDN" );
+_LIT16( KDN_IAPName,                "IAP" );
+
+// Needed because of Customization Tool limitations
+_LIT16( KDN_IAPName2,               "IAP2" );
+_LIT16( KDN_IAPName3,               "IAP3" );
+_LIT16( KDN_IAPName4,               "IAP4" );
+_LIT16( KDN_IAPName5,               "IAP5" );
+_LIT16( KDN_IAPName6,               "IAP6" );
+_LIT16( KDN_IAPName7,               "IAP7" );
+_LIT16( KDN_IAPName8,               "IAP8" );
+_LIT16( KDN_IAPName9,               "IAP9" );
+_LIT16( KDN_IAPName10,              "IAP10" );
+
+//Global settings
+_LIT16( KAttachMode,                "Attachmode" );
+_LIT16( KDefaultAP,                 "DefaultAP" );
+_LIT16( KDefaultDnIcon,             "DefaultDnIcon" );
+_LIT16( KPriorityLan,               "PriorityLan" );
+_LIT16( KPriorityWlan,              "PriorityWlan" );
+_LIT16( KPriorityPan,               "PriorityPan" );
+_LIT16( KPriorityGprsOut,           "PriorityGprsOut" );
+_LIT16( KPriorityGprsIn,            "PriorityGprsIn" );
+_LIT16( KPriorityCdma2k,            "PriorityCdma2k" );
+_LIT16( KPriorityDialOut,           "PriorityDialOut" );
+_LIT16( KPriorityDialIn,            "PriorityDialIn" );
+_LIT16( KPriorityVpn,               "PriorityVpn" );
+_LIT16( KPriorityMip,               "PriorityMip" );
+_LIT16( KUIPriorityLan,             "UIPriorityLan" );
+_LIT16( KUIPriorityWlan,            "UIPriorityWlan" );
+_LIT16( KUIPriorityPan,             "UIPriorityPan" );
+_LIT16( KUIPriorityGprsOut,         "UIPriorityGprsOut" );
+_LIT16( KUIPriorityGprsIn,          "UIPriorityGprsIn" );
+_LIT16( KUIPriorityCdma2k,          "UIPriorityCdma2k" );
+_LIT16( KUIPriorityDialOut,         "UIPriorityDialOut" );
+_LIT16( KUIPriorityDialIn,          "UIPriorityDialIn" );
+_LIT16( KUIPriorityVpn,             "UIPriorityVpn" );
+_LIT16( KUIPriorityMip,             "UIPriorityMip" );
+_LIT16( KDefaultConnectionType,     "DefaultConnectionType" );
+_LIT16( KDefaultConnectionName,     "DefaultConnectionName" );
+_LIT16( KUsageOfWlan,               "UsageOfWlan" );
+_LIT16( KSeamlessnessHome,          "SeamlessnessHome" );
+_LIT16( KSeamlessnessVisitor,       "SeamlessnessVisitor" );
+_LIT16( KGprsLastSocketActivityTimeout, "GprsLastSocketActivityTimeout" );
+_LIT16( KGprsLastSessionClosedTimeout,  "GprsLastSessionClosedTimeout" );
+_LIT16( KGprsLastSocketClosedTimeout,   "GprsLastSocketClosedTimeout" );
+_LIT16( KWlanLastSocketActivityTimeout, "WlanLastSocketActivityTimeout" );
+_LIT16( KWlanLastSessionClosedTimeout,  "WlanLastSessionClosedTimeout" );
+_LIT16( KWlanLastSocketClosedTimeout,   "WlanLastSocketClosedTimeout" );
+_LIT16( KWlanBGScanInterval,        "WlanBGScanInterval" );
+_LIT16( KWlanUseDefSettings,        "WlanUseDefSettings" );
+_LIT16( KWlanLongRetry,             "WlanLongRetry" );
+_LIT16( KWlanShortRetry,            "WlanShortRetry" );
+_LIT16( KWlanRTS,                   "WlanRTS" );
+_LIT16( KWlanTxPowerLevel,          "WlanTxPowerLevel" );
+_LIT16( KWlanRadioMeasurements,     "WlanRadioMeasurements" );
+_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 =======================
+
+// ---------------------------------------------------------
+// CReaderXML::NewL
+// ---------------------------------------------------------
+//
+CReaderXML* CReaderXML::NewLC( const TDesC& aInFileName,
+                               const TDbCreatorInputCharSet aCharSet )
+    {
+    CReaderXML* self = new ( ELeave ) CReaderXML( aCharSet );
+
+    CleanupStack::PushL( self );
+
+    self->CReaderBase::ConstructL( aInFileName );
+    self->ConstructL();
+
+    return self;
+    }
+
+
+// ---------------------------------------------------------
+// CReaderXML::ConstructL
+// ---------------------------------------------------------
+//
+void CReaderXML::ConstructL()
+    {
+    //if charset is not given as a parameter - detect it
+    if ( iCharSet == ECharSetUnknown )
+        {
+        DetectEncodingL();
+        }
+        
+    FillPacketDataParams();
+    FillLanParams();
+    FillWLanParams();
+    FillVpnParams();
+    FillGlobalParams();
+    FillDNParams();                
+    }
+
+
+// ---------------------------------------------------------
+// CReaderXML::CReaderXML
+// ---------------------------------------------------------
+//
+CReaderXML::CReaderXML( const TDbCreatorInputCharSet aCharSet ) :
+    CReaderBase( EFileXML, EFeatureNone ),
+    iCharSet( aCharSet ),
+    iLine ( NULL ),
+    iFoundGlobal( EFalse )
+    {
+    //no implementation required
+    }
+    
+    
+// ---------------------------------------------------------
+// CReaderXML::~CReaderXML
+// ---------------------------------------------------------
+//
+CReaderXML::~CReaderXML()
+    {
+    delete iLine;
+    
+    iPDParams.Close();
+    iLanParams.Close();
+    iWLanParams.Close();
+    iVpnParams.Close();
+    iGlobalParams.Close();
+    iDNParams.Close();
+    }
+
+
+// ---------------------------------------------------------
+// CReaderXML::LocateFeature
+// ---------------------------------------------------------
+//
+void CReaderXML::LocateFeatureL()
+    {
+    iCurrentFeature = EFeatureNone;
+    TInt result( KErrNone );
+    TBool eof( EFalse );
+    
+    //looks for the next feature
+    while ( !eof && CurrentFeature() == EFeatureNone )
+        {
+        //reads the next line
+        result = ReadLineL();
+        
+        if ( result == KErrEof )
+            {
+            //end of file
+            eof = ETrue;    
+            }
+        else if ( result )    
+            {
+            //other error
+            User::Leave( result );    
+            }
+        else
+            {
+            //no error
+            if ( iLine->FindF( KFileTail ) == KErrNone || 
+                 iLine->FindF( KFileTail2 ) == KErrNone )
+                {
+                //end of file is reached ("/variantvariant" found)
+                eof = ETrue;            
+                }
+            else
+                {
+                //try to recognize a feature
+                iCurrentFeature = DetectFeatureHead();
+                }//else
+            }//else        
+        }//while
+    }
+
+
+// ---------------------------------------------------------
+// CReaderXML::LocateAP
+// ---------------------------------------------------------
+//
+TBool CReaderXML::LocateAPL()
+    {
+    TBool found( EFalse );    //found feature data
+    TBool eofea( EFalse );    //end of feature
+    
+    if ( CurrentFeature() == EFeatureGlobal )
+        {
+        //for Global settings there is no feature data header
+        found = iFoundGlobal;
+        iFoundGlobal = EFalse;
+        }
+    else
+        {
+        //looks for the next feature header
+        while ( !eofea && !found )
+            {
+            User::LeaveIfError( ReadLineL() );
+            
+            if ( DetectFeatureTail() )
+                {
+                //feature tail is detected - no more data to process
+                eofea = ETrue;    
+                }
+            else
+                {
+                //looks for feature data header
+                switch ( CurrentFeature() )
+                    {
+                    case EFeaturePacketData:
+                        found = ( iLine->FindF( KDataHeadPacketData ) != KErrNotFound ); 
+                        break;
+                    case EFeatureWLAN:
+                        found = ( iLine->FindF( KDataHeadWLAN ) != KErrNotFound );
+                        break;
+                    case EFeatureLAN:
+                        found = ( iLine->FindF( KDataHeadLAN ) != KErrNotFound );
+                        break;
+                    case EFeatureVPN:
+                        found = ( iLine->FindF( KDataHeadVPN ) != KErrNotFound );
+                        break;
+                    case EFeatureDN:
+                        found = ( iLine->FindF( KDataHeadDN ) != KErrNotFound );
+                        break;
+                    }//switch
+                }//else
+            }//while
+        }//else
+            
+    return found;
+    
+    }
+           
+
+// ---------------------------------------------------------
+// CReaderXML::ParseAPL
+// ---------------------------------------------------------
+//
+void CReaderXML::ParseAPL()
+    {
+    do
+        {            
+        User::LeaveIfError( ReadLineL() );
+        TInt fieldId = DetectParam();
+        
+        if ( fieldId != KErrNotFound )
+            {
+            HBufC16* param = ReadParam( EParamValue );
+            if ( param )
+                {
+                ConvertSpecialXMLChars( param );
+                CleanupStack::PushL( param );
+                TagContainer().AddL( param , fieldId );        
+                CleanupStack::Pop( param );
+                }    
+            else
+                {
+                //simply skip line
+                }        
+            }
+        
+        }
+    while ( !DetectTailAP() );
+    }
+    
+// ---------------------------------------------------------
+// CReaderXML::Reset
+// ---------------------------------------------------------
+//
+TInt CReaderXML::Reset()
+    {
+    iFilePos = 0;
+    return InputFile().Seek( ESeekStart, iFilePos );
+    }
+              
+        
+// ---------------------------------------------------------
+// CReaderXML::ToDoLog
+// ---------------------------------------------------------
+//
+void CReaderXML::ToDoLog()
+    {
+    CLOG_WRITE( "Line :" )
+    FileLogger().Write( *iLine );
+    CLOG_WRITE( "--------------------------------------------\n\n" )
+    }
+    
+// ---------------------------------------------------------
+// Private methods
+// ---------------------------------------------------------
+ 
+// ---------------------------------------------------------
+// CReaderXML::ReadLine
+// ---------------------------------------------------------
+//  
+TInt CReaderXML::ReadLineL()
+    {
+    //go to the actual position
+    TInt result = InputFile().Seek(ESeekStart, iFilePos);
+    
+    //temporary buffer for line
+    TBuf8<KMaxLineSize> buf;
+
+    if (result == KErrNone) 
+        {
+        result = InputFile().Read(buf, buf.MaxSize());
+        }
+
+    //if seeking and reading both succesful extract one line form the buffer
+    if (result == KErrNone)
+        {
+        TPtrC8 ptrBuf8;
+        ptrBuf8.Set( buf );
+
+        if (result == KErrNone || result == KErrEof)
+            {          
+            switch ( iCharSet )
+                {
+                case ECharSetUnicode:
+                    {                     
+                    //simply copy to a Unicode descriptor
+                    TPtrC16 ptrBuf16( ( TText16* )ptrBuf8.Ptr(), \
+                                        ptrBuf8.Length() / KAsciiUnicodeRatio );
+                                        
+                    TPtrC16 ptrLine;
+                    result = ExtractLine(ptrBuf16, ptrLine);  
+                    
+                    if ( result == KErrNone ) 
+                        {
+                        delete iLine;
+                        iLine = NULL;
+                        iLine = ptrLine.AllocL();
+                        
+                        //Increment the file position
+                        iFilePos += iLine->Length() * KAsciiUnicodeRatio;
+                        }
+                    
+                    break;
+                    } 
+                case ECharSetAscii:
+                case ECharSetUtf8:
+                default:
+                    {                    
+                    //conversion to Unicode is needed
+                    HBufC16* hBuf16 = HBufC16::NewLC( KMaxLineSize );
+                    TPtr16 ptrBuf16( hBuf16->Des() );
+                    
+                    if( iCharSet == ECharSetUtf8 )
+                        {
+                        CnvUtfConverter::ConvertToUnicodeFromUtf8
+                                                    ( ptrBuf16, ptrBuf8 );
+                        }
+                    else
+                        {
+                        ptrBuf16.Copy( ptrBuf8 );
+                        }
+                    
+                    TPtrC16 ptrLine;
+                    result = ExtractLine(ptrBuf16, ptrLine); 
+                    
+                    if ( result == KErrNone ) 
+                        {
+                        delete iLine;
+                        iLine = NULL;
+                        iLine = ptrLine.AllocL();
+                        
+                        // Increment the file position
+                        // Line in unicode format converted back to UTF-8
+                        // for getting the right lenght and osition in file
+                        CnvUtfConverter::ConvertFromUnicodeToUtf8( 
+                                            buf, iLine->Des() );
+                        iFilePos += buf.Length();
+                        }
+                    
+                    CleanupStack::PopAndDestroy( hBuf16 ); 
+                    
+                    break;
+                    }//case
+                }//switch
+            }//if
+        }//if
+
+    return result;
+    }
+ 
+ 
+// ---------------------------------------------------------
+// CReaderXML::ExtractLine
+// ---------------------------------------------------------
+//     
+TInt CReaderXML::ExtractLine(const TPtrC16& aBuffer, TPtrC16& aLine)
+    {
+    // Whitespace characters
+    const TChar KSpace = ' ';
+    const TChar KNewLine = '\n';
+    const TChar KCarriageReturn = '\r';
+    const TChar KTab = '\t';
+    const TChar KTagStart = '<';
+    
+    
+    // A line is considered to contain one parameter. It starts from the
+    // current position and lasts until the end of the current parameter.
+    // The end is detected by looking for the characters ">" and "<" with
+    // any number of white spaces between them. The next line will start at
+    // the "<" character.
+    TBool lineEndFound( EFalse );
+    TBool tagEndFound( EFalse );
+    TInt pos( 0 );
+    while( !lineEndFound && pos < aBuffer.Length() )
+        {
+        if( !tagEndFound && KParamNameTail.iBuf[ 0 ] == aBuffer[ pos ] )
+            {
+            tagEndFound = ETrue;
+            }
+        else if( tagEndFound && KParamNameHead.iBuf[ 0 ] == aBuffer[ pos ] )
+            {
+            lineEndFound = ETrue;
+            break;
+            }
+        
+        else if( ( KSpace != aBuffer[ pos ] ) &&
+                 ( KNewLine != aBuffer[ pos ] ) &&
+                 ( KCarriageReturn != aBuffer[ pos ] ) &&
+                 ( KTab != aBuffer[ pos ] ) && 
+                   tagEndFound )
+            {
+            tagEndFound = EFalse;
+            }
+        ++pos;
+        }
+    
+    if( !lineEndFound )
+        {
+        //End of line not found--malformed xml file or no more data
+        //get highest file position; and check EoF
+        TInt hiPos = 0;
+        
+        if (InputFile().Size(hiPos) != KErrNone) 
+            {
+            return KErrGeneral;    
+            }
+        
+        //check for end of file
+        if ( aBuffer.Length() < KMaxLineSize )
+            {
+            aLine.Set( aBuffer );
+            return KErrEof;
+            }
+        else
+            {
+            return KErrNotFound;    
+            }
+        }
+
+    aLine.Set( aBuffer.Left( pos ) );
+
+    return KErrNone ;
+    }
+
+// ---------------------------------------------------------
+// CReaderXML::DetectFeatureHead
+// ---------------------------------------------------------
+//     
+TDbCreatorFeatures CReaderXML::DetectFeatureHead()
+    {
+    TDbCreatorFeatures feature( EFeatureNone );
+    
+    if ( iLine->FindF( KFeatureHeadPacketData ) != KErrNotFound )
+        {
+        feature = EFeaturePacketData;
+        }
+    else if ( iLine->FindF( KFeatureHeadWLAN ) != KErrNotFound )
+        {
+        feature = EFeatureWLAN;
+        }
+    else if ( iLine->FindF( KFeatureHeadLAN ) != KErrNotFound )
+        {
+        feature = EFeatureLAN;
+        }
+    else if ( iLine->FindF( KFeatureHeadVPN ) != KErrNotFound )
+        {
+        feature = EFeatureVPN;
+        }
+    else if ( iLine->FindF( KFeatureHeadDN ) != KErrNotFound )
+        {
+        feature = EFeatureDN;
+        }
+    else if ( iLine->FindF( KFeatureHeadGlobal ) != KErrNotFound )
+        {
+        feature = EFeatureGlobal;
+        iFoundGlobal = ETrue;        
+        }
+    else
+        {
+        //feature not found            
+        }
+    
+    return feature;
+
+    }
+    
+    
+// ---------------------------------------------------------
+// CReaderXML::DetectFeatureTail
+// ---------------------------------------------------------
+//     
+TBool CReaderXML::DetectFeatureTail()
+    {
+    TBool found( EFalse );
+        
+    switch ( CurrentFeature() )        
+        {
+        case EFeaturePacketData:
+            found = ( iLine->FindF( KFeatureTailPacketData ) != KErrNotFound ); 
+            break;
+        case EFeatureWLAN:
+            found = ( iLine->FindF( KFeatureTailWLAN ) != KErrNotFound );
+            break;
+        case EFeatureLAN:
+            found = ( iLine->FindF( KFeatureTailLAN ) != KErrNotFound );
+            break;
+        case EFeatureVPN:
+            found = ( iLine->FindF( KFeatureTailVPN ) != KErrNotFound );
+            break;
+        case EFeatureDN:
+            found = ( iLine->FindF( KFeatureTailDN ) != KErrNotFound );
+            break;
+        case EFeatureGlobal:
+            found = ( iLine->FindF( KFeatureTailGlobal ) != KErrNotFound );
+            break;
+        }
+    
+    return found;
+    }
+    
+    
+// ---------------------------------------------------------
+// CReaderXML::DetectTailAP
+// ---------------------------------------------------------
+//     
+TBool CReaderXML::DetectTailAP()
+    {
+    TBool found( EFalse );
+        
+    switch ( CurrentFeature() )        
+        {
+        case EFeaturePacketData:
+            found = ( iLine->FindF( KDataTailPacketData ) != KErrNotFound ); 
+            break;
+        case EFeatureWLAN:
+            found = ( iLine->FindF( KDataTailWLAN ) != KErrNotFound );
+            break;
+        case EFeatureLAN:
+            found = ( iLine->FindF( KDataTailLAN ) != KErrNotFound );
+            break;
+        case EFeatureVPN:
+            found = ( iLine->FindF( KDataTailVPN ) != KErrNotFound );
+            break;
+        case EFeatureDN:
+            found = ( iLine->FindF( KDataTailDN ) != KErrNotFound );
+            break;
+        case EFeatureGlobal:
+            //there is no data tail for Global settings -- looks for feature tail
+            found = ( iLine->FindF( KFeatureTailGlobal ) != KErrNotFound );
+            break;
+        }
+    
+    return found;
+    }
+    
+    
+// ---------------------------------------------------------
+// CReaderXML::DetectParamL
+// ---------------------------------------------------------
+//
+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    
+
+    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:
+            User::Panic( KPanicInvalidCase, KErrInvalidCase );
+        }
+       
+    //looks for parameter match
+    HBufC16* paramName = ReadParam( EParamName );
+    TBool found ( EFalse );
+    
+    if ( paramName == NULL )
+            {
+            return fieldId;
+            }
+
+    for ( TInt idx = 0; idx < maxParam && !found; idx++ )
+        {        
+        if ( paramName->CompareF( (*params)[idx].iParam ) == 0 )
+            {
+            fieldId = (*params)[idx].iId;
+            found = ETrue;            
+            }
+        }
+       
+    delete paramName;   
+    return fieldId;
+    }
+  
+    
+// ---------------------------------------------------------
+// CReaderXML::ReadParam
+// ---------------------------------------------------------
+//     
+HBufC16* CReaderXML::ReadParam( TParamSegment aSegment )
+    {
+    TBuf<KMaxItemLength> tag; //local buffer
+    TInt posh( 0 ); //header position
+    TInt post( 0 ); //tail position
+    HBufC16* ret = NULL; // returned pointer
+    
+    //  calculation of the position 
+    //
+    //  EParamValue:           posh|     post|
+    //                             |         |
+    //  EParamName:  posh|    post||         |
+    //                   ¡        ¡¡         ¡ 
+    //                  <ParamName>ParamValue</ParamName>
+    
+    switch ( aSegment )
+        {
+        case EParamValue:
+            posh = iLine->Find( KParamValueHead ) + 1;
+            post = iLine->Find( KParamValueTail );
+            break;
+        case EParamName:
+            posh = iLine->Find( KParamNameHead ) + 1;
+            post = iLine->Find( KParamNameTail );
+            break;
+        default:
+            break;
+        }
+    
+    if ( posh == KErrNotFound || post == KErrNotFound || post == 0 )
+        {
+        //line must contain header and tail and longer than 0
+        ret = NULL;
+        }
+    else
+        {
+        // Copis the value to the local buffer and allocates buffer
+        tag.Copy( iLine->Mid( posh, post - posh ) );
+        ret = tag.Alloc();
+        // Checks the result.
+        if( ret == NULL )
+            {
+            CLOG_WRITE_FORMAT( "! Warning: tag could not be allocated %S:",
+                                     &tag );
+            }
+        }
+    return ret;
+    }
+
+
+// ---------------------------------------------------------
+// CReaderXML::DetectEncoding
+// ---------------------------------------------------------
+//     
+void CReaderXML::DetectEncodingL()
+    {
+    TInt originalPos( iFilePos );  //stores original file position
+    TBool found( EFalse );
+    
+    for ( TInt i = ECharSetUnicode; i >= ECharSetAscii && !found; i--)
+        {
+        //assumes that the first line contains version and encoding info
+        iFilePos = 0;
+        iCharSet = static_cast<TDbCreatorInputCharSet>( i );
+        
+        if ( ReadLineL() == KErrNone )
+            {
+            if( iCharSet == ECharSetAscii )
+                {
+                if ( ( iLine->FindF( KXmlVersion ) != KErrNotFound ) ||
+                     ( iLine->FindF( KEncoding ) != KErrNotFound ) )
+                    {
+                    if( iLine->FindF( KEncodingUtf8 ) != KErrNotFound )
+                        {
+                        iCharSet = ECharSetUtf8;
+                        }
+                    found = ETrue;
+                    }
+                }
+            else if( iCharSet == ECharSetUnicode )
+                {
+                if ( ( iLine->FindF( KXmlVersion ) != KErrNotFound ) ||
+                     ( iLine->FindF( KEncoding ) != KErrNotFound ) )
+                    {
+                    found = ETrue;
+                    }
+                }
+            }
+        }
+    iFilePos = originalPos;
+    }
+    
+// ---------------------------------------------------------
+// CReaderXML::ConvertSpecialXMLChars
+// ---------------------------------------------------------
+//
+void CReaderXML::ConvertSpecialXMLChars( HBufC* aPtrTag )
+    {
+    if ( aPtrTag == NULL )
+            {
+                return;
+            }   
+    _LIT16( escapeStart, "&" );
+    
+    //check if there are parameters to be replaced, if not: return
+    if ( aPtrTag->Des().Find( escapeStart ) == KErrNotFound )
+            {
+                return;
+            }
+                
+    _LIT16( spXML1, "&lt;" );
+    _LIT16( sp1, "<" );
+    ReplaceInString( aPtrTag, spXML1, sp1 );
+    _LIT16( spXML2, "&amp;" );
+    _LIT16( sp2, "&" );
+    ReplaceInString( aPtrTag, spXML2, sp2 );
+    _LIT16( spXML3, "&gt;" );
+    _LIT16( sp3, ">" );
+    ReplaceInString( aPtrTag, spXML3, sp3 );
+    _LIT16( spXML4, "&quot;" );
+    _LIT16( sp4, "\"" );
+    ReplaceInString( aPtrTag, spXML4, sp4 );
+    _LIT16( spXML5, "&apos;" );
+    _LIT16( sp5, "\'" );
+    ReplaceInString( aPtrTag, spXML5, sp5 );
+    _LIT16( spXML6, "&iexcl;" );
+    _LIT16( sp6, "¡" );
+    ReplaceInString( aPtrTag, spXML6, sp6 );
+    _LIT16( spXML7, "&cent;" );
+    _LIT16( sp7, "¢" );
+    ReplaceInString( aPtrTag, spXML7, sp7 );
+    _LIT16( spXML8, "&pound;" );
+    _LIT16( sp8, "£" );
+    ReplaceInString( aPtrTag, spXML8, sp8 );
+    _LIT16( spXML9, "&curren;" );
+    _LIT16( sp9, "¤" );
+    ReplaceInString( aPtrTag, spXML9, sp9 );
+    _LIT16( spXML10, "&yen;" );
+    _LIT16( sp10, "¥" );
+    ReplaceInString( aPtrTag, spXML10, sp10 );
+    _LIT16( spXML11, "&brvbar;" );
+    _LIT16( sp11, "¦" );
+    ReplaceInString( aPtrTag, spXML11, sp11 );
+    _LIT16( spXML12, "&sect;" );
+    _LIT16( sp12, "§" );
+    ReplaceInString( aPtrTag, spXML12, sp12 );
+    _LIT16( spXML13, "&uml;" );
+    _LIT16( sp13, "¨" );
+    ReplaceInString( aPtrTag, spXML13, sp13 );
+    _LIT16( spXML14, "&copy;" );
+    _LIT16( sp14, "©" );
+    ReplaceInString( aPtrTag, spXML14, sp14 );
+    _LIT16( spXML15, "&ordf;" );
+    _LIT16( sp15, "ª" );
+    ReplaceInString( aPtrTag, spXML15, sp15 );
+    _LIT16( spXML16, "&laquo;" );
+    _LIT16( sp16, "«" );
+    ReplaceInString( aPtrTag, spXML16, sp16 );
+    _LIT16( spXML17, "&not;" );
+    _LIT16( sp17, "¬" );
+    ReplaceInString( aPtrTag, spXML17, sp17 );
+    _LIT16( spXML18, "&reg;" );
+    _LIT16( sp18, "®" );
+    ReplaceInString( aPtrTag, spXML18, sp18 );
+    _LIT16( spXML19, "&macr;" );
+    _LIT16( sp19, "¯" );
+    ReplaceInString( aPtrTag, spXML19, sp19 );
+    _LIT16( spXML20, "&deg;" );
+    _LIT16( sp20, "°" );
+    ReplaceInString( aPtrTag, spXML20, sp20 );
+    _LIT16( spXML21, "&plusmn;" );
+    _LIT16( sp21, "±" );
+    ReplaceInString( aPtrTag, spXML21, sp21 );
+    _LIT16( spXML22, "&sup2;" );
+    _LIT16( sp22, "²" );
+    ReplaceInString( aPtrTag, spXML22, sp22 );
+    _LIT16( spXML23, "&sup3;" );
+    _LIT16( sp23, "³" );
+    ReplaceInString( aPtrTag, spXML23, sp23 );
+    _LIT16( spXML24, "&acute;" );
+    _LIT16( sp24, "´" );
+    ReplaceInString( aPtrTag, spXML24, sp24 );
+    _LIT16( spXML25, "&micro;" );
+    _LIT16( sp25, "µ" );
+    ReplaceInString( aPtrTag, spXML25, sp25 );
+    _LIT16( spXML26, "&para;" );
+    _LIT16( sp26, "¶" );
+    ReplaceInString( aPtrTag, spXML26, sp26 );  
+    _LIT16( spXML27, "&middot;" );
+    _LIT16( sp27, "·" );
+    ReplaceInString( aPtrTag, spXML27, sp27 );
+    _LIT16( spXML28, "&cedil;" );
+    _LIT16( sp28, "¸" );
+    ReplaceInString( aPtrTag, spXML28, sp28 );
+    _LIT16( spXML29, "&sup1;" );
+    _LIT16( sp29, "¹" );
+    ReplaceInString( aPtrTag, spXML29, sp29 );
+    _LIT16( spXML30, "&ordm;" );
+    _LIT16( sp30, "º" );
+    ReplaceInString( aPtrTag, spXML30, sp30 );
+    _LIT16( spXML31, "&raquo;" );
+    _LIT16( sp31, "»" );
+    ReplaceInString( aPtrTag, spXML31, sp31 );
+    _LIT16( spXML32, "&frac14;" );
+    _LIT16( sp32, "¼" );
+    ReplaceInString( aPtrTag, spXML32, sp32 );
+    _LIT16( spXML33, "&frac12;" );
+    _LIT16( sp33, "½" );
+    ReplaceInString( aPtrTag, spXML33, sp33 );
+    _LIT16( spXML34, "&frac34;" );
+    _LIT16( sp34, "¾" );
+    ReplaceInString( aPtrTag, spXML34, sp34 );
+    _LIT16( spXML35, "&iquest;" );
+    _LIT16( sp35, "¿" );
+    ReplaceInString( aPtrTag, spXML35, sp35 );
+    _LIT16( spXML36, "&Agrave;" );
+    _LIT16( sp36, "À" );
+    ReplaceInString( aPtrTag, spXML36, sp36 );
+    _LIT16( spXML37, "&Aacute;" );
+    _LIT16( sp37, "Á" );
+    ReplaceInString( aPtrTag, spXML37, sp37 );
+    _LIT16( spXML38, "&Acirc;" );
+    _LIT16( sp38, "Â" );
+    ReplaceInString( aPtrTag, spXML38, sp38 );
+    _LIT16( spXML39, "&Atilde;" );
+    _LIT16( sp39, "Ã" );
+    ReplaceInString( aPtrTag, spXML39, sp39 );
+    _LIT16( spXML40, "&Auml;" );
+    _LIT16( sp40, "Ä" );
+    ReplaceInString( aPtrTag, spXML40, sp40 );
+    _LIT16( spXML41, "&Aring;" );
+    _LIT16( sp41, "Å" );
+    ReplaceInString( aPtrTag, spXML41, sp41 );
+    _LIT16( spXML42, "&AElig;" );
+    _LIT16( sp42, "Æ" );
+    ReplaceInString( aPtrTag, spXML42, sp42 ); 
+    _LIT16( spXML43, "&Ccedil;" );
+    _LIT16( sp43, "Ç" );
+    ReplaceInString( aPtrTag, spXML43, sp43 );
+    _LIT16( spXML44, "&Egrave;" );
+    _LIT16( sp44, "È" );
+    ReplaceInString( aPtrTag, spXML44, sp44 );
+    _LIT16( spXML45, "&Eacute;" );
+    _LIT16( sp45, "É" );
+    ReplaceInString( aPtrTag, spXML45, sp45 );
+    _LIT16( spXML46, "&Ecirc;" );
+    _LIT16( sp46, "Ê" );
+    ReplaceInString( aPtrTag, spXML46, sp46 );
+    _LIT16( spXML47, "&Euml;" );
+    _LIT16( sp47, "Ë" );
+    ReplaceInString( aPtrTag, spXML47, sp47 );
+    _LIT16( spXML48, "&Igrave;" );
+    _LIT16( sp48, "Ì" );
+    ReplaceInString( aPtrTag, spXML48, sp48 );
+    _LIT16( spXML49, "&Iacute;" );
+    _LIT16( sp49, "Í" );
+    ReplaceInString( aPtrTag, spXML49, sp49 );
+    _LIT16( spXML50, "&Icirc;" );
+    _LIT16( sp50, "Î" );
+    ReplaceInString( aPtrTag, spXML50, sp50 );
+    _LIT16( spXML51, "&Iuml;" );
+    _LIT16( sp51, "Ï" );
+    ReplaceInString( aPtrTag, spXML51, sp51 );
+    _LIT16( spXML52, "&ETH;" );
+    _LIT16( sp52, "Ð" );
+    ReplaceInString( aPtrTag, spXML52, sp52 );
+    _LIT16( spXML53, "&Ntilde;" );
+    _LIT16( sp53, "Ñ" );
+    ReplaceInString( aPtrTag, spXML53, sp53 );
+    _LIT16( spXML54, "&Ograve;" );
+    _LIT16( sp54, "Ò" );
+    ReplaceInString( aPtrTag, spXML54, sp54 );
+    _LIT16( spXML55, "&Oacute;" );
+    _LIT16( sp55, "Ó" );
+    ReplaceInString( aPtrTag, spXML55, sp55 );
+    _LIT16( spXML56, "&Ocirc;" );
+    _LIT16( sp56, "Ô" );
+    ReplaceInString( aPtrTag, spXML56, sp56 );
+    _LIT16( spXML57, "&Otilde;" );
+    _LIT16( sp57, "Õ" );
+    ReplaceInString( aPtrTag, spXML57, sp57 );
+    _LIT16( spXML58, "&Ouml;" );
+    _LIT16( sp58, "Ö" );
+    ReplaceInString( aPtrTag, spXML58, sp58 );
+    _LIT16( spXML59, "&times;" );
+    _LIT16( sp59, "×" );
+    ReplaceInString( aPtrTag, spXML59, sp59 );
+    _LIT16( spXML60, "&Oslash;" );
+    _LIT16( sp60, "Ø" );
+    ReplaceInString( aPtrTag, spXML60, sp60 );
+    _LIT16( spXML61, "&Ugrave;" );
+    _LIT16( sp61, "Ù" );
+    ReplaceInString( aPtrTag, spXML61, sp61 );
+    _LIT16( spXML62, "&Uacute;" );
+    _LIT16( sp62, "Ú" );
+    ReplaceInString( aPtrTag, spXML62, sp62 );
+    _LIT16( spXML63, "&Ucirc;" );
+    _LIT16( sp63, "Û" );
+    ReplaceInString( aPtrTag, spXML63, sp63 );
+    _LIT16( spXML64, "&Uuml;" );
+    _LIT16( sp64, "Ü" );
+    ReplaceInString( aPtrTag, spXML64, sp64 );
+    _LIT16( spXML65, "&Yacute;" );
+    _LIT16( sp65, "Ý" );
+    ReplaceInString( aPtrTag, spXML65, sp65 );
+    _LIT16( spXML66, "&THORN;" );
+    _LIT16( sp66, "Þ" );
+    ReplaceInString( aPtrTag, spXML66, sp66 );
+    _LIT16( spXML67, "&szlig;" );
+    _LIT16( sp67, "ß" );
+    ReplaceInString( aPtrTag, spXML67, sp67 );
+    _LIT16( spXML68, "&agrave;" );
+    _LIT16( sp68, "à" );
+    ReplaceInString( aPtrTag, spXML68, sp68 );
+    _LIT16( spXML69, "&aacute;" );
+    _LIT16( sp69, "á" );
+    ReplaceInString( aPtrTag, spXML69, sp69 );
+    _LIT16( spXML70, "&acirc;" );
+    _LIT16( sp70, "â" );
+    ReplaceInString( aPtrTag, spXML70, sp70 );
+    _LIT16( spXML71, "&atilde;" );
+    _LIT16( sp71, "ã" );
+    ReplaceInString( aPtrTag, spXML71, sp71 );
+    _LIT16( spXML72, "&auml;");
+    _LIT16( sp72, "ä" );
+    ReplaceInString( aPtrTag, spXML72, sp72 );
+    _LIT16( spXML73, "&aring;" );
+    _LIT16( sp73, "å" );
+    ReplaceInString( aPtrTag, spXML73, sp73 );
+    _LIT16( spXML74, "&aelig;" );
+    _LIT16( sp74, "æ" );
+    ReplaceInString( aPtrTag, spXML74, sp74 );
+    _LIT16( spXML75, "&acedil;" );
+    _LIT16( sp75, "ç" );
+    ReplaceInString( aPtrTag, spXML75, sp75 );
+    _LIT16( spXML76, "&egrave;" );
+    _LIT16( sp76, "è" );
+    ReplaceInString( aPtrTag, spXML76, sp76 );
+    _LIT16( spXML77, "&eacute;" );
+    _LIT16( sp77, "é" );
+    ReplaceInString( aPtrTag, spXML77, sp77 );
+    _LIT16( spXML78, "&ecirc;" );
+    _LIT16( sp78, "ê" );
+    ReplaceInString( aPtrTag, spXML78, sp78 );
+    _LIT16( spXML79, "&euml;" );
+    _LIT16( sp79, "ë" );
+    ReplaceInString( aPtrTag, spXML79, sp79 );
+    _LIT16( spXML80, "&igrave;" );
+    _LIT16( sp80, "ì" );
+    ReplaceInString( aPtrTag, spXML80, sp80 );
+    _LIT16( spXML81, "&iacute;" );
+    _LIT16( sp81, "í" );
+    ReplaceInString( aPtrTag, spXML81, sp81 );
+    _LIT16( spXML82, "&icirc;" );
+    _LIT16( sp82, "î" );
+    ReplaceInString( aPtrTag, spXML82, sp82 );
+    _LIT16( spXML83, "&iuml;" );
+    _LIT16( sp83, "ï" );
+    ReplaceInString( aPtrTag, spXML83, sp83 );
+    _LIT16( spXML84, "&eth;" );
+    _LIT16( sp84, "ð" );
+    ReplaceInString( aPtrTag, spXML84, sp84 );
+    _LIT16( spXML85, "&ntilde;" );
+    _LIT16( sp85, "ñ" );
+    ReplaceInString( aPtrTag, spXML85, sp85 );
+    _LIT16( spXML86, "&ograve;" );
+    _LIT16( sp86, "ò" );
+    ReplaceInString( aPtrTag, spXML86, sp86 );
+    _LIT16( spXML87, "&oacute;" );
+    _LIT16( sp87, "ó" );
+    ReplaceInString( aPtrTag, spXML87, sp87 );
+    _LIT16( spXML88, "&ocirc;" );
+    _LIT16( sp88, "ô" );
+    ReplaceInString( aPtrTag, spXML88, sp88 );
+    _LIT16( spXML89, "&otilde;" );
+    _LIT16( sp89, "õ" );
+    ReplaceInString( aPtrTag, spXML89, sp89 );
+    _LIT16( spXML90, "&ouml;" );
+    _LIT16( sp90, "ö" );
+    ReplaceInString( aPtrTag, spXML90, sp90 );
+    _LIT16( spXML91, "&divide;" );
+    _LIT16( sp91, "÷" );
+    ReplaceInString( aPtrTag, spXML91, sp91 );
+    _LIT16( spXML92, "&oslash;" );
+    _LIT16( sp92, "ø" );
+    ReplaceInString( aPtrTag, spXML92, sp92 );
+    _LIT16( spXML93, "&ugrave;" );
+    _LIT16( sp93, "ù" );
+    ReplaceInString( aPtrTag, spXML93, sp93 );
+    _LIT16( spXML94, "&uacute;" );
+    _LIT16( sp94, "ú" );
+    ReplaceInString( aPtrTag, spXML94, sp94 );
+    _LIT16( spXML95, "&ucirc;" );
+    _LIT16( sp95, "û" );
+    ReplaceInString( aPtrTag, spXML95, sp95 );
+    _LIT16( spXML96, "&uuml;" );
+    _LIT16( sp96, "ü" );
+    ReplaceInString( aPtrTag, spXML96, sp96 );
+    _LIT16( spXML97, "&yacute;" );
+    _LIT16( sp97, "ý" );
+    ReplaceInString( aPtrTag, spXML97, sp97 );
+    _LIT16( spXML98, "&thorn;" );
+    _LIT16( sp98, "þ" );
+    ReplaceInString( aPtrTag, spXML98, sp98 );
+    _LIT16( spXML99, "&yuml;" );
+    _LIT16( sp99, "ÿ" );
+    ReplaceInString( aPtrTag, spXML99, sp99 );
+    _LIT16( spXML100, "&OElig;" );
+    _LIT16( sp100, "Œ" );
+    ReplaceInString( aPtrTag, spXML100, sp100 );
+    _LIT16( spXML101, "&oelig;" );
+    _LIT16( sp101, "œ" );
+    ReplaceInString( aPtrTag, spXML101, sp101 );
+    _LIT16( spXML102, "&Scaron;" );
+    _LIT16( sp102, "Š" );
+    ReplaceInString( aPtrTag, spXML102, sp102 );
+    _LIT16( spXML103, "&scaron;" );
+    _LIT16( sp103, "š" );
+    ReplaceInString( aPtrTag, spXML103, sp103 );
+    _LIT16( spXML104, "&Yuml;" );
+    _LIT16( sp104, "Ÿ" );
+    ReplaceInString( aPtrTag, spXML104, sp104 );
+    _LIT16( spXML105, "&fnof;" );
+    _LIT16( sp105, "ƒ" );
+    ReplaceInString( aPtrTag, spXML105, sp105 );
+    _LIT16( spXML106, "&circ;" );
+    _LIT16( sp106, "ˆ" );
+    ReplaceInString( aPtrTag, spXML106, sp106 );
+    _LIT16( spXML107, "&tilde;" );
+    _LIT16( sp107, "˜" );
+    ReplaceInString( aPtrTag, spXML107, sp107 );
+    }
+
+// ---------------------------------------------------------
+// CReaderXML::Replace
+// ---------------------------------------------------------
+//
+void CReaderXML::ReplaceInString(   HBufC* aPtrTag, 
+                                const TDesC& aSpXML, 
+                                const TDesC& aSp )
+    {
+        if( aPtrTag == NULL )
+        {
+            return;
+        }
+    TInt strPos = aPtrTag->Des().Find(aSpXML);
+    while ( strPos != KErrNotFound )
+        {
+        aPtrTag->Des().Replace(strPos, aSpXML.Length() , aSp);
+        strPos = aPtrTag->Des().Find(aSpXML);     
+        }
+    }   
+
+//maximum number of VPN AP parameters
+
+
+void CReaderXML::FillPacketDataParams()    
+    {
+    iPDParams.Append( EInputParams( ECmName,                          KConnectionName ) );
+    iPDParams.Append( EInputParams( ECmId,                            KConnectionId ) );
+    iPDParams.Append( EInputParams( ECmProtected,                     KProtected ) );
+    iPDParams.Append( EInputParams( ECmHidden,                        KHidden ) );
+    iPDParams.Append( EInputParams( ECmMetaHiddenAgent,               KHiddenAgent ) );
+    iPDParams.Append( EInputParams( ECmMetaHighlight,                 KHighlighted ) );
+    iPDParams.Append( EInputParams( ECmSeamlessnessLevel,             KSeamlessness ) );
+    iPDParams.Append( EInputParams( EPacketDataAPName,                KGprs_AP_Name ) );
+    iPDParams.Append( EInputParams( EPacketDataIFAuthName,            KUserName ) );
+    iPDParams.Append( EInputParams( EPacketDataIFPromptForAuth,       KPromptPassword ) );
+    iPDParams.Append( EInputParams( EPacketDataIFAuthPass,            KPassword ) );
+    iPDParams.Append( EInputParams( EPacketDataDisablePlainTextAuth,  KPasswordAuthType ) );
+    iPDParams.Append( EInputParams( ECmWapIPGatewayAddress,           KWAPGatewayIP ) );
+    iPDParams.Append( EInputParams( ECmStartPage,                     KStartingPage ) );
+    iPDParams.Append( EInputParams( ECmWapIPSecurity,                 KWTLS_Security ) );
+    iPDParams.Append( EInputParams( ECmWapIPWSPOption,                KWAP_ConnectionType ) );
+    iPDParams.Append( EInputParams( EPacketDataIPAddr,                KPhoneIP ) );
+    iPDParams.Append( EInputParams( EPacketDataIPNameServer1,         KPrimaryNameServer ) );
+    iPDParams.Append( EInputParams( EPacketDataIPNameServer2,         KSecondaryNameServer ) );
+    iPDParams.Append( EInputParams( ECmProxyServerName,               KProxyServerAddress ) );
+    iPDParams.Append( EInputParams( ECmProxyPortNumber,               KProxyPortNumber ) );
+    iPDParams.Append( EInputParams( ECmProxyProtocolName,             KProxyProtocolName ) );
+    iPDParams.Append( EInputParams( EPacketDataIPIP6NameServer1,      KPrimaryIP6NameServer ) );
+    iPDParams.Append( EInputParams( EPacketDataIPIP6NameServer2,      KSecondaryIP6NameServer ) );
+    iPDParams.Append( EInputParams( EPacketDataApType,                KIspType ) );
+    iPDParams.Append( EInputParams( EPacketDataPDPType,               KNetworkType ) );
+    iPDParams.Append( EInputParams( EPacketDataUseEdge,               KGprsUseEdge ) );
+    iPDParams.Append( EInputParams( EPacketDataLinger,                KLinger ) );
+    };
+
+void CReaderXML::FillLanParams()    
+    {
+    iLanParams.Append( EInputParams( ECmName,                           KConnectionName ) );
+    iLanParams.Append( EInputParams( ECmId,                             KConnectionId ) );
+    iLanParams.Append( EInputParams( ECmProtected,                      KProtected ) );
+    iLanParams.Append( EInputParams( ECmHidden,                         KHidden ) );
+    iLanParams.Append( EInputParams( ECmMetaHiddenAgent,                KHiddenAgent ) );
+    iLanParams.Append( EInputParams( ECmMetaHighlight,                  KHighlighted ) );
+    iLanParams.Append( EInputParams( ECmSeamlessnessLevel,              KSeamlessness ) );
+    iLanParams.Append( EInputParams( ECmWapIPGatewayAddress,            KWAPGatewayIP ) );
+    iLanParams.Append( EInputParams( ECmStartPage,                      KStartingPage ) );
+    iLanParams.Append( EInputParams( ECmWapIPSecurity,                  KWTLS_Security ) );
+    iLanParams.Append( EInputParams( ECmWapIPWSPOption,                 KWAP_ConnectionType ) );
+    iLanParams.Append( EInputParams( ECmProxyServerName,                KProxyServerAddress ) );
+    iLanParams.Append( EInputParams( ECmProxyPortNumber,                KProxyPortNumber ) );
+    iLanParams.Append( EInputParams( ECmProxyProtocolName,              KProxyProtocolName ) );
+    iLanParams.Append( EInputParams( ELanIfNetworks,                    KLanIfNetworks ) );
+    iLanParams.Append( EInputParams( ELanIpNetMask,                     KLanIpNetMask ) );
+    iLanParams.Append( EInputParams( ELanIpGateway,                     KLanIpGateway ) );
+    iLanParams.Append( EInputParams( ELanIpAddr,                        KPhoneIP ) );
+    iLanParams.Append( EInputParams( ELanIpNameServer1,                 KPrimaryNameServer ) );
+    iLanParams.Append( EInputParams( ELanIpNameServer2,                 KSecondaryNameServer ) );
+    iLanParams.Append( EInputParams( ELanIp6NameServer1,                KPrimaryIP6NameServer ) );
+    iLanParams.Append( EInputParams( ELanIp6NameServer2,                KSecondaryIP6NameServer ) );
+    iLanParams.Append( EInputParams( ELanIpAddrFromServer,              KLanIpAddrFromServer ) );
+    iLanParams.Append( EInputParams( ELanIpDNSAddrFromServer,           KLanIpDNSAddrFromServer ) );
+    iLanParams.Append( EInputParams( ELanConfigDaemonManagerName,       KLanConfigDaemonManagerName ) );
+    iLanParams.Append( EInputParams( ELanConfigDaemonName,              KLanConfigDaemonName ) );
+    };
+    
+//Binds WLAN access point parameters to field IDs
+void CReaderXML::FillWLanParams()    
+    {        
+    iWLanParams.Append( EInputParams( ECmName,                      KConnectionName ) );
+    iWLanParams.Append( EInputParams( ECmId,                        KConnectionId ) );
+    iWLanParams.Append( EInputParams( ECmProtected,                 KProtected ) );
+    iWLanParams.Append( EInputParams( ECmHidden,                    KHidden ) );
+    iWLanParams.Append( EInputParams( ECmMetaHiddenAgent,           KHiddenAgent ) );
+    iWLanParams.Append( EInputParams( ECmMetaHighlight,             KHighlighted ) );
+    iWLanParams.Append( EInputParams( ECmSeamlessnessLevel,         KSeamlessness ) );
+    iWLanParams.Append( EInputParams( ECmStartPage,                 KStartingPage ) );
+    iWLanParams.Append( EInputParams( EWlanSSID,                    KNetworkName ) );
+    iWLanParams.Append( EInputParams( EWlanConnectionMode,          KNetworkMode ) );
+    iWLanParams.Append( EInputParams( EWlanSecurityMode,            KSecurityMode ) );
+    iWLanParams.Append( EInputParams( EWlanIpNameServer1,           KPrimaryNameServer ) );
+    iWLanParams.Append( EInputParams( EWlanIpNameServer2,           KSecondaryNameServer ) );
+    iWLanParams.Append( EInputParams( EWlanIp6NameServer1,          KPrimaryIP6NameServer ) );
+    iWLanParams.Append( EInputParams( EWlanIp6NameServer2,          KSecondaryIP6NameServer ) );
+    iWLanParams.Append( EInputParams( EWlanIpGateway,               KWlanIpGatewayAddress ) );
+    iWLanParams.Append( EInputParams( ECmProxyServerName,           KProxyServerAddress ) );
+    iWLanParams.Append( EInputParams( ECmProxyProtocolName,         KProxyProtocolName ) );
+    iWLanParams.Append( EInputParams( EWlanIpNetMask,               KWlanIpNetMask ) );
+    iWLanParams.Append( EInputParams( ECmProxyPortNumber,           KProxyPortNumber ) );
+    iWLanParams.Append( EInputParams( EWlanIpAddr,                  KPhoneIP ) ); 
+    iWLanParams.Append( EInputParams( EWlanScanSSID,                KWlanScanSSId ) );
+    iWLanParams.Append( EInputParams( EWlanChannelID,               KWlanChannelId ) );
+    iWLanParams.Append( EInputParams( EWEPKeyInUse,                 KWEPKeyInUse ) );
+    iWLanParams.Append( EInputParams( EWEPAuthType,                 KWEPAuthType ) );
+    iWLanParams.Append( EInputParams( EWEPKey1Length,               KWEPKey1Length ) );
+    iWLanParams.Append( EInputParams( EWEPKey1Format,               KWEPKey1Format ) );
+    iWLanParams.Append( EInputParams( EWEPKey1Data,                 KWEPKey1Data ) );
+    iWLanParams.Append( EInputParams( EWEPKey2Length,               KWEPKey2Length ) );
+    iWLanParams.Append( EInputParams( EWEPKey2Format,               KWEPKey2Format ) );
+    iWLanParams.Append( EInputParams( EWEPKey2Data,                 KWEPKey2Data ) );
+    iWLanParams.Append( EInputParams( EWEPKey3Length,               KWEPKey3Length ) );
+    iWLanParams.Append( EInputParams( EWEPKey3Format,               KWEPKey3Format ) );
+    iWLanParams.Append( EInputParams( EWEPKey3Data,                 KWEPKey3Data ) );
+    iWLanParams.Append( EInputParams( EWEPKey4Length,               KWEPKey4Length ) );
+    iWLanParams.Append( EInputParams( EWEPKey4Format,               KWEPKey4Format ) );
+    iWLanParams.Append( EInputParams( EWEPKey4Data,                 KWEPKey4Data ) );
+    iWLanParams.Append( EInputParams( EWPAPresharedKey,             KWPAPresharedKey ) );
+    iWLanParams.Append( EInputParams( EWPAKeyLength,                KWPAKeyLength ) );
+    iWLanParams.Append( EInputParams( EWPAListOfEAPs,               KWPAListOfEAPs ) );
+    iWLanParams.Append( EInputParams( EWPAUseOfPresharedKey,        KWPAUseOfPresharedKey ) );
+    iWLanParams.Append( EInputParams( EEapGtcUsername,              KEapGtcUsername ) );
+    iWLanParams.Append( EInputParams( EEapGtcSessionValidityTime,   KEapGtcSessionValidityTime ) );
+    iWLanParams.Append( EInputParams( EEapGtcEncapsulation,         KEapGtcEncapsulation ) );
+    iWLanParams.Append( EInputParams( EEapTlsUsername,              KEapTlsUsername ) );
+    iWLanParams.Append( EInputParams( EEapTlsRealm,                 KEapTlsRealm ) );
+    iWLanParams.Append( EInputParams( EEapTlsVerifyServerRealm,     KEapTlsVerifyServerRealm ) );
+    iWLanParams.Append( EInputParams( EEapTlsRequireClientAuth,     KEapTlsRequireClientAuth ) );
+    iWLanParams.Append( EInputParams( EEapTlsSessionValidityTime,   KEapTlsSessionValidityTime ) );
+    iWLanParams.Append( EInputParams( EEapTlsCipherSuites,          KEapTlsCipherSuites ) );
+    iWLanParams.Append( EInputParams( EEapTlsUserCertSubjectKeyId,  KEapTlsUserCertSubjectKeyId ) );
+    iWLanParams.Append( EInputParams( EEapTlsUserCertIssuerName,    KEapTlsUserCertIssuerName ) );
+    iWLanParams.Append( EInputParams( EEapTlsUserCertSerialNumber,  KEapTlsUserCertSerialNumber ) );
+    iWLanParams.Append( EInputParams( EEapTlsCaCertSubjectKeyId,    KEapTlsCaCertSubjectKeyId ) );
+    iWLanParams.Append( EInputParams( EEapTlsCaCertIssuerName,      KEapTlsCaCertIssuerName ) );
+    iWLanParams.Append( EInputParams( EEapTlsCaCertSerialNumber,    KEapTlsCaCertSerialNumber ) );
+    iWLanParams.Append( EInputParams( EEapTlsEncapsulation,         KEapTlsEncapsulation ) );
+    iWLanParams.Append( EInputParams( EEapLeapUsername,             KEapLeapUsername ) );
+    iWLanParams.Append( EInputParams( EEapLeapPassword,             KEapLeapPassword ) );
+    iWLanParams.Append( EInputParams( EEapLeapSessionValidityTime,  KEapLeapSessionValidityTime ) );
+    iWLanParams.Append( EInputParams( EEapSimUsername,              KEapSimUsername ) );
+    iWLanParams.Append( EInputParams( EEapSimRealm,                 KEapSimRealm ) );
+    iWLanParams.Append( EInputParams( EEapSimUsePseudonyms,         KEapSimUsePseudonyms ) );
+    iWLanParams.Append( EInputParams( EEapSimSessionValidityTime,   KEapSimSessionValidityTime ) );
+    iWLanParams.Append( EInputParams( EEapSimEncapsulation,         KEapSimEncapsulation ) );
+    iWLanParams.Append( EInputParams( EEapTtlsUsername,             KEapTtlsUsername ) );
+    iWLanParams.Append( EInputParams( EEapTtlsRealm,                KEapTtlsRealm ) );
+    iWLanParams.Append( EInputParams( EEapTtlsVerifyServerRealm,    KEapTtlsVerifyServerRealm ) );
+    iWLanParams.Append( EInputParams( EEapTtlsRequireClientAuth,    KEapTtlsRequireClientAuth ) );
+    iWLanParams.Append( EInputParams( EEapTtlsSessionValidityTime,  KEapTtlsSessionValidityTime ) );
+    iWLanParams.Append( EInputParams( EEapTtlsCipherSuites,         KEapTtlsCipherSuites ) );
+    iWLanParams.Append( EInputParams( EEapTtlsEncapsulatedTypes,    KEapTtlsEncapsulatedTypes ) );
+    iWLanParams.Append( EInputParams( EEapTtlsUserCertSubjectKeyId, KEapTtlsUserCertSubjectKeyId ) );
+    iWLanParams.Append( EInputParams( EEapTtlsUserCertIssuerName,   KEapTtlsUserCertIssuerName ) );
+    iWLanParams.Append( EInputParams( EEapTtlsUserCertSerialNumber, KEapTtlsUserCertSerialNumber ) );
+    iWLanParams.Append( EInputParams( EEapTtlsCaCertSubjectKeyId,   KEapTtlsCaCertSubjectKeyId ) );
+    iWLanParams.Append( EInputParams( EEapTtlsCaCertIssuerName,     KEapTtlsCaCertIssuerName ) );
+    iWLanParams.Append( EInputParams( EEapTtlsCaCertSerialNumber,   KEapTtlsCaCertSerialNumber ) );
+    iWLanParams.Append( EInputParams( EEapAkaUsername,              KEapAkaUsername ) );
+    iWLanParams.Append( EInputParams( EEapAkaRealm,                 KEapAkaRealm ) );
+    iWLanParams.Append( EInputParams( EEapAkaUsePseudonyms,         KEapAkaUsePseudonyms ) );
+    iWLanParams.Append( EInputParams( EEapAkaSessionValidityTime,   KEapAkaSessionValidityTime ) );
+    iWLanParams.Append( EInputParams( EEapAkaEncapsulation,         KEapAkaEncapsulation ) );
+    iWLanParams.Append( EInputParams( EEapPeapUsername,             KEapPeapUsername ) );
+    iWLanParams.Append( EInputParams( EEapPeapRealm,                KEapPeapRealm ) );
+    iWLanParams.Append( EInputParams( EEapPeapVerifyServerRealm,    KEapPeapVerifyServerRealm ) );
+    iWLanParams.Append( EInputParams( EEapPeapRequireClientAuth,    KEapPeapRequireClientAuth ) );
+    iWLanParams.Append( EInputParams( EEapPeapSessionValidityTime,  KEapPeapSessionValidityTime ) );
+    iWLanParams.Append( EInputParams( EEapPeapCipherSuites,         KEapPeapCipherSuites ) );
+    iWLanParams.Append( EInputParams( EEapPeapV0Allowed,            KEapPeapV0Allowed ) );
+    iWLanParams.Append( EInputParams( EEapPeapV1Allowed,            KEapPeapV1Allowed ) );
+    iWLanParams.Append( EInputParams( EEapPeapV2Allowed,            KEapPeapV2Allowed ) );
+    iWLanParams.Append( EInputParams( EEapPeapEncapsulatedTypes,    KEapPeapEncapsulatedTypes ) );
+    iWLanParams.Append( EInputParams( EEapPeapUserCertSubjectKeyId, KEapPeapUserCertSubjectKeyId ) );
+    iWLanParams.Append( EInputParams( EEapPeapUserCertIssuerName,   KEapPeapUserCertIssuerName ) );
+    iWLanParams.Append( EInputParams( EEapPeapUserCertSerialNumber, KEapPeapUserCertSerialNumber ) );
+    iWLanParams.Append( EInputParams( EEapPeapCaCertSubjectKeyId,   KEapPeapCaCertSubjectKeyId ) );
+    iWLanParams.Append( EInputParams( EEapPeapCaCertIssuerName,     KEapPeapCaCertIssuerName ) );
+    iWLanParams.Append( EInputParams( EEapPeapCaCertSerialNumber,   KEapPeapCaCertSerialNumber ) );
+    iWLanParams.Append( EInputParams( EEapMschapv2Username,         KEapMschapv2Username ) );
+    iWLanParams.Append( EInputParams( EEapMschapv2Password,         KEapMschapv2Password ) );
+    iWLanParams.Append( EInputParams( EEapMschapv2SessionValidityTime, KEapMschapv2SessionValidityTime ) );
+    iWLanParams.Append( EInputParams( EEapMschapv2Encapsulation,    KEapMschapv2Encapsulation ) );
+    iWLanParams.Append( EInputParams( EEapFastUsername,             KEapFastUsername ) );
+    iWLanParams.Append( EInputParams( EEapFastRealm,                KEapFastRealm ) );
+    iWLanParams.Append( EInputParams( EEapFastVerifyServerRealm,    KEapFastVerifyServerRealm ) );
+    iWLanParams.Append( EInputParams( EEapFastRequireClientAuth,    KEapFastRequireClientAuth ) );
+    iWLanParams.Append( EInputParams( EEapFastSessionValidityTime,  KEapFastSessionValidityTime ) );
+    iWLanParams.Append( EInputParams( EEapFastCipherSuites,         KEapFastCipherSuites ) );
+    iWLanParams.Append( EInputParams( EEapFastEncapsulatedTypes,    KEapFastEncapsulatedTypes ) );
+    iWLanParams.Append( EInputParams( EEapFastAuthProvModeAllowed,  KEapFastAuthProvModeAllowed ) );
+    iWLanParams.Append( EInputParams( EEapFastUnauthProvModeAllowed, KEapFastUnauthProvModeAllowed ) );
+    iWLanParams.Append( EInputParams( EEapFastWarnADHPNoPAC,        KEapFastWarnADHPNoPAC ) );
+    iWLanParams.Append( EInputParams( EEapFastWarnADHPNoMatchingPAC, KEapFastWarnADHPNoMatchingPAC ) );
+    iWLanParams.Append( EInputParams( EEapFastWarnNotDefaultServer, KEapFastWarnNotDefaultServer ) );
+    iWLanParams.Append( EInputParams( EEapFastUserCertSubjectKeyId, KEapFastUserCertSubjectKeyId ) );
+    iWLanParams.Append( EInputParams( EEapFastUserCertIssuerName,   KEapFastUserCertIssuerName ) );
+    iWLanParams.Append( EInputParams( EEapFastUserCertSerialNumber, KEapFastUserCertSerialNumber ) );
+    iWLanParams.Append( EInputParams( EEapFastCaCertSubjectKeyId,   KEapFastCaCertSubjectKeyId ) );
+    iWLanParams.Append( EInputParams( EEapFastCaCertIssuerName,     KEapFastCaCertIssuerName ) );
+    iWLanParams.Append( EInputParams( EEapFastCaCertSerialNumber,   KEapFastCaCertSerialNumber ) );
+    iWLanParams.Append( EInputParams( EMschapv2Username,            KMschapv2Username ) );
+    iWLanParams.Append( EInputParams( EMschapv2Password,            KMschapv2Password ) );
+    iWLanParams.Append( EInputParams( EMschapv2SessionValidityTime, KMschapv2SessionValidityTime ) );
+    iWLanParams.Append( EInputParams( EMschapv2Encapsulation, 		KMschapv2Encapsulation ) );        
+    };
+    
+    
+
+void CReaderXML::FillVpnParams()    
+    {
+    iVpnParams.Reset();
+        
+    iVpnParams.Append( EInputParams( ECmName,              KConnectionName ) );
+    iVpnParams.Append( EInputParams( ECmId,                KConnectionId ) );
+    iVpnParams.Append( EInputParams( ECmProtected,         KProtected ) );
+    iVpnParams.Append( EInputParams( ECmHidden,            KHidden ) );
+    iVpnParams.Append( EInputParams( ECmMetaHiddenAgent,   KHiddenAgent ) );
+    iVpnParams.Append( EInputParams( ECmMetaHighlight,     KHighlighted ) );
+    iVpnParams.Append( EInputParams( ECmSeamlessnessLevel, KSeamlessness ) );
+    iVpnParams.Append( EInputParams( ECmProxyServerName,   KProxyServerAddress ) );
+    iVpnParams.Append( EInputParams( ECmProxyPortNumber,   KProxyPortNumber ) );
+    iVpnParams.Append( EInputParams( ECmProxyProtocolName, KProxyProtocolName ) );
+    iVpnParams.Append( EInputParams( EVPN_IapName,         KVpnIapName ) );
+    iVpnParams.Append( EInputParams( EVpnServicePolicy,    KVpnServicePolicy ) );
+
+    };    
+
+//Binds Gobal settings parameters to field IDs
+void CReaderXML::FillGlobalParams()    
+    {         
+    iGlobalParams.Append( EInputParams( EGPRSAttachMode,        KAttachMode ) );
+    iGlobalParams.Append( EInputParams( EDefaultAP,             KDefaultAP) );
+    iGlobalParams.Append( EInputParams( EDefaultDnIcon,         KDefaultDnIcon ) );
+    iGlobalParams.Append( EInputParams( EPriorityLan,           KPriorityLan ) );
+    iGlobalParams.Append( EInputParams( EPriorityWlan,          KPriorityWlan ) );
+    iGlobalParams.Append( EInputParams( EPriorityPan,           KPriorityPan ) );
+    iGlobalParams.Append( EInputParams( EPriorityGprsOut,       KPriorityGprsOut ) );
+    iGlobalParams.Append( EInputParams( EPriorityGprsIn,        KPriorityGprsIn ) );
+    iGlobalParams.Append( EInputParams( EPriorityCdma2k,        KPriorityCdma2k ) );
+    iGlobalParams.Append( EInputParams( EPriorityDialOut,       KPriorityDialOut ) );
+    iGlobalParams.Append( EInputParams( EPriorityDialIn,        KPriorityDialIn ) );
+    iGlobalParams.Append( EInputParams( EPriorityVpn,           KPriorityVpn ) );
+    iGlobalParams.Append( EInputParams( EPriorityMip,           KPriorityMip ) );
+    iGlobalParams.Append( EInputParams( EUIPriorityLan,         KUIPriorityLan ) );
+    iGlobalParams.Append( EInputParams( EUIPriorityWlan,        KUIPriorityWlan ) );
+    iGlobalParams.Append( EInputParams( EUIPriorityPan,         KUIPriorityPan ) );
+    iGlobalParams.Append( EInputParams( EUIPriorityGprsOut,     KUIPriorityGprsOut ) );
+    iGlobalParams.Append( EInputParams( EUIPriorityGprsIn,      KUIPriorityGprsIn ) );
+    iGlobalParams.Append( EInputParams( EUIPriorityCdma2k,      KUIPriorityCdma2k ) );
+    iGlobalParams.Append( EInputParams( EUIPriorityDialOut,     KUIPriorityDialOut ) );
+    iGlobalParams.Append( EInputParams( EUIPriorityDialIn,      KUIPriorityDialIn ) );
+    iGlobalParams.Append( EInputParams( EUIPriorityVpn,         KUIPriorityVpn ) );
+    iGlobalParams.Append( EInputParams( EUIPriorityMip,         KUIPriorityMip ) );
+    iGlobalParams.Append( EInputParams( EDefaultConnectionType, KDefaultConnectionType ) );
+    iGlobalParams.Append( EInputParams( EDefaultConnectionName, KDefaultConnectionName ) );
+    iGlobalParams.Append( EInputParams( EUsageOfWlan,           KUsageOfWlan ) );
+    iGlobalParams.Append( EInputParams( ESeamlessnessHome,      KSeamlessnessHome ) );
+    iGlobalParams.Append( EInputParams( ESeamlessnessVisitor,   KSeamlessnessVisitor ) );
+    iGlobalParams.Append( EInputParams( EGprsLastSocketActivityTimeout, KGprsLastSocketActivityTimeout ) );
+    iGlobalParams.Append( EInputParams( EGprsLastSessionClosedTimeout,  KGprsLastSessionClosedTimeout ) );
+    iGlobalParams.Append( EInputParams( EGprsLastSocketClosedTimeout,   KGprsLastSocketClosedTimeout ) );
+    iGlobalParams.Append( EInputParams( EWlanLastSocketActivityTimeout, KWlanLastSocketActivityTimeout ) );
+    iGlobalParams.Append( EInputParams( EWlanLastSessionClosedTimeout,  KWlanLastSessionClosedTimeout ) );
+    iGlobalParams.Append( EInputParams( EWlanLastSocketClosedTimeout,   KWlanLastSocketClosedTimeout ) );
+    iGlobalParams.Append( EInputParams( EWlanBGScanInterval,    KWlanBGScanInterval ) );
+    iGlobalParams.Append( EInputParams( EWlanUseDefSettings,    KWlanUseDefSettings ) );
+    iGlobalParams.Append( EInputParams( EWlanLongRetry,         KWlanLongRetry ) );
+    iGlobalParams.Append( EInputParams( EWlanShortRetry,        KWlanShortRetry ) );
+    iGlobalParams.Append( EInputParams( EWlanRTS,               KWlanRTS ) );
+    iGlobalParams.Append( EInputParams( EWlanTxPowerLevel,      KWlanTxPowerLevel ) );
+    iGlobalParams.Append( EInputParams( EWlanRadioMeasurements, KWlanRadioMeasurements ) );
+    iGlobalParams.Append( EInputParams( EWlanPowerMode,         KWlanPowerMode ) );
+    
+    };
+
+//Describes a Destination Network
+void CReaderXML::FillDNParams()    
+    {        
+    iDNParams.Append( EInputParams( EDN_Name,           KDN_Name ) );
+    iDNParams.Append( EInputParams( EDN_Id,             KDN_Id ) );
+    iDNParams.Append( EInputParams( EDN_Icon,           KDN_Icon ) );
+    iDNParams.Append( EInputParams( EDN_Metadata,       KDN_Metadata ) );
+    iDNParams.Append( EInputParams( EDN_Protection,     KDN_Protection ) );
+    iDNParams.Append( EInputParams( EDN_Hidden,         KHidden ) );
+    iDNParams.Append( EInputParams( EDN_HiddenAgent,    KHiddenAgent ) );
+    iDNParams.Append( EInputParams( EDN_Highlighted,    KHighlighted ) );
+    iDNParams.Append( EInputParams( EDN_EmbeddedDNName, KDN_EmbeddedDNName ) );
+    iDNParams.Append( EInputParams( EDN_IAPName,        KDN_IAPName ) );
+    // Needed because of Customization Tool limitations
+    iDNParams.Append( EInputParams( EDN_IAPName,        KDN_IAPName2 ) );
+    iDNParams.Append( EInputParams( EDN_IAPName,        KDN_IAPName3 ) );
+    iDNParams.Append( EInputParams( EDN_IAPName,        KDN_IAPName4 ) );
+    iDNParams.Append( EInputParams( EDN_IAPName,        KDN_IAPName5 ) );
+    iDNParams.Append( EInputParams( EDN_IAPName,        KDN_IAPName6 ) );
+    iDNParams.Append( EInputParams( EDN_IAPName,        KDN_IAPName7 ) );
+    iDNParams.Append( EInputParams( EDN_IAPName,        KDN_IAPName8 ) );
+    iDNParams.Append( EInputParams( EDN_IAPName,        KDN_IAPName9 ) );
+    iDNParams.Append( EInputParams( EDN_IAPName,        KDN_IAPName10 ) );   
+    };
+
+        
+// End of File.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatcreator/Src/cdctagcontainer.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,145 @@
+/*
+* Copyright (c) 2004 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:  Method definitions of the class CTagContainer.
+*
+*/
+
+
+
+#include "cdctagcontainer.h"
+#include "cdcerrors.h"
+
+//CONSTANTS
+const TInt KGranularity = 20;
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// Constructor of ETag
+// ---------------------------------------------------------
+CTagContainer::ETag::ETag( HBufC16* aTag, TInt aFieldId ):
+    iFieldId( aFieldId ),
+    iTag( aTag )
+    {
+    //no implementation needed    
+    }
+
+// ---------------------------------------------------------
+// Destructor of ETag
+// ---------------------------------------------------------
+CTagContainer::ETag::~ETag() 
+    {
+    delete iTag;    
+    }
+    
+// ---------------------------------------------------------
+// TTagContainer NewL
+// ---------------------------------------------------------
+//    
+CTagContainer* CTagContainer::NewL()
+    {
+    CTagContainer* self = new ( ELeave ) CTagContainer();
+    CleanupStack::PushL( self );
+
+    // From Base class
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;    
+    }
+    
+// ---------------------------------------------------------
+// TTagContainer ConstructL
+// ---------------------------------------------------------
+//        
+void CTagContainer::ConstructL()
+    {
+    iTags = new (ELeave) CArrayPtrSeg<ETag>( KGranularity );    
+    }
+    
+// ---------------------------------------------------------
+// TTagContainer Constructor
+// ---------------------------------------------------------
+//
+CTagContainer::CTagContainer()
+    {
+    }
+    
+// ---------------------------------------------------------
+// TTagContainer Destructor
+// ---------------------------------------------------------
+//
+CTagContainer::~CTagContainer()
+    {
+    Clear();
+    delete iTags;
+    }
+        
+// ---------------------------------------------------------
+// CTagContainer::Clear
+// ---------------------------------------------------------
+//
+void CTagContainer::Clear()
+    {
+    iTags->ResetAndDestroy();
+    }
+    
+// ---------------------------------------------------------
+// CTagContainer::Add
+// ---------------------------------------------------------
+//    
+void CTagContainer::AddL( HBufC16* aTag, TInt aFieldId )
+    {
+    ETag* tag = new (ELeave) ETag( aTag, aFieldId );
+    //lint -sem( iTags->AppendL, custodial(1) )
+    
+    CleanupStack::PushL( tag );
+    iTags->AppendL( tag );
+    CleanupStack::Pop( tag );
+    }
+    
+// ---------------------------------------------------------
+// CTagContainer::Tag
+// ---------------------------------------------------------
+//    
+HBufC16* CTagContainer::Tag( TUint aIdx )
+    {
+    __ASSERT_ALWAYS( aIdx < Count(), 
+                 User::Panic ( KPanicOutOfRange, KErrOutOfRange ) );
+                 
+    return iTags->At(aIdx)->iTag;
+    }
+
+// ---------------------------------------------------------
+// CTagContainer::FieldId
+// ---------------------------------------------------------
+//    
+TInt CTagContainer::FieldId( TUint aIdx )
+    {
+    __ASSERT_ALWAYS( aIdx < Count(), 
+                 User::Panic ( KPanicOutOfRange, KErrOutOfRange ) );
+
+    return iTags->At( aIdx )->iFieldId;
+    }
+    
+// ---------------------------------------------------------
+// CTagContainer::Count
+// ---------------------------------------------------------
+//    
+TInt CTagContainer::Count()
+    {
+    return iTags->Count();
+    }
+
+// End of File.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatcreator/Src/cdcwlandevicesettings.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,279 @@
+/*
+* Copyright (c) 2004 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 the class CWlanDeviceSettings
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "cdcwlandevicesettings.h"
+#include "cdclogger.h"
+
+#include <cdbcols.h>
+#include <WlanCdbCols.h>
+
+#include <metadatabase.h>
+#include <commsdattypeinfov1_1.h>
+#include <commsdattypesv1_1.h>
+#include <wlancontainer.h>
+
+
+// CONSTANTS
+// WLAN Device Settings table - default settings
+const TUint32 KDefaultBGScanInterval    = 0;   // No background scan
+const TBool   KDefaultUseDefSettings    = ETrue;        
+const TUint32 KDefaultLongRetry         = 4;
+const TUint32 KDefaultShortRetry        = 7;
+const TUint32 KDefaultRTS               = 2347;
+const TUint32 KDefaultTxPowerLevel      = 100;  //mW
+const TBool   KDefaultRadioMeasurements = ETrue;  
+const TBool   KDefaultWlanPowerMode     = ETrue;        
+
+// Increase version every time the content of the table changes
+const TUint32 KWlanDeviceSettingsTableVersion = 9;
+
+
+// ================= MEMBER FUNCTIONS ======================
+
+// ---------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------
+//
+CWlanDeviceSettings::CWlanDeviceSettings()
+    {
+    }
+    
+
+// ---------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------
+//
+void CWlanDeviceSettings::ConstructL()
+    {
+    DEBUG( "CWlanDeviceSettings::ConstructL()" )
+    
+    iSession = CMDBSession::NewL( CMDBSession::LatestVersion() );
+    
+    // Open the WLAN device settings table.
+    if( !iSession->IsInTransaction() )
+        {
+        iSession->OpenTransactionL();
+        }
+    OpenTableL();
+    iSession->CommitTransactionL();
+    DEBUG( "CWlanDeviceSettings::ConstructL() Tables opened ok." )
+    }
+
+
+// ---------------------------------------------------------
+// Static constructor.
+// ---------------------------------------------------------
+//
+CWlanDeviceSettings* CWlanDeviceSettings::NewL()
+    {
+    DEBUG( "CWlanDeviceSettings::NewL()" )
+
+    CWlanDeviceSettings* self = new (ELeave) CWlanDeviceSettings;
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+    
+
+// ---------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------
+//
+CWlanDeviceSettings::~CWlanDeviceSettings()
+    {
+    DEBUG( "CWlanDeviceSettings::~CWlanDeviceSettings()" )
+    
+    if ( iSession )
+        {
+        iSession->Close();
+        delete iSession; 
+        }
+    }
+
+
+// ---------------------------------------------------------
+// CWlanDeviceSettings::GetDefaultSettings
+// ---------------------------------------------------------
+//
+void CWlanDeviceSettings::GetDefaultSettings( SWlanDeviceSettings& aSettings )
+    {
+    DEBUG( "CWlanDeviceSettings::GetDefaultSettings()" )
+
+    aSettings.backgroundScanInterval = KDefaultBGScanInterval; 
+    aSettings.savedBgScanInterval    = KDefaultBGScanInterval; 
+    aSettings.useDefaultSettings     = KDefaultUseDefSettings;        
+    aSettings.longRetry              = KDefaultLongRetry;
+    aSettings.shortRetry             = KDefaultShortRetry;
+    aSettings.rts                    = KDefaultRTS;
+    aSettings.txPowerLevel           = KDefaultTxPowerLevel;
+    aSettings.radioMeasurements      = KDefaultRadioMeasurements;
+    aSettings.powerMode              = KDefaultWlanPowerMode;
+    }
+
+
+// ---------------------------------------------------------
+// CWlanDeviceSettings::OpenTableL
+// ---------------------------------------------------------
+//
+void CWlanDeviceSettings::OpenTableL()
+    {
+    DEBUG( "CWlanDeviceSettings::OpenTableL()" )
+    
+    // See if there is a record whose device settings type is
+    // 'WLAN default settings'
+    CMDBGenericRecord* deviceSettingsTable = static_cast< CMDBGenericRecord* >
+                        ( CCDRecordBase::RecordFactoryL( 0 ) );
+    CleanupStack::PushL( deviceSettingsTable );
+    deviceSettingsTable->InitializeL( TPtrC( WLAN_DEVICE_SETTINGS ), NULL );
+    deviceSettingsTable->LoadL( *iSession );
+    
+    CMDBElement* tableType = deviceSettingsTable->GetFieldByIdL
+                                            ( KCDTIdWlanDeviceSettingsType );
+    CMDBField< TUint32 >* tableTypeField =
+                            static_cast< CMDBField< TUint32 >* >( tableType );
+    tableTypeField->SetL( KWlanDefaultSettings );
+    
+    if( !deviceSettingsTable->FindL( *iSession ) )
+        {
+        // If not, store empty record
+        deviceSettingsTable->SetRecordId( KCDNewRecordRequest );
+        deviceSettingsTable->StoreL( *iSession );
+        // And fill it with data
+        FillRecordL( KWlanDefaultSettings, deviceSettingsTable );
+        deviceSettingsTable->ModifyL( *iSession );
+        }
+    CleanupStack::PopAndDestroy( deviceSettingsTable );
+    
+    // See if there is a record whose device settings type is
+    // 'WLAN user settings'
+    deviceSettingsTable = static_cast< CMDBGenericRecord* >
+                                ( CCDRecordBase::RecordFactoryL( 0 ) );
+    CleanupStack::PushL( deviceSettingsTable );
+    deviceSettingsTable->InitializeL( TPtrC( WLAN_DEVICE_SETTINGS ), NULL );
+    deviceSettingsTable->LoadL( *iSession );
+    
+    tableType = deviceSettingsTable->GetFieldByIdL( KCDTIdWlanDeviceSettingsType );
+    tableTypeField = static_cast< CMDBField< TUint32 >* >( tableType );
+    tableTypeField->SetL( KWlanUserSettings );
+    
+    if( !deviceSettingsTable->FindL( *iSession ) )
+        {
+        // If not, store empty record
+        deviceSettingsTable->SetRecordId( KCDNewRecordRequest );
+        deviceSettingsTable->StoreL( *iSession );
+        // And fill it with data
+        FillRecordL( KWlanUserSettings, deviceSettingsTable );
+        deviceSettingsTable->ModifyL( *iSession );
+        }
+    CleanupStack::PopAndDestroy( deviceSettingsTable );
+    }
+
+
+// ---------------------------------------------------------
+// CWlanDeviceSettings::FillRecordL
+// ---------------------------------------------------------
+//
+
+void CWlanDeviceSettings::FillRecordL( TUint32 aTableType, 
+                                      CMDBGenericRecord* aRecord )
+    {
+    DEBUG1( "CWlanDeviceSettings::NewRecordL() Type=%d", aTableType )
+    
+    SWlanDeviceSettings settings;
+    GetDefaultSettings( settings );
+    
+    // Device Settings Type
+    CMDBElement* tableType = aRecord->GetFieldByIdL
+                                            ( KCDTIdWlanDeviceSettingsType );
+    CMDBField< TUint32 >* tableTypeField =
+                            static_cast< CMDBField< TUint32 >* >( tableType );
+    tableTypeField->SetL( aTableType );
+    
+    // Table Version
+    CMDBElement* tableVersion = aRecord->GetFieldByIdL
+                                                    ( KCDTIdTableVersion );
+    CMDBField< TUint32 >* tableVersionField =
+                        static_cast< CMDBField< TUint32 >* >( tableVersion );
+    
+    tableVersionField->SetL( KWlanDeviceSettingsTableVersion );
+
+    // BG Scan Interval
+    CMDBElement* bgScanInterval = aRecord->GetFieldByIdL
+                                                    ( KCDTIdBgScanInterval );
+    CMDBField< TUint32 >* bgScanIntervalField =
+                        static_cast< CMDBField< TUint32 >* >( bgScanInterval );
+    bgScanIntervalField->SetL( settings.backgroundScanInterval );
+    
+    // Saved BG Scan Interval
+    CMDBElement* savedBgScanInterval = aRecord->GetFieldByIdL
+                                                    ( KCDTIdSavedBgScanInterval );
+    CMDBField< TUint32 >* savedBgScanIntervalField =
+                        static_cast< CMDBField< TUint32 >* >( savedBgScanInterval );
+    savedBgScanIntervalField->SetL( settings.savedBgScanInterval );
+    
+    // Use Default Settings
+    CMDBElement* useDefaultSettings = aRecord->GetFieldByIdL
+                                                ( KCDTIdUseDefaultSettings );
+    CMDBField< TBool >* useDefaultSettingsField =
+                    static_cast< CMDBField< TBool >* >( useDefaultSettings );
+    useDefaultSettingsField->SetL( settings.useDefaultSettings );
+    
+    // Long Retry
+    CMDBElement* longRetry = aRecord->GetFieldByIdL( KCDTIdWlanLongRetry );
+    CMDBField< TUint32 >* longRetryField =
+                        static_cast< CMDBField< TUint32 >* >( longRetry );
+    longRetryField->SetL( settings.longRetry );
+    
+    // Short Retry
+    CMDBElement* shortRetry = aRecord->GetFieldByIdL( KCDTIdWlanShortRetry );
+    CMDBField< TUint32 >* shortRetryField =
+                        static_cast< CMDBField< TUint32 >* >( shortRetry );
+    shortRetryField->SetL( settings.shortRetry );
+    
+    // RTS Threshold
+    CMDBElement* rts = aRecord->GetFieldByIdL( KCDTIdWlanRTSThreshold );
+    CMDBField< TUint32 >* rtsField =
+                        static_cast< CMDBField< TUint32 >* >( rts );
+    rtsField->SetL( settings.rts );
+    
+    // TX Power Level
+    CMDBElement* txPowerLevel = aRecord->GetFieldByIdL( KCDTIdTxPowerLevel );
+    CMDBField< TUint32 >* txPowerLevelField =
+                        static_cast< CMDBField< TUint32 >* >( txPowerLevel );
+    txPowerLevelField->SetL( settings.txPowerLevel );
+    
+    // Radio Measurements
+    CMDBElement* radioMeasurements = aRecord->GetFieldByIdL
+                                            ( KCDTIdAllowRadioMeasurements );
+    CMDBField< TBool >* radioMeasurementsField =
+                    static_cast< CMDBField< TBool >* >( radioMeasurements );
+    radioMeasurementsField->SetL( settings.radioMeasurements );
+    
+    // Power Mode
+    CMDBElement* powerMode = aRecord->GetFieldByIdL( KCDTIdWlanPowerMode );
+    CMDBField< TBool >* powerModeField =
+                    static_cast< CMDBField< TBool >* >( powerMode );
+    powerModeField->SetL( settings.powerMode );
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatcreator/Src/cdcwlantables.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,252 @@
+/*
+* Copyright (c) 2004 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 the class CWlanTables
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include "cdclogger.h"
+#include "cdcwlantables.h"
+
+#include <wlancontainer.h>
+
+// CONSTANTS
+/// Modem bearer names for WLAN connection methods
+_LIT( KWlanBearerName, "WLANBearer" );
+_LIT( KWlanBearerAgent, "wlanagt.agt" );
+_LIT( KWlanBearerNif, "wlannif" );
+
+_LIT( KWlanLDDName, "not used" );
+_LIT( KWlanPDDName, "not used" );
+const TInt KWlanLastSocketActivityTimeout = -1;
+const TInt KWlanLastSessionClosedTimeout = 1;
+const TInt KWlanLastSocketClosedTimeout = -1;
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CWlanTables::NewL
+// ---------------------------------------------------------
+//
+CWlanTables* CWlanTables::NewL()
+    {
+
+    CWlanTables* self = new ( ELeave ) CWlanTables;
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+
+// ---------------------------------------------------------
+// CWlanTables::CWlanTables
+// ---------------------------------------------------------
+//
+CWlanTables::CWlanTables()
+    {
+    //no implementation needed
+    }
+
+
+// ---------------------------------------------------------
+// CWlanTables::ConstructL
+// ---------------------------------------------------------
+//
+void CWlanTables::ConstructL()
+    {
+    iSession = CMDBSession::NewL( CMDBSession::LatestVersion() );
+    }
+
+
+// ---------------------------------------------------------
+// CWlanTables::~CWlanTables
+// ---------------------------------------------------------
+//
+CWlanTables::~CWlanTables()
+    {
+    if ( iSession )
+        {
+        iSession->Close();
+        delete iSession; 
+        }
+    }
+    
+    
+// ---------------------------------------------------------
+// CreateWlanServiceTableL
+// ---------------------------------------------------------
+//
+void CWlanTables::CheckAndCreateTablesL()
+    {
+    // Check WLAN Device Settings Table (creates if does not exist).
+    CreateWlanDeviceSettingsTableL();
+    
+    // Check WLAN Service Table (creates if does not exist).
+    CreateWlanServiceTableL();
+
+    // Check WLAN Secondary SSID Table (creates if does not exist).
+    CreateWlanSecSSIDTableL();
+    
+    // Check WLAN bearer record (creates if does not exist).
+    CreateWlanBearerRecordL();    
+    }
+    
+// ---------------------------------------------------------
+// CreateWlanServiceTableL
+// ---------------------------------------------------------
+//
+void CWlanTables::CreateWlanServiceTableL()
+    {
+    //checks whether table exists
+    TInt error( KErrNone );
+    
+    TRAP( error, CCDWlanServiceRecord::TableIdL( *iSession ) );
+    if( error == KErrNotFound )
+        {    
+        //table not found -- add new table
+        CCDWlanServiceRecord::CreateTableL( *iSession );
+        
+        //check result
+        TRAP( error, CCDWlanServiceRecord::TableIdL( *iSession ) );
+        
+        if ( error == KErrNone )
+            {
+            CLOG_WRITE( "Added WLAN service table" )
+            }
+        }
+    else if ( error == KErrNone)
+        {
+            CLOG_WRITE( "WLAN service table already exists" )
+        }
+    else
+        {
+        //do nothing             
+        }
+    }
+    
+
+// ---------------------------------------------------------
+// CreateWlanDeviceTableL
+// ---------------------------------------------------------
+//
+void CWlanTables::CreateWlanDeviceSettingsTableL()
+    {
+    //checks whether table exists
+    TInt error( KErrNone );
+    
+    TRAP( error, CCDWlanDeviceSettingsRecord::TableIdL( *iSession ) );
+    if( error == KErrNotFound )
+        {    
+        //table not found -- add new table
+        CCDWlanDeviceSettingsRecord::CreateTableL( *iSession );
+        
+        //check result
+        TRAP( error, CCDWlanDeviceSettingsRecord::TableIdL( *iSession ) );
+        if ( error == KErrNone )
+            {
+            CLOG_WRITE( "Added Device Settings table" )
+            }
+        }
+    else if ( error == KErrNone)
+        {
+        CLOG_WRITE( "Device Settings table already exists" )
+        }
+    else
+        {
+        //do nothing             
+        }
+    }
+    
+    
+// ---------------------------------------------------------
+// CreateWlanSecSSIDTableL
+// ---------------------------------------------------------
+//
+void CWlanTables::CreateWlanSecSSIDTableL()
+    {
+    //checks whether table exists
+    TInt error( KErrNone );
+    
+    TRAP( error, CCDWLANSecSSIDTable::TableIdL( *iSession ) );
+    if( error == KErrNotFound )
+        {    
+        //table not found -- add new table
+        CCDWLANSecSSIDTable::CreateTableL( *iSession );
+        
+        //check result
+        TRAP( error, CCDWLANSecSSIDTable::TableIdL( *iSession ) );
+        
+        if ( error == KErrNone )
+            {
+            CLOG_WRITE( "Added Secondary SSID table" )
+            }
+        }
+    else if ( error == KErrNone)
+        {
+        CLOG_WRITE( "Secondary SSID table already exists" )
+        }
+    else
+        {
+        //do nothing             
+        }
+    }
+
+// ---------------------------------------------------------
+// CreateWlanBearerRecordL
+// ---------------------------------------------------------
+//
+void CWlanTables::CreateWlanBearerRecordL()
+    {
+	CCDLANBearerRecord* record = static_cast<CCDLANBearerRecord*>
+                ( CCDRecordBase::RecordFactoryL( KCDTIdLANBearerRecord ) );
+    CleanupStack::PushL( record );    
+    
+   	record->iRecordName.SetL( TPtrC( KWlanBearerName ) );
+   	
+    if ( !record->FindL( *iSession ) )
+        { // bearer not found -> create dummy values. Copied from CmManager initialization.               
+        record->SetRecordId( KCDNewRecordRequest );
+        
+        record->iBearerAgent.SetL( KWlanBearerAgent );
+        record->iRecordName.SetL( KWlanBearerName );
+        record->iLanBearerNifName.SetL( KWlanBearerNif );
+        record->iLanBearerLddName.SetL( KWlanLDDName );
+        record->iLanBearerPddName.SetL( KWlanPDDName );
+        record->iLastSocketActivityTimeout.SetL(
+                                ( TUint32 )KWlanLastSocketActivityTimeout );
+        record->iLastSessionClosedTimeout.SetL(
+                                (TUint32 )KWlanLastSessionClosedTimeout );
+        record->iLastSocketClosedTimeout.SetL(
+                                ( TUint32 )KWlanLastSocketClosedTimeout );
+        record->StoreL( *iSession );
+        CLOG_WRITE( "Added WLAN bearer record" );
+        }
+    else
+		{
+		CLOG_WRITE( "WLAN bearer record already exists" );
+		}
+
+    CleanupStack::PopAndDestroy( record );
+    }
+
+
+
+//  End of File.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatcreator/bwins/commsdatcreatoru.def	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,8 @@
+EXPORTS
+	??1CCdcCommsDatCreator@@UAE@XZ @ 1 NONAME ; CCdcCommsDatCreator::~CCdcCommsDatCreator(void)
+	?CreateCommsDatL@CCdcCommsDatCreator@@QAEXABV?$TBuf@$0BAA@@@@Z @ 2 NONAME ; void CCdcCommsDatCreator::CreateCommsDatL(class TBuf<256> const &)
+	?CreateTablesL@CCdcCommsDatCreator@@QAEXXZ @ 3 NONAME ; void CCdcCommsDatCreator::CreateTablesL(void)
+	?DumpCommsDatL@CCdcCommsDatCreator@@QAEXABV?$TBuf@$0BAA@@@@Z @ 4 NONAME ; void CCdcCommsDatCreator::DumpCommsDatL(class TBuf<256> const &)
+	?NewL@CCdcCommsDatCreator@@SAPAV1@XZ @ 5 NONAME ; class CCdcCommsDatCreator * CCdcCommsDatCreator::NewL(void)
+	?NewLC@CCdcCommsDatCreator@@SAPAV1@XZ @ 6 NONAME ; class CCdcCommsDatCreator * CCdcCommsDatCreator::NewLC(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatcreator/eabi/commsdatcreatoru.def	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,37 @@
+EXPORTS
+	_ZN19CCdcCommsDatCreator13CreateTablesLEv @ 1 NONAME
+	_ZN19CCdcCommsDatCreator13DumpCommsDatLERK4TBufILi256EE @ 2 NONAME
+	_ZN19CCdcCommsDatCreator15CreateCommsDatLERK4TBufILi256EE @ 3 NONAME
+	_ZN19CCdcCommsDatCreator4NewLEv @ 4 NONAME
+	_ZN19CCdcCommsDatCreator5NewLCEv @ 5 NONAME
+	_ZTI10CReaderXML @ 6 NONAME ; #<TI>#
+	_ZTI11CDumpTables @ 7 NONAME ; #<TI>#
+	_ZTI11CReaderBase @ 8 NONAME ; #<TI>#
+	_ZTI11CWlanTables @ 9 NONAME ; #<TI>#
+	_ZTI12CProcessorDN @ 10 NONAME ; #<TI>#
+	_ZTI13CProcessorLan @ 11 NONAME ; #<TI>#
+	_ZTI13CProcessorVpn @ 12 NONAME ; #<TI>#
+	_ZTI13CTagContainer @ 13 NONAME ; #<TI>#
+	_ZTI14CProcessorBase @ 14 NONAME ; #<TI>#
+	_ZTI14CProcessorWlan @ 15 NONAME ; #<TI>#
+	_ZTI15CEapTypeElement @ 16 NONAME ; #<TI>#
+	_ZTI16CProcessorGlobal @ 17 NONAME ; #<TI>#
+	_ZTI19CCdcCommsDatCreator @ 18 NONAME ; #<TI>#
+	_ZTI19CDataMobilityTables @ 19 NONAME ; #<TI>#
+	_ZTI20CProcessorPacketData @ 20 NONAME ; #<TI>#
+	_ZTV10CReaderXML @ 21 NONAME ; #<VT>#
+	_ZTV11CDumpTables @ 22 NONAME ; #<VT>#
+	_ZTV11CReaderBase @ 23 NONAME ; #<VT>#
+	_ZTV11CWlanTables @ 24 NONAME ; #<VT>#
+	_ZTV12CProcessorDN @ 25 NONAME ; #<VT>#
+	_ZTV13CProcessorLan @ 26 NONAME ; #<VT>#
+	_ZTV13CProcessorVpn @ 27 NONAME ; #<VT>#
+	_ZTV13CTagContainer @ 28 NONAME ; #<VT>#
+	_ZTV14CProcessorBase @ 29 NONAME ; #<VT>#
+	_ZTV14CProcessorWlan @ 30 NONAME ; #<VT>#
+	_ZTV15CEapTypeElement @ 31 NONAME ; #<VT>#
+	_ZTV16CProcessorGlobal @ 32 NONAME ; #<VT>#
+	_ZTV19CCdcCommsDatCreator @ 33 NONAME ; #<VT>#
+	_ZTV19CDataMobilityTables @ 34 NONAME ; #<VT>#
+	_ZTV20CProcessorPacketData @ 35 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatcreator/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2008 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 DbCreator
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+
+PRJ_EXPORTS
+ 
+
+
+PRJ_MMPFILES
+./cdccommsdatcreator.mmp
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatcreator/group/cdccommsdatcreator.mmp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,75 @@
+/*
+* Copyright (c) 2008 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 description file for commsdatcreator
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+
+TARGET      commsdatcreator.dll
+TARGETTYPE  dll
+UID         0x1000008d 0x10207372
+
+
+CAPABILITY CAP_GENERAL_DLL
+
+VENDORID VID_DEFAULT
+  
+LANG SC
+    
+SOURCEPATH     ../Src
+
+SOURCE        cdcreaderbase.cpp
+SOURCE        cdcreaderxml.cpp
+SOURCE        cdcprocessorbase.cpp
+SOURCE 	      cdcprocessorpacketdata.cpp
+SOURCE	      cdcprocessorwlan.cpp
+SOURCE        cdcprocessorlan.cpp
+SOURCE        cdcprocessorvpn.cpp
+SOURCE        cdcprocessordn.cpp
+SOURCE	      cdcprocessorglobal.cpp		
+SOURCE        cdccommsdatcreator.cpp
+SOURCE        cdcwlantables.cpp
+SOURCE        cdcwlandevicesettings.cpp
+SOURCE        cdcdatamobilitytables.cpp
+SOURCE 	      cdctagcontainer.cpp
+SOURCE        cdcdumptables.cpp
+
+
+// Component specific internal headers 
+USERINCLUDE			../Inc
+
+USERINCLUDE			../../inc
+
+// ADO-SUBSYSTEM specific internal headers 
+SYSTEMINCLUDE		../../../inc
+
+//Macro to /epoc32 headers
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY		ecom.lib
+LIBRARY        euser.lib
+LIBRARY        estor.lib
+LIBRARY        efsrv.lib
+LIBRARY        bafl.lib
+LIBRARY        charconv.lib
+LIBRARY        edbms.lib
+LIBRARY        commsdat.lib
+LIBRARY        FeatMgr.lib
+LIBRARY        cmmanager.lib
+LIBRARY        cmmanagerdatabase.lib
+LIBRARY        flogger.lib 
+LIBRARY        centralrepository.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatcreatorrfsplugin/data/10281BC5.rss	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,48 @@
+/*
+* 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:  PacketData PlugIn's resource file
+*
+*/
+
+
+
+#include "ecom/registryinfo.rh"
+
+// Because attribute enums had to be added to namespace CMManager
+// it's not possible to included cmpluginlanbasedef.h
+// Thus bearer type id had to be redefine here.
+#define KUidCommsDatCreatorRFSPlugin  0x10281BC6
+
+RESOURCE REGISTRY_INFO theInfo
+	{
+	dll_uid = 0x10281BC5;
+	interfaces = 
+		{
+		INTERFACE_INFO
+			{
+			interface_uid = 0x102073BB;  // = CRFSPluginInterfaceUid
+			implementations =
+				{
+				IMPLEMENTATION_INFO
+					{
+					implementation_uid = KUidCommsDatCreatorRFSPlugin;
+					version_no = 1;
+					display_name = "CdCRFSPlugin";
+					default_data = "NI"; // Normal, Deep, Init
+					opaque_data = "";
+					}
+				};
+			}
+		};
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatcreatorrfsplugin/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,29 @@
+/*
+* 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:  Build information for the LAN plugin.   
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+ARMV5
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+./cdccommsdatcreatorrfsplugin.mmp
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatcreatorrfsplugin/group/cdccommsdatcreatorrfsplugin.mmp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,52 @@
+/*
+* 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:  RFS Plugin.   
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET      commsdatcreatorrfsplugin.dll
+UID         0x10009D8D 0x10281BC5
+
+TARGETTYPE		PLUGIN
+
+CAPABILITY      CAP_ECOM_PLUGIN
+VENDORID        VID_DEFAULT
+
+SOURCEPATH  ../src
+
+SOURCE      cdccommsdatcreatorrfsplugin.cpp
+SOURCE      cdccommsdatcreatorrfspluginproxy.cpp
+SOURCE      cdcprocesslauncher.cpp
+
+SOURCEPATH  ../data
+
+START RESOURCE 10281BC5.rss
+TARGET commsdatcreatorrfsplugin.rsc
+END
+
+// Component specific internal headers 
+USERINCLUDE			../inc
+USERINCLUDE			../../inc
+
+//Macro to /epoc32 headers
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         efsrv.lib
+LIBRARY	        ECOM.LIB
+LIBRARY	        centralrepository.lib
+DEBUGLIBRARY    flogger.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatcreatorrfsplugin/inc/cdccommsdatcreatorrfsplugin.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,101 @@
+/*
+* Copyright (c) 2006,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:   Declaration of CCdcCommsDatCreatorRfsPlugin class.
+*
+*/
+
+
+
+#ifndef C_CCDCCOMMSDATCREATORRFSPLUGIN_H
+#define C_CCDCCOMMSDATCREATORRFSPLUGIN_H
+
+//  INCLUDES
+#include <rfsPlugin.h>
+
+// CONSTANTS
+const TInt KUidCommsDatCreatorRfsPlugin = 0x10281BC6; 
+
+// FORWARD DECLARATIONS
+class CRepository;
+
+
+// CLASS DECLARATION
+
+/**
+*	Concrete class for CRFSPlugin
+*	It supplies instantiation & destruction by using
+*	the ECom framework, and functional services
+*	by using the methods of the actual class.
+*/
+class CCdcCommsDatCreatorRfsPlugin : public CRFSPlugin
+    {
+public:
+
+    /**
+    * Two-phased constructor.
+    * aImplementationUid - Implementation Uid
+    */
+    static CCdcCommsDatCreatorRfsPlugin * NewL( const TUid& aImplementationUid );
+
+    /** 
+	* From CRFSPlugin
+	* aType Type
+    * @return
+	*/
+    virtual void RestoreFactorySettingsL( const TRfsReason aType );
+
+    /** 
+	* From CRFSPlugin
+	* aType - Type
+	* aPath - Path
+    * @return
+	*/
+    virtual void GetScriptL( const TRfsReason aType, TDes& aPath );
+
+    /** 
+	* From CRFSPlugin
+	* aType - Type
+	* aCommand - Command
+    * @return
+	*/
+	virtual void ExecuteCustomCommandL( const TRfsReason aType, 
+                                        TDesC& aCommand );
+                                        
+    /**
+    * C++ destructor
+    */
+    virtual ~CCdcCommsDatCreatorRfsPlugin();
+
+                                        
+protected:
+
+    /**
+    * C++ default Constructor
+    */
+    CCdcCommsDatCreatorRfsPlugin ();
+ 
+private:
+
+	
+    /**
+    * Starts the rfs exe.
+    */
+    void StartProcessL();
+
+private:
+
+    };
+
+
+#endif // C_CCDCCOMMSDATCREATORRFSPLUGIN_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatcreatorrfsplugin/inc/cdclogfilename.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2004 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:   contains logger macros
+*
+*/
+
+
+
+
+#ifndef CDC_LOGFILE_NAME_H
+#define CDC_LOGFILE_NAME_H
+
+
+/// Directory where the log file can be found.
+_LIT16( KLogDir, "cdc" );
+
+/// Log file name.
+_LIT16( KLogFile, "cdcrfsplugin.txt" );
+
+
+#endif // CDC_LOGFILE_NAME_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatcreatorrfsplugin/inc/cdcprocesslauncher.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,93 @@
+/*
+* Copyright (c) 2008 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 CCdcProcessLauncher class.
+*
+*/
+
+
+
+#ifndef C_CCDCPROCESSLAUNCHER_H
+#define C_CCDCPROCESSLAUNCHER_H
+
+#include <e32base.h>
+
+/**
+*  Launches a single executable and waits for its rendezvous for a given time.
+*
+*  Launches a single executable
+*
+*  @lib None
+*  @since S60 3.2
+*/
+class CCdcProcessLauncher : public CActive
+    {
+
+public:
+
+    /**
+    * Two-phased constructor.
+    */
+    static CCdcProcessLauncher* NewL();
+
+    /**
+    * Destructor.
+    */
+    virtual ~CCdcProcessLauncher();
+
+    /**
+    * Launch the executable and wait for its rendezvous if needed.
+    *
+    */
+    void Launch();
+
+private:
+
+    /**
+    * C++ default constructor.
+    */
+    CCdcProcessLauncher();
+
+    /**
+    * By default Symbian 2nd phase constructor is private.
+    */
+    void ConstructL();
+
+    /**
+    * From CActive.
+    * Implements cancellation of an outstanding request.
+    */
+    void DoCancel();
+
+    /**
+    * From CActive.
+    * Handles an active object’s request completion event.
+    */
+    void RunL();
+
+    /**
+    * Launch the executable and wait for its rendezvous if needed.
+    */
+    void LaunchProcess();
+
+private: // data
+
+    // THandle to the executable being launched.
+    RProcess iProcess;
+
+    // CActiveSchedulerWait to force caller waiting it    
+    CActiveSchedulerWait iWait;    
+
+    };
+
+#endif // C_CCDCPROCESSLAUNCHER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatcreatorrfsplugin/src/cdccommsdatcreatorrfsplugin.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,123 @@
+/*
+* Copyright (c) 2006,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:   Implementation of cdccommsdatcreatorrfsplugin class.
+*
+*/
+
+
+
+#include <centralrepository.h>
+#include "cdccommsdatcreatorcrkeys.h"
+
+#include "cdccommsdatcreatorrfsplugin.h"
+#include "cdclogger.h"
+#include "cdcprocesslauncher.h"
+
+// CONSTANTS
+
+// ----------------------------------------------------------------------------
+// CCdcCommsDatCreatorRfsPlugin::NewL
+// ----------------------------------------------------------------------------
+//
+CCdcCommsDatCreatorRfsPlugin* CCdcCommsDatCreatorRfsPlugin::NewL( 
+                                        const TUid& /*aImplementationUid*/ )
+	{
+    CLOG_WRITE( "CCdcCommsDatCreatorRfsPlugin::NewL()" );
+	
+	CCdcCommsDatCreatorRfsPlugin * self = new( ELeave ) 
+               CCdcCommsDatCreatorRfsPlugin ();
+
+    CLOG_WRITE( "CCdcCommsDatCreatorRfsPlugin::NewL()" );
+    return self;
+	}
+
+// ----------------------------------------------------------------------------
+// CCdcCommsDatCreatorRfsPlugin::RestoreFactorySettingsL
+// ----------------------------------------------------------------------------
+//
+void CCdcCommsDatCreatorRfsPlugin::RestoreFactorySettingsL( 
+                                                     const TRfsReason aType )
+	{
+    CLOG_WRITE_FORMAT( 
+    "CCdcCommsDatCreatorRfsPlugin::RestoreFactorySettingsL() Rfs type: %d", aType );
+        	
+    if( aType == ENormalRfs )
+    {
+    	// Do nothing in Normal RFS case so that user IAPs are preserved (TSW: EJYG-7FZCKJ)
+    	return;
+    }
+	// Launch the separate process to 1. reset 2. check/create the tables in CommsDat 
+	// and 3. Generate the CommsDat based on the input file
+   	StartProcessL();                        
+
+    CLOG_WRITE( "CCdcCommsDatCreatorRfsPlugin::RestoreFactorySettingsL() end" );
+	}
+
+// ----------------------------------------------------------------------------
+// CCdcCommsDatCreatorRfsPlugin::GetScriptL
+// ----------------------------------------------------------------------------
+//
+void CCdcCommsDatCreatorRfsPlugin::GetScriptL( 
+                                 const TRfsReason /*aType*/, TDes& /*aPath*/ )
+	{
+	}
+
+// ----------------------------------------------------------------------------
+// CCdcCommsDatCreatorRfsPlugin::ExecuteCustomCommandL
+// ----------------------------------------------------------------------------
+//
+void CCdcCommsDatCreatorRfsPlugin::ExecuteCustomCommandL( 
+                              const TRfsReason /*aType*/, TDesC& /*aCommand*/ )
+	{
+	}
+
+// ----------------------------------------------------------------------------
+// CCdcCommsDatCreatorRfsPlugin::CCdcCommsDatCreatorRfsPlugin
+// ----------------------------------------------------------------------------
+//
+CCdcCommsDatCreatorRfsPlugin::CCdcCommsDatCreatorRfsPlugin () :
+    CRFSPlugin()
+	{
+	}
+
+
+// ----------------------------------------------------------------------------
+// CCdcCommsDatCreatorRfsPlugin::StartProcessL()
+// ----------------------------------------------------------------------------
+//   
+void CCdcCommsDatCreatorRfsPlugin::StartProcessL()
+    {
+    CLOG_WRITE( "CCdcCommsDatCreatorRfsPlugin::StartProcessL" );
+
+    CCdcProcessLauncher* pl = CCdcProcessLauncher::NewL();
+
+    CLOG_WRITE( "CCdcCommsDatCreatorRfsPlugin::Launch" );
+
+    pl->Launch();
+
+    CLOG_WRITE( "CCdcCommsDatCreatorRfsPlugin::Launch" );
+    
+    delete ( pl );
+
+    CLOG_WRITE( "CCdcCommsDatCreatorRfsPlugin::StartProcessL end" );
+    }
+
+// ----------------------------------------------------------------------------
+// CCdcCommsDatCreatorRfsPlugin::CCdcCommsDatCreatorRfsPlugin()
+// ----------------------------------------------------------------------------
+//   	
+CCdcCommsDatCreatorRfsPlugin::~CCdcCommsDatCreatorRfsPlugin()
+    {
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatcreatorrfsplugin/src/cdccommsdatcreatorrfspluginproxy.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,39 @@
+/*
+* 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 cdccommsdatcreatorstartuppluginproxy 
+* proxy table
+*
+*/
+
+
+
+#include "cdccommsdatcreatorrfsplugin.h"
+#include <e32std.h>
+#include <ecom/implementationproxy.h>
+
+
+// Exported proxy for instantiation method resolution
+// Define the interface UIDs
+const TImplementationProxy ImplementationTable[] = 
+	{
+	IMPLEMENTATION_PROXY_ENTRY( KUidCommsDatCreatorRfsPlugin, 
+	                            CCdcCommsDatCreatorRfsPlugin::NewL)
+	};
+
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+	{
+	aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+
+	return ImplementationTable;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatcreatorrfsplugin/src/cdcprocesslauncher.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,181 @@
+/*
+* Copyright (c) 2005-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:   Implementation of CCdcProcessLauncher class.
+*
+*/
+
+
+
+#include "cdcprocesslauncher.h"
+#include "cdclogger.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CCdcProcessLauncher::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCdcProcessLauncher* CCdcProcessLauncher::NewL()
+    {
+    CCdcProcessLauncher* self = new( ELeave ) CCdcProcessLauncher();
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+
+// Destructor
+CCdcProcessLauncher::~CCdcProcessLauncher()
+    {
+    iProcess.Close();
+    Cancel();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCdcProcessLauncher::Launch()
+//
+// -----------------------------------------------------------------------------
+//
+void CCdcProcessLauncher::Launch()
+    {
+    CLOG_WRITE( "CCdcProcessLauncher::Launch" );
+
+    // Exe name and empty parameters
+	_LIT( KProcess, "commsdatstartup.exe" );
+    _LIT( KEmpty, "" );
+    	
+    TInt errorCode = iProcess.Create(KProcess, KEmpty); 
+
+    CLOG_WRITE_FORMAT( "CCdcCommsDatCreatorRfsPlugin::process.Create result: %d", errorCode );
+	
+    if ( errorCode == KErrNone )
+        {
+        LaunchProcess();
+        }
+    else
+        {
+        CLOG_WRITE( "Failed to creating process" );
+        }
+
+    CLOG_WRITE( "CCdcProcessLauncher::Launch" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCdcProcessLauncher::CCdcProcessLauncher
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CCdcProcessLauncher::CCdcProcessLauncher()
+  : CActive( EPriorityStandard )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCdcProcessLauncher::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CCdcProcessLauncher::ConstructL()
+    {
+    iProcess.SetHandle( NULL );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCdcProcessLauncher::DoCancel
+//
+// -----------------------------------------------------------------------------
+//
+void CCdcProcessLauncher::DoCancel()
+    {
+    CLOG_WRITE( "CCdcProcessLauncher::DoCancel" );
+
+    if ( iProcess.Handle() )
+        {
+        iProcess.RendezvousCancel( iStatus );
+        iProcess.Close();
+        }
+
+    iWait.AsyncStop();
+
+    CLOG_WRITE( "CCdcProcessLauncher::DoCancel" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCdcProcessLauncher::RunL
+//
+// -----------------------------------------------------------------------------
+//
+void CCdcProcessLauncher::RunL()
+    {
+    CLOG_WRITE( "CCdcProcessLauncher::RunL" );
+    ASSERT( iProcess.Handle() );
+
+    if ( iProcess.ExitType() == EExitPanic )
+        {
+        iProcess.ExitReason();
+        }
+    else
+        {
+        iStatus.Int();
+        }
+    
+    iWait.AsyncStop();
+
+    CLOG_WRITE( "CCdcProcessLauncher::RunL" );
+    }
+
+// -----------------------------------------------------------------------------
+// CCdcProcessLauncher::Launch()
+//
+// -----------------------------------------------------------------------------
+//
+void CCdcProcessLauncher::LaunchProcess()
+    {
+    CLOG_WRITE( "CCdcProcessLauncher::Launch" );
+
+    ASSERT( !IsActive() );
+    ASSERT( iProcess.Handle() );
+
+    iProcess.Rendezvous( iStatus );
+
+    if( iStatus == KRequestPending )
+        {
+        CLOG_WRITE( "CCdcProcessLauncher::Resume" );
+        iProcess.Resume();
+        CLOG_WRITE( "CCdcProcessLauncher::SetActive" );
+        SetActive();
+        CLOG_WRITE( "CCdcProcessLauncher::Start waiter" );
+        iWait.Start();
+        }
+    else
+        {
+        CLOG_WRITE( "Failed to make rendezvous with process, killing it" );
+        iProcess.Kill( KErrGeneral );
+        }
+
+    CLOG_WRITE( "CCdcProcessLauncher::Launch end" );
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatstartup/Inc/cdccommsdatstartup.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,105 @@
+/*
+* Copyright (c) 2006,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:   Declaration of CCommsDatStartup class.
+*
+*/
+
+
+
+
+#ifndef CDC_COMMSDAT_STARTUP_H
+#define CDC_COMMSDAT_STARTUP_H
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <bacline.h>
+#include <f32file.h>
+
+class CRepository;
+
+
+// CONSTANTS
+
+
+// DATA TYPES
+
+
+// FORWARD DECLARATIONS
+
+
+// CLASS DECLARATION
+
+
+/**
+* CCdcCommsDatStartup checks the conditions if commsdat creation is enabled.
+* If yes starts commsdat creation and indicates the result after launch.
+*/
+class CCdcCommsDatStartup : public CBase
+    {
+
+    public:
+    
+    /**
+    * CCdcCommsDatStartup checks the conditions if commsdat creation is enabled.
+    * If yes starts commsdat creation and indicates the result after launch.
+    */
+    void DoStartL();
+        
+    ~CCdcCommsDatStartup();
+     
+          
+    private:
+    
+    /*
+    * Checks the creator UID. It leaves if it is not CdcCommsDatRfsPlugin.
+    * It is done by security reasons.
+    */
+    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
+    */
+    void ResetCommsDatToDefaultL();
+    
+    /**
+    * Deletes the EAP DBMS database files from c:\ thus reseting the settings    
+    */
+    void ResetEAPSettingsL();
+    
+    /*
+    * Sets the startup status
+    * @param startup status to be set.
+    */
+    void SetStartupStatusL( TInt aStatus );
+    
+    // Repository
+    CRepository *iRepository;
+
+    };
+
+
+#endif // CDC_COMMSDAT_STARTUP_H
+            
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatstartup/Inc/cdclogfilename.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2008 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:   contains logger macros
+*
+*/
+
+
+
+
+#ifndef CDC_LOGFILE_NAME_H
+#define CDC_LOGFILE_NAME_H
+
+
+/// Directory where the log file can be found.
+_LIT16( KLogDir, "cdc" );
+
+/// Log file name.
+_LIT16( KLogFile, "cdcstartup.txt" );
+
+
+#endif // CDC_LOGFILE_NAME_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatstartup/Src/cdccommsdatstartup.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,290 @@
+/*
+* Copyright (c) 2006,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:   Implementation of CCommsDatStartup class.
+*
+*/
+
+
+
+
+// INCLUDE FILES
+
+#include <e32def.h>
+#include <e32base.h>
+#include <s32strm.h>
+#include <s32file.h>
+#include <etelpckt.h>
+
+#include <centralrepository.h>
+#include "cdccommsdatcreatorcrkeys.h"
+
+#include "cdccommsdatstartup.h"
+#include "cdccommsdatcreator.h"
+#include "cdcerrors.h"
+#include "cdclogger.h"
+
+
+// CONSTANTS
+const TUid KCRUidCommsDb = { 0xcccccc00 };
+
+//------------------------------------------------
+// CCdcCommsDatStartup::DoStartL
+//------------------------------------------------
+//
+void CCdcCommsDatStartup::DoStartL()
+    {
+    CLOG_WRITE( "-----------------------------" );
+    CLOG_WRITE( "CCdcCommsDatStartup::DoStartL" );
+    CLOG_WRITE( "-----------------------------" );
+    
+    CheckCreatorUIdL();
+
+    CreateRepositoryL();
+    
+    // Set status to not initialised
+    SetStartupStatusL( ECommsDatInitialisationFailed );
+
+	CLOG_WRITE( "CCdcCommsDatStartup::ResetCommsDatToDefaultL()" );
+	// In all RFS cases CommsDat must be reset 
+	ResetCommsDatToDefaultL();
+	
+	// Reset EAP settings databases
+	ResetEAPSettingsL();
+
+	CLOG_WRITE( "CCdcCommsDatStartup::CCdcCommsDatCreator::NewLC()" );
+	    
+	CCdcCommsDatCreator* cdc = CCdcCommsDatCreator::NewLC();
+	
+	CLOG_WRITE( "CCdcCommsDatStartup::CreateTablesL" );
+	
+	// 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 )
+        {
+        CLOG_WRITE( "CCdcCommsDatStartup::CommsDat generation enabled" );
+        
+        TFileName path( _L("Z:\\private\\10281BC3\\" )  );
+        path.Append( fileName );
+
+		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" );               
+        }
+       else
+       	{
+       	CLOG_WRITE( "CCdcCommsDatStartup::CommsDat generation disabled" );
+       	}
+        
+    // If nothing has leaved then everything is okay (both in disabled and
+    // enabled cases.
+    SetStartupStatusL( ECommsDatInitialised );
+        
+    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()
+// ----------------------------------------------------------------------------
+//   	
+void CCdcCommsDatStartup::CheckCreatorUIdL()
+    {
+    // UID of MainRfs
+    const TUid KCreatorUid = { 0x102073EA };   
+    
+    CLOG_WRITE( "CCdcCommsDatStartup::CheckCreatorUIdL" );
+    
+    TUid creatorId = User::CreatorIdentity();
+
+    CLOG_WRITE_FORMAT( "CreatorId : %x", creatorId );
+   
+    if( KCreatorUid != creatorId )
+        {
+        User::Leave( KErrPermissionDenied );
+        }
+
+    CLOG_WRITE( "CCdcCommsDatStartup::CheckCreatorUIdL" );
+    }
+    
+// ----------------------------------------------------------------------------
+// CCdcCommsDatStartup::~CCdcCommsDatStartup()
+// ----------------------------------------------------------------------------
+//   	
+CCdcCommsDatStartup::~CCdcCommsDatStartup()
+    {
+    if( iRepository )
+        {
+        delete iRepository;
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CCdcCommsDatCreatorRfsPlugin::ResetCommsDatToDefaultL()
+// ----------------------------------------------------------------------------
+//   	
+void CCdcCommsDatStartup::ResetCommsDatToDefaultL()
+	{		
+	CLOG_WRITE( "CCdcCommsDatStartup::ResetCommsDatToDefaultL" );
+	
+	CRepository* repository( NULL );
+    
+    repository = CRepository::NewL( KCRUidCommsDb );    
+    CleanupStack::PushL( repository );
+
+    CLOG_WRITE("Reset CommsDat CenRep");
+
+    User::LeaveIfError( repository->Reset() );
+
+    CleanupStack::PopAndDestroy( repository );
+
+    CLOG_WRITE( "CCdcCommsDatStartup::ResetCommsDatToDefaultL end" );    
+	}
+
+// ----------------------------------------------------------------------------
+// CCdcCommsDatCreatorRfsPlugin::ResetEAPSettingsL()
+// ----------------------------------------------------------------------------
+//   	
+void CCdcCommsDatStartup::ResetEAPSettingsL()
+{
+	CLOG_WRITE( "CCdcCommsDatStartup::ResetEAPSettingsL" );
+	RFs fs;
+	User::LeaveIfError( fs.Connect() );
+	CleanupClosePushL( fs );
+	
+	CFileMan *fileMan = CFileMan::NewL( fs );
+	CleanupStack::PushL( fileMan );
+	
+	_LIT( KEapWildcard, "c:\\private\\100012a5\\DBS_102072E9_eap*" );
+	
+	TInt err = fileMan->Delete( KEapWildcard );
+	
+	if ( err != KErrNone 
+		 && err != KErrNotFound 
+		 && err != KErrPathNotFound )
+		{
+		User::Leave( err );
+		}
+			
+	CleanupStack::PopAndDestroy( fileMan );
+	CleanupStack::PopAndDestroy(); // fs		
+	CLOG_WRITE( "CCdcCommsDatStartup::ResetEAPSettingsL end" );
+}
+
+// End of File.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatstartup/Src/main.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,97 @@
+/*
+* Copyright (c) 2008 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:   Entry point of DbCreator 
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <e32test.h>
+#include <e32base.h>
+#include <bacline.h>
+#include <f32file.h>
+
+#include "cdccommsdatstartup.h"
+#include "cdcerrors.h"
+#include "cdclogger.h"
+
+
+/**
+* Entry point for the test program. Runs test under a TRAP harness.
+*/
+GLDEF_C TInt E32Main()
+    {
+    TInt result( KErrNone );
+
+    CCdcCommsDatStartup* cdc = new CCdcCommsDatStartup;
+
+    if (cdc == NULL)
+        {
+        result = KErrNoMemory;
+        return result;
+        }
+
+    CTrapCleanup* cleanup = CTrapCleanup::New();
+
+    TRAP( result, cdc->DoStartL() );
+    delete cleanup;
+
+    CLOG_WRITE_FORMAT( "\t result: %d \n", result )
+    switch ( result )
+        {
+        case KErrNone:
+            CLOG_WRITE( "No error" )
+            break;
+        case KErrNotSupported:
+            CLOG_WRITE( "! Error : Not supported feature found" )
+            break;
+        case KErrAlreadyExists:
+            CLOG_WRITE( "! Error : Access point already exists" )
+            break;
+        case KErrNotFound:
+            CLOG_WRITE( "! Error : Item not found" )
+            break;
+        case KErrPermissionDenied:
+            CLOG_WRITE( "! Error : Permission denied" );
+            break;
+        case KErrInvalidContent:
+            CLOG_WRITE( "! Error : Invalid content found" )
+            break;
+        case KErrAssertionFailed:
+            CLOG_WRITE( "! Error : Assertion failed" )
+            break;
+        case KErrFileCannotBeOpened:
+            CLOG_WRITE( "! Error : Cannot open file\n" )
+            break;
+        case KErrArgument:
+            CLOG_WRITE( "! Error : Argument is out of range\n" )
+            break;
+        case KErrWLANTablesMissing:
+            CLOG_WRITE( "! Error : WLAN tables are missing\n" )
+            break;
+        case KErrInvalidParameter:
+            CLOG_WRITE( "! Error : Invalid parameter\n" )
+            break;
+        case KErrInvalidExtension:
+            CLOG_WRITE( "! Error : File extension must be .csv or .xml\n" );
+            break;
+        default:
+            CLOG_WRITE( "! Error : Unknown error" )
+            break;
+        }
+    delete cdc;
+
+    return result;
+    }
Binary file dbcreator/commsdatstartup/cenrep/keys_commsdatcreator.xls has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatstartup/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2002 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 DbCreator
+*
+*/
+
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+./cdccommsdatstartup.mmp
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/commsdatstartup/group/cdccommsdatstartup.mmp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2008 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 description file for the Access Point Engine
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+
+TARGET      commsdatstartup.exe
+TARGETTYPE  exe
+UID         0x100039CE 0x10281BC3
+  
+
+
+CAPABILITY READDEVICEDATA WRITEDEVICEDATA READUSERDATA WRITEUSERDATA ALLFILES NETWORKCONTROL
+
+VENDORID VID_DEFAULT
+
+EPOCSTACKSIZE 0x5000 
+
+LANG SC
+    
+SOURCEPATH     ../Src
+
+		
+SOURCE        main.cpp
+SOURCE        cdccommsdatstartup.cpp
+
+
+// Component specific internal headers 
+USERINCLUDE			../Inc
+
+USERINCLUDE			../../inc
+
+
+//Macro to /epoc32 headers
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY        euser.lib
+LIBRARY        efsrv.lib 
+LIBRARY        bafl.lib
+LIBRARY	       centralrepository.lib
+LIBRARY        commsdatcreator.lib
+DEBUGLIBRARY   flogger.lib
Binary file dbcreator/conf/commsdatcreator.confml has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/conf/commsdatcreator_01.gcfml	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,27 @@
+<file xmlns="http://www.s60.com/xml/genconfml/1" name="VariantData_commsdat.xml" target="private\10281BC3\">			 
+
+	<setting ref="Global/*"/>
+	<setting ref="DNs/*"/>
+	<setting ref="APs/*"/>
+	<setting ref="WLAN_APs/*"/>
+	<setting ref="CSD_APs/*"/>
+	<setting ref="HSCSD_APs/*"/>
+	<setting ref="LAN_APs/*"/>
+	<setting ref="VPN_APs/*"/>
+	
+	<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xi="http://www.w3.org/2001/xinclude">
+		<xsl:output method="xml" indent="yes" encoding="UTF-8"/>
+		<xsl:template match="configuration">
+		<data>
+			<xsl:copy-of select="data/Global"/>			
+			<xsl:copy-of select="data/APs"/>
+			<xsl:copy-of select="data/WLAN_APs"/>
+			<xsl:copy-of select="data/CSD_APs"/>
+			<xsl:copy-of select="data/HSCSD_APs"/>
+			<xsl:copy-of select="data/LAN_APs"/>
+			<xsl:copy-of select="data/VPN_APs"/>
+			<xsl:copy-of select="data/DNs"/>
+		</data>
+		</xsl:template>				
+	</xsl:stylesheet>
+</file>
\ No newline at end of file
Binary file dbcreator/conf/commsdatcreator_10281BC8.crml has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/dbcreatorexe/Inc/cdcdbcreator.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2002 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 the class CDbCreator
+*
+*/
+
+
+
+
+#ifndef C_CDCDBCREATOR_H
+#define C_CDCDBCREATOR_H
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <bacline.h>
+#include <f32file.h>
+
+/**
+* CsvProcessor creates data to the CommsDb from the CSV file.
+*/
+class CDbCreator : public CBase
+    {
+
+    public:
+    
+        /**
+        * Creates the internet access points and creates output file.
+        */
+        void DoStartL();
+     
+          
+    private:
+    
+        /**
+        * ParseCommandLineLC
+        * Gets parameters from command line. If some parameters are not
+        * supplied in the command line, they are untouched.
+        * @param aArgs, command line arguments.
+        * @param aFileName, xml file name.
+        * @param aExt, will the CommsDat be extended or not.
+        * @param aDump, dump or not.
+        */
+        
+        void ParseCommandLineLC( CCommandLineArguments* aArgs,
+                                         TFileName& aFileName,   
+                                         TBool& aExt,
+                                         TBool& aDump );
+
+    };
+
+
+#endif   // C_CDCDBCREATOR_H
+            
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/dbcreatorexe/Inc/cdclogfilename.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2004 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:   contains logger macros
+*
+*/
+
+
+
+
+#ifndef CDC_LOGFILE_NAME_H
+#define CDC_LOGFILE_NAME_H
+
+
+/// Directory where the log file can be found.
+_LIT16( KLogDir, "cdc" );
+
+/// Log file name.
+_LIT16( KLogFile, "cdcexe.txt" );
+
+
+#endif // CDC_LOGFILE_NAME_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/dbcreatorexe/Src/cdcdbcreator.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,152 @@
+/*
+* Copyright (c) 2002 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:   Module for creating CommsDat from an input file
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include <e32def.h>
+#include <e32base.h>
+#include <s32strm.h>
+#include <s32file.h>
+
+#include "cdcdbcreator.h"
+#include "cdcerrors.h"
+#include "cdccommsdatcreator.h"
+
+
+// CONSTANTS
+
+// Length of the characters "f:"
+const TUint KFParamLength = 2;
+
+// Default input file for db creating
+_LIT16( KInFile, "C:\\Data\\DbCreator\\VariantData.xml" );
+// Default output file for dumping
+_LIT16( KOutFile, "C:\\Data\\DbCreator\\DumpFile.csv" );
+
+
+void CDbCreator::DoStartL()
+    {
+    //process command line arguments
+    //------------------------------
+    TBool extensionOnly( EFalse );           //Only extend CommsDat
+    TBool dump( EFalse );                    //Dump is needed not creation
+    
+    CCommandLineArguments* args = CCommandLineArguments::NewLC();
+
+    TFileName fileName;
+    ParseCommandLineLC( args, fileName, extensionOnly, dump );
+
+
+    CCdcCommsDatCreator* cdc = CCdcCommsDatCreator::NewLC();
+                                            
+    //checks filename argument
+    if ( fileName.Length() == 0 )
+        {
+        if( dump )
+            {
+            fileName.Copy( KOutFile );
+            }
+        else
+            {
+            fileName.Copy( KInFile );
+            }
+        }
+                                            
+    //calls the appropriate function.
+    if( dump )
+        {
+        cdc->DumpCommsDatL( fileName );
+        }
+    else if( extensionOnly ) 
+        {
+        cdc->CreateTablesL();    
+        }
+    else
+        {
+        cdc->CreateTablesL();
+        cdc->CreateCommsDatL( fileName );    
+        }
+        
+    CleanupStack::PopAndDestroy( 2, args);  // args, cdc
+    }
+
+
+
+//------------------------------------------------
+// CDbCreator::ParseCommandLineLC
+//------------------------------------------------
+//
+
+void CDbCreator::ParseCommandLineLC( CCommandLineArguments* aArgs,
+                                     TFileName& aFileName,   
+                                     TBool& aExt,
+                                     TBool& aDump )
+    {
+    TPtrC arg;
+
+    if ( aArgs->Count() > 1 )
+        {
+
+        for ( TInt i = 1; i < aArgs->Count(); i++ )
+            {
+            arg.Set( aArgs->Arg( i ) );
+            
+            if( arg.Size() > 0 )
+                {
+                switch( arg[0] )
+                    {
+                    case 'd':
+                    case 'D'://fall-through 
+                        // D means "dump" needed
+                        aDump = ETrue;
+                        break;
+                    case 'f':
+                    case 'F'://fall-through 
+                        {
+                        _LIT( KHeader,  "f:" );
+                        if ( 0 == arg.FindF( KHeader ) )
+                            {
+                            //f: must be in the head position of file location
+                            aFileName.Copy( arg.Right( arg.Length() - KFParamLength ) );
+                            }
+                        else
+                            {
+                            User::Leave( KErrInvalidParameter );    
+                            }
+                        
+                        break;
+                        }
+                    // Only the CommsDat will be extended
+                    case 'E':
+                    case 'e'://fall-through 
+                        {    
+                        aExt = ETrue;    
+                        break;
+                        }
+                    default:
+                        {
+                        User::Leave( KErrInvalidParameter );
+                        }
+                    }//swich
+                }//if
+            }//for
+        }//if
+
+    }         
+// End of File.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/dbcreatorexe/Src/main.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,88 @@
+/*
+* Copyright (c) 2008 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:   Entry point of DbCreator 
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <e32test.h>
+#include <e32base.h>
+#include <bacline.h>
+#include <f32file.h>
+
+#include "cdcdbcreator.h"
+#include "cdcerrors.h"
+#include "cdclogger.h"
+
+
+
+/**
+* Entry point for the test program. Runs test under a TRAP harness.
+*/
+GLDEF_C TInt E32Main()
+    {
+    TInt result( KErrNone );
+    CDbCreator* dbc = new CDbCreator;
+    if (dbc == NULL)
+        {
+        result = KErrNoMemory;
+        return result;
+        }
+    
+    CTrapCleanup* cleanup = CTrapCleanup::New();
+    TRAP( result, dbc->DoStartL() );
+    delete cleanup;
+               
+    CLOG_WRITE_FORMAT( "\t result: %d \n", result )
+    switch ( result )
+        {
+        case KErrNone: 
+            CLOG_WRITE( "No error" )
+            break;
+        case KErrNotSupported:
+        	CLOG_WRITE( "! Error : Not supported feature found" )
+        	break;
+        case KErrAlreadyExists:
+            CLOG_WRITE( "! Error : Access point already exists" )
+            break;
+        case KErrNotFound:
+            CLOG_WRITE( "! Error : File not found" )
+            break;
+        case KErrInvalidContent:
+            CLOG_WRITE( "! Error : Invalid content found" )
+            break;
+        case KErrAssertionFailed:
+            CLOG_WRITE( "! Error : Assertion failed" )
+            break;
+        case KErrFileCannotBeOpened:
+            CLOG_WRITE( "! Error : Cannot open file\n" )
+            break;
+        case KErrWLANTablesMissing:
+            CLOG_WRITE( "! Error : WLAN tables are missing\n" )
+            break;
+        case KErrInvalidParameter:
+            CLOG_WRITE( "! Error : Invalid parameter\n" )
+            break;
+        case KErrInvalidExtension:
+            CLOG_WRITE( "! Error : File extension must be .csv or .xml\n" );
+            break;
+        default:
+            CLOG_WRITE( "! Error : Unknown error" )
+            break;
+        }
+    delete dbc;
+    return result;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/dbcreatorexe/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2002 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 DbCreator
+*
+*/
+
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+./dbcreatorexe.mmp
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/dbcreatorexe/group/dbcreatorexe.mmp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2002 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 description file for the dbcreator
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+
+TARGET      dbcreator.exe
+TARGETTYPE  exe
+UID         0x100039CE 0x10207371
+  
+CAPABILITY READDEVICEDATA WRITEDEVICEDATA NetworkControl
+VENDORID VID_DEFAULT
+
+EPOCSTACKSIZE 0x5000 
+
+LANG SC
+    
+SOURCEPATH     ../Src
+
+		
+SOURCE        main.cpp
+SOURCE        cdcdbcreator.cpp
+
+
+// Component specific internal headers 
+USERINCLUDE			../Inc
+
+USERINCLUDE			../../inc
+
+//Macro to /epoc32 headers
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY        euser.lib
+LIBRARY        bafl.lib
+LIBRARY        commsdatcreator.lib
+DEBUGLIBRARY   flogger.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,40 @@
+/*
+* 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:   Build information for the DbCreator.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+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)
+../rom/commsdatcreator.iby						CORE_MW_LAYER_IBY_EXPORT_PATH(commsdatcreator.iby)
+
+
+PRJ_MMPFILES
+// None
+
+#include "../commsdatcreator/group/bld.inf"
+/* CommsDatCreator RFS functionality is disabled in the emulator */
+#ifndef WINSCW
+	#include "../commsdatcreatorrfsplugin/group/bld.inf"
+#endif
+#include "../commsdatstartup/group/bld.inf"
+#include "../dbcreatorexe/group/bld.inf"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/inc/cdccommon.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,359 @@
+/*
+* Copyright (c) 2002 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 enums and const for DbCreator
+*
+*/
+
+
+
+
+#ifndef CDCCOMMON_H
+#define CDCCOMMON_H
+
+// Possible input files
+enum TDbCreatorInputFile
+    {
+    EFileUnknown    = 0x00000000,     // Unrecognized
+    EFileXML        = 0x00000001      // XML file
+    };
+    
+// Possible character sets of input file
+enum TDbCreatorInputCharSet
+    {
+    ECharSetAscii   = 0x00000000,     // ASCII
+    ECharSetUnicode = 0x00000001,     // Unicode
+    ECharSetUtf8    = 0x00000002,     // UTF-8
+    ECharSetUnknown = 0x00000003      // Unknown
+    };
+
+// Feaures DbCreator can recognize (from XML input)
+enum TDbCreatorFeatures
+    {
+    EFeatureNone       = 0x00000000,     // No feature found
+    EFeaturePacketData = 0x00000001,     // GPRS access point
+    EFeatureWLAN       = 0x00000002,     // WLAN access point
+    EFeatureLAN        = 0x00000003,     // LAN access point
+    EFeatureCSD        = 0x00000004,     // CSD access point
+    EFeatureHSCSD      = 0x00000005,     // HSCSD access point
+    EFeatureVPN        = 0x00000006,     // VPN access point
+    EFeatureDN         = 0x00000007,     // Destination Network
+    EFeatureGlobal     = 0x00000008      // Global settings
+    };
+    
+// Global settings
+enum TDbCreatorGlobalSettings
+    {
+    EGPRSAttachMode       = 0x00000000,    
+    EDefaultDnIcon        = 0x00000001,
+    EPriorityLan          = 0x00000002,
+    EPriorityWlan         = 0x00000003,
+    EPriorityPan          = 0x00000004,
+    EPriorityGprsIn       = 0x00000005,
+    EPriorityGprsOut      = 0x00000006,
+    EPriorityCdma2k       = 0x00000007,
+    EPriorityDialOut      = 0x00000009,
+    EPriorityDialIn       = 0x0000000a,
+    EPriorityVpn          = 0x0000000b,
+    EPriorityMip          = 0x0000000c,
+    EUIPriorityLan        = 0x0000000d,
+    EUIPriorityWlan       = 0x0000000e,
+    EUIPriorityPan        = 0x0000000f,
+    EUIPriorityGprsIn     = 0x00000010,
+    EUIPriorityGprsOut    = 0x00000011,
+    EUIPriorityCdma2k     = 0x00000012,
+    EUIPriorityDialOut    = 0x00000013,
+    EUIPriorityDialIn     = 0x00000014,
+    EUIPriorityVpn        = 0x00000015,
+    EUIPriorityMip        = 0x00000016,
+    EDefaultConnectionType= 0x00000017,
+    EDefaultConnectionName= 0x00000018,
+    EGprsLastSocketActivityTimeout	= 0x00000019, 
+    EGprsLastSessionClosedTimeout	= 0x0000001a,
+    EGprsLastSocketClosedTimeout	= 0x0000001b,
+    ECsdLastSocketActivityTimeout	= 0x0000001c,
+    ECsdLastSessionClosedTimeout	= 0x0000001d,
+    ECsdLastSocketClosedTimeout		= 0x0000001e,
+    EWlanLastSocketActivityTimeout	= 0x0000001f,
+    EWlanLastSessionClosedTimeout	= 0x00000020,
+    EWlanLastSocketClosedTimeout	= 0x00000021,
+    EWlanBGScanInterval		= 0x00000022,
+    EWlanUseDefSettings		= 0x00000023,
+    EWlanLongRetry			= 0x00000024,
+    EWlanShortRetry			= 0x00000025,
+    EWlanRTS				= 0x00000026,
+    EWlanTxPowerLevel		= 0x00000027,
+    EWlanRadioMeasurements	= 0x00000028,
+    EWlanPowerMode			= 0x00000029,    
+    EDefaultAP				= 0x0000002a,
+    EUsageOfWlan            = 0x0000002b,
+    ESeamlessnessHome       = 0x0000002c,
+    ESeamlessnessVisitor    = 0x0000002d,
+    EUnused               	= 0x00010000
+    };
+    
+    
+// Destination Network parameters
+enum TDbCreatorDNParams
+    {
+    EDN_Name           = 0x00000000,
+    EDN_Icon           = 0x00000001,
+    EDN_Metadata       = 0x00000002,
+    EDN_Protection     = 0x00000003,
+    EDN_Hidden         = 0x00000004,
+    EDN_HiddenAgent    = 0x00000005,
+    EDN_Highlighted    = 0x00000006,
+    EDN_IAPName        = 0x00000007,
+    EDN_EmbeddedDNName = 0x00000008,
+    EDN_Id             = 0x00000009
+    };
+    
+// VPN parameters
+enum TDbCreatorVpnParams
+    {
+    EVPN_IapName       = 0x00000000
+    
+    };
+    
+//WLAN Security settings 
+enum TDbCreatorSecurityMode
+    {
+    ESecurityModeOpen = 0x00000001,   // open mode
+    ESecurityModeWEP  = 0x00000002,   // WEP security mode
+    ESecurityMode802  = 0x00000004,   // 802.1X security mode
+    ESecurityModeWPA  = 0x00000008,   // Wpa security mode
+    ESecurityModeWPA2 = 0x00000010    // Wpa2 only security mode 
+    };        
+    
+//WEP related field ids
+enum TDbCreatorWEPFields
+    {
+    EWEPKeyInUse    = 0x00001000,     // Key in use
+    EWEPAuthType    = 0x00001001,     // Authentication type
+    EWEPKey1Length  = 0x00001002,     // Key 1 length
+    EWEPKey1Format  = 0x00001003,     // Key 1 format
+    EWEPKey1Data    = 0x00001004,     // Key 1 data
+    EWEPKey2Length  = 0x00001005,     // Key 2 length
+    EWEPKey2Format  = 0x00001006,     // Key 2 format
+    EWEPKey2Data    = 0x00001007,     // Key 2 data
+    EWEPKey3Length  = 0x00001008,     // Key 3 length
+    EWEPKey3Format  = 0x00001009,     // Key 3 format 
+    EWEPKey3Data    = 0x0000100a,     // Key 3 data
+    EWEPKey4Length  = 0x0000100b,     // Key 4 length
+    EWEPKey4Format  = 0x0000100c,     // Key 4 format 
+    EWEPKey4Data    = 0x0000100d,     // Key 4 data
+    };
+
+//number of WEP fields
+const TInt KWEPKeyNumOfFields = 14;
+    
+//WPA related field ids
+enum TDbCreatorWPAFields
+    {
+    EWPAPresharedKey = 0x00002000,    // Preshared key 
+    EWPAKeyLength    = 0x00002001,    // Key length
+    EWPAListOfEAPs   = 0x00002002,    // List of EA plugins
+    EWPAUseOfPresharedKey =0x00002003,// Use of preshared key
+    };
+    
+//number of WPA fields
+const TInt KWPAKeyNumOfFields = 4;
+
+// Enumeration of the possible keys in use
+enum TWEPKeyInUse
+    {
+    EKeyNumber1,                      // Key number 1
+    EKeyNumber2,                      // Key number 2
+    EKeyNumber3,                      // Key number 3
+    EKeyNumber4                       // Key number 4
+    };
+
+// Enumeration of the possible authentication types
+enum TWEPAuthentication
+    {
+    EAuthOpen,                        // Open authentication
+    EAuthShared                       // Shared authentication
+    };
+
+// Possible lengths of the keys
+enum TWEPKeyLength
+    {
+    E40Bits,                          // 40 bits
+    E104Bits,                         // 104 bits
+    E232Bits                          // 232 bits
+    };
+
+// Possible formats of the keys
+enum TWEPKeyFormat
+    {
+    EAscii,                           // Ascii format
+    EHexadecimal                      // Hex format
+    };
+
+// Empty key
+LOCAL_D const TUint KKeyDataLengthEmpty = 0;
+
+// Number of characters for a 40 bits key
+LOCAL_D const TUint KKeyDataLength40Bits  = 10;
+
+// Number of characters for a 104 bits key
+LOCAL_D const TUint KKeyDataLength104Bits = 26;
+
+// Number of characters for a 232 bits key
+LOCAL_D const TUint KKeyDataLength232Bits = 58;
+
+// The maximum length of key data
+LOCAL_D const TUint KMaxLengthOfKeyData = KKeyDataLength232Bits;
+
+// Number of keys
+LOCAL_D const TUint KMaxNumberofKeys = 4;
+
+//EAP related field ids
+enum TDbCreatorEAPFields
+	{
+	EEapParameterFirst = 0x0002fff,
+	EEapGtcUsername = 0x00003000,
+	EEapGtcSessionValidityTime = 0x00003001,
+	EEapGtcEncapsulation = 0x00003002,
+	EEapTlsUsername = 0x00003053,
+	EEapTlsRealm = 0x00003003,
+	EEapTlsVerifyServerRealm = 0x00003004,
+	EEapTlsRequireClientAuth = 0x00003005,
+	EEapTlsSessionValidityTime = 0x00003006,
+	EEapTlsCipherSuites = 0x00003007,
+	EEapTlsUserCertSubjectKeyId = 0x00003008,
+	EEapTlsUserCertIssuerName = 0x00003009,
+	EEapTlsUserCertSerialNumber = 0x0000300a,
+	EEapTlsCaCertSubjectKeyId = 0x0000300b,
+	EEapTlsCaCertIssuerName = 0x0000300c,
+	EEapTlsCaCertSerialNumber = 0x0000300d,
+	EEapTlsEncapsulation = 0x0000300e,
+	EEapLeapUsername = 0x0000300f,
+	EEapLeapPassword = 0x00003010,
+	EEapLeapSessionValidityTime = 0x00003011,
+	EEapSimUsername = 0x00003012,
+	EEapSimRealm = 0x00003013,
+	EEapSimUsePseudonyms = 0x00003014,
+	EEapSimSessionValidityTime = 0x00003015,
+	EEapSimEncapsulation = 0x00003016,
+	EEapTtlsUsername = 0x00003017,
+	EEapTtlsRealm = 0x00003018,
+	EEapTtlsVerifyServerRealm = 0x00003019,
+	EEapTtlsRequireClientAuth = 0x0000301a,
+	EEapTtlsSessionValidityTime = 0x0000301b,
+	EEapTtlsCipherSuites = 0x0000301c,
+	EEapTtlsEncapsulatedTypes = 0x0000301d,
+	EEapTtlsUserCertSubjectKeyId = 0x0000301e,
+	EEapTtlsUserCertIssuerName = 0x0000301f,
+	EEapTtlsUserCertSerialNumber = 0x00003020,
+	EEapTtlsCaCertSubjectKeyId = 0x00003021,
+	EEapTtlsCaCertIssuerName = 0x00003022,
+	EEapTtlsCaCertSerialNumber = 0x00003023,
+	EEapAkaUsername = 0x00003024,
+	EEapAkaRealm = 0x00003025,
+	EEapAkaUsePseudonyms = 0x00003026,
+	EEapAkaSessionValidityTime = 0x00003027,
+	EEapAkaEncapsulation = 0x00003028,
+	EEapPeapUsername = 0x00003029,
+	EEapPeapRealm = 0x0000302a,
+	EEapPeapVerifyServerRealm = 0x0000302b,
+	EEapPeapRequireClientAuth = 0x0000302c,
+	EEapPeapSessionValidityTime = 0x0000302d,
+	EEapPeapCipherSuites = 0x0000302e,
+	EEapPeapV0Allowed = 0x0000302f,
+	EEapPeapV1Allowed = 0x00003030,
+	EEapPeapV2Allowed = 0x00003031,
+	EEapPeapEncapsulatedTypes = 0x00003032,
+	EEapPeapUserCertSubjectKeyId = 0x00003033,
+	EEapPeapUserCertIssuerName = 0x00003034,
+	EEapPeapUserCertSerialNumber = 0x00003035,
+	EEapPeapCaCertSubjectKeyId = 0x00003036,
+	EEapPeapCaCertIssuerName = 0x00003037,
+	EEapPeapCaCertSerialNumber = 0x00003038,
+	EEapMschapv2Username = 0x00003039,
+	EEapMschapv2Password = 0x0000303a,
+	EEapMschapv2SessionValidityTime = 0x0000303b,
+	EEapMschapv2Encapsulation = 0x0000303c,
+	EEapFastUsername = 0x0000303d,
+	EEapFastRealm = 0x0000303e,
+	EEapFastVerifyServerRealm = 0x0000303f,
+	EEapFastRequireClientAuth = 0x00003040,
+	EEapFastSessionValidityTime = 0x00003041,
+	EEapFastCipherSuites = 0x00003042,
+	EEapFastEncapsulatedTypes = 0x00003043,
+	EEapFastAuthProvModeAllowed = 0x00003044,
+	EEapFastUnauthProvModeAllowed = 0x00003045,
+	EEapFastWarnADHPNoPAC = 0x00003046,
+	EEapFastWarnADHPNoMatchingPAC = 0x00003047,
+	EEapFastWarnNotDefaultServer = 0x00003048,
+	EEapFastUserCertSubjectKeyId = 0x00003049,
+	EEapFastUserCertIssuerName = 0x0000304a,
+	EEapFastUserCertSerialNumber = 0x0000304b,
+	EEapFastCaCertSubjectKeyId = 0x0000304c,
+	EEapFastCaCertIssuerName = 0x0000304d,
+	EEapFastCaCertSerialNumber = 0x0000304e,
+	EMschapv2Username = 0x0000304f,
+	EMschapv2Password = 0x00003050,
+	EMschapv2SessionValidityTime = 0x00003051,
+	EMschapv2Encapsulation = 0x00003052,
+	EEapParameterLast = 0x0003100
+	};    
+   
+    
+// exceptional field ids that are missing from access point item definition
+const TInt KFieldIgnored         = -1; // Ignored field
+const TInt KFieldApplicationName = -2; // Application name.
+
+// maximum length of default GPRS name
+const TInt KMaxLengthOfApName    = 50;
+
+// String constants for general connection method parameters
+_LIT16( KStrYes,             "Yes" );
+_LIT16( KStrNo,              "No" );
+_LIT16( KStrOn,              "On" );
+_LIT16( KStrOff,             "Off" );
+_LIT16( KStrEmpty,           "" );
+
+// Metadata
+_LIT16( KStrMMS,             "MMS" );
+_LIT16( KStrNotMMS,          "NotMMS" );
+
+// Seamlessness
+_LIT16( KStrNotRoamedTo,     "NotRoamedTo" );
+_LIT16( KStrConfirmFirst,    "ConfirmFirst" );
+_LIT16( KStrShowProgress,    "ShowProgress" );
+_LIT16( KStrFullySeamless,   "FullySeamless" );
+    
+// Default connection type
+_LIT16( KStrAlwaysAsk,       "Always ask" );
+_LIT16( KStrAskOnce,         "Ask once" );
+_LIT16( KStrDestination,     "Destination" );
+_LIT16( KStrConnectionMethod,"Connection method" );
+
+// General connection settings: Wlan usage: Known / Manual
+_LIT16( KStrKnown,           "Known" );
+_LIT16( KStrManual,          "Manual" );
+
+// General connection settings: Seamlessness: Automatic / Confirm / Wlan only
+_LIT16( KStrAutomatic,       "Automatic" );
+_LIT16( KStrConfirm,         "Confirm" );
+_LIT16( KStrWlanOnly,        "Wlan only" );
+
+// Packet Data Settings
+enum TDbCreatorPacketDataSettings
+    {
+    EPacketDataLinger = 0x29041982
+    };
+
+    
+#endif //CDCCOMMON_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/inc/cdccommsdatcreator.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,127 @@
+/*
+* Copyright (c) 2004-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:   Declaration of cdccommsdatcreator class.
+*
+*/
+
+
+
+
+#ifndef COMMSDAT_CREATOR_H
+#define COMMSDAT_CREATOR_H
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <bacline.h>
+#include <f32file.h>
+
+#include <cmmanagerext.h>
+
+
+// CONSTANTS
+
+
+// DATA TYPES
+
+
+// FORWARD DECLARATIONS
+class RCmConnectionMethodExt;
+class RCmDestinationExt;
+class CReaderBase;
+class CProcessorBase;
+class CEapTypeElement;
+class CLingerElement;
+
+// CLASS DECLARATION
+
+
+/**
+* Creates CommsDat database from the input XML file.
+* Writes the content of the CommsDat to CSV output file.
+*/
+class CCdcCommsDatCreator: public CBase
+    {
+
+    public:
+
+        /** Epoc constructors */
+        IMPORT_C static CCdcCommsDatCreator* NewL();
+        IMPORT_C static CCdcCommsDatCreator* NewLC();
+    
+        IMPORT_C void CreateCommsDatL( const TFileName& aInFileName );
+
+        IMPORT_C void DumpCommsDatL( const TFileName& aOutFileName );
+
+        IMPORT_C void CreateTablesL();
+
+
+        /** Destructor */
+	    IMPORT_C virtual ~CCdcCommsDatCreator();
+        
+    private:
+    
+        /** First stage constructor */
+        CCdcCommsDatCreator();
+    
+        /** Epoc constructor */
+        void ConstructL(); // second-phase constructor
+        
+        /**
+        * InputFileType
+        * @return TDbCreatorInputFile
+        *    EFileUnknown     ///< Unrecognized
+        *    EFileCSV         ///< CSV file
+        *    EFileXML         ///< XML file
+        */
+        TUint InputFileType ( const TFileName& aInFileName );
+
+        void LogIapIdsL();
+                      
+        void UpdateUncatCmsL( RArray< TBool >& aCmInDest );
+                      
+        template<class T> void ProcessPluginL();
+        
+        void ProcessDNL( RArray< TBool >& aCmInDest, TBool aFirstRound );
+
+        void SetUnderlyingIapL( RPointerArray< HBufC >& aUnderLying );
+
+        void SetDefaultConnectionL( RPointerArray< HBufC >& aDefCon );
+        
+        void SetWlanSecurityL( RPointerArray< HBufC >& aWlanSecurity );
+        
+        void SetLingerSettingsL( RPointerArray< CLingerElement >& aLingerSettings );
+                      
+        TBool iIsWlanS;
+        
+        RPointerArray< RCmDestinationExt > iDestArray;
+        RPointerArray< HBufC > iDestNames;
+        RPointerArray< RCmConnectionMethodExt > iPluginArray;
+        RPointerArray< HBufC > iPluginNames;
+        RPointerArray< CEapTypeElement > iEapSettings;
+		RPointerArray< HBufC > iUnderLying;
+    	RPointerArray< HBufC > iDefCon;
+    	RPointerArray< HBufC > iWlanSecurity;
+    	RPointerArray< CLingerElement > iLingerSettings;
+    	RArray< TBool > iCmInDest;
+    
+        RCmManagerExt iCmManager;
+        
+        CReaderBase* iReader;
+
+        CProcessorBase* iFileProcessor;
+
+    };
+
+#endif   // COMMSDAT_CREATOR_H
+            
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/inc/cdccommsdatcreatorcrkeys.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,65 @@
+/*
+* 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/inc/cdcerrors.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2004 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 the error codes of the DbCreator.
+*
+*/
+
+
+
+
+#ifndef DBCREATOR_ERRORS_H
+#define DBCREATOR_ERRORS_H
+
+// INCLUDE FILES
+
+#include <e32base.h>
+
+// The potential errors.
+const TInt  KErrApIsNotCreated         = -600;
+const TInt  KErrGivenRealIdNotExists   = -601;
+const TInt  KErrGivenRealNameNotExists = -602;
+const TInt  KErrTooMuchTag             = -603;
+const TInt  KErrInvaildPolicyId        = -604;
+const TInt  KErrComment                = -605;
+const TInt  KErrInvalidContent         = -606;
+const TInt  KErrAssertionFailed        = -607;
+const TInt  KErrFileCannotBeOpened     = -608;
+const TInt  KErrWLANTablesMissing      = -609;
+const TInt  KErrInvalidParameter       = -610;
+const TInt  KErrInvalidExtension       = -611;
+
+//Panic codes
+const TInt  KErrInvalidCase            = -700;
+const TInt  KErrOutOfRange             = -701;
+
+//Panic texts
+_LIT16( KPanicInvalidCase,         "Invalid case" );
+_LIT16( KPanicOutOfRange,          "Value is out of range" );
+
+
+#endif // DBCREATOR_ERRORS_H
+
+
+// End of File.
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/inc/cdclogger.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,97 @@
+/*
+* Copyright (c) 2004 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:   contains logger macros
+*
+*/
+
+
+
+
+#ifndef LOGGER_H
+#define LOGGER_H
+
+
+// INCLUDE FILES
+
+#include <e32std.h>
+#include <e32def.h>
+
+
+#ifdef _DEBUG
+
+#include <flogger.h>
+
+#include "cdclogfilename.h"
+
+
+#define CREATE_LOG                              \
+    {                                           \
+    User::LeaveIfError( iLogFile.Connect() );   \
+    iLogFile.CreateLog( KLogDir, KLogFile , EFileLoggingModeAppend ); \
+    }                                           \
+
+#define CLOSE_LOG       \
+    {                   \
+    iLogFile.Close();   \
+    }                   \
+
+
+/// Writes to the log file the string 'a'.
+#define CLOG_WRITE( a )             \
+    {                               \
+    _LIT16( temp, a );              \
+    RFileLogger::Write              \
+        (                           \
+        KLogDir,                    \
+        KLogFile,                   \
+        EFileLoggingModeAppend,     \
+        temp                        \
+        );                          \
+    }
+
+
+/// Writes to the log file formatted in unicode.
+#define CLOG_WRITE_FORMAT( a, b )   \
+    {                               \
+    _LIT( temp, a );                \
+    RFileLogger::WriteFormat        \
+        (                           \
+        KLogDir,                    \
+        KLogFile,                   \
+        EFileLoggingModeAppend,     \
+        temp,                       \
+        b                           \
+        );                          \
+    }
+
+                                                    
+#else /* not defined __DEBUG__*/
+
+/// Empty definition (disable log).
+#define CLOG_WRITE( a )
+
+/// Empty definition (disable log).
+#define CLOG_WRITE_FORMAT( a, b )
+
+#define CREATE_LOG                              \
+
+#define CLOSE_LOG                              \
+
+
+#endif /* def _DEBUG */
+
+#endif /* def LOGGER_H */
+
+
+// End of File.
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/rom/commsdatcreator.iby	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project dbcreator
+*
+*/
+
+#ifndef __COMMSDAT_CREATOR_IBY
+#define __COMMSDAT_CREATOR_IBY
+
+#include <bldvariant.hrh>
+
+#ifdef FF_COMMSDAT_CREATOR
+
+REM binaries
+
+file=ABI_DIR\BUILD_DIR\commsdatstartup.exe	Sys\Bin\commsdatstartup.exe  
+file=ABI_DIR\BUILD_DIR\commsdatcreator.dll     	SHARED_LIB_DIR\commsdatcreator.dll
+
+ECOM_PLUGIN( commsdatcreatorrfsplugin.dll,     commsdatcreatorrfsplugin.rsc )
+
+
+REM Varintadata for commsdat creation
+
+REM data=DATAZ_\private\10281BC3\VariantData.xml     private\10281BC3\VariantData.xml
+
+
+#endif // FF_COMMSDAT_CREATOR
+
+
+#endif // __COMMSDAT_CREATOR_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Build info for ipconnmgmt package. 
+*
+*/
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+// Export CommsDat to emulator
+../data/cccccc00_emulator.cre   /epoc32/winscw/c/private/10202be9/persists/cccccc00.cre
+
+// Export default configuration options
+../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"
+#include "../cmmanager/group/bld.inf"
+#include "../connectionmonitoring/group/bld.inf"
+#include "../connectionutilities/ConnectionDialogs/group/bld.inf"
+#include "../dbcreator/group/bld.inf"
+#include "../ipcm_plat/group/bld.inf"
+#include "../ipcm_pub/group/bld.inf"
+
+
+PRJ_TESTMMPFILES
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/inc/meshpreface1.cfg	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,604 @@
+##
+##	Purpose of this file is to provide default configuration options for the new,
+##	access point aware code for all legacy configuration files which do not have
+##	it on their own.
+##	According to its purpose this file is being used only(!) ever (!) with legacy,
+##	non access point aware (or as it is also called in CommsDat: non mesh compatible)
+##	configurations.
+##	This means that for these configurations the only preferences used for selection
+##	are the link layer ones (IAP + connection preference ranking on implicit).
+##	None of the new preferences will ever make any sense on any system that does not
+##	provide the new configuration and will always be rejected!
+##
+
+############################################################
+## GlobalSettings
+##
+## 	A new setting has been added to indicate the default Tier that should be referred to 
+##	whenever a Tier setting is required but has not been specified.
+##	The deprecated global settings "DefaultSnap" and "PromptForSnap" are now held in the 
+##	default tier record not in the global settings table itself 
+##
+##
+
+[GlobalSettings]
+ADD_TEMPLATE
+	DefaultTier=Link.TierTable.2048
+	FIELD_COUNT=1
+END_TEMPLATE
+
+
+############################################################
+## AccessPointTable
+##
+##	Generally all of our (Symbian's) network layer providers (tier id == 2048)
+##	interpret their selection policy ids as records in the APPrioritySelectionPolicyTable.
+##	However, in this particular case below (and when using this file) we are always
+##	dealing with a legacy, link layer preferences and selection (please also see
+##	the comment above).
+##	Since none of the link preferences can ever be understood by the network layer
+##	selector, they always override the provider's own selection policy (as specified
+##	in the network layer access point, i.e. in the "NetworkDefault" record below this text).
+##	This is why the default network layer access point below does not need to have
+##	a APPrioritySelectionPolicyTable entry orresponding to its selection poincy id
+##	(this really is only an excepti on from the rule, it can never happen on a system
+##	configured to be access point aware!!!).
+##
+
+[AccessPointTable]
+ADD_SECTION
+# COMMDB_ID = 254
+	Id=10000
+	Name=NetworkDefault
+	Tier=Link.TierTable.2048
+	MCpr=MCprTable.1
+	AccessPointSelectionPolicy=Link.APPrioritySelectionPolicyTable.20000
+	Cpr=CprTable.1
+	SCpr=SCprTable.7
+	Protocol=ProtocolTable.1
+	FIELD_COUNT=8
+END_ADD
+
+##This record here is the default record for the IPProto level APs generated by 
+##CommsDat. This record used as it is if the config file, which is processed
+## after this config file, doesn't contain any ConnectionPreferences or 
+##IAPPrioritySelectionPolicy tables.
+ADD_SECTION
+# COMMDB_ID = 253
+	Id=10001
+	Name=IPProtoDefault
+	Tier=Link.TierTable.271064560
+	MCpr=MCprTable.2
+	AccessPointSelectionPolicy=0
+	Cpr=CprTable.2
+	SCpr=SCprTable.2
+	Protocol=ProtocolTable.2
+	##this field value here is an indication that the config file doesn't have
+	##any generated IPProto APs which means that there is no ConnPref or 
+	##IAPPrioritySelPol records.
+	CustomSelectionPolicy=-1
+	FIELD_COUNT=9
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 252
+	Id=10002
+	Name=SIPDefault
+	Tier=Link.TierTable.536887799
+	MCpr=MCprTable.11
+	AccessPointSelectionPolicy=0
+	Cpr=CprTable.5
+	SCpr=SCprTable.8
+	Protocol=ProtocolTable.2
+	FIELD_COUNT=8
+END_ADD
+
+
+############################################################
+## APPrioritySelectionPolicyTable
+## 
+
+[APPrioritySelectionPolicyTable]
+ADD_SECTION
+# COMMDB_ID = 254
+	Id=20000
+	Name=APSelPolNetworkDefault
+	##This will be modified by CommsDat to point to the correct IPProto level APs
+    ##in the ranking order of IAPs in the ConnectionPreferences table, if there
+    ##is any.
+	AP1=Link.AccessPointTable.10001
+	APCOUNT=1
+	FIELD_COUNT=4
+END_ADD
+
+
+############################################################
+## TierTable
+##
+
+[TierTable]
+
+## Id=0x10281DD8 == 271064536
+
+ADD_SECTION
+# COMMDB_ID = 1
+	Id=2048
+	TierImplUid=0x101F6D4A
+	Name=Tier1
+	TierThreadName= ESock_IP
+	TierManagerName= NetworkTierManager
+	DefaultAccessPoint=Link.AccessPointTable.10000
+	PromptUser=0
+	FIELD_COUNT=7
+END_ADD
+
+## Id=0x10281DF0 == 271064560
+
+ADD_SECTION
+# COMMDB_ID = 2
+	Id=271064560
+	TierImplUid=271064560
+	Name=Tier2
+	TierThreadName= ESock_IP
+	TierManagerName= ProtoTierManager
+	##By default this is linked to the default AP on the IPProto layer
+	DefaultAccessPoint=Link.AccessPointTable.10001
+	PromptUser=0
+	FIELD_COUNT=7
+END_ADD
+
+## Id=0x10281DF5 == 271064565
+
+ADD_SECTION
+# COMMDB_ID = 3
+	Id=271064565
+	TierImplUid=271064565
+	Name=Tier3
+	TierThreadName= ESock_IP
+	TierManagerName= LinkTierManager
+	##NB defaultAccessPoint not present in this layer. This is only needed here to satisfy the check
+	##on the link layer. However important that once this field has a value it has to be linked to a 
+	##correct accesspoint record in the accesspoint table because this will be checked either.
+	DefaultAccessPoint=Link.AccessPointTable.10000
+	PromptUser=0
+	FIELD_COUNT=7
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 4
+	Id=536887799
+	TierImplUid=536887799
+	Name=Tier4
+	TierThreadName= ESock_SIP
+	TierManagerName= SIPTierManager
+	DefaultAccessPoint=Link.AccessPointTable.10002
+	PromptUser= 0
+	FIELD_COUNT=7
+END_ADD
+
+############################################################
+## MCprTable
+## 
+[MCprTable]
+ADD_SECTION
+# COMMDB_ID = 1
+	Name=netmcpr
+	MCprUid=0x101F6D4B
+	FIELD_COUNT=2
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 2
+	Name=ipprotomcpr
+	MCprUid=0x10281DEE
+	FIELD_COUNT=2
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 3
+	Name=pppmcpr
+	MCprUid=0x10281DEC
+	FIELD_COUNT=2
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 4
+	Name=ethmcpr
+	MCprUid=0x10281DFC
+	FIELD_COUNT=2
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 5
+	Name=rawipmcpr
+	MCprUid=0x10281E00
+	FIELD_COUNT=2
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 6
+	Name=tunnelmcpr
+	MCprUid=0x10281E02
+	FIELD_COUNT=2
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 7
+	Name=qospppmcpr
+	MCprUid=0x10281DEC
+	FIELD_COUNT=2
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 8
+	Name=dummynifmcpr
+	MCprUid=0x10281E04
+	FIELD_COUNT=2
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 9
+	Name=hungrynifmcpr
+	MCprUid=0x10281E04
+	FIELD_COUNT=2
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 10
+	Name=pdpmcpr
+	MCprUid=0x102822F0
+	FIELD_COUNT=2
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 11
+	Name=sipmcpr
+	MCprUid=0x200041F9
+	FIELD_COUNT=2
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 12
+	Name=wlanmcpr
+	MCprUid=0x2001B2D2
+	FIELD_COUNT=2
+END_ADD
+
+## PAN Ether MCpr Uid = 271070626 (0x102835A2)
+ADD_SECTION
+# COMMDB_ID = 13
+	Name=panethermcpr
+	MCprUid=271070626
+	FIELD_COUNT=2
+END_ADD
+
+############################################################
+## CprTable
+## 
+[CprTable]
+ADD_SECTION
+# COMMDB_ID = 1
+	Name=ipcpr
+	CprUid=0x102070EF
+	FIELD_COUNT=2
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 2
+	Name=ipprotocpr
+	CprUid=0x10281DD3
+	FIELD_COUNT=2
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 3
+	Name=agentcpr
+	CprUid=0x10281DE8
+	FIELD_COUNT=2
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 4
+	Name=vanillacpr
+	CprUid=0x102822F3
+	FIELD_COUNT=2
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 5
+	Name=sipcpr
+	CprUid=0x10274C38
+	FIELD_COUNT=2
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 6
+	Name=tunnelagentcpr
+	CprUid=271080968
+	FIELD_COUNT=2
+END_ADD
+
+############################################################
+## SCprTable
+## 
+[SCprTable]
+ADD_SECTION
+# COMMDB_ID = 1
+	Name=ipscpr
+	SCprUid=0x10204308
+	FIELD_COUNT=2
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 2
+	Name=ipprotoscpr
+	SCprUid=0x10281DD1
+	FIELD_COUNT=2
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 3
+	Name=agentscpr
+	SCprUid=0x10281DEA
+	FIELD_COUNT=2
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 4
+	Name=pdpscpr
+	SCprUid=0x102822E0
+	FIELD_COUNT=2
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 5
+	Name=pppscpr
+	SCprUid=0x102822FC
+	FIELD_COUNT=2
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 6
+	Name=vanillascpr
+	SCprUid=0x102822F4
+	FIELD_COUNT=2
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 7
+	Name=qosscpr
+	SCprUid=0x102822D3
+	FIELD_COUNT=2
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 8
+	Name=sipscpr
+	SCprUid=0x10274C17
+	FIELD_COUNT=2
+END_ADD
+
+############################################################
+## ProtocolTable
+## 
+[ProtocolTable]
+ADD_SECTION
+# COMMDB_ID = 1
+	Name=sapshim
+	ProtocolUid=0x101F7482
+	FIELD_COUNT=2
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 2
+	Name=ipshim4
+	ProtocolUid=0x10281C36
+	FIELD_COUNT=2
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 3
+	Name=ppp
+	ProtocolUid=0x10281C4F
+	FIELD_COUNT=2
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 4
+	Name=ethernet
+	ProtocolUid=0x10281DDB
+	FIELD_COUNT=2
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 5
+	Name=rawip
+	ProtocolUid=0x10281DF2
+	FIELD_COUNT=2
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 6
+	Name=tunnel
+	ProtocolUid=0x10281DF7
+	FIELD_COUNT=2
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 7
+	Name=qosppp
+	ProtocolUid=0x10281C54
+	FIELD_COUNT=2
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 8
+	Name=dummynif
+	ProtocolUid=0x10281C3B
+	FIELD_COUNT=2
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 9
+	Name=hungrynif
+	ProtocolUid=0x10281C3D
+	FIELD_COUNT=2
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 10
+	Name=panether
+	ProtocolUid=271070627
+	FIELD_COUNT=2
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 11
+	Name=wlan
+	ProtocolUid=0x2001B2D3
+	FIELD_COUNT=2
+END_ADD
+
+############################################################
+## BearerTypeTable
+## 
+[BearerTypeTable]
+ADD_SECTION
+# COMMDB_ID = 1
+	Name=ppp
+	Tier=Link.TierTable.271064565
+	MCpr=MCprTable.3
+	Cpr=CprTable.3
+	SCpr=SCprTable.5
+	Protocol=ProtocolTable.3
+	FIELD_COUNT=6
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 2
+	Name=ethint
+	Tier=Link.TierTable.271064565
+	MCpr=MCprTable.4
+	Cpr=CprTable.3
+	SCpr=SCprTable.3
+	Protocol=ProtocolTable.4
+	FIELD_COUNT=6
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 3
+	Name=rawip
+	Tier=Link.TierTable.271064565
+	MCpr=MCprTable.5
+	Cpr=CprTable.3
+	SCpr=SCprTable.3
+	Protocol=ProtocolTable.5
+	FIELD_COUNT=6
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 4
+	Name=tunnelnif
+	Tier=Link.TierTable.271064565
+	MCpr=MCprTable.6
+	Cpr=CprTable.6
+	SCpr=SCprTable.3
+	Protocol=ProtocolTable.6
+	FIELD_COUNT=6
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 5
+	Name=qosppp
+	Tier=Link.TierTable.271064565
+	MCpr=MCprTable.7
+	Cpr=CprTable.3
+	SCpr=SCprTable.5
+	Protocol=ProtocolTable.7
+	FIELD_COUNT=6
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 6
+	Name=dummynif
+	Tier=Link.TierTable.271064565
+	MCpr=MCprTable.8
+	Cpr=CprTable.3
+	SCpr=SCprTable.3
+	Protocol=ProtocolTable.8
+	FIELD_COUNT=6
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 7
+	Name=hungrynif
+	Tier=Link.TierTable.271064565
+	MCpr=MCprTable.9
+	Cpr=CprTable.3
+	SCpr=SCprTable.3
+	Protocol=ProtocolTable.9
+	FIELD_COUNT=6
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 8
+	Name=spud-ppp
+	Tier=Link.TierTable.271064565
+	MCpr=MCprTable.10
+	Cpr=CprTable.3
+	SCpr=SCprTable.4
+	Protocol=ProtocolTable.3
+	FIELD_COUNT=6
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 9
+	Name=spud-rawip
+	Tier=Link.TierTable.271064565
+	MCpr=MCprTable.10
+	Cpr=CprTable.3
+	SCpr=SCprTable.4
+	Protocol=ProtocolTable.5
+	FIELD_COUNT=6
+END_ADD
+
+##This record here is the template record for the IPProto level APs generated by CommsDat.
+ADD_SECTION
+# COMMDB_ID = 10
+	##This name is a predefined name for the template for the IPProto APs.
+	##Please don't change it!
+	Name=IPProtoDefaultTemplate
+	Tier=Link.TierTable.271064560
+	MCpr=MCprTable.2
+	Cpr=CprTable.2
+	SCpr=SCprTable.2
+	Protocol=ProtocolTable.2
+	FIELD_COUNT=6
+END_ADD
+
+##This record here is the template record for the Network level AP generated by CommsDat.
+##It's used when processing SNAP config files
+ADD_SECTION
+# COMMDB_ID = 11
+    ##This name is a predefined name for the template for the Network APs.
+	##Please don't change it!
+	Name=NetworkDefaultTemplate
+	Tier=Link.TierTable.2048
+	MCpr=MCprTable.1
+	Cpr=CprTable.1
+	SCpr=SCprTable.1
+	Protocol=ProtocolTable.1
+	FIELD_COUNT=6
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 12
+	Name=wlannif
+	Tier=Link.TierTable.271064565
+	MCpr=MCprTable.12
+	Cpr=CprTable.3
+	SCpr=SCprTable.3
+	Protocol=ProtocolTable.11
+	FIELD_COUNT=6
+END_ADD
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/access_point_engine_misc_api/access_point_engine_misc_api.metaxml	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,18 @@
+<?xml version="1.0" ?>
+<api id="7b5f383134e4f9cbc68be65994b580cb" dataversion="1.0">
+  <name>Access Point Engine Misc API</name>
+  <description>Some complementary features can be used by this API, such as management of protected access points, VPN Access Points.</description>
+  <type>c++</type>
+  <subsystem>networkingutilities</subsystem>
+  <libs>
+    <lib name="apengine.lib" />
+  </libs>
+  <release category="domain" deprecatedsince="3.2"/>
+  <attributes>
+     <!-- This indicates wether the api provedes separate html documentation -->
+     <!-- or is the additional documentation generated from headers. -->
+     <!-- If you are unsuere then the value is "no" -->
+     <htmldocprovided>yes</htmldocprovided>
+     <adaptation>no</adaptation>
+  </attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/access_point_engine_misc_api/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,29 @@
+/*
+* 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:  File that exports the files belonging to 
+:                Access Point Engine Misc API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/VpnAPEngine.h     MW_LAYER_PLATFORM_EXPORT_PATH(VpnApEngine.h)
+../inc/VpnAPItem.h     MW_LAYER_PLATFORM_EXPORT_PATH(VpnApItem.h)
+../inc/ApProtHandler.h     MW_LAYER_PLATFORM_EXPORT_PATH(ApProtHandler.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/access_point_engine_misc_api/inc/ApProtHandler.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,239 @@
+/*
+* Copyright (c) 2002 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 the CApProtHandler class.
+*
+*/
+
+
+#ifndef CAPPROTHANDLER_H
+#define CAPPROTHANDLER_H
+
+// Deprecation warning
+#warning This header file has been deprecated. Will be removed in one of the next SDK releases.
+ 
+ 
+//  INCLUDES
+#include <e32base.h>
+#include <ApEngineVer.h>
+
+
+
+
+// FORWARD DECLARATION
+class CCommsDatabase;
+class CCommsDbTableView;
+
+// CLASS DECLARATION
+/**
+*  A collection of access point protection handling routines.
+*/
+NONSHARABLE_CLASS( CApProtHandler )
+    {
+    public:  // New functions
+
+        /**
+        * Returns whether the Access Point Table is protected or not.
+        * If the table is protected, new access points can not be added,
+        * existing ones can not be modified and can not be deleted.
+        * @param aDb The database object
+        * @return TBool indicating whether the table is protected or not.
+        *
+        * @deprecated
+        */
+        IMPORT_C static TBool IsTableProtectedL( CCommsDatabase* aDb );
+
+
+        /**
+        * Returns whether the given Access Point is protected or not.
+        * If the access point is protected, it can not be modified and
+        * can not be deleted.
+        * @param aDb    The database object
+        * @param aUid   The uid of the access point
+        * @return TBool indicating whether the access point is protected or not
+        *
+        * @deprecated
+        */
+        IMPORT_C static TBool IsApProtectedL( CCommsDatabase* aDb,
+                                             TUint32 aUid );
+
+
+        /**
+        * Sets a given Access Point to protected.
+        * If the access point is protected, it can not be modified and
+        * can not be deleted.
+        * @param aDb    The database object
+        * @param aUid   The uid of the access point
+        *
+        * @deprecated
+        */
+        IMPORT_C static void ProtectItemL( CCommsDatabase* aDb, TUint32 aUid );
+
+
+        /**
+        * Sets a given Access Point to not-protected.
+        * If the access point is not protected, it can be modified and
+        * can be deleted.
+        * @param aDb    The database object
+        * @param aUid   The uid of the access point
+        *
+        * @deprecated
+        */
+        IMPORT_C static void UnprotectItemL( CCommsDatabase* aDb, 
+                                             TUint32 aUid );
+
+        /**
+        * Sets the access point table to protected.
+        * If the table is protected, new access points can not be added,
+        * existing ones can not be modified and can not be deleted.
+        * @param aDb    The database object
+        *
+        * @deprecated
+        */
+        IMPORT_C static void ProtectTableL( CCommsDatabase* aDb );
+
+
+        /**
+        * Sets the access point table to not-protected.
+        * If the table is not protected, new access points can be added,
+        * existing ones can be modified and can be deleted.
+        * @param aDb    The database object
+        *
+        * @deprecated
+        */
+        IMPORT_C static void UnprotectTableL( CCommsDatabase* aDb );
+
+
+        /**
+        * Gets whether the preferences are protected or not
+        * @param aDb    The database object
+        * @returns TBool indicating whether the preferences are protected
+        * or not
+        *
+        * @deprecated
+        */
+        IMPORT_C static TBool IsPreferencesProtectedL( CCommsDatabase* aDb );
+
+
+        /**
+        * Sets the preferences to protected.
+        * @param aDb    The database object
+        *
+        * @deprecated
+        */
+        IMPORT_C static void ProtectPreferencesL( CCommsDatabase* aDb );
+
+
+        /**
+        * Sets the preferences to not-protected.
+        * @param aDb    The database object
+        *
+        * @deprecated
+        */
+        IMPORT_C static void UnprotectPreferencesL( CCommsDatabase* aDb );
+
+
+        // The following are not exported, for internal use only!
+        /**
+        * Returns whether the given record in the given table
+        * is protected or not.
+        * If the record is protected, it can not be modified and
+        * can not be deleted.
+        * @param aDb The database object in use
+        * @param the table to use
+        * @param the uid of the record
+        * @return whether the given record in the given table
+        * is protected or not.
+        */
+        static TBool IsRecordProtectedL( CCommsDatabase* aDb,
+                                    const TDesC& aTable, TUint32 aUid );
+
+        /**
+        * Protects a given record in a given table.
+        * @param aDb The database object in use
+        * @param the table to use
+        * @param the uid of the record
+        */
+        static void ProtectRecordL( CCommsDatabase* aDb,
+                                 const TDesC& aTable, TUint32 aUid );
+
+
+        /**
+        * Unprotects a given record in a given table.
+        * @param aDb The database object in use
+        * @param the table to use
+        * @param the uid of the record
+        */
+        static void UnprotectRecordL( CCommsDatabase* aDb,
+                                    const TDesC& aTable, TUint32 aUid );
+
+
+        /**
+        * Returns whether the given table in a given database is
+        * protected or not.
+        * @param aDb The database object in use
+        * @param the table we need the info on
+        * @returns TBool indicating whether the given table in a given
+        * database is protected or not.
+        */
+        static TBool IsTableProtectedL( CCommsDatabase* aDb,
+                                        const TDesC& aTable );
+
+
+        /**
+        * Protects a given table in a given database.
+        * @param aDb    The database object in use
+        * @param aTable The table to protect
+        */
+        static void ProtectTableL( CCommsDatabase* aDb, const TDesC& aTable );
+
+        /**
+        * Unprotects a given table in a given database.
+        * @param aDb The database object in use
+        * @param aTable The table to unprotect
+        */
+        static void UnprotectTableL( CCommsDatabase* aDb,
+                                     const TDesC& aTable );
+
+        /**
+        * Gets the current records' protection state
+        * aTable MUST be open and record cursor set to desired record
+        * @param aTable The table containign the record whose protection 
+        * sate we would like to get
+        * @return The records' protection state
+        */
+        static TBool GetProtectionStateL( CCommsDbTableView& aTable );
+
+
+
+        /**
+        * Remove all protected AP-s and sets the table to be 'updatable'.
+        * @param aDb The database object in use
+        *
+        * @deprecated
+        */
+        IMPORT_C static void RemoveProtectedAccessPointsL(CCommsDatabase* aDb);
+
+
+        /**
+        * Remove all protected AP-s and sets the table to be 'updatable'.
+        * @param aDb The database object in use
+        */
+        static void DoRemoveProtectedAccessPointsL( CCommsDatabase& aDb );
+    
+
+    };
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/access_point_engine_misc_api/inc/VpnAPEngine.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,360 @@
+/*
+* Copyright (c) 2002 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: 
+*     Declares the main handler, CVpnAPEngine and the public API for 
+*     the Vpn Access Point Engine.
+*
+*/
+
+
+#ifndef VPN_AP_ENGINE_H
+#define VPN_AP_ENGINE_H
+
+// Deprecation warning
+#warning This header file has been deprecated. Will be removed in one of the next SDK releases.
+ 
+ 
+// INCLUDES
+#include    <e32base.h>
+
+// CONSTANTS
+
+
+// FORWARD DECLARATIONS
+class CCommsDatabase;
+class CVpnApItem;
+
+// CLASS DECLARATION
+/**
+* CVpnApEngine class: It is the main handler for the VPN Access Point Engine.
+* It contains the only public API for other (sub)systems.
+*
+*/
+NONSHARABLE_CLASS( CVpnApEngine ) : public CBase
+    {
+
+    public: // Constructors and destructor
+
+
+        /**
+        * Two-phased constructor. Leaves on failure.
+        * This function shall be used to create the VPN access point engine
+        * object. This object is a thin layer above the VpnApEngine which 
+        * uses Access Point Engine (ApEngine) and it provides a 
+        * simple interface to the VPN ApEngine enabling creation, deletion 
+        * and editing of VPN access points.
+        * @param aDb a pointer to a CCommsDataBase object, might be NULL
+        * @return The constructed CVpnApEngine object.
+        *
+        * @deprecated
+        */
+        IMPORT_C static CVpnApEngine* NewLC( CCommsDatabase* aDb = NULL );
+
+
+
+        /**
+        * Destructor.
+        *
+        * @deprecated
+        */
+        IMPORT_C ~CVpnApEngine( );
+
+
+
+    protected:
+        /**
+        * Second-phase constructor.
+        * @param aDb The database
+        *
+        * @deprecated
+        */
+        IMPORT_C void ConstructL( CCommsDatabase* aDb );
+
+
+    private:
+        /**
+        * Constructor.
+        *
+        * @deprecated
+        */
+        IMPORT_C CVpnApEngine( );
+
+
+    public: // New functions
+
+        /**
+        * Creates a new VPN from the passed CVpnApItem
+        * @param aVpnApItem a CVpnApItem holding the data
+        * @return The WAP ID of the succesfully created VPN AP.
+        *
+        * @deprecated
+        */
+        IMPORT_C TUint32 CreateVpnApL( CVpnApItem& aVpnApItem );
+
+
+        /**
+        * Creates a new VPN from the passed VPN data
+        * @param aName The name of the access point.
+        * @param aIapId A TUint32 holding the real internet access point ID
+        * @param aPolicy a TDesC& Holding the policy for the VPN
+        * @param aProxyServerAddress a TDesC* holding the proxy server address
+        * @param aProxyPort A TUint32 specifying the proxy's port number
+        * @return The created VPN access point's WAP ID
+        *
+        * @deprecated
+        */
+        IMPORT_C TUint32 CreateVpnApL( TDesC& aName, 
+                                       TUint32 aIapId, 
+                                       TDesC& aPolicy, 
+                                       TDesC* aProxyServerAddress = NULL, 
+                                       TUint32 aProxyPort = 0 );
+
+
+        /**
+        * Deletes the VPN access poitn indentified by it's WAP ID
+        * @param aVpnApId A TUint32 The WAP ID of the vpn access point to be 
+        *   deleted
+        * Might Leave on error.
+        *
+        * @deprecated
+        */
+        IMPORT_C void DeleteVpnL( TUint32 aVpnApId );
+
+
+
+        /**
+        * Reads up one VPN access point's data from the database.
+        * Expects that CVpnApEngine has been created and the database had
+        * been opened.
+        * In case of error, function leaves with error code.
+        * <br>Error conditions:
+        *   - Insufficient memory,
+        *   - AP does not exists,
+        *   - Server connection failure.
+        *
+        * @param aUid The WAP Uid of the VPN access point to be read
+        * @param aApItem A reference to a CApAccessPointItem to hold the data.
+        * @return no return value.
+        *
+        * @deprecated
+        */
+        IMPORT_C void VpnDataL( TUint32 aUid, CVpnApItem& aVpnApItem );
+
+
+
+        // update
+        /**
+        * Updates data stored in an existing VPN access point.
+        * Expects that CVpnApEngine has been created and the database had
+        * been opened.
+        * In case of error, no data is stored.
+        * <br>Error conditions:
+        *   - Insufficient memory
+        *   - Server connection failure
+        *   - Lock already present by other task
+        *   - Uid does not exists.
+        *   - Attempting to update read-only records will result
+        *     in KErrAccessDenied
+        *
+        * @param aApItem A reference to a CApAccessPointItem holding the data
+        * @return No return value.
+        *
+        * @deprecated
+        */
+        IMPORT_C void UpdateVpnDataL( CVpnApItem& aVpnApItem );
+
+
+        /**
+        * Gives whether the access point identified by the passed WAP ID
+        * is a VPN access point or not.
+        * @param aUid The UID of the access point
+        *
+        * @deprecated
+        */
+        IMPORT_C TBool IsVpnApL( const TUint32 aUid );
+
+
+        /**
+        * Component Validation Test.
+        * @return KErrNone.
+        *
+        * @deprecated
+        */
+        IMPORT_C static TInt Cvt();
+
+
+    protected:  // New functions
+        /**
+        * Creates a new VPN from the passed VPN item
+        * @param aIsNew Booleasn stating whether it is a new AP or not
+        * @param aVpnApItem A CVpnApItem holding the VPN access point data
+        * @return The created VPN access point's WAP ID
+        */
+        TUint32 DoCreateVpnApL( TBool aIsNew, CVpnApItem& aVpnApItem );
+        
+        
+        /**
+        * Writes the VPN data part from the passed VPN item
+        * @param aIsNew Booleasn stating whether it is a new AP or not
+        * @param aVpnApItem A CVpnApItem holding the VPN access point data
+        */
+        void WriteVpnDataL( TBool aIsNew, CVpnApItem& aVpnApItem );
+
+
+        /**
+        * Creates a virtual bearer record if needed
+        * @return The virtual bearer record ID
+        */
+        TUint32 CreateVirtBearerIfNeededL();
+
+
+        /**
+        * Writes the VPN-IAP data part from the passed VPN item
+        * @param aIsNew Booleasn stating whether it is a new AP or not
+        * @param aVpnApItem A CVpnApItem holding the VPN access point data
+        * @return The IAP ID for the VPN part
+        */
+        TUint32 WriteVpnIapRecordL( TBool aIsNew, CVpnApItem& aVpnApItem );
+
+
+        /**
+        * Gets the location record ID
+        * @return The ID of the location record 
+        */
+        TUint32 GetLocationIdL();
+
+
+        /**
+        * Writes the VPN-WAP data part from the passed VPN item
+        * @param aIsNew Booleasn stating whether it is a new AP or not
+        * @param aVpnApItem A CVpnApItem holding the VPN access point data
+        */
+        void    WriteVpnWapApDataL( TBool aIsNew, CVpnApItem& aVpnApItem );
+
+
+        /**
+        * Writes the VPN-WAP bearer data part from the passed VPN item
+        * @param aIsNew Booleasn stating whether it is a new AP or not
+        * @param aVpnApItem A CVpnApItem holding the VPN access point data
+        */
+        void    WriteVpnWapBearerDataL( TBool aIsNew, CVpnApItem& aVpnApItem );
+
+
+        /**
+        * Reads up the VPN-WAP bearer data part into the passed VPN item
+        * @param aUid The WAP-bearer part's record ID
+        * @param aVpnApItem A CVpnApItem to hold the readed data
+        */
+        void    ReadVpnWapBearerDataL( TUint32 aUid, CVpnApItem& aVpnApItem );
+
+
+        /**
+        * Reads up the VPN-WAP data part into the passed VPN item
+        * The WAP record ID should already been set by an earlier call to
+        * ReadVpnWapBearerDataL
+        * @param aVpnApItem A CVpnApItem to hold the readed data
+        */
+        void    ReadVpnWapApDataL( CVpnApItem& aVpnApItem );
+
+
+        /**
+        * Reads up the VPN-IAP data part into the passed VPN item
+        * The IAP record ID should already been set by an earlier call to
+        * ReadVpnWapApDataL
+        * @param aVpnApItem A CVpnApItem to hold the readed data
+        */
+        void    ReadVpnIapRecordL( CVpnApItem& aVpnApItem );
+
+
+        /**
+        * Reads up the VPN data part into the passed VPN item
+        * The VPN record ID should already been set by an earlier call to
+        * ReadVpnIapRecordL
+        * @param aVpnApItem A CVpnApItem to hold the readed data
+        */
+        void    ReadVpnDataL( CVpnApItem& aVpnApItem );
+
+
+        /**
+        * Writes the proxy data of the passed VPN access point item 
+        * @param aIsNew Boolean stating whether the access point is new
+        * @param aVpnApItem A CVpnApItem holding the current VPN data
+        */
+        void    WriteProxyDataL( TBool aIsNew, const CVpnApItem& aVpnApItem );
+
+
+        /**
+        * Reads the proxy data into the passed VPN access point item 
+        * @param aVpnApItem A CVpnApItem holding the current VPN data
+        */
+        void    ReadProxyDataL( CVpnApItem& aVpnApItem );
+
+
+        /**
+        * Deletes the VPN proxy data
+        * @param aIspId The Isp record ID for which the proxy data should be
+        * deleted 
+        */
+        void    RemoveVpnProxyDataL( TUint32 aIspId );
+
+
+        /**
+        * Deletes the VPN data
+        * @param aUid The UID of the VPN access point to be deleted.
+        */
+        void    DoDeleteVpnL( TUint32 aUid );
+
+
+
+        /**
+        * Removes a record from a table
+        * @param aTable The table to remove from
+        * @param aUid   The record ID to remove
+        */
+        void    RemoveRecordL( const TDesC& aTable, TUint32 aUid );
+
+
+        /**
+        * Writes the network data of the passed VPN access point item 
+        * @param aIsNew Boolean stating whether the access point is new
+        * @param aVpnApItem A CVpnApItem holding the current network data
+        */
+        void    WriteNetworkDataL( TBool aIsNew, CVpnApItem& aVpnApItem );
+
+
+        /**
+        * Reads up the network data into the passed VPN access point item
+        * @param aVpnApItem A CVpnApItem holding the current VPN data
+        */
+        void    ReadNetworkDataL( CVpnApItem& aVpnApItem );
+
+
+        /**
+        * Removes a network data
+        * @param aIspId The Network record ID which should be deleted
+        */
+        void    RemoveNetworkDataL( TUint32 aIspId );
+
+
+    protected:  // Functions from base classes
+
+
+    private: //data 
+        TBool               iOwnDb;
+        CCommsDatabase*     iDb;
+    };
+
+#endif 
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/access_point_engine_misc_api/inc/VpnAPItem.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,352 @@
+/*
+* Copyright (c) 2002 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: 
+*     Declares the main handler, CVpnAPItem and the API for 
+*     the Vpn Access Point Engine.
+*
+*/
+
+
+#ifndef VPN_AP_ITEM_H
+#define VPN_AP_ITEM_H
+
+// Deprecation warning
+#warning This header file has been deprecated. Will be removed in one of the next SDK releases.
+ 
+ 
+// INCLUDES
+#include    <e32base.h>
+
+// CONSTANTS
+enum TVpnApMember
+    {
+    // WAP Access Point Table
+    EApVpnWapAccessPointID,         ///< The Uid of the VPN access point.
+                                    ///< READ ONLY, assigned by the database.
+                                    ///< TUint32
+    EApVpnWapAccessPointName,       ///< The name of the access point, TDesC16
+
+    EApVpnRealWapID,                ///< WAP ID of the real IAP ap, TUint32
+    EApVpnIapID,                    ///< IAP ID of the VPN IAP record, TUint32
+    EApVpnRealIapID,                ///< IAP ID of the real IAP record used
+                                    ///< to create connection, TUint32
+    EApVpnRealIapName,              ///< IAP name of the real IAP record used
+                                    ///< to create connection, Text
+    EApVpnPolicy,                   ///< The VPN policy to be used, TDesC16
+    EApVpnPolicyId,                 ///< The VPN policy to be used, TDesC16
+    EApVpnProxyServerAddress,       ///< Proxy server address, long text
+    EApVpnProxyPortNumber,          ///< Proxy port number,  TUint32
+
+    EApVpnHomeNetworkID,            ///< The ID of the home netwokr, TUint32
+    EApVpnIapNetworkID,             ///< The ID of the home netwokr, TUint32
+    EApVpnIapNetworkName,           ///< The name of the home netwokr, TDesC16
+    };
+
+
+
+
+
+// FORWARD DECLARATIONS
+class CCommsDatabase;
+
+// CLASS DECLARATION
+/**
+* This class encapsulates VPN related data in addition to a 'normal' 
+* access point. It provides Get/Set methods for every member.
+* Member set is not limited by the API.
+* It is used to read-write VPN data to and form CommsDb.
+* Main user is CVpnApEngine class but also UI might use this one.
+*/
+NONSHARABLE_CLASS( CVpnApItem ) : public CBase
+    { // holds VPN specific data
+
+    public:  // Constructors and destructor
+        /**
+        * Two-phased constructor. Leaves on failure, places instance
+        * on cleanup stack. Instance is initialised to default values.
+        * @return The constructed CApAccessPointItem.
+        *
+        * @deprecated
+        */
+        IMPORT_C static CVpnApItem* NewLC();
+
+
+        /**
+        * Destructor.
+        *
+        * @deprecated
+        */
+        IMPORT_C virtual ~CVpnApItem();
+
+        
+    protected:      // Constructors
+
+        /**
+        * Second-phase constructor.
+        *
+        * @deprecated
+        */
+        IMPORT_C void ConstructL();
+
+
+    private:    // Data
+        /**
+        * C++ default constructor.
+        *
+        * @deprecated
+        */
+        IMPORT_C CVpnApItem();
+
+
+
+    public:  // other public, exported functions
+        /**
+        * Copies the data from another CVpnApItem.
+        * Substitute for the "assignment operator". It requires allocation
+        * thus can leave.
+        * Wap Access Point Uid is not copied.
+        *
+        * @deprecated
+        */
+        IMPORT_C void CopyFromL( const CVpnApItem& aCopyFrom  );
+
+
+        /**
+        * Equality operator. Wap Access Point Uid is not counted.
+        *
+        * @deprecated
+        */
+        IMPORT_C TBool operator==( const CVpnApItem& aitem ) const;
+
+
+        /**
+        * Inequality operator. Wap Access Point Uid is not counted.
+        *
+        * @deprecated
+        */
+        IMPORT_C TBool operator!=( const CVpnApItem& aitem ) const;
+
+
+
+        /**
+        * This function reads up a 16-bit text value from the specified column.
+        * @param aColumn Enum value indicating the column to read.
+        * @param aValue Reference to a 16-bit descriptor to hold the value
+        * @return no return value
+        *
+        * @deprecated
+        */
+        IMPORT_C void ReadTextL( const TVpnApMember aColumn, TDes16& aValue );
+
+
+        /**
+        * This function reads up a long text value from the specified column.
+        * The ownership is not passed to the caller. It means that the caller
+        * should not delete the received value.
+        * If the caller must take the ownership for any reason, must make a
+        * copy and use that and delete the copy when no longer needed.
+        * @param aColumn Enum value indicating the column to read.
+        * @return A const HBufC* to the value.
+        *
+        * @deprecated
+        */
+        IMPORT_C const HBufC* ReadConstLongTextL( const TVpnApMember aColumn );
+
+
+        /**
+        * This function reads up a TUint32 value from the specified column.
+        * If the specified column does not exist (that is, not part of the
+        * database structure), it will Panic in debug builds and it will
+        * return KErrInvalidColumn in release builds without Panicking.
+        * Panic is used in debug builds because it indicates a programming
+        * error. In release, it 'notifies' the caller about the error through
+        * the return value but enables system to continue operation.
+        * @param aColumn Enum value indicating the column to read.
+        * @param aValue A reference to a TUint32 to hold the value
+        * @return Error code.
+        *
+        * @deprecated
+        */
+        IMPORT_C TInt ReadUint( const TVpnApMember aColumn, TUint32& aValue );
+
+        /**
+        * This function reads up a boolean value from the specified column.
+        * If the specified column does not exist (that is, not part of the
+        * database structure), it will Panic in debug builds and it will
+        * return KErrInvalidColumn in release builds without Panicking.
+        * Panic is used in debug builds because it indicates a programming
+        * error. In release, it 'notifies' the caller about the error through
+        * the return value but enables system to continue operation.
+        * @param aColumn Enum value indicating the column to read.
+        * @param aValue A reference to a boolean to hold the value
+        * @return Error code.
+        *
+        * @deprecated
+        */
+        IMPORT_C TInt ReadBool( const TVpnApMember aColumn, TBool& aValue );
+
+
+
+        /**
+        * This function writes a 16-bit text value to the specified column.
+        * If the specified column does not exist (that is, not part of the
+        * database structure), it will Panic in debug builds and it will
+        * return KErrInvalidColumn in release builds without Panicking.
+        * Panic is used in debug builds because it indicates a programming
+        * error. In release, it 'notifies' the caller about the error through
+        * the return value but enables system to continue operation.
+        * This function can Leave if the copying of the text does not succeed.
+        * @param aColumn Enum value indicating the column to write.
+        * @param aValue Reference to a 16-bit text descriptor to the value
+        * @return Error code.
+        *
+        * @deprecated
+        */
+        IMPORT_C TInt WriteTextL( const TVpnApMember aColumn,
+                                  const TDesC16& aValue );
+
+
+
+        /**
+        * This function writes a long text value to the specified column.
+        * If the specified column does not exist (that is, not part of the
+        * database structure), it will Panic in debug builds and it will
+        * return KErrInvalidColumn in release builds without Panicking.
+        * Panic is used in debug builds because it indicates a programming
+        * error. In release, it 'notifies' the caller about the error through
+        * the return value but enables system to continue operation.
+        * This function can Leave if the copying of the text does not succeed.
+        * @param aColumn Enum value indicating the column to write.
+        * @param aValue Reference to a 16-bit text descriptor to the value
+        * @return Error code.
+        *
+        * @deprecated
+        */
+        IMPORT_C TInt WriteLongTextL( const TVpnApMember aColumn,
+                                      const TDesC& aValue );
+
+
+        /**
+        * This function writes a TUint32 value to the specified column.
+        * If the specified column does not exist (that is, not part of the
+        * database structure), it will Panic in debug builds and it will
+        * return KErrInvalidColumn in release builds without Panicking.
+        * Panic is used in debug builds because it indicates a programming
+        * error. In release, it 'notifies' the caller about the error through
+        * the return value but enables system to continue operation.
+        * @param aColumn Enum value indicating the column to write.
+        * @param aValue A const reference to a TUint32 value
+        * @return Error code.
+        *
+        * @deprecated
+        */
+        IMPORT_C TInt WriteUint( const TVpnApMember aColumn,
+                                 const TUint32& aValue );
+
+        /**
+        * This function writes a boolean value to the specified column.
+        * If the specified column does not exist (that is, not part of the
+        * database structure), it will Panic in debug builds and it will
+        * return KErrInvalidColumn in release builds without Panicking.
+        * Panic is used in debug builds because it indicates a programming
+        * error. In release, it 'notifies' the caller about the error through
+        * the return value but enables system to continue operation.
+        * @param aColumn Enum value indicating the column to write.
+        * @param aValue A const reference to a boolean value
+        * @return Error code.
+        *
+        * @deprecated
+        */
+        IMPORT_C TInt WriteBool( const TVpnApMember aColumn,
+                                 const TBool& aValue );
+
+
+
+        // Query
+        // COMMON
+        /**
+        * This function returns the ID of the access point
+        * @return The ID of this access point
+        *
+        * @deprecated
+        */
+        IMPORT_C TUint32 WapUid() const;
+
+
+        /**
+        * This function returns the name of the connection
+        * Ownership is not passed.
+        * @return The name of the connection
+        *
+        * @deprecated
+        */
+        IMPORT_C const TDesC& Name() const;
+
+protected:
+        /**
+        * Reallocates a passed 16-bit descriptor. Passed descriptor is deleted,
+        * new one is AllocL-ed
+        * Passed descriptor MUST NOT BE on the CleanupStack
+        */
+        void ReAllocL(HBufC*& aDes, const TDesC16& aValue);
+
+        
+        /**
+        * Removes invalid chars from the passed text
+        * Invalid chars are: TAB
+        * @return a HBufC16 holding the new text
+        */
+        HBufC* RemoveInvalidCharsLC( const TDesC16& aInText );
+
+
+        /**
+        * Returns whether this VPN access point has proxy data or not.
+        * 
+        */
+        TBool HasProxy() const;
+
+private:    // Data
+
+
+        HBufC*      iName;
+        TUint32     iVpnTableId;
+        TUint32     iVpnIapId;
+        TUint32     iRealIapId;
+
+        TUint32     iVpnRealWapId;
+        TUint32     iVpnWapId;
+
+        TUint32     iVirtualBearerID;
+
+        HBufC*      iPolicyId;
+
+        HBufC*      iPolicy;
+        HBufC*      iProxyServerAddress;
+        HBufC*      iRealIapName;
+        TUint32     iProxyPort;
+        TUint32     iHomeNetwork;
+        TUint32     iVpnIapNetwork;
+        HBufC*      iVpnIapNetworkName;
+
+
+    protected:  // Friend classes
+        friend class CVpnApEngine;
+
+    };
+
+
+
+#endif 
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/bearer_settings_plugin_api/bearer_settings_plugin_api.metaxml	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,17 @@
+<?xml version="1.0" ?>
+<api id="fafd5605d046874f18b6027d5fc32cad" dataversion="1.0">
+  <name>Bearer Settings Plugin API</name>
+  <description>The bearer plug-in interface of Connection Method Manager for extending the framework with new bearer specific ecom plug-ins.</description>
+  <type>c++</type>
+  <subsystem>networkingutilities</subsystem>
+  <libs>
+  </libs>
+  <release category="domain"/>
+  <attributes>
+     <!-- This indicates wether the api provedes separate html documentation -->
+     <!-- or is the additional documentation generated from headers. -->
+     <!-- If you are unsuere then the value is "no" -->
+     <htmldocprovided>yes</htmldocprovided>
+     <adaptation>no</adaptation>
+  </attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/bearer_settings_plugin_api/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,36 @@
+/*
+* 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:  File that exports the files belonging to 
+:                Bearer Settings Plugin API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/cmpbasesettingsdlgip.h     MW_LAYER_PLATFORM_EXPORT_PATH(cmpbasesettingsdlgip.h)
+../inc/cmpluginlanbase.h     MW_LAYER_PLATFORM_EXPORT_PATH(cmpluginlanbase.h)
+../inc/cmpbasesettingsdlgadv.h     MW_LAYER_PLATFORM_EXPORT_PATH(cmpbasesettingsdlgadv.h)
+../inc/cmpluginlandef.h     MW_LAYER_PLATFORM_EXPORT_PATH(cmpluginlandef.h)
+../inc/cmcommonconstants.h     MW_LAYER_PLATFORM_EXPORT_PATH(cmcommonconstants.h)
+../inc/cmpluginbaseeng.h     MW_LAYER_PLATFORM_EXPORT_PATH(cmpluginbaseeng.h)
+../inc/cmpluginbase.h     MW_LAYER_PLATFORM_EXPORT_PATH(cmpluginbase.h)
+../inc/cmpluginlanbasedef.h     MW_LAYER_PLATFORM_EXPORT_PATH(cmpluginlanbasedef.h)
+../inc/cmpbasesettingsdlg.h     MW_LAYER_PLATFORM_EXPORT_PATH(cmpbasesettingsdlg.h)
+../inc/mcmdexec.h     MW_LAYER_PLATFORM_EXPORT_PATH(mcmdexec.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/bearer_settings_plugin_api/inc/cmcommonconstants.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,82 @@
+/*
+* 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:  Common constants, enumerations are declared here
+*
+*/
+
+#ifndef CMCOMMONCONSTANTS_H
+#define CMCOMMONCONSTANTS_H
+
+// UID of general settings app, in which help texts are included
+const TUid KHelpUidPlugin = { 0x100058EC };
+
+// Array granularities
+const TInt KCmArraySingularGranularity = 1;
+const TInt KCmArraySmallGranularity     = 2;
+const TInt KCmArrayMediumGranularity    = 5;
+const TInt KCmArrayBigGranularity       = 10;
+const TInt KCmMaxPasswordLength         = 50;
+
+// For destination selection type dialogs
+const TUint32 KDestMaxId = 0xff;
+const TUint32 KDestItemNewConnection = 0x100;
+const TUint32 KDestItemUncategorized = 0x101;
+const TUint32 KDestItemEasyWlan      = 0x102;
+const TUint32 KDestItemAlwaysAsk     = 0x103;
+const TUint32 KDestItemAskOnce       = 0x104;
+const TUint32 KDestItemDefaultConnection = 0x105;
+
+const TInt KDestinationNameMaxLength = 30;
+const TInt KConnMethodNameMaxLength = 30;
+
+const TInt KDestReservedIconIndexNewConn = 0;
+const TInt KDestReservedIconIndexProtected = 1;
+const TInt KDestReservedIconIndexUncategorized = 2;
+const TInt KDestReservedIconIndexDefaultConn = 3;
+const TInt KDestReservedIconIndexCount = 4;//always modify if you add one
+
+const TInt KCmReservedIconIndexProtected = 0;
+const TInt KCmReservedIconIndexDefaultConn = 1;
+const TInt KCmReservedIconIndexCount = 2;
+
+_LIT( KManagerIconFilename, "z:cmmanager.mbm" );
+_LIT( KACMManagerResDirAndFileName, "z:cmmanager.rsc" );
+
+const TInt KDialogUserBack = 0;
+const TInt KDialogUserExit = 1;
+const TInt KDialogUserDelete = 2;
+const TInt KDialogUserDeleteConfirmed = 3;
+
+// ENUMERATIONS
+enum TCmPanicCodes
+    {
+    ECmNullPointer,
+    ECmWrongBearerType
+    };
+
+// UI constants
+// 3 chars are reserved for the icon index, plus one for the '\t' char
+const TInt KNumberOfStaticCharsIn1LineFormattedString = 4;
+// 3 chars are reserved for the icon index, plus two for the '\t' chars
+const TInt KNumberOfStaticCharsIn2LineFormattedString = 5;
+_LIT( KSingleNumberAsString, "%d" );
+
+const TUint32 KSettingsListBoxItemPrefix = '\t';
+
+_LIT( KSettingsListBoxItemPostfix, "\t\t" );
+_LIT( KTxtCompulsory, "\t*" );
+_LIT( KCmNewLine, "\n" );
+
+
+#endif // CMCOMMONCONSTANTS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/bearer_settings_plugin_api/inc/cmmanager.loc	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,1056 @@
+/*
+* 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 file.
+*
+*/
+
+//  LOCALISATION STRINGS
+
+//============================================================================
+// GENERAL SETTINGS VIEW
+//============================================================================
+//d: Network destinations setting item under General Settings/Connection Settings
+//l: list_single_large_graphic_pane_t1_cp2
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_network_connections "Network destinations"
+
+//=============================================================================
+//  DESTINATION VIEW
+//=============================================================================
+
+//-----------------------------------------------------------------------------
+// Options Menu Items
+//-----------------------------------------------------------------------------
+
+//d: Options menu text. Edit the highlighted item, used for destination and 
+//d: connection methods views
+//l: list_single_pane_t1_cp2
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_options_edit    "Edit"
+
+//d: Options menu text. Opens a submenu to manage the highlighted destination
+//l: list_single_pane_t1_cp2
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_options_manage_destination    "Manage"
+
+//d: Options menu text. Opens a radio button page to select default conneciton
+//l: list_single_pane_t1_cp2
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_options_default_connection "Default Connection"
+
+//d: Options menu text, subitem of Manage. Adds a new destination
+//l: list_single_popup_submenu_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_options_add_destination    "Add destination"
+
+//d:Options menu text, subitem of Manage
+//l: list_single_popup_submenu_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_options_rename_destination    "Rename destination"
+
+//d:Options menu text, subitem of Manage
+//l: list_single_popup_submenu_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_options_change_dest_icon    "Change icon"
+
+//d:Options menu text, subitem of Manage
+//l: list_single_popup_submenu_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_options_delete_destination    "Delete destination"
+
+
+//d: Destination name query prompt text 
+//l: popup_query_data_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_prmpt_destination_name "Destination name: "
+
+//d: Title text for destination icon selection dialog.
+//l: heading_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_prmpt_select_icon "Select an icon:"
+
+
+//d: Connection method name query prompt text 
+//l: popup_query_data_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_prmpt_method_name "Connection method name:"
+
+//d: Connection method delete query text 
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_quest_delete_method "Delete connection method ’%U’?"
+
+//d: Connection method delete info text 
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_info_cannot_delete_protected_method "Unable to delete protected connection method"
+
+//d: Connection method delete info text 
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_info_cannot_delete_method_in_use "Connection method currently in use. Unable to delete."
+
+//d: Destination delete query text 
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_quest_delete_destination "Delete destination ’%U’ and associated connection methods?"
+
+//d: Destination delete info text
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_info_cannot_delete_dest_in_use "Destination currently in use. Unable to delete."
+
+//d: Note to indicate the the selected connection method cannot be currently edited as it is being used
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_set_note_ap_in_use_edit "Connection method is currently in use. Unable to edit."
+
+//d: Destination delete info text
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_info_cannot_delete_dest_protected  "Unable to delete protected destination"
+
+//d: Destination name info text, shown when destination name already exists
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_info_name_already_in_use  "Name ’%U’ already in use"
+
+//d: Embedded Destination delete query text
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_quest_delete_embedded_dest  "Link cannot be restored by user. Delete anyway?"
+
+//d: Common text used to indicate that a destination or connection method
+//d: cannot be edited if it is protected
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_info_cannot_edit_protected  "Unable to edit protected settings"
+
+//-----------------------------------------------------------------------------
+// List Items
+//-----------------------------------------------------------------------------
+
+//d: The name of a new, default connection. Max.30 chars, 
+//d: longer ones will be truncated.
+//l: list_double_large_graphic_pane_t1_cp2
+//w:
+//r: 3.2
+//
+#define qtn_netw_conset_add_connection "Add connection"
+
+//d: The group of legacy access points
+//l: list_double_large_graphic_pane_t1_cp2
+//w:
+//r: 3.2
+//
+#define qtn_netw_conset_dest_uncategorized "Uncategorized"
+
+//d: Destination list text. The second line for qtn_netw_conset_add_connection 
+//d: Indicates that selecting the item will start the UI for adding a
+//d: a connection method
+//l: list_double_large_graphic_pane_t2_cp2
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_add_connection_method "New connection method"
+
+//d: Destination list text, notes the number of connections methods
+//d: belonging to the destination
+//l: list_double_large_graphic_pane_t2_cp2
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_conn_methods_amount_many    "%N connection methods"
+
+//d: Destination list text. Notes that the destination has one 
+//d: connection method
+//l: list_double_large_graphic_pane_t2_cp2
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_conn_methods_amount_one      "1 connection method"
+
+//d: Destination list text. Notes that the destination is empty
+//l: list_double_large_graphic_pane_t2_cp2
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_conn_methods_amount_none      "No connection methods"
+
+//-----------------------------------------------------------------------------
+// Status Pane
+//-----------------------------------------------------------------------------
+
+//d: Destination list title text
+//l: title_pane_t2/opt9
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_network_connections_title "Network destinations"
+
+//d: Destination list text. Shows the number of configured destinations in the 
+//d: navi pane
+//l: navi_text_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_navi_nof_destinations "%N destinations defined"
+
+//d: Destination list text. Shows the number of configured destinations in the 
+//d: navi pane
+//l: navi_text_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_navi_one_destination "1 destination defined"
+
+//d: Destination list text. Shows the default connection in the 
+//d: navi pane
+//l: navi_text_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_navi_default "Default: %U"
+
+//=============================================================================
+//  CONNECTION METHOD VIEW
+//=============================================================================
+
+//-----------------------------------------------------------------------------
+// Options Menu Items
+//-----------------------------------------------------------------------------
+
+//d: Connection method list text. Starts a wizard for adding a 
+//d: new connection method
+//l: list_single_pane_t1_cp2
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_options_add_method "Add connection method"
+
+//d: Connection method list text. Renames the highlighted connection methof
+//l: list_single_pane_t1_cp2
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_options_rename_method "Rename"
+
+//d: Connection method list text. Deletes the highlighted connection method
+//l: list_single_pane_t1_cp2
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_options_delete_method "Delete"
+
+//d: Connection method list text. Opens a submenu for managing the highlighted
+//d: connection method
+//l: list_single_pane_t1_cp2/opt3
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_options_organise "Organise"
+
+//d:Connection method list text. Prioritise the highlighted connecton method
+//l: list_single_popup_submenu_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_options_prioritise "Prioritise"
+
+//d: Connection method list text. Moves the highlighted connection method
+//d: to a selected target destination
+//l: list_single_popup_submenu_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_options_move_to_dest "Move to other destination"
+
+//d: Connection method list text. Copies the highlighted connection method
+//d: to a selected target destination
+//l: list_single_popup_submenu_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_options_copy_to_dest "Copy to other destination"
+
+//-----------------------------------------------------------------------------
+// List Items
+//-----------------------------------------------------------------------------
+
+//d: Connection method list text. Indicates the priority of the 
+//d: connection method
+//l: list_double_graphic_pane_t2
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_method_priority_other "Priority %N connection method "
+
+//d: Connection method list text. The name of an embedded destination
+//l: list_double_graphic_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_embedded_dest "Link to '%U'"
+
+//d: Connection method list popup note. Text shown in a toolip (info popup)
+//d: which is prefixed to the Bearer type of the highlighted connection method
+//l: popup_preview_text_window_t1
+//w:
+//r:3.2
+//
+#define qtn_netw_conset_popup_title_data_bearer "Data Bearer: "
+
+//d: Connection method list popup note. WLAN Bearer type shown in info popup
+//l: popup_preview_text_window_t1
+//w:
+//r: 3.2
+//
+#define qtn_netw_conset_popup_bearer_wlan "Wireless LAN"
+
+//d: Connection method list popup note. 
+//d: Packet Data Bearer type shown in info popup
+//l: popup_preview_text_window_t1
+//w:
+//r: 3.2
+//
+#define qtn_netw_conset_popup_bearer_packet_data "Packet data"
+
+//d: Connection method list popup note. 
+//d: Data call Bearer type shown in info popup
+//l: popup_preview_text_window_t1
+//w:
+//r: 3.2
+//
+#define qtn_netw_conset_popup_bearer_csd "Data call"
+
+//d: Connection method list popup note. 
+//d: High speed GSM  Data Bearer type shown in info popup
+//l: popup_preview_text_window_t1
+//w:
+//r: 3.2
+//
+#define qtn_netw_conset_popup_bearer_hscsd "High-speed GSM"
+
+//d: Connection method list empty text. 
+//d: Shown if there are no connection methods
+//l: main_pane_empty_t1/opt2
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_empty_method_view_primary "No connection methods"
+
+
+//d: Connection method list empty text. Second line in the list item if
+//d: no connection methods exist. Indicates how to create one.
+//l: main_list_empty_pane/opt2
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_empty_method_view_secondary "Select Add connection method from Options menu to define a method "
+
+//d: radio button popup menu title text
+//l: list_setting_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_sett_destination "Network connection"
+
+//d: radio button popup menu title text
+//l: list_set_graphic_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_sett_always_ask "Always ask"
+
+
+//d: radio button popup menu title text
+//l: list_setting_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_default_connection_title "Default connection"
+
+//d: radio button popup menu text
+//l: list_set_graphic_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_sett_ask_once "Ask Once"
+
+//d: radio button popup menu text
+//l: list_set_graphic_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_sett_default_connection "Default Connection"
+
+//d: radio button popup menu text
+//l: list_set_graphic_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_sett_user_defined "User Defined"
+
+//d: radio button popup options menu text
+//l: list_single_pane_t1_cp2
+//w: 
+//r: 3.2
+//
+#define qtn_set_cmd_select "Select"
+
+//d: popup options menu text
+//l: list_single_pane_t1_cp2
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_options_select_method "Choose connection method"
+
+//d: First line of a double large graphic style listbox - WLAN specific
+//l: list_double_large_graphic_pane_t1_cp2
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_bearer_available_wlan "Wireless LAN"
+
+//d: Second line of a double large graphic style listbox - WLAN specific
+//l: list_double_large_graphic_pane_t2_cp2
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_one_wlan_nw_available "1 network available"
+
+//d: Second line of a double large graphic style listbox - WLAN specific
+//l: list_double_large_graphic_pane_t2_cp2
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_many_wlan_nw_available "%N networks available"
+
+//-----------------------------------------------------------------------------
+// Status Pane
+//-----------------------------------------------------------------------------
+
+//d: Connection method view. Indicates that there is one connection method 
+//d: in the current destination
+//l: navi_text_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_navi_one_conn_method "1 conn. method"
+
+//d: Connection method view. Indicates the number of connection methods 
+//d: in the current destination
+//l: navi_text_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_navi_many_conn_methods "%N conn. methods"
+
+//-----------------------------------------------------------------------------
+// Soft Keys
+//-----------------------------------------------------------------------------
+
+//d: Middle soft key whose action is to start the wizard for adding 
+//d: a connection method from the connection method view
+//d: 
+//l: control_pane_t3/opt7
+//w: 
+//r: 3.2
+//
+#define qtn_msk_add_method "Add method"
+
+//-----------------------------------------------------------------------------
+// Strings used in dialogs
+//-----------------------------------------------------------------------------
+
+//d: Confirmation query used to ask the user if he/she wants to check for
+//d: available connection methods automatically.
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_quest_check_conn_methods "Automatically check for available connection methods?"
+
+//d: String used to inform user what is going on while the dialog is displayed.
+//l: popup_note_wait_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_wait_checking_methods "Checking connection methods..."
+
+//d: Question asked from the user when automatic configuration has failed. User
+//d: must answer if he/she wants to proceed with manual configuration.
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_quest_conf_method_manually "Could not automatically detect availability. Do you want to configure manually?"
+
+//d: Title of "Available methods:" list query.
+//l: heading_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_prmpt_available_methods "Available methods:"
+
+//d: Title of "Select connection method:" list query.
+//l: heading_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_prmpt_select_conn_method "Select connection method:"
+
+//d: Title of "Select destination:" list query.
+//l: heading_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_prmpt_add_to_destination "Select destination:"
+
+//d: Heading text used in "Select destination:" list query.
+//l: loc_type_pane
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_detail_add_to_destination "What destination or service you want to access via this method?"
+
+//d: Text of an information note used to ensure the user the a new connection
+//d: method has been added successfully.
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_conf_new_method_added "New connection method for '%U' added"
+
+//d: Text of an information note used to ensure the user the a new destination
+//d: has been created successfully.
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_conf_new_dest_added "New destination '%U' created"
+
+//d: Confirmation query text shown when user enters empty Conn methods view.
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_quest_add_method "No connection methods for '%U' defined. Define one now?"
+
+//d: Warning about having no destinations in Destinations view when trying to
+//d: create a new connection method.
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_info_no_destinations "No destinations defined. Create one first."
+
+//d: Warning about having no unprotected destinations in Destinations view when trying to
+//d: create a new connection method.
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_new_conset_info_cannot_add_all_dest_protected "Unable to add to any existing destination. All destinations are protected. Create a new one."
+
+//d: Warning shown when user tries to prioritise a conn. method 'over' an embedded destination
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_info_prio_not_possible "Priority not possible"
+
+
+//d: Text of an information note used to ensure the user the a new default destination
+//d: has been set successfully.
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+
+#define qtn_netw_conset_default_connection_set_to "Default connection set to '%U'"
+
+
+//=============================================================================
+// FRAMEWORK BASE STRINGS
+//=============================================================================
+
+//d: The name of a Internet destination. Max.30 chars, 
+//d: longer ones will be truncated.
+//l: list_double_large_graphic_pane_t1_cp2
+//w:
+//r: 3.2
+//
+#define qtn_netw_conset_dest_internet "Internet"
+
+//d: The name of a "WAP services" destination. Max.30 chars, 
+//d: longer ones will be truncated.
+//l: list_double_large_graphic_pane_t1_cp2
+//w:
+//r: 3.2
+//
+#define qtn_netw_conset_dest_wap "WAP services"
+
+//d: The name of a "Multimedia message" destination. Max.30 chars, 
+//d: longer ones will be truncated.
+//l: list_double_large_graphic_pane_t1_cp2
+//w:
+//r: 3.2
+//
+#define qtn_netw_conset_dest_mms "Multimedia message"
+
+//=============================================================================
+// PLUGIN BASE STRINGS
+//=============================================================================
+
+//d: Item text in setting list.
+//d: The name of the connection
+//l: list_setting_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_set_ap_conn_name "Connection name"
+
+//d: Name of the data bearer.
+//d: Used in Connection method view.
+//l: list_setting_pane_t1
+//w:
+//r: 3.2
+//
+#define qtn_set_ap_bearer "Data bearer"
+
+//d: Command in options menu in access points view.
+//d: Modifies the currently selected access point.
+//l: list_single_pane_t1_cp2
+//w:
+//r: 3.2
+//
+#define qtn_set_options_change "Change"
+
+
+//d: Command in options menu in access points view.
+//d: Opens advanced settings for the access point.
+//l: list_single_pane_t1_cp2
+//w:
+//r: 3.2
+//
+#define qtn_set_options_ap_advanced "Advanced settings"
+
+//d: Command in options menu.
+//d: Opens help application with context sensitive help.
+//l: list_single_pane_t1_cp2
+//w:
+//r: 3.2
+//
+#define qtn_set_options_help "Help"
+
+
+//d: Command in options menu.
+//d: Exits access point settings.
+//l: list_single_pane_t1_cp2
+//w:
+//r: 3.2
+//
+#define qtn_set_options_exit "Exit"
+
+
+//d: Setting list item text.
+//l: list_setting_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_sett_roaming_confirmation "Utilise this method"
+
+//d: Setting list item text shown if automatic roaming is selected.
+//l: list_set_graphic_pane_t1
+//w: 
+//r: 3.2
+//
+
+#define qtn_netw_conset_sett_roaming_automatic "Automatically"
+
+//d: Setting list item text shown if confirmation takes place upon roaming.
+//l: list_set_graphic_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_sett_roaming_confirm "After confirmation"
+
+//d: Bearer type cannot be modified info text 
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_info_bearer_not_editable "Unable to edit data bearer type once selected. Define a new connection method."
+
+//d:Item text in setting list for password.
+//l:list_setting_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_set_ap_passwd "Password"
+
+//
+//SMTP Settings
+ 
+//d: Setting list item text to access smtp settings.
+//l: list_double2_pane
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_sett_smtp_override "Outgoing mail server settings"
+
+//d: SMTP outgoing mail server setting text
+//l: list_setting_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_mce_settings_mail_sending_h "Outgoing mail server"
+
+//d: Error note for when invalid server/IP data is input
+//d: in relation to the Outgoing mail server setting
+//l: ??
+//w: 
+//r: 3.2
+//
+#define qtn_mbxs_settings_mail_srvr_prompt "Please, insert proper server name."
+
+//d: SMTP User name setting text
+//l: list_setting_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_mce_settings_mail_user_name "User name"
+
+//d: SMTP Password setting text
+//l: list_setting_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_mce_settings_mail_password "Password"
+
+//d: SMTP Security setting text
+//l: list_setting_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_mce_settings_mail_security "Security"
+
+//d: Security setting is set to 'on' with Start TLS
+//l: list_set_graphic_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_mbxs_settings_mail_sec_starttls "STARTTLS"
+
+//d: Security setting is set to 'on' with SSL TLS
+//l: list_set_graphic_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_mbxs_settings_mail_sec_ssltls "SSL/TLS"
+
+//d: Security setting set to 'off'
+//l: list_set_graphic_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_mbxs_settings_mail_sec_off "Off"
+
+//d: SMTP Port number setting text
+//l: list_setting_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_mce_settings_mail_port "Port"
+
+//d: SMTP Port number setting to 'default'
+//l: list_set_graphic_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_mbxs_settings_mail_port_def "Default"
+
+//d: SMTP Port number setting to 'User defined'
+//l: list_set_graphic_pane_t1
+//w: 
+//r: 3.2
+//
+#define qtn_mbxs_settings_mail_port_userdef "User defined"
+
+//d: Note after the last legacy IAP from "Uncategorized" group
+//d: is deleted
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_info_uncat_empty "Uncategorized folder is empty and will be removed"
+
+//d: The name of a new, default connection. Max.30 chars, 
+//d: longer ones will be truncated.
+//l: list_set_graphic_pane_t1
+//w:
+//r: 3.2
+//
+#define qtn_set_ap_default_name "Connection"
+
+//d: Error message when user wants to delete a connection method that is 
+//d: linked to a virtual connection method.
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_info_cannot_delete_virtual_ref "Unable to delete referenced method"
+
+//d: Item text in setting list.
+//l: list_setting_pane_t1
+//w:
+//r: 3.2
+//
+#define qtn_set_starting_page "Homepage"
+
+//d: Connection method list text
+//l: list_set_graphic_pane_t1
+//w:
+//r: 3.2
+//
+#define qtn_set_home_page_none "None"
+
+//d: Invalid ip address note text
+//l: popup_note_window
+//w:
+//r: 3.2
+//
+#define qtn_set_info_invalid_ip "Invalid IP address"
+
+//d: Connection method settings query text 
+//d: displayed when there are empty compulsory settings 
+//d: and user presses 'back' from settings view 
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_quest_iap_incomplete_delete "Incomplete access point details. Exit without saving?"
+
+//d:Domain name servers 'User defined'
+//l:list_set_graphic_pane_t1
+//w:
+//r:3.2
+#define qtn_set_ip_user_defined "User defined"
+
+//d:Item text in setting list. Offers IPv4 settings to be changed
+//l:list_setting_pane_t1
+//w:
+//r:3.2
+//
+#define  qtn_set_ipv4_settings "IPv4 settings"
+
+//d:Item text in setting list. Offers IPv6 settings to be changed
+//l:list_setting_pane_t1
+//w:
+//r:3.2
+//
+#define  qtn_set_ipv6_settings "IPv6 settings"
+
+//d:Item text in setting list. "Phone IP address"
+//l:list_setting_pane_t1 
+//w:
+//r:3.2
+//
+#define qtn_set_ip_address "Phone IP address"
+
+//d:Default value for "Phone ip address" item. 'Automatic'
+//l:list_set_graphic_pane_t1
+//w:
+//r:3.2
+#define qtn_set_ip_address_dynamic "Automatic"
+
+//d:Item text in setting list.
+//l:list_setting_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_set_primary_dns "Primary Name Server"
+
+//d:Item text in setting list.
+//l:list_setting_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_set_secondary_dns "Secondary Name Server"
+
+//d:Item text in setting list. "Proxy server address"
+//l:list_setting_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_set_proxy_server_address "Proxy server address"
+
+//d: Proxy server address 'None'
+//l: list_set_graphic_pane_t1
+//w:
+//r: 3.2
+//
+#define qtn_set_proxy_server_address_none "None"
+
+//d: Item text in setting list  for Proxy port number
+//l:list_setting_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_set_proxy_port_number "Proxy port number"
+
+//d:Item text in setting list. Entrance for the Domain name servers settings
+//l:list_setting_pane_t1
+//w:
+//r:3.2
+//
+#define  qtn_set_dns_servers_ip "Domain name servers"
+
+//d:Domain name servers 'Automatic'
+//l:list_set_graphic_pane_t1
+//w:
+//r:3.2
+#define qtn_set_dns_servers_automatic "Automatic"
+
+//d:Domain name servers 'Well-known'
+//l:list_set_graphic_pane_t1
+//w:
+//r:3.2
+#define qtn_set_ip_well_known "Well-known"
+
+//d: Item text in setting list. "User name"
+//l: list_set_graphic_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_set_ap_username "User name"
+
+//d: Answer to: qtn_set_passwd_aut,
+//d: whether password authentication is secure or normal
+//l: list_set_graphic_pane_t1
+//w:
+//r: 3.2
+//
+#define qtn_set_passwd_aut_secure "Secure"
+
+//d: Answer to: qtn_set_passwd_aut,
+//d: whether password authentication is secure or normal
+//l: list_set_graphic_pane_t1
+//w:
+//r: 3.2
+//
+#define qtn_set_passwd_aut_normal "Normal"
+
+//d: Item text for empty user name in setting list
+//l: list_set_graphic_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_set_ap_username_none "None"
+
+//d: Item text in setting list. "Prompt password"
+//l: list_setting_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_set_prompt_passwd "Prompt password"
+
+//d: Item text in setting list for not prompting for password.
+//l: list_set_graphic_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_set_prompt_passwd_no "No"
+
+//d: Item text in setting list for prompting for password.
+//l: list_set_graphic_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_set_prompt_passwd_yes "Yes"
+
+//d: Item text in setting list.
+//d: Indicates whther password authentication is secure or normal
+//l: list_setting_pane_t1
+//w:
+//r: 3.2
+//
+#define qtn_set_passwd_aut "Authentication"
+
+//d:Defines the WLAN subnet mask to be used
+//l:list_setting_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_netw_sett_subnet_mask "Subnet mask"
+
+//d:Defines the WLAN default gateway to be used
+//l:list_setting_pane_t1
+//w:
+//r:3.2
+//
+#define qtn_netw_sett_default_gateway "Default gateway"
+
+//d: Error note when user tries to delete a destination 
+//d: which contains one or more protected connection methods
+//l: popup_note_window
+//w: 
+//r: 3.2
+//
+#define qtn_netw_conset_info_cannot_delete_dest_prot_cm "Unable to delete destination; contains protected connection methods."
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/bearer_settings_plugin_api/inc/cmpbasesettingsdlg.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,400 @@
+/*
+* 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:  Declares dialog for access point view/edit.
+*
+*/
+
+#ifndef CMPLUGINBASE_SETTINGS_DLG_H
+#define CMPLUGINBASE_SETTINGS_DLG_H
+
+// INCLUDES
+#include <eiklbo.h>
+#include <aknlists.h>
+#include <AknDialog.h>
+#include <coneresloader.h>
+#include <cmcommonconstants.h>
+#include <cmconnectionmethoddef.h>
+
+#include <coehelp.h>
+
+// FORWARD DECLARATIONS
+class CCmPluginBaseEng;
+class CEikStatusPane;
+class CAknTitlePane;
+class CAknNavigationControlContainer;
+class CAknNavigationDecorator;
+class CAknSettingPage;
+class CCmdExec;
+class MCmdExec;
+
+/**
+ *  CmPluginBaseSettingsDlg dialog class.
+ *  Base class for plugin settings dialogs.
+ *  @lib cmmanager.lib
+ *  @since S60 v3.2
+ */
+class CmPluginBaseSettingsDlg : public CAknDialog, 
+                                public MEikListBoxObserver,
+                                public MCmdExec
+    {
+
+    public: // Constructors and destructor
+
+        /* C++ Constructor */
+        IMPORT_C CmPluginBaseSettingsDlg( 
+                                        CCmPluginBaseEng& aCmPluginBaseEng );
+
+        /**
+        * Create and launch dialog.        
+        * @since S60 3.2
+        * @return The code returned by the dialog's ExecuteLD
+        */
+        IMPORT_C TInt ConstructAndRunLD( );
+
+        /* Destructor. */
+        IMPORT_C  ~CmPluginBaseSettingsDlg();
+
+    public: // from MEikCommandObserver
+
+        IMPORT_C  virtual void ProcessCommandL( TInt aCommandId );
+
+    public: // From CCoeControl
+    
+        /**
+        * Returns the help context
+        * From CCoeControl
+        * 
+        * @since S60 3.2
+        * @param aContext the returned help context
+        */
+        IMPORT_C void GetHelpContext( TCoeHelpContext& aContext ) const;
+
+         // New functions - API
+
+        IMPORT_C  virtual void InitTextsL();
+
+        IMPORT_C  void HandleListboxDataChangeL( );
+
+        /**
+        * Updates bearer specific listbox contents.         
+        * @since S60 3.2
+        * @param aItemArray The listbox's item array containing the setting 
+        * texts
+        */
+        virtual void UpdateListBoxContentBearerSpecificL( 
+                                               CDesCArray& aItemArray ) = 0;
+
+        /**
+        * Runs the Advanced settings dialog 
+        * @since S60 3.2
+        */
+        virtual void RunAdvancedSettingsL() = 0;
+        
+    protected:
+
+        /** From CEikDialog */
+        IMPORT_C virtual void PreLayoutDynInitL();
+
+        /** From CAknDialog */
+        IMPORT_C TBool OkToExitL( TInt aButtonId );
+
+        /** From MEikMenuObserver */
+        IMPORT_C virtual void DynInitMenuPaneL( TInt aResourceId, 
+                                             CEikMenuPane* aMenuPane ) ;
+
+        /** From MEikListBoxObserver */
+        IMPORT_C void HandleListBoxEventL( CEikListBox* aListBox, 
+                                        TListBoxEvent aEventType );
+                                               
+        /**
+        * Updates Setting items in the listbox (setting names and values are
+        * refreshed).
+        * @since S60 3.2
+        */                                 
+        IMPORT_C virtual void UpdateListBoxContentL();
+        
+        /**
+        * Shows the setting page for a certain setting.        
+        * @since S60 3.2
+        * @param aAttribute The setting to be changed by the setting page
+        * @param aCommandId The command the attribute is changed with 
+        * (ok/change key pressed)
+        */                                 
+        IMPORT_C virtual TBool ShowPopupSettingPageL( TUint32 aAttribute, 
+                                                       TInt aCommandId );
+            
+            
+        /**
+        * Adds the setting item text to the setting list array
+        * @since S60 3.2
+        * @param aItemArray an array of setting texts
+        * @param aSettingItemId the Id used to recognise a setting
+        * @param aValueResId the resource if for the setting value        
+        */
+        IMPORT_C void AppendSettingTextsL( CDesCArray& aItemArray,
+                                           const TInt aSettingItemId,
+                                           const TInt aValueResId );
+
+        /**
+        * Adds the setting item text to the setting list array
+        * @since S60 3.2
+        * @param aItemArray an array of setting texts
+        * @param aSettingItemId the Id used to recognise a setting
+        * @param aValueString the value of a setting
+        */
+        IMPORT_C void AppendSettingTextsL( CDesCArray& aItemArray,
+                                           const TInt aSettingItemId,
+                                           const HBufC* aValueString = NULL );
+
+        /**
+        * Adds the setting item text to the setting list array
+        * @since S60 3.2
+        * @param aItemArray an array of setting texts
+        * @param aSettingItemId the Id used to recognise a setting
+        * @param aTitleResId the resource if for the setting title 
+        * @param aValueResId the resource if for the setting value        
+        * @param aCompulsory indicates compulsory settings
+        */  
+        IMPORT_C void AppendSettingTextsL(   
+                                    CDesCArray& aItemArray,
+                                    const TInt aSettingItemId,
+                                    const TInt aTitleResId,
+                                    const TInt aValueResId,
+                                    const TBool aCompulsory = EFalse ) const;
+                                                                               
+        /**
+        * Adds the setting item text to the setting list array
+        * @since S60 3.2
+        * @param aItemArray an array of setting texts
+        * @param aSettingItemId the Id used to recognise a setting
+        * @param aTitleResId the resource if for the setting title 
+        * @param aValueString the value of a setting
+        * @param aCompulsory indicates compulsory settings
+        */  
+        IMPORT_C void AppendSettingTextsL(  
+                                    CDesCArray& aItemArray,
+                                    const TInt aSettingItemId,
+                                    const TInt aTitleResId,
+                                    const TDesC& aValueString,
+                                    const TBool aCompulsory = EFalse ) const;
+
+        /**
+        * Selects one item of the listbox.        
+        * @since S60 3.2
+        * @param aItemIndex The index of the item to be select.
+        */
+        IMPORT_C void SelectItem( TInt aItemIndex );        
+
+        /**
+        * Sets a string attribute in the settings listbox.
+        * @since S60 3.2
+        * @param aAttribute The attribute id to set.
+        * @param aDefRes The default string's resource to use.
+        * HBuf ownership is passed to the caller
+        */
+        IMPORT_C HBufC* StringAttributeWithDefaultL( TUint32 aAttribute,
+                                                  TUint32 aDefRes );  
+
+        /**
+        * Loads a resource file.
+        * @since S60 3.2
+        * @param aResFileName the resource file name.
+        */
+        IMPORT_C TInt LoadResourceL ( const TDesC& aResFileName );
+
+
+    public: // 'Show' functions
+    
+        /**
+        * Displays a Radio button setting page
+        * @since S60 3.2
+        * @param aResIds an array of item texts terminated with 0.
+        * @param aCurrentItem The currently selected item
+        * @param aTitleId The title of the setting page
+        * @return The code returned by the dialogs' ExecuteLD
+        */
+        IMPORT_C TInt ShowRadioButtonSettingPageL( const TUint32* aResIds,
+                                                   TInt& aCurrentItem,
+                                                   TUint32 aTitleId );
+
+        /**
+        * Displays a Radio button setting page
+        * @since S60 3.2
+        * @param aItems array of selection items
+        * @param aCurrentItem The currently selected item
+        * @param aTitleId The title of the setting page
+        * @return The code returned by the dialogs' ExecuteLD
+        */
+        IMPORT_C TInt ShowRadioButtonSettingPageL( 
+                                                CDesCArrayFlat& aItems, 
+                                                TInt& aCurrentItem,
+                                                TUint32 aTitleId );
+        /**
+        * Displays an IP setting page
+        * @param aAttribute the setting to be modified
+        * @param aTitleId The title of the setting page
+        * @return ETrue if changed
+        */
+        IMPORT_C TBool ShowPopupIpSettingPageL( TUint32 aAttribute,
+                                                TUint32 aTitleId = 0 );
+        
+        /**
+        * Shows a popup page for numeric settings
+        * @since S60 3.2
+        * @param aAttribute the setting to be modified
+        * @param aTitleId The title of the setting page
+        */
+        IMPORT_C TBool ShowPopupPortNumSettingPageL( 
+                                                TUint32 aAttribute,
+                                                TUint32 aTitleId = 0 );
+           
+        /*
+        * Shows a text based setting page for a specific setting
+        * @since S60 3.2
+        * @param aAttribute the setting to be modified
+        * @param aAttribute the setting
+        */
+        IMPORT_C TBool ShowPopupTextSettingPageL( TUint32 aAttribute,
+                                                  TUint32 aTitleId = 0 );
+        
+        /**
+        * Shows a popup page for password settings
+        * @since S60 3.2
+        * @param aAttribute the setting to be modified
+        * @param aTitleId The title of the setting page
+        * if NULL, default is used
+        */
+        IMPORT_C TBool ShowPopupPasswordSettingPageL( TUint32 aAttribute, 
+                                                      TUint32 aTitleId = 0 );
+          
+        /**
+        */                                            
+        IMPORT_C TBool ShowPopupIPv4DNSEditorL( TUint32 aDNSUsageAttribute,
+                                                TUint32 aPrimServAttribute,
+                                                TUint32 aSecServAttribute,
+                                                TUint32 aTitleId = 0 );
+
+        /**
+        */
+        IMPORT_C TInt ShowPopupIPv6DNSEditorL(
+                                            const TUint32* aSelectionItems,
+                                            TUint32 aDNSUsageAttribute,
+                                            TUint32 aDNS1ServAttribute,
+                                            TUint32 aDNS2ServAttribute );
+
+        /**
+        */
+        IMPORT_C TInt GetIPv6DNSTypeL( TUint32 aDNS1ServAttribute,
+                                             TUint32 aDNS2ServAttribute );
+        
+    public:
+        /**
+        * Handles the resource change
+        * From CCoeControl
+        * 
+        * @since S60 5.0
+        * @param aType Type of the resource change
+        */
+        IMPORT_C void HandleResourceChange( TInt aType );
+
+    private:
+
+        /**
+        * 
+        */
+        TUint32 TitleId( TUint32 aConvTitleId,
+                         TUint32 aTitleId ) const;
+        /**
+        */
+        void SetTitleL( CAknSettingPage* aDlg,
+                        TUint32 aConvTitleId,
+                        TUint32 aTitleId ) const;
+        
+        /**
+        *
+        */
+        TUint32 EditorId( TUint32 aConvEditorId,
+                          TUint32 aEditorId ) const;
+             
+        /**
+        * Tries to save the connection name. If it is not unique opens a dialog
+        * to notify the user and asks the name again.
+        */
+        void SetUniqueNameL( TPtr ptrTextToChange );
+                          
+    public:
+        /**
+         * From base class MCmdExec
+         */
+        IMPORT_C virtual void Execute();
+
+        /**
+         * From base class MCmdExec
+         */
+        IMPORT_C virtual void HandleLeaveError( TInt aError );
+
+    protected:
+
+		// None
+
+    protected: //data
+
+        TUint32*                        iUid;
+        CEikStatusPane*                 iStatusPane;    // NOT owned
+        CAknTitlePane*                  iTitlePane;     // NOT owned
+        CAknNavigationControlContainer* iNaviPane;      // NOT owned
+        CAknNavigationDecorator*        iNaviDecorator; // owned
+
+        HBufC*                          iOldTitleText;
+
+        CAknSettingStyleListBox*    iListbox;      // owned through resources,
+                                                   // destroyed automatically 
+                                                   // by the dialog
+
+        CDesCArrayFlat*         iItemArray;        // not owned
+
+        CCmPluginBaseEng&       iCmPluginBaseEng;  // not owned
+        CArrayFixFlat<TUint>*   iSettingIndex;     // OWNED    
+        TInt                    iExitReason;       // Exit reason, can be 
+                                                   // KUserExit or KUserBack
+                                                   // used to pass user exit 
+                                                   // event          
+        RConeResourceLoader     iResourceReader;
+
+        /**
+         * Contains the help context of the current settings view
+         */   
+        TCoeContextName         iHelpContext;
+
+    private:
+        // for the FeatureManager
+        TBool                   iHelp;
+
+    private:
+        // A flag to check if there is ongoing processing
+        TBool                   iProcessing;
+        
+        // An object to keep plugin object alive if e.g Exit started from UI
+        CCmdExec*               iCmdExec;
+
+    public:
+        // A flag to indicate if there is memory problem
+        TBool                   iIsPossibleToSaveSetting;
+
+        // A flag to indicate if setting has been changed by user
+        TBool                   iHasSettingChanged;
+        
+    };
+
+#endif // CMPLUGINBASE_SETTINGS_DLG_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/bearer_settings_plugin_api/inc/cmpbasesettingsdlgadv.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,77 @@
+/*
+* 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:  Declares dialog for access point view/edit.
+*
+*/
+
+#ifndef CMPLUGINBASEADV_SETTINGS_DLG_H
+#define CMPLUGINBASEADV_SETTINGS_DLG_H
+
+// INCLUDES
+#include <coecntrl.h>
+#include <coeccntx.h>
+#include <eiklbo.h>
+#include <eikapp.h>
+#include <eikdoc.h>
+#include <aknlists.h>
+#include <akndialog.h>
+#include <cmpbasesettingsdlg.h>
+
+// FORWARD DECLARATIONS
+class CEikStatusPane;
+class CAknTitlePane;
+class CAknNavigationControlContainer;
+class CAknNavigationDecorator;
+class CCmPluginBaseEng;
+
+/**
+ *  CmPluginBaseSettingsDlgAdv dialog class
+ *  base class for plugin settings dialogs
+ *  @lib cmmanager.lib
+ *  @since S60 v3.2
+ */
+class CmPluginBaseSettingsDlgAdv : public CmPluginBaseSettingsDlg 
+                                
+    {
+
+    public: // Constructors and destructor
+
+        /** Constructor */
+        IMPORT_C CmPluginBaseSettingsDlgAdv( 
+                                        CCmPluginBaseEng& aCmPluginBaseEng );
+
+        /** Destructor. */
+        IMPORT_C ~CmPluginBaseSettingsDlgAdv();
+    
+    public: // From CmPluginBaseSettingsDlg
+        
+        virtual void UpdateListBoxContentBearerSpecificL( 
+                                               CDesCArray& aItemArray );
+                                               
+        IMPORT_C virtual void RunAdvancedSettingsL();
+
+    public: // From MEikMenuObserver
+        
+        IMPORT_C virtual void DynInitMenuPaneL( TInt aResourceId, 
+                                                CEikMenuPane* aMenuPane ) ;
+
+    protected: // from CmPluginBaseSettingsDlg
+    
+        IMPORT_C virtual void UpdateListBoxContentL();
+
+
+        IMPORT_C virtual TBool ShowPopupSettingPageL( TInt aAttribute, 
+                                                       TInt aCommandId );
+    };
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/bearer_settings_plugin_api/inc/cmpbasesettingsdlgip.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,64 @@
+/*
+* 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:  Declares dialog for access point view/edit.
+*
+*/
+
+#ifndef CMPLUGINBASEIP_SETTINGS_DLG_H
+#define CMPLUGINBASEIP_SETTINGS_DLG_H
+
+// INCLUDES
+#include <cmpbasesettingsdlg.h>
+
+
+// FORWARD DECLARATIONS
+
+/**
+ *  CmPluginBaseSettingsDlgIP dialog class
+ *  base class for plugin IP settings dialogs
+ *
+ *  @lib cmmanager.lib
+ *  @since S60 3.2
+ */
+class CmPluginBaseSettingsDlgIp : public CmPluginBaseSettingsDlg 
+                                
+    {
+
+    public: // Constructors and destructor
+
+        /** Constructor */
+        IMPORT_C CmPluginBaseSettingsDlgIp( 
+                                        CCmPluginBaseEng& aCmPluginBaseEng );
+
+        /** Destructor. */
+        IMPORT_C ~CmPluginBaseSettingsDlgIp();
+    
+    public: // From CmPluginBaseSettingsDlg
+        
+        virtual void UpdateListBoxContentBearerSpecificL( 
+                                               CDesCArray& aItemArray );
+                                               
+        IMPORT_C virtual void RunAdvancedSettingsL();
+
+    public: // From MEikMenuObserver
+        
+        IMPORT_C virtual void DynInitMenuPaneL( TInt aResourceId, 
+                                                CEikMenuPane* aMenuPane ) ;
+
+    protected: // from CmPluginBaseSettingsDlg
+    
+        IMPORT_C virtual void UpdateListBoxContentL();
+
+    };
+#endif // CMPLUGINBASEIP_SETTINGS_DLG_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/bearer_settings_plugin_api/inc/cmpluginbase.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,704 @@
+/*
+* 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:  IF implementation class for connection method plugins.
+*
+*/
+
+#ifndef CMPLUGINBASE_H
+#define CMPLUGINBASE_H
+
+// INCLUDES
+#include <cmpluginbaseeng.h>
+
+/**
+ *  This class wraps the CCmPluginBaseEng class and is used instead of that 
+ *  in the framework and the 'R' classes. This way the CCmPluginBaseEng
+ *  class could remain in the object pool after the CCmPluginBase object is
+ *  deleted.
+ *
+ *  @lib cmmanager.lib
+ *  @since S60 v3.2
+ */
+class CCmPluginBase : public CBase
+    {
+    public:
+    
+    
+        /** Constructor */
+        IMPORT_C CCmPluginBase( CCmPluginBaseEng* plugin );
+        
+        /** Destructor. */
+        IMPORT_C ~CCmPluginBase();
+                        
+        /**
+        * Create a new instance of the given bearer type plugin.
+        * Used from framework to avoid using slow ECom framework.
+        * @param aInitParam initialization data
+        */
+        CCmPluginBase* 
+                CreateInstanceL( TCmPluginInitParam& aInitParam );
+                
+    public: // Attribute handlers
+    
+        /**
+        * Gets the value for a TInt attribute.
+        * @param aAttribute Identifies the attribute to be retrived.
+        * @return contains the requested TInt attribute.
+        */
+        IMPORT_C TUint32 
+                        GetIntAttributeL( const TUint32 aAttribute ) const;
+
+        /**
+        * Gets the value for a TBool attribute.
+        * @param aAttribute Identifies the attribute to be retrived.
+        * @return contains the requested TBool attribute.
+        */
+        IMPORT_C TBool 
+                        GetBoolAttributeL( const TUint32 aAttribute ) const;
+
+        /**
+        * Gets the value for a String16 attribute.
+        * @param aAttribute Identifies the attribute to be retrived.
+        * @return copy of the requested attribute. Ownership is passed.
+        */
+        IMPORT_C HBufC* 
+                        GetStringAttributeL( const TUint32 aAttribute ) const;
+        
+        /**
+        * Gets the value for a String8 attribute.
+        * @param aAttribute Identifies the attribute to be retrived.
+        * @return copy of the requested attribute. Ownership is passed.
+        */
+        IMPORT_C HBufC8* 
+                        GetString8AttributeL( const TUint32 aAttribute ) const;
+
+        /**
+        * Sets the value for a TInt attribute.
+        * @param aAttribute Identifies the attribute to be set.
+        * @param aValue The value to be set.
+        * @return None.
+        */
+        IMPORT_C void SetIntAttributeL( 
+                             const TUint32 aAttribute, TUint32 aValue );
+
+        /**
+        * Sets the value for a TBool attribute.
+        * @param aAttribute Identifies the attribute to be set.
+        * @param aValue The value to be set.
+        * @return None.
+        */
+        IMPORT_C void SetBoolAttributeL( 
+                             const TUint32 aAttribute, TBool aValue );
+
+        /**
+        * Sets the value for a String16 attribute.
+        * @param aAttribute Identifies the attribute to be set.
+        * @param aValue The value to be set.
+        * @return None.
+        */
+        IMPORT_C void SetStringAttributeL( 
+                             const TUint32 aAttribute, const TDesC16& aValue );
+
+        /**
+        * Sets the value for a String8 attribute.
+        * @param aAttribute Identifies the attribute to be set.
+        * @param aValue The value to be set.
+        * @return None.
+        */
+        IMPORT_C void SetString8AttributeL( 
+                             const TUint32 aAttribute, const TDesC8& aValue );
+
+        /**
+        * Restore the original value of the attribute from commsdat field.
+        * Base implementation can be used only with attributes 
+        * stored directly in commsdat.
+        * @param aAttribute attribute to be restored
+        */
+        IMPORT_C void RestoreAttributeL( const TUint32 aAttribute );
+        
+        /**
+        * Returns the CCmDestinationImpl* if this is an 
+        * embedded destination CM. Otherwise returns NULL.
+        * @return embedded destination object or NULL
+        */
+        IMPORT_C CCmDestinationImpl* Destination() const;
+        
+        /**
+        * Update or if this is a new CM, creates CM in CommsDat. 
+        * - OpenTransactionLC()
+        * - PrepareToUpdateRecordsL()
+        * - UpdateChargeCardRecordL()
+        * - UpdateServiceRecordL()
+        * - UpdateIAPRecordL()
+        *   - UpdateLocationRecordL()
+        *   - BearerRecordIdLC()
+        *   - UpdateNetworkRecordL()
+        *   - UpdateWapRecordL()
+        *   - UpdateProxyRecordL()
+        *   - UpdateConnPrefSettingL()
+        * - UpdateAdditionalRecordsL()
+        * - CommitTransactionL()
+        * @return None.
+        */        
+        IMPORT_C void UpdateL();     
+        
+        /*
+        * Delete from the database if this CM has no more reference
+        * from the DN_IAP table.
+        * - IsMultipleReferencedL()
+        * - OpenTransactionLC()
+        * - PrepareToDeleteL()
+        * - Delete records (in this order)
+        *   - IAP
+        *   - Proxy
+        *   - Service
+        *   - ChargeCard
+        *   - Network
+        *   - Location
+        *   - WapAP
+        *   - WapBearer
+        * - DeleteAdditionalRecordsL()
+        * - CommitTransactionL()
+        * @param aForced forced delete doesn't check referencies
+        * @param aOneRefsAllowed ETrue if one reference from a destination is 
+        *           acceptable to delete this connection method.
+        */    
+        IMPORT_C TBool DeleteL( TBool aForced,
+                                        TBool aOneRefAllowed = ETrue );
+
+        /**
+        * Performs the basic loading of records related
+        * to this connection method:
+        * - OpenTransactionLC();
+        * - PrepareToLoadRecordsL()
+        * - LoadIAPRecordL();
+        *       - load IAP
+        *       - load WAP (AP & IP Bearer)
+        *       - load proxy
+        *       - load charge card
+        *       - load network
+        *       - load location
+        * - LoadServiceSettingL();
+        * - LoadAdditionalRecordsL();
+        */
+        IMPORT_C void LoadL( TUint32 aIapId );
+
+        /**
+        * Reloads CM
+        */
+        void ReLoadL();
+
+        /**
+        * Create a new connection method in memory.
+        * Call UpdateL() to store it in CommsDat.
+        * No transaction operation is performed.
+        * - Creates new WAP, IAP, Network records
+        * - CreateNewServiceRecordL()
+        * - CreateAdditionalRecordsL()
+        * - Loads default AP name from resource 
+        *       (R_CMMANAGERENG_DEFAULT_AP_NAME)
+        */
+        IMPORT_C void CreateNewL();
+        
+        /**
+        * Create a copy of the connection method:
+        * - CreateInstanceL()
+        * - CreateNewL()
+        * - PrepareToCopyDataL()
+        * - Copies data:
+        *   - name
+        *   - bearer type
+        *   - records added to the convertion table
+        * - Calls CopyAdditionalDataL().
+        */
+        IMPORT_C CCmPluginBase* CreateCopyL() const;
+        
+        /*
+        * Returns true if the CM has more than one parent destination
+        */        
+        IMPORT_C TInt NumOfConnMethodReferencesL();
+
+    public:
+    
+        /**
+        * Returns a pointer to the cmmanager
+        * @return a pointer to the cmmanager
+        */
+        IMPORT_C CCmManagerImpl& CmMgr() const ;
+
+        IMPORT_C CCmPluginBaseEng* Plugin() const ;
+
+        IMPORT_C CommsDat::CMDBSession& Session() const;
+
+        /**
+        * Launches the settings dialog of the plugin
+        *
+        * @since S60 3.2
+        * @return soft key selection
+        */
+        TInt RunSettingsL();
+
+        /**
+        * Called on a newly created connection method to initialize it properly
+        * with user interaction (e.g. APN setting for a packet data-, WEP-key
+        * setting for a WLAN connection method, etc.).
+        * Note: each plug-in should set its name (i.e. ECmName) in this
+        * function call.
+        *
+        * @since S60 3.2
+        * @param aManuallyConfigure let's the plugin know if a plugin should 
+        *                           be configured manually or automatically
+        * @return ETrue if initialization was successful and wasn't cancelled.
+        * EFalse, if initialization process was cancelled (i.e. user pressed
+        * Cancel button).
+        */
+        TBool InitializeWithUiL( TBool aManuallyConfigure );
+        
+        /**
+        * Checks if the plug-in can handle the given AP.
+        * @param aIapId IAPId of the AP to be checked
+        * @return ETrue if plug-in can handle the IAP
+        */
+        TBool CanHandleIapIdL( TUint32 aIapId ) const;
+        
+        /**
+        * Checks if the plug-in can handle the given AP.
+        * @param aIapRecord IAP record to be checked
+        * @return ETrue if plug-in can handle the IAP
+        */
+        TBool CanHandleIapIdL( CommsDat::CCDIAPRecord* aIapRecord ) const;
+        
+        /**
+        * Return the parent destination of this connection method.
+        * @return parent destination of this connection method
+        */
+        IMPORT_C CCmDestinationImpl* ParentDestination() const ;
+        
+        /**
+        * Calls FeatureManager::FeatureSupported directly.
+        * @param aFeature feature ID
+        * @return feature support status
+        * @since 3.2
+        */
+        IMPORT_C static TBool FeatureSupported( TInt aFeature );
+                
+        /**
+        * Function should be overriden by bearer type plugins.
+        * Returns if the passed IAP id is linked to that connection method.
+        * @param aIapId IAP id to be checked
+        * @return ETrue if the passed IAP id is linked to that connection method.
+        */
+        IMPORT_C TBool IsLinkedToIap( TUint32 aIapId );
+        
+        /**
+        * Function should be overriden by bearer type plugins.
+        * Returns if the passed SNAP id is linked to that connection method.
+        * @param aSnapId SNAP id to be checked
+        * @return ETrue if the passed SNAP id is linked to that connection method.
+        */
+        IMPORT_C TBool IsLinkedToSnap( TUint32 aSnapId );
+
+        /**
+        * Increments the reference counter. Used by the object pool.
+        */
+        void IncrementRefCounter();
+        /**
+        * Increments the reference counter. Used by the object pool.
+        */
+        void DecrementRefCounter();
+        /**
+        * Returns the reference counter. Used by the object pool.
+        * @return TInt
+        */
+        TInt GetRefCounter();
+
+        /**
+        * Appends uids of connection methods - which were also created during connection method
+        * creation - to the array given as parameter 
+        * @param aIapIds the array the additonal cm uids are appended to
+        */        
+        IMPORT_C void GetAdditionalUids( RArray<TUint32>& aIapIds );
+
+    protected: // Conversion table API
+    
+        IMPORT_C void AddConverstionTableL( 
+                            CommsDat::CCDRecordBase* *aRecord,
+                            TBool* aEnabled,
+                            const TCmAttribConvTable* aConvTable );
+                                            
+        IMPORT_C void AddCommonConversionTableL( 
+                                const TCmCommonAttrConvArrayItem* aConvTable );
+        
+        IMPORT_C void RemoveConversionTable( 
+                                        const TCmAttribConvTable* aConvTable );
+        
+        IMPORT_C void RemoveCommonConversionTable( 
+                                const TCmCommonAttrConvArrayItem* aConvTable );
+                                   
+    protected: // Resource handling
+    
+        /**
+        * Add file name to the resource file array.
+        * Open it and/or increment reference count.
+        * @param aName resource file name
+        */
+        IMPORT_C void AddResourceFileL( const TDesC& aName );
+        
+        /**
+        * Remove file name from the resource file name array.
+        * Close the resource file and/or decrement the reference count.
+        * @param aName resource file name
+        */
+        IMPORT_C void RemoveResourceFile( const TDesC& aName );
+
+        /**
+        * Read string from resource file. Resource file has to be
+        * opened prior this by calling AddResourceFileL().
+        */
+        IMPORT_C HBufC* AllocReadL( TInt aResourceId ) const;
+        
+            
+    protected:
+        
+        /** Second phase constructor */
+        IMPORT_C void ConstructL();
+    
+        /** Open transaction */
+        void OpenTransactionLC();
+        
+        /**
+        * Commit transaction.
+        * @param aError - error id
+        */
+        void CommitTransactionL( TInt aError );
+        
+        /** Make a reset on this class. */
+        IMPORT_C void Reset();
+        
+        /**
+        * Plug-in implementation can make its on
+        * cleanup in this function. 
+        * Always called from LoadL() and 
+        * should be called from plugin's destructor.
+        */
+        void AdditionalReset();
+        
+        /**
+        * Check if there's connection established with
+        * this connection method (IAP id).
+        */
+        IMPORT_C TBool CheckIfAlreadyConnected() const;
+        
+    protected:  // loader function
+        
+        /**
+        * Inherited class can make some preraration
+        * before CCmPluginBaseEng would start loading
+        * records from tables.
+        */
+        IMPORT_C void PrepareToLoadRecordsL();
+
+        /**
+        * Inherited class can load any additional
+        * records after CCmPluginBaseEng finished.
+        */
+        void LoadAdditionalRecordsL();
+
+        /**
+        * Load service record. Default implementation can
+        * create only factory supported record instances.
+        */
+        IMPORT_C void LoadServiceSettingL();
+
+    protected:  // update functions
+    
+        /**
+        * Check if connection method data is valid, before
+        * it would be persisted to commsdat.
+        * If invalid data found, set its attribute id in
+        * iInvalidAttribute.
+        * Base class implementation must be called from
+        * overridden one.
+        */
+        IMPORT_C void PrepareToUpdateRecordsL();
+        
+        /**
+        * Inherited class can update its additional
+        * records here.
+        */
+        void UpdateAdditionalRecordsL();
+
+        /**
+        * Update service record.
+        */
+        IMPORT_C void UpdateServiceRecordL();
+
+        /**
+        * Return the service table name and record id 
+        * of this connection in the service table.
+        * @param - aServiceName name of the service table
+        *           this connection method points to.
+        * @param - aRecordId record id in the service table.
+        */
+        void ServiceRecordIdLC( HBufC* &aServiceName, 
+                                       TUint32& aRecordId );
+
+        /**
+        * Return the bearer table name and record id 
+        * of this connection in the bearer table.
+        * @param - aBearerName name of the bearer table
+        *           this connection method points to.
+        * @param - aRecordId record id in the bearer table.
+        */
+        void BearerRecordIdLC( HBufC* &aBearerName, 
+                                       TUint32& aRecordId );
+
+    protected:  // delete function
+    
+        /**
+        * Plugin can prepare to delete the connection method
+        * with this function. Called from DeleteL() before
+        * any record would be deleted. Do NOT delete any
+        * record here.
+        */
+        void PrepareToDeleteRecordsL();
+        
+        /**
+        * Plugin can delete additional, bearer specific record
+        * with this function. Called from DeleteL().
+        */
+        void DeleteAdditionalRecordsL();
+
+    protected:  // create function
+    
+        /**
+        * Plugin has to create and initialize its bearer specific object
+        * that points to the service record here. Pointer has to be stored in 
+        * iServiceRecord data member.
+        * Do NOT store service record in CommsDat yet.
+        */
+        void CreateNewServiceRecordL();
+        
+        /**
+        * Plugin can create and initialize its bearer specific record(s) here.
+        * Do NOT store them in CommsDat yet.
+        */
+        void CreateAdditionalRecordsL();
+        
+    protected:
+
+        /**
+        * Called from CreateCopyL().
+        * Plugin can prepare for copying every records
+        * added to the conversion tables.
+        *
+        * @param aDestInst copy attributes into this plugin instance
+        */
+        void PrepareToCopyDataL( CCmPluginBaseEng& aDestInst ) const;
+                
+        /**
+        * Copy data of the connection method that is not 
+        * added to the conversion table. (e.g. bearer specific
+        * flags)
+        *
+        * @param aDestInst copy attributes into this plugin instance
+        */    
+        void CopyAdditionalDataL( CCmPluginBaseEng& aDestInst ) const;
+
+    private:
+    
+        void EnableProxyL( TBool aEnable );
+        void EnableChargeCardL( TBool aEnable );
+        void EnableLocationL( TBool aEnable );
+
+        // Loader functions
+        void DoLoadL( TUint32 aIapId );
+        void LoadIAPRecordL( TUint32 aIapId );
+        void LoadChargeCardSettingL( TUint32 aChargeCardId );
+        void LoadProxySettingL();
+        void LoadNetworkSettingL();
+        void LoadLocationSettingL();
+        void LoadWapRecordL();
+        void LoadSeamlessnessRecordL();
+        
+        // Updater functions
+        void UpdateIAPRecordL();
+        void UpdateProxyRecordL();
+        void UpdateChargeCardRecordL();
+        void UpdateConnPrefSettingL();
+        void UpdateNetworkRecordL();
+        void UpdateLocationRecordL();
+        void UpdateWapRecordL();
+        void UpdateSeamlessnessRecordL();
+        
+        /**
+        * No WAP record found in load process,
+        * but client wants to set start page.
+        */
+        void NewWapRecordL();
+        
+        /**
+        * Create a new metadata record.
+        * @param aSetDef ETrue if setting default seamlessness valud is needed
+        * @return create metadata record point
+        */
+        CCDIAPMetadataRecord* NewSeamlessnessRecordL( TBool aSetDef );
+        
+        CommsDat::CCDWAPIPBearerRecord* FindWAPRecordL();
+        CCDIAPMetadataRecord* FindSeamlessnessRecordL();
+
+        /**
+        * Set attribute flag on the given record
+        * @param aRecord record to be set
+        * @param aAttribute e.g. ECDHidden
+        * @param aSet ETrue to set, EFalse to clear
+        */
+        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 );
+
+        /**
+        * Find field element associated with the passed attribute.
+        * @param aAttribute aatribute to find
+        * @aType type of the attribute (e.g. bool, int or string)
+        */               
+        TValidationFunctionL FindFieldL( TUint32 aAttribute,
+                                           TCMFieldTypes aType,
+                                           CommsDat::CMDBElement* &aElement ) const;
+
+        
+        /**
+        * Return Location id
+        * @return location id
+        */
+        TUint32 GetLocationIdL() const;
+        
+        /**
+        * Search for common attribute and convert it to plugin specific one.
+        * @param aAttribute common attribute id
+        * @return bearer specific attribute id
+        */
+        TUint32 CheckForCommonAttribute( const TUint32 aAttribute ) const;
+        
+        /**
+        * Returns the common attribute for the bearer specific attribute.
+        * Panics if there is no matching common attribute.
+        * @param aAttribute bearer specific attribute
+        * @return common attribute
+        */
+        TUint32 CommonAttribute( const TUint32 aAttribute ) const;
+        
+    public: // Util functions
+        /** 
+        * Returns pointer to the CmManager object
+        */
+        CCmManagerImpl* Cmmgr();
+
+        IMPORT_C CommsDat::TMDBElementId IAPRecordElementId() const;
+        
+        IMPORT_C TBool IsProtected() const;
+        
+        TBool SetProxyServerNameL( const TDesC& aProxyServer );
+
+        /**
+        * Return the coversion table item of the attribute
+        * @param aAttribute attribute of which conversion item is requested
+        * @return conversion table item
+        */
+        IMPORT_C const TCmAttribConvTable* ConvTableItem( TUint32 aAttribute );
+
+        /**
+        * Function to set up DNS addresses and DNS address from server flag.
+        * Can be used with both IPv4 and IPv6 attribute. 
+        * Passed bearer specific attributes must be defined in common conversion 
+        * table.
+        * @param aSrv1Attr first DNS server address attribute
+        * @param aSrv1 DNS first DNS server address
+        * @param aSrv2Attr second DNS server address
+        * @param aSrv2 DNS second DNS server address attribute
+        * @param aAddrFromSrvAttr DNS address from server flag attribute
+        * @param aIPv6 ETrue if passed addresses are in IPv6 form
+        */
+        IMPORT_C void SetDNSServerAddressL( TUint32 aSrv1Attr,
+                                            const TDesC& aSrv1,
+                                            TUint32 aSrv2Attr,
+                                            const TDesC& aSrv2,
+                                            TUint32 aAddrFromSrvAttr,
+                                            TBool aIPv6  );
+
+        /**
+        * Plugins can check DNS setting with this function.
+        * Suggested to be called from PrepareToUpdateRecordsL().
+        * It checked the DNS server addresses, moves secord into
+        * first if first is dynamic, and update DNSFromServer field
+        * according to address values.
+        * @param aIPv6 passed DNS server address are in IPv6 form
+        * @param aDNS1 first DNS server address
+        * @param aDNS1 secord DNS server address
+        * @param aDNSFromServer DNS address from server flag
+        */                                            
+        IMPORT_C void CheckDNSServerAddressL( TBool aIPv6,
+                                              CommsDat::CMDBField<TDesC>& aDNS1,
+                                              CommsDat::CMDBField<TDesC>& aDNS2,
+                                              CommsDat::CMDBField<TBool>& aDNSFromServer );
+        void SetPlugin(CCmPluginBaseEng* aPlugin);
+        
+        /**
+        * Scans aDests for destinations that may be valid parents 
+        * for this plugin and removes those that may not.
+        * @param aDests The array of destination IDs to be filtered.
+        */
+        void FilterPossibleParentsL( RArray<TUint32>& aDests );
+        
+    protected:
+            
+        /**
+        * Checks if the ECmName attribute was set since the last update.
+        * If so, name is updated in passed record
+        * @param aRecord record to be checked against iIapRecord
+        */
+        IMPORT_C void CheckIfNameModifiedL( CommsDat::CCDRecordBase* aRecord ) const;
+        
+        /**
+        * Returns the global priority of the passed bearer type
+        * @param aServiceType bearer type of which priority is requested
+        * @return global bearer priority
+        */        
+        IMPORT_C TInt GlobalBearerPriority( const TDesC& aServiceType ) const;
+        
+        /**
+        * Returns the global UI priority of the passed bearer type
+        * @param aServiceType bearer type of which priority is requested
+        * @return global UI bearer priority
+        */
+        IMPORT_C TInt GlobalUiBearerPriority( const TDesC& aServiceType ) const;
+
+    private: // Data
+	    CCmPluginBaseEng*      iPlugin;
+	    
+	    friend class CCmPluginBaseEng;
+    };
+    
+#endif // CMPLUGINBASE_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/bearer_settings_plugin_api/inc/cmpluginbaseeng.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,1038 @@
+/*
+* 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:  IF implementation class for connection method plugins.
+*
+*/
+
+#ifndef CMPLUGINBASEENG_H
+#define CMPLUGINBASEENG_H
+
+// INCLUDES
+#include <cmconnectionmethoddef.h>
+
+#include <e32std.h>
+#include <e32base.h>
+#include <ecom/ecom.h>        // For REComSession
+#include <metadatabase.h>
+#include <CommsDatTypesV1_1.h>
+
+#define IAP_ELEMENT_ID( iapRecId )  (KCDTIdIAPRecord | \
+                                     KCDMaskShowFieldType | \
+                                     (iapRecId << 8))
+
+#define QUERY_HBUFC_FIELD( record, fieldId ) *STATIC_CAST(CommsDat::CMDBField<HBufC*>*, record->GetFieldByIdL( fieldId ))
+#define QUERY_UINT32_FIELD( record, fieldId ) *STATIC_CAST(CommsDat::CMDBField<TUint32>*, record->GetFieldByIdL( fieldId ))
+#define QUERY_INT_FIELD( record, fieldId ) *STATIC_CAST(CommsDat::CMDBField<TInt>*, record->GetFieldByIdL( fieldId ))
+#define SET_HBUFC_FIELD( record, fieldId, stringVal ) STATIC_CAST(CommsDat::CMDBField<TDesC>*, record->GetFieldByIdL( fieldId ))->SetL( stringVal->Des() )
+#define SET_INT_FIELD( record, fieldId, intVal ) STATIC_CAST(CommsDat::CMDBField<TInt>*, record->GetFieldByIdL( fieldId ))->SetL( intVal )
+#define FIELD_TO_TDESC( field ) ( (const TDesC&)( field ) )
+
+
+// CONSTANTS
+const TInt32 KExtensionBaseLevel = 1;
+const TUint32 KDefAttrsArrayGranSize = 32;
+const TUint32 KMaxProxyServerNameLength = 1000;
+
+const TUint32 KDummyBearerType = 1;
+
+// DATA TYPES
+typedef enum
+    {
+    ECmBool,
+    ECmInt,
+    ECmText,
+    ECmText8
+    }TCMFieldTypes;
+    
+// Attributes that are related to bearer plugin creation
+enum TBearerCreationCommonAttributes
+    {
+    ECmBearerCreationCommonAttributes = 9000,   /**<
+                                                * Marks the beginning of
+                                                * bearer creation related
+                                                * attributes
+                                                */
+    
+    ECmExtensionLevel,          /**<
+                                * 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
+                                                */
+    };
+
+class CCmPluginBaseEng;
+class CCmPluginBase;
+
+/**
+* Validation function called before data is stored.
+* @param aThis 'this' pointer of the plugin instance
+* @param aAttribute attribute to be set
+* @param aValue value to be checked
+* @return ETrue if value is stored.
+*/
+typedef TBool (*TValidationFunctionL)( CCmPluginBaseEng* aThis,
+                                      TUint32 aAttribute,
+                                      const TAny* aValue );
+
+/**
+* Structure of conversion table between CM attributes and
+* CommsDat ids. The first element must indicate the 
+* range of the conversion table. iAttribId is the lowest Id, 
+* iCommsDatId is the highest one. The last element is a
+* terminator. e.g. Proxy table:
+* static const TCmAttribConvTable SProxyConvTbl[] = 
+*   {
+        { ECMProxyUsageEnabled, ECMProxyRangeMax, NULL }
+        { ECMProxyUseProxyServer, KCDTIdUseProxyServer, NULL },
+        { ECmProxyPortNumber, KCDTIdPortNumber, &CheckPortNumberValidityL },
+        ...
+        { 0, 0 }
+    }
+*/
+typedef struct
+    {
+    TInt    iAttribId;
+    TInt    iCommsDatId;
+    TValidationFunctionL iValidFuncL;
+    TInt    iTitleId;
+    TInt    iMaxLength;
+    TUint32 iAttribFlags;   // see TCmConvAttribFlags
+    TInt    iDefSettingResId;
+    TInt    iEditorResId;
+    TInt    iDefValueResId;
+    TAny*   iNotUsed1;
+    TAny*   iNotUsed2;
+    }TCmAttribConvTable;
+    
+enum TCmConvAttribFlags
+    {
+    EConvNoZeroLength   = 0x00000001,   // Zero length NOT acceptable
+    EConvCompulsory     = 0x00000002,
+    EConv8Bits          = 0x00000004,
+    EConvReadOnly       = 0x00000008,
+    EConvNumber         = 0x00000010,
+    EConvIPv4           = 0x00000020,
+    EConvIPv6           = 0x00000040,
+    EConvPassword       = 0x00000080,
+    };
+
+typedef struct
+    {
+    CommsDat::CCDRecordBase*      *iRecord;
+    TBool*              iEnabled;
+    const TCmAttribConvTable* iConvTable;
+    }TCmAttrConvArrayItem;
+
+typedef struct
+    {
+    TInt                iAttribId;
+    TInt                iCommonAttribId;
+    }TCmCommonAttrConvArrayItem;
+    
+enum TCmMetaDataFields
+    {
+    EMetaHighlight    = 0x00000001,
+    EMetaHiddenAgent  = 0x00000002
+    };
+    
+// FUNCTION PROTOTYPES
+
+/**
+* TValidationFunctionL functions.
+*/
+
+/**
+* Function should be called if client tries to set attribute that is read-only
+* @param aThis 'this' pointer of the plugin instance
+* @param aAttribute not used
+* @param aValue not used
+* @leave KErrNotSupported in every cases
+*/
+IMPORT_C TBool ReadOnlyAttributeL( CCmPluginBaseEng* aThis, 
+                                  TUint32 aAttribute, 
+                                  const TAny* aValue );
+
+/**
+* Function to check if the passed IPv4 address is valid.
+* @param aThis 'this' pointer of the plugin instance
+* @param aAttribute attribute client wants to set
+* @param aValue TDesC* IPv4 address buffer to be checked
+*/
+IMPORT_C TBool CheckIPv4ValidityL( CCmPluginBaseEng* aThis, 
+                                  TUint32 aAttribute, 
+                                  const TAny* aValue );
+
+/**
+* Function to check if the passed IPv6 address is valid.
+* @param aThis 'this' pointer of the plugin instance
+* @param aAttribute attribute client wants to set
+* @param aValue TDesC* IPv6 address buffer to be checked
+*/
+IMPORT_C TBool CheckIPv6ValidityL( CCmPluginBaseEng* aThis, 
+                                  TUint32 aAttribute, 
+                                  const TAny* aValue );
+
+/**
+* Function to check if the passed port number is valid.
+* @param aThis 'this' pointer of the plugin instance
+* @param aAttribute attribute client wants to set
+* @param aValue TUint32 the port number to be check
+*/
+IMPORT_C TBool CheckPortNumberValidityL( CCmPluginBaseEng* aThis, 
+                                        TUint32 aAttribute, 
+                                        const TAny* aValue );
+
+/**
+* Function to check if the passed record is valid.
+* @param aThis 'this' pointer of the plugin instance
+* @param aAttribute attribute client wants to set
+* @param aValue TUint32 the record id to be checked
+*/
+IMPORT_C TBool CheckRecordIdValidityL( CCmPluginBaseEng* aThis, 
+                                      TUint32 aAttribute, 
+                                      const TAny* aValue );
+
+/**
+* Function to check if the passed WAPWspOption is valid.
+* @param aThis 'this' pointer of the plugin instance
+* @param aAttribute attribute client wants to set
+* @param TUint32 the WPSOption to be checked
+*/
+IMPORT_C TBool CheckWAPWspOptionValidityL( CCmPluginBaseEng* aThis, 
+                                          TUint32 aAttribute, 
+                                          const TAny* aValue );
+
+/**
+* @param aThis 'this' pointer of the plugin instance
+* @param aAttribute attribute client wants to set
+* @param TUint32 the WPSOption to be checked
+*/
+IMPORT_C TBool SetProxyServerNameL( CCmPluginBaseEng* aThis, 
+                                   TUint32 aAttribute, 
+                                   const TAny* aValue );
+                          
+/**
+* Miscellaneous utility functions.
+*/
+
+/**
+* Check if the passed IP address is '0.0.0.0' or empty string
+* @param aIpAddress IP address to be checked
+*/
+IMPORT_C TBool IsUnspecifiedIPv4Address( const TDesC& aIpv4Address );
+
+/**
+* Check if the passed IP address is one of these:
+* - 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
+*/
+IMPORT_C CMManager::TIPv6Types ClassifyIPv6Address( const TDesC& aIpv6Address );
+
+// FORWARD DECLARATIONS
+class CCmDestinationImpl;
+class CCmManagerImpl;
+class CCDIAPMetadataRecord;
+class CCmTransactionHandler;
+class CCmPluginBasePrivate;
+        
+// CLASS DECLARATION
+NONSHARABLE_CLASS(TCmPluginInitParam)
+    {
+    public:
+    
+        TCmPluginInitParam( CCmManagerImpl& aCmMgr );
+        
+    public:
+    
+        CCmManagerImpl&     iCmMgr;
+        TUint32             iParentDest;// Parent destination
+        TAny*               iNotused1;
+        TAny*               iNotused2;
+    };
+
+/**
+ *  CCmPluginBaseEng is base class for every connection method plugin
+ *
+ *  @lib cmmanager.lib
+ *  @since S60 v3.2
+ */
+class CCmPluginBaseEng : public CBase
+    {
+    public:
+    
+        /** Destructor. */
+        IMPORT_C virtual ~CCmPluginBaseEng();
+        
+        /**
+        * Create a new instance of the given bearer type plugin.
+        * Used from framework to avoid using slow ECom framework.
+        * @param aInitParam initialization data
+        */
+        virtual CCmPluginBaseEng* 
+                CreateInstanceL( TCmPluginInitParam& aInitParam ) const = 0;
+        
+    public: // Attribute handlers
+    
+        /**
+        * Gets the value for a TInt attribute.
+        * @param aAttribute Identifies the attribute to be retrived.
+        * @return contains the requested TInt attribute.
+        */
+        IMPORT_C virtual TUint32 
+                        GetIntAttributeL( const TUint32 aAttribute ) const;
+
+        /**
+        * Gets the value for a TBool attribute.
+        * @param aAttribute Identifies the attribute to be retrived.
+        * @return contains the requested TBool attribute.
+        */
+        IMPORT_C virtual TBool 
+                        GetBoolAttributeL( const TUint32 aAttribute ) const;
+
+        /**
+        * Gets the value for a String16 attribute.
+        * @param aAttribute Identifies the attribute to be retrived.
+        * @return copy of the requested attribute. Ownership is passed.
+        */
+        IMPORT_C virtual HBufC* 
+                        GetStringAttributeL( const TUint32 aAttribute ) const;
+        
+        /**
+        * Gets the value for a String8 attribute.
+        * @param aAttribute Identifies the attribute to be retrived.
+        * @return copy of the requested attribute. Ownership is passed.
+        */
+        IMPORT_C virtual HBufC8* 
+                        GetString8AttributeL( const TUint32 aAttribute ) const;
+
+        /**
+        * Sets the value for a TInt attribute.
+        * @param aAttribute Identifies the attribute to be set.
+        * @param aValue The value to be set.
+        * @return None.
+        */
+        IMPORT_C virtual void SetIntAttributeL( 
+                             const TUint32 aAttribute, TUint32 aValue );
+
+        /**
+        * Sets the value for a TBool attribute.
+        * @param aAttribute Identifies the attribute to be set.
+        * @param aValue The value to be set.
+        * @return None.
+        */
+        IMPORT_C virtual void SetBoolAttributeL( 
+                             const TUint32 aAttribute, TBool aValue );
+
+        /**
+        * Sets the value for a String16 attribute.
+        * @param aAttribute Identifies the attribute to be set.
+        * @param aValue The value to be set.
+        * @return None.
+        */
+        IMPORT_C virtual void SetStringAttributeL( 
+                             const TUint32 aAttribute, const TDesC16& aValue );
+
+        /**
+        * Sets the value for a String8 attribute.
+        * @param aAttribute Identifies the attribute to be set.
+        * @param aValue The value to be set.
+        * @return None.
+        */
+        IMPORT_C virtual void SetString8AttributeL( 
+                             const TUint32 aAttribute, const TDesC8& aValue );
+
+        /**
+        * Restore the original value of the attribute from commsdat field.
+        * Base implementation can be used only with attributes 
+        * stored directly in commsdat.
+        * @param aAttribute attribute to be restored
+        */
+        IMPORT_C virtual void RestoreAttributeL( const TUint32 aAttribute );
+        
+        /**
+        * Returns the CCmDestinationImpl* if this is an 
+        * embedded destination CM. Otherwise returns NULL.
+        * @return embedded destination object or NULL
+        */
+        IMPORT_C virtual CCmDestinationImpl* Destination() const;
+        
+        /**
+        * Update or if this is a new CM, creates CM in CommsDat. 
+        * - OpenTransactionLC()
+        * - PrepareToUpdateRecordsL()
+        * - UpdateChargeCardRecordL()
+        * - UpdateServiceRecordL()
+        * - UpdateIAPRecordL()
+        *   - UpdateLocationRecordL()
+        *   - BearerRecordIdLC()
+        *   - UpdateNetworkRecordL()
+        *   - UpdateWapRecordL()
+        *   - UpdateProxyRecordL()
+        *   - UpdateConnPrefSettingL()
+        * - UpdateAdditionalRecordsL()
+        * - CommitTransactionL()
+        * @return None.
+        */        
+        IMPORT_C virtual void UpdateL();     
+        
+        /*
+        * Delete from the database if this CM has no more reference
+        * from the DN_IAP table.
+        * - IsMultipleReferencedL()
+        * - OpenTransactionLC()
+        * - PrepareToDeleteL()
+        * - Delete records (in this order)
+        *   - IAP
+        *   - Proxy
+        *   - Service
+        *   - ChargeCard
+        *   - Network
+        *   - Location
+        *   - WapAP
+        *   - WapBearer
+        * - DeleteAdditionalRecordsL()
+        * - CommitTransactionL()
+        * @param aForced forced delete doesn't check referencies
+        * @param aOneRefsAllowed ETrue if one reference from a destination is 
+        *           acceptable to delete this connection method.
+        */    
+        IMPORT_C virtual TBool DeleteL( TBool aForced,
+                                        TBool aOneRefAllowed = ETrue );
+
+        /**
+        * Performs the basic loading of records related
+        * to this connection method:
+        * - OpenTransactionLC();
+        * - PrepareToLoadRecordsL()
+        * - LoadIAPRecordL();
+        *       - load IAP
+        *       - load WAP (AP & IP Bearer)
+        *       - load proxy
+        *       - load charge card
+        *       - load network
+        *       - load location
+        * - LoadServiceSettingL();
+        * - LoadAdditionalRecordsL();
+        */
+        IMPORT_C virtual void LoadL( TUint32 aIapId );
+
+        /**
+        * Create a new connection method in memory.
+        * Call UpdateL() to store it in CommsDat.
+        * No transaction operation is performed.
+        * - Creates new WAP, IAP, Network records
+        * - CreateNewServiceRecordL()
+        * - CreateAdditionalRecordsL()
+        * - Loads default AP name from resource 
+        *       (R_CMMANAGERENG_DEFAULT_AP_NAME)
+        */
+        IMPORT_C virtual void CreateNewL();
+        
+        /**
+        * Create a copy of the connection method:
+        * - CreateInstanceL()
+        * - CreateNewL()
+        * - PrepareToCopyDataL()
+        * - Copies data:
+        *   - name
+        *   - bearer type
+        *   - records added to the convertion table
+        * - Calls CopyAdditionalDataL().
+        */
+        IMPORT_C virtual CCmPluginBaseEng* CreateCopyL() const;
+        
+        /*
+        * Returns true if the CM has more than one parent destination
+        */        
+        IMPORT_C virtual TInt NumOfConnMethodReferencesL();
+
+    public:
+    
+        /**
+        * Returns a pointer to the cmmanager
+        * @return a pointer to the cmmanager
+        */
+        CCmManagerImpl& CmMgr() const { return iCmMgr; };
+
+        IMPORT_C CommsDat::CMDBSession& Session() const;
+
+        /**
+        * Launches the settings dialog of the plugin
+        *
+        * @since S60 3.2
+        * @return soft key selection
+        */
+        virtual TInt RunSettingsL() = 0;
+
+        /**
+        * Called on a newly created connection method to initialize it properly
+        * with user interaction (e.g. APN setting for a packet data-, WEP-key
+        * setting for a WLAN connection method, etc.).
+        * Note: each plug-in should set its name (i.e. ECmName) in this
+        * function call.
+        *
+        * @since S60 3.2
+        * @param aManuallyConfigure let's the plugin know if a plugin should 
+        *                           be configured manually or automatically
+        * @return ETrue if initialization was successful and wasn't cancelled.
+        * EFalse, if initialization process was cancelled (i.e. user pressed
+        * Cancel button).
+        */
+        virtual TBool InitializeWithUiL( TBool aManuallyConfigure ) = 0;
+        
+        /**
+        * Checks if the plug-in can handle the given AP.
+        * @param aIapId IAPId of the AP to be checked
+        * @return ETrue if plug-in can handle the IAP
+        */
+        virtual TBool CanHandleIapIdL( TUint32 aIapId ) const = 0;
+        
+        /**
+        * Checks if the plug-in can handle the given AP.
+        * @param aIapRecord IAP record to be checked
+        * @return ETrue if plug-in can handle the IAP
+        */
+        virtual TBool CanHandleIapIdL( CommsDat::CCDIAPRecord* aIapRecord ) const = 0;
+        
+        /**
+        * Return the parent destination of this connection method.
+        * @return parent destination of this connection method
+        */
+        IMPORT_C CCmDestinationImpl* ParentDestination() const;
+        
+        /**
+        * Calls FeatureManager::FeatureSupported directly.
+        * @param aFeature feature ID
+        * @return feature support status
+        * @since 3.2
+        */
+        IMPORT_C static TBool FeatureSupported( TInt aFeature );
+                
+        /**
+        * Function should be overriden by virtual bearer type plugins.
+        * Returns if the passed IAP id is linked to that connection method.
+        * @param aIapId IAP id to be checked
+        * @return ETrue if the passed IAP id is linked to that connection method.
+        */
+        virtual TBool IsLinkedToIap( TUint32 /*aIapId*/ ){ return EFalse; }
+        
+        /**
+        * Function should be overriden by virtual bearer type plugins.
+        * Returns if the passed SNAP id is linked to that connection method.
+        * @param aSnapId SNAP id to be checked
+        * @return ETrue if the passed SNAP id is linked to that connection method.
+        */
+        virtual TBool IsLinkedToSnap( TUint32 /*aSnapId*/ ){ return EFalse; }
+
+        /**
+        * Increments the reference counter. Used by the object pool.
+        */
+        void IncrementRefCounter();
+        /**
+        * Increments the reference counter. Used by the object pool.
+        */
+        void DecrementRefCounter();
+        /**
+        * Returns the reference counter. Used by the object pool.
+        * @return TInt
+        */
+        TInt GetRefCounter();
+
+        /**
+        * Appends uids of connection methods - which were also created during connection method
+        * creation - to the array given as parameter 
+        * @param aIapIds the array the additonal cm uids are appended to
+        */        
+        IMPORT_C virtual void GetAdditionalUids( RArray<TUint32>& aIapIds );
+
+    protected: // Conversion table API
+    
+        IMPORT_C void AddConverstionTableL( 
+                            CommsDat::CCDRecordBase* *aRecord,
+                            TBool* aEnabled,
+                            const TCmAttribConvTable* aConvTable );
+                                            
+        IMPORT_C void AddCommonConversionTableL( 
+                                const TCmCommonAttrConvArrayItem* aConvTable );
+        
+        IMPORT_C void RemoveConversionTable( 
+                                        const TCmAttribConvTable* aConvTable );
+        
+        IMPORT_C void RemoveCommonConversionTable( 
+                                const TCmCommonAttrConvArrayItem* aConvTable );
+                                   
+    protected: // Resource handling
+    
+        /**
+        * Add file name to the resource file array.
+        * Open it and/or increment reference count.
+        * @param aName resource file name
+        */
+        IMPORT_C void AddResourceFileL( const TDesC& aName );
+        
+        /**
+        * Remove file name from the resource file name array.
+        * Close the resource file and/or decrement the reference count.
+        * @param aName resource file name
+        */
+        IMPORT_C void RemoveResourceFile( const TDesC& aName );
+
+        /**
+        * Read string from resource file. Resource file has to be
+        * opened prior this by calling AddResourceFileL().
+        */
+        IMPORT_C HBufC* AllocReadL( TInt aResourceId ) const;
+        
+            
+    protected:
+    
+        /** Constructor */
+        IMPORT_C CCmPluginBaseEng( TCmPluginInitParam *aInitParam );
+        
+        /** Second phase constructor */
+        IMPORT_C virtual void ConstructL();
+    
+        /** Open transaction */
+        void OpenTransactionLC();
+        
+        /**
+        * Commit transaction.
+        * @param aError - error id
+        */
+        void CommitTransactionL( TInt aError );
+        
+        /**
+        * Rollback transaction.
+        */
+        void RollbackTransaction();
+        
+        /** Make a reset on this class. */
+        IMPORT_C void Reset();
+        
+        /**
+        * Plug-in implementation can make its on
+        * cleanup in this function. 
+        * Always called from LoadL() and 
+        * should be called from plugin's destructor.
+        */
+        virtual void AdditionalReset() = 0;
+        
+        /**
+        * Check if there's connection established with
+        * this connection method (IAP id).
+        */
+        IMPORT_C virtual TBool CheckIfAlreadyConnected() const;
+        
+    protected:  // virtual loader function
+        
+        /**
+        * Inherited class can make some preraration
+        * before CCmPluginBaseEng would start loading
+        * records from tables.
+        */
+        IMPORT_C virtual void PrepareToLoadRecordsL();
+
+        /**
+        * Inherited class can load any additional
+        * records after CCmPluginBaseEng finished.
+        */
+        virtual void LoadAdditionalRecordsL(){};
+
+        /**
+        * Load service record. Default implementation can
+        * create only factory supported record instances.
+        */
+        IMPORT_C virtual void LoadServiceSettingL();
+
+    protected:  // virtual update functions
+    
+        /**
+        * Check if connection method data is valid, before
+        * it would be persisted to commsdat.
+        * If invalid data found, set its attribute id in
+        * iInvalidAttribute.
+        * Base class implementation must be called from
+        * overridden one.
+        */
+        IMPORT_C virtual void PrepareToUpdateRecordsL();
+        
+        /**
+        * Inherited class can update its additional
+        * records here.
+        */
+        virtual void UpdateAdditionalRecordsL(){};
+
+        /**
+        * Update service record.
+        */
+        IMPORT_C virtual void UpdateServiceRecordL();
+
+        /**
+        * Return the service table name and record id 
+        * of this connection in the service table.
+        * @param - aServiceName name of the service table
+        *           this connection method points to.
+        * @param - aRecordId record id in the service table.
+        */
+        virtual void ServiceRecordIdLC( HBufC* &aServiceName, 
+                                       TUint32& aRecordId ) = 0;
+
+        /**
+        * Return the bearer table name and record id 
+        * of this connection in the bearer table.
+        * @param - aBearerName name of the bearer table
+        *           this connection method points to.
+        * @param - aRecordId record id in the bearer table.
+        */
+        virtual void BearerRecordIdLC( HBufC* &aBearerName, 
+                                       TUint32& aRecordId ) = 0;
+
+    protected:  // virtual delete function
+    
+        /**
+        * Plugin can prepare to delete the connection method
+        * with this function. Called from DeleteL() before
+        * any record would be deleted. Do NOT delete any
+        * record here.
+        */
+        virtual void PrepareToDeleteRecordsL(){};
+        
+        /**
+        * Plugin can delete additional, bearer specific record
+        * with this function. Called from DeleteL().
+        */
+        virtual void DeleteAdditionalRecordsL(){};
+
+    protected:  // virtual create function
+    
+        /**
+        * Plugin has to create and initialize its bearer specific object
+        * that points to the service record here. Pointer has to be stored in 
+        * iServiceRecord data member.
+        * Do NOT store service record in CommsDat yet.
+        */
+        virtual void CreateNewServiceRecordL() = 0;
+        
+        /**
+        * Plugin can create and initialize its bearer specific record(s) here.
+        * Do NOT store them in CommsDat yet.
+        */
+        virtual void CreateAdditionalRecordsL(){};
+        
+    protected:
+
+        /**
+        * Called from CreateCopyL().
+        * Plugin can prepare for copying every records
+        * added to the conversion tables.
+        *
+        * @param aDestInst copy attributes into this plugin instance
+        */
+        virtual void PrepareToCopyDataL( CCmPluginBaseEng& /*aDestInst*/ ) const {};
+                
+        /**
+        * Copy data of the connection method that is not 
+        * added to the conversion table. (e.g. bearer specific
+        * flags)
+        *
+        * @param aDestInst copy attributes into this plugin instance
+        */    
+        virtual void CopyAdditionalDataL( CCmPluginBaseEng& /*aDestInst*/ ) const {};
+
+    private:
+    
+        void EnableProxyL( TBool aEnable );
+        void EnableChargeCardL( TBool aEnable );
+        void EnableLocationL( TBool aEnable );
+
+        // Loader functions
+        void DoLoadL( TUint32 aIapId );
+        void LoadIAPRecordL( TUint32 aIapId );
+        void LoadChargeCardSettingL( TUint32 aChargeCardId );
+        void LoadProxySettingL();
+        void LoadNetworkSettingL();
+        void LoadLocationSettingL();
+        void LoadWapRecordL();
+        void LoadSeamlessnessRecordL();
+        
+        // Updater functions
+        void UpdateIAPRecordL();
+        void UpdateProxyRecordL();
+        void UpdateChargeCardRecordL();
+        void UpdateConnPrefSettingL();
+        void UpdateNetworkRecordL();
+        void UpdateLocationRecordL();
+        void UpdateWapRecordL();
+        void UpdateSeamlessnessRecordL();
+        
+        /**
+        * No WAP record found in load process,
+        * but client wants to set start page.
+        */
+        void NewWapRecordL();
+        
+        /**
+        * Create a new metadata record.
+        * @param aSetDef ETrue if setting default seamlessness valud is needed
+        * @return create metadata record point
+        */
+        CCDIAPMetadataRecord* NewSeamlessnessRecordL( TBool aSetDef );
+        
+        CommsDat::CCDWAPIPBearerRecord* FindWAPRecordL();
+        CCDIAPMetadataRecord* FindSeamlessnessRecordL();
+
+        /**
+        * Set attribute flag on the given record
+        * @param aRecord record to be set
+        * @param aAttribute e.g. ECDHidden
+        * @param aSet ETrue to set, EFalse to clear
+        */
+        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 );
+
+        /**
+        * Find field element associated with the passed attribute.
+        * @param aAttribute aatribute to find
+        * @aType type of the attribute (e.g. bool, int or string)
+        */               
+        TValidationFunctionL FindFieldL( TUint32 aAttribute,
+                                           TCMFieldTypes aType,
+                                           CommsDat::CMDBElement* &aElement ) const;
+
+        
+        /**
+        * Return Location id
+        * @return location id
+        */
+        TUint32 GetLocationIdL() const;
+        
+        /**
+        * Search for common attribute and convert it to plugin specific one.
+        * @param aAttribute common attribute id
+        * @return bearer specific attribute id
+        */
+        TUint32 CheckForCommonAttribute( const TUint32 aAttribute ) const;
+        
+        /**
+        * Returns the common attribute for the bearer specific attribute.
+        * Panics if there is no matching common attribute.
+        * @param aAttribute bearer specific attribute
+        * @return common attribute
+        */
+        TUint32 CommonAttribute( const TUint32 aAttribute ) const;
+        
+    public: // Util functions
+
+        IMPORT_C CommsDat::TMDBElementId IAPRecordElementId() const;
+        
+        IMPORT_C TBool IsProtected() const;
+        
+        TBool SetProxyServerNameL( const TDesC& aProxyServer );
+
+        /**
+        * Return the coversion table item of the attribute
+        * @param aAttribute attribute of which conversion item is requested
+        * @return conversion table item
+        */
+        IMPORT_C const TCmAttribConvTable* ConvTableItem( TUint32 aAttribute );
+
+        /**
+        * Function to set up DNS addresses and DNS address from server flag.
+        * Can be used with both IPv4 and IPv6 attribute. 
+        * Passed bearer specific attributes must be defined in common conversion 
+        * table.
+        * @param aSrv1Attr first DNS server address attribute
+        * @param aSrv1 DNS first DNS server address
+        * @param aSrv2Attr second DNS server address
+        * @param aSrv2 DNS second DNS server address attribute
+        * @param aAddrFromSrvAttr DNS address from server flag attribute
+        * @param aIPv6 ETrue if passed addresses are in IPv6 form
+        */
+        IMPORT_C void SetDNSServerAddressL( TUint32 aSrv1Attr,
+                                            const TDesC& aSrv1,
+                                            TUint32 aSrv2Attr,
+                                            const TDesC& aSrv2,
+                                            TUint32 aAddrFromSrvAttr,
+                                            TBool aIPv6  );
+
+        /**
+        * Plugins can check DNS setting with this function.
+        * Suggested to be called from PrepareToUpdateRecordsL().
+        * It checked the DNS server addresses, moves secord into
+        * first if first is dynamic, and update DNSFromServer field
+        * according to address values.
+        * @param aIPv6 passed DNS server address are in IPv6 form
+        * @param aDNS1 first DNS server address
+        * @param aDNS1 secord DNS server address
+        * @param aDNSFromServer DNS address from server flag
+        */                                            
+        IMPORT_C void CheckDNSServerAddressL( TBool aIPv6,
+                                              CommsDat::CMDBField<TDesC>& aDNS1,
+                                              CommsDat::CMDBField<TDesC>& aDNS2,
+                                              CommsDat::CMDBField<TBool>& aDNSFromServer );
+
+    protected:
+            
+        /**
+        * Checks if the ECmName attribute was set since the last update.
+        * If so, name is updated in passed record
+        * @param aRecord record to be checked against iIapRecord
+        */
+        IMPORT_C void CheckIfNameModifiedL( CommsDat::CCDRecordBase* aRecord ) const;
+        
+        /**
+        * Returns the global priority of the passed bearer type
+        * @param aServiceType bearer type of which priority is requested
+        * @return global bearer priority
+        */        
+        IMPORT_C TInt GlobalBearerPriority( const TDesC& aServiceType ) const;
+        
+        /**
+        * Returns the global UI priority of the passed bearer type
+        * @param aServiceType bearer type of which priority is requested
+        * @return global UI bearer priority
+        */
+        IMPORT_C TInt GlobalUiBearerPriority( const TDesC& aServiceType ) const;
+
+    private: // Util functions
+    
+        HBufC* DoMakeValidNameL( const TDesC& aName );
+        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 );
+        HBufC* EscapeTextLC( const TDesC& aLiteral );
+        
+        void SetNameL( const TDesC& aName );
+        
+        TCmAttrConvArrayItem* ConversionTable( TUint32 aAttribute ) const;
+        CommsDat::CMDBElement& FieldByAttributeL( const TCmAttrConvArrayItem* aItem,
+                                        const TUint32 aAttribute,
+                                        TInt& aIndex ) const;
+        
+        /**
+        * Writes the passed text into the passed attribute.
+        * @param aAttribute The attribute to write into
+        * @param aValue The value to write
+        */
+        void GenericStringWriterL( const TUint32 aAttribute, 
+                                   const TDesC16& aValue );
+        
+        /**
+        * Returns the common attribute for the bearer specific attribute, if 
+        * it is mapped to any. Otherwise, it returns the original attribute.
+        * @param aAttribute bearer specific attribute
+        * @return common/original attribute
+        */
+        TUint32 MappedCommonAttribute( const TUint32 aAttribute ) const;        
+    public:
+
+        /**
+        * Indicates if the Id is valid or if this is a new object which sitll
+        * haven't been updated. 
+        * Used by the object pool.
+        * @return TBool
+        */
+        TBool IdIsValid();
+
+        /**
+        * Sets iIdIsValid attribute
+        * Used by the object pool.
+        */
+        void SetIdValidity(TBool validity);
+        
+        /**
+        * Scans aDests for destinations that may be valid parents 
+        * for this plugin and removes those that may not. The function may be
+        * overriden by virtual bearer type plugins.
+        * @param aDests The array of destination IDs to be filtered.
+        */
+        virtual void FilterPossibleParentsL( RArray<TUint32>& /*aDests*/ ) {}
+        
+        /**
+         * Sets the predefined id for the plugin. This should only be
+         * used by cmmanager framework.
+         */
+        IMPORT_C void SetPreDefinedId( const TUint32 aPreDefId );
+
+    public:
+
+        /**
+        * Check if there is space to save record
+        * @return ETrue if space is available; otherwise leave with KLeaveWithoutAlert
+        */
+        IMPORT_C TBool CheckSpaceBelowCriticalLevelL() const;
+
+    public: // Data
+    
+        // Required attribute for the framework
+        // (An identifier used during destruction)
+        TUid iDtor_ID_Key;
+        
+    protected:
+
+        CCmManagerImpl&     iCmMgr;         //< Not owned    
+        TUint32             iParentDest;    // id of the parent destinaton
+        
+        // IAP id of the CM. 0 means that this is a newly
+        // created one.
+        TUint32         iIapId;
+        TUint32         iBearerType;        //< Should be set by plugin 
+                                            //< constructor
+        
+        CommsDat::CCDIAPRecord*           iIapRecord;         // created by base class
+        CommsDat::CCDProxiesRecord*       iProxyRecord;       // optional
+        CommsDat::CCDRecordBase*          iServiceRecord;     // created by plugin
+        CommsDat::CCDChargecardRecord*    iChargeCardRecord;  // optional
+        CommsDat::CCDNetworkRecord*       iNetworkRecord;     // created by base class
+        CommsDat::CCDLocationRecord*      iLocationRecord;    // optional
+        
+        TBool           iChargeCardEnabled;
+        TBool           iLocationEnabled;
+
+        TUint32         iInvalidAttribute;
+
+    private: // Data
+        
+        CCmPluginBasePrivate* iPriv;
+        //Reference counter for the object pool
+	    TInt                  iRefCounter;
+        //indicates if the Id is valid or not (for the object pool)
+        TBool                 iIdIsValid;
+        // Predefined connection method id(iap id)
+        TUint32               iPreDefIapId;
+	    friend class CCmPluginBase;
+    };
+    
+#endif // CMPLUGINBASEENG_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/bearer_settings_plugin_api/inc/cmpluginlanbase.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,106 @@
+/*
+* 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 Base Lan interface implementation 
+*                for "LAN" plugin
+*
+*/
+
+#ifndef LAN_PLUGIN_BASE_H
+#define LAN_PLUGIN_BASE_H
+
+// INCLUDES
+#include <e32base.h>
+#include <eikdoc.h>
+#include <apparc.h>
+#include <CommsDatTypesV1_1.h>
+#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include <commsdat_partner.h>
+#endif
+
+
+#include <cmpluginbaseeng.h>
+#include <cmpluginlanbasedef.h>
+
+/**
+ *  Lan based plugin IF implementation class
+ *
+ *  @lib cmmanager.lib
+ *  @since S60 v3.2
+ */
+class CCmPluginLanBase : public CCmPluginBaseEng
+    {
+                    
+    public: // From CCmPluginBaseEng
+        
+        IMPORT_C void LoadServiceSettingL();
+
+    protected:    // Constructors
+        /**
+        * Second phase constructor. Leaves on failure.
+        */
+        IMPORT_C void ConstructL();
+        
+        IMPORT_C virtual ~CCmPluginLanBase();
+
+        /**
+        * Constructor. 
+        */      
+        IMPORT_C CCmPluginLanBase( TCmPluginInitParam* aInitParam );
+        
+        
+        IMPORT_C virtual void ServiceRecordIdLC( HBufC* &aServiceName, 
+                                                 TUint32& aRecordId );
+        IMPORT_C virtual void BearerRecordIdLC( HBufC* &aBearerName, 
+                                                TUint32& aRecordId );
+
+        /**
+        * Creates a new service record.
+        */
+        IMPORT_C virtual void CreateNewServiceRecordL();
+
+    public: // From CCmPluginBaseEng        
+        
+        /**
+        * From CCmPluginBaseEng
+        * see base class definition
+        *
+        * @since S60 3.2
+        */
+        IMPORT_C void PrepareToUpdateRecordsL();
+        
+        /**
+        * No UI for LanBase.
+        * Panics in debug mode, leaves with KErrNotSupported in
+        * release mode.
+        */
+        IMPORT_C virtual TInt RunSettingsL();
+        
+        /**
+        * No UI for LanBase.
+        * Panics in debug mode, leaves with KErrNotSupported in
+        * release mode.
+        */
+        IMPORT_C virtual TBool InitializeWithUiL( TBool aManuallyConfigure );
+                
+    private:
+    
+        IMPORT_C CommsDat::CCDLANServiceRecord& ServiceRecord()const;
+        
+    protected:
+    
+        TBuf<CommsDat::KMaxTextLength>    iBearerRecName;        
+        TUint32                 iReserved[4];
+    };
+
+#endif // LAN_PLUGIN_BASE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/bearer_settings_plugin_api/inc/cmpluginlanbasedef.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,53 @@
+/*
+* 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:  Attribute definitions for LAN Plug-ins
+*
+*/
+
+#ifndef CMPLUGINLAN_BASE_DEF_H
+#define CMPLUGINLAN_BASE_DEF_H
+
+#define KUidLanBearerType  0x1020737A
+
+// INCLUDES
+#include "cmconnectionmethoddef.h" //KLanBaseIfNetworks
+
+namespace CMManager
+{
+/** LAN specific connection method attributes */
+enum
+    {
+    ELanBaseSpecificAttributes = KLanBaseSpecificAttributes,
+    ELanBaseIfNetworks = KLanBaseIfNetworks,
+    ELanBaseIpNetMask,
+    ELanBaseIpGateway,
+    ELanBaseIpAddrFromServer,
+    ELanBaseIpAddr,
+    ELanBaseIpDNSAddrFromServer,
+    ELanBaseIpNameServer1,
+    ELanBaseIpNameServer2,
+    ELanBaseIp6DNSAddrFromServer,
+    ELanBaseIp6NameServer1,
+    ELanBaseIp6NameServer2,
+    ELanBaseIpAddrLeaseValidFrom,
+    ELanBaseIpAddrLeaseValidTo,
+    ELanBaseConfigDaemonManagerName,
+    ELanBaseConfigDaemonName,
+    ELanBaseServiceExtensionTableName,
+    ELanBaseServiceExtensionTableRecordId,
+    ELanBaseRangeMax = KLanBaseRangeMax
+    };
+} // namespace CMManager
+
+#endif // CMPLUGINLAN_BASE_DEF_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/bearer_settings_plugin_api/inc/cmpluginlandef.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,147 @@
+/*
+* 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 headers for LAN Plug-in
+*
+*/
+
+
+#ifndef CMPLUGINLAN_DEF_H
+#define CMPLUGINLAN_DEF_H
+
+#include <cmconnectionmethoddef.h>
+
+namespace CMManager
+    {
+    /** LAN specific connection method attributes */
+    enum TConnectionMethodLanSpecificAttributes
+        {
+        ELanSpecificAttributes = KLanBaseSpecificAttributes,
+        
+        /**
+        * Comma separated list of network protocols, e.g. "PPP".
+        * ( String - default: None)
+        */
+        ELanIfNetworks = KLanBaseIfNetworks,
+        
+        /**
+        * IP net mask of interface.
+        * ( String - default: None)
+        */        
+        ELanIpNetMask,
+
+        /**
+        * IP address of gateway
+        * ( String - default: None)
+        */
+        ELanIpGateway,
+
+        /**
+        * Get IP addresses (for EPOC) from server?
+        * ( TBool - default: None)
+        */
+        ELanIpAddrFromServer,
+
+        /**
+        * IP address of EPOC.
+        * ( String - default: None)
+        */
+        ELanIpAddr,
+
+        /**
+        * Get DNS addresses from server?
+        * ( TBool - default: None)
+        */
+        ELanIpDNSAddrFromServer,
+
+        /**
+        * IP Address of primary name server.
+        * ( String - default: None)
+        */
+        ELanIpNameServer1,
+
+        /**
+        * IP Address of secondary name server.
+        * ( String - default: None)
+        */
+        ELanIpNameServer2,
+
+        /**
+        * Get IP6 DNS addresses from server?
+        * ( TBool - default: None)
+        */
+        ELanIp6DNSAddrFromServer,
+
+        /**
+        * IP6 Address of primary name server.
+        * ( String - default: None)
+        */
+        ELanIp6NameServer1,
+
+        /**
+        * IP6 Address of secondary name server.
+        * ( String - default: None)
+        */
+        ELanIp6NameServer2,
+
+        /**
+        * IP address valid from this time, used to store 
+        * dynamically assigned address lease info.
+        * ( String - default: None)
+        */
+        ELanIpAddrLeaseValidFrom,
+
+        /**
+        * IP address valid for use until this time, used to store .
+        * dynamically assigned address lease info.
+        * ( String - default: None)
+        */
+        ELanIpAddrLeaseValidTo,
+
+        /**
+        * Name of the ECOM configuration daemon manager component. 
+        * This component interfaces with the server identified in 
+        * ISP_CONFIG_DAEMON_NAME. If specified, ISP_CONFIG_DAEMON_NAME 
+        * should also be specified. 
+        * ( String - default: None)
+        */
+        ELanConfigDaemonManagerName,
+
+        /**
+        * Name of the configuration daemon server. 
+        * This server is used to provide further configuration for 
+        * a connection, e.g. dynamic IP address assignment. 
+        * If specified, ISP_CONFIG_DAEMON_MANAGER_NAME should also 
+        * be specified.
+        * ( String - default: None)
+        */
+        ELanConfigDaemonName,
+
+        /**
+        * Name of the LAN Service Extension table.
+        * ( String - default: None)
+        */
+        ELanServiceExtensionTableName,
+
+        /**
+        * The record ID of the linked LAN Service Extension record in the
+        * LAN Service Extension table.
+        * ( TUint32 - default: None)
+        */
+        ELanServiceExtensionTableRecordId,
+
+        ELanRangeMax = KLanBaseRangeMax
+        };
+    } // namespace CMManager
+
+#endif // CMPLUGINLAN_DEF_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/bearer_settings_plugin_api/inc/mcmdexec.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2008 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 using non-blocking mechanism needs to implement virtual
+*                defined by this class.
+*
+*/
+
+
+#ifndef MCMDEXEC_H
+#define MCMDEXEC_H
+
+#include<e32def.h>
+
+class MCmdExec
+    {
+public:
+    virtual void Execute() = 0;
+    virtual void HandleLeaveError( TInt aError ) = 0;
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/commsdat_wlan_api/commsdat_wlan_api.metaxml	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,18 @@
+<?xml version="1.0" ?>
+<api id="d30c60651eeb10f5fb33ccaadaebac1a" dataversion="1.0">
+  <name>CommsDat WLAN API</name>
+  <description>Provides const definitions for CommsDat WLAN tables.</description>
+  <type>c++</type>
+  <subsystem>networkingutilities</subsystem>
+  <libs>
+    <lib name="cmmanagerdatabase.lib" />
+  </libs>
+  <release category="domain"/>
+  <attributes>
+     <!-- This indicates wether the api provedes separate html documentation -->
+     <!-- or is the additional documentation generated from headers. -->
+     <!-- If you are unsuere then the value is "no" -->
+     <htmldocprovided>yes</htmldocprovided>
+     <adaptation>no</adaptation>
+  </attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/commsdat_wlan_api/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,29 @@
+/*
+* 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:  File that exports the files belonging to 
+:                CommsDat WLAN API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/wlancontainer.h     MW_LAYER_PLATFORM_EXPORT_PATH(wlancontainer.h)
+../inc/wlancdbcols.h     MW_LAYER_PLATFORM_EXPORT_PATH(WlanCdbCols.h)
+../inc/cmmanagertablefields.h     MW_LAYER_PLATFORM_EXPORT_PATH(cmmanagertablefields.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/commsdat_wlan_api/inc/cmmanagertablefields.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,104 @@
+/*
+* Copyright (c) 2004 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:  table field definitions
+*
+*/
+
+
+
+#ifndef TABLE_FIELDS_H
+#define TABLE_FIELDS_H
+
+
+// INCLUDES
+#include <e32base.h>
+#include <Metadatabase.h>
+#include <WlanCdbCols.h>
+#include <CommsDatTypesV1_1.h>
+
+using namespace CommsDat;
+
+// FORWARD DECLARATIONS
+
+// CONSTANTS
+
+// WLAN Service Table
+const TMDBElementId KCDTIdWlanServiceId        = 0x00030000;
+const TMDBElementId KCDTIdWlanConnMode         = 0x00040000;
+   
+const TMDBElementId KCDTIdWlanSSID             = 0x00050000;
+const TMDBElementId KCDTIdWlanWepKey1          = 0x00060000;
+const TMDBElementId KCDTIdWlanWepKey2          = 0x00070000;
+const TMDBElementId KCDTIdWlanWepKey3          = 0x00080000;
+const TMDBElementId KCDTIdWlanWepKey4          = 0x00090000;
+const TMDBElementId KCDTIdWlanWepIndex         = 0x000A0000;
+const TMDBElementId KCDTIdWlanSecMode          = 0x000B0000;
+const TMDBElementId KCDTIdWlanAuthMode         = 0x000C0000;
+const TMDBElementId KCDTIdWlanEnableWpaPsk     = 0x000D0000;
+const TMDBElementId KCDTIdWlanWpaPreSharedKey  = 0x000E0000;
+
+const TMDBElementId KCDTIdWlanWpaKeyLength     = 0x000F0000;
+const TMDBElementId KCDTIdWlanEaps             = 0x00100000;
+const TMDBElementId KCDTIdWlanScanSSID         = 0x00110000;
+const TMDBElementId KCDTIdWlanChannelID        = 0x00120000;
+const TMDBElementId KCDTIdWlanUsedSSID         = 0x00130000;
+const TMDBElementId KCDTIdWlanFormatKey1       = 0x00140000;
+const TMDBElementId KCDTIdWlanFormatKey2       = 0x00150000;
+const TMDBElementId KCDTIdWlanFormatKey3       = 0x00160000;
+const TMDBElementId KCDTIdWlanFormatKey4       = 0x00170000;
+
+const TMDBElementId KCDTIdWlanAllowSSIDRoaming = 0x00180000;
+
+const TMDBElementId KCDTIdWlanEnabledEaps      = 0x00190000;
+const TMDBElementId KCDTIdWlanDisabledEaps     = 0x001A0000;
+
+
+// WLAN Device Settings Table
+const TMDBElementId KCDTIdTableVersion              = 0x00030000;
+
+const TMDBElementId KCDTIdWlanDeviceSettingsType    = 0x00040000;
+const TMDBElementId KCDTIdBgScanInterval            = 0x00050000;
+
+const TMDBElementId KCDTIdUseDefaultSettings        = 0x00060000;
+const TMDBElementId KCDTIdWlanLongRetry             = 0x00070000;
+const TMDBElementId KCDTIdWlanShortRetry            = 0x00080000;
+const TMDBElementId KCDTIdWlanRTSThreshold          = 0x00090000;
+const TMDBElementId KCDTIdTxPowerLevel              = 0x000A0000;
+const TMDBElementId KCDTIdAllowRadioMeasurements    = 0x000B0000;
+const TMDBElementId KCDTIdWlanPowerMode             = 0x000C0000;
+
+const TMDBElementId KCDTIdSavedBgScanInterval       = 0x000D0000;
+
+// WLAN Secondary SSID Table
+const TMDBElementId KCDTIdWlanSecSSIDServiceId      = 0x00030000;
+const TMDBElementId KCDTIdWlanSecSSIDName           = 0x00040000;
+
+const TMDBElementId KCDTIdWlanSecSSIDScannedSSID    = 0x00050000;
+const TMDBElementId KCDTIdWlanSecSSIDUsedSSID       = 0x00060000;
+const TMDBElementId KCDTIdWlanSecSSIDId             = 0x00070000;
+
+// WLAN Destination Network Table
+const TMDBElementId KCDTIdDestNwShowRoaming         = 0x00030000;
+const TMDBElementId KCDTIdDestNwAccessNwId          = 0x00040000;
+
+//Default Connection
+const CommsDat::TMDBElementId KCDTIdDefConnType         = 0x00120000;
+const CommsDat::TMDBElementId KCDTIdDefConnUid          = 0x00130000;
+const CommsDat::TMDBElementId KCDTIdUsageOfWlan         = 0x00150000;
+const CommsDat::TMDBElementId KCDTIdSeamlessnessHome    = 0x00170000;
+const CommsDat::TMDBElementId KCDTIdSeamlessnessVisitor = 0x00180000;
+
+#endif      // TABLE_FIELDS_H
+
+// End of File.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/commsdat_wlan_api/inc/wlancdbcols.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,123 @@
+/*
+* Copyright (c) 2004 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: 
+*      Database table and column names for WLAN related Commsdb data.   
+*      
+*
+*/
+
+
+#ifndef WLAN_CDB_COLS_H
+#define WLAN_CDB_COLS_H
+
+// ---------------------------------------------------------
+//
+// WLAN Service Table
+//
+// ---------------------------------------------------------
+
+#define WLAN_SERVICE                _S("WLANServiceTable")
+
+// WLAN Table rows
+#define WLAN_SERVICE_ID             _S("ServiceID")                 // to which iap these settings belong to
+
+// Columns for WLAN security table
+#define WLAN_CONNECTION_MODE        _S("WlanConnectionMode")
+#define NU_WLAN_SSID                _S("WlanSSID")
+#define NU_WLAN_WEP_KEY1            _S("WlanWepKey1InHex")
+#define NU_WLAN_WEP_KEY2            _S("WlanWepKey2InHex")
+#define NU_WLAN_WEP_KEY3            _S("WlanWepKey3InHex")
+#define NU_WLAN_WEP_KEY4            _S("WlanWepKey4InHex")
+#define WLAN_WEP_KEY1_FORMAT        _S("WlanWepKey1Format")
+#define WLAN_WEP_KEY2_FORMAT        _S("WlanWepKey2Format")
+#define WLAN_WEP_KEY3_FORMAT        _S("WlanWepKey3Format")
+#define WLAN_WEP_KEY4_FORMAT        _S("WlanWepKey4Format")
+#define WLAN_WEP_INDEX              _S("WlanWepKeyIndex")        
+
+#define WLAN_SECURITY_MODE          _S("WlanSecurityMode")          // Encryption type
+#define NU_WLAN_AUTHENTICATION_MODE _S("WlanAuthenticationMode")    // authentication type, none, wep, wpa, wpapresharedkey
+
+#define WLAN_ENABLE_WPA_PSK         _S("UseWpaPreSharedKey")
+#define WLAN_WPA_PRE_SHARED_KEY     _S("WlanWpaPreSharedKey")       // Shared key
+#define WLAN_WPA_KEY_LENGTH         _S("WlanWpaKeyLength")          // Key length
+#define WLAN_EAPS                   _S("WlanEapList")
+#define WLAN_SCAN_SSID              _S("WlanScanSSID")
+#define NU_WLAN_CHANNEL_ID          _S("WlanChannelId")
+#define WLAN_USED_SSID              _S("WlanUsedSSID")
+
+#define WLAN_ALLOW_SSID_ROAMING     _S("WlanAllowSSIDRoaming")
+
+#define WLAN_ENABLED_EAPS           _S("WlanEnabledEapList")
+#define WLAN_DISABLED_EAPS          _S("WlanDisabledEapList")
+
+
+#define KWlanWpaPskLength           64
+
+#define WLAN_WEP_NOT_IN_USE         -1
+
+
+// ---------------------------------------------------------
+//
+// WLAN Device Settings
+//
+// ---------------------------------------------------------
+// Ids for Wlan settings type.
+#define KWlanDefaultSettings                    0
+#define KWlanUserSettings                       1
+
+#define WLAN_DEVICE_SETTINGS                    _S("WLANDeviceTable")
+#define WLAN_TABLE_VERSION                      _S("Version")
+
+#define WLAN_DEVICE_SETTINGS_TYPE               _S("WlanDeviceSettingsType")
+
+#define WLAN_BG_SCAN_INTERVAL                   _S("WlanBgScanInterval")
+#define WLAN_SAVED_BG_SCAN_INTERVAL             _S("WlanSavedBgScanInterval")
+
+#define WLAN_USE_DEFAULT_SETTINGS               _S("WlanUseDefaultSettings")
+#define WLAN_LONG_RETRY                         _S("WlanLongRetry")
+#define WLAN_SHORT_RETRY                        _S("WlanShortRetry")
+#define WLAN_RTS_THRESHOLD                      _S("WlanRTS")
+#define NU_WLAN_TX_POWER_LEVEL                  _S("WlanTxPowerLevel")
+#define WLAN_ALLOW_RADIO_MEASUREMENTS           _S("AllowRadioMeasurements")
+#define WLAN_POWER_MODE                         _S("WlanPowerMode")
+
+
+
+// ---------------------------------------------------------
+//
+// WLAN Secondary SSID table
+//
+// ---------------------------------------------------------
+// table name
+#define WLAN_SECONDARY_SSID                     _S("SecondarySSID")
+// table fields
+#define WLAN_SEC_SSID_SERVICE_ID                _S("ServiceId")
+#define WLAN_SEC_SSID_NAME                      _S("SecSSIDName")
+#define WLAN_SEC_SSID_SCANNED_SSID              _S("ScannedSSID")
+#define WLAN_SEC_SSID_USED_SSID                 _S("UsedSSID")
+#define WLAN_SEC_SSID_ID                        _S("SecSSIDID")
+
+// ---------------------------------------------------------
+//
+// Destination Network table
+//
+// ---------------------------------------------------------
+// table name
+#define DEST_NETWORK                            _S("DestinationNetwork")
+// table fields
+#define DEST_NW_SHOW_ROAMING                    _S("ShowRoaming")
+#define DEST_NW_ACCESS_NWID                     _S("AccessNWID")
+
+
+#endif 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/commsdat_wlan_api/inc/wlancontainer.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,175 @@
+/*
+* Copyright (c) 2004 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:  WLAN table container class.
+*
+*/
+
+
+
+#ifndef WLAN_CONTAINER_H
+#define WLAN_CONTAINER_H
+
+
+// INCLUDES
+#include <e32base.h>
+#include <Metadatabase.h>
+#include <CommsDatTypesV1_1.h>
+#include <cmmanagertablefields.h>
+
+// FORWARD DECLARATIONS
+
+// CONSTANTS
+
+using namespace CommsDat;
+
+
+// CLASS DECLARATION
+
+
+/**
+ *  Class representing records in the WLAN Service table
+ *  @since Series60_3.2
+ */
+NONSHARABLE_CLASS( CCDWlanServiceRecord ) : public CCDRecordBase
+    {
+	public:
+	IMPORT_C CCDWlanServiceRecord( TMDBElementId aElementId );
+
+    IMPORT_C const SRecordTypeInfo* GetRecordInfo();
+	
+    IMPORT_C static TMDBElementId CreateTableL( CMDBSession& aSession );
+    IMPORT_C static TMDBElementId TableIdL( CMDBSession& aSession );
+
+	DATA_VTABLE
+		
+	public:
+	CMDBField<TUint>    iWlanServiceId;
+	CMDBField<TUint>    iWlanConnMode;
+	CMDBField<TDesC>    iWLanSSID;
+	CMDBField<TDesC>    iWLanUsedSSID;
+	CMDBField<TDesC8>   iWLanWepKey1;
+	CMDBField<TDesC8>   iWLanWepKey2;
+	CMDBField<TDesC8>   iWLanWepKey3;
+	CMDBField<TDesC8>   iWLanWepKey4;
+	CMDBField<TUint>    iWlanWepIndex;
+    CMDBField<TUint>    iWlanSecMode;
+    CMDBField<TUint>    iWlanAuthMode;
+    CMDBField<TUint>    iWlanEnableWpaPsk;
+    CMDBField<TDesC8>   iWLanWpaPreSharedKey;
+    CMDBField<TUint>    iWlanWpaKeyLength;
+    CMDBField<TDesC>    iWLanEaps;
+    CMDBField<TBool>    iWlanScanSSID;
+    CMDBField<TUint>    iWlanChannelID;
+    CMDBField<TUint>    iWlanFormatKey1;
+    CMDBField<TUint>    iWlanFormatKey2;
+    CMDBField<TUint>    iWlanFormatKey3;
+    CMDBField<TUint>    iWlanFormatKey4;
+    CMDBField<TBool>    iWlanAllowSSIDRoaming;
+    CMDBField<TDesC8>   iWLanEnabledEaps;   // binary
+    CMDBField<TDesC8>   iWLanDisabledEaps;  // binary
+
+	private:
+	
+		static const SRecordTypeInfo iRecordInfo[];
+    };
+
+/**
+ * Wlan Device settings record.
+ * @since Series60_3.2
+ */
+NONSHARABLE_CLASS( CCDWlanDeviceSettingsRecord ) : public CCDRecordBase
+    {
+	public:
+	IMPORT_C CCDWlanDeviceSettingsRecord( TMDBElementId aElementId );
+
+	IMPORT_C const SRecordTypeInfo* GetRecordInfo();
+	
+    IMPORT_C static TMDBElementId CreateTableL( CMDBSession& aSession );
+    IMPORT_C static TMDBElementId TableIdL( CMDBSession& aSession );
+
+	DATA_VTABLE
+		
+	public:
+	CMDBField<TUint>    iTableVersion;
+	CMDBField<TUint>    iWlanDeviceSettingsType;
+	CMDBField<TUint>    iBgScanInterval;
+	CMDBField<TUint>    iSavedBgScanInterval;
+	CMDBField<TBool>    iUseDefaultSettings;
+	CMDBField<TUint>    iWlanLongRetry;
+	CMDBField<TUint>    iWlanShortRetry;
+	CMDBField<TUint>    iWlanRTSThreshold;
+	CMDBField<TUint>    iTxPowerLevel;
+	CMDBField<TBool>    iAllowRadioMeasurements;
+	CMDBField<TBool>    iWlanPowerMode;
+
+	private:
+	
+		static const SRecordTypeInfo iRecordInfo[];
+    };
+
+/**
+ * Wlan Secure SSID record
+ * @since Series60_3.2
+ */
+NONSHARABLE_CLASS( CCDWLANSecSSIDTable ) : public CCDRecordBase
+    {
+	public:
+	IMPORT_C CCDWLANSecSSIDTable( TMDBElementId aElementId );
+
+	IMPORT_C const SRecordTypeInfo* GetRecordInfo();
+	
+    IMPORT_C static TMDBElementId CreateTableL( CMDBSession& aSession );
+    IMPORT_C static TMDBElementId TableIdL( CMDBSession& aSession );
+
+	DATA_VTABLE
+		
+	public:
+	CMDBField<TUint>    iWlanSecSSIDServiceId;
+	CMDBField<TDesC>    iWlanSecSSIDName;
+	CMDBField<TDesC>    iWlanSecSSIDScannedSSID;
+	CMDBField<TDesC>    iWlanSecSSIDUsedSSID;
+	CMDBField<TUint>    iWlanSecSSIDId;
+
+	private:
+	
+		static const SRecordTypeInfo iRecordInfo[];
+    };
+
+/**
+ * Destination Network record
+ * @since Series60_3.2
+ */
+NONSHARABLE_CLASS( CCDDestNWTable ) : public CCDRecordBase
+    {
+	public:
+	IMPORT_C CCDDestNWTable( TMDBElementId aElementId );
+
+	IMPORT_C const SRecordTypeInfo* GetRecordInfo();
+	
+    IMPORT_C static TMDBElementId CreateTableL( CMDBSession& aSession );
+    IMPORT_C static TMDBElementId TableIdL( CMDBSession& aSession );
+
+	DATA_VTABLE
+		
+	public:
+	CMDBField<TUint>    iDestNwShowRoaming;
+	CMDBField<TDesC>    iDestNwAccessNwId;
+
+	private:
+	
+		static const SRecordTypeInfo iRecordInfo[];
+    };
+#endif      // WLAN_CONTAINER_H
+
+// End of File.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/connection_monitor_extension_api/connection_monitor_extension_api.metaxml	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,18 @@
+<?xml version="1.0" ?>
+<api id="dd6dec7da0c17441af206ece30de10df" dataversion="1.0">
+  <name>Connection Monitor Extension API</name>
+  <description>Provides bearer specific connection monitoring extensions a way to supply bearer specific connection monitoring information to Connection Monitor Server's clients.</description>
+  <type>c++</type>
+  <subsystem>connectionmonitoring</subsystem>
+  <libs>
+    <lib name="ConnMonExt.lib" />
+  </libs>
+  <release category="domain"/>
+  <attributes>
+     <!-- This indicates wether the api provedes separate html documentation -->
+     <!-- or is the additional documentation generated from headers. -->
+     <!-- If you are unsuere then the value is "no" -->
+     <htmldocprovided>yes</htmldocprovided>
+     <adaptation>no</adaptation>
+  </attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/connection_monitor_extension_api/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* 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:  File that exports the files belonging to Connection
+*                Monitor Extension API.
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/ConnMonExt.h     MW_LAYER_PLATFORM_EXPORT_PATH(ConnMonExt.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/connection_monitor_extension_api/inc/ConnMonExt.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,325 @@
+/*
+* Copyright (c) 2004-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:  CConnectionMonitorPlugin provides an interface for an engine
+*                to provide bearer specific information to the Connection
+*                Monitor server.
+*
+*/
+
+#ifndef __CONNMONEXT_H
+#define __CONNMONEXT_H
+
+#include <e32base.h>
+#include <rconnmon.h>
+
+const TInt KPluginMajorVersionNumber=1;
+const TInt KPluginMinorVersionNumber=1;
+const TInt KPluginBuildVersionNumber=1;
+
+
+class CPluginAO;
+
+void Panic( TInt aPanic );
+
+/**
+ * MConnectionMonitorPluginInterface
+ * MConnectionMonitorPluginInterface is an interface class that must be implemented
+ * in order to serve the requests initiated by the Connection Monitor server.
+ *
+ * @lib CONNMONEXT.LIB
+ */
+class MConnectionMonitorPluginInterface
+    {
+public:
+    /**
+     * GetIntAttribute is called to get the value of a TInt attribute.
+     * @param aAttribute Identifies the attribute to be retrived.
+     * @param aValue On return, contains the requested TInt attribute.
+     * @return KErrNone if successful, a system-wide error code if not.
+     */
+    virtual TInt GetIntAttribute( const TUint aAttribute, TInt& aValue ) =0;
+
+    /**
+     * GetUintAttribute is called to get the value of a TUint attribute.
+     * @param aAttribute Identifies the attribute to be retrived.
+     * @param aValue On return, contains the requested TUint attribute.
+     * @return KErrNone if successful, a system-wide error code if not.
+     */
+    virtual TInt GetUintAttribute( const TUint aAttribute, TUint& aValue ) =0;
+
+    /**
+     * GetBoolAttribute is called to get the value of a TBool attribute.
+     * @param aAttribute Identifies the attribute to be retrived.
+     * @param aValue On return, contains the requested TBool attribute.
+     * @return KErrNone if successful, a system-wide error code if not.
+     */
+    virtual TInt GetBoolAttribute( const TUint aAttribute, TBool& aValue ) =0;
+
+    /**
+     * GetStringAttribute is called to get the value of a TDes attribute.
+     * @param aAttribute Identifies the attribute to be retrived.
+     * @param aValue On return, contains the requested TDes attribute.
+     * @return KErrNone if successful, a system-wide error code if not.
+     */
+    virtual TInt GetStringAttribute( const TUint aAttribute, TDes& aValue ) =0;
+
+    /**
+     * GetPckgAttribute is called to get the value of a packaged attribute.
+     * @param aAttribute Identifies the attribute to be retrived.
+     * @param aValue On return, contains the requested packaged attribute.
+     * @return KErrNone if successful, a system-wide error code if not.
+     */
+    virtual TInt GetPckgAttribute( const TUint aAttribute, TDes8& aValue ) =0;
+
+    /**
+     * SetIntAttribute is called to set the value of a TInt attribute.
+     * @param aAttribute Identifies the attribute to be set.
+     * @param aValue The new value for the TInt attribute.
+     * @return KErrNone if successful, a system-wide error code if not.
+     */
+    virtual TInt SetIntAttribute( const TUint aAttribute, const TInt aValue ) =0;
+
+    /**
+     * SetUintAttribute is called to set the value of a TUint attribute.
+     * @param aAttribute Identifies the attribute to be set.
+     * @param aValue The new value for the TUint attribute.
+     * @return KErrNone if successful, a system-wide error code if not.
+     */
+    virtual TInt SetUintAttribute( const TUint aAttribute, const TUint aValue ) =0;
+
+    /**
+     * SetBoolAttribute is called to set the value of a TBool attribute.
+     * @param aAttribute Identifies the attribute to be set.
+     * @param aValue The new value for the TBool attribute.
+     * @return KErrNone if successful, a system-wide error code if not.
+     */
+    virtual TInt SetBoolAttribute( const TUint aAttribute, const TBool aValue ) =0;
+
+    /**
+     * SetStringAttribute is called to set the value of a TDes attribute.
+     * @param aAttribute Identifies the attribute to be set.
+     * @param aValue The new value for the TDes attribute.
+     * @return KErrNone if successful, a system-wide error code if not.
+     */
+    virtual TInt SetStringAttribute( const TUint aAttribute, const TDes& aValue ) =0;
+
+    /**
+     * SetPckgAttribute is called to set the value for a packaged attribute.
+     * @param aAttribute Identifies the attribute to be set.
+     * @param aValue The new value for the packaged attribute.
+     * @return KErrNone if successful, a system-wide error code if not.
+     */
+    virtual TInt SetPckgAttribute( const TUint aAttribute, const TDes8& aValue ) =0;
+    };
+
+/**
+ * RConnMonPlugin
+ * Plug-in subsession.
+ * @lib CONNMONEXT.LIB
+ */
+class RConnMonPlugin : public RSubSessionBase
+    {
+public:
+    /**
+     * Opens a plug-in subsession to the Connection Monitor server. It must
+     * be called before any of other methods during the subsession.
+     * @param aSession Connection Monitor session (RConnectionMonitor) object.
+     * @param aConnectionId Bearer specific general connection id that
+     * identifies the plug-in. See TConnMonBearerId (rconnmon.h).
+     * @return KErrNone if succesfull, a system-wide error code if not.
+     */
+    TInt Open( RConnectionMonitor &aSession, const TUint aConnectionId );
+
+    /**
+     * Closes plug-in subsession from the Connection Monitor server.
+     * @return void.
+     */
+    void Close();
+
+    /**
+     * Returns the version information.
+     * @return void.
+     */
+    TVersion Version() const;
+
+    /**
+     * Registers an attribute to the Connection monitor server.
+     * @param aAttribute Attribute identifier.
+     * @return KErrNone if succesfull, a system-wide error code if not.
+     */
+    TInt RegisterAttribute( const TUint aAttribute ) const;
+
+    /**
+     * Cancels the attribute registration from the Connection monitor server.
+     * @param aAttribute Attribute identifier.
+     * @return KErrNone if succesfull, a system-wide error code if not.
+     */
+    TInt CancelRegisterAttribute( const TUint aAttribute ) const;
+
+    /**
+     * Sends an event to the Connection Monitor server.
+     * @param aEventId Event identifier.
+     * @param aData Event data.
+     * @param aSize Size of the event data. This must not exceed 512 bytes.
+     * @return KErrNone if succesfull, a system-wide error code if not.
+     */
+    TInt SendEvent( const TUint aEventId, const TAny* aData, const TUint aSize ) const;
+
+    /**
+     * Gets the next attribute request from the Connection Monitor server.
+     * @param aBuffer Query record in buffer.
+     * @param aStatus On completion, KErrNone if successfull, a system-wide error code if not.
+     * @return void.
+     */
+    void GetQuery( TDes8& aBuffer, TRequestStatus& aStatus ) const;
+
+     /**
+     * Cancels the attribute request from the Connection Monitor server.
+     * @return void.
+     */
+    void CancelGetQuery() const;
+
+    /**
+     * Sends an attribute to the Connection Monitor server.
+     * @param aType Type of the attribute (TInt, TUint, TBool, TDes, TDes8).
+     * @param aAttribute Attribute identifier.
+     * @param aRet The plug-in return code.
+     * @param aValue The value of the attribute.
+     * @param aSize Size of the attribute. This must not exceed 512 bytes.
+     * @return KErrNone if succesfull, a system-wide error code if not.
+     */
+    TInt SendAttribute(
+            const TInt aType,
+            const TUint aAttribute,
+            const TInt aRet,
+            const TAny* aValue,
+            const TUint aSize ) const;
+    };
+
+/**
+ * CConnectionMonitorPlugin
+ * @lib CONNMONEXT.LIB
+ */
+class CConnectionMonitorPlugin : public CBase, public MConnectionMonitorPluginInterface
+    {
+public:
+    IMPORT_C CConnectionMonitorPlugin();
+    IMPORT_C virtual ~CConnectionMonitorPlugin();
+
+public:
+    /**
+     * Registers the plug-in to the Connection Monitor Server. It must be called
+     * before any of other methods during the plug-in's session.
+     * @param aConnectionId Bearer specific general connection id that
+     * identifies the plug-in. See TConnMonBearerId (rconnmon.h).
+     * @return void
+     */
+    IMPORT_C void RegisterPluginL( const TUint aConnectionId );
+
+    /**
+     * Unregisters the plug-in from the Connection Monitor server.
+     * @return void
+     */
+    IMPORT_C void CancelRegisterPlugin();
+
+    /**
+     * Registers a new attribute to the Connection Monitor server.
+     * @param aAttribute Attribute identifier.
+     * @return void
+     */
+    IMPORT_C TInt RegisterAttribute( const TUint aAttribute ) const;
+
+    /**
+     * Cancels the attribute registration from the Connection Monitor server.
+     * @param aAttribute Attribute identifier.
+     * @return void
+     */
+    IMPORT_C void CancelRegisterAttribute( const TUint aAttribute ) const;
+
+    /**
+     * Sends an event to the Connection Monitor server.
+     * @param aEventId Event identifier.
+     * @param aData Event data.
+     * @param aSize Size of the event data. This must not exceed 512 bytes.
+     * @return void
+     */
+    IMPORT_C TInt Event( const TUint aEventId, const TAny* aData, const TUint aSize ) const;
+
+    /**
+     * Returns the version info.
+     * @return Version information.
+     */
+    IMPORT_C TVersion Version() const;
+
+private:
+    RConnectionMonitor iConnMonServer;
+    RConnMonPlugin iSession;
+    CPluginAO* iPluginAO;
+    };
+
+/**
+ * TReqInfo
+ * @lib CONNMONEXT.LIB
+ */
+class TReqInfo
+    {
+public:
+    inline void Reset(){ iType = 0; iAttribute = 0; iData = 0; }
+public:
+    TInt iType;
+    TUint iAttribute;
+    TInt iData;
+    };
+
+/**
+ * CPluginAO
+ * @lib CONNMONEXT.LIB
+ */
+NONSHARABLE_CLASS( CPluginAO ) : public CActive
+    {
+public:
+    CPluginAO( RConnMonPlugin& aSession, CConnectionMonitorPlugin& aPlugin );
+    void ConstructL();
+    virtual ~CPluginAO();
+
+public:
+    void ReceiveQuery();
+
+private:
+    /**
+     * From CActive Cancels the asyncronous request.
+     * @return void
+     */
+    void DoCancel();
+
+    /**
+     * From CActive Handles the the request that has arrived from server.
+     * @return void
+     */
+    void RunL();
+
+private:
+    RConnMonPlugin& iSession;
+    CConnectionMonitorPlugin& iPlugin;
+
+    // Event information
+    TReqInfo iReqInfo;
+
+    // Needed in inter-thread reads/writes
+    TPtr8 iBuf;
+    };
+
+#endif //__CONNMONEXT_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/connection_ui_utilities_api/connection_ui_utilities_api.metaxml	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,18 @@
+<?xml version="1.0" ?>
+<api id="67a65ff10e010cf2bfde4f4bf0369337" dataversion="1.0">
+  <name>Connection UI Utilities API</name>
+  <description>Provides miscellaneous networking UI services (eg. Roaming notifiers, Connecting notes, Progress notes ...).</description>
+  <type>c++</type>
+  <subsystem>networkingutilities</subsystem>
+  <libs>
+    <lib name="ConnectionUiUtilities.lib" />
+  </libs>
+  <release category="domain"/>
+  <attributes>
+     <!-- This indicates wether the api provedes separate html documentation -->
+     <!-- or is the additional documentation generated from headers. -->
+     <!-- If you are unsuere then the value is "no" -->
+     <htmldocprovided>yes</htmldocprovided>
+     <adaptation>no</adaptation>
+  </attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/connection_ui_utilities_api/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* 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:  File that exports the files belonging to 
+:                Connection UI Utilities API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/ConnectionUiUtilities.h     MW_LAYER_PLATFORM_EXPORT_PATH(ConnectionUiUtilities.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/connection_ui_utilities_api/inc/ConnectionUiUtilities.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,615 @@
+/*
+* Copyright (c) 2002 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: 
+*     Declares the main handler, CConnectionUiUtilities and public API for the
+*     Connection Ui Utilities.
+*
+*/
+
+
+#ifndef CONNECTIONUIUTILITIES_H
+#define CONNECTIONUIUTILITIES_H
+
+// INCLUDES
+
+#include <e32base.h>
+#include <wlanmgmtcommon.h>
+
+
+// FORWARD DECLARATIONS
+class CConnectionUiUtilitiesImpl;
+class TConnectionPrefs;
+
+
+// CONSTANT DECLARATIONS
+
+
+// TYPE DECLARATIONS
+
+enum TCuuAlwaysAskResults
+    {
+    ECuuAlwaysAsk = 0,
+    ECuuUserDefined        
+    };
+    
+
+enum TMsgQueryLinkedResults
+    {
+    EMsgQueryCancelled = 0,     // Message query was cancelled
+    EMsgQueryAutomatically,     
+    EMsgQueryThisTime
+    };
+    
+
+// CLASS DECLARATION
+/*
+* Connection Ui Utilities, it is a set of Miscellaneous networking related 
+* ui functions
+* Proxy around the real implementation in CConnectionUiUtilitiesUiImpl. 
+* No details of the actual data are exposed.
+*/
+NONSHARABLE_CLASS( CConnectionUiUtilities ) : public CBase
+    {
+
+    public: // Constructors and destructor
+
+        /**
+        * Two-phased constructor. Leaves on failure.
+        * @return The constructed CConnectionUiUtilities object.
+        */
+        IMPORT_C static CConnectionUiUtilities* NewL();
+
+
+        /**
+        * Destructor.
+        */
+        IMPORT_C ~CConnectionUiUtilities();
+
+
+    public:     // New methods
+
+        /**
+        * @param aResult contains ECuuAlwaysAsk if always ask radio button 
+        * was selected, and ECuuUserDefined if user defined 
+        * radio button was selected by user
+        * It acts also as input parameter to default this setting.
+        * @return ETrue if OK Soft key was pressed, 
+        * EFalse if Cancel Soft key was selected on the dialog.
+        */
+        IMPORT_C TBool AlwaysAskPageL( TCuuAlwaysAskResults& aResult );
+                
+        /**
+        * @param aIAPId specifies the IAP to be excluded from the list
+        * @param aIAPId gives back the iapid of selected connection
+        * @param aPrefs Specifies the rank and desired direction and bearer
+        * of the connections will appear in the dialog
+        * @return ETrue if Select Soft key was pressed, 
+        * EFalse if Cancel Soft key was selected on the dialog.
+        */        
+        IMPORT_C TBool ChangeConnectionL( TUint32& aIAPId, 
+                                          TConnectionPrefs aPrefs );
+        /**
+        * Pops up an information note, about connection is changed to 
+        * the given accespont
+        * @param aIAPId The id of access point which has been selected.
+        */
+        IMPORT_C void  ShowConnectionChangedNoteL( const TUint32& aIAPId );
+        
+        /**
+        * Pops up discreet popup indicating that connection is being
+        * established to the given access point.
+        * This method should only be used from the MPM in order to provide
+        * a consistent popup behavior across the platform.
+        * @param aIAPId The id of the access point.
+        * @param aConnectionActive is connection already active.
+        */
+        IMPORT_C void ConnectingViaDiscreetPopup( const TUint32& aIAPId, TBool aConnectionAlreadyActive );
+
+        /**
+        * Pops up a discreet popup indicating a connection error.
+        * Only appropriate error codes show the popup, otherwise
+        * (such as with general errors) the popup is not shown.
+        * This method should only be used from the MPM in order to provide
+        * a consistent popup behavior across the platform.
+        * @param aErrCode Symbian error code.
+        */
+        IMPORT_C void ConnectionErrorDiscreetPopup( const TInt& aErrorCode );
+        
+        /**
+        * Notifier. Search available WLAN networks, and user can select one of
+        * them
+        * @param aSSID the id of selected wlan network
+        * @return ETrue if user selected one of networks, EFalse if an error
+        * is occured or user does not select a network.
+        */
+        IMPORT_C TBool SearchWLANNetwork( TWlanSsid& aSSID );
+
+        /**
+        * Cancel SearchWLANNetwork
+        */
+        IMPORT_C void  CancelSearchWLANNetwork();
+
+        
+        /**
+        * Notifier. Shows a query, "Do you want to create a WLAN connection in 
+        * Off-line mode?"
+        * @return ETrue if user select Yes, EFalse otherwise
+        */
+        IMPORT_C TBool OffLineWlanNote();
+        
+        /**
+        * Cancel OffLineWlan Note
+        */
+        IMPORT_C  void CancelOffLineWlanNote();
+        
+        /**
+        * Notifier. Pops up an information note: 
+        * "Operation not possible in Off-line mode"
+        */        
+        IMPORT_C void OffLineWlanDisabledNote();               
+
+        /**
+        * @deprecated
+        *
+        * Use TBool EasyWepDlg( TDes* aKey, TBool& aHex )!
+        *
+        * Notifier. Shows a data query, "Enter WEP key for WLAN" 
+        * @param aKey Key entered by user. Default value can be passed
+        * @return ETrue if user select OK, EFalse otherwise
+        */
+        IMPORT_C TBool EasyWepDlg( TDes* aKey );
+        
+        /**
+        * Cancel Easy Wep dialog
+        */
+        IMPORT_C  void CancelEasyWepDlg();
+
+        /**
+        * Notifier. Shows a data query, "Enter pre-shared key for WLAN" 
+        * @param aKey Key entered by user. Default value can be passed
+        * @return ETrue if user select OK, EFalse otherwise
+        */
+        IMPORT_C TBool EasyWpaDlg( TDes* aKey );
+
+        /**
+        * Notifier. Shows a data query, "Enter pre-shared key for WLAN" 
+        * Async version
+        * @param aStatus caller's TRequestStatus to handle asynchronous call.        
+        * @param aKey Key entered by user. Default value can be passed
+        */
+        IMPORT_C void EasyWpaDlg( TRequestStatus& aStatus, TDes* aKey );
+                
+        /**
+        * Cancel Easy Wpa dialog
+        */
+        IMPORT_C  void CancelEasyWpaDlg();
+
+        /**
+        * Notifier. Seatrch available WLAN networks, and user can select one 
+        * of them
+        * @param aSSID the id of selected wlan network
+        * @param aConnectionMode connection mode of selected wlan network
+        * @param aSecurityMode security mode of selected wlan network
+        * @return ETrue if user selected one of networks, EFalse if an error
+        * is occured or user does not select a network.
+        */
+        IMPORT_C TBool SearchWLANNetwork
+            (
+            TWlanSsid& aSSID, 
+            TWlanConnectionMode& aConnectionMode,
+            TWlanConnectionSecurityMode& aSecurityMode
+            );
+            
+        /**
+        * Notifier. Search available WLAN networks, and user can select one 
+        * of them
+        * @param aSSID the id of selected wlan network
+        * @param aConnectionMode connection mode of selected wlan network
+        * @param aExtendedSecurityMode extended security mode of selected wlan network
+        * @return ETrue if user selected one of networks, EFalse if an error
+        * is occured or user does not select a network.
+        */
+        IMPORT_C TBool SearchWLANNetwork
+            (
+            TWlanSsid& aSSID, 
+            TWlanConnectionMode& aConnectionMode,
+            TWlanConnectionExtentedSecurityMode& aExtendedSecurityMode
+            );    
+
+        /**
+        * Notifier. Shows a data query, "Enter WEP key for WLAN" 
+        * @param aKey Key entered by user. Default value can be passed
+        * @param aHex Returns ETrue if user entered hexadecimal key, 
+        * EFalse, if user entered ASCII key
+        * @return ETrue if user pressed OK, EFalse otherwise
+        */
+        IMPORT_C TBool EasyWepDlg( TDes* aKey, TBool& aHex );
+        
+        /**
+        * Notifier. Shows a data query, "Enter WEP key for WLAN" 
+        * Async version
+        * @param aStatus caller's TRequestStatus to handle asynchronous call.
+        * @param aKey Key entered by user. Default value can be passed
+        * @param aHex Returns ETrue if user entered hexadecimal key, 
+        * EFalse, if user entered ASCII key
+        */
+        IMPORT_C void EasyWepDlg( TRequestStatus& aStatus, TDes* aKey, TBool& aHex );
+
+        /**
+        * Notifier. Pops up an information note: 
+        * "Selected WLAN network has no coverage"
+        */        
+        IMPORT_C void WLANNetworkUnavailableNote();               
+
+        /**
+        * Notifier. Search available WLAN networks, and user can select one of
+        * them. Totally synchronous version, to be used from Engines, not from
+        * UIs
+        * @param aSSID the id of selected wlan network
+        * @param aConnectionMode connection mode of selected wlan network
+        * @param aSecurityMode security mode of selected wlan network
+        * @return ETrue if user selected one of networks, EFalse if an error
+        * is occured or user does not select a network.
+        */
+        IMPORT_C TBool SearchWLANNetworkSync
+            (
+            TWlanSsid& aSSID, 
+            TWlanConnectionMode& aConnectionMode,
+            TWlanConnectionSecurityMode& aSecurityMode
+            );
+
+        /**
+        * Notifier. Search available WLAN networks, and user can select one of 
+        * them. Totally asynchronous version, to be used from Engines, not 
+        * from UIs
+        * @param aStatus status object of notifier
+        * @param aSSID the id of selected wlan network
+        * @param aConnectionMode connection mode of selected wlan network
+        * @param aSecurityMode security mode of selected wlan network
+        * @return 
+        */
+        IMPORT_C void SearchWLANNetworkAsync( TRequestStatus& aStatus, 
+                                TWlanSsid& aSSID, 
+                                TWlanConnectionMode& aConnectionMode, 
+                                TWlanConnectionSecurityMode& aSecurityMode );
+                                
+        /**
+        * Notifier. Search available WLAN networks, and user can select one of 
+        * them. Totally asynchronous version, to be used from Engines, not 
+        * from UIs
+        * @param aStatus status object of notifier
+        * @param aSSID the id of selected wlan network
+        * @param aConnectionMode connection mode of selected wlan network
+        * @param aExtendedSecurityMode extended security mode of selected wlan network
+        * @return 
+        */
+        IMPORT_C void SearchWLANNetworkAsync( TRequestStatus& aStatus, 
+                    TWlanSsid& aSSID, 
+                    TWlanConnectionMode& aConnectionMode, 
+                    TWlanConnectionExtentedSecurityMode& aExtendedSecurityMode );                        
+
+        /**
+        * DEPRECATED, PLEASE USE ASYNC VERSION!
+        * Confirmation note is used after the connection has been successfully 
+        * established via destination and connection method.
+        * @param aDestId Id of used destination.
+        * @param aConnMId Id of used connection method.
+        */
+        IMPORT_C void ConnectedViaDestAndConnMethodNote( const TUint32 aDestId,
+                                                    const TUint32 aConnMId );
+
+        /**
+        * Confirmation note is used after the connection has been successfully 
+        * established via destination and connection method.
+        * @param aDestId Id of used destination.
+        * @param aConnMId Id of used connection method.
+        * @param aStatus caller's TRequestStatus to handle asynchronous call.
+        */
+        void ConnectedViaDestAndConnMethodNote( const TUint32 aDestId, 
+                                                const TUint32 aConnMId, 
+                                                TRequestStatus& aStatus );
+                                                    
+        /**
+        * Cancel ConnectedViaDestAndConnMethodNote notifier.
+        */
+        IMPORT_C void CancelConnectedViaDestAndConnMethodNote();
+
+        /**
+        * @deprecated
+        *
+        * Use void ReconnectToMethodQuery( const TUint32 aDestId, 
+        *                                  const TUint32 aConnMId, 
+        *                                  const TBool aNextBestExists,
+        *                                  TMsgQueryLinkedResults& aResult,
+        *                                  TRequestStatus& aStatus );
+        *
+        * Confirmation query is used when current method is lost and 
+        * connection is going to be established via another lower priority 
+        * method.
+        * @param aConnMId Id of used connection method.
+        * @param aResult Result of user selection, ETrue if user accepted 
+        * roaming, to less preferred method, EFlase otherwise
+        * @param aStatus Status object of notifier.
+        */
+        IMPORT_C void ReconnectToMethodQuery( const TUint32 aConnMId, 
+                                              TBool& aResult,
+                                              TRequestStatus& aStatus );
+        /**
+        * Cancel ReconnectToMethodQuery notifier.
+        */
+        IMPORT_C void CancelReconnectToMethodQuery();
+
+        /**
+        * @deprecated
+        *
+        * Use void RoamingToMorePrefMethodQuery( const TUint32 aDestId, 
+        *                                     const TUint32 aConnMId, 
+        *                                     const TBool aNextBestExists,
+        *                                     TMsgQueryLinkedResults& aResult,
+        *                                     TRequestStatus& aStatus );
+        *
+        * Confirmation query is used when more preferred method becomes 
+        * available
+        * @param aConnMId Id of used connection method.
+        * @param aResult Result of user selection, ETrue if user accepted 
+        * roaming, to more preferred method, EFlase otherwise
+        * @param aStatus Status object of notifier.
+        */
+        IMPORT_C void RoamingToMorePrefMethodQuery( const TUint32 aConnMId, 
+                                                    TBool& aResult,
+                                                    TRequestStatus& aStatus );
+        /**
+        * Cancel RoamingToMorePrefMethodQuery notifier.
+        */
+        IMPORT_C void CancelRoamingToMorePrefMethodQuery();
+
+        /**
+        * Information note is used when "Automatically" roaming is enabled. The
+        * actual connection establishment take places in the background 
+        * (no wait note).
+        * @param aConnMId Id of used connection method.
+        */
+        IMPORT_C void ChangingConnectionToNote( const TUint32 aConnMId );
+		
+		/**
+        * Information note is used when "Automatically" roaming is enabled. The
+        * actual connection establishment take places in the background 
+        * (no wait note). This is the asynchronous version of the previous one
+        * @param aConnMId Id of used connection method.
+        * @param aStatus Status object of the notifier
+        */
+        IMPORT_C void ChangingConnectionToNote( const TUint32 aConnMId, 
+        											TRequestStatus& aStatus );
+		
+        /**
+        * Cancel ChangingConnectionToNote notifier.
+        */
+        IMPORT_C void CancelChangingConnectionToNote();
+
+        /**
+        * @deprecated
+        *
+        * Use void ConfirmMethodUsageQuery( const TUint32 aDestId, 
+        *                                   const TUint32 aConnMId, 
+        *                                   const TBool aNextBestExists,
+        *                                   TMsgQueryLinkedResults& aResult,
+        *                                   TRequestStatus& aStatus );
+        *
+        * Notifier. Shows a query, "Connect to\n '%0U' via\n '%1U'?"
+        * @param aDestId Id of used destination.
+        * @param aConnMId Id of used connection method.
+        * @param aResult Result of user selection, ETrue if user accepted 
+        *                query, EFalse otherwise
+        * @param aStatus Status object of notifier.
+        */
+        IMPORT_C void ConfirmMethodUsageQuery( const TUint32 aDestId, 
+                                               const TUint32 aConnMId, 
+                                               TBool& aResult, 
+                                               TRequestStatus& aStatus );
+        
+        /**
+        * Cancel ConfirmMethodUsageQuery
+        */
+        IMPORT_C  void CancelConfirmMethodUsageQuery();
+
+        /**
+        * DEPRECATED, PLEASE USE ASYNC VERSION!
+        * Confirmation note is used after the connection has been successfully 
+        * established via a connection method.
+        * @param aConnMId Id of used connection method.
+        */
+        IMPORT_C void ConnectedViaConnMethodNote( const TUint32 aConnMId );
+
+        /**
+        * Confirmation note is used after the connection has been successfully 
+        * established via a connection method.
+        * @param aConnMId Id of used connection method.
+        * @param aStatus caller's TRequestStatus to handle asynchronous call.
+        */
+        void ConnectedViaConnMethodNote( const TUint32 aConnMId, 
+                                         TRequestStatus& aStatus );
+                                         
+        /**
+        * Cancel ConnectedViaConnMethodNote notifier.
+        */
+        IMPORT_C void CancelConnectedViaConnMethodNote();
+
+        /**
+        * Confirmation query is used when current method is lost and 
+        * connection is going to be established via another lower priority 
+        * method.
+        * @param aDestId Id of used destination.
+        * @param aConnMId Id of used connection method.
+        * @param aNextBestExists ETrue if there is another available CM inside
+        *                        the destination that could be used
+        * @param aResult Result of user selection
+        * @param aStatus Status object of notifier.
+        */
+        IMPORT_C void ReconnectToMethodQuery( const TUint32 aDestId, 
+                                              const TUint32 aConnMId, 
+                                              const TBool aNextBestExists,
+                                              TMsgQueryLinkedResults& aResult,
+                                              TRequestStatus& aStatus );
+
+        /**
+        * Confirmation query is used when more preferred method becomes 
+        * available
+        * @param aDestId Id of used destination.
+        * @param aConnMId Id of used connection method.
+        * @param aNextBestExists ETrue if there is another available CM inside
+        *                        the destination that could be used
+        * @param aResult Result of user selection
+        * @param aStatus Status object of notifier.
+        */
+        IMPORT_C void RoamingToMorePrefMethodQuery( const TUint32 aDestId, 
+                                            const TUint32 aConnMId, 
+                                            const TBool aNextBestExists,
+                                            TMsgQueryLinkedResults& aResult,
+                                            TRequestStatus& aStatus );
+
+        /**
+        * Notifier. Shows a query, "Connect to\n '%0U' via\n '%1U'?"
+        * @param aResult Result of user selection
+        * @param aHomeNetwork Home or foreign network.
+        * @param aStatus Status object of notifier
+        */
+        IMPORT_C void ConfirmMethodUsageQuery( TMsgQueryLinkedResults& aResult, 
+                                               const TBool aHomeNetwork,
+                                               TRequestStatus& aStatus );
+
+
+        /**
+        * Notifier. Shows a query, "Do you want to create a WLAN connection in 
+        * Off-line mode?"
+        * @param aStatus Status object of notifier.
+        */
+        IMPORT_C void OffLineWlanNote( TRequestStatus& aStatus );
+        
+        /**
+        * Notifier that displays "Power save test" information note.
+        * @param aDisable On completion, contains ETrue if user wants to disable
+        *                 the note in the future. EFalse otherwise. 
+        * @param aStatus KErrNone if successful, a system-wide error code if not.
+        */
+        IMPORT_C void WlanPowerSaveTestNote( TBool&          aDisable,
+                                             TRequestStatus& aStatus );
+        
+        /**
+        * Cancel WlanPowerSaveTestNote notifier.
+        */
+        IMPORT_C void CancelWlanPowerSaveTestNote();
+        
+        /**
+        * Notifier. Shows a data query prompting for WAPI pre-shared key. 
+        * @param aKey Key entered by user. Default value can be passed
+        * @return ETrue if user select OK, EFalse otherwise
+        */
+        IMPORT_C TBool EasyWapiDlg( TDes* aKey );
+
+        /**
+        * Notifier. Pops up an information note: 
+        * "No WLAN networks are available at the moment. Connection not available."
+        */        
+        IMPORT_C void NoWLANNetworksAvailableNote(); 
+
+        /**
+        * Notifier. Search available WLAN networks, and user can select one of 
+        * them. Totally asynchronous version, to be used from Engines, not 
+        * from UIs
+        * @param aStatus status object of notifier
+        * @param aSSID the id of selected wlan network
+        * @param aConnectionMode connection mode of selected wlan network
+        * @param aSecurityMode security mode of selected wlan network, 
+        * @param aProtectedSetupSupported if the wlan supports Protected Setup
+        * @return 
+        */
+        IMPORT_C void SearchWLANNetworkAsync( TRequestStatus& aStatus, 
+                                TWlanSsid& aSSID, 
+                                TWlanConnectionMode& aConnectionMode, 
+                                TWlanConnectionSecurityMode& aSecurityMode, 
+                                TBool& aProtectedSetupSupported );
+                                
+         /**
+        * Notifier. Search available WLAN networks, and user can select one of 
+        * them. Totally asynchronous version, to be used from Engines, not 
+        * from UIs
+        * @param aStatus status object of notifier
+        * @param aSSID the id of selected wlan network
+        * @param aConnectionMode connection mode of selected wlan network
+        * @param aExtendedSecurityMode extended security mode of selected wlan network, 
+        * @param aProtectedSetupSupported if the wlan supports Protected Setup
+        * @return 
+        */
+        IMPORT_C void SearchWLANNetworkAsync( TRequestStatus& aStatus, 
+                    TWlanSsid& aSSID, 
+                    TWlanConnectionMode& aConnectionMode, 
+                    TWlanConnectionExtentedSecurityMode& aExtendedSecurityMode, 
+                    TBool& aProtectedSetupSupported );                        
+
+        /**
+        * Notifier. Search available WLAN networks, and user can select one of
+        * them. Totally synchronous version, to be used from Engines, not from
+        * UIs
+        * @param aSSID the id of selected wlan network
+        * @param aConnectionMode connection mode of selected wlan network
+        * @param aSecurityMode security mode of selected wlan network
+        * @param aProtectedSetupSupported if the wlan supports Protected Setup
+        * @return ETrue if user selected one of networks, EFalse if an error
+        * is occured or user does not select a network.
+        */
+        IMPORT_C TBool SearchWLANNetworkSync( TWlanSsid& aSSID, 
+                                    TWlanConnectionMode& aConnectionMode,
+                                    TWlanConnectionSecurityMode& aSecurityMode,
+                                    TBool& aProtectedSetupSupported );
+
+        /**
+        * Notifier. Seatrch available WLAN networks, and user can select one 
+        * of them
+        * @param aSSID the id of selected wlan network
+        * @param aConnectionMode connection mode of selected wlan network
+        * @param aSecurityMode security mode of selected wlan network
+        * @param aProtectedSetupSupported if the wlan supports Protected Setup
+        * @return ETrue if user selected one of networks, EFalse if an error
+        * is occured or user does not select a network.
+        */
+        IMPORT_C TBool SearchWLANNetwork( TWlanSsid& aSSID, 
+                                    TWlanConnectionMode& aConnectionMode,
+                                    TWlanConnectionSecurityMode& aSecurityMode,
+                                    TBool& aProtectedSetupSupported );
+                                                        
+        /**
+        * Notifier. Search available WLAN networks, and user can select one 
+        * of them
+        * @param aSSID the id of selected wlan network
+        * @param aConnectionMode connection mode of selected wlan network
+        * @param aExtendedSecurityMode extended security mode of selected wlan network
+        * @param aProtectedSetupSupported if the wlan supports Protected Setup
+        * @return ETrue if user selected one of networks, EFalse if an error
+        * is occured or user does not select a network.
+        */
+        IMPORT_C TBool SearchWLANNetwork( TWlanSsid& aSSID, 
+                     TWlanConnectionMode& aConnectionMode,
+                     TWlanConnectionExtentedSecurityMode& aExtendedSecurityMode,
+                     TBool& aProtectedSetupSupported );                                        
+
+
+    private:    // Data 
+
+        CConnectionUiUtilitiesImpl* iImpl;  ///< Implementation. Owned.
+
+    };
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/disconnect_dialog_api/disconnect_dialog_api.metaxml	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,18 @@
+<?xml version="1.0" ?>
+<api id="1873c1fda7b347e70949498b5381854c" dataversion="1.0">
+  <name>Disconnect Dialog API</name>
+  <description>Provides a list of the active connections for the user in order to close one of them. When a connection is selected from this UI, it is also closed by this component.</description>
+  <type>c++</type>
+  <subsystem>networkingutilities</subsystem>
+  <libs>
+    <lib name="DisconnectDlgClient.lib" />
+  </libs>
+  <release category="domain"/>
+  <attributes>
+     <!-- This indicates wether the api provedes separate html documentation -->
+     <!-- or is the additional documentation generated from headers. -->
+     <!-- If you are unsuere then the value is "no" -->
+     <htmldocprovided>yes</htmldocprovided>
+     <adaptation>no</adaptation>
+  </attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/disconnect_dialog_api/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* 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:  File that exports the files belonging to 
+:                Disconnect Dialog API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/DisconnectDlgClient.h     MW_LAYER_PLATFORM_EXPORT_PATH(DisconnectDlgClient.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/disconnect_dialog_api/inc/DisconnectDlgClient.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,128 @@
+/*
+* Copyright (c) 2004 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:  Declares Disconnect Dialog Client classes.
+*
+*/
+
+
+
+#ifndef __DDLG_DIALOG_CLIENT_H__
+#define __DDLG_DIALOG_CLIENT_H__
+
+// INCLUDES
+#include <e32std.h>
+#include <rconnmon.h>
+
+// CONSTANTS
+
+
+// Version of this API
+const TUint KDisconnectDlgMajorVersionNumber = 1;     ///< Major version number
+const TUint KDisconnectDlgMinorVersionNumber = 1;     ///< Minor version number
+const TUint KDisconnectDlgBuildVersionNumber = 1;     ///< Build version number
+
+// CLASS DECLARATION
+
+/**
+ * Defines preferences of the connection
+ */
+class TDisconnectConnectionPrefs
+    {
+    public:
+        TUint                 iConnId;     // id of icon represents connection
+        TInt                  iBearerType; // bearer type of connection
+        TConnMonClientEnumBuf iClientInfo; // info from clients, use connection
+        TName                 iIapName;    // Owned. Access point name.
+        TBool                 iPrompt;
+    };
+
+
+/**
+ * RDisconnectDlgServer. 
+ */
+class RDisconnectDlgServer : public RSessionBase
+    {
+    public:
+        /**
+        * Constructor.
+        */
+        IMPORT_C RDisconnectDlgServer();
+
+        /**
+        * Destructor.
+        */
+        IMPORT_C ~RDisconnectDlgServer();
+
+        /**
+        * Version of the dialog server API.
+        * @return The API version.
+        */
+        IMPORT_C TVersion Version() const;
+
+        /**
+        * Connect to the notifier server. Must be called before any other 
+        * function (c'tor excepted).
+        * @return KErrNone if connection succeeded and a standard error code 
+        * otherwise.
+        */
+        IMPORT_C TInt Connect();
+
+        /**
+        * Disconnect from the notifier server.
+        */
+        IMPORT_C void Close();
+
+    public:
+
+        /**
+        * Starts the notifier to DisconnectDlg.
+        * @param TRequestStatus status of notifier
+        * @param aShowQuery indicates, if show a information query before,
+        * connections are shown
+        */
+        IMPORT_C void DisconnectDlg( TRequestStatus& aStatus, 
+                                     const TBool aShowQuery = EFalse );
+                                 
+                                 
+        /**
+        * Starts the notifier to DisconnectDlg.
+        * @param aStatus status of notifier
+        * @param aIapId IAP of the closed connection
+        * @param aShowQuery indicates, if to show a information query before,
+        * connections are shown
+        */
+        IMPORT_C void DisconnectDlg( TRequestStatus& aStatus, 
+                                     TUint32& aIapId,
+                                     const TBool aShowQuery = EFalse );
+
+        /**
+        * Cancels the notifier.
+        */
+        IMPORT_C void CancelDisconnectDlg();
+
+    private:
+
+        // Pointer to the client interface
+        RNotifier* iNotifier;
+
+        // Passed information to Notifier
+        TPckgBuf<TDisconnectConnectionPrefs> iPassedInfo;
+        
+        // IAP id of the closed connection
+        TPckg<TUint32> iIapId;
+    };
+
+#endif /* __DDLG_DIALOG_CLIENT_H__ */
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/disconnect_dialog_disable_api/disconnect_dialog_disable_api.metaxml	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,17 @@
+<?xml version="1.0" ?>
+<api id="a573d197faed19acd84af72206b72873" dataversion="1.0">
+  <name>Disconnect Dialog Disable API</name>
+  <description>P&amp;S API for MMS to disable disconnect dialog. This API is meant to be temporary and it will be removed when Symbian APIs make proper solution possible.</description>
+  <type>c++</type>
+  <subsystem>bearermanagement</subsystem>
+  <libs>
+  </libs>
+  <release category="domain"/>
+  <attributes>
+     <!-- This indicates wether the api provedes separate html documentation -->
+     <!-- or is the additional documentation generated from headers. -->
+     <!-- If you are unsuere then the value is "no" -->
+     <htmldocprovided>yes</htmldocprovided>
+     <adaptation>no</adaptation>
+  </attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/disconnect_dialog_disable_api/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build info for Disconnect Dialog Disable API.
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/mpmpropertydef.h     MW_LAYER_PLATFORM_EXPORT_PATH(mpmpropertydef.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/disconnect_dialog_disable_api/inc/mpmpropertydef.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* 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:  Defines property category and key for publish and subscribe.
+*               This property should be defined and set by MMS.
+*
+*/
+
+#ifndef MPMPROPERTYDEF_H
+#define MPMPROPERTYDEF_H
+
+#include <e32property.h>
+
+const TUid KMPMCathegory = { 0x101F6D34 };
+const TUint KMPMPropertyKeyMMS = 0;
+const TInt KMPMPropertyTypeMMS = RProperty::EInt;
+
+#endif // MPMPROPERTYDEF_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/extended_connection_settings_api/extended_connection_settings_api.metaxml	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,18 @@
+<?xml version="1.0" ?>
+<api id="43e3f4cdb8fb8eec5e9ab4529e045109" dataversion="1.0">
+  <name>Extended Connection Settings API</name>
+  <description>Provides full access (read/write) to Destinations and Connection Methods. The API also provides UI for manipulating Destinations and Connection Methods.</description>
+  <type>c++</type>
+  <subsystem>networkingutilities</subsystem>
+  <libs>
+    <lib name="cmmanager.lib" />
+  </libs>
+  <release category="domain"/>
+  <attributes>
+     <!-- This indicates wether the api provedes separate html documentation -->
+     <!-- or is the additional documentation generated from headers. -->
+     <!-- If you are unsuere then the value is "no" -->
+     <htmldocprovided>yes</htmldocprovided>
+     <adaptation>no</adaptation>
+  </attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/extended_connection_settings_api/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,32 @@
+/*
+* 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:  File that exports the files belonging to 
+:                Extended Connection Settings API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/cmdestinationext.h     MW_LAYER_PLATFORM_EXPORT_PATH(cmdestinationext.h)
+../inc/cmconnectionmethodext.h     MW_LAYER_PLATFORM_EXPORT_PATH(cmconnectionmethodext.h)
+../inc/cmpsettingsconsts.h     MW_LAYER_PLATFORM_EXPORT_PATH(cmpsettingsconsts.h)
+../inc/cmsettingsui.h     MW_LAYER_PLATFORM_EXPORT_PATH(cmsettingsui.h)
+../inc/cmcommonui.h     MW_LAYER_PLATFORM_EXPORT_PATH(cmcommonui.h)
+../inc/cmmanagerext.h     MW_LAYER_PLATFORM_EXPORT_PATH(cmmanagerext.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/extended_connection_settings_api/inc/cmcommonui.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,307 @@
+/*
+* 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:  Contains common methods used to show various types of dialogs.
+*
+*/
+
+#ifndef CMCOMMONUI_H
+#define CMCOMMONUI_H
+
+// INCLUDES
+#include <e32def.h>
+#include <e32cmn.h>
+
+#include "cmdefconnvalues.h"
+// FORWARD DECLARATIONS;
+
+class CCmManagerImpl;
+class CGulIcon;
+
+// CLASS DECLARATIONS
+
+/**
+ * Helper class containing static methods for displaying various types of
+ * dialogs.
+ *
+ *  @lib cmmanager.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( TCmCommonUi )
+    {
+    public:
+    
+        /**
+        * Inner helper class that keeps track of UIDs associated with
+        * descriptors (one-to-one). The descriptors are used by a listbox
+        * showing bearer-specific information (one bearer one line).
+        * A UID, in fact, identifies a bearer (a conn method plug-in).
+        *
+        * Note: not all methods are overriden by this inherited class, only
+        * those that we make use of here. For example, Delete() method is NOT
+        * overriden, consequently calling it will result in deletion from the
+        * descriptor array, but NOT from the UID array!
+        */
+        class CCmDesCArray : public CDesCArrayFlat
+            {
+            public: // public methods
+                /**
+                * Default constructor.
+                */
+                CCmDesCArray();
+
+                /**
+                * Destructor.
+                */
+                ~CCmDesCArray();
+
+                /**
+                * Appends an item to the array. The descriptor will be appended
+                * to the descriptor array, whilst the UID to the uid array.
+                * @param aUid UID of the item.
+                * @param aItem Descriptor to be added to the array.
+                */
+                void AppendL( TUint aUid, const TDesC& aItem );
+
+                /**
+                * Returns the UID of (aIndex)th item.
+                * @param aIndex The index of the item we're looking for.
+                * @return UID of the item in question.
+                */
+                TUint Uid( TInt aIndex ) const;
+
+            private: // data members
+                RArray<TUint> iUids;
+            };
+
+    public: // enums
+        enum TCmNoteType
+            {
+            ECmOkNote,
+            ECmInfoNote,
+            ECmWarningNote,
+            ECmErrorNote
+            };
+
+    public: // public methods
+        /**
+        * Shows a confirmation query specified by a resource.
+        * @param aResId Resource identifier of the text to be displayed
+        * @return Result of the query (Yes-No).
+        */
+        IMPORT_C static TInt ShowConfirmationQueryL( TInt aResId );
+        
+        /**
+        * Shows a confirmation query specified by a resource.
+        * @param aResId Resource identifier of the text to be displayed
+        * @param aString Replacement string for the first %U found in the
+        * resource identified by aResId.
+        * @return Result of the query (Yes-No).
+        */
+        IMPORT_C static TInt ShowConfirmationQueryL( TInt aResId, 
+                                                     const TDesC& aString );
+        
+        /**
+        * Shows a note specified by a resource.
+        * @param aResId Resource identifier of the text to be displayed
+        * @param aNoteType Specifies the type of the note to be displayed.
+        * @result
+        */
+        IMPORT_C static TInt ShowNoteL( TInt aResId, TCmNoteType aNoteType );
+        
+        /**
+        * Shows a note specified by a resource.
+        * @param aResId Resource identifier of the text to be displayed
+        * @param aString Replacement string for the first %U found in the
+        * resource identified by aResId.
+        * @param aNoteType Specifies the type of the note to be displayed.
+        * @return
+        */
+        IMPORT_C static TInt ShowNoteL( TInt aResId, const TDesC& aString,
+                                        TCmNoteType aNoteType );
+                                        
+        /**
+        * Shows a note containing text passed as argument
+        * @param aPrompt Prompt text to show.
+        * @param aNoteType Specifies the type of the note to be displayed.
+        */
+        IMPORT_C static TInt ShowNoteL( const TDesC& aPrompt, TCmNoteType aNoteType );
+
+        /**
+        * Shows a confirmation query with an input text.
+        * @param aResId Resource ID of the prompt to be displayed on the query.
+        * @param aInput String descriptor that will store the text typed in by
+        * the user.
+        * @return Result of the query (OK-Cancel).
+        */
+        IMPORT_C static TInt ShowConfirmationQueryWithInputL( TInt aResId,
+                                                              TDes& aInput );
+        /**
+        * Shows a memory full confirmation query. 
+        * @return Result of the query. It is always OK. 
+        */
+        static TInt ShowMemoryFullConfirmationQueryL();
+
+
+        /**
+        * Shows a list with graphic containing the available bearer
+        * types (e.g. WLAN, packet data). The input arguments tells the
+        * method which bearer type is available. The user is prompted
+        * this dialog along with a Select-Cancel softkey pair.
+        * @param aAvailableBearers List holding the UIDs of currently available
+        * bearers.
+        * @param aCmManager Reference to CM Manager implementation used for
+        * querying bearer specific data.
+        * @return This method returns the UID of selected bearer type or zero
+        * if nothing was selected (i.e. user pressed Cancel).
+        */
+        static TUint32 ShowAvailableMethodsL( 
+                                      const RArray<TUint32>& aAvailableBearers,
+                                      const CCmManagerImpl& aCmManager );
+        /**
+        * Shows a list of supported bearers.
+        * @param aCmManager Reference to CM Manager implementation used for
+        * querying bearer specific data.
+        * @return This method returns the UID of selected bearer type or zero
+        * if nothing was selected (i.e. user pressed Cancel).
+        */
+        static TUint32 SelectBearerL( const CCmManagerImpl& aCmManager );
+        
+        /**
+        * Creates and formats a string based on the input arguments. The string
+        * can be used by a single graphic style listbox so that the icon
+        * index and the first line are always well-formatted.
+        * Ownership of the returned string is transferred to the caller.
+        * @param aIconIndex Icon index to be appended to the string. This
+        * method has nothing to do with any icon arrays, this value is just
+        * used for formatting.
+        * @param aLineText Line text to be appended to the formatted string.
+        * @return Well-formatted string + ownership.
+        */
+        static HBufC* FormattedTextForListBoxLC( TInt aIconIndex,
+                                                 const TDesC& aLineText );
+                                                 
+        /**
+        * Displays a generic pop-up list (CAknPopupList)
+        * 
+        * @since S60 3.2
+        * @param aTitle the title of the popup
+        * @param aTextItems the textual items in the popup - ownership is taken over
+        * @param aIconArray the icons to show in the list, if NULL icons are not shown
+        * @param aSoftKeys the soft key resource ids
+        * @param aSelection the result
+        * @return ETrue if a selection was made EFalse if cancelled
+        */
+        IMPORT_C static TBool ShowPopupListL( const TDesC& aTitle,
+                                              CDesCArrayFlat* aTextItems,
+                                              CArrayPtr<CGulIcon>* aIconArray,
+                                              const TUint aSoftKeys,
+                                              TInt& aSelection );
+
+        /**
+        * Displays a note 'Default destination is set to Always Ask'
+        * for use in Destination and CM views when deleting the cm/destination
+        * representing the default connection 
+        *
+        * @since S60 3.2
+        * @param aOldDefConn former default connection
+        * @param aCmManagerImpl - engine to ask the new default connection from
+        */
+        TBool static ShowAlwaysAskNoteL( TCmDefConnValue aOldDefConn,
+                                        CCmManagerImpl& aCmManagerImpl );
+
+    private: // helper methods
+        /**
+        * Shows a confirmation query specified by a resource.
+        * This method takes over the ownership of the pointer passed and
+        * deletes the object at the end of the call.
+        * @param aPrompt Prompt text to show.
+        * @return Result of the query (Yes-No).
+        */
+        static TInt ShowConfirmationQueryL( HBufC* aPrompt );
+        
+        /**
+        * Creates and formats a string based on the input arguments. The string
+        * can be used by a double graphic style listbox so that the icon
+        * index and the two lines are always well-formatted.
+        * Ownership of the returned string is transferred to the caller.
+        * @param aIconIndex Icon index to be appended to the string. This
+        * method has nothing to do with any icon arrays, this value is just
+        * used for formatting.
+        * @param aFirstLine First line to be appended to the formatted string.
+        * @param aSecondLine Second line to be appended to the formatted string.
+        * @return Well-formatted string + ownership.
+        */
+        static HBufC* FormattedTextForListBoxLC( TInt aIconIndex,
+                                                 const TDesC& aFirstLine,
+                                                 const TDesC& aSecondLine );
+
+        /**
+        * Creates and formats a string based on the input arguments. The string
+        * can be used by a double large graphic style listbox so that the icon
+        * index and the first/second lines are always well-formatted.
+        * Ownership of the returned string is transferred to the caller.
+        * @param aIconIndex Icon index to be appended to the string. This
+        * method has nothing to do with any icon arrays, this value is just
+        * used for formatting.
+        * @param aFirstLineResId Resource ID of the first that this method will
+        * resolve.
+        * @param aSecondLineResId Resource ID of the first that this method
+        * will resolve.
+        * @return Well-formatted string + ownership.
+        */
+        static HBufC* FormattedTextForListBoxLC( TInt aIconIndex,
+                                                TInt aFirstLineResId,
+                                                TInt aSecondLineResId );
+
+        /**
+        * Creates and formats a string based on the input arguments. The string
+        * can be used by a double large graphic style listbox so that the icon
+        * index and the first/second lines are always well-formatted.
+        * Ownership of the returned string is transferred to the caller.
+        * @param aIconIndex Icon index to be appended to the string. This
+        * method has nothing to do with any icon arrays, this value is just
+        * used for formatting.
+        * @param aFirstLineResId Resource ID of the first that this method will
+        * resolve.
+        * @param aSecondLineResId Resource ID of the first that this method
+        * will resolve.
+        * @param aReplacementInSecondLine An integer to be inserted in the
+        * second line.
+        * @return Well-formatted string + ownership.
+        */
+        static HBufC* FormattedTextForListBoxLC( TInt aIconIndex,
+                                               TInt aFirstLineResId,
+                                               TInt aSecondLineResId,
+                                               TInt aReplacementInSecondLine );
+
+        /**
+        * Creates and formats a string based on the input arguments. The string
+        * can be used by a double large graphic style listbox so that the icon
+        * index and the first/second lines are always well-formatted.
+        * Ownership of the returned string is transferred to the caller.
+        * @param aIconIndex Icon index to be appended to the string. This
+        * method has nothing to do with any icon arrays, this value is just
+        * used for formatting.
+        * @param aFirstLineResId Resource ID of the first that this method will
+        * resolve.
+        * @param aSecondLine Second line, a string.
+        * @return Well-formatted string + ownership.
+        */
+        static HBufC* FormattedTextForListBoxL( TInt aIconIndex,
+                                                TInt aFirstLineResId,
+                                                const TDesC& aSecondLine );
+    };
+
+#endif // CMCOMMONUI_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/extended_connection_settings_api/inc/cmconnectionmethodext.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,202 @@
+/*
+* 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:  Connection method extended interface class.
+*
+*/
+
+#ifndef CMCONNECTIONMETHODEXT_H
+#define CMCONNECTIONMETHODEXT_H
+
+// INCLUDES
+#include <e32base.h>
+#include <cmconnectionmethoddef.h>
+
+// CLASS DECLARATION
+class CCmPluginBaseEng;
+class RCmDestinationExt;
+
+/**
+ *  RCmConnectionMethodExt is for getting/setting values of a connection method.
+ *  Use RCmManagerExt or RCmDestinationExt classes to query a connection method.
+ *  @lib cmmanager.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( RCmConnectionMethodExt )
+    {
+    //=====================================================================
+    // Constructors/Destructors
+    // 
+    public:
+    
+        /**
+        * Default constructor. 
+        */
+        IMPORT_C RCmConnectionMethodExt();
+
+
+        /**
+        * Copy constructor. 
+        */
+        IMPORT_C RCmConnectionMethodExt(const RCmConnectionMethodExt& aItem);
+
+
+        /**
+        * Destructor. 
+        */
+        IMPORT_C ~RCmConnectionMethodExt();
+
+    //=====================================================================
+    // API functions
+    public:
+    
+        /**
+        * Close the session.
+        */
+        IMPORT_C void Close();
+        
+        /**
+        * Creates a copy of this connection method. UpdateL() has to be called 
+        * to store new connection method in database. Copy is put to
+        * the Uncategorized destination. The ownership is passed.
+        */
+        IMPORT_C RCmConnectionMethodExt CreateCopyL();
+            
+        /**
+        * Gets the value for a TInt attribute.
+        * @param aAttribute Identifies the attribute to be retrived.
+        * @return contains the requested TInt attribute.
+        */
+        IMPORT_C TUint32 GetIntAttributeL( TUint32 aAttribute ) const;
+
+        /**
+        * Gets the value for a TBool attribute.
+        * @param aAttribute Identifies the attribute to be retrived.
+        * @return contains the requested TBool attribute.
+        */
+        IMPORT_C TBool GetBoolAttributeL( TUint32 aAttribute ) const;
+
+        /**
+        * Gets the value for a String16 attribute.
+        * HBuf ownership is passed to the caller
+        * @param aAttribute Identifies the attribute to be retrived.
+        * @return copy of the requested attribute. Ownership is passed.
+        */
+        IMPORT_C HBufC* GetStringAttributeL( TUint32 aAttribute ) const;
+        
+        /**
+        * Gets the value for a String8 attribute.
+        * HBuf ownership is passed to the caller
+        * @param aAttribute Identifies the attribute to be retrived.
+        * @return copy of the requested attribute. Ownership is passed.
+        */
+        IMPORT_C HBufC8* GetString8AttributeL( const TUint32 aAttribute ) const;
+
+        /**
+        * Sets the value for a TInt attribute.
+        * @param aAttribute Identifies the attribute to be set.
+        * @param aValue The value to be set.
+        * @return None.
+        */
+        IMPORT_C void SetIntAttributeL( TUint32 aAttribute, TUint32 aValue );
+
+        /**
+        * Sets the value for a TBool attribute.
+        * @param aAttribute Identifies the attribute to be set.
+        * @param aValue The value to be set.
+        * @return None.
+        */
+        IMPORT_C void SetBoolAttributeL( TUint32 aAttribute, TBool aValue );
+
+        /**
+        * Sets the value for a String16 attribute.
+        * @param aAttribute Identifies the attribute to be set.
+        * @param aValue The value to be set.
+        * @return None.
+        */
+        IMPORT_C void SetStringAttributeL( TUint32 aAttribute, 
+                                           const TDesC16& aValue );
+        
+        /**
+        * Sets the value for a String8 attribute.
+        * @param aAttribute Identifies the attribute to be set.
+        * @param aValue The value to be set.
+        * @return None.
+        */
+        IMPORT_C void SetString8AttributeL( TUint32 aAttribute, 
+                                            const TDesC8& aValue );
+        
+        /**
+        * Call this function only if this CM is an embedded destination!
+        * @return embedded destination
+        */
+        IMPORT_C RCmDestinationExt DestinationL() const;
+
+        /**
+        * Try to delete the connection method. If it is referenced from 
+        * any destination, then the references are removed and the 
+        * connection method is deleted.
+        * Do NOT call this function if you got this
+        * connection method from a destination. Call destination's
+        * DeleteConnectionMethodL() function instead.
+        * @return ETrue if connection method deleted.
+        */
+        IMPORT_C TBool DeleteL();
+        
+        /**
+        * Update in the database.
+        * @return None.
+        */        
+        IMPORT_C void UpdateL();
+        
+        /**
+        * checks if connection methods are the same 
+        * 
+        * @since S60 3.2
+        * @param aConnMethod the connection method being compared
+        * @return ETrue if the destinations are the same
+        */
+        IMPORT_C TBool operator==( RCmConnectionMethodExt& aConnMethod ) const;
+        
+        /**
+        * checks if connection methods are not the same 
+        * 
+        * @since S60 3.2
+        * @param aConnMethod the connection method being compared
+        * @return ETrue if the destinations are different
+        */
+        IMPORT_C TBool operator!=( RCmConnectionMethodExt& aConnMethod ) const;
+        
+
+        /**
+        * assignment operator 
+        * 
+        * @since S60 3.2
+        * @return RCmConnectionMethod
+        */
+        IMPORT_C RCmConnectionMethodExt& operator=(const RCmConnectionMethodExt& 
+                                                    aConnMethod);
+
+    private:
+    
+        friend class RCmManagerExt;
+        friend class RCmDestinationExt;
+        
+    private:
+    
+        CCmPluginBaseEng* iImplementation;
+    };
+
+#endif      // CMCONNECTIONMETHODEXT_H
+           
+//  End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/extended_connection_settings_api/inc/cmdestinationext.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,295 @@
+/*
+* 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:  Destination extended interface class.
+*
+*/
+
+#ifndef DESTINATIONEXT_H
+#define DESTINATIONEXT_H
+
+// System includes
+#include <E32def.h>
+#include <e32base.h>
+#include <metadatabase.h>
+#include <cmmanagerdef.h>
+
+// FORWARD DECLARATIONS
+class CCmDestinationData;
+class CCmManagerImpl;
+class RCmConnectionMethodExt;
+class RCmDestinationExt;
+class CGulIcon;
+
+/**
+ *  RCmDestination is for getting/setting values of a network destination.
+ *  @lib cmmanager.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS(RCmDestinationExt)
+    {
+    //=====================================================================
+    // Constructors/Destructors
+    // 
+    public:
+    
+        /** Default constructor. */
+        IMPORT_C RCmDestinationExt();
+
+    //=====================================================================
+    // API functions
+    public:
+        
+        /**
+        * Close the session.
+        */
+        IMPORT_C void Close();
+
+        IMPORT_C ~RCmDestinationExt();
+
+        IMPORT_C RCmDestinationExt(const RCmDestinationExt& aCmDestination);
+        
+        //=====================================================================
+        // Conn method handling    
+        
+        /**
+        * Return the number of connection methods in the destination
+        * @param None
+        * @return number of the connection method in this destination
+        */                 
+        IMPORT_C TInt ConnectionMethodCount();
+        
+        /**
+        * Return a reference to the connection method. 
+        * The index must be less than the return value of 
+        * ConnectionMethodCount()
+        * @param anIndex index of the connection method to be returned
+        * @return connection method
+        */        
+        IMPORT_C RCmConnectionMethodExt ConnectionMethodL( TInt anIndex );
+        
+        /**
+        * Returns the connection method with the ECmId.
+        * Leaves with KErrNotFound if not found.
+        * @param aCmId unique id of the requested connection method.
+        * @return connection method
+        */
+        IMPORT_C RCmConnectionMethodExt ConnectionMethodByIDL( 
+                                                        TInt aCmId );
+
+        //Getting attributes
+
+        /**
+        * Return the priority of the passed connection method
+        * @param aCCMItem connection method
+        * @return the priority of the queried connection method 
+        */
+        IMPORT_C TUint PriorityL(const RCmConnectionMethodExt& aCCMItem );
+        
+        /**
+        * Return the name of the destination. Ownership is passed.
+        * HBuf ownership is passed to the caller
+        * @return name of the destination.
+        */      
+        IMPORT_C HBufC* NameLC();                        
+        
+        /**
+        * Return the destination's Id attribute
+        * @return id of the destination
+        */                    
+        IMPORT_C TUint32 Id();
+
+        /**
+        * Return the destination's ElementId attribute
+        * @return TUint32        
+        */            
+        IMPORT_C TUint32 ElementId();
+                
+        /**
+        * Return the Icon pointer. Ownership is passed.
+        * This fucton leaves if the client does not have a valid UI context
+        * @return icon of the destination
+        */ 
+        IMPORT_C CGulIcon* IconL();
+    
+        /**
+        * Return the Metadata
+        * @return TUint32        
+        */            
+        IMPORT_C TUint32 MetadataL( CMManager::TSnapMetadataField aMetaField ) const;
+    
+        /**
+        * Return the protection level of the destination.
+        * @return protection level
+        */
+        IMPORT_C CMManager::TProtectionLevel ProtectionLevel();
+        
+        /**
+        * Return that the destination is hidden or not.
+        * @return ETrue if the destination is hidden
+        */
+        IMPORT_C TBool IsHidden();        
+                
+        /**
+        * Create a connection method that belongs to this destination.
+        * @param aImplementationUid - implementation uid (bearer type) of the 
+        * connection method to be created
+        * @return newly created connection method
+        */
+        IMPORT_C RCmConnectionMethodExt CreateConnectionMethodL( 
+                                                          TUint32 aBearerType );
+        
+        /*
+        * Adds an existing connection method to a destination
+        * @param aConnectionMethod Connection method to be added
+        * @return index in the Connection Method list
+        */
+        IMPORT_C TInt AddConnectionMethodL( 
+                                    RCmConnectionMethodExt aConnectionMethod );            
+    
+        /*
+        * Embeds an existing destination into this destination.
+        * @param RCmDestinationExt - Destination to be embedded
+        * @return TInt - index in the Connection Method list
+        */
+        IMPORT_C TInt AddEmbeddedDestinationL(
+                            const RCmDestinationExt& aDestination );     
+    
+        /**
+        * Remove a connection method from a destination and delete it
+        * on update. 
+        * Exception: conenction method is not deleted  if it's referenced 
+        * from any other destination.
+        * @param aConnectionMethod the connection method to be deleted.
+        */
+        IMPORT_C void DeleteConnectionMethodL( 
+                                    RCmConnectionMethodExt& aConnectionMethod );
+    
+        /**
+        * Remove connection method from the destination
+        * @param aConnectionMethod connection method to be removed
+        */
+        IMPORT_C void RemoveConnectionMethodL( 
+                                   RCmConnectionMethodExt aConnectionMethod );
+        
+    
+        /**
+        * Set the connection method's priority based on the passed
+        * index. Indexing starts from zero(the highest priority).
+        * @param aCCMItem the connection method item
+        * @param aIndex the new priority of the connection method in the 
+        * destination
+        */
+        IMPORT_C void ModifyPriorityL( RCmConnectionMethodExt& aCCMItem, 
+                                       TUint aIndex );
+        
+        /**
+        * Set the destination's name
+        * @param aDestinationName new name of the destination
+        */
+        IMPORT_C void SetNameL( const TDesC& aName );
+           
+        /**
+        * Set the destination's icon index.
+        * This fucton leaves if the client does not have a valid UI context
+        * @param aIconIndex new icon index of the destination
+        */
+        IMPORT_C void SetIconL( TUint32 anIndex );
+        
+        /**
+        * Set the Metadata
+        * @param aMetaField field to be modified
+        * @param aValue value to be set
+        */            
+        IMPORT_C void SetMetadataL( CMManager::TSnapMetadataField aMetaField, 
+                                    TUint32 aValue );
+        
+        /**
+        * Set the protection level of the destination.
+        * @param aProtLevel new protection level 
+        */
+        IMPORT_C void SetProtectionL( CMManager::TProtectionLevel aProtLevel );
+        
+        /**
+        * Set if the destination is hidden or not.
+        * @param aHidden - ETrue if destination is hidden
+        */
+        IMPORT_C void SetHiddenL( TBool aHidden );         
+        
+        /**
+        * Update all values of the destination and its connection method.
+        * Nothing if stored, if update leaves due to any reason.
+        */
+        IMPORT_C void UpdateL();               
+
+        /**
+        * Delete destination and its connection methods from CommsDat.
+        * Connection methods that belong to other destination, too, are
+        * not deleted.
+        */
+        IMPORT_C void DeleteLD();
+        
+        /**
+        * Returns if there's connection created with any of the destination's
+        * connection method.
+        * @return ETrue if there's connection with any of the destination's
+        * connection method.
+        */
+        IMPORT_C TBool IsConnectedL() const;
+        
+        /**
+         * Compares whether two objects content is the same.
+         * @return ETrue if the content is same.
+         */
+        IMPORT_C TBool operator==(const RCmDestinationExt& aDestination) const;
+
+        /**
+         * Compares whether two objects content is different.
+         * @return ETrue if the content is different.
+         */
+        IMPORT_C TBool operator!=(const RCmDestinationExt& aDestination) const;
+
+        /**
+        * assignment operator 
+        * 
+        * @since S60 3.2
+        * @param aDestination the destination being compared
+        * @return RCmDestination
+        */
+        IMPORT_C RCmDestinationExt& operator=(const RCmDestinationExt& 
+                                                    aCmDestination);
+
+        /**
+        * Create a connection method with given id that belongs to this destination.
+        * @param aImplementationUid - implementation uid (bearer type) of the 
+        * connection method to be created
+        * @param aConnMethdId Predefined id for the connection method
+        * (id range is from 1 to max IAP record amount in CommsDat).
+        * @return newly created connection method or leaves with
+        * KErrAlreadyExists if there exists CM with the same Id.
+        */
+        IMPORT_C RCmConnectionMethodExt CreateConnectionMethodL( 
+                                                         TUint32 aBearerType,
+                                                         TUint32 aConnMethId );
+
+    private: // Data
+        
+        CCmDestinationData* iDestinatonData;
+
+    private:
+    
+        friend class RCmManagerExt;
+        friend class RCmConnectionMethodExt;
+    };
+    
+#endif // DESTINATIONEXT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/extended_connection_settings_api/inc/cmmanagerext.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,318 @@
+/*
+* 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:  Connection manager IF class.
+*
+*/
+
+#ifndef CMMANAGEREXT_H
+#define CMMANAGEREXT_H
+
+// System includes
+#include <e32std.h>
+#include <e32base.h>
+#include <e32cmn.h>
+#include <metadatabase.h>
+#include <coneresloader.h>
+#include <cmmanagerdef.h>
+#include <cmconnectionmethodext.h>
+#include <cmdefconnvalues.h>
+
+// FORWARD DECLARATIONS
+class RCmDestinationExt;
+class CCmManagerImpl;
+class CGulIcon;
+
+/**
+ *  RCmManager is used to query and modify network destinations and connection
+ *  methods.
+ *
+ *  @lib cmmanager.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS(RCmManagerExt)
+    {
+    //=====================================================================
+    // Constructors/Destructors
+    // 
+    public:
+    
+        /** Inline constructor */
+        inline RCmManagerExt();
+
+    //=====================================================================
+    // API functions
+    public:
+        
+        /** Open session */
+        IMPORT_C void OpenL();    
+
+        /** Open session and create tables if they don't exist*/
+        IMPORT_C void CreateTablesAndOpenL();    
+        
+        /**
+        * Symbian constructor
+        * Pushes the object on the cleanup stack
+        *
+        * @since S60 3.2
+        */
+        IMPORT_C void OpenLC();    
+        
+        /** Close session */
+        IMPORT_C void Close();
+        
+        /**
+        * GetBearerInfoXXX function can be used to query
+        * bearer informantion that doesn't belong
+        * to a specific connection method, such as 
+        * ECmCoverage or ECmDefaultPriority etc.
+        * NULL pointer, returned from string functions, means
+        * attribute exists but has no value.
+        * HBuf ownership is passed to the caller
+        */
+        IMPORT_C TUint32 GetBearerInfoIntL( TUint32 aBearerType,
+                                  TUint32 aAttribute ) const;
+        IMPORT_C TBool GetBearerInfoBoolL( TUint32 aBearerType,
+                                 TUint32 aAttribute ) const;
+        IMPORT_C HBufC* GetBearerInfoStringL( TUint32 aBearerType,
+                                    TUint32 aAttribute ) const;
+        IMPORT_C HBufC8* GetBearerInfoString8L( TUint32 aBearerType,
+                                    TUint32 aAttribute ) const;
+
+        /**
+        * GetConnectionMethodInfoXXX function can be used to 
+        * query any, non-bearer specific information about
+        * a given connection method. This can be e.g. ECmBearerType,
+        * ECmName, ECmStartPage etc.
+        * NULL pointer, returned from string functions, means
+        * attribute exists but has no value.
+        * HBuf ownership is passed to the caller
+        */
+        IMPORT_C TUint32 GetConnectionMethodInfoIntL( TUint32 aIapId,
+                                             TUint32 aAttribute ) const;
+        IMPORT_C TBool GetConnectionMethodInfoBoolL( TUint32 aIapId,
+                                            TUint32 aAttribute ) const;
+        IMPORT_C HBufC* GetConnectionMethodInfoStringL( TUint32 aIapId,
+                                               TUint32 aAttribute ) const;
+        IMPORT_C HBufC8* GetConnectionMethodInfoString8L( TUint32 aIapId,
+                                               TUint32 aAttribute ) const;
+                
+        /**
+        * Creates a Destination with the passed name. 
+        * @param aName the name of the new destination.
+        * @return RCmDestinationExt new destination. ownership is passed to the 
+        * caller
+        */
+        IMPORT_C RCmDestinationExt CreateDestinationL( const TDesC& aName );
+        
+        /**
+        * Creates a connection method does not belong to any destination
+        * @param aImplementationUid - bearer type of the new connection method
+        * @return RCmConnectionMethodExt newly created connection method.
+        */
+        IMPORT_C RCmConnectionMethodExt CreateConnectionMethodL( 
+                                                          TUint32 aBearerType );        
+        
+        /**
+        * Copies a connection method belonging to one destination to 
+        * another. The connection method becomes shared.
+        * Calls UpdateL on the destination
+        * @param aTargetDestination
+        * @param aConnectionMethodId
+        * @return TInt - index in the Connection Method list
+        */
+        IMPORT_C TInt CopyConnectionMethodL( 
+                                    RCmDestinationExt& aTargetDestination,
+                                    RCmConnectionMethodExt& aConnectionMethod );
+                                        
+        /**
+        * Moves a connection method belonging to one destination to 
+        * another. The connection method is removed from the source destination
+        * @param aSourceDestination
+        * @param aTargetDestination
+        * @param aConnectionMethod
+        * @return TInt - index in the Connection Method list
+        */
+        IMPORT_C TInt MoveConnectionMethodL( 
+                                    RCmDestinationExt& aSourceDestination,
+                                    RCmDestinationExt& aTargetDestination,
+                                    RCmConnectionMethodExt& aConnectionMethod );
+                                                                                  
+        /**
+        * Remove connection method from the destination
+        * @param aDestination destination the connection method is attached to
+        * @param aConnectionMethod connection method to be removed
+        */
+        IMPORT_C void RemoveConnectionMethodL( 
+                                   RCmDestinationExt& aDestination,
+                                   RCmConnectionMethodExt& aConnectionMethod );
+                                   
+        /**
+        * Removes connection method from every destination and make it 
+        * uncategorized.
+        * @param aConnectionMethod connection method to be removed
+        */
+        IMPORT_C void RemoveAllReferencesL( 
+                                    RCmConnectionMethodExt& aConnectionMethod );
+
+    //=========================================================================
+    // API functions - Getter-Setter
+    public:
+    
+        /**
+        * Returns the connection method queried by its ID.
+        * @param aId if of the connection method
+        * @return RCmConnectionMethodExt connection method instance
+        */
+        IMPORT_C RCmConnectionMethodExt ConnectionMethodL( 
+                                                  TUint32 aConnectionMethodId );
+        
+        /**
+        * Returns the list of connection methods that do not belong to any 
+        * destination
+        * @param aCMArray on return it is the array of IAP ids.
+        * @param aCheckBearerType If ETrue only connection methods with 
+        *                         supported bearer types are returned
+        * @param aLegacyOnly when set to ETrue only Legacy IAP ids will
+        *                         be returned
+        * @param aEasyWlan when set to ETrue EasyWlan id is returned, too
+        */
+        IMPORT_C void ConnectionMethodL( RArray<TUint32>& aCMArray,
+                                         TBool aCheckBearerType = ETrue,
+                                         TBool aLegacyOnly = ETrue,
+                                         TBool aEasyWlan = EFalse );
+        
+        /**
+        * Returns the destination to which a specified 
+        * connection method belongs, search is by destination ID
+        * @param aDestinationId id of the destination
+        * @return RCmDestinationExt network destination
+        */
+        IMPORT_C RCmDestinationExt DestinationL( TUint32 aDestinationId );
+        
+        /**
+        * Returns an array of all destination id's
+        * @param aDestArray array of all available network destination
+        */ 
+        IMPORT_C void AllDestinationsL( RArray<TUint32>& aDestArray );
+        
+        /**
+        * Returns the copy of the bearer priority array. Ownership is passed.
+        * @param aArray bearer priority array
+        */          
+        IMPORT_C void BearerPriorityArrayL( RArray<TBearerPriority>& aArray ) const;
+        
+        /**
+        * Update bearer priority array
+        * @param aArray array with new global bearer priority
+        */          
+        IMPORT_C void UpdateBearerPriorityArrayL( 
+                                        const RArray<TBearerPriority>& aArray );
+        
+
+        /**
+        * Clean up passed global bearer priority array. Delete
+        * the elements and calls Reset and Close on the array.
+        * @param aArray array to be cleaned up
+        */
+        IMPORT_C void CleanupGlobalPriorityArray( 
+                                        RArray<TBearerPriority>& aArray ) const;
+        
+        /**
+        * Query all of the supported bearer types.
+        * @param aArray list of all supported bearer types.
+        */          
+        IMPORT_C void SupportedBearersL( RArray<TUint32>& aArray ) const;
+        
+        /**
+        * Returns "Uncategorized" icon.
+        * This fucton leaves if the client does not have a valid UI context
+        * @return CGulIcon* Icon of uncategorized connection methods. Ownership 
+        * is passed.
+        */          
+        IMPORT_C CGulIcon* UncategorizedIconL() const;
+        
+        /**
+        * Returns the id of the EasyWlan connection method.
+        *
+        * @since S60 3.2
+        * @return id of the EasyWLan connection method. 0 if not found.
+        */
+        IMPORT_C TUint32 EasyWlanIdL();
+
+        /**
+        * Returns the default connection method/SNAP.
+        *
+        * @since S60 3.2
+        */
+        IMPORT_C void ReadDefConnL( TCmDefConnValue& aDCSetting );   
+        /**
+        * Stores the default connection method/SNAP.
+        *
+        * @since S60 3.2
+        */
+        IMPORT_C void WriteDefConnL( const TCmDefConnValue& aDCSetting );  
+
+        /**
+        * Creates a Destination with the passed name and id. 
+        * @param aName the name of the new destination.
+        * @param aDestId Predefined id of the destination.
+        * @return RCmDestinationExt newly created destination or leaves with
+        * KErrAlreadyExists if there exists CM with the same Id.
+        * Ownership is passed to the caller.
+        */
+        IMPORT_C RCmDestinationExt CreateDestinationL( const TDesC& aName,
+                                                       TUint32      aDestId );
+        
+        /**
+        * Creates a connection method does not belong to any destination
+        * @param aImplementationUid - bearer type of the new connection
+        * method
+        * @param aConnMethodId Predefined id for the connection method
+        * (id range is from 1 to max IAP record amount in CommsDat).
+        * @return RCmConnectionMethodExt newly created connection
+        * method or leaves with KErrAlreadyExists if there exists CM
+        * with the same Id.
+        */
+        IMPORT_C RCmConnectionMethodExt CreateConnectionMethodL( TUint32 aImplementationUid,
+                                                                 TUint32 aConnMethodId );
+
+    private:
+        /**
+        * This is a private copy constructor without iplemetation.
+        * The sole purpose of this declaration is to forbid the copying of 
+        * the objects of this class.
+        */          
+        RCmManagerExt(RCmManagerExt&  );
+        /**
+        * This is a private copy constructor without iplemetation.
+        * The sole purpose of this declaration is to forbid the copying of 
+        * the objects of this class.
+        */          
+        RCmManagerExt& operator=( RCmManagerExt& );
+
+    friend class CCmManagerImpl;
+    //=========================================================================
+    // Member data
+    
+    private:
+    
+        CCmManagerImpl* iImplementation;
+    };
+    
+inline RCmManagerExt::RCmManagerExt()
+    : iImplementation(NULL)
+    {
+    }
+    
+#endif // CMMANAGEREXT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/extended_connection_settings_api/inc/cmpsettingsconsts.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,83 @@
+/*
+* 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:  Contains common internal consts, typedefs for the Access Point 
+*                settings.
+*
+*/
+
+#ifndef CMPSETTINGS_CONSTS_H
+#define CMPSETTINGS_CONSTS_H
+
+// CONSTANTS
+
+#define KMaxConnNameLength            30
+#define KMaxGprsApNameLength          100
+#define KMaxLoginNameLength           50
+#define KMaxStartPageLength           1000
+#define KMaxAccessNumLength           20
+#define KMaxLoginScriptLength         1000
+#define KMaxLoginPasswordLength       50
+#define KMaxModInitStringLength       50
+#define KMaxProxyServerLength         1000
+#define KMaxProxyPortNumberLength     5
+#define KMaxNetworkNameLength         50
+#define KMaxIPv6NameServerLength      50
+#define KMaxIPv4NameServerLength      15
+#define KMaxWlanNetworkameLength      32
+#define KMaxAdhocChannelNumberLength  2
+#define KAdhocChannelMin              1
+#define KAdhocChannelMax              11
+#define KMaxDialUpNumLength           20
+#define KMaxNumericPageLength         50
+
+#define KConnNameWidth                10
+#define KGprsApNameWidth              10
+#define KLoginNameWidth               10
+#define KStartPageWidth               10
+#define KAccessNumWidth               10
+#define KCBInfoWidth                  10
+#define KServiceCentreAddrWidth       10
+#define KServiceAccessNumWidth        10
+#define KIpAddressWidth               15
+#define KLoginScriptWidth             10
+#define KModInitStringWidth           10
+#define KProxyServerWidth             10
+#define KProxyPortNumberWidth         10
+#define KNetworkNameWidth             10
+#define KNumericPageWidth             50
+
+#define KConnNameLines                2
+#define KGprsApNameLines              2
+#define KLoginNameLines               2
+#define KStartPageLines               2
+#define KAccessNumLines               2
+#define KCBInfoLines                  2
+#define KServiceCentreAddrLines       2
+#define KServiceAccessNumLines        2
+#define KIpAddressLines               2
+#define KLoginScriptLines             2
+#define KModInitStringLines           2
+#define KProxyServerLines             2
+#define KProxyPortNumberLines         2
+#define KNetworkNameLines             1
+#define KNumericPageLines             2
+
+#define KSettingsItemMaxLength        100
+#define KSettingsNumItemMaxLength     10
+    
+
+#define KListQueryHeight              6
+#define KListQueryWidth               2
+
+#endif  // CMPSETTINGS_CONSTS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/extended_connection_settings_api/inc/cmsettingsui.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of settings UI
+*
+*/
+
+#ifndef C_CMSETTINGSUI_H
+#define C_CMSETTINGSUI_H
+
+#include <E32def.h>
+#include <e32base.h>
+
+class CCmSettingsUiImpl;
+
+/**
+ *  Implementation of Setting UI
+ *
+ *  @lib cmmanager.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS(CCmSettingsUi) : public CBase
+    {
+    public:
+
+        enum TResult
+                {
+                EBack,
+                EExit
+                };
+
+        /** Epoc constructor */
+        IMPORT_C static CCmSettingsUi* NewL();
+
+        /** Destructor */
+        virtual ~CCmSettingsUi();
+
+    //=========================================================================    
+    // UI API
+    //
+    public:
+
+        /**
+        * Launches the Settings UI 
+        * for handling Destinations and Connection Methods
+        * @since 3.2
+        * @return TResult - the softkey the user exited with
+        */
+        IMPORT_C TResult RunSettingsL();
+        
+        /**
+        * Launches a dialog with a list of Destination
+        * @since 3.2
+        * @param  aDestinationId ID of the selected Destination
+        * @return TBool
+        */
+        IMPORT_C TBool SelectDestinationDlgL( TUint32& aDestinationId );
+
+    private:
+
+        /** First stage constructor */
+        CCmSettingsUi();
+
+        /** Epoc constructor */
+        void ConstructL();
+
+    private: // data
+
+        CCmSettingsUiImpl* iImpl;
+    };
+
+#endif // C_CMSETTINGSUI_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build info for ipcm_plat. 
+*
+*/
+
+#include "../access_point_engine_misc_api/group/bld.inf"
+#include "../bearer_settings_plugin_api/group/bld.inf"
+#include "../commsdat_wlan_api/group/bld.inf"
+#include "../connection_monitor_extension_api/group/bld.inf"
+#include "../connection_ui_utilities_api/group/bld.inf"
+#include "../disconnect_dialog_api/group/bld.inf"
+#include "../disconnect_dialog_disable_api/group/bld.inf"
+#include "../extended_connection_settings_api/group/bld.inf"
+#include "../mpm_default_connection_api/group/bld.inf"
+#include "../pdpcontextmanager2_reset_factory_settings_api/group/bld.inf"
+#include "../pdpcontextmanager2_settings_api/group/bld.inf"
+#include "../mpm_connect_screen_api/group/bld.inf"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/mpm_connect_screen_api/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Used to export api headers.
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/mpmconnectscreenid.h     MW_LAYER_PLATFORM_EXPORT_PATH(mpmconnectscreenid.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/mpm_connect_screen_api/inc/mpmconnectscreenid.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Defines central repository key for connect screen id.
+*
+*/
+
+#ifndef MPMCONNECTSCREENID_H
+#define MPMCONNECTSCREENID_H
+
+/**
+ * The UID of the repository to be accessed.
+ *
+ * @since S60 5.1
+ */
+const TUid KMpmOccCenRepUid = {0x101F6D50}; 
+
+/**
+ * This key contains process uid of the connect screen. Client can set this
+ * value if it has WriteDeviceData and NetworkControl capabilities. Note that
+ * zero means that user connection can not be established.
+ *
+ * @since S60 5.1
+ */
+const TUint32 KMpmConnectScreenId  = 0x00000001;
+
+#endif // MPMCONNECTSCREENID_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/mpm_default_connection_api/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build info for MPM Default Connection API.
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/rmpmdefaultconnection.h     MW_LAYER_PLATFORM_EXPORT_PATH(rmpmdefaultconnection.h)
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/mpm_default_connection_api/inc/rmpmdefaultconnection.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,112 @@
+/*
+* 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:  Client interface to MPM Default Connection server
+*
+*/
+
+#ifndef RMPMDEFAULTCONNECTION_H
+#define RMPMDEFAULTCONNECTION_H
+
+#include <e32std.h>
+
+/**
+ *  Cleant API for MPM Default Connection server
+ *  services.
+ *
+ *  Enables registering IAP to be used as default connection. 
+ *  Only one client may be connected at a time 
+ *  @code
+ *  RMPMDefaultConnection rmpmdc;
+ *  TInt err = KErrNone;
+ *  //connect and set default IAP
+ *  err = rmpmdc.Connect();
+ *  err = rmpmdc.SetDefaultIAP( iapId );
+ *
+ *  //when IAP no longer used as default
+ *  err = rmpmdc.ClearDefaultIAP();
+ *  rmpmdc.Close();
+ *  @endcode
+ *
+ *  @lib mpmdefaultconnection.dll
+ *  @since S60 v3.2
+ */
+class RMPMDefaultConnection : public RSessionBase
+    {
+
+public:
+
+    /**
+     * Constructor.
+     *
+     * @since S60 v3.2
+     */
+    inline RMPMDefaultConnection() : RSessionBase(), 
+    iClientConnected( EFalse )
+    {};
+
+    /**
+     * Creates connection to server
+     *
+     * @since S60 v3.2
+     * @return KErrNone if successful, otherwise one of the
+     * system-wide error codes
+     */
+    IMPORT_C TInt Connect();
+
+    /**
+     * Closes connection to server
+     * If IAP has been registered by the client it is also deregistered here
+     *
+     * @since S60 v3.2
+     */
+    IMPORT_C void Close();
+
+    /**
+     * Sets IAP to be used as default connection
+     *
+     * @since S60 v3.2
+     * @param aIapId CommsDat record id of the IAP
+     * @return KErrNone if successful, otherwise one of the
+     * system-wide error codes
+     */
+    IMPORT_C TInt SetDefaultIAP( TInt aIapId );
+
+
+    /**
+     * Clears IAP from being used as default connection
+     *
+     * @since S60 v3.2
+     * @param aIapId CommsDat record id of the IAP
+     * @return KErrNone if successful, otherwise one of the
+     * system-wide error codes
+     */
+    IMPORT_C TInt ClearDefaultIAP();
+    
+    /**
+     * Returns MPM Default Connection server version.
+     * @since 3.2
+     * @return Version of the MPM Default Connection server
+     */
+     IMPORT_C TVersion Version() const;
+    
+private: // data
+
+    /**
+     * Is client connected to server or not
+     */
+     TBool iClientConnected;    
+
+    };
+
+#endif // RMPMDEFAULTCONNECTION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/mpm_default_connection_api/mpm_default_connection_api.metaxml	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,18 @@
+<?xml version="1.0" ?>
+<api id="b2e86b78ef2622115024f5670a07a915" dataversion="1.0">
+  <name>MPM Default Connection API</name>
+  <description>Used by an Active Idle plugin for setting default IAP (in practice a WLAN IAP that has earlier been started explicitly by the Active Idle plugin itself)</description>
+  <type>c++</type>
+  <subsystem>bearermanagement</subsystem>
+  <libs>
+    <lib name="mpmdefaultconnection.lib" />
+  </libs>
+  <release category="domain"/>
+  <attributes>
+     <!-- This indicates wether the api provedes separate html documentation -->
+     <!-- or is the additional documentation generated from headers. -->
+     <!-- If you are unsuere then the value is "no" -->
+     <htmldocprovided>yes</htmldocprovided>
+     <adaptation>no</adaptation>
+  </attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/pdpcontextmanager2_reset_factory_settings_api/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* 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:  File that exports the files belonging to 
+:                PdpContextManager2 Reset Factory Settings API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/pdpcontextmanagerpskeys.h     MW_LAYER_PLATFORM_EXPORT_PATH(pdpcontextmanagerpskeys.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/pdpcontextmanager2_reset_factory_settings_api/inc/pdpcontextmanagerpskeys.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2004,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:  Publish & Subscribe keys
+*
+*/
+
+
+#ifndef PDPCONTEXTMANAGERPSKEYS_H
+#define PDPCONTEXTMANAGERPSKEYS_H
+
+// PDPContextManager2 property category
+const TUid KPDPContextManager2 = {0x101F85EB};
+
+// Factory settings reset key
+const TUint KPDPContextManagerFactorySettingsReset = 0x00000001;
+enum TPDPContextManagerFactorySettingsReset
+    {
+    EPDPContextManagerFactorySettingsResetStart,
+    EPDPContextManagerFactorySettingsResetStartReply,
+    EPDPContextManagerFactorySettingsResetStop
+    };
+
+#endif // PDPCONTEXTMANAGERPSKEYS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/pdpcontextmanager2_reset_factory_settings_api/pdpcontextmanager2_reset_factory_settings_api.metaxml	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,17 @@
+<?xml version="1.0" ?>
+<api id="a144ec952b5f58e00285bcae01dc7f1b" dataversion="1.0">
+  <name>PdpContextManager2 Reset Factory Settings API</name>
+  <description>Progress status of reset factory settings process (start/startReply/stop). API is used in communication between RFS and PdpContextManager2.</description>
+  <type>c++</type>
+  <subsystem>networkingutilities</subsystem>
+  <libs>
+  </libs>
+  <release category="domain"/>
+  <attributes>
+     <!-- This indicates wether the api provedes separate html documentation -->
+     <!-- or is the additional documentation generated from headers. -->
+     <!-- If you are unsuere then the value is "no" -->
+     <htmldocprovided>yes</htmldocprovided>
+     <adaptation>no</adaptation>
+  </attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/pdpcontextmanager2_settings_api/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* 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:  File that exports the files belonging to 
+:                PdpContextManager2 Settings API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/pdpcontextmanagerinternalcrkeys.h     MW_LAYER_PLATFORM_EXPORT_PATH(pdpcontextmanagerinternalcrkeys.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/pdpcontextmanager2_settings_api/inc/pdpcontextmanagerinternalcrkeys.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,112 @@
+/*
+* Copyright (c) 2005-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:  PDPContextManager Settings API 
+*               Provides access to the PDPContextManager settings 
+*
+*/
+
+#ifndef PDPCONTEXTMANAGERINTERNALCRKEYS_H
+#define PDPCONTEXTMANAGERINTERNALCRKEYS_H
+
+const TUid KCRUidPDPContextManager = {0x102071F5};
+
+
+/** 
+* Defines whether always online functionality is used when user is roaming. 
+*
+* Integer type
+*
+* Default value: 0
+*/
+const TUint32 KPDPContextManagerEnableWhenRoaming        = 0x00000001;
+
+/**
+* Access point ID that is used as always online context.
+*
+* Integer type
+*
+* Default value: 0
+*/
+const TUint32 KPDPContextManagerDefaultUid                = 0x00000002;
+
+/**
+* Retry interval in minutes which is used if connection fails.
+*
+* Integer type
+*
+* Default value: ""
+**/
+const TUint32 KPDPContextManagerRetryTimer                = 0x00000003;
+
+/** 
+* Defines whether always online functionality is used when user 
+* is in home network.
+*
+* Integer type
+*
+* Default value: 0
+**/
+const TUint32 KPDPContextManagerEnableWhenHome            = 0x00000004;
+
+/** 
+* Accesspoint related linger value.
+*
+* Binary type
+*
+* Default value: 0
+**/
+const TUint32  KPDPContextManagerLinger                   = 0x00000005;
+
+/**
+* Connection timer value.
+*
+* Integer type
+*
+* Default value: 30
+**/
+const TUint32 KPDPContextManagerConnectionTimer           = 0x00000006;
+
+/**
+* Always-on feature dynamic flag.
+*
+* Integer type
+*
+* Default value: 0
+*
+* 0 = Disabled
+* 1 = Enabled
+**/
+const TUint32 KPDPContextAlwaysOnEnabled                  = 0x00000007;
+
+/**
+* Polling timer in unconnected state.
+* A new connection will be tried after interval specified in the timer.
+* Timer value in seconds.
+*
+* Integer type
+*
+* Default value: 10
+*/
+const TUint32 KPDPContextManagerUnconnectTimer           = 0x00000008;
+
+/**
+* Number of iap id & linger interval entries in dynamic table.
+*
+* Integer type
+*
+* Default value: 0
+*/
+const TUint32 KPdpContextManagerLingerArrayCount         = 0x00000009;
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/pdpcontextmanager2_settings_api/pdpcontextmanager2_settings_api.metaxml	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,17 @@
+<?xml version="1.0" ?>
+<api id="843bca1902a4bd9ca69a8d4df1533639" dataversion="1.0">
+  <name>PdpContextManager2 Settings API</name>
+  <description>Provisioning adapters write and PdpContextManager2 reads always-on settings to/from these keys.</description>
+  <type>c++</type>
+  <subsystem>networkingutilities</subsystem>
+  <libs>
+  </libs>
+  <release category="domain"/>
+  <attributes>
+     <!-- This indicates wether the api provedes separate html documentation -->
+     <!-- or is the additional documentation generated from headers. -->
+     <!-- If you are unsuere then the value is "no" -->
+     <htmldocprovided>yes</htmldocprovided>
+     <adaptation>no</adaptation>
+  </attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/access_point_engine_api/access_point_engine_api.metaxml	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,18 @@
+<?xml version="1.0" ?>
+<api id="eab22f6b7dcd5833eaa3a66dcc8bd217" dataversion="1.0">
+  <name>Access Point Engine API</name>
+  <description>Provides applications the possibility to access the Access Point information stored in the communications database.</description>
+  <type>c++</type>
+  <subsystem>networkingutilities</subsystem>
+  <libs>
+    <lib name="apengine.lib" />
+  </libs>
+  <release category="sdk" sinceversion="0.9" deprecatedsince="3.2"/>
+  <attributes>
+     <!-- This indicates wether the api provedes separate html documentation -->
+     <!-- or is the additional documentation generated from headers. -->
+     <!-- If you are unsuere then the value is "no" -->
+     <htmldocprovided>yes</htmldocprovided>
+     <adaptation>no</adaptation>
+  </attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/access_point_engine_api/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,38 @@
+/*
+* 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:  File that exports the files belonging to 
+:                Access Point Engine API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/APUtils.h     MW_LAYER_PUBLIC_EXPORT_PATH(ApUtils.h)
+../inc/APDataHandler.h     MW_LAYER_PUBLIC_EXPORT_PATH(ApDataHandler.h)
+../inc/ActiveApDb.h     MW_LAYER_PUBLIC_EXPORT_PATH(ActiveApDb.h)
+../inc/ApEngineConsts.h     MW_LAYER_PUBLIC_EXPORT_PATH(ApEngineConsts.h)
+../inc/ApEngineVer.h     MW_LAYER_PUBLIC_EXPORT_PATH(ApEngineVer.h)
+../inc/Aplistitemlist.h     MW_LAYER_PUBLIC_EXPORT_PATH(ApListItemList.h)
+../inc/ApNetworkItemlist.h     MW_LAYER_PUBLIC_EXPORT_PATH(ApNetworkItemList.h)
+../inc/ApListItem.h     MW_LAYER_PUBLIC_EXPORT_PATH(ApListItem.h)
+../inc/APSelect.h     MW_LAYER_PUBLIC_EXPORT_PATH(ApSelect.h)
+../inc/APNetworks.h     MW_LAYER_PUBLIC_EXPORT_PATH(ApNetworks.h)
+../inc/ApNetworkItem.h     MW_LAYER_PUBLIC_EXPORT_PATH(ApNetworkItem.h)
+../inc/APAccessPointItem.h     MW_LAYER_PUBLIC_EXPORT_PATH(ApAccessPointItem.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/access_point_engine_api/inc/APAccessPointItem.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,1307 @@
+/*
+* Copyright (c) 2002 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 the class CApAccessPointItem
+*
+*/
+
+
+#ifndef ACCESSPOINTITEM_H
+#define ACCESSPOINTITEM_H
+
+// Deprecation warning
+#warning This header file has been deprecated. Will be removed in one of the next SDK releases.
+
+ 
+//  INCLUDES
+#include <etelmm.h>
+#include <cdbcols.h>
+#include <nifvar.h>
+#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include <nifvar_internal.h>
+#endif
+#include <ApEngineVer.h>
+#include <ApEngineConsts.h>
+
+
+// DATA TYPES
+/**
+* This enum is used to identify the data when reading or writing
+* CApAccessPointItem data.
+* <br>Field types:
+* <br>
+*    8 - bit text:
+* <br>ReadTextL( const TApMember aColumn, TDes8& aValue )
+* <br>WriteTextL( const TApMember aColumn, const TDesC8& aValue )
+* <br>  EApIspIfCallbackInfo
+* <br>  EApIspInitString
+* <br>
+* <br>
+*    16-bit text:
+* <br>ReadTextL( const TApMember aColumn, TDes16& aValue )
+* <br>WriteTextL( const TApMember aColumn, const TDesC16& aValue )
+* <br>  EApWapAccessPointName
+* <br>  EApWapCurrentBearer
+* <br>  EApWapGatewayAddress
+* <br>  EApWapServiceCentreAddress
+* <br>  EApIapName
+* <br>  EApIapServiceType
+* <br>  EApIspName
+* <br>  EApIspDescription
+* <br>  EApIspDefaultTelNumber
+* <br>  EApIspLoginName
+* <br>  EApIspLoginPass
+* <br>  EApIspIfName
+* <br>  EApGprsIfName
+* <br>  EApIspIfParams
+* <br>  EApGprsIfParams
+* <br>  EApIspIfNetworks
+* <br>  EApGprsIfNetworks
+* <br>  EApIspIfAuthName
+* <br>  EApGprsIfAuthName
+* <br>  EApIspIfAuthPass
+* <br>  EApGprsIfAuthPassword
+* <br>  EApIspIPAddr
+* <br>  EApGprsIpAddr
+* <br>  EApIspIPNetMask
+* <br>  EApGprsIpNetMask
+* <br>  EApIspIPGateway
+* <br>  EApGprsIpGateway
+* <br>  EApIspIPNameServer1
+* <br>  EApGprsIPNameServer1
+* <br>  EApIspIPNameServer2
+* <br>  EApGprsIPNameServer2
+* <br>  EApGprsPdpAddress
+* <br>  EApProxyProtocolName
+* <br>  EApNetworkName
+* <br>  EApProxyLoginName
+* <br>  EApProxyLoginPass
+* <br>  EApIP6NameServer1
+* <br>  EApIP6NameServer2
+* <br>  EApLanBearerName
+* <br>
+* <br>Long text, 16 bit:
+* <br>const HBufC* ReadConstLongTextL( const TApMember aColumn )
+* <br>WriteLongTextL( const TApMember aColumn, const TDesC& aValue )
+* <br>  EApWapStartPage
+* <br>  EApIspLoginScript
+* <br>  EApGprsAccessPointName
+* <br>  EApProxyServerAddress
+* <br>  EApProxyExceptions
+* <br>
+* <br>Uint:
+* <br>ReadUint( const TApMember aColumn, TUint32& aValue )
+* <br>WriteUint( const TApMember aColumn, const TUint32& aValue )
+* <br>  EApWapAccessPointID
+
+// DEPRECATED
+* <br>  EApWapIsp
+
+// DEPRECATED
+* <br>  EApWapChargecard
+
+* <br>  EApWapIap
+
+// DEPRECATED
+* <br>  EApWapIspType
+
+* <br>  EApIapServiceId
+* <br>  EApIapChargecard
+* <br>  EApIspIspType
+* <br>  EApIspAuthRetries
+* <br>  EApGprsIfAuthRetries
+* <br>  EApIspIfCallbackType
+* <br>  EApIspCallBackTimeOut
+* <br>  EApIspBearerName
+* <br>  EApIspBearerSpeed
+* <br>  EApIspBearerCE
+* <br>  EApIspBearerType
+* <br>  EApIspBearerCallTypeIsdn
+* <br>  EApIspChannelCoding
+* <br>  EApIspAIUR
+* <br>  EApIspRequestedTimeSlots
+* <br>  EApIspMaximumTimeSlots
+* <br>  EApGprsPdpType
+* <br>  EApGprsReqPrecedence
+* <br>  EApGprsReqDelay
+* <br>  EApGprsReqReliability
+* <br>  EApGprsReqPeakThroughput
+* <br>  EApGprsReqMeanPeakThroughput
+* <br>  EApGprsMinPrecedence
+* <br>  EApGprsMinDelay
+* <br>  EApGprsMinReliability
+* <br>  EApGprsMinPeakThroughput
+* <br>  EApGprsMinMeanThroughput
+* <br>  EApWapWspOption
+* <br>  EApIspBearerCallTypeIsdn
+* <br>  EApProxyPortNumber
+* <br>  EApNetworkID
+* <br>  EApWapProxyPort
+* <br>  EApIapBearerService
+* <br>  EApIapBearerID
+* <br>
+* <br>Bool:
+* <br>ReadBool( const TApMember aColumn, TBool& aValue )
+* <br>WriteBool( const TApMember aColumn, const TBool& aValue )
+* <br>  EApWapSecurity
+* <br>  EApIspDialResolution
+* <br>  EApIspUseLoginScript
+* <br>  EApIspPromptForLogin
+* <br>  EApIspDisplayPCT
+* <br>  EApIspIfPromptForAuth
+* <br>  EApGprsIfPromptForAuth
+* <br>  EApIspIfCallbackEnabled
+* <br>  EApIspIPAddrFromServer
+* <br>  EApGprsIpAddrFromServer
+* <br>  EApIspIPDnsAddrFromServer
+* <br>  EApGprsIpDnsAddrFromServer
+* <br>  EApIspEnableIpHeaderComp
+* <br>  EApGprsHeaderCompression
+* <br>  EApIspEnableLCPExtensions
+* <br>  EApGprsEnableLCPExtensions
+* <br>  EApIspDisablePlainTextAuth
+* <br>  EApGprsDisablePlainTextAuth
+* <br>  EApIspEnableSWCompression
+* <br>  EApGprsDataCompression
+* <br>  EApGprsUseAnonymAccess
+* <br>  EApIsReadOnly
+* <br>  EApProxyUseProxy
+* <br>  EApHasProxySettings
+* <br>  EApIP6DNSAddrFromServer
+*/
+enum TApMember
+    {
+    // WAP Access Point Table
+    EApWapAccessPointID,            ///< The Uid of the access point.
+                                    ///< READ ONLY, assigned by the database.
+    EApWapAccessPointName,          ///< The name of the access point
+    EApWapCurrentBearer,            ///< Indicates the name of the table from
+                                    ///< which to read the bearer information
+    EApWapStartPage,                ///< WAP start page URL, LONG TEXT!
+
+    // WAP Common (present in both tables)
+    EApWapGatewayAddress,           ///< WAP gateway address (IP address)
+    EApWapWspOption,                ///< Enum value indicating whether
+                                    ///< connection-oriented or connectionless
+                                    ///< API should be used.
+                                    ///< Type is TCommsDbWapWspOption.
+    EApWapSecurity,                 ///< Attepmt secure WTLS connection to
+                                    ///< the gateway
+
+    // WAP IP Bearer Table
+//* DEPRECATED
+    EApWapIsp,                      ///< Identifier of the ISP to use if this
+                                    ///< is an ISP type database
+//* DEPRECATED
+    EApWapChargecard,               ///< Identifier for the chargecard to use
+                                    ///< if this is an ISP type database
+    EApWapIap,                      ///< Identifier of a record in the IAP
+                                    ///< table to be used if this is an IAP
+                                    ///< type database
+//* DEPRECATED
+    EApWapIspType,                  ///< Enum value indicating whether IAP/ISP
+                                    ///< is a dial in or a dial out
+
+    // WAP SMS Bearer Table
+    // EApSmsWapGatewayAddress is mapped to EApWapGatewayAddress,
+    // different enum needed only for being able to
+    // distinguish when editing...
+
+    // IAP Table
+    EApIapName,                     ///< The name of this IAP
+    EApIapServiceType,              ///< Name of service table in this IAP
+    EApIapServiceId,                ///< Identifier of service in this IAP
+    EApIapChargecard,               ///< Identifier of the chargecard in
+                                    ///< this IAP
+
+    // ISP table
+    EApIspName,                     ///< The name of this ISP
+    EApIspDescription,              ///< Application's description of this ISP
+    EApIspIspType,                  ///< Enum value indicating ISP type, e.g.
+                                    ///< Internet ISP, WAP Isp.TCommsDbIspType.
+    EApIspDefaultTelNumber,         ///< Default phone number
+    EApIspDialResolution,           ///< Perform dialing resolution for default
+                                    ///< phone number?
+    EApIspUseLoginScript,           ///< Use login script?
+    EApIspLoginScript,              ///< Login script (used only if Use Login
+                                    ///< Script is true), LONG TEXT.
+    EApIspPromptForLogin,           ///< Prompt user for username and password?
+    EApIspLoginName,                ///< Login name
+    EApIspLoginPass,                ///< Login password
+    EApIspDisplayPCT,               ///< Display PCT (without scanning script
+                                    ///< for READ command) UNUSED, always FALSE
+    EApIspIfName,                   ///< Interface name
+    EApIspIfParams,                 ///< Interface parameter string
+    EApIspIfNetworks,               ///< Comma separated list of network
+                                    ///< protocols
+    EApIspIfPromptForAuth,          ///< Prompt user for authentication
+                                    ///< username and password?
+    EApIspIfAuthName,               ///< Authentication username used by PPP
+    EApIspIfAuthPass,               ///< Authentication password used by PPP
+    EApIspAuthRetries,              ///< Number of times to retry
+                                    ///< authentication if it fails
+    EApIspIfCallbackEnabled,        ///< Is callback enabled?
+    EApIspIfCallbackType,           ///< Enum value indicating the type of
+                                    ///< callback (if enabled).
+                                    ///< enum TCallbackAction.
+    EApIspIfCallbackInfo,           ///< Info for callback request (if enabled)
+                                    ///< 8-bit text field.
+    EApIspCallBackTimeOut,          ///< Time to wait for callback in
+                                    ///< microseconds (if enabled)
+    EApIspIPAddrFromServer,         ///< Get IP address from server?
+    EApIspIPAddr,                   ///< IP address of interface
+    EApIspIPNetMask,                ///< IP net mask of interface
+    EApIspIPGateway,                ///< IP address of gateway
+    EApIspIPDnsAddrFromServer,      ///< Get DNS address from server?
+    EApIspIPNameServer1,            ///< IP address of primary name server
+    EApIspIPNameServer2,            ///< IP address of secondary name server
+    EApIspEnableIpHeaderComp,       ///< Enable IP header compression?
+    EApIspEnableLCPExtensions,      ///< Enable LCP extensions?
+    EApIspDisablePlainTextAuth,     ///< Disable plain text authentication?
+    EApIspEnableSWCompression,      ///< Enable software compression?
+    EApIspBearerName,               ///< Enum value specifying the name of the
+                                    ///< bearer, e.g. Asunchronous Modem,
+                                    ///< RBasicGsmCall::TBearerName
+    EApIspBearerSpeed,              ///< Enum value specifying the bearer speed
+                                    ///< TApCallSpeed.
+    EApIspBearerCallTypeIsdn,       ///< call type is ISDN or Analogue...
+    EApIspBearerCE,                 ///< Enum value specifying the bearer CE,
+                                    ///< RBasicGsmCall::TBearerCE
+    EApIspInitString,               ///< Modem initialization string to be used
+                                    ///< when this ISP is in use.This string
+                                    ///< will be copied into the
+                                    ///< MODEM_ISP_INIT_STRING field by
+                                    ///< NetDial. 8-bit text field.
+    EApIspBearerType,               ///< Enum value indicating connection type
+                                    ///< (CSD or HSCSD), TCommsDbBearerType
+    EApIspChannelCoding,            ///< Enum value specifying HSCSD channel
+                                    ///< coding
+    EApIspAIUR,                     ///< Enum value specifying AIUR for HSCSD
+    EApIspRequestedTimeSlots,       ///< Requested number of time slots for
+                                    ///< HSCSD
+    EApIspMaximumTimeSlots,         ///< Maximum number of time slots for HSCSD
+                                    ///< which could be requested during this
+                                    ///< connection
+
+    EApGprsAccessPointName,         ///< Access Point Name, LONG TEXT!
+    EApGprsPdpType,                 ///< PDP type
+    EApGprsPdpAddress,              ///< PDP address
+    EApGprsReqPrecedence,           ///< Requested quality of service
+                                    ///< precedence class
+    EApGprsReqDelay,                ///< Requested quality of service
+                                    ///< delay class
+    EApGprsReqReliability,          ///< Requested quality of service
+                                    ///< reliability class
+    EApGprsReqPeakThroughput,       ///< Requested quality of service
+                                    ///< peak throughput class
+    EApGprsReqMeanPeakThroughput,   ///< Requested quality of service
+                                    ///< mean throughput class
+    EApGprsMinPrecedence,           ///< Minimum quality of service
+                                    ///< precedence class
+    EApGprsMinDelay,                ///< Minimum quality of service
+                                    ///< delay class
+    EApGprsMinReliability,          ///< Minimum quality of service
+                                    ///< reliability class
+    EApGprsMinPeakThroughput,       ///< Minimum quality of service
+                                    ///< peak throughput class
+    EApGprsMinMeanThroughput,       ///< Minimum quality of service
+                                    ///< mean throughput class
+    EApGprsUseAnonymAccess,         ///< Use anonymous access on?
+
+    // followings are mapped to ISP... fields
+    EApGprsDataCompression,         ///< Data compression on?
+    EApGprsHeaderCompression,       ///< IP header compression on?
+    EApGprsIfName,                  ///< Interface name
+    EApGprsIfParams,                ///< Interface parameter string
+    EApGprsIfNetworks,              ///< Comma separated list of network
+                                    ///< protocols
+    EApGprsIfPromptForAuth,         ///< Prompt user for authentication
+                                    ///< username and password?
+    EApGprsIfAuthName,              ///< Authentication username used by PPP
+    EApGprsIfAuthPassword,          ///< Authentication password used by PPP
+    EApGprsIfAuthRetries,           ///< Number of times to retry
+                                    ///< authentication if it fails
+    EApGprsIpNetMask,               ///< IP net mask of interface
+    EApGprsIpGateway,               ///< IP address of gateway
+    EApGprsIpAddrFromServer,        ///< Get IP adresses (for Symbian OS)
+                                    ///< from server?
+    EApGprsIpAddr,                  ///< IP address of Symbian OS
+    EApGprsIpDnsAddrFromServer,     ///< Get DNS addresses from server?
+    EApGprsIPNameServer1,           ///< IP address of primary name server
+    EApGprsIPNameServer2,           ///< IP address of secondary name server
+    EApGprsEnableLCPExtensions,     ///< Enable LCP extension?
+    EApGprsDisablePlainTextAuth,    ///< Disable plain text authentication?
+    EApIsReadOnly                   ///< Is the current record read only?
+
+
+// expanding this enum is safe and will not cause any trouble as all public 
+// part of this module uses it as a const parameter and NEVER as 
+// a return value, therefore non-aware clients will NEVER meet with the new
+// ones, thus it can not cause any problems that they do not expect them...
+    ,
+    EApProxyServerAddress,          ///< Proxy server address, long text
+    EApProxyProtocolName,           ///< Proxy protocol name, Text
+    EApProxyPortNumber,             ///< Proxy port number,  TUint32
+    EApProxyUseProxy,               ///< Use proxy server?, TBool 
+    EApProxyExceptions,             ///< ';' separated list of addr. for wich 
+                                    ///< the server should not be used. 
+                                    ///< Long text
+    EApHasProxySettings,            ///< Has proxy settings? READ ONLY.
+    EApNetworkID,                   ///< The network ID
+    EApNetworkName,                 ///< The network name
+
+    EApWapProxyPort,                ///< The wap proxy port number
+    EApProxyLoginName,              ///< The proxy login name
+    EApProxyLoginPass,              ///< The proxy login password
+    EApIapBearerService,            ///< Bearer service
+
+    EApIP6DNSAddrFromServer,        ///< Get IPv6 DNS addresses from server?
+    EApIP6NameServer1,              ///< IP address of primary name server
+    EApIP6NameServer2,              ///< IP address of secondary name server
+
+    // CDMA2000
+    EApCdmaIwfName,                 ///< IWF name, Text
+    EApCdmaServiceOption,           ///< Service Option, TUint32
+    EApCdmaPdpType,                 ///< PDP type, TUin32
+    EApCdmaPdpAddress,              ///< PDP address, Text
+    EApCdmaReqFwdPriority,          ///< Requested forward priority, TUint32
+    EApCdmaReqRevPriority,          ///< Requested reverse priority, TUint32
+    EApCdmaReqFwdBitrate,           ///< Requested forward bitrate, TUint32
+    EApCdmaReqRevBitrate,           ///< Requested reverse bitrate, TUint32
+    EApCdmaReqFwdLoss,              ///< Req. forward frame loss rate, TUint32
+    EApCdmaReqRevLoss,              ///< Req. reverse frame loss rate, TUint32
+    EApCdmaReqFwdMaxDelay,          ///< Requested forward delay, TUint32
+    EApCdmaReqRevMaxDelay,          ///< Requested reverse delay, TUint32
+    EApCdmaMinFwdBitrate,           ///< Min. acceptable fwd bitrate, TUint32
+    EApCdmaMinRevBitrate,           ///< Min. acceptable rev bitrate, TUint32
+    EApCdmaAccptFwdLoss,            ///< Max. acc. fwd frame loss rate, TUint32
+    EApCdmaAccptRevLoss,            ///< Max. acc. rev frame loss rate, TUint32
+    EApCdmaAccptFwdMaxDelay,        ///< Max. acceptable forward delay, TUint32
+    EApCdmaAccptRevMaxDelay,        ///< Max. acceptable reverse delay, TUint32
+
+    // CDMA2000, mapped to ISP... fields
+    EApCdmaDataCompression,         ///< Data compression on? TBool
+    EApCdmaHeaderCompression,       ///< IP header compression on? TBool
+    EApCdmaAnonymousAccess,         ///< Use anonymous access on? TBool
+    EApCdmaIfName,                  ///< Interface name
+    EApCdmaIfParams,                ///< Interface parameter string
+    EApCdmaIfNetworks,              ///< Comma separated list of network
+                                    ///< protocols
+    EApCdmaIfPromptForAuth,         ///< Prompt user for authentication
+                                    ///< username and password?
+    EApCdmaIfAuthName,              ///< Authentication username used by PPP
+    EApCdmaIfAuthPassword,          ///< Authentication password used by PPP
+    EApCdmaIfAuthRetries,           ///< Number of times to retry
+                                    ///< authentication if it fails
+    EApCdmaIpNetMask,               ///< IP net mask of interface
+    EApCdmaIpGateway,               ///< IP address of gateway
+    EApCdmaIpAddrFromServer,        ///< Get IP adresses (for Symbian OS)
+                                    ///< from server?
+    EApCdmaIpAddr,                  ///< IP address of Symbian OS
+    EApCdmaIpDnsAddrFromServer,     ///< Get DNS addresses from server?
+    EApCdmaIPNameServer1,           ///< IP address of primary name server
+    EApCdmaIPNameServer2,           ///< IP address of secondary name server
+    EApCdmaEnableLCPExtensions,     ///< Enable LCP extension?
+    EApCdmaDisablePlainTextAuth,    ///< Disable plain text authentication?
+
+    // CDMA2000
+    EApCdmaApType,                  ///< Internet / WAP or both? TUint32
+    EApCdmaQosWarningTimeout,       ///< Notify user if the requested QOS
+                                    ///< cannot be satisfied for this time in
+                                    ///< microseconds, TUint32
+    EApCdmaRlpMode,                 ///< Transparent or non-transparent
+                                    ///< radio link protocol, TUint32
+    // CDMA2000 deprecated Mobile IP fields
+    EApCdmaMip,                     ///< Attempt to use mobile IP, TBool
+    EApCdmaHomeAgentAddress,        ///< Home Agent address, Text
+    EApCdmaMipTimeout,              ///< A normal reconnect (informing the
+                                    ///< user) takes place if both the PPP link
+                                    ///< drops and a change in SID or NID is
+                                    ///< received within this time in
+                                    ///< milliseconds, TUint32
+    // CDMA2000 specific CDMA parameters provisioned through OTA and defined
+    // in TIA-683B section 3.5.8
+    // These fields replace the old Mobile IP fields (above).
+    EApCdmaNaiType,                 ///< Type of NAI, TUint32
+    EApCdmaSimpleIpAuthAlgorithm,   ///< SimpleIP auth.algorithm, TUint32
+    EApCdmaSimpleIpPapSsHandle,     ///< SimpleIP PAP shared secret handle,
+                                    ///< TUint32
+    EApCdmaSimpleIpChapSsHandle,    ///< SimpleIP CHAP shared secret handle,
+                                    ///< TUint32
+    EApCdmaMipTBit,                 ///< Reverse-tunneling reqd flag, TUint32
+    EApCdmaMipHomeAddress,          ///< Home address, Text
+    EApCdmaMipPrimaryHomeAgent,     ///< IP address of mobile node's
+                                    ///< primary home agent, Text
+    EApCdmaMipSecondaryHomeAgent,   ///< IP address of mobile node's
+                                    ///< secondary home agent, Text
+    EApCdmaMipMnAaaAuthAlgorithm,   ///< MN-AAA auth algorithm, TUint32
+    EApCdmaMipMnAaaSpi,             ///< MN-AAA security param index, TUint32
+    EApCdmaMipMnAaaSsHandle,        ///< MN-AAA shared secret handle, TUint32
+    EApCdmaMipMnHaAuthAlgorithm,    ///< MN-HA auth algorithm, TUint32
+    EApCdmaMipMnHaSpi,              ///< MN-HA security param index, TUint32
+    EApCdmaMipMnHaSsHandle,         ///< MN-HA shared secret handle, TUint32
+    
+
+    // WLAN specific fields
+    EApWlanNetworkName,             ///< The network name, Text
+    EApWlanNetworkMode,             ///< Gives network mode, TUint32
+    EApWlanSecurityMode,            ///< The security mode, TUint32
+
+    // WLAN, mapped to ISP... fields
+    EApWlanIfNetworks,              ///< Comma separated list of network
+                                ///< protocols
+    EApWlanIfPromptForAuth,         ///< Prompt user for authentication
+                                ///< username and password?
+    EApWlanIfAuthName,              ///< Authentication username used by PPP
+    EApWlanIfAuthPassword,          ///< Authentication password used by PPP
+    EApWlanIfAuthRetries,           ///< Number of times to retry
+                                ///< authentication if it fails
+    EApWlanIpNetMask,               ///< IP net mask of interface
+    EApWlanIpGateway,               ///< IP address of gateway
+    EApWlanIpAddrFromServer,        ///< Get IP adresses (for Symbian OS)
+                                    ///< from server?
+    EApWlanIpAddr,                  ///< IP address of Symbian OS
+    EApWlanIpDnsAddrFromServer,     ///< Get DNS addresses from server?
+    EApWlanIPNameServer1,           ///< IP address of primary name server
+    EApWlanIPNameServer2,           ///< IP address of secondary name server
+    EApWlanSettingsId,              ///< COMMDB_ID of the WLAN settings,
+                                    ///< TUint32
+    EApWlanScanSSID,                ///< TBool, whether need to scan the SSID
+    EApWlanChannelId,               ///< In ad-hoc network mode, the channel  
+                                    ///< ID, TUint32
+    EApLanBearerName,               ///< The name of the LAN bearer
+    EApIapBearerID,                 ///< UID of the bearer record (LAN/Modem)
+    EApIapBearerType,               ///< The name of the iap bearer 
+                                    ///< table (LAN/Modem)
+    // some defines for UI ONLY, NOT TO BE USED BY ANYONE ELSE!!!
+    EApIpv4Settings = 0x00010000,
+    EApIpv6Settings,
+    EApWlanSecuritySettings         ///< The security settings launcher
+    };
+
+
+
+// CONSTANTS
+// D E P R E C A T E D,  please do not use it!!!!!!!!!!
+// can not remove as it was part of the public API...
+const TInt KApMemberNum = EApGprsDisablePlainTextAuth+1;
+
+// FORWARD
+class CApItemExtra;
+
+// CLASS DECLARATION
+
+
+/**
+* CApAccessPointItem is used to exchange data between engine and client.
+* It holds the information for an access point including WAP, IAP, ISP
+* (if present & applies).
+* This class uses the same approach as CommDB to read and write data: it
+* has functions for each data type implemented. To read or write the data,
+* we have to know the data type and the enum name of the 'column'.
+* The column values has the names of the database columns with the 'EAp'
+* prefix. The reason for this (not using the database column descriptors)
+* is performance. It is much faster to compare enum values than literals.
+*/
+class CApAccessPointItem :public CBase
+    {
+
+    public:  // Constructors and destructor
+        /**
+        * Two-phased constructor. Leaves on failure, places instance
+        * on cleanup stack. Instance is initialised to default values.
+        * The created instance is suitable for passing to CApDataHandler's
+        * functions, contains all necessary information.
+        * @return The constructed CApAccessPointItem.
+        *
+        * @deprecated
+        */
+        IMPORT_C static CApAccessPointItem* NewLC();
+
+
+        /**
+        * Destructor.
+        *
+        * @deprecated
+        */
+        IMPORT_C virtual ~CApAccessPointItem();
+
+
+        /**
+        * Copies the data from another CApAccessPointItem.
+        * Substitute for the "assignment operator". It requires allocation
+        * thus can leave.
+        * Wap Access Point Uid is not copied.
+        *
+        * @deprecated
+        */
+        IMPORT_C void CopyFromL( const CApAccessPointItem& aCopyFrom  );
+
+
+        /**
+        * Equality operator. Wap Access Point Uid is not counted.
+        *
+        * @deprecated
+        */
+        IMPORT_C TBool operator==( const CApAccessPointItem& aitem ) const;
+
+
+        /**
+        * Inequality operator. Wap Access Point Uid is not counted.
+        *
+        * @deprecated
+        */
+        IMPORT_C TBool operator!=( const CApAccessPointItem& aitem ) const;
+
+
+    protected:      // Constructors
+
+        /**
+        * C++ default constructor.
+        *
+        * @deprecated
+        */
+        IMPORT_C CApAccessPointItem();
+
+        /**
+        * Second-phase constructor.
+        *
+        * @deprecated
+        */
+        IMPORT_C void ConstructL();
+
+
+
+
+    public: // New functions
+
+
+        /**
+        * This function reads up an 8-bit text value from the specified column.
+        * @param aColumn Enum value indicating the column to read.
+        * @param aValue Reference to an 8-bit descriptor to hold the value
+        * @return no return value
+        *
+        * @deprecated
+        */
+        IMPORT_C void ReadTextL( const TApMember aColumn, TDes8& aValue );
+
+        /**
+        * This function reads up a 16-bit text value from the specified column.
+        * @param aColumn Enum value indicating the column to read.
+        * @param aValue Reference to a 16-bit descriptor to hold the value
+        * @return no return value
+        *
+        * @deprecated
+        */
+        IMPORT_C void ReadTextL( const TApMember aColumn, TDes16& aValue );
+
+        /**
+        * NOTE: This function is deprecated. Use ReadConstLongTextL!
+        * This function reads up a long text value from the specified column.
+        * The ownership is not passed to the caller. It means that the caller
+        * should not delete the received value.
+        * If the caller must take the ownership for any reason, must make a
+        * copy and use that and delete the copy when no longer needed.
+        * @param aColumn Enum value indicating the column to read.
+        * @return A HBufC* to the value.
+        *
+        * @deprecated
+        */
+        IMPORT_C HBufC* ReadLongTextL( const TApMember aColumn );
+
+
+        /**
+        * This function reads up a long text value from the specified column.
+        * The ownership is not passed to the caller. It means that the caller
+        * should not delete the received value.
+        * If the caller must take the ownership for any reason, must make a
+        * copy and use that and delete the copy when no longer needed.
+        * @param aColumn Enum value indicating the column to read.
+        * @return A const HBufC* to the value.
+        *
+        * @deprecated
+        */
+        IMPORT_C const HBufC* ReadConstLongTextL( const TApMember aColumn );
+
+
+
+        /**
+        * This function reads the length of the text in the specified column.
+        * @param aColumn Enum value indicating the column to read.
+        * @return The length of the text in that column.
+        *
+        * @deprecated
+        */
+        IMPORT_C TUint32 ReadTextLengthL( const TApMember aColumn );
+
+
+        /**
+        * This function reads up a TUint32 value from the specified column.
+        * In case the given value was not written to the database,
+        * it will return KErrValueUnspecified.
+        * If the specified column does not exist (that is, not part of the
+        * database structure), it will Panic in debug builds and it will
+        * return KErrInvalidColumn in release builds without Panicking.
+        * Panic is used in debug builds because it indicates a programming
+        * error. In release, it 'notifies' the caller about the error through
+        * the return value but enables system to continue operation.
+        * @param aColumn Enum value indicating the column to read.
+        * @param aValue A reference to a TUint32 to hold the value
+        * @return Error code.
+        *
+        * @deprecated
+        */
+        IMPORT_C TInt ReadUint( const TApMember aColumn, TUint32& aValue );
+
+        /**
+        * This function reads up a boolean value from the specified column.
+        * If the specified column does not exist (that is, not part of the
+        * database structure), it will Panic in debug builds and it will
+        * return KErrInvalidColumn in release builds without Panicking.
+        * Panic is used in debug builds because it indicates a programming
+        * error. In release, it 'notifies' the caller about the error through
+        * the return value but enables system to continue operation.
+        * @param aColumn Enum value indicating the column to read.
+        * @param aValue A reference to a boolean to hold the value
+        * @return Error code.
+        *
+        * @deprecated
+        */
+        IMPORT_C TInt ReadBool( const TApMember aColumn, TBool& aValue );
+
+
+        // Update
+        /**
+        * This function writes an 8-bit text value to the specified column.
+        * If the specified column does not exist (that is, not part of the
+        * database structure), it will Panic in debug builds and it will
+        * return KErrInvalidColumn in release builds without Panicking.
+        * Panic is used in debug builds because it indicates a programming
+        * error. In release, it 'notifies' the caller about the error through
+        * the return value but enables system to continue operation.
+        * This function can Leave if the copying of the text does not succeed.
+        * Possible leave codes are the system leave codes.
+        * @param aColumn Enum value indicating the column to write.
+        * @param aValue Reference to an 8-bit text descriptor to the value
+        * @return Error code.
+        *
+        * @deprecated
+        */
+        IMPORT_C TInt WriteTextL( const TApMember aColumn,
+                                const TDesC8& aValue );
+
+        /**
+        * This function writes a 16-bit text value to the specified column.
+        * If the specified column does not exist (that is, not part of the
+        * database structure), it will Panic in debug builds and it will
+        * return KErrInvalidColumn in release builds without Panicking.
+        * Panic is used in debug builds because it indicates a programming
+        * error. In release, it 'notifies' the caller about the error through
+        * the return value but enables system to continue operation.
+        * This function can Leave if the copying of the text does not succeed.
+        * @param aColumn Enum value indicating the column to write.
+        * @param aValue Reference to a 16-bit text descriptor to the value
+        * @return Error code.
+        *
+        * @deprecated
+        */
+        IMPORT_C TInt WriteTextL( const TApMember aColumn,
+                                const TDesC16& aValue );
+
+        /**
+        * This function writes a long text value to the specified column.
+        * If the specified column does not exist (that is, not part of the
+        * database structure), it will Panic in debug builds and it will
+        * return KErrInvalidColumn in release builds without Panicking.
+        * Panic is used in debug builds because it indicates a programming
+        * error. In release, it 'notifies' the caller about the error through
+        * the return value but enables system to continue operation.
+        * This function can Leave if the copying of the text does not succeed.
+        * @param aColumn Enum value indicating the column to write.
+        * @param aValue Reference to a 16-bit text descriptor to the value
+        * @return Error code.
+        *
+        * @deprecated
+        */
+        IMPORT_C TInt WriteLongTextL( const TApMember aColumn,
+                                    const TDesC& aValue );
+
+        /**
+        * This function writes a TUint32 value to the specified column.
+        * If the specified column does not exist (that is, not part of the
+        * database structure), it will Panic in debug builds and it will
+        * return KErrInvalidColumn in release builds without Panicking.
+        * Panic is used in debug builds because it indicates a programming
+        * error. In release, it 'notifies' the caller about the error through
+        * the return value but enables system to continue operation.
+        * @param aColumn Enum value indicating the column to write.
+        * @param aValue A const reference to a TUint32 value
+        * @return Error code.
+        *
+        * @deprecated
+        */
+        IMPORT_C TInt WriteUint( const TApMember aColumn,
+                                const TUint32& aValue );
+
+        /**
+        * This function writes a boolean value to the specified column.
+        * If the specified column does not exist (that is, not part of the
+        * database structure), it will Panic in debug builds and it will
+        * return KErrInvalidColumn in release builds without Panicking.
+        * Panic is used in debug builds because it indicates a programming
+        * error. In release, it 'notifies' the caller about the error through
+        * the return value but enables system to continue operation.
+        * @param aColumn Enum value indicating the column to write.
+        * @param aValue A const reference to a boolean value
+        * @return Error code.
+        *
+        * @deprecated
+        */
+        IMPORT_C TInt WriteBool( const TApMember aColumn,
+                                const TBool& aValue );
+
+
+        // Query
+        // COMMON
+        /**
+        * This function returns the ID of the access point
+        * @return The ID of this access point
+        *
+        * @deprecated
+        */
+        IMPORT_C TUint32 WapUid() const;
+
+
+        /**
+        * This function returns the name of the connection
+        * Ownership is not passed.
+        * @return The name of the connection
+        *
+        * @deprecated
+        */
+        IMPORT_C const TDesC& ConnectionName() const;
+
+
+        // WAP-spec.
+        /**
+        * This function returns the current WAP bearer for the access point
+        * Ownership is not passed.
+        * @return The current WAP bearer for the access point
+        *
+        * @deprecated
+        */
+        IMPORT_C const TDesC& WapBearer() const;
+
+
+        /**
+        * This function returns the bearer type for the current access point
+        * @return The current bearer type for the access point
+        *
+        * @deprecated
+        */
+        IMPORT_C TApBearerType BearerTypeL();
+
+
+        /**
+        * This function sets the bearer type for the current access point
+        * @param aBearer TApBearerType enum indicating the desired bearer type.
+        * @return No return value.
+        *
+        * @deprecated
+        */
+        IMPORT_C void SetBearerTypeL( TApBearerType aBearer );
+
+
+        /**
+        * This function writes a 16-bit text value to the 'name' fields
+        * of the access point.
+        * This includes: WAP_ACCESS_POINT, IAP, Dial/in/out/Gprs In/Out
+        * table's COMM_DB_NAME fields.
+        * These fields are (by TApMember): EApWapAccessPointName, EApIapName,
+        * EApIspName.
+        * It is useful if we need to use same names.
+        * @param aValue A const reference to a 16-bit text descriptor to
+        * the value.
+        * @return No return value.
+        *
+        * @deprecated
+        */
+        IMPORT_C void SetNamesL( const TDesC16& aValue );
+
+
+        /**
+        * This function checks the integrity of the CApAccessPointItem.
+        * Currently checks:
+        * IF WAP_IP_BEARER, WAP_ISP_TYPE conforms to IAP_SERVICE_TYPE
+        * @return Boolean indicating whether the sanity check has
+        * passed(ETrue) or not(EFalse)
+        *
+        * @deprecated
+        */
+        IMPORT_C TBool SanityCheckOk();
+
+
+        /**
+        * This function compares this and the passed CApAccessPointItem
+        * whether they have the same ISP and bearer
+        * Returns true if the APs have the same phone number
+        * @param aItem a CApAccessPointItem to compare with
+        * @return whether the APs have the same isp and bearer
+        *
+        * @deprecated
+        */
+        IMPORT_C TBool HasSameIspAndBearerL( CApAccessPointItem& aItem );
+
+        /**
+        * This function returns whether the access point is read-only or not.
+        * @return Whether the current access point is read-only or not.
+        *
+        * @deprecated
+        */
+        IMPORT_C TBool IsReadOnly() const;
+
+    public: // public, not exported, available only inside the ApEngine dll
+        /**
+        * Returnes whether the given access point is a VPN ap or not.
+        */
+        TBool IsVpnAp() const;
+
+        /**
+        * Sets the current access point as VPN or as normal AP.
+        * Internal use only!
+        * @param aIsVpn a TBool specifiyng that the current AP is VPN or not.
+        */
+        void SetVpnAp( TBool aIsVpn );
+
+    private:
+        /**
+        * Returns whether a given member is specified (after reading it from
+        * the DB) or not.
+        * @param aMember The member we would like to knopw if it is specified 
+        * or not.
+        * @return whether a given member is specified (after reading it from
+        * the DB) or not.
+        */
+        TBool Specified( TApMember aMember );
+
+        /**
+        * Sets a given member as specified or not
+        * @param aMember The member to set
+        * @param aOn The value to set
+        */
+        void Specify( TApMember aMember, TBool aOn );
+
+        /**
+        * Sets all WAP member as specified or not
+        * @param aOn The value to set
+        */
+        void SpecifyWap( TBool aOn );
+
+        /**
+        * Sets all IP bearer member as specified or not
+        * @param aOn The value to set
+        */
+        void SpecifyIpBearer( TBool aOn );
+
+        /**
+        * Sets all IAP member as specified or not
+        * @param aOn The value to set
+        */
+        void SpecifyIAP( TBool aOn );
+
+        /**
+        * Sets all ISP member as specified or not
+        * @param aOn The value to set
+        */
+        void SpecifyISP( TBool aOn );
+
+        /**
+        * Sets all GPRS member as specified or not
+        * @param aOn The value to set
+        */
+        void SpecifyGPRS( TBool aOn );
+
+        /**
+        * Sets all CDMA member as specified or not
+        * @param aOn The value to set
+        */
+        void SpecifyCDMA( TBool aOn );
+
+        /**
+        * Sets all WLAN member as specified or not
+        * @param aOn The value to set
+        */
+        void SpecifyWLAN( TBool aOn );
+
+        /**
+        * Sets all member as specified or not
+        * @param aOn The value to set
+        */
+        void SpecifyAll( TBool aOn );
+
+        /**
+        * Sets iGetDNSIPFromServer according the currently valid iPrimaryDNS
+        * & iSecondaryDNS values. Called internally, after every setting of
+        * the above two values
+        */
+        void SetDnsIpFromServer();
+
+        /**
+        * Sets iIspIPAddrFromServer according the currently valid iIspIPAddr
+        * value. Called internally, after every setting of iIspIPAddr values
+        */
+        void SetIpFromServer();
+
+
+        /**
+        * Sets iExt->iIpv6GetDNSIPFromServer according the currently valid 
+        * iExt->iIpv6PrimaryDNS & iExt->iIpv6SecondaryDNS values.
+        * Called internally, after every setting of the above two values
+        */
+        void SetDns6IpFromServer();
+
+
+        /**
+        * Reallocates a passed 16-bit descriptor. Passed descriptor is deleted,
+        * new one is AllocL-ed
+        * Passed descriptor MUST NOT BE on the CleanupStack
+        * @param aDes The descriptor to hold the value
+        * @param aValue The value to pass to the aDes descriptor.
+        */
+        void ReAllocL(HBufC*& aDes, const TDesC16& aValue);
+
+        /**
+        * Reallocates a passed 8-bit descriptor. Passed descriptor is deleted,
+        * new one is AllocL-ed
+        * Passed descriptor MUST NOT BE on the CleanupStack
+        * @param aDes The descriptor to hold the value
+        * @param aValue The value to pass to the aDes descriptor.
+        */
+        void ReAllocL(HBufC8*& aDes, const TDesC8& aValue);
+
+
+        /**
+        * Compares THIS and the passed aItem.
+        * @param aItem The item to compare this to
+        * @return Whether the item is equal with this or not
+        */
+        TBool DoCompareApL( const CApAccessPointItem& aItem ) const;
+
+
+        /**
+        * Compares the WAP part of THIS and the passed aItem.
+        * Does not compares IAP ID
+        * @param aItem The item to compare this to
+        * @return Whether the WAP part is equal with this or not
+        */
+        TBool CompareWap( const CApAccessPointItem& aItem ) const;
+
+
+        /**
+        * Compares the IAP part of THIS and the passed aItem.
+        * @param aItem The item to compare this to
+        * @return Whether the IAP part is equal with this or not
+        */
+        TBool CompareIap( const CApAccessPointItem& aItem ) const;
+
+
+        /**
+        * Compares the IsP part of THIS and the passed aItem.
+        * @param aItem The item to compare this to
+        * @return Whether the ISP part is equal with this or not
+        */
+        TBool CompareIsp( const CApAccessPointItem& aItem ) const;
+
+
+        /**
+        * Compares the Gprs part of THIS and the passed aItem.
+        * @param aItem The item to compare this to
+        * @return Whether the GPRS part is equal with this or not
+        */
+        TBool CompareGprs( const CApAccessPointItem& aItem ) const;
+
+
+        /**
+        * Compares the Cdma part of THIS and the passed aItem.
+        * @param aItem The item to compare this to
+        * @return Whether the CDMA part is equal with this or not        
+        */
+        TBool CompareCdma( const CApAccessPointItem& aItem ) const;
+
+
+        /**
+        * Compares the Wlan part of THIS and the passed aItem.
+        * @param aItem The item to compare this to
+        * @return Whether the WLAN part is equal with this or not
+        */
+        TBool CompareWlan( const CApAccessPointItem& aItem ) const;
+
+
+        /**
+        * Removes leading 0s from the passed IP address.
+        * @param aValue A descriptor holding the IP address to remove
+        * leading 0s from
+        * @return A newly allocated HBufC holding the resulting string.
+        */
+        HBufC* GetCleanIpAddressLC( const TDesC& aValue );
+
+
+
+        /**
+        * Removes invalid chars e.g. space, () from the passed phone number.
+        * (valid are 0,1,2,..9,p,w,+,*,#)
+        * Strips pre- and postfixes, prefix separator is#,
+        * postfix separators are p, w or +
+        * @param aValue A descriptor holding the phone number
+        * @return A newly allocated HBufC holding the resulting string.
+        */
+        HBufC* GetPlainPhoneNumberLC( const TDesC& aNumber );
+
+
+        /**
+        * Compares the 'default phone number' (ISP dial-in number) of this
+        * and the passed CApAccessPointItem
+        * @param aItem The item to compare this to
+        * @return a TBool indicating whether the phone numbers are
+        * the same or not.
+        */
+        TBool IsSamePhoneNumberL( CApAccessPointItem& aItem );
+
+
+        /**
+        * Removes invalid chars from the passed phone number
+        * @param aIntext Text to remove invalid characters from phone number
+        * @return a HBufC holding the new text
+        */
+        HBufC* RemoveInvalidPhoneCharsLC( const TDesC16& aInText );
+
+
+        /**
+        * Removes invalid chars from the passed text
+        * Invalid chars are: TAB
+        * @param aIntext Text to remove invalid characters from        
+        * @return a HBufC16 holding the new text
+        */
+        HBufC* RemoveInvalidCharsLC( const TDesC16& aInText );
+
+
+        /**
+        * Removes invalid chars from the passed text
+        * Invalid chars are: TAB
+        * @param aIntext Text to remove invalid characters from        
+        * @return a HBufC8 holding the new text
+        */
+        HBufC8* RemoveInvalidCharsLC( const TDesC8& aInText );
+
+
+        /**
+        * Compares the proxy data of this and the passed CApAccessPointItem.
+        * @param aItem The item to compare this to
+        * @return Whether the Proxy part is equal with this or not
+        */
+        TBool CompareProxy( const CApAccessPointItem& aItem ) const;
+
+
+        /**
+        * Returns whether the Ap has proxy data or not.
+        * @return Whether the Ap has proxy data or not.
+        */
+        TBool HasProxy() const;
+
+
+        /**
+        * Sets the proxy flag.
+        */
+        void SetProxyFlag();
+
+
+        /**
+        * Limits the speed after changing e.g. bearer type
+        */
+        void LimitSpeedL();
+
+
+        /**
+        * Sets the IfNetworks value according to the bearer type and 
+        * the IPv6 support availability. The required values are:
+        * IPv4:
+        *   GPRS/CDMA, pdptype ipv4 "ip",
+        *   CSD                     "ip"
+        *   HSCSD                   "ip"
+        * IPv6:
+        *   GPRS/CDMA, pdptype ipv4 "ip",
+        *   GPRS/CDMA, pdptype ipv6 "ip6",
+        *   CSD                     "ip,ip6"
+        *   HSCSD                   "ip,ip6"
+        *
+        */
+        void SetIfNetworksL();
+
+
+        /**
+        * Check if aColumn is supported.
+        * @param aColumn Enum value indicating the column to check.
+        * @return Whether the given member is supported or not
+        */
+        TBool IsSupported( TApMember aColumn );
+
+
+        /**
+        * Leave with KErrNotSupported if aColumn is not supported.
+        * @param aColumn Enum value indicating the column to check.
+        */
+        void LeaveIfUnsupportedL( TApMember aColumn );
+
+
+        /**
+        * Returns whether this item has WLAN or not
+        * @return Whether this item has WLAN or not
+        */
+        TBool IsWlan();
+
+
+        /**
+        * Limit the Ip6 DNS address
+        * In case of CSD, HSCSD, only Well-known and User defined is supported, 
+        * so if the bearer is changed from something else to these bearer
+        * types, the possible 'Dynamic' should be replaced with Well-known
+        */
+        void LimitIp6DNSL();
+
+private:    // Data
+
+        // member data
+        // COMMON
+        TUint32 iWapUid;        ///< The unique identifier of the AP record.
+        HBufC* iWapAccessPointName;
+
+
+        // WAP-spec.
+        HBufC* iWapBearer;
+        HBufC* iStartingPage;
+
+        // common for bearers
+        HBufC* iWapGatewayAddress;  ///< The WAP gateway address
+        TBool iIsWTLSSecurityOn;
+        TUint32 iIsConnectionTypeContinuous;
+
+        CApItemExtra*   iExt;
+        TUint32         iChargeCard;
+        TUint32         iWapIap;
+        TUint32         iWapIspType;    // deprecated, not used but kept 
+                                        // to keep member positions
+
+
+        // IAP-part
+        HBufC* iIapName;
+
+        TUint32 iIapServiceId;
+        HBufC* iIapServiceType;
+
+        TUint32 iIapChargeCardId;
+
+        // ISP-part
+        HBufC* iIspName;
+        HBufC* iIspDescription;
+        TCommsDbIspType  iIspType;
+        HBufC* iIspDefaultTelNumber;
+        TBool iIspDialResolution;
+        TBool iUseLoginScript;
+        HBufC* iLoginScript;
+        TBool iPromptPassword;
+        HBufC* iUserName;
+        HBufC* iPassword;
+        TBool iDisplayTerminalWindow;
+        HBufC* iIspIfName;
+        HBufC* iIspIfParams;
+        HBufC* iIspIfNetworks;
+        TBool iIspIfPromptForAuth;
+        HBufC* iIspIfAuthName;
+        HBufC* iIspIfAuthPass;
+        TUint32 iIspIfAuthRetries;
+        TBool iUseCallBack;
+        TCallbackAction iCallBackTypeIsServerNum;
+        HBufC8* iIspIfCallbackInfo;
+        TUint32 iIspCallbackTimeOut;
+        TBool iIspIPAddrFromServer;
+        HBufC* iIspIPAddr;
+        HBufC* iIspIPNetMask;
+        HBufC* iIspGateway;
+        TBool iGetDNSIPFromServer;
+        HBufC* iPrimaryDNS;
+        HBufC* iSecondaryDNS;
+        TBool iEnablePPPCompression;
+        TBool iIspEnableLCPExtensions;
+        TBool iIsPasswordAuthenticationSecure;
+        TBool iIspEnableSwCompression;
+        /*****************************************************
+        *   Series 60 Customer / ETel
+        *   Series 60   ETel API
+        *****************************************************/
+        TInt    iIspBearerName; // RMobileCall::TMobileCallDataServiceCaps  
+        TApCallSpeed iMaxConnSpeed;
+        TApCallType iBearerCallTypeIsdn; //RMobileCall::TMobileCallDataProtocol
+        TInt    iIspBearerCE; // RMobileCall::TMobileCallDataQoS 
+        HBufC8* iIspInitString;
+        TUint32 iIspBearerType;
+        TUint32 iIspChannelCoding;
+        TUint32 iIspAIUR;
+        TUint32 iIspRequestedTimeSlots;
+        TUint32 iIspMaximumTimeSlots;
+
+        // GPRS part
+        HBufC*  iGprsAccessPointName;
+        TUint32 iGprsPdpType;
+        HBufC*  iGprsPdpAddress;
+        TUint32 iGprsReqPrecedence;
+        TUint32 iGprsReqDelay;
+        TUint32 iGprsReqReliability;
+        TUint32 iGprsReqPeakThroughput;
+        TUint32 iGprsReqMeanPeakThroughput;
+        TUint32 iGprsMinPrecedence;
+
+        TUint32 iGprsMinDelay;
+        TUint32 iGprsMinReliability;
+        TUint32 iGprsMinPeakThroughput;
+        TUint32 iGprsMinMeanThroughput;
+        TBool   iGprsUseAnonymAccess;
+
+        CArrayFixFlat<TBool>    *iSpecified;
+        TBool iIsReadOnly;
+
+        HBufC*  iApProxyProtocolName;
+        HBufC*  iApProxyServerAddress;
+        TUint32 iApProxyPortNumber;
+        TBool   iApProxyUseProxy;
+        HBufC*  iApProxyExceptions;
+        TBool   iApHasProxySettings;
+
+        TUint32 iNetworkId;
+        TUint32 iWapProxyPort;
+        HBufC*  iNetworkName;
+        HBufC*  iWapProxyLoginName;
+        HBufC*  iWapProxyLoginPass;
+        TUint32 iApIapBearerService; // RMobileCall::TMobileCallDataServiceCaps
+
+
+
+    protected:  // Friend classes
+        friend class CApDataHandler;
+
+
+    };
+
+#endif      // ACCESSPOINTITEM_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/access_point_engine_api/inc/APDataHandler.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,1131 @@
+/*
+* Copyright (c) 2002 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 CApDataHandler
+*
+*/
+
+
+#ifndef APDATAHANDLER_H
+#define APDATAHANDLER_H
+
+// Deprecation warning
+#warning This header file has been deprecated. Will be removed in one of the next SDK releases.
+ 
+ 
+//  INCLUDES
+#include <commdb.h>
+#include <etelmm.h>
+#include <ApEngineVer.h>
+#include <ApEngineConsts.h>
+
+
+// FORWARD DECLARATIONS
+class CApAccessPointItem;
+class CApNetworkItem;
+
+// extra data holder.
+typedef struct
+    {
+        TInt    iIsIpv6Supported;            // Is Ipv6 Supported?
+        TBool   iIsFeatureManagerInitialised;// Is FeatureManager Initialised?
+
+        /**
+        * Indicates if HSCSD Access point is supported or not.
+        */
+        TBool   iIsAppHscsdSupport;              
+
+        TInt    iVariant;               /// Local variant value
+
+
+    }THandlerExtra;
+
+// CLASS DECLARATION
+
+/**
+*  Representation of the access point handler.
+*  Encapsulates a session with the CommsDB
+*  Provides a way to access the database and manipulate its data.
+*/
+class CApDataHandler :public CBase
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor. Leaves on failure, places instance
+        * on cleanup stack.
+        * @param aDb a reference to a CCommsDataBase object.
+        * @return The constructed CApDataHandler.
+        *
+        * @deprecated
+        */
+        IMPORT_C static CApDataHandler* NewLC( CCommsDatabase& aDb );
+
+
+        /**
+        * Destructor.
+        *
+        * @deprecated
+        */
+        IMPORT_C virtual ~CApDataHandler();
+
+
+protected:      // Constructors
+
+        /**
+        * C++ default constructor.
+        *
+        * @deprecated
+        */
+        IMPORT_C CApDataHandler();
+
+        /**
+        * Second-phase constructor.
+        *
+        * @deprecated
+        */
+        IMPORT_C void ConstructL( CCommsDatabase& aDb );
+
+
+    private:
+
+
+    public: // New functions
+        // query
+        /**
+        * Reads up one access point's data from the database.
+        * Expects that CApDataHandler has been created and the database had
+        * been opened.
+        * In case of error, function leaves with error code.
+        * <br>Error conditions:
+        *   - Insufficient memory,
+        *   - AP does not exists,
+        *   - Server connection failure.
+        *
+        * @param aUid The Uid of the access point to be read
+        * @param aApItem A reference to a CApAccessPointItem to hold the data.
+        * @return no return value.
+        *
+        * @deprecated
+        */
+        IMPORT_C void AccessPointDataL( TUint32 aUid,
+                                      CApAccessPointItem& aApItem );
+
+
+        // update
+        /**
+        * Updates data stored in an existing access point.
+        * Expects that CApDataHandler has been created and the database had
+        * been opened.
+        * In case of error, no data is stored.
+        * <br>Error conditions:
+        *   - Insufficient memory
+        *   - Server connection failure
+        *   - Lock already present by other task
+        *   - Uid does not exists.
+        *   - Attempting to update read-only records will result
+        *     in KErrAccessDenied
+        *
+        * @param aApItem A reference to a CApAccessPointItem holding the data
+        * @param aNameChanged a reference to a TBool that will indicate
+        * whether the name has changed or not.
+        * @return No return value.
+        *
+        * @deprecated
+        */
+        IMPORT_C void UpdateAccessPointDataL( CApAccessPointItem& aApItem,
+                                              TBool& aNameChanged );
+
+
+        // Creating new AP
+        /**
+        * Creates a copy of a previously existing access point.
+        * Expects that CApDataHandler has been created and the database had
+        * been opened.
+        * In case of error, no access point will be created.
+        * <br>Error conditions:
+        *   - Insufficient memory
+        *   - Server connection failure.
+        *   - Lock already present by other task.
+        *   - Access point does not exist.
+        *   - Attempting to create new in protected tables will results
+        *     in KErrAccessDenied
+        *
+        * @param aBaseId The UID of the existing access point to copy from.
+        * @return The Uid of the newly constructed and saved access point.
+        *
+        * @deprecated
+        */
+        IMPORT_C TUint32 CreateCopyFromL( TUint32 aBaseId );
+
+
+        /**
+        * Create a new access point from supplied data
+        * Expects that CApDataHandler has been created and the database had
+        * been opened.
+        * The name of the AP will be corrected to be unique if necessary and
+        * returned in the passed aApItem.
+        * In case of error, no access point will be created and the passed
+        * one will remain intact.
+        * <br>Error conditions:
+        *   - Insufficient memory
+        *   - Server connection failure.
+        *   - Lock already present by other task.
+        *   - Attempting to create new in protected tables will result
+        * in KErrAccessDenied
+        *
+        * @param aApItem Reference to a CApAccessPointItem holding the data
+        * @return The UID of the newly created and saved access point.
+        *
+        * @deprecated
+        */
+        IMPORT_C TUint32 CreateFromDataL( CApAccessPointItem& aApItem );
+
+
+        // Remove
+        /**
+        * Removes the given access point from the database.
+        * Expects that CApDataHandler has been created and the database had
+        * been opened.
+        * In case of error, access point will not be removed.
+        * <br>Error conditions:
+        *   - Insufficient memory,
+        *   - Server connection failure.
+        *   - Lock already present by other task.
+        *   - Access point does not exist.
+        *   - Attempting to remove read-only records will result
+        * in KErrAccessDenied
+        *
+        * @param aUid The UID of the access point to remove.
+        * @return no return value.
+        *
+        * @deprecated
+        */
+        IMPORT_C void RemoveAPL( TUint32 aUid );
+
+
+        // Getting default access point
+        /**
+        * Reads the UID of the default access point.
+        * Expects that CApDataHandler has been created and the database had
+        * been opened.
+        * In case of error, leaves with CommsDb or system error codes.
+        * <br>Error conditions:
+        *   - Insufficient memory;
+        *   - Server connection failure;
+        *   - Lock already present;
+        *   - Access point does not exists.
+        *
+        * @param aIsWAP A boolean indicating whether to read the default
+        * WAP or the default IAP/ISP (dep. on the database type) access point.
+        * @return The UID of the default access point.
+        *
+        * @deprecated
+        */
+        IMPORT_C TUint32 DefaultL( TBool aIsWap ) const;
+
+
+        // Setting as default
+        /**
+        * Sets the default access point.
+        * Expects that CApDataHandler has been created and the database had
+        * been opened.
+        * In case of error, leaves with CommsDb or system error codes.
+        * <br>Error conditions:
+        *   - Insufficient memory;
+        *   - Server connection failure;
+        *   - Lock already present;
+        *   - Access point does not exists.
+        *   - Given Access Point is not of the desired type.
+        *
+        * @param aUid The UID of the access point to be set as default.
+        * @param aIntendedType The default type ( IAP, WAP, Both).
+        *
+        * @deprecated
+        */
+        IMPORT_C void SetAsDefaultL(TUint32 aUid,
+                                    TCommsDbIspType aIntendedType );
+
+
+
+        // Setting preferences
+        /**
+        * Sets the access point preference. Can be used only if the
+        * database type is IAP.
+        * Expects that CApDataHandler has been created and the database had
+        * been opened.
+        * In case of error, leaves with CommsDb or system error codes.
+        * <br>Error conditions:
+        *   - Insufficient memory;
+        *   - Server connection failure;
+        *   - Lock already present;
+        * Can also leave with KErrAlreadyExists (if aOverWrite is EFalse ).
+        * @param aRank The ranking of the connection preference.
+        * @param aDircetion Specifies the direction of this connection
+        * preference
+        * @param aBearers The bearer set being valid for this connection
+        * preference
+        * @param aPrompt Enum value indicating whether or not the user
+        * should be prompted or warned on connection
+        * @param aIAP The identifier of the preferred IAP for this connection.
+        * @param aOverwrite Boolean value indicating that if a same record
+        * present, overwrite it or not.
+        *
+        * @deprecated
+        */
+        IMPORT_C void SetPreferredIfDbIapTypeL
+                                    (
+                                    TUint32 aRank,
+                                    TCommDbConnectionDirection aDirection,
+                                    TUint32 aBearers,
+                                    TCommDbDialogPref aPrompt,
+                                    TUint32 aIAP,
+                                    TBool aOverwrite
+                                    );
+
+        /**
+        * Sets the access point preference. Can be used only if the
+        * database type is ISP.
+        * Expects that CApDataHandler has been created and the database had
+        * been opened.
+        * In case of error, leaves with CommsDb or system error codes.
+        * <br>Error conditions:
+        *   - Insufficient memory;
+        *   - Server connection failure;
+        *   - Lock already present;
+        * Can also leave with KErrAlreadyExists (if aOverWrite is EFalse ).
+        * @param aRank The ranking of the connection preference.
+        * @param aDircetion Specifies the direction of this connection
+        * preference
+        * @param aBearers The bearer set beeing valid for this connection
+        * preference
+        * @param aPrompt Enum value indicating whether or not the user
+        * should be prompted or warned on connection
+        * @param aISP The identifier of the preferred ISP for this connection.
+        * @param aChargeCard Identifier of the preferred chargecard for
+        * this connection.
+        * @param aServiceType The type of the service.
+        * @param aOverwrite Boolean value indicating that if a same record is
+        * present, overwrite it or not.
+        *
+        * @deprecated
+        */
+        IMPORT_C void SetPreferredIfDbIspTypeL
+                                    (
+                                    TUint32 aRank,
+                                    TCommDbConnectionDirection aDirection,
+                                    TUint32 aBearers,
+                                    TCommDbDialogPref aPrompt,
+                                    TUint32 aISP,
+                                    TUint32 aChargeCard,
+                                    const TDesC& aServiceType,
+                                    TBool aOverwrite
+                                    );
+
+
+
+        /**
+        * Gets the access point preference. Can be used only if the
+        * database type is IAP.
+        * Expects that CApDataHandler has been created and the database had
+        * been opened.
+        * In case of error, leaves with CommsDb or system error codes.
+        * <br>Error conditions:
+        *   - Insufficient memory;
+        *   - Server connection failure;
+        *   - Lock already present;
+        * @param aRank The ranking of the desired connection preference.
+        * @param aDircetion Specifies the direction of the desired connection
+        * preference
+        * @param aBearers The bearer set beeing valid for this connection
+        * preference
+        * @param aPrompt Enum value indicating whether or not the user
+        * should be prompted or warned on connection
+        * @param aIAP The identifier of the preferred IAP for this
+        * connection preference.
+        *
+        * @deprecated
+        */
+        IMPORT_C void GetPreferredIfDbIapTypeL
+                                    (
+                                    TUint32 aRank,
+                                    TCommDbConnectionDirection aDirection,
+                                    TUint32& aBearers,
+                                    TUint32& aPrompt,
+                                    TUint32& aIAP
+                                    );
+
+        /**
+        * Gets the access point preference. Can be used only if the
+        * database type is ISP.
+        * Expects that CApDataHandler has been created and the database had
+        * been opened.
+        * In case of error, leaves with CommsDb or system error codes.
+        * <br>Error conditions:
+        *   - Insufficient memory;
+        *   - Server connection failure;
+        *   - Lock already present;
+        * @param aRank The ranking of the desired connection preference.
+        * @param aDircetion Specifies the direction of the desired connection
+        * preference
+        * @param aBearers The bearer set beeing valid for this connection
+        * preference
+        * @param aPrompt Enum value indicating whether or not the user
+        * should be prompted or warned on connection
+        * @param aISP The identifier of the preferred ISP for this
+        * connection preference.
+        * @param aChargeCard Identifier of the preferred chargecard for
+        * this connection preference.
+        * @return The type of the service.
+        *
+        * @deprecated
+        */
+        IMPORT_C const TDesC& GetPreferredIfDbIspTypeL
+                                    (
+                                    TUint32 aRank,
+                                    TCommDbConnectionDirection aDirection,
+                                    TUint32& aBearers,
+                                    TUint32& aPrompt,
+                                    TUint32& aISP,
+                                    TUint32& aChargeCard
+                                    );
+
+
+        // Getting default access point
+        /**
+        * Reads the UID of the default access point.
+        * Expects that CApDataHandler has been created and the database had
+        * been opened.
+        * In case of error, leaves with CommsDb or system error codes.
+        * <br>Error conditions:
+        *   - Insufficient memory;
+        *   - Server connection failure;
+        *   - Lock already present;
+        *   - Access point does not exists.
+        *
+        * @param aIsWAP A boolean indicating whether to read the default
+        * WAP or the default IAP/ISP (dep. on the database type) access point.
+        * @param aReadOnly A TBool passed by reference to hold whether the
+        * the default access point record is read-only or not.
+        * @return The UID of the default access point.
+        *
+        * @deprecated
+        */
+        IMPORT_C TUint32 DefaultL( TBool aIsWap, TBool& aReadOnly )const;
+
+
+
+
+        // Remove
+        /**
+        * Removes the given network group from the database.
+        * Expects that CApDataHandler has been created and the database had
+        * been opened.
+        * In case of error, network group will not be removed.
+        * <br>Error conditions:
+        *   - Insufficient memory,
+        *   - Server connection failure.
+        *   - Lock already present by other task.
+        *   - network group does not exist.
+        *   - Attempting to remove read-only records will result
+        * in KErrAccessDenied
+        *
+        * @param aUid The UID of the network group to remove.
+        * @return no return value.
+        *
+        * @deprecated
+        */
+        IMPORT_C void RemoveNetworkL( TUint32 aUid );
+
+
+        /**
+        * Creates a network group from the data.
+        * Expects that CApDataHandler has been created and the database had
+        * been opened.
+        * In case of error, network group will not be created.
+        * <br>Error conditions:
+        *   - Insufficient memory,
+        *   - Server connection failure.
+        *   - Lock already present by other task.
+        *   - network group does not exist.
+        *   - Attempting to remove read-only records will result
+        * in KErrAccessDenied
+        *
+        * @param aNetwork The network item to create/write into db.
+        * @return no return value.
+        *
+        * @deprecated
+        */
+        IMPORT_C void CreateNetworkL( CApNetworkItem& aNetwork );
+
+
+        /**
+        * Reads up a network part of the access point
+        * Network is identified by the iNetworkId of the passed access point
+        *
+        * @deprecated
+        */
+        IMPORT_C void ReadNetworkPartL( CApAccessPointItem& aItem );
+
+
+
+        /**
+        * Reads up a network 
+        * Network is identified by passed uid
+        *
+        * @deprecated
+        */
+        IMPORT_C void ReadNetworkL( TUint32 aUid, CApNetworkItem& aNetwork );
+
+
+    protected:  // New functions
+        /**
+        * Reads the WAP part of the data from the database.
+        * In case of error, leaves with CommDb error codes.
+        * @param aWapId The UID of the Access Point to read the data from.
+        * @param aApItem A reference to a CApAccessPointItem to hold the data
+        * @return No return value.
+        */
+        void ReadWapDataL( TUint32 aWapId, CApAccessPointItem& aApItem );
+
+
+        /**
+        * Reads the IAP part of the data from the database.
+        * In case of error, leaves with CommDb error codes.
+        * @param aIapId The UID of the record in the IAP table to read
+        * the data.
+        * @param aApItem A reference to a CApAccessPointItem to hold the data
+        * @return No return value.
+        */
+        void ReadIapDataL( TUint32 aIapId, CApAccessPointItem& aApItem );
+
+
+        /**
+        * Reads the ISP part of the data from the database.
+        * In case of error, leaves with CommDb error codes.
+        * @param aIspId The UID of the record in the ISP table to
+        * read the data.
+        * @param aApItem A reference to a CApAccessPointItem to hold the data
+        * @return No return value.
+        */
+        void ReadIspDataL( TUint32 aIspId, CApAccessPointItem& aApItem );
+
+
+        /**
+        * Reads the GPRS data from the database.
+        * In case of error, leaves with CommDb error codes.
+        * @param aIspId The UID of the record in the GPRS table to
+        * read the data from.
+        * @param aApItem A reference to a CApAccessPointItem to hold the data
+        * @return No return value.
+        */
+        void ReadGprsDataL( TUint32 aIspId, CApAccessPointItem& aApItem );
+
+
+        /**
+        * Reads the LAN data from the database.
+        * In case of error, leaves with CommDb error codes.
+        * @param aIspId The UID of the record in the LAN table to
+        * read the data from.
+        * @param aApItem A reference to a CApAccessPointItem to hold the data
+        * @return No return value.
+        */
+        void ReadLanDataL( TUint32 aIspId, CApAccessPointItem& aApItem );
+
+
+        /**
+        * Reads the DialIn/Out ISP data from the database.
+        * In case of error, leaves with CommDb error codes.
+        * @param aIspId The UID of the record in the Dialup table to
+        * read the data from.
+        * @param aApItem A reference to a CApAccessPointItem to hold the data
+        * @return No return value.
+        */
+        void ReadDialInOutDataL( TUint32 aIspId, CApAccessPointItem& aApItem );
+
+        
+        /**
+        * Reads up the VPN bearer type info in case of a VPN access point
+        * In case of error, leaves with CommDb error codes.
+        * @param aIspId The UID of the record in the VPN table to
+        * read the data from.
+        * @param aApItem A reference to a CApAccessPointItem to hold the data
+        * @return No return value.
+        */
+        void ReadVpnInfoL( TUint32 aIspId, CApAccessPointItem& aApItem);
+
+
+        /**
+        * Writes the WAP bearer part of the data to the database.
+        * In case of error, leaves with CommDb error codes.
+        * @param aIsNew A Boolean indicating whether it is a new record or it
+        * is an update operation.
+        * @param aWapId The UID of the WAP Access Point record to update.
+        * Used only if aIsNew EFalse.
+        * @param aApItem Reference to a CApAccessPointItem which holds the data
+        * @return No return value.
+        */
+        void WriteWapBearerDataL
+                        (
+                        TBool aIsNew,
+                        TUint32 aWapId,
+                        CApAccessPointItem& aApItem
+                        );
+
+
+        /**
+        * Writes the WAP AP part of the data to the database.
+        * In case of error, leaves with CommDb error codes.
+        * @param aIsNew A Boolean indicating whether it is a new record or it
+        * is an update operation.
+        * @param aWapId The UID of the WAP Access Point record to update.
+        * Used only if aIsNew EFalse.
+        * @param aApItem Reference to a CApAccessPointItem which holds the data
+        * @return No return value.
+        */
+        void WriteWapApDataL
+                        (
+                        TBool aIsNew,
+                        TUint32 aWapId,
+                        CApAccessPointItem& aApItem
+                        );
+
+
+
+        /**
+        * Writes the IAP part of the data to the database.
+        * In case of error, leaves with CommDb error codes.
+        * @param aIsNew A Boolean indicating whether it is a new record or it
+        * is an update operation.
+        * @param aIapId The UID of the IAP Access Point record to update.
+        * Used only if aIsNew EFalse.
+        * @param aApItem Reference to a CApAccessPointItem which holds the data
+        * @return No return value.
+        */
+        void WriteIapDataL
+                        (
+                        TBool aIsNew,
+                        TUint32 aIapId,
+                        CApAccessPointItem& aApItem
+                        );
+
+        /**
+        * Writes the ISP part of the data to the database.
+        * In case of error, leaves with CommDb error codes.
+        * @param aIsNew A Boolean indicating whether it is a new record or it
+        * is an update operation.
+        * @param aIspId The UID of the ISP Access Point record to update.
+        * Used only if aIsNew EFalse.
+        * @param aApItem Reference to a CApAccessPointItem which holds the data
+        * @return No return value.
+        */
+        void WriteIspDataL( TBool aIsNew, TUint32 aIspId,
+                            CApAccessPointItem& aApItem );
+
+        /**
+        * Writes the Gprs data to the database.
+        * In case of error, leaves with CommDb error codes.
+        * @param aIsNew A Boolean indicating whether it is a new record or it
+        * is an update operation.
+        * @param aApItem Reference to a CApAccessPointItem which holds the data
+        * @return No return value.
+        */
+        void WriteGprsDataL( TBool aIsNew,
+                            CApAccessPointItem& aApItem );
+
+        /**
+        * Writes the LAN data to the database.
+        * In case of error, leaves with CommDb error codes.
+        * @param aIsNew A Boolean indicating whether it is a new record or it
+        * is an update operation.
+        * @param aApItem Reference to a CApAccessPointItem which holds the data
+        * @return No return value.
+        */
+        void WriteLanDataL( TBool aIsNew,
+                            CApAccessPointItem& aApItem );
+
+
+        /**
+        * Writes the data to the database.
+        * In case of error, leaves with CommDb error codes.
+        * @param aApItem Reference to a CApAccessPointItem which holds the data
+        * @param aIsNew A Boolean indicating whether it is a new record or it
+        * is an update operation.
+        * @return No return value.
+        */
+        TUint32 DoUpdateAccessPointDataL( CApAccessPointItem& aApItem,
+                                       TBool aIsNew, TBool& aNameChanged );
+
+
+        /**
+        * Sets the default IAP & ISP records in Global Settings.
+        * In case of error, leaves with CommDb error codes.
+        * @param aApItem A UID to the WAP Access Point record to
+        * be used as a default.
+        * @return No return value.
+        */
+        void SetDefaultIapIspL( TUint32 aUid );
+
+        // Remove
+        /**
+        * Removes the WAP_BEARER table part of the access point from
+        * the database.
+        * Expects that CApDataHandler has been created and the database had
+        * been opened.
+        * In case of error, access point will not be removed.
+        * @param aUid The UID of the access point to remove.
+        * @return No return value.
+        */
+        void RemoveWapBearerApL( TUint32 aUid );
+
+
+        /**
+        * Removes the WAP_ACCESS_POINT table part of the access point from
+        * the database.
+        * Expects that CApDataHandler has been created and the database had
+        * been opened.
+        * In case of error, access point will not be removed.
+        * @param aUid The UID of the access point to remove.
+        * @return No return value.
+        */
+        void RemoveWapApL( TUint32 aUid );
+
+
+        /**
+        * Removes the IAP part of the access point from the database.
+        * Expects that CApDataHandler has been created and the database had
+        * been opened.
+        * In case of error, access point will not be removed.
+        * @param aUid The UID of the IAP part of the access point to remove.
+        * @return No return value.
+        */
+        void RemoveIapL( TUint32 aUid );
+
+
+        /**
+        * Removes the ISP part of the access point from the database.
+        * Expects that CApDataHandler has been created and the database had
+        * been opened.
+        * In case of error, access point will not be removed.
+        * @param aUid The UID of the ISP part of the access point to remove.
+        * @param aOut TBool indicating whether Dial out or dial in ISP.
+        * @return No return value.
+        */
+        void RemoveIspL( TUint32 aUid, TBool aOut );
+
+
+        /**
+        * Removes the GPRS part of the access point from the database.
+        * Expects that CApDataHandler has been created and the database had
+        * been opened.
+        * In case of error, access point will not be removed.
+        * @param aUid The UID of the GPRS part of the access point to remove.
+        * @return No return value.
+        */
+        void RemoveGprsL( TUint32 aUid, TBool aOut );
+
+
+        /**
+        * Removes the LAN part of the access point from the database.
+        * Expects that CApDataHandler has been created and the database had
+        * been opened.
+        * In case of error, access point will not be removed.
+        * @param aUid The UID of the LAN part of the access point to remove.
+        * @return No return value.
+        */
+        void RemoveLanL( TUint32 aUid );
+
+
+        /**
+        * Removes the WLAN part of the access point from the database.
+        * Expects that CApDataHandler has been created and the database had
+        * been opened.
+        * In case of error, access point will not be removed.
+        * @param aUid The UID of the LAN part of the access point to remove.
+        * @return No return value.
+        */
+        void RemoveWlanL( TUint32 aUid );
+        
+        
+        /**
+        * Handles the bearer change related things (deleting old links,
+        * inserting new ones if needed in the database).
+        * Expects that CApDataHandler has been created and the database had
+        * been opened.
+        * In case of error, access point data will not be changed.
+        * @param aApItem A reference to a CApAccessPointItem holding the
+        * CHANGED data.
+        * @return Boolean indicating whether bearer has changed or not.
+        */
+        TBool HandleBearerChangeIfNeededL( CApAccessPointItem& aApItem );
+
+
+
+        /**
+        * Reads up one access point's data from the database.
+        * Expects that CApDataHandler has been created and the database had
+        * been opened.
+        * In case of error, function leaves with error code.
+        * <br>Error conditions:
+        *   - Insufficient memory,
+        *   - AP does not exists,
+        *   - Server connection failure.
+        *
+        * @param aUid The Uid of the access point to be read
+        * @param aApItem A reference to a CApAccessPointItem to hold the data.
+        * @return no return value.
+        */
+        void DoAccessPointDataL( TUint32 aUid, CApAccessPointItem& aApItem );
+
+
+        /**
+        * Removes the given access point from the database.
+        * Expects that CApDataHandler has been created and the database had
+        * been opened.
+        * In case of error, access point will not be removed.
+        * <br>Error conditions:
+        *   - Insufficient memory,
+        *   - Server connection failure.
+        *   - Lock already present by other task.
+        *   - Access point does not exist.
+        *   - Attempting to remove read-only records will result
+        * in KErrAccessDenied
+        *
+        * @param aUid The UID of the access point to remove.
+        * @return no return value.
+        */
+        void DoRemoveAPL( TUint32 aUid );
+
+
+        /**
+        * Sets the default access point.
+        * Expects that CApDataHandler has been created and the database had
+        * been opened.
+        * In case of error, leaves with CommsDb or system error codes.
+        * <br>Error conditions:
+        *   - Insufficient memory;
+        *   - Server connection failure;
+        *   - Lock already present;
+        *   - Access point does not exists.
+        *   - Given Access Point is not of the desired type.
+        *
+        * @param aUid The UID of the access point to be set as default.
+        * @param aIntendedType The default type ( IAP, WAP, Both).
+        */
+        void DoSetAsDefaultL(TUint32 aUid, TCommsDbIspType aIntendedType );
+
+
+        /**
+        * Sets the access point preference. Can be used only if the
+        * database type is IAP.
+        * Expects that CApDataHandler has been created and the database had
+        * been opened.
+        * In case of error, leaves with CommsDb or system error codes.
+        * <br>Error conditions:
+        *   - Insufficient memory;
+        *   - Server connection failure;
+        *   - Lock already present;
+        * Can also leave with KErrAlreadyExists (if aOverWrite is EFalse ).
+        * @param aRank The ranking of the connection preference.
+        * @param aDircetion Specifies the direction of this connection
+        * preference
+        * @param aBearers The bearer set beeing valid for this connection
+        * preference
+        * @param aPrompt Enum value indicating whether or not the user
+        * should be prompted or warned on connection
+        * @param aIAP The identifier of the preferred IAP for this connection.
+        * @param aOverwrite Boolean value indicating that if a same record
+        * present, overwrite it or not.
+        */
+        void DoSetPreferredIfDbIapTypeL
+                                    (
+                                    TUint32 aRank,
+                                    TCommDbConnectionDirection aDirection,
+                                    TUint32 aBearers,
+                                    TCommDbDialogPref aPrompt,
+                                    TUint32 aIAP,
+                                    TBool aOverwrite
+                                    );
+
+
+        /**
+        * Sets the access point preference. Can be used only if the
+        * database type is ISP.
+        * Expects that CApDataHandler has been created and the database had
+        * been opened.
+        * In case of error, leaves with CommsDb or system error codes.
+        * <br>Error conditions:
+        *   - Insufficient memory;
+        *   - Server connection failure;
+        *   - Lock already present;
+        * Can also leave with KErrAlreadyExists (if aOverWrite is EFalse ).
+        * @param aRank The ranking of the connection preference.
+        * @param aDircetion Specifies the direction of this connection
+        * preference
+        * @param aBearers The bearer set beeing valid for this connection
+        * preference
+        * @param aPrompt Enum value indicating whether or not the user
+        * should be prompted or warned on connection
+        * @param aISP The identifier of the preferred ISP for this connection.
+        * @param aChargeCard Identifier of the preferred chargecard for
+        * this connection.
+        * @param aServiceType The type of the service.
+        * @param aOverwrite Boolean value indicating that if a same record
+        * present, overwrite it or not.
+        */
+        void DoSetPreferredIfDbIspTypeL
+                                    (
+                                    TUint32 aRank,
+                                    TCommDbConnectionDirection aDirection,
+                                    TUint32 aBearers,
+                                    TCommDbDialogPref aPrompt,
+                                    TUint32 aISP,
+                                    TUint32 aChargeCard,
+                                    const TDesC& aServiceType,
+                                    TBool aOverwrite
+                                    );
+
+
+        /**
+        * Converts setted AP speed from TApCallSpeed to commsdb values
+        * @param The access point item whose speed needs to be converted
+        * @return no return value
+        */
+        /*****************************************************
+        *   Series 60 Customer / ETel
+        *   Series 60  ETel API
+        *****************************************************/
+        void ApSpeed2EtelL( CApAccessPointItem* aItem );
+
+
+        /**
+        * Converts commsdb speed values to TApCallSpeed 
+        * @param The access point item whose speed needs to be converted
+        * @return no return value
+        */
+        /*****************************************************
+        *   Series 60 Customer / ETel
+        *   Series 60  ETel API
+        *****************************************************/
+        void EtelSpeed2ApL(  CApAccessPointItem& aItem );
+
+
+        // Getting default access point
+        /**
+        * Reads the UID of the default access point.
+        * Expects that CApDataHandler has been created and the database had
+        * been opened.
+        * In case of error, leaves with CommsDb or system error codes.
+        * <br>Error conditions:
+        *   - Insufficient memory;
+        *   - Server connection failure;
+        *   - Lock already present;
+        *   - Access point does not exists.
+        *
+        * @param aIsWAP A boolean indicating whether to read the default
+        * WAP or the default IAP/ISP (dep. on the database type) access point.
+        * @param TBool*: if not NULL, a holder for the read-only flag of
+        * the default access point. Prepared for future products but also used
+        * here through passing NULL ptr.
+        * @return The UID of the default access point.
+        */
+        TUint32 DoGetDefaultL( TBool aIsWap, TBool* aReadOnly ) const;
+
+
+        /**
+        * Writes the proxy data of an access point
+        * @param aIsNew Boolean stating whether the access point is new
+        * @param aApItem A CApAccessPointItem passed by reference 
+        * holding the current access point data. It's record ID's will be 
+        * updated if needed (in case it is a new item )
+        */
+        void WriteProxyDataL( TBool aIsNew, 
+                              const CApAccessPointItem& aApItem );
+
+
+        /**
+        * Reads up the proxy data of an access point
+        * @param aApItem A CApAccessPointItem passed by reference 
+        * holding the current access point data. 
+        */
+        void ReadProxyDataL( CApAccessPointItem& aApItem );
+
+
+        /**
+        * Removes a proxy data
+        * @param aServiceType   The service type to remove for
+        * @param aIspId         The service record ID
+        */
+        void RemoveProxyDataL( HBufC* aServiceType, TUint32 aIspId );
+
+
+        /**
+        * Writes the network data of an access point
+        * @param aIsNew Boolean stating whether the access point is new
+        * @param aApItem A CApAccessPointItem passed by reference 
+        * holding the current access point data. It's record ID's will be 
+        * updated if needed (in case it is a new item )
+        */
+        void WriteNetworkDataL( TBool aIsNew, CApAccessPointItem& aApItem );
+
+
+        /**
+        * Reads up the network data of an access point
+        * @param aApItem A CApAccessPointItem passed by reference 
+        * holding the current access point data. 
+        */
+        void ReadNetworkDataL( CApAccessPointItem& aApItem );
+
+
+        /**
+        * Removes the network data
+        * @param aIspId The record ID to remove
+        */
+        void RemoveNetworkDataL( TUint32 aIspId );
+
+
+        /**
+        * Gets the location record ID
+        * @return The UID of the location.
+        */
+        TUint32 GetLocationIdL();
+
+
+        /**
+        * Gets the modem record ID
+        * @return The UID of the modem record.
+        */
+        TUint32 GetModemBearerIDL( CApAccessPointItem& aApItem );
+
+
+        /**
+        * Returns the protocol for the passed item
+        * @param aApItem An access point item 
+        * @return The protocol of the passed item.
+        */
+        TUint32 ProtocolL( CApAccessPointItem& aApItem );
+
+        /**
+        * Returns the commsdb speed for the passed item
+        * @param aApItem An access point item 
+        * @return The speed of the passed item.
+        */
+        TUint32 CommsDbSpeedL( CApAccessPointItem& aApItem );
+
+
+        /**
+        * Reads up common IP & PPP SERVICE data parts of an access point.
+        * Leaves if it is not persent in the database
+        * @param The table to read from
+        * @param The CApAccessPointItem to store into
+        */
+        void ReadServiceL( CCommsDbTableView& ispt, 
+                           CApAccessPointItem& aApItem );
+
+
+        /**
+        * Reads up CSD/GPRS IPv6 parts of an access point.
+        * Leaves if it is not persent in the database
+        * @param The table to read from
+        * @param The CApAccessPointItem to store into
+        */
+        void ReadServiceIp6L( CCommsDbTableView& ispt,
+                              CApAccessPointItem& aApItem );
+
+
+        /**
+        * Writes common IP & PPP SERVICE data parts of an access point.
+        * Leaves if it is not persent in the database
+        * @param The table to write into 
+        * @param The CApAccessPointItem holding the data to store 
+        */
+        void WriteServiceL( CCommsDbTableView& aTable,
+                            CApAccessPointItem& aApItem );
+
+
+        /**
+        * Writes the IPv6 parts of an access point.
+        * Leaves if it is not persent in the database
+        * @param The table to write to 
+        * @param The CApAccessPointItem to read the data from
+        */
+        void WriteServiceIp6L( CCommsDbTableView& ispt,
+                               CApAccessPointItem& aApItem );
+
+
+        /**
+        * Writes the CSD isp data to the database.
+        * In case of error, leaves with CommDb error codes.
+        * Leaves with KErrNotSupported if (HS)CSD bearer type is not supported.
+        * @param aIsNew A Boolean indicating whether it is a new record or it
+        * is an update operation.
+        * @param aApItem Reference to a CApAccessPointItem which holds the data
+        * @return No return value.
+        */
+        void WriteCsdDataL( TBool aIsNew, CApAccessPointItem& aApItem );
+
+
+        /**
+        * Gets the local variant value 
+        * @return A TInt stating the variant
+        */
+//        TInt GetVariantL();
+
+
+        /**
+        * Reads up WLAN data parts of an access point.
+        * Leaves if it is not persent in the database
+        * @param The table to read from
+        * @param The CApAccessPointItem to store into
+        */
+        void ReadWlanL( CCommsDbTableView& lant,
+                        CApAccessPointItem& aApItem );
+
+
+        /**
+        * Writes the WLAN parts of an access point.
+        * Leaves if it is not persent in the database
+        * @param The table to write to 
+        * @param The CApAccessPointItem to read the data from
+        */
+        void WriteWlanL( CCommsDbTableView& aTable,
+                         CApAccessPointItem& aApItem );
+
+        /**
+        * Creates a new record in the LANBearer table if there is none for WLAN
+        * @return The UID of the LANBEarer record.
+        */
+        TUint32 CreateLanBearerIfNeededL();
+
+
+
+        /**
+        * Reads up the name of the LAN/Modem bearer record
+        */
+        void ReadModemBearerNameL( CApAccessPointItem& aApItem );
+        
+
+    private:    // Data
+        CCommsDatabase* iDb;
+//        TCommDbDatabaseType iDbType;  // deprecated and not used but kept 
+                                        // to maintain class size for BC
+        // no change in size as deprecated removed, 
+        // new added, with the same size...
+        THandlerExtra*  iExt;
+
+
+    };
+
+#endif      // APDATAHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/access_point_engine_api/inc/APNetworks.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,139 @@
+/*
+* Copyright (c) 2002 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 the CApNetworks class.
+*
+*/
+
+
+#ifndef CAPNETWORKS_H
+#define CAPNETWORKS_H
+
+// Deprecation warning
+#warning This header file has been deprecated. Will be removed in one of the next SDK releases.
+ 
+ 
+//  INCLUDES
+#include <commdb.h>
+#include <ApEngineVer.h>
+#include <ApEngineConsts.h>
+
+// FORWARD DECLARATIONS
+class CApNetworkItem;
+class CApNetworkItemList;
+
+// CLASS DECLARATION
+
+/**
+*  This class is used to help client's network selection.
+*
+*/
+NONSHARABLE_CLASS( CApNetworks ) :public CBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor. Leaves on failure, places instance
+        * on cleanup stack.
+        * @param aDb a reference to a CCommsDataBase.
+        * @return The constructed CApNetworks.
+        *
+        * @deprecated
+        */
+        IMPORT_C static CApNetworks* NewLC( CCommsDatabase& aDb );
+
+
+        /**
+        * Destructor.
+        *
+        * @deprecated
+        */
+        IMPORT_C virtual ~CApNetworks();
+
+
+    private:      // Constructors
+
+        /**
+        * C++ default constructor.
+        *
+        * @deprecated
+        */
+        IMPORT_C CApNetworks();
+
+        /**
+        * Second-phase constructor.
+        * @param aDb The database
+        *
+        * @deprecated
+        */
+        IMPORT_C void ConstructL( CCommsDatabase& aDb );
+
+
+
+    public: // New functions
+
+        /**
+        * Counts the items in the list
+        * @return The number of items in the list.
+        *
+        * @deprecated
+        */
+        IMPORT_C TUint32 Count() const;
+
+
+        /**
+        * Gets the name of the network group with the given UID
+        * Ownership of the returned text is not passed.
+        * @param aUid The uid of the network item 
+        * @return The name of the network group
+        *
+        * @deprecated
+        */
+        IMPORT_C const TDesC& NameL( TUint32 aUid ) const;
+
+
+
+        /**
+        * Provides all data in a CApNetworkItemList array.
+        * @param aList A reference to a CApNetworkItemList object
+        * to hold the values.
+        * @return The number of items in the list.
+        * All elements in the aList array and their memory
+        * will be freed inside the routine.
+        * The routine expands or shrinks the array as necessary
+        * to minimize memory consumption.
+        *
+        * @deprecated
+        */
+        IMPORT_C TInt AllListItemDataL( CApNetworkItemList& aList );
+
+
+    private:
+        /**
+        * This function updates the member data according to the
+        * current filter settings.
+        * @return Error code.
+        */
+        TInt DoUpdateL();
+
+
+
+    private:    // Data
+        CCommsDatabase*             iDb;    // Does not own it!
+        CApNetworkItemList*         iApList;
+        TInt                        iCount;
+    };
+
+#endif      // CAPNETWORKS_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/access_point_engine_api/inc/APSelect.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,737 @@
+/*
+* Copyright (c) 2002 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 the CApSelect class.
+*
+*/
+
+
+#ifndef CAPSELECT_H
+#define CAPSELECT_H
+
+// Deprecation warning
+#warning This header file has been deprecated. Will be removed in one of the next SDK releases.
+ 
+ 
+//  INCLUDES
+#include <commdb.h>
+#include <ApEngineVer.h>
+#include <ApEngineConsts.h>
+
+
+// FORWARD DECLARATIONS
+class CApListItem;
+class CApListItemList;
+class CApUtils;
+
+
+
+enum TVpnFilterType
+    {
+    EVpnFilterVpnOnly,          ///< Shows only VPN access points
+    EVpnFilterNoVpn,            ///< Shows only non-VPN access points
+    EVpnFilterBoth              ///< Shows both normal and VPN access points
+    };
+
+
+// CLASS DECLARATION
+// Extra data holder
+typedef struct
+    {
+        TInt                iMaxIndex;
+        TInt                iReqIpvType;
+        TInt                iIsIpv6Supported;
+        TInt                iExtra;
+        TBool               iIsFeatureManagerInitialised;
+        TBool               iCdma;
+        TInt                iVpnFilterType; // TVpnFilterType values !!
+        TBool               iWlanSupported;
+        TBool               iIncludeEasyWlan;
+    }TSelectExtra;
+
+
+
+typedef struct
+    {
+    TUint32     iVpnIapId;
+    TUint32     iHomeIapId;
+    HBufC *     iName;
+    }TVpnData;
+
+
+/**
+*  This class is used to help client's access point selection.
+*  Selection can be tailored with specific filters, rules and sort order.
+*  Provides methods for setting and getting filters and sort order.
+*
+*/
+class CApSelect :public CBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor. Leaves on failure, places instance
+        * on cleanup stack.
+        * @param aDb a pointer to a CCommsDataBase.
+        * @param aIspTypeFilter Filtering criteria on ISP type
+        * Possible values are:
+        * KEApIspTypeInternetOnly, KEApIspTypeWAPOnly,
+        * KEApIspTypeInternetAndWAP, KEApIspTypeWAPMandatory
+        * KEApIspTypeAll and their combinations.
+        * @param aBearerFilter Filtering criteria on bearer type
+        * Possible values are the TApBearer enums and
+        * their combinations (or-ed).
+        * @param aSortType Specifies the sort order to use.
+        * Possible values are:
+        * KEApSortUidAscending, KEApSortUidDescending,
+        * KEApSortNameAscending, KEApSortNameDescending
+        * @return The constructed CApSelect.
+        *
+        * @deprecated
+        */
+        IMPORT_C static CApSelect* NewLC(
+                                        CCommsDatabase& aDb,
+                                        TInt aIspFilter,
+                                        TInt aBearerFilter,
+                                        TInt aSortType
+                                        );
+
+
+        /**
+        * Two-phased constructor. Leaves on failure, places instance
+        * on cleanup stack.
+        * @param aDb a pointer to a CCommsDataBase.
+        * @param aIspTypeFilter Filtering criteria on ISP type
+        * Possible values are:
+        * KEApIspTypeInternetOnly, KEApIspTypeWAPOnly,
+        * KEApIspTypeInternetAndWAP, KEApIspTypeWAPMandatory
+        * KEApIspTypeAll and their combinations.
+        * @param aBearerFilter Filtering criteria on bearer type
+        * Possible values are the TApBearer enums and
+        * their combinations (or-ed).
+        * @param aSortType Specifies the sort order to use.
+        * Possible values are:
+        * KEApSortUidAscending, KEApSortUidDescending,
+        * KEApSortNameAscending, KEApSortNameDescending
+        * @param aReqIpvType Filtering criteria on the IPv type of the 
+        * access point. In case of GPRS, GPRS_PDP_TYPE holds it, while
+        * in case of CSD, all CSD access points are 
+        * considered to be IPv4 & IPv6 (both)
+        * @return The constructed CApSelect.
+        *
+        * @deprecated
+        */
+        IMPORT_C static CApSelect* NewLC(
+                                        CCommsDatabase& aDb,
+                                        TInt aIspFilter,
+                                        TInt aBearerFilter,
+                                        TInt aSortType,
+                                        TInt aReqIpvType
+                                        );
+
+
+
+        /**
+        * Two-phased constructor. Leaves on failure, places instance
+        * on cleanup stack.
+        * @param aDb a pointer to a CCommsDataBase.
+        * @param aIspTypeFilter Filtering criteria on ISP type
+        * Possible values are:
+        * KEApIspTypeInternetOnly, KEApIspTypeWAPOnly,
+        * KEApIspTypeInternetAndWAP, KEApIspTypeWAPMandatory
+        * KEApIspTypeAll and their combinations.
+        * @param aBearerFilter Filtering criteria on bearer type
+        * Possible values are the TApBearer enums and
+        * their combinations (or-ed).
+        * @param aSortType Specifies the sort order to use.
+        * Possible values are:
+        * KEApSortUidAscending, KEApSortUidDescending,
+        * KEApSortNameAscending, KEApSortNameDescending
+        * @param aReqIpvType Filtering criteria on the IPv type of the 
+        * access point. In case of GPRS, GPRS_PDP_TYPE holds it, while
+        * in case of CSD, all CSD access points are 
+        * considered to be IPv4 & IPv6 (both)
+        * @param aVpnFilterType a TVpnFilterType enum specifying the 
+        * vpn filtering.
+        * @return The constructed CApSelect.
+        *
+        * @deprecated
+        */
+        IMPORT_C static CApSelect* NewLC(
+                                        CCommsDatabase& aDb,
+                                        TInt aIspFilter,
+                                        TInt aBearerFilter,
+                                        TInt aSortType,
+                                        TInt aReqIpvType,
+                                        TVpnFilterType aVpnFilterType );
+
+
+        /**
+        * Two-phased constructor. Leaves on failure, places instance
+        * on cleanup stack.
+        * @param aDb a pointer to a CCommsDataBase.
+        * @param aIspTypeFilter Filtering criteria on ISP type
+        * Possible values are:
+        * KEApIspTypeInternetOnly, KEApIspTypeWAPOnly,
+        * KEApIspTypeInternetAndWAP, KEApIspTypeWAPMandatory
+        * KEApIspTypeAll and their combinations.
+        * @param aBearerFilter Filtering criteria on bearer type
+        * Possible values are the TApBearer enums and
+        * their combinations (or-ed).
+        * @param aSortType Specifies the sort order to use.
+        * Possible values are:
+        * KEApSortUidAscending, KEApSortUidDescending,
+        * KEApSortNameAscending, KEApSortNameDescending
+        * @param aReqIpvType Filtering criteria on the IPv type of the 
+        * access point. In case of GPRS, GPRS_PDP_TYPE holds it, while
+        * in case of CSD, all CSD access points are 
+        * considered to be IPv4 & IPv6 (both)
+        * @param aVpnFilterType a TVpnFilterType enum specifying the 
+        * vpn filtering.
+        * @param aIncludeEasyWlan TBool specifying whther to include
+        * EasyWlan access point in the list or not...
+        * @return The constructed CApSelect.
+        *
+        * @deprecated
+        */
+        IMPORT_C static CApSelect* NewLC(
+                                        CCommsDatabase& aDb,
+                                        TInt aIspFilter,
+                                        TInt aBearerFilter,
+                                        TInt aSortType,
+                                        TInt aReqIpvType,
+                                        TVpnFilterType aVpnFilterType,
+                                        TBool aIncludeEasyWlan );
+
+
+        /**
+        * Destructor.
+        *
+        * @deprecated
+        */
+        IMPORT_C virtual ~CApSelect();
+
+
+    protected:      // Constructors
+
+        /**
+        * C++ default constructor.
+        *
+        * @deprecated
+        */
+        IMPORT_C CApSelect();
+
+
+        /**
+        * Second-phase constructor.
+        * @param aDb a pointer to a CCommsDataBase.
+        * @param aIspTypeFilter Filtering criteria on ISP type
+        * Possible values are:
+        * KEApIspTypeInternetOnly, KEApIspTypeWAPOnly,
+        * KEApIspTypeInternetAndWAP, KEApIspTypeWAPMandatory
+        * KEApIspTypeAll and their combinations.
+        * @param aBearerFilter Filtering criteria on bearer type
+        * Possible values are the TApBearer enums and
+        * their combinations (or-ed).
+        * @param aSortType Specifies the sort order to use.
+        * Possible values are:
+        * KEApSortUidAscending, KEApSortUidDescending,
+        * KEApSortNameAscending, KEApSortNameDescending
+        *
+        * @deprecated
+        */
+        IMPORT_C void ConstructL(
+                                CCommsDatabase& aDb,
+                                TInt aIspFilter,
+                                TInt aBearerFilter,
+                                TInt aSortType
+                                );
+
+
+        /**
+        * Second-phase constructor.
+        * @param aDb a pointer to a CCommsDataBase.
+        * @param aIspTypeFilter Filtering criteria on ISP type
+        * Possible values are:
+        * KEApIspTypeInternetOnly, KEApIspTypeWAPOnly,
+        * KEApIspTypeInternetAndWAP, KEApIspTypeWAPMandatory
+        * KEApIspTypeAll and their combinations.
+        * @param aBearerFilter Filtering criteria on bearer type
+        * Possible values are the TApBearer enums and
+        * their combinations (or-ed).
+        * @param aSortType Specifies the sort order to use.
+        * Possible values are:
+        * KEApSortUidAscending, KEApSortUidDescending,
+        * KEApSortNameAscending, KEApSortNameDescending
+        * @param aReqIpvType Filtering criteria on the IPv type of the 
+        * access point. In case of GPRS, GPRS_PDP_TYPE holds it, while
+        * in case of CSD, all CSD access points are 
+        * considered to be IPv4 & IPv6 (both)
+        *
+        * @deprecated
+        */
+        IMPORT_C void ConstructL(
+                                CCommsDatabase& aDb,
+                                TInt aIspFilter,
+                                TInt aBearerFilter,
+                                TInt aSortType,
+                                TInt aReqIpvType
+                                );
+
+
+        /**
+        * Second-phase constructor.
+        * @param aDb a pointer to a CCommsDataBase.
+        * @param aIspTypeFilter Filtering criteria on ISP type
+        * Possible values are:
+        * KEApIspTypeInternetOnly, KEApIspTypeWAPOnly,
+        * KEApIspTypeInternetAndWAP, KEApIspTypeWAPMandatory
+        * KEApIspTypeAll and their combinations.
+        * @param aBearerFilter Filtering criteria on bearer type
+        * Possible values are the TApBearer enums and
+        * their combinations (or-ed).
+        * @param aSortType Specifies the sort order to use.
+        * Possible values are:
+        * KEApSortUidAscending, KEApSortUidDescending,
+        * KEApSortNameAscending, KEApSortNameDescending
+        * @param aReqIpvType Filtering criteria on the IPv type of the 
+        * access point. In case of GPRS, GPRS_PDP_TYPE holds it, while
+        * in case of CSD, all CSD access points are 
+        * considered to be IPv4 & IPv6 (both)
+        * @param aVpnFilterType a TVpnFilterType enum specifying the 
+        * vpn filtering.
+        *
+        * @deprecated
+        */
+        IMPORT_C void ConstructL( CCommsDatabase& aDb,
+                                 TInt aIspFilter,
+                                 TInt aBearerFilter,
+                                 TInt aSortType,
+                                 TInt aReqIpvType,
+                                 TVpnFilterType aVpnFilterType 
+                                 );
+                                 
+        /**
+        * Second-phase constructor.
+        * @param aDb a pointer to a CCommsDataBase.
+        * @param aIspTypeFilter Filtering criteria on ISP type
+        * Possible values are:
+        * KEApIspTypeInternetOnly, KEApIspTypeWAPOnly,
+        * KEApIspTypeInternetAndWAP, KEApIspTypeWAPMandatory
+        * KEApIspTypeAll and their combinations.
+        * @param aBearerFilter Filtering criteria on bearer type
+        * Possible values are the TApBearer enums and
+        * their combinations (or-ed).
+        * @param aSortType Specifies the sort order to use.
+        * Possible values are:
+        * KEApSortUidAscending, KEApSortUidDescending,
+        * KEApSortNameAscending, KEApSortNameDescending
+        * @param aReqIpvType Filtering criteria on the IPv type of the 
+        * access point. In case of GPRS, GPRS_PDP_TYPE holds it, while
+        * in case of CSD, all CSD access points are 
+        * considered to be IPv4 & IPv6 (both)
+        * @param aVpnFilterType a TVpnFilterType enum specifying the 
+        * vpn filtering.
+        * @param aIncludeEasyWlan TBool specifying whther to include
+        * EasyWlan access point in the list or not...
+        *
+        * @deprecated
+        */                                 
+        IMPORT_C void ConstructL( CCommsDatabase& aDb,
+                                 TInt aIspFilter,
+                                 TInt aBearerFilter,
+                                 TInt aSortType,
+                                 TInt aReqIpvType,
+                                 TVpnFilterType aVpnFilterType,
+                                 TBool aIncludeEasyWlan );
+                                 
+    public: // New functions
+        /**
+        * Sets filters and sorting order for the list of available
+        * access points
+        * @param aIspTypeFilter Filtering criteria on ISP type
+        * Possible values are:
+        * KEApIspTypeInternetOnly, KEApIspTypeWAPOnly,
+        * KEApIspTypeInternetAndWAP,
+        * KEApIspTypeWAPMandatory, KEApIspTypeAll and their combinations.
+        * @param aBearerFilter Filtering criteria on bearer type
+        * Possible values are the TApBearer enums and
+        * their combinations (or-ed).
+        * @param aSortType Specifies the sort order to use.
+        * Possible values are:
+        * KEApSortUidAscending, KEApSortUidDescending,
+        * KEApSortNameAscending, KEApSortNameDescending
+        *
+        * @deprecated
+        */
+        IMPORT_C void SetFiltersL(
+                                 TInt aIspFilter,
+                                 TInt aBearerFilter,
+                                 TInt aSortType
+                                 );
+
+
+
+        /**
+        * Gets the current ISP-type filter
+        * @return The current ISP-type filter
+        *
+        * @deprecated
+        */
+        IMPORT_C TInt IspTypeFilter();
+
+
+        /**
+        * Gets the current bearer-type filter
+        * @return The current bearer-type filter
+        *
+        * @deprecated
+        */
+        IMPORT_C TInt BearerFilter();
+
+
+        /**
+        * Gets the current sorting order
+        * @return The current sorting order
+        *
+        * @deprecated
+        */
+        IMPORT_C TInt SortOrder();
+
+
+        /**
+        * Navigates to the first access point in the list.
+        * @return Boolean indicating the success of the operation.
+        *
+        * @deprecated
+        */
+        IMPORT_C TBool  MoveToFirst();
+
+
+        /**
+        * Navigates to the next access point in the list.
+        * @return Boolean indicating the success of the operation.
+        *
+        * @deprecated
+        */
+        IMPORT_C TBool  MoveNext();
+
+
+        /**
+        * Navigates to the last access point in the list.
+        * @return Boolean indicating the success of the operation.
+        *
+        * @deprecated
+        */
+        IMPORT_C TBool  MoveLast();
+
+
+        /**
+        * Navigates to the previous access point in the list.
+        * @return Boolean indicating the success of the operation.
+        *
+        * @deprecated
+        */
+        IMPORT_C TBool  MovePrev();
+
+
+        /**
+        * Counts the items in the list
+        * @return The number of items in the list.
+        *
+        * @deprecated
+        */
+        IMPORT_C TUint32 Count();
+
+
+        /**
+        * Gets the name of the 'current' access point
+        * Ownership of the returned text is not passed.
+        * @return The name of the current access point
+        *
+        * @deprecated
+        */
+        IMPORT_C const TDesC& Name();
+
+
+        /**
+        * Gets the UID of the current access point
+        * @return The UID of the current access point
+        *
+        * @deprecated
+        */
+        IMPORT_C TUint32 Uid();
+
+
+        /**
+        * Gets the ISP-type of the current access point
+        * @return The ISP-type of the current access point.
+        *
+        * @deprecated
+        */
+        IMPORT_C TCommsDbIspType Type();
+
+
+        /**
+        * Gets the bearer-type of the current access point
+        * @return The bearer-type of the current access point.
+        *
+        * @deprecated
+        */
+        IMPORT_C TApBearerType BearerType();
+
+
+        /**
+        * Provides all data in a CApListItemList array.
+        * @param aList A reference to a CApListItemList object
+        * to hold the values.
+        * @return The number of items in the list.
+        * All elements in the aList array and their memory
+        * will be freed inside the routine.
+        * The routine expands or shrinks the array as necessary
+        * to minimize memory consumption.
+        *
+        * @deprecated
+        */
+        IMPORT_C TInt AllListItemDataL( CApListItemList& aList );
+
+        /**
+        * Returns whether the current item is read-only or not.
+        * @return Returns whether the current item is read-only or not.
+        *
+        * @deprecated
+        */
+        IMPORT_C TBool IsReadOnly() const;
+
+    private:
+        /**
+        * This function updates the member data according to the
+        * current filter settings.
+        * @return Error code.
+        */
+        TInt DoUpdateL();
+
+
+        /**
+        * Gets the filtered and sorted wap table
+        * and places it on the Cleanupstack
+        */
+        CCommsDbTableView* GetFilteredSortedWapTableViewLC();
+
+
+        /**
+        * Gets the filtered and sorted IP bearer table
+        * and places it on the Cleanupstack
+        */
+        CCommsDbTableView* GetFilteredSortedIpBearerTableViewLC();
+
+
+        /**
+        * Gets the filtered and sorted ISP table
+        * and places it on the Cleanupstack
+        */
+        CCommsDbTableView* GetFilteredSortedIspOutTableViewLC();
+
+
+        /**
+        * Gets the filtered and sorted GPRS table
+        * and places it on the Cleanupstack
+        */
+        CCommsDbTableView* GetFilteredSortedGprsTableViewLC( TBool aIn );
+
+        /**
+        * Reads up the specified columns TUint32 values stored
+        * in the table and returns it in the passed array
+        */
+        void GetUintValuesL
+                (
+                CCommsDbTableView* aTable,
+                const TDesC& aField,
+                CArrayFixFlat<TUint32>& aArray
+                );
+
+
+        /**
+        * Reads up the protection values stored
+        * in the table and returns it in the passed array
+        */
+        void GetProtValuesL( CCommsDbTableView* aTable,
+                             CArrayFixFlat<TUint32>& aArray );
+
+        /**
+        * Reads up the specified columns text values stored
+        * in the table and returns it in the passed array
+        */
+        void GetTextValuesL
+                (
+                CCommsDbTableView* aTable,
+                const TDesC& aField,
+                CArrayPtrFlat<HBufC>& aArray
+                );
+
+
+        /**
+        * Reads up the specified columns long text values stored
+        * in the table and returns it in the passed array
+        */
+        void GetLongTextValuesL
+                (
+                CCommsDbTableView* aTable,
+                const TDesC& aField,
+                CArrayPtrFlat<HBufC>& aArray
+                );
+
+
+        /**
+        * Returns whether a given value is in the given array or not
+        */
+        TBool IsInArray( CArrayFixFlat<TUint32>* aArray, TUint32 aValue );
+
+
+        /**
+        * Returns the position of a given value in the given array.
+        */
+        TInt PosInArray( CArrayFixFlat<TUint32>* aArray, TUint32 aValue );
+
+
+        /**
+        * Returns the position of an item with a given UID in the given list.
+        */
+        TInt GetItemPos( CApListItemList* aTmpApList, TUint32 aId );
+
+
+        /**
+        * Opens a view on the given table where a given text coloumn has
+        * a given value
+        * @return the opened view on the table
+        */
+        CCommsDbTableView* OpenViewMatchingTextL
+                                (
+                                const TDesC& aTableName,
+                                const TDesC& aColumnToMatch,
+                                const TDesC16& aValueToMatch
+                                );
+
+        /**
+        * Gets the ISP values (ISP UID, ISP type, ISP bearer type)
+        * from a given table
+        * @param aTable the table to go through (already filtered & ordered)
+        * @param aArray An array to hold the readed values
+        * @param aColName Column name (different column names are used for
+        * CSD/GPRS/CDMA.
+        */
+        void GetIspValuesL
+                (
+                CCommsDbTableView* aTable,
+                CArrayFixFlat<TUint32[3]>* aArray,
+                const TDesC& aColName
+                );
+
+        /**
+        * Gets the position of an element with a given IAP UID
+        */
+        TInt GetIapPos
+                (
+                CArrayFixFlat<TUint32[3]>* aArray,
+                TUint32 aValue
+                );
+
+        /**
+        * Sorts the data according to localised sorting on the 
+        * access point names, using CompareC
+        */
+        void SortLocalisedNameL( TBool aAscending = ETrue );
+
+
+        /**
+        * Sorts the data according to Uids
+        */
+        void SortUidL( TBool aAscending = ETrue );
+
+
+
+    private:    // New functions
+        /**
+        * Sets filters and sorting order for the list of available
+        * access points
+        * @param aIspTypeFilter Filtering criteria on ISP type
+        * Possible values are:
+        * KEApIspTypeInternetOnly, KEApIspTypeWAPOnly,
+        * KEApIspTypeInternetAndWAP,
+        * KEApIspTypeWAPMandatory, KEApIspTypeAll and their combinations.
+        * @param aBearerFilter Filtering criteria on bearer type
+        * Possible values are the TApBearer enums and
+        * their combinations (or-ed).
+        * @param aSortType Specifies the sort order to use.
+        * Possible values are:
+        * KEApSortUidAscending, KEApSortUidDescending,
+        * KEApSortNameAscending, KEApSortNameDescending
+        * @param aReqIpvType The filtering criteria for IPv type
+        * @param aVpnFilterType The Vpn filtering type, TVpnFilterType values
+        */
+        void SetFiltersL( TInt aIspFilter,
+                          TInt aBearerFilter,
+                          TInt aSortType,
+                          TInt aReqIpvType,
+                          TInt aVpnFilterType
+                         );
+
+
+        /**
+        * Returns a pointer to the opened VPN_SERVICE table
+        */
+        CCommsDbTableView* GetVpnTableViewLC();
+
+
+        /**
+        * Gets the VPN values (VPN IAP UID, VPN HOME IAP UID, VPN Name )
+        * from the given VPN table
+        * @param aTable the table to go through (already filtered & ordered)
+        * @param aVpnArray An array to hold the readed vpn data values
+        */
+        void GetVpnValuesL( CCommsDbTableView* aTable, 
+                            CArrayFixFlat<TVpnData>* aVpnArray );
+
+
+        /**
+        * Returns the supported bearer set from the passed requested bearer set
+        * @param aBearerFilter The requested bearer set
+        * return The supported subset of the requested bearers.
+        */
+        TInt GetSupportedBearerSet( TInt aBearerFilter );
+
+
+        /**
+        * Adding WLAN or LAN access points to existing list.
+        * aWlan a TBool specifying whether WLAN or LAN
+        */
+        void AddLanL( TBool aWlan );
+
+
+
+
+    private:    // Data
+        CCommsDatabase*             iDb;    // Does not own it!
+        TInt                        iIsp;
+        TInt                        iBearer;
+        TInt                        iSort;
+        CApListItemList*            iApList;
+        TInt                        iCursor;
+        TInt                        iCount;
+        TSelectExtra*               iExt;
+
+    };
+
+#endif      // CAPSELECT_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/access_point_engine_api/inc/APUtils.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,422 @@
+/*
+* Copyright (c) 2002 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 the class CApUtils
+*     Contains utility functions for access point handling
+*
+*/
+
+
+#ifndef APUTILS_H
+#define APUTILS_H
+
+// Deprecation warning
+#warning This header file has been deprecated. Will be removed in one of the next SDK releases.
+ 
+ 
+//  INCLUDES
+#include <commdb.h>
+#include <ApEngineVer.h>
+#include <ApEngineConsts.h>
+
+
+
+// extra data holder.
+typedef struct
+    {
+    TInt    iVariant;               /// Local variant value
+    TBool   iWlanSupported;         /// WLAN feature supported or not
+    TBool   iIsFeatureManagerInitialised;
+    }TUtilsExtra;
+
+
+// CLASS DECLARATION
+
+/**
+*  Representation of access point utilities.
+*  Provides utilities to access points for clients.
+*  Encapsulates database handling.
+*  This class provides utility functions for clients that need some
+*  specific information or parameters from (maybe more than one) AP.
+*  It is provided for ease of use so clients do not have to work with
+*  CApDataHandler's concept (one object-one Uid).
+*/
+class CApUtils :public CBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor. Leaves on failure, places instance
+        * on cleanup stack.
+        * @param aDb a reference to a CCommsDataBase object.
+        * @return The constructed CApUtils.
+        *
+        * @deprecated
+        */
+        IMPORT_C static CApUtils* NewLC( CCommsDatabase& aDb );
+
+
+        /**
+        * Destructor.
+        *
+        * @deprecated
+        */
+        IMPORT_C virtual ~CApUtils();
+
+
+protected: // Constructors
+        /**
+        * C++ default constructor.
+        *
+        * @deprecated
+        */
+        IMPORT_C CApUtils();
+
+        /**
+        * Second-phase constructor.
+        *
+        * @deprecated
+        */
+        IMPORT_C void ConstructL( CCommsDatabase& aDb );
+
+
+
+
+    public: // New functions
+
+        /**
+        * Indicates whether a given access point is in use or not.
+        * If access point does not exists, return value is TRUE
+        * @param aUid The UID of the access point.
+        * @return Boolean indicating if it is in use (if used, TRUE)
+        *
+        * @deprecated
+        */
+        IMPORT_C TBool IsAPInUseL( TUint32 aUid );
+
+
+        /**
+        * Indicates the WAP bearer type of a given access point.
+        * Passed descriptor MUST be large enough to hold the new data,
+        * otherwise leaves with KErrDescOverflow.
+        * The maximum length is the maximum length of a 'normal' text fields
+        * length in Comms DB, KCommsDbSvrMaxFieldLength,
+        * which is defined in cdblen.h.
+        * @param aUid The UID of the access point.
+        * @param aBearer A reference to a TBearer to hold the bearer
+        * type of the access point.
+        * @return no return value.
+        *
+        * @deprecated
+        */
+        IMPORT_C void WapBearerTypeL( TUint32 aUid, TDes& aBearer );
+
+
+        /**
+        * Gets the bearer type of a given access point. Leaves on error.
+        * @param aUid The UID of the access point.
+        * @return The type of the bearer.
+        *
+        * @deprecated
+        */
+        IMPORT_C TApBearerType BearerTypeL( TUint32 aUid );
+
+
+
+        /**
+        * Indicates the ISP type of a given access point.
+        * @param aUid The UID of the access point.
+        * @param aIspType A reference to a TCommsDbIspType to hold the value
+        * @return No return value.
+        *
+        * @deprecated
+        */
+        IMPORT_C void ISPTypeL( TUint32 aUid, TCommsDbIspType& aIspType );
+
+        /**
+        * Indicates whether a given name is valid or not.
+        * @param aNameText The name to check.
+        * @return Boolean indicating if it is valid or not.
+        *
+        * @deprecated
+        */
+        IMPORT_C TBool IsValidNameL( const TDesC& aNameText );
+
+
+        /**
+        * TBool CApUtils::MakeValidNameL(TDes& aNameText);
+        * Creates a valid name based on the given one.
+        * @param aNameText The name to use for creating a valid name.
+        * The new name is returned in it, too.
+        * @return Whether the name was changed or not
+        *
+        * @deprecated
+        */
+        IMPORT_C TBool MakeValidNameL( TDes& aNameText );
+
+
+        /**
+        * Reads the Name of a given access point
+        * @param aUid The UID of the access point.
+        * @param A reference to hold the name of the access point.
+        * @return no return value.
+        * Passed descriptor MUST be large enough to hold the new data,
+        * otherwise leaves with KErrDescOverflow.
+        *
+        * @deprecated
+        */
+        IMPORT_C void NameL( TUint32 aUid, TDes& aName );
+
+
+        /**
+        * Sets the Name of a given access point
+        * Name is validated and modified if needed.
+        * Passed aName buffer MUST be large enough to hold the modified name.
+        * @param aName A reference to the name of the access point.
+        * The given name is returned in it.
+        * @param aUid The UID of the access point.
+        * @return no return value.
+        *
+        * @deprecated
+        */
+        IMPORT_C void SetNameL( TDes& aName, TUint32 aUid );
+
+
+        /**
+        * Sets the ISP type for a given access point
+        * @param aUid The UID of the access point
+        * @param aIspType The desired Isp type of the access point
+        * @return no return value.
+        *
+        * @deprecated
+        */
+        IMPORT_C void SetISPTypeL( TUint32 aUid, TCommsDbIspType aIspType );
+
+
+        /**
+        * Gets the Iap record ID for a given access point ID
+        * @param aUid The UID of the access point
+        * @return The Iap record ID.
+        *
+        * @deprecated
+        */
+        IMPORT_C TUint32 IapIdFromWapIdL( TUint32 aUid );
+
+
+        /**
+        * Gets the Wap record ID for a given Iap record ID
+        * @param aUid The UID of the Iap
+        * @return The Wap access point ID.
+        *
+        * @deprecated
+        */
+        IMPORT_C TUint32 WapIdFromIapIdL( TUint32 aUid );
+
+
+
+        /**
+        * Returns whether the access point has the WAP-mandatory
+        * fields filled or not.
+        * Starts a transaction which is 'internal' to ApEngine if
+        * client not started one.
+        * @param  aUid The UID of the access point
+        * @return TBool Are the WAP-mandatory fields filled in the access point?
+        *
+        * @deprecated
+        */
+        IMPORT_C TBool HasMandatoryFieldsFilledL( TUint32 aUid );
+
+        /**
+        * Returns in a TBool whether the internet access point part
+        * identified by the passed aUid exists or not.
+        * param aUid the internet access point ID to check for
+        * (NOT equals to Wap access point ID).
+        * return TBool indicating whether an internet access point
+        * with the given ID exists or not.
+        *
+        * @deprecated
+        */
+        IMPORT_C TBool IAPExistsL( TUint32 aUid );
+
+        /**
+        * Returns in a TBool whether the access point identified
+        * by the passed aUid exists or not.
+        * @param aUid the access point ID to check for.(Wap access point ID).
+        * @return TBool indicating whether an access point with the
+        * given ID exists or not.
+        *
+        * @deprecated
+        */
+        IMPORT_C TBool WapApExistsL( TUint32 aUid );
+
+        /**
+        * Returns whether the access point has the WAP-mandatory
+        * fields filled or not.
+        * @param  aUid The UID of the access point
+        * @return TBool Are the WAP-mandatory fields filled in the access point?
+        *
+        * @deprecated
+        */
+        IMPORT_C TBool DoHasMandatoryFieldsFilledL(
+                        TUint32 aUid,
+                        CCommsDbTableView* aWapt = NULL,
+                        TApBearerType aBearertype = EApBearerTypeAllBearers );
+
+
+        /**
+        * Indicates whether a given name is valid or not.
+        * The name is valid if none, or only the aAcceptUid AP has it.
+        * @param aNameText The name to check.
+        * @param aAcceptUid A UID to accept with this name
+        * @return Boolean indicating if it is valid or not.
+        *
+        * @deprecated
+        */
+        IMPORT_C TBool IsValidNameL( const TDesC& aNameText,
+                                     TUint32 aAcceptUid );
+
+
+        /**
+        * Determines whether a given AP is read-only or not.
+        * @param aUid A UID to look for
+        * @return Boolean indicating if it is read-only or not.
+        *
+        * @deprecated
+        */
+        IMPORT_C TBool IsReadOnlyL( TUint32 aUid );
+
+
+
+        /**
+        * Determines whether a given LAN_SERVICE commsdb id 
+        * is linked to a WLAN data (thus is it a WLAN) or not.
+        * @param aUid A UID to look for
+        * @return Boolean indicating if it is WLAN or not.
+        */
+        TBool IsWlanL( TUint32 aLanCommdbId );
+        
+        
+        
+        
+        /**
+        * Determines whether a given LAN_SERVICE commsdb id 
+        * which is linked to a WLAN data (thus is it a WLAN) 
+        * has a valid SSID or it is empty
+        * @param aUid A UID to look for
+        * @return Boolean indicating if it has WLAN SSID or not.
+        */
+        TBool HasWlanSSIDL( TUint32 aLanCommdbId );
+        
+    protected:
+
+
+        /**
+        * Indicates the WAP bearer type of a given access point.
+        * Passed descriptor MUST be large enough to hold the new data,
+        * otherwise leaves with KErrDescOverflow.
+        * The maximum length is the maximum length of a 'normal' text fields
+        * length in Comms DB, KCommsDbSvrMaxFieldLength,
+        * which is defined in cdblen.h.
+        * @param aUid The UID of the access point.
+        * @param aBearer A reference to a TBearer to hold the bearer
+        * type of the access point.
+        * @return no return value.
+        */
+        void DoWapBearerTypeL( TUint32 aUid, TDes& aBearer );
+
+
+        /**
+        * Gets the bearer type of a given access point. Leaves on error.
+        * @param aUid The UID of the access point.
+        * @return The type of the bearer.
+        */
+        TApBearerType DoBearerTypeL( TUint32 aUid );
+
+
+        /**
+        * Indicates the ISP type of a given access point.
+        * @param aUid The UID of the access point.
+        * @param aIspType A reference to a TCommsDbIspType to hold the value
+        * @return No return value.
+        */
+        void DoISPTypeL( TUint32 aUid, TCommsDbIspType& aIspType );
+
+
+        /**
+        * Reads the Name of a given access point
+        * @param aUid The UID of the access point.
+        * @param A reference to hold the name of the access point.
+        * @return no return value.
+        * Passed descriptor MUST be large enough to hold the new data,
+        * otherwise leaves with KErrDescOverflow.
+        */
+        void DoNameL( TUint32 aUid, TDes& aName );
+
+
+        /**
+        * Sets the Name of a given access point
+        * Name is validated and modified if needed.
+        * Passed aName buffer MUST be large enough to hold the modified name.
+        * @param aName A reference to the name of the access point.
+        * The given name is returned in it.
+        * @param aUid The UID of the access point.
+        * @return no return value.
+        */
+        void DoSetNameL( TDes& aName, TUint32 aUid );
+
+
+        /**
+        * Sets the ISP type for a given access point
+        * @param aUid The UID of the access point
+        * @param aIspType The desired Isp type of the access point
+        * @return no return value.
+        */
+        void DoSetISPTypeL( TUint32 aUid, TCommsDbIspType aIspType );
+
+
+        /**
+        * Returns in a TBool whether the record
+        * identified by the passed aUid exists or not
+        * in the table identified by the passed table name.
+        * @param aTable The name of the table to check
+        * @param aUid The UID to check for
+        * @return TBool indicating whether the record
+        * with the given ID exists in the given table or not.
+        */
+        TBool DoesExistsL( TPtrC aTable, TUint32 aUid );
+
+
+        /**
+        * Wrapper for public API.
+        * Determines whether a given LAN_SERVICE commsdb id 
+        * is linked to a WLAN data (thus is it a WLAN) or not.
+        * @param aUid A UID to look for
+        * @return Boolean indicating if it is WLAN or not.
+        */
+        TBool DoIsWlanL( TUint32 aLanCommdbId );
+        
+        
+    private:    // Data
+        CCommsDatabase* iDb;
+        // TCommDbDatabaseType iDbType; // deprecated and not used but kept 
+        // to maintain class size for BC
+        // Added a new iExt for expansion instead of TCommDbDatabaseType 
+        // same size, no BC problem...
+        TUtilsExtra*  iExt;
+
+
+    };
+
+#endif      // APUTILS_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/access_point_engine_api/inc/ActiveApDb.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,195 @@
+/*
+* Copyright (c) 2002 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 classes CActiveApDb
+*               and MActiveApDbObserver.
+*
+*/
+
+
+#ifndef ACTIVE_APDB_H
+#define ACTIVE_APDB_H
+
+// Deprecation warning
+#warning This header file has been deprecated. Will be removed in one of the next SDK releases.
+
+
+//  INCLUDES
+#include <commdb.h>
+#include <ApEngineVer.h>
+
+/*
+// Enum for DATABASE_TYPE field
+// Will be deprecated in 7.0
+enum TCommDbDatabaseType
+    {
+    EUnspecified = 0,   // not specifying which type it is - any type of 
+                        // database can be opened with this parameter
+    EIAP,
+    EISP
+    };
+*/
+
+// CONSTANTS
+const TInt KErrActiveApDbObserverNotFound = -500;
+
+// FORWARD DECLARATION
+class CActiveApDbNotifier;
+
+// CLASS DECLARATION
+
+/**
+* Mixin protocol for handling events from a CCommsDatabase.
+* Events are related to database changes and availability.
+*/
+class MActiveApDbObserver
+    {
+    public:     // types
+        enum TEvent       /// Events reported to the database observer.
+            {
+            EDbChanged,   ///< Database has changed.
+            EDbClosing,   ///< Database is about to close.
+            EDbAvailable  ///< Database is available again.(E.g. after unlock)
+            };
+
+    public:     // new methods
+
+        /**
+        * Derived classes should implement this method, and act accordingly
+        * to database events.
+        * @param anEvent Database-related event.
+        *
+        * @deprecated
+        */
+        IMPORT_C virtual void HandleApDbEventL( TEvent anEvent ) = 0;
+
+    };
+
+/**
+* This class manages and guards database integrity
+* by handling all events that are related to the database. These events
+* may originate from the system (Shutdown, Backup/Restore) and from the
+* database itself. The events are transformed into a simple protocol,
+* defined by MActiveApDbObserver.
+* Expects an active scheduler to be installed and running.
+*/
+NONSHARABLE_CLASS( CActiveApDb ) : public CBase
+    {
+
+    public:     // Constructors and destructor
+        /**
+        * Two-phased constructor. Leaves on failure.
+        * @param aType The desired type of the CCommsDatabase object.
+        * Defaults to EDatabaseTypeIAP.
+        * @return The constructed CActiveApDb object.
+        *
+        * @deprecated
+        */
+        IMPORT_C static CActiveApDb* NewL
+            ( TCommDbDatabaseType aType = EDatabaseTypeIAP );
+
+
+
+        /**
+        * Destructor.
+        *
+        * @deprecated
+        */
+        IMPORT_C virtual ~CActiveApDb();
+
+    protected:  // Constructors
+
+        /**
+        * Second phase constructor. Leaves on failure.
+        * @param aType The desired type of the CCommsDatabase object.
+        * events.
+        */
+        void ConstructL();
+
+    public:     // new methods
+        /**
+        * Adds an observer to the list of observers to be notified
+        * about the DB events.
+        * Also automatically starts observation and notification.
+        * The order of notification will be exactly the order of registration.
+        * @param anObserver Observer to be notified about database-related
+        * events.
+        *
+        * @deprecated
+        */
+        IMPORT_C void AddObserverL( MActiveApDbObserver* anObserver );
+
+
+        /**
+        * Removes an observer. If not added, silently ignores.
+        * @param anObserver The observer.
+        *
+        * @deprecated
+        */
+        IMPORT_C void RemoveObserver( MActiveApDbObserver* anObserver );
+
+
+        /**
+        * Returns the CCommsDatabase.
+        * Required because we can not derive from CCommsDatabase...
+        *
+        * @deprecated
+        */
+        IMPORT_C CCommsDatabase*  Database();
+
+    private:
+        /**
+        * Handle events from the database (DBMS).
+        * The order of notification is the order of registration.
+        * @param anEvent Event generated by DBMS. Values from
+        * RDbNotifier::TEvent, or KErrCancel.
+        */
+        void HandleDbEventL( TInt anEvent );
+
+
+        /**
+        * Notify all observers about an event.
+        * @param anEvent Event to be sent to observers.
+        */
+        void NotifyObserversL( MActiveApDbObserver::TEvent anEvent );
+
+    friend class CActiveApDbNotifier;
+
+    private:    // types
+        /**
+        * Default constructor. Can not leave.
+        */
+        CActiveApDb();
+
+
+        enum TState             /// State of the finite state machine.
+            {
+            EClosed,            ///< Closed and idle.
+            EReady,             ///< Open and ready for use.
+            EWaitClose,         ///< Closed, waiting for other users to close.
+            EWaitBackupRestore, ///< Closed, waiting Backup/Restore to finish.
+            EWaitShutdown       ///< Closed, waiting to die.
+            };
+
+    private:        // Data
+        CArrayPtrFlat<MActiveApDbObserver>* iObservers;   ///< Observers.
+
+        CCommsDatabase*     iDb;    // Creates & owns it !
+        // CommsDb has its own RDbNotifier...
+        TState iState;  ///< Current state of the database.
+        CActiveApDbNotifier*    iDbNotifier;
+    };
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/access_point_engine_api/inc/ApEngineConsts.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,279 @@
+/*
+* Copyright (c) 2002 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:  Used constants of the ApEngine.
+*
+*/
+
+
+#ifndef APENGINE_CONSTS_H
+#define APENGINE_CONSTS_H
+
+// Deprecation warning
+#warning This header file has been deprecated. Will be removed in one of the next SDK releases.
+ 
+ 
+#include <ApEngineVer.h>
+
+
+// ERROR CODES
+// Used either as return values or leave codes. Apart from these, system error
+// codes can also be returned or leaved with.
+
+/// Attempting to read or write a column which does not exists.
+const TInt  KErrInvalidColumn       = -300;
+
+/// The given bearer is not valid.
+const TInt  KErrInvalidBearer       = -301;
+
+/// The type of the database is not valid
+const TInt  KErrInvalidDatabaseType = -302;
+
+/// The name of the AP is not valid (length = 0)
+const TInt  KErrInvalidName         = -303;
+
+const TInt  KErrDescOverflow        = -304;
+
+/// The passed pointer was invalid = NULL
+const TInt  KErrNullPointerPassed   = -305;
+
+/// The filter is not valid
+const TInt  KErrInvalidFilterType   = -310;
+
+/// The bearer is not valid
+const TInt  KErrInvalidBearerType   = -311;
+
+/// The ISP type given is invalid
+const TInt  KErrInvalidIspRequest   = -312;
+
+/// Used when the requested value was not specified in the database
+const TInt  KErrValueUnspecified    = -323;
+
+const TInt  KApEngineMaxSql              = 255;
+
+
+
+/// These constants are used to represent the sorting order used in CApSelect.
+const TInt  KEApSortUidAscending         = 0x00000001;  ///< The sorting is
+                                                        ///< done according to
+                                                        ///< the ID of the
+                                                        ///< access points in
+                                                        ///< ascending order.
+const TInt  KEApSortUidDescending        = 0x00000002;  ///< The sorting is
+                                                        ///< done according to
+                                                        ///< the ID of the
+                                                        ///< access points in
+                                                        ///< descending order.
+const TInt  KEApSortNameAscending        = 0x00000003;  ///< The sorting is
+                                                        ///< done according to
+                                                        ///< the name of the
+                                                        ///< access points in
+                                                        ///< ascending order.
+const TInt  KEApSortNameDescending       = 0x00000004;  ///< The sorting is
+                                                        ///< done according to
+                                                        ///< the name of the
+                                                        ///< access points in
+                                                        ///< descending order.
+
+
+/// These enums are used to represent one the filtering criterias in CApSelect.
+const TInt  KEApIspTypeInternetOnly     = 0x00000001;   ///< Filter allows only
+                                                        ///< access points that
+                                                        ///< are capable of
+                                                        ///< only internet
+                                                        ///< access.
+const TInt  KEApIspTypeWAPOnly          = 0x00000002;   ///< Filter allows only
+                                                        ///< access points that
+                                                        ///< are capable of
+                                                        ///< only WAP access.
+const TInt  KEApIspTypeInternetAndWAP   = 0x00000004;   ///< Filter allows only
+                                                        ///< access points that
+                                                        ///< are capable of
+                                                        ///< internet AND
+                                                        ///< WAP access.
+const TInt  KEApIspTypeWAPMandatory     = 0x00000008;   ///< Filter allows only
+                                                        ///< access points that
+                                                        ///< are capable of
+                                                        ///< WAP access AND
+                                                        ///< contain mandatory
+                                                        ///< WAP settings.
+const TInt  KEApIspTypeAll              = 0x00000010;   ///< No filtering is
+                                                        ///< done, all access
+                                                        ///< points are shown.
+const TInt  KEApIspTypeMMSMandatory     = 0x00000020;   ///< Filter allows only
+                                                        ///< access points that
+                                                        ///< are capable of MMS
+                                                        ///< and contain MMS
+                                                        ///< mandatory settings
+                                                        ///< Starting Page
+
+
+
+
+const TInt KModifiableTextLength        = 100;
+const TInt KModifiableLongTextLength    = 1000;
+
+
+// typedef
+enum TApBearerType      /// These enums are used to represent the possible
+                        /// bearer types and the filtering criteria
+                        /// in CApSelect.
+    {
+    EApBearerTypeCSD        = 0x00000001,   ///< Filter allows only access
+                                            ///< points that has CSD as bearer.
+    EApBearerTypeGPRS       = 0x00000002,   ///< Filter allows only access
+                                            ///< points that has GPRS as bearer
+    EApBearerTypeHSCSD      = 0x00000004,   ///< Filter allows only access
+                                            ///< points that has HSCSD
+                                            ///< as bearer.
+
+// Will be deprecated, use EApBearerTypeAllBearers instead !
+    EApBearerTypeAll        = 0x00000008,   ///< No filtering is done,
+                                            ///< all access points are shown.
+                                            
+    EApBearerTypeCDMA       = 0x00000010,   ///< Filter allows only access
+                                            ///< points that has CDMA as bearer
+    EApBearerTypeWLAN       = 0x00000020,   ///< Filter allows only access
+                                            ///< points that has WLAN as bearer
+    EApBearerTypeLAN        = 0x00000040,   ///< Filter allows only access
+                                            ///< points that has LAN as bearer
+    EApBearerTypeLANModem   = 0x00000080,   ///< Filter allows only access
+                                            ///< points with LAN modem bearer
+    EApBearerTypeAllBearers = 0xffffffff    ///< No filtering is done,
+                                            ///< all access points are shown.
+    };
+
+
+enum TApCallSpeed       /// These enums are used to represent
+                        /// the connection speed.
+    {
+    KSpeedAutobaud=0x00000000,          ///< Autodetect
+    KSpeed9600=0x00000001,              ///< 9600
+    KSpeed14400=0x00000002,             ///< 14400
+    KSpeed19200=0x00000003,             ///< 19200
+    KSpeed28800=0x00000004,             ///< 28800
+    KSpeed38400=0x00000005,             ///< 38400
+    KSpeed43200=0x00000006,             ///< 43200
+    KSpeed56000=0x00000007              ///< 56000
+    };
+
+
+enum TApCallType        /// These enums are used to represent
+                        /// the conn. type Analogue/ISDNv110/ISDNv120
+    {
+    ECallTypeAnalogue,          ///< Analogue
+    ECallTypeISDNv110,          ///< ISDN v. 110
+    ECallTypeISDNv120           ///< ISDN v. 120
+    };
+
+const TUint32 KMaxAnalogueSpeed    = KSpeed28800;
+const TUint32 KMaxIsdnSpeed        = KSpeed43200;
+
+//if WCDMA is enabled, then the max speed are :
+const TUint32 KMaxAnalogueSpeedWcdma    = KSpeed28800;
+const TUint32 KMaxIsdnSpeedWdma         = KSpeed56000;
+
+
+enum TIPvType
+    {
+    EIPv4       = 1,
+    EIPv6       = 2
+    };
+
+
+enum TWlanNetMode
+    {
+    EAdhoc       = 0,
+    EInfra       = 1
+    };
+
+
+enum TWlanSecMode
+    {
+    EOpen       = 1,
+    EWep        = 2,
+    E802_1x     = 4,
+    EWpa        = 8,
+    EWpa2       = 16
+    };
+
+
+#define KApMaxConnNameLength            30
+
+// The following constants are deprecated, DO NOT USE THEM!
+// DO NOT USE STARTS
+#define KApMaxGprsApNameLength          100
+#define KApMaxLoginNameLength           32
+#define KApMaxStartPageLength           1000
+#define KApMaxAccessNumLength           21
+#define KApCBInfoLength                 21
+#define KApMaxServiceCentreAddrLength   21
+#define KApMaxIpAddressLength           100
+#define KApMaxLoginScriptLength         1000
+#define KApMaxLoginPasswordLength       20
+// DO NOT USE ENDS
+
+
+_LIT( KSqlSelectNum, "SELECT %s from %s WHERE %s=%d" );
+_LIT( KSqlSelectBaseNum, "SELECT * from %s WHERE %s=%d" );
+
+/// 'Dynamic' IP address to use in comparisons
+_LIT( KDynIpAddress, "0.0.0.0" );
+
+/// A start page, which have to be considered as invalid.
+_LIT( KInvStartPage, "http://" );
+
+/// A name for the 'location' to use
+_LIT( KLocation, "Mobile" );
+
+
+/// Modem bearer names for (HS)CSD Access Points
+_LIT( KModemBearerCSD, "CSD Modem" ); 
+
+/// Modem bearer names for GPRS/WCDMA Access Points
+_LIT( KModemBearerGPRS, "GPRS Modem" );
+
+/// Modem bearer names for CDMA Access Points
+_LIT( KModemBearerCDMA, "CDMA Modem" );
+
+/// Modem bearer names for WLAN Access Points
+_LIT( KModemBearerWLAN, "WLANBearer" );
+
+/// Modem bearer names for LAN Access Points
+_LIT( KModemBearerLAN, "LANBearer" );
+
+/// Modem bearer names for LAN Modem Access Points
+_LIT( KModemBearerLANModem, "LANModem" );
+
+
+/// Number of retries that are used in database operations
+const TInt KRetryCount              = 5;
+
+
+/// Time to wait before retry database operation 
+// (==0.10 secs = 100000microsec.)
+#define KRetryWait  100000 /* in TTimeIntervalMicroSeconds32 */
+
+// callback timeout in microseconds
+const TUint32 KCallBackTimeOut  = 60000000;
+
+_LIT( KDynIpv6Address, "0:0:0:0:0:0:0:0" );
+
+
+_LIT( KDaemonManagerName, "NetCfgExtnDhcp" );
+_LIT( KConfigDaemonName, "!DhcpServ" );
+
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/access_point_engine_api/inc/ApEngineVer.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2002 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 used for version/behavioural control for the ApEngine.
+*
+*/
+
+
+#ifndef APENGINE_VER_H
+#define APENGINE_VER_H
+
+// Deprecation warning
+#warning This header file has been deprecated. Will be removed in one of the next SDK releases.
+ 
+ 
+// #define     __PROXY_SETTINGS
+
+#endif
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/access_point_engine_api/inc/ApListItem.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,318 @@
+/*
+* Copyright (c) 2002 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 the CApSelect class.
+*
+*/
+
+
+#ifndef CAPLISTITEM_H
+#define CAPLISTITEM_H
+
+// Deprecation warning
+#warning This header file has been deprecated. Will be removed in one of the next SDK releases.
+ 
+ 
+//  INCLUDES
+#include <commdb.h>
+#include <ApEngineVer.h>
+#include <ApEngineConsts.h>
+
+
+typedef struct
+    {
+    TBool           iReadOnly;      ///< Is the AP protected or not
+    TUint32         iIapId;         ///< The IAP UID of the item
+    TBool           iIsVpn;         ///< Is it a VPN or not?
+    }TApListItemExtra;
+
+
+// CLASS DECLARATION
+/**
+*  Representation of a list item.
+*/
+class CApListItem :public CBase
+                                         ///< This class is used to hold
+                                         ///< the main information of an
+                                         ///< access point.
+                                         ///< It is used in CApSelect.
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor. Leaves on failure, places instance
+        * on cleanup stack.
+        * @return The constructed CApListItem.
+        *
+        * @deprecated
+        */
+        IMPORT_C static CApListItem* NewLC();
+
+
+        /**
+        * NOTE: This function is deprecated, use the one with the additional
+        * aStartPage parameter below.
+        * Two-phased constructor. Leaves on failure, places instance
+        * on cleanup stack.
+        * @param aIspType The type of the access point
+        * (Internet only, Wap only, Internet AND Wap)
+        * @param aUid The ID of the access point
+        * @param aName The name of the access point
+        * @param aBearerType The bearer type of the access point
+        * @return The constructed CApListItem.
+        *
+        * @deprecated
+        */
+        IMPORT_C static CApListItem* NewLC( TCommsDbIspType aIspType,
+                                            TUint32 aUid,
+                                            const TDesC& aName,
+                                            TApBearerType aBearerType );
+
+
+        /**
+        * Two-phased constructor. Leaves on failure, places instance
+        * on cleanup stack.
+        * @param aIspType The type of the access point
+        * (Internet only, Wap only, Internet AND Wap)
+        * @param aUid The ID of the access point
+        * @param aName The name of the access point
+        * @param aBearerType The bearer type of the access point
+        * @param aStartpage The starting page of the access point
+        * @param aReadOnly Whether the given item is read-only or not
+        * @return The constructed CApListItem.
+        *
+        * @deprecated
+        */
+        IMPORT_C static CApListItem* NewLC( TCommsDbIspType aIspType,
+                                            TUint32 aUid,
+                                            const TDesC& aName,
+                                            TApBearerType aBearerType,
+                                            const TDesC& aStartPage,
+                                            TBool aReadOnly = ETrue
+                                            );
+
+        /**
+        * Two-phased constructor. Leaves on failure, places instance
+        * on cleanup stack.
+        * @param aItem a pointer to a CApListItem.
+        * @return The constructed CApListItem.
+        *
+        * @deprecated
+        */
+        IMPORT_C static CApListItem* NewLC( CApListItem* aItem );
+
+
+        /**
+        * Destructor.
+        *
+        * @deprecated
+        */
+        IMPORT_C virtual ~CApListItem();
+
+
+        /**
+        * Copies the data from another CApListItem
+        * Substitutes the "Assignment operator."
+        * @return No return value.
+        *
+        * @deprecated
+        */
+        IMPORT_C void CopyFromL( const CApListItem& aCopyFrom );
+
+
+
+    protected:      // Constructors
+        /**
+        * C++ default constructor.
+        *
+        * @deprecated
+        */
+        IMPORT_C CApListItem();
+
+        /**
+        * NOTE: This function is deprecated, use the one with the additional
+        * aStartPage parameter below.
+        * Second-phase constructor.
+        * @param aIspType The type of the access point
+        * (Internet only, Wap only, Internet AND Wap)
+        * @param aUid The ID of the access point
+        * @param aName The name of the access point
+        * @param aBearerType The bearer type of the access point
+        *
+        * @deprecated
+        */
+        IMPORT_C void ConstructL( TCommsDbIspType aIspType,
+                                  TUint32 aUid,
+                                  const TDesC& aName,
+                                  TApBearerType aBearerType );
+
+        /**
+        * Second-phase constructor.
+        * @param aIspType The type of the access point
+        * (Internet only, Wap only, Internet AND Wap)
+        * @param aUid The ID of the access point
+        * @param aName The name of the access point
+        * @param aBearerType The bearer type of the access point
+        * @param aStartpage The starting page of the access point
+        *
+        * @deprecated
+        */
+        IMPORT_C void ConstructL( TCommsDbIspType aIspType,
+                                  TUint32 aUid,
+                                  const TDesC& aName,
+                                  TApBearerType aBearerType,
+                                  const TDesC& aStartPage
+                                  );
+
+
+        /**
+        * Second-phase constructor.
+        *
+        * @deprecated
+        */
+        IMPORT_C void ConstructL();
+
+
+    public: // New functions
+
+        /**
+        * NOTE: This function is deprecated, use the one with the additional
+        * aStartPage parameter below.
+        * Sets item values of the access point. Leaves on failure.
+        * @param aIspType The type of the access point
+        * (Internet only, Wap only, Internet AND Wap)
+        * @param aUid The ID of the access point
+        * @param aName The name of the access point
+        * @param aBearerType The bearer type of the access point
+        *
+        * @deprecated
+        */
+        IMPORT_C void SetItemL( TCommsDbIspType aIspType,
+                                TUint32 aUid,
+                                const TDesC& aName,
+                                TApBearerType aBearerType );
+
+        /**
+        * Sets item values of the access point. Leaves on failure.
+        * @param aIspType The type of the access point
+        * (Internet only, Wap only, Internet AND Wap)
+        * @param aUid The ID of the access point
+        * @param aName The name of the access point
+        * @param aBearerType The bearer type of the access point
+        * @param aStartpage The starting page of the access point
+        *
+        * @deprecated
+        */
+        IMPORT_C void SetItemL( TCommsDbIspType aIspType,
+                                TUint32 aUid,
+                                const TDesC& aName,
+                                TApBearerType aBearerType,
+                                const TDesC& aStartpage
+                                );
+
+
+        /**
+        * Gets the name of the 'current' access point
+        * Ownership of the returned text is not passed.
+        * @return The name of the current access point
+        *
+        * @deprecated
+        */
+        IMPORT_C const TDesC& Name();
+
+
+        /**
+        * Gets the UID of the current access point
+        * @return The UID of the current access point
+        *
+        * @deprecated
+        */
+        IMPORT_C TUint32 Uid();
+
+
+        /**
+        * Gets the ISP-type of the current access point
+        * @return The ISP-type of the current access point.
+        *
+        * @deprecated
+        */
+        IMPORT_C TCommsDbIspType Type();
+
+
+        /**
+        * Gets the bearer-type of the current access point
+        * @return The bearer-type of the current access point.
+        *
+        * @deprecated
+        */
+        IMPORT_C TApBearerType BearerType();
+
+
+        /**
+        * Returns the startpage of the current access point if any,
+        * otherwise, an empty string is returned.
+        * Ownership of the returned text is not passed.
+        * @return The startpage of the current access point.
+        *
+        * @deprecated
+        */
+        IMPORT_C const TDesC& StartPage() const;
+
+
+        /**
+        * Returns whether the access point is read-only or not.
+        * @return Whether the access point is read-only or not.
+        *
+        * @deprecated
+        */
+        IMPORT_C TBool IsReadOnly() const;
+
+
+        /**
+        * Returnes whether the given access point is a VPN ap or not.
+        * @return whether the given access point is a VPN ap or not.
+        */
+        TBool IsVpnAp() const;
+
+        /**
+        * Sets whether the given access point is a VPN ap or not.
+        */
+        void SetVpnFlag( TBool aIsVpn );
+
+    protected:
+        void CreateExtraL();    ///< Construct the extra data
+
+    private:    // Data
+        TCommsDbIspType iIspType;       ///< The type of the access point
+                                        ///< (Internet only, Wap only,
+                                        ///< Internet AND Wap)
+        TUint32         iUid;           ///< The ID of the access point
+        HBufC*          iName;          ///< The name of the access point
+        HBufC*          iStartPage;     ///< The startpage of the access point
+
+        TApBearerType   iBearerType;    ///< Bearer type of the access point
+        TApListItemExtra*   iExt;       ///< Extra data structure
+
+
+    protected:  // Friend classes
+        friend class CApSelect;
+        friend class TApListItemUidKey;
+
+    };
+
+
+
+#endif      // CAPLISTITEM_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/access_point_engine_api/inc/ApNetworkItem.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,162 @@
+/*
+* Copyright (c) 2002 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 the CApNetworkItem class.
+*
+*/
+
+
+#ifndef CAPNETWORKITEM_H
+#define CAPNETWORKITEM_H
+
+// Deprecation warning
+#warning This header file has been deprecated. Will be removed in one of the next SDK releases.
+ 
+ 
+//  INCLUDES
+#include <commdb.h>
+#include <ApEngineVer.h>
+#include <ApEngineConsts.h>
+
+// CLASS DECLARATION
+/**
+*  Representation of a Network item.
+*/
+NONSHARABLE_CLASS( CApNetworkItem ) :public CBase
+                                         ///< This class is used to hold
+                                         ///< the main information of a
+                                         ///< Network item.
+                                         ///< It is used in CApNetworks.
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor. Leaves on failure, places instance
+        * on cleanup stack.
+        * @return The constructed CApNetworkItem.
+        *
+        * @deprecated
+        */
+        IMPORT_C static CApNetworkItem* NewLC();
+
+
+        /**
+        * Two-phased constructor. Leaves on failure, places instance
+        * on cleanup stack.
+        * @param aItem a pointer to a CApNetworkItem.
+        * @return The constructed CApNetworkItem.
+        *
+        * @deprecated
+        */
+        IMPORT_C static CApNetworkItem* NewLC( CApNetworkItem* aItem );
+
+
+        /**
+        * Destructor.
+        *
+        * @deprecated
+        */
+        IMPORT_C virtual ~CApNetworkItem();
+
+
+        /**
+        * Copies the data from another CApNetworkItem
+        * Substitutes the "Assignment operator."
+        * @return No return value.
+        *
+        * @deprecated
+        */
+        IMPORT_C void CopyFromL( const CApNetworkItem& aCopyFrom );
+
+
+    private:      // Constructors
+        /**
+        * C++ default constructor.
+        *
+        * @deprecated
+        */
+        IMPORT_C CApNetworkItem();
+
+
+        /**
+        * Second-phase constructor.
+        * @param aUid The UID
+        * @param aName The name
+        *
+        * @deprecated
+        */
+        IMPORT_C void ConstructL( TUint32 aUid,
+                                  const TDesC& aName
+                                  );
+
+
+        /**
+        * Second-phase constructor.
+        *
+        * @deprecated
+        */
+        IMPORT_C void ConstructL();
+
+
+    public: // New functions
+
+        /**
+        * Gets the name of the network group
+        * Ownership of the returned text is not passed.
+        * @return The name of the network group
+        *
+        * @deprecated
+        */
+        IMPORT_C const TDesC& Name() const;
+
+
+        /**
+        * Gets the UID of this network group
+        * @return The UID of this network group
+        *
+        * @deprecated
+        */
+        IMPORT_C TUint32 Uid() const;
+
+
+
+        /**
+        * Sets a UID of the network group.
+        * @param aUid a uid to set.
+        *
+        * @deprecated
+        */
+        IMPORT_C void SetUid( TUint32 aUid );
+
+
+        /**
+        * Sets the network name
+        * @param aName The name to set.
+        *
+        * @deprecated
+        */
+        IMPORT_C void SetNameL( const TDesC& aName );
+
+
+    private:    // Data
+        TUint32         iUid;           ///< The ID of the network group
+        HBufC*          iName;          ///< The name of the network group 
+
+    };
+
+
+
+#endif      // CAPNETWORKITEM_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/access_point_engine_api/inc/ApNetworkItemlist.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,74 @@
+/*
+* Copyright (c) 2002 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 the CApNetworkItemList class.
+*
+*/
+
+
+#ifndef CAPNETWORKITEMLIST_H
+#define CAPNETWORKITEMLIST_H
+
+// Deprecation warning
+#warning This header file has been deprecated. Will be removed in one of the next SDK releases.
+ 
+ 
+//  INCLUDES
+#include <e32base.h>
+#include <ApEngineVer.h>
+
+// FORWARD DECLARATION
+
+class CApNetworkItem;
+
+// CLASS DECLARATION
+/**
+*  A list of CApNetworkItem-s pointers; items are owned.
+*/
+class CApNetworkItemList : public CArrayPtrFlat<CApNetworkItem>
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * C++ default constructor.
+        *
+        * @deprecated
+        */
+        IMPORT_C CApNetworkItemList();
+
+        /**
+        * Destructor. Items in the list are destroyed.
+        *
+        * @deprecated
+        */
+        IMPORT_C virtual ~CApNetworkItemList();
+
+    public:  // New methods
+
+        /**
+        * Get pointer to the item having aUid,
+        * or NULL if no such item is in the
+        * list.
+        * @param aUid Uid of item to get.
+        * @return Pointer to the item having uid aUid, or NULL. Ownership
+        * not passed (the list still owns the item).
+        *
+        * @deprecated
+        */
+        IMPORT_C const CApNetworkItem* ItemForUid( TUint32 aUid ) const;
+
+    };
+
+#endif // CAPNETWORKITEMLIST_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/access_point_engine_api/inc/Aplistitemlist.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,74 @@
+/*
+* Copyright (c) 2002 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 the CApListItemList class.
+*
+*/
+
+
+#ifndef CAPLISTITEMLIST_H
+#define CAPLISTITEMLIST_H
+
+// Deprecation warning
+#warning This header file has been deprecated. Will be removed in one of the next SDK releases.
+ 
+ 
+//  INCLUDES
+#include <e32base.h>
+#include <ApEngineVer.h>
+
+// FORWARD DECLARATION
+
+class CApListItem;
+
+// CLASS DECLARATION
+/**
+*  A list of CApListItem-s pointers; items are owned.
+*/
+class CApListItemList : public CArrayPtrFlat<CApListItem>
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * C++ default constructor.
+        *
+        * @deprecated
+        */
+        IMPORT_C CApListItemList();
+
+        /**
+        * Destructor. Items in the list are destroyed.
+        *
+        * @deprecated
+        */
+        IMPORT_C virtual ~CApListItemList();
+
+    public:  // New methods
+
+        /**
+        * Get pointer to the item having aUid,
+        * or NULL if no such item is in the
+        * list.
+        * @param aUid Uid of item to get.
+        * @return Pointer to the item having uid aUid, or NULL. Ownership
+        * not passed (the list still owns the item).
+        *
+        * @deprecated
+        */
+        IMPORT_C CApListItem* ItemForUid( TUint32 aUid ) const;
+
+    };
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/access_point_settings_handler_api/access_point_settings_handler_api.metaxml	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,18 @@
+<?xml version="1.0" ?>
+<api id="d7abf56e3fafedb47da958a6a793cd8d" dataversion="1.0">
+  <name>Access Point Settings Handler API</name>
+  <description>Provides applications with the possibility to include Access Point choice.</description>
+  <type>c++</type>
+  <subsystem>networkingutilities</subsystem>
+  <libs>
+    <lib name="apsettingshandlerui.lib" />
+  </libs>
+  <release category="sdk" sinceversion="0.9" deprecatedsince="3.2"/>
+  <attributes>
+     <!-- This indicates wether the api provedes separate html documentation -->
+     <!-- or is the additional documentation generated from headers. -->
+     <!-- If you are unsuere then the value is "no" -->
+     <htmldocprovided>yes</htmldocprovided>
+     <adaptation>no</adaptation>
+  </attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/access_point_settings_handler_api/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* 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:  File that exports the files belonging to 
+:                Access Point Settings Handler API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/ApSettingsHandlerCommons.h     MW_LAYER_PUBLIC_EXPORT_PATH(ApSettingsHandlerCommons.h)
+../inc/Apsettingshandlerui.h     MW_LAYER_PUBLIC_EXPORT_PATH(ApSettingsHandlerUI.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/access_point_settings_handler_api/inc/ApSettingsHandlerCommons.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,179 @@
+/*
+* Copyright (c) 2002 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: 
+*     Contains common consts, typedefs for the Access Point settings.
+*
+*/
+
+
+#ifndef APSETTINGS_HANDLER_COMMONS_H
+#define APSETTINGS_HANDLER_COMMONS_H
+
+// Deprecation warning
+#warning This header file has been deprecated. Will be removed in one of the next SDK releases.
+ 
+ 
+// INCLUDES
+#include <ApEngineConsts.h>
+
+
+//#define __TEST_OOMDEBUG
+
+
+// CONSTANTS
+_LIT( KEmpty, "");
+
+_LIT( KTestFileName, "C:\\Data\\ApSetUiTest\\TestState.txt" );
+
+const TInt  KApSelectionCanceled    = -350;
+const TInt  KTxtNotOverriden        = -351;
+const TInt  KErrInvalidTextId       = -355;
+
+#ifdef __TEST_OOMDEBUG
+    const TInt  KDialogListTest      = 1;   // Done
+    const TInt  KPopupListTest       = 2;   // Done
+    const TInt  KQueryTest           = 3;   // Done
+    const TInt  KEditingTest         = 4;   // Done
+    const TInt  KViewerTest          = 5;   // impl.
+    const TInt  KCreateBlankTest     = 6;   // Impl
+    const TInt  KCreateUseExistTest  = 7;   // Impl
+    const TInt  KDeleteTest          = 8;   // N/I!
+
+    const TUint32   KOOMRetryCount   = 10;
+    const TUint32   KOOMRetryOffset  = 5;
+#endif // __TEST_OOMDEBUG
+
+// DATA TYPES
+enum TTextID    /// These enums are used to identify the 'overridable' 
+                /// text items in CApSettingsHandler.
+    {
+    EApSettingsSelStatusPaneText = 0x00,
+    EApSettingsSelListEmptyText,
+    EPopupPromptText            /// Only this last one is used & implemented.
+    };
+
+
+enum TTransactionResult         ///< Transaction results
+    {
+    EOwnTransaction,            ///< Own transaction started
+    EUsingAlreadyStarted,       ///< Used already started one
+    EFailedWithLocked           ///< Transaction start failed with KErrLocked
+    };
+
+
+enum TApUiExitReason
+    {
+    EExitNone,
+    EExit,
+    EShutDown
+    };
+
+
+// CONSTANTS
+const TInt  KTTextIdMin             =  EApSettingsSelStatusPaneText;
+const TInt  KTTextIdMax             =  EPopupPromptText;
+
+const TInt  KMaxNumOfLockedDbRetries= 3;
+
+/// Ui return code flags. They indicate what has happened inside the module. 
+/// They can be combined.
+/**
+* Ui return code flags. They indicate what has happened inside the module. 
+* They can be combined. The most important one is KApUiEventSelected and it 
+* indicates that the user selected an access point (in case of selection...)
+*/
+const TInt  KApUiEventNone              = 0x00000000;   ///< Nothign happend
+const TInt  KApUiEventSelected          = 0x00000001;   ///< Item was selected
+const TInt  KApUiEventCreatedBlank      = 0x00000002;   ///< New item created 
+                                                        ///< from blank
+const TInt  KApUiEventCreatedUsedOld    = 0x00000004;   ///< New item created 
+                                                        ///< from an existing 
+                                                        ///< one
+const TInt  KApUiEventEdited            = 0x00000008;   ///< Item edited
+const TInt  KApUiEventDeleted           = 0x00000010;   ///< Item deleted
+const TInt  KApUiEventExitRequested     = 0x00000020;   ///< User choosed Exit
+const TInt  KApUiEventShutDownRequested = 0x00000040;   ///< System shutdown
+
+// INTERNAL flag
+const TUint32  KApUiEventInternal       = 0x80000000;   ///< Internal flag
+
+
+const TUint32  KApNoneUID               = 0x00000000;
+
+
+enum TSelectionListType         ///< Defines the list type to be used
+    {
+    EApSettingsSelListIsPopUp, 
+    EApSettingsSelListIsListPane,
+    EApSettingsSelListIsPopUpWithNone
+    };
+
+
+enum TSelectionMenuType         ///< Defines the Options menu type to be used
+    {
+    EApSettingsSelMenuNormal, 
+    EApSettingsSelMenuSelectOnly,
+    EApSettingsSelMenuSelectNormal
+    };
+
+
+
+enum TApSettingsHandlerUiPanicCodes ///< Defines the Panic codes
+    {
+    EMenuCommandUnknown,            ///< Unknonw menu command
+    EInvalidDbType,                 ///< Invalid database type
+    EInvalidBitmapType,             ///< Invalid bitmap type
+    EInvalidBearerType,             ///< Invalid bearer type
+    EInvalidIspRequest,             ///< Invalid ISP request
+    ENullPointer,                   ///< Null pointer passed
+    EUnknownCase,                   ///< Unknown 'case' 
+    EInvalidTextType,               ///< Invalid text type
+    EInvalidState                   ///< Invalid state
+    } ;
+
+
+
+/**
+* Panic
+* @param aPanic Panic code
+*/
+void Panic( TApSettingsHandlerUiPanicCodes aPanic );
+
+
+/**
+* Ask a query
+* @param aResId Resource id
+* @param aVar variable part of the query, if any
+* @return The result of the query
+*/
+TInt AskQueryL( TInt aResId, TDesC* aVar = NULL );
+
+
+/**
+* Shows a note
+* @param aResId Resource id
+* @param aVar variable part of the note, if any
+* @return The result of the note
+*/
+TInt ShowNoteL( TInt aResId, TDesC* aVar = NULL );
+
+
+#ifdef __TEST_OOMDEBUG
+    TInt GetTestState();
+#endif // __TEST_OOMDEBUG
+
+#endif
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/access_point_settings_handler_api/inc/Apsettingshandlerui.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,1365 @@
+/*
+* Copyright (c) 2002 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: 
+*     Declares the main handler, CApSettingsHandler and public API for the 
+*     Access Point settings.
+*
+*/
+
+
+#ifndef APSETTINGS_HANDLER_H
+#define APSETTINGS_HANDLER_H
+
+// Deprecation warning
+#warning This header file has been deprecated. Will be removed in one of the next SDK releases.
+ 
+ 
+// INCLUDES
+#include <ApSettingsHandlerCommons.h>
+#include <ApEngineConsts.h>
+#include <ApSelect.h>
+
+// CONSTANTS
+const   TUid    KUidApSettingsHandler = { 0x10008d3B };
+
+typedef struct      ///< Extra data holder
+    {
+        TInt                iResOffset;
+        TBool               iIsIpv6Supported;       // Default is NO 
+        TBool               iIsFeatureManagerInitialised;
+        TInt                iExtra;
+        TInt                iSortType;
+        TVpnFilterType      iVpnFilterType;
+        TInt                iVariant;               /// Local variant value
+        TBool               iIncludeEasyWlan;
+    }TApSetHandlerExtra;
+
+// FORWARD DECLARATIONS
+class CActiveApDb;
+class CApSelector;
+class CApSettingsModel;
+class CApSettings;
+class CTextOverrides;
+class CApAccessPointItem;
+
+class CApSettingsHandlerImpl;
+
+// CLASS DECLARATION
+/**
+* CApSettingsHandler class: It is the main handler for the Access Point 
+* settings. It contains the only public API for other (sub)systems.
+*
+*/
+class CApSettingsHandler : public CBase
+    {
+
+    public: // Constructors and destructor
+
+
+        /**
+        * Two-phased constructor. Leaves on failure.
+        * This function shall be used to create the access point 
+        * settings/selection handling UI object. It is customizable through 
+        * the parameters. This object is a small layer above the UI part and
+        * it provides a standard interface to select, edit, create access 
+        * points. It has two main parts, Select and Edit. The first parameter,
+        * aStartWithSelection gives whether we would like to select or edit.
+        * In case of selection, there is the possibility to use this module in
+        * many applications. For this, two layouts are implemented, 
+        * one is list pane used by General Settings which provides the list in
+        * a list-pane. The other layout is for the other applications 
+        * requiring access point selection, a popup-list style as the decision
+        * I know about was that General Settings will use list-pane and all
+        * other apps. popup-list style. It is the caller who selects the style
+        * so if spec. says otherwise, this module still can be used.
+        * It is also possible to start the UI without selection, so if any 
+        * module has a 'linked/default/etc.' access point and stored it's UID,
+        * the module can simply call the editor part of the UI without having
+        * to select the AP once more. In case of editing only, 
+        * (aStartWithSelection is EFalse), all other construction parameters 
+        * are ignored and after construction caller can simply call 
+        * RunSettingsL(..). In case of selection, a lot of other parameters 
+        * can be specified to fulfil all requirements. There are three types 
+        * of Options menu available: 
+        * EApSettingsSelMenuNormal, 
+        * EApSettingsSelMenuSelectOnly,
+        * EApSettingsSelMenuSelectNormal.
+        * <br>
+        *-EApSettingsSelMenuSelectOnly: Only Select is visible, 
+        *                               no way to edit, delete, create, etc.
+        * <br>
+        * -EApSettingsSelMenuNormal:    Options menu specified in General 
+        *                               Settings, contains Edit, Delete, 
+        *                               Create new, etc. menu items.
+        * <br>
+        * -EApSettingsSelMenuSelectNormal: Same as in EApSettingsSelMenuNormal
+        *                                BUT the first item is Select. 
+        *                                This one makes it possible to select 
+        *                                an access point and also possible to 
+        *                                edit, create, delete, etc.
+        * <br>
+        * The following three parameters specify the filtering and ordering 
+        * criteria for the selection list creation. First, it is possible to
+        * specify which ISP-type we are looking for. The possible values are:
+        * <br>
+        * KEApIspTypeInternetOnly:  Filter allows only access points that are
+        *                           capable of only internet access.
+        * <br>
+        * KEApIspTypeWAPOnly:       Filter allows only access points that are 
+        *                           capable of only WAP access.
+        * <br>
+        * KEApIspTypeInternetAndWAP: Filter allows only access points that are
+        *                           capable of internet AND WAP access.
+        * <br>
+        * KEApIspTypeWAPMandatory:  Filter allows only access points that are
+        *                           capable of WAP access AND contain 
+        *                           mandatory WAP settings.
+        * <br>
+        * KEApIspTypeAll:           No filtering is done for the isp-type,
+        *                           all types of access points are shown.
+        * <br>
+        * It is possible to combine them by simply adding/or-ing together 
+        * the values, filtering will be done in such a way that only access 
+        * points with the listed ISP-types will be shown. Second filtering
+        * possibility (aBearerFilter) is the desired bearer type. The possible
+        * values are the values of the TApBearerType enum type and their 
+        * combinations, as in case of the ISP type. The ordering of the list
+        * can be specified with the aSortType parameter. It can have the
+        * following values:
+        * KEApSortUidAscending:     The sorting is done according to the ID 
+        *                           of the access points in ascending order.
+        * KEApSortUidDescending:    The sorting is done according to the ID 
+        *                           of the access points in descending order.
+        * KEApSortNameAscending:    The sorting is done according to the name
+        *                           of the access points in ascending order.
+        * KEApSortNameDescending:   The sorting is done according to the name
+        *                           of the access points in descending order.
+        * Caution! The ordering values can not be combined!
+        * @param aStartWithSelection    A boolean value indicating whether to 
+        *                               select or edit an ap.
+        * @param aListType      A TSelectionListType enum indicating the 
+        *                       desired list type.
+        * @param aSelMenuType   A TSelectionMenuType enum indicating the 
+        *                       desired menu type.
+        * @param aIspTypeFilter Filtering criteria on ISP type
+        * @param aBearerFilter Filtering criteria on bearer type
+        * @param aSortType Specifies the sort order to use.
+        * @return The constructed CApSettingsHandler object.
+        *
+        * @deprecated
+        */
+        IMPORT_C static CApSettingsHandler* NewLC(
+                        TBool aStartWithSelection,
+                        TSelectionListType aListType,
+                        TSelectionMenuType aSelMenuType,
+                        TInt aIspFilter,
+                        TInt aBearerFilter,
+                        TInt aSortType
+                        );
+
+
+
+        /**
+        * Two-phased constructor. Leaves on failure.
+        * This function shall be used to create the access point 
+        * settings/selection handling UI object. It is customizable through 
+        * the parameters. This object is a small layer above the UI part and
+        * it provides a standard interface to select, edit, create 
+        * access points. It has two main parts, Select and Edit. The first 
+        * parameter, aStartWithSelection gives whether we would like to select
+        * or edit. In case of selection, there is the possibility to use this 
+        * module in many applications. For this, two layouts are implemented,
+        * one is list pane used by General Settings which provides the list 
+        * in a list-pane. The other layout is for the other applications 
+        * requiring access point selection, a popup-list style as the 
+        * decision I know about was that General Settings will use list-pane 
+        * and all other apps. popup-list style. It is the caller who selects 
+        * the style so if spec. says otherwise, this module still can be used.
+        * It is also possible to start the UI without selection, so if any 
+        * module has a 'linked/default/etc.' access point and stored it's UID,
+        * the module can simply call the editor part of the UI without having
+        * to select the AP once more.
+        * In case of editing only, (aStartWithSelection is EFalse), all other 
+        * construction parameters are ignored and after construction caller 
+        * can simply call RunSettingsL(..).
+        * In case of selection, a lot of other parameters can be specified 
+        * to fulfil all requirements. There are three types of Options menu 
+        * available: 
+        * EApSettingsSelMenuNormal, 
+        * EApSettingsSelMenuSelectOnly,
+        * EApSettingsSelMenuSelectNormal.
+        * <br>
+        *-EApSettingsSelMenuSelectOnly:     Only Select is visible, no way to
+        *                                   edit, delete, create, etc.
+        * <br>
+        * -EApSettingsSelMenuNormal:        Options menu specified in General 
+        *                                   Settings, contains Edit, Delete, 
+        *                                   Create new, etc. menu items.
+        * <br>
+        * -EApSettingsSelMenuSelectNormal:  Same as in EApSettingsSelMenuNormal
+        *                                   BUT the first item is Select. 
+        *                                   This one makes it possible to 
+        *                                   select an access point and also 
+        *                                   possible to edit, create, 
+        *                                   delete, etc.
+        * <br>
+        * The following three parameters specify the filtering and ordering 
+        * criteria for the selection list creation. First, it is possible to 
+        * specify which ISP-type we are looking for. The possible values are:
+        * <br>
+        * KEApIspTypeInternetOnly:      Filter allows only access points that
+        *                               are capable of only internet access.
+        * <br>
+        * KEApIspTypeWAPOnly:           Filter allows only access points that 
+        *                               are capable of only WAP access.
+        * <br>
+        * KEApIspTypeInternetAndWAP:    Filter allows only access points that
+        *                               are capable of internet AND WAP access.
+        * <br>
+        * KEApIspTypeWAPMandatory:      Filter allows only access points that
+        *                               are capable of WAP access AND contain
+        *                               mandatory WAP settings.
+        * <br>
+        * KEApIspTypeAll:               No filtering is done for the isp-type,
+        *                               all types of access points are shown.
+        * <br>
+        * It is possible to combine them by simply adding/or-ing together the
+        * values, filtering will be done in such a way that only access points
+        * with the listed ISP-types will be shown.
+        * Second filtering possibility (aBearerFilter) is the desired bearer 
+        * type. The possible values are the values of the TApBearerType enum 
+        * type and their combinations, as in case of the ISP type.
+        * The ordering of the list can be specified with the aSortType 
+        * parameter. It can have the following values:
+        * KEApSortUidAscending:     The sorting is done according to the ID
+        *                           of the access points in ascending order.
+        * KEApSortUidDescending:    The sorting is done according to the ID 
+        *                           of the access points in descending order.
+        * KEApSortNameAscending:    The sorting is done according to the name 
+        *                           of the access points in ascending order.
+        * KEApSortNameDescending:   The sorting is done according to the name
+        *                           of the access points in descending order.
+        * Caution! The ordering values can not be combined!
+        * @param aDb A database to work on
+        * @param aStartWithSelection A boolean value indicating whether to 
+        * select or edit an ap.
+        * @param aListType A TSelectionListType enum indicating the desired
+        * list type.
+        * @param aSelMenuType A TSelectionMenuType enum indicating the desired
+        * menu type.
+        * @param aIspTypeFilter Filtering criteria on ISP type
+        * @param aBearerFilter Filtering criteria on bearer type
+        * @param aSortType Specifies the sort order to use.
+        * @return The constructed CApSettingsHandler object.
+        *
+        * @deprecated
+        */
+        IMPORT_C static CApSettingsHandler* NewLC(
+                        CActiveApDb& aDb,
+                        TBool aStartWithSelection,
+                        TSelectionListType aListType,
+                        TSelectionMenuType aSelMenuType,
+                        TInt aIspFilter,
+                        TInt aBearerFilter,
+                        TInt aSortType
+                        );
+
+
+
+
+
+
+
+
+        /**
+        * Two-phased constructor. Leaves on failure.
+        * This function shall be used to create the access point 
+        * settings/selection handling UI object.It is customizable through the
+        * parameters. This object is a small layer above the UI part and
+        * it provides a standard interface to select, edit, create access 
+        * points. It has two main parts, Select and Edit. The first parameter, 
+        * aStartWithSelection gives whether we would like to select or edit.
+        * In case of selection, there is the possibility to use this module in
+        * many applications. For this, two layouts are implemented, one is 
+        * list pane used by General Settings which provides the list in a 
+        * list-pane. The other layout is for the other applications requiring 
+        * access point selection, a popup-list style as the decision was that 
+        * General Settings will use list-pane and all other apps. popup-list 
+        * style. It is the caller who selects the style so if spec. says 
+        * otherwise, this module still can be used.
+        * It is also possible to start the UI without selection, so if any 
+        * module has a 'linked/default/etc.' access point and stored it's UID,
+        * the module can simply call the editor part of the UI without having
+        * to select the AP once more.
+        * In case of editing only, (aStartWithSelection is EFalse), all other 
+        * construction parameters are ignored and after construction caller 
+        * can simply call RunSettingsL(..).
+        * In case of selection, a lot of other parameters can be specified to
+        * fulfil all requirements. There are three types of Options menu 
+        * available: EApSettingsSelMenuNormal, EApSettingsSelMenuSelectOnly,
+        * EApSettingsSelMenuSelectNormal.
+        * <br>
+        *-EApSettingsSelMenuSelectOnly: Only Select is visible, no way to edit,
+        *   delete, create, etc.
+        * <br>
+        * -EApSettingsSelMenuNormal:Options menu specified in General Settings,
+        *   contains Edit, Delete, Create new, etc. menu items.
+        * <br>
+        * -EApSettingsSelMenuSelectNormal: Same as in EApSettingsSelMenuNormal 
+        *   BUT the first item is Select. This one makes it possible to select 
+        *   an access point and also possible to edit, create, delete, etc.
+        * <br>
+        * The following three parameters specify the filtering and ordering 
+        * criteria for the selection list creation. First, it is possible to 
+        * specify which ISP-type we are looking for. The possible values are:
+        * <br>
+        * KEApIspTypeInternetOnly: Filter allows only access points that are 
+        *   capable of only internet access.
+        * <br>
+        * KEApIspTypeWAPOnly: Filter allows only access points that are 
+        *   capable of only WAP access.
+        * <br>
+        * KEApIspTypeInternetAndWAP: Filter allows only access points that are 
+        *   capable of internet AND WAP access.
+        * <br>
+        * KEApIspTypeWAPMandatory: Filter allows only access points that are 
+        *   capable of WAP access AND contain mandatory WAP settings.
+        * <br>
+        * KEApIspTypeAll: No filtering is done for the isp-type, all types of
+        *   access points are shown.
+        * <br>
+        * It is possible to combine them by simply adding/or-ing together the 
+        * values, filtering will be done in such a way that only access points 
+        * with the listed ISP-types will be shown.
+        * Second filtering possibility (aBearerFilter) is the desired bearer 
+        * type. The possible values are the values of the TApBearerType enum 
+        * type and their combinations, as in case of the ISP type.
+        * The ordering of the list can be specified with the aSortType 
+        * parameter. It can have the following values:
+        * KEApSortUidAscending: The sorting is done according to the ID of 
+        *   the access points in ascending order.
+        * KEApSortUidDescending: The sorting is done according to the ID of 
+        *   the access points in descending order.
+        * KEApSortNameAscending: The sorting is done according to the name of 
+        *   the access points in ascending order.
+        * KEApSortNameDescending: The sorting is done according to the name of 
+        *   the access points in descending order.
+        * Caution! The ordering values can not be combined!
+        * @param aStartWithSelection A boolean value indicating whether to 
+        *   select or edit an ap.
+        * @param aListType A TSelectionListType enum indicating the desired
+        *   list type.
+        * @param aSelMenuType A TSelectionMenuType enum indicating the desired
+        *   menu type.
+        * @param aIspTypeFilter Filtering criteria on ISP type
+        * @param aBearerFilter Filtering criteria on bearer type
+        * @param aSortType Specifies the sort order to use.
+        * @param aReqIpvType Specifies whether the caller would like to 
+        *   have IPv4, IPv6 or both access points. If it is IPv6 or Both, 
+        *   in case of IPv6 support is available as a feature, it will be 
+        *   supported. If IPv6 feature is not supported by the phone, it 
+        *   simply defaults to the normal IPv4 version.
+        *   If it is IPv4, it uses the default IPv4 version independently 
+        *   from IPv6 feature beeing available or not.
+        * @return The constructed CApSettingsHandler object.
+        *
+        * @deprecated
+        */
+        IMPORT_C static CApSettingsHandler* NewLC(
+                        TBool aStartWithSelection,
+                        TSelectionListType aListType,
+                        TSelectionMenuType aSelMenuType,
+                        TInt aIspFilter,
+                        TInt aBearerFilter,
+                        TInt aSortType,
+                        TInt aReqIpvType
+                        );
+
+
+
+        /**
+        * Two-phased constructor. Leaves on failure.
+        * This function shall be used to create the access point 
+        * settings/selection handling UI object. It is customizable through 
+        * the parameters. This object is a small layer above the UI part and
+        * it provides a standard interface to select, edit, create access 
+        * points. It has two main parts, Select and Edit. The first parameter,
+        * aStartWithSelection gives whether we would like to select or edit.
+        * In case of selection, there is the possibility to use this module in
+        * many applications. For this, two layouts are implemented, one is list
+        * pane used by General Settings which provides the list in a list-pane.
+        * The other layout is for the other applications requiring access point
+        * selection, a popup-list style as the decision was that General 
+        * Settings will use list-pane and all other apps. popup-list style. 
+        * It is the caller who selects the style so if spec. says otherwise,
+        * this module still can be used. It is also possible to start the UI 
+        * without selection, so if any module has a 'linked/default/etc.'
+        * access point and stored it's UID, the module can simply call the 
+        * editor part of the UI without having to select the AP once more.
+        * In case of editing only, (aStartWithSelection is EFalse), all other 
+        * construction parameters are ignored and after construction caller can
+        * simply call RunSettingsL(..). In case of selection, a lot of other
+        * parameters can be specified to fulfil all requirements. There are 
+        * three types of Options menu available: EApSettingsSelMenuNormal, 
+        * EApSettingsSelMenuSelectOnly, EApSettingsSelMenuSelectNormal.
+        * <br>
+        *-EApSettingsSelMenuSelectOnly: Only Select is visible, no way to edit,
+        *   delete, create, etc.
+        * <br>
+        * -EApSettingsSelMenuNormal:Options menu specified in General Settings,
+        *   contains Edit, Delete, Create new, etc. menu items.
+        * <br>
+        * -EApSettingsSelMenuSelectNormal: Same as in EApSettingsSelMenuNormal 
+        *   BUT the first item is Select. This one makes it possible to select
+        *   an access point and also possible to edit, create, delete, etc.
+        * <br>
+        * The following three parameters specify the filtering and ordering
+        * criteria for the selection list creation. First, it is possible to 
+        * specify which ISP-type we are looking for. The possible values are:
+        * <br>
+        * KEApIspTypeInternetOnly: Filter allows only access points that are 
+        *   capable of only internet access.
+        * <br>
+        * KEApIspTypeWAPOnly: Filter allows only access points that are 
+        *   capable of only WAP access.
+        * <br>
+        * KEApIspTypeInternetAndWAP: Filter allows only access points that are 
+        *   capable of internet AND WAP access.
+        * <br>
+        * KEApIspTypeWAPMandatory: Filter allows only access points that are 
+        *   capable of WAP access AND contain mandatory WAP settings.
+        * <br>
+        * KEApIspTypeAll: No filtering is done for the isp-type, all types of
+        *   access points are shown.
+        * <br>
+        * It is possible to combine them by simply adding/or-ing together the
+        * values, filtering will be done in such a way that only access points
+        * with the listed ISP-types will be shown. Second filtering possibility
+        * (aBearerFilter) is the desired bearer type. The possible values are 
+        * the values of the TApBearerType enum type and their combinations, as
+        * in case of the ISP type. The ordering of the list can be specified 
+        * with the aSortType parameter. It can have the following values:
+        * KEApSortUidAscending: The sorting is done according to the ID of 
+        *   the access points in ascending order.
+        * KEApSortUidDescending: The sorting is done according to the ID of 
+        *   the access points in descending order.
+        * KEApSortNameAscending: The sorting is done according to the name of
+        *   the access points in ascending order.
+        * KEApSortNameDescending: The sorting is done according to the name of
+        *   the access points in descending order.
+        * Caution! The ordering values can not be combined!
+        * @param aDb A database to work on
+        * @param aStartWithSelection A boolean value indicating whether to 
+        *   select or edit an ap.
+        * @param aListType A TSelectionListType enum indicating the desired
+        *   list type.
+        * @param aSelMenuType A TSelectionMenuType enum indicating the desired
+        *   menu type.
+        * @param aIspTypeFilter Filtering criteria on ISP type
+        * @param aBearerFilter Filtering criteria on bearer type
+        * @param aSortType Specifies the sort order to use.
+        * @param aReqIpvType Specifies whether the caller would like to 
+        *   have IPv4, IPv6 or both access points. If it is IPv6 or Both, 
+        *   in case of IPv6 support is available as a feature, it will be 
+        *   supported. If IPv6 feature is not supported by the phone, it 
+        *   simply defaults to the normal IPv4 version.
+        *   If it is IPv4, it uses the default IPv4 version independently 
+        *   from IPv6 feature beeing available or not.
+        * @return The constructed CApSettingsHandler object.
+        *
+        * @deprecated
+        */
+        IMPORT_C static CApSettingsHandler* NewLC(
+                        CActiveApDb& aDb,
+                        TBool aStartWithSelection,
+                        TSelectionListType aListType,
+                        TSelectionMenuType aSelMenuType,
+                        TInt aIspFilter,
+                        TInt aBearerFilter,
+                        TInt aSortType,
+                        TInt aReqIpvType
+                        );
+
+
+
+
+        /**
+        * Two-phased constructor. Leaves on failure.
+        * This function shall be used to create the access point 
+        * settings/selection handling UI object.It is customizable through the
+        * parameters. This object is a small layer above the UI part and
+        * it provides a standard interface to select, edit, create access 
+        * points. It has two main parts, Select and Edit. The first parameter, 
+        * aStartWithSelection gives whether we would like to select or edit.
+        * In case of selection, there is the possibility to use this module in
+        * many applications. For this, two layouts are implemented, one is 
+        * list pane used by General Settings which provides the list in a 
+        * list-pane. The other layout is for the other applications requiring 
+        * access point selection, a popup-list style as the decision was that 
+        * General Settings will use list-pane and all other apps. popup-list 
+        * style. It is the caller who selects the style so if spec. says 
+        * otherwise, this module still can be used.
+        * It is also possible to start the UI without selection, so if any 
+        * module has a 'linked/default/etc.' access point and stored it's UID,
+        * the module can simply call the editor part of the UI without having
+        * to select the AP once more.
+        * In case of editing only, (aStartWithSelection is EFalse), all other 
+        * construction parameters are ignored and after construction caller 
+        * can simply call RunSettingsL(..).
+        * In case of selection, a lot of other parameters can be specified to
+        * fulfil all requirements. There are three types of Options menu 
+        * available: EApSettingsSelMenuNormal, EApSettingsSelMenuSelectOnly,
+        * EApSettingsSelMenuSelectNormal.
+        * <br>
+        *-EApSettingsSelMenuSelectOnly: Only Select is visible, no way to edit,
+        *   delete, create, etc.
+        * <br>
+        * -EApSettingsSelMenuNormal:Options menu specified in General Settings,
+        *   contains Edit, Delete, Create new, etc. menu items.
+        * <br>
+        * -EApSettingsSelMenuSelectNormal: Same as in EApSettingsSelMenuNormal 
+        *   BUT the first item is Select. This one makes it possible to select 
+        *   an access point and also possible to edit, create, delete, etc.
+        * <br>
+        * The following three parameters specify the filtering and ordering 
+        * criteria for the selection list creation. First, it is possible to 
+        * specify which ISP-type we are looking for. The possible values are:
+        * <br>
+        * KEApIspTypeInternetOnly: Filter allows only access points that are 
+        *   capable of only internet access.
+        * <br>
+        * KEApIspTypeWAPOnly: Filter allows only access points that are 
+        *   capable of only WAP access.
+        * <br>
+        * KEApIspTypeInternetAndWAP: Filter allows only access points that are 
+        *   capable of internet AND WAP access.
+        * <br>
+        * KEApIspTypeWAPMandatory: Filter allows only access points that are 
+        *   capable of WAP access AND contain mandatory WAP settings.
+        * <br>
+        * KEApIspTypeAll: No filtering is done for the isp-type, all types of
+        *   access points are shown.
+        * <br>
+        * It is possible to combine them by simply adding/or-ing together the 
+        * values, filtering will be done in such a way that only access points 
+        * with the listed ISP-types will be shown.
+        * Second filtering possibility (aBearerFilter) is the desired bearer 
+        * type. The possible values are the values of the TApBearerType enum 
+        * type and their combinations, as in case of the ISP type.
+        * The ordering of the list can be specified with the aSortType 
+        * parameter. It can have the following values:
+        * KEApSortUidAscending: The sorting is done according to the ID of 
+        *   the access points in ascending order.
+        * KEApSortUidDescending: The sorting is done according to the ID of 
+        *   the access points in descending order.
+        * KEApSortNameAscending: The sorting is done according to the name of 
+        *   the access points in ascending order.
+        * KEApSortNameDescending: The sorting is done according to the name of 
+        *   the access points in descending order.
+        * Caution! The ordering values can not be combined!
+        * @param aStartWithSelection A boolean value indicating whether to 
+        *   select or edit an ap.
+        * @param aListType A TSelectionListType enum indicating the desired
+        *   list type.
+        * @param aSelMenuType A TSelectionMenuType enum indicating the desired
+        *   menu type.
+        * @param aIspTypeFilter Filtering criteria on ISP type
+        * @param aBearerFilter Filtering criteria on bearer type
+        * @param aSortType Specifies the sort order to use.
+        * @param aReqIpvType Specifies whether the caller would like to 
+        *   have IPv4, IPv6 or both access points. If it is IPv6 or Both, 
+        *   in case of IPv6 support is available as a feature, it will be 
+        *   supported. If IPv6 feature is not supported by the phone, it 
+        *   simply defaults to the normal IPv4 version.
+        *   If it is IPv4, it uses the default IPv4 version independently 
+        *   from IPv6 feature beeing available or not.
+        * @param aVpnFilterType a TVpnFilterType representing the possible 
+        *   additional VPN filtering.
+        * @return The constructed CApSettingsHandler object.
+        *
+        * @deprecated
+        */
+        IMPORT_C static CApSettingsHandler* NewLC(
+                        TBool aStartWithSelection,
+                        TSelectionListType aListType,
+                        TSelectionMenuType aSelMenuType,
+                        TInt aIspFilter,
+                        TInt aBearerFilter,
+                        TInt aSortType,
+                        TInt aReqIpvType,
+                        TVpnFilterType aVpnFilterType
+                        );
+
+
+
+        /**
+        * Two-phased constructor. Leaves on failure.
+        * This function shall be used to create the access point 
+        * settings/selection handling UI object. It is customizable through 
+        * the parameters. This object is a small layer above the UI part and
+        * it provides a standard interface to select, edit, create access 
+        * points. It has two main parts, Select and Edit. The first parameter,
+        * aStartWithSelection gives whether we would like to select or edit.
+        * In case of selection, there is the possibility to use this module in
+        * many applications. For this, two layouts are implemented, one is list
+        * pane used by General Settings which provides the list in a list-pane.
+        * The other layout is for the other applications requiring access point
+        * selection, a popup-list style as the decision was that General 
+        * Settings will use list-pane and all other apps. popup-list style. 
+        * It is the caller who selects the style so if spec. says otherwise,
+        * this module still can be used. It is also possible to start the UI 
+        * without selection, so if any module has a 'linked/default/etc.'
+        * access point and stored it's UID, the module can simply call the 
+        * editor part of the UI without having to select the AP once more.
+        * In case of editing only, (aStartWithSelection is EFalse), all other 
+        * construction parameters are ignored and after construction caller can
+        * simply call RunSettingsL(..). In case of selection, a lot of other
+        * parameters can be specified to fulfil all requirements. There are 
+        * three types of Options menu available: EApSettingsSelMenuNormal, 
+        * EApSettingsSelMenuSelectOnly, EApSettingsSelMenuSelectNormal.
+        * <br>
+        *-EApSettingsSelMenuSelectOnly: Only Select is visible, no way to edit,
+        *   delete, create, etc.
+        * <br>
+        * -EApSettingsSelMenuNormal:Options menu specified in General Settings,
+        *   contains Edit, Delete, Create new, etc. menu items.
+        * <br>
+        * -EApSettingsSelMenuSelectNormal: Same as in EApSettingsSelMenuNormal 
+        *   BUT the first item is Select. This one makes it possible to select
+        *   an access point and also possible to edit, create, delete, etc.
+        * <br>
+        * The following three parameters specify the filtering and ordering
+        * criteria for the selection list creation. First, it is possible to 
+        * specify which ISP-type we are looking for. The possible values are:
+        * <br>
+        * KEApIspTypeInternetOnly: Filter allows only access points that are 
+        *   capable of only internet access.
+        * <br>
+        * KEApIspTypeWAPOnly: Filter allows only access points that are 
+        *   capable of only WAP access.
+        * <br>
+        * KEApIspTypeInternetAndWAP: Filter allows only access points that are 
+        *   capable of internet AND WAP access.
+        * <br>
+        * KEApIspTypeWAPMandatory: Filter allows only access points that are 
+        *   capable of WAP access AND contain mandatory WAP settings.
+        * <br>
+        * KEApIspTypeAll: No filtering is done for the isp-type, all types of
+        *   access points are shown.
+        * <br>
+        * It is possible to combine them by simply adding/or-ing together the
+        * values, filtering will be done in such a way that only access points
+        * with the listed ISP-types will be shown. Second filtering possibility
+        * (aBearerFilter) is the desired bearer type. The possible values are 
+        * the values of the TApBearerType enum type and their combinations, as
+        * in case of the ISP type. The ordering of the list can be specified 
+        * with the aSortType parameter. It can have the following values:
+        * KEApSortUidAscending: The sorting is done according to the ID of 
+        *   the access points in ascending order.
+        * KEApSortUidDescending: The sorting is done according to the ID of 
+        *   the access points in descending order.
+        * KEApSortNameAscending: The sorting is done according to the name of
+        *   the access points in ascending order.
+        * KEApSortNameDescending: The sorting is done according to the name of
+        *   the access points in descending order.
+        * Caution! The ordering values can not be combined!
+        * @param aDb A database to work on
+        * @param aStartWithSelection A boolean value indicating whether to 
+        *   select or edit an ap.
+        * @param aListType A TSelectionListType enum indicating the desired
+        *   list type.
+        * @param aSelMenuType A TSelectionMenuType enum indicating the desired
+        *   menu type.
+        * @param aIspTypeFilter Filtering criteria on ISP type
+        * @param aBearerFilter Filtering criteria on bearer type
+        * @param aSortType Specifies the sort order to use.
+        * @param aReqIpvType Specifies whether the caller would like to 
+        *   have IPv4, IPv6 or both access points. If it is IPv6 or Both, 
+        *   in case of IPv6 support is available as a feature, it will be 
+        *   supported. If IPv6 feature is not supported by the phone, it 
+        *   simply defaults to the normal IPv4 version.
+        *   If it is IPv4, it uses the default IPv4 version independently 
+        *   from IPv6 feature beeing available or not.
+        * @param aVpnFilterType a TVpnFilterType representing the possible 
+        *   additional VPN filtering.
+        * @return The constructed CApSettingsHandler object.
+        *
+        * @deprecated
+        */
+        IMPORT_C static CApSettingsHandler* NewLC(
+                        CActiveApDb& aDb,
+                        TBool aStartWithSelection,
+                        TSelectionListType aListType,
+                        TSelectionMenuType aSelMenuType,
+                        TInt aIspFilter,
+                        TInt aBearerFilter,
+                        TInt aSortType,
+                        TInt aReqIpvType,
+                        TVpnFilterType aVpnFilterType
+                        );
+
+
+
+
+
+        /**
+        * Two-phased constructor. Leaves on failure.
+        * This function shall be used to create the access point 
+        * settings/selection handling UI object. It is customizable through 
+        * the parameters. This object is a small layer above the UI part and
+        * it provides a standard interface to select, edit, create access 
+        * points. It has two main parts, Select and Edit. The first parameter,
+        * aStartWithSelection gives whether we would like to select or edit.
+        * In case of selection, there is the possibility to use this module in
+        * many applications. For this, two layouts are implemented, one is list
+        * pane used by General Settings which provides the list in a list-pane.
+        * The other layout is for the other applications requiring access point
+        * selection, a popup-list style as the decision was that General 
+        * Settings will use list-pane and all other apps. popup-list style. 
+        * It is the caller who selects the style so if spec. says otherwise,
+        * this module still can be used. It is also possible to start the UI 
+        * without selection, so if any module has a 'linked/default/etc.'
+        * access point and stored it's UID, the module can simply call the 
+        * editor part of the UI without having to select the AP once more.
+        * In case of editing only, (aStartWithSelection is EFalse), all other 
+        * construction parameters are ignored and after construction caller can
+        * simply call RunSettingsL(..). In case of selection, a lot of other
+        * parameters can be specified to fulfil all requirements. There are 
+        * three types of Options menu available: EApSettingsSelMenuNormal, 
+        * EApSettingsSelMenuSelectOnly, EApSettingsSelMenuSelectNormal.
+        * <br>
+        *-EApSettingsSelMenuSelectOnly: Only Select is visible, no way to edit,
+        *   delete, create, etc.
+        * <br>
+        * -EApSettingsSelMenuNormal:Options menu specified in General Settings,
+        *   contains Edit, Delete, Create new, etc. menu items.
+        * <br>
+        * -EApSettingsSelMenuSelectNormal: Same as in EApSettingsSelMenuNormal 
+        *   BUT the first item is Select. This one makes it possible to select
+        *   an access point and also possible to edit, create, delete, etc.
+        * <br>
+        * The following three parameters specify the filtering and ordering
+        * criteria for the selection list creation. First, it is possible to 
+        * specify which ISP-type we are looking for. The possible values are:
+        * <br>
+        * KEApIspTypeInternetOnly: Filter allows only access points that are 
+        *   capable of only internet access.
+        * <br>
+        * KEApIspTypeWAPOnly: Filter allows only access points that are 
+        *   capable of only WAP access.
+        * <br>
+        * KEApIspTypeInternetAndWAP: Filter allows only access points that are 
+        *   capable of internet AND WAP access.
+        * <br>
+        * KEApIspTypeWAPMandatory: Filter allows only access points that are 
+        *   capable of WAP access AND contain mandatory WAP settings.
+        * <br>
+        * KEApIspTypeAll: No filtering is done for the isp-type, all types of
+        *   access points are shown.
+        * <br>
+        * It is possible to combine them by simply adding/or-ing together the
+        * values, filtering will be done in such a way that only access points
+        * with the listed ISP-types will be shown. Second filtering possibility
+        * (aBearerFilter) is the desired bearer type. The possible values are 
+        * the values of the TApBearerType enum type and their combinations, as
+        * in case of the ISP type. The ordering of the list can be specified 
+        * with the aSortType parameter. It can have the following values:
+        * KEApSortUidAscending: The sorting is done according to the ID of 
+        *   the access points in ascending order.
+        * KEApSortUidDescending: The sorting is done according to the ID of 
+        *   the access points in descending order.
+        * KEApSortNameAscending: The sorting is done according to the name of
+        *   the access points in ascending order.
+        * KEApSortNameDescending: The sorting is done according to the name of
+        *   the access points in descending order.
+        * Caution! The ordering values can not be combined!
+        * @param aDb A database to work on
+        * @param aStartWithSelection A boolean value indicating whether to 
+        *   select or edit an ap.
+        * @param aListType A TSelectionListType enum indicating the desired
+        *   list type.
+        * @param aSelMenuType A TSelectionMenuType enum indicating the desired
+        *   menu type.
+        * @param aIspTypeFilter Filtering criteria on ISP type
+        * @param aBearerFilter Filtering criteria on bearer type
+        * @param aSortType Specifies the sort order to use.
+        * @param aReqIpvType Specifies whether the caller would like to 
+        *   have IPv4, IPv6 or both access points. If it is IPv6 or Both, 
+        *   in case of IPv6 support is available as a feature, it will be 
+        *   supported. If IPv6 feature is not supported by the phone, it 
+        *   simply defaults to the normal IPv4 version.
+        *   If it is IPv4, it uses the default IPv4 version independently 
+        *   from IPv6 feature beeing available or not.
+        * @param aVpnFilterType a TVpnFilterType representing the possible 
+        *   additional VPN filtering.
+        * @param aIncludeEasyWlan a TBool indicating whether it should 
+        *   include the easy wlan AP in the list or not.
+        * @return The constructed CApSettingsHandler object.
+        *
+        * @deprecated
+        */
+        IMPORT_C static CApSettingsHandler* NewLC(
+                        CActiveApDb& aDb,
+                        TBool aStartWithSelection,
+                        TSelectionListType aListType,
+                        TSelectionMenuType aSelMenuType,
+                        TInt aIspFilter,
+                        TInt aBearerFilter,
+                        TInt aSortType,
+                        TInt aReqIpvType,
+                        TVpnFilterType aVpnFilterType,
+                        TBool aIncludeEasyWlan
+                        );
+
+
+
+
+        /**
+        * Destructor.
+        *
+        * @deprecated
+        */
+        IMPORT_C ~CApSettingsHandler();
+
+
+    protected:
+        /**
+        * Constructor.
+        * @param aStartWithSelection A boolean value indicating whether to 
+        *   select or edit an ap.
+        * @param aListType A TSelectionListType enum indicating the desired
+        *   list type.
+        * @param aSelMenuType A TSelectionMenuType enum indicating the desired
+        *   menu type.
+        *
+        * @deprecated
+        */
+        IMPORT_C CApSettingsHandler(
+                                    TBool aStartWithSelection,
+                                    TSelectionListType aListType,
+                                    TSelectionMenuType aSelMenuType
+                                    );
+
+        /**
+        * Constructor.
+        * @param aStartWithSelection A boolean value indicating whether to 
+        *   select or edit an ap.
+        * @param aListType A TSelectionListType enum indicating the desired
+        *   list type.
+        * @param aSelMenuType A TSelectionMenuType enum indicating the desired
+        *   menu type.
+        * @param aHelpMajor Major help ID
+        *
+        * @deprecated
+        */
+        IMPORT_C CApSettingsHandler(
+                                    TBool aStartWithSelection,
+                                    TSelectionListType aListType,
+                                    TSelectionMenuType aSelMenuType,
+                                    TUid aHelpMajor
+                                    );
+
+
+        /**
+        * Constructor.
+        * @param aStartWithSelection A boolean value indicating whether to 
+        *   select or edit an ap.
+        * @param aListType A TSelectionListType enum indicating the desired
+        *   list type.
+        * @param aSelMenuType A TSelectionMenuType enum indicating the desired
+        *   menu type.
+        * @param aNeedIpv6Support Whether IPv6 is supported or not
+        */
+        CApSettingsHandler(
+                            TBool aStartWithSelection,
+                            TSelectionListType aListType,
+                            TSelectionMenuType aSelMenuType,
+                            TBool aNeedIpv6Support
+                            );
+
+
+
+        /**
+        * Second-phase constructor.
+        * @param aIspTypeFilter Filtering criteria on ISP type
+        * @param aBearerFilter Filtering criteria on bearer type
+        * @param aSortType Specifies the sort order to use.
+        *
+        * @deprecated
+        */
+        IMPORT_C void ConstructL(
+                                TInt aIspFilter,
+                                TInt aBearerFilter,
+                                TInt aSortType
+                                );
+
+
+        /**
+        * Second-phase constructor.
+        * @param aDb A database to work on
+        * @param aIspTypeFilter Filtering criteria on ISP type
+        * @param aBearerFilter Filtering criteria on bearer type
+        * @param aSortType Specifies the sort order to use.
+        *
+        * @deprecated
+        */
+        IMPORT_C void ConstructL(
+                                CActiveApDb& aDb,
+                                TInt aIspFilter,
+                                TInt aBearerFilter,
+                                TInt aSortType
+                                );
+
+
+        /**
+        * Second-phase constructor.
+        * @param aIspTypeFilter Filtering criteria on ISP type
+        * @param aBearerFilter Filtering criteria on bearer type
+        * @param aSortType Specifies the sort order to use.
+        * @param aVpnFilterType a TVpnFilterType representing the possible 
+        *   additional VPN filtering.
+        *
+        * @deprecated
+        */
+        IMPORT_C void ConstructL(
+                                TInt aIspFilter,
+                                TInt aBearerFilter,
+                                TInt aSortType,
+                                TVpnFilterType aVpnFilterType
+                                );
+
+
+        /**
+        * Second-phase constructor.
+        * @param aDb A database to work on
+        * @param aIspTypeFilter Filtering criteria on ISP type
+        * @param aBearerFilter Filtering criteria on bearer type
+        * @param aSortType Specifies the sort order to use.
+        * @param aVpnFilterType a TVpnFilterType representing the possible 
+        *   additional VPN filtering.
+        *
+        * @deprecated
+        */
+        IMPORT_C void ConstructL(
+                                CActiveApDb& aDb,
+                                TInt aIspFilter,
+                                TInt aBearerFilter,
+                                TInt aSortType,
+                                TVpnFilterType aVpnFilterType
+                                );
+
+
+
+
+        /**
+        * Second-phase constructor.
+        * @param aDb A database to work on
+        * @param aIspTypeFilter Filtering criteria on ISP type
+        * @param aBearerFilter Filtering criteria on bearer type
+        * @param aSortType Specifies the sort order to use.
+        * @param aVpnFilterType a TVpnFilterType representing the possible 
+        *   additional VPN filtering.
+        * @param aIncludeEasyWlan a TBool indicating whether it should 
+        *   include the easy wlan AP in the list or not.
+        *
+        * @deprecated
+        */
+        IMPORT_C void ConstructL(
+                                CActiveApDb& aDb,
+                                TInt aIspFilter,
+                                TInt aBearerFilter,
+                                TInt aSortType,
+                                TVpnFilterType aVpnFilterType,
+                                TBool aIncludeEasyWlan
+                                );
+
+
+    public: // New functions
+        /**
+        * Sets the filtering used in the access point selection.
+        * @param aIspTypeFilter Filtering criteria on ISP type
+        * @param aBearerFilter Filtering criteria on bearer type
+        * @param aSortType Specifies the sort order to use.
+        * @return No return value. Leaves on error.
+        *
+        * @deprecated
+        */
+        IMPORT_C void SetFilterL(
+                                TInt aIspFilter,
+                                TInt aBearerFilter,
+                                TInt aSortType
+                                );
+
+
+        /**
+        * Sets possible overrides of some texts.
+        * By default, text is read from resources. This provides a way to 
+        * change some of the text to a caller-supplied one. The text must 
+        * be read from resource and must be already localized.
+        * More than one text can be substituted, they are stored internally
+        * in an array.
+        * Currently not supported and supporting it is under discussion.
+        * @param aText2Change TTextID to identify the text to be replaced with
+        * @param aNewText Reference to the substitute text.
+        *
+        * @deprecated
+        */
+        IMPORT_C void SetTextOverrideL( TTextID aText2Change, 
+                                        const TDesC& aNewText );
+
+
+        /**
+        * Gets possible overrides of a text.
+        * By default, text is read from resources. This provides a way to 
+        * change some of the text to a caller-supplied one. The text must
+        * be read from resource and must be already localized.
+        * More than one text can be substituted, they are stored internally
+        * in an array.
+        * Currently not supported and supporting it is under discussion
+        * @param aTextID TTextID type to identify the text to be replaced with
+        * @return Reference to the substitute text.
+        *
+        * @deprecated
+        */
+        IMPORT_C const TDesC& TextOverrideL( TTextID aTextId );
+
+
+        /**
+        * Starts the settings component.
+        * Creates dialog(s) from scratch, launches and executes them.
+        * Can leave with error codes.
+        * @param TUint32 aHighlight The UID of the AP to highlight by default
+        * @param TUint32 aSelected The UID of the access point selected 
+        * by the user.
+        * @return The accomplished task's flag-codes:
+        * <br>
+        * KApUiEventNone,
+        * <br>
+        * KApUiEventSelected,
+        * <br>
+        * KApUiEventCreatedBlank,
+        * <br>
+        * KApUiEventCreatedUsedOld,
+        * <br>
+        * KApUiEventEdited,
+        * <br>
+        * KApUiEventDeleted,
+        * <br>
+        * KApUiEventExitRequested
+        * <br>and their combinations. ( Bitwise OR )
+        * <br>
+        * aSelected will be modified only if KApUiEventSelected is included 
+        * in the flags.
+        * <br>
+        * In case it returns KApUiEventExitRequested, the user had choosen
+        * the Exit option from the Options menu which means
+        * that the caller application MUST exit!
+        * <br>
+        * Returns after completion!
+        *
+        * @deprecated
+        */
+        IMPORT_C TInt RunSettingsL( TUint32 aHighLight, TUint32& aSelected );
+
+
+        /**
+        * Component Validation Test.
+        * @return KErrNone.
+        *
+        * @deprecated
+        */
+        IMPORT_C static TInt Cvt();
+
+
+    protected:  // New functions
+        /**
+        * @Deprecated
+        * Starts the settings component.
+        * Creates dialog(s) from scratch, launches and executes them.
+        * In case of error, leaves with error codes.
+        * @param TUint32 aHighlight The UID of the AP to highlight by default
+        * @param TUint32 aSelected The UID of the AP selected by the user
+        * @return The accomplished task's flag-codes:
+        * <br>
+        * KApUiEventNone,
+        * <br>
+        * KApUiEventSelected,
+        * <br>
+        * KApUiEventCreatedBlank,
+        * <br>
+        * KApUiEventCreatedUsedOld,
+        * <br>
+        * KApUiEventEdited,
+        * <br>
+        * KApUiEventDeleted
+        * <br>
+        * and their combinations. ( Bitwise OR )
+        * <br>
+        * aSelected will be modified only if KApUiEventSelected is included 
+        * in the flags.
+        * <br>
+        * Returns after completion!
+        */
+        TInt DoRunSettingsL( TUint32 aHighLight, TUint32& aSelected );
+
+
+        /**
+        * Starts the viewer component.
+        * Creates dialog(s) from scratch, launches and executes it.
+        * In case of error, leaves with error codes.
+        * @param TUint32 aUid The UID of the AP to view/edit
+        * @return Returns the completed task's flags
+        * KApUiEventNone, KApUiEventSelected, KApUiEventCreatedBlank,
+        * KApUiEventCreatedUsedOld, KApUiEventEdited, KApUiEventDeleted,
+        * KApUiEventExitRequested and their combinations. ( Bitwise OR )
+        * In case it returns KApUiEventExitRequested, the user had choosen
+        * the Exit option from the Options menu which means
+        * that the caller application MUST exit!
+        * <br>
+        * Returns after completion!
+        *
+        * @deprecated
+        */
+        IMPORT_C TInt RunViewerL( TUint32 aUid );
+
+
+        /**
+        * @Deprecated
+        * Starts the viewer component.
+        * Creates dialog(s) from scratch, launches and executes it.
+        * In case of error, leaves with error codes.
+        * @param TUint32 aUid The UID of the AP to view/edit
+        * @return Returns the completed task's flags
+        * KApUiEventNone, KApUiEventSelected, KApUiEventCreatedBlank,
+        * KApUiEventCreatedUsedOld, KApUiEventEdited, KApUiEventDeleted,
+        * KApUiEventExitRequested and their combinations. ( Bitwise OR )
+        * Returns after completion!
+        */
+        TInt DoRunViewerL( TUint32 aUid );
+
+
+        // handles the Delete access Point command.
+        // @Deprecated
+        void HandleApDeleteCmdL( TUint32 aUid, TBool aIsLast );
+
+
+        // handles the Create blank new access Point command.
+        // @Deprecated
+        TUint32 HandleApBlankNewL( TInt aBearers, TInt aIsps );
+
+
+        // handles the Create new access Point by using existing one command.
+        // @Deprecated
+        TUint32 HandleApUseOldNewL();
+
+
+        // handles the Editing of the newly created access Point.
+        // @Deprecated
+        TUint32 EditAfterCreateL( TUint32 aUid, 
+                                  CApAccessPointItem* aItem = NULL );
+
+
+        /**
+        * Second-phase internal constructor.
+        * @param aDb A database to work on
+        * @param aIspTypeFilter Filtering criteria on ISP type
+        * @param aBearerFilter Filtering criteria on bearer type
+        * @param aSortType Specifies the sort order to use.
+        * @param aVpnFilterType a TVpnFilterType representing the possible 
+        *   additional VPN filtering.
+        * @param aIncludeEasyWlan a TBool indicating whether it should 
+        *   include the easy wlan AP in the list or not.
+        */
+        void DoConstructL( CActiveApDb* aDb, TInt aIspFilter,
+                           TInt aBearerFilter, TInt aSortType,
+                           TVpnFilterType aVpnFilterType,
+                           TBool aIncludeEasyWlan );
+
+
+        /**
+        * @Deprecated
+        * Starts the selector component as a list
+        * Creates dialog(s) from scratch, launches and executes them.
+        * In case of error, leaves with error codes.
+        * @param TUint32 aHighlight The UID of the AP to highlight by default
+        * @param TUint32 aSelected The UID of the AP selected by the user
+        * @return The accomplished task's flag-codes:
+        * <br>
+        * KApUiEventNone,
+        * <br>
+        * KApUiEventSelected,
+        * <br>
+        * KApUiEventCreatedBlank,
+        * <br>
+        * KApUiEventCreatedUsedOld,
+        * <br>
+        * KApUiEventEdited,
+        * <br>
+        * KApUiEventDeleted
+        * <br>
+        * and their combinations. ( Bitwise OR )
+        * <br>
+        * aSelected will be modified only if KApUiEventSelected is included 
+        * in the flags.
+        * <br>
+        * Returns after completion!
+        */
+        void DoRunListSettingsL( TUint32 aHighLight, TUint32& aSelected );
+
+
+        /**
+        * @Deprecated        
+        * Starts the selector component in a setting page
+        * Creates dialog(s) from scratch, launches and executes them.
+        * In case of error, leaves with error codes.
+        * @param TUint32 aHighlight The UID of the AP to highlight by default
+        * @param TUint32 aSelected The UID of the AP selected by the user
+        * @return The accomplished task's flag-codes:
+        * <br>
+        * KApUiEventNone,
+        * <br>
+        * KApUiEventSelected,
+        * <br>
+        * KApUiEventCreatedBlank,
+        * <br>
+        * KApUiEventCreatedUsedOld,
+        * <br>
+        * KApUiEventEdited,
+        * <br>
+        * KApUiEventDeleted
+        * <br>
+        * and their combinations. ( Bitwise OR )
+        * <br>
+        * aSelected will be modified only if KApUiEventSelected is included
+        * in the flags.
+        * <br>
+        * Returns after completion!
+        */
+        void DoRunSetPageSettingsL( TUint32 aHighLight, TUint32& aSelected );
+
+
+        /**
+        * @Deprecated
+        * handles the Create new access Point by using existing one command.
+        * Called after user has selected the AP to copy
+        * Creates the new Ap and offers it for editing.
+        * @param aSelected The UID of the AP to copy. Shall not be KErrNone.
+        * @return The UID of the newly created Ap
+        */
+        TUint32 DoHandleApUseOldNewL( TUint32 aSelected );
+
+        /**
+        * @Deprecated
+        * Selects the Ap to Copy, returns its UID.
+        * If not selected, KErrNone is returned
+        */
+        TUint32 SelectApToCopyL();
+
+
+        /**
+        * @Deprecated
+        * handles the Create blank new access Point command.
+        */
+        TUint32 DoHandleApBlankNewL( TInt aBearers, TInt aIsps );
+
+
+        /**
+        * @Deprecated
+        * handles the Delete network group command.
+        * @param aUid The uid of the network to delete
+        */
+        void HandleNetworkDeleteCmdL( TUint32 aUid );
+
+
+        /**
+        * @Deprecated
+        * Gets the local variant value 
+        * @return A TInt stating the variant
+        */
+        TInt GetVariantL();
+
+
+        /**
+        * @Deprecated
+        * Gets confirmation about deleting an access point
+        * @param aUid A TUint32 holding the WAP access point ID of the 
+        * access point to be deleted.
+        * @param aIsLast A TBool specifying whether the access point to be 
+        * deleted is the last one or not.
+        * @return A TInt stating the result
+        */
+        TInt ConfirmDeleteL( TUint32 aUid, TBool aIsLast );
+
+
+        /**
+        * @Deprecated
+        * Wrapper for the public API
+        */
+        void HandleRunSettingsL( TUint32 aHighLight, TUint32& aSelected );
+        
+
+    protected:  // Functions from base classes
+
+        friend class CApSettingsDlg;
+        friend class CApSelectorDialog;
+        friend class CApSelPopupList;
+        friend class CApNetSelPopupList;
+
+    private:
+        /**
+        * @Deprecated
+        * Selects an appropriate bearer type for a given item according to 
+        * the current filtering criterias
+        * @param aBearers The current bearer filter set
+        * @param aItem The CApAccessPointItem whoose bearer type is to be set.
+        */
+        void ChooseBearerTypeL( TInt aBearers, CApAccessPointItem& aItem );
+
+        /**
+        * @Deprecated
+        * Duplciates an existing access point identified by the passed WAP ID
+        * @param aUid The WAP Access Point ID of the access point to duplicate
+        * @return The WAP Access Point ID of the newly created access point.
+        */
+        TUint32 HandleDuplicateL( TUint32 aUid );
+
+
+    private: //data
+        TBool                   iStartWithSelection;
+        TSelectionListType      iListType;
+        TSelectionMenuType      iSelMenuType;
+ 
+        TInt                    iIspFilter;
+        TInt                    iBearerFilter;
+        TApSetHandlerExtra*     iExt;           // Extra data holder structure
+
+        TInt                    iReqIpvType;    // Default is IPv4
+
+// replacing iModel with iImpl, no size change
+//        CApSettingsModel*       iModel;   
+        CApSettingsHandlerImpl* iImpl;          // owned
+        
+        CTextOverrides*         iTextOverrides;
+        TUint32                 iEventStore;    // to hold the events
+        TUid                    iHelpMajor;
+
+#ifdef __TEST_OOMDEBUG
+        TBool                           iMemTestOn;
+#endif // __TEST_OOMDEBUG
+
+    };
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/agent_dialog_api/agent_dialog_api.metaxml	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,18 @@
+<?xml version="1.0" ?>
+<api id="6ae4508d41bbdb8169f513f403d4e2ac" dataversion="1.0">
+  <name>Agent Dialog API</name>
+  <description>Provides user interaction needed when setting up a connection to the Internet.</description>
+  <type>c++</type>
+  <subsystem>networkingutilities</subsystem>
+  <libs>
+    <lib name="agentdialog.lib" />
+  </libs>
+  <release category="sdk" sinceversion="1.0"/>
+  <attributes>
+     <!-- This indicates wether the api provedes separate html documentation -->
+     <!-- or is the additional documentation generated from headers. -->
+     <!-- If you are unsuere then the value is "no" -->
+     <htmldocprovided>yes</htmldocprovided>
+     <adaptation>no</adaptation>
+  </attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/agent_dialog_api/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* 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:  File that exports the files belonging to 
+:                Agent Dialog API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/agentdialog.h     /epoc32/include/agentdialog.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/agent_dialog_api/inc/agentdialog.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,180 @@
+/*
+* Copyright (c) 1997-2004 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 __AGENTDIALOG_H__
+#define __AGENTDIALOG_H__
+
+#include <e32std.h>
+#include <cdbcols.h>
+#include <cdblen.h>
+//#include <comms-infras\commsdebugutility.h> Cannot be included because it conflicts with flogger
+
+
+/**
+Server name in EKA2 case
+@internalTechnology
+*/
+_LIT(KCommsDialogServerName, "!NetDialDialogServer");
+
+//__FLOG_STMT(_LIT8(KDlgSvrLogSubsys, "agentdialog");)
+//__FLOG_STMT(_LIT8(KDlgSvrLogComponent, "server");)
+//__FLOG_STMT(_LIT8(KDlgCliLogComponent, "client");)
+
+class TConnectionPrefs
+/**
+Specifies the rank and desired direction of the connection and bearer.
+
+@internalTechnology
+*/
+	{
+public:
+	TUint32 iRank;
+	TCommDbConnectionDirection iDirection;
+	TUint32 iBearerSet;
+	};
+
+class TIspConnectionNames
+/**
+Specifies the Connection Names for ISP.
+
+@internalTechnology
+*/
+	{
+public:
+	TBuf<KCommsDbSvrDefaultTextFieldLength> iServiceName;
+	TBuf<KCommsDbSvrMaxColumnNameLength> iServiceTable;
+	TBuf<KCommsDbSvrDefaultTextFieldLength> iModemName;
+	TBuf<KCommsDbSvrDefaultTextFieldLength> iLocationName;
+	TBuf<KCommsDbSvrDefaultTextFieldLength> iChargecardName;
+	};
+
+class TAuthenticationPair
+/**
+Specifies the Authentication for the User Name and Password.
+
+@internalTechnology
+*/
+	{
+public:
+	TDes* iUsername;
+	TDes* iPassword;
+	};
+
+class TPctResponse
+/**
+Allows the user to see the login script running, see what is sent and received, and allows the user to type responses.
+
+@internalTechnology
+*/
+	{
+public:
+	TDes* iBuffer;
+	};
+
+class TNewIapConnectionPrefs
+/**
+Specifies Connection Preference for the New IAP.
+
+@internalTechnology
+*/
+	{
+public:
+	TConnectionPrefs iPrefs;
+	TInt iLastError;
+	TBuf<KCommsDbSvrDefaultTextFieldLength> iName;
+	};
+
+class RDialogNotifier : public RNotifier
+/**
+Client interface to allow engines or other low level components to communicate with the UI.
+
+Real implementations need three asynchronous message slots instead of RNotifiers default one slot
+in order to implement the PCT functionality.  This is not used at all by the test dialog server
+implementation.
+ 
+@internalTechnology
+*/
+	{
+public :
+	TInt Connect();
+	};
+
+class RGenConAgentDialogServer : public RSessionBase
+/**
+RGenConAgentDialogServer. This components needs to be written as a 
+proper polymorphic DLL in JetStream.
+
+NOTE! Although the class inherits from RSessionBase this does not mean you 
+have to implement the API as a client server mechanism.
+
+@internalTechnology
+*/
+	{
+public:
+	IMPORT_C RGenConAgentDialogServer();
+	IMPORT_C ~RGenConAgentDialogServer();
+	IMPORT_C TVersion Version() const;
+	IMPORT_C TInt Connect();
+	IMPORT_C void Close();
+	IMPORT_C void ModemAndLocationSelection(TUint32& aModemId,TUint32& aLocationId,TRequestStatus& aStatus);
+	IMPORT_C void IapConnection(TUint32& aIAP, const TConnectionPrefs& aPrefs, TRequestStatus& aStatus);
+	IMPORT_C void IapConnection(TUint32& aIAP, const TConnectionPrefs& aPrefs, TInt aLastError, TRequestStatus& aStatus);
+	IMPORT_C void WarnNewIapConnection(const TConnectionPrefs& aPrefs, TInt aLastError, const TDesC& aNewIapName, TBool& aResponse, TRequestStatus& aStatus);
+	IMPORT_C void Login(TDes& aUsername, TDes& aPassword, TBool aIsReconnect, TRequestStatus& aStatus);
+	IMPORT_C void Authenticate(TDes& aUsername, TDes& aPassword, TBool aIsReconnect, TRequestStatus& aStatus);
+	IMPORT_C void Reconnect(TBool& aResponse, TRequestStatus& aStatus);
+	IMPORT_C TInt OpenPct();
+	IMPORT_C TInt WritePct(const TDesC& aData);
+	IMPORT_C void ReadPct(TDes& aData, TRequestStatus& aStatus);
+	IMPORT_C void DestroyPctNotification(TRequestStatus& aStatus);
+	IMPORT_C void ClosePct();
+	IMPORT_C void QoSWarning(TBool& aResponse, TRequestStatus& aStatus);
+	IMPORT_C void CancelModemAndLocationSelection();
+	IMPORT_C void CancelIapConnection();
+	IMPORT_C void CancelWarnNewIapConnection();
+	IMPORT_C void CancelLogin();
+	IMPORT_C void CancelAuthenticate();
+	IMPORT_C void CancelReconnect();
+	IMPORT_C void CancelReadPct();
+	IMPORT_C void CancelDestroyPctNotification();
+	IMPORT_C void CancelQoSWarning();
+	IMPORT_C void AccessPointConnection(TUint32& aAccessPoint, TInt aAccessPointGroup, TRequestStatus& aStatus);
+	IMPORT_C void CancelAccessPointConnection();
+	IMPORT_C void AccessPointConnection(TUint32& aAP, TUint32 aAPType, TUint32& aBearerAPInd, TUint32 aBearerAPType, TRequestStatus& aStatus);
+
+private:
+	RDialogNotifier* iNotifier;
+	TPckg<TUint32> iIAP;
+	TPckg<TUint32> iModemId;
+	TPckg<TUint32> iLocationId;
+	TPckgBuf<TIspConnectionNames> iConNames;
+	TPckgBuf<TConnectionPrefs> iPrefs;
+	TPckg<TBool> iBool;
+	TPckgBuf<TUint32> iPctBuffer;
+	TPckgBuf<TPctResponse> iPctResponse;
+	TPckgBuf<TAuthenticationPair> iAuthenticationPair;
+	TPckgBuf<TNewIapConnectionPrefs> iNewIapPrefsBuffer;
+	TPckgBuf<TUint32> iNotUsed;		// Parameters not used by plugin
+	TRequestStatus iStatus;
+	TPckg<TUint32> iAccessPoint;
+//	__FLOG_DECLARATION_MEMBER;
+	};
+
+IMPORT_C TInt StartDialogThread();
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/connection_monitor_server_api/connection_monitor_server_api.metaxml	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,18 @@
+<?xml version="1.0" ?>
+<api id="49d1f1bbc3fe47c6d3428037e1a43324" dataversion="1.0">
+  <name>Connection Monitor Server API</name>
+  <description>Provides an API for ip data connection monitoring with some management capabilities.</description>
+  <type>c++</type>
+  <subsystem>connectionmonitoring</subsystem>
+  <libs>
+    <lib name="ConnMon.lib" />
+  </libs>
+  <release category="sdk" sinceversion="2.6"/>
+  <attributes>
+     <!-- This indicates wether the api provedes separate html documentation -->
+     <!-- or is the additional documentation generated from headers. -->
+     <!-- If you are unsuere then the value is "no" -->
+     <htmldocprovided>yes</htmldocprovided>
+     <adaptation>no</adaptation>
+  </attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/connection_monitor_server_api/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* 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:  File that exports the files belonging to Connection
+*                Monitor Server API.
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/rconnmon.h       MW_LAYER_PUBLIC_EXPORT_PATH(rconnmon.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/connection_monitor_server_api/inc/rconnmon.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,2750 @@
+/*
+* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  RConnectionMonitor provides an interface for an application to
+*                get information about active data connection. It also provides
+*                a way to close any connection or all the connections.
+*
+*/
+
+#ifndef __CONNECTIONMONITOR_H
+#define __CONNECTIONMONITOR_H
+
+#include <e32base.h>
+
+
+// ===========================================================================
+// TInt attribute constants, used by GetIntAttribute, SetIntAttribute.
+// ===========================================================================
+//
+/** Bearer, defined in TConnMonBearerType.
+*/
+const TUint KBearer = 1;
+/** Network status, defined in TConnMonNetworkStatus.
+*/
+const TUint KNetworkStatus = 2;
+/** Connection status, progress constants are from nifvar.h.
+*/
+const TUint KConnectionStatus = 3;
+/** Protocol, defined in TConnMonProtocolType.
+*/
+const TUint KProtocolType = 4;
+/** Network registration values defined in TConnMonNetworkRegistration.
+*/
+const TUint KNetworkRegistration = 5;
+/** Signal strength in dBm.
+*/
+const TUint KSignalStrength = 6;
+/** WLAN mode, defined in TConnMonNetworkMode.
+*/
+const TUint KNetworkMode = 7;
+/** WLAN connection security mode, defined in TConnMonSecurityMode.
+*/
+const TUint KSecurityMode = 8;
+/** Bearer information, defined in TConnMonBearerInfo.
+*/
+const TUint KBearerInfo = 9;
+/** Acceptable WLAN scan cache age in seconds. Set to -1 to use device
+default. Only has meaning if KWlanScanMaxDelay is set to 0.
+*/
+const TUint KWlanScanCacheLifetime = 10;
+
+/** Network registration values defined in TConnMonNetworkRegistration_v2.
+*/
+const TUint KNetworkRegistration_v2 = 11;
+
+/** QoS - Not supported.
+*/
+const TUint KTrafficClass = 30;
+/** QoS - Not supported.
+*/
+const TUint KDeliveryOrder = 31;
+/** QoS - Not supported.
+*/
+const TUint KErroneousSDUDelivery = 32;
+/** QoS - Not supported.
+*/
+const TUint KResidualBitErrorRatio = 33;
+/** QoS - Not supported.
+*/
+const TUint KSDUErrorRatio = 34;
+
+
+// ===========================================================================
+// TUint attribute constants, used by GetUintAttribute, SetUintAttribute.
+// ===========================================================================
+//
+/** Downlink data in bytes.
+*/
+const TUint KDownlinkData = 100;
+/** Uplink data in bytes.
+*/
+const TUint KUplinkData = 101;
+/** Used IAP ID.
+*/
+const TUint KIAPId = 102;
+/** Network ID.
+*/
+const TUint KNetworkIdentifier = 103;
+/** WLAN transmit power in mW.
+*/
+const TUint KTransmitPower = 104;
+/** Current network mode, defined in TConnMonMobilePhoneNetworkMode.
+*/
+const TUint KMobilePhoneNetworkMode = 105;
+/** QoS - Not supported.
+*/
+const TUint KMaximumBitrateDownlink = 130;
+/** QoS - Not supported.
+*/
+const TUint KMaximumBitrateUplink = 131;
+/** QoS - Not supported.
+*/
+const TUint KMaximumSDUSize = 132;
+/** QoS - Not supported.
+*/
+const TUint KTransferDelay = 133;
+/** QoS - Not supported.
+*/
+const TUint KGuaranteedBitrateDownlink = 134;
+/** QoS - Not supported.
+*/
+const TUint KGuaranteedBitrateUplink = 135;
+/** QoS - Not supported.
+*/
+const TUint KTrafficHandlingPriority = 136;
+/** Enables EConnMonConnectionActivityChange events.
+0 means off, minimum allowed is 5 seconds.
+*/
+const TUint KActivityTimeThreshold = 150;
+/** Enables EConnMonDownlinkDataThreshold events.
+0 means off, minimum allowed is 4096 bytes.
+*/
+const TUint KDownlinkDataThreshold = 151;
+/** Enables EConnMonUplinkDataThreshold events.
+0 means off, minimum allowed is 4096 bytes.
+*/
+const TUint KUplinkDataThreshold = 152;
+/** Enables EConnMonBearerAvailabilityChange events.
+*/
+const TUint KBearerAvailabilityThreshold = 153;
+/** Enables EConnMonSignalStrengthChange events.
+*/
+const TUint KSignalStrengthThreshold = 154;
+/** If set, disables EConnMonBearerChange events and enables
+EConnMonBearerInfoChange and EConnMonBearerGroupChange events instead.
+*/
+const TUint KBearerGroupThreshold = 155;
+/** Acceptable delay in seconds for receiving WLAN scan results.
+If set to 0 (default), KWlanScanCacheLifetime will be used.
+*/
+const TUint KWlanScanMaxDelay = 160;
+
+
+// ===========================================================================
+// TBool attribute constants, used by GetBoolAttribute, SetBoolAttribute.
+// ===========================================================================
+//
+/** Connection activity.
+*/
+const TUint KConnectionActive = 200;
+/** Bearer availability.
+*/
+const TUint KBearerAvailability = 201;
+/** Packet data availability. Can be blocked if phone call is active and no
+dual transfer mode support.
+*/
+const TUint KPacketDataAvailability = 202;
+/** Stop a connection.
+*/
+const TUint KConnectionStop = 250;
+/** Stop all connections.
+*/
+const TUint KConnectionStopAll = 251;
+
+
+// ===========================================================================
+// TDes attribute constants, used by GetStringAttribute, SetStringAttribute.
+// ===========================================================================
+//
+/** Name of used IAP.
+*/
+const TUint KIAPName = 300;
+/** Name of used access point.
+*/
+const TUint KAccessPointName = 301;
+/** Used telephone number.
+*/
+const TUint KTelNumber = 302;
+/** Name (SSID) of used WLAN.
+*/
+const TUint KNetworkName = 303;
+/** WLAN name (SSID) to be used in SSID scan (KWlanSsidNetworks).
+*/
+const TUint KWlanSsid = 304;
+
+
+// ===========================================================================
+// TPckgBuf attribute constants, used by GetPckgAttribute.
+// ===========================================================================
+//
+/** Connection start time. See TConnMonTimeBuf.
+*/
+const TUint KStartTime = 400;
+/** All clients using a connection. See TConnMonClientEnumBuf.
+*/
+const TUint KClientInfo = 401;
+/** Basic WLAN scan information. See TConnMonNetworkNamesBuf.
+*/
+const TUint KNetworkNames = 402;
+/** Available IAP IDs. See TConnMonIapInfoBuf.
+*/
+const TUint KIapAvailability = 403;
+/** Deprecated. Old WLAN scan results, use KWlanNetworks instead.
+*/
+const TUint KWLANNetworks = 404;
+/** Available SNAP IDs. See TConnMonSNAPInfoBuf.
+*/
+const TUint KSNAPsAvailability = 405;
+/** Available SNAP IDs, in a more flexible way. See ConnMonIdsArrayPckg.
+*/
+const TUint KAvailableSNAPsIds = 406;
+/** WLAN scan results. See CConnMonWlanNetworksPtrArrayPckg.
+*/
+const TUint KWlanNetworks = 407;
+/** Bearer group information. See TConnMonBearerGroupInfoBuf.
+*/
+const TUint KBearerGroupInfo = 408;
+/** WLAN SSID scan results. Scans for WLANs with a specific SSID.
+See CConnMonWlanNetworksPtrArrayPckg.
+*/
+const TUint KWlanSsidNetworks = 409;
+/** Information about the currently used WLAN.
+See CConnMonWlanNetworksPtrArrayPckg.
+*/
+const TUint KWlanCurrentNetwork = 410;
+/** Beacon frames from a WLAN scan. See CConnMonWlanProbeRawBuffersPckg.
+*/
+const TUint KWlanProbeRawBuffers = 411;
+
+
+/** Base value for plug-in specific attribute IDs.
+*/
+const TUint KConnMonPluginAttributeBase = 3000000;
+
+
+/**
+* Bearer type.
+*/
+enum TConnMonBearerType
+    {
+    EBearerUnknown           = 0,
+    EBearerCSD               = 1,  ///< CSD (GSM)
+    EBearerWCDMA             = 2,  ///< PSD (WCDMA)
+    EBearerLAN               = 3,
+    EBearerCDMA2000          = 4,
+    EBearerGPRS              = 5,
+    EBearerHSCSD             = 6,  ///< HSCSD (GSM)
+    EBearerEdgeGPRS          = 7,
+    EBearerWLAN              = 8,
+    EBearerBluetooth         = 9,
+    EBearerVirtual           = 10,
+    EBearerVirtualVPN        = 11,
+    EBearerWcdmaCSD          = 12, ///< CSD (WCDMA)
+
+    EBearerExternalCSD       = 30, ///< external CSD (GSM)
+    EBearerExternalWCDMA     = 31, ///< external PSD (WCDMA)
+    EBearerExternalLAN       = 32,
+    EBearerExternalCDMA2000  = 33,
+    EBearerExternalGPRS      = 34,
+    EBearerExternalHSCSD     = 35, ///< external HSCSD (GSM)
+    EBearerExternalEdgeGPRS  = 36,
+    EBearerExternalWLAN      = 37,
+    EBearerExternalBluetooth = 38,
+    EBearerExternalWcdmaCSD  = 39, ///< external CSD (WCDMA)
+    };
+
+/**
+* Bearer specific general connection ID.
+*/
+enum TConnMonBearerId
+    {
+    EBearerIdAll        = 0,
+    EBearerIdGPRS       = 2000000, ///< Internal/external GPRS and EdgeGPRS
+    EBearerIdWCDMA      = 2000001, ///< Internal/external PSD (WCDMA)
+    EBearerIdCSD        = 2000002, ///< Internal/external CSD and HSCSD (GSM)
+    EBearerIdGSM        = 2000003, ///< Union of EBearerIdGPRS and EBearerIdCSD
+    EBearerIdWLAN       = 2000004,
+    EBearerIdLAN        = 2000005,
+    EBearerIdWcdmaCSD   = 2000006, ///< Internal/external CSD (WCDMA)
+    EBearerIdCDMA2000   = 2000007,
+    EBearerIdVirtualVPN = 2000008
+    };
+
+/**
+* Network status.
+*/
+enum TConnMonNetworkStatus
+    {
+    EConnMonStatusNotAvailable = 0,
+    EConnMonStatusUnattached,
+    EConnMonStatusAttached,
+    EConnMonStatusActive,
+    EConnMonStatusSuspended
+    };
+
+/**
+* Protocol type (type of PDP). It may not be available for some
+* bearers (returns EProtocolTypeUnknown).
+*/
+enum TConnMonProtocolType
+    {
+    EProtocolTypeUnknown = 0,
+    EProtocolTypeIPv4,
+    EProtocolTypeIPv6,
+    EProtocolTypeX25,
+    EProtocolTypePPP,
+    EProtocolTypeCDPD,
+    EProtocolTypeIP           ///< Connection uses both IPv4 and IPv6
+    };
+
+/**
+* Asyncronous request codes.
+*/
+enum TConnMonAsyncRequest
+    {
+    EConnMonGetConnectionCount = 1,
+    EConnMonGetIntAttribute,
+    EConnMonGetUintAttribute,
+    EConnMonGetBoolAttribute,
+    EConnMonGetStringAttribute,
+    EConnMonGetPckgAttribute
+    };
+
+/**
+* Events sent by Connection Monitor. See SDK documentation for more details.
+*/
+enum TConnMonEvent
+    {
+    EConnMonCreateConnection          = 1,
+    EConnMonDeleteConnection          = 2,
+    EConnMonCreateSubConnection       = 3,  ///< Not supported
+    EConnMonDeleteSubConnection       = 4,  ///< Not supported
+    EConnMonDownlinkDataThreshold     = 5,
+    EConnMonUplinkDataThreshold       = 6,
+    EConnMonNetworkStatusChange       = 7,
+    EConnMonConnectionStatusChange    = 8,
+    EConnMonConnectionActivityChange  = 9,
+    EConnMonNetworkRegistrationChange = 10,
+    EConnMonBearerChange              = 11,
+    EConnMonSignalStrengthChange      = 12, ///< For cellular, not WLAN
+    EConnMonBearerAvailabilityChange  = 13,
+    EConnMonIapAvailabilityChange     = 14,
+    EConnMonTransmitPowerChange       = 15, ///< For WLAN
+    EConnMonSNAPsAvailabilityChange   = 16,
+    EConnMonNewWLANNetworkDetected    = 17,
+    EConnMonOldWLANNetworkLost        = 18,
+    EConnMonPacketDataAvailable       = 19,
+    EConnMonPacketDataUnavailable     = 20,
+    EConnMonBearerInfoChange          = 21,
+    EConnMonBearerGroupChange         = 22,
+
+    EConnMonPluginEventBase           = 4000000
+    };
+
+/**
+* Network registration status. Valid for CSD, GPRS and WCDMA.
+*/
+enum TConnMonNetworkRegistration
+    {
+    ENetworkRegistrationNotAvailable = 0,
+    ENetworkRegistrationUnknown,
+    ENetworkRegistrationNoService,
+    ENetworkRegistrationEmergencyOnly,
+    ENetworkRegistrationSearching,
+    ENetworkRegistrationBusy,
+    ENetworkRegistrationHomeNetwork,
+    ENetworkRegistrationDenied,
+    ENetworkRegistrationRoaming
+    };
+
+/**
+* Network registration status. Valid for CSD, GPRS and WCDMA.
+* New values will be added to the end of the enumeration.
+*/
+enum TConnMonNetworkRegistration_v2
+    {
+    ENetworkRegistrationExtNotAvailable = 0,
+    ENetworkRegistrationExtUnknown,
+    ENetworkRegistrationExtNoService,
+    ENetworkRegistrationExtEmergencyOnly,
+    ENetworkRegistrationExtSearching,
+    ENetworkRegistrationExtBusy,
+    ENetworkRegistrationExtHomeNetwork,
+    ENetworkRegistrationExtDenied,
+    ENetworkRegistrationExtRoamingNational,
+    ENetworkRegistrationExtRoamingInternational
+    };
+    
+/**
+* QoS. Traffic class.
+*/
+enum TQosTrafficClass
+    {
+    EQosTrafficClassConversational = 1,
+    EQosTrafficClassStreaming,
+    EQosTrafficClassInteractive,
+    EQosTrafficClassBackground
+    };
+
+/**
+* QoS. Delivery order.
+*/
+enum TQosDeliveryOrder
+    {
+    EQosDeliveryOrderYes = 1,
+    EQosDeliveryOrderNo
+    };
+
+/**
+* QoS. Delivery of erroneous SDUs.
+*/
+enum TQosErroneousSDUDelivery
+    {
+    EQosErroneousSDUDeliveryYes = 1,
+    EQosErroneousSDUDeliveryNo,
+    EQosErroneousSDUDeliveryUnspecified
+    };
+
+/**
+* QoS. Residual bit error ratio.
+*/
+enum TQosBitErrorRatio
+    {
+    EQosBERFivePerHundred = 1,
+    EQosBEROnePerHundred,
+    EQosBERFivePerThousand,
+    EQosBEROnePerThousand,
+    EQosBEROnePerTenThousand,
+    EQosBEROnePerMillion
+    };
+
+/**
+* QoS. SDU error ratio.
+*/
+enum TQosSDUErrorRatio
+    {
+    EQosSDUErrorRatioOnePerHundred = 1,
+    EQosSDUErrorRatioSevenPerThousand,
+    EQosSDUErrorRatioOnePerThousand,
+    EQosSDUErrorRatioOnePerTenThousand,
+    EQosSDUErrorRatioOnePerHundredThousand
+    };
+
+/**
+* Client-server requests.
+*/
+enum TConnMonRequests
+    {
+    EReqGetConnectionCount            = 0,
+    EReqGetConnectionInfo             = 1,
+    EReqGetSubConnectionInfo          = 2,
+    EReqGetIntAttribute               = 3,
+    EReqGetUintAttribute              = 4,
+    EReqGetBoolAttribute              = 5,
+    EReqGetStringAttribute            = 6,
+    EReqGetPckgAttribute              = 7,
+    EReqSetIntAttribute               = 8,
+    EReqSetUintAttribute              = 9,
+    EReqSetBoolAttribute              = 10,
+    EReqSetStringAttribute            = 11,
+    EReqSetPckgAttribute              = 12,
+    EReqCancelAsyncRequest            = 13,
+    EReqReceiveEvent                  = 14,
+    EReqCancelReceiveEvent            = 15,
+
+    EReqPluginCreateSubSession        = 500,
+    EReqPluginCloseSubSession         = 501,
+    EReqPluginRegisterAttribute       = 502,
+    EReqPluginCancelRegisterAttribute = 503,
+    EReqPluginEvent                   = 504,
+    EReqPluginGetQuery                = 505,
+    EReqPluginCancelGetQuery          = 506,
+    EReqPluginAttribute               = 507,
+
+    EReqInternalSetThreshold          = 600,
+    EReqInternalResetThreshold        = 601
+    };
+
+/**
+* WLAN connection modes.
+*/
+enum TConnMonNetworkMode
+    {
+    EConnMonInfraStructure = 0,
+    EConnMonAdHoc          = 1,
+    EConnMonSecureInfra    = 2
+    };
+
+/**
+* WLAN connection security modes.
+*/
+enum TConnMonSecurityMode
+    {
+    EConnMonSecurityOpen   = 0,
+    EConnMonSecurityWep    = 1,
+    EConnMonSecurity802d1x = 2,
+    EConnMonSecurityWpa    = 3,
+    EConnMonSecurityWpaPsk = 4
+    };
+
+/**
+* Network Modes.
+*/
+enum TConnMonMobilePhoneNetworkMode
+    {
+    EConnMonNetworkModeUnknown = 0,  ///< Network mode is unknown
+    EConnMonNetworkModeUnregistered, ///< ME is not registered
+    EConnMonNetworkModeGsm,          ///< GSM/GPRS or DCS1800 network
+    EConnMonNetworkModeAmps,         ///< AMPS network (CDMA)
+    EConnMonNetworkModeCdma95,       ///< CDMA (IS-95) network
+    EConnMonNetworkModeCdma2000,     ///< CDMA (cdma2000) network
+    EConnMonNetworkModeWcdma,        ///< WCDMA (UTRA FDD) network
+    EConnMonNetworkModeTdcdma        ///< TD-CDMA (UTRA TDD) network (WCDMA)
+    };
+
+/** Maximum size of a plug-in's event data.
+*/
+const TUint KConnMonMaxPluginDataSize = 512;
+/** Maximum size of a plug-in's attribute.
+*/
+const TUint KConnMonMaxStringAttributeLength = 64;
+
+/**
+* Package class definition for getting the TTime.
+*/
+typedef TPckgBuf<TTime> TConnMonTimeBuf;
+
+/** Maximum number of clients contained in TConnMonClientEnum class.
+*/
+const TUint KConnMonMaxClientUids = 10;
+
+/**
+* Class to contain client UIDs of a connection.
+*/
+class TConnMonClientEnum
+    {
+public:
+    /**
+    * Constructor.
+    */
+    inline TConnMonClientEnum():iCount( 0 )
+        {
+        }
+public:
+    /**
+    * Number of UIDs in iUid array.
+    */
+    TUint iCount;
+    /**
+    * Array for client UIDs.
+    */
+    TUid iUid[KConnMonMaxClientUids];
+    };
+
+/**
+* Package class definition for getting the client information.
+*/
+typedef TPckgBuf<TConnMonClientEnum> TConnMonClientEnumBuf;
+
+/** Maximum number of WLANs contained in TConnMonNetworkNames class.
+*/
+const TUint KConnMonMaxNetworkCount = 10;
+
+/**
+* Class to contain basic WLAN information.
+*/
+class TConnMonNetwork
+{
+public:
+    /**
+    * Constructor.
+    */
+    inline TConnMonNetwork():iType( 0 ), iSignalStrength( 0 )
+        {
+        }
+public:
+    /**
+    * WLAN name (SSID).
+    */
+    TBuf8<32> iName;
+    /**
+    * WLAN mode, defined in TConnMonNetworkMode.
+    */
+    TInt8 iType;
+    /**
+    * Signal strength in dBm. Given as absolute, correct value is negative.
+    */
+    TUint8 iSignalStrength;
+    };
+
+/**
+* Class to contain an array of basic WLAN information.
+*/
+class TConnMonNetworkNames
+    {
+public:
+    /**
+    * Constructor.
+    */
+    inline TConnMonNetworkNames():iCount( 0 )
+        {
+        }
+    /**
+    * This method returns the number of WLANs contained in this class.
+    *
+    * @return Number of WLANs.
+    */
+    inline TUint Count()
+        {
+        return iCount;
+        }
+public:
+    /**
+    * Number of items in WLAN array.
+    */
+    TUint iCount;
+    /**
+    * Array of WLANs.
+    */
+    TConnMonNetwork iNetwork[KConnMonMaxNetworkCount];
+    };
+
+/**
+* Package class definition for getting basic WLAN scan information.
+*/
+typedef TPckgBuf<TConnMonNetworkNames> TConnMonNetworkNamesBuf;
+
+/** Maximum number of IAPs contained in TConnMonIapInfo class.
+*/
+const TUint KConnMonMaxIAPCount = 25;
+
+/**
+* Class representing an IAP.
+*/
+class TConnMonIap
+    {
+public:
+    /**
+    * Constructor.
+    */
+    inline TConnMonIap():iIapId( 0 )
+        {
+        }
+public:
+    /**
+    * IAP ID number.
+    */
+    TUint iIapId;
+    };
+
+/**
+* Class to contain an array of IAPs.
+*/
+class TConnMonIapInfo
+    {
+public:
+    /**
+    * Constructor.
+    */
+    inline TConnMonIapInfo():iCount( 0 )
+        {
+        }
+    /**
+    * This method returns the number of IAPs contained in this class.
+    *
+    * @return Number of IAPs.
+    */
+    inline TUint Count()
+        {
+        return iCount;
+        }
+public:
+    /**
+    * Number of items in IAP array.
+    */
+    TUint iCount;
+    /**
+    * Array of IAPs.
+    */
+    TConnMonIap iIap[KConnMonMaxIAPCount];
+    };
+
+/** Package class definiton for getting available IAPs.
+*/
+typedef TPckgBuf<TConnMonIapInfo> TConnMonIapInfoBuf;
+
+/** Maximum number of SNAPs contained in TConnMonSNAPInfo class.
+*/
+const TUint KConnMonMaxSNAPsCount = 25;
+
+/**
+* Class representing a SNAP.
+*/
+class TConnMonSNAPId
+    {
+public:
+    /**
+    * Constructor.
+    */
+    inline TConnMonSNAPId():iSNAPId( 0 )
+        {
+        }
+public:
+    /**
+    * SNAP ID number.
+    */
+    TUint iSNAPId;
+    };
+
+/**
+* Class to contain an array of SNAPs.
+*/
+class TConnMonSNAPInfo
+    {
+public:
+    /**
+    * Constructor.
+    */
+    inline TConnMonSNAPInfo():iCount( 0 )
+        {
+        }
+    /**
+    * This method returns the number of SNAPs contained in this class.
+    *
+    * @return Number of SNAPs.
+    */
+    inline TUint Count()
+        {
+        return iCount;
+        }
+public:
+    /**
+    * Number of items in SNAP array.
+    */
+    TUint iCount;
+    /**
+    * Array of SNAPs.
+    */
+    TConnMonSNAPId iSNAP[KConnMonMaxSNAPsCount];
+    };
+
+/** Package class definiton for getting available SNAPs.
+*/
+typedef TPckgBuf<TConnMonSNAPInfo> TConnMonSNAPInfoBuf;
+
+/**
+* Bearer group definition, new values will be added to the end of the
+* enumeration.
+*/
+enum TConnMonBearerGroup
+    {
+    EBearerGroupUnknown                    = 0,
+    EBearerGroupCellular                   = 0x00000001,
+    EBearerGroupNonCellular                = 0x00000002,
+    EBearerGroupCellularPacket             = 0x00000004,
+    EBearerGroupCircuitSwitched            = 0x00000008,
+    EBearerGroup2G                         = 0x00000010,
+    EBearerGroup2GPacket                   = 0x00000020,
+    EBearerGroup3G                         = 0x00000040,
+    EBearerGroup3GPacket                   = 0x00000080,
+    EBearerGroupHSPA                       = 0x00000100,
+    EBearerGroupLANBased                   = 0x00000200,
+    EBearerGroupWLAN                       = 0x00000400,
+    EBearerGroupIPOverConnectivityProtocol = 0x00000800,
+    EBearerGroupWired                      = 0x00001000,
+    EBearerGroupVirtual                    = 0x00002000
+    };
+
+/**
+* Bearer definition, new values will be added to the end of the enumeration.
+* These are used if KBearerInfo attribute is set or in events if
+* KBearerGroupThreshold is set.
+*/
+enum TConnMonBearerInfo
+    {
+    EBearerInfoUnknown = 0,
+    EBearerInfoCSD,
+    EBearerInfoWCDMA,
+    EBearerInfoLAN,
+    EBearerInfoCDMA2000,
+    EBearerInfoGPRS,
+    EBearerInfoHSCSD,
+    EBearerInfoEdgeGPRS,
+    EBearerInfoWLAN,
+    EBearerInfoBluetooth,
+    EBearerInfoVirtual,
+    EBearerInfoVirtualVPN,
+    EBearerInfoWcdmaCSD,
+    EBearerInfoHSDPA,
+    EBearerInfoHSUPA,
+    EBearerInfoHSxPA
+    };
+
+/**
+* Class to contain bearer group information.
+*/
+class TConnMonBearerGroupInfo
+    {
+public:
+    /**
+    * Constructor.
+    */
+    inline TConnMonBearerGroupInfo():
+            iInternal( ETrue ),
+            iBearerGroups( 0 ),
+            iBearerGroups2( 0 )
+        {
+        }
+public:
+    /**
+    * Connection is internal or external.
+    */
+    TBool iInternal;
+    /**
+    * Bearer group bitmask.
+    */
+    TUint iBearerGroups;
+    /**
+    * Reserved for future use.
+    */
+    TUint iBearerGroups2;
+    };
+
+/** Package class definiton for getting bearer group information.
+*/
+typedef TPckgBuf<TConnMonBearerGroupInfo> TConnMonBearerGroupInfoBuf;
+
+/**
+* Class to represent a WLAN. Used when reporting WLAN scan results back to a
+* client.
+*/
+NONSHARABLE_CLASS( CConnMonWlanNetwork ) : public CBase
+    {
+public:
+    /** Maximum length of a WLAN name (SSID).
+    */
+    static const TUint KMaxNameLength = 32;
+    /** WLAN BSSID length (mac address).
+    */
+    static const TUint KWlanBssId = 6;
+    /** Reserved for future use.
+    */
+    static const TUint KExtraCount = 10;
+
+    /**
+    * Constructor.
+    *
+    * @param aName Name (SSID) of the network.
+    * @param aConnectionMode Mode of the network.
+    * @param aSignalStrength Signal strength of the network.
+    * @param aSecurityMode Security mode of the network.
+    * @param aBssId Mac address (BSSID) of the base station.
+    * @param aVendorData Not in use.
+    * @return Pointer to the created CConnMonWlanNetwork object.
+    */
+    IMPORT_C static CConnMonWlanNetwork* NewL(
+            const TBuf<KMaxNameLength>& aName,
+            TUint aConnectionMode,
+            TUint aSignalStrength,
+            TUint aSecurityMode,
+            const TBuf8<KWlanBssId>& aBssId,
+            const TDesC& aVendorData );
+
+    /**
+    * Constructor.
+    *
+    * @return Pointer to the created empty CConnMonWlanNetwork object.
+    */
+    IMPORT_C static CConnMonWlanNetwork* NewL();
+
+    /**
+    * Copy constructor.
+    *
+    * @param aConnMonWlanNetwork The object which is copied.
+    * @return Pointer to the created CConnMonWlanNetwork object.
+    */
+    IMPORT_C static CConnMonWlanNetwork* NewL(
+            CConnMonWlanNetwork& aConnMonWlanNetwork );
+
+    /**
+    * Destructor.
+    */
+    IMPORT_C ~CConnMonWlanNetwork();
+
+    /**
+    * Assignment operator.
+    *
+    * @param aConnMonWlanNetwork The object which is assigned.
+    */
+    IMPORT_C CConnMonWlanNetwork& operator=(
+            CConnMonWlanNetwork& aConnMonWlanNetwork );
+
+    /**
+    * Compares two networks by signal strength.
+    *
+    * @param aFirst Reference to first WLAN object.
+    * @param aSecond Reference to second WLAN object.
+    * @return Result of the comparison, 1 if first is less than second, 0 if
+    * they are equal and -1 otherwise.
+    */
+    IMPORT_C static TInt CompareBySignal(
+            const CConnMonWlanNetwork& aFirst,
+            const CConnMonWlanNetwork& aSecond );
+
+    /**
+    * Obtains the name (SSID) of the network.
+    *
+    * @return Name of the wlan network.
+    */
+    inline TBuf<KMaxNameLength> Name()
+        {
+        return iName;
+        }
+
+    /**
+    * Obtains the connection mode of the network.
+    *
+    * @return Connection mode (defined in TConnMonNetworkMode).
+    */
+    inline TUint ConnectionMode()
+        {
+        return iConnectionMode;
+        }
+
+    /**
+    * Obtains the signal strength of the network.
+    *
+    * @return Signal strength in dBm.
+    */
+    inline TUint SignalStrength()
+        {
+        return iSignalStrength;
+        }
+
+    /**
+    * Obtains the security mode of the network.
+    *
+    * @return Security mode (defined in TConnMonSecurityMode).
+    */
+    inline TUint SecurityMode()
+        {
+        return iSecurityMode;
+        }
+
+    /**
+    * Obtains the mac address (BSSID) of the base station.
+    *
+    * @return Mac address (BSSID).
+    */
+    inline TBuf8<KWlanBssId> WlanBssid()
+        {
+        return iWlanBssId;
+        }
+
+    /**
+    * Obtains a pointer to vendor specific data buffer.
+    * Ownership of the data is NOT transferred. Not in use, use package
+    * attribute KWlanProbeRawBuffers instead.
+    *
+    * @return Pointer to vendor specific data if available.
+    */
+    inline HBufC* VendorData()
+        {
+        return iVendorData;
+        }
+
+    /**
+    * Writes object of class CConnMonWlanNetwork to memory.
+    * Ownership of newly created buffer is transferred to caller.
+    *
+    * @return Pointer to heap descriptor. NULL if memory allocation failed.
+    */
+    IMPORT_C const HBufC* ToBuf() const;
+
+    /**
+    * Reads object of class CConnMonWlanNetwork from memory.
+    *
+    * @param aPtrC Pointer to the beginning of the CConnMonWlanNetwork object
+    * in buffer.
+    * @param aConnMonWlanNetwork Pointer to CConnMonWlanNetwork object where
+    * unpacked contents are written.
+    * @return A Symbian OS error code.
+    */
+    IMPORT_C static TInt FromPtrC(
+            const TPtrC& aPtrC,
+            CConnMonWlanNetwork* aConnMonWlanNetwork );
+
+private:
+    /**
+    * Constructor.
+    */
+    CConnMonWlanNetwork();
+
+    /**
+    * Constructor.
+    *
+    * @param aName Name (SSID) of the network.
+    * @param aConnectionMode Mode of the network.
+    * @param aSignalStrength Signal strength of the network.
+    * @param aSecurityMode Security mode of the network.
+    * @param aBssId Mac address (BSSID) of the base station.
+    * @param aVendorData Not in use.
+    */
+    CConnMonWlanNetwork(
+            const TBuf<KMaxNameLength>& aName,
+            TUint aConnectionMode,
+            TUint aSignalStrength,
+            TUint aSecurityMode,
+            const TBuf8<KWlanBssId>& aBssId,
+            const TDesC& aVendorData );
+
+    /**
+    * Second-phase constructor.
+    */
+    void ConstructL();
+
+private:
+    TBuf<KMaxNameLength> iName;   // Network name
+    TUint iConnectionMode;        // WLAN mode, see TConnMonNetworkMode
+    TUint iSignalStrength;        // Signal strength in absolute dBm
+    TUint iSecurityMode;          // See TConnMonSecurityMode
+    TBuf8<KWlanBssId> iWlanBssId; // BSSID
+    HBufC* iVendorData;           // For vendor specific data
+    TUint iExtraBuf[KExtraCount]; // Reserved for future
+    };
+
+/** Class definition for a pointer array of CConnMonWlanNetwork objects.
+*/
+typedef RPointerArray<CConnMonWlanNetwork> RConnMonWlanNetworksPtrArray;
+
+/**
+* Class to contain a package of a pointer array of CConnMonWlanNetwork objects.
+*/
+class CConnMonWlanNetworksPtrArrayPckg : public CBase
+    {
+public:
+    /**
+    * Constructor. Constructs the package of an array of pointers to
+    * CConnMonWlanNetwork objects on the heap.
+    *
+    * @param aRef Array of pointers to CConnMonWlanNetwork objects.
+    * @param aBufSize Size of the buffer, intended to contain the package.
+    */
+    CConnMonWlanNetworksPtrArrayPckg(
+            const RPointerArray<CConnMonWlanNetwork>& aRef,
+            TUint aBufSize );
+
+    /**
+    * Constructor. Constructs an empty package on the heap.
+    *
+    * @param aBufSize Size of the buffer, intended to contain the package.
+    */
+    IMPORT_C CConnMonWlanNetworksPtrArrayPckg( TUint aBufSize );
+
+    /**
+    * Destructor.
+    */
+    IMPORT_C virtual ~CConnMonWlanNetworksPtrArrayPckg();
+
+    /**
+    * Unpacks the package to a pointer array of CConnMonWlanNetwork objects.
+    *
+    * @param aRef Array that will contain the pointers to unpacked objects.
+    */
+    IMPORT_C void UnpackToL( RPointerArray<CConnMonWlanNetwork>& aRef ) const;
+
+    /**
+    * Obtains a pointer to the package buffer.
+    *
+    * @return Pointer to the package buffer.
+    */
+    IMPORT_C HBufC* Buf() const;
+
+private:
+    /**
+    * Pointer to the package Buffer on the heap.
+    */
+    HBufC* iBuf;
+    };
+
+/**
+* Class to represent a WLAN beacon frame. Used when reporting WLAN scan
+* results back to a client.
+*/
+NONSHARABLE_CLASS( CConnMonWlanProbeRawBuffer ) : public CBase
+    {
+    public:
+    /**
+    * Constructor.
+    *
+    * @param aRawBuffer Beacon frame buffer to be copied to this object.
+    * @return Pointer to the created CConnMonWlanProbeRawBuffer object.
+    */
+    IMPORT_C static CConnMonWlanProbeRawBuffer* NewL(
+            const HBufC8* aRawBuffer );
+
+    /**
+    * Constructor.
+    *
+    * @return Pointer to the created empty CConnMonWlanProbeRawBuffer object.
+    */
+    IMPORT_C static CConnMonWlanProbeRawBuffer* NewL();
+
+    /**
+    * Copy constructor.
+    *
+    * @param aConnMonWlanProbeRawBuffer The object which is copied.
+    * @return Pointer to the created CConnMonWlanProbeRawBuffer object.
+    */
+    IMPORT_C static CConnMonWlanProbeRawBuffer* NewL(
+            CConnMonWlanProbeRawBuffer& aConnMonWlanProbeRawBuffer );
+
+    /**
+    * Destructor.
+    */
+    IMPORT_C virtual ~CConnMonWlanProbeRawBuffer();
+
+    /**
+    * Assignment operator.
+    *
+    * @param aConnMonWlanProbeRawBuffer The object which is assigned.
+    */
+    IMPORT_C CConnMonWlanProbeRawBuffer& operator=(
+            CConnMonWlanProbeRawBuffer& aConnMonWlanProbeRawBuffer );
+
+    /**
+    * Obtains a pointer to the beacon frame buffer.
+    *
+    * @return Pointer to the beacon frame buffer.
+    */
+    IMPORT_C HBufC8* RawBuffer() const;
+
+    /**
+    * Writes object of class CConnMonWlanProbeRawBuffer to memory.
+    * Ownership of newly created buffer is transferred to caller.
+    *
+    * @return Pointer to heap descriptor, NULL if memory allocation failed.
+    */
+    const HBufC8* ToBuf() const;
+
+    /**
+    * Reads object of class CConnMonWlanProbeRawBuffer from memory.
+    *
+    * @param aPtrC Pointer to the beginning of the CConnMonWlanProbeRawBuffer
+    * object in buffer.
+    * @param aConnMonWlanProbeRawBuffer Pointer to CConnMonWlanProbeRawBuffer
+    * object where unpacked contents are written.
+    * @return A Symbian OS error code.
+    */
+    static TInt FromPtrC(
+            const TPtrC8& aPtrC,
+            CConnMonWlanProbeRawBuffer* aConnMonWlanProbeRawBuffer );
+
+private:
+    /**
+    * Constructor.
+    */
+    CConnMonWlanProbeRawBuffer();
+
+    /**
+    * Second-phase constructor.
+    */
+    void ConstructL();
+
+    /**
+    * Second-phase constructor.
+    *
+    * @param aRawBuffer Buffer to be copied to this object.
+    */
+    void ConstructL( const HBufC8* aRawBuffer );
+
+private:
+    HBufC8* iRawBuffer; // Beacon frame buffer
+    };
+
+/** Class definition for a pointer array of CConnMonWlanProbeRawBuffer objects.
+*/
+typedef RPointerArray<CConnMonWlanProbeRawBuffer> RConnMonWlanProbeRawBuffersPtrArray;
+
+/**
+* Class to contain a package of a pointer array of CConnMonWlanProbeRawBuffer
+* objects.
+*/
+class CConnMonWlanProbeRawBuffersPckg : public CBase
+    {
+public:
+    /**
+    * Constructor. Constructs the package of an array of pointers to
+    * CConnMonWlanProbeRawBuffer objects on the heap.
+    *
+    * @param aRef Array of pointers to CConnMonWlanProbeRawBuffer objects.
+    * @param aBufSize Size of the buffer, intended to contain the package.
+    */
+    CConnMonWlanProbeRawBuffersPckg(
+            const RConnMonWlanProbeRawBuffersPtrArray& aRef,
+            TUint aBufSize );
+
+    /**
+    * Constructor. Constructs an empty package on the heap.
+    *
+    * @param aBufSize Size of the buffer, intended to contain the package.
+    */
+    IMPORT_C CConnMonWlanProbeRawBuffersPckg( TUint aBufSize );
+
+    /**
+    * Destructor.
+    */
+    IMPORT_C virtual ~CConnMonWlanProbeRawBuffersPckg();
+
+    /**
+    * Unpacks the package to a pointer array of CConnMonWlanProbeRawBuffer
+    * objects.
+    *
+    * @param aRef Array that will contain the pointers to unpacked objects.
+    */
+    IMPORT_C void UnpackToL( RConnMonWlanProbeRawBuffersPtrArray& aRef ) const;
+
+    /**
+    * Obtains a pointer to the package buffer.
+    *
+    * @return Pointer to the package buffer.
+    */
+    IMPORT_C HBufC8* Buf() const;
+
+    /**
+    * Obtains the total number of found WLANs.
+    *
+    * @return Total count (iBuf[0]).
+    */
+    IMPORT_C TUint Total() const;
+
+    /**
+    * Obtains the number of trasferred WLANs. This will be less than total
+    * count if there was not enough memory in buffer to include all found
+    * WLANs.
+    *
+    * @return Transfered count in buffer (iBuf[1]).
+    */
+    IMPORT_C TUint Count() const;
+
+private:
+    /**
+    * Pointer to the package buffer on the heap.
+    */
+    HBufC8* iBuf;
+    };
+
+/**
+* Interface template for the class T serialization to/from HBuf/TPtr.
+* Class T could be any type of class (T, C, etc.).
+*/
+template <class T>
+    class MDesSerializer
+    {
+public:
+    /**
+    * Have to pack the object of class T to HBufC.
+    * Ownership of newly created pointer is transferred to caller.
+    *
+    * @return Pointer to the heap descriptor.
+    */
+    virtual const HBufC* ToBuf() const = 0;
+
+    /**
+    * Have to unpack object of class T from aPtrC.
+    *
+    * @return Constant pointer to the heap descriptor.
+    */
+    static T FromPtrC( const TPtrC& aPtrC );
+    };
+
+/**
+* Class representing an ID number.
+* MDesSerializer - abstract interface for class serialization.
+*/
+class TConnMonId : public MDesSerializer<TConnMonId>
+    {
+public:
+    /**
+    * Defines the maximum size of the object in TChar's.
+    * +1 is for rounding to bigger integer.
+    */
+    static const TUint KMaxSize = ( sizeof( TUint ) ) / sizeof( TChar ) + 1;
+
+    /**
+    * Defines shifts of fields inside the object.
+    */
+    enum FieldsShifts
+        {
+        EId = 0
+        };
+
+    /**
+    * Constructor.
+    *
+    * @param aId ID number.
+    */
+    IMPORT_C TConnMonId( TUint aId );
+
+    /**
+    * Obtains the ID number.
+    *
+    * @return ID number.
+    */
+    IMPORT_C TUint Id() const;
+
+    // From MDesSerializer
+
+    /**
+    * Writes object of class TConnMonId to memory.
+    * Ownership of newly created buffer is transferred to caller.
+    *
+    * @return Pointer to heap descriptor, NULL if memory allocation failed.
+    */
+    IMPORT_C const HBufC* ToBuf() const;
+
+    /**
+    * Reads object of class TConnMonId from memory.
+    *
+    * @param aPtrC Pointer to the beginning of the TConnMonId object in buffer.
+    * @return The newly created TConnMonId object.
+    */
+    IMPORT_C static TConnMonId FromPtrC( const TPtrC& aPtrC );
+
+protected:
+    /**
+    * ID number.
+    */
+    const TUint iId;
+    };
+
+/** Class definition for an array of TConnMonId objects.
+*/
+typedef RArray<TConnMonId> RConnMonIdsArray;
+
+/**
+* Class to contain a package of an array of TConnMonId objects.
+*/
+class ConnMonIdsArrayPckg
+    {
+public:
+    /**
+    * Constructor. Constructs the package of an array of TConnMonId objects
+    * on the heap.
+    *
+    * @param aRef Array of TConnMonId objects.
+    * @param aBufSize Size of the buffer, intended to contain the package.
+    */
+    ConnMonIdsArrayPckg( const RArray<TConnMonId>& aRef, TUint aBufSize );
+
+    /**
+    * Constructor. Constructs an empty package on the heap.
+    *
+    * @param aBufSize Size of the buffer, intended to contain the package.
+    */
+    IMPORT_C ConnMonIdsArrayPckg( TUint aBufSize );
+
+    /**
+    * Destructor.
+    */
+    IMPORT_C virtual ~ConnMonIdsArrayPckg();
+
+    /**
+    * Unpacks the package to an array of TConnMonId objects.
+    *
+    * @param aRef Array that will contain the unpacked objects.
+    */
+    IMPORT_C void UnpackToL( RArray<TConnMonId>& aRef ) const;
+
+    /**
+    * Obtains a pointer to the package buffer.
+    *
+    * @return Pointer to the package buffer.
+    */
+    IMPORT_C HBufC* Buf() const;
+
+protected:
+    /**
+    * Pointer to the package buffer on the heap.
+    */
+    HBufC* iBuf;
+    };
+
+// Forward declarations
+class CConnMonEventBase;
+class CConnMonEventHandler;
+
+/**
+* Client application must implement the MConnectionMonitorObserver interface in
+* order to receive notifications. MConnectionMonitorObserver::EventL() method
+* will be called every time an event arrives.
+*
+* @lib CONNMON.LIB
+*/
+class MConnectionMonitorObserver
+    {
+public:
+    /**
+    * This method is called every time an event occurs.
+    *
+    * @param aConnMonEvent The event information.
+    */
+    virtual void EventL( const CConnMonEventBase &aConnMonEvent ) = 0;
+    };
+
+/**
+* RConnectionMonitor
+*
+* @lib CONNMON.LIB
+*/
+class RConnectionMonitor : public RSessionBase
+    {
+public:
+    /**
+    * Constructor.
+    */
+    inline RConnectionMonitor():
+            RSessionBase(),
+            iHandler( 0 ),
+            iPtrArray(),
+            iIndex( 0 )
+        {
+        }
+
+public:
+    /**
+    * Connects the client to the Connection Monitor Server. It must be called
+    * before any of other methods during the Connection Monitor session.
+    *
+    * @return KErrNone if successful, a system-wide error code if not.
+    */
+    IMPORT_C TInt ConnectL();
+
+    /**
+    * Closes the Connection Monitor session. An opened RConnectionMonitor must
+    * be closed explicitily to prevent a resource (memory) leak.
+    */
+    IMPORT_C void Close();
+
+    /**
+    * Gathers information on currently active connections.
+    *
+    * @param aConnectionCount On completion, contains the number of active
+    * connections.
+    * @param aStatus KErrNone if successful, a system-wide error code if not.
+    */
+    IMPORT_C void GetConnectionCount(
+            TUint& aConnectionCount,
+            TRequestStatus& aStatus );
+
+    /**
+    * Gets the connection ID and the count of the subconnections for the given
+    * index. GetConnectionCount() must be called to gather the information on
+    * active connections before calling this method.
+    *
+    * @param aIndex Must be between 1 and the count returned by
+    * GetConnectionCount().
+    * @param aConnectionId On return, contains the connection ID.
+    * @param aSubConnectionCount On return, contains the number of
+    * subconnections.
+    * @return KErrNone if successful, a system-wide error code if not.
+    */
+    IMPORT_C TInt GetConnectionInfo(
+            const TUint aIndex,
+            TUint& aConnectionId,
+            TUint& aSubConnectionCount ) const;
+
+    /**
+    * Gets the subconnection ID for the given index.
+    *
+    * @param aConnectionId Connection ID.
+    * @param aIndex Must be between 1 and the subconnection count returned by
+    * GetConnectionInfo().
+    * @param aSubConnectionId On return, contains the subconnection ID.
+    * @return KErrNone if successful, a system-wide error code if not.
+    */
+    IMPORT_C TInt GetSubConnectionInfo(
+            const TUint aConnectionId,
+            const TUint aIndex,
+            TUint& aSubConnectionId ) const;
+
+    /**
+    * Gets the value for a TInt attribute.
+    *
+    * @param aConnectionId Connection ID.
+    * @param aSubConnectionId Subconnection ID. If set to 0, method applies to
+    * connection.
+    * @param aAttribute Identifies the attribute to be retrieved.
+    * @param aValue On completion, contains the requested TInt attribute.
+    * @param aStatus KErrNone if successful, a system-wide error code if not.
+    */
+    IMPORT_C void GetIntAttribute(
+            const TUint aConnectionId,
+            const TUint aSubConnectionId,
+            const TUint aAttribute,
+            TInt& aValue,
+            TRequestStatus& aStatus );
+
+    /**
+    * Gets the value for a TUint attribute.
+    *
+    * @param aConnectionId Connection ID.
+    * @param aSubConnectionId Subconnection ID. If set to 0, method applies to
+    * connection.
+    * @param aAttribute Identifies the attribute to be retrieved.
+    * @param aValue On completion, contains the requested TUint attribute.
+    * @param aStatus KErrNone if successful, a system-wide error code if not.
+    */
+    IMPORT_C void GetUintAttribute(
+            const TUint aConnectionId,
+            const TUint aSubConnectionId,
+            const TUint aAttribute,
+            TUint& aValue,
+            TRequestStatus& aStatus );
+
+    /**
+    * Gets the value for a TBool attribute.
+    *
+    * @param aConnectionId Connection ID.
+    * @param aSubConnectionId Subconnection ID. If set to 0, method applies to
+    * connection.
+    * @param aAttribute Identifies the attribute to be retrieved.
+    * @param aValue On completion, contains the requested TBool attribute.
+    * @param aStatus KErrNone if successful, a system-wide error code if not.
+    */
+    IMPORT_C void GetBoolAttribute(
+            const TUint aConnectionId,
+            const TUint aSubConnectionId,
+            const TUint aAttribute,
+            TBool& aValue,
+            TRequestStatus& aStatus );
+
+    /**
+    * Gets the value for a string attribute.
+    *
+    * @param aConnectionId Connection ID.
+    * @param aSubConnectionId Subconnection ID. If set to 0, method applies to
+    * connection.
+    * @param aAttribute Identifies the attribute to be retrieved.
+    * @param aValue On completion, contains the requested string. Use a 16-bit
+    * descriptor!
+    * @param aStatus KErrNone if successful, a system-wide error code if not.
+    */
+    IMPORT_C void GetStringAttribute(
+            const TUint aConnectionId,
+            const TUint aSubConnectionId,
+            const TUint aAttribute,
+            TDes& aValue,
+            TRequestStatus& aStatus ) const;
+
+    /**
+    * Gets the value for a packaged attribute.
+    *
+    * @param aConnectionId Connection ID.
+    * @param aSubConnectionId Subconnection ID. If set to 0, method applies to
+    * connection.
+    * @param aAttribute Identifies the attribute to be retrieved.
+    * @param aValue On completion, contains the requested packaged attribute.
+    * @param aStatus KErrNone if successful, a system-wide error code if not.
+    */
+    IMPORT_C void GetPckgAttribute(
+            const TUint aConnectionId,
+            const TUint aSubConnectionId,
+            const TUint aAttribute,
+            TDes8& aValue,
+            TRequestStatus& aStatus ) const;
+
+    /**
+    * Gets the value for a packaged attribute.
+    *
+    * @param aConnectionId Connection ID.
+    * @param aSubConnectionId Subconnection ID. If set to 0, method applies to
+    * connection.
+    * @param aAttribute Identifies the attribute to be retrieved.
+    * @param aValue On completion, contains the requested packaged attribute.
+    * @param aStatus KErrNone if successful, a system-wide error code if not.
+    */
+    IMPORT_C void GetPckgAttribute(
+            const TUint aConnectionId,
+            const TUint aSubConnectionId,
+            const TUint aAttribute,
+            TDes16& aValue,
+            TRequestStatus& aStatus ) const;
+
+    /**
+    * Sets the value for a TInt attribute.
+    *
+    * @param aConnectionId Connection ID.
+    * @param aSubConnectionId Subconnection ID. If set to 0, method applies to
+    * connection.
+    * @param aAttribute Identifies the attribute to be set.
+    * @param aValue The value to be set.
+    * @return KErrNone if successful, a system-wide error code if not.
+    */
+    IMPORT_C TInt SetIntAttribute(
+            const TUint aConnectionId,
+            const TUint aSubConnectionId,
+            const TUint aAttribute,
+            const TInt aValue ) const;
+
+    /**
+    * Sets the value for a TUint attribute.
+    *
+    * @param aConnectionId Connection ID.
+    * @param aSubConnectionId Subconnection ID. If set to 0, method applies to
+    * connection.
+    * @param aAttribute Identifies the attribute to be set.
+    * @param aValue The value to be set.
+    * @return KErrNone if successful, a system-wide error code if not.
+    */
+    IMPORT_C TInt SetUintAttribute(
+            const TUint aConnectionId,
+            const TUint aSubConnectionId,
+            const TUint aAttribute,
+            const TUint aValue ) const;
+
+    /**
+    * Sets the value for a TBool attribute.
+    *
+    * This method can be used to stop a connection (KConnectionStop).
+    * @param aConnectionId Connection ID.
+    * @param aSubConnectionId Subconnection ID. If set to 0, method applies to
+    * connection.
+    * @param aAttribute Identifies the attribute to be set.
+    * @param aValue The value to be set.
+    * @return KErrNone if successful, a system-wide error code if not.
+    */
+    IMPORT_C TInt SetBoolAttribute(
+            const TUint aConnectionId,
+            const TUint aSubConnectionId,
+            const TUint aAttribute,
+            const TBool aValue ) const;
+
+    /**
+    * Sets the value for a string attribute.
+    *
+    * @param aConnectionId Connection ID.
+    * @param aSubConnectionId Subconnection ID. If set to 0, method applies to
+    * connection.
+    * @param aAttribute Identifies the attribute to be set.
+    * @param aValue The string value to be set. Must be a 16-bit descriptor.
+    * @return KErrNone if successful, a system-wide error code if not.
+    */
+    IMPORT_C TInt SetStringAttribute(
+            const TUint aConnectionId,
+            const TUint aSubConnectionId,
+            const TUint aAttribute,
+            const TDes& aValue ) const;
+
+    /**
+    * Sets the value for a packaged attribute. There is currently no packaged
+    * attributes that can be set.
+    *
+    * @param aConnectionId Connection ID.
+    * @param aSubConnectionId Subconnection ID. If set to 0, method applies to
+    * connection.
+    * @param aAttribute Identifies the attribute to be set.
+    * @param aValue The value to be set.
+    * @return KErrNone if successful, a system-wide error code if not.
+    */
+    IMPORT_C TInt SetPckgAttribute(
+            const TUint aConnectionId,
+            const TUint aSubConnectionId,
+            const TUint aAttribute,
+            const TDes8& aValue ) const;
+
+    /**
+    * Cancels an asyncronous request. If there is several active requests of
+    * the same type (for example GetIntAttribute), they will all be cancelled.
+    * When a request is cancelled, it is completed with error code KErrCancel.
+    *
+    * @param aReqToCancel Identifies the request type to be cancelled.
+    * The different types are defined in TConnMonAsyncRequest.
+    */
+    IMPORT_C void CancelAsyncRequest( TInt aReqToCancel );
+
+    /**
+    * Registers an event observer to catch connection monitor events.
+    *
+    * @param aObserver The event observer.
+    * @return KErrNone if successful, a system-wide error code if not.
+    */
+    IMPORT_C TInt NotifyEventL( MConnectionMonitorObserver& aObserver );
+
+    /**
+    * Cancels the notifications from connection monitor.
+    */
+    IMPORT_C void CancelNotifications();
+
+private:
+    void ReceiveEvent(
+            TDes8& aBuffer,
+            TDes8& aExtraBuf,
+            TRequestStatus& aStatus );
+    void CancelReceiveEvent();
+    TBool IsConnected() const;
+    TPtr8& NextPtr();
+
+private:
+    CConnMonEventHandler* iHandler;
+    RArray<TPtr8> iPtrArray;
+    TInt iIndex;
+
+private:
+    friend class CConnMonEventHandler;
+    };
+
+/**
+* Base class for all ConnMon event types.
+*
+* Example how to convert an event according to type.
+* @code
+* void CMyConnMonObserver::EventL( const CConnMonEventBase& aEvent )
+*     {
+*     switch( aEvent.EventType() )
+*         {
+*         case EConnMonCreateConnection:
+*             CConnMonCreateConnection* realEvent;
+*             realEvent = (CConnMonCreateConnection*) &aEvent;
+*             //...
+* @endcode
+*/
+NONSHARABLE_CLASS( CConnMonEventBase ) : public CBase
+    {
+public:
+    /**
+    * Constructor.
+    *
+    * @param aEventType Event type.
+    * @param iConnectionId Connection ID.
+    */
+    CConnMonEventBase( const TInt aEventType, const TUint iConnectionId );
+
+    /**
+    * Destructor.
+    */
+    ~CConnMonEventBase();
+
+public:
+    /**
+    * Gets the type of the event.
+    *
+    * @return Type of the event. Values are defined in TConnMonEventType.
+    */
+    IMPORT_C TInt EventType() const;
+
+    /**
+    * Gets the connection ID of the connection.
+    *
+    * @return Connection ID.
+    */
+    IMPORT_C TUint ConnectionId() const;
+
+private:
+    TInt iEventType;
+    TUint iConnectionId;
+    };
+
+/**
+* This event is triggered when a new connection has been created. The
+* connection ID passed in the event is a new ID number that ConnMon assigned to
+* the new connection.
+*
+* @lib CONNMON.LIB
+*/
+NONSHARABLE_CLASS( CConnMonCreateConnection ) : public CConnMonEventBase
+    {
+public:
+    /**
+    * Constructor.
+    *
+    * @param aConnectionId Connection ID.
+    */
+    CConnMonCreateConnection( const TUint aConnectionId );
+
+    /**
+    * Destructor.
+    */
+    ~CConnMonCreateConnection();
+    };
+
+/**
+* This event is triggered when a connection has been deleted. The connection ID
+* passed in the event is the connection ID of the deleted connection.
+*
+* @lib CONNMON.LIB
+*/
+NONSHARABLE_CLASS( CConnMonDeleteConnection ) : public CConnMonEventBase
+    {
+public:
+    /**
+    * Constructor.
+    *
+    * @param aConnectionId Connection ID.
+    * @param aDownlinkData Downlink data volume.
+    * @param aUplinkData Uplink data volume.
+    * @param aAuthDelete Was connection stopped in an authoritative way.
+    */
+    CConnMonDeleteConnection(
+            const TUint aConnectionId,
+            const TUint aDownlinkData,
+            const TUint aUplinkData,
+            const TBool aAuthDelete );
+
+    /**
+    * Destructor.
+    */
+    ~CConnMonDeleteConnection();
+
+public:
+    /**
+    * Gets the downlink data volume.
+    *
+    * @return Downlink data volume in bytes.
+    */
+    IMPORT_C TUint DownlinkData() const;
+
+    /**
+    * Gets the uplink data volume.
+    *
+    * @return Uplink data volume in bytes.
+    */
+    IMPORT_C TUint UplinkData() const;
+
+    /**
+    * Checks if the connection was stopped in an authoritative way.
+    * ETrue will be returned if the user has deactivated the connection by
+    * using Connection Monitor or if some application has issued
+    * RConnection::Stop( RConnection::EStopAuthoritative ).
+    *
+    * @return ETrue if connection has been deactivated in an authoritative
+    * way, otherwise returns EFalse.
+    */
+    IMPORT_C TBool AuthoritativeDelete() const;
+
+private:
+    TUint iDownlinkData;
+    TUint iUplinkData;
+    TBool iAuthDelete;
+    };
+
+/**
+* This event is triggered when a new subconnection has been created.
+* Subconnections are not supported currently.
+*
+* @lib CONNMON.LIB
+*/
+NONSHARABLE_CLASS( CConnMonCreateSubConnection ) : public CConnMonEventBase
+    {
+public:
+    /**
+    * Constructor.
+    *
+    * @param aConnectionId Connection ID.
+    * @param aSubConnectionId Subconnection ID.
+    */
+    CConnMonCreateSubConnection(
+            const TUint aConnectionId,
+            const TUint aSubConnectionId );
+
+    /**
+    * Destructor.
+    */
+    ~CConnMonCreateSubConnection();
+
+public:
+    /**
+    * Gets the new subconnection ID.
+    *
+    * @return Subconnection ID.
+    */
+    IMPORT_C TUint SubConnectionId() const;
+
+private:
+    TUint iSubConnectionId;
+    };
+
+/**
+* This event is triggered when a subconnection has been deleted.
+* Subconnections are not supported currently.
+*
+* @lib CONNMON.LIB
+*/
+NONSHARABLE_CLASS( CConnMonDeleteSubConnection ) : public CConnMonEventBase
+    {
+public:
+    /**
+    * Constructor.
+    *
+    * @param aConnectionId Connection ID.
+    * @param aSubConnectionId Subconnection ID.
+    * @param aDownlinkData Downlink data volume.
+    * @param aUplinkData Uplink data volume.
+    * @param aAuthDelete Was connection stopped in an authoritative way.
+    */
+    CConnMonDeleteSubConnection(
+            const TUint aConnectionId,
+            const TUint aSubConnectionId,
+            const TUint aDownlinkData,
+            const TUint aUplinkData,
+            const TBool aAuthDelete );
+
+    /**
+    * Destructor.
+    */
+    ~CConnMonDeleteSubConnection();
+
+public:
+    /**
+    * Gets the subconnection ID of the deleted subconnection.
+    *
+    * @return Subconnection ID.
+    */
+    IMPORT_C TUint SubConnectionId() const;
+
+    /**
+    * Gets the downlink data volume.
+    *
+    * @return Downlink data volume in bytes.
+    */
+    IMPORT_C TUint DownlinkData() const;
+
+    /**
+    * Gets the uplink data volume.
+    *
+    * @return Uplink data volume in bytes.
+    */
+    IMPORT_C TUint UplinkData() const;
+
+    /**
+    * Checks if the connection was stopped in an authoritative way.
+    * ETrue will be returned if the user has deactivated the connection by
+    * using Connection Monitor or if some application has issued
+    * RConnection::Stop( RConnection::EStopAuthoritative ).
+    *
+    * @return ETrue if connection has been deactivated in an authoritative
+    * way, otherwise returns EFalse.
+    */
+    IMPORT_C TBool AuthoritativeDelete() const;
+
+private:
+    TUint iSubConnectionId;
+    TUint iDownlinkData;
+    TUint iUplinkData;
+    TBool iAuthDelete;
+    };
+
+/**
+* This event is triggered when there is a sufficient change in the volume of
+* downlink data for a specific connection. The event is sent each time a client
+* specified amount (KDownlinkDataThreshold) of new data has been sent. If
+* another ConnMon client has requested for these events for the same
+* connection, the smallest threshold value will be used globally. If
+* KDownlinkDataThreshold is 0 (default), events will not be sent for that
+* connection. To prevent rapid flooding of these events, different bearers have
+* appropriate minimum threshold values which will be used to override too small
+* thresholds when necessary.
+*
+* @lib CONNMON.LIB
+*/
+NONSHARABLE_CLASS( CConnMonDownlinkDataThreshold ) : public CConnMonEventBase
+    {
+public:
+    /**
+    * Constructor.
+    *
+    * @param aConnectionId Connection ID.
+    * @param aSubConnectionId Subconnection ID.
+    * @param aDownlinkData Downlink data volume.
+    */
+    CConnMonDownlinkDataThreshold(
+            const TUint aConnectionId,
+            const TUint aSubConnectionId,
+            const TUint aDownlinkData );
+
+    /**
+    * Destructor.
+    */
+    ~CConnMonDownlinkDataThreshold();
+
+public:
+    /**
+    * Gets the subconnection ID.
+    *
+    * @return Subconnection ID.
+    */
+    IMPORT_C TUint SubConnectionId() const;
+
+    /**
+    * Gets the downlink data volume.
+    *
+    * @return Downlink data volume in bytes.
+    */
+    IMPORT_C TUint DownlinkData() const;
+
+private:
+    TUint iSubConnectionId;
+    TUint iDownlinkData;
+    };
+
+/**
+* This event is triggered when there is a sufficient change in the volume of
+* uplink data for a specific connection. The event is sent each time a client
+* specified amount (KUplinkDataThreshold) of new data has been received. If
+* another ConnMon client has requested for these events for the same
+* connection, the smallest threshold value will be used globally. If
+* KUplinkDataThreshold is 0 (default), events will not be sent for that
+* connection. To prevent rapid flooding of these events, different bearers have
+* appropriate minimum threshold values which will be used to override too small
+* thresholds when necessary.
+*
+* @lib CONNMON.LIB
+*/
+NONSHARABLE_CLASS( CConnMonUplinkDataThreshold ) : public CConnMonEventBase
+    {
+public:
+    /**
+    * Constructor.
+    *
+    * @param aConnectionId Connection ID.
+    * @param aSubConnectionId Subconnection ID.
+    * @param aUplinkData Uplink data volume.
+    */
+    CConnMonUplinkDataThreshold(
+            const TUint aConnectionId,
+            const TUint aSubConnectionId,
+            const TUint aUplinkData );
+
+    /**
+    * Destructor.
+    */
+    ~CConnMonUplinkDataThreshold();
+
+public:
+    /**
+    * Gets the subconnection ID.
+    *
+    * @return Subconnection ID.
+    */
+    IMPORT_C TUint SubConnectionId() const;
+
+    /**
+    * Gets the uplink data volume.
+    *
+    * @return Uplink data volume in bytes.
+    */
+    IMPORT_C TUint UplinkData() const;
+
+private:
+    TUint iSubConnectionId;
+    TUint iUplinkData;
+    };
+
+/**
+* This event is triggered when network status changes for some packet data
+* connection. The connection ID passed in the event is a bearer specific
+* connection ID (see TConnMonBearerId). The same information can be retrieved
+* with TInt attribute KNetworkStatus.
+*
+* @lib CONNMON.LIB
+*/
+NONSHARABLE_CLASS( CConnMonNetworkStatusChange ) : public CConnMonEventBase
+    {
+public:
+    /**
+    * Constructor.
+    *
+    * @param aConnectionId Connection ID.
+    * @param aNetworkStatus Network status.
+    */
+    CConnMonNetworkStatusChange(
+            const TUint aConnectionId,
+            const TInt aNetworkStatus );
+
+    /**
+    * Destructor.
+    */
+    ~CConnMonNetworkStatusChange();
+
+public:
+    /**
+    * Gets the network status.
+    *
+    * @return Network status. Values are defined in TConnMonNetworkStatus.
+    */
+    IMPORT_C TInt NetworkStatus() const;
+
+private:
+    TInt iNetworkStatus;
+    };
+
+/**
+* This event is triggered when the status of some connection changes.
+* The same information can be retrieved with TInt attribute KConnectionStatus.
+* Connection status values are defined in nifvar.h.
+*
+* @lib CONNMON.LIB
+*/
+NONSHARABLE_CLASS( CConnMonConnectionStatusChange ) : public CConnMonEventBase
+    {
+public:
+    /**
+    * Constructor.
+    *
+    * @param aConnectionId Connection ID.
+    * @param aSubConnectionId Subconnection ID.
+    * @param aConnectionStatus Connection status.
+    */
+    CConnMonConnectionStatusChange(
+            const TUint aConnectionId,
+            const TUint aSubConnectionId,
+            const TInt aConnectionStatus );
+
+    /**
+    * Destructor.
+    */
+    ~CConnMonConnectionStatusChange();
+
+public:
+    /**
+    * Gets the subconnection ID.
+    *
+    * @return Subconnection ID.
+    */
+    IMPORT_C TUint SubConnectionId() const;
+
+    /**
+    * Gets the connection status.
+    *
+    * @return Connection status. Values are defined in nifvar.h.
+    */
+    IMPORT_C TInt ConnectionStatus() const;
+
+private:
+    TUint iSubConnectionId;
+    TInt iConnectionStatus;
+    };
+
+/**
+* This event is triggered when some connection changes from active to idle or
+* vice versa. The client must set KActivityTimeThreshold to receive these
+* events. KActivityTimeThreshold defines the period (in seconds) for checking
+* wether the connection is active or not. The minimum allowed value is 5
+* seconds. The connection is considered active, if data has been passed during
+* the last period, otherwise it is considered inactive. The same information
+* can be retrieved with TBool attribute KConnectionActive.
+*
+* @lib CONNMON.LIB
+*/
+NONSHARABLE_CLASS( CConnMonConnectionActivityChange ) : public CConnMonEventBase
+    {
+public:
+    /**
+    * Constructor.
+    *
+    * @param aConnectionId Connection ID.
+    * @param aSubConnectionId Subconnection ID.
+    * @param aActivity Connection activity.
+    */
+    CConnMonConnectionActivityChange(
+            const TUint aConnectionId,
+            const TUint aSubConnectionId,
+            const TBool aActivity );
+
+    /**
+    * Destructor.
+    */
+    ~CConnMonConnectionActivityChange();
+
+public:
+    /**
+    * Gets the subconnection ID.
+    *
+    * @return Subconnection ID.
+    */
+    IMPORT_C TUint SubConnectionId() const;
+
+    /**
+    * Gets the connection activity.
+    *
+    * @return ETrue if the connection is active, EFalse if not.
+    */
+    IMPORT_C TBool ConnectionActivity() const;
+
+private:
+    TUint iSubConnectionId;
+    TBool iActivity;
+    };
+
+/**
+* This event is triggered when network registration status (GSM/GPRS/WCDMA)
+* changes. The connection ID passed in the event is a bearer specific
+* connection ID (see TConnMonBearerId). The same information can be retrieved
+* with TInt attribute KNetworkRegistration. Network registration values are
+* defined in TConnMonNetworkRegistration.
+*
+* @lib CONNMON.LIB
+*/
+NONSHARABLE_CLASS( CConnMonNetworkRegistrationChange ) : public CConnMonEventBase
+    {
+public:
+    /**
+    * Constructor.
+    *
+    * @param aConnectionId Connection ID.
+    * @param aRegistrationStatus Network registration status.
+    */
+    CConnMonNetworkRegistrationChange(
+            const TUint aConnectionId,
+            const TInt aRegistrationStatus );
+
+    /**
+    * Destructor.
+    */
+    ~CConnMonNetworkRegistrationChange();
+
+public:
+    /**
+    * Gets the network registration status.
+    *
+    * @return Registration status. Values are defined in
+    * TConnMonNetworkRegistration.
+    */
+    IMPORT_C TInt RegistrationStatus() const;
+
+private:
+    TInt iRegistrationStatus;
+    };
+
+/**
+* This event is triggered when bearer type (GPRS/EdgeGPRS/WCDMA) changes. The
+* connection ID passed in the event is a bearer specific connection ID, either
+* EBearerIdGPRS or EBearerIdWCDMA (see TConnMonBearerId). The new bearer passed
+* in the event can be EBearerGPRS, EBearerEdgeGPRS or EBearerWCDMA (see
+* TConnMonBearerType). The same information can be retrieved with TInt
+* attribute KBearer.
+*
+* Note: If TUint attribute KBearerGroupThreshold is set, these events are
+* disabled and events EConnMonBearerInfoChange and EConnMonBearerGroupChange
+* are used instead. Use these events, for example, if HSDPA related information
+* is required.
+*
+* @lib CONNMON.LIB
+*/
+NONSHARABLE_CLASS( CConnMonBearerChange ) : public CConnMonEventBase
+    {
+public:
+    /**
+    * Constructor.
+    *
+    * @param aConnectionId Connection ID.
+    * @param aBearer Bearer.
+    */
+    CConnMonBearerChange( const TUint aConnectionId, const TInt aBearer );
+
+    /**
+    * Destructor.
+    */
+    ~CConnMonBearerChange();
+
+public:
+    /**
+    * Gets the new bearer.
+    *
+    * @return New bearer. Values are defined in TConnMonBearerType.
+    */
+    IMPORT_C TInt Bearer() const;
+
+private:
+    TInt iBearer;
+    };
+
+/**
+* This event is triggered when signal strength changes. The connection ID
+* passed in the event is a bearer specific connection ID (see
+* TConnMonBearerId). This event is valid only for cellular (GPRS, WCDMA, etc.)
+* bearers and not for other bearers, e.g. WLAN. The client must set
+* KSignalStrengthThreshold to 1 to receive these events.
+*
+* @lib CONNMON.LIB
+*/
+NONSHARABLE_CLASS( CConnMonSignalStrengthChange ) : public CConnMonEventBase
+    {
+public:
+    /**
+    * Constructor.
+    *
+    * @param aConnectionId Connection ID.
+    * @param aSignalStrength Signal strength in dBm.
+    */
+    CConnMonSignalStrengthChange(
+            const TUint aConnectionId,
+            const TInt aSignalStrength );
+
+    /**
+    * Destructor.
+    */
+    ~CConnMonSignalStrengthChange();
+
+public:
+    /**
+    * Gets the signal strength.
+    *
+    * @return Signal strength in dBm.
+    */
+    IMPORT_C TInt SignalStrength() const;
+
+private:
+    TInt iSignalStrength;
+    };
+
+/**
+* This event is triggered when the availability of some bearer changes. The
+* connection ID passed in the event is a bearer specific connection ID (see
+* TConnMonBearerId). The client must set KBearerAvailabilityThreshold to 1 to
+* receive these events. Using this event for detecting changes in WLAN
+* availability requires WLAN background scanning to be enabled.
+*
+* @lib CONNMON.LIB
+*/
+NONSHARABLE_CLASS( CConnMonBearerAvailabilityChange ) : public CConnMonEventBase
+    {
+public:
+    /**
+    * Constructor.
+    *
+    * @param aConnectionId Connection ID.
+    * @param aAvailability Availability of the bearer.
+    */
+    CConnMonBearerAvailabilityChange(
+            const TUint aConnectionId,
+            const TBool aAvailability );
+
+    /**
+    * Destructor.
+    */
+    ~CConnMonBearerAvailabilityChange();
+
+public:
+    /**
+    * Gets the availability of the bearer.
+    *
+    * @return ETrue if the bearer is available, EFalse if not.
+    */
+    IMPORT_C TBool Availability() const;
+
+private:
+    TBool iAvailability;
+    };
+
+/**
+* This event is triggered when a plug-in sends a bearer specific event that is
+* unknown to ConnMon.
+*
+* @lib CONNMON.LIB
+*/
+NONSHARABLE_CLASS( CConnMonGenericEvent ) : public CConnMonEventBase
+    {
+public:
+    /**
+    * Constructor.
+    *
+    * @param aType Event type.
+    * @param aConnectionId Connection ID.
+    * @param aData Pointer to the event data.
+    */
+    CConnMonGenericEvent(
+            const TUint aType,
+            const TUint aConnectionId,
+            TAny* aData );
+
+    /**
+    * Destructor.
+    */
+    ~CConnMonGenericEvent();
+
+public:
+    /**
+    * Gets a pointer to the event data.
+    * The pointer is valid only inside EventL().
+    *
+    * @return Pointer to the event data.
+    */
+    IMPORT_C TAny* Data() const;
+
+private:
+    TAny* iData;
+    };
+
+/**
+* This event is triggered when IAP availability changes. The connection ID
+* passed in the event is the generic connection ID EBearerIdAll. The ID numbers
+* of available IAPs are included in the event (see TConnMonIapInfo). The same
+* information can be retrieved with packaged attribute KIapAvailability.
+*
+* @lib CONNMON.LIB
+*/
+NONSHARABLE_CLASS( CConnMonIapAvailabilityChange ) : public CConnMonEventBase
+    {
+public:
+    /**
+    * Constructor.
+    *
+    * @param aConnectionId Connection ID.
+    * @param aIapInfoPtr Pointer to the IAP availability information.
+    */
+    CConnMonIapAvailabilityChange(
+            const TUint aConnectionId,
+            const TConnMonIapInfo* aIapInfoPtr );
+
+    /**
+    * Destructor.
+    */
+    ~CConnMonIapAvailabilityChange();
+
+public:
+    /**
+    * Gets the IAP availability information.
+    *
+    * @return IAP availability information.
+    */
+    IMPORT_C TConnMonIapInfo IapAvailability() const;
+
+private:
+    TConnMonIapInfo iIapInfo;
+    };
+
+/**
+* This event is triggered when the used WLAN transmit power changes. The
+* connection ID passed in the event is the bearer specific connection ID
+* EBearerIdWLAN. Transmit power is given in milliwatts (mW). The same
+* information can be retrieved with TUint attribute KTransmitPower.
+*
+* @lib CONNMON.LIB
+*/
+NONSHARABLE_CLASS( CConnMonTransmitPowerChange ) : public CConnMonEventBase
+    {
+public:
+    /**
+    * Constructor.
+    *
+    * @param aConnectionId Connection ID.
+    * @param aTransmitPower Transmit power in mW.
+    */
+    CConnMonTransmitPowerChange(
+            const TUint aConnectionId,
+            const TUint aTransmitPower );
+
+    /**
+    * Destructor.
+    */
+    ~CConnMonTransmitPowerChange();
+
+public:
+    /**
+    * Gets the transmit power.
+    *
+    * @return Transmit power in mW.
+    */
+    IMPORT_C TUint TransmitPower() const;
+
+private:
+    TUint iTransmitPower;
+    };
+
+/**
+* This event is triggered when SNAP availability changes. The connection ID
+* passed in the event is the generic connection ID EBearerIdAll. The ID numbers
+* of available SNAPs are included in the event (see TConnMonSNAPInfo). The same
+* information can be retrieved with packaged attributes KSNAPsAvailability and
+* KAvailableSNAPsIds.
+*
+* @lib CONNMON.LIB
+*/
+NONSHARABLE_CLASS( CConnMonSNAPsAvailabilityChange ) : public CConnMonEventBase
+    {
+public:
+    /**
+    * Constructor.
+    *
+    * @param aConnectionId Connection ID.
+    * @param aSNAPsAvailable Number of available SNAPs.
+    * @param aSNAPInfoPtr Pointer to the SNAP availability information.
+    */
+    CConnMonSNAPsAvailabilityChange(
+            const TUint aConnectionId,
+            const TUint aSNAPsAvailable,
+            const TConnMonSNAPInfo* aSNAPInfoPtr );
+
+    /**
+    * Destructor.
+    */
+    ~CConnMonSNAPsAvailabilityChange();
+
+public:
+    /**
+    * Gets the SNAP availability information.
+    *
+    * @return SNAP availability information.
+    */
+    IMPORT_C TConnMonSNAPInfo SNAPAvailability() const;
+
+    /**
+    * Gets the number of available SNAPs.
+    *
+    * @return Number of available SNAPs.
+    */
+    IMPORT_C TUint SNAPsAvailabile() const;
+
+private:
+    TConnMonSNAPInfo iSNAPInfo;
+    TUint iSNAPsAvailable;
+    };
+
+/**
+* This event is triggered when new WLAN networks are detected during a WLAN
+* scan. The connection ID passed in the event is the bearer specific connection
+* ID EBearerIdWLAN. To receive these events, WLAN background scanning must be
+* enabled, or some other mechanism must be used to trigger the necessary WLAN
+* scans.
+*
+* @lib CONNMON.LIB
+*/
+NONSHARABLE_CLASS( CConnMonNewWLANNetworkDetected ) : public CConnMonEventBase
+    {
+public:
+    /**
+    * Constructor.
+    *
+    * @param aConnectionId Connection ID.
+    */
+    CConnMonNewWLANNetworkDetected( const TUint aConnectionId );
+
+    /**
+    * Destructor.
+    */
+    ~CConnMonNewWLANNetworkDetected();
+    };
+
+/**
+* This event is triggered when one or more WLAN networks have been lost since
+* the last WLAN scan. The connection ID passed in the event is the bearer
+* specific connection ID EBearerIdWLAN. To receive these events, WLAN
+* background scanning must be enabled, or some other mechanism must be used to
+* trigger the necessary WLAN scans.
+*
+* @lib CONNMON.LIB
+*/
+NONSHARABLE_CLASS( CConnMonOldWLANNetworkLost ) : public CConnMonEventBase
+    {
+public:
+    /**
+    * Constructor.
+    *
+    * @param aConnectionId Connection ID.
+    */
+    CConnMonOldWLANNetworkLost( const TUint aConnectionId );
+
+    /**
+    * Destructor.
+    */
+    ~CConnMonOldWLANNetworkLost();
+    };
+
+/**
+* This event is triggered when GPRS or WCDMA bearer availability changes, a
+* phone call is started, or a phone call ends. The connection ID passed in the
+* event is a bearer specific connection ID, either EBearerIdGPRS or
+* EBearerIdWCDMA (see TConnMonBearerId).
+*
+* EConnMonPacketDataUnavailable and EConnMonPacketDataAvailable events form a
+* pair. Two events are always sent, one with connection ID EBearerIdGPRS for 2G
+* network, and one with connection ID EBearerIdWCDMA for 3G network. The event
+* for the network that the phone is not registered to is always of type
+* EConnMonPacketDataUnavailable. If the phone does not support dual transfer
+* mode and a call is started, a GPRS or WCDMA packet data connection will be
+* put on hold. In this scenario, both will be of type
+* EConnMonPacketDataUnavailable. The same information can be retrieved with
+* TBool attribute KPacketDataAvailability.
+*
+* @lib CONNMON.LIB
+*/
+NONSHARABLE_CLASS( CConnMonPacketDataUnavailable ) : public CConnMonEventBase
+    {
+public:
+    /**
+    * Constructor.
+    *
+    * @param aConnectionId Bearer specific connection ID, EBearerIdGPRS or
+    * EBearerIdWCDMA.
+    */
+    CConnMonPacketDataUnavailable( const TUint aConnectionId );
+
+    /**
+    * Destructor.
+    */
+    virtual ~CConnMonPacketDataUnavailable();
+    };
+
+/**
+* This event is triggered when GPRS or WCDMA bearer availability changes, a
+* phone call is started, or a phone call ends. The connection ID passed in the
+* event is a bearer specific connection ID, either EBearerIdGPRS or
+* EBearerIdWCDMA (see TConnMonBearerId).
+*
+* EConnMonPacketDataAvailable and EConnMonPacketDataUnavailable events form a
+* pair. Two events are always sent, one with connection ID EBearerIdGPRS for 2G
+* network, and one with connection ID EBearerIdWCDMA for 3G network. The event
+* for the network that the phone is not registered to is always of type
+* EConnMonPacketDataUnavailable. If the phone does not support dual transfer
+* mode and a call is started, a GPRS or WCDMA packet data connection will be
+* put on hold. In this scenario, both will be of type
+* EConnMonPacketDataUnavailable. The same information can be retrieved with
+* TBool attribute KPacketDataAvailability.
+*
+* @lib CONNMON.LIB
+*/
+NONSHARABLE_CLASS( CConnMonPacketDataAvailable ) : public CConnMonEventBase
+    {
+public:
+    /**
+    * Constructor.
+    *
+    * @param aConnectionId Bearer specific connection ID, EBearerIdGPRS or
+    * EBearerIdWCDMA.
+    */
+    CConnMonPacketDataAvailable( const TUint aConnectionId );
+
+    /**
+    * Destructor.
+    */
+    virtual ~CConnMonPacketDataAvailable();
+    };
+
+/**
+* This event is triggered when there is a change in bearer information for an
+* existing connection, or if the network mode changes e.g. from 2G to 3G. For
+* connection specific events, the connection ID passed in the event is the
+* respective connection specific ID, and for network level events, the
+* connection ID is EBearerIdAll. The same connection level information can be
+* retrieved with TInt attribute KBearerInfo. The bearer info values are defined
+* in TConnMonBearerInfo.
+*
+* Note: The client needs to set the TUint attribute KBearerGroupThreshold in
+* order to receive these events. This also disables EConnMonBearerChange events.
+*
+* @lib CONNMON.LIB
+*/
+NONSHARABLE_CLASS( CConnMonBearerInfoChange ) : public CConnMonEventBase
+    {
+public:
+    /**
+    * Constructor.
+    *
+    * @param aConnectionId Connection ID.
+    * @param aBearerInfo Bearer information.
+    */
+    CConnMonBearerInfoChange(
+            const TUint aConnectionId,
+            const TInt aBearerInfo );
+
+    /**
+    * Destructor.
+    */
+    ~CConnMonBearerInfoChange();
+
+public:
+    /**
+    * Gets the new bearer information. Values are defined in TConnMonBearerInfo.
+    *
+    * @return New bearer information.
+    */
+    IMPORT_C TInt BearerInfo() const;
+
+private:
+    TInt iBearerInfo;
+    };
+
+/**
+* This event is triggered when there is a change in bearer group information
+* for an existing connection. The connection ID passed in the event is the
+* respective connection specific ID. The same information can be retrieved with
+* packaged attribute KBearerGroupInfo. The bearer group bitmask is defined in
+* TConnMonBearerGroup.
+*
+* Note: The client needs to set the TUint attribute KBearerGroupThreshold in
+* order to receive these events. This also disables EConnMonBearerChange events.
+*
+* @lib CONNMON.LIB
+*/
+NONSHARABLE_CLASS( CConnMonBearerGroupChange ) : public CConnMonEventBase
+    {
+public:
+    /**
+    * Constructor.
+    *
+    * @param aConnectionId Connection ID.
+    * @param aBearerGroups1 First bearer group bitmask.
+    * @param aBearerGroups2 Second bearer group bitmask.
+    * @param aInternal ETrue if connection is internal, EFalse if external.
+    */
+    CConnMonBearerGroupChange(
+            const TUint aConnectionId,
+            const TUint aBearerGroups1,
+            const TUint aBearerGroups2,
+            const TBool aInternal );
+
+    /**
+    * Destructor.
+    */
+    ~CConnMonBearerGroupChange();
+
+public:
+    /**
+    * Gets the new bearer groups. Values are defined in TConnMonBearerGroup.
+    *
+    * @param aBearerGroups1 Will contain the first bearer group bitmask.
+    * @param aBearerGroups2 Will contain the second bearer group bitmask.
+    */
+    IMPORT_C void BearerGroups(
+            TUint& aBearerGroups1,
+            TUint& aBearerGroups2 ) const;
+
+    /**
+    * Gets the information whether the current connection bearer is internal
+    * or external.
+    *
+    * @return ETrue if the bearer is internal and EFalse if external.
+    */
+    IMPORT_C TBool Internal() const;
+
+private:
+    TBool iInternal;      // ETrue for internal, EFalse for external connection.
+    TUint iBearerGroups1; // Contains the groups as bitmask.
+    TUint iBearerGroups2; // Reserved for the future use.
+    };
+
+#endif // __CONNECTIONMONITOR_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/connection_settings_api/connection_settings_api.metaxml	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,18 @@
+<?xml version="1.0" ?>
+<api id="3f8fa8d82ca454018ee9cf6252124ca6" dataversion="1.0">
+  <name>Connection Settings API</name>
+  <description>Provides functionality to read and write Destinations and Connection Methods. The API does not provide UI functionality.</description>
+  <type>c++</type>
+  <subsystem>cmmanager</subsystem>
+  <libs>
+    <lib name="cmmanager.lib" />
+  </libs>
+  <release category="sdk" sinceversion="3.2"/>
+  <attributes>
+     <!-- This indicates wether the api provides separate html documentation -->
+     <!-- or is the additional documentation generated from headers. -->
+     <!-- If you are unsure then the value is "no" -->
+     <htmldocprovided>yes</htmldocprovided>
+     <adaptation>no</adaptation>
+  </attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/connection_settings_api/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,43 @@
+/*
+* 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:  File that exports the files belonging to 
+:                Connection Settings API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/cmconnectionmethod.inl     MW_LAYER_PUBLIC_EXPORT_PATH(cmconnectionmethod.inl)
+../inc/cmplugindialcommondefs.h     MW_LAYER_PUBLIC_EXPORT_PATH(cmplugindialcommondefs.h)
+../inc/cmdefconnvalues.h     MW_LAYER_PUBLIC_EXPORT_PATH(cmdefconnvalues.h)
+../inc/cmpluginpacketdatadef.h     MW_LAYER_PUBLIC_EXPORT_PATH(cmpluginpacketdatadef.h)
+../inc/cmmanager.inl     MW_LAYER_PUBLIC_EXPORT_PATH(cmmanager.inl)
+../inc/cmconnectionmethod.h     MW_LAYER_PUBLIC_EXPORT_PATH(cmconnectionmethod.h)
+../inc/cmconnectionmethoddef.h     MW_LAYER_PUBLIC_EXPORT_PATH(cmconnectionmethoddef.h)
+../inc/cmdestination.h     MW_LAYER_PUBLIC_EXPORT_PATH(cmdestination.h)
+../inc/cmpluginembdestinationdef.h     MW_LAYER_PUBLIC_EXPORT_PATH(cmpluginembdestinationdef.h)
+../inc/cmplugincsddef.h     MW_LAYER_PUBLIC_EXPORT_PATH(cmplugincsddef.h)
+../inc/cmmanagerdef.h     MW_LAYER_PUBLIC_EXPORT_PATH(cmmanagerdef.h)
+../inc/cmpluginwlandef.h     MW_LAYER_PUBLIC_EXPORT_PATH(cmpluginwlandef.h)
+../inc/cmpluginvpndef.h     MW_LAYER_PUBLIC_EXPORT_PATH(cmpluginvpndef.h)
+../inc/cmpluginhscsddef.h     MW_LAYER_PUBLIC_EXPORT_PATH(cmpluginhscsddef.h)
+../inc/cmmanager.h     MW_LAYER_PUBLIC_EXPORT_PATH(cmmanager.h)
+../inc/cmsettingsui.h     MW_LAYER_PUBLIC_EXPORT_PATH(cmsettingsui.h)
+../inc/cmgenconnsettings.h     MW_LAYER_PUBLIC_EXPORT_PATH(cmgenconnsettings.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/connection_settings_api/inc/cmconnectionmethod.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,217 @@
+/*
+* 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:  Connection Method interface class.
+*
+*/
+
+#ifndef CMCONNECTIONMETHOD_H
+#define CMCONNECTIONMETHOD_H
+
+// INCLUDES
+#include <e32base.h>
+#include <cmconnectionmethoddef.h>
+
+// CLASS DECLARATION
+class CCmPluginBaseEng;
+class RCmDestination;
+
+/**
+ *  RCmConnectionMethod is for getting/setting values of a connection method.
+ *  @lib cmmanager.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( RCmConnectionMethod )
+    {
+    //=====================================================================
+    // Constructors/Destructors
+    // 
+    public:
+    
+        /**
+        * Default constructor. 
+        */
+        IMPORT_C RCmConnectionMethod();
+
+
+        /**
+        * Copy constructor. 
+        */
+        IMPORT_C RCmConnectionMethod(const RCmConnectionMethod& aItem);
+
+
+        /**
+        * Destructor. 
+        */
+        IMPORT_C ~RCmConnectionMethod();
+
+    //=====================================================================
+    // API functions
+    public:
+    
+        /**
+        * Close the session
+        *
+        * @since S60 3.2
+        */
+        IMPORT_C void Close();
+        
+        /**
+        * Gets the value for a TInt attribute.
+        *
+        * @since S60 3.2
+        * @param aAttribute Identifies the attribute to be retrieved.
+        * @return contains the requested TInt attribute.
+        */
+        IMPORT_C TUint32 GetIntAttributeL( TUint32 aAttribute ) const;
+
+        /**
+        * Gets the value for a TBool attribute.
+        *
+        * @since S60 3.2
+        * @param aAttribute Identifies the attribute to be retrieved.
+        * @return contains the requested TBool attribute.
+        */
+        IMPORT_C TBool GetBoolAttributeL( TUint32 aAttribute ) const;
+
+        /**
+        * Gets the value for a String16 attribute.
+        * HBuf ownership is passed to the caller
+        *
+        * @since S60 3.2
+        * @param aAttribute Identifies the attribute to be retrieved.
+        * @return copy of the requested attribute. Ownership is passed.
+        */
+        IMPORT_C HBufC* GetStringAttributeL( TUint32 aAttribute ) const;
+        
+        /**
+        * Gets the value for a String8 attribute.
+        * HBuf ownership is passed to the caller
+        *
+        * @since S60 3.2
+        * @param aAttribute Identifies the attribute to be retrieved.
+        * @return copy of the requested attribute. Ownership is passed.
+        */
+        IMPORT_C HBufC8* GetString8AttributeL( 
+                                        const TUint32 aAttribute ) const;
+
+        /**
+        * Call this function only if this CM is an embedded destination!
+        *
+        * @since S60 3.2
+        * @return embedded destination
+        */
+        IMPORT_C RCmDestination DestinationL() const;
+
+        
+        /**
+        * checks if connection methods are the same 
+        * 
+        * @since S60 3.2
+        * @param aConnMethod the connection method being compared
+        * @return ETrue if the destinations are the same
+        */
+        IMPORT_C TBool operator==( RCmConnectionMethod& aConnMethod ) const;
+        
+        /**
+        * checks if connection methods are not the same 
+        * 
+        * @since S60 3.2
+        * @param aConnMethod the connection method being compared
+        * @return ETrue if the destinations are different
+        */
+        IMPORT_C TBool operator!=( RCmConnectionMethod& aConnMethod ) const;
+        
+
+        /**
+        * assignment operator 
+        * 
+        * @since S60 3.2
+        * @return RCmConnectionMethod
+        */
+        IMPORT_C RCmConnectionMethod& operator=(const RCmConnectionMethod& 
+                                                    aConnMethod);
+
+        /**
+        * Creates a copy of this connection method. UpdateL() has to be called 
+        * to store new connection method in database. Ownership is passed.
+        */
+        IMPORT_C RCmConnectionMethod CreateCopyL();
+
+                /**
+        * Sets the value for a TInt attribute.
+        * @param aAttribute Identifies the attribute to be set.
+        * @param aValue The value to be set.
+        * @return None.
+        */
+        IMPORT_C void SetIntAttributeL( TUint32 aAttribute, TUint32 aValue );
+
+        /**
+        * Sets the value for a TBool attribute.
+        * @param aAttribute Identifies the attribute to be set.
+        * @param aValue The value to be set.
+        * @return None.
+        */
+        IMPORT_C void SetBoolAttributeL( TUint32 aAttribute, TBool aValue );
+
+        /**
+        * Sets the value for a String16 attribute.
+        * @param aAttribute Identifies the attribute to be set.
+        * @param aValue The value to be set.
+        * @return None.
+        */
+        IMPORT_C void SetStringAttributeL( TUint32 aAttribute, 
+                                           const TDesC16& aValue );
+
+        /**
+        * Sets the value for a String8 attribute.
+        * @param aAttribute Identifies the attribute to be set.
+        * @param aValue The value to be set.
+        * @return None.
+        */
+        IMPORT_C void SetString8AttributeL( TUint32 aAttribute, 
+                                            const TDesC8& aValue );
+
+        /**
+        * Try to delete the connection method. If it is referenced from 
+        * any destination, then the references are removed and the 
+        * connection method is deleted.
+        * Do NOT call this function if you got this
+        * connection method from a destination. Call destination's
+        * DeleteConnectionMethodL() function instead.
+        * @return ETrue if connection method deleted.
+        */
+        IMPORT_C TBool DeleteL();
+
+        /**
+        * Update in the database.
+        * @return None.
+        */        
+        IMPORT_C void UpdateL();
+
+    private:
+    
+        friend class RCmDestination;
+        friend class RCmManager;
+        
+    private:
+        
+        /**
+         * the implementation class
+         */
+        CCmPluginBaseEng* iImplementation;
+    };
+
+#include <cmconnectionmethod.inl>
+    
+#endif      // CMCONNECTIONMETHOD_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/connection_settings_api/inc/cmconnectionmethod.inl	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,18 @@
+/*
+* 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 cmconnectionmethod.h inline functions
+*
+*/
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/connection_settings_api/inc/cmconnectionmethoddef.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,761 @@
+/*
+* 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:  Definition of attributes used by every Connection Methods.
+*
+*/
+
+#ifndef CMCONNECTIONMETHODDEF_H
+#define CMCONNECTIONMETHODDEF_H
+
+// INCLUDES
+#include <e32base.h>
+
+// CONSTANTS
+
+// Beginning of the CMManager enum range (internal use)
+const TUint KLanBaseSpecificAttributes = 20000;
+const TUint KLanBaseIfNetworks = 20100; 
+// End of the CMManager enum range (internal use)
+const TUint KLanBaseRangeMax = 29999;
+
+/**  ECOM interface UID */
+const TUint KCMPluginInterfaceUid = 0x10207377;
+
+namespace CMManager
+    {
+    //Enumeration for possible values of seamlessness field 
+    //in IAP Metadata table 
+    /**  Naming method options */
+    enum TNamingMethod
+        {
+        ENamingNothing,     ///< Do nothing with name set via ECmName
+        ENamingUnique,      ///< Make name unique when ECmName is set.
+        ENamingNotAccept    ///< Do not accept duplication. It will leave with
+                            ///< KErrArgument.
+        };
+    
+    // Enumeration for IPv6 types
+    enum TIPv6Types
+        {
+        EIPv6Unspecified,   ///< Unspecified IPv6 type
+        EIPv6WellKnown,     ///< Well known IPv6 type
+        EIPv6UserDefined    ///< User defined IPv6 type
+        };
+    
+    enum TSeamlessnessValue
+        {
+        ESeamlessnessNotRoamedTo,   // NOT supported
+        ESeamlessnessConfirmFirst,  // Confirm first
+        ESeamlessnessShowprogress,  // Shows progress
+        ESeamlessnessFullySeamless  // NOT supported
+        };
+    
+    
+    /// Unspecified IPv4 address
+    _LIT( KUnspecifiedIPv4, "0.0.0.0" );
+    
+    /// Known IPv6 name server 1
+    _LIT( KKnownIp6NameServer1, "fec0:000:0000:ffff::1" );
+    /// Known IPv6 name server 2
+    _LIT( KKnownIp6NameServer2, "fec0:000:0000:ffff::2" );
+    
+    /// Dynamic IPv6 address
+    _LIT( KDynamicIpv6Address, "0:0:0:0:0:0:0:0" );
+
+    /// Default proxy protocol name
+    _LIT( KDefProxyProtocolName, "http" );
+    
+    /// Default proxy port number
+    _LIT( KDefaultProxyPortNumber, "0" );
+
+    /// IPv4 network protocol
+    _LIT( KDefIspIfNetworksIPv4, "ip" );
+    /// IPv6 network protocol
+    _LIT( KDefIspIfNetworksIPv6, "ip6" );
+    /// IPv4 and IPv6 network protocols
+    _LIT( KDefIspIfNetworksIPv4IPv6, "ip,ip6" );
+    /// IPv4 and IPv6 network protocols for LAN bearers
+    _LIT( KDefIspIfNetworksIPv4IPv6LAN, "ip" );
+
+    _LIT( KDaemonManagerName, "NetCfgExtnDhcp" );
+    _LIT( KConfigDaemonName, "!DhcpServ" );
+
+
+    /**
+    * This enum lists all the common attributes of Connection Methods.
+    */
+    enum TConnectionMethodCommonAttributes
+        {
+        /**
+        * The following attributes can be queried via both 
+        * the manager interface's and connection method interface's ::Get functions.
+        */
+        ECmCoverage,                /**<
+                                    * Checks if there's coverage for this bearer.
+                                    * (TBool - default: none - read only)
+                                    */
+                        
+        ECmDefaultPriority,         /**<
+                                    * Default global priority of the CM's bearer 
+                                    * type.
+                                    * (TUint32 - default: none - read only)
+                                    */
+                        
+        ECmDestination,             /**<
+                                    * ETrue if this connection method is 
+                                    * an embedded destination.
+                                    * (TBool - default: none - read only)
+                                    */
+                            
+        ECmBearerHasUi,             /**<
+                                    * Indicates whether the bearer has any UI.
+                                    * (TBool - default: none - read only)
+                                    */
+
+        ECmIPv6Supported,           /**<
+                                    * Returns ETrue if IPv6 is supported.
+                                    * (TBool - default: none - read only)
+                                    */
+                                    
+        ECmDefaultUiPriority,       /**<
+                                    * Priority of this bearer type when shown in UI for 
+                                    * configuring a new IAP.
+                                    * (TUint32 - default: none - read only)
+                                    */
+
+        ECmBearerIcon = 100,        /**<
+                                    * Return the bearer specific icon. Assumes that
+                                    * there's an existing EEikEnv in the client.                        
+                                    * Type cast return value from TUint32 to 
+                                    * CGuiIcon*.
+                                    * Return value 0 means bearer has no icon.
+                                    * (TUint32 - default: none - read only)
+                                    */ 
+                        
+        ECmBearerAvailableIcon,     /**<
+                                    * Return the bearer available specific icon. 
+                                    * Assumes that there's an existing EEikEnv 
+                                    * in the client. Type cast return value from 
+                                    * TUint32 to CGuiIcon*.
+                                    * Return value 0 means bearer has no icon.
+                                    * (TUint32 - default: none - read only)
+                                    */
+                        
+        ECmBearerAvailableName = 200,   /**<
+                                        * Name of the bearer. Can be used in 
+                                        * layout 
+                                        * list_double_large_graphic_popup_menu_pane.
+                                        * (String - default: none - read only)
+                                        */
+                        
+        ECmBearerSupportedName,     /**<
+                                    * Name of the bearer. Can be used in 
+                                    * layout list_single_popup_menu_pane_1.
+                                    * (String - default: none - read only)
+                                    */
+                        
+        ECmBearerAvailableText,     /**<
+                                    * Localized text 'Available'. Can be used in 
+                                    * layout 
+                                    * list_double_large_graphic_popup_menu_pane.
+                                    * (String - default: none - read only)
+                                    */
+                        
+        ECmBearerNamePopupNote,     /**<
+                                    * Localized text of the bearer type name.
+                                    * Can be used in layout popup note.
+                                    * (String - default: none - read only)
+                                    */
+
+        ECmCommsDBBearerType,       /**<
+                                    * For backward compatibility, connection method
+                                    * can return its CommsDB specific bearer type.
+                                    * (TUint32 - default: none - read only)
+                                    * Leaves with KErrUnknown if no associated bearer 
+                                    * type exists in CommsDat.
+                                    */
+                                
+        ECmBearerSettingName,       /**<
+                                    * Name of the data bearer used when 
+                                    * accessing external network.
+                                    * (String - default: none - read only)
+                                    */
+        
+        ECmVirtual,                 /**<
+                                    * Is the given connection method virtual?
+                                    * (TBool - default: none - read only)
+                                    */
+
+        /**
+        * These are not bearer specific, but controling attributes.
+        */    
+        ECmInvalidAttribute = 400,  /**<
+                                    * Client application can check which attribute 
+                                    * was incorrect in UpdateL().
+                                    * (TUint32 - default: none - read only)
+                                    */
+                                    
+        ECmAddToAvailableList,      /**<
+                                    * Bearer type has to be added to the avaialable
+                                    * bearer type list.
+                                    * (TBool - default: EFalse - read only)
+                                    */                   
+                        
+        ECmLoadResult,              /**<
+                                    * Result of the load process. KErrNone if there
+                                    * was no error. Otherwise a system wide
+                                    * error code.
+                                    * (TUint32 - default: KErrNone - read only)
+                                    */
+        
+        /**
+        * Attributes the can be queried only via
+        * - connection method's GetXXXAttributeL()
+        * - connection manager's function GetConnectionMethodInfoXXXL()
+        * functions
+        */
+        ECmBearerType = 500,        /**<   
+                                    * Bearer type of the CM 
+                                    * (TUint - default: none - read only)
+                                    */
+                        
+        ECmName,                    /**<   
+                                    * Name of the CM
+                                    * (String - default: none)
+                                    */
+        
+        ECmIapId,                   /**<    
+                                    * IAP id
+                                    * (TUint32 - default: none - read only)
+                                    */
+                        
+        ECmStartPage,               /**<
+                                    * Start page of the connection method
+                                    * (String - default: empty string)
+                                    */
+
+        ECmHidden,                  /**<
+                                    * Connection method is hidden. 
+                                    * (not supported yet)
+                                    * (TBool - default: EFalse)
+                                    */
+
+        ECmProtected,               /**<
+                                    * This connection method is protected. 
+                                    * Modifying it needs NetworkControl capability.
+                                    * (TBool - default: EFalse)
+                                    */
+                        
+        ECmNamingMethod,            /**<
+                                    * See acceptable values in TNamingControl.
+                                    * (TUint32 - default: ENamingUnique)
+                                    */             
+        
+        ECmSeamlessnessLevel,   /**<
+                                * Defines whether an IAP can be roamed to.
+                                * See details in TSeamlessnessValue.
+                                * (TUint32 - default: ESeamlessnessConfirmFirst )
+                                */
+                                
+        ECmElementID,           /**<
+                                * Element id of the connection method in IAP table.
+                                * (TUint32 - default: none - read only)
+                                */
+        
+        ECmNetworkId,           /**<
+                                * Network id of the connection method.
+                                * (TUint32 - default: none - read only)
+                                */
+                                
+        ECmConnected,           /**<
+                                * Is network connection created with connection
+                                * method?
+                                * (TBool - default: none - read only)
+                                */
+
+        ECmId,                  /**<    
+                                * ID to uniquely identify the connection
+                                * methods
+                                * It is guaranteed that every connection
+                                * method has an ECmId
+                                * (TUint32 - default: none - read only)
+                                */
+
+        ECmWapId,               /**
+		                        * Provided for backwards compatibility only.
+                                * The record ID of the connection methods' 
+                                * corresponding WAP_ACCESS_POINT record, which
+                                * use had been deprecated as the main ID 
+                                * should now be ECmIapId, ECmElementID or ECmId.
+                                * (TUint32 - default: none - read only)
+                                */
+
+        ECmIapServiceId,        /**
+		                        * Provided for backwards compatibility only.
+                                * The record ID of the connection methods' 
+                                * service record
+                                * (TUint32 - default: none - read only)
+                                */
+
+        /**
+        * The following attributes are stored in the connection method's 
+        * meta data record.
+        */
+        ECmMetaHighlight = 600, /**<
+                                * Set to indicate that this connection method is
+                                * highlighted in Agent dialog. Only one connection
+                                * method can have this flag set.
+                                * (TBool - default: EFalse)
+                                */
+                                
+        ECmMetaHiddenAgent,     /**<
+                                * Set to hide this connection method in Agent
+                                * dialog.
+                                * (TBool - default: EFalse)
+                                */
+                                
+        // These attributes can be used with virtual bearer type
+        // connection methods.
+        ECmNextLayerIapId,      /**<
+                                * Returns the linked connection method's IAP id.
+                                * (TUint32 - default: None)
+                                */
+                                
+        ECmNextLayerSNAPId,     /**<
+                                * Returns the linked connection method's SNAP id.
+                                * (TUint32 - default: None)
+                                */
+        
+        // Proxy attributes
+        ECmProxyUsageEnabled = 1000,    /**<
+                                        * Set to enable/disable proxy setting
+                                        * of connection method.
+                                        * Disabling: record is deleted from proxy 
+                                        * when UpdateL() is called.
+                                        * Proxy record is deleted on UpdateL() 
+                                        * if ECmProxyServerName is an empty string.
+                                        * It can be queried only via the 
+                                        * connection method's GetXXXAttributeL()
+                                        * (TBool: default: EFalse)
+                                        */
+     
+        ECmProxyServerName,             /**<
+                                        * Name of the host.
+                                        * It can be queried only via the 
+                                        * connection method's GetXXXAttributeL()
+                                        * (String - default: none)
+                                        */
+                                        
+        ECmProxyProtocolName,           /**<
+                                        * Name of the protocol for which this proxy 
+                                        * can be used.
+                                        * It can be queried only via the 
+                                        * connection method's GetXXXAttributeL()
+                                        * (String - default: none)
+                                        */
+                                        
+        ECmProxyPortNumber,             /**< 
+                                        * Port number
+                                        * It can be queried only via the 
+                                        * connection method's GetXXXAttributeL()
+                                        * (TUint32 - default: none)
+                                        */
+                                        
+        ECmProxyExceptions,             /**<
+                                        * ";" separated list of the addresses for 
+                                        * which the proxy server should not be used.
+                                        * It can be queried only via the 
+                                        * connection method's GetXXXAttributeL()
+                                        * (String - default: none)
+                                        */
+                                        
+        ECmProxyRangeMax = 1999,        /**<
+                                        * Marks the end of the proxy range
+                                        */
+                                  
+        ECmChargeCardUsageEnabled = 2000,   /**<
+                                            * Same as in ECmProxyUsageEnabled but 
+                                            * for charge card. 
+                                            * (TBool - default: EFalse)
+                                            */      
+                                            
+        ECmChargeCardAccountNumber,         /**<
+                                            * Account number
+                                            * (String - default: none)
+                                            */
+                                            
+        ECmChargeCardPIN,                   /**<
+                                            * PIN number
+                                            * (String - default: none)
+                                            */
+        
+        ECmChargeCardLocalRule,             /**<
+                                            * Order of dialling account number, 
+                                            * PIN and phone number for local calls.
+                                            * (String - default: none)
+                                            */
+                                            
+        ECmChargeCardNatRule,               /**<
+                                            * Order of dialling account number, 
+                                            * PIN and phone number for national 
+                                            * calls.
+                                            * (String - default: none)
+                                            */
+
+        ECmChargeCardIntlRule,              /**<
+                                            * Order of  dialling account number, 
+                                            * PIN and phone number for 
+                                            * international calls.
+                                            * (String - default: none)
+                                            */
+        
+        ECmChargeCardRangeMax = 2999,       /**<
+                                            * Marks the end of the chargecard range
+                                            */
+                                            
+        ECmLocationUsageEnabled = 3000,     /**<
+                                            * Same as in ECmProxyUsageEnabled but 
+                                            * for location. 
+                                            * (TBool - default: EFalse)
+                                            */
+                                            
+        ECmLocationIntlPrefixCode,          /**<
+                                            * International prefix code.
+                                            * (String - default: none)
+                                            */
+                                            
+        ECmLocationNatPrefixCode,           /**<
+                                            * National prefix code.
+                                            * (String - default: none)
+                                            */
+                                            
+        ECmLocationNatCode,                 /**<
+                                            * National code
+                                            * (String - default: none)
+                                            */
+                                            
+        ECmLocationAreaCode,                /**<
+                                            * Area code.
+                                            * (String - default: none)
+                                            */
+                                            
+        ECmLocationDialOutCode,             /**<
+                                            * Number to dial for an outside line.
+                                            * (String - default: none)
+                                            */
+                                            
+        ECmLocationDisableCallWaitingCode,  /**<
+                                            * Code to dial to disable call waiting 
+                                            * facility.
+                                            * (String - default: none)
+                                            */
+                                            
+        ECmLocationMobile,                  /**<
+                                            * Mobile phone?
+                                            * (TBool - default: none)
+                                            */
+                                            
+        ECmLocationUsePulseDial,            /**<
+                                            * Use pulse dialling?
+                                            * (TBool - default: none)
+                                            */
+                                            
+        ECmLocationWaitForDialTone,         /**<
+                                            * Wait for the dial tone?
+                                            * (TBool - default: none)
+                                            */
+                                            
+        ECmLocationPauseAfterDialOut,       /**<
+                                            * Pause time after dial out.
+                                            * (TUint32 - default: none)
+                                            */
+                                            
+        ECmLocationRangeMax = 3999,         /**<
+                                            * Marks the end of the location
+                                            * range
+                                            */
+        
+        // WAP specific attributes
+        ECmWapIPGatewayAddress = 4000,      /**<
+                                            * WAP Gateway address, in this case an 
+                                            * IP address.
+                                            * (String - default: none)
+                                            */
+                                            
+        ECmWapIPWSPOption,          /**<
+                                    * Enum value indicating whether 
+                                    * connection-oriented 
+                                    * or connectionless API should be used.
+                                    * See valid values in TWapWSPOption.
+                                    * (TUint32 - default: 
+                                    * ECmWapWspOptionConnectionless)
+                                    */
+                                            
+        ECmWapIPSecurity,           /**<
+                                    * Attempt secure WTLS connection to the gateway
+                                    * (TBool - default: EFalse)
+                                    */
+        
+        ECmWapIPProxyPort,          /**<
+                                    * Proxy port number. Required for WAP2.0 only.
+                                    * (TUint32 - default: none)
+                                    */
+                                            
+        ECmWapIPProxyLoginName,     /**<
+                                    * Proxy login name. Required for WAP2.0 only.
+                                    * (String - default: none)
+                                    */
+                                            
+        ECmWapIPProxyLoginPass,     /**<
+                                    * Proxy login password. 
+                                    * Required for WAP2.0 only.
+                                    * (String - default: none)
+                                    */
+                                            
+        ECmWapRangeMax = 4099,      /**<
+                                    * Marks the end of the WAP specific range
+                                    */
+
+        /** 
+        * The following attributes are common for many bearer types.
+        * It's not sure that every IF or IP attribute is supported by
+        * all bearer types.
+        * It's not possible to query these attributes via 
+        * GetConnectionInfoXXX() functions.
+        */
+        ECmCommonAttributesStart = 5000, /**<
+                                         * Marks the beginning of the common
+                                         * attributes
+                                         */
+        
+        ECmIFName,                  /**<
+                                    * Interface name
+                                    * It can be queried only via the 
+                                    * connection method's GetXXXAttributeL()
+                                    * (String - default: none)
+                                    */
+                                    
+        ECmIFParams,                /**<
+                                    * Interface parameter string
+                                    * It can be queried only via the 
+                                    * connection method's GetXXXAttributeL()
+                                    * (String - default: none)
+                                    */
+                                    
+        ECmIFNetworks,              /**<
+                                    * List of network protocols
+                                    * It can be queried only via the 
+                                    * connection method's GetXXXAttributeL()
+                                    * (String - default: none)
+                                    */
+                                    
+        ECmIFPromptForAuth,         /**<
+                                    * Prompt user for authentication
+                                    * It can be queried only via the 
+                                    * connection method's GetXXXAttributeL()
+                                    * (TBool - default: none)
+                                    */
+                                    
+        ECmIFAuthName,              /**<
+                                    * Authentication user name used by PPP
+                                    * It can be queried only via the 
+                                    * connection method's GetXXXAttributeL()
+                                    * (String - default: none)
+                                    */
+                                    
+        ECmIFAuthPass,              /**<
+                                    * Authentication password used by PPP
+                                    * It can be queried only via the 
+                                    * connection method's GetXXXAttributeL()
+                                    * (String - default: none)
+                                    */
+                                    
+        ECmIFAuthRetries,           /**<
+                                    * Number of times for retrying authentication
+                                    * if it fails
+                                    * It can be queried only via the 
+                                    * connection method's GetXXXAttributeL()
+                                    * (TUint32 - default: none)
+                                    */
+        
+        ECmIPNetmask = 5050,        /**<
+                                    * IP net mask of interface
+                                    * It can be queried only via the 
+                                    * connection method's GetXXXAttributeL()
+                                    * (String - default: none)
+                                    */
+                                    
+        ECmIPGateway,               /**<
+                                    * IP address of gateway
+                                    * It can be queried only via the 
+                                    * connection method's GetXXXAttributeL()
+                                    * (String - default: none)
+                                    */
+                                    
+        ECmIPAddFromServer,         /**<
+                                    * Get IP address from server?
+                                    * It can be queried only via the 
+                                    * connection method's GetXXXAttributeL()
+                                    * (TBool - default: none)
+                                    */
+                                    
+        ECmIPAddress,               /**<
+                                    * IP address of interface
+                                    * It can be queried only via the 
+                                    * connection method's GetXXXAttributeL()
+                                    * (String - default: none)
+                                    */
+                                    
+        ECmIPDNSAddrFromServer,     /**<
+                                    * Get DNS addresses from server?
+                                    * It can be queried only via the 
+                                    * connection method's GetXXXAttributeL()
+                                    * (TBool - default: none)
+                                    */
+                                    
+        ECmIPNameServer1,           /**<
+                                    * IP address of primary name server
+                                    * It can be queried only via the 
+                                    * connection method's GetXXXAttributeL()
+                                    * (String - default: none)
+                                    */
+                                    
+        ECmIPNameServer2,           /**<
+                                    * IP address of secondary name server
+                                    * It can be queried only via the 
+                                    * connection method's GetXXXAttributeL()
+                                    * (String - default: none)
+                                    */
+                                    
+        ECmIP6DNSAddrFromServer,    /**<
+                                    * Get IP6 DNS addresses from server?
+                                    * It can be queried only via the 
+                                    * connection method's GetXXXAttributeL()
+                                    * (TBool - default: none)
+                                    */
+                                    
+        ECmIP6NameServer1,          /**<
+                                    * IP6 address of primary name server
+                                    * It can be queried only via the 
+                                    * connection method's GetXXXAttributeL()
+                                    * (String - default: none)
+                                    */
+                                    
+        ECmIP6NameServer2,          /**<
+                                    * IP6 address of secondary name server
+                                    * It can be queried only via the 
+                                    * connection method's GetXXXAttributeL()
+                                    * (String - default: none)
+                                    */
+                                    
+        ECmIPAddrLeaseValidFrom,    /**<
+                                    * IP address valid from this time, used to
+                                    * store dynamically assigned address lease
+                                    * info
+                                    * It can be queried only via the 
+                                    * connection method's GetXXXAttributeL()
+                                    * (String - default: none)
+                                    */
+                                    
+        ECmIPAddrLeaseValidTo,      /**<
+                                    * IP address valid for use until this time,
+                                    * used to store dynamically assigned
+                                    * address lease info
+                                    * It can be queried only via the 
+                                    * connection method's GetXXXAttributeL()
+                                    * (String - default: none)
+                                    */
+        
+        ECmConfigDaemonManagerName = 5100, /**<
+                                            * Name of the ECom configuration
+                                            * daemon manager component. This
+                                            * component interfaces with the
+                                            * server identified in
+                                            * ECmConfigDaemonName. If
+                                            * specified, ECmConfigDaemonName
+                                            * should also be specified.                                            
+                                            * It can be queried only via the 
+                                            * connection method's GetXXXAttributeL()
+                                            * (String - default: none)
+                                            */
+                                            
+        ECmConfigDaemonName,        /**<
+                                    * Name of the configuration daemon server.
+                                    * This server is used to provide further
+                                    * configuration for a connection, e.g.
+                                    * dynamic IP address assignment. If
+                                    * specified, ECmConfigDaemonManagerName
+                                    * should also be specified.
+                                    * It can be queried only via the 
+                                    * connection method's GetXXXAttributeL()
+                                    * (String - default: none)
+                                    */
+        
+        ECmEnableLPCExtension = 5110,   /**<
+                                        * Enable LCP extensions?
+                                        * It can be queried only via the 
+                                        * connection method's GetXXXAttributeL()
+                                        * (TBool - default: none)
+                                        */
+                                        
+        ECmDisablePlainTextAuth,        /**<
+                                        * Disable plaintext authentication?
+                                        * It can be queried only via the 
+                                        * connection method's GetXXXAttributeL()
+                                        * (TBool - default: none)
+                                        */
+                                        
+        ECmCommonAttributesEnd = 5999,  /**<
+                                        * Marks the end of common attributes
+                                        */
+        
+        /**
+        * The following methods can be queried only via 
+        * connection method's GetXXXAttributeL()
+        */
+        ECmSpecialAttributes = 6000,   /**<
+                                        * Marks the beginning of special
+                                        * attributes
+                                        */
+        
+        ECmIsLinked,                /**<
+                                    * Is connection method linked to any
+                                    * virtual connection method?
+                                    * It can be queried only via the 
+                                    * connection method's GetXXXAttributeL()
+                                    * (TBool - default: none)
+                                    */
+                                    
+        ECmSpecialAttributesEnd = 8999  /**<
+                                        * Marks the end of special attributes
+                                        */
+        };
+
+    /**  WAP WSP options */        
+    enum TWapWSPOption
+        {
+        /**
+        * Indicates that connectionless APIs should be used
+        */
+        ECmWapWspOptionConnectionless,
+        
+        /**
+        * Indicates that connection oriented APIs should be used
+        */
+        ECmWapWspOptionConnectionOriented
+        };
+       
+    }   // namespace CMManager
+
+#endif // CMCONNECTIONMETHODDEF_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/connection_settings_api/inc/cmdefconnvalues.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,73 @@
+/*
+* 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 default connection values
+*
+*/
+
+#ifndef C_CMDEFCONNVALUES_H
+#define C_CMDEFCONNVALUES_H
+
+enum TCmDefConnType
+        {
+        /**
+         * Deprecated
+         */
+        ECmDefConnAlwaysAsk,
+
+        /**
+         * Deprecated
+         */
+        ECmDefConnAskOnce,
+
+        /**
+         * The user selected a destination
+         */
+        ECmDefConnDestination,
+
+        /**
+          * The user selected a connection method
+          */
+        ECmDefConnConnectionMethod
+        };
+        
+struct TCmDefConnValue 
+    {
+    /**
+    * Type of default connection
+    */
+    TCmDefConnType iType;
+    
+    /**
+    * Id of the selected destination or connection method
+    */
+    TUint iId;
+    // -----------------------------------------------------------------------------
+    // TCmDefConnValue::operator==
+    // -----------------------------------------------------------------------------
+    //
+    inline TBool TCmDefConnValue::operator==( TCmDefConnValue& aDCSettingSelection ) const
+        {
+        return ( (iType == aDCSettingSelection.iType) && ( iId == aDCSettingSelection.iId ) );
+        };
+
+    // -----------------------------------------------------------------------------
+    // TCmDefConnValue::operator!=
+    // -----------------------------------------------------------------------------
+    //
+    inline TBool TCmDefConnValue::operator!=( TCmDefConnValue& aDCSettingSelection ) const
+        {
+        return (!( (iType == aDCSettingSelection.iType) && ( iId == aDCSettingSelection.iId ) ));
+        };     
+    };    
+#endif // C_CMDEFCONNVALUES_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/connection_settings_api/inc/cmdestination.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,321 @@
+/*
+* 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:  Destination interface class.
+*
+*/
+
+#ifndef DESTINATION_H
+#define DESTINATION_H
+
+// System includes
+#include <cmconnectionmethod.h>
+#include <cmmanagerdef.h>
+#include <E32def.h>
+#include <e32base.h>
+#include <metadatabase.h>
+
+// FORWARD DECLARATIONS
+class CCmManagerImpl;
+class CCmDestinationData;
+class CGulIcon;
+
+/**
+ *  RCmDestination is for setting/getting values of a network destination.
+ *
+ *  @lib cmmanager.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS(RCmDestination)
+    {
+    //=====================================================================
+    // Constructors/Destructors
+    // 
+    public:
+    
+        /** Default constructor. */
+        IMPORT_C RCmDestination();
+
+        IMPORT_C ~RCmDestination();
+
+        IMPORT_C RCmDestination(const RCmDestination& aCmDestination);
+        
+    //=====================================================================
+    // API functions
+    public:
+
+        /**
+        * Close the session.
+        *
+        * @since S60 3.2
+        */
+        IMPORT_C void Close();
+            
+        /**
+        * Returns the number of connection methods of the destination
+        *
+        * @since 3.2
+        * @return the number of connection methods belonging to a destination        
+        */                 
+        IMPORT_C TInt ConnectionMethodCount() const;
+        
+        /**
+        * Returns a reference to the connection method. 
+        * The index must be less than the return value of 
+        * ConnectionMethodCount().
+        *
+        * @since 3.2
+        * @param anIndex
+        * @return a connection method
+        */        
+        IMPORT_C RCmConnectionMethod ConnectionMethodL( TInt anIndex ) const;
+
+        /**
+        * Returns the connection method with the ECmId.
+        * Leaves with KErrNotFound if not found.
+        * @param aCmId unique id of the requested connection method.
+        * @return connection method
+        */
+        IMPORT_C RCmConnectionMethod ConnectionMethodByIDL( 
+                                                        TInt aCmId ) const;
+
+        /**
+        * Return the priority of the passed connection method
+        *
+        * @since 3.2
+        * @param aCCMItem connection method
+        * @return the priority of the queried connection method 
+        */
+        IMPORT_C TUint PriorityL(const RCmConnectionMethod& aCCMItem ) const;
+        
+        //Getting attributes
+
+        /**
+        * Returns the destination's Name attribute
+        * HBuf ownership is passed to the caller
+        *
+        * @since 3.2
+        * @return HBufC* Passes returned value's ownership to the caller
+        */      
+        IMPORT_C HBufC* NameLC() const;                        
+        
+        /**
+        * Returns the destination's Id attribute
+        *
+        * @since 3.2
+        * @return the destination's id
+        */                    
+        IMPORT_C TUint32 Id() const;
+        
+        /**
+        * Returns the destination's ElementId attribute
+        *
+        * @since 3.2
+        * @return the destination's element id        
+        */            
+        IMPORT_C TUint32 ElementId() const;        
+                
+        /**
+        * Returns the Icon pointer
+        * This function leaves if the client does not have a valid UI context
+        *
+        * @since 3.2
+        * @return the destination icon  
+        */ 
+        IMPORT_C CGulIcon* IconL() const;
+
+        /**
+        * Returns the Metadata
+        *
+        * @since 3.2
+        * @param aMetaField the meta data field to query
+        * @return the value of the requested field        
+        */            
+        IMPORT_C TUint32 MetadataL( CMManager::TSnapMetadataField aMetaField ) const;
+    
+        /**
+        * Return the protection level of the destination.
+        *
+        * @since 3.2              
+        * @return protection level of the destination
+        */
+        IMPORT_C CMManager::TProtectionLevel ProtectionLevel() const;
+
+        /**
+        * Returns if there's a connection created with any of the destination's
+        * connection method.
+        *
+        * @since 3.2        
+        * @return ETrue if there's a connection with any of the destination's
+        * connection method.
+        */
+        IMPORT_C TBool IsConnectedL() const;
+        
+        /**
+        * Returns whether the destination is hidden or not.
+        *
+        * @since 3.2
+        * @return ETrue if the destination is hidden
+        */
+        IMPORT_C TBool IsHidden() const;
+
+        /**
+        * checks if destinations are the same 
+        * 
+        * @since S60 3.2
+        * @param aDestination the destination being compared
+        * @return ETrue if the destinations are the same
+        */
+        IMPORT_C TBool operator==(const RCmDestination& aDestination ) const;
+        
+        /**
+        * checks if destinations are not the same 
+        * 
+        * @since S60 3.2
+        * @param aDestination the destination being compared
+        * @return ETrue if the destinations are different
+        */
+        IMPORT_C TBool operator!=(const RCmDestination& aDestination ) const;
+
+        /**
+        * assignment operator 
+        * 
+        * @since S60 3.2
+        * @param aDestination the destination being compared
+        * @return RCmDestination
+        */
+        IMPORT_C RCmDestination& operator=(const RCmDestination& 
+                                                    aCmDestination);
+
+                /**
+        * Create a connection method that belongs to this destination.
+        * @param aImplementationUid - implementation uid (bearer type) of the 
+        * connection method to be created
+        * @return newly created connection method
+        */
+        IMPORT_C RCmConnectionMethod CreateConnectionMethodL( TUint32 aBearerType );
+
+        /*
+        * Adds an existing connection method to a destination
+        * @param aConnectionMethod Connection method to be added
+        * @return index in the Connection Method list
+        */
+        IMPORT_C TInt AddConnectionMethodL( RCmConnectionMethod aConnectionMethod );            
+
+        /*
+        * Embeds an existing destination into this destination.
+        * @param RCmDestination - Destination to be embedded
+        * @return TInt - index in the Connection Method list
+        */
+        IMPORT_C TInt AddEmbeddedDestinationL( const RCmDestination& aDestination );     
+
+        /**
+        * Remove a connection method from a destination and delete it
+        * on update. 
+        * Exception: conenction method is not deleted  if it's referenced 
+        * from any other destination.
+        * @param aConnectionMethod the connection method to be deleted.
+        */
+        IMPORT_C void DeleteConnectionMethodL( RCmConnectionMethod& aConnectionMethod );
+
+        /**
+        * Remove connection method from the destination
+        * @param aConnectionMethod connection method to be removed
+        */
+        IMPORT_C void RemoveConnectionMethodL( RCmConnectionMethod aConnectionMethod );
+
+
+        /**
+        * Set the connection method's priority based on the passed index.
+        * @param aCCMItem the connection method item
+        * @param aIndex the new priority of the connection method in the 
+        * destination
+        */
+        IMPORT_C void ModifyPriorityL( RCmConnectionMethod& aCCMItem, 
+                                       TUint aIndex );
+
+        /**
+        * Set the destination's name
+        * @param aDestinationName new name of the destination
+        */
+        IMPORT_C void SetNameL( const TDesC& aName );
+
+        /**
+        * Set the destination's icon index.
+        * This fucton leaves if the client does not have a valid UI context
+        * @param aIconIndex new icon index of the destination
+        */
+        IMPORT_C void SetIconL( TUint32 anIndex );
+
+        /**
+        * Set the Metadata
+        * @param aMetaField field to be modified
+        * @param aValue value to be set
+        */            
+        IMPORT_C void SetMetadataL( CMManager::TSnapMetadataField aMetaField, 
+                                    TUint32 aValue );
+
+        /**
+        * Set the protection level of the destination.
+        * @param aProtLevel new protection level 
+        */
+        IMPORT_C void SetProtectionL( CMManager::TProtectionLevel aProtLevel );
+
+        /**
+        * Set if the destination is hidden or not.
+        * @param aHidden - ETrue if destination is hidden
+        */
+        IMPORT_C void SetHiddenL( TBool aHidden );         
+
+        /**
+        * Update all values of the destination and its connection method.
+        * Nothing if stored, if update leaves due to any reason.
+        */
+        IMPORT_C void UpdateL();               
+
+        /**
+        * Delete destination and its connection methods from CommsDat.
+        * Connection methods that belong to other destination, too, are
+        * not deleted.
+        */
+        IMPORT_C void DeleteLD();
+
+        /**
+        * Create a connection method with given id that belongs to this destination.
+        * @param aImplementationUid - implementation uid (bearer type) of the 
+        * connection method to be created
+        * @return newly created connection method or leaves with
+        * KErrAlreadyExists if there exists CM with the same Id.
+        */
+        IMPORT_C RCmConnectionMethod CreateConnectionMethodL( TUint32 aBearerType,
+                                                              TUint32 aConnMethId );
+
+
+    //=======================================================================
+    // Member variables
+    //
+    private: 
+        
+        /**
+         * the implementation class
+         */
+        CCmDestinationData* iDestinatonData;
+
+    private:
+    
+        friend class RCmManager;
+        friend class RCmConnectionMethod;
+    };
+    
+
+#endif // DESTINATION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/connection_settings_api/inc/cmgenconnsettings.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  General connectivity settings.
+*
+*/
+#ifndef CMGENCONNSETTINGS_H
+#define CMGENCONNSETTINGS_H
+
+
+// Usage types for new WLAN
+enum TCmUsageOfWlan
+    {
+    ECmUsageOfWlanKnown,
+    ECmUsageOfWlanKnownAndNew, // default 
+    ECmUsageOfWlanManual   
+    };
+
+// Seamlessness values
+enum TCmSeamlessnessValue
+        {
+        ECmSeamlessnessNotRoamedTo,   // IAP can be used in start, but not roamed to unless already active
+        ECmSeamlessnessConfirmFirst,  // Confirm first
+        ECmSeamlessnessShowprogress,  // Show progress
+        ECmSeamlessnessFullySeamless, // Same as previous
+        ECmSeamlessnessDisabled       // IAP blacklisted and not used at all
+        };
+
+// Table for connection settings other than default connection
+struct TCmGenConnSettings
+    {
+    TCmUsageOfWlan         iUsageOfWlan;
+    TCmSeamlessnessValue   iSeamlessnessHome;
+    TCmSeamlessnessValue   iSeamlessnessVisitor;
+    };
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/connection_settings_api/inc/cmmanager.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,417 @@
+/*
+* 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:  Connection manager IF class.
+*
+*/
+
+#ifndef CMMANAGER_H
+#define CMMANAGER_H
+
+// System Includes
+#include <e32std.h>
+#include <e32base.h>
+#include <e32cmn.h>
+#include <cmdefconnvalues.h>
+#include <cmgenconnsettings.h>
+
+// Forward Declarations
+class RCmConnectionMethod;
+class RCmDestination;
+class CCmManagerImpl;
+class TBearerPriority;
+class CGulIcon;
+
+/**
+ *  RCmManager gives access to network destinations and connection methods.
+ *
+ *  @lib cmmanager.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS(RCmManager)
+      {          
+    //=====================================================================
+    // Constructors/Destructors
+    // 
+    public:
+    
+        /**
+        * Default constructor. 
+        */
+        inline RCmManager();
+
+    //=====================================================================
+    // API functions
+    public:
+        
+        /**
+        * Symbian constructor
+        *
+        * @since S60 3.2
+        */
+        IMPORT_C void OpenL();    
+        
+        /**
+        * Symbian constructor
+        * Pushes the object on the cleanup stack
+        *
+        * @since S60 3.2
+        */
+        IMPORT_C void OpenLC();    
+        
+        /**
+        * Secondary destructor
+        *
+        * @since S60 3.2
+        */
+        IMPORT_C void Close();
+        
+    //=======================================================================
+    // Getter API
+    public:    
+      
+        /**
+        * Used to query bearer information that doesn't belong
+        * to a specific connection method, such as 
+        * ECmCoverage or ECmDefaultPriority etc.
+        *
+        * @since S60 3.2
+        * @param aBearerType the bearer
+        * @param aAttribute the setting value
+        * @return the setting value
+        */
+        IMPORT_C TUint32 GetBearerInfoIntL( TUint32 aBearerType,
+                                  TUint32 aAttribute ) const;
+                                  
+        
+        /**
+        * Used to query bearer information that doesn't belong
+        * to a specific connection method, such as 
+        * ECmCoverage or ECmDefaultPriority etc.
+        *
+        * @since S60 3.2
+        * @param aBearerType the bearer
+        * @param aAttribute the setting value
+        * @return the setting value
+        */
+        IMPORT_C TBool GetBearerInfoBoolL( TUint32 aBearerType,
+                                 TUint32 aAttribute ) const;
+        /**
+        * Used to query bearer information that doesn't belong
+        * to a specific connection method, such as 
+        * ECmCoverage or ECmDefaultPriority etc.
+        * HBuf ownership is passed to the caller
+        *
+        * @since S60 3.2
+        * @param aBearerType the bearer
+        * @param aAttribute the setting value
+        * @return the setting value
+        */        
+        IMPORT_C HBufC* GetBearerInfoStringL( TUint32 aBearerType,
+                                    TUint32 aAttribute ) const;
+        /**
+        * Used to query bearer information that does not belong
+        * to a specific connection method, such as 
+        * ECmCoverage or ECmDefaultPriority, etc.
+        * HBuf ownership is passed to the caller
+        *
+        * @since S60 3.2
+        * @param aBearerType the bearer
+        * @param aAttribute the setting value
+        * @return the setting value
+        */
+        IMPORT_C HBufC8* GetBearerInfoString8L( TUint32 aBearerType,
+                                    TUint32 aAttribute ) const;
+                    
+        /**
+        * Used to query any non-bearer specific information about
+        * a given connection method. This can be e.g. ECmBearerType,
+        * ECmName, ECmStartPage, etc.
+        *
+        * @since S60 3.2
+        * @param aIapId the connection method id
+        * @param aAttribute the setting value
+        * @return the setting value
+        */
+        IMPORT_C TUint32 GetConnectionMethodInfoIntL( TUint32 aIapId,
+                                             TUint32 aAttribute ) const;
+        
+        /**
+        * Used to query any, non-bearer specific information about
+        * a given connection method. This can be e.g. ECmBearerType,
+        * ECmName, ECmStartPage, etc.
+        *
+        * @since S60 3.2
+        * @param aIapId the connection method id
+        * @param aAttribute the setting value
+        * @return the setting value
+        */
+        IMPORT_C TBool GetConnectionMethodInfoBoolL( TUint32 aIapId,
+                                            TUint32 aAttribute ) const;
+
+        /**
+        * Used to query any non-bearer specific information about
+        * a given connection method. This can be e.g. ECmBearerType,
+        * ECmName, ECmStartPage, etc.
+        * HBuf ownership is passed to the caller
+        *
+        * @since S60 3.2
+        * @param aIapId the connection method id
+        * @param aAttribute the setting value
+        * @return the setting value
+        */
+        IMPORT_C HBufC* GetConnectionMethodInfoStringL( TUint32 aIapId,
+                                               TUint32 aAttribute ) const;
+
+        /**
+        * Used to query any non-bearer specific information about
+        * a given connection method. This can be e.g. ECmBearerType,
+        * ECmName, ECmStartPage, etc.
+        * HBuf ownership is passed to the caller
+        *
+        * @since S60 3.2
+        * @param aIapId the connection method id
+        * @param aAttribute the setting value
+        * @return the setting value
+        */
+        IMPORT_C HBufC8* GetConnectionMethodInfoString8L( TUint32 aIapId,
+                                               TUint32 aAttribute ) const;
+                
+        /**
+        * Returns the connection method queried by its ID
+        *
+        * @since S60 3.2
+        * @param aConnectionMethodId id of the connection method
+        * @return RCmConnectionMethod connection method
+        */
+        IMPORT_C RCmConnectionMethod ConnectionMethodL( 
+                                     TUint32 aConnectionMethodId ) const;
+                        
+        /**
+        * Returns the list of connection methods. Connection Methods are 
+        * filtered by the switch parameters e.g. aLegacyOnly.
+        *
+        * @since S60 3.2
+        * @param aCMArray on return it is the array of IAP ids.
+        * @param aCheckBearerType If ETrue only connection methods with 
+        *                         supported bearer type are returned
+        * @param aLegacyOnly when set to ETrue only Legacy IAP ids will
+        *                         be returned
+        * @param aEasyWlan when set to ETrue EasyWlan id is returned, too
+        */
+        IMPORT_C void ConnectionMethodL( RArray<TUint32>& aCMArray, 
+                                         TBool aCheckBearerType = ETrue,
+                                         TBool aLegacyOnly = ETrue,
+                                         TBool aEasyWlan = EFalse ) const;
+        
+        /**
+        * Returns an array of all destination id's
+        *
+        * @since S60 3.2
+        * @param aDestArray list all available destinations' id
+        */ 
+        IMPORT_C void AllDestinationsL( RArray<TUint32>& aDestArray ) const;
+
+        /**
+        * Returns the destination to which a specified 
+        * connection method belongs, search is by destination ID
+        *
+        * @since S60 3.2
+        * @param aDestinationId id of destination
+        * @return RCmDestination network destination 
+        */
+        IMPORT_C RCmDestination DestinationL( TUint32 aDestinationId ) const;
+       
+        /**
+        * Returns the copy of the bearer priority array. Ownership is passed.
+        *
+        * @since S60 3.2
+        * @param aArray bearer priority array
+        */          
+        IMPORT_C void BearerPriorityArrayL( 
+                                   RArray<TBearerPriority>& aArray ) const;
+       
+        /**
+        * Clean up passed global bearer priority array. Delete
+        * the elements and calls Reset and Close on the array.
+        *
+        * @since S60 3.2
+        * @param aArray array to be cleaned up
+        */
+        IMPORT_C void CleanupGlobalPriorityArray( 
+                                   RArray<TBearerPriority>& aArray ) const;
+        
+        /**
+        * Returns the id of the EasyWlan connection method.
+        *
+        * @since S60 3.2
+        * @return id of the EasyWLan connection method. 0 if not found.
+        */
+        IMPORT_C TUint32 EasyWlanIdL() const;
+        
+        /**
+        * Returns the default connection method/SNAP.
+        *
+        * @since S60 3.2
+        */
+        IMPORT_C void ReadDefConnL( TCmDefConnValue& aDCSetting );
+
+        /**
+        * Stores the default connection method/SNAP.
+        *
+        * @since S60 3.2
+        */
+        IMPORT_C void WriteDefConnL( const TCmDefConnValue& aDCSetting );  
+
+
+        /**
+        * Returns the general connection settings.
+        *
+        * @since S60 9.2
+        */
+        IMPORT_C void ReadGenConnSettingsL( TCmGenConnSettings& aGenConnSettings );
+
+        /**
+        * Writes the general connection settings.
+        *
+        * @since S60 9.2
+        */
+        IMPORT_C void WriteGenConnSettingsL( const TCmGenConnSettings& aGenConnSettings );
+        
+        
+        /** Open session and create tables if they don't exist*/
+        IMPORT_C void CreateTablesAndOpenL();    
+
+        /**
+        * Creates a Destination with the passed name. 
+        * @param aName the name of the new destination.
+        * @return RCmDestination new destination. ownership is passed to the 
+        * caller
+        */
+        IMPORT_C RCmDestination CreateDestinationL( const TDesC& aName );
+
+        /**
+        * Creates a connection method does not belong to any destination
+        * @param aImplementationUid - bearer type of the new connection method
+        * @return RCmConnectionMethod newly created connection method.
+        */
+        IMPORT_C RCmConnectionMethod CreateConnectionMethodL( TUint32 aBearerType );        
+
+        /**
+        * Copies a connection method belonging to one destination to 
+        * another. The connection method becomes shared.
+        * Calls UpdateL on the destination
+        * @param aTargetDestination
+        * @param aConnectionMethodId
+        * @return TInt - index in the Connection Method list
+        */
+        IMPORT_C TInt CopyConnectionMethodL( RCmDestination& aTargetDestination,
+                                             RCmConnectionMethod& aConnectionMethod );
+
+        /**
+        * Moves a connection method belonging to one destination to 
+        * another. The connection method is removed from the source destination
+        * @param aSourceDestination
+        * @param aTargetDestination
+        * @param aConnectionMethod
+        * @return TInt - index in the Connection Method list
+        */
+        IMPORT_C TInt MoveConnectionMethodL( RCmDestination& aSourceDestination,
+                                             RCmDestination& aTargetDestination,
+                                             RCmConnectionMethod& aConnectionMethod );
+
+        /**
+        * Remove connection method from the destination
+        * @param aDestination destination the connection method is attached to
+        * @param aConnectionMethod connection method to be removed
+        */
+        IMPORT_C void RemoveConnectionMethodL( RCmDestination& aDestination,
+                                               RCmConnectionMethod& aConnectionMethod );
+
+        /**
+        * Removes connection method from every destination and make it 
+        * uncategorized.
+        * @param aConnectionMethod connection method to be removed
+        */
+        IMPORT_C void RemoveAllReferencesL( RCmConnectionMethod& aConnectionMethod );
+
+        /**
+        * Update bearer priority array
+        * @param aArray array with new global bearer priority
+        */          
+        IMPORT_C void UpdateBearerPriorityArrayL( const RArray<TBearerPriority>& aArray );
+
+        /**
+        * Creates a Destination with the passed name and id. 
+        * @param aName the name of the new destination.
+        * @param aDestId Predefined id of the destination.
+        * @return RCmDestination newly created destination or leaves with
+        * KErrAlreadyExists if there exists CM with the same Id.
+        * Ownership is passed to the caller.
+        */
+        IMPORT_C RCmDestination CreateDestinationL( const TDesC& aName,
+                                                       TUint32      aDestId );
+
+        /**
+        * Creates a connection method does not belong to any destination
+        * @param aImplementationUid - bearer type of the new connection
+        * method
+        * @param aConnMethodId Predefined id for the connection method.
+        * @return RCmConnectionMethod newly created connection
+        * method or leaves with KErrAlreadyExists if there exists CM
+        * with the same Id.
+        */
+        IMPORT_C RCmConnectionMethod CreateConnectionMethodL( TUint32 aImplementationUid,
+                                                              TUint32 aConnMethodId );
+
+        /**
+        * Query all of the supported bearer types.
+        * @param aArray list of all supported bearer types.
+        */          
+        IMPORT_C void SupportedBearersL( RArray<TUint32>& aArray ) const;
+
+        /**
+        * Returns "Uncategorized" icon.
+        * This fucton leaves if the client does not have a valid UI context
+        * @return CGulIcon* Icon of uncategorized connection methods. Ownership 
+        * is passed.
+        */          
+        IMPORT_C CGulIcon* UncategorizedIconL() const;
+        
+    private:
+        /**
+        * This is a private copy constructor without implementation.
+        * The sole purpose of this declaration is to forbid the copying of 
+        * the objects of this class.
+        */          
+        RCmManager(RCmManager&  );
+        /**
+        * This is a private copy constructor without implementation.
+        * The sole purpose of this declaration is to forbid the copying of 
+        * the objects of this class.
+        */          
+        RCmManager& operator=( RCmManager& );
+    //=========================================================================
+    // Member data
+    
+    private:
+    
+        /**
+         * the implementation class
+         */
+        CCmManagerImpl* iImplementation;
+    };
+
+#include "cmmanager.inl"
+    
+#endif // CMMANAGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/connection_settings_api/inc/cmmanager.inl	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* 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 cmmanager.h inline functions
+*
+*/
+
+
+// -----------------------------------------------------------------------------
+// RCmManager::RCmManager
+// -----------------------------------------------------------------------------
+//
+inline RCmManager::RCmManager()
+    : iImplementation(NULL)
+    {
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/connection_settings_api/inc/cmmanagerdef.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,180 @@
+/*
+* 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:  Definition module for Connection Method Manager
+*
+*/
+
+#ifndef CMMANAGERDEF_H
+#define CMMANAGERDEF_H
+
+// System includes
+#include <E32def.h>
+#include <e32std.h>
+           
+namespace CMManager
+    {
+    /**
+     * Metadata items
+     */
+    enum TSnapMetadataField
+        {
+        /**
+        * If set this destination is for internet usage.
+        * There can be only one such destination.
+        * (TBool - default: EFalse)
+        * @deprecated
+        */
+        ESnapMetadataInternet               =   0x00000001,
+        
+        /**
+        * If set this destination is highlighted by default
+        * in the Agent dialog.
+        * (TBool - default: EFalse)
+        */
+        ESnapMetadataHighlight              =   0x00000002,
+        
+        /**
+        * If set this destination is hidden in the 
+        * Agent dialog.
+        * (TBool - default: EFalse)
+        */
+        ESnapMetadataHiddenAgent            =   0x00000004,
+        /**
+        * This set of flags identifies the fixed destinations which have localised names.
+        * The possible values for this flag-set are the enums of TLocalisedDestinations.
+        */
+        ESnapMetadataDestinationIsLocalised =   0x000000F0,
+
+        /**
+        * This set of flags identifies the fixed destinations for fixed
+        * purposes.
+        * The possible values for this flag-set are the enums of TSnapPurpose.
+        */
+        ESnapMetadataPurpose =   0x00000F00
+        };
+
+    /**
+    * This is the enum set of the TSnapMetadataField's ESnapMetadataDestinationIsLocalised 
+    */
+    enum TLocalisedDestinations
+        {
+        /**
+        * Used to sign that the destination is not localised at all
+        */
+        ENotLocalisedDest = 0x00000000,
+
+        /**
+        * Used to sign that the destination is localised as 'Internet'
+        */
+        ELocalisedDestInternet       =   0x00000001,
+
+        /**
+        * Used to sign that the destination is localised as 'Wap'
+        */
+        ELocalisedDestWap            =   0x00000002,
+
+        /**
+        * Used to sign that the destination is localised as 'MMS'
+        */
+        ELocalisedDestMMS       =   0x00000003,
+
+        /**
+        * Used to sign that the destination is localised as 'Intranet'
+        */
+        ELocalisedDestIntranet = 0x00000004
+        };
+
+    /**
+    * This is the enum set of the TSnapMetadataField's ESnapMetadataPurpose
+    */
+    enum TSnapPurpose
+        {
+        ESnapPurposeUnknown = 0x00000000,
+
+        /**
+        * Used to sign that the destination is identified as 'Internet'
+        */
+        ESnapPurposeInternet = 0x00000001,
+
+        /**
+        * Used to sign that the destination is identified as 'Operator'
+        */
+        ESnapPurposeOperator = 0x00000002,
+
+        /**
+        * Used to sign that the destination is identified as 'MMS'
+        */
+        ESnapPurposeMMS = 0x00000003,
+
+        /**
+        * Used to sign that the destination is identified as 'Intranet'
+        */
+        ESnapPurposeIntranet = 0x00000004
+        };
+
+    /**
+     * Protection Levels
+     */      
+    enum TProtectionLevel
+        {
+        EProtLevel0 = 0,    /**<
+                            * No protection
+                            */
+                            
+        EProtLevel1 = 1,    /**<
+                            * A destination and its contents
+                            */
+                            
+        EProtLevel2 = 2,    /**<
+                            * A destination
+                            */
+                            
+        EProtLevel3 = 3     /**<
+                            * Note: Level 3 - Set the ECmProtected attr on 
+                            * connection method
+                            */
+        };  
+
+    const TInt KDataMobilitySelectionPolicyPriorityWildCard = 256;
+    } // namespace CMManager
+
+/**
+ * TBearerPriority is a representation of a bearer priority defined in
+ * commsdat
+ *
+ *  @lib cmmanager.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( TBearerPriority )
+    {
+    public:
+        
+        HBufC*     iServiceType;    /**<
+                                    * Name of the service table to identify
+                                    * type of bearer 
+                                    */
+                                    
+        TUint32    iPriority;       /**<
+                                    * Priority of the bearer. 
+                                    * Values must be unique within the table 
+                                    */
+                                    
+        TUint32    iUIPriority;     /**<
+                                    * Priority of this bearer type when shown
+                                    * in UI for configuring a new IAP. 
+                                    * Values must be unique within the table 
+                                    */
+    };       
+    
+#endif // CMMANAGERDEF_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/connection_settings_api/inc/cmplugincsddef.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,32 @@
+/*
+* 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 headers for CSD Plugin.
+*
+*/
+
+
+#ifndef CMPLUGINCSDDEF_H
+#define CMPLUGINCSDDEF_H
+
+#include <cmplugindialcommondefs.h>
+
+/**  ECOM interface UID */
+const TUint KUidCSDBearerType = 0x10281BB7;
+
+/**
+* CSD bearer type has no additional attributes than
+* there's already defined in cmplugindialcommondefs.h.
+*/
+
+#endif // CMPLUGINCSDDEF_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/connection_settings_api/inc/cmplugindialcommondefs.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,499 @@
+/*
+* 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 headers for Dial Plugins.
+*
+*/
+
+#ifndef CMPLUGINDIALCOMMONDEFS_H
+#define CMPLUGINDIALCOMMONDEFS_H
+
+namespace CMManager
+    {
+    /// callback timeout in microseconds
+    const TUint32 KCallBackTimeOut  = 60000000;
+
+    enum TCmCallType                /// These enums are used to represent
+                                    ///< the conn. type Analogue/ISDNv110/ISDNv120
+        {
+        ECmCallTypeAnalogue,          ///< Analogue
+        ECmCallTypeISDNv110,          ///< ISDN v. 110
+        ECmCallTypeISDNv120           ///< ISDN v. 120
+        };
+
+
+    enum TCmCallSpeed                       /// These enums are used to represent
+                                            ///< the connection speed.
+        {
+        ECmSpeedAutobaud=0x00000000,          ///< Autodetect
+        ECmSpeed9600=0x00000001,              ///< 9600
+        ECmSpeed14400=0x00000002,             ///< 14400
+        ECmSpeed19200=0x00000003,             ///< 19200
+        ECmSpeed28800=0x00000004,             ///< 28800
+        ECmSpeed38400=0x00000005,             ///< 38400
+        ECmSpeed43200=0x00000006,             ///< 43200
+        ECmSpeed56000=0x00000007              ///< 56000
+        };
+
+    /// indicated the end of the array in the following max speed array sets
+    const TInt KEndOfArray = -1;
+
+    /// the set of max speeds available for CSD analogue
+    const TInt KCsdAnalogue[]       = { ECmSpeedAutobaud, ECmSpeed9600, 
+                                        ECmSpeed14400, 
+                                        KEndOfArray };
+
+    /// the set of speeds available for CSD wcdma analogue
+    const TInt KCsdAnalogueWcdma[]  = { ECmSpeedAutobaud, ECmSpeed9600, 
+                                        ECmSpeed14400, ECmSpeed28800, 
+                                        KEndOfArray};
+
+    /// the set of speeds available for CSD idsn 110
+    const TInt KCsdIsdn110[]        = { ECmSpeed9600, ECmSpeed14400, 
+                                        KEndOfArray};
+
+    /// the set of speeds available for CSD isdn 110 wcdma
+    const TInt KCsdIsdn110Wcdma[]   = { ECmSpeed9600, ECmSpeed14400, 
+                                        ECmSpeed28800, ECmSpeed38400, 
+                                        KEndOfArray};
+    
+    /// the set of speeds available for CSD isdn 120
+    const TInt KCsdIsdn120[]        = { ECmSpeed9600, ECmSpeed14400, 
+                                        KEndOfArray};
+
+    /// the set of speeds available for CSD isdn 120 wcdma
+    const TInt KCsdIsdn120Wcdma[]   = { ECmSpeed9600, ECmSpeed14400, 
+                                        ECmSpeed28800, ECmSpeed56000,
+                                        KEndOfArray};
+
+    /// the set of speeds available for HSCSD analogue
+    const TInt KHcsdAnal[]          = { ECmSpeedAutobaud, ECmSpeed9600, 
+                                        ECmSpeed14400, ECmSpeed19200, 
+                                        ECmSpeed28800, KEndOfArray };
+
+    /// the set of speeds available for HSCSD isdn 110
+    const TInt KHcsdIsdn110[]       = { ECmSpeed9600, ECmSpeed14400, 
+                                        ECmSpeed19200, ECmSpeed28800, 
+                                        ECmSpeed38400, KEndOfArray};
+
+    /// the set of speeds available for HSCSD isdn 120
+    const TInt KHcsdIsdn120[]       = { ECmSpeed9600, ECmSpeed14400, 
+                                        ECmSpeed19200, ECmSpeed28800,
+                                        ECmSpeed43200, KEndOfArray};
+
+    /**
+    * These are the common attribute of every dial in/out
+    * bearer types.
+    */
+    enum TConnectionMethodCsdHscsdCommonAttributes
+        {
+        EPluginDialAttribStart = 10000,     /**<
+                                            * Marks the beginning of common dial
+                                            * in/out attributes.
+                                            */
+        
+        EDialOut = 10001,                   /**<
+                                            * Dial out or in. ETrue means dial out.
+                                            * (TBool - default: ETrue)
+                                            */
+                                            
+        EDialCallType = 10002,              /**<
+                                            * Call type. See acceptable values 
+                                            * in TCmCallType.
+                                            * (TUint32 - default: ECmCallTypeAnalogue )
+                                            */
+                                            
+        EDialMaxConnSpeed = 10003,          /**<
+                                            * Maximum speed. See acceptable values
+                                            * in TCmCallSpeed.
+                                            * (TUint32 - default: ECmSpeedAutobaud )
+                                            */
+        
+        EDialDescription = 10100,           /**<
+                                            * Application's description of ISP.
+                                            * (String - default: none)
+                                            */
+
+        EDialType = 10101,                  /**<
+                                            * Enum value indicating ISP type, 
+                                            * e.g. Internet ISP, WAP ISP. 
+                                            * Selected from TCommsDbIspType
+                                            * (TUint32 - default: EIspTypeInternetAndWap)
+                                            */
+                                            
+        EDialDefaultTelNum = 10102,         /**<
+                                            * Default phone number.
+                                            * (Only for dial out)
+                                            * (String - default: none)
+                                            */
+                                            
+        EDialDialResolution = 10103,        /**<
+                                            * Perform dialling resolution for 
+                                            * default phone number?
+                                            * (Only for dial out)
+                                            * (TBool - default: none)
+                                            */
+
+        EDialChargeCard = 10104,            /**<
+                                            * Identifier of the chargecard in 
+                                            * this ISP.
+                                            * (Only for dial out)
+                                            * (TUint32 - default: none)
+                                            */
+                                            
+        EDialUseLoginScript = 10105,        /**<
+                                            * Use login script?
+                                            * (TBool - default: EFalse)
+                                            */
+                                            
+        EDialLoginScript = 10106,           /**<
+                                            * Login script (used if Use Login 
+                                            * Script is ETrue)
+                                            * (String - default: none)
+                                            */
+
+        EDialAuthentication = 10107,        /**<
+                                            * UNUSED (will eventually point to 
+                                            * some authentication table/group)
+                                            * (Only for dial in)
+                                            * (TUint32 - default: none)
+                                            */
+
+        EDialPromptForLogin = 10108,        /**<
+                                            * Prompt user for username and password?
+                                            * (Only for dial out)
+                                            * (TBool - default: EFalse)
+                                            */
+                                            
+        EDialLoginName = 10109,             /**<
+                                            * Login name.
+                                            * (Only for dial out)
+                                            * (String - default: none)
+                                            */
+                                            
+        EDialLoginPassword = 10110,         /**<
+                                            * Login password.
+                                            * (Only for dial out)
+                                            * (String - default: none)
+                                            */
+                                            
+        EDialDisplayPCT = 10111,            /**<
+                                            * Display PCT (without scanning 
+                                            * script for READ command)?
+                                            * (Only for dial out)
+                                            * (TBool - default: none)
+                                            */
+                                            
+        EDialIFParams = 10112,              /**<
+                                            * Interface parameter string.
+                                            * (String - default: none)
+                                            */
+                                            
+        EDialIFNetworks = 10113,            /**<
+                                            * Comma separated list of network 
+                                            * protocols, e.g. "PPP"
+                                            * (String - default: none)
+                                            */
+                                            
+        EDialIFPromptForAuth = 10114,       /**<
+                                            * Prompt user for authentication 
+                                            * username and password?
+                                            * (Only for dial out)
+                                            * (TBool - default: EFalse)
+                                            */
+                                            
+        EDialIFAuthName = 10115,            /**<
+                                            * Authentication username used by PPP
+                                            * (Only for dial out)
+                                            * (String - default: none)
+                                            */
+                                            
+        EDialIFAuthPass = 10116,            /**<
+                                            * Authentication password used by PPP
+                                            * (Only for dial out)
+                                            * (String - default: none)
+                                            */
+                                            
+        EDialIFAuthRetries = 10117,         /**<
+                                            * Number of times to retry 
+                                            * authentication if it fails.
+                                            * (TUint32 - default: none)
+                                            */
+                                            
+        EDialIFCallbackEnabled = 10118,     /**<
+                                            * Callback enabled?
+                                            * (Only for dial out)
+                                            * (TBool - default: none)
+                                            */
+                                            
+        EDialIFCallbackType = 10119,        /**<
+                                            * Enum value indicating type of 
+                                            * callback (if enabled). 
+                                            * Selected from TCallbackAction.
+                                            * (Only for dial out)
+                                            * (TUint32 - default: none)
+                                            */
+                                            
+        EDialIFCallbackInfo = 10120,        /**<
+                                            * Info for callback request (if enabled)
+                                            * This is an 8-bit string!
+                                            * (Only for dial out)
+                                            * (String - default: none)
+                                            */
+                                            
+        EDialCallbackTimeout = 10121,       /**<
+                                            * Time to wait for callback in 
+                                            * microseconds (if enabled)
+                                            * (Only for dial out)
+                                            * (TUint32 - default: none)
+                                            */
+
+        EDialIFServerMode = 10122,          /**<
+                                            * When PPP is configured as a server.
+                                            * (Only for dial out)
+                                            * (TBool - default: none)
+                                            */
+                                            
+        EDialIPAddressFromServer = 10123,   /**<
+                                            * Get IP address from server?
+                                            * (TBool - default: none)
+                                            */
+                                            
+        EDialIPAddress = 10124,             /**<
+                                            * IP address of interface
+                                            * (String - default: none)
+                                            */
+                                            
+        EDialIPNetmask = 10125,             /**<
+                                            * IP net mask of interface
+                                            * (String - default: none)
+                                            */
+                                            
+        EDialIPGateway = 10126,             /**<
+                                            * IP address of gateway.
+                                            * (String - default: none)
+                                            */
+                                            
+        EDialIPDNSAddressFromServer = 10127,/**<
+                                            * Get DNS addresses from server?
+                                            * (TBool - default: none)
+                                            */
+                                            
+        EDialIPNameServer1 = 10128,         /**<
+                                            * IP Address of primary name server.
+                                            * (String - default: none)
+                                            */
+                                            
+        EDialIPNameServer2 = 10129,         /**<
+                                            * IP Address of secondary name server.
+                                            * (String - default: none)
+                                            */
+                                            
+        EDialIP6DNSAddressFromServer = 10130,/**<
+                                            * Get IP6 DNS addresses from server?
+                                            * (TBool - default: none)
+                                            */
+                                            
+        EDialIP6NameServer1 = 10131,        /**<
+                                            * IP6 Address of primary name server
+                                            * (String - default: none)
+                                            */
+                                            
+        EDialIP6NameServer2 = 10132,        /**<
+                                            * IP6 Address of secondary name server
+                                            * (String - default: none)
+                                            */
+                                            
+        EDialIPAddressLeaseValidFrom = 10133,/**<
+                                            * IP address valid from this time, 
+                                            * used to store dynamically assigned 
+                                            * address lease info.
+                                            * (Only for dial out)
+                                            * (String - default: none)
+                                            */
+                                            
+        EDialIPAddressLeaseValidTo = 10134, /**<
+                                            * IP address valid for use until 
+                                            * this time, used to store dynamically 
+                                            * assigned address lease info.
+                                            * (Only for dial out)
+                                            * (String - default: none)
+                                            */
+                                            
+        EDialConfigDaemonManagerName = 10135,/**<
+                                            * Name of the ECOM configuration daemon 
+                                            * manager component. This component 
+                                            * interfaces with the server identified 
+                                            * in ISP_CONFIG_DAEMON_NAME. 
+                                            * If specified, ISP_CONFIG_DAEMON_NAME 
+                                            * should also be specified.
+                                            * (Only for dial out)
+                                            * (String - default: none)
+                                            */
+                                            
+        EDialConfigDaemonName = 10136,      /**<
+                                            * Name of the configuration daemon 
+                                            * server. This server is used to 
+                                            * provide further configuration for 
+                                            * a connection, e.g. dynamic IP address 
+                                            * assignment. If specified, 
+                                            * ISP_CONFIG_DAEMON_MANAGER_NAME 
+                                            * should also be specified.
+                                            * (Only for dial out)
+                                            * (String - default: none)
+                                            */
+                                            
+        EDialEnableIPHeaderComp = 10137,    /**<
+                                            * Enable IP header compression?
+                                            * (TBool - default: none)
+                                            */
+                                            
+        EDialEnableLCPExtension = 10138,    /**<
+                                            * Enable LCP extension?
+                                            * (TBool - default: none)
+                                            */
+                                            
+        EDialDisablePlainTextAuth = 10139,  /**<
+                                            * Disable plain text authentication?
+                                            * (TBool - default: none)
+                                            */
+
+        EDialEnableSWComp = 10140,          /**<
+                                            * Enable software compression 
+                                            * (e.g. Microsoft, STAC or Predictor 
+                                            * compression)?
+                                            * (TBool - default: none)
+                                            */
+
+        EDialBearerName = 10141,            /**<
+                                            * Enum value specifying the name of the 
+                                            * bearer, e.g. Asynchronous Modem.
+                                            * Selected from 
+                                            * RBasicGsmCall::TBearerName
+                                            * (TUint32 - default: none)
+                                            */
+
+        EDialBearerSpeed = 10142,           /**<
+                                            * Enum value specifying the bearer speed 
+                                            * from RBasicGsmCall::TBearerSpeed
+                                            * (TUint32 - default: none)
+                                            */
+
+        EDialBearerCE = 10143,              /**<
+                                            * Enum value specifying the bearer CE, 
+                                            * e.g. non-transparent. 
+                                            * Selected from RbasicGsmCall::TBearerCE
+                                            * (TUint32 - default: none)
+                                            */
+
+        EDialInitString = 10144,            /**<
+                                            * Modem initialisation string to be used 
+                                            * when this ISP is in use. 
+                                            * This string is copied into the 
+                                            * MODEM_ISP_INIT_STRING 
+                                            * field by NetDial.
+                                            * 8bit string!
+                                            * (String- default: none)
+                                            */
+
+        EDialBearerService = 10145,         /**<
+                                            * Enum of type 
+                                            * RMobileCall::TMobileCallDataService.
+                                            * (Only for dial out)
+                                            * (TUint32 - default: none)
+                                            */
+
+        EDialBearerProtocol = 10146,        /**<
+                                            * Enum of type 
+                                            * RMobileCall::TMobileCallDataProtocol.
+                                            * (Only for dial out)
+                                            * (TUint32 - default: none)
+                                            */
+
+        EDialRLPVersion = 10147,            /**<
+                                            * Enum of type 
+                                            * RMobileCall::TMobileCallDataRLPVersion.
+                                            * (Only for dial out)
+                                            * (TUint32 - default: none)
+                                            */
+
+        EDialIWFtoMS = 10148,               /**<
+                                            * Integer specifying network to 
+                                            * MS window size.
+                                            * (Only for dial out)
+                                            * (TUint32 - default: none)
+                                            */
+
+        EDialMStoIWF = 10149,               /**<
+                                            * Integer specifying MS to network 
+                                            * window size.
+                                            * (Only for dial out)
+                                            * (TUint32 - default: none)
+                                            */
+
+        EDialAckTimer = 10150,              /**<
+                                            * Integer specifying rlp ack timeout in 
+                                            * microseconds.
+                                            * (Only for dial out)
+                                            * (TUint32 - default: none)
+                                            */
+
+        EDialRetransmissionAttempts = 10151,/**<
+                                            * Integer specifying rlp retransmission 
+                                            * attempts.
+                                            * (Only for dial out)
+                                            * (TUint32 - default: none)
+                                            */
+
+        EDialResequencePeriod = 10152,      /**<
+                                            * Integer specifying resequencing 
+                                            * period.
+                                            * (Only for dial out)
+                                            * (TUint32 - default: none)
+                                            */
+
+        EDialV42Compression = 10153,        /**<
+                                            * Enum of type TMobileCallDataV42bis.
+                                            * (Only for dial out)
+                                            * (TUint32 - default: none)
+                                            */
+
+        EDialV42CodeWords = 10154,          /**<
+                                            * Integer specifying V42bis codewords.
+                                            * (Only for dial out)
+                                            * (TUint32 - default: none)
+                                            */
+
+        EDialV42MaxLength = 10155,          /**<
+                                            * Integer specifying V42bis maximum 
+                                            * string length.
+                                            * (Only for dial out)
+                                            * (TUint32 - default: none)
+                                            */
+
+        EDialUseEdge = 10156,               /**<
+                                            * EDGE parameter used by GSM.
+                                            * (TBool - default: none)
+                                            */
+                                            
+        EPluginDialAttribRangeMax = 19999   /**<
+                                            * Marks the end of common dial
+                                            * in/out attributes.
+                                            */
+        };
+
+
+
+    } // namespace CMManager
+
+#endif // CMPLUGINDIALCOMMONDEFS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/connection_settings_api/inc/cmpluginembdestinationdef.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,37 @@
+/*
+* 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:  Embedded destination attribute descriptor header.
+*
+*/
+
+#ifndef CMEMBEDDEDDESTINATION_H
+#define CMEMBEDDEDDESTINATION_H
+
+// Bearer type of the embedded destination
+/**  ECOM interface UID */
+const TUint KUidEmbeddedDestination  = 0x10207379;
+
+// Embedded destination plugin has no special attribute. Call ::Destination()
+// function of interface class to get destination object.
+// The following common attribute are supported:
+// - ECmBearerType  (read-only)
+// - ECmName,       (read/write)
+// - ECmIapId       (returns destination Id! read-only)
+// - ECmCoverage    (always return EFalse. read-only)
+// - ECmProtected   (read/write)
+// - ECmDestination (always return ETrue. read-only)
+// - ECmHidden      (read/write)
+// - ECmDefaultPriority (read-only)
+
+#endif // CMEMBEDDEDDESTINATION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/connection_settings_api/inc/cmpluginhscsddef.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,79 @@
+/*
+* 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 headers for HSCSD Plugin.
+*
+*/
+
+#ifndef CMPLUGINHSCSDDEF_H
+#define CMPLUGINHSCSDDEF_H
+
+/**  ECOM interface UID */
+const TUint KUidHSCSDBearerType = 0x10281BB8;
+
+namespace CMManager
+    {
+    /**
+    * Enumeration for the HSCSD specific attributes.
+    */
+    enum TConnectionMethodHscsdSpecificAttributes
+        {
+        EPluginHSCSDAttribStart = 20000,    /**<
+                                            * Marks the beginning of HSCSD
+                                            * attributes.
+                                            */
+        
+        EHscsdChannelCoding = 20100,        /**<
+                                            * Enum value specifying HSCSD channel
+                                            * coding. Selected from 
+                                            * RMobileCall::TMobileCallTchCoding.
+                                            * (TUint32 - default: none - read only)
+                                            */
+                                            
+        EHscsdAiur = 20101,                 /**<
+                                            * Enum value specifying AIUR for HSCSD. 
+                                            * Selected from 
+                                            * RMobileCall::TMobileCallAiur.
+                                            * (TUint32 - default: none - read only)
+                                            */
+        
+        EHscsdRequestedTimeSlots = 20102,   /**<
+                                            * Requested number of time slots 
+                                            * for HSCSD.
+                                            * (TUint32 - default: none - read only)
+                                            */
+
+        EHscsdMaximumTimeSlots = 20103,     /**<
+                                            * Maximum number of time slots for 
+                                            * HSCSD which could be requested during this connection.
+                                            * (TUint32 - default: none - read only)
+                                            */
+        
+        EHscsdAsymmetry = 20104,            /**<
+                                            * Enum of type TMobileCallAsymmetry for 
+                                            * HSCSD.
+                                            * (TUint32 - default: none)
+                                            */
+        
+        EHscsdUserInitUpgrade = 20105,      /**<
+                                            * HSCSD parameter - user init upgrade.
+                                            * (TBool - default: none)
+                                            */
+
+        EPluginHSCSDAttribRangeMax = 29999  /**<
+                                            * Marks the end of HSCSD attributes.
+                                            */
+        };
+    } // namespace CMManager
+    
+#endif // CMPLUGINHSCSDDEF_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/connection_settings_api/inc/cmpluginpacketdatadef.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,442 @@
+/*
+* 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:  packet data specific enums
+*
+*/
+
+#ifndef CMPLUGINPACKETDATADEF_H
+#define CMPLUGINPACKETDATADEF_H
+
+/**  ECOM interface UID */
+const TUint KUidPacketDataBearerType = 0x10207378;
+
+namespace CMManager
+    {
+    /** Packet Data specific connection method attributes */
+enum TConnectionMethodPacketDataSpecificAttributes
+    {
+    EPacketDataSpecificAttributes = 10000,  /**<
+                                            * Marks the beginning of packet
+                                            * data specific attributes.
+                                            */
+    
+    EPacketDataOutGoing,            /**<
+                                    * Indicates the direction of this connection method. 
+                                    * Value ETrue means outgoing, EFalse is incoming. 
+                                    * Can be changed dynamically, 
+                                    * but every packet data specific data is lost then.
+                                    * (TBool - default: ETrue)
+                                    */
+                                    
+    EPacketDataAPName = 10100,      /**<
+                                    * Access point name.
+                                    * (String - default: None)
+                                    */
+                                            
+    EPacketDataPDPType,             /**<
+                                    * PDP type. Values can be one 
+                                    * (RPacketContext::TProtocolType):
+                                    *   - EPdpTypeIPv4 or
+                                    *   - EPdpTypeIPv6
+                                    * (TUint32 - default: EPdpTypeIPv4 
+                                    *                       if IPv4 only
+                                    *                     EPdpTypeIPv6 
+                                    *                       if IPv6 supported )
+                                    */
+
+    EPacketDataPDPAddress,          /**<
+                                    * PDP address of phone.
+                                    * ( String - default: None)
+                                    */
+                                            
+    EPacketDataReqPrecedence,       /**<
+                                    * Requested quality of service precedence class.
+                                    * ( TUint32 - default: None)
+                                    */
+
+    EPacketDataReqDelay,            /**<
+                                    * Requested quality of service delay class.
+                                    * ( TUint32 - default: None)
+                                    */
+
+    EPacketDataReliability,         /**<
+                                    * Requested quality of service reliability class.
+                                    * ( TUint32 - default: None)
+                                    */
+
+    EPacketDataPeakThroughput,      /**<
+                                    * Requested quality of service peak throughput class.
+                                    * ( TUint32 - default: None)
+                                    */
+
+    EPacketDataMeanThroughput,      /**<
+                                    * Requested quality of service mean throughput class.
+                                    * ( TUint32 - default: None)
+                                    */
+
+    EPacketDataMinPrecedence,       /**<
+                                    * Minimum quality of service precedence class.
+                                    * ( TUint32 - default: None)
+                                    */
+
+    EPacketDataMinDelay,            /**<
+                                    * Minimum quality of service delay class.
+                                    * ( TUint32 - default: None)
+                                    */
+
+    EPacketDataMinReliability,      /**<
+                                    * Minimum quality of service reliability class.
+                                    * ( TUint32 - default: None)
+                                    */
+
+    EPacketDataMinPeakThroughput,   /**<
+                                    * Minimum quality of service peak throughput class.
+                                    * ( TUint32 - default: None)
+                                    */
+
+    EPacketDataMinMeanThroughput,   /**<
+                                    * Minimum quality of service mean throughput class.
+                                    * ( TUint32 - default: None)
+                                    */
+
+    EPacketDataDataCompression,     /**<
+                                    * Data compression on?
+                                    * ( TBool - default: None)
+                                    */
+
+    EPacketDataHeaderCompression,   /**<
+                                    * IP header compression on?
+                                    * ( TBool - default: None)
+                                    */
+
+    EPacketDataUseEdge,             /**<
+                                    * EDGE parameter.
+                                    * ( TBool - default: None)
+                                    */
+
+    EPacketDataAnonymousAccess,     /**<
+                                    * Use anonymous access on?
+                                    * ( TBool - default: None)
+                                    */
+
+    EPacketDataIFParams,            /**<
+                                    * Interface parameter string.
+                                    * ( String - default: None)
+                                    */
+
+    EPacketDataIFNetworks,          /**<
+                                    * Comma separated list of network protocols,
+                                    * e.g. "PPP".
+                                    * ( String - default: None)
+                                    */
+
+    EPacketDataIFPromptForAuth,     /**<
+                                    * Prompt user for authentication 
+                                    * username and password?
+                                    * ( TBool - default: None)
+                                    */
+
+    EPacketDataIFAuthName,          /**<
+                                    * Authentication username used by PPP.
+                                    * ( String - default: None)
+                                    */
+
+    EPacketDataIFAuthPass,          /**<
+                                    * Authentication password used by PPP.
+                                    * ( String - default: None)
+                                    */
+
+    EPacketDataIFAuthRetries,       /**<
+                                    * Number of times to retry authentication if it fails.
+                                    * ( TUint32 - default: None)
+                                    */
+
+    EPacketDataIPNetmask,           /**<
+                                    * IP net mask of interface.
+                                    * ( String - default: None)
+                                    */
+
+    EPacketDataIPGateway,           /**<
+                                    * IP address of gateway
+                                    * ( String - default: None)
+                                    */
+
+    EPacketDataIPAddrFromServer,    /**<
+                                    * Get IP addresses (for EPOC) from server?
+                                    * ( TBool - default: None)
+                                    */
+
+    EPacketDataIPAddr,              /**<
+                                    * IP address of EPOC.
+                                    * ( String - default: None)
+                                    */
+
+    EPacketDataIPDNSAddrFromServer, /**<
+                                    * Get DNS addresses from server?
+                                    * ( TBool - default: None)
+                                    */
+
+    EPacketDataIPNameServer1,       /**<
+                                    * IP Address of primary name server.
+                                    * ( String - default: None)
+                                    */
+
+    EPacketDataIPNameServer2,       /**<
+                                    * IP Address of secondary name server.
+                                    * ( String - default: None)
+                                    */
+
+    EPacketDataIPIP6DNSAddrFromServer,  /**<
+                                        * Get IP6 DNS addresses from server?
+                                        * ( TBool - default: None)
+                                        */
+
+    EPacketDataIPIP6NameServer1,    /**<
+                                    * IP6 Address of primary name server.
+                                    * ( String - default: None)
+                                    */
+
+    EPacketDataIPIP6NameServer2,    /**<
+                                    * IP6 Address of secondary name server.
+                                    * ( String - default: None)
+                                    */
+
+    EPacketDataIPAddrLeaseValidFrom,/**<
+                                    * IP address valid from this time, used to store 
+                                    * dynamically assigned address lease info.
+                                    * ( String - default: None)
+                                    */
+
+    EPacketDataIPAddrLeaseValidTo,  /**<
+                                    * IP address valid for use until this time, 
+                                    * used to store.
+                                    * ( String - default: None)
+                                    */
+
+    EPacketDataConfigDaemonManagerName, /**<
+                                        * IP address valid for use until this time, 
+                                        * used to store dynamically assigned address 
+                                        * lease info.
+                                        * ( String - default: None)
+                                        */
+
+    EPacketDataConfigDaemonName,    /**<
+                                    * Name of the ECOM configuration daemon manager 
+                                    * component. This component interfaces with the 
+                                    * server identified in ISP_CONFIG_DAEMON_NAME. 
+                                    * If specified, ISP_CONFIG_DAEMON_NAME 
+                                    * should also be specified. 
+                                    * Name of the configuration daemon server. 
+                                    * This server is used to provide further
+                                    * configuration for a connection, 
+                                    * e.g. dynamic IP address assignment. 
+                                    * If specified, ISP_CONFIG_DAEMON_MANAGER_NAME 
+                                    * should also be specified.
+                                    * ( String - default: None)
+                                    */
+
+    EPacketDataEnableLcpExtension,  /**<
+                                    * Enable LCP extensions?
+                                    * ( TBool - default: None)
+                                    */
+
+    EPacketDataDisablePlainTextAuth,/**<
+                                    * Disable plain text authentication?
+                                    * ( TBool - default: None)
+                                    */
+
+    EPacketDataApType,              /**<
+                                    * Service supports Internet only, WAP only or both.
+                                    * Values can be any of TPacketDataType.
+                                    * ( TUint32 - default: None)
+                                    */
+
+    EPacketDataQoSWarningTimeOut,   /**<
+                                    * If the requested QOS can not be satisfied warn
+                                    * the user after this time in microseconds. 
+                                    * Set to 0xffffffff to disable.
+                                    * ( TUint32 - default: None)
+                                    */
+
+    EPacketDataServiceEnableLLMNR,  /**<
+                                    * Enable LLMNR?
+                                    * ( TBool - default: None)
+                                    */
+
+    EGPRSReqTrafficClass = 10200,   /**< 
+                                    * Requested traffic class
+                                    * Defined in etelqos.h in RPacketQoS::TTrafficClass.
+                                    * (TUint32 - default: ETrafficClassUnspecified)
+                                    */
+    
+    EGPRSMinTrafficClass,           /**< 
+                                    * Minimum acceptable traffic class.
+                                    * Defined in etelqos.h in RPacketQoS::TTrafficClass.
+                                    * (TUint32 - default: ETrafficClassUnspecified)
+                                    */
+
+    EGPRSReqDeliveryOrder,          /**< 
+                                    * Requested value for sequential SDU delivery.
+                                    * Defined in etelqos.h in RPacketQoS::TDeliveryOrder.
+                                    * (TUint32 - default: EDeliveryOrderUnspecified)
+                                    */
+    
+    GPRSMinDeliveryOrder,           /**< 
+                                    * Minimum acceptable value for sequential SDU delivery.
+                                    * Defined in etelqos.h in RPacketQoS::TDeliveryOrder.
+                                    * (TUint32 - default: EDeliveryOrderUnspecified)
+                                    */
+    
+    EGPRSReqDeliverErroneousSDU,    /**< 
+                                    * Requested value for erroneous SDU delivery.
+                                    * Defined in etelqos.h in RPacketQoS::TErroneousSDUDelivery.
+                                    * (TUint32 - default: EErroneousSDUDeliveryUnspecified)
+                                    */
+    
+    EGPRSMinDeliverErroneousSDU,    /**< 
+                                    * Minimum acceptable value for erroneous SDU delivery.
+                                    * Defined in etelqos.h in RPacketQoS::TErroneousSDUDelivery.
+                                    * (TUint32 - default: EErroneousSDUDeliveryUnspecified)
+                                    */
+    
+    EGPRSReqMaxSDUSize,             /**< 
+                                    * Request maximum SDU size.
+                                    * (TInt32 - default: 0)
+                                    */
+    
+    EGPRSMinAcceptableMaxSDUSize,	/**< 
+                                    * Minimum acceptable SDU size.
+                                    * (TInt32 - default: 0)
+                                    */
+    
+    EGPRSReqMaxUplinkRate,          /**< 
+                                    * Requested maximum bit rates on uplink.
+                                    * (TInt32 - default: 0)
+                                    */
+    
+    EGPRSReqMinUplinkRate,          /**< 
+                                    * Requested minimum bit rates on uplink.
+                                    * (TInt32 - default: 0)
+                                    */
+    
+    EGPRSReqMaxDownlinkRate,        /**< 
+                                    * Requested maximum bit rates on downlink.
+                                    * (TInt32 - default: 0)
+                                    */
+
+    EGPRSReqMinDownlinkRate,        /**< 
+                                    * Requested minimum bit rates on downlink.
+                                    * (TInt32 - default: 0)
+                                    */
+    
+    EGPRSReqBER,                    /**< 
+                                    * Requested target BER.
+                                    * Defined in etelqos.h in RPacketQoS::TBitErrorRatio.
+                                    * (TUint32 - default: EBERUnspecified)
+                                    */
+    
+    EGPRSMaxBER,                    /**< 
+                                    * Maximum acceptable target BER.
+                                    * Defined in etelqos.h in RPacketQoS::TBitErrorRatio.
+                                    * (TUint32 - default: EBERUnspecified)
+                                    */
+    
+    EGPRSReqSDUErrorRatio,          /**< 
+                                    * Requested target SDU error ratio.
+                                    * Defined in etelqos.h in RPacketQoS::TSDUErrorRatio.
+                                    * (TUint32 - default: ESDUErrorRatioUnspecified)
+                                    */
+    
+    EGPRSMaxSDUErrorRatio,          /**< 
+                                    * Maximum acceptable target SDU error ratio.
+                                    * Defined in etelqos.h in RPacketQoS::TSDUErrorRatio.
+                                    * (TUint32 - default: ESDUErrorRatioUnspecified)
+                                    */
+    
+    EGPRSReqTrafficHandlingPriority,	/**< 
+                                        * Requested traffic handling priority.
+                                        * Defined in etelqos.h in RPacketQoS::TTrafficHandlingPriority.
+                                        * (TUint32 - default: ETrafficPriorityUnspecified)
+                                        */
+    
+    EGPRSMinTrafficHandlingPriority,	/**< 
+                                        * Minimum acceptable traffic handling priority.
+                                        * Defined in etelqos.h in RPacketQoS::TTrafficHandlingPriority.
+                                        * (TUint32 - default: ETrafficPriorityUnspecified)
+                                        */
+    
+    EGPRSReqTransferDelay,          /**< 
+                                    * Requested transfer delay(in milliseconds).
+                                    * (TInt32 - default: 0)
+                                    */
+    
+    EGPRSMaxTransferDelay,          /**< 
+                                    * Maximum acceptable transfer delay(in milliseconds).
+                                    * (TInt32 - default: 0)
+                                    */
+    
+    EGPRSReqGuaranteedUplinkRate,       /**< 
+                                        * Requested guaranteed bit rates on uplink.
+                                        * (TInt32 - default: 0)
+                                        */
+    
+    EGPRSMinGuaranteedUplinkRate,      	/**< 
+                                        * Minimum acceptable guaranteed bit rates on uplink.
+                                        * (TInt32 - default: 0)
+                                        */
+    
+    EGPRSReqGuaranteedDownlinkRate,  	/**< 
+                                        * Requested guaranteed bit rates on downlink.
+                                        * (TInt32 - default: 0)
+                                        */
+    
+    EGPRSMinGuaranteedDownlinkRate,	    /**< 
+                                        * Minimum acceptable guaranteed bit rates on downlink.
+                                        * (TInt32 - default: 0)
+                                        */
+    
+    EGPRSSignallingIndication,		   	/**< 
+                                        * Signalling indication.
+                                        * (TBool - default: EFalse)
+                                        */
+    
+    EGPRS_ImCnSignallingIndication,     /**< 
+                                        * IP Multimeida System (IMS) Core Network (CN) Signalling Indicator.
+                                        * (TBool - default: EFalse)
+                                        */
+    
+    EGPRSSourceStatisticsDescriptor,    /**< 
+                                        * Static source descriptor.
+                                        * Defined in etelqos.h in RPacketQoS::TSourceStatisticsDescriptor.
+                                        * (TUint32 - default: ESourceStatisticsDescriptorUnknown)
+                                        */
+    
+
+    EPacketDataRangeMax = 19999     /**<
+                                    * Marks the end of packet data specific
+                                    * attributes.
+                                    */
+    };
+
+/** Enumeration for packet data AP types */
+enum TPacketDataApType
+    {
+    EPacketDataInternetOnly,    ///< Internet-only connection method
+    EPacketDataWAPOnly,         ///< WAP-only connection method
+    EPacketDataBoth             ///< Connection method supports both WAP and
+                                ///< Internet
+    };
+} // namespace CMManager
+    
+#endif // CMPLUGINPACKETDATADEF_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/connection_settings_api/inc/cmpluginvpndef.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,90 @@
+/*
+* 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:  Attributes for VPN plug-in.
+*
+*/
+
+#ifndef VPN_PLUGIN_DEF_H
+#define VPN_PLUGIN_DEF_H
+
+#include <cmconnectionmethoddef.h>
+
+/**  ECOM interface UID */
+const TUint KPluginVPNBearerTypeUid = 0x10281BBD;
+
+namespace CMManager
+    {
+    /**
+     VPN specific attributes
+     
+     Note: ECmProxyPortNumber is a common bearer attribute, but its  default
+     value varies in the VPN plug-in, where it is 80
+     
+     Note2: VPN, as it is a virtual plugin, does not supports the following 
+     common attributes (these are valid only for real bearers):
+            ECmIFName,                  ECmIFParams,        
+            ECmIFNetworks,              ECmIFPromptForAuth,
+            ECmIFAuthName,              ECmIFAuthPass,
+            ECmIFAuthRetries,           ECmIPNetmask,
+            ECmIPGateway,               ECmIPAddFromServer,
+            ECmIPAddress,               ECmIPDNSAddrFromServer,
+            ECmIPNameServer1,           ECmIPNameServer2,   
+            ECmIP6DNSAddrFromServer,    ECmIP6NameServer1,
+            ECmIP6NameServer2,          ECmIPAddrLeaseValidFrom,
+            ECmIPAddrLeaseValidTo,      ECmConfigDaemonManagerName,
+            ECmConfigDaemonName,        ECmEnableLPCExtension,
+            ECmDisablePlainTextAuth
+     Querying these will leave with KErrNotSupported.
+     */
+    enum TConnectionMethodVpnSpecificAttributes
+        {
+        EPluginVpnAttribStart = 30000,  /**<
+                                        * Marks the beginning of the VPN
+                                        * attributes.
+                                        */
+        
+        EVpnServicePolicyName = 30100,  /**<
+                                        * Policy name.
+                                        * (String - default: None)
+                                        */
+                                        
+        EVpnServicePolicy,              /**<
+                                        * Policy.
+                                        * (String - default: None)
+                                        */
+
+
+        EVpnIapId,                      /**<
+                                        * Home IAP Id.
+                                        * (TUint32 - default: None)
+                                        */
+
+        EVpnNetworkId,                  /**<
+                                        * Network Id.
+                                        * (TUint32 - default: None - read only)
+                                        */
+                                        
+        EVpnServiceEnableLLMNR,         /**<
+                                        * LLMNR
+                                        * (TBool - default: EFalse)
+                                        */
+
+        EPluginVpnAttribRangeMax = 39999    /**<
+                                            * Marks the end of the VPN
+                                            * attributes.
+                                            */
+        };
+    } // namespace CMManager
+    
+#endif // VPN_PLUGIN_DEF_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/connection_settings_api/inc/cmpluginwlandef.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,241 @@
+/*
+* 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:  ?description
+*
+*/
+
+#ifndef CMPLUGIN_WLAN_DEF_H
+#define CMPLUGIN_WLAN_DEF_H
+
+#include <cmconnectionmethoddef.h>
+
+/**  ECOM interface UID */
+const TUint KUidWlanBearerType = 0x10281BB1;
+
+namespace CMManager
+    {
+    /** enumerations for WLAN network modes */
+    enum TWlanNetMode
+        {
+        EAdhoc       = 0,   ///< Ad-Hoc mode
+        EInfra       = 1    ///< Infrastructure mode
+        };
+        
+    /** enumerations for WLAN security modes 
+     ** It's possible to extend this enumeration */
+    enum TWlanSecMode
+        {
+        EWlanSecModeOpen    = 1,    ///< Open security mode
+        EWlanSecModeWep     = 2,    ///< WEP security mode
+        EWlanSecMode802_1x  = 4,    ///< 802.1x security mode
+        EWlanSecModeWpa     = 8,    ///< WPA security mode
+        EWlanSecModeWpa2    = 16,   ///< WPA2 security mode
+        EWlanSecModeWAPI    = 32    ///< WAPI security mode
+        };
+
+    /** Wlan specific connection method attributes */
+    enum TConnectionMethodWlanSpecificAttributes
+        {
+        /**
+        * Comma separated list of network protocols, e.g. "PPP".
+        * ( String - default: None)
+        */
+        EWlanIfNetworks = KLanBaseIfNetworks,
+
+        /**
+        * IP net mask of interface.
+        * ( String - default: None)
+        */        
+        EWlanIpNetMask,
+            
+        /**
+        * IP address of gateway
+        * ( String - default: None)
+        */
+        EWlanIpGateway,
+            
+        /**
+        * Get IP addresses (for EPOC) from server?
+        * ( TBool - default: None)
+        */
+        EWlanIpAddrFromServer,
+        
+        /**
+        * IP address of EPOC.
+        * ( String - default: None)
+        */
+        EWlanIpAddr,
+        
+        /**
+        * Get DNS addresses from server?
+        * ( TBool - default: None)
+        */
+        EWlanIpDNSAddrFromServer,
+
+        /**
+        * IP Address of primary name server.
+        * ( String - default: None)
+        */
+        EWlanIpNameServer1,
+            
+        /**
+        * IP Address of secondary name server.
+        * ( String - default: None)
+        */
+        EWlanIpNameServer2,
+        
+        /**
+        * Get IP6 DNS addresses from server?
+        * ( TBool - default: None)
+        */
+        EWlanIp6DNSAddrFromServer,
+        
+        /**
+        * IP6 Address of primary name server.
+        * ( String - default: None)
+        */
+        EWlanIp6NameServer1,
+        
+        /**
+        * IP6 Address of secondary name server.
+        * ( String - default: None)
+        */
+        EWlanIp6NameServer2,
+        
+        /**
+        * IP address valid from this time, used to store 
+        * dynamically assigned address lease info.
+        * ( String - default: None)
+        */
+        EWlanIpAddrLeaseValidFrom,
+            
+        /**
+        * IP address valid for use until this time, used to store
+        * dynamically assigned address lease info.
+        * ( String - default: None)
+        */
+        EWlanIpAddrLeaseValidTo,
+            
+        /**
+        * Name of the ECOM configuration daemon manager component. 
+        * This component interfaces with the server identified in 
+        * ISP_CONFIG_DAEMON_NAME. If specified, ISP_CONFIG_DAEMON_NAME 
+        * should also be specified. 
+        * ( String - default: None)
+        */
+        EWlanConfigDaemonManagerName,
+            
+        /**
+        * Name of the configuration daemon server. 
+        * This server is used to provide further configuration for 
+        * a connection, e.g. dynamic IP address assignment. 
+        * If specified, ISP_CONFIG_DAEMON_MANAGER_NAME should also 
+        * be specified.
+        * ( String - default: None)
+        */
+        EWlanConfigDaemonName,
+            
+        /**
+        * Name of the WLAN Service Extension table.
+        * ( String - default: None)
+        */
+        EWlanServiceExtensionTableName,
+            
+        /**
+        * The record ID of the linked WLAN Service Extension record in the
+        * WLAN Service Extension table.
+        * ( TUint32 - default: None)
+        */
+        EWlanServiceExtensionTableRecordId,
+        
+        /**
+        * Marks the beginning of WLAN specific attributes.
+        */
+        EWlanSpecificAttributes = 30000,
+            
+        /**
+        * The record ID to which IAP record these settings belong to.
+        * ( TUint32 - default: None)
+        */
+        EWlanServiceId = 30100,
+            
+        /**
+        * The connection mode. This can be either Ad-hoc or infrastructure.
+        * TWlanNetMode enum is to be used.
+        * ( TUint32 - default: EInfra )
+        */
+        EWlanConnectionMode,
+            
+        /**
+        * The SSID of this WLAN connection.
+        * ( String - default: None)
+        */
+        EWlanSSID,
+            
+        /**
+        * Used SSID.
+        * ( String - default: None)
+        */
+        EWlanUsedSSID,
+            
+        /**
+        * The security mode of this WLAN connection. It is a TWlanSecMode enum.
+        * ( TUint32 - default: EWlanSecModeOpen )
+        */
+        EWlanSecurityMode,
+            
+        /**
+        * Authentication type: none, wep, wpa, wpapresharedkey
+        * ( TUint32 - default: None )
+        */
+        EWlanAuthenticationMode,
+            
+        /**
+        * Gives whether it should scan for the SSID.
+        * (TBool - default: EFalse )
+        */
+        EWlanScanSSID,
+        
+        /**
+        * This is the channel ID in ad-hoc network mode
+        * ( TUint32 - default: EAdhocAutomatic, if set to EAdhocUserDefined default = 7 )
+        */
+        EWlanChannelID,
+        
+        /**
+        * Gives whether it is allowed to roam inside one SSID or not.
+        * (TBool - default: determined through variation )
+        */
+        EWlanAllowSSIDRoaming,
+        
+            
+        // The following attributes before EWlanRangeMax are for internal use only
+        /**
+        * Internal limiter
+        */
+        EWlanRangeInternal = 35000,
+            
+        /**
+        * Internal, used for the security settings.
+        */
+        EWlanSecuritySettings,
+        
+        /**
+        * Marks the end of WLAN attributes.
+        */
+        EWlanRangeMax = 39999
+        };
+    } // namespace CMManager
+
+#endif // CMPLUGIN_WLAN_DEF_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/connection_settings_api/inc/cmsettingsui.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of settings UI
+*
+*/
+
+#ifndef C_CMSETTINGSUI_H
+#define C_CMSETTINGSUI_H
+
+#include <E32def.h>
+#include <e32base.h>
+
+class CCmSettingsUiImpl;
+
+/**
+ *  Implementation of Setting UI
+ *
+ *  @lib cmmanager.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS(CCmSettingsUi) : public CBase
+    {
+    public:
+
+        enum TResult
+                {
+                EBack,
+                EExit
+                };
+
+        /** Epoc constructor */
+        IMPORT_C static CCmSettingsUi* NewL();
+
+        /** Destructor */
+        virtual ~CCmSettingsUi();
+
+    //=========================================================================    
+    // UI API
+    //
+    public:
+
+        /**
+        * Launches the Settings UI 
+        * for handling Destinations and Connection Methods
+        * @since 3.2
+        * @return TResult - the softkey the user exited with
+        */
+        IMPORT_C TResult RunSettingsL();
+        
+        /**
+        * Launches a dialog with a list of Destination
+        * @since 3.2
+        * @param  aDestinationId ID of the selected Destination
+        * @return TBool
+        */
+        IMPORT_C TBool SelectDestinationDlgL( TUint32& aDestinationId );
+
+    private:
+
+        /** First stage constructor */
+        CCmSettingsUi();
+
+        /** Epoc constructor */
+        void ConstructL();
+
+    private: // data
+
+        CCmSettingsUiImpl* iImpl;
+    };
+
+#endif // C_CMSETTINGSUI_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/connection_settings_ui_api/connection_settings_ui_api.metaxml	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,18 @@
+<?xml version="1.0" ?>
+<api id="4b950b5ff5cb2e7fd0b6c8e0591ea243" dataversion="1.0">
+  <name>Connection Settings UI API</name>
+  <description>Connection Settings UI API provides UI for applications to let the user to choose a Destination or a Connection Method. The main purpose is to save the selected Destination or Connection method and use it as permanent setting.</description>
+  <type>c++</type>
+  <subsystem>cmmanager</subsystem>
+  <libs>
+    <lib name="cmmanager.lib" />
+  </libs>
+  <release category="sdk" sinceversion="3.2"/>
+  <attributes>
+     <!-- This indicates wether the api provides separate html documentation -->
+     <!-- or is the additional documentation generated from headers. -->
+     <!-- If you are unsure then the value is "no" -->
+     <htmldocprovided>yes</htmldocprovided>
+     <adaptation>no</adaptation>
+  </attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/connection_settings_ui_api/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* 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:  File that exports the files belonging to 
+:                Connection Settings UI API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/cmapplicationsettingsui.h     MW_LAYER_PUBLIC_EXPORT_PATH(cmapplicationsettingsui.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/connection_settings_ui_api/inc/cmapplicationsettingsui.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,300 @@
+/*
+* 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:  
+*
+*/
+
+#ifndef C_CMAPPLICATIONSETTINGSUI_H
+#define C_CMAPPLICATIONSETTINGSUI_H
+
+#include <E32def.h>
+#include <e32base.h>
+
+class CCmConnSettingsUiImpl;
+namespace CMManager
+    {
+    
+    /**
+    * CCmApplicationSettingsUi::RunApplicationSettingsL leaves with this 
+    * error code if the selection dialog would have zero elements caused 
+    * by filtering out all the Connection Methods with the aFilterArray
+    * and not requesting other list elements by the aListItems bitfield.
+    * See the comment of the RunApplicationSettingsL method for more 
+    * detailes.
+    * This error code is supported by the error resolver. 
+    */
+    const TInt KErrConnectionNotFound = -32700;
+    
+    /** 
+    * The selection type of a list item in application settings UI
+    */
+    enum TCmSettingSelectionMode
+        {
+        EAlwaysAsk,         /**<
+                            * The user selected Always ask 
+                            */
+        EDestination,       /**<
+                            * The user selected a destination
+                            */
+        EConnectionMethod,  /**<
+                            * The user selected a connection method
+                            */
+        EDefaultConnection // The user selected Default Connection 
+
+        };
+        
+    
+    /** 
+    * These bitmasks controls what items does the selection UI containes.
+    * Bitmasks not listed in the enum are reserved for future usage and they
+    * are disabled by default. So extending these bitmasks does not cause 
+    * BC break later.
+    */
+    enum TCmSelectionDialogItems
+        {
+        EShowAlwaysAsk = 0x01,          /**<
+                                        * AlwaysAsk is added to the 
+                                        * selection UI.
+                                        */                                
+        EShowDefaultConnection = 0x02,  /**<
+                                        * DefaultConnection is added to the 
+                                        * selection UI.
+                                        */           
+        
+        /**
+        * The following enumerations controls how destinations and 
+        * Connection Methods are presented in the selection UI.
+        * EShowDestinations is set and EShowConnectionMethods is set:
+        *   Destination list is added to the selection UI and a Connection
+        *   Method can be selected inside a Destination.
+        * EShowDestinations is set and EShowConnectionMethods is not set:
+        *   Destination list is added to the selection UI and no Connection
+        *   Method can be selected inside a Destination. 
+        * EShowDestinations is not set and EShowConnectionMethods is set:
+        *   Connection Method list is added to the selection UI. Connection
+        *   Methods are ordered according to the global bearer type 
+        *   priorities. Destination cannot be selected.
+        * EShowDestinations is not set and EShowConnectionMethods is not set:
+        *   The selection UI will not contain any Destination or Connection 
+        *   Method. E.g. If EShowAlwaysAsk and EShowDefaultConnection was set
+        *   then the selection UI will contain two entries (AlwaysAsk and 
+        *   DefaultConnection).
+        */
+        EShowDestinations = 0x04,       /**<
+                                        * Destination list is added to the 
+                                        * selection UI. Destinations which
+                                        * does not contain any Connection
+                                        * Methods are not shown.
+                                        */
+        EShowConnectionMethods = 0x08,  /**<
+                                        * If EShowDestinations is set:
+                                        *   Connection Method can be selected
+                                        *   inside a destination.
+                                        * If EShowDestinations is not set:
+                                        *   Connection Method list is added to 
+                                        *   the selection UI.
+                                        */                                  
+        };    
+        
+    }// namespace CMManger
+
+
+    // Structs
+    
+/**
+ * Stores the details of a setting selection
+ *
+ *  @lib cmmanager.lib
+ *  @since S60 3.2
+ */
+NONSHARABLE_STRUCT( TCmSettingSelection )
+    {
+    /**
+    * Selection mode, refers to the type of the list item which is selected
+    */
+    CMManager::TCmSettingSelectionMode iResult;
+    
+    /**
+    * Id of the selected destination or connection method
+    */
+    TUint iId;
+    };
+
+/**
+* Typedef of the bearer filter array.
+* This type of array is used to filter Connection Methods
+* by bearer types.
+*
+* The array elements are bearer IDs. The IDs are defined in the bearer
+* type specific cmplugin...def.h files. E.g. the ID of the CSD bearer
+* type (KUidCSDBearerType) can be found in the cmplugincsddef.h header.
+*/
+typedef RArray<TUint32> TBearerFilterArray;
+
+/**
+ * For launching the Application Settings UI
+ *
+ * Displays a radio button page for an application used to select
+ * a destination or connection method
+ *
+ *  @lib cmmanager.lib
+ *  @since S60 3.2
+ */
+NONSHARABLE_CLASS( CCmApplicationSettingsUi ) : public CBase
+    {
+
+    public: // construction/destruction
+
+        /** Epoc constructor */
+        IMPORT_C static CCmApplicationSettingsUi* NewL();
+
+        /** Epoc constructor 
+        * Pushes the object on the cleanup stack
+        */
+        IMPORT_C static CCmApplicationSettingsUi* NewLC();
+
+        /** Destructor. */
+        virtual ~CCmApplicationSettingsUi();
+
+    //=======================================================================
+    // UI API
+    //
+    public:
+
+        /**
+        * Launches the 'easy to use' Settings UI provided for applications
+        * for handling Destinations and Connection Methods.
+        * This function call launches the same selection dialog as the 
+        * the extended RunApplicationSettingsL do (see below) with the
+        * list items Default Connection, Destinations and  Connection Methods 
+        * without any filtering.
+        *
+        * @since 3.2
+        * @param aSelection If initialised to a valid value, sets the higlight to the
+        * corresponding list item at startup. If a list of Destinations is displayed, and
+        * the initial highlight is set to a Connection Method, the parent Destination
+        * gets highlighted. On return, holds user selection.
+        * @return TBool seleceted or not.
+        */
+        IMPORT_C TBool RunApplicationSettingsL( 
+                                        TCmSettingSelection& aSelection );
+
+        /**
+        * Launches the 'easy to use' Settings UI provided for applications
+        * for handling Destinations and Connection Methods
+        *
+        * @since 3.2
+        * @param aSelection If initialised to a valid value, sets the higlight to the
+        * corresponding list item at startup. If a list of Destinations is displayed, and
+        * the initial highlight is set to a Connection Method, the parent Destination
+        * gets highlighted. On return, holds user selection.
+        * @param aListItems A bit field which indicates which items shoud be
+        *                   shown in the selection dialog. The bitmasks are 
+        *                   defined in the TCmSelectionDialogItems enum.
+        *
+        * The function leaves with KErrNotSupported  if all the items which 
+        * were set to be shown are not supported/enabled. 
+        * E.g. Default Connection availability/support is controlled by the 
+        * Feature Manager so if only EShowDefaultConnection is set and the 
+        * Default Connection feature is not enabled than the function leaves
+        * with KErrNotSupported.
+        *
+        * In other cases (when an item or items are not supported/enabled but
+        * not all) the selected but not supported/enabled items are not added
+        * to the list. The request to show such an item is silently ignored.
+        *
+        *
+        * Special note about the EShowDestinations and EShowConnectionMethods
+        * bitmasks:      
+        *   The following enumerations controls how how destinations and 
+        *   Connection Methods are presented in the selection UI.
+        *   General rule about the EShowDestinations:
+        *     Destinations which does not contain any Connection Methods are 
+        *     not shown in the selection dialog. The same rule is applied if
+        *     the Destination containes Connection Methods but all of them 
+        *     are filtered out by the filtering criteria.
+        *   EShowDestinations is set and EShowConnectionMethods is set:
+        *     Destination list is added to the selection UI and a Connection
+        *     Method can be selected inside a Destination.
+        *   EShowDestinations is set and EShowConnectionMethods is not set:
+        *     Destination list is added to the selection UI and no Connection
+        *     Method can be selected inside a Destination. 
+        *   EShowDestinations is not set and EShowConnectionMethods is set:
+        *     Connection Method list is added to the selection UI. Connection
+        *     Methods are ordered according to the global bearer type 
+        *     priorities. Destination cannot be selected.
+        *   EShowDestinations is not set and EShowConnectionMethods is not set:
+        *     The selection UI will not contain any Destination or Connection 
+        *     Method. E.g. If EShowAlwaysAsk and EShowDefaultConnection was 
+        *     set then the selection UI will contain two entries (AlwaysAsk
+        *     and DefaultConnection).
+        *
+        * @param aFilterArray Only Connection Methods with bearer types from
+        *                     the aFilterArray will be shown. 
+        *                     All Connection Methods will be listed if the 
+        *                     array has no element.
+        * @return TBool seleceted or not.
+        *
+        * @leave KErrArgument If the selection dialog would have zero 
+        *                     elements based on the aListItems bitmask
+        *                     (aListItems is equal to zero). 
+        *
+        * @leave KErrNotSupported 
+        *                     If the selection dialog would have zero 
+        *                     elements based on the aListItems bitmask
+        *                     (all the selected elements in aListItems  
+        *	                  are not supported/disabled).
+        *                     E.g. aListItems = EShowDefaultConnection but 
+        *                     Default Connection feature is not enabled.
+        *
+        * @leave KErrConnectionNotFound 
+        *                     If the selection dialog would have zero 
+        *                     elements caused by filtering out all the 
+        *                     Connection Methods with the aFilterArray
+        *                     and not requesting other list elements by 
+        *                     the aListItems bitfield than the function 
+        *                     call leaves with KErrConnectionNotFound 
+        *                     error code. A corresponding error note can
+        *                     be shown using the error resolver. 
+        *                     E.g. 
+        *                       - aListItems = EShowConnectionMethods
+        *                     but all Connection Methods are filtered 
+        *                     out by the aFilterArray.
+        */
+        IMPORT_C TBool RunApplicationSettingsL( 
+                                        TCmSettingSelection& aSelection, 
+                                        TUint aListItems,
+                                        TBearerFilterArray& aFilterArray);
+
+    private:
+
+        /** C++ constructor */
+        CCmApplicationSettingsUi();
+
+        /**
+        * Epoc 2nd phase constructor
+        *
+        * @since S60 3.2        
+        */
+        void ConstructL();
+
+    private: // data
+
+        /**
+         * implementation of the class
+         */
+        CCmConnSettingsUiImpl* iImpl;    
+    };
+
+#endif // C_CMAPPLICATIONSETTINGSUI_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/data_connection_log_counters_api/data_connection_log_counters_api.metaxml	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,17 @@
+<?xml version="1.0" ?>
+<api id="91c9872266e185142a2a240bc4ff401e" dataversion="1.0">
+  <name>Data Connection Log Counters API</name>
+  <description>Central Repository keys KLogsGPRSSentCounter, KLogsGPRSReceivedCounter, KLogsWLANSentCounter, and KLogsWLANReceivedCounter (under UID KCRUidDCLLogs) can be used for monitoring byte counts of GPRS/UMTS incoming/outgoing data and WLAN incoming/outgoing data. The data amount is measures so that IP header and IP data are included.</description>
+  <type>c++</type>
+  <subsystem>connectionmonitoring</subsystem>
+  <libs>
+  </libs>
+  <release category="sdk" sinceversion="3.2"/>
+  <attributes>
+     <!-- This indicates wether the api provedes separate html documentation -->
+     <!-- or is the additional documentation generated from headers. -->
+     <!-- If you are unsuere then the value is "no" -->
+     <htmldocprovided>yes</htmldocprovided>
+     <adaptation>no</adaptation>
+  </attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/data_connection_log_counters_api/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* 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:  File that exports the files belonging to Data Connection
+*                Log Counters API.
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/dclcrkeys.h      MW_LAYER_PUBLIC_EXPORT_PATH(dclcrkeys.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/data_connection_log_counters_api/inc/dclcrkeys.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2004-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:  Contains Central Repository keys needed in logging GPRS/WLAN
+*                counters.
+*
+*/
+
+#ifndef DCLCRKEYS_H
+#define DCLCRKEYS_H
+
+const TUid KCRUidDCLLogs = {0x101F4CD5};
+
+// Amount of total sent bytes using GPRS.
+const TUint32 KLogsGPRSSentCounter     = 0x0000000C;
+
+// Amount of total received bytes using GPRS.
+const TUint32 KLogsGPRSReceivedCounter = 0x0000000D;
+
+// Amount of total sent bytes using WLAN.
+const TUint32 KLogsWLANSentCounter     = 0x00000014;
+
+// Amount of total received bytes using WLAN.
+const TUint32 KLogsWLANReceivedCounter = 0x00000015;
+
+#endif // DCLCRKEYS_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/extendedconnpref_api/extendedconnpref_api.metaxml	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<api id="73bfd02c12f0135a4cf31b94a56e910f" dataversion="2.0">
+  <name>Extendedconnpref API</name>
+  <description>Provides an API for configuring creation of an IP connection.</description>
+  <type>c++</type>
+  <collection>bearermanagement</collection>
+  <libs>
+    <lib name="extendedconnpref.lib"/>
+    <lib name="netmeta.lib"/>
+  </libs>
+  <release category="public" sinceversion="5.2"/>
+  <attributes>
+    <htmldocprovided>yes</htmldocprovided>
+    <adaptation>no</adaptation>
+  </attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/extendedconnpref_api/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* 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:  File that exports the files belonging to 
+:                Extended Connection Preferences API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/extendedconnpref.h     MW_LAYER_PUBLIC_EXPORT_PATH(extendedconnpref.h)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/extendedconnpref_api/inc/extendedconnpref.h	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,331 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implementation of Extended Connection Preferences API.
+*              
+*              This API defines extended connection parameters as a part of
+*              custom preferences mechanism making possible for Symbian 
+*              licensees to define their own parameter extensions.
+*
+*/
+
+#if !(defined __EXTENDEDCONNPREF_H__)
+#define __EXTENDEDCONNPREF_H__
+
+#include <e32base.h>
+#include <comms-infras/metadata.h>
+#include <connpref.h>
+#include <cmmanagerdef.h>
+
+
+class TExtendedConnPref : public Meta::SMetaDataECom
+/**
+User of this API must remember to link against extendedconnpref.lib and 
+netmeta.lib and add #include <extendedconnpref.h>.
+
+Set methods for the extended connection preference. This preference cannot be
+used with RConnection::Start as a TConnPref. It must be part of a 
+TConnPrefList. The extented connection preference can be appeded to connection
+setup parameters before RConnection::Start() dispatch. Appending is carried 
+out as follows. 
+
+See connpref.h for more details.
+
+@code
+
+RSocketServ sockSvr;
+RConnection conn;
+
+sockSvr.Connect();
+User::LeaveIfError(conn.Open(sockSvr));
+CleanupClosePushL(conn);
+
+TConnPrefList prefList;
+TExtendedConnPref extPrefs;
+
+extPrefs.SetSnapPurpose( CMManager::ESnapPurposeInternet );
+extPrefs.SetNoteBehaviour( ENoteBehaviourConnSilent );
+
+prefList.AppendL(&extPrefs);
+
+TInt error = conn.Start(prefList);
+
+CleanupStack::PopAndDestroy(&conn);
+@endcode
+
+@see TConnPrefList
+@see RConnection::Start
+
+@publishedAll
+@released since S60 5.2
+*/
+    {
+public:
+ 
+    enum
+        {
+        /** UID for Extended Connection Preference API implementation. */
+        EUid = 0x20016A82, 
+        /** Subidentifier. */
+        ETypeId = 1
+        };
+
+    /**
+    * ExtendedConnBearer enables application to request a specific bearer for
+    * a connection.
+    */
+    enum TExtendedConnBearer
+        {
+        /** Bearer support unknown. */
+        EExtendedConnBearerUnknown  = 0x00000000,
+        /** Support GPRS, 3G and Cdma2000 bearers. CSD not supported. */
+        EExtendedConnBearerCellular = 0x00000001,
+        /** WLAN bearer support. */
+        EExtendedConnBearerWLAN     = 0x00000002
+        };
+
+    /**
+    * TNoteBehaviour enables application to request a specific behaviour from
+    * the middleware regarding displaying of dialogs, notes and queries.
+    */
+    enum TNoteBehaviour
+        {
+        /** Displays notes and queries according to default settings. */
+        ENoteBehaviourDefault            = 0x00000000,
+        /**
+        * Starts connection and roams between different bearers without any 
+        * notes, i.e., notes about connection state are not shown to the user.
+        */
+        ENoteBehaviourConnDisableNotes   = 0x00000001,
+        /**
+        * Roams between different bearers without displaying any queries to
+        * the user but informs the user on the events with dialogs or notes.
+        * User is able to see only notes about connection state but not any
+        * queries which would need user's confirmation.
+        */
+        ENoteBehaviourConnDisableQueries = 0x00000002
+        };
+
+    /**
+    * Starts connection and roams between different bearers without any 
+    * queries, dialogs or notes, i.e., nothing about connection is shown
+    * to the user.
+    */
+    static const TUint32 ENoteBehaviourConnSilent =
+        ENoteBehaviourConnDisableNotes | ENoteBehaviourConnDisableQueries;
+
+    /** 
+    * Constructor.
+    */
+    IMPORT_C TExtendedConnPref();
+    
+    /**
+    * Sets the purpose of the SNAP identifying where the connection is 
+    * requested to. This function enables applications to start a connection
+    * to, e.g., Internet SNAP or intranet SNAP without iterating through all
+    * SNAPs to find the ID of the right one.
+    * Default value is ESnapPurposeUnknown meaning that any SNAP is fine.
+    * 
+    * If SNAP purpose is set, IAP id shall be zero.
+    * If SNAP purpose is set, SNAP id shall be zero.
+    * If SNAP purpose is set, Connection selection dialog shall be disabled.
+    * Either SNAP purpose, SNAP id, or IAP id shall be given, or Connection
+    * selection dialog shall be enabled.
+    * 
+    * @param aSnapPurpose SNAP Purpose.
+    */
+    IMPORT_C void SetSnapPurpose( CMManager::TSnapPurpose aSnapPurpose );
+
+    /**
+    * Gets SNAP purpose.
+    *
+    * @return SNAP purpose.
+    */
+    IMPORT_C CMManager::TSnapPurpose SnapPurpose() const;
+
+    /**
+    * Sets SNAP id. If SNAP id is zero, it is interpreted as 
+    * client's request for not requesting any specific SNAP.
+    * Default value is 0.
+    *
+    * If SNAP id is set, IAP id shall be zero.
+    * If SNAP id is set, SNAP purpose shall be CMManager::ESnapPurposeUnknown.
+    * If SNAP id is set, Connection selection dialog shall be disabled.
+    * Either SNAP purpose, SNAP id, or IAP id shall be given, or Connection
+    * selection dialog shall be enabled.
+    *
+    * @param aSnap SNAP id.
+    */
+    IMPORT_C void SetSnapId( TUint32 aSnapId );
+
+    /**
+    * Gets SNAP id.
+    *
+    * @return SNAP id.
+    */
+    IMPORT_C TUint32 SnapId() const;
+
+    /**
+    * Sets IAP id.
+    * 
+    * Setting IAP id means that the connection will be made utilizing given
+    * IAP id no matter what existing connections are available.
+    * 
+    * If IAP id is zero, it is interpreted as
+    * client's request for not requesting any specific IAP.
+    * Default value is 0.
+    * 
+    * If IAP id is set, SNAP id shall be zero.
+    * If IAP id is set, SNAP purpose shall be CMManager::ESnapPurposeUnknown.
+    * If IAP id is set, Connection selection dialog shall be disabled.
+    * If IAP id is set, bearer set shall be EExtendedConnBearerUnknown.
+    * If IAP id is set, forced roaming is disabled automatically.
+    * Either SNAP purpose, SNAP id, or IAP id shall be given, or Connection
+    * selection dialog shall be enabled.
+    * 
+    * @param aIap IAP id.
+    */
+    IMPORT_C void SetIapId( TUint32 aIapId );
+
+    /**
+    * Gets IAP id.
+    *
+    * @return IAP id.
+    */
+    IMPORT_C TUint32 IapId() const;
+
+    /**
+    * Sets bearer, use combination of TExtendedConnBearer values.
+    * Default value is KExtendedConnBearerUnknown.
+    *
+    * @param aBearerSet A set of bearers as a combination of
+    *                   TExtendedConnBearer values.
+    *                   Type is TUint32 due to bitfield character.
+    */
+    IMPORT_C void SetBearerSet( TUint32 aBearerSet );
+
+    /**
+    * Gets set of requested bearers.
+    *
+    * @return Set of requested bearers. Type is TUint32 due to bifield
+    *         character.
+    */
+    IMPORT_C TUint32 BearerSet() const;
+
+    /**
+    * Sets note behaviour, use combination of TNoteBehaviour values.
+    * Default value is ENoteBehaviourDefault.
+    * This method does not control connection selection dialog or disconnect
+    * dialog. There are own methods for these purposes in this API.
+    *
+    * @param aNoteBehaviour Note behaviour as a combination of TNoteBehaviour
+    *                       values. Type is TUint32 due to bitfield
+    *                       character.
+    */ 
+    IMPORT_C void SetNoteBehaviour( TUint32 aNoteBehaviour );
+
+    /**
+    * Gets note behaviour.
+    *
+    * @return Note behaviour as a combination of TNoteBehaviour values.
+    *         Type is TUint32 due to bitfield character.
+    */
+    IMPORT_C TUint32 NoteBehaviour() const;
+
+    /**
+    * Enables or disables Disconnect dialog.
+    * By default, Disconnect dialog is enabled.
+    *
+    * @param aEnableDisconnectDialog Indicates whether Disconnect dialog is
+    *                                enabled or disabled.
+    */
+    IMPORT_C void SetDisconnectDialog( TBool aEnableDisconnectDialog );
+
+    /**
+    * Indicates whether Disconnect dialog is enabled.
+    *
+    * @return Indicates whether Disconnect dialog is enabled.
+    */
+    IMPORT_C TBool DisconnectDialog() const;
+
+    /**
+    * Enables or disables Connection selection dialog. Only the SNAPs/IAPs
+    * matching with BearerSet are shown in the dialog.
+    * By default, Connection selection dialog is disabled.
+    *
+    * If Connection selection dialog is enabled, SNAP id shall be zero.
+    * If Connection selection dialog is enabled, IAP id shall be zero.
+    * If Connection selection dialog is enabled, SNAP purpose shall be
+    * CMManager::ESnapPurposeUnknown.
+    * Either SNAP purpose, SNAP id, or IAP id shall be given, or Connection
+    * selection dialog shall be enabled.
+    *
+    * @param aConnSelectionDialog Indicates whether Connection selection
+    *                             dialog is enabled or disabled.
+    */
+    IMPORT_C void SetConnSelectionDialog( TBool aConnSelectionDialog );
+
+    /**
+    * Indicates whether Connection selection dialog is enabled.
+    *
+    * @return Indicates whether Connection selection dialog is enabled.
+    */
+    IMPORT_C TBool ConnSelectionDialog() const;
+
+    /**
+    * Enables or disables forced roaming.
+    * By default, forced roaming is enabled.
+    * Forced roaming only applies on connections made to Internet SNAP.
+    * 
+    * Forced roaming means that the connection can be torn down by the
+    * middleware when better one is available. E.g., when known WLAN IAP
+    * becomes available, 3G connection is disconnected.
+    * 
+    * @param aForcedRoaming Indicates whether forced roaming is enabled or
+    *                       disabled.
+    */
+    IMPORT_C void SetForcedRoaming( TBool aForcedRoaming );
+
+    /**
+    * Indicates whether forced roaming is enabled.
+    *
+    * @return Indicates whether forced roaming is enabled.
+    */
+    IMPORT_C TBool ForcedRoaming() const;
+
+protected:
+    /** SMetaData implied functions */
+    EXPORT_DATA_VTABLE_AND_FN
+
+private:
+
+    /** SNAP purpose. */
+    CMManager::TSnapPurpose iSnapPurpose;
+    /** SNAP id. */
+    TUint32 iSnapId;
+    /** IAP id. */
+    TUint32 iIapId;
+    /** Bearer set. */
+    TUint32 iBearerSet;
+    /** Note behaviour. */
+    TUint32 iNoteBehaviour;
+    /** Indicates whether UI disconnect dialog is shown. */
+    TBool iDisconnectDialog;
+    /** Indicates whether UI connection selection dialog is shown. */    
+    TBool iConnSelectionDialog;
+    /** Indicates whether forced roaming is enabled. */
+    TBool iForcedRoaming;
+    };
+
+
+#endif __EXTENDEDCONNPREF_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_pub/group/bld.inf	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Includes all the SDK API specific bld.inf files, 
+*              which export files. 
+*
+*/
+
+#include "../connection_settings_api/group/bld.inf"
+#include "../access_point_engine_api/group/bld.inf"
+#include "../access_point_settings_handler_api/group/bld.inf"
+#include "../data_connection_log_counters_api/group/bld.inf"
+#include "../connection_monitor_server_api/group/bld.inf"
+#include "../connection_settings_ui_api/group/bld.inf"
+#include "../agent_dialog_api/group/bld.inf"
+#include "../extendedconnpref_api/group/bld.inf"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/layers.sysdef.xml	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<!DOCTYPE SystemDefinition SYSTEM "sysdef_1_4_0.dtd" [
+  <!ENTITY layer_real_source_path "sf/mw/ipconnmgmt" >
+]>
+
+<SystemDefinition name="ipconnmgmt" schema="1.4.0">
+  <systemModel>
+    <layer name="mw_layer">
+      <module name="ipconnmgmt">
+        <unit unitID="netdo.ipconnmgmt" mrp="" bldFile="&layer_real_source_path;/group" name="ipconnmgmt" />
+      </module>
+    </layer>
+  </systemModel>
+</SystemDefinition>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/package_definition.xml	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<SystemDefinition schema="3.0.0">
+  <package id="ipconnmgmt" name="IP Connectivity Management" levels="plugin framework server generic utils">
+    <collection id="alwayson_net_plugin" name="Always Online Net Plugin" level="server">
+      <component id="pdpcontextmanager2" filter="s60" name="PDP Context Manager 2">
+        <unit bldFile="alwayson_net_plugin/pdpcontextmanager2/group"/>
+      </component>
+    </collection>
+    <collection id="bearermanagement" name="Bearer Management" level="framework">
+      <component id="mpm" filter="s60" name="Mobility Policy Manager">
+        <unit bldFile="bearermanagement/mpm/group"/>
+      </component>
+      <component id="bearermanager" filter="s60" name="Bearer Manager">
+        <unit bldFile="bearermanagement/bearermanager/group"/>
+      </component>
+      <component id="bearermanagement_build" filter="s60" name="Bearer Management Build">
+		<!-- move exports into one of the other components and remove this one -->
+        <unit bldFile="bearermanagement/group"/>
+      </component>
+    </collection>
+    <collection id="connectionmonitoring" name="Connection Monitoring" level="server">
+      <component id="connectionmonitorplugin" filter="s60" name="Connection Monitor Plugin" class="plugin">
+        <unit bldFile="connectionmonitoring/connectionmonitorplugin/group"/>
+      </component>
+      <component id="connectionmonitorui" filter="s60" name="Connection Monitor UI">
+        <unit bldFile="connectionmonitoring/connectionmonitorui/group"/>
+      </component>
+      <component id="connmon" filter="s60" name="Connection Monitor">
+		<!-- either split into two components, or #include from a common bld.inf -->
+        <unit bldFile="connectionmonitoring/connmon/connectionmonitor/group"/>
+        <unit bldFile="connectionmonitoring/connmon/dataconnectionlogger/group"/>
+      </component>
+      <component id="connmonext" filter="s60" name="Connection Monitor Extension API">
+        <unit bldFile="connectionmonitoring/connmonext/group"/>
+      </component>
+    </collection>
+    <collection id="accesspointcontrol" name="Access Point Control" level="plugin">
+      <component id="apcontrollistplugin" filter="s60" name="Access Point Control List Plugin" class="plugin" introduced="^2">
+        <unit bldFile="accesspointcontrol/apcontrollistplugin/group"/>
+      </component>
+    </collection>
+    <collection id="apengine" name="Access Point Engine" level="framework">
+      <component id="apeng" filter="s60" name="Access Point Engine">
+        <unit bldFile="apengine/apeng/group"/>
+      </component>
+      <component id="apsettingshandlerui" filter="s60" name="Access Point Settings Handler UI">
+        <unit bldFile="apengine/apsettingshandlerui/group"/>
+      </component>
+      <component id="apsettingsplugin" filter="s60" name="Access Point Settings Plugin" class="plugin">
+        <unit bldFile="apengine/apsettingsplugin/group"/>
+      </component>
+    </collection>
+    <collection id="cmmanager" name="Connection Method Manager" level="framework">
+      <component id="cmmgr" filter="s60" name="CM Manager">
+        <unit bldFile="cmmanager/cmmgr/group"/>
+      </component>
+    </collection>
+    <collection id="dbcreator" name="DB Creator" level="utils">
+      <component id="commsdatcreator" filter="s60" name="Comms Database Creator" introduced="9.3">
+        <unit bldFile="dbcreator/commsdatcreator/group"/>
+      </component>
+      <component id="commsdatcreatorrfsplugin" filter="s60" name="Comms Database Creator RFS Plugin" class="plugin" introduced="9.3">
+        <unit bldFile="dbcreator/commsdatcreatorrfsplugin/group"/>
+      </component>
+      <component id="commsdatstartup" filter="s60" name="Comms Database Startup" introduced="9.3">
+        <unit bldFile="dbcreator/commsdatstartup/group"/>
+      </component>
+      <component id="dbcreatorexe" filter="s60" name="DB Creator" introduced="9.3">
+        <unit bldFile="dbcreator/dbcreatorexe/group"/>
+      </component>
+      <component id="dbcreator_build" filter="s60" name="DB Creator Build" introduced="9.3">
+		<!-- consider moving exports to another component and getting rid of this one -->
+        <unit bldFile="dbcreator/group"/>
+      </component>
+    </collection>
+    <collection id="connectionutilities" name="Connection Utilities" level="utils">
+      <component id="connectiondialogs" filter="s60" name="Connection Dialogs">
+        <unit bldFile="connectionutilities/connectiondialogs/group"/>
+      </component>
+    </collection>
+    <collection id="ipconnmgmt_info" name="IP Connectivity Management Info" level="utils">
+      <component id="ipcm_pub" filter="s60" class="api" name="IP Connectivity Management Public Interfaces">
+        <unit bldFile="ipcm_pub/group"/>
+      </component>
+      <component id="ipcm_plat" filter="s60" class="api" name="IP Connectivity Management Platform Interfaces">
+        <unit bldFile="ipcm_plat/group"/>
+      </component>
+    </collection>
+  </package>
+</SystemDefinition>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysdef_1_4_0.dtd	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,86 @@
+ <!ELEMENT SystemDefinition (systemModel?, build?)>
+ <!ATTLIST SystemDefinition
+  name CDATA #REQUIRED
+  schema CDATA #REQUIRED>
+ <!ELEMENT systemModel (layer+)>
+ <!ELEMENT layer (logicalset* | module*)*>
+ <!ATTLIST layer
+  name CDATA #REQUIRED
+  levels CDATA #IMPLIED
+  span CDATA #IMPLIED>
+ <!ELEMENT logicalset (logicalsubset* | module* | unit* | package* | prebuilt*)*>
+ <!ATTLIST logicalset name CDATA #REQUIRED>
+ <!ELEMENT logicalsubset (module* | unit* | package* | prebuilt*)*>
+ <!ATTLIST logicalsubset name CDATA #REQUIRED>
+ <!ELEMENT module (component* | unit* | package* | prebuilt*)*>
+ <!ATTLIST module
+  name CDATA #REQUIRED
+  level CDATA #IMPLIED>
+ <!ELEMENT component (unit* | package* | prebuilt*)*>
+ <!ATTLIST component name CDATA #REQUIRED>
+ <!ELEMENT unit EMPTY>
+ <!ATTLIST unit
+  unitID ID #REQUIRED
+  name CDATA #REQUIRED
+  mrp CDATA #REQUIRED
+  filter CDATA #IMPLIED
+  bldFile CDATA #REQUIRED
+  priority CDATA #IMPLIED
+  contract CDATA #IMPLIED>
+ <!ELEMENT package EMPTY>
+ <!ATTLIST package
+  name CDATA #REQUIRED
+  mrp CDATA #REQUIRED
+  filter CDATA #IMPLIED
+  contract CDATA #IMPLIED>
+ <!ELEMENT prebuilt EMPTY>
+ <!ATTLIST prebuilt
+  name CDATA #REQUIRED
+  version CDATA #REQUIRED
+  late (Y|N) #IMPLIED
+  filter CDATA #IMPLIED
+  contract CDATA #IMPLIED>
+ <!ELEMENT build (option* | target+ | targetList+ | unitList+ | configuration+)*>
+ <!ELEMENT unitList (unitRef+)>
+ <!ATTLIST unitList
+  name ID #REQUIRED
+  description CDATA #REQUIRED>
+ <!ELEMENT unitRef EMPTY>
+ <!ATTLIST unitRef unit IDREF #REQUIRED>
+ <!ELEMENT targetList EMPTY>
+ <!ATTLIST targetList
+  name ID #REQUIRED
+  description CDATA #REQUIRED
+  target IDREFS #REQUIRED>
+ <!ELEMENT target EMPTY>
+ <!ATTLIST target
+  name ID #REQUIRED
+  abldTarget CDATA #REQUIRED
+  description CDATA #REQUIRED>
+ <!ELEMENT option EMPTY>
+ <!ATTLIST option
+  name ID #REQUIRED
+  abldOption CDATA #REQUIRED
+  description CDATA #REQUIRED
+  enable (Y | N | y | n) #REQUIRED>
+ <!ELEMENT configuration (unitListRef+ | layerRef+ | task+)*>
+ <!ATTLIST configuration
+  name ID #REQUIRED
+  description CDATA #REQUIRED
+  filter CDATA #REQUIRED>
+ <!ELEMENT task ( unitListRef* , (buildLayer | specialInstructions))>
+ <!ELEMENT unitListRef EMPTY>
+ <!ATTLIST unitListRef unitList IDREF #REQUIRED>
+ <!ELEMENT layerRef EMPTY>
+ <!ATTLIST layerRef layerName CDATA #REQUIRED>
+ <!ELEMENT buildLayer EMPTY>
+ <!ATTLIST buildLayer
+  command CDATA #REQUIRED
+  targetList IDREFS #IMPLIED
+  unitParallel (Y | N | y | n) #REQUIRED
+  targetParallel (Y | N | y | n) #IMPLIED>
+ <!ELEMENT specialInstructions EMPTY>
+ <!ATTLIST specialInstructions
+  name CDATA #REQUIRED
+  cwd CDATA #REQUIRED
+  command CDATA #REQUIRED>